Niki Denev wrote this message on Sat, Aug 12, 2006 at 11:42 +0300: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > John Baldwin wrote: > > On Saturday 05 August 2006 10:06, Niki Denev wrote: > >> for(i=0; i < sizeof(config_table_t); i++) { > >> r = bus_space_read_1(sc->bar.tag, sc->bar.hdl, i); > >> *((u_int8_t *)&sc->cfg_table + i) = r; > >> } > > > > Note that you can replace this with: > > > > bus_space_read_multi_1(sc->bar.tag, sc->bar.hdl, 0, > > (u_int8_t *)&sc->cfg_table, sizeof(config_table_t)); > > > > I can't understand why the code above gives me different results. > i.e.: > > for(i=0; i < sizeof(config_table_t); i++) { > *((u_int8_t *)&sc->cfg_table + i) = bus_read_1(sc->res, i); > } > printf("cfg_table signature : %08X\n", sc->cfg_table.signature); > > This prints : cfg_table signaature 0xEFEFFEFE, which is the correct signature > that should be read from the card. > > But this code : > > bus_read_multi_1(sc->res, 0, (u_int8_t *)&sc->cfg_table, > sizeof(config_table_t)); > printf("cfg_table signature : %08X\n", sc->cfg_table.signature); > > prints : cfg_table signature 0xFEFEFEFE > which is not correct... > > Shouldn't the above examples do exactly the same thing?
No, read_multi reads from the same location every time.. This is for things like a FIFO where the value can change each time, you want bus_read_region_1... Read the bus_space(9) man page for more info about the differences between the two... http://www.freebsd.org/cgi/man.cgi?query=bus_space&apropos=0&sektion=0&manpath=FreeBSD+6.1-RELEASE&format=html -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"