source: svn/newcon3bcm2_21bu/nexus/modules/spi/7552/include/nexus_spi.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.5 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_spi.h $
39* $brcm_Revision: 16 $
40* $brcm_Date: 6/1/11 9:00a $
41*
42* API Description:
43*   API name: Spi
44*    Specific APIs related to SPI Control.
45*
46* Revision History:
47*
48* $brcm_Log: /nexus/modules/spi/7400/include/nexus_spi.h $
49*
50* 16   6/1/11 9:00a erickson
51* SWDEPRECATED-2425: clarify comments
52*
53* 15   12/7/10 5:44p erickson
54* SW35230-2310: add comment
55*
56* 14   11/19/10 4:42p jhaberf
57* SW35230-2310: removed BCHP==35230 compile time checks
58*
59* 13   11/3/10 1:54p jhaberf
60* SW35125-1: Added support for 35125 DTV chip
61*
62* 12   7/14/10 8:02p jhaberf
63* SW35230-639: Added nexus_memory.h to included files in order to resolve
64*  a build issue
65*
66* 11   6/9/10 2:48p jhaberf
67* SW35230-67: integrated latest nexus SPI support for the 35230
68*
69* 10   5/19/10 5:20p jhaberf
70* SW35230-67: Added bHeap and bufferSize structure members for 35230
71*
72* 9   5/13/10 4:32p jhaberf
73* SW35230-67: Added nexus spi changes for 35230 DTV chip
74*
75* 8   1/6/10 11:33a mphillip
76* SW3548-2660: Merge interrupt vs. polling mode changes to main
77*
78* SW3548-2660/2   1/6/10 11:29a mphillip
79* SW3548-2660: Rename variable exposing interrupt vs. polling mode for
80*  transfers
81*
82* SW3548-2660/1   1/5/10 6:06p mphillip
83* SW3548-2660: Add a user setting to enable polling for transfers
84*
85* 7   11/11/09 11:53a erickson
86* SW7405-3362: add dtl and rdsclk fields to NEXUS_SpiSettings
87*
88* 6   2/4/08 4:24p vsilyaev
89* PR 38682: Added more tags for the linux kernel/user proxy mode
90*
91* 5   2/4/08 2:47p vsilyaev
92* PR 38682: Added markup for variable size pointers
93*
94* 4   1/25/08 2:29p erickson
95* PR39016: doc update
96*
97* 3   1/23/08 8:36p vobadm
98* PR35457: update docs
99*
100* 2   1/23/08 5:16p erickson
101* PR35457: update docs
102*
103* 1   1/18/08 2:21p jgarrett
104* PR 38808: Merging to main branch
105*
106* Nexus_Devel/1   11/20/07 1:28p erickson
107* PR37423: added uart, gpio, spi modules
108*
109* Nexus_Devel/1   9/13/07 6:04p jgarrett
110* PR 34702: Adding SPI
111*
112***************************************************************************/
113#ifndef NEXUS_SPI_H__
114#define NEXUS_SPI_H__
115
116#include "nexus_memory.h"
117
118#ifdef __cplusplus
119extern "C" {
120#endif
121
122typedef struct NEXUS_Spi *NEXUS_SpiHandle;
123
124/***************************************************************************
125Summary:
126    Peripheral chip select
127   
128Description:
129    Selects the chip select for the peripheral device
130***************************************************************************/
131typedef enum NEXUS_SpiPeripheralChipSelect
132{
133    NEXUS_SpiPeripheralChipSelect_e0 = 0x01,
134    NEXUS_SpiPeripheralChipSelect_e1 = 0x02,
135    NEXUS_SpiPeripheralChipSelect_e2 = 0x04,
136    NEXUS_SpiPeripheralChipSelect_e3 = 0x08,
137    NEXUS_SpiPeripheralChipSelect_eMax
138} NEXUS_SpiPeripheralChipSelect;
139
140
141/***************************************************************************
142Summary:
143    Settings structure for SPI.
144
145Description:
146    The setting structure defines the configuration of
147    SPI when a channel is opened.
148
149See Also:
150    NEXUS_Spi_Open, NEXUS_Spi_GetDefaultSettings
151
152****************************************************************************/
153typedef struct NEXUS_SpiSettings
154{
155    uint32_t    baud;                       /* SPI baud rate */
156    bool        clockActiveLow;             /* If true, the SCK will be active low. */
157    bool        txLeadingCapFalling;        /* If true, data will be transmitted on the leading edge and captured on the falling edge */
158    uint8_t     bitsPerTransfer;            /* number of bits per transfer */
159    bool        lastByteContinueEnable;     /* Last Byte Contiue Enable Flag */
160    bool        useUserDtlAndDsclk;         /* Use User specified DTL and DSCLK */
161
162    uint8_t     dtl;                        /* DTL field - length of delay after transfer. See RDB documentation for usage. */
163    uint8_t     rdsclk;                     /* RDSCLK field - the length of delay from PCS valid to SCK transition. See RDB documentation for usage. */
164    bool        interruptMode;              /* If true (default), transfers will wait for interrupt, if false transfers will poll for completion */
165   
166    /* DTV only. */
167    bool        rxLeading;
168    NEXUS_SpiPeripheralChipSelect pcs;      /* peripheral chip select */
169    bool        xferDMAMode;                /* xfer mode, either DMA or register */
170    NEXUS_HeapHandle hHeap;                 /* heap handle used for DMA xfer */
171    uint32_t    bufferSize;                 /* size of buffer from the heap */
172} NEXUS_SpiSettings;
173
174/***************************************************************************
175Summary:
176Get default settings for a SPI channel.
177****************************************************************************/
178void NEXUS_Spi_GetDefaultSettings(
179    NEXUS_SpiSettings *pSettings    /* [out] Default Settings */
180    );
181
182/***************************************************************************
183Summary:
184Open a SPI channel
185****************************************************************************/
186NEXUS_SpiHandle NEXUS_Spi_Open(  /* attr{destructor=NEXUS_Spi_Close} */
187    unsigned index, /* channel index */
188    const NEXUS_SpiSettings *pSettings
189    );
190
191/***************************************************************************
192Summary:
193Close a SPI channel
194****************************************************************************/
195void NEXUS_Spi_Close(
196    NEXUS_SpiHandle handle
197    );
198
199/***************************************************************************
200Summary:
201Set settings for a SPI channel.
202****************************************************************************/
203NEXUS_Error NEXUS_Spi_SetSettings(
204    NEXUS_SpiHandle handle,
205    const NEXUS_SpiSettings *pSettings
206    );
207
208/***************************************************************************
209Summary:
210Get settings for a SPI channel.
211****************************************************************************/
212void NEXUS_Spi_GetSettings(
213    NEXUS_SpiHandle handle,
214    NEXUS_SpiSettings *pSettings    /* [out] */
215    );
216
217/***************************************************************************
218Summary:
219Write out data over SPI.
220****************************************************************************/
221NEXUS_Error NEXUS_Spi_Write(
222    NEXUS_SpiHandle handle,
223    const uint8_t *pWriteData,      /* attr{nelem=length;reserved=8} pointer to write memory location */
224    size_t length                   /* size of data in pWriteData[] in bytes */
225    );
226
227/***************************************************************************
228Summary:
229Read in data from SPI.
230
231Description:
232The SPI protocol always writes data out as it is reading data in.
233The incoming data is stored in pReadData while the data
234going out is sourced from pWriteData.
235****************************************************************************/
236NEXUS_Error NEXUS_Spi_Read(
237    NEXUS_SpiHandle handle,
238    const uint8_t *pWriteData,      /* attr{nelem=length;reserved=8} pointer to memory location where data is to sent  */
239    uint8_t *pReadData,             /* [out] attr{nelem=length;reserved=8} pointer to memory location to store read data  */
240    size_t length                   /* length is the size of pWriteData[] in bytes and is also the size of pReadData[] in bytes. They have the same size. */
241    );
242
243#ifdef __cplusplus
244}
245#endif
246
247#endif /* #ifndef NEXUS_SPI_H__ */
248
Note: See TracBrowser for help on using the repository browser.