DHCOM_HAL
Hardware-abstraction library (HAL) for multiple targets, including DHCOM modules
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
Public Types | Public Member Functions
dhcom::System Class Reference

Class representing particular HW/SW combination, from which the I/O implementation may depend. More...

#include <System.h>

Public Types

enum  HARDWARE { HARDWARE_INVALID = 0, HARDWARE_DHCOM_IMX25 = 1, HARDWARE_DHCOM_AM35 = 2, HARDWARE_PC = 100 }
 

Public Member Functions

 System ()
 The class which represents the target hardware.
 
 System (HARDWARE hardware)
 Constructor of a System object with target hardware specification.
 
STATUS setHardware (HARDWARE hardware)
 Sets the target hardware.
 
HARDWARE getHardware () const
 Returns the target hardware.
 
uint16_t getUartsNumber (STATUS *status=NULL) const
 Get the number of supported hardware UARTS.
 
const char * getUartDeviceName (UART::DEVICE device, STATUS *status=NULL) const
 Get the OS-dependent device name for UART.
 
uint16_t getGPIOPortsNumber (STATUS *status=NULL) const
 Get the number of supported GPIO ports.
 
uint8_t getGPIOPortPin (GPIO::PORT port, STATUS *status=NULL) const
 

Detailed Description

Class representing particular HW/SW combination, from which the I/O implementation may depend.

The I/O classes which depend on the System require the System object in their constructor args.

Member Enumeration Documentation

Enumerator:
HARDWARE_INVALID 

hardware was not set yet (used as a return value)

HARDWARE_DHCOM_IMX25 

Running on DHCOM-iMX25 module.

HARDWARE_DHCOM_AM35 

Running on DHCOM-AM35 module.

HARDWARE_PC 

Running on x86_32 or x86_64 PC.

Constructor & Destructor Documentation

dhcom::System::System ( )

The class which represents the target hardware.

Constructor of a System object, undefined hardware.

This class provides some flexibility to configure in-runtime on which target hardware we run. For example, both DHCOM module types run under linux-arm, so the same library binary can work for both, and nicely abstract from the particular module type, given the System object is correctly created.

The hardware my be defined later by call to System::setHardware().

dhcom::System::System ( System::HARDWARE  hardware)

Constructor of a System object with target hardware specification.

Parameters
hardware- the assumed target hardware.

Member Function Documentation

uint8_t dhcom::System::getGPIOPortPin ( GPIO::PORT  port,
STATUS status = NULL 
) const
Parameters
port- the port for which to get the pin number.
status- if NULL, status is not returned, otherwise the status will be assigned to STATUS_SUCCESS, STATUS_HARDWARE_UNDEFINED or STATUS_DEVICE_DOESNT_EXIST.
Returns
- the pin number related to the port (hardware-dependent). In case of an error 0 is returned.
uint16_t dhcom::System::getGPIOPortsNumber ( STATUS status = NULL) const

Get the number of supported GPIO ports.

Parameters
status- if NULL, status is not returned, otherwise the status will be assigned to STATUS_SUCCESS or STATUS_HARDWARE_UNDEFINED
Returns
- number of supported GPIO ports.
System::HARDWARE dhcom::System::getHardware ( ) const

Returns the target hardware.

Returns
- can be HARDWARE_INVALID (hardware not set), or other value from System::HARDWARE enumeration.
const char * dhcom::System::getUartDeviceName ( UART::DEVICE  device,
STATUS status = NULL 
) const

Get the OS-dependent device name for UART.

Parameters
device- which device to look for.
status- if NULL, status is not returned, otherwise the status will be assigned to STATUS_SUCCESS, STATUS_HARDWARE_UNDEFINED or STATUS_DEVICE_DOESNT_EXIST.
Returns
- a const string defining the device file name.
uint16_t dhcom::System::getUartsNumber ( STATUS status = NULL) const

Get the number of supported hardware UARTS.

Parameters
status- if NULL, status is not returned, otherwise the status will be assigned to STATUS_SUCCESS or STATUS_HARDWARE_UNDEFINED
Returns
- number of hardware UARTS, supported by the configured target. In case of error 0 will be returned.
STATUS dhcom::System::setHardware ( System::HARDWARE  hardware)

Sets the target hardware.

The hardware can only be set if it was not set before - by this call or in constructor.

Parameters
hardware- the assumed target hardware.
Returns
- may be STATUS_SUCCESS, STATUS_HARDWARE_ALREADY_DEFINED, STATUS_HARDWARE_UNSUPPORTED (library was not compiled for this hardware)

The documentation for this class was generated from the following file: