RTEMS 6.1-rc6
Loading...
Searching...
No Matches
xil-compat-common.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2024 On-Line Applications Research Corporation (OAR)
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_SHARED_XIL_COMPAT_COMMON_H
37#define LIBBSP_SHARED_XIL_COMPAT_COMMON_H
38#include <stdint.h>
39typedef uint8_t u8;
40typedef int8_t s8;
41typedef uint16_t u16;
42typedef uint32_t u32;
43typedef int32_t s32;
44typedef uint64_t u64;
45typedef intptr_t INTPTR;
46typedef uintptr_t UINTPTR;
47#define INLINE inline
48
49#define XST_SUCCESS 0
50#define XST_FAILURE 1
51#define XST_DEVICE_IS_STARTED 5
52#define XST_DEVICE_BUSY 21
53#define XST_FLASH_TIMEOUT_ERROR 1134
54#define XST_SPI_TRANSFER_DONE 1152
55#define XST_SPI_COMMAND_ERROR 1162
56#define XST_SPI_POLL_DONE 1163
57
58#include <rtems/score/assert.h>
59#define Xil_AssertNonvoid(expr) _Assert(expr);
60#define Xil_AssertVoid(expr) _Assert(expr);
61#define Xil_AssertVoidAlways() _Assert(false);
62
63#include <stdio.h>
64#define xil_printf(args...) printf(args)
65
66#define XIL_COMPONENT_IS_READY 0x1U
67
68#include <string.h>
69#define Xil_MemCpy(dest, src, count) memcpy(dest, src, count)
70
71static inline uint32_t Xil_In32(uintptr_t addr)
72{
73 return *(volatile uint32_t *) addr;
74}
75
76static inline void Xil_Out32(uintptr_t addr, uint32_t value)
77{
78 *(volatile uint32_t *)addr = value;
79}
80
81#include <rtems/rtems/cache.h>
82#define Xil_DCacheInvalidateRange(addr, len) \
83 rtems_cache_flush_multiple_data_lines((void*)addr, len); \
84 rtems_cache_invalidate_multiple_data_lines((void*)addr, len)
85#define Xil_DCacheFlushRange(addr, len) \
86 rtems_cache_flush_multiple_data_lines((void*)addr, len)
87
88#include <unistd.h>
89#include <bspopts.h>
90
91#endif
This header file provides the interfaces of the Assert Handler.
This header file defines the Cache Manager API.