FreeRTOS port on GAP8/RISC-V
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Event_unit

Event management

The following function can be used for selecting which events can wake-up the core, put the core the sleep, clear events and so on.

static uint32_t hal_evt_read32 (uint32_t base, uint32_t offset)
 
static uint32_t hal_eu_evt_status ()
 
static uint32_t hal_eu_evt_status_masked ()
 
static void hal_eu_evt_clr (uint32_t evtMask)
 
static void hal_eu_evt_mask (uint32_t evtMask)
 
static void hal_eu_evt_mask_set (uint32_t evtMask)
 
static void hal_eu_evt_mask_clr (uint32_t evtMask)
 
static uint32_t hal_eu_evt_wait ()
 
static uint32_t hal_eu_evt_wait_and_clr ()
 
static uint32_t hal_eu_evt_mask_wait_and_clr (uint32_t evt_mask)
 
static uint32_t hal_eu_evt_mask_wait (uint32_t evt_mask)
 
static uint32_t hal_eu_fc_evt_mask_wait_and_clr (uint32_t evt_mask)
 

Interrupt management

Functions for setting-up which IRQ can trigger an interrupt handler, clear interrupts and so on

static uint32_t hal_eu_evt_status_irq_masked ()
 
static void hal_eu_irq_mask (uint32_t irq_mask)
 
static void hal_eu_irq_sec_mask (uint32_t irq_mask)
 
static void hal_eu_irq_mask_set (uint32_t irq_mask)
 
static void hal_eu_irq_mask_clr (uint32_t irq_mask)
 
static void hal_eu_irq_sec_mask_set (uint32_t irq_mask)
 
static void hal_eu_irq_sec_mask_clr (uint32_t irq_mask)
 
static uint32_t hal_eu_irq_status ()
 

SW event trigger.

Functions for triggering SW events which can be used to wake-up cluster cores from SW.

static void hal_eu_fc_evt_trig_set (int event_num, uint32_t value)
 
static void hal_eu_fc_evt_demux_trig_set (int event_num, uint32_t value)
 

Hardware barriers.

Functions for managing the hardware barriers which can be used to implement a rendez-vous

static uint32_t hal_eu_barrier_trigger_wait_clear ()
 
static void hal_eu_barrier_setup (uint32_t core_mask)
 
static void hal_eu_barrier_trigger (uint32_t mask)
 
static uint32_t hal_eu_barrier_team_get (void)
 

SoC events FIFO.

Functions for managing SoC events coming from outside the cluster and pushed by the HW to the SoC event FIFO.

static uint32_t hal_eu_soc_events_pop ()
 
static uint32_t hal_fc_eu_soc_events_pop ()
 
static int32_t hal_eu_soc_events_is_valid (uint32_t word)
 
static uint32_t hal_eu_soc_events_get_event (uint32_t word)
 

Hardware mutexes.

Functions for managing, locking and unlocking hardware mutexes

static void hal_eu_mutex_lock (uint32_t mutex_id)
 
static void hal_eu_mutex_unlock (uint32_t mutex_id)
 
static void hal_eu_mutex_init (uint32_t mutex_id)
 

Hardware dispatcher.

Functions for managing the hardware dispatcher, which can be used to dispatch entry points to sleeping slave cores.

static uint32_t hal_eu_dispatch_pop ()
 
static void hal_eu_dispatch_push (uint32_t value)
 
static void hal_eu_dispatch_team_config (uint32_t value)
 

Hardware loops.

Functions for managing the hardware loops, which can be used to dispatch a range of indexes to a core set.

static uint32_t hal_eu_loop_addr (uint32_t id)
 
static uint32_t hal_eu_loop_get_chunk ()
 
static uint32_t hal_eu_loop_get_start ()
 
static uint32_t hal_eu_loop_get_state ()
 
static void hal_eu_loop_set_start (uint32_t value)
 
static void hal_eu_loop_set_end (uint32_t value)
 
static void hal_eu_loop_set_incr (uint32_t value)
 
static void hal_eu_loop_set_chunk (uint32_t value)
 
static void hal_eu_loop_init_epoch (uint32_t core_set)
 
static uint32_t hal_eu_loop_get_single ()
 

Description

Function Documentation

static void hal_eu_barrier_setup ( uint32_t  core_mask)
inlinestatic

References EU_BARRIER_DEMUX.

static uint32_t hal_eu_barrier_team_get ( void  )
inlinestatic

References EU_BARRIER_DEMUX.

static void hal_eu_barrier_trigger ( uint32_t  mask)
inlinestatic

References EU_BARRIER_DEMUX.

static uint32_t hal_eu_barrier_trigger_wait_clear ( )
inlinestatic
static uint32_t hal_eu_dispatch_pop ( )
inlinestatic
static void hal_eu_dispatch_push ( uint32_t  value)
inlinestatic

References EU_DISPATCH_DEMUX, and hal_write32().

static void hal_eu_dispatch_team_config ( uint32_t  value)
inlinestatic

References EU_DISPATCH_DEMUX, and hal_write32().

static void hal_eu_evt_clr ( uint32_t  evtMask)
inlinestatic

Clear some bits of the event status register. This allows clearing events after they have been received so that they do not prevent the core from sleeping anymore.

Parameters
evtMaskBits to be cleared. 1 means the bit must be cleared, 0 it should remain the same.

References EU_CORE_DEMUX.

static void hal_eu_evt_mask ( uint32_t  evtMask)
inlinestatic

Modify the event mask. The event mask tells the event unit which events can wake-up the core. When the core executes the p.elw instruction it goes to sleep unless there is one bit which is set in both the event mask and the event status register. If the event is received while the core is already sleeping and the corresponding bit is set in the event mask, the core is waken-up and cannot go back to sleep until either the event mask or the event status register is modified (usually the bit is cleared using eu_evt_clr)

Parameters
evtMaskValue to write to the event mask. There is 1 bit per event, 1 means it can wake-up the core, 0 it cannot

References EU_CORE_DEMUX.

static void hal_eu_evt_mask_clr ( uint32_t  evtMask)
inlinestatic

Set part of the event mask to 0. This is the opposite of eu_evt_maskSet. For each bit at 1 in the new value, the corresponding bit is set to 0 in the event mask and the others remain the same.

Parameters
evtMaskBit mask used to update the event mask. There is 1 bit per event, 1 means the corresponding bit is cleared in the event mask.

References EU_CORE_DEMUX.

Referenced by hal_eu_evt_mask_wait(), hal_eu_evt_mask_wait_and_clr(), hal_eu_fc_evt_mask_wait_and_clr(), and system_exit().

static void hal_eu_evt_mask_set ( uint32_t  evtMask)
inlinestatic

Set part of the event mask to 1. This is similar to eu_evt_mask but for each bit at 1 in the new value, the corresponding bit is set in the event mask and the others remain the same. This is useful when the mask must be updated before waiting for a specific event without modifying the other events (this saves a few instructions)

Parameters
evtMaskBit mask used to update the event mask. There is 1 bit per event, 1 means the corresponding bit is set in the event mask.

References EU_CORE_DEMUX.

Referenced by cl_cluster_exec_loop(), hal_eu_evt_mask_wait(), hal_eu_evt_mask_wait_and_clr(), and hal_eu_fc_evt_mask_wait_and_clr().

static uint32_t hal_eu_evt_mask_wait ( uint32_t  evt_mask)
inlinestatic

Modify the event mask, put the core to sleep mode until it receives an event, clears the active events and restore the mask. This is similar to eu_evt_waitAndClr but the events whose bit is set to 1 in the given mask, are activated in the event mask before going to sleep, and are cleared when the core is waken-up. Not that this function is using 3 instructions instead of 1 for most of other primitives, as it needs 2 instruction to set and clear the mask.

Parameters
evtMaskEvent mask used for activating and deactivating events. Each bit to 1 means the corresponding event is activated before sleeping and deactivated after.

References hal_eu_evt_mask_clr(), hal_eu_evt_mask_set(), and hal_eu_evt_wait().

Referenced by hal_cl_dma_flush(), and hal_cl_dma_wait().

static uint32_t hal_eu_evt_mask_wait_and_clr ( uint32_t  evt_mask)
inlinestatic

Modify the event mask, put the core to sleep mode until it receives an event, clears the active events and restore the mask. This is similar to eu_evt_waitAndClr but the events whose bit is set to 1 in the given mask, are activated in the event mask before going to sleep, and are cleared when the core is waken-up. Not that this function is using 3 instructions instead of 1 for most of other primitives, as it needs 2 instruction to set and clear the mask.

Parameters
evtMaskEvent mask used for activating and deactivating events. Each bit to 1 means the corresponding event is activated before sleeping and deactivated after.

References hal_eu_evt_mask_clr(), hal_eu_evt_mask_set(), and hal_eu_evt_wait_and_clr().

Referenced by __attribute__(), __pi_rtc_apb_reg_wait(), cl_wait_task(), pi_cl_dma_decompressor_wait(), pi_cl_pi_task_wait(), and pi_cl_send_task_to_fc().

static uint32_t hal_eu_evt_status ( )
inlinestatic

Get event status. Return the value of the event status register. This register contains one bit per event, 1 means the event is set. Note that this register is actually used as a status register for both events and interrupts, so clearing one will clear the other. 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
The content of the status register.

References EU_CORE_DEMUX.

static uint32_t hal_eu_evt_status_irq_masked ( )
inlinestatic

References EU_CORE_DEMUX.

static uint32_t hal_eu_evt_status_masked ( )
inlinestatic

Get active events. Same as eu_evt_status, but the content of the status register is ANDed with the content of the event mask register 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
The content of the status register ANDed with the event mask register.

References EU_CORE_DEMUX.

static uint32_t hal_eu_evt_wait ( )
inlinestatic

Put the core to sleep mode until it receives an event The core goes to sleep until there is one bit at 1 in both the event status register and the event mask register. If it is already the case, when this function is called, the core does not go to sleep and this function returns immediately.

References EU_CORE_DEMUX, and hal_evt_read32().

Referenced by hal_eu_evt_mask_wait(), and system_exit().

static uint32_t hal_eu_evt_wait_and_clr ( )
inlinestatic

Put the core to sleep mode until it receives an event and clears the active events This is similar to eu_evt_wait but when the core is waken-up, the active events are cleared in the status register. An event is active if its bit is at 1 in both the event status register and the event mask register.

References EU_CORE_DEMUX, and hal_evt_read32().

Referenced by hal_eu_evt_mask_wait_and_clr(), and hal_eu_fc_evt_mask_wait_and_clr().

static void hal_eu_fc_evt_demux_trig_set ( int  event_num,
uint32_t  value 
)
inlinestatic

References EU_SW_EVENTS_DEMUX, and hal_write32().

Referenced by __attribute__().

static uint32_t hal_eu_fc_evt_mask_wait_and_clr ( uint32_t  evt_mask)
inlinestatic
static void hal_eu_fc_evt_trig_set ( int  event_num,
uint32_t  value 
)
inlinestatic

References FC_EU_SW_EVENTS, and hal_write32().

Referenced by pi_cl_send_task_to_fc(), and vSetPendSV().

static void hal_eu_irq_mask ( uint32_t  irq_mask)
inlinestatic

References EU_CORE_DEMUX.

static void hal_eu_irq_mask_clr ( uint32_t  irq_mask)
inlinestatic

References EU_CORE_DEMUX.

static void hal_eu_irq_mask_set ( uint32_t  irq_mask)
inlinestatic

References EU_CORE_DEMUX.

Referenced by cl_cluster_exec_loop().

static void hal_eu_irq_sec_mask ( uint32_t  irq_mask)
inlinestatic

References EU_CORE_DEMUX.

static void hal_eu_irq_sec_mask_clr ( uint32_t  irq_mask)
inlinestatic

References EU_SEC_DEMUX.

static void hal_eu_irq_sec_mask_set ( uint32_t  irq_mask)
inlinestatic

References EU_SEC_DEMUX.

static uint32_t hal_eu_irq_status ( )
inlinestatic

References EU_CORE_DEMUX.

static uint32_t hal_eu_loop_addr ( uint32_t  id)
inlinestatic
static uint32_t hal_eu_loop_get_chunk ( )
inlinestatic

References EU_LOOP_DEMUX.

static uint32_t hal_eu_loop_get_single ( )
inlinestatic

References EU_LOOP_DEMUX.

static uint32_t hal_eu_loop_get_start ( )
inlinestatic

References EU_LOOP_DEMUX.

static uint32_t hal_eu_loop_get_state ( )
inlinestatic

References EU_LOOP_DEMUX.

static void hal_eu_loop_init_epoch ( uint32_t  core_set)
inlinestatic

References EU_LOOP_DEMUX.

static void hal_eu_loop_set_chunk ( uint32_t  value)
inlinestatic
static void hal_eu_loop_set_end ( uint32_t  value)
inlinestatic
static void hal_eu_loop_set_incr ( uint32_t  value)
inlinestatic
static void hal_eu_loop_set_start ( uint32_t  value)
inlinestatic
static void hal_eu_mutex_init ( uint32_t  mutex_id)
inlinestatic

References EU_MUTEX_DEMUX.

Referenced by cl_stack_init().

static void hal_eu_mutex_lock ( uint32_t  mutex_id)
inlinestatic
static void hal_eu_mutex_unlock ( uint32_t  mutex_id)
inlinestatic
static uint32_t hal_eu_soc_events_get_event ( uint32_t  word)
inlinestatic
static int32_t hal_eu_soc_events_is_valid ( uint32_t  word)
inlinestatic
static uint32_t hal_eu_soc_events_pop ( )
inlinestatic

References EU_SOC_EVENTS, and hal_read32().

static uint32_t hal_evt_read32 ( uint32_t  base,
uint32_t  offset 
)
inlinestatic

Clock-gated load. 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
baseThe base address of the event unit.
offsetThe offset 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 Catch::Generators::value().

Referenced by hal_eu_barrier_trigger_wait_clear(), hal_eu_dispatch_pop(), hal_eu_evt_wait(), hal_eu_evt_wait_and_clr(), and hal_eu_mutex_lock().

static uint32_t hal_fc_eu_soc_events_pop ( )
inlinestatic