⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ca6004.h

📁 miceteck_MPC860_BSP源码,基于VXWORK
💻 H
字号:
/* ------- ca6004.h - header for ca6004.c -------- */
/* Copyright 2000-2003 AllOptic NetWorking Co.,Ltd */

#define TRUE 1
#define FALS 0

/* 定义基址 */
#define PLD_BASE 0x30000000

/* 定义存储器空间(32k) */
#define PLD_SIZE 0x00008000 

/* CPLD register offset address definition */
#define CA6004_REG_BOD_INF       0x0      /* 单盘在位 */
#define CA6004_REG_OT1_TYP       0x1      /* 一号业务盘类型 */
#define CA6004_REG_OT2_TYP       0x2      /* 二号业务盘类型 */
#define CA6004_REG_OT3_TYP       0x3      /* 三号业务盘类型 */
#define CA6004_REG_OT4_TYP       0x4      /* 四号业务盘类型 */
#define CA6004_REG_SYS_ALM       0x5      /* 系统告警 */
#define CA6004_REG_OT1_ALM       0x6      /* 一号业务盘告警 */
#define CA6004_REG_OT2_ALM       0x7      /* 二号业务盘告警 */
#define CA6004_REG_OT3_ALM       0x8      /* 三号业务盘告警 */
#define CA6004_REG_OT4_ALM       0x9      /* 四号业务盘告警 */
#define CA6004_REG_OSC_ALM       0xA      /* OSC告警 */
#define CA6004_REG_LAS_STA       0xB      /* 激光器使能控制 */
#define CA6004_REG_SWI_STA       0xC      /* 交换机端口使能控制 */
#define CA6004_REG_SYS_LED       0xD      /* 系统LED状态 */
#define CA6004_REG_OTU_LED       0xE      /* 业务LED状态 */ 
#define CA6004_REG_RST_CTL       0xF      /* 看门狗复位输出控制 */ 


/* CPLD register address pointer definition */
volatile unsigned *CA6004_POI_BOD_INF = (unsigned *)(PLD_BASE + CA6004_REG_BOD_INF);
volatile unsigned *CA6004_POI_OT1_TYP = (unsigned *)(PLD_BASE + CA6004_REG_OT1_TYP);
volatile unsigned *CA6004_POI_OT2_TYP = (unsigned *)(PLD_BASE + CA6004_REG_OT2_TYP);
volatile unsigned *CA6004_POI_OT3_TYP = (unsigned *)(PLD_BASE + CA6004_REG_OT3_TYP);
volatile unsigned *CA6004_POI_OT4_TYP = (unsigned *)(PLD_BASE + CA6004_REG_OT4_TYP);
volatile unsigned *CA6004_POI_SYS_ALM = (unsigned *)(PLD_BASE + CA6004_REG_SYS_ALM);
volatile unsigned *CA6004_POI_OT1_ALM = (unsigned *)(PLD_BASE + CA6004_REG_OT1_ALM);
volatile unsigned *CA6004_POI_OT2_ALM = (unsigned *)(PLD_BASE + CA6004_REG_OT2_ALM);
volatile unsigned *CA6004_POI_OT3_ALM = (unsigned *)(PLD_BASE + CA6004_REG_OT3_ALM);
volatile unsigned *CA6004_POI_OT4_ALM = (unsigned *)(PLD_BASE + CA6004_REG_OT4_ALM);
volatile unsigned *CA6004_POI_OSC_ALM = (unsigned *)(PLD_BASE + CA6004_REG_OSC_ALM);
volatile unsigned *CA6004_POI_LAS_STA = (unsigned *)(PLD_BASE + CA6004_REG_LAS_STA);
volatile unsigned *CA6004_POI_SWI_STA = (unsigned *)(PLD_BASE + CA6004_REG_SWI_STA);
volatile unsigned *CA6004_POI_SYS_LED = (unsigned *)(PLD_BASE + CA6004_REG_SYS_LED);
volatile unsigned *CA6004_POI_OTU_LED = (unsigned *)(PLD_BASE + CA6004_REG_OTU_LED);
volatile unsigned *CA6004_POI_RST_CTL = (unsigned *)(PLD_BASE + CA6004_REG_RST_CTL);

/***AllOptic Networking***/

/* MAX197 A/D control definition */
#define ADRDSTART ( *PADIR(immr) = (*PADIR(immr)&0xFA03)|0xF000 )
#define ADWRSTART ( *PADIR(immr) |= 0xF5FC )
#define ADCSHI ( *PADAT(immr) |= 0x8000 )
#define ADCSLO ( *PADAT(immr) &= ~0x8000 )
#define ADWRHI ( *PADAT(immr) |= 0x4000 )
#define ADWRLO ( *PADAT(immr) &= ~0x4000 )
#define ADRDHI ( *PADAT(immr) |= 0x2000 )
#define ADRDLO ( *PADAT(immr) &= ~0x2000 )
#define HBENHI ( *PADAT(immr) |= 0x1000 )
#define HBENLO ( *PADAT(immr) &= ~0x1000 )
#define PIN1START ( *PADAT(immr) = (*PADAT(immr)&0xFA0B)|0x0008 )
#define PIN2START ( *PADAT(immr) = (*PADAT(immr)&0xFE0B)|0x0408 )
#define PIN3START ( *PADAT(immr) = (*PADAT(immr)&0xFB0B)|0x0108 )
#define PIN4START ( *PADAT(immr) = (*PADAT(immr)&0xFF0B)|0x0508 )
#define PIN5START ( *PADAT(immr) = (*PADAT(immr)&0xFA8B)|0x0088 )
#define PIN6START ( *PADAT(immr) = (*PADAT(immr)&0xFE8B)|0x0488 )
#define PIN7START ( *PADAT(immr) = (*PADAT(immr)&0xFB8B)|0x0188 )
#define PIN8START ( *PADAT(immr) = (*PADAT(immr)&0xFF8B)|0x0588 )
#define ADNOP for(i=0;i<1000;i++)
 
/* GBIC I2C control definition */
#define GBICCLKHI  ( *PBDAT(immr) |= 0x00010000 ) 
#define GBICCLKLO  ( *PBDAT(immr) &= ~0x00010000 )
#define GBICDATHI  ( *PBDAT(immr) |= 0x00008000 ) 
#define GBICDATLO  ( *PBDAT(immr) &= ~0x00008000 )
#define GBICDATOU  ( *PBDIR(immr) |= 0x00008000 )
#define GBICDATIN  ( *PBDIR(immr) &= ~0x00008000 )
#define GBICENA11  ( *PBDAT(immr) |= 0x00004000 )
#define GBICDIS11  ( *PBDAT(immr) &= ~0x00004000 )
#define GBICENA12  ( *PBDAT(immr) |= 0x00002000 )
#define GBICDIS12  ( *PBDAT(immr) &= ~0x00002000 ) 
#define GBICENA13  ( *PBDAT(immr) |= 0x00000800 )
#define GBICDIS13  ( *PBDAT(immr) &= ~0x00000800 )  
#define GBICENA14  ( *PBDAT(immr) |= 0x00000400 ) 
#define GBICDIS14  ( *PBDAT(immr) &= ~0x00000400 )
#define GBICENA21  ( *PCDAT(immr) |= 0x0008 ) 
#define GBICDIS21  ( *PCDAT(immr) &= ~0x0008 )
#define GBICENA22  ( *PCDAT(immr) |= 0x0004 ) 
#define GBICDIS22  ( *PCDAT(immr) &= ~0x0004 )
#define GBICENA23  ( *PCDAT(immr) |= 0x0002 ) 
#define GBICDIS23  ( *PCDAT(immr) &= ~0x0002 )
#define GBICENA24  ( *PCDAT(immr) |= 0x0001 ) 
#define GBICDIS24  ( *PCDAT(immr) &= ~0x0001 )
#define GBICWRITADD  0x00a0
#define GBICREADADD  0x00a1

/* ks8999 eeprom read/write definition */
#define CLKHI ( *PCDAT(immr) |= 0x0100 ) 
#define CLKLO ( *PCDAT(immr) &= 0xfeff )
#define DATHI ( *PCDAT(immr) |= 0x0080 ) 
#define DATLO ( *PCDAT(immr) &= 0xff7f )
#define WRITEADD 0x00a0
#define READADD  0x00a1
#define TRUE 1
#define FALS 0

/* GBIC temperature,current,opticPower read command definition */
#define GET_TEMP          140
#define GET_CURRENT       141
#define GET_RX_PWR        142
#define GET_TX_PWR        143
#define GET_AD2           144
#define GET_AD3           145
#define GET_AD1           146
#define GET_CAL1_HI       147
#define GET_CAL1_LO       148
#define GET_CAL2_HI       149
#define GET_CAL2_LO       150
#define GET_TEMP1_HI      151
#define GET_TEMP1_LO      152
#define GET_TEMP2_HI      153
#define GET_TEMP2_LO      154

/* watchdog definition */
#define DOG_FEED_INI       ( *PBDIR(immr) |= 0x00000200 )
#define DOG_FEED_HIG       ( *PBDAT(immr) |= 0x00000200 )
#define DOG_FEED_LOW       ( *PBDAT(immr) &= ~0x00000200 )
#define DOG_FEED_NOP       for(i=0;i<10000;i++)

⌨️ 快捷键说明

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