Skip to content

Commit 1b38b5a

Browse files
paul-szczepanek-armCruz Monrreal II
authored andcommitted
fix docs in Mail
1 parent de6ba91 commit 1b38b5a

File tree

1 file changed

+71
-53
lines changed

1 file changed

+71
-53
lines changed

rtos/Mail.h

Lines changed: 71 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -42,28 +42,31 @@ namespace rtos {
4242
* \defgroup rtos_Mail Mail class
4343
* @{
4444
*/
45-
46-
/** The Mail class allow to control, send, receive, or wait for mail.
47-
A mail is a memory block that is send to a thread or interrupt service routine.
48-
@tparam T data type of a single message element.
49-
@tparam queue_sz maximum number of messages in queue.
50-
51-
@note
52-
Memory considerations: The mail data store and control structures will be created on current thread's stack,
53-
both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory pools are not being used).
54-
*/
45+
46+
/** The Mail class allows you to control, send, receive, or wait for mail.
47+
* A mail is a memory block that is sent to a thread or interrupt service routine.
48+
* @tparam T Data type of a single mail message element.
49+
* @tparam queue_sz Maximum number of mail messages in queue.
50+
*
51+
* @note
52+
* Memory considerations: The mail data store and control structures are part of this class - they do not (themselves)
53+
* allocate memory on the heap, both for the mbed OS and underlying RTOS objects (static or dynamic RTOS memory
54+
* pools are not being used).
55+
*/
5556
template<typename T, uint32_t queue_sz>
5657
class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
5758
public:
58-
/** Create and Initialize Mail queue.
59+
/** Create and initialize Mail queue.
5960
*
6061
* @note You cannot call this function from ISR context.
61-
*/
62+
*/
6263
Mail() { };
6364

64-
/** Check if the mail queue is empty
65+
/** Check if the mail queue is empty.
6566
*
66-
* @return True if the mail queue is empty, false if not
67+
* @return State of queue.
68+
* @retval true Mail queue is empty.
69+
* @retval false Mail queue contains mail.
6770
*
6871
* @note You may call this function from ISR context.
6972
*/
@@ -72,9 +75,11 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
7275
return _queue.empty();
7376
}
7477

75-
/** Check if the mail queue is full
78+
/** Check if the mail queue is full.
7679
*
77-
* @return True if the mail queue is full, false if not
80+
* @return State of queue.
81+
* @retval true Mail queue is full.
82+
* @retval false Mail queue is not full.
7883
*
7984
* @note You may call this function from ISR context.
8085
*/
@@ -83,47 +88,55 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
8388
return _queue.full();
8489
}
8590

86-
/** Allocate a memory block of type T
87-
@param millisec timeout value or 0 in case of no time-out. (default: 0).
88-
@return pointer to memory block that can be filled with mail or NULL in case error.
89-
90-
@note You may call this function from ISR context if the millisec parameter is set to 0.
91-
*/
92-
T *alloc(uint32_t millisec = 0)
93-
{
91+
/** Allocate a memory block of type T.
92+
*
93+
* @param millisec Not used.
94+
*
95+
* @return Pointer to memory block that can be filled with mail or NULL in case error.
96+
*
97+
* @note You may call this function from ISR context.
98+
*/
99+
T* alloc(uint32_t millisec=0) {
94100
return _pool.alloc();
95101
}
96102

97103
/** Allocate a memory block of type T and set memory block to zero.
98-
@param millisec timeout value or 0 in case of no time-out. (default: 0).
99-
@return pointer to memory block that can be filled with mail or NULL in case error.
100-
101-
@note You may call this function from ISR context if the millisec parameter is set to 0.
102-
*/
103-
T *calloc(uint32_t millisec = 0)
104-
{
104+
*
105+
* @param millisec Not used.
106+
*
107+
* @return Pointer to memory block that can be filled with mail or NULL in case error.
108+
*
109+
* @note You may call this function from ISR context.
110+
*/
111+
T* calloc(uint32_t millisec=0) {
105112
return _pool.calloc();
106113
}
107114

108115
/** Put a mail in the queue.
109-
@param mptr memory block previously allocated with Mail::alloc or Mail::calloc.
110-
@return status code that indicates the execution status of the function.
111-
112-
@note You may call this function from ISR context.
113-
*/
114-
osStatus put(T *mptr)
115-
{
116+
*
117+
* @param mptr Memory block previously allocated with Mail::alloc or Mail::calloc.
118+
*
119+
* @return Status code that indicates the execution status of the function (osOK on success).
120+
*
121+
* @note You may call this function from ISR context.
122+
*/
123+
osStatus put(T *mptr) {
116124
return _queue.put(mptr);
117125
}
118126

119-
/** Get a mail from a queue.
120-
@param millisec timeout value or 0 in case of no time-out. (default: osWaitForever).
121-
@return event that contains mail information or error code.
122-
123-
@note You may call this function from ISR context if the millisec parameter is set to 0.
124-
*/
125-
osEvent get(uint32_t millisec = osWaitForever)
126-
{
127+
/** Get a mail from the queue.
128+
*
129+
* @param millisec Timeout value or 0 in case of no timeout (default: osWaitForever).
130+
*
131+
* @return Event that contains mail information or error code.
132+
* @retval osEventMessage Message received.
133+
* @retval osOK No mail is available (and no timeout was specified).
134+
* @retval osEventTimeout No mail has arrived during the given timeout period.
135+
* @retval osErrorParameter A parameter is invalid or outside of a permitted range.
136+
*
137+
* @note You may call this function from ISR context if the millisec parameter is set to 0.
138+
*/
139+
osEvent get(uint32_t millisec=osWaitForever) {
127140
osEvent evt = _queue.get(millisec);
128141
if (evt.status == osEventMessage) {
129142
evt.status = osEventMail;
@@ -132,19 +145,24 @@ class Mail : private mbed::NonCopyable<Mail<T, queue_sz> > {
132145
}
133146

134147
/** Free a memory block from a mail.
135-
@param mptr pointer to the memory block that was obtained with Mail::get.
136-
@return status code that indicates the execution status of the function.
137-
138-
@note You may call this function from ISR context.
139-
*/
140-
osStatus free(T *mptr)
141-
{
148+
*
149+
* @param mptr Pointer to the memory block that was obtained with Mail::get.
150+
*
151+
* @return Status code that indicates the execution status of the function (osOK on success).
152+
*
153+
* @note You may call this function from ISR context.
154+
*/
155+
osStatus free(T *mptr) {
142156
return _pool.free(mptr);
143157
}
144158

159+
#if !defined(DOXYGEN_ONLY)
160+
145161
private:
146162
Queue<T, queue_sz> _queue;
147163
MemoryPool<T, queue_sz> _pool;
164+
165+
#endif //!defined(DOXYGEN_ONLY)
148166
};
149167

150168
/** @}*/

0 commit comments

Comments
 (0)