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

Subversion Repositories mips_enhanced

[/] [mips_enhanced/] [trunk/] [grlib-gpl-1.0.19-b3188/] [software/] [leon3/] [hpi_new.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dimamali
#include <stdio.h>
2
#include "hpi_defs.h"
3
#include "hpi_functions.h"
4
 
5
#define SIMULATION
6
 
7
#ifdef SIMULATION
8
 
9
//#define printf //
10
#define MSIZE 32
11
#define LOOPS 1
12
#define START 0x0000
13
#define DATA  ((USHORT)~(2*i))
14
//#define DATA  0xC53A//0xffff//
15
 
16
#else
17
 
18
#define MSIZE 512
19
#define LOOPS 4
20
#define START 0x0500 //0x0000
21
#define DATA  ((USHORT)~(2*i))
22
 
23
#endif
24
 
25
int main(int argc,char *argv[], char *envp[])
26
{
27
 
28
  USHORT const size = (USHORT) MSIZE;
29
  USHORT tmp, j, i, error=0;
30
  USHORT start = (USHORT) START;
31
  USHORT data1[size];
32
 
33
  CTRL_REG * pctrl = (CTRL_REG *) HPI_CTRL;
34
 
35
  pctrl->RESERVED = 0;
36
  pctrl->AtoCSlow = 1;
37
  pctrl->CStoCTRLlow = 2;
38
  pctrl->CTRLlowDvalid = 2;
39
  pctrl->CTRLlow = 3;
40
  pctrl->CTRLhighCShigh = 1;
41
  pctrl->CShighREC = 1;
42
 
43
  tmp = pctrl->reg;
44
 
45
  printf("\n\nHPI_NEW: Test for the LEON HPI bus interface\n\n");
46
  printf("Writing %d words from 0x%04x to 0x%04x\n", size, start, start+(size-1)*2);
47
  printf("AHB2HPI CTRL register: 0x%04x\n\n", tmp);
48
  printf("Start reading and writing data\n\n");
49
 
50
  for (j=0; j<LOOPS; j++) {
51
    for(i=0; i<size; i++) {
52
      lcd_hpi_write_word(start+i*2, DATA);
53
      tmp = lcd_hpi_read_word(start+i*2);
54
      if (tmp != DATA) {
55
        printf("R/W error #%d:\n", ++error);
56
        printf("Cycle #%d:\n", i);
57
        printf("Expected:\t0x%x\n", DATA);
58
        printf("Read:\t\t0x%x\n", tmp);
59
        printf("Address:\t0x%x\n\n", start+i*2);
60
      }
61
    }
62
  }
63
 
64
  /*
65
#ifdef SIMULATION
66
#undef SIMULATION
67
#endif
68
  */
69
 
70
  if(error == 0)
71
    printf("**** FINISHED without errors ****\n");
72
  else
73
    printf("**** ERRORS: %d ****\n", error);
74
 
75
  return error;
76
}
77
 

powered by: WebSVN 2.1.0

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