The dmtimer Timer module supports the timer in 'one shot', 'continuous',
and 'dynamic' modes.
In 'one shot' mode, a timer function will "fire" (run) when the timer period
expires (counts up to zero). In 'one shot' mode this will only happen
once.
In 'continuous' mode, the specified timer function will "fire" every
time the period expires, throughout the lifetime of the program. When the
period expires in 'continuous mode', the period is then reset to its
original value and then begins counting up to zero again. At this point
the timer function will fire again and the cycle repeats itself.
In 'dynamic' mode, the specified timer function will "fire" every
time the period expires. But the period of the timer can be changed
dynamically, to correspond to the next tick interrupt needed from the
timer. The timer will continually count upwards, and the timer's compare
mode is used to generate an interrupt when a specific threshold count is
reached. This mode is used by the SYS/BIOS Clock module, for implementing
dynamic tick suppression, which reduces the number of interrupts from the
timer to the minimum required for currently scheduled timeouts.
const Timer_ANY |
|
Const used to specify any timer
#define Timer_ANY (UInt)~0
const Timer_MAX_PERIOD |
|
Max value of Timer period for PeriodType_COUNTS
#define Timer_MAX_PERIOD (UInt)0xffffffff
enum Timer_PeriodType |
|
Timer period units
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
typedef enum Timer_RunMode {
Timer_RunMode_CONTINUOUS,
// periodic and continuous
Timer_RunMode_ONESHOT,
// one-shot
Timer_RunMode_DYNAMIC
// dynamically reprogrammed (available on subset of devices)
} Timer_RunMode;
VALUES
RunMode_CONTINUOUS
Timer is periodic and runs continuously.
RunMode_ONESHOT
Timer runs for a single period value and stops.
RunMode_DYNAMIC
Timer is dynamically reprogrammed for the next required tick. This mode
is intended only for use by the Clock module when it is operating in
TickMode_DYNAMIC; it is not applicable for user-created Timer instances.
enum Timer_StartMode |
|
Timer Start Modes
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
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
typedef Void (*Timer_FuncPtr)(UArg);
struct Timer_Tclr |
|
Control Register (TCLR)
typedef struct Timer_Tclr {
Bits32 ptv;
// Trigger output mode
Bits8 pre;
// Prescalar enable
Bits8 ce;
// Compare enable
Bits8 scpwm;
// Pulse-width modulation
Bits16 tcm;
// Transition capture mode
Bits16 trg;
// Trigger output mode
Bits8 pt;
// Pulse or toggle select bit
Bits8 captmode;
// Capture mode select bit
Bits8 gpocfg;
// PWM output/event detection input pin
} Timer_Tclr;
struct Timer_Tier |
|
Interrupt Enable Register (TIER)
typedef struct Timer_Tier {
Bits8 mat_it_ena;
// Enable match interrupt
Bits8 ovf_it_ena;
// Enable overflow interrupt
Bits8 tcar_it_ena;
// Enable capture interrupt
} Timer_Tier;
struct Timer_TiocpCfg |
|
L4 interface Configuration Register (TIOCP_CFG)
typedef struct Timer_TiocpCfg {
Bits8 idlemode;
// 0=force-idle;1=no-idle;2=Smart-idle;3=Smart-idle
Bits8 emufree;
// 0=counter frozen; 1=counter free-running
Bits8 softreset;
// 0=normal mode; 1=soft reset
} Timer_TiocpCfg;
struct Timer_Tsicr |
|
L4 Interface Synchronization Control Register (TSICR)
typedef struct Timer_Tsicr {
Bits8 sft;
// Reset software functional registers
Bits8 posted;
// Posted mode selection
Bits8 readmode;
// Select posted/non-posted mode for read operation
} Timer_Tsicr;
DETAILS
Note: 'readmode' field is not available on some older Silicon.
Please check the technical reference manual of your device to
determine if this field is available before using it.
struct Timer_Twer |
|
WakepUp Enable Register (TWER)
typedef struct Timer_Twer {
Bits8 mat_wup_ena;
// Enable match wake-up
Bits8 ovf_wup_ena;
// Enable overflow wake-up
Bits8 tcar_wup_ena;
// Enable capture wake-up
} Timer_Twer;
config Timer_A_notAvailable // module-wide |
|
Assert raised when statically created timer is not available
config Timer_E_badIntNum // module-wide |
|
Error raised when intNum not supplied by user or device table
extern const Error_Id Timer_E_badIntNum;
config Timer_E_cannotSupport // module-wide |
|
Error raised when period requested is not supported
extern const Error_Id Timer_E_cannotSupport;
config Timer_E_freqMismatch // module-wide |
|
Error raised when timer frequency does not match expected frequency
extern const Error_Id Timer_E_freqMismatch;
DETAILS
BIOS does not configure the DMTimer clock source and expects this
configuration to be performed via a GEL script or on the host OS. This
error is raised if BIOS detects a mismatch between
intFreq and
the actual operating frequency. The check is performed by comparing
the timestamp operating frequency with the DMTimer frequency.
To change the expected timer frequency to match the actual operating
frequency, use the following example configuration:
var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
Timer.intFreq.lo = 20000000; //For 20Mhz
Timer.intFreq.hi = 0;
This check can be skipped by setting
checkFrequency to FALSE.
config Timer_E_invalidTimer // module-wide |
|
Error raised when timer id specified is not supported
extern const Error_Id Timer_E_invalidTimer;
config Timer_E_notAvailable // module-wide |
|
Error raised when timer requested is in use
extern const Error_Id Timer_E_notAvailable;
config Timer_anyMask // module-wide |
|
Available mask to be used when select = Timer_ANY
extern const Bits32 Timer_anyMask;
DETAILS
Default value is device specific.
config Timer_checkFrequency // module-wide |
|
Whether to check the timer operating frequency at startup
extern const Bool Timer_checkFrequency;
DETAILS
When this flag is set to 'TRUE', the Timer module will verify that the
operating frequency equals the frequency at which BIOS expects the
timers to operate. This check is performed by checking the timer count
rate against the
xdc.runtime.Timestamp count rate.
Timer_getHandle() // module-wide |
|
Get Handle associated with a timer id
ARGUMENTS
id
timer Id
RETURNS
timer handle
Timer_getNumTimers() // module-wide |
|
Returns number of timer peripherals on the platform
UInt Timer_getNumTimers();
RETURNS
Number of timer peripherals.
Timer_getStatus() // module-wide |
|
Returns timer status (free or in use)
RETURNS
timer status
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool Timer_Module_startupDone();
// Test if this module has completed startup
// 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 |
|
typedef struct Timer_Object Timer_Object;
// Opaque internal representation of an instance object
// Client reference to an instance object
typedef struct Timer_Struct Timer_Struct;
// Opaque client structure large enough to hold an instance object
// Convert this instance structure pointer into an instance handle
// Convert this instance handle into an instance structure pointer
Instance Config Parameters |
|
typedef struct Timer_Params {
// Instance config-params structure
// Common per-instance configs
UArg arg;
// Argument for tick function
Int eventId;
// Hwi event Id to be used by Timer
// Timer frequency
// Hwi Params for Hwi Object. Default is null
Int intNum;
// Hwi interrupt number to be used by Timer
UInt32 period;
// Period of a tick
// Period type
// Timer run mode
// Timer start mode
// Initial Timer Control Register bit settings
// Initial Timer IRQSTATUS_SET Register bit settings
// Initial Timer TIOCP_CFG Register bit settings
UInt32 tmar;
// Initial Timer Match Register setting
// Initial Timer Synchronous Interface Control Register bit settings
// Initial Timer IRQ Wakeup Enable Register bit settings
} Timer_Params;
// Initialize this config-params structure with supplier-specified defaults before instance creation
config Timer_Params.arg // instance |
|
Argument for tick function
DETAILS
Default is null.
config Timer_Params.eventId // instance |
|
Hwi event Id to be used by Timer
config Timer_Params.extFreq // instance |
|
Timer frequency
DETAILS
This parameter is meaningfull only on platforms where the timer's
input clock can be changed. If value is left at zero, then input clock
to the timer clock is assumed.
This value is used to convert timer ticks to real time units; seconds,
milliseconds, etc.
config Timer_Params.hwiParams // instance |
|
Hwi Params for Hwi Object. Default is null
config Timer_Params.intNum // instance |
|
Hwi interrupt number to be used by Timer
config Timer_Params.period // instance |
|
Period of a tick
DETAILS
The period can be specified in timer counts or microseconds
and its default value is 0.
The implementation of ITimer will support a period of UInt32
timer counts and use pre-scalars if necessary.
config Timer_Params.periodType // instance |
|
Period type
DETAILS
Default is PeriodType_MICROSECS
config Timer_Params.runMode // instance |
|
Timer run mode
DETAILS
config Timer_Params.startMode // instance |
|
Timer start mode
DETAILS
config Timer_Params.tclr // instance |
|
Initial Timer Control Register bit settings
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
config Timer_Params.tier // instance |
|
Initial Timer IRQSTATUS_SET Register bit settings
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
config Timer_Params.tiocpCfg // instance |
|
Initial Timer TIOCP_CFG Register bit settings
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
config Timer_Params.tmar // instance |
|
Initial Timer Match Register setting
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
config Timer_Params.tsicr // instance |
|
Initial Timer Synchronous Interface Control Register bit settings
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
config Timer_Params.twer // instance |
|
Initial Timer IRQ Wakeup Enable Register bit settings
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
Runtime Instance Creation |
|
// Allocate and initialize a new instance object and return its handle
// Initialize a new instance object inside the provided structure
ARGUMENTS
id
Timer id ranging from 0 to a platform specific value,
or ANY
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 |
|
// Finalize and free this previously allocated instance object, setting the referenced handle to NULL
// Finalize the instance object inside the provided structure
Timer_getCount() // instance |
|
Read timer counter register
ARGUMENTS
handle
handle of a previously-created Timer instance object
RETURNS
timer counter value
Timer_getFreq() // instance |
|
Return timer frequency in Hz
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
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 |
|
Get timer period in timer counts
ARGUMENTS
handle
handle of a previously-created Timer instance object
RETURNS
period in timer counts
Timer_reconfig() // instance |
|
Used to modify static timer instances at runtime
ARGUMENTS
handle
handle of a previously-created Timer instance object
timerParams
timer Params
tickFxn
functions that runs when timer expires
Timer_restoreRegisters() // instance |
|
Restore timer registers to their nominal state following a power down
ARGUMENTS
handle
handle of a previously-created Timer instance object
DETAILS
All registers are restored to their nominal operating state, except
for those registers and bits associated with starting the timer.
Following a power down, the user should do the following to restore
and restart the timer:
Timer_handle timer;
Error_Block eb;
Timer_restoreRegisters(timer, &eb);
Timer_start(timer);
Timer_setFunc() // instance |
|
Overwrite Timer function and 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 |
|
Set timer period specified in timer counts
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 |
|
Set timer period specified in microseconds
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, i.e. 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_start() // instance |
|
Reload and start the timer
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
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 |
|
// unconditionally move one level up the inheritance hierarchy
// conditionally move one level down the inheritance hierarchy; NULL upon failure
Instance Built-Ins |
|
Int Timer_Object_count();
// The number of statically-created instance objects
// The handle of the i-th statically-created instance object (array == NULL)
// The handle of the first dynamically-created instance object, or NULL
// The handle of the next dynamically-created instance object, or NULL
// The heap used to allocate dynamically-created instance objects
// The label associated with this instance object
// The name of this instance object
const Timer.ANY |
|
Const used to specify any timer
C SYNOPSIS
const Timer.MAX_PERIOD |
|
Max value of Timer period for PeriodType_COUNTS
const Timer.MAX_PERIOD = 0xffffffff;
C SYNOPSIS
enum Timer.PeriodType |
|
Timer period units
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
values of type Timer.RunMode
const Timer.RunMode_CONTINUOUS;
// periodic and continuous
const Timer.RunMode_ONESHOT;
// one-shot
const Timer.RunMode_DYNAMIC;
// dynamically reprogrammed (available on subset of devices)
VALUES
RunMode_CONTINUOUS
Timer is periodic and runs continuously.
RunMode_ONESHOT
Timer runs for a single period value and stops.
RunMode_DYNAMIC
Timer is dynamically reprogrammed for the next required tick. This mode
is intended only for use by the Clock module when it is operating in
TickMode_DYNAMIC; it is not applicable for user-created Timer instances.
C SYNOPSIS
enum Timer.StartMode |
|
Timer Start Modes
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
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.Tclr |
|
Control Register (TCLR)
var obj = new Timer.Tclr;
obj.ptv = Bits32 ...
// Trigger output mode
obj.pre = Bits8 ...
// Prescalar enable
obj.ce = Bits8 ...
// Compare enable
obj.scpwm = Bits8 ...
// Pulse-width modulation
obj.tcm = Bits16 ...
// Transition capture mode
obj.trg = Bits16 ...
// Trigger output mode
obj.pt = Bits8 ...
// Pulse or toggle select bit
obj.captmode = Bits8 ...
// Capture mode select bit
obj.gpocfg = Bits8 ...
// PWM output/event detection input pin
C SYNOPSIS
struct Timer.Tier |
|
Interrupt Enable Register (TIER)
var obj = new Timer.Tier;
obj.mat_it_ena = Bits8 ...
// Enable match interrupt
obj.ovf_it_ena = Bits8 ...
// Enable overflow interrupt
obj.tcar_it_ena = Bits8 ...
// Enable capture interrupt
C SYNOPSIS
metaonly struct Timer.TimerSetting |
|
Timer Settings
var obj = new Timer.TimerSetting;
obj.master = Bool ...
// specifies whether this is the master
obj.baseAddr = Ptr ...
// specify the base address
obj.intNum = Int ...
// specify which interrupt vector
obj.eventId = Int ...
// specify which event number to use
obj.name = String ...
// specify the timer name
struct Timer.TiocpCfg |
|
L4 interface Configuration Register (TIOCP_CFG)
var obj = new Timer.TiocpCfg;
obj.idlemode = Bits8 ...
// 0=force-idle;1=no-idle;2=Smart-idle;3=Smart-idle
obj.emufree = Bits8 ...
// 0=counter frozen; 1=counter free-running
obj.softreset = Bits8 ...
// 0=normal mode; 1=soft reset
C SYNOPSIS
struct Timer.Tsicr |
|
L4 Interface Synchronization Control Register (TSICR)
var obj = new Timer.Tsicr;
obj.sft = Bits8 ...
// Reset software functional registers
obj.posted = Bits8 ...
// Posted mode selection
obj.readmode = Bits8 ...
// Select posted/non-posted mode for read operation
DETAILS
Note: 'readmode' field is not available on some older Silicon.
Please check the technical reference manual of your device to
determine if this field is available before using it.
C SYNOPSIS
struct Timer.Twer |
|
WakepUp Enable Register (TWER)
var obj = new Timer.Twer;
obj.mat_wup_ena = Bits8 ...
// Enable match wake-up
obj.ovf_wup_ena = Bits8 ...
// Enable overflow wake-up
obj.tcar_wup_ena = Bits8 ...
// Enable capture wake-up
C SYNOPSIS
config Timer.A_notAvailable // module-wide |
|
Assert raised when statically created timer is not available
msg: "A_notAvailable: statically created timer not available"
};
C SYNOPSIS
config Timer.E_badIntNum // module-wide |
|
Error raised when intNum not supplied by user or device table
msg: "E_badIntNum: Timer requires a valid intNum. Please use DMTimer module's timerSettings config param to assign a valid intNum for the selected timer."
};
C SYNOPSIS
config Timer.E_cannotSupport // module-wide |
|
Error raised when period requested is not supported
msg: "E_cannotSupport: Timer cannot support requested period %d"
};
C SYNOPSIS
config Timer.E_freqMismatch // module-wide |
|
Error raised when timer frequency does not match expected frequency
msg: "E_freqMismatch: Frequency mismatch: Expected %d Hz, actual: %d Hz. You need to modify Timer.intFreq.lo to match the actual frequency."
};
DETAILS
BIOS does not configure the DMTimer clock source and expects this
configuration to be performed via a GEL script or on the host OS. This
error is raised if BIOS detects a mismatch between
intFreq and
the actual operating frequency. The check is performed by comparing
the timestamp operating frequency with the DMTimer frequency.
To change the expected timer frequency to match the actual operating
frequency, use the following example configuration:
var Timer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
Timer.intFreq.lo = 20000000; //For 20Mhz
Timer.intFreq.hi = 0;
This check can be skipped by setting
checkFrequency to FALSE.
C SYNOPSIS
config Timer.E_invalidTimer // module-wide |
|
Error raised when timer id specified is not supported
msg: "E_invalidTimer: Invalid Timer Id %d"
};
C SYNOPSIS
config Timer.E_notAvailable // module-wide |
|
Error raised when timer requested is in use
msg: "E_notAvailable: Timer not available %d"
};
C SYNOPSIS
config Timer.anyMask // module-wide |
|
Available mask to be used when select = Timer_ANY
Timer.anyMask = Bits32 undefined;
DETAILS
Default value is device specific.
C SYNOPSIS
config Timer.checkFrequency // module-wide |
|
Whether to check the timer operating frequency at startup
Timer.checkFrequency = Bool true;
DETAILS
When this flag is set to 'TRUE', the Timer module will verify that the
operating frequency equals the frequency at which BIOS expects the
timers to operate. This check is performed by checking the timer count
rate against the
xdc.runtime.Timestamp count rate.
C SYNOPSIS
metaonly config Timer.common$ // module-wide |
|
Common module configuration parameters
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.
metaonly config Timer.intFreq // module-wide |
|
Default internal timer input clock frequency
DETAILS
If intFreq is set, its value will be copied into all
intFreqs[] array entries except any entry which was
explicitly written to in the application's config script.
For example, if intFreq is set to {hi:0, lo:32768} on a device
with 3 timers, it will be copied into intFreqs[0], intFreqs[1] &
intFreqs[2]. If the application explicitly sets one of the
intFreqs[] entries, say intFreqs[1], then intFreq is not
copied into intFreqs[1] and intFreqs[1] retains the value it was
set to in the config script.
metaonly config Timer.intFreqs // module-wide |
|
Default internal timer input clock frequency array
DETAILS
This array can be used to change the input clock frequency
for a particular timer.
For example, if it is required to change the input clock frequency
for timer id 2 to 32768Hz on a device that has 4 timers, the
intFreqs[2] config param can be set to {hi:0, lo:32768} in the
config script.
For a list of default timer frequencies for different devices,
please refer
Timer Mapping Tables.
metaonly config Timer.timerSettings // module-wide |
|
Global Control configuration for each physical timer
Instance Config Parameters |
|
var params = new Timer.Params;
// Instance config-params object
params.arg = UArg null;
// Argument for tick function
params.eventId = Int -1;
// Hwi event Id to be used by Timer
// Timer frequency
lo: 0,
hi: 0
};
// Hwi Params for Hwi Object. Default is null
params.intNum = Int -1;
// Hwi interrupt number to be used by Timer
params.period = UInt32 0;
// Period of a tick
// Period type
// Timer run mode
// Timer start mode
// Initial Timer Control Register bit settings
ptv: 0,
pre: 0,
ce: 0,
scpwm: 0,
tcm: 0,
trg: 0,
pt: 0,
captmode: 0,
gpocfg: 0
};
// Initial Timer IRQSTATUS_SET Register bit settings
mat_it_ena: 0,
ovf_it_ena: 1,
tcar_it_ena: 0
};
// Initial Timer TIOCP_CFG Register bit settings
idlemode: 0,
emufree: 0,
softreset: 1
};
params.tmar = UInt32 0;
// Initial Timer Match Register setting
// Initial Timer Synchronous Interface Control Register bit settings
sft: 0,
posted: 0,
readmode: 0
};
// Initial Timer IRQ Wakeup Enable Register bit settings
mat_wup_ena: 0,
ovf_wup_ena: 0,
tcar_wup_ena: 0
};
config Timer.Params.arg // instance |
|
Argument for tick function
var params = new Timer.Params;
...
params.arg = UArg null;
DETAILS
Default is null.
C SYNOPSIS
config Timer.Params.eventId // instance |
|
Hwi event Id to be used by Timer
var params = new Timer.Params;
...
params.eventId = Int -1;
C SYNOPSIS
config Timer.Params.extFreq // instance |
|
Timer frequency
var params = new Timer.Params;
...
lo: 0,
hi: 0
};
DETAILS
This parameter is meaningfull only on platforms where the timer's
input clock can be changed. If value is left at zero, then input clock
to the timer clock is assumed.
This value is used to convert timer ticks to real time units; seconds,
milliseconds, etc.
C SYNOPSIS
config Timer.Params.hwiParams // instance |
|
Hwi Params for Hwi Object. Default is null
var params = new Timer.Params;
...
C SYNOPSIS
config Timer.Params.intNum // instance |
|
Hwi interrupt number to be used by Timer
var params = new Timer.Params;
...
params.intNum = Int -1;
C SYNOPSIS
config Timer.Params.period // instance |
|
Period of a tick
var params = new Timer.Params;
...
params.period = UInt32 0;
DETAILS
The period can be specified in timer counts or microseconds
and its default value is 0.
The implementation of ITimer will support a period of UInt32
timer counts and use pre-scalars if necessary.
C SYNOPSIS
config Timer.Params.periodType // instance |
|
Period type
var params = new Timer.Params;
...
DETAILS
Default is PeriodType_MICROSECS
C SYNOPSIS
config Timer.Params.runMode // instance |
|
Timer run mode
var params = new Timer.Params;
...
DETAILS
C SYNOPSIS
config Timer.Params.startMode // instance |
|
Timer start mode
var params = new Timer.Params;
...
DETAILS
C SYNOPSIS
config Timer.Params.tclr // instance |
|
Initial Timer Control Register bit settings
var params = new Timer.Params;
...
ptv: 0,
pre: 0,
ce: 0,
scpwm: 0,
tcm: 0,
trg: 0,
pt: 0,
captmode: 0,
gpocfg: 0
};
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
config Timer.Params.tier // instance |
|
Initial Timer IRQSTATUS_SET Register bit settings
var params = new Timer.Params;
...
mat_it_ena: 0,
ovf_it_ena: 1,
tcar_it_ena: 0
};
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
config Timer.Params.tiocpCfg // instance |
|
Initial Timer TIOCP_CFG Register bit settings
var params = new Timer.Params;
...
idlemode: 0,
emufree: 0,
softreset: 1
};
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
config Timer.Params.tmar // instance |
|
Initial Timer Match Register setting
var params = new Timer.Params;
...
params.tmar = UInt32 0;
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
config Timer.Params.tsicr // instance |
|
Initial Timer Synchronous Interface Control Register bit settings
var params = new Timer.Params;
...
sft: 0,
posted: 0,
readmode: 0
};
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
config Timer.Params.twer // instance |
|
Initial Timer IRQ Wakeup Enable Register bit settings
var params = new Timer.Params;
...
mat_wup_ena: 0,
ovf_wup_ena: 0,
tcar_wup_ena: 0
};
DETAILS
For a detailed description of this timer register, please
refer to your device's Technical Reference Manual.
C SYNOPSIS
Static Instance Creation |
|
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,
or ANY
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.