picoos-micro  1.xxxx
Data Structures | Macros | Functions
picoos-u.h File Reference

Include file of u-layer library for pico]OS. More...

#include "uoscfg.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  uosSpiBusConf
 
struct  uosSpiBus
 
struct  uosSpiDev
 
struct  uosFileInfo
 
struct  uosFileConf
 
struct  uosFSConf
 
struct  uosDiskConf
 
struct  uosDisk
 
struct  uosFS
 
struct  uosFile
 
struct  uosMmcSpiConf
 
struct  uosMmcDisk
 
struct  _uosConfigKeyValue
 

Macros

#define UOS_BITTAB_TABLE(type, size)
 
#define UOS_BITTAB_INIT(bm)   memset(&bm.bitmap, '\0', sizeof(bm.bitmap))
 
#define UOS_BITTAB_SLOT(bm, elem)   (elem == NULL ? -1 : (elem - bm.table))
 
#define UOS_BITTAB_ELEM(bm, slot)   (slot == -1 ? NULL : (bm.table + slot))
 
#define UOS_BITTAB_ALLOC(bm)   uosBitTabAlloc(bm.bitmap, sizeof(bm.table)/sizeof(bm.table[0]))
 
#define UOS_BITTAB_FREE(bm, slot)   uosBitTabFree(bm.bitmap, slot)
 
#define UOS_BITTAB_IS_FREE(bm, slot)   uosBitTabIsFree(bm.bitmap, slot)
 

Functions

int uosBitTabAlloc (uint8_t *bitmap, int size)
 
void uosBitTabFree (uint8_t *bitmap, int slot)
 
bool uosBitTabIsFree (uint8_t *bitmap, int slot)
 
void uosNewlibInit (void)
 
void uosInit (void)
 
void uosBootDiag (void)
 
void uosResourceDiag (void)
 
void uosSpinInit (void)
 
void uosSpinUSecs (uint16_t uSecs)
 
typedef struct uosSpiBusConf UosSpiBusConf
 
typedef struct uosSpiBus UosSpiBus
 
typedef struct uosSpiDev UosSpiDev
 
struct __attribute__ ((aligned(4))) uosSpiDevConf
 
void uosSpiInit (UosSpiBus *bus, const UosSpiBusConf *cf)
 
void uosSpiDevInit (UosSpiDev *dev, const UosSpiDevConf *cf, UosSpiBus *bus)
 
void uosSpiControl (UosSpiBus *bus, bool fullSpeed)
 
void uosSpiBeginNoCS (UosSpiDev *dev)
 
void uosSpiBegin (UosSpiDev *dev)
 
void uosSpiCS (UosSpiDev *dev, bool select)
 
uint8_t uosSpiXchg (UosSpiDev *dev, uint8_t data)
 
void uosSpiXmit (UosSpiDev *dev, const uint8_t *data, int len)
 
void uosSpiRcvr (UosSpiDev *dev, uint8_t *data, int len)
 
void uosSpiEnd (UosSpiDev *dev)
 
typedef struct uosFileInfo UosFileInfo
 
typedef struct uosFileConf UosFileConf
 
typedef struct uosFSConf UosFSConf
 
typedef struct uosDiskConf UosDiskConf
 
typedef struct uosDisk UosDisk
 
typedef struct uosFS UosFS
 
typedef struct uosFile UosFile
 
typedef struct uosMmcSpiConf UosMmcSpiConf
 
typedef struct uosMmcDisk UosMmcDisk
 
void uosFileInit (void)
 
int uosFile2Slot (UosFile *file)
 
UosFileuosSlot2File (int fd)
 
int uosMount (const UosFS *mount)
 
UosFileuosFileAlloc (void)
 
int uosFileFree (UosFile *file)
 
UosFileuosFileOpen (const char *fileName, int flags, int mode)
 
int uosFileRead (UosFile *file, char *buf, int max)
 
int uosFileWrite (UosFile *file, const char *buf, int len)
 
int uosFileClose (UosFile *file)
 
int uosFileStat (const char *filename, UosFileInfo *st)
 
int uosFileFStat (UosFile *file, UosFileInfo *st)
 
int uosFileSeek (UosFile *file, int offset, int whence)
 
int uosFileUnlink (const char *filename)
 
int uosFileSync (UosFile *file)
 
int uosAddDisk (const UosDisk *disk)
 
const UosDiskuosGetDisk (int diskNumber)
 
int uosMountFat (const char *mountPoint, int diskNumber)
 
void uosMmcSpiXmit (const UosMmcDisk *, const uint8_t *data, int len)
 
void uosMmcSpiRcvr (const UosMmcDisk *, uint8_t *data, int len)
 
int uosMountRom (const char *mountPoint, const UosRomFile *data)
 
UosRing * uosRingCreate (int msgSize, int msgCount)
 
bool uosRingPut (UosRing *ring, const void *msg, UINT_t timeout)
 
bool uosRingGet (UosRing *ring, void *msg, UINT_t timeout)
 
void uosRingDestroy (UosRing *ring)
 
typedef struct _uosConfigKeyValue UosConfigKeyValue
 
typedef int(* UosConfigSaver) (void *context, const char *key, const char *value)
 
const char * uosConfigGet (const char *key)
 
const char * uosConfigSet (const char *key, const char *value)
 
void uosConfigInit (void)
 
int uosConfigSaveEntries (void *context, UosConfigSaver saver)
 
int uosConfigSave (const char *filename)
 
int uosConfigLoad (const char *filename)
 

Detailed Description

Include file of u-layer library for pico]OS.

Author
Ari Suutari ari@s.nosp@m.tone.nosp@m.pile..nosp@m.fi

Macro Definition Documentation

§ UOS_BITTAB_TABLE

#define UOS_BITTAB_TABLE (   type,
  size 
)
Value:
typedef struct { \
uint8_t bitmap[size / 8 + 1]; \
type table[size]; \
} type##Bittab

Macro for defining a table of objects where used/free status is managed by separate bitmap for efficient space usage.

§ UOS_BITTAB_INIT

#define UOS_BITTAB_INIT (   bm)    memset(&bm.bitmap, '\0', sizeof(bm.bitmap))

Initialize bitmap table so that all elements are marked free.

§ UOS_BITTAB_SLOT

#define UOS_BITTAB_SLOT (   bm,
  elem 
)    (elem == NULL ? -1 : (elem - bm.table))

Macro for converting address of table element into table index.

§ UOS_BITTAB_ELEM

#define UOS_BITTAB_ELEM (   bm,
  slot 
)    (slot == -1 ? NULL : (bm.table + slot))

Macro for converting table index into table element pointer.

§ UOS_BITTAB_ALLOC

#define UOS_BITTAB_ALLOC (   bm)    uosBitTabAlloc(bm.bitmap, sizeof(bm.table)/sizeof(bm.table[0]))

Macro for allocating an entry from bitmap table.

§ UOS_BITTAB_FREE

#define UOS_BITTAB_FREE (   bm,
  slot 
)    uosBitTabFree(bm.bitmap, slot)

Macro for freeing a bitmap table entry.

§ UOS_BITTAB_IS_FREE

#define UOS_BITTAB_IS_FREE (   bm,
  slot 
)    uosBitTabIsFree(bm.bitmap, slot)

Macro for checking for free bitmap table entry.

Typedef Documentation

§ UosSpiBusConf

typedef struct uosSpiBusConf UosSpiBusConf

Config for generic SPI bus.

§ UosSpiBus

typedef struct uosSpiBus UosSpiBus

Structure for generic SPI bus.

§ UosSpiDev

typedef struct uosSpiDev UosSpiDev

Generic SPI bus device.

Function Documentation

§ __attribute__()

struct __attribute__ ( (aligned(4))  )

Config for generic SPI bus device.

§ uosSpiInit()

void uosSpiInit ( UosSpiBus bus,
const UosSpiBusConf cf 
)

Initialize SPI bus. Must be called before any other operations.

§ uosSpiDevInit()

void uosSpiDevInit ( UosSpiDev dev,
const UosSpiDevConf *  cf,
UosSpiBus bus 
)

Initialize SPI device.

§ uosSpiControl()

void uosSpiControl ( UosSpiBus bus,
bool  fullSpeed 
)

Control SPI bus speed (low or full).

§ uosSpiBeginNoCS()

void uosSpiBeginNoCS ( UosSpiDev dev)

Allocate SPI bus for current task, but do not assert CS.

§ uosSpiBegin()

void uosSpiBegin ( UosSpiDev dev)

Allocate SPI bus for current task and assert CS.

§ uosSpiCS()

void uosSpiCS ( UosSpiDev dev,
bool  select 
)

Directly manipulate CS line. Call to uosSpiBegin is still required.

§ uosSpiXchg()

uint8_t uosSpiXchg ( UosSpiDev dev,
uint8_t  data 
)

Exchange byte on SPI bus.

§ uosSpiXmit()

void uosSpiXmit ( UosSpiDev dev,
const uint8_t *  data,
int  len 
)

Transmit multiple bytes on SPI bus.

§ uosSpiRcvr()

void uosSpiRcvr ( UosSpiDev dev,
uint8_t *  data,
int  len 
)

Receive multiple bytes from SPI bus.

§ uosSpiEnd()

void uosSpiEnd ( UosSpiDev dev)

Free SPI bus from current task. If chip select was turned low by uosSpiBegin, turn it high again.

§ uosBitTabAlloc()

int uosBitTabAlloc ( uint8_t *  bitmap,
int  size 
)

Allocate entry from bitmap table.

§ uosBitTabFree()

void uosBitTabFree ( uint8_t *  bitmap,
int  slot 
)

Free an entry that was allocated from bitmap table.

§ uosBitTabIsFree()

bool uosBitTabIsFree ( uint8_t *  bitmap,
int  slot 
)

Check if entry is free in bitmap table.

§ uosNewlibInit()

void uosNewlibInit ( void  )

Initialize newlib syscall layer.