libdragon
|
00001 00006 #ifndef __LIBDRAGON_SYSTEM_H 00007 #define __LIBDRAGON_SYSTEM_H 00008 00015 #define MAX_FILESYSTEMS 10 00016 00017 #define MAX_OPEN_HANDLES 100 00018 00019 #ifdef __cplusplus 00020 extern "C" { 00021 #endif 00022 00023 #include <dir.h> 00024 00032 typedef struct 00033 { 00046 void *(*open)( char *name, int flags ); 00057 int (*fstat)( void *file, struct stat *st ); 00070 int (*lseek)( void *file, int ptr, int dir ); 00083 int (*read)( void *file, uint8_t *ptr, int len ); 00095 int (*write)( void *file, uint8_t *ptr, int len ); 00104 int (*close)( void *file ); 00114 int (*unlink)( char *name ); 00127 int (*findfirst)( char *path, dir_t *dir ); 00137 int (*findnext)( dir_t *dir ); 00138 } filesystem_t; 00139 00147 typedef struct 00148 { 00159 int (*stdin_read)( char *data, unsigned int len ); 00170 int (*stdout_write)( char *data, unsigned int len ); 00181 int (*stderr_write)( char *data, unsigned int len ); 00182 } stdio_t; 00183 00184 int attach_filesystem( const char * const prefix, filesystem_t *filesystem ); 00185 int detach_filesystem( const char * const prefix ); 00186 00187 int hook_stdio_calls( stdio_t *stdio_calls ); 00188 int unhook_stdio_calls(); 00189 00190 #ifdef __cplusplus 00191 } 00192 #endif 00193 00196 #endif