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

Subversion Repositories wf3d

[/] [wf3d/] [trunk/] [clib/] [hw_dep/] [zedboard/] [mp_hwdep.c] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 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 for ZedBoard
10
//
11
// Author:
12
//   Kenji Ishimaru (kenji.ishimaru@gmail.com)
13
//
14
//======================================================================
15
//
16
// Copyright (c) 2016, 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
#include <stdio.h>
44
 
45
volatile int fb_front = 0;
46
 
47
void buffer_clear(unsigned int c,int bank) {
48
  unsigned int i;
49
  unsigned int a,ae;
50
  if (bank==1) a = FRAME_BUFFER_1;
51
  else a = FRAME_BUFFER_0;
52
  ae = a+0x4b000;  // 640x480x8
53
  for (i = a; i < ae; i += 4 ) {
54
    (*(volatile unsigned int  *)i) = c;
55
  }
56
}
57
 
58
void video_init() {
59
  SYS_FB0_OFFSET = FRAME_BUFFER_0;
60
  SYS_FB1_OFFSET = FRAME_BUFFER_1;
61
  printf("FB0: %x\n",SYS_FB0_OFFSET);
62
  printf("FB1: %x\n",SYS_FB1_OFFSET);
63
  SYS_FRONT_BUFFER = 0;
64
  SYS_VIDEO_INT_MASK = 3;
65
  SYS_COLOR_MODE = 2;  // 8bit color
66
  fb_front = 0;    // BANK0 is displayed
67
  // clear screen
68
  printf("COLOR MODE %d\n",SYS_COLOR_MODE);
69
  // Video Start
70
  SYS_VIDEO_START = 0x00000001;
71
}
72
 
73
void video_swap() {
74
  int video_status;
75
  //VIDEO_INT_CLEAR = 0;
76
  video_status = SYS_VIDEO_STATUS;
77
  while (!(video_status & 0x1))  {
78
    video_status = SYS_VIDEO_STATUS;
79
  }
80
  if (fb_front == 0) fb_front = 1;
81
  else fb_front = 0;
82
  SYS_FRONT_BUFFER = fb_front;
83
}
84
 
85
void hw_init() {
86
  init_platform();
87
  SYS_AXI_CONFIG = 0xffffffff;
88
}
89
 

powered by: WebSVN 2.1.0

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