close Warning: Can't use blame annotator:
No changeset 2 in the repository

source: svn/newcon3bcm2_21bu/dta/tests/unit_test/main_decode.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 3.6 KB
RevLine 
1/***************************************************************************
2 *     Copyright (c) 2011, 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 "gist.h"
32#include "bos_task_priorities.h"
33#include "bcmuart.h"
34#include "bchp_timer.h"
35#include "bmem_debug.h"
36#include "zlib.h"
37#include "bfds.h"
38#include "bchp_sun_top_ctrl.h"
39#include "bstd_defs.h"
40#include "bkni_print.h"
41#include "ramheader.h"
42
43
44BDBG_MODULE(main_decode);
45
46#define CONSOLE_STK_SIZE                (1024*3)        /* in words */
47#define REG_RW_STK_SIZE                 128             /* in words */
48#define TEST_TASKINFO_STK_SIZE          512             /* in words */
49#define APP_STK_SIZE                   2048             /* in words */
50
51
52/* external declarations */
53void do_test(void * data);
54
55/* forward declarations */
56void console_main(void *data);
57
58#define BPRINT_STK_SIZE 0x400
59static unsigned int bprint_stack[BPRINT_STK_SIZE];
60static b_task_t bprint_task;
61static bool s_printing_enabled = true;
62static void bprint_entry(void *data);
63
64/* main entry point from CRT */
65
66void bcm_main(void)
67{
68        b_task_params console_params;
69        b_task_t console_task_h;
70        b_task_t print_task_h;
71        BERR_Code berr;
72       
73        bos_init();
74        /* kni and dbg must be initialized after os since they use os primitives */
75        berr = BKNI_Init();
76        BKNI_Print_Init();
77        berr = BDBG_Init();
78        /* test message for BDBG routines */
79        BDBG_ERR(("### BOS INIT DONE ###"));
80
81        calc_cache_sizes();
82        print_cache_sizes();
83
84        console_params.name="console";
85        console_params.priority = CONSOLE_PRIORITY;
86        console_params.stack_size = CONSOLE_STK_SIZE;
87        console_params.stack = (unsigned int*)malloc(console_params.stack_size * sizeof(unsigned int));
88
89        printf("%s stack @ 0x%08x\n",console_params.name, console_params.stack);
90        bos_start_task(&console_task_h,&console_params,console_main,&console_task_h);
91        console_params.name="bprint";
92        console_params.priority = BPRINT_PRIORITY;
93        console_params.stack_size = BPRINT_STK_SIZE;
94        console_params.stack = bprint_stack;
95
96        bos_start_task(&bprint_task, &console_params, bprint_entry,&print_task_h);
97        bos_start();
98
99        printf("%s..SHOULD NEVER GET HERE.\n",__FUNCTION__);
100        __asm__("break 2");
101}
102
103void console_main(void *data)
104{
105        gist_init();
106       
107        serial_init(CONSOLE_UART,115200);
108
109        bos_calibrate();
110
111
112        printf("Calculated MIPS = %dHz:\n", 2 * g_running_clock.clock_freq);
113
114    do_test(data);
115        while (1){
116        BKNI_Sleep(1000);
117    }
118       
119}
120
121/* this two functions probably should be moved somewhere more suitable */
122static size_t out_string(const void * buf, size_t count)
123{
124        size_t i;
125        const unsigned char * pc = buf;
126        for(i = 0; i <= count; i++){
127                if (pc[i]=='\n') {
128                        serial_putc(CONSOLE_UART, '\r');
129                }
130                serial_putc(CONSOLE_UART, pc[i]);
131        }
132        return count;
133}
134
135void bprint_entry(void *data)
136{
137        BDBG_ERR(("PRINT TASK ONLINE"));
138        s_printing_enabled = true;
139        while (1)
140        {
141                if (s_printing_enabled)
142                {
143                        BKNI_Print_Worker(out_string);
144                }
145                else
146                {
147                        bos_sleep(200);
148                }
149        }
150        __asm__("sdbbp");
151}
152void bprint_flush(void)
153{
154        BKNI_Print_Flush(out_string);
155}
Note: See TracBrowser for help on using the repository browser.