Advertisement
ormz

dmtimer-test

Nov 17th, 2011
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.20 KB | None | 0 0
  1. #include <linux/err.h>
  2. #include <linux/hardirq.h>
  3. #include <linux/init.h>
  4. #include <linux/interrupt.h>
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <plat/dmtimer.h>
  8.  
  9. int dmt1 = 3;
  10. int dmt2 = 4;
  11.  
  12. module_param(dmt1, int, 0);
  13. module_param(dmt2, int, 0);
  14.  
  15. void tsk_enable_timer(unsigned long id)
  16. {
  17.         struct omap_dm_timer *dmt = NULL;
  18.  
  19.         dmt = omap_dm_timer_request_specific(id);
  20.         if (!dmt) {
  21.                 printk("%s error requesting timer\n", __func__);
  22.                 return;
  23.         }
  24.  
  25.         omap_dm_timer_free(dmt);
  26. }
  27.  
  28. struct tasklet_struct dmt_tsk;
  29.  
  30. static int __init dmtimer_test_init(void)
  31. {
  32.         struct omap_dm_timer *dmt = NULL;
  33.  
  34.         dmt = omap_dm_timer_request_specific(dmt1);
  35.         if (!dmt)
  36.                 printk("%s error requesting timer\n", __func__);
  37.  
  38.         tasklet_init(&dmt_tsk, tsk_enable_timer, dmt2);
  39.         tasklet_schedule(&dmt_tsk);
  40.  
  41.         if (dmt)
  42.                 omap_dm_timer_free(dmt);
  43.  
  44.         return 0;
  45. }
  46.  
  47. static void __exit dmtimer_test_exit(void)
  48. {
  49.         tasklet_kill(&dmt_tsk);
  50. }
  51.  
  52. module_init(dmtimer_test_init);
  53. module_exit(dmtimer_test_exit);
  54.  
  55. MODULE_AUTHOR("Omar");
  56. MODULE_LICENSE("GPL");
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement