CORDET Framework - C2 Implementation
CrPsHkRepStructRep.c
Go to the documentation of this file.
1 
22 #include "CrPsHkRepStructRep.h"
23 
24 #include <FwPrConfig.h>
25 #include <FwSmConfig.h>
26 
27 #include <OutCmp/CrFwOutCmp.h>
28 #include <Pckt/CrFwPckt.h>
29 
30 #include <CrFwCmpData.h>
31 
32 #include <CrPsUserConstants.h>
33 #include <DataPool/CrPsDp.h>
34 #include <DataPool/CrPsDpServHk.h>
38 
39 #include <stdlib.h>
40 
41 
42 void CrPsHkRepStructRepUpdateAction(FwSmDesc_t smDesc)
43 {
44  CrFwCmpData_t *cmpData;
45  CrFwOutCmpData_t *cmpSpecificData;
46  CrFwPckt_t pckt;
48 
49  CrFwCounterU4_t i, j;
50  CrPsSid_t sid, rdlSid, rdlSlot;
51  CrPsStatus_t PeriodicGenActionStatus = 1;
52  CrPsCollectInterval_t CollectionInterval;
53  CrFwCounterU4_t N1, N2, NFA;
54  CrPsParamId_t N1ParamId, N2ParamId;
55  CrPsRepNum_t SCSampleRepNum;
56  CrFwCounterU4_t offset;
57 
58  /* Load the SID definition from the RDL */
59 
60  /* Get packet and discriminant */
61  cmpData = (CrFwCmpData_t *) FwSmGetData(smDesc);
62  cmpSpecificData = (CrFwOutCmpData_t *) cmpData->cmpSpecificData;
63  pckt = cmpSpecificData->pckt;
64  disc = CrFwPcktGetDiscriminant(pckt);
65 
66  /* Set SID equal to discriminant */
67  sid = (CrPsSid_t) disc;
68  setHkRepStructRepRepStrucId(pckt, sid); /* TODO: check if necessary */
69 
70  /* set RDL information in out-going report packet */
71  /* Get report structure ID (SID) and set in out-going report packet */
72  setHkRepStructRepRepStrucId(pckt, sid);
73 
74  /* look for the slot */
75  for (rdlSlot = 0; rdlSlot < HK_N_REP_DEF; rdlSlot++)
76  {
77  rdlSid = getDpsidItem(rdlSlot);
78 
79  if (sid == rdlSid)
80  break;
81  }
82 
83  /* Get periodic generation action status and set in out-going report packet */
84  setHkRepStructRepPeriodicGenActionStatus(pckt, PeriodicGenActionStatus);
85 
86  /* Get collection interval and set in out-going report packet */
87  CollectionInterval = getDpperiodItem(rdlSlot);
88  setHkRepStructRepCollectionInterval(pckt, CollectionInterval);
89 
90  /* Get N1 and set in out-going report packet */
91  N1 = getDpnSimpleItem(rdlSlot);
92  setHkRepStructRepN1(pckt, N1);
93 
94  /* Get N1 parameter IDs and set them in out-going report packet */
95  for (i=0; i<N1; i++)
96  {
97  N1ParamId = getDplstIdItem(rdlSlot*HK_MAX_N_ITEMS + i);
98  setHkRepStructRepN1ParamIdItem(pckt, i+1, N1ParamId);
99  }
100 
101  /* Get NFA and set in out-going report packet */
102  NFA = getNFA(rdlSlot);
103  setHkRepStructRepNFA(pckt, NFA);
104 
105  offset = 0;
106 
107  for (i=0; i<NFA; i++)
108  {
109  /* Get sample repition number and set in out-going report packet */
110  SCSampleRepNum = getDplstSampleRepItem(rdlSlot*HK_MAX_N_GR + i);
111  setHkRepStructRepSCSampleRepNumItem(pckt, i+1, SCSampleRepNum);
112 
113  /* Get N2 and set in out-going report packet */
114  N2 = getDplstNSampRepItem(rdlSlot*HK_MAX_N_GR + i);
115  setHkRepStructRepN2(pckt, i+1, N2);
116 
117  /* Get N2 parameter IDs and set them in out-going report packet */
118  for (j=0; j<N2; j++)
119  {
120  N2ParamId = getDplstIdItem(rdlSlot*HK_MAX_N_ITEMS + N1 + offset + j);
121  setHkRepStructRepN2ParamIdItem(pckt, i+1, j+1, N2ParamId);
122  }
123 
124  /* update offset */
125  offset += N2;
126  }
127 
128  return;
129 }
Type for the Framework Component Data (FCD).
void setHkRepStructRepNFA(void *p, CrFwCounterU4_t src)
Set "NFA" in "HkRepStructRep" packet.
uint32_t CrPsRepNum_t
Type used for the Repetition Number of a packet.
static CrPsPeriod_t getDpperiodItem(int i)
Gets the value of the i-th element in the datapool array period.
Definition: CrPsDpServHk.h:259
void setHkRepStructRepSCSampleRepNumItem(void *p, CrFwCounterU4_t NFA, CrPsRepNum_t src)
Set "SCSampleRepNum" in "HkRepStructRep" packet.
CrFwCounterU4_t i
CrPsCmd5EidStart function definitions.
CrFwDiscriminant_t CrFwPcktGetDiscriminant(CrFwPckt_t pckt)
Return the discriminant of the command or report encapsulated in a packet.
static void setHkRepStructRepRepStrucId(void *p, CrPsSid_t RepStrucId)
Set "RepStrucId" in "HkRepStructRep" packet.
Header file to define all user-configurable constants and types for the IASW Application.
uint16_t CrPsParamId_t
Type used for the Parameter ID of a packet.
static void setHkRepStructRepN1(void *p, CrFwCounterU4_t N1)
Set "N1" in "HkRepStructRep" packet.
Interface for accessing data pool items.
Type for the data describing an OutComponent.
Header file to define all service and packet identifiers.
void setHkRepStructRepN2ParamIdItem(void *p, CrFwCounterU4_t NFA, CrFwCounterU4_t N2, CrPsParamId_t src)
Set "N2ParamID" in "HkRepStructRep" packet.
CrFwPckt_t pckt
Packet to which the out-going command or report is serialized.
Interface for creating and accessing a report or command packet.
Declaration of the Housekeeping Structure Report (3,10) or Disgnostic Structure Report (3...
static CrPsSid_t getDpsidItem(int i)
Gets the value of the i-th element in the datapool array sid.
Definition: CrPsDpServHk.h:289
auxiliary Interface for accessing fields in packets of service "ServHk".
uint32_t CrPsCollectInterval_t
Type used for the Collection Interval of a packet.
static CrFwDiscriminant_t disc
Discriminant.
static CrFwCounterU4_t getNFA(int i)
Gets the number of super-commutated groups (NFA) from number of sample repetition numbers (rep[]) ...
Definition: CrPsDpServHk.h:140
static void setHkRepStructRepPeriodicGenActionStatus(void *p, CrPsStatus_t PeriodicGenActionStatus)
Set "PeriodicGenActionStatus" in "HkRepStructRep" packet.
void setHkRepStructRepN1ParamIdItem(void *p, CrFwCounterU4_t N, CrPsParamId_t src)
Set "N1ParamId" arrayItem in "HkRepStructRep" packet.
void * cmpSpecificData
Derived data which are specific to each type of framework component.
static CrPsNumberU2_t getDplstNSampRepItem(int i)
Gets the value of the i-th element in the datapool array lstNSampRep.
Definition: CrPsDpServHk.h:409
unsigned short CrFwDiscriminant_t
Type used for the discriminant of a command or report.
#define HK_N_REP_DEF
Number of Report Definitions in the Report Definition List (maximum number of housekeeping/diagnostic...
uint8_t CrPsSid_t
Type used for the Parameter Report Structure ID of a packet.
char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
Definition: CrFwConstants.h:36
#define HK_MAX_N_GR
Maximum number of super-commutated groups in a house- keeping/diagnostic report.
Definition of the OutComponent Component of the framework.
static uint16_t getDplstSampleRepItem(int i)
Gets the value of the i-th element in the datapool array lstSampleRep.
Definition: CrPsDpServHk.h:439
void setHkRepStructRepN2(void *p, CrFwCounterU4_t NFA, CrFwCounterU4_t N2)
Set "N2" in "HkRepStructRep" packet.
Interface for accessing fields in packets of service "ServHk".
uint8_t CrPsStatus_t
Type used for the Status of a packet.
static CrPsParamId_t getDplstIdItem(int i)
Gets the value of the i-th element in the datapool array lstId.
Definition: CrPsDpServHk.h:379
void CrPsHkRepStructRepUpdateAction(FwSmDesc_t smDesc)
Update action of the Housekeeping Structure Report (3,10) out-going report packet.
Interface for accessing data pool items.
static void setHkRepStructRepCollectionInterval(void *p, CrPsCollectInterval_t CollectionInterval)
Set "CollectionInterval" in "HkRepStructRep" packet.
static CrPsNumberU2_t getDpnSimpleItem(int i)
Gets the value of the i-th element in the datapool array nSimple.
Definition: CrPsDpServHk.h:469
P&P Software GmbH, Copyright 2012-2013, All Rights Reserved