wm_wl_timers.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * @file wm_wl_timers.h
  3. *
  4. * @brief task APIs
  5. *
  6. * @author dave
  7. *
  8. * Copyright (c) 2015 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef __TLS_WL_TIMERS_H__
  11. #define __TLS_WL_TIMERS_H__
  12. #include "wm_type_def.h"
  13. #include "wm_wl_mbox.h"
  14. /** callback function of time out */
  15. typedef void (* tls_timeout_handler)(void *arg);
  16. /**
  17. * @brief Create a one-shot timer (aka timeout)
  18. *
  19. * @param[in] timeo_assigned timer NO. by assigned
  20. * @param[in] msecs time in milliseconds after that the timer should expire
  21. * @param[in] handler callback function that would be called by the timeout
  22. * @param[in] *arg callback argument that would be passed to handler
  23. *
  24. * @return None
  25. *
  26. * @note While waiting for a message using sys_timeouts_mbox_fetch()
  27. */
  28. void tls_timeout_p(u8 timeo_assigned, u32 msecs, tls_timeout_handler handler, void *arg);
  29. /**
  30. * @brief Go through timeout list (for this task only) and remove the first
  31. * matching entry, even though the timeout has not been triggered yet
  32. *
  33. * @param[in] timeo_assigned timer NO. by assigned
  34. * @param[in] handler callback function that would be called by the timeout
  35. * @param[in] *arg callback argument that would be passed to handler
  36. *
  37. * @return None
  38. *
  39. * @note None
  40. */
  41. void tls_untimeout_p(u8 timeo_assigned, tls_timeout_handler handler, void *arg);
  42. /**
  43. * @brief Wait (forever) for a message to arrive in an mbox.
  44. * While waiting, timeouts are processed
  45. *
  46. * @param[in] timeo_assigned timer NO. by assigned
  47. * @param[in] mbox the mbox to fetch the message from
  48. * @param[out] **msg the place to store the message
  49. *
  50. * @return None
  51. *
  52. * @note None
  53. */
  54. void tls_timeouts_mbox_fetch_p(u8 timeo_assigned, tls_mbox_t mbox, void **msg);
  55. /**
  56. * @brief Initialize the timer
  57. *
  58. * @param None
  59. *
  60. * @retval 0 success
  61. * @retval other failed
  62. *
  63. * @note None
  64. */
  65. s8 tls_wl_timer_init(void);
  66. #endif