1/******************************************************************************
2 *
3 *  Copyright (C) 2003-2012 Broadcom Corporation
4 *
5 *  Licensed under the Apache License, Version 2.0 (the "License");
6 *  you may not use this file except in compliance with the License.
7 *  You may obtain a copy of the License at:
8 *
9 *  http://www.apache.org/licenses/LICENSE-2.0
10 *
11 *  Unless required by applicable law or agreed to in writing, software
12 *  distributed under the License is distributed on an "AS IS" BASIS,
13 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 *  See the License for the specific language governing permissions and
15 *  limitations under the License.
16 *
17 ******************************************************************************/
18
19/******************************************************************************
20 *
21 *  This is the private interface file for the BTA system manager.
22 *
23 ******************************************************************************/
24#ifndef BTA_SYS_INT_H
25#define BTA_SYS_INT_H
26
27#include "ptim.h"
28
29/*****************************************************************************
30**  Constants and data types
31*****************************************************************************/
32
33/*****************************************************************************
34**  state table
35*****************************************************************************/
36
37/* SYS HW state */
38enum
39{
40    BTA_SYS_HW_OFF,
41    BTA_SYS_HW_STARTING,
42    BTA_SYS_HW_ON,
43    BTA_SYS_HW_STOPPING
44};
45typedef UINT8 tBTA_SYS_HW_STATE;
46
47/* Collision callback */
48#define MAX_COLLISION_REG   5
49
50typedef struct
51{
52    UINT8                   id[MAX_COLLISION_REG];
53    tBTA_SYS_CONN_CBACK     *p_coll_cback[MAX_COLLISION_REG];
54} tBTA_SYS_COLLISION;
55
56/* system manager control block */
57typedef struct
58{
59    tBTA_SYS_REG            *reg[BTA_ID_MAX];       /* registration structures */
60    BOOLEAN                 is_reg[BTA_ID_MAX];     /* registration structures */
61    tPTIM_CB                ptim_cb;                /* protocol timer list */
62    BOOLEAN                 timers_disabled;        /* TRUE if sys timers disabled */
63    UINT8                   task_id;                /* GKI task id */
64    tBTA_SYS_HW_STATE state;
65    tBTA_SYS_HW_CBACK *sys_hw_cback[BTA_SYS_MAX_HW_MODULES];    /* enable callback for each HW modules */
66    UINT32                  sys_hw_module_active;   /* bitmask of all active modules */
67    UINT16                  sys_features;           /* Bitmask of sys features */
68
69    tBTA_SYS_CONN_CBACK     *prm_cb;                 /* role management callback registered by DM */
70    tBTA_SYS_CONN_CBACK     *ppm_cb;                 /* low power management callback registered by DM */
71    tBTA_SYS_CONN_CBACK     *p_policy_cb;            /* link policy change callback registered by DM */
72    tBTA_SYS_CONN_CBACK     *p_sco_cb;               /* SCO connection change callback registered by AV */
73    tBTA_SYS_CONN_CBACK     *p_role_cb;              /* role change callback registered by AV */
74    tBTA_SYS_COLLISION      colli_reg;               /* collision handling module */
75#if ( BTM_EIR_SERVER_INCLUDED == TRUE )&&(BTA_EIR_CANNED_UUID_LIST != TRUE)
76    tBTA_SYS_EIR_CBACK      *eir_cb;                /* add/remove UUID into EIR */
77#endif
78#if (BTM_SSR_INCLUDED == TRUE)
79    tBTA_SYS_SSR_CFG_CBACK      *p_ssr_cb;
80#endif
81    /* VS event handler */
82    tBTA_SYS_VS_EVT_HDLR   *p_vs_evt_hdlr;
83
84} tBTA_SYS_CB;
85
86
87
88
89/*****************************************************************************
90**  Global variables
91*****************************************************************************/
92
93/* system manager control block */
94#if BTA_DYNAMIC_MEMORY == FALSE
95extern tBTA_SYS_CB bta_sys_cb;
96#else
97extern tBTA_SYS_CB *bta_sys_cb_ptr;
98#define bta_sys_cb (*bta_sys_cb_ptr)
99#endif
100
101
102/* system manager configuration structure */
103extern tBTA_SYS_CFG *p_bta_sys_cfg;
104
105
106
107/* functions used for BTA SYS HW state machine */
108void bta_sys_hw_btm_cback( tBTM_DEV_STATUS status );
109void bta_sys_hw_error(tBTA_SYS_HW_MSG *p_sys_hw_msg);
110void bta_sys_hw_api_enable( tBTA_SYS_HW_MSG *p_sys_hw_msg );
111void bta_sys_hw_api_disable(tBTA_SYS_HW_MSG *p_sys_hw_msg);
112void bta_sys_hw_evt_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg);
113void bta_sys_hw_evt_disabled(tBTA_SYS_HW_MSG *p_sys_hw_msg);
114void bta_sys_hw_evt_stack_enabled(tBTA_SYS_HW_MSG *p_sys_hw_msg);
115
116BOOLEAN bta_sys_sm_execute(BT_HDR *p_msg);
117
118
119
120
121
122#endif /* BTA_SYS_INT_H */
123