Hardware Access
You must provide a read function and a write function for the API to call. Use the hardware write function matching the instance configuration (32b/64b):
void hardware_read(void *context, uint32_t address, uint32_t *data);
void hardware_write32(void *context, uint32_t address, uint32_t data);
void hardware_write64(void *context, uint32_t address, uint64_t data);
Arguments:
- context
- User-defined handle to select the specific IP instance and its configuration such as, base address.
- data
- 32-bit value for read operations; 32-bit or 64-bit value for write operations.
- address
- Width depends on the IP and addressing mode.
Mapping
- In both hardware_write and hardware_read, map the API’s logical address for the selected instance to the hardware base address of that instance.
Abstraction and Driver Behavior
- The IP register space is fully abstracted by the API and supplied driver.
- Direct register accesses are not required; your
hardware_readandhardware_writefunctions provide the necessary access path for the driver.
Implementation Notes
Use the context to retrieve the instance's base address.
Registration
Use the following driver calls to register the hardware access functions:
// Hardware Read Function (always 32-bit)
void cam_arg_set_hw_read_function(cam_arg_t *cam_arg, void (*hw_read_function)(void *, uint32_t, uint32_t *));
// Hardware Write Functions (32-bit or 64-bit options)
void cam_arg_set_hw_write32_function(cam_arg_t *cam_arg, void (*hw_write32_function)(void *, uint32_t, uint32_t));
void cam_arg_set_hw_write64_function(cam_arg_t *cam_arg, void (*hw_write64_function)(void *, uint32_t, uint64_t));
// Set instance context for hardware access functions
void cam_arg_set_inst_ctx(cam_arg_t *cam_arg, void *inst_ctx);