ham

HAM management module.

Provides a Hardware Access Method manager with read and write APIs to support communication protocols such as i2c within EosSdk.

namespace eos
class ham_handler

Public Functions

ham_handler(ham_mgr *)
ham_mgr * get_ham_mgr() const
class ham_mgr

Public Functions

virtual ~ham_mgr()
virtual void ham_is(eossdk_ham_t ham) = 0

Create the EosSdk HAM object to use for future reads and writes.

virtual bool exists() const = 0

Verifies that the HAM object was successfully created and exists.

virtual eos::response_enum_t read8(register_t reg, uint8_t * result) = 0

Called to read 8 bytes of data at a time from given register, stores the 8 bytes that was read within ‘result’, using the HAM created in the ham_is API.

virtual eos::response_enum_t read16(register_t reg, uint16_t * result) = 0

Called to read 16 bytes of data at a time from given register, stores the 16 bytes that was read within ‘result’, using the HAM created in the ham_is API.

virtual eos::response_enum_t read32(register_t reg, std::string * result) = 0

Called to read 32 bytes of data at a time from given register, stores the 32 bytes that was read within ‘result’, using the HAM created in the ham_is API. Uses string ptr to store result because underlying pluto call requires a string pointer for this call.

virtual eos::response_enum_t read(register_t reg, std::string * result, size_t size) = 0

Called to issue an I2C variable-sized/block read from given register. Reads up to ‘size’ amount of bytes of data from given register, and stores the bytes that were read within ‘result’. Uses the HAM created in the ham_is API.

virtual eos::response_enum_t readBlock(register_t reg, std::string * result) = 0

Called to issue am Smbus block read from given register, stores the bytes that were read within ‘result’, using the HAM created in the ham_is API. Reads up to a max of 32 bytes from register. Uses string ptr to store result because underlying pluto call requires a string pointer for this call.

virtual eos::response_enum_t write8(register_t reg, uint8_t data, bool reliable = false) = 0

Called to write 8 bytes that are stored in ‘data’ to register ‘reg’, using the HAM created in the ham_is API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write16(register_t reg, uint16_t data, bool reliable = false) = 0

Called to write 16 bytes that are stored in ‘data’ to register ‘reg’, using the HAM created in the ham_is API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write32(register_t reg, uint32_t data, bool reliable = false) = 0

Called to write 32 bytes that are stored in ‘data’ to register ‘reg’, using the HAM created in the ham_is API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write(register_t reg, uint32_t data, size_t size, bool reliable) = 0

Called to issue an I2C variable-sized/block write call, writes a block of data of a given size to register ‘reg’, using the HAM created in the ham_is API. Stores the result in ‘data’. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t writeBlock(register_t reg, uint32_t data, size_t size, bool reliable) = 0

Called to issue an Smbus write block call, writes a block of data of a given size to register ‘reg’, using the HAM created in the ham_is API. Stores the result in ‘data’. ‘reliable’ represents if the data transfer was reliable/successful or not.

Protected Functions

ham_mgr()

Private Members

ham_mgr

Friends

friend class ham_handler

Type definitions in ham

namespace eos

Enums

response_enum_t enum

The response_enum_t is the return value of any read or write with the ham.

Values:

  • STATUS_OK -

    Ok.

  • STATUS_ERR_HW_NOT_PRESENT -

    Hardware not present.

  • STATUS_ERR_HW_FAILURE -

    General hardware failure.

  • STATUS_ERR_ARGS -

    Invalid parameter arguments.

  • STATUS_ERR_COMM -

    Communication error. Possible to retry later.

  • STATUS_ERR_API_UNSUPPORTED -

    API not supported.

  • STATUS_ERR_INTERNAL -

    Internal error.

class device_t
#include <ham.h>

The device_t type is passed to the ctor of the eossdk_ham_t type.

Public Functions

device_t()

Default constructor.

device_t(const device_t & other)
device_t & operator=(device_t const & other)
std::string driver() const

Getter for ‘driver’: Driver name.

void driver_is(std::string driver)

Setter for ‘driver’.

uint32_t uid() const

Getter for ‘uid’: The unique ID for the component.

void uid_is(uint32_t uid)

Setter for ‘uid’.

uint32_t did() const

Getter for ‘did’: The unique topology ID for the device.

void did_is(uint32_t did)

Setter for ‘did’.

uint32_t bus() const

Getter for ‘bus’: The Bus ID attribute.

void bus_is(uint32_t bus)

Setter for ‘bus’.

uint32_t accelerator() const

Getter for ‘accelerator’: The accelerator attribute.

void accelerator_is(uint32_t accelerator)

Setter for ‘accelerator’.

bool operator==(device_t const & other) const
bool operator!=(device_t const & other) const
bool operator<(device_t const & other) const
uint32_t hash() const

The hash function for type device_t.

void mix_me(hash_mix & h) const

The hash mix function for type device_t.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::shared_ptr< device_impl_t > pimpl

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of device_t to the ostream.

class pci_address_t
#include <ham.h>

The pci_address_t type is passed to the ctor of the eossdk_ham_t type. The HAM should use the PCI address of the SCD. If zero, the CPUs SMBuses are used.

Public Functions

pci_address_t()

Default constructor.

pci_address_t(const pci_address_t & other)
pci_address_t & operator=(pci_address_t const & other)
uint32_t domain() const

Getter for ‘domain’: Domain of the pci address.

void domain_is(uint32_t domain)

Setter for ‘domain’.

uint32_t bus() const

Getter for ‘bus’: Bus identifier for pci address.

void bus_is(uint32_t bus)

Setter for ‘bus’.

uint32_t device() const

Getter for ‘device’: Device identifier for pci address.

void device_is(uint32_t device)

Setter for ‘device’.

uint32_t function() const

Getter for ‘function’: Function identifier for pci address.

void function_is(uint32_t function)

Setter for ‘function’.

bool operator==(pci_address_t const & other) const
bool operator!=(pci_address_t const & other) const
bool operator<(pci_address_t const & other) const
uint32_t hash() const

The hash function for type pci_address_t.

void mix_me(hash_mix & h) const

The hash mix function for type pci_address_t.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::shared_ptr< pci_address_impl_t > pimpl

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of pci_address_t to the ostream.

class aham_address_t
#include <ham.h>

The aham_address_t type is passed to the ctor of the eossdk_ham_t type. It holds the bus Id, the accelerator,and the endpoint address.

Public Functions

aham_address_t()

Default constructor.

aham_address_t(const aham_address_t & other)
aham_address_t & operator=(aham_address_t const & other)
uint32_t bus() const

Getter for ‘bus’: Bus attribute for aham address.

void bus_is(uint32_t bus)

Setter for ‘bus’.

uint32_t accelerator() const

Getter for ‘accelerator’: Accelerator for ahamaddress.

void accelerator_is(uint32_t accelerator)

Setter for ‘accelerator’.

uint32_t address() const

Getter for ‘address’: Address field of the aham addressobject.

void address_is(uint32_t address)

Setter for ‘address’.

bool operator==(aham_address_t const & other) const
bool operator!=(aham_address_t const & other) const
bool operator<(aham_address_t const & other) const
uint32_t hash() const

The hash function for type aham_address_t.

void mix_me(hash_mix & h) const

The hash mix function for type aham_address_t.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::shared_ptr< aham_address_impl_t > pimpl

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of aham_address_t to the ostream.

class eossdk_ham_t
#include <ham.h>

Hardware access method.

Public Functions

eossdk_ham_t(device_t device_Args, uint32_t endpoint_Addr)

Default constructor, where deviceArgs and endpointAddr are passed in from the EosSdk FPGA module.

eossdk_ham_t(aham_address_t aham_address, pci_address_t pci_address)

Constructor specifying the AhamAddress for the ham device, where the AhamAddress contains the endpoint address, the bus Id, and the accelerator for the ham. Also specifies PCI Address.

eossdk_ham_t(const eossdk_ham_t & other)
eossdk_ham_t & operator=(eossdk_ham_t const & other)
device_t device_Args() const
uint32_t endpoint_Addr() const
aham_address_t aham_address() const
pci_address_t pci_address() const
uint32_t hash() const

The hash function for type eossdk_ham_t.

void mix_me(hash_mix & h) const

The hash mix function for type eossdk_ham_t.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::shared_ptr< eossdk_ham_impl_t > pimpl

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of eossdk_ham_t to the ostream.

class register_t
#include <ham.h>

Register type, from which the HAM will read from/write to.

Public Functions

register_t()
register_t(const register_t & other)
register_t & operator=(register_t const & other)
uint32_t reg() const
void reg_is(uint32_t reg)
bool operator==(register_t const & other) const
bool operator!=(register_t const & other) const
bool operator<(register_t const & other) const
uint32_t hash() const

The hash function for type register_t.

void mix_me(hash_mix & h) const

The hash mix function for type register_t.

std::string to_string() const

Returns a string representation of the current object’s values.

Private Members

std::shared_ptr< register_impl_t > pimpl

Friends

friend std::ostream & operator<<

A utility stream operator that adds a string representation of register_t to the ostream.