Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:42

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsShared
0007  *
0008  * @brief This header file provides a minimal shim for Xilinx drivers.
0009  */
0010 
0011 /*
0012  * Copyright (C) 2024 On-Line Applications Research Corporation (OAR)
0013  *
0014  * Redistribution and use in source and binary forms, with or without
0015  * modification, are permitted provided that the following conditions
0016  * are met:
0017  * 1. Redistributions of source code must retain the above copyright
0018  *    notice, this list of conditions and the following disclaimer.
0019  * 2. Redistributions in binary form must reproduce the above copyright
0020  *    notice, this list of conditions and the following disclaimer in the
0021  *    documentation and/or other materials provided with the distribution.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0033  * POSSIBILITY OF SUCH DAMAGE.
0034  */
0035 
0036 #ifndef LIBBSP_SHARED_XIL_COMPAT_COMMON_H
0037 #define LIBBSP_SHARED_XIL_COMPAT_COMMON_H
0038 #include <stdint.h>
0039 typedef uint8_t u8;
0040 typedef int8_t s8;
0041 typedef uint16_t u16;
0042 typedef uint32_t u32;
0043 typedef int32_t s32;
0044 typedef uint64_t u64;
0045 typedef intptr_t INTPTR;
0046 typedef uintptr_t UINTPTR;
0047 #define INLINE inline
0048 
0049 #define XST_SUCCESS 0
0050 #define XST_FAILURE 1
0051 #define XST_DEVICE_IS_STARTED 5
0052 #define XST_DEVICE_BUSY 21
0053 #define XST_FLASH_TIMEOUT_ERROR 1134
0054 #define XST_SPI_TRANSFER_DONE 1152
0055 #define XST_SPI_COMMAND_ERROR 1162
0056 #define XST_SPI_POLL_DONE 1163
0057 
0058 #include <rtems/score/assert.h>
0059 #define Xil_AssertNonvoid(expr) _Assert(expr);
0060 #define Xil_AssertVoid(expr) _Assert(expr);
0061 #define Xil_AssertVoidAlways() _Assert(false);
0062 
0063 #include <stdio.h>
0064 #define xil_printf(args...) printf(args)
0065 
0066 #define XIL_COMPONENT_IS_READY 0x1U
0067 
0068 #include <string.h>
0069 #define Xil_MemCpy(dest, src, count) memcpy(dest, src, count)
0070 
0071 static inline uint32_t Xil_In32(uintptr_t addr)
0072 {
0073   return *(volatile uint32_t *) addr;
0074 }
0075 
0076 static inline void Xil_Out32(uintptr_t addr, uint32_t value)
0077 {
0078   *(volatile uint32_t *)addr = value;
0079 }
0080 
0081 #include <rtems/rtems/cache.h>
0082 #define Xil_DCacheInvalidateRange(addr, len) \
0083   rtems_cache_flush_multiple_data_lines((void*)addr, len); \
0084   rtems_cache_invalidate_multiple_data_lines((void*)addr, len)
0085 #define Xil_DCacheFlushRange(addr, len) \
0086   rtems_cache_flush_multiple_data_lines((void*)addr, len)
0087 
0088 #include <unistd.h>
0089 #include <bspopts.h>
0090 
0091 #endif