From e06b155baa31443e76650d4c6aaca960af9f0051 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 7 Dec 2008 12:01:57 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@537 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- src/include/debug.h | 14 +++++++------- src/include/events.h | 10 +++++----- src/include/lists.h | 12 ++++++------ src/include/mempools.h | 2 +- src/include/messages.h | 4 ++-- src/include/mutexes.h | 6 +++--- src/include/queues.h | 38 +++++++++++++++++++------------------- src/include/scheduler.h | 26 +++++++++++++------------- src/include/semaphores.h | 10 +++++----- src/include/serial.h | 37 ++++++++++++++++++------------------- src/include/threads.h | 26 +++++++++++++------------- 11 files changed, 92 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/include/debug.h b/src/include/debug.h index 783709062..6bd3845b4 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -37,16 +37,16 @@ #define MEM_FILL_PATTERN 0x55 typedef struct { - void *cse_wtobjp; - systime_t cse_time; - uint16_t cse_state: 4; - uint16_t cse_tid: 12; + void *cse_wtobjp; + systime_t cse_time; + uint16_t cse_state: 4; + uint16_t cse_tid: 12; } CtxSwcEvent; typedef struct { - size_t tb_size; - CtxSwcEvent *tb_ptr; - CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; + size_t tb_size; + CtxSwcEvent *tb_ptr; + CtxSwcEvent tb_buffer[TRACE_BUFFER_SIZE]; } TraceBuffer; extern CtxSwcEvent *dbgnext; diff --git a/src/include/events.h b/src/include/events.h index c851a2c82..0ebe9952a 100644 --- a/src/include/events.h +++ b/src/include/events.h @@ -37,11 +37,11 @@ typedef struct EventListener EventListener; */ struct EventListener { /** Next Event Listener registered on the Event Source.*/ - EventListener *el_next; + EventListener *el_next; /** Thread interested in the Event Source.*/ - Thread *el_listener; + Thread *el_listener; /** Event flags mask associated by the thread to the Event Source.*/ - eventmask_t el_mask; + eventmask_t el_mask; }; /** @@ -49,12 +49,12 @@ struct EventListener { */ typedef struct EventSource { /** First Event Listener registered on the Event Source.*/ - EventListener *es_next; + EventListener *es_next; } EventSource; /** Returns the event mask from the event identifier. * @deprecated use EVENT_MASK() instead.*/ -#define EventMask(eid) (1 << (eid)) +#define EventMask(eid) (1 << (eid)) /** Returns the event mask from the event identifier.*/ #define EVENT_MASK(eid) (1 << (eid)) diff --git a/src/include/lists.h b/src/include/lists.h index 785d3b013..5f4a73d67 100644 --- a/src/include/lists.h +++ b/src/include/lists.h @@ -28,8 +28,8 @@ typedef struct Thread Thread; /* Macros good with both ThreadsQueue and ThreadsList.*/ -#define isempty(p) ((p)->p_next == (Thread *)(p)) -#define notempty(p) ((p)->p_next != (Thread *)(p)) +#define isempty(p) ((p)->p_next == (Thread *)(p)) +#define notempty(p) ((p)->p_next != (Thread *)(p)) /** * Generic threads queue header and element. @@ -37,9 +37,9 @@ typedef struct Thread Thread; */ typedef struct { /** First \p Thread in the queue, or \p ThreadQueue when empty. */ - Thread *p_next; + Thread *p_next; /** Last \p Thread in the queue, or \p ThreadQueue when empty. */ - Thread *p_prev; + Thread *p_prev; } ThreadsQueue; /** @@ -47,14 +47,14 @@ typedef struct { */ typedef struct { /** Last pushed \p Thread on the stack list, or \p ThreadList when empty. */ - Thread *p_next; + Thread *p_next; } ThreadsList; /* * Threads Lists functions and macros. */ #define queue_init(tqp) ((tqp)->p_next = (tqp)->p_prev = (Thread *)(tqp)); -#define list_init(tlp) ((tlp)->p_next = (Thread *)(tlp)) +#define list_init(tlp) ((tlp)->p_next = (Thread *)(tlp)) #ifndef CH_OPTIMIZE_SPEED diff --git a/src/include/mempools.h b/src/include/mempools.h index 28ddeea35..fb7f9a22b 100644 --- a/src/include/mempools.h +++ b/src/include/mempools.h @@ -28,7 +28,7 @@ #ifdef CH_USE_MEMPOOLS struct pool_header { - struct pool_header *ph_next; + struct pool_header *ph_next; }; typedef struct { diff --git a/src/include/messages.h b/src/include/messages.h index ae6ae9bb3..c93d6a2d7 100644 --- a/src/include/messages.h +++ b/src/include/messages.h @@ -31,13 +31,13 @@ * Evaluates to TRUE if the thread has pending messages. */ #define chMsgIsPendingI(tp) \ - ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue) + ((tp)->p_msgqueue.p_next != (Thread *)&(tp)->p_msgqueue) /** * Returns the first message in the queue. */ #define chMsgGetI(tp) \ - ((tp)->p_msgqueue.p_next->p_msg) + ((tp)->p_msgqueue.p_next->p_msg) #ifdef __cplusplus extern "C" { diff --git a/src/include/mutexes.h b/src/include/mutexes.h index b9b399c86..e4ddcfb43 100644 --- a/src/include/mutexes.h +++ b/src/include/mutexes.h @@ -32,11 +32,11 @@ */ typedef struct Mutex { /** Queue of the threads sleeping on this Mutex.*/ - ThreadsQueue m_queue; + ThreadsQueue m_queue; /** Owner \p Thread pointer or \p NULL.*/ - Thread *m_owner; + Thread *m_owner; /** Next \p Mutex into an owner-list, \p NULL if none.*/ - struct Mutex *m_next; + struct Mutex *m_next; } Mutex; #ifdef __cplusplus diff --git a/src/include/queues.h b/src/include/queues.h index 0a373b5ea..90456f4d1 100644 --- a/src/include/queues.h +++ b/src/include/queues.h @@ -29,15 +29,15 @@ typedef void (*qnotify_t)(void); /** Returned by the queue functions if the operation is successful. */ -#define Q_OK RDY_OK +#define Q_OK RDY_OK /** Returned by the queue functions if a timeout occurs. */ -#define Q_TIMEOUT RDY_TIMEOUT +#define Q_TIMEOUT RDY_TIMEOUT /** Returned by the queue functions if the queue is reset. */ -#define Q_RESET RDY_RESET +#define Q_RESET RDY_RESET /** Returned by the queue functions if the queue is empty. */ -#define Q_EMPTY -3 +#define Q_EMPTY -3 /** Returned by the queue functions if the queue is full. */ -#define Q_FULL -4 +#define Q_FULL -4 #ifdef CH_USE_QUEUES /** @@ -46,17 +46,17 @@ typedef void (*qnotify_t)(void); */ typedef struct { /** Pointer to the queue buffer. */ - uint8_t *q_buffer; + uint8_t *q_buffer; /** Pointer to the first location after the buffer. */ - uint8_t *q_top; + uint8_t *q_top; /** Write pointer. */ - uint8_t *q_wrptr; + uint8_t *q_wrptr; /** Read pointer. */ - uint8_t *q_rdptr; + uint8_t *q_rdptr; /** Counter semaphore. */ - Semaphore q_sem; + Semaphore q_sem; /** Data notification callback. */ - qnotify_t q_notify; + qnotify_t q_notify; } Queue; /** Returns the queue's buffer size. */ @@ -120,21 +120,21 @@ extern "C" { */ typedef struct { /** Pointer to the queue buffer. */ - uint8_t *hdq_buffer; + uint8_t *hdq_buffer; /** Pointer to the first location after the buffer. */ - uint8_t *hdq_top; + uint8_t *hdq_top; /** Write pointer.*/ - uint8_t *hdq_wrptr; + uint8_t *hdq_wrptr; /** Read pointer.*/ - uint8_t *hdq_rdptr; + uint8_t *hdq_rdptr; /** Input counter semaphore. */ - Semaphore hdq_isem; + Semaphore hdq_isem; /** Output counter semaphore. */ - Semaphore hdq_osem; + Semaphore hdq_osem; /** Input data notification callback. */ - qnotify_t hdq_inotify; + qnotify_t hdq_inotify; /** Output data notification callback. */ - qnotify_t hdq_onotify; + qnotify_t hdq_onotify; } HalfDuplexQueue; /** Returns the queue's buffer size. */ diff --git a/src/include/scheduler.h b/src/include/scheduler.h index dbeb8ee1e..f4dac7d16 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -26,31 +26,31 @@ #define _SCHEDULER_H_ /** Normal \p chSchReadyI() message. */ -#define RDY_OK 0 +#define RDY_OK 0 /** Returned when the thread was made ready because of a timeout. */ -#define RDY_TIMEOUT -1 +#define RDY_TIMEOUT -1 /** Returned when the thread was made ready because of a reset. */ -#define RDY_RESET -2 +#define RDY_RESET -2 /** Pseudo priority used by the ready list header, do not use.*/ -#define NOPRIO 0 +#define NOPRIO 0 /** Idle thread priority.*/ -#define IDLEPRIO 1 +#define IDLEPRIO 1 /** Lowest user priority.*/ -#define LOWPRIO 2 +#define LOWPRIO 2 /** Normal user priority.*/ -#define NORMALPRIO 64 +#define NORMALPRIO 64 /** Highest user priority.*/ -#define HIGHPRIO 127 +#define HIGHPRIO 127 /** Greatest possible priority.*/ -#define ABSPRIO 255 +#define ABSPRIO 255 /** Infinite time specification for all the syscalls with a timeout specification.*/ -#define TIME_INFINITE 0 +#define TIME_INFINITE 0 /** The priority of the first thread on the given ready list. */ -#define firstprio(rlp) ((rlp)->p_next->p_prio) +#define firstprio(rlp) ((rlp)->p_next->p_prio) /** * Ready list header. @@ -58,9 +58,9 @@ */ typedef struct { /** Next \p Thread in the ready list.*/ - Thread *p_next; + Thread *p_next; /** Previous \p Thread in the ready list.*/ - Thread *p_prev; + Thread *p_prev; /* End of the fields shared with the ThreadsQueue structure. */ /** The thread priority.*/ tprio_t r_prio; diff --git a/src/include/semaphores.h b/src/include/semaphores.h index 45486874b..5faa6e97e 100644 --- a/src/include/semaphores.h +++ b/src/include/semaphores.h @@ -32,9 +32,9 @@ */ typedef struct { /** Queue of the threads sleeping on this Semaphore.*/ - ThreadsQueue s_queue; + ThreadsQueue s_queue; /** The Semaphore counter.*/ - cnt_t s_cnt; + cnt_t s_cnt; } Semaphore; #ifdef __cplusplus @@ -62,18 +62,18 @@ extern "C" { * Decreases the semaphore counter, this macro can be used when it is ensured * that the counter would not become negative. */ -#define chSemFastWaitS(sp) ((sp)->s_cnt--) +#define chSemFastWaitS(sp) ((sp)->s_cnt--) /** * Increases the semaphore counter, this macro can be used when the counter is * not negative. */ -#define chSemFastSignalI(sp) ((sp)->s_cnt++) +#define chSemFastSignalI(sp) ((sp)->s_cnt++) /** * Returns the semaphore counter current value. */ -#define chSemGetCounter(sp) ((sp)->s_cnt) +#define chSemGetCounter(sp) ((sp)->s_cnt) #endif /* CH_USE_SEMAPHORES */ diff --git a/src/include/serial.h b/src/include/serial.h index 4b7b02b7c..25dcfa9ec 100644 --- a/src/include/serial.h +++ b/src/include/serial.h @@ -26,19 +26,19 @@ #define _SERIAL_H_ /** No pending conditions.*/ -#define SD_NO_ERROR 0 +#define SD_NO_ERROR 0 /** Connection happened.*/ -#define SD_CONNECTED 1 +#define SD_CONNECTED 1 /** Disconnection happened.*/ -#define SD_DISCONNECTED 2 +#define SD_DISCONNECTED 2 /** Parity error happened.*/ -#define SD_PARITY_ERROR 4 +#define SD_PARITY_ERROR 4 /** Framing error happened.*/ -#define SD_FRAMING_ERROR 8 +#define SD_FRAMING_ERROR 8 /** Overflow happened.*/ -#define SD_OVERRUN_ERROR 16 +#define SD_OVERRUN_ERROR 16 /** Break detected.*/ -#define SD_BREAK_DETECTED 32 +#define SD_BREAK_DETECTED 32 /** Serial Driver condition flags type.*/ typedef uint16_t dflags_t; @@ -52,24 +52,24 @@ typedef struct { /** Input queue. Incoming data can be read from this queue by using the * queues APIs.*/ - Queue sd_iqueue; + Queue sd_iqueue; /** Data Available \p EventSource. This event is generated when some incoming * data is inserted in the Input \p Queue.*/ - EventSource sd_ievent; + EventSource sd_ievent; /** Output queue. Outgoing data can be written to this Output \p Queue by * using the queues APIs.*/ - Queue sd_oqueue; + Queue sd_oqueue; /** Data Transmitted \p EventSource. This event is generated when the * Output \p Queue is empty.*/ - EventSource sd_oevent; + EventSource sd_oevent; /** I/O driver status flags. This field should not be read directly but * the \p chFDDGetAndClearFlags() funtion should be used instead.*/ - dflags_t sd_flags; + dflags_t sd_flags; /** Status Change \p EventSource. This event is generated when a * condition flag was changed.*/ - EventSource sd_sevent; + EventSource sd_sevent; } FullDuplexDriver; #ifdef __cplusplus @@ -116,22 +116,21 @@ extern "C" { typedef struct { /** Data queue. Transmit/receive \p HalfDuplexQueue.*/ - HalfDuplexQueue sd_queue; + HalfDuplexQueue sd_queue; /** Data Available \p EventSource. This event is generated when some * incoming data is inserted in the receive queue.*/ - EventSource sd_ievent; + EventSource sd_ievent; /** Data Transmitted \p EventSource. This event is generated when the * transmission queue is empty and the driver can either transmit more * data or enter receive mode.*/ - EventSource sd_oevent; - + EventSource sd_oevent; /** I/O driver status flags. This field should not be read directly but * the \p chHDDGetAndClearFlags() funtion should be used * instead.*/ - dflags_t sd_flags; + dflags_t sd_flags; /** Status Change Event Source. This event is generated when a condition * flag was changed.*/ - EventSource sd_sevent; + EventSource sd_sevent; } HalfDuplexDriver; #ifdef __cplusplus diff --git a/src/include/threads.h b/src/include/threads.h index 959a48b0e..b939ba3a1 100644 --- a/src/include/threads.h +++ b/src/include/threads.h @@ -122,32 +122,32 @@ struct Thread { }; /** Thread state: Ready to run, waiting on the ready list.*/ -#define PRREADY 0 +#define PRREADY 0 /** Thread state: Currently running. */ -#define PRCURR 1 +#define PRCURR 1 /** Thread state: Thread created in suspended state. */ -#define PRSUSPENDED 2 +#define PRSUSPENDED 2 /** Thread state: Waiting on a semaphore. */ -#define PRWTSEM 3 +#define PRWTSEM 3 /** Thread state: Waiting on a mutex. */ -#define PRWTMTX 4 +#define PRWTMTX 4 /** Thread state: Waiting in \p chThdSleep() or \p chThdSleepUntil(). */ -#define PRWTCOND 5 +#define PRWTCOND 5 /** Thread state: Waiting in \p chCondWait(). */ -#define PRSLEEP 6 +#define PRSLEEP 6 /** Thread state: Waiting in \p chThdWait(). */ -#define PRWAIT 7 +#define PRWAIT 7 /** Thread state: Waiting in \p chEvtWaitOneTimeout() or \p chEvtWaitAnyTimeout(). */ -#define PRWTOREVT 8 +#define PRWTOREVT 8 /** Thread state: Waiting in \p chEvtWaitAllTimeout(). */ -#define PRWTANDEVT 9 +#define PRWTANDEVT 9 /** Thread state: Waiting in \p chMsgSend(). */ -#define PRSNDMSG 10 +#define PRSNDMSG 10 /** Thread state: Waiting in \p chMsgWait(). */ -#define PRWTMSG 11 +#define PRWTMSG 11 /** Thread state: After termination.*/ -#define PREXIT 12 +#define PREXIT 12 /* * Various flags into the thread p_flags field. -- cgit v1.2.3