CORDET Framework - C2 Implementation
CrPsLptDownLastRep.c
Go to the documentation of this file.
1 
24 #include "CrPsLptDownLastRep.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 
50 {
51  uint16_t sm_state;
52 
53  CRFW_UNUSED(smDesc);
54 
55  sm_state = FwSmGetCurState(getSmDescLpt());
56  if (sm_state == CrPsLpt_DOWN_TRANSFER)
57  {
58  return 1;
59  }
60  else
61  {
62  return 0;
63  }
64 }
65 
73 void CrPsLptDownLastRepUpdateAction(FwSmDesc_t smDesc)
74 {
75  CrFwCmpData_t *cmpData;
76  CrFwOutCmpData_t *cmpSpecificData;
77  CrFwPckt_t pckt;
78  uint32_t *lptMemStartAddr;
79  uint32_t LptBufferId;
80  CrPsSize_t partSize, partSize_prev, lptRemSize;
81  CrPsTid_t Tid;
82  CrPsNumberU4_t PartSeqNmb;
83 
84  cmpData = (CrFwCmpData_t *) FwSmGetData(smDesc);
85  cmpSpecificData = (CrFwOutCmpData_t *) cmpData->cmpSpecificData;
86  pckt = cmpSpecificData->pckt;
87 
88  LptBufferId = DownTransferLptBufferId;
89 
90  /* set the transaction identifier equal to largeMsgTransId */
91  Tid = getDplargeMsgTransIdItem(LptBufferId);
92  setLptDownLastRepTid(pckt, Tid);
93 
94  /* set the partnumber equal to partSeqNmb */
95  PartSeqNmb = getDppartSeqNmbItem(LptBufferId);
96  setLptDownLastRepPartSeqNmb(pckt, PartSeqNmb);
97 
98  /* Load the first part of the large packet from the LPT Buffer */
99  lptMemStartAddr = getLptMemStartAddr(LptBufferId); /* Adaptation Point */
100  partSize = getDplptRemSizeItem(LptBufferId);
101  partSize_prev = (CR_FW_MAX_PCKT_LENGTH - (sizeof(TmHeader_t) + sizeof(CrPsTid_t) + sizeof(CrPsNumberU4_t) + CRC_LENGTH));
102  setLptDownLastRepPart(pckt, (uint8_t *)lptMemStartAddr + (PartSeqNmb-1)*partSize_prev, partSize);
103 
104  /* decrement lptRemSize by partSize */
105  lptRemSize = getDplptRemSizeItem(LptBufferId) - partSize; /* should be always zero */
106  setDplptRemSizeItem(LptBufferId, lptRemSize);
107 
108  return;
109 }
Type for the Framework Component Data (FCD).
#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
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.
static void setLptDownLastRepPartSeqNmb(void *p, CrPsNumberU4_t PartSeqNmb)
Set "PartSeqNmb" in "LptDownLastRep" packet.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
Interface for accessing fields in packets of service "ServLPT".
Implementation of TM(13,3) LptDownLastRep.
FwSmDesc_t getSmDescLpt()
Getter for Lpt state machine descriptor.
CrFwBool_t CrPsLptDownLastRepEnableCheck(FwSmDesc_t smDesc)
Enable check of TM(13,3) LptDownLastRep.
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
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 setLptDownLastRepTid(void *p, CrPsTid_t Tid)
Set "Tid" in "LptDownLastRep" packet.
void CrPsLptDownLastRepUpdateAction(FwSmDesc_t smDesc)
Update action of TM(13,3) LptDownLastRep.
void setLptDownLastRepPart(void *p, unsigned char *Part, unsigned short length)
Set "Part" in "LptDownLastRep" packet.
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved