Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ee/debug/src/font.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <tamtypes.h>

u8 msx[]=
const u8 msx[]=
"\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x42\xa5\x81\xa5\x99\x42\x3c"
"\x3c\x7e\xdb\xff\xff\xdb\x66\x3c\x6c\xfe\xfe\xfe\x7c\x38\x10\x00"
"\x10\x38\x7c\xfe\x7c\x38\x10\x00\x10\x38\x54\xfe\x54\x10\x38\x00"
Expand Down
62 changes: 36 additions & 26 deletions ee/debug/src/scr_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include <debug.h>
#include <ee_regs.h>

static short int X = 0, Y = 0;
static short int MX = 80, MY = 40;
static u32 bgcolor = 0, fontcolor = 0xffffff, cursorcolor = 0xffffff;
static short int cursor = 1;
static short int X, Y;
static const short int MX = 80, MY = 40;
static u32 bgcolor, fontcolor, cursorcolor;
static short int cursor;

struct t_setupscr
{
Expand Down Expand Up @@ -111,7 +111,7 @@ static void DmaReset(void)
* @param size The size (in 16 byte quads) of the data to be transfered.
*/

static inline void progdma(void *addr, int size)
static inline void progdma(const void *addr, int size)
{
*R_EE_D2_QWC = (u32)size; // D2_QWC
*R_EE_D2_MADR = (u32)addr; // D2_MADR
Expand All @@ -133,19 +133,26 @@ void scr_setcursorcolor(u32 color)
cursorcolor = color;
}

static const struct t_setupscr g_setupscr_template = {
{0x100000000000800E, 0xE, 0xA0000, 0x4C, 0x8C, 0x4E}, // GIFtag (REGS: A+D, NREG 1, FLG PACKED, EOP, NLOOP 14), FRAME_1 (PSM PSMCT32, FBW 10, FBP 0), ZBUF_1 (PSM PSMZ32, ZBP 140)
{27648, 30976},
{0x18}, // XYOFFSET_1 (OFX 1728.0, OFY 1936.0)
{0, 639, 0, 223}, // SCISSOR_1 (SCAX0 0, SCAX1 639, SCAY0 0, SCAY1 223)
{0x40, 1, 0x1a, 1, 0x46, 0, 0x45, 0x70000, // PRMODECONT (AC PRIM), COLCLAMP (CLAMP 1), DTHE (DTHE 0)
0x47, 0x30000, 0x47, 6, 0, 0x3F80000000000000, 1, 0x79006C00, 5, // TEST_1 (ZTST GREATER, ZTE 1), TEST_1 (ZTST ALWAYS, ZTE 1), PMODE (CRTMD 1, EN2 1), RGBAQ (Q 1.0, A 0, B 0, G 0, R 0), XYZ2 (Z 0.0, Y 1728.0, X 1936.0)
0x87009400, 5, 0x70000, 0x47} // XYZ2 (Z 0, Y 2160.0, X 2368.0), TEST_1 (ZTST GREATER, ZTE 1)
};

void init_scr(void)
{
static struct t_setupscr setupscr __attribute__((aligned(16))) = {
{0x100000000000800E, 0xE, 0xA0000, 0x4C, 0x8C, 0x4E}, // GIFtag (REGS: A+D, NREG 1, FLG PACKED, EOP, NLOOP 14), FRAME_1 (PSM PSMCT32, FBW 10, FBP 0), ZBUF_1 (PSM PSMZ32, ZBP 140)
{27648, 30976},
{0x18}, // XYOFFSET_1 (OFX 1728.0, OFY 1936.0)
{0, 639, 0, 223}, // SCISSOR_1 (SCAX0 0, SCAX1 639, SCAY0 0, SCAY1 223)
{0x40, 1, 0x1a, 1, 0x46, 0, 0x45, 0x70000, // PRMODECONT (AC PRIM), COLCLAMP (CLAMP 1), DTHE (DTHE 0)
0x47, 0x30000, 0x47, 6, 0, 0x3F80000000000000, 1, 0x79006C00, 5, // TEST_1 (ZTST GREATER, ZTE 1), TEST_1 (ZTST ALWAYS, ZTE 1), PMODE (CRTMD 1, EN2 1), RGBAQ (Q 1.0, A 0, B 0, G 0, R 0), XYZ2 (Z 0.0, Y 1728.0, X 1936.0)
0x87009400, 5, 0x70000, 0x47} // XYZ2 (Z 0, Y 2160.0, X 2368.0), TEST_1 (ZTST GREATER, ZTE 1)
};
static struct t_setupscr setupscr __attribute__((aligned(16)));

*((struct t_setupscr *)UNCACHED_SEG(&setupscr)) = g_setupscr_template;
X = Y = 0;
scr_setbgcolor(0);
scr_setfontcolor(0xffffff);
scr_setcursorcolor(0xffffff);
scr_setCursor(1);
DmaReset();

Init_GS(1, debug_detect_signal() == 1 ? 3 : 2, 0); // Interlaced, NTSC/PAL and FIELD mode
Expand All @@ -156,25 +163,28 @@ void init_scr(void)
Dma02Wait();
}

extern u8 msx[];
extern const u8 msx[];

static const struct t_setupchar g_setupchar_template = {
{0x1000000000000004, 0xE, 0xA000000000000, 0x50}, // GIFtag (REGS: A+D, NREG 1, FLG PACKED, NLOOP 4), BITBLTBUF (DPSM PSMCT32, DBW 10, DBP 0)
{0},
100,
100,
{0x51}, // TRXPOS (DSAX 100, DSAY 100)
{8, 8}, // TRXREG (RRW 8, RRH 8)
{0x52, 0, 0x53, 0x800000000008010, 0} // TRXDIR (XDIR Host -> Local), GIFtag (FLG IMAGE, EOP, NLOOP 16)
};

void scr_putchar(int x, int y, u32 color, int ch)
{
static struct t_setupchar setupchar __attribute__((aligned(16))) = {
{0x1000000000000004, 0xE, 0xA000000000000, 0x50}, // GIFtag (REGS: A+D, NREG 1, FLG PACKED, NLOOP 4), BITBLTBUF (DPSM PSMCT32, DBW 10, DBP 0)
{0},
100,
100,
{0x51}, // TRXPOS (DSAX 100, DSAY 100)
{8, 8}, // TRXREG (RRW 8, RRH 8)
{0x52, 0, 0x53, 0x800000000008010, 0} // TRXDIR (XDIR Host -> Local), GIFtag (FLG IMAGE, EOP, NLOOP 16)
};
/* charmap must be aligned to a 16-bye boundary. */
static struct t_setupchar setupchar __attribute__((aligned(16)));
/* charmap must be aligned to a 16-byte boundary. */
static u32 charmap[64] __attribute__((aligned(16)));
int i, j, l;
u8 *font;
const u8 *font;
u32 pixel;

*((struct t_setupchar *)UNCACHED_SEG(&setupchar)) = g_setupchar_template;
((struct t_setupchar *)UNCACHED_SEG(&setupchar))->x = x;
((struct t_setupchar *)UNCACHED_SEG(&setupchar))->y = y;

Expand Down
2 changes: 1 addition & 1 deletion ee/draw/include/draw3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extern "C" {
#endif

/** Begins a primitive, allowing for vertex data to be filled in the packet directly */
extern qword_t *draw_prim_start(qword_t *q, int context, prim_t *prim, color_t *color);
extern qword_t *draw_prim_start(qword_t *q, int context, const prim_t *prim, const color_t *color);

/** Ends a primitive by calculating the number of qwords used, the number of registers, the register list */
extern qword_t *draw_prim_end(qword_t *q,int nreg, u64 reglist);
Expand Down
2 changes: 1 addition & 1 deletion ee/draw/samples/teapot/teapot.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void flip_buffers(packet_t *flip,framebuffer_t *frame)

}

qword_t *render_teapot(qword_t *q,MATRIX view_screen, VECTOR object_position, VECTOR object_rotation, prim_t *prim, color_t *color, framebuffer_t *frame, zbuffer_t *z)
qword_t *render_teapot(qword_t *q,MATRIX view_screen, VECTOR object_position, VECTOR object_rotation, const prim_t *prim, const color_t *color, framebuffer_t *frame, zbuffer_t *z)
{

int i;
Expand Down
2 changes: 1 addition & 1 deletion ee/draw/src/draw3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// Starting position of primitive
static qword_t *__prim_start = NULL;

qword_t *draw_prim_start(qword_t *q, int context, prim_t *prim, color_t *color)
qword_t *draw_prim_start(qword_t *q, int context, const prim_t *prim, const color_t *color)
{

// Set the primitive register in packed mode, but don't end the packet
Expand Down
8 changes: 5 additions & 3 deletions ee/erl/src/erl.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ static char * reloc_types[] = {

/* These global names will not be 'exported' to the global space. */

static const char * local_names[] = {
static const char * const local_names[] = {
"_init",
"_fini",
"erl_id",
Expand Down Expand Up @@ -538,7 +538,7 @@ static int fix_loosy(struct erl_record_t * provider, const char * symbol, u32 ad
}

static int is_local(const char * symbol) {
const char ** p;
const char * const * p;

for (p = local_names; *p; p++)
if (!strcmp(*p, symbol))
Expand Down Expand Up @@ -962,7 +962,7 @@ static struct erl_record_t * _init_load_erl_wrapper_from_file(char * erl_id) {
return _init_load_erl_from_file(tmpnam, erl_id);
}

erl_loader_t _init_load_erl = _init_load_erl_wrapper_from_file;
erl_loader_t _init_load_erl;

static struct erl_record_t * load_erl(const char * fname, u8 * elf_mem, u32 addr, int argc, char ** argv) {
struct erl_record_t * r;
Expand Down Expand Up @@ -1007,6 +1007,8 @@ static struct erl_record_t * load_erl(const char * fname, u8 * elf_mem, u32 addr
dprintf("erl_dependancies = %08X.\n", r->dependancies);

if (r->dependancies) {
if (!_init_load_erl)
_init_load_erl = _init_load_erl_wrapper_from_file;
char ** d;
for (d = r->dependancies; *d; d++) {
dprintf("Loading dependancy: %s.\n", *d);
Expand Down
6 changes: 3 additions & 3 deletions ee/font/include/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ extern int fontx_load(const char *path, fontx_t* fontx, int type, int wmargin, i
extern void fontx_unload(fontx_t *fontx);

/** Prints an ascii/JISX201 formatted string */
extern qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *fontx);
extern qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, const color_t *c0, fontx_t *fontx);

/** Prints a SJIS formatted string */
extern qword_t *fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *ascii, fontx_t *kanji);
extern qword_t *fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, const color_t *c0, fontx_t *ascii, fontx_t *kanji);

// FontStudio type fonts

Expand All @@ -105,7 +105,7 @@ extern char *fontstudio_load_ini(const char *path);
extern void fontstudio_unload_ini(fsfont_t *font);

/** Prints a unicode formatted string (UTF+8) */
extern qword_t *fontstudio_print_string(qword_t *q, int context, const unsigned char *string, int alignment, const vertex_t *v0, color_t *c0, fsfont_t *font);
extern qword_t *fontstudio_print_string(qword_t *q, int context, const unsigned char *string, int alignment, const vertex_t *v0, const color_t *c0, fsfont_t *font);

#ifdef __cplusplus
}
Expand Down
8 changes: 4 additions & 4 deletions ee/font/src/fontx.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ typedef struct {
} block[];
} fontx_hdr;

static prim_t charprim =
static const prim_t charprim =
{
PRIM_POINT, PRIM_SHADE_FLAT, DRAW_DISABLE,
DRAW_DISABLE, DRAW_ENABLE, DRAW_DISABLE,
PRIM_MAP_ST, PRIM_UNFIXED
};

// These are the SJIS table ranges for character lookup
unsigned short sjis_table[] = {
static const unsigned short sjis_table[] = {
0x8140,0x817e,
0x8180,0x81ac,
0x81b8,0x81bf,
Expand Down Expand Up @@ -556,7 +556,7 @@ qword_t *draw_fontx_char(qword_t *q, unsigned short c, vertex_t *v0, fontx_t *fo

}

qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *fontx)
qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, const color_t *c0, fontx_t *fontx)
{

int i,j;
Expand Down Expand Up @@ -732,7 +732,7 @@ qword_t *fontx_print_ascii(qword_t *q, int context, const unsigned char *str, in

}

qword_t *fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fontx_t *ascii, fontx_t *kanji)
qword_t *fontx_print_sjis(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, const color_t *c0, fontx_t *ascii, fontx_t *kanji)
{

int i,j;
Expand Down
4 changes: 2 additions & 2 deletions ee/font/src/fsfont.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <font.h>

static prim_t charprim =
static const prim_t charprim =
{
PRIM_SPRITE, PRIM_SHADE_FLAT, DRAW_ENABLE,
DRAW_DISABLE, DRAW_ENABLE, DRAW_DISABLE,
Expand Down Expand Up @@ -453,7 +453,7 @@ qword_t *draw_fontstudio_char(qword_t *q, unsigned int c, vertex_t *v0, fsfont_t

}

qword_t *fontstudio_print_string(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, color_t *c0, fsfont_t *font)
qword_t *fontstudio_print_string(qword_t *q, int context, const unsigned char *str, int alignment, const vertex_t *v0, const color_t *c0, fsfont_t *font)
{

int i = 0,j;
Expand Down
8 changes: 0 additions & 8 deletions ee/graph/include/graph.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@
#define GRAPH_BLEND_RC2 0
#define GRAPH_BLEND_BGCOLOR 1

typedef struct {
int x,y;
int width, height;
int mode;
} GRAPH_MODE;

extern GRAPH_MODE graph_mode[];

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
18 changes: 10 additions & 8 deletions ee/graph/src/graph_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@
#include <graph.h>
#include <graph_config.h>

typedef struct {
int x,y;
int width, height;
int mode;
} GRAPH_MODE;

/* y offset is non-interlaced */
GRAPH_MODE graph_mode[22] =
static const GRAPH_MODE graph_mode[22] =
{

{ 0, 0, 0, 0, 0 }, // AUTO
Expand Down Expand Up @@ -39,7 +45,6 @@ GRAPH_MODE graph_mode[22] =

static float graph_width = 0.0f;
static float graph_height = 0.0f;
static float graph_aspect = 1.0f;

static int graph_filter = 0;
static int graph_crtmode = 0;
Expand All @@ -53,7 +58,7 @@ static int graph_magv = 0;
static u64 graph_pmode = 0;

// old bios has GCONT enabled
u64 smode1_values[22] =
static const u64 smode1_values[22] =
{

0,
Expand Down Expand Up @@ -405,6 +410,7 @@ void graph_set_smode1(char cmod, char gcont)

float graph_aspect_ratio(void)
{
float graph_aspect;

// Get the tv screen type as defined in the osd configuration.
if (configGetTvScreenType() == TV_SCREEN_169)
Expand All @@ -421,10 +427,7 @@ float graph_aspect_ratio(void)
}

// Return the current aspect ratio
graph_aspect = graph_aspect * (graph_height / graph_width);

return graph_aspect;

return graph_aspect * (graph_height / graph_width);
}

int graph_get_config(char *config)
Expand All @@ -446,7 +449,6 @@ int graph_shutdown(void)
*GS_REG_CSR = GS_SET_CSR(0,0,0,0,0,0,0,0,0,0,0,0);

// Reset the static variables.
graph_aspect = 1.0f;
graph_width = 0.0f;
graph_height = 0.0f;
graph_filter = 0;
Expand Down
2 changes: 1 addition & 1 deletion ee/kernel/src/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct SyscallData
void *function;
};

struct SyscallData SysEntry = {
static const struct SyscallData SysEntry = {
0x5A,
&kCopyBytes};

Expand Down
16 changes: 12 additions & 4 deletions ee/kernel/src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ SifRpcClientData_t _fio_cd;
int _fio_recv_data[512] __attribute__((aligned(64)));
int _fio_intr_data[32] __attribute__((aligned(64)));
int _fio_block_mode;
int _fio_io_sema = -1;
int _fio_completion_sema = -1;
int _fio_io_sema;
int _fio_completion_sema;
#endif

#ifdef F_fio_init
Expand Down Expand Up @@ -70,15 +70,21 @@ int fioInit(void)
sema.option = 0;
_fio_completion_sema = CreateSema(&sema);
if (_fio_completion_sema < 0)
{
_fio_completion_sema = 0;
return -E_LIB_SEMA_CREATE;
}

// Unofficial: create a locking semaphore to prevent a thread from overwriting another thread's return status.
sema.init_count = 1;
sema.max_count = 1;
sema.option = 0;
_fio_io_sema = CreateSema(&sema);
if (_fio_io_sema < 0)
{
_fio_io_sema = 0;
return -E_LIB_SEMA_CREATE;
}

_fio_block_mode = FIO_WAIT;

Expand Down Expand Up @@ -145,11 +151,13 @@ void fioExit(void)
{
if (_fio_cd.server) {
memset(&_fio_cd, 0, sizeof _fio_cd);
if (_fio_completion_sema >= 0) {
if (_fio_completion_sema > 0) {
DeleteSema(_fio_completion_sema);
_fio_completion_sema = 0;
}
if (_fio_io_sema >= 0) {
if (_fio_io_sema > 0) {
DeleteSema(_fio_io_sema);
_fio_io_sema = 0;
}
}
}
Expand Down
Loading
Loading