18 #ifndef __CORE_FEATURE_CIDU_H__ 
   19 #define __CORE_FEATURE_CIDU_H__ 
   35 #include "core_feature_base.h" 
   37 #if defined(__CIDU_PRESENT) && (__CIDU_PRESENT == 1) 
   59 #ifndef __CIDU_BASEADDR 
   61 #error "__CIDU_BASEADDR is not defined, please check!" 
   64 #define CIDU_BASE                                __CIDU_BASEADDR 
   65 #define CIDU_RECEIVE_INTERRUPT_EN(core_id)       (0x1UL << core_id)    
   67 #define CIDU_CORE_INT_STATUS_OFS      0x0         
   68 #define CIDU_SEMAPHORE_OFS            0x80        
   69 #define CIDU_ICI_SHADOW_OFS           0x3FFC      
   70 #define CIDU_INT_INDICATOR_OFS        0x4000      
   71 #define CIDU_INT_MASK_OFS             0x8000      
   72 #define CIDU_CORE_NUM_OFS             0xC084      
   73 #define CIDU_INT_NUM_OFS              0xC090      
   75 #define CIDU_CORE_INT_STATUS_ADDR(n)  (unsigned long)((CIDU_BASE) + (CIDU_CORE_INT_STATUS_OFS) + ((n) << 2))     
   76 #define CIDU_SEMAPHORE_ADDR(n)        (unsigned long)((CIDU_BASE) + (CIDU_SEMAPHORE_OFS) + ((n) << 2))           
   77 #define CIDU_ICI_SHADOW_ADDR          (unsigned long)((CIDU_BASE) + (CIDU_ICI_SHADOW_OFS))                       
   78 #define CIDU_INT_INDICATOR_ADDR(n)    (unsigned long)((CIDU_BASE) + (CIDU_INT_INDICATOR_OFS) + ((n) << 2))       
   79 #define CIDU_INT_MASK_ADDR(n)         (unsigned long)((CIDU_BASE) + (CIDU_INT_MASK_OFS) + ((n) << 2))            
   80 #define CIDU_CORE_NUM_ADDR            (unsigned long)((CIDU_BASE) + (CIDU_CORE_NUM_OFS))                         
   81 #define CIDU_INT_NUM_ADDR             (unsigned long)((CIDU_BASE) + (CIDU_INT_NUM_OFS))                          
   85 #define CIDU_ICI_SEND_CORE_ID_POS     16 
  147     __SW(addr, (uint32_t)to_cores);
 
  190     uint32_t mask = 1UL << core_id;
 
  218     __SW(addr, 0xFFFFFFFF);
 
  277     __SW(addr, (uint32_t)val);
 
  314     val = (uint32_t)(1UL << send_core_id);
 
  366     if (core_id != val) {
 
  388     long semaphore_status = -1;
 
  393     return semaphore_status;
 
  410     int32_t semaphore_status = -1;
 
  412     while(0 != semaphore_status) {
 
  432     __SW(addr, 0xFFFFFFFF);
 
#define CIDU_ICI_SEND_CORE_ID_POS
#define CIDU_CORE_INT_STATUS_ADDR(n)
Core n Inter Core Interrupt status register address.
__STATIC_FORCEINLINE uint32_t CIDU_GetCoreNum(void)
Get core number in the cluster.
#define CIDU_INT_NUM_ADDR
Static configuration external interrupt number register address.
#define CIDU_INT_INDICATOR_ADDR(n)
External interrupt n indicator register address.
__STATIC_FORCEINLINE uint32_t CIDU_GetIntNum(void)
Get external interrupt number.
#define CIDU_CORE_NUM_ADDR
Static configuration core num register address.
#define CIDU_ICI_SHADOW_ADDR
ICI Interrupt source core ID and target core ID register address.
#define CIDU_INT_MASK_ADDR(n)
External interrupt n mask (mask interrupt n to cores or not when interrupt n indicator on)register ad...
#define CIDU_SEMAPHORE_ADDR(n)
Semaphore n register address.
__STATIC_FORCEINLINE void __SW(volatile void *addr, uint32_t val)
Write 32bit value to address (32 bit)
__STATIC_FORCEINLINE uint32_t __LW(volatile void *addr)
Load 32bit value from address (32 bit)
#define __STATIC_FORCEINLINE
Define a static function that should be always inlined by the compiler.
#define __STATIC_INLINE
Define a static function that may be inlined by the compiler.
__STATIC_FORCEINLINE uint32_t CIDU_GetBroadcastModeStatus(uint32_t int_id)
get broadcast mode status
__STATIC_INLINE long CIDU_SetFirstClaimMode(uint32_t int_id, uint32_t core_id)
Let the first coming core to first claim the interrupt.
__STATIC_FORCEINLINE uint32_t CIDU_GetClaimStatus(uint32_t int_id)
Get the claim mask status.
__STATIC_FORCEINLINE void CIDU_ResetFirstClaimMode(uint32_t int_id)
Reset the claim mode mask.
__STATIC_FORCEINLINE void CIDU_BroadcastExtInterrupt(uint32_t int_id, uint32_t to_cores)
Broadcast external interrupt to cores.
__STATIC_FORCEINLINE void CIDU_TriggerInterCoreInt(uint32_t send_core_id, uint32_t recv_core_id)
Trigger interrupt to another core in a multi-core cluster.
__STATIC_FORCEINLINE void CIDU_ClearInterCoreIntReq(uint32_t send_core_id, uint32_t recv_core_id)
Clear the corresponding bit/bits of ICI request triggered by sender core.
__STATIC_FORCEINLINE uint32_t CIDU_QueryCoreIntSenderMask(uint32_t recv_core_id)
Core recv_core_id queries out who sends inter core interrupt to itself.
__STATIC_FORCEINLINE uint32_t CIDU_GetSemaphoreStatus(uint32_t semph_n)
Get SEMAPHOREn's value.
__STATIC_INLINE void CIDU_AcquireSemaphore_Block(uint32_t semph_n, uint32_t core_id)
Keep acquiring the SEMAPHOREn until it has acquired this semaphore successfully.
__STATIC_FORCEINLINE void CIDU_ReleaseSemaphore(uint32_t semph_n)
Release the SEMAPHOREn.
__STATIC_INLINE long CIDU_AcquireSemaphore(uint32_t semph_n, uint32_t core_id)
Acquire the SEMAPHOREn.
__STATIC_INLINE long CIDU_CheckSemaphoreAcquired(uint32_t semph_n, uint32_t core_id)
check SEMAPHOREn's acquired status