123
Fork of LG by
Device.h
- Committer:
- Diletant
- Date:
- 2016-06-26
- Revision:
- 174:0f86eedd511c
- Parent:
- 173:7f938afb0447
- Child:
- 177:672ef279c8e0
File content as of revision 174:0f86eedd511c:
#ifndef __DEVICE_H__ #define __DEVICE_H__ #define DEV_BOARD_HAOYU #ifdef DEV_BOARD_HAOYU #warning "Program config: development board!!!" #endif #include "LPC17xx.h" //#include "system_LPC17xx.h" #include "DeviceController.h" //#include "DeviceDAC.h" #include "DeviceUserProtocol.h" #include "DeviceCounters.h" #include "DeviceDither.h" #include "DeviceLightUp.h" #include "DeviceISACS.h" #include "DeviceSequencer.h" #include "DevicePLCS.h" #include "DeviceTSS.h" #include "DeviceCCS.h" #include "DeviceErrorModel.h" typedef enum _DeviceLatchMode { DeviceLatch10kHz, //internal latch by pulses 10 kHz (power on default mode) DeviceLatchMeander, //internal latch by signed meander pulses (not used?) DeviceLatchRS422, //external latch by RS422 request DeviceLatchPin //external latch by hardware pin request } DeviceLatchMode; typedef enum _DeviceLatchFormat { DeviceLatchFormatDeltaPS, //latch data in DELTA_PS response format DeviceLatchFormatDeltaBINS, //latch data in DELTA_BINS response format DeviceLatchFormatDeltaSF //latch data in DELTA_SF response format } DeviceLatchFormat; typedef struct _DeviceLatchState { uint8_t ready; DeviceLatchMode mode; //latch source DeviceLatchFormat format; //data to latch uint8_t reset; //set to reset counters on each latch (default), clear to keep (DELTA_SF) } DeviceLatchState; typedef enum _DeviceCountingSource { DeviceCountingSourceReference, //Accumulate pulses using reference +/- counters as source DeviceCountingSourceDither, //Accumulate pulses using dither counters as source } DeviceCountingSource; //Device service communication typedefs typedef struct _Service { char buffer[512]; uint16_t position; //Transmission position } Service; //Device measurement cycle typedefs typedef struct _DeviceMeasurementCycle { uint32_t length; //Measurement cycle length uint32_t counter; //Measurement cycle counter } DeviceMeasurementCycle; //Device regular cycle typedefs typedef struct _DeviceRegularCycle { volatile uint32_t event1Hz; volatile uint32_t event500Hz; volatile uint32_t event1K; volatile uint32_t event10K; volatile uint32_t event100K; volatile uint32_t time100K; volatile uint32_t time10K; volatile uint32_t time1K; volatile uint32_t time500Hz; volatile uint32_t time1Hz; } DeviceRegularCycle; //Device sensor typedefs typedef struct _DeviceSensorSettings { //Device ID uint16_t id; //Block ID uint16_t block; } DeviceSensorSettings; typedef struct _DeviceSensorState { } DeviceSensorState; typedef struct _DeviceSensor { DeviceSensorSettings settings; DeviceSensorState state; } DeviceSensor; //Device typedefs typedef struct _Device { //Measurement cycle DeviceMeasurementCycle measurement; //Control cycle DeviceRegularCycle regular; //Counting DeviceLatchState latch; DeviceCounters counters; //Controller DeviceController controller; //Protocols Service service; //Service communication protocol - asynchronous serial port 0 DeviceUserProtocol user; //User communication protocol - asynchronous serial port 1 //Units DeviceSensor sensor; //Sensor info DeviceLightUp lightUp; //Light-up system DeviceDither dither; //Dither system DeviceISACS isacs; //Information signal amplitude stabilizer DeviceSequencer sequencer; //Sequencer DevicePathLengthControlSystem plcs; //Path length control system DeviceTSS tss; //Temperature sense system DeviceCCS ccs; //Current control system DeviceEM em; //Error model } Device; typedef struct _HashParam { uint32_t hash; void * ref; uint32_t size; } HashParam; #define HASH_PARAM_COUNT 755 typedef struct _HashFunc { uint32_t hash; void * ref; uint32_t resultSize; uint32_t paramCount; } HashFunc; #define HASH_FUNC_COUNT 3 void DeviceInitDefaultSettings(void); void DeviceInitState(void); void DeviceInit(void); void DeviceStart(void); void InitHashParamTable(void); void InitHashFuncTable(void); void DeviceRegularEvent1Hz(void); void DeviceRegularEvent500Hz(void); void DeviceRegularEvent1KHz(void); void DeviceRegularEvent10KHz(void); void DeviceRegularEvent100KHz(void); void DeviceMeasurementInterruptHandler(void); void DeviceRegularInterruptHandler(void); #endif /* __DEVICE_H__ */