- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

# /space/home/slher/rel/Beken/v6_4_5/macsw/modules/ke/src/ke_task.h

Go to the documentation of this file.

    00001
    00013 #ifndef _KE_TASK_H_
    00014 #define _KE_TASK_H_
    00015
    00027 /*
    00028  * INCLUDE FILES
    00029  ****************************************************************************************
    00030  */
    00031 #include "co_int.h"
    00032 #include "co_bool.h"
    00033
    00034 // for target dependent macros
    00035 #include "rwnx_config.h"
    00036 // for __INLINE
    00037 #include "compiler.h"
    00038 // for types
    00039 #include "ke_msg.h"
    00040
    00041
    00042 /*
    00043  * DEFINES
    00044  ****************************************************************************************
    00045  */
    00047 enum
    00048 {
    00049     TASK_NONE = (uint8_t) -1,
    00050
    00052     TASK_MM = 0,
    00054     TASK_DBG,
    00056     TASK_SCAN,
    00058     TASK_TDLS,
    00059
    00060     #if (NX_UMAC_PRESENT)
    00062     TASK_SCANU,
    00064     TASK_ME,
    00066     TASK_SM,
    00068     TASK_APM,
    00070     TASK_BAM,
    00072     TASK_MESH,
    00074     TASK_RXU,
    00075
    00076     // This is used to define the last task that is running on the EMB processor
    00077     TASK_LAST_EMB = TASK_RXU,
    00078     #else
    00079     // This is used to define the last task that is running on the EMB processor
    00080     TASK_LAST_EMB = TASK_TDLS,
    00081     #endif //(NX_UMAC_PRESENT)
    00082
    00083     // nX API task
    00084     TASK_API,
    00085     TASK_MAX,
    00086 };
    00087
    00088
    00096 #define KE_FIRST_MSG(task) ((ke_msg_id_t)((task) << 10))
    00097
    00105 #define MSG_T(msg) ((ke_task_id_t)((msg) >> 10))
    00106
    00114 #define MSG_I(msg) ((msg) & ((1<<10)-1))
    00115
    00117 typedef int (*ke_msg_func_t)(ke_msg_id_t const msgid,
    00118                              void const *param,
    00119                              ke_task_id_t const dest_id,
    00120                              ke_task_id_t const src_id);
    00121
    00123 struct ke_msg_handler
    00124 {
    00126     ke_msg_id_t id;
    00128     ke_msg_func_t func;
    00129 };
    00130
    00132 struct ke_state_handler
    00133 {
    00135     const struct ke_msg_handler *msg_table;
    00137     uint16_t msg_cnt;
    00138 };
    00139
    00141 #define KE_STATE_HANDLER(hdl) {hdl, sizeof(hdl)/sizeof(struct ke_msg_handler)}
    00142
    00144 #define KE_STATE_HANDLER_NONE {NULL, 0}
    00145
    00146
    00148 struct ke_task_desc
    00149 {
    00151     const struct ke_state_handler* state_handler;
    00153     const struct ke_state_handler* default_handler;
    00155     ke_state_t* state;
    00157     uint16_t state_max;
    00159     uint16_t idx_max;
    00160 };
    00161
    00162 /*
    00163  * FUNCTION PROTOTYPES
    00164  ****************************************************************************************
    00165  */
    00166
    00176 __INLINE bool ke_task_local(ke_task_id_t const id)
    00177 {
    00178     // sanity check
    00179     ASSERT_ERR(id <= TASK_MAX);
    00180
    00181     return (id <= TASK_LAST_EMB);
    00182 }
    00183
    00184
    00185 ke_state_t ke_state_get(ke_task_id_t const id);
    00186
    00187 void ke_state_set(ke_task_id_t const id,
    00188                   ke_state_t const state_id);
    00189
    00190 void ke_task_schedule(int dummy);
    00191
    00192
    00193 int ke_msg_discard(ke_msg_id_t const msgid,
    00194                    void const *param,
    00195                    ke_task_id_t const dest_id,
    00196                    ke_task_id_t const src_id);
    00197
    00198 int ke_msg_save(ke_msg_id_t const msgid,
    00199                 void const *param,
    00200                 ke_task_id_t const dest_id,
    00201                 ke_task_id_t const src_id);
    00202
    00203
    00205
    00206 #endif // _KE_TASK_H_
    00207