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

Represents a chunk of physical address space of DHCOM module. More...

#include <PhysMem.h>

Public Member Functions

 PhysMem (uint32_t physAddress, uint32_t length)
 Creates the PhysMem object and remembers the related segment of the physical addresses.
 
 ~PhysMem ()
 Destroys an object of the class, closing it if necessary.
 
STATUS open ()
 Claims the physical address space.
 
STATUS close ()
 Releases the physical address space.
 
bool isOpen () const
 Checks if the physical address space was opened and is accessible.
 
void * getAddress () const
 Returns the virtual address for access to the represented physical address space.
 
void * getAddress (uint32_t offset) const
 
uint32_t getLength () const
 Get the length of the physical address segment.
 

Detailed Description

Represents a chunk of physical address space of DHCOM module.

Important: On Linux systems root privileges are required to map physical memory.

Constructor & Destructor Documentation

dhcom::PhysMem::PhysMem ( uint32_t  physAddress,
uint32_t  length 
)

Creates the PhysMem object and remembers the related segment of the physical addresses.

Parameters
physAddress- start of the physical address space.
length- the length of the address space in bytes.
dhcom::PhysMem::~PhysMem ( )

Destroys an object of the class, closing it if necessary.

Member Function Documentation

STATUS dhcom::PhysMem::close ( )

Releases the physical address space.

Returns
STATUS_DEVICE_CLOSE_FAILED or STATUS_SUCCESS.
void * dhcom::PhysMem::getAddress ( ) const

Returns the virtual address for access to the represented physical address space.

Returns
- a void pointer to the mapped block of memory, through which the access to physical address space is possible. Returns NULL if was not opened.
void* dhcom::PhysMem::getAddress ( uint32_t  offset) const
inline
uint32_t dhcom::PhysMem::getLength ( ) const

Get the length of the physical address segment.

Returns
the length in bytes.
bool dhcom::PhysMem::isOpen ( ) const

Checks if the physical address space was opened and is accessible.

Returns
true - the physical address space is accessible.
STATUS dhcom::PhysMem::open ( )

Claims the physical address space.

Returns
STATUS_DEVICE_ALREADY_OPEN, STATUS_DEVICE_OPEN_FAILED or STATUS_SUCCESS.

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