source: svn/trunk/newcon3bcm2_21bu/dta/src/ram_init_nexus.c @ 2

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

1.phkim

  1. revision copy newcon3sk r27
  • Property svn:executable set to *
File size: 4.2 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2003-2008, 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: $
11 * $brcm_Revision: $
12 * $brcm_Date: $
13 *
14 * Module Description:
15 *
16 * Revision History:
17 *
18 * $brcm_Log: $
19 *
20 *
21 ***************************************************************************/
22
23
24#include "ministd.h"
25#include "serial.h"
26#include "bos.h"
27#include "cache_util.h"
28#include "bstd.h"
29#include "bkni.h"
30#include "ucos_ii.h"
31#include "bcmuart.h"
32#include "bchp_timer.h"
33//#include "bmem_debug.h"
34#include "serial.h"
35#include "bchp_sun_top_ctrl.h"
36
37#define APP_PRIORITY                    24
38#define CONSOLE_STK_SIZE                4096            /* in words */
39#define REG_RW_STK_SIZE                 128             /* in words */
40#define TEST_TASKINFO_STK_SIZE          512             /* in words */
41#define APP_STK_SIZE                   2048            /* in words */
42#ifdef CONFIG_ENABLE_EMU
43        #define TASKINFO_SLEEP_ms 100
44#else
45        #define TASKINFO_SLEEP_ms 2000
46#endif
47
48
49BDBG_MODULE(ram_start);
50
51extern unsigned int _fbss;
52extern unsigned int _end;
53extern unsigned long  ram1_start_address;
54
55extern void console_main(void *data);
56void test_taskinfo_main(void *data);
57unsigned get_opt(void);
58
59extern void ram_start(void);
60
61static b_task_t app_task_h;
62static b_task_t info_task_h;
63static unsigned int *info_stack;
64
65#define CONSOLE_PRIORITY                52
66bool s_printing_enabled;
67
68/***********************************************************************/
69/* static inline void s_do_putc(volatile UartChannel *uart, int c) */
70/***********************************************************************/
71static inline void s_do_putc(volatile UartChannel *uart, int c)
72{
73        while (!(uart->sdw_lsr & THRE));
74        uart->sdw_rbr_thr_dll = (unsigned char)c;
75}
76
77/***********************************************************************/
78/* serial_putc(UartChannel *uart, unsigned int c)*/
79/***********************************************************************/
80void print_string(char *str)
81{
82        unsigned int idx = 0;
83
84        while(str[idx])
85                serial_putc(CONSOLE_UART,str[idx++]);
86}
87
88
89#define BPRINT_PRIORITY 35
90#define BPRINT_STK_SIZE 0x400
91static unsigned int bprint_stack[BPRINT_STK_SIZE];
92static b_task_t bprint_task;
93static void bprint_entry(void *data);
94
95void bcm_main(void)
96{
97        b_task_params console_params;
98        b_task_t console_task_h;
99        BERR_Code berr;
100
101        bos_init();
102        /* kni and dbg must be initialized after os since they use os primitives */
103        berr = BKNI_Init();
104        BKNI_Print_Init();
105        berr = BDBG_Init();
106        /* test message for BDBG routines */
107        BDBG_ERR(("### BOS INIT DONE ###"));
108
109        calc_cache_sizes();
110        print_cache_sizes();
111
112        console_params.name="console";
113        console_params.priority = CONSOLE_PRIORITY;
114        console_params.stack_size = CONSOLE_STK_SIZE;
115        console_params.stack = (unsigned int*)malloc(console_params.stack_size * sizeof(unsigned int));
116
117        printf("%s stack @ 0x%08x\n",console_params.name, console_params.stack);
118        bos_start_task(&console_task_h,&console_params,console_main,&console_task_h);
119        console_params.name="bprint";
120        console_params.priority = BPRINT_PRIORITY;
121        console_params.stack_size = BPRINT_STK_SIZE;
122        console_params.stack = bprint_stack;
123
124        bos_start_task(&bprint_task, &console_params, bprint_entry,&console_task_h);
125        bos_start();
126
127        printf("%s..SHOULD NEVER GET HERE.\n",__FUNCTION__);
128        __asm__("break 2");
129}
130
131
132/* this two functions probably should be moved somewhere more suitable */
133static size_t out_string(const void * buf, size_t count)
134{
135        size_t i;
136        const unsigned char * pc = buf;
137        for(i = 0; i <= count; i++){
138                if (pc[i]=='\n') {
139                        serial_putc(CONSOLE_UART, '\r');
140                }
141                serial_putc(CONSOLE_UART, pc[i]);
142        }
143        return count;
144}
145
146void bprint_entry(void *data)
147{
148        BDBG_ERR(("PRINT TASK ONLINE"));
149        s_printing_enabled = true;
150        while (1)
151        {
152                if (s_printing_enabled)
153                {
154                        BKNI_Print_Worker(out_string);
155                }
156                else
157                {
158                        bos_sleep(200);
159                }
160        }
161        __asm__("sdbbp");
162}
163void bprint_flush(void)
164{
165        BKNI_Print_Flush(out_string);
166}
167
Note: See TracBrowser for help on using the repository browser.