ChibiOS  21.6.0
Collaboration diagram for Jobs Queues:

Detailed Description

Macros

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

Typedefs

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

Data Structures

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

Functions

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

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.

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()

static 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:
Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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()

static 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: