55 if (!job->enabled || !job->job)
68 if (list_job->job == job)
70 list_job->enabled = true;
74 if (list_job->interval > counter_reset_value)
75 counter_reset_value = list_job->interval;
88 if (list_job->job == job)
90 list_job->enabled = false;
94 if (list_job->interval == counter_reset_value)
95 recalculate_reset_value();
124 if (list_job->
job == job)
146 if (list_job->job == job)
155 if (multiplier_factor == 0)
159 if (list_job->job == job)
161 list_job->interval = base_ival * multiplier_factor;
165 if (list_job->interval == counter_reset_value)
166 recalculate_reset_value();
189 LPC_RIT->RICOUNTER = 0;
200 if (
counter % job->interval == 0 && job->job)
CL_Error CL_ListRemoveAt(CL_List *const list, u32 index, void *out_elem)
Removes an element at the specified index.
void CL_ListClear(CL_List *const list)
Removes all elements from the list.
u32 CL_ListSize(const CL_List *const list)
Gets the number of elements in the list.
#define CL_LIST_FOREACH_PTR(__type, __name, __list,...)
Macro to iterate over the elements of the list with a pointer to the current element.
CL_Error CL_ListPushBack(CL_List *const list, const void *const elem)
Adds an element at the end of the list.
void CL_ListFree(CL_List *const list)
Frees the memory previously assigned to the list.
CL_Error CL_ListGetPtr(const CL_List *const list, u32 index, void **out_elem)
Gets an element at the specified index as a pointer, so the user can modify it.
CL_List * CL_ListAlloc(MEM_Allocator *const alloc, u32 elem_sz)
Initializes a new doubly-linked list with tail, with the allocated memory provided by the user.
void RIT_Disable(void)
Disables the RIT entirely (stops counting).
void RIT_Enable(void)
Enables the RIT counting.
_PRIVATE CL_List * jobs
Array of jobs to execute in the RIT interrupt handler.
void allocate_jobs_list(MEM_Allocator *const alloc)
RIT_Error RIT_DisableJob(RIT_Job job)
Exclude this job from the RIT handler queue.
RIT_Error RIT_EnableJob(RIT_Job job)
Include this job in the RIT handler queue.
u32 RIT_GetJobsCount(void)
Returns the number of jobs in the job queue.
RIT_Error RIT_SetJobMultiplierFactor(RIT_Job job, u8 multiplier_factor)
Sets the multiplier factor for the given job.
void RIT_ClearJobs(void)
Clears the job queue.
RIT_Error RIT_RemoveJob(RIT_Job job)
Removes a job from the RIT interrupt handler job queue.
u8 RIT_GetJobMultiplierFactor(RIT_Job job)
Returns the multiplier factor for the given job.
_PRIVATE void recalculate_reset_value(void)
_DECL_EXTERNALLY u32 base_ival
External variable that stores the base interval between each RIT interrupt.
_USED_EXTERNALLY u32 counter_reset_value
_PRIVATE u32 counter
Stores the current RIT counter value, and it's incremented by each RIT interrupt. It's used with the ...
void RIT_IRQHandler(void)
void free_jobs_list(void)
RIT_Error RIT_AddJob(RIT_Job job, u8 divider_factor)
void(* RIT_Job)(void)
RIT interrupt function pointer for jobs that need to be executed in the RIT interrupt handler.
@ RIT_ERR_DURING_PUSHBACK
An error occurred during the push back of the job in the list.
@ RIT_ERR_INVALID_MULTIPLIER
An invalid multiplier factor was specified (must be > 0).
@ RIT_ERR_JOB_NOT_FOUND
The job specified was not found in the handler queue.
@ RIT_ERR_DURING_REMOVEAT
An error occurred during the removal of the job from the list.
#define SET_BIT(reg, bit)