Standalone
Standalone
Documentation
Chapter 1
Assert APIs/Macros specifies that a application program satisfies certain conditions at particular
points in its execution. These function can be used by application programs to ensure that,
application code is satisfying certain conditions.
void Xil_AssertSetCallback
Xil_AssertCallback Routine
void XNullHandler
void * NullParameter
Functions
Xil_Assert
Implement assert.
Currently, it calls a user-defined callback function if one has been set. Then, it potentially enters
an infinite loop depending on the value of the Xil_AssertWait variable.
Note: None.
Prototype
Parameters
Name Description
File filename of the source
Line linenumber within File
Returns
None.
Xil_AssertSetCallback
Set up a callback function to be invoked when an assert occurs.
Prototype
Parameters
Name Description
Routine callback to be invoked when an assert is taken
Returns
None.
XNullHandler
Null handler function.
This follows the XInterruptHandler signature for interrupt handlers. It can be used to assign a null
handler (a stub) to an interrupt controller vector table.
Note: None.
Prototype
Parameters
Name Description
NullParameter arbitrary void pointer and not used.
Returns
None.
Definitions
#Define Xil_AssertVoid
Description
This in conjunction with the Xil_AssertWait boolean can be used to accommodate tests so that
asserts which fail allow execution to continue.
Parameters
Name Description
Expression expression to be evaluated. If it evaluates to false, the assert occurs.
Returns
Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an
infinite loop is entered.
#Define Xil_AssertNonvoid
Description
This in conjunction with the Xil_AssertWait boolean can be used to accommodate tests so that
asserts which fail allow execution to continue.
Parameters
Name Description
Expression expression to be evaluated. If it evaluates to false, the assert occurs.
Returns
Returns 0 unless the Xil_AssertWait variable is true, in which case no return is made and an
infinite loop is entered.
#Define Xil_AssertVoidAlways
Description
Always assert.
This assert macro is to be used for void functions. Use for instances where an assert should
always occur.
Returns
Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an
infinite loop is entered.
#Define Xil_AssertNonvoidAlways
Description
Always assert.
This assert macro is to be used for functions that do return a value. Use for instances where an
assert should always occur.
Returns
Returns void unless the Xil_AssertWait variable is true, in which case no return is made and an
infinite loop is entered.
Variables
u32 Xil_AssertStatus
This variable allows testing to be done easier with asserts. An assert sets this variable such that a
driver can evaluate this variable to determine if an assert occurred.
s32 Xil_AssertWait
This variable allows the assert functionality to be changed for testing such that it does not wait
infinitely. Use the debugger to disable the waiting during testing of asserts.
INLINE u8 Xil_In8
UINTPTR Addr
u16 Xil_EndianSwap16
u16 Data
Functions
Xil_In16BE
Perform an big-endian input operation for a 16-bit memory location by reading from the
specified address and returning the value read from that address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Returns
The value read from the specified input address with the proper endianness. The return value has
the same endianness as that of the processor. For example, if the processor is little-endian, the
return value is the byte-swapped value read from the address.
Xil_In32BE
Perform a big-endian input operation for a 32-bit memory location by reading from the specified
address and returning the value read from that address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Returns
The value read from the specified input address with the proper endianness. The return value has
the same endianness as that of the processor. For example, if the processor is little-endian, the
return value is the byte-swapped value read from the address.
Xil_Out16BE
Perform a big-endian output operation for a 16-bit memory location by writing the specified
value to the specified address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the output operation.
Value contains the value to be output at the specified address. The value has the same
endianness as that of the processor. For example, if the processor is little-endian, the
byteswapped value is written to the address.
Xil_Out32BE
Perform a big-endian output operation for a 32-bit memory location by writing the specified
value to the specified address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the output operation.
Value contains the value to be output at the specified address. The value has the same
endianness as that of the processor. For example, if the processor is little-endian, the
byteswapped value is written to the address.
Xil_In16LE
Perform a little-endian input operation for a 16-bit memory location by reading from the
specified address and returning the value read from that address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Returns
The value read from the specified input address with the proper endianness. The return value has
the same endianness as that of the processor. For example, if the processor is big-endian, the
return value is the byte-swapped value read from the address.
Xil_In32LE
Perform a little-endian input operation for a 32-bit memory location by reading from the
specified address and returning the value read from that address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Returns
The value read from the specified input address with the proper endianness. The return value has
the same endianness as that of the processor. For example, if the processor is big-endian, the
return value is the byte-swapped value read from the address.
Xil_Out16LE
Perform a little-endian output operation for a 16-bit memory location by writing the specified
value to the specified address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Value contains the value to be output at the specified address. The value has the same
endianness as that of the processor. For example, if the processor is big-endian, the
byteswapped value is written to the address.
Xil_Out32LE
Perform a little-endian output operation for a 32-bit memory location by writing the specified
value to the specified address.
Prototype
Parameters
Name Description
Addr contains the address at which to perform the input operation.
Value contains the value to be output at the specified address. The value has the same
endianness as that of the processor. For example, if the processor is big-endian, the
byteswapped value is written to the address
Xil_In8
Performs an input operation for a memory location by reading from the specified address and
returning the 8 bit Value read from that address.
Prototype
Parameters
Name Description
Addr contains the address to perform the input operation
Returns
Xil_In16
Performs an input operation for a memory location by reading from the specified address and
returning the 16 bit Value read from that address.
Prototype
Parameters
Name Description
Addr contains the address to perform the input operation
Returns
Xil_In32
Performs an input operation for a memory location by reading from the specified address and
returning the 32 bit Value read from that address.
Prototype
Parameters
Name Description
Addr contains the address to perform the input operation
Returns
Xil_In64
Performs an input operation for a memory location by reading the 64 bit Value read from that
address.
Prototype
Parameters
Name Description
Addr contains the address to perform the input operation
Returns
Xil_Out8
Performs an output operation for an memory location by writing the 8 bit Value to the the
specified address.
Prototype
Parameters
Name Description
Addr contains the address to perform the output operation
Value contains the 8 bit Value to be written at the specified address.
Returns
None.
Xil_Out16
Performs an output operation for a memory location by writing the 16 bit Value to the the
specified address.
Prototype
Parameters
Name Description
Addr contains the address to perform the output operation
Value contains the Value to be written at the specified address.
Returns
None.
Xil_Out32
Performs an output operation for a memory location by writing the 32 bit Value to the the
specified address.
Prototype
Parameters
Name Description
Addr contains the address to perform the output operation
Value contains the 32 bit Value to be written at the specified address.
Returns
None.
Xil_Out64
Performs an output operation for a memory location by writing the 64 bit Value to the the
specified address.
Prototype
Parameters
Name Description
Addr contains the address to perform the output operation
Value contains 64 bit Value to be written at the specified address.
Returns
None.
Xil_SecureOut32
Performs an output operation for a memory location by writing the 32 bit Value to the the
specified address and then reading it back to verify the value written in the register.
Prototype
Parameters
Name Description
Addr contains the address to perform the output operation
Value contains 32 bit Value to be written at the specified address
Returns
Returns Status
• XST_SUCCESS on success
• XST_FAILURE on failure
Xil_EndianSwap16
Perform a 16-bit endian conversion.
Prototype
Parameters
Name Description
Data 16-bit value to be converted
Returns
Xil_EndianSwap32
Perform a 32-bit endian conversion.
Prototype
Parameters
Name Description
Data 32-bit value to be converted
Returns
The xplatform_info.h file contains definitions for various available Xilinx platforms.
Also, it contains prototype of APIs, which can be used to get the platform information.
u32 XGet_Zynq_UltraMp_Platform_info
void
u32 XGetPSVersion_Info
void
Functions
XGetPlatform_Info
This API is used to provide information about platform.
Prototype
u32 XGetPlatform_Info();
Returns
XGet_Zynq_UltraMp_Platform_info
This API is used to provide information about zynq ultrascale MP platform.
Prototype
u32 XGet_Zynq_UltraMp_Platform_info();
Returns
XGetPSVersion_Info
This API is used to provide information about PS Silicon version.
Prototype
u32 XGetPSVersion_Info();
Returns
These data types are applicable for all processors supported by Xilinx.
Functions
Xil_MemCpy
This function copies memory from once location to other.
Prototype
Parameters
Name Description
dst pointer pointing to destination memory
src pointer pointing to source memory
cnt 32 bit length of bytes to be copied
The xil_testio.h file contains utility functions to test endian related memory IO functions.
A subset of the memory tests can be selected or all of the tests can be run in order. If there is an
error detected by a subtest, the test stops and the failure code is returned. Further tests are not
run even if all of the tests are selected.
• XIL_TESTMEM_WALKZEROS: Also known as the Walking zero's test. This test uses the
inverse value of the walking ones test as the test value for memory.
location 1 = 0xFFFFFFFE
location 2 = 0xFFFFFFFD
...
• XIL_TESTMEM_INVERSEADDR: Also known as the inverse address test. This test uses the
inverse of the address of the location under test as the test value for memory.
• XIL_TESTMEM_FIXEDPATTERN: Also known as the fixed pattern test. This test uses the
provided patters as the test value for memory. If zero is provided as the pattern the test uses
'0xDEADBEEF".
CAUTION! The tests are DESTRUCTIVE. Run before any initialized memory spaces have been set up. The
address provided to the memory tests is not checked for validity except for the NULL case. It is possible to
provide a code-space pointer for this test to start with and ultimately destroy executable code causing
random failures.
Note: Used for spaces where the address range of the region is smaller than the data width. If the memory
range is greater than 2 ** width, the patterns used in XIL_TESTMEM_WALKONES and
XIL_TESTMEM_WALKZEROS will repeat on a boundary of a power of two making it more difficult to
detect addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR tests
suffer the same problem. Ideally, if large blocks of memory are to be tested, break them up into smaller
regions of memory to allow the test patterns used not to repeat over the region tested.
s32 Xil_TestMem16
u16 * Addr
u32 Words
u16 Pattern
u8 Subtest
u32 RotateLeft
u32 Input
u8 Width
u32 RotateRight
u32 Input
u8 Width
s32 Xil_TestDCacheRange
void
s32 Xil_TestDCacheAll
void
s32 Xil_TestICacheRange
void
s32 Xil_TestICacheAll
void
s32 Xil_TestIO8
u8 * Addr
s32 Length
u8 Value
s32 Xil_TestIO16
u16 * Addr
s32 Length
u16 Value
s32 Kind
s32 Swap
s32 Xil_TestIO32
u32 * Addr
s32 Length
u32 Value
s32 Kind
s32 Swap
Functions
Xil_TestMem32
Perform a destructive 32-bit wide memory test.
Note: Used for spaces where the address range of the region is smaller than the data width. If the memory
range is greater than 2 ** Width, the patterns used in XIL_TESTMEM_WALKONES and
XIL_TESTMEM_WALKZEROS will repeat on a boundary of a power of two making it more difficult to
detect addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR tests
suffer the same problem. Ideally, if large blocks of memory are to be tested, break them up into smaller
regions of memory to allow the test patterns used not to repeat over the region tested.
Prototype
Parameters
Name Description
Addr pointer to the region of memory to be tested.
Words length of the block.
Pattern constant used for the constant pattern test, if 0, 0xDEADBEEF is used.
Subtest test type selected. See xil_testmem.h for possible values.
Returns
Xil_TestMem16
Perform a destructive 16-bit wide memory test.
Note: Used for spaces where the address range of the region is smaller than the data width. If the memory
range is greater than 2 ** Width, the patterns used in XIL_TESTMEM_WALKONES and
XIL_TESTMEM_WALKZEROS will repeat on a boundary of a power of two making it more difficult to
detect addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR tests
suffer the same problem. Ideally, if large blocks of memory are to be tested, break them up into smaller
regions of memory to allow the test patterns used not to repeat over the region tested.
Prototype
Parameters
Name Description
Addr pointer to the region of memory to be tested.
Words length of the block.
Pattern constant used for the constant Pattern test, if 0, 0xDEADBEEF is used.
Subtest type of test selected. See xil_testmem.h for possible values.
Returns
Xil_TestMem8
Perform a destructive 8-bit wide memory test.
Note: Used for spaces where the address range of the region is smaller than the data width. If the memory
range is greater than 2 ** Width, the patterns used in XIL_TESTMEM_WALKONES and
XIL_TESTMEM_WALKZEROS will repeat on a boundary of a power of two making it more difficult to
detect addressing errors. The XIL_TESTMEM_INCREMENT and XIL_TESTMEM_INVERSEADDR tests
suffer the same problem. Ideally, if large blocks of memory are to be tested, break them up into smaller
regions of memory to allow the test patterns used not to repeat over the region tested.
Prototype
Parameters
Name Description
Addr pointer to the region of memory to be tested.
Words length of the block.
Pattern constant used for the constant pattern test, if 0, 0xDEADBEEF is used.
Subtest type of test selected. See xil_testmem.h for possible values.
Returns
RotateLeft
Rotates the provided value to the left one bit position.
Prototype
Parameters
Name Description
Input is value to be rotated to the left
Width is the number of bits in the input data
Returns
RotateRight
Rotates the provided value to the right one bit position.
Prototype
Parameters
Name Description
Input value to be rotated to the right
Width number of bits in the input data
Returns
Xil_TestDCacheRange
Perform DCache range related API test such as Xil_DCacheFlushRange and
Xil_DCacheInvalidateRange.
This test function writes a constant value to the Data array, flushes the range, writes a new
value, then invalidates the corresponding range.
Prototype
s32 Xil_TestDCacheRange(void);
Returns
Xil_TestDCacheAll
Perform DCache all related API test such as Xil_DCacheFlush and Xil_DCacheInvalidate.
This test function writes a constant value to the Data array, flushes the DCache, writes a new
value, then invalidates the DCache.
Prototype
s32 Xil_TestDCacheAll(void);
Returns
Xil_TestICacheRange
Perform Xil_ICacheInvalidateRange() on a few function pointers.
Prototype
s32 Xil_TestICacheRange(void);
Returns
Xil_TestICacheAll
Perform Xil_ICacheInvalidate() on a few function pointers.
Prototype
s32 Xil_TestICacheAll(void);
Returns
Xil_TestIO8
Perform a destructive 8-bit wide register IO test where the register is accessed using Xil_Out8
and Xil_In8, and comparing the written values by reading them back.
Prototype
Parameters
Name Description
Addr a pointer to the region of memory to be tested.
Length Length of the block.
Value constant used for writing the memory.
Returns
Xil_TestIO16
Perform a destructive 16-bit wide register IO test.
Each location is tested by sequentially writing a 16-bit wide register, reading the register, and
comparing value. This function tests three kinds of register IO functions, normal register IO, little-
endian register IO, and big-endian register IO. When testing little/big-endian IO, the function
performs the following sequence, Xil_Out16LE/Xil_Out16BE, Xil_In16, Compare In-Out values,
Xil_Out16, Xil_In16LE/Xil_In16BE, Compare In-Out values. Whether to swap the read-in value
before comparing is controlled by the 5th argument.
Prototype
s32 Xil_TestIO16(u16 *Addr, s32 Length, u16 Value, s32 Kind, s32 Swap);
Parameters
Name Description
Addr a pointer to the region of memory to be tested.
Length Length of the block.
Value constant used for writing the memory.
Kind Type of test. Acceptable values are: XIL_TESTIO_DEFAULT, XIL_TESTIO_LE,
XIL_TESTIO_BE.
Swap indicates whether to byte swap the read-in value.
Returns
Xil_TestIO32
Perform a destructive 32-bit wide register IO test.
Each location is tested by sequentially writing a 32-bit wide register, reading the register, and
comparing value. This function tests three kinds of register IO functions, normal register IO, little-
endian register IO, and big-endian register IO. When testing little/big-endian IO, the function
perform the following sequence, Xil_Out32LE/ Xil_Out32BE, Xil_In32, Compare, Xil_Out32,
Xil_In32LE/Xil_In32BE, Compare. Whether to swap the read-in value *before comparing is
controlled by the 5th argument.
Prototype
s32 Xil_TestIO32(u32 *Addr, s32 Length, u32 Value, s32 Kind, s32 Swap);
Parameters
Name Description
Addr a pointer to the region of memory to be tested.
Length Length of the block.
Value constant used for writing the memory.
Kind type of test. Acceptable values are: XIL_TESTIO_DEFAULT, XIL_TESTIO_LE,
XIL_TESTIO_BE.
Swap indicates whether to byte swap the read-in value.
Returns
Chapter 2
void microblaze_register_exception_handler
u32 ExceptionId
Top
void * DataPtr
Functions
microblaze_register_handler
Registers a top-level interrupt handler for the MicroBlaze.
The argument provided in this call as the DataPtr is used as the argument for the handler when it
is called.
Prototype
Parameters
Name Description
Handler Top level handler.
DataPtr a reference to data that will be passed to the handler when it gets called.
Returns
None.
microblaze_register_exception_handler
Registers an exception handler for the MicroBlaze.
The argument provided in this call as the DataPtr is used as the argument for the handler when it
is called.
Prototype
Parameters
Name Description
ExceptionId is the id of the exception to register this handler for.
Top level handler.
DataPtr is a reference to data that will be passed to the handler when it gets called.
Returns
None.
Application programs can use these APIs for various exception related operations. For example,
enable exception, disable exception, register exception hander.
Note: To use exception related functions, xil_exception.h must be added in source code
void Xil_ExceptionInit
void
void Xil_ExceptionEnable
void
void Xil_ExceptionDisable
void
void Xil_ExceptionRegisterHandler
u32 Id
Xil_ExceptionHandler Handler
void * Data
void Xil_ExceptionRemoveHandler
u32 Id
Functions
Xil_ExceptionNullHandler
This function is a stub handler that is the default handler that gets called if the application has
not setup a handler for a specific exception.
The function interface has to match the interface specified for a handler even though none of the
arguments are used.
Prototype
Parameters
Name Description
Data unused by this function.
Xil_ExceptionInit
Initialize exception handling for the processor.
The exception vector table is setup with the stub handler for all exceptions.
Prototype
void Xil_ExceptionInit(void);
Xil_ExceptionEnable
Enable Exceptions.
Prototype
void Xil_ExceptionEnable(void);
Xil_ExceptionDisable
Disable Exceptions.
Prototype
void Xil_ExceptionDisable(void);
Xil_ExceptionRegisterHandler
Makes the connection between the Id of the exception source and the associated handler that is
to run when the exception is recognized.
The argument provided in this call as the DataPtr is used as the argument for the handler when it
is called.
Prototype
Parameters
Name Description
Id contains the 32 bit ID of the exception source and should be XIL_EXCEPTION_INT or be
in the range of 0 to XIL_EXCEPTION_LAST. See xil_mach_exception.h for further
information.
Handler handler function to be registered for exception
Data a reference to data that will be passed to the handler when it gets called.
Xil_ExceptionRemoveHandler
Removes the handler for a specific exception Id.
Prototype
Parameters
Name Description
Id contains the 32 bit ID of the exception source and should be XIL_EXCEPTION_INT or in
the range of 0 to XIL_EXCEPTION_LAST. See xexception_l.h for further information.
The xil_cache.h file contains cache related driver functions (or macros) that can be used to access
the device.
The user should refer to the hardware device specification for more details of the device
operation. The functions in this header file can be used across all Xilinx supported processors.
void Xil_ICacheDisable
void
Functions
Xil_DCacheDisable
Disable the data cache.
Prototype
void Xil_DCacheDisable(void);
Returns
None.
Xil_ICacheDisable
Disable the instruction cache.
Prototype
void Xil_ICacheDisable(void);
Returns
None.
Definitions
#Define Xil_L1DCacheInvalidate
Description
#Define Xil_L2CacheInvalidate
Description
#Define Xil_L1DCacheInvalidateRange
Description
If the bytes specified by the address (Addr) are cached by the L1 data cache, the cacheline
containing that byte is invalidated.If the cacheline is modified (dirty), the modified contents are
lost.
Parameters
Name Description
Addr is address of range to be invalidated.
Len is the length in bytes to be invalidated.
#Define Xil_L2CacheInvalidateRange
Description
If the bytes specified by the address (Addr) are cached by the L1 data cache, the cacheline
containing that byte is invalidated. If the cacheline is modified (dirty), the modified contents are
lost.
Parameters
Name Description
Addr address of range to be invalidated.
Len length in bytes to be invalidated.
#Define Xil_L1DCacheFlushRange
Description
If the bytes specified by the address (Addr) are cached by the data cache, and is modified (dirty),
the cacheline will be written to system memory.The cacheline will also be invalidated.
Parameters
Name Description
Addr the starting address of the range to be flushed.
Len length in byte to be flushed.
#Define Xil_L2CacheFlushRange
Description
If the bytes specified by the address (Addr) are cached by the data cache, and is modified (dirty),
the cacheline will be written to system memory. The cacheline will also be invalidated.
Parameters
Name Description
Addr the starting address of the range to be flushed.
Len length in byte to be flushed.
#Define Xil_L1DCacheFlush
Description
If any cacheline is dirty, the cacheline will be written to system memory. The entire data cache
will be invalidated.
#Define Xil_L2CacheFlush
Description
If any cacheline is dirty, the cacheline will be written to system memory. The entire data cache
will be invalidated.
#Define Xil_L1ICacheInvalidateRange
Description
Parameters
Name Description
Addr is address of ragne to be invalidated.
Len is the length in bytes to be invalidated.
#Define Xil_L1ICacheInvalidate
Description
#Define Xil_L1DCacheEnable
Description
#Define Xil_L1DCacheDisable
Description
#Define Xil_L1ICacheEnable
Description
#Define Xil_L1ICacheDisable
Description
#Define Xil_DCacheEnable
Description
#Define Xil_ICacheEnable
Description
#Define Xil_DCacheInvalidate
Description
#Define Xil_DCacheInvalidateRange
Description
If the bytes specified by the address (adr) are cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Parameters
Name Description
Addr Start address of range to be invalidated.
Len Length of range to be invalidated in bytes.
#Define Xil_DCacheFlush
Description
#Define Xil_DCacheFlushRange
Description
If the bytes specified by the address (adr) are cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the written to system memory first
before the before the line is invalidated.
Parameters
Name Description
Addr Start address of range to be flushed.
Len Length of range to be flushed in bytes.
#Define Xil_ICacheInvalidate
Description
Definitions
#Define getfslx
Description
Parameters
Name Description
val variable to sink data from get function
id literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define putfslx
Description
Parameters
Name Description
val variable to source data to put function
id literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define tgetfslx
Description
Parameters
Name Description
val variable to sink data from get function
id literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define tputfslx
Description
Parameters
Name Description
id FSL identifier
flags valid FSL macro flags
#Define getdfslx
Description
Parameters
Name Description
val variable to sink data from getd function
var literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define putdfslx
Description
Parameters
Name Description
val variable to source data to putd function
var literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define tgetdfslx
Description
Parameters
Name Description
val variable to sink data from getd function
var literal in the range of 0 to 7 (0 to 15 for MicroBlaze v7.00.a and later)
flags valid FSL macro flags
#Define tputdfslx
Description
Parameters
Name Description
var FSL identifier
flags valid FSL macro flags
1. Use the microblaze_get_pvr() function to populate the PVR data into a pvr_t data
structure.
2. In subsequent steps, you can use any one of the PVR access macros list to get individual data
stored in the PVR.
Note: The pvr.h header file must be included to source to use PVR macros.
Functions
microblaze_get_pvr
Populate the PVR data structure to which pvr points, with the values of the hardware PVR
registers.
Prototype
Parameters
Name Description
pvr- address of PVR data structure to be populated
Returns
0 - SUCCESS -1 - FAILURE
Definitions
#Define MICROBLAZE_PVR_IS_FULL
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_BARREL
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_DIV
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_HW_MUL
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_FPU
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_ICACHE
Description
Parameters
Name Description
_pvr pvr data structure
#Define MICROBLAZE_PVR_USE_DCACHE
Description
Parameters
Name Description
_pvr pvr data structure
u32 Xil_GetMBFrequency
void
void MB_Sleep
MilliSeconds-
Functions
Xil_SetMBFrequency
Sets variable which stores Microblaze frequency value.
Note: It must be called after runtime change in Microblaze frequency, failing to do so would result in to
incorrect behavior of sleep routines
Prototype
Parameters
Name Description
Val - Frequency value to be set
Returns
Xil_GetMBFrequency
Returns current Microblaze frequency value.
Prototype
u32 Xil_GetMBFrequency();
Returns
MB_Sleep
Provides delay for requested duration.
Prototype
Parameters
Name Description
MilliSeconds- Delay time in milliseconds.
Returns
None.
Chapter 3
void Xil_ExceptionRemoveHandler
u32 Exception_id
void Xil_GetExceptionRegisterHandler
u32 Exception_id
Xil_ExceptionHandler * Handler
void ** Data
void Xil_ExceptionInit
void
void Xil_DataAbortHandler
void
void Xil_PrefetchAbortHandler
void
void Xil_UndefinedExceptionHandler
void
Functions
Xil_ExceptionRegisterHandler
Register a handler for a specific exception.
This handler is being called when the processor encounters the specified exception.
Prototype
Parameters
Name Description
Exception_id contains the ID of the exception source and should be in the range of 0 to
XIL_EXCEPTION_ID_LAST. See xil_exception.h for further information.
Handler to the Handler for that exception.
Data is a reference to Data that will be passed to the Handler when it gets called.
Returns
None.
Xil_ExceptionRemoveHandler
Removes the handler for a specific exception Id.
Prototype
Parameters
Name Description
Exception_id contains the ID of the exception source and should be in the range of 0 to
XIL_EXCEPTION_ID_LAST. See xil_exception.h for further information.
Returns
None.
Xil_GetExceptionRegisterHandler
Get a handler for a specific exception.
This handler is being called when the processor encounters the specified exception.
Prototype
Parameters
Name Description
Exception_id contains the ID of the exception source and should be in the range of 0 to
XIL_EXCEPTION_ID_LAST. See xil_exception.h for further information.
Handler to the Handler for that exception.
Data is a reference to Data that will be passed to the Handler when it gets called.
Returns
None.
Xil_ExceptionInit
The function is a common API used to initialize exception handlers across all supported arm
processors.
For Arm Cortex-A53, Cortex-R5F, and Cortex-A9, the exception handlers are being initialized
statically and this function does not do anything. However, it is still present to take care of
backward compatibility issues (in earlier versions of BSPs, this API was being used to initialize
exception handlers).
Prototype
void Xil_ExceptionInit(void);
Returns
None.
Xil_DataAbortHandler
Default Data abort handler which prints data fault status register through which information
about data fault can be acquired.
Prototype
Returns
None.
Xil_PrefetchAbortHandler
Default Prefetch abort handler which prints prefetch fault status register through which
information about instruction prefetch fault can be acquired.
Prototype
Returns
None.
Xil_UndefinedExceptionHandler
Default undefined exception handler which prints address of the undefined instruction if debug
prints are enabled.
Prototype
Returns
None.
Definitions
Define Xil_ExceptionEnableMask
Definition
#define Xil_ExceptionEnableMask { \
register u32 Reg __asm("cpsr"); \
mtcpsr((Reg) & (~((Mask) & XIL_EXCEPTION_ALL))); \
}
Description
Enable Exceptions.
Define Xil_ExceptionEnable
Definition
#define Xil_ExceptionEnable
Xil_ExceptionEnableMask
(XIL_EXCEPTION_IRQ)
Description
Note: None.
Define Xil_ExceptionDisableMask
Definition
#define Xil_ExceptionDisableMask
{ \
register u32 Reg __asm("cpsr"); \
mtcpsr((Reg) | ((Mask) & XIL_EXCEPTION_ALL)); \
}
Description
Disable Exceptions.
Define Xil_ExceptionDisable
Definition
#define Xil_ExceptionDisable
Xil_ExceptionDisableMask
(XIL_EXCEPTION_IRQ)
Description
Note: None.
Define Xil_EnableNestedInterrupts
Definition
Description
Note: This macro is supposed to be used from interrupt handlers. In the interrupt handler the interrupts are
disabled by default (I and F are 1). To allow nesting of interrupts, this macro should be used. It clears the I
and F bits by changing the ARM mode to system mode. Once these bits are cleared and provided the
preemption of interrupt conditions are met in the GIC, nesting of interrupts will start happening. Caution:
This macro must be used with caution. Before calling this macro, the user must ensure that the source of
the current IRQ is appropriately cleared. Otherwise, as soon as we clear the I and F bits, there can be an
infinite loop of interrupts with an eventual crash (all the stack space getting consumed).
Define Xil_DisableNestedInterrupts
Definition
Description
Note: This macro is meant to be called in the interrupt service routines. This macro cannot be used
independently. It can only be used when nesting of interrupts have been enabled by using the macro
Xil_EnableNestedInterrupts() . In a typical flow, the user first calls the Xil_EnableNestedInterrupts
in the ISR at the appropriate point. The user then must call this macro before exiting the interrupt service
routine. This macro puts the ARM back in IRQ/FIQ mode and hence sets back the I and F bits.
Chapter 4
It supports gcc compiler. This section provides a linked summary and detailed descriptions of the
Arm Cortex-R5F processor APIs.
Boot code invokes Init_MPU function to configure the MPU. A total of 10 MPU regions are
allocated with another 6 being free for users. Overview of the memory attributes for different
MPU regions is as given below,
Note: For a system where DDR is less than 2GB, region after DDR and before PL is marked as undefined in
translation table. Memory range 0xFE000000-0xFEFFFFFF is allocated for upper LPS slaves, where as
memory region 0xFF000000-0xFFFFFFFF is allocated for lower LPS slaves.
void Xil_EnableMPU
void
void Xil_DisableMPU
void
u32 Xil_SetMPURegion
INTPTR addr
u64 size
u32 attrib
u32 Xil_UpdateMPUConfig
u32 reg_num
INTPTR address
u32 size
u32 attrib
u32 Xil_GetNumOfFreeRegions
void
u32 Xil_GetNextMPURegion
void
u32 Xil_DisableMPURegionByRegNum
u32 reg_num
u16 Xil_GetMPUFreeRegMask
void
u32 Xil_SetMPURegionByRegNum
u32 reg_num
INTPTR addr
u64 size
u32 attrib
void * Xil_MemMap
UINTPTR Physaddr
size_t size
u32 flags
Functions
Xil_SetTlbAttributes
This function sets the memory attributes for a section covering 1MB, of memory in the
translation table.
Prototype
Parameters
Name Description
addr 32-bit address for which memory attributes need to be set.
attrib Attribute for the given memory region.
Returns
None.
Xil_EnableMPU
Enable MPU for Cortex-R5F processor.
This function invalidates I cache and flush the D Caches, and then enables the MPU.
Prototype
void Xil_EnableMPU(void);
Returns
None.
Xil_DisableMPU
Disable MPU for Cortex-R5F processors.
This function invalidates I cache and flush the D Caches, and then disabes the MPU.
Prototype
void Xil_DisableMPU(void);
Returns
None.
Xil_SetMPURegion
Set the memory attributes for a section of memory in the translation table.
Prototype
Parameters
Name Description
addr 32-bit address for which memory attributes need to be set..
size size is the size of the region.
attrib Attribute for the given memory region.
Returns
None.
Xil_UpdateMPUConfig
Update the MPU configuration for the requested region number in the global MPU configuration
table.
Prototype
Parameters
Name Description
reg_num The requested region number to be updated information for.
address 32 bit address for start of the region.
size Requested size of the region.
attrib Attribute for the corresponding region.
Returns
XST_FAILURE: When the requested region number if 16 or more. XST_SUCCESS: When the
MPU configuration table is updated.
Xil_GetMPUConfig
The MPU configuration table is passed to the caller.
Prototype
Parameters
Name Description
mpuconfig This is of type XMpu_Config which is an array of 16 entries of type structure
representing the MPU config table
Returns
none
Xil_GetNumOfFreeRegions
Returns the total number of free MPU regions available.
Prototype
u32 Xil_GetNumOfFreeRegions(void);
Returns
Xil_GetNextMPURegion
Returns the next available free MPU region.
Prototype
u32 Xil_GetNextMPURegion(void);
Returns
Xil_DisableMPURegionByRegNum
Disables the corresponding region number as passed by the user.
Prototype
Parameters
Name Description
reg_num The region number to be disabled
Returns
XST_SUCCESS: If the region could be disabled successfully XST_FAILURE: If the requested region
number is 16 or more.
Xil_GetMPUFreeRegMask
Returns the total number of free MPU regions available in the form of a mask.
A bit of 1 in the returned 16 bit value represents the corresponding region number to be
available. For example, if this function returns 0xC0000, this would mean, the regions 14 and 15
are available to users.
Prototype
u16 Xil_GetMPUFreeRegMask(void);
Returns
Xil_SetMPURegionByRegNum
Enables the corresponding region number as passed by the user.
Prototype
Parameters
Name Description
reg_num The region number to be enabled
Name Description
addr 32 bit address for start of the region.
size Requested size of the region.
attrib Attribute for the corresponding region.
Returns
XST_SUCCESS: If the region could be created successfully XST_FAILURE: If the requested region
number is 16 or more.
Xil_MemMap
Memory mapping for Cortex-R5F. If successful, the mapped region will include all of the memory
requested, but may include more. Specifically, it will be a power of two in size, aligned on a
boundary of that size.
Prototype
Parameters
Name Description
Physaddr is base physical address at which to start mapping. NULL in Physaddr masks possible
mapping errors.
size of region to be mapped.
flags used to set translation table.
Returns
It gives option to perform the cache operations on a single cacheline, a range of memory and an
entire cache.
void Xil_DCacheDisable
void
void Xil_DCacheInvalidate
void
void Xil_DCacheInvalidateRange
INTPTR adr
u32 len
void Xil_DCacheFlush
void
void Xil_DCacheFlushRange
INTPTR adr
u32 len
void Xil_DCacheInvalidateLine
INTPTR adr
void Xil_DCacheFlushLine
INTPTR adr
void Xil_DCacheStoreLine
INTPTR adr
void Xil_ICacheEnable
void
void Xil_ICacheDisable
void
void Xil_ICacheInvalidate
void
void Xil_ICacheInvalidateRange
INTPTR adr
u32 len
void Xil_ICacheInvalidateLine
INTPTR adr
Functions
Xil_DCacheEnable
Enable the Data cache.
Prototype
void Xil_DCacheEnable(void);
Returns
None.
Xil_DCacheDisable
Disable the Data cache.
Prototype
void Xil_DCacheDisable(void);
Returns
None.
Xil_DCacheInvalidate
Invalidate the entire Data cache.
Prototype
void Xil_DCacheInvalidate(void);
Returns
None.
Xil_DCacheInvalidateRange
Invalidate the Data cache for the given address range.
If the bytes specified by the address (adr) are cached by the Data cache,the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of range to be invalidated in bytes.
Returns
None.
Xil_DCacheFlush
Flush the entire Data cache.
Prototype
void Xil_DCacheFlush(void);
Returns
None.
Xil_DCacheFlushRange
Flush the Data cache for the given address range.
If the bytes specified by the address (adr) are cached by the Data cache, the cacheline containing
those bytes is invalidated.If the cacheline is modified (dirty), the written to system memory
before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be flushed.
len Length of the range to be flushed in bytes
Returns
None.
Xil_DCacheInvalidateLine
Invalidate a Data cache line.
If the byte specified by the address (adr) is cached by the data cache, the cacheline containing
that byte is invalidated.If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_DCacheFlushLine
Flush a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline
are written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_DCacheStoreLine
Store a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache and the cacheline is
modified (dirty), the entire contents of the cacheline are written to system memory.After the
store completes, the cacheline is marked as unmodified (not dirty).
Prototype
Parameters
Name Description
adr 32bit address of the data to be stored
Returns
None.
Xil_ICacheEnable
Enable the instruction cache.
Prototype
void Xil_ICacheEnable(void);
Returns
None.
Xil_ICacheDisable
Disable the instruction cache.
Prototype
void Xil_ICacheDisable(void);
Returns
None.
Xil_ICacheInvalidate
Invalidate the entire instruction cache.
Prototype
void Xil_ICacheInvalidate(void);
Returns
None.
Xil_ICacheInvalidateRange
Invalidate the instruction cache for the given address range.
If the bytes specified by the address (adr) are cached by the Data cache, the cacheline containing
that byte is invalidated. If the cachelineis modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_ICacheInvalidateLine
Invalidate an instruction cache line.If the instruction specified by the address is cached by the
instruction cache, the cacheline containing that instruction is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the instruction to be invalidated.
Returns
None.
void XTime_GetTime
XTime * Xtime_Global
Functions
XTime_SetTime
TTC Timer runs continuously and the time can not be set as desired.
This API doesn't contain anything. It is defined to have uniformity across platforms.
Note: In multiprocessor environment reference time will reset/lost for all processors, when this function
called by any one processor.
Prototype
Parameters
Name Description
Xtime_Global 32 bit value to be written to the timer counter register.
Returns
None.
XTime_GetTime
Get the time from the timer counter register.
Prototype
Parameters
Name Description
Xtime_Global Pointer to the 32 bit location to be updated with the time current value of timer
counter register.
Returns
None.
Cortex-R5F Performance Monitor has 3 event counters which can be used to count a variety of
events described in Coretx-R5 TRM. The xpm_counter.h file defines configurations
XPM_CNTRCFGx which can be used to program the event counters to count a set of events.
void Xpm_GetEventCounters
u32 * PmCtrValue
u32 Xpm_DisableEvent
EventCntrId
u32 Xpm_SetUpAnEvent
u32 EventID
u32 Xpm_GetEventCounter
EventCntrId
u32 * CntVal
void Xpm_DisableEventCounters
void
void Xpm_EnableEventCounters
void
void Xpm_ResetEventCounters
void
void Xpm_SleepPerfCounter
u32 delay
u64 frequency
Functions
Xpm_SetEvents
This function configures the Cortex-R5F event counters controller, with the event codes, in a
configuration selected by the user and enables the counters.
Prototype
Parameters
Name Description
PmcrCfg Configuration value based on which the event counters are
configured.XPM_CNTRCFG* values defined in xpm_counter.h can be utilized for setting
configuration
Returns
None.
Xpm_GetEventCounters
This function disables the event counters and returns the counter values.
Prototype
Parameters
Name Description
PmCtrValue Pointer to an array of type u32 PmCtrValue[6]. It is an output parameter which is used
to return the PM counter values.
Returns
None.
Xpm_DisableEvent
Disables the requested event counter.
Prototype
Parameters
Name Description
EventCntrId Event Counter ID. The counter ID is the same that was earlier returned through a call
to Xpm_SetUpAnEvent. Cortex-R5F supports only 3 counters. The valid values are 0, 1,
or 2.
Returns
• XST_SUCCESS if successful.
• XST_FAILURE if the passed Counter ID is invalid (i.e. greater than 2).
Xpm_SetUpAnEvent
Sets up one of the event counters to count events based on the Event ID passed.
For supported Event IDs please refer xpm_counter.h. Upon invoked, the API searches for an
available counter. After finding one, it sets up the counter to count events for the requested
event.
Prototype
Parameters
Name Description
EventID For valid values, please refer xpm_counter.h.
Returns
Xpm_GetEventCounter
Reads the counter value for the requested counter ID.
This is used to read the number of events that has been counted for the requsted event ID. This
can only be called after a call to Xpm_SetUpAnEvent.
Prototype
Parameters
Name Description
EventCntrId The counter ID is the same that was earlier returned through a call to
Xpm_SetUpAnEvent. Cortex-R5F supports only 3 counters. The valid values are 0, 1, or
2.
CntVal Pointer to a 32 bit unsigned int type. This is used to return the event counter value.
Returns
• XST_SUCCESS if successful.
• XST_FAILURE if the passed Counter ID is invalid (i.e. greater than 2).
Xpm_DisableEventCounters
This function disables the Cortex-R5F event counters.
Prototype
void Xpm_DisableEventCounters(void);
Returns
None.
Xpm_EnableEventCounters
This function enables the Cortex-R5F event counters.
Prototype
void Xpm_EnableEventCounters(void);
Returns
None.
Xpm_ResetEventCounters
This function resets the Cortex-R5F event counters.
Prototype
void Xpm_ResetEventCounters(void);
Returns
None.
Xpm_SleepPerfCounter
This is helper function used by sleep/usleep APIs to generate delay in sec/usec.
Prototype
Parameters
Name Description
delay - delay time in sec/usec
frequency - Number of countes in second/micro second
Returns
None.
The xreg_cortexr5.h file contains definitions for inline assembler code. It provides inline
definitions for Cortex-R5F GPRs, SPRs,co-processor registers and Debug register
The xpseudo_asm_gcc.h contains the definitions for the most often used inline assembler
instructions, available as macros. These can be very useful for tasks such as setting or getting
special purpose registers, synchronization,or cache manipulation. These inline assembler
instructions can be used from drivers and user applications written in C.
Chapter 5
The translation_table.S contains a static page table required by MMU for cortex-A9. This
translation table is flat mapped (input address = output address) with default memory attributes
defined for Zynq-7000 architecture. It utilizes short descriptor translation table format with each
section defining 1 MB of memory.
Note: For region 0x00000000 - 0x3FFFFFFF, a system where DDR is less than 1 GB, region after DDR and
before PL is marked as undefined/reserved in translation table. In 0xF8000000 - 0xF8FFFFFF,
0xF8000C00 - 0xF8000FFF, 0xF8010000 - 0xF88FFFFF and 0xF8F03000 to 0xF8FFFFFF are reserved
but due to granual size of 1 MB, it is not possible to define separate regions for them. For region
0xFFF00000 - 0xFFFFFFFF, 0xFFF00000 to 0xFFFB0000 is reserved but due to 1MB granual size, it is not
possible to define separate region for it.
It gives option to perform the cache operations on a single cacheline, a range of memory and an
entire cache.
void Xil_DCacheDisable
void
void Xil_DCacheInvalidate
void
void Xil_DCacheInvalidateRange
INTPTR adr
u32 len
void Xil_DCacheFlushRange
INTPTR adr
u32 len
void Xil_ICacheEnable
void
void Xil_ICacheDisable
void
void Xil_ICacheInvalidate
void
void Xil_ICacheInvalidateRange
INTPTR adr
u32 len
void Xil_DCacheInvalidateLine
u32 adr
void Xil_DCacheFlushLine
u32 adr
void Xil_DCacheStoreLine
u32 adr
void Xil_ICacheInvalidateLine
u32 adr
void Xil_L1DCacheEnable
void
void Xil_L1DCacheDisable
void
void Xil_L1DCacheInvalidate
void
void Xil_L1DCacheInvalidateLine
u32 adr
void Xil_L1DCacheInvalidateRange
u32 adr
u32 len
void Xil_L1DCacheFlush
void
void Xil_L1DCacheFlushLine
u32 adr
void Xil_L1DCacheFlushRange
u32 adr
u32 len
void Xil_L1ICacheEnable
void
void Xil_L1ICacheDisable
void
void Xil_L1ICacheInvalidate
void
void Xil_L1ICacheInvalidateLine
u32 adr
void Xil_L1ICacheInvalidateRange
u32 adr
u32 len
void Xil_L2CacheEnable
void
void Xil_L2CacheDisable
void
void Xil_L2CacheInvalidate
void
void Xil_L2CacheInvalidateLine
u32 adr
void Xil_L2CacheInvalidateRange
u32 adr
u32 len
void Xil_L2CacheFlush
void
void Xil_L2CacheFlushLine
u32 adr
void Xil_L2CacheFlushRange
u32 adr
u32 len
void Xil_L2CacheStoreLine
u32 adr
Functions
Xil_DCacheEnable
Enable the Data cache.
Prototype
void Xil_DCacheEnable(void);
Returns
None.
Xil_DCacheDisable
Disable the Data cache.
Prototype
void Xil_DCacheDisable(void);
Returns
None.
Xil_DCacheInvalidate
Invalidate the entire Data cache.
Prototype
void Xil_DCacheInvalidate(void);
Returns
None.
Xil_DCacheInvalidateRange
Invalidate the Data cache for the given address range.
If the bytes specified by the address range are cached by the Data cache, the cachelines
containing those bytes are invalidated. If the cachelines are modified (dirty), the modified
contents are lost and NOT written to the system memory before the lines are invalidated.
In this function, if start address or end address is not aligned to cache-line, particular cache-line
containing unaligned start or end address is flush first and then invalidated the others as
invalidating the same unaligned cache line may result into loss of data. This issue raises few
possibilities.
If the address to be invalidated is not cache-line aligned, the following choices are available:
1. Invalidate the cache line when required and do not bother much for the side effects. Though
it sounds good, it can result in hard-to-debug issues. The problem is, if some other variable
are allocated in the same cache line and had been recently updated (in cache), the
invalidation would result in loss of data.
2. Flush the cache line first. This will ensure that if any other variable present in the same cache
line and updated recently are flushed out to memory. Then it can safely be invalidated. Again
it sounds good, but this can result in issues. For example, when the invalidation happens in a
typical ISR (after a DMA transfer has updated the memory), then flushing the cache line
means, losing data that were updated recently before the ISR got invoked.
Linux prefers the second one. To have uniform implementation (across standalone and Linux), the
second option is implemented. This being the case, following needs to be taken care of:
1. Whenever possible, the addresses must be cache line aligned. Please nore that, not just start
address, even the end address must be cache line aligned. If that is taken care of, this will
always work.
2. Avoid situations where invalidation has to be done after the data is updated by
peripheral/DMA directly into the memory. It is not tough to achieve (may be a bit risky). The
common use case to do invalidation is when a DMA happens. Generally for such use cases,
buffers can be allocated first and then start the DMA. The practice that needs to be followed
here is, immediately after buffer allocation and before starting the DMA, do the invalidation.
With this approach, invalidation need not to be done after the DMA transfer is over.
This is going to always work if done carefully. However, the concern is, there is no guarantee that
invalidate has not needed to be done after DMA is complete. For example, because of some
reasons if the first cache line or last cache line (assuming the buffer in question comprises of
multiple cache lines) are brought into cache (between the time it is invalidated and DMA
completes) because of some speculative prefetching or reading data for a variable present in the
same cache line, then we will have to invalidate the cache after DMA is complete.
Prototype
Parameters
Name Description
adr 32-bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_DCacheFlush
Flush the entire Data cache.
Prototype
void Xil_DCacheFlush(void);
Returns
None.
Xil_DCacheFlushRange
Flush the Data cache for the given address range.
If the bytes specified by the address range are cached by the data cache, the cachelines
containing those bytes are invalidated. If the cachelines are modified (dirty), they are written to
the system memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be flushed.
len Length of the range to be flushed in bytes.
Returns
None.
Xil_ICacheEnable
Enable the instruction cache.
Prototype
void Xil_ICacheEnable(void);
Returns
None.
Xil_ICacheDisable
Disable the instruction cache.
Prototype
void Xil_ICacheDisable(void);
Returns
None.
Xil_ICacheInvalidate
Invalidate the entire instruction cache.
Prototype
void Xil_ICacheInvalidate(void);
Returns
None.
Xil_ICacheInvalidateRange
Invalidate the instruction cache for the given address range.
If the instructions specified by the address range are cached by the instrunction cache, the
cachelines containing those instructions are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_DCacheInvalidateLine
Invalidate a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to the system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_DCacheFlushLine
Flush a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline
are written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_DCacheStoreLine
Store a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache and the cacheline is
modified (dirty), the entire contents of the cacheline are written to system memory. After the
store completes, the cacheline is marked as unmodified (not dirty).
Prototype
Parameters
Name Description
adr 32bit address of the data to be stored.
Returns
None.
Xil_ICacheInvalidateLine
Invalidate an instruction cache line.
If the instruction specified by the address is cached by the instruction cache, the cacheline
containing that instruction is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the instruction to be invalidated.
Returns
None.
Xil_L1DCacheEnable
Enable the level 1 Data cache.
Prototype
void Xil_L1DCacheEnable(void);
Returns
None.
Xil_L1DCacheDisable
Disable the level 1 Data cache.
Prototype
void Xil_L1DCacheDisable(void);
Returns
None.
Xil_L1DCacheInvalidate
Invalidate the level 1 Data cache.
Note: In Cortex A9, there is no cp instruction for invalidating the whole D-cache. This function invalidates
each line by set/way.
Prototype
void Xil_L1DCacheInvalidate(void);
Returns
None.
Xil_L1DCacheInvalidateLine
Invalidate a level 1 Data cache line.
If the byte specified by the address (Addr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be invalidated.
Returns
None.
Xil_L1DCacheInvalidateRange
Invalidate the level 1 Data cache for the given address range.
If the bytes specified by the address range are cached by the Data cache, the cachelines
containing those bytes are invalidated. If the cachelines are modified (dirty), the modified
contents are lost and NOT written to the system memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_L1DCacheFlush
Flush the level 1 Data cache.
Note: In Cortex A9, there is no cp instruction for flushing the whole D-cache. Need to flush each line.
Prototype
void Xil_L1DCacheFlush(void);
Returns
None.
Xil_L1DCacheFlushLine
Flush a level 1 Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline
are written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_L1DCacheFlushRange
Flush the level 1 Data cache for the given address range.
If the bytes specified by the address range are cached by the Data cache, the cacheline
containing those bytes are invalidated. If the cachelines are modified (dirty), they are written to
system memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be flushed.
len Length of the range to be flushed in bytes.
Returns
None.
Xil_L1DCacheStoreLine
Store a level 1 Data cache line.
If the byte specified by the address (adr) is cached by the Data cache and the cacheline is
modified (dirty), the entire contents of the cacheline are written to system memory. After the
store completes, the cacheline is marked as unmodified (not dirty).
Prototype
Parameters
Name Description
adr Address to be stored.
Returns
None.
Xil_L1ICacheEnable
Enable the level 1 instruction cache.
Prototype
void Xil_L1ICacheEnable(void);
Returns
None.
Xil_L1ICacheDisable
Disable level 1 the instruction cache.
Prototype
void Xil_L1ICacheDisable(void);
Returns
None.
Xil_L1ICacheInvalidate
Invalidate the entire level 1 instruction cache.
Prototype
void Xil_L1ICacheInvalidate(void);
Returns
None.
Xil_L1ICacheInvalidateLine
Invalidate a level 1 instruction cache line.
If the instruction specified by the address is cached by the instruction cache, the cacheline
containing that instruction is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the instruction to be invalidated.
Returns
None.
Xil_L1ICacheInvalidateRange
Invalidate the level 1 instruction cache for the given address range.
If the instrucions specified by the address range are cached by the instruction cache, the
cacheline containing those bytes are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_L2CacheEnable
Enable the L2 cache.
Prototype
void Xil_L2CacheEnable(void);
Returns
None.
Xil_L2CacheDisable
Disable the L2 cache.
Prototype
void Xil_L2CacheDisable(void);
Returns
None.
Xil_L2CacheInvalidate
Invalidate the entire level 2 cache.
Prototype
void Xil_L2CacheInvalidate(void);
Returns
None.
Xil_L2CacheInvalidateLine
Invalidate a level 2 cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the modified contents are lost and are
NOT written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data/instruction to be invalidated.
Returns
None.
Xil_L2CacheInvalidateRange
Invalidate the level 2 cache for the given address range.
If the bytes specified by the address range are cached by the L2 cache, the cacheline containing
those bytes are invalidated. If the cachelines are modified (dirty), the modified contents are lost
and are NOT written to system memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_L2CacheFlush
Flush the entire level 2 cache.
Prototype
void Xil_L2CacheFlush(void);
Returns
None.
Xil_L2CacheFlushLine
Flush a level 2 cache line.
If the byte specified by the address (adr) is cached by the L2 cache, the cacheline containing that
byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline are
written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data/instruction to be flushed.
Returns
None.
Xil_L2CacheFlushRange
Flush the level 2 cache for the given address range.
If the bytes specified by the address range are cached by the L2 cache, the cacheline containing
those bytes are invalidated. If the cachelines are modified (dirty), they are written to the system
memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be flushed.
len Length of the range to be flushed in bytes.
Returns
None.
Xil_L2CacheStoreLine
Store a level 2 cache line.
If the byte specified by the address (adr) is cached by the L2 cache and the cacheline is modified
(dirty), the entire contents of the cacheline are written to system memory. After the store
completes, the cacheline is marked as unmodified (not dirty).
Prototype
Parameters
Name Description
adr 32bit address of the data/instruction to be stored.
Returns
None.
void Xil_EnableMMU
void
void Xil_DisableMMU
void
void * Xil_MemMap
UINTPTR PhysAddr
size_t size
u32 flags
Functions
Xil_SetTlbAttributes
This function sets the memory attributes for a section covering 1MB of memory in the
translation table.
Note: The MMU or D-cache does not need to be disabled before changing a translation table entry.
Prototype
Parameters
Name Description
Addr 32-bit address for which memory attributes need to be set.
attrib Attribute for the given memory region. xil_mmu.h contains definitions of commonly
used memory attributes which can be utilized for this function.
Returns
None.
Xil_EnableMMU
Enable MMU for cortex A9 processor.
This function invalidates the instruction and data caches, and then enables MMU.
Prototype
void Xil_EnableMMU(void);
Returns
None.
Xil_DisableMMU
Disable MMU for Cortex A9 processors.
This function invalidates the TLBs, Branch Predictor Array and flushed the D Caches before
disabling the MMU.
Note: When the MMU is disabled, all the memory accesses are treated as strongly ordered.
Prototype
void Xil_DisableMMU(void);
Returns
None.
Xil_MemMap
Memory mapping for Cortex A9 processor.
Note: : Previously this was implemented in libmetal. Move to embeddedsw as this functionality is specific
to A9 processor.
Prototype
Parameters
Name Description
PhysAddr is physical address.
size is size of region.
flags is flags used to set translation table.
Returns
This counter increases by one at every two processor cycles. These functions can be used to
get/set time in the global timer.
Functions
XTime_SetTime
Set the time in the Global Timer Counter Register.
Note: When this function is called by any one processor in a multi- processor environment, reference time
will reset/lost for all processors.
Prototype
Parameters
Name Description
Xtime_Global 64-bit Value to be written to the Global Timer Counter Register.
Returns
None.
XTime_GetTime
Get the time from the Global Timer Counter Register.
Note: None.
Prototype
Parameters
Name Description
Xtime_Global Pointer to the 64-bit location which will be updated with the current timer value.
Returns
None.
Cortex-A9 performance monitor has six event counters which can be used to count a variety of
events described in Coretx-A9 TRM. xpm_counter.h defines configurations XPM_CNTRCFGx
which can be used to program the event counters to count a set of events.
Note: It doesn't handle the Cortex-A9 cycle counter, as the cycle counter is being used for time keeping.
void Xpm_GetEventCounters
u32 * PmCtrValue
Functions
Xpm_SetEvents
This function configures the Cortex A9 event counters controller, with the event codes, in a
configuration selected by the user and enables the counters.
Prototype
Parameters
Name Description
PmcrCfg Configuration value based on which the event counters are configured.
XPM_CNTRCFG* values defined in xpm_counter.h can be utilized for setting
configuration.
Returns
None.
Xpm_GetEventCounters
This function disables the event counters and returns the counter values.
Prototype
Parameters
Name Description
PmCtrValue Pointer to an array of type u32 PmCtrValue[6]. It is an output parameter which is used
to return the PM counter values.
Returns
None.
PL310 has two event counters which can be used to count variety of events like DRHIT, DRREQ,
DWHIT, DWREQ, etc. xl2cc_counter.h contains definitions for different configurations which can
be used for the event counters to count a set of events.
void XL2cc_EventCtrStart
void
void XL2cc_EventCtrStop
u32 * EveCtr0
u32 * EveCtr1
Functions
XL2cc_EventCtrInit
This function initializes the event counters in L2 Cache controller with a set of event codes
specified by the user.
Note: The definitions for event codes XL2CC_* can be found in xl2cc_counter.h.
Prototype
Parameters
Name Description
Event0 Event code for counter 0.
Event1 Event code for counter 1.
Returns
None.
XL2cc_EventCtrStart
This function starts the event counters in L2 Cache controller.
Prototype
void XL2cc_EventCtrStart(void);
Returns
None.
XL2cc_EventCtrStop
This function disables the event counters in L2 Cache controller, saves the counter values and
resets the counters.
Prototype
Parameters
Name Description
EveCtr0 Output parameter which is used to return the value in event counter 0.
EveCtr1 Output parameter which is used to return the value in event counter 1.
Returns
None.
The implementation for errata handling follows ARM guidelines and is based on the open source
Linux support for these errata.
Note: The errata handling is enabled by default. To disable handling of all the errata globally, un-define the
macro ENABLE_ARM_ERRATA in xil_errata.h. To disable errata on a per-erratum basis, un-define relevant
macros in xil_errata.h.
Definitions
Define CONFIG_ARM_ERRATA_742230
Definition
#define CONFIG_ARM_ERRATA_7422301
Description
Define CONFIG_ARM_ERRATA_743622
Definition
#define CONFIG_ARM_ERRATA_7436221
Description
Errata No: 743622 Description: Faulty hazard checking in the Store Buffer may lead to data
corruption.
Define CONFIG_ARM_ERRATA_775420
Definition
#define CONFIG_ARM_ERRATA_7754201
Description
Errata No: 775420 Description: A data cache maintenance operation which aborts, might lead to
deadlock.
Define CONFIG_ARM_ERRATA_794073
Definition
#define CONFIG_ARM_ERRATA_7940731
Description
Errata No: 794073 Description: Speculative instruction fetches with MMU disabled might not
comply with architectural requirements.
Define CONFIG_PL310_ERRATA_588369
Definition
#define CONFIG_PL310_ERRATA_5883691
Description
Errata No: 588369 Description: Clean & Invalidate maintenance operations do not invalidate
clean lines
Define CONFIG_PL310_ERRATA_727915
Definition
#define CONFIG_PL310_ERRATA_7279151
Description
Errata No: 727915 Description: Background Clean and Invalidate by Way operation can cause
data corruption.
The xreg_cortexa9.h file contains definitions for inline assembler code. It provides inline
definitions for Cortex A9 GPRs, SPRs, MPE registers, co-processor registers and Debug registers.
The xpseudo_asm_gcc.h contains the definitions for the most often used inline assembler
instructions, available as macros. These can be very useful for tasks such as setting or getting
special purpose registers, synchronization, or cache manipulation etc. These inline assembler
instructions can be used from drivers and user applications written in C.
Chapter 6
The translation_table.S contains a static page table required by MMU for cortex-A53. This
translation table is flat mapped (input address = output address) with default memory attributes
defined for Zynq Ultrascale+ architecture. It utilizes short descriptor translation table format with
each section defining 1 MB of memory.
Note: For DDR in region 0x00000000 - 0x7FFFFFFF, a system where DDR is less than 2 GB, region after
DDR and before PL is marked as undefined/reserved in translation table. In region 0xFFC00000 -
0xFFDFFFFF, it contains CSU and PMU memory which are marked as Device since it is less than 1 MB and
falls in a region with device memory.
It gives option to perform the cache operations on a single cacheline, a range of memory and an
entire cache.
void Xil_DCacheDisable
void
void Xil_DCacheInvalidate
void
void Xil_DCacheInvalidateRange
INTPTR adr
u32 len
void Xil_DCacheFlushRange
INTPTR adr
u32 len
void Xil_DCacheInvalidateLine
u32 adr
void Xil_DCacheFlushLine
u32 adr
void Xil_ICacheInvalidateLine
u32 adr
void Xil_ICacheEnable
void
void Xil_ICacheDisable
void
void Xil_ICacheInvalidate
void
void Xil_ICacheInvalidateRange
INTPTR adr
u32 len
Functions
Xil_DCacheEnable
Enable the Data cache.
Prototype
void Xil_DCacheEnable(void);
Returns
None.
Xil_DCacheDisable
Disable the Data cache.
Prototype
void Xil_DCacheDisable(void);
Returns
None.
Xil_DCacheInvalidate
Invalidate the Data cache.
The contents present in the data cache are cleaned and invalidated.
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate to avoid such corruption.
Prototype
void Xil_DCacheInvalidate(void);
Returns
None.
Xil_DCacheInvalidateRange
Invalidate the Data cache for the given address range.
The cachelines present in the adderss range are cleaned and invalidated
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate to avoid such corruption.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_DCacheFlush
Flush the Data cache.
Prototype
void Xil_DCacheFlush(void);
Returns
None.
Xil_DCacheFlushRange
Flush the Data cache for the given address range.
If the bytes specified by the address range are cached by the Data cache, the cachelines
containing those bytes are invalidated. If the cachelines are modified (dirty), they are written to
system memory before the lines are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be flushed.
len Length of range to be flushed in bytes.
Returns
None.
Xil_DCacheInvalidateLine
Invalidate a Data cache line.
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate to avoid such corruption.
Prototype
Parameters
Name Description
adr 32 bit address of the data to be invalidated.
Returns
None.
Xil_DCacheFlushLine
Flush a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline
are written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the data to be flushed.
Returns
None.
Xil_ICacheInvalidateLine
Invalidate an instruction cache line.
If the instruction specified by the address is cached by the instruction cache, the cachecline
containing that instruction is invalidated.
Prototype
Parameters
Name Description
adr 32bit address of the instruction to be invalidated..
Returns
None.
Xil_ICacheEnable
Enable the instruction cache.
Prototype
void Xil_ICacheEnable(void);
Returns
None.
Xil_ICacheDisable
Disable the instruction cache.
Prototype
void Xil_ICacheDisable(void);
Returns
None.
Xil_ICacheInvalidate
Invalidate the entire instruction cache.
Prototype
void Xil_ICacheInvalidate(void);
Returns
None.
Xil_ICacheInvalidateRange
Invalidate the instruction cache for the given address range.
If the instructions specified by the address range are cached by the instrunction cache, the
cachelines containing those instructions are invalidated.
Prototype
Parameters
Name Description
adr 32bit start address of the range to be invalidated.
Name Description
len Length of the range to be invalidated in bytes.
Returns
None.
None.
Note:
void Xil_EnableMMU
void
void Xil_DisableMMU
void
Functions
Xil_SetTlbAttributes
This function sets the memory attributes for a section covering 1MB of memory in the
translation table.
Note: The MMU or D-cache does not need to be disabled before changing a translation table entry.
Prototype
Parameters
Name Description
Addr 32-bit address for which the attributes need to be set.
attrib Attributes for the specified memory region. xil_mmu.h contains commonly used
memory attributes definitions which can be utilized for this function.
Returns
None.
Xil_EnableMMU
Enable MMU for Cortex-A53 processor in 32bit mode.
This function invalidates the instruction and data caches before enabling MMU.
Prototype
void Xil_EnableMMU(void);
Returns
None.
Xil_DisableMMU
Disable MMU for Cortex A53 processors in 32bit mode.
This function invalidates the TLBs, Branch Predictor Array and flushed the data cache before
disabling the MMU.
Note: When the MMU is disabled, all the memory accesses are treated as strongly ordered.
Prototype
void Xil_DisableMMU(void);
Returns
None.
void XTime_GetTime
XTime * Xtime_Global
Functions
XTime_SetTime
Timer of A53 runs continuously and the time can not be set as desired.
This API doesn't contain anything. It is defined to have uniformity across platforms.
Prototype
Parameters
Name Description
Xtime_Global 64bit Value to be written to the Global Timer Counter Register. But since the function
does not contain anything, the value is not used for anything.
Returns
None.
XTime_GetTime
Get the time from the physical timer counter register.
Prototype
Parameters
Name Description
Xtime_Global Pointer to the 64-bit location to be updated with the current value in physical timer
counter.
Returns
None.
The xreg_cortexa53.h file contains definitions for inline assembler code. It provides inline
definitions for Cortex A53 GPRs, SPRs, co-processor registers and floating point registers.
The xpseudo_asm_gcc.h contains the definitions for the most often used inline assembler
instructions, available as macros. These can be very useful for tasks such as setting or getting
special purpose registers, synchronization, or cache manipulation etc. These inline assembler
instructions can be used from drivers and user applications written in C.
Chapter 7
The 64-bit mode of cortex-A53 contains Armv8-A architecture. This section provides a linked
summary and detailed descriptions of the Arm Cortex-A53 64-bit Processor APIs.
Note: These APIs are applicable for the Cortex-A72 processor as well.
If the current exception level is EL1 and BSP is also built for EL1_NONSECURE it will perform
initialization required for application execution at EL1 non-secure. For all other combination, the
execution will go into infinite loop. Below is a sequence illustrating what all configuration is
performed before control reaches to main function for EL1 execution.
The translation_table.S contains a static page table required by MMU for cortex-A53. This
translation table is flat mapped (input address = output address) with default memory attributes
defined for zynq ultrascale+ architecture. It utilizes translation granual size of 4 KB with 2 MB
section size for initial 4 GB memory and 1 GB section size for memory after 4 GB. The overview
of translation table memory attributes is described below.
Note: For DDR region 0x0000000000 - 0x007FFFFFFF, a system where DDR is less than 2 GB, region
after DDR and before PL is marked as undefined/reserved in translation table. Region 0xF9100000 -
0xF91FFFFF is reserved memory in 0x00F9000000 - 0x00F91FFFFF range, but it is marked as strongly
ordered because minimum section size in translation table section is 2 MB. Region 0x00FFC00000 -
0x00FFDFFFFF contains CSU and PMU memory which are marked as Device since it is less than 1MB and
falls in a region with device memory.
It gives option to perform the cache operations on a single cacheline, a range of memory and an
entire cache.
void Xil_DCacheDisable
void
void Xil_DCacheInvalidate
void
void Xil_DCacheInvalidateRange
INTPTR adr
INTPTR len
void Xil_DCacheInvalidateLine
INTPTR adr
void Xil_DCacheFlush
void
void Xil_DCacheFlushLine
INTPTR adr
void Xil_ICacheEnable
void
void Xil_ICacheDisable
void
void Xil_ICacheInvalidate
void
void Xil_ICacheInvalidateRange
INTPTR adr
INTPTR len
void Xil_ICacheInvalidateLine
INTPTR adr
void Xil_ConfigureL1Prefetch
u8 num
Functions
Xil_DCacheEnable
Enable the Data cache.
Prototype
void Xil_DCacheEnable(void);
Returns
None.
Xil_DCacheDisable
Disable the Data cache.
Prototype
void Xil_DCacheDisable(void);
Returns
None.
Xil_DCacheInvalidate
Invalidate the Data cache.
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate which avoids such corruption.
Prototype
void Xil_DCacheInvalidate(void);
Returns
None.
Xil_DCacheInvalidateRange
Invalidate the Data cache for the given address range.
The cachelines present in the adderss range are cleaned and invalidated
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate which avoids such corruption.
Prototype
Parameters
Name Description
adr 64bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_DCacheInvalidateLine
Invalidate a Data cache line.
Note: In Cortex-A53, functionality to simply invalid the cachelines is not present. Such operations are a
problem for an environment that supports virtualisation. It would allow one OS to invalidate a line
belonging to another OS. This could lead to the other OS crashing because of the loss of essential data.
Hence, such operations are promoted to clean and invalidate which avoids such corruption.
Prototype
Parameters
Name Description
adr 64bit address of the data to be flushed.
Returns
None.
Xil_DCacheFlush
Flush the Data cache.
Prototype
void Xil_DCacheFlush(void);
Returns
None.
Xil_DCacheFlushLine
Flush a Data cache line.
If the byte specified by the address (adr) is cached by the Data cache, the cacheline containing
that byte is invalidated. If the cacheline is modified (dirty), the entire contents of the cacheline
are written to system memory before the line is invalidated.
Prototype
Parameters
Name Description
adr 64bit address of the data to be flushed.
Returns
None.
Xil_ICacheEnable
Enable the instruction cache.
Prototype
void Xil_ICacheEnable(void);
Returns
None.
Xil_ICacheDisable
Disable the instruction cache.
Prototype
void Xil_ICacheDisable(void);
Returns
None.
Xil_ICacheInvalidate
Invalidate the entire instruction cache.
Prototype
void Xil_ICacheInvalidate(void);
Returns
None.
Xil_ICacheInvalidateRange
Invalidate the instruction cache for the given address range.
If the instructions specified by the address range are cached by the instrunction cache, the
cachelines containing those instructions are invalidated.
Prototype
Parameters
Name Description
adr 64bit start address of the range to be invalidated.
len Length of the range to be invalidated in bytes.
Returns
None.
Xil_ICacheInvalidateLine
Invalidate an instruction cache line.
If the instruction specified by the parameter adr is cached by the instruction cache, the cacheline
containing that instruction is invalidated.
Prototype
Parameters
Name Description
adr 64bit address of the instruction to be invalidated.
Returns
None.
Xil_ConfigureL1Prefetch
Configure the maximum number of outstanding data prefetches allowed in L1 cache.
Prototype
Parameters
Name Description
num maximum number of outstanding data prefetches allowed, valid values are 0-7.
Returns
None.
None.
Note:
Functions
Xil_SetTlbAttributes
It sets the memory attributes for a section, in the translation table.
If the address (defined by Addr) is less than 4GB, the memory attribute(attrib) is set for a section
of 2MB memory. If the address (defined by Addr) is greater than 4GB, the memory attribute
(attrib) is set for a section of 1GB memory.
Note: The MMU and D-cache need not be disabled before changing an translation table attribute.
Prototype
Parameters
Name Description
Addr 64-bit address for which attributes are to be set.
attrib Attribute for the specified memory region. xil_mmu.h contains commonly used
memory attributes definitions which can be utilized for this function.
Returns
None.
void XTime_GetTime
XTime * Xtime_Global
Functions
XTime_SetTime
Timer of A53 runs continuously and the time can not be set as desired.
This API doesn't contain anything. It is defined to have uniformity across platforms.
Prototype
Parameters
Name Description
Xtime_Global 64bit value to be written to the physical timer counter register. Since API does not do
anything, the value is not utilized.
Returns
None.
XTime_GetTime
Get the time from the physical timer counter register.
Prototype
Parameters
Name Description
Xtime_Global Pointer to the 64-bit location to be updated with the current value of physical timer
counter register.
Returns
None.
The xreg_cortexa53.h file contains definitions for inline assembler code. It provides inline
definitions for Cortex A53 GPRs, SPRs and floating point registers.
The xpseudo_asm_gcc.h contains the definitions for the most often used inline assembler
instructions, available as macros. These can be very useful for tasks such as setting or getting
special purpose registers, synchronization, or cache manipulation etc. These inline assembler
instructions can be used from drivers and user applications written in C.
Appendix A
Xilinx Resources
For support resources such as Answers, Documentation, Downloads, and Forums, see Xilinx
Support.
Xilinx Design Hubs provide links to documentation organized by design tasks and other topics,
which you can use to learn key concepts and address frequently asked questions. To access the
Design Hubs:
Note: For more information on DocNav, see the Documentation Navigator page on the Xilinx website.
Copyright
© Copyright 2020-2022 Xilinx, Inc. Xilinx, the Xilinx logo, Alveo, Artix, Kintex, Kria, Spartan,
Versal, Vitis, Virtex, Vivado, Zynq, and other designated brands included herein are trademarks of
Xilinx in the United States and other countries. All other trademarks are the property of their
respective owners.