mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-26 05:42:17 +00:00
fusee: add basic print-to-display console / printk
This commit is contained in:
parent
9ab7d66524
commit
57853602df
11 changed files with 14144 additions and 3 deletions
1539
fusee/src/display/cfb_console.c
Normal file
1539
fusee/src/display/cfb_console.c
Normal file
File diff suppressed because it is too large
Load diff
53
fusee/src/display/video_fb.h
Normal file
53
fusee/src/display/video_fb.h
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* (C) Copyright 1997-2002 ELTEC Elektronik AG
|
||||
* Frank Gottschling <fgottschling@eltec.de>
|
||||
*
|
||||
* See file CREDITS for list of people who contributed to this
|
||||
* project.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _VIDEO_FB_H_
|
||||
#define _VIDEO_FB_H_
|
||||
|
||||
#define CONSOLE_BG_COL 0x00
|
||||
#define CONSOLE_FG_COL 0xa0
|
||||
|
||||
/* Try using the small font */
|
||||
#define CONFIG_VIDEO_FONT_SMALL
|
||||
|
||||
/*
|
||||
* Graphic Data Format (GDF) bits for VIDEO_DATA_FORMAT
|
||||
*/
|
||||
#define GDF__8BIT_INDEX 0
|
||||
#define GDF_15BIT_555RGB 1
|
||||
#define GDF_16BIT_565RGB 2
|
||||
#define GDF_32BIT_X888RGB 3
|
||||
#define GDF_24BIT_888RGB 4
|
||||
#define GDF__8BIT_332RGB 5
|
||||
|
||||
#define CONFIG_VIDEO_FB_LITTLE_ENDIAN
|
||||
#define CONFIG_VIDEO_VISIBLE_COLS 720
|
||||
#define CONFIG_VIDEO_VISIBLE_ROWS 1280
|
||||
#define CONFIG_VIDEO_COLS 768
|
||||
#define CONFIG_VIDEO_PIXEL_SIZE 4
|
||||
#define CONFIG_VIDEO_DATA_FORMAT GDF_32BIT_X888RGB /* BGR actually, but w/e */
|
||||
|
||||
int video_init(void *fb);
|
||||
void video_puts(const char *s);
|
||||
|
||||
#endif /*_VIDEO_FB_H_ */
|
6181
fusee/src/display/video_font_large.h
Normal file
6181
fusee/src/display/video_font_large.h
Normal file
File diff suppressed because it is too large
Load diff
4630
fusee/src/display/video_font_small.h
Normal file
4630
fusee/src/display/video_font_small.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -183,7 +183,7 @@ void display_color_screen(u32 color)
|
|||
GPIO_6(0x24) = GPIO_6(0x24) & 0xFFFFFFFE | 1;
|
||||
}
|
||||
|
||||
u32 *display_init_framebuffer(u32 *fb)
|
||||
u32 *display_init_framebuffer(void)
|
||||
{
|
||||
//This configures the framebuffer @ 0xC0000000 with a resolution of 1280x720 (line stride 768).
|
||||
exec_cfg((u32 *)DISPLAY_A_BASE, cfg_display_framebuffer, 32);
|
||||
|
|
|
@ -51,6 +51,6 @@ void display_end();
|
|||
void display_color_screen(u32 color);
|
||||
|
||||
/*! Init display in full 1280x720 resolution (32bpp, line stride 768, framebuffer size = 1280*768*4 bytes). */
|
||||
u32 *display_init_framebuffer();
|
||||
u32 *display_init_framebuffer(void);
|
||||
|
||||
#endif
|
||||
|
|
24
fusee/src/lib/printk.c
Normal file
24
fusee/src/lib/printk.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Kernel print functions.
|
||||
*/
|
||||
|
||||
#include "printk.h"
|
||||
|
||||
#include "vsprintf.h"
|
||||
#include "../display/video_fb.h"
|
||||
|
||||
/**
|
||||
* Temporary stand-in main printk.
|
||||
*
|
||||
* TODO: This should print via UART, console framebuffer, and to a ring for
|
||||
* consumption by Horizon
|
||||
*/
|
||||
void printk(char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char buf[512];
|
||||
va_start(list, fmt);
|
||||
vsnprintf(buf, sizeof(buf), fmt, list);
|
||||
video_puts(buf);
|
||||
va_end(list);
|
||||
}
|
2
fusee/src/lib/printk.h
Normal file
2
fusee/src/lib/printk.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
void printk(char *fmt, ...);
|
1676
fusee/src/lib/vsprintf.c
Normal file
1676
fusee/src/lib/vsprintf.c
Normal file
File diff suppressed because it is too large
Load diff
24
fusee/src/lib/vsprintf.h
Normal file
24
fusee/src/lib/vsprintf.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Andrei Warkentin <andrey.warkentin@gmail.com>
|
||||
*
|
||||
* This program is free software ; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef VSPRINTF_H
|
||||
#define VSPRINTF_H
|
||||
|
||||
struct va_format {
|
||||
const char *fmt;
|
||||
va_list *va;
|
||||
};
|
||||
|
||||
unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base);
|
||||
|
||||
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
|
||||
|
||||
#endif /* VSPRINTF_H */
|
|
@ -1,10 +1,22 @@
|
|||
#include "utils.h"
|
||||
#include "hwinit.h"
|
||||
#include "lib/printk.h"
|
||||
#include "display/video_fb.h"
|
||||
|
||||
|
||||
int main(void) {
|
||||
u32 *lfb_base;
|
||||
|
||||
nx_hwinit();
|
||||
display_init();
|
||||
display_color_screen(0xFFFFFFFF);
|
||||
|
||||
// Set up the display, and register it as a printk provider.
|
||||
lfb_base = display_init_framebuffer();
|
||||
video_init(lfb_base);
|
||||
|
||||
// Say hello.
|
||||
printk("Welcome to Atmosphere Fusee!\n");
|
||||
printk("Using color linear framebuffer at 0x%p!\n", lfb_base);
|
||||
|
||||
/* Do nothing for now */
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue