在开发FX3的时候,觉得赛普拉斯的库注释太少,很多时候无法理解代码含义。由于使用DMA,需要理解DMA生产者消费者代表的含义,经过多方查找,决定记录下来。
在cyu3dma.h中对SocketID进行了枚举,以下是其具体代码。
typedef enum CyU3PDmaSocketId_t
{
CY_U3P_LPP_SOCKET_I2S_LEFT = 0x0000, /**< Left channel output to I2S port. */
CY_U3P_LPP_SOCKET_I2S_RIGHT, /**< Right channel output to I2S port. */
CY_U3P_LPP_SOCKET_I2C_CONS, /**< Outgoing data to I2C slave. */
CY_U3P_LPP_SOCKET_UART_CONS, /**< Outgoing data to UART peer. */
CY_U3P_LPP_SOCKET_SPI_CONS, /**< Outgoing data to SPI slave. */
CY_U3P_LPP_SOCKET_I2C_PROD, /**< Incoming data from I2C slave. */
CY_U3P_LPP_SOCKET_UART_PROD, /**< Incoming data from UART peer. */
CY_U3P_LPP_SOCKET_SPI_PROD, /**< Incoming data from SPI slave. */ CY_U3P_PIB_SOCKET_0 = 0x0100, /**< P-port socket number 0. */
CY_U3P_PIB_SOCKET_1, /**< P-port socket number 1. */
CY_U3P_PIB_SOCKET_2, /**< P-port socket number 2. */
CY_U3P_PIB_SOCKET_3, /**< P-port socket number 3. */
CY_U3P_PIB_SOCKET_4, /**< P-port socket number 4. */
CY_U3P_PIB_SOCKET_5, /**< P-port socket number 5. */
CY_U3P_PIB_SOCKET_6, /**< P-port socket number 6. */
CY_U3P_PIB_SOCKET_7, /**< P-port socket number 7. */
CY_U3P_PIB_SOCKET_8, /**< P-port socket number 8. */
CY_U3P_PIB_SOCKET_9, /**< P-port socket number 9. */
CY_U3P_PIB_SOCKET_10, /**< P-port socket number 10. */
CY_U3P_PIB_SOCKET_11, /**< P-port socket number 11. */
CY_U3P_PIB_SOCKET_12, /**< P-port socket number 12. */
CY_U3P_PIB_SOCKET_13, /**< P-port socket number 13. */
CY_U3P_PIB_SOCKET_14, /**< P-port socket number 14. */
CY_U3P_PIB_SOCKET_15, /**< P-port socket number 15. */
CY_U3P_PIB_SOCKET_16, /**< P-port socket number 16. */
CY_U3P_PIB_SOCKET_17, /**< P-port socket number 17. */
CY_U3P_PIB_SOCKET_18, /**< P-port socket number 18. */
CY_U3P_PIB_SOCKET_19, /**< P-port socket number 19. */
CY_U3P_PIB_SOCKET_20, /**< P-port socket number 20. */
CY_U3P_PIB_SOCKET_21, /**< P-port socket number 21. */
CY_U3P_PIB_SOCKET_22, /**< P-port socket number 22. */
CY_U3P_PIB_SOCKET_23, /**< P-port socket number 23. */
CY_U3P_PIB_SOCKET_24, /**< P-port socket number 24. */
CY_U3P_PIB_SOCKET_25, /**< P-port socket number 25. */
CY_U3P_PIB_SOCKET_26, /**< P-port socket number 26. */
CY_U3P_PIB_SOCKET_27, /**< P-port socket number 27. */
CY_U3P_PIB_SOCKET_28, /**< P-port socket number 28. */
CY_U3P_PIB_SOCKET_29, /**< P-port socket number 29. */
CY_U3P_PIB_SOCKET_30, /**< P-port socket number 30. */
CY_U3P_PIB_SOCKET_31, /**< P-port socket number 31. */ CY_U3P_SIB_SOCKET_0 = 0x0200, /**< S-port socket number 0. */
CY_U3P_SIB_SOCKET_1, /**< S-port socket number 1. */
CY_U3P_SIB_SOCKET_2, /**< S-port socket number 2. */
CY_U3P_SIB_SOCKET_3, /**< S-port socket number 3. */
CY_U3P_SIB_SOCKET_4, /**< S-port socket number 4. */
CY_U3P_SIB_SOCKET_5, /**< S-port socket number 5. */ //U-port是指endpoint socket
CY_U3P_UIB_SOCKET_CONS_0 = 0x0300, /**< U-port output socket number 0. */
CY_U3P_UIB_SOCKET_CONS_1, /**< U-port output socket number 1. */
CY_U3P_UIB_SOCKET_CONS_2, /**< U-port output socket number 2. */
CY_U3P_UIB_SOCKET_CONS_3, /**< U-port output socket number 3. */
CY_U3P_UIB_SOCKET_CONS_4, /**< U-port output socket number 4. */
CY_U3P_UIB_SOCKET_CONS_5, /**< U-port output socket number 5. */
CY_U3P_UIB_SOCKET_CONS_6, /**< U-port output socket number 6. */
CY_U3P_UIB_SOCKET_CONS_7, /**< U-port output socket number 7. */
CY_U3P_UIB_SOCKET_CONS_8, /**< U-port output socket number 8. */
CY_U3P_UIB_SOCKET_CONS_9, /**< U-port output socket number 9. */
CY_U3P_UIB_SOCKET_CONS_10, /**< U-port output socket number 10. */
CY_U3P_UIB_SOCKET_CONS_11, /**< U-port output socket number 11. */
CY_U3P_UIB_SOCKET_CONS_12, /**< U-port output socket number 12. */
CY_U3P_UIB_SOCKET_CONS_13, /**< U-port output socket number 13. */
CY_U3P_UIB_SOCKET_CONS_14, /**< U-port output socket number 14. */
CY_U3P_UIB_SOCKET_CONS_15, /**< U-port output socket number 15. */ CY_U3P_UIB_SOCKET_PROD_0 = 0x400, /**< U-port input socket number 0. */
CY_U3P_UIB_SOCKET_PROD_1, /**< U-port input socket number 1. */
CY_U3P_UIB_SOCKET_PROD_2, /**< U-port input socket number 2. */
CY_U3P_UIB_SOCKET_PROD_3, /**< U-port input socket number 3. */
CY_U3P_UIB_SOCKET_PROD_4, /**< U-port input socket number 4. */
CY_U3P_UIB_SOCKET_PROD_5, /**< U-port input socket number 5. */
CY_U3P_UIB_SOCKET_PROD_6, /**< U-port input socket number 6. */
CY_U3P_UIB_SOCKET_PROD_7, /**< U-port input socket number 7. */
CY_U3P_UIB_SOCKET_PROD_8, /**< U-port input socket number 8. */
CY_U3P_UIB_SOCKET_PROD_9, /**< U-port input socket number 9. */
CY_U3P_UIB_SOCKET_PROD_10, /**< U-port input socket number 10. */
CY_U3P_UIB_SOCKET_PROD_11, /**< U-port input socket number 11. */
CY_U3P_UIB_SOCKET_PROD_12, /**< U-port input socket number 12. */
CY_U3P_UIB_SOCKET_PROD_13, /**< U-port input socket number 13. */
CY_U3P_UIB_SOCKET_PROD_14, /**< U-port input socket number 14. */
CY_U3P_UIB_SOCKET_PROD_15, /**< U-port input socket number 15. */ CY_U3P_CPU_SOCKET_CONS = 0x3F00, /**< Socket through which the FX3 CPU receives data. */
CY_U3P_CPU_SOCKET_PROD /**< Socket through which the FX3 CPU produces data. */ } CyU3PDmaSocketId_t;
其中:
LPP_SOCKET是指 外设硬件端口,如CY_U3P_LPP_SOCKET_UART_PROD就代表UART的 RX 端口,而CY_U3P_LPP_SOCKET_UART_CONS就代表TX,因为数据要从TX端口发送。
P-PORT 是指FX3中的GPIF端口
S-PORT 是指FX3专门为SD/MMC卡准备的端口
U-PORT 是指USB端口,或者说是Endpoint Socket端口
CPU_SOCKET是指 FX3的CPU所收到的数据储存的端口