EEPROM API 参考
EEPROM
-
struct wm_drv_eeprom_ops_t
instance api types
-
wm_device_t *wm_drv_eeprom_init(const char *eeprom_dev_name)
eeprom drvier initialize
- 参数:
eeprom_dev_name – [in] The eeprom name, defined in device table
- 返回:
!0 : eeprom device, return previous handle if called twice
NULL: fail
-
int wm_drv_eeprom_deinit(wm_device_t *eeprom_device)
eeprom drvier deinitialize
- 参数:
eeprom_device – [in] eeprom device,type of wm_device_t *
- 返回:
WM_ERR_SUCCESS : deinitialize ok
WM_ERR_INVALID_PARAM: bad param
-
int wm_drv_eeprom_read(wm_device_t *eeprom_device, uint32_t offset, void *buf, uint32_t len)
read data from eeprom device
- 参数:
eeprom_device – [in] eeprom device,type of wm_device_t *
offset – [in] read offset
buf – [out] The read buffer
len – [in] The buffer size
- 返回:
WM_ERR_SUCCESS : read ok
WM_ERR_FAILED : read fail
WM_ERR_INVALID_PARAM: bad param
-
int wm_drv_eeprom_write(wm_device_t *eeprom_device, uint32_t offset, const void *data, uint32_t len)
write data to eeprom device
- 参数:
eeprom_device – [in] eeprom device,type of wm_device_t *
offset – [in] write offset
data – [in] The write data
len – [in] The size of write data
- 返回:
WM_ERR_SUCCESS : read ok
WM_ERR_FAILED : read fail
WM_ERR_INVALID_PARAM: bad param
-
int wm_drv_eeprom_get_size(wm_device_t *eeprom_device)
Get eeprom size, the size is configured in device table.
- 参数:
eeprom_device – [in] eeprom device,type of wm_device_t *
- 返回:
> 0: eeprom size
< 0: WM_ERR_INVALID_PARAM
-
int wm_drv_eeprom_set_wp(wm_device_t *eeprom_device, bool on)
set write protection
备注
The eeprom WP pin must connect to the gpio pin that configured in device table
- 参数:
eeprom_device – [in] eeprom device,type of wm_device_t *
on – [in] 1: write protection, 0: no write protection
- 返回:
WM_ERR_SUCCESS : deinitialize ok
WM_ERR_INVALID_PARAM: bad param