bootlog: make a copy for use in gintctl

This commit is contained in:
lephe 2019-05-04 12:07:14 +02:00
parent e48386d2a4
commit 05f2e01b50
6 changed files with 30 additions and 10 deletions

View File

@ -20,6 +20,9 @@ void *memset(void *dest, int byte, size_t n);
/* strlen() - length of a NUL-terminated string */
size_t strlen(const char *str);
/* strncpy() - copy a string with a size limit*/
char *strncpy(char *dst, const char *src, size_t n);
/* vsprintf() - an almost-empty subset of the real one */
void vsprintf(char *str, const char *format, va_list args);

View File

@ -12,16 +12,16 @@
// Driver procedure flow
//
// Drivers are initialized in priority order, and in linking order within
// the same priority (which is pretty much undefined). Make sure every
// the same priority level (pretty much undefined). Make sure every
// driver's priority level is higher than those of its dependencies.
//
// At initialization, the following functions are called:
// 1. driver_sh3() [if not NULL, SH3 fx9860G only]
// 1. driver_sh3() [if not NULL, SH3 fx9860g only]
// 2. ctx_save(sys_ctx) [if not NULL]
// 3. init() [if not NULL]
//
// Then, if the on-screen boot log is enabled, the status() function is
// called and the returned function is displayed (21 characters max).
// called and the returned string is displayed (21 characters max).
// 4. status() [if not NULL, if GINT_BOOT_LOG is defined]
//
// If the gint_switch() function is called to temporarily give back

View File

@ -9,7 +9,7 @@
/* GINT_VERSION - the library version number
gint is versioned from it's repository commits on the master branch. The
gint is versioned from its repository commits on the master branch. The
GINT_VERSION integer contains the short commit hash.
For instance, 0x03f7c0a0 means commit 3f7c0a0. */

View File

@ -14,14 +14,19 @@
#include <core/syscalls.h>
#include <gint/clock.h>
#ifdef GINT_BOOT_LOG
#ifdef FXCG50
void Bdisp_AllClr_VRAM(void);
void Bdisp_PutDisp_DD(void);
void PrintXY(int x, int y, const char *str, int fg, int bg);
#define dclear(c) Bdisp_AllClr_VRAM()
#define dupdate() Bdisp_PutDisp_DD()
#endif
/* A copy of the bootlog */
GDATA char gint_bootlog[22*9] = { 0 };
/* Linker script symbols - see core/start.c for details */
extern char
brom, srom,
@ -38,13 +43,15 @@ static void print(int x, int y, const char *format, ...)
vsprintf(str + 2, format, args);
#ifdef FX9860G
dtext(6 * (x - 1) + 1, 7 * (y - 1), str + 2, color_black, color_white);
dtext(6 * (x-1) + 1, 7 * (y-1), str + 2, color_black, color_white);
#endif
#ifdef FXCG50
PrintXY(x, y, str, 0, 0);
#endif
strncpy(gint_bootlog + 22 * (y-1) + (x-1), str + 2, 21 - (x-1));
va_end(args);
}
@ -90,7 +97,7 @@ void bootlog_loaded(void)
/* bootlog_mapped() - ROM mapping stage */
GSECTION(".pretext")
void bootlog_mapped(int rom, int ram)
void bootlog_mapped(int rom, GUNUSED int ram)
{
/* Check whether all ROM is mapped */
uint32_t rom_size = (uint32_t)&srom;
@ -186,3 +193,5 @@ void bootlog_driver_summary(void)
dupdate();
}
#endif /* GINT_BOOT_LOG */

View File

@ -2,6 +2,7 @@
#include <gint/mpu/dma.h>
#include <gint/mpu/power.h>
#include <gint/mpu/intc.h>
#include <gint/gint.h>
#include <gint/dma.h>
#include <gint/drivers.h>
#include <gint/clock.h>

View File

@ -13,13 +13,20 @@ GWEAK size_t strlen(const char *str)
return len;
}
GWEAK char *strncpy(char *dst, const char *src, size_t n)
{
size_t i = 0;
while(i < n && (dst[i] = src[i])) i++;
return dst;
}
/* vsprintf() - a trimmed-down version of the function
This function supports formats '%%', '%nd', '%nx' and '%s' where 'n' is a
1-digit size, and is mandatory. For '%d' and '%x', '0' is always set.
This function supports formats '%%', '%<n>d', '%<n>x' and '%s' where 'n' is
a 1-digit size, and is mandatory. For '%d' and '%x', flag '0' is always set.
Always outputs exactly the requested number of characters, even if it's not
enough to completely print the value.
Does whatever it wants if the format is invalid. This is really a basic
function to format output without needing 18 kB of code. */
function to format output without needing 18 kB of fxlib code. */
GWEAK void vsprintf(char *str, const char *format, va_list args)
{
#define in() (c = *format++)