Contains the source code from the course work throughout my undergraduate Computer Engineering degree at Brigham Young University. There is a mixture of Go, Python, C, C++, Java, VHDL, Verilog, Matlab, Bash, Assembly, etc..
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.

nes.h 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*****************************************************************************
  2. * Filename: C:\Users\superman\Desktop\korea\SpaceInvaderTestHW2/drivers/nes_v1_00_a/src/nes.h
  3. * Version: 1.00.a
  4. * Description: nes Driver Header File
  5. * Date: Tue Nov 18 16:03:58 2014 (by Create and Import Peripheral Wizard)
  6. *****************************************************************************/
  7. #ifndef NES_H
  8. #define NES_H
  9. /***************************** Include Files *******************************/
  10. #include "xbasic_types.h"
  11. #include "xstatus.h"
  12. #include "xil_io.h"
  13. /************************** Constant Definitions ***************************/
  14. /**
  15. * User Logic Slave Space Offsets
  16. * -- SLV_REG0 : user logic slave module register 0
  17. */
  18. #define NES_USER_SLV_SPACE_OFFSET (0x00000000)
  19. #define NES_SLV_REG0_OFFSET (NES_USER_SLV_SPACE_OFFSET + 0x00000000)
  20. /**************************** Type Definitions *****************************/
  21. /***************** Macros (Inline Functions) Definitions *******************/
  22. /**
  23. *
  24. * Write a value to a NES register. A 32 bit write is performed.
  25. * If the component is implemented in a smaller width, only the least
  26. * significant data is written.
  27. *
  28. * @param BaseAddress is the base address of the NES device.
  29. * @param RegOffset is the register offset from the base to write to.
  30. * @param Data is the data written to the register.
  31. *
  32. * @return None.
  33. *
  34. * @note
  35. * C-style signature:
  36. * void NES_mWriteReg(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Data)
  37. *
  38. */
  39. #define NES_mWriteReg(BaseAddress, RegOffset, Data) \
  40. Xil_Out32((BaseAddress) + (RegOffset), (Xuint32)(Data))
  41. /**
  42. *
  43. * Read a value from a NES register. A 32 bit read is performed.
  44. * If the component is implemented in a smaller width, only the least
  45. * significant data is read from the register. The most significant data
  46. * will be read as 0.
  47. *
  48. * @param BaseAddress is the base address of the NES device.
  49. * @param RegOffset is the register offset from the base to write to.
  50. *
  51. * @return Data is the data from the register.
  52. *
  53. * @note
  54. * C-style signature:
  55. * Xuint32 NES_mReadReg(Xuint32 BaseAddress, unsigned RegOffset)
  56. *
  57. */
  58. #define NES_mReadReg(BaseAddress, RegOffset) \
  59. Xil_In32((BaseAddress) + (RegOffset))
  60. /**
  61. *
  62. * Write/Read 32 bit value to/from NES user logic slave registers.
  63. *
  64. * @param BaseAddress is the base address of the NES device.
  65. * @param RegOffset is the offset from the slave register to write to or read from.
  66. * @param Value is the data written to the register.
  67. *
  68. * @return Data is the data from the user logic slave register.
  69. *
  70. * @note
  71. * C-style signature:
  72. * void NES_mWriteSlaveRegn(Xuint32 BaseAddress, unsigned RegOffset, Xuint32 Value)
  73. * Xuint32 NES_mReadSlaveRegn(Xuint32 BaseAddress, unsigned RegOffset)
  74. *
  75. */
  76. #define NES_mWriteSlaveReg0(BaseAddress, RegOffset, Value) \
  77. Xil_Out32((BaseAddress) + (NES_SLV_REG0_OFFSET) + (RegOffset), (Xuint32)(Value))
  78. #define NES_mReadSlaveReg0(BaseAddress, RegOffset) \
  79. Xil_In32((BaseAddress) + (NES_SLV_REG0_OFFSET) + (RegOffset))
  80. /************************** Function Prototypes ****************************/
  81. /**
  82. *
  83. * Run a self-test on the driver/device. Note this may be a destructive test if
  84. * resets of the device are performed.
  85. *
  86. * If the hardware system is not built correctly, this function may never
  87. * return to the caller.
  88. *
  89. * @param baseaddr_p is the base address of the NES instance to be worked on.
  90. *
  91. * @return
  92. *
  93. * - XST_SUCCESS if all self-test code passed
  94. * - XST_FAILURE if any self-test code failed
  95. *
  96. * @note Caching must be turned off for this function to work.
  97. * @note Self test may fail if data memory and device are not on the same bus.
  98. *
  99. */
  100. XStatus NES_SelfTest(void * baseaddr_p);
  101. /**
  102. * Defines the number of registers available for read and write*/
  103. #define TEST_AXI_LITE_USER_NUM_REG 1
  104. #endif /** NES_H */