Lines Matching refs:fd
66 int (*init) (int fd, struct uart_t *u, struct termios *ti);
67 int (*post) (int fd, struct uart_t *u, struct termios *ti);
143 int set_speed(int fd, struct termios *ti, int speed) in set_speed() argument
151 if (tcsetattr(fd, TCSANOW, ti) < 0) in set_speed()
160 int read_hci_event(int fd, unsigned char* buf, int size) in read_hci_event() argument
171 r = read(fd, buf, 1); in read_hci_event()
181 r = read(fd, buf + count, 3 - count); in read_hci_event()
194 r = read(fd, buf + count, remain - (count - 3)); in read_hci_event()
206 static int ericsson(int fd, struct uart_t *u, struct termios *ti) in ericsson() argument
249 if (write(fd, cmd, 5) != 5) { in ericsson()
261 static int digi(int fd, struct uart_t *u, struct termios *ti) in digi() argument
286 if (write(fd, cmd, 5) != 5) { in digi()
295 static int texas(int fd, struct uart_t *u, struct termios *ti) in texas() argument
297 return texas_init(fd, ti); in texas()
300 static int texas2(int fd, struct uart_t *u, struct termios *ti) in texas2() argument
302 return texas_post(fd, ti); in texas2()
305 static int texasalt(int fd, struct uart_t *u, struct termios *ti) in texasalt() argument
307 return texasalt_init(fd, u->speed, ti); in texasalt()
310 static int ath3k_ps(int fd, struct uart_t *u, struct termios *ti) in ath3k_ps() argument
312 return ath3k_init(fd, u->speed, u->init_speed, u->bdaddr, ti); in ath3k_ps()
315 static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti) in ath3k_pm() argument
317 return ath3k_post(fd, u->pm); in ath3k_pm()
320 static int qualcomm(int fd, struct uart_t *u, struct termios *ti) in qualcomm() argument
322 return qualcomm_init(fd, u->speed, ti, u->bdaddr); in qualcomm()
325 static int read_check(int fd, void *buf, int count) in read_check() argument
330 res = read(fd, buf, count); in read_check()
385 static int bcsp(int fd, struct uart_t *u, struct termios *ti) in bcsp() argument
397 if (set_speed(fd, ti, u->speed) < 0) { in bcsp()
405 if (tcsetattr(fd, TCSANOW, ti) < 0) { in bcsp()
412 serial_fd = fd; in bcsp()
423 if (read_check(fd, &byte, 1) == -1){ in bcsp()
430 if ( read_check(fd, &bcsph[0], 1) == -1){ in bcsp()
436 if ( read_check(fd, &bcsph[1], 3) == -1){ in bcsp()
446 if (read_check(fd, &bcspp, 4) == -1){ in bcsp()
452 if (write(fd, &bcsp_sync_resp_pkt,10) < 0) in bcsp()
467 if (read_check(fd, &byte, 1) == -1){ in bcsp()
474 if (read_check(fd, &bcsph[0], 1) == -1){ in bcsp()
480 if (read_check(fd, &bcsph[1], 3) == -1){ in bcsp()
491 if (read_check(fd, &bcspp, 4) == -1){ in bcsp()
497 len = write(fd, &bcsp_sync_resp_pkt, 10); in bcsp()
499 len = write(fd, &bcsp_conf_resp_pkt, 10); in bcsp()
520 static int csr(int fd, struct uart_t *u, struct termios *ti) in csr() argument
567 if (write(fd, cmd, clen) != clen) { in csr()
573 if (read_hci_event(fd, resp, 100) < 0) { in csr()
611 if (write(fd, cmd, clen) != clen) { in csr()
617 if (read_hci_event(fd, resp, 100) < 0) { in csr()
677 if (write(fd, cmd, clen) != clen) { in csr()
690 static int swave(int fd, struct uart_t *u, struct termios *ti) in swave() argument
732 if (write(fd, cmd, 10) != 10) { in swave()
744 r = read(fd, rsp, sizeof(rsp)); in swave()
773 if (write(fd, cmd, 4) != 4) { in swave()
795 static int st(int fd, struct uart_t *u, struct termios *ti) in st() argument
838 if (write(fd, cmd, 5) != 5) { in st()
847 static int stlc2500(int fd, struct uart_t *u, struct termios *ti) in stlc2500() argument
855 rvalue = ericsson(fd, u, ti); in stlc2500()
862 if (set_speed(fd, ti, u->speed) < 0) { in stlc2500()
872 if ((n = read_hci_event(fd, resp, 10)) < 0) { in stlc2500()
884 return stlc2500_init(fd, &bdaddr); in stlc2500()
887 static int bgb2xx(int fd, struct uart_t *u, struct termios *ti) in bgb2xx() argument
893 return bgb2xx_init(fd, &bdaddr); in bgb2xx()
900 static int bcm2035(int fd, struct uart_t *u, struct termios *ti) in bcm2035() argument
914 if (write(fd, cmd, 4) != 4) { in bcm2035()
920 if ((n = read_hci_event(fd, resp, 4)) < 0) { in bcm2035()
936 if (write(fd, cmd, 10) != 10) { in bcm2035()
942 if ((n = read_hci_event(fd, resp, 10)) < 0) { in bcm2035()
957 if (write(fd, cmd, 4) != 4) { in bcm2035()
964 if ((n = read_hci_event(fd, resp, 4)) < 0) { in bcm2035()
978 if (write(fd, cmd, 4) != 4) { in bcm2035()
985 if ((n = read_hci_event(fd, resp, 4)) < 0) { in bcm2035()
1024 if (write(fd, cmd, 6) != 6) { in bcm2035()
1029 if ((n = read_hci_event(fd, resp, 6)) < 0) { in bcm2035()
1167 int fd, i; in init_uart() local
1173 fd = open(dev, O_RDWR | O_NOCTTY); in init_uart()
1174 if (fd < 0) { in init_uart()
1179 tcflush(fd, TCIOFLUSH); in init_uart()
1181 if (tcgetattr(fd, &ti) < 0) { in init_uart()
1194 if (tcsetattr(fd, TCSANOW, &ti) < 0) { in init_uart()
1200 if (set_speed(fd, &ti, u->init_speed) < 0) { in init_uart()
1205 tcflush(fd, TCIOFLUSH); in init_uart()
1208 tcsendbreak(fd, 0); in init_uart()
1212 if (u->init && u->init(fd, u, &ti) < 0) in init_uart()
1215 tcflush(fd, TCIOFLUSH); in init_uart()
1218 if (set_speed(fd, &ti, u->speed) < 0) { in init_uart()
1225 if (ioctl(fd, TIOCSETD, &i) < 0) { in init_uart()
1230 if (flags && ioctl(fd, HCIUARTSETFLAGS, flags) < 0) { in init_uart()
1235 if (ioctl(fd, HCIUARTSETPROTO, u->proto) < 0) { in init_uart()
1240 if (u->post && u->post(fd, u, &ti) < 0) in init_uart()
1243 return fd; in init_uart()
1423 p.fd = n; in main()