Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
7572ae8
feat(base): include lesson05
anarchuser Sep 8, 2021
e28e7ad
feat(io): modify printf to allow %p %P for 0x........ notation
anarchuser Sep 8, 2021
256b9fe
feat(io): add uart as alternative to mini uart
anarchuser Sep 13, 2021
0ff6b7f
style(io): rename hdmi to gpu
anarchuser Sep 17, 2021
8732d02
feat(io): add mailbox send and read functions [untested]
anarchuser Sep 17, 2021
fc3469f
feat(io): initialise framebuffer [not working]
anarchuser Sep 17, 2021
2babdc2
fix(mb): added missing left shift
anarchuser Sep 21, 2021
c46136f
feat(io): clear UART screen
anarchuser Sep 21, 2021
93f39e4
refactor(io): rewrite mailbox and adapt gpu init to it
anarchuser Sep 21, 2021
b26321a
WIP: add debug showing program gets stuck waiting for configuration
anarchuser Sep 21, 2021
d8c4d60
Work in progress
maxstreitberger Oct 7, 2021
9fa3b72
WIP
BMG93 Oct 8, 2021
c8f19e5
WIP
anarchuser Oct 8, 2021
887b5ed
chore(make): fix stty baud rate for mac (#22)
maxstreitberger Oct 11, 2021
d9d0e48
feat(gpu): hardcode printing of four pixels
anarchuser Oct 14, 2021
5154281
WIP
anarchuser Oct 14, 2021
5fee653
feat(gpu): fix screen size and print RAINBOW
anarchuser Oct 14, 2021
520a3da
refactor(gpu): clean up unused code and add comments
anarchuser Oct 14, 2021
8c67b8f
feat(gpu): use physical dimensions read as virtual size
anarchuser Oct 14, 2021
d1bbd1d
feat(gpu): update screensaver
anarchuser Oct 14, 2021
32b473d
feat(gpu): read out physical dims to use for virtual dims
anarchuser Oct 14, 2021
9712af4
refactor(gpu): allow overriding screen dims read from GPU
anarchuser Oct 14, 2021
16b5d6d
feat(gpu): request pitch
anarchuser Oct 14, 2021
8e0be78
fix(debug): fix int dump printing too many integers
anarchuser Oct 14, 2021
2bdbc94
refactor(debug): make output more understandable
anarchuser Oct 14, 2021
6037e7c
feat(gpu): double rainbow resolution
anarchuser Oct 15, 2021
890343a
feat(gpu): display a continuous rainbow pattern
anarchuser Oct 15, 2021
bbf6705
feat(colour): switch to discrete rainbow again
anarchuser Oct 15, 2021
9faf4e3
feat(gpu): store fb related data in fb_info struct
anarchuser Oct 15, 2021
41b9349
feat(temperature): continously read temperature
anarchuser Oct 15, 2021
4ef1d2a
fix(temperature): fix message using invalid buffer size
anarchuser Oct 15, 2021
a133873
WIP: toggle GPIO pin for fan
anarchuser Oct 15, 2021
6c39023
Merge branch 'main' into feat-temperature
anarchuser Oct 18, 2021
0503bb5
Merge branch 'main' into feat-temperature
anarchuser Oct 19, 2021
b2769b6
feat(base): include lesson05
anarchuser Sep 8, 2021
f9bb2e2
feat(io): modify printf to allow %p %P for 0x........ notation
anarchuser Sep 8, 2021
c63598b
feat(io): add uart as alternative to mini uart
anarchuser Sep 13, 2021
260af24
style(io): rename hdmi to gpu
anarchuser Sep 17, 2021
d2a4e3e
feat(io): add mailbox send and read functions [untested]
anarchuser Sep 17, 2021
0561c12
feat(io): initialise framebuffer [not working]
anarchuser Sep 17, 2021
fb44629
fix(mb): added missing left shift
anarchuser Sep 21, 2021
24d89f8
refactor(io): rewrite mailbox and adapt gpu init to it
anarchuser Sep 21, 2021
57f1f23
WIP: add debug showing program gets stuck waiting for configuration
anarchuser Sep 21, 2021
47a5696
feat(gpu): hardcode printing of four pixels
anarchuser Oct 14, 2021
94e0549
Bitmap font : WIP currently not rendering any pixels on screen
BMG93 Oct 14, 2021
dd73b51
fix(bitmap): remove get_fb() from pixel location
maxstreitberger Oct 21, 2021
4120e92
feat(bitmap): WIP
maxstreitberger Oct 21, 2021
d2f9e29
fix(bitmap): drawpx
maxstreitberger Oct 21, 2021
90608fc
chore(bitmap): remove printf in drawpx
maxstreitberger Oct 21, 2021
356c0f7
feat(bitmap): working on printing char
maxstreitberger Oct 21, 2021
f0e492e
feat(font): configure printf to print to screen
anarchuser Oct 21, 2021
069e856
refactor(font): make printing a bit nicer
anarchuser Oct 21, 2021
e0f77d6
Merge branch 'feat-bitmap' into feat-temperature
anarchuser Oct 21, 2021
1430939
Merge branch 'main' into feat-temperature
anarchuser Nov 9, 2021
77565b9
Merge branch 'main' into feat-temperature
anarchuser Nov 9, 2021
987ff7d
feat(fan): run fan while temperature is above 50°C
anarchuser Nov 9, 2021
d93a7ba
feat(fan): regulate fan in kernel process
anarchuser Nov 9, 2021
b7ce1c1
feat(font): replace font with extended ascii font
anarchuser Nov 9, 2021
08b595d
feat(temperature): remove ° (not working) and print a graph frame
anarchuser Nov 9, 2021
e38145f
feat(temperature): graph development of temperature
anarchuser Nov 9, 2021
ec769b1
fix(temperature): invert graph
anarchuser Nov 9, 2021
e7d8268
feat(fan): turn-off-fan value adjusted to match graph
anarchuser Nov 9, 2021
c50fba0
refactor(temperature): change graph clearing to not clear unused bottom
anarchuser Nov 9, 2021
41f3026
style(temperature): use colors to indicate the status of the fan
anarchuser Nov 9, 2021
3289885
feat(screen): add fillrec, a function filling rectangles with color
anarchuser Nov 11, 2021
c7a8b98
refactor(temperature): make graph less stroboscopic
anarchuser Nov 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions chainloader/src/kernel/mini_uart.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "kernel/mini_uart.h"

void uart_send (char c) {
while (!((*(unsigned int *) AUX_MU_LSR_REG) & 0x20))
while (! ((*(unsigned int *) AUX_MU_LSR_REG) & 0x20))
;
*(unsigned int *) AUX_MU_IO_REG = c;
}

char uart_recv (void) {
while (!((*(unsigned int *) AUX_MU_LSR_REG) & 0x01))
while (! ((*(unsigned int *) AUX_MU_LSR_REG) & 0x01))
;
return ((*(unsigned int *) AUX_MU_IO_REG) & 0xFF);
}
Expand Down
6 changes: 4 additions & 2 deletions thorn/include/common/font.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define _ROSE_C_FONT_H

#define FONT_SIZE 8
#define FONT_FACTOR 2
#define FONT_FACTOR 3
#define FONT_REAL_WIDTH (FONT_SIZE * FONT_FACTOR)

// Spacing between lines in pixels
Expand All @@ -20,6 +20,7 @@

#include "common/gpu.h"
#include "common/screen.h"
#include "kernel/mini_uart.h"
#include "kernel/mm.h"

static point_t cursor = {0, 0};
Expand All @@ -29,10 +30,11 @@ static volatile color_t font_normal_fg = {0xC0, 0xC0, 0xC0, 0x00};
static volatile color_t font_error_fg = {0x00, 0x00, 0xC0, 0x00};
static volatile color_t font_fg;

const unsigned long long int * font (int c);
unsigned char const * font (unsigned char c);

void printc (char c);
void printc_location (point_t point, char c);
void prints_location (point_t point, char const * s);

void putc_screen (void * p, char c);

Expand Down
4 changes: 4 additions & 0 deletions thorn/include/common/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

#include "common/geometry.h"
#include "common/gpu.h"
#include "common/logging.h"
#include "common/math.h"
#include "common/printf.h"

void drawpx (point_t p, color_t color);

Expand All @@ -16,6 +19,7 @@ void drawline_grid (point_t p0, point_t p1, color_t color);
void drawrec (point_t p0, point_t p1, color_t color);
void drawcircle (point_t p, int radius, color_t color);
void draw_all_octant_points (point_t p, point_t offset, color_t color);
void fillrec (point_t pp0, point_t p1, color_t color);

void test_drawing ();

Expand Down
50 changes: 50 additions & 0 deletions thorn/include/common/temperature.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef _ROSE_C_TEMPERATURE_H
#define _ROSE_C_TEMPERATURE_H

#include "common/font.h"
#include "common/screen.h"
#include "common/stdbool.h"
#include "kernel/fork.h"
#include "kernel/gpio.h"
#include "kernel/mailbox.h"

#define GPIO_FAN 18

// Temperature the system tries to keep. Turns off cooling if it falls below.
// NOTE: The pi hits a 'soft' limit at 70 °C, reducing clock frequency.
// This value is defined in the config.txt and defaults to 60 °C if not set
#define TEMPERATURE_FAN_OFF 47500
#define TEMPERATURE_FAN_ON 50000
#define TEMPERATURE_MAX 80000

#define TEMPERATURE_CHECK_DELAY 2000

#define TEMPERATURE_POINTS 200

#define TEMPERATURE_GRAPH_LOW 45000
#define TEMPERATURE_GRAPH_HIGH 55000

static volatile unsigned int __attribute__ ((aligned (16))) temperature_request[8];

static unsigned int temperatures[TEMPERATURE_POINTS] = {0};
static unsigned int current_temperature_index = 0;

// Max temperature in degree milliCelsius.
// USB + Ethernet are designed up to 70 °C but unlikely to overheat.
// CPU is designed up to 85 °C so 80 is probably a reasonable upper limit.
// Consider reducing to 70 °C if the workload on the ports increases
static int max_temperature;

bool init_temperature (void);

void regulate_temperature (void);

int get_max_temperature (void);

int get_temperature (void);

void set_fan (bool enable);

void draw_temp_graph (void);

#endif//_ROSE_C_TEMPERATURE_H
2 changes: 1 addition & 1 deletion thorn/include/kernel/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

void enable_interrupt_controller (void);

void show_invalid_entry_message (int type, ptr_t esr, ptr_t address);
void show_invalid_entry_message (int type, ptr_t esr, ptr_t address, ptr_t far);

void irq_vector_init (void);

Expand Down
6 changes: 6 additions & 0 deletions thorn/include/kernel/timer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
#ifndef _ROSE_K_TIMER_H
#define _ROSE_K_TIMER_H

#include "common/printf.h"
#include "common/status_led.h"
#include "common/utils.h"
#include "kernel/peripherals/timer.h"
#include "kernel/sched.h"

void timer_init (void);

void handle_timer_irq (void);
Expand Down
2 changes: 1 addition & 1 deletion thorn/src/common/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ void hex_dump (byte_t * array) {
print_hex (array[i - j]);
}
printf (" ");
if (!(i % 32))
if (! (i % 32))
printf ("\r\n");
}
printf ("\r\n");
Expand Down
145 changes: 134 additions & 11 deletions thorn/src/common/font.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "common/font.h"

/* From https://github.com/dhepper/font8x8/blob/master/font8x8_block.h */
const unsigned long long int * font (int c) {
static const char f[128][FONT_SIZE] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+0000 (nul)
unsigned char const * font (unsigned char c) {
static unsigned char const f[256][FONT_SIZE] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+0000
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+0001
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+0002
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+0003
Expand Down Expand Up @@ -62,7 +62,7 @@ const unsigned long long int * font (int c) {
{0x1E, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x1E, 0x00},// U+0038 (8)
{0x1E, 0x33, 0x33, 0x3E, 0x30, 0x18, 0x0E, 0x00},// U+0039 (9)
{0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00},// U+003A (:)
{0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06},// U+003B (//)
{0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06},// U+003B (;)
{0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x00},// U+003C (<)
{0x00, 0x00, 0x3F, 0x00, 0x00, 0x3F, 0x00, 0x00},// U+003D (=)
{0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00},// U+003E (>)
Expand Down Expand Up @@ -130,13 +130,130 @@ const unsigned long long int * font (int c) {
{0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00},// U+007C (|)
{0x07, 0x0C, 0x0C, 0x38, 0x0C, 0x0C, 0x07, 0x00},// U+007D (})
{0x6E, 0x3B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+007E (~)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} // U+007F
};
return (unsigned long long int *) f[c];
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},// U+007F
{0x1E, 0x33, 0x03, 0x33, 0x1E, 0x18, 0x30, 0x1E},// U+00C7 (C cedille)
{0x00, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00},// U+00FC (u umlaut)
{0x38, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00},// U+00E9 (e aigu)
{0x7E, 0xC3, 0x3C, 0x60, 0x7C, 0x66, 0xFC, 0x00},// U+00E2 (a circumflex)
{0x33, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00},// U+00E4 (a umlaut)
{0x07, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00},// U+00E0 (a grave)
{0x0C, 0x0C, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00},// U+00E5 (a ring)
{0x00, 0x00, 0x1E, 0x03, 0x03, 0x1E, 0x30, 0x1C},// U+00E7 (c cedille)
{0x7E, 0xC3, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00},// U+00EA (e circumflex)
{0x33, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00},// U+00EB (e umlaut)
{0x07, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x1E, 0x00},// U+00E8 (e grave)
{0x33, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00},// U+00EF (i umlaut)
{0x3E, 0x63, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00},// U+00EE (i circumflex)
{0x07, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00},// U+00EC (i grave)
{0x63, 0x1C, 0x36, 0x63, 0x7F, 0x63, 0x63, 0x00},// U+00C4 (A umlaut)
{0x0C, 0x0C, 0x00, 0x1E, 0x33, 0x3F, 0x33, 0x00},// U+00C5 (A ring)
{0x07, 0x00, 0x3F, 0x06, 0x1E, 0x06, 0x3F, 0x00},// U+00C8 (E grave)
{0x00, 0x00, 0xFE, 0x30, 0xFE, 0x33, 0xFE, 0x00},// U+00E6 (ae)
{0x7C, 0x36, 0x33, 0x7F, 0x33, 0x33, 0x73, 0x00},// U+00C6 (AE)
{0x1E, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00},// U+00F4 (o circumflex)
{0x00, 0x33, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00},// U+00F6 (o umlaut)
{0x00, 0x07, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00},// U+00F2 (o grave)
{0x1E, 0x33, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00},// U+00FB (u circumflex)
{0x00, 0x07, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00},// U+00F9 (u grave)
{0x00, 0x33, 0x00, 0x33, 0x33, 0x3E, 0x30, 0x1F},// U+00FF (y umlaut)
{0xC3, 0x18, 0x3C, 0x66, 0x66, 0x3C, 0x18, 0x00},// U+00D6 (O umlaut)
{0x33, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00},// U+00DC (U umlaut)
{0x18, 0x18, 0x7E, 0x03, 0x03, 0x7E, 0x18, 0x18},// U+00A2 (dollarcents)
{0x1C, 0x36, 0x26, 0x0F, 0x06, 0x67, 0x3F, 0x00},// U+00A3 (pound sterling)
{0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C},// U+00A5 (yen)
{0x7C, 0xC6, 0x1C, 0x36, 0x36, 0x1C, 0x33, 0x1E},// U+00A7 (paragraph)
{0x70, 0xD8, 0x18, 0x3C, 0x18, 0x18, 0x1B, 0x0E},// U+0192 (dutch florijn)
{0x38, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x7E, 0x00},// U+00E1 (a aigu)
{0x1C, 0x00, 0x0E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00},// U+00ED (i augu)
{0x00, 0x38, 0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00},// U+00F3 (o aigu)
{0x00, 0x38, 0x00, 0x33, 0x33, 0x33, 0x7E, 0x00},// U+00FA (u aigu)
{0x00, 0x1F, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x00},// U+00F1 (n ~)
{0x3F, 0x00, 0x33, 0x37, 0x3F, 0x3B, 0x33, 0x00},// U+00D1 (N ~)
{0x3C, 0x36, 0x36, 0x7C, 0x00, 0x00, 0x00, 0x00},// U+00AA (superscript a)
{0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00},// U+00BA (superscript 0)
{0x0C, 0x00, 0x0C, 0x06, 0x03, 0x33, 0x1E, 0x00},// U+00BF (inverted ?)
{0x00, 0x00, 0x00, 0x3F, 0x03, 0x03, 0x00, 0x00},// U+2310 (gun pointing right)
{0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x00, 0x00},// U+00AC (gun pointing left)
{0xC3, 0x63, 0x33, 0x7B, 0xCC, 0x66, 0x33, 0xF0},// U+00BD (1/2)
{0xC3, 0x63, 0x33, 0xBD, 0xEC, 0xF6, 0xF3, 0x03},// U+00BC (1/4)
{0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00},// U+00A1 (inverted !)
{0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00},// U+00AB (<<)
{0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00},// U+00BB (>>)
{0x55, 0x00, 0xAA, 0x00, 0x55, 0x00, 0xAA, 0x00},// U+2591 (25% solid)
{0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA},// U+2592 (50% solid)
{0xFF, 0xAA, 0xFF, 0x55, 0xFF, 0xAA, 0xFF, 0x55},// U+2593 (75% solid)
{0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08},// U+2502 (thin vertical)
{0x08, 0x08, 0x08, 0x08, 0x0f, 0x08, 0x08, 0x08},// U+2524 (down L, left L, up L)
{0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x08, 0x08},// U+2561 (up L, down L, left D)
{0x14, 0x14, 0x14, 0x14, 0x17, 0x14, 0x14, 0x14},// U+2562 (up D, down D, left L)
{0x00, 0x00, 0x00, 0x00, 0x1F, 0x14, 0x14, 0x14},// U+2556 (down D, left L)
{0x00, 0x00, 0x00, 0x0F, 0x08, 0x0F, 0x08, 0x08},// U+2555 (down L, left D)
{0x14, 0x14, 0x14, 0x17, 0x10, 0x17, 0x14, 0x14},// U+2563 (up D, down D, left D)
{0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14},// U+2551 (double vertical)
{0x00, 0x00, 0x00, 0x1F, 0x10, 0x17, 0x14, 0x14},// U+2557 (down D, left D)
{0x14, 0x14, 0x14, 0x17, 0x10, 0x1F, 0x00, 0x00},// U+255D (up D, left D)
{0x14, 0x14, 0x14, 0x14, 0x1F, 0x00, 0x00, 0x00},// U+255C (up D, left L)
{0x08, 0x08, 0x08, 0x0F, 0x08, 0x0F, 0x00, 0x00},// U+255B (up L, left D)
{0x00, 0x00, 0x00, 0x00, 0x0f, 0x08, 0x08, 0x08},// U+2510 (down L, left L)
{0x08, 0x08, 0x08, 0x08, 0xf8, 0x00, 0x00, 0x00},// U+2514 (up L, right L)
{0x08, 0x08, 0x08, 0x08, 0xff, 0x00, 0x00, 0x00},// U+2534 (up L, right L, left L)
{0x00, 0x00, 0x00, 0x00, 0xff, 0x08, 0x08, 0x08},// U+252C (down L, right L, left L)
{0x08, 0x08, 0x08, 0x08, 0xf8, 0x08, 0x08, 0x08},// U+251C (down L, right L, up L)
{0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00},// U+2500 (thin horizontal)
{0x08, 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08},// U+253C (up L, right L, left L, down L)
{0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x08, 0x08},// U+255E (up L, down L, right D)
{0x14, 0x14, 0x14, 0x14, 0xF4, 0x14, 0x14, 0x14},// U+255F (up D, down D, right L)
{0x14, 0x14, 0x14, 0xF4, 0x04, 0xFC, 0x00, 0x00},// U+255A (up D, right D)
{0x00, 0x00, 0x00, 0xFC, 0x04, 0xF4, 0x14, 0x14},// U+2554 (down D, right D)
{0x14, 0x14, 0x14, 0xF7, 0x00, 0xFF, 0x00, 0x00},// U+2569 (left D, right D, up D)
{0x00, 0x00, 0x00, 0xFF, 0x00, 0xF7, 0x14, 0x14},// U+2566 (left D, right D, down D)
{0x14, 0x14, 0x14, 0xF4, 0x04, 0xF4, 0x14, 0x14},// U+2560 (up D, down D, right D)
{0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00},// U+2550 (double horizontal)
{0x14, 0x14, 0x14, 0xF7, 0x00, 0xF7, 0x14, 0x14},// U+256C (left D, right D, down D, up D)
{0x08, 0x08, 0x08, 0xFF, 0x00, 0xFF, 0x00, 0x00},// U+2567 (left D, right D, up L)
{0x14, 0x14, 0x14, 0x14, 0xFF, 0x00, 0x00, 0x00},// U+2568 (left L, right L, up D)
{0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x08, 0x08},// U+2564 (left D, right D, down L)
{0x00, 0x00, 0x00, 0x00, 0xFF, 0x14, 0x14, 0x14},// U+2565 (left L, right L, down D)
{0x14, 0x14, 0x14, 0x14, 0xFC, 0x00, 0x00, 0x00},// U+2559 (up D, right L)
{0x08, 0x08, 0x08, 0xF8, 0x08, 0xF8, 0x00, 0x00},// U+2558 (up L, right D)
{0x00, 0x00, 0x00, 0xF8, 0x08, 0xF8, 0x08, 0x08},// U+2552 (down L, right D)
{0x00, 0x00, 0x00, 0x00, 0xFC, 0x14, 0x14, 0x14},// U+2553 (down D, right L)
{0x14, 0x14, 0x14, 0x14, 0xFF, 0x14, 0x14, 0x14},// U+256B (left L, right L, down D, up D)
{0x08, 0x08, 0x08, 0xFF, 0x08, 0xFF, 0x08, 0x08},// U+256A (left D, right D, down L, up L)
{0x08, 0x08, 0x08, 0x08, 0x0f, 0x00, 0x00, 0x00},// U+2518 (up L, left L)
{0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, 0x08, 0x08},// U+250C (down L, right L)
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF},// U+2588 (solid)
{0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF},// U+2584 (bottom half)
{0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F},// U+258C (left half)
{0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0},// U+2590 (right half)
{0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00},// U+2580 (top half)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x1C, 0x36, 0x36, 0x1C, 0x00, 0x00, 0x00, 0x00},// U+00BA (degree)
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}};
return f[c];
}

void printc_location (point_t point, char c) {
unsigned char const * bitmap = (unsigned char const *) font (c);
unsigned char const * bitmap = font (c);
for (int i = 0; i < FONT_SIZE; i++) {
for (int j = 0; j < FONT_SIZE; j++) {
bool is_on = bitmap[i] & (1 << j);
Expand All @@ -152,6 +269,12 @@ void printc_location (point_t point, char c) {
}
}
}
void prints_location (point_t point, char const * s) {
while (*s) {
printc_location (point, *s++);
point.x += FONT_REAL_WIDTH;
}
}

void printc (char c) {
// Handle special characters, print otherwise
Expand All @@ -177,11 +300,11 @@ void printc (char c) {
cursor.y += FONT_REAL_HEIGHT;
}
// If next line would overflow screen height (ignoring line spacing) move to beginning of screen
if (cursor.y + FONT_REAL_WIDTH - FONT_SPACING >= get_max_height ()) {
if (cursor.y + FONT_REAL_WIDTH - FONT_SPACING > get_max_height () / 2) {
#ifdef FONT_SCROLLBACK
cursor.y -= FONT_SB_LINES * FONT_REAL_HEIGHT;
unsigned int remove_size = FONT_SB_LINES * FONT_REAL_HEIGHT * get_fb_info ()->pitch;
unsigned int scroll_size = get_fb_info ()->fb_size - remove_size;
unsigned int remove_size = FONT_SB_LINES * FONT_REAL_HEIGHT * get_fb_info ()->pitch - FONT_SPACING;
unsigned int scroll_size = get_fb_info ()->fb_size / 2 - remove_size;
memcpy ((ptr_t) get_fb (), (ptr_t) get_fb () + remove_size, scroll_size);
memzero ((ptr_t) get_fb () + scroll_size, remove_size);
#else
Expand Down
18 changes: 10 additions & 8 deletions thorn/src/common/gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ bool init_gpu () {
gpu_msg_buffer[0] = (4 * ++c);// Write message size at the beginning of the buffer

// If reading physical screen dimension fails exit function
if (!mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
if (! mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
return false;
}
{ // Second message: request frame buffer
int c = 0;// Message size; increment while we write
gpu_msg_buffer[++c] = 0;// Response - will be 0x80000000 for SUCCESS or 0x80000001 for FAILURE

#ifdef GPU_OVERRIDE_PHYSICAL_SCREEN // If this is set, update physical /virtual dimensions based on constants
gpu_msg_buffer[++c] = 0x00048003; // Tag to set virtual display width / height
gpu_msg_buffer[++c] = 8; // Size of value buffer
gpu_msg_buffer[++c] = 0; // Response & value buffer size written will be written here
gpu_msg_buffer[++c] = GPU_SCREEN_WIDTH; // Set virtual screen width | Overwritten by actual virtual width
gpu_msg_buffer[++c] = GPU_SCREEN_HEIGHT;// Set virtual screen height | Overwritten by actual virtual height
gpu_msg_buffer[++c] = 0x00048003; // Tag to set virtual display width / height
gpu_msg_buffer[++c] = 8; // Size of value buffer
gpu_msg_buffer[++c] = 0; // Response & value buffer size written will be written here
gpu_msg_buffer[++c] = GPU_SCREEN_WIDTH;// Set virtual screen width | Overwritten by actual virtual width
int index_gpu_width = c;
gpu_msg_buffer[++c] = GPU_SCREEN_HEIGHT;// Set virtual screen height | Overwritten by actual virtual height
int index_gpu_height = c;

gpu_msg_buffer[++c] = 0x00048004; // Tag to set virtual display width / height
gpu_msg_buffer[++c] = 8; // Size of value buffer
Expand Down Expand Up @@ -67,7 +69,7 @@ bool init_gpu () {
gpu_msg_buffer[0] = (4 * ++c);// Write message size at the beginning of the buffer

// If message failed exit
if (!mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
if (! mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
return false;

// Since message succeeded, update frame buffer and its size
Expand Down Expand Up @@ -95,7 +97,7 @@ bool init_gpu () {
gpu_msg_buffer[0] = (4 * ++c);// Write message size at the beginning of the buffer

// If message failed exit
if (!mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
if (! mailbox_request (gpu_msg_buffer, PROPERTY_ARM_VC))
return false;

// Else write pitch appropriately
Expand Down
Loading