1 /******************************************************************************
3 * Copyright (C) 2007 - 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /*****************************************************************************/
35 * @addtogroup cpu_v2_3
38 * This file contains macros for interfacing to the Fast Simplex Link (FSL)
42 * MODIFICATION HISTORY:
44 * Ver Who Date Changes
45 * ----- ---- -------- ---------------------------------------------------
46 * 1.00a ecm 06/20/07 Initial version, moved over from bsp area
47 * 1.11c ecm 08/26/08 Fixed the missing 'FSL_DEFAULT' define that was causing
55 ******************************************************************************/
61 /***************************** Include Files *********************************/
67 /************************** Constant Definitions *****************************/
69 /**************************** Type Definitions *******************************/
71 /***************** Macros (Inline Functions) Definitions *********************/
74 /* if these have not been defined already, define here */
77 /* necessary for pre-processor */
78 #define stringify(s) tostring(s)
79 #define tostring(s) #s
81 #endif /* stringify */
83 /* Extended FSL macros. These now replace all of the previous FSL macros */
85 #define FSL_NONBLOCKING n
86 #define FSL_EXCEPTION e
90 #define FSL_NONBLOCKING_EXCEPTION ne
91 #define FSL_NONBLOCKING_CONTROL nc
92 #define FSL_NONBLOCKING_ATOMIC na
93 #define FSL_EXCEPTION_CONTROL ec
94 #define FSL_EXCEPTION_ATOMIC ea
95 #define FSL_CONTROL_ATOMIC ca
97 #define FSL_NONBLOCKING_EXCEPTION_CONTROL nec
98 #define FSL_NONBLOCKING_EXCEPTION_ATOMIC nea
99 #define FSL_NONBLOCKING_CONTROL_ATOMIC nca
100 #define FSL_EXCEPTION_CONTROL_ATOMIC eca
102 #define FSL_NONBLOCKING_EXCEPTION_CONTROL_ATOMIC neca
104 #define getfslx(val, id, flags) asm volatile (stringify(flags) "get\t%0,rfsl" stringify(id) : "=d" (val))
105 #define putfslx(val, id, flags) asm volatile (stringify(flags) "put\t%0,rfsl" stringify(id) :: "d" (val))
107 #define tgetfslx(val, id, flags) asm volatile ("t" stringify(flags) "get\t%0,rfsl" stringify(id) : "=d" (val))
108 #define tputfslx(id, flags) asm volatile ("t" stringify(flags) "put\trfsl" stringify(id))
110 #define getdfslx(val, var, flags) asm volatile (stringify(flags) "getd\t%0,%1" : "=d" (val) : "d" (var))
111 #define putdfslx(val, var, flags) asm volatile (stringify(flags) "putd\t%0,%1" :: "d" (val), "d" (var))
113 #define tgetdfslx(val, var, flags) asm volatile ("t" stringify(flags) "getd\t%0,%1" : "=d" (val) : "d" (var))
114 #define tputdfslx(var, flags) asm volatile ("t" stringify(flags) "putd\t%0" :: "d" (var))
116 /* if the mb_interface.h file has been included already, the following are not needed and will not be defined */
118 /* Legacy FSL Access Macros */
122 /* Blocking Data Read and Write to FSL no. id */
123 #define getfsl(val, id) asm volatile ("get\t%0,rfsl" stringify(id) : "=d" (val))
124 #define putfsl(val, id) asm volatile ("put\t%0,rfsl" stringify(id) :: "d" (val))
126 /* Non-blocking Data Read and Write to FSL no. id */
127 #define ngetfsl(val, id) asm volatile ("nget\t%0,rfsl" stringify(id) : "=d" (val))
128 #define nputfsl(val, id) asm volatile ("nput\t%0,rfsl" stringify(id) :: "d" (val))
130 /* Blocking Control Read and Write to FSL no. id */
131 #define cgetfsl(val, id) asm volatile ("cget\t%0,rfsl" stringify(id) : "=d" (val))
132 #define cputfsl(val, id) asm volatile ("cput\t%0,rfsl" stringify(id) :: "d" (val))
134 /* Non-blocking Control Read and Write to FSL no. id */
135 #define ncgetfsl(val, id) asm volatile ("ncget\t%0,rfsl" stringify(id) : "=d" (val))
136 #define ncputfsl(val, id) asm volatile ("ncput\t%0,rfsl" stringify(id) :: "d" (val))
138 /* Polling versions of FSL access macros. This makes the FSL access interruptible */
139 #define getfsl_interruptible(val, id) asm volatile ("\n1:\n\tnget\t%0,rfsl" stringify(id) "\n\t" \
140 "addic\tr18,r0,0\n\t" \
142 : "=d" (val) :: "r18")
144 #define putfsl_interruptible(val, id) asm volatile ("\n1:\n\tnput\t%0,rfsl" stringify(id) "\n\t" \
145 "addic\tr18,r0,0\n\t" \
147 :: "d" (val) : "r18")
149 #define cgetfsl_interruptible(val, id) asm volatile ("\n1:\n\tncget\t%0,rfsl" stringify(id) "\n\t" \
150 "addic\tr18,r0,0\n\t" \
152 : "=d" (val) :: "r18")
154 #define cputfsl_interruptible(val, id) asm volatile ("\n1:\n\tncput\t%0,rfsl" stringify(id) "\n\t" \
155 "addic\tr18,r0,0\n\t" \
157 :: "d" (val) : "r18")
158 /* FSL valid and error check macros. */
159 #define fsl_isinvalid(result) asm volatile ("addic\t%0,r0,0" : "=d" (result))
160 #define fsl_iserror(error) asm volatile ("mfs\t%0,rmsr\n\t" \
161 "andi\t%0,%0,0x10" : "=d" (error))
163 #endif /* legacy FSL defines */
164 /************************** Function Prototypes ******************************/
166 /************************** Variable Definitions *****************************/