70 | | function of [source:/ResearchApps/MAC/CSMA/csmaMac.c@L csmaMac.c]. |
| 72 | function of [source:/ResearchApps/MAC/CSMAMAC/csmaMac.c@L csmaMac.c]. |
| 73 | |
| 74 | ==== Steady State ==== |
| 75 | This block of code calls the following [http://warp.rice.edu/WARP_API/warpmac_8c.html WARPMAC] functions: |
| 76 | |
| 77 | {{{ |
| 78 | #!c |
| 79 | warpmac_getMyId(); |
| 80 | }}} |
| 81 | |
| 82 | This function reads the current setting on the [wiki:HardwareUsersGuides/FPGABoard_v1.2/UserIO#DIPSwitch Dip Switches]. The value is used simply to identify the node in the network. For the purposes of the Reference Design, one node must be identified as "0" and the other as "1." |
| 83 | |
| 84 | {{{ |
| 85 | #!c |
| 86 | warpmac_init() |
| 87 | }}} |
| 88 | |
| 89 | This function sets reasonable default values for many of the parameters of the MAC, configures interrupts and exceptions, configures Ethernet, and finally initializes the custom peripherals such as the radio controller, the PHY, the packet detector, and the automatic gain control block. |
| 90 | |
| 91 | {{{ |
| 92 | #!c |
| 93 | warpmac_setMacAddr(-); |
| 94 | }}} |
| 95 | |
| 96 | This function sets the wireless MAC address of the node. |
| 97 | |
| 98 | {{{ |
| 99 | #!c |
| 100 | warpmac_setMaxResend(-); |
| 101 | warpmac_setMaxCW(-); |
| 102 | warpmac_setTimeout(-); |
| 103 | warpmac_setSlotTime(-); |
| 104 | }}} |
| 105 | |
| 106 | These function set up internal parameters of the MAC. The maximum number of resends is the maximum number of times that a packet should be retransmitted, in the event of not receiving an acknowledgment. The maximum contention window defines "how random" backoffs should be in the worst case. The timeout time is the amount of time that the MAC should wait on an acknowledgment before retransmitting. Finally, the slot time is a length of the minimum contention window. |
| 107 | |
| 108 | {{{ |
| 109 | #!c |
| 110 | warpmac_setRxBuffer(&rxBuffer,0); |
| 111 | warpmac_setTxBuffer(1); |
| 112 | }}} |
| 113 | |
| 114 | The newest version of the [wiki:OFDM PHY] |
| 115 | |
| 116 | |
| 117 | {{{ |
| 118 | #!c |
| 119 | int main() |
| 120 | }}} |
| 121 | |
| 122 | |
| 123 | {{{ |
| 124 | #!c |
| 125 | int main() |
| 126 | }}} |
| 127 | |
| 128 | |
| 129 | {{{ |
| 130 | #!c |
| 131 | int main() |
| 132 | }}} |
| 133 | |