コード例 #1
0
ファイル: main.c プロジェクト: QNewU/osmocom-bb
int main(void)
{
	/* Simulate a compal loader saying "ACK" */
	unsigned i = 0;
	for (i = 0; i < sizeof(phone_ack); i++) {
		putchar_asm(phone_ack[i]);
	}

	/* initialize board without interrupts */
	board_init(0);
	sercomm_uart = sercomm_get_uart();

	/* Say hi */
	puts("\n\nOsmocomBB Loader (revision " GIT_REVISION ")\n");
	puts(hr);

	fb_clear();

	fb_setfg(FB_COLOR_BLACK);
	fb_setbg(FB_COLOR_WHITE);
	fb_setfont(FB_FONT_HELVB14);

	fb_gotoxy(2,20);
	fb_putstr("loader",framebuffer->width-4);

	fb_setfg(FB_COLOR_RED);
	fb_setbg(FB_COLOR_BLUE);

	fb_gotoxy(2,25);
	fb_boxto(framebuffer->width-3,38);

	fb_setfg(FB_COLOR_WHITE);
	fb_setfont(FB_FONT_HELVR08);
	fb_gotoxy(8,33);
	fb_putstr("osmocom-bb",framebuffer->width-4);

	fb_flush();

	/* Identify environment */
	printf("Running on %s in environment %s\n", manifest_board,
	       manifest_environment);

	/* Initialize flash driver */
	if (flash_init(&the_flash, 0)) {
		puts("Failed to initialize flash!\n");
	} else {
		printf("Found flash of %zu bytes at 0x%p with %zu regions\n",
		       the_flash.f_size, the_flash.f_base,
		       the_flash.f_nregions);

		for (i = 0; i < the_flash.f_nregions; i++) {
			printf("  Region %d of %zu pages with %zu bytes each.\n",
			       i,
			       the_flash.f_regions[i].fr_bnum,
			       the_flash.f_regions[i].fr_bsize);
		}

	}

	/* Set up a key handler for powering off */
	keypad_set_handler(&key_handler);

	/* Set up loader communications */
	sercomm_register_rx_cb(SC_DLCI_LOADER, &cmd_handler);

	/* Notify any running osmoload about our startup */
	loader_send_init(SC_DLCI_LOADER);

	/* Wait for events */
	while (1) {
		keypad_poll();
		uart_poll(sercomm_uart);
	}

	/* NOT REACHED */

	twl3025_power_off();
}
コード例 #2
0
ファイル: main.c プロジェクト: kashif-test/VBTS
int main(void)
{
	/* Simulate a compal loader saying "ACK" */
	int i = 0;
	for (i = 0; i < sizeof(phone_ack); i++) {
		putchar_asm(phone_ack[i]);
	}

	/* Always disable wdt (some platforms enable it on boot) */
	wdog_enable(0);

	/* Disable the bootrom mapping */
	calypso_bootrom(0);

	/* Initialize TWL3025 for power control */
	twl3025_init();

	/* Backlight */
	bl_mode_pwl(1);
	bl_level(50);

	/* Initialize UART without interrupts */
	uart_init(SERCOMM_UART_NR, 0);
	uart_baudrate(SERCOMM_UART_NR, UART_115200);

	/* Initialize HDLC subsystem */
	sercomm_init();

	/* Say hi */
	puts("\n\nOSMOCOM Loader (revision " GIT_REVISION ")\n");
	puts(hr);

	/* Identify environment */
	printf("Running on %s in environment %s\n", manifest_board,
	       manifest_environment);

	/* Initialize flash driver */
	if (flash_init(&the_flash, 0)) {
		puts("Failed to initialize flash!\n");
	} else {
		printf("Found flash of %d bytes at 0x%x with %d regions\n",
		       the_flash.f_size, the_flash.f_base,
		       the_flash.f_nregions);

		int i;
		for (i = 0; i < the_flash.f_nregions; i++) {
			printf("  Region %d of %d pages with %d bytes each.\n",
			       i,
			       the_flash.f_regions[i].fr_bnum,
			       the_flash.f_regions[i].fr_bsize);
		}

	}

	/* Set up a key handler for powering off */
	keypad_set_handler(&key_handler);

	/* Set up loader communications */
	sercomm_register_rx_cb(SC_DLCI_LOADER, &cmd_handler);

	/* Notify any running osmoload about our startup */
	loader_send_init(SC_DLCI_LOADER);

	/* Wait for events */
	while (1) {
		keypad_poll();
		uart_poll(SERCOMM_UART_NR);
	}

	/* NOT REACHED */

	twl3025_power_off();
}