osc.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef __OSC_H__
  2. #define __OSC_H__
  3. #include "hal.h"
  4. #define OVLY_SEG(NAME) __attribute__((section(#NAME)))
  5. /*
  6. TYPES OF GENERAL EXCEPTION
  7. */
  8. #define GE_ALIGN_CHECK 0
  9. #define GE_RESERVED_INST 1
  10. #define GE_TRAP 2
  11. #define GE_ARITHMETIC 3
  12. #define GE_PRECISE_BUS_ERR 4
  13. #define GE_INPRECISE_BUS_ERR 5
  14. #define GE_COPROCESSOR 6
  15. #define GE_PRIVILEGE_INST 7
  16. #define GE_RESERVED_VALUE 8
  17. #define GE_NON_EXIST_LOCAL_MEM 9
  18. #define GE_MPZIU_CTRL 10
  19. /*
  20. structure of overlay control registers
  21. Please define this structure based on your hardware design
  22. */
  23. typedef struct
  24. {
  25. unsigned int reserved ;
  26. unsigned int root_size ;
  27. unsigned int base_addr ;
  28. unsigned int end_addr ;
  29. volatile unsigned int dma ;
  30. } OVLY_REGS ;
  31. typedef struct
  32. {
  33. unsigned long vma;
  34. unsigned long size;
  35. unsigned long lma;
  36. unsigned long mapped;
  37. } OVLY_TABLE ;
  38. typedef struct
  39. {
  40. unsigned int ipc;
  41. OVLY_REGS *povl;
  42. } OVL_CTRL;
  43. typedef struct {
  44. hal_queue_t queue;
  45. hal_thread_t th;
  46. OVL_CTRL povl_ctrl;
  47. } OSC_DRV_INFO;
  48. /* _novlys from overlay table in linker script stands for number of overlay regions. */
  49. extern int _novlys;
  50. extern OVLY_TABLE _ovly_table[] ;
  51. extern char __ovly_lmastart_OVL_RAM;
  52. static volatile int overlay_busy = 0;
  53. void __attribute__((no_prologue)) osc_init();
  54. int _osc_drv_init(void (*handler)(unsigned int ipc),
  55. void (*osc_hisr)(void *arg),
  56. OSC_DRV_INFO *osc_info);
  57. #ifdef CONFIG_OSC_DEBUG_SUPPORT
  58. #define OVLY_DEBUG
  59. #endif
  60. #endif