# sys.h File Reference

`#include "arch/cc.h"`
`#include "arch/sys_arch.h"`

Go to the source code of this file.

## Data Structures

struct | sys_timeout
struct | sys_timeouts

## Typedefs

typedef void(*) | sys_timeout_handler (void *arg)

## Functions

uInt16 | sys_arch_mbox_fetch (sys_mbox_t mbox, void **msg, uInt16 timeout)
uInt16 | sys_arch_sem_wait (sys_sem_t sem, uInt16 timeout)
sys_timeouts * | sys_arch_timeouts (void)
void | sys_init (void)
void | sys_mbox_fetch (sys_mbox_t mbox, void **msg)
void | sys_mbox_free (sys_mbox_t mbox)
sys_mbox_t | sys_mbox_new (void)
void | sys_mbox_post (sys_mbox_t mbox, void *msg)
unsigned long | sys_now (void)
void | sys_sem_free (sys_sem_t sem)
sys_sem_t | sys_sem_new (uInt8 count)
void | sys_sem_signal (sys_sem_t sem)
void | sys_sem_wait (sys_sem_t sem)
void | sys_thread_new (void(*function)(void), void *arg)
void | sys_timeout (uInt16 msecs, sys_timeout_handler h, void *arg)

## Typedef Documentation

typedef void(* ) sys_timeout_handler(void *arg)

Definition at line 41 of file sys.h.

## Function Documentation

uInt16 sys_arch_mbox_fetch | ( | sys_mbox_t | mbox,
|  | void ** | msg,
|  | uInt16 | timeout |
| ) |  |  |

Referenced by netconn_delete().

uInt16 sys_arch_sem_wait | ( | sys_sem_t | sem,
|  | uInt16 | timeout |
| ) |  |  |

Referenced by sys_arch_mbox_fetch().

struct sys_timeouts* sys_arch_timeouts | ( | void |  | ) |

Definition at line 409 of file sys_arch.c.

References current_thread(), and sys_thread::timeouts.

void sys_init | ( | void |  | ) |

Definition at line 404 of file sys_arch.c.

References gettimeofday(), and starttime.

Referenced by net_init().

void sys_mbox_fetch | ( | sys_mbox_t | mbox,
|  | void ** | msg |
| ) |  |  |

Referenced by netconn_accept(), netconn_bind(), netconn_close(), netconn_connect(), netconn_delete(), netconn_listen(), netconn_recv(), netconn_send(), netconn_write(), and tcpip_thread().

void sys_mbox_free | ( | sys_mbox_t | mbox | ) |

Referenced by accept_function(), netconn_delete(), and netconn_recv().

sys_mbox_t sys_mbox_new | ( | void |  | ) |

Definition at line 204 of file sys_arch.c.

References sys_mbox::first, kmalloc(), sys_mbox::last, sys_mbox::mail, mbox, sys_mbox::mutex, and sys_sem_new_().

Referenced by accept_function(), do_listen(), netconn_bind(), netconn_connect(), netconn_listen(), netconn_new(), and tcpip_init().

void sys_mbox_post | ( | sys_mbox_t | mbox,
|  | void * | msg |
| ) |  |  |

Referenced by accept_function(), do_bind(), do_close(), do_connect(), do_connected(), do_delconn(), do_listen(), do_recv(), do_send(), do_write(), err_tcp(), recv_tcp(), recv_udp(), tcpip_apimsg(), and tcpip_input().

unsigned long sys_now | ( | void |  | ) |

void sys_sem_free | ( | sys_sem_t | sem | ) |

Referenced by netconn_delete(), netconn_write(), and netMainThread().

sys_sem_t sys_sem_new | ( | uInt8 | count | ) |

Definition at line 295 of file sys_arch.c.

References sys_sem_new_().

Referenced by accept_function(), netconn_write(), and netMainThread().

void sys_sem_signal | ( | sys_sem_t | sem | ) |

Referenced by err_tcp(), poll_tcp(), sent_tcp(), sys_arch_mbox_fetch(), sys_mbox_post(), and tcpip_init_done().

void sys_sem_wait | ( | sys_sem_t | sem | ) |

Referenced by netconn_close(), netconn_write(), netMainThread(), sys_mbox_free(), and sys_mbox_post().

void sys_thread_new | ( | void(*)(void) | function,
|  | void * | arg |
| ) |  |  |

Definition at line 172 of file sys_arch.c.

References kmalloc(), kpanic(), kprintf(), netThreadSpinlock, sys_thread::next, sys_timeouts::next, NULL, spinLock(), spinUnlock(), threads, sys_thread::timeouts, sys_thread::ubthread, and ubthread_create().

Referenced by bot_init(), low_level_init(), net_init(), shell_init(), tcpip_init(), and udpecho_init().

void sys_timeout | ( | uInt16 | msecs,
|  | sys_timeout_handler | h,
|  | void * | arg |
| ) |  |  |

Referenced by arp_timer(), ethernetif_init(), tcpip_tcp_timer(), and tcpip_thread().