From 2c6619e446da9eb6027e256ade74c8325fba3544 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Tue, 14 Oct 2008 20:28:22 +0000 Subject: [PATCH] Styling and define module path outside the driver git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28105 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/bluetooth/btModules.h | 12 +++++++++++ headers/private/bluetooth/l2cap.h | 20 ++++++++++++------- .../bluetooth/h2/h2generic/h2generic.c | 8 +++----- .../drivers/bluetooth/h2/h2generic/h2upper.c | 7 ++----- 4 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 headers/private/bluetooth/btModules.h diff --git a/headers/private/bluetooth/btModules.h b/headers/private/bluetooth/btModules.h new file mode 100644 index 0000000000..ffb43ff0af --- /dev/null +++ b/headers/private/bluetooth/btModules.h @@ -0,0 +1,12 @@ +/* + * Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef _BTMODULES_H +#define _BTMODULES_H + + +#define NET_BLUETOOTH_DEVICE_NAME "network/devices/bluetooth/v1" +#define NET_BLUETOOTH_L2CAP_NAME "network/protocols/l2cap/v1" + +#endif // _BCOREDATA_H diff --git a/headers/private/bluetooth/l2cap.h b/headers/private/bluetooth/l2cap.h index 4ea917f9df..a428d0c19f 100644 --- a/headers/private/bluetooth/l2cap.h +++ b/headers/private/bluetooth/l2cap.h @@ -32,7 +32,13 @@ // TODO: from BSD compatibility layer #define htole16(x) (x) +#define le16toh(x) (x) +#define le32toh(x) (x) +#define htole32(x) (x) +#define HZ 1000000 // us per second TODO: move somewhere more generic +#define bluetooth_l2cap_ertx_timeout (60*HZ) +#define bluetooth_l2cap_rtx_timeout (300*HZ) /* * Channel IDs are assigned relative to the instance of L2CAP node, i.e. @@ -50,13 +56,13 @@ /* * L2CAP signaling command ident's are assigned relative to the connection, - * because there is only one signaling channel (cid == 0x01) for every - * connection. So up to 254 (0xff - 0x01) L2CAP commands can be pending at the + * because there is only one signaling channel (cid == 0x01) for every + * connection. So up to 254 (0xff - 0x01) L2CAP commands can be pending at the * same time for the same connection. */ -#define L2CAP_NULL_IDENT 0x00 /* DO NOT USE THIS IDENT */ -#define L2CAP_FIRST_IDENT 0x01 /* dynamically alloc. (start) */ -#define L2CAP_LAST_IDENT 0xff /* dynamically alloc. (end) */ +#define L2CAP_NULL_IDENT 0x00 /* DO NOT USE THIS IDENT */ +#define L2CAP_FIRST_IDENT 0x01 /* dynamically alloc. (start) */ +#define L2CAP_LAST_IDENT 0xff /* dynamically alloc. (end) */ /* L2CAP MTU */ @@ -122,7 +128,7 @@ #define L2CAP_OPT_FLUSH_TIMO 0x02 #define L2CAP_OPT_FLUSH_TIMO_SIZE sizeof(uint16) #define L2CAP_OPT_QOS 0x03 -#define L2CAP_OPT_QOS_SIZE sizeof(l2cap_qos) +#define L2CAP_OPT_QOS_SIZE sizeof(l2cap_flow_t) /* 0x4 - 0xff - reserved for future use */ /* L2CAP Information request type codes */ @@ -291,5 +297,5 @@ typedef union { typedef l2cap_info_rsp_data_t * l2cap_info_rsp_data_p; -#endif +#endif diff --git a/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c b/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c index 7ed940e59f..ae655ba4a6 100644 --- a/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c +++ b/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2generic.c @@ -22,10 +22,10 @@ #include #define BT_DEBUG_THIS_MODULE -#define MODULE_NAME "BT" #define SUBMODULE_NAME BLUETOOTH_DEVICE_DEVFS_NAME -#define SUBMODULE_COLOR 31 +#define SUBMODULE_COLOR 35 #include +#include #include "h2generic.h" #include "h2transactions.h" @@ -38,8 +38,6 @@ int32 api_version = B_CUR_DRIVER_API_VERSION; /* Modules */ static char* usb_name = B_USB_MODULE_NAME; static char* hci_name = BT_HCI_MODULE_NAME; - -#define NET_BLUETOOTH_DEVICE_NAME "network/devices/bluetooth/v1" //move out!! static char* btDevices_name = NET_BLUETOOTH_DEVICE_NAME; @@ -602,7 +600,7 @@ device_control(void *cookie, uint32 msg, void *params, size_t size) snb_put(snbuf, params, size); err = submit_tx_command(bdev, snbuf); - debugf("device launched %ld\n", err); + debugf("command launched %ld\n", err); break; case BT_UP: diff --git a/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c b/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c index d4dc3a8353..9ae02df444 100644 --- a/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c +++ b/src/add-ons/kernel/drivers/bluetooth/h2/h2generic/h2upper.c @@ -113,8 +113,7 @@ post_packet_up(bt_usb_dev* bdev, bt_packet_t type, void* buf) snb_park(&bdev->snetBufferRecycleTrash, snbuf); - } - else { + } else { flowf("ERROR:bluetooth_server not found for posting\n"); err = B_NAME_NOT_FOUND; } @@ -125,12 +124,10 @@ post_packet_up(bt_usb_dev* bdev, bt_packet_t type, void* buf) btDevices->receive_data(bdev->ndev, &nbuf); } - } - else { + } else { // TODO: Upper layer comunication /* Not freeing because is being used by upper layers*/ } - return err; }