bte.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2001-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 constants and definitions for the bte project
  21. *
  22. ******************************************************************************/
  23. #ifndef BTE_H
  24. #define BTE_H
  25. //#include <semaphore.h>
  26. //#include <signal.h>
  27. //#include <pthread.h>
  28. #include "bt_target.h"
  29. /* by default on shutdown, baudrate is reset 115kbits. this should NOT be need for platforms
  30. * that kill BTE driver and remove/reset BT chip
  31. */
  32. #ifndef BTE_RESET_BAUD_ON_BT_DISABLE
  33. #define BTE_RESET_BAUD_ON_BT_DISABLE TRUE
  34. #endif
  35. /* Target Modes (based on jumper settings on hardware [see user manual]) */
  36. enum {
  37. /* BTE BBY */
  38. /* J3 J4 SW3-3 SW3-2 SW3-1 */
  39. /* -------------------------------------------- */
  40. BTE_MODE_SERIAL_APP, /* OUT OUT OFF OFF OFF Sample serial port application */
  41. BTE_MODE_APPL, /* IN OUT OFF OFF ON Target used with Tester through RPC */
  42. BTE_MODE_RESERVED, /* OUT IN OFF ON OFF Reserved */
  43. BTE_MODE_SAMPLE_APPS, /* IN IN OFF ON ON Sample applications (ICP/HSP) */
  44. BTE_MODE_DONGLE, /* not yet supported ON OFF OFF Dongle mode */
  45. BTE_MODE_APPL_PROTOCOL_TRACE, /* this is a fake mode do allow protocol tracing in application without rpc */
  46. BTE_MODE_INVALID
  47. };
  48. extern volatile UINT8 bte_target_mode; /* indicates the mode that the board is running in */
  49. /* Startup options */
  50. extern UINT32 bte_startup_options; /* Switch and jumper settings at startup */
  51. void bte_get_startup_options(UINT32 *p_options); /* Platform specific function for getting startup options */
  52. #define BTE_OPTIONS_TARGET_MODE_MASK 0x00000007 /* bits 2-0 indicate target mode (QuickConnect: jp3 & jp4, BBY: SW3-1 & SW3-2)*/
  53. /****************************************************************************
  54. * Definitions to define which type of application gets built
  55. ****************************************************************************/
  56. #define BUILD_HCITOOL FALSE
  57. #define BUILD_L2PING FALSE
  58. #define LINUX_FM_DRIVER_INCLUDED FALSE
  59. /* hcisu userial operations. should probably go into bt_types to avoid collisions! */
  60. #define BT_EVT_TO_HCISU_USERIAL_OP (0x0080 | BT_EVT_HCISU)
  61. /* operation for above hcisu event */
  62. #define BT_HCISU_USERIAL_OPEN (0) /* open serial port calling USERIAL_Open() */
  63. #define BT_HCISU_USERIAL_CLOSE (1) /* close userial port */
  64. /* options associated with close op */
  65. #define BT_HCISU_USERIAL_CL_NO_DIS_BT 0 /* do not touch bt_wake and power gpio */
  66. #define BT_HCISU_USERIAL_CL_DIS_BT 1 /* put power and bt_wake into defined off state to preserve
  67. power */
  68. /* status codes for callback */
  69. /*
  70. #define BTE_HCISU_USERIAL_FAIL 0
  71. #define BTE_HCISU_USERIAL_OK 1
  72. typedef void (tUSERIAL_MSG_CBACK) (int status);
  73. typedef struct tHCISU_USERIAL_MSG_tag {
  74. BT_HDR hdr;
  75. tUSERIAL_MSG_CBACK *p_cback;
  76. UINT8 port; // port number
  77. UINT8 op;
  78. UINT8 option; // option for operation. depends on operation
  79. } tHCISU_USERIAL_MSG;
  80. extern void bte_hcisu_userial_oper( tUSERIAL_MSG_CBACK *p_cback, UINT8 port, UINT8 op, UINT8 option );
  81. */
  82. /* Pointer to function for sending HCI commands and data to the HCI tranport */
  83. extern int (*p_bte_hci_send)(UINT16 port, BT_HDR *p_msg);
  84. /* Protocol trace mask */
  85. extern UINT32 bte_proto_trace_mask;
  86. typedef struct tBAUD_REG_tag {
  87. UINT8 DHBR;
  88. UINT8 DLBR;
  89. UINT8 ExplicitBaudRate0;
  90. UINT8 ExplicitBaudRate1;
  91. UINT8 ExplicitBaudRate2;
  92. UINT8 ExplicitBaudRate3;
  93. } tBAUD_REG;
  94. #include "gki.h"
  95. extern const tBAUD_REG baud_rate_regs[];
  96. #endif /* BTE_H */