Fixed bug 2792919, minor documentation improvements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@979 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
53f1b74772
commit
dd32a2316e
|
@ -81,6 +81,8 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
||||||
stable branch).
|
stable branch).
|
||||||
- FIX: Fixed missing volatile modifier for p_time field in Thread structure
|
- FIX: Fixed missing volatile modifier for p_time field in Thread structure
|
||||||
(bug 2789501)(backported in stable branch).
|
(bug 2789501)(backported in stable branch).
|
||||||
|
- FIX: Fixed C99-style variable declarations (bug 2792919)(backported in
|
||||||
|
stable branch).
|
||||||
- NEW: Abstract I/O Channels mechanism introduced. This mechanism allows to
|
- NEW: Abstract I/O Channels mechanism introduced. This mechanism allows to
|
||||||
access I/O resources through a standard interface and hides implementation
|
access I/O resources through a standard interface and hides implementation
|
||||||
details. The existing serial drivers were modified to offer a standard
|
details. The existing serial drivers were modified to offer a standard
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file chlists.c
|
* @file chlists.c
|
||||||
* @brief Lists and queues code.
|
* @brief Thread queues/lists code.
|
||||||
* @addtogroup ThreadLists
|
* @addtogroup ThreadLists
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -71,9 +71,8 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
|
||||||
* @details The new thread is initialized but not inserted in the ready list,
|
* @details The new thread is initialized but not inserted in the ready list,
|
||||||
* the initial state is @p PRSUSPENDED.
|
* the initial state is @p PRSUSPENDED.
|
||||||
*
|
*
|
||||||
* @param[out] workspace pointer to a working area dedicated to the thread
|
* @param[out] wsp pointer to a working area dedicated to the thread stack
|
||||||
* stack
|
* @param[in] size size of the working area
|
||||||
* @param[in] wsize size of the working area
|
|
||||||
* @param[in] prio the priority level for the new thread
|
* @param[in] prio the priority level for the new thread
|
||||||
* @param[in] pf the thread function
|
* @param[in] pf the thread function
|
||||||
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
||||||
|
@ -85,32 +84,28 @@ static void memfill(uint8_t *startp, uint8_t *endp, uint8_t v) {
|
||||||
* it is not an I-Class API because it does not touch any critical kernel
|
* it is not an I-Class API because it does not touch any critical kernel
|
||||||
* data structure.
|
* data structure.
|
||||||
*/
|
*/
|
||||||
Thread *chThdInit(void *workspace, size_t wsize,
|
Thread *chThdInit(void *wsp, size_t size, tprio_t prio, tfunc_t pf, void *arg) {
|
||||||
tprio_t prio, tfunc_t pf, void *arg) {
|
/* Thread structure is layed out in the lower part of the thread workspace */
|
||||||
/* thread structure is layed out in the lower part of the thread workspace */
|
Thread *tp = wsp;
|
||||||
Thread *tp = workspace;
|
|
||||||
|
|
||||||
chDbgCheck((workspace != NULL) && (wsize >= THD_WA_SIZE(0)) &&
|
chDbgCheck((wsp != NULL) && (size >= THD_WA_SIZE(0)) &&
|
||||||
(prio <= HIGHPRIO) && (pf != NULL),
|
(prio <= HIGHPRIO) && (pf != NULL),
|
||||||
"chThdInit");
|
"chThdInit");
|
||||||
#if CH_DBG_FILL_THREADS
|
#if CH_DBG_FILL_THREADS
|
||||||
memfill((uint8_t *)workspace,
|
memfill((uint8_t *)wsp, (uint8_t *)wsp + sizeof(Thread), THREAD_FILL_VALUE);
|
||||||
(uint8_t *)workspace + sizeof(Thread),
|
memfill((uint8_t *)wsp + sizeof(Thread),
|
||||||
THREAD_FILL_VALUE);
|
(uint8_t *)wsp + size, STACK_FILL_VALUE);
|
||||||
memfill((uint8_t *)workspace + sizeof(Thread),
|
|
||||||
(uint8_t *)workspace + wsize,
|
|
||||||
STACK_FILL_VALUE);
|
|
||||||
#endif
|
#endif
|
||||||
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
SETUP_CONTEXT(wsp, size, pf, arg);
|
||||||
return init_thread(tp, prio);
|
return init_thread(tp, prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new thread into a static memory area.
|
* @brief Creates a new thread into a static memory area.
|
||||||
*
|
*
|
||||||
* @param[out] workspace pointer to a working area dedicated to the thread
|
* @param[out] wsp pointer to a working area dedicated to the thread
|
||||||
* stack
|
* stack
|
||||||
* @param[in] wsize size of the working area
|
* @param[in] size size of the working area
|
||||||
* @param[in] prio the priority level for the new thread
|
* @param[in] prio the priority level for the new thread
|
||||||
* @param[in] pf the thread function
|
* @param[in] pf the thread function
|
||||||
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
||||||
|
@ -119,17 +114,17 @@ Thread *chThdInit(void *workspace, size_t wsize,
|
||||||
* @note A thread can terminate by calling @p chThdExit() or by simply
|
* @note A thread can terminate by calling @p chThdExit() or by simply
|
||||||
* returning from its main function.
|
* returning from its main function.
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
Thread *chThdCreateStatic(void *wsp, size_t size,
|
||||||
tprio_t prio, tfunc_t pf, void *arg) {
|
tprio_t prio, tfunc_t pf, void *arg) {
|
||||||
|
|
||||||
return chThdResume(chThdInit(workspace, wsize, prio, pf, arg));
|
return chThdResume(chThdInit(wsp, size, prio, pf, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP
|
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new thread allocating the memory from the heap.
|
* @brief Creates a new thread allocating the memory from the heap.
|
||||||
*
|
*
|
||||||
* @param[in] wsize size of the working area to be allocated
|
* @param[in] size size of the working area to be allocated
|
||||||
* @param[in] prio the priority level for the new thread
|
* @param[in] prio the priority level for the new thread
|
||||||
* @param[in] pf the thread function
|
* @param[in] pf the thread function
|
||||||
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
* @param[in] arg an argument passed to the thread function. It can be @p NULL.
|
||||||
|
@ -144,13 +139,14 @@ Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
||||||
* @p CH_USE_HEAP and @p CH_USE_WAITEXIT options are enabled
|
* @p CH_USE_HEAP and @p CH_USE_WAITEXIT options are enabled
|
||||||
* in @p chconf.h.
|
* in @p chconf.h.
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
Thread *chThdCreateFromHeap(size_t size, tprio_t prio, tfunc_t pf, void *arg) {
|
||||||
tfunc_t pf, void *arg) {
|
void *wsp;
|
||||||
|
Thread *tp;
|
||||||
|
|
||||||
void *workspace = chHeapAlloc(wsize);
|
wsp = chHeapAlloc(size);
|
||||||
if (workspace == NULL)
|
if (wsp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
Thread *tp = chThdInit(workspace, wsize, prio, pf, arg);
|
tp = chThdInit(wsp, size, prio, pf, arg);
|
||||||
tp->p_flags = P_MEM_MODE_HEAP;
|
tp->p_flags = P_MEM_MODE_HEAP;
|
||||||
return chThdResume(tp);
|
return chThdResume(tp);
|
||||||
}
|
}
|
||||||
|
@ -179,13 +175,15 @@ Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
||||||
*/
|
*/
|
||||||
Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
|
Thread *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
|
||||||
tfunc_t pf, void *arg) {
|
tfunc_t pf, void *arg) {
|
||||||
|
void *wsp;
|
||||||
|
Thread *tp;
|
||||||
|
|
||||||
chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool");
|
chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool");
|
||||||
|
|
||||||
void *workspace = chPoolAlloc(mp);
|
wsp = chPoolAlloc(mp);
|
||||||
if (workspace == NULL)
|
if (wsp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
Thread *tp = chThdInit(workspace, mp->mp_object_size, prio, pf, arg);
|
tp = chThdInit(wsp, mp->mp_object_size, prio, pf, arg);
|
||||||
tp->p_flags = P_MEM_MODE_MEMPOOL;
|
tp->p_flags = P_MEM_MODE_MEMPOOL;
|
||||||
tp->p_mpool = mp;
|
tp->p_mpool = mp;
|
||||||
return chThdResume(tp);
|
return chThdResume(tp);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file lists.h
|
* @file lists.h
|
||||||
* @brief Lists and queues macros and structures.
|
* @brief Thread queues/lists macros and structures.
|
||||||
* @addtogroup ThreadLists
|
* @addtogroup ThreadLists
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -162,12 +162,12 @@ typedef msg_t (*tfunc_t)(void *);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
Thread *chThdInit(void *workspace, size_t wsize,
|
Thread *chThdInit(void *wsp, size_t size,
|
||||||
tprio_t prio, tfunc_t pf, void *arg);
|
tprio_t prio, tfunc_t pf, void *arg);
|
||||||
Thread *chThdCreateStatic(void *workspace, size_t wsize,
|
Thread *chThdCreateStatic(void *wsp, size_t size,
|
||||||
tprio_t prio, tfunc_t pf, void *arg);
|
tprio_t prio, tfunc_t pf, void *arg);
|
||||||
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP
|
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_HEAP
|
||||||
Thread *chThdCreateFromHeap(size_t wsize, tprio_t prio,
|
Thread *chThdCreateFromHeap(size_t size, tprio_t prio,
|
||||||
tfunc_t pf, void *arg);
|
tfunc_t pf, void *arg);
|
||||||
#endif
|
#endif
|
||||||
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS
|
#if CH_USE_DYNAMIC && CH_USE_WAITEXIT && CH_USE_MEMPOOLS
|
||||||
|
|
6
todo.txt
6
todo.txt
|
@ -10,15 +10,15 @@ After 1.2.0:
|
||||||
as compact as possible.
|
as compact as possible.
|
||||||
* Add tests documentation to the general documentation via doxygen.
|
* Add tests documentation to the general documentation via doxygen.
|
||||||
* Static object initializers.
|
* Static object initializers.
|
||||||
|
- New chThdCreate() that takes just two parameters, a pointer to a thread
|
||||||
|
descriptor and the tread parameter. It could wrap the current variants
|
||||||
|
or just be an alternative.
|
||||||
- Remove any instance of unnamed structures/unions.
|
- Remove any instance of unnamed structures/unions.
|
||||||
- Objects registry in the kernel.
|
- Objects registry in the kernel.
|
||||||
- OSEK-style simple tasks within the idle thread.
|
- OSEK-style simple tasks within the idle thread.
|
||||||
- Code examples into the documentation.
|
- Code examples into the documentation.
|
||||||
- Dedicated syscalls.c support for newlib users.
|
- Dedicated syscalls.c support for newlib users.
|
||||||
- Threads Pools manager in the library.
|
- Threads Pools manager in the library.
|
||||||
- New chThdCreate() that takes just two parameters, a pointer to a thread
|
|
||||||
descriptor and the tread parameter. It could wrap the current variants
|
|
||||||
or just be an alternative.
|
|
||||||
- Minimal optional C-runtime library (complete enough for lwIP).
|
- Minimal optional C-runtime library (complete enough for lwIP).
|
||||||
? Think to something for threads restart.
|
? Think to something for threads restart.
|
||||||
? Multiple heaps, disjoint heaps, heaps in heaps.
|
? Multiple heaps, disjoint heaps, heaps in heaps.
|
||||||
|
|
Loading…
Reference in New Issue