90 #ifndef UOSCFG_MAX_MOUNT 91 #define UOSCFG_MAX_MOUNT 2 124 #if defined(__MSP430__) && UOSCFG_SPIN_USECS == 2 126 #define uosSpinUSecs(t) __delay_cycles(PORTCFG_CPU_CLOCK_MHZ * (t)) 141 #if UOSCFG_SPI_BUS > 0 || DOX == 1 157 void (*control)(
struct uosSpiBus* bus,
bool fullSpeed);
158 void (*cs)(
struct uosSpiBus* bus,
bool select);
159 uint8_t (*xchg)(
const struct uosSpiBus* bus, uint8_t data);
160 void (*xmit)(
const struct uosSpiBus*,
const uint8_t* data,
int len);
161 void (*rcvr)(
const struct uosSpiBus*, uint8_t* data,
int len);
169 const UosSpiBusConf* cf;
179 #ifdef UOSCFG_SPI_CS_TYPE 180 UOSCFG_SPI_CS_TYPE cs;
189 const UosSpiDevConf* cf;
248 #if UOSCFG_MAX_OPEN_FILES > 0 || DOX == 1 250 #if !defined(UOSCFG_NEWLIB_SYSCALLS) || UOSCFG_NEWLIB_SYSCALLS == 0 255 #define O_APPEND 0x0008 256 #define O_CREAT 0x0200 257 #define O_TRUNC 0x0400 270 #define UOS_BITTAB_TABLE(type, size) \ 272 uint8_t bitmap[size / 8 + 1]; \ 280 #define UOS_BITTAB_INIT(bm) memset(&bm.bitmap, '\0', sizeof(bm.bitmap)) 286 #define UOS_BITTAB_SLOT(bm, elem) (elem == NULL ? -1 : (elem - bm.table)) 291 #define UOS_BITTAB_ELEM(bm, slot) (slot == -1 ? NULL : (bm.table + slot)) 296 #define UOS_BITTAB_ALLOC(bm) uosBitTabAlloc(bm.bitmap, sizeof(bm.table)/sizeof(bm.table[0])) 301 #define UOS_BITTAB_FREE(bm, slot) uosBitTabFree(bm.bitmap, slot) 306 #define UOS_BITTAB_IS_FREE(bm, slot) uosBitTabIsFree(bm.bitmap, slot) 343 int (*read)(
struct uosFile* file,
char* buf,
int max);
344 int (*write)(
struct uosFile* file,
const char* buf,
int len);
345 int (*close)(
struct uosFile* file);
347 int (*lseek)(
struct uosFile* file,
int offset,
int whence);
348 int (*sync)(
struct uosFile* file);
357 int (*init)(
const struct uosFS* mount);
358 int (*open)(
const struct uosFS* mount,
struct uosFile* file,
const char* filename,
int flags,
int mode);
359 int (*stat)(
const struct uosFS* mount,
const char* filename,
UosFileInfo* st);
360 int (*unlink)(
const struct uosFS* mount,
const char* name);
369 int (*init)(
const struct uosDisk* disk);
370 int (*status)(
const struct uosDisk* disk);
371 int (*read)(
const struct uosDisk* disk, uint8_t* buff,
int sector,
int count);
372 int (*write)(
const struct uosDisk* disk,
const uint8_t* buff,
int sector,
int count);
373 int (*ioctl)(
const struct uosDisk* disk, uint8_t cmd,
void* buff);
381 const UosDiskConf* cf;
390 const char* mountPoint;
398 const UosFileConf* cf;
493 #if UOSCFG_FAT > 0 || DOX == 1 498 int uosMountFat(
const char* mountPoint,
int diskNumber);
500 #if UOSCFG_FAT_MMC > 0 || DOX == 1 502 extern const UosDiskConf uosMmcDiskConf;
521 const UosMmcSpiConf* cf;
538 #if UOSCFG_FS_ROM > 0 || DOX == 1 541 const char* fileName;
542 const uint8_t* contents;
549 int uosMountRom(
const char* mountPoint,
const UosRomFile* data);
562 #if UOSCFG_RING > 0 || DOX == 1 569 typedef struct uosRing UosRing;
581 bool uosRingPut(UosRing* ring,
const void *msg, UINT_t timeout);
588 bool uosRingGet(UosRing* ring,
void *msg, UINT_t timeout);
599 #if UOSCFG_NEWLIB_SYSCALLS == 1 608 #define UOS_CONFIG_KEYSIZE 20 609 #define UOS_CONFIG_VALUESIZE 40 616 char key[UOS_CONFIG_KEYSIZE];
617 char value[UOS_CONFIG_VALUESIZE];
625 typedef int (*
UosConfigSaver)(
void* context,
const char* key,
const char* value);
638 const char*
uosConfigSet(
const char* key,
const char* value);
654 #if UOSCFG_MAX_OPEN_FILES > 0 || DOX == 1
void uosMmcSpiRcvr(const UosMmcDisk *, uint8_t *data, int len)
int uosFileSync(UosFile *file)
const char * uosConfigGet(const char *key)
Definition: picoos-u.h:518
struct uosFileInfo UosFileInfo
struct _uosConfigKeyValue UosConfigKeyValue
bool uosBitTabIsFree(uint8_t *bitmap, int slot)
int uosMountFat(const char *mountPoint, int diskNumber)
UosRing * uosRingCreate(int msgSize, int msgCount)
struct uosDiskConf UosDiskConf
const UosDisk * uosGetDisk(int diskNumber)
struct uosFSConf UosFSConf
Definition: picoos-u.h:367
int uosBitTabAlloc(uint8_t *bitmap, int size)
Definition: picoos-u.h:167
void uosBitTabFree(uint8_t *bitmap, int slot)
void uosMmcSpiXmit(const UosMmcDisk *, const uint8_t *data, int len)
UosFile * uosFileOpen(const char *fileName, int flags, int mode)
const char * uosConfigSet(const char *key, const char *value)
int uosMount(const UosFS *mount)
void uosSpiRcvr(UosSpiDev *dev, uint8_t *data, int len)
int(* UosConfigSaver)(void *context, const char *key, const char *value)
Definition: picoos-u.h:625
struct uosSpiBus UosSpiBus
int uosFileClose(UosFile *file)
picoos-micro library configuration file
int uosFileRead(UosFile *file, char *buf, int max)
bool uosRingPut(UosRing *ring, const void *msg, UINT_t timeout)
void uosSpiBeginNoCS(UosSpiDev *dev)
int uosConfigSaveEntries(void *context, UosConfigSaver saver)
void uosSpiCS(UosSpiDev *dev, bool select)
Definition: picoos-u.h:614
int uosConfigSave(const char *filename)
Definition: picoos-u.h:509
void uosSpiInit(UosSpiBus *bus, const UosSpiBusConf *cf)
void uosResourceDiag(void)
int uosFile2Slot(UosFile *file)
struct uosSpiBusConf UosSpiBusConf
Definition: picoos-u.h:154
int uosFileWrite(UosFile *file, const char *buf, int len)
int uosFileUnlink(const char *filename)
bool uosRingGet(UosRing *ring, void *msg, UINT_t timeout)
Definition: picoos-u.h:355
struct uosMmcDisk UosMmcDisk
struct __attribute__((aligned(4))) uosSpiDevConf
Definition: picoos-u.h:178
void uosSpiControl(UosSpiBus *bus, bool fullSpeed)
int uosFileSeek(UosFile *file, int offset, int whence)
int uosConfigLoad(const char *filename)
uint8_t uosSpiXchg(UosSpiDev *dev, uint8_t data)
int uosAddDisk(const UosDisk *disk)
struct uosSpiDev UosSpiDev
Definition: picoos-u.h:379
int uosFileFree(UosFile *file)
Definition: picoos-u.h:341
void uosSpiEnd(UosSpiDev *dev)
void uosRingDestroy(UosRing *ring)
UosFile * uosFileAlloc(void)
int uosMountRom(const char *mountPoint, const UosRomFile *data)
void uosSpiBegin(UosSpiDev *dev)
UosFile * uosSlot2File(int fd)
Definition: picoos-u.h:387
int uosFileFStat(UosFile *file, UosFileInfo *st)
void uosSpiXmit(UosSpiDev *dev, const uint8_t *data, int len)
void uosSpinUSecs(uint16_t uSecs)
Definition: picoos-u.h:331
void uosSpiDevInit(UosSpiDev *dev, const UosSpiDevConf *cf, UosSpiBus *bus)
struct uosMmcSpiConf UosMmcSpiConf
Definition: picoos-u.h:396
Definition: picoos-u.h:187
int uosFileStat(const char *filename, UosFileInfo *st)
struct uosFileConf UosFileConf