diff options
Diffstat (limited to 'os/kernel/include')
-rw-r--r-- | os/kernel/include/ch.h | 13 | ||||
-rw-r--r-- | os/kernel/include/chdynamic.h | 4 | ||||
-rw-r--r-- | os/kernel/include/chevents.h | 70 | ||||
-rw-r--r-- | os/kernel/include/chfiles.h | 165 | ||||
-rw-r--r-- | os/kernel/include/chheap.h | 54 | ||||
-rw-r--r-- | os/kernel/include/chmboxes.h | 149 | ||||
-rw-r--r-- | os/kernel/include/chmemcore.h | 30 | ||||
-rw-r--r-- | os/kernel/include/chmempools.h | 83 | ||||
-rw-r--r-- | os/kernel/include/chmsg.h | 69 | ||||
-rw-r--r-- | os/kernel/include/chmtx.h | 82 | ||||
-rw-r--r-- | os/kernel/include/chregistry.h | 101 | ||||
-rw-r--r-- | os/kernel/include/chsys.h | 215 | ||||
-rw-r--r-- | os/kernel/include/chthreads.h | 4 |
13 files changed, 542 insertions, 497 deletions
diff --git a/os/kernel/include/ch.h b/os/kernel/include/ch.h index 1237a3ae9..a7cafb581 100644 --- a/os/kernel/include/ch.h +++ b/os/kernel/include/ch.h @@ -128,19 +128,6 @@ typedef struct thread thread_t; #include "chdynamic.h"
#include "chqueues.h"
#include "chstreams.h"
-#include "chfiles.h"
-
-#if !defined(__DOXYGEN__)
-extern WORKING_AREA(_idle_thread_wa, PORT_IDLE_THREAD_STACK_SIZE);
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void _idle_thread(void *p);
-#ifdef __cplusplus
-}
-#endif
#endif /* _CH_H_ */
diff --git a/os/kernel/include/chdynamic.h b/os/kernel/include/chdynamic.h index a8ba91a86..752fee90c 100644 --- a/os/kernel/include/chdynamic.h +++ b/os/kernel/include/chdynamic.h @@ -74,11 +74,11 @@ extern "C" { thread_t *chThdAddRef(thread_t *tp);
void chThdRelease(thread_t *tp);
#if CH_USE_HEAP
- thread_t *chThdCreateFromHeap(MemoryHeap *heapp, size_t size,
+ thread_t *chThdCreateFromHeap(memory_heap_t *heapp, size_t size,
tprio_t prio, tfunc_t pf, void *arg);
#endif
#if CH_USE_MEMPOOLS
- thread_t *chThdCreateFromMemoryPool(MemoryPool *mp, tprio_t prio,
+ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio,
tfunc_t pf, void *arg);
#endif
#ifdef __cplusplus
diff --git a/os/kernel/include/chevents.h b/os/kernel/include/chevents.h index 2cedea7b9..4fe072050 100644 --- a/os/kernel/include/chevents.h +++ b/os/kernel/include/chevents.h @@ -50,32 +50,30 @@ /* Module data structures and types. */
/*===========================================================================*/
-typedef struct EventListener EventListener;
+typedef struct event_listener event_listener_t;
/**
* @brief Event Listener structure.
*/
-struct EventListener {
- EventListener *el_next; /**< @brief Next Event Listener
- registered on the Event
- Source. */
+struct event_listener {
+ event_listener_t *el_next; /**< @brief Next Event Listener
+ registered on the event
+ source. */
thread_t *el_listener; /**< @brief Thread interested in the
- Event Source. */
- eventmask_t el_mask; /**< @brief Event flags mask associated
- by the thread to the Event
- Source. */
- flagsmask_t el_flags; /**< @brief Flags added to the listener
+ event source. */
+ eventmask_t el_mask; /**< @brief Event identifiers mask. */
+ eventflags_t el_flags; /**< @brief Flags added to the listener
by the event source.*/
};
/**
* @brief Event Source structure.
*/
-typedef struct EventSource {
- EventListener *es_next; /**< @brief First Event Listener
+typedef struct event_source {
+ event_listener_t *es_next; /**< @brief First Event Listener
registered on the Event
Source. */
-} EventSource;
+} event_source_t;
/**
* @brief Event Handler callback function.
@@ -111,7 +109,7 @@ typedef void (*evhandler_t)(eventid_t); *
* @param name the name of the event source variable
*/
-#define EVENTSOURCE_DECL(name) EventSource name = _EVENTSOURCE_DATA(name)
+#define EVENTSOURCE_DECL(name) event_source_t name = _EVENTSOURCE_DATA(name)
/*===========================================================================*/
/* External declarations. */
@@ -120,18 +118,18 @@ typedef void (*evhandler_t)(eventid_t); #ifdef __cplusplus
extern "C" {
#endif
- void chEvtRegisterMask(EventSource *esp,
- EventListener *elp,
+ void chEvtRegisterMask(event_source_t *esp,
+ event_listener_t *elp,
eventmask_t mask);
- void chEvtUnregister(EventSource *esp, EventListener *elp);
+ void chEvtUnregister(event_source_t *esp, event_listener_t *elp);
eventmask_t chEvtGetAndClearEvents(eventmask_t mask);
eventmask_t chEvtAddEvents(eventmask_t mask);
- flagsmask_t chEvtGetAndClearFlags(EventListener *elp);
- flagsmask_t chEvtGetAndClearFlagsI(EventListener *elp);
+ eventflags_t chEvtGetAndClearFlags(event_listener_t *elp);
+ eventflags_t chEvtGetAndClearFlagsI(event_listener_t *elp);
void chEvtSignal(thread_t *tp, eventmask_t mask);
void chEvtSignalI(thread_t *tp, eventmask_t mask);
- void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags);
- void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags);
+ void chEvtBroadcastFlags(event_source_t *esp, eventflags_t flags);
+ void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags);
void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask);
#if CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT
eventmask_t chEvtWaitOne(eventmask_t mask);
@@ -160,15 +158,15 @@ extern "C" { /**
* @brief Initializes an Event Source.
* @note This function can be invoked before the kernel is initialized
- * because it just prepares a @p EventSource structure.
+ * because it just prepares a @p event_source_t structure.
*
- * @param[in] esp pointer to the @p EventSource structure
+ * @param[in] esp pointer to the @p event_source_t structure
*
* @init
*/
-static inline void chEvtInit(EventSource *esp) {
+static inline void chEvtInit(event_source_t *esp) {
- esp->es_next = (EventListener *)(void *)esp;
+ esp->es_next = (event_listener_t *)(void *)esp;
}
/**
@@ -176,8 +174,8 @@ static inline void chEvtInit(EventSource *esp) { * @note Multiple Event Listeners can use the same event identifier, the
* listener will share the callback function.
*
- * @param[in] esp pointer to the @p EventSource structure
- * @param[out] elp pointer to the @p EventListener structure
+ * @param[in] esp pointer to the @p event_source_t structure
+ * @param[out] elp pointer to the @p event_listener_t structure
* @param[in] eid numeric identifier assigned to the Event Listener. The
* identifier is used as index for the event callback
* function.
@@ -186,21 +184,21 @@ static inline void chEvtInit(EventSource *esp) { *
* @api
*/
-static inline void chEvtRegister(EventSource *esp,
- EventListener *elp,
+static inline void chEvtRegister(event_source_t *esp,
+ event_listener_t *elp,
eventid_t eid) {
chEvtRegisterMask(esp, elp, EVENT_MASK(eid));
}
/**
- * @brief Verifies if there is at least one @p EventListener registered.
+ * @brief Verifies if there is at least one @p event_listener_t registered.
*
- * @param[in] esp pointer to the @p EventSource structure
+ * @param[in] esp pointer to the @p event_source_t structure
*
* @iclass
*/
-static inline bool chEvtIsListeningI(EventSource *esp) {
+static inline bool chEvtIsListeningI(event_source_t *esp) {
return (bool)((void *)esp != (void *)esp->es_next);
}
@@ -209,11 +207,11 @@ static inline bool chEvtIsListeningI(EventSource *esp) { * @brief Signals all the Event Listeners registered on the specified Event
* Source.
*
- * @param[in] esp pointer to the @p EventSource structure
+ * @param[in] esp pointer to the @p event_source_t structure
*
* @api
*/
-static inline void chEvtBroadcast(EventSource *esp) {
+static inline void chEvtBroadcast(event_source_t *esp) {
chEvtBroadcastFlags(esp, 0);
}
@@ -226,11 +224,11 @@ static inline void chEvtBroadcast(EventSource *esp) { * interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
- * @param[in] esp pointer to the @p EventSource structure
+ * @param[in] esp pointer to the @p event_source_t structure
*
* @iclass
*/
-static inline void chEvtBroadcastI(EventSource *esp) {
+static inline void chEvtBroadcastI(event_source_t *esp) {
chEvtBroadcastFlagsI(esp, 0);
}
diff --git a/os/kernel/include/chfiles.h b/os/kernel/include/chfiles.h deleted file mode 100644 index ad2974ad8..000000000 --- a/os/kernel/include/chfiles.h +++ /dev/null @@ -1,165 +0,0 @@ -/*
- ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
- 2011,2012,2013 Giovanni Di Sirio.
-
- This file is part of ChibiOS/RT.
-
- ChibiOS/RT is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- ChibiOS/RT is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-/**
- * @file chfiles.h
- * @brief Data files.
- * @details This header defines abstract interfaces useful to access generic
- * data files in a standardized way.
- *
- * @addtogroup data_files
- * @details This module define an abstract interface for generic data files by
- * extending the @p BaseSequentialStream interface. Note that no code
- * is present, data files are just abstract interface-like structures,
- * you should look at the systems as to a set of abstract C++ classes
- * (even if written in C). This system has the advantage to make the
- * access to streams independent from the implementation logic.<br>
- * The data files interface can be used as base class for high level
- * object types such as an API for a File System implementation.
- * @{
- */
-
-#ifndef _CHFILES_H_
-#define _CHFILES_H_
-
-/**
- * @brief No error return code.
- */
-#define FILE_OK 0
-
-/**
- * @brief Error code from the file stream methods.
- */
-#define FILE_ERROR 0xFFFFFFFFUL
-
-/**
- * @brief File offset type.
- */
-typedef uint32_t fileoffset_t;
-
-/**
- * @brief BaseFileStream specific methods.
- */
-#define _base_file_stream_methods \
- _base_sequential_stream_methods \
- /* File close method.*/ \
- uint32_t (*close)(void *instance); \
- /* Get last error code method.*/ \
- int (*geterror)(void *instance); \
- /* File get size method.*/ \
- fileoffset_t (*getsize)(void *instance); \
- /* File get current position method.*/ \
- fileoffset_t (*getposition)(void *instance); \
- /* File seek method.*/ \
- uint32_t (*lseek)(void *instance, fileoffset_t offset);
-
-/**
- * @brief @p BaseFileStream specific data.
- * @note It is empty because @p BaseFileStream is only an interface
- * without implementation.
- */
-#define _base_file_stream_data \
- _base_sequential_stream_data
-
-/**
- * @extends BaseSequentialStreamVMT
- *
- * @brief @p BaseFileStream virtual methods table.
- */
-struct BaseFileStreamVMT {
- _base_file_stream_methods
-};
-
-/**
- * @extends BaseSequentialStream
- *
- * @brief Base file stream class.
- * @details This class represents a generic file data stream.
- */
-typedef struct {
- /** @brief Virtual Methods Table.*/
- const struct BaseFileStreamVMT *vmt;
- _base_file_stream_data
-} BaseFileStream;
-
-/**
- * @name Macro Functions (BaseFileStream)
- * @{
- */
-/**
- * @brief Base file Stream close.
- * @details The function closes a file stream.
- *
- * @param[in] ip pointer to a @p BaseFileStream or derived class
- * @return The operation status.
- * @retval FILE_OK no error.
- * @retval FILE_ERROR operation failed.
- *
- * @api
- */
-#define chFileStreamClose(ip) ((ip)->vmt->close(ip))
-
-/**
- * @brief Returns an implementation dependent error code.
- *
- * @param[in] ip pointer to a @p BaseFileStream or derived class
- * @return Implementation dependent error code.
- *
- * @api
- */
-#define chFileStreamGetError(ip) ((ip)->vmt->geterror(ip))
-
-/**
- * @brief Returns the current file size.
- *
- * @param[in] ip pointer to a @p BaseFileStream or derived class
- * @return The file size.
- *
- * @api
- */
-#define chFileStreamGetSize(ip) ((ip)->vmt->getsize(ip))
-
-/**
- * @brief Returns the current file pointer position.
- *
- * @param[in] ip pointer to a @p BaseFileStream or derived class
- * @return The current position inside the file.
- *
- * @api
- */
-#define chFileStreamGetPosition(ip) ((ip)->vmt->getposition(ip))
-
-/**
- * @brief Moves the file current pointer to an absolute position.
- *
- * @param[in] ip pointer to a @p BaseFileStream or derived class
- * @param[in] offset new absolute position
- * @return The operation status.
- * @retval FILE_OK no error.
- * @retval FILE_ERROR operation failed.
- *
- * @api
- */
-#define chFileStreamSeek(ip, offset) ((ip)->vmt->lseek(ip, offset))
-/** @} */
-
-#endif /* _CHFILES_H_ */
-
-/** @} */
diff --git a/os/kernel/include/chheap.h b/os/kernel/include/chheap.h index 8a54d7290..03c1643ab 100644 --- a/os/kernel/include/chheap.h +++ b/os/kernel/include/chheap.h @@ -31,18 +31,34 @@ #if CH_USE_HEAP || defined(__DOXYGEN__)
-/*
- * Module dependencies check.
- */
-#if !CH_USE_MEMCORE && !CH_USE_MALLOC_HEAP
-#error "CH_USE_HEAP requires CH_USE_MEMCORE or CH_USE_MALLOC_HEAP"
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_MEMCORE
+#error "CH_USE_HEAP requires CH_USE_MEMCORE"
#endif
#if !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
#error "CH_USE_HEAP requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
#endif
-typedef struct memory_heap MemoryHeap;
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @brief Type of a memory heap.
+ */
+typedef struct memory_heap memory_heap_t;
/**
* @brief Memory heap block header.
@@ -52,7 +68,7 @@ union heap_header { struct {
union {
union heap_header *next; /**< @brief Next block in free list. */
- MemoryHeap *heap; /**< @brief Block owner heap. */
+ memory_heap_t *heap; /**< @brief Block owner heap. */
} u; /**< @brief Overlapped fields. */
size_t size; /**< @brief Size of the memory block. */
} h;
@@ -66,26 +82,36 @@ struct memory_heap { this heap. */
union heap_header h_free; /**< @brief Free blocks list header. */
#if CH_USE_MUTEXES
- Mutex h_mtx; /**< @brief Heap access mutex. */
+ mutex_t h_mtx; /**< @brief Heap access mutex. */
#else
- Semaphore h_sem; /**< @brief Heap access semaphore. */
+ semaphore_t h_sem; /**< @brief Heap access semaphore. */
#endif
};
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
void _heap_init(void);
-#if !CH_USE_MALLOC_HEAP
- void chHeapInit(MemoryHeap *heapp, void *buf, size_t size);
-#endif
- void *chHeapAlloc(MemoryHeap *heapp, size_t size);
+ void chHeapInit(memory_heap_t *heapp, void *buf, size_t size);
+ void *chHeapAlloc(memory_heap_t *heapp, size_t size);
void chHeapFree(void *p);
- size_t chHeapStatus(MemoryHeap *heapp, size_t *sizep);
+ size_t chHeapStatus(memory_heap_t *heapp, size_t *sizep);
#ifdef __cplusplus
}
#endif
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
#endif /* CH_USE_HEAP */
#endif /* _CHHEAP_H_ */
diff --git a/os/kernel/include/chmboxes.h b/os/kernel/include/chmboxes.h index 388ef07a6..6cb903e82 100644 --- a/os/kernel/include/chmboxes.h +++ b/os/kernel/include/chmboxes.h @@ -31,13 +31,26 @@ #if CH_USE_MAILBOXES || defined(__DOXYGEN__)
-/*
- * Module dependencies check.
- */
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
#if !CH_USE_SEMAPHORES
#error "CH_USE_MAILBOXES requires CH_USE_SEMAPHORES"
#endif
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Structure representing a mailbox object.
*/
@@ -52,39 +65,79 @@ typedef struct { @p semaphore_t. */
semaphore_t mb_emptysem; /**< @brief Empty counter
@p semaphore_t. */
-} Mailbox;
+} mailbox_t;
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/**
+ * @brief Data part of a static mailbox initializer.
+ * @details This macro should be used when statically initializing a
+ * mailbox that is part of a bigger structure.
+ *
+ * @param[in] name the name of the mailbox variable
+ * @param[in] buffer pointer to the mailbox buffer area
+ * @param[in] size size of the mailbox buffer area
+ */
+#define _MAILBOX_DATA(name, buffer, size) { \
+ (msg_t *)(buffer), \
+ (msg_t *)(buffer) + size, \
+ (msg_t *)(buffer), \
+ (msg_t *)(buffer), \
+ _SEMAPHORE_DATA(name.mb_fullsem, 0), \
+ _SEMAPHORE_DATA(name.mb_emptysem, size), \
+}
+
+/**
+ * @brief Static mailbox initializer.
+ * @details Statically initialized mailboxes require no explicit
+ * initialization using @p chMBInit().
+ *
+ * @param[in] name the name of the mailbox variable
+ * @param[in] buffer pointer to the mailbox buffer area
+ * @param[in] size size of the mailbox buffer area
+ */
+#define MAILBOX_DECL(name, buffer, size) \
+ mailbox_t name = _MAILBOX_DATA(name, buffer, size)
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
- void chMBInit(Mailbox *mbp, msg_t *buf, cnt_t n);
- void chMBReset(Mailbox *mbp);
- msg_t chMBPost(Mailbox *mbp, msg_t msg, systime_t timeout);
- msg_t chMBPostS(Mailbox *mbp, msg_t msg, systime_t timeout);
- msg_t chMBPostI(Mailbox *mbp, msg_t msg);
- msg_t chMBPostAhead(Mailbox *mbp, msg_t msg, systime_t timeout);
- msg_t chMBPostAheadS(Mailbox *mbp, msg_t msg, systime_t timeout);
- msg_t chMBPostAheadI(Mailbox *mbp, msg_t msg);
- msg_t chMBFetch(Mailbox *mbp, msg_t *msgp, systime_t timeout);
- msg_t chMBFetchS(Mailbox *mbp, msg_t *msgp, systime_t timeout);
- msg_t chMBFetchI(Mailbox *mbp, msg_t *msgp);
+ void chMBInit(mailbox_t *mbp, msg_t *buf, cnt_t n);
+ void chMBReset(mailbox_t *mbp);
+ msg_t chMBPost(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostI(mailbox_t *mbp, msg_t msg);
+ msg_t chMBPostAhead(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t timeout);
+ msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg);
+ msg_t chMBFetch(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
+ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t timeout);
+ msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp);
#ifdef __cplusplus
}
#endif
-/**
- * @name Macro Functions
- * @{
- */
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
/**
* @brief Returns the mailbox buffer size.
*
- * @param[in] mbp the pointer to an initialized Mailbox object
+ * @param[in] mbp the pointer to an initialized mailbox_t object
*
* @iclass
*/
-#define chMBSizeI(mbp) \
- ((mbp)->mb_top - (mbp)->mb_buffer)
+static inline size_t chMBSizeI(mailbox_t *mbp) {
+
+ return (size_t)(mbp->mb_top - mbp->mb_buffer);
+}
/**
* @brief Returns the number of free message slots into a mailbox.
@@ -93,12 +146,17 @@ extern "C" { * @note The returned value can be less than zero when there are waiting
* threads on the internal semaphore.
*
- * @param[in] mbp the pointer to an initialized Mailbox object
+ * @param[in] mbp the pointer to an initialized mailbox_t object
* @return The number of empty message slots.
*
* @iclass
*/
-#define chMBGetFreeCountI(mbp) chSemGetCounterI(&(mbp)->mb_emptysem)
+static inline cnt_t chMBGetFreeCountI(mailbox_t *mbp) {
+
+ chDbgCheckClassI();
+
+ return chSemGetCounterI(&mbp->mb_emptysem);
+}
/**
* @brief Returns the number of used message slots into a mailbox.
@@ -107,12 +165,17 @@ extern "C" { * @note The returned value can be less than zero when there are waiting
* threads on the internal semaphore.
*
- * @param[in] mbp the pointer to an initialized Mailbox object
+ * @param[in] mbp the pointer to an initialized mailbox_t object
* @return The number of queued messages.
*
* @iclass
*/
-#define chMBGetUsedCountI(mbp) chSemGetCounterI(&(mbp)->mb_fullsem)
+static inline cnt_t chMBGetUsedCountI(mailbox_t *mbp) {
+
+ chDbgCheckClassI();
+
+ return chSemGetCounterI(&mbp->mb_fullsem);
+}
/**
* @brief Returns the next message in the queue without removing it.
@@ -123,38 +186,12 @@ extern "C" { *
* @iclass
*/
-#define chMBPeekI(mbp) (*(mbp)->mb_rdptr)
-/** @} */
+static inline cnt_t chMBPeekI(mailbox_t *mbp) {
-/**
- * @brief Data part of a static mailbox initializer.
- * @details This macro should be used when statically initializing a
- * mailbox that is part of a bigger structure.
- *
- * @param[in] name the name of the mailbox variable
- * @param[in] buffer pointer to the mailbox buffer area
- * @param[in] size size of the mailbox buffer area
- */
-#define _MAILBOX_DATA(name, buffer, size) { \
- (msg_t *)(buffer), \
- (msg_t *)(buffer) + size, \
- (msg_t *)(buffer), \
- (msg_t *)(buffer), \
- _SEMAPHORE_DATA(name.mb_fullsem, 0), \
- _SEMAPHORE_DATA(name.mb_emptysem, size), \
-}
+ chDbgCheckClassI();
-/**
- * @brief Static mailbox initializer.
- * @details Statically initialized mailboxes require no explicit
- * initialization using @p chMBInit().
- *
- * @param[in] name the name of the mailbox variable
- * @param[in] buffer pointer to the mailbox buffer area
- * @param[in] size size of the mailbox buffer area
- */
-#define MAILBOX_DECL(name, buffer, size) \
- Mailbox name = _MAILBOX_DATA(name, buffer, size)
+ return *mbp->mb_rdptr;
+}
#endif /* CH_USE_MAILBOXES */
diff --git a/os/kernel/include/chmemcore.h b/os/kernel/include/chmemcore.h index 4f75bd043..dbc5d5d60 100644 --- a/os/kernel/include/chmemcore.h +++ b/os/kernel/include/chmemcore.h @@ -29,6 +29,24 @@ #ifndef _CHMEMCORE_H_
#define _CHMEMCORE_H_
+#if CH_USE_MEMCORE || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Memory get function.
* @note This type must be assignment compatible with the @p chMemAlloc()
@@ -36,6 +54,10 @@ */
typedef void *(*memgetfunc_t)(size_t size);
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
/**
* @name Alignment support macros
*/
@@ -66,7 +88,9 @@ typedef void *(*memgetfunc_t)(size_t size); #define MEM_IS_ALIGNED(p) (((size_t)(p) & MEM_ALIGN_MASK) == 0)
/** @} */
-#if CH_USE_MEMCORE || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
@@ -79,6 +103,10 @@ extern "C" { }
#endif
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
#endif /* CH_USE_MEMCORE */
#endif /* _CHMEMCORE_H_ */
diff --git a/os/kernel/include/chmempools.h b/os/kernel/include/chmempools.h index 80d6eeaf2..f211ec1d1 100644 --- a/os/kernel/include/chmempools.h +++ b/os/kernel/include/chmempools.h @@ -31,6 +31,26 @@ #if CH_USE_MEMPOOLS || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+#if !CH_USE_MEMCORE
+#error "CH_USE_MEMPOOLS requires CH_USE_MEMCORE"
+#endif
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Memory pool free object header.
*/
@@ -46,9 +66,13 @@ typedef struct { struct pool_header *mp_next; /**< @brief Pointer to the header. */
size_t mp_object_size; /**< @brief Memory pool objects
size. */
- memgetfunc_t mp_provider; /**< @brief Memory blocks provider for
- this pool. */
-} MemoryPool;
+ memgetfunc_t mp_provider; /**< @brief Memory blocks provider
+ for this pool. */
+} memory_pool_t;
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
/**
* @brief Data part of a static memory pool initializer.
@@ -73,12 +97,29 @@ typedef struct { * if the pool is not allowed to grow automatically
*/
#define MEMORYPOOL_DECL(name, size, provider) \
- MemoryPool name = _MEMORYPOOL_DATA(name, size, provider)
+ memory_pool_t name = _MEMORYPOOL_DATA(name, size, provider)
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chPoolInit(memory_pool_t *mp, size_t size, memgetfunc_t provider);
+ void chPoolLoadArray(memory_pool_t *mp, void *p, size_t n);
+ void *chPoolAllocI(memory_pool_t *mp);
+ void *chPoolAlloc(memory_pool_t *mp);
+ void chPoolFreeI(memory_pool_t *mp, void *objp);
+ void chPoolFree(memory_pool_t *mp, void *objp);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
-/**
- * @name Macro Functions
- * @{
- */
/**
* @brief Adds an object to a memory pool.
* @pre The memory pool must be already been initialized.
@@ -89,12 +130,15 @@ typedef struct { * @note This function is just an alias for @p chPoolFree() and has been
* added for clarity.
*
- * @param[in] mp pointer to a @p MemoryPool structure
+ * @param[in] mp pointer to a @p memory_pool_t structure
* @param[in] objp the pointer to the object to be added
*
* @api
*/
-#define chPoolAdd(mp, objp) chPoolFree(mp, objp)
+static inline void chPoolAdd(memory_pool_t *mp, void *objp) {
+
+ chPoolFree(mp, objp);
+}
/**
* @brief Adds an object to a memory pool.
@@ -106,26 +150,17 @@ typedef struct { * @note This function is just an alias for @p chPoolFree() and has been
* added for clarity.
*
- * @param[in] mp pointer to a @p MemoryPool structure
+ * @param[in] mp pointer to a @p memory_pool_t structure
* @param[in] objp the pointer to the object to be added
*
* @iclass
*/
-#define chPoolAddI(mp, objp) chPoolFreeI(mp, objp)
-/** @} */
+static inline void chPoolAddI(memory_pool_t *mp, void *objp) {
-#ifdef __cplusplus
-extern "C" {
-#endif
- void chPoolInit(MemoryPool *mp, size_t size, memgetfunc_t provider);
- void chPoolLoadArray(MemoryPool *mp, void *p, size_t n);
- void *chPoolAllocI(MemoryPool *mp);
- void *chPoolAlloc(MemoryPool *mp);
- void chPoolFreeI(MemoryPool *mp, void *objp);
- void chPoolFree(MemoryPool *mp, void *objp);
-#ifdef __cplusplus
+ chDbgCheckClassI();
+
+ chPoolFreeI(mp, objp);
}
-#endif
#endif /* CH_USE_MEMPOOLS */
diff --git a/os/kernel/include/chmsg.h b/os/kernel/include/chmsg.h index be3103db9..1e9099c73 100644 --- a/os/kernel/include/chmsg.h +++ b/os/kernel/include/chmsg.h @@ -31,17 +31,55 @@ #if CH_USE_MESSAGES || defined(__DOXYGEN__)
-/**
- * @name Macro Functions
- * @{
- */
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ msg_t chMsgSend(thread_t *tp, msg_t msg);
+ thread_t * chMsgWait(void);
+ void chMsgRelease(thread_t *tp, msg_t msg);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
/**
* @brief Evaluates to TRUE if the thread has pending messages.
*
* @iclass
*/
-#define chMsgIsPendingI(tp) \
- ((tp)->p_msgqueue.p_next != (thread_t *)&(tp)->p_msgqueue)
+static inline bool chMsgIsPendingI(thread_t *tp) {
+
+ chDbgCheckClassI();
+
+ return (bool)(tp->p_msgqueue.p_next != (thread_t *)&tp->p_msgqueue);
+}
/**
* @brief Returns the message carried by the specified thread.
@@ -53,7 +91,10 @@ *
* @api
*/
-#define chMsgGet(tp) ((tp)->p_msg)
+static inline msg_t chMsgGet(thread_t *tp) {
+
+ return tp->p_msg;
+}
/**
* @brief Releases the thread waiting on top of the messages queue.
@@ -65,18 +106,12 @@ *
* @sclass
*/
-#define chMsgReleaseS(tp, msg) chSchWakeupS(tp, msg)
-/** @} */
+static inline void chMsgReleaseS(thread_t *tp, msg_t msg) {
-#ifdef __cplusplus
-extern "C" {
-#endif
- msg_t chMsgSend(thread_t *tp, msg_t msg);
- thread_t * chMsgWait(void);
- void chMsgRelease(thread_t *tp, msg_t msg);
-#ifdef __cplusplus
+ chDbgCheckClassS();
+
+ chSchWakeupS(tp, msg);
}
-#endif
#endif /* CH_USE_MESSAGES */
diff --git a/os/kernel/include/chmtx.h b/os/kernel/include/chmtx.h index bc0057e80..589caccba 100644 --- a/os/kernel/include/chmtx.h +++ b/os/kernel/include/chmtx.h @@ -31,32 +31,37 @@ #if CH_USE_MUTEXES || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Mutex structure.
*/
-typedef struct Mutex {
+typedef struct mutex {
threads_queue_t m_queue; /**< @brief Queue of the threads sleeping
- on this Mutex. */
+ on this mutex. */
thread_t *m_owner; /**< @brief Owner @p thread_t pointer or
@p NULL. */
- struct Mutex *m_next; /**< @brief Next @p Mutex into an
+ mutex_t *m_next; /**< @brief Next @p mutex_t into an
owner-list or @p NULL. */
-} Mutex;
+} mutex_t;
-#ifdef __cplusplus
-extern "C" {
-#endif
- void chMtxInit(Mutex *mp);
- void chMtxLock(Mutex *mp);
- void chMtxLockS(Mutex *mp);
- bool_t chMtxTryLock(Mutex *mp);
- bool_t chMtxTryLockS(Mutex *mp);
- Mutex *chMtxUnlock(void);
- Mutex *chMtxUnlockS(void);
- void chMtxUnlockAll(void);
-#ifdef __cplusplus
-}
-#endif
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
/**
* @brief Data part of a static mutex initializer.
@@ -74,20 +79,45 @@ extern "C" { *
* @param[in] name the name of the mutex variable
*/
-#define MUTEX_DECL(name) Mutex name = _MUTEX_DATA(name)
+#define MUTEX_DECL(name) mutex_t name = _MUTEX_DATA(name)
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chMtxInit(mutex_t *mp);
+ void chMtxLock(mutex_t *mp);
+ void chMtxLockS(mutex_t *mp);
+ bool_t chMtxTryLock(mutex_t *mp);
+ bool_t chMtxTryLockS(mutex_t *mp);
+ mutex_t *chMtxUnlock(void);
+ mutex_t *chMtxUnlockS(void);
+ void chMtxUnlockAll(void);
+#ifdef __cplusplus
+}
+#endif
+
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
/**
- * @name Macro Functions
- * @{
- */
-/**
- * @brief Returns @p TRUE if the mutex queue contains at least a waiting
+ * @brief Returns @p true if the mutex queue contains at least a waiting
* thread.
*
+ * @deprecated
* @sclass
*/
-#define chMtxQueueNotEmptyS(mp) queue_notempty(&(mp)->m_queue)
-/** @} */
+static inline bool chMtxQueueNotEmptyS(mutex_t *mp) {
+
+ chDbgCheckClassS();
+
+ return queue_notempty(&mp->m_queue);
+}
#endif /* CH_USE_MUTEXES */
diff --git a/os/kernel/include/chregistry.h b/os/kernel/include/chregistry.h index 552e9d598..b176058ce 100644 --- a/os/kernel/include/chregistry.h +++ b/os/kernel/include/chregistry.h @@ -31,6 +31,22 @@ #if CH_USE_REGISTRY || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
/**
* @brief ChibiOS/RT memory signature record.
*/
@@ -57,39 +73,10 @@ typedef struct { uint8_t cf_off_time; /**< @brief Offset of @p p_time field. */
} chdebug_t;
-/**
- * @name Macro Functions
- * @{
- */
-/**
- * @brief Sets the current thread name.
- * @pre This function only stores the pointer to the name if the option
- * @p CH_USE_REGISTRY is enabled else no action is performed.
- *
- * @param[in] p thread name as a zero terminated string
- *
- * @api
- */
-#define chRegSetThreadName(p) (currp->p_name = (p))
-
-/**
- * @brief Returns the name of the specified thread.
- * @pre This function only returns the pointer to the name if the option
- * @p CH_USE_REGISTRY is enabled else @p NULL is returned.
- *
- * @param[in] tp pointer to the thread
- *
- * @return Thread name as a zero terminated string.
- * @retval NULL if the thread name has not been set.
- */
-#define chRegGetThreadName(tp) ((tp)->p_name)
-/** @} */
-#else /* !CH_USE_REGISTRY */
-#define chRegSetThreadName(p)
-#define chRegGetThreadName(tp) NULL
-#endif /* !CH_USE_REGISTRY */
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
-#if CH_USE_REGISTRY || defined(__DOXYGEN__)
/**
* @brief Removes a thread from the registry list.
* @note This macro is not meant for use in application code.
@@ -113,6 +100,10 @@ typedef struct { (tp)->p_older->p_newer = rlist.r_older = (tp); \
}
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -123,6 +114,52 @@ extern "C" { }
#endif
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Sets the current thread name.
+ * @pre This function only stores the pointer to the name if the option
+ * @p CH_USE_REGISTRY is enabled else no action is performed.
+ *
+ * @param[in] p thread name as a zero terminated string
+ *
+ * @api
+ */
+static inline void chRegSetThreadName(const char *name) {
+
+#if CH_USE_REGISTRY
+ currp->p_name = name;
+#else
+ (void)name;
+#endif
+}
+
+/**
+ * @brief Returns the name of the specified thread.
+ * @pre This function only returns the pointer to the name if the option
+ * @p CH_USE_REGISTRY is enabled else @p NULL is returned.
+ *
+ * @param[in] tp pointer to the thread
+ *
+ * @return Thread name as a zero terminated string.
+ * @retval NULL if the thread name has not been set.
+ *
+ * @iclass
+ */
+static inline const char *chRegGetThreadNameI(thread_t *tp) {
+
+ chDbgCheckClassI();
+
+#if CH_USE_REGISTRY
+ return tp->p_name;
+#else
+ (void)tp;
+ return NULL;
+#endif
+}
+
#endif /* CH_USE_REGISTRY */
#endif /* _CHREGISTRY_H_ */
diff --git a/os/kernel/include/chsys.h b/os/kernel/include/chsys.h index a1f59f38e..5585117b6 100644 --- a/os/kernel/include/chsys.h +++ b/os/kernel/include/chsys.h @@ -29,45 +29,94 @@ #ifndef _CHSYS_H_
#define _CHSYS_H_
+/*===========================================================================*/
+/* Module constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Module macros. */
+/*===========================================================================*/
+
/**
- * @name Macro Functions
- * @{
+ * @name ISRs abstraction macros
*/
-#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
/**
- * @brief Returns a pointer to the idle thread.
- * @pre In order to use this function the option @p CH_NO_IDLE_THREAD
- * must be disabled.
- * @note The reference counter of the idle thread is not incremented but
- * it is not strictly required being the idle thread a static
- * object.
+ * @brief IRQ handler enter code.
+ * @note Usually IRQ handlers functions are also declared naked.
+ * @note On some architectures this macro can be empty.
*
- * @return Pointer to the idle thread.
+ * @special
+ */
+#define CH_IRQ_PROLOGUE() \
+ PORT_IRQ_PROLOGUE(); \
+ dbg_check_enter_isr();
+
+/**
+ * @brief IRQ handler exit code.
+ * @note Usually IRQ handlers function are also declared naked.
+ * @note This macro usually performs the final reschedule by using
+ * @p chSchIsPreemptionRequired() and @p chSchDoReschedule().
*
- * @api
+ * @special
*/
-#define chSysGetIdleThread() (rlist.r_queue.p_prev)
-#endif
+#define CH_IRQ_EPILOGUE() \
+ dbg_check_leave_isr(); \
+ PORT_IRQ_EPILOGUE();
+
+/**
+ * @brief Standard normal IRQ handler declaration.
+ * @note @p id can be a function name or a vector number depending on the
+ * port implementation.
+ *
+ * @special
+ */
+#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
+/** @} */
/**
- * @brief Halts the system.
- * @details This function is invoked by the operating system when an
- * unrecoverable error is detected, for example because a programming
- * error in the application code that triggers an assertion while
- * in debug mode.
- * @note Can be invoked from any system state.
+ * @name Fast ISRs abstraction macros
+ */
+/**
+ * @brief Standard fast IRQ handler declaration.
+ * @note @p id can be a function name or a vector number depending on the
+ * port implementation.
+ * @note Not all architectures support fast interrupts.
*
* @special
*/
-#if !defined(SYSTEM_HALT_HOOK) || defined(__DOXYGEN__)
-#define chSysHalt() port_halt()
-#else
-#define chSysHalt() { \
- SYSTEM_HALT_HOOK(); \
- port_halt(); \
+#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
+/** @} */
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void chSysInit(void);
+ void chSysHalt(void);
+ void chSysTimerHandlerI(void);
+#ifdef __cplusplus
}
#endif
+/*===========================================================================*/
+/* Module inline functions. */
+/*===========================================================================*/
+
/**
* @brief Performs a context switch.
* @note Not a user function, it is meant to be invoked by the scheduler
@@ -78,10 +127,11 @@ *
* @special
*/
-#define chSysSwitch(ntp, otp) { \
- dbg_trace(otp); \
- THREAD_CONTEXT_SWITCH_HOOK(ntp, otp); \
- port_switch(ntp, otp); \
+static inline void chSysSwitch(thread_t *ntp, thread_t *otp) {
+
+ dbg_trace(otp);
+ THREAD_CONTEXT_SWITCH_HOOK(ntp, otp);
+ port_switch(ntp, otp);
}
/**
@@ -92,9 +142,10 @@ *
* @special
*/
-#define chSysDisable() { \
- port_disable(); \
- dbg_check_disable(); \
+static inline void chSysDisable(void) {
+
+ port_disable();
+ dbg_check_disable();
}
/**
@@ -108,9 +159,10 @@ *
* @special
*/
-#define chSysSuspend() { \
- port_suspend(); \
- dbg_check_suspend(); \
+static inline void chSysSuspend(void) {
+
+ port_suspend();
+ dbg_check_suspend();
}
/**
@@ -122,9 +174,10 @@ *
* @special
*/
-#define chSysEnable() { \
- dbg_check_enable(); \
- port_enable(); \
+static inline void chSysEnable(void) {
+
+ dbg_check_enable();
+ port_enable();
}
/**
@@ -132,9 +185,10 @@ *
* @special
*/
-#define chSysLock() { \
- port_lock(); \
- dbg_check_lock(); \
+static inline void chSysLock(void) {
+
+ port_lock();
+ dbg_check_lock();
}
/**
@@ -142,9 +196,10 @@ *
* @special
*/
-#define chSysUnlock() { \
- dbg_check_unlock(); \
- port_unlock(); \
+static inline void chSysUnlock(void) {
+
+ dbg_check_unlock();
+ port_unlock();
}
/**
@@ -159,9 +214,10 @@ *
* @special
*/
-#define chSysLockFromIsr() { \
- port_lock_from_isr(); \
- dbg_check_lock_from_isr(); \
+static inline void chSysLockFromIsr(void) {
+
+ port_lock_from_isr();
+ dbg_check_lock_from_isr();
}
/**
@@ -177,70 +233,11 @@ *
* @special
*/
-#define chSysUnlockFromIsr() { \
- dbg_check_unlock_from_isr(); \
- port_unlock_from_isr(); \
-}
-/** @} */
-
-/**
- * @name ISRs abstraction macros
- */
-/**
- * @brief IRQ handler enter code.
- * @note Usually IRQ handlers functions are also declared naked.
- * @note On some architectures this macro can be empty.
- *
- * @special
- */
-#define CH_IRQ_PROLOGUE() \
- PORT_IRQ_PROLOGUE(); \
- dbg_check_enter_isr();
-
-/**
- * @brief IRQ handler exit code.
- * @note Usually IRQ handlers function are also declared naked.
- * @note This macro usually performs the final reschedule by using
- * @p chSchIsPreemptionRequired() and @p chSchDoReschedule().
- *
- * @special
- */
-#define CH_IRQ_EPILOGUE() \
- dbg_check_leave_isr(); \
- PORT_IRQ_EPILOGUE();
-
-/**
- * @brief Standard normal IRQ handler declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- *
- * @special
- */
-#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
-/** @} */
-
-/**
- * @name Fast ISRs abstraction macros
- */
-/**
- * @brief Standard fast IRQ handler declaration.
- * @note @p id can be a function name or a vector number depending on the
- * port implementation.
- * @note Not all architectures support fast interrupts.
- *
- * @special
- */
-#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
-/** @} */
+static inline void chSysUnlockFromIsr(void) {
-#ifdef __cplusplus
-extern "C" {
-#endif
- void chSysInit(void);
- void chSysTimerHandlerI(void);
-#ifdef __cplusplus
+ dbg_check_unlock_from_isr();
+ port_unlock_from_isr();
}
-#endif
#endif /* _CHSYS_H_ */
diff --git a/os/kernel/include/chthreads.h b/os/kernel/include/chthreads.h index 452ffd37d..c46103faf 100644 --- a/os/kernel/include/chthreads.h +++ b/os/kernel/include/chthreads.h @@ -95,7 +95,7 @@ /* Forward declaration required by the mutexes stack structure present
in every thread.*/
#if CH_USE_MUTEXES
-typedef struct Mutex Mutex;
+typedef struct mutex mutex_t;
#endif
/**
@@ -238,7 +238,7 @@ typedef struct thread { * @brief List of the mutexes owned by this thread.
* @note The list is terminated by a @p NULL in this field.
*/
- Mutex *p_mtxlist;
+ mutex_t *p_mtxlist;
/**
* @brief Thread's own, non-inherited, priority.
*/
|