#ifndef ACCESS_SDSP_H #define ACCESS_SDSP_H #include "utilities.h" //Addresses of SDSP HPI registers: #define SDSP_HPIC(sdsp) (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0000) << 2)) #define SDSP_HPIA(sdsp) (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0001) << 2)) #define SDSP_HPID_I(sdsp) (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0002) << 2)) #define SDSP_HPID(sdsp) (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0003) << 2)) #define SDSP_DOES_NOT_EXIST(x) (x < 0) #define SDSP_NOT_CONFIGURED(x) (x == 0) #define SDSP_HOST_LIST_BUSY(x) (!slvHostListIdle(x) || getSlvAck(x)) #define SDSP_IDSP_LIST_BUSY (!intrDspListSendIdle() || getIntrDspAck()) extern uint32 *emifGCR; /* The EMIF Global Control register has a bit (10) which indicates the status of an external memory access request. While it is low, the CPU should wait. This little macro creates the idling while loop when inserted in the code: */ #define waitArdy while (!(*emifGCR & 0x00000400)) //A set of inlined functions for lightning access to the SDSPs: /************************ Write to the HPI control register *************************/ static inline void writeSdspHpic(uint32 sdsp, uint32 dataValue) { *((uint32 *) (SDSP_HPIC(sdsp)))= dataValue; waitArdy; } /************************ Write to the HPI address register *************************/ static inline void writeSdspHpia(uint32 sdsp, uint32 dataValue) { *((uint32 *) (SDSP_HPIA(sdsp)))= dataValue; waitArdy; //*((uint32 *) (SDSP_HPIA(sdsp)))= dataValue; //while (!(*emifGCR & 0x00000400)) ; //Wait for ARDY. } /************************** Write to the HPI data register **************************/ static inline void writeSdspHpid(uint32 sdsp, uint32 dataValue) { *((uint32 *) (SDSP_HPID(sdsp)))= dataValue; waitArdy; } /************ Write to the HPI data register with automatic increment ***************/ static inline void writeSdspHpid_i(uint32 sdsp, uint32 dataValue) { *((uint32 *) (SDSP_HPID_I(sdsp)))= dataValue; waitArdy; } /************************ Read from the HPI control register ************************/ static inline uint32 readSdspHpic(uint32 sdsp) { return *((uint32 *) (SDSP_HPIC(sdsp))); } /************************ Read from the HPI address register ************************/ static inline uint32 readSdspHpia(uint32 sdsp) { return *((uint32 *) (SDSP_HPIA(sdsp))); } /************************** Read from the HPI data register *************************/ static inline uint32 readSdspHpid(uint32 sdsp) { return *((uint32 *) (SDSP_HPID(sdsp))); } /************ Read from the HPI data register with automatic increment **************/ static inline uint32 readSdspHpid_i(uint32 sdsp) { return *((uint32 *) (SDSP_HPID_I(sdsp))); } static inline void readSdspBlockI(uint32 sdsp, uint32 *sdspPtr, uint32 *ptr, uint32 len) { uint32 i; //greenLed_on; writeSdspHpia(sdsp, (uint32) sdspPtr); for (i=0; i<(len-1); ++i) *(ptr +i)= readSdspHpid_i(sdsp); *(ptr +i)= readSdspHpid(sdsp); //greenLed_off; } static inline void readSdspBlockI2(uint32 sdsp, uint32 *sdspPtr, uint32 *ptr, uint32 len) { uint32 i; //greenLed_on; *((uint32 *) (SDSP_HPIA(sdsp)))= (uint32) sdspPtr; waitArdy; for (i=0; i<(len-1); ++i) *(ptr +i)= *((uint32 *) (SDSP_HPID_I(sdsp))); *(ptr +i)= *((uint32 *) (SDSP_HPID(sdsp))); //greenLed_off; } #endif /* Multiple inclusion protection. */