mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
Compare commits
5 commits
b0c4e6fd2f
...
aba6c280b6
Author | SHA1 | Date | |
---|---|---|---|
|
aba6c280b6 | ||
|
979873288a | ||
|
6ebfe8484e | ||
|
93329ab697 | ||
|
85e50658ea |
9 changed files with 85 additions and 7 deletions
|
@ -23,6 +23,8 @@ endif()
|
||||||
configure_file(include/gint/config.h.in include/gint/config.h)
|
configure_file(include/gint/config.h.in include/gint/config.h)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
# Hardware Abstraction Layer for the standard library
|
||||||
|
src/fxlibc_hal.c
|
||||||
# Clock Pulse Generator driver
|
# Clock Pulse Generator driver
|
||||||
src/cpg/cpg.c
|
src/cpg/cpg.c
|
||||||
src/cpg/overclock.c
|
src/cpg/overclock.c
|
||||||
|
@ -261,7 +263,7 @@ fxconv_declare_assets(${ASSETS_FX} ${ASSETS_CG})
|
||||||
include_directories(
|
include_directories(
|
||||||
"${PROJECT_SOURCE_DIR}/include"
|
"${PROJECT_SOURCE_DIR}/include"
|
||||||
"${PROJECT_BINARY_DIR}/include")
|
"${PROJECT_BINARY_DIR}/include")
|
||||||
add_compile_options(-Wall -Wextra -std=c11 -Os -g -fstrict-volatile-bitfields -mtas -ffreestanding -flto)
|
add_compile_options(-Wall -Wextra -std=c11 -Os -g -fstrict-volatile-bitfields -mtas -flto)
|
||||||
|
|
||||||
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
if("${FXSDK_PLATFORM_LONG}" STREQUAL fx9860G)
|
||||||
add_compile_definitions(FX9860G)
|
add_compile_definitions(FX9860G)
|
||||||
|
|
|
@ -43,7 +43,10 @@ SECTIONS
|
||||||
- All text from .text and .text.* (including user code) */
|
- All text from .text and .text.* (including user code) */
|
||||||
.hh2 : {
|
.hh2 : {
|
||||||
KEEP(*(.hh2.header))
|
KEEP(*(.hh2.header))
|
||||||
KEEP(*(.hh2.info))
|
KEEP(*(.hh2.info.name))
|
||||||
|
KEEP(*(.hh2.info.description))
|
||||||
|
KEEP(*(.hh2.info.author))
|
||||||
|
KEEP(*(.hh2.info.version))
|
||||||
KEEP(*(.hh2.stage2))
|
KEEP(*(.hh2.stage2))
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
} > eram AT> bin
|
} > eram AT> bin
|
||||||
|
|
|
@ -80,4 +80,26 @@
|
||||||
#define GINT_RENDER_MONO (GINT_HW_FX || GINT_FX9860G_G3A)
|
#define GINT_RENDER_MONO (GINT_HW_FX || GINT_FX9860G_G3A)
|
||||||
#define GINT_RENDER_RGB ((GINT_HW_CG || GINT_HW_CP) && !GINT_FX9860G_G3A)
|
#define GINT_RENDER_RGB ((GINT_HW_CG || GINT_HW_CP) && !GINT_FX9860G_G3A)
|
||||||
|
|
||||||
|
/* Macros for specifying HH2 binary metadata fields. Here because this header
|
||||||
|
is guaranteed to be included with every gint header. */
|
||||||
|
#if GINT_HW_CP
|
||||||
|
#define HH2_NAME(STR) \
|
||||||
|
GSECTION(".hh2.info.name") GVISIBLE \
|
||||||
|
char _hh2info_name[] = (STR);
|
||||||
|
#define HH2_DESCRIPTION(STR) \
|
||||||
|
GSECTION(".hh2.info.description") GVISIBLE \
|
||||||
|
char _hh2info_description[] = (STR);
|
||||||
|
#define HH2_AUTHOR(STR) \
|
||||||
|
GSECTION(".hh2.info.author") GVISIBLE \
|
||||||
|
char _hh2info_author[] = (STR);
|
||||||
|
#define HH2_VERSION(STR) \
|
||||||
|
GSECTION(".hh2.info.version") GVISIBLE \
|
||||||
|
char _hh2info_version[] = (STR);
|
||||||
|
#else
|
||||||
|
#define HH2_NAME(STR)
|
||||||
|
#define HH2_DESCRIPTION(STR)
|
||||||
|
#define HH2_AUTHOR(STR)
|
||||||
|
#define HH2_VERSION(STR)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* GINT_CONFIG */
|
#endif /* GINT_CONFIG */
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#ifndef GINT_DEFS_CALL
|
#ifndef GINT_DEFS_CALL
|
||||||
#define GINT_DEFS_CALL
|
#define GINT_DEFS_CALL
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,6 +40,7 @@ typedef union {
|
||||||
type volatile const *name ## _cv;
|
type volatile const *name ## _cv;
|
||||||
|
|
||||||
POINTER(void, pv)
|
POINTER(void, pv)
|
||||||
|
POINTER(bool, pb)
|
||||||
POINTER(char, pc)
|
POINTER(char, pc)
|
||||||
POINTER(unsigned char, puc)
|
POINTER(unsigned char, puc)
|
||||||
POINTER(short, ps)
|
POINTER(short, ps)
|
||||||
|
|
40
src/fxlibc_hal.c
Normal file
40
src/fxlibc_hal.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* Hardware Abstraction Layer (HAL) implementation for fxlibc. We can group
|
||||||
|
this in a single file because LTO will prune away unused functions. */
|
||||||
|
|
||||||
|
#include <fxlibc/hal.h>
|
||||||
|
#include <gint/rtc.h>
|
||||||
|
#include <gint/kmalloc.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
void *fxlibc_hal_malloc(size_t size)
|
||||||
|
{
|
||||||
|
return kmalloc(size, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fxlibc_hal_free(void *ptr)
|
||||||
|
{
|
||||||
|
return kfree(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *fxlibc_hal_realloc(void *ptr, size_t size)
|
||||||
|
{
|
||||||
|
return krealloc(ptr, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fxlibc_hal_rawtime(struct tm *tm)
|
||||||
|
{
|
||||||
|
rtc_time_t rtc;
|
||||||
|
rtc_get_time(&rtc);
|
||||||
|
tm->tm_sec = rtc.seconds;
|
||||||
|
tm->tm_min = rtc.minutes;
|
||||||
|
tm->tm_hour = rtc.hours;
|
||||||
|
tm->tm_mday = rtc.month_day;
|
||||||
|
tm->tm_mon = rtc.month;
|
||||||
|
tm->tm_year = rtc.year - 1900;
|
||||||
|
tm->tm_isdst = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
clock_t fxlibc_hal_clock(void)
|
||||||
|
{
|
||||||
|
return (CLOCKS_PER_SEC * (uint64_t)rtc_ticks()) / 128;
|
||||||
|
}
|
|
@ -629,7 +629,7 @@ static bool gdb_handle_stubcall(gdb_cpu_state_t* cpu_state)
|
||||||
int sc_num = cpu_state->reg.r3;
|
int sc_num = cpu_state->reg.r3;
|
||||||
|
|
||||||
if(sc_num == 64) { /* write */
|
if(sc_num == 64) { /* write */
|
||||||
int len = snprintf(str, sizeof str, "Fwrite,%x,%08x,%x",
|
int len = snprintf(str, sizeof str, "Fwrite,%lx,%08lx,%lx",
|
||||||
cpu_state->reg.r4,
|
cpu_state->reg.r4,
|
||||||
cpu_state->reg.r5,
|
cpu_state->reg.r5,
|
||||||
cpu_state->reg.r6);
|
cpu_state->reg.r6);
|
||||||
|
|
|
@ -122,4 +122,12 @@ _stage2:
|
||||||
it's overriding the correct location. */
|
it's overriding the correct location. */
|
||||||
.long 1, 2, 3, 4, 5, 6, 7, 8
|
.long 1, 2, 3, 4, 5, 6, 7, 8
|
||||||
|
|
||||||
|
/* Also provide default values for metadata fields. */
|
||||||
|
|
||||||
|
.section .hh2.info.name
|
||||||
|
.global __hh2info_name
|
||||||
|
.weak __hh2info_name
|
||||||
|
/* Zero byte will skip specifiying any of the data */
|
||||||
|
__hh2info_name: .byte 0x00
|
||||||
|
|
||||||
#endif /* GINT_OS_CP */
|
#endif /* GINT_OS_CP */
|
||||||
|
|
|
@ -247,7 +247,7 @@ static void prepend_link(block_t *b, index_t *index)
|
||||||
//---
|
//---
|
||||||
|
|
||||||
/* Round a size to the closest allocatable size */
|
/* Round a size to the closest allocatable size */
|
||||||
static size_t round(size_t size)
|
static size_t round_size(size_t size)
|
||||||
{
|
{
|
||||||
return (size < 8) ? 8 : ((size + 3) & ~3);
|
return (size < 8) ? 8 : ((size + 3) & ~3);
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ static void *gint_malloc(size_t size, void *data)
|
||||||
{
|
{
|
||||||
index_t *index = data;
|
index_t *index = data;
|
||||||
stats_t *s = index->stats;
|
stats_t *s = index->stats;
|
||||||
size = round(size);
|
size = round_size(size);
|
||||||
int c = size_class(size);
|
int c = size_class(size);
|
||||||
|
|
||||||
/* Try to find a class that has a free block available */
|
/* Try to find a class that has a free block available */
|
||||||
|
@ -330,7 +330,7 @@ static void *gint_realloc(void *ptr, size_t size, void *data)
|
||||||
index_t *index = data;
|
index_t *index = data;
|
||||||
stats_t *s = index->stats;
|
stats_t *s = index->stats;
|
||||||
block_t *b = ptr - sizeof(block_t);
|
block_t *b = ptr - sizeof(block_t);
|
||||||
size = round(size);
|
size = round_size(size);
|
||||||
int size_before = b->size;
|
int size_before = b->size;
|
||||||
|
|
||||||
/* When requesting a smaller size, split the original block */
|
/* When requesting a smaller size, split the original block */
|
||||||
|
|
|
@ -539,7 +539,7 @@ static void USB_LOG_TR(char const *p, asyncio_op_t *t, char const *fmt, ...)
|
||||||
if(t->shbuf_size >= 4)
|
if(t->shbuf_size >= 4)
|
||||||
sprintf(shbuf, "!!%d", t->shbuf_size);
|
sprintf(shbuf, "!!%d", t->shbuf_size);
|
||||||
else
|
else
|
||||||
snprintf(shbuf, t->shbuf_size * 2 + 1, "%08x", t->shbuf);
|
snprintf(shbuf, t->shbuf_size * 2 + 1, "%08lx", t->shbuf);
|
||||||
|
|
||||||
char str[128];
|
char str[128];
|
||||||
snprintf(str, sizeof str - 1, "%s: %s buf=%d%s%s req=%d/%d%s |%s| ",
|
snprintf(str, sizeof str - 1, "%s: %s buf=%d%s%s req=%d/%d%s |%s| ",
|
||||||
|
|
Loading…
Reference in a new issue