aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-13 03:08:29 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-13 11:58:04 -0800
commit9f212b01be20da43ba534ad33b20419779c89335 (patch)
tree2c7fee0d42eb27047ba365fb603c663399566b94 /src
parentf59ec2043b840a4534fdd61502de59e2571988d5 (diff)
downloadriscv-openocd-9f212b01be20da43ba534ad33b20419779c89335.zip
riscv-openocd-9f212b01be20da43ba534ad33b20419779c89335.tar.gz
riscv-openocd-9f212b01be20da43ba534ad33b20419779c89335.tar.bz2
fileio_t -> struct fileio
Remove useless structure typedef.
Diffstat (limited to 'src')
-rw-r--r--src/flash/flash.c2
-rw-r--r--src/flash/lpc2900.c2
-rw-r--r--src/flash/mflash.c4
-rw-r--r--src/flash/nand.c4
-rw-r--r--src/helper/fileio.c26
-rw-r--r--src/helper/fileio.h21
-rw-r--r--src/target/etm.c4
-rw-r--r--src/target/image.c6
-rw-r--r--src/target/image.h8
-rw-r--r--src/target/target.c2
-rw-r--r--src/target/xscale.c2
11 files changed, 40 insertions, 41 deletions
diff --git a/src/flash/flash.c b/src/flash/flash.c
index f3f0086..2abd8c4 100644
--- a/src/flash/flash.c
+++ b/src/flash/flash.c
@@ -812,7 +812,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
uint32_t offset;
uint8_t *buffer;
uint32_t buf_cnt;
- fileio_t fileio;
+ struct fileio fileio;
if (argc != 3)
return ERROR_COMMAND_SYNTAX_ERROR;
diff --git a/src/flash/lpc2900.c b/src/flash/lpc2900.c
index 953a62a..8359379 100644
--- a/src/flash/lpc2900.c
+++ b/src/flash/lpc2900.c
@@ -622,7 +622,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command)
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 )
diff --git a/src/flash/mflash.c b/src/flash/mflash.c
index 5a9b7c3..54578da 100644
--- a/src/flash/mflash.c
+++ b/src/flash/mflash.c
@@ -706,7 +706,7 @@ COMMAND_HANDLER(mg_write_cmd)
{
uint32_t address, buf_cnt, cnt, res, i;
uint8_t *buffer;
- fileio_t fileio;
+ struct fileio fileio;
int ret;
if (argc != 3) {
@@ -770,7 +770,7 @@ COMMAND_HANDLER(mg_dump_cmd)
{
uint32_t address, size_written, size, cnt, res, i;
uint8_t *buffer;
- fileio_t fileio;
+ struct fileio fileio;
int ret;
if (argc != 4) {
diff --git a/src/flash/nand.c b/src/flash/nand.c
index 26eb63a..44207a8 100644
--- a/src/flash/nand.c
+++ b/src/flash/nand.c
@@ -1292,7 +1292,7 @@ COMMAND_HANDLER(handle_nand_write_command)
uint32_t buf_cnt;
enum oob_formats oob_format = NAND_OOB_NONE;
- fileio_t fileio;
+ struct fileio fileio;
if (argc < 3)
@@ -1469,7 +1469,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
return ERROR_OK;
}
- fileio_t fileio;
+ struct fileio fileio;
uint8_t *page = NULL;
uint32_t page_size = 0;
diff --git a/src/helper/fileio.c b/src/helper/fileio.c
index 42dae06..71cae75 100644
--- a/src/helper/fileio.c
+++ b/src/helper/fileio.c
@@ -31,7 +31,7 @@
#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];
@@ -98,7 +98,7 @@ static inline int fileio_open_local(fileio_t *fileio)
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;
@@ -111,7 +111,7 @@ int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, en
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)
@@ -131,7 +131,7 @@ static inline int fileio_close_local(fileio_t *fileio)
return ERROR_OK;
}
-int fileio_close(fileio_t *fileio)
+int fileio_close(struct fileio *fileio)
{
int retval;
@@ -143,7 +143,7 @@ int fileio_close(fileio_t *fileio)
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)
@@ -155,19 +155,19 @@ int fileio_seek(fileio_t *fileio, uint32_t position)
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;
@@ -180,7 +180,7 @@ int fileio_read_u32(fileio_t *fileio, uint32_t *data)
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;
@@ -188,19 +188,19 @@ static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buff
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;
@@ -212,7 +212,7 @@ int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_
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;
diff --git a/src/helper/fileio.h b/src/helper/fileio.h
index 3f47cb9..024ad08 100644
--- a/src/helper/fileio.h
+++ b/src/helper/fileio.h
@@ -45,29 +45,28 @@ enum fileio_access
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)
diff --git a/src/target/etm.c b/src/target/etm.c
index a4ff6c5..6d34f6c 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1788,7 +1788,7 @@ COMMAND_HANDLER(handle_etm_image_command)
COMMAND_HANDLER(handle_etm_dump_command)
{
- fileio_t file;
+ struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;
@@ -1856,7 +1856,7 @@ COMMAND_HANDLER(handle_etm_dump_command)
COMMAND_HANDLER(handle_etm_load_command)
{
- fileio_t file;
+ struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;
diff --git a/src/target/image.c b/src/target/image.c
index cf7e11a..9a9c955 100644
--- a/src/target/image.c
+++ b/src/target/image.c
@@ -47,7 +47,7 @@
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];
@@ -150,7 +150,7 @@ static int identify_image_type(image_t *image, const char *type_string, const ch
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;
@@ -502,7 +502,7 @@ static int image_elf_read_section(image_t *image, int section, uint32_t offset,
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;
diff --git a/src/target/image.h b/src/target/image.h
index 30240d5..a1e24c4 100644
--- a/src/target/image.h
+++ b/src/target/image.h
@@ -69,12 +69,12 @@ typedef struct image_s
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;
@@ -87,7 +87,7 @@ typedef struct image_memory_s
typedef struct fileio_elf_s
{
- fileio_t fileio;
+ struct fileio fileio;
Elf32_Ehdr *header;
Elf32_Phdr *segments;
uint32_t segment_count;
@@ -96,7 +96,7 @@ typedef struct fileio_elf_s
typedef struct image_mot_s
{
- fileio_t fileio;
+ struct fileio fileio;
uint8_t *buffer;
} image_mot_t;
diff --git a/src/target/target.c b/src/target/target.c
index 8cc46ec..6346ae0 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2493,7 +2493,7 @@ COMMAND_HANDLER(handle_load_image_command)
COMMAND_HANDLER(handle_dump_image_command)
{
- fileio_t fileio;
+ struct fileio fileio;
uint8_t buffer[560];
int retvaltemp;
diff --git a/src/target/xscale.c b/src/target/xscale.c
index e18d591..88914b5 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -3420,7 +3420,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
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);