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 eos::base_handler<ham_mgr, ham_handler>

Public Functions

ham_handler(ham_mgr *)
ham_mgr *get_ham_mgr() const
class ham_mgr : public eos::base_mgr<ham_handler>

Public Functions

virtual ~ham_mgr()
virtual eos::read8_result_t read8(eossdk_ham_t ham, register_t reg) = 0

Called to read 8 bytes of data at a time from given register, stores the 8 bytes that was read within the return value’s attribute named ‘result’, and stores the response_enum within the return value’s attribute named ‘status’, using the HAM passed in to this API.

virtual eos::read16_result_t read16(eossdk_ham_t ham, register_t reg) = 0

Called to read 16 bytes of data at a time from given register, stores the 16 bytes that was read within the return value’s attribute named ‘result’, and stores the response_enum within the return value’s attribute named ‘status’, using the HAM passed into this API.

virtual eos::read_result_t read32(eossdk_ham_t ham, register_t reg) = 0

Called to read 32 bytes of data at a time from given register, stores the 32 bytes that was read within the return value’s attribute named ‘result’, and stores the response_enum within the return value’s attribute named ‘status’, using the HAM passed into this API. Uses string ptr to store result because underlying pluto call requires a string pointer for this call.

virtual eos::read_result_t read(eossdk_ham_t ham, register_t reg, 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 the return value’s attribute named ‘result’. Uses the HAM passed into this API.

virtual eos::read_result_t readBlock(eossdk_ham_t ham, register_t reg) = 0

Called to issue am Smbus block read from given register, stores the bytes that were read within the return value’s attribute named ‘result’, using the HAM passed into this 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(eossdk_ham_t ham, 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 passed into this API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write16(eossdk_ham_t ham, 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 passed into this API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write32(eossdk_ham_t ham, 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 passed into this API. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t write(eossdk_ham_t ham, register_t reg, eos::ByteString const &data, bool reliable = false) = 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 passed into this API. Stores the result in ‘data’. ‘reliable’ represents if the data transfer was reliable/successful or not.

virtual eos::response_enum_t writeBlock(eossdk_ham_t ham, register_t reg, eos::ByteString const &data, bool reliable = false) = 0

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

Protected Functions

ham_mgr()

Private Members

eos::ham_mgr::ham_mgr

Friends

friend eos::ham_handler

Type definitions in ham

namespace eos

Enums

enum response_enum_t

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

std::ostream &operator<<(std::ostream &os, const device_t &obj)

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

std::ostream &operator<<(std::ostream &os, const pci_address_t &obj)

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

std::ostream &operator<<(std::ostream &os, const aham_address_t &obj)

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

std::ostream &operator<<(std::ostream &os, const eossdk_ham_t &obj)

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

class read8_result_t
#include <ham.h>

Stores the status and result of read8 calls.

Public Functions

read8_result_t(response_enum_t status, uint8_t result)

Default constructor.

read8_result_t(const read8_result_t &other)
read8_result_t &operator=(read8_result_t const &other)
response_enum_t status() const
void status_is(response_enum_t status)
uint8_t result() const
void result_is(uint8_t result)
bool operator==(read8_result_t const &other) const
bool operator!=(read8_result_t const &other) const
uint32_t hash() const

The hash function for type read8_result_t.

void mix_me(hash_mix &h) const

The hash mix function for type read8_result_t.

std::string to_string() const

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

Private Members

std::shared_ptr<read8_result_impl_t> pimpl

Friends

std::ostream &operator<<(std::ostream &os, const read8_result_t &obj)

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

class read16_result_t
#include <ham.h>

Stores the status and result of read16 calls.

Public Functions

read16_result_t(response_enum_t status, uint16_t result)

Default constructor.

read16_result_t(const read16_result_t &other)
read16_result_t &operator=(read16_result_t const &other)
response_enum_t status() const
void status_is(response_enum_t status)
uint16_t result() const
void result_is(uint16_t result)
bool operator==(read16_result_t const &other) const
bool operator!=(read16_result_t const &other) const
uint32_t hash() const

The hash function for type read16_result_t.

void mix_me(hash_mix &h) const

The hash mix function for type read16_result_t.

std::string to_string() const

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

Private Members

std::shared_ptr<read16_result_impl_t> pimpl

Friends

std::ostream &operator<<(std::ostream &os, const read16_result_t &obj)

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

class read_result_t
#include <ham.h>

Stores the status and result of read calls that readup to 32 bytes.

Public Functions

read_result_t(response_enum_t status, ByteString result)

Default constructor.

read_result_t(const read_result_t &other)
read_result_t &operator=(read_result_t const &other)
response_enum_t status() const
void status_is(response_enum_t status)
ByteString result() const
void result_is(ByteString result)
bool operator==(read_result_t const &other) const
bool operator!=(read_result_t const &other) const
uint32_t hash() const

The hash function for type read_result_t.

void mix_me(hash_mix &h) const

The hash mix function for type read_result_t.

std::string to_string() const

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

Private Members

std::shared_ptr<read_result_impl_t> pimpl

Friends

std::ostream &operator<<(std::ostream &os, const read_result_t &obj)

A utility stream operator that adds a string representation of read_result_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

std::ostream &operator<<(std::ostream &os, const register_t &obj)

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