-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
60 lines (48 loc) · 1.47 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//header file containing declarations, constants and variables
#ifndef MAIN_HEADER
#define MAIN_HEADER
#define SDRAM_BASE 0xC0000000
#define FPGA_ONCHIP_BASE 0xC8000000
#define FPGA_CHAR_BASE 0xC9000000
/* Cyclone V FPGA devices */
#define LEDR_BASE 0xFF200000
#define HEX3_HEX0_BASE 0xFF200020
#define HEX5_HEX4_BASE 0xFF200030
#define SW_BASE 0xFF200040
#define KEY_BASE 0xFF200050
#define TIMER_BASE 0xFF202000
#define PIXEL_BUF_CTRL_BASE 0xFF203020
#define CHAR_BUF_CTRL_BASE 0xFF203030
#define JTAG_UART_BASE 0xFF201000
/* VGA colors */
#define WHITE 0xFFFF
#define YELLOW 0xFFE0
#define RED 0xF800
#define GREEN 0x07E0
#define BLUE 0x001F
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define GREY 0xC618
#define PINK 0xFC18
#define ORANGE 0xFC00
#define ABS(x) (((x) > 0) ? (x) : -(x))
/* Screen size. */
#define RESOLUTION_X 320
#define RESOLUTION_Y 240
/* Constants for animation */
#define BOX_LEN 2
#define NUM_BOXES 8
#define FALSE 0
#define TRUE 1
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
void plot_pixel(int x, int y, short int line_color);
void draw_line(int x0, int y0, int x1, int y1, short int line_color);
void clear_screen();
void wait_for_vsync();
void draw_box(int x, int y, short int line_colour);
char get_jtag(volatile int * JTAG_UART_ptr);
void put_jtag(volatile int * JTAG_UART_ptr,char c);
volatile int pixel_buffer_start; // global variable
#endif