diff options
author | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 20:17:42 -0500 |
---|---|---|
committer | root <root@avtech.domain.avtechpulse.com> | 1999-12-31 20:17:42 -0500 |
commit | 41e73b50f0addac28ee0e87fe10043dc6d45ba68 (patch) | |
tree | 03ef5764d63837452eedc07dc682d2d6ebfc3c63 /bus.c | |
parent | 2a637c5759191f2911cdf5548d05496600e0655a (diff) |
make hardware-detect flags global
Diffstat (limited to 'bus.c')
-rw-r--r-- | bus.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -15,6 +15,7 @@ #include <unistd.h> #include <stdbool.h> #include <inttypes.h> +#include "globals.h" #include "bus.h" #define GPIO_SYSFSPATH "/sys/class/gpio" @@ -360,18 +361,17 @@ static unsigned gpio_pins[] = { GPIO0_X + 22, // i.e., GPIO0_22 static volatile uint8_t* extbus; -static bool isbb = false; void bus_init() { - isbb = util_isbeaglebone(); + globals.HWDetect.beaglebone = util_isbeaglebone(); - if (!isbb) { + if (!globals.HWDetect.beaglebone) { printf("This doesn't seem to be a beaglebone.. bus stuff disabled!\n"); } - if (isbb) { + if (globals.HWDetect.beaglebone) { gpmc_setup(); extbus = (uint8_t*) util_mapmemoryblock(0x01000000, 0x100); @@ -396,7 +396,7 @@ void bus_init() int bus_getpin(int pin) { - if (isbb) { + if (globals.HWDetect.beaglebone) { return gpio_readvalue(gpio_pins[pin]); } else { return 0; @@ -405,21 +405,21 @@ int bus_getpin(int pin) void bus_setpin(int pin, int value) { - if (isbb) { + if (globals.HWDetect.beaglebone) { gpio_writevalue(gpio_pins[pin], value & 0x1); } } void bus_writebyte(uint8_t address, uint8_t data) { - if (isbb) { + if (globals.HWDetect.beaglebone) { *(extbus + address) = data; } } uint8_t bus_readbyte(uint8_t address) { - if (isbb) { + if (globals.HWDetect.beaglebone) { return *(extbus + address); } else { return 0; @@ -428,7 +428,7 @@ uint8_t bus_readbyte(uint8_t address) void bus_shutdown() { - if (isbb) { + if (globals.HWDetect.beaglebone) { util_unmapmemoryblock((void*) extbus, 0x100); int i; for (i = 0; i < SIZEOFARRAY(gpio_pins); i++) { |