From 76c9ec7be64cb354b698b008427d639835bc117e Mon Sep 17 00:00:00 2001 From: Ayush Mehra Date: Wed, 14 Aug 2024 14:13:06 +0530 Subject: [PATCH] auto-generate Get/Set --- generated/nifpga/nifpga.proto | 246 ++++++++++- generated/nifpga/nifpga_client.cpp | 279 +++++++++++- generated/nifpga/nifpga_client.h | 16 +- generated/nifpga/nifpga_compilation_test.cpp | 50 +++ generated/nifpga/nifpga_library.cpp | 90 ++++ generated/nifpga/nifpga_library.h | 30 ++ generated/nifpga/nifpga_library_interface.h | 10 + generated/nifpga/nifpga_mock_library.h | 10 + generated/nifpga/nifpga_service.cpp | 432 ++++++++++++++++++- generated/nifpga/nifpga_service.h | 14 + source/codegen/metadata/nifpga/config.py | 3 +- source/codegen/metadata/nifpga/enums.py | 265 ++++++++++++ source/codegen/metadata/nifpga/functions.py | 22 +- 13 files changed, 1439 insertions(+), 28 deletions(-) diff --git a/generated/nifpga/nifpga.proto b/generated/nifpga/nifpga.proto index d1f35fa12..01990516d 100644 --- a/generated/nifpga/nifpga.proto +++ b/generated/nifpga/nifpga.proto @@ -24,6 +24,12 @@ service NiFpga { rpc Download(DownloadRequest) returns (DownloadResponse); rpc FindFifo(FindFifoRequest) returns (FindFifoResponse); rpc FindRegister(FindRegisterRequest) returns (FindRegisterResponse); + rpc GetBitfileSignature(GetBitfileSignatureRequest) returns (GetBitfileSignatureResponse); + rpc GetFifoPropertyI32(GetFifoPropertyI32Request) returns (GetFifoPropertyI32Response); + rpc GetFifoPropertyI64(GetFifoPropertyI64Request) returns (GetFifoPropertyI64Response); + rpc GetFifoPropertyU32(GetFifoPropertyU32Request) returns (GetFifoPropertyU32Response); + rpc GetFifoPropertyU64(GetFifoPropertyU64Request) returns (GetFifoPropertyU64Response); + rpc GetFpgaViState(GetFpgaViStateRequest) returns (GetFpgaViStateResponse); rpc Open(OpenRequest) returns (OpenResponse); rpc ReadArrayBool(ReadArrayBoolRequest) returns (ReadArrayBoolResponse); rpc ReadArrayDbl(ReadArrayDblRequest) returns (ReadArrayDblResponse); @@ -61,6 +67,10 @@ service NiFpga { rpc ReleaseFifoElements(ReleaseFifoElementsRequest) returns (ReleaseFifoElementsResponse); rpc Reset(ResetRequest) returns (ResetResponse); rpc Run(RunRequest) returns (RunResponse); + rpc SetFifoPropertyI32(SetFifoPropertyI32Request) returns (SetFifoPropertyI32Response); + rpc SetFifoPropertyI64(SetFifoPropertyI64Request) returns (SetFifoPropertyI64Response); + rpc SetFifoPropertyU32(SetFifoPropertyU32Request) returns (SetFifoPropertyU32Response); + rpc SetFifoPropertyU64(SetFifoPropertyU64Request) returns (SetFifoPropertyU64Response); rpc StartFifo(StartFifoRequest) returns (StartFifoResponse); rpc StopFifo(StopFifoRequest) returns (StopFifoResponse); rpc UnreserveFifo(UnreserveFifoRequest) returns (UnreserveFifoResponse); @@ -99,6 +109,93 @@ service NiFpga { rpc WriteU8(WriteU8Request) returns (WriteU8Response); } +enum CloseAttribute { + CLOSE_ATTRIBUTE_UNSPECIFIED = 0; + CLOSE_ATTRIBUTE_NO_RESET_IF_LAST_SESSION = 1; +} + +enum FifoFlowControl { + FIFO_FLOW_CONTROL_UNSPECIFIED = 0; + FIFO_FLOW_CONTROL_DISABLED = 1; + FIFO_FLOW_CONTROL_ENABLED = 2; +} + +enum FifoProperty { + FIFO_PROPERTY_NOT_SUPPORTED = 0; + FIFO_PROPERTY_BYTES_PER_ELEMENT = 1; + FIFO_PROPERTY_HOST_BUFFER_ALLOCATION_GRANULARITY = 2; + FIFO_PROPERTY_HOST_BUFFER_SIZE = 3; + FIFO_PROPERTY_HOST_BUFFER_MIRROR_SIZE = 4; + FIFO_PROPERTY_HOST_BUFFER_TYPE = 5; + FIFO_PROPERTY_HOST_BUFFER = 6; + FIFO_PROPERTY_FLOW_CONTROL = 7; + FIFO_PROPERTY_ELEMENTS_CURRENTLY_ACQUIRED = 8; + FIFO_PROPERTY_PREFERRED_NUMA_NODE = 9; + FIFO_PROPERTY_NUMBER_OF_ZERO_COPY_REGIONS = 10; +} + +enum FpgaViState { + FPGA_VI_STATE_NOT_RUNNING = 0; + FPGA_VI_STATE_INVALID = 1; + FPGA_VI_STATE_RUNNING = 2; + FPGA_VI_STATE_NATURALLY_STOPPED = 3; +} + +enum HostBufferType { + HOST_BUFFER_TYPE_UNSPECIFIED = 0; + HOST_BUFFER_TYPE_ALLOCATED_BY_RIO = 1; + HOST_BUFFER_TYPE_ALLOCATED_BY_USER = 2; +} + +enum Irq { + IRQ_UNSPECIFIED = 0; + IRQ_Irq_0 = 1; + IRQ_Irq_1 = 2; + IRQ_Irq_2 = 3; + IRQ_Irq_3 = 4; + IRQ_Irq_4 = 5; + IRQ_Irq_5 = 6; + IRQ_Irq_6 = 7; + IRQ_Irq_7 = 8; + IRQ_Irq_8 = 9; + IRQ_Irq_9 = 10; + IRQ_Irq_10 = 11; + IRQ_Irq_11 = 12; + IRQ_Irq_12 = 13; + IRQ_Irq_13 = 14; + IRQ_Irq_14 = 15; + IRQ_Irq_15 = 16; + IRQ_Irq_16 = 17; + IRQ_Irq_17 = 18; + IRQ_Irq_18 = 19; + IRQ_Irq_19 = 20; + IRQ_Irq_20 = 21; + IRQ_Irq_21 = 22; + IRQ_Irq_22 = 23; + IRQ_Irq_23 = 24; + IRQ_Irq_24 = 25; + IRQ_Irq_25 = 26; + IRQ_Irq_26 = 27; + IRQ_Irq_27 = 28; + IRQ_Irq_28 = 29; + IRQ_Irq_29 = 30; + IRQ_Irq_30 = 31; + IRQ_Irq_31 = 32; +} + +enum OpenAttribute { + OPEN_ATTRIBUTE_UNSPECIFIED = 0; + OPEN_ATTRIBUTE_NO_RUN = 1; + OPEN_ATTRIBUTE_BITFILE_PATH_IS_UTF8 = 2; + OPEN_ATTRIBUTE_BITFILE_CONTENTS_NOT_PATH = 3; + OPEN_ATTRIBUTE_IGNORE_SIGNATURE_ARGUMENT = 4; +} + +enum RunAttribute { + RUN_ATTRIBUTE_UNSPECIFIED = 0; + RUN_ATTRIBUTE_WAIT_UNTIL_DONE = 1; +} + message AbortRequest { nidevice_grpc.Session session = 1; } @@ -109,7 +206,10 @@ message AbortResponse { message CloseRequest { nidevice_grpc.Session session = 1; - uint32 attribute = 2; + oneof attribute_enum { + CloseAttribute attribute = 2; + uint32 attribute_raw = 3; + } } message CloseResponse { @@ -174,13 +274,92 @@ message FindRegisterResponse { uint32 register_offset = 2; } +message GetBitfileSignatureRequest { + nidevice_grpc.Session session = 1; +} + +message GetBitfileSignatureResponse { + int32 status = 1; + uint32 signature = 2; + uint32 signature_size = 3; +} + +message GetFifoPropertyI32Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } +} + +message GetFifoPropertyI32Response { + int32 status = 1; + int32 value = 2; +} + +message GetFifoPropertyI64Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } +} + +message GetFifoPropertyI64Response { + int32 status = 1; + int64 value = 2; +} + +message GetFifoPropertyU32Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } +} + +message GetFifoPropertyU32Response { + int32 status = 1; + uint32 value = 2; +} + +message GetFifoPropertyU64Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } +} + +message GetFifoPropertyU64Response { + int32 status = 1; + uint64 value = 2; +} + +message GetFpgaViStateRequest { + nidevice_grpc.Session session = 1; +} + +message GetFpgaViStateResponse { + int32 status = 1; + FpgaViState state = 2; + uint32 state_raw = 3; +} + message OpenRequest { string session_name = 1; string bitfile = 2; string signature = 3; string resource = 4; - uint32 attribute = 5; - nidevice_grpc.SessionInitializationBehavior initialization_behavior = 6; + oneof attribute_enum { + OpenAttribute attribute_mapped = 5; + uint32 attribute_raw = 6; + } + nidevice_grpc.SessionInitializationBehavior initialization_behavior = 7; } message OpenResponse { @@ -583,13 +762,72 @@ message ResetResponse { message RunRequest { nidevice_grpc.Session session = 1; - uint32 attribute = 2; + oneof attribute_enum { + RunAttribute attribute = 2; + uint32 attribute_raw = 3; + } } message RunResponse { int32 status = 1; } +message SetFifoPropertyI32Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } + int32 value = 5; +} + +message SetFifoPropertyI32Response { + int32 status = 1; +} + +message SetFifoPropertyI64Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } + int64 value = 5; +} + +message SetFifoPropertyI64Response { + int32 status = 1; +} + +message SetFifoPropertyU32Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } + uint32 value = 5; +} + +message SetFifoPropertyU32Response { + int32 status = 1; +} + +message SetFifoPropertyU64Request { + nidevice_grpc.Session session = 1; + uint32 fifo = 2; + oneof property_enum { + FifoProperty property = 3; + uint32 property_raw = 4; + } + uint64 value = 5; +} + +message SetFifoPropertyU64Response { + int32 status = 1; +} + message StartFifoRequest { nidevice_grpc.Session session = 1; uint32 fifo = 2; diff --git a/generated/nifpga/nifpga_client.cpp b/generated/nifpga/nifpga_client.cpp index 014e3453b..4a3b8e7d2 100644 --- a/generated/nifpga/nifpga_client.cpp +++ b/generated/nifpga/nifpga_client.cpp @@ -35,13 +35,20 @@ abort(const StubPtr& stub, const nidevice_grpc::Session& session) } CloseResponse -close(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& attribute) +close(const StubPtr& stub, const nidevice_grpc::Session& session, const simple_variant& attribute) { ::grpc::ClientContext context; auto request = CloseRequest{}; request.mutable_session()->CopyFrom(session); - request.set_attribute(attribute); + const auto attribute_ptr = attribute.get_if(); + const auto attribute_raw_ptr = attribute.get_if(); + if (attribute_ptr) { + request.set_attribute(*attribute_ptr); + } + else if (attribute_raw_ptr) { + request.set_attribute_raw(*attribute_raw_ptr); + } auto response = CloseResponse{}; @@ -161,8 +168,146 @@ find_register(const StubPtr& stub, const nidevice_grpc::Session& session, const return response; } +GetBitfileSignatureResponse +get_bitfile_signature(const StubPtr& stub, const nidevice_grpc::Session& session) +{ + ::grpc::ClientContext context; + + auto request = GetBitfileSignatureRequest{}; + request.mutable_session()->CopyFrom(session); + + auto response = GetBitfileSignatureResponse{}; + + raise_if_error( + stub->GetBitfileSignature(&context, request, &response), + context); + + return response; +} + +GetFifoPropertyI32Response +get_fifo_property_i32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property) +{ + ::grpc::ClientContext context; + + auto request = GetFifoPropertyI32Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + + auto response = GetFifoPropertyI32Response{}; + + raise_if_error( + stub->GetFifoPropertyI32(&context, request, &response), + context); + + return response; +} + +GetFifoPropertyI64Response +get_fifo_property_i64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property) +{ + ::grpc::ClientContext context; + + auto request = GetFifoPropertyI64Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + + auto response = GetFifoPropertyI64Response{}; + + raise_if_error( + stub->GetFifoPropertyI64(&context, request, &response), + context); + + return response; +} + +GetFifoPropertyU32Response +get_fifo_property_u32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property) +{ + ::grpc::ClientContext context; + + auto request = GetFifoPropertyU32Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + + auto response = GetFifoPropertyU32Response{}; + + raise_if_error( + stub->GetFifoPropertyU32(&context, request, &response), + context); + + return response; +} + +GetFifoPropertyU64Response +get_fifo_property_u64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property) +{ + ::grpc::ClientContext context; + + auto request = GetFifoPropertyU64Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + + auto response = GetFifoPropertyU64Response{}; + + raise_if_error( + stub->GetFifoPropertyU64(&context, request, &response), + context); + + return response; +} + +GetFpgaViStateResponse +get_fpga_vi_state(const StubPtr& stub, const nidevice_grpc::Session& session) +{ + ::grpc::ClientContext context; + + auto request = GetFpgaViStateRequest{}; + request.mutable_session()->CopyFrom(session); + + auto response = GetFpgaViStateResponse{}; + + raise_if_error( + stub->GetFpgaViState(&context, request, &response), + context); + + return response; +} + OpenResponse -open(const StubPtr& stub, const std::string& bitfile, const std::string& signature, const std::string& resource, const pb::uint32& attribute, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior) +open(const StubPtr& stub, const std::string& bitfile, const std::string& signature, const std::string& resource, const simple_variant& attribute, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior) { ::grpc::ClientContext context; @@ -170,7 +315,14 @@ open(const StubPtr& stub, const std::string& bitfile, const std::string& signatu request.set_bitfile(bitfile); request.set_signature(signature); request.set_resource(resource); - request.set_attribute(attribute); + const auto attribute_ptr = attribute.get_if(); + const auto attribute_raw_ptr = attribute.get_if(); + if (attribute_ptr) { + request.set_attribute_mapped(*attribute_ptr); + } + else if (attribute_raw_ptr) { + request.set_attribute_raw(*attribute_raw_ptr); + } request.set_initialization_behavior(initialization_behavior); auto response = OpenResponse{}; @@ -846,13 +998,20 @@ reset(const StubPtr& stub, const nidevice_grpc::Session& session) } RunResponse -run(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& attribute) +run(const StubPtr& stub, const nidevice_grpc::Session& session, const simple_variant& attribute) { ::grpc::ClientContext context; auto request = RunRequest{}; request.mutable_session()->CopyFrom(session); - request.set_attribute(attribute); + const auto attribute_ptr = attribute.get_if(); + const auto attribute_raw_ptr = attribute.get_if(); + if (attribute_ptr) { + request.set_attribute(*attribute_ptr); + } + else if (attribute_raw_ptr) { + request.set_attribute_raw(*attribute_raw_ptr); + } auto response = RunResponse{}; @@ -863,6 +1022,114 @@ run(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32 return response; } +SetFifoPropertyI32Response +set_fifo_property_i32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::int32& value) +{ + ::grpc::ClientContext context; + + auto request = SetFifoPropertyI32Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + request.set_value(value); + + auto response = SetFifoPropertyI32Response{}; + + raise_if_error( + stub->SetFifoPropertyI32(&context, request, &response), + context); + + return response; +} + +SetFifoPropertyI64Response +set_fifo_property_i64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::int64& value) +{ + ::grpc::ClientContext context; + + auto request = SetFifoPropertyI64Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + request.set_value(value); + + auto response = SetFifoPropertyI64Response{}; + + raise_if_error( + stub->SetFifoPropertyI64(&context, request, &response), + context); + + return response; +} + +SetFifoPropertyU32Response +set_fifo_property_u32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::uint32& value) +{ + ::grpc::ClientContext context; + + auto request = SetFifoPropertyU32Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + request.set_value(value); + + auto response = SetFifoPropertyU32Response{}; + + raise_if_error( + stub->SetFifoPropertyU32(&context, request, &response), + context); + + return response; +} + +SetFifoPropertyU64Response +set_fifo_property_u64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::uint64& value) +{ + ::grpc::ClientContext context; + + auto request = SetFifoPropertyU64Request{}; + request.mutable_session()->CopyFrom(session); + request.set_fifo(fifo); + const auto property_ptr = property.get_if(); + const auto property_raw_ptr = property.get_if(); + if (property_ptr) { + request.set_property(*property_ptr); + } + else if (property_raw_ptr) { + request.set_property_raw(*property_raw_ptr); + } + request.set_value(value); + + auto response = SetFifoPropertyU64Response{}; + + raise_if_error( + stub->SetFifoPropertyU64(&context, request, &response), + context); + + return response; +} + StartFifoResponse start_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo) { diff --git a/generated/nifpga/nifpga_client.h b/generated/nifpga/nifpga_client.h index cdc8d6fe7..627484682 100644 --- a/generated/nifpga/nifpga_client.h +++ b/generated/nifpga/nifpga_client.h @@ -23,14 +23,20 @@ using namespace nidevice_grpc::experimental::client; AbortResponse abort(const StubPtr& stub, const nidevice_grpc::Session& session); -CloseResponse close(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& attribute); +CloseResponse close(const StubPtr& stub, const nidevice_grpc::Session& session, const simple_variant& attribute); CommitFifoConfigurationResponse commit_fifo_configuration(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo); ConfigureFifoResponse configure_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const pb::uint32& depth); ConfigureFifo2Response configure_fifo2(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const pb::uint32& requested_depth); DownloadResponse download(const StubPtr& stub, const nidevice_grpc::Session& session); FindFifoResponse find_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const std::string& fifo_name); FindRegisterResponse find_register(const StubPtr& stub, const nidevice_grpc::Session& session, const std::string& register_name); -OpenResponse open(const StubPtr& stub, const std::string& bitfile, const std::string& signature, const std::string& resource, const pb::uint32& attribute, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED); +GetBitfileSignatureResponse get_bitfile_signature(const StubPtr& stub, const nidevice_grpc::Session& session); +GetFifoPropertyI32Response get_fifo_property_i32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property); +GetFifoPropertyI64Response get_fifo_property_i64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property); +GetFifoPropertyU32Response get_fifo_property_u32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property); +GetFifoPropertyU64Response get_fifo_property_u64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property); +GetFpgaViStateResponse get_fpga_vi_state(const StubPtr& stub, const nidevice_grpc::Session& session); +OpenResponse open(const StubPtr& stub, const std::string& bitfile, const std::string& signature, const std::string& resource, const simple_variant& attribute, const nidevice_grpc::SessionInitializationBehavior& initialization_behavior = nidevice_grpc::SESSION_INITIALIZATION_BEHAVIOR_UNSPECIFIED); ReadArrayBoolResponse read_array_bool(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& indicator, const pb::uint32& size); ReadArrayDblResponse read_array_dbl(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& indicator, const pb::uint32& size); ReadArrayI16Response read_array_i16(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& indicator, const pb::uint32& size); @@ -66,7 +72,11 @@ ReadU64Response read_u64(const StubPtr& stub, const nidevice_grpc::Session& sess ReadU8Response read_u8(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& indicator); ReleaseFifoElementsResponse release_fifo_elements(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const pb::uint32& elements); ResetResponse reset(const StubPtr& stub, const nidevice_grpc::Session& session); -RunResponse run(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& attribute); +RunResponse run(const StubPtr& stub, const nidevice_grpc::Session& session, const simple_variant& attribute); +SetFifoPropertyI32Response set_fifo_property_i32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::int32& value); +SetFifoPropertyI64Response set_fifo_property_i64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::int64& value); +SetFifoPropertyU32Response set_fifo_property_u32(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::uint32& value); +SetFifoPropertyU64Response set_fifo_property_u64(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo, const simple_variant& property, const pb::uint64& value); StartFifoResponse start_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo); StopFifoResponse stop_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo); UnreserveFifoResponse unreserve_fifo(const StubPtr& stub, const nidevice_grpc::Session& session, const pb::uint32& fifo); diff --git a/generated/nifpga/nifpga_compilation_test.cpp b/generated/nifpga/nifpga_compilation_test.cpp index de7d2ca44..4e17735f5 100644 --- a/generated/nifpga/nifpga_compilation_test.cpp +++ b/generated/nifpga/nifpga_compilation_test.cpp @@ -47,6 +47,36 @@ NiFpga_Status FindRegister(NiFpga_Session session, char registerName[], uint32_t return NiFpga_FindRegister(session, registerName, registerOffset); } +NiFpga_Status GetBitfileSignature(NiFpga_Session session, uint32_t* signature, size_t* signatureSize) +{ + return NiFpga_GetBitfileSignature(session, signature, signatureSize); +} + +NiFpga_Status GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t* value) +{ + return NiFpga_GetFifoPropertyI32(session, fifo, property, value); +} + +NiFpga_Status GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t* value) +{ + return NiFpga_GetFifoPropertyI64(session, fifo, property, value); +} + +NiFpga_Status GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t* value) +{ + return NiFpga_GetFifoPropertyU32(session, fifo, property, value); +} + +NiFpga_Status GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t* value) +{ + return NiFpga_GetFifoPropertyU64(session, fifo, property, value); +} + +NiFpga_Status GetFpgaViState(NiFpga_Session session, uint32_t* state) +{ + return NiFpga_GetFpgaViState(session, state); +} + NiFpga_Status Open(char bitfile[], char signature[], char resource[], uint32_t attribute, NiFpga_Session* session) { return NiFpga_Open(bitfile, signature, resource, attribute, session); @@ -232,6 +262,26 @@ NiFpga_Status Run(NiFpga_Session session, uint32_t attribute) return NiFpga_Run(session, attribute); } +NiFpga_Status SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t value) +{ + return NiFpga_SetFifoPropertyI32(session, fifo, property, value); +} + +NiFpga_Status SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t value) +{ + return NiFpga_SetFifoPropertyI64(session, fifo, property, value); +} + +NiFpga_Status SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t value) +{ + return NiFpga_SetFifoPropertyU32(session, fifo, property, value); +} + +NiFpga_Status SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t value) +{ + return NiFpga_SetFifoPropertyU64(session, fifo, property, value); +} + NiFpga_Status StartFifo(NiFpga_Session session, uint32_t fifo) { return NiFpga_StartFifo(session, fifo); diff --git a/generated/nifpga/nifpga_library.cpp b/generated/nifpga/nifpga_library.cpp index deb536477..d52cb8f51 100644 --- a/generated/nifpga/nifpga_library.cpp +++ b/generated/nifpga/nifpga_library.cpp @@ -35,6 +35,12 @@ NiFpgaLibrary::NiFpgaLibrary(std::shared_ptr(shared_library_->get_function_pointer("NiFpgaDll_Download")); function_pointers_.FindFifo = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_FindFifo")); function_pointers_.FindRegister = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_FindRegister")); + function_pointers_.GetBitfileSignature = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetBitfileSignature")); + function_pointers_.GetFifoPropertyI32 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetFifoPropertyI32")); + function_pointers_.GetFifoPropertyI64 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetFifoPropertyI64")); + function_pointers_.GetFifoPropertyU32 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetFifoPropertyU32")); + function_pointers_.GetFifoPropertyU64 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetFifoPropertyU64")); + function_pointers_.GetFpgaViState = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_GetFpgaViState")); function_pointers_.Open = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_Open")); function_pointers_.ReadArrayBool = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_ReadArrayBool")); function_pointers_.ReadArrayDbl = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_ReadArrayDbl")); @@ -72,6 +78,10 @@ NiFpgaLibrary::NiFpgaLibrary(std::shared_ptr(shared_library_->get_function_pointer("NiFpgaDll_ReleaseFifoElements")); function_pointers_.Reset = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_Reset")); function_pointers_.Run = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_Run")); + function_pointers_.SetFifoPropertyI32 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_SetFifoPropertyI32")); + function_pointers_.SetFifoPropertyI64 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_SetFifoPropertyI64")); + function_pointers_.SetFifoPropertyU32 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_SetFifoPropertyU32")); + function_pointers_.SetFifoPropertyU64 = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_SetFifoPropertyU64")); function_pointers_.StartFifo = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_StartFifo")); function_pointers_.StopFifo = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_StopFifo")); function_pointers_.UnreserveFifo = reinterpret_cast(shared_library_->get_function_pointer("NiFpgaDll_UnreserveFifo")); @@ -185,6 +195,54 @@ NiFpga_Status NiFpgaLibrary::FindRegister(NiFpga_Session session, char registerN return function_pointers_.FindRegister(session, registerName, registerOffset); } +NiFpga_Status NiFpgaLibrary::GetBitfileSignature(NiFpga_Session session, uint32_t* signature, size_t* signatureSize) +{ + if (!function_pointers_.GetBitfileSignature) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetBitfileSignature."); + } + return function_pointers_.GetBitfileSignature(session, signature, signatureSize); +} + +NiFpga_Status NiFpgaLibrary::GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t* value) +{ + if (!function_pointers_.GetFifoPropertyI32) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetFifoPropertyI32."); + } + return function_pointers_.GetFifoPropertyI32(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t* value) +{ + if (!function_pointers_.GetFifoPropertyI64) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetFifoPropertyI64."); + } + return function_pointers_.GetFifoPropertyI64(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t* value) +{ + if (!function_pointers_.GetFifoPropertyU32) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetFifoPropertyU32."); + } + return function_pointers_.GetFifoPropertyU32(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t* value) +{ + if (!function_pointers_.GetFifoPropertyU64) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetFifoPropertyU64."); + } + return function_pointers_.GetFifoPropertyU64(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::GetFpgaViState(NiFpga_Session session, uint32_t* state) +{ + if (!function_pointers_.GetFpgaViState) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_GetFpgaViState."); + } + return function_pointers_.GetFpgaViState(session, state); +} + NiFpga_Status NiFpgaLibrary::Open(char bitfile[], char signature[], char resource[], uint32_t attribute, NiFpga_Session* session) { if (!function_pointers_.Open) { @@ -481,6 +539,38 @@ NiFpga_Status NiFpgaLibrary::Run(NiFpga_Session session, uint32_t attribute) return function_pointers_.Run(session, attribute); } +NiFpga_Status NiFpgaLibrary::SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t value) +{ + if (!function_pointers_.SetFifoPropertyI32) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_SetFifoPropertyI32."); + } + return function_pointers_.SetFifoPropertyI32(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t value) +{ + if (!function_pointers_.SetFifoPropertyI64) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_SetFifoPropertyI64."); + } + return function_pointers_.SetFifoPropertyI64(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t value) +{ + if (!function_pointers_.SetFifoPropertyU32) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_SetFifoPropertyU32."); + } + return function_pointers_.SetFifoPropertyU32(session, fifo, property, value); +} + +NiFpga_Status NiFpgaLibrary::SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t value) +{ + if (!function_pointers_.SetFifoPropertyU64) { + throw nidevice_grpc::LibraryLoadException("Could not find NiFpga_SetFifoPropertyU64."); + } + return function_pointers_.SetFifoPropertyU64(session, fifo, property, value); +} + NiFpga_Status NiFpgaLibrary::StartFifo(NiFpga_Session session, uint32_t fifo) { if (!function_pointers_.StartFifo) { diff --git a/generated/nifpga/nifpga_library.h b/generated/nifpga/nifpga_library.h index 7890d5565..9993fd0ca 100644 --- a/generated/nifpga/nifpga_library.h +++ b/generated/nifpga/nifpga_library.h @@ -29,6 +29,12 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { NiFpga_Status Download(NiFpga_Session session) override; NiFpga_Status FindFifo(NiFpga_Session session, char fifoName[], uint32_t* fifoNumber) override; NiFpga_Status FindRegister(NiFpga_Session session, char registerName[], uint32_t* registerOffset) override; + NiFpga_Status GetBitfileSignature(NiFpga_Session session, uint32_t* signature, size_t* signatureSize) override; + NiFpga_Status GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t* value) override; + NiFpga_Status GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t* value) override; + NiFpga_Status GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t* value) override; + NiFpga_Status GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t* value) override; + NiFpga_Status GetFpgaViState(NiFpga_Session session, uint32_t* state) override; NiFpga_Status Open(char bitfile[], char signature[], char resource[], uint32_t attribute, NiFpga_Session* session) override; NiFpga_Status ReadArrayBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool array[], size_t size) override; NiFpga_Status ReadArrayDbl(NiFpga_Session session, uint32_t indicator, double array[], size_t size) override; @@ -66,6 +72,10 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { NiFpga_Status ReleaseFifoElements(NiFpga_Session session, uint32_t fifo, size_t elements) override; NiFpga_Status Reset(NiFpga_Session session) override; NiFpga_Status Run(NiFpga_Session session, uint32_t attribute) override; + NiFpga_Status SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t value) override; + NiFpga_Status SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t value) override; + NiFpga_Status SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t value) override; + NiFpga_Status SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t value) override; NiFpga_Status StartFifo(NiFpga_Session session, uint32_t fifo) override; NiFpga_Status StopFifo(NiFpga_Session session, uint32_t fifo) override; NiFpga_Status UnreserveFifo(NiFpga_Session session, uint32_t fifo) override; @@ -112,6 +122,12 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { using DownloadPtr = decltype(&NiFpga_Download); using FindFifoPtr = decltype(&NiFpga_FindFifo); using FindRegisterPtr = decltype(&NiFpga_FindRegister); + using GetBitfileSignaturePtr = decltype(&NiFpga_GetBitfileSignature); + using GetFifoPropertyI32Ptr = decltype(&NiFpga_GetFifoPropertyI32); + using GetFifoPropertyI64Ptr = decltype(&NiFpga_GetFifoPropertyI64); + using GetFifoPropertyU32Ptr = decltype(&NiFpga_GetFifoPropertyU32); + using GetFifoPropertyU64Ptr = decltype(&NiFpga_GetFifoPropertyU64); + using GetFpgaViStatePtr = decltype(&NiFpga_GetFpgaViState); using OpenPtr = decltype(&NiFpga_Open); using ReadArrayBoolPtr = decltype(&NiFpga_ReadArrayBool); using ReadArrayDblPtr = decltype(&NiFpga_ReadArrayDbl); @@ -149,6 +165,10 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { using ReleaseFifoElementsPtr = decltype(&NiFpga_ReleaseFifoElements); using ResetPtr = decltype(&NiFpga_Reset); using RunPtr = decltype(&NiFpga_Run); + using SetFifoPropertyI32Ptr = decltype(&NiFpga_SetFifoPropertyI32); + using SetFifoPropertyI64Ptr = decltype(&NiFpga_SetFifoPropertyI64); + using SetFifoPropertyU32Ptr = decltype(&NiFpga_SetFifoPropertyU32); + using SetFifoPropertyU64Ptr = decltype(&NiFpga_SetFifoPropertyU64); using StartFifoPtr = decltype(&NiFpga_StartFifo); using StopFifoPtr = decltype(&NiFpga_StopFifo); using UnreserveFifoPtr = decltype(&NiFpga_UnreserveFifo); @@ -195,6 +215,12 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { DownloadPtr Download; FindFifoPtr FindFifo; FindRegisterPtr FindRegister; + GetBitfileSignaturePtr GetBitfileSignature; + GetFifoPropertyI32Ptr GetFifoPropertyI32; + GetFifoPropertyI64Ptr GetFifoPropertyI64; + GetFifoPropertyU32Ptr GetFifoPropertyU32; + GetFifoPropertyU64Ptr GetFifoPropertyU64; + GetFpgaViStatePtr GetFpgaViState; OpenPtr Open; ReadArrayBoolPtr ReadArrayBool; ReadArrayDblPtr ReadArrayDbl; @@ -232,6 +258,10 @@ class NiFpgaLibrary : public nifpga_grpc::NiFpgaLibraryInterface { ReleaseFifoElementsPtr ReleaseFifoElements; ResetPtr Reset; RunPtr Run; + SetFifoPropertyI32Ptr SetFifoPropertyI32; + SetFifoPropertyI64Ptr SetFifoPropertyI64; + SetFifoPropertyU32Ptr SetFifoPropertyU32; + SetFifoPropertyU64Ptr SetFifoPropertyU64; StartFifoPtr StartFifo; StopFifoPtr StopFifo; UnreserveFifoPtr UnreserveFifo; diff --git a/generated/nifpga/nifpga_library_interface.h b/generated/nifpga/nifpga_library_interface.h index f4f95c045..9ed812d7a 100644 --- a/generated/nifpga/nifpga_library_interface.h +++ b/generated/nifpga/nifpga_library_interface.h @@ -23,6 +23,12 @@ class NiFpgaLibraryInterface { virtual NiFpga_Status Download(NiFpga_Session session) = 0; virtual NiFpga_Status FindFifo(NiFpga_Session session, char fifoName[], uint32_t* fifoNumber) = 0; virtual NiFpga_Status FindRegister(NiFpga_Session session, char registerName[], uint32_t* registerOffset) = 0; + virtual NiFpga_Status GetBitfileSignature(NiFpga_Session session, uint32_t* signature, size_t* signatureSize) = 0; + virtual NiFpga_Status GetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t* value) = 0; + virtual NiFpga_Status GetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t* value) = 0; + virtual NiFpga_Status GetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t* value) = 0; + virtual NiFpga_Status GetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t* value) = 0; + virtual NiFpga_Status GetFpgaViState(NiFpga_Session session, uint32_t* state) = 0; virtual NiFpga_Status Open(char bitfile[], char signature[], char resource[], uint32_t attribute, NiFpga_Session* session) = 0; virtual NiFpga_Status ReadArrayBool(NiFpga_Session session, uint32_t indicator, NiFpga_Bool array[], size_t size) = 0; virtual NiFpga_Status ReadArrayDbl(NiFpga_Session session, uint32_t indicator, double array[], size_t size) = 0; @@ -60,6 +66,10 @@ class NiFpgaLibraryInterface { virtual NiFpga_Status ReleaseFifoElements(NiFpga_Session session, uint32_t fifo, size_t elements) = 0; virtual NiFpga_Status Reset(NiFpga_Session session) = 0; virtual NiFpga_Status Run(NiFpga_Session session, uint32_t attribute) = 0; + virtual NiFpga_Status SetFifoPropertyI32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t value) = 0; + virtual NiFpga_Status SetFifoPropertyI64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t value) = 0; + virtual NiFpga_Status SetFifoPropertyU32(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t value) = 0; + virtual NiFpga_Status SetFifoPropertyU64(NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t value) = 0; virtual NiFpga_Status StartFifo(NiFpga_Session session, uint32_t fifo) = 0; virtual NiFpga_Status StopFifo(NiFpga_Session session, uint32_t fifo) = 0; virtual NiFpga_Status UnreserveFifo(NiFpga_Session session, uint32_t fifo) = 0; diff --git a/generated/nifpga/nifpga_mock_library.h b/generated/nifpga/nifpga_mock_library.h index 4d4e5cfc1..5b8b4933d 100644 --- a/generated/nifpga/nifpga_mock_library.h +++ b/generated/nifpga/nifpga_mock_library.h @@ -25,6 +25,12 @@ class NiFpgaMockLibrary : public nifpga_grpc::NiFpgaLibraryInterface { MOCK_METHOD(NiFpga_Status, Download, (NiFpga_Session session), (override)); MOCK_METHOD(NiFpga_Status, FindFifo, (NiFpga_Session session, char fifoName[], uint32_t* fifoNumber), (override)); MOCK_METHOD(NiFpga_Status, FindRegister, (NiFpga_Session session, char registerName[], uint32_t* registerOffset), (override)); + MOCK_METHOD(NiFpga_Status, GetBitfileSignature, (NiFpga_Session session, uint32_t* signature, size_t* signatureSize), (override)); + MOCK_METHOD(NiFpga_Status, GetFifoPropertyI32, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t* value), (override)); + MOCK_METHOD(NiFpga_Status, GetFifoPropertyI64, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t* value), (override)); + MOCK_METHOD(NiFpga_Status, GetFifoPropertyU32, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t* value), (override)); + MOCK_METHOD(NiFpga_Status, GetFifoPropertyU64, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t* value), (override)); + MOCK_METHOD(NiFpga_Status, GetFpgaViState, (NiFpga_Session session, uint32_t* state), (override)); MOCK_METHOD(NiFpga_Status, Open, (char bitfile[], char signature[], char resource[], uint32_t attribute, NiFpga_Session* session), (override)); MOCK_METHOD(NiFpga_Status, ReadArrayBool, (NiFpga_Session session, uint32_t indicator, NiFpga_Bool array[], size_t size), (override)); MOCK_METHOD(NiFpga_Status, ReadArrayDbl, (NiFpga_Session session, uint32_t indicator, double array[], size_t size), (override)); @@ -62,6 +68,10 @@ class NiFpgaMockLibrary : public nifpga_grpc::NiFpgaLibraryInterface { MOCK_METHOD(NiFpga_Status, ReleaseFifoElements, (NiFpga_Session session, uint32_t fifo, size_t elements), (override)); MOCK_METHOD(NiFpga_Status, Reset, (NiFpga_Session session), (override)); MOCK_METHOD(NiFpga_Status, Run, (NiFpga_Session session, uint32_t attribute), (override)); + MOCK_METHOD(NiFpga_Status, SetFifoPropertyI32, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int32_t value), (override)); + MOCK_METHOD(NiFpga_Status, SetFifoPropertyI64, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, int64_t value), (override)); + MOCK_METHOD(NiFpga_Status, SetFifoPropertyU32, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint32_t value), (override)); + MOCK_METHOD(NiFpga_Status, SetFifoPropertyU64, (NiFpga_Session session, uint32_t fifo, NiFpga_FifoProperty property, uint64_t value), (override)); MOCK_METHOD(NiFpga_Status, StartFifo, (NiFpga_Session session, uint32_t fifo), (override)); MOCK_METHOD(NiFpga_Status, StopFifo, (NiFpga_Session session, uint32_t fifo), (override)); MOCK_METHOD(NiFpga_Status, UnreserveFifo, (NiFpga_Session session, uint32_t fifo), (override)); diff --git a/generated/nifpga/nifpga_service.cpp b/generated/nifpga/nifpga_service.cpp index 2d7eb303c..305081496 100644 --- a/generated/nifpga/nifpga_service.cpp +++ b/generated/nifpga/nifpga_service.cpp @@ -73,7 +73,22 @@ namespace nifpga_grpc { try { auto session_grpc_session = request->session(); NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); - uint32_t attribute = request->attribute(); + uint32_t attribute; + switch (request->attribute_enum_case()) { + case nifpga_grpc::CloseRequest::AttributeEnumCase::kAttribute: { + attribute = static_cast(request->attribute()); + break; + } + case nifpga_grpc::CloseRequest::AttributeEnumCase::kAttributeRaw: { + attribute = static_cast(request->attribute_raw()); + break; + } + case nifpga_grpc::CloseRequest::AttributeEnumCase::ATTRIBUTE_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for attribute was not specified or out of range"); + break; + } + } + session_repository_->remove_session(session_grpc_session.name()); auto status = library_->Close(session, attribute); if (!status_ok(status)) { @@ -234,6 +249,221 @@ namespace nifpga_grpc { } } + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetBitfileSignature(::grpc::ServerContext* context, const GetBitfileSignatureRequest* request, GetBitfileSignatureResponse* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t signature {}; + size_t signature_size {}; + auto status = library_->GetBitfileSignature(session, &signature, &signature_size); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_signature(signature); + response->set_signature_size(signature_size); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetFifoPropertyI32(::grpc::ServerContext* context, const GetFifoPropertyI32Request* request, GetFifoPropertyI32Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::GetFifoPropertyI32Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::GetFifoPropertyI32Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::GetFifoPropertyI32Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + int32_t value {}; + auto status = library_->GetFifoPropertyI32(session, fifo, property, &value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_value(value); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetFifoPropertyI64(::grpc::ServerContext* context, const GetFifoPropertyI64Request* request, GetFifoPropertyI64Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::GetFifoPropertyI64Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::GetFifoPropertyI64Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::GetFifoPropertyI64Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + int64_t value {}; + auto status = library_->GetFifoPropertyI64(session, fifo, property, &value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_value(value); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetFifoPropertyU32(::grpc::ServerContext* context, const GetFifoPropertyU32Request* request, GetFifoPropertyU32Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::GetFifoPropertyU32Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::GetFifoPropertyU32Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::GetFifoPropertyU32Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + uint32_t value {}; + auto status = library_->GetFifoPropertyU32(session, fifo, property, &value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_value(value); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetFifoPropertyU64(::grpc::ServerContext* context, const GetFifoPropertyU64Request* request, GetFifoPropertyU64Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::GetFifoPropertyU64Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::GetFifoPropertyU64Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::GetFifoPropertyU64Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + uint64_t value {}; + auto status = library_->GetFifoPropertyU64(session, fifo, property, &value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_value(value); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::GetFpgaViState(::grpc::ServerContext* context, const GetFpgaViStateRequest* request, GetFpgaViStateResponse* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t state {}; + auto status = library_->GetFpgaViState(session, &state); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + response->set_state(static_cast(state)); + response->set_state_raw(state); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + //--------------------------------------------------------------------- //--------------------------------------------------------------------- ::grpc::Status NiFpgaService::Open(::grpc::ServerContext* context, const OpenRequest* request, OpenResponse* response) @@ -248,7 +478,26 @@ namespace nifpga_grpc { char* signature = (char*)signature_mbcs.c_str(); auto resource_mbcs = convert_from_grpc(request->resource()); char* resource = (char*)resource_mbcs.c_str(); - uint32_t attribute = request->attribute(); + uint32_t attribute; + switch (request->attribute_enum_case()) { + case nifpga_grpc::OpenRequest::AttributeEnumCase::kAttributeMapped: { + auto attribute_imap_it = openattribute_input_map_.find(request->attribute_mapped()); + if (attribute_imap_it == openattribute_input_map_.end()) { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for attribute_mapped was not specified or out of range."); + } + attribute = static_cast(attribute_imap_it->second); + break; + } + case nifpga_grpc::OpenRequest::AttributeEnumCase::kAttributeRaw: { + attribute = static_cast(request->attribute_raw()); + break; + } + case nifpga_grpc::OpenRequest::AttributeEnumCase::ATTRIBUTE_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for attribute was not specified or out of range"); + break; + } + } + auto initialization_behavior = request->initialization_behavior(); bool new_session_initialized {}; @@ -1275,7 +1524,22 @@ namespace nifpga_grpc { try { auto session_grpc_session = request->session(); NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); - uint32_t attribute = request->attribute(); + uint32_t attribute; + switch (request->attribute_enum_case()) { + case nifpga_grpc::RunRequest::AttributeEnumCase::kAttribute: { + attribute = static_cast(request->attribute()); + break; + } + case nifpga_grpc::RunRequest::AttributeEnumCase::kAttributeRaw: { + attribute = static_cast(request->attribute_raw()); + break; + } + case nifpga_grpc::RunRequest::AttributeEnumCase::ATTRIBUTE_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for attribute was not specified or out of range"); + break; + } + } + auto status = library_->Run(session, attribute); if (!status_ok(status)) { return ConvertApiErrorStatusForNiFpga_Session(context, status, session); @@ -1288,6 +1552,166 @@ namespace nifpga_grpc { } } + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::SetFifoPropertyI32(::grpc::ServerContext* context, const SetFifoPropertyI32Request* request, SetFifoPropertyI32Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::SetFifoPropertyI32Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::SetFifoPropertyI32Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::SetFifoPropertyI32Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + int32_t value = request->value(); + auto status = library_->SetFifoPropertyI32(session, fifo, property, value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::SetFifoPropertyI64(::grpc::ServerContext* context, const SetFifoPropertyI64Request* request, SetFifoPropertyI64Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::SetFifoPropertyI64Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::SetFifoPropertyI64Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::SetFifoPropertyI64Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + int64_t value = request->value(); + auto status = library_->SetFifoPropertyI64(session, fifo, property, value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::SetFifoPropertyU32(::grpc::ServerContext* context, const SetFifoPropertyU32Request* request, SetFifoPropertyU32Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::SetFifoPropertyU32Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::SetFifoPropertyU32Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::SetFifoPropertyU32Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + uint32_t value = request->value(); + auto status = library_->SetFifoPropertyU32(session, fifo, property, value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + + //--------------------------------------------------------------------- + //--------------------------------------------------------------------- + ::grpc::Status NiFpgaService::SetFifoPropertyU64(::grpc::ServerContext* context, const SetFifoPropertyU64Request* request, SetFifoPropertyU64Response* response) + { + if (context->IsCancelled()) { + return ::grpc::Status::CANCELLED; + } + try { + auto session_grpc_session = request->session(); + NiFpga_Session session = session_repository_->access_session(session_grpc_session.name()); + uint32_t fifo = request->fifo(); + NiFpga_FifoProperty property; + switch (request->property_enum_case()) { + case nifpga_grpc::SetFifoPropertyU64Request::PropertyEnumCase::kProperty: { + property = static_cast(request->property()); + break; + } + case nifpga_grpc::SetFifoPropertyU64Request::PropertyEnumCase::kPropertyRaw: { + property = static_cast(request->property_raw()); + break; + } + case nifpga_grpc::SetFifoPropertyU64Request::PropertyEnumCase::PROPERTY_ENUM_NOT_SET: { + return ::grpc::Status(::grpc::INVALID_ARGUMENT, "The value for property was not specified or out of range"); + break; + } + } + + uint64_t value = request->value(); + auto status = library_->SetFifoPropertyU64(session, fifo, property, value); + if (!status_ok(status)) { + return ConvertApiErrorStatusForNiFpga_Session(context, status, session); + } + response->set_status(status); + return ::grpc::Status::OK; + } + catch (nidevice_grpc::NonDriverException& ex) { + return ex.GetStatus(); + } + } + //--------------------------------------------------------------------- //--------------------------------------------------------------------- ::grpc::Status NiFpgaService::StartFifo(::grpc::ServerContext* context, const StartFifoRequest* request, StartFifoResponse* response) @@ -2380,7 +2804,7 @@ namespace nifpga_grpc { NiFpgaFeatureToggles::NiFpgaFeatureToggles( const nidevice_grpc::FeatureToggles& feature_toggles) : is_enabled( - feature_toggles.is_feature_enabled("nifpga", CodeReadiness::kNextRelease)) + feature_toggles.is_feature_enabled("nifpga", CodeReadiness::kRelease)) { } } // namespace nifpga_grpc diff --git a/generated/nifpga/nifpga_service.h b/generated/nifpga/nifpga_service.h index 349795d5c..1a0abd76a 100644 --- a/generated/nifpga/nifpga_service.h +++ b/generated/nifpga/nifpga_service.h @@ -50,6 +50,12 @@ class NiFpgaService final : public NiFpga::Service { ::grpc::Status Download(::grpc::ServerContext* context, const DownloadRequest* request, DownloadResponse* response) override; ::grpc::Status FindFifo(::grpc::ServerContext* context, const FindFifoRequest* request, FindFifoResponse* response) override; ::grpc::Status FindRegister(::grpc::ServerContext* context, const FindRegisterRequest* request, FindRegisterResponse* response) override; + ::grpc::Status GetBitfileSignature(::grpc::ServerContext* context, const GetBitfileSignatureRequest* request, GetBitfileSignatureResponse* response) override; + ::grpc::Status GetFifoPropertyI32(::grpc::ServerContext* context, const GetFifoPropertyI32Request* request, GetFifoPropertyI32Response* response) override; + ::grpc::Status GetFifoPropertyI64(::grpc::ServerContext* context, const GetFifoPropertyI64Request* request, GetFifoPropertyI64Response* response) override; + ::grpc::Status GetFifoPropertyU32(::grpc::ServerContext* context, const GetFifoPropertyU32Request* request, GetFifoPropertyU32Response* response) override; + ::grpc::Status GetFifoPropertyU64(::grpc::ServerContext* context, const GetFifoPropertyU64Request* request, GetFifoPropertyU64Response* response) override; + ::grpc::Status GetFpgaViState(::grpc::ServerContext* context, const GetFpgaViStateRequest* request, GetFpgaViStateResponse* response) override; ::grpc::Status Open(::grpc::ServerContext* context, const OpenRequest* request, OpenResponse* response) override; ::grpc::Status ReadArrayBool(::grpc::ServerContext* context, const ReadArrayBoolRequest* request, ReadArrayBoolResponse* response) override; ::grpc::Status ReadArrayDbl(::grpc::ServerContext* context, const ReadArrayDblRequest* request, ReadArrayDblResponse* response) override; @@ -87,6 +93,10 @@ class NiFpgaService final : public NiFpga::Service { ::grpc::Status ReleaseFifoElements(::grpc::ServerContext* context, const ReleaseFifoElementsRequest* request, ReleaseFifoElementsResponse* response) override; ::grpc::Status Reset(::grpc::ServerContext* context, const ResetRequest* request, ResetResponse* response) override; ::grpc::Status Run(::grpc::ServerContext* context, const RunRequest* request, RunResponse* response) override; + ::grpc::Status SetFifoPropertyI32(::grpc::ServerContext* context, const SetFifoPropertyI32Request* request, SetFifoPropertyI32Response* response) override; + ::grpc::Status SetFifoPropertyI64(::grpc::ServerContext* context, const SetFifoPropertyI64Request* request, SetFifoPropertyI64Response* response) override; + ::grpc::Status SetFifoPropertyU32(::grpc::ServerContext* context, const SetFifoPropertyU32Request* request, SetFifoPropertyU32Response* response) override; + ::grpc::Status SetFifoPropertyU64(::grpc::ServerContext* context, const SetFifoPropertyU64Request* request, SetFifoPropertyU64Response* response) override; ::grpc::Status StartFifo(::grpc::ServerContext* context, const StartFifoRequest* request, StartFifoResponse* response) override; ::grpc::Status StopFifo(::grpc::ServerContext* context, const StopFifoRequest* request, StopFifoResponse* response) override; ::grpc::Status UnreserveFifo(::grpc::ServerContext* context, const UnreserveFifoRequest* request, UnreserveFifoResponse* response) override; @@ -127,6 +137,10 @@ class NiFpgaService final : public NiFpga::Service { LibrarySharedPtr library_; ResourceRepositorySharedPtr session_repository_; ::grpc::Status ConvertApiErrorStatusForNiFpga_Session(::grpc::ServerContextBase* context, int32_t status, NiFpga_Session session); + std::map irq_input_map_ { {0, 0},{1, 1},{2, 2},{3, 4},{4, 8},{5, 16},{6, 32},{7, 64},{8, 128},{9, 256},{10, 512},{11, 1024},{12, 2048},{13, 4096},{14, 8192},{15, 16384},{16, 32768},{17, 65536},{18, 131072},{19, 262144},{20, 524288},{21, 1048576},{22, 2097152},{23, 4194304},{24, 8388608},{25, 16777216},{26, 33554432},{27, 67108864},{28, 134217728},{29, 268435456},{30, 536870912},{31, 1073741824},{32, 2147483648}, }; + std::map irq_output_map_ { {0, 0},{1, 1},{2, 2},{4, 3},{8, 4},{16, 5},{32, 6},{64, 7},{128, 8},{256, 9},{512, 10},{1024, 11},{2048, 12},{4096, 13},{8192, 14},{16384, 15},{32768, 16},{65536, 17},{131072, 18},{262144, 19},{524288, 20},{1048576, 21},{2097152, 22},{4194304, 23},{8388608, 24},{16777216, 25},{33554432, 26},{67108864, 27},{134217728, 28},{268435456, 29},{536870912, 30},{1073741824, 31},{2147483648, 32}, }; + std::map openattribute_input_map_ { {0, 0},{1, 1},{2, 2},{3, 1073741824},{4, 2147483648}, }; + std::map openattribute_output_map_ { {0, 0},{1, 1},{2, 2},{1073741824, 3},{2147483648, 4}, }; NiFpgaFeatureToggles feature_toggles_; }; diff --git a/source/codegen/metadata/nifpga/config.py b/source/codegen/metadata/nifpga/config.py index 16846468d..5eef81525 100644 --- a/source/codegen/metadata/nifpga/config.py +++ b/source/codegen/metadata/nifpga/config.py @@ -27,7 +27,8 @@ 'uint16_t': 'uint32', 'uint32_t': 'uint32', 'uint64_t': 'uint64', - 'NiFpga_Bool': 'bool' + 'NiFpga_Bool': 'bool', + 'NiFpga_FifoProperty': 'uint32', }, 'custom_types': [], 'library_info': { diff --git a/source/codegen/metadata/nifpga/enums.py b/source/codegen/metadata/nifpga/enums.py index 193c71887..409c018b3 100644 --- a/source/codegen/metadata/nifpga/enums.py +++ b/source/codegen/metadata/nifpga/enums.py @@ -1,2 +1,267 @@ enums = { + 'CloseAttribute': { + 'values': [ + { + 'name': 'NO_RESET_IF_LAST_SESSION', + 'value': 1 + } + ] + }, + 'FifoFlowControl': { + 'force-include': True, + 'values': [ + { + 'name': 'DISABLED', + 'value': 1 + }, + { + 'name': 'ENABLED', + 'value': 2 + } + ] + }, + 'FifoProperty': { + 'values': [ + { + 'name': 'BYTES_PER_ELEMENT', + 'value': 1 + }, + { + 'name': 'HOST_BUFFER_ALLOCATION_GRANULARITY', + 'value': 2 + }, + { + 'name': 'HOST_BUFFER_SIZE', + 'value': 3 + }, + { + 'name': 'HOST_BUFFER_MIRROR_SIZE', + 'value': 4 + }, + { + 'name': 'HOST_BUFFER_TYPE', + 'value': 5 + }, + { + 'name': 'HOST_BUFFER', + 'value': 6 + }, + { + 'name': 'FLOW_CONTROL', + 'value': 7 + }, + { + 'name': 'ELEMENTS_CURRENTLY_ACQUIRED', + 'value': 8 + }, + { + 'name': 'PREFERRED_NUMA_NODE', + 'value': 9 + }, + { + 'name': 'NUMBER_OF_ZERO_COPY_REGIONS', + 'value': 10 + }, + { + 'name': 'NOT_SUPPORTED', + 'value': 0 + } + ] + }, + 'FpgaViState': { + 'values': [ + { + 'name': 'NOT_RUNNING', + 'value': 0 + }, + { + 'name': 'INVALID', + 'value': 1 + }, + { + 'name': 'RUNNING', + 'value': 2 + }, + { + 'name': 'NATURALLY_STOPPED', + 'value': 3 + } + ] + }, + 'HostBufferType': { + 'force-include': True, + 'values': [ + { + 'name': 'ALLOCATED_BY_RIO', + 'value': 1 + }, + { + 'name': 'ALLOCATED_BY_USER', + 'value': 2 + } + ] + }, + 'Irq': { + 'force-include': True, + 'generate-mappings': True, + 'values': [ + { + 'name': 'Irq_0', + 'value': 1 + }, + { + 'name': 'Irq_1', + 'value': 2 + }, + { + 'name': 'Irq_2', + 'value': 4 + }, + { + 'name': 'Irq_3', + 'value': 8 + }, + { + 'name': 'Irq_4', + 'value': 16 + }, + { + 'name': 'Irq_5', + 'value': 32 + }, + { + 'name': 'Irq_6', + 'value': 64 + }, + { + 'name': 'Irq_7', + 'value': 128 + }, + { + 'name': 'Irq_8', + 'value': 256 + }, + { + 'name': 'Irq_9', + 'value': 512 + }, + { + 'name': 'Irq_10', + 'value': 1024 + }, + { + 'name': 'Irq_11', + 'value': 2048 + }, + { + 'name': 'Irq_12', + 'value': 4096 + }, + { + 'name': 'Irq_13', + 'value': 8192 + }, + { + 'name': 'Irq_14', + 'value': 16384 + }, + { + 'name': 'Irq_15', + 'value': 32768 + }, + { + 'name': 'Irq_16', + 'value': 65536 + }, + { + 'name': 'Irq_17', + 'value': 131072 + }, + { + 'name': 'Irq_18', + 'value': 262144 + }, + { + 'name': 'Irq_19', + 'value': 524288 + }, + { + 'name': 'Irq_20', + 'value': 1048576 + }, + { + 'name': 'Irq_21', + 'value': 2097152 + }, + { + 'name': 'Irq_22', + 'value': 4194304 + }, + { + 'name': 'Irq_23', + 'value': 8388608 + }, + { + 'name': 'Irq_24', + 'value': 16777216 + }, + { + 'name': 'Irq_25', + 'value': 33554432 + }, + { + 'name': 'Irq_26', + 'value': 67108864 + }, + { + 'name': 'Irq_27', + 'value': 134217728 + }, + { + 'name': 'Irq_28', + 'value': 268435456 + }, + { + 'name': 'Irq_29', + 'value': 536870912 + }, + { + 'name': 'Irq_30', + 'value': 1073741824 + }, + { + 'name': 'Irq_31', + 'value': 2147483648 + } + ] + }, + 'OpenAttribute': { + 'generate-mappings': True, + 'values': [ + { + 'name': 'NO_RUN', + 'value': 1 + }, + { + 'name': 'BITFILE_PATH_IS_UTF8', + 'value': 2 + }, + { + 'name': 'BITFILE_CONTENTS_NOT_PATH', + 'value': 1073741824 + }, + { + 'name': 'IGNORE_SIGNATURE_ARGUMENT', + 'value': 2147483648 + } + ] + }, + 'RunAttribute': { + 'values': [ + { + 'name': 'WAIT_UNTIL_DONE', + 'value': 1 + } + ] + } } diff --git a/source/codegen/metadata/nifpga/functions.py b/source/codegen/metadata/nifpga/functions.py index 125686475..32944cea1 100644 --- a/source/codegen/metadata/nifpga/functions.py +++ b/source/codegen/metadata/nifpga/functions.py @@ -1070,6 +1070,7 @@ }, { 'direction': 'in', + 'enum': 'CloseAttribute', 'name': 'attribute', 'type': 'uint32_t' } @@ -1289,7 +1290,6 @@ 'returns': 'NiFpga_Status' }, 'GetBitfileSignature': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1310,7 +1310,6 @@ 'returns': 'NiFpga_Status' }, 'GetFifoPropertyI32': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1324,6 +1323,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -1336,7 +1336,6 @@ 'returns': 'NiFpga_Status' }, 'GetFifoPropertyI64': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1350,6 +1349,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -1388,7 +1388,6 @@ 'returns': 'NiFpga_Status' }, 'GetFifoPropertyU32': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1402,6 +1401,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -1414,7 +1414,6 @@ 'returns': 'NiFpga_Status' }, 'GetFifoPropertyU64': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1428,6 +1427,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -1440,7 +1440,6 @@ 'returns': 'NiFpga_Status' }, 'GetFpgaViState': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -1449,6 +1448,7 @@ }, { 'direction': 'out', + 'enum': 'FpgaViState', 'name': 'state', 'type': 'uint32_t' } @@ -1567,6 +1567,7 @@ }, { 'direction': 'in', + 'enum': 'OpenAttribute', 'name': 'attribute', 'type': 'uint32_t' }, @@ -2771,6 +2772,7 @@ }, { 'direction': 'in', + 'enum': 'RunAttribute', 'name': 'attribute', 'type': 'uint32_t' } @@ -2778,7 +2780,6 @@ 'returns': 'NiFpga_Status' }, 'SetFifoPropertyI32': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -2792,6 +2793,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -2804,7 +2806,6 @@ 'returns': 'NiFpga_Status' }, 'SetFifoPropertyI64': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -2818,6 +2819,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -2856,7 +2858,6 @@ 'returns': 'NiFpga_Status' }, 'SetFifoPropertyU32': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -2870,6 +2871,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' }, @@ -2882,7 +2884,6 @@ 'returns': 'NiFpga_Status' }, 'SetFifoPropertyU64': { - 'codegen_method': 'no', 'parameters': [ { 'direction': 'in', @@ -2896,6 +2897,7 @@ }, { 'direction': 'in', + 'enum': 'FifoProperty', 'name': 'property', 'type': 'NiFpga_FifoProperty' },