1/*-
2 * cyclades cyclom-y serial driver
3 * Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993
4 *
5 * Copyright (c) 1993 Andrew Herbert.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 15 unchanged lines hidden (view full) ---
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/cy/cy.c 130585 2004-06-16 09:47:26Z phk $");
33
34#include "opt_compat.h"
35
36/*
37 * TODO:
38 * Atomic COR change.
39 * Consoles.
40 */
--- 116 unchanged lines hidden (view full) ---
157#define CALLOUT_MASK 0x80
158#define CONTROL_MASK 0x60
159#define CONTROL_INIT_STATE 0x20
160#define CONTROL_LOCK_STATE 0x40
161#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev)))
162#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK)
163/*
164 * Not all of the magic is parametrized in the following macros. 16 and
165 * 0xff are related to the bitfields in a udev_t. CY_MAX_PORTS must be
166 * ((0xff & ~MINOR_MAGIC_MASK) + 1) for things to work.
167 */
168#define MINOR_TO_UNIT(mynor) (((mynor) >> 16) * CY_MAX_PORTS \
169 | (((mynor) & 0xff) & ~MINOR_MAGIC_MASK))
170#define UNIT_TO_MINOR(unit) (((unit) / CY_MAX_PORTS) << 16 \
171 | (((unit) & 0xff) & ~MINOR_MAGIC_MASK))
172
173/*
--- 2702 unchanged lines hidden ---
2 * cyclades cyclom-y serial driver
3 * Andrew Herbert <andrew@werple.apana.org.au>, 17 August 1993
4 *
5 * Copyright (c) 1993 Andrew Herbert.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
--- 15 unchanged lines hidden (view full) ---
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/dev/cy/cy.c 130585 2004-06-16 09:47:26Z phk $");
33
34#include "opt_compat.h"
35
36/*
37 * TODO:
38 * Atomic COR change.
39 * Consoles.
40 */
--- 116 unchanged lines hidden (view full) ---
157#define CALLOUT_MASK 0x80
158#define CONTROL_MASK 0x60
159#define CONTROL_INIT_STATE 0x20
160#define CONTROL_LOCK_STATE 0x40
161#define DEV_TO_UNIT(dev) (MINOR_TO_UNIT(minor(dev)))
162#define MINOR_MAGIC_MASK (CALLOUT_MASK | CONTROL_MASK)
163/*
164 * Not all of the magic is parametrized in the following macros. 16 and
165 * 0xff are related to the bitfields in a udev_t. CY_MAX_PORTS must be
166 * ((0xff & ~MINOR_MAGIC_MASK) + 1) for things to work.
167 */
168#define MINOR_TO_UNIT(mynor) (((mynor) >> 16) * CY_MAX_PORTS \
169 | (((mynor) & 0xff) & ~MINOR_MAGIC_MASK))
170#define UNIT_TO_MINOR(unit) (((unit) / CY_MAX_PORTS) << 16 \
171 | (((unit) & 0xff) & ~MINOR_MAGIC_MASK))
172
173/*
--- 2702 unchanged lines hidden ---