21 FILE *input_file = fopen(filename,
"rb");
24 LOG_ERROR(
"Couldn't open %s: %s", filename, strerror(errno));
28 fseek(input_file, 0, SEEK_END);
29 long length = ftell(input_file);
30 fseek(input_file, 0, SEEK_SET);
34 LOG_ERROR(
"Failed to get length of file %s: %s", filename, strerror(errno));
40 if (!bit_file->
data) {
46 size_t read_count = fread(bit_file->
data,
sizeof(
char), bit_file->
length, input_file);
48 if (read_count != bit_file->
length) {
#define LOG_ERROR(expr ...)
#define ERROR_PLD_FILE_LOAD_FAILED
int cpld_read_raw_bit_file(struct raw_bit_file *bit_file, const char *filename)