123
Fork of LG by
DeviceController.h@173:7f938afb0447, 2016-06-19 (annotated)
- Committer:
- Diletant
- Date:
- Sun Jun 19 03:54:35 2016 +0000
- Revision:
- 173:7f938afb0447
- Parent:
- 167:bedc0a9d559a
- Child:
- 182:2bd8ec44998f
Device&... update. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 156:e68ee0bcdcda | 1 | #ifndef __DEVICE_CONTROLLER_H__ |
Diletant | 156:e68ee0bcdcda | 2 | #define __DEVICE_CONTROLLER_H__ |
Diletant | 156:e68ee0bcdcda | 3 | |
Diletant | 156:e68ee0bcdcda | 4 | #include "DeviceFlash.h" |
Diletant | 156:e68ee0bcdcda | 5 | #include "DeviceSSP.h" |
Diletant | 156:e68ee0bcdcda | 6 | #include "DeviceI2C.h" |
Diletant | 156:e68ee0bcdcda | 7 | #include "DeviceQEI.h" |
Diletant | 156:e68ee0bcdcda | 8 | #include "DeviceServicePort.h" |
Diletant | 161:efd949e8d536 | 9 | #include "DeviceUserPort.h" |
Diletant | 156:e68ee0bcdcda | 10 | #include "DeviceTimers.h" |
Diletant | 156:e68ee0bcdcda | 11 | |
Diletant | 156:e68ee0bcdcda | 12 | typedef struct _DeviceUARTSettings { |
Diletant | 156:e68ee0bcdcda | 13 | uint32_t baudRate; |
Diletant | 156:e68ee0bcdcda | 14 | } DeviceUARTSettings; |
Diletant | 156:e68ee0bcdcda | 15 | |
Diletant | 156:e68ee0bcdcda | 16 | typedef struct _DeviceUARTState { |
Diletant | 156:e68ee0bcdcda | 17 | //Line Control Register. Contains controls for frame formatting and break generation. |
Diletant | 156:e68ee0bcdcda | 18 | uint8_t LCR; |
Diletant | 156:e68ee0bcdcda | 19 | |
Diletant | 156:e68ee0bcdcda | 20 | //Divisor Latch MSB. Most significant byte of the baud rate divisor value. |
Diletant | 156:e68ee0bcdcda | 21 | //The full divisor is used to generate a baud rate from the fractional rate divider. |
Diletant | 156:e68ee0bcdcda | 22 | //When DLAB = 1 |
Diletant | 156:e68ee0bcdcda | 23 | uint8_t DLM; |
Diletant | 156:e68ee0bcdcda | 24 | |
Diletant | 156:e68ee0bcdcda | 25 | //Divisor Latch LSB. Least significant byte of the baud rate divisor value. |
Diletant | 156:e68ee0bcdcda | 26 | //The full divisor is used to generate a baud rate from the fractional rate divider. |
Diletant | 156:e68ee0bcdcda | 27 | //When DLAB = 1 |
Diletant | 156:e68ee0bcdcda | 28 | uint8_t DLL; |
Diletant | 156:e68ee0bcdcda | 29 | |
Diletant | 156:e68ee0bcdcda | 30 | //FIFO Control Register. Controls FIFO usage and modes. |
Diletant | 156:e68ee0bcdcda | 31 | uint8_t FCR; |
Diletant | 156:e68ee0bcdcda | 32 | } DeviceUARTState; |
Diletant | 156:e68ee0bcdcda | 33 | |
Diletant | 156:e68ee0bcdcda | 34 | typedef struct _DeviceUART { |
Diletant | 156:e68ee0bcdcda | 35 | DeviceUARTSettings settings; |
Diletant | 156:e68ee0bcdcda | 36 | DeviceUARTState state; |
Diletant | 156:e68ee0bcdcda | 37 | } DeviceUART; |
Diletant | 156:e68ee0bcdcda | 38 | |
Diletant | 161:efd949e8d536 | 39 | typedef struct _DeviceController { |
Diletant | 156:e68ee0bcdcda | 40 | uint32_t chip; |
Diletant | 156:e68ee0bcdcda | 41 | DeviceFlash flash; |
Diletant | 156:e68ee0bcdcda | 42 | DeviceSSP SSP; |
Diletant | 156:e68ee0bcdcda | 43 | DeviceI2C I2C; |
Diletant | 156:e68ee0bcdcda | 44 | DeviceQEI QEI; |
Diletant | 156:e68ee0bcdcda | 45 | DeviceTimer timer[2]; |
Diletant | 156:e68ee0bcdcda | 46 | DeviceUART uart[2]; |
Diletant | 156:e68ee0bcdcda | 47 | } DeviceController; |
Diletant | 156:e68ee0bcdcda | 48 | |
Diletant | 173:7f938afb0447 | 49 | void SystemInit1(void); |
Diletant | 173:7f938afb0447 | 50 | void SystemCoreClockUpdate1(void); |
Diletant | 173:7f938afb0447 | 51 | |
Diletant | 167:bedc0a9d559a | 52 | void InitControllerDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 53 | void InitControllerState(void); |
Diletant | 167:bedc0a9d559a | 54 | void DeviceStartController(void); |
Diletant | 156:e68ee0bcdcda | 55 | |
Diletant | 156:e68ee0bcdcda | 56 | #endif /* __DEVICE_CONTROLLER_H__ */ |