- initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
#ifndef LIBSYS_H
|
||||
#define LIBSYS_H
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// Types
|
||||
// ---------------------------------------------------------
|
||||
#define INT8 char
|
||||
#define INT16 short
|
||||
#define INT32 long
|
||||
#define UINT8 unsigned char
|
||||
#define UINT16 unsigned short
|
||||
#define UINT32 unsigned long
|
||||
#define INT int
|
||||
#define UINT unsigned int
|
||||
#define FLOAT32 float
|
||||
#define FLOAT64 double
|
||||
|
||||
#define IS_ERROR(e) ((e & 0x80000000) == 0x80000000)
|
||||
|
||||
#ifndef SYS_IO_BASE
|
||||
#define SYS_IO_BASE 0xA0000000
|
||||
#endif
|
||||
#ifndef SDRAM_BASE
|
||||
#define SDRAM_BASE 0x40000000
|
||||
#endif
|
||||
#ifndef FLASH_BASE_IO
|
||||
#define FLASH_BASE_IO 0xA4000000
|
||||
#endif
|
||||
#ifndef FLASH_BASE_MEM
|
||||
#define FLASH_BASE_MEM 0x00000000
|
||||
#endif
|
||||
|
||||
|
||||
#define SYS_GPIO_0_DATA (SYS_IO_BASE + 0x0)
|
||||
#define SYS_GPIO_0_DIR (SYS_IO_BASE + 0x4)
|
||||
#define GPIO_0_DFLT_DIR (GPIO_0_LED | GPIO_0_USB_RST | GPIO_0_USB_INTEN | GPIO_0_AC97_INTEN | GPIO_0_PHY_RST | GPIO_0_PHY_MDC)
|
||||
#define GPIO_0_DFLT_DATA ((~GPIO_0_LED & GPIO_0_LED) | GPIO_0_USB_RST | (~GPIO_0_USB_INTEN & GPIO_0_USB_INTEN) | (~GPIO_0_AC97_INTEN & GPIO_0_AC97_INTEN) | GPIO_0_PHY_RST | (~GPIO_0_PHY_MDC & GPIO_0_PHY_MDC))
|
||||
#define GPIO_0_LED 0x000001FF
|
||||
#define GPIO_0_BTN 0x1F000000
|
||||
#define GPIO_0_DIP 0x00FF0000
|
||||
#define GPIO_0_USB_RST 0x00001000
|
||||
#define GPIO_0_USB_INTEN 0x00002000
|
||||
#define GPIO_0_AC97_INTEN 0x00008000
|
||||
#define GPIO_0_PHY_RST 0x20000000
|
||||
#define GPIO_0_PHY_MDC 0x40000000
|
||||
#define GPIO_0_PHY_MDIO 0x80000000
|
||||
#define GPIO_0_ALIGN_LED 0
|
||||
#define GPIO_0_ALIGN_DIP 16
|
||||
#define GPIO_0_ALIGN_BTN 24
|
||||
#define GPIO_0_ALIGN_MDIO 31
|
||||
|
||||
#define SYS_TIMER_USEC (SYS_IO_BASE + 0x8)
|
||||
#define SYS_TIMER_SEC (SYS_IO_BASE + 0xC)
|
||||
#define SYS_UART_DATA (SYS_IO_BASE + 0x10000)
|
||||
#define SYS_UART_STAT (SYS_IO_BASE + 0x10004)
|
||||
#define SYS_UART_BAUD (SYS_IO_BASE + 0x10008)
|
||||
#define SYS_USB_DATA (SYS_IO_BASE + 0x20000)
|
||||
#define SYS_USB_MBX (SYS_IO_BASE + 0x20004)
|
||||
#define SYS_USB_ADDR (SYS_IO_BASE + 0x20008)
|
||||
#define SYS_USB_STATUS (SYS_IO_BASE + 0x2000C)
|
||||
#define SYS_FLASH_IO 0xA4000000
|
||||
#define SYS_FLASH_MEM 0x00000000
|
||||
|
||||
// MIPS specific
|
||||
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);
|
||||
|
||||
// General
|
||||
char readchar(void);
|
||||
void writechar(char c);
|
||||
int write(int file, char *ptr, int len);
|
||||
int sputs(char *pStr);
|
||||
void print_byte(char byte);
|
||||
void print_word(int word);
|
||||
void PrintBuffer8(UINT8 *pBuf, int nbpr, int len);
|
||||
void memdump(UINT8 *pBuf, int print_offset_only, int num_bytes_per_row, int len);
|
||||
|
||||
#endif // LIBSYS_H
|
||||
|
||||
Reference in New Issue
Block a user