From 53d1f9b2ca5718e4996e9cf3406f857d0ed26df2 Mon Sep 17 00:00:00 2001 From: drath Date: Thu, 14 Jun 2007 09:47:00 +0000 Subject: - added manpage for OpenOCD (thanks to Uwe Hermann) - fixed bug in ARM926EJ-S cache handling that caused cache linefills to be disabled after first debug entry - added support for auto image type detection (thanks to Vincent Palatin) - further work on ETM trace decoding (tested with a ETB interface using an ETM in normal 16-bit port mode, still experimental) git-svn-id: svn://svn.berlios.de/openocd/trunk@169 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/helper/fileio.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/helper/fileio.c') diff --git a/src/helper/fileio.c b/src/helper/fileio.c index 3a760cd8..7075fc16 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -258,6 +258,27 @@ int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read) } } +int fileio_read_u32(fileio_t *fileio, u32 *data) +{ + u8 buf[4]; + u32 size_read; + int retval; + + switch (fileio->location) + { + case FILEIO_LOCAL: + if ((retval = fileio_local_read(fileio, 4, buf, &size_read)) != ERROR_OK) + return retval; + *data = be_to_h_u32(buf); + break; + default: + ERROR("BUG: should never get here"); + exit(-1); + } + + return ERROR_OK; +} + int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written) { fileio_local_t *fileio_local = fileio->location_private; @@ -280,3 +301,24 @@ int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written) return ERROR_OK; } + +int fileio_write_u32(fileio_t *fileio, u32 data) +{ + u8 buf[4]; + u32 size_written; + int retval; + + h_u32_to_be(buf, data); + + switch (fileio->location) + { + case FILEIO_LOCAL: + if ((retval = fileio_local_write(fileio, 4, buf, &size_written)) != ERROR_OK) + return retval; + break; + default: + ERROR("BUG: should never get here"); + } + + return ERROR_OK; +} -- cgit v1.2.3