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