2020-11-30 13:13:08 +08:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (c) 2014 - 2020 Xilinx, Inc. All rights reserved.
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @file xil_io.h
|
|
|
|
*
|
|
|
|
* @addtogroup common_io_interfacing_apis Register IO interfacing APIs
|
|
|
|
*
|
|
|
|
* The xil_io.h file contains the interface for the general I/O component, which
|
|
|
|
* encapsulates the Input/Output functions for the processors that do not
|
|
|
|
* require any special I/O handling.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
* <pre>
|
|
|
|
* MODIFICATION HISTORY:
|
|
|
|
*
|
|
|
|
* Ver Who Date Changes
|
|
|
|
* ----- -------- -------- -----------------------------------------------
|
2021-05-14 14:22:23 +08:00
|
|
|
* 5.00 pkp 05/29/14 First release
|
2020-11-30 13:13:08 +08:00
|
|
|
* 6.00 mus 08/19/16 Remove checking of __LITTLE_ENDIAN__ flag for
|
|
|
|
* ARM processors
|
|
|
|
* 7.20 har 01/03/20 Added Xil_SecureOut32 for avoiding blindwrite for
|
|
|
|
* CR-1049218
|
|
|
|
* </pre>
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef XIL_IO_H /* prevent circular inclusions */
|
|
|
|
#define XIL_IO_H /* by using protection macros */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/***************************** Include Files *********************************/
|
|
|
|
|
|
|
|
#include "xil_types.h"
|
|
|
|
#include "xil_printf.h"
|
|
|
|
#include "xstatus.h"
|
|
|
|
|
|
|
|
#if defined (__GNUC__) || defined (__ICCARM__) || defined (__MICROBLAZE__)
|
|
|
|
#define INLINE inline
|
|
|
|
#else
|
|
|
|
#define INLINE __inline
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an input operation for a memory location by reading
|
|
|
|
* from the specified address and returning the 8 bit Value read from
|
|
|
|
* that address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr: contains the address to perform the input operation
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return The 8 bit Value read from the specified input address.
|
2020-11-30 13:13:08 +08:00
|
|
|
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE u8 Xil_In8(UINTPTR Addr)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
return *(volatile u8 *) Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an input operation for a memory location by reading from
|
|
|
|
* the specified address and returning the 16 bit Value read from that
|
|
|
|
* address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr: contains the address to perform the input operation
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return The 16 bit Value read from the specified input address.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE u16 Xil_In16(UINTPTR Addr)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
return *(volatile u16 *) Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an input operation for a memory location by
|
|
|
|
* reading from the specified address and returning the 32 bit Value
|
|
|
|
* read from that address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr: contains the address to perform the input operation
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return The 32 bit Value read from the specified input address.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE u32 Xil_In32(UINTPTR Addr)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
return *(volatile u32 *) Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an input operation for a memory location by reading the
|
|
|
|
* 64 bit Value read from that address.
|
|
|
|
*
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr: contains the address to perform the input operation
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return The 64 bit Value read from the specified input address.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE u64 Xil_In64(UINTPTR Addr)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
return *(volatile u64 *) Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an output operation for an memory location by
|
|
|
|
* writing the 8 bit Value to the the specified address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr: contains the address to perform the output operation
|
|
|
|
* @param Value: contains the 8 bit Value to be written at the specified
|
2020-11-30 13:13:08 +08:00
|
|
|
* address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return None.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE void Xil_Out8(UINTPTR Addr, u8 Value)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
volatile u8 *LocalAddr = (volatile u8 *)Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
*LocalAddr = Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an output operation for a memory location by writing the
|
|
|
|
* 16 bit Value to the the specified address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr contains the address to perform the output operation
|
|
|
|
* @param Value contains the Value to be written at the specified address.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return None.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE void Xil_Out16(UINTPTR Addr, u16 Value)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
volatile u16 *LocalAddr = (volatile u16 *)Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
*LocalAddr = Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an output operation for a memory location by writing the
|
|
|
|
* 32 bit Value to the the specified address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr contains the address to perform the output operation
|
|
|
|
* @param Value contains the 32 bit Value to be written at the specified
|
2020-11-30 13:13:08 +08:00
|
|
|
* address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return None.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE void Xil_Out32(UINTPTR Addr, u32 Value)
|
|
|
|
{
|
|
|
|
#ifndef ENABLE_SAFETY
|
2021-05-14 14:22:23 +08:00
|
|
|
volatile u32 *LocalAddr = (volatile u32 *)Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
*LocalAddr = Value;
|
|
|
|
#else
|
2021-05-14 14:22:23 +08:00
|
|
|
XStl_RegUpdate(Addr, Value);
|
2020-11-30 13:13:08 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Performs an output operation for a memory location by writing the
|
|
|
|
* 64 bit Value to the the specified address.
|
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @param Addr contains the address to perform the output operation
|
|
|
|
* @param Value contains 64 bit Value to be written at the specified address.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
2021-05-14 14:22:23 +08:00
|
|
|
* @return None.
|
2020-11-30 13:13:08 +08:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
static INLINE void Xil_Out64(UINTPTR Addr, u64 Value)
|
|
|
|
{
|
2021-05-14 14:22:23 +08:00
|
|
|
volatile u64 *LocalAddr = (volatile u64 *)Addr;
|
2020-11-30 13:13:08 +08:00
|
|
|
*LocalAddr = Value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* end of protection macro */
|
|
|
|
/**
|
|
|
|
* @} End of "addtogroup common_io_interfacing_apis".
|
|
|
|
*/
|