CORDET Framework - C2 Implementation
CrPsLptDownInterRep.c
Go to the documentation of this file.
1 
24 #include "CrPsLptDownInterRep.h"
25 
26 /* CrFramework includes */
27 #include "OutCmp/CrFwOutCmp.h"
28 #include "CrFwCmpData.h"
29 #include "Pckt/CrFwPckt.h"
30 
31 /* FwProfile includes */
32 #include "FwPrConfig.h"
33 #include "FwPrCore.h"
34 #include "FwSmConfig.h"
35 
36 #include <CrPsUtilitiesServLpt.h>
37 #include <DataPool/CrPsDpServLpt.h>
42 
43 
51 {
52  uint16_t sm_state;
53 
54  CRFW_UNUSED(smDesc);
55 
56  sm_state = FwSmGetCurState(getSmDescLpt());
57  if (sm_state == CrPsLpt_DOWN_TRANSFER)
58  {
59  return 1;
60  }
61  else
62  {
63  return 0;
64  }
65 }
66 
74 {
75  uint32_t LptBufferId;
76 
77  CRFW_UNUSED(smDesc);
78 
79  LptBufferId = DownTransferLptBufferId;
80 
81  if (getDplptRemSizeItem(LptBufferId) > CR_FW_MAX_PCKT_LENGTH - (sizeof(TmHeader_t) + sizeof(CrPsTid_t) + sizeof(CrPsNumberU4_t) + CRC_LENGTH))
82  {
83  return 1;
84  }
85  else
86  {
87  return 0;
88  }
89 }
90 
98 void CrPsLptDownInterRepUpdateAction(FwSmDesc_t smDesc)
99 {
100  CrFwCmpData_t *cmpData;
101  CrFwOutCmpData_t *cmpSpecificData;
102  CrFwPckt_t pckt;
103  uint32_t *lptMemStartAddr;
104  uint32_t LptBufferId;
105  CrPsSize_t partSize, lptRemSize;
106  CrPsTid_t Tid;
107  CrPsNumberU4_t PartSeqNmb;
108 
109  cmpData = (CrFwCmpData_t *) FwSmGetData(smDesc);
110  cmpSpecificData = (CrFwOutCmpData_t *) cmpData->cmpSpecificData;
111  pckt = cmpSpecificData->pckt;
112 
113  LptBufferId = DownTransferLptBufferId;
114 
115  /* set the transaction identifier equal to largeMsgTransId */
116  Tid = getDplargeMsgTransIdItem(LptBufferId);
117  setLptDownInterRepTid(pckt, Tid);
118 
119  /* set the partnumber equal to partSeqNmb */
120  PartSeqNmb = getDppartSeqNmbItem(LptBufferId);
121  setLptDownInterRepPartSeqNmb(pckt, PartSeqNmb);
122 
123  /* Load the first part of the large packet from the LPT Buffer */
124  lptMemStartAddr = getLptMemStartAddr(LptBufferId); /* Adaptation Point */
125  partSize = (CR_FW_MAX_PCKT_LENGTH - (sizeof(TmHeader_t) + sizeof(CrPsTid_t) + sizeof(CrPsNumberU4_t) + CRC_LENGTH));
126  setLptDownFirstRepPart(pckt, (uint8_t *)lptMemStartAddr + (PartSeqNmb-1)*partSize, partSize);
127 
128  /* increment partSeqNmb */
129  PartSeqNmb++;
130  setDppartSeqNmbItem(LptBufferId, PartSeqNmb);
131 
132  /* decrement lptRemSize by partSize */
133  lptRemSize = getDplptRemSizeItem(LptBufferId) - partSize;
134  setDplptRemSizeItem(LptBufferId, lptRemSize);
135 
136  return;
137 }
Implementation of TM(13,2) LptDownInterRep.
Type for the Framework Component Data (FCD).
CrFwBool_t CrPsLptDownInterRepRepeatCheck(FwSmDesc_t smDesc)
Repeat check of TM(13,2) LptDownInterRep.
#define CR_FW_MAX_PCKT_LENGTH
The maximum size in number of bytes of a packet.
#define CRFW_UNUSED(x)
A macro that can be used to specify that a function parameter is not used.
Definition: CrFwConstants.h:27
static CrPsSize_t getDplptRemSizeItem(int i)
Gets the value of the i-th element in the datapool array lptRemSize.
#define CRC_LENGTH
The length of CRC.
Interface for accessing data pool items.
Type for the data describing an OutComponent.
Header file to define all service and packet identifiers.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
Interface through which applications can initialize and execute framework PUS extension components...
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Definition: CrFwConstants.h:30
static void setLptDownInterRepPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptDownInterRep" packet.
Create one instance of the CrPsLpt state machine.
static void setDplptRemSizeItem(int i, CrPsSize_t lptRemSize)
Sets the value of the i-th element in the datapool array lptRemSize.
static CrPsTid_t getDplargeMsgTransIdItem(int i)
Gets the value of the i-th element in the datapool array largeMsgTransId.
CrPsTid_t Tid
CrPsLptUpCmdStart function definitions.
CrFwBool_t CrPsLptDownInterRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,2) LptDownInterRep.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Interface for accessing fields in packets of service "ServLPT".
FwSmDesc_t getSmDescLpt()
Getter for Lpt state machine descriptor.
uint32_t * getLptMemStartAddr(uint32_t LptBuffer)
Getter function for the Address of the Data.
void CrPsLptDownInterRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,2) LptDownInterRep.
#define CrPsLpt_DOWN_TRANSFER
Make sure to include this header file only once.
Definition: CrPsLptCreate.h:43
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
void setLptDownFirstRepPart(void *p, unsigned char *Part, unsigned short length)
Set "Part" in "LptDownFirstRep" packet.
Definition of the OutComponent Component of the framework.
static CrFwCounterU4_t getDppartSeqNmbItem(int i)
Gets the value of the i-th element in the datapool array partSeqNmb.
auxiliary Interface for accessing fields in packets of service "ServLPT".
static void setLptDownInterRepTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptDownInterRep" packet.
static void setDppartSeqNmbItem(int i, CrFwCounterU4_t partSeqNmb)
Sets the value of the i-th element in the datapool array partSeqNmb.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved