po_hi_driver_pus_packet.c 1.01 KB
Newer Older
julien.delange's avatar
julien.delange committed
1
2
3
4
5
/*
 * This is a part of PolyORB-HI-C distribution, a minimal
 * middleware written for generated code from AADL models.
 * You should use it with the Ocarina toolsuite.
 *
yoogx's avatar
yoogx committed
6
 * For more informations, please visit http://taste.tuxfamily.org/wiki
julien.delange's avatar
julien.delange committed
7
 *
yoogx's avatar
yoogx committed
8
 * Copyright (C) 2010-2014 ESA & ISAE.
julien.delange's avatar
julien.delange committed
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

#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;
}