DMM Mode Manager Scheduler

Dual Mode Manager Scheduler.

The DMMSch interface provides a service to adjust the timing of RF commands to meet the needs of multiple stacks. The stacks will call into a jump table for the RF commands, and any RF API’s pertinent to the timing of a command will be remapped to a DMMSch alternative.

The adjustment of timing will be done based on a policy set by the DMM Policy Manager, which will be set by passing a policy structure.

Usage

To use the DMMSch module to schedule a tacks RF commands, the application calls the following APIs:

  • DMMSch_init(): Initialize the DMMSch module/task.
  • DMMSch_Params_init(): Initialize a DMMSch_Params structure with default values. Then change the parameters from non-default values as needed.
  • DMMSch_open(): Open an instance of the DMMSch module, passing the initialized parameters.
  • Stack A application - DMMSch_registerClient: Passes the rfMode point so DMMSch can map an RF handle to a stack type (and hance known which policy applies to an RF handle passed in a command)
  • Stack A application - Rf_open -> DMMSch_rfOpen: DMMSch opens an RF client and stores maps the Stack Type to an RF Handle (vie the rfMode passed in DMMSch_registerClient)
  • Stack B application - DMMSch_registerClient: Passes the rfMode point so DMMSch can map an RF handle to a stack type (and hence known which policy applies to an RF handle passed in a command)
  • Stack B application - Rf_open -> DMMSch_rfOpen: DMMSch opens an RF client and stores maps the Stack Type to an RF Handle (vie the rfMode passed in DMMSch_registerClient)
  • Stack A application - Rf_postCmd -> DMMSch_rfPostCmd: DMMSch adjusted timing based on policy
  • Stack B application - Rf_postCmd -> DMMSch_rfPostCmd: DMMSch adjusted timing based on policy

Typedefs

typedef void(* DMMSch_antennaCb_t)(DMMSch_AntennaType antennaType, RF_ClientEvent event)

Antenna swtich callback.

Enums

enum DMMSch_AntennaType

the stack types supported

Values:

DMMSch_AntennaType_Sub1G = 0

Antenna is Sub1G.

DMMSch_AntennaType_2_4G

Antenna is Sub1G.

Functions

void DMMSch_Params_init(DMMSch_Params * params)

Function to initialize the DMMSch_Params struct to its defaults.

Defaults values are:

Parameters
  • params: An pointer to RF_Params structure for initialization

void DMMSch_init(void)

Function that initializes the DMMSch module.

void DMMSch_open(DMMSch_Params * params)

Function to open the DMMSch module.

Parameters
  • params: An pointer to RF_Params structure for initialization

void DMMSch_updatePolicy(DMMPolicy_PolicyTableEntry policy)

Updates the policy used to make scheduling decisions.

Parameters
  • policy: A new policy

void DMMSch_registerClient(Task_Handle * pTaskHndl, DMMPolicy_StackType stackType, DMMSch_AntennaType antennaType)

Register an DMM Scheduler client.

Parameters
  • pTaskHndl: Task handle that the stack is running in, used to map the RF Client handle to a Stack type
  • stackType: Stack type associated with Task handle
  • antennaType: Antenna type associated with Task handle

RF_Handle DMMSch_rfOpen(RF_Object * pObj, RF_Mode * pRfMode, RF_RadioSetup * pOpSetup, RF_Params * params)

Intercepts calls from a stack to RF_postCmd (re-mapped to DMMSch_rfOpen), The DMMSch module uses this to tie.

Parameters
  • params: An pointer to RF_Params structure for initialization

RF_CmdHandle DMMSch_rfPostCmd(RF_Handle h, RF_Op * pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent)

Handles calls from a stack to RF_postCmd (re-mapped to DMMSch_postCmd), adjusts timing as necessary and schedules then accordingly with RF_scheduleCmd.

See
RF_pendCmd(), RF_runCmd(), RF_scheduleCmd(), RF_RF_cancelCmd(), RF_flushCmd(), RF_getCmdOp()
Return
A handle to the RF command. Return value of RF_ALLOC_ERROR indicates error.
Parameters
  • h: Driver handle previously returned by RF_open()
  • pOp: Pointer to the RF operation command.
  • ePri: Priority of this RF command (used for arbitration in multi-client systems)
  • pCb: Callback function called during command execution and upon completion. If RF_postCmd() fails, no callback is made.
  • bmEvent: Bitmask of events that will trigger the callback or that can be pended on.

RF_CmdHandle DMMSch_rfScheduleCmd(RF_Handle h, RF_Op * pOp, RF_ScheduleCmdParams * pSchParams, RF_Callback pCb, RF_EventMask bmEvent)

Handles calls from a stack to RF_scheduleCmd (re-mapped to DMMSch_scheduleCmd), adjusts timing as necessary and schedules then accordingly with RF_scheduleCmd.

Return
A handle to the RF command. Return value of RF_ALLOC_ERROR indicates error.
Parameters
  • h: Handle previously returned by RF_open()
  • pOp: Pointer to the RF_Op. Must normally be in persistent and writeable memory
  • pSchParams: Pointer to the schedule command parameter structure
  • pCb: Callback function called upon command completion (and some other events). If RF_scheduleCmd() fails no callback is made
  • bmEvent: Bitmask of events that will trigger the callback.

RF_EventMask DMMSch_rfRunCmd(RF_Handle h, RF_Op * pOp, RF_Priority ePri, RF_Callback pCb, RF_EventMask bmEvent)

Handles calls from a stack to RF_runCmd (re-mapped to DMMSch_runCmd), adjusts timing as necessary and schedules then accordingly with RF_scheduleCmd.

Return
The relevant termination event.
Parameters
  • h: Driver handle previously returned by RF_open()
  • pOp: Pointer to the RF operation command.
  • ePri: Priority of this RF command (used for arbitration in multi-client systems)
  • pCb: Callback function called during command execution and upon completion. If RF_runCmd() fails, no callback is made.
  • bmEvent: Bitmask of events that will trigger the callback or that can be pended on.

RF_EventMask DMMSch_rfRunScheduleCmd(RF_Handle h, RF_Op * pOp, RF_ScheduleCmdParams * pSchParams, RF_Callback pCb, RF_EventMask bmEvent)

Handles calls from a stack to RF_runScheduleCmd (re-mapped to DMMSch_runScheduleCmd), adjusts timing as necessary and schedules then accordingly with RF_scheduleCmd.

Return
The relevant command completed event.
Parameters
  • h: Handle previously returned by RF_open()
  • pOp: Pointer to the RF_Op. Must normally be in persistent and writeable memory
  • pSchParams: Pointer to the schdule command parameter structure
  • pCb: Callback function called upon command completion (and some other events). If RF_runScheduleCmd() fails, no callback is made.
  • bmEvent: Bitmask of events that will trigger the callback.

RF_Stat DMMSch_rfCancelCmd(RF_Handle h, RF_CmdHandle ch, uint8_t mode)

Abort/stop/cancel single command in command queue.

If command is running, aborts/stops it and posts callback for the aborted/stopped command. If command has not yet run, cancels it it and posts callback for the cancelled command. If command has already run or been aborted/stopped/cancelled, has no effect. If RF_cancelCmd is called from a Swi context with same or higher priority than RF Driver Swi, when the RF core is powered OFF -> the cancel callback will be delayed until the next power-up cycle.

Note
Calling context : Task/SWI
Return
RF_Stat indicates if command was successfully completed
Parameters
  • h: Handle previously returned by RF_open()
  • ch: Command handle previously returned by RF_postCmd().
  • mode: 1: Stop gracefully, 0: abort abruptly

RF_Stat DMMSch_rfFlushCmd(RF_Handle h, RF_CmdHandle ch, uint8_t mode)

Abort/stop/cancel command and any subsequent commands in command queue.

If command is running, aborts/stops it and then cancels all later commands in queue. If command has not yet run, cancels it and all later commands in queue. If command has already run or been aborted/stopped/cancelled, has no effect. The callbacks for all cancelled commands are issued in chronological order. If RF_flushCmd is called from a Swi context with same or higher priority than RF Driver Swi, when the RF core is powered OFF -> the cancel callback will be delayed until the next power-up cycle.

Note
Calling context : Task/SWI
Return
RF_Stat indicates if command was successfully completed
Parameters
  • h: Handle previously returned by RF_open()
  • ch: Command handle previously returned by RF_postCmd().
  • mode: 1: Stop gracefully, 0: abort abruptly

RF_Stat DMMSch_rfRunImmediateCmd(RF_Handle h, uint32_t * pCmdStruct)

Send any Immediate command.

Immediate Comamnd is send to RDBELL, if radio is active and the RF_Handle points to the current client. In other appropriate RF_Stat values are returned.

Note
Calling context : Task/SWI/HWI
Return
RF_Stat indicates if command was successfully completed
Parameters
  • h: Handle previously returned by RF_open()
  • pCmdStruct: Pointer to the immediate command structure

RF_Stat DMMSch_rfRunDirectCmd(RF_Handle h, uint32_t cmd)

Send any Direct command.

Direct Comamnd value is send to RDBELL immediately, if radio is active and the RF_Handle point to the current client. In other appropriate RF_Stat values are returned.

Note
Calling context : Task/SWI/HWI
Return
RF_Stat indicates if command was successfully completed.
Parameters
  • h: Handle previously returned by RF_open()
  • cmd: Direct command value.

struct DMMSch_Params
#include <dmm_scheduler.h>

RF parameter struct DMM Scheduler parameters are used with the DMMSch_open() and DMMSch_Params_init() call.

Public Members

DMMSch_antennaCb_t antennaCb