diff options
Diffstat (limited to 'Software/Code_Composer')
82 files changed, 10029 insertions, 71 deletions
diff --git a/Software/Code_Composer/twine_usblib_demo/.cproject b/Software/Code_Composer/twine_usblib_demo/.cproject index c6812f5ac..b1256533d 100644 --- a/Software/Code_Composer/twine_usblib_demo/.cproject +++ b/Software/Code_Composer/twine_usblib_demo/.cproject @@ -52,6 +52,8 @@ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN.572182054" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/> <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH.411074002" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH" useByScannerDiscovery="false" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/twine_usblib}""/> + <listOptionValue builtIn="false" value="C:\ti\tirtos_tivac_2_16_00_08\products\bios_6_45_01_29\packages"/> + <listOptionValue builtIn="false" value="C:\ti\xdctools_3_32_00_06_core\packages"/> <listOptionValue builtIn="false" value=""${workspace_loc:/grlib}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/twine_graphicslib}""/> <listOptionValue builtIn="false" value=""C:/ti/TivaWare_C_Series-2.1.4.178/examples/boards/dk-tm4c129x""/> diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c index a9684e855..02bf45004 100644 --- a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.c @@ -7,7 +7,7 @@ #endif #include "MessageType.pb-c.h" -static const ProtobufCEnumValue message_type__enum_values_by_number[46] = +static const ProtobufCEnumValue message_type__enum_values_by_number[66] = { { "RGB", "MESSAGE_TYPE__RGB", 0 }, { "Job", "MESSAGE_TYPE__Job", 1 }, @@ -46,6 +46,26 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[46] = { "StubExtFlashReadResponse", "MESSAGE_TYPE__StubExtFlashReadResponse", 34 }, { "StubExtFlashWriteRequest", "MESSAGE_TYPE__StubExtFlashWriteRequest", 35 }, { "StubExtFlashWriteResponse", "MESSAGE_TYPE__StubExtFlashWriteResponse", 36 }, + { "StubFPGAReadBackRegRequest", "MESSAGE_TYPE__StubFPGAReadBackRegRequest", 37 }, + { "StubFPGAReadBackRegResponse", "MESSAGE_TYPE__StubFPGAReadBackRegResponse", 38 }, + { "StubFPGAReadVersionRequest", "MESSAGE_TYPE__StubFPGAReadVersionRequest", 39 }, + { "StubFPGAReadVersionResponse", "MESSAGE_TYPE__StubFPGAReadVersionResponse", 40 }, + { "StubL6470DriverRequest", "MESSAGE_TYPE__StubL6470DriverRequest", 41 }, + { "StubL6470DriverResponse", "MESSAGE_TYPE__StubL6470DriverResponse", 42 }, + { "StubMotorInitRequest", "MESSAGE_TYPE__StubMotorInitRequest", 43 }, + { "StubMotorInitResponse", "MESSAGE_TYPE__StubMotorInitResponse", 44 }, + { "StubMotorRunRequest", "MESSAGE_TYPE__StubMotorRunRequest", 45 }, + { "StubMotorRunResponse", "MESSAGE_TYPE__StubMotorRunResponse", 46 }, + { "StubMotorStopRequest", "MESSAGE_TYPE__StubMotorStopRequest", 47 }, + { "StubMotorStopResponse", "MESSAGE_TYPE__StubMotorStopResponse", 48 }, + { "StubMotorStatusRequest", "MESSAGE_TYPE__StubMotorStatusRequest", 49 }, + { "StubMotorStatusResponse", "MESSAGE_TYPE__StubMotorStatusResponse", 50 }, + { "StubMotorMovRequest", "MESSAGE_TYPE__StubMotorMovRequest", 51 }, + { "StubMotorMovResponse", "MESSAGE_TYPE__StubMotorMovResponse", 52 }, + { "StubMotorSpeedRequest", "MESSAGE_TYPE__StubMotorSpeedRequest", 53 }, + { "StubMotorSpeedResponse", "MESSAGE_TYPE__StubMotorSpeedResponse", 54 }, + { "StubMotorPositionRequest", "MESSAGE_TYPE__StubMotorPositionRequest", 55 }, + { "StubMotorPositionResponse", "MESSAGE_TYPE__StubMotorPositionResponse", 56 }, { "ExternalBridgeUdpDiscoveryPacket", "MESSAGE_TYPE__ExternalBridgeUdpDiscoveryPacket", 1000 }, { "ExternalClientLoginRequest", "MESSAGE_TYPE__ExternalClientLoginRequest", 1001 }, { "ExternalClientLoginResponse", "MESSAGE_TYPE__ExternalClientLoginResponse", 1002 }, @@ -57,22 +77,22 @@ static const ProtobufCEnumValue message_type__enum_values_by_number[46] = { "KeepAliveResponse", "MESSAGE_TYPE__KeepAliveResponse", 1008 }, }; static const ProtobufCIntRange message_type__value_ranges[] = { -{0, 0},{1000, 37},{0, 46} +{0, 0},{1000, 57},{0, 66} }; -static const ProtobufCEnumValueIndex message_type__enum_values_by_name[46] = +static const ProtobufCEnumValueIndex message_type__enum_values_by_name[66] = { { "CalculateRequest", 3 }, { "CalculateResponse", 4 }, - { "DirectSynchronizationRequest", 40 }, - { "DirectSynchronizationResponse", 41 }, - { "ExternalBridgeUdpDiscoveryPacket", 37 }, - { "ExternalClientLoginRequest", 38 }, - { "ExternalClientLoginResponse", 39 }, + { "DirectSynchronizationRequest", 60 }, + { "DirectSynchronizationResponse", 61 }, + { "ExternalBridgeUdpDiscoveryPacket", 57 }, + { "ExternalClientLoginRequest", 58 }, + { "ExternalClientLoginResponse", 59 }, { "Job", 1 }, - { "KeepAliveRequest", 44 }, - { "KeepAliveResponse", 45 }, - { "OverrideDataBaseRequest", 42 }, - { "OverrideDataBaseResponse", 43 }, + { "KeepAliveRequest", 64 }, + { "KeepAliveResponse", 65 }, + { "OverrideDataBaseRequest", 62 }, + { "OverrideDataBaseResponse", 63 }, { "ProgressRequest", 5 }, { "ProgressResponse", 6 }, { "RGB", 0 }, @@ -87,6 +107,10 @@ static const ProtobufCEnumValueIndex message_type__enum_values_by_name[46] = { "StubExtFlashReadResponse", 34 }, { "StubExtFlashWriteRequest", 35 }, { "StubExtFlashWriteResponse", 36 }, + { "StubFPGAReadBackRegRequest", 37 }, + { "StubFPGAReadBackRegResponse", 38 }, + { "StubFPGAReadVersionRequest", 39 }, + { "StubFPGAReadVersionResponse", 40 }, { "StubGPIOInputSetupRequest", 13 }, { "StubGPIOInputSetupResponse", 14 }, { "StubGPIOReadBitRequest", 15 }, @@ -99,8 +123,24 @@ static const ProtobufCEnumValueIndex message_type__enum_values_by_name[46] = { "StubGPIOWriteByteResponse", 22 }, { "StubHeaterRequest", 23 }, { "StubHeaterResponse", 24 }, + { "StubL6470DriverRequest", 41 }, + { "StubL6470DriverResponse", 42 }, { "StubMotorEncoderRequest", 25 }, { "StubMotorEncoderResponse", 26 }, + { "StubMotorInitRequest", 43 }, + { "StubMotorInitResponse", 44 }, + { "StubMotorMovRequest", 51 }, + { "StubMotorMovResponse", 52 }, + { "StubMotorPositionRequest", 55 }, + { "StubMotorPositionResponse", 56 }, + { "StubMotorRunRequest", 45 }, + { "StubMotorRunResponse", 46 }, + { "StubMotorSpeedRequest", 53 }, + { "StubMotorSpeedResponse", 54 }, + { "StubMotorStatusRequest", 49 }, + { "StubMotorStatusResponse", 50 }, + { "StubMotorStopRequest", 47 }, + { "StubMotorStopResponse", 48 }, { "StubOptLimitSwitchRequest", 27 }, { "StubOptLimitSwitchResponse", 28 }, { "StubSteperMotorRequest", 29 }, @@ -115,9 +155,9 @@ const ProtobufCEnumDescriptor message_type__descriptor = "MessageType", "MessageType", "", - 46, + 66, message_type__enum_values_by_number, - 46, + 66, message_type__enum_values_by_name, 2, message_type__value_ranges, diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h index b5040d4d1..04e3336f2 100644 --- a/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Common/MessageType.pb-c.h @@ -23,6 +23,9 @@ typedef enum _MessageType { MESSAGE_TYPE__RGB = 0, MESSAGE_TYPE__Job = 1, MESSAGE_TYPE__Segment = 2, + /* + *Stubs + */ MESSAGE_TYPE__CalculateRequest = 3, MESSAGE_TYPE__CalculateResponse = 4, MESSAGE_TYPE__ProgressRequest = 5, @@ -57,6 +60,29 @@ typedef enum _MessageType { MESSAGE_TYPE__StubExtFlashReadResponse = 34, MESSAGE_TYPE__StubExtFlashWriteRequest = 35, MESSAGE_TYPE__StubExtFlashWriteResponse = 36, + MESSAGE_TYPE__StubFPGAReadBackRegRequest = 37, + MESSAGE_TYPE__StubFPGAReadBackRegResponse = 38, + MESSAGE_TYPE__StubFPGAReadVersionRequest = 39, + MESSAGE_TYPE__StubFPGAReadVersionResponse = 40, + MESSAGE_TYPE__StubL6470DriverRequest = 41, + MESSAGE_TYPE__StubL6470DriverResponse = 42, + MESSAGE_TYPE__StubMotorInitRequest = 43, + MESSAGE_TYPE__StubMotorInitResponse = 44, + MESSAGE_TYPE__StubMotorRunRequest = 45, + MESSAGE_TYPE__StubMotorRunResponse = 46, + MESSAGE_TYPE__StubMotorStopRequest = 47, + MESSAGE_TYPE__StubMotorStopResponse = 48, + MESSAGE_TYPE__StubMotorStatusRequest = 49, + MESSAGE_TYPE__StubMotorStatusResponse = 50, + MESSAGE_TYPE__StubMotorMovRequest = 51, + MESSAGE_TYPE__StubMotorMovResponse = 52, + MESSAGE_TYPE__StubMotorSpeedRequest = 53, + MESSAGE_TYPE__StubMotorSpeedResponse = 54, + MESSAGE_TYPE__StubMotorPositionRequest = 55, + MESSAGE_TYPE__StubMotorPositionResponse = 56, + /* + *Integration + */ MESSAGE_TYPE__ExternalBridgeUdpDiscoveryPacket = 1000, MESSAGE_TYPE__ExternalClientLoginRequest = 1001, MESSAGE_TYPE__ExternalClientLoginResponse = 1002, diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h index dbb1f8046..4e6718ca9 100644 --- a/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Jobs/Job.pb-c.h @@ -44,6 +44,10 @@ struct _Job */ protobuf_c_boolean has_distancetospoollength; uint32_t distancetospoollength; + /* + *repeated temperatureSensorsSetting[Dryer,Head, Mixer]; //temp sensor wanted temperaure in celzius + *SCREW: + */ protobuf_c_boolean has_startoffsetpulses; uint32_t startoffsetpulses; protobuf_c_boolean has_spoolbackingrate; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.c new file mode 100644 index 000000000..60519632e --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadBackRegRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubFPGAReadBackRegRequest.pb-c.h" +void stub_fpgaread_back_reg_request__init + (StubFPGAReadBackRegRequest *message) +{ + static const StubFPGAReadBackRegRequest init_value = STUB_FPGAREAD_BACK_REG_REQUEST__INIT; + *message = init_value; +} +size_t stub_fpgaread_back_reg_request__get_packed_size + (const StubFPGAReadBackRegRequest *message) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_fpgaread_back_reg_request__pack + (const StubFPGAReadBackRegRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_fpgaread_back_reg_request__pack_to_buffer + (const StubFPGAReadBackRegRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubFPGAReadBackRegRequest * + stub_fpgaread_back_reg_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubFPGAReadBackRegRequest *) + protobuf_c_message_unpack (&stub_fpgaread_back_reg_request__descriptor, + allocator, len, data); +} +void stub_fpgaread_back_reg_request__free_unpacked + (StubFPGAReadBackRegRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_fpgaread_back_reg_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_fpgaread_back_reg_request__field_descriptors[2] = +{ + { + "FPGAId", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadBackRegRequest, has_fpgaid), + offsetof(StubFPGAReadBackRegRequest, fpgaid), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Value", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadBackRegRequest, has_value), + offsetof(StubFPGAReadBackRegRequest, value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_fpgaread_back_reg_request__field_indices_by_name[] = { + 0, /* field[0] = FPGAId */ + 1, /* field[1] = Value */ +}; +static const ProtobufCIntRange stub_fpgaread_back_reg_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_fpgaread_back_reg_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubFPGAReadBackRegRequest", + "StubFPGAReadBackRegRequest", + "StubFPGAReadBackRegRequest", + "", + sizeof(StubFPGAReadBackRegRequest), + 2, + stub_fpgaread_back_reg_request__field_descriptors, + stub_fpgaread_back_reg_request__field_indices_by_name, + 1, stub_fpgaread_back_reg_request__number_ranges, + (ProtobufCMessageInit) stub_fpgaread_back_reg_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.h new file mode 100644 index 000000000..e4ae69f1f --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.h @@ -0,0 +1,80 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadBackRegRequest.proto */ + +#ifndef PROTOBUF_C_StubFPGAReadBackRegRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubFPGAReadBackRegRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubFPGAReadBackRegRequest StubFPGAReadBackRegRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubFPGAReadBackRegRequest +{ + ProtobufCMessage base; + /* + * 0..2 + */ + protobuf_c_boolean has_fpgaid; + uint32_t fpgaid; + /* + * 16 bit + */ + protobuf_c_boolean has_value; + uint32_t value; +}; +#define STUB_FPGAREAD_BACK_REG_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_fpgaread_back_reg_request__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubFPGAReadBackRegRequest methods */ +void stub_fpgaread_back_reg_request__init + (StubFPGAReadBackRegRequest *message); +size_t stub_fpgaread_back_reg_request__get_packed_size + (const StubFPGAReadBackRegRequest *message); +size_t stub_fpgaread_back_reg_request__pack + (const StubFPGAReadBackRegRequest *message, + uint8_t *out); +size_t stub_fpgaread_back_reg_request__pack_to_buffer + (const StubFPGAReadBackRegRequest *message, + ProtobufCBuffer *buffer); +StubFPGAReadBackRegRequest * + stub_fpgaread_back_reg_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_fpgaread_back_reg_request__free_unpacked + (StubFPGAReadBackRegRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubFPGAReadBackRegRequest_Closure) + (const StubFPGAReadBackRegRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_fpgaread_back_reg_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubFPGAReadBackRegRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.c new file mode 100644 index 000000000..e222b3b24 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.c @@ -0,0 +1,132 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadBackRegResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubFPGAReadBackRegResponse.pb-c.h" +void stub_fpgaread_back_reg_response__init + (StubFPGAReadBackRegResponse *message) +{ + static const StubFPGAReadBackRegResponse init_value = STUB_FPGAREAD_BACK_REG_RESPONSE__INIT; + *message = init_value; +} +size_t stub_fpgaread_back_reg_response__get_packed_size + (const StubFPGAReadBackRegResponse *message) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_fpgaread_back_reg_response__pack + (const StubFPGAReadBackRegResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_fpgaread_back_reg_response__pack_to_buffer + (const StubFPGAReadBackRegResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_fpgaread_back_reg_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubFPGAReadBackRegResponse * + stub_fpgaread_back_reg_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubFPGAReadBackRegResponse *) + protobuf_c_message_unpack (&stub_fpgaread_back_reg_response__descriptor, + allocator, len, data); +} +void stub_fpgaread_back_reg_response__free_unpacked + (StubFPGAReadBackRegResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_fpgaread_back_reg_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_fpgaread_back_reg_response__field_descriptors[4] = +{ + { + "FPGAId", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadBackRegResponse, has_fpgaid), + offsetof(StubFPGAReadBackRegResponse, fpgaid), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ReadBackValue", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadBackRegResponse, has_readbackvalue), + offsetof(StubFPGAReadBackRegResponse, readbackvalue), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(StubFPGAReadBackRegResponse, status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "StatusWord", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadBackRegResponse, has_statusword), + offsetof(StubFPGAReadBackRegResponse, statusword), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_fpgaread_back_reg_response__field_indices_by_name[] = { + 0, /* field[0] = FPGAId */ + 1, /* field[1] = ReadBackValue */ + 2, /* field[2] = Status */ + 3, /* field[3] = StatusWord */ +}; +static const ProtobufCIntRange stub_fpgaread_back_reg_response__number_ranges[2 + 1] = +{ + { 1, 0 }, + { 4, 2 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor stub_fpgaread_back_reg_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubFPGAReadBackRegResponse", + "StubFPGAReadBackRegResponse", + "StubFPGAReadBackRegResponse", + "", + sizeof(StubFPGAReadBackRegResponse), + 4, + stub_fpgaread_back_reg_response__field_descriptors, + stub_fpgaread_back_reg_response__field_indices_by_name, + 2, stub_fpgaread_back_reg_response__number_ranges, + (ProtobufCMessageInit) stub_fpgaread_back_reg_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.h new file mode 100644 index 000000000..234017433 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.h @@ -0,0 +1,89 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadBackRegResponse.proto */ + +#ifndef PROTOBUF_C_StubFPGAReadBackRegResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubFPGAReadBackRegResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubFPGAReadBackRegResponse StubFPGAReadBackRegResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubFPGAReadBackRegResponse +{ + ProtobufCMessage base; + /* + * 0..2 + */ + protobuf_c_boolean has_fpgaid; + uint32_t fpgaid; + /* + * 16 bit + */ + protobuf_c_boolean has_readbackvalue; + uint32_t readbackvalue; + /* + * Passed/Failed + */ + char *status; + /* + * Error number/bit when the status is Failed + */ + protobuf_c_boolean has_statusword; + uint32_t statusword; +}; +#define STUB_FPGAREAD_BACK_REG_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_fpgaread_back_reg_response__descriptor) \ + , 0, 0, 0, 0, NULL, 0, 0 } + + +/* StubFPGAReadBackRegResponse methods */ +void stub_fpgaread_back_reg_response__init + (StubFPGAReadBackRegResponse *message); +size_t stub_fpgaread_back_reg_response__get_packed_size + (const StubFPGAReadBackRegResponse *message); +size_t stub_fpgaread_back_reg_response__pack + (const StubFPGAReadBackRegResponse *message, + uint8_t *out); +size_t stub_fpgaread_back_reg_response__pack_to_buffer + (const StubFPGAReadBackRegResponse *message, + ProtobufCBuffer *buffer); +StubFPGAReadBackRegResponse * + stub_fpgaread_back_reg_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_fpgaread_back_reg_response__free_unpacked + (StubFPGAReadBackRegResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubFPGAReadBackRegResponse_Closure) + (const StubFPGAReadBackRegResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_fpgaread_back_reg_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubFPGAReadBackRegResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.c new file mode 100644 index 000000000..5381c462a --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadVersionRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubFPGAReadVersionRequest.pb-c.h" +void stub_fpgaread_version_request__init + (StubFPGAReadVersionRequest *message) +{ + static const StubFPGAReadVersionRequest init_value = STUB_FPGAREAD_VERSION_REQUEST__INIT; + *message = init_value; +} +size_t stub_fpgaread_version_request__get_packed_size + (const StubFPGAReadVersionRequest *message) +{ + assert(message->base.descriptor == &stub_fpgaread_version_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_fpgaread_version_request__pack + (const StubFPGAReadVersionRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_fpgaread_version_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_fpgaread_version_request__pack_to_buffer + (const StubFPGAReadVersionRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_fpgaread_version_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubFPGAReadVersionRequest * + stub_fpgaread_version_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubFPGAReadVersionRequest *) + protobuf_c_message_unpack (&stub_fpgaread_version_request__descriptor, + allocator, len, data); +} +void stub_fpgaread_version_request__free_unpacked + (StubFPGAReadVersionRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_fpgaread_version_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_fpgaread_version_request__field_descriptors[1] = +{ + { + "FPGAId", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionRequest, has_fpgaid), + offsetof(StubFPGAReadVersionRequest, fpgaid), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_fpgaread_version_request__field_indices_by_name[] = { + 0, /* field[0] = FPGAId */ +}; +static const ProtobufCIntRange stub_fpgaread_version_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor stub_fpgaread_version_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubFPGAReadVersionRequest", + "StubFPGAReadVersionRequest", + "StubFPGAReadVersionRequest", + "", + sizeof(StubFPGAReadVersionRequest), + 1, + stub_fpgaread_version_request__field_descriptors, + stub_fpgaread_version_request__field_indices_by_name, + 1, stub_fpgaread_version_request__number_ranges, + (ProtobufCMessageInit) stub_fpgaread_version_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.h new file mode 100644 index 000000000..54db77bad --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionRequest.pb-c.h @@ -0,0 +1,75 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadVersionRequest.proto */ + +#ifndef PROTOBUF_C_StubFPGAReadVersionRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubFPGAReadVersionRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubFPGAReadVersionRequest StubFPGAReadVersionRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubFPGAReadVersionRequest +{ + ProtobufCMessage base; + /* + * 0..2 + */ + protobuf_c_boolean has_fpgaid; + uint32_t fpgaid; +}; +#define STUB_FPGAREAD_VERSION_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_fpgaread_version_request__descriptor) \ + , 0, 0 } + + +/* StubFPGAReadVersionRequest methods */ +void stub_fpgaread_version_request__init + (StubFPGAReadVersionRequest *message); +size_t stub_fpgaread_version_request__get_packed_size + (const StubFPGAReadVersionRequest *message); +size_t stub_fpgaread_version_request__pack + (const StubFPGAReadVersionRequest *message, + uint8_t *out); +size_t stub_fpgaread_version_request__pack_to_buffer + (const StubFPGAReadVersionRequest *message, + ProtobufCBuffer *buffer); +StubFPGAReadVersionRequest * + stub_fpgaread_version_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_fpgaread_version_request__free_unpacked + (StubFPGAReadVersionRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubFPGAReadVersionRequest_Closure) + (const StubFPGAReadVersionRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_fpgaread_version_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubFPGAReadVersionRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.c new file mode 100644 index 000000000..79c25d9a5 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.c @@ -0,0 +1,170 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadVersionResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubFPGAReadVersionResponse.pb-c.h" +void stub_fpgaread_version_response__init + (StubFPGAReadVersionResponse *message) +{ + static const StubFPGAReadVersionResponse init_value = STUB_FPGAREAD_VERSION_RESPONSE__INIT; + *message = init_value; +} +size_t stub_fpgaread_version_response__get_packed_size + (const StubFPGAReadVersionResponse *message) +{ + assert(message->base.descriptor == &stub_fpgaread_version_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_fpgaread_version_response__pack + (const StubFPGAReadVersionResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_fpgaread_version_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_fpgaread_version_response__pack_to_buffer + (const StubFPGAReadVersionResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_fpgaread_version_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubFPGAReadVersionResponse * + stub_fpgaread_version_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubFPGAReadVersionResponse *) + protobuf_c_message_unpack (&stub_fpgaread_version_response__descriptor, + allocator, len, data); +} +void stub_fpgaread_version_response__free_unpacked + (StubFPGAReadVersionResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_fpgaread_version_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_fpgaread_version_response__field_descriptors[7] = +{ + { + "FPGAId", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_fpgaid), + offsetof(StubFPGAReadVersionResponse, fpgaid), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Day", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_day), + offsetof(StubFPGAReadVersionResponse, day), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Month", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_month), + offsetof(StubFPGAReadVersionResponse, month), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Year", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_year), + offsetof(StubFPGAReadVersionResponse, year), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Ver_num", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_ver_num), + offsetof(StubFPGAReadVersionResponse, ver_num), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(StubFPGAReadVersionResponse, status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "StatusWord", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubFPGAReadVersionResponse, has_statusword), + offsetof(StubFPGAReadVersionResponse, statusword), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_fpgaread_version_response__field_indices_by_name[] = { + 1, /* field[1] = Day */ + 0, /* field[0] = FPGAId */ + 2, /* field[2] = Month */ + 5, /* field[5] = Status */ + 6, /* field[6] = StatusWord */ + 4, /* field[4] = Ver_num */ + 3, /* field[3] = Year */ +}; +static const ProtobufCIntRange stub_fpgaread_version_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor stub_fpgaread_version_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubFPGAReadVersionResponse", + "StubFPGAReadVersionResponse", + "StubFPGAReadVersionResponse", + "", + sizeof(StubFPGAReadVersionResponse), + 7, + stub_fpgaread_version_response__field_descriptors, + stub_fpgaread_version_response__field_indices_by_name, + 1, stub_fpgaread_version_response__number_ranges, + (ProtobufCMessageInit) stub_fpgaread_version_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.h new file mode 100644 index 000000000..360f7faac --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubFPGAReadVersionResponse.pb-c.h @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubFPGAReadVersionResponse.proto */ + +#ifndef PROTOBUF_C_StubFPGAReadVersionResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubFPGAReadVersionResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubFPGAReadVersionResponse StubFPGAReadVersionResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubFPGAReadVersionResponse +{ + ProtobufCMessage base; + /* + * 0..2 + */ + protobuf_c_boolean has_fpgaid; + uint32_t fpgaid; + protobuf_c_boolean has_day; + uint32_t day; + protobuf_c_boolean has_month; + uint32_t month; + protobuf_c_boolean has_year; + uint32_t year; + protobuf_c_boolean has_ver_num; + uint32_t ver_num; + /* + * Passed/Failed + */ + char *status; + /* + * Error number/bit when the status is Failed + */ + protobuf_c_boolean has_statusword; + uint32_t statusword; +}; +#define STUB_FPGAREAD_VERSION_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_fpgaread_version_response__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0 } + + +/* StubFPGAReadVersionResponse methods */ +void stub_fpgaread_version_response__init + (StubFPGAReadVersionResponse *message); +size_t stub_fpgaread_version_response__get_packed_size + (const StubFPGAReadVersionResponse *message); +size_t stub_fpgaread_version_response__pack + (const StubFPGAReadVersionResponse *message, + uint8_t *out); +size_t stub_fpgaread_version_response__pack_to_buffer + (const StubFPGAReadVersionResponse *message, + ProtobufCBuffer *buffer); +StubFPGAReadVersionResponse * + stub_fpgaread_version_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_fpgaread_version_response__free_unpacked + (StubFPGAReadVersionResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubFPGAReadVersionResponse_Closure) + (const StubFPGAReadVersionResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_fpgaread_version_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubFPGAReadVersionResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.c new file mode 100644 index 000000000..3771b60a9 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.c @@ -0,0 +1,339 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubL6470DriverRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubL6470DriverRequest.pb-c.h" +void stub_l6470_driver_request__init + (StubL6470DriverRequest *message) +{ + static const StubL6470DriverRequest init_value = STUB_L6470_DRIVER_REQUEST__INIT; + *message = init_value; +} +size_t stub_l6470_driver_request__get_packed_size + (const StubL6470DriverRequest *message) +{ + assert(message->base.descriptor == &stub_l6470_driver_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_l6470_driver_request__pack + (const StubL6470DriverRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_l6470_driver_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_l6470_driver_request__pack_to_buffer + (const StubL6470DriverRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_l6470_driver_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubL6470DriverRequest * + stub_l6470_driver_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubL6470DriverRequest *) + protobuf_c_message_unpack (&stub_l6470_driver_request__descriptor, + allocator, len, data); +} +void stub_l6470_driver_request__free_unpacked + (StubL6470DriverRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_l6470_driver_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_l6470_driver_request__field_descriptors[20] = +{ + { + "Run_Value", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_run_value), + offsetof(StubL6470DriverRequest, run_value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Mov_Value", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_mov_value), + offsetof(StubL6470DriverRequest, mov_value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Direction", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_direction), + offsetof(StubL6470DriverRequest, direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Time_2_Change_Direction", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_time_2_change_direction), + offsetof(StubL6470DriverRequest, time_2_change_direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Display_Tx_ON_LCD", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_display_tx_on_lcd), + offsetof(StubL6470DriverRequest, display_tx_on_lcd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Display_Rx_on_LCD", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_display_rx_on_lcd), + offsetof(StubL6470DriverRequest, display_rx_on_lcd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Init_MicroStep", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_init_microstep), + offsetof(StubL6470DriverRequest, init_microstep), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Init_Acc", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_init_acc), + offsetof(StubL6470DriverRequest, init_acc), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Init_Dec", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_init_dec), + offsetof(StubL6470DriverRequest, init_dec), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_1", + 10, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_testbool_1), + offsetof(StubL6470DriverRequest, testbool_1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_2", + 11, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_testbool_2), + offsetof(StubL6470DriverRequest, testbool_2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_3", + 12, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_testbool_3), + offsetof(StubL6470DriverRequest, testbool_3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_4", + 13, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_testbool_4), + offsetof(StubL6470DriverRequest, testbool_4), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_5", + 14, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverRequest, has_testbool_5), + offsetof(StubL6470DriverRequest, testbool_5), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_1", + 15, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_1), + offsetof(StubL6470DriverRequest, testuint32_1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_2", + 16, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_2), + offsetof(StubL6470DriverRequest, testuint32_2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_3", + 17, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_3), + offsetof(StubL6470DriverRequest, testuint32_3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_4", + 18, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_4), + offsetof(StubL6470DriverRequest, testuint32_4), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_5", + 19, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_5), + offsetof(StubL6470DriverRequest, testuint32_5), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_6", + 20, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverRequest, has_testuint32_6), + offsetof(StubL6470DriverRequest, testuint32_6), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_l6470_driver_request__field_indices_by_name[] = { + 2, /* field[2] = Direction */ + 5, /* field[5] = Display_Rx_on_LCD */ + 4, /* field[4] = Display_Tx_ON_LCD */ + 7, /* field[7] = Init_Acc */ + 8, /* field[8] = Init_Dec */ + 6, /* field[6] = Init_MicroStep */ + 1, /* field[1] = Mov_Value */ + 0, /* field[0] = Run_Value */ + 9, /* field[9] = TestBool_1 */ + 10, /* field[10] = TestBool_2 */ + 11, /* field[11] = TestBool_3 */ + 12, /* field[12] = TestBool_4 */ + 13, /* field[13] = TestBool_5 */ + 14, /* field[14] = TestUint32_1 */ + 15, /* field[15] = TestUint32_2 */ + 16, /* field[16] = TestUint32_3 */ + 17, /* field[17] = TestUint32_4 */ + 18, /* field[18] = TestUint32_5 */ + 19, /* field[19] = TestUint32_6 */ + 3, /* field[3] = Time_2_Change_Direction */ +}; +static const ProtobufCIntRange stub_l6470_driver_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 20 } +}; +const ProtobufCMessageDescriptor stub_l6470_driver_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubL6470DriverRequest", + "StubL6470DriverRequest", + "StubL6470DriverRequest", + "", + sizeof(StubL6470DriverRequest), + 20, + stub_l6470_driver_request__field_descriptors, + stub_l6470_driver_request__field_indices_by_name, + 1, stub_l6470_driver_request__number_ranges, + (ProtobufCMessageInit) stub_l6470_driver_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.h new file mode 100644 index 000000000..ee4e261c9 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverRequest.pb-c.h @@ -0,0 +1,110 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubL6470DriverRequest.proto */ + +#ifndef PROTOBUF_C_StubL6470DriverRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubL6470DriverRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubL6470DriverRequest StubL6470DriverRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubL6470DriverRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_run_value; + uint32_t run_value; + protobuf_c_boolean has_mov_value; + uint32_t mov_value; + protobuf_c_boolean has_direction; + protobuf_c_boolean direction; + protobuf_c_boolean has_time_2_change_direction; + uint32_t time_2_change_direction; + protobuf_c_boolean has_display_tx_on_lcd; + protobuf_c_boolean display_tx_on_lcd; + protobuf_c_boolean has_display_rx_on_lcd; + protobuf_c_boolean display_rx_on_lcd; + protobuf_c_boolean has_init_microstep; + uint32_t init_microstep; + protobuf_c_boolean has_init_acc; + uint32_t init_acc; + protobuf_c_boolean has_init_dec; + uint32_t init_dec; + protobuf_c_boolean has_testbool_1; + protobuf_c_boolean testbool_1; + protobuf_c_boolean has_testbool_2; + protobuf_c_boolean testbool_2; + protobuf_c_boolean has_testbool_3; + protobuf_c_boolean testbool_3; + protobuf_c_boolean has_testbool_4; + protobuf_c_boolean testbool_4; + protobuf_c_boolean has_testbool_5; + protobuf_c_boolean testbool_5; + protobuf_c_boolean has_testuint32_1; + uint32_t testuint32_1; + protobuf_c_boolean has_testuint32_2; + uint32_t testuint32_2; + protobuf_c_boolean has_testuint32_3; + uint32_t testuint32_3; + protobuf_c_boolean has_testuint32_4; + uint32_t testuint32_4; + protobuf_c_boolean has_testuint32_5; + uint32_t testuint32_5; + protobuf_c_boolean has_testuint32_6; + uint32_t testuint32_6; +}; +#define STUB_L6470_DRIVER_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_l6470_driver_request__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + + +/* StubL6470DriverRequest methods */ +void stub_l6470_driver_request__init + (StubL6470DriverRequest *message); +size_t stub_l6470_driver_request__get_packed_size + (const StubL6470DriverRequest *message); +size_t stub_l6470_driver_request__pack + (const StubL6470DriverRequest *message, + uint8_t *out); +size_t stub_l6470_driver_request__pack_to_buffer + (const StubL6470DriverRequest *message, + ProtobufCBuffer *buffer); +StubL6470DriverRequest * + stub_l6470_driver_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_l6470_driver_request__free_unpacked + (StubL6470DriverRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubL6470DriverRequest_Closure) + (const StubL6470DriverRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_l6470_driver_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubL6470DriverRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.c new file mode 100644 index 000000000..b129bb930 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.c @@ -0,0 +1,274 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubL6470DriverResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubL6470DriverResponse.pb-c.h" +void stub_l6470_driver_response__init + (StubL6470DriverResponse *message) +{ + static const StubL6470DriverResponse init_value = STUB_L6470_DRIVER_RESPONSE__INIT; + *message = init_value; +} +size_t stub_l6470_driver_response__get_packed_size + (const StubL6470DriverResponse *message) +{ + assert(message->base.descriptor == &stub_l6470_driver_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_l6470_driver_response__pack + (const StubL6470DriverResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_l6470_driver_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_l6470_driver_response__pack_to_buffer + (const StubL6470DriverResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_l6470_driver_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubL6470DriverResponse * + stub_l6470_driver_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubL6470DriverResponse *) + protobuf_c_message_unpack (&stub_l6470_driver_response__descriptor, + allocator, len, data); +} +void stub_l6470_driver_response__free_unpacked + (StubL6470DriverResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_l6470_driver_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_l6470_driver_response__field_descriptors[15] = +{ + { + "Run_Value", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_run_value), + offsetof(StubL6470DriverResponse, run_value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Mov_Value", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_mov_value), + offsetof(StubL6470DriverResponse, mov_value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_1", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverResponse, has_testbool_1), + offsetof(StubL6470DriverResponse, testbool_1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_2", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverResponse, has_testbool_2), + offsetof(StubL6470DriverResponse, testbool_2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_3", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverResponse, has_testbool_3), + offsetof(StubL6470DriverResponse, testbool_3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_4", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverResponse, has_testbool_4), + offsetof(StubL6470DriverResponse, testbool_4), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestBool_5", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubL6470DriverResponse, has_testbool_5), + offsetof(StubL6470DriverResponse, testbool_5), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_1", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_1), + offsetof(StubL6470DriverResponse, testuint32_1), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_2", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_2), + offsetof(StubL6470DriverResponse, testuint32_2), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_3", + 10, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_3), + offsetof(StubL6470DriverResponse, testuint32_3), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_4", + 11, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_4), + offsetof(StubL6470DriverResponse, testuint32_4), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_5", + 12, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_5), + offsetof(StubL6470DriverResponse, testuint32_5), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TestUint32_6", + 13, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_testuint32_6), + offsetof(StubL6470DriverResponse, testuint32_6), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status", + 14, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(StubL6470DriverResponse, status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "StatusWord", + 15, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubL6470DriverResponse, has_statusword), + offsetof(StubL6470DriverResponse, statusword), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_l6470_driver_response__field_indices_by_name[] = { + 1, /* field[1] = Mov_Value */ + 0, /* field[0] = Run_Value */ + 13, /* field[13] = Status */ + 14, /* field[14] = StatusWord */ + 2, /* field[2] = TestBool_1 */ + 3, /* field[3] = TestBool_2 */ + 4, /* field[4] = TestBool_3 */ + 5, /* field[5] = TestBool_4 */ + 6, /* field[6] = TestBool_5 */ + 7, /* field[7] = TestUint32_1 */ + 8, /* field[8] = TestUint32_2 */ + 9, /* field[9] = TestUint32_3 */ + 10, /* field[10] = TestUint32_4 */ + 11, /* field[11] = TestUint32_5 */ + 12, /* field[12] = TestUint32_6 */ +}; +static const ProtobufCIntRange stub_l6470_driver_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 15 } +}; +const ProtobufCMessageDescriptor stub_l6470_driver_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubL6470DriverResponse", + "StubL6470DriverResponse", + "StubL6470DriverResponse", + "", + sizeof(StubL6470DriverResponse), + 15, + stub_l6470_driver_response__field_descriptors, + stub_l6470_driver_response__field_indices_by_name, + 1, stub_l6470_driver_response__number_ranges, + (ProtobufCMessageInit) stub_l6470_driver_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.h new file mode 100644 index 000000000..ca18da2a9 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubL6470DriverResponse.pb-c.h @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubL6470DriverResponse.proto */ + +#ifndef PROTOBUF_C_StubL6470DriverResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubL6470DriverResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubL6470DriverResponse StubL6470DriverResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubL6470DriverResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_run_value; + uint32_t run_value; + protobuf_c_boolean has_mov_value; + uint32_t mov_value; + protobuf_c_boolean has_testbool_1; + protobuf_c_boolean testbool_1; + protobuf_c_boolean has_testbool_2; + protobuf_c_boolean testbool_2; + protobuf_c_boolean has_testbool_3; + protobuf_c_boolean testbool_3; + protobuf_c_boolean has_testbool_4; + protobuf_c_boolean testbool_4; + protobuf_c_boolean has_testbool_5; + protobuf_c_boolean testbool_5; + protobuf_c_boolean has_testuint32_1; + uint32_t testuint32_1; + protobuf_c_boolean has_testuint32_2; + uint32_t testuint32_2; + protobuf_c_boolean has_testuint32_3; + uint32_t testuint32_3; + protobuf_c_boolean has_testuint32_4; + uint32_t testuint32_4; + protobuf_c_boolean has_testuint32_5; + uint32_t testuint32_5; + protobuf_c_boolean has_testuint32_6; + uint32_t testuint32_6; + /* + * Passed/Failed + */ + char *status; + /* + * Error number/bit when the status is Failed + */ + protobuf_c_boolean has_statusword; + uint32_t statusword; +}; +#define STUB_L6470_DRIVER_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_l6470_driver_response__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, 0, 0 } + + +/* StubL6470DriverResponse methods */ +void stub_l6470_driver_response__init + (StubL6470DriverResponse *message); +size_t stub_l6470_driver_response__get_packed_size + (const StubL6470DriverResponse *message); +size_t stub_l6470_driver_response__pack + (const StubL6470DriverResponse *message, + uint8_t *out); +size_t stub_l6470_driver_response__pack_to_buffer + (const StubL6470DriverResponse *message, + ProtobufCBuffer *buffer); +StubL6470DriverResponse * + stub_l6470_driver_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_l6470_driver_response__free_unpacked + (StubL6470DriverResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubL6470DriverResponse_Closure) + (const StubL6470DriverResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_l6470_driver_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubL6470DriverResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.c new file mode 100644 index 000000000..0f01b16d4 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.c @@ -0,0 +1,196 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorInitRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorInitRequest.pb-c.h" +void stub_motor_init_request__init + (StubMotorInitRequest *message) +{ + static const StubMotorInitRequest init_value = STUB_MOTOR_INIT_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_init_request__get_packed_size + (const StubMotorInitRequest *message) +{ + assert(message->base.descriptor == &stub_motor_init_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_init_request__pack + (const StubMotorInitRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_init_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_init_request__pack_to_buffer + (const StubMotorInitRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_init_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorInitRequest * + stub_motor_init_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorInitRequest *) + protobuf_c_message_unpack (&stub_motor_init_request__descriptor, + allocator, len, data); +} +void stub_motor_init_request__free_unpacked + (StubMotorInitRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_init_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_init_request__field_descriptors[9] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitRequest, has_motor_id), + offsetof(StubMotorInitRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Micro_Steps", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitRequest, has_micro_steps), + offsetof(StubMotorInitRequest, micro_steps), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Set_Micro_Steps", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorInitRequest, has_set_micro_steps), + offsetof(StubMotorInitRequest, set_micro_steps), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ACC", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitRequest, has_acc), + offsetof(StubMotorInitRequest, acc), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Set_ACC", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorInitRequest, has_set_acc), + offsetof(StubMotorInitRequest, set_acc), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "DEC", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitRequest, has_dec), + offsetof(StubMotorInitRequest, dec), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Set_Dec", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorInitRequest, has_set_dec), + offsetof(StubMotorInitRequest, set_dec), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Max_Speed", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitRequest, has_max_speed), + offsetof(StubMotorInitRequest, max_speed), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Set_Max_Speed", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorInitRequest, has_set_max_speed), + offsetof(StubMotorInitRequest, set_max_speed), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_init_request__field_indices_by_name[] = { + 3, /* field[3] = ACC */ + 5, /* field[5] = DEC */ + 7, /* field[7] = Max_Speed */ + 1, /* field[1] = Micro_Steps */ + 0, /* field[0] = Motor_ID */ + 4, /* field[4] = Set_ACC */ + 6, /* field[6] = Set_Dec */ + 8, /* field[8] = Set_Max_Speed */ + 2, /* field[2] = Set_Micro_Steps */ +}; +static const ProtobufCIntRange stub_motor_init_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 9 } +}; +const ProtobufCMessageDescriptor stub_motor_init_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorInitRequest", + "StubMotorInitRequest", + "StubMotorInitRequest", + "", + sizeof(StubMotorInitRequest), + 9, + stub_motor_init_request__field_descriptors, + stub_motor_init_request__field_indices_by_name, + 1, stub_motor_init_request__number_ranges, + (ProtobufCMessageInit) stub_motor_init_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.h new file mode 100644 index 000000000..29b1f6036 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitRequest.pb-c.h @@ -0,0 +1,91 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorInitRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorInitRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorInitRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorInitRequest StubMotorInitRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorInitRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + /* + * 1/2/4/8/16/32/64/128 + */ + protobuf_c_boolean has_micro_steps; + uint32_t micro_steps; + protobuf_c_boolean has_set_micro_steps; + protobuf_c_boolean set_micro_steps; + protobuf_c_boolean has_acc; + uint32_t acc; + protobuf_c_boolean has_set_acc; + protobuf_c_boolean set_acc; + protobuf_c_boolean has_dec; + uint32_t dec; + protobuf_c_boolean has_set_dec; + protobuf_c_boolean set_dec; + protobuf_c_boolean has_max_speed; + uint32_t max_speed; + protobuf_c_boolean has_set_max_speed; + protobuf_c_boolean set_max_speed; +}; +#define STUB_MOTOR_INIT_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_init_request__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + + +/* StubMotorInitRequest methods */ +void stub_motor_init_request__init + (StubMotorInitRequest *message); +size_t stub_motor_init_request__get_packed_size + (const StubMotorInitRequest *message); +size_t stub_motor_init_request__pack + (const StubMotorInitRequest *message, + uint8_t *out); +size_t stub_motor_init_request__pack_to_buffer + (const StubMotorInitRequest *message, + ProtobufCBuffer *buffer); +StubMotorInitRequest * + stub_motor_init_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_init_request__free_unpacked + (StubMotorInitRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorInitRequest_Closure) + (const StubMotorInitRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_init_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorInitRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.c new file mode 100644 index 000000000..17c436fa3 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorInitResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorInitResponse.pb-c.h" +void stub_motor_init_response__init + (StubMotorInitResponse *message) +{ + static const StubMotorInitResponse init_value = STUB_MOTOR_INIT_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_init_response__get_packed_size + (const StubMotorInitResponse *message) +{ + assert(message->base.descriptor == &stub_motor_init_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_init_response__pack + (const StubMotorInitResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_init_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_init_response__pack_to_buffer + (const StubMotorInitResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_init_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorInitResponse * + stub_motor_init_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorInitResponse *) + protobuf_c_message_unpack (&stub_motor_init_response__descriptor, + allocator, len, data); +} +void stub_motor_init_response__free_unpacked + (StubMotorInitResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_init_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_init_response__field_descriptors[2] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitResponse, has_motor_id), + offsetof(StubMotorInitResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorInitResponse, has_status), + offsetof(StubMotorInitResponse, status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_init_response__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ + 1, /* field[1] = Status */ +}; +static const ProtobufCIntRange stub_motor_init_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_motor_init_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorInitResponse", + "StubMotorInitResponse", + "StubMotorInitResponse", + "", + sizeof(StubMotorInitResponse), + 2, + stub_motor_init_response__field_descriptors, + stub_motor_init_response__field_indices_by_name, + 1, stub_motor_init_response__number_ranges, + (ProtobufCMessageInit) stub_motor_init_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.h new file mode 100644 index 000000000..c4f825818 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorInitResponse.pb-c.h @@ -0,0 +1,74 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorInitResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorInitResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorInitResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorInitResponse StubMotorInitResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorInitResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_status; + uint32_t status; +}; +#define STUB_MOTOR_INIT_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_init_response__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubMotorInitResponse methods */ +void stub_motor_init_response__init + (StubMotorInitResponse *message); +size_t stub_motor_init_response__get_packed_size + (const StubMotorInitResponse *message); +size_t stub_motor_init_response__pack + (const StubMotorInitResponse *message, + uint8_t *out); +size_t stub_motor_init_response__pack_to_buffer + (const StubMotorInitResponse *message, + ProtobufCBuffer *buffer); +StubMotorInitResponse * + stub_motor_init_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_init_response__free_unpacked + (StubMotorInitResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorInitResponse_Closure) + (const StubMotorInitResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_init_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorInitResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.c new file mode 100644 index 000000000..ed5152830 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.c @@ -0,0 +1,118 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorMovRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorMovRequest.pb-c.h" +void stub_motor_mov_request__init + (StubMotorMovRequest *message) +{ + static const StubMotorMovRequest init_value = STUB_MOTOR_MOV_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_mov_request__get_packed_size + (const StubMotorMovRequest *message) +{ + assert(message->base.descriptor == &stub_motor_mov_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_mov_request__pack + (const StubMotorMovRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_mov_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_mov_request__pack_to_buffer + (const StubMotorMovRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_mov_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorMovRequest * + stub_motor_mov_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorMovRequest *) + protobuf_c_message_unpack (&stub_motor_mov_request__descriptor, + allocator, len, data); +} +void stub_motor_mov_request__free_unpacked + (StubMotorMovRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_mov_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_mov_request__field_descriptors[3] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovRequest, has_motor_id), + offsetof(StubMotorMovRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Direction", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorMovRequest, has_direction), + offsetof(StubMotorMovRequest, direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Position", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovRequest, has_position), + offsetof(StubMotorMovRequest, position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_mov_request__field_indices_by_name[] = { + 1, /* field[1] = Direction */ + 0, /* field[0] = Motor_ID */ + 2, /* field[2] = Position */ +}; +static const ProtobufCIntRange stub_motor_mov_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor stub_motor_mov_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorMovRequest", + "StubMotorMovRequest", + "StubMotorMovRequest", + "", + sizeof(StubMotorMovRequest), + 3, + stub_motor_mov_request__field_descriptors, + stub_motor_mov_request__field_indices_by_name, + 1, stub_motor_mov_request__number_ranges, + (ProtobufCMessageInit) stub_motor_mov_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.h new file mode 100644 index 000000000..8957b336a --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovRequest.pb-c.h @@ -0,0 +1,76 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorMovRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorMovRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorMovRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorMovRequest StubMotorMovRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorMovRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_direction; + protobuf_c_boolean direction; + protobuf_c_boolean has_position; + uint32_t position; +}; +#define STUB_MOTOR_MOV_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_mov_request__descriptor) \ + , 0, 0, 0, 0, 0, 0 } + + +/* StubMotorMovRequest methods */ +void stub_motor_mov_request__init + (StubMotorMovRequest *message); +size_t stub_motor_mov_request__get_packed_size + (const StubMotorMovRequest *message); +size_t stub_motor_mov_request__pack + (const StubMotorMovRequest *message, + uint8_t *out); +size_t stub_motor_mov_request__pack_to_buffer + (const StubMotorMovRequest *message, + ProtobufCBuffer *buffer); +StubMotorMovRequest * + stub_motor_mov_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_mov_request__free_unpacked + (StubMotorMovRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorMovRequest_Closure) + (const StubMotorMovRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_mov_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorMovRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.c new file mode 100644 index 000000000..e0da6c0b3 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.c @@ -0,0 +1,170 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorMovResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorMovResponse.pb-c.h" +void stub_motor_mov_response__init + (StubMotorMovResponse *message) +{ + static const StubMotorMovResponse init_value = STUB_MOTOR_MOV_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_mov_response__get_packed_size + (const StubMotorMovResponse *message) +{ + assert(message->base.descriptor == &stub_motor_mov_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_mov_response__pack + (const StubMotorMovResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_mov_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_mov_response__pack_to_buffer + (const StubMotorMovResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_mov_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorMovResponse * + stub_motor_mov_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorMovResponse *) + protobuf_c_message_unpack (&stub_motor_mov_response__descriptor, + allocator, len, data); +} +void stub_motor_mov_response__free_unpacked + (StubMotorMovResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_mov_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_mov_response__field_descriptors[7] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovResponse, has_motor_id), + offsetof(StubMotorMovResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Position", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovResponse, has_position), + offsetof(StubMotorMovResponse, position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status_Reg", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovResponse, has_status_reg), + offsetof(StubMotorMovResponse, status_reg), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Direction", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorMovResponse, has_direction), + offsetof(StubMotorMovResponse, direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Mot_Status", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorMovResponse, has_mot_status), + offsetof(StubMotorMovResponse, mot_status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_A", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorMovResponse, has_step_loss_a), + offsetof(StubMotorMovResponse, step_loss_a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_B", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorMovResponse, has_step_loss_b), + offsetof(StubMotorMovResponse, step_loss_b), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_mov_response__field_indices_by_name[] = { + 3, /* field[3] = Direction */ + 4, /* field[4] = Mot_Status */ + 0, /* field[0] = Motor_ID */ + 1, /* field[1] = Position */ + 5, /* field[5] = STEP_LOSS_A */ + 6, /* field[6] = STEP_LOSS_B */ + 2, /* field[2] = Status_Reg */ +}; +static const ProtobufCIntRange stub_motor_mov_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor stub_motor_mov_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorMovResponse", + "StubMotorMovResponse", + "StubMotorMovResponse", + "", + sizeof(StubMotorMovResponse), + 7, + stub_motor_mov_response__field_descriptors, + stub_motor_mov_response__field_indices_by_name, + 1, stub_motor_mov_response__number_ranges, + (ProtobufCMessageInit) stub_motor_mov_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.h new file mode 100644 index 000000000..cd80996ed --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorMovResponse.pb-c.h @@ -0,0 +1,90 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorMovResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorMovResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorMovResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorMovResponse StubMotorMovResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorMovResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_position; + uint32_t position; + protobuf_c_boolean has_status_reg; + uint32_t status_reg; + /* + * Reverse / Forward + */ + protobuf_c_boolean has_direction; + protobuf_c_boolean direction; + /* + *Stopped / Acceleration / Deceleration / Constant speed + */ + protobuf_c_boolean has_mot_status; + uint32_t mot_status; + protobuf_c_boolean has_step_loss_a; + protobuf_c_boolean step_loss_a; + protobuf_c_boolean has_step_loss_b; + protobuf_c_boolean step_loss_b; +}; +#define STUB_MOTOR_MOV_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_mov_response__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + + +/* StubMotorMovResponse methods */ +void stub_motor_mov_response__init + (StubMotorMovResponse *message); +size_t stub_motor_mov_response__get_packed_size + (const StubMotorMovResponse *message); +size_t stub_motor_mov_response__pack + (const StubMotorMovResponse *message, + uint8_t *out); +size_t stub_motor_mov_response__pack_to_buffer + (const StubMotorMovResponse *message, + ProtobufCBuffer *buffer); +StubMotorMovResponse * + stub_motor_mov_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_mov_response__free_unpacked + (StubMotorMovResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorMovResponse_Closure) + (const StubMotorMovResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_mov_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorMovResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.c new file mode 100644 index 000000000..08f43e778 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorPositionRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorPositionRequest.pb-c.h" +void stub_motor_position_request__init + (StubMotorPositionRequest *message) +{ + static const StubMotorPositionRequest init_value = STUB_MOTOR_POSITION_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_position_request__get_packed_size + (const StubMotorPositionRequest *message) +{ + assert(message->base.descriptor == &stub_motor_position_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_position_request__pack + (const StubMotorPositionRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_position_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_position_request__pack_to_buffer + (const StubMotorPositionRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_position_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorPositionRequest * + stub_motor_position_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorPositionRequest *) + protobuf_c_message_unpack (&stub_motor_position_request__descriptor, + allocator, len, data); +} +void stub_motor_position_request__free_unpacked + (StubMotorPositionRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_position_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_position_request__field_descriptors[1] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorPositionRequest, has_motor_id), + offsetof(StubMotorPositionRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_position_request__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ +}; +static const ProtobufCIntRange stub_motor_position_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor stub_motor_position_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorPositionRequest", + "StubMotorPositionRequest", + "StubMotorPositionRequest", + "", + sizeof(StubMotorPositionRequest), + 1, + stub_motor_position_request__field_descriptors, + stub_motor_position_request__field_indices_by_name, + 1, stub_motor_position_request__number_ranges, + (ProtobufCMessageInit) stub_motor_position_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.h new file mode 100644 index 000000000..439a0f31d --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionRequest.pb-c.h @@ -0,0 +1,72 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorPositionRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorPositionRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorPositionRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorPositionRequest StubMotorPositionRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorPositionRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; +}; +#define STUB_MOTOR_POSITION_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_position_request__descriptor) \ + , 0, 0 } + + +/* StubMotorPositionRequest methods */ +void stub_motor_position_request__init + (StubMotorPositionRequest *message); +size_t stub_motor_position_request__get_packed_size + (const StubMotorPositionRequest *message); +size_t stub_motor_position_request__pack + (const StubMotorPositionRequest *message, + uint8_t *out); +size_t stub_motor_position_request__pack_to_buffer + (const StubMotorPositionRequest *message, + ProtobufCBuffer *buffer); +StubMotorPositionRequest * + stub_motor_position_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_position_request__free_unpacked + (StubMotorPositionRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorPositionRequest_Closure) + (const StubMotorPositionRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_position_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorPositionRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.c new file mode 100644 index 000000000..4354eb2da --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorPositionResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorPositionResponse.pb-c.h" +void stub_motor_position_response__init + (StubMotorPositionResponse *message) +{ + static const StubMotorPositionResponse init_value = STUB_MOTOR_POSITION_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_position_response__get_packed_size + (const StubMotorPositionResponse *message) +{ + assert(message->base.descriptor == &stub_motor_position_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_position_response__pack + (const StubMotorPositionResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_position_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_position_response__pack_to_buffer + (const StubMotorPositionResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_position_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorPositionResponse * + stub_motor_position_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorPositionResponse *) + protobuf_c_message_unpack (&stub_motor_position_response__descriptor, + allocator, len, data); +} +void stub_motor_position_response__free_unpacked + (StubMotorPositionResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_position_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_position_response__field_descriptors[2] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorPositionResponse, has_motor_id), + offsetof(StubMotorPositionResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Position", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorPositionResponse, has_position), + offsetof(StubMotorPositionResponse, position), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_position_response__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ + 1, /* field[1] = Position */ +}; +static const ProtobufCIntRange stub_motor_position_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_motor_position_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorPositionResponse", + "StubMotorPositionResponse", + "StubMotorPositionResponse", + "", + sizeof(StubMotorPositionResponse), + 2, + stub_motor_position_response__field_descriptors, + stub_motor_position_response__field_indices_by_name, + 1, stub_motor_position_response__number_ranges, + (ProtobufCMessageInit) stub_motor_position_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.h new file mode 100644 index 000000000..13c7c3c95 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorPositionResponse.pb-c.h @@ -0,0 +1,74 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorPositionResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorPositionResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorPositionResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorPositionResponse StubMotorPositionResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorPositionResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_position; + uint32_t position; +}; +#define STUB_MOTOR_POSITION_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_position_response__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubMotorPositionResponse methods */ +void stub_motor_position_response__init + (StubMotorPositionResponse *message); +size_t stub_motor_position_response__get_packed_size + (const StubMotorPositionResponse *message); +size_t stub_motor_position_response__pack + (const StubMotorPositionResponse *message, + uint8_t *out); +size_t stub_motor_position_response__pack_to_buffer + (const StubMotorPositionResponse *message, + ProtobufCBuffer *buffer); +StubMotorPositionResponse * + stub_motor_position_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_position_response__free_unpacked + (StubMotorPositionResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorPositionResponse_Closure) + (const StubMotorPositionResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_position_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorPositionResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.c new file mode 100644 index 000000000..30cf9ccf2 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.c @@ -0,0 +1,118 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorRunRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorRunRequest.pb-c.h" +void stub_motor_run_request__init + (StubMotorRunRequest *message) +{ + static const StubMotorRunRequest init_value = STUB_MOTOR_RUN_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_run_request__get_packed_size + (const StubMotorRunRequest *message) +{ + assert(message->base.descriptor == &stub_motor_run_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_run_request__pack + (const StubMotorRunRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_run_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_run_request__pack_to_buffer + (const StubMotorRunRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_run_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorRunRequest * + stub_motor_run_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorRunRequest *) + protobuf_c_message_unpack (&stub_motor_run_request__descriptor, + allocator, len, data); +} +void stub_motor_run_request__free_unpacked + (StubMotorRunRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_run_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_run_request__field_descriptors[3] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorRunRequest, has_motor_id), + offsetof(StubMotorRunRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Direction", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorRunRequest, has_direction), + offsetof(StubMotorRunRequest, direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Speed", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(StubMotorRunRequest, has_speed), + offsetof(StubMotorRunRequest, speed), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_run_request__field_indices_by_name[] = { + 1, /* field[1] = Direction */ + 0, /* field[0] = Motor_ID */ + 2, /* field[2] = Speed */ +}; +static const ProtobufCIntRange stub_motor_run_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor stub_motor_run_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorRunRequest", + "StubMotorRunRequest", + "StubMotorRunRequest", + "", + sizeof(StubMotorRunRequest), + 3, + stub_motor_run_request__field_descriptors, + stub_motor_run_request__field_indices_by_name, + 1, stub_motor_run_request__number_ranges, + (ProtobufCMessageInit) stub_motor_run_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.h new file mode 100644 index 000000000..5c4ce2efd --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunRequest.pb-c.h @@ -0,0 +1,76 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorRunRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorRunRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorRunRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorRunRequest StubMotorRunRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorRunRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_direction; + protobuf_c_boolean direction; + protobuf_c_boolean has_speed; + double speed; +}; +#define STUB_MOTOR_RUN_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_run_request__descriptor) \ + , 0, 0, 0, 0, 0, 0 } + + +/* StubMotorRunRequest methods */ +void stub_motor_run_request__init + (StubMotorRunRequest *message); +size_t stub_motor_run_request__get_packed_size + (const StubMotorRunRequest *message); +size_t stub_motor_run_request__pack + (const StubMotorRunRequest *message, + uint8_t *out); +size_t stub_motor_run_request__pack_to_buffer + (const StubMotorRunRequest *message, + ProtobufCBuffer *buffer); +StubMotorRunRequest * + stub_motor_run_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_run_request__free_unpacked + (StubMotorRunRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorRunRequest_Closure) + (const StubMotorRunRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_run_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorRunRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.c new file mode 100644 index 000000000..ccbd85dbf --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.c @@ -0,0 +1,170 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorRunResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorRunResponse.pb-c.h" +void stub_motor_run_response__init + (StubMotorRunResponse *message) +{ + static const StubMotorRunResponse init_value = STUB_MOTOR_RUN_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_run_response__get_packed_size + (const StubMotorRunResponse *message) +{ + assert(message->base.descriptor == &stub_motor_run_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_run_response__pack + (const StubMotorRunResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_run_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_run_response__pack_to_buffer + (const StubMotorRunResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_run_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorRunResponse * + stub_motor_run_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorRunResponse *) + protobuf_c_message_unpack (&stub_motor_run_response__descriptor, + allocator, len, data); +} +void stub_motor_run_response__free_unpacked + (StubMotorRunResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_run_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_run_response__field_descriptors[7] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorRunResponse, has_motor_id), + offsetof(StubMotorRunResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Speed", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(StubMotorRunResponse, has_speed), + offsetof(StubMotorRunResponse, speed), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Status_Reg", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorRunResponse, has_status_reg), + offsetof(StubMotorRunResponse, status_reg), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Direction", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorRunResponse, has_direction), + offsetof(StubMotorRunResponse, direction), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Mot_Status", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorRunResponse, has_mot_status), + offsetof(StubMotorRunResponse, mot_status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_A", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorRunResponse, has_step_loss_a), + offsetof(StubMotorRunResponse, step_loss_a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_B", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorRunResponse, has_step_loss_b), + offsetof(StubMotorRunResponse, step_loss_b), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_run_response__field_indices_by_name[] = { + 3, /* field[3] = Direction */ + 4, /* field[4] = Mot_Status */ + 0, /* field[0] = Motor_ID */ + 5, /* field[5] = STEP_LOSS_A */ + 6, /* field[6] = STEP_LOSS_B */ + 1, /* field[1] = Speed */ + 2, /* field[2] = Status_Reg */ +}; +static const ProtobufCIntRange stub_motor_run_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor stub_motor_run_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorRunResponse", + "StubMotorRunResponse", + "StubMotorRunResponse", + "", + sizeof(StubMotorRunResponse), + 7, + stub_motor_run_response__field_descriptors, + stub_motor_run_response__field_indices_by_name, + 1, stub_motor_run_response__number_ranges, + (ProtobufCMessageInit) stub_motor_run_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.h new file mode 100644 index 000000000..ad4f33de8 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorRunResponse.pb-c.h @@ -0,0 +1,90 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorRunResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorRunResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorRunResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorRunResponse StubMotorRunResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorRunResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_speed; + double speed; + protobuf_c_boolean has_status_reg; + uint32_t status_reg; + /* + * Reverse / Forward + */ + protobuf_c_boolean has_direction; + protobuf_c_boolean direction; + /* + *Stopped / Acceleration / Deceleration / Constant speed + */ + protobuf_c_boolean has_mot_status; + uint32_t mot_status; + protobuf_c_boolean has_step_loss_a; + protobuf_c_boolean step_loss_a; + protobuf_c_boolean has_step_loss_b; + protobuf_c_boolean step_loss_b; +}; +#define STUB_MOTOR_RUN_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_run_response__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + + +/* StubMotorRunResponse methods */ +void stub_motor_run_response__init + (StubMotorRunResponse *message); +size_t stub_motor_run_response__get_packed_size + (const StubMotorRunResponse *message); +size_t stub_motor_run_response__pack + (const StubMotorRunResponse *message, + uint8_t *out); +size_t stub_motor_run_response__pack_to_buffer + (const StubMotorRunResponse *message, + ProtobufCBuffer *buffer); +StubMotorRunResponse * + stub_motor_run_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_run_response__free_unpacked + (StubMotorRunResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorRunResponse_Closure) + (const StubMotorRunResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_run_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorRunResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.c new file mode 100644 index 000000000..c8acbfdfd --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.c @@ -0,0 +1,92 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorSpeedRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorSpeedRequest.pb-c.h" +void stub_motor_speed_request__init + (StubMotorSpeedRequest *message) +{ + static const StubMotorSpeedRequest init_value = STUB_MOTOR_SPEED_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_speed_request__get_packed_size + (const StubMotorSpeedRequest *message) +{ + assert(message->base.descriptor == &stub_motor_speed_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_speed_request__pack + (const StubMotorSpeedRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_speed_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_speed_request__pack_to_buffer + (const StubMotorSpeedRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_speed_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorSpeedRequest * + stub_motor_speed_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorSpeedRequest *) + protobuf_c_message_unpack (&stub_motor_speed_request__descriptor, + allocator, len, data); +} +void stub_motor_speed_request__free_unpacked + (StubMotorSpeedRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_speed_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_speed_request__field_descriptors[1] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorSpeedRequest, has_motor_id), + offsetof(StubMotorSpeedRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_speed_request__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ +}; +static const ProtobufCIntRange stub_motor_speed_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor stub_motor_speed_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorSpeedRequest", + "StubMotorSpeedRequest", + "StubMotorSpeedRequest", + "", + sizeof(StubMotorSpeedRequest), + 1, + stub_motor_speed_request__field_descriptors, + stub_motor_speed_request__field_indices_by_name, + 1, stub_motor_speed_request__number_ranges, + (ProtobufCMessageInit) stub_motor_speed_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.h new file mode 100644 index 000000000..537ca4da6 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedRequest.pb-c.h @@ -0,0 +1,72 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorSpeedRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorSpeedRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorSpeedRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorSpeedRequest StubMotorSpeedRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorSpeedRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; +}; +#define STUB_MOTOR_SPEED_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_speed_request__descriptor) \ + , 0, 0 } + + +/* StubMotorSpeedRequest methods */ +void stub_motor_speed_request__init + (StubMotorSpeedRequest *message); +size_t stub_motor_speed_request__get_packed_size + (const StubMotorSpeedRequest *message); +size_t stub_motor_speed_request__pack + (const StubMotorSpeedRequest *message, + uint8_t *out); +size_t stub_motor_speed_request__pack_to_buffer + (const StubMotorSpeedRequest *message, + ProtobufCBuffer *buffer); +StubMotorSpeedRequest * + stub_motor_speed_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_speed_request__free_unpacked + (StubMotorSpeedRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorSpeedRequest_Closure) + (const StubMotorSpeedRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_speed_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorSpeedRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.c new file mode 100644 index 000000000..34d826880 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorSpeedResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorSpeedResponse.pb-c.h" +void stub_motor_speed_response__init + (StubMotorSpeedResponse *message) +{ + static const StubMotorSpeedResponse init_value = STUB_MOTOR_SPEED_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_speed_response__get_packed_size + (const StubMotorSpeedResponse *message) +{ + assert(message->base.descriptor == &stub_motor_speed_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_speed_response__pack + (const StubMotorSpeedResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_speed_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_speed_response__pack_to_buffer + (const StubMotorSpeedResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_speed_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorSpeedResponse * + stub_motor_speed_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorSpeedResponse *) + protobuf_c_message_unpack (&stub_motor_speed_response__descriptor, + allocator, len, data); +} +void stub_motor_speed_response__free_unpacked + (StubMotorSpeedResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_speed_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_speed_response__field_descriptors[2] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorSpeedResponse, has_motor_id), + offsetof(StubMotorSpeedResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Speed", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(StubMotorSpeedResponse, has_speed), + offsetof(StubMotorSpeedResponse, speed), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_speed_response__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ + 1, /* field[1] = Speed */ +}; +static const ProtobufCIntRange stub_motor_speed_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_motor_speed_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorSpeedResponse", + "StubMotorSpeedResponse", + "StubMotorSpeedResponse", + "", + sizeof(StubMotorSpeedResponse), + 2, + stub_motor_speed_response__field_descriptors, + stub_motor_speed_response__field_indices_by_name, + 1, stub_motor_speed_response__number_ranges, + (ProtobufCMessageInit) stub_motor_speed_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.h new file mode 100644 index 000000000..d113e02d9 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorSpeedResponse.pb-c.h @@ -0,0 +1,74 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorSpeedResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorSpeedResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorSpeedResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorSpeedResponse StubMotorSpeedResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorSpeedResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_speed; + double speed; +}; +#define STUB_MOTOR_SPEED_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_speed_response__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubMotorSpeedResponse methods */ +void stub_motor_speed_response__init + (StubMotorSpeedResponse *message); +size_t stub_motor_speed_response__get_packed_size + (const StubMotorSpeedResponse *message); +size_t stub_motor_speed_response__pack + (const StubMotorSpeedResponse *message, + uint8_t *out); +size_t stub_motor_speed_response__pack_to_buffer + (const StubMotorSpeedResponse *message, + ProtobufCBuffer *buffer); +StubMotorSpeedResponse * + stub_motor_speed_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_speed_response__free_unpacked + (StubMotorSpeedResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorSpeedResponse_Closure) + (const StubMotorSpeedResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_speed_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorSpeedResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.c new file mode 100644 index 000000000..21ff45bab --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStatusRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorStatusRequest.pb-c.h" +void stub_motor_status_request__init + (StubMotorStatusRequest *message) +{ + static const StubMotorStatusRequest init_value = STUB_MOTOR_STATUS_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_status_request__get_packed_size + (const StubMotorStatusRequest *message) +{ + assert(message->base.descriptor == &stub_motor_status_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_status_request__pack + (const StubMotorStatusRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_status_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_status_request__pack_to_buffer + (const StubMotorStatusRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_status_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorStatusRequest * + stub_motor_status_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorStatusRequest *) + protobuf_c_message_unpack (&stub_motor_status_request__descriptor, + allocator, len, data); +} +void stub_motor_status_request__free_unpacked + (StubMotorStatusRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_status_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_status_request__field_descriptors[2] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStatusRequest, has_motor_id), + offsetof(StubMotorStatusRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ClearStatus", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusRequest, has_clearstatus), + offsetof(StubMotorStatusRequest, clearstatus), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_status_request__field_indices_by_name[] = { + 1, /* field[1] = ClearStatus */ + 0, /* field[0] = Motor_ID */ +}; +static const ProtobufCIntRange stub_motor_status_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_motor_status_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorStatusRequest", + "StubMotorStatusRequest", + "StubMotorStatusRequest", + "", + sizeof(StubMotorStatusRequest), + 2, + stub_motor_status_request__field_descriptors, + stub_motor_status_request__field_indices_by_name, + 1, stub_motor_status_request__number_ranges, + (ProtobufCMessageInit) stub_motor_status_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.h new file mode 100644 index 000000000..84fbd6080 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusRequest.pb-c.h @@ -0,0 +1,74 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStatusRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorStatusRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorStatusRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorStatusRequest StubMotorStatusRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorStatusRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_clearstatus; + protobuf_c_boolean clearstatus; +}; +#define STUB_MOTOR_STATUS_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_status_request__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubMotorStatusRequest methods */ +void stub_motor_status_request__init + (StubMotorStatusRequest *message); +size_t stub_motor_status_request__get_packed_size + (const StubMotorStatusRequest *message); +size_t stub_motor_status_request__pack + (const StubMotorStatusRequest *message, + uint8_t *out); +size_t stub_motor_status_request__pack_to_buffer + (const StubMotorStatusRequest *message, + ProtobufCBuffer *buffer); +StubMotorStatusRequest * + stub_motor_status_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_status_request__free_unpacked + (StubMotorStatusRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorStatusRequest_Closure) + (const StubMotorStatusRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_status_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorStatusRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.c new file mode 100644 index 000000000..9236abdea --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.c @@ -0,0 +1,287 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStatusResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorStatusResponse.pb-c.h" +void stub_motor_status_response__init + (StubMotorStatusResponse *message) +{ + static const StubMotorStatusResponse init_value = STUB_MOTOR_STATUS_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_status_response__get_packed_size + (const StubMotorStatusResponse *message) +{ + assert(message->base.descriptor == &stub_motor_status_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_status_response__pack + (const StubMotorStatusResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_status_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_status_response__pack_to_buffer + (const StubMotorStatusResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_status_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorStatusResponse * + stub_motor_status_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorStatusResponse *) + protobuf_c_message_unpack (&stub_motor_status_response__descriptor, + allocator, len, data); +} +void stub_motor_status_response__free_unpacked + (StubMotorStatusResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_status_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_status_response__field_descriptors[16] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStatusResponse, has_motor_id), + offsetof(StubMotorStatusResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "SCK_MOD", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_sck_mod), + offsetof(StubMotorStatusResponse, sck_mod), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_B", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_step_loss_b), + offsetof(StubMotorStatusResponse, step_loss_b), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "STEP_LOSS_A", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_step_loss_a), + offsetof(StubMotorStatusResponse, step_loss_a), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "OCD", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_ocd), + offsetof(StubMotorStatusResponse, ocd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TH_SD", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_th_sd), + offsetof(StubMotorStatusResponse, th_sd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "TH_WRN", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_th_wrn), + offsetof(StubMotorStatusResponse, th_wrn), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "UVLO", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_uvlo), + offsetof(StubMotorStatusResponse, uvlo), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "WRONG_CMD", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_wrong_cmd), + offsetof(StubMotorStatusResponse, wrong_cmd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "NOTPERF_CMD", + 10, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_notperf_cmd), + offsetof(StubMotorStatusResponse, notperf_cmd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "MOT_STATUS", + 11, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStatusResponse, has_mot_status), + offsetof(StubMotorStatusResponse, mot_status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "DIR", + 12, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_dir), + offsetof(StubMotorStatusResponse, dir), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "SW_EVN", + 13, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_sw_evn), + offsetof(StubMotorStatusResponse, sw_evn), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "SW_F", + 14, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_sw_f), + offsetof(StubMotorStatusResponse, sw_f), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "BUSY", + 15, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_busy), + offsetof(StubMotorStatusResponse, busy), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "HiZ", + 16, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStatusResponse, has_hiz), + offsetof(StubMotorStatusResponse, hiz), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_status_response__field_indices_by_name[] = { + 14, /* field[14] = BUSY */ + 11, /* field[11] = DIR */ + 15, /* field[15] = HiZ */ + 10, /* field[10] = MOT_STATUS */ + 0, /* field[0] = Motor_ID */ + 9, /* field[9] = NOTPERF_CMD */ + 4, /* field[4] = OCD */ + 1, /* field[1] = SCK_MOD */ + 3, /* field[3] = STEP_LOSS_A */ + 2, /* field[2] = STEP_LOSS_B */ + 12, /* field[12] = SW_EVN */ + 13, /* field[13] = SW_F */ + 5, /* field[5] = TH_SD */ + 6, /* field[6] = TH_WRN */ + 7, /* field[7] = UVLO */ + 8, /* field[8] = WRONG_CMD */ +}; +static const ProtobufCIntRange stub_motor_status_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 16 } +}; +const ProtobufCMessageDescriptor stub_motor_status_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorStatusResponse", + "StubMotorStatusResponse", + "StubMotorStatusResponse", + "", + sizeof(StubMotorStatusResponse), + 16, + stub_motor_status_response__field_descriptors, + stub_motor_status_response__field_indices_by_name, + 1, stub_motor_status_response__number_ranges, + (ProtobufCMessageInit) stub_motor_status_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.h new file mode 100644 index 000000000..440830b3b --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStatusResponse.pb-c.h @@ -0,0 +1,102 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStatusResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorStatusResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorStatusResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorStatusResponse StubMotorStatusResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorStatusResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + protobuf_c_boolean has_sck_mod; + protobuf_c_boolean sck_mod; + protobuf_c_boolean has_step_loss_b; + protobuf_c_boolean step_loss_b; + protobuf_c_boolean has_step_loss_a; + protobuf_c_boolean step_loss_a; + protobuf_c_boolean has_ocd; + protobuf_c_boolean ocd; + protobuf_c_boolean has_th_sd; + protobuf_c_boolean th_sd; + protobuf_c_boolean has_th_wrn; + protobuf_c_boolean th_wrn; + protobuf_c_boolean has_uvlo; + protobuf_c_boolean uvlo; + protobuf_c_boolean has_wrong_cmd; + protobuf_c_boolean wrong_cmd; + protobuf_c_boolean has_notperf_cmd; + protobuf_c_boolean notperf_cmd; + protobuf_c_boolean has_mot_status; + uint32_t mot_status; + protobuf_c_boolean has_dir; + protobuf_c_boolean dir; + protobuf_c_boolean has_sw_evn; + protobuf_c_boolean sw_evn; + protobuf_c_boolean has_sw_f; + protobuf_c_boolean sw_f; + protobuf_c_boolean has_busy; + protobuf_c_boolean busy; + protobuf_c_boolean has_hiz; + protobuf_c_boolean hiz; +}; +#define STUB_MOTOR_STATUS_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_status_response__descriptor) \ + , 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + + +/* StubMotorStatusResponse methods */ +void stub_motor_status_response__init + (StubMotorStatusResponse *message); +size_t stub_motor_status_response__get_packed_size + (const StubMotorStatusResponse *message); +size_t stub_motor_status_response__pack + (const StubMotorStatusResponse *message, + uint8_t *out); +size_t stub_motor_status_response__pack_to_buffer + (const StubMotorStatusResponse *message, + ProtobufCBuffer *buffer); +StubMotorStatusResponse * + stub_motor_status_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_status_response__free_unpacked + (StubMotorStatusResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorStatusResponse_Closure) + (const StubMotorStatusResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_status_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorStatusResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.c new file mode 100644 index 000000000..1bcdca7be --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStopRequest.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorStopRequest.pb-c.h" +void stub_motor_stop_request__init + (StubMotorStopRequest *message) +{ + static const StubMotorStopRequest init_value = STUB_MOTOR_STOP_REQUEST__INIT; + *message = init_value; +} +size_t stub_motor_stop_request__get_packed_size + (const StubMotorStopRequest *message) +{ + assert(message->base.descriptor == &stub_motor_stop_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_stop_request__pack + (const StubMotorStopRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_stop_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_stop_request__pack_to_buffer + (const StubMotorStopRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_stop_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorStopRequest * + stub_motor_stop_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorStopRequest *) + protobuf_c_message_unpack (&stub_motor_stop_request__descriptor, + allocator, len, data); +} +void stub_motor_stop_request__free_unpacked + (StubMotorStopRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_stop_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_stop_request__field_descriptors[2] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStopRequest, has_motor_id), + offsetof(StubMotorStopRequest, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Stop_CMD", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStopRequest, has_stop_cmd), + offsetof(StubMotorStopRequest, stop_cmd), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_stop_request__field_indices_by_name[] = { + 0, /* field[0] = Motor_ID */ + 1, /* field[1] = Stop_CMD */ +}; +static const ProtobufCIntRange stub_motor_stop_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor stub_motor_stop_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorStopRequest", + "StubMotorStopRequest", + "StubMotorStopRequest", + "", + sizeof(StubMotorStopRequest), + 2, + stub_motor_stop_request__field_descriptors, + stub_motor_stop_request__field_indices_by_name, + 1, stub_motor_stop_request__number_ranges, + (ProtobufCMessageInit) stub_motor_stop_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.h new file mode 100644 index 000000000..2c89fc185 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopRequest.pb-c.h @@ -0,0 +1,77 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStopRequest.proto */ + +#ifndef PROTOBUF_C_StubMotorStopRequest_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorStopRequest_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorStopRequest StubMotorStopRequest; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorStopRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + /* + * 1 - Hard_Stop/ 2 - Soft_Stop/ 3 - Hard_Hiz/ 4 - Soft_Hiz + */ + protobuf_c_boolean has_stop_cmd; + uint32_t stop_cmd; +}; +#define STUB_MOTOR_STOP_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_stop_request__descriptor) \ + , 0, 0, 0, 0 } + + +/* StubMotorStopRequest methods */ +void stub_motor_stop_request__init + (StubMotorStopRequest *message); +size_t stub_motor_stop_request__get_packed_size + (const StubMotorStopRequest *message); +size_t stub_motor_stop_request__pack + (const StubMotorStopRequest *message, + uint8_t *out); +size_t stub_motor_stop_request__pack_to_buffer + (const StubMotorStopRequest *message, + ProtobufCBuffer *buffer); +StubMotorStopRequest * + stub_motor_stop_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_stop_request__free_unpacked + (StubMotorStopRequest *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorStopRequest_Closure) + (const StubMotorStopRequest *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_stop_request__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorStopRequest_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.c b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.c new file mode 100644 index 000000000..d829d6b68 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.c @@ -0,0 +1,118 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStopResponse.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "StubMotorStopResponse.pb-c.h" +void stub_motor_stop_response__init + (StubMotorStopResponse *message) +{ + static const StubMotorStopResponse init_value = STUB_MOTOR_STOP_RESPONSE__INIT; + *message = init_value; +} +size_t stub_motor_stop_response__get_packed_size + (const StubMotorStopResponse *message) +{ + assert(message->base.descriptor == &stub_motor_stop_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t stub_motor_stop_response__pack + (const StubMotorStopResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &stub_motor_stop_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t stub_motor_stop_response__pack_to_buffer + (const StubMotorStopResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &stub_motor_stop_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +StubMotorStopResponse * + stub_motor_stop_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (StubMotorStopResponse *) + protobuf_c_message_unpack (&stub_motor_stop_response__descriptor, + allocator, len, data); +} +void stub_motor_stop_response__free_unpacked + (StubMotorStopResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &stub_motor_stop_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor stub_motor_stop_response__field_descriptors[3] = +{ + { + "Motor_ID", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStopResponse, has_motor_id), + offsetof(StubMotorStopResponse, motor_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "Mot_Status", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + offsetof(StubMotorStopResponse, has_mot_status), + offsetof(StubMotorStopResponse, mot_status), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "HiZ", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + offsetof(StubMotorStopResponse, has_hiz), + offsetof(StubMotorStopResponse, hiz), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned stub_motor_stop_response__field_indices_by_name[] = { + 2, /* field[2] = HiZ */ + 1, /* field[1] = Mot_Status */ + 0, /* field[0] = Motor_ID */ +}; +static const ProtobufCIntRange stub_motor_stop_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor stub_motor_stop_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "StubMotorStopResponse", + "StubMotorStopResponse", + "StubMotorStopResponse", + "", + sizeof(StubMotorStopResponse), + 3, + stub_motor_stop_response__field_descriptors, + stub_motor_stop_response__field_indices_by_name, + 1, stub_motor_stop_response__number_ranges, + (ProtobufCMessageInit) stub_motor_stop_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.h b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.h new file mode 100644 index 000000000..ca3fd9d38 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/PMR/Stubs/StubMotorStopResponse.pb-c.h @@ -0,0 +1,82 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: StubMotorStopResponse.proto */ + +#ifndef PROTOBUF_C_StubMotorStopResponse_2eproto__INCLUDED +#define PROTOBUF_C_StubMotorStopResponse_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1003000 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct _StubMotorStopResponse StubMotorStopResponse; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _StubMotorStopResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_motor_id; + uint32_t motor_id; + /* + * Stopped / Acceleration / Deceleration / Constant speed + */ + protobuf_c_boolean has_mot_status; + uint32_t mot_status; + /* + * 1 - high impedance state. + */ + protobuf_c_boolean has_hiz; + protobuf_c_boolean hiz; +}; +#define STUB_MOTOR_STOP_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&stub_motor_stop_response__descriptor) \ + , 0, 0, 0, 0, 0, 0 } + + +/* StubMotorStopResponse methods */ +void stub_motor_stop_response__init + (StubMotorStopResponse *message); +size_t stub_motor_stop_response__get_packed_size + (const StubMotorStopResponse *message); +size_t stub_motor_stop_response__pack + (const StubMotorStopResponse *message, + uint8_t *out); +size_t stub_motor_stop_response__pack_to_buffer + (const StubMotorStopResponse *message, + ProtobufCBuffer *buffer); +StubMotorStopResponse * + stub_motor_stop_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void stub_motor_stop_response__free_unpacked + (StubMotorStopResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*StubMotorStopResponse_Closure) + (const StubMotorStopResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor stub_motor_stop_response__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_StubMotorStopResponse_2eproto__INCLUDED */ diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Calculate.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Calculate.c index 6bd5cb703..cc6841261 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Calculate.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Calculate.c @@ -1,4 +1,6 @@ +#include <PMR/Stubs/CalculateRequest.pb-c.h> +#include <PMR/Stubs/CalculateResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -14,9 +16,6 @@ #include "usb_serial_adapter.h" #include "graphics_adapter.h" #include "MessageContainer.pb-c.h" -#include "CalculateRequest.pb-c.h" -#include "CalculateResponse.pb-c.h" - #include "Container.h" void Stub_CalculateRequest(MessageContainer* requestContainer) diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Container.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Container.c index 570ead28f..d8627bf1c 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Container.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Container.c @@ -25,6 +25,10 @@ #include "Stub_SteperMotor.h" #include "Stub_Valve.h" #include "Stub_ExtFlash.h" +#include "Stub_FPGAReadBackReg.h" +#include "Stub_FPGAReadVersion.h" +#include "Stub_L6470.h" +#include "Stub_Motor.h" MessageContainer createContainer(MessageType type, char* token, protobuf_c_boolean completed, void* response, size_t (*packPtr)(void*, uint8_t*), size_t (*sizePtr)(void*)) { @@ -113,6 +117,36 @@ void receive_callback(char* buffer, size_t length) case MESSAGE_TYPE__StubExtFlashWriteRequest: Stub_ExtFlashWriteRequest(requestContainer); break; + case MESSAGE_TYPE__StubFPGAReadBackRegRequest: + Stub_FPGAReadBackRegRequest(requestContainer); + break; + case MESSAGE_TYPE__StubFPGAReadVersionRequest: + Stub_FPGAReadVersionRequest(requestContainer); + break; + case MESSAGE_TYPE__StubL6470DriverRequest: + Stub_L6470DriverRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorInitRequest: + Stub_MotorInitRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorRunRequest: + Stub_MotorRunRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorStopRequest: + Stub_MotorStopRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorStatusRequest: + Stub_MotorStatusRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorPositionRequest: + Stub_MotorPositionRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorSpeedRequest: + Stub_MotorSpeedRequest(requestContainer); + break; + case MESSAGE_TYPE__StubMotorMovRequest: + Stub_MotorMovRequest(requestContainer); + break; default: //unsupported message type !! diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/DataDef.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/DataDef.h index 08da87c09..c7e41d2b8 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/DataDef.h +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/DataDef.h @@ -4,6 +4,7 @@ #define EVALUATION_BOARD // to use the LCD only when using the evaluation board #define USE_HIGH_SPEED_GPIO // to use AHB GPIO (A..J) ports A-J APB or AHB, ports K-Q on AHB only + #define ON 1 #define OFF 0 @@ -25,18 +26,27 @@ enum #define NEW 0 #define USED 1 -#define START 1 -#define STOP 0 +#define START 0 +#define STOP 1 +#define NOSTOP 2 +#define CONTINUE 2 + +#define NOTBUSY 0 +#define BUSY 1 +// +//#define SPI_BUSY 0 +//#define SPI_NOTBUSY 1 + // motor direction -#define CW 1 // clockwise -#define CCW 0 // counter clockwise +#define CW 0 // clockwise +#define CCW 1 // counter clockwise #define TRUE 1 #define FALSE 0 -#define INPUT 1 -#define OUTPUT 0 +#define INPUT 0x0 +#define OUTPUT 0x1 #define PULLDOWN 0 #define PULLUP 1 @@ -45,6 +55,54 @@ enum #define RX 1 #define TXRX 2 +#define ODD 0 +#define EVEN 1 + +#define READY 0 +#define NOTREADY 1 +#define WAIT 2 + +#define LOW 0x0 +#define HIGH 0x1 + +#define WR 0 +#define RD 1 + +#define FLAGSTART 1 +#define FLAGSET 1 +#define FLAGCLEAR 0 + +#define IN 2 +#define OUT 3 + +#define INIT 1 +#define SKIP_INIT 0 + +#define byte uint8_t//char +#define boolean bool + +#define SERIAL 0x0 +#define DISPLAY 0x1 + +#define LSBFIRST 0 +#define MSBFIRST 1 + +#define CHANGE 1 +#define FALLING 2 +#define RISING 3 + +//typedef union +//{ +// struct +// { +// unsigned char MSB; +// unsigned char 3RD; +// unsigned char 2ND; +// unsigned char LSB; +// }byte; +// long LONG; +//}LONG2BYTE; + //--------------------------------------------------------------------- #pragma diag_suppress 169 /* Avoid warnings on VOID * conversions (protobuf issue) The warning: diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Progress.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Progress.c index efd4c7eac..8d55b2933 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Progress.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Progress.c @@ -1,4 +1,6 @@ +#include <PMR/Stubs/ProgressRequest.pb-c.h> +#include <PMR/Stubs/ProgressResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -14,9 +16,6 @@ #include "usb_serial_adapter.h" #include "graphics_adapter.h" #include "MessageContainer.pb-c.h" -#include "ProgressRequest.pb-c.h" -#include "ProgressResponse.pb-c.h" - #include "Container.h" void Stub_ProgressRequest(MessageContainer* requestContainer) diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Cartridge.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Cartridge.c index e97831e67..5bb71dd9c 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Cartridge.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Cartridge.c @@ -1,5 +1,9 @@ +#include <PMR/Stubs/StubCartridgeReadRequest.pb-c.h> +#include <PMR/Stubs/StubCartridgeReadResponse.pb-c.h> +#include <PMR/Stubs/StubCartridgeWriteRequest.pb-c.h> +#include <PMR/Stubs/StubCartridgeWriteResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -17,11 +21,6 @@ #include "MessageContainer.pb-c.h" -#include "StubCartridgeReadResponse.pb-c.h" -#include "StubCartridgeReadRequest.pb-c.h" -#include "StubCartridgeWriteResponse.pb-c.h" -#include "StubCartridgeWriteRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Dispenser.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Dispenser.c index bb2ceaea9..cc1f1e4ea 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Dispenser.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Dispenser.c @@ -1,5 +1,7 @@ +#include <PMR/Stubs/StubDispenserRequest.pb-c.h> +#include <PMR/Stubs/StubDispenserResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -17,9 +19,6 @@ #include "MessageContainer.pb-c.h" -#include "StubDispenserResponse.pb-c.h" -#include "StubDispenserRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_ExtFlash.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_ExtFlash.c index c7ef4aaa8..4994736e6 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_ExtFlash.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_ExtFlash.c @@ -1,5 +1,9 @@ #include <drivers/Flash_Memory/Flash_Memory.h> +#include <PMR/Stubs/StubExtFlashReadRequest.pb-c.h> +#include <PMR/Stubs/StubExtFlashReadResponse.pb-c.h> +#include <PMR/Stubs/StubExtFlashWriteRequest.pb-c.h> +#include <PMR/Stubs/StubExtFlashWriteResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -16,12 +20,6 @@ #include "MessageContainer.pb-c.h" -#include "StubExtFlashWriteRequest.pb-c.h" -#include "StubExtFlashWriteResponse.pb-c.h" - -#include "StubExtFlashReadRequest.pb-c.h" -#include "StubExtFlashReadResponse.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.c new file mode 100644 index 000000000..2ca985d12 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.c @@ -0,0 +1,69 @@ + +#include <PMR/Stubs/StubFPGAReadBackRegRequest.pb-c.h> +#include <PMR/Stubs/StubFPGAReadBackRegResponse.pb-c.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include <Stubs_Handler/DataDef.h> +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" + +#include "usb_serial_adapter.h" +#include "graphics_adapter.h" + +#include "MessageContainer.pb-c.h" + +#include "Container.h" +#include "Stub_Status.h" +#include "drivers/FPGA/FPGA.h" + +void Stub_FPGAReadBackRegRequest(MessageContainer* requestContainer) +{ + uint32_t status = FAILED; + + unsigned short ReadBack_Value; + + MessageContainer responseContainer; + + StubFPGAReadBackRegRequest* request = stub_fpgaread_back_reg_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + writeLine("ReadBack Request: "); + + writeFloat(request->fpgaid); + writeString(", "); + writeFloat(request->value); + + status = Test_FPGA_ReadBack((unsigned char) request->fpgaid, (unsigned short) request->value, &ReadBack_Value); + + StubFPGAReadBackRegResponse response = STUB_FPGAREAD_BACK_REG_RESPONSE__INIT; + + status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + response.fpgaid = request->fpgaid; + response.has_fpgaid = true; + response.readbackvalue = ReadBack_Value; + response.has_readbackvalue = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubFPGAReadBackRegResponse, requestContainer->token, true, &response, &stub_fpgaread_back_reg_response__pack, &stub_fpgaread_back_reg_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.fpgaid); + writeString(", "); + writeFloat(response.readbackvalue); + writeString(", "); + + Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); + +} diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.h new file mode 100644 index 000000000..14e245225 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadBackReg.h @@ -0,0 +1,11 @@ +#ifndef STUB_READBACK_H +#define STUB_READBACK_H + +void Stub_FPGAReadBackRegRequest(MessageContainer* requestContainer); + +#endif //STUB_READBACK_H + + + + + diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.c new file mode 100644 index 000000000..0861ddb5f --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.c @@ -0,0 +1,81 @@ + +#include <PMR/Stubs/StubFPGAReadVersionResponse.pb-c.h> +#include <PMR/Stubs/StubFPGAReadVersionRequest.pb-c.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include <Stubs_Handler/DataDef.h> +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" + +#include "usb_serial_adapter.h" +#include "graphics_adapter.h" + +#include "MessageContainer.pb-c.h" + +#include "Container.h" +#include "Stub_Status.h" +#include "drivers/FPGA/FPGA.h" + +void Stub_FPGAReadVersionRequest(MessageContainer* requestContainer) +{ + uint32_t status = FAILED; + unsigned char Version; + unsigned char Year; + unsigned char Month; + unsigned char Day; + + MessageContainer responseContainer; + + StubFPGAReadVersionRequest* request = stub_fpgaread_version_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + writeLine("ReadBack Request: "); + + writeFloat(request->fpgaid); + + status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); + + StubFPGAReadVersionResponse response = STUB_FPGAREAD_VERSION_RESPONSE__INIT; + + status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + response.fpgaid = request->fpgaid; + response.has_fpgaid = true; + response.day = Day; + response.has_day = true; + response.month = Month; + response.has_month = true; + response.year = Year; + response.has_year = true; + response.ver_num = Version; + response.has_ver_num = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubFPGAReadVersionResponse, requestContainer->token, true, &response, &stub_fpgaread_version_response__pack, &stub_fpgaread_version_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.fpgaid); + writeString(", "); + writeFloat(response.day); + writeString(", "); + writeFloat(response.month); + writeString(", "); + writeFloat(response.year); + writeString(", "); + writeFloat(response.ver_num); + writeString(", "); + + Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); + +} diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.h new file mode 100644 index 000000000..d9c33b8b8 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_FPGAReadVersion.h @@ -0,0 +1,6 @@ +#ifndef STUB_FPGAVER_H +#define STUB_FPGAVER_H + +void Stub_FPGAReadVersionRequest(MessageContainer* requestContainer); + +#endif //STUB_FPGAVER_H diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_GPIO.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_GPIO.c index 0d0896517..b02c79539 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_GPIO.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_GPIO.c @@ -1,4 +1,14 @@ +#include <PMR/Stubs/StubGPIOInputSetupRequest.pb-c.h> +#include <PMR/Stubs/StubGPIOInputSetupResponse.pb-c.h> +#include <PMR/Stubs/StubGPIOReadBitRequest.pb-c.h> +#include <PMR/Stubs/StubGPIOReadBitResponse.pb-c.h> +#include <PMR/Stubs/StubGPIOReadByteRequest.pb-c.h> +#include <PMR/Stubs/StubGPIOReadByteResponse.pb-c.h> +#include <PMR/Stubs/StubGPIOWriteBitRequest.pb-c.h> +#include <PMR/Stubs/StubGPIOWriteBitResponse.pb-c.h> +#include <PMR/Stubs/StubGPIOWriteByteRequest.pb-c.h> +#include <PMR/Stubs/StubGPIOWriteByteResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -16,21 +26,6 @@ #include "MessageContainer.pb-c.h" -#include "StubGPIOWriteBitRequest.pb-c.h" -#include "StubGPIOWriteBitResponse.pb-c.h" - -#include "StubGPIOReadByteResponse.pb-c.h" -#include "StubGPIOReadByteRequest.pb-c.h" - -#include "StubGPIOReadBitResponse.pb-c.h" -#include "StubGPIOReadBitRequest.pb-c.h" - -#include "StubGPIOWriteByteResponse.pb-c.h" -#include "StubGPIOWriteByteRequest.pb-c.h" - -#include "StubGPIOInputSetupRequest.pb-c.h" -#include "StubGPIOInputSetupResponse.pb-c.h" - #include "Container.h" #include <Stubs_Handler/User_Leds.h> diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Heater.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Heater.c index 38193f180..8cc5c515a 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Heater.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Heater.c @@ -1,5 +1,7 @@ +#include <PMR/Stubs/StubHeaterRequest.pb-c.h> +#include <PMR/Stubs/StubHeaterResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -17,9 +19,6 @@ #include "MessageContainer.pb-c.h" -#include "StubHeaterResponse.pb-c.h" -#include "StubHeaterRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.c new file mode 100644 index 000000000..a8be5cd19 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.c @@ -0,0 +1,133 @@ + +#include <PMR/Stubs/StubL6470DriverResponse.pb-c.h> +#include <PMR/Stubs/StubL6470DriverRequest.pb-c.h> +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include <Stubs_Handler/DataDef.h> +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" + +#include "usb_serial_adapter.h" +#include "graphics_adapter.h" + +#include "MessageContainer.pb-c.h" + +#include "Container.h" +#include "Stub_Status.h" +#include "drivers/FPGA/FPGA.h" +#include "drivers/SPI/SPI_Comm.h" + +#include "drivers/FPGA/Moters_Driver/L6470.h" + +#include "driverlib/ssi.h" + + unsigned long Run_Value = 136902 ; + unsigned long Pos_Value; + unsigned long Mov_Value ; + bool Direction ; + unsigned long Time_2_Change_Direction ; + bool Display_Tx_ON_LCD; + bool Display_Rx_on_LCD; + unsigned long Init_MicroStep ; + unsigned long Init_Acc; + unsigned long Init_Dec; + bool TestBool_1; + bool TestBool_2; + bool TestBool_3; + bool TestBool_4; + bool TestBool_5; + unsigned long TestUint32_1; + unsigned long TestUint32_2; + unsigned long TestUint32_3; + unsigned long TestUint32_4; + unsigned long TestUint32_5; + unsigned long TestUint32_6; + +void Stub_L6470DriverRequest(MessageContainer* requestContainer) +{ + uint32_t status = PASSED; + + MessageContainer responseContainer; + + StubL6470DriverRequest* request = stub_l6470_driver_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + Run_Value = request->run_value; + Mov_Value = request->mov_value; + Direction = request->direction; + Time_2_Change_Direction = request->time_2_change_direction; + Display_Tx_ON_LCD = request->display_tx_on_lcd; + Display_Rx_on_LCD = request->display_rx_on_lcd; + Init_MicroStep = request->init_microstep; + Init_Acc = request->init_acc; + Init_Dec = request->init_dec; + TestBool_1 = request->testbool_1; + TestBool_2 = request->testbool_2; + TestBool_3 = request->testbool_3; + TestBool_4 = request->testbool_4; + TestBool_5 = request->testbool_5; + TestUint32_1 = request->testuint32_1; + TestUint32_2 = request->testuint32_2; + TestUint32_3 = request->testuint32_3; + TestUint32_4 = request->testuint32_4; + TestUint32_5 = request->testuint32_5; + TestUint32_6 = request->testuint32_6; + + writeLine("L6470 Request: "); + + writeFloat(request->run_value); + + //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); + SPI_Control(INIT); + + //temp_init_spi2(); + + + StubL6470DriverResponse response = STUB_L6470_DRIVER_RESPONSE__INIT; + + status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + //response.run_value = Get_Param(x_SPEED); + /* + response.mov_value = ; + response.day = Day; + response.has_day = true; + response.month = Month; + response.has_month = true; + response.year = Year; + response.has_year = true; + response.ver_num = Version; + response.has_ver_num = true; +*/ + responseContainer = createContainer(MESSAGE_TYPE__StubL6470DriverResponse, requestContainer->token, true, &response, &stub_l6470_driver_response__pack, &stub_l6470_driver_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.run_value); + /* + writeString(", "); + writeFloat(response.day); + writeString(", "); + writeFloat(response.month); + writeString(", "); + writeFloat(response.year); + writeString(", "); + writeFloat(response.ver_num); + writeString(", "); +*/ + Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); + + + //StartUSB(ui32SysClock); //todo to test the USB comm problem after using 6470 +} diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.h new file mode 100644 index 000000000..0b4702861 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_L6470.h @@ -0,0 +1,3 @@ +void Stub_L6470DriverRequest(MessageContainer* requestContainer); + +void temp_init_spi2(); diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.c new file mode 100644 index 000000000..ef77db30d --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.c @@ -0,0 +1,448 @@ + +#include <PMR/Stubs/StubMotorInitRequest.pb-c.h> +#include <PMR/Stubs/StubMotorInitResponse.pb-c.h> +#include <PMR/Stubs/StubMotorRunRequest.pb-c.h> +#include <PMR/Stubs/StubMotorRunResponse.pb-c.h> +#include <PMR/Stubs/StubMotorStopRequest.pb-c.h> +#include <PMR/Stubs/StubMotorStopResponse.pb-c.h> +#include <PMR/Stubs/StubMotorStatusRequest.pb-c.h> +#include <PMR/Stubs/StubMotorStatusResponse.pb-c.h> +#include <PMR/Stubs/StubMotorSpeedResponse.pb-c.h> +#include <PMR/Stubs/StubMotorSpeedRequest.pb-c.h> +#include <PMR/Stubs/StubMotorPositionRequest.pb-c.h> +#include <PMR/Stubs/StubMotorPositionResponse.pb-c.h> +#include <PMR/Stubs/StubMotorMovRequest.pb-c.h> +#include <PMR/Stubs/StubMotorMovResponse.pb-c.h> + +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <string.h> +#include <Stubs_Handler/DataDef.h> +#include "inc/hw_memmap.h" +#include "inc/hw_types.h" +#include "inc/hw_uart.h" + +#include "usb_serial_adapter.h" +#include "graphics_adapter.h" + +#include "MessageContainer.pb-c.h" + +#include "Container.h" +#include "Stub_Status.h" +#include "drivers/FPGA/FPGA.h" +#include "drivers/SPI/SPI_Comm.h" + +#include "drivers/FPGA/Moters_Driver/L6470.h" + +#include "driverlib/ssi.h" + + +extern unsigned long Run_Value ; +extern unsigned long Pos_Value ; +extern bool Direction ; +unsigned char Stop_Command = 0 ; + + + +void Stub_MotorInitRequest(MessageContainer* requestContainer) +{ + //uint32_t status = FAILED; + + MessageContainer responseContainer; + + StubMotorInitRequest* request = stub_motor_init_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + //SPI_Control(INIT); + + SPI2_Init(); + init_BUSY_Pin(); + //while(SSIBusy(SSI2_BASE)){}; + //init_BUSY_Pin(); + + + setup(request); + //setup(); + + //init_BUSY_Pin(); + //while(SSIBusy(SSI2_BASE)){}; + //ResetPos(); + //while(SSIBusy(SSI2_BASE)){}; + + //Run_Value = request->run_value; + //Mov_Value = request->mov_value; + //Direction = request->direction; + + + //writeLine("L6470 Request: "); + + //writeFloat(request->run_value); + + //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); + //SPI_Control(); + + //temp_init_spi2(); + + + StubMotorInitResponse response = STUB_MOTOR_INIT_RESPONSE__INIT; + + // status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + + response.motor_id = request->motor_id; + response.has_motor_id = true; + response.status = 0; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorInitResponse, requestContainer->token, true, &response, &stub_motor_init_response__pack, &stub_motor_init_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.motor_id); + writeString(", "); + writeFloat(response.status); + + //writeString(", "); + // + //Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + +void Stub_MotorRunRequest(MessageContainer* requestContainer) +{ + //uint32_t status = FAILED; + + uint32_t read_status; + + MessageContainer responseContainer; + + StubMotorRunRequest* request = stub_motor_run_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + float temp = (float)request->speed; + Run_Value = SpdCalc(temp); + Direction = request->direction; + + //SPI_Control(SKIP_INIT); + Mot_Run(); + + //writeLine("L6470 Request: "); + + //writeFloat(request->run_value); + + //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); + + + + StubMotorRunResponse response = STUB_MOTOR_RUN_RESPONSE__INIT; + + // status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + read_status = Get_and_Clear_Status(); + + response.speed = (double)(CurrentSpdCalc(Get_Param(x_SPEED))); + response.has_speed = true; + + response.status_reg = read_status; + response.has_status_reg = true; + + response.direction = ((read_status & x_STATUS_DIR)>>4); + response.has_direction = true; + + response.step_loss_a = ((read_status & x_STATUS_STEP_LOSS_A)>>13); + response.has_step_loss_a = true; + response.step_loss_b = ((read_status & x_STATUS_STEP_LOSS_B)>>14); + response.has_step_loss_b = true; + + + response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5); + response.has_mot_status = true; + + + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorRunResponse, requestContainer->token, true, &response, &stub_motor_run_response__pack, &stub_motor_run_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.motor_id); + + //writeString(", "); + //writeFloat(response.day); + + //Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + +void Stub_MotorStopRequest(MessageContainer* requestContainer) +{ + uint32_t read_status; + //uint32_t status = FAILED; + + MessageContainer responseContainer; + + StubMotorStopRequest* request = stub_motor_stop_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + + Stop_Command = request->stop_cmd; + + //SPI_Control(SKIP_INIT); + Mot_Stop(); + + //writeLine("L6470 Request: "); + + //writeFloat(request->run_value); + + //status = FPGA_ReadVersion((unsigned char)request->fpgaid, &Version, &Year, &Month, &Day); + + + + StubMotorStopResponse response = STUB_MOTOR_STOP_RESPONSE__INIT; + + // status_response(status,&response.status, &response.statusword ,&response.has_statusword); + + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + read_status = Get_and_Clear_Status(); + + response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5); + response.has_mot_status = true; + + response.hiz = (read_status & x_STATUS_HIZ); + response.has_hiz = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorStopResponse, requestContainer->token, true, &response, &stub_motor_stop_response__pack, &stub_motor_stop_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.motor_id); + + //writeString(", "); + //writeFloat(response.day); + + //Write_status_response(status); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + + +void Stub_MotorStatusRequest(MessageContainer* requestContainer) +{ + uint32_t read_status; + + MessageContainer responseContainer; + + StubMotorStatusRequest* request = stub_motor_status_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + + if(request->clearstatus) + { + read_status = Get_and_Clear_Status(); + } + else + { + read_status = Get_Param(x_STATUS); + } + + StubMotorStatusResponse response = STUB_MOTOR_STATUS_RESPONSE__INIT; + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + response.sck_mod = ((read_status & x_STATUS_SCK_MOD)>>15); + response.has_sck_mod = true; + + response.step_loss_b = ((read_status & x_STATUS_STEP_LOSS_B)>>14); + response.has_step_loss_b = true; + + response.step_loss_a = ((read_status & x_STATUS_STEP_LOSS_A)>>13); + response.has_step_loss_a = true; + + response.ocd = ((read_status & x_STATUS_OCD)>>12); + response.has_ocd = true; + + response.th_sd = ((read_status & x_STATUS_TH_SD)>>11); + response.has_th_sd = true; + + response.th_wrn = ((read_status & x_STATUS_TH_WRN)>>10); + response.has_th_wrn = true; + + response.uvlo = ((read_status & x_STATUS_UVLO)>>9); + response.has_uvlo = true; + + response.wrong_cmd = ((read_status & x_STATUS_WRONG_CMD)>>8); + response.has_wrong_cmd = true; + + response.notperf_cmd = ((read_status & x_STATUS_NOTPERF_CMD)>>7); + response.has_notperf_cmd = true; + + response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5); + response.has_mot_status = true; + + response.dir = ((read_status & x_STATUS_DIR)>>4); + response.has_dir = true; + + response.sw_evn = ((read_status & x_STATUS_SW_EVN)>>3); + response.has_sw_evn = true; + + response.sw_f = ((read_status & x_STATUS_SW_F)>>2); + response.has_sw_f = true; + + response.busy = ((read_status & x_STATUS_BUSY)>>1); + response.has_busy = true; + + response.hiz = (read_status & x_STATUS_HIZ); + response.has_hiz = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorStatusResponse, requestContainer->token, true, &response, &stub_motor_status_response__pack, &stub_motor_status_response__get_packed_size); + + writeLine("Sending Response: "); + + writeFloat(response.motor_id); + + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + +void Stub_MotorSpeedRequest(MessageContainer* requestContainer) +{ + + MessageContainer responseContainer; + + StubMotorSpeedRequest* request = stub_motor_speed_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + StubMotorSpeedResponse response = STUB_MOTOR_SPEED_RESPONSE__INIT; + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + //response.speed = Get_Param(x_SPEED); + response.speed = (double)(CurrentSpdCalc(Get_Param(x_SPEED))); + response.has_speed = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorSpeedResponse, requestContainer->token, true, &response, &stub_motor_speed_response__pack, &stub_motor_speed_response__get_packed_size); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + +void Stub_MotorPositionRequest(MessageContainer* requestContainer) +{ + + MessageContainer responseContainer; + + StubMotorPositionRequest* request = stub_motor_position_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + StubMotorPositionResponse response = STUB_MOTOR_POSITION_RESPONSE__INIT; + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + response.position = Get_Param(x_ABS_POS); + response.has_position = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorPositionResponse, requestContainer->token, true, &response, &stub_motor_position_response__pack, &stub_motor_position_response__get_packed_size); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + + +void Stub_MotorMovRequest(MessageContainer* requestContainer) +{ + uint32_t read_status; + + MessageContainer responseContainer; + + StubMotorMovRequest* request = stub_motor_mov_request__unpack(NULL, requestContainer->data.len, requestContainer->data.data); + + Pos_Value = request->position; + Direction = request->direction; + + Mot_Mov(); + + StubMotorMovResponse response = STUB_MOTOR_MOV_RESPONSE__INIT; + + response.motor_id = request->motor_id; + response.has_motor_id = true; + + + response.position = Get_Param(x_ABS_POS); + response.has_position = true; + + while(SSIBusy(SSI2_BASE)){}; + + read_status = Get_and_Clear_Status(); + + + response.status_reg = read_status; + response.has_status_reg = true; + + response.direction = ((read_status & x_STATUS_DIR)>>4); + response.has_direction = true; + + response.step_loss_a = ((read_status & x_STATUS_STEP_LOSS_A)>>13); + response.has_step_loss_a = true; + response.step_loss_b = ((read_status & x_STATUS_STEP_LOSS_B)>>14); + response.has_step_loss_b = true; + + + response.mot_status = ((read_status & x_STATUS_MOT_STATUS)>>5); + response.has_mot_status = true; + + responseContainer = createContainer(MESSAGE_TYPE__StubMotorMovResponse, requestContainer->token, true, &response, &stub_motor_mov_response__pack, &stub_motor_mov_response__get_packed_size); + + free(request); + //------------------------------------------------------------------------------------------- + uint8_t* container_buffer = malloc(message_container__get_packed_size(&responseContainer)); + size_t container_size = message_container__pack(&responseContainer, container_buffer); + SendChars((char*)container_buffer, container_size); + free(container_buffer); + free(requestContainer); +} + diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.h new file mode 100644 index 000000000..95f82353f --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Motor.h @@ -0,0 +1,7 @@ +void Stub_MotorInitRequest(MessageContainer* requestContainer); +void Stub_MotorRunRequest(MessageContainer* requestContainer); +void Stub_MotorStopRequest(MessageContainer* requestContainer); +void Stub_MotorStatusRequest(MessageContainer* requestContainer); +void Stub_MotorSpeedRequest(MessageContainer* requestContainer); +void Stub_MotorPositionRequest(MessageContainer* requestContainer); +void Stub_MotorMovRequest(MessageContainer* requestContainer); diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_MotorEncoder.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_MotorEncoder.c index 9380ec65f..6478e0ca0 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_MotorEncoder.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_MotorEncoder.c @@ -1,4 +1,6 @@ +#include <PMR/Stubs/StubMotorEncoderRequest.pb-c.h> +#include <PMR/Stubs/StubMotorEncoderResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -16,9 +18,6 @@ #include "MessageContainer.pb-c.h" -#include "StubMotorEncoderResponse.pb-c.h" -#include "StubMotorEncoderRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_OptLimitSwitch.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_OptLimitSwitch.c index c7064b0ea..a885cc0c0 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_OptLimitSwitch.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_OptLimitSwitch.c @@ -1,5 +1,7 @@ +#include <PMR/Stubs/StubOptLimitSwitchRequest.pb-c.h> +#include <PMR/Stubs/StubOptLimitSwitchResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -17,9 +19,6 @@ #include "MessageContainer.pb-c.h" -#include "StubOptLimitSwitchResponse.pb-c.h" -#include "StubOptLimitSwitchRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_SteperMotor.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_SteperMotor.c index 47ff8a0d5..a54ac9a10 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_SteperMotor.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_SteperMotor.c @@ -1,5 +1,7 @@ +#include <PMR/Stubs/StubSteperMotorRequest.pb-c.h> +#include <PMR/Stubs/StubSteperMotorResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -17,9 +19,6 @@ #include "MessageContainer.pb-c.h" -#include "StubSteperMotorRequest.pb-c.h" -#include "StubSteperMotorResponse.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Valve.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Valve.c index 08c74611c..c4fe7b08f 100644 --- a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Valve.c +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/Stub_Valve.c @@ -1,4 +1,6 @@ +#include <PMR/Stubs/StubValveRequest.pb-c.h> +#include <PMR/Stubs/StubValveResponse.pb-c.h> #include <stdbool.h> #include <stdlib.h> #include <stdio.h> @@ -16,9 +18,6 @@ #include "MessageContainer.pb-c.h" -#include "StubValveResponse.pb-c.h" -#include "StubValveRequest.pb-c.h" - #include "Container.h" #include "Stub_Status.h" diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.c b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.c new file mode 100644 index 000000000..0d7c95943 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.c @@ -0,0 +1,263 @@ +//***************************************************************************** +// +// temperature_sensor.c - Example demonstrating the internal ADC temperature +// sensor. +// +// Copyright (c) 2010-2014 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the +// distribution. +// +// Neither the name of Texas Instruments Incorporated nor the names of +// its contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// This is part of revision 2.1.0.12573 of the Tiva Firmware Development Package. +// +//***************************************************************************** +/* + * This code was made to show a simple ADC read. + * + * It was made from the example provided by TivaWare but it was a some modifications + * like the math + * + * + * Lu?s Afonso + * https://sites.google.com/site/luiselectronicprojects/tutorials/tiva-tutorials/tiva-adc/internal-temperature-sensor + * + */ + +#include <stdint.h> +#include <stdbool.h> +#include "stdlib.h" +#include "inc/hw_ints.h" +#include "inc/hw_memmap.h" +#include "inc/hw_uart.h" +#include "inc/hw_gpio.h" +#include "inc/hw_pwm.h" +#include "inc/hw_types.h" +#include "driverlib/adc.h" +#include "driverlib/timer.h" +#include "driverlib/gpio.h" +#include "driverlib/interrupt.h" +#include "driverlib/pin_map.h" +#include "driverlib/rom.h" +#include "driverlib/rom_map.h" +#include "driverlib/sysctl.h" +#include "driverlib/uart.h" +#include "driverlib/udma.h" +#include "driverlib/pwm.h" +#include "driverlib/ssi.h" +#include "driverlib/systick.h" +#include "driverlib/adc.h" +#include "utils/uartstdio.h" +#include "utils/uartstdio.c" +#include <string.h> + +#include "graphics_adapter.h" + +//***************************************************************************** +// +// This function sets up UART0 to be used for a console to display information +// as the example is running. +// +//***************************************************************************** +void +InitConsole(void) +{ + // + // Enable GPIO port A which is used for UART0 pins. + // TODO: change this to whichever GPIO port you are using. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Configure the pin muxing for UART0 functions on port A0 and A1. + // This step is not necessary if your part does not support pin muxing. + // TODO: change this to select the port/pin you are using. + // + GPIOPinConfigure(GPIO_PA0_U0RX); + GPIOPinConfigure(GPIO_PA1_U0TX); + + // + // Enable UART0 so that we can configure the clock. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Select the alternate (UART) function for these pins. + // TODO: change this to select the port/pin you are using. + // + GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); +} + +int temperature_main(){ + SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); + InitConsole(); + // + // This array is used for storing the data read from the ADC FIFO. It + // must be as large as the FIFO for the sequencer in use. This example + // uses sequence 3 which has a FIFO depth of 1. If another sequence + // was used with a deeper FIFO, then the array size must be changed. + // + uint32_t ADCValues[1]; + + // + // These variables are used to store the temperature conversions for + // Celsius and Fahrenheit. + // + uint32_t TempValueC ; + uint32_t TempValueF ; + + + // + // Display the setup on the console. + // + UARTprintf("ADC ->\n"); + UARTprintf(" Type: Internal Temperature Sensor\n"); + UARTprintf(" Samples: One\n"); + UARTprintf(" Update Rate: 250ms\n"); + UARTprintf(" Input Pin: Internal temperature sensor\n\n"); + + writeLine("ADC ->\n"); + writeLine(" Type: Internal Temperature Sensor\n"); + writeLine(" Samples: One\n"); + writeLine(" Update Rate: 250ms\n"); + writeLine(" Input Pin: Internal temperature sensor\n\n"); + + // + // The ADC0 peripheral must be enabled for use. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0); + SysCtlDelay(3);//3 wait cycles after enabling a clock on a peripheral + + // + // Enable sample sequence 3 with a processor signal trigger. Sequence 3 + // will do a single sample when the processor sends a singal to start the + // conversion. Each ADC module has 4 programmable sequences, sequence 0 + // to sequence 3. This example is arbitrarily using sequence 3. + // + ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_PROCESSOR, 0); + + // + // Configure step 0 on sequence 3. Sample the temperature sensor + // (ADC_CTL_TS) and configure the interrupt flag (ADC_CTL_IE) to be set + // when the sample is done. Tell the ADC logic that this is the last + // conversion on sequence 3 (ADC_CTL_END). Sequence 3 has only one + // programmable step. Sequence 1 and 2 have 4 steps, and sequence 0 has + // 8 programmable steps. Since we are only doing a single conversion using + // sequence 3 we will only configure step 0. For more information on the + // ADC sequences and steps, reference the datasheet. + // + ADCSequenceStepConfigure(ADC0_BASE, 3, 0, ADC_CTL_TS | ADC_CTL_IE | + ADC_CTL_END); + + //ADCHardwareOversampleConfigure(ADC0_BASE,64);//This will configure to do averages of 64 values (powers of 2, from 2 to 64 ) + + // + // Since sample sequence 3 is now configured, it must be enabled. + // + ADCSequenceEnable(ADC0_BASE, 3); + + // + // Clear the interrupt status flag. This is done to make sure the + // interrupt flag is cleared before we sample. + // + ADCIntClear(ADC0_BASE, 3); + + // + // Sample the temperature sensor forever. Display the value on the + // console. + // + while(1) + { + // + // Trigger the ADC conversion. + // + ADCProcessorTrigger(ADC0_BASE, 3); + + // + // Wait for conversion to be completed. + // + while(!ADCIntStatus(ADC0_BASE, 3, false)) + { + } + + // + // Clear the ADC interrupt flag. + // + ADCIntClear(ADC0_BASE, 3); + + // + // Read ADC Value. + // + ADCSequenceDataGet(ADC0_BASE, 3, ADCValues); + + // + // Use non-calibrated conversion provided in the data sheet. I use floats in intermediate + // math but you could use intergers with multiplied by powers of 10 and divide on the end + // Make sure you divide last to avoid dropout. + // + TempValueC = (uint32_t)(147.5 - ((75.0*3.3 *(float)ADCValues[0])) / 4096.0); + + //float Temaraure_C = 147.5 - ((75.0*3.3 *(float)ADCValues[0])) / 4096.0; + + // + // Get Fahrenheit value. Make sure you divide last to avoid dropout. + // + TempValueF = ((TempValueC * 9) + 160) / 5; + + // + // Display the temperature value on the console. + // + UARTprintf("Temperature = %3d*C or %3d*F\r", TempValueC, + TempValueF); + + writeLine("Temperature(Celsius): "); + writeFloat(TempValueC); + + // + // This function provides a means of generating a constant length + // delay. The function delay (in cycles) = 3 * parameter. Delay + // 250ms arbitrarily. + // + SysCtlDelay(80000000 / 12); + + ///SysCtlDelay(80000000); + } + + + +} diff --git a/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.h b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.h new file mode 100644 index 000000000..6368cf744 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/Stubs_Handler/temperature_sensor.h @@ -0,0 +1 @@ +int temperature_main(); diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.c b/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.c new file mode 100644 index 000000000..b230f8bf8 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.c @@ -0,0 +1,295 @@ +// ***************************************************************************** +// +// This is the data acquisition module. It performs acquisition of data from +// selected channels, starting and stopping data logging, storing acquired +// data, and running the strip chart display. +// +// ***************************************************************************** + +#include "ADC.h" +#include <stdbool.h> +#include <ti/sysbios/knl/Task.h> +#include <ti/sysbios/BIOS.h> +#include <ti/sysbios/knl/Clock.h> +#include <ti/sysbios/knl/Semaphore.h> + +#include <driverlib/adc.h> +#include <driverlib/rom_map.h> +#include <driverlib/interrupt.h> + +#include <inc/hw_memmap.h> +#include <inc/hw_ints.h> +#include "Drivers/I2C_Communication/I2C.h" +// ***************************************************************************** +// +// The following defines which ADC channel control should be used for each +// kind of data item. Basically it maps how the ADC channels are connected +// on the board. This is a hardware pinmap configuration. +// Physical ADC connected channels in the TIVA +// ***************************************************************************** +#define CHAN_DISPENSER_TEMP_3 ADC_CTL_CH0 +#define CHAN_DISPENSER_TEMP_1 ADC_CTL_CH1 +#define CHAN_RGB_RED ADC_CTL_CH2 +#define CHAN_TEMP_3 ADC_CTL_CH3 +#define CHAN_POS_WINDER ADC_CTL_CH10 +#define CHAN_RGB_GREEN ADC_CTL_CH12 +#define CHAN_RGB_BLUE ADC_CTL_CH13 +#define CHAN_DISPENSER_TEMP_5 ADC_CTL_CH16 +#define CHAN_DISPENSER_TEMP_6 ADC_CTL_CH17 +#define CHAN_TEMP_1 ADC_CTL_CH18 +#define CHAN_TEMP_2 ADC_CTL_CH19 +#define CHAN_DISPENSER_TEMP_4 ADC_CTL_CH20 +#define CHAN_POS_POOLER ADC_CTL_CH21 +#define CHAN_DISPENSER_TEMP_2 ADC_CTL_CH23 + +// ***************************************************************************** +// +// The following maps the order that items are acquired and stored by the +// ADC sequencers. Note that 16 samples are specified, using 2 of the +// 8 sample sequencers. The current is sampled multiple times deliberately +// because that value tends to bounce around. It is sampled multiple +// times and will be averaged. +// +// ***************************************************************************** +uint32_t g_pui32ADCSeq[] = +{ + CHAN_DISPENSER_TEMP_3, CHAN_DISPENSER_TEMP_1, CHAN_RGB_RED, CHAN_TEMP_3, + CHAN_POS_POOLER, CHAN_RGB_GREEN, CHAN_RGB_BLUE, CHAN_DISPENSER_TEMP_5, + CHAN_DISPENSER_TEMP_6, CHAN_TEMP_1, CHAN_TEMP_2, CHAN_DISPENSER_TEMP_4, + CHAN_DISPENSER_TEMP_2, CHAN_POS_WINDER +}; + +#define NUM_ADC_CHANNELS (sizeof(g_pui32ADCSeq) / \ + sizeof(g_pui32ADCSeq[0])) + +#define SAMPLE_ARRAY_SIZE (NUM_ADC_CHANNELS + I2C_NUM_OF_CHANNELS) + +static bool isInitialized = false; +// ***************************************************************************** +// +// Global _storage for most recent sampaled Sensor Data +// +// ***************************************************************************** +// +// A buffer to hold one set of ADC data that is acquired per sample time. +// +// ***************************************************************************** +static uint32_t g_pui32ADCData[SAMPLE_ARRAY_SIZE]; + +// ***************************************************************************** +//configured in the cfg file and thats why should be defined as extern +// ***************************************************************************** +extern Semaphore_Handle adcResultSem; + +static Clock_Handle adcSampleClock; +static Clock_Params clkParams; +static ProcessCallback processCallBack; + +// ***************************************************************************** +// ADCClockHandle: clock event handler - initiates trigger for the adc sampaling +// ***************************************************************************** +// This function starts an ADC Conversion. +static void ADCClockHandle(UArg arg0) +{ + // + // Kick off the next ADC acquisition. When these are done they will + // cause an ADC interrupt. + // + MAP_ADCProcessorTrigger(ADC1_BASE, 0); + MAP_ADCProcessorTrigger(ADC0_BASE, 0); +} + +// ***************************************************************************** +// +// This is the handler for the ADC interrupt. Even though more than one +// sequencer is used, they are configured so that this one runs last. +// Therefor when this ADC sequencer interrupt occurs, we know all of the ADC +// data has been acquired. +// +// ***************************************************************************** +void ADC0SS0Handler(void) +{ + // + // Clear the interrupts for all ADC sequencers that are used. + // + MAP_ADCIntClear(ADC0_BASE, 0); + MAP_ADCIntClear(ADC1_BASE, 0); + + // + // Retrieve the data from all ADC sequencers + // + MAP_ADCSequenceDataGet(ADC0_BASE, 0, &g_pui32ADCData[0]); + //offset in the array calculated as sempeling of 16 channels each one of 16 bits + MAP_ADCSequenceDataGet(ADC1_BASE, 0, &g_pui32ADCData[8]); + + // + // Release adc result semaphore + // + Semaphore_post(adcResultSem); +} + +// ***************************************************************************** +// +// ***************************************************************************** +Void ADCProcessTask(UArg arg0, UArg arg1) +{ + while(1) + { + // + // Wait until new ADC data is available + // + Semaphore_pend(adcResultSem, BIOS_WAIT_FOREVER); + + // + // Process the ADC data + // + if (processCallBack != NULL) + { + processCallBack(g_pui32ADCData); + } + } +} + +// ***************************************************************************** +// +// This function initializes the ADC hardware in preparation for data +// acquisition. +// +// ***************************************************************************** +void ADCAcquireInit(void) +{ + uint32_t ui32Chan, ui32Base, ui32Seq; + + //Avaraging 8 + MAP_ADCHardwareOversampleConfigure(ADC0_BASE, 8); + MAP_ADCHardwareOversampleConfigure(ADC1_BASE, 8); + // + // Initialize both ADC peripherals using sequencer 0 and processor trigger. + // + MAP_ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); + MAP_ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); + + + // + // Enter loop to configure all of the ADC sequencer steps needed to + // acquire the data for the data logger. Multiple ADC and sequencers + // will be used in order to acquire all the channels. + // + for(ui32Chan = 0; ui32Chan < NUM_ADC_CHANNELS; ui32Chan++) + { + // + // If this is the first ADC then set the base for ADC0 + // + if(ui32Chan < 8) + { + ui32Base = ADC0_BASE; + ui32Seq = 0; + } + else if(ui32Chan < 16) + { + // + // Second ADC, set the base for ADC1 + // + ui32Base = ADC1_BASE; + ui32Seq = 0; + } + + // + // Get the channel control for each channel. Test to see if it is the + // last channel for the sequencer, and if so then also set the + // interrupt and "end" flags. + // + uint32_t ui32ChCtl = g_pui32ADCSeq[ui32Chan]; + //TODO define all the numbers under #define and not here + if((ui32Chan == 7) || (ui32Chan == 15) || (ui32Chan == (NUM_ADC_CHANNELS - 1))) + { + ui32ChCtl |= ADC_CTL_IE | ADC_CTL_END; + } + + // + // Configure the sequence step + // + MAP_ADCSequenceStepConfigure(ui32Base, ui32Seq, ui32Chan % 8, ui32ChCtl); + } + + if (!isInitialized) + { + // Create a periodic Clock Instance with _period - triggers the ADC sampling + Clock_Params_init(&clkParams); + clkParams.period = 0; + clkParams.startFlag = FALSE; + adcSampleClock = Clock_create(ADCClockHandle, 11, &clkParams, NULL); + isInitialized = true; + + InitI2C(); + } +} + +// ***************************************************************************** +// +// This function is called to start an acquisition running. It determines +// which channels are to be logged, enables the ADC/I2C sequencers. +// This will start the acquisition running. +// +// ***************************************************************************** +void ADCAcquireStart(ProcessCallback _callback, uint32_t _period) +{ + // + // Enable the ADC sequencers + // + MAP_ADCSequenceEnable(ADC0_BASE, 0); + MAP_ADCSequenceEnable(ADC1_BASE, 0); + + // + // Flush the ADC sequencers to be sure there is no lingering/ trush data. + // + MAP_ADCSequenceDataGet(ADC0_BASE, 0, g_pui32ADCData); + MAP_ADCSequenceDataGet(ADC1_BASE, 0, g_pui32ADCData); + + // + // Enable ADC interrupts + // + MAP_ADCIntClear(ADC0_BASE, 0); + MAP_ADCIntClear(ADC1_BASE, 0); + MAP_ADCIntEnable(ADC0_BASE, 0); + MAP_IntEnable(INT_ADC0SS0); + + uint8_t i; + for (i = NUM_ADC_CHANNELS; i < SAMPLE_ARRAY_SIZE; ++i) + { + g_pui32ADCData[i] = MAX_DIGITAL_POTENTIOMETER_READ; + } + // Store process + processCallBack = _callback; + // Start a periodic Clock Instance with _period - triggers the ADC sampling + Clock_setPeriod(adcSampleClock, _period); + Clock_start(adcSampleClock); + // + // Logging data should now start running + // +} + +// ***************************************************************************** +// +// This function is called to stop an acquisition running. It disables the +// ADC sequencers. +// +// ***************************************************************************** +void ADCAcquireStop(void) +{ + //Stop trigger adc sampling + Clock_stop(adcSampleClock); + + // + // Disable ADC interrupts + // + MAP_IntDisable(INT_ADC0SS0); + MAP_IntDisable(INT_ADC1SS0); + + // + // Disable ADC sequencers + // + MAP_ADCSequenceDisable(ADC0_BASE, 0); + MAP_ADCSequenceDisable(ADC1_BASE, 0); +} + diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.h b/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.h new file mode 100644 index 000000000..f04c2d512 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/ADC_Sampling/ADC.h @@ -0,0 +1,40 @@ + +#ifndef DRIVERS_ADC_H_ +#define DRIVERS_ADC_H_ + +#include <stdint.h> + +//***************************************************************************** +// +// The following are indexes for values returned from the ADC's. These index's +// map directly to g_pui32ADCSeq[], and inside this array there is a directly +// ADC copied data +//***************************************************************************** +#define ADCSEQ_DISPENSER_TEMP_3 0 +#define ADCSEQ_DISPENSER_TEMP_1 1 +#define ADCSEQ_RGB_RED 2 +#define ADCSEQ_TEMP_3 3 +#define ADCSEQ_POS_POOLER 4 +#define ADCSEQ_RGB_GREEN 5 +#define ADCSEQ_RGB_BLUE 6 +#define ADCSEQ_DISPENSER_TEMP_5 7 +#define ADCSEQ_DISPENSER_TEMP_6 8 +#define ADCSEQ_TEMP_1 9 +#define ADCSEQ_TEMP_2 10 +#define ADCSEQ_DISPENSER_TEMP_4 11 +#define ADCSEQ_DISPENSER_TEMP_2 12 +#define ADCSEQ_POS_WINDER 13 + +//max potentiometer read in I2C protocol +#define MAX_DIGITAL_POTENTIOMETER_READ 0x660D + +typedef void (*ProcessCallback)(uint32_t* adcData); + +void ADCAcquireInit(void); + +void ADCAcquireStart(ProcessCallback _callback, uint32_t _period); + +void ADCAcquireStop(void); + +#endif // DRIVERS_ADC_H_ + diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.c b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.c new file mode 100644 index 000000000..fafd84375 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.c @@ -0,0 +1,88 @@ +#include "FPGA_COMM.h" +#include "Stubs_Handler/DataDef.h" + + +unsigned short GPO_01_Reg; + +int test_FPGA() +{ + GP_Out_01 Gpo_01; + + Gpo_01.bits.F3_GPO_LED4 = 1; + Gpo_01.bits.F3_GPO_LED3 = 1; + Gpo_01.bits.F3_GPO_LED2 = 0; + Gpo_01.bits.F3_GPO_LED1 = 1; + Gpo_01.bits.F3_GPO_EXTWINDER_SSR11_CTRL = 1; + Gpo_01.bits.F3_GPO_BUZZER = 0; + Gpo_01.bits.F3_SPARE2_ROTENC_CLK = 1; + Gpo_01.bits.F3_SPARE1_ROTENC_CLK = 1; + Gpo_01.bits.RESERVE = 0xF5; + + GPO_01_Reg = Gpo_01.ushort; + + return 0; +} + +int Test_FPGA_ReadBack(unsigned char FPGA_NUM, unsigned short Value, unsigned short *ReadBackValue)// = 0x1234) +{ + + //unsigned short Temp = 0x1234; + + if(FPGA_NUM == 1) + { + FPGA1_Test = Value; + *ReadBackValue = FPGA1_Test; + if(Value == !FPGA1_Test) + return PASSED; + } + + if(FPGA_NUM == 2) + { + FPGA2_Test = Value; + *ReadBackValue = FPGA2_Test; + if(Value == !FPGA2_Test) + return PASSED; + } + + if(FPGA_NUM == 3) + { + FPGA3_Test = Value; + *ReadBackValue = FPGA3_Test; + if(Value == !FPGA3_Test) + return PASSED; + } + + return FAILED; +} + + +int FPGA_ReadVersion(unsigned char FPGA_NUM, unsigned char *Version, unsigned char *Year, unsigned char *Month, unsigned char *Day) +{ + VER1 Ver1; + VER2 Ver2; + + switch(FPGA_NUM) + { + case 1: + Ver1.ushort = FPGA1_Ver1_D; + Ver2.ushort = FPGA1_Ver2_D; + break; + case 2: + Ver1.ushort = FPGA2_Ver1_D; + Ver2.ushort = FPGA2_Ver2_D; + break; + case 3: + Ver1.ushort = FPGA3_Ver1_D; + Ver2.ushort = FPGA3_Ver2_D; + break; + default: + break; + } + + *Month = Ver1.bytes.Month; + *Day = Ver1.bytes.Day; + *Year = Ver2.bytes.Year; // to check how many digits is needed + *Version = Ver2.bytes.Ver_num; + + return PASSED; +} diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.h b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.h new file mode 100644 index 000000000..a0e845296 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA.h @@ -0,0 +1,9 @@ +#ifndef FPGA_H +#define FPGA_H + +int test_FPGA(); +int Test_FPGA_ReadBack(unsigned char FPGA_NUM, unsigned short Value, unsigned short *ReadBackValue); +int FPGA_ReadVersion(unsigned char FPGA_NUM, unsigned char *Version, unsigned char *Year, unsigned char *Month, unsigned char *Day); + + +#endif //FPGA_H diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_Comm.h b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_Comm.h new file mode 100644 index 000000000..4a124092f --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_Comm.h @@ -0,0 +1,731 @@ +#include <stdbool.h> + +//TODO update the addresses WordOrByte !!! + +//Address is = 4bit_base + 3bit_fpga_base + 9bit_WordOrByte +//Base Address 0X000 + +#define BASE 0x0000 << 12 +#define FPGA1_BASE (BASE | (0x00 << 0x09)) +#define FPGA2_BASE (BASE | (0x01 << 0x09)) +#define FPGA3_BASE (BASE | (0x02 << 0x09)) + +#define WordOrByte 0x01//0x01 for Word, 0x02 for Byte + +//Registers definitions + +// * * * * * * * * * * * * * * * * FPGA 1 * * * * * * * * * * * * * * * * // + +//Version1 +#define FPGA1_Ver1_D (*((volatile short *)(FPGA1_BASE | (0x0 * WordOrByte)))) //Version of Fpga is held here +#define FPGA1_Ver1_L (*((volatile short *)(FPGA1_BASE | (0x1 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA1_Ver1_M (*((volatile short *)(FPGA1_BASE | (0x2 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Version2 +#define FPGA1_Ver2_D (*((volatile short *)(FPGA1_BASE | (0x8 * WordOrByte)))) //Version of Fpga is held here +#define FPGA1_Ver2_L (*((volatile short *)(FPGA1_BASE | (0x9 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA1_Ver2_M (*((volatile short *)(FPGA1_BASE | (0xa * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_01 Registers +#define F1_GPI_LS1_D (*((volatile short *)(FPGA1_BASE | (0x10 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F1_GPI_LS1_L (*((volatile short *)(FPGA1_BASE | (0x11 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F1_GPI_LS1_M (*((volatile short *)(FPGA1_BASE | (0x12 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_02 Registers +#define F1_GPI_LS2_D (*((volatile short *)(FPGA1_BASE | (0x18 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F1_GPI_LS2_L (*((volatile short *)(FPGA1_BASE | (0x19 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F1_GPI_LS2_M (*((volatile short *)(FPGA1_BASE | (0x1a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_03 Registers +#define GPI_LS3_D (*((volatile short *)(FPGA1_BASE | (0x20 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define GPI_LS3_L (*((volatile short *)(FPGA1_BASE | (0x21 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define GPI_LS3_M (*((volatile short *)(FPGA1_BASE | (0x22 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Moto_Driver_NBUSY_register1 +#define Moto_Driver_NBUSY1_D (*((volatile short *)(FPGA1_BASE | (0x28 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define Moto_Driver_NBUSY1_L (*((volatile short *)(FPGA1_BASE | (0x29 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define Moto_Driver_NBUSY1_M (*((volatile short *)(FPGA1_BASE | (0x2a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Moto_Driver_NBUSY_register2 +#define Moto_Driver_NBUSY2_D (*((volatile short *)(FPGA1_BASE | (0x30 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define Moto_Driver_NBUSY2_L (*((volatile short *)(FPGA1_BASE | (0x31 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define Moto_Driver_NBUSY2_M (*((volatile short *)(FPGA1_BASE | (0x32 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI_EXTWINDER_and_TFEED_BRK +#define GPI_EXTWINDER_D (*((volatile short *)(FPGA1_BASE | (0x38 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define GPI_EXTWINDER_L (*((volatile short *)(FPGA1_BASE | (0x39 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define GPI_EXTWINDER_M (*((volatile short *)(FPGA1_BASE | (0x3a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Prescaler +#define F1_Prescaler1_reg1 (*((volatile short *)(FPGA1_BASE | (0x40 * WordOrByte)))) //Parameter for prescaler divisions +#define F1_Prescaler1_reg2 (*((volatile short *)(FPGA1_BASE | (0x41 * WordOrByte)))) //Parameter for prescaler divisions +#define F1_Prescaler1_reg3 (*((volatile short *)(FPGA1_BASE | (0x42 * WordOrByte)))) //Parameter for prescaler divisions +#define F1_Prescaler1_reg4 (*((volatile short *)(FPGA1_BASE | (0x43 * WordOrByte)))) //Parameter for prescaler divisions + +//SPI_Busy_register1 +#define SPI_Busy1_D (*((volatile short *)(FPGA1_BASE | (0x048 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define SPI_Busy1_L (*((volatile short *)(FPGA1_BASE | (0x049 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define SPI_Busy1_M (*((volatile short *)(FPGA1_BASE | (0x04a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//SPI_Busy_register2 +#define SPI_Busy2_D (*((volatile short *)(FPGA1_BASE | (0x050 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define SPI_Busy2_L (*((volatile short *)(FPGA1_BASE | (0x051 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define SPI_Busy2_M (*((volatile short *)(FPGA1_BASE | (0x052 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Moto_Driver_NSTBYRST_register1 +#define F1_Moto_Driver_NSTBYRST1 (*((volatile short *)(FPGA1_BASE | (0x059 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register + +//Moto_Driver_NSTBYRST_register2 +#define Moto_Driver_NSTBYRST2 (*((volatile short *)(FPGA1_BASE | (0x061 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register + +//Moto_Driver_SW_register1 +#define F1_Moto_Driver_SW1 (*((volatile short *)(FPGA1_BASE | (0x069 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register + +//Moto_Driver_SW_register2 +#define Moto_Driver_SW2 (*((volatile short *)(FPGA1_BASE | (0x071 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register + +//QEI_SCREW_ROTENC +#define SCREW_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x080 * WordOrByte)))) //Value of the lsb of the QEI register +#define SCREW_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x081 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define SCREW_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x082 * WordOrByte)))) //value of index counter + +//QEI_RSPARE_ROTENC +#define RSPARE_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x088 * WordOrByte)))) //Value of the lsb of the QEI register +#define RSPARE_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x089 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define RSPARE_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x08a * WordOrByte)))) //value of index counter + +//QEI_LSPARE1_ROTENC +#define LSPARE1_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x090 * WordOrByte)))) //Value of the lsb of the QEI register +#define LSPARE1_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x091 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define LSPARE1_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x092 * WordOrByte)))) //value of index counter + +//QEI_RSPEEDSENS_ROTENC +#define RSPEEDSENS_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x098 * WordOrByte)))) //Value of the lsb of the QEI register +#define RSPEEDSENS_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x099 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define RSPEEDSENS_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x09a * WordOrByte)))) //value of index counter + +//QEI_LSPARE2_ROTENC +#define LSPARE2_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x0A0 * WordOrByte)))) //Value of the lsb of the QEI register +#define LSPARE2_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x0A1 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define LSPARE2_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x0A2 * WordOrByte)))) //value of index counter + +//QEI_DRYER_LOADARM_ROTENC +#define DRYER_LOADARM_ROTENC_L (*((volatile short *)(FPGA1_BASE | (0x0a8 * WordOrByte)))) //Value of the lsb of the QEI register +#define DRYER_LOADARM_ROTENC_M (*((volatile short *)(FPGA1_BASE | (0x0a9 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define DRYER_LOADARM_ROTENC_I (*((volatile short *)(FPGA1_BASE | (0x0aa * WordOrByte)))) //value of index counter + +//SPI_MOTO_RLOADING_A1 +#define MOTO_RLOADING_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x100 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RLOADING_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x101 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RLOADING_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x102 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_RLOADING_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x103 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. + +//SPI_MOTO_RDRIVING_A1 +#define MOTO_RDRIVING_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x108 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RDRIVING_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x109 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RDRIVING_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x10A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_RDRIVING_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x10B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. + +//SPI_F1_MOTO_LDRIVING_A1 +#define MOTO_LDRIVING_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x110 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDRIVING_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x111 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDRIVING_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x112 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_LDRIVING_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x113 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_LLOADING_A1 +#define MOTO_LLOADING_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x118 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LLOADING_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x119 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LLOADING_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x11A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_LLOADING_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x11B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. + +//SPI_F1_MOTO_DRYER_LOADARM_A1 +#define MOTO_DRYER_LOADARM_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x120 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_LOADARM_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x121 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_LOADARM_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x122 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DRYER_LOADARM_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x123 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_DRYER_DRIVING_A1 +#define MOTO_DRYER_DRIVING_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x128 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_DRIVING_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x129 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_DRIVING_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x12A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DRYER_DRIVING_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x12B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_DH_CLEANHEAD_A1 +#define MOTO_DH_CLEANHEAD_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x130 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_CLEANHEAD_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x131 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_CLEANHEAD_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x132 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DH_CLEANHEAD_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x133 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_DH_CLEANMECH_A1 +#define MOTO_DH_CLEANMECH_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x138 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_CLEANMECH_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x139 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_CLEANMECH_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x13A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DH_CLEANMECH_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x13B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. + +//SPI_F1_MOTO_SCREW_A1 +#define MOTO_SCREW_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x140 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SCREW_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x141 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SCREW_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x142 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_SCREW_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x143 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_WINDER_A1 +#define MOTO_WINDER_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x148 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_WINDER_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x149 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_WINDER_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x14A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_WINDER_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x14B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_RLOADARM_A1 +#define MOTO_RLOADARM_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x150 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RLOADARM_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x151 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RLOADARM_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x152 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_RLOADARM_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x153 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_RDANCER_A1 +#define MOTO_RDANCER_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x158 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RDANCER_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x159 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_RDANCER_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x15A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_RDANCER_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x15B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_LDANCER1_A1 +#define MOTO_LDANCER1_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x160 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDANCER1_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x161 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDANCER1_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x162 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_LDANCER1_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x163 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_LDANCER2_A1 +#define MOTO_LDANCER2_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x168 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDANCER2_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x169 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LDANCER2_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x16A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_LDANCER2_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x16B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_DRYER_LID_A1 +#define MOTO_DRYER_LID_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x170 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_LID_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x171 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DRYER_LID_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x172 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DRYER_LID_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x173 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_DH_LID_A1 +#define MOTO_DH_LID_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x178 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_LID_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x179 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DH_LID_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x17A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DH_LID_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x17B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_LPIVOT1_A1 +#define MOTO_LPIVOT1_A1_TX_00 (*((volatile short *)(FPGA1_BASE | (0x180 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LPIVOT1_A1_TX_01 (*((volatile short *)(FPGA1_BASE | (0x181 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_LPIVOT1_A1_RX_00 (*((volatile short *)(FPGA1_BASE | (0x182 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_LPIVOT1_A1_RX_01 (*((volatile short *)(FPGA1_BASE | (0x183 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SSI +#define F1_LDANCER1_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | (0x190 * WordOrByte)))) //16 bit MSB if nessesary +#define F1_LDANCER1_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | (0x191 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define LDANCER2_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | (0x198 * WordOrByte)))) //16 bit MSB if nessesary +#define LDANCER2_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | (0x199 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define LSPARE_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | (0x1a0 * WordOrByte)))) //16 bit MSB if nessesary +#define LSPARE_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | (0x1a1 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define RDANCER_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | (0x1a8 * WordOrByte)))) //16 bit MSB if nessesary +#define RDANCER_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | (0x1a9 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define F1_RSPARE_ROTENC_DATA_p_RX_msb (*((volatile short *)(FPGA1_BASE | (0x1b0 * WordOrByte)))) //16 bit MSB if nessesary +#define F1_RSPARE_ROTENC_DATA_p_RX_lsb (*((volatile short *)(FPGA1_BASE | (0x1b1 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//Test +#define FPGA1_Test (*((volatile short *)(FPGA1_BASE | (0x1f8 * WordOrByte)))) //Readback not -gives the inverse of the written to value + +// * * * * * * * * * * * * * * * * FPGA 2 * * * * * * * * * * * * * * * * // +//Version1 +#define FPGA2_Ver1_D (*((volatile short *)(FPGA2_BASE | (0x0 * WordOrByte)))) //Version of Fpga is held here +#define FPGA2_Ver1_L (*((volatile short *)(FPGA2_BASE | (0x1 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA2_Ver1_M (*((volatile short *)(FPGA2_BASE | (0x2 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Version2 +#define FPGA2_Ver2_D (*((volatile short *)(FPGA2_BASE | (0x8 * WordOrByte)))) //Version of Fpga is held here +#define FPGA2_Ver2_L (*((volatile short *)(FPGA2_BASE | (0x9 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA2_Ver2_M (*((volatile short *)(FPGA2_BASE | (0xa * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_01 Registers +#define F2_GPI_LS1_D (*((volatile short *)(FPGA2_BASE | (0x10 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F2_GPI_LS1_L (*((volatile short *)(FPGA2_BASE | (0x11 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F2_GPI_LS1_M (*((volatile short *)(FPGA2_BASE | (0x12 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_02 Registers +#define F2_GPI_LS2_D (*((volatile short *)(FPGA2_BASE | (0x18 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F2_GPI_LS2_L (*((volatile short *)(FPGA2_BASE | (0x19 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F2_GPI_LS2_M (*((volatile short *)(FPGA2_BASE | (0x1a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI shorterrupt LS_03 Registers +#define F2_GPI_LS3_D (*((volatile short *)(FPGA2_BASE | (0x20 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F2_GPI_LS3_L (*((volatile short *)(FPGA2_BASE | (0x21 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F2_GPI_LS3_M (*((volatile short *)(FPGA2_BASE | (0x22 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Moto_Driver_NBUSY_register1 +#define F2_Moto_Driver_NBUSY1_D (*((volatile short *)(FPGA2_BASE | (0x28 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define F2_Moto_Driver_NBUSY1_L (*((volatile short *)(FPGA2_BASE | (0x29 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define F2_Moto_Driver_NBUSY1_M (*((volatile short *)(FPGA2_BASE | (0x2a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//DISPENSER_VALVE_IN +#define DISPENSER_VALVE_IN_Direct (*((volatile short *)(FPGA2_BASE | (0x030 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define DISPENSER_VALVE_IN_Latched (*((volatile short *)(FPGA2_BASE | (0x031 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define DISPENSER_VALVE_IN_Mask (*((volatile short *)(FPGA2_BASE | (0x032 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//GPI_REGISTER1 +#define GPI_REGISTER1_Direct (*((volatile short *)(FPGA2_BASE | (0x038 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define GPI_REGISTER1_Latched (*((volatile short *)(FPGA2_BASE | (0x039 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define GPI_REGISTER1_Mask (*((volatile short *)(FPGA2_BASE | (0x03A * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//LS_04 +#define LS_04_Direct (*((volatile short *)(FPGA2_BASE | (0x040 * WordOrByte)))) //Version of Fpga is held here +#define LS_04_Latched (*((volatile short *)(FPGA2_BASE | (0x041 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define LS_04_Mask (*((volatile short *)(FPGA2_BASE | (0x042 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//SPI_Busy_register1 +#define SPI_Busy1_Direct (*((volatile short *)(FPGA2_BASE | (0x048 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define SPI_Busy1_Latched (*((volatile short *)(FPGA2_BASE | (0x049 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define SPI_Busy1_Mask (*((volatile short *)(FPGA2_BASE | (0x04a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//SPI_Busy_register2 +#define SPI_Busy2_Direct (*((volatile short *)(FPGA2_BASE | (0x050 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define SPI_Busy2_Latched (*((volatile short *)(FPGA2_BASE | (0x051 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define SPI_Busy2_Mask (*((volatile short *)(FPGA2_BASE | (0x052 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//Moto_Driver_NSTBYRST_register1 +#define F2_Moto_Driver_NSTBYRST1 (*((volatile short *)(FPGA2_BASE | (0x059 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//DISPENSER_VALVE_OUT +#define F2_DISPENSER_VALVE_OUT (*((volatile short *)(FPGA2_BASE | (0x061 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//Moto_Driver_SW_register1 +#define F2_Moto_Driver_SW1 (*((volatile short *)(FPGA2_BASE | (0x069 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//CTRL +#define CTRL (*((volatile short *)(FPGA2_BASE | (0x071 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//GPO_REGISTER +#define GPO_REGISTER (*((volatile short *)(FPGA2_BASE | (0x079 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//SSI +#define DISPENSER_ROTENC_DATA_p_7_RX_msb (*((volatile short *)(FPGA2_BASE | (0x080 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_7_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x081 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define DISPENSER_ROTENC_DATA_p_8_RX_msb (*((volatile short *)(FPGA2_BASE | (0x088 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_8_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x089 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DYEINGH_TEMP1_1 +#define ANALOG_DYEINGH_TEMP1_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x100 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP1_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x101 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP1_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x102 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DYEINGH_TEMP1_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x103 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//AN_ENCLOSURETEMP1_1 +#define AN_ENCLOSURETEMP1_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x108 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP1_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x109 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP1_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x10A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define AN_ENCLOSURETEMP1_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x10B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DYEINGH_TEMP2 +#define ANALOG_DYEINGH_TEMP2_TX_00 (*((volatile short *)(FPGA2_BASE | (0x110 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP2_TX_01 (*((volatile short *)(FPGA2_BASE | (0x111 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP2_RX_00 (*((volatile short *)(FPGA2_BASE | (0x112 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DYEINGH_TEMP2_RX_01 (*((volatile short *)(FPGA2_BASE | (0x113 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//AN_ENCLOSURETEMP2_1 +#define AN_ENCLOSURETEMP2_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x118 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP2_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x119 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP2_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x11A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define AN_ENCLOSURETEMP2_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x11B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DYEINGH_TEMP3 +#define ANALOG_DYEINGH_TEMP3_TX_00 (*((volatile short *)(FPGA2_BASE | (0x120 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP3_TX_01 (*((volatile short *)(FPGA2_BASE | (0x121 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP3_RX_00 (*((volatile short *)(FPGA2_BASE | (0x122 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DYEINGH_TEMP3_RX_01 (*((volatile short *)(FPGA2_BASE | (0x123 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//AN_ENCLOSURETEMP3_1 +#define AN_ENCLOSURETEMP3_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x128 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP3_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x129 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define AN_ENCLOSURETEMP3_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x12A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define AN_ENCLOSURETEMP3_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x12B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DYEINGH_TEMP4 +#define ANALOG_DYEINGH_TEMP4_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x130 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP4_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x131 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP4_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x132 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DYEINGH_TEMP4_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x133 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DRYER_TEMP1 +#define ANALOG_DRYER_TEMP1_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x138 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP1_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x139 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP1_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x13A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DRYER_TEMP1_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x13B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DYEINGH_TEMP5 +#define ANALOG_DYEINGH_TEMP5_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x140 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP5_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x141 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DYEINGH_TEMP5_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x142 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DYEINGH_TEMP5_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x143 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DRYER_TEMP2 +#define ANALOG_DRYER_TEMP2_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x148 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP2_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x149 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP2_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x14A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DRYER_TEMP2_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x14B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_MIXCHIP_TEMP +#define ANALOG_MIXCHIP_TEMP_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x150 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_MIXCHIP_TEMP_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x151 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_MIXCHIP_TEMP_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x152 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_MIXCHIP_TEMP_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x153 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//ANALOG_DRYER_TEMP3 +#define ANALOG_DRYER_TEMP3_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x158 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP3_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x159 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define ANALOG_DRYER_TEMP3_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x15A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define ANALOG_DRYER_TEMP3_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x15B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SSI +#define DISPENSER_ROTENC_DATA_p_1_RX_msb (*((volatile short *)(FPGA2_BASE | (0x160 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_1_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x161 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define DISPENSER_ROTENC_DATA_p_2_RX_msb (*((volatile short *)(FPGA2_BASE | (0x168 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_2_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x169 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define DISPENSER_ROTENC_DATA_p_3_RX_msb (*((volatile short *)(FPGA2_BASE | (0x170 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_3_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x171 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_4_RX_msb (*((volatile short *)(FPGA2_BASE | (0x178 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define DISPENSER_ROTENC_DATA_p_4_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x179 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_5_RX_msb (*((volatile short *)(FPGA2_BASE | (0x180 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define DISPENSER_ROTENC_DATA_p_5_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x181 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_6_RX_msb (*((volatile short *)(FPGA2_BASE | (0x188 * WordOrByte)))) //16 bit MSB if nessesary +#define DISPENSER_ROTENC_DATA_p_6_RX_lsb (*((volatile short *)(FPGA2_BASE | (0x189 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1 +#define MOTO_DISPENSER_A1_1_TX_00 (*((volatile short *)(FPGA2_BASE | (0x190 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_1_TX_01 (*((volatile short *)(FPGA2_BASE | (0x191 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_1_RX_00 (*((volatile short *)(FPGA2_BASE | (0x192 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_1_RX_01 (*((volatile short *)(FPGA2_BASE | (0x193 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_2 +#define MOTO_DISPENSER_A1_2_TX_00 (*((volatile short *)(FPGA2_BASE | (0x198 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_2_TX_01 (*((volatile short *)(FPGA2_BASE | (0x199 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_2_RX_00 (*((volatile short *)(FPGA2_BASE | (0x19A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_2_RX_01 (*((volatile short *)(FPGA2_BASE | (0x19B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_3 +#define MOTO_DISPENSER_A1_3_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1A0 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_3_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1A1 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_3_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1A2 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_3_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1A3 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_4 +#define MOTO_DISPENSER_A1_4_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1A8 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_4_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1A9 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_4_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1AA * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_4_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1AB * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_5 +#define MOTO_DISPENSER_A1_5_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1B0 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_5_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1B1 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_5_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1B2 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_5_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1B3 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_6 +#define MOTO_DISPENSER_A1_6_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1B8 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_6_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1B9 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_6_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1BA * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_6_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1BB * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_7 +#define MOTO_DISPENSER_A1_7_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1C0 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_7_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1C1 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_7_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1C2 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_7_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1C3 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//MOTO_DISPENSER_A1_8 +#define MOTO_DISPENSER_A1_8_TX_00 (*((volatile short *)(FPGA2_BASE | (0x1C8 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_8_TX_01 (*((volatile short *)(FPGA2_BASE | (0x1C9 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_DISPENSER_A1_8_RX_00 (*((volatile short *)(FPGA2_BASE | (0x1CA * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_DISPENSER_A1_8_RX_01 (*((volatile short *)(FPGA2_BASE | (0x1CB * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//Prescaler +#define F2_Prescaler1_reg1 (*((volatile short *)(FPGA2_BASE | (0x1f0 * WordOrByte)))) //Parameter for prescaler divisions +#define F2_Prescaler1_reg2 (*((volatile short *)(FPGA2_BASE | (0x1f1 * WordOrByte)))) //Parameter for prescaler divisions +#define F2_Prescaler1_reg3 (*((volatile short *)(FPGA2_BASE | (0x1f2 * WordOrByte)))) //Parameter for prescaler divisions +#define F2_Prescaler1_reg4 (*((volatile short *)(FPGA2_BASE | (0x1f3 * WordOrByte)))) //Parameter for prescaler divisions +//Test +#define FPGA2_Test (*((volatile short *)(FPGA2_BASE | (0x1f8 * WordOrByte)))) //Readback not - gives the inverse of the written to value + +// * * * * * * * * * * * * * * * * FPGA 3 * * * * * * * * * * * * * * * * // + +//Version1 +#define FPGA3_Ver1_D (*((volatile short *)(FPGA3_BASE | (0x0 * WordOrByte)))) //Version of Fpga is held here +#define FPGA3_Ver1_L (*((volatile short *)(FPGA3_BASE | (0x1 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA3_Ver1_M (*((volatile short *)(FPGA3_BASE | (0x2 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//Version2 +#define FPGA3_Ver2_D (*((volatile short *)(FPGA3_BASE | (0x8 * WordOrByte)))) //Version of Fpga is held here +#define FPGA3_Ver2_L (*((volatile short *)(FPGA3_BASE | (0x9 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define FPGA3_Ver2_M (*((volatile short *)(FPGA3_BASE | (0xa * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//GPI 01 +#define GPI_01_D (*((volatile short *)(FPGA3_BASE | (0x10 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define GPI_01_L (*((volatile short *)(FPGA3_BASE | (0x11 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define GPI_01_M (*((volatile short *)(FPGA3_BASE | (0x12 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 + +//MIDTANK 01 +#define MIDTANK_01_Direct (*((volatile short *)(FPGA3_BASE | (0x018 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define MIDTANK_01_Latched (*((volatile short *)(FPGA3_BASE | (0x019 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define MIDTANK_01_Mask (*((volatile short *)(FPGA3_BASE | (0x01a * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//MIDTANK 02 +#define MIDTANK_02_Direct (*((volatile short *)(FPGA3_BASE | (0x020 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define MIDTANK_02_Latched (*((volatile short *)(FPGA3_BASE | (0x021 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define MIDTANK_02_Mask (*((volatile short *)(FPGA3_BASE | (0x022 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//DISPENSER_ROTENC_IN +#define DISPENSER_ROTENC_IN_Direct (*((volatile short *)(FPGA3_BASE | (0x028 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define DISPENSER_ROTENC_IN_Latched (*((volatile short *)(FPGA3_BASE | (0x029 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define DISPENSER_ROTENC_IN_Mask (*((volatile short *)(FPGA3_BASE | (0x02A * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//Moto_Driver_NBUSY_register1 +#define Moto_Driver_NBUSY1_Direct (*((volatile short *)(FPGA3_BASE | (0x030 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define Moto_Driver_NBUSY1_Latched (*((volatile short *)(FPGA3_BASE | (0x031 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define Moto_Driver_NBUSY1_Mask (*((volatile short *)(FPGA3_BASE | (0x032 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//CARTx_PRES +#define CARTx_PRES_02_Direct (*((volatile short *)(FPGA3_BASE | (0x038 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define CARTx_PRES_02_Latched (*((volatile short *)(FPGA3_BASE | (0x039 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define CARTx_PRES_02_Mask (*((volatile short *)(FPGA3_BASE | (0x03A * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//LS_01 +#define LS_01_Direct (*((volatile short *)(FPGA3_BASE | (0x040 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define LS_01_Latched (*((volatile short *)(FPGA3_BASE | (0x041 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define LS_01_Mask (*((volatile short *)(FPGA3_BASE | (0x042 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//Spi_Busy_01 +#define busy_01_Direct (*((volatile short *)(FPGA3_BASE | (0x050 * WordOrByte)))) //Reads the direct values that are currently being sent to the fpga. +#define busy_01_Latched (*((volatile short *)(FPGA3_BASE | (0x051 * WordOrByte)))) //Value of the latched shorterrupts that have occurred +#define busy_01_Mask (*((volatile short *)(FPGA3_BASE | (0x052 * WordOrByte)))) //Value of the shorterrupt mask, Default is 0x0000 +//Moto_Driver_NSTBYRST_register1 +#define F3_Moto_Driver_NSTBYRST1 (*((volatile short *)(FPGA3_BASE | (0x059 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//GPO_01 +#define /*F3_DISPENSER_VALVE_OUT*/GPO_01 (*((volatile short *)(FPGA3_BASE | (0x061 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//Moto_Driver_SW_register1 +#define F3_Moto_Driver_SW1 (*((volatile short *)(FPGA3_BASE | (0x069 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//VALVE_OUT +#define VALVE_OUT (*((volatile short *)(FPGA3_BASE | (0x071 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//DISPENSER_ROTENC_OUT +#define DISPENSER_ROTENC_OUT (*((volatile short *)(FPGA3_BASE | (0x079 * WordOrByte)))) //Writes to values. Readback thevaluessthat are currently in the GPO register +//QEI_SCREW_ROTENC +#define SPARE1_ROTENC_lsb (*((volatile short *)(FPGA3_BASE | (0x080 * WordOrByte)))) //Value of the lsb of the QEI register +#define SPARE1_ROTENC_msb (*((volatile short *)(FPGA3_BASE | (0x081 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define SPARE1_ROTENC_index (*((volatile short *)(FPGA3_BASE | (0x082 * WordOrByte)))) //value of index counter +//QEI_RSPARE_ROTENC +#define RSPARE_ROTENC_lsb (*((volatile short *)(FPGA3_BASE | (0x088 * WordOrByte)))) //Value of the lsb of the QEI register +#define RSPARE_ROTENC_msb (*((volatile short *)(FPGA3_BASE | (0x089 * WordOrByte)))) //10bits Value of the Msb of the QEI register, 1bit Direction of movement, 5bits Reserved +#define RSPARE_ROTENC_index (*((volatile short *)(FPGA3_BASE | (0x08a * WordOrByte)))) //value of index counter +//SPI_MOTO_RLOADING_A1 +#define MOTO_SPARE1_1_A1_TX_00 (*((volatile short *)(FPGA3_BASE | (0x100 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE1_1_A1_TX_01 (*((volatile short *)(FPGA3_BASE | (0x101 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE1_1_A1_RX_00 (*((volatile short *)(FPGA3_BASE | (0x102 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_SPARE1_1_A1_RX_01 (*((volatile short *)(FPGA3_BASE | (0x103 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_MOTO_RDRIVING_A1 +#define MOTO_SPARE1_2_A1_TX_00 (*((volatile short *)(FPGA3_BASE | (0x108 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE1_2_A1_TX_01 (*((volatile short *)(FPGA3_BASE | (0x109 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE1_2_A1_RX_00 (*((volatile short *)(FPGA3_BASE | (0x10A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_SPARE1_2_A1_RX_01 (*((volatile short *)(FPGA3_BASE | (0x10B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_LDRIVING_A1 +#define MOTO_SPARE2_1_A1_TX_00 (*((volatile short *)(FPGA3_BASE | (0x110 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE2_1_A1_TX_01 (*((volatile short *)(FPGA3_BASE | (0x111 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE2_1_A1_RX_00 (*((volatile short *)(FPGA3_BASE | (0x112 * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_SPARE2_1_A1_RX_01 (*((volatile short *)(FPGA3_BASE | (0x113 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SPI_F1_MOTO_LLOADING_A1 +#define MOTO_SPARE2_2_A1_TX_00 (*((volatile short *)(FPGA3_BASE | (0x118 * WordOrByte)))) //The second register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE2_2_A1_TX_01 (*((volatile short *)(FPGA3_BASE | (0x119 * WordOrByte)))) //The first register to be shifted out of the spi. The msb bit of this register is shifted out first. +#define MOTO_SPARE2_2_A1_RX_00 (*((volatile short *)(FPGA3_BASE | (0x11A * WordOrByte)))) //The 8 msb bits of the shifted in bits. The 8 msb bits of this register are zeros. +#define MOTO_SPARE2_2_A1_RX_01 (*((volatile short *)(FPGA3_BASE | (0x11B * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//SSI +#define SPARE1_ROTENC_DATA_p_1_RX_msb (*((volatile short *)(FPGA3_BASE | (0x160 * WordOrByte)))) //16 bit MSB if nessesary +#define SPARE1_ROTENC_DATA_p_1_RX_lsb (*((volatile short *)(FPGA3_BASE | (0x161 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +#define SPARE2_ROTENC_DATA_p_2_RX_msb (*((volatile short *)(FPGA3_BASE | (0x168 * WordOrByte)))) //16 bit MSB if nessesary +#define SPARE2_ROTENC_DATA_p_2_RX_lsb (*((volatile short *)(FPGA3_BASE | (0x169 * WordOrByte)))) //The 16 Lsb bits of the shifted in data. +//Prescaler +#define F3_Prescaler1_reg1 (*((volatile short *)(FPGA3_BASE | (0x1f0 * WordOrByte)))) //Parameter for prescaler divisions +#define F3_Prescaler1_reg2 (*((volatile short *)(FPGA3_BASE | (0x1f1 * WordOrByte)))) //Parameter for prescaler divisions +#define F3_Prescaler1_reg3 (*((volatile short *)(FPGA3_BASE | (0x1f2 * WordOrByte)))) //Parameter for prescaler divisions +#define F3_Prescaler1_reg4 (*((volatile short *)(FPGA3_BASE | (0x1f3 * WordOrByte)))) //Parameter for prescaler divisions +//Test +#define FPGA3_Test (*((volatile short *)(FPGA3_BASE | (0x1f8 * WordOrByte)))) //Readback not - gives the inverse of the written to value + +//1 Version1_Direct +typedef union +{ + struct + { + unsigned char Month; //0-7 + unsigned char Day; //8-15 + }bytes; + unsigned short ushort; +}VER1; + +//4 Version2_Direct +typedef union +{ + struct + { + unsigned char Ver_num; //0-7 + unsigned char Year; //8-15 + }bytes; + unsigned short ushort; +}VER2; + +//16 Moto_Driver_NBUSY_register1 +typedef union +{ + struct + { + bool F1_MOTO_LPIVOT1_A1_NBUSY : 1; //0 + bool F1_MOTO_LLOADING_A1_NBUSY : 1; //1 + bool F1_MOTO_LDRIVING_A1_NBUSY : 1; //2 + bool F1_MOTO_LDANCER2_A1_NBUSY : 1; //3 + bool F1_MOTO_LDANCER1_A1_NBUSY : 1; //4 + bool F1_MOTO_DRYER_LOADARM_A1_NBUSY : 1; //5 + bool F1_MOTO_DRYER_LID_A1_NBUSY : 1; //6 + bool F1_MOTO_DRYER_DRIVING_A1_NBUSY : 1; //7 + bool F1_MOTO_DH_LID_A1_NBUSY : 1; //8 + bool F1_MOTO_DH_CLEANMECH_A1_NBUSY : 1; //9 + bool F1_MOTO_DH_CLEANHEAD_A1_NBUSY : 1; //10 + unsigned char RESERVE:5; //11-15 + }bits; + unsigned short ushort; +}Mot_NBUSY1; + +//19 Moto_Driver_NBUSY_register2 +typedef union +{ + struct + { + bool F1_MOTO_WINDER_A1_NBUSY : 1; //0 + bool F1_MOTO_SCREW_A1_NBUSY : 1; //1 + bool F1_MOTO_RLOADING_A1_NBUSY : 1; //2 + bool F1_MOTO_RLOADARM_A1_NBUSY : 1; //3 + bool F1_MOTO_RDRIVING_A1_NBUSY : 1; //4 + bool F1_MOTO_RDANCER_A1_NBUSY : 1; //5 + unsigned char RESERVE1 : 2; // 6-7 + unsigned char RESERVE2; // 8-15 + }bits; + unsigned short ushort; +}Mot_NBUSY2; + + +//29 + 32 SPI_Busy_register1 + SPI_Busy_register2 +typedef union +{ + struct + { + unsigned char SPI_Busy_1_D; + unsigned char SPI_Busy_2_D; + }ushort; + unsigned int uint; +}SPI_BUSY; + +//35 Moto_Driver_NSTBYRST1 +typedef union +{ + struct + { + bool LPIVOT1 : 1; //0 + bool LLOADING : 1; //1 + bool LDRIVING : 1; //2 + bool LDANCER2 : 1; //3 + bool LDANCER1 : 1; //4 + bool DRYER_LOADARM : 1; //5 + bool DRYER_LID : 1; //6 + bool DRYER_DRIVING : 1; //7 + bool DH_LID : 1; //8 + bool DH_CLEANMECH : 1; //9 + bool DH_CLEANHEAD : 1; //10 + unsigned char RESERVE:5; //11-15 + }bits; + unsigned short ushort; +}MOT_NSTBYRST1; + + + +//36 Moto_Driver_NSTBYRST2 +typedef union +{ + struct + { + bool WINDER : 1; //0 + bool SCREW : 1; //1 + bool RLOADING : 1; //2 + bool RLOADARM : 1; //3 + bool RDRIVING : 1; //4 + bool RDANCER : 1; //5 + unsigned char RESERVE1:2; // 6-7 + unsigned char RESERVE2; // 8-15 + }bits; + unsigned short ushort; +}MOT_NSTBYRST2; + +//37 Moto_Driver_SW_register1 - Moto_Driver_SW1 +typedef union +{ + struct + { + bool LPIVOT1 : 1; //0 + bool LLOADING : 1; //1 + bool LDRIVING : 1; //2 + bool LDANCER2 : 1; //3 + bool LDANCER1 : 1; //4 + bool DRYER_LOADARM : 1; //5 + bool DRYER_LID : 1; //6 + bool DRYER_DRIVING; //7 + bool DH_LID : 1; //8 + bool DH_CLEANMECH : 1; //9 + bool DH_CLEANHEAD : 1; //10 + bool GPO_TFEED_BREAK_1 : 1; //11 + bool GPO_TFEED_BREAK_2 : 1; //12 + unsigned char RESERVE:3; // 13-15 + }bits; + unsigned short ushort; +}MOT_SW1; + +//38 Moto_Driver_SW_register2 - Moto_Driver_SW2 +typedef union +{ + struct + { + bool F1_MOTO_WINDER_A1_SW : 1; //0 + bool F1_MOTO_SCREW_A1_SW : 1; //1 + bool F1_MOTO_RLOADING_A1_SW : 1; //2 + bool F1_MOTO_RLOADARM_A1_SW : 1; //3 + bool F1_MOTO_RDRIVING_A1_SW : 1; //4 + bool F1_MOTO_RDANCER_A1_SW : 1; //5 + unsigned char RESERVE1:2; // 6-7 + unsigned char RESERVE2; // 8-15 + }bits; + unsigned short ushort; +}MOT_SW2; + + + +//308 GPO_01 +typedef union +{ + struct + { + bool F3_GPO_LED4 : 1; //0 + bool F3_GPO_LED3 : 1; //1 + bool F3_GPO_LED2 : 1; //2 + bool F3_GPO_LED1 : 1; //3 + bool F3_GPO_EXTWINDER_SSR11_CTRL : 1; //4 + bool F3_GPO_BUZZER : 1; //4 + bool F3_SPARE2_ROTENC_CLK : 1; //6 + bool F3_SPARE1_ROTENC_CLK : 1; //7 + unsigned char RESERVE; // 8-15 + }bits; + unsigned short ushort; +}GP_Out_01; + + + +//------------------------------ MOTOR DRIVER L_6470 ------------------------------ + +typedef union +{ + struct + { + unsigned short LSB; + unsigned short MSB; + }ushort; + unsigned int uint; +}INT2SHORT;//16->32 + +enum +{ + RLOADING, + RDRIVING, + F1_LDRIVING, + F1_LLOADING, + F1_DRYER_LOADARM, + F1_DRYER_DRIVING, + F1_DH_CLEANHEAD, + F1_DH_CLEANMECH, + F1_SCREW, + F1_WINDER, + RLOADARM, + RDANCER, + LDANCER1, + LDANCER2, + DRYER_LID, + DH_LID, + LPIVOT1, +}SPI_TYPE; + +//SPI +typedef struct //S_SPI +{ + unsigned char Type; + unsigned int TX_MOSI; //32bit (Master Output Slave Input ) + unsigned int RX_MISO; //24bit (Master Input Slave Output) + //unsigned int BUSY; //32bit + +}SPI;//SPI + +/* +#define L6470_MOSI (*((volatile short *)(BASE | 0x0100))) +#define L6470_MISO (*((volatile short *)(BASE | 0x0200))) +#define L6470_CS (*((volatile short *)(BASE | 0x0300))) +#define L6470_CLK (*((volatile short *)(BASE | 0x0400))) +#define L6470_BUSY (*((volatile short *)(BASE | 0x0500))) +#define L6470_RESET (*((volatile short *)(BASE | 0x0600))) +#define L6470_TX (*((volatile char *)(BASE | 0x0700))) +#define L6470_RX (*((volatile char *)(BASE | 0x0800))) +*/ + +//L6470_MOSI = 0x00; diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_SPI_Comm.c b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_SPI_Comm.c new file mode 100644 index 000000000..11e9231c7 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/FPGA_SPI_Comm.c @@ -0,0 +1,281 @@ + +#include <stdint.h> +#include <stdbool.h> +#include <drivers/FPGA/FPGA_Comm.h> +#include "Stubs_Handler/DataDef.h" + +uint8_t SPI_Transnit(SPI Spi) +{ + + INT2SHORT Int2Short; + + //Check Busy register and see if the SPI desired is available + while((SPI_Busy1_D != NOTBUSY ) || (SPI_Busy2_D != NOTBUSY )); + + Int2Short.uint = Spi.TX_MOSI; + + switch(Spi.Type) + { + case RLOADING: + MOTO_RLOADING_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_RLOADING_A1_TX_01); + + //Send a write to TX_00 + MOTO_RLOADING_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_RLOADING_A1_TX_00); + break; + case RDRIVING: + MOTO_RDRIVING_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_RDRIVING_A1_TX_01); + + //Send a write to TX_00 + MOTO_RDRIVING_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_RDRIVING_A1_TX_00); + break; + case F1_LDRIVING: + MOTO_LDRIVING_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_LDRIVING_A1_TX_01); + + //Send a write to TX_00 + MOTO_LDRIVING_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_LDRIVING_A1_TX_00); + break; + case F1_LLOADING: + MOTO_LLOADING_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_LLOADING_A1_TX_01); + + //Send a write to TX_00 + MOTO_LLOADING_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_LLOADING_A1_TX_00); + break; + case F1_DRYER_LOADARM: + MOTO_DRYER_LOADARM_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DRYER_LOADARM_A1_TX_01); + + //Send a write to TX_00 + MOTO_DRYER_LOADARM_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DRYER_LOADARM_A1_TX_00); + break; + case F1_DRYER_DRIVING: + MOTO_DRYER_DRIVING_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DRYER_DRIVING_A1_TX_01); + + //Send a write to TX_00 + MOTO_DRYER_DRIVING_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DRYER_DRIVING_A1_TX_00); + break; + case F1_DH_CLEANHEAD: + MOTO_DH_CLEANHEAD_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DH_CLEANHEAD_A1_TX_01); + + //Send a write to TX_00 + MOTO_DH_CLEANHEAD_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DH_CLEANHEAD_A1_TX_00); + break; + case F1_DH_CLEANMECH: + MOTO_DH_CLEANMECH_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DH_CLEANMECH_A1_TX_01); + + //Send a write to TX_00 + MOTO_DH_CLEANMECH_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DH_CLEANMECH_A1_TX_00); + break; + case F1_SCREW: + MOTO_SCREW_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_SCREW_A1_TX_01); + + //Send a write to TX_00 + MOTO_SCREW_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_SCREW_A1_TX_00); + break; + case F1_WINDER: + MOTO_WINDER_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_WINDER_A1_TX_01); + + //Send a write to TX_00 + MOTO_WINDER_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_WINDER_A1_TX_00); + break; + case RLOADARM: + MOTO_RLOADARM_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_RLOADARM_A1_TX_01); + + //Send a write to TX_00 + MOTO_RLOADARM_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_RLOADARM_A1_TX_00); + break; + case RDANCER: + MOTO_RDANCER_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_RDANCER_A1_TX_01); + + //Send a write to TX_00 + MOTO_RDANCER_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_RDANCER_A1_TX_00); + break; + case LDANCER1: + MOTO_LDANCER1_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_LDANCER1_A1_TX_01); + + //Send a write to TX_00 + MOTO_LDANCER1_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_LDANCER1_A1_TX_00); + break; + case LDANCER2: + MOTO_LDANCER2_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_LDANCER2_A1_TX_01); + + //Send a write to TX_00 + MOTO_LDANCER2_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_LDANCER2_A1_TX_00); + break; + case DRYER_LID: + MOTO_DRYER_LID_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DRYER_LID_A1_TX_01); + + //Send a write to TX_00 + MOTO_DRYER_LID_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DRYER_LID_A1_TX_00); + break; + case DH_LID: + MOTO_DH_LID_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_DH_LID_A1_TX_01); + + //Send a write to TX_00 + MOTO_DH_LID_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_DH_LID_A1_TX_00); + break; + case LPIVOT1: + MOTO_LPIVOT1_A1_TX_01 = Int2Short.ushort.MSB; + //Read the TX_01 register and make sure that the value was written properly. + while( Int2Short.ushort.MSB != MOTO_LPIVOT1_A1_TX_01); + + //Send a write to TX_00 + MOTO_LPIVOT1_A1_TX_00 = Int2Short.ushort.LSB; + //Read the TX_00 register and make sure that the value was written properly. + while( Int2Short.ushort.LSB != MOTO_LPIVOT1_A1_TX_00); + break; + default: + break; + } + + return 0; +} + +uint8_t SPI_Receive (SPI Spi) +{ + + INT2SHORT Int2Short; + + //Check busy before trying to read RX registers. + while((SPI_Busy1_D != NOTBUSY ) || (SPI_Busy2_D != NOTBUSY )); + + switch(Spi.Type) + { + case RLOADING: + Int2Short.ushort.LSB = MOTO_RLOADING_A1_RX_00; + Int2Short.ushort.MSB = MOTO_RLOADING_A1_RX_01; + break; + case RDRIVING: + Int2Short.ushort.LSB = MOTO_RDRIVING_A1_RX_00; + Int2Short.ushort.MSB = MOTO_RDRIVING_A1_RX_01; + break; + case F1_LDRIVING: + Int2Short.ushort.LSB = MOTO_LDRIVING_A1_RX_00; + Int2Short.ushort.MSB = MOTO_LDRIVING_A1_RX_01; + break; + case F1_LLOADING: + Int2Short.ushort.LSB = MOTO_LLOADING_A1_RX_00; + Int2Short.ushort.MSB = MOTO_LLOADING_A1_RX_01; + break; + case F1_DRYER_LOADARM: + Int2Short.ushort.LSB = MOTO_DRYER_LOADARM_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DRYER_LOADARM_A1_RX_01; + break; + case F1_DRYER_DRIVING: + Int2Short.ushort.LSB = MOTO_DRYER_DRIVING_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DRYER_DRIVING_A1_RX_01; + break; + case F1_DH_CLEANHEAD: + Int2Short.ushort.LSB = MOTO_DH_CLEANHEAD_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DH_CLEANHEAD_A1_RX_01; + break; + case F1_DH_CLEANMECH: + Int2Short.ushort.LSB = MOTO_DH_CLEANMECH_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DH_CLEANMECH_A1_RX_01; + break; + case F1_SCREW: + Int2Short.ushort.LSB = MOTO_SCREW_A1_RX_00; + Int2Short.ushort.MSB = MOTO_SCREW_A1_RX_01; + break; + case F1_WINDER: + Int2Short.ushort.LSB = MOTO_WINDER_A1_RX_00; + Int2Short.ushort.MSB = MOTO_WINDER_A1_RX_01; + break; + case RLOADARM: + Int2Short.ushort.LSB = MOTO_RLOADARM_A1_RX_00; + Int2Short.ushort.MSB = MOTO_RLOADARM_A1_RX_01; + break; + case RDANCER: + Int2Short.ushort.LSB = MOTO_RDANCER_A1_RX_00; + Int2Short.ushort.MSB = MOTO_RDANCER_A1_RX_01; + break; + case LDANCER1: + Int2Short.ushort.LSB = MOTO_LDANCER1_A1_RX_00; + Int2Short.ushort.MSB = MOTO_LDANCER1_A1_RX_01; + break; + case LDANCER2: + Int2Short.ushort.LSB = MOTO_LDANCER2_A1_RX_00; + Int2Short.ushort.MSB = MOTO_LDANCER2_A1_RX_01; + break; + case DRYER_LID: + Int2Short.ushort.LSB = MOTO_DRYER_LID_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DRYER_LID_A1_RX_01; + break; + case DH_LID: + Int2Short.ushort.LSB = MOTO_DH_LID_A1_RX_00; + Int2Short.ushort.MSB = MOTO_DH_LID_A1_RX_01; + break; + case LPIVOT1: + Int2Short.ushort.LSB = MOTO_LPIVOT1_A1_RX_00; + Int2Short.ushort.MSB = MOTO_LPIVOT1_A1_RX_01; + break; + default: + break; + } + + Spi.RX_MISO = Int2Short.uint; + + return 0; +} diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.c b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.c new file mode 100644 index 000000000..0a648ea31 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.c @@ -0,0 +1,706 @@ +/* +* cL6470.cpp +* +* Created: 6/22/2016 8:41:00 PM +* Author: Atif +*/ +#include "graphics_adapter.h" +#include <stdint.h> +#include <stdbool.h> +#include <drivers/FPGA/FPGA_Comm.h> +#include "Stubs_Handler/DataDef.h" + +#include "drivers/SPI/SPI_Comm.h" +#include "inc/hw_memmap.h" + + + + + +////////////// +//#include "stdafx.h" +#include "L6470.h" +//#include "FPGA_Comm.h" +// To use time library of C +#include <time.h> + +//int volatile * const MOSI_Reg = (int *)MOSI_BASE; +//int volatile * const MISO_Reg = (int *)MISO_BASE; +//int volatile * const CS_Reg = (int *)CS_BASE; +//int volatile * const CLK_Reg = (int *)CLK_BASE; +//int volatile * const BUSY_Reg = (int *)BUSY_BASE; +//int volatile * const RESET_Reg = (int *)RESET_BASE; +//char volatile * const TX_Reg = (char *)TX_BASE; +//char volatile * const RX_Reg = (char *)RX_BASE; + + + + +//void cL6470(int MOSI, int MISO, int CS, int CLK, int BUSY, int RESET) +//{ +// _Set_MISO(MISO); +// _Set_MOSI(MOSI); +// _Set_CS(CS); +// _Set_CLK(CLK); +// _Set_BUSY(BUSY); +// _Set_RESET(RESET); +// +//} +/* +void delay(int number_of_seconds) +{ + // Converting time into milli_seconds + int milli_seconds = 1000 * number_of_seconds; + + // Stroing start time + clock_t start_time = clock(); + + // looping till required time is not acheived + while (clock() < start_time + milli_seconds); +} +*/ + +/* +void init() +{ + //pinMode(_CS, OUTPUT); + //digitalWrite(_CS, HIGH); + L6470_CS = HIGH; + //pinMode(_MOSI, OUTPUT); + //pinMode(_MISO, INPUT); + //pinMode(_CLK, OUTPUT); + //pinMode(_BUSY, INPUT); + //pinMode(_RESET, OUTPUT); + + //digitalWrite(_RESET, HIGH); + L6470_RESET = HIGH; + //AVI : TODO add deley + delay(1); + //digitalWrite(_RESET, LOW); + L6470_RESET = LOW; + delay(1); + //digitalWrite(_RESET, HIGH); + L6470_RESET = HIGH; + delay(1); + + //SPI.begin(); + //SPI.setBitOrder(MSBFIRST); + //SPI.setClockDivider(SPI_CLOCK_DIV16); // or 2, 8, 16, 32, 64 + //SPI.setDataMode(SPI_MODE3); +} +*/ + +void SetParam(byte param, unsigned long value) +{ + Data_To_Transfer(x_SET_PARAM | param); + ParamHandler(param, value); +} + + +unsigned long GetParam(byte param) +{ + Data_To_Transfer(x_GET_PARAM | param); + return ParamHandler(param, 0); +} + +// Enable or disable the low-speed optimization option. If enabling, +// the other 12 bits of +void SetLSPDOpt(boolean enable) +{ + Data_To_Transfer(x_SET_PARAM | x_MIN_SPEED); + + if (enable) + Param(0x1000, 13); + else + Param(0, 13); +} + +// RUN sets the motor spinning in a direction (defined by the constants +// FWD and REV). Maximum speed and minimum speed are defined +// by the MAX_SPEED and MIN_SPEED registers; exceeding the FS_SPD value +// will switch the device into full-step mode. +// The SpdCalc() function is provided to convert steps/s values into +// appropriate integer values for this function. +void Run(byte dir, unsigned long spd) +{ + Data_To_Transfer(x_RUN | dir); + if (spd > 0xFFFFF) spd = 0xFFFFF; + Data_To_Transfer((byte)((spd >> 16)&0xFF)); + Data_To_Transfer((byte)((spd >> 8)&0xFF)); + Data_To_Transfer((byte)((spd)&0xFF)); +} +byte Write_Byte(uint8_t WByte); +void Run_tx_test(byte dir, unsigned long spd) +{ + uint32_t temp = 0; + uint32_t rx = 0; + + temp = Write_Byte(x_RUN | dir); + rx |= (temp & 0xFF) << 24; + + temp = Write_Byte((spd >> 16)&0xFF); + rx |= (temp & 0xFF) << 16; + + temp = Write_Byte((spd >> 8)&0xFF); + rx |= (temp & 0xFF) << 8; + + temp = Write_Byte((spd)&0xFF); + rx |= temp & 0xFF; + + //return rx; +} + +// STEP_CLOCK puts the device in external step clocking mode. When active, +// pin 25, STCK, becomes the step clock for the device, and steps it in +// the direction (set by the FWD and REV constants) imposed by the call +// of this function. Motion commands (RUN, MOVE, etc) will cause the device +// to exit step clocking mode. +void Step_Clock(byte dir) +{ + Data_To_Transfer(x_STEP_CLOCK | dir); +} + +// MOVE will send the motor n_step steps (size based on step mode) in the +// direction imposed by dir (FWD or REV constants may be used). The motor +// will accelerate according the acceleration and deceleration curves, and +// will run at MAX_SPEED. Stepping mode will adhere to FS_SPD value, as well. +void Move(byte dir, unsigned long n_step) +{ + Data_To_Transfer(x_MOVE | dir); + if (n_step > 0x3FFFFF) n_step = 0x3FFFFF; + Data_To_Transfer((byte)(n_step >> 16)); + Data_To_Transfer((byte)(n_step >> 8)); + Data_To_Transfer((byte)(n_step)); +} + +// GOTO operates much like MOVE, except it produces absolute motion instead +// of relative motion. The motor will be moved to the indicated position +// in the shortest possible fashion. +void GoTo(unsigned long pos) +{ + + Data_To_Transfer(x_GOTO); + if (pos > 0x3FFFFF) pos = 0x3FFFFF; + Data_To_Transfer((byte)(pos >> 16)); + Data_To_Transfer((byte)(pos >> 8)); + Data_To_Transfer((byte)(pos)); +} + +// Same as GOTO, but with user constrained rotational direction. +void GoTo_DIR(byte dir, unsigned long pos) +{ + + Data_To_Transfer(x_GOTO_DIR); + if (pos > 0x3FFFFF) pos = 0x3FFFFF; + Data_To_Transfer((byte)(pos >> 16)); + Data_To_Transfer((byte)(pos >> 8)); + Data_To_Transfer((byte)(pos)); +} + +// GoUntil will set the motor running with direction dir (REV or +// FWD) until a falling edge is detected on the SW pin. Depending +// on bit SW_MODE in CONFIG, either a hard stop or a soft stop is +// performed at the falling edge, and depending on the value of +// act (either RESET or COPY) the value in the ABS_POS register is +// either RESET to 0 or COPY-ed into the MARK register. +void GoUntil(byte act, byte dir, unsigned long spd) +{ + Data_To_Transfer(x_GO_UNTIL | act | dir); + if (spd > 0x3FFFFF) spd = 0x3FFFFF; + Data_To_Transfer((byte)(spd >> 16)); + Data_To_Transfer((byte)(spd >> 8)); + Data_To_Transfer((byte)(spd)); +} + +// Similar in nature to GoUntil, ReleaseSW produces motion at the +// higher of two speeds: the value in MIN_SPEED or 5 steps/s. +// The motor continues to run at this speed until a rising edge +// is detected on the switch input, then a hard stop is performed +// and the ABS_POS register is either COPY-ed into MARK or RESET to +// 0, depending on whether RESET or COPY was passed to the function +// for act. +void ReleaseSW(byte act, byte dir) +{ + Data_To_Transfer(x_RELEASE_SW | act | dir); +} + +// GoHome is equivalent to GoTo(0), but requires less time to send. +// Note that no direction is provided; motion occurs through shortest +// path. If a direction is required, use GoTo_DIR(). +void GoHome() +{ + Data_To_Transfer(x_GO_HOME); +} + +// GoMark is equivalent to GoTo(MARK), but requires less time to send. +// Note that no direction is provided; motion occurs through shortest +// path. If a direction is required, use GoTo_DIR(). +void GoMark() +{ + Data_To_Transfer(x_GO_MARK); +} + +// Sets the ABS_POS register to 0, effectively declaring the current +// position to be "HOME". +void ResetPos() +{ + byte value = x_RESET_POS; + Data_To_Transfer(value); +} + +// Reset device to power up conditions. Equivalent to toggling the STBY +// pin or cycling power. +void ResetDev() +{ + byte value = x_RESET_DEVICE; + Data_To_Transfer(value); +} + +// Bring the motor to a halt using the deceleration curve. +void SoftStop() +{ + byte value = x_SOFT_STOP; + Data_To_Transfer(value); +} + +// Stop the motor with infinite deceleration. +void HardStop() +{ + byte value = x_HARD_STOP; + Data_To_Transfer(value); +} + +// Decelerate the motor and put the bridges in Hi-Z state. +void SoftHiZ() +{ + byte value = x_SOFT_HIZ; + Data_To_Transfer(value); +} + +// Put the bridges in Hi-Z state immediately with no deceleration. +void HardHiZ() +{ + byte value = x_HARD_HIZ; + Data_To_Transfer(value); +} + +// Fetch and return the 16-bit value in the STATUS register. Resets +// any warning flags and exits any error states. Using GetParam() +// to read STATUS does not clear these values. +int GetStatus() +{ + int temp = 0; + Data_To_Transfer(x_GET_STATUS); + temp = Data_To_Transfer(0) << 8; + temp |= Data_To_Transfer(0); + return temp; +} + + + + +unsigned long AccCalc(float stepsPerSecPerSec) +{ + float temp = (float)(stepsPerSecPerSec * 0.137438); + if ( ((unsigned long) ( (long)(temp) )) > 0x00000FFF ) + return 0x00000FFF; + else return (unsigned long) (long)(temp); +} + +// The calculation for DEC is the same as for ACC. Value is 0x08A on boot. +// This is a 12-bit value, so we need to make sure the value is at or below 0xFFF. +unsigned long DecCalc(float stepsPerSecPerSec) +{ + float temp = (float)(stepsPerSecPerSec * 0.137438); + if ((unsigned long) (long)(temp) > 0x00000FFF) return 0x00000FFF; + else return (unsigned long) (long)(temp); +} + +// The value in the MAX_SPD register is [(steps/s)*(tick)]/(2^-18) where tick is +// 250ns (datasheet value)- 0x041 on boot. +// Multiply desired steps/s by .065536 to get an appropriate value for this register +// This is a 10-bit value, so we need to make sure it remains at or below 0x3FF +unsigned long MaxSpdCalc(float stepsPerSec) +{ + float temp = (float)(stepsPerSec * .065536); + if ((unsigned long) (long)(temp) > 0x000003FF) return 0x000003FF; + else return (unsigned long) (long)(temp); +} + +// The value in the MIN_SPD register is [(steps/s)*(tick)]/(2^-24) where tick is +// 250ns (datasheet value)- 0x000 on boot. +// Multiply desired steps/s by 4.1943 to get an appropriate value for this register +// This is a 12-bit value, so we need to make sure the value is at or below 0xFFF. +unsigned long MinSpdCalc(float stepsPerSec) +{ + float temp = (float)(stepsPerSec * 4.1943); + if ((unsigned long) (long)(temp) > 0x00000FFF) return 0x00000FFF; + else return (unsigned long) (long)(temp); +} + +// The value in the FS_SPD register is ([(steps/s)*(tick)]/(2^-18))-0.5 where tick is +// 250ns (datasheet value)- 0x027 on boot. +// Multiply desired steps/s by .065536 and subtract .5 to get an appropriate value for this register +// This is a 10-bit value, so we need to make sure the value is at or below 0x3FF. +unsigned long FSCalc(float stepsPerSec) +{ + float temp = (float)((stepsPerSec * .065536) - .5); + if ((unsigned long) (long)(temp) > 0x000003FF) return 0x000003FF; + else return (unsigned long) (long)(temp); +} + +// The value in the INT_SPD register is [(steps/s)*(tick)]/(2^-24) where tick is +// 250ns (datasheet value)- 0x408 on boot. +// Multiply desired steps/s by 4.1943 to get an appropriate value for this register +// This is a 14-bit value, so we need to make sure the value is at or below 0x3FFF. +unsigned long IntSpdCalc(float stepsPerSec) +{ + float temp = (float)(stepsPerSec * 4.1943); + if ((unsigned long) (long)(temp) > 0x00003FFF) return 0x00003FFF; + else return (unsigned long) (long)(temp); +} + +// When issuing RUN command, the 20-bit speed is [(steps/s)*(tick)]/(2^-28) where tick is +// 250ns (datasheet value). +// Multiply desired steps/s by 67.106 to get an appropriate value for this register +// This is a 20-bit value, so we need to make sure the value is at or below 0xFFFFF. +uint32_t SpdCalc(float stepsPerSec)// for run request +{ + /*float temp = (float)(stepsPerSec * 67.106); + if ((unsigned long) (long)(temp) > 0x000FFFFF) return 0x000FFFFF; + else return (unsigned long)temp;*/ + uint32_t temp = 67106 * stepsPerSec; + uint32_t stepspertick = temp/1000 ; + if(stepspertick > 0xFFFFF) + stepspertick = 0xFFFFF; + return stepspertick; +} +float CurrentSpdCalc(uint32_t stepspertick)// for Speed response +{ + /*float temp = (float)(stepspertick); + float stepsPerSec = (float)(temp / 67.106); + if(stepsPerSec>15625) stepsPerSec = 15625;*/ + uint32_t temp = stepspertick *1000; + float stepsPerSec = (float)(temp/67106); + if(stepsPerSec>15625) stepsPerSec = 15625; + return stepsPerSec; +} + + + +// This simple function shifts a byte out over SPI and receives a byte over +// SPI. Unusually for SPI devices, the x requires a toggling of the +// CS (slaveSelect) pin after each byte sent. That makes this function +// a bit more reasonable, because we can include more functionality in it. +byte Data_To_Transfer(byte data) +{ + + //while(SSIBusy(SSI2_BASE)){}; + //while(Check_SPI_Busy() == BUSY){}; + + byte data_out = 0; + /* + //digitalWrite(_CS, LOW); + L6470_CS = LOW; + //data_out = SPI.transfer(data); + L6470_TX = data; + data_out = L6470_RX; + + //digitalWrite(_CS, HIGH); + L6470_CS = HIGH; + return data_out; + */ + + data_out = Transfer_tx(data/*, &data_out*/ ); + return data_out; +} + + +// the register will be automatically zero. +// When disabling, the value will have to be explicitly written by +// the user with a SetParam() call. See the datasheet for further +// information about low-speed optimization.// Much of the functionality between "get parameter" and "set parameter" is +// very similar, so we deal with that by putting all of it in one function +// here to save memory space and simplify the program. +unsigned long ParamHandler(byte param, unsigned long value) +{ + unsigned long ret_val = 0; // This is a temp for the value to return. + // This switch structure handles the appropriate action for each register. + // This is necessary since not all registers are of the same length, either + // bit-wise or byte-wise, so we want to make sure we mask out any spurious + // bits and do the right number of transfers. That is handled by the x_Param() + // function, in most cases, but for 1-byte or smaller transfers, we call + // Data_To_Transfer() directly. + switch (param) + { + // ABS_POS is the current absolute offset from home. It is a 22 bit number expressed + // in two's complement. At power up, this value is 0. It cannot be written when + // the motor is running, but at any other time, it can be updated to change the + // interpreted position of the motor. + case x_ABS_POS: + ret_val = Param(value, 22); + break; + // EL_POS is the current electrical position in the step generation cycle. It can + // be set when the motor is not in motion. Value is 0 on power up. + case x_EL_POS: + ret_val = Param(value, 9); + break; + // MARK is a second position other than 0 that the motor can be told to go to. As + // with ABS_POS, it is 22-bit two's complement. Value is 0 on power up. + case x_MARK: + ret_val = Param(value, 22); + break; + // SPEED contains information about the current speed. It is read-only. It does + // NOT provide direction information. + case x_SPEED: + ret_val = Param(0, 32); +// writeLine("ParamHandler: "); +// writeFloat(ret_val); + break; + // ACC and DEC set the acceleration and deceleration rates. Set ACC to 0xFFF + // to get infinite acceleration/decelaeration- there is no way to get infinite + // deceleration w/o infinite acceleration (except the HARD STOP command). + // Cannot be written while motor is running. Both default to 0x08A on power up. + // AccCalc() and DecCalc() functions exist to convert steps/s/s values into + // 12-bit values for these two registers. + case x_ACC: + ret_val = Param(value, 12); + break; + case x_DEC: + ret_val = Param(value, 12); + break; + // MAX_SPEED is just what it says- any command which attempts to set the speed + // of the motor above this value will simply cause the motor to turn at this + // speed. Value is 0x041 on power up. + // MaxSpdCalc() function exists to convert steps/s value into a 10-bit value + // for this register. + case x_MAX_SPEED: + ret_val = Param(value, 10); + break; + // MIN_SPEED controls two things- the activation of the low-speed optimization + // feature and the lowest speed the motor will be allowed to operate at. LSPD_OPT + // is the 13th bit, and when it is set, the minimum allowed speed is automatically + // set to zero. This value is 0 on startup. + // MinSpdCalc() function exists to convert steps/s value into a 12-bit value for this + // register. SetLSPDOpt() function exists to enable/disable the optimization feature. + case x_MIN_SPEED: + ret_val = Param(value, 12); + break; + // FS_SPD register contains a threshold value above which microstepping is disabled + // and the x operates in full-step mode. Defaults to 0x027 on power up. + // FSCalc() function exists to convert steps/s value into 10-bit integer for this + // register. + case x_FS_SPD: + ret_val = Param(value, 10); + break; + // KVAL is the maximum voltage of the PWM outputs. These 8-bit values are ratiometric + // representations: 255 for full output voltage, 128 for half, etc. Default is 0x29. + // The implications of different KVAL settings is too complex to dig into here, but + // it will usually work to max the value for RUN, ACC, and DEC. Maxing the value for + // HOLD may result in excessive power dissipation when the motor is not running. + case x_KVAL_HOLD: + ret_val = Data_To_Transfer((byte)value); + break; + case x_KVAL_RUN: + ret_val = Data_To_Transfer((byte)value); + break; + case x_KVAL_ACC: + ret_val = Data_To_Transfer((byte)value); + break; + case x_KVAL_DEC: + ret_val = Data_To_Transfer((byte)value); + break; + // INT_SPD, ST_SLP, FN_SLP_ACC and FN_SLP_DEC are all related to the back EMF + // compensation functionality. Please see the datasheet for details of this + // function- it is too complex to discuss here. Default values seem to work + // well enough. + case x_INT_SPD: + ret_val = Param(value, 14); + break; + case x_ST_SLP: + ret_val = Data_To_Transfer((byte)value); + break; + case x_FN_SLP_ACC: + ret_val = Data_To_Transfer((byte)value); + break; + case x_FN_SLP_DEC: + ret_val = Data_To_Transfer((byte)value); + break; + // K_THERM is motor winding thermal drift compensation. Please see the datasheet + // for full details on operation- the default value should be okay for most users. + case x_K_THERM: + ret_val = Data_To_Transfer((byte)value & 0x0F); + break; + // ADC_OUT is a read-only register containing the result of the ADC measurements. + // This is less useful than it sounds; see the datasheet for more information. + case x_ADC_OUT: + ret_val = Data_To_Transfer(0); + break; + // Set the overcurrent threshold. Ranges from 375mA to 6A in steps of 375mA. + // A set of defined constants is provided for the user's convenience. Default + // value is 3.375A- 0x08. This is a 4-bit value. + case x_OCD_TH: + ret_val = Data_To_Transfer((byte)value & 0x0F); + break; + // Stall current threshold. Defaults to 0x40, or 2.03A. Value is from 31.25mA to + // 4A in 31.25mA steps. This is a 7-bit value. + case x_STALL_TH: + ret_val = Data_To_Transfer((byte)value & 0x7F); + break; + // STEP_MODE controls the microstepping settings, as well as the generation of an + // output signal from the x. Bits 2:0 control the number of microsteps per + // step the part will generate. Bit 7 controls whether the BUSY/SYNC pin outputs + // a BUSY signal or a step synchronization signal. Bits 6:4 control the frequency + // of the output signal relative to the full-step frequency; see datasheet for + // that relationship as it is too complex to reproduce here. + // Most likely, only the microsteps per step value will be needed; there is a set + // of constants provided for ease of use of these values. + case x_STEP_MODE: + ret_val = Data_To_Transfer((byte)value); + break; + // ALARM_EN controls which alarms will cause the FLAG pin to fall. A set of constants + // is provided to make this easy to interpret. By default, ALL alarms will trigger the + // FLAG pin. + case x_ALARM_EN: + ret_val = Data_To_Transfer((byte)value); + break; + // CONFIG contains some assorted configuration bits and fields. A fairly comprehensive + // set of reasonably self-explanatory constants is provided, but users should refer + // to the datasheet before modifying the contents of this register to be certain they + // understand the implications of their modifications. Value on boot is 0x2E88; this + // can be a useful way to verify proper start up and operation of the x chip. + case x_CONFIG: + ret_val = Param(value, 16); + break; + // STATUS contains read-only information about the current condition of the chip. A + // comprehensive set of constants for masking and testing this register is provided, but + // users should refer to the datasheet to ensure that they fully understand each one of + // the bits in the register. + case x_STATUS: // STATUS is a read-only register + ret_val = Param(0, 16); + break; + default: + ret_val = Data_To_Transfer((byte)(value)); + break; + } + return ret_val; +} + +// Generalization of the subsections of the register read/write functionality. +// We want the end user to just write the value without worrying about length, +// so we pass a bit length parameter from the calling function. +unsigned long Param(unsigned long value, byte bit_len) +{ + unsigned long ret_val = 0; // We'll return this to generalize this function + // for both read and write of registers. + byte byte_len = bit_len / 8; // How many BYTES do we have? + if (bit_len % 8 > 0) byte_len++; // Make sure not to lose any partial byte values. + // Let's make sure our value has no spurious bits set, and if the value was too + // high, max it out. + unsigned long mask = 0xffffffff >> (32 - bit_len); + if (value > mask) + value = mask; + // The following three if statements handle the various possible byte length + // transfers- it'll be no less than 1 but no more than 3 bytes of data. + // Data_To_Transfer() sends a byte out through SPI and returns a byte received + // over SPI- when calling it, we typecast a shifted version of the masked + // value, then we shift the received value back by the same amount and + // store it until return time. + if (byte_len == 3) { + ret_val |= Data_To_Transfer((byte)(value >> 16)) << 16; + //Serial.println(ret_val, HEX); + } + if (byte_len >= 2) { + ret_val |= Data_To_Transfer((byte)(value >> 8)) << 8; + //Serial.println(ret_val, HEX); + } + if (byte_len >= 1) { + //Serial.print("Value = "); + //Serial.println(value); + //Serial.print("ret_val = "); + //Serial.println(ret_val); + + ret_val |= Data_To_Transfer((byte)value); + + //Serial.print("ret_val = "); + //Serial.println(ret_val); + + //Serial.println(ret_val, HEX); + } + // Return the received values. Mask off any unnecessary bits, just for + // the sake of thoroughness- we don't EXPECT to see anything outside + // the bit length range but better to be safe than sorry. + return (ret_val & mask); +} + +// This simple function shifts a byte out over SPI and receives a byte over +// SPI. Unusually for SPI devices, the x requires a toggling of the +// CS (slaveSelect) pin after each byte sent. That makes this function +// a bit more reasonable, because we can include more functionality in it. + +// +//void Set_MOSI(int MOSI) +// +//{ +// _MOSI = MOSI; +//} +// +//void Set_MISO(int MISO) +// +//{ +// _MISO = MISO; +//} +// +//void Set_CS(int CS) +// +//{ +// _CS = CS; +//} +// +//void Set_CLK(int CLK) +// +//{ +// _CLK = CLK; +//} +// +//void Set_BUSY(int BUSY) +// +//{ +// _BUSY = BUSY; +//} +// +//void Set_RESET(int RESET) +// +//{ +// _RESET = RESET; +//} +// +//int Get_MOSI() +//{ +// return MOSI; +//} +// +//int Get_MISO() +//{ +// return MISO; +//} +// +//int Get_CS() +//{ +// return CS; +//} +//int Get_CLK() +//{ +// return CLK; +//} +// +//int Get_BUSY() +//{ +// return BUSY; +//} +//int Get_RESET() +//{ +// return RESET; +//} + + diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.h b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.h new file mode 100644 index 000000000..3f91c8e4b --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/FPGA/Moters_Driver/L6470.h @@ -0,0 +1,338 @@ +/* +* cL6470.h +* +* Created: 6/22/2016 8:40:34 PM +* Author: Atif +*/ + + +#ifndef CL6470_H_ +#define CL6470_H_ + +//#include <Arduino.h> +//#include <SPI.h> + +// + +// + +// constant definitions for overcurrent thresholds. Write these values to +// register x_OCD_TH to set the level at which an overcurrent even occurs. +#define x_OCD_TH_375mA 0x00 +#define x_OCD_TH_750mA 0x01 +#define x_OCD_TH_1125mA 0x02 +#define x_OCD_TH_1500mA 0x03 +#define x_OCD_TH_1875mA 0x04 +#define x_OCD_TH_2250mA 0x05 +#define x_OCD_TH_2625mA 0x06 +#define x_OCD_TH_3000mA 0x07 +#define x_OCD_TH_3375mA 0x08 +#define x_OCD_TH_3750mA 0x09 +#define x_OCD_TH_4125mA 0x0A +#define x_OCD_TH_4500mA 0x0B +#define x_OCD_TH_4875mA 0x0C +#define x_OCD_TH_5250mA 0x0D +#define x_OCD_TH_5625mA 0x0E +#define x_OCD_TH_6000mA 0x0F + +// STEP_MODE option values. +// First comes the "microsteps per step" options... +#define x_STEP_MODE_STEP_SEL 0x07 // Mask for these bits only. +#define x_STEP_SEL_1 0x00 +#define x_STEP_SEL_1_2 0x01 +#define x_STEP_SEL_1_4 0x02 +#define x_STEP_SEL_1_8 0x03 +#define x_STEP_SEL_1_16 0x04 +#define x_STEP_SEL_1_32 0x05 +#define x_STEP_SEL_1_64 0x06 +#define x_STEP_SEL_1_128 0x07 + +// ...next, define the SYNC_EN bit. When set, the BUSYN pin will instead +// output a clock related to the full-step frequency as defined by the +// SYNC_SEL bits below. +#define x_STEP_MODE_SYNC_EN 0x80 // Mask for this bit +#define x_SYNC_EN 0x80 + +// ...last, define the SYNC_SEL modes. The clock output is defined by +// the full-step frequency and the value in these bits- see the datasheet +// for a matrix describing that relationship (page 46). +#define x_STEP_MODE_SYNC_SEL 0x70 +#define x_SYNC_SEL_1_2 0x00 +#define x_SYNC_SEL_1 0x10 +#define x_SYNC_SEL_2 0x20 +#define x_SYNC_SEL_4 0x30 +#define x_SYNC_SEL_8 0x40 +#define x_SYNC_SEL_16 0x50 +#define x_SYNC_SEL_32 0x60 +#define x_SYNC_SEL_64 0x70 + +// Bit names for the ALARM_EN register. +// Each of these bits defines one potential alarm condition. +// When one of these conditions occurs and the respective bit in ALARM_EN is set, +// the FLAG pin will go low. The register must be queried to determine which event +// caused the alarm. +#define x_ALARM_EN_OVERCURRENT 0x01 +#define x_ALARM_EN_THERMAL_SHUTDOWN 0x02 +#define x_ALARM_EN_THERMAL_WARNING 0x04 +#define x_ALARM_EN_UNDER_VOLTAGE 0x08 +#define x_ALARM_EN_STALL_DET_A 0x10 +#define x_ALARM_EN_STALL_DET_B 0x20 +#define x_ALARM_EN_SW_TURN_ON 0x40 +#define x_ALARM_EN_WRONG_NPERF_CMD 0x80 + +// CONFIG register renames. + +// Oscillator options. +// The x needs to know what the clock frequency is because it uses that for some +// calculations during operation. +#define x_CONFIG_OSC_SEL 0x000F // Mask for this bit field. +#define x_CONFIG_INT_16MHZ 0x0000 // Internal 16MHz, no output +#define x_CONFIG_INT_16MHZ_OSCOUT_2MHZ 0x0008 // Default; internal 16MHz, 2MHz output +#define x_CONFIG_INT_16MHZ_OSCOUT_4MHZ 0x0009 // Internal 16MHz, 4MHz output +#define x_CONFIG_INT_16MHZ_OSCOUT_8MHZ 0x000A // Internal 16MHz, 8MHz output +#define x_CONFIG_INT_16MHZ_OSCOUT_16MHZ 0x000B // Internal 16MHz, 16MHz output +#define x_CONFIG_EXT_8MHZ_XTAL_DRIVE 0x0004 // External 8MHz crystal +#define x_CONFIG_EXT_16MHZ_XTAL_DRIVE 0x0005 // External 16MHz crystal +#define x_CONFIG_EXT_24MHZ_XTAL_DRIVE 0x0006 // External 24MHz crystal +#define x_CONFIG_EXT_32MHZ_XTAL_DRIVE 0x0007 // External 32MHz crystal +#define x_CONFIG_EXT_8MHZ_OSCOUT_INVERT 0x000C // External 8MHz crystal, output inverted +#define x_CONFIG_EXT_16MHZ_OSCOUT_INVERT 0x000D // External 16MHz crystal, output inverted +#define x_CONFIG_EXT_24MHZ_OSCOUT_INVERT 0x000E // External 24MHz crystal, output inverted +#define x_CONFIG_EXT_32MHZ_OSCOUT_INVERT 0x000F // External 32MHz crystal, output inverted + +// Configure the functionality of the external switch input +#define x_CONFIG_SW_MODE 0x0010 // Mask for this bit. +#define x_CONFIG_SW_HARD_STOP 0x0000 // Default; hard stop motor on switch. +#define x_CONFIG_SW_USER 0x0010 // Tie to the GoUntil and ReleaseSW +// commands to provide jog function. +// See page 25 of datasheet. + +// Configure the motor voltage compensation mode (see page 34 of datasheet) +#define x_CONFIG_EN_VSCOMP 0x0020 // Mask for this bit. +#define x_CONFIG_VS_COMP_DISABLE 0x0000 // Disable motor voltage compensation. +#define x_CONFIG_VS_COMP_ENABLE 0x0020 // Enable motor voltage compensation. + +// Configure overcurrent detection event handling +#define x_CONFIG_OC_SD 0x0080 // Mask for this bit. +#define x_CONFIG_OC_SD_DISABLE 0x0000 // Bridges do NOT shutdown on OC detect +#define x_CONFIG_OC_SD_ENABLE 0x0080 // Bridges shutdown on OC detect + +// Configure the slew rate of the power bridge output +#define x_CONFIG_POW_SR 0x0300 // Mask for this bit field. +#define x_CONFIG_SR_180V_us 0x0000 // 180V/us +#define x_CONFIG_SR_290V_us 0x0200 // 290V/us +#define x_CONFIG_SR_530V_us 0x0300 // 530V/us + +// Integer divisors for PWM sinewave generation +// See page 32 of the datasheet for more information on this. +#define x_CONFIG_F_PWM_DEC 0x1C00 // mask for this bit field +#define x_CONFIG_PWM_MUL_0_625 (0x00)<<10 +#define x_CONFIG_PWM_MUL_0_75 (0x01)<<10 +#define x_CONFIG_PWM_MUL_0_875 (0x02)<<10 +#define x_CONFIG_PWM_MUL_1 (0x03)<<10 +#define x_CONFIG_PWM_MUL_1_25 (0x04)<<10 +#define x_CONFIG_PWM_MUL_1_5 (0x05)<<10 +#define x_CONFIG_PWM_MUL_1_75 (0x06)<<10 +#define x_CONFIG_PWM_MUL_2 (0x07)<<10 + +// Multiplier for the PWM sinewave frequency +#define x_CONFIG_F_PWM_INT 0xE000 // mask for this bit field. +#define x_CONFIG_PWM_DIV_1 (0x00)<<13 +#define x_CONFIG_PWM_DIV_2 (0x01)<<13 +#define x_CONFIG_PWM_DIV_3 (0x02)<<13 +#define x_CONFIG_PWM_DIV_4 (0x03)<<13 +#define x_CONFIG_PWM_DIV_5 (0x04)<<13 +#define x_CONFIG_PWM_DIV_6 (0x05)<<13 +#define x_CONFIG_PWM_DIV_7 (0x06)<<13 + +// Status register bit renames- read-only bits conferring information about the +// device to the user. +#define x_STATUS_HIZ 0x0001 // high when bridges are in HiZ mode +#define x_STATUS_BUSY 0x0002 // mirrors BUSY pin +#define x_STATUS_SW_F 0x0004 // low when switch open, high when closed +#define x_STATUS_SW_EVN 0x0008 // active high, set on switch falling edge, +// cleared by reading STATUS +#define x_STATUS_DIR 0x0010 // Indicates current motor direction. +// High is FWD, Low is REV. +#define x_STATUS_NOTPERF_CMD 0x0080 // Last command not performed. +#define x_STATUS_WRONG_CMD 0x0100 // Last command not valid. +#define x_STATUS_UVLO 0x0200 // Undervoltage lockout is active +#define x_STATUS_TH_WRN 0x0400 // Thermal warning +#define x_STATUS_TH_SD 0x0800 // Thermal shutdown +#define x_STATUS_OCD 0x1000 // Overcurrent detected +#define x_STATUS_STEP_LOSS_A 0x2000 // Stall detected on A bridge +#define x_STATUS_STEP_LOSS_B 0x4000 // Stall detected on B bridge +#define x_STATUS_SCK_MOD 0x8000 // Step clock mode is active + +// Status register motor status field +#define x_STATUS_MOT_STATUS 0x0060 // field mask +#define x_STATUS_MOT_STATUS_STOPPED (0x0000)<<13 // Motor stopped +#define x_STATUS_MOT_STATUS_ACCELERATION (0x0001)<<13 // Motor accelerating +#define x_STATUS_MOT_STATUS_DECELERATION (0x0002)<<13 // Motor decelerating +#define x_STATUS_MOT_STATUS_CONST_SPD (0x0003)<<13 // Motor at constant speed + +// Register address redefines. +// See the x_Param_Handler() function for more info about these. +#define x_ABS_POS 0x01 +#define x_EL_POS 0x02 +#define x_MARK 0x03 +#define x_SPEED 0x04 +#define x_ACC 0x05 +#define x_DEC 0x06 +#define x_MAX_SPEED 0x07 +#define x_MIN_SPEED 0x08 +#define x_FS_SPD 0x15 +#define x_KVAL_HOLD 0x09 +#define x_KVAL_RUN 0x0A +#define x_KVAL_ACC 0x0B +#define x_KVAL_DEC 0x0C +#define x_INT_SPD 0x0D +#define x_ST_SLP 0x0E +#define x_FN_SLP_ACC 0x0F +#define x_FN_SLP_DEC 0x10 +#define x_K_THERM 0x11 +#define x_ADC_OUT 0x12 +#define x_OCD_TH 0x13 +#define x_STALL_TH 0x14 +#define x_STEP_MODE 0x16 +#define x_ALARM_EN 0x17 +#define x_CONFIG 0x18 +#define x_STATUS 0x19 + +//x commands +#define x_NOP 0x00 +#define x_SET_PARAM 0x00 +#define x_GET_PARAM 0x20 +#define x_RUN 0x50 +#define x_STEP_CLOCK 0x58 +#define x_MOVE 0x40 +#define x_GOTO 0x60 +#define x_GOTO_DIR 0x68 +#define x_GO_UNTIL 0x82 +#define x_RELEASE_SW 0x92 +#define x_GO_HOME 0x70 +#define x_GO_MARK 0x78 +#define x_RESET_POS 0xD8 +#define x_RESET_DEVICE 0xC0 +#define x_SOFT_STOP 0xB0 +#define x_HARD_STOP 0xB8 +#define x_SOFT_HIZ 0xA0 +#define x_HARD_HIZ 0xA8 +#define x_GET_STATUS 0xD0 // use Get_and_Clear_Status + +/* x direction options */ +#define FWD 0x01 +#define REV 0x00 + +/* x action options */ +#define ACTION_RESET 0x00 +#define ACTION_COPY 0x01 + + + +//class cL6470 { +//public: + +//Default constuctot +//cL6470(); + +//Overload Constructor +//@param int MOSI, int MISO, int CS, int CLK, int BUSY, int RESET +//cL6470(int, int, int, int, int, int); +void init(); +unsigned long GetParam(byte); +byte Data_To_Transfer(byte); +unsigned long ParamHandler(byte, unsigned long); +void SetParam(byte, unsigned long); +unsigned long Param(unsigned long, byte); +int GetStatus(); +uint32_t SpdCalc(float); +unsigned long IntSpdCalc(float); +unsigned long FSCalc(float); +unsigned long MinSpdCalc(float); +unsigned long MaxSpdCalc(float); +unsigned long DecCalc(float); +unsigned long AccCalc(float); +void SetLSPDOpt(boolean); +void Run(byte, unsigned long); +void Step_Clock(byte); +void Move(byte, unsigned long); +void GoTo(unsigned long); +void GoTo_DIR(byte, unsigned long); +void GoUntil(byte, byte, unsigned long); +void ReleaseSW(byte, byte); +void GoHome(); +void GoMark(); +void ResetPos(); +void ResetDev(); +void SoftStop(); +void HardStop(); +void SoftHiZ(); +void HardHiZ(); +float CurrentSpdCalc(uint32_t stepspertick);// for Speed response +void delay(int number_of_seconds); +void Run_tx_test(byte dir, unsigned long spd); +////TODO update the addresses +//#define MOSI_BASE 0x00000001 // +//#define MISO_BASE 0x00000002 // +//#define CS_BASE 0x00000003 // +//#define CLK_BASE 0x00000004 // +//#define BUSY_BASE 0x00000005 // +//#define RESET_BASE 0x00000006 // +//#define TX_BASE 0x00000006 // +//#define RX_BASE 0x00000007 // + + +//extern int volatile * const MOSI_Reg; +//extern int volatile * const MISO_Reg; +//extern int volatile * const CS_Reg; +//extern int volatile * const CLK_Reg; +//extern int volatile * const BUSY_Reg; +//extern int volatile * const RESET_Reg; +//extern char volatile * const TX_Reg; +//extern char volatile * const RX_Reg; + +//*MOSI = value; /* write to port */ +//value = *MOSI; /* read from port */ + + + +/////////////// + + +////@param int MOSI +//void Set_MOSI(int); +////@param int MISO +//void Set_MISO(int); +////@param int CS +//void Set_CS(int); +////@param int CLK +//void Set_CLK(int); +////@param int BUSY +//void Set_BUSY(int); +////@param int RESET +//void Set_RESET(int); + + + +//int Get_MOSI(); +//int Get_MISO(); +//int Get_CS(); +//int Get_CLK(); +//int Get_BUSY(); +//int Get_RESET(); + + +//private: +// Member Variable + +//int MOSI = 0; +//int MISO = 0; +//int CS = 0; +//int CLK = 0; +//int BUSY = 0; +//int RESET = 0; +//}; + + +#endif /* CL6470_H_ */ diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/I2C_Communication/I2C.h b/Software/Code_Composer/twine_usblib_demo/drivers/I2C_Communication/I2C.h new file mode 100644 index 000000000..125b7eb2c --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/I2C_Communication/I2C.h @@ -0,0 +1,31 @@ + +#ifndef DRIVERS_I2C_H_ +#define DRIVERS_I2C_H_ + + +#include <stdbool.h> +#include <stdint.h> + +#define I2C_NUM_OF_CHANNELS 7 // 6 dispensers and feeder +//front panel date saved in the same array of sampeled ADC data g_pui32ADCSeq[] + +#define I2C_START_INDEX 14 +#define I2C_ADC_DISP_1_POT 20 +#define I2C_ADC_DISP_2_POT 19 +#define I2C_ADC_DISP_3_POT 14 +#define I2C_ADC_DISP_4_POT 17 +#define I2C_ADC_DISP_5_POT 16 +#define I2C_ADC_DISP_6_POT 15 +#define I2C_ADC_FEEDER_POT 18 + + +/********************************************************************************************* + * this function is responsible for recieving a to d data of the potentiometers that connected + * to front panel and arrives in I2C communication protocol. + * input parameters - slave addres of I2C device + * buffer to write the result into + * index inside the beffer from where to atart writing + *********************************************************************************************/ +void SampleI2CData(uint32_t* _resultData); +void InitI2C(void); +#endif /* DRIVERS_I2C_H_ */ diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.c b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.c new file mode 100644 index 000000000..d11555de1 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.c @@ -0,0 +1,1031 @@ + +#include <stdbool.h> +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <string.h> + +#include "inc/hw_memmap.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/ssi.h" +#include "driverlib/sysctl.h" +#include "utils/uartstdio.h" + +#include "graphics_adapter.h" +#include <Stubs_Handler/DataDef.h> + +#include "drivers/FPGA/Moters_Driver/L6470.h" + +#include "drivers/FPGA/FPGA_Comm.h" + +#include <driverlib/rom.h> +#include <driverlib/rom_map.h> + +#include <PMR/Stubs/StubMotorInitRequest.pb-c.h> + +void temp_init_spi2(); +void temp_setup(); + +void Avi_test_get_speed(); +//uint32_t Get_Param_Status(byte param); +uint32_t Get_and_Clear_Status(); + +uint32_t Get_Param(byte param); +unsigned long MaxSpdCalc(float stepsPerSec); + +extern unsigned long Run_Value ; +extern unsigned long Mov_Value ; +extern unsigned long Pos_Value; +extern bool Direction ; +extern unsigned long Time_2_Change_Direction ; +extern bool Display_Tx_ON_LCD; +extern bool Display_Rx_on_LCD; +extern unsigned long Init_MicroStep ; +extern unsigned long Init_Acc; +extern unsigned long Init_Dec; +extern bool TestBool_1; +extern bool TestBool_2; +extern bool TestBool_3; +extern bool TestBool_4; +extern bool TestBool_5; +extern unsigned long TestUint32_1; +extern unsigned long TestUint32_2; +extern unsigned long TestUint32_3; +extern unsigned long TestUint32_4; +extern unsigned long TestUint32_5; +extern unsigned long TestUint32_6; + +extern unsigned char Stop_Command; + +//#define SPI_EVA_LCD_ENABLED + + +void SPI2_Init() +{ + #if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + uint32_t ui32SysClock; + #endif + + + + // + // Set the clocking to run directly from the external crystal/oscillator. + // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the + // crystal on your board. + // + #if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + /*ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | + SYSCTL_OSC_MAIN | + SYSCTL_USE_OSC), 25000000);*/ + ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | + SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | + SYSCTL_CFG_VCO_480), 120000000); + #else + SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); + #endif +#ifdef SPI_EVA_LCD_ENABLED + writeLine("SSI:"); + writeLine(" Mode: SPI"); + writeLine(" Data: 8-bit"); +#endif + + // The SSI2 peripheral must be enabled for use. + // + SysCtlPeripheralReset(SYSCTL_PERIPH_SSI2); + SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); + + // + // For this example SSI2 is used with PortG[7:4]. GPIO port G needs to be + // enabled so these pins can be used. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + + + + /* Configure pad settings */ // AVI + GPIOPadConfigSet(GPIO_PORTG_BASE, + GPIO_PIN_7 | GPIO_PIN_5, + GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD); + + + GPIOPadConfigSet(GPIO_PORTG_BASE, + GPIO_PIN_4, + GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU); + + GPIOPadConfigSet(GPIO_PORTG_BASE, + GPIO_PIN_6, + GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD); + + + // + // Configure the pin muxing for SSI2 functions on port G4, G5, G6 and G7. + // This step is not necessary if your part does not support pin muxing. + + + #define GPIO_PG4_SSI2TX GPIO_PG4_SSI2XDAT1 // AVI + #define GPIO_PG5_SSI2RX GPIO_PG5_SSI2XDAT0 // AVI + + // + GPIOPinConfigure(GPIO_PG7_SSI2CLK); + GPIOPinConfigure(GPIO_PG6_SSI2FSS); + GPIOPinConfigure(GPIO_PG5_SSI2RX); + GPIOPinConfigure(GPIO_PG4_SSI2TX); + + // + // Configure the GPIO settings for the SSI pins. This function also gives + // control of these pins to the SSI hardware. Consult the data sheet to + // see which functions are allocated per pin. + // The pins are assigned as follows: + // PG4 - SSI2Tx + // PG5 - SSI2Rx + // PG6 - SSI2Fss + // PG7 - SSI2CLK + // + GPIOPinTypeSSI(GPIO_PORTG_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | + GPIO_PIN_4); + + // + // Configure and enable the SSI2 port for SPI Master mode. + // + #if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + SSIConfigSetExpClk(SSI2_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); + #else + SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); + #endif + + SSIAdvModeSet(SSI2_BASE,SSI_ADV_MODE_READ_WRITE);//data is written to and read from the slave // AVI + // + // Enable the SSI2 module. + // + SSIEnable(SSI2_BASE); + //---------------------------------------------------------------- + +} + +void init_BUSY_Pin(void) +{ + MAP_GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_0); // Enable pin for GPIOInput + SysCtlDelay(10000); + GPIOPadConfigSet(GPIO_PORTG_BASE,GPIO_PIN_0,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU );//Configure GPIO PULL UP resistors. NOTE: does not work if ROM_GPIOPinTypeGPIOInput() isnt called before. +} + +bool Check_SPI_Busy(void) +{ + + if(ROM_GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_0) == GPIO_PIN_0) + return NOTBUSY; + else + return BUSY; +} + +bool Polling_SPI_Busy(void) +{ + uint32_t timeout = 10000; // todo - check this value + char temp; + + do + { + timeout--; + temp = ROM_GPIOPinRead(GPIO_PORTG_BASE, GPIO_PIN_0); + } while(( temp != GPIO_PIN_0) && (timeout)); + + if(temp != GPIO_PIN_0) + return BUSY;//After time out + else + return NOTBUSY; +} + +void SPI_TX(unsigned int SSI_BASE,uint32_t *pui32DataTx, uint32_t *pui32DataRx, unsigned int Num_SSI_Data) +{ + uint32_t ui32Index; + // + // Read any residual data from the SSI port. This makes sure the receive + // FIFOs are empty, so we don't read any unwanted junk. This is done here + // because the SPI SSI mode is full-duplex, which allows you to send and + // receive at the same time. The SSIDataGetNonBlocking function returns + // "true" when data was returned, and "false" when no data was returned. + // The "non-blocking" function checks if there is any data in the receive + // FIFO and does not "hang" if there isn't. + // + while(SSIDataGetNonBlocking(SSI_BASE, &pui32DataRx[0])) + { + } + + + // + // Display indication that the SSI is transmitting data. + // + //UARTprintf("Sent:\n "); +#ifdef SPI_EVA_LCD_ENABLED + writeLine("Sent: "); +#endif + // + // Send 3 bytes of data. + // + + for(ui32Index = 0; ui32Index < Num_SSI_Data; ui32Index++) + { + #ifdef SPI_EVA_LCD_ENABLED +#ifdef SPI_EVA_LCD_ENABLED + // Display the data that SSI is transferring. + writeFloat (pui32DataTx[ui32Index]); + writeString(" "); +#endif + #endif + + + // + // Send the data using the "blocking" put function. This function + // will wait until there is room in the send FIFO before returning. + // This allows you to assure that all the data you send makes it into + // the send FIFO. + // + SSIDataPut(SSI_BASE, pui32DataTx[ui32Index]); + } + + // + // Wait until SSI2 is done transferring all the data in the transmit FIFO. + // + while(SSIBusy(SSI_BASE)) + { + } +} + +void SPI_RX(unsigned int SSI_Bsae, uint32_t* RxBuf, uint32_t NumOfWords) +{ + +/* + uint32_t ui32Index; +#define DUMMY_BYTE 0x00 + + NumOfWords = 2; + + writeLine("Starting Read Operations..."); + + for(ui32Index=0;ui32Index<NumOfWords-1;ui32Index++) + { + SSIDataPut(SSI_Bsae,DUMMY_BYTE); + SSIDataGet(SSI_Bsae,&RxBuf[ui32Index]); + } + SSIAdvDataPutFrameEnd(SSI_Bsae,DUMMY_BYTE); + SSIDataGet(SSI_Bsae,&RxBuf[NumOfWords-1]); + + + writeFloat (RxBuf[0]); + writeFloat (RxBuf[1]); +// + writeLine("Read Completed..."); + +*/ + + uint32_t ui32Index; +#ifdef SPI_EVA_LCD_ENABLED + // Display indication that the SSI is receiving data. + writeLine("Received: "); +#endif + // + // Receive 3 bytes of data. + +// while(SSIBusy(SSI_Bsae)) +// { +// } + // + unsigned char Num_SSI_Data = 1; + uint32_t pui32DataRx[1]; + + for(ui32Index = 0; ui32Index < Num_SSI_Data; ui32Index++) + { + // + // Receive the data using the "blocking" Get function. This function + // will wait until there is data in the receive FIFO before returning. + // + SSIDataGet(SSI_Bsae, &pui32DataRx[ui32Index]); + + writeLine("SPI_RX: "); + writeFloat (pui32DataRx[ui32Index]); + writeString(" "); + + + // + // Since we are using 8-bit data, mask off the MSB. + // + pui32DataRx[ui32Index] &= 0x00FF; + + // + // Display the data that SSI2 received. + // + //UARTprintf("'%c' ", pui32DataRx[ui32Index]); + + //temp[0] = pui32DataRx[ui32Index]; + //writeString(temp); +//#ifdef SPI_EVA_LCD_ENABLED +// writeFloat (pui32DataRx[ui32Index]); +// writeString(" "); +//#endif + } + + RxBuf[0] = pui32DataRx[0]; + + // + // Return no errors + // + + +} + +/////////////// + +void setup(StubMotorInitRequest* request) +//void setup() +{ + + unsigned long read_status, NOP; + + // // Standard serial port initialization for debugging. + //Serial.begin(9600); + //Serial.setTimeout(50); + //delay(500); + + //if (GetParam(x_CONFIG) == 0x2E88) // the default value of the CONFIG register + // The following function calls are for this demo application- + // you will need to adjust them for your particular + // application, and you may need to configure additional + // registers. + + // First, let's set the step mode register: + // - x_SYNC_EN controls whether the BUSY/SYNC pin reflects + // the step frequency or the BUSY status of the chip. We + // want it to be the BUSY status. + // - x_STEP_SEL_x is the microstepping rate- we'll go full + // step. + // - x_SYNC_SEL_x is the ratio of (micro)steps to toggles + // on the BUSY/SYNC pin (when that pin is used for SYNC). + // Make it 1:1, despite not using that pin. + + + //Step mode can only be changed when bridges are disabled: + HardHiZ(); + read_status = Get_Param(x_STATUS); + while((read_status & x_STATUS_HIZ) != x_STATUS_HIZ) + { + NOP++; + } + + while(SSIBusy(SSI2_BASE)){}; + + if(request->set_micro_steps) + { + SetParam(x_STEP_MODE, + !x_SYNC_EN | + request->micro_steps | + x_SYNC_SEL_1); + } + else + { + SetParam(x_STEP_MODE, + !x_SYNC_EN | + x_STEP_SEL_1_8 | + x_SYNC_SEL_1); + } + + // Configure the MAX_SPEED register- this is the maximum number + // of (micro)steps per second allowed. You'll want to mess + // around with your desired application to see how far you can + // push it before the motor starts to slip. The ACTUAL + // parameter passed to this function is in steps/tick; + // MaxSpdCalc() will convert a number of steps/s into an + // appropriate value for this function. Note that for any move + // or goto type function where no speed is specified, this + // value will be used. + while(SSIBusy(SSI2_BASE)){}; + + if(request->set_max_speed) + { + SetParam(x_MAX_SPEED, MaxSpdCalc(request->max_speed)); + } + else + { + SetParam(x_MAX_SPEED, MaxSpdCalc(1120)); + } + + + // Configure the FS_SPD register- this is the speed at which the + // driver ceases microstepping and goes to full stepping. + // FSCalc() converts a value in steps/s to a value suitable for + // this register; to disable full-step switching, you can pass + // 0x3FF to this register. + while(SSIBusy(SSI2_BASE)){}; + SetParam(x_FS_SPD, FSCalc(0x3FF)); + + // Configure the acceleration rate, in steps/tick/tick. There is + // also a DEC register; both of them have a function (AccCalc() + // and DecCalc() respectively) that convert from steps/s/s into + // the appropriate value for the register. Writing ACC to 0xfff + // sets the acceleration and deceleration to 'infinite' (or as + // near as the driver can manage). If ACC is set to 0xfff, DEC + // is ignored. To get infinite deceleration without infinite + // acceleration, only hard stop will work. + + //SoftStop(); // ACC + DEC writable only when motor is stopped + //SysCtlDelay(10000000); + while(SSIBusy(SSI2_BASE)){}; + + HardHiZ(); + read_status = Get_Param(x_STATUS); + while((read_status & x_STATUS_HIZ) != x_STATUS_HIZ) + { + SysCtlDelay(1000000); + read_status = Get_Param(x_STATUS); + } + // ACC + DEC writable only when motor is stopped + + if(request->set_acc) + { + SetParam(x_ACC, request->acc);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + } + else + { + SetParam(x_ACC, 0x8A);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + } + + while(SSIBusy(SSI2_BASE)){}; + + if(request->set_dec) + { + SetParam(x_ACC, request->dec);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + } + else + { + SetParam(x_DEC, 0x8A);//roll-over after 0x7F - 7 bit ??? (should be 12 bit) AVI + } + + + + // Configure the overcurrent detection threshold. The constants + // for this are defined in the L6470.h file. + while(SSIBusy(SSI2_BASE)){}; + SetParam(x_OCD_TH, x_OCD_TH_1500mA); + + // Set up the CONFIG register as follows: + // PWM frequency divisor = 1 + // PWM frequency multiplier = 2 (62.5kHz PWM frequency) + // Slew rate is 290V/us + // Do NOT shut down bridges on overcurrent + // Disable motor voltage compensation + // Hard stop on switch low + // 16MHz internal oscillator, nothing on output + + //Get_Param(x_STATUS); //High impedance state + //while(SSIBusy(SSI2_BASE)){}; + //GetStatus(); + //SysCtlDelay(10000000); + while(SSIBusy(SSI2_BASE)){}; + + HardHiZ(); + read_status = Get_Param(x_STATUS); + while((read_status & x_STATUS_HIZ) != x_STATUS_HIZ) + { + SysCtlDelay(1000000); + read_status = Get_Param(x_STATUS); + } + + //writable only when outputs are in high impedance: + SetParam(x_CONFIG, + x_CONFIG_PWM_DIV_1 | + x_CONFIG_PWM_MUL_2 | + x_CONFIG_SR_180V_us | + x_CONFIG_OC_SD_ENABLE | + x_CONFIG_VS_COMP_DISABLE | + x_CONFIG_SW_HARD_STOP | + x_CONFIG_INT_16MHZ); + + while(SSIBusy(SSI2_BASE)){}; + + SetParam(x_ALARM_EN,0xFF); + //----------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Special Section <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + // Configure the RUN KVAL. This defines the duty cycle of the + // PWM of the bridges during running. 0xFF means that they are + // essentially NOT PWMed during run; this MAY result in more + // power being dissipated than you actually need for the task. + // Setting this value too low may result in failure to turn. + // There are ACC, DEC, and HOLD KVAL registers as well; you may + // need to play with those values to get acceptable performance + // for a given application. + SetParam(x_KVAL_HOLD, /*0x0B);// */ 0x05); + SetParam(x_KVAL_RUN, /*0x4B);// */ 0x23); + SetParam(x_KVAL_ACC, /*0x4B);// */ 0x23); + SetParam(x_KVAL_DEC, /*0x4B);// */ 0x23); + SetParam(x_ST_SLP, 0x18); + SetParam(x_INT_SPD, /*0x1A13);// */ 0x3550); + SetParam(x_FN_SLP_ACC, /*0x48);// */ 0x23); + SetParam(x_FN_SLP_DEC, /*0x48);// */ 0x23); + + //https://www.youtube.com/watch?v=8C7qdjPbhlg MIN 2:20 + + //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< + + // Calling GetStatus() clears the UVLO bit in the status + // register, which is set by default on power-up. The driver + // may not run without that bit cleared by this read operation. + GetStatus(); + + // Now we're going to set up a counter to track pulses from an + // encoder, to verify against the expected values. + //TCCR1A = 0; // No waveform generation stuff. + //TCCR1B = B00000110; // Clock on falling edge, T1 pin. + //TCNT1 = 0; // Clear the count. +} + +void Mot_Run() +{ + while(SSIBusy(SSI2_BASE)){}; + Run(Direction,Run_Value ); + //Run_tx_test(Direction,Run_Value ); +} + +void Mot_Mov() +{ + while(SSIBusy(SSI2_BASE)){}; + Move(Direction,Pos_Value ); +} + + + +void Mot_Stop() +{ + while(SSIBusy(SSI2_BASE)){}; + switch(Stop_Command) + { + case 0: + SoftHiZ(); + break; + case 1: + HardHiZ(); + break; + case 2: + SoftStop(); + break; + case 3: + HardStop(); + break; + default: + break; + } +} + +void loop() +{ + GetStatus(); // Clear the error + + //unsigned long i; + //unsigned long ReadSpeed; +// ResetPos(); +// SoftStop(); +// SysCtlDelay(17500000); + +// HardStop(); + // writeLine("Received: "); + //while(1) + { + + ResetPos(); + //for(i=0;i<0x3FFFFF;i++) +// { +// Run(FWD,i ); +// HardStop(); +// writeLine("Tx "); +// writeFloat(i); +// SysCtlDelay(5000000); +// } + //i = 100000; + + unsigned long Read_Speed, + //Read_MaxSpeed, + //Read_Acc, + //Read_Dec, + //speed, + Read_pos, + //Pos_Value, + //Read_ELpos, + read_status; + //unsigned long SpeedStepPerSec, + // MaxSpeedStepPerSec; + + //Direction = FWD; + //Run_Value = 0x10625; // 1000 step/sec + //Pos_Value = 0x111111; // 1000 step/sec + unsigned k = 1; + + //SetParam(x_MAX_SPEED, MaxSpdCalc(1100)); // >1000 step/sec + //SetParam(x_MAX_SPEED, 0x10680); // >1000 step/sec + + while(k) + { + + while(SSIBusy(SSI2_BASE)){}; + //Avi_test_get_speed(); //OK !!! + Read_Speed = Get_Param(x_SPEED); + writeLine("Read_Speed: "); + writeFloat(Read_Speed); + + while(SSIBusy(SSI2_BASE)){}; + //SysCtlDelay(17500000); + Read_pos = Get_Param(x_ABS_POS); + writeLine("Read_pos: "); + writeFloat(Read_pos); + while(SSIBusy(SSI2_BASE)){}; + +/* Read_ELpos = Get_Param(x_EL_POS); + writeLine("Read_EL_pos: "); + writeFloat(Read_ELpos); + while(SSIBusy(SSI2_BASE)){};*/ + + + writeLine("Tx "); + writeFloat(Run_Value); + Run(Direction,Run_Value ); + + switch(Stop_Command) + { + case 1: + HardStop(); + break; + case 2: + SoftStop(); + break; + case 3: + HardHiZ(); + break; + case 4: + SoftHiZ(); + break; + default: + break; + } + +/* if(k>5) + Move(Direction,Pos_Value ); + else + //GoTo_DIR(Direction,Pos_Value ); + GoTo(Pos_Value );*/ + + read_status = Get_Param(x_STATUS); + + switch((read_status & x_STATUS_MOT_STATUS)>>5) + { + case 0://Stopped + writeLine("-"); + break; + case 1://Acceleration + if(read_status & x_STATUS_DIR) + writeLine(">>>"); + else + writeLine("<<<"); + break; + case 2://Deceleration + if(read_status & x_STATUS_DIR) + writeLine(">"); + else + writeLine("<"); + break; + case 3://Constant speed + if(read_status & x_STATUS_DIR) + writeLine(">>"); + else + writeLine("<<"); + break; + } + //read_status = GetStatus(); + //read_status = Get_Param_Status( x_GET_STATUS); // The GetStatus command resets the STATUS register warning flags. + read_status = Get_and_Clear_Status(); + + if((read_status & x_STATUS_UVLO)==0) + writeLine("Undervoltage"); + + Get_Param(x_STEP_MODE); + + /* + //speed = Get_Param(x_SPEED); + speed = GetParam(x_SPEED); + if(speed & 0xfffff == Run_Value ) + writeLine(" XXXXXXX "); + writeLine(" Speed: "); + writeFloat(speed); + */ + //SysCtlDelay(17500000); + ///while(SSIBusy(SSI2_BASE)){}; + //Avi_test_get_speed(); //OK !!! + // Get_Param(x_SPEED); + + // while(SSIBusy(SSI2_BASE)){}; + //SysCtlDelay(17500000); + // Get_Param(x_ABS_POS); + //SysCtlDelay(17500000); + //GetParam(x_SPEED); // wrong value; + + + //unsigned long read_status; +/* + if(k<2) + { + HardHiZ(); + read_status = Get_Param(x_STATUS); + while((read_status & x_STATUS_HIZ) != x_STATUS_HIZ) + { + read_status = Get_Param(x_STATUS); + SysCtlDelay(1000000); + } + + + Read_Acc = Get_Param(x_ACC); + writeLine("x_ACC: "); + writeFloat(Read_Acc); + + + // while(SSIBusy(SSI2_BASE)){}; + + Read_Dec = Get_Param(x_DEC); + writeLine("x_ACC: "); + writeFloat(Read_Dec); + + while(SSIBusy(SSI2_BASE)){}; + + Get_Param(x_CONFIG); + }*/ + //Get_Param(x_ALARM_EN); + k--; + } + + + + + +// +// Read_MaxSpeed = Get_Param(x_MAX_SPEED); +// writeLine("Max Speed: "); +// writeFloat(Read_MaxSpeed); +// +// MaxSpeedStepPerSec = MaxSpdCalc(Read_MaxSpeed); +// +// writeLine("Max Speed (Step Per Sec): "); +// writeFloat(MaxSpeedStepPerSec); + + + +/* + Read_KvalAcc = Get_Param(x_KVAL_ACC); + writeLine("x_KVAL_ACC: "); + writeFloat(Read_KvalAcc); + + Read_KvalDec = Get_Param(x_KVAL_DEC); + writeLine("x_KVAL_DEC: "); + writeFloat(Read_KvalDec); +*/ + + /* while (1) + { + //Run(Direction,Run_Value ); + + writeLine("Tx "); + writeFloat(Run_Value); + + SysCtlDelay(7500000); + Read_Speed = Get_Param(x_SPEED); + writeLine("Speed: "); + writeFloat(Read_Speed); + + SpeedStepPerSec = MaxSpdCalc(Read_Speed); + + writeLine("Speed (Step Per Sec): "); + writeFloat(SpeedStepPerSec); + } +*/ + +/* + + //for(i=0xFFFFF;i>0;i--) + //{ + + //Move(FWD, 25600); + + //Move(FWD, 25600); + + Run(FWD, 0xFFFFF); + //while (digitalRead(Get_BUSY()) == LOW); // Until the movement completes, the + //while(L6470_BUSY == LOW){} // BUSYN pin will be low. + //SetParam(x_MAX_SPEED, MaxSpdCalc(1)); // Change the Speed + // SetParam(x_MIN_SPEED, MinSpdCalc(300)); + + //writeLine("Tx "); + // writeFloat(i); + // writeLine("Rx "); + //delay(5); + //SysCtlDelay(7500000); // need #include "driverlib/sysctl.h" + //ReadSpeed = GetParam(x_SPEED); + + //writeFloat(ReadSpeed); + + + //SysCtlDelay(17500000); + SysCtlDelay(10000000); // need #include "driverlib/sysctl.h" + //SoftStop(); + // HardStop(); +// } +// //SetParam(x_MAX_SPEED, MaxSpdCalc(300)); // Change the Speed +// //delay(5); +// // for(i=0;i<10;i++) +// { +// //Move(REV, 25600); + //Move(REV, 25600); + + Run(REV, 0xFFFFF); + + //SetParam(x_MAX_SPEED, MaxSpdCalc(30)); // Change the Speed + SysCtlDelay(10000000); + //SoftStop(); +// //while (digitalRead(Get_BUSY()) == LOW); // Until the movement completes, the +// //while (*BUSY_Reg == LOW){} // BUSYN pin will be low. +// //SetParam(x_MAX_SPEED, MaxSpdCalc(50)); // Change the Speed +// //delay(5); + // HardStop(); +// } + + //GoHome(); + + // SysCtlDelay(17500000); + //for(i=0;i<10;i++); +*/ + } +} +/////////////// + +int SPI_Control(bool Init) +{ + if(Init == INIT) + { + SPI2_Init(); + init_BUSY_Pin(); + //setup(); + setup(NULL); + } + loop(); + + return(0); +} + +byte Transfer_tx(byte data/*, byte data_out*/ ) +{ + #define NUM_SSI_DATA 1 + byte data_out; + + uint32_t pui32DataTx[NUM_SSI_DATA]; + uint32_t pui32DataRx[NUM_SSI_DATA]; + + pui32DataTx[0] = data; + //pui32DataRx[0] = data_out; + + SPI_TX(SSI2_BASE, &pui32DataTx, &pui32DataRx, NUM_SSI_DATA ); + + SPI_RX(SSI2_BASE, &pui32DataRx, NUM_SSI_DATA ); + + //writeLine("Transfer_tx: "); + //writeFloat(pui32DataRx[0]); + + data_out = pui32DataRx[0]; + + return data_out; + +} + + +byte Write_Byte(uint8_t WByte) +{ + uint32_t RByte; + + SSIDataPut(SSI2_BASE, WByte); + + while(SSIBusy(SSI2_BASE)) + { + } + + while(Check_SPI_Busy() == BUSY) + { + } + + SSIDataGet(SSI2_BASE, &RByte); + + return (RByte & 0xff); + +} + +uint32_t Get_Param(byte param)//OK +{ + uint32_t temp = 0; + uint32_t rx = 0; + while(SSIBusy(SSI2_BASE)){}; + while(Check_SPI_Busy() == BUSY){}; + /* Send GetParam operation code to dSPIN */ + temp = Write_Byte((uint8_t)x_GET_PARAM | (uint8_t)param); + /* MSB which should be 0 */ + rx |= (temp & 0xFF) << 24; + switch (param) + { + case x_ABS_POS: ; + case x_MARK: ; + case x_SPEED: + while(SSIBusy(SSI2_BASE)){}; + while(Check_SPI_Busy() == BUSY){}; + temp = Write_Byte((uint8_t)(0x00)); + rx |= (temp & 0xFF) << 16; + case x_EL_POS: ; + case x_ACC: ; + case x_DEC: ; + case x_MAX_SPEED: ; + case x_MIN_SPEED: ; + case x_FS_SPD: ; + case x_INT_SPD: ; + case x_CONFIG: ; + case x_STATUS: + while(SSIBusy(SSI2_BASE)){}; + while(Check_SPI_Busy() == BUSY){}; + temp = Write_Byte((uint8_t)(0x00)); + rx |= (temp & 0xFF) << 8; + default: + while(SSIBusy(SSI2_BASE)){}; + while(Check_SPI_Busy() == BUSY){}; + temp = Write_Byte((uint8_t)(0x00)); + rx |= temp & 0xFF; + } + + return rx; +} +/* +void Avi_test_get_speed()// Working as expected read the speed +{ + + unsigned char i; + + uint32_t pui32DataRx[10]; + + while(SSIDataGetNonBlocking(SSI2_BASE, &pui32DataRx[0])) + { + } + + SSIDataPut(SSI2_BASE, 0x24);//get speed + + while(SSIBusy(SSI2_BASE)) + { + } + + writeLine("Received: "); + + + for(i = 0; i < 4; i++) + { + if(i>0) + SSIDataPut(SSI2_BASE, 0x00); + + while(SSIBusy(SSI2_BASE)) + { + } + + SSIDataGet(SSI2_BASE, &pui32DataRx[i]); + + pui32DataRx[i] &= 0x00FF; + + writeFloat (pui32DataRx[i]); + writeString(" "); + } + +} + +*/ +uint32_t Get_and_Clear_Status()// Tested OK AVI +{ + uint32_t temp = 0; + uint32_t rx = 0; + + /* Send GetParam operation code to dSPIN */ + temp = Write_Byte(x_GET_STATUS); + /* MSB which should be 0 */ + rx |= (temp & 0xFF) << 24; + + temp = Write_Byte((uint8_t)(0x00)); + rx |= (temp & 0xFF) << 8; + + temp = Write_Byte((uint8_t)(0x00)); + rx |= temp & 0xFF; + + return rx; +} diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.h b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.h new file mode 100644 index 000000000..6b4d5ecf1 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/SPI_Comm.h @@ -0,0 +1,16 @@ +int SPI_Control(bool Init); + +byte Transfer_tx(byte data/*, byte data_out*/ ); +uint32_t Get_Param(byte param); +void SPI2_Init(); + +//void temp_init_spi2(); +void Mot_Mov(); +void Mot_Run(); + +void Mot_Stop(); +uint32_t Get_and_Clear_Status(); +void setup(); +void init_BUSY_Pin(void); +#include <PMR/Stubs/StubMotorInitRequest.pb-c.h> +void setup(StubMotorInitRequest* request); diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.c b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.c new file mode 100644 index 000000000..73eaa7468 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.c @@ -0,0 +1,519 @@ +//***************************************************************************** +// +// spi_master.c - Example demonstrating how to configure SSI0 in SPI master +// mode. +// +// Copyright (c) 2010-2017 Texas Instruments Incorporated. All rights reserved. +// Software License Agreement +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the +// distribution. +// +// Neither the name of Texas Instruments Incorporated nor the names of +// its contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// This is part of revision 2.1.4.178 of the Tiva Firmware Development Package. +// +//***************************************************************************** + +#include <stdbool.h> +#include <stdint.h> +#include "inc/hw_memmap.h" +#include "driverlib/gpio.h" +#include "driverlib/pin_map.h" +#include "driverlib/ssi.h" +#include "driverlib/sysctl.h" +//#include "driverlib/uart.h" +#include "utils/uartstdio.h" + +#include "graphics_adapter.h" + +//***************************************************************************** +// +//! \addtogroup ssi_examples_list +//! <h1>SPI Master (spi_master)</h1> +//! +//! This example shows how to configure the SSI0 as SPI Master. The code will +//! send three characters on the master Tx then polls the receive FIFO until +//! 3 characters are received on the master Rx. +//! +//! This example uses the following peripherals and I/O signals. You must +//! review these and change as needed for your own board: +//! - SSI0 peripheral +//! - GPIO Port A peripheral (for SSI0 pins) +//! - SSI0Clk - PA2 +//! - SSI0Fss - PA3 +//! - SSI0Rx - PA4 +//! - SSI0Tx - PA5 +//! +//! The following UART signals are configured only for displaying console +//! messages for this example. These are not required for operation of SSI0. +//! - UART0 peripheral +//! - GPIO Port A peripheral (for UART0 pins) +//! - UART0RX - PA0 +//! - UART0TX - PA1 +//! +//! This example uses the following interrupt handlers. To use this example +//! in your own application you must add these interrupt handlers to your +//! vector table. +//! - None. +// +//***************************************************************************** + +//***************************************************************************** +// +// Number of bytes to send and receive. +// +//***************************************************************************** +#define NUM_SSI_DATA 5 + +//***************************************************************************** +// +// This function sets up UART0 to be used for a console to display information +// as the example is running. +// +//***************************************************************************** +/* +void InitSPI2(void) +{ + // + // The SSI2 peripheral must be enabled for use. + // + SysCtlPeripheralReset(SYSCTL_PERIPH_SSI2); + SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); + + // + // For this example SSI2 is used with PortG[7:4]. GPIO port G needs to be + // enabled so these pins can be used. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + + // + // Configure the pin muxing for SSI2 functions on port G4, G5, G6 and G7. + // This step is not necessary if your part does not support pin muxing. + + + #define GPIO_PG4_SSI2TX GPIO_PG4_SSI2XDAT1 + #define GPIO_PG5_SSI2RX GPIO_PG5_SSI2XDAT0 + // + GPIOPinConfigure(GPIO_PG7_SSI2CLK); + GPIOPinConfigure(GPIO_PG6_SSI2FSS); + GPIOPinConfigure(GPIO_PG5_SSI2RX); + GPIOPinConfigure(GPIO_PG4_SSI2TX); + + // + // Configure the GPIO settings for the SSI pins. This function also gives + // control of these pins to the SSI hardware. Consult the data sheet to + // see which functions are allocated per pin. + // The pins are assigned as follows: + // PG4 - SSI2Tx + // PG5 - SSI2Rx + // PG6 - SSI2Fss + // PG7 - SSI2CLK + // + GPIOPinTypeSSI(GPIO_PORTG_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | + GPIO_PIN_4); + + // + // Configure and enable the SSI2 port for SPI Master mode. + // +#if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + SSIConfigSetExpClk(SSI2_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); +#else + SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); +#endif + ///-------------------------------- + + ///---------------------------- + + // + // Enable the SSI2 module. + // + SSIEnable(SSI2_BASE); +} +*/ + +/* +void +InitConsole2(void) +{ + // + // Enable GPIO port A which is used for UART0 pins. + // TODO: change this to whichever GPIO port you are using. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Configure the pin muxing for UART0 functions on port A0 and A1. + // This step is not necessary if your part does not support pin muxing. + // TODO: change this to select the port/pin you are using. + // + GPIOPinConfigure(GPIO_PA0_U0RX); + GPIOPinConfigure(GPIO_PA1_U0TX); + + // + // Enable UART0 so that we can configure the clock. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); + + // + // Use the internal 16MHz oscillator as the UART clock source. + // + UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC); + + // + // Select the alternate (UART) function for these pins. + // TODO: change this to select the port/pin you are using. + // + GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); + + // + // Initialize the UART for console I/O. + // + UARTStdioConfig(0, 115200, 16000000); +} +*/ +//***************************************************************************** +// +// Configure SSI2 in master Freescale (SPI) mode. This example will send out +// 3 bytes of data, then wait for 3 bytes of data to come in. This will all be +// done using the polling method. +// +//***************************************************************************** +int SPI_main(void) +{ +#if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + uint32_t ui32SysClock; +#endif + + uint32_t pui32DataTx[NUM_SSI_DATA]; + uint32_t pui32DataRx[NUM_SSI_DATA]; + uint32_t ui32Index; + + // + // Set the clocking to run directly from the external crystal/oscillator. + // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the + // crystal on your board. + // +#if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | + SYSCTL_OSC_MAIN | + SYSCTL_USE_OSC), 25000000); +#else + SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN | + SYSCTL_XTAL_16MHZ); +#endif + + // + // Set up the serial console to use for displaying messages. This is + // just for this example program and is not needed for SSI operation. + // + //InitConsole2(); + + // + // Display the setup on the console. + // + //UARTprintf("SSI ->\n"); + //UARTprintf(" Mode: SPI\n"); + //UARTprintf(" Data: 8-bit\n\n"); + + writeLine("SSI:"); + writeLine(" Mode: SPI"); + writeLine(" Data: 8-bit"); + + + //------------------------------------------------------------ + +// //GPIO pull ups +// GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_4,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); +// GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_5,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); +// GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_6,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); +// GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_7,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); + + // + // The SSI2 peripheral must be enabled for use. + // + SysCtlPeripheralReset(SYSCTL_PERIPH_SSI2); + SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2); + + // + // For this example SSI2 is used with PortG[7:4]. GPIO port G needs to be + // enabled so these pins can be used. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); + + // + // Configure the pin muxing for SSI2 functions on port G4, G5, G6 and G7. + // This step is not necessary if your part does not support pin muxing. + + + #define GPIO_PG4_SSI2TX GPIO_PG4_SSI2XDAT1 // AVI? + #define GPIO_PG5_SSI2RX GPIO_PG5_SSI2XDAT0 // AVI? + + + + // + GPIOPinConfigure(GPIO_PG7_SSI2CLK); + GPIOPinConfigure(GPIO_PG6_SSI2FSS); + GPIOPinConfigure(GPIO_PG5_SSI2RX); + GPIOPinConfigure(GPIO_PG4_SSI2TX); + + // + // Configure the GPIO settings for the SSI pins. This function also gives + // control of these pins to the SSI hardware. Consult the data sheet to + // see which functions are allocated per pin. + // The pins are assigned as follows: + // PG4 - SSI2Tx + // PG5 - SSI2Rx + // PG6 - SSI2Fss + // PG7 - SSI2CLK + // + GPIOPinTypeSSI(GPIO_PORTG_BASE, GPIO_PIN_7 | GPIO_PIN_6 | GPIO_PIN_5 | + GPIO_PIN_4); + + // + // Configure and enable the SSI2 port for SPI Master mode. + // + #if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + SSIConfigSetExpClk(SSI2_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); + #else + SSIConfigSetExpClk(SSI2_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); + #endif + ///-------------------------------- + + ///---------------------------- + + // + // Enable the SSI2 module. + // + SSIEnable(SSI2_BASE); + //---------------------------------------------------------------- + + +/*//--------------------------------------------------------------------- + // + // The SSI0 peripheral must be enabled for use. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0); + + // + // For this example SSI0 is used with PortA[5:2]. The actual port and pins + // used may be different on your part, consult the data sheet for more + // information. GPIO port A needs to be enabled so these pins can be used. + // TODO: change this to whichever GPIO port you are using. + // + SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); + + // + // Configure the pin muxing for SSI0 functions on port A2, A3, A4, and A5. + // This step is not necessary if your part does not support pin muxing. + // TODO: change this to select the port/pin you are using. + // + #define GPIO_PA4_SSI0RX 0x00001002 AVI? + #define GPIO_PA5_SSI0TX 0x00001402 AVI ? + + GPIOPinConfigure(GPIO_PA2_SSI0CLK); + GPIOPinConfigure(GPIO_PA3_SSI0FSS); + GPIOPinConfigure(GPIO_PA4_SSI0RX); + GPIOPinConfigure(GPIO_PA5_SSI0TX); + + // + // Configure the GPIO settings for the SSI pins. This function also gives + // control of these pins to the SSI hardware. Consult the data sheet to + // see which functions are allocated per pin. + // The pins are assigned as follows: + // PA5 - SSI0Tx + // PA4 - SSI0Rx + // PA3 - SSI0Fss + // PA2 - SSI0CLK + // TODO: change this to select the port/pin you are using. + // + GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | + GPIO_PIN_2); + + // + // Configure and enable the SSI port for SPI master mode. Use SSI0, + // system clock supply, idle clock level low and active low clock in + // freescale SPI mode, master mode, 1MHz SSI frequency, and 8-bit data. + // For SPI mode, you can set the polarity of the SSI clock when the SSI + // unit is idle. You can also configure what clock edge you want to + // capture data on. Please reference the datasheet for more information on + // the different SPI modes. + // +#if defined(TARGET_IS_TM4C129_RA0) || \ + defined(TARGET_IS_TM4C129_RA1) || \ + defined(TARGET_IS_TM4C129_RA2) + SSIConfigSetExpClk(SSI0_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); +#else + SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0, + SSI_MODE_MASTER, 1000000, 8); +#endif + + // + // Enable the SSI0 module. + // + SSIEnable(SSI0_BASE);*/ + + unsigned char Loops = 1; + while (Loops){ + //Loops--; + // + // Read any residual data from the SSI port. This makes sure the receive + // FIFOs are empty, so we don't read any unwanted junk. This is done here + // because the SPI SSI mode is full-duplex, which allows you to send and + // receive at the same time. The SSIDataGetNonBlocking function returns + // "true" when data was returned, and "false" when no data was returned. + // The "non-blocking" function checks if there is any data in the receive + // FIFO and does not "hang" if there isn't. + // + while(SSIDataGetNonBlocking(SSI2_BASE, &pui32DataRx[0])) + { + } + + + //------------------------------------------------------------------------------------------- + //SDSPI_init(); + //SDSPITiva_open(); + +/* SSIDataPut(SSI2_BASE,0xC0); + SSIDataPut(SSI2_BASE,0x51); + SSIDataPut(SSI2_BASE,0x0); + SSIDataPut(SSI2_BASE,0xff); + SSIDataPut(SSI2_BASE,0x0);*/ + + pui32DataTx[0] = 0xC0; + pui32DataTx[1] = 0x51; + pui32DataTx[2] = 0x0; + pui32DataTx[3] = 0xff; + pui32DataTx[4] = 0x0; + + //------------------------------------------------------------------------------------------ + // + // Initialize the data to send. + // +/* + pui32DataTx[0] = 'A'; + pui32DataTx[1] = 's'; + pui32DataTx[2] = 'p'; + pui32DataTx[3] = 'i'; + pui32DataTx[4] = 'A'; +*/ + // + // Display indication that the SSI is transmitting data. + // + //UARTprintf("Sent:\n "); + + writeLine("Sent: "); + + // + // Send 3 bytes of data. + // + // char temp[2]; + //temp[1] = '\0'; + + for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++) + { + // + // Display the data that SSI is transferring. + // + //UARTprintf("'%c' ", pui32DataTx[ui32Index]); + + + //temp[0] = pui32DataTx[ui32Index]; + //writeString(temp); + writeFloat (pui32DataTx[ui32Index]); + writeString(" "); + + + // + // Send the data using the "blocking" put function. This function + // will wait until there is room in the send FIFO before returning. + // This allows you to assure that all the data you send makes it into + // the send FIFO. + // + SSIDataPut(SSI2_BASE, pui32DataTx[ui32Index]); + } + + // + // Wait until SSI2 is done transferring all the data in the transmit FIFO. + // + while(SSIBusy(SSI2_BASE)) + { + } + + // + // Display indication that the SSI is receiving data. + // + //UARTprintf("\nReceived:\n "); + writeLine("Received: "); + + // + // Receive 3 bytes of data. + // + for(ui32Index = 0; ui32Index < NUM_SSI_DATA; ui32Index++) + { + // + // Receive the data using the "blocking" Get function. This function + // will wait until there is data in the receive FIFO before returning. + // + SSIDataGet(SSI2_BASE, &pui32DataRx[ui32Index]); + + // + // Since we are using 8-bit data, mask off the MSB. + // + pui32DataRx[ui32Index] &= 0x00FF; + + // + // Display the data that SSI2 received. + // + //UARTprintf("'%c' ", pui32DataRx[ui32Index]); + + //temp[0] = pui32DataRx[ui32Index]; + //writeString(temp); + writeFloat (pui32DataRx[ui32Index]); + writeString(" "); + } + + // + // Return no errors + // + Loops =2; + + }//while(1) + return(0); +} diff --git a/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.h b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.h new file mode 100644 index 000000000..1a047b695 --- /dev/null +++ b/Software/Code_Composer/twine_usblib_demo/drivers/SPI/spi_master.h @@ -0,0 +1 @@ +int SPI_main(void); diff --git a/Software/Code_Composer/twine_usblib_demo/main.c b/Software/Code_Composer/twine_usblib_demo/main.c index 7ffd95043..7c497f869 100644 --- a/Software/Code_Composer/twine_usblib_demo/main.c +++ b/Software/Code_Composer/twine_usblib_demo/main.c @@ -1,4 +1,5 @@ #include <drivers/Flash_Memory/Flash_Memory.h> +#include <drivers/FPGA/FPGA.h> #include <protobuf-c/person-pb-c.h> #include <stdbool.h> #include <stdlib.h> @@ -45,6 +46,12 @@ #include <Stubs_Handler/DataDef.h> //#include "Stubs_Handler/Buzzer.h" +#include "Stubs_Handler/temperature_sensor.h" + +#include "drivers/SPI/spi_master.h" +#include "drivers/SPI/SPI_Comm.h" + + //***************************************************************************** // @@ -87,10 +94,20 @@ void USB0Handler(void) InitUSB(); } + +int a = 5; + +void HandleSSI2(void) +{ + a++; +} + + int main(void) { uint32_t ui32SysClock, ui32PLLRate; + // Set the system clock to run at 120MHz from the PLL. ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | @@ -102,6 +119,8 @@ int main(void) // Save the PLL rate used by this application. SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate); + + // Enable the system tick. ROM_SysTickPeriodSet(ui32SysClock / TICKS_PER_SECOND); ROM_SysTickIntEnable(); @@ -113,10 +132,19 @@ int main(void) /////////////// tests by AVI //Ext_Flash_Operation(TX,5); //SoundExample(); + //temperature_main(); + //test_FPGA(); + + //SPI_main(); + // SPI_Control(); + + ///////////////////// RegisterReceiveCallback(&receive_callback); StartUSB(ui32SysClock); + + while(1){}; } diff --git a/Software/Code_Composer/twine_usblib_demo/tm4c129xnczad_startup_ccs.c b/Software/Code_Composer/twine_usblib_demo/tm4c129xnczad_startup_ccs.c index 562bb6ff8..578215d2a 100644 --- a/Software/Code_Composer/twine_usblib_demo/tm4c129xnczad_startup_ccs.c +++ b/Software/Code_Composer/twine_usblib_demo/tm4c129xnczad_startup_ccs.c @@ -60,6 +60,7 @@ extern uint32_t __STACK_TOP; extern void SysTickHandler(void); extern void USB0Handler(void); extern void USB0DeviceIntHandler(void); +extern void HandleSSI2(void); //***************************************************************************** // @@ -142,7 +143,7 @@ void (* const g_pfnVectors[])(void) = IntDefaultHandler, // GPIO Port J IntDefaultHandler, // GPIO Port K IntDefaultHandler, // GPIO Port L - IntDefaultHandler, // SSI2 Rx and Tx + HandleSSI2, // SSI2 Rx and Tx IntDefaultHandler, // SSI3 Rx and Tx IntDefaultHandler, // UART3 Rx and Tx IntDefaultHandler, // UART4 Rx and Tx |
