|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
Listing 1-We used a dead-or-alive function test to check communications between the XR-88C681 UART and the ADSP-21061 DSP.
#define SYSCON21K ((unsigned int *) 0x00) // 21K processor definitions
#define BANKS8K 0xFFFF0FFF // Set External Banks to 8K size
#define WAIT21K ((unsigned int *) 0x02) // Wait state register
#define BANK3MASK 0xFFF07FFF // Need 6 internally generated wait states for bank 3
#define WAIT6BANK3 0x000B8000
#define DUARTBASE 0x00406000 // DUART definitions
#define IVR ((volatile char *) 0x0C+DUARTBASE) // Memory mapped System Configuration Register
// IVR register has 0x0C offset in the DUART
/************************************
Function: char DuartAlive(void)
Descriptions:
Returns ALIVE if the DSP can talk to DUART.
Returns DEAD if no communication
*************************************/
#define ALIVE 1
#define DEAD 0
#define TESTVALUE 0xA5
char DuartAlive(void){
*SYSCON21K &= BANKS8K; // Set 21k bank size
*WAIT21K &= BANK3MASK; // Clear Bank 3 bits
*WAIT21K |= WAIT6BANK3; // 6 Waits to set
// Try to say "hello" to DUART
*IVR = TESTVALUE; // Write a value to IVR
if ((*IVR) & 0xFF) != TESTVALUE) // and then bring back
return DEAD; // Oops!
else return ALIVE; // Success!
}
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||