20 #include <sysSymTbl.h>
21 MODULE_ID VxLoadLibraryFromPath(
const char* path,
int flags);
22 STATUS VxFreeLibrary(MODULE_ID library,
int flags);
35 #define NiFpga_CCall __cdecl
36 #define NiFpga_StdCall __stdcall
39 #define NiFpga_StdCall
46 static HMODULE NiFpga_library = NULL;
48 static MODULE_ID NiFpga_library = NULL;
50 static void* NiFpga_library = NULL;
58 #if NiFpga_Cvi && NiFpga_Windows
59 #define NiFpga_CviResourceTracking 1
61 static char*
const NiFpga_cviResourceType =
"FPGA Interface C API";
63 typedef void* (NiFpga_CCall *NiFpga_AcquireCviResource)(
void* resource,
68 static NiFpga_AcquireCviResource NiFpga_acquireCviResource = NULL;
70 typedef void* (NiFpga_StdCall *NiFpga_ReleaseCviResource)(
void* resource);
72 static NiFpga_ReleaseCviResource NiFpga_releaseCviResource = NULL;
78 static NiFpga_Status (NiFpga_CCall *NiFpga_open)(
80 const char* signature,
83 NiFpga_Session* session) = NULL;
85 NiFpga_Status NiFpga_Open(
const char* path,
86 const char* signature,
89 NiFpga_Session* session)
91 const NiFpga_Status result = NiFpga_open
97 : NiFpga_Status_ResourceNotInitialized;
98 #if NiFpga_CviResourceTracking
99 if (NiFpga_acquireCviResource
100 && NiFpga_IsNotError(result))
101 NiFpga_acquireCviResource((
void*)*session,
102 NiFpga_cviResourceType,
103 "NiFpga_Session %#08x",
109 static NiFpga_Status (NiFpga_CCall *NiFpga_close)(
110 NiFpga_Session session,
111 uint32_t attribute) = NULL;
113 NiFpga_Status NiFpga_Close(NiFpga_Session session,
117 return NiFpga_Status_ResourceNotInitialized;
118 #if NiFpga_CviResourceTracking
119 if (NiFpga_releaseCviResource)
120 NiFpga_releaseCviResource((
void*)session);
122 return NiFpga_close(session, attribute);
128 static NiFpga_Status (NiFpga_CCall *NiFpga_run)(
129 NiFpga_Session session,
130 uint32_t attribute) = NULL;
132 NiFpga_Status NiFpga_Run(NiFpga_Session session,
136 ? NiFpga_run(session, attribute)
137 : NiFpga_Status_ResourceNotInitialized;
140 static NiFpga_Status (NiFpga_CCall *NiFpga_abort)(
141 NiFpga_Session session) = NULL;
143 NiFpga_Status NiFpga_Abort(NiFpga_Session session)
146 ? NiFpga_abort(session)
147 : NiFpga_Status_ResourceNotInitialized;
150 static NiFpga_Status (NiFpga_CCall *NiFpga_reset)(
151 NiFpga_Session session) = NULL;
153 NiFpga_Status NiFpga_Reset(NiFpga_Session session)
156 ? NiFpga_reset(session)
157 : NiFpga_Status_ResourceNotInitialized;
160 static NiFpga_Status (NiFpga_CCall *NiFpga_download)(
161 NiFpga_Session session) = NULL;
163 NiFpga_Status NiFpga_Download(NiFpga_Session session)
165 return NiFpga_download
166 ? NiFpga_download(session)
167 : NiFpga_Status_ResourceNotInitialized;
173 static NiFpga_Status (NiFpga_CCall *NiFpga_readBool)(
174 NiFpga_Session session,
176 NiFpga_Bool* value) = NULL;
178 NiFpga_Status NiFpga_ReadBool(NiFpga_Session session,
182 return NiFpga_readBool
183 ? NiFpga_readBool(session, indicator, value)
184 : NiFpga_Status_ResourceNotInitialized;
187 static NiFpga_Status (NiFpga_CCall *NiFpga_readI8)(
188 NiFpga_Session session,
190 int8_t* value) = NULL;
192 NiFpga_Status NiFpga_ReadI8(NiFpga_Session session,
197 ? NiFpga_readI8(session, indicator, value)
198 : NiFpga_Status_ResourceNotInitialized;
201 static NiFpga_Status (NiFpga_CCall *NiFpga_readU8)(
202 NiFpga_Session session,
204 uint8_t* value) = NULL;
206 NiFpga_Status NiFpga_ReadU8(NiFpga_Session session,
211 ? NiFpga_readU8(session, indicator, value)
212 : NiFpga_Status_ResourceNotInitialized;
215 static NiFpga_Status (NiFpga_CCall *NiFpga_readI16)(
216 NiFpga_Session session,
218 int16_t* value) = NULL;
220 NiFpga_Status NiFpga_ReadI16(NiFpga_Session session,
224 return NiFpga_readI16
225 ? NiFpga_readI16(session, indicator, value)
226 : NiFpga_Status_ResourceNotInitialized;
229 static NiFpga_Status (NiFpga_CCall *NiFpga_readU16)(
230 NiFpga_Session session,
232 uint16_t* value) = NULL;
234 NiFpga_Status NiFpga_ReadU16(NiFpga_Session session,
238 return NiFpga_readU16
239 ? NiFpga_readU16(session, indicator, value)
240 : NiFpga_Status_ResourceNotInitialized;
243 static NiFpga_Status (NiFpga_CCall *NiFpga_readI32)(
244 NiFpga_Session session,
246 int32_t* value) = NULL;
248 NiFpga_Status NiFpga_ReadI32(NiFpga_Session session,
252 return NiFpga_readI32
253 ? NiFpga_readI32(session, indicator, value)
254 : NiFpga_Status_ResourceNotInitialized;
257 static NiFpga_Status (NiFpga_CCall *NiFpga_readU32)(
258 NiFpga_Session session,
260 uint32_t* value) = NULL;
262 NiFpga_Status NiFpga_ReadU32(NiFpga_Session session,
266 return NiFpga_readU32
267 ? NiFpga_readU32(session, indicator, value)
268 : NiFpga_Status_ResourceNotInitialized;
271 static NiFpga_Status (NiFpga_CCall *NiFpga_readI64)(
272 NiFpga_Session session,
274 int64_t* value) = NULL;
276 NiFpga_Status NiFpga_ReadI64(NiFpga_Session session,
280 return NiFpga_readI64
281 ? NiFpga_readI64(session, indicator, value)
282 : NiFpga_Status_ResourceNotInitialized;
285 static NiFpga_Status (NiFpga_CCall *NiFpga_readU64)(
286 NiFpga_Session session,
288 uint64_t* value) = NULL;
290 NiFpga_Status NiFpga_ReadU64(NiFpga_Session session,
294 return NiFpga_readU64
295 ? NiFpga_readU64(session, indicator, value)
296 : NiFpga_Status_ResourceNotInitialized;
302 static NiFpga_Status (NiFpga_CCall *NiFpga_writeBool)(
303 NiFpga_Session session,
305 NiFpga_Bool value) = NULL;
307 NiFpga_Status NiFpga_WriteBool(NiFpga_Session session,
311 return NiFpga_writeBool
312 ? NiFpga_writeBool(session, control, value)
313 : NiFpga_Status_ResourceNotInitialized;
316 static NiFpga_Status (NiFpga_CCall *NiFpga_writeI8)(
317 NiFpga_Session session,
319 int8_t value) = NULL;
321 NiFpga_Status NiFpga_WriteI8(NiFpga_Session session,
325 return NiFpga_writeI8
326 ? NiFpga_writeI8(session, control, value)
327 : NiFpga_Status_ResourceNotInitialized;
330 static NiFpga_Status (NiFpga_CCall *NiFpga_writeU8)(
331 NiFpga_Session session,
333 uint8_t value) = NULL;
335 NiFpga_Status NiFpga_WriteU8(NiFpga_Session session,
339 return NiFpga_writeU8
340 ? NiFpga_writeU8(session, control, value)
341 : NiFpga_Status_ResourceNotInitialized;
344 static NiFpga_Status (NiFpga_CCall *NiFpga_writeI16)(
345 NiFpga_Session session,
347 int16_t value) = NULL;
349 NiFpga_Status NiFpga_WriteI16(NiFpga_Session session,
353 return NiFpga_writeI16
354 ? NiFpga_writeI16(session, control, value)
355 : NiFpga_Status_ResourceNotInitialized;
358 static NiFpga_Status (NiFpga_CCall *NiFpga_writeU16)(
359 NiFpga_Session session,
361 uint16_t value) = NULL;
363 NiFpga_Status NiFpga_WriteU16(NiFpga_Session session,
367 return NiFpga_writeU16
368 ? NiFpga_writeU16(session, control, value)
369 : NiFpga_Status_ResourceNotInitialized;
372 static NiFpga_Status (NiFpga_CCall *NiFpga_writeI32)(
373 NiFpga_Session session,
375 int32_t value) = NULL;
377 NiFpga_Status NiFpga_WriteI32(NiFpga_Session session,
381 return NiFpga_writeI32
382 ? NiFpga_writeI32(session, control, value)
383 : NiFpga_Status_ResourceNotInitialized;
386 static NiFpga_Status (NiFpga_CCall *NiFpga_writeU32)(
387 NiFpga_Session session,
389 uint32_t value) = NULL;
391 NiFpga_Status NiFpga_WriteU32(NiFpga_Session session,
395 return NiFpga_writeU32
396 ? NiFpga_writeU32(session, control, value)
397 : NiFpga_Status_ResourceNotInitialized;
400 static NiFpga_Status (NiFpga_CCall *NiFpga_writeI64)(
401 NiFpga_Session session,
403 int64_t value) = NULL;
405 NiFpga_Status NiFpga_WriteI64(NiFpga_Session session,
409 return NiFpga_writeI64
410 ? NiFpga_writeI64(session, control, value)
411 : NiFpga_Status_ResourceNotInitialized;
414 static NiFpga_Status (NiFpga_CCall *NiFpga_writeU64)(
415 NiFpga_Session session,
417 uint64_t value) = NULL;
419 NiFpga_Status NiFpga_WriteU64(NiFpga_Session session,
423 return NiFpga_writeU64
424 ? NiFpga_writeU64(session, control, value)
425 : NiFpga_Status_ResourceNotInitialized;
431 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayBool)(
432 NiFpga_Session session,
437 NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session,
442 return NiFpga_readArrayBool
443 ? NiFpga_readArrayBool(session, indicator, array, size)
444 : NiFpga_Status_ResourceNotInitialized;
447 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI8)(
448 NiFpga_Session session,
453 NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session,
458 return NiFpga_readArrayI8
459 ? NiFpga_readArrayI8(session, indicator, array, size)
460 : NiFpga_Status_ResourceNotInitialized;
463 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU8)(
464 NiFpga_Session session,
469 NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session,
474 return NiFpga_readArrayU8
475 ? NiFpga_readArrayU8(session, indicator, array, size)
476 : NiFpga_Status_ResourceNotInitialized;
479 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI16)(
480 NiFpga_Session session,
485 NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session,
490 return NiFpga_readArrayI16
491 ? NiFpga_readArrayI16(session, indicator, array, size)
492 : NiFpga_Status_ResourceNotInitialized;
495 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU16)(
496 NiFpga_Session session,
501 NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session,
506 return NiFpga_readArrayU16
507 ? NiFpga_readArrayU16(session, indicator, array, size)
508 : NiFpga_Status_ResourceNotInitialized;
511 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI32)(
512 NiFpga_Session session,
517 NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session,
522 return NiFpga_readArrayI32
523 ? NiFpga_readArrayI32(session, indicator, array, size)
524 : NiFpga_Status_ResourceNotInitialized;
527 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU32)(
528 NiFpga_Session session,
533 NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session,
538 return NiFpga_readArrayU32
539 ? NiFpga_readArrayU32(session, indicator, array, size)
540 : NiFpga_Status_ResourceNotInitialized;
543 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayI64)(
544 NiFpga_Session session,
549 NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session,
554 return NiFpga_readArrayI64
555 ? NiFpga_readArrayI64(session, indicator, array, size)
556 : NiFpga_Status_ResourceNotInitialized;
559 static NiFpga_Status (NiFpga_CCall *NiFpga_readArrayU64)(
560 NiFpga_Session session,
565 NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session,
570 return NiFpga_readArrayU64
571 ? NiFpga_readArrayU64(session, indicator, array, size)
572 : NiFpga_Status_ResourceNotInitialized;
578 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayBool)(
579 NiFpga_Session session,
581 const NiFpga_Bool* array,
584 NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session,
586 const NiFpga_Bool* array,
589 return NiFpga_writeArrayBool
590 ? NiFpga_writeArrayBool(session, control, array, size)
591 : NiFpga_Status_ResourceNotInitialized;
594 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI8)(
595 NiFpga_Session session,
600 NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session,
605 return NiFpga_writeArrayI8
606 ? NiFpga_writeArrayI8(session, control, array, size)
607 : NiFpga_Status_ResourceNotInitialized;
610 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU8)(
611 NiFpga_Session session,
613 const uint8_t* array,
616 NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session,
618 const uint8_t* array,
621 return NiFpga_writeArrayU8
622 ? NiFpga_writeArrayU8(session, control, array, size)
623 : NiFpga_Status_ResourceNotInitialized;
626 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI16)(
627 NiFpga_Session session,
629 const int16_t* array,
632 NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session,
634 const int16_t* array,
637 return NiFpga_writeArrayI16
638 ? NiFpga_writeArrayI16(session, control, array, size)
639 : NiFpga_Status_ResourceNotInitialized;
642 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU16)(
643 NiFpga_Session session,
645 const uint16_t* array,
648 NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session,
650 const uint16_t* array,
653 return NiFpga_writeArrayU16
654 ? NiFpga_writeArrayU16(session, control, array, size)
655 : NiFpga_Status_ResourceNotInitialized;
658 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI32)(
659 NiFpga_Session session,
661 const int32_t* array,
664 NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session,
666 const int32_t* array,
669 return NiFpga_writeArrayI32
670 ? NiFpga_writeArrayI32(session, control, array, size)
671 : NiFpga_Status_ResourceNotInitialized;
674 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU32)(
675 NiFpga_Session session,
677 const uint32_t* array,
680 NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session,
682 const uint32_t* array,
685 return NiFpga_writeArrayU32
686 ? NiFpga_writeArrayU32(session, control, array, size)
687 : NiFpga_Status_ResourceNotInitialized;
690 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayI64)(
691 NiFpga_Session session,
693 const int64_t* array,
696 NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session,
698 const int64_t* array,
701 return NiFpga_writeArrayI64
702 ? NiFpga_writeArrayI64(session, control, array, size)
703 : NiFpga_Status_ResourceNotInitialized;
706 static NiFpga_Status (NiFpga_CCall *NiFpga_writeArrayU64)(
707 NiFpga_Session session,
709 const uint64_t* array,
712 NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session,
714 const uint64_t* array,
717 return NiFpga_writeArrayU64
718 ? NiFpga_writeArrayU64(session, control, array, size)
719 : NiFpga_Status_ResourceNotInitialized;
725 static NiFpga_Status (NiFpga_CCall *NiFpga_reserveIrqContext)(
726 NiFpga_Session session,
727 NiFpga_IrqContext* context) = NULL;
730 NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session,
731 NiFpga_IrqContext* context)
733 const NiFpga_Status result = NiFpga_reserveIrqContext
734 ? NiFpga_reserveIrqContext(session, context)
735 : NiFpga_Status_ResourceNotInitialized;
736 #if NiFpga_CviResourceTracking
737 if (NiFpga_acquireCviResource
738 && NiFpga_IsNotError(result))
739 NiFpga_acquireCviResource(*context,
740 NiFpga_cviResourceType,
741 "NiFpga_IrqContext 0x%p",
747 static NiFpga_Status (NiFpga_CCall *NiFpga_unreserveIrqContext)(
748 NiFpga_Session session,
749 NiFpga_IrqContext context) = NULL;
752 NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session,
753 NiFpga_IrqContext context)
755 if (!NiFpga_unreserveIrqContext)
756 return NiFpga_Status_ResourceNotInitialized;
757 #if NiFpga_CviResourceTracking
758 if (NiFpga_releaseCviResource)
759 NiFpga_releaseCviResource(context);
761 return NiFpga_unreserveIrqContext(session, context);
764 static NiFpga_Status (NiFpga_CCall *NiFpga_waitOnIrqs)(
765 NiFpga_Session session,
766 NiFpga_IrqContext context,
769 uint32_t* irqsAsserted,
770 NiFpga_Bool* timedOut) = NULL;
772 NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session,
773 NiFpga_IrqContext context,
776 uint32_t* irqsAsserted,
777 NiFpga_Bool* timedOut)
779 return NiFpga_waitOnIrqs
780 ? NiFpga_waitOnIrqs(session,
786 : NiFpga_Status_ResourceNotInitialized;
789 static NiFpga_Status (NiFpga_CCall *NiFpga_acknowledgeIrqs)(
790 NiFpga_Session session,
791 uint32_t irqs) = NULL;
793 NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session,
796 return NiFpga_acknowledgeIrqs
797 ? NiFpga_acknowledgeIrqs(session, irqs)
798 : NiFpga_Status_ResourceNotInitialized;
804 static NiFpga_Status (NiFpga_CCall *NiFpga_configureFifo)(
805 NiFpga_Session session,
807 size_t depth) = NULL;
809 NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session,
813 return NiFpga_configureFifo
814 ? NiFpga_configureFifo(session, fifo, depth)
815 : NiFpga_Status_ResourceNotInitialized;
818 static NiFpga_Status (NiFpga_CCall *NiFpga_configureFifo2)(
819 NiFpga_Session session,
821 size_t requestedDepth,
822 size_t* actualDepth) = NULL;
824 NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session,
826 size_t requestedDepth,
829 return NiFpga_configureFifo2
830 ? NiFpga_configureFifo2(session, fifo, requestedDepth, actualDepth)
831 : NiFpga_Status_ResourceNotInitialized;
834 static NiFpga_Status (NiFpga_CCall *NiFpga_startFifo)(
835 NiFpga_Session session,
836 uint32_t fifo) = NULL;
838 NiFpga_Status NiFpga_StartFifo(NiFpga_Session session,
841 return NiFpga_startFifo
842 ? NiFpga_startFifo(session, fifo)
843 : NiFpga_Status_ResourceNotInitialized;
846 static NiFpga_Status (NiFpga_CCall *NiFpga_stopFifo)(
847 NiFpga_Session session,
848 uint32_t fifo) = NULL;
850 NiFpga_Status NiFpga_StopFifo(NiFpga_Session session,
853 return NiFpga_stopFifo
854 ? NiFpga_stopFifo(session, fifo)
855 : NiFpga_Status_ResourceNotInitialized;
861 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoBool)(
862 NiFpga_Session session,
865 size_t numberOfElements,
867 size_t* elementsRemaining) = NULL;
869 NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session,
872 size_t numberOfElements,
874 size_t* elementsRemaining)
876 return NiFpga_readFifoBool
877 ? NiFpga_readFifoBool(session,
883 : NiFpga_Status_ResourceNotInitialized;
886 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI8)(
887 NiFpga_Session session,
890 size_t numberOfElements,
892 size_t* elementsRemaining) = NULL;
894 NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session,
897 size_t numberOfElements,
899 size_t* elementsRemaining)
901 return NiFpga_readFifoI8
902 ? NiFpga_readFifoI8(session,
908 : NiFpga_Status_ResourceNotInitialized;
911 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU8)(
912 NiFpga_Session session,
915 size_t numberOfElements,
917 size_t* elementsRemaining) = NULL;
919 NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session,
922 size_t numberOfElements,
924 size_t* elementsRemaining)
926 return NiFpga_readFifoU8
927 ? NiFpga_readFifoU8(session,
933 : NiFpga_Status_ResourceNotInitialized;
936 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI16)(
937 NiFpga_Session session,
940 size_t numberOfElements,
942 size_t* elementsRemaining) = NULL;
944 NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session,
947 size_t numberOfElements,
949 size_t* elementsRemaining)
951 return NiFpga_readFifoI16
952 ? NiFpga_readFifoI16(session,
958 : NiFpga_Status_ResourceNotInitialized;
961 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU16)(
962 NiFpga_Session session,
965 size_t numberOfElements,
967 size_t* elementsRemaining) = NULL;
969 NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session,
972 size_t numberOfElements,
974 size_t* elementsRemaining)
976 return NiFpga_readFifoU16
977 ? NiFpga_readFifoU16(session,
983 : NiFpga_Status_ResourceNotInitialized;
986 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI32)(
987 NiFpga_Session session,
990 size_t numberOfElements,
992 size_t* elementsRemaining) = NULL;
994 NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session,
997 size_t numberOfElements,
999 size_t* elementsRemaining)
1001 return NiFpga_readFifoI32
1002 ? NiFpga_readFifoI32(session,
1008 : NiFpga_Status_ResourceNotInitialized;
1011 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU32)(
1012 NiFpga_Session session,
1015 size_t numberOfElements,
1017 size_t* elementsRemaining) = NULL;
1019 NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session,
1022 size_t numberOfElements,
1024 size_t* elementsRemaining)
1026 return NiFpga_readFifoU32
1027 ? NiFpga_readFifoU32(session,
1033 : NiFpga_Status_ResourceNotInitialized;
1036 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoI64)(
1037 NiFpga_Session session,
1040 size_t numberOfElements,
1042 size_t* elementsRemaining) = NULL;
1044 NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session,
1047 size_t numberOfElements,
1049 size_t* elementsRemaining)
1051 return NiFpga_readFifoI64
1052 ? NiFpga_readFifoI64(session,
1058 : NiFpga_Status_ResourceNotInitialized;
1061 static NiFpga_Status (NiFpga_CCall *NiFpga_readFifoU64)(
1062 NiFpga_Session session,
1065 size_t numberOfElements,
1067 size_t* elementsRemaining) = NULL;
1069 NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session,
1072 size_t numberOfElements,
1074 size_t* elementsRemaining)
1076 return NiFpga_readFifoU64
1077 ? NiFpga_readFifoU64(session,
1083 : NiFpga_Status_ResourceNotInitialized;
1089 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoBool)(
1090 NiFpga_Session session,
1092 const NiFpga_Bool* data,
1093 size_t numberOfElements,
1095 size_t* emptyElementsRemaining) = NULL;
1097 NiFpga_Status NiFpga_WriteFifoBool(
1098 NiFpga_Session session,
1100 const NiFpga_Bool* data,
1101 size_t numberOfElements,
1103 size_t* emptyElementsRemaining)
1105 return NiFpga_writeFifoBool
1106 ? NiFpga_writeFifoBool(session,
1111 emptyElementsRemaining)
1112 : NiFpga_Status_ResourceNotInitialized;
1115 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI8)(
1116 NiFpga_Session session,
1119 size_t numberOfElements,
1121 size_t* emptyElementsRemaining) = NULL;
1123 NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session,
1126 size_t numberOfElements,
1128 size_t* emptyElementsRemaining)
1130 return NiFpga_writeFifoI8
1131 ? NiFpga_writeFifoI8(session,
1136 emptyElementsRemaining)
1137 : NiFpga_Status_ResourceNotInitialized;
1140 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU8)(
1141 NiFpga_Session session,
1143 const uint8_t* data,
1144 size_t numberOfElements,
1146 size_t* emptyElementsRemaining) = NULL;
1148 NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session,
1150 const uint8_t* data,
1151 size_t numberOfElements,
1153 size_t* emptyElementsRemaining)
1155 return NiFpga_writeFifoU8
1156 ? NiFpga_writeFifoU8(session,
1161 emptyElementsRemaining)
1162 : NiFpga_Status_ResourceNotInitialized;
1165 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI16)(
1166 NiFpga_Session session,
1168 const int16_t* data,
1169 size_t numberOfElements,
1171 size_t* emptyElementsRemaining) = NULL;
1173 NiFpga_Status NiFpga_WriteFifoI16(
1174 NiFpga_Session session,
1176 const int16_t* data,
1177 size_t numberOfElements,
1179 size_t* emptyElementsRemaining)
1181 return NiFpga_writeFifoI16
1182 ? NiFpga_writeFifoI16(session,
1187 emptyElementsRemaining)
1188 : NiFpga_Status_ResourceNotInitialized;
1191 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU16)(
1192 NiFpga_Session session,
1194 const uint16_t* data,
1195 size_t numberOfElements,
1197 size_t* emptyElementsRemaining) = NULL;
1199 NiFpga_Status NiFpga_WriteFifoU16(
1200 NiFpga_Session session,
1202 const uint16_t* data,
1203 size_t numberOfElements,
1205 size_t* emptyElementsRemaining)
1207 return NiFpga_writeFifoU16
1208 ? NiFpga_writeFifoU16(session,
1213 emptyElementsRemaining)
1214 : NiFpga_Status_ResourceNotInitialized;
1217 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI32)(
1218 NiFpga_Session session,
1220 const int32_t* data,
1221 size_t numberOfElements,
1223 size_t* emptyElementsRemaining) = NULL;
1225 NiFpga_Status NiFpga_WriteFifoI32(
1226 NiFpga_Session session,
1228 const int32_t* data,
1229 size_t numberOfElements,
1231 size_t* emptyElementsRemaining)
1233 return NiFpga_writeFifoI32
1234 ? NiFpga_writeFifoI32(session,
1239 emptyElementsRemaining)
1240 : NiFpga_Status_ResourceNotInitialized;
1243 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU32)(
1244 NiFpga_Session session,
1246 const uint32_t* data,
1247 size_t numberOfElements,
1249 size_t* emptyElementsRemaining) = NULL;
1251 NiFpga_Status NiFpga_WriteFifoU32(
1252 NiFpga_Session session,
1254 const uint32_t* data,
1255 size_t numberOfElements,
1257 size_t* emptyElementsRemaining)
1259 return NiFpga_writeFifoU32
1260 ? NiFpga_writeFifoU32(session,
1265 emptyElementsRemaining)
1266 : NiFpga_Status_ResourceNotInitialized;
1269 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoI64)(
1270 NiFpga_Session session,
1272 const int64_t* data,
1273 size_t numberOfElements,
1275 size_t* emptyElementsRemaining) = NULL;
1277 NiFpga_Status NiFpga_WriteFifoI64(
1278 NiFpga_Session session,
1280 const int64_t* data,
1281 size_t numberOfElements,
1283 size_t* emptyElementsRemaining)
1285 return NiFpga_writeFifoI64
1286 ? NiFpga_writeFifoI64(session,
1291 emptyElementsRemaining)
1292 : NiFpga_Status_ResourceNotInitialized;
1295 static NiFpga_Status (NiFpga_CCall *NiFpga_writeFifoU64)(
1296 NiFpga_Session session,
1298 const uint64_t* data,
1299 size_t numberOfElements,
1301 size_t* emptyElementsRemaining) = NULL;
1303 NiFpga_Status NiFpga_WriteFifoU64(
1304 NiFpga_Session session,
1306 const uint64_t* data,
1307 size_t numberOfElements,
1309 size_t* emptyElementsRemaining)
1311 return NiFpga_writeFifoU64
1312 ? NiFpga_writeFifoU64(session,
1317 emptyElementsRemaining)
1318 : NiFpga_Status_ResourceNotInitialized;
1321 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsBool)(
1322 NiFpga_Session session,
1324 NiFpga_Bool** elements,
1325 size_t elementsRequested,
1327 size_t* elementsAcquired,
1328 size_t* elementsRemaining) = NULL;
1330 NiFpga_Status NiFpga_AcquireFifoReadElementsBool(
1331 NiFpga_Session session,
1333 NiFpga_Bool** elements,
1334 size_t elementsRequested,
1336 size_t* elementsAcquired,
1337 size_t* elementsRemaining)
1339 return NiFpga_acquireFifoReadElementsBool
1340 ? NiFpga_acquireFifoReadElementsBool(session,
1347 : NiFpga_Status_ResourceNotInitialized;
1350 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI8)(
1351 NiFpga_Session session,
1354 size_t elementsRequested,
1356 size_t* elementsAcquired,
1357 size_t* elementsRemaining) = NULL;
1359 NiFpga_Status NiFpga_AcquireFifoReadElementsI8(
1360 NiFpga_Session session,
1363 size_t elementsRequested,
1365 size_t* elementsAcquired,
1366 size_t* elementsRemaining)
1368 return NiFpga_acquireFifoReadElementsI8
1369 ? NiFpga_acquireFifoReadElementsI8(session,
1376 : NiFpga_Status_ResourceNotInitialized;
1379 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU8)(
1380 NiFpga_Session session,
1383 size_t elementsRequested,
1385 size_t* elementsAcquired,
1386 size_t* elementsRemaining) = NULL;
1388 NiFpga_Status NiFpga_AcquireFifoReadElementsU8(
1389 NiFpga_Session session,
1392 size_t elementsRequested,
1394 size_t* elementsAcquired,
1395 size_t* elementsRemaining)
1397 return NiFpga_acquireFifoReadElementsU8
1398 ? NiFpga_acquireFifoReadElementsU8(session,
1405 : NiFpga_Status_ResourceNotInitialized;
1408 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI16)(
1409 NiFpga_Session session,
1412 size_t elementsRequested,
1414 size_t* elementsAcquired,
1415 size_t* elementsRemaining) = NULL;
1417 NiFpga_Status NiFpga_AcquireFifoReadElementsI16(
1418 NiFpga_Session session,
1421 size_t elementsRequested,
1423 size_t* elementsAcquired,
1424 size_t* elementsRemaining)
1426 return NiFpga_acquireFifoReadElementsI16
1427 ? NiFpga_acquireFifoReadElementsI16(session,
1434 : NiFpga_Status_ResourceNotInitialized;
1437 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU16)(
1438 NiFpga_Session session,
1440 uint16_t** elements,
1441 size_t elementsRequested,
1443 size_t* elementsAcquired,
1444 size_t* elementsRemaining) = NULL;
1446 NiFpga_Status NiFpga_AcquireFifoReadElementsU16(
1447 NiFpga_Session session,
1449 uint16_t** elements,
1450 size_t elementsRequested,
1452 size_t* elementsAcquired,
1453 size_t* elementsRemaining)
1455 return NiFpga_acquireFifoReadElementsU16
1456 ? NiFpga_acquireFifoReadElementsU16(session,
1463 : NiFpga_Status_ResourceNotInitialized;
1466 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI32)(
1467 NiFpga_Session session,
1470 size_t elementsRequested,
1472 size_t* elementsAcquired,
1473 size_t* elementsRemaining) = NULL;
1475 NiFpga_Status NiFpga_AcquireFifoReadElementsI32(
1476 NiFpga_Session session,
1479 size_t elementsRequested,
1481 size_t* elementsAcquired,
1482 size_t* elementsRemaining)
1484 return NiFpga_acquireFifoReadElementsI32
1485 ? NiFpga_acquireFifoReadElementsI32(session,
1492 : NiFpga_Status_ResourceNotInitialized;
1495 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU32)(
1496 NiFpga_Session session,
1498 uint32_t** elements,
1499 size_t elementsRequested,
1501 size_t* elementsAcquired,
1502 size_t* elementsRemaining) = NULL;
1504 NiFpga_Status NiFpga_AcquireFifoReadElementsU32(
1505 NiFpga_Session session,
1507 uint32_t** elements,
1508 size_t elementsRequested,
1510 size_t* elementsAcquired,
1511 size_t* elementsRemaining)
1513 return NiFpga_acquireFifoReadElementsU32
1514 ? NiFpga_acquireFifoReadElementsU32(session,
1521 : NiFpga_Status_ResourceNotInitialized;
1524 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsI64)(
1525 NiFpga_Session session,
1528 size_t elementsRequested,
1530 size_t* elementsAcquired,
1531 size_t* elementsRemaining) = NULL;
1533 NiFpga_Status NiFpga_AcquireFifoReadElementsI64(
1534 NiFpga_Session session,
1537 size_t elementsRequested,
1539 size_t* elementsAcquired,
1540 size_t* elementsRemaining)
1542 return NiFpga_acquireFifoReadElementsI64
1543 ? NiFpga_acquireFifoReadElementsI64(session,
1550 : NiFpga_Status_ResourceNotInitialized;
1553 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoReadElementsU64)(
1554 NiFpga_Session session,
1556 uint64_t** elements,
1557 size_t elementsRequested,
1559 size_t* elementsAcquired,
1560 size_t* elementsRemaining) = NULL;
1562 NiFpga_Status NiFpga_AcquireFifoReadElementsU64(
1563 NiFpga_Session session,
1565 uint64_t** elements,
1566 size_t elementsRequested,
1568 size_t* elementsAcquired,
1569 size_t* elementsRemaining)
1571 return NiFpga_acquireFifoReadElementsU64
1572 ? NiFpga_acquireFifoReadElementsU64(session,
1579 : NiFpga_Status_ResourceNotInitialized;
1582 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsBool)(
1583 NiFpga_Session session,
1585 NiFpga_Bool** elements,
1586 size_t elementsRequested,
1588 size_t* elementsAcquired,
1589 size_t* elementsRemaining) = NULL;
1591 NiFpga_Status NiFpga_AcquireFifoWriteElementsBool(
1592 NiFpga_Session session,
1594 NiFpga_Bool** elements,
1595 size_t elementsRequested,
1597 size_t* elementsAcquired,
1598 size_t* elementsRemaining)
1600 return NiFpga_acquireFifoWriteElementsBool
1601 ? NiFpga_acquireFifoWriteElementsBool(session,
1608 : NiFpga_Status_ResourceNotInitialized;
1611 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI8)(
1612 NiFpga_Session session,
1615 size_t elementsRequested,
1617 size_t* elementsAcquired,
1618 size_t* elementsRemaining) = NULL;
1620 NiFpga_Status NiFpga_AcquireFifoWriteElementsI8(
1621 NiFpga_Session session,
1624 size_t elementsRequested,
1626 size_t* elementsAcquired,
1627 size_t* elementsRemaining)
1629 return NiFpga_acquireFifoWriteElementsI8
1630 ? NiFpga_acquireFifoWriteElementsI8(session,
1637 : NiFpga_Status_ResourceNotInitialized;
1640 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU8)(
1641 NiFpga_Session session,
1644 size_t elementsRequested,
1646 size_t* elementsAcquired,
1647 size_t* elementsRemaining) = NULL;
1649 NiFpga_Status NiFpga_AcquireFifoWriteElementsU8(
1650 NiFpga_Session session,
1653 size_t elementsRequested,
1655 size_t* elementsAcquired,
1656 size_t* elementsRemaining)
1658 return NiFpga_acquireFifoWriteElementsU8
1659 ? NiFpga_acquireFifoWriteElementsU8(session,
1666 : NiFpga_Status_ResourceNotInitialized;
1669 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI16)(
1670 NiFpga_Session session,
1673 size_t elementsRequested,
1675 size_t* elementsAcquired,
1676 size_t* elementsRemaining) = NULL;
1678 NiFpga_Status NiFpga_AcquireFifoWriteElementsI16(
1679 NiFpga_Session session,
1682 size_t elementsRequested,
1684 size_t* elementsAcquired,
1685 size_t* elementsRemaining)
1687 return NiFpga_acquireFifoWriteElementsI16
1688 ? NiFpga_acquireFifoWriteElementsI16(session,
1695 : NiFpga_Status_ResourceNotInitialized;
1698 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU16)(
1699 NiFpga_Session session,
1701 uint16_t** elements,
1702 size_t elementsRequested,
1704 size_t* elementsAcquired,
1705 size_t* elementsRemaining) = NULL;
1707 NiFpga_Status NiFpga_AcquireFifoWriteElementsU16(
1708 NiFpga_Session session,
1710 uint16_t** elements,
1711 size_t elementsRequested,
1713 size_t* elementsAcquired,
1714 size_t* elementsRemaining)
1716 return NiFpga_acquireFifoWriteElementsU16
1717 ? NiFpga_acquireFifoWriteElementsU16(session,
1724 : NiFpga_Status_ResourceNotInitialized;
1727 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI32)(
1728 NiFpga_Session session,
1731 size_t elementsRequested,
1733 size_t* elementsAcquired,
1734 size_t* elementsRemaining) = NULL;
1736 NiFpga_Status NiFpga_AcquireFifoWriteElementsI32(
1737 NiFpga_Session session,
1740 size_t elementsRequested,
1742 size_t* elementsAcquired,
1743 size_t* elementsRemaining)
1745 return NiFpga_acquireFifoWriteElementsI32
1746 ? NiFpga_acquireFifoWriteElementsI32(session,
1753 : NiFpga_Status_ResourceNotInitialized;
1756 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU32)(
1757 NiFpga_Session session,
1759 uint32_t** elements,
1760 size_t elementsRequested,
1762 size_t* elementsAcquired,
1763 size_t* elementsRemaining) = NULL;
1765 NiFpga_Status NiFpga_AcquireFifoWriteElementsU32(
1766 NiFpga_Session session,
1768 uint32_t** elements,
1769 size_t elementsRequested,
1771 size_t* elementsAcquired,
1772 size_t* elementsRemaining)
1774 return NiFpga_acquireFifoWriteElementsU32
1775 ? NiFpga_acquireFifoWriteElementsU32(session,
1782 : NiFpga_Status_ResourceNotInitialized;
1785 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsI64)(
1786 NiFpga_Session session,
1789 size_t elementsRequested,
1791 size_t* elementsAcquired,
1792 size_t* elementsRemaining) = NULL;
1794 NiFpga_Status NiFpga_AcquireFifoWriteElementsI64(
1795 NiFpga_Session session,
1798 size_t elementsRequested,
1800 size_t* elementsAcquired,
1801 size_t* elementsRemaining)
1803 return NiFpga_acquireFifoWriteElementsI64
1804 ? NiFpga_acquireFifoWriteElementsI64(session,
1811 : NiFpga_Status_ResourceNotInitialized;
1814 static NiFpga_Status (NiFpga_CCall *NiFpga_acquireFifoWriteElementsU64)(
1815 NiFpga_Session session,
1817 uint64_t** elements,
1818 size_t elementsRequested,
1820 size_t* elementsAcquired,
1821 size_t* elementsRemaining) = NULL;
1823 NiFpga_Status NiFpga_AcquireFifoWriteElementsU64(
1824 NiFpga_Session session,
1826 uint64_t** elements,
1827 size_t elementsRequested,
1829 size_t* elementsAcquired,
1830 size_t* elementsRemaining)
1832 return NiFpga_acquireFifoWriteElementsU64
1833 ? NiFpga_acquireFifoWriteElementsU64(session,
1840 : NiFpga_Status_ResourceNotInitialized;
1843 static NiFpga_Status (NiFpga_CCall *NiFpga_releaseFifoElements)(
1844 NiFpga_Session session,
1846 size_t elements) = NULL;
1848 NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session,
1852 return NiFpga_releaseFifoElements
1853 ? NiFpga_releaseFifoElements(session, fifo, elements)
1854 : NiFpga_Status_ResourceNotInitialized;
1857 static NiFpga_Status (NiFpga_CCall *NiFpga_getPeerToPeerFifoEndpoint)(
1858 NiFpga_Session session,
1860 uint32_t* endpoint) = NULL;
1862 NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session,
1866 return NiFpga_getPeerToPeerFifoEndpoint
1867 ? NiFpga_getPeerToPeerFifoEndpoint(session, fifo, endpoint)
1868 : NiFpga_Status_ResourceNotInitialized;
1876 const char*
const name;
1877 void**
const address;
1878 } NiFpga_functions[] =
1880 {
"NiFpgaDll_Open", (
void**)(
void*)&NiFpga_open},
1881 {
"NiFpgaDll_Close", (
void**)(
void*)&NiFpga_close},
1882 {
"NiFpgaDll_Run", (
void**)(
void*)&NiFpga_run},
1883 {
"NiFpgaDll_Abort", (
void**)(
void*)&NiFpga_abort},
1884 {
"NiFpgaDll_Reset", (
void**)(
void*)&NiFpga_reset},
1885 {
"NiFpgaDll_Download", (
void**)(
void*)&NiFpga_download},
1886 {
"NiFpgaDll_ReadBool", (
void**)(
void*)&NiFpga_readBool},
1887 {
"NiFpgaDll_ReadI8", (
void**)(
void*)&NiFpga_readI8},
1888 {
"NiFpgaDll_ReadU8", (
void**)(
void*)&NiFpga_readU8},
1889 {
"NiFpgaDll_ReadI16", (
void**)(
void*)&NiFpga_readI16},
1890 {
"NiFpgaDll_ReadU16", (
void**)(
void*)&NiFpga_readU16},
1891 {
"NiFpgaDll_ReadI32", (
void**)(
void*)&NiFpga_readI32},
1892 {
"NiFpgaDll_ReadU32", (
void**)(
void*)&NiFpga_readU32},
1893 {
"NiFpgaDll_ReadI64", (
void**)(
void*)&NiFpga_readI64},
1894 {
"NiFpgaDll_ReadU64", (
void**)(
void*)&NiFpga_readU64},
1895 {
"NiFpgaDll_WriteBool", (
void**)(
void*)&NiFpga_writeBool},
1896 {
"NiFpgaDll_WriteI8", (
void**)(
void*)&NiFpga_writeI8},
1897 {
"NiFpgaDll_WriteU8", (
void**)(
void*)&NiFpga_writeU8},
1898 {
"NiFpgaDll_WriteI16", (
void**)(
void*)&NiFpga_writeI16},
1899 {
"NiFpgaDll_WriteU16", (
void**)(
void*)&NiFpga_writeU16},
1900 {
"NiFpgaDll_WriteI32", (
void**)(
void*)&NiFpga_writeI32},
1901 {
"NiFpgaDll_WriteU32", (
void**)(
void*)&NiFpga_writeU32},
1902 {
"NiFpgaDll_WriteI64", (
void**)(
void*)&NiFpga_writeI64},
1903 {
"NiFpgaDll_WriteU64", (
void**)(
void*)&NiFpga_writeU64},
1904 {
"NiFpgaDll_ReadArrayBool", (
void**)(
void*)&NiFpga_readArrayBool},
1905 {
"NiFpgaDll_ReadArrayI8", (
void**)(
void*)&NiFpga_readArrayI8},
1906 {
"NiFpgaDll_ReadArrayU8", (
void**)(
void*)&NiFpga_readArrayU8},
1907 {
"NiFpgaDll_ReadArrayI16", (
void**)(
void*)&NiFpga_readArrayI16},
1908 {
"NiFpgaDll_ReadArrayU16", (
void**)(
void*)&NiFpga_readArrayU16},
1909 {
"NiFpgaDll_ReadArrayI32", (
void**)(
void*)&NiFpga_readArrayI32},
1910 {
"NiFpgaDll_ReadArrayU32", (
void**)(
void*)&NiFpga_readArrayU32},
1911 {
"NiFpgaDll_ReadArrayI64", (
void**)(
void*)&NiFpga_readArrayI64},
1912 {
"NiFpgaDll_ReadArrayU64", (
void**)(
void*)&NiFpga_readArrayU64},
1913 {
"NiFpgaDll_WriteArrayBool", (
void**)(
void*)&NiFpga_writeArrayBool},
1914 {
"NiFpgaDll_WriteArrayI8", (
void**)(
void*)&NiFpga_writeArrayI8},
1915 {
"NiFpgaDll_WriteArrayU8", (
void**)(
void*)&NiFpga_writeArrayU8},
1916 {
"NiFpgaDll_WriteArrayI16", (
void**)(
void*)&NiFpga_writeArrayI16},
1917 {
"NiFpgaDll_WriteArrayU16", (
void**)(
void*)&NiFpga_writeArrayU16},
1918 {
"NiFpgaDll_WriteArrayI32", (
void**)(
void*)&NiFpga_writeArrayI32},
1919 {
"NiFpgaDll_WriteArrayU32", (
void**)(
void*)&NiFpga_writeArrayU32},
1920 {
"NiFpgaDll_WriteArrayI64", (
void**)(
void*)&NiFpga_writeArrayI64},
1921 {
"NiFpgaDll_WriteArrayU64", (
void**)(
void*)&NiFpga_writeArrayU64},
1922 {
"NiFpgaDll_ReserveIrqContext", (
void**)(
void*)&NiFpga_reserveIrqContext},
1923 {
"NiFpgaDll_UnreserveIrqContext", (
void**)(
void*)&NiFpga_unreserveIrqContext},
1924 {
"NiFpgaDll_WaitOnIrqs", (
void**)(
void*)&NiFpga_waitOnIrqs},
1925 {
"NiFpgaDll_AcknowledgeIrqs", (
void**)(
void*)&NiFpga_acknowledgeIrqs},
1926 {
"NiFpgaDll_ConfigureFifo", (
void**)(
void*)&NiFpga_configureFifo},
1927 {
"NiFpgaDll_ConfigureFifo2", (
void**)(
void*)&NiFpga_configureFifo2},
1928 {
"NiFpgaDll_StartFifo", (
void**)(
void*)&NiFpga_startFifo},
1929 {
"NiFpgaDll_StopFifo", (
void**)(
void*)&NiFpga_stopFifo},
1930 {
"NiFpgaDll_ReadFifoBool", (
void**)(
void*)&NiFpga_readFifoBool},
1931 {
"NiFpgaDll_ReadFifoI8", (
void**)(
void*)&NiFpga_readFifoI8},
1932 {
"NiFpgaDll_ReadFifoU8", (
void**)(
void*)&NiFpga_readFifoU8},
1933 {
"NiFpgaDll_ReadFifoI16", (
void**)(
void*)&NiFpga_readFifoI16},
1934 {
"NiFpgaDll_ReadFifoU16", (
void**)(
void*)&NiFpga_readFifoU16},
1935 {
"NiFpgaDll_ReadFifoI32", (
void**)(
void*)&NiFpga_readFifoI32},
1936 {
"NiFpgaDll_ReadFifoU32", (
void**)(
void*)&NiFpga_readFifoU32},
1937 {
"NiFpgaDll_ReadFifoI64", (
void**)(
void*)&NiFpga_readFifoI64},
1938 {
"NiFpgaDll_ReadFifoU64", (
void**)(
void*)&NiFpga_readFifoU64},
1939 {
"NiFpgaDll_WriteFifoBool", (
void**)(
void*)&NiFpga_writeFifoBool},
1940 {
"NiFpgaDll_WriteFifoI8", (
void**)(
void*)&NiFpga_writeFifoI8},
1941 {
"NiFpgaDll_WriteFifoU8", (
void**)(
void*)&NiFpga_writeFifoU8},
1942 {
"NiFpgaDll_WriteFifoI16", (
void**)(
void*)&NiFpga_writeFifoI16},
1943 {
"NiFpgaDll_WriteFifoU16", (
void**)(
void*)&NiFpga_writeFifoU16},
1944 {
"NiFpgaDll_WriteFifoI32", (
void**)(
void*)&NiFpga_writeFifoI32},
1945 {
"NiFpgaDll_WriteFifoU32", (
void**)(
void*)&NiFpga_writeFifoU32},
1946 {
"NiFpgaDll_WriteFifoI64", (
void**)(
void*)&NiFpga_writeFifoI64},
1947 {
"NiFpgaDll_WriteFifoU64", (
void**)(
void*)&NiFpga_writeFifoU64},
1948 {
"NiFpgaDll_AcquireFifoReadElementsBool", (
void**)(
void*)&NiFpga_acquireFifoReadElementsBool},
1949 {
"NiFpgaDll_AcquireFifoReadElementsI8", (
void**)(
void*)&NiFpga_acquireFifoReadElementsI8},
1950 {
"NiFpgaDll_AcquireFifoReadElementsU8", (
void**)(
void*)&NiFpga_acquireFifoReadElementsU8},
1951 {
"NiFpgaDll_AcquireFifoReadElementsI16", (
void**)(
void*)&NiFpga_acquireFifoReadElementsI16},
1952 {
"NiFpgaDll_AcquireFifoReadElementsU16", (
void**)(
void*)&NiFpga_acquireFifoReadElementsU16},
1953 {
"NiFpgaDll_AcquireFifoReadElementsI32", (
void**)(
void*)&NiFpga_acquireFifoReadElementsI32},
1954 {
"NiFpgaDll_AcquireFifoReadElementsU32", (
void**)(
void*)&NiFpga_acquireFifoReadElementsU32},
1955 {
"NiFpgaDll_AcquireFifoReadElementsI64", (
void**)(
void*)&NiFpga_acquireFifoReadElementsI64},
1956 {
"NiFpgaDll_AcquireFifoReadElementsU64", (
void**)(
void*)&NiFpga_acquireFifoReadElementsU64},
1957 {
"NiFpgaDll_AcquireFifoWriteElementsBool", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsBool},
1958 {
"NiFpgaDll_AcquireFifoWriteElementsI8", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsI8},
1959 {
"NiFpgaDll_AcquireFifoWriteElementsU8", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsU8},
1960 {
"NiFpgaDll_AcquireFifoWriteElementsI16", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsI16},
1961 {
"NiFpgaDll_AcquireFifoWriteElementsU16", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsU16},
1962 {
"NiFpgaDll_AcquireFifoWriteElementsI32", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsI32},
1963 {
"NiFpgaDll_AcquireFifoWriteElementsU32", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsU32},
1964 {
"NiFpgaDll_AcquireFifoWriteElementsI64", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsI64},
1965 {
"NiFpgaDll_AcquireFifoWriteElementsU64", (
void**)(
void*)&NiFpga_acquireFifoWriteElementsU64},
1966 {
"NiFpgaDll_ReleaseFifoElements", (
void**)(
void*)&NiFpga_releaseFifoElements},
1967 {
"NiFpgaDll_GetPeerToPeerFifoEndpoint", (
void**)(
void*)&NiFpga_getPeerToPeerFifoEndpoint},
1971 NiFpga_Status NiFpga_Initialize(
void)
1974 if (!NiFpga_library)
1979 NiFpga_library = LoadLibraryA(
"NiFpga.dll");
1980 #elif NiFpga_VxWorks
1981 NiFpga_library = VxLoadLibraryFromPath(
"NiFpga.out", 0);
1983 const char*
const library =
"libNiFpga.so";
1984 NiFpga_library = dlopen(library, RTLD_LAZY);
1985 if (!NiFpga_library)
1986 fprintf(stderr,
"Error opening %s: %s\n", library, dlerror());
1990 if (!NiFpga_library)
1991 return NiFpga_Status_ResourceNotFound;
1993 for (i = 0; NiFpga_functions[i].name; i++)
1995 const char*
const name = NiFpga_functions[i].name;
1996 void**
const address = NiFpga_functions[i].address;
1998 *address = GetProcAddress(NiFpga_library, name);
2000 return NiFpga_Status_VersionMismatch;
2001 #elif NiFpga_VxWorks
2003 if (symFindByName(sysSymTbl,
2007 return NiFpga_Status_VersionMismatch;
2009 *address = dlsym(NiFpga_library, name);
2011 return NiFpga_Status_VersionMismatch;
2017 #if NiFpga_CviResourceTracking
2019 HMODULE engine = GetModuleHandle(
"cvirte.dll");
2021 engine = GetModuleHandle(
"cvi_lvrt.dll");
2023 engine = GetModuleHandle(
"instrsup.dll");
2026 NiFpga_acquireCviResource =
2027 (NiFpga_AcquireCviResource)
2028 GetProcAddress(engine,
"__CVI_Resource_Acquire");
2029 NiFpga_releaseCviResource =
2030 (NiFpga_ReleaseCviResource)
2031 GetProcAddress(engine,
"__CVI_Resource_Release");
2032 if (!NiFpga_acquireCviResource
2033 || !NiFpga_releaseCviResource)
2035 NiFpga_acquireCviResource = NULL;
2036 NiFpga_releaseCviResource = NULL;
2042 return NiFpga_Status_Success;
2045 NiFpga_Status NiFpga_Finalize(
void)
2051 NiFpga_Status status = NiFpga_Status_Success;
2054 if (!FreeLibrary(NiFpga_library))
2055 status = NiFpga_Status_ResourceNotInitialized;
2056 #elif NiFpga_VxWorks
2057 if (VxFreeLibrary(NiFpga_library, 0) != OK)
2058 status = NiFpga_Status_ResourceNotInitialized;
2060 if (dlclose(NiFpga_library))
2061 status = NiFpga_Status_ResourceNotInitialized;
2066 NiFpga_library = NULL;
2067 for (i = 0; NiFpga_functions[i].name; i++)
2068 *NiFpga_functions[i].address = NULL;
2070 #if NiFpga_CviResourceTracking
2071 NiFpga_acquireCviResource = NULL;
2072 NiFpga_releaseCviResource = NULL;
2077 return NiFpga_Status_ResourceNotInitialized;