• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-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  *  Filename:      userial_vendor.h
22  *
23  *  Description:   Contains vendor-specific definitions used in serial port
24  *                 controls
25  *
26  ******************************************************************************/
27 
28 #ifndef USERIAL_VENDOR_H
29 #define USERIAL_VENDOR_H
30 
31 #include "bt_vendor_brcm.h"
32 
33 /******************************************************************************
34 **  Constants & Macros
35 ******************************************************************************/
36 
37 /**** baud rates ****/
38 #define USERIAL_BAUD_300        0
39 #define USERIAL_BAUD_600        1
40 #define USERIAL_BAUD_1200       2
41 #define USERIAL_BAUD_2400       3
42 #define USERIAL_BAUD_9600       4
43 #define USERIAL_BAUD_19200      5
44 #define USERIAL_BAUD_57600      6
45 #define USERIAL_BAUD_115200     7
46 #define USERIAL_BAUD_230400     8
47 #define USERIAL_BAUD_460800     9
48 #define USERIAL_BAUD_921600     10
49 #define USERIAL_BAUD_1M         11
50 #define USERIAL_BAUD_1_5M       12
51 #define USERIAL_BAUD_2M         13
52 #define USERIAL_BAUD_3M         14
53 #define USERIAL_BAUD_4M         15
54 #define USERIAL_BAUD_AUTO       16
55 
56 /**** Data Format ****/
57 /* Stop Bits */
58 #define USERIAL_STOPBITS_1      1
59 #define USERIAL_STOPBITS_1_5    (1<<1)
60 #define USERIAL_STOPBITS_2      (1<<2)
61 
62 /* Parity Bits */
63 #define USERIAL_PARITY_NONE     (1<<3)
64 #define USERIAL_PARITY_EVEN     (1<<4)
65 #define USERIAL_PARITY_ODD      (1<<5)
66 
67 /* Data Bits */
68 #define USERIAL_DATABITS_5      (1<<6)
69 #define USERIAL_DATABITS_6      (1<<7)
70 #define USERIAL_DATABITS_7      (1<<8)
71 #define USERIAL_DATABITS_8      (1<<9)
72 
73 
74 #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
75 /* These are the ioctl values used for bt_wake ioctl via UART driver. you may
76  * need to redefine them on you platform!
77  * Logically they need to be unique and not colide with existing uart ioctl's.
78  */
79 #ifndef USERIAL_IOCTL_BT_WAKE_ASSERT
80 #define USERIAL_IOCTL_BT_WAKE_ASSERT   0x8003
81 #endif
82 #ifndef USERIAL_IOCTL_BT_WAKE_DEASSERT
83 #define USERIAL_IOCTL_BT_WAKE_DEASSERT 0x8004
84 #endif
85 #ifndef USERIAL_IOCTL_BT_WAKE_GET_ST
86 #define USERIAL_IOCTL_BT_WAKE_GET_ST   0x8005
87 #endif
88 #endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
89 
90 /******************************************************************************
91 **  Type definitions
92 ******************************************************************************/
93 
94 /* Structure used to configure serial port during open */
95 typedef struct
96 {
97     uint16_t fmt;       /* Data format */
98     uint8_t  baud;      /* Baud rate */
99 } tUSERIAL_CFG;
100 
101 typedef enum {
102 #if (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
103     USERIAL_OP_ASSERT_BT_WAKE,
104     USERIAL_OP_DEASSERT_BT_WAKE,
105     USERIAL_OP_GET_BT_WAKE_STATE,
106 #endif
107     USERIAL_OP_NOP,
108 } userial_vendor_ioctl_op_t;
109 
110 /******************************************************************************
111 **  Extern variables and functions
112 ******************************************************************************/
113 
114 /******************************************************************************
115 **  Functions
116 ******************************************************************************/
117 
118 /*******************************************************************************
119 **
120 ** Function        userial_vendor_init
121 **
122 ** Description     Initialize userial vendor-specific control block
123 **
124 ** Returns         None
125 **
126 *******************************************************************************/
127 void userial_vendor_init(void);
128 
129 /*******************************************************************************
130 **
131 ** Function        userial_vendor_open
132 **
133 ** Description     Open the serial port with the given configuration
134 **
135 ** Returns         device fd
136 **
137 *******************************************************************************/
138 int userial_vendor_open(tUSERIAL_CFG *p_cfg);
139 
140 /*******************************************************************************
141 **
142 ** Function        userial_vendor_close
143 **
144 ** Description     Conduct vendor-specific close work
145 **
146 ** Returns         None
147 **
148 *******************************************************************************/
149 void userial_vendor_close(void);
150 
151 /*******************************************************************************
152 **
153 ** Function        userial_vendor_set_baud
154 **
155 ** Description     Set new baud rate
156 **
157 ** Returns         None
158 **
159 *******************************************************************************/
160 void userial_vendor_set_baud(uint8_t userial_baud);
161 
162 /*******************************************************************************
163 **
164 ** Function        userial_vendor_ioctl
165 **
166 ** Description     ioctl inteface
167 **
168 ** Returns         None
169 **
170 *******************************************************************************/
171 void userial_vendor_ioctl(userial_vendor_ioctl_op_t op, void *p_data);
172 
173 #endif /* USERIAL_VENDOR_H */
174 
175