CORDET Framework - C2 Implementation
CrPsLptDownFirstRep.c
Go to the documentation of this file.
1 
24 #include "CrPsLptDownFirstRep.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 void CrPsLptDownFirstRepUpdateAction(FwSmDesc_t smDesc)
75 {
76  CrFwCmpData_t *cmpData;
77  CrFwOutCmpData_t *cmpSpecificData;
78  CrFwPckt_t pckt;
79  uint32_t *lptMemStartAddr;
80  uint32_t LptBufferId;
81  CrPsSize_t partSize, lptRemSize;
82  CrPsTid_t Tid;
83  CrPsNumberU4_t PartSeqNmb;
84 
85  cmpData = (CrFwCmpData_t *) FwSmGetData(smDesc);
86  cmpSpecificData = (CrFwOutCmpData_t *) cmpData->cmpSpecificData;
87  pckt = cmpSpecificData->pckt;
88 
89  LptBufferId = DownTransferLptBufferId;
90 
91  /* set the transaction identifier equal to largeMsgTransId */
92  Tid = getDplargeMsgTransIdItem(LptBufferId);
93  setLptDownFirstRepTid(pckt, Tid);
94 
95  /* set the partnumber equal to partSeqNmb */
96  PartSeqNmb = getDppartSeqNmbItem(LptBufferId);
97  setLptDownFirstRepPartSeqNmb(pckt, PartSeqNmb);
98 
99  /* Load the first part of the large packet from the LPT Buffer */
100  lptMemStartAddr = getLptMemStartAddr(LptBufferId); /* Adaptation Point */
101  partSize = (CR_FW_MAX_PCKT_LENGTH - (sizeof(TmHeader_t) + sizeof(CrPsTid_t) + sizeof(CrPsNumberU4_t) + CRC_LENGTH));
102  setLptDownFirstRepPart(pckt, (uint8_t *)lptMemStartAddr, partSize);
103 
104  /* increment partSeqNmb */
105  PartSeqNmb++;
106  setDppartSeqNmbItem(LptBufferId, PartSeqNmb);
107 
108  /* decrement lptRemSize by partSize */
109  lptRemSize = getDplptRemSizeItem(LptBufferId) - partSize;
110  setDplptRemSizeItem(LptBufferId, lptRemSize);
111 
112  return;
113 }
void CrPsLptDownFirstRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,1) LptDownFirstRep.
Type for the Framework Component Data (FCD).
Implementation of TM(13,1) LptDownFirstRep.
#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.
static void setLptDownFirstRepPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptDownFirstRep" packet.
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
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 void setLptDownFirstRepTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptDownFirstRep" packet.
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.
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.
#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".
CrFwBool_t CrPsLptDownFirstRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,1) LptDownFirstRep.
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