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 | * |
| 19 | * @param i_chip This is a pointer to a user application object that |
| 20 | * represents the target chip. It is provided to the isolator |
| 21 | * by the user application via the isolator main APIs. The |
| 22 | * isolator does not know anything about this object nor how |
| 23 | * to use it. The user application is responsible for knowing |
| 24 | * what to do with this parameter. |
| 25 | * |
| 26 | * @param o_buffer Allocated memory space for the returned contents of the |
| 27 | * register. |
| 28 | * |
| 29 | * @param io_bufSize The input parameter is the maximum size of the allocated |
| 30 | * o_buffer. The return value is the number of bytes actually |
| 31 | * written to the buffer. |
| 32 | * |
| 33 | * @param i_regType The user application may support different types of |
| 34 | * registers. This value is provided to the isolator by the |
| 35 | * user application via the Chip Data Files. The user |
| 36 | * application is responsible for knowing what to do with this |
| 37 | * parameter. |
| 38 | * |
| 39 | * @param i_address The register address. The values is a 1, 2, 4, or 8 byte |
| 40 | * address (right justified), which is provided to the |
| 41 | * isolator by the user application via the Chip Data Files. |
| 42 | * |
| 43 | * @return RC_SUCCESS or RC_REG_ACCESS_FAILURE. Note that in the case of a |
| 44 | * failure the user application is responsible for reporting why the |
| 45 | * register access failed. |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 46 | */ |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 47 | ReturnCode registerRead( void * i_chip, void * o_buffer, size_t & io_bufSize, |
| 48 | uint64_t i_regType, uint64_t i_address ); |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 49 | |
| 50 | #ifndef __HEI_READ_ONLY |
| 51 | |
| 52 | /** |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 53 | * @brief Performs a hardware register write operation. |
| 54 | * |
| 55 | * @param i_chip This is a pointer to a user application object that |
| 56 | * represents the target chip. It is provided to the isolator |
| 57 | * by the user application via the isolator main APIs. The |
| 58 | * isolator does not know anything about this object nor how |
| 59 | * to use it. The user application is responsible for knowing |
| 60 | * what to do with this parameter. |
| 61 | * |
| 62 | * @param i_buffer Allocated memory space containing the register contents to |
| 63 | * write to hardware. |
| 64 | * |
| 65 | * @param io_bufSize The input parameter is the number of byte from i_buffer to |
| 66 | * write to the hardware register. The return value is the |
| 67 | * actual number of bytes written to the hardware register. |
| 68 | * |
| 69 | * @param i_regType The user application may support different types of |
| 70 | * registers. This value is provided to the isolator by the |
| 71 | * user application via the Chip Data Files. The user |
| 72 | * application is responsible for knowing what to do with this |
| 73 | * parameter. |
| 74 | * |
| 75 | * @param i_address The register address. The values is a 1, 2, 4, or 8 byte |
| 76 | * address (right justified), which is provided to the |
| 77 | * isolator by the user application via the Chip Data Files. |
| 78 | * |
| 79 | * @return RC_SUCCESS or RC_REG_ACCESS_FAILURE. Note that in the case of a |
| 80 | * failure the user application is responsible for reporting why the |
| 81 | * register access failed. |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 82 | */ |
Zane Shelley | ca4b2f4 | 2019-08-30 15:48:40 -0500 | [diff] [blame] | 83 | ReturnCode registerWrite( void * i_chip, void * i_buffer, size_t & io_bufSize, |
| 84 | uint64_t i_regType, uint64_t i_address ); |
Zane Shelley | 814b1e3 | 2019-06-17 20:55:04 -0500 | [diff] [blame] | 85 | |
| 86 | #endif |
| 87 | |
| 88 | } // end namespace libhei |
Zane Shelley | 465e0b3 | 2019-04-17 10:15:39 -0500 | [diff] [blame] | 89 | |