Deleted Added
full compact
ng_hci_ulpi.c (107120) ng_hci_ulpi.c (109623)
1/*
2 * ng_hci_ulpi.c
3 *
4 * Copyright (c) Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: ng_hci_ulpi.c,v 1.14 2002/11/12 22:35:40 max Exp $
1/*
2 * ng_hci_ulpi.c
3 *
4 * Copyright (c) Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 12 unchanged lines hidden (view full) ---

21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: ng_hci_ulpi.c,v 1.14 2002/11/12 22:35:40 max Exp $
29 * $FreeBSD: head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c 107120 2002-11-20 23:01:59Z julian $
29 * $FreeBSD: head/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c 109623 2003-01-21 08:56:16Z alfred $
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/kernel.h>
35#include <sys/endian.h>
36#include <sys/malloc.h>
37#include <sys/mbuf.h>

--- 189 unchanged lines hidden (view full) ---

227 }
228
229 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
230
231 /*
232 * Create HCI command
233 */
234
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34#include <sys/kernel.h>
35#include <sys/endian.h>
36#include <sys/malloc.h>
37#include <sys/mbuf.h>

--- 189 unchanged lines hidden (view full) ---

227 }
228
229 bcopy(&ep->bdaddr, &con->bdaddr, sizeof(con->bdaddr));
230
231 /*
232 * Create HCI command
233 */
234
235 MGETHDR(m, M_DONTWAIT, MT_DATA);
235 MGETHDR(m, M_NOWAIT, MT_DATA);
236 if (m == NULL) {
237 ng_hci_free_con(con);
238 error = ENOBUFS;
239 goto out;
240 }
241
242 m->m_pkthdr.len = m->m_len = sizeof(*req);
243 req = mtod(m, struct acl_con_req *);

--- 178 unchanged lines hidden (view full) ---

422 }
423
424 bcopy(&ep->bdaddr, &sco_con->bdaddr, sizeof(sco_con->bdaddr));
425
426 /*
427 * Create HCI command
428 */
429
236 if (m == NULL) {
237 ng_hci_free_con(con);
238 error = ENOBUFS;
239 goto out;
240 }
241
242 m->m_pkthdr.len = m->m_len = sizeof(*req);
243 req = mtod(m, struct acl_con_req *);

--- 178 unchanged lines hidden (view full) ---

422 }
423
424 bcopy(&ep->bdaddr, &sco_con->bdaddr, sizeof(sco_con->bdaddr));
425
426 /*
427 * Create HCI command
428 */
429
430 MGETHDR(m, M_DONTWAIT, MT_DATA);
430 MGETHDR(m, M_NOWAIT, MT_DATA);
431 if (m == NULL) {
432 ng_hci_free_con(sco_con);
433 error = ENOBUFS;
434 goto out;
435 }
436
437 m->m_pkthdr.len = m->m_len = sizeof(*req);
438 req = mtod(m, struct sco_con_req *);

--- 101 unchanged lines hidden (view full) ---

540 error = EINVAL;
541 goto out;
542 }
543
544 /*
545 * Create HCI command
546 */
547
431 if (m == NULL) {
432 ng_hci_free_con(sco_con);
433 error = ENOBUFS;
434 goto out;
435 }
436
437 m->m_pkthdr.len = m->m_len = sizeof(*req);
438 req = mtod(m, struct sco_con_req *);

--- 101 unchanged lines hidden (view full) ---

540 error = EINVAL;
541 goto out;
542 }
543
544 /*
545 * Create HCI command
546 */
547
548 MGETHDR(m, M_DONTWAIT, MT_DATA);
548 MGETHDR(m, M_NOWAIT, MT_DATA);
549 if (m == NULL) {
550 error = ENOBUFS;
551 goto out;
552 }
553
554 m->m_pkthdr.len = m->m_len = sizeof(*req);
555 req = mtod(m, struct discon_req *);
556 req->hdr.type = NG_HCI_CMD_PKT;

--- 232 unchanged lines hidden (view full) ---

789
790 switch (con->state) {
791 case NG_HCI_CON_W4_LP_CON_RSP:
792
793 /*
794 * Create HCI command
795 */
796
549 if (m == NULL) {
550 error = ENOBUFS;
551 goto out;
552 }
553
554 m->m_pkthdr.len = m->m_len = sizeof(*req);
555 req = mtod(m, struct discon_req *);
556 req->hdr.type = NG_HCI_CMD_PKT;

--- 232 unchanged lines hidden (view full) ---

789
790 switch (con->state) {
791 case NG_HCI_CON_W4_LP_CON_RSP:
792
793 /*
794 * Create HCI command
795 */
796
797 MGETHDR(m, M_DONTWAIT, MT_DATA);
797 MGETHDR(m, M_NOWAIT, MT_DATA);
798 if (m == NULL) {
799 error = ENOBUFS;
800 goto out;
801 }
802
803 req = mtod(m, struct con_rsp_req *);
804 req->hdr.type = NG_HCI_CMD_PKT;
805

--- 206 unchanged lines hidden (view full) ---

1012 error = EINVAL;
1013 goto out;
1014 }
1015
1016 /*
1017 * Create HCI command
1018 */
1019
798 if (m == NULL) {
799 error = ENOBUFS;
800 goto out;
801 }
802
803 req = mtod(m, struct con_rsp_req *);
804 req->hdr.type = NG_HCI_CMD_PKT;
805

--- 206 unchanged lines hidden (view full) ---

1012 error = EINVAL;
1013 goto out;
1014 }
1015
1016 /*
1017 * Create HCI command
1018 */
1019
1020 MGETHDR(m, M_DONTWAIT, MT_DATA);
1020 MGETHDR(m, M_NOWAIT, MT_DATA);
1021 if (m == NULL) {
1022 error = ENOBUFS;
1023 goto out;
1024 }
1025
1026 m->m_pkthdr.len = m->m_len = sizeof(*req);
1027 req = mtod(m, struct qos_setup_req *);
1028 req->hdr.type = NG_HCI_CMD_PKT;

--- 213 unchanged lines hidden (view full) ---

1242 __func__, NG_NODE_NAME(node)));
1243
1244 con->flags &= ~NG_HCI_CON_WATCHDOG_TIMEOUT_PENDING;
1245
1246 /*
1247 * Create HCI command
1248 */
1249
1021 if (m == NULL) {
1022 error = ENOBUFS;
1023 goto out;
1024 }
1025
1026 m->m_pkthdr.len = m->m_len = sizeof(*req);
1027 req = mtod(m, struct qos_setup_req *);
1028 req->hdr.type = NG_HCI_CMD_PKT;

--- 213 unchanged lines hidden (view full) ---

1242 __func__, NG_NODE_NAME(node)));
1243
1244 con->flags &= ~NG_HCI_CON_WATCHDOG_TIMEOUT_PENDING;
1245
1246 /*
1247 * Create HCI command
1248 */
1249
1250 MGETHDR(m, M_DONTWAIT, MT_DATA);
1250 MGETHDR(m, M_NOWAIT, MT_DATA);
1251 if (m == NULL)
1252 return; /* XXX this is bad */
1253
1254 m->m_pkthdr.len = m->m_len = sizeof(*req);
1255 req = mtod(m, struct discon_req *);
1256 req->hdr.type = NG_HCI_CMD_PKT;
1257 req->hdr.length = sizeof(req->cp);
1258 req->hdr.opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,

--- 22 unchanged lines hidden ---
1251 if (m == NULL)
1252 return; /* XXX this is bad */
1253
1254 m->m_pkthdr.len = m->m_len = sizeof(*req);
1255 req = mtod(m, struct discon_req *);
1256 req->hdr.type = NG_HCI_CMD_PKT;
1257 req->hdr.length = sizeof(req->cp);
1258 req->hdr.opcode = htole16(NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL,

--- 22 unchanged lines hidden ---