BLE-Stack APIs
3.00.00
|
This module implements the Indirect Call Layer. More...
Modules | |
ICall Constants | |
ICall Data Structures | |
Files | |
file | icall.h |
ICall layer interface. | |
Functions | |
ICall_Errno | ICall_abort (void) |
Aborts. More... | |
void * | ICall_allocMsg (size_t size) |
Allocates memory block for a message. More... | |
void | ICall_createRemoteTasks (void) |
Create remote tasks. More... | |
ICall_Semaphore | ICall_createSemaphore (uint_fast8_t mode, int initcount) |
Creates a semaphore. More... | |
ICall_Errno | ICall_createTask (void(*entryfn)(size_t arg), uint_fast8_t priority, uint_fast16_t stacksize, size_t arg) |
Creates a new RTOS task. More... | |
uint32_t | icall_directAPI (uint8_t service, icall_lite_id_t id,...) |
generic variadic function to translate API id to a functional call in the stack context, More... | |
ICall_Errno | ICall_disableInt (int intnum) |
Disables interrupt. More... | |
ICall_Errno | ICall_disableMInt (void) |
Disables master interrupt and context switching. More... | |
ICall_Errno | ICall_enableInt (int intnum) |
Enables interrupt. More... | |
ICall_Errno | ICall_enableMInt (void) |
Enables master interrupt and context switching. More... | |
ICall_Errno | ICall_enrollService (ICall_ServiceEnum service, ICall_ServiceFunc fn, ICall_EntityID *entity, ICall_SyncHandle *msgSyncHdl) |
Registers a service entity. More... | |
ICall_Errno | ICall_entityId2ServiceId (ICall_EntityID entityId, ICall_ServiceEnum *servId) |
Transforms and entityId into a serviceId. Note that this function is useful in case an application waits for messages from both a server and another application, in which case, the application can only use ICall_fetchMsg , not ICall_fetchServiceMsg because the latter will return ICALL_ERRNO_CORRUPT_MSG when a message sent by the other application is about to be fetched. This function, then, is useful to retrieve service id matching the source entity id in case the source entity id is not that of the other application. More... | |
ICall_Errno | ICall_fetchMsg (ICall_EntityID *src, ICall_EntityID *dest, void **msg) |
Retrieves a message, queued to receive queue of the calling thread. More... | |
ICall_Errno | ICall_fetchServiceMsg (ICall_ServiceEnum *src, ICall_EntityID *dest, void **msg) |
Retrieves a message received at the message queue associated with the calling thread. More... | |
void | ICall_free (void *msg) |
Frees an allocated memory block. More... | |
void | ICall_freeMsg (void *msg) |
Frees the memory block allocated for a message. More... | |
ICall_EntityID | ICall_getEntityId (void) |
Retrieves an entity ID of (arbitrary) one of the entities registered from the calling thread. More... | |
uint_fast8_t | ICall_getLocalMsgEntityId (ICall_ServiceEnum service, ICall_EntityID entity) |
Retrieves an internal ID understood only by a service entity, corresponding to an ICall entity ID. More... | |
uint_fast32_t | ICall_getMaxMSecs (void) |
Gets the maximum timeout period supported by ICall_setTimerMSecs function. More... | |
uint_fast32_t | ICall_getTickPeriod (void) |
Gets the tick period. More... | |
uint_fast32_t | ICall_getTicks (void) |
Gets the current tick counter value. More... | |
void | ICall_init (void) |
Initializes the dispatcher implementation. More... | |
void * | ICall_malloc (uint_least16_t size) |
Allocates a memory block. More... | |
ICall_Errno | ICall_postSemaphore (ICall_Semaphore sem) |
Post on a semaphore. More... | |
ICall_Errno | ICall_pwrConfigACAction (ICall_PwrBitmap_t bitmap) |
Configures power constraint/dependency set/release actions upon activity counter change. More... | |
ICall_Errno | ICall_pwrDispense (ICall_PwrBitmap_t bitmap) |
Releases power constraints and dependencies. More... | |
uint_fast8_t | ICall_pwrGetTransitionState (void) |
Retrieves power transition state. More... | |
uint32_t | ICall_pwrGetXOSCStartupTime (uint_fast32_t timeUntilWakeupInMs) |
bool | ICall_pwrIsStableXOSCHF (void) |
Checks whether HF XOSC is stable. This function must be called after HF XOSC is turned on (through power dependency). More... | |
ICall_Errno | ICall_pwrRegisterNotify (ICall_PwrNotifyFn fn, ICall_PwrNotifyData *obj) |
Registers a power state transition notify function. More... | |
ICall_Errno | ICall_pwrRequire (ICall_PwrBitmap_t bitmap) |
Sets power constraints and dependencies. More... | |
ICall_Errno | ICall_pwrSwitchXOSCHF (void) |
Switch clock source to HF XOSC. This function must be called after HF XOSC is stable. More... | |
bool | ICall_pwrUpdActivityCounter (bool incFlag) |
Increments or decrements power activity counter. More... | |
ICall_Errno | ICall_registerApp (ICall_EntityID *entity, ICall_SyncHandle *msgSyncHdl) |
Registers an application. More... | |
ICall_Errno | ICall_registerISR (int intnum, void(*isrfunc)(void)) |
Registers an interrupt service routine. More... | |
ICall_Errno | ICall_registerISR_Ext (int intnum, void(*isrfunc)(void), int intPriority) |
ICall Register ISR. | |
ICall_EntityID | ICall_searchServiceEntity (ICall_ServiceEnum service) |
Search for a service entity entry. More... | |
ICall_Errno | ICall_send (ICall_EntityID src, ICall_EntityID dest, ICall_MSGFormat format, void *msg) |
Sends a message to an entity. More... | |
ICall_Errno | ICall_sendServiceMsg (ICall_EntityID src, ICall_ServiceEnum dest, ICall_MSGFormat format, void *msg) |
Sends a message to a registered server. More... | |
ICall_Errno | ICall_setTimer (uint_fast32_t ticks, ICall_TimerCback cback, void *arg, ICall_TimerID *id) |
Set up or restart a timer. Note that the timer setup initially by this function may be restarted using ICall_setTimerMSecs function as well. More... | |
ICall_Errno | ICall_setTimerMSecs (uint_fast32_t msecs, ICall_TimerCback cback, void *arg, ICall_TimerID *id) |
Set up or restart a timer. Note that the timer setup initially by this function may be restarted using ICall_setTimer function as well. More... | |
ICall_Errno | ICall_signal (ICall_SyncHandle msgSyncHdl) |
Signals a semaphore. More... | |
void | ICall_stopTimer (ICall_TimerID id) |
Stops a timer. More... | |
uint_fast8_t | ICall_threadServes (ICall_ServiceEnum service) |
Checks whether the calling thread provides the designated service. More... | |
ICall_Errno | ICall_wait (uint_fast32_t milliseconds) |
Waits for a signal to the semaphore associated with the calling thread. More... | |
ICall_Errno | ICall_waitMatch (uint_least32_t milliseconds, ICall_MsgMatchFn matchFn, ICall_ServiceEnum *src, ICall_EntityID *dest, void **msg) |
Waits for and retrieves a message received at the message queue associated with the calling thread, which matches a certain condition. More... | |
ICall_Errno | ICall_waitSemaphore (ICall_Semaphore sem, uint_fast32_t milliseconds) |
Waits on a semaphore. More... | |
This module implements the Indirect Call Layer.
ICall_Errno ICall_abort | ( | void | ) |
Aborts.
This is preferred over C runtime abort function, in an external image since the C runtime abort is only guaranteed in a root image which contains the C runtime entry function that is executed upon startup.
void* ICall_allocMsg | ( | size_t | size | ) |
Allocates memory block for a message.
size | size of the message body in bytes. |
void ICall_createRemoteTasks | ( | void | ) |
Create remote tasks.
The external image information must be stored either in a custom icall_addrs.h header file in an include path when ICALL_FEATURE_SEPARATE_IMGINFO compile flag is not defined, or as a set of external constants.
If ICALL_FEATURE_SEPARATE_IMGINFO compile flag is not defined, the following macros must be defined in the ICallAddrs.h file: ICALL_STACK0_ADDR, ICALL_ADDR_MAPS, ICALL_TASK_PRIORITIES and ICALL_TASK_STACK_SIZES.
If ICALL_FEATURE_SEPARATE_IMGINFO compile flag is defined, the following constants have to be linked into an image that include ICall module: ICall_imgEntries, ICall_imgTaskPriorities, ICall_imgTaskStackSizes and ICall_numImages.
ICall_Semaphore ICall_createSemaphore | ( | uint_fast8_t | mode, |
int | initcount | ||
) |
Creates a semaphore.
mode | Semaphore mode ICALL_SEMAPHORE_MODE_COUNTING, or ICALL_SEMAPHORE_MODE_BINARY |
initcount | initial count value |
ICall_Errno ICall_createTask | ( | void(*)(size_t arg) | entryfn, |
uint_fast8_t | priority, | ||
uint_fast16_t | stacksize, | ||
size_t | arg | ||
) |
Creates a new RTOS task.
entryfn | task entry function. |
priority | task priority as understood by the underlying RTOS |
stacksize | stack size as understood by the underlying RTOS |
arg | argument to pass to the task entry function |
uint32_t icall_directAPI | ( | uint8_t | service, |
icall_lite_id_t | id, | ||
... | |||
) |
generic variadic function to translate API id to a functional call in the stack context,
Maximum number of supported parameters is define in the stack build, can be 4, 8 or 12 parameters (uint32_t).
service | service the API belongs to |
id | Id of the stack API to call. |
... | : all parameters corresponding to the stack API to call. |
ICall_Errno ICall_disableInt | ( | int | intnum | ) |
ICall_Errno ICall_disableMInt | ( | void | ) |
Disables master interrupt and context switching.
ICall_Errno ICall_enableInt | ( | int | intnum | ) |
ICall_Errno ICall_enableMInt | ( | void | ) |
Enables master interrupt and context switching.
ICall_Errno ICall_enrollService | ( | ICall_ServiceEnum | service, |
ICall_ServiceFunc | fn, | ||
ICall_EntityID * | entity, | ||
ICall_SyncHandle * | msgSyncHdl | ||
) |
Registers a service entity.
service | service id of the enrolling service |
fn | handler function which handles function calls to the service. |
entity | pointer to a variable to store the assigned entity id |
msgSyncHdl | pointer to a variable to store the synchronous object handle associated with the calling thread. |
ICall_Errno ICall_entityId2ServiceId | ( | ICall_EntityID | entityId, |
ICall_ServiceEnum * | servId | ||
) |
Transforms and entityId into a serviceId. Note that this function is useful in case an application waits for messages from both a server and another application, in which case, the application can only use ICall_fetchMsg , not ICall_fetchServiceMsg because the latter will return ICALL_ERRNO_CORRUPT_MSG when a message sent by the other application is about to be fetched.
This function, then, is useful to retrieve service id matching the source entity id in case the source entity id is not that of the other application.
entityId | entity id |
servId | pointer to a variable to store the resultant service id |
ICall_Errno ICall_fetchMsg | ( | ICall_EntityID * | src, |
ICall_EntityID * | dest, | ||
void ** | msg | ||
) |
Retrieves a message, queued to receive queue of the calling thread.
src | pointer to a variable to store the sender entity id of the received message. |
dest | pointer to a variable to store the destination entity id of the received message. |
msg | pointer to a pointer variable to store the starting address of a received message body. |
ICall_Errno ICall_fetchServiceMsg | ( | ICall_ServiceEnum * | src, |
ICall_EntityID * | dest, | ||
void ** | msg | ||
) |
Retrieves a message received at the message queue associated with the calling thread.
Note that this function should be used by an application which does not expect any message from non-server entity.
src | pointer to a variable to store the service id of the registered server which sent the retrieved message |
dest | pointer to a variable to store the entity id of the destination of the message. |
msg | pointer to a pointer variable to store the starting address of the message body being retrieved. |
void ICall_free | ( | void * | msg | ) |
Frees an allocated memory block.
msg | pointer to a memory block to free. |
void ICall_freeMsg | ( | void * | msg | ) |
Frees the memory block allocated for a message.
msg | pointer to the start of the message body which was returned from ICall_allocMsg . |
ICall_EntityID ICall_getEntityId | ( | void | ) |
Retrieves an entity ID of (arbitrary) one of the entities registered from the calling thread.
Note that, if multiple entities were registered from the same thread, this function shall arbitrarily pick one of the entities.
uint_fast8_t ICall_getLocalMsgEntityId | ( | ICall_ServiceEnum | service, |
ICall_EntityID | entity | ||
) |
Retrieves an internal ID understood only by a service entity, corresponding to an ICall entity ID.
This function is used when a message body includes a field indicating a software entity and the destination of the message has its own internal message routing mechanism with its own entity enumeration system.
service | Service enumeration value for the service. Currently ICALL_SERVICE_CLASS_BLE_MSG is supported. |
entity | ICall entity ID. |
uint_fast32_t ICall_getMaxMSecs | ( | void | ) |
Gets the maximum timeout period supported by ICall_setTimerMSecs function.
uint_fast32_t ICall_getTickPeriod | ( | void | ) |
Gets the tick period.
uint_fast32_t ICall_getTicks | ( | void | ) |
Gets the current tick counter value.
void ICall_init | ( | void | ) |
Initializes the dispatcher implementation.
void* ICall_malloc | ( | uint_least16_t | size | ) |
Allocates a memory block.
size | size of the block in bytes. |
ICall_Errno ICall_postSemaphore | ( | ICall_Semaphore | sem | ) |
Post on a semaphore.
sem | semaphore. |
ICall_Errno ICall_pwrConfigACAction | ( | ICall_PwrBitmap_t | bitmap | ) |
Configures power constraint/dependency set/release actions upon activity counter change.
When activity counter value drops to zero, all constraints and dependencies configured by this function shall be released.
When activity counter value increments to one, all constraints and dependencies configured by this function shall be set.
bitmap | a bitmap of constraint or dependency flags. The flag definition is specific to each platform. For instance, see ICallCC26xxDefs.h. |
ICall_Errno ICall_pwrDispense | ( | ICall_PwrBitmap_t | bitmap | ) |
Releases power constraints and dependencies.
bitmap | a bitmap of constraint or dependency flags. The flag definition is specific to each platform. For instance, see ICallCC26xxDefs.h. |
uint_fast8_t ICall_pwrGetTransitionState | ( | void | ) |
Retrieves power transition state.
uint32_t ICall_pwrGetXOSCStartupTime | ( | uint_fast32_t | timeUntilWakeupInMs | ) |
Gets the estimated crystal oscillator startup time.
bool ICall_pwrIsStableXOSCHF | ( | void | ) |
Checks whether HF XOSC is stable. This function must be called after HF XOSC is turned on (through power dependency).
ICall_Errno ICall_pwrRegisterNotify | ( | ICall_PwrNotifyFn | fn, |
ICall_PwrNotifyData * | obj | ||
) |
Registers a power state transition notify function.
The registered notify function shall be called when the power state changes.
fn | notify function pointer |
obj | pointer to data object to be passed to notify function. This pointer must not be NULL and can point to an aggregate type containing the ICall_PwrNotifyData. The object must not be released. |
ICall_Errno ICall_pwrRequire | ( | ICall_PwrBitmap_t | bitmap | ) |
Sets power constraints and dependencies.
bitmap | a bitmap of constraint or dependency flags. The flag definition is specific to each platform. For instance, see ICallCC26xxDefs.h. |
ICall_Errno ICall_pwrSwitchXOSCHF | ( | void | ) |
Switch clock source to HF XOSC. This function must be called after HF XOSC is stable.
bool ICall_pwrUpdActivityCounter | ( | bool | incFlag | ) |
Increments or decrements power activity counter.
When power activity counter is greater than zero, the device shall stay in the active power state. The caller has to make sure that it decrements the counter as many times as it has incremented the counter when there is no activity that requires the active power state. It is recommended that each client increments the counter by just one, but it is not mandated to be so.
incFlag | TRUE to indicate incrementing the counter. FALSE to indicate decrementing the counter. |
ICall_Errno ICall_registerApp | ( | ICall_EntityID * | entity, |
ICall_SyncHandle * | msgSyncHdl | ||
) |
Registers an application.
entity | pointer to a variable to store entity id assigned to the application. |
msgSyncHdl | pointer to a variable to store the synchronous object handle associated with the calling thread. |
ICall_Errno ICall_registerISR | ( | int | intnum, |
void(*)(void) | isrfunc | ||
) |
Registers an interrupt service routine.
intnum | interrupt number |
isrfunc | pointer to the interrupt service function |
ICall_EntityID ICall_searchServiceEntity | ( | ICall_ServiceEnum | service | ) |
Search for a service entity entry.
service | service id |
ICall_Errno ICall_send | ( | ICall_EntityID | src, |
ICall_EntityID | dest, | ||
ICall_MSGFormat | format, | ||
void * | msg | ||
) |
Sends a message to an entity.
src | entity id of the sender |
dest | entity id of the destination of the message. |
format | message format. See ICall_sendServiceMsg . |
msg | pointer to the message body. |
ICall_Errno ICall_sendServiceMsg | ( | ICall_EntityID | src, |
ICall_ServiceEnum | dest, | ||
ICall_MSGFormat | format, | ||
void * | msg | ||
) |
Sends a message to a registered server.
src | Entity id of the sender of the message |
dest | Service id |
format | Message format: ICALL_MSG_FORMAT_KEEP, ICALL_MSG_FORMAT_1ST_CHAR_TASK_ID or ICALL_MSG_FORMAT_3RD_CHAR_TASK_ID. Message format indicates whether and which field of the message must be transformed into a implementation specific sender identity for an external image. When a service message interface is defined, it may contain a field that is not understood by the client but only understood by the system on the server's side. The format provides an information to the messaging system on such a server so that it can generically tag necessary information to the message. |
msg | pointer to the message body to send. Note that if message is successfully sent, the caller should not reference the message any longer. However, if the function fails, the caller still owns the reference to the message. That is, caller may attempt another send, or may free the memory block, etc. |
ICall_Errno ICall_setTimer | ( | uint_fast32_t | ticks, |
ICall_TimerCback | cback, | ||
void * | arg, | ||
ICall_TimerID * | id | ||
) |
Set up or restart a timer. Note that the timer setup initially by this function may be restarted using ICall_setTimerMSecs function as well.
ticks | timeout period in ticks after which the callback function shall be called. |
cback | callback function pointer |
arg | argument to pass to the callback function |
id | pointer to the timer ID. If a new timer must be set up, the value of the timer ID must be set to ICALL_INVALID_TIMER_ID when making this call and when the function returns successfully, the variable will be assigned a new timer ID value. The value other than ICALL_INVALID_TIMER_ID shall be regarded as a request to restart the earlier set timer. |
ICall_Errno ICall_setTimerMSecs | ( | uint_fast32_t | msecs, |
ICall_TimerCback | cback, | ||
void * | arg, | ||
ICall_TimerID * | id | ||
) |
Set up or restart a timer. Note that the timer setup initially by this function may be restarted using ICall_setTimer function as well.
msecs | timeout period in milliseconds after which callback function shall be called. |
cback | callback function pointer |
arg | argument to pass to the callback function |
id | pointer to the timer ID. If a new timer must be set up, the value of the timer ID must be set to ICALL_INVALID_TIMER_ID when making this call and when the function returns successfully, the variable will be assigned a new timer ID value. The value other than ICALL_INVALID_TIMER_ID shall be regarded as a request to restart the earlier set timer. |
ICall_Errno ICall_signal | ( | ICall_SyncHandle | msgSyncHdl | ) |
Signals a semaphore.
msgSyncHdl | handle of a synchronous object to signal |
void ICall_stopTimer | ( | ICall_TimerID | id | ) |
Stops a timer.
id | timer ID. |
uint_fast8_t ICall_threadServes | ( | ICall_ServiceEnum | service | ) |
Checks whether the calling thread provides the designated service.
service | Service enumeration value for the service. |
ICall_Errno ICall_wait | ( | uint_fast32_t | milliseconds | ) |
Waits for a signal to the semaphore associated with the calling thread.
Note that the semaphore associated with a thread is signaled when a message is queued to the message receive queue of the thread or when ICall_signal function is called onto the semaphore.
milliseconds | timeout period in milliseconds. |
ICall_Errno ICall_waitMatch | ( | uint_least32_t | milliseconds, |
ICall_MsgMatchFn | matchFn, | ||
ICall_ServiceEnum * | src, | ||
ICall_EntityID * | dest, | ||
void ** | msg | ||
) |
Waits for and retrieves a message received at the message queue associated with the calling thread, which matches a certain condition.
milliseconds | timeout period in milliseconds. |
matchFn | pointer to a function that would return TRUE when the message matches its condition. |
src | pointer to a variable to store the service id of the registered server which sent the retrieved message, or NULL if not interested in storing service id. |
dest | pointer to a variable to store the entity id of the destination of the message, of NULL if not interested in storing the destination entity id. |
msg | pointer to a pointer variable to store the starting address of the message body being retrieved. The pointer must not be NULL. |
ICall_Errno ICall_waitSemaphore | ( | ICall_Semaphore | sem, |
uint_fast32_t | milliseconds | ||
) |
Waits on a semaphore.
sem | semaphore. |
milliseconds | timeout in milliseconds or ICALL_TIMEOUT_FOREVER to wait forever |