110 likes | 256 Views
MAC Project. 8/26. Project 說明. 實作 PCF 模式 PCF 模式與 DCF 模式會週期性的切換. DEMO 環境 (DCF)–contention. 0. Warp (Client). Warp (Client). 2. Warp (Client). 1. DEMO 環境 (PCF)-contention free. 0. Warp (Server). Warp (Client). 2. Warp (Client). 1. Superframe. 1.change mode DCF->PCF
E N D
MAC Project 8/26
Project 說明 • 實作PCF模式 • PCF模式與DCF模式會週期性的切換
DEMO 環境(DCF)–contention 0 Warp (Client) Warp (Client) 2 Warp (Client) 1
DEMO 環境(PCF)-contention free 0 Warp (Server) Warp (Client) 2 Warp (Client) 1
Superframe • 1.change mode DCF->PCF server key “P” to start PCF mode • 2.server polling every client client key “D” if client have data • 3.change mode PCF->DCF server key “S” to end PCF mode
csmaMAC.c Main() //poll the timer, PHY and user I/O warpmac_pollPeripherals() you can trace warpmac.c to know the detail
csmaMAC.c Void uartRecv_callback(unsigned char uartByte) if(uartByte != 0x0) { xil_printf("(%c)\t", uartByte); switch(uartByte) case ASCII_1: ….. }
csmaMAC.c voidtimer_callback(unsigned char timerType) switch(timerType) { case TIMEOUT_TIMER: … case BACKOFF_TIMER: … }
csmaMAC.c voiddataFromNetworkLayer_callback(Xuint32 length, char* payload) txMacframe.header.length = length; txMacframe.header.pktType = PKTTYPE_DATA; txMacframe.header.destAddr = (unsigned short int)(NODEID_TO_ADDR(destNode)); txMacframe.header.remainingTx = (maximumReSend+1); if(warpmac_carrierSense()) { … } else { warpmac_setTimer(BACKOFF_TIMER); }
csmaMAC.c intphyRx_goodHeader_callback(Macframe* packet) if( packet->header.destAddr == (NODEID_TO_ADDR(myID)) ) { switch(packet->header.pktType) { case PKTTYPE_DATA: …. case PKTTYPE_ACK: …. }
Deadline & Demo • Question?