Subject: pcmcia
To: None <tech-kern@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: tech-kern
Date: 05/26/2001 22:57:15
Can someone please explain to me the following bit of code in pcmcia_cis.c?

============
    tuple.mult = 2;
...
        while (1) {
            /* get the tuple code */
 
            DELAY(1000);
            tuple.code = pcmcia_cis_read_1(&tuple, tuple.ptr); 
 
            /* two special-case tuples */
 
            if (tuple.code == PCMCIA_CISTPL_NULL) {
                DPRINTF(("CISTPL_NONE\n 00\n"));
                tuple.ptr++;
                continue; 
============
For reference:

#define pcmcia_cis_read_1(tuple, idx0)                  \
    (bus_space_read_1((tuple)->memt, (tuple)->memh, (tuple)->mult*(idx0)))

     u_int8_t
     bus_space_read_1(bus_space_tag_t space, bus_space_handle_t handle,
             bus_size_t offset);

- How do I find out what the u_int8_t by bus_space_read_1 returned is/means?
  (not mentioned in bus_space(9))
- Why is it reading 1 byte with read_1, but the offset is going up in twos
  as tuple.mult=2 ? Did that want to be read_2 ?
- What happens when tuple.ptr points outside of the memory mapped in tuple.memh?
  as it seems offset=2*ptr, and ptr keeps being incremented ad infinitum if
  code always==null..

Cheers,

Patrick