aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Common/CheckSum/Checksum.c
blob: 5e7e7a0b5663d39cdb6064ac45ecf230ff0722c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
 * Checksum.c
 *
 *  Created on: May 7, 2020
 *      Author: avi
 */

#include <stdint.h>
#include <stdbool.h>
#include "Include.h"
#include "driverlib/crc.h"
//*****************************************************************************
//
//! CheckSum() Calculates an 8 bit checksum
//!
//! \param pui8Data is a pointer to an array of 8 bit data of size ui8Size.
//! \param ui8Size is the size of the array that will run through the checksum
//!     algorithm.
//!
//! This function simply calculates an 8 bit checksum on the data passed in.
//!
//! \return The function returns the calculated checksum.
//
//*****************************************************************************
uint8_t
CheckSum8bit(uint8_t *pui8Data, uint8_t ui8Size)
{
    int32_t i;
    uint8_t ui8CheckSum;

    ui8CheckSum = 0;

    for(i = 0; i < ui8Size; ++i)
    {
        ui8CheckSum += pui8Data[i];
    }
    return(ui8CheckSum);
}


//*****************************************************************************
//
//! Calculates an 8-bit checksum
//!
//! \param pui8Data is a pointer to an array of 8-bit data of size ui32Size.
//! \param ui32Size is the size of the array that will run through the checksum
//! algorithm.
//!
//! This function simply calculates an 8-bit checksum on the data passed in.
//!
//! \return Returns the calculated checksum.
//
//*****************************************************************************
uint32_t
CheckSum32bit(const uint8_t *pui8Data, uint32_t ui32Size)
{
    uint32_t ui32CheckSum;

    //
    // Initialize the checksum to zero.
    //
    ui32CheckSum = 0;

    //
    // Add up all the bytes, do not do anything for an overflow.
    //
    while(ui32Size--)
    {
        ui32CheckSum += *pui8Data++;
    }

    //
    // Return the calculated check sum.
    //
    return(ui32CheckSum & 0xff);
}

void
InitCRC32(void)
//http://e2e.ti.com/support/microcontrollers/other/f/908/t/360408
//C:\TI\TivaWare_C_Series-2.1.4.178\examples\boards\dk-tm4c129x\crc32
{
    //
    // Enable the CRC module.
    //
    SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
    //
    // Wait for the CRC module to be ready.
    //
    while(!SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
    {
    }
    //
    // Configure the CRC module.
    //
    CRCConfigSet(CCM0_BASE,
    CRC_CFG_INIT_SEED |
    CRC_CFG_TYPE_P4C11DB7 |
    CRC_CFG_SIZE_32BIT);
    //
    // Set the seed value.
    //
    CRCSeedSet(CCM0_BASE, 0x5a5a5a5a);
}


bool Test_CRC32()
{

    uint32_t g_ui32Result;
    // Random data for generating CRC.
    //
    uint32_t g_ui32RandomData[16] =
    {
    0x8a5f1b22, 0xcb935d29, 0xcc1ac092, 0x5dad8c9e,
    0x6a83b39f, 0x8607dc60, 0xda0ba4d2, 0xf49b0fa2,
    0xaf35d524, 0xffa8001d, 0xbcc931e8, 0x4a2c99ef,
    0x7fa297ab, 0xab943bae, 0x07c61cc4, 0x47c8627d
    };

    InitCRC32();
    //
    // Process the data and get the result. The result should be
    // 0x75fd6f5c.
    //
    g_ui32Result = CRCDataProcess(CCM0_BASE, g_ui32RandomData, (sizeof(g_ui32RandomData) / sizeof(uint32_t)), false);

    if(g_ui32Result == 0x75fd6f5c)
    {
        return OK;
    }

    return ERROR;
}
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: StubFPGAReadVersionResponse.proto

#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "StubFPGAReadVersionResponse.pb.h"

#include <algorithm>

#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/port.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)

namespace Tango {
namespace PMR {
namespace Stubs {
class StubFPGAReadVersionResponseDefaultTypeInternal {
public:
 ::google::protobuf::internal::ExplicitlyConstructed<StubFPGAReadVersionResponse>
     _instance;
} _StubFPGAReadVersionResponse_default_instance_;

namespace protobuf_StubFPGAReadVersionResponse_2eproto {


namespace {

::google::protobuf::Metadata file_level_metadata[1];

}  // namespace

PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTableField
    const TableStruct::entries[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  {0, 0, 0, ::google::protobuf::internal::kInvalidMask, 0, 0},
};

PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::AuxillaryParseTableField
    const TableStruct::aux[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ::google::protobuf::internal::AuxillaryParseTableField(),
};
PROTOBUF_CONSTEXPR_VAR ::google::protobuf::internal::ParseTable const
    TableStruct::schema[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { NULL, NULL, 0, -1, -1, -1, -1, NULL, false },
};

const ::google::protobuf::uint32 TableStruct::offsets[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, fpgaid_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, day_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, month_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, year_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, ver_num_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, status_),
  GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StubFPGAReadVersionResponse, statusword_),
};
static const ::google::protobuf::internal::MigrationSchema schemas[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, sizeof(StubFPGAReadVersionResponse)},
};

static ::google::protobuf::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::google::protobuf::Message*>(&_StubFPGAReadVersionResponse_default_instance_),
};

namespace {

void protobuf_AssignDescriptors() {
  AddDescriptors();
  ::google::protobuf::MessageFactory* factory = NULL;
  AssignDescriptors(
      "StubFPGAReadVersionResponse.proto", schemas, file_default_instances, TableStruct::offsets, factory,
      file_level_metadata, NULL, NULL);
}

void protobuf_AssignDescriptorsOnce() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &protobuf_AssignDescriptors);
}

void protobuf_RegisterTypes(const ::std::string&) GOOGLE_ATTRIBUTE_COLD;
void protobuf_RegisterTypes(const ::std::string&) {
  protobuf_AssignDescriptorsOnce();
  ::google::protobuf::internal::RegisterAllTypes(file_level_metadata, 1);
}

}  // namespace
void TableStruct::InitDefaultsImpl() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  ::google::protobuf::internal::InitProtobufDefaults();
  _StubFPGAReadVersionResponse_default_instance_._instance.DefaultConstruct();
  ::google::protobuf::internal::OnShutdownDestroyMessage(
      &_StubFPGAReadVersionResponse_default_instance_);}

void InitDefaults() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &TableStruct::InitDefaultsImpl);
}
namespace {
void AddDescriptorsImpl() {
  InitDefaults();
  static const char descriptor[] GOOGLE_ATTRIBUTE_SECTION_VARIABLE(protodesc_cold) = {
      "\n!StubFPGAReadVersionResponse.proto\022\017Tan"
      "go.PMR.Stubs\"\214\001\n\033StubFPGAReadVersionResp"
      "onse\022\016\n\006FPGAId\030\001 \001(\r\022\013\n\003Day\030\002 \001(\r\022\r\n\005Mon"
      "th\030\003 \001(\r\022\014\n\004Year\030\004 \001(\r\022\017\n\007Ver_num\030\005 \001(\r\022"
      "\016\n\006Status\030\006 \001(\t\022\022\n\nStatusWord\030\007 \001(\rB\033\n\031c"
      "om.twine.tango.pmr.stubsb\006proto3"
  };
  ::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
      descriptor, 232);
  ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
    "StubFPGAReadVersionResponse.proto", &protobuf_RegisterTypes);
}
} // anonymous namespace

void AddDescriptors() {
  static GOOGLE_PROTOBUF_DECLARE_ONCE(once);
  ::google::protobuf::GoogleOnceInit(&once, &AddDescriptorsImpl);
}
// Force AddDescriptors() to be called at dynamic initialization time.
struct StaticDescriptorInitializer {
  StaticDescriptorInitializer() {
    AddDescriptors();
  }
} static_descriptor_initializer;

}  // namespace protobuf_StubFPGAReadVersionResponse_2eproto


// ===================================================================

#if !defined(_MSC_VER) || _MSC_VER >= 1900
const int StubFPGAReadVersionResponse::kFPGAIdFieldNumber;
const int StubFPGAReadVersionResponse::kDayFieldNumber;
const int StubFPGAReadVersionResponse::kMonthFieldNumber;
const int StubFPGAReadVersionResponse::kYearFieldNumber;
const int StubFPGAReadVersionResponse::kVerNumFieldNumber;
const int StubFPGAReadVersionResponse::kStatusFieldNumber;
const int StubFPGAReadVersionResponse::kStatusWordFieldNumber;
#endif  // !defined(_MSC_VER) || _MSC_VER >= 1900

StubFPGAReadVersionResponse::StubFPGAReadVersionResponse()
  : ::google::protobuf::Message(), _internal_metadata_(NULL) {
  if (GOOGLE_PREDICT_TRUE(this != internal_default_instance())) {
    protobuf_StubFPGAReadVersionResponse_2eproto::InitDefaults();
  }
  SharedCtor();
  // @@protoc_insertion_point(constructor:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
}
StubFPGAReadVersionResponse::StubFPGAReadVersionResponse(const StubFPGAReadVersionResponse& from)
  : ::google::protobuf::Message(),
      _internal_metadata_(NULL),
      _cached_size_(0) {
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  status_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  if (from.status().size() > 0) {
    status_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.status_);
  }
  ::memcpy(&fpgaid_, &from.fpgaid_,
    static_cast<size_t>(reinterpret_cast<char*>(&statusword_) -
    reinterpret_cast<char*>(&fpgaid_)) + sizeof(statusword_));
  // @@protoc_insertion_point(copy_constructor:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
}

void StubFPGAReadVersionResponse::SharedCtor() {
  status_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&fpgaid_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&statusword_) -
      reinterpret_cast<char*>(&fpgaid_)) + sizeof(statusword_));
  _cached_size_ = 0;
}

StubFPGAReadVersionResponse::~StubFPGAReadVersionResponse() {
  // @@protoc_insertion_point(destructor:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  SharedDtor();
}

void StubFPGAReadVersionResponse::SharedDtor() {
  status_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}

void StubFPGAReadVersionResponse::SetCachedSize(int size) const {
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StubFPGAReadVersionResponse::descriptor() {
  protobuf_StubFPGAReadVersionResponse_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_StubFPGAReadVersionResponse_2eproto::file_level_metadata[kIndexInFileMessages].descriptor;
}

const StubFPGAReadVersionResponse& StubFPGAReadVersionResponse::default_instance() {
  protobuf_StubFPGAReadVersionResponse_2eproto::InitDefaults();
  return *internal_default_instance();
}

StubFPGAReadVersionResponse* StubFPGAReadVersionResponse::New(::google::protobuf::Arena* arena) const {
  StubFPGAReadVersionResponse* n = new StubFPGAReadVersionResponse;
  if (arena != NULL) {
    arena->Own(n);
  }
  return n;
}

void StubFPGAReadVersionResponse::Clear() {
// @@protoc_insertion_point(message_clear_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  ::google::protobuf::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  status_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
  ::memset(&fpgaid_, 0, static_cast<size_t>(
      reinterpret_cast<char*>(&statusword_) -
      reinterpret_cast<char*>(&fpgaid_)) + sizeof(statusword_));
  _internal_metadata_.Clear();
}

bool StubFPGAReadVersionResponse::MergePartialFromCodedStream(
    ::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!GOOGLE_PREDICT_TRUE(EXPRESSION)) goto failure
  ::google::protobuf::uint32 tag;
  // @@protoc_insertion_point(parse_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  for (;;) {
    ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoffNoLastTag(127u);
    tag = p.first;
    if (!p.second) goto handle_unusual;
    switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
      // uint32 FPGAId = 1;
      case 1: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(8u /* 8 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &fpgaid_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // uint32 Day = 2;
      case 2: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(16u /* 16 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &day_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // uint32 Month = 3;
      case 3: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(24u /* 24 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &month_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // uint32 Year = 4;
      case 4: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(32u /* 32 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &year_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // uint32 Ver_num = 5;
      case 5: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(40u /* 40 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &ver_num_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // string Status = 6;
      case 6: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(50u /* 50 & 0xFF */)) {
          DO_(::google::protobuf::internal::WireFormatLite::ReadString(
                input, this->mutable_status()));
          DO_(::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
            this->status().data(), static_cast<int>(this->status().length()),
            ::google::protobuf::internal::WireFormatLite::PARSE,
            "Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status"));
        } else {
          goto handle_unusual;
        }
        break;
      }

      // uint32 StatusWord = 7;
      case 7: {
        if (static_cast< ::google::protobuf::uint8>(tag) ==
            static_cast< ::google::protobuf::uint8>(56u /* 56 & 0xFF */)) {

          DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
                   ::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
                 input, &statusword_)));
        } else {
          goto handle_unusual;
        }
        break;
      }

      default: {
      handle_unusual:
        if (tag == 0) {
          goto success;
        }
        DO_(::google::protobuf::internal::WireFormat::SkipField(
              input, tag, _internal_metadata_.mutable_unknown_fields()));
        break;
      }
    }
  }
success:
  // @@protoc_insertion_point(parse_success:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  return true;
failure:
  // @@protoc_insertion_point(parse_failure:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  return false;
#undef DO_
}

void StubFPGAReadVersionResponse::SerializeWithCachedSizes(
    ::google::protobuf::io::CodedOutputStream* output) const {
  // @@protoc_insertion_point(serialize_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // uint32 FPGAId = 1;
  if (this->fpgaid() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->fpgaid(), output);
  }

  // uint32 Day = 2;
  if (this->day() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->day(), output);
  }

  // uint32 Month = 3;
  if (this->month() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(3, this->month(), output);
  }

  // uint32 Year = 4;
  if (this->year() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->year(), output);
  }

  // uint32 Ver_num = 5;
  if (this->ver_num() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->ver_num(), output);
  }

  // string Status = 6;
  if (this->status().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->status().data(), static_cast<int>(this->status().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status");
    ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
      6, this->status(), output);
  }

  // uint32 StatusWord = 7;
  if (this->statusword() != 0) {
    ::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->statusword(), output);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    ::google::protobuf::internal::WireFormat::SerializeUnknownFields(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), output);
  }
  // @@protoc_insertion_point(serialize_end:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
}

::google::protobuf::uint8* StubFPGAReadVersionResponse::InternalSerializeWithCachedSizesToArray(
    bool deterministic, ::google::protobuf::uint8* target) const {
  (void)deterministic; // Unused
  // @@protoc_insertion_point(serialize_to_array_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // uint32 FPGAId = 1;
  if (this->fpgaid() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->fpgaid(), target);
  }

  // uint32 Day = 2;
  if (this->day() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->day(), target);
  }

  // uint32 Month = 3;
  if (this->month() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(3, this->month(), target);
  }

  // uint32 Year = 4;
  if (this->year() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->year(), target);
  }

  // uint32 Ver_num = 5;
  if (this->ver_num() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->ver_num(), target);
  }

  // string Status = 6;
  if (this->status().size() > 0) {
    ::google::protobuf::internal::WireFormatLite::VerifyUtf8String(
      this->status().data(), static_cast<int>(this->status().length()),
      ::google::protobuf::internal::WireFormatLite::SERIALIZE,
      "Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status");
    target =
      ::google::protobuf::internal::WireFormatLite::WriteStringToArray(
        6, this->status(), target);
  }

  // uint32 StatusWord = 7;
  if (this->statusword() != 0) {
    target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->statusword(), target);
  }

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  return target;
}

size_t StubFPGAReadVersionResponse::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  size_t total_size = 0;

  if ((_internal_metadata_.have_unknown_fields() &&  ::google::protobuf::internal::GetProto3PreserveUnknownsDefault())) {
    total_size +=
      ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
        (::google::protobuf::internal::GetProto3PreserveUnknownsDefault()   ? _internal_metadata_.unknown_fields()   : _internal_metadata_.default_instance()));
  }
  // string Status = 6;
  if (this->status().size() > 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::StringSize(
        this->status());
  }

  // uint32 FPGAId = 1;
  if (this->fpgaid() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->fpgaid());
  }

  // uint32 Day = 2;
  if (this->day() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->day());
  }

  // uint32 Month = 3;
  if (this->month() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->month());
  }

  // uint32 Year = 4;
  if (this->year() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->year());
  }

  // uint32 Ver_num = 5;
  if (this->ver_num() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->ver_num());
  }

  // uint32 StatusWord = 7;
  if (this->statusword() != 0) {
    total_size += 1 +
      ::google::protobuf::internal::WireFormatLite::UInt32Size(
        this->statusword());
  }

  int cached_size = ::google::protobuf::internal::ToCachedSize(total_size);
  GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
  _cached_size_ = cached_size;
  GOOGLE_SAFE_CONCURRENT_WRITES_END();
  return total_size;
}

void StubFPGAReadVersionResponse::MergeFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  GOOGLE_DCHECK_NE(&from, this);
  const StubFPGAReadVersionResponse* source =
      ::google::protobuf::internal::DynamicCastToGenerated<const StubFPGAReadVersionResponse>(
          &from);
  if (source == NULL) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
    ::google::protobuf::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
    MergeFrom(*source);
  }
}

void StubFPGAReadVersionResponse::MergeFrom(const StubFPGAReadVersionResponse& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom(from._internal_metadata_);
  ::google::protobuf::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  if (from.status().size() > 0) {

    status_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.status_);
  }
  if (from.fpgaid() != 0) {
    set_fpgaid(from.fpgaid());
  }
  if (from.day() != 0) {
    set_day(from.day());
  }
  if (from.month() != 0) {
    set_month(from.month());
  }
  if (from.year() != 0) {
    set_year(from.year());
  }
  if (from.ver_num() != 0) {
    set_ver_num(from.ver_num());
  }
  if (from.statusword() != 0) {
    set_statusword(from.statusword());
  }
}

void StubFPGAReadVersionResponse::CopyFrom(const ::google::protobuf::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void StubFPGAReadVersionResponse::CopyFrom(const StubFPGAReadVersionResponse& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:Tango.PMR.Stubs.StubFPGAReadVersionResponse)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool StubFPGAReadVersionResponse::IsInitialized() const {
  return true;
}

void StubFPGAReadVersionResponse::Swap(StubFPGAReadVersionResponse* other) {
  if (other == this) return;
  InternalSwap(other);
}
void StubFPGAReadVersionResponse::InternalSwap(StubFPGAReadVersionResponse* other) {
  using std::swap;
  status_.Swap(&other->status_);
  swap(fpgaid_, other->fpgaid_);
  swap(day_, other->day_);
  swap(month_, other->month_);
  swap(year_, other->year_);
  swap(ver_num_, other->ver_num_);
  swap(statusword_, other->statusword_);
  _internal_metadata_.Swap(&other->_internal_metadata_);
  swap(_cached_size_, other->_cached_size_);
}

::google::protobuf::Metadata StubFPGAReadVersionResponse::GetMetadata() const {
  protobuf_StubFPGAReadVersionResponse_2eproto::protobuf_AssignDescriptorsOnce();
  return protobuf_StubFPGAReadVersionResponse_2eproto::file_level_metadata[kIndexInFileMessages];
}

#if PROTOBUF_INLINE_NOT_IN_HEADERS
// StubFPGAReadVersionResponse

// uint32 FPGAId = 1;
void StubFPGAReadVersionResponse::clear_fpgaid() {
  fpgaid_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::fpgaid() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.FPGAId)
  return fpgaid_;
}
void StubFPGAReadVersionResponse::set_fpgaid(::google::protobuf::uint32 value) {
  
  fpgaid_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.FPGAId)
}

// uint32 Day = 2;
void StubFPGAReadVersionResponse::clear_day() {
  day_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::day() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Day)
  return day_;
}
void StubFPGAReadVersionResponse::set_day(::google::protobuf::uint32 value) {
  
  day_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Day)
}

// uint32 Month = 3;
void StubFPGAReadVersionResponse::clear_month() {
  month_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::month() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Month)
  return month_;
}
void StubFPGAReadVersionResponse::set_month(::google::protobuf::uint32 value) {
  
  month_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Month)
}

// uint32 Year = 4;
void StubFPGAReadVersionResponse::clear_year() {
  year_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::year() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Year)
  return year_;
}
void StubFPGAReadVersionResponse::set_year(::google::protobuf::uint32 value) {
  
  year_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Year)
}

// uint32 Ver_num = 5;
void StubFPGAReadVersionResponse::clear_ver_num() {
  ver_num_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::ver_num() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Ver_num)
  return ver_num_;
}
void StubFPGAReadVersionResponse::set_ver_num(::google::protobuf::uint32 value) {
  
  ver_num_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Ver_num)
}

// string Status = 6;
void StubFPGAReadVersionResponse::clear_status() {
  status_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
const ::std::string& StubFPGAReadVersionResponse::status() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
  return status_.GetNoArena();
}
void StubFPGAReadVersionResponse::set_status(const ::std::string& value) {
  
  status_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
}
#if LANG_CXX11
void StubFPGAReadVersionResponse::set_status(::std::string&& value) {
  
  status_.SetNoArena(
    &::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
  // @@protoc_insertion_point(field_set_rvalue:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
}
#endif
void StubFPGAReadVersionResponse::set_status(const char* value) {
  GOOGLE_DCHECK(value != NULL);
  
  status_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
  // @@protoc_insertion_point(field_set_char:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
}
void StubFPGAReadVersionResponse::set_status(const char* value, size_t size) {
  
  status_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
      ::std::string(reinterpret_cast<const char*>(value), size));
  // @@protoc_insertion_point(field_set_pointer:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
}
::std::string* StubFPGAReadVersionResponse::mutable_status() {
  
  // @@protoc_insertion_point(field_mutable:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
  return status_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
::std::string* StubFPGAReadVersionResponse::release_status() {
  // @@protoc_insertion_point(field_release:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
  
  return status_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
void StubFPGAReadVersionResponse::set_allocated_status(::std::string* status) {
  if (status != NULL) {
    
  } else {
    
  }
  status_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), status);
  // @@protoc_insertion_point(field_set_allocated:Tango.PMR.Stubs.StubFPGAReadVersionResponse.Status)
}

// uint32 StatusWord = 7;
void StubFPGAReadVersionResponse::clear_statusword() {
  statusword_ = 0u;
}
::google::protobuf::uint32 StubFPGAReadVersionResponse::statusword() const {
  // @@protoc_insertion_point(field_get:Tango.PMR.Stubs.StubFPGAReadVersionResponse.StatusWord)
  return statusword_;
}
void StubFPGAReadVersionResponse::set_statusword(::google::protobuf::uint32 value) {
  
  statusword_ = value;
  // @@protoc_insertion_point(field_set:Tango.PMR.Stubs.StubFPGAReadVersionResponse.StatusWord)
}

#endif  // PROTOBUF_INLINE_NOT_IN_HEADERS

// @@protoc_insertion_point(namespace_scope)

}  // namespace Stubs
}  // namespace PMR
}  // namespace Tango

// @@protoc_insertion_point(global_scope)