FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gap8/pmsis/include/pmsis/implem/hal/cluster/cluster_event_unit.h File Reference

Functions

static uint32_t hal_eu_read32 (uint32_t base, uint32_t offset)
 Clock-gated load. More...
 
static void hal_cl_eu_evt_mask_set (uint32_t mask)
 EU_Core. More...
 
static void hal_cl_eu_evt_mask_clear (uint32_t mask)
 
static void hal_cl_eu_irq_mask_set (uint32_t mask)
 
static void hal_cl_eu_irq_mask_clear (uint32_t mask)
 
static uint32_t hal_cl_eu_evt_irq_status (void)
 Events and IRQs status. More...
 
static uint32_t hal_cl_eu_evt_status (void)
 Event status. More...
 
static uint32_t hal_cl_eu_irq_status (void)
 IRQs status. More...
 
static void hal_cl_eu_evt_clear (uint32_t mask)
 Clear event status. More...
 
static uint32_t hal_cl_eu_evt_wait (void)
 Wait and sleep. More...
 
static uint32_t hal_cl_eu_evt_wait_and_clear (void)
 Wait and sleep. More...
 
static void hal_cl_eu_evt_mask_wait (uint32_t event_mask)
 
static void hal_cl_eu_evt_mask_wait_clear (uint32_t event_mask)
 
static void hal_cl_eu_dispatch_fifo_push (uint32_t message)
 EU_Dispatch. More...
 
static uint32_t hal_cl_eu_dispatch_fifo_pop (void)
 
static void hal_cl_eu_dispatch_team_config (uint32_t team_mask)
 
static void hal_cl_eu_mutex_init (uint32_t mutex_id)
 EU_HW_Mutex. More...
 
static void hal_cl_eu_mutex_lock (uint32_t mutex_id)
 
static void hal_cl_eu_mutex_unlock (uint32_t mutex_id)
 
static void hal_cl_eu_glob_sw_trig (uint32_t cluster_id, uint32_t sw_event, uint32_t core_mask)
 EU_SW_Trig. More...
 
static void hal_cl_eu_barrier_setup (uint32_t barrier_id, uint32_t core_mask)
 EU_HW_Barrier. More...
 
static uint32_t hal_cl_eu_barrier_team_get (uint32_t barrier_id)
 
static uint32_t hal_cl_eu_barrier_status (uint32_t barrier_id)
 
static void hal_cl_eu_barrier_trigger (uint32_t barrier_id, uint32_t core_mask)
 
static uint32_t hal_cl_eu_barrier_trigger_self (uint32_t barrier_id)
 
static uint32_t hal_cl_eu_barrier_trigger_wait (uint32_t barrier_id)
 
static uint32_t hal_cl_eu_barrier_trigger_wait_clear (uint32_t barrier_id)
 

Function Documentation

static void hal_cl_eu_barrier_setup ( uint32_t  barrier_id,
uint32_t  core_mask 
)
inlinestatic

Functions to use to config/access cluster barrier.

Setup a barrier for a mask of cores. Get current status of barrier. Trigger barrier with a mask. Trigger barrier with core_id of core calling func. Trigger barrier with core_id of core calling func and sleep. Trigger barrier with core_id of core calling func and sleep and clear buffer.

References CL_DEMUX_EU_HW_BARRIER_TARGET_MASK, CL_DEMUX_EU_HW_BARRIER_TRIGGER_MASK, and hal_write32().

Referenced by pi_cl_team_fork(), and pi_cl_team_prepare_fork().

static uint32_t hal_cl_eu_barrier_status ( uint32_t  barrier_id)
inlinestatic
static uint32_t hal_cl_eu_barrier_team_get ( uint32_t  barrier_id)
inlinestatic
static void hal_cl_eu_barrier_trigger ( uint32_t  barrier_id,
uint32_t  core_mask 
)
inlinestatic
static uint32_t hal_cl_eu_barrier_trigger_self ( uint32_t  barrier_id)
inlinestatic
static uint32_t hal_cl_eu_barrier_trigger_wait ( uint32_t  barrier_id)
inlinestatic
static uint32_t hal_cl_eu_barrier_trigger_wait_clear ( uint32_t  barrier_id)
inlinestatic
static uint32_t hal_cl_eu_dispatch_fifo_pop ( void  )
inlinestatic
static void hal_cl_eu_dispatch_fifo_push ( uint32_t  message)
inlinestatic

Functions to dispatch messages/info to cores. Used by cluster core master to send cluster task info to slaves.

Push a message to slave cores. Pop a message, by slave cores. Configure cores that will receive messages.

References CL_DEMUX_EU_DISPATCH_FIFO_ACCESS, and hal_write32().

Referenced by pi_cl_team_fork(), and pi_cl_team_preset_fork().

static void hal_cl_eu_dispatch_team_config ( uint32_t  team_mask)
inlinestatic
static void hal_cl_eu_evt_clear ( uint32_t  mask)
inlinestatic

Clears the corresponding buffered bit in eu_core_buffer to 0. If the corresponding event line is active in the same cycle where the clear operation gets effective, the bit still does get cleared to 0.

References CL_DEMUX_EU_CORE_BUFFER_CLEAR, and hal_write32().

Referenced by hal_cl_eu_evt_mask_wait_clear().

static uint32_t hal_cl_eu_evt_irq_status ( void  )
inlinestatic

This register contains one bit per event, 1 means the event is set. This register is a buffer, which means if an event is received while its bit is already at 1, the event is somehow lost as the bit stays at 1. Thus events should be used as Linux signals.

Returns
Events and IRQs received.
Note
This register is actually used as a status register for both events and interrupts, so clearing one will clear the other.

References CL_DEMUX_EU_CORE_BUFFER, and hal_eu_read32().

static void hal_cl_eu_evt_mask_clear ( uint32_t  mask)
inlinestatic
static void hal_cl_eu_evt_mask_set ( uint32_t  mask)
inlinestatic

Function to acces cluster event unit.

Set event mask . Clear event mask. Set IRQ mask. Clear IRQ mask. Wait for event, used for synchro. Wait for event and clear, used for synchro.

References CL_DEMUX_EU_CORE_EVENT_MASK_OR, and hal_write32().

Referenced by cl_cluster_exec_loop(), hal_cl_eu_evt_mask_wait(), and hal_cl_eu_evt_mask_wait_clear().

static void hal_cl_eu_evt_mask_wait ( uint32_t  event_mask)
inlinestatic
static void hal_cl_eu_evt_mask_wait_clear ( uint32_t  event_mask)
inlinestatic
static uint32_t hal_cl_eu_evt_status ( void  )
inlinestatic

Same as hal_cl_eu_evt_irq_status(), with the content ANDed with current event mask, so that only relevant events (that can wake-up the core) are shown. It can for example be used to know which events must be handled after a core wake-up as the core has been waken-up due to one of them.

Returns
Events received.

References CL_DEMUX_EU_CORE_BUFFER_MASKED, and hal_eu_read32().

static uint32_t hal_cl_eu_evt_wait ( void  )
inlinestatic

Reading this register will stop the clock of the core until at least one event with the corresponding mask bit set to 1 occurs. The read content of this register is identical to that of eu_core_buffer_masked.

Returns
Events received.

References CL_DEMUX_EU_CORE_EVENT_WAIT, and hal_eu_read32().

Referenced by hal_cl_eu_evt_mask_wait(), and hal_cl_eu_evt_mask_wait_clear().

static uint32_t hal_cl_eu_evt_wait_and_clear ( void  )
inlinestatic

Reading from this register has the same effect as reading from eu_core_event_wait. In addition, the bits of eu_core_buffer that are set to 1 in eu_core_mask will be cleared to 0 after the read.

Returns
Events received.

References CL_DEMUX_EU_CORE_EVENT_WAIT_CLEAR, and hal_eu_read32().

static void hal_cl_eu_glob_sw_trig ( uint32_t  cluster_id,
uint32_t  sw_event,
uint32_t  core_mask 
)
inlinestatic

Functions to use to trigger a SW IRQ from FC to cluster.

Trigger a SW IRQ to cores of a given cluster.

References CL_DEMUX_EU_SW_EVT_TRIGGER, hal_write32(), and offset.

static void hal_cl_eu_irq_mask_clear ( uint32_t  mask)
inlinestatic
static void hal_cl_eu_irq_mask_set ( uint32_t  mask)
inlinestatic
static uint32_t hal_cl_eu_irq_status ( void  )
inlinestatic

Same as hal_cl_eu_evt_irq_status(), with the content ANDed with current event IRQ mask, so that only relevant events (that can wake-up the core) are shown. It can for example be used to know which events must be handled after a core wake-up as the core has been waken-up due to one of them.

Returns
IRQs received.

References CL_DEMUX_EU_CORE_BUFFER_IRQ_MASKED, and hal_eu_read32().

static void hal_cl_eu_mutex_init ( uint32_t  mutex_id)
inlinestatic

Functions to lock/unlock cluster HW mutex.

Initialize mutex. Lock mutex. Unlock mutex.

References CL_DEMUX_EU_MUTEX_MUTEX, hal_compiler_barrier(), and hal_write32().

static void hal_cl_eu_mutex_lock ( uint32_t  mutex_id)
inlinestatic
static void hal_cl_eu_mutex_unlock ( uint32_t  mutex_id)
inlinestatic
static uint32_t hal_eu_read32 ( uint32_t  base,
uint32_t  offset 
)
inlinestatic

On architectures that support it, this executes the special p.elw instruction which is used to put the core in idle mode until it receives an event. On other architectures, it executes a classic read which has the same effect but does not handle correctly interrupts while the core is sleeping.

Parameters
baseBase address of the event unit.
offsetOffset in the event unit where to load from. Depending on this offset, this will trigger different behaviors (barrier, wait, wait&clear, etc).
Returns
The loaded value, after the core has been waken-up. This value depends on the feature which is accessed.

References hal_compiler_barrier(), and Catch::Generators::value().

Referenced by hal_cl_eu_barrier_status(), hal_cl_eu_barrier_trigger_self(), hal_cl_eu_barrier_trigger_wait(), hal_cl_eu_barrier_trigger_wait_clear(), hal_cl_eu_evt_irq_status(), hal_cl_eu_evt_status(), hal_cl_eu_evt_wait(), hal_cl_eu_evt_wait_and_clear(), hal_cl_eu_irq_status(), and hal_cl_eu_mutex_lock().