📄 asmcom.s
字号:
#include <asm.h>#include <mipsreg.h>#include <cpureg.h>/* manifest constants for com ports */#define COM1 0xbff80de0#define COM2 0xbff80be0#define RBR 0xbff80de0#define THR 0xbff80de0#define DLL 0xbff80de0#define IER_COM 0xbff80de1#define DLH 0xbff80de1#define IIR 0xbff80de2#define FCR 0xbff80de2#define LCR 0xbff80de3#define MCR 0xbff80de4#define LSR 0xbff80de5#define MSR 0xbff80de6#define SCR 0xbff80de7/*///#define RBR 0xbff80be0///#define THR 0xbff80be0///#define DLL 0xbff80be0///#define IER 0xbff80be1///#define DLH 0xbff80be1///#define IIR 0xbff80be2///#define FCR 0xbff80be2///#define LCR 0xbff80be3///#define MCR 0xbff80be4///#define LSR 0xbff80be5///#define MSR 0xbff80be6///#define SCR 0xbff80be7*//* 16550A definition */#define CLEAR 0x00#define DTR 0x01#define RTS 0x02#define CTS 0x10#define DSR 0x20#define CD 0x80#define DR 0x01 /* Data Ready */#define OR 0x02 /*Overrrun */#define THRE 0x20 /* Transmitter Holding Register */#define TEMT 0x40 /* Transmitter Empty */#define Rx_ON (DTR | RTS)#define Tx_ON (CD | DSR)#define Tx_DATA_ON (THRE | TEMT)#define BAUD_DATA_MSB 0x00 # set divisor 12 /*#define BAUD_DATA_LSB 0x0C // 9600 baud #define BAUD_DATA_LSB 0x5B // 1200 baud #define BAUD_DATA_LSB 0x8B // 300 baud [8 MHz crystal:(8M/2)/(6*16*BAUD_DATA)=300 baud]*/#define BAUD_DATA_LSB 0x18 /* 300 baud [5 MHz crystal:(5M/2)/(6*16*BAUD_DATA)=300 baud]*/#define DIVISOR_ON 0x80#define SERIAL_SET_DATA 0x03#define RxRDY 0x01#define TxRDY 0x20#define CLEAR_DATA 0x00#define DIS_FIFO 0x06 /* FIFO disable */#define EN_FIFO 0x07 /* FIFO enable */#define SCU_CMD_IDLE 0x01 /* * InitDebugSerial : void InitDebugSerial(void) * * Initialize debug serial port. * * Args: none * Return: none */ LEAF(InitDebugSerial).set noreorder li t0,LCR li t1,CLEAR_DATA sb t1,(t0) li t0,IER_COM sb t1,(t0) li t0,FCR li t1,EN_FIFO sb t1,(t0) li t0,LCR li t1,DIVISOR_ON sb t1,(t0) li t0,DLL li t1,BAUD_DATA_LSB sb t1,(t0) li t0,DLH li t1,BAUD_DATA_MSB sb t1,(t0) li t0,LCR li t1,SERIAL_SET_DATA sb t1,(t0) li t0,MCR li t1,DTR | RTS | 8 sb t1,(t0) j ra nop .end /* * WriteDebugByte : void WriteDebugByte(char c) */ LEAF(WriteDebugByte).set noreorder li t2,THRE li t1,01: li t0,LSR lb t1,(t0) and t1,t2 # mask:0x20 bne t1,t2,1b nop li t0,THR sb a0,(t0) j ra nop .end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -