Guest User

Untitled

a guest
Aug 19th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <math.h>
  5. #include <stdlib.h>
  6.  
  7. #include "rtems.h"
  8. #include <rtems/irq-extension.h>
  9. #include "exti.h"
  10. #include "driver_name.h"
  11.  
  12. extern void task_config_drivers(void);
  13. extern void *get_driver_from_list(enum driver_name name);
  14. extern void EXTI15_10_IRQHandler(void);
  15.  
  16. static rtems_id exti_task_id;
  17.  
  18. void exti_test_callback(void)
  19. {
  20. printf("%s\n", __FUNCTION__);
  21. rtems_status_code status = rtems_event_send(exti_task_id, RTEMS_EVENT_0);
  22.  
  23. if(status != RTEMS_SUCCESSFUL) {
  24. printk("failed with %d\n", status);
  25. }
  26. }
  27.  
  28. rtems_task hello_world(__attribute__((unused)) rtems_task_argument argument)
  29. {
  30. exti_task_id = rtems_task_self();
  31. task_config_drivers();
  32.  
  33. struct exti_driver *exti = get_driver_from_list(EXTI_TEST);
  34. exti_driver_config(exti, NULL);
  35.  
  36. rtems_status_code status;
  37. const char *exti_test_msg = "exti test";
  38.  
  39. status = rtems_interrupt_handler_install(
  40. (rtems_vector_number) EXTI15_10_IRQn,
  41. exti_test_msg,
  42. RTEMS_INTERRUPT_UNIQUE,
  43. (rtems_interrupt_handler) EXTI15_10_IRQHandler,
  44. NULL);
  45.  
  46. if (status != RTEMS_SUCCESSFUL) {
  47. printk("interrupt handler install 2 failed with %d\n", status);
  48. }
  49.  
  50. exti->irq_en(exti);
  51.  
  52. while(true) {
  53. printf("%d\n", __LINE__);
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment