CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
orangepi-xunlong

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: orangepi-xunlong/orangepi-build
Path: blob/next/external/cache/sources/hcitools/hciattach.h
Views: 3959
1
/*
2
*
3
* BlueZ - Bluetooth protocol stack for Linux
4
*
5
* Copyright (C) 2003-2010 Marcel Holtmann <[email protected]>
6
*
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
*
22
*/
23
24
#include <termios.h>
25
26
#include <bluetooth.h>
27
28
#ifndef N_HCI
29
#define N_HCI 15
30
#endif
31
32
#define HCIUARTSETPROTO _IOW('U', 200, int)
33
#define HCIUARTGETPROTO _IOR('U', 201, int)
34
#define HCIUARTGETDEVICE _IOR('U', 202, int)
35
#define HCIUARTSETFLAGS _IOW('U', 203, int)
36
#define HCIUARTGETFLAGS _IOR('U', 204, int)
37
38
#define HCI_UART_H4 0
39
#define HCI_UART_BCSP 1
40
#define HCI_UART_3WIRE 2
41
#define HCI_UART_H4DS 3
42
#define HCI_UART_LL 4
43
#define HCI_UART_ATH3K 5
44
45
#define HCI_UART_RAW_DEVICE 0
46
#define HCI_UART_RESET_ON_INIT 1
47
#define HCI_UART_CREATE_AMP 2
48
49
struct uart_t {
50
char *type;
51
int m_id;
52
int p_id;
53
int proto;
54
int init_speed;
55
int speed;
56
int flags;
57
int pm;
58
char *bdaddr;
59
int (*init) (int fd, struct uart_t *u, struct termios *ti);
60
int (*post) (int fd, struct uart_t *u, struct termios *ti);
61
};
62
63
#define FLOW_CTL 0x0001
64
#define AMP_DEV 0x0002
65
#define ENABLE_PM 1
66
#define DISABLE_PM 0
67
68
int read_hci_event(int fd, unsigned char *buf, int size);
69
int set_speed(int fd, struct termios *ti, int speed);
70
int uart_speed(int speed);
71
72
int texas_init(int fd, int *speed, struct termios *ti);
73
int texas_post(int fd, struct termios *ti);
74
int texasalt_init(int fd, int speed, struct termios *ti);
75
int stlc2500_init(int fd, bdaddr_t *bdaddr);
76
int bgb2xx_init(int dd, bdaddr_t *bdaddr);
77
int ath3k_init(int fd, int speed, int init_speed, char *bdaddr,
78
struct termios *ti);
79
int ath3k_post(int fd, int pm);
80
int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr);
81
int intel_init(int fd, int init_speed, int *speed, struct termios *ti);
82
int bcm43xx_init(int fd, int speed, struct termios *ti, const char *bdaddr);
83
84
//Realtek_add_start
85
//add realtek init and post process for realtek Bluetooth chip
86
int rtk_init(int fd, int proto, int speed, struct termios *ti);
87
int rtk_post(int fd, int proto, struct termios *ti);
88
//Realtek_add_end
89
90
// add xradio init and post process for xradio Bluetooth chip (xr829)
91
int xr_init(int fd, struct uart_t *u, struct termios *ti);
92
int xr_post(int fd, struct uart_t *u, struct termios *ti);
93
94
// add sprd init and post process for sprd Bluetooth chip (UWE5622)
95
int sprd_config_init(int fd, struct uart_t *u, struct termios *ti);
96
int sprd_config_post(int fd, struct uart_t *u, struct termios *ti);
97
98