OpenCores
URL https://opencores.org/ocsvn/openmsp430/openmsp430/trunk

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [software/] [apps/] [gfx_demo/] [main.c] - Blame information for rev 221

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 221 olivier.gi
#include "omsp_system.h"
2
#include "timerA.h"
3
#include "gfx_controller.h"
4
#include "demo.h"
5
 
6
//---------------------------------------------------//
7
// Watchdog interrupt                                //
8
// Change Video Mode every 327ms * 15 = 4.2seconds   //
9
//---------------------------------------------------//
10
volatile unsigned char wdt_irq_cnt;
11
volatile unsigned char move_to_next_mode;
12
 
13
wakeup interrupt (WDT_VECTOR) INT_watchdog(void) {
14
 
15
  if (wdt_irq_cnt<100) {
16
    wdt_irq_cnt++;
17
  } else {
18
    wdt_irq_cnt       = 0;
19
    move_to_next_mode = 1;
20
  }
21
}
22
 
23
//---------------------------------------------------//
24
// Graphic mode initialization                       //
25
//---------------------------------------------------//
26
void gfx_mode_init(uint16_t gfx_mode, uint16_t refresh_rate) {
27
 
28
  //unsigned int idx;
29
 
30
  // Initialize Graphic controller
31
  init_gfx_ctrl(gfx_mode, refresh_rate);
32
 
33
  // Initialize palette
34
  //LUT_RAM_ADDR    = 0x0000;
35
  //for( idx = 0; idx < 256; idx = idx + 1 ) {
36
  //  LUT_RAM_DATA  = palette_64k[idx];
37
  //}
38
 
39
  // Initialize Frame pointers
40
  FRAME0_PTR   = PIX_ADDR(0, 0);
41
  FRAME1_PTR   = PIX_ADDR(0, 0);
42
 
43
  FRAME_SELECT = REFRESH_FRAME0_SELECT  |
44
                 REFRESH_SW_LUT_DISABLE |
45
                 REFRESH_SW_LUT0_SELECT |
46
                 VID_RAM0_FRAME0_SELECT |
47
                 VID_RAM1_FRAME0_SELECT |
48
                 LUT_BANK0_SELECT;
49
 
50
  // Start Graphic controller
51
  start_gfx_ctrl();
52
}
53
 
54
//---------------------------------------------------//
55
// Main                                              //
56
//---------------------------------------------------//
57
int main(void) {
58
 
59
  // Init global variables
60
  wdt_irq_cnt       = 0;
61
  move_to_next_mode = 0;
62
 
63
  // Configure watchdog timer to generate an IRQ every 327ms
64
  WDTCTL = WDTPW | WDTSSEL | WDTCNTCL | WDTTMSEL | WDTIS0;  // Select ACLK | Clear timer | Enable interval timer mode | div32768
65
  IE1_set_wdtie();
66
  eint();
67
 
68
  while (1) {
69
 
70
    gfx_mode_init(GFX_16_BPP, LT24_REFR_62_FPS);
71
    demo_16bpp();
72
    move_to_next_mode = 0;
73
 
74
    gfx_mode_init(GFX_8_BPP,  LT24_REFR_1000_FPS);
75
    demo_8bpp();
76
    move_to_next_mode = 0;
77
 
78
    gfx_mode_init(GFX_4_BPP,  LT24_REFR_1000_FPS);
79
    demo_4bpp();
80
    move_to_next_mode = 0;
81
 
82
    gfx_mode_init(GFX_2_BPP,  LT24_REFR_1000_FPS);
83
    demo_2bpp();
84
    move_to_next_mode = 0;
85
 
86
    gfx_mode_init(GFX_1_BPP,  LT24_REFR_1000_FPS);
87
    demo_1bpp();
88
    move_to_next_mode = 0;
89
  };
90
 
91
  return 0;
92
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.