Lines Matching refs:length
35 static inline size_t pad(ssize_t length) in pad() argument
37 return (length + 3) & ~3; in pad()
40 static inline size_t tot_len(ssize_t length) in tot_len() argument
43 return sizeof(uint32_t) + pad(length) + sizeof(uint32_t); in tot_len()
78 ssize_t length = 0; in main() local
119 length = strtol(optarg, NULL, 0); in main()
205 if (length == 0 || length > buf.st_size) in main()
206 length = buf.st_size; in main()
208 if (fread(&buffer[sizeof(uint32_t)], 1, length, file) < (size_t)length) { in main()
213 printf("Writing %zd bytes from %s to 0x%08x\n", length, in main()
219 buffer[1] = (length >> 16) & 0xFF; in main()
220 buffer[2] = (length >> 8) & 0xFF; in main()
221 buffer[3] = (length ) & 0xFF; in main()
222 crc = ~stm32f4_crc32(buffer, sizeof(uint32_t) + length); in main()
224 memcpy(&buffer[sizeof(uint32_t) + pad(length)], in main()
228 tot_len(length), buffer); in main()
232 length, &buffer[sizeof(uint32_t)]); in main()
251 if (length > 0) { in main()
253 buffer = calloc(length, 1); in main()
255 ret = read_memory(handle, address, length, buffer); in main()
257 if (fwrite(buffer, 1, length, file) < (size_t)length) in main()
261 length, read_filename, address); in main()
272 length = ((tmp_buf[1] << 16) & 0x00FF0000) | in main()
277 buffer = calloc(tot_len(length), 1); in main()
279 tot_len(length), buffer); in main()
281 crc = stm32f4_crc32(buffer, tot_len(length)); in main()
282 if (fwrite(buffer, 1, tot_len(length), file) < tot_len(length)) in main()
286 length, read_filename, address, type, in main()