Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ECE354 Lab 2
- *
- * Andrew LaMarche, alamarche@umass.edu, 29432708
- * Brandon Cross, bjcross@umass.edu, 27898706
- *
- */
- // #include "address_map_arm.h"
- #include <time.h>
- #define KEY_BASE 0xFF200050
- #define VIDEO_IN_BASE 0xFF203060
- #define FPGA_ONCHIP_BASE 0xC8000000
- #define CHARACTER_BUFFER_BASE 0xC9000000
- /* This program demonstrates the use of the D5M camera with the DE1-SoC Board
- * It performs the following:
- * 1. Capture one frame of video when any key is pressed.
- * 2. Display the captured frame when any key is pressed.
- */
- /* Note: Set the switches SW1 and SW2 to high and rest of the switches to low for correct exposure timing while compiling and the loading the program in the Altera Monitor program.
- */
- void write_character(int x, int y, char c) {
- volatile char* buffer = (char *)(CHARACTER_BUFFER_BASE + (y << 7) + x);
- *buffer = c;
- }
- void clear_screen() {
- int x, y;
- for (x = 0; x < 320; x++) {
- for (y = 0; y < 240; y++) {
- write_character(x,y,0);
- }
- }
- }
- int main(void) {
- volatile int * KEY_ptr = (int *) KEY_BASE;
- volatile int * Video_In_DMA_ptr = (int *) VIDEO_IN_BASE;
- volatile short * Video_Mem_ptr = (short *) FPGA_ONCHIP_BASE;
- time_t curtime;
- struct tm *timeinfo;
- time (&curtime);
- timeinfo = localtime (&curtime);
- int x, y;
- *(Video_In_DMA_ptr + 3) = 0x4; // Enable the video
- while (1) {
- if (*KEY_ptr != 0) { // check if any KEY was pressed
- *(Video_In_DMA_ptr + 3) = 0x0; // Disable the video to capture one frame
- while (*KEY_ptr != 0); // wait for pushbutton KEY release
- break;
- }
- }
- while (1) {
- if (*KEY_ptr != 0) { // check if any KEY was pressed
- break;
- }
- }
- /* for (y = 0; y < 240; y++) {
- for (x = 0; x < 320; x++) {
- short temp2 = *(Video_Mem_ptr + (y << 9) + x);
- *(Video_Mem_ptr + (y << 9) + x) = temp2;
- }
- }*/
- char *time = "cucky mc. cuck cuck";
- x = 1;
- while (*time) {
- write_character(x, 59, *time);
- x++;
- time++;
- }
- clear_screen();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement