btm_main.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2002-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. * This file contains the definition of the btm control block when
  21. * BTM_DYNAMIC_MEMORY is used.
  22. *
  23. ******************************************************************************/
  24. #include "bt_types.h"
  25. #include "bt_target.h"
  26. #include <string.h>
  27. #include "btm_int.h"
  28. /* Global BTM control block structure
  29. */
  30. #if BTM_DYNAMIC_MEMORY == FALSE
  31. tBTM_CB btm_cb;
  32. #endif
  33. /*******************************************************************************
  34. **
  35. ** Function btm_init
  36. **
  37. ** Description This function is called at BTM startup to allocate the
  38. ** control block (if using dynamic memory), and initializes the
  39. ** tracing level. It then initializes the various components of
  40. ** btm.
  41. **
  42. ** Returns void
  43. **
  44. *******************************************************************************/
  45. void btm_init (void)
  46. {
  47. /* All fields are cleared; nonzero fields are reinitialized in appropriate function */
  48. memset(&btm_cb, 0, sizeof(tBTM_CB));
  49. #if defined(BTM_INITIAL_TRACE_LEVEL)
  50. btm_cb.trace_level = BTM_INITIAL_TRACE_LEVEL;
  51. #else
  52. btm_cb.trace_level = BT_TRACE_LEVEL_NONE;
  53. #endif
  54. /* Initialize BTM component structures */
  55. btm_inq_db_init(); /* Inquiry Database and Structures */
  56. btm_acl_init(); /* ACL Database and Structures */
  57. btm_sec_init(BTM_SEC_MODE_SP); /* Security Manager Database and Structures */
  58. #if BTM_SCO_INCLUDED == TRUE
  59. btm_sco_init(); /* SCO Database and Structures (If included) */
  60. #endif
  61. btm_dev_init(); /* Device Manager Structures & HCI_Reset */
  62. }