Kernel documentation fixes and improvements.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3251 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
2d55ac3059
commit
c9be79def6
|
@ -84,6 +84,10 @@ typedef struct {
|
||||||
#define BSEMAPHORE_DECL(name, taken) \
|
#define BSEMAPHORE_DECL(name, taken) \
|
||||||
BinarySemaphore name = _BSEMAPHORE_DATA(name, taken)
|
BinarySemaphore name = _BSEMAPHORE_DATA(name, taken)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Initializes a binary semaphore.
|
* @brief Initializes a binary semaphore.
|
||||||
*
|
*
|
||||||
|
@ -238,6 +242,7 @@ typedef struct {
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
#define chBSemGetStateI(bsp) ((bsp)->bs_sem.s_cnt > 0 ? FALSE : TRUE)
|
#define chBSemGetStateI(bsp) ((bsp)->bs_sem.s_cnt > 0 ? FALSE : TRUE)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* CH_USE_SEMAPHORES */
|
#endif /* CH_USE_SEMAPHORES */
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,10 @@ extern ch_trace_buffer_t dbg_trace_buffer;
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if CH_DBG_ENABLE_CHECKS || defined(__DOXYGEN__)
|
#if CH_DBG_ENABLE_CHECKS || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Function parameter check.
|
* @brief Function parameter check.
|
||||||
* @details If the condition check fails then the kernel panics and halts.
|
* @details If the condition check fails then the kernel panics and halts.
|
||||||
|
@ -150,6 +153,7 @@ extern ch_trace_buffer_t dbg_trace_buffer;
|
||||||
chDbgPanic(__QUOTE_THIS(func)"()"); \
|
chDbgPanic(__QUOTE_THIS(func)"()"); \
|
||||||
}
|
}
|
||||||
#endif /* !defined(chDbgCheck) */
|
#endif /* !defined(chDbgCheck) */
|
||||||
|
/** @} */
|
||||||
#else /* !CH_DBG_ENABLE_CHECKS */
|
#else /* !CH_DBG_ENABLE_CHECKS */
|
||||||
#define chDbgCheck(c, func) { \
|
#define chDbgCheck(c, func) { \
|
||||||
(void)(c), (void)__QUOTE_THIS(func)"()"; \
|
(void)(c), (void)__QUOTE_THIS(func)"()"; \
|
||||||
|
@ -161,6 +165,10 @@ extern ch_trace_buffer_t dbg_trace_buffer;
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
#if CH_DBG_ENABLE_ASSERTS || defined(__DOXYGEN__)
|
#if CH_DBG_ENABLE_ASSERTS || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Condition assertion.
|
* @brief Condition assertion.
|
||||||
* @details If the condition check fails then the kernel panics with the
|
* @details If the condition check fails then the kernel panics with the
|
||||||
|
@ -184,6 +192,7 @@ extern ch_trace_buffer_t dbg_trace_buffer;
|
||||||
chDbgPanic(m); \
|
chDbgPanic(m); \
|
||||||
}
|
}
|
||||||
#endif /* !defined(chDbgAssert) */
|
#endif /* !defined(chDbgAssert) */
|
||||||
|
/** @} */
|
||||||
#else /* !CH_DBG_ENABLE_ASSERTS */
|
#else /* !CH_DBG_ENABLE_ASSERTS */
|
||||||
#define chDbgAssert(c, m, r) {(void)(c);}
|
#define chDbgAssert(c, m, r) {(void)(c);}
|
||||||
#endif /* !CH_DBG_ENABLE_ASSERTS */
|
#endif /* !CH_DBG_ENABLE_ASSERTS */
|
||||||
|
|
|
@ -88,6 +88,10 @@ typedef void (*evhandler_t)(eventid_t);
|
||||||
*/
|
*/
|
||||||
#define EVENT_MASK(eid) ((eventmask_t)(1 << (eid)))
|
#define EVENT_MASK(eid) ((eventmask_t)(1 << (eid)))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Registers an Event Listener on an Event Source.
|
* @brief Registers an Event Listener on an Event Source.
|
||||||
* @note Multiple Event Listeners can use the same event identifier, the
|
* @note Multiple Event Listeners can use the same event identifier, the
|
||||||
|
@ -151,6 +155,7 @@ typedef void (*evhandler_t)(eventid_t);
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
#define chEvtBroadcastI(esp) chEvtBroadcastFlagsI(esp, 0)
|
#define chEvtBroadcastI(esp) chEvtBroadcastFlagsI(esp, 0)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -74,6 +74,8 @@ typedef uint32_t fileoffset_t;
|
||||||
_base_sequential_stream_data
|
_base_sequential_stream_data
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @extends BaseSequentialStreamVMT
|
||||||
|
*
|
||||||
* @brief @p BaseFileStream virtual methods table.
|
* @brief @p BaseFileStream virtual methods table.
|
||||||
*/
|
*/
|
||||||
struct BaseFilelStreamVMT {
|
struct BaseFilelStreamVMT {
|
||||||
|
@ -92,6 +94,10 @@ typedef struct {
|
||||||
_base_file_stream_data
|
_base_file_stream_data
|
||||||
} BaseFileStream;
|
} BaseFileStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions (BaseFileStream)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Base file Stream close.
|
* @brief Base file Stream close.
|
||||||
* @details The function closes a file stream.
|
* @details The function closes a file stream.
|
||||||
|
@ -138,6 +144,7 @@ typedef struct {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chFileStreamSeek ((ip)->vmt->lseek(ip, offset))
|
#define chFileStreamSeek ((ip)->vmt->lseek(ip, offset))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* _CHFILES_H_ */
|
#endif /* _CHFILES_H_ */
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,8 @@
|
||||||
_base_sequential_stream_data
|
_base_sequential_stream_data
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @extends BaseSequentialStreamVMT
|
||||||
|
*
|
||||||
* @brief @p BaseChannel virtual methods table.
|
* @brief @p BaseChannel virtual methods table.
|
||||||
*/
|
*/
|
||||||
struct BaseChannelVMT { \
|
struct BaseChannelVMT { \
|
||||||
|
@ -86,6 +88,10 @@ typedef struct {
|
||||||
_base_channel_data
|
_base_channel_data
|
||||||
} BaseChannel;
|
} BaseChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions (BaseChannel)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Channel output check.
|
* @brief Channel output check.
|
||||||
* @details This function verifies if a subsequent put/write operation would
|
* @details This function verifies if a subsequent put/write operation would
|
||||||
|
@ -227,9 +233,13 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
#define chIOReadTimeout(ip, bp, n, time) \
|
#define chIOReadTimeout(ip, bp, n, time) \
|
||||||
((ip)->vmt->readt(ip, bp, n, time))
|
((ip)->vmt->readt(ip, bp, n, time))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#if CH_USE_EVENTS
|
#if CH_USE_EVENTS || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @name I/O status flags
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/** @brief No pending conditions.*/
|
/** @brief No pending conditions.*/
|
||||||
#define IO_NO_ERROR 0
|
#define IO_NO_ERROR 0
|
||||||
/** @brief Connection happened.*/
|
/** @brief Connection happened.*/
|
||||||
|
@ -242,6 +252,7 @@ typedef struct {
|
||||||
#define IO_OUTPUT_EMPTY 8
|
#define IO_OUTPUT_EMPTY 8
|
||||||
/** @brief Transmission end.*/
|
/** @brief Transmission end.*/
|
||||||
#define IO_TRANSMISSION_END 16
|
#define IO_TRANSMISSION_END 16
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Type of an I/O condition flags mask.
|
* @brief Type of an I/O condition flags mask.
|
||||||
|
@ -267,6 +278,8 @@ typedef uint_fast16_t ioflags_t;
|
||||||
ioflags_t flags;
|
ioflags_t flags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @extends BaseChannelVMT
|
||||||
|
*
|
||||||
* @brief @p BaseAsynchronousChannel virtual methods table.
|
* @brief @p BaseAsynchronousChannel virtual methods table.
|
||||||
*/
|
*/
|
||||||
struct BaseAsynchronousChannelVMT {
|
struct BaseAsynchronousChannelVMT {
|
||||||
|
@ -286,6 +299,10 @@ typedef struct {
|
||||||
_base_asynchronous_channel_data
|
_base_asynchronous_channel_data
|
||||||
} BaseAsynchronousChannel;
|
} BaseAsynchronousChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions (BaseAsynchronousChannel)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Returns the I/O condition event source.
|
* @brief Returns the I/O condition event source.
|
||||||
* @details The event source is broadcasted when an I/O condition happens.
|
* @details The event source is broadcasted when an I/O condition happens.
|
||||||
|
@ -299,7 +316,7 @@ typedef struct {
|
||||||
#define chIOGetEventSource(ip) (&((ip)->event))
|
#define chIOGetEventSource(ip) (&((ip)->event))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds condition flags to the channel's mask.
|
* @brief Adds status flags to the channel's mask.
|
||||||
* @details This function is usually called from the I/O ISTs in order to
|
* @details This function is usually called from the I/O ISTs in order to
|
||||||
* notify I/O conditions such as data events, errors, signal
|
* notify I/O conditions such as data events, errors, signal
|
||||||
* changes etc.
|
* changes etc.
|
||||||
|
@ -316,7 +333,7 @@ typedef struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns and clears the errors mask associated to the channel.
|
* @brief Returns and clears the status flags associated to the channel.
|
||||||
*
|
*
|
||||||
* @param[in] ip pointer to a @p BaseAsynchronousChannel or derived
|
* @param[in] ip pointer to a @p BaseAsynchronousChannel or derived
|
||||||
* class
|
* class
|
||||||
|
@ -326,6 +343,7 @@ typedef struct {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chIOGetAndClearFlags(ip) ((ip)->vmt->getflags(ip))
|
#define chIOGetAndClearFlags(ip) ((ip)->vmt->getflags(ip))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default implementation of the @p getflags virtual method.
|
* @brief Default implementation of the @p getflags virtual method.
|
||||||
|
|
|
@ -72,6 +72,10 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Returns the mailbox buffer size.
|
* @brief Returns the mailbox buffer size.
|
||||||
*
|
*
|
||||||
|
@ -120,6 +124,7 @@ extern "C" {
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
#define chMBPeekI(mbp) (*(mbp)->mb_rdptr)
|
#define chMBPeekI(mbp) (*(mbp)->mb_rdptr)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Data part of a static mailbox initializer.
|
* @brief Data part of a static mailbox initializer.
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
|
|
||||||
#if CH_USE_MESSAGES || defined(__DOXYGEN__)
|
#if CH_USE_MESSAGES || defined(__DOXYGEN__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Evaluates to TRUE if the thread has pending messages.
|
* @brief Evaluates to TRUE if the thread has pending messages.
|
||||||
*
|
*
|
||||||
|
@ -74,6 +78,7 @@
|
||||||
* @sclass
|
* @sclass
|
||||||
*/
|
*/
|
||||||
#define chMsgReleaseS(tp, msg) chSchWakeupS(tp, msg)
|
#define chMsgReleaseS(tp, msg) chSchWakeupS(tp, msg)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -76,6 +76,10 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define MUTEX_DECL(name) Mutex name = _MUTEX_DATA(name)
|
#define MUTEX_DECL(name) Mutex name = _MUTEX_DATA(name)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @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.
|
* thread.
|
||||||
|
@ -83,6 +87,7 @@ extern "C" {
|
||||||
* @sclass
|
* @sclass
|
||||||
*/
|
*/
|
||||||
#define chMtxQueueNotEmptyS(mp) notempty(&(mp)->m_queue)
|
#define chMtxQueueNotEmptyS(mp) notempty(&(mp)->m_queue)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* CH_USE_MUTEXES */
|
#endif /* CH_USE_MUTEXES */
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,10 @@ struct GenericQueue {
|
||||||
qnotify_t q_notify; /**< @brief Data notification callback. */
|
qnotify_t q_notify; /**< @brief Data notification callback. */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Returns the queue's buffer size.
|
* @brief Returns the queue's buffer size.
|
||||||
*
|
*
|
||||||
|
@ -90,7 +94,8 @@ struct GenericQueue {
|
||||||
*
|
*
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
#define chQSpaceI(qp) ((size_t)((qp)->q_counter))
|
#define chQSpaceI(qp) ((qp)->q_counter)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @extends GenericQueue
|
* @extends GenericQueue
|
||||||
|
@ -105,6 +110,10 @@ struct GenericQueue {
|
||||||
*/
|
*/
|
||||||
typedef GenericQueue InputQueue;
|
typedef GenericQueue InputQueue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Returns the filled space into an input queue.
|
* @brief Returns the filled space into an input queue.
|
||||||
*
|
*
|
||||||
|
@ -165,6 +174,7 @@ typedef GenericQueue InputQueue;
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE)
|
#define chIQGet(iqp) chIQGetTimeout(iqp, TIME_INFINITE)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Data part of a static input queue initializer.
|
* @brief Data part of a static input queue initializer.
|
||||||
|
@ -212,15 +222,19 @@ typedef GenericQueue InputQueue;
|
||||||
*/
|
*/
|
||||||
typedef GenericQueue OutputQueue;
|
typedef GenericQueue OutputQueue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the filled space into an output queue.
|
* @name Macro Functions
|
||||||
*
|
* @{
|
||||||
* @param[in] oqp pointer to an @p OutputQueue structure
|
*/
|
||||||
* @return The number of full bytes in the queue.
|
/**
|
||||||
* @retval 0 if the queue is empty.
|
* @brief Returns the filled space into an output queue.
|
||||||
*
|
*
|
||||||
* @iclass
|
* @param[in] oqp pointer to an @p OutputQueue structure
|
||||||
*/
|
* @return The number of full bytes in the queue.
|
||||||
|
* @retval 0 if the queue is empty.
|
||||||
|
*
|
||||||
|
* @iclass
|
||||||
|
*/
|
||||||
#define chOQGetFullI(oqp) (chQSizeI(oqp) - chQSpaceI(oqp))
|
#define chOQGetFullI(oqp) (chQSizeI(oqp) - chQSpaceI(oqp))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -274,6 +288,7 @@ typedef GenericQueue OutputQueue;
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE)
|
#define chOQPut(oqp, b) chOQPutTimeout(oqp, b, TIME_INFINITE)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Data part of a static output queue initializer.
|
* @brief Data part of a static output queue initializer.
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#define _CHREGISTRY_H_
|
#define _CHREGISTRY_H_
|
||||||
|
|
||||||
#if CH_USE_REGISTRY || defined(__DOXYGEN__)
|
#if CH_USE_REGISTRY || defined(__DOXYGEN__)
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Sets the current thread name.
|
* @brief Sets the current thread name.
|
||||||
* @pre This function only stores the pointer to the name if the option
|
* @pre This function only stores the pointer to the name if the option
|
||||||
|
@ -52,13 +56,13 @@
|
||||||
* @retval NULL if the thread name has not been set.
|
* @retval NULL if the thread name has not been set.
|
||||||
*/
|
*/
|
||||||
#define chRegGetThreadName(tp) ((tp)->p_name)
|
#define chRegGetThreadName(tp) ((tp)->p_name)
|
||||||
|
/** @} */
|
||||||
#else /* !CH_USE_REGISTRY */
|
#else /* !CH_USE_REGISTRY */
|
||||||
#define chRegSetThreadName(p)
|
#define chRegSetThreadName(p)
|
||||||
#define chRegGetThreadName(tp) NULL
|
#define chRegGetThreadName(tp) NULL
|
||||||
#endif /* !CH_USE_REGISTRY */
|
#endif /* !CH_USE_REGISTRY */
|
||||||
|
|
||||||
#if CH_USE_REGISTRY || defined(__DOXYGEN__)
|
#if CH_USE_REGISTRY || defined(__DOXYGEN__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Removes a thread from the registry list.
|
* @brief Removes a thread from the registry list.
|
||||||
* @note This macro is not meant for use in application code.
|
* @note This macro is not meant for use in application code.
|
||||||
|
|
|
@ -161,6 +161,10 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Determines if the current thread must reschedule.
|
* @brief Determines if the current thread must reschedule.
|
||||||
* @details This function returns @p TRUE if there is a ready thread with
|
* @details This function returns @p TRUE if there is a ready thread with
|
||||||
|
@ -223,6 +227,7 @@ extern "C" {
|
||||||
chSchDoReschedule(); \
|
chSchDoReschedule(); \
|
||||||
}
|
}
|
||||||
#endif /* CH_TIME_QUANTUM == 0 */
|
#endif /* CH_TIME_QUANTUM == 0 */
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* _CHSCHD_H_ */
|
#endif /* _CHSCHD_H_ */
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,10 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
#define SEMAPHORE_DECL(name, n) Semaphore name = _SEMAPHORE_DATA(name, n)
|
#define SEMAPHORE_DECL(name, n) Semaphore name = _SEMAPHORE_DATA(name, n)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Decreases the semaphore counter.
|
* @brief Decreases the semaphore counter.
|
||||||
* @details This macro can be used when the counter is known to be positive.
|
* @details This macro can be used when the counter is known to be positive.
|
||||||
|
@ -105,6 +109,7 @@ extern "C" {
|
||||||
* @iclass
|
* @iclass
|
||||||
*/
|
*/
|
||||||
#define chSemGetCounterI(sp) ((sp)->s_cnt)
|
#define chSemGetCounterI(sp) ((sp)->s_cnt)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* CH_USE_SEMAPHORES */
|
#endif /* CH_USE_SEMAPHORES */
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,10 @@ typedef struct {
|
||||||
_base_sequential_stream_data
|
_base_sequential_stream_data
|
||||||
} BaseSequentialStream;
|
} BaseSequentialStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions (BaseSequentialStream)
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Sequential Stream write.
|
* @brief Sequential Stream write.
|
||||||
* @details The function writes data from a buffer to a stream.
|
* @details The function writes data from a buffer to a stream.
|
||||||
|
@ -103,6 +107,7 @@ typedef struct {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chSequentialStreamRead(ip, bp, n) ((ip)->vmt->read(ip, bp, n))
|
#define chSequentialStreamRead(ip, bp, n) ((ip)->vmt->read(ip, bp, n))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#endif /* _CHSTREAMS_H_ */
|
#endif /* _CHSTREAMS_H_ */
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
#ifndef _CHSYS_H_
|
#ifndef _CHSYS_H_
|
||||||
#define _CHSYS_H_
|
#define _CHSYS_H_
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
|
#if !CH_NO_IDLE_THREAD || defined(__DOXYGEN__)
|
||||||
/**
|
/**
|
||||||
* @brief Returns a pointer to the idle thread.
|
* @brief Returns a pointer to the idle thread.
|
||||||
|
@ -177,7 +181,11 @@
|
||||||
dbg_check_unlock_from_isr(); \
|
dbg_check_unlock_from_isr(); \
|
||||||
port_unlock_from_isr(); \
|
port_unlock_from_isr(); \
|
||||||
}
|
}
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name ISRs abstraction macros
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief IRQ handler enter code.
|
* @brief IRQ handler enter code.
|
||||||
* @note Usually IRQ handlers functions are also declared naked.
|
* @note Usually IRQ handlers functions are also declared naked.
|
||||||
|
@ -211,7 +219,11 @@
|
||||||
* @special
|
* @special
|
||||||
*/
|
*/
|
||||||
#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
|
#define CH_IRQ_HANDLER(id) PORT_IRQ_HANDLER(id)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Fast ISRs abstraction macros
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Standard fast IRQ handler declaration.
|
* @brief Standard fast IRQ handler declaration.
|
||||||
* @note @p id can be a function name or a vector number depending on the
|
* @note @p id can be a function name or a vector number depending on the
|
||||||
|
@ -221,6 +233,7 @@
|
||||||
* @special
|
* @special
|
||||||
*/
|
*/
|
||||||
#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
|
#define CH_FAST_IRQ_HANDLER(id) PORT_FAST_IRQ_HANDLER(id)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -59,9 +59,10 @@
|
||||||
*/
|
*/
|
||||||
#define THD_MEM_MODE_MASK 3 /**< @brief Thread memory mode mask. */
|
#define THD_MEM_MODE_MASK 3 /**< @brief Thread memory mode mask. */
|
||||||
#define THD_MEM_MODE_STATIC 0 /**< @brief Static thread. */
|
#define THD_MEM_MODE_STATIC 0 /**< @brief Static thread. */
|
||||||
#define THD_MEM_MODE_HEAP 1 /**< @brief Thread allocated from Heap. */
|
#define THD_MEM_MODE_HEAP 1 /**< @brief Thread allocated from a
|
||||||
#define THD_MEM_MODE_MEMPOOL 2 /**< @brief Thread allocated from Memory
|
Memory Heap. */
|
||||||
Pool. */
|
#define THD_MEM_MODE_MEMPOOL 2 /**< @brief Thread allocated from a
|
||||||
|
Memory Pool. */
|
||||||
#define THD_TERMINATE 4 /**< @brief Termination requested flag. */
|
#define THD_TERMINATE 4 /**< @brief Termination requested flag. */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -204,6 +205,10 @@ struct Thread {
|
||||||
*/
|
*/
|
||||||
typedef msg_t (*tfunc_t)(void *);
|
typedef msg_t (*tfunc_t)(void *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Returns a pointer to the current @p Thread.
|
* @brief Returns a pointer to the current @p Thread.
|
||||||
*
|
*
|
||||||
|
@ -258,7 +263,7 @@ typedef msg_t (*tfunc_t)(void *);
|
||||||
#define chThdShouldTerminate() (currp->p_flags & THD_TERMINATE)
|
#define chThdShouldTerminate() (currp->p_flags & THD_TERMINATE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Resumes a thread created with @p chThdInit().
|
* @brief Resumes a thread created with @p chThdCreateI().
|
||||||
*
|
*
|
||||||
* @param[in] tp pointer to the thread
|
* @param[in] tp pointer to the thread
|
||||||
*
|
*
|
||||||
|
@ -317,6 +322,7 @@ typedef msg_t (*tfunc_t)(void *);
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec))
|
#define chThdSleepMicroseconds(usec) chThdSleep(US2ST(usec))
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Threads APIs.
|
* Threads APIs.
|
||||||
|
|
|
@ -34,21 +34,21 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Time conversion utility.
|
* @brief Seconds to system ticks.
|
||||||
* @details Converts from seconds to system ticks number.
|
* @details Converts from seconds to system ticks number.
|
||||||
* @note The result is rounded upward to the next tick boundary.
|
* @note The result is rounded upward to the next tick boundary.
|
||||||
*/
|
*/
|
||||||
#define S2ST(sec) ((systime_t)((sec) * CH_FREQUENCY))
|
#define S2ST(sec) ((systime_t)((sec) * CH_FREQUENCY))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Time conversion utility.
|
* @brief Milliseconds t0 system ticks.
|
||||||
* @details Converts from milliseconds to system ticks number.
|
* @details Converts from milliseconds to system ticks number.
|
||||||
* @note The result is rounded upward to the next tick boundary.
|
* @note The result is rounded upward to the next tick boundary.
|
||||||
*/
|
*/
|
||||||
#define MS2ST(msec) ((systime_t)(((((msec) - 1L) * CH_FREQUENCY) / 1000L) + 1L))
|
#define MS2ST(msec) ((systime_t)(((((msec) - 1L) * CH_FREQUENCY) / 1000L) + 1L))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Time conversion utility.
|
* @brief Microseconds to system ticks.
|
||||||
* @details Converts from microseconds to system ticks number.
|
* @details Converts from microseconds to system ticks number.
|
||||||
* @note The result is rounded upward to the next tick boundary.
|
* @note The result is rounded upward to the next tick boundary.
|
||||||
*/
|
*/
|
||||||
|
@ -99,6 +99,10 @@ typedef struct {
|
||||||
|
|
||||||
extern VTList vtlist;
|
extern VTList vtlist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name Macro Functions
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* @brief Virtual timers ticker.
|
* @brief Virtual timers ticker.
|
||||||
*
|
*
|
||||||
|
@ -139,6 +143,7 @@ extern VTList vtlist;
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
#define chTimeNow() (vtlist.vt_systime)
|
#define chTimeNow() (vtlist.vt_systime)
|
||||||
|
/** @} */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Virtual Timers APIs.
|
* Virtual Timers APIs.
|
||||||
|
|
|
@ -109,7 +109,7 @@ Thread *chMsgWait(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Releases the thread waiting on top of the messages queue.
|
* @brief Releases a sender thread specifying a response message.
|
||||||
* @pre Invoke this function only after a message has been received
|
* @pre Invoke this function only after a message has been received
|
||||||
* using @p chMsgWait().
|
* using @p chMsgWait().
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue