|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|

类型定义 | |
| typedef void(* | SWTMR_PROC_FUNC) (UINTPTR arg) |
| Define the type of a callback function that handles software timer timeout. | |
枚举 | |
| enum | enSwTmrType { LOS_SWTMR_MODE_ONCE , LOS_SWTMR_MODE_PERIOD , LOS_SWTMR_MODE_NO_SELFDELETE , LOS_SWTMR_MODE_OPP } |
函数 | |
| UINT32 | LOS_SwtmrStart (UINT16 swtmrId) |
| Start a software timer. | |
| UINT32 | LOS_SwtmrStop (UINT16 swtmrId) |
| Stop a software timer. | |
| UINT32 | LOS_SwtmrTimeGet (UINT16 swtmrId, UINT32 *tick) |
| Obtain the number of remaining Ticks configured on a software timer. | |
| UINT32 | LOS_SwtmrCreate (UINT32 interval, UINT8 mode, SWTMR_PROC_FUNC handler, UINT16 *swtmrId, UINTPTR arg) |
| Create a software timer. | |
| UINT32 | LOS_SwtmrDelete (UINT16 swtmrId) |
| Delete a software timer. | |
| #define LOS_ERRNO_SWTMR_HANDLER_POOL_NO_MEM LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0a) |
Software timer error code: Insufficient memory allocated by membox.
Value: 0x0200030a.
Solution: Expand the memory allocated by membox.
| #define LOS_ERRNO_SWTMR_HWI_ACTIVE LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x09) |
Software timer error code: The software timer is being used during an interrupt.
Value: 0x02000309.
Solution: Change the source code and do not use the software timer during an interrupt.
| #define LOS_ERRNO_SWTMR_ID_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x05) |
Software timer error code: Invalid software timer ID.
Value: 0x02000305.
Solution: Pass in a valid software timer ID.
| #define LOS_ERRNO_SWTMR_INTERVAL_NOT_SUITED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x01) |
Software timer error code: The expiration time is 0.
Value: 0x02000301.
Solution: Re-define the expiration time.
| #define LOS_ERRNO_SWTMR_INVALID_SYNCDEL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x12) |
Software timer error code: Try to sync delete a software timer during an interrupt or a timer callback.
Value: 0x02000312.
Solution: Change the source code and do not sync delete a software timer during an interrupt or a timer callback.
| #define LOS_ERRNO_SWTMR_MAXSIZE LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x04) |
Software timer error code: The number of software timers exceeds the configured permitted maximum number.
Value: 0x02000304.
Solution: Re-configure the permitted maximum number of software timers, or wait for a software timer to become available.
| #define LOS_ERRNO_SWTMR_MAXSIZE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x08) |
Software timer error code: Invalid configured number of software timers.
Value: 0x02000308.
Solution: Re-configure the number of software timers.
| #define LOS_ERRNO_SWTMR_MODE_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x02) |
Software timer error code: Invalid software timer mode.
Value: 0x02000302.
Solution: Check the mode value. The value range is [0,3].
| #define LOS_ERRNO_SWTMR_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x07) |
Software timer error code: Insufficient memory for software timer linked list creation.
Value: 0x02000307.
Solution: Allocate bigger memory partition to software timer linked list creation.
| #define LOS_ERRNO_SWTMR_NOT_CREATED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x06) |
Software timer error code: The software timer is not created.
Value: 0x02000306.
Solution: Create a software timer.
| #define LOS_ERRNO_SWTMR_NOT_STARTED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0d) |
Software timer error code: The software timer is not started.
Value: 0x0200030d.
Solution: Start the software timer.
| #define LOS_ERRNO_SWTMR_PTR_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x00) |
Software timer error code: The timeout handling function is NULL.
Value: 0x02000300.
Solution: Define the timeout handling function.
| #define LOS_ERRNO_SWTMR_QUEUE_CREATE_FAILED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0b) |
Software timer error code: The software timer queue fails to be created.
Value: 0x0200030b.
Solution: Check whether more memory can be allocated to the queue to be created.
| #define LOS_ERRNO_SWTMR_RET_PTR_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x03) |
Software timer error code: The passed-in software timer ID is NULL.
Value: 0x02000303.
Solution: Define the software timer ID before passing it in.
| #define LOS_ERRNO_SWTMR_SORTLINK_CREATE_FAILED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x11) |
Software timer error code: The software sortlink fails to be created.
Value: 0x02000311.
Solution: Check whether the memory is sufficient and re-create the sortlink.
| #define LOS_ERRNO_SWTMR_SORTLIST_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0f) |
Software timer error code: This error code is not in use temporarily.
Value: 0x0200030f
| #define LOS_ERRNO_SWTMR_STATUS_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0e) |
Software timer error code: Invalid software timer state.
Value: 0x0200030e.
Solution: Check the software timer state.
| #define LOS_ERRNO_SWTMR_TASK_CREATE_FAILED LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x0c) |
Software timer error code: The software timer task fails to be created.
Value: 0x0200030c.
Solution: Check whether the memory is sufficient and re-create the task.
| #define LOS_ERRNO_SWTMR_TICK_PTR_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_SWTMR, 0x10) |
Software timer error code: The passed-in number of remaining Ticks configured on the software timer is NULL.
Value: 0x02000310.
Solution: Define a variable of the number of remaining Ticks before passing in the number of remaining Ticks.
| #define OS_SWTMR_HANDLE_QUEUE_SIZE KERNEL_SWTMR_LIMIT |
Maximum size of a software timer queue. The default value of LOSCFG_BASE_CORE_SWTMR_LIMIT is 16.
| #define OS_SWTMR_MAX_TIMERID ((0xFFFF / KERNEL_SWTMR_LIMIT) * KERNEL_SWTMR_LIMIT) |
Max number of software timers ID
0xFFFF: max number of all software timers
| typedef void(* SWTMR_PROC_FUNC) (UINTPTR arg) |
Define the type of a callback function that handles software timer timeout.
| arg | [IN] the parameter of the callback function that handles software timer timeout. |
| None. |
| enum enSwTmrType |
Software timer mode
|
extern |
Create a software timer.
| interval | [IN] Timing duration of the software timer to be created (unit: tick). |
| mode | [IN] Software timer mode. Pass in one of the modes specified by enSwTmrType. There are three types of modes, one-off, periodic, and continuously periodic after one-off, of which the third mode is not supported temporarily. |
| handler | [IN] Callback function that handles software timer timeout. |
| swtmrId | [OUT] Software timer ID created by LOS_SwtmrCreate. |
| arg | [IN] Parameter passed in when the callback function that handles software timer timeout is called. |
| LOS_ERRNO_SWTMR_INTERVAL_NOT_SUITED | The software timer timeout interval is 0. |
| LOS_ERRNO_SWTMR_MODE_INVALID | Invalid software timer mode. |
| LOS_ERRNO_SWTMR_PTR_NULL | The callback function that handles software timer timeout is NULL. |
| LOS_ERRNO_SWTMR_RET_PTR_NULL | The passed-in software timer ID is NULL. |
| LOS_ERRNO_SWTMR_MAXSIZE | The number of software timers exceeds the configured permitted maximum number. |
| LOS_OK | The software timer is successfully created. |
Delete a software timer.
| swtmrId | [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1]. |
| LOS_ERRNO_SWTMR_ID_INVALID | Invalid software timer ID. |
| LOS_ERRNO_SWTMR_NOT_CREATED | The software timer is not created. |
| LOS_ERRNO_SWTMR_STATUS_INVALID | Invalid software timer state. |
| LOS_OK | The software timer is successfully deleted. |
Start a software timer.
| swtmrId | [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1]. |
| LOS_ERRNO_SWTMR_ID_INVALID | Invalid software timer ID. |
| LOS_ERRNO_SWTMR_NOT_CREATED | The software timer is not created. |
| LOS_ERRNO_SWTMR_STATUS_INVALID | Invalid software timer state. |
| LOS_OK | The software timer is successfully started. |
Stop a software timer.
| swtmrId | [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1]. |
| LOS_ERRNO_SWTMR_ID_INVALID | Invalid software timer ID. |
| LOS_ERRNO_SWTMR_NOT_CREATED | The software timer is not created. |
| LOS_ERRNO_SWTMR_NOT_STARTED | The software timer is not started. |
| LOS_ERRNO_SWTMR_STATUS_INVALID | Invalid software timer state. |
| LOS_OK | The software timer is successfully stopped. |
Obtain the number of remaining Ticks configured on a software timer.
| swtmrId | [IN] Software timer ID created by LOS_SwtmrCreate. The value of ID should be in [0, LOSCFG_BASE_CORE_SWTMR_LIMIT - 1]. |
| tick | [OUT] Number of remaining Ticks configured on the software timer. |
| LOS_ERRNO_SWTMR_ID_INVALID | Invalid software timer ID. |
| LOS_ERRNO_SWTMR_TICK_PTR_NULL | The input parameter tick is a NULL pointer. |
| LOS_ERRNO_SWTMR_NOT_CREATED | The software timer is not created. |
| LOS_ERRNO_SWTMR_NOT_STARTED | The software timer is not started. |
| LOS_ERRNO_SWTMR_STATUS_INVALID | Invalid software timer state. |
| LOS_OK | The number of remaining Ticks is successfully obtained. |