blob: 6a4b6223148ac6d4fc1fafdd937afb37f7d3a10f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
/**
* @author generated by eTrice
*
* Header File of ActorClass ATimingService
*
*/
#ifndef _ROOM_BASIC_SERVICE_TIMING_ATIMINGSERVICE_H_
#define _ROOM_BASIC_SERVICE_TIMING_ATIMINGSERVICE_H_
#include "etDatatypes.h"
#include "messaging/etMessage.h"
/* include all referenced room classes */
#include "room/basic/service/timing/PTimer.h"
/*--------------------- begin user code ---------------------*/
#include "osal/etTime.h"
#define ET_NB_OF_TCBS 30
typedef struct etTCB etTimerControlBlock;
struct etTCB {
etTime expTime;
etTime pTime;
int32 portIdx;
etTimerControlBlock* next;
};
/*--------------------- end user code ---------------------*/
typedef struct ATimingService ATimingService;
/* const part of ActorClass (ROM) */
typedef struct ATimingService_const {
const char* instName;
/* simple ports */
/* data receive ports */
/* saps */
/* replicated ports */
/* services */
const etReplPort timer;
} ATimingService_const;
/* constant for state machine data */
#define ATIMINGSERVICE_HISTORY_SIZE 2
/* variable part of ActorClass (RAM) */
struct ATimingService {
const ATimingService_const* const constData;
/* data send ports */
/*--------------------- attributes ---------------------*/
etTimerControlBlock tcbs[30]
;
etTimerControlBlock* usedTcbsRoot;
etTimerControlBlock* freeTcbsRoot;
/* state machine variables */
etInt16 state;
etInt16 history[ATIMINGSERVICE_HISTORY_SIZE];
};
void ATimingService_init(ATimingService* self);
void ATimingService_receiveMessage(void* self, const void* ifitem, const etMessage* msg);
void ATimingService_execute(ATimingService* self);
/*--------------------- user constructor/destructor ---------------------*/
/*--------------------- operations ---------------------*/
void ATimingService_returnTcb(ATimingService* self, etTimerControlBlock* block);
void ATimingService_putTcbToUsedList(ATimingService* self, etTimerControlBlock* block);
void ATimingService_addTime(ATimingService* self, etTime* t1, etTime* t2);
etTimerControlBlock* ATimingService_getTcb(ATimingService* self);
void ATimingService_removeTcbFromUsedList(ATimingService* self, int32 idx);
bool ATimingService_isTimeGreater(ATimingService* self, etTime* t1, etTime* t2);
/*--------------------- begin user code ---------------------*/
/*uc2*/
/*--------------------- end user code ---------------------*/
#endif /* _ROOM_BASIC_SERVICE_TIMING_ATIMINGSERVICE_H_ */
|