Styling and define module path outside the driver

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28105 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2008-10-14 20:28:22 +00:00
parent 19c416bbd0
commit 2c6619e446
4 changed files with 30 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -22,10 +22,10 @@
#include <bluetooth/HCI/btHCI_module.h>
#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 <btDebug.h>
#include <btModules.h>
#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:

View File

@ -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;
}