Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1 | |
Dean Lee | c3ea8a7 | 2015-06-16 15:28:21 +0900 | [diff] [blame^] | 2 | #include "wilc_timer.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4 | WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, |
| 5 | tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs) |
| 6 | { |
| 7 | WILC_ErrNo s32RetStatus = WILC_SUCCESS; |
| 8 | setup_timer(pHandle, (void(*)(unsigned long))pfCallback, 0); |
| 9 | |
| 10 | return s32RetStatus; |
| 11 | } |
| 12 | |
| 13 | WILC_ErrNo WILC_TimerDestroy(WILC_TimerHandle *pHandle, |
| 14 | tstrWILC_TimerAttrs *pstrAttrs) |
| 15 | { |
| 16 | WILC_ErrNo s32RetStatus = WILC_FAIL; |
| 17 | if (pHandle != NULL) { |
| 18 | s32RetStatus = del_timer_sync(pHandle); |
| 19 | pHandle = NULL; |
| 20 | } |
| 21 | |
| 22 | return s32RetStatus; |
| 23 | } |
| 24 | |
| 25 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 26 | WILC_ErrNo WILC_TimerStart(WILC_TimerHandle *pHandle, u32 u32Timeout, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 27 | void *pvArg, tstrWILC_TimerAttrs *pstrAttrs) |
| 28 | { |
| 29 | WILC_ErrNo s32RetStatus = WILC_FAIL; |
| 30 | if (pHandle != NULL) { |
| 31 | pHandle->data = (unsigned long)pvArg; |
| 32 | s32RetStatus = mod_timer(pHandle, (jiffies + msecs_to_jiffies(u32Timeout))); |
| 33 | } |
| 34 | return s32RetStatus; |
| 35 | } |
| 36 | |
| 37 | WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, |
| 38 | tstrWILC_TimerAttrs *pstrAttrs) |
| 39 | { |
| 40 | WILC_ErrNo s32RetStatus = WILC_FAIL; |
| 41 | if (pHandle != NULL) |
| 42 | s32RetStatus = del_timer(pHandle); |
| 43 | |
| 44 | return s32RetStatus; |
| 45 | } |