Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

accessSlave.h

00001 #ifndef ACCESS_SDSP_H
00002 #define ACCESS_SDSP_H
00003 #include "utilities.h"
00004 
00005 //Addresses of SDSP HPI registers:
00006 #define SDSP_HPIC(sdsp)   (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0000) << 2))
00007 #define SDSP_HPIA(sdsp)   (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0001) << 2))
00008 #define SDSP_HPID_I(sdsp) (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0002) << 2))
00009 #define SDSP_HPID(sdsp)   (REG_BASE +((SDSP_BASE +(sdsp<<15) +0x0003) << 2)) 
00010 
00011 #define SDSP_DOES_NOT_EXIST(x)   (x < 0)
00012 #define SDSP_NOT_CONFIGURED(x)   (x == 0)
00013 #define SDSP_HOST_LIST_BUSY(x)   (!slvHostListIdle(x)     || getSlvAck(x))
00014 #define SDSP_IDSP_LIST_BUSY      (!intrDspListSendIdle()  || getIntrDspAck())
00015 
00016 extern uint32 *emifGCR;
00017 /* The EMIF Global Control register has a bit (10) which indicates the status of
00018    an external memory access request. While it is low, the CPU should wait. This
00019    little macro creates the idling while loop when inserted in the code: */
00020 #define waitArdy  while (!(*emifGCR & 0x00000400))
00021 
00022 //A set of inlined functions for lightning access to the SDSPs:
00023 
00024 /************************ Write to the HPI control register *************************/
00025 static inline void writeSdspHpic(uint32 sdsp, uint32 dataValue) {
00026     *((uint32 *) (SDSP_HPIC(sdsp)))= dataValue;
00027     waitArdy; 
00028 }
00029 
00030 /************************ Write to the HPI address register *************************/
00031 static inline void writeSdspHpia(uint32 sdsp, uint32 dataValue) {
00032     *((uint32 *) (SDSP_HPIA(sdsp)))= dataValue;
00033     waitArdy;
00034 
00035     //*((uint32 *) (SDSP_HPIA(sdsp)))= dataValue;
00036     //while (!(*emifGCR & 0x00000400)) ;  //Wait for ARDY.
00037 }
00038 
00039 /************************** Write to the HPI data register **************************/
00040 static inline void writeSdspHpid(uint32 sdsp, uint32 dataValue) {
00041     *((uint32 *) (SDSP_HPID(sdsp)))= dataValue;
00042     waitArdy;
00043 }
00044 
00045 /************ Write to the HPI data register with automatic increment ***************/
00046 static inline void writeSdspHpid_i(uint32 sdsp, uint32 dataValue) {
00047     *((uint32 *) (SDSP_HPID_I(sdsp)))= dataValue;
00048     waitArdy;
00049 }
00050 
00051 /************************ Read from the HPI control register ************************/
00052 static inline uint32 readSdspHpic(uint32 sdsp) {
00053     return *((uint32 *) (SDSP_HPIC(sdsp)));
00054 }
00055 
00056 /************************ Read from the HPI address register ************************/
00057 static inline uint32 readSdspHpia(uint32 sdsp) {
00058     return *((uint32 *) (SDSP_HPIA(sdsp)));
00059 }
00060 
00061 /************************** Read from the HPI data register *************************/
00062 static inline uint32 readSdspHpid(uint32 sdsp) {
00063     return *((uint32 *) (SDSP_HPID(sdsp)));
00064 }
00065 
00066 /************ Read from the HPI data register with automatic increment **************/
00067 static inline uint32 readSdspHpid_i(uint32 sdsp) {
00068     return *((uint32 *) (SDSP_HPID_I(sdsp)));
00069 }
00070 
00071 static inline void readSdspBlockI(uint32 sdsp, uint32 *sdspPtr, uint32 *ptr, uint32 len) {
00072     uint32 i;
00073 
00074     //greenLed_on;
00075     writeSdspHpia(sdsp, (uint32) sdspPtr);
00076 
00077     for (i=0; i<(len-1); ++i) *(ptr +i)= readSdspHpid_i(sdsp);
00078     *(ptr +i)= readSdspHpid(sdsp);
00079     //greenLed_off;
00080 }
00081 
00082 static inline void readSdspBlockI2(uint32 sdsp, uint32 *sdspPtr, uint32 *ptr, uint32 len) {
00083     uint32 i;
00084 
00085     //greenLed_on;
00086     *((uint32 *) (SDSP_HPIA(sdsp)))= (uint32) sdspPtr;
00087     waitArdy;
00088 
00089     for (i=0; i<(len-1); ++i) *(ptr +i)= *((uint32 *) (SDSP_HPID_I(sdsp)));
00090     *(ptr +i)= *((uint32 *) (SDSP_HPID(sdsp)));
00091     //greenLed_off;
00092 }
00093 
00094 
00095 #endif  /* Multiple inclusion protection. */

Generated on Thu Dec 22 20:16:56 2005 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5