123

Dependencies:   mbed

Fork of LG by igor Apu

DeviceController.h

Committer:
Diletant
Date:
2016-06-19
Revision:
173:7f938afb0447
Parent:
167:bedc0a9d559a
Child:
182:2bd8ec44998f

File content as of revision 173:7f938afb0447:

#ifndef __DEVICE_CONTROLLER_H__
#define __DEVICE_CONTROLLER_H__

#include "DeviceFlash.h"
#include "DeviceSSP.h"
#include "DeviceI2C.h"
#include "DeviceQEI.h"
#include "DeviceServicePort.h"
#include "DeviceUserPort.h"
#include "DeviceTimers.h"

typedef struct _DeviceUARTSettings {
  uint32_t baudRate;
} DeviceUARTSettings;

typedef struct _DeviceUARTState {
 //Line Control Register. Contains controls for frame formatting and break generation.
 uint8_t LCR;
 
 //Divisor Latch MSB. Most significant byte of the baud rate divisor value.
 //The full divisor is used to generate a baud rate from the fractional rate divider.
 //When DLAB = 1
 uint8_t DLM;
 
 //Divisor Latch LSB. Least significant byte of the baud rate divisor value.
 //The full divisor is used to generate a baud rate from the fractional rate divider.
 //When DLAB = 1
 uint8_t DLL;
 
 //FIFO Control Register. Controls FIFO usage and modes.
 uint8_t FCR;
} DeviceUARTState;

typedef struct _DeviceUART {
  DeviceUARTSettings settings;
  DeviceUARTState state;
} DeviceUART;

typedef struct _DeviceController {
  uint32_t chip;
  DeviceFlash flash;
  DeviceSSP SSP;
  DeviceI2C I2C;
  DeviceQEI QEI;
  DeviceTimer timer[2];
  DeviceUART uart[2];
} DeviceController;

void SystemInit1(void);
void SystemCoreClockUpdate1(void);

void InitControllerDefaultSettings(void);
void InitControllerState(void);
void DeviceStartController(void);

#endif  /* __DEVICE_CONTROLLER_H__ */