1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17:
18:
19: #ifndef _TIME_CALLS_H
20: #define _TIME_CALLS_H
21:
22: #define DIFF_TRON_UTC (473385600000LL)
23:
24: 25: 26:
27: typedef struct cyclic_handler_control_block {
28: void *exinf;
29: ATR cycatr;
30: FP cychdr;
31: UINT cycstat;
32: RELTIM cyctim;
33: TMEB cyctmeb;
34: #if USE_OBJECT_NAME
35: UB name[OBJECT_NAME_LENGTH];
36: #endif
37: } CYCCB;
38:
39: IMPORT CYCCB knl_cyccb_table[];
40: IMPORT QUEUE knl_free_cyccb;
41:
42: #define get_cyccb(id) ( &knl_cyccb_table[INDEX_CYC(id)] )
43:
44:
45: 46: 47:
48: Inline ABSTIM knl_cyc_next_time( CYCCB *cyccb )
49: {
50: ABSTIM tm, cur;
51:
52: cur = lltoul(knl_current_time);
53: tm = cyccb->cyctmeb.time + cyccb->cyctim;
54:
55: if ( knl_abstim_reached(cur, tm) ) {
56:
57: tm = ((cur - cyccb->cyctmeb.time) / cyccb->cyctim + 1) * cyccb->cyctim + cyccb->cyctmeb.time;
58: }
59:
60: return tm;
61: }
62:
63: IMPORT void knl_call_cychdr( CYCCB* cyccb );
64:
65: 66: 67:
68: Inline void knl_cyc_timer_insert( CYCCB *cyccb, ABSTIM tm )
69: {
70: knl_timer_insert_abs(&cyccb->cyctmeb, tm, (CBACK)knl_call_cychdr, cyccb);
71: }
72:
73:
74: 75: 76:
77: typedef struct alarm_handler_control_block {
78: void *exinf;
79: ATR almatr;
80: FP almhdr;
81: UINT almstat;
82: TMEB almtmeb;
83: #if USE_OBJECT_NAME
84: UB name[OBJECT_NAME_LENGTH];
85: #endif
86: } ALMCB;
87:
88:
89: IMPORT ALMCB knl_almcb_table[];
90: IMPORT QUEUE knl_free_almcb;
91:
92: #define get_almcb(id) ( &knl_almcb_table[INDEX_ALM(id)] )
93:
94: IMPORT void knl_call_almhdr( ALMCB *almcb );
95:
96: 97: 98:
99: Inline void knl_alm_timer_insert( ALMCB *almcb, RELTIM reltim )
100: {
101: ABSTIM tm;
102:
103: 104:
105: tm = lltoul(knl_current_time) + reltim + TIMER_PERIOD;
106:
107: knl_timer_insert_abs(&almcb->almtmeb, tm, (CBACK)knl_call_almhdr, almcb);
108: }
109:
110:
111: #endif