• Home
  • 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.h
22  *
23  *  Description:   Contains definitions used for serial port controls
24  *
25  ******************************************************************************/
26 
27 #ifndef USERIAL_H
28 #define USERIAL_H
29 
30 /******************************************************************************
31 **  Constants & Macros
32 ******************************************************************************/
33 
34 /**** port IDs ****/
35 #define USERIAL_PORT_1          0
36 #define USERIAL_PORT_2          1
37 #define USERIAL_PORT_3          2
38 #define USERIAL_PORT_4          3
39 #define USERIAL_PORT_5          4
40 #define USERIAL_PORT_6          5
41 #define USERIAL_PORT_7          6
42 #define USERIAL_PORT_8          7
43 #define USERIAL_PORT_9          8
44 #define USERIAL_PORT_10         9
45 #define USERIAL_PORT_11         10
46 #define USERIAL_PORT_12         11
47 #define USERIAL_PORT_13         12
48 #define USERIAL_PORT_14         13
49 #define USERIAL_PORT_15         14
50 #define USERIAL_PORT_16         15
51 #define USERIAL_PORT_17         16
52 #define USERIAL_PORT_18         17
53 
54 typedef enum {
55     USERIAL_OP_INIT,
56     USERIAL_OP_RXFLOW_ON,
57     USERIAL_OP_RXFLOW_OFF,
58 } userial_ioctl_op_t;
59 
60 /******************************************************************************
61 **  Type definitions
62 ******************************************************************************/
63 
64 /******************************************************************************
65 **  Extern variables and functions
66 ******************************************************************************/
67 
68 /******************************************************************************
69 **  Functions
70 ******************************************************************************/
71 
72 /*******************************************************************************
73 **
74 ** Function        userial_init
75 **
76 ** Description     Initializes the userial driver
77 **
78 ** Returns         TRUE/FALSE
79 **
80 *******************************************************************************/
81 uint8_t userial_init(void);
82 
83 /*******************************************************************************
84 **
85 ** Function        userial_open
86 **
87 ** Description     Open Bluetooth device with the port ID
88 **
89 ** Returns         TRUE/FALSE
90 **
91 *******************************************************************************/
92 uint8_t userial_open(uint8_t port);
93 
94 /*******************************************************************************
95 **
96 ** Function        userial_read
97 **
98 ** Description     Read data from the userial port
99 **
100 ** Returns         Number of bytes actually read from the userial port and
101 **                 copied into p_data.  This may be less than len.
102 **
103 *******************************************************************************/
104 uint16_t  userial_read(uint16_t msg_id, uint8_t *p_buffer, uint16_t len);
105 
106 /*******************************************************************************
107 **
108 ** Function        userial_write
109 **
110 ** Description     Write data to the userial port
111 **
112 ** Returns         Number of bytes actually written to the userial port. This
113 **                 may be less than len.
114 **
115 *******************************************************************************/
116 uint16_t userial_write(uint16_t msg_id, uint8_t *p_data, uint16_t len);
117 
118 /*******************************************************************************
119 **
120 ** Function        userial_close
121 **
122 ** Description     Close the userial port
123 **
124 ** Returns         None
125 **
126 *******************************************************************************/
127 void userial_close(void);
128 
129 /*******************************************************************************
130 **
131 ** Function        userial_ioctl
132 **
133 ** Description     ioctl inteface
134 **
135 ** Returns         None
136 **
137 *******************************************************************************/
138 void userial_ioctl(userial_ioctl_op_t op, void *p_data);
139 
140 #endif /* USERIAL_H */
141 
142