📄 sp6608.h
字号:
//===================================================================// 单 位:浙江金大科技// 作 者:HDL// 版 本:0.00.01 [主版本号.次版本号.修订版本号]// 创建日期:2006-02-10// 修改日期:2006-02-10// 说 明:系统寄存器定义// 修改记录://===================================================================#ifndef __SP6608_H__#define __SP6608_H__ //--------------------------Register address definitions------------------------------*/// Port A, B, C, D *///------------------------------------------------------------------------------------*/#define P_IOA_Data 0x7000 //R/W, portA data // IOA0~IOA7 can be set as input or output pin by pin. // Input mode - IOA0~IOA7 provide pull-high resistosrs // IOA6 & IOA7 provide pull-low resistors // Output mode - CMOS output // Wake-up - IOA0~IOA7 all provide wake-up function // IOA0~4 - (I) Keyboad inputs (pull-high) // IOA5 - (O) Option (low active) // IOA6 - (I) Pulse/Tone Select (pull-high <-> pull-low) // 10pps / 20pps / Tone low/floating/high // IOA7 - (I) Lock Select (pull-high <-> pull-low) // disable / lock all / lock 0 low/floating/high #define P_IOA_Buf 0x7001 //R, port A output latch#define P_IOA_Dir 0x7002 //R/W, portA direction, 0/1 I/O#define P_IOA_PullR 0x7003 //R/W, portA pull-highs & pull-lows // b15~b8 1 to enable pull-high of IOA7~IOA0 // b7~b6 1 to enable pull-low of IOA7~IOA6#define P_IOA_Latch 0x7004 //R, latch IO for wakeup//------------------------------------------------------------------------------------------#define P_IOB_Data 0x7005 //R/W, portB data // IOB0~IOB7 can be set as input or output pin by pin. // Input mode - CMOS input (without pulled reisitors) // Output mode - IOB0~IOB5 are CMOS outputs // IOB6 & IOB7 are NMOS open-drain // Wake-up - no wake-up function // IOB0~4 - (O) keyboard driven lines (CMOS output) (low active) // IOB5 - (O) HandFree Output (CMOS output) (high active) // IOB6 - (O) /Xmute (NMOS open-drain) (low active) // IOB7 - (O) DP (NMOS open-drain) (high active) #define P_IOB_Buf 0x7006 //R, portB output latch#define P_IOB_Dir 0x7007 //R/W, portB direction, 0/1 I/O//------------------------------------------------------------------------------------------#define P_IOC_Data 0x7008 //R/W, portC data // IOC0~IOC7 can be set as input or output pin by pin. // Input mode - CMOS input (without pulled reisitors) // Output mode - IOC0~IOC5 are CMOS outputs // IOC6 & IOC7 are NMOS open-drain // Wake-up - IOC0 & IOC1 provide wake-up function // IOC0 - (I) Ringer Detect (wake-up) // IOC1 - (I) Hook Detect (wake-up) // IOC2 - (O) Option (low active) // IOC6 - (I) Steal Detect, Auto-Hold release // IOC4 - (O) Ringer Contrl // IOC6 - (O) nMOS open-dran, output '0' if NC // IOC7 - (O) nMOS open-dran, output '0' if NC #define P_IOC_Buf 0x7009 //R, portC output latch#define P_IOC_Dir 0x700A //R/W, portC direction//------------------------------------------------------------------------------------------#define P_IOD_Data 0x700B //R/W, portD data // IOD0~1 can be set as input or output pin by pin. // Input mode - CMOS input (without pulled reisitors) // Output mode - IOD0~IOD1 are CMOS outputs // Wake-up - no wake-up function // IOD0~1 - (x)#define P_IOD_Buf 0x700C //R, portD output latch#define P_IOD_Dir 0x700D //R/W, portD direction, 0/1 I/O#define P_IOCD_Ctrl 0x700E // XXXX XXXX 7654 3210 // C0EG 00 - C0 provide interrupt/wake-up at falling edge // 01 - C0 provide interrupt/wake-up at rising edge // 1x - C0 provide interrupt/wake-up at both edges // C1EG 00 - C1 provide interrupt/wake-up at falling edge // 01 - C1 provide interrupt/wake-up at rising edge // 1x - C1 provide interrupt/wake-up at both edgex // 0 - tone output (IOD1) comes from timer A overflow // 1 - tone output (IOD1) comes from timer B overflow // 0 - IOD1 is normal I/O // 1 - IOD1 is tone-output//------------------------------------------------------------------------------------------#define P_IOE_Data 0x7050 #define P_IOE_Buf 0x7051 #define P_IOE_Dir 0x7052 #define P_IOE_PullR 0x7053#define P_IOE_Latch 0x7054//------------------------------------------------------------------------------------------//----------------------------------------------------------------------------------------*/// Interrupt & Wake-Up *///----------------------------------------------------------------------------------------*/#define P_Int 0x7010 // write 0/1 - disable/enable interrupt // read 0/1 - interrupt is disabled/enabled#define P_IntClr 0x7011 // write 1 - clear happened interrupt flag // read 1 - interrupt is happened#define P_WakeUp 0x7012 // write 0/1 - disable/enable wake-up // read 0/1 - wake-up is disabled/enabled#define P_WakeUpClr 0x7013 // write 1 - clear happened wake-up flag // read 1 - wake-up is happened // IOC1 - Hook // IOC0 - Polarity Change sahred // XXXX X098 7654 3210 // Ring Detect // IOA key-change // TimerA overflow // TimerB overflow // 32KHz (4KHz,8KHz,16KHz,32KHz) // 2KHz (256Hz,512Hz,1KHz,2KHz) P_TimeBaseSet // 128Hz (16Hz,32Hz,64Hz,128Hz) // 8Hz (1Hz,2Hz,4Hz,8Hz) #define P_IoaWakeUp 0x7014 // R/W, b7~b01 to enable IOA7~0 wake-up //================================================================================= #define B_Irq0 0x0001 // vector FFF8#define B_RiInt 0x0001#define B_Irq1 0x0002 // vector FFF9#define B_IoaInt 0x0002#define B_Irq2 0x0004 // vector FFFA#define B_TmrAInt 0x0004#define B_Irq3 0x0008 // vector FFFB#define B_TmrBInt 0x0008#define B_Irq4 0x0010 // vector FFFC#define B_T32KHzInt 0x0010#define B_8KHzInt 0x0010#define B_Irq5 0x0020 // vector FFFD#define B_T2KHzInt 0x0020#define B_1KHzInt 0x0020#define B_512HzInt 0x0020#define B_Irq6 0x0040 // vector FFFE#define B_T128HzInt 0x0040#define B_Irq7 0x0080#define B_T8HzInt 0x0080#define B_2HzInt 0x0080#define B_Ioc0Int 0x0100#define B_Ioc1Int 0x0200#define B_LineInt 0x0400#define B_UartInt 0x0800//================================================================================= //----------------------------------------------------------------------------------*/// System Clock *///----------------------------------------------------------------------------------*/#define P_SystemClock 0x7015 // XXXX XXXX 7XXX X210 // CPU Operating Clock Select // 000 - Fosc // Mode 001 - Fosc/2 // 0 - Fosc 1M 010 - Fosc/4 // 1 - Fosc10M 011 - Fosc/8 (default) // 100 - Fosc/8 // 101 - Fosc/8 // 110 - Fosc/8 // 111 - Stop/Sleep //================================================================================= #define Clk10M 0x0080 // 28M#define ClkNorm 0x0080 // 28M#define ClkDiv0 0x0080 // 28M#define ClkDiv1 0x0000 // 28M的 1/10 #define ClkDiv2 0x0001 // 28M的 1/20 #define ClkDiv4 0x0002 // 28M的 1/40 #define ClkDiv5 0x0006 // 28M的 1/50 #define ClkDiv6 0x0005 // 28M的 1/60 #define ClkSleep 0x0007 // 睡眠#define ClkHDiv2 0x0081 // 14M //================================================================================= #define P_Watchdog_Clr 0x7016 // period 2sec // write 16-bit value to reset watch dog//----------------------------------------------------------------------------------*/// Time Base *///----------------------------------------------------------------------------------*/#define P_TimeBaseSet 0x7018 // enable 32768 // weak/strong mode // 54XX XXXX 7654 3210 // 1000 0000 0101 1101 <- at off-line sleep // T32KHzS T8HzS // 00 - 4KHz 吵 吵 00 - 1Hz // 01 - 8KHz 吵 吵 01 - 2Hz // 10 - 16KHz 吵 吵 10 - 4Hz // 11 - 32KHz 吵 吵 11 - 8Hz // T2KHz T128HzS // 00 - 256Hz 00 - 16Hz // 01 - 512Hz 01 - 32Hz // 10 - 1KHz 10 - 64Hz // 11 - 2KHz 11 - 128Hz // Time Base, generated by 32768Hz, is a combination of frequency selection // for timers and interrupt. //================================================================================= #define B_Enable32768 0x8000#define B_Strong32768 0x4000 // After powering on, set 32768 at strong mode // for 2 sec. Afterwards, change to weak mode#define B_1Hz 0x0000#define B_2Hz 0x0001#define B_4Hz 0x0002#define B_8Hz 0x0003#define B_16Hz 0x0000#define B_32Hz 0x0004#define B_64Hz 0x0008#define B_128Hz 0x000C#define B_256Hz 0x0000#define B_512Hz 0x0010#define B_1KHz 0x0020#define B_2KHz 0x0030#define B_4KHz 0x0000#define B_8KHz 0x0040#define B_16KHz 0x0080#define B_32KHz 0x00C0//================================================================================= //----------------------------------------------------------------------------------*/// Timer A & B *///----------------------------------------------------------------------------------*/// Writing a value of N to P_TimerA_Data or P_TimerB_Data and selecting an// appropriate clock sources, the timer will count up from N, N+1, N+2, ....
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -