git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@708 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2009-02-01 13:59:31 +00:00
parent 53e4f68189
commit ad6e94828f
12 changed files with 85 additions and 95 deletions

View File

@ -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.

View File

@ -35,7 +35,7 @@
* @brief CondVar structure.
*/
typedef struct CondVar {
ThreadsQueue c_queue;
ThreadsQueue c_queue; /**< CondVar threads queue.*/
} CondVar;
#ifdef __cplusplus

View File

@ -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;

View File

@ -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.*/

View File

@ -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;
/**

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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;

View File

@ -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

View File

@ -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.*/

View File

@ -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
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.*/
vtfunc_t vt_func;
/** Timer callback function parameter.*/
void *vt_par;
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;