| 1265 | } |
| 1266 | |
| 1267 | static void write_image(const char *filename, char *image, int size) |
| 1268 | { |
| 1269 | int new_fd; |
| 1270 | printf("Writing new image to %s\n", filename); |
| 1271 | |
| 1272 | // Now write out new image |
| 1273 | new_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644); |
| 1274 | if (new_fd < 0) { |
| 1275 | perror("Error while trying to open file"); |
| 1276 | exit(EXIT_FAILURE); |
| 1277 | } |
| 1278 | if (write(new_fd, image, size) != size) |
| 1279 | perror("Error while writing"); |
| 1280 | close(new_fd); |
| 1281 | } |
| 1282 | |
| 1283 | static void set_spi_frequency(const char *filename, char *image, int size, |
| 1284 | enum spi_frequency freq) |
no test coverage detected