source: svn/trunk/newcon3bcm2_21bu/magnum/commonutils/rsp/brsp.h @ 12

Last change on this file since 12 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 4.9 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: brsp.h $
11 * $brcm_Revision: Hydra_Software_Devel/3 $
12 * $brcm_Date: 10/19/04 12:06p $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: /magnum/commonutils/rsp/brsp.h $
19 *
20 * Hydra_Software_Devel/3   10/19/04 12:06p dlwin
21 * PR 13038: Added ability to do Read/Mod/Write.
22 *
23 * Hydra_Software_Devel/2   9/8/03 6:29p dlwin
24 * Updated API function parameter comment for DocJet.
25 *
26 * Hydra_Software_Devel/1   9/3/03 3:33p dlwin
27 * Initial version
28 *
29 ***************************************************************************/
30
31/*= Module Overview *********************************************************
32<verbatim>
33
34Overview
35This common utility module is responsible for providing service to
36parse Register Scripts.  A Register Script is simple table that contains
37register's address and the value to write to that register.  The script
38supports write operations in 8/16/32 bits as well as Multi-Byte writes
39(used in Qam Downstream/Out-of-Band).  Along with the write operation, the
40script supports Delay and CallBack functions.  Delays are implemented
41using a busy loops.  The CallBack functions are provided when a simple write
42is not suffice to configure a register, for example, the register setting may
43require a run-time conditional operation to determine the appropriate value
44to configure it.
45
46All BRSP CallBack function must contain five parameters, four script
47provided parameters and one device handle.  CallBack function must
48return BERR_Code.  If an BERR_SUCCESS is not returned, then
49script parser will terminate.
50
51
52Design
53None
54
55
56Usage
57The usage of BRSP involves the following:
58
59        * Create Register Script (statically or dynamically)
60        * Call parse function to parse Register Script
61
62
63Sample Code
64// The following is simple example that writes to several registers
65// in the RFM core.
66static const BRSP_ScriptTbl regScript[] =
67{
68        BRSP_ScriptType_eWrite32, BCHP_RFM_CLK27_LCF1A1, 0x12345678,
69        BRSP_ScriptType_eWrite32, BCHP_RFM_CLK27_LCF1B1, 0xFF00FF00,
70        BRSP_ScriptType_eWrite32, BCHP_RFM_CLK27_LCF1B2, 0xBABEFACE,
71        BRSP_ScriptType_eEndOfScript, 0x00,                          0x00000000
72};
73
74static BCHP_Handle hChip7038;
75static BREG_Handle hReg7038;
76static BINT_Handle hInt7038;
77
78main( void )
79{
80        // Initialize hChip7038, hReg7038, and hInt7038 . . .
81
82        BRSP_ParseRegScript( hReg7038, regScript, NULL );
83}
84
85
86</verbatim>
87***************************************************************************/
88
89
90#ifndef BRSP_H__
91#define BRSP_H__
92
93#include "breg_mem.h"
94
95#ifdef __cplusplus
96extern "C" {
97#endif
98
99
100/***************************************************************************
101Summary:
102        The typedef for BRSP Script Table.
103
104Description:
105        This typedef represents the BRSP Script Table.
106
107See Also:
108        BRSP_ParseRegScript()
109
110****************************************************************************/
111typedef uint32_t                                                BRSP_ScriptTbl;
112
113#define BRSP_RD_MOD_WR_32( reg, field, val )                    BCHP_##reg, BCHP_MASK(reg, field), BCHP_FIELD_DATA(reg, field, val), 0x00000000, 0x00000000
114
115/***************************************************************************
116Summary:
117        Enumeration for Script Type supported by BRSP.
118
119Description:
120        This enumeration defines the Script Type supported by BRSP.
121
122See Also:
123        BRSP_ParseRegScript()
124
125****************************************************************************/
126typedef enum
127{
128        BRSP_ScriptType_eEndOfScript,                   /* End of Script */
129        BRSP_ScriptType_eNestedScript,                  /* Link to nested-script */
130        BRSP_ScriptType_eDelay,                                 /* Busy Delay, in Milliseconds */
131        BRSP_ScriptType_eFunc,                                  /* CallBack Function */
132        BRSP_ScriptType_eWrite8,                                /* 8 bit single word write */
133        BRSP_ScriptType_eWrite16,                               /* 16 bit single word write */
134        BRSP_ScriptType_eWrite32,                               /* 32 bit single word write */
135        BRSP_ScriptType_eMbWrite32,                             /* Multi-byte write, supported only for InBand and OutOfBand Qam cores */
136        BRSP_ScriptType_eRdModWr32,                             /* Read/Mod./Write, 32 bit single word, requires six fields */
137        BRSP_ScriptType_eLast
138} BRSP_ScriptType;
139
140/***************************************************************************
141Summary:
142        This function parses a BRSP script.
143
144Description:
145        This function is responsible for parsing a BRSP script.
146
147Returns:
148        TODO:
149
150See Also:
151        BRSP_ScriptType
152
153****************************************************************************/
154BERR_Code BRSP_ParseRegScript(
155        BREG_Handle hReg,                                       /* [in] Handle to Register */
156        const BRSP_ScriptTbl *pScriptTbl,       /* [in] Pointer to Register Script Tbl */
157        void *phDev                                                     /* [in] Handle of calling device */
158        );
159
160
161#ifdef __cplusplus
162}
163#endif
164 
165#endif
166
167
168
Note: See TracBrowser for help on using the repository browser.