GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / cfe / cfe / arch / mips / board / bcm1250cpci / src / ui_bcm1250cpci.c
blob7c4a9dc42496f4023cee938c9333b58e79387c4c
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * SENTOSA-specific commands File: ui_sentosa.c
5 *
6 * A temporary sandbox for misc test routines and commands.
7 *
8 * Author: Mitch Lichtenberg (mpl@broadcom.com)
9 *
10 *********************************************************************
12 * Copyright 2000,2001,2002,2003
13 * Broadcom Corporation. All rights reserved.
15 * This software is furnished under license and may be used and
16 * copied only in accordance with the following terms and
17 * conditions. Subject to these conditions, you may download,
18 * copy, install, use, modify and distribute modified or unmodified
19 * copies of this software in source and/or binary form. No title
20 * or ownership is transferred hereby.
22 * 1) Any source code used, modified or distributed must reproduce
23 * and retain this copyright notice and list of conditions
24 * as they appear in the source file.
26 * 2) No right is granted to use any trade name, trademark, or
27 * logo of Broadcom Corporation. The "Broadcom Corporation"
28 * name may not be used to endorse or promote products derived
29 * from this software without the prior written permission of
30 * Broadcom Corporation.
32 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
33 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
34 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
35 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
36 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
37 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
38 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
40 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
41 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
42 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
43 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
44 * THE POSSIBILITY OF SUCH DAMAGE.
45 ********************************************************************* */
48 #include "lib_types.h"
49 #include "lib_string.h"
50 #include "lib_queue.h"
51 #include "lib_malloc.h"
52 #include "lib_printf.h"
54 #include "cfe_iocb.h"
55 #include "cfe_device.h"
56 #include "cfe_console.h"
57 #include "cfe_devfuncs.h"
58 #include "cfe_timer.h"
60 #include "cfe_error.h"
62 #include "ui_command.h"
63 #include "cfe.h"
65 #include "bsp_config.h"
67 #include "sbmips.h"
68 #include "sb1250_regs.h"
69 #include "sb1250_smbus.h"
70 #include "sb1250_scd.h"
72 #include "bcm1250cpci.h"
75 extern void ui_init_cpu1cmds(void);
76 extern int ui_init_memtestcmds(void);
77 extern void ui_init_usbcmds(void);
79 /* *********************************************************************
80 * Configuration
81 ********************************************************************* */
83 /* *********************************************************************
84 * prototypes
85 ********************************************************************* */
87 int ui_init_bcm1250cpcicmds(void);
88 static int ui_bcm1250cpci_setvxwenv(ui_cmdline_t *cmd,int argc,char *argv[]);
90 /* *********************************************************************
91 * Data
92 ********************************************************************* */
95 /* *********************************************************************
96 * ui_init_bcm1250cpcicmds()
98 * Add BCM1250CPCI-specific commands to the command table
100 * Input parameters:
101 * nothing
103 * Return value:
105 ********************************************************************* */
108 int ui_init_bcm1250cpcicmds(void)
111 cmd_addcmd("setvxwenv",
112 ui_bcm1250cpci_setvxwenv,
113 NULL,
114 "Set up VxWorks environment variables",
115 "setvxwenv \n\n"
116 "This command enables passing of CFE environment variables to"
117 "VxWorks and its processes.",
118 "");
121 return 0;
124 #ifdef __long64
125 #define LOCAL_MEM_LOCAL_ADRS 0xFFFFFFFF81000000
126 #else
127 #define LOCAL_MEM_LOCAL_ADRS 0x81000000
128 #endif
130 typedef struct env_vars
132 int offset;
133 char *name;
134 char *pattern;
135 } Env_vars;
137 static Env_vars var_table[] =
139 { 0x700, "NET_IPADDR", "sbe(0,0)host:/usr/vw/config/sb1250/vxWorks h=90.0.0.3 e=%s u=target" },
140 { 0x800, "PARM0", "%s" },
141 { 0x880, "PARM1", "%s" },
142 { 0x900, "PARM2", "%s" },
143 { 0x980, "PARM3", "%s" },
144 { 0xA00, "PARM4", "%s" },
145 { 0xA80, "PARM5", "%s" },
146 { 0xB00, "PARM6", "%s" },
147 { 0xB80, "PARM7", "%s" },
148 { 0xC00, "PARM8", "%s" },
149 { 0xC80, "PARM9", "%s" },
150 { 0xD00, "PARMA", "%s" },
151 { 0xD80, "PARMB", "%s" },
152 { 0xE00, "PARMC", "%s" },
153 { 0xE80, "PARMD", "%s" },
154 { 0xF00, "PARME", "%s" },
155 { 0xF80, "PARMF", "%s" }
158 static int ui_bcm1250cpci_setvxwenv( ui_cmdline_t *cmd, int argc, char *argv[] )
160 int var;
161 char *vxw_addr;
162 char str[100];
163 char vxw_str[100];
165 for( var = 0; var < (sizeof(var_table) / sizeof(Env_vars)); var++ )
167 str[0] = 0;
168 cfe_getenv( var_table[ var ].name, str, sizeof(str) );
169 /* xprintf( "%s = %s\n", var_table[ var ].name, str ); */
171 sprintf( vxw_str, var_table[ var ].pattern, str );
172 /* xprintf( "vxw str = %s\n", vxw_str ); */
173 vxw_addr = (char *) (LOCAL_MEM_LOCAL_ADRS + var_table[ var ].offset);
174 strcpy( vxw_addr, vxw_str );
177 return 0;