repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
teddycloud
github_2023
toniebox-reverse-engineering
c
test_gpt_header
static int test_gpt_header ( /* 0:Invalid, 1:Valid */ const BYTE* gpth /* Pointer to the GPT header */ ) { UINT i; DWORD bcc, hlen; if (memcmp(gpth + GPTH_Sign, "EFI PART" "\0\0\1", 12)) return 0; /* Check signature and version (1.0) */ hlen = ld_dword(gpth + GPTH_Size); /* Check header size */ if (hlen ...
/* Check validity of GPT header */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3239-L3258
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
make_rand
static DWORD make_rand ( DWORD seed, /* Seed value */ BYTE *buff, /* Output buffer */ UINT n /* Data length */ ) { UINT r; if (seed == 0) seed = 1; do { for (r = 0; r < 8; r++) seed = seed & 1 ? seed >> 1 ^ 0xA3000000 : seed >> 1; /* Shift 8 bits the 32-bit LFSR */ *buff++ = (BYTE)seed; } while (--n); ...
/* Generate random value */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3263-L3278
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
check_fs
static UINT check_fs ( /* 0:FAT/FAT32 VBR, 1:exFAT VBR, 2:Not FAT and valid BS, 3:Not FAT and invalid BS, 4:Disk error */ FATFS* fs, /* Filesystem object */ LBA_t sect /* Sector to load and check if it is an FAT-VBR or not */ ) { WORD w, sign; BYTE b; fs->wflag = 0; fs->winsect = (LBA_t)0 - 1; /* Invaidate ...
/*-----------------------------------------------------------------------*/ /* Load a sector and check if it is an FAT VBR */ /*-----------------------------------------------------------------------*/ /* Check what the sector is */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3291-L3325
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
find_volume
static UINT find_volume ( /* Returns BS status found in the hosting drive */ FATFS* fs, /* Filesystem object */ UINT part /* Partition to fined = 0:find as SFD and partitions, >0:forced partition number */ ) { UINT fmt, i; DWORD mbr_pt[4]; fmt = check_fs(fs, 0); /* Load sector 0 and check if it is an FAT VB...
/* Find an FAT volume */ /* (It supports only generic partitioning rules, MBR, GPT and SFD) */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3331-L3376
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
mount_volume
static FRESULT mount_volume ( /* FR_OK(0): successful, !=0: an error occurred */ const TCHAR** path, /* Pointer to pointer to the path name (drive number) */ FATFS** rfs, /* Pointer to pointer to the found filesystem object */ BYTE mode /* Desiered access mode to check write protection */ ) { int vol; FAT...
/*-----------------------------------------------------------------------*/ /* Determine logical drive number and mount the volume if needed */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3385-L3604
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
validate
static FRESULT validate ( /* Returns FR_OK or FR_INVALID_OBJECT */ FFOBJID* obj, /* Pointer to the FFOBJID, the 1st member in the FIL/DIR structure, to check validity */ FATFS** rfs /* Pointer to pointer to the owner filesystem object to return */ ) { FRESULT res = FR_INVALID_OBJECT; if (obj && obj->fs && ob...
/*-----------------------------------------------------------------------*/ /* Check if the file/directory object is valid or not */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3613-L3640
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_mount
FRESULT f_mount ( FATFS* fs, /* Pointer to the filesystem object to be registered (NULL:unmount)*/ const TCHAR* path, /* Logical drive number to be mounted/unmounted */ BYTE opt /* Mount option: 0=Do not mount (delayed mount), 1=Mount immediately */ ) { FATFS *cfs; int vol; FRESULT res; const TCHAR *rp = pat...
/*--------------------------------------------------------------------------- Public Functions (FatFs API) ----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/ /* Mount/Unmount a Logical Drive ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3657-L3708
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_open
FRESULT f_open ( FIL* fp, /* Pointer to the blank file object */ const TCHAR* path, /* Pointer to the file name */ BYTE mode /* Access mode and open mode flags */ ) { FRESULT res; DIR dj; FATFS *fs; #if !FF_FS_READONLY DWORD cl, bcs, clst, tm; LBA_t sc; FSIZE_t ofs; #endif DEF_NAMBUF if (!fp) return FR...
/*-----------------------------------------------------------------------*/ /* Open or Create a File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3717-L3905
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_read
FRESULT f_read ( FIL* fp, /* Open file to be read */ void* buff, /* Data buffer to store the read data */ UINT btr, /* Number of bytes to read */ UINT* br /* Number of bytes read */ ) { FRESULT res; FATFS *fs; DWORD clst; LBA_t sect; FSIZE_t remain; UINT rcnt, cc, csect; BYTE *rbuff = (BYTE*)buff; *br = ...
/*-----------------------------------------------------------------------*/ /* Read File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L3914-L4004
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_write
FRESULT f_write ( FIL* fp, /* Open file to be written */ const void* buff, /* Data to be written */ UINT btw, /* Number of bytes to write */ UINT* bw /* Number of bytes written */ ) { FRESULT res; FATFS *fs; DWORD clst; LBA_t sect; UINT wcnt, cc, csect; const BYTE *wbuff = (const BYTE*)buff; *bw = 0;...
/*-----------------------------------------------------------------------*/ /* Write File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4014-L4126
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_sync
FRESULT f_sync ( FIL* fp /* Open file to be synced */ ) { FRESULT res; FATFS *fs; DWORD tm; BYTE *dir; res = validate(&fp->obj, &fs); /* Check validity of the file object */ if (res == FR_OK) { if (fp->flag & FA_MODIFIED) { /* Is there any change to the file? */ #if !FF_FS_TINY if (fp->flag & FA_DIRTY) {...
/*-----------------------------------------------------------------------*/ /* Synchronize the File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4135-L4205
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_close
FRESULT f_close ( FIL* fp /* Open file to be closed */ ) { FRESULT res; FATFS *fs; #if !FF_FS_READONLY res = f_sync(fp); /* Flush cached data */ if (res == FR_OK) #endif { res = validate(&fp->obj, &fs); /* Lock volume */ if (res == FR_OK) { #if FF_FS_LOCK res = dec_share(fp->obj.lockid); /* Decremen...
/* !FF_FS_READONLY */ /*-----------------------------------------------------------------------*/ /* Close File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4216-L4242
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_chdrive
FRESULT f_chdrive ( const TCHAR* path /* Drive number to set */ ) { int vol; /* Get logical drive number */ vol = get_ldnumber(&path); if (vol < 0) return FR_INVALID_DRIVE; CurrVol = (BYTE)vol; /* Set it as current volume */ return FR_OK; }
/*-----------------------------------------------------------------------*/ /* Change Current Directory or Current Drive, Get Current Directory */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4252-L4265
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_lseek
FRESULT f_lseek ( FIL* fp, /* Pointer to the file object */ FSIZE_t ofs /* File pointer from top of file */ ) { FRESULT res; FATFS *fs; DWORD clst, bcs; LBA_t nsect; FSIZE_t ifptr; #if FF_USE_FASTSEEK DWORD cl, pcl, ncl, tcl, tlen, ulen; DWORD *tbl; LBA_t dsc; #endif res = validate(&fp->obj, &fs); /* Che...
/*-----------------------------------------------------------------------*/ /* Seek File Read/Write Pointer */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4433-L4588
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_opendir
FRESULT f_opendir ( DIR* dp, /* Pointer to directory object to create */ const TCHAR* path /* Pointer to the directory path */ ) { FRESULT res; FATFS *fs; DEF_NAMBUF if (!dp) return FR_INVALID_OBJECT; /* Get logical drive */ res = mount_volume(&path, &fs, 0); if (res == FR_OK) { dp->obj.fs = fs; INIT_...
/*-----------------------------------------------------------------------*/ /* Create a Directory Object */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4597-L4654
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_closedir
FRESULT f_closedir ( DIR *dp /* Pointer to the directory object to be closed */ ) { FRESULT res; FATFS *fs; res = validate(&dp->obj, &fs); /* Check validity of the file object */ if (res == FR_OK) { #if FF_FS_LOCK if (dp->obj.lockid) res = dec_share(dp->obj.lockid); /* Decrement sub-directory open counter */ ...
/*-----------------------------------------------------------------------*/ /* Close Directory */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4663-L4684
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_readdir
FRESULT f_readdir ( DIR* dp, /* Pointer to the open directory object */ FILINFO* fno /* Pointer to file information to return */ ) { FRESULT res; FATFS *fs; DEF_NAMBUF res = validate(&dp->obj, &fs); /* Check validity of the directory object */ if (res == FR_OK) { if (!fno) { res = dir_sdi(dp, 0); /* R...
/*-----------------------------------------------------------------------*/ /* Read Directory Entries in Sequence */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4693-L4720
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_findnext
FRESULT f_findnext ( DIR* dp, /* Pointer to the open directory object */ FILINFO* fno /* Pointer to the file information structure */ ) { FRESULT res; for (;;) { res = f_readdir(dp, fno); /* Get a directory item */ if (res != FR_OK || !fno || !fno->fname[0]) break; /* Terminate if any error or end of direct...
/*-----------------------------------------------------------------------*/ /* Find Next File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4729-L4746
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_findfirst
FRESULT f_findfirst ( DIR* dp, /* Pointer to the blank directory object */ FILINFO* fno, /* Pointer to the file information structure */ const TCHAR* path, /* Pointer to the directory to open */ const TCHAR* pattern /* Pointer to the matching pattern */ ) { FRESULT res; dp->pat = pattern; /* Save pointer...
/*-----------------------------------------------------------------------*/ /* Find First File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4754-L4770
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_stat
FRESULT f_stat ( const TCHAR* path, /* Pointer to the file path */ FILINFO* fno /* Pointer to file information to return */ ) { FRESULT res; DIR dj; DEF_NAMBUF /* Get logical drive */ res = mount_volume(&path, &dj.obj.fs, 0); if (res == FR_OK) { INIT_NAMBUF(dj.obj.fs); res = follow_path(&dj, path); /* Fo...
/*-----------------------------------------------------------------------*/ /* Get File Status */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4781-L4807
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_getfree
FRESULT f_getfree ( const TCHAR* path, /* Logical drive number */ DWORD* nclst, /* Pointer to a variable to return number of free clusters */ FATFS** fatfs /* Pointer to return pointer to corresponding filesystem object */ ) { FRESULT res; FATFS *fs; DWORD nfree, clst, stat; LBA_t sect; UINT i; FFOBJID obj; ...
/*-----------------------------------------------------------------------*/ /* Get Number of Free Clusters */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4816-L4903
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_truncate
FRESULT f_truncate ( FIL* fp /* Pointer to the file object */ ) { FRESULT res; FATFS *fs; DWORD ncl; res = validate(&fp->obj, &fs); /* Check validity of the file object */ if (res != FR_OK || (res = (FRESULT)fp->err) != FR_OK) LEAVE_FF(fs, res); if (!(fp->flag & FA_WRITE)) LEAVE_FF(fs, FR_DENIED); /* Check ac...
/*-----------------------------------------------------------------------*/ /* Truncate File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4912-L4953
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_unlink
FRESULT f_unlink ( const TCHAR* path /* Pointer to the file or directory path */ ) { FRESULT res; FATFS *fs; DIR dj, sdj; DWORD dclst = 0; #if FF_FS_EXFAT FFOBJID obj; #endif DEF_NAMBUF /* Get logical drive */ res = mount_volume(&path, &fs, FA_WRITE); if (res == FR_OK) { dj.obj.fs = fs; INIT_NAMBUF(fs)...
/*-----------------------------------------------------------------------*/ /* Delete a File/Directory */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L4962-L5047
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_mkdir
FRESULT f_mkdir ( const TCHAR* path /* Pointer to the directory path */ ) { FRESULT res; FATFS *fs; DIR dj; FFOBJID sobj; DWORD dcl, pcl, tm; DEF_NAMBUF res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ if (res == FR_OK) { dj.obj.fs = fs; INIT_NAMBUF(fs); res = follow_path(&dj, path); ...
/*-----------------------------------------------------------------------*/ /* Create a Directory */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5056-L5131
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_rename
FRESULT f_rename ( const TCHAR* path_old, /* Pointer to the object name to be renamed */ const TCHAR* path_new /* Pointer to the new name */ ) { FRESULT res; FATFS *fs; DIR djo, djn; BYTE buf[FF_FS_EXFAT ? SZDIRE * 2 : SZDIRE], *dir; LBA_t sect; DEF_NAMBUF get_ldnumber(&path_new); /* Snip the drive numb...
/*-----------------------------------------------------------------------*/ /* Rename a File/Directory */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5140-L5236
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_chmod
FRESULT f_chmod ( const TCHAR* path, /* Pointer to the file path */ BYTE attr, /* Attribute bits */ BYTE mask /* Attribute mask to change */ ) { FRESULT res; FATFS *fs; DIR dj; DEF_NAMBUF res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ if (res == FR_OK) { dj.obj.fs = fs; INIT_NAMBUF...
/*-----------------------------------------------------------------------*/ /* Change Attribute */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5250-L5288
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_utime
FRESULT f_utime ( const TCHAR* path, /* Pointer to the file/directory name */ const FILINFO* fno /* Pointer to the timestamp to be set */ ) { FRESULT res; FATFS *fs; DIR dj; DEF_NAMBUF res = mount_volume(&path, &fs, FA_WRITE); /* Get logical drive */ if (res == FR_OK) { dj.obj.fs = fs; INIT_NAMBUF(fs); ...
/*-----------------------------------------------------------------------*/ /* Change Timestamp */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5297-L5333
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_getlabel
FRESULT f_getlabel ( const TCHAR* path, /* Logical drive number */ TCHAR* label, /* Buffer to store the volume label */ DWORD* vsn /* Variable to store the volume serial number */ ) { FRESULT res; FATFS *fs; DIR dj; UINT si, di; WCHAR wc; /* Get logical drive */ res = mount_volume(&path, &fs, 0); /* Get...
/*-----------------------------------------------------------------------*/ /* Get Volume Label */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5344-L5436
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_setlabel
FRESULT f_setlabel ( const TCHAR* label /* Volume label to set with heading logical drive number */ ) { FRESULT res; FATFS *fs; DIR dj; BYTE dirvn[22]; UINT di; WCHAR wc; static const char badchr[18] = "+.,;=[]" "/*:<>|\\\"\?\x7F"; /* [0..16] for FAT, [7..16] for exFAT */ #if FF_USE_LFN DWORD dc; #endif /* G...
/*-----------------------------------------------------------------------*/ /* Set Volume Label */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5445-L5553
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_expand
FRESULT f_expand ( FIL* fp, /* Pointer to the file object */ FSIZE_t fsz, /* File size to be expanded to */ BYTE opt /* Operation mode 0:Find and prepare or 1:Find and allocate */ ) { FRESULT res; FATFS *fs; DWORD n, clst, stcl, scl, ncl, tcl, lclst; res = validate(&fp->obj, &fs); /* Check validity of the f...
/*-----------------------------------------------------------------------*/ /* Allocate a Contiguous Blocks to the File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5565-L5650
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_forward
FRESULT f_forward ( FIL* fp, /* Pointer to the file object */ UINT (*func)(const BYTE*,UINT), /* Pointer to the streaming function */ UINT btf, /* Number of bytes to forward */ UINT* bf /* Pointer to number of bytes forwarded */ ) { FRESULT res; FATFS *fs; DWORD clst; LBA_t sect; FSIZE_t remain...
/*-----------------------------------------------------------------------*/ /* Forward Data to the Stream Directly */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5661-L5722
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
create_partition
static FRESULT create_partition ( BYTE drv, /* Physical drive number */ const LBA_t plst[], /* Partition list */ BYTE sys, /* System ID for each partition (for only MBR) */ BYTE *buf /* Working buffer for a sector */ ) { UINT i, cy; LBA_t sz_drv; DWORD sz_drv32, nxt_alloc32, sz_part32; BYTE *pte; BYTE hd...
/* Create partitions on the physical drive in format of MBR or GPT */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L5739-L5878
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_fdisk
FRESULT f_fdisk ( BYTE pdrv, /* Physical drive number */ const LBA_t ptbl[], /* Pointer to the size table for each partitions */ void* work /* Pointer to the working buffer (null: use heap memory) */ ) { BYTE *buf = (BYTE*)work; DSTATUS stat; FRESULT res; /* Initialize the physical drive */ stat = disk_in...
/*-----------------------------------------------------------------------*/ /* Create Partition Table on the Physical Drive */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6386-L6410
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
putc_bfd
static void putc_bfd (putbuff* pb, TCHAR c) { UINT n; int i, nc; #if FF_USE_LFN && FF_LFN_UNICODE WCHAR hs, wc; #if FF_LFN_UNICODE == 2 DWORD dc; const TCHAR* tp; #endif #endif if (FF_USE_STRFUNC == 2 && c == '\n') { /* LF -> CRLF conversion */ putc_bfd(pb, '\r'); } i = pb->idx; /* Write index of pb->buf...
/* Buffered file write with code conversion */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6578-L6704
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
putc_flush
static int putc_flush (putbuff* pb) { UINT nw; if ( pb->idx >= 0 /* Flush buffered characters to the file */ && f_write(pb->fp, pb->buf, (UINT)pb->idx, &nw) == FR_OK && (UINT)pb->idx == nw) return pb->nchr; return -1; }
/* Flush remaining characters in the buffer */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6709-L6717
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
putc_init
static void putc_init (putbuff* pb, FIL* fp) { memset(pb, 0, sizeof (putbuff)); pb->fp = fp; }
/* Initialize write buffer */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6722-L6726
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_puts
int f_puts ( const TCHAR* str, /* Pointer to the string to be output */ FIL* fp /* Pointer to the file object */ ) { putbuff pb; putc_init(&pb, fp); while (*str) putc_bfd(&pb, *str++); /* Put the string */ return putc_flush(&pb); }
/*-----------------------------------------------------------------------*/ /* Put a String to the File */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6750-L6761
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_printf
int f_printf ( FIL* fp, /* Pointer to the file object */ const TCHAR* fmt, /* Pointer to the format string */ ... /* Optional arguments... */ ) { va_list arp; putbuff pb; UINT i, j, w, f, r; int prec; #if FF_PRINT_LLI && FF_INTDEF == 2 QWORD v; #else DWORD v; #endif TCHAR *tp; TCHAR tc, pad; TCHAR nul...
/* FF_PRINT_FLOAT && FF_INTDEF == 2 */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L6893-L7049
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
f_setcp
FRESULT f_setcp ( WORD cp /* Value to be set as active code page */ ) { static const WORD validcp[22] = { 437, 720, 737, 771, 775, 850, 852, 855, 857, 860, 861, 862, 863, 864, 865, 866, 869, 932, 936, 949, 950, 0}; static const BYTE *const tables[22] = {Ct437, Ct720, C...
/*-----------------------------------------------------------------------*/ /* Set Active Codepage for the Path Name */ /*-----------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ff.c#L7061-L7082
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ff_mutex_create
int ff_mutex_create ( /* Returns 1:Function succeeded or 0:Could not create the mutex */ int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */ ) { #if OS_TYPE == 0 /* Win32 */ Mutex[vol] = CreateMutex(NULL, FALSE, NULL); return (int)(Mutex[vol] != INVALID_HANDLE_VALUE); #elif OS...
/*------------------------------------------------------------------------*/ /* Create a Mutex */ /*------------------------------------------------------------------------*/ /* This function is called in f_mount function to create a new mutex / or semaphore for ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ffsystem.c#L79-L110
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ff_mutex_delete
void ff_mutex_delete ( /* Returns 1:Function succeeded or 0:Could not delete due to an error */ int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */ ) { #if OS_TYPE == 0 /* Win32 */ CloseHandle(Mutex[vol]); #elif OS_TYPE == 1 /* uITRON */ del_mtx(Mutex[vol]); #elif OS_TYPE == ...
/*------------------------------------------------------------------------*/ /* Delete a Mutex */ /*------------------------------------------------------------------------*/ /* This function is called in f_mount function to delete a mutex or / semaphore of the v...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ffsystem.c#L120-L142
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ff_mutex_take
int ff_mutex_take ( /* Returns 1:Succeeded or 0:Timeout */ int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */ ) { #if OS_TYPE == 0 /* Win32 */ return (int)(WaitForSingleObject(Mutex[vol], FF_FS_TIMEOUT) == WAIT_OBJECT_0); #elif OS_TYPE == 1 /* uITRON */ return (int)(tloc_mtx(M...
/*------------------------------------------------------------------------*/ /* Request a Grant to Access the Volume */ /*------------------------------------------------------------------------*/ /* This function is called on enter file functions to lock the volume. / When a 0 is ret...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ffsystem.c#L152-L175
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ff_mutex_give
void ff_mutex_give ( int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */ ) { #if OS_TYPE == 0 /* Win32 */ ReleaseMutex(Mutex[vol]); #elif OS_TYPE == 1 /* uITRON */ unl_mtx(Mutex[vol]); #elif OS_TYPE == 2 /* uC/OS-II */ OSMutexPost(Mutex[vol]); #elif OS_TYPE == 3 /* FreeRTOS ...
/*------------------------------------------------------------------------*/ /* Release a Grant to Access the Volume */ /*------------------------------------------------------------------------*/ /* This function is called on leave file functions to unlock the volume. */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ffsystem.c#L185-L205
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ff_wtoupper
DWORD ff_wtoupper ( /* Returns up-converted code point */ DWORD uni /* Unicode code point to be up-converted */ ) { const WORD* p; WORD uc, bc, nc, cmd; static const WORD cvt1[] = { /* Compressed up conversion table for U+0000 - U+0FFF */ /* Basic Latin */ 0x0061,0x031A, /* Latin-1 Supplement */ 0x00E0,0x0...
/*------------------------------------------------------------------------*/ /* Unicode Up-case Conversion */ /*------------------------------------------------------------------------*/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/fat/source/ffunicode.c#L15464-L15590
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
cache_stats
void cache_stats(cache_stats_t *stats) { if (stats == NULL) { return; } cache_entry_t *pos = &cache_table; memset(stats, 0, sizeof(cache_stats_t)); // Initialize all stats to zero while (pos != NULL) { stats->total_entries++; stats->memory_used += sizeof(*pos); // A...
/** * @brief Gathers statistics about the current cache. * * @param stats Pointer to a structure where the statistics will be stored. */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cache.c#L48-L88
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
process_nvs_item
static error_t process_nvs_item(FsFile *file, size_t offset, size_t part_offset, struct ESP32_nvs_item *item, char (*namespaces)[MAX_NAMESPACE_COUNT][MAX_KEY_SIZE]) { error_t error = NO_ERROR; if (item->nsIndex == 0) { TRACE_INFO(" Namespace %s\r\n", item->key); if (item->uint8 > MAX...
/** * @brief Processes a single NVS item. * * This function processes a single NVS item, updates its CRC if necessary, and * logs relevant information about the item. If the CRC check fails, the function * updates the CRC and returns an error code indicating the CRC mismatch. * * @param file Pointer to the file ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/esp32.c#L473-L656
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
esp32_fixup_nvs
error_t esp32_fixup_nvs(FsFile *file, size_t offset, size_t length, bool modify) { char namespaces[MAX_NAMESPACE_COUNT][MAX_KEY_SIZE] = {0}; for (size_t sector_offset = 0; sector_offset < length; sector_offset += NVS_SECTOR_SIZE) { error_t error; struct ESP32_nvs_page_header page_header; ...
/** * @brief Fixes up the NVS data. * * This function scans through the NVS data in the specified file, updates CRCs, * and logs relevant information about the NVS pages and items. * * @param file Pointer to the file to read/write. * @param offset Offset within the file. * @param length Length of the data to pr...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/esp32.c#L670-L748
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
mem_replace
uint32_t mem_replace(uint8_t *buffer, size_t buffer_len, const char *pattern, const char *replace) { int replaced = 0; size_t pattern_len = osStrlen(pattern) + 1; size_t replace_len = osStrlen(replace) + 1; if (pattern_len == 0 || buffer_len == 0) { return 0; } for (size_t i = 0; i...
/** * @brief Replaces all occurrences of a pattern string with a replacement string in a given buffer. * * This function searches the buffer for the C-string 'pattern' and replaces all its occurrences with the * C-string 'replace'. It doesn't check if the sizes of the two strings differ and overwrites the original ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/esp32.c#L1661-L1690
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
sanitizePath
void sanitizePath(char *path, bool isDir) { size_t i, j; bool slash = false; pathCanonicalize(path); /* Merge all double (or more) slashes // */ for (i = 0, j = 0; path[i]; ++i) { if (path[i] == PATH_SEPARATOR) { if (slash) continue; slas...
/* sanitizes the path - needs two additional characters in worst case, so make sure 'path' has enough space */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/handler_api.c#L48-L97
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
mqtt_publish
bool mqtt_publish(const char *item_topic, const char *content) { int entries = 0; bool success = false; mutex_lock(MUTEX_MQTT_TX_BUFFER); for (int pos = 0; pos < MQTT_TX_BUFFERS; pos++) { if (!mqtt_tx_buffers[pos].used) { /* found the first empty slot */ if (...
/** * @brief Publishes an MQTT message by placing it into a transmission buffer. * * This function attempts to queue an MQTT message for transmission based on the topic and content provided. * The function looks for an available slot in the transmission buffer or tries to find an existing message * with the same t...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/mqtt.c#L237-L284
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ipv4StringToAddr
error_t ipv4StringToAddr(const char_t *str, Ipv4Addr *ipAddr) { error_t error; int_t i = 0; int_t value = -1; // Parse input string while (1) { // Decimal digit found? if (osIsdigit(*str)) { // First digit to be decoded? if (value < 0) ...
/** * @brief Convert a dot-decimal string to a binary IPv4 address * @param[in] str NULL-terminated string representing the IPv4 address * @param[out] ipAddr Binary representation of the IPv4 address * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/server_helpers.c#L533-L610
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ipv6StringToAddr
error_t ipv6StringToAddr(const char_t *str, Ipv6Addr *ipAddr) { error_t error; int_t i = 0; int_t j = -1; int32_t value = -1; // Parse input string while (1) { // Hexadecimal digit found? if (isxdigit((uint8_t)*str)) { // First digit to be decoded? ...
/** * @brief Convert a string representation of an IPv6 address to a binary IPv6 address * @param[in] str NULL-terminated string representing the IPv6 address * @param[out] ipAddr Binary representation of the IPv6 address * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/server_helpers.c#L619-L755
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
ipStringToAddr
error_t ipStringToAddr(const char_t *str, IpAddr *ipAddr) { error_t error; #if (IPV6_SUPPORT == ENABLED) // IPv6 address? if (osStrchr(str, ':') != NULL) { // IPv6 addresses are 16-byte long ipAddr->length = sizeof(Ipv6Addr); // Convert the string to IPv6 address error =...
/** * @brief Convert a string representation of an IP address to a binary IP address * @param[in] str NULL-terminated string representing the IP address * @param[out] ipAddr Binary representation of the IP address * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/server_helpers.c#L764-L798
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
settings_load_all_certs
void settings_load_all_certs() { for (size_t id = 0; id < MAX_OVERLAYS; id++) { settings_load_certs_id(id); } }
/* unused? */
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/settings.c#L1622-L1628
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
der_get_length
error_t der_get_length(FsFile *fp, size_t *outLength) { uint8_t derLen; size_t len; error_t err = fsReadFile(fp, &derLen, 1, &len); if (err != NO_ERROR || len != 1) { *outLength = 0; return err; } if ((derLen & 0x80) == 0) { *outLength = derLen; // Short form ...
/** * @brief Reads a length field from ASN.1 DER data * * This function reads a length field from ASN.1 DER data from the given file. * The length is encoded either in short form (single byte) or long form * (multiple bytes with the high bit set in the first byte). * * @param[in] fp The file to read from * @ret...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/tls_adapter.c#L52-L86
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
der_detect
error_t der_detect(const char *filename, eDerType *type) { error_t ret = NO_ERROR; *type = eDerTypeUnknown; FsFile *fp = fsOpenFile(filename, FS_FILE_MODE_READ); if (!fp) { return ERROR_FAILURE; } /* while loop to break out and clean up commonly */ do { uint8_t tag;...
/** * @brief Determines the type of DER data in a file * * This function attempts to determine whether the given file contains * an X.509 certificate or an RSA private key encoded in ASN.1 DER format. * The type is determined based on the first few bytes of the data. * * @param[in] filename The name of the file ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/tls_adapter.c#L98-L161
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
read_certificate
error_t read_certificate(const char_t *filename, char_t **buffer, size_t *length) { error_t error; // Initialize output parameters *buffer = NULL; *length = 0; if (!filename) { TRACE_ERROR("Filename NULL\r\n"); return ERROR_READ_FAILED; } const char_t *type = NULL; ...
/** * @brief Load the specified PEM file * @param[in] filename Name of the PEM file to load * @param[out] buffer Memory buffer that holds the contents of the file * @param[out] length Length of the file in bytes **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/tls_adapter.c#L169-L306
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
tlsParseCertificateList
error_t tlsParseCertificateList(TlsContext *context, const uint8_t *p, size_t length) { error_t error; error_t certValidResult; uint_t i; size_t n; const char_t *subjectName; X509CertInfo *certInfo; X509CertInfo *issuerCertInfo; // Initialize X.509 certif...
/** * @brief Parse certificate chain * @param[in] context Pointer to the TLS context * @param[in] p Input stream where to read the certificate chain * @param[in] length Number of bytes available in the input stream * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/tls_adapter.c#L454-L759
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
debugDisplayArray
void debugDisplayArray(FILE *stream, const char_t *prepend, const void *data, size_t length) { uint_t i; //Dump the contents of the array for(i = 0; i < length; i++) { //Beginning of a new line? if((i % 16) == 0) { TRACE_PRINTF("%s", prepend); } //Display current ...
/** * @brief Display the contents of an array * @param[in] stream Pointer to a FILE object that identifies an output stream * @param[in] prepend String to prepend to the left of each line * @param[in] data Pointer to the data array * @param[in] length Number of bytes to display **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/debug.c#L89-L112
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsInit
error_t fsInit(void) { // Successful processing return NO_ERROR; }
/** * @brief File system initialization * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L93-L97
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsFileExists
bool_t fsFileExists(const char_t *path) { error_t error; bool_t found; FsFileStat fileStat; // Clear flag found = FALSE; // Make sure the pathname is valid if (path != NULL) { // Retrieve the attributes of the specified file error = fsGetFileStat(path, &fileStat); // Check w...
/** * @brief Check whether a file exists * @param[in] path NULL-terminated string specifying the filename * @return The function returns TRUE if the file exists. Otherwise FALSE is returned **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L105-L133
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsGetFileSize
error_t fsGetFileSize(const char_t *path, uint32_t *size) { error_t error; FsFileStat fileStat; // Check parameters if (path == NULL || size == NULL) { return ERROR_INVALID_PARAMETER; } // Retrieve the attributes of the specified file error = fsGetFileStat(path, &fileStat); // Check ...
/** * @brief Retrieve the size of the specified file * @param[in] path NULL-terminated string specifying the filename * @param[out] size Size of the file in bytes * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L142-L165
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsGetFileStat
error_t fsGetFileStat(const char_t *path, FsFileStat *fileStat) { error_t error = NO_ERROR; wchar_t wpath[FS_MAX_PATH_LEN + 1]; WIN32_FILE_ATTRIBUTE_DATA fad; strConvertToWchar(path, wpath, FS_MAX_PATH_LEN); if (!GetFileAttributesExW(wpath, GetFileExInfoStandard, &fad)) { error = GetLastError(...
/** * @brief Retrieve the attributes of the specified file * @param[in] path NULL-terminated string specifying the filename * @param[out] fileStat File attributes * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L173-L206
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsRenameFile
error_t fsRenameFile(const char_t *oldPath, const char_t *newPath) { error_t error; int_t ret; // Check parameters if (oldPath == NULL || newPath == NULL) { return ERROR_INVALID_PARAMETER; } // Rename the specified file ret = rename(oldPath, newPath); // On success, zero is returned ...
/** * @brief Rename the specified file * @param[in] oldPath NULL-terminated string specifying the pathname of the file to be renamed * @param[in] newPath NULL-terminated string specifying the new filename * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L215-L241
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsDeleteFile
error_t fsDeleteFile(const char_t *path) { error_t error; int_t ret; // Make sure the pathname is valid if (path == NULL) { return ERROR_INVALID_PARAMETER; } // Delete the specified file ret = remove(path); // On success, zero is returned if (ret == 0) { error = NO_ERROR;...
/** * @brief Delete a file * @param[in] path NULL-terminated string specifying the filename * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L249-L275
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsSeekFile
error_t fsSeekFile(FsFile *file, int_t offset, uint_t origin) { error_t error; int_t ret; // Make sure the file pointer is valid if (file == NULL) { return ERROR_INVALID_PARAMETER; } // The origin is used as reference for the offset if (origin == FS_SEEK_CUR) { // The offset is ...
/** * @brief Move to specified position in file * @param[in] file Handle that identifies the file * @param[in] offset Number of bytes to move from origin * @param[in] origin Position used as reference for the offset (FS_SEEK_SET, * FS_SEEK_CUR or FS_SEEK_END) * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L306-L349
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsWriteFile
error_t fsWriteFile(FsFile *file, void *data, size_t length) { if (file == NULL) { return ERROR_INVALID_PARAMETER; } size_t written = fwrite(data, length, 1, file); if (written != 1) { return ERROR_FAILURE; } return NO_ERROR; }
/** * @brief Write data to the specified file * @param[in] file Handle that identifies the file to be written * @param[in] data Pointer to a buffer containing the data to be written * @param[in] length Number of data bytes to write * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L359-L374
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsReadFile
error_t fsReadFile(FsFile *file, void *data, size_t size, size_t *length) { if (file == NULL || length == NULL) { return ERROR_INVALID_PARAMETER; } size_t n = fread(data, 1, size, file); *length = n; if (n == 0) { return ERROR_END_OF_FILE; } return NO_ERROR; }
/** * @brief Read data from the specified file * @param[in] file Handle that identifies the file to be read * @param[in] data Pointer to the buffer where to copy the data * @param[in] size Size of the buffer, in bytes * @param[out] length Number of data bytes that have been read * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L385-L402
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsCloseFile
void fsCloseFile(FsFile *file) { // Make sure the file pointer is valid if (file != NULL) { // Close the specified file fclose(file); } }
/** * @brief Close a file * @param[in] file Handle that identifies the file to be closed **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L409-L417
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsDirExists
bool_t fsDirExists(const char_t *path) { error_t error; bool_t found; FsFileStat fileStat; // Clear flag found = FALSE; // Retrieve the attributes of the specified file error = fsGetFileStat(path, &fileStat); // Check whether the file exists if (!error) { // Valid directory? ...
/** * @brief Check whether a directory exists * @param[in] path NULL-terminated string specifying the directory path * @return The function returns TRUE if the directory exists. Otherwise FALSE is returned **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L425-L449
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsCreateDir
error_t fsCreateDir(const char_t *path) { error_t error; int_t ret; // Make sure the pathname is valid if (path == NULL) { return ERROR_INVALID_PARAMETER; } // Create a new directory #ifdef _WIN32 ret = _mkdir(path); #else ret = mkdir(path, 0777); #endif // On success, zero is ret...
/** * @brief Create a directory * @param[in] path NULL-terminated string specifying the directory path * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L457-L487
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsRemoveDir
error_t fsRemoveDir(const char_t *path) { error_t error; int_t ret; // Make sure the pathname is valid if (path == NULL) { return ERROR_INVALID_PARAMETER; } // Remove the specified directory #ifdef _WIN32 ret = _rmdir(path); #else ret = rmdir(path); #endif // On success, zero is r...
/** * @brief Remove a directory * @param[in] path NULL-terminated string specifying the directory path * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L495-L525
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsReadDir
error_t fsReadDir(FsDir *dir, FsDirEntry *dirEntry) { error_t error; int_t ret; struct dirent *entry; struct stat fileStat; char_t path[FS_MAX_PATH_LEN + 1]; wchar_t wpath[FS_MAX_PATH_LEN + 1]; // Check parameters if (dir == NULL || dirEntry == NULL) { return ERROR_INVALID_PARAMETER; ...
/** * @brief Read an entry from the specified directory stream * @param[in] dir Handle that identifies the directory * @param[out] dirEntry Pointer to a directory entry * @return Error code **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L552-L639
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
fsCloseDir
void fsCloseDir(FsDir *dir) { // Make sure the directory pointer is valid if (dir != NULL) { // Close the specified directory FindClose(dir->handle); // Release directory descriptor osFreeMem(dir); } }
/** * @brief Close a directory stream * @param[in] dir Handle that identifies the directory to be closed **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/fs_port_windows.c#L646-L657
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osInitKernel
void osInitKernel(void) { //Not implemented }
/** * @brief Kernel initialization **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L54-L57
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osStartKernel
void osStartKernel(void) { //Not implemented }
/** * @brief Start kernel **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L64-L67
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osCreateTask
OsTaskId osCreateTask(const char_t *name, OsTaskCode taskCode, void *param, size_t stackSize, int_t priority) { int_t ret; pthread_t thread; //Create a new thread ret = pthread_create(&thread, NULL, (PthreadTaskCode) taskCode, param); //Return a pointer to the newly created thread if(ret == 0) ...
/** * @brief Create a task * @param[in] name A name identifying the task * @param[in] taskCode Pointer to the task entry function * @param[in] param A pointer to a variable to be passed to the task * @param[in] stackSize The initial size of the stack, in words * @param[in] priority The priority at which the task ...
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L80-L98
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osDeleteTask
void osDeleteTask(OsTaskId taskId) { //Delete the calling thread? if(taskId == OS_SELF_TASK_ID) { //Kill ourselves pthread_exit(NULL); } else { pthread_t thread = (pthread_t)taskId; pthread_cancel(thread); } }
/** * @brief Delete a task * @param[in] taskId Task identifier referencing the task to be deleted **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L106-L120
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osDelayTask
void osDelayTask(systime_t delay) { //Delay the task for the specified duration usleep(delay * 1000); }
/** * @brief Delay routine * @param[in] delay Amount of time for which the calling task should block **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L127-L131
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osSwitchTask
void osSwitchTask(void) { //Not implemented }
/** * @brief Yield control to the next task **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L138-L141
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osSuspendAllTasks
void osSuspendAllTasks(void) { pthread_once(&init_once, osMutexInit); pthread_mutex_lock(&mutex); }
/** * @brief Suspend scheduler activity **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L158-L162
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osResumeAllTasks
void osResumeAllTasks(void) { pthread_mutex_unlock(&mutex); }
/** * @brief Resume scheduler activity **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L167-L170
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osCreateEvent
bool_t osCreateEvent(OsEvent *event) { int_t ret; //Create a semaphore object ret = sem_init(event, 0, 0); //Check whether the semaphore was successfully created if(ret == 0) { return TRUE; } else { return FALSE; } }
/** * @brief Create an event object * @param[in] event Pointer to the event object * @return The function returns TRUE if the event object was successfully * created. Otherwise, FALSE is returned **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L180-L196
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osDeleteEvent
void osDeleteEvent(OsEvent *event) { //Properly dispose the event object sem_destroy(event); }
/** * @brief Delete an event object * @param[in] event Pointer to the event object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L204-L208
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osSetEvent
void osSetEvent(OsEvent *event) { int_t ret; int_t value; //Get the current value of the semaphore ret = sem_getvalue(event, &value); //Nonsignaled state? if(ret == 0 && value == 0) { //Set the specified event to the signaled state sem_post(event); } }
/** * @brief Set the specified event object to the signaled state * @param[in] event Pointer to the event object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L216-L230
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osResetEvent
void osResetEvent(OsEvent *event) { int_t ret; //Force the specified event to the nonsignaled state do { //Decrement the semaphore's count by one ret = sem_trywait(event); //Check status } while(ret == 0); }
/** * @brief Set the specified event object to the nonsignaled state * @param[in] event Pointer to the event object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L238-L250
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osWaitForEvent
bool_t osWaitForEvent(OsEvent *event, systime_t timeout) { int_t ret; struct timespec ts; //Wait until the specified event is in the signaled state or the timeout //interval elapses if(timeout == 0) { //Non-blocking call ret = sem_trywait(event); } else if(timeout == INFINITE_DELAY)...
/** * @brief Wait until the specified event is in the signaled state * @param[in] event Pointer to the event object * @param[in] timeout Timeout interval * @return The function returns TRUE if the state of the specified object is * signaled. FALSE is returned if the timeout interval elapsed **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L261-L318
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osSetEventFromIsr
bool_t osSetEventFromIsr(OsEvent *event) { //Not implemented return FALSE; }
/** * @brief Set an event object to the signaled state from an interrupt service routine * @param[in] event Pointer to the event object * @return TRUE if setting the event to signaled state caused a task to unblock * and the unblocked task has a priority higher than the currently running task **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L328-L332
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osCreateSemaphore
bool_t osCreateSemaphore(OsSemaphore *semaphore, uint_t count) { int_t ret; //Create a semaphore object ret = sem_init(semaphore, 0, count); //Check whether the semaphore was successfully created if(ret == 0) { return TRUE; } else { return FALSE; } }
/** * @brief Create a semaphore object * @param[in] semaphore Pointer to the semaphore object * @param[in] count The maximum count for the semaphore object. This value * must be greater than zero * @return The function returns TRUE if the semaphore was successfully * created. Otherwise, FALSE is returned **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L344-L360
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osDeleteSemaphore
void osDeleteSemaphore(OsSemaphore *semaphore) { //Properly dispose the semaphore object sem_destroy(semaphore); }
/** * @brief Delete a semaphore object * @param[in] semaphore Pointer to the semaphore object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L368-L372
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osWaitForSemaphore
bool_t osWaitForSemaphore(OsSemaphore *semaphore, systime_t timeout) { int_t ret; struct timespec ts; //Wait until the semaphore is available or the timeout interval elapses if(timeout == 0) { //Non-blocking call ret = sem_trywait(semaphore); } else if(timeout == INFINITE_DELAY) { ...
/** * @brief Wait for the specified semaphore to be available * @param[in] semaphore Pointer to the semaphore object * @param[in] timeout Timeout interval * @return The function returns TRUE if the semaphore is available. FALSE is * returned if the timeout interval elapsed **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L383-L428
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osReleaseSemaphore
void osReleaseSemaphore(OsSemaphore *semaphore) { if (semaphore == NULL) { TRACE_ERROR("osReleaseSemaphore() failed because semaphore is NULL\r\n"); return; } //Release the semaphore sem_post(semaphore); }
/** * @brief Release the specified semaphore object * @param[in] semaphore Pointer to the semaphore object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L436-L445
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osCreateMutex
bool_t osCreateMutex(OsMutex *mutex) { int_t ret; //Create a mutex object ret = pthread_mutex_init(mutex, NULL); //Check whether the mutex was successfully created if(ret == 0) { return TRUE; } else { return FALSE; } }
/** * @brief Create a mutex object * @param[in] mutex Pointer to the mutex object * @return The function returns TRUE if the mutex was successfully * created. Otherwise, FALSE is returned **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L455-L471
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osDeleteMutex
void osDeleteMutex(OsMutex *mutex) { //Properly dispose the mutex object pthread_mutex_destroy(mutex); }
/** * @brief Delete a mutex object * @param[in] mutex Pointer to the mutex object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L479-L483
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osAcquireMutex
void osAcquireMutex(OsMutex *mutex) { //Obtain ownership of the mutex object pthread_mutex_lock(mutex); }
/** * @brief Acquire ownership of the specified mutex object * @param[in] mutex Pointer to the mutex object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L491-L495
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osReleaseMutex
void osReleaseMutex(OsMutex *mutex) { //Release ownership of the mutex object pthread_mutex_unlock(mutex); }
/** * @brief Release ownership of the specified mutex object * @param[in] mutex Pointer to the mutex object **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L503-L507
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osGetSystemTime
systime_t osGetSystemTime(void) { struct timeval tv; //Get current time gettimeofday(&tv, NULL); //Convert resulting value to milliseconds return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); }
/** * @brief Retrieve system time * @return Number of milliseconds elapsed since the system was last started **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L515-L524
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osFreeMem
__weak_func void osFreeMem(void *p) { //Free memory block free(p); }
/** * @brief Release a previously allocated memory block * @param[in] p Previously allocated memory block to be freed **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_posix.c#L546-L550
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osInitKernel
void osInitKernel(void) { //Not implemented }
/** * @brief Kernel initialization **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_windows.c#L53-L56
83d3b29cbfc74e8f76f48f8782646c8e464055b2
teddycloud
github_2023
toniebox-reverse-engineering
c
osStartKernel
void osStartKernel(void) { //Not implemented }
/** * @brief Start kernel **/
https://github.com/toniebox-reverse-engineering/teddycloud/blob/83d3b29cbfc74e8f76f48f8782646c8e464055b2/src/cyclone/common/os_port_windows.c#L63-L66
83d3b29cbfc74e8f76f48f8782646c8e464055b2