]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/uio-test-pruss.git/blob - uio_test_pru.asm
Add support for am43xx
[processor-sdk/uio-test-pruss.git] / uio_test_pru.asm
1 ;*
2 ;*
3 ;* Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
4 ;*
5 ;*
6 ;*  Redistribution and use in source and binary forms, with or without
7 ;*  modification, are permitted provided that the following conditions
8 ;*  are met:
9 ;*
10 ;*    Redistributions of source code must retain the above copyright
11 ;*    notice, this list of conditions and the following disclaimer.
12 ;*
13 ;*    Redistributions in binary form must reproduce the above copyright
14 ;*    notice, this list of conditions and the following disclaimer in the 
15 ;*    documentation and/or other materials provided with the
16 ;*    distribution.
17 ;*
18 ;*    Neither the name of Texas Instruments Incorporated nor the names of
19 ;*    its contributors may be used to endorse or promote products derived
20 ;*    from this software without specific prior written permission.
21 ;*
22 ;*
23 ;*
24 ;*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 ;*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 ;*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS OR
27 ;*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 ;*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 ;*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 ;*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 ;*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 ;*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 ;*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 ;*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 ;*
37         .if PRUSS_V2 = 1
38 ARM_PRU0_EVENT  .set 16
39 PRU0_ARM_EVENT  .set 17
40 ARM_PRU1_EVENT  .set 18
41 PRU1_ARM_EVENT  .set 19
42         .else
43 ARM_PRU0_EVENT  .set 32 
44 PRU0_ARM_EVENT  .set 33
45 ARM_PRU1_EVENT  .set 34
46 PRU1_ARM_EVENT  .set 35
47         .endif
49 MOV32   .macro dst, src
50         LDI     dst.w0, src & 0xFFFF
51         LDI     dst.w2, src >> 16
52         .endm
54         .def ARM_TO_PRU_INTERRUPT_POLL
55  
56 ARM_TO_PRU_INTERRUPT_POLL:
57 ;  Poll for receipt of interrupt on host 0
58         .if CORE_PRU = 0
59         QBBS      EVENT, R31, 30
60         .endif
61         .if CORE_PRU = 1
62         QBBS      EVENT, R31, 31
63         .endif
64         JMP       ARM_TO_PRU_INTERRUPT_POLL
66 EVENT:
67 ; Clear system event in SECR1/2
68         MOV32   r0, 0
69 ; Send notification to Host for program completion
70         .if PRUSS_V2 = 1
71         LDI     r3.w0, 0x280 ; SECR1
72         .if     CORE_PRU = 0
73         SET     r0, r0, ARM_PRU0_EVENT
74         LDI     R31.b0, PRU0_ARM_EVENT+16
75         .endif
76         .if     CORE_PRU = 1
77         SET     r0, r0, ARM_PRU1_EVENT
78         LDI     R31.b0, PRU1_ARM_EVENT+16
79         .endif
80         .else
81         LDI     r3.w0, 0x284 ; SECR2
82         .if     CORE_PRU = 0
83         SET     r0, r0, ARM_PRU0_EVENT-32
84         LDI     R31.b0, PRU0_ARM_EVENT
85         .endif
86         .if     CORE_PRU = 1
87         SET     r0, r0, ARM_PRU1_EVENT-32
88         LDI     R31.b0, PRU1_ARM_EVENT
89         .endif
90         .endif
91         SBCO    &r0, C0, r3.w0, 4 
92         QBA ARM_TO_PRU_INTERRUPT_POLL