Shannon DSP specification

COMMAND / RESPONSE

COMMAND: DSP_CID_CMD 0x22 (2 to 3 bytes)

Descprition: Control the caller ID


Commands (byte 1):

START_STUTTER_DET

0x1A

Start detection of a stutter dialtone

SET_CID_OPTIONS

0x17

Command to set DSP ptions for CID

GET_CID_OPTIONS

0x18

Get the current CID options

GETCID1

0x09

Get number/date/time

GETCID2

0x0A

Get name


Options (byte 2):

bit 4

CID CW Enable

??

bit 1

Stter detect enable

Enable the stutter dialtone detection

bit 0

FSK detect enable

??


RESPONSE: RSP_CID_CMD 0x22

Descrpiption: Respond to the caller ID request


Status (byte 1):

NEWCID

0x20

CID information is available

CID1

0x27

Number/date/time (starting in byte 2)

CID2

0x28

Name (starting in byte 2)

FSK_MSG_ON

0x2D

Message waiting indicdator is on

FSK_MSG_OFF

0x2E

Message waiting indiator is off

STUTTER_MSG_ON

0x34

Stutter dial tone detected - CO message exists

STUTTER_MSG_OFF

0x35

Stutter dial tone tected - No CO message exists

STUTTER_ERROR

0x36

Neither normal or stutter dial tone detected


Data (Byte 2)


CID1: (up to 16 hex digits)

byte[0]

Flags

bit 7 - DDN detected (1 = yes)

bit 6 - Call Qualifier detected (1 = next byte is call qualifier)

byte[1]

Call Qaulifer

0xFF - No qualifier

0x4C (L) (long distance call)

Byte[1]

Special condition byte

if least signficant byte is set, a parallel set was offhook, and no CID took place

Byte[3]

Always 0x00


Byte[4-5]

Date (packed BCD)


Byte[6-7]

time (packed BCD)


Byte[8-15]

number (packed BCD)

If byte 1 of the extraced number is 0X0A then it is a private number


If byte 2 of the extracted number is 0x0B then it is out of area


CID2: (up to 16 hex digits)

Byte[0]

always ignored


Byte[1-15]

name

if name[0] is <CNTL> P (0x10) then it is private

if name[0] is <CNTL> O (0x0F) then it is out of area


Terminator is <CNTL> D (0x04)



COMMAND: DSP_TONE_CMD 0x42 (3 bytes)

Description: Set the tone played to the specified destination


Byte 1 - Destination

DEST_SP

0x01

(speaker)

DEST_L1

0x02

(line 1)

DEST_L2

0x04

(line 2)

DEST_WH

0x08

(??)

DEST_CH

0x10

(??)


Byte 2 - Tone

RING ALERT

0x01

LONG BEEP

0x02

PAGE TONE

0x03

HAPPY TONE

0x04

SAD TONE

0x05

PRIORITY RING

0x06

PRIORITY CALL

0x07

DOUBLE BEEP

0x08

SHORT_BEEP

0x09

MEDIUM_BEEP

0x0A


COMMAND: DSP_VOL_CMD 0x4C (2 bytes)

Description: Set the volume on the particular device


Byte 1 - Destination | volume


Destination

VOL_HS

0x00

(handset)

VOL_SP

0x10

(speaker)

VOL_AM

0x20


VOL_RG

0x30

(ring)


Volume:

handset

[0,3]

speaker

[0,7]

ringer

[0,7]


COMMAND: DSP_SETTIME_CMD 0X50 (9 bytes)

Description: Set the time on the DSP


Byte 1 - 4

byte 0 - 4 of current time (in seconds)

Byte 5 - 9

0x0


COMMAND: DSP_GETTIME_CMD 0x52 (1 byte)

Description: Tell the DSP to get the current time (in seconds)


COMMAND: DSP_DIAL_CMD: 0x58 (2 bytes)

Description: Send a DTMF code to the DSP


Bugs - When dialing a string of digits and a key is pressed, the DSP gets a

"dial - no tone" command. The DSP stops all dialing, even if other digits are queued

We need to stay in DTMF_BURST mode until the whole string has been pumped out


byte 1: mode | digit


Modes:

DTMF_CONTU

0x40

(keep sending continuious press)

DTMF_BURST

0x00

(Normal)

PULSE_DIAL

0x80

(For pulse)


Digit:


SPACE

0x00

DTMF_1

0x01

DTMF_2

0x02

DTMF_3

0x03

DTMF_4

0x04

DTMF_5

0x05

DTMF_6

0x06

DTMF_7

0x07

DTMF_8

0x08

DTMF_9

0x09

DTMF_0

0x0A

DTMF_S

0x0B

DTMF_P

0x0C

DTMF_F

0x0D

DTMF_U

0x0E

DTMF_W

0x0F


COMMAND: DSP_AUDIO_CMD 0xA6 (2 bytes)

Description: Set the audio path


Byte 1 - Path


IDLE

0x01

HANDSET

0x02

MUTE_SPEAKERPHONE

0x04

SPEAKERPHONE

0x0d

MUTE_HANDSET

0x16


COMMAND: DSP_LINE_CTRL 0xA7 (2 bytes)

Description: Control the line


Byte 1 - mode

ONHOOK

0x00

(put it on hook)

OFFHOOK_S

0x06

(go off hook on speaker phone)

OFFHOOK_H

0x02

(goo off hook on handset)



COMMAND: DSP_LED_CMD 0xA3 (7 bytes)

Description: Control the specified LEDs


Byte 1 - Flash / Blink Rate (flash << 4 | blink):


Flash


FLASHRATE100

0x00

FLASHRATE200

0x01

FLASHRATE300

0x02

FLASHRATE400

0x03

FLASHRATE500

0x04


Blink

BLINKRATE100

0x00

BLINKRATE200

0x01

BLINKRATE300

0x02

BLINKRATE400

0x03

BLINKRATE500

0x04


Note: Each LED has a 2 bit state assignment:


Byte 2

C B A 9

(None, none, none, none)

Byte 3

8 7 6 5

(notused, not used, not used, new call)

Byte 4

4 3 2 1

(Speaker, mute, not used, relay)

byte 5

LINE1

(Line 1)

Byte 6

PARALLEL

(Parallel phone)


State:


LED_OFF

0x00

LED_BLINK

0x01

LED_FLASH

0x02

LED_ON

0x03


COMMAND: DSP_BUSYON_CMD: 0xAC (1 byte)

Description: Turn busy signal on


COMMAND: DSP_BUSYOFF_CMD: 0xAD (1 byte)

Description: Turn busy signal off


COMMAND: DSP_SANITY_CMD: 0xB7 (1 byte)

Description: Order a sanity check from DSP






RESPONSE: RSP_SANITY_CMD: 0xDB (3 bytes)

Description: Get the sanity response from the DSP


Byte 1

If 0x03, then reset DSP


COMMAND: DSP_PARALLEL_SET_DETECT_CMD 0xA2 (2 bytes)

Description: See if another phone on the line was picked up


RESPONSE: RSP_PARALLEL_SET_DETECT_CMD 0x08

Description: Send when another phone on the line was picked up


COMMAND: DSP_BATT_STATUS_CMD 0x4A (1 byte)

Description: Get the current status of the secondary serial flash battery


RESPONSE: RSP_BATT_STATUS_CMD 0xDA (2 bytes)

Description: Return the current status of the backup battery


Byte 1

voltage bits

6 - 0

battery voltage (apparently 48 is threshold between bad and good??)


DSP Messages

These are messages sent from the DSP to the kernel


MESSAGE: KEYPRESS 0x04 (2 bytes)

Description: Get a key press from the keypad


Byte 1 - key code

KEY_1

0x08

KEY_2

0x09

KEY_3

0x0a

KEY_HOLD

0x0b

KEY_MUTE

0x0c

KEY_4

0x18

KEY_5

0x19

KEY_6

0x1a

KEY_FLASH

0x1b

KEY_VOL_UP

0x1c

KEY_7

0x28

KEY_8

0x29

KEY_9

0x2a

KEY_LINE1

0x2b

KEY_VOL_DN

0x2c

KEY_ASS

0x38

KEY_0

0x39

KEY_PND

0x3a

KEY_LINE2

0x3b

KEY_SPEAKER

0x3c

KEY_ONHOOK

0x80

KEY_OFFHOOK

0x88

KEY_UP

0xF7

KEY_SPACE

0x01

KEY_PAUSE

0x02

KEY_WAIT

0x03


MESSAGE: RSP_RING_CMD 0x10 (1 byte)

Description: Sent when a ring occurs. These are sent every 128ms during a ring


Byte 1 - status


Bit 0

line bit

(0 = line 1, 1 = line 2)

bit 1

ring alerter

(0 = off, 1 = on)

bit 2-7

ring count



Special: Sends 0x00 after 10 seconds of no ringing


MESSAGE: RSP_ACK_CMD 0x80 (variable)

Description: Ack a DSP command. The actual response follows starting in byte 1


MESSAGE: RSP_BAD_CMD 0x84

Description: A bad command was sent. A new response follows?


MESSAGE: RSP_BUSY_CMD 0x85 (2 bytes)

Description: DSP reports that the line is busy

Byte 1: ??


MESSAGE: RSP_LIU_CMD 0xB0 (2 bytes)

Description: Line in Use flag - Indicates the line status


Byte 1 - Status


bit 2

Line is dead

bit 1

Line is in use (when we go off hook)

Other

Line is not in use


MESSAGE: RSP_POWER_CMD 0xB6

Description: Recieved when the DSP powers up?


Byte 1 - Status


Bit 1

if set, the DSP clock is bad


MESSAGE: RSP_TIME_CMD: 0xEA

Description: Update the DSP time based on the recieved time from a caller id message.


Byte 1 - 4

the time in seconds (byte 0 - 3)



Power Failure Messages

These are single byte messages from the DSP to the kernel regarding power failure


MESSAGE: PWRDN_MSG 0x53


MESSAGE: PWRUP_NO_CALL_MSG 0x54


MESSAGE: PWRUP_WITH_CALL_MSG 0x55


Misc Command/Response

These are generally unused or buggy commands/responses. They can be either commands or responses, depending on who started the transfer


Speakerphone data:


Each Set of DATA is 500 bytes:


Buffer format: 100 bytes of PARAMS_DATA (sent in 5 blocks)

400 bytes of STATES_DATA (sent in 20 blocks)


COMMAND: READ_STATE_DATA_CMD 0x1A

Description: Get speakerphone state data


RESPONSE: SPKPH_STATES_DATA: 0x18 (22 bytes)

Description: Get 1 block of speakerphone state data (20 blocks total)


Byte 1

the block to get (0 - 19)

Byte 2-21

the data


COMMAND: READ_PARAMS_DATA_CMD 0x1B

Description: Ask the DSP for speakerphone PARAMS data


RESPONSE: SPKPH_PARAMS_DATA 0x19 (22 bytes)

Description: Get 1 block of speakerphone param data (5 blocks total)


Byte 1

the block to get (0 - 4)

Byte 2-21

the data (20 bytes)


COMMAND: DSP_DTMF_DETECT_CMD 0x57 (2 bytes)

This is used to access the machine remotely. The DSP will respond

immediately to this command with an ACK, and then all other keypads

will come back as RSP_DTMF_DECT_CMD:code


Byte 1: Line

ENABLE_DTMF_LINE1

0x02

DISABLE_DTMF_LINE1

0x00

ENABLE_DTMF_LINE2

0x03

DISABLE_DTMF_LINE2

0x01



RESPONSE RSP_DTMF_DETECT_CMD 0x57 (3 bytes)

Description: Returns the a remote keystroke


Byte 1

The associated keystroke (see KEYSTROKE)


Unused or Unknown Commands

COMMAND: DSP_START_REC_CMD 0x13

Description: Not used


COMMAND: DSP_STOP_REC_CMD 0x11

Description: Not used


COMMAND: DSP_PLAY_MSG_CMD 0x10

Description: Not used


COMMAND: DSP_STOP_MSG_CMD 0x15

Description: Not used


COMMAND: DSP_LOAD_MSG_DATA_CMD 0x17

Description: Block of encoded speech to ble laoded into DSP RCELP coder


COMMAND: DSP_USRP_STORE_MSG_DATA 0x87

Description: Block of encoded speech to be stored into PCMCIA flash memory


COMMAND: DSP_USRP_RDY_4_NEXT_BLK 0x88

Description: DSP is ready to recieve another block of speech encoded data to play


COMMAND: DSP_USRP_DLY_RSP 0xB2

Description: Delayed response for long operation


COMMAND: DSP_GET_LINE_STAT_CMD 0xD1

Description: Not used


RESPONSE:RSP_LINE_STAT_INUSE_CMD 0xD8

Description: Not used


RESPONSE:RSP_LINE_STAT_NOT_INUSE_CMD 0xD9

Description: Not used


COMMAND: DSP_VOX_START_CMD 0xA1

Description: Not used


COMMAND: DSP_AUDIO_GAIN_CMD 0xA8

Description: Not used


COMMAND:DSP_KEYBOARD_SCAN_CMD 0xA5

Description: Not used


COMMAND:DSP_AC_POWER_THRESH_CMD 0xD2

Description: Not used


MESSAGE: RSP_THEEND_CMD 0x81

Description: Not used


MESSAGE: RSP_VOXTMO_CMD 0x82

Description: Not used


MeSSAGE: RSP_MEMFUL_CMD 0x83

Description: Not used


Using the SPI to talk to the DSP

All of the DSP communications happen through the SPI interface. The SPI is connected to a series of GPIO pins that are connected to the DSP. Here is how the DSP specific GPIO pins are listed:

GPIO Pin Device Direction Comments
00 Serial Flash Output Driven low, enables the serial connection to the serial flash
01 DSP Output Driven low, enables the serial connection to the DSP
10 SPI_DOUT Output Output pin to SPI
11 SPI_INPUT Input Input pin from SPI
12 SPI_SCLK Output Pin connected to the SPI clock
13 SPI_SFRM Output Not used for DSP communications, but part of the SPI signals
14 SPI_RTSN Input SPI Ready to Send (RSTN)
15 SPI_CTS Output SPI clear to send (CTS)
17 DSP Reset Output Drive low to reset the DSP
Note: Pins 10, 11, 12 and 13 are considered to be the SPI signals (SPI_CTRL) and are often bunched together

Interrupts

There should be an falling edge interrupt handler registered on GPIO pin 14 (RSTN). This should allow the kernel to read the DSP on an interrupt driven basis. Interrupt 19 is also registered for the SPI, but this appears to be only used for the serial flash.

Initalizing the SPI

  • Set the correct I/O direction for each pin on GPIO Direction (GPDR) (see above for assignments)
  • Set bits 10, 11, 12, and 13 on GPIO Clear (GPCR) - This lowers all the GPIO pins
  • Set Pin 0 and 1 on GPIO Set (GPSR) This raises the Serial Flash and DSP controls
  • Set Pin 15 on GPCR - This lowers the CTS pin
  • clear bits 10, 11, 12, and 13 from the GPIO Alternate functions register (GAFR)
  • Set Pin 18 (SPR) on the PPC Pin Assignment Register PPAR (so that we uses the GPIO for the SPI and not serial port 4)
  • Set the ADM (bit 18), and MCE (bit 16) in The MCP Control Register (MCCR0). Note: MCE must be set at all times. Previous UCB1200 communications only turned it on when writing. Also, set pins 14..8 (Telecom sample rate divider) to 40, and set bit 15 (no name, no description) put 40 into the TSD (telecom sample divider) and set bit 15 (no name).

    Reseting the DSP

  • Drive DSP_RESET and SPI_CTS low (set bits 17 and bit 15 low in GPCR)
  • Hold for 500 microseconds.
  • Raise DSP_RESET (Set bit 17 in GPSR)
  • Wait 500 us for it to wake up

    READ BYTE

  • set bit 0 for serial flash, or bit 1 for DSP in GSCR (lower the pin for the desired device).
  • For each bit in the value from N to 0:
    If the Nth bit is set in the outgoing value, then set SPI_DOUT (set bit 10 in GRSR), otherwise set it low (bit 10 in GRCR).
    Set bit 10 (SPI_SCLK) in GRSR (drive it high), wait for SCLK clock period (typically 5 usecs, but it can be variable.. see page 323 of the SA100 spec)
    If bit 11 (SPI_DIN) is set in GRSR, then Nth bit in the response value should be set as well.
    set bit 10 in GRCR (clear SPI_SCLK), wait for another SCLK clock period.
  • set bit 0 for serial flash, or bit 1 for DSP in GRSR (raise the pin for the desired device) to finish.

    READ MESSAGE

    A message is available if RTSN is low (bit 14 is set in GSCR). This should be tied to a falling edge interrupt.
  • Set bit 15 in GRSR (Raise CTS)
  • Wait for RTSN to go high (bit 14 set in GRSR)
  • Read the byte from the SPI (see above)
  • Delay 200 us
  • set bit 15 in GRCR (Drop CTS)
    If the next word of the message does not arrive in 500usec, then the message is done