Changes between Version 79 and Version 80 of WANMAC
- Timestamp:
- Jul 24, 2006, 5:46:43 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WANMAC
v79 v80 138 138 '''Common''' 139 139 140 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@3 05#L46 pduStruct]140 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L46 pduStruct] 141 141 The pduStruct type is the internal representation of what information is included in the frame sent to the PHY. There is a one to one conversion between this struct and array of bytes interpreted by the PHY. This allows us to abstract away from this array structure, making our MAC's behavior independent of the header format. Each 142 142 packet contains a CID, which indicates the subscriber ID. The CID sof zero is for broadcasting purposes. 143 143 144 144 145 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L58 pduQueueStruct]145 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L58 pduQueueStruct] 146 146 The pduQueueStruct is a structure containing an array of frameStructs and a few control bytes to keep track of indices, flags and the length of the queue. This queue can serve two purposes. The first use is during the receive phase of the MAC. When the MAC receives a packet from another node, it needs to put the payload somewhere. Because the specification of the connection between our MAC and higher networking layers is still in the process of being defined, we need a method of abstracting our layer away from this future glue layer. An acceptable solution is to simply copy packets from the PHY's memory space into a queue. It is assumed that another in the xilkernel will be taking these packets and giving them to higher layers. The other use of this queue is on the transmit side of the MAC. Again, the connection to the higher layer is still being defined, so we need a way of getting packets to send in the meantime. You can think of the transmit queue as analogous to the receive queue, in that some process somewhere gives us packets to send. This could be the [wiki:"Video Board" Video Board], or eventually the ethernet controller. 147 147 148 148 149 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L74 MAPEntryStruct]149 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L74 MAPEntryStruct] 150 150 The MAPEntryStruct is a single entry/slot of an uplink or a downlink MAP data structure. It contains the start time and the end time for that entry, 151 151 which denote the number of bursts allocated in a given slot. … … 153 153 [[Image(Maps.JPG, align=centre, 700)]] 154 154 155 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L79 MAPStruct]155 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L79 MAPStruct] 156 156 This is the data structure depicting the MAP. It contains the number of entries of the MAP along with the start time for that MAP. Also it has 157 157 the pointer to the actual entries array. 158 158 159 159 160 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L83IDEntryStruct]160 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L85 IDEntryStruct] 161 161 This depicts an single ID, namely the Connection ID and the MAC information of the node being described. So far we are not using this, 162 162 as this is used for Network Entry Protocol. 163 163 164 164 165 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L90 IDStruct]165 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L90 IDStruct] 166 166 This contains the list and the number of ids which correspond to the changes to be made in the new map. This is used both for deletion as well 167 167 as for newly added subscriber ids. So far we are not using this, as this is used for Network Entry Protocol. … … 179 179 180 180 181 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L68 BSQueueStruct]181 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@360#L68 BSQueueStruct] 182 182 This is the Base Station data structure, for keeping record of the number of subscribers and for their Receive and Transmit Queues. 183 183 … … 214 214 == == 215 215 216 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@ 91#L68SSQueueStruct]216 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.h@361#L52 SSQueueStruct] 217 217 This is the Subscriber Station data structure, for keeping record of its Receive and Transmit Queues. 218 218 … … 249 249 == Base Station Functions == 250 250 251 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51rxPhyGood]251 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L75 rxPhyGood] 252 252 This function is called when a packet with the correct CRC is received. It copies the packet into the memory. It then checks the state of the 253 253 BS machine and the Connection ID of the packet received with the expected Connection ID. Else it simply frees the buffer and in the end 254 254 resets the receiver. Note, the resetting of the receiver is a must and it must be the last step after packet processing. 255 255 256 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51BSRxInsertQueuebyMAC]256 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L157 BSRxInsertQueuebyMAC] 257 257 The function is called when a packet needs to be inserted into a specific queue of the Base Station. This abstracts the behaviour of the 258 258 PHY-MAC interaction. The queues are circular and this maintains a notion of a flag, to ensure it does not overwrite on any queue location. 259 259 260 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51CopyMAPs]260 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L239 CopyMAPs] 261 261 Another utility function for Copying one Map into another. 262 262 263 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51ackmac_main]263 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L325 ackmac_main] 264 264 The first funtion to be called when the program begins the execution. It extracts the last byte of the MAC Address. This 265 265 allocates the Memmory Buffer for the program . It then calls the function for Hardware Initialisation, followed by the 266 266 Software Initialization and finally triggering off the State Machine. 267 267 268 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51InitialiseBS]268 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L372 InitialiseBS] 269 269 This is the main software Initialization funtion. It allocates memory for all the receive and transmit queues for the 270 270 specified number of queues. Note the data in the queues is allocated as and when required. For the transmit queues it is done by the Dummy Application … … 272 272 read and the write indexes are initialised to zero. 273 273 274 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51CreateMaps]274 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L CreateMaps] 275 275 This function takes in old maps and the number of new users added to the system along with their ids. It also inputs 276 276 the nos of users that would deleted from the system. It then process all the information to create the most 277 277 update map verion. It does that both for the uplink and the downlink. 278 278 279 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51InitialiseMAP]279 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L429 InitialiseMAP] 280 280 This is a utility function for initialising the first uplink and downlink maps. It allocates memory to the 281 281 entries. For the time being we only had three entries, one for contention and one each for two subscribers. 282 282 Note by defaut: The zeroth entry of the Downlink Map specifies the Contention Period Timings. 283 283 284 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51TxMapsNewIds]284 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L558 TxMapsNewIds] 285 285 This function takes in the Uplink and the Downlink Map and puts them into a pdu packet. It first puts 286 286 in the Downlink Map followed by the Uplink Map. It allocates memory for the data part of the packet 287 287 thus created. 288 288 289 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51TxBSPDUs]289 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L693 TxBSPDUs] 290 290 The function is resposnsible for reading the Downlink Map and according to that, 291 291 setting the timers for each of the downlink slots corresponding to each subscriber 292 292 293 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51TransmitfrmQ]293 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L727 TransmitfrmQ] 294 294 This function makes the call to pull out packets from the queue specified and hands them over to the PHY layer. It simply waits in the while 295 295 loop as long the timer goes on. 296 296 297 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51BSTxRemoveQueuebyMAC]297 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L747 BSTxRemoveQueuebyMAC] 298 298 This function is responsible for taking out the pdu from one of the circular queue specified. This is responsible for updating the queue 299 299 data structure so that we dont over write on any queue location. This is done by incrementing the read index of the circular transmit queue. … … 301 301 302 302 303 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51ReceivefrmPhy]303 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L859 ReceivefrmPhy] 304 304 All this function does it to set a timer and wait for a packet to be received. It also changes the global variable queueidRx to the specified 305 305 queueid, so that packets corresponding to the correct subscriber can be used. 306 306 307 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51RxBSPDUs]307 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L886 RxBSPDUs] 308 308 It receives the Uplink Map and processes it in order to receive from each one of the subscribers. 309 309 310 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@3 05#L51StateMachineBS]310 [source:/ResearchApps/MAC/WANMAC/Basestation/basestation.c@360#L906 StateMachineBS] 311 311 This is the main State Machine for the Basetation. It coordinates the way the execution takes place. It runs the dummy application to fill 312 312 up the transmit queues. It then enters a never ending while loop, and starts to process Maps, transmit them, transmit and receive the payloads … … 320 320 == Subscriber Station Functions == 321 321 322 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76InitialiseSS]322 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L79 InitialiseSS] 323 323 This is the main software initialization funtion for the subscriber station. It allocates memory for all the receive and transmit queues for a 324 324 given subscriber. Note the data in the queues is allocated as and when required. For the transmit queues it is done by the Dummy Application … … 326 326 read and the write indexes are initialised to zero. 327 327 328 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76RxMap]328 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L387 RxMap] 329 329 This function begins with an infinite loop simply waiting for a correct MAP to be received. The print statement in this function 330 330 is important, otherwise the code just stops executing as it senses an infinite while loop. After having the received the Map … … 332 332 333 333 334 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76 StateMachineSS]334 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L466 StateMachineSS] 335 335 This is the state machine for the Subscriber Station. It begins with the dummy application generator filling up the transmit queue 336 336 for the subscriber station. Note that the interrupts for the good and the bad have been enabled here rather than in the hardware. This … … 339 339 After each loop the de-allocation of the Map entries is done. 340 340 341 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76 SSFreeQueues]341 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L576 SSFreeQueues] 342 342 This function does the de-allocation of the queues allocated for the transmit and the receive of the Subscriber Station 343 343 344 344 345 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76ackmac_main]345 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L595 ackmac_main] 346 346 The first funtion to be called when the program begins the execution. It extracts the last byte of the MAC Address. This 347 347 allocates the Memmory Buffer for the program . It then calls the function for Hardware Initialisation, followed by the … … 349 349 350 350 351 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76RxSSPDUs]351 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L647 RxSSPDUs] 352 352 This function waits in a while loop till the timer goes off on the global variable notEndRxPDU. It expects to receive packets from 353 353 the Base Station during this time interval. Note the setting of the timer is not done in this function unlike the Base Station, instead … … 355 355 356 356 357 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76TxSSPDUs]357 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L664 TxSSPDUs] 358 358 This function keeps on calling the function to remove packets from the transmit queue and sending them to the physcial layer. It 359 359 waits on the global variable notEndTxPDU, which again is set in the state machine and not inside this function. 360 360 361 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76SSTxRemoveQueuebyMAC]361 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L683 SSTxRemoveQueuebyMAC] 362 362 This function is responsible for taking out the pdu from one of the circular queue specified. This is responsible for updating the queue 363 363 data structure so that we dont over write on any queue location. This is done by incrementing the read index of the circular transmit queue. 364 364 The packet is copied into passed argument and memory is allocated for the data. 365 365 366 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@3 01#L76SSRxInsertQueuebyMAC]366 [source:/ResearchApps/MAC/WANMAC/Subscriber/substation.c@361#L748 SSRxInsertQueuebyMAC] 367 367 This function is responsible for inserting the pdu into one of the circular queue specified. This is responsible for updating the queue 368 368 data structure so that we dont over write on any queue location. This is done by incrementing the write index of the circular receive queue.