blob: 9849ca1c34059c03821f38e4f0b33ebe5133c148 [file] [log] [blame]
Zane Shelley465e0b32019-04-17 10:15:39 -05001#pragma once
2
Zane Shelleyca4b2f42019-08-30 15:48:40 -05003/**
4 * @file hei_user_interface.hpp
5 *
6 * The method for actions like hardware register access will vary per user
7 * application. Therefore, the user application must define all of the APIs
8 * listed below.
9 */
10
11#include <hei_includes.hpp>
Zane Shelley465e0b32019-04-17 10:15:39 -050012
Zane Shelley814b1e32019-06-17 20:55:04 -050013namespace libhei
14{
15
16/**
Zane Shelleyca4b2f42019-08-30 15:48:40 -050017 * @brief Performs a hardware register read operation.
18 *
Zane Shelley11b89942019-11-07 11:07:28 -060019 * @param i_chip The target chip for the register access. It is provided to
20 * the isolator by the user application via the isolator main
21 * APIs.
Zane Shelleyca4b2f42019-08-30 15:48:40 -050022 *
23 * @param o_buffer Allocated memory space for the returned contents of the
24 * register.
25 *
26 * @param io_bufSize The input parameter is the maximum size of the allocated
27 * o_buffer. The return value is the number of bytes actually
28 * written to the buffer.
29 *
30 * @param i_regType The user application may support different types of
31 * registers. This value is provided to the isolator by the
32 * user application via the Chip Data Files. The user
33 * application is responsible for knowing what to do with this
34 * parameter.
35 *
36 * @param i_address The register address. The values is a 1, 2, 4, or 8 byte
37 * address (right justified), which is provided to the
38 * isolator by the user application via the Chip Data Files.
39 *
40 * @return RC_SUCCESS or RC_REG_ACCESS_FAILURE. Note that in the case of a
41 * failure the user application is responsible for reporting why the
42 * register access failed.
Zane Shelley814b1e32019-06-17 20:55:04 -050043 */
Zane Shelley11b89942019-11-07 11:07:28 -060044ReturnCode registerRead(const Chip& i_chip, void* o_buffer, size_t& io_bufSize,
Zane Shelley83da2452019-10-25 15:45:34 -050045 uint64_t i_regType, uint64_t i_address);
Zane Shelley814b1e32019-06-17 20:55:04 -050046
47#ifndef __HEI_READ_ONLY
48
49/**
Zane Shelleyca4b2f42019-08-30 15:48:40 -050050 * @brief Performs a hardware register write operation.
51 *
Zane Shelley11b89942019-11-07 11:07:28 -060052 * @param i_chip The target chip for the register access. It is provided to
53 * the isolator by the user application via the isolator main
54 * APIs.
Zane Shelleyca4b2f42019-08-30 15:48:40 -050055 *
56 * @param i_buffer Allocated memory space containing the register contents to
57 * write to hardware.
58 *
59 * @param io_bufSize The input parameter is the number of byte from i_buffer to
60 * write to the hardware register. The return value is the
61 * actual number of bytes written to the hardware register.
62 *
63 * @param i_regType The user application may support different types of
64 * registers. This value is provided to the isolator by the
65 * user application via the Chip Data Files. The user
66 * application is responsible for knowing what to do with this
67 * parameter.
68 *
69 * @param i_address The register address. The values is a 1, 2, 4, or 8 byte
70 * address (right justified), which is provided to the
71 * isolator by the user application via the Chip Data Files.
72 *
73 * @return RC_SUCCESS or RC_REG_ACCESS_FAILURE. Note that in the case of a
74 * failure the user application is responsible for reporting why the
75 * register access failed.
Zane Shelley814b1e32019-06-17 20:55:04 -050076 */
Zane Shelley11b89942019-11-07 11:07:28 -060077ReturnCode registerWrite(const Chip& i_chip, void* i_buffer, size_t& io_bufSize,
Zane Shelley83da2452019-10-25 15:45:34 -050078 uint64_t i_regType, uint64_t i_address);
Zane Shelley814b1e32019-06-17 20:55:04 -050079
80#endif
81
82} // end namespace libhei