module ti.sysbios.family.arm.cc26xx.Alarm

CC26xx Alarm Manager

This module manages Alarms objects. Alarm objects internally create and schedule Clock objects, to expire at specified 64-bit RTC count values. [ more ... ]
C synopsis target-domain sourced in ti/sysbios/family/arm/cc26xx/Alarm.xdc
#include <ti/sysbios/family/arm/cc26xx/Alarm.h>
Functions
Void
Void
Void
UInt64 
Void
Bool 
Void 
Void 
Functions common to all target instances
Functions common to all target modules
Typedefs
typedef Void 
typedef Alarm_Object *
typedef struct
typedef struct
typedef struct
 
DETAILS
This module manages Alarms objects. Alarm objects internally create and schedule Clock objects, to expire at specified 64-bit RTC count values.

Calling Context

Function Hwi Swi Task Main Startup
getCount Y Y Y Y N
Params_init Y Y Y Y Y
construct N N Y Y N
create N N Y Y N
delete N N Y Y N
destruct N N Y Y N
set Y Y Y Y N
setFunc Y Y Y Y N
stop Y Y Y Y N
Definitions:
  • Hwi: API is callable from a Hwi thread.
  • Swi: API is callable from a Swi thread.
  • Task: API is callable from a Task thread.
  • Main: API is callable during any of these phases:
    • During main().
    • During BIOS.startupFxns.
  • Startup: API is callable during xdc.runtime.Startup functions.
 
typedef Alarm_FuncPtr

Instance function prototype

C synopsis target-domain
typedef Void (*Alarm_FuncPtr)(UArg);
 
 
Alarm_getCount()  // module-wide

Get the current RTC count

C synopsis target-domain
UInt64 Alarm_getCount();
 
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Alarm_Module_id();
// Get this module's unique id
 
Bool Alarm_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Alarm_Module_heap();
// The heap from which this module allocates memory
 
Bool Alarm_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Alarm_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Alarm_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct Alarm_Object Alarm_Object;
// Opaque internal representation of an instance object
 
typedef Alarm_Object *Alarm_Handle;
// Client reference to an instance object
 
typedef struct Alarm_Struct Alarm_Struct;
// Opaque client structure large enough to hold an instance object
 
Alarm_Handle Alarm_handle(Alarm_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
Alarm_Struct *Alarm_struct(Alarm_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct Alarm_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
} Alarm_Params;
 
Void Alarm_Params_init(Alarm_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
Runtime Instance Creation

C synopsis target-domain
Alarm_Handle Alarm_create(Alarm_FuncPtr alarmFxn, UArg arg, const Alarm_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void Alarm_construct(Alarm_Struct *structP, Alarm_FuncPtr alarmFxn, UArg arg, const Alarm_Params *params);
// Initialize a new instance object inside the provided structure
ARGUMENTS
alarmFxn — alarm function, of type Alarm_FuncPtr
arg — argument to the alarm function
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
Instance Deletion

C synopsis target-domain
Void Alarm_delete(Alarm_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void Alarm_destruct(Alarm_Struct *structP);
// Finalize the instance object inside the provided structure
 
Alarm_set()  // instance

Set and start an alarm, to expire upon a specified RTC count value

C synopsis target-domain
Bool Alarm_set(Alarm_Handle handle, UInt64 countRTC);
 
ARGUMENTS
handle — handle of a previously-created Alarm instance object
countRTC — 64-bit target RTC count
RETURNS
TRUE if alarm is set, FALSE if countRTC is in the past, or is too soon to trigger the corresponding Clock interrupt
DETAILS
The RTC count will be converted to the closest Clock tick that expires before the specified RTC count.
When the alarm expires, the alarm's function will be called, with the specified argument, from Swi context. The alarm function could complete its processing and return, or it might defer processing by signaling another thread.
The alarm function can be unique to the application, or it might be a common kernel function. For example, to create an alarm that wakes a task that is pended upon a semaphore, the alarm function could be Semaphore_post(), and the argument the handle of a semaphore that the task is pended upon:
  Void yourFunc() {
      ...
      sem = Semaphore_create(0, NULL, NULL);
      ...
      alm = Alarm_create((Alarm_FuncPtr)Semaphore_post, (UArg)sem, NULL,
          NULL);
      ...
      Alarm_set(alm, 0x200000000);
      ...
  }
 
Alarm_setFunc()  // instance

Change an alarm's function and argument

C synopsis target-domain
Void Alarm_setFunc(Alarm_Handle handle, Alarm_FuncPtr fxn, UArg arg);
 
ARGUMENTS
handle — handle of a previously-created Alarm instance object
fxn — alarm function, of type Alarm_FuncPtr
arg — argument to the Alarm function
DETAILS
Replaces an alarm's function and argument, with a new function and argument.
CONSTRAINTS
Cannot change the function and argument of Alarm that has already been started with Alarm_set or Alarm_setTick.
 
Alarm_stop()  // instance

Stop an alarm that has been started with Alarm_set or Alarm_setTick

C synopsis target-domain
Void Alarm_stop(Alarm_Handle handle);
 
ARGUMENTS
handle — handle of a previously-created Alarm instance object
Instance Built-Ins

C synopsis target-domain
Int Alarm_Object_count();
// The number of statically-created instance objects
 
Alarm_Handle Alarm_Object_get(Alarm_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
Alarm_Handle Alarm_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
Alarm_Handle Alarm_Object_next(Alarm_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle Alarm_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *Alarm_Handle_label(Alarm_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String Alarm_Handle_name(Alarm_Handle handle);
// The name of this instance object
 
Configuration settings sourced in ti/sysbios/family/arm/cc26xx/Alarm.xdc
var Alarm = xdc.useModule('ti.sysbios.family.arm.cc26xx.Alarm');
module-wide config parameters
per-instance config parameters
    var params = new Alarm.Params// Instance config-params object;
per-instance creation
    var inst = Alarm.create// Create an instance-object(Void(*)(UArg) alarmFxn, UArg arg, params);
 
 
metaonly config Alarm.common$  // module-wide

Common module configuration parameters

Configuration settings
Alarm.common$ = Types.Common$ undefined;
 
DETAILS
All modules have this configuration parameter. Its name contains the '$' character to ensure it does not conflict with configuration parameters declared by the module. This allows new configuration parameters to be added in the future without any chance of breaking existing modules.
Instance Config Parameters

Configuration settings
var params = new Alarm.Params;
// Instance config-params object
Static Instance Creation

Configuration settings
var params = new Alarm.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = Alarm.create(Void(*)(UArg) alarmFxn, UArg arg, params);
// Create an instance-object
ARGUMENTS
alarmFxn — alarm function, of type Alarm_FuncPtr
arg — argument to the alarm function
params — per-instance config params, or NULL to select default values (target-domain only)
eb — active error-handling block, or NULL to select default policy (target-domain only)
generated on Fri, 10 Jun 2016 23:29:15 GMT