diff --git a/readme.txt b/readme.txt index b90d51ef7..3b0b55699 100644 --- a/readme.txt +++ b/readme.txt @@ -105,6 +105,7 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, - FIX: Modified the default value for the STM32 HSI setup it was 1, it should be 0x10. - FIX: Removed an obsolete constant (P_SUSPENDED) from thread.h. +- FIX: Removed unused field mp_grow in the MemoryPool structure. *** 1.0.0 *** - License switch, added GPL exception, see exception.txt. diff --git a/src/include/condvars.h b/src/include/condvars.h index ef9a37791..ca7d8f56b 100644 --- a/src/include/condvars.h +++ b/src/include/condvars.h @@ -35,7 +35,7 @@ * @brief CondVar structure. */ typedef struct CondVar { - ThreadsQueue c_queue; + ThreadsQueue c_queue; /**< CondVar threads queue.*/ } CondVar; #ifdef __cplusplus diff --git a/src/include/debug.h b/src/include/debug.h index 52c15cf08..631882fad 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -36,17 +36,23 @@ */ #define MEM_FILL_PATTERN 0x55 +/** + * @brief Trace buffer record. + */ typedef struct { - void *cse_wtobjp; - systime_t cse_time; - uint16_t cse_state: 4; - uint16_t cse_tid: 12; + void *cse_wtobjp; /**< Object where going to sleep.*/ + systime_t cse_time; /**< Time of the switch event.*/ + uint16_t cse_state: 4; /**< Switched out thread state.*/ + uint16_t cse_tid: 12; /**< Switched in thdread id.*/ } CtxSwcEvent; +/** + * @brief Trace buffer header. + */ typedef struct { - size_t tb_size; - CtxSwcEvent *tb_ptr; - CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; + unsigned tb_size; /**< Trace buffer size (records).*/ + CtxSwcEvent *tb_ptr; /**< Pointer to the ring buffer front.*/ + CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; /**< Ring buffer.*/ } TraceBuffer; extern CtxSwcEvent *dbgnext; diff --git a/src/include/events.h b/src/include/events.h index 4ae3d3540..34c35d487 100644 --- a/src/include/events.h +++ b/src/include/events.h @@ -36,20 +36,20 @@ typedef struct EventListener EventListener; * @brief Event Listener structure. */ struct EventListener { - /** Next Event Listener registered on the Event Source.*/ - EventListener *el_next; - /** Thread interested in the Event Source.*/ - Thread *el_listener; - /** Event flags mask associated by the thread to the Event Source.*/ - eventmask_t el_mask; + EventListener *el_next; /**< Next Event Listener registered on + the Event Source.*/ + Thread *el_listener; /**< Thread interested in the Event + Source.*/ + eventmask_t el_mask; /**< Event flags mask associated by the + thread to the Event Source.*/ }; /** * @brief Event Source structure. */ typedef struct EventSource { - /** First Event Listener registered on the Event Source.*/ - EventListener *es_next; + EventListener *es_next; /**< First Event Listener registered on + the Event Source.*/ } EventSource; /** Returns the event mask from the event identifier.*/ diff --git a/src/include/lists.h b/src/include/lists.h index 339c6741c..81b0aa943 100644 --- a/src/include/lists.h +++ b/src/include/lists.h @@ -36,10 +36,10 @@ typedef struct Thread Thread; * @extends ThreadsList */ typedef struct { - /** First @p Thread in the queue, or @p ThreadQueue when empty. */ - Thread *p_next; - /** Last @p Thread in the queue, or @p ThreadQueue when empty. */ - Thread *p_prev; + Thread *p_next; /**< First @p Thread in the queue, or + @p ThreadQueue when empty.*/ + Thread *p_prev; /**< Last @p Thread in the queue, or + @p ThreadQueue when empty.*/ } ThreadsQueue; /** @@ -47,8 +47,8 @@ typedef struct { * @details This list behaves like a stack. */ typedef struct { - /** Last pushed @p Thread on the stack list, or @p ThreadList when empty. */ - Thread *p_next; + Thread *p_next; /**< Last pushed @p Thread on the stack, + or @p ThreadList when empty.*/ } ThreadsList; /** diff --git a/src/include/mempools.h b/src/include/mempools.h index fb7f9a22b..5e9406e97 100644 --- a/src/include/mempools.h +++ b/src/include/mempools.h @@ -27,16 +27,19 @@ #ifdef CH_USE_MEMPOOLS +/** + * @brief Memory pool free object header. + */ struct pool_header { struct pool_header *ph_next; }; +/** + * @brief Memory pool descriptor. + */ typedef struct { - struct pool_header *mp_next; - size_t mp_object_size; -#ifdef CH_USE_HEAP - bool_t mp_grow; -#endif /* CH_USE_HEAP */ + struct pool_header *mp_next; /**< Pointer to the header.*/ + size_t mp_object_size; /**< Memory pool objects size.*/ } MemoryPool; #ifdef __cplusplus diff --git a/src/include/mutexes.h b/src/include/mutexes.h index 2040d64eb..5c313e526 100644 --- a/src/include/mutexes.h +++ b/src/include/mutexes.h @@ -31,12 +31,12 @@ * @brief Mutex structure. */ typedef struct Mutex { - /** Queue of the threads sleeping on this Mutex.*/ - ThreadsQueue m_queue; - /** Owner @p Thread pointer or @p NULL.*/ - Thread *m_owner; - /** Next @p Mutex into an owner-list, @p NULL if none.*/ - struct Mutex *m_next; + ThreadsQueue m_queue; /**< Queue of the threads sleeping on + this Mutex.*/ + Thread *m_owner; /**< Owner @p Thread pointer or + @p NULL.*/ + struct Mutex *m_next; /**< Next @p Mutex into an owner-list + or @p NULL.*/ } Mutex; #ifdef __cplusplus diff --git a/src/include/queues.h b/src/include/queues.h index a11a5a73f..f634cbbce 100644 --- a/src/include/queues.h +++ b/src/include/queues.h @@ -46,18 +46,13 @@ typedef void (*qnotify_t)(void); * the difference is on how the semaphore is initialized. */ typedef struct { - /** Pointer to the queue buffer. */ - uint8_t *q_buffer; - /** Pointer to the first location after the buffer. */ - uint8_t *q_top; - /** Write pointer. */ - uint8_t *q_wrptr; - /** Read pointer. */ - uint8_t *q_rdptr; - /** Counter semaphore. */ - Semaphore q_sem; - /** Data notification callback. */ - qnotify_t q_notify; + uint8_t *q_buffer; /**< Pointer to the queue buffer.*/ + uint8_t *q_top; /**< Pointer to the first location + after the buffer.*/ + uint8_t *q_wrptr; /**< Write pointer.*/ + uint8_t *q_rdptr; /**< Read pointer.*/ + Semaphore q_sem; /**< Counter @p Semaphore.*/ + qnotify_t q_notify; /**< Data notification callback.*/ } Queue; /** Returns the queue's buffer size. */ @@ -120,22 +115,17 @@ extern "C" { * @brief Half duplex queue structure. */ typedef struct { - /** Pointer to the queue buffer. */ - uint8_t *hdq_buffer; - /** Pointer to the first location after the buffer. */ - uint8_t *hdq_top; - /** Write pointer.*/ - uint8_t *hdq_wrptr; - /** Read pointer.*/ - uint8_t *hdq_rdptr; - /** Input counter semaphore. */ - Semaphore hdq_isem; - /** Output counter semaphore. */ - Semaphore hdq_osem; - /** Input data notification callback. */ - qnotify_t hdq_inotify; - /** Output data notification callback. */ - qnotify_t hdq_onotify; + uint8_t *hdq_buffer; /**< Pointer to the queue buffer.*/ + uint8_t *hdq_top; /**< Pointer to the first location + after the buffer. */ + uint8_t *hdq_wrptr; /**< Write pointer.*/ + uint8_t *hdq_rdptr; /**< Read pointer.*/ + Semaphore hdq_isem; /**< Input counter @p Semaphore.*/ + Semaphore hdq_osem; /**< Output counter @p Semaphore.*/ + qnotify_t hdq_inotify; /**< Input data notification + callback.*/ + qnotify_t hdq_onotify; /**< Output data notification + callback.*/ } HalfDuplexQueue; /** Returns the queue's buffer size. */ diff --git a/src/include/scheduler.h b/src/include/scheduler.h index bd44451d6..fde23a0ce 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -52,21 +52,18 @@ * @extends ThreadsQueue */ typedef struct { - /** Next @p Thread in the ready list.*/ - Thread *p_next; - /** Previous @p Thread in the ready list.*/ - Thread *p_prev; + Thread *p_next; /**< Next @p Thread in the ready list.*/ + Thread *p_prev; /**< Previous @p Thread in the ready + list.*/ /* End of the fields shared with the ThreadsQueue structure. */ - /** The thread priority.*/ - tprio_t r_prio; + tprio_t r_prio; /**< This field must be initialized to + zero.*/ /* End of the fields shared with the Thread structure. */ #ifdef CH_USE_ROUNDROBIN - /** Round robin counter.*/ - cnt_t r_preempt; + cnt_t r_preempt; /**< Round robin counter.*/ #endif #ifndef CH_CURRP_REGISTER_CACHE - /** The currently running thread.*/ - Thread *r_current; + Thread *r_current; /**< The currently running thread.*/ #endif } ReadyList; diff --git a/src/include/semaphores.h b/src/include/semaphores.h index 0f1a493d4..da6fcb628 100644 --- a/src/include/semaphores.h +++ b/src/include/semaphores.h @@ -31,10 +31,9 @@ * @brief Semaphore structure. */ typedef struct Semaphore { - /** Queue of the threads sleeping on this Semaphore.*/ - ThreadsQueue s_queue; - /** The Semaphore counter.*/ - cnt_t s_cnt; + ThreadsQueue s_queue; /**< Queue of the threads sleeping on + this semaphore.*/ + cnt_t s_cnt; /**< The semaphore counter.*/ } Semaphore; #ifdef __cplusplus diff --git a/src/include/threads.h b/src/include/threads.h index 00a948c3f..8d5c572e6 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -37,7 +37,7 @@ struct Thread { Thread *p_next; /**< Next @p Thread in the threads list/queue.*/ /* End of the fields shared with the ThreadsList structure. */ - Thread *p_prev; /**< Previous @p Thread in the thread + Thread *p_prev; /**< Previous @p Thread in the threads queue.*/ /* End of the fields shared with the ThreadsQueue structure. */ tprio_t p_prio; /**< Thread priority.*/ diff --git a/src/include/vt.h b/src/include/vt.h index 89ad275e4..73f2881a3 100644 --- a/src/include/vt.h +++ b/src/include/vt.h @@ -52,17 +52,14 @@ typedef struct VirtualTimer VirtualTimer; * @extends DeltaList */ struct VirtualTimer { - /** Next timer in the delta list.*/ - VirtualTimer *vt_next; - /** Previous timer in the delta list.*/ - VirtualTimer *vt_prev; - /** Time delta before timeout.*/ - systime_t vt_time; - /** Timer callback function pointer. The pointer is reset to zero after - the callback is invoked.*/ - vtfunc_t vt_func; - /** Timer callback function parameter.*/ - void *vt_par; + VirtualTimer *vt_next; /**< Next timer in the delta list.*/ + VirtualTimer *vt_prev; /**< Previous timer in the delta list.*/ + systime_t vt_time; /**< Time delta before timeout.*/ + vtfunc_t vt_func; /**< Timer callback function pointer. + The pointer is reset to zero after + the callback is invoked.*/ + void *vt_par; /**< Timer callback function + parameter.*/ }; /** @@ -72,14 +69,11 @@ struct VirtualTimer { * is often used in the code. */ typedef struct { - /** Next timer in the list (the one that will be triggered next).*/ - VirtualTimer *vt_next; - /** Last timer in the list.*/ - VirtualTimer *vt_prev; - /** Not used but it must be set to -1.*/ - systime_t vt_time; - /** System Time counter.*/ - volatile systime_t vt_systime; + VirtualTimer *vt_next; /**< Next timer in the delta list (the + one that will be triggered next).*/ + VirtualTimer *vt_prev; /**< Last timer in the delta list.*/ + systime_t vt_time; /**< Must be initialized to -1.*/ + volatile systime_t vt_systime; /**< System Time counter.*/ } VTList; extern VTList vtlist;