usb_serial.h (196219) | usb_serial.h (197570) |
---|---|
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 196219 2009-08-14 20:03:53Z jhb $ */ | 2/* $FreeBSD: head/sys/dev/usb/serial/usb_serial.h 197570 2009-09-28 08:13:50Z thompsa $ */ |
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: --- 78 unchanged lines hidden (view full) --- 89 * be called after "ucom_cfg_open()" if the device is detached 90 * while it is open! 91 */ 92struct ucom_callback { 93 void (*ucom_cfg_get_status) (struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr); 94 void (*ucom_cfg_set_dtr) (struct ucom_softc *, uint8_t); 95 void (*ucom_cfg_set_rts) (struct ucom_softc *, uint8_t); 96 void (*ucom_cfg_set_break) (struct ucom_softc *, uint8_t); | 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: --- 78 unchanged lines hidden (view full) --- 89 * be called after "ucom_cfg_open()" if the device is detached 90 * while it is open! 91 */ 92struct ucom_callback { 93 void (*ucom_cfg_get_status) (struct ucom_softc *, uint8_t *plsr, uint8_t *pmsr); 94 void (*ucom_cfg_set_dtr) (struct ucom_softc *, uint8_t); 95 void (*ucom_cfg_set_rts) (struct ucom_softc *, uint8_t); 96 void (*ucom_cfg_set_break) (struct ucom_softc *, uint8_t); |
97 void (*ucom_cfg_set_ring) (struct ucom_softc *, uint8_t); |
|
97 void (*ucom_cfg_param) (struct ucom_softc *, struct termios *); 98 void (*ucom_cfg_open) (struct ucom_softc *); 99 void (*ucom_cfg_close) (struct ucom_softc *); 100 int (*ucom_pre_open) (struct ucom_softc *); 101 int (*ucom_pre_param) (struct ucom_softc *, struct termios *); 102 int (*ucom_ioctl) (struct ucom_softc *, uint32_t, caddr_t, int, struct thread *); 103 void (*ucom_start_read) (struct ucom_softc *); 104 void (*ucom_stop_read) (struct ucom_softc *); 105 void (*ucom_start_write) (struct ucom_softc *); 106 void (*ucom_stop_write) (struct ucom_softc *); 107 void (*ucom_tty_name) (struct ucom_softc *, char *pbuf, uint16_t buflen, uint16_t local_subunit); | 98 void (*ucom_cfg_param) (struct ucom_softc *, struct termios *); 99 void (*ucom_cfg_open) (struct ucom_softc *); 100 void (*ucom_cfg_close) (struct ucom_softc *); 101 int (*ucom_pre_open) (struct ucom_softc *); 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 local_subunit); |
109 void (*ucom_poll) (struct ucom_softc *); |
|
108}; 109 110/* Line status register */ 111#define ULSR_RCV_FIFO 0x80 112#define ULSR_TSRE 0x40 /* Transmitter empty: byte sent */ 113#define ULSR_TXRDY 0x20 /* Transmitter buffer empty */ 114#define ULSR_BI 0x10 /* Break detected */ 115#define ULSR_FE 0x08 /* Framing error: bad stop bit */ --- 41 unchanged lines hidden (view full) --- 157 const struct ucom_callback *sc_callback; 158 struct ucom_super_softc *sc_super; 159 struct tty *sc_tty; 160 struct mtx *sc_mtx; 161 void *sc_parent; 162 uint32_t sc_unit; 163 uint32_t sc_local_unit; 164 uint16_t sc_portno; | 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 */ --- 41 unchanged lines hidden (view full) --- 159 const struct ucom_callback *sc_callback; 160 struct ucom_super_softc *sc_super; 161 struct tty *sc_tty; 162 struct mtx *sc_mtx; 163 void *sc_parent; 164 uint32_t sc_unit; 165 uint32_t sc_local_unit; 166 uint16_t sc_portno; |
165 uint8_t sc_flag; | 167 uint16_t sc_flag; |
166#define UCOM_FLAG_RTS_IFLOW 0x01 /* use RTS input flow control */ 167#define UCOM_FLAG_GONE 0x02 /* the device is gone */ 168#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ 169#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ 170#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ 171#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ | 168#define UCOM_FLAG_RTS_IFLOW 0x01 /* use RTS input flow control */ 169#define UCOM_FLAG_GONE 0x02 /* the device is gone */ 170#define UCOM_FLAG_ATTACHED 0x04 /* set if attached */ 171#define UCOM_FLAG_GP_DATA 0x08 /* set if get and put data is possible */ 172#define UCOM_FLAG_LL_READY 0x20 /* set if low layer is ready */ 173#define UCOM_FLAG_HL_READY 0x40 /* set if high layer is ready */ |
174#define UCOM_FLAG_CONSOLE 0x80 /* set if device is a console */ |
|
172 uint8_t sc_lsr; 173 uint8_t sc_msr; 174 uint8_t sc_mcr; 175 uint8_t sc_ttyfreed; /* set when TTY has been freed */ 176 /* programmed line state bits */ 177 uint8_t sc_pls_set; /* set bits */ 178 uint8_t sc_pls_clr; /* cleared bits */ 179 uint8_t sc_pls_curr; /* last state */ 180#define UCOM_LS_DTR 0x01 181#define UCOM_LS_RTS 0x02 182#define UCOM_LS_BREAK 0x04 | 175 uint8_t sc_lsr; 176 uint8_t sc_msr; 177 uint8_t sc_mcr; 178 uint8_t sc_ttyfreed; /* set when TTY has been freed */ 179 /* programmed line state bits */ 180 uint8_t sc_pls_set; /* set bits */ 181 uint8_t sc_pls_clr; /* cleared bits */ 182 uint8_t sc_pls_curr; /* last state */ 183#define UCOM_LS_DTR 0x01 184#define UCOM_LS_RTS 0x02 185#define UCOM_LS_BREAK 0x04 |
186#define UCOM_LS_RING 0x08 |
|
183}; 184 185#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ 186 usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) 187 188int ucom_attach(struct ucom_super_softc *, 189 struct ucom_softc *, uint32_t, void *, 190 const struct ucom_callback *callback, struct mtx *); 191void ucom_detach(struct ucom_super_softc *, 192 struct ucom_softc *, uint32_t); 193void ucom_status_change(struct ucom_softc *); 194uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, 195 uint32_t, uint32_t, uint32_t *); 196void ucom_put_data(struct ucom_softc *, struct usb_page_cache *, 197 uint32_t, uint32_t); 198uint8_t ucom_cfg_is_gone(struct ucom_softc *); 199#endif /* _USB_SERIAL_H_ */ | 187}; 188 189#define ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \ 190 usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo) 191 192int ucom_attach(struct ucom_super_softc *, 193 struct ucom_softc *, uint32_t, void *, 194 const struct ucom_callback *callback, struct mtx *); 195void ucom_detach(struct ucom_super_softc *, 196 struct ucom_softc *, uint32_t); 197void ucom_status_change(struct ucom_softc *); 198uint8_t ucom_get_data(struct ucom_softc *, struct usb_page_cache *, 199 uint32_t, uint32_t, uint32_t *); 200void ucom_put_data(struct ucom_softc *, struct usb_page_cache *, 201 uint32_t, uint32_t); 202uint8_t ucom_cfg_is_gone(struct ucom_softc *); 203#endif /* _USB_SERIAL_H_ */ |