dirs refactoring
This commit is contained in:
118
modules/os_interface/os_interface.h
Normal file
118
modules/os_interface/os_interface.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* JTAG Boundary Scanner
|
||||
* Copyright (c) 2008 - 2024 Viveris Technologies
|
||||
*
|
||||
* JTAG Boundary Scanner is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
* JTAG Boundary Scanner is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License version 3 for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with JTAG Boundary Scanners; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file os_interface.h
|
||||
* @brief Basic/generic OS functions wrapper header.
|
||||
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#define FILEFOUND_NAMESIZE 256
|
||||
|
||||
/////////////// Thread functions ////////////////
|
||||
|
||||
#if 0
|
||||
typedef int (*THREADFUNCTION) (void* jtag_ctx,void* hw_ctx);
|
||||
|
||||
typedef struct threadinit_
|
||||
{
|
||||
THREADFUNCTION thread;
|
||||
jtag_core * jtag_ctx;
|
||||
void * hwcontext;
|
||||
}threadinit;
|
||||
#endif
|
||||
|
||||
typedef struct filefoundinfo_
|
||||
{
|
||||
int isdirectory;
|
||||
char filename[FILEFOUND_NAMESIZE];
|
||||
int size;
|
||||
}filefoundinfo;
|
||||
|
||||
int genos_setevent(unsigned char id );
|
||||
uintptr_t genos_createevent(unsigned char id );
|
||||
int genos_waitevent(int id, int timeout );
|
||||
void genos_pause( int ms );
|
||||
#if 0
|
||||
int genos_createthread(void* hwcontext, THREADFUNCTION thread, int priority );
|
||||
#endif
|
||||
|
||||
uintptr_t genos_createcriticalsection(unsigned char id );
|
||||
void genos_entercriticalsection(unsigned char id );
|
||||
void genos_leavecriticalsection(unsigned char id );
|
||||
void genos_destroycriticalsection(unsigned char id );
|
||||
|
||||
/////////////// String functions ///////////////
|
||||
|
||||
char * genos_strupper( char * str );
|
||||
char * genos_strlower( char * str );
|
||||
char * genos_strndstcat( char *dest, const char *src, size_t maxdestsize );
|
||||
|
||||
/////////////// File functions ////////////////
|
||||
|
||||
int genos_open ( const char *filename, int flags, ... );
|
||||
|
||||
FILE *genos_fopen ( const char *filename, const char *mode );
|
||||
int genos_fread( void * ptr, size_t size, FILE *f );
|
||||
char * genos_fgets( char * str, int num, FILE *f );
|
||||
int genos_fclose( FILE * f );
|
||||
int genos_fgetsize( FILE * f );
|
||||
#ifndef stat
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
int genos_stat( const char *filename, struct stat *buf );
|
||||
|
||||
void* genos_find_first_file( char *folder, char *file, filefoundinfo* fileinfo );
|
||||
int genos_find_next_file( void* handleff, char *folder, char *file, filefoundinfo* fileinfo );
|
||||
int genos_find_close( void* handle );
|
||||
|
||||
int genos_mkdir( char * folder );
|
||||
|
||||
char * genos_getcurrentdirectory( char *currentdirectory, int buffersize );
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_PATH_TYPE = 0,
|
||||
UNIX_PATH_TYPE,
|
||||
WINDOWS_PATH_TYPE,
|
||||
};
|
||||
|
||||
char * genos_getfilenamebase( char * fullpath, char * filenamebase, int type );
|
||||
char * genos_getfilenameext( char * fullpath, char * filenameext, int type );
|
||||
int genos_getfilenamewext( char * fullpath, char * filenamewext, int type );
|
||||
int genos_getpathfolder( char * fullpath, char * folder, int type );
|
||||
int genos_checkfileext( char * path, char *ext, int type );
|
||||
int genos_getfilesize( char * path );
|
||||
|
||||
/////////////// Network functions ////////////////
|
||||
|
||||
void * network_connect(char * address,unsigned short port);
|
||||
int network_read(void * network_connection, unsigned char * buffer, int size,int timeout);
|
||||
int network_read2(void * network_connection, unsigned char * buffer, int size,int timeout);
|
||||
int network_write(void * network_connection, unsigned char * buffer, int size,int timeout);
|
||||
int network_close(void * network_connection);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user