source: svn/newcon3bcm2_21bu/nexus/modules/uart/7552/include/nexus_uart.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 9.3 KB
Line 
1/***************************************************************************
2*     (c)2004-2011 Broadcom Corporation
3*
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13*
14*  Except as expressly set forth in the Authorized License,
15*
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28*
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: nexus_uart.h $
39* $brcm_Revision: 5 $
40* $brcm_Date: 2/16/11 1:04p $
41*
42* API Description:
43*   API name: Uart
44*    Specific APIs related to UART Control.
45*
46* Revision History:
47*
48* $brcm_Log: /nexus/modules/uart/7400/include/nexus_uart.h $
49*
50* 5   2/16/11 1:04p erickson
51* SW7420-1491: add nelem required with nelem_out
52*
53* 4   2/15/11 2:12p erickson
54* SW7420-1491: change param attributes
55*
56* 3   3/9/09 9:27a erickson
57* PR52362: rework to improve uart performance
58*
59* 2   2/6/08 4:29p vsilyaev
60* PR 38682: Added attributes for the linux kernel/user proxy mode
61*
62* 1   1/18/08 2:21p jgarrett
63* PR 38808: Merging to main branch
64*
65* Nexus_Devel/2   11/28/07 2:11p erickson
66* PR35457: doc update
67*
68* Nexus_Devel/1   11/20/07 1:28p erickson
69* PR37423: added uart, gpio, spi modules
70*
71* Nexus_Devel/2   9/12/07 5:38p jgarrett
72* PR 34702: Adding UART interface
73*
74* Nexus_Devel/1   9/12/07 10:39a jgarrett
75* PR 34702: Adding initial IO headers
76*
77***************************************************************************/
78#ifndef NEXUS_UART_H__
79#define NEXUS_UART_H__
80
81#ifdef __cplusplus
82extern "C" {
83#endif
84
85/***************************************************************************
86Summary:
87Handle for the Uart Interface.
88
89Description:
90
91See Also:
92NEXUS_Uart_Open
93***************************************************************************/
94typedef struct NEXUS_Uart *NEXUS_UartHandle;
95
96/***************************************************************************
97Summary:
98UART parity
99
100Description:
101
102See Also:
103NEXUS_UartSettings
104***************************************************************************/
105typedef enum NEXUS_UartParity
106{
107    NEXUS_UartParity_eNone,
108    NEXUS_UartParity_eOdd,
109    NEXUS_UartParity_eEven,
110    NEXUS_UartParity_eMax
111} NEXUS_UartParity;
112
113/***************************************************************************
114Summary:
115UART data bits
116
117Description:
118
119See Also:
120NEXUS_UartSettings
121***************************************************************************/
122typedef enum NEXUS_UartDataBits
123{
124    NEXUS_UartDataBits_e7,
125    NEXUS_UartDataBits_e8,
126    NEXUS_UartDataBits_eMax
127} NEXUS_UartDataBits;
128
129/***************************************************************************
130Summary:
131UART data bits
132
133Description:
134
135See Also:
136NEXUS_UartSettings
137***************************************************************************/
138typedef enum NEXUS_UartStopBits
139{
140    NEXUS_UartStopBits_e0,
141    NEXUS_UartStopBits_e1,
142    NEXUS_UartStopBits_e2,
143    NEXUS_UartStopBits_eMax
144} NEXUS_UartStopBits;
145
146/***************************************************************************
147Summary:
148UART Settings
149
150Description:
151
152See Also:
153NEXUS_Uart_Open
154NEXUS_Uart_GetDefaultSettings
155***************************************************************************/
156typedef struct NEXUS_UartSettings
157{
158    unsigned rxBufferSize;
159    unsigned txBufferSize;
160
161    unsigned baudRate;
162    NEXUS_UartParity parity;
163    NEXUS_UartDataBits dataBits;
164    NEXUS_UartStopBits stopBits;
165
166    NEXUS_CallbackDesc rxReady;
167    NEXUS_CallbackDesc txDone;
168    NEXUS_CallbackDesc error;
169} NEXUS_UartSettings;
170
171/***************************************************************************
172Summary:
173Get default settings for the structure.
174
175Description:
176This is required in order to make application code resilient to the addition of new strucutre members in the future.
177
178See Also:
179NEXUS_Uart_Open
180***************************************************************************/
181void NEXUS_Uart_GetDefaultSettings(
182    NEXUS_UartSettings *pSettings /* [out] */
183    );
184
185/***************************************************************************
186Summary:
187Open a serial port handle.
188
189Description:
190
191See Also:
192NEXUS_Uart_Close
193***************************************************************************/
194NEXUS_UartHandle NEXUS_Uart_Open( /* attr{destructor=NEXUS_Uart_Close}  */
195    unsigned index,
196    const NEXUS_UartSettings *pSettings
197    );
198
199/***************************************************************************
200Summary:
201Close a serial port handle.
202
203Description:
204
205See Also:
206NEXUS_Uart_Open
207***************************************************************************/
208void NEXUS_Uart_Close(
209    NEXUS_UartHandle handle
210    );
211
212/***************************************************************************
213Summary:
214Get the settings for a UART
215
216Description:
217
218See Also:
219NEXUS_Uart_SetSettings
220***************************************************************************/
221void NEXUS_Uart_GetSettings(
222    NEXUS_UartHandle handle,
223    NEXUS_UartSettings *pSettings   /* [out] */
224    );
225
226/***************************************************************************
227Summary:
228Set the settings for a UART
229
230Description:
231
232See Also:
233NEXUS_Uart_GetSettings
234***************************************************************************/
235NEXUS_Error NEXUS_Uart_SetSettings(
236    NEXUS_UartHandle handle,
237    const NEXUS_UartSettings *pSettings
238    );
239
240/***************************************************************************
241Summary:
242Read data from a serial port.
243
244Description:
245This function will read data from a serial port, up to the number of bytes
246specified.  The application should continue to call this function until it
247returns 0 bytes read before waiting for another callback.
248
249See Also:
250NEXUS_Uart_Write
251***************************************************************************/
252NEXUS_Error NEXUS_Uart_Read(
253    NEXUS_UartHandle handle,
254    void *pData, /* [out] attr{nelem=numBytes;nelem_out=pBytesRead;reserved=64} */
255    size_t numBytes,
256    size_t *pBytesRead /* [out] */
257    );
258
259/***************************************************************************
260Summary:
261Write data to a serial port.
262
263Description:
264This function will write data to a serial port, up to the number of bytes
265specified.  If the bytes specified exceeds available buffer space, the
266number of bytes written will be smaller than the number requested.  In this
267case, the application should wait for a TxCallback and then continue to write
268the remaining bytes.
269
270See Also:
271NEXUS_Uart_Read
272***************************************************************************/
273NEXUS_Error NEXUS_Uart_Write(
274    NEXUS_UartHandle handle,
275    const void *pData, /* [out] attr{nelem=bufferSize;reserved=64} */
276    size_t bufferSize,
277    size_t *pBytesWritten /* [out] */
278    );
279
280/***************************************************************************
281Summary:
282UART status
283
284Description:
285
286See Also:
287NEXUS_Uart_GetStatus
288***************************************************************************/
289typedef struct NEXUS_UartStatus
290{
291    bool rxOverrun;
292    bool rxFrameError;
293    bool rxParityError;
294    unsigned rxBytes;
295    unsigned txBytes;
296} NEXUS_UartStatus;
297
298/***************************************************************************
299Summary:
300Get the current status of a UART.
301***************************************************************************/
302NEXUS_Error NEXUS_Uart_GetStatus(
303    NEXUS_UartHandle handle,
304    NEXUS_UartStatus *pStatus   /* [out] */
305    );
306
307#ifdef __cplusplus
308}
309#endif
310
311#endif /* #ifndef NEXUS_UART_H__ */
312
Note: See TracBrowser for help on using the repository browser.