summaryrefslogtreecommitdiffstats
path: root/bta/sys
diff options
context:
space:
mode:
Diffstat (limited to 'bta/sys')
-rw-r--r--bta/sys/bd.c43
-rw-r--r--bta/sys/bta_sys.h44
-rw-r--r--bta/sys/bta_sys_cfg.c35
-rw-r--r--bta/sys/bta_sys_ci.c50
-rw-r--r--bta/sys/bta_sys_conn.c86
-rw-r--r--bta/sys/bta_sys_int.h34
-rw-r--r--bta/sys/bta_sys_main.c132
-rw-r--r--bta/sys/ptim.c35
-rw-r--r--bta/sys/utl.c53
9 files changed, 312 insertions, 200 deletions
diff --git a/bta/sys/bd.c b/bta/sys/bd.c
index 3c639d1..052f9b9 100644
--- a/bta/sys/bd.c
+++ b/bta/sys/bd.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: bd.c
-**
-** Description: BD address services.
-**
-** Copyright (c) 2003, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * BD address services.
+ *
+ ******************************************************************************/
#include "data_types.h"
#include "bd.h"
@@ -29,9 +42,9 @@ const BD_ADDR bd_addr_null= {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
** Function bdcpy
**
** Description Copy bd addr b to a.
-**
**
-** Returns void
+**
+** Returns void
**
*******************************************************************************/
void bdcpy(BD_ADDR a, const BD_ADDR b)
@@ -49,7 +62,7 @@ void bdcpy(BD_ADDR a, const BD_ADDR b)
** Function bdcmp
**
** Description Compare bd addr b to a.
-**
+**
**
** Returns Zero if b==a, nonzero otherwise (like memcmp).
**
@@ -73,7 +86,7 @@ int bdcmp(const BD_ADDR a, const BD_ADDR b)
** Function bdcmpany
**
** Description Compare bd addr to "any" bd addr.
-**
+**
**
** Returns Zero if a equals bd_addr_any.
**
@@ -88,7 +101,7 @@ int bdcmpany(const BD_ADDR a)
** Function bdsetany
**
** Description Set bd addr to "any" bd addr.
-**
+**
**
** Returns void
**
diff --git a/bta/sys/bta_sys.h b/bta/sys/bta_sys.h
index 32cb69a..5d724e5 100644
--- a/bta/sys/bta_sys.h
+++ b/bta/sys/bta_sys.h
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_sys.h
-**
-** Description: This is the public interface file for the BTA system
-** manager.
-**
-** Copyright (c) 2003-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This is the public interface file for the BTA system manager.
+ *
+ ******************************************************************************/
#ifndef BTA_SYS_H
#define BTA_SYS_H
@@ -79,9 +91,9 @@ typedef UINT16 tBTA_SYS_HW_MODULE;
#define BTA_ID_MSE 28 /* Message Server Equipment */
#define BTA_ID_MCE 29 /* Message Client Equipment */
#define BTA_ID_HL 30 /* Health Device Profile*/
-#define BTA_ID_GATTC 31 /* GATT Client */
-#define BTA_ID_GATTS 32 /* GATT Client */
-#define BTA_ID_BLUETOOTH_MAX 33 /* last BT profile */
+#define BTA_ID_GATTC 31 /* GATT Client */
+#define BTA_ID_GATTS 32 /* GATT Client */
+#define BTA_ID_BLUETOOTH_MAX 33 /* last BT profile */
/* FM */
#define BTA_ID_FM 34 /* FM */
@@ -165,7 +177,7 @@ typedef struct
/* data type to send events to BTA SYS HW manager */
typedef struct
{
- BT_HDR hdr;
+ BT_HDR hdr;
tBTA_SYS_HW_MODULE hw_module;
} tBTA_SYS_HW_MSG;
@@ -216,7 +228,7 @@ enum
};
typedef UINT8 tBTA_SYS_HW_EVT;
-
+
/* HW enable callback type */
typedef void (tBTA_SYS_HW_CBACK)(tBTA_SYS_HW_EVT status);
diff --git a/bta/sys/bta_sys_cfg.c b/bta/sys/bta_sys_cfg.c
index bf728cd..bcc7e40 100644
--- a/bta/sys/bta_sys_cfg.c
+++ b/bta/sys/bta_sys_cfg.c
@@ -1,14 +1,27 @@
-/*****************************************************************************
-**
-** Name: bta_sys_cfg.c
-**
-** Description: This file contains compile-time configurable constants
-** for the BTA system manager.
-**
-** Copyright (c) 2003, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains compile-time configurable constants for the BTA
+ * system manager.
+ *
+ ******************************************************************************/
#include "bt_target.h"
#include "gki.h"
diff --git a/bta/sys/bta_sys_ci.c b/bta/sys/bta_sys_ci.c
index d8ef532..d191077 100644
--- a/bta/sys/bta_sys_ci.c
+++ b/bta/sys/bta_sys_ci.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_sys_ci.c
-**
-** Description: This is the implementation file for BTA system call-in
-** functions.
-**
-** Copyright (c) 2010, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2010-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This is the implementation file for BTA system call-in functions.
+ *
+ ******************************************************************************/
#include "bta_sys.h"
#include "bta_sys_ci.h"
@@ -20,21 +32,21 @@
**
** Description This function must be called in response to function
** bta_sys_hw_enable_co(), when HW is indeed enabled
-**
**
-** Returns void
+**
+** Returns void
**
*******************************************************************************/
void bta_sys_hw_ci_enabled(tBTA_SYS_HW_MODULE module )
{
tBTA_SYS_HW_MSG *p_msg;
-
+
if ((p_msg = (tBTA_SYS_HW_MSG *) GKI_getbuf(sizeof(tBTA_SYS_HW_MSG))) != NULL)
{
p_msg->hdr.event = BTA_SYS_EVT_ENABLED_EVT;
p_msg->hw_module = module;
-
+
bta_sys_sendmsg(p_msg);
}
}
@@ -45,20 +57,20 @@
**
** Description This function must be called in response to function
** bta_sys_hw_disable_co() when HW is really OFF
-**
**
-** Returns void
+**
+** Returns void
**
*******************************************************************************/
void bta_sys_hw_ci_disabled( tBTA_SYS_HW_MODULE module )
{
tBTA_SYS_HW_MSG *p_msg;
-
+
if ((p_msg = (tBTA_SYS_HW_MSG *) GKI_getbuf(sizeof(tBTA_SYS_HW_MSG))) != NULL)
{
p_msg->hdr.event = BTA_SYS_EVT_DISABLED_EVT;
p_msg->hw_module = module;
-
+
bta_sys_sendmsg(p_msg);
}
}
diff --git a/bta/sys/bta_sys_conn.c b/bta/sys/bta_sys_conn.c
index 63e9fc6..b495085 100644
--- a/bta/sys/bta_sys_conn.c
+++ b/bta/sys/bta_sys_conn.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_sys_conn.c
-**
-** Description: Routes connection status callbacks from various sub systems
-** to DM
-**
-** Copyright (c) 2003-2011, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * Routes connection status callbacks from various sub systems to DM
+ *
+ ******************************************************************************/
#include "bta_api.h"
#include "bta_sys.h"
@@ -21,7 +33,7 @@
** Function bta_sys_rm_register
**
** Description Called by BTA DM to register role management callbacks
-**
+**
**
** Returns void
**
@@ -37,7 +49,7 @@ void bta_sys_rm_register(tBTA_SYS_CONN_CBACK * p_cback)
** Function bta_sys_policy_register
**
** Description Called by BTA DM to register link policy change callbacks
-**
+**
**
** Returns void
**
@@ -52,7 +64,7 @@ void bta_sys_policy_register(tBTA_SYS_CONN_CBACK * p_cback)
** Function bta_sys_role_chg_register
**
** Description Called by BTA AV to register role change callbacks
-**
+**
**
** Returns void
**
@@ -66,7 +78,7 @@ void bta_sys_role_chg_register(tBTA_SYS_CONN_CBACK * p_cback)
** Function bta_sys_ssr_cfg_register
**
** Description Called by BTA DM to register SSR configuration callback
-**
+**
**
** Returns void
**
@@ -82,7 +94,7 @@ void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK * p_cback)
** Function bta_sys_role_chg_register
**
** Description Called by BTA AV to register role change callbacks
-**
+**
**
** Returns void
**
@@ -100,7 +112,7 @@ void bta_sys_notify_role_chg(BD_ADDR_PTR p_bda, UINT8 new_role, UINT8 hci_status
** Function bta_sys_collision_register
**
** Description Called by any BTA module to register for collision event.
-**
+**
**
** Returns void
**
@@ -126,7 +138,7 @@ void bta_sys_collision_register(UINT8 bta_id, tBTA_SYS_CONN_CBACK *p_cback)
** Function bta_sys_notify_collision
**
** Description Called by BTA DM to notify collision event.
-**
+**
**
** Returns void
**
@@ -150,7 +162,7 @@ void bta_sys_notify_collision (BD_ADDR_PTR p_bda)
** Function bta_sys_sco_register
**
** Description Called by BTA AV to register sco connection change callbacks
-**
+**
**
** Returns void
**
@@ -165,7 +177,7 @@ void bta_sys_sco_register(tBTA_SYS_CONN_CBACK * p_cback)
** Function bta_sys_pm_register
**
** Description Called by BTA DM to register power management callbacks
-**
+**
**
** Returns void
**
@@ -179,9 +191,9 @@ void bta_sys_pm_register(tBTA_SYS_CONN_CBACK * p_cback)
**
** Function bta_sys_conn_open
**
-** Description Called by BTA subsystems when a connection is made to
+** Description Called by BTA subsystems when a connection is made to
** the service
-**
+**
**
** Returns void
**
@@ -211,7 +223,7 @@ void bta_sys_conn_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
**
** Description Called by BTA subsystems when a connection to the service
** is closed
-**
+**
**
** Returns void
**
@@ -240,7 +252,7 @@ void bta_sys_conn_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
**
** Description Called by BTA subsystems when application initiates connection
** to a peer device
-**
+**
**
** Returns void
**
@@ -260,7 +272,7 @@ void bta_sys_app_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
** Function bta_sys_app_close
**
** Description Called by BTA subsystems when application initiates close
-** of connection to peer device
+** of connection to peer device
**
** Returns void
**
@@ -279,7 +291,7 @@ void bta_sys_app_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
** Function bta_sys_sco_open
**
** Description Called by BTA subsystems when sco connection for that service
-** is open
+** is open
**
** Returns void
**
@@ -292,7 +304,7 @@ void bta_sys_sco_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
/* without querying BTM_GetNumScoLinks() */
bta_sys_cb.p_sco_cb(BTA_SYS_SCO_OPEN, 1, app_id, peer_addr);
}
-
+
if(bta_sys_cb.ppm_cb)
{
bta_sys_cb.ppm_cb(BTA_SYS_SCO_OPEN, id, app_id, peer_addr);
@@ -304,7 +316,7 @@ void bta_sys_sco_open(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
** Function bta_sys_sco_close
**
** Description Called by BTA subsystems when sco connection for that service
-** is closed
+** is closed
**
** Returns void
**
@@ -330,7 +342,7 @@ void bta_sys_sco_close(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
** Function bta_sys_sco_use
**
** Description Called by BTA subsystems when that service needs to use sco.
-**
+**
**
** Returns void
**
@@ -358,7 +370,7 @@ void bta_sys_sco_use(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
void bta_sys_sco_unuse(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
{
UINT8 num_sco_links;
-
+
if((bta_sys_cb.p_sco_cb))
{
num_sco_links = BTM_GetNumScoLinks();
@@ -460,7 +472,7 @@ void bta_sys_clear_default_policy (UINT8 id, UINT8 policy)
**
** Function bta_sys_idle
**
-** Description Called by BTA subsystems to indicate that the connection to
+** Description Called by BTA subsystems to indicate that the connection to
** peer device is idle
**
** Returns void
@@ -487,7 +499,7 @@ void bta_sys_idle(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
**
** Function bta_sys_busy
**
-** Description Called by BTA subsystems to indicate that the connection to
+** Description Called by BTA subsystems to indicate that the connection to
** peer device is busy
**
** Returns void
@@ -515,7 +527,7 @@ void bta_sys_busy(UINT8 id, UINT8 app_id, BD_ADDR peer_addr)
**
** Function bta_sys_eir_register
**
-** Description Called by BTA DM to register EIR utility function that can be
+** Description Called by BTA DM to register EIR utility function that can be
** used by the other BTA modules to add/remove UUID.
**
** Returns void
@@ -530,8 +542,8 @@ void bta_sys_eir_register(tBTA_SYS_EIR_CBACK * p_cback)
**
** Function bta_sys_add_uuid
**
-** Description Called by BTA subsystems to indicate to DM that new service
-** class UUID is added.
+** Description Called by BTA subsystems to indicate to DM that new service
+** class UUID is added.
**
** Returns void
**
@@ -548,8 +560,8 @@ void bta_sys_add_uuid(UINT16 uuid16)
**
** Function bta_sys_remove_uuid
**
-** Description Called by BTA subsystems to indicate to DM that the service
-** class UUID is removed.
+** Description Called by BTA subsystems to indicate to DM that the service
+** class UUID is removed.
**
** Returns void
**
diff --git a/bta/sys/bta_sys_int.h b/bta/sys/bta_sys_int.h
index ac54453..d187b29 100644
--- a/bta/sys/bta_sys_int.h
+++ b/bta/sys/bta_sys_int.h
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_sys_int.h
-**
-** Description: This is the private interface file for the BTA system
-** manager.
-**
-** Copyright (c) 2003-2010, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This is the private interface file for the BTA system manager.
+ *
+ ******************************************************************************/
#ifndef BTA_SYS_INT_H
#define BTA_SYS_INT_H
diff --git a/bta/sys/bta_sys_main.c b/bta/sys/bta_sys_main.c
index 2b54289..f3d8cb6 100644
--- a/bta/sys/bta_sys_main.c
+++ b/bta/sys/bta_sys_main.c
@@ -1,14 +1,26 @@
-/*****************************************************************************
-**
-** Name: bta_sys_main.c
-**
-** Description: This is the main implementation file for the BTA
-** system manager.
-**
-** Copyright (c) 2003-2010, Broadcom Corp., All Rights Reserved.
-** Broadcom Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This is the main implementation file for the BTA system manager.
+ *
+ ******************************************************************************/
#include "btm_api.h"
#include "bta_api.h"
@@ -63,8 +75,8 @@ const tBTA_SYS_ACTION bta_sys_action[] =
{
/* device manager local device API events - cf bta_sys.h for events */
bta_sys_hw_api_enable, /* 0 BTA_SYS_HW_API_ENABLE_EVT */
- bta_sys_hw_evt_enabled, /* 1 BTA_SYS_HW_EVT_ENABLED_EVT */
- bta_sys_hw_evt_stack_enabled, /* 2 BTA_SYS_HW_EVT_STACK_ENABLED_EVT */
+ bta_sys_hw_evt_enabled, /* 1 BTA_SYS_HW_EVT_ENABLED_EVT */
+ bta_sys_hw_evt_stack_enabled, /* 2 BTA_SYS_HW_EVT_STACK_ENABLED_EVT */
bta_sys_hw_api_disable, /* 3 BTA_SYS_HW_API_DISABLE_EVT */
bta_sys_hw_evt_disabled, /* 4 BTA_SYS_HW_EVT_DISABLED_EVT */
bta_sys_hw_error /* 5 BTA_SYS_HW_ERROR_EVT */
@@ -74,9 +86,9 @@ const tBTA_SYS_ACTION bta_sys_action[] =
enum
{
/* device manager local device API events */
- BTA_SYS_HW_API_ENABLE,
+ BTA_SYS_HW_API_ENABLE,
BTA_SYS_HW_EVT_ENABLED,
- BTA_SYS_HW_EVT_STACK_ENABLED,
+ BTA_SYS_HW_EVT_STACK_ENABLED,
BTA_SYS_HW_API_DISABLE,
BTA_SYS_HW_EVT_DISABLED,
BTA_SYS_HW_ERROR
@@ -121,7 +133,7 @@ const UINT8 bta_sys_hw_on[][BTA_SYS_NUM_COLS] =
/* EVT_ENABLED */ {BTA_SYS_IGNORE, BTA_SYS_IGNORE, BTA_SYS_HW_ON},
/* STACK_ENABLED */ {BTA_SYS_IGNORE, BTA_SYS_IGNORE, BTA_SYS_HW_ON},
/* API_DISABLE */ {BTA_SYS_HW_API_DISABLE, BTA_SYS_IGNORE, BTA_SYS_HW_ON}, /* don't change the state here, as some other modules might be active */
-/* EVT_DISABLED */ {BTA_SYS_HW_ERROR, BTA_SYS_IGNORE, BTA_SYS_HW_ON},
+/* EVT_DISABLED */ {BTA_SYS_HW_ERROR, BTA_SYS_IGNORE, BTA_SYS_HW_ON},
/* EVT_ERROR */ {BTA_SYS_HW_ERROR, BTA_SYS_IGNORE, BTA_SYS_HW_ON}
};
@@ -151,7 +163,7 @@ const tBTA_SYS_ST_TBL bta_sys_st_tbl[] = {
** Function bta_sys_init
**
** Description BTA initialization; called from task initialization.
-**
+**
**
** Returns void
**
@@ -180,7 +192,7 @@ BTA_API void bta_sys_init(void)
** Function bta_dm_sm_execute
**
** Description State machine event handling function for DM
-**
+**
**
** Returns void
**
@@ -191,9 +203,9 @@ BOOLEAN bta_sys_sm_execute(BT_HDR *p_msg)
tBTA_SYS_ST_TBL state_table;
UINT8 action;
int i;
-
+
APPL_TRACE_EVENT2("bta_sys_sm_execute state:%d, event:0x%x", bta_sys_cb.state, p_msg->event);
-
+
/* look up the state table for the current state */
state_table = bta_sys_st_tbl[bta_sys_cb.state];
/* update state */
@@ -232,16 +244,16 @@ void bta_sys_hw_unregister( tBTA_SYS_HW_MODULE module )
** Function bta_sys_hw_btm_cback
**
** Description This function is registered by BTA SYS to BTM in order to get status notifications
-**
**
-** Returns
+**
+** Returns
**
*******************************************************************************/
void bta_sys_hw_btm_cback( tBTM_DEV_STATUS status )
{
tBTA_SYS_HW_MSG *sys_event;
-
+
APPL_TRACE_DEBUG1(" bta_sys_hw_btm_cback was called with parameter: %i" , status );
/* send a message to BTA SYS */
@@ -275,8 +287,8 @@ void bta_sys_hw_btm_cback( tBTM_DEV_STATUS status )
**
** Function bta_sys_hw_error
**
-** Description In case the HW device stops answering... Try to turn it off, then re-enable all
-** previously active SW modules.
+** Description In case the HW device stops answering... Try to turn it off, then re-enable all
+** previously active SW modules.
**
** Returns success or failure
**
@@ -297,7 +309,7 @@ void bta_sys_hw_error(tBTA_SYS_HW_MSG *p_sys_hw_msg)
break;
default:
/* not yet supported */
- break;
+ break;
}
}
@@ -314,12 +326,12 @@ void bta_sys_hw_error(tBTA_SYS_HW_MSG *p_sys_hw_msg)
break;
default:
/* not yet supported */
- break;
+ break;
}
}
-
-
+
+
}
@@ -331,7 +343,7 @@ void bta_sys_hw_error(tBTA_SYS_HW_MSG *p_sys_hw_msg)
** Function bta_sys_hw_enable
**
** Description this function is called after API enable and HW has been turned on
-**
+**
**
** Returns success or failure
**
@@ -343,7 +355,7 @@ void bta_sys_hw_api_enable( tBTA_SYS_HW_MSG *p_sys_hw_msg )
{
/* register which HW module was turned on */
bta_sys_cb.sys_hw_module_active |= ((UINT32)1 << p_sys_hw_msg->hw_module );
-
+
/* use call-out to power-up HW */
bta_sys_hw_co_enable(p_sys_hw_msg->hw_module);
}
@@ -351,13 +363,13 @@ void bta_sys_hw_api_enable( tBTA_SYS_HW_MSG *p_sys_hw_msg )
{
/* register which HW module was turned on */
bta_sys_cb.sys_hw_module_active |= ((UINT32)1 << p_sys_hw_msg->hw_module );
-
+
/* HW already in use, so directly notify the caller */
if (bta_sys_cb.sys_hw_cback[p_sys_hw_msg->hw_module ]!= NULL )
- bta_sys_cb.sys_hw_cback[p_sys_hw_msg->hw_module ]( BTA_SYS_HW_ON_EVT );
+ bta_sys_cb.sys_hw_cback[p_sys_hw_msg->hw_module ]( BTA_SYS_HW_ON_EVT );
}
-
- APPL_TRACE_EVENT2 ("bta_sys_hw_api_enable for %d, active modules 0x%04X",
+
+ APPL_TRACE_EVENT2 ("bta_sys_hw_api_enable for %d, active modules 0x%04X",
p_sys_hw_msg->hw_module, bta_sys_cb.sys_hw_module_active);
}
@@ -367,28 +379,28 @@ void bta_sys_hw_api_enable( tBTA_SYS_HW_MSG *p_sys_hw_msg )
** Function bta_sys_hw_disable
**
** Description if no other module is using the HW, this function will call ( if defined ) a user-macro to turn off the HW
-**
+**
**
** Returns success or failure
**
*******************************************************************************/
void bta_sys_hw_api_disable(tBTA_SYS_HW_MSG *p_sys_hw_msg)
{
- APPL_TRACE_DEBUG2("bta_sys_hw_api_disable for %d, active modules: 0x%04X",
+ APPL_TRACE_DEBUG2("bta_sys_hw_api_disable for %d, active modules: 0x%04X",
p_sys_hw_msg->hw_module, bta_sys_cb.sys_hw_module_active );
/* make sure the related SW blocks were stopped */
- bta_sys_disable( p_sys_hw_msg->hw_module );
+ bta_sys_disable( p_sys_hw_msg->hw_module );
/* register which module we turn off */
bta_sys_cb.sys_hw_module_active &= ~((UINT32)1 << p_sys_hw_msg->hw_module );
-
+
/* if there are still some SW modules using the HW, just provide an answer to the calling */
if( bta_sys_cb.sys_hw_module_active != 0 )
- {
- /* if there are still some SW modules using the HW, directly notify the caller */
+ {
+ /* if there are still some SW modules using the HW, directly notify the caller */
if( bta_sys_cb.sys_hw_cback[p_sys_hw_msg->hw_module ]!= NULL )
bta_sys_cb.sys_hw_cback[p_sys_hw_msg->hw_module ]( BTA_SYS_HW_OFF_EVT );
}
@@ -397,7 +409,7 @@ void bta_sys_hw_api_disable(tBTA_SYS_HW_MSG *p_sys_hw_msg)
/* manually update the state of our system */
bta_sys_cb.state = BTA_SYS_HW_STOPPING;
/* and use the call-out to disable HW */
- bta_sys_hw_co_disable(p_sys_hw_msg->hw_module);
+ bta_sys_hw_co_disable(p_sys_hw_msg->hw_module);
}
}
@@ -407,8 +419,8 @@ void bta_sys_hw_api_disable(tBTA_SYS_HW_MSG *p_sys_hw_msg)
**
** Function bta_sys_hw_event_enabled
**
-** Description
-**
+** Description
+**
**
** Returns success or failure
**
@@ -416,7 +428,7 @@ void bta_sys_hw_api_disable(tBTA_SYS_HW_MSG *p_sys_hw_msg)
void bta_sys_hw_evt_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
{
APPL_TRACE_EVENT1("bta_sys_hw_evt_enabled for %i", p_sys_hw_msg->hw_module);
-
+
#if ( defined BTM_AUTOMATIC_HCI_RESET && BTM_AUTOMATIC_HCI_RESET == TRUE )
/* If device is already up, send a fake "BTM DEVICE UP" using BTA SYS state machine */
/* If we are in the middle device initialization, BTM_DEVICE_UP will be issued */
@@ -426,9 +438,9 @@ void bta_sys_hw_evt_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
bta_sys_hw_btm_cback (BTM_DEV_STATUS_UP);
}
#else
-
+
/* if HCI reset was not sent during stack start-up */
- BTM_DeviceReset( NULL );
+ BTM_DeviceReset( NULL );
#endif
}
@@ -438,8 +450,8 @@ void bta_sys_hw_evt_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
**
** Function bta_sys_hw_event_disabled
**
-** Description
-**
+** Description
+**
**
** Returns success or failure
**
@@ -449,7 +461,7 @@ void bta_sys_hw_evt_disabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
UINT8 hw_module_index;
APPL_TRACE_DEBUG1("bta_sys_hw_evt_disabled - module 0x%X", p_sys_hw_msg->hw_module);
-
+
for (hw_module_index = 0; hw_module_index < BTA_SYS_MAX_HW_MODULES; hw_module_index++)
{
if (bta_sys_cb.sys_hw_cback[hw_module_index] != NULL)
@@ -470,7 +482,7 @@ void bta_sys_hw_evt_disabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
void bta_sys_hw_evt_stack_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
{
UINT8 hw_module_index;
-
+
APPL_TRACE_DEBUG0(" bta_sys_hw_evt_stack_enabled!notify the callers");
for (hw_module_index = 0; hw_module_index < BTA_SYS_MAX_HW_MODULES; hw_module_index++ )
@@ -488,7 +500,7 @@ void bta_sys_hw_evt_stack_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg)
** Function bta_sys_event
**
** Description BTA event handler; called from task event handler.
-**
+**
**
** Returns void
**
@@ -543,7 +555,7 @@ BTA_API void bta_sys_timer_update(void)
**
** Description Called by other BTA subsystems to register their event
** handler.
-**
+**
**
** Returns void
**
@@ -560,7 +572,7 @@ void bta_sys_register(UINT8 id, const tBTA_SYS_REG *p_reg)
**
** Description Called by other BTA subsystems to de-register
** handler.
-**
+**
**
** Returns void
**
@@ -576,7 +588,7 @@ void bta_sys_deregister(UINT8 id)
**
** Description Called by other BTA subsystems to get registeration
** status.
-**
+**
**
** Returns void
**
@@ -593,7 +605,7 @@ BOOLEAN bta_sys_is_register(UINT8 id)
** Description Send a GKI message to BTA. This function is designed to
** optimize sending of messages to BTA. It is called by BTA
** API functions and call-in functions.
-**
+**
**
** Returns void
**
@@ -645,7 +657,7 @@ void bta_sys_disable(tBTA_SYS_HW_MODULE module)
{
int bta_id = 0;
int bta_id_max = 0;
-
+
APPL_TRACE_DEBUG1("bta_sys_disable: module %i", module);
switch( module )
@@ -664,9 +676,9 @@ void bta_sys_disable(tBTA_SYS_HW_MODULE module)
break;
case BTA_SYS_HW_GPS:
bta_id = BTA_ID_GPS;
- bta_id_max = BTA_ID_GPS;
+ bta_id_max = BTA_ID_GPS;
break;
- default:
+ default:
APPL_TRACE_WARNING0("bta_sys_disable: unkown module");
return;
}
@@ -677,7 +689,7 @@ void bta_sys_disable(tBTA_SYS_HW_MODULE module)
{
if (bta_sys_cb.is_reg[bta_id] == TRUE && bta_sys_cb.reg[bta_id]->disable != NULL)
{
- (*bta_sys_cb.reg[bta_id]->disable)();
+ (*bta_sys_cb.reg[bta_id]->disable)();
}
}
}
diff --git a/bta/sys/ptim.c b/bta/sys/ptim.c
index 24ed246..9dffc66 100644
--- a/bta/sys/ptim.c
+++ b/bta/sys/ptim.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: ptim.c
-**
-** Description: Protocol timer services.
-**
-** Copyright (c) 2003-2006, Broadcom Corp., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * Protocol timer services.
+ *
+ ******************************************************************************/
#include "bt_target.h"
#include "gki.h"
@@ -50,7 +63,7 @@ void ptim_timer_update(tPTIM_CB *p_cb)
UINT32 new_ticks_count;
INT32 period_in_ticks;
- /* To handle the case when the function is called less frequently than the period
+ /* To handle the case when the function is called less frequently than the period
we must convert determine the number of ticks since the last update, then
convert back to milliseconds before updating timer list */
new_ticks_count = GKI_get_tick_count();
diff --git a/bta/sys/utl.c b/bta/sys/utl.c
index 1487f2e..4bb1d95 100644
--- a/bta/sys/utl.c
+++ b/bta/sys/utl.c
@@ -1,13 +1,26 @@
-/*****************************************************************************
-**
-** Name: utl.c
-**
-** Description: This file contains utility functions.
-**
-** Copyright (c) 2003, Widcomm Inc., All Rights Reserved.
-** Widcomm Bluetooth Core. Proprietary and confidential.
-**
-*****************************************************************************/
+/******************************************************************************
+ *
+ * Copyright (C) 2003-2012 Broadcom Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ ******************************************************************************/
+
+/******************************************************************************
+ *
+ * This file contains utility functions.
+ *
+ ******************************************************************************/
#include "utl.h"
#include "gki.h"
#include "btm_api.h"
@@ -20,7 +33,7 @@
** integer. Acceptable values in string are 0-9. If invalid
** string or string value too large, -1 is returned. Leading
** spaces are skipped.
-**
+**
**
** Returns Integer value or -1 on error.
**
@@ -60,7 +73,7 @@ INT16 utl_str2int(const char *p_s)
** String p_s must be uppercase. String p_t is converted to
** uppercase if lowercase. If p_s ends first, the substring
** match is counted as a match.
-**
+**
**
** Returns 0 if strings match, nonzero otherwise.
**
@@ -100,7 +113,7 @@ int utl_strucmp(const char *p_s, const char *p_t)
** Description This utility function converts a UINT16 to a string. The
** string is NULL-terminated. The length of the string is
** returned;
-**
+**
**
** Returns Length of string.
**
@@ -140,7 +153,7 @@ UINT8 utl_itoa(UINT16 i, char *p_s)
** Description This function calls GKI_freebuf to free the buffer passed
** in, if buffer pointer is not NULL, and also initializes
** buffer pointer to NULL.
-**
+**
**
** Returns Nothing.
**
@@ -161,7 +174,7 @@ void utl_freebuf(void **p)
**
** Description This function updates the local Device Class.
**
-** Parameters:
+** Parameters:
** p_cod - Pointer to the device class to set to
**
** cmd - the fields of the device class to update.
@@ -234,9 +247,9 @@ BOOLEAN utl_set_device_class(tBTA_UTL_COD *p_cod, UINT8 cmd)
**
** Function utl_isintstr
**
-** Description This utility function checks if the given string is an
+** Description This utility function checks if the given string is an
** integer string or not
-**
+**
**
** Returns TRUE if successful, Otherwise FALSE
**
@@ -258,9 +271,9 @@ BOOLEAN utl_isintstr(const char *p_s)
**
** Function utl_isdialstr
**
-** Description This utility function checks if the given string contains
+** Description This utility function checks if the given string contains
** only dial digits or not
-**
+**
**
** Returns TRUE if successful, Otherwise FALSE
**
@@ -271,7 +284,7 @@ BOOLEAN utl_isdialstr(const char *p_s)
for(i=0; p_s[i] != 0; i++)
{
- if(!(((p_s[i] >= '0') && (p_s[i] <= '9'))
+ if(!(((p_s[i] >= '0') && (p_s[i] <= '9'))
|| (p_s[i] == '*') || (p_s[i] == '+') || (p_s[i] == '#') || (p_s[i] == ';')
|| ((p_s[i] >= 'A') && (p_s[i] <= 'C'))))
return FALSE;