Skip to content

Commit 464d0c5

Browse files
committed
[kernel] update comments
1 parent 5de6996 commit 464d0c5

File tree

6 files changed

+108
-108
lines changed

6 files changed

+108
-108
lines changed

src/device.c

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
#endif /* RT_USING_DEVICE_OPS */
4040

4141
/**
42-
* @brief This function registers a device driver with specified name.
42+
* @brief This function registers a device driver with a specified name.
4343
*
44-
* @param dev the pointer of device driver structure.
44+
* @param dev is the pointer of device driver structure.
4545
*
46-
* @param name the device driver's name.
46+
* @param name is the device driver's name.
4747
*
48-
* @param flags the capabilities flag of device.
48+
* @param flags is the capabilities flag of device.
4949
*
5050
* @return the error code, RT_EOK on initialization successfully.
5151
*/
@@ -76,7 +76,7 @@ RTM_EXPORT(rt_device_register);
7676
/**
7777
* @brief This function removes a previously registered device driver.
7878
*
79-
* @param dev the pointer of device driver structure.
79+
* @param dev is the pointer of device driver structure.
8080
*
8181
* @return the error code, RT_EOK on successfully.
8282
*/
@@ -95,7 +95,7 @@ RTM_EXPORT(rt_device_unregister);
9595
/**
9696
* @brief This function finds a device driver by specified name.
9797
*
98-
* @param name the device driver's name.
98+
* @param name is the device driver's name.
9999
*
100100
* @return the registered device driver on successful, or RT_NULL on failure.
101101
*/
@@ -109,9 +109,9 @@ RTM_EXPORT(rt_device_find);
109109
/**
110110
* @brief This function creates a device object with user data size.
111111
*
112-
* @param type the kind type of this device object.
112+
* @param type is the type of the device object.
113113
*
114-
* @param attach_size the size of user data.
114+
* @param attach_size is the size of user data.
115115
*
116116
* @return the allocated device object, or RT_NULL when failed.
117117
*/
@@ -139,7 +139,7 @@ RTM_EXPORT(rt_device_create);
139139
/**
140140
* @brief This function destroy the specific device object.
141141
*
142-
* @param dev the specific device object.
142+
* @param dev is a specific device object.
143143
*/
144144
void rt_device_destroy(rt_device_t dev)
145145
{
@@ -158,7 +158,7 @@ RTM_EXPORT(rt_device_destroy);
158158
/**
159159
* @brief This function will initialize the specified device.
160160
*
161-
* @param dev the pointer of device driver structure.
161+
* @param dev is the pointer of device driver structure.
162162
*
163163
* @return the result, RT_EOK on successfully.
164164
*/
@@ -192,9 +192,9 @@ rt_err_t rt_device_init(rt_device_t dev)
192192
/**
193193
* @brief This function will open a device.
194194
*
195-
* @param dev the pointer of device driver structure.
195+
* @param dev is the pointer of device driver structure.
196196
*
197-
* @param oflag the flags for device open.
197+
* @param oflag is the flags for device open.
198198
*
199199
* @return the result, RT_EOK on successfully.
200200
*/
@@ -259,7 +259,7 @@ RTM_EXPORT(rt_device_open);
259259
/**
260260
* @brief This function will close a device.
261261
*
262-
* @param dev the pointer of device driver structure.
262+
* @param dev is the pointer of device driver structure.
263263
*
264264
* @return the result, RT_EOK on successfully.
265265
*/
@@ -295,13 +295,13 @@ RTM_EXPORT(rt_device_close);
295295
/**
296296
* @brief This function will read some data from a device.
297297
*
298-
* @param dev the pointer of device driver structure.
298+
* @param dev is the pointer of device driver structure.
299299
*
300-
* @param pos the position of reading.
300+
* @param pos is the position when reading.
301301
*
302-
* @param buffer the data buffer to save read data.
302+
* @param buffer is a data buffer to save the read data.
303303
*
304-
* @param size the size of buffer.
304+
* @param size is the size of buffer.
305305
*
306306
* @return the actually read size on successful, otherwise negative returned.
307307
*
@@ -337,13 +337,13 @@ RTM_EXPORT(rt_device_read);
337337
/**
338338
* @brief This function will write some data to a device.
339339
*
340-
* @param dev the pointer of device driver structure.
340+
* @param dev is the pointer of device driver structure.
341341
*
342-
* @param pos the position of written.
342+
* @param pos is the position when writing.
343343
*
344-
* @param buffer the data buffer to be written to device.
344+
* @param buffer is the data buffer to be written to device.
345345
*
346-
* @param size the size of buffer.
346+
* @param size is the size of buffer.
347347
*
348348
* @return the actually written size on successful, otherwise negative returned.
349349
*
@@ -379,11 +379,11 @@ RTM_EXPORT(rt_device_write);
379379
/**
380380
* @brief This function will perform a variety of control functions on devices.
381381
*
382-
* @param dev the pointer of device driver structure.
382+
* @param dev is the pointer of device driver structure.
383383
*
384-
* @param cmd the command sent to device.
384+
* @param cmd is the command sent to device.
385385
*
386-
* @param arg the argument of command.
386+
* @param arg is the argument of command.
387387
*
388388
* @return the result, -RT_ENOSYS for failed.
389389
*/
@@ -406,11 +406,11 @@ RTM_EXPORT(rt_device_control);
406406
* @brief This function will set the reception indication callback function. This callback function
407407
* is invoked when this device receives data.
408408
*
409-
* @param dev the pointer of device driver structure.
409+
* @param dev is the pointer of device driver structure.
410410
*
411-
* @param rx_ind the indication callback function.
411+
* @param rx_ind is the indication callback function.
412412
*
413-
* @return RT_EOK.
413+
* @return RT_EOK
414414
*/
415415
rt_err_t
416416
rt_device_set_rx_indicate(rt_device_t dev,
@@ -426,14 +426,14 @@ rt_device_set_rx_indicate(rt_device_t dev,
426426
RTM_EXPORT(rt_device_set_rx_indicate);
427427

428428
/**
429-
* @brief This function will set the indication callback function when device has
430-
* written data to physical hardware.
429+
* @brief This function will set a callback function. The callback function
430+
* will be called when device has written data to physical hardware.
431431
*
432-
* @param dev the pointer of device driver structure.
432+
* @param dev is the pointer of device driver structure.
433433
*
434-
* @param tx_done the indication callback function.
434+
* @param tx_done is the indication callback function.
435435
*
436-
* @return RT_EOK.
436+
* @return RT_EOK
437437
*/
438438
rt_err_t
439439
rt_device_set_tx_complete(rt_device_t dev,

src/mem.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void rt_system_heap_init(void *begin_addr, void *end_addr)
266266
*
267267
* @param size is the minimum size of the requested block in bytes.
268268
*
269-
* @return pointer to allocated memory or NULL if no free memory was found.
269+
* @return the pointer to allocated memory or NULL if no free memory was found.
270270
*/
271271
void *rt_malloc(rt_size_t size)
272272
{
@@ -410,11 +410,11 @@ void *rt_malloc(rt_size_t size)
410410
RTM_EXPORT(rt_malloc);
411411

412412
/**
413-
* @brief This function will change the previously allocated memory block.
413+
* @brief This function will change the size of previously allocated memory block.
414414
*
415-
* @param rmem pointer to memory allocated by rt_malloc.
415+
* @param rmem is the pointer to memory allocated by rt_malloc.
416416
*
417-
* @param newsize the required new size.
417+
* @param newsize is the required new size.
418418
*
419419
* @return the changed memory block address.
420420
*/
@@ -517,15 +517,15 @@ void *rt_realloc(void *rmem, rt_size_t newsize)
517517
RTM_EXPORT(rt_realloc);
518518

519519
/**
520-
* @brief This function will contiguously allocate enough space for count objects
521-
* that are size bytes of memory each and returns a pointer to the allocated
522-
* memory.
520+
* @brief This function will contiguously allocate enough space for count objects
521+
* that are size bytes of memory each and returns a pointer to the allocated
522+
* memory.
523523
*
524-
* @note The allocated memory is filled with bytes of value zero.
524+
* @note The allocated memory is filled with bytes of value zero.
525525
*
526-
* @param count number of objects to allocate.
526+
* @param count is the number of objects to allocate.
527527
*
528-
* @param size size of the objects to allocate.
528+
* @param size is the size of one object to allocate.
529529
*
530530
* @return pointer to allocated memory / NULL pointer if there is an error.
531531
*/
@@ -548,7 +548,7 @@ RTM_EXPORT(rt_calloc);
548548
* @brief This function will release the previously allocated memory block by
549549
* rt_malloc. The released memory block is taken back to system heap.
550550
*
551-
* @param rmem the address of memory which will be released
551+
* @param rmem the address of memory which will be released.
552552
*/
553553
void rt_free(void *rmem)
554554
{

src/mempool.c

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static void (*rt_mp_free_hook)(struct rt_mempool *mp, void *block);
3333

3434
/**
3535
* @brief This function will set a hook function, which will be invoked when a memory
36-
* block is allocated from memory pool.
36+
* block is allocated from the memory pool.
3737
*
3838
* @param hook the hook function
3939
*/
@@ -44,7 +44,7 @@ void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool *mp, void *block))
4444

4545
/**
4646
* @brief This function will set a hook function, which will be invoked when a memory
47-
* block is released to memory pool.
47+
* block is released to the memory pool.
4848
*
4949
* @param hook the hook function
5050
*/
@@ -63,18 +63,18 @@ void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block))
6363
/**@{*/
6464

6565
/**
66-
* @brief This function will initialize a memory pool object, normally which is used
67-
* for static object.
66+
* @brief This function will initialize a memory pool object, normally which is used
67+
* for static object.
6868
*
69-
* @param mp the memory pool object
69+
* @param mp is the memory pool object.
7070
*
71-
* @param name the name of memory pool
71+
* @param name is the name of the memory pool.
7272
*
73-
* @param start the star address of memory pool
73+
* @param start is the start address of the memory pool.
7474
*
75-
* @param size the total size of memory pool
75+
* @param size is the total size of the memory pool.
7676
*
77-
* @param block_size the size for each block
77+
* @param block_size is the size for each block..
7878
*
7979
* @return RT_EOK
8080
*/
@@ -129,9 +129,9 @@ rt_err_t rt_mp_init(struct rt_mempool *mp,
129129
RTM_EXPORT(rt_mp_init);
130130

131131
/**
132-
* @brief This function will detach a memory pool from system object management.
132+
* @brief This function will detach a memory pool from system object management.
133133
*
134-
* @param mp the memory pool object.
134+
* @param mp is the memory pool object.
135135
*
136136
* @return RT_EOK
137137
*/
@@ -179,11 +179,11 @@ RTM_EXPORT(rt_mp_detach);
179179
* @brief This function will create a mempool object and allocate the memory pool from
180180
* heap.
181181
*
182-
* @param name the name of memory pool
182+
* @param name is the name of memory pool.
183183
*
184-
* @param block_count the count of blocks in memory pool
184+
* @param block_count is the count of blocks in memory pool.
185185
*
186-
* @param block_size the size for each block
186+
* @param block_size is the size for each block.
187187
*
188188
* @return the created mempool object
189189
*/
@@ -249,7 +249,7 @@ RTM_EXPORT(rt_mp_create);
249249
/**
250250
* @brief This function will delete a memory pool and release the object memory.
251251
*
252-
* @param mp the memory pool object.
252+
* @param mp is the memory pool object.
253253
*
254254
* @return RT_EOK
255255
*/
@@ -301,9 +301,10 @@ RTM_EXPORT(rt_mp_delete);
301301
/**
302302
* @brief This function will allocate a block from memory pool.
303303
*
304-
* @param mp the memory pool object.
304+
* @param mp is the memory pool object.
305305
*
306-
* @param time the waiting time.
306+
* @param time is the maximum waiting time for allocating memory.
307+
* - 0 for not waiting, allocating memory immediately.
307308
*
308309
* @return the allocated memory block or RT_NULL on allocated failed.
309310
*/
@@ -399,9 +400,9 @@ void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time)
399400
RTM_EXPORT(rt_mp_alloc);
400401

401402
/**
402-
* @brief This function will release a memory block
403+
* @brief This function will release a memory block.
403404
*
404-
* @param block the address of memory block to be released
405+
* @param block the address of memory block to be released.
405406
*/
406407
void rt_mp_free(void *block)
407408
{

0 commit comments

Comments
 (0)