board.h

来自「ucos 在arca方舟芯片(mips)上的移植。」· C头文件 代码 · 共 31 行

H
31
字号
#include "hal_regs.h"#include "hal_io.h"#define plf_gpio_init()				\do {						\    unsigned int gpio;				\    /* turn off the dancing leds. */		\    outb(UCOS_REG_GPDR_A, 0xff);			\    /* gpio init */				\    gpio = inl(UCOS_REG_GPCR_C);		\    /* bit7-3 as UART/SCC */			\    outl(UCOS_REG_GPCR_C, gpio | 0x0000C000);	\    gpio = inl(UCOS_REG_GPCR_D);		\    /* bit3-0 as UART/IRDA */			\    outl(UCOS_REG_GPCR_D, gpio | 0x00000F00);   \}while(0)#define hal_led_dancing()						\do {									\    static unsigned char led_dancing_timer1 = 0;			\    static unsigned char led_dancing_timer2 = 0;			\    volatile unsigned char *gpio_b = (unsigned char *)UCOS_REG_GPDR_A;	\    led_dancing_timer1 ++;						\    if (led_dancing_timer1 == 50) {					\	led_dancing_timer1 = 0;						\	(*gpio_b) = 0x0f & ~(1 << led_dancing_timer2);			\	led_dancing_timer2 ++;						\	if (led_dancing_timer2 == 4) led_dancing_timer2 = 0;		\    }                                                                   \} while (0)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?