usb_serial.h (233774) | usb_serial.h (239179) |
---|---|
1/* $NetBSD: ucomvar.h,v 1.9 2001/01/23 21:56:17 augustss Exp $ */ | 1/* $NetBSD: ucomvar.h,v 1.9 2001/01/23 21:56:17 augustss Exp $ */ |
2/* $FreeBSD: head/sys/dev/usb/serial/usb_serial.h 233774 2012-04-02 10:50:42Z hselasky $ */ | 2/* $FreeBSD: head/sys/dev/usb/serial/usb_serial.h 239179 2012-08-10 15:21:12Z hselasky $ */ |
3 4/*- 5 * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 91 unchanged lines hidden (view full) --- 102 int (*ucom_pre_param) (struct ucom_softc *, struct termios *); 103 int (*ucom_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *); 104 void (*ucom_start_read) (struct ucom_softc *); 105 void (*ucom_stop_read) (struct ucom_softc *); 106 void (*ucom_start_write) (struct ucom_softc *); 107 void (*ucom_stop_write) (struct ucom_softc *); 108 void (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t unit, uint16_t subunit); 109 void (*ucom_poll) (struct ucom_softc *); | 3 4/*- 5 * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 91 unchanged lines hidden (view full) --- 102 int (*ucom_pre_param) (struct ucom_softc *, struct termios *); 103 int (*ucom_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *); 104 void (*ucom_start_read) (struct ucom_softc *); 105 void (*ucom_stop_read) (struct ucom_softc *); 106 void (*ucom_start_write) (struct ucom_softc *); 107 void (*ucom_stop_write) (struct ucom_softc *); 108 void (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t unit, uint16_t subunit); 109 void (*ucom_poll) (struct ucom_softc *); |
110 void (*ucom_free) (struct ucom_softc *); |
|
110}; 111 112/* Line status register */ 113#define ULSR_RCV_FIFO 0x80 114#define ULSR_TSRE 0x40 /* Transmitter empty: byte sent */ 115#define ULSR_TXRDY 0x20 /* Transmitter buffer empty */ 116#define ULSR_BI 0x10 /* Break detected */ 117#define ULSR_FE 0x08 /* Framing error: bad stop bit */ --- 12 unchanged lines hidden (view full) --- 130 struct ucom_softc *sc; 131 struct termios termios_copy; 132}; 133 134struct ucom_super_softc { 135 struct usb_process sc_tq; 136 int sc_unit; 137 int sc_subunits; | 111}; 112 113/* Line status register */ 114#define ULSR_RCV_FIFO 0x80 115#define ULSR_TSRE 0x40 /* Transmitter empty: byte sent */ 116#define ULSR_TXRDY 0x20 /* Transmitter buffer empty */ 117#define ULSR_BI 0x10 /* Break detected */ 118#define ULSR_FE 0x08 /* Framing error: bad stop bit */ --- 12 unchanged lines hidden (view full) --- 131 struct ucom_softc *sc; 132 struct termios termios_copy; 133}; 134 135struct ucom_super_softc { 136 struct usb_process sc_tq; 137 int sc_unit; 138 int sc_subunits; |
139 int sc_refs; 140 int sc_wait_refs; |
|
138 struct sysctl_oid *sc_sysctl_ttyname; 139 struct sysctl_oid *sc_sysctl_ttyports; 140 char sc_ttyname[16]; 141}; 142 143struct ucom_softc { 144 /* 145 * NOTE: To avoid loosing level change information we use two --- 7 unchanged lines hidden (view full) --- 153 * CLOSE->OPEN 154 */ 155 struct ucom_cfg_task sc_start_task[2]; 156 struct ucom_cfg_task sc_open_task[2]; 157 struct ucom_cfg_task sc_close_task[2]; 158 struct ucom_cfg_task sc_line_state_task[2]; 159 struct ucom_cfg_task sc_status_task[2]; 160 struct ucom_param_task sc_param_task[2]; | 141 struct sysctl_oid *sc_sysctl_ttyname; 142 struct sysctl_oid *sc_sysctl_ttyports; 143 char sc_ttyname[16]; 144}; 145 146struct ucom_softc { 147 /* 148 * NOTE: To avoid loosing level change information we use two --- 7 unchanged lines hidden (view full) --- 156 * CLOSE->OPEN 157 */ 158 struct ucom_cfg_task sc_start_task[2]; 159 struct ucom_cfg_task sc_open_task[2]; 160 struct ucom_cfg_task sc_close_task[2]; 161 struct ucom_cfg_task sc_line_state_task[2]; 162 struct ucom_cfg_task sc_status_task[2]; 163 struct ucom_param_task sc_param_task[2]; |
161 struct cv sc_cv; | |
162 /* Used to set "UCOM_FLAG_GP_DATA" flag: */ 163 struct usb_proc_msg *sc_last_start_xfer; 164 const struct ucom_callback *sc_callback; 165 struct ucom_super_softc *sc_super; 166 struct tty *sc_tty; 167 struct mtx *sc_mtx; 168 void *sc_parent; 169 int sc_subunit; --- 4 unchanged lines hidden (view full) --- 174#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ 175#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ 176#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ 177#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ 178#define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ 179 uint8_t sc_lsr; 180 uint8_t sc_msr; 181 uint8_t sc_mcr; | 164 /* Used to set "UCOM_FLAG_GP_DATA" flag: */ 165 struct usb_proc_msg *sc_last_start_xfer; 166 const struct ucom_callback *sc_callback; 167 struct ucom_super_softc *sc_super; 168 struct tty *sc_tty; 169 struct mtx *sc_mtx; 170 void *sc_parent; 171 int sc_subunit; --- 4 unchanged lines hidden (view full) --- 176#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ 177#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ 178#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ 179#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ 180#define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ 181 uint8_t sc_lsr; 182 uint8_t sc_msr; 183 uint8_t sc_mcr; |
182 uint8_t sc_ttyfreed; /* set when TTY has been freed */ | |
183 /* programmed line state bits */ 184 uint8_t sc_pls_set; /* set bits */ 185 uint8_t sc_pls_clr; /* cleared bits */ 186 uint8_t sc_pls_curr; /* last state */ 187#define UCOM_LS_DTR 0x01 188#define UCOM_LS_RTS 0x02 189#define UCOM_LS_BREAK 0x04 190#define UCOM_LS_RING 0x08 191}; 192 | 184 /* programmed line state bits */ 185 uint8_t sc_pls_set; /* set bits */ 186 uint8_t sc_pls_clr; /* cleared bits */ 187 uint8_t sc_pls_curr; /* last state */ 188#define UCOM_LS_DTR 0x01 189#define UCOM_LS_RTS 0x02 190#define UCOM_LS_BREAK 0x04 191#define UCOM_LS_RING 0x08 192}; 193 |
194#define UCOM_MTX_ASSERT(sc, what) mtx_assert((sc)->sc_mtx, what) 195#define UCOM_MTX_LOCK(sc) mtx_lock((sc)->sc_mtx) 196#define UCOM_MTX_UNLOCK(sc) mtx_unlock((sc)->sc_mtx) 197#define UCOM_UNLOAD_DRAIN(x) \ 198SYSUNINIT(var, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_drain_all, 0) 199 |
|
193#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ 194 usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) 195 196int ucom_attach(struct ucom_super_softc *, 197 struct ucom_softc *, int, void *, 198 const struct ucom_callback *callback, struct mtx *); 199void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); 200void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); 201void ucom_status_change(struct ucom_softc *); 202uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, 203 uint32_t, uint32_t, uint32_t *); 204void ucom_put_data(struct ucom_softc *, struct usb_page_cache *, 205 uint32_t, uint32_t); 206uint8_t ucom_cfg_is_gone(struct ucom_softc *); | 200#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ 201 usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) 202 203int ucom_attach(struct ucom_super_softc *, 204 struct ucom_softc *, int, void *, 205 const struct ucom_callback *callback, struct mtx *); 206void ucom_detach(struct ucom_super_softc *, struct ucom_softc *); 207void ucom_set_pnpinfo_usb(struct ucom_super_softc *, device_t); 208void ucom_status_change(struct ucom_softc *); 209uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, 210 uint32_t, uint32_t, uint32_t *); 211void ucom_put_data(struct ucom_softc *, struct usb_page_cache *, 212 uint32_t, uint32_t); 213uint8_t ucom_cfg_is_gone(struct ucom_softc *); |
214void ucom_drain(struct ucom_super_softc *); 215void ucom_drain_all(void *); 216void ucom_ref(struct ucom_super_softc *); 217int ucom_unref(struct ucom_super_softc *); |
|
207#endif /* _USB_SERIAL_H_ */ | 218#endif /* _USB_SERIAL_H_ */ |