sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) { size_t wsz; void *wsp; syssts_t sts; thread_t *tp; (void)name; wsz = THD_WORKING_AREA_SIZE(stacksize); wsp = chCoreAlloc(wsz); if (wsp == NULL) return NULL; #if CH_DBG_FILL_THREADS == TRUE _thread_memfill((uint8_t *)wsp, (uint8_t *)wsp + sizeof(thread_t), CH_DBG_THREAD_FILL_VALUE); _thread_memfill((uint8_t *)wsp + sizeof(thread_t), (uint8_t *)wsp + wsz, CH_DBG_STACK_FILL_VALUE); #endif sts = chSysGetStatusAndLockX(); tp = chThdCreateI(wsp, wsz, prio, (tfunc_t)thread, arg); chRegSetThreadNameX(tp, name); chThdStartI(tp); chSysRestoreStatusX(sts); return (sys_thread_t)tp; }
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) { (void)name; size_t wsz = THD_WA_SIZE(stacksize); void *wsp = chCoreAlloc(wsz); if (wsp == NULL) return NULL; return (sys_thread_t)chThdCreateStatic(wsp, wsz, prio, (tfunc_t)thread, arg); }
void *_sbrk_r(struct _reent *r, ptrdiff_t incr) { #if CH_USE_MEMCORE void *p = chCoreAlloc((size_t) incr); if (p == NULL) { r->_errno = ENOMEM; return (void*) -1; } return (void*) p; #else __errno_r(r) = ENOMEM; return (caddr_t)-1; #endif }
caddr_t _sbrk_r(struct _reent *r, int incr) { void *p; chDbgCheck(incr > 0, "_sbrk_r"); (void)r; p = chCoreAlloc((size_t)incr); if (p == NULL) { __errno_r(r) = ENOMEM; return (caddr_t)-1; } return (caddr_t)p; }
caddr_t _sbrk_r(struct _reent *r, int incr) { void *p; if (incr <= 0) { return (caddr_t)-1; } (void)r; p = chCoreAlloc((size_t)incr); if (p == NULL) { __errno_r(r) = ENOMEM; return (caddr_t)-1; } return (caddr_t)p; }
caddr_t _sbrk_r(struct _reent *r, int incr) { #if CH_CFG_USE_MEMCORE void *p; chDbgCheck(incr > 0); p = chCoreAlloc((size_t)incr); if (p == NULL) { __errno_r(r) = ENOMEM; return (caddr_t)-1; } return (caddr_t)p; #else (void)incr; __errno_r(r) = ENOMEM; return (caddr_t)-1; #endif }
void *operator new[](size_t size) { return chCoreAlloc(size); }
/*------------------------------------------------------------------------* * chibios_rt::Core * *------------------------------------------------------------------------*/ void *Core::alloc(size_t size) { return chCoreAlloc(size); }