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