BEST PCIe driver
 All Data Structures Files Functions Variables Macros Pages
descriptor_regs.h
1 /*
2  Descriptor formats:
3 
4  Standard Format:
5 
6  Offset | 3 2 1 0
7  --------------------------------------------------------------------------------------
8  0x0 | Read Address[31..0]
9  0x4 | Write Address[31..0]
10  0x8 | Length[31..0]
11  0xC | Control[31..0]
12 
13  Extended Format:
14 
15  Offset | 3 2 1 0
16  -------------------------------------------------------------------------------------------------------------------
17  0x0 | Read Address[31..0]
18  0x4 | Write Address[31..0]
19  0x8 | Length[31..0]
20  0xC | Write Burst Count[7..0] | Read Burst Count[7..0] | Sequence Number[15..0]
21  0x10 | Write Stride[15..0] | Read Stride[15..0]
22  0x14 | Read Address[63..32]
23  0x18 | Write Address[63..32]
24  0x1C | Control[31..0]
25 
26  Note: The control register moves from offset 0xC to 0x1C depending on the format used
27 
28 */
29 
30 
31 #ifndef DESCRIPTOR_REGS_H_
32 #define DESCRIPTOR_REGS_H_
33 
34 //#include "io.h"
35 
36 #define DESCRIPTOR_READ_ADDRESS_REG (0x0)
37 #define DESCRIPTOR_WRITE_ADDRESS_REG (0x4)
38 #define DESCRIPTOR_LENGTH_REG (0x8)
39 #define DESCRIPTOR_CONTROL_STANDARD_REG (0xC)
40 #define DESCRIPTOR_SEQUENCE_NUMBER_REG (0xC)
41 #define DESCRIPTOR_READ_BURST_REG (0xE)
42 #define DESCRIPTOR_WRITE_BURST_REG (0xF)
43 #define DESCRIPTOR_READ_STRIDE_REG (0x10)
44 #define DESCRIPTOR_WRITE_STRIDE_REG (0x12)
45 #define DESCRIPTOR_READ_ADDRESS_HIGH_REG (0x14)
46 #define DESCRIPTOR_WRITE_ADDRESS_HIGH_REG (0x18)
47 #define DESCRIPTOR_CONTROL_ENHANCED_REG (0x1C)
48 
49 
50 // masks and offsets for the sequence number and programmable burst counts
51 #define DESCRIPTOR_SEQUENCE_NUMBER_MASK (0xFFFF)
52 #define DESCRIPTOR_SEQUENCE_NUMBER_OFFSET (0)
53 #define DESCRIPTOR_READ_BURST_COUNT_MASK (0x00FF0000)
54 #define DESCRIPTOR_READ_BURST_COUNT_OFFSET (16)
55 #define DESCRIPTOR_WRITE_BURST_COUNT_MASK (0xFF000000)
56 #define DESCRIPTOR_WRITE_BURST_COUNT_OFFSET (24)
57 
58 
59 // masks and offsets for the read and write strides
60 #define DESCRIPTOR_READ_STRIDE_MASK (0xFFFF)
61 #define DESCRIPTOR_READ_STRIDE_OFFSET (0)
62 #define DESCRIPTOR_WRITE_STRIDE_MASK (0xFFFF0000)
63 #define DESCRIPTOR_WRITE_STRIDE_OFFSET (16)
64 
65 
66 // masks and offsets for the bits in the descriptor control field
67 #define DESCRIPTOR_CONTROL_TRANSMIT_CHANNEL_MASK (0xFF)
68 #define DESCRIPTOR_CONTROL_TRANSMIT_CHANNEL_OFFSET (0)
69 #define DESCRIPTOR_CONTROL_GENERATE_SOP_MASK (1<<8)
70 #define DESCRIPTOR_CONTROL_GENERATE_SOP_OFFSET (8)
71 #define DESCRIPTOR_CONTROL_GENERATE_EOP_MASK (1<<9)
72 #define DESCRIPTOR_CONTROL_GENERATE_EOP_OFFSET (9)
73 #define DESCRIPTOR_CONTROL_PARK_READS_MASK (1<<10)
74 #define DESCRIPTOR_CONTROL_PARK_READS_OFFSET (10)
75 #define DESCRIPTOR_CONTROL_PARK_WRITES_MASK (1<<11)
76 #define DESCRIPTOR_CONTROL_PARK_WRITES_OFFSET (11)
77 #define DESCRIPTOR_CONTROL_END_ON_EOP_MASK (1<<12)
78 #define DESCRIPTOR_CONTROL_END_ON_EOP_OFFSET (12)
79 #define DESCRIPTOR_CONTROL_TRANSFER_COMPLETE_IRQ_MASK (1<<14)
80 #define DESCRIPTOR_CONTROL_TRANSFER_COMPLETE_IRQ_OFFSET (14)
81 #define DESCRIPTOR_CONTROL_EARLY_TERMINATION_IRQ_MASK (1<<15)
82 #define DESCRIPTOR_CONTROL_EARLY_TERMINATION_IRQ_OFFSET (15)
83 #define DESCRIPTOR_CONTROL_ERROR_IRQ_MASK (0xFF<<16) // the read master will use this as the transmit error, the dispatcher will use this to generate an interrupt if any of the error bits are asserted by the write master
84 #define DESCRIPTOR_CONTROL_ERROR_IRQ_OFFSET (16)
85 #define DESCRIPTOR_CONTROL_EARLY_DONE_ENABLE_MASK (1<<24)
86 #define DESCRIPTOR_CONTROL_EARLY_DONE_ENABLE_OFFSET (24)
87 #define DESCRIPTOR_CONTROL_GO_MASK (1<<31) // at a minimum you always have to write '1' to this bit as it commits the descriptor to the dispatcher
88 #define DESCRIPTOR_CONTROL_GO_OFFSET (31)
89 
90 
91 /* Each register is byte lane accessible so the some of the values that are
92  * less than 32 bits wide are written to according to the field width.
93  */
94 /*
95 #define WR_DESCRIPTOR_READ_ADDRESS(base, data) IOWR_32DIRECT(base, DESCRIPTOR_READ_ADDRESS_REG, data)
96 #define WR_DESCRIPTOR_WRITE_ADDRESS(base, data) IOWR_32DIRECT(base, DESCRIPTOR_WRITE_ADDRESS_REG, data)
97 #define WR_DESCRIPTOR_LENGTH(base, data) IOWR_32DIRECT(base, DESCRIPTOR_LENGTH_REG, data)
98 #define WR_DESCRIPTOR_CONTROL_STANDARD(base, data) IOWR_32DIRECT(base, DESCRIPTOR_CONTROL_STANDARD_REG, data) // this pushes the descriptor into the read/write FIFOs when standard descriptors are used
99 #define WR_DESCRIPTOR_SEQUENCE_NUMBER(base, data) IOWR_16DIRECT(base, DESCRIPTOR_SEQUENCE_NUMBER_REG, data)
100 #define WR_DESCRIPTOR_READ_BURST(base, data) IOWR_8DIRECT(base, DESCRIPTOR_READ_BURST_REG, data)
101 #define WR_DESCRIPTOR_WRITE_BURST(base, data) IOWR_8DIRECT(base, DESCRIPTOR_WRITE_BURST_REG, data)
102 #define WR_DESCRIPTOR_READ_STRIDE(base, data) IOWR_16DIRECT(base, DESCRIPTOR_READ_STRIDE_REG, data)
103 #define WR_DESCRIPTOR_WRITE_STRIDE(base, data) IOWR_16DIRECT(base, DESCRIPTOR_WRITE_STRIDE_REG, data)
104 #define WR_DESCRIPTOR_READ_ADDRESS_HIGH(base, data) IOWR_32DIRECT(base, DESCRIPTOR_READ_ADDRESS_HIGH_REG, data)
105 #define WR_DESCRIPTOR_WRITE_ADDRESS_HIGH(base, data) IOWR_32DIRECT(base, DESCRIPTOR_WRITE_ADDRESS_HIGH_REG, data)
106 #define WR_DESCRIPTOR_CONTROL_ENHANCED(base, data) IOWR_32DIRECT(base, DESCRIPTOR_CONTROL_ENHANCED_REG, data) // this pushes the descriptor into the read/write FIFOs when the extended descriptors are used
107 */
108 
109 #endif /*DESCRIPTOR_REGS_H_*/