boot_irq.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _BOOT_IRQ_H_
  13. #define _BOOT_IRQ_H_
  14. #include <stdint.h>
  15. #include <stdbool.h>
  16. #include <stddef.h>
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /**
  21. * \brief function type of irq handler
  22. */
  23. typedef void (*bootIrqHandler_t)(void *ctx);
  24. /**
  25. * \brief enable interrupt
  26. */
  27. void bootEnableInterrupt(void);
  28. /**
  29. * \brief disable interrupt
  30. *
  31. * If interrupt is enabled in bootloader, it is needed to disable interrupt
  32. * before jump to the application.
  33. */
  34. void bootDisableInterrupt(void);
  35. /**
  36. * \brief enable specified IRQ
  37. *
  38. * \param irqn IRQ number
  39. * \param prio IRQ priority
  40. */
  41. void bootEnableIrq(uint32_t irqn, uint32_t prio);
  42. /**
  43. * \brief disable specified IRQ
  44. *
  45. * Before bootloader jumps to application, all enabled IRQ should be disabled.
  46. *
  47. * \param irqn IRQ number
  48. */
  49. void bootDisableIrq(uint32_t irqn);
  50. /**
  51. * \brief set irq handler
  52. *
  53. * \param irqn IRQ number
  54. * \param handler IRQ handler
  55. * \param ctx IRQ handler context pointer
  56. * \return
  57. * - true on success
  58. * - false on invalid parameters
  59. */
  60. void bootIrqSetHandler(uint32_t irqn, bootIrqHandler_t handler, void *ctx);
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif