#define GPIO_DIR_HIGH (0xbfe00120) #define GPIO_DATA_HIGH (0xbfe0011c) #define G_OUTPUT 0 #define G_INPUT 1 #define GPIO_SDA_DIR_SHIFT 2 #define GPIO_SCL_DIR_SHIFT 3 #define GPIO_SDA_DATA_SHIFT 2 #define GPIO_SCL_DATA_SHIFT 3 /* can't use t1,t5,t6 */ LEAF(_i2c_sleep) // // li t0,0x300 li t0,0x3 sll a0,t0,a0 1: nop subu a0,1 bnez a0,1b nop jr ra nop END(_i2c_sleep) LEAF(_sda_dir) li t0,GPIO_DIR_HIGH lwu t2,0(t0) nop beqz a0,1f nop ori t2,t2,0x1<