view loadagent/main.c @ 7:aa1f6fe16fef

loadtools building blocks started
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 30 Apr 2013 07:19:48 +0000
parents 4a7a325ed1b6
children
line wrap: on
line source

/*
 * FreeCalypso loadagent main() function lives here
 */

#include "types.h"
#include "romvars.h"
#include "ns16550.h"
#include "halt.h"

#include <stdio.h>

extern struct boot_rom_vars rom_vars;

struct ns16550_regs *uart_base;
char *uart_name;

uart_select_init()
{
	switch (rom_vars.uart_id) {
	case 0:
		uart_base = (struct ns16550_regs *) 0xFFFF5800;
		uart_name = "MODEM";
		break;
	case 1:
		uart_base = (struct ns16550_regs *) 0xFFFF5000;
		uart_name = "IrDA";
		break;
	default:
		_exit(HALTCODE_INVALIDUART);
	}
}

main()
{
	uart_select_init();
	printf("FreeCalypso loadagent running\n");
	printf("Loaded via UART %d (%s) at baud rate #%d\n", rom_vars.uart_id,
		uart_name, rom_vars.baud_rate_code);
	printf("TCXO clock input autodetected to be %d MHz\n",
		rom_vars.clktcxo_13mhz ? 13 : 26);
	/* interactive command mode to be implemented */
	while (1)
		;
}