PDK API Guide for J721E
csl_proxy.h
Go to the documentation of this file.
1 
40 #ifndef CSL_PROXY_H_
41 #define CSL_PROXY_H_
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 #include <stdint.h>
48 #include <stdbool.h>
49 #include <ti/csl/cslr_proxy.h>
50 
142 #define CSL_PROXY_GLOBAL_ERR_EVT_DISABLE ((uint32_t) 0xFFFFU)
143 
153 typedef uint32_t CSL_ProxyQueueAccessMode;
155 #define CSL_PROXY_QUEUE_ACCESS_MODE_HEAD (CSL_PROXY_TARGET0_PROXY_CTL_MODE_VAL_HEAD)
156 
157 #define CSL_PROXY_QUEUE_ACCESS_MODE_TAIL (CSL_PROXY_TARGET0_PROXY_CTL_MODE_VAL_TAIL)
158 
159 #define CSL_PROXY_QUEUE_ACCESS_MODE_PEEK_HEAD (CSL_PROXY_TARGET0_PROXY_CTL_MODE_VAL_PEEK_HEAD)
160 
161 #define CSL_PROXY_QUEUE_ACCESS_MODE_PEEK_TAIL (CSL_PROXY_TARGET0_PROXY_CTL_MODE_VAL_PEEK_TAIL)
162 /* @} */
163 
193 typedef void (*CSL_ProxyMemAccessCbFxnPtr)( uintptr_t addr, uint8_t *pAppData, uint32_t elemSizeBytes, uint32_t elemCnt );
194 
196 typedef struct {
197  uint32_t mode;
198  uint32_t elSz;
199  uint32_t queueNum;
200  uint32_t errEvtNum;
202 
204 typedef struct
205 {
206  CSL_proxy_target0Regs *pTargetRegs;
207  uint32_t numChns;
208  uint32_t chnSizeBytes;
210 
212 typedef struct
213 {
214  CSL_proxyRegs *pGlbRegs;
215  CSL_proxy_cfgRegs *pCfgRegs;
216  uint32_t bufferSizeBytes;
217  uint32_t numTargets;
219 } CSL_ProxyCfg;
220 
223 /*=============================================================================
224  * Encode the ring element size as follows:
225  * 0 = 4 bytes
226  * 1 = 8 bytes
227  * 2 = 16 bytes
228  * 3 = 32 bytes
229  * 4 = 64 bytes
230  * 5 = 128 bytes
231  * 6 = 256 bytes
232  * 7 = 512 bytes
233  *
234  * 0 is returned if the element size != 4, 8, 16, 32, 64, 128, 256, or 512.
235  *===========================================================================*/
236 static inline uint32_t CSL_proxyEncodeElementSize( uint32_t elSz );
237 static inline uint32_t CSL_proxyEncodeElementSize( uint32_t elSz )
238 {
239  uint32_t i;
240 
241  for(i=7u; (i>0u) && (elSz != (1u<<(i+2U))); i--) {}
242  return i;
243 }
244 
263 extern uint32_t CSL_proxyGetRevision( const CSL_ProxyCfg *pProxyCfg );
264 
275 extern uint32_t CSL_proxyGetNumThreads( const CSL_ProxyCfg *pProxyCfg );
276 
306 extern int32_t CSL_proxyCfgGlobalErrEvtNum( const CSL_ProxyCfg *pProxyCfg, uint32_t globalErrEvtNum );
307 
325 extern int32_t CSL_proxyCfgThread( CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, const CSL_ProxyThreadCfg *pThreadCfg );
326 
342 extern int32_t CSL_proxyCfgThreadErrEvtNum( CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t errEvtNum );
343 
359 extern uint32_t CSL_proxyGetMaxMsgSize( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum );
360 
381 extern uintptr_t CSL_proxyGetDataAddr( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t numBytes );
382 
408 extern void CSL_proxyAccessTarget( CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint8_t *pData, uint32_t numBytes, CSL_ProxyMemAccessCbFxnPtr fpMemAccess );
409 
428 static inline void CSL_proxySetQueueAccessMode( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, CSL_ProxyQueueAccessMode mode );
429 static inline void CSL_proxySetQueueAccessMode( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, CSL_ProxyQueueAccessMode mode )
430 {
431  CSL_ProxyTargetParams *pProxyTargetParams = &((pProxyCfg->pProxyTargetParams)[targetNum]);
432  CSL_REG32_FINS( &pProxyTargetParams->pTargetRegs->PROXY[threadNum].CTL, PROXY_TARGET0_PROXY_CTL_MODE, mode );
433 }
434 
455 static inline void CSL_proxySetQueueParms( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t queueNum, uint32_t elSz, CSL_ProxyQueueAccessMode mode );
456 static inline void CSL_proxySetQueueParms( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t queueNum, uint32_t elSz, CSL_ProxyQueueAccessMode mode )
457 {
458  uint32_t regVal;
459  CSL_ProxyTargetParams *pProxyTargetParams = &((pProxyCfg->pProxyTargetParams)[targetNum]);
460  regVal = CSL_FMK( PROXY_TARGET0_PROXY_CTL_ELSIZE, CSL_proxyEncodeElementSize(elSz) ) |
461  CSL_FMK( PROXY_TARGET0_PROXY_CTL_MODE, (uint32_t)mode ) |
462  CSL_FMK( PROXY_TARGET0_PROXY_CTL_QUEUE, queueNum );
463  CSL_REG32_WR( &pProxyTargetParams->pTargetRegs->PROXY[threadNum].CTL, regVal );
464 }
465 
487 static inline uint32_t CSL_proxyIsThreadError( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum );
488 static inline uint32_t CSL_proxyIsThreadError( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum )
489 {
490  CSL_ProxyTargetParams *pProxyTargetParams = &((pProxyCfg->pProxyTargetParams)[targetNum]);
491  return CSL_REG32_FEXT( &pProxyTargetParams->pTargetRegs->PROXY[threadNum].STATUS, PROXY_TARGET0_PROXY_STATUS_ERROR );
492 }
493 
511 static inline void CSL_proxyClrThreadError( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum );
512 static inline void CSL_proxyClrThreadError( const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum )
513 {
514  CSL_ProxyTargetParams *pProxyTargetParams = &((pProxyCfg->pProxyTargetParams)[targetNum]);
515  CSL_REG32_FINS( &pProxyTargetParams->pTargetRegs->PROXY[threadNum].STATUS, PROXY_TARGET0_PROXY_STATUS_ERROR, 0 );
516 }
517 
520 #ifdef __cplusplus
521 }
522 #endif
523 
524 #endif
static void CSL_proxyClrThreadError(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum)
Clear thread error status.
Definition: csl_proxy.h:512
CSL_proxyRegs * pGlbRegs
Definition: csl_proxy.h:214
uintptr_t CSL_proxyGetDataAddr(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t numBytes)
Get the read/write data address for the specified thread.
uint32_t queueNum
Definition: csl_proxy.h:199
void CSL_proxyAccessTarget(CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint8_t *pData, uint32_t numBytes, CSL_ProxyMemAccessCbFxnPtr fpMemAccess)
Access (read/write) from/to the specified thread.
static uint32_t CSL_proxyIsThreadError(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum)
Get thread error status.
Definition: csl_proxy.h:488
uint32_t chnSizeBytes
Definition: csl_proxy.h:208
uint32_t elSz
Definition: csl_proxy.h:198
uint32_t CSL_proxyGetNumThreads(const CSL_ProxyCfg *pProxyCfg)
Get number of threads supported.
static void CSL_proxySetQueueAccessMode(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, CSL_ProxyQueueAccessMode mode)
Set the queue access mode.
Definition: csl_proxy.h:429
uint32_t bufferSizeBytes
Definition: csl_proxy.h:216
This structure contains configuration parameters for each proxy target.
Definition: csl_proxy.h:204
This structure contains configuration parameters for the proxy IP.
Definition: csl_proxy.h:212
uint32_t errEvtNum
Definition: csl_proxy.h:200
char mode[32]
Definition: tisci_pm_core.h:130
uint64_t addr
Definition: csl_udmap_tr.h:216
CSL_proxy_target0Regs * pTargetRegs
Definition: csl_proxy.h:206
uint32_t numChns
Definition: csl_proxy.h:207
int32_t CSL_proxyCfgThreadErrEvtNum(CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t errEvtNum)
Configure a proxy thread's error event number.
int32_t CSL_proxyCfgGlobalErrEvtNum(const CSL_ProxyCfg *pProxyCfg, uint32_t globalErrEvtNum)
Configure the event number used for global errors.
CSL_ProxyTargetParams * pProxyTargetParams
Definition: csl_proxy.h:218
static void CSL_proxySetQueueParms(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, uint32_t queueNum, uint32_t elSz, CSL_ProxyQueueAccessMode mode)
Set the queue parameters.
Definition: csl_proxy.h:456
uint32_t numTargets
Definition: csl_proxy.h:217
CSL_proxy_cfgRegs * pCfgRegs
Definition: csl_proxy.h:215
union @2 u
void(* CSL_ProxyMemAccessCbFxnPtr)(uintptr_t addr, uint8_t *pAppData, uint32_t elemSizeBytes, uint32_t elemCnt)
Callback function used to write/read to/from memory.
Definition: csl_proxy.h:193
uint32_t mode
Definition: csl_proxy.h:197
uint32_t CSL_proxyGetRevision(const CSL_ProxyCfg *pProxyCfg)
Return revision of the Proxy module.
uint32_t CSL_proxyGetMaxMsgSize(const CSL_ProxyCfg *pProxyCfg, uint32_t targetNum)
Get maximim message size.
int32_t CSL_proxyCfgThread(CSL_ProxyCfg *pProxyCfg, uint32_t targetNum, uint32_t threadNum, const CSL_ProxyThreadCfg *pThreadCfg)
Configure a proxy thread.
static uint32_t CSL_proxyEncodeElementSize(uint32_t elSz)
Definition: csl_proxy.h:237
uint32_t CSL_ProxyQueueAccessMode
Definition: csl_proxy.h:153
This structure contains configuration parameters for each proxy thread.
Definition: csl_proxy.h:196