Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/ppbus/ppb_base.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
* ppb_poll_bus() | * ppb_poll_bus() | ||||
* | * | ||||
* Polls the bus | * Polls the bus | ||||
* | * | ||||
* max is a delay in 10-milliseconds | * max is a delay in 10-milliseconds | ||||
*/ | */ | ||||
int | int | ||||
ppb_poll_bus(device_t bus, int max, | ppb_poll_bus(device_t bus, int max, | ||||
char mask, char status, int how) | uint8_t mask, uint8_t status, int how) | ||||
{ | { | ||||
struct ppb_data *ppb = DEVTOSOFTC(bus); | struct ppb_data *ppb = DEVTOSOFTC(bus); | ||||
int i, j, error; | int i, j, error; | ||||
char r; | uint8_t r; | ||||
ppb_assert_locked(bus); | ppb_assert_locked(bus); | ||||
/* try at least up to 10ms */ | /* try at least up to 10ms */ | ||||
for (j = 0; j < ((how & PPB_POLL) ? max : 1); j++) { | for (j = 0; j < ((how & PPB_POLL) ? max : 1); j++) { | ||||
for (i = 0; i < 10000; i++) { | for (i = 0; i < 10000; i++) { | ||||
r = ppb_rstr(bus); | r = ppb_rstr(bus); | ||||
DELAY(1); | DELAY(1); | ||||
▲ Show 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* ppb_get_status() | * ppb_get_status() | ||||
* | * | ||||
* Read the status register and update the status info | * Read the status register and update the status info | ||||
*/ | */ | ||||
int | int | ||||
ppb_get_status(device_t bus, struct ppb_status *status) | ppb_get_status(device_t bus, struct ppb_status *status) | ||||
{ | { | ||||
register char r; | uint8_t r; | ||||
ppb_assert_locked(bus); | ppb_assert_locked(bus); | ||||
r = status->status = ppb_rstr(bus); | r = status->status = ppb_rstr(bus); | ||||
status->timeout = r & TIMEOUT; | status->timeout = r & TIMEOUT; | ||||
status->error = !(r & nFAULT); | status->error = !(r & nFAULT); | ||||
status->select = r & SELECT; | status->select = r & SELECT; | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |