Home | History | Annotate | Download | only in stm32_flash

Lines Matching refs:handle

26 uint8_t checksum(__attribute__((unused)) handle_t *handle, uint8_t *bytes, int length)
43 static uint8_t write_len(handle_t *handle, int len)
49 return handle->write_data(handle, buffer, sizeof(uint8_t));
52 static uint8_t write_cnt(handle_t *handle, uint16_t cnt)
59 return handle->write_data(handle, buffer, sizeof(uint16_t));
62 static uint8_t write_addr(handle_t *handle, uint32_t addr)
71 return handle->write_data(handle, buffer, sizeof(uint32_t));
75 static uint8_t write_len_data(handle_t *handle, int len, uint8_t *data)
85 return handle->write_data(handle, buffer, sizeof(uint8_t)+len);
89 static uint8_t read_ack_loop(handle_t *handle)
94 ret = handle->read_ack(handle);
101 uint8_t erase_sector(handle_t *handle, uint16_t sector)
106 handle->write_cmd(handle, handle->cmd_erase);
107 ret = handle->read_ack(handle);
113 write_cnt(handle, sector);
114 } else if (handle->no_extra_sync) {
120 handle->write_data(handle, buffer, sizeof(uint16_t)+sizeof(uint16_t));
123 write_cnt(handle, 0x0000);
124 ret = read_ack_loop(handle);
127 write_cnt(handle, sector);
130 return read_ack_loop(handle);
134 uint8_t read_memory(handle_t *handle, uint32_t addr, uint32_t length, uint8_t *buffer)
140 handle->write_cmd(handle, handle->cmd_read_memory);
141 ret = handle->read_ack(handle);
143 write_addr(handle, addr+offset);
144 ret = read_ack_loop(handle);
147 write_len(handle, 256);
148 ret = read_ack_loop(handle);
150 handle->read_data(handle, &buffer[offset], 256);
154 write_len(handle, length-offset);
155 ret = read_ack_loop(handle);
157 handle->read_data(handle, &buffer[offset], length - offset);
169 uint8_t write_memory(handle_t *handle, uint32_t addr, uint32_t length, uint8_t *buffer)
175 handle->write_cmd(handle, handle->cmd_write_memory);
176 ret = handle->read_ack(handle);
178 write_addr(handle, addr+offset);
179 ret = read_ack_loop(handle);
182 write_len_data(handle, 256, &buffer[offset]);
185 write_len_data(handle, length-offset, &buffer[offset]);
188 ret = read_ack_loop(handle);