NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
bte.h
1/******************************************************************************
2 *
3 * NOTICE OF CHANGES
4 * 2024/03/25:
5 * - Remove Linux #includes for RVL target
6 *
7 * Compile with REVOLUTION defined to include these changes.
8 *
9 ******************************************************************************/
10
11
12
13/******************************************************************************
14 *
15 * Copyright (C) 2001-2012 Broadcom Corporation
16 *
17 * Licensed under the Apache License, Version 2.0 (the "License");
18 * you may not use this file except in compliance with the License.
19 * You may obtain a copy of the License at:
20 *
21 * http://www.apache.org/licenses/LICENSE-2.0
22 *
23 * Unless required by applicable law or agreed to in writing, software
24 * distributed under the License is distributed on an "AS IS" BASIS,
25 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 * See the License for the specific language governing permissions and
27 * limitations under the License.
28 *
29 ******************************************************************************/
30
31/******************************************************************************
32 *
33 * this file contains constants and definitions for the bte project
34 *
35 ******************************************************************************/
36#ifndef BTE_H
37#define BTE_H
38
39#ifndef REVOLUTION
40#include <semaphore.h>
41#include <signal.h>
42#include <pthread.h>
43#endif
44#include "bt_target.h"
45
46/* by default on shutdown, baudrate is reset 115kbits. this should NOT be need for platforms
47 * that kill BTE driver and remove/reset BT chip
48 */
49#ifndef BTE_RESET_BAUD_ON_BT_DISABLE
50#define BTE_RESET_BAUD_ON_BT_DISABLE TRUE
51#endif
52
53/* Target Modes (based on jumper settings on hardware [see user manual]) */
54enum
55{
56 /* BTE BBY */
57 /* J3 J4 SW3-3 SW3-2 SW3-1 */
58 /* -------------------------------------------- */
59 BTE_MODE_SERIAL_APP, /* OUT OUT OFF OFF OFF Sample serial port application */
60 BTE_MODE_APPL, /* IN OUT OFF OFF ON Target used with Tester through RPC */
61 BTE_MODE_RESERVED, /* OUT IN OFF ON OFF Reserved */
62 BTE_MODE_SAMPLE_APPS, /* IN IN OFF ON ON Sample applications (ICP/HSP) */
63 BTE_MODE_DONGLE, /* not yet supported ON OFF OFF Dongle mode */
64 BTE_MODE_APPL_PROTOCOL_TRACE, /* this is a fake mode do allow protocol tracing in application without rpc */
65 BTE_MODE_INVALID
66};
67
68extern volatile UINT8 bte_target_mode; /* indicates the mode that the board is running in */
69
70/* Startup options */
71extern UINT32 bte_startup_options; /* Switch and jumper settings at startup */
72void bte_get_startup_options(UINT32 *p_options); /* Platform specific function for getting startup options */
73
74#define BTE_OPTIONS_TARGET_MODE_MASK 0x00000007 /* bits 2-0 indicate target mode (QuickConnect: jp3 & jp4, BBY: SW3-1 & SW3-2)*/
75
76
77/****************************************************************************
78 * Definitions to define which type of application gets built
79 ****************************************************************************/
80#define BUILD_HCITOOL FALSE
81#define BUILD_L2PING FALSE
82
83
84#define LINUX_FM_DRIVER_INCLUDED FALSE
85
86
87/* hcisu userial operations. should probably go into bt_types to avoid collisions! */
88#define BT_EVT_TO_HCISU_USERIAL_OP (0x0080 | BT_EVT_HCISU)
89/* operation for above hcisu event */
90#define BT_HCISU_USERIAL_OPEN (0) /* open serial port calling USERIAL_Open() */
91#define BT_HCISU_USERIAL_CLOSE (1) /* close userial port */
92/* options associated with close op */
93#define BT_HCISU_USERIAL_CL_NO_DIS_BT 0 /* do not touch bt_wake and power gpio */
94#define BT_HCISU_USERIAL_CL_DIS_BT 1 /* put power and bt_wake into defined off state to preserve
95 power */
96/* status codes for callback */
97#define BTE_HCISU_USERIAL_FAIL 0
98#define BTE_HCISU_USERIAL_OK 1
99typedef void (tUSERIAL_MSG_CBACK) (int status);
100typedef struct tHCISU_USERIAL_MSG_tag {
101 BT_HDR hdr;
102 tUSERIAL_MSG_CBACK *p_cback;
103 UINT8 port; /* port number */
104 UINT8 op;
105 UINT8 option; /* option for operation. depends on operation */
106} tHCISU_USERIAL_MSG;
107
108extern void bte_hcisu_userial_oper( tUSERIAL_MSG_CBACK *p_cback, UINT8 port, UINT8 op, UINT8 option );
109
110/* Pointer to function for sending HCI commands and data to the HCI tranport */
111extern int (*p_bte_hci_send)(UINT16 port, BT_HDR *p_msg);
112
113
114/* Protocol trace mask */
115extern UINT32 bte_proto_trace_mask;
116
117/* Version string */
118extern const UINT8 bte_version_string[];
120typedef struct tBAUD_REG_tag {
121 UINT8 DHBR;
122 UINT8 DLBR;
123 UINT8 ExplicitBaudRate0;
124 UINT8 ExplicitBaudRate1;
125 UINT8 ExplicitBaudRate2;
126 UINT8 ExplicitBaudRate3;
127} tBAUD_REG;
128
129#include "gki.h"
130
131extern const tBAUD_REG baud_rate_regs[];
132
133#endif /* BTE_H */