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

Subversion Repositories wdsp

[/] [wdsp/] [trunk/] [sw/] [FIR50/] [FIR50.c] - Blame information for rev 10

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

Line No. Rev Author Line
1 5 parrado
#include "../support/support.h"
2
#include "../support/board.h"
3
#include "../support/uart.h"
4
#include "coefs.h"
5
 
6
#include "../support/spr_defs.h"
7
 
8
#define FIR_BASE 0x9f000000
9
#define FIR_CONTROL 4
10
#define FIR_DATA 8
11
#define FIR_STATUS 12
12
#define FIR_Q 16
13
#define FIR_COEFF 20
14
 
15
void uart_print_str(char *);
16
void uart_print_long(unsigned long);
17
 
18
// Dummy or32 except vectors
19
void buserr_except(){}
20
void dpf_except(){}
21
void ipf_except(){}
22
void lpint_except(){}
23
void align_except(){}
24
void illegal_except(){}
25
/*void hpint_except(){
26
 
27
}*/
28
void dtlbmiss_except(){}
29
void itlbmiss_except(){}
30
void range_except(){}
31
void syscall_except(){}
32
void res1_except(){}
33
void trap_except(){}
34
void res2_except(){}
35
 
36
 
37
void uart_interrupt()
38
{
39
    char lala;
40
    unsigned char interrupt_id;
41
    interrupt_id = REG8(UART_BASE + UART_IIR);
42
    if ( interrupt_id & UART_IIR_RDI )
43
    {
44
        lala = uart_getc();
45
        uart_putc((lala>>1)&0xff);
46
 
47
 
48
//        uart_putc('A');
49
 
50
 
51
//uart_print_short(lala);
52
 //       uart_putc('\n');
53
    }
54
}
55
 
56
 
57
void uart_print_str(char *p)
58
{
59
        while(*p != 0) {
60
                uart_putc(*p);
61
                p++;
62
        }
63
}
64
 
65
void uart_print_long(unsigned long ul)
66
{
67
  int i;
68
  char c;
69
 
70
 
71
  uart_print_str("0x");
72
  for(i=0; i<8; i++) {
73
 
74
  c = (char) (ul>>((7-i)*4)) & 0xf;
75
  if(c >= 0x0 && c<=0x9)
76
    c += '0';
77
  else
78
    c += 'a' - 10;
79
  uart_putc(c);
80
  }
81
 
82
}
83
 
84
void uart_print_short(unsigned long ul)
85
{
86
  int i;
87
  char c;
88
  char flag=0;
89
 
90
 
91
  uart_print_str("0x");
92
  for(i=0; i<8; i++) {
93
 
94
  c = (char) (ul>>((7-i)*4)) & 0xf;
95
  if(c >= 0x0 && c<=0x9)
96
    c += '0';
97
  else
98
    c += 'a' - 10;
99
  if ((c != '0') || (i==7))
100
    flag=1;
101
  if(flag)
102
    uart_putc(c);
103
  }
104
 
105
}
106
 
107
 
108
char str[100];
109
int main()
110
{
111
int c,k,j,r_in,r_out;
112
        uart_init();
113
 
114
        int_init();
115
        int_add(UART_IRQ,&uart_interrupt);
116
uart_print_str("OpenRISC Printing Data:\n ");
117
 
118
 
119
//Writes coeffcientes
120
                for (k=0;k<Nh;k++){
121
                        REG32(FIR_BASE+FIR_COEFF+(k*4))=hn[k];
122
 
123
                };
124
 
125
 
126
//Writes Q
127
                REG32(FIR_BASE+FIR_Q)=Q;
128
 
129
//Writes kronecker delta
130
                REG32(FIR_BASE+FIR_DATA)=32767;
131
                REG32(FIR_BASE+FIR_CONTROL)=1;//Start
132
                //reads filter output
133
                r_out=REG32(FIR_BASE+FIR_DATA);
134
                int10_to_str(r_out,str,-10);
135
                uart_print_str(str);
136
                uart_putc(' ');
137
                /*Writes zeros*/
138
                for (k=1;k<Nh;k++){
139
                        REG32(FIR_BASE+FIR_DATA)=0;
140
                        REG32(FIR_BASE+FIR_CONTROL)=1;//Start
141
                 //reads filter output
142
                        r_out=REG32(FIR_BASE+FIR_DATA);
143
                        int10_to_str(r_out,str,-10);
144
                        uart_print_str(str);
145
                        uart_putc(' ');
146
                };
147
 
148
 
149
        report(0xdeaddead);
150
        or32_exit(0);
151
}

powered by: WebSVN 2.1.0

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