|
Embedded Xinu Operating System
An ongoing research project and educational operating system.
|
Driver for the BCM2837B0 (Raspberry Pi 3 B+) framebuffer. More...
Functions | |
| void | drawChar (char c, int x, int y, ulong color) |
| void | drawPixel (int x, int y, ulong color) |
| void | drawLine (int x1, int y1, int x2, int y2, ulong color) |
| void | drawSegment (int x1, int y1, int x2, int y2, ulong color) |
| void | drawRect (int x1, int y1, int x2, int y2, ulong color) |
| void | fillRect (int x1, int y1, int x2, int y2, ulong color, bool gradient) |
| void | drawCircle (int x0, int y0, int radius, ulong color) |
| void | fillCircle (int x0, int y0, int radius, ulong color, bool gradient) |
| void | drawBody (int x0, int y0, int radius, ulong color) |
| void | fillBody (int x0, int y0, int radius, ulong color, bool gradient) |
| syscall | fbputc (uchar c, device *devptr) |
| syscall | fbgetc (device *devptr) |
| syscall | fbprintf (char *fmt,...) |
| devcall | fbPutc (device *devptr, char ch) |
| devcall | fbWrite (device *devptr, const uchar *buf, uint len) |
| ulong | mailboxRead () |
| void | mailboxWrite (ulong data) |
| ulong | readMMIO (ulong base, ulong reg) |
| void | writeMMIO (ulong base, ulong reg, ulong val) |
| ulong | physToBus (void *address) |
| volatile unsigned int | __attribute__ ((aligned(16))) |
| void | screenInit () |
| int | framebufferInit () |
| void | screenClear (ulong color) |
| void | minishellClear (ulong color) |
| void | initlinemap () |
| double | power (double base, int exp) |
| long | factorial (int num) |
| double | cosine_taylor (double x, int terms) |
| double | cos (int x) |
| double | sine_taylor (double x, int terms) |
Driver for the BCM2837B0 (Raspberry Pi 3 B+) framebuffer.
This driver communicates with the VideoCore GPU and provides functions to draw shapes and print text to the screen.
| volatile unsigned int __attribute__ | ( | (aligned(16)) | ) |
Make a mailbox call.
| ch | Mailbox channel |
| double cos | ( | int | x | ) |
Compute the cosine using the Taylor approximation as a helper function
| x | Angle, in degrees |
| double cosine_taylor | ( | double | x, |
| int | terms | ||
| ) |
Compute the Taylor series approximation of cosine using power and factorial x Base value
| terms | Terms of the sum |
| void drawBody | ( | int | x0, |
| int | y0, | ||
| int | radius, | ||
| ulong | color | ||
| ) |
Turtle graphics specific circle functions
| x0 | x-coordinate of circle center |
| y0 | y-coordinate of circle center |
| radius | radius of circle |
| color | color of circle |
| void drawChar | ( | char | c, |
| int | x, | ||
| int | y, | ||
| ulong | color | ||
| ) |
font.c includes a 12 byte representation of each of the first 128 ASCII characters. each byte is one row of 0's and 1's, where 1's represent that a pixel should be rendered in that location.
| c | character to be drawn |
| x | x-coordinate of character |
| y | y-coordinate of character |
| color | color of character |
| void drawCircle | ( | int | x0, |
| int | y0, | ||
| int | radius, | ||
| ulong | color | ||
| ) |
Midpoint Circle Algorithm calculation of a circle. Based on "x^2 + y^2 = r^2"
| x0 | x-coordinate of circle center |
| y0 | y-coordinate of circle center |
| radius | radius of circle |
| color | color of circle |
| void drawLine | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| ulong | color | ||
| ) |
Line drawing based on Bresenham's Algorithm. So that we don't need to mess with division or decimals.
| x1 | starting x-coordinate of line |
| y1 | starting y-coordinate of line |
| x2 | ending x-coordinate of line |
| y2 | ending y-coordinate of line |
| color | color of line |
| void drawPixel | ( | int | x, |
| int | y, | ||
| ulong | color | ||
| ) |
Draws a colored pixel at given (x, y) coordinates.
| x | x-coordinate of pixel |
| y | y-coordinate of pixel |
| color | color of pixel |
| void drawRect | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| ulong | color | ||
| ) |
Draws a rectangle outline TODODC better description
| x1 | upper left hand corner x-coordinate |
| y1 | upper left hand corner y-coordinate |
| x2 | lower right hand corner x-coordinate |
| y2 | lower right hand corner y-coordinate |
| color | color of rectangle |
| void drawSegment | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| ulong | color | ||
| ) |
Modified drawLine specifically for turtle graphics
| x1 | starting x-coordinate |
| y1 | starting y-coordinate |
| x2 | ending x-coordinate |
| y2 | ending y-coordinate |
| color | color of line |
| long factorial | ( | int | num | ) |
Compute the factorial of an integer
| num | Integer to compute factorial operation on |
| syscall fbgetc | ( | device * | devptr | ) |
perform a synchronous kernel read
| *devptr | pointer to device on which to write character |
| syscall fbprintf | ( | char * | fmt, |
| ... | |||
| ) |
kernel printf: formatted, unbuffered output to framebuffer Akin to "kprintf" for the serial driver. Alternate: fprintf(FRAMEBUF, "string");
| *fmt | pointer to string being printed |
| syscall fbputc | ( | uchar | c, |
| device * | devptr | ||
| ) |
perform a synchronous character write
| *devptr | pointer to device on which to write character |
| c | character to write |
| devcall fbPutc | ( | device * | devptr, |
| char | ch | ||
| ) |
Write a single character to the framebuffer
| devptr | pointer to framebuffer device |
| ch | character to write |
| devcall fbWrite | ( | device * | devptr, |
| const uchar * | buf, | ||
| uint | len | ||
| ) |
Write a buffer of characters to the framebuffer.
| devptr | pointer to framebuffer device |
| buf | buffer of characters to write |
| len | number of characters to write from the buffer |
len in the event of a write error; or ::SYSERR if an error occurred before any characters at all were written. | void fillBody | ( | int | x0, |
| int | y0, | ||
| int | radius, | ||
| ulong | color, | ||
| bool | gradient | ||
| ) |
Draws filled in circle
| x0 | x-coordinate of circle center |
| y0 | y-coordinate of circle center |
| radius | radius of circle |
| color | color of circle |
| gradient | true if circle has a gradient; false if not |
| void fillCircle | ( | int | x0, |
| int | y0, | ||
| int | radius, | ||
| ulong | color, | ||
| bool | gradient | ||
| ) |
Draws a filled in circle TODODC better description
| x0 | x-coordinate of circle center |
| y0 | y-coordinate of circle center |
| radius | radius of circle |
| color | color of circle |
| gradient | true if circle has a gradient; false if not |
| void fillRect | ( | int | x1, |
| int | y1, | ||
| int | x2, | ||
| int | y2, | ||
| ulong | color, | ||
| bool | gradient | ||
| ) |
Draws a filled-in ractangle, given coordinates and colorization options
| x1 | upper left hand corner x-coordinate |
| y1 | upper left hand corner y-coordinate |
| x2 | lower right hand corner x-coordinate |
| y2 | lower right hand corner y-coordinate |
| color | color of rectangle |
| gradient | true if rectangle has a gradient; false if not |
| int framebufferInit | ( | ) |
Initializes the framebuffer used by the GPU via the framebuffer mailbox.
| void initlinemap | ( | ) |
Clear the "linemapping" array used to keep track of pixels we need to remember
| ulong mailboxRead | ( | ) |
Read from mailbox one on channel one (GPU mailbox) Note: Data: first 28 bits. Channel: last 4 bits.
| void mailboxWrite | ( | ulong | data | ) |
Write to GPU mailbox.
| data | Data to write to the mailbox |
| void minishellClear | ( | ulong | color | ) |
Clear the minishell window
| color | Color to paint the window upon clear |
| ulong physToBus | ( | void * | address | ) |
Converts ARM physical addresses to ARM bus addresses. Separate function for legibility's sake. Rev 1 board GPU required bus addresses. Now deprecated.
| address | Physical address to convert |
| double power | ( | double | base, |
| int | exp | ||
| ) |
Compute the double-precision result of a power operation
| base | Double-precision base value of operation |
| exp | Integer exponent to which the base is raised |
| ulong readMMIO | ( | ulong | base, |
| ulong | reg | ||
| ) |
To omit illegible lines of code, a helper function that reads from memory mapped IO registers.
| base | Register base |
| reg | MMIO register to read |
| void screenClear | ( | ulong | color | ) |
Very heavy handed clearing of the screen to a single color.
| color |
| void screenInit | ( | ) |
Calls framebufferInit() several times to ensure we successfully initialize, just in case.
| double sine_taylor | ( | double | x, |
| int | terms | ||
| ) |
Compute the Taylor series approximation of sine
| x | Base value |
| terms | Terms of the sum |
| void writeMMIO | ( | ulong | base, |
| ulong | reg, | ||
| ulong | val | ||
| ) |
The opposite of above. Write to MMIO.
| base | Register base |
| reg | MMIO register to write to |
| val | Value to be written |
1.8.5