bfa_timer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. #ifndef __BFA_TIMER_H__
  18. #define __BFA_TIMER_H__
  19. #include <bfa_os_inc.h>
  20. #include <cs/bfa_q.h>
  21. struct bfa_s;
  22. typedef void (*bfa_timer_cbfn_t)(void *);
  23. /**
  24. * BFA timer data structure
  25. */
  26. struct bfa_timer_s {
  27. struct list_head qe;
  28. bfa_timer_cbfn_t timercb;
  29. void *arg;
  30. int timeout; /**< in millisecs. */
  31. };
  32. /**
  33. * Timer module structure
  34. */
  35. struct bfa_timer_mod_s {
  36. struct list_head timer_q;
  37. };
  38. #define BFA_TIMER_FREQ 500 /**< specified in millisecs */
  39. void bfa_timer_beat(struct bfa_timer_mod_s *mod);
  40. void bfa_timer_init(struct bfa_timer_mod_s *mod);
  41. void bfa_timer_begin(struct bfa_timer_mod_s *mod, struct bfa_timer_s *timer,
  42. bfa_timer_cbfn_t timercb, void *arg,
  43. unsigned int timeout);
  44. void bfa_timer_stop(struct bfa_timer_s *timer);
  45. #endif /* __BFA_TIMER_H__ */