- use build in data types

git-svn-id: http://moon:8086/svn/mips@35 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
2015-05-28 19:19:01 +00:00
parent 3263f9d79c
commit a655e1c5d9
54 changed files with 1551 additions and 1583 deletions
+81 -81
View File
@@ -11,16 +11,16 @@
// ---------------------------------------------------------------------------------
// Forward declarations
// ---------------------------------------------------------------------------------
void flush(UINT32 port);
UINT32 GetPort(int file);
void flush(uint32_t port);
uint32_t GetPort(int file);
// ---------------------------------------------------------------------------------
// Types
// ---------------------------------------------------------------------------------
void libsys_init(void)
{
UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL;
UINT32 volatile *pITIM_ctrl = (UINT32*)SYS_ITIM_CTRL;
uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL;
uint32_t volatile *pITIM_ctrl = (uint32_t*)SYS_ITIM_CTRL;
Screen_clr();
@@ -62,7 +62,7 @@ enum
};
UINT32 GetPort(int file)
uint32_t GetPort(int file)
{
if (file == 0) // STDIN
return PORT_IN_UART_0;
@@ -90,34 +90,34 @@ enum
typedef struct _suart_if_t
{
volatile UINT32 *pCTRL;
volatile UINT32 *pDATA;
volatile UINT32 *pBAUD;
volatile uint32_t *pCTRL;
volatile uint32_t *pDATA;
volatile uint32_t *pBAUD;
} uart_if_t;
typedef struct _sps2_if_t
{
volatile UINT32 *pCTRL;
volatile UINT32 *pDATA;
volatile uint32_t *pCTRL;
volatile uint32_t *pDATA;
} ps2_if_t;
typedef struct _svga_if_t
{
volatile UINT32 *pCTRL;
volatile UINT32 *pDATA;
volatile UINT32 *pCSRX;
volatile UINT32 *pCSRY;
volatile uint32_t *pCTRL;
volatile uint32_t *pDATA;
volatile uint32_t *pCSRX;
volatile uint32_t *pCSRY;
} vga_if_t;
typedef struct _scon_if_in_t
{
UINT32 type;
uint32_t type;
void *pIF;
} con_if_in_t;
typedef struct _scon_if_out_t
{
UINT32 type;
uint32_t type;
void *pIF;
} con_if_out_t;
@@ -126,15 +126,15 @@ typedef struct _scon_if_out_t
// ---------------------------------------------------------------------------------
static uart_if_t uart_if[2] =
{
{(UINT32*)SYS_UART0_STAT, (UINT32*)SYS_UART0_DATA, (UINT32*)SYS_UART0_BAUD},
{(UINT32*)SYS_UART1_STAT, (UINT32*)SYS_UART1_DATA, (UINT32*)SYS_UART1_BAUD}
{(uint32_t*)SYS_UART0_STAT, (uint32_t*)SYS_UART0_DATA, (uint32_t*)SYS_UART0_BAUD},
{(uint32_t*)SYS_UART1_STAT, (uint32_t*)SYS_UART1_DATA, (uint32_t*)SYS_UART1_BAUD}
};
extern ps2_if_t ps2_if[];
static vga_if_t vga_if =
{
(UINT32*)SYS_VGA_CTRL, (UINT32*)SYS_VGA_ASCII, (UINT32*)SYS_VGA_POSX, (UINT32*)SYS_VGA_POSY
(uint32_t*)SYS_VGA_CTRL, (uint32_t*)SYS_VGA_ASCII, (uint32_t*)SYS_VGA_POSX, (uint32_t*)SYS_VGA_POSY
};
static con_if_in_t con_if_in[4] =
@@ -156,9 +156,9 @@ static con_if_out_t con_if_out[4] =
// ---------------------------------------------------------------------------------
// MIPS specific
// ---------------------------------------------------------------------------------
UINT32 CP0_SR_read(void)
uint32_t CP0_SR_read(void)
{
UINT32 result;
uint32_t result;
__asm__
(
@@ -169,7 +169,7 @@ UINT32 CP0_SR_read(void)
return result;
}
void CP0_SR_write(UINT32 val)
void CP0_SR_write(uint32_t val)
{
__asm__
(
@@ -179,9 +179,9 @@ void CP0_SR_write(UINT32 val)
);
}
UINT32 CP0_CR_read(void)
uint32_t CP0_CR_read(void)
{
UINT32 result;
uint32_t result;
__asm__
(
@@ -192,7 +192,7 @@ UINT32 CP0_CR_read(void)
return result;
}
void CP0_CR_write(UINT32 val)
void CP0_CR_write(uint32_t val)
{
__asm__
(
@@ -202,9 +202,9 @@ void CP0_CR_write(UINT32 val)
);
}
UINT32 CP0_TR_read(void)
uint32_t CP0_TR_read(void)
{
UINT32 result;
uint32_t result;
__asm__
(
@@ -215,7 +215,7 @@ UINT32 CP0_TR_read(void)
return result;
}
void CP0_TR_write(UINT32 val)
void CP0_TR_write(uint32_t val)
{
__asm__
(
@@ -225,9 +225,9 @@ void CP0_TR_write(UINT32 val)
);
}
UINT32 CP0_PRID_read(void)
uint32_t CP0_PRID_read(void)
{
UINT32 result;
uint32_t result;
__asm__
(
@@ -238,7 +238,7 @@ UINT32 CP0_PRID_read(void)
return result;
}
void CP0_TR_write_ptr(UINT32* pPtr)
void CP0_TR_write_ptr(uint32_t* pPtr)
{
__asm__
(
@@ -248,7 +248,7 @@ void CP0_TR_write_ptr(UINT32* pPtr)
);
}
void CP0_TR_read_ptr(UINT32* pPtr)
void CP0_TR_read_ptr(uint32_t* pPtr)
{
__asm__
(
@@ -266,7 +266,7 @@ void ICACHE_invalidate_all(void)
);
}
void ICACHE_invalidate_at(UINT32* pPtr)
void ICACHE_invalidate_at(uint32_t* pPtr)
{
__asm__
(
@@ -285,7 +285,7 @@ void DCACHE_invalidate_all(void)
);
}
void DCACHE_invalidate_at(UINT32* pPtr)
void DCACHE_invalidate_at(uint32_t* pPtr)
{
__asm__
(
@@ -302,10 +302,10 @@ void DCACHE_invalidate_at(UINT32* pPtr)
//keymap for the AT keyboard SG layout
typedef struct
{
UINT8 scancode;
UINT8 unshifted;
UINT8 shifted;
UINT8 altered;
uint8_t scancode;
uint8_t unshifted;
uint8_t shifted;
uint8_t altered;
} libsys_key_entry_t;
#define SHIFTED (1<<0)
@@ -318,7 +318,7 @@ static const libsys_key_entry_t __keymap_german[] =
{0x32, 'b', 'B', 'b'},
{0x21, 'c', 'C', 'c'},
{0x23, 'd', 'D', 'd'},
{0x24, 'e', 'E', ''},
{0x24, 'e', 'E', ''},
{0x2b, 'f', 'F', 'f'},
{0x34, 'g', 'G', 'g'},
{0x33, 'h', 'H', 'h'},
@@ -326,7 +326,7 @@ static const libsys_key_entry_t __keymap_german[] =
{0x3b, 'j', 'J', 'j'},
{0x42, 'k', 'K', 'k'},
{0x4b, 'l', 'L', 'l'},
{0x3a, 'm', 'M', 'µ'},
{0x3a, 'm', 'M', ''},
{0x31, 'n', 'N', 'n'},
{0x44, 'o', 'O', 'o'},
{0x4d, 'p', 'P', 'p'},
@@ -342,7 +342,7 @@ static const libsys_key_entry_t __keymap_german[] =
{0x35, 'z', 'Z', 'z'},
{0x16, '1', '!', '1'},
{0x1e, '2', '"', '2'},
{0x26, '3', '§', '3'},
{0x26, '3', '', '3'},
{0x25, '4', '$', '4'},
{0x2e, '5', '%', '5'},
{0x36, '6', '&', '6'},
@@ -350,18 +350,18 @@ static const libsys_key_entry_t __keymap_german[] =
{0x3e, '8', '(', '['},
{0x46, '9', ')', ']'},
{0x45, '0', '=', '}'},
{0x4e, 'ß', '?', '\\'},
{0x4e, '', '?', '\\'},
{0x29, ' ', ' ', ' '},
{0x41, ',', ';', ','},
{0x49, '.', ':', '.'},
{0x4a, '-', '_', '-'},
{0x52, 'ä', 'Ä', 'ä'},
{0x4c, 'ö', 'Ö', 'ö'},
{0x54, 'ü', 'Ü', 'ü'},
{0x52, '', '', ''},
{0x4c, '', '', ''},
{0x54, '', '', ''},
{0x5a, '\n', '\n', '\n'}, //RETURN
{0x5b, '+', '*', '~'},
{0x5d, '#', '\'', '#'},
{0x0e, '^', '°', '^'},
{0x0e, '^', '', '^'},
{0x61, '<', '>', '|'},
{0x66, '\b', '\b', '\b'},
{0} //sentinel
@@ -414,7 +414,7 @@ static char __findkey(char scancode, int mode)
#define ARROW_LEFT (SPECIALKEY|EXTENDED|0x6b)
#define ARROW_RIGHT (SPECIALKEY|EXTENDED|0x74)
UINT32 PS2_readchar(ps2_if_t *pIF)
uint32_t PS2_readchar(ps2_if_t *pIF)
{
if (!pIF)
return -1;
@@ -425,15 +425,15 @@ UINT32 PS2_readchar(ps2_if_t *pIF)
}
UINT32 con_readchar(ps2_if_t *pIF)
uint32_t con_readchar(ps2_if_t *pIF)
{
UINT8 c;
uint8_t c;
static char mode = 0;
static char nextrelease = 0;
static char extended = 0;
int flags = 0;
int char_valid = 0;
UINT8 key;
uint8_t key;
key = PS2_readchar(pIF);
@@ -520,12 +520,12 @@ void UART_writechar(uart_if_t *pIF, char c)
while((SYS_UART_BIT_TX_HALFFULL & *pIF->pCTRL) != 0);
*pIF->pDATA = (UINT32)c;
*pIF->pDATA = (uint32_t)c;
}
void cg_writechar(vga_if_t *pIF, char c)
{
UINT32 code;
uint32_t code;
if (!pIF)
return;
@@ -533,27 +533,27 @@ void cg_writechar(vga_if_t *pIF, char c)
// Output translation
switch(c)
{
case 'Ä':
case '':
code = 196;
break;
case 'ä':
case '':
code = 228;
break;
case 'Ö':
case '':
code = 214;
break;
case 'ö':
case '':
code = 246;
break;
case 'Ü':
case '':
code = 220;
break;
case 'ü':
case '':
code = 252;
break;
@@ -561,24 +561,24 @@ void cg_writechar(vga_if_t *pIF, char c)
code = 230;
break;
case '§':
case '':
code = 167;
break;
case 'ß':
case '':
code = 223;
break;
case '°':
case '':
code = 176;
break;
case 'µ':
case '':
code = 181;
break;
default:
code = (UINT32)c;
code = (uint32_t)c;
break;
}
@@ -586,7 +586,7 @@ void cg_writechar(vga_if_t *pIF, char c)
*pIF->pDATA = code;
}
void cg_set_csr_x(vga_if_t *pIF, UINT32 coord)
void cg_set_csr_x(vga_if_t *pIF, uint32_t coord)
{
if (!pIF)
return;
@@ -596,7 +596,7 @@ void cg_set_csr_x(vga_if_t *pIF, UINT32 coord)
*pIF->pCSRX = coord;
}
void cg_set_csr_y(vga_if_t *pIF, UINT32 coord)
void cg_set_csr_y(vga_if_t *pIF, uint32_t coord)
{
if (!pIF)
return;
@@ -643,39 +643,39 @@ void Screen_line_clr(void)
cg_clr_line(&vga_if);
}
void Screen_csr_set_x(UINT32 coord)
void Screen_csr_set_x(uint32_t coord)
{
cg_set_csr_x(&vga_if, coord);
}
void Screen_csr_set_y(UINT32 coord)
void Screen_csr_set_y(uint32_t coord)
{
cg_set_csr_y(&vga_if, coord);
}
UINT32 Screen_get_resx(void)
uint32_t Screen_get_resx(void)
{
UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES;
uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES;
return (0xFFF & (*pVGA_res >> 0));
}
UINT32 Screen_get_resy(void)
uint32_t Screen_get_resy(void)
{
UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES;
uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES;
return (0xFFF & (*pVGA_res >> 12));
}
UINT32 Screen_get_fps(void)
uint32_t Screen_get_fps(void)
{
UINT32 volatile *pVGA_res = (UINT32*)SYS_VGA_RES;
uint32_t volatile *pVGA_res = (uint32_t*)SYS_VGA_RES;
return (0xFF & (*pVGA_res >> 24));
}
// ---------------------------------------------------------------------------------
void flush(UINT32 port)
void flush(uint32_t port)
{
int c;
con_if_in_t *pIF;
@@ -701,7 +701,7 @@ void flush(UINT32 port)
} while(c > 0);
}
char readchar(UINT32 port)
char readchar(uint32_t port)
{
int c;
con_if_in_t *pIF;
@@ -729,7 +729,7 @@ char readchar(UINT32 port)
return (char)c;
}
void writechar(UINT32 port, char c)
void writechar(uint32_t port, char c)
{
con_if_out_t *pIF;
@@ -750,7 +750,7 @@ void writechar(UINT32 port, char c)
}
}
void _putchar(UINT32 port, char c)
void _putchar(uint32_t port, char c)
{
con_if_out_t *pIF;
@@ -951,7 +951,7 @@ int close(int file)
int read(int file, char *ptr, int len)
{
UINT32 port;
uint32_t port;
int i;
char c;
@@ -984,7 +984,7 @@ int read(int file, char *ptr, int len)
int write(int file, char *ptr, int len)
{
UINT32 port;
uint32_t port;
int i = 0;
// sputs("write ("); print_word(file); sputs(")\n");
@@ -1087,12 +1087,12 @@ void print_word(int word)
// _Return: none
//
// ---------------------------------------------------------------------------
void PrintBuffer8(UINT8 *pBuf, int nbpr, int len)
void PrintBuffer8(uint8_t *pBuf, int nbpr, int len)
{
memdump(pBuf, 1, nbpr, len);
}
void memdump(UINT8 *pBuf, int print_offset_only, int num_bytes_per_row, int len)
void memdump(uint8_t *pBuf, int print_offset_only, int num_bytes_per_row, int len)
{
int i, j, cnt_hex, cnt_asc, base;
unsigned char c;