CORDET Framework - C2 Implementation
CrPsUtilitiesServLpt.c
Go to the documentation of this file.
1 
21 #include "CrPsUtilitiesServLpt.h"
22 #include "Pckt/CrFwPckt.h" /* --- interface to adaptation point CrFwPckt --- */
23 
24 /* CrFramework includes */
27 #include <CrFwCmpData.h>
28 
29 /* FwProfile includes */
30 #include <FwPrCore.h>
31 #include <FwPrConfig.h>
32 #include <FwSmConfig.h>
33 
37 
38 #include <DataPool/CrPsDp.h>
39 #include <DataPool/CrPsDpServLpt.h>
40 
41 #include <time.h>
42 #include <stdlib.h>
43 
44 /* global handles for the procedures */
45 FwPrDesc_t prDescLptUpCmdStart;
46 FwSmDesc_t smDescLpt;
47 
48 
53 {
54  /***********************************************************************/
55  /* Service Large Packet Transfer Procedure */
56  /***********************************************************************/
57  prDescLptUpCmdStart = CrPsLptUpCmdStartCreate(NULL);
58  if (FwPrCheck(prDescLptUpCmdStart) != prSuccess)
59  {
60  return EXIT_FAILURE;
61  }
62 
63  /***********************************************************************/
64  /* Service Large Packet Transfer State Machine */
65  /***********************************************************************/
66  smDescLpt = CrPsLptCreate(NULL);
67  if (FwSmCheckRec(smDescLpt) != smSuccess)
68  {
69  return EXIT_FAILURE;
70  }
71  FwSmStart(smDescLpt);
72 
73  /* initialize Datapool Values */
74  initDpServLpt();
75 
76  {
78  }
79  return EXIT_SUCCESS;
80 }
81 
86 {
87  FwSmMakeTrans(smDescLpt, Execute);
88 
89  return;
90 }
91 
96 {
97  /* NOP */
98 
99  return;
100 }
101 
105 inline FwPrDesc_t getPrDescLptUpCmdStart()
106 {
107  return prDescLptUpCmdStart;
108 }
109 
113 inline FwSmDesc_t getSmDescLpt()
114 {
115  return smDescLpt;
116 }
117 
130 {
131  struct timespec now;
132  time_t coarse;
133  uint32_t fine;
134  CrFwTimeStamp_t ts; /* unsigned char struct.t[6] */
135 
136  clock_gettime(CLOCK_REALTIME, &now);
137  coarse = now.tv_sec;
138  fine = (uint32_t)(32.768 * (float)now.tv_nsec / (float)1000000);
139 
140  ts.t[3] = coarse & 0xff;
141  ts.t[2] = (coarse >> 8) & 0xff;
142  ts.t[1] = (coarse >> 16) & 0xff;
143  ts.t[0] = (coarse >> 24) & 0xff;
144  ts.t[4] = (fine >> 7) & 0x7f;
145  ts.t[5] = fine & 0xfe;
146 
147  return ts;
148 }
FwPrDesc_t getPrDescLptUpCmdStart()
Getter for LptUpCmdStart procedure descriptor.
Create one instance of the CrPsLptUpCmdStart procedure.
Interface for accessing data pool items.
Definition of the OutFactory component.
static void setDplptSizeItem(int i, CrPsSize_t lptSize)
Sets the value of the i-th element in the datapool array lptSize.
uint32_t getLptMemSize(uint32_t LptBuffer)
Getter function to return the size of the Data.
Header file to define all service and packet identifiers.
Interface for creating and accessing a report or command packet.
Interface through which applications can initialize and execute framework PUS extension components...
Create one instance of the CrPsLpt state machine.
void CrPsExecServLpt()
Execution of CORDET Framework PUS Extension components.
void initDpServLpt(void)
Initialises ServLpt.
Definition: CrPsDpServLpt.c:32
FwSmDesc_t CrPsLptCreate(void *smData)
CrPsLpt function definitions.
Definition: CrPsLptCreate.c:34
FwSmDesc_t getSmDescLpt()
Getter for Lpt state machine descriptor.
FwPrDesc_t CrPsLptUpCmdStartCreate(void *prData)
Create a new procedure descriptor.
void CrPsExecServLptSm()
Execution of CORDET Framework PUS Extension components.
int CrPsInitServLpt()
Initialization of CORDET Framework PUS Extension components.
Interface for accessing data pool items.
Definition of the OutLoader component.
CrFwTimeStamp_t CrFwGetCurrentTimeServer()
Provide the current time.
#define Execute
The identifiers of transition commands (triggers)
Definition: CrPsLptCreate.h:48
unsigned int CrFwTimeStamp_t
Type used for the time stamp of a command or report.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved