XDK API  3.6.0
Documentation
Files | Data Structures | Macros | Typedefs | Enumerations | Functions
CmdProcessor

Handles the execution of enqueued commands. More...

+ Collaboration diagram for CmdProcessor:

Files

file  BCDS_CmdProcessor.h
 

Data Structures

struct  _CmdProcessor_S
 

Macros

#define CMDPROCESSOR_MAX_NAME_LEN   UINT32_C(32)
 

Typedefs

typedef void(* CmdProcessor_Func_T )(void *param1, uint32_t param2)
 This data type represents a function pointer for the functions which can be handled by the command processor. More...
 
typedef struct _CmdProcessor_S CmdProcessor_T
 
typedef void * cmdProcessorQueueHandle_t
 
typedef void * cmdProcessorTaskHandle_t
 

Enumerations

enum  CmdProcessor_Retcode_E
 

Functions

 BCDS_DEPRECATED (Retcode_T CmdProcessor_initialize(CmdProcessor_T *cmdProcessor, char *name, uint32_t taskPriority, uint32_t taskStackDepth, uint32_t queueSize))
 This function initializes the command processor instance. It creates a queue which will carry the command functions and a task which will process the queue. More...
 
 BCDS_DEPRECATED (Retcode_T CmdProcessor_enqueue(CmdProcessor_T *cmdProcessor, CmdProcessor_Func_T func, void *param1, uint32_t param2))
 This routine is used to hand-over a function to the command processor for execution. The function is added to the queue which is processed in a FIFO manner. More...
 
 BCDS_DEPRECATED (void CmdProcessor_suspend(CmdProcessor_T *cmdProcessor))
 The API suspends the command processor service. It is used to stop the execution of the command processor task functionality. More...
 
Retcode_T CmdProcessor_Enqueue (CmdProcessor_T *cmdProcessor, CmdProcessor_Func_T func, void *param1, uint32_t param2)
 This routine is used to hand-over a function to the command processor for execution. The function is added to the queue which is processed in a FIFO manner. More...
 
Retcode_T CmdProcessor_EnqueueFromIsr (CmdProcessor_T *cmdProcessor, CmdProcessor_Func_T func, void *param1, uint32_t param2)
 This routine is used to hand-over a function to the command processor from ISR context. The function is added to the queue which is processed in a FIFO manner. More...
 
Retcode_T CmdProcessor_Initialize (CmdProcessor_T *cmdProcessor, char *name, uint32_t taskPriority, uint32_t taskStackDepth, uint32_t queueSize)
 This function initializes the command processor instance. It creates a queue which will carry the command functions and a task which will process the queue. More...
 
void CmdProcessor_Resume (CmdProcessor_T *cmdProcessor)
 The API resumes the command processor service. It is used to execute the suspended command processor task functionality. More...
 
void CmdProcessor_Suspend (CmdProcessor_T *cmdProcessor)
 The API suspends the command processor service. It is used to stop the execution of the command processor task functionality. More...
 

Detailed Description

Command processor module has a task, to executes the next function from the queue. This function is enqueued by the application using the command enqueue function

Example usage:

// function to load in queue
void AppFunc(void * , uint32_t param)
{
// do some functionality
}
int main(void)
{
// Intialize the command processor
CmdProcessor_Initialize(&cmdprocessor,"<taskname>",priority, stack_size,queue_size);
//create a timer task
OS_timerCreate(timer, 10,pdTRUE ,NULL, vTimerCallback);
}
// Timer call back function to load application function in queue
void vTimerCallback( OS_timerHandle_tp pxTimer )
{
CmdProcessor_enqueue(&CmdProcessor,&AppFunc, NULL, NULL);
}

Data Structure Documentation

struct _CmdProcessor_S

Macro Definition Documentation

#define CMDPROCESSOR_MAX_NAME_LEN   UINT32_C(32)

Maximum length of command processor task name including 0 termination char

Typedef Documentation

typedef void(* CmdProcessor_Func_T)(void *param1, uint32_t param2)
Note
The return value of the command processor function is void. Exceptions must be handled within the function itself.
Parameters
[in]*param1- a generic pointer to any context data structure which will be passed to the function when it is invoked by the command processor.
[in]param2- a generic 32 bit value which will be passed to the function when it is invoked by the command processor..

The Command Processor handle data type. The structure itself is hidden in the source file.

typedef void* cmdProcessorTaskHandle_t

Enumeration Type Documentation

enums to represent the return status of a command processor

Enumerator
CMDPROCESSOR_RETCODE_QUEUE_FULL 
CMDPROCESSOR_RETCODE_QUEUE_ERROR 

Function Documentation

BCDS_DEPRECATED ( Retcode_T   CmdProcessor_initializeCmdProcessor_T *cmdProcessor, char *name, uint32_t taskPriority, uint32_t taskStackDepth, uint32_t queueSize)
Deprecated:
since version vxx.xx.xx, replaced by CmdProcessor_Initialize
CmdProcessor_T *cmdProcessor = CmdProcessor_getSingleton();
CmdProcessor_Initialize(&cmdProcessor, "AppCmdProcessor", ...);
Note
Please take care while assigning the priority to command processor task, it should be less than scheduler timer task priority. Command processor does not support the delegation from ISR because it falls under the application tasks and application task should be operated at least priority compare to ISR and RTOS(timer service).
Parameters
[in]cmdProcessor- contains the queue and task handles
[in]name- represents the task name
[in]taskPriority- represents the task priority
[in]taskStackDepth- Represents the stack Size for the task
[in]queueSize- Represents the queue Size
Return values
RETCODE_OKwhen the queue is created successfully
RETCODE_NULL_POINTERwhen the task or queue is not created
BCDS_DEPRECATED ( Retcode_T   CmdProcessor_enqueueCmdProcessor_T *cmdProcessor, CmdProcessor_Func_T func, void *param1, uint32_t param2)

This routine is used to hand-over a function to the command processor from ISR context. The function is added to the queue which is processed in a FIFO manner.

Deprecated:
since version vxx.xx.xx, replaced by CmdProcessor_Enqueue
Warning
This routine should be called after CmdProcessor_Initialize function. Hand-over Function prototype should be same as cmdprocess_fun_t
Parameters
[in]cmdProcessor- contains the queue handle
[in]func- represents the function
[in]param1- a generic pointer to an arbitrary context data structure which will be passed to the function when it is invoked by the command processor.
[in]param2- second argument of the function
Return values
RETCODE_OKwhen the function is pushed successfully into the queue
RETCODE_INVALID_PARAMwhen cmdProcessor or function pointers is NULL
RETCODE_FAILUREwhen the queue is full
Deprecated:
since version vxx.xx.xx, replaced by CmdProcessor_EnqueueFromIsr
Warning
This routine should be called after cmdprocessor_intitialize function. Hand-over Function prototype should be same as cmdprocess_fun_t
Parameters
[in]cmdProcessor- contains the queue handle
[in]func- represents the function
[in]param1- a generic pointer to an arbitrary context data structure which will be passed to the function when it is invoked by the command processor.
[in]param2- second argument of the function
Return values
RETCODE_OKwhen the function is pushed successfully into the queue
RETCODE_INVALID_PARAMwhen cmdProcessor or function pointers is NULL
RETCODE_FAILUREwhen the queue is full
BCDS_DEPRECATED ( void   CmdProcessor_suspendCmdProcessor_T *cmdProcessor)

The API resumes the command processor service. It is used to execute the suspended command processor task functionality.

Deprecated:
since version vxx.xx.xx, replaced by CmdProcessor_Suspend
Parameters
[in]cmdProcessor- Holds the command processor task handle
Deprecated:
since version vxx.xx.xx, replaced by CmdProcessor_Resume
Parameters
[in]cmdProcessor- Holds the command processor task handle
Retcode_T CmdProcessor_Enqueue ( CmdProcessor_T cmdProcessor,
CmdProcessor_Func_T  func,
void *  param1,
uint32_t  param2 
)
Warning
This routine should be called after cmdprocessor_intitialize function. Hand-over Function prototype should be same as cmdprocess_fun_t
Parameters
[in]cmdProcessor- contains the queue handle
[in]func- represents the function
[in]param1- a generic pointer to an arbitrary context data structure which will be passed to the function when it is invoked by the command processor.
[in]param2- second argument of the function
Return values
RETCODE_OKwhen the function is pushed successfully into the queue
RETCODE_INVALID_PARAMwhen cmdProcessor or function pointers is NULL
RETCODE_FAILUREwhen the queue is full

+ Here is the caller graph for this function:

Retcode_T CmdProcessor_EnqueueFromIsr ( CmdProcessor_T cmdProcessor,
CmdProcessor_Func_T  func,
void *  param1,
uint32_t  param2 
)
Warning
This routine should be called after cmdprocessor_intitialize function. Hand-over Function prototype should be same as cmdprocess_fun_t
Parameters
[in]cmdProcessor- contains the queue handle
[in]func- represents the function
[in]param1- a generic pointer to an arbitrary context data structure which will be passed to the function when it is invoked by the command processor.
[in]param2- second argument of the function
Return values
RETCODE_OKwhen the function is pushed successfully into the queue
RETCODE_INVALID_PARAMwhen cmdProcessor or function pointers is NULL
RETCODE_FAILUREwhen the queue is full

+ Here is the caller graph for this function:

Retcode_T CmdProcessor_Initialize ( CmdProcessor_T cmdProcessor,
char *  name,
uint32_t  taskPriority,
uint32_t  taskStackDepth,
uint32_t  queueSize 
)
CmdProcessor_T *cmdProcessor = CmdProcessor_getSingleton();
CmdProcessor_Initialize(&cmdProcessor, "AppCmdProcessor", ...);
Note
Please take care while assigning the priority to command processor task, it should be less than scheduler timer task priority. Command processor does not support the delegation from ISR because it falls under the application tasks and application task should be operated at least priority compare to ISR and RTOS(timer service).
Parameters
[in]cmdProcessor- contains the queue and task handles
[in]name- represents the task name
[in]taskPriority- represents the task priority
[in]taskStackDepth- Represents the stack Size for the task
[in]queueSize- Represents the queue Size
Return values
RETCODE_OKwhen the queue is created successfully
RETCODE_NULL_POINTERwhen the task or queue is not created

+ Here is the caller graph for this function:

void CmdProcessor_Resume ( CmdProcessor_T cmdProcessor)
Parameters
[in]cmdProcessor- Holds the command processor task handle
void CmdProcessor_Suspend ( CmdProcessor_T cmdProcessor)
Parameters
[in]cmdProcessor- Holds the command processor task handle

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:52 by doxygen 1.8.8