Files
Matthias Biermann d126a6cb1d Typo in Headdatei
2025-02-14 16:18:22 +01:00

81 lines
3.6 KiB
C

#ifndef AXI_CRC_DMA_H_
#define AXI_CRC_DMA_H_
#include <stdint.h>
#include <stdbool.h>
// -------------------------------------------------------------------------------------------------
// 0x00 - Control Register:
// 0 : Run
// 1 : Interrupt Enable
// 31..2 : Reserved
// -------------------------------------------------------------------------------------------------
// 0x04 - Interrupt Status Register:
// 0 : Interrupt Status
// 31..1 : Reserved
// -------------------------------------------------------------------------------------------------
// 0x08 - Read Address Register:
// 31..0 : First address of data packets
// -------------------------------------------------------------------------------------------------
// 0x0C - Write Address Register:
// 31..0 : Address to write packets + checksum to
// -------------------------------------------------------------------------------------------------
// 0x10 - Packet Size Register:
// 15.. 0 : Packets Size in words minus 1
// 31..16 : Reserved
// -------------------------------------------------------------------------------------------------
// 0x14 - Number Packets Register:
// 15.. 0 : Number of packets minus 1
// 31..16 : Reserved
// -------------------------------------------------------------------------------------------------
// 0x18 - Polynomial Register:
// 31..0 : Polynomial
// -------------------------------------------------------------------------------------------------
// 0x1C - Initial Value Register:
// 31..0 : Initial Value
// -------------------------------------------------------------------------------------------------
// 0x20 - Final XOR Register:
// 31..0 : Final XOR Value
// -------------------------------------------------------------------------------------------------
// 0x24 - InOutReflected Register:
// 0 : Input Reflected
// 1 : Output Reflected
// 31..2 : Reserved
// -------------------------------------------------------------------------------------------------
// 0x28 - AxCache Register:
// 3.. 0 : AWCache for M_AXI Write
// 7.. 4 : ARCache for M_AXI Read
// 31..8 : Reserved
// -------------------------------------------------------------------------------------------------
typedef struct
{
volatile uint32_t Control; // [0] Run, [1] INT Enable
volatile uint32_t InterruptStatus; // [0] INT Status
volatile uint32_t ReadAddress; // [31:0] Read Address of Data
volatile uint32_t WriteAddress; // [31:0] Write Address of Data + CRC Checksums
volatile uint32_t PacketSize; // [15:0] Size of Packets Minus 1 in 32 Bit words
volatile uint32_t NumberPackets; // [15:0] Number of Packets Minus 1
volatile uint32_t Polynomial; // [31:0] Polynomial for CRC Calculation
volatile uint32_t InitialValue; // [31:0] Initial Value of CRC Calculation
volatile uint32_t FinalXOR; // [31:0] Final XOR Value
volatile uint32_t InOutReflected; // [0] Input Reflected, [1] Output Reflected
volatile uint32_t AxCache; // [3:0] M_AXI AWCache, [7:4] M_AXI ARCache
} CRC_DMA_Typedef;
typedef CRC_DMA_Typedef *PCRC_DMA_Typedef;
typedef struct
{
uint32_t Polynomial;
uint32_t InitalValue;
uint32_t FinalXOR;
bool InputReflected;
bool OutputReflected;
} CrcParameterSet;
// load a specific set of CRC parameters into Hardware
void CRC_DMA_set_parameters(PCRC_DMA_Typedef baseAddr, const CrcParameterSet* parameterSet);
#endif /* AXI_CRC_DMA_H_ */