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

Subversion Repositories wf3d

[/] [wf3d/] [trunk/] [clib/] [hw_dep/] [de0/] [mp_hwdep.c] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 specular
//=======================================================================
2
// Project Monophony
3
//   Wire-Frame 3D Graphics Accelerator IP Core
4
//
5
// File:
6
//   mp_hwdep.c
7
//
8
// Abstract:
9
//   Hardware dependent function
10
//
11
// Author:
12 9 specular
//   Kenji Ishimaru (info.info.wf3d@gmail.com)
13 2 specular
//
14
//======================================================================
15
//
16
// Copyright (c) 2015, Kenji Ishimaru
17
// All rights reserved.
18
//
19
// Redistribution and use in source and binary forms, with or without
20
// modification, are permitted provided that the following conditions are met:
21
//
22
//  -Redistributions of source code must retain the above copyright notice,
23
//   this list of conditions and the following disclaimer.
24
//  -Redistributions in binary form must reproduce the above copyright notice,
25
//   this list of conditions and the following disclaimer in the documentation
26
//   and/or other materials provided with the distribution.
27
//
28
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
30
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
31
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
34
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
35
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
36
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
37
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
38
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39
//
40
// Revision History
41
 
42
#include "mp_hwdep.h"
43
 
44
volatile int fb_front = 0;
45
 
46
void buffer_clear(unsigned int c,int bank) {
47
  unsigned int i;
48
  unsigned int a,ae;
49
  if (bank==1) a = FRAME_BUFFER_1;
50
  else a = FRAME_BUFFER_0;
51
  ae = a+0x4b000;  // 640x480x8
52
  for (i = a; i < ae; i += 4 ) {
53
    (*(volatile unsigned int  *)i) = c;
54
  }
55
}
56
 
57
void video_init() {
58
  FB0_OFFSET = FRAME_BUFFER_0;
59
  FB1_OFFSET = FRAME_BUFFER_1;
60
  FRONT_BUFFER = 0;
61
  VIDEO_INT_MASK = 3;
62
  COLOR_MODE = 2;  // 8bit color
63
  fb_front = 0;    // BANK0 is displayed
64
  // clear screen
65
  printf("COLOR MODE %d\n",COLOR_MODE);
66
  // Video Start
67
  VIDEO_START = 0x00000001;
68
}
69
 
70
void video_swap() {
71
  int video_status;
72
  //VIDEO_INT_CLEAR = 0;
73
  video_status = VIDEO_STATUS;
74
  while (!(video_status & 0x1))  {
75
    video_status = VIDEO_STATUS;
76
  }
77
  if (fb_front == 0) fb_front = 1;
78
  else fb_front = 0;
79
  FRONT_BUFFER = fb_front;
80
}
81 4 specular
 
82
void hw_init() {
83
}
84
 

powered by: WebSVN 2.1.0

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