You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
4.0 KiB
123 lines
4.0 KiB
/***************************************************************************** |
|
* Filename: C:\Users\superman\Desktop\korea\SpaceInvaderTestHW2/drivers/nes_v1_00_a/src/nes.h |
|
* Version: 1.00.a |
|
* Description: nes Driver Header File |
|
* Date: Tue Nov 18 16:03:58 2014 (by Create and Import Peripheral Wizard) |
|
*****************************************************************************/ |
|
|
|
#ifndef NES_H |
|
#define NES_H |
|
|
|
/***************************** Include Files *******************************/ |
|
|
|
#include "xbasic_types.h" |
|
#include "xstatus.h" |
|
#include "xil_io.h" |
|
|
|
/************************** Constant Definitions ***************************/ |
|
|
|
|
|
/** |
|
* User Logic Slave Space Offsets |
|
* -- SLV_REG0 : user logic slave module register 0 |
|
*/ |
|
#define NES_USER_SLV_SPACE_OFFSET (0x00000000) |
|
#define NES_SLV_REG0_OFFSET (NES_USER_SLV_SPACE_OFFSET + 0x00000000) |
|
|
|
/**************************** Type Definitions *****************************/ |
|
|
|
|
|
/***************** Macros (Inline Functions) Definitions *******************/ |
|
|
|
/** |
|
* |
|
* Write a value to a NES register. A 32 bit write is performed. |
|
* If the component is implemented in a smaller width, only the least |
|
* significant data is written. |
|
* |
|
* @param BaseAddress is the base address of the NES device. |
|
* @param RegOffset is the register offset from the base to write to. |
|
* @param Data is the data written to the register. |
|
* |
|
* @return None. |
|
* |
|
* @note |
|
* C-style signature: |
|
* void NES_mWriteReg(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Data) |
|
* |
|
*/ |
|
#define NES_mWriteReg(BaseAddress, RegOffset, Data) \ |
|
Xil_Out32((BaseAddress) + (RegOffset), (Xuint32)(Data)) |
|
|
|
/** |
|
* |
|
* Read a value from a NES register. A 32 bit read is performed. |
|
* If the component is implemented in a smaller width, only the least |
|
* significant data is read from the register. The most significant data |
|
* will be read as 0. |
|
* |
|
* @param BaseAddress is the base address of the NES device. |
|
* @param RegOffset is the register offset from the base to write to. |
|
* |
|
* @return Data is the data from the register. |
|
* |
|
* @note |
|
* C-style signature: |
|
* Xuint32 NES_mReadReg(Xuint32 BaseAddress, unsigned RegOffset) |
|
* |
|
*/ |
|
#define NES_mReadReg(BaseAddress, RegOffset) \ |
|
Xil_In32((BaseAddress) + (RegOffset)) |
|
|
|
|
|
/** |
|
* |
|
* Write/Read 32 bit value to/from NES user logic slave registers. |
|
* |
|
* @param BaseAddress is the base address of the NES device. |
|
* @param RegOffset is the offset from the slave register to write to or read from. |
|
* @param Value is the data written to the register. |
|
* |
|
* @return Data is the data from the user logic slave register. |
|
* |
|
* @note |
|
* C-style signature: |
|
* void NES_mWriteSlaveRegn(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Value) |
|
* Xuint32 NES_mReadSlaveRegn(Xuint32 BaseAddress, unsigned RegOffset) |
|
* |
|
*/ |
|
#define NES_mWriteSlaveReg0(BaseAddress, RegOffset, Value) \ |
|
Xil_Out32((BaseAddress) + (NES_SLV_REG0_OFFSET) + (RegOffset), (Xuint32)(Value)) |
|
|
|
#define NES_mReadSlaveReg0(BaseAddress, RegOffset) \ |
|
Xil_In32((BaseAddress) + (NES_SLV_REG0_OFFSET) + (RegOffset)) |
|
|
|
/************************** Function Prototypes ****************************/ |
|
|
|
|
|
/** |
|
* |
|
* Run a self-test on the driver/device. Note this may be a destructive test if |
|
* resets of the device are performed. |
|
* |
|
* If the hardware system is not built correctly, this function may never |
|
* return to the caller. |
|
* |
|
* @param baseaddr_p is the base address of the NES instance to be worked on. |
|
* |
|
* @return |
|
* |
|
* - XST_SUCCESS if all self-test code passed |
|
* - XST_FAILURE if any self-test code failed |
|
* |
|
* @note Caching must be turned off for this function to work. |
|
* @note Self test may fail if data memory and device are not on the same bus. |
|
* |
|
*/ |
|
XStatus NES_SelfTest(void * baseaddr_p); |
|
/** |
|
* Defines the number of registers available for read and write*/ |
|
#define TEST_AXI_LITE_USER_NUM_REG 1 |
|
|
|
|
|
#endif /** NES_H */
|
|
|