lamebus

Lamebus - Machine-independent LAMEbus code#include#include#include#include Register offsets

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * Machine-independent LAMEbus code. */ #include <types.h> #include <lib.h> #include <machine/spl.h> #include <lamebus/lamebus.h> /* Register offsets within each config region */ #define CFGREG_VID 0 /* Vendor ID */ #define CFGREG_DID 4 /* Device ID */ #define CFGREG_DRL 8 /* Device Revision Level */ /* LAMEbus controller private registers (offsets within its config region) */ #define CTLREG_RAMSZ 0x200 #define CTLREG_IRQS 0x204 #define CTLREG_PWR 0x208 /* * Read a config register for the given slot. */ static inline u_int32_t read_cfg_register(struct lamebus_softc *lb, int slot, u_int32_t offset) { /* Note that lb might be NULL on some platforms in some contexts. */ offset += LB_CONFIG_SIZE*slot; return lamebus_read_register(lb, LB_CONTROLLER_SLOT, offset); } /* * Write a config register for a given slot. */ static inline void write_cfg_register(struct lamebus_softc *lb, int slot, u_int32_t offset, u_int32_t val) { offset += LB_CONFIG_SIZE*slot; lamebus_write_register(lb, LB_CONTROLLER_SLOT, offset, val); } /* * Read one of the bus controller's registers. */ static inline u_int32_t read_ctl_register(struct lamebus_softc *lb, u_int32_t offset) { /* Note that lb might be NULL on some platforms in some contexts. */ return read_cfg_register(lb, LB_CONTROLLER_SLOT, offset); } /*
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
* Write one of the bus controller's registers. */ static inline void write_ctl_register(struct lamebus_softc *lb, u_int32_t offset, u_int32_t val) { write_cfg_register(lb, LB_CONTROLLER_SLOT, offset, val); } /* * Probe function. * * Given a LAMEbus, look for a device that's not already been marked * in use, has the specified IDs, and has a device revision level in * the specified range (which is inclusive on both ends.) * * Returns the slot number found (0-31) or -1 if nothing suitable was * found. */ int lamebus_probe(struct lamebus_softc *sc, u_int32_t vendorid, u_int32_t deviceid, u_int32_t lowver, u_int32_t highver) { int slot; u_int32_t val; int spl; /* * Because the slot information in sc is used when dispatching * interrupts, disable interrupts while working with it. */ spl = splhigh();
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/10/2009 for the course CS 536 taught by Professor Lums during the Spring '09 term at Indiana.

Page1 / 8

Lamebus - Machine-independent LAMEbus code#include#include#include#include Register offsets

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online