AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
ntv2linuxpublicinterface.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #ifndef NTV2LINUXPUBLICINTERFACE_H
8 #define NTV2LINUXPUBLICINTERFACE_H
9 
10 #include "ajatypes.h"
11 #include "ntv2enums.h"
12 #include "ntv2publicinterface.h"
13 
14 #define NTV2_DEVICE_TYPE 0xBB
15 
16 #define NTV2_LINUX_DRIVER_VERSION NTV2DriverVersionEncodedBuildType | NTV2DriverVersionEncode(AJA_NTV2_SDK_VERSION_MAJOR, AJA_NTV2_SDK_VERSION_MINOR, AJA_NTV2_SDK_VERSION_POINT, AJA_NTV2_SDK_BUILD_NUMBER)
17 
18 
19 // Read,Write IOCTL's
20  // Input: REGISTER_ACCESS structure
21  // Output: NONE
22 #define IOCTL_NTV2_WRITE_REGISTER \
23  _IOW(NTV2_DEVICE_TYPE, 48, REGISTER_ACCESS)
24 
25  // Input: REGISTER_ACCESS structure
26  // Output: REGISTER_ACCESS structure
27 #define IOCTL_NTV2_READ_REGISTER \
28  _IOWR(NTV2_DEVICE_TYPE, 49 , REGISTER_ACCESS)
29 
30 // DMA Ioctls use METHOD_IN_DIRECT ... thus special macro NTV2_MAKE_IN_DIRECT_IOCTL
31 #define IOCTL_NTV2_DMA_READ_FRAME \
32  _IOW(NTV2_DEVICE_TYPE, 146,NTV2_DMA_CONTROL_STRUCT)
33 
34 #define IOCTL_NTV2_DMA_WRITE_FRAME \
35  _IOW(NTV2_DEVICE_TYPE, 147,NTV2_DMA_CONTROL_STRUCT)
36 
37 #define IOCTL_NTV2_DMA_READ_FRAME_SEGMENT \
38  _IOW(NTV2_DEVICE_TYPE, 148,NTV2_DMA_SEGMENT_CONTROL_STRUCT)
39 
40 #define IOCTL_NTV2_DMA_WRITE_FRAME_SEGMENT \
41  _IOW(NTV2_DEVICE_TYPE, 149,NTV2_DMA_SEGMENT_CONTROL_STRUCT)
42 
43 // DMA Ioctls use METHOD_IN_DIRECT ... thus special macro NTV2_MAKE_IN_DIRECT_IOCTL
44 #define IOCTL_NTV2_DMA_READ \
45  _IOW(NTV2_DEVICE_TYPE, 175,NTV2_DMA_CONTROL_STRUCT)
46 
47 #define IOCTL_NTV2_DMA_WRITE \
48  _IOW(NTV2_DEVICE_TYPE, 176,NTV2_DMA_CONTROL_STRUCT)
49 
50 #define IOCTL_NTV2_DMA_READ_SEGMENT \
51  _IOW(NTV2_DEVICE_TYPE, 177,NTV2_DMA_SEGMENT_CONTROL_STRUCT)
52 
53 #define IOCTL_NTV2_DMA_WRITE_SEGMENT \
54  _IOW(NTV2_DEVICE_TYPE, 178,NTV2_DMA_SEGMENT_CONTROL_STRUCT)
55 
56 #define IOCTL_NTV2_DMA_P2P \
57  _IOW(NTV2_DEVICE_TYPE, 179,NTV2_DMA_P2P_CONTROL_STRUCT)
58 
59 
60 // Interrupt control (enable, disable, get count)
61 //
62 #define IOCTL_NTV2_INTERRUPT_CONTROL \
63  _IOW(NTV2_DEVICE_TYPE, 220, NTV2_INTERRUPT_CONTROL_STRUCT)
64 
65 // Wait for interrupt
66 //
67 #define IOCTL_NTV2_WAITFOR_INTERRUPT \
68  _IOW(NTV2_DEVICE_TYPE, 221, NTV2_WAITFOR_INTERRUPT_STRUCT)
69 
70 // Control debug messages.
71 //
72 #define IOCTL_NTV2_CONTROL_DRIVER_DEBUG_MESSAGES \
73  _IOW(NTV2_DEVICE_TYPE, 230, NTV2_CONTROL_DRIVER_DEBUG_MESSAGES_STRUCT)
74 
75 // Put board interrupts and LEDs in known state
76 //
77 #define IOCTL_NTV2_SETUP_BOARD \
78  _IO(NTV2_DEVICE_TYPE, 231)
79 
80 // Reload procamp hardware registers from software copy after ADC chip reset
81 #define IOCTL_NTV2_RESTORE_HARDWARE_PROCAMP_REGISTERS \
82  _IO(NTV2_DEVICE_TYPE, 232)
83 
84 //
85 // Downloaded Xilinx bitfile management IOCTLs
86 //
87 //
88 #define IOCTL_NTV2_SET_BITFILE_INFO \
89  _IOWR(NTV2_DEVICE_TYPE, 240, BITFILE_INFO_STRUCT)
90 
91 #define IOCTL_NTV2_GET_BITFILE_INFO \
92  _IOWR(NTV2_DEVICE_TYPE, 241, BITFILE_INFO_STRUCT)
93 
94 //
95 // Autocirculate IOCTLs
96 //
97 //
98 #define IOCTL_NTV2_AUTOCIRCULATE_CONTROL \
99  _IOW(NTV2_DEVICE_TYPE, 250, AUTOCIRCULATE_DATA)
100 
101 #define IOCTL_NTV2_AUTOCIRCULATE_STATUS \
102  _IOWR(NTV2_DEVICE_TYPE, 251, AUTOCIRCULATE_STATUS_STRUCT)
103 
104 #define IOCTL_NTV2_AUTOCIRCULATE_FRAMESTAMP \
105  _IOWR(NTV2_DEVICE_TYPE, 252, AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT)
106 
107 #define IOCTL_NTV2_AUTOCIRCULATE_TRANSFER \
108  _IOWR(NTV2_DEVICE_TYPE, 253, AUTOCIRCULATE_TRANSFER_COMBO_STRUCT)
109 
110 #define IOCTL_NTV2_AUTOCIRCULATE_CAPTURETASK \
111  _IOWR(NTV2_DEVICE_TYPE, 254, AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT)
112 
113 #define IOCTL_AJANTV2_MESSAGE \
114  _IOWR(NTV2_DEVICE_TYPE, 255, AUTOCIRCULATE_STATUS)
115 
116 //
117 // UART Write/Read IOCTLs
118 //
119 #define IOCTL_NTV2_WRITE_UART_TX \
120  _IOWR(NTV2_DEVICE_TYPE, 201, NTV2_UART_STRUCT)
121 
122 #if 0 /* not yet */
123 #define IOCTL_NTV2_READ_UART_RX \
124  _IOWR(NTV2_DEVICE_TYPE, 202, NTV2_UART_STRUCT)
125 #endif
126 
127 
128 // When adding new IOCTLs, note that the number is only 8 bits.
129 // So don't go above 255.
130 
131 // Structure used to request an address range
132 typedef struct _MAP_MEMORY {
133  void* Address;
134  ULWord Length;
136 
137 
138 typedef struct {
139  ULWord RegisterNumber;
140  ULWord RegisterValue;
144 
145 // Virtual registers
146 #include "ntv2virtualregisters.h"
147 
148 // Structure used to request a DMA transfer
149 typedef struct
150 {
151  NTV2DMAEngine engine;
152  NTV2Channel dmaChannel;
153  ULWord frameNumber; // 0-NUM_FRAMEBUFFERS-1
154  PULWord frameBuffer; // if small integer, then interpreted as DMA driver buffer # in
155  // driver(i.e. GetDMABufferAddress)
156  ULWord frameOffsetSrc; // For Audio DMA, we want to write from a specific location within the 'frame'
157  ULWord frameOffsetDest; // For Audio DMA, we want to write to a specific location within the 'frame'
158  ULWord numBytes; // number of bytes to transfer
159  ULWord downSample; // applies only to KHD, used for 1/4 size preview
160  ULWord linePitch; // applies only if downSample true, gets every linePitch lines
161  ULWord poll; // if poll = true it doesn't block, needs to be checked manually
163 
164 // Structure used to request a DMA transfer
165 typedef struct
166 {
167  NTV2DMAEngine engine;
168  NTV2Channel dmaChannel;
169  ULWord frameNumber; // 0-NUM_FRAMEBUFFERS-1
170  PULWord frameBuffer; // if small integer, then interpreted as DMA driver buffer # in
171  // driver(i.e. GetDMABufferAddress)
172  ULWord frameOffsetSrc; // For Audio DMA, we want to write from a specific location within the 'frame'
173  ULWord frameOffsetDest; // For Audio DMA, we want to write to a specific location within the 'frame'
174  ULWord numBytes; // number of bytes to transfer
175  ULWord poll; // if poll = true it doesn't block, needs to be checked manually
176  ULWord videoNumSegments; // partial segment transfer - number of segment of size numBytes
177  ULWord videoSegmentHostPitch; //
178  ULWord videoSegmentCardPitch; //
180 
181 // Structure used to request a P2P transfer
182 typedef struct {
183  bool bRead; // True for a Target operation, false for a Transfer
184  NTV2DMAEngine dmaEngine; // engine for transfer
185  NTV2Channel dmaChannel; // frame buffer channel for message
186  ULWord ulFrameNumber; // frame number for target/transfer
187  ULWord ulFrameOffset; // offset into frame to start transfer
188  ULWord ulVidNumBytes; // transfer size in bytes
189  ULWord ulVidNumSegments; // number of video segments to transfer
190  ULWord ulVidSegmentHostPitch; // segment host pitch
191  ULWord ulVidSegmentCardPitch; // segment card pitch
192  ULWord64 ullVideoBusAddress; // frame buffer bus address
193  ULWord64 ullMessageBusAddress; // message register bus address (0 if not required)
194  ULWord ulVideoBusSize; // size of the video aperture (bytes)
195  ULWord ulMessageData; // message data (write to message bus address to complete video transfer)
197 
198 // Structure to enable/disable interrupts
199 typedef struct
200 {
201  INTERRUPT_ENUMS eInterruptType; // Which interrupt to enable/disable. Not all interrupts supported.
202  ULWord enable; // 0: disable, nonzero: enable
203  ULWord interruptCount; // In: interrupt type. Out: interrupt count
205 
206 // Structure to wait for interrupts
207 typedef struct
208 {
209  INTERRUPT_ENUMS eInterruptType; // Which interrupt to wait on.
210  ULWord timeOutMs; // Timeout in milliseconds
211  ULWord success; // On return, nonzero if interrupt occured
213 
214 // Structure to control driver debug messages
215 typedef struct
216 {
217  NTV2_DriverDebugMessageSet msgSet; // Which set of message to turn on/off
218  bool enable; // If true, turn messages on
219  ULWord success;// On return, nonzero on failure
221 
222 typedef struct
223 {
224  NTV2Crosspoint channelSpec;// Which channel
225  AUTOCIRCULATE_TRANSFER_STRUCT acTransfer; // Transfer ctl
226  AUTOCIRCULATE_TRANSFER_STATUS_STRUCT acStatus; // Results
227  NTV2RoutingTable acXena2RoutingTable; // Xena2 crosspoint table
228  AUTOCIRCULATE_TASK_STRUCT acTask; // driver tasks
230 
231 typedef struct
232 {
233  FRAME_STAMP_STRUCT acFrameStamp; // frame stamp
234  AUTOCIRCULATE_TASK_STRUCT acTask; // driver tasks
236 
237 /*
238 typedef struct
239 {
240  ULWord requestedByteCount; // number of bytes to write OR MAX number of bytes to read
241  ULWord actualByteCount; // actual number of byte successfully written or read
242  UByte bytes[]; // WRITE: an array of bytes to write of size requestedByteCount
243  // READ: an empty array of MAX size requestedByteCount into which the read goes
244 } NTV2_UART_STRUCT, *P_NTV2_UART_STRUCT;
245 */
246 
247 // Driver buffers are numbered 0 .. whatever
248 #define ntv2DMADriverbuffer(n) (n)
249 
250 
251 #define IOCTL_HEVC_MESSAGE \
252  _IOWR(NTV2_DEVICE_TYPE, 120, unsigned long)
253 
254 #endif
struct REGISTER_ACCESS * PREGISTER_ACCESS
NTV2Crosspoint
Logically, these are an NTV2Channel combined with an NTV2Mode.
Definition: ntv2enums.h:1700
uint32_t * PULWord
Definition: ajatypes.h:224
struct NTV2_CONTROL_DRIVER_DEBUG_MESSAGES_STRUCT * P_NTV2_CONTROL_DRIVER_DEBUG_MESSAGES_STRUCT
NTV2_DriverDebugMessageSet
Definition: ntv2enums.h:3829
uint32_t ULWord
Definition: ajatypes.h:223
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They're also commonly use...
Definition: ntv2enums.h:1357
struct _MAP_MEMORY MAP_MEMORY
struct AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT * P_AUTOCIRCULATE_FRAME_STAMP_COMBO_STRUCT
struct NTV2_INTERRUPT_CONTROL_STRUCT * P_NTV2_INTERRUPT_CONTROL_STRUCT
struct AUTOCIRCULATE_TRANSFER_COMBO_STRUCT * P_AUTOCIRCULATE_TRANSFER_COMBO_STRUCT
Enumerations for controlling NTV2 devices.
struct NTV2_DMA_CONTROL_STRUCT * P_NTV2_DMA_CONTROL_STRUCT
NTV2DMAEngine
Definition: ntv2enums.h:1856
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
uint64_t ULWord64
Definition: ajatypes.h:226
struct _MAP_MEMORY * PMAP_MEMORY
struct NTV2_DMA_P2P_CONTROL_STRUCT * P_NTV2_DMA_P2P_CONTROL_STRUCT
struct NTV2_WAITFOR_INTERRUPT_STRUCT * P_NTV2_WAITFOR_INTERRUPT_STRUCT
struct NTV2_DMA_SEGMENT_CONTROL_STRUCT * P_NTV2_DMA_SEGMENT_CONTROL_STRUCT
Declares enums and structs used by all platform drivers and the SDK.
Declares enums for virtual registers used in all platform drivers and the SDK.