module ti.sysbios.family.c28.Timer

Timer peripherals manager for the c28 family

28x Timers

more ... ]
C synopsis target-domain sourced in ti/sysbios/family/c28/Timer.xdc
#include <ti/sysbios/family/c28/Timer.h>
Functions
Void
Void
Void
UInt16 
UInt16 
Void
Void 
Functions common to all ITimer modules
UInt32 
Void 
UInt 
UInt32 
Void 
Void 
Bool 
Void 
Void 
Functions common to all target instances
Functions common to all target modules
Defines
#define
#define
#define
Typedefs
typedef struct
typedef Void 
typedef Timer_Object *
typedef struct
typedef struct
typedef enum
typedef enum
typedef enum
typedef enum
typedef struct
Constants
extern const UInt 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Assert_Id 
extern const Error_Id 
 
DETAILS

28x Timers

  • The 28x has three 32-bit timers.
  • The 28x timer counts downward from 'period' to 0; however, Timer_getCount will count upward.
  • The 28x timer supports an optional 16-bit prescalar. The prescalar effectively sets the period of the timer tick; the prescalar counts down from the prescale factor to 0, then a timer tick occurs. So, with a prescale set, the actual timer period is (prescale * period).

Calling Context

Function Hwi Swi Task Main Startup
getNumTimers Y Y Y Y N
getStatus Y Y Y Y N
Params_init Y Y Y Y N
construct Y Y Y Y N
create N N Y Y N
delete N N Y Y N
destruct Y Y Y Y N
getCount Y Y Y N N
getFreq Y Y Y Y N
getPeriod Y Y Y Y N
getPrescale Y Y Y Y N
getPrescaleCount Y Y Y Y N
setPeriod Y Y Y Y N
setPeriodMicroSecs Y Y Y Y N
setPrescale Y Y Y Y N
start Y Y Y N N
stop Y Y Y N 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:
    • In your module startup after this module is started (e.g. Timer_Module_startupDone() returns TRUE).
    • During xdc.runtime.Startup.lastFxns.
    • During main().
    • During BIOS.startupFxns.
  • Startup: API is callable during any of these phases:
    • During xdc.runtime.Startup.firstFxns.
    • In your module startup before this module is started (e.g. Timer_Module_startupDone() returns FALSE).
const Timer_ANY

Const used to specify any timer

C synopsis target-domain
#define Timer_ANY (UInt)~0
const Timer_MAX_PERIOD

Max value of Timer period for PeriodType_COUNTS

C synopsis target-domain
#define Timer_MAX_PERIOD (UInt)0xffffffff
const Timer_NUM_TIMER_DEVICES

Number of timer peripherals on chip

C synopsis target-domain
#define Timer_NUM_TIMER_DEVICES (Int)3
enum Timer_PeriodType

PeriodType

C synopsis target-domain
typedef enum Timer_PeriodType {
    Timer_PeriodType_MICROSECS,
    // period in microsecs
    Timer_PeriodType_COUNTS
    // period in counts
} Timer_PeriodType;
VALUES
PeriodType_MICROSECS — Period value is in microseconds.
PeriodType_COUNTS — Period value is in counts.
enum Timer_RunMode

Timer Run Modes

C synopsis target-domain
typedef enum Timer_RunMode {
    Timer_RunMode_CONTINUOUS,
    // periodic and continuous
    Timer_RunMode_ONESHOT
    // one-shot
} Timer_RunMode;
VALUES
RunMode_CONTINUOUS — Timer is periodic and runs continuously.
RunMode_ONESHOT — Timer runs for a single period value and stops
enum Timer_StartMode

Timer Start Modes

C synopsis target-domain
typedef enum Timer_StartMode {
    Timer_StartMode_AUTO,
    // timer starts automatically
    Timer_StartMode_USER
    // timer will be started by user
} Timer_StartMode;
VALUES
StartMode_AUTO — Statically created/constructed Timers will be started in BIOS_start(). Dynamically created Timers will start at create() time. This includes timers created before BIOS_start().
StartMode_USER — Timer will be started by the user using start().
enum Timer_Status

Timer Status

C synopsis target-domain
typedef enum Timer_Status {
    Timer_Status_INUSE,
    // timer in use
    Timer_Status_FREE
    // timer is free
} Timer_Status;
VALUES
Status_INUSE — Timer is in use. A timer is marked in use from the time it gets created to the time it gets deleted.
Status_FREE — Timer is free and can be acquired using create.
typedef Timer_FuncPtr

Timer tick function prototype

C synopsis target-domain
typedef Void (*Timer_FuncPtr)(UArg);
struct Timer_EmulationMode

Timer Emulation Mode

C synopsis target-domain
typedef struct Timer_EmulationMode {
    UInt free;
    // At sw breakpoint, stop or free-run the timer
    UInt soft;
    // At sw breakpoint, hard stop or run down timer
} Timer_EmulationMode;
config Timer_A_invalidHwiMask  // module-wide

Assert raised in Timer_create when Hwi Params does not mask 'self'

C synopsis target-domain
extern const Assert_Id Timer_A_invalidHwiMask;
DETAILS
This is not allowed because the timers on this platform do not inherently support one-shot mode. Instead, a stub is used to stop the timer, so it is important that the timer interrupt not occur again before the stub has stopped the timer.
config Timer_A_invalidRunMode  // module-wide

Assert raised in Timer_create if an invalid RunMode is requested

C synopsis target-domain
extern const Assert_Id Timer_A_invalidRunMode;
config Timer_A_invalidTimer  // module-wide

Assert raised in Timer_create when timer id specified is not supported

C synopsis target-domain
extern const Assert_Id Timer_A_invalidTimer;
config Timer_E_cannotSupport  // module-wide

Assert raised when period requested is not supported

C synopsis target-domain
extern const Assert_Id Timer_E_cannotSupport;
config Timer_E_notAvailable  // module-wide

Error raised in Timer_create when timer requested is in use

C synopsis target-domain
extern const Error_Id Timer_E_notAvailable;
config Timer_anyMask  // module-wide

Available mask to be used when select = Timer_ANY

C synopsis target-domain
extern const UInt Timer_anyMask;
Timer_getNumTimers()  // module-wide

Returns number of timer peripherals on the platform

C synopsis target-domain
UInt Timer_getNumTimers();
RETURNS
Number of timer peripherals.
Timer_getStatus()  // module-wide

Returns timer status (free or in use)

C synopsis target-domain
ITimer_Status Timer_getStatus(UInt id);
RETURNS
timer status
Module-Wide Built-Ins

C synopsis target-domain
Types_ModuleId Timer_Module_id();
// Get this module's unique id
 
Bool Timer_Module_startupDone();
// Test if this module has completed startup
 
IHeap_Handle Timer_Module_heap();
// The heap from which this module allocates memory
 
Bool Timer_Module_hasMask();
// Test whether this module has a diagnostics mask
 
Bits16 Timer_Module_getMask();
// Returns the diagnostics mask for this module
 
Void Timer_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
Instance Object Types

C synopsis target-domain
typedef struct Timer_Object Timer_Object;
// Opaque internal representation of an instance object
 
typedef Timer_Object *Timer_Handle;
// Client reference to an instance object
 
typedef struct Timer_Struct Timer_Struct;
// Opaque client structure large enough to hold an instance object
 
Timer_Handle Timer_handle(Timer_Struct *structP);
// Convert this instance structure pointer into an instance handle
 
Timer_Struct *Timer_struct(Timer_Handle handle);
// Convert this instance handle into an instance structure pointer
Instance Config Parameters

C synopsis target-domain
typedef struct Timer_Params {
// Instance config-params structure
    IInstance_Params *instance;
    // Common per-instance configs
    UArg arg;
    // Argument for tick function. Default is null
    Timer_EmulationMode emulationModeInit;
    // Initial timer emulation mode. Default hard stop
    Types_FreqHz extFreq;
    // Timer frequency
    Hwi_Params *hwiParams;
    // Parameters for the Hwi object created for the Timer ISR
    UInt32 period;
    // Period of tick. Can be specified in timer counts or microseconds. Default is 0
    ITimer_PeriodType periodType;
    // Period Type. Default is PeriodType_MICROSECS
    UInt16 prescale;
    // Prescale factor
    ITimer_RunMode runMode;
    // Timer run mode. Default is RunMode_CONTINUOUS
    ITimer_StartMode startMode;
    // Start mode. Default is StartMode_AUTO
} Timer_Params;
 
Void Timer_Params_init(Timer_Params *params);
// Initialize this config-params structure with supplier-specified defaults before instance creation
config Timer_arg  // instance

Argument for tick function. Default is null

C synopsis target-domain
struct Timer_Params {
      ...
    UArg arg;
config Timer_emulationModeInit  // instance

Initial timer emulation mode. Default hard stop

C synopsis target-domain
struct Timer_Params {
      ...
    Timer_EmulationMode emulationModeInit;
DETAILS
Determines timer state at a software breakpoint. If 'free' is 1, the timer will continue to run, and the value of 'soft' doesn't matter. When 'free' is 0 and 'soft' is 1, the timer runs down to 0 then stops. When 'free' is 0 and 'soft' is 0, the timer halts.
 
  FREE   SOFT     
  0      0      Stop after next timer decrement. (Hard stop) 
  0      1      Stop after timer runs down to 0. (Soft stop) 
  1      x      Continue running the timer. 
  
config Timer_extFreq  // instance

Timer frequency

C synopsis target-domain
struct Timer_Params {
      ...
    Types_FreqHz extFreq;
DETAILS
This parameter is meaningfull only on platforms where the timer clock can be changed. If value is left at zero, then default hookup of timer clock is assumed.
config Timer_hwiParams  // instance

Parameters for the Hwi object created for the Timer ISR

C synopsis target-domain
struct Timer_Params {
      ...
    Hwi_Params *hwiParams;
DETAILS
The mask setting for the Hwi object should include SELF to prevent nested timer interrupts.
config Timer_period  // instance

Period of tick. Can be specified in timer counts or microseconds. Default is 0

C synopsis target-domain
struct Timer_Params {
      ...
    UInt32 period;
DETAILS
The implementation of ITimer will support a period of UInt32 timer counts and use pre-scalars if necessary.
config Timer_periodType  // instance

Period Type. Default is PeriodType_MICROSECS

C synopsis target-domain
struct Timer_Params {
      ...
    ITimer_PeriodType periodType;
config Timer_prescale  // instance

Prescale factor

C synopsis target-domain
struct Timer_Params {
      ...
    UInt16 prescale;
DETAILS
The prescale factor determines the length of a timer tick. If a prescale of 10 is specified, a timer tick will occur every 11 cycles.
If the timer is used as a counter, the prescale factor determines the period between counts. Otherwise, the prescale factor can be used to achieve longer timer periods: with a prescale specified, the actual period is (period * prescale+1).
config Timer_runMode  // instance

Timer run mode. Default is RunMode_CONTINUOUS

C synopsis target-domain
struct Timer_Params {
      ...
    ITimer_RunMode runMode;
config Timer_startMode  // instance

Start mode. Default is StartMode_AUTO

C synopsis target-domain
struct Timer_Params {
      ...
    ITimer_StartMode startMode;
Instance Creation

C synopsis target-domain
Timer_Handle Timer_create(Int id, ITimer_FuncPtr tickFxn, const Timer_Params *params, Error_Block *eb);
// Allocate and initialize a new instance object and return its handle
 
Void Timer_construct(Timer_Struct *structP, Int id, ITimer_FuncPtr tickFxn, const Timer_Params *params, Error_Block *eb);
// Initialize a new instance object inside the provided structure
ARGUMENTS
id — Timer id ranging from 0 to a platform specific value
tickFxn — function that runs upon timer expiry.
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)
DETAILS
Create could fail if timer peripheral is unavailable. To request any available timer use ANY as the id. TimerId's are logical ids. The family-specific implementations map the ids to physical peripherals.
Instance Deletion

C synopsis target-domain
Void Timer_delete(Timer_Handle *handleP);
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
 
Void Timer_destruct(Timer_Struct *structP);
// Finalize the instance object inside the provided structure
Timer_getCount()  // instance

Returns the number of counts that have passed

C synopsis target-domain
UInt32 Timer_getCount(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
RETURNS
timer counter value
timer counts, counting upward from 0
DETAILS
The 28x timer counts downward from the period to 0, but getCount subtracts the timer counter value from the period so that getCount counts upward instead of downward.
Timer_getFreq()  // instance

Returns timer frequency in Hz

C synopsis target-domain
Void Timer_getFreq(Timer_Handle handle, Types_FreqHz *freq);
ARGUMENTS
handle — handle of a previously-created Timer instance object
freq — frequency in Hz
DETAILS
This is the effective frequency of the clock incrementing the timer counter register after all scaling factors are taken into account. (including pre-scalars).
Timer_getFunc()  // instance

Get Timer function and arg

C synopsis target-domain
ITimer_FuncPtr Timer_getFunc(Timer_Handle handle, UArg *arg);
ARGUMENTS
handle — handle of a previously-created Timer instance object
arg — pointer for returning Timer's function argument
RETURNS
Timer's function
Timer_getPeriod()  // instance

Gets timer period in timer counts

C synopsis target-domain
UInt32 Timer_getPeriod(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
RETURNS
period in timer counts
Timer_getPrescale()  // instance

Get timer prescale value

C synopsis target-domain
UInt16 Timer_getPrescale(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
RETURNS
prescale value
DETAILS
This is not the prescale count, but the period of the prescalar.
Timer_getPrescaleCount()  // instance

Reads timer prescale counter

C synopsis target-domain
UInt16 Timer_getPrescaleCount(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
RETURNS
prescale counter, counting upward from 0
DETAILS
The prescale counter counts down from prescale to 0, but getPrescaleCount subtracts the counter value from the period so that this function counts upward instead of downward.
Timer_setFunc()  // instance

Overwrite Timer function and arg

C synopsis target-domain
Void Timer_setFunc(Timer_Handle handle, ITimer_FuncPtr fxn, UArg arg);
ARGUMENTS
handle — handle of a previously-created Timer instance object
fxn — pointer to function
arg — argument to function
DETAILS
Replaces a Timer object's tickFxn function originally provided in create.
Timer_setPeriod()  // instance

Sets timer period specified in timer counts

C synopsis target-domain
Void Timer_setPeriod(Timer_Handle handle, UInt32 period);
ARGUMENTS
handle — handle of a previously-created Timer instance object
period — period in timer counts
DETAILS
Timer_setPeriod() invokes Timer_stop() prior to setting the period and leaves the timer in the stopped state.
To dynamically change the period of a timer you must protect against re-entrancy by disabling interrupts. Use the following call sequence to guarantee proper results:
  // disable interrupts if an interrupt could lead to 
  // another call to Timer_start(). 
  key = Hwi_disable(); 
  Timer_setPeriod(period); 
  Timer_start(); 
  Hwi_restore(key); 
ITimer implementation must support UInt32 and use pre-scalars whenever necessary
SIDE EFFECTS
Calls Timer_stop(), and disables the timer's interrupt.
Timer_setPeriodMicroSecs()  // instance

Sets timer period specified in microseconds

C synopsis target-domain
Bool Timer_setPeriodMicroSecs(Timer_Handle handle, UInt32 microsecs);
ARGUMENTS
handle — handle of a previously-created Timer instance object
period — period in microseconds
DETAILS
A best-effort method will be used to set the period register. There might be a slight rounding error based on resolution of timer period register. If the timer frequency cannot support the requested period, ie the timer period register cannot support the requested period, then this function returns false.
Timer_setPeriodMicroSecs() invokes Timer_stop() prior to setting the period and leaves the timer in the stopped state.
To dynamically change the period of a timer you must protect against re-entrancy by disabling interrupts. Use the following call sequence to guarantee proper results:
  // disable interrupts if an interrupt could lead to 
  // another call to Timer_start(). 
  key = Hwi_disable(); 
  Timer_setPeriodMicroSecs(period); 
  Timer_start(); 
  Hwi_restore(key); 
Timer_setPrescale()  // instance

Set timer prescale value

C synopsis target-domain
Void Timer_setPrescale(Timer_Handle handle, UInt16 preScalar);
ARGUMENTS
handle — handle of a previously-created Timer instance object
preScalar — The value to set the prescale period to.
DETAILS
This function sets the value of the prescalar, and will also reload the timer counter and prescale registers.
The prescalar decrements with each timer clock source cycle until it reaches zero, then the timer's count is decremented by one. The prescalar has the effect of setting the rate of the timer tick.
Timer_start()  // instance

Reloads and starts the timer

C synopsis target-domain
Void Timer_start(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
DETAILS
Thread safety must be observed when using the start and stop APIs to avoid possible miss- configuration of the timers and unintended behaviors. To protect against re-entrancy, surround the start/stop invocations with Hwi_disable() and Hwi_restore() calls:
  // disable interrupts if an interrupt could lead to 
  // another call to Timer_start(). 
  key = Hwi_disable(); 
  Timer_stop(); 
  ... 
  Timer_start(); 
  Hwi_restore(key); 
SIDE EFFECTS
Enables the timer's interrupt.
Timer_stop()  // instance

Stop the timer

C synopsis target-domain
Void Timer_stop(Timer_Handle handle);
ARGUMENTS
handle — handle of a previously-created Timer instance object
DETAILS
Thread safety must be observed when using the start and stop APIs to avoid possible miss- configuration of the timers and unintended behaviors. To protect against re-entrancy, surround the start/stop invocations with Hwi_disable() and Hwi_restore() calls:
  // disable interrupts if an interrupt could lead to 
  // another call to Timer_start(). 
  key = Hwi_disable(); 
  Timer_stop(); 
  ... 
  Timer_start(); 
  Hwi_restore(key); 
SIDE EFFECTS
Disables the timer's interrupt.
Instance Convertors

C synopsis target-domain
ITimer_Handle Timer_Handle_upCast(Timer_Handle handle);
// unconditionally move one level up the inheritance hierarchy
 
Timer_Handle Timer_Handle_downCast(ITimer_Handle handle);
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins

C synopsis target-domain
Int Timer_Object_count();
// The number of statically-created instance objects
 
Timer_Handle Timer_Object_get(Timer_Object *array, Int i);
// The handle of the i-th statically-created instance object (array == NULL)
 
Timer_Handle Timer_Object_first();
// The handle of the first dynamically-created instance object, or NULL
 
Timer_Handle Timer_Object_next(Timer_Handle handle);
// The handle of the next dynamically-created instance object, or NULL
 
IHeap_Handle Timer_Object_heap();
// The heap used to allocate dynamically-created instance objects
 
Types_Label *Timer_Handle_label(Timer_Handle handle, Types_Label *buf);
// The label associated with this instance object
 
String Timer_Handle_name(Timer_Handle handle);
// The name of this instance object
 
XDCscript usage meta-domain sourced in ti/sysbios/family/c28/Timer.xdc
var Timer = xdc.useModule('ti.sysbios.family.c28.Timer');
module-wide constants & types
    values of type Timer.PeriodType// PeriodType
    values of type Timer.RunMode// Timer Run Modes
        const Timer.RunMode_ONESHOT// one-shot;
    values of type Timer.StartMode// Timer Start Modes
    values of type Timer.Status// Timer Status
        const Timer.Status_INUSE// timer in use;
        const Timer.Status_FREE// timer is free;
        obj.free// At sw breakpoint, stop or free-run the timer = UInt  ...
        obj.soft// At sw breakpoint, hard stop or run down timer = UInt  ...
module-wide config parameters
        msg: "A_InvalidMask: Mask in hwiParams cannot enable self"
    };
        msg: "A_invalidRunMode: Invalid RunMode"
    };
        msg: "A_invalidTimer: Timer id must be 0-2"
    };
        msg: "E_cannotSupport: Timer cannot support requested period"
    };
        msg: "E_notAvailable: Timer not available %d"
    };
per-instance config parameters
    var params = new Timer.Params// Instance config-params object;
        params.arg// Argument for tick function. Default is null = UArg null;
        free: 0,
        soft: 0
    };
        params.extFreq// Timer frequency = Types.FreqHz {
        lo: 0,
        hi: 0
    };
        params.prescale// Prescale factor = UInt16 0;
per-instance creation
    var inst = Timer.create// Create an instance-object(Int id, Void(*)(UArg) tickFxn, params);
 
const Timer.ANY

Const used to specify any timer

XDCscript usage meta-domain
const Timer.ANY = ~0;
C SYNOPSIS
const Timer.MAX_PERIOD

Max value of Timer period for PeriodType_COUNTS

XDCscript usage meta-domain
const Timer.MAX_PERIOD = 0xffffffff;
C SYNOPSIS
const Timer.NUM_TIMER_DEVICES

Number of timer peripherals on chip

XDCscript usage meta-domain
const Timer.NUM_TIMER_DEVICES = 3;
C SYNOPSIS
enum Timer.PeriodType

PeriodType

XDCscript usage meta-domain
values of type Timer.PeriodType
    const Timer.PeriodType_MICROSECS;
    // period in microsecs
    const Timer.PeriodType_COUNTS;
    // period in counts
VALUES
PeriodType_MICROSECS — Period value is in microseconds.
PeriodType_COUNTS — Period value is in counts.
C SYNOPSIS
enum Timer.RunMode

Timer Run Modes

XDCscript usage meta-domain
values of type Timer.RunMode
    const Timer.RunMode_CONTINUOUS;
    // periodic and continuous
    const Timer.RunMode_ONESHOT;
    // one-shot
VALUES
RunMode_CONTINUOUS — Timer is periodic and runs continuously.
RunMode_ONESHOT — Timer runs for a single period value and stops
C SYNOPSIS
enum Timer.StartMode

Timer Start Modes

XDCscript usage meta-domain
values of type Timer.StartMode
    const Timer.StartMode_AUTO;
    // timer starts automatically
    const Timer.StartMode_USER;
    // timer will be started by user
VALUES
StartMode_AUTO — Statically created/constructed Timers will be started in BIOS_start(). Dynamically created Timers will start at create() time. This includes timers created before BIOS_start().
StartMode_USER — Timer will be started by the user using start().
C SYNOPSIS
enum Timer.Status

Timer Status

XDCscript usage meta-domain
values of type Timer.Status
    const Timer.Status_INUSE;
    // timer in use
    const Timer.Status_FREE;
    // timer is free
VALUES
Status_INUSE — Timer is in use. A timer is marked in use from the time it gets created to the time it gets deleted.
Status_FREE — Timer is free and can be acquired using create.
C SYNOPSIS
struct Timer.EmulationMode

Timer Emulation Mode

XDCscript usage meta-domain
var obj = new Timer.EmulationMode;
 
    obj.free = UInt  ...
    // At sw breakpoint, stop or free-run the timer
    obj.soft = UInt  ...
    // At sw breakpoint, hard stop or run down timer
C SYNOPSIS
config Timer.A_invalidHwiMask  // module-wide

Assert raised in Timer_create when Hwi Params does not mask 'self'

XDCscript usage meta-domain
Timer.A_invalidHwiMask = Assert.Desc {
    msg: "A_InvalidMask: Mask in hwiParams cannot enable self"
};
DETAILS
This is not allowed because the timers on this platform do not inherently support one-shot mode. Instead, a stub is used to stop the timer, so it is important that the timer interrupt not occur again before the stub has stopped the timer.
C SYNOPSIS
config Timer.A_invalidRunMode  // module-wide

Assert raised in Timer_create if an invalid RunMode is requested

XDCscript usage meta-domain
Timer.A_invalidRunMode = Assert.Desc {
    msg: "A_invalidRunMode: Invalid RunMode"
};
C SYNOPSIS
config Timer.A_invalidTimer  // module-wide

Assert raised in Timer_create when timer id specified is not supported

XDCscript usage meta-domain
Timer.A_invalidTimer = Assert.Desc {
    msg: "A_invalidTimer: Timer id must be 0-2"
};
C SYNOPSIS
config Timer.E_cannotSupport  // module-wide

Assert raised when period requested is not supported

XDCscript usage meta-domain
Timer.E_cannotSupport = Assert.Desc {
    msg: "E_cannotSupport: Timer cannot support requested period"
};
C SYNOPSIS
config Timer.E_notAvailable  // module-wide

Error raised in Timer_create when timer requested is in use

XDCscript usage meta-domain
Timer.E_notAvailable = Error.Desc {
    msg: "E_notAvailable: Timer not available %d"
};
C SYNOPSIS
config Timer.anyMask  // module-wide

Available mask to be used when select = Timer_ANY

XDCscript usage meta-domain
Timer.anyMask = UInt 0x7;
C SYNOPSIS
metaonly config Timer.common$  // module-wide

Common module configuration parameters

XDCscript usage meta-domain
Timer.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

XDCscript usage meta-domain
var params = new Timer.Params;
// Instance config-params object
    params.arg = UArg null;
    // Argument for tick function. Default is null
    params.emulationModeInit = Timer.EmulationMode {
    // Initial timer emulation mode. Default hard stop
    free: 0,
    soft: 0
};
    params.extFreq = Types.FreqHz {
    // Timer frequency
    lo: 0,
    hi: 0
};
    params.hwiParams = Hwi.Params* null;
    // Parameters for the Hwi object created for the Timer ISR
    params.period = UInt32 0;
    // Period of tick. Can be specified in timer counts or microseconds. Default is 0
    params.periodType = ITimer.PeriodType ITimer.PeriodType_MICROSECS;
    // Period Type. Default is PeriodType_MICROSECS
    params.prescale = UInt16 0;
    // Prescale factor
    params.runMode = ITimer.RunMode ITimer.RunMode_CONTINUOUS;
    // Timer run mode. Default is RunMode_CONTINUOUS
    params.startMode = ITimer.StartMode ITimer.StartMode_AUTO;
    // Start mode. Default is StartMode_AUTO
config Timer.arg  // instance

Argument for tick function. Default is null

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.arg = UArg null;
C SYNOPSIS
config Timer.emulationModeInit  // instance

Initial timer emulation mode. Default hard stop

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.emulationModeInit = Timer.EmulationMode {
    free: 0,
    soft: 0
};
DETAILS
Determines timer state at a software breakpoint. If 'free' is 1, the timer will continue to run, and the value of 'soft' doesn't matter. When 'free' is 0 and 'soft' is 1, the timer runs down to 0 then stops. When 'free' is 0 and 'soft' is 0, the timer halts.
 
  FREE   SOFT     
  0      0      Stop after next timer decrement. (Hard stop) 
  0      1      Stop after timer runs down to 0. (Soft stop) 
  1      x      Continue running the timer. 
  
C SYNOPSIS
config Timer.extFreq  // instance

Timer frequency

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.extFreq = Types.FreqHz {
    lo: 0,
    hi: 0
};
DETAILS
This parameter is meaningfull only on platforms where the timer clock can be changed. If value is left at zero, then default hookup of timer clock is assumed.
C SYNOPSIS
config Timer.hwiParams  // instance

Parameters for the Hwi object created for the Timer ISR

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.hwiParams = Hwi.Params* null;
DETAILS
The mask setting for the Hwi object should include SELF to prevent nested timer interrupts.
C SYNOPSIS
config Timer.period  // instance

Period of tick. Can be specified in timer counts or microseconds. Default is 0

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.period = UInt32 0;
DETAILS
The implementation of ITimer will support a period of UInt32 timer counts and use pre-scalars if necessary.
C SYNOPSIS
config Timer.periodType  // instance

Period Type. Default is PeriodType_MICROSECS

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
C SYNOPSIS
config Timer.prescale  // instance

Prescale factor

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
params.prescale = UInt16 0;
DETAILS
The prescale factor determines the length of a timer tick. If a prescale of 10 is specified, a timer tick will occur every 11 cycles.
If the timer is used as a counter, the prescale factor determines the period between counts. Otherwise, the prescale factor can be used to achieve longer timer periods: with a prescale specified, the actual period is (period * prescale+1).
C SYNOPSIS
config Timer.runMode  // instance

Timer run mode. Default is RunMode_CONTINUOUS

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
C SYNOPSIS
config Timer.startMode  // instance

Start mode. Default is StartMode_AUTO

XDCscript usage meta-domain
var params = new Timer.Params;
  ...
C SYNOPSIS
Instance Creation

XDCscript usage meta-domain
var params = new Timer.Params;
// Allocate instance config-params
params.config =   ...
// Assign individual configs
 
var inst = Timer.create(Int id, Void(*)(UArg) tickFxn, params);
// Create an instance-object
ARGUMENTS
id — Timer id ranging from 0 to a platform specific value
tickFxn — function that runs upon timer expiry.
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)
DETAILS
Create could fail if timer peripheral is unavailable. To request any available timer use ANY as the id. TimerId's are logical ids. The family-specific implementations map the ids to physical peripherals.
generated on Thu, 03 Feb 2011 19:01:18 GMT