Lines Matching +full:read +full:- +full:cmd

4  * SPDX-License-Identifier: Apache-2.0
13 * This driver supports the on-chip EEPROM found on NXP LPC11U6x MCUs.
15 * @note This driver is only a wrapper for the IAP (In-Application Programming)
34 const struct eeprom_lpc11u6x_config *config = dev->config; in eeprom_lpc11u6x_read()
35 uint32_t cmd[5]; in eeprom_lpc11u6x_read() local
42 if ((offset + len) > config->size) { in eeprom_lpc11u6x_read()
43 LOG_WRN("attempt to read past device boundary"); in eeprom_lpc11u6x_read()
44 return -EINVAL; in eeprom_lpc11u6x_read()
47 cmd[0] = IAP_CMD_EEPROM_READ; in eeprom_lpc11u6x_read()
48 cmd[1] = offset; in eeprom_lpc11u6x_read()
49 cmd[2] = (uint32_t) data; in eeprom_lpc11u6x_read()
50 cmd[3] = len; in eeprom_lpc11u6x_read()
51 cmd[4] = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / 1000; in eeprom_lpc11u6x_read()
53 ret = iap_cmd(cmd); in eeprom_lpc11u6x_read()
56 LOG_ERR("failed to read EEPROM (offset=%08x len=%d err=%d)", in eeprom_lpc11u6x_read()
58 return -EINVAL; in eeprom_lpc11u6x_read()
67 const struct eeprom_lpc11u6x_config *config = dev->config; in eeprom_lpc11u6x_write()
68 uint32_t cmd[5]; in eeprom_lpc11u6x_write() local
75 if ((offset + len) > config->size) { in eeprom_lpc11u6x_write()
77 return -EINVAL; in eeprom_lpc11u6x_write()
80 cmd[0] = IAP_CMD_EEPROM_WRITE; in eeprom_lpc11u6x_write()
81 cmd[1] = offset; in eeprom_lpc11u6x_write()
82 cmd[2] = (uint32_t) data; in eeprom_lpc11u6x_write()
83 cmd[3] = len; in eeprom_lpc11u6x_write()
84 cmd[4] = CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC / 1000; in eeprom_lpc11u6x_write()
86 ret = iap_cmd(cmd); in eeprom_lpc11u6x_write()
91 return -EINVAL; in eeprom_lpc11u6x_write()
99 const struct eeprom_lpc11u6x_config *config = dev->config; in eeprom_lpc11u6x_size()
101 return config->size; in eeprom_lpc11u6x_size()
105 .read = eeprom_lpc11u6x_read,