You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
6.8 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /* --------------------------------------------------------------------------
  2. FILE : pru.h
  3. PROJECT : DA8xx/OMAP-L138/C674x PRU Development
  4. DESC : PRU Load and Run API Definitions
  5. ----------------------------------------------------------------------------- */
  6. #ifndef _PRU_H_
  7. #define _PRU_H_
  8. #include "tistdtypes.h"
  9. #include "csl/cslr_prucore.h"
  10. // Prevent C++ name mangling
  11. #ifdef __cplusplus
  12. extern far "c" {
  13. #endif
  14. #define PRU_NUM0 (0)
  15. #define PRU_NUM1 (1)
  16. /***********************************************************
  17. * Global Macro Declarations *
  18. ***********************************************************/
  19. // PRU Memory Macros
  20. #define PRU0_DATA_RAM_START (0x01C30000)
  21. #define PRU0_PROG_RAM_START (0x01C38000)
  22. #define PRU1_DATA_RAM_START (0x01C32000)
  23. #define PRU1_PROG_RAM_START (0x01C3C000)
  24. #define PRU_DATA_RAM_SIZE (0x200)
  25. #define PRU_PROG_RAM_SIZE (0x1000)
  26. #define PRU_PRU0_BASE_ADDRESS 0
  27. #define PRU_INTC_BASE_ADDRESS (PRU_PRU0_BASE_ADDRESS + 0x4000)
  28. #define PRU_INTC_REVID (PRU_INTC_BASE_ADDRESS + 0)
  29. #define PRU_INTC_CONTROL (PRU_INTC_BASE_ADDRESS + 0x4)
  30. #define PRU_INTC_GLBLEN (PRU_INTC_BASE_ADDRESS + 0x10)
  31. #define PRU_INTC_GLBLNSTLVL (PRU_INTC_BASE_ADDRESS + 0x1C)
  32. #define PRU_INTC_STATIDXSET (PRU_INTC_BASE_ADDRESS + 0x20)
  33. #define PRU_INTC_STATIDXCLR (PRU_INTC_BASE_ADDRESS + 0x24)
  34. #define PRU_INTC_ENIDXSET (PRU_INTC_BASE_ADDRESS + 0x28)
  35. #define PRU_INTC_ENIDXCLR (PRU_INTC_BASE_ADDRESS + 0x2C)
  36. #define PRU_INTC_HSTINTENIDXSET (PRU_INTC_BASE_ADDRESS + 0x34)
  37. #define PRU_INTC_HSTINTENIDXCLR (PRU_INTC_BASE_ADDRESS + 0x38)
  38. #define PRU_INTC_GLBLPRIIDX (PRU_INTC_BASE_ADDRESS + 0x80)
  39. #define PRU_INTC_STATSETINT0 (PRU_INTC_BASE_ADDRESS + 0x200)
  40. #define PRU_INTC_STATSETINT1 (PRU_INTC_BASE_ADDRESS + 0x204)
  41. #define PRU_INTC_STATCLRINT0 (PRU_INTC_BASE_ADDRESS + 0x280)
  42. #define PRU_INTC_STATCLRINT1 (PRU_INTC_BASE_ADDRESS + 0x284)
  43. #define PRU_INTC_ENABLESET0 (PRU_INTC_BASE_ADDRESS + 0x300)
  44. #define PRU_INTC_ENABLESET1 (PRU_INTC_BASE_ADDRESS + 0x304)
  45. #define PRU_INTC_ENABLECLR0 (PRU_INTC_BASE_ADDRESS + 0x380)
  46. #define PRU_INTC_ENABLECLR1 (PRU_INTC_BASE_ADDRESS + 0x384)
  47. #define PRU_INTC_CHANMAP0 (PRU_INTC_BASE_ADDRESS + 0x400)
  48. #define PRU_INTC_CHANMAP1 (PRU_INTC_BASE_ADDRESS + 0x404)
  49. #define PRU_INTC_CHANMAP2 (PRU_INTC_BASE_ADDRESS + 0x408)
  50. #define PRU_INTC_CHANMAP3 (PRU_INTC_BASE_ADDRESS + 0x40C)
  51. #define PRU_INTC_CHANMAP4 (PRU_INTC_BASE_ADDRESS + 0x410)
  52. #define PRU_INTC_CHANMAP5 (PRU_INTC_BASE_ADDRESS + 0x414)
  53. #define PRU_INTC_CHANMAP6 (PRU_INTC_BASE_ADDRESS + 0x418)
  54. #define PRU_INTC_CHANMAP7 (PRU_INTC_BASE_ADDRESS + 0x41C)
  55. #define PRU_INTC_CHANMAP8 (PRU_INTC_BASE_ADDRESS + 0x420)
  56. #define PRU_INTC_CHANMAP9 (PRU_INTC_BASE_ADDRESS + 0x424)
  57. #define PRU_INTC_CHANMAP10 (PRU_INTC_BASE_ADDRESS + 0x428)
  58. #define PRU_INTC_CHANMAP11 (PRU_INTC_BASE_ADDRESS + 0x42C)
  59. #define PRU_INTC_CHANMAP12 (PRU_INTC_BASE_ADDRESS + 0x430)
  60. #define PRU_INTC_CHANMAP13 (PRU_INTC_BASE_ADDRESS + 0x434)
  61. #define PRU_INTC_CHANMAP14 (PRU_INTC_BASE_ADDRESS + 0x438)
  62. #define PRU_INTC_CHANMAP15 (PRU_INTC_BASE_ADDRESS + 0x43C)
  63. #define PRU_INTC_HOSTMAP0 (PRU_INTC_BASE_ADDRESS + 0x800)
  64. #define PRU_INTC_HOSTMAP1 (PRU_INTC_BASE_ADDRESS + 0x804)
  65. #define PRU_INTC_HOSTMAP2 (PRU_INTC_BASE_ADDRESS + 0x808)
  66. #define PRU_INTC_HOSTINTPRIIDX0 (PRU_INTC_BASE_ADDRESS + 0x900)
  67. #define PRU_INTC_HOSTINTPRIIDX1 (PRU_INTC_BASE_ADDRESS + 0x904)
  68. #define PRU_INTC_HOSTINTPRIIDX2 (PRU_INTC_BASE_ADDRESS + 0x908)
  69. #define PRU_INTC_HOSTINTPRIIDX3 (PRU_INTC_BASE_ADDRESS + 0x90C)
  70. #define PRU_INTC_HOSTINTPRIIDX4 (PRU_INTC_BASE_ADDRESS + 0x910)
  71. #define PRU_INTC_HOSTINTPRIIDX5 (PRU_INTC_BASE_ADDRESS + 0x914)
  72. #define PRU_INTC_HOSTINTPRIIDX6 (PRU_INTC_BASE_ADDRESS + 0x918)
  73. #define PRU_INTC_HOSTINTPRIIDX7 (PRU_INTC_BASE_ADDRESS + 0x91C)
  74. #define PRU_INTC_HOSTINTPRIIDX8 (PRU_INTC_BASE_ADDRESS + 0x920)
  75. #define PRU_INTC_HOSTINTPRIIDX9 (PRU_INTC_BASE_ADDRESS + 0x924)
  76. #define PRU_INTC_POLARITY0 (PRU_INTC_BASE_ADDRESS + 0xD00)
  77. #define PRU_INTC_POLARITY1 (PRU_INTC_BASE_ADDRESS + 0xD04)
  78. #define PRU_INTC_TYPE0 (PRU_INTC_BASE_ADDRESS + 0xD80)
  79. #define PRU_INTC_TYPE1 (PRU_INTC_BASE_ADDRESS + 0xD84)
  80. #define PRU_INTC_HOSTINTNSTLVL0 (PRU_INTC_BASE_ADDRESS + 0x1100)
  81. #define PRU_INTC_HOSTINTNSTLVL1 (PRU_INTC_BASE_ADDRESS + 0x1104)
  82. #define PRU_INTC_HOSTINTNSTLVL2 (PRU_INTC_BASE_ADDRESS + 0x1108)
  83. #define PRU_INTC_HOSTINTNSTLVL3 (PRU_INTC_BASE_ADDRESS + 0x110C)
  84. #define PRU_INTC_HOSTINTNSTLVL4 (PRU_INTC_BASE_ADDRESS + 0x1110)
  85. #define PRU_INTC_HOSTINTNSTLVL5 (PRU_INTC_BASE_ADDRESS + 0x1114)
  86. #define PRU_INTC_HOSTINTNSTLVL6 (PRU_INTC_BASE_ADDRESS + 0x1118)
  87. #define PRU_INTC_HOSTINTNSTLVL7 (PRU_INTC_BASE_ADDRESS + 0x111C)
  88. #define PRU_INTC_HOSTINTNSTLVL8 (PRU_INTC_BASE_ADDRESS + 0x1120)
  89. #define PRU_INTC_HOSTINTNSTLVL9 (PRU_INTC_BASE_ADDRESS + 0x1124)
  90. #define PRU_INTC_HOSTINTEN (PRU_INTC_BASE_ADDRESS + 0x1500)
  91. /* Macros defining some PRU specific constants. */
  92. #define PRU_INTC_HOSTINTLVL_MAX 9
  93. /*
  94. *====================
  95. * Typedef structures
  96. *====================
  97. */
  98. typedef struct arm_pru_iomap {
  99. void *pru_io_addr;
  100. void *mcasp_io_addr;
  101. void *psc0_io_addr;
  102. void *psc1_io_addr;
  103. void *syscfg_io_addr;
  104. void *pFifoBufferPhysBase;
  105. void *pFifoBufferVirtBase;
  106. } arm_pru_iomap;
  107. /***********************************************************
  108. * Global Function Declarations *
  109. ***********************************************************/
  110. extern __FAR__ Uint32 pru_enable(Uint8 pruNum,
  111. arm_pru_iomap * pru_arm_iomap);
  112. extern __FAR__ Uint32 pru_load(Uint8 pruNum, Uint32 * pruCode,
  113. Uint32 codeSizeInWords,
  114. arm_pru_iomap * pru_arm_iomap);
  115. extern __FAR__ Uint32 pru_run(Uint8 pruNum,
  116. arm_pru_iomap * pru_arm_iomap);
  117. extern __FAR__ Uint32 pru_waitForHalt(Uint8 pruNum, Int32 timeout,
  118. arm_pru_iomap * pru_arm_iomap);
  119. extern __FAR__ Uint32 pru_disable(arm_pru_iomap * pru_arm_iomap);
  120. short pru_ram_write_data(Uint32 u32offset, Uint8 * pu8datatowrite,
  121. Uint16 u16wordstowrite,
  122. arm_pru_iomap * pru_arm_iomap);
  123. short pru_ram_read_data(Uint32 u32offset, Uint8 * pu8datatoread,
  124. Uint16 u16wordstoread,
  125. arm_pru_iomap * pru_arm_iomap);
  126. short pru_ram_read_data_4byte(unsigned int u32offset,
  127. unsigned int *pu32datatoread,
  128. short u16wordstoread);
  129. short pru_ram_write_data_4byte(unsigned int u32offset,
  130. unsigned int *pu32datatoread,
  131. short u16wordstoread);
  132. /***********************************************************
  133. * End file *
  134. ***********************************************************/
  135. #ifdef __cplusplus
  136. }
  137. #endif
  138. #endif // End _PRU_H_