From 995326b6000773efd454e308d487dec0b9f564b5 Mon Sep 17 00:00:00 2001 From: ntfreak Date: Mon, 1 Oct 2007 08:31:30 +0000 Subject: - flash autoerase cmd added, default is off - flash banks are calculated and erased prior to write (flash write_image only) - corrected array overrun in armv7m.c - corrected breakpoint memory allocation bug - image read now uses fgets, vastly improves reading of large files - improved hex file reading, support for Linear Address Record added git-svn-id: svn://svn.berlios.de/openocd/trunk@208 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/fileio.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/helper/fileio.c') diff --git a/src/helper/fileio.c b/src/helper/fileio.c index b0ad446e..3ee0b18b 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -284,6 +284,29 @@ int fileio_read_u32(fileio_t *fileio, u32 *data) return ERROR_OK; } +int fileio_local_fgets(fileio_t *fileio, u32 size, u8 *buffer) +{ + fileio_local_t *fileio_local = fileio->location_private; + + if( fgets(buffer, size, fileio_local->file) == NULL) + return ERROR_FILEIO_OPERATION_FAILED; + + return ERROR_OK; +} + +int fileio_fgets(fileio_t *fileio, u32 size, u8 *buffer) +{ + switch (fileio->location) + { + case FILEIO_LOCAL: + return fileio_local_fgets(fileio, size, buffer); + break; + default: + ERROR("BUG: should never get here"); + exit(-1); + } +} + int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written) { fileio_local_t *fileio_local = fileio->location_private; -- cgit v1.2.3