lwIP bindings improvements. Added new function chRegSetThreadNamex().
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8058 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
32490c00b3
commit
8131d84ea7
|
@ -148,11 +148,8 @@ extern "C" {
|
||||||
* @return Thread name as a zero terminated string.
|
* @return Thread name as a zero terminated string.
|
||||||
* @retval NULL if the thread name has not been set.
|
* @retval NULL if the thread name has not been set.
|
||||||
*
|
*
|
||||||
* @iclass
|
|
||||||
*/
|
*/
|
||||||
static inline const char *chRegGetThreadNameI(thread_t *tp) {
|
static inline const char *chRegGetThreadNameX(thread_t *tp) {
|
||||||
|
|
||||||
chDbgCheckClassI();
|
|
||||||
|
|
||||||
#if CH_CFG_USE_REGISTRY == TRUE
|
#if CH_CFG_USE_REGISTRY == TRUE
|
||||||
return tp->p_name;
|
return tp->p_name;
|
||||||
|
@ -162,6 +159,26 @@ static inline const char *chRegGetThreadNameI(thread_t *tp) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Changes the name of the specified thread.
|
||||||
|
* @pre This function only sets the name if the option
|
||||||
|
* @p CH_CFG_USE_REGISTRY is enabled else it does
|
||||||
|
* nothing.
|
||||||
|
*
|
||||||
|
* @param[in] tp pointer to the thread
|
||||||
|
* @param[in] name name to be set
|
||||||
|
*
|
||||||
|
* @xclass
|
||||||
|
*/
|
||||||
|
static inline void chRegSetThreadNameX(thread_t *tp, const char *name) {
|
||||||
|
|
||||||
|
#if CH_CFG_USE_REGISTRY == TRUE
|
||||||
|
tp->p_name = name;
|
||||||
|
#else
|
||||||
|
(void)tp;
|
||||||
|
(void)name;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif /* CH_CFG_USE_REGISTRY == TRUE */
|
#endif /* CH_CFG_USE_REGISTRY == TRUE */
|
||||||
|
|
||||||
#endif /* _CHREGISTRY_H_ */
|
#endif /* _CHREGISTRY_H_ */
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
static void _idle_thread(void *p) {
|
static void _idle_thread(void *p) {
|
||||||
|
|
||||||
(void)p;
|
(void)p;
|
||||||
chRegSetThreadName("idle");
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/*lint -save -e522 [2.2] Apparently no side effects because it contains
|
/*lint -save -e522 [2.2] Apparently no side effects because it contains
|
||||||
an asm instruction.*/
|
an asm instruction.*/
|
||||||
|
@ -135,11 +135,17 @@ void chSysInit(void) {
|
||||||
chRegSetThreadName((const char *)&ch_debug);
|
chRegSetThreadName((const char *)&ch_debug);
|
||||||
|
|
||||||
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
#if CH_CFG_NO_IDLE_THREAD == FALSE
|
||||||
|
{
|
||||||
/* This thread has the lowest priority in the system, its role is just to
|
/* This thread has the lowest priority in the system, its role is just to
|
||||||
serve interrupts in its context while keeping the lowest energy saving
|
serve interrupts in its context while keeping the lowest energy saving
|
||||||
mode compatible with the system status.*/
|
mode compatible with the system status.*/
|
||||||
(void) chThdCreateStatic(ch.idle_thread_wa, sizeof(ch.idle_thread_wa),
|
thread_t *tp = chThdCreateStatic(ch.idle_thread_wa,
|
||||||
IDLEPRIO, (tfunc_t)_idle_thread, NULL);
|
sizeof(ch.idle_thread_wa),
|
||||||
|
IDLEPRIO,
|
||||||
|
(tfunc_t)_idle_thread,
|
||||||
|
NULL);
|
||||||
|
chRegSetThreadNameX(tp, "idle");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,28 +202,43 @@ void sys_mbox_set_invalid(sys_mbox_t *mbox) {
|
||||||
|
|
||||||
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread,
|
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread,
|
||||||
void *arg, int stacksize, int prio) {
|
void *arg, int stacksize, int prio) {
|
||||||
|
|
||||||
size_t wsz;
|
size_t wsz;
|
||||||
void *wsp;
|
void *wsp;
|
||||||
|
syssts_t sts;
|
||||||
|
thread_t *tp;
|
||||||
|
|
||||||
(void)name;
|
(void)name;
|
||||||
wsz = THD_WORKING_AREA_SIZE(stacksize);
|
wsz = THD_WORKING_AREA_SIZE(stacksize);
|
||||||
wsp = chCoreAlloc(wsz);
|
wsp = chCoreAlloc(wsz);
|
||||||
if (wsp == NULL)
|
if (wsp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
return (sys_thread_t)chThdCreateStatic(wsp, wsz, prio, (tfunc_t)thread, arg);
|
|
||||||
|
#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_prot_t sys_arch_protect(void) {
|
sys_prot_t sys_arch_protect(void) {
|
||||||
|
|
||||||
osalSysLock();
|
return chSysGetStatusAndLockX();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sys_arch_unprotect(sys_prot_t pval) {
|
void sys_arch_unprotect(sys_prot_t pval) {
|
||||||
|
|
||||||
(void)pval;
|
osalSysRestoreStatusX((syssts_t)pval);
|
||||||
osalSysUnlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32_t sys_now(void) {
|
u32_t sys_now(void) {
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
typedef semaphore_t * sys_sem_t;
|
typedef semaphore_t * sys_sem_t;
|
||||||
typedef mailbox_t * sys_mbox_t;
|
typedef mailbox_t * sys_mbox_t;
|
||||||
typedef thread_t * sys_thread_t;
|
typedef thread_t * sys_thread_t;
|
||||||
typedef int sys_prot_t;
|
typedef syssts_t sys_prot_t;
|
||||||
|
|
||||||
#define SYS_MBOX_NULL (mailbox_t *)0
|
#define SYS_MBOX_NULL (mailbox_t *)0
|
||||||
#define SYS_THREAD_NULL (thread_t *)0
|
#define SYS_THREAD_NULL (thread_t *)0
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
/** @brief IP Address. */
|
/** @brief IP Address. */
|
||||||
#if !defined(LWIP_IPADDR) || defined(__DOXYGEN__)
|
#if !defined(LWIP_IPADDR) || defined(__DOXYGEN__)
|
||||||
#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 1, 20)
|
#define LWIP_IPADDR(p) IP4_ADDR(p, 192, 168, 1, 10)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @brief IP Gateway. */
|
/** @brief IP Gateway. */
|
||||||
|
|
Loading…
Reference in New Issue