##// END OF EJS Templates
Matrix C-driver added
martin -
r86:86db8ae19874 martin
parent child
Show More
@@ -0,0 +1,44
1 #------------------------------------------------------------------------------
2 #-- This file is a part of the LPP VHDL IP LIBRARY
3 #-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
6 #-- it under the terms of the GNU General Public License as published by
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
9 #--
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
14 #--
15 #-- You should have received a copy of the GNU General Public License
16 #-- along with this program; if not, write to the Free Software
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #------------------------------------------------------------------------------
19
20 include ../../rules.mk
21 LIBDIR = ../../lib
22 INCPATH = ../../includes
23 SCRIPTDIR=../../scripts/
24 LIBS=-lapb_Matrix_Driver -llpp_apb_functions -lapb_delay_Driver -lapb_fifo_Driver -lapb_uart_Driver -lapb_gpio_Driver
25 INPUTFILE=main.c
26 EXEC=BenchMatrix.bin
27 OUTBINDIR=bin/
28
29
30 .PHONY:bin
31
32 all:bin
33 @echo $(EXEC)" file created"
34
35 clean:
36 rm -f *.{o,a}
37
38
39
40 help:ruleshelp
41 @echo " all : makes an executable file called "$(EXEC)
42 @echo " in "$(OUTBINDIR)
43 @echo " clean : removes temporary files"
44
@@ -0,0 +1,205
1 #include <stdio.h>
2 #include "lpp_apb_functions.h"
3 #include "apb_fifo_Driver.h"
4 #include "apb_Matrix_Driver.h"
5 #include "apb_uart_Driver.h"
6 #include "apb_delay_Driver.h"
7 #include "apb_gpio_Driver.h"
8
9 int main()
10 {
11 int i=0;
12 char temp[256];
13 int TblB1[256] = {0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100};
14 int TblB2[256] = {0x0006,0x0007,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105};
15 int TblB3[256] = {0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A};
16 int TblE1[256] = {0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A,0x010B,0x010C,0x010D,0x010E,0x010F};
17 int TblE2[256] = {0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A,0x010B,0x010C,0x010D,0x010E,0x010F,0x0110,0x0111,0x0112,0x0113,0x0114};
18 int Table[256];
19
20 DELAY_Device* delay0 = openDELAY(0);
21 UART_Device* uart0 = openUART(0);
22 FIFO_Device* fifo0 = openFIFO(0);
23 FIFO_Device* fifo1 = openFIFO(1);
24 static MATRIX_Device* mspec;
25 mspec = openMatrix(0);
26 FIFO_Device* fifoOut = openFIFO(2);
27 GPIO_Device* gpio0 = openGPIO(0);
28
29
30 printf("\nDebut Main\n\n");
31
32 Setup(delay0,30000000);
33 gpio0->oen = 0x3;
34 gpio0->Dout = 0x0;
35
36 mspec->Statu = 2;
37 FillFifo(fifo0,TblB1,256);
38 FillFifo(fifo1,TblB2,256);
39
40 Delay_ms(delay0,10);
41 gpio0->Dout = 0x1;
42 for (i = 0 ; i < 256 ; i++)
43 {
44 Table[i] = fifoOut->rwdata;
45 }
46
47 gpio0->Dout = 0x2;
48 sprintf(temp,"Reels\tImaginaires\n\r");
49 uartputs(uart0,temp);
50 for (i = 0 ; i < 256 ; i+=2)
51 {
52 sprintf(temp,"%d\t%d\n\r",Table[i],Table[i+1]);
53 uartputs(uart0,temp);
54 }
55
56 gpio0->Dout = 0x3;
57
58 printf("\nFin Main\n\n");
59 return 0;
60 }
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107 /*int main()
108 {
109 int i=0;
110 int TblB1[256] = {0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100};
111 int TblB2[256] = {0x0006,0x0007,0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105};
112 int TblB3[256] = {0x000B,0x000C,0x000D,0x000E,0x000F,0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A};
113 int TblE1[256] = {0x0010,0x0011,0x0012,0x0013,0x0014,0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A,0x010B,0x010C,0x010D,0x010E,0x010F};
114 int TblE2[256] = {0x0015,0x0016,0x0017,0x0018,0x0019,0x001A,0x001B,0x001C,0x001D,0x001E,0x001F,0x0020,0x0021,0x0022,0x0023,0x0024,0x0025,0x0026,0x0027,0x0028,0x0029,0x002A,0x002B,0x002C,0x002D,0x002E,0x002F,0x0030,0x0031,0x0032,0x0033,0x0034,0x0035,0x0036,0x0037,0x0038,0x0039,0x003A,0x003B,0x003C,0x003D,0x003E,0x003F,0x0040,0x0041,0x0042,0x0043,0x0044,0x0045,0x0046,0x0047,0x0048,0x0049,0x004A,0x004B,0x004C,0x004D,0x004E,0x004F,0x0050,0x0051,0x0052,0x0053,0x0054,0x0055,0x0056,0x0057,0x0058,0x0059,0x005A,0x005B,0x005C,0x005D,0x005E,0x005F,0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,0x0080,0x0081,0x0082,0x0083,0x0084,0x0085,0x0086,0x0087,0x0088,0x0089,0x008A,0x008B,0x008C,0x008D,0x008E,0x008F,0x0090,0x0091,0x0092,0x0093,0x0094,0x0095,0x0096,0x0097,0x0098,0x0099,0x009A,0x009B,0x009C,0x009D,0x009E,0x009F,0x00A0,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7,0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF,0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7,0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF,0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7,0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF,0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7,0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF,0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7,0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF,0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7,0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF,0x0100,0x0101,0x0102,0x0103,0x0104,0x0105,0x0106,0x0107,0x0108,0x0109,0x010A,0x010B,0x010C,0x010D,0x010E,0x010F,0x0110,0x0111,0x0112,0x0113,0x0114};
115
116
117 printf("\nDebut Main\n\n");
118
119 FIFO_Device* fifoB1 = openFIFO(0);
120 FIFO_Device* fifoB2 = openFIFO(1);
121 FIFO_Device* fifoB3 = openFIFO(2);
122 FIFO_Device* fifoE1 = openFIFO(3);
123 FIFO_Device* fifoE2 = openFIFO(4);
124
125 for (i = 0 ; i < 256 ; i++)
126 {
127 fifoB1->rwdata = TblB1[i];
128 fifoB2->rwdata = TblB2[i];
129 fifoB3->rwdata = TblB3[i];
130 fifoE1->rwdata = TblE1[i];
131 fifoE2->rwdata = TblE2[i];
132 }
133
134 fifoB1->cfgreg = fifoB1->cfgreg | Boucle;
135 fifoB2->cfgreg = fifoB2->cfgreg | Boucle;
136 fifoB3->cfgreg = fifoB3->cfgreg | Boucle;
137 fifoE1->cfgreg = fifoE1->cfgreg | Boucle;
138 fifoE2->cfgreg = fifoE2->cfgreg | Boucle;
139
140 printf("\t*** BouclοΏ½ ***\n\n");
141
142 return 0;
143 }*/
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172 /*
173 while((fifoB1->cfgreg & FIFO_Empty) != FIFO_Empty) // TANT QUE empty a 0 ALORS
174 {
175 while((Mspec0->Cfg & Read) != Read); // TANT QUE read a 0 RIEN
176
177 Mspec0->IN1 = fifoB1->rwdata;
178 Mspec0->IN2 = fifoB1->rwdata;
179 Mspec0->Cfg = 0x1;
180 printf("Input: %x / %x\n",Mspec0->IN1,Mspec0->IN2);
181
182 while((Mspec0->Cfg & Read) != Read); // TANT QUE read a 0 RIEN
183
184 Mspec0->IN1 = fifoB1->rwdata;
185 Mspec0->IN2 = fifoB1->rwdata;
186 Mspec0->Cfg = 0x0;
187 printf("Input: %x / %x\n",Mspec0->IN1,Mspec0->IN2);
188
189 while((Mspec0->Cfg & Valid) != Valid); // TANT QUE valid a 0 RIEN
190
191 //printf("Result: %d\n",Mspec0->RES);
192 Mspec0->Cfg = 0x100;
193 TabResB1B1[i] = Mspec0->RES;
194 i++;
195 printf("Result: %d\n",Mspec0->RES);
196
197 while((Mspec0->Cfg & Valid) != Valid); // TANT QUE valid a 0 RIEN
198
199 //printf("Result: %d\n",Mspec0->RES);
200 Mspec0->Cfg = 0x000;
201 TabResB1B1[i] = Mspec0->RES;
202 i++;
203 printf("Result: %d\n",Mspec0->RES);
204 }
205 */
@@ -0,0 +1,64
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_MATRIX_DRIVER_H
23 #define APB_MATRIX_DRIVER_H
24
25 /*! \file apb_Matrix_Driver.h
26 \brief LPP MATRIX driver.
27
28 This library is written to work with LPP_APB_MATRIX VHDL module from LPP's FreeVHDLIB.
29
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
32
33
34 /*===================================================
35 T Y P E S D E F
36 ====================================================*/
37 /*! \struct APB_MATRIX_REG
38 \brief Sturcture representing the Matrix registers
39 */
40 struct APB_MATRIX_REG
41 {
42 int Statu; /**< \brief Statu register, To know wich matrix calcul is doing */
43 };
44
45 typedef volatile struct APB_MATRIX_REG MATRIX_Device;
46
47 /*===================================================
48 F U N C T I O N S
49 ====================================================*/
50 /*! \fn MATRIX_Device* openMatrix(int count);
51 \brief Return count Matrix.
52
53 This Function scans APB devices table and returns count Matrix.
54
55 \param count The number of the Matrix you whant to get. For example if you have 3 Matrixs on your SOC you want
56 to use Matrix0 so count = 0.
57 \return The pointer to the device.
58 */
59 MATRIX_Device* openMatrix(int count);
60
61
62
63
64 #endif
@@ -0,0 +1,25
1 #------------------------------------------------------------------------------
2 #-- This file is a part of the LPP VHDL IP LIBRARY
3 #-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
6 #-- it under the terms of the GNU General Public License as published by
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
9 #--
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
14 #--
15 #-- You should have received a copy of the GNU General Public License
16 #-- along with this program; if not, write to the Free Software
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #------------------------------------------------------------------------------
19 FILE = apb_Matrix_Driver
20 LIB = liblpp_Matrix_Driver.a
21
22 include ../../rules.mk
23
24 all: $(FILE).a
25 @echo $(FILE)".a created"
@@ -0,0 +1,35
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
22 #include "lpp_apb_functions.h"
23 #include "apb_Matrix_Driver.h"
24 #include <stdio.h>
25
26
27 MATRIX_Device* openMatrix(int count)
28 {
29 MATRIX_Device* Mspec0;
30 Mspec0 = (MATRIX_Device*) apbgetdevice(LPP_MATRIX,VENDOR_LPP,count);
31 return Mspec0;
32 }
33
34
35
@@ -0,0 +1,64
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_MATRIX_DRIVER_H
23 #define APB_MATRIX_DRIVER_H
24
25 /*! \file apb_Matrix_Driver.h
26 \brief LPP MATRIX driver.
27
28 This library is written to work with LPP_APB_MATRIX VHDL module from LPP's FreeVHDLIB.
29
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
32
33
34 /*===================================================
35 T Y P E S D E F
36 ====================================================*/
37 /*! \struct APB_MATRIX_REG
38 \brief Sturcture representing the Matrix registers
39 */
40 struct APB_MATRIX_REG
41 {
42 int Statu; /**< \brief Statu register, To know wich matrix calcul is doing */
43 };
44
45 typedef volatile struct APB_MATRIX_REG MATRIX_Device;
46
47 /*===================================================
48 F U N C T I O N S
49 ====================================================*/
50 /*! \fn MATRIX_Device* openMatrix(int count);
51 \brief Return count Matrix.
52
53 This Function scans APB devices table and returns count Matrix.
54
55 \param count The number of the Matrix you whant to get. For example if you have 3 Matrixs on your SOC you want
56 to use Matrix0 so count = 0.
57 \return The pointer to the device.
58 */
59 MATRIX_Device* openMatrix(int count);
60
61
62
63
64 #endif
@@ -1,33 +1,33
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 #include "stdio.h"
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 #include "stdio.h"
20 20 #include "lpp_apb_functions.h"
21 #include "apb_fifo_Driver.h"
22
23
24
25 int main()
26 {
21 #include "apb_fifo_Driver.h"
22
23
24
25 int main()
26 {
27 27 int d=0;
28 28 int i=0;
29 APB_FIFO_Device* FIFO0;
30 FIFO0 = apbfifoOpen(0);
29 FIFO_Device* FIFO0;
30 FIFO0 = openFIFO(0);
31 31
32 32 for(i=0;i<1024;i++)
33 33 {
@@ -37,8 +37,8 int main()
37 37 for(i=0;i<1024;i++)
38 38 {
39 39 printf("%x",FIFO0->rwdata);
40 }
40 }
41
41 42
42
43 return 0;
44 }
43 return 0;
44 }
@@ -26,4 +26,5 all:
26 26 make all -C BenchUART
27 27 make all -C BenchFFT
28 28 make all -C BenchGPIO
29 make all -C BenchMatrix
29 30
@@ -38,7 +38,7 struct DAC_Driver
38 38 int dataReg; /**< Registre de donnοΏ½e sur 16 bits */
39 39 };
40 40
41 typedef struct DAC_Driver DAC_Device;
41 typedef volatile struct DAC_Driver DAC_Device;
42 42
43 43 /*===================================================
44 44 F U N C T I O N S
@@ -19,21 +19,33
19 19 -- Author : Martin Morlot
20 20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
22 #ifndef APB_DELAY_DRIVER_H
23 #define APB_DELAY_DRIVER_H
24 24
25 /*! \file apb_delay_Driver.h
26 \brief LPP Interupt driver.
27
28 This library is written to work with LPP_APB_DELAY VHDL module from LPP's FreeVHDLIB.
25 29
26 #define Delay_End 0x111
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
32
33 #define Delay_End 0x00001000 /**< Used to know when the VHDL delay counter stoped counting */
27 34
28 35 /*===================================================
29 36 T Y P E S D E F
30 37 ====================================================*/
31
38 /*! \struct DELAY_REG
39 \brief Sturcture representing the Delay registers
40 */
32 41 struct DELAY_REG
33 42 {
34 int Cfg;
35 int Fboard;
36 int Timer;
43 int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0]
44 Start Flag [HEX 1]
45 End Flag Received [HEX 2]
46 End Flag [HEX 3] */
47 int Fboard; /**< \brief Board Frequency register */
48 int Timer; /**< \brief Delay duration register */
37 49 };
38 50
39 51 typedef volatile struct DELAY_REG DELAY_Device;
@@ -41,12 +53,61 typedef volatile struct DELAY_REG DELAY_
41 53 /*===================================================
42 54 F U N C T I O N S
43 55 ====================================================*/
56 /*! \fn DELAY_Device* openDELAY(int count);
57 \brief Return count Delay.
58
59 This Function scans APB devices table and returns count Delay.
60
61 \param count The number of the Delay you whant to get. For example if you have 3 Delays on your SOC you want
62 to use Delay1 so count = 1.
63 \return The pointer to the device.
64 */
65 DELAY_Device* openDELAY(int count);
44 66
45 DELAY_Device* openDELAY(int count);
67 /*! \fn int Setup(DELAY_Device* dev,int X);
68 \brief Setup the device
69
70 This function setup the device, reset and Board frequency.
71
72 \param dev The Delay pointer.
73 \param X the Board frequency.
74 */
75 int Setup(DELAY_Device* dev,int X);
76
77 /*! \fn int Delay_us(DELAY_Device* dev,int T);
78 \brief Generate delay
79
80 This function genrate a delay in microsecond.
81
82 \param dev The Delay pointer.
83 \param T the Delay duration in us.
84 */
46 85 int Delay_us(DELAY_Device* dev,int T);
86
87 /*! \fn int Delay_ms(DELAY_Device* dev,int T);
88 \brief Generate delay
89
90 This function genrate a delay in milisecond.
91
92 \param dev The Delay pointer.
93 \param T the Delay duration in ms.
94 */
47 95 int Delay_ms(DELAY_Device* dev,int T);
96
97 /*! \fn int Delay_s(DELAY_Device* dev,int T);
98 \brief Generate delay
99
100 This function genrate a delay in second.
101
102 \param dev The Delay pointer.
103 \param T the Delay duration in s.
104 */
48 105 int Delay_s(DELAY_Device* dev,int T);
49 int Setup(DELAY_Device* dev,int X);
106
107
108
109
110
50 111
51 112
52 113 #endif
@@ -28,7 +28,6
28 28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
29 29 from an input data table.
30 30
31 \todo Check "DEVICE1 => count = 2" function Open
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
34 33
@@ -56,7 +55,7 struct FFT_Driver
56 55 int WriteAddrReg; /**< \brief Address register for the writing operation */
57 56 };
58 57
59 typedef struct FFT_Driver FFT_Device;
58 typedef volatile struct FFT_Driver FFT_Device;
60 59
61 60
62 61 /*===================================================
@@ -68,7 +67,7 typedef struct FFT_Driver FFT_Device;
68 67 This Function scans APB devices table and returns count FFT.
69 68
70 69 \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want
71 to use FFT1 so count = 2.
70 to use FFT1 so count = 1.
72 71 \return The pointer to the device.
73 72 */
74 73 FFT_Device* openFFT(int count);
@@ -28,9 +28,12
28 28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
29 29 used in many type of application.
30 30
31 \todo Check "DEVICE1 => count = 2" function Open
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
33 #define FIFO_Empty 0x00000100 /**< Show that the FIFO is Empty */
34 #define FIFO_Full 0x00001000 /**< Show that the FIFO is Full */
35 #define Boucle 0x00110000 /**< Configuration for reused the same value of the FIFO */
36 #define NoBoucle 0xFFEEFFFF /**< Unlock the previous configuration */
34 37
35 38
36 39 /*===================================================
@@ -48,13 +51,15 struct APB_FIFO_REG
48 51 Write enable Flag [HEX 1]
49 52 Empty Flag [HEX 2]
50 53 Full Flag [HEX 3]
51 Dummy "C" [HEX 4/5/6/7] */
54 ReUse Flag [HEX 4]
55 Lock Flag [HEX 5]
56 Dummy "C" [HEX 6/7] */
52 57 int dummy0; /**< \brief Unused register, aesthetic interest */
53 58 int dummy1; /**< \brief Unused register, aesthetic interest */
54 59 int waddr; /**< \brief Address register for the writing operation */
55 60 };
56 61
57 typedef struct APB_FIFO_REG APB_FIFO_Device;
62 typedef volatile struct APB_FIFO_REG FIFO_Device;
58 63
59 64 /*===================================================
60 65 F U N C T I O N S
@@ -66,11 +71,20 typedef struct APB_FIFO_REG APB_FIFO_Dev
66 71 This Function scans APB devices table and returns count FIFO.
67 72
68 73 \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want
69 to use FIFO1 so count = 2.
74 to use FIFO1 so count = 1.
70 75 \return The pointer to the device.
71 76 */
72 APB_FIFO_Device* apbfifoOpen(int count);
77 FIFO_Device* openFIFO(int count);
73 78
74
79 /*! \fn int FillFifo(FIFO_Device* dev,int Tbl[],int A);
80 \brief a Fill in FIFO function.
81
82 This Function fill in the FIFO with a table data.
83
84 \param dev The FFT pointer.
85 \param Tbl[] The data table.
86 \param A The data table size.
87 */
88 int FillFifo(FIFO_Device* dev,int Tbl[],int A);
75 89
76 90 #endif
@@ -22,24 +22,41
22 22 #ifndef APB_GPIO_DRIVER_H
23 23 #define APB_GPIO_DRIVER_H
24 24
25 /*! \file apb_gpio_Driver.h
26 \brief Gaisler GPIO driver.
27
28 This library is written to work with Gaisler GPIO VHDL module.
29
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
25 32
26 33 /*===================================================
27 34 T Y P E S D E F
28 35 ====================================================*/
29
36 /*! \struct GPIO_REG
37 \brief Sturcture representing the gpio registers
38 */
30 39 struct GPIO_REG
31 40 {
32 int Din;
33 int Dout;
34 int oen;
41 int Din; /**< \brief Input GPIO register */
42 int Dout; /**< \brief Output GPIO register */
43 int oen; /**< \brief Enable GPIO register */
35 44 };
36 45
37 typedef struct GPIO_REG GPIO_Device;
46 typedef volatile struct GPIO_REG GPIO_Device;
38 47
39 48 /*===================================================
40 49 F U N C T I O N S
41 50 ====================================================*/
42
51 /*! \fn GPIO_Device* openGPIO(int count);
52 \brief Return count GPIO.
53
54 This Function scans APB devices table and returns count GPIO.
55
56 \param count The number of the GPIO you whant to get. For example if you have 3 GPIOs on your SOC you want
57 to use GPIO1 so count = 1.
58 \return The pointer to the device.
59 */
43 60 GPIO_Device* openGPIO(int count);
44 61
45 62
@@ -26,9 +26,8
26 26 \brief LPP Uart driver.
27 27
28 28 This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get,
29 char or strings over uart.
30
31 \todo Check "DEVICE1 => count = 2" function Open
29 char or strings over uart.
30
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
34 33
@@ -56,7 +55,7 struct UART_Driver
56 55 int DataRReg; /**< \brief Data Read register */
57 56 };
58 57
59 typedef struct UART_Driver UART_Device;
58 typedef volatile struct UART_Driver UART_Device;
60 59
61 60
62 61 /*===================================================
@@ -69,7 +68,7 typedef struct UART_Driver UART_Device;
69 68 This Function scans APB devices table and returns count UART.
70 69
71 70 \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want
72 to use UART1 so count = 2.
71 to use UART1 so count = 1.
73 72 \return The pointer to the device.
74 73 */
75 74 UART_Device* openUART(int count);
@@ -38,7 +38,7 struct DAC_Driver
38 38 int dataReg; /**< Registre de donnοΏ½e sur 16 bits */
39 39 };
40 40
41 typedef struct DAC_Driver DAC_Device;
41 typedef volatile struct DAC_Driver DAC_Device;
42 42
43 43 /*===================================================
44 44 F U N C T I O N S
@@ -34,6 +34,7 DELAY_Device* openDELAY(int count)
34 34 int Setup(DELAY_Device* dev,int X)
35 35 {
36 36 dev->Fboard = X;
37 dev->Cfg = 0x001;
37 38 return dev->Fboard;
38 39 }
39 40
@@ -41,9 +42,9 int Setup(DELAY_Device* dev,int X)
41 42 int Delay_s(DELAY_Device* dev,int T)
42 43 {
43 44 dev->Timer = dev->Fboard * T;
44 dev->Cfg = 0x11;
45 while(dev->Cfg != Delay_End);
46 dev->Cfg = 0x01;
45 dev->Cfg = 0x011;
46 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
47 dev->Cfg = 0x101;
47 48 return dev->Cfg;
48 49 }
49 50
@@ -51,9 +52,9 int Delay_s(DELAY_Device* dev,int T)
51 52 int Delay_ms(DELAY_Device* dev,int T)
52 53 {
53 54 dev->Timer = (dev->Fboard / 1000) * T;
54 dev->Cfg = 0x11;
55 while(dev->Cfg != Delay_End);
56 dev->Cfg = 0x01;
55 dev->Cfg = 0x011;
56 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
57 dev->Cfg = 0x101;
57 58 return dev->Cfg;
58 59 }
59 60
@@ -61,9 +62,9 int Delay_ms(DELAY_Device* dev,int T)
61 62 int Delay_us(DELAY_Device* dev,int T)
62 63 {
63 64 dev->Timer = (dev->Fboard / 1000000) * T;
64 dev->Cfg = 0x11;
65 while(dev->Cfg != Delay_End);
66 dev->Cfg = 0x01;
65 dev->Cfg = 0x011;
66 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
67 dev->Cfg = 0x101;
67 68 return dev->Cfg;
68 69 }
69 70
@@ -19,21 +19,33
19 19 -- Author : Martin Morlot
20 20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
22 #ifndef APB_DELAY_DRIVER_H
23 #define APB_DELAY_DRIVER_H
24 24
25 /*! \file apb_delay_Driver.h
26 \brief LPP Interupt driver.
27
28 This library is written to work with LPP_APB_DELAY VHDL module from LPP's FreeVHDLIB.
25 29
26 #define Delay_End 0x111
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
32
33 #define Delay_End 0x00001000 /**< Used to know when the VHDL delay counter stoped counting */
27 34
28 35 /*===================================================
29 36 T Y P E S D E F
30 37 ====================================================*/
31
38 /*! \struct DELAY_REG
39 \brief Sturcture representing the Delay registers
40 */
32 41 struct DELAY_REG
33 42 {
34 int Cfg;
35 int Fboard;
36 int Timer;
43 int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0]
44 Start Flag [HEX 1]
45 End Flag Received [HEX 2]
46 End Flag [HEX 3] */
47 int Fboard; /**< \brief Board Frequency register */
48 int Timer; /**< \brief Delay duration register */
37 49 };
38 50
39 51 typedef volatile struct DELAY_REG DELAY_Device;
@@ -41,12 +53,61 typedef volatile struct DELAY_REG DELAY_
41 53 /*===================================================
42 54 F U N C T I O N S
43 55 ====================================================*/
56 /*! \fn DELAY_Device* openDELAY(int count);
57 \brief Return count Delay.
58
59 This Function scans APB devices table and returns count Delay.
60
61 \param count The number of the Delay you whant to get. For example if you have 3 Delays on your SOC you want
62 to use Delay1 so count = 1.
63 \return The pointer to the device.
64 */
65 DELAY_Device* openDELAY(int count);
44 66
45 DELAY_Device* openDELAY(int count);
67 /*! \fn int Setup(DELAY_Device* dev,int X);
68 \brief Setup the device
69
70 This function setup the device, reset and Board frequency.
71
72 \param dev The Delay pointer.
73 \param X the Board frequency.
74 */
75 int Setup(DELAY_Device* dev,int X);
76
77 /*! \fn int Delay_us(DELAY_Device* dev,int T);
78 \brief Generate delay
79
80 This function genrate a delay in microsecond.
81
82 \param dev The Delay pointer.
83 \param T the Delay duration in us.
84 */
46 85 int Delay_us(DELAY_Device* dev,int T);
86
87 /*! \fn int Delay_ms(DELAY_Device* dev,int T);
88 \brief Generate delay
89
90 This function genrate a delay in milisecond.
91
92 \param dev The Delay pointer.
93 \param T the Delay duration in ms.
94 */
47 95 int Delay_ms(DELAY_Device* dev,int T);
96
97 /*! \fn int Delay_s(DELAY_Device* dev,int T);
98 \brief Generate delay
99
100 This function genrate a delay in second.
101
102 \param dev The Delay pointer.
103 \param T the Delay duration in s.
104 */
48 105 int Delay_s(DELAY_Device* dev,int T);
49 int Setup(DELAY_Device* dev,int X);
106
107
108
109
110
50 111
51 112
52 113 #endif
@@ -28,7 +28,6
28 28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
29 29 from an input data table.
30 30
31 \todo Check "DEVICE1 => count = 2" function Open
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
34 33
@@ -56,7 +55,7 struct FFT_Driver
56 55 int WriteAddrReg; /**< \brief Address register for the writing operation */
57 56 };
58 57
59 typedef struct FFT_Driver FFT_Device;
58 typedef volatile struct FFT_Driver FFT_Device;
60 59
61 60
62 61 /*===================================================
@@ -68,7 +67,7 typedef struct FFT_Driver FFT_Device;
68 67 This Function scans APB devices table and returns count FFT.
69 68
70 69 \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want
71 to use FFT1 so count = 2.
70 to use FFT1 so count = 1.
72 71 \return The pointer to the device.
73 72 */
74 73 FFT_Device* openFFT(int count);
@@ -24,12 +24,22
24 24 #include <stdio.h>
25 25
26 26
27 APB_FIFO_Device* apbfifoOpen(int count)
27 FIFO_Device* openFIFO(int count)
28 28 {
29 APB_FIFO_Device* fifo0;
30 fifo0 = (APB_FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count);
29 FIFO_Device* fifo0;
30 fifo0 = (FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count);
31 31 return fifo0;
32 32 }
33 33
34
35
34
35 int FillFifo(FIFO_Device* dev,int Tbl[],int A)
36 {
37 int i=0;
38 while(i <= A)
39 {
40 dev->rwdata = Tbl[i];
41 i++;
42 }
43
44 return 0;
45 }
@@ -28,9 +28,12
28 28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
29 29 used in many type of application.
30 30
31 \todo Check "DEVICE1 => count = 2" function Open
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
33 #define FIFO_Empty 0x00000100 /**< Show that the FIFO is Empty */
34 #define FIFO_Full 0x00001000 /**< Show that the FIFO is Full */
35 #define Boucle 0x00110000 /**< Configuration for reused the same value of the FIFO */
36 #define NoBoucle 0xFFEEFFFF /**< Unlock the previous configuration */
34 37
35 38
36 39 /*===================================================
@@ -48,13 +51,15 struct APB_FIFO_REG
48 51 Write enable Flag [HEX 1]
49 52 Empty Flag [HEX 2]
50 53 Full Flag [HEX 3]
51 Dummy "C" [HEX 4/5/6/7] */
54 ReUse Flag [HEX 4]
55 Lock Flag [HEX 5]
56 Dummy "C" [HEX 6/7] */
52 57 int dummy0; /**< \brief Unused register, aesthetic interest */
53 58 int dummy1; /**< \brief Unused register, aesthetic interest */
54 59 int waddr; /**< \brief Address register for the writing operation */
55 60 };
56 61
57 typedef struct APB_FIFO_REG APB_FIFO_Device;
62 typedef volatile struct APB_FIFO_REG FIFO_Device;
58 63
59 64 /*===================================================
60 65 F U N C T I O N S
@@ -66,11 +71,20 typedef struct APB_FIFO_REG APB_FIFO_Dev
66 71 This Function scans APB devices table and returns count FIFO.
67 72
68 73 \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want
69 to use FIFO1 so count = 2.
74 to use FIFO1 so count = 1.
70 75 \return The pointer to the device.
71 76 */
72 APB_FIFO_Device* apbfifoOpen(int count);
77 FIFO_Device* openFIFO(int count);
73 78
74
79 /*! \fn int FillFifo(FIFO_Device* dev,int Tbl[],int A);
80 \brief a Fill in FIFO function.
81
82 This Function fill in the FIFO with a table data.
83
84 \param dev The FFT pointer.
85 \param Tbl[] The data table.
86 \param A The data table size.
87 */
88 int FillFifo(FIFO_Device* dev,int Tbl[],int A);
75 89
76 90 #endif
@@ -22,24 +22,41
22 22 #ifndef APB_GPIO_DRIVER_H
23 23 #define APB_GPIO_DRIVER_H
24 24
25 /*! \file apb_gpio_Driver.h
26 \brief Gaisler GPIO driver.
27
28 This library is written to work with Gaisler GPIO VHDL module.
29
30 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 */
25 32
26 33 /*===================================================
27 34 T Y P E S D E F
28 35 ====================================================*/
29
36 /*! \struct GPIO_REG
37 \brief Sturcture representing the gpio registers
38 */
30 39 struct GPIO_REG
31 40 {
32 int Din;
33 int Dout;
34 int oen;
41 int Din; /**< \brief Input GPIO register */
42 int Dout; /**< \brief Output GPIO register */
43 int oen; /**< \brief Enable GPIO register */
35 44 };
36 45
37 typedef struct GPIO_REG GPIO_Device;
46 typedef volatile struct GPIO_REG GPIO_Device;
38 47
39 48 /*===================================================
40 49 F U N C T I O N S
41 50 ====================================================*/
42
51 /*! \fn GPIO_Device* openGPIO(int count);
52 \brief Return count GPIO.
53
54 This Function scans APB devices table and returns count GPIO.
55
56 \param count The number of the GPIO you whant to get. For example if you have 3 GPIOs on your SOC you want
57 to use GPIO1 so count = 1.
58 \return The pointer to the device.
59 */
43 60 GPIO_Device* openGPIO(int count);
44 61
45 62
@@ -30,6 +30,7 all:
30 30 make all -C FFT
31 31 make all -C DELAY
32 32 make all -C GPIO
33 make all -C MATRIX
33 34
34 35
35 36 cleanall:
@@ -41,4 +42,5 cleanall:
41 42 make clean -C FFT
42 43 make clean -C DELAY
43 44 make clean -C GPIO
45 make clean -C MATRIX
44 46
@@ -26,9 +26,8
26 26 \brief LPP Uart driver.
27 27
28 28 This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get,
29 char or strings over uart.
30
31 \todo Check "DEVICE1 => count = 2" function Open
29 char or strings over uart.
30
32 31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 32 */
34 33
@@ -56,7 +55,7 struct UART_Driver
56 55 int DataRReg; /**< \brief Data Read register */
57 56 };
58 57
59 typedef struct UART_Driver UART_Device;
58 typedef volatile struct UART_Driver UART_Device;
60 59
61 60
62 61 /*===================================================
@@ -69,7 +68,7 typedef struct UART_Driver UART_Device;
69 68 This Function scans APB devices table and returns count UART.
70 69
71 70 \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want
72 to use UART1 so count = 2.
71 to use UART1 so count = 1.
73 72 \return The pointer to the device.
74 73 */
75 74 UART_Device* openUART(int count);
@@ -57,7 +57,7 constant pconfig : apb_config_type := (
57 57 1 => apb_iobar(paddr, pmask));
58 58
59 59 type DELAY_ctrlr_Reg is record
60 Delay_CFG : std_logic_vector(2 downto 0);
60 Delay_CFG : std_logic_vector(3 downto 0);
61 61 Delay_FreqBoard : std_logic_vector(25 downto 0);
62 62 Delay_Timer : std_logic_vector(25 downto 0);
63 63 end record;
@@ -67,25 +67,28 signal Rdata : std_logic_vector(31 downt
67 67
68 68 signal Flag_st : std_logic;
69 69 signal Flag_end : std_logic;
70 signal Flag_OKend : std_logic;
70 71 signal Rz : std_logic;
71 72 signal Raz : std_logic;
72 73
73 74 begin
74 75
75 76 Flag_st <= Rec.Delay_CFG(1);
76 Rec.Delay_CFG(2) <= Flag_end;
77 Rec.Delay_CFG(3) <= Flag_end;
77 78 Rz <= Rec.Delay_CFG(0);
79 Flag_OKend <= Rec.Delay_CFG(2);
78 80
79 81 Raz <= rst and Rz;
80 82
81 83 Delay0 : TimerDelay
82 port map(clk,Raz,Flag_st,Flag_end,Rec.Delay_Timer);
84 port map(clk,Raz,Flag_st,Flag_OKend,Flag_end,Rec.Delay_Timer);
83 85
84 86 process(rst,clk)
85 87 begin
86 88 if(rst='0')then
87 89 Rec.Delay_FreqBoard <= (others => '0');
88 90 Rec.Delay_Timer <= (others => '0');
91 Rec.Delay_CFG(2 downto 0) <= (others => '0');
89 92
90 93 elsif(clk'event and clk='1')then
91 94
@@ -95,8 +98,9 Delay0 : TimerDelay
95 98 when "000000" =>
96 99 Rec.Delay_CFG(0) <= apbi.pwdata(0);
97 100 Rec.Delay_CFG(1) <= apbi.pwdata(4);
101 Rec.Delay_CFG(2) <= apbi.pwdata(8);
98 102 when "000001" =>
99 Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0);
103 Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0);
100 104 when "000010" =>
101 105 Rec.Delay_Timer <= apbi.pwdata(25 downto 0);
102 106 when others =>
@@ -104,11 +108,12 Delay0 : TimerDelay
104 108 end case;
105 109 end if;
106 110
107 --APB READ OP
111 --APB Read OP
108 112 if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then
109 113 case apbi.paddr(abits-1 downto 2) is
110 114 when "000000" =>
111 Rdata(31 downto 12) <= (others => '0');
115 Rdata(31 downto 16) <= (others => '0');
116 Rdata(15 downto 12) <= "000" & Rec.Delay_CFG(3);
112 117 Rdata(11 downto 8) <= "000" & Rec.Delay_CFG(2);
113 118 Rdata(7 downto 4) <= "000" & Rec.Delay_CFG(1);
114 119 Rdata(3 downto 0) <= "000" & Rec.Delay_CFG(0);
@@ -8,6 +8,7 port(
8 8 clk : in std_logic;
9 9 raz : in std_logic;
10 10 Start : in std_logic;
11 OKfin : in std_logic;
11 12 Fin : out std_logic;
12 13 Cpt : in std_logic_vector(25 downto 0)
13 14 );
@@ -16,14 +17,14 end TimerDelay;
16 17
17 18 architecture ar_TimerDelay of TimerDelay is
18 19
19 type state is (stX,st1);
20 type state is (stX,st1,st2);
20 21 signal ect : state;
21 22
22 23 constant MAX : integer := 67_108_863;
23 24
24 25 signal delay : integer range 0 to MAX;
25 26 signal compt : integer range 0 to MAX;
26 signal Start_reg : std_logic;
27 --signal Start_reg : std_logic;
27 28
28 29
29 30 begin
@@ -35,31 +36,37 delay <= to_integer(unsigned(Cpt));
35 36
36 37 if(raz='0')then
37 38 Fin <= '1';
38 Start_reg <= '0';
39 --Start_reg <= '0';
39 40 ect <= stX;
40 41
41 42 elsif(clk'event and clk='1')then
42 Start_reg <= Start;
43 --Start_reg <= Start;
43 44
44 45 case ect is
45 46
46 when stX =>
47 if(Start_reg = '0' and Start = '1')then
48 Fin <= '0';
47 when stX =>
48 if(Start = '1')then
49 --OKst <= '1';
49 50 ect <= st1;
50 51 end if;
51
52 52
53 53 when st1 =>
54 54 if(compt = delay)then
55 55 compt <= 0;
56 --OKst <= '0';
56 57 Fin <= '1';
57 ect <= stX;
58 ect <= st2;
58 59 else
59 60 compt <= compt + 1;
60 61 ect <= st1;
61 end if;
62 end if;
62 63
64 when st2 =>
65 if(OKfin = '1')then
66 Fin <= '0';
67 ect <= stX;
68 end if;
69
63 70 end case;
64 71 end if;
65 72 end process;
@@ -50,9 +50,10 component TimerDelay is
50 50 port(
51 51 clk : in std_logic;
52 52 raz : in std_logic;
53 Start : in std_logic;
54 Fin : out std_logic;
55 Cpt : in std_logic_vector(25 downto 0)
53 Start : in std_logic;
54 OKfin : in std_logic;
55 Fin : out std_logic;
56 Cpt : in std_logic_vector(25 downto 0)
56 57 );
57 58 end component;
58 59
General Comments 0
You need to be logged in to leave comments. Login now