示例#1
0
文件: sys_arch.c 项目: TexZK/ChibiOS
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;
}
示例#2
0
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);
}
示例#3
0
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
}
示例#4
0
文件: syscalls.c 项目: GHF/gyroking
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;
}
示例#5
0
文件: system.c 项目: CalcMan/model-t
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;
}
示例#6
0
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
}
示例#7
0
void *operator new[](size_t size) {
    return chCoreAlloc(size);
}
示例#8
0
/*------------------------------------------------------------------------*
 * chibios_rt::Core                                                       *
 *------------------------------------------------------------------------*/
void *Core::alloc(size_t size) {

    return chCoreAlloc(size);
}