OpenOCD
helper/fileio.h File Reference
Include dependency graph for helper/fileio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ERROR_FILEIO_ACCESS_NOT_SUPPORTED   (-1203)
 
#define ERROR_FILEIO_LOCATION_UNKNOWN   (-1200)
 
#define ERROR_FILEIO_NOT_FOUND   (-1201)
 
#define ERROR_FILEIO_OPERATION_FAILED   (-1202)
 
#define ERROR_FILEIO_OPERATION_NOT_SUPPORTED   (-1205)
 
#define ERROR_FILEIO_RESOURCE_TYPE_UNKNOWN   (-1204)
 
#define FILEIO_MAX_ERROR_STRING   (128)
 

Enumerations

enum  fileio_access {
  FILEIO_NONE , FILEIO_READ , FILEIO_WRITE , FILEIO_READWRITE ,
  FILEIO_APPEND , FILEIO_APPENDREAD
}
 
enum  fileio_type { FILEIO_TEXT , FILEIO_BINARY }
 

Functions

int fileio_close (struct fileio *fileio)
 
int fileio_feof (struct fileio *fileio)
 
int fileio_fgets (struct fileio *fileio, size_t size, void *buffer)
 
int fileio_open (struct fileio **fileio, const char *url, enum fileio_access access_type, enum fileio_type type)
 
int fileio_read (struct fileio *fileio, size_t size, void *buffer, size_t *size_read)
 
int fileio_read_u32 (struct fileio *fileio, uint32_t *data)
 
int fileio_seek (struct fileio *fileio, size_t position)
 
int fileio_size (struct fileio *fileio, size_t *size)
 FIX!!!! More...
 
int fileio_write (struct fileio *fileio, size_t size, const void *buffer, size_t *size_written)
 
int fileio_write_u32 (struct fileio *fileio, uint32_t data)
 

Macro Definition Documentation

◆ ERROR_FILEIO_ACCESS_NOT_SUPPORTED

#define ERROR_FILEIO_ACCESS_NOT_SUPPORTED   (-1203)

Definition at line 57 of file helper/fileio.h.

◆ ERROR_FILEIO_LOCATION_UNKNOWN

#define ERROR_FILEIO_LOCATION_UNKNOWN   (-1200)

Definition at line 54 of file helper/fileio.h.

◆ ERROR_FILEIO_NOT_FOUND

#define ERROR_FILEIO_NOT_FOUND   (-1201)

Definition at line 55 of file helper/fileio.h.

◆ ERROR_FILEIO_OPERATION_FAILED

#define ERROR_FILEIO_OPERATION_FAILED   (-1202)

Definition at line 56 of file helper/fileio.h.

◆ ERROR_FILEIO_OPERATION_NOT_SUPPORTED

#define ERROR_FILEIO_OPERATION_NOT_SUPPORTED   (-1205)

Definition at line 59 of file helper/fileio.h.

◆ ERROR_FILEIO_RESOURCE_TYPE_UNKNOWN

#define ERROR_FILEIO_RESOURCE_TYPE_UNKNOWN   (-1204)

Definition at line 58 of file helper/fileio.h.

◆ FILEIO_MAX_ERROR_STRING

#define FILEIO_MAX_ERROR_STRING   (128)

Definition at line 19 of file helper/fileio.h.

Enumeration Type Documentation

◆ fileio_access

Enumerator
FILEIO_NONE 
FILEIO_READ 
FILEIO_WRITE 
FILEIO_READWRITE 
FILEIO_APPEND 
FILEIO_APPENDREAD 

Definition at line 26 of file helper/fileio.h.

◆ fileio_type

Enumerator
FILEIO_TEXT 
FILEIO_BINARY 

Definition at line 21 of file helper/fileio.h.

Function Documentation

◆ fileio_close()

int fileio_close ( struct fileio fileio)

◆ fileio_feof()

int fileio_feof ( struct fileio fileio)

Definition at line 146 of file helper/fileio.c.

References fileio::file.

Referenced by image_ihex_buffer_complete_inner(), and image_mot_buffer_complete_inner().

◆ fileio_fgets()

int fileio_fgets ( struct fileio fileio,
size_t  size,
void *  buffer 
)

◆ fileio_open()

int fileio_open ( struct fileio **  fileio,
const char *  url,
enum fileio_access  access_type,
enum fileio_type  type 
)

◆ fileio_read()

int fileio_read ( struct fileio fileio,
size_t  size,
void *  buffer,
size_t *  size_read 
)

◆ fileio_read_u32()

int fileio_read_u32 ( struct fileio fileio,
uint32_t *  data 
)

Definition at line 182 of file helper/fileio.c.

References be_to_h_u32(), ERROR_OK, and fileio_local_read().

Referenced by COMMAND_HANDLER().

◆ fileio_seek()

◆ fileio_size()

int fileio_size ( struct fileio fileio,
size_t *  size 
)

FIX!!!!

For now this can not fail, but that's because a seek was executed on startup.

Avoiding the seek on startup opens up for using streams.

Definition at line 259 of file helper/fileio.c.

References ERROR_OK, fileio::size, and size.

Referenced by COMMAND_HANDLER(), COMMAND_HELPER(), image_ihex_buffer_complete_inner(), image_mot_buffer_complete_inner(), and image_open().

◆ fileio_write()

int fileio_write ( struct fileio fileio,
size_t  size,
const void *  buffer,
size_t *  size_written 
)

◆ fileio_write_u32()

int fileio_write_u32 ( struct fileio fileio,
uint32_t  data 
)

Definition at line 235 of file helper/fileio.c.

References ERROR_OK, fileio_write(), and h_u32_to_be().

Referenced by COMMAND_HANDLER().