wiki:OFDM/MIMO/Docs/AutoResponse

Version 8 (modified by murphpo, 15 years ago) (diff)

--

The OFDM core includes a subsystem which can automatically transmit a packet in response to a received packet. This behavior is ideal for implementing MAC protocols which require responses at fast time scales (like RTS-CTS or DATA-ACK exchanges). Both the conditions for responding and contents of the response packet are programmable at run-time.

The auto response hardware consists of three parts- match units, actors and the header translator.

Match Units

The auto response match units search for user-specified patterns in received headers. Each unit operates independently.

Actors

The actors are configured to trigger a transmission when a received packet meets programmed conditions, including any combination of match unit outputs.

Important: user code must guarantee that the conditions applied to each actor are mutually exclusive. No more than one actor should be triggered by a single packet reception. This requirement is not enforced in hardware. Results will be unpredictable if multiple actors are triggered at once. Unused actors should be disabled.

Header Translator

The header translator is used to construct the header of an automatically transmitted packet using data from the header of the received packet which triggered the transmission.

Configuring the Auto Response System

C macros are provided in warphphy.h to help configure the match units, actors and header translator.

Match unit configuration:

  • PHY_AUTORESPONSE_MATCH_CONFIG(addr, len, val): Configure the match unit to check whether len header bytes starting at addr match value val

Actor configuration: Each actor is configured with a single register write; each actor is access with its own macro (mimo_ofdmTxRx_setActionN(''config'')), where N is in [0,5] and config is the value returned by one of these actor configuration macros:

  • PHY_AUTORESPONSE_TXACTION_CONFIG(pktBuf, translateHdr, delay, conditions): Configure the actor to automatically transmit:
    • pktBuf: index (in [1,31]) of the packet buffer from which to automatically transmit the packet
    • translateHdr: enable the header translator when this actor triggers a transmission 'PHY_AUTORESPONSE_ACT_TRANS_HDR: use the translator; 0: disable the translator)
    • delay: number of 0.25µs increments to delay the automatic transmission. The time starts when the final byte of the incoming packet is decoded, even if the actor doesn't depend on the payload error status
    • conditions: bitwise OR'd combination of actor condition flags; every condition must be met by a given reception to trigger the actor.
  • PHY_AUTORESPONSE_ACTION_SETFLAGA_CONFIG(conditions): Configure the actor to set Flag A; conditions is a bitwise OR'd combination of actor condition requirements
  • PHY_AUTORESPONSE_ACTION_SETFLAGB_CONFIG(conditions): Configure the actor to set Flag B; conditions is a bitwise OR'd combination of actor condition requirements

Actor condition requirements:

  • PHY_AUTORESPONSE_REQ_GOODHDR: Packet currently being received is decoded without header errors
  • PHY_AUTORESPONSE_REQ_BADPKT: Packet currently being received has errors in payload but not header
  • PHY_AUTORESPONSE_REQ_GOODPKT: Packet currently being received is decoded without errors in header and payload
  • PHY_AUTORESPONSE_REQ_FLAGA: Flag A is set (set during previous reception)
  • PHY_AUTORESPONSE_REQ_FLAGB: Flag B is set (set during previous reception)
  • PHY_AUTORESPONSE_REQ_MATCH0: Match unit 0 conditions are met by the current packet header
  • PHY_AUTORESPONSE_REQ_MATCH1: Match unit 1 conditions are met by the current packet header
  • PHY_AUTORESPONSE_REQ_MATCH2: Match unit 2 conditions are met by the current packet header
  • PHY_AUTORESPONSE_REQ_MATCH3: Match unit 3 conditions are met by the current packet header
  • PHY_AUTORESPONSE_REQ_MATCH4: Match unit 4 conditions are met by the current packet header
  • PHY_AUTORESPONSE_REQ_MATCH5: Match unit 5 conditions are met by the current packet header

Actor options:

  • PHY_AUTORESPONSE_ACT_TRANS_HDR: Use the header translator for the auto-triggered transmission

Header translator:

  • PHY_HEADERTRANSLATE_SET(actionBuf, txByteNum, srcBuf, srcByteNum): Configure the translator to send the byte at index srcByteNum from the packet buffer srcBuf as byte number txByteNum for packets automatically transmitted from packet buffer actionBuf

Sample Code

//Configure match unit 0 to search for packets addressed to me
// Looks for 2 bytes starting at index PKTHEADER_INDX_DSTADDR with value MY_ADDR
mimo_ofdmTxRx_setMatch0( PHY_AUTORESPONSE_MATCH_CONFIG(PKTHEADER_INDX_DSTADDR, 2, MY_ADDR) );

//Configure match unit 1 to search for DATA packets
// Looks for 1 byte starting at index PKTHEADER_INDX_TYPE with value DATAPACKET
mimo_ofdmTxRx_setMatch1( PHY_AUTORESPONSE_MATCH_CONFIG(PKTHEADER_INDX_TYPE, 1, DATAPACKET) );

//Configure the header translator to replace the outgoing destination address with the received source address
PHY_HEADERTRANSLATE_SET(pktBuf_tx_ACK, (PKTHEADER_INDX_DSTADDR+0), pktBuf_rx, (PKTHEADER_INDX_SRCADDR+0));
PHY_HEADERTRANSLATE_SET(pktBuf_tx_ACK, (PKTHEADER_INDX_DSTADDR+1), pktBuf_rx, (PKTHEADER_INDX_SRCADDR+1));

//Create a template ACK packet
templatePkt.header.fullRate = pktFullRate;
templatePkt.header.codeRate = pktCodeRate;
templatePkt.header.length = 0;
templatePkt.header.srcAddr = (unsigned short)(NODEID_TO_ADDR(myID));
templatePkt.header.pktType = ACKPACKET;

//Copy the template ACK to the PHY packet buffer
warpmac_prepPhyForXmit(&templatePkt, pktBuf_tx_ACK);

//Configure actor 0 to send ACKs using the header translator after 5µs when the PHY receives a good data packet destined to this node
mimo_ofdmTxRx_setAction0(
    PHY_AUTORESPONSE_TXACTION_CONFIG(pktBuf_tx_ACK, PHY_AUTORESPONSE_ACT_TRANS_HDR, 20, 
        (PHY_AUTORESPONSE_REQ_MATCH0 | PHY_AUTORESPONSE_REQ_MATCH1 | PHY_AUTORESPONSE_REQ_GOODHDR | PHY_AUTORESPONSE_REQ_GOODPKT)));

//Disable the unused actors
mimo_ofdmTxRx_setAction1(0);
mimo_ofdmTxRx_setAction2(0);
mimo_ofdmTxRx_setAction3(0);
mimo_ofdmTxRx_setAction4(0);
mimo_ofdmTxRx_setAction5(0);