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)
105 handle->write_cmd(handle, handle->cmd_erase);
106 ret = handle->read_ack(handle);
108 write_cnt(handle, 0x0000);
110 ret = read_ack_loop(handle);
112 write_cnt(handle, sector);
114 ret = read_ack_loop(handle);
120 uint8_t read_memory(handle_t *handle, uint32_t addr, uint32_t length, uint8_t *buffer)
126 handle->write_cmd(handle, handle->cmd_read_memory);
127 ret = handle->read_ack(handle);
129 write_addr(handle, addr+offset);
130 ret = read_ack_loop(handle);
133 write_len(handle, 256);
134 ret = read_ack_loop(handle);
136 handle->read_data(handle, &buffer[offset], 256);
140 write_len(handle, length-offset);
141 ret = read_ack_loop(handle);
143 handle->read_data(handle, &buffer[offset], length - offset);
155 uint8_t write_memory(handle_t *handle, uint32_t addr, uint32_t length, uint8_t *buffer)
161 handle->write_cmd(handle, handle->cmd_write_memory);
162 ret = handle->read_ack(handle);
164 write_addr(handle, addr+offset);
165 ret = read_ack_loop(handle);
168 write_len_data(handle, 256, &buffer[offset]);
171 write_len_data(handle, length-offset, &buffer[offset]);
174 ret = read_ack_loop(handle);