source: svn/trunk/newcon3bcm2_21bu/dta/src/ram_init_settop.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
66#define BKNI_PRINT_PRIORITY             53
67bool s_printing_enabled;
68
69/***********************************************************************/
70/* static inline void s_do_putc(volatile UartChannel *uart, int c) */
71/***********************************************************************/
72static inline void s_do_putc(volatile UartChannel *uart, int c)
73{
74        while (!(uart->sdw_lsr & THRE));
75        uart->sdw_rbr_thr_dll = (unsigned char)c;
76}
77
78/***********************************************************************/
79/* serial_putc(UartChannel *uart, unsigned int c)*/
80/***********************************************************************/
81void print_string(char *str)
82{
83        unsigned int idx = 0;
84
85        while(str[idx])
86                serial_putc(CONSOLE_UART,str[idx++]);
87}
88
89
90#define BPRINT_PRIORITY 35
91#define BPRINT_STK_SIZE 0x400
92static unsigned int bprint_stack[BPRINT_STK_SIZE];
93static b_task_t bprint_task;
94static void bprint_entry(void *data);
95
96void bcm_main(void)
97{
98        b_task_params console_params;
99        b_task_t console_task_h;
100        BERR_Code berr;
101
102        bos_init();
103        /* kni and dbg must be initialized after os since they use os primitives */
104        berr = BKNI_Init();
105        BKNI_Print_Init();
106        berr = BDBG_Init();
107
108        /* test message for BDBG routines */
109        BDBG_ERR(("### BOS INIT DONE ###"));
110
111        calc_cache_sizes();
112        print_cache_sizes();
113
114        console_params.name="console";
115        console_params.priority = CONSOLE_PRIORITY;
116        console_params.stack_size = CONSOLE_STK_SIZE;
117        console_params.stack = (unsigned int*)malloc(console_params.stack_size * sizeof(unsigned int));
118
119        printf("%s stack @ 0x%08x\n",console_params.name, console_params.stack);
120        bos_start_task(&console_task_h,&console_params,console_main,&console_task_h);
121        console_params.name="bprint";
122        console_params.priority = BPRINT_PRIORITY;
123        console_params.stack_size = BPRINT_STK_SIZE;
124        console_params.stack = bprint_stack;
125
126        bos_start_task(&bprint_task, &console_params, bprint_entry,&console_task_h);
127        bos_start();
128
129        printf("%s..SHOULD NEVER GET HERE.\n",__FUNCTION__);
130        __asm__("break 2");
131}
132
133
134/* this two functions probably should be moved somewhere more suitable */
135static size_t out_string(const void * buf, size_t count)
136{
137        size_t i;
138        const unsigned char * pc = buf;
139        for(i = 0; i <= count; i++){
140                if (pc[i]=='\n') {
141                        serial_putc(CONSOLE_UART, '\r');
142                }
143                serial_putc(CONSOLE_UART, pc[i]);
144        }
145        return count;
146}
147
148void bprint_entry(void *data)
149{
150        BDBG_ERR(("PRINT TASK ONLINE"));
151        s_printing_enabled = true;
152        while (1)
153        {
154                if (s_printing_enabled)
155                {
156                        BKNI_Print_Worker(out_string);
157                }
158                else
159                {
160                        bos_sleep(200);
161                }
162        }
163        __asm__("sdbbp");
164}
165void bprint_flush(void)
166{
167        BKNI_Print_Flush(out_string);
168}
169
Note: See TracBrowser for help on using the repository browser.