The Design Cycle
222CF is an 11-Mbps wireless
CompactFlash network adapter
card that can transmit and
receive up to 60 meters indoors
and up to 250 meters outdoors. I particularly like the
TRENDnet card because it
has an activity LED that lets
you know if something is
being sent or received by the
TRENDnet CompactFlash
NIC. Also, the TRENDnet
TEW-222CF is certified for
use anywhere in the world.
The AirDrop-P is pretty
much a “doorbell” microcontroller circuit. The real power
behind the AirDrop-P lies in
the firmware, so let’s take a
look at some of the 802.11b
driver code.
802.11b Logic
Before we can do anything
with 802.11b, we must first
introduce some CompactFlash
card lingo. Some of the
802.11b startup information
we need and information about
the CompactFlash NIC itself
can be obtained by simply
reading the CompactFlash
card’s tuples, which are located in the CompactFlash card’s
ROM beginning at address
0x0000 of the CompactFlash
card’s attribute memory area.
As far as CompactFlash
cards are concerned, a tuple is
simply an ordered set of data
elements. Tuple elements for
any CompactFlash card consist of the code tuple, the link
tuple, and the data tuple or
data tuples that follow. In a
CompactFlash card, the tuple
values that are meaningful to
us all lie on even byte boundaries. For instance, the first
code tuple is at location
0x0000 and the first link tuple
is at location 0x0002. This
puts the first data tuple at
address 0x0004. The reasoning behind this is that only the
APRIL 2005
Listing 1 continued ...
switch(code_tuple)
{
case DEVICE_TUPLE:
printf(“\r\nDEVICE_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
break;
case DEVICE_A_TUPLE:
printf(“\r\nDEVICE_A_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
break;
case DEVICE_OC_TUPLE:
printf(“\r\nDEVICE_OC_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
break;
case DEVICE_OA_TUPLE:
printf(“\r\nDEVICE_OA_UPLE %02X = %02X”,tuple_link_cnt,tuple_data);
break;
case VERS_1_TUPLE:
printf(“\r\nVERS_1_TUPLE_TUPLE %02X = %c”,tuple_link_cnt,tuple_data);
break;
case MANFID_TUPLE:
printf(“\r\nMANFID_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
break;
case FUNCID_TUPLE:
printf(“\r\nFUNCID_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
if(tuple_link_cnt == 0)
cis_device = tuple_data;
break;
case FUNCE_TUPLE:
printf(“\r\nFUNCE_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
if(funce_cnt == 4)
if(tuple_link_cnt>1)
macaddrc[mac_cnt++] = tuple_data;
if(tuple_link_cnt == (link_tuple-1))
funce_cnt++;
break;
case CONFIG_TUPLE: // GET THE COR ADDRESS
printf(“\r\nCONFIG_TUPLE %02X = %02X”,tuple_link_cnt,tuple_data);
if(tuple_link_cnt == 2)
cor_addr_lo = tuple_data; // copying low-byte
if(tuple_link_cnt == 3) // shift, then copy hi-byte
{
cor_addr_hi = tuple_data;
cor_addr = make16(cor_addr_hi,cor_addr_lo);
}
break;
case CFTABLE_ENTRY_TUPLE:
printf(“\r\nCFTABLE_ENTRY_TUPLE %02X =
%02X”,tuple_link_cnt,tuple_data);
break;
default:
break;
}// end switch
}// end for loop tuple_link_cnt
}//if(code_tuple != END_TUPLE)
else
{
setf_cis;
}
}while(!(bcisflag));
cor_data = rd_cor_data(cor_addr);
delay_ms(4);
cor_data |= io_en_mask;
wr_cor_data(cor_data,cor_addr);
rc = send_command( Initialize_Cmd, 0);
switch(rc)
{
case 0:
printf(“\r\nAirDrop-P Initialized”);
break;
case 1:
printf(“\r\nAirDrop-P Initialization Failure”);
break;
case 2:
printf(“\r\nNo buffer space”);
break;
case 3:
printf(“\r\nCommand error”);
break;
default:
printf(“\r\nResult Code = %x”,rc);
break;
}
}
33