void DEBUG_Init(s32 device_type,s32 channel_port) { u32 level; struct uip_ip_addr localip,netmask,gateway; UIP_LOG("DEBUG_Init()\n"); __lwp_thread_dispatchdisable(); bp_init(); if(device_type==GDBSTUB_DEVICE_USB) { current_device = usb_init(channel_port); } else { localip.addr = uip_ipaddr((const u8_t*)tcp_localip); netmask.addr = uip_ipaddr((const u8_t*)tcp_netmask); gateway.addr = uip_ipaddr((const u8_t*)tcp_gateway); current_device = tcpip_init(&localip,&netmask,&gateway,(u16)channel_port); } if(current_device!=NULL) { _CPU_ISR_Disable(level); __exception_sethandler(EX_DSI,dbg_exceptionhandler); __exception_sethandler(EX_PRG,dbg_exceptionhandler); __exception_sethandler(EX_TRACE,dbg_exceptionhandler); __exception_sethandler(EX_IABR,dbg_exceptionhandler); _CPU_ISR_Restore(level); dbg_initialized = 1; } __lwp_thread_dispatchenable(); }
lwp_t LWP_GetSelf() { lwp_t ret; __lwp_thread_dispatchdisable(); ret = (lwp_t)(LWP_OBJMASKTYPE(LWP_OBJTYPE_THREAD)|LWP_OBJMASKID(_thr_executing->object.id)); __lwp_thread_dispatchunnest(); return ret; }
static tqueue_st* __lwp_tqueue_allocate() { tqueue_st *tqueue; __lwp_thread_dispatchdisable(); tqueue = (tqueue_st*)__lwp_objmgr_allocate(&_lwp_tqueue_objects); if(tqueue) { __lwp_objmgr_open(&_lwp_tqueue_objects,&tqueue->object); return tqueue; } __lwp_thread_dispatchenable(); return NULL; }
static lwp_cntrl* __lwp_cntrl_allocate() { lwp_cntrl *thethread; __lwp_thread_dispatchdisable(); thethread = (lwp_cntrl*)__lwp_objmgr_allocate(&_lwp_thr_objects); if(thethread) { __lwp_objmgr_open(&_lwp_thr_objects,&thethread->object); return thethread; } __lwp_thread_dispatchenable(); return NULL; }
static cond_st* __lwp_cond_allocate() { cond_st *cond; __lwp_thread_dispatchdisable(); cond = (cond_st*)__lwp_objmgr_allocate(&_lwp_cond_objects); if(cond) { __lwp_objmgr_open(&_lwp_cond_objects,&cond->object); return cond; } __lwp_thread_dispatchenable(); return NULL; }
static mqbox_st* __lwp_mqbox_allocate() { mqbox_st *mqbox; __lwp_thread_dispatchdisable(); mqbox = (mqbox_st*)__lwp_objmgr_allocate(&_lwp_mqbox_objects); if(mqbox) { __lwp_objmgr_open(&_lwp_mqbox_objects,&mqbox->object); return mqbox; } __lwp_thread_dispatchenable(); return NULL; }
void LWP_Reschedule(u32 prio) { __lwp_thread_dispatchdisable(); __lwp_rotate_readyqueue(prio); __lwp_thread_dispatchenable(); }
void LWP_YieldThread() { __lwp_thread_dispatchdisable(); __lwp_thread_yield(); __lwp_thread_dispatchenable(); }