NetSim Source Code Help
Loading...
Searching...
No Matches
FCH.c
Go to the documentation of this file.
1#include "main.h"
2#include "802_22.h"
3/** The frame control header is transmitted as part of the downstream PDU in the DS subframe.
4The length of the FCH shall be 3 bytes.The FCH shall be sent in the first subchannel of the
5symbol immediately following the frame preamble symbol except when it I s the first frame
6of a superframe belonging to a specific BS where this symbol will follow the SCH.
7
8This second symbol of the frame carrying the FCH shall use a cyclic prefix TCP=1/4 TFFT.
9The FCH shall be encoded using the binary convolutional channel coding .The FCH shall be
10transmitted using the PHY mode 5. */
12
13{
14 double dTime = pstruEventDetails->dEventTime;
15 BS_MAC* pstruBSMAC;
16 BS_PHY* pstruBSPhy;
19
20 if(pstruBSPhy->pstruOpratingChannel == NULL)
21 {
22 return 0;//No activity
23 }
24 pstruBSMAC->nDSBurst = 1;
25 if(pstruBSPhy->nFrameNumber==0)
26 pstruBSMAC->nDSBurst = 3;
27
28 //Call function to form DS-MAP
30
31 if(pstruBSPhy->nFrameNumber)
32 {
34 }
35 //Increment the frame number
36 pstruBSPhy->nFrameNumber++;
37 //Update the DSFrametime
39
40 //Add timer event to tranmit the packet
47 //Add timer event to transmit form next frame
48 if(pstruBSPhy->nFrameNumber != 16)
49 {
50 pstruEventDetails->dEventTime = pstruBSMAC->dSuperframeStartTime + pstruBSPhy->nFrameNumber*10000+pstruBSPhy->pstruSymbolParameter->dSymbolDuration;// symbol duration added for frame preamble
54 }
55 //Add FCH to CR metrics
56 pstruBSMAC->struBSMetrics.nFCHSent++;
57 return 1;
58}
59/** The FCH shall be encoded using the binary convolutional channel coding .The FCH shall be
60transmitted using the PHY mode 5. The 15-bit randomizer is initialized using the 15 LSBs
61of the BS ID. The BS ID is transmitted as part of the SCH and is thus available to the CPEs
62for decoding.
63The 24 FCH bits are encoded and mapped onto 24 data subcarriers. In order to
64increase the robustness of the FCH, as signaled in the SCH, the encoded and mapped FCH data
65may be transmitted using the PHY mode 4. The FCH then occupies the first two OFDM slots. */
67{
70 FCH* pstruFCH = PACKET_MACPROTOCOLDATA(pstruPacket);
71 SYMBOL_PARAMETER* pstruSymbol = pstruCPEPhy->pstruSymbol;
72 BS_MAC* pstruBSMAC = DEVICE_MACVAR(pstruCPEMAC->nBSID,pstruCPEMAC->nBSInterface);
73 BS_PHY* pstruBSPHY = DEVICE_PHYVAR(pstruCPEMAC->nBSID,pstruCPEMAC->nBSInterface);
74 pstruCPEPhy->nFrameNumber++;
75 if(pstruCPEPhy->nIntraFrameQuietPeriodLength)
76 {
77 if(pstruCPEPhy->szIntraFrameQuietPeriodBitmap[pstruCPEPhy->nFrameNumber-1] == '1')
78 {
79 //Quiet period is scheduled
80 //Add an event to sense the channel
81 pstruEventDetails->dEventTime =pstruBSMAC->dFrameStartTime + (pstruFCH->n_Length_of_the_frame - pstruCPEPhy->nIntraFrameQuietPeriodDuration)*pstruSymbol->dSymbolDuration+pstruBSPHY->dTTG;
86 }
87 }
88 //Add FCH to CR metrics
89 pstruCPEMAC->struCPEMetrics.nFCHReceived++;
90 return 1;
91}
92
93
94
int fn_NetSim_CR_FormDSFrame(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, double dTime)
Definition: DSFrame.c:6
@ FORM_DS_BURST
Definition: 802_22.h:150
@ QUIET_PERIOD
Definition: 802_22.h:157
@ TRANSMIT_DS_BURST
Definition: 802_22.h:151
int fn_NetSim_CR_CPE_ProcessFCH(NetSim_PACKET *pstruPacket)
Definition: FCH.c:66
int fn_NetSim_CR_TransmitFCH()
Definition: FCH.c:11
#define PACKET_MACPROTOCOLDATA(pPacket)
Definition: Packet.h:300
#define DEVICE_PHYVAR(DeviceId, InterfaceId)
Definition: Stack.h:797
EXPORTED struct stru_NetSim_Network * NETWORK
Definition: Stack.h:742
@ TIMER_EVENT
Definition: Stack.h:114
#define DEVICE_MACVAR(DeviceId, InterfaceId)
Definition: Stack.h:798
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
#define fnpAddEvent(pstruEvent)
Definition: main.h:191
unsigned int nDSBurst
Current DS burst
Definition: 802_22.h:798
double dDSFrameTime
Definition: 802_22.h:806
BS_METRICS struBSMetrics
Definition: 802_22.h:815
double dFrameStartTime
Definition: 802_22.h:807
double dSuperframeStartTime
Definition: 802_22.h:805
double dTTG
Transmit Transition Gap. 105-333 micro sec. default 210 microsec.
Definition: 802_22.h:851
unsigned int nFrameNumber
Current super frame number
Definition: 802_22.h:829
struct stru_802_22_Channel * pstruOpratingChannel
Currently operating channel.
Definition: 802_22.h:840
SYMBOL_PARAMETER * pstruSymbolParameter
Definition: 802_22.h:854
CPE structure for IEEE 802.22 MAC.
Definition: 802_22.h:869
CPE_METRICS struCPEMetrics
Definition: 802_22.h:897
NETSIM_ID nBSInterface
Definition: 802_22.h:871
NETSIM_ID nBSID
Definition: 802_22.h:870
CPE structure for CPE PHY.
Definition: 802_22.h:902
unsigned int nFrameNumber
Definition: 802_22.h:914
SYMBOL_PARAMETER * pstruSymbol
Same parameter as BS have.
Definition: 802_22.h:910
unsigned int nIntraFrameQuietPeriodDuration
Definition: 802_22.h:913
unsigned int nIntraFrameQuietPeriodLength
Definition: 802_22.h:911
char szIntraFrameQuietPeriodBitmap[17]
Definition: 802_22.h:912
unsigned int n_Length_of_the_frame
Definition: 802_22.h:523
unsigned int nDownLinkSymbol
Definition: 802_22.h:989
double dSymbolDuration
Tsym = Tfft + Tcp in microsec.
Definition: 802_22.h:966
unsigned int nFCHSent
Definition: 802_22.h:630
unsigned int nFCHReceived
Definition: 802_22.h:661
struct stru_NetSim_Interface ** ppstruInterfaceList
Definition: Stack.h:717
EVENT_TYPE nEventType
Definition: Stack.h:747
struct stru_NetSim_Packet * pPacket
Definition: Stack.h:754
NETSIM_ID nSubEventType
Definition: Stack.h:757
NETSIM_ID nDeviceId
Definition: Stack.h:750
long long int nPacketId
Definition: Stack.h:755
NETSIM_ID nInterfaceId
Definition: Stack.h:751
struct stru_NetSim_PhysicalLayer * pstruPhysicalLayer
Definition: Stack.h:699
struct stru_NetSim_MacLayer * pstruMACLayer
Definition: Stack.h:698
struct stru_NetSim_Device ** ppstruDeviceList
Definition: Stack.h:737