Remove useless structure typedef.
uint32_t offset;
uint8_t *buffer;
uint32_t buf_cnt;
- fileio_t fileio;
+ struct fileio fileio;
if (argc != 3)
return ERROR_COMMAND_SYNTAX_ERROR;
target_write_u32( target, FCTR, FCTR_FS_CS | FCTR_FS_WEB );
/* Try and open the file */
- fileio_t fileio;
+ struct fileio fileio;
const char *filename = args[1];
int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
if( ret != ERROR_OK )
{
uint32_t address, buf_cnt, cnt, res, i;
uint8_t *buffer;
- fileio_t fileio;
+ struct fileio fileio;
int ret;
if (argc != 3) {
{
uint32_t address, size_written, size, cnt, res, i;
uint8_t *buffer;
- fileio_t fileio;
+ struct fileio fileio;
int ret;
if (argc != 4) {
uint32_t buf_cnt;
enum oob_formats oob_format = NAND_OOB_NONE;
- fileio_t fileio;
+ struct fileio fileio;
if (argc < 3)
return ERROR_OK;
}
- fileio_t fileio;
+ struct fileio fileio;
uint8_t *page = NULL;
uint32_t page_size = 0;
#include "configuration.h"
#include "fileio.h"
-static inline int fileio_open_local(fileio_t *fileio)
+static inline int fileio_open_local(struct fileio *fileio)
{
char access[4];
return ERROR_OK;
}
-int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type)
+int fileio_open(struct fileio *fileio, const char *url, enum fileio_access access, enum fileio_type type)
{
int retval = ERROR_OK;
return retval;
}
-static inline int fileio_close_local(fileio_t *fileio)
+static inline int fileio_close_local(struct fileio *fileio)
{
int retval;
if ((retval = fclose(fileio->file)) != 0)
return ERROR_OK;
}
-int fileio_close(fileio_t *fileio)
+int fileio_close(struct fileio *fileio)
{
int retval;
return retval;
}
-int fileio_seek(fileio_t *fileio, uint32_t position)
+int fileio_seek(struct fileio *fileio, uint32_t position)
{
int retval;
if ((retval = fseek(fileio->file, position, SEEK_SET)) != 0)
return ERROR_OK;
}
-static inline int fileio_local_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
+static inline int fileio_local_read(struct fileio *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
{
*size_read = fread(buffer, 1, size, fileio->file);
return ERROR_OK;
}
-int fileio_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
+int fileio_read(struct fileio *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
{
return fileio_local_read(fileio, size, buffer, size_read);
}
-int fileio_read_u32(fileio_t *fileio, uint32_t *data)
+int fileio_read_u32(struct fileio *fileio, uint32_t *data)
{
uint8_t buf[4];
uint32_t size_read;
return ERROR_OK;
}
-static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buffer)
+static inline int fileio_local_fgets(struct fileio *fileio, uint32_t size, char *buffer)
{
if (fgets(buffer, size, fileio->file) == NULL)
return ERROR_FILEIO_OPERATION_FAILED;
return ERROR_OK;
}
-int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer)
+int fileio_fgets(struct fileio *fileio, uint32_t size, char *buffer)
{
return fileio_local_fgets(fileio, size, buffer);
}
-static inline int fileio_local_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
+static inline int fileio_local_write(struct fileio *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
{
*size_written = fwrite(buffer, 1, size, fileio->file);
return ERROR_OK;
}
-int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
+int fileio_write(struct fileio *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
{
int retval;
return retval;;
}
-int fileio_write_u32(fileio_t *fileio, uint32_t data)
+int fileio_write_u32(struct fileio *fileio, uint32_t data)
{
uint8_t buf[4];
uint32_t size_written;
FILEIO_APPENDREAD, /* open for writing, position at end, allow reading */
};
-typedef struct fileio_s
-{
+struct fileio {
char *url;
long long size;
enum fileio_type type;
enum fileio_access access;
FILE *file;
-} fileio_t;
+};
-int fileio_open(fileio_t *fileio,
+int fileio_open(struct fileio *fileio,
const char *url, enum fileio_access access, enum fileio_type type);
-int fileio_close(fileio_t *fileio);
+int fileio_close(struct fileio *fileio);
-int fileio_seek(fileio_t *fileio, uint32_t position);
-int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer);
+int fileio_seek(struct fileio *fileio, uint32_t position);
+int fileio_fgets(struct fileio *fileio, uint32_t size, char *buffer);
-int fileio_read(fileio_t *fileio,
+int fileio_read(struct fileio *fileio,
uint32_t size, uint8_t *buffer, uint32_t *size_read);
-int fileio_write(fileio_t *fileio,
+int fileio_write(struct fileio *fileio,
uint32_t size, const uint8_t *buffer, uint32_t *size_written);
-int fileio_read_u32(fileio_t *fileio, uint32_t *data);
-int fileio_write_u32(fileio_t *fileio, uint32_t data);
+int fileio_read_u32(struct fileio *fileio, uint32_t *data);
+int fileio_write_u32(struct fileio *fileio, uint32_t data);
#define ERROR_FILEIO_LOCATION_UNKNOWN (-1200)
#define ERROR_FILEIO_NOT_FOUND (-1201)
COMMAND_HANDLER(handle_etm_dump_command)
{
- fileio_t file;
+ struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;
COMMAND_HANDLER(handle_etm_load_command)
{
- fileio_t file;
+ struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;
static int autodetect_image_type(image_t *image, const char *url)
{
int retval;
- fileio_t fileio;
+ struct fileio fileio;
uint32_t read_bytes;
uint8_t buffer[9];
static int image_ihex_buffer_complete(image_t *image)
{
image_ihex_t *ihex = image->type_private;
- fileio_t *fileio = &ihex->fileio;
+ struct fileio *fileio = &ihex->fileio;
uint32_t full_address = 0x0;
uint32_t cooked_bytes;
int i;
static int image_mot_buffer_complete(image_t *image)
{
image_mot_t *mot = image->type_private;
- fileio_t *fileio = &mot->fileio;
+ struct fileio *fileio = &mot->fileio;
uint32_t full_address = 0x0;
uint32_t cooked_bytes;
int i;
typedef struct image_binary_s
{
- fileio_t fileio;
+ struct fileio fileio;
} image_binary_t;
typedef struct image_ihex_s
{
- fileio_t fileio;
+ struct fileio fileio;
uint8_t *buffer;
} image_ihex_t;
typedef struct fileio_elf_s
{
- fileio_t fileio;
+ struct fileio fileio;
Elf32_Ehdr *header;
Elf32_Phdr *segments;
uint32_t segment_count;
typedef struct image_mot_s
{
- fileio_t fileio;
+ struct fileio fileio;
uint8_t *buffer;
} image_mot_t;
COMMAND_HANDLER(handle_dump_image_command)
{
- fileio_t fileio;
+ struct fileio fileio;
uint8_t buffer[560];
int retvaltemp;
target_t *target = get_current_target(cmd_ctx);
struct xscale_common_s *xscale = target_to_xscale(target);
xscale_trace_data_t *trace_data;
- fileio_t file;
+ struct fileio file;
int retval;
retval = xscale_verify_pointer(cmd_ctx, xscale);