/* * Shannon specific DSP and Serial Flash definitions. * This file is the old spi.h and sflash.h combined. */ //************* //* GPIO Pin ** //************* #define DISP_EN 0x00400000 #define BKLITE_EN 0x00200000 #define U3_CTS 0x00100000 #define U3_RTS 0x00080000 #define CODEC_RESET 0x00040000 #define DSP_RESET 0x00020000 #define CODEC_IRQ 0x00010000 #define SPI_CTS 0x00008000 #define SPI_RTSN_v 14 #define SPI_RTSN 0x00004000 #define SPI_CTRL 0x00003C00 #define SPI_DIN_v 11 #define SPI_DIN 0x00000800 #define SPI_DOUT 0x00000400 #define SPI_SCLK 0x00001000 #define LCD_LOWER 0x000003FC #define WHEATIES 0x00000002 #define EE_CS 0x00000001 //*************** //* SPI Defines * //*************** #define SCR_MG 17 /* 100kHz (102.4kHz) */ #define SCR_SFC 2 /* */ #define SCR_SF 2 /* */ #define SSE 0x00000001 /* SSI Enabled. */ #define ECS 0x00000000 /* Internal clock. */ #define FRF 0x00000000 /* Motorola SPI format. */ #define DSS8 0x00000007 /* 8 bit data size. */ #define DSS9 0x00000008 /* 9 bit data size. */ #define DSS16 0x0000000f /* 16 bit data size. */ #define SPICTRL0_MG (SCR_MG << SSCR0_V_SCR) | ( SSE << SSCR0_V_SSE) | (ECS << SSCR0_V_ECS) | (FRF << SSCR0_V_FRF) | DSS8 #define SPICTRL0 (SCR_SFC << SSCR0_V_SCR) | ( SSE << SSCR0_V_SSE) | (ECS << SSCR0_V_ECS) | (FRF << SSCR0_V_FRF) | DSS8 #define SPICTRL0_SF (SCR_SF << SSCR0_V_SCR) | ( SSE << SSCR0_V_SSE) | (ECS << SSCR0_V_ECS) | (FRF << SSCR0_V_FRF) | DSS8 #define SPICTRL0_9 (SCR_SFC << SSCR0_V_SCR) | ( SSE << SSCR0_V_SSE) | (ECS << SSCR0_V_ECS) | (FRF << SSCR0_V_FRF) | DSS9 #define SPICTRL0_16 (SCR_SF << SSCR0_V_SCR) | ( SSE << SSCR0_V_SSE) | (ECS << SSCR0_V_ECS) | (FRF << SSCR0_V_FRF) | DSS16 #define SPI_CS WHEATIES | EE_CS //*************** //* MCP Defines * //*************** #define MCPCTRL MCCR_M_ADM | MCCR_M_MCE | ( 40 << MCCR_V_TSD) | 15 //*************************************** // // DSP Messages and Useful Constants // //*************************************** //messages from dsp #define KEYPRESS 0x04 #define KEY_1 0x08 #define KEY_2 0x09 #define KEY_3 0x0a #define KEY_HOLD 0x0b #define KEY_MUTE 0x0c #define KEY_4 0x18 #define KEY_5 0x19 #define KEY_6 0x1a #define KEY_FLASH 0x1b #define KEY_VOL_UP 0x1c #define KEY_7 0x28 #define KEY_8 0x29 #define KEY_9 0x2a #define KEY_LINE1 0x2b #define KEY_VOL_DN 0x2c #define KEY_ASS 0x38 #define KEY_0 0x39 #define KEY_PND 0x3a #define KEY_LINE2 0x3b #define KEY_SPEAKER 0x3c #define KEY_ONHOOK 0x80 #define KEY_OFFHOOK 0x88 #define KEY_UP 0xF7 #define KEY_SPACE 0x01 #define KEY_PAUSE 0x02 #define KEY_WAIT 0x03 // // jrc - new answering system and speaker phone commands and responses // // Note - following is both command and response, depending on which side initiates xfer #define SPKPH_STATES_DATA 0x18 // 1 block of speakerphone state data (20 blocks total) #define SPKPH_PARAMS_DATA 0x19 // 1 block of speakerphone parameter data (5 blocks total) #define READ_STATES_DATA_CMD 0x1A // Prepare to upload speakerphone state data from DSP #define READ_PARAMS_DATA_CMD 0x1B // Prepare to upload speakerphone parameter data from DSP #define DSP_START_REC_CMD 0x13 // Start recording #define DSP_STOP_REC_CMD 0x11 // Stop recording #define DSP_PLAY_MSG_CMD 0x10 // Playback a message #define DSP_STOP_MSG_CMD 0x15 // Stop playback of a message #define DSP_LOAD_MSG_DATA_CMD 0x17 // Block of encoded speech to be loaded into DSP RCELP coder #define DSP_URSP_STORE_MSG_DATA 0x87 // Block of encoded speech to be stored in PCMCIA Flash memory #define DSP_URSP_RDY_4_NEXT_BLK 0x88 // DSP is ready to receive another block of speech encoded data to play #define DSP_URSP_DLY_RSP 0xB2 // Delayed response for "long" operation #define DSP_PARALLEL_SET_DETECT_CMD 0xA2 // Enable parallel set detection, line in use // Used for hold release, answering system disconnect #define RSP_PARALLEL_SET_DETECT_CMD 0x08 // parallel set detected #define DSP_GET_LINE_STAT_CMD 0xD1 #define RSP_LINE_STAT_INUSE_CMD 0xD8 #define RSP_LINE_STAT_NOT_INUSE_CMD 0xD9 // // Following command is used to access the answering system remotely // by entering a numeric access code. The other constants are used to // enable/disable detection on the appropriate line. // // NOTE - DSP will automatically disable DTMF detection by an // on-hook event. // // NOTE - DSP will respond to this command immediately with an ACK. // Thereafter, any digits entered in an attempted remote access // will come back in the form 0x02:code. This is considered // an asynchronous, secondary response (not a delayed response). // In theory, each remote key press should generate 2 responses - // first response to say DTMF has been detected for digit x, // and the second response to say that DTMF is not detected for // digit x. // // #define DSP_DTMF_DETECT_CMD 0x57 #define ENABLE_DTMF_LINE1 0x02 #define DISABLE_DTMF_LINE1 0x00 #define ENABLE_DTMF_LINE2 0x03 #define DISABLE_DTMF_LINE2 0x01 #define RSP_DTMF_DETECT_CMD 0x02 // Common commands to dsp #define DSP_CID_CMD 0x22 #define DSP_TONE_CMD 0x42 #define DSP_VOL_CMD 0x4C #define DSP_SETIME_CMD 0x50 #define DSP_GETIME_CMD 0x52 #define DSP_DIAL_CMD 0x58 #define DSP_AUDIO_CMD 0xA6 #define DSP_LINE_CTL 0xA7 #define DSP_LED_CMD 0xA3 #define DSP_BUSYON_CMD 0xAC #define DSP_BUSYOFF_CMD 0xAD #define DSP_SANITY_CMD 0xB7 //commands from dsp #define RSP_RING_CMD 0x10 #define RSP_CID_CMD 0x22 #define RSP_ACK_CMD 0x80 #define RSP_THEEND_CMD 0x81 #define RSP_VOXTMO_CMD 0x82 #define RSP_MEMFUL_CMD 0x83 #define RSP_BAD_CMD 0x84 #define RSP_BUSY_CMD 0x85 #define RSP_LIU_CMD 0xB0 #define RSP_POWER_CMD 0xB6 #define RSP_TIME_CMD 0xEA #define RSP_SANITY_CMD 0xDB /* ** Sanity Response is always 3 bytes: ** DB : status byte : NOT(status byte) */ // Callid 0x22 - to DSP #define GETCID1 0x09 #define GETCID2 0x0A // // NOTE - The available CID options are defined as follows (blank // locations are don't cares, and should be read/written as // zeroes). // // +-------+-------+-------+--------+-------+-------+---------+--------+ // | | | | CID | | | Stutter | FSK | // | | | | CW | | | Detect | Detect | // | | | | Enable | | | Enable | Enable | // +-------+-------+-------+--------+-------+-------+---------+--------+ // // 7 6 5 4 3 2 1 0 // #define ALL_CID_OPTS_ON 0x13 #define ALL_CID_OPTS_MINUS_CIDCW 0x03 #define SET_CID_OPTIONS 0x17 // Command to set DSP options #define GET_CID_OPTIONS 0x18 // Command to read DSP options #define START_STUTTER_DET 0x1A // Initiate 2.1 sec stutter dialtone detection period #define ABORT_STUTTER_DET 0x1B // Abort 2.1 second stutter dialtone detection period // Callid 0x22 - from DSP #define NEWCID 0x20 // New CID data received from CO #define RPT_LIST_OPTIONS 0x25 // Report of current CID settings #define CID1 0x27 // Data Block 1 - number/date/time #define CID2 0x28 // Data Block 2 - name #define FSK_MSG_ON 0x2D // Visual Message Waiting Indicator is on #define FSK_MSG_OFF 0x2E // Visual Message Waiting Indicator is off #define STUTTER_MSG_ON 0x34 // Stutter dial tone detected, CO message exists #define STUTTER_MSG_OFF 0x35 // Normal dial tone detected, no CO message exists #define STUTTER_ERROR 0x36 // Neither normal or stutter dial tone has been detected in 2.1 sec period // Tone generator 0x42 index number #define RING_ALERT 0x01 #define LONG_BEEP 0x02 #define PAGE_TONE 0x03 #define HAPPY_TONE 0x04 #define SAD_TONE 0x05 #define PRIORITY_RING 0x06 #define PRIORITY_CALL 0x07 #define DOUBLE_BEEP 0x08 #define SHORT_BEEP 0x09 #define MEDIUM_BEEP 0x0A // Tone generator 0x42 audio path destinations #define DEST_SP 0x01 #define DEST_L1 0x02 #define DEST_L2 0x04 #define DEST_WH 0x08 #define DEST_CH 0x10 //volume 0x4c #define VOL_HS 0x00 #define VOL_SP 0x10 #define VOL_AM 0x20 #define VOL_RG 0x30 //dtmf dialing 0x58 #define SPACE 0x00 #define DTMF_1 0x01 #define DTMF_2 0x02 #define DTMF_3 0x03 #define DTMF_4 0x04 #define DTMF_5 0x05 #define DTMF_6 0x06 #define DTMF_7 0x07 #define DTMF_8 0x08 #define DTMF_9 0x09 #define DTMF_0 0x0a #define DTMF_S 0x0b #define DTMF_P 0x0c #define DTMF_F 0x0d #define DTMF_U 0x0e #define DTMF_W 0x0f #define DTMF_CONTU 0x40 #define DTMF_BURST 0x00 #define PULSE_DIAL 0x80 //audio path manager 0xa6 audio mode settings #define IDLE 0x01 #define HANDSET 0x02 #define MUTE_SPEAKERPHONE 0x04 #define SPEAKERPHONE 0x0d #define MUTE_HANDSET 0x16 //led commands 0xa3 #define FLASHRATE100 0x00 #define FLASHRATE200 0x01 #define FLASHRATE300 0x02 #define FLASHRATE400 0x03 #define FLASHRATE500 0x04 #define BLINKRATE100 0x00 #define BLINKRATE200 0x01 #define BLINKRATE300 0x02 #define BLINKRATE400 0x03 #define BLINKRATE500 0x04 #define LED_OFF 0x00 #define LED_BLINK 0x01 #define LED_FLASH 0x02 #define LED_ON 0x03 //line control 0xa7 #define ONHOOK 0x00 #define OFFHOOK_S 0x06 #define OFFHOOK_H 0x02 //busy detect 0xac #define BUSY_ON 0x01 #define BUSY_OFF 0x02 #define BUSY_REPORT 0x03 // Power Fail Messages (from DSP to MCU) // // NOTE - these are single byte messages, but are always sent twice // by the DSP as a safety net to guarantee that it is not // missed by the MCU #define PWRDN_MSG 0x53 #define PWRUP_NO_CALL_MSG 0x54 #define PWRUP_WITH_CALL_MSG 0x55 // // NOTE - Following commands and responses not really needed, // either done automatically by DSP, or just not used. // They are included here for completeness, and possible // future development. // #define DSP_VOX_START_CMD 0xA1 #define DSP_AUDIO_GAIN_CMD 0xA8 #define DSP_KEYBOARD_SCAN_CMD 0xA5 #define DSP_BATT_STATUS_CMD 0x4A #define RSP_BATT_STATUS_CMD 0xDA #define DSP_AC_POWER_THRESH_CMD 0xD2 // // Software Reset of DSP - always 2 byte message as shown below. // NOTE - Since StrongARM can force DSP reset at IO pins, this command // is not really necessary. // #define RESET_DSP1_CMD 0xB9 #define RESET_DSP2_CMD 0xBB //******************************************************************** // // Messages sent between DSP kernel processes, and Limbo Applications // //******************************************************************** // Messages from the kernel, sent to application #define K2A_BATT_AOK_MSG 'A' #define K2A_BATT_LOW_MSG 'B' #define K2A_BUSY_MSG 'b' #define K2A_CONNECT_MSG 'c' #define K2A_DIGIT_DIALED_MSG 'D' #define K2A_MODEM_OVERRIDE_REQ_MSG 'E' #define K2A_FAR_END_HANGUP_MSG 'h' #define K2A_HSET_VOLUME_MSG 'H' #define K2A_INCOMING_CID_MSG 'i' #define K2A_CO_MSG_WAITING_MSG 'I' // Used to retain message mode and status of LED after a // power failure. It has the following format and meanings: // I0 = FSK ON ( Set FSK mode, MSG LED is ON ) // I1 = FSK OFF ( Set FSK mode, MSG LED is OFF ) // I2 = Stutter ON ( Set Stutter mode, MSG LED is ON ) // I3 = Stutter OFF ( Set Stutter mode, MSG LED is OFF ) #define FSK_MODE_LED_ON 0 #define FSK_MODE_LED_OFF 1 #define STUTTER_MODE_LED_ON 2 #define STUTTER_MODE_LED_OFF 3 #define K2A_KEYPAD_PRESS_MSG 'K' #define K2A_MODEM_IN_USE_MSG 'M' #define K2A_MODEM_NOT_IN_USE_MSG 'm' #define K2A_LINE_NOT_IN_USE_MSG 'n' #define K2A_RINGER_OFF_MSG 'O' #define K2A_HSET_IN_USE_MSG 'o' #define K2A_HSET_NOT_IN_USE_MSG 'p' #define K2A_RINGING_MSG 'r' #define K2A_RINGER_VOLUME_MSG 'R' #define K2A_SPKR_IN_USE_MSG 's' #define K2A_SPKR_VOLUME_MSG 'S' #define K2A_SPKR_NOT_IN_USE_MSG 't' #define K2A_LINE_IN_USE_MSG 'u' // Messages from application, sent to kernel #define A2K_ENABLE_BUSY_DETECT_MSG 'A' #define A2K_DIAL_MSG 'd' #define A2K_DO_MODEM_OVERRIDE_MSG 'e' #define A2K_HANGUP_MSG 'h' #define A2K_SET_MSG_MODE_MSG 'i' // Used to retain message mode and status of LED after a // power failure. It has the following format and meanings: // i0 = FSK ON ( Set FSK mode, MSG LED is ON ) // i1 = FSK OFF ( Set FSK mode, MSG LED is OFF ) // i2 = Stutter ON ( Set Stutter mode, MSG LED is ON ) // i3 = Stutter OFF ( Set Stutter mode, MSG LED is OFF ) #define A2K_CHECK_LINE_MSG 'k' #define A2K_NEW_CALL_MSG 'x' #define A2K_NEW_NOTE_MSG 'y' #define A2K_MUTE_MSG 'M' #define A2K_PRIORITY_RING_MSG 'R' /* * Shannon Serial Flash definitions (was /os/shannon/sflash.h) */ #ifdef SMALL enum { SFLASH_SECTOR_SIZE = 264, SFLASH_DATA_SIZE = 256, SFLASH_NUM_SECTORS = 128, SFLASH_FREE_SECTORS = (SFLASH_NUM_SECTORS/8)+1, SFLASH_DATA_SECTORS = SFLASH_NUM_SECTORS-SFLASH_FREE_SECTORS, MAX_WRITE_CYCLES = SFLASH_NUM_SECTORS*65, }; #else enum { SFLASH_SECTOR_SIZE = 264, SFLASH_DATA_SIZE = 256, SFLASH_NUM_SECTORS = 2048, SFLASH_FREE_SECTORS = (SFLASH_NUM_SECTORS/16)+1, SFLASH_DATA_SECTORS = SFLASH_NUM_SECTORS-SFLASH_FREE_SECTORS, }; #endif typedef struct { #ifdef sun union { uchar s0_bdata[SFLASH_DATA_SIZE]; ulong s0_ldata[SFLASH_DATA_SIZE / sizeof (ulong)]; }s0; #define ldata s0.s0_ldata #define bdata s0.s0_bdata #else union { uchar bdata[SFLASH_DATA_SIZE]; ulong ldata[SFLASH_DATA_SIZE / sizeof (ulong)]; }; #endif ulong addr; ushort vers; uchar hc; uchar dc; } sflashSector; #define HDR_SZ (SFLASH_SECTOR_SIZE-SFLASH_DATA_SIZE) #define HDR_OFF SFLASH_DATA_SIZE enum { Qdirsflash, Qctl, Qerrlog, Qdebug, Qstore, Qstorelog, Qstat, Qlog2phys, Qlogvers, Qphyswcnt, Qpbusy, }; //*********************************************** // // FLASH MEMORY commands and other stuff // //*********************************************** //flash memory #define BUFFER1_READ 0x54 #define BUFFER2_READ 0x56 #define BUFFER1_WRITE 0x84 #define BUFFER2_WRITE 0x87 #define MAIN_MEMORY_PAGE_READ 0x52 #define MAIN_PAGE_TO_BUFFER1 0x53 #define MAIN_PAGE_TO_BUFFER2 0x55 #define BUFFER1_AUTO_REWRITE 0x58 #define BUFFER2_AUTO_REWRITE 0x59 #define COMPARE_BUFFER1 0x60 #define COMPARE_BUFFER2 0x61 #define MAIN_PROGRAM_ERASE 0x82 #define BUFFER1_PROGRAM_ERASE 0x83 #define BUFFER2_PROGRAM_ERASE 0x86 #define BUFFER1_PROGRAM_NOERASE 0x88 #define BUFFER2_PROGRAM_NOERASE 0x89 int sspSF( uchar cmd, int pga, int bya, void *data, int cnt ); void writeSFblk(int, sflashSector *); void readSFblk(int, sflashSector *); int readSFstat(int pat, void *data, long n, ulong offset); void writeSFctl(char **, int);