[ECOS] cf_get_CIS () not right?
Trenton D. Adams
tadams@extremeeng.com
Tue Oct 9 12:45:00 GMT 2001
I was looking at cf_get_CIS () and noticed that when creating a buffer
from a section in the CIS such as CF_CISTPL_CONFIG, it doesn't seem to
do it quite right from what I understand of the CIS.
For the CF_CISTPL_CONFIG section, the first LINK field that comes right
after the CF_CISTPL_CONFIG(0x1a) id will only indicate the size of the
first part of the CONFIG section. The next part starts with a
CF_CISTPL_CFTABLE_ENTRY (0x1b). In the case of my card, I only have one
CF_CISTPL_CFTABLE_ENTRY and the CONFIG section ends at the end of that.
Below is the CF_CISTPL_CONFIG section for my WaveLAN card. The 0x07 for
the second byte does not indicate the full size of the CF_CISTPL_CONFIG
section. It only indicates the size of the section before the first
CF_CISTPL_CFTABLE_ENTRY.
0xbf3d8 <stack+30648>: 0x1a 0x07 0x03 0x01 0xe0 0x03
0x00 0x00
0xbf3e0 <stack+30656>: 0x01 0x1b 0x0f 0xc1 0x01 0x19
0x76 0xc5
0xbf3e8 <stack+30664>: 0x4b 0xd5 0x19 0x36 0x36 0x05
0x46 0x7f
0xbf3f0 <stack+30672>: 0xff 0xff
The buffer above was obtained with the new cf_get_CIS () below.
bool
cf_get_CIS(struct cf_slot *slot, unsigned char id,
unsigned char *buf, int *len, int *ptr)
{
int i, size;
unsigned char *cis = slot->attr;
unsigned char *cis_end = cis + slot->attr_length;
bool bFound = false;
*len = 0;
cis += *ptr;
while (cis < cis_end)
{
if (*cis == 0xFF)
{
break;
}
if (*cis == id || bFound)
{
size = *(cis+2) + 2;
for (i = 0; i < size; i++)
{
*buf++ = *cis;
cis += 2;
}
*len += size;
*ptr = (unsigned long)(cis - slot->attr);
bFound = true;
}
else
{
// Skip to next entry
cis += (*(cis+2) * 2) + 4;
}
}
return bFound;
}
Is this correct!?!?
p.s.
I think there's something wrong with the cf_parse_XXX functions too, but
I haven't fiddled with them much yet.
Trenton D. Adams
Extreme Engineering
#17, 6025 - 12 St. SE
Calgary, Alberta, Canada
T2H 2K1
Phone: 403 640 9494 ext-208
Fax: 403 640 9599
http://www.extremeeng.com
More information about the Ecos-discuss
mailing list