Zane Shelley | 465e0b3 | 2019-04-17 10:15:39 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 3 | /** |
| 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 Shelley | 465e0b3 | 2019-04-17 10:15:39 -0500 | [diff] [blame] | 12 | |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 13 | namespace libhei |
| 14 | { |
| 15 | |
| 16 | /** |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 17 | * @brief Performs a hardware register read operation. |
| 18 | * |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 19 | * @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 Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 22 | * |
| 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 Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 43 | */ |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 44 | ReturnCode registerRead(const Chip& i_chip, void* o_buffer, size_t& io_bufSize, |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 45 | uint64_t i_regType, uint64_t i_address); |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 46 | |
| 47 | #ifndef __HEI_READ_ONLY |
| 48 | |
| 49 | /** |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 50 | * @brief Performs a hardware register write operation. |
| 51 | * |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 52 | * @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 Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 55 | * |
| 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 Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 76 | */ |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 77 | ReturnCode registerWrite(const Chip& i_chip, void* i_buffer, size_t& io_bufSize, |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 78 | uint64_t i_regType, uint64_t i_address); |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 79 | |
| 80 | #endif |
| 81 | |
| 82 | } // end namespace libhei |