Learning

导航

NIOS的system.h解读--PIO实现的LED灯和key

#define LED_NAME "/dev/led"  //设备名
#define LED_TYPE "altera_avalon_pio"  //sopc对应的ip核
#define LED_BASE 0x010020c0          //基地址
#define LED_SPAN 16                      //存储地址的总大小
#define LED_DO_TEST_BENCH_WIRING 0
#define LED_DRIVEN_SIM_VALUE 0
#define LED_HAS_TRI 0             //IO口为三态
#define LED_HAS_OUT 1          //IO口为输出
#define LED_HAS_IN 0            //IO口为输入
#define LED_CAPTURE 0             //无edge capture
#define LED_DATA_WIDTH 8   //数据宽度
#define LED_RESET_VALUE 0   //复位值
#define LED_EDGE_TYPE "NONE"   //无edge capture 类型
#define LED_IRQ_TYPE "NONE"      //无中断
#define LED_BIT_CLEARING_EDGE_REGISTER 0//无edge capture register清零
#define LED_FREQ 50000000   //时钟
#define ALT_MODULE_CLASS_led altera_avalon_pio


ine KEY_IN_NAME "/dev/key_in"
#define KEY_IN_TYPE "altera_avalon_pio"
#define KEY_IN_BASE 0x010020f0
#define KEY_IN_SPAN 16
#define KEY_IN_IRQ 4                        //中断号
#define KEY_IN_DO_TEST_BENCH_WIRING 0
#define KEY_IN_DRIVEN_SIM_VALUE 0
#define KEY_IN_HAS_TRI 0
#define KEY_IN_HAS_OUT 0
#define KEY_IN_HAS_IN 1
#define KEY_IN_CAPTURE 1                      //edge capture
#define KEY_IN_DATA_WIDTH 8
#define KEY_IN_RESET_VALUE 0
#define KEY_IN_EDGE_TYPE "FALLING"      //edge capture 类型下降沿
#define KEY_IN_IRQ_TYPE "EDGE"            //中断沿触发
#define KEY_IN_BIT_CLEARING_EDGE_REGISTER 0
#define KEY_IN_FREQ 50000000
#define ALT_MODULE_CLASS_key_in altera_avalon_pio

posted on 2009-07-26 21:06  xinjie  阅读(1111)  评论(0编辑  收藏  举报