• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2 * Copyright (C) 2018 Cadence Design Systems, Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to use this Software with Cadence processor cores only and
7 * not with any other processors and platforms, subject to
8 * the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 
21 ******************************************************************************/
22 
23 /*******************************************************************************
24  * xf-sys.h
25  *
26  * Definitions for Xtensa SHMEM configuration
27  *
28  *******************************************************************************/
29 
30 #ifndef __XF_H
31 #error "xf-sys.h mustn't be included directly"
32 #endif
33 
34 /*******************************************************************************
35  * Standard system includes
36  ******************************************************************************/
37 
38 /* ...from directory ./board-BOARDNAME */
39 #include "xf-board.h"
40 
41 /*******************************************************************************
42  * Global abstractions
43  ******************************************************************************/
44 
45 /* ...prevent instructions reordering */
46 #define barrier()                           \
47     __asm__ __volatile__("": : : "memory")
48 
49 /* ...memory barrier */
50 #define XF_PROXY_BARRIER()                  \
51     __asm__ __volatile__("memw": : : "memory")
52 
53 /* ...memory invalidation */
54 #define XF_PROXY_INVALIDATE(buf, length)    \
55     ({ if ((length)) { xthal_dcache_region_invalidate((buf), (length)); barrier(); } buf; })
56 
57 /* ...memory flushing */
58 #define XF_PROXY_FLUSH(buf, length)         \
59     ({ if ((length)) { barrier(); xthal_dcache_region_writeback((buf), (length)); XF_PROXY_BARRIER(); } buf; })
60 
61 /*******************************************************************************
62  * Core-specific data accessor
63  ******************************************************************************/
64 
65 /* ...per-core execution data */
66 extern xf_core_data_t   xf_core_data[XF_CFG_CORES_NUM];
67 
68 /* ...local memory accessor */
69 #define XF_CORE_DATA(core)      (&xf_core_data[core])
70 
71 /*******************************************************************************
72  * Inter-processor communication and shared memory interface definition
73  ******************************************************************************/
74 
75 #include "xf-ipc.h"
76