]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/pdk.git/blob - packages/ti/drv/emac/firmware/icss_dualmac/src/xfr2vbus_widget.h
Merge pull request #19 in PROCESSOR-SDK/pdk from prsdk-7325 to master
[processor-sdk/pdk.git] / packages / ti / drv / emac / firmware / icss_dualmac / src / xfr2vbus_widget.h
1 ;
2 ;  TEXAS INSTRUMENTS TEXT FILE LICENSE
3 ;
4 ;   Copyright (c) 2018-2019 Texas Instruments Incorporated
5 ;
6 ;  All rights reserved not granted herein.
7 ;
8 ;  Limited License.
9 ;
10 ;  Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive
11 ;  license under copyrights and patents it now or hereafter owns or controls to
12 ;  make, have made, use, import, offer to sell and sell ("Utilize") this software
13 ;  subject to the terms herein.  With respect to the foregoing patent license,
14 ;  such license is granted  solely to the extent that any such patent is necessary
15 ;  to Utilize the software alone.  The patent license shall not apply to any
16 ;  combinations which include this software, other than combinations with devices
17 ;  manufactured by or for TI (“TI Devices”).  No hardware patent is licensed hereunder.
18 ;
19 ;  Redistributions must preserve existing copyright notices and reproduce this license
20 ;  (including the above copyright notice and the disclaimer and (if applicable) source
21 ;  code license limitations below) in the documentation and/or other materials provided
22 ;  with the distribution.
23 ;
24 ;  Redistribution and use in binary form, without modification, are permitted provided
25 ;  that the following conditions are met:
26 ;       No reverse engineering, decompilation, or disassembly of this software is
27 ;   permitted with respect to any software provided in binary form.
28 ;       Any redistribution and use are licensed by TI for use only with TI Devices.
29 ;       Nothing shall obligate TI to provide you with source code for the software
30 ;   licensed and provided to you in object code.
31 ;
32 ;  If software source code is provided to you, modification and redistribution of the
33 ;  source code are permitted provided that the following conditions are met:
34 ;       Any redistribution and use of the source code, including any resulting derivative
35 ;   works, are licensed by TI for use only with TI Devices.
36 ;       Any redistribution and use of any object code compiled from the source code
37 ;   and any resulting derivative works, are licensed by TI for use only with TI Devices.
38 ;
39 ;  Neither the name of Texas Instruments Incorporated nor the names of its suppliers
40 ;  may be used to endorse or promote products derived from this software without
41 ;  specific prior written permission.
42 ;
43 ;  DISCLAIMER.
44 ;
45 ;  THIS SOFTWARE IS PROVIDED BY TI AND TI’S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED
46 ;  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
47 ;  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI’S
48 ;  LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
49 ;  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
50 ;  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
51 ;  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 ;  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
53 ;  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
55 ;------------------------------------
56 ;FILE: xfr2vbus_widget.h
57 ;Purpose:  macros, etc for xfr2vbus_widget
58 ;------------------------------------
60 ;-----------------DEFINES-------------------------
62 ;XIDs
63 XFR2VBUS_XID_READ0      .set    0x60
64 XFR2VBUS_XID_READ1      .set    0x61
65 XFR2VBUS_XID_WRITE      .set    0x62
66 XFR2VBUS_XID_WRITE0     .set    0x62
67 XFR2VBUS_XID_WRITE1     .set    0x63
69         .asg    t2, XFR2VBUS_READ_DONE  ;set if read fifo non empty
70 ;------------------MACROS--------------------------
71 ;read in read result (32)
72 XFR2VBUS_READ32_RESULT  .macro   rnum
73         xin     rnum, &r2, 32
74  .endm
76 ;issue a oneshot read of 32 bytes from addrss _lo|_hi
77 ; steps on r18, r19,r20
78 XFR2VBUS_ISSUE_READ_ONESHOT_32  .macro   rnum, addr_lo,addr_hi
79         and r20, addr_hi, addr_hi;Warning: converted from mov
80         and r19, addr_lo, addr_lo;Warning: converted from mov
81         ldi     r18, 0x4; [1.2] = 2 => 32 bytes
82         add     r0, r0, 0;nop - see instability inr18   ..
83         xout    rnum, &r18, 12
84  .endm
85 ;poll for read complete
86 ;returns in r18.tb2 the result
87 XFR2VBUS_POLL_READ      .macro   rnum
88         xin     rnum, &r18, 4
89  .endm
91 ;issue a read of 64 bytes from addrss _lo|_hi, auto mode
92 ;clobbers r18-r20
93 XFR2VBUS_ISSUE_READ_AUTO_64_CMD .macro   rnum, addr_lo,addr_hi
94         ldi     r20, addr_hi
95         and r19, addr_lo, addr_lo
96         ldi     r18, 0x7;(0x1 | 0x3>>1)
97         xout    rnum, &r18, 12
98  .endm
100 ;issue cmd to stop read auto mode
101 XFR2VBUS_CANCEL_READ_AUTO_64_CMD        .macro   rnum
102         ldi     r18, 0
103         xout    rnum, &r18, 4
104  .endm
106 ;read in data64
107 ; fills in r2-r17
108 XFR2VBUS_READ64_RESULT  .macro   rnum
109         xin     rnum, &r2, 64
110  .endm
112 XFR2VBUS_WAIT4READY .macro rnum
113 $1:     xin     rnum, &r18, 4
114         qbne    $1, r18.w0, 0x5
115  .endm
117 ;read in data8
118 ; fills in r2-r3
119 XFR2VBUS_READ8_RESULT   .macro   rnum
120         xin     rnum, &r2, 8
121  .endm
123 ;issue a write of 32 bytes from address _lo|_hi, one shot
124 ; data in r2-r9
125 ; clobbers r10, r11
126 XFR2VBUS_WRITE32        .macro   xid, addr_lo,addr_hi
127         and r10, addr_lo, addr_lo;Warning: converted from mov
128         and r11, addr_hi, addr_hi;Warning: converted from mov
129         xout    xid, &r2, 40
130  .endm