Annotation of prex-old/dev/arm/cats/hostio.c, Revision 1.1
1.1 ! nbrk 1: /*
! 2: * $Id$
! 3: */
! 4: #include <driver.h>
! 5: #include <bus.h>
! 6:
! 7: #include "hostiovar.h"
! 8:
! 9: /*
! 10: * Autoconf glue.
! 11: */
! 12: int hostio_match(struct device *parent, void *aux);
! 13: int hostio_attach(struct device *parent, struct device *self, void *aux);
! 14:
! 15: struct driver hostio_drv = {
! 16: "hostio", /* name */
! 17: sizeof(struct hostio_softc),/* datasize */
! 18: hostio_match, /* match */
! 19: hostio_attach, /* attach */
! 20: NULL, /* detach */
! 21: -1 /* nunits XXX */
! 22: };
! 23:
! 24:
! 25:
! 26: int
! 27: hostio_match(struct device *parent, void *aux)
! 28: {
! 29: return(1);
! 30: }
! 31:
! 32:
! 33: int
! 34: hostio_attach(struct device *parent, struct device *self, void *aux)
! 35: {
! 36: struct hostio_softc *sc = self->dv_data;
! 37:
! 38: printk("\n");
! 39:
! 40: sc->sc_iot = &hostio_bs_tag;
! 41:
! 42: /*
! 43: * Nothing to do. Just pass our bus_space_tag_t to upper layers.
! 44: */
! 45: config_search_children(self, sc->sc_iot);
! 46:
! 47: return(0);
! 48: }
! 49:
! 50:
! 51: int
! 52: hostio_map(void *cookie, bus_addr_t addr, bus_size_t size, int flags, bus_space_handle_t *ioh)
! 53: {
! 54: /* XXX */
! 55:
! 56: /* *ioh = kmem_map(addr, size); */
! 57: *ioh = addr;
! 58:
! 59: return(0);
! 60: }
! 61:
! 62:
! 63: uint8_t
! 64: hostio_read_1(void *cookie, bus_space_handle_t ioh, bus_size_t off)
! 65: {
! 66: uint8_t d;
! 67:
! 68: d = *(volatile uint32_t *)(ioh + off);
! 69:
! 70: return(d);
! 71: }
! 72:
! 73:
! 74: uint16_t
! 75: hostio_read_2(void *cookie, bus_space_handle_t ioh, bus_size_t off)
! 76: {
! 77: uint16_t d;
! 78:
! 79: d = *(volatile uint32_t *)(ioh + off);
! 80:
! 81: return(d);
! 82: }
! 83:
! 84:
! 85: uint32_t
! 86: hostio_read_4(void *cookie, bus_space_handle_t ioh, bus_size_t off)
! 87: {
! 88: uint32_t d;
! 89:
! 90: d = *(volatile uint32_t *)(ioh + off);
! 91:
! 92: return(d);
! 93: }
! 94:
! 95:
! 96: void
! 97: hostio_write_1(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint8_t data)
! 98: {
! 99: *(volatile uint32_t *)(ioh + off) = data;
! 100: }
! 101:
! 102:
! 103: void
! 104: hostio_write_2(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint16_t data)
! 105: {
! 106: *(volatile uint32_t *)(ioh + off) = data;
! 107: }
! 108:
! 109:
! 110: void
! 111: hostio_write_4(void *cookie, bus_space_handle_t ioh, bus_size_t off, uint32_t data)
! 112: {
! 113: *(volatile uint32_t *)(ioh + off) = data;
! 114: }
! 115:
CVSweb