ChibiOS 21.11.4

Detailed Description

Collaboration diagram for Jobs Queues:

Data Structures

struct  ch_jobs_queue
 Type of a jobs queue. More...
struct  ch_job_descriptor
 Type of a job descriptor. More...

Macros

#define MSG_JOB_NULL   ((msg_t)-2)
 Dispatcher return code in case of a JOB_NUL has been received.

Typedefs

typedef struct ch_jobs_queue jobs_queue_t
 Type of a jobs queue.
typedef void(* job_function_t) (void *arg)
 Type of a job function.
typedef struct ch_job_descriptor job_descriptor_t
 Type of a job descriptor.

Functions

static void chJobObjectInit (jobs_queue_t *jqp, size_t jobsn, job_descriptor_t *jobsbuf, msg_t *msgbuf)
 Initializes a jobs queue object.
static job_descriptor_tchJobGet (jobs_queue_t *jqp)
 Allocates a free job object.
static job_descriptor_tchJobGetI (jobs_queue_t *jqp)
 Allocates a free job object.
static job_descriptor_tchJobGetTimeoutS (jobs_queue_t *jqp, sysinterval_t timeout)
 Allocates a free job object.
static job_descriptor_tchJobGetTimeout (jobs_queue_t *jqp, sysinterval_t timeout)
 Allocates a free job object.
static void chJobPostI (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts a job object.
static void chJobPostS (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts a job object.
static void chJobPost (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts a job object.
static void chJobPostAheadI (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts an high priority job object.
static void chJobPostAheadS (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts an high priority job object.
static void chJobPostAhead (jobs_queue_t *jqp, job_descriptor_t *jp)
 Posts an high priority job object.
static msg_t chJobDispatch (jobs_queue_t *jqp)
 Waits for a job then executes it.
static msg_t chJobDispatchTimeout (jobs_queue_t *jqp, sysinterval_t timeout)
 Waits for a job then executes it.

Macro Definition Documentation

◆ MSG_JOB_NULL

#define MSG_JOB_NULL   ((msg_t)-2)

Dispatcher return code in case of a JOB_NUL has been received.

Definition at line 48 of file chjobs.h.

Referenced by chJobDispatch(), and chJobDispatchTimeout().

Typedef Documentation

◆ jobs_queue_t

typedef struct ch_jobs_queue jobs_queue_t

Type of a jobs queue.

◆ job_function_t

typedef void(* job_function_t) (void *arg)

Type of a job function.

Definition at line 91 of file chjobs.h.

◆ job_descriptor_t

Type of a job descriptor.

Function Documentation

◆ chJobObjectInit()

void chJobObjectInit ( jobs_queue_t * jqp,
size_t jobsn,
job_descriptor_t * jobsbuf,
msg_t * msgbuf )
inlinestatic

Initializes a jobs queue object.

Parameters
[out]jqppointer to a jobs_queue_t structure
[in]jobsnnumber of jobs available
[in]jobsbufpointer to the buffer of jobs, it must be able to hold jobsn job_descriptor_t structures
[in]msgbufpointer to the buffer of messages, it must be able to hold jobsn msg_t messages
Function Class:
Object or module nitializer function.

Definition at line 139 of file chjobs.h.

References chDbgCheck, chGuardedPoolLoadArray(), chGuardedPoolObjectInit(), chMBObjectInit(), ch_jobs_queue::free, and ch_jobs_queue::mbx.

Here is the call graph for this function:

◆ chJobGet()

job_descriptor_t * chJobGet ( jobs_queue_t * jqp)
inlinestatic

Allocates a free job object.

Parameters
[in]jqppointer to a jobs_queue_t structure
Returns
The pointer to the allocated job object.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 159 of file chjobs.h.

References chGuardedPoolAllocTimeout(), ch_jobs_queue::free, and TIME_INFINITE.

Here is the call graph for this function:

◆ chJobGetI()

job_descriptor_t * chJobGetI ( jobs_queue_t * jqp)
inlinestatic

Allocates a free job object.

Parameters
[in]jqppointer to a jobs_queue_t structure
Returns
The pointer to the allocated job object.
Return values
NULLif a job object is not immediately available.
Function Class:
This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 173 of file chjobs.h.

References chGuardedPoolAllocI(), and ch_jobs_queue::free.

Here is the call graph for this function:

◆ chJobGetTimeoutS()

job_descriptor_t * chJobGetTimeoutS ( jobs_queue_t * jqp,
sysinterval_t timeout )
inlinestatic

Allocates a free job object.

Parameters
[in]jqppointer to a jobs_queue_t structure
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The pointer to the allocated job object.
Return values
NULLif a job object is not available within the specified timeout.
Function Class:
This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 193 of file chjobs.h.

References chGuardedPoolAllocTimeoutS(), and ch_jobs_queue::free.

Here is the call graph for this function:

◆ chJobGetTimeout()

job_descriptor_t * chJobGetTimeout ( jobs_queue_t * jqp,
sysinterval_t timeout )
inlinestatic

Allocates a free job object.

Parameters
[in]jqppointer to a jobs_queue_t structure
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The pointer to the allocated job object.
Return values
NULLif a job object is not available within the specified timeout.
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 214 of file chjobs.h.

References chGuardedPoolAllocTimeout(), and ch_jobs_queue::free.

Here is the call graph for this function:

◆ chJobPostI()

void chJobPostI ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts a job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 229 of file chjobs.h.

References chDbgAssert, chMBPostI(), ch_jobs_queue::mbx, and MSG_OK.

Here is the call graph for this function:

◆ chJobPostS()

void chJobPostS ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts a job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 245 of file chjobs.h.

References chDbgAssert, chMBPostTimeoutS(), ch_jobs_queue::mbx, MSG_OK, and TIME_IMMEDIATE.

Here is the call graph for this function:

◆ chJobPost()

void chJobPost ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts a job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 261 of file chjobs.h.

References chDbgAssert, chMBPostTimeout(), ch_jobs_queue::mbx, MSG_OK, and TIME_IMMEDIATE.

Here is the call graph for this function:

◆ chJobPostAheadI()

void chJobPostAheadI ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts an high priority job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
This is an I-Class API, this function can be invoked from within a system lock zone by both threads and interrupt handlers.

Definition at line 277 of file chjobs.h.

References chDbgAssert, chMBPostAheadI(), ch_jobs_queue::mbx, and MSG_OK.

Here is the call graph for this function:

◆ chJobPostAheadS()

void chJobPostAheadS ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts an high priority job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
This is an S-Class API, this function can be invoked from within a system lock zone by threads only.

Definition at line 293 of file chjobs.h.

References chDbgAssert, chMBPostAheadTimeoutS(), ch_jobs_queue::mbx, MSG_OK, and TIME_IMMEDIATE.

Here is the call graph for this function:

◆ chJobPostAhead()

void chJobPostAhead ( jobs_queue_t * jqp,
job_descriptor_t * jp )
inlinestatic

Posts an high priority job object.

Note
By design the object can be always immediately posted.
Parameters
[in]jqppointer to a jobs_queue_t structure
[in]jppointer to the job object to be posted
Function Class:
Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 309 of file chjobs.h.

References chDbgAssert, chMBPostAheadTimeout(), ch_jobs_queue::mbx, MSG_OK, and TIME_IMMEDIATE.

Here is the call graph for this function:

◆ chJobDispatch()

msg_t chJobDispatch ( jobs_queue_t * jqp)
inlinestatic

Waits for a job then executes it.

Parameters
[in]jqppointer to a jobs_queue_t structure
Returns
The function outcome.
Return values
MSG_OKif a job has been executed.
MSG_RESETif the internal mailbox has been reset.
MSG_JOB_NULLif a JOB_NULL has been received.

Definition at line 325 of file chjobs.h.

References chDbgAssert, chGuardedPoolFree(), chMBFetchTimeout(), ch_jobs_queue::free, ch_job_descriptor::jobarg, ch_job_descriptor::jobfunc, ch_jobs_queue::mbx, MSG_JOB_NULL, MSG_OK, and TIME_INFINITE.

Here is the call graph for this function:

◆ chJobDispatchTimeout()

msg_t chJobDispatchTimeout ( jobs_queue_t * jqp,
sysinterval_t timeout )
inlinestatic

Waits for a job then executes it.

Parameters
[in]jqppointer to a jobs_queue_t structure
[in]timeoutthe number of ticks before the operation timeouts, the following special values are allowed:
  • TIME_IMMEDIATE immediate timeout.
  • TIME_INFINITE no timeout.
Returns
The function outcome.
Return values
MSG_OKif a job has been executed.
MSG_TIMEOUTif a timeout occurred.
MSG_RESETif the internal mailbox has been reset.
MSG_JOB_NULLif a JOB_NULL has been received.

Definition at line 366 of file chjobs.h.

References chDbgAssert, chGuardedPoolFree(), chMBFetchTimeout(), ch_jobs_queue::free, ch_job_descriptor::jobarg, ch_job_descriptor::jobfunc, ch_jobs_queue::mbx, MSG_JOB_NULL, and MSG_OK.

Here is the call graph for this function: