Esempio n. 1
0
void rtx_init () {
#ifdef _DEBUG_
	rtx_dbug_outs((CHAR *)"x: rtx_init \r\n");
#else
	rtx_dbug_outs((CHAR *)"\r\nInitializing");
#endif

	init_memory();
	init_trap_handler();
	coldfire_vbr_init();
	
	BYTE * memProcStack = memEnd + MEMBLOCKS*sizeof(struct listItem);
#ifdef _DEBUG_
	dprintf("memProcStack = 0x%x \r\n", memProcStack);
#endif

	UINT16 i;


	rtx_memset( &ready_queues[0], NULL, sizeof(ready_queues) );
	rtx_memset( &blocked_mem_queues[0], NULL, sizeof(blocked_mem_queues) );
	rtx_memset( &blocked_msg_procs[0], 0, sizeof(blocked_msg_procs) );
	rtx_memset( &i_proc_queue, 0, sizeof(i_proc_queue) );
	rtx_memset( &char_buffer[0], 0, sizeof(char_buffer) );
	rtx_memset( &cmd_registration[0], 0, sizeof(CMD_SIZE) );

#ifdef _DEBUG_HOTKEYS
	rtx_memset(&send_msg_buffer[0], 0, sizeof(send_msg_buffer));
	rtx_memset(&recv_msg_buffer[0], 0, sizeof(recv_msg_buffer));
	send_msg_buffer_index = recv_msg_buffer_index = 0;
#endif
	cursor_tracker = 0;

#ifndef _DEBUG_
	rtx_dbug_outs((CHAR *)".");
#endif	
	// sys_proc()
	pcbs[0].pid = 0;
	pcbs[0].priority = LOWEST+1;
	pcbs[0].proc_state = RUNNING;
	memProcStack += SZ_STACK/2;
	pcbs[0].orig_sp = (long*)memProcStack;
	pcbs[0].stack_ptr = pcbs[0].orig_sp;
	pcbs[0].recv_queue.msg_head = pcbs[0].recv_queue.msg_tail = NULL;


	// INIT STACK
	(pcbs[0].stack_ptr)--;
	*(pcbs[0].stack_ptr) = (UINT32)sys_proc; // PC
	(pcbs[0].stack_ptr)--;
	*(pcbs[0].stack_ptr) = ADMIN_SR; // ADMIN_SR
#ifdef _DEBUG_
	dprintf("pcb: 0x%x, pid: %d, stack_start_addr: 0x%x, PC: 0x%x \r\n", &pcbs[0], 0, pcbs[0].stack_ptr, sys_proc);
#else
	rtx_dbug_outs((CHAR *)".");
#endif
	for (i = 1; i<=NUM_T_PROCS; i++ ) {
		pcbs[i].pid = g_test_proc[i-1].pid;
		pcbs[i].priority = g_test_proc[i-1].priority;	
		memProcStack += g_test_proc[i-1].sz_stack;
		pcbs[i].orig_sp = (long*)memProcStack;
		pcbs[i].stack_ptr = pcbs[i].orig_sp;
		pcbs[i].proc_state = READY;
		pcbs[i].recv_queue.msg_head = pcbs[i].recv_queue.msg_tail = NULL;

		// INIT STACK
		
		stack_init(&(pcbs[i].stack_ptr), (UINT32)g_test_proc[i-1].entry);
		
#ifdef _DEBUG_
		dprintf("pcb: 0x%x, pid: %d, stack_ptr: 0x%x \r\n", &pcbs[i], pcbs[i].pid, pcbs[i].stack_ptr);
#else
	rtx_dbug_outs((CHAR *)".");
#endif
		proc_queue_push_back(pcbs[i].pid);
	}

	for (i = NUM_T_PROCS+1; i<=NUM_K_PROCS+NUM_T_PROCS; i++ ) {
		// i<KCD are Process A, B, C
		pcbs[i].pid = i;
		if (i == TIMER0 || i == UART1) {
			pcbs[i].proc_state = I_PROC;
			memProcStack += SZ_STACK/2;
		}
		else {
			pcbs[i].proc_state = READY;
			memProcStack += SZ_STACK;
		}
		pcbs[i].orig_sp = (long*)memProcStack;
		pcbs[i].stack_ptr = pcbs[i].orig_sp;
		
		pcbs[i].recv_queue.msg_head = pcbs[i].recv_queue.msg_tail = NULL;

		// INIT STACK

		switch(i)
		{
			case P_A:
				pcbs[i].priority = LOWEST;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)Process_A);
				break;
			case P_B:
				pcbs[i].priority = LOW;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)Process_B);
				break;
			case P_C:
				pcbs[i].priority = MEDIUM;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)Process_C);
				break;
			case KCD:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)kcd);
				break;
			case CMD_DECODER:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)cmd_decoder);
				break;
			case CRT:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)crt);
				break;
			case WALL_CLK_START:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)wall_clock_start);
				break;
			case WALL_CLK_STOP:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)wall_clock_stop);
				break;
			case SET_PROCESS_PRIOIRTY_PROC:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)set_process_priority_proc);
				break;
			case WALL_CLK_DISPLAY:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)wall_clock_display);
				break;
			case TIMER0:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)i_timer_proc);
				break;
			case UART1:
				pcbs[i].priority = HIGH;
				stack_init(&(pcbs[i].stack_ptr), (UINT32)i_uart_proc);
				break;
		}
#ifdef _DEBUG_	
		dprintf("pcb: 0x%x, pid: %d, stack_ptr: 0x%x \r\n", &pcbs[i], pcbs[i].pid, pcbs[i].stack_ptr);
#else
	rtx_dbug_outs((CHAR *)".");
#endif
		proc_queue_push_back(pcbs[i].pid);
	}
	
	

	current_pcb = &pcbs[0];

	asm("move.l %0, %%a7": :"m"(current_pcb->stack_ptr));
	
#ifndef _DEBUG_

rtx_dbug_outs("\r\n\r\n\r\n");

rtx_dbug_outs("      :::::::::: ::::::::  :::::::::: ::::::::  ::::::::::     ::: \r\n");
rtx_dbug_outs("     :+:       :+:    :+: :+:       :+:    :+: :+:    :+:    :+:   \r\n");
rtx_dbug_outs("    +:+       +:+        +:+              +:+ +:+          +:+ +:+ \r\n");
rtx_dbug_outs("   +#++:++#  +#+        +#++:++#      +#++:  +#++:++#+   +#+  +:+  \r\n");
rtx_dbug_outs("  +#+       +#+        +#+              +#+        +#+ +#+#+#+#+#+ \r\n");
rtx_dbug_outs(" #+#       #+#    #+# #+#       #+#    #+# #+#    #+#       #+#    \r\n");
rtx_dbug_outs("########## ########  ########## ########   ########        ###  \r\n");

rtx_dbug_outs("\r\n\r\n\r\n");

rtx_dbug_outs("RRRRRRRRRRRRRRRRR   TTTTTTTTTTTTTTTTTTTTTTT     OOOOOOOOO        SSSSSSSSSSSSSSS\r\n");
rtx_dbug_outs("R::::::::::::::::R  T:::::::::::::::::::::T   OO:::::::::OO    SS:::::::::::::::S\r\n");
rtx_dbug_outs("R::::::RRRRRR:::::R T:::::::::::::::::::::T OO:::::::::::::OO S:::::SSSSSS::::::S\r\n");
rtx_dbug_outs("RR:::::R     R:::::RT:::::TT:::::::TT:::::TO:::::::OOO:::::::OS:::::S     SSSSSSS\r\n");
rtx_dbug_outs("  R::::R     R:::::RTTTTTT  T:::::T  TTTTTTO::::::O   O::::::OS:::::S     \r\n");
rtx_dbug_outs("  R::::R     R:::::R        T:::::T        O:::::O     O:::::OS:::::S         \r\n");
rtx_dbug_outs("  R::::RRRRRR:::::R         T:::::T        O:::::O     O:::::O S::::SSSS     \r\n");
rtx_dbug_outs("  R:::::::::::::RR          T:::::T        O:::::O     O:::::O  SS::::::SSSSS    \r\n");
rtx_dbug_outs("  R::::RRRRRR:::::R         T:::::T        O:::::O     O:::::O    SSS::::::::SS  \r\n");
rtx_dbug_outs("  R::::R     R:::::R        T:::::T        O:::::O     O:::::O       SSSSSS::::S \r\n");
rtx_dbug_outs("  R::::R     R:::::R        T:::::T        O:::::O     O:::::O            S:::::S\r\n");
rtx_dbug_outs("  R::::R     R:::::R        T:::::T        O::::::O   O::::::O            S:::::S\r\n");
rtx_dbug_outs("RR:::::R     R:::::R      TT:::::::TT      O:::::::OOO:::::::OSSSSSSS     S:::::S\r\n");
rtx_dbug_outs("R::::::R     R:::::R      T:::::::::T       OO:::::::::::::OO S::::::SSSSSS:::::S\r\n");
rtx_dbug_outs("R::::::R     R:::::R      T:::::::::T         OO:::::::::OO   S:::::::::::::::SS \r\n");
rtx_dbug_outs("RRRRRRRR     RRRRRRR      TTTTTTTTTTT           OOOOOOOOO      SSSSSSSSSSSSSSS   \r\n");

rtx_dbug_outs("\r\n+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#++++++  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#++++++  +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#++++''''''''''''''''+++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++++++\r\n");
rtx_dbug_outs("+#++++''''''''''''''''+++++++++++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++++++++++\r\n");
rtx_dbug_outs("++'''''''''''''''''''''''''''''''''''@@................................@@++++++++++++\r\n");
rtx_dbug_outs("++'''''''''''''''''''''''''''''''''''@@................................@@++++++++++++\r\n");
rtx_dbug_outs("++'''''''''''''''''''''''''''''''''@@.`....````````````````````````....`.@@++++++++++\r\n");
rtx_dbug_outs("++'''''''''''''''''''''''''''''''''@@......````````````````````````......@@++++++++++\r\n");
rtx_dbug_outs("++''''::::::::::::::::'''''''''''''@@....```````````::````::`````````....@@++++++++++\r\n");
rtx_dbug_outs("+'''''::::::::::::::::'''''''''''''@@....```````````::````::`````````....@@++++++++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..````::``````````````````````````..@@++++++++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..````::``````````````````````````..@@++++++++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..```````````````````@@@@```::````..@@++@@@@++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..``````````````````.@@@@`.`,:````..@@++@@@@++++\r\n");
rtx_dbug_outs("+;;:::,,,,,,,,,,,,,,,,:::::::::::::@@..`````````````````@@::::@@```````..@@@@::::@@++\r\n");
rtx_dbug_outs("+:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@..```````````.`````@@::::::@.`````..@@:,::::@@++\r\n");
rtx_dbug_outs("+:,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,@@..```````````::````@@::::::@``````..@@::::::@@++\r\n");
rtx_dbug_outs("+:,,,,,,,,,,,,,,,,,,,,,,@@@@@@@,,,,@@..```````````,,````@@:::::::@@@@@@@@::::::::@@++\r\n");
rtx_dbug_outs("+:,,,,,,,,,,,,,,,,,,,,,,@@@@@@@,,,,@@..`````````````````@@:::::::@@@@@@@@::::::::@@++\r\n");
rtx_dbug_outs("+:,,,,;;;;;;;;;;;;;;;;@@:::,:@@@@@@@@..``````:.`````````@@::::::::::::::,::::::::@@++\r\n");
rtx_dbug_outs("+:,,,,;;;;;;;;;;;;;;;;@@::,::@@@@@@@@..``````:``````````@@:::::::::::::::::::::::@@++\r\n");
rtx_dbug_outs("+';;;;';;;;;;;;;;;;;;;@@@:::,::::@@@@..`````````````::@@:::::::::::::::::::::::::::@+\r\n");
rtx_dbug_outs("+'';;;;;;;;;;;;;;;;;;;@@@::::::::@@@@..`````````````,:@@:::::::::::::::::::::::::::@+\r\n");
rtx_dbug_outs("+'';;;;;;;;;;;;;;;;;;;;;;@@@@@@@@,:@@..``::```````````@@::::::  @,::::,::::  @@::::@+\r\n");
rtx_dbug_outs("+'';;;;;;;;;;;;;;;;;;;;;;@@@@@@@@::@@..``::```````````@@::::::  @:::::,::::  @@::::@+\r\n");
rtx_dbug_outs("+'';;;::::::::::::::::;;;;;;;;;@@@@@@..```````````````@@:,::::@@@::::::@@::@@@@::::@+\r\n");
rtx_dbug_outs("+'';;;::::::::::::::::;;;;;;;;;@@@@@@..```````````````@@::::::@@@::::::@@,:@@@@:::,@+\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..`````````::````@@::....::::,:::,::::::::.,..@+\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@..`````````::````@@::....:,:,,:::,::::::::....@+\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@....``::`````````@@::....::@:,::@@::::@@::....@+\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::::@@....``::`````````@@::....::@::::@@::::@@::....@+\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::::@@@@......`````````````@@,::::,@@@@@@@@@@@@@::::@@++\r\n");
rtx_dbug_outs("+;:::::::::::::::::::::::::::::;:@@@@......`````````````@@::::,:@@@@@@@@@@@@@,,::@@++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::::@@@@@@@@...................@@::::::::::::::::::,@@++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::;:@@@@@@@@...................@@:,:::::::::::::::::@@++++\r\n");
rtx_dbug_outs("+;;::::::::::::::::::::::::::@@::::::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@++++++\r\n");
rtx_dbug_outs("+;;:::;::::::::::::::::::::::@@:::::,@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#+++++++++++++\r\n");
rtx_dbug_outs("+;;:::++++++++++++++++:::::::@@::::@@  @@::,:@+   ++++++++@@,::,@@+@@::::@@++++++++++\r\n");
rtx_dbug_outs("+++++++++++++++++++++++++++++@@::::@@++@@::::@++++++++++++@@::::@@+@@::::@@++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++@@@@@@++++++@@@@@++++++++++++++@@@@@@+++@@@@@@++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++#+++++++++++++  ++++++++++++++++++++#+++#+++++++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++++++++++++++++  ++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++++++++++++++++  ++++++++++++++++++++++++++++++++++++++++\r\n");
rtx_dbug_outs("+#+++++++++++++++++++++++++++++++++++++++++  ++++++++++++++++++++++++++++++++++++++++\r\n");

	rtx_dbug_outs("\r\nNyan Nyan!\r\n");
	rtx_dbug_outs("\r\nG01's FELOX (Forever Emo Loser's Operating System) is about to start!\r\n\r\n");
	SINT8 animate_count = 0;
	UINT32 delay = 50000;
	UINT8 move_count = 12;
	UINT32 tmp_animate_count;
	while(animate_count++<move_count)
	{
		tmp_animate_count = animate_count;
		while(tmp_animate_count-->0) rtx_dbug_outs(" ");
		rtx_dbug_outs("This project is making me FOREVER ALONE!\r");
		tmp_animate_count = 0;
		while (tmp_animate_count++<delay);
	}
	while(animate_count-->0)
	{
		tmp_animate_count = animate_count;
		UINT16 tmp_animate_count2 = move_count-tmp_animate_count;
		while(tmp_animate_count-->0) rtx_dbug_outs(" ");
		rtx_dbug_outs("This project is making me FOREVER ALONE!");
		while(tmp_animate_count2-->0) rtx_dbug_outs(" ");
		rtx_dbug_outs("\r");
		tmp_animate_count = 0;
		while (tmp_animate_count++<delay);
	}
	while (animate_count++<3)
	{
		rtx_dbug_outs("This project is making me FOREVER ALONE! (o.O)\r");
		tmp_animate_count = 0;
		while (tmp_animate_count++<delay);
		rtx_dbug_outs("This project is making me FOREVER ALONE! (O.o)\r");
		tmp_animate_count = 0;
		while (tmp_animate_count++<delay);
		rtx_dbug_outs("This project is making me FOREVER ALONE! (T_T)\r");
		tmp_animate_count = 0;
		while (tmp_animate_count++<delay);
	}
	rtx_dbug_outs("This project is making me FOREVER ALONE! (@_@)\r\n\r\n");
	tmp_animate_count = 0;
	while (tmp_animate_count++<delay);
	                                                                     
rtx_dbug_outs("                             :##@@@@@           \r\n");                         
rtx_dbug_outs("                          '@@@,@,   @@                 \r\n");                  
rtx_dbug_outs("                       #@@@;         @@#                      \r\n");           
rtx_dbug_outs("                   ,+@@@              `#+                            \r\n");    
rtx_dbug_outs("                 `#@@                  `@.                               \r\n");
rtx_dbug_outs("               .@@+            @        '@                               \r\n");
rtx_dbug_outs("             `#@                       ` @,                              \r\n");
rtx_dbug_outs("             #@       `````' `         `@@@                              \r\n");
rtx_dbug_outs("            @@      '      ` # .         `@                              \r\n");
rtx_dbug_outs("           @# `      '+#,.,@ :`   ..   `  '@`                            \r\n");
rtx_dbug_outs("          @#        `     +',              @@                            \r\n");
rtx_dbug_outs("         ,@   #        `         ,..@@@`.   @'                           \r\n");
rtx_dbug_outs("        ,@     @  #` '++    '     +@`'@.+    @                           \r\n");
rtx_dbug_outs("        ;#     @  `  ## +    '    +#+;@`     @@@,,    `                  \r\n");
rtx_dbug_outs("        @      ``   @#@##    :     '@;;+    .;`;#@@@@@`                  \r\n");
rtx_dbug_outs("       ;@           @   @    .,     @,,;            `@@@'                \r\n");
rtx_dbug_outs("       @'        #''@@,@@          ;....:,,,:``  `'    `#@               \r\n");
rtx_dbug_outs("       @        + `+#@::@`#  ;  ,@ `         ,,`  +@+    :@              \r\n");
rtx_dbug_outs("      ,@           `'@;;,  `@   .' ++++'     `  ,@@` ,    ;@             \r\n");
rtx_dbug_outs("      ,@           ;: '.:.  :,# #@           :+@@@'  `     :@            \r\n");
rtx_dbug_outs("      .@    .       `:,'+ `@;@#  `         # `@@@@          '@:          \r\n");
rtx_dbug_outs("      @#  '       ,   `@  #     #      ````+#@@+; :           @@         \r\n");
rtx_dbug_outs("      @.           '';, '         ;`  .: ''@, '@ `   `        `@:        \r\n");
rtx_dbug_outs("      @.             ' '         @  ,@ '.@## @#` '   #         +#        \r\n");
rtx_dbug_outs("      @.            `:   +   .      ++@@@.#.@@ ```   #          @+       \r\n");
rtx_dbug_outs("      @             .;@@@@@@@@@@@@@@#',@@@@@'  `  :`            .@       \r\n");
rtx_dbug_outs("      @             :,.@@@@@@@#@@@;@@@@#.;     ,                 @'`     \r\n");
rtx_dbug_outs("     '@;         '  `,.         @ @+: '   `   ;` +                @      \r\n");
rtx_dbug_outs("     ''          :   ; .               ``   '   ` @       `       ##     \r\n");
rtx_dbug_outs("     '+ @        ,  ``` .' `;`            ;,   '                   @.    \r\n");
rtx_dbug_outs("     '+`,#`       ``  :      ``+.  +    #  ,   .          .        '@    \r\n");
rtx_dbug_outs("     @'   @`          ``          :+++;       `        ` .          @    \r\n");
rtx_dbug_outs("     @   ,`  .        .  +                    `                     '+   \r\n");
rtx_dbug_outs("     @    `           ` `  + `                :         ,           ;#   \r\n");
rtx_dbug_outs("    .@                 `     +                :        .           `'+   \r\n");
rtx_dbug_outs("    `@                 `                               ``         ``'+   \r\n");
rtx_dbug_outs("    @;       ,         ,                              :             '+   \r\n");
rtx_dbug_outs("    @  .               ,                  `;          :             '+   \r\n");
rtx_dbug_outs("   :@`   :    `                                                     '+   \r\n");
rtx_dbug_outs("   '+   :             .                              ,              @'   \r\n");
rtx_dbug_outs("   @. .               ``                                            @    \r\n");
rtx_dbug_outs("   @  `   .                                         .              @, `  \r\n");
rtx_dbug_outs("   @`        `+         '                        ,  '              @     \r\n");
rtx_dbug_outs("   @    '      `                                                  +@     \r\n");
rtx_dbug_outs("   @#  .       '         `                        `               @      \r\n");
rtx_dbug_outs("    @,        `+          '       ` `                          ``#@      \r\n");
rtx_dbug_outs("     @+       ,+           .       ;;,                          ,@       \r\n");
rtx_dbug_outs("      @`                   `          `                         @@       \r\n");
rtx_dbug_outs("      .@.                   ;                                  .#        \r\n");
rtx_dbug_outs("       `@`                   :                                 @'        \r\n");
rtx_dbug_outs("        `@'            `                                      @@         \r\n");
rtx_dbug_outs("          @# `+``                                            ;@          \r\n");
rtx_dbug_outs("       `   @+  ; #                                           @.          \r\n");
rtx_dbug_outs("            @+  ' '                        +                @#           \r\n");
rtx_dbug_outs("            .@`  # `'                      +               #@            \r\n");
rtx_dbug_outs("             `@.     +                     '              .@             \r\n");
rtx_dbug_outs("              `@`   '                      +              @;             \r\n");
rtx_dbug_outs("               .@`   ;                                  `.@              \r\n");
rtx_dbug_outs("                `@`    +                  +              @,              \r\n");
rtx_dbug_outs("                 '@@+++'                            :`  @@               \r\n");
rtx_dbug_outs("                   @@    `,              :         '  '@@                \r\n");
rtx_dbug_outs("                    :##       ,.           `    ++' `@@                  \r\n");
rtx_dbug_outs("                      +@@@`      ;,,,,:         `  ,@#                   \r\n");
rtx_dbug_outs("                        .@@@#              ` ++#@@@@;                    \r\n");
rtx_dbug_outs("                           '@@@@@@@@@@@@@@@@@';;:                        \r\n\r\n");
                           


#endif	
	
	prepare_serial();
	prepare_timer();
	
	asm("rte");

}
Esempio n. 2
0
int main()
{
 #ifdef _DEBUG
  rtx_dbug_outs((CHAR *)"rtx: Entering main()\r\n");
#endif


  /* get the third party test proc initialization info */
  __REGISTER_TEST_PROCS_ENTRY__();

  /* The following  is just to demonstrate how to reference
   * the third party test process entry point inside rtx.
   * Your rtx should NOT call the test process directly!!!
   * Instead, the scheduler picks the test process to run
   * and the os context switches to the chosen test process
   */

   /* Load the vector table for TRAP #0 with our assembly stub
       address */
   asm( "move.l #asm_trap_entry,%d0" );
   asm( "move.l %d0,0x10000080" );

  //UINT32 turn = 100;
  //CALL_TRAP(SEND_MESSAGE_TRAP_CALL, 300,200,100, turn);

  //g_test_proc[0].entry(); /* DO NOT invoke test proc this way !!*/

  // Assign the start of free memory
  // (so we can start initializations that require memory.)
  freeMemoryBegin = &__end + 2; // Add two because __end is used.

  int diff = ((UINT32)freeMemoryBegin)%4;
  if (diff != 0){
    freeMemoryBegin  += (4-diff);
  }

  rtx_memset(freeMemoryBegin, 0, (char*)0x10200000 - freeMemoryBegin);

  init_user_heap();
 #ifdef _DEBUG
  rtx_dbug_outs((CHAR *)"Created user heap.\r\n");
#endif


  MemoryPool_init();
 #ifdef _DEBUG
  rtx_dbug_outs((CHAR *)"Created memory pool.\r\n");
#endif


  initialize(register_sys_proc(), create_user_table());
 #ifdef _DEBUG
  rtx_dbug_outs((CHAR *)"Initialization finished.\r\n");
#endif


          int b;
        asm ("move.w %%sr, %0;":"=r"(b)  );    
rtx_dbug_out_number(b);		

  //UINT32 mask;
     /*
     * Set the interupt mask
     */
    //mask = SIM_IMR;
    //mask &= 0x0003ddff;
    //SIM_IMR = mask;
  process_switch();


  return 0;
}