⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xbuf_descriptor.h

📁 linux嵌入式系统的dma方式的实现代码
💻 H
📖 第 1 页 / 共 3 页
字号:
** @return** The flags field of the buffer descriptor.  The field may contain one or more* of the following values which are bit masks.*                               <br><br>* - XBD_FLAGS_LOCKED_MASK       Indicates the buffer descriptor is locked** @note** None.*******************************************************************************/#define XBufDescriptor_GetFlags(InstancePtr) \    (Xuint32)(*((Xuint32 *)InstancePtr + XBD_FLAGS_OFFSET))/*****************************************************************************//**** This function sets the flags field of the buffer descriptor.  The flags* field is not used by the DMA channel hardware and is used for software* processing of buffer descriptors.** @param** InstancePtr points to the buffer descriptor to operate on.** @param** Flags contains the flags field for the buffer descriptor.  The field may* contain one or more of the following values which are bit masks.* - XBD_FLAGS_LOCKED_MASK       Indicates the buffer descriptor is locked** @return** None.** @note** None.*******************************************************************************/#define XBufDescriptor_SetFlags(InstancePtr, Flags) \    (*((Xuint32 *)InstancePtr + XBD_FLAGS_OFFSET) = (Xuint32)Flags)/*****************************************************************************//**** This function locks the buffer descriptor. A lock is specific to the* scatter gather processing and prevents a buffer descriptor from being* overwritten in the scatter gather list.  This field is not used by the DMA* channel hardware such that the hardware could still write to the buffer* descriptor.  Locking a buffer descriptor is application specific and not* necessary to allow the DMA channel to use the buffer descriptor, but is* provided for flexibility in designing device drivers.** @param** InstancePtr points to the buffer descriptor to operate on.** @return** None.** @note** None.*******************************************************************************/#define XBufDescriptor_Lock(InstancePtr) \    (*((Xuint32 *)InstancePtr + XBD_FLAGS_OFFSET) |= XBD_FLAGS_LOCKED_MASK)/*****************************************************************************//**** This function unlocks the buffer descriptor.  A lock is specific to the* scatter gather processing and prevents a buffer descriptor from being* overwritten in the scatter gather list.  This field is not used by the DMA* channel hardware such that the hardware could still write to the buffer* descriptor.  Locking a buffer descriptor is application specific and not* necessary to allow the DMA channel to use the buffer descriptor, but is* provided for flex ability in designing device drivers.** @param** InstancePtr points to the buffer descriptor to operate on.** @return** None.** @note** None.*******************************************************************************/#define XBufDescriptor_Unlock(InstancePtr) \    (*((Xuint32 *)InstancePtr + XBD_FLAGS_OFFSET) &= ~XBD_FLAGS_LOCKED_MASK)/*****************************************************************************//**** This function determines if the buffer descriptor is locked.  The lock* is not used by the DMA channel hardware and is used for software processing* of buffer descriptors.** @param** InstancePtr points to the buffer descriptor to operate on.** @return** XTRUE if the buffer descriptor is locked, otherwise XFALSE.** @note** None.*******************************************************************************/#define XBufDescriptor_IsLocked(InstancePtr) \    (Xboolean) ((*((Xuint32 *)InstancePtr + XBD_FLAGS_OFFSET) & \        XBD_FLAGS_LOCKED_MASK) == XBD_FLAGS_LOCKED_MASK)/*****************************************************************************//**** This function gets the Initial value for the CS offload function.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** The initial value that will be used for checksum offload operation as DMA* moves the data.** @note** None.*******************************************************************************/#define XBufDescriptor_GetCSInit(InstancePtr)\(*((Xuint32 *)InstancePtr + XBD_CONTROL_OFFSET) &= XDC_DMACR_TX_CS_INIT_MASK)/*****************************************************************************//**** This function Sets the Initial value for the CS offload function.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** None** @note** None.*******************************************************************************/#define XBufDescriptor_SetCSInit(InstancePtr, InitialValue)            \{                                                                   \    Xuint32 Register;                                               \    Register = (*((Xuint32 *)InstancePtr + XBD_CONTROL_OFFSET));     \    Register &= ~XDC_DMACR_TX_CS_INIT_MASK;                         \    (*((Xuint32 *)InstancePtr + XBD_CONTROL_OFFSET)) =               \              Register | ((Xuint32) (InitialValue));               \}/*****************************************************************************//**** This function gets the byte position where the CS offload function* inserts the calculated checksum.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** The insert byte location value that will be used to place the results of* the checksum offload.** @note** None.*******************************************************************************/#define XBufDescriptor_GetCSInsertLoc(InstancePtr)                     \(*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET) &= XDC_DAREG_CS_INSERT_MASK)/*****************************************************************************//**** This function sets the byte position where the CS offload function* inserts the calculated checksum.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** None** @note** None.*******************************************************************************/#define XBufDescriptor_SetCSInsertLoc(InstancePtr, InsertLocation)            \{                                                                   \    Xuint32 Register;                                               \    Register = (*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET));      \    Register &= ~XDC_DAREG_CS_INSERT_MASK;                         \    (*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET)) =                \              Register | ((Xuint32) (InsertLocation));             \}/*****************************************************************************//**** This function gets the byte position where the CS offload function* begins the calculation of the checksum.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** The insert byte location value that will be used to place the results of* the checksum offload.** @note** None.*******************************************************************************/#define XBufDescriptor_GetCSBegin(InstancePtr)                      \(Xuint16)((*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET)) >> 16)/*****************************************************************************//**** This function sets the byte position where the CS offload function* begins the calculation of the checksum.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** None** @note** None.*******************************************************************************/#define XBufDescriptor_SetCSBegin(InstancePtr, BeginLocation)               \{                                                                           \    Xuint32 Register;                                                       \    Register = (*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET));             \    Register &= ~XDC_DAREG_CS_BEGIN_MASK;                                 \    (*((Xuint32 *)InstancePtr + XBD_DESTINATION_OFFSET)) =                       \              Register | (((Xuint32) (BeginLocation)) << 16);               \}/*****************************************************************************//**** This function gets the resulting checksum from the rx channel.** @param** InstancePtr contains a pointer to the DMA channel to operate on.** @return** The raw checksum calculation from the receive operation. It needs to* be adjusted to remove the header and packet FCS to be correct.** @note** None.*******************************************************************************/#define XBufDescriptor_GetCSRaw(InstancePtr)                     \(Xuint16)((*((Xuint32 *)InstancePtr + XBD_DEVICE_STATUS_OFFSET)) >> 16)/************************** Function Prototypes ******************************//* The following prototypes are provided to allow each of the functions to * be implemented as a function rather than a macro, and to provide the * syntax to allow users to understand how to call the macros, they are * commented out to prevent linker errors *Xuint32 XBufDescriptor_Initialize(XBufDescriptor* InstancePtr);Xuint32 XBufDescriptor_GetControl(XBufDescriptor* InstancePtr);void XBufDescriptor_SetControl(XBufDescriptor* InstancePtr, Xuint32 Control);Xboolean XBufDescriptor_IsLastControl(XBufDescriptor* InstancePtr);void XBufDescriptor_SetLast(XBufDescriptor* InstancePtr);Xuint32 XBufDescriptor_GetLength(XBufDescriptor* InstancePtr);void XBufDescriptor_SetLength(XBufDescriptor* InstancePtr, Xuint32 Length);Xuint32 XBufDescriptor_GetStatus(XBufDescriptor* InstancePtr);void XBufDescriptor_SetStatus(XBufDescriptor* InstancePtr, Xuint32 Status);Xboolean XBufDescriptor_IsLastStatus(XBufDescriptor* InstancePtr);Xuint32 XBufDescriptor_GetDeviceStatus(XBufDescriptor* InstancePtr);void XBufDescriptor_SetDeviceStatus(XBufDescriptor* InstancePtr,                                    Xuint32 Status);Xuint32 XBufDescriptor_GetSrcAddress(XBufDescriptor* InstancePtr);void XBufDescriptor_SetSrcAddress(XBufDescriptor* InstancePtr,                                  Xuint32 SourceAddress);Xuint32 XBufDescriptor_GetDestAddress(XBufDescriptor* InstancePtr);void XBufDescriptor_SetDestAddress(XBufDescriptor* InstancePtr,                                   Xuint32 DestinationAddress);XBufDescriptor* XBufDescriptor_GetNextPtr(XBufDescriptor* InstancePtr);void XBufDescriptor_SetNextPtr(XBufDescriptor* InstancePtr,                               XBufDescriptor* NextPtr);Xuint32 XBufDescriptor_GetId(XBufDescriptor* InstancePtr);void XBufDescriptor_SetId(XBufDescriptor* InstancePtr, Xuint32 Id);Xuint32 XBufDescriptor_GetFlags(XBufDescriptor* InstancePtr);void XBufDescriptor_SetFlags(XBufDescriptor* InstancePtr, Xuint32 Flags);void XBufDescriptor_Lock(XBufDescriptor* InstancePtr);void XBufDescriptor_Unlock(XBufDescriptor* InstancePtr);Xboolean XBufDescriptor_IsLocked(XBufDescriptor* InstancePtr);Xuint16 XBufDescriptor_GetCSInit(XBufDescriptor* InstancePtr)void XBufDescriptor_SetCSInit(XBufDescriptor* InstancePtr, Xuint16 InitialValue)Xuint16 XBufDescriptor_GetCSInsertLoc(XBufDescriptor* InstancePtr)void XBufDescriptor_SetCSInsertLoc(XBufDescriptor* InstancePtr, Xuint16 InsertLocation)Xuint16 XBufDescriptor_GetCSBegin(XBufDescriptor* InstancePtr)void XBufDescriptor_SetCSBegin(XBufDescriptor* InstancePtr, Xuint16 BeginLocation)Xuint16 XBufDescriptor_GetCSRaw(XBufDescriptor* InstancePtr)void XBufDescriptor_Copy(XBufDescriptor* InstancePtr,                         XBufDescriptor* DestinationPtr);*/#ifdef __cplusplus}#endif#endif              /* end of protection macro */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -