po_hi_driver_pus_packet.c 745 Bytes
Newer Older
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

#include <po_hi_types.h>
#include <drivers/po_hi_driver_pus_packet.h>


void __po_hi_driver_pus_packet_init (__po_hi_driver_pus_packet_t* pkt)
{
   pkt.id.version = 0;
}

__po_hi_driver_pus_packet_error_t __po_hi_driver_pus_packet_check (__po_hi_driver_pus_packet_t* pkt)
{
      if ((pkt.header.id.type == PO_HI_DRIVER_PUS_PACKET_TYPE_TC) && (pkt.header.id.flag == 0))
      {
         return __PO_HI_DRIVER_PUS_PACKET_ERROR_FLAG;
      }

      if (pkg.header.id.version != 0)
      {
         return __PO_HI_DRIVER_PUS_PACKET_ERROR_VERSION;
      }


      if (pkg.data.header.ccsds_secondary_flag != 0)
      {
         return __PO_HI_DRIVER_PUS_PACKET_ERROR_DATA_CCSDS_FLAG;
      }

   return __PO_HI_DRIVER_PUS_PACKET_ERROR_NO_ERROR;
}