/*
* @file hv_drv_UsbPortingOsIo.h
* @brief Header file of usb adapting to os about io.
*
* @author HiView SoC Software Team
* @version 1.0.0
* @date 2022-06-15
*/

#ifndef __HV_DRV_USB_PORTING_OS_IO_H
#define __HV_DRV_USB_PORTING_OS_IO_H

#include "hv_drv_UsbPortingOsTypes.h"

typedef void *os_io_handle_t;

void os_io_init(void);

// Lookup a device and return it's handle
os_errno os_io_lookup(const char *name,
                      os_io_handle_t *handle);
// Write data to a device
os_errno os_io_write(os_io_handle_t handle,
                     const void *buf,
                     u32 *len);
// Read data from a device
os_errno os_io_read(os_io_handle_t handle,
                    void *buf,
                    u32 *len);
// Write data to a block device
os_errno os_io_bwrite(os_io_handle_t handle,
                      const void *buf,
                      u32 *len,
                      u32 pos);
// Read data from a block device
os_errno os_io_bread(os_io_handle_t handle,
                     void *buf,
                     u32 *len,
                     u32 pos);
// Get the configuration of a device
os_errno os_io_get_config(os_io_handle_t handle,
                          u32 key,
                          void *buf,
                          u32 *len);
// Change the configuration of a device
os_errno os_io_set_config(os_io_handle_t handle,
                          u32 key,
                          const void *buf,
                          u32 *len);
// Test a device for readiness
os_errno os_io_select(os_io_handle_t handle,
                     u32 which,
                     OS_ADDRWORD info);

#endif  /* OS_IO_H */
/* EOF io.h */
