- use build in data types
git-svn-id: http://moon:8086/svn/mips@35 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+5
-5
@@ -2,24 +2,24 @@
|
||||
#include "gpio.h"
|
||||
|
||||
// ---------------------------------------------------------
|
||||
UINT32 gpio_init(gpio_if_t *pGPIO, UINT32 base_addr)
|
||||
uint32_t gpio_init(gpio_if_t *pGPIO, uint32_t base_addr)
|
||||
{
|
||||
pGPIO->pBase = (UINT32*)base_addr;
|
||||
pGPIO->pBase = (uint32_t*)base_addr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_clean(gpio_if_t *pGPIO)
|
||||
uint32_t gpio_clean(gpio_if_t *pGPIO)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_write(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 value)
|
||||
uint32_t gpio_write(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t value)
|
||||
{
|
||||
*(pGPIO->pBase + offset) = (*(pGPIO->pBase + offset) & ~(mask << shift)) | ((value & mask) << shift);
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 gpio_read(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 *pValue)
|
||||
uint32_t gpio_read(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t *pValue)
|
||||
{
|
||||
*pValue = (*(pGPIO->pBase + offset) & (mask << shift)) >> shift;
|
||||
return 0;
|
||||
|
||||
+5
-5
@@ -9,7 +9,7 @@
|
||||
// ---------------------------------------------------------
|
||||
typedef struct _sgpio_if_t
|
||||
{
|
||||
volatile UINT32 *pBase;
|
||||
volatile uint32_t *pBase;
|
||||
|
||||
} gpio_if_t;
|
||||
|
||||
@@ -32,10 +32,10 @@ typedef struct _sgpio_if_t
|
||||
gpio_read(gpio, mask, shift, GPIO_DIR_OFFSET, ret)
|
||||
|
||||
|
||||
UINT32 gpio_init(gpio_if_t *pGPIO, UINT32 base_addr);
|
||||
UINT32 gpio_clean(gpio_if_t *pGPIO);
|
||||
uint32_t gpio_init(gpio_if_t *pGPIO, uint32_t base_addr);
|
||||
uint32_t gpio_clean(gpio_if_t *pGPIO);
|
||||
|
||||
UINT32 gpio_write(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 value);
|
||||
UINT32 gpio_read(gpio_if_t *pGPIO, UINT32 mask, UINT32 shift, UINT32 offset, UINT32 *pValue);
|
||||
uint32_t gpio_write(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t value);
|
||||
uint32_t gpio_read(gpio_if_t *pGPIO, uint32_t mask, uint32_t shift, uint32_t offset, uint32_t *pValue);
|
||||
|
||||
#endif // GPIO_H
|
||||
|
||||
+81
-81
@@ -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;
|
||||
|
||||
+29
-48
@@ -1,30 +1,11 @@
|
||||
#ifndef LIBSYS_H
|
||||
#define LIBSYS_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Types
|
||||
// ---------------------------------------------------------
|
||||
#define INT8 signed char
|
||||
#define INT16 signed short
|
||||
#define INT32 signed int
|
||||
#define INT64 signed long long
|
||||
#define UINT8 unsigned char
|
||||
#define UINT16 unsigned short
|
||||
#define UINT32 unsigned int
|
||||
#define UINT64 unsigned long long
|
||||
#define INT INT32
|
||||
#define UINT UINT32
|
||||
#define FLOAT32 float
|
||||
#define FLOAT64 double
|
||||
|
||||
#define int8_t signed char
|
||||
#define int16_t signed short
|
||||
#define int32_t signed int
|
||||
#define int64_t signed long long
|
||||
#define uint8_t unsigned char
|
||||
#define uint16_t unsigned short
|
||||
#define uint32_t unsigned int
|
||||
#define uint64_t unsigned long long
|
||||
|
||||
#define NO_ERROR LSYS_SUCCESS
|
||||
#define ERROR LSYS_ERR_BASE
|
||||
@@ -278,7 +259,7 @@ void ICACHE_invalidate_all(void)
|
||||
);
|
||||
}
|
||||
|
||||
void ICACHE_invalidate_at(UINT32* pPtr)
|
||||
void ICACHE_invalidate_at(uint32_t* pPtr)
|
||||
{
|
||||
__asm__
|
||||
(
|
||||
@@ -297,7 +278,7 @@ void DCACHE_invalidate_all(void)
|
||||
);
|
||||
}
|
||||
|
||||
void DCACHE_invalidate_at(UINT32* pPtr)
|
||||
void DCACHE_invalidate_at(uint32_t* pPtr)
|
||||
{
|
||||
__asm__
|
||||
(
|
||||
@@ -311,7 +292,7 @@ void DCACHE_invalidate_at(UINT32* pPtr)
|
||||
|
||||
#define CP0_read(idx) \
|
||||
({ \
|
||||
UINT32 result; \
|
||||
uint32_t result; \
|
||||
__asm__ __volatile__ \
|
||||
( \
|
||||
"mfc0\t%0,$"#idx"\n" \
|
||||
@@ -351,34 +332,34 @@ void DCACHE_invalidate_at(UINT32* pPtr)
|
||||
); \
|
||||
})
|
||||
|
||||
UINT32 CP0_SR_read(void);
|
||||
void CP0_SR_write(UINT32 val);
|
||||
UINT32 CP0_CR_read(void);
|
||||
void CP0_CR_write(UINT32 val);
|
||||
UINT32 CP0_PRID_read(void);
|
||||
UINT32 CP0_TR_read(void);
|
||||
void CP0_TR_write(UINT32 val);
|
||||
void CP0_TR_write_ptr(UINT32* pPtr);
|
||||
void CP0_TR_read_ptr(UINT32* pPtr);
|
||||
uint32_t CP0_SR_read(void);
|
||||
void CP0_SR_write(uint32_t val);
|
||||
uint32_t CP0_CR_read(void);
|
||||
void CP0_CR_write(uint32_t val);
|
||||
uint32_t CP0_PRID_read(void);
|
||||
uint32_t CP0_TR_read(void);
|
||||
void CP0_TR_write(uint32_t val);
|
||||
void CP0_TR_write_ptr(uint32_t* pPtr);
|
||||
void CP0_TR_read_ptr(uint32_t* pPtr);
|
||||
void ICACHE_invalidate_all(void);
|
||||
void ICACHE_invalidate_at(UINT32* pPtr);
|
||||
void ICACHE_invalidate_at(uint32_t* pPtr);
|
||||
void DCACHE_invalidate_all(void);
|
||||
void DCACHE_invalidate_at(UINT32* pPtr);
|
||||
void DCACHE_invalidate_at(uint32_t* pPtr);
|
||||
|
||||
#define CALC_BAUD(b) \
|
||||
((UINT32)((float)CPU_FREQ_HZ/(16*b) + 0.5f) - 1);
|
||||
((uint32_t)((float)CPU_FREQ_HZ/(16*b) + 0.5f) - 1);
|
||||
|
||||
#define UART0_setbaud(b) \
|
||||
*((UINT32*)SYS_UART0_BAUD) = CALC_BAUD(b);
|
||||
*((uint32_t*)SYS_UART0_BAUD) = CALC_BAUD(b);
|
||||
|
||||
#define UART1_setbaud(b) \
|
||||
*((UINT32*)SYS_UART1_BAUD) = CALC_BAUD(b);
|
||||
*((uint32_t*)SYS_UART1_BAUD) = CALC_BAUD(b);
|
||||
|
||||
#define UART2_setbaud(b) \
|
||||
*((UINT32*)SYS_UART2_BAUD) = CALC_BAUD(b);
|
||||
*((uint32_t*)SYS_UART2_BAUD) = CALC_BAUD(b);
|
||||
|
||||
char readchar(UINT32 port);
|
||||
void writechar(UINT32 port, char c);
|
||||
char readchar(uint32_t port);
|
||||
void writechar(uint32_t port, char c);
|
||||
int write(int file, char *ptr, int len);
|
||||
int sputs(char const *pStr);
|
||||
void print_byte(char byte);
|
||||
@@ -389,16 +370,16 @@ void usleep(unsigned us);
|
||||
|
||||
char _getchar(void);
|
||||
|
||||
void PrintBuffer8(UINT8 *pBuf, int nbpr, int len);
|
||||
void memdump(UINT8 *pBuf, int print_offset_only, int num_bytes_per_row, int len);
|
||||
void PrintBuffer8(uint8_t *pBuf, int nbpr, int len);
|
||||
void memdump(uint8_t *pBuf, int print_offset_only, int num_bytes_per_row, int len);
|
||||
|
||||
void Screen_clr(void);
|
||||
void Screen_line_clr(void);
|
||||
void Screen_csr_set_x(UINT32 coord);
|
||||
void Screen_csr_set_y(UINT32 coord);
|
||||
UINT32 Screen_get_resx(void);
|
||||
UINT32 Screen_get_resy(void);
|
||||
UINT32 Screen_get_fps(void);
|
||||
void Screen_csr_set_x(uint32_t coord);
|
||||
void Screen_csr_set_y(uint32_t coord);
|
||||
uint32_t Screen_get_resx(void);
|
||||
uint32_t Screen_get_resy(void);
|
||||
uint32_t Screen_get_fps(void);
|
||||
|
||||
|
||||
|
||||
|
||||
+218
-218
@@ -37,8 +37,8 @@ static char *g_state_names[STATE_NUM_ENTRIES] = {"Init", "Run", "Single step", "
|
||||
|
||||
typedef struct _sbp_t
|
||||
{
|
||||
UINT32 *pAddr;
|
||||
UINT32 instr;
|
||||
uint32_t *pAddr;
|
||||
uint32_t instr;
|
||||
} bp_t;
|
||||
|
||||
static EXCEPTION_CONTEXT xcp_last;
|
||||
@@ -48,17 +48,17 @@ static bp_t mgmt_bp_ru[2];
|
||||
static int g_is_ss;
|
||||
static int g_bp_count;
|
||||
|
||||
int IsBreak(UINT32 instr)
|
||||
int IsBreak(uint32_t instr)
|
||||
{
|
||||
return ((instr & 0xFC00003F) == 0x0000000D);
|
||||
}
|
||||
|
||||
UINT32 BreakGetType(UINT32 instr)
|
||||
uint32_t BreakGetType(uint32_t instr)
|
||||
{
|
||||
return (instr >> 6) & BP_MASK_TYPE;
|
||||
}
|
||||
|
||||
char* reg_changed(UINT32 reg1, UINT32 reg2)
|
||||
char* reg_changed(uint32_t reg1, uint32_t reg2)
|
||||
{
|
||||
static char chg_str[2] = {0};
|
||||
|
||||
@@ -69,80 +69,80 @@ char* reg_changed(UINT32 reg1, UINT32 reg2)
|
||||
|
||||
return chg_str;
|
||||
}
|
||||
|
||||
void set_mgmt_break(UINT32 *pAddr_break)
|
||||
{
|
||||
mgmt_bp_ss[0].pAddr = NULL;
|
||||
mgmt_bp_ss[0].pAddr = 0;
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[0].pAddr = pAddr_break;
|
||||
mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void singlestep(struct xcptcontext * xcp, UINT32 *pAddr_curr, UINT32 is_branch_shadow)
|
||||
{
|
||||
|
||||
int junk;
|
||||
UINT32 branch_addr, reg, result, bp_type;
|
||||
UINT32 *pInstr, *pAddr_prev, *pAddr_next;
|
||||
|
||||
pAddr_prev = pAddr_curr - 1;
|
||||
pAddr_next = pAddr_curr + 1;
|
||||
|
||||
set_mgmt_break(pAddr_next);
|
||||
|
||||
mgmt_bp_ss[1].pAddr = NULL;
|
||||
mgmt_bp_ss[1].pAddr = 0;
|
||||
|
||||
// We have two possible management breaks, if previous instruction was branch or jump
|
||||
if (is_branch_shadow)
|
||||
{
|
||||
result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®);
|
||||
// Is jump target stored in register
|
||||
if (result == 3)
|
||||
{
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[1].pAddr = (UINT32*)branch_addr;
|
||||
mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void set_mgmt_break(uint32_t *pAddr_break)
|
||||
{
|
||||
mgmt_bp_ss[0].pAddr = NULL;
|
||||
mgmt_bp_ss[0].pAddr = 0;
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(*pAddr_break) && (BreakGetType(*pAddr_break) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at address ");print_word((long)pAddr_break);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[0].pAddr = pAddr_break;
|
||||
mgmt_bp_ss[0].instr = *(mgmt_bp_ss[0].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[0].pAddr) = BP_MGMT_SS(1);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[0].pAddr);
|
||||
}
|
||||
}
|
||||
|
||||
void singlestep(struct xcptcontext * xcp, uint32_t *pAddr_curr, uint32_t is_branch_shadow)
|
||||
{
|
||||
|
||||
int junk;
|
||||
uint32_t branch_addr, reg, result, bp_type;
|
||||
uint32_t *pInstr, *pAddr_prev, *pAddr_next;
|
||||
|
||||
pAddr_prev = pAddr_curr - 1;
|
||||
pAddr_next = pAddr_curr + 1;
|
||||
|
||||
set_mgmt_break(pAddr_next);
|
||||
|
||||
mgmt_bp_ss[1].pAddr = NULL;
|
||||
mgmt_bp_ss[1].pAddr = 0;
|
||||
|
||||
// We have two possible management breaks, if previous instruction was branch or jump
|
||||
if (is_branch_shadow)
|
||||
{
|
||||
result = tdisasm(g_buf, (long)pAddr_prev, *pAddr_prev, 0, &junk, &branch_addr, ®);
|
||||
// Is jump target stored in register
|
||||
if (result == 3)
|
||||
{
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
|
||||
// Don't overwrite user breaks
|
||||
if (IsBreak(branch_addr) && (BreakGetType(branch_addr) == BP_USER_BASE))
|
||||
{
|
||||
// sputs("Instruction at branch address ");print_word((long)branch_addr);sputs(" is user break\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Save original instruction
|
||||
mgmt_bp_ss[1].pAddr = (uint32_t*)branch_addr;
|
||||
mgmt_bp_ss[1].instr = *(mgmt_bp_ss[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ss[1].pAddr) = BP_MGMT_SS(2);
|
||||
ICACHE_invalidate_at(mgmt_bp_ss[1].pAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_handler(struct xcptcontext * xcp)
|
||||
{
|
||||
|
||||
UINT32 bp_addr, bp_index = 0, branch_addr, reg, result, bp_type;
|
||||
uint32_t bp_addr, bp_index = 0, branch_addr, reg, result, bp_type;
|
||||
int junk, i, leave_isr, is_branch_shadow, is_user_bp;
|
||||
UINT32 *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next;
|
||||
uint32_t *pInstr, *pAddr_curr, *pAddr_prev, *pAddr_next;
|
||||
instr_info_t info;
|
||||
|
||||
|
||||
is_user_bp = 0;
|
||||
pAddr_curr = (UINT32*)xcp->epc;
|
||||
pAddr_curr = (uint32_t*)xcp->epc;
|
||||
is_branch_shadow = ((xcp->cr & 0x80000000) == 0x80000000);
|
||||
if (is_branch_shadow)
|
||||
pAddr_curr++;
|
||||
@@ -209,92 +209,92 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
}
|
||||
}
|
||||
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr));
|
||||
PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr));
|
||||
PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc));
|
||||
PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo));
|
||||
PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi));
|
||||
|
||||
sputs("\n");
|
||||
|
||||
sputs("Registers:\n");
|
||||
PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0]));
|
||||
PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1]));
|
||||
PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2]));
|
||||
PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4]));
|
||||
PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5]));
|
||||
PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6]));
|
||||
PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8]));
|
||||
PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9]));
|
||||
PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10]));
|
||||
PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12]));
|
||||
PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13]));
|
||||
PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14]));
|
||||
PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16]));
|
||||
PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17]));
|
||||
PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18]));
|
||||
PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20]));
|
||||
PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21]));
|
||||
PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22]));
|
||||
PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24]));
|
||||
PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25]));
|
||||
PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26]));
|
||||
PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28]));
|
||||
PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29]));
|
||||
PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30]));
|
||||
PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31]));
|
||||
sputs("\n");
|
||||
sputs("\n");
|
||||
|
||||
// sputs(g_state_names[g_state]);sputs("\n");
|
||||
// sputs("\n");
|
||||
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" Status : ", xcp->sr, reg_changed(xcp->sr, xcp_last.sr));
|
||||
PRINT_REG_CHG(" Cause : ", xcp->cr, reg_changed(xcp->cr, xcp_last.cr));
|
||||
PRINT_REG_CHG(" EPC : ", xcp->epc, reg_changed(xcp->epc, xcp_last.epc));
|
||||
PRINT_REG_CHG("BadAddr : ", xcp->baddr, reg_changed(xcp->baddr, xcp_last.baddr));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" MDLO : ", xcp->mdlo, reg_changed(xcp->mdlo, xcp_last.mdlo));
|
||||
PRINT_REG_CHG(" MDHI : ", xcp->mdhi, reg_changed(xcp->mdhi, xcp_last.mdhi));
|
||||
|
||||
sputs("\n");
|
||||
|
||||
sputs("Registers:\n");
|
||||
PRINT_REG_CHG(" 0 (ze) : ", xcp->regs[0], reg_changed(xcp->regs[0], xcp_last.regs[0]));
|
||||
PRINT_REG_CHG(" 1 (at) : ", xcp->regs[1], reg_changed(xcp->regs[1], xcp_last.regs[1]));
|
||||
PRINT_REG_CHG(" 2 (v0) : ", xcp->regs[2], reg_changed(xcp->regs[2], xcp_last.regs[2]));
|
||||
PRINT_REG_CHG(" 3 (v1) : ", xcp->regs[3], reg_changed(xcp->regs[3], xcp_last.regs[3]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 4 (a0) : ", xcp->regs[4], reg_changed(xcp->regs[4], xcp_last.regs[4]));
|
||||
PRINT_REG_CHG(" 5 (a1) : ", xcp->regs[5], reg_changed(xcp->regs[5], xcp_last.regs[5]));
|
||||
PRINT_REG_CHG(" 6 (a2) : ", xcp->regs[6], reg_changed(xcp->regs[6], xcp_last.regs[6]));
|
||||
PRINT_REG_CHG(" 7 (a3) : ", xcp->regs[7], reg_changed(xcp->regs[7], xcp_last.regs[7]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG(" 8 (t0) : ", xcp->regs[8], reg_changed(xcp->regs[8], xcp_last.regs[8]));
|
||||
PRINT_REG_CHG(" 9 (t1) : ", xcp->regs[9], reg_changed(xcp->regs[9], xcp_last.regs[9]));
|
||||
PRINT_REG_CHG("10 (t2) : ", xcp->regs[10], reg_changed(xcp->regs[10], xcp_last.regs[10]));
|
||||
PRINT_REG_CHG("11 (t3) : ", xcp->regs[11], reg_changed(xcp->regs[11], xcp_last.regs[11]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("12 (t4) : ", xcp->regs[12], reg_changed(xcp->regs[12], xcp_last.regs[12]));
|
||||
PRINT_REG_CHG("13 (t5) : ", xcp->regs[13], reg_changed(xcp->regs[13], xcp_last.regs[13]));
|
||||
PRINT_REG_CHG("14 (t6) : ", xcp->regs[14], reg_changed(xcp->regs[14], xcp_last.regs[14]));
|
||||
PRINT_REG_CHG("15 (t7) : ", xcp->regs[15], reg_changed(xcp->regs[15], xcp_last.regs[15]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("16 (s0) : ", xcp->regs[16], reg_changed(xcp->regs[16], xcp_last.regs[16]));
|
||||
PRINT_REG_CHG("17 (s1) : ", xcp->regs[17], reg_changed(xcp->regs[17], xcp_last.regs[17]));
|
||||
PRINT_REG_CHG("18 (s2) : ", xcp->regs[18], reg_changed(xcp->regs[18], xcp_last.regs[18]));
|
||||
PRINT_REG_CHG("19 (s3) : ", xcp->regs[19], reg_changed(xcp->regs[19], xcp_last.regs[19]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("20 (s4) : ", xcp->regs[20], reg_changed(xcp->regs[20], xcp_last.regs[20]));
|
||||
PRINT_REG_CHG("21 (s5) : ", xcp->regs[21], reg_changed(xcp->regs[21], xcp_last.regs[21]));
|
||||
PRINT_REG_CHG("22 (s6) : ", xcp->regs[22], reg_changed(xcp->regs[22], xcp_last.regs[22]));
|
||||
PRINT_REG_CHG("23 (s7) : ", xcp->regs[23], reg_changed(xcp->regs[23], xcp_last.regs[23]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("24 (s8) : ", xcp->regs[24], reg_changed(xcp->regs[24], xcp_last.regs[24]));
|
||||
PRINT_REG_CHG("25 (s9) : ", xcp->regs[25], reg_changed(xcp->regs[25], xcp_last.regs[25]));
|
||||
PRINT_REG_CHG("26 (k0) : ", xcp->regs[26], reg_changed(xcp->regs[26], xcp_last.regs[26]));
|
||||
PRINT_REG_CHG("27 (k1) : ", xcp->regs[27], reg_changed(xcp->regs[27], xcp_last.regs[27]));
|
||||
sputs("\n");
|
||||
PRINT_REG_CHG("28 (gp) : ", xcp->regs[28], reg_changed(xcp->regs[28], xcp_last.regs[28]));
|
||||
PRINT_REG_CHG("29 (sp) : ", xcp->regs[29], reg_changed(xcp->regs[29], xcp_last.regs[29]));
|
||||
PRINT_REG_CHG("30 (fp) : ", xcp->regs[30], reg_changed(xcp->regs[30], xcp_last.regs[30]));
|
||||
PRINT_REG_CHG("31 (ra) : ", xcp->regs[31], reg_changed(xcp->regs[31], xcp_last.regs[31]));
|
||||
sputs("\n");
|
||||
sputs("\n");
|
||||
|
||||
// sputs(g_state_names[g_state]);sputs("\n");
|
||||
// sputs("\n");
|
||||
|
||||
pInstr = pAddr_prev;
|
||||
// Disassemble instructions
|
||||
for (i=0; i < 3; i++)
|
||||
{
|
||||
print_word((long)pInstr);
|
||||
if (pInstr != pAddr_curr)
|
||||
{
|
||||
if (pInstr != pAddr_curr)
|
||||
{
|
||||
if (IsBreak(*pInstr) && (BreakGetType(*pInstr) == BP_USER_BASE))
|
||||
{
|
||||
tdisasm(g_buf, (long)user_bp[BP_GET_ID(*pInstr)].pAddr, user_bp[BP_GET_ID(*pInstr)].instr, 0, &junk, &junk, &junk);
|
||||
sputs(": b("); print_byte((char)BP_GET_ID(*pInstr)); sputs(") ");
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
sputs(": ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
sputs(": ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tdisasm(g_buf, (long)pInstr, *pInstr, 0, &junk, &junk, &junk);
|
||||
if (is_user_bp)
|
||||
{
|
||||
sputs(": b("); print_byte((char)bp_index); sputs(")-> ");
|
||||
}
|
||||
{
|
||||
sputs(": b("); print_byte((char)bp_index); sputs(")-> ");
|
||||
}
|
||||
else
|
||||
{
|
||||
sputs(": -> ");
|
||||
}
|
||||
{
|
||||
sputs(": -> ");
|
||||
}
|
||||
}
|
||||
sputs(g_buf);
|
||||
sputs("\n");
|
||||
@@ -323,7 +323,7 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
branch_addr = xcp->regs[reg&0x1F];
|
||||
}
|
||||
// Save original instruction
|
||||
mgmt_bp_ru[1].pAddr = (UINT32*)branch_addr;
|
||||
mgmt_bp_ru[1].pAddr = (uint32_t*)branch_addr;
|
||||
mgmt_bp_ru[1].instr = *(mgmt_bp_ru[1].pAddr);
|
||||
// Replace instruction with managment breakpoint
|
||||
*(mgmt_bp_ru[1].pAddr) = BP_MGMT_RU(bp_index);
|
||||
@@ -354,8 +354,8 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
printf("Enter breakpoint: ");
|
||||
scanf("%x", &bp_addr);
|
||||
printf("Insert breakpoint at %.8X\n", bp_addr);
|
||||
|
||||
user_bp[g_bp_count].pAddr = (UINT32*)bp_addr;
|
||||
|
||||
user_bp[g_bp_count].pAddr = (uint32_t*)bp_addr;
|
||||
user_bp[g_bp_count].instr = *(user_bp[g_bp_count].pAddr);
|
||||
*(user_bp[g_bp_count].pAddr) = BP_USER(g_bp_count);
|
||||
|
||||
@@ -384,82 +384,82 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
g_state = STATE_STEP_SINGLE;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
pInstr = pAddr_curr;
|
||||
|
||||
do
|
||||
{
|
||||
result = instr_info(*pInstr, &info);
|
||||
if (result == INSTR_TYPE_JUMP)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
else if (result == INSTR_TYPE_LOAD)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
pInstr++;
|
||||
} while(1);
|
||||
|
||||
// sputs("Return found at "); print_word((long)pInstr);sputs("\n");
|
||||
set_mgmt_break(pInstr);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
g_state = STATE_STEP_SINGLE;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
pInstr = pAddr_curr;
|
||||
|
||||
do
|
||||
{
|
||||
result = instr_info(*pInstr, &info);
|
||||
if (result == INSTR_TYPE_JUMP)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
else if (result == INSTR_TYPE_LOAD)
|
||||
{
|
||||
if (info.rs == 0x1F)
|
||||
break;
|
||||
}
|
||||
pInstr++;
|
||||
} while(1);
|
||||
|
||||
// sputs("Return found at "); print_word((long)pInstr);sputs("\n");
|
||||
set_mgmt_break(pInstr);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
g_state = STATE_STEP_PROC;
|
||||
g_is_ss = 1;
|
||||
leave_isr = 1;
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
result = instr_info(*pAddr_curr, &info);
|
||||
if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK))
|
||||
{
|
||||
singlestep(xcp, pAddr_next, 0);
|
||||
// sputs("Skip sub-routine\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
}
|
||||
|
||||
if (is_user_bp)
|
||||
break;
|
||||
|
||||
if (IsBreak(*pAddr_curr))
|
||||
{
|
||||
if (BreakGetType(*pAddr_curr) == BP_USER_BASE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
xcp->epc += 4; // Skip ordinary program breaks
|
||||
}
|
||||
}
|
||||
|
||||
result = instr_info(*pAddr_curr, &info);
|
||||
if ((result == INSTR_TYPE_JUMP) && (info.flags & INSTR_FLAGS_JUMP_LINK))
|
||||
{
|
||||
singlestep(xcp, pAddr_next, 0);
|
||||
// sputs("Skip sub-routine\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
singlestep(xcp, pAddr_curr, is_branch_shadow);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -467,7 +467,7 @@ void dbg_handler(struct xcptcontext * xcp)
|
||||
}
|
||||
} while (!leave_isr);
|
||||
|
||||
memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT));
|
||||
memcpy(&xcp_last, xcp, sizeof(EXCEPTION_CONTEXT));
|
||||
}
|
||||
|
||||
void debug_int(struct xcptcontext * xcp)
|
||||
|
||||
+100
-100
@@ -12,7 +12,7 @@ static vga_hw_t *g_pRegs;
|
||||
// -------------------------------------------------------------
|
||||
// Functions
|
||||
// -------------------------------------------------------------
|
||||
void __gfx_block_set_8(UINT32* pDst, UINT32 value)
|
||||
void __gfx_block_set_8(uint32_t* pDst, uint32_t value)
|
||||
{
|
||||
__asm__ volatile
|
||||
(
|
||||
@@ -29,7 +29,7 @@ void __gfx_block_set_8(UINT32* pDst, UINT32 value)
|
||||
);
|
||||
}
|
||||
|
||||
void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc)
|
||||
void __gfx_block_copy_8(uint32_t* pDst, uint32_t* pSrc)
|
||||
{
|
||||
__asm__ volatile
|
||||
(
|
||||
@@ -59,7 +59,7 @@ void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc)
|
||||
);
|
||||
}
|
||||
|
||||
void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords)
|
||||
void _GFX_copy32(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords)
|
||||
{
|
||||
while (ndwords > 3)
|
||||
{
|
||||
@@ -75,7 +75,7 @@ void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords)
|
||||
}
|
||||
}
|
||||
|
||||
void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords)
|
||||
void _GFX_memset32(uint32_t* pDst, uint32_t value, uint32_t ndwords)
|
||||
{
|
||||
while (ndwords > 3)
|
||||
{
|
||||
@@ -90,10 +90,10 @@ void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords)
|
||||
}
|
||||
}
|
||||
|
||||
void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_finish)
|
||||
void _GFX_copy32_hw(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords, uint32_t wait_finish)
|
||||
{
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = 0;
|
||||
g_pRegs->pVGA_dst_dimx = 0;
|
||||
g_pRegs->pVGA_nx = ndwords;
|
||||
@@ -111,9 +111,9 @@ void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_fini
|
||||
|
||||
}
|
||||
|
||||
void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_finish)
|
||||
void _GFX_memset32_hw(uint32_t* pDst, uint32_t value, uint32_t ndwords, uint32_t wait_finish)
|
||||
{
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = 0;
|
||||
g_pRegs->pVGA_dst_dimx = 0;
|
||||
g_pRegs->pVGA_nx = ndwords;
|
||||
@@ -131,10 +131,10 @@ void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_fi
|
||||
|
||||
}
|
||||
|
||||
void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value)
|
||||
void _GFX_BLIT_const(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value)
|
||||
{
|
||||
UINT32 xmax8, x, y;
|
||||
UINT32 *pStart, *pEnd;
|
||||
uint32_t xmax8, x, y;
|
||||
uint32_t *pStart, *pEnd;
|
||||
|
||||
xmax8 = xmax - ((xmax-xmin)%8);
|
||||
for (y=ymin; y < ymax; y += xdim_dst)
|
||||
@@ -154,13 +154,13 @@ void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UI
|
||||
}
|
||||
}
|
||||
|
||||
void _GFX_BLIT_const_hw(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value, UINT32 wait_finish)
|
||||
void _GFX_BLIT_const_hw(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value, uint32_t wait_finish)
|
||||
{
|
||||
UINT32 *pStart, *pEnd;
|
||||
uint32_t *pStart, *pEnd;
|
||||
|
||||
pStart = (UINT32*)&pDst[xmin + ymin*xdim_dst];
|
||||
pStart = (uint32_t*)&pDst[xmin + ymin*xdim_dst];
|
||||
|
||||
g_pRegs->pVGA_dst = (UINT32)pStart;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pStart;
|
||||
g_pRegs->pVGA_dst_dimx = xdim_dst;
|
||||
g_pRegs->pVGA_nx = xmax - xmin + 1;
|
||||
g_pRegs->pVGA_ny = ymax - ymin + 1;
|
||||
@@ -185,14 +185,14 @@ void GFX_DirtyRectSetClean(gfx_t *pObj, buf_t *pBuf)
|
||||
pBuf->is_dirty = 0;
|
||||
}
|
||||
|
||||
void GFX_DirtyRectInit(gfx_t *pObj, buf_t *pBuf, UINT32 w, UINT32 h)
|
||||
void GFX_DirtyRectInit(gfx_t *pObj, buf_t *pBuf, uint32_t w, uint32_t h)
|
||||
{
|
||||
pBuf->w = w;
|
||||
pBuf->h = h;
|
||||
GFX_DirtyRectSetClean(pObj, pBuf);
|
||||
}
|
||||
|
||||
void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, UINT32 xmin, UINT32 xmax, UINT32 ymin, UINT32 ymax)
|
||||
void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, uint32_t xmin, uint32_t xmax, uint32_t ymin, uint32_t ymax)
|
||||
{
|
||||
|
||||
if (xmin < pBuf->dirty.xmin)
|
||||
@@ -231,9 +231,9 @@ void GFX_DirtyRectUpdate(gfx_t *pObj, buf_t *pBuf, UINT32 xmin, UINT32 xmax, UIN
|
||||
|
||||
void GFX_DirtyRectCopy(gfx_t *pObj, buf_t *pBuf)
|
||||
{
|
||||
UINT32 xmin, xmax, xmax8, ymin, ymax, x, y;
|
||||
UINT32 *pDst, *pDst_end;
|
||||
UINT32 *pSrc, *pSrc_end;
|
||||
uint32_t xmin, xmax, xmax8, ymin, ymax, x, y;
|
||||
uint32_t *pDst, *pDst_end;
|
||||
uint32_t *pSrc, *pSrc_end;
|
||||
|
||||
xmin = pBuf->dirty.xmin;
|
||||
xmax = pBuf->dirty.xmax;
|
||||
@@ -245,15 +245,15 @@ void GFX_DirtyRectCopy(gfx_t *pObj, buf_t *pBuf)
|
||||
ymax *= pBuf->w;
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
pSrc = (UINT32*)&pBuf->pLast->pFB[xmin + ymin];
|
||||
pDst = (UINT32*)&pBuf->pFB[xmin + ymin];
|
||||
pSrc = (uint32_t*)&pBuf->pLast->pFB[xmin + ymin];
|
||||
pDst = (uint32_t*)&pBuf->pFB[xmin + ymin];
|
||||
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (UINT32)pBuf->w;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)pBuf->w;
|
||||
g_pRegs->pVGA_nx = (UINT32)(pBuf->dirty.xmax-pBuf->dirty.xmin);
|
||||
g_pRegs->pVGA_ny = (UINT32)(pBuf->dirty.ymax-pBuf->dirty.ymin);
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (uint32_t)pBuf->w;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)pBuf->w;
|
||||
g_pRegs->pVGA_nx = (uint32_t)(pBuf->dirty.xmax-pBuf->dirty.xmin);
|
||||
g_pRegs->pVGA_ny = (uint32_t)(pBuf->dirty.ymax-pBuf->dirty.ymin);
|
||||
g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -289,7 +289,7 @@ void GFX_init(gfx_t *pObj)
|
||||
{
|
||||
int i;
|
||||
buf_t *pBuf;
|
||||
UINT32 w, h, fps;
|
||||
uint32_t w, h, fps;
|
||||
|
||||
g_pRegs = (vga_hw_t*)SYS_VGA_CTRL;
|
||||
|
||||
@@ -305,19 +305,19 @@ void GFX_init(gfx_t *pObj)
|
||||
pObj->h = h;
|
||||
|
||||
// Init background buffer
|
||||
pObj->pBG = (UINT32*)calloc(w * h, sizeof(buf_t));
|
||||
pObj->pBG = (uint32_t*)calloc(w * h, sizeof(buf_t));
|
||||
|
||||
// Init framebuffers
|
||||
pObj->pBuf = (buf_t*)calloc(1, sizeof(buf_t));
|
||||
pBuf = pObj->pBuf;
|
||||
pBuf->pFB = (UINT32*)calloc((w+8) * h, sizeof(UINT32)); // w+8 because of dirty rectangle 8 byte min. x-size
|
||||
pBuf->pFB = (uint32_t*)calloc((w+8) * h, sizeof(uint32_t)); // w+8 because of dirty rectangle 8 byte min. x-size
|
||||
for (i=1; i < GFX_NUM_FRAME_BUFFERS; i++)
|
||||
{
|
||||
|
||||
pBuf->pNext = (buf_t*)calloc(1, sizeof(buf_t));
|
||||
pBuf->pNext->pLast = pBuf;
|
||||
pBuf = pBuf->pNext;
|
||||
pBuf->pFB = (UINT32*)calloc((w+8) * h, sizeof(UINT32)); // w+8 because of dirty rectangle 8 byte min. x-size
|
||||
pBuf->pFB = (uint32_t*)calloc((w+8) * h, sizeof(uint32_t)); // w+8 because of dirty rectangle 8 byte min. x-size
|
||||
}
|
||||
pObj->pBuf->pLast = pBuf;
|
||||
pBuf->pNext = pObj->pBuf;
|
||||
@@ -331,19 +331,19 @@ void GFX_init(gfx_t *pObj)
|
||||
pBuf = pBuf->pNext;
|
||||
}
|
||||
|
||||
g_pRegs->pVGA_front = (UINT32)pObj->pBuf->pLast->pFB;
|
||||
g_pRegs->pVGA_back = (UINT32)pObj->pBuf->pLast->pFB;
|
||||
g_pRegs->pVGA_front = (uint32_t)pObj->pBuf->pLast->pFB;
|
||||
g_pRegs->pVGA_back = (uint32_t)pObj->pBuf->pLast->pFB;
|
||||
g_pRegs->pVGA_ctrl |= SYS_VGA_BIT_MSTEN;
|
||||
|
||||
|
||||
}
|
||||
|
||||
void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 image_ny, UINT32 image_scale_x, UINT32 image_scale_y)
|
||||
void GFX_set_background(gfx_t *pObj, uint32_t *pImage, uint32_t image_nx, uint32_t image_ny, uint32_t image_scale_x, uint32_t image_scale_y)
|
||||
{
|
||||
|
||||
UINT32 off_x, off_y;
|
||||
UINT32 i, j;
|
||||
UINT32 *pDst, *pSrc;
|
||||
uint32_t off_x, off_y;
|
||||
uint32_t i, j;
|
||||
uint32_t *pDst, *pSrc;
|
||||
buf_t *pBuf;
|
||||
|
||||
if (!pImage)
|
||||
@@ -354,15 +354,15 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
|
||||
pDst = ((UINT32*)pObj->pBG) + pObj->w*off_y + off_x;
|
||||
pDst = ((uint32_t*)pObj->pBG) + pObj->w*off_y + off_x;
|
||||
pSrc = pImage;
|
||||
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (UINT32)0;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)0;
|
||||
g_pRegs->pVGA_nx = (UINT32)image_ny*image_nx;
|
||||
g_pRegs->pVGA_ny = (UINT32)1;
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (uint32_t)0;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)0;
|
||||
g_pRegs->pVGA_nx = (uint32_t)image_ny*image_nx;
|
||||
g_pRegs->pVGA_ny = (uint32_t)1;
|
||||
g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -374,12 +374,12 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima
|
||||
pDst = pBuf->pFB;
|
||||
pSrc = pObj->pBG;
|
||||
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (UINT32)0;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)0;
|
||||
g_pRegs->pVGA_nx = (UINT32)image_ny*image_nx;
|
||||
g_pRegs->pVGA_ny = (UINT32)1;
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (uint32_t)0;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)0;
|
||||
g_pRegs->pVGA_nx = (uint32_t)image_ny*image_nx;
|
||||
g_pRegs->pVGA_ny = (uint32_t)1;
|
||||
g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -390,7 +390,7 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima
|
||||
|
||||
#else
|
||||
|
||||
pDst = ((UINT32*)pObj->pBG) + pObj->w*off_y + off_x;
|
||||
pDst = ((uint32_t*)pObj->pBG) + pObj->w*off_y + off_x;
|
||||
pSrc = pImage;
|
||||
|
||||
for (i=0; i < image_ny*image_nx; i += 8)
|
||||
@@ -423,13 +423,13 @@ void GFX_set_background(gfx_t *pObj, UINT32 *pImage, UINT32 image_nx, UINT32 ima
|
||||
|
||||
}
|
||||
|
||||
void GFX_frame(gfx_t *pObj, UINT32 sync_mode)
|
||||
void GFX_frame(gfx_t *pObj, uint32_t sync_mode)
|
||||
{
|
||||
|
||||
// Wait until back buffer becomes front
|
||||
if (sync_mode == GFX_FRAME_SYNC)
|
||||
{
|
||||
while(g_pRegs->pVGA_front == (UINT32)pObj->pBuf->pFB);
|
||||
while(g_pRegs->pVGA_front == (uint32_t)pObj->pBuf->pFB);
|
||||
}
|
||||
|
||||
GFX_copy_front2back(pObj);
|
||||
@@ -445,7 +445,7 @@ void GFX_frame(gfx_t *pObj, UINT32 sync_mode)
|
||||
void GFX_show(gfx_t *pObj)
|
||||
{
|
||||
|
||||
g_pRegs->pVGA_back = (UINT32)pObj->pBuf->pFB;
|
||||
g_pRegs->pVGA_back = (uint32_t)pObj->pBuf->pFB;
|
||||
pObj->pBuf = pObj->pBuf->pNext;
|
||||
|
||||
}
|
||||
@@ -469,22 +469,22 @@ void GFX_copy_front2back(gfx_t *pObj)
|
||||
}
|
||||
}
|
||||
|
||||
void GFX_get_FB_front(gfx_t *pObj, UINT32 **ppFB)
|
||||
void GFX_get_FB_front(gfx_t *pObj, uint32_t **ppFB)
|
||||
{
|
||||
*ppFB = pObj->pBuf->pLast->pFB;
|
||||
}
|
||||
|
||||
void box_create(box_t *pObj, UINT32 w, UINT32 h)
|
||||
void box_create(box_t *pObj, uint32_t w, uint32_t h)
|
||||
{
|
||||
pObj->w = w;
|
||||
pObj->h = h;
|
||||
}
|
||||
|
||||
void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy)
|
||||
void GFX_restore(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy)
|
||||
{
|
||||
UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
UINT32 *pDst, *pDst_end;
|
||||
UINT32 *pSrc, *pSrc_end;
|
||||
uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
uint32_t *pDst, *pDst_end;
|
||||
uint32_t *pSrc, *pSrc_end;
|
||||
buf_t *pBuf;
|
||||
|
||||
if (pBox)
|
||||
@@ -529,15 +529,15 @@ void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy)
|
||||
ymax *= pObj->w;
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
pSrc = (UINT32*)&pObj->pBG[xmin + ymin];
|
||||
pDst = (UINT32*)&pBuf->pFB[xmin + ymin];
|
||||
pSrc = (uint32_t*)&pObj->pBG[xmin + ymin];
|
||||
pDst = (uint32_t*)&pBuf->pFB[xmin + ymin];
|
||||
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (UINT32)pObj->w;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w;
|
||||
g_pRegs->pVGA_nx = (UINT32)nx;
|
||||
g_pRegs->pVGA_ny = (UINT32)ny;
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_src0_dimx = (uint32_t)pObj->w;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w;
|
||||
g_pRegs->pVGA_nx = (uint32_t)nx;
|
||||
g_pRegs->pVGA_ny = (uint32_t)ny;
|
||||
g_pRegs->pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -569,10 +569,10 @@ void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy)
|
||||
|
||||
}
|
||||
|
||||
void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color)
|
||||
void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color)
|
||||
{
|
||||
UINT32 xmin, xmax, xmax8, ymin, ymax, x, y;
|
||||
UINT32 *pFB, *pFB_end;
|
||||
uint32_t xmin, xmax, xmax8, ymin, ymax, x, y;
|
||||
uint32_t *pFB, *pFB_end;
|
||||
buf_t *pBuf;
|
||||
|
||||
pBuf = pObj->pBuf->pLast;
|
||||
@@ -609,10 +609,10 @@ void GFX_box_draw_direct(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UIN
|
||||
|
||||
}
|
||||
|
||||
void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color)
|
||||
void GFX_box_draw(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color)
|
||||
{
|
||||
UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
UINT32 *pFB, *pFB_end;
|
||||
uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
uint32_t *pFB, *pFB_end;
|
||||
buf_t *pBuf;
|
||||
|
||||
xmin = posx;
|
||||
@@ -646,12 +646,12 @@ void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 col
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
|
||||
pFB = (UINT32*)&pBuf->pFB[xmin + ymin];
|
||||
pFB = (uint32_t*)&pBuf->pFB[xmin + ymin];
|
||||
|
||||
g_pRegs->pVGA_dst = (UINT32)pFB;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w;
|
||||
g_pRegs->pVGA_nx = (UINT32)nx;
|
||||
g_pRegs->pVGA_ny = (UINT32)ny;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pFB;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w;
|
||||
g_pRegs->pVGA_nx = (uint32_t)nx;
|
||||
g_pRegs->pVGA_ny = (uint32_t)ny;
|
||||
g_pRegs->pVGA_color = color;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -681,10 +681,10 @@ void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 col
|
||||
#endif
|
||||
}
|
||||
|
||||
void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color)
|
||||
void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color)
|
||||
{
|
||||
UINT32 xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
UINT32 *pFB, *pFB_end;
|
||||
uint32_t xmin, xmax, xmax8, ymin, ymax, x, y, nx, ny;
|
||||
uint32_t *pFB, *pFB_end;
|
||||
|
||||
xmin = posx;
|
||||
xmax = pBox->w + posx - 0;
|
||||
@@ -705,12 +705,12 @@ void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
|
||||
pFB = (UINT32*)&pObj->pBG[xmin + ymin];
|
||||
pFB = (uint32_t*)&pObj->pBG[xmin + ymin];
|
||||
|
||||
g_pRegs->pVGA_dst = (UINT32)pFB;
|
||||
g_pRegs->pVGA_dst_dimx = (UINT32)pObj->w;
|
||||
g_pRegs->pVGA_nx = (UINT32)nx;
|
||||
g_pRegs->pVGA_ny = (UINT32)ny;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pFB;
|
||||
g_pRegs->pVGA_dst_dimx = (uint32_t)pObj->w;
|
||||
g_pRegs->pVGA_nx = (uint32_t)nx;
|
||||
g_pRegs->pVGA_ny = (uint32_t)ny;
|
||||
g_pRegs->pVGA_color = color;
|
||||
|
||||
while (g_pRegs->pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
@@ -739,15 +739,15 @@ void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32
|
||||
|
||||
}
|
||||
|
||||
void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst)
|
||||
void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst)
|
||||
{
|
||||
|
||||
UINT32 x_src, y_src, xmax8_src;
|
||||
UINT32 x_dst, y_dst, xmax8_dst;
|
||||
UINT32 xmin_src, xmax_src, ymin_src, ymax_src;
|
||||
UINT32 xmin_dst, xmax_dst, ymin_dst, ymax_dst;
|
||||
UINT32 *pDst, *pDst_end;
|
||||
UINT32 *pSrc, *pSrc_end;
|
||||
uint32_t x_src, y_src, xmax8_src;
|
||||
uint32_t x_dst, y_dst, xmax8_dst;
|
||||
uint32_t xmin_src, xmax_src, ymin_src, ymax_src;
|
||||
uint32_t xmin_dst, xmax_dst, ymin_dst, ymax_dst;
|
||||
uint32_t *pDst, *pDst_end;
|
||||
uint32_t *pSrc, *pSrc_end;
|
||||
buf_t *pBuf;
|
||||
pBuf = pObj->pBuf->pNext;
|
||||
|
||||
@@ -781,12 +781,12 @@ void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_sr
|
||||
pBuf = pObj->pBuf;
|
||||
|
||||
#ifdef USE_HW_BLITTER
|
||||
pSrc = (UINT32*)&pObj->pBG[xmin_src + ymin_src*pObj->w];
|
||||
pDst = (UINT32*)&pBuf->pFB[xmin_dst + ymin_dst*pObj->w];
|
||||
pSrc = (uint32_t*)&pObj->pBG[xmin_src + ymin_src*pObj->w];
|
||||
pDst = (uint32_t*)&pBuf->pFB[xmin_dst + ymin_dst*pObj->w];
|
||||
|
||||
g_pRegs->pVGA_src0 = (UINT32)pSrc;
|
||||
g_pRegs->pVGA_src0 = (uint32_t)pSrc;
|
||||
g_pRegs->pVGA_src0_dimx = pObj->w;
|
||||
g_pRegs->pVGA_dst = (UINT32)pDst;
|
||||
g_pRegs->pVGA_dst = (uint32_t)pDst;
|
||||
g_pRegs->pVGA_dst_dimx = pObj->w;
|
||||
g_pRegs->pVGA_nx = pBox->w;
|
||||
g_pRegs->pVGA_ny = pBox->h;
|
||||
|
||||
+46
-46
@@ -12,58 +12,58 @@
|
||||
// -------------------------------------------------------------
|
||||
typedef struct _sbox_t
|
||||
{
|
||||
UINT32 w, h;
|
||||
uint32_t w, h;
|
||||
} box_t;
|
||||
|
||||
typedef struct _srect_t
|
||||
{
|
||||
UINT32 xmin, xmax;
|
||||
UINT32 ymin, ymax;
|
||||
uint32_t xmin, xmax;
|
||||
uint32_t ymin, ymax;
|
||||
} rect_t;
|
||||
|
||||
typedef struct _svga_hw_t
|
||||
{
|
||||
UINT32 volatile pVGA_ctrl; // 0xA0030000 // R/W
|
||||
UINT32 volatile pVGA_ascii; // 0xA0030004 // R/W
|
||||
UINT32 volatile pVGA_posx; // 0xA0030008 // R/W
|
||||
UINT32 volatile pVGA_posy; // 0xA003000C // R/W
|
||||
UINT32 volatile pVGA_cgcol; // 0xA0030010 // R/W
|
||||
UINT32 volatile pVGA_res; // 0xA0030014 // RO
|
||||
UINT32 volatile pVGA_front; // 0xA0030018 // R/W
|
||||
UINT32 volatile pVGA_back; // 0xA003001C // R/W
|
||||
UINT32 volatile pVGA_src0; // 0xA0030020 // R/W
|
||||
UINT32 volatile pVGA_src0_dimx; // 0xA0030024 // R/W
|
||||
UINT32 volatile pVGA_gap0; // 0xA0030028 // R/W
|
||||
UINT32 volatile pVGA_gap1; // 0xA003002C // R/W
|
||||
UINT32 volatile pVGA_src1; // 0xA0030030 // R/W
|
||||
UINT32 volatile pVGA_src1_dimx; // 0xA0030034 // R/W
|
||||
UINT32 volatile pVGA_gap2; // 0xA0030038 // R/W
|
||||
UINT32 volatile pVGA_gap3; // 0xA003003C // R/W
|
||||
UINT32 volatile pVGA_dst; // 0xA0030040 // R/W
|
||||
UINT32 volatile pVGA_dst_dimx; // 0xA0030044 // R/W
|
||||
UINT32 volatile pVGA_gap4; // 0xA0030048 // R/W
|
||||
UINT32 volatile pVGA_gap5; // 0xA003004C // R/W
|
||||
UINT32 volatile pVGA_nx; // 0xA0030050 // R/W
|
||||
UINT32 volatile pVGA_ny; // 0xA0030054 // R/W
|
||||
UINT32 volatile pVGA_color; // 0xA0030058 // R/W
|
||||
uint32_t volatile pVGA_ctrl; // 0xA0030000 // R/W
|
||||
uint32_t volatile pVGA_ascii; // 0xA0030004 // R/W
|
||||
uint32_t volatile pVGA_posx; // 0xA0030008 // R/W
|
||||
uint32_t volatile pVGA_posy; // 0xA003000C // R/W
|
||||
uint32_t volatile pVGA_cgcol; // 0xA0030010 // R/W
|
||||
uint32_t volatile pVGA_res; // 0xA0030014 // RO
|
||||
uint32_t volatile pVGA_front; // 0xA0030018 // R/W
|
||||
uint32_t volatile pVGA_back; // 0xA003001C // R/W
|
||||
uint32_t volatile pVGA_src0; // 0xA0030020 // R/W
|
||||
uint32_t volatile pVGA_src0_dimx; // 0xA0030024 // R/W
|
||||
uint32_t volatile pVGA_gap0; // 0xA0030028 // R/W
|
||||
uint32_t volatile pVGA_gap1; // 0xA003002C // R/W
|
||||
uint32_t volatile pVGA_src1; // 0xA0030030 // R/W
|
||||
uint32_t volatile pVGA_src1_dimx; // 0xA0030034 // R/W
|
||||
uint32_t volatile pVGA_gap2; // 0xA0030038 // R/W
|
||||
uint32_t volatile pVGA_gap3; // 0xA003003C // R/W
|
||||
uint32_t volatile pVGA_dst; // 0xA0030040 // R/W
|
||||
uint32_t volatile pVGA_dst_dimx; // 0xA0030044 // R/W
|
||||
uint32_t volatile pVGA_gap4; // 0xA0030048 // R/W
|
||||
uint32_t volatile pVGA_gap5; // 0xA003004C // R/W
|
||||
uint32_t volatile pVGA_nx; // 0xA0030050 // R/W
|
||||
uint32_t volatile pVGA_ny; // 0xA0030054 // R/W
|
||||
uint32_t volatile pVGA_color; // 0xA0030058 // R/W
|
||||
|
||||
} vga_hw_t;
|
||||
|
||||
typedef struct _sbuf_t
|
||||
{
|
||||
UINT32 *pFB;
|
||||
uint32_t *pFB;
|
||||
struct _sbuf_t *pNext;
|
||||
struct _sbuf_t *pLast;
|
||||
UINT32 is_dirty;
|
||||
uint32_t is_dirty;
|
||||
rect_t dirty;
|
||||
UINT32 w, h;
|
||||
uint32_t w, h;
|
||||
} buf_t;
|
||||
|
||||
typedef struct _sgfx_t
|
||||
{
|
||||
UINT32 w, h;
|
||||
uint32_t w, h;
|
||||
buf_t *pBuf;
|
||||
UINT32 *pBG;
|
||||
uint32_t *pBG;
|
||||
rect_t restore;
|
||||
|
||||
} gfx_t;
|
||||
@@ -71,23 +71,23 @@ typedef struct _sgfx_t
|
||||
// -------------------------------------------------------------
|
||||
// Functions
|
||||
// -------------------------------------------------------------
|
||||
void __gfx_block_set_8(UINT32* pDst, UINT32 value);
|
||||
void __gfx_block_copy_8(UINT32* pDst, UINT32* pSrc);
|
||||
void _GFX_copy32(UINT32* pDst, UINT32* pSrc, UINT32 ndwords);
|
||||
void _GFX_copy32_hw(UINT32* pDst, UINT32* pSrc, UINT32 ndwords, UINT32 wait_finish);
|
||||
void _GFX_memset32(UINT32* pDst, UINT32 value, UINT32 ndwords);
|
||||
void _GFX_memset32_hw(UINT32* pDst, UINT32 value, UINT32 ndwords, UINT32 wait_finish);
|
||||
void _GFX_BLIT_const(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value);
|
||||
void _GFX_BLIT_const_hw(UINT32* pDst, UINT32 xdim_dst, UINT32 xmin, UINT32 ymin, UINT32 xmax, UINT32 ymax, UINT32 value, UINT32 wait_finish);
|
||||
void __gfx_block_set_8(uint32_t* pDst, uint32_t value);
|
||||
void __gfx_block_copy_8(uint32_t* pDst, uint32_t* pSrc);
|
||||
void _GFX_copy32(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords);
|
||||
void _GFX_copy32_hw(uint32_t* pDst, uint32_t* pSrc, uint32_t ndwords, uint32_t wait_finish);
|
||||
void _GFX_memset32(uint32_t* pDst, uint32_t value, uint32_t ndwords);
|
||||
void _GFX_memset32_hw(uint32_t* pDst, uint32_t value, uint32_t ndwords, uint32_t wait_finish);
|
||||
void _GFX_BLIT_const(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value);
|
||||
void _GFX_BLIT_const_hw(uint32_t* pDst, uint32_t xdim_dst, uint32_t xmin, uint32_t ymin, uint32_t xmax, uint32_t ymax, uint32_t value, uint32_t wait_finish);
|
||||
void GFX_init(gfx_t *pObj);
|
||||
void GFX_frame(gfx_t *pObj, UINT32 sync_mode);
|
||||
void GFX_frame(gfx_t *pObj, uint32_t sync_mode);
|
||||
void GFX_show(gfx_t *pObj);
|
||||
void GFX_copy_front2back(gfx_t *pObj);
|
||||
void GFX_get_FB_front(gfx_t *pObj, UINT32 **ppFB);
|
||||
void box_create(box_t *pObj, UINT32 w, UINT32 h);
|
||||
void GFX_restore(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy);
|
||||
void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color);
|
||||
void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color);
|
||||
void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, UINT32 pos_x_src, UINT32 pos_y_src, UINT32 pos_x_dst, UINT32 pos_y_dst);
|
||||
void GFX_get_FB_front(gfx_t *pObj, uint32_t **ppFB);
|
||||
void box_create(box_t *pObj, uint32_t w, uint32_t h);
|
||||
void GFX_restore(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy);
|
||||
void GFX_box_draw(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color);
|
||||
void GFX_box_draw_bg(gfx_t *pObj, box_t *pBox, uint32_t posx, uint32_t posy, uint32_t color);
|
||||
void GFX_box_blit_bg(gfx_t *pObj, box_t *pBox, uint32_t pos_x_src, uint32_t pos_y_src, uint32_t pos_x_dst, uint32_t pos_y_dst);
|
||||
|
||||
#endif // GFX_H
|
||||
|
||||
+14
-14
@@ -6,16 +6,16 @@
|
||||
|
||||
ps2_if_t ps2_if[2] =
|
||||
{
|
||||
{ps2_type_unknown, (UINT32*)SYS_PS2_0_STAT, (UINT32*)SYS_PS2_0_DATA},
|
||||
{ps2_type_unknown, (UINT32*)SYS_PS2_1_STAT, (UINT32*)SYS_PS2_1_DATA}
|
||||
{ps2_type_unknown, (uint32_t*)SYS_PS2_0_STAT, (uint32_t*)SYS_PS2_0_DATA},
|
||||
{ps2_type_unknown, (uint32_t*)SYS_PS2_1_STAT, (uint32_t*)SYS_PS2_1_DATA}
|
||||
};
|
||||
|
||||
UINT32 PS2_get_num_if(void)
|
||||
uint32_t PS2_get_num_if(void)
|
||||
{
|
||||
return (sizeof(ps2_if)/sizeof(ps2_if_t));
|
||||
}
|
||||
|
||||
ps2_if_t *PS2_get_if(UINT32 port)
|
||||
ps2_if_t *PS2_get_if(uint32_t port)
|
||||
{
|
||||
if (port < PS2_get_num_if())
|
||||
return &ps2_if[port];
|
||||
@@ -23,7 +23,7 @@ ps2_if_t *PS2_get_if(UINT32 port)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PS2_byte_write(UINT32 port, UINT8 byte)
|
||||
void PS2_byte_write(uint32_t port, uint8_t byte)
|
||||
{
|
||||
ps2_if_t *pIF;
|
||||
|
||||
@@ -31,10 +31,10 @@ void PS2_byte_write(UINT32 port, UINT8 byte)
|
||||
|
||||
while(!(*pIF->pCTRL & SYS_PS2_BIT_TX_EMPTY));
|
||||
|
||||
*pIF->pDATA = (UINT32)byte;
|
||||
*pIF->pDATA = (uint32_t)byte;
|
||||
}
|
||||
|
||||
UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms)
|
||||
uint32_t PS2_byte_read(uint32_t port, uint32_t timeout_ms)
|
||||
{
|
||||
ps2_if_t *pIF;
|
||||
|
||||
@@ -48,12 +48,12 @@ UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms)
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
return (UINT32)*pIF->pDATA;
|
||||
return (uint32_t)*pIF->pDATA;
|
||||
}
|
||||
|
||||
UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms)
|
||||
uint32_t PS2_cmd(uint32_t port, uint8_t cmd, uint32_t ack_timeout_ms)
|
||||
{
|
||||
UINT32 result;
|
||||
uint32_t result;
|
||||
|
||||
PS2_byte_write(port, cmd);
|
||||
result = PS2_byte_read(port, ack_timeout_ms);
|
||||
@@ -65,21 +65,21 @@ UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PS2_flush(UINT32 port)
|
||||
void PS2_flush(uint32_t port)
|
||||
{
|
||||
while (!IS_ERROR(PS2_byte_read(port, 10)));
|
||||
}
|
||||
|
||||
UINT32 PS2_init(UINT32 port)
|
||||
uint32_t PS2_init(uint32_t port)
|
||||
{
|
||||
int i;
|
||||
ps2_if_t *pIF;
|
||||
UINT8 id[2];
|
||||
uint8_t id[2];
|
||||
|
||||
pIF = &ps2_if[port];
|
||||
pIF->type = ps2_type_unknown;
|
||||
|
||||
UINT32 result;
|
||||
uint32_t result;
|
||||
|
||||
// Disable RX-interrupt
|
||||
*pIF->pCTRL &= ~SYS_PS2_BIT_RX_INTEN;
|
||||
|
||||
+10
-10
@@ -15,9 +15,9 @@ enum
|
||||
|
||||
typedef struct _sps2_if_t
|
||||
{
|
||||
UINT32 type;
|
||||
volatile UINT32 *pCTRL;
|
||||
volatile UINT32 *pDATA;
|
||||
uint32_t type;
|
||||
volatile uint32_t *pCTRL;
|
||||
volatile uint32_t *pDATA;
|
||||
} ps2_if_t;
|
||||
|
||||
// --------------------------------------------------
|
||||
@@ -32,12 +32,12 @@ typedef struct _sps2_if_t
|
||||
// --------------------------------------------------
|
||||
// Functions
|
||||
// --------------------------------------------------
|
||||
UINT32 PS2_get_num_if(void);
|
||||
ps2_if_t *PS2_get_if(UINT32 port);
|
||||
UINT32 PS2_init(UINT32 port);
|
||||
void PS2_byte_write(UINT32 port, UINT8 byte);
|
||||
UINT32 PS2_byte_read(UINT32 port, UINT32 timeout_ms);
|
||||
UINT32 PS2_cmd(UINT32 port, UINT8 cmd, UINT32 ack_timeout_ms);
|
||||
void PS2_flush(UINT32 port);
|
||||
uint32_t PS2_get_num_if(void);
|
||||
ps2_if_t *PS2_get_if(uint32_t port);
|
||||
uint32_t PS2_init(uint32_t port);
|
||||
void PS2_byte_write(uint32_t port, uint8_t byte);
|
||||
uint32_t PS2_byte_read(uint32_t port, uint32_t timeout_ms);
|
||||
uint32_t PS2_cmd(uint32_t port, uint8_t cmd, uint32_t ack_timeout_ms);
|
||||
void PS2_flush(uint32_t port);
|
||||
|
||||
#endif // PS2_H
|
||||
|
||||
Reference in New Issue
Block a user