Listing 61 continued CLKC

*********************************************************************************

* GET TIME-STAMP

* Description : This function is used to return a time-stamp to your application. The format of the

* time-starrp is shown below:

* Field:-------Year------—Month—------Day---------Hours-----—Minutes— —Seconds—

* Bit# : 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

* Notes : The year is based from CLK_TS_BASE_YEAR. That is, if bits 31..26 contain 0 it really

* means that the year is CLK_TS_BASE_YEAR. If bits 31. .26 contain 13, the year is

* CLK_TS_BASE_YEAR + 13. *********************************************************************************************************

TS ClkGetTS (void) {

OS_ENTER_CRITICAL ( ) ; ts = ClkrS; OS_EXIT_CRITICAL ( ) ; return (ts);

#endif

*****************************************************************************

* .TIME MODULE INITIALIZATION

* TIME-OF-DAY CLOCK INITIALIZATION

* Description : This function initializes the time module. The time of day clock task will be created

* by this function .

* Arguments : None

*********************************************************************************************************

void Clklnit (void) {

ClkSan = OSSoiCreate(l),- I* Create time of day clock semaphore */

ClkSsnSec = OSSarCreate(O) ; /* Create counting semaphore to signal the occurrence of 1 sec. */

ClkTickCtr = 0; ClkSec = 0; ClkMin = 0; ClkHr = 0; #if CLK_DATE_EN

ClkTS = ClktfekeTS(ClkMDnth, ClkDay, ClkYear, ClkHr, ClkMin, ClkSec);

#endif

OSTaskCreate (ClkTask, (void *)0, KlkTaskStk[CLK_TASK_STK_SIZE], CLK_TASK_PRIO) ;

Was this article helpful?

0 0

Post a comment