123
Fork of LG by
Device.h@182:2bd8ec44998f, 2016-07-10 (annotated)
- Committer:
- Diletant
- Date:
- Sun Jul 10 05:35:08 2016 +0000
- Revision:
- 182:2bd8ec44998f
- Parent:
- 177:672ef279c8e0
- Child:
- 183:c7a9c309086c
Device & ... update. More AskGld & Techno functionality. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 74:f4d9c3403578 | 1 | #ifndef __DEVICE_H__ |
Diletant | 74:f4d9c3403578 | 2 | #define __DEVICE_H__ |
Diletant | 74:f4d9c3403578 | 3 | |
Diletant | 149:abbf7663d27d | 4 | #include "LPC17xx.h" |
Diletant | 173:7f938afb0447 | 5 | //#include "system_LPC17xx.h" |
Diletant | 156:e68ee0bcdcda | 6 | #include "DeviceController.h" |
Diletant | 166:c3c0b8a90d81 | 7 | //#include "DeviceDAC.h" |
Diletant | 182:2bd8ec44998f | 8 | #include "DeviceUser.h" |
Diletant | 156:e68ee0bcdcda | 9 | #include "DeviceCounters.h" |
Diletant | 161:efd949e8d536 | 10 | #include "DeviceDither.h" |
Diletant | 149:abbf7663d27d | 11 | #include "DeviceLightUp.h" |
Diletant | 161:efd949e8d536 | 12 | #include "DeviceISACS.h" |
Diletant | 173:7f938afb0447 | 13 | #include "DeviceSequencer.h" |
Diletant | 149:abbf7663d27d | 14 | #include "DevicePLCS.h" |
Diletant | 174:0f86eedd511c | 15 | #include "DeviceTSS.h" |
Diletant | 174:0f86eedd511c | 16 | #include "DeviceCCS.h" |
Diletant | 174:0f86eedd511c | 17 | #include "DeviceErrorModel.h" |
Diletant | 177:672ef279c8e0 | 18 | //#include "DeviceDebug.h" |
Diletant | 74:f4d9c3403578 | 19 | |
Diletant | 182:2bd8ec44998f | 20 | //Device service communication interface typedefs |
Diletant | 182:2bd8ec44998f | 21 | typedef struct _DeviceService { |
Diletant | 156:e68ee0bcdcda | 22 | char buffer[512]; |
Diletant | 161:efd949e8d536 | 23 | uint16_t position; //Transmission position |
Diletant | 182:2bd8ec44998f | 24 | DeviceServicePort port; |
Diletant | 182:2bd8ec44998f | 25 | } DeviceService; |
Diletant | 137:14a0c452cf32 | 26 | |
Diletant | 161:efd949e8d536 | 27 | //Device measurement cycle typedefs |
Diletant | 156:e68ee0bcdcda | 28 | typedef struct _DeviceMeasurementCycle { |
Diletant | 156:e68ee0bcdcda | 29 | uint32_t length; //Measurement cycle length |
Diletant | 156:e68ee0bcdcda | 30 | uint32_t counter; //Measurement cycle counter |
Diletant | 156:e68ee0bcdcda | 31 | } DeviceMeasurementCycle; |
Diletant | 156:e68ee0bcdcda | 32 | |
Diletant | 161:efd949e8d536 | 33 | //Device regular cycle typedefs |
Diletant | 156:e68ee0bcdcda | 34 | typedef struct _DeviceRegularCycle { |
Diletant | 161:efd949e8d536 | 35 | volatile uint32_t event1Hz; |
Diletant | 161:efd949e8d536 | 36 | volatile uint32_t event500Hz; |
Diletant | 161:efd949e8d536 | 37 | volatile uint32_t event1K; |
Diletant | 161:efd949e8d536 | 38 | volatile uint32_t event10K; |
Diletant | 161:efd949e8d536 | 39 | volatile uint32_t event100K; |
Diletant | 156:e68ee0bcdcda | 40 | |
Diletant | 161:efd949e8d536 | 41 | volatile uint32_t time100K; |
Diletant | 161:efd949e8d536 | 42 | volatile uint32_t time10K; |
Diletant | 161:efd949e8d536 | 43 | volatile uint32_t time1K; |
Diletant | 161:efd949e8d536 | 44 | volatile uint32_t time500Hz; |
Diletant | 161:efd949e8d536 | 45 | volatile uint32_t time1Hz; |
Diletant | 156:e68ee0bcdcda | 46 | } DeviceRegularCycle; |
Diletant | 156:e68ee0bcdcda | 47 | |
Diletant | 161:efd949e8d536 | 48 | //Device sensor typedefs |
Diletant | 161:efd949e8d536 | 49 | typedef struct _DeviceSensorSettings { |
Diletant | 161:efd949e8d536 | 50 | //Device ID |
Diletant | 161:efd949e8d536 | 51 | uint16_t id; |
Diletant | 161:efd949e8d536 | 52 | //Block ID |
Diletant | 161:efd949e8d536 | 53 | uint16_t block; |
Diletant | 161:efd949e8d536 | 54 | } DeviceSensorSettings; |
Diletant | 156:e68ee0bcdcda | 55 | |
Diletant | 161:efd949e8d536 | 56 | typedef struct _DeviceSensorState { |
Diletant | 161:efd949e8d536 | 57 | } DeviceSensorState; |
Diletant | 161:efd949e8d536 | 58 | |
Diletant | 161:efd949e8d536 | 59 | typedef struct _DeviceSensor { |
Diletant | 161:efd949e8d536 | 60 | DeviceSensorSettings settings; |
Diletant | 161:efd949e8d536 | 61 | DeviceSensorState state; |
Diletant | 161:efd949e8d536 | 62 | } DeviceSensor; |
Diletant | 161:efd949e8d536 | 63 | |
Diletant | 161:efd949e8d536 | 64 | //Device typedefs |
Diletant | 74:f4d9c3403578 | 65 | typedef struct _Device { |
Diletant | 156:e68ee0bcdcda | 66 | //Measurement cycle |
Diletant | 156:e68ee0bcdcda | 67 | DeviceMeasurementCycle measurement; |
Diletant | 156:e68ee0bcdcda | 68 | //Control cycle |
Diletant | 156:e68ee0bcdcda | 69 | DeviceRegularCycle regular; |
Diletant | 182:2bd8ec44998f | 70 | //Counters |
Diletant | 156:e68ee0bcdcda | 71 | DeviceCounters counters; |
Diletant | 161:efd949e8d536 | 72 | //Controller |
Diletant | 161:efd949e8d536 | 73 | DeviceController controller; |
Diletant | 182:2bd8ec44998f | 74 | //Interfaces |
Diletant | 182:2bd8ec44998f | 75 | DeviceService service; //Service communication interface - asynchronous serial port 0 |
Diletant | 182:2bd8ec44998f | 76 | DeviceUser user; //User communication interface - asynchronous serial port 1 |
Diletant | 137:14a0c452cf32 | 77 | //Units |
Diletant | 174:0f86eedd511c | 78 | DeviceSensor sensor; //Sensor info |
Diletant | 174:0f86eedd511c | 79 | DeviceLightUp lightUp; //Light-up system |
Diletant | 174:0f86eedd511c | 80 | DeviceDither dither; //Dither system |
Diletant | 174:0f86eedd511c | 81 | DeviceISACS isacs; //Information signal amplitude stabilizer |
Diletant | 174:0f86eedd511c | 82 | DeviceSequencer sequencer; //Sequencer |
Diletant | 161:efd949e8d536 | 83 | DevicePathLengthControlSystem plcs; //Path length control system |
Diletant | 174:0f86eedd511c | 84 | DeviceTSS tss; //Temperature sense system |
Diletant | 174:0f86eedd511c | 85 | DeviceCCS ccs; //Current control system |
Diletant | 174:0f86eedd511c | 86 | DeviceEM em; //Error model |
Diletant | 177:672ef279c8e0 | 87 | #ifdef __DEVICE_DEBUG_H__ |
Diletant | 177:672ef279c8e0 | 88 | DeviceDebug debug; |
Diletant | 177:672ef279c8e0 | 89 | #endif |
Diletant | 74:f4d9c3403578 | 90 | } Device; |
Diletant | 74:f4d9c3403578 | 91 | |
Diletant | 137:14a0c452cf32 | 92 | typedef struct _HashParam { |
Diletant | 137:14a0c452cf32 | 93 | uint32_t hash; |
Diletant | 137:14a0c452cf32 | 94 | void * ref; |
Diletant | 137:14a0c452cf32 | 95 | uint32_t size; |
Diletant | 137:14a0c452cf32 | 96 | } HashParam; |
Diletant | 137:14a0c452cf32 | 97 | |
Diletant | 182:2bd8ec44998f | 98 | #define HASH_PARAM_COUNT 886 |
Diletant | 149:abbf7663d27d | 99 | |
Diletant | 149:abbf7663d27d | 100 | typedef struct _HashFunc { |
Diletant | 149:abbf7663d27d | 101 | uint32_t hash; |
Diletant | 149:abbf7663d27d | 102 | void * ref; |
Diletant | 149:abbf7663d27d | 103 | uint32_t resultSize; |
Diletant | 149:abbf7663d27d | 104 | uint32_t paramCount; |
Diletant | 149:abbf7663d27d | 105 | } HashFunc; |
Diletant | 149:abbf7663d27d | 106 | |
Diletant | 149:abbf7663d27d | 107 | #define HASH_FUNC_COUNT 3 |
Diletant | 149:abbf7663d27d | 108 | |
Diletant | 167:bedc0a9d559a | 109 | void DeviceInitDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 110 | void DeviceInitState(void); |
Diletant | 167:bedc0a9d559a | 111 | |
Diletant | 173:7f938afb0447 | 112 | void DeviceInit(void); |
Diletant | 173:7f938afb0447 | 113 | void DeviceStart(void); |
Diletant | 173:7f938afb0447 | 114 | |
Diletant | 161:efd949e8d536 | 115 | void InitHashParamTable(void); |
Diletant | 166:c3c0b8a90d81 | 116 | void InitHashFuncTable(void); |
Diletant | 149:abbf7663d27d | 117 | |
Diletant | 156:e68ee0bcdcda | 118 | void DeviceRegularEvent1Hz(void); |
Diletant | 156:e68ee0bcdcda | 119 | void DeviceRegularEvent500Hz(void); |
Diletant | 156:e68ee0bcdcda | 120 | void DeviceRegularEvent1KHz(void); |
Diletant | 156:e68ee0bcdcda | 121 | void DeviceRegularEvent10KHz(void); |
Diletant | 156:e68ee0bcdcda | 122 | void DeviceRegularEvent100KHz(void); |
Diletant | 156:e68ee0bcdcda | 123 | void DeviceMeasurementInterruptHandler(void); |
Diletant | 156:e68ee0bcdcda | 124 | void DeviceRegularInterruptHandler(void); |
Diletant | 173:7f938afb0447 | 125 | |
Diletant | 74:f4d9c3403578 | 126 | #endif /* __DEVICE_H__ */ |