git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@708 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
53e4f68189
commit
ad6e94828f
|
@ -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
|
- FIX: Modified the default value for the STM32 HSI setup it was 1, it should
|
||||||
be 0x10.
|
be 0x10.
|
||||||
- FIX: Removed an obsolete constant (P_SUSPENDED) from thread.h.
|
- FIX: Removed an obsolete constant (P_SUSPENDED) from thread.h.
|
||||||
|
- FIX: Removed unused field mp_grow in the MemoryPool structure.
|
||||||
|
|
||||||
*** 1.0.0 ***
|
*** 1.0.0 ***
|
||||||
- License switch, added GPL exception, see exception.txt.
|
- License switch, added GPL exception, see exception.txt.
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
* @brief CondVar structure.
|
* @brief CondVar structure.
|
||||||
*/
|
*/
|
||||||
typedef struct CondVar {
|
typedef struct CondVar {
|
||||||
ThreadsQueue c_queue;
|
ThreadsQueue c_queue; /**< CondVar threads queue.*/
|
||||||
} CondVar;
|
} CondVar;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -36,17 +36,23 @@
|
||||||
*/
|
*/
|
||||||
#define MEM_FILL_PATTERN 0x55
|
#define MEM_FILL_PATTERN 0x55
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace buffer record.
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *cse_wtobjp;
|
void *cse_wtobjp; /**< Object where going to sleep.*/
|
||||||
systime_t cse_time;
|
systime_t cse_time; /**< Time of the switch event.*/
|
||||||
uint16_t cse_state: 4;
|
uint16_t cse_state: 4; /**< Switched out thread state.*/
|
||||||
uint16_t cse_tid: 12;
|
uint16_t cse_tid: 12; /**< Switched in thdread id.*/
|
||||||
} CtxSwcEvent;
|
} CtxSwcEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Trace buffer header.
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
size_t tb_size;
|
unsigned tb_size; /**< Trace buffer size (records).*/
|
||||||
CtxSwcEvent *tb_ptr;
|
CtxSwcEvent *tb_ptr; /**< Pointer to the ring buffer front.*/
|
||||||
CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE];
|
CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; /**< Ring buffer.*/
|
||||||
} TraceBuffer;
|
} TraceBuffer;
|
||||||
|
|
||||||
extern CtxSwcEvent *dbgnext;
|
extern CtxSwcEvent *dbgnext;
|
||||||
|
|
|
@ -36,20 +36,20 @@ typedef struct EventListener EventListener;
|
||||||
* @brief Event Listener structure.
|
* @brief Event Listener structure.
|
||||||
*/
|
*/
|
||||||
struct EventListener {
|
struct EventListener {
|
||||||
/** Next Event Listener registered on the Event Source.*/
|
EventListener *el_next; /**< Next Event Listener registered on
|
||||||
EventListener *el_next;
|
the Event Source.*/
|
||||||
/** Thread interested in the Event Source.*/
|
Thread *el_listener; /**< Thread interested in the Event
|
||||||
Thread *el_listener;
|
Source.*/
|
||||||
/** Event flags mask associated by the thread to the Event Source.*/
|
eventmask_t el_mask; /**< Event flags mask associated by the
|
||||||
eventmask_t el_mask;
|
thread to the Event Source.*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Event Source structure.
|
* @brief Event Source structure.
|
||||||
*/
|
*/
|
||||||
typedef struct EventSource {
|
typedef struct EventSource {
|
||||||
/** First Event Listener registered on the Event Source.*/
|
EventListener *es_next; /**< First Event Listener registered on
|
||||||
EventListener *es_next;
|
the Event Source.*/
|
||||||
} EventSource;
|
} EventSource;
|
||||||
|
|
||||||
/** Returns the event mask from the event identifier.*/
|
/** Returns the event mask from the event identifier.*/
|
||||||
|
|
|
@ -36,10 +36,10 @@ typedef struct Thread Thread;
|
||||||
* @extends ThreadsList
|
* @extends ThreadsList
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** First @p Thread in the queue, or @p ThreadQueue when empty. */
|
Thread *p_next; /**< First @p Thread in the queue, or
|
||||||
Thread *p_next;
|
@p ThreadQueue when empty.*/
|
||||||
/** Last @p Thread in the queue, or @p ThreadQueue when empty. */
|
Thread *p_prev; /**< Last @p Thread in the queue, or
|
||||||
Thread *p_prev;
|
@p ThreadQueue when empty.*/
|
||||||
} ThreadsQueue;
|
} ThreadsQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +47,8 @@ typedef struct {
|
||||||
* @details This list behaves like a stack.
|
* @details This list behaves like a stack.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Last pushed @p Thread on the stack list, or @p ThreadList when empty. */
|
Thread *p_next; /**< Last pushed @p Thread on the stack,
|
||||||
Thread *p_next;
|
or @p ThreadList when empty.*/
|
||||||
} ThreadsList;
|
} ThreadsList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -27,16 +27,19 @@
|
||||||
|
|
||||||
#ifdef CH_USE_MEMPOOLS
|
#ifdef CH_USE_MEMPOOLS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Memory pool free object header.
|
||||||
|
*/
|
||||||
struct pool_header {
|
struct pool_header {
|
||||||
struct pool_header *ph_next;
|
struct pool_header *ph_next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Memory pool descriptor.
|
||||||
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct pool_header *mp_next;
|
struct pool_header *mp_next; /**< Pointer to the header.*/
|
||||||
size_t mp_object_size;
|
size_t mp_object_size; /**< Memory pool objects size.*/
|
||||||
#ifdef CH_USE_HEAP
|
|
||||||
bool_t mp_grow;
|
|
||||||
#endif /* CH_USE_HEAP */
|
|
||||||
} MemoryPool;
|
} MemoryPool;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -31,12 +31,12 @@
|
||||||
* @brief Mutex structure.
|
* @brief Mutex structure.
|
||||||
*/
|
*/
|
||||||
typedef struct Mutex {
|
typedef struct Mutex {
|
||||||
/** Queue of the threads sleeping on this Mutex.*/
|
ThreadsQueue m_queue; /**< Queue of the threads sleeping on
|
||||||
ThreadsQueue m_queue;
|
this Mutex.*/
|
||||||
/** Owner @p Thread pointer or @p NULL.*/
|
Thread *m_owner; /**< Owner @p Thread pointer or
|
||||||
Thread *m_owner;
|
@p NULL.*/
|
||||||
/** Next @p Mutex into an owner-list, @p NULL if none.*/
|
struct Mutex *m_next; /**< Next @p Mutex into an owner-list
|
||||||
struct Mutex *m_next;
|
or @p NULL.*/
|
||||||
} Mutex;
|
} Mutex;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -46,18 +46,13 @@ typedef void (*qnotify_t)(void);
|
||||||
* the difference is on how the semaphore is initialized.
|
* the difference is on how the semaphore is initialized.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Pointer to the queue buffer. */
|
uint8_t *q_buffer; /**< Pointer to the queue buffer.*/
|
||||||
uint8_t *q_buffer;
|
uint8_t *q_top; /**< Pointer to the first location
|
||||||
/** Pointer to the first location after the buffer. */
|
after the buffer.*/
|
||||||
uint8_t *q_top;
|
uint8_t *q_wrptr; /**< Write pointer.*/
|
||||||
/** Write pointer. */
|
uint8_t *q_rdptr; /**< Read pointer.*/
|
||||||
uint8_t *q_wrptr;
|
Semaphore q_sem; /**< Counter @p Semaphore.*/
|
||||||
/** Read pointer. */
|
qnotify_t q_notify; /**< Data notification callback.*/
|
||||||
uint8_t *q_rdptr;
|
|
||||||
/** Counter semaphore. */
|
|
||||||
Semaphore q_sem;
|
|
||||||
/** Data notification callback. */
|
|
||||||
qnotify_t q_notify;
|
|
||||||
} Queue;
|
} Queue;
|
||||||
|
|
||||||
/** Returns the queue's buffer size. */
|
/** Returns the queue's buffer size. */
|
||||||
|
@ -120,22 +115,17 @@ extern "C" {
|
||||||
* @brief Half duplex queue structure.
|
* @brief Half duplex queue structure.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Pointer to the queue buffer. */
|
uint8_t *hdq_buffer; /**< Pointer to the queue buffer.*/
|
||||||
uint8_t *hdq_buffer;
|
uint8_t *hdq_top; /**< Pointer to the first location
|
||||||
/** Pointer to the first location after the buffer. */
|
after the buffer. */
|
||||||
uint8_t *hdq_top;
|
uint8_t *hdq_wrptr; /**< Write pointer.*/
|
||||||
/** Write pointer.*/
|
uint8_t *hdq_rdptr; /**< Read pointer.*/
|
||||||
uint8_t *hdq_wrptr;
|
Semaphore hdq_isem; /**< Input counter @p Semaphore.*/
|
||||||
/** Read pointer.*/
|
Semaphore hdq_osem; /**< Output counter @p Semaphore.*/
|
||||||
uint8_t *hdq_rdptr;
|
qnotify_t hdq_inotify; /**< Input data notification
|
||||||
/** Input counter semaphore. */
|
callback.*/
|
||||||
Semaphore hdq_isem;
|
qnotify_t hdq_onotify; /**< Output data notification
|
||||||
/** Output counter semaphore. */
|
callback.*/
|
||||||
Semaphore hdq_osem;
|
|
||||||
/** Input data notification callback. */
|
|
||||||
qnotify_t hdq_inotify;
|
|
||||||
/** Output data notification callback. */
|
|
||||||
qnotify_t hdq_onotify;
|
|
||||||
} HalfDuplexQueue;
|
} HalfDuplexQueue;
|
||||||
|
|
||||||
/** Returns the queue's buffer size. */
|
/** Returns the queue's buffer size. */
|
||||||
|
|
|
@ -52,21 +52,18 @@
|
||||||
* @extends ThreadsQueue
|
* @extends ThreadsQueue
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Next @p Thread in the ready list.*/
|
Thread *p_next; /**< Next @p Thread in the ready list.*/
|
||||||
Thread *p_next;
|
Thread *p_prev; /**< Previous @p Thread in the ready
|
||||||
/** Previous @p Thread in the ready list.*/
|
list.*/
|
||||||
Thread *p_prev;
|
|
||||||
/* End of the fields shared with the ThreadsQueue structure. */
|
/* End of the fields shared with the ThreadsQueue structure. */
|
||||||
/** The thread priority.*/
|
tprio_t r_prio; /**< This field must be initialized to
|
||||||
tprio_t r_prio;
|
zero.*/
|
||||||
/* End of the fields shared with the Thread structure. */
|
/* End of the fields shared with the Thread structure. */
|
||||||
#ifdef CH_USE_ROUNDROBIN
|
#ifdef CH_USE_ROUNDROBIN
|
||||||
/** Round robin counter.*/
|
cnt_t r_preempt; /**< Round robin counter.*/
|
||||||
cnt_t r_preempt;
|
|
||||||
#endif
|
#endif
|
||||||
#ifndef CH_CURRP_REGISTER_CACHE
|
#ifndef CH_CURRP_REGISTER_CACHE
|
||||||
/** The currently running thread.*/
|
Thread *r_current; /**< The currently running thread.*/
|
||||||
Thread *r_current;
|
|
||||||
#endif
|
#endif
|
||||||
} ReadyList;
|
} ReadyList;
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,9 @@
|
||||||
* @brief Semaphore structure.
|
* @brief Semaphore structure.
|
||||||
*/
|
*/
|
||||||
typedef struct Semaphore {
|
typedef struct Semaphore {
|
||||||
/** Queue of the threads sleeping on this Semaphore.*/
|
ThreadsQueue s_queue; /**< Queue of the threads sleeping on
|
||||||
ThreadsQueue s_queue;
|
this semaphore.*/
|
||||||
/** The Semaphore counter.*/
|
cnt_t s_cnt; /**< The semaphore counter.*/
|
||||||
cnt_t s_cnt;
|
|
||||||
} Semaphore;
|
} Semaphore;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct Thread {
|
||||||
Thread *p_next; /**< Next @p Thread in the threads
|
Thread *p_next; /**< Next @p Thread in the threads
|
||||||
list/queue.*/
|
list/queue.*/
|
||||||
/* End of the fields shared with the ThreadsList structure. */
|
/* 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.*/
|
queue.*/
|
||||||
/* End of the fields shared with the ThreadsQueue structure. */
|
/* End of the fields shared with the ThreadsQueue structure. */
|
||||||
tprio_t p_prio; /**< Thread priority.*/
|
tprio_t p_prio; /**< Thread priority.*/
|
||||||
|
|
|
@ -52,17 +52,14 @@ typedef struct VirtualTimer VirtualTimer;
|
||||||
* @extends DeltaList
|
* @extends DeltaList
|
||||||
*/
|
*/
|
||||||
struct VirtualTimer {
|
struct VirtualTimer {
|
||||||
/** Next timer in the delta list.*/
|
VirtualTimer *vt_next; /**< Next timer in the delta list.*/
|
||||||
VirtualTimer *vt_next;
|
VirtualTimer *vt_prev; /**< Previous timer in the delta list.*/
|
||||||
/** Previous timer in the delta list.*/
|
systime_t vt_time; /**< Time delta before timeout.*/
|
||||||
VirtualTimer *vt_prev;
|
vtfunc_t vt_func; /**< Timer callback function pointer.
|
||||||
/** Time delta before timeout.*/
|
The pointer is reset to zero after
|
||||||
systime_t vt_time;
|
the callback is invoked.*/
|
||||||
/** Timer callback function pointer. The pointer is reset to zero after
|
void *vt_par; /**< Timer callback function
|
||||||
the callback is invoked.*/
|
parameter.*/
|
||||||
vtfunc_t vt_func;
|
|
||||||
/** Timer callback function parameter.*/
|
|
||||||
void *vt_par;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,14 +69,11 @@ struct VirtualTimer {
|
||||||
* is often used in the code.
|
* is often used in the code.
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/** Next timer in the list (the one that will be triggered next).*/
|
VirtualTimer *vt_next; /**< Next timer in the delta list (the
|
||||||
VirtualTimer *vt_next;
|
one that will be triggered next).*/
|
||||||
/** Last timer in the list.*/
|
VirtualTimer *vt_prev; /**< Last timer in the delta list.*/
|
||||||
VirtualTimer *vt_prev;
|
systime_t vt_time; /**< Must be initialized to -1.*/
|
||||||
/** Not used but it must be set to -1.*/
|
volatile systime_t vt_systime; /**< System Time counter.*/
|
||||||
systime_t vt_time;
|
|
||||||
/** System Time counter.*/
|
|
||||||
volatile systime_t vt_systime;
|
|
||||||
} VTList;
|
} VTList;
|
||||||
|
|
||||||
extern VTList vtlist;
|
extern VTList vtlist;
|
||||||
|
|
Loading…
Reference in New Issue