UbixOS V2 2.0

Macros | Typedefs | Functions
sys.h File Reference
`#include <net/opt.h>`
`#include <net/arch/sys_arch.h>`
`#include "net/err.h"`
Include dependency graph for sys.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | LWIP_COMPAT_MUTEX 0
#define | SYS_ARCH_DEC(var, val)
#define | SYS_ARCH_DECL_PROTECT(lev)
#define | SYS_ARCH_GET(var, ret)
#define | SYS_ARCH_INC(var, val)
#define | SYS_ARCH_PROTECT(lev)
#define | SYS_ARCH_SET(var, val)
#define | SYS_ARCH_TIMEOUT 0xffffffffUL
#define | SYS_ARCH_UNPROTECT(lev)
#define | SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT
#define | sys_mbox_fetch(mbox, msg) sys_arch_mbox_fetch(mbox, msg, 0)
#define | sys_mbox_set_invalid_val(mbox) sys_mbox_set_invalid(&(mbox))
#define | sys_mbox_tryfetch(mbox, msg) sys_arch_mbox_tryfetch(mbox, msg)
#define | sys_mbox_valid_val(mbox) sys_mbox_valid(&(mbox))
#define | sys_sem_set_invalid_val(sem) sys_sem_set_invalid(&(sem))
#define | sys_sem_valid_val(sem) sys_sem_valid(&(sem))
#define | sys_sem_wait(sem) sys_arch_sem_wait(sem, 0)

## Typedefs
typedef void(* | lwip_thread_fn) (void *arg)

## Functions
uint32_t | sys_arch_mbox_fetch (struct sys_mbox **mb, void **msg, uint32_t timeout)
uint32_t | sys_arch_mbox_tryfetch (struct sys_mbox **mb, void **msg)
uint32_t | sys_arch_sem_wait (struct sys_sem **s, uint32_t timeout)
void | sys_init (void)
u32_t | sys_jiffies (void)
void | sys_mbox_free (struct sys_mbox **mb)
err_t | sys_mbox_new (struct sys_mbox **mb, int size)
void | sys_mbox_post (struct sys_mbox **mb, void *msg)
void | sys_mbox_set_invalid (struct sys_mbox **mb)
err_t | sys_mbox_trypost (struct sys_mbox **mb, void *msg)
int | sys_mbox_valid (struct sys_mbox **mb)
void | sys_msleep (u32_t ms)
void | sys_mutex_free (sys_mutex_t *mutex)
void | sys_mutex_lock (sys_mutex_t *mutex)
err_t | sys_mutex_new (sys_mutex_t *mutex)
void | sys_mutex_set_invalid (sys_mutex_t *mutex)
void | sys_mutex_unlock (sys_mutex_t *mutex)
int | sys_mutex_valid (sys_mutex_t *mutex)
u32_t | sys_now (void)
void | sys_sem_free (sys_sem_t **sem)
err_t | sys_sem_new (sys_sem_t **sem, u8_t count)
void | sys_sem_set_invalid (struct sys_sem **s)
void | sys_sem_signal (struct sys_sem **s)
int | sys_sem_valid (struct sys_sem **s)
sys_thread_t | sys_thread_new (const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)

## Macro Definition Documentation

## ◆ LWIP_COMPAT_MUTEX

#define LWIP_COMPAT_MUTEX 0

Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores should be used instead

Definition at line 68 of file sys.h.

## ◆ SYS_ARCH_DEC

#define SYS_ARCH_DEC | ( |  | var,
|  |  | val
| ) |  |

Value:
do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var -= val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)

Definition at line 384 of file sys.h.

## ◆ SYS_ARCH_DECL_PROTECT

#define SYS_ARCH_DECL_PROTECT | ( |  | lev | ) |

SYS_LIGHTWEIGHT_PROT define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection for certain critical regions during buffer allocation, deallocation and memory allocation and deallocation.

Definition at line 361 of file sys.h.

## ◆ SYS_ARCH_GET

#define SYS_ARCH_GET | ( |  | var,
|  |  | ret
| ) |  |

Value:
do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
ret = var; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)

Definition at line 393 of file sys.h.

## ◆ SYS_ARCH_INC

#define SYS_ARCH_INC | ( |  | var,
|  |  | val
| ) |  |

Value:
do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var += val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)

Definition at line 375 of file sys.h.

## ◆ SYS_ARCH_PROTECT

#define SYS_ARCH_PROTECT | ( |  | lev | ) |

Definition at line 362 of file sys.h.

## ◆ SYS_ARCH_SET

#define SYS_ARCH_SET | ( |  | var,
|  |  | val
| ) |  |

Value:
do { \
SYS_ARCH_DECL_PROTECT(old_level); \
SYS_ARCH_PROTECT(old_level); \
var = val; \
SYS_ARCH_UNPROTECT(old_level); \
} while(0)

Definition at line 402 of file sys.h.

## ◆ SYS_ARCH_TIMEOUT

#define SYS_ARCH_TIMEOUT 0xffffffffUL

Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait

Definition at line 47 of file sys.h.

## ◆ SYS_ARCH_UNPROTECT

#define SYS_ARCH_UNPROTECT | ( |  | lev | ) |

Definition at line 363 of file sys.h.

## ◆ SYS_MBOX_EMPTY

#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT

sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. For now we use the same magic value, but we allow this to change in future.

Definition at line 52 of file sys.h.

## ◆ sys_mbox_fetch

#define sys_mbox_fetch | ( |  | mbox,
|  |  | msg
| ) |  | sys_arch_mbox_fetch(mbox, msg, 0)

Definition at line 252 of file sys.h.

## ◆ sys_mbox_set_invalid_val

#define sys_mbox_set_invalid_val | ( |  | mbox | ) | sys_mbox_set_invalid(&(mbox))

Same as sys_mbox_set_invalid() but taking a value, not a pointer

Definition at line 277 of file sys.h.

## ◆ sys_mbox_tryfetch

#define sys_mbox_tryfetch | ( |  | mbox,
|  |  | msg
| ) |  | sys_arch_mbox_tryfetch(mbox, msg)

For now, we map straight to sys_arch implementation.

Definition at line 245 of file sys.h.

## ◆ sys_mbox_valid_val

#define sys_mbox_valid_val | ( |  | mbox | ) | sys_mbox_valid(&(mbox))

Same as sys_mbox_valid() but taking a value, not a pointer

Definition at line 271 of file sys.h.

## ◆ sys_sem_set_invalid_val

#define sys_sem_set_invalid_val | ( |  | sem | ) | sys_sem_set_invalid(&(sem))

Same as sys_sem_set_invalid() but taking a value, not a pointer

Definition at line 183 of file sys.h.

## ◆ sys_sem_valid_val

#define sys_sem_valid_val | ( |  | sem | ) | sys_sem_valid(&(sem))

Same as sys_sem_valid() but taking a value, not a pointer

Definition at line 177 of file sys.h.

## ◆ sys_sem_wait

#define sys_sem_wait | ( |  | sem | ) | sys_arch_sem_wait(sem, 0)

Wait for a semaphore - forever/no timeout

Definition at line 158 of file sys.h.

## Typedef Documentation

## ◆ lwip_thread_fn

typedef void(* lwip_thread_fn) (void *arg)

Function prototype for thread functions

Definition at line 58 of file sys.h.

## Function Documentation

## ◆ sys_init()

void sys_init | ( | void |  | ) |

Definition at line 32 of file sys_arch.c.

References gettimeofday().

Referenced by lwip_init().

Here is the call graph for this function:

## ◆ sys_jiffies()

u32_t sys_jiffies | ( | void |  | ) |

Ticks/jiffies since power up.