Functions ¶
Initialization And DeInitialization Functions ¶
-
void
SEQ_Init
(
void
)
¶
-
Initialize the sequencer internal resources.
Note
Not callable from an ISR.
-
void
SEQ_DeInit
(
void
)
¶
-
Deinitialize the sequencer resources.
Note
Not callable from an ISR.
Idle Task Functions ¶
- __WEAK void SEQ_Idle (void)
-
This function is called by the sequencer in critical section (PRIMASK bit). Called when there are no more tasks to be executed and when there are no pending event or the pending event is still not set.
Note
The application must enter low power mode in this function. When this function is not implemented by the application, the sequencer keeps running a while loop (RUN MODE) It must be called only by the sequencer.
- __WEAK void SEQ_PreIdle (void)
-
This function is called by the sequencer outside critical section just before calling SEQ_Idle(). SEQ_PreIdle() is considered as the last task executed before calling SEQ_Idle(). In case a task or an event is set from an interrupt handler just after SEQ_PreIdle() is called, SEQ_Idle() will not be called.
Note
It must be called only by the sequencer.
- __WEAK void SEQ_PostIdle (void)
-
This function is called by the sequencer outside critical section. Called either after calling SEQ_Idle() OR after calling SEQ_PreIdle() without call to SEQ_Idle() due to an incoming task set or event requested after SEQ_PreIdle() has been called.
Note
SEQ_PostIdle() is always called if SEQ_PreIdle() has been called and never called otherwise. It must be called only by the sequencer.
Scheduler Functions ¶
-
void
SEQ_Run
(
seq_bm_t
mask_bm
)
¶
-
This function requests the sequencer to execute all pending tasks using round robin mechanism. When no task are pending, it calls SEQ_Idle(); This function must be called in a while loop in the application.
Note
It must not be called from an ISR.
Note
The construction of the task must take into account the fact that there is no counting / protection on the activation of the task. Thus, when the task is running, it must perform all the operations in progress programmed before its call or manage a reprogramming of the task. This function can be nested. That is the reason why many variables that are used only in that function are declared static.
Note
: These variables could have been declared static in the function.
- Parameters :
-
mask_bm – list of task (bit mapping) that is be kept in the sequencer list.
Task Creation Functions ¶
-
void
SEQ_RegTask
(
seq_task_id_t
task_id_bm
,
uint32_t
flags
,
void
(
*
task
)
(
void
)
)
¶
-
This function registers a task in the sequencer.
Note
It can be called from an ISR.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
flags – flags are reserved parameter for future use
task – Reference of the function to be executed
-
uint32_t
SEQ_IsRegisteredTask
(
seq_task_id_t
task_id_bm
)
¶
-
This function checks if a task is registered.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
- Return values :
-
0 – if not 1 if true
Task Enable Functions ¶
-
void
SEQ_SetTask
(
seq_task_id_t
task_id_bm
,
uint32_t
task_prio
)
¶
-
This function requests a task to be executed.
Note
It can be called from an ISR
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
task_prio – The priority of the task It must a number from 0 (high priority) to 31 (low priority) The priority is checked each time the sequencer needs to select a new task to execute It does not permit to preempt a running task with lower priority
-
uint32_t
SEQ_IsSchedulableTask
(
seq_task_id_t
task_id_bm
)
¶
-
This function checks if a task could be scheduled.
Note
It can be called from an ISR.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
- Return values :
-
0 – if not 1 if true
Task Pause/Resume Functions ¶
-
void
SEQ_PauseTask
(
seq_task_id_t
task_id_bm
)
¶
-
This function prevents a task to be called by the sequencer even when set with SEQ_SetTask(). By default, all tasks are executed by the sequencer when set with SEQ_SetTask(). When a task is paused, it is moved out from the sequencer list.
Note
It can be called from an ISR.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
-
uint32_t
SEQ_IsPauseTask
(
seq_task_id_t
task_id_bm
)
¶
-
This function allows to know if the task has been put in pause. By default, all tasks are executed by the sequencer when set with SEQ_SetTask() The exit of the pause must be done by the function SEQ_ResumeTask.
Note
It can be called from an ISR.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
- Return values :
-
0 – if not 1 if true
-
void
SEQ_ResumeTask
(
seq_task_id_t
task_id_bm
)
¶
-
This function allows again a task to be called by the sequencer if set with SEQ_SetTask(). This is used in relation with SEQ_PauseTask().
Note
It can be called from an ISR.
- Parameters :
-
task_id_bm – The Id of the task, this parameter must be a value of the enumeration seq_task_id_t
Task Event Functions ¶
-
void
SEQ_SetEvt
(
seq_bm_t
evt_id_bm
)
¶
-
This function sets an event that is waited with SEQ_WaitEvt().
Note
An event must be a 32 bit mapping where only 1 bit is set It can be called from an ISR.
- Parameters :
-
evt_id_bm – event id bit mask
-
void
SEQ_ClrEvt
(
seq_bm_t
evt_id_bm
)
¶
-
This function can be used to clear the event before calling SEQ_WaitEvt(). This API is useful when the SEQ_SetEvt() is called several time to notify the same event. Due to Software Architecture where the timings are hard to control, this can be an unwanted case.
Note
It can be called from an ISR.
- Parameters :
-
evt_id_bm – event id bm It must be a bit mapping where only 1 bit is set
-
void
SEQ_WaitEvt
(
seq_bm_t
evt_id_bm
)
¶
-
This function waits for a specific event to be set. Sequencer loops SEQ_EvtIdle() until the event is set. When called recursively, it acts as a First in / Last out mechanism. The sequencer waits for the last event requested to be set even though one of the already requested event has been set.
Note
It must not be called from an ISR.
Note
The construction of the task must take into account the fact that there is no counting / protection on the event. Thus, when the task is running, it must perform all the operations in progress programmed before its call or manage a reprogramming of the task.
- Parameters :
-
evt_id_bm – event id bit mask It must be a bit mapping where only 1 bit is set
-
seq_bm_t
SEQ_IsEvtPend
(
void
)
¶
-
This function returns whether the waited event is pending or not. It is useful only when the SEQ_EvtIdle() is overloaded by the application. In that case, when the low power mode needs to be executed, the application must first check whether the waited event is pending or not. Both the event checking and the low power mode processing must be done in critical section.
Note
It can be called from an ISR.
- Return values :
-
0 – when the waited event is not there or the evt_id when the waited event is pending
- __WEAK void SEQ_EvtIdle (seq_bm_t task_id_bm, seq_bm_t evt_waited_bm)
-
This function loops until the waited event is set.
Note
When not implemented by the application, it calls SEQ_Run(~task_id_bm) which means the waited task is suspended until the waited event and the other tasks are running or the application enter low power mode. Else the user can redefine his own function for example call sequencer SEQ_Run(0) to suspend all the task and let the sequencer enter the low power mode. It must be called only by the sequencer.
- Parameters :
-
task_id_bm – The task id that is currently running. When task_id_bm = 0, it means SEQ_WaitEvt( ) has been called outside a registered task (ie at startup before SEQ_Run( ) has been called
evt_waited_bm – The event id that is waited.
Pre-Post Task Functions ¶
- __WEAK void SEQ_PreTask (uint32_t task_id)
-
This function is call before a task execution.
Note
the function is provided to help the debug and the default implementation does nothing
- Parameters :
-
task_id – The task id.
- __WEAK void SEQ_PostTask (uint32_t task_id)
-
This function is called after a task execution.
Note
the function is provided to help the debug and the default implementation does nothing
- Parameters :
-
task_id – The task id.
- __WEAK void SEQ_CatchWarning (seq_warning_t warning_id)
-
This function is called when a warning is detected.
Note
the function is provided to help the debug and the default implementation does nothing
- Parameters :
-
warning_id – The warning id.