Lines Matching refs:length
42 static inline size_t pad(ssize_t length) in pad() argument
44 return (length + 3) & ~3; in pad()
47 static inline size_t tot_len(ssize_t length) in tot_len() argument
50 return sizeof(uint32_t) + pad(length) + sizeof(uint32_t); in tot_len()
86 ssize_t length = 0; in main() local
128 length = strtol(optarg, NULL, 0); in main()
227 if (length == 0 || length > buf.st_size) in main()
228 length = buf.st_size; in main()
230 if (fread(&buffer[sizeof(uint32_t)], 1, length, file) < (size_t)length) { in main()
237 printf("Writing %zd bytes from %s to 0x%08x\n", length, in main()
243 buffer[1] = (length >> 16) & 0xFF; in main()
244 buffer[2] = (length >> 8) & 0xFF; in main()
245 buffer[3] = (length ) & 0xFF; in main()
246 crc = ~stm32f4_crc32(buffer, sizeof(uint32_t) + length); in main()
248 memcpy(&buffer[sizeof(uint32_t) + pad(length)], in main()
252 tot_len(length), buffer); in main()
256 length, &buffer[sizeof(uint32_t)]); in main()
275 if (length > 0) { in main()
277 buffer = calloc(length, 1); in main()
279 ret = read_memory(handle, address, length, buffer); in main()
281 if (fwrite(buffer, 1, length, file) < (size_t)length) in main()
285 length, read_filename, address); in main()
296 length = ((tmp_buf[1] << 16) & 0x00FF0000) | in main()
301 buffer = calloc(tot_len(length), 1); in main()
303 tot_len(length), buffer); in main()
305 crc = stm32f4_crc32(buffer, tot_len(length)); in main()
306 if (fwrite(buffer, 1, tot_len(length), file) < tot_len(length)) in main()
310 length, read_filename, address, type, in main()