KE_TASK
[KERNEL]

Task management module. More...

Collaboration diagram for KE_TASK:

Data Structures

struct  ke_msg_handler
 Element of a message handler table. More...
struct  ke_state_handler
 Element of a state handler table. More...
struct  ke_task_desc
 Task descriptor grouping all information required by the kernel for the scheduling. More...

Defines

#define KE_FIRST_MSG(task)   ((ke_msg_id_t)((task) << 10))
 Builds the first message ID of a task.
#define MSG_T(msg)   ((ke_task_id_t)((msg) >> 10))
 Returns the task identifier based on a message identifier.
#define MSG_I(msg)   ((msg) & ((1<<10)-1))
 Returns the message index in the task based on a message identifier.
#define KE_STATE_HANDLER(hdl)   {hdl, sizeof(hdl)/sizeof(struct ke_msg_handler)}
 Helps writing the initialization of the state handlers without errors.
#define KE_STATE_HANDLER_NONE   {NULL, 0}
 Helps writing empty states.

Typedefs

typedef int(* ke_msg_func_t )(ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
 Format of a task message handler function.

Enumerations

enum  {
  TASK_NONE = (uint8_t) -1, TASK_MM = 0, TASK_DBG, TASK_SCAN,
  TASK_TDLS, TASK_SCANU, TASK_ME, TASK_SM,
  TASK_APM, TASK_BAM, TASK_MESH, TASK_RXU,
  TASK_LAST_EMB = TASK_RXU, TASK_API, TASK_MAX
}
 

Tasks types.

More...

Functions

static bool cmp_dest_id (struct co_list_hdr const *msg, uint32_t dest_id)
 Compare destination task callback.
static void ke_task_saved_update (ke_task_id_t const ke_task_id)
 Reactivation of saved messages.
void ke_state_set (ke_task_id_t const id, ke_state_t const state_id)
 Set the state of the task identified by its Task Id.
ke_state_t ke_state_get (ke_task_id_t const id)
 Retrieve the state of a task.
static ke_msg_func_t ke_handler_search (ke_msg_id_t const msg_id, struct ke_state_handler const *state_handler)
 Search message handler function matching the msg id.
static ke_msg_func_t ke_task_handler_get (ke_msg_id_t const msg_id, ke_task_id_t const task_id)
 Retrieve appropriate message handler function of a task.
void ke_task_schedule (int dummy)
 Task scheduler entry point.
int ke_msg_discard (ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
 Generic message handler to consume message without handling it in the task.
int ke_msg_save (ke_msg_id_t const msgid, void const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
 Generic message handler to consume message without handling it in the task.
__INLINE bool ke_task_local (ke_task_id_t const id)
 Check if a task is executed on the local platform.

Variables

static struct ke_task_desc TASK_DESC [TASK_MAX]
 Table grouping the task descriptors.

Detailed Description

Task management module.

This module implements the functions used for managing tasks.


Define Documentation

#define KE_FIRST_MSG ( task   )     ((ke_msg_id_t)((task) << 10))

Builds the first message ID of a task.

Parameters:
[in] task Task identifier
Returns:
The identifier of the first message of the task

Definition at line 96 of file ke_task.h.

#define MSG_I ( msg   )     ((msg) & ((1<<10)-1))

Returns the message index in the task based on a message identifier.

Parameters:
[in] msg Message identifier
Returns:
The message index in the task

Definition at line 114 of file ke_task.h.

#define MSG_T ( msg   )     ((ke_task_id_t)((msg) >> 10))

Returns the task identifier based on a message identifier.

Parameters:
[in] msg Message identifier
Returns:
The identifier of the task this message belongs to

Definition at line 105 of file ke_task.h.


Enumeration Type Documentation

anonymous enum

Tasks types.

Enumerator:
TASK_MM 

MAC Management task.

TASK_DBG 

DEBUG task.

TASK_SCAN 

SCAN task.

TASK_TDLS 

TDLS task.

TASK_SCANU 

SCAN task.

TASK_ME 

SCAN task.

TASK_SM 

SM task.

TASK_APM 

APM task.

TASK_BAM 

BAM task.

TASK_MESH 

MESH task.

TASK_RXU 

RXU task.

Definition at line 47 of file ke_task.h.


Function Documentation

static ke_msg_func_t ke_handler_search ( ke_msg_id_t const   msg_id,
struct ke_state_handler const *  state_handler 
) [static]

Search message handler function matching the msg id.

Parameters:
[in] msg_id Message identifier
[in] state_handler Pointer to the state handler
Returns:
Pointer to the message handler (NULL if not found)

Definition at line 224 of file ke_task.c.

References ASSERT_ERR, ke_msg_handler::func, ke_msg_handler::id, ke_state_handler::msg_cnt, and ke_state_handler::msg_table.

Referenced by ke_task_handler_get().

int ke_msg_discard ( ke_msg_id_t const   msgid,
void const *  param,
ke_task_id_t const   dest_id,
ke_task_id_t const   src_id 
)

Generic message handler to consume message without handling it in the task.

Parameters:
[in] msgid Id of the message received (probably unused)
[in] param Pointer to the parameters of the message.
[in] dest_id TaskId of the receiving task.
[in] src_id TaskId of the sending task.
Returns:
KE_MSG_CONSUMED
int ke_msg_save ( ke_msg_id_t const   msgid,
void const *  param,
ke_task_id_t const   dest_id,
ke_task_id_t const   src_id 
)

Generic message handler to consume message without handling it in the task.

Parameters:
[in] msgid Id of the message received (probably unused)
[in] param Pointer to the parameters of the message.
[in] dest_id TaskId of the receiving task.
[in] src_id TaskId of the sending task.
Returns:
KE_MSG_CONSUMED
ke_state_t ke_state_get ( ke_task_id_t const   id  ) 
void ke_state_set ( ke_task_id_t const   id,
ke_state_t const   state_id 
)
static ke_msg_func_t ke_task_handler_get ( ke_msg_id_t const   msg_id,
ke_task_id_t const   task_id 
) [static]

Retrieve appropriate message handler function of a task.

Parameters:
[in] msg_id Message identifier
[in] task_id Task instance identifier
Returns:
Pointer to the message handler (NULL if not found)

Definition at line 254 of file ke_task.c.

References ASSERT_ERR, ke_task_desc::default_handler, ke_handler_search(), KE_IDX_GET, ke_task_local(), KE_TYPE_GET, ke_task_desc::state, and ke_task_desc::state_handler.

__INLINE bool ke_task_local ( ke_task_id_t const   id  ) 

Check if a task is executed on the local platform.

Parameters:
[in] id Task instance identifier
Returns:
True if the task is executed on the local platform

Definition at line 176 of file ke_task.h.

References ASSERT_ERR.

Referenced by ipc_emb_kmsg_hdlr(), and ke_task_handler_get().

static void ke_task_saved_update ( ke_task_id_t const   ke_task_id  )  [static]

Reactivation of saved messages.

This primitive looks for all the messages destined to the task ke_task_id that have been saved and inserts them into the sent priority queue. These messages will be scheduled at the next scheduler pass.

Parameters:
[in] ke_task_id Destination Identifier

Definition at line 118 of file ke_task.c.

References cmp_dest_id(), GLOBAL_INT_DISABLE, GLOBAL_INT_RESTORE, ke_env, KE_EVT_KE_MESSAGE_BIT, ke_evt_set(), ke_queue_extract(), ke_queue_push(), ke_env_tag::queue_saved, and ke_env_tag::queue_sent.

void ke_task_schedule ( int  dummy  ) 

Task scheduler entry point.

This function is the scheduler of messages. It tries to get a message from the sent queue, then try to get the appropriate message handler function (from the current state, or the default one). This function is called, then the message is saved or freed.

Parameters:
[in] dummy Parameter not used but required to follow the kernel event callback format

Generated on 14 Jan 2020 for Ceva-RW WLAN FullMAC SW documentation by  doxygen 1.6.1