module ti.sysbios.hal.Seconds |
|
|
|
Seconds Manager
This module is a proxy to the device-specific Seconds module functions
as defined in ISeconds.xdc.
[
more ... ]
#include <ti/sysbios/hal/Seconds.h>
Functions common to all ISeconds modules |
UInt32 | |
UInt32 | |
Void | |
UInt32 | |
Functions common to all target modules |
|
|
Typedefs |
typedef struct | |
DETAILS
This module is a proxy to the device-specific Seconds module functions
as defined in ISeconds.xdc.
This module generates a custom time() function in the
configuration-generated .c file. This time() function calls Seconds_get()
to get the number of seconds since 1970 from a device-specific delegate
function.
Note: For TI codegen tools, time() returns the number of seconds since
1900. The generated time() function takes this into account, and adds the
number of seconds from 1900 to 1970 to the value returned by Seconds_get().
This allows functions such as localtime() to work correctly with TI tools.
The actual implementations of the Seconds module functions are
provided by the Seconds module delegates.
Additional, family-specific Seconds module APIs may also be provided
by the Seconds module delegates.
Follow the link below to determine which Seconds delegate is used
for your Target/Device:
Calling Context
Function | Hwi | Swi |
Task | Main | Startup |
get | Y | Y |
Y | Y | Y |
set | N | N |
Y | Y | Y |
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. Seconds_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. Seconds_Module_startupDone() returns FALSE).
|
Usage example with run-time support library:
#include <ti/sysbios/hal/Seconds.h>
#include <time.h>
time_t t;
struct tm *ltm;
char *curTime;
Seconds_set(STARTTIME);
t = time(NULL);
ltm = localtime(&t);
curTime = asctime(ltm);
System_printf("Time(GMT): %s\n", curTime);
struct Seconds_Time |
|
Structure to hold a time value in seconds plus nanoseconds
typedef struct Seconds_Time {
UInt32 secs;
// Seconds
UInt32 nsecs;
// Nanoseconds
} Seconds_Time;
Seconds_get() // module-wide |
|
Returns number of seconds since 1970 (the Unix epoch)
DETAILS
The user must call Seconds_set() before making any calls to Seconds_get(),
otherwise the value returned by Seconds_get() will be meaningless.
Seconds_getTime() // module-wide |
|
Fills in a Seconds_Time structure with seconds and nanoseconds
elapsed since 1970 (the Unix epoch)
DETAILS
Seconds_set() must have been called before making any calls to
Seconds_getTime(), otherwise the value returned by Seconds_getTime()
will be meaningless.
Seconds_set() // module-wide |
|
Update the real time clock with number of seconds since 1970
Void Seconds_set(UInt32 seconds);
DETAILS
Note: This function is non-reentrant.
Seconds_setTime() // module-wide |
|
Update the real time clock with the number of seconds and nanoseconds
that have elapsed since 1970 (the Unix epoch). The Seconds_Time
structure passed to setTime() contains the seconds and nanoseconds
to set the real time clock to. This API can be called instead
of Seconds_set(), if finer granularity of the time is required
Module-Wide Built-Ins |
|
// Get this module's unique id
Bool Seconds_Module_startupDone();
// Test if this module has completed startup
// The heap from which this module allocates memory
Bool Seconds_Module_hasMask();
// Test whether this module has a diagnostics mask
Bits16 Seconds_Module_getMask();
// Returns the diagnostics mask for this module
Void Seconds_Module_setMask(Bits16 mask);
// Set the diagnostics mask for this module
var Seconds = xdc.useModule('ti.sysbios.hal.Seconds');
local proxy modules
module-wide constants & types
module-wide config parameters
generated on Thu, 23 May 2019 00:22:17 GMT