ppb_1284.c (185003) | ppb_1284.c (187576) |
---|---|
1/*- 2 * Copyright (c) 1997 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997 Nicolas Souchu 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 13 unchanged lines hidden (view full) --- 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/ppbus/ppb_1284.c 185003 2008-11-16 17:42:02Z jhb $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ppbus/ppb_1284.c 187576 2009-01-21 23:10:06Z jhb $"); |
31 32/* 33 * General purpose routines for the IEEE1284-1994 Standard 34 */ 35 36#include "opt_ppb_1284.h" 37 38#include <sys/param.h> | 31 32/* 33 * General purpose routines for the IEEE1284-1994 Standard 34 */ 35 36#include "opt_ppb_1284.h" 37 38#include <sys/param.h> |
39#include <sys/lock.h> 40#include <sys/mutex.h> |
|
39#include <sys/systm.h> 40#include <sys/bus.h> 41 42 43#include <dev/ppbus/ppbconf.h> 44#include <dev/ppbus/ppb_1284.h> 45 46#include "ppbus_if.h" --- 40 unchanged lines hidden (view full) --- 87/* 88 * ppb_1284_get_state() 89 * 90 * Get IEEE1284 state 91 */ 92int 93ppb_1284_get_state(device_t bus) 94{ | 41#include <sys/systm.h> 42#include <sys/bus.h> 43 44 45#include <dev/ppbus/ppbconf.h> 46#include <dev/ppbus/ppb_1284.h> 47 48#include "ppbus_if.h" --- 40 unchanged lines hidden (view full) --- 89/* 90 * ppb_1284_get_state() 91 * 92 * Get IEEE1284 state 93 */ 94int 95ppb_1284_get_state(device_t bus) 96{ |
97 struct ppb_data *ppb = DEVTOSOFTC(bus); |
|
95 | 98 |
96 return (DEVTOSOFTC(bus)->state); | 99 mtx_assert(ppb->ppc_lock, MA_OWNED); 100 return (ppb->state); |
97} 98 99/* 100 * ppb_1284_set_state() 101 * 102 * Change IEEE1284 state if no error occured 103 */ 104int 105ppb_1284_set_state(device_t bus, int state) 106{ 107 struct ppb_data *ppb = DEVTOSOFTC(bus); 108 109 /* call ppb_1284_reset_error() if you absolutly want to change 110 * the state from PPB_ERROR to another */ | 101} 102 103/* 104 * ppb_1284_set_state() 105 * 106 * Change IEEE1284 state if no error occured 107 */ 108int 109ppb_1284_set_state(device_t bus, int state) 110{ 111 struct ppb_data *ppb = DEVTOSOFTC(bus); 112 113 /* call ppb_1284_reset_error() if you absolutly want to change 114 * the state from PPB_ERROR to another */ |
115 mtx_assert(ppb->ppc_lock, MA_OWNED); |
|
111 if ((ppb->state != PPB_ERROR) && 112 (ppb->error == PPB_NO_ERROR)) { 113 ppb->state = state; 114 ppb->error = PPB_NO_ERROR; 115 } 116 117 return (0); 118} --- 742 unchanged lines hidden --- | 116 if ((ppb->state != PPB_ERROR) && 117 (ppb->error == PPB_NO_ERROR)) { 118 ppb->state = state; 119 ppb->error = PPB_NO_ERROR; 120 } 121 122 return (0); 123} --- 742 unchanged lines hidden --- |