StateOS
Loading...
Searching...
No Matches
Job queue

job queues (procedures executed by the receiving task) More...

Macros

#define OS_JOB_BUFFER(buf, size)
 define job queue data buffer
#define OS_JOB(job, limit)
 define and initialize a job queue object
#define static_JOB(job, limit)
 static alias of OS_JOB()
#define JOB_INIT(limit)
 create and initialize a job queue object
#define JOB_CREATE(limit)
 create and initialize a job queue object
#define JOB_NEW   JOB_CREATE
 alias of JOB_CREATE()

Functions

void job_init (job_t *job, fun_t **data, size_t bufsize)
 initialize a job queue object
job_t * job_create (unsigned limit)
 create and initialize a new job queue object
job_t * job_new (unsigned limit)
 alias of job_create()
void job_reset (job_t *job)
 reset the job queue object and wake up all waiting tasks with 'E_STOPPED' event
void job_kill (job_t *job)
 alias of job_reset()
void job_destroy (job_t *job)
 reset the job queue object, wake up all waiting tasks with 'E_DELETED' event value and free allocated resource
void job_delete (job_t *job)
 alias of job_destroy()
int job_take (job_t *job)
 try to transfer job data from the job queue object and execute the job procedure, don't wait if the job queue object is empty
int job_tryWait (job_t *job)
 alias of job_take()
int job_takeISR (job_t *job)
 ISR alias of job_take().
int job_takeAsync (job_t *job)
 Async alias of job_take().
int job_waitFor (job_t *job, cnt_t delay)
 try to transfer job data from the job queue object and execute the job procedure, wait for given duration of time while the job queue object is empty
int job_waitUntil (job_t *job, cnt_t time)
 try to transfer job data from the job queue object and execute the job procedure, wait until given timepoint while the job queue object is empty
int job_wait (job_t *job)
 try to transfer job data from the job queue object and execute the job procedure, wait indefinitely while the job queue object is empty
int job_waitAsync (job_t *job)
 Async alias of job_wait().
int job_give (job_t *job, fun_t *fun)
 try to transfer job data to the job queue object, don't wait if the job queue object is full
int job_giveISR (job_t *job, fun_t *fun)
 ISR alias of job_give().
int job_giveAsync (job_t *job, fun_t *fun)
 Async alias of job_give().
int job_sendFor (job_t *job, fun_t *fun, cnt_t delay)
 try to transfer job data to the job queue object, wait for given duration of time while the job queue object is full
int job_sendUntil (job_t *job, fun_t *fun, cnt_t time)
 try to transfer job data to the job queue object, wait until given timepoint while the job queue object is full
int job_send (job_t *job, fun_t *fun)
 try to transfer job data to the job queue object, wait indefinitely while the job queue object is full
int job_sendAsync (job_t *job, fun_t *fun)
 Async alias of job_send().
void job_push (job_t *job, fun_t *fun)
 transfer job data to the job queue object, remove the oldest job data if the job queue object is full
void job_pushISR (job_t *job, fun_t *fun)
 ISR alias of job_push().
unsigned job_count (job_t *job)
 return the amount of data contained in the job queue
unsigned job_countISR (job_t *job)
 ISR alias of job_count().
unsigned job_space (job_t *job)
 return the amount of free space in the job queue
unsigned job_spaceISR (job_t *job)
 ISR alias of job_space().
unsigned job_limit (job_t *job)
 return the size of the job queue
unsigned job_limitISR (job_t *job)
 ISR alias of job_limit().

Detailed Description

job queues (procedures executed by the receiving task)

Macro Definition Documentation

◆ OS_JOB_BUFFER

#define OS_JOB_BUFFER ( buf,
size )
Value:
fun_t *buf[size]
void fun_t(void)
timer/task procedure
Definition osbase.h:137

define job queue data buffer

Parameters
bufname of the buffer (passed to the init function)
sizesize of a queue (max number of stored job procedures)

◆ OS_JOB

#define OS_JOB ( job,
limit )
Value:
static fun_t *job##__buf[limit]; \
job_t job[] = { _JOB_INIT( limit, job##__buf ) }

define and initialize a job queue object

Parameters
jobname of a pointer to job queue object
limitsize of a queue (max number of stored job procedures)

◆ static_JOB

#define static_JOB ( job,
limit )
Value:
static fun_t *job##__buf[limit]; \
static job_t job[] = { _JOB_INIT( limit, job##__buf ) }

static alias of OS_JOB()

◆ JOB_INIT

#define JOB_INIT ( limit)
Value:
_JOB_INIT( limit, _JOB_DATA( limit ) )

create and initialize a job queue object

Parameters
limitsize of a queue (max number of stored job procedures)
Returns
job queue object
Note
use only in 'C' code

◆ JOB_CREATE

#define JOB_CREATE ( limit)
Value:
{ JOB_INIT ( limit ) }
#define JOB_INIT(limit)
create and initialize a job queue object
Definition osjobqueue.h:137

create and initialize a job queue object

Parameters
limitsize of a queue (max number of stored job procedures)
Returns
job queue object as array (id)
Note
use only in 'C' code

Function Documentation

◆ job_init()

void job_init ( job_t * job,
fun_t ** data,
size_t bufsize )

initialize a job queue object

Parameters
jobpointer to job queue object
datajob queue data buffer
bufsizesize of the data buffer (in bytes)
Note
use only in thread mode

◆ job_create()

job_t * job_create ( unsigned limit)

create and initialize a new job queue object

Parameters
limitsize of a queue (max number of stored job procedures)
Returns
pointer to job queue object
Return values
NULLobject not created (not enough free memory)
Note
use only in thread mode

◆ job_reset()

void job_reset ( job_t * job)

reset the job queue object and wake up all waiting tasks with 'E_STOPPED' event

Parameters
jobpointer to job queue object
Note
use only in thread mode

◆ job_destroy()

void job_destroy ( job_t * job)

reset the job queue object, wake up all waiting tasks with 'E_DELETED' event value and free allocated resource

Parameters
jobpointer to job queue object
Note
use only in thread mode

◆ job_take()

int job_take ( job_t * job)

try to transfer job data from the job queue object and execute the job procedure, don't wait if the job queue object is empty

Parameters
jobpointer to job queue object
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_TIMEOUTjob queue object is empty, try again
Note
can be used in both thread and handler mode
use ISR alias in blockable interrupt handlers
use Async alias for communication with unmasked interrupt handlers

◆ job_waitFor()

int job_waitFor ( job_t * job,
cnt_t delay )

try to transfer job data from the job queue object and execute the job procedure, wait for given duration of time while the job queue object is empty

Parameters
jobpointer to job queue object
delayduration of time (maximum number of ticks to wait while the job queue object is empty)
  • IMMEDIATE: don't wait if the job queue object is empty
  • INFINITE: wait indefinitely while the job queue object is empty
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_DELETEDjob queue object was deleted before the specified timeout expired
E_TIMEOUTjob queue object is empty and was not received data before the specified timeout expired
Note
use only in thread mode

◆ job_waitUntil()

int job_waitUntil ( job_t * job,
cnt_t time )

try to transfer job data from the job queue object and execute the job procedure, wait until given timepoint while the job queue object is empty

Parameters
jobpointer to job queue object
timetimepoint value
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_DELETEDjob queue object was deleted before the specified timeout expired
E_TIMEOUTjob queue object is empty and was not received data before the specified timeout expired
Note
use only in thread mode

◆ job_wait()

int job_wait ( job_t * job)
inline

try to transfer job data from the job queue object and execute the job procedure, wait indefinitely while the job queue object is empty

Parameters
jobpointer to job queue object
Return values
E_SUCCESSjob data was successfully transferred from the job queue object
E_STOPPEDjob queue object was reseted (unavailable for async version)
E_DELETEDjob queue object was deleted (unavailable for async version)
Note
use only in thread mode
use Async alias for communication with unmasked interrupt handlers
the Async alias is intended for tasks of equal priority: it waits in a loop with tsk_yield, lower priority tasks do not run meanwhile

◆ job_give()

int job_give ( job_t * job,
fun_t * fun )

try to transfer job data to the job queue object, don't wait if the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_TIMEOUTjob queue object is full, try again
Note
can be used in both thread and handler mode
use ISR alias in blockable interrupt handlers
use Async alias for communication with unmasked interrupt handlers

◆ job_sendFor()

int job_sendFor ( job_t * job,
fun_t * fun,
cnt_t delay )

try to transfer job data to the job queue object, wait for given duration of time while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
delayduration of time (maximum number of ticks to wait while the job queue object is full)
  • IMMEDIATE: don't wait if the job queue object is full
  • INFINITE: wait indefinitely while the job queue object is full
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_DELETEDjob queue object was deleted before the specified timeout expired
E_TIMEOUTjob queue object is full and was not issued data before the specified timeout expired
Note
use only in thread mode

◆ job_sendUntil()

int job_sendUntil ( job_t * job,
fun_t * fun,
cnt_t time )

try to transfer job data to the job queue object, wait until given timepoint while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
timetimepoint value
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted before the specified timeout expired
E_DELETEDjob queue object was deleted before the specified timeout expired
E_TIMEOUTjob queue object is full and was not issued data before the specified timeout expired
Note
use only in thread mode

◆ job_send()

int job_send ( job_t * job,
fun_t * fun )
inline

try to transfer job data to the job queue object, wait indefinitely while the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
Return values
E_SUCCESSjob data was successfully transferred to the job queue object
E_STOPPEDjob queue object was reseted (unavailable for async version)
E_DELETEDjob queue object was deleted (unavailable for async version)
Note
use only in thread mode
use Async alias for communication with unmasked interrupt handlers
the Async alias is intended for tasks of equal priority: it waits in a loop with tsk_yield, lower priority tasks do not run meanwhile

◆ job_push()

void job_push ( job_t * job,
fun_t * fun )

transfer job data to the job queue object, remove the oldest job data if the job queue object is full

Parameters
jobpointer to job queue object
funpointer to job procedure
Note
can be used in both thread and handler mode (for blockable interrupts)
use ISR alias in blockable interrupt handlers

◆ job_count()

unsigned job_count ( job_t * job)

return the amount of data contained in the job queue

Parameters
jobpointer to job queue object
Returns
amount of data contained in the job queue
Note
can be used in both thread and handler mode (for blockable interrupts)
use ISR alias in blockable interrupt handlers

◆ job_space()

unsigned job_space ( job_t * job)

return the amount of free space in the job queue

Parameters
jobpointer to job queue object
Returns
amount of free space in the job queue
Note
can be used in both thread and handler mode (for blockable interrupts)
use ISR alias in blockable interrupt handlers

◆ job_limit()

unsigned job_limit ( job_t * job)

return the size of the job queue

Parameters
jobpointer to job queue object
Returns
size of the job queue
Note
can be used in both thread and handler mode (for blockable interrupts)
use ISR alias in blockable interrupt handlers