##// 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,44 +1,44
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
18 -------------------------------------------------------------------------------*/
19 #include "stdio.h"
19 #include "stdio.h"
20 #include "lpp_apb_functions.h"
20 #include "lpp_apb_functions.h"
21 #include "apb_fifo_Driver.h"
21 #include "apb_fifo_Driver.h"
22
22
23
23
24
24
25 int main()
25 int main()
26 {
26 {
27 int d=0;
27 int d=0;
28 int i=0;
28 int i=0;
29 APB_FIFO_Device* FIFO0;
29 FIFO_Device* FIFO0;
30 FIFO0 = apbfifoOpen(0);
30 FIFO0 = openFIFO(0);
31
31
32 for(i=0;i<1024;i++)
32 for(i=0;i<1024;i++)
33 {
33 {
34 FIFO0->rwdata = i;
34 FIFO0->rwdata = i;
35 }
35 }
36
36
37 for(i=0;i<1024;i++)
37 for(i=0;i<1024;i++)
38 {
38 {
39 printf("%x",FIFO0->rwdata);
39 printf("%x",FIFO0->rwdata);
40 }
40 }
41
41
42
42
43 return 0;
43 return 0;
44 }
44 }
@@ -1,29 +1,30
1 #------------------------------------------------------------------------------
1 #------------------------------------------------------------------------------
2 #-- This file is a part of the LPP VHDL IP LIBRARY
2 #-- This file is a part of the LPP VHDL IP LIBRARY
3 #-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
3 #-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
4 #--
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
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
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
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
8 #-- (at your option) any later version.
9 #--
9 #--
10 #-- This program is distributed in the hope that it will be useful,
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
13 #-- GNU General Public License for more details.
14 #--
14 #--
15 #-- You should have received a copy of the GNU General Public License
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
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
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #------------------------------------------------------------------------------
18 #------------------------------------------------------------------------------
19
19
20
20
21
21
22 all:
22 all:
23 make all -C ScanAPB
23 make all -C ScanAPB
24 make all -C APB_lcd_ctrlr
24 make all -C APB_lcd_ctrlr
25 make all -C BenchFIFO
25 make all -C BenchFIFO
26 make all -C BenchUART
26 make all -C BenchUART
27 make all -C BenchFFT
27 make all -C BenchFFT
28 make all -C BenchGPIO
28 make all -C BenchGPIO
29 make all -C BenchMatrix
29
30
@@ -1,60 +1,60
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_CNA_DRIVER_H
22 #ifndef APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
24
24
25 #define DAC_ready 3
25 #define DAC_ready 3
26 #define DAC_enable 1
26 #define DAC_enable 1
27 #define DAC_disable 0
27 #define DAC_disable 0
28
28
29
29
30 /*===================================================
30 /*===================================================
31 T Y P E S D E F
31 T Y P E S D E F
32 ====================================================*/
32 ====================================================*/
33
33
34 /** Structure repr�sentant le registre du CNA */
34 /** Structure repr�sentant le registre du CNA */
35 struct DAC_Driver
35 struct DAC_Driver
36 {
36 {
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
38 int dataReg; /**< Registre de donn�e sur 16 bits */
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 F U N C T I O N S
44 F U N C T I O N S
45 ====================================================*/
45 ====================================================*/
46
46
47 /** Ouvre l'acc� au CNA */
47 /** Ouvre l'acc� au CNA */
48 DAC_Device* DacOpen(int count);
48 DAC_Device* DacOpen(int count);
49
49
50 //DAC_Device* DacClose(int count);
50 //DAC_Device* DacClose(int count);
51
51
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
53 int DacTable();
53 int DacTable();
54
54
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
56 int DacConst();
56 int DacConst();
57
57
58
58
59
59
60 #endif
60 #endif
@@ -1,52 +1,113
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
22 #ifndef APB_DELAY_DRIVER_H
23 #define APB_FIFO_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 T Y P E S D E F
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 struct DELAY_REG
41 struct DELAY_REG
33 {
42 {
34 int Cfg;
43 int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0]
35 int Fboard;
44 Start Flag [HEX 1]
36 int Timer;
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 typedef volatile struct DELAY_REG DELAY_Device;
51 typedef volatile struct DELAY_REG DELAY_Device;
40
52
41 /*===================================================
53 /*===================================================
42 F U N C T I O N S
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 int Delay_us(DELAY_Device* dev,int T);
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 int Delay_ms(DELAY_Device* dev,int T);
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 int Delay_s(DELAY_Device* dev,int T);
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 #endif
113 #endif
@@ -1,98 +1,97
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FFT_DRIVER_H
22 #ifndef APB_FFT_DRIVER_H
23 #define APB_FFT_DRIVER_H
23 #define APB_FFT_DRIVER_H
24
24
25 /*! \file apb_fft_Driver.h
25 /*! \file apb_fft_Driver.h
26 \brief LPP FFT driver.
26 \brief LPP FFT driver.
27
27
28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
29 from an input data table.
29 from an input data table.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 */
32 */
34
33
35 #define FFT_Empty 0x00100 /**< Used to know when the data can be send to the FFT module */
34 #define FFT_Empty 0x00100 /**< Used to know when the data can be send to the FFT module */
36 #define FFT_Full 0x01000 /**< Used to know when the data can be send to the FFT module */
35 #define FFT_Full 0x01000 /**< Used to know when the data can be send to the FFT module */
37
36
38
37
39 /*===================================================
38 /*===================================================
40 T Y P E S D E F
39 T Y P E S D E F
41 ====================================================*/
40 ====================================================*/
42 /*! \struct FFT_Driver
41 /*! \struct FFT_Driver
43 \brief Sturcture representing the fft registers
42 \brief Sturcture representing the fft registers
44 */
43 */
45 struct FFT_Driver
44 struct FFT_Driver
46 {
45 {
47 int RWDataReg; /**< \brief Data register Write/Read */
46 int RWDataReg; /**< \brief Data register Write/Read */
48 int ReadAddrReg; /**< \brief Address register for the reading operation */
47 int ReadAddrReg; /**< \brief Address register for the reading operation */
49 int ConfigReg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
48 int ConfigReg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
50 Write enable Flag [HEX 1]
49 Write enable Flag [HEX 1]
51 Empty Flag [HEX 2]
50 Empty Flag [HEX 2]
52 Full Flag [HEX 3]
51 Full Flag [HEX 3]
53 Dummy "C" [HEX 4/5/6/7] */
52 Dummy "C" [HEX 4/5/6/7] */
54 int Dummy1; /**< \brief Unused register, aesthetic interest */
53 int Dummy1; /**< \brief Unused register, aesthetic interest */
55 int Dummy0; /**< \brief Unused register, aesthetic interest */
54 int Dummy0; /**< \brief Unused register, aesthetic interest */
56 int WriteAddrReg; /**< \brief Address register for the writing operation */
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 /*===================================================
63 F U N C T I O N S
62 F U N C T I O N S
64 ====================================================*/
63 ====================================================*/
65 /*! \fn FFT_Device* openFFT(int count);
64 /*! \fn FFT_Device* openFFT(int count);
66 \brief Return count FFT.
65 \brief Return count FFT.
67
66
68 This Function scans APB devices table and returns count FFT.
67 This Function scans APB devices table and returns count FFT.
69
68
70 \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want
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 \return The pointer to the device.
71 \return The pointer to the device.
73 */
72 */
74 FFT_Device* openFFT(int count);
73 FFT_Device* openFFT(int count);
75
74
76 /*! \fn int FftInput(int Tbl[],FFT_Device*);
75 /*! \fn int FftInput(int Tbl[],FFT_Device*);
77 \brief Fill in the Input for the FFT
76 \brief Fill in the Input for the FFT
78
77
79 This function provides the data used by the FFT
78 This function provides the data used by the FFT
80
79
81 \param Tbl[] The Table which contains the Data.
80 \param Tbl[] The Table which contains the Data.
82 \param dev The FFT pointer.
81 \param dev The FFT pointer.
83 */
82 */
84 int FftInput(int Tbl[],FFT_Device* dev);
83 int FftInput(int Tbl[],FFT_Device* dev);
85
84
86 /*! \fn int FftOutput(int Tbl[],FFT_Device*);
85 /*! \fn int FftOutput(int Tbl[],FFT_Device*);
87 \brief Save data from the FFT
86 \brief Save data from the FFT
88
87
89 This function save the data generated by the FFT
88 This function save the data generated by the FFT
90
89
91 \param Tbl[] The Table which will contains the Data.
90 \param Tbl[] The Table which will contains the Data.
92 \param dev The FFT pointer.
91 \param dev The FFT pointer.
93 */
92 */
94 int FftOutput(int Tbl[],FFT_Device* dev);
93 int FftOutput(int Tbl[],FFT_Device* dev);
95
94
96
95
97
96
98 #endif
97 #endif
@@ -1,76 +1,90
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
22 #ifndef APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
24
24
25 /*! \file apb_fifo_Driver.h
25 /*! \file apb_fifo_Driver.h
26 \brief LPP FIFO driver.
26 \brief LPP FIFO driver.
27
27
28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
29 used in many type of application.
29 used in many type of application.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
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 /*===================================================
37 T Y P E S D E F
40 T Y P E S D E F
38 ====================================================*/
41 ====================================================*/
39
42
40 /*! \struct APB_FIFO_REG
43 /*! \struct APB_FIFO_REG
41 \brief Sturcture representing the fifo registers
44 \brief Sturcture representing the fifo registers
42 */
45 */
43 struct APB_FIFO_REG
46 struct APB_FIFO_REG
44 {
47 {
45 int rwdata; /**< \brief Data register Write/Read */
48 int rwdata; /**< \brief Data register Write/Read */
46 int raddr; /**< \brief Address register for the reading operation */
49 int raddr; /**< \brief Address register for the reading operation */
47 int cfgreg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
50 int cfgreg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
48 Write enable Flag [HEX 1]
51 Write enable Flag [HEX 1]
49 Empty Flag [HEX 2]
52 Empty Flag [HEX 2]
50 Full Flag [HEX 3]
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 int dummy0; /**< \brief Unused register, aesthetic interest */
57 int dummy0; /**< \brief Unused register, aesthetic interest */
53 int dummy1; /**< \brief Unused register, aesthetic interest */
58 int dummy1; /**< \brief Unused register, aesthetic interest */
54 int waddr; /**< \brief Address register for the writing operation */
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 F U N C T I O N S
65 F U N C T I O N S
61 ====================================================*/
66 ====================================================*/
62
67
63 /*! \fn APB_FIFO_Device* apbfifoOpen(int count);
68 /*! \fn APB_FIFO_Device* apbfifoOpen(int count);
64 \brief Return count FIFO.
69 \brief Return count FIFO.
65
70
66 This Function scans APB devices table and returns count FIFO.
71 This Function scans APB devices table and returns count FIFO.
67
72
68 \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want
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 \return The pointer to the device.
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 #endif
90 #endif
@@ -1,46 +1,63
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_GPIO_DRIVER_H
22 #ifndef APB_GPIO_DRIVER_H
23 #define APB_GPIO_DRIVER_H
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 T Y P E S D E F
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 struct GPIO_REG
39 struct GPIO_REG
31 {
40 {
32 int Din;
41 int Din; /**< \brief Input GPIO register */
33 int Dout;
42 int Dout; /**< \brief Output GPIO register */
34 int oen;
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 F U N C T I O N S
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 GPIO_Device* openGPIO(int count);
60 GPIO_Device* openGPIO(int count);
44
61
45
62
46 #endif
63 #endif
@@ -1,118 +1,117
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_UART_DRIVER_H
22 #ifndef APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
24
24
25 /*! \file apb_uart_Driver.h
25 /*! \file apb_uart_Driver.h
26 \brief LPP Uart driver.
26 \brief LPP Uart driver.
27
27
28 This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get,
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.
29 char or strings over uart.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 */
32 */
34
33
35
34
36
35
37 #define BaudGenOnDuty 0 /**< Used to reset the Baud Generator (Capture Flag) */
36 #define BaudGenOnDuty 0 /**< Used to reset the Baud Generator (Capture Flag) */
38 #define DataSended 0x10 /**< Used to know when the data was send */
37 #define DataSended 0x10 /**< Used to know when the data was send */
39 #define NewData 0x100 /**< Used to know if a New data is ready to be send */
38 #define NewData 0x100 /**< Used to know if a New data is ready to be send */
40
39
41 /*===================================================
40 /*===================================================
42 T Y P E S D E F
41 T Y P E S D E F
43 ====================================================*/
42 ====================================================*/
44
43
45 /*! \struct UART_Driver
44 /*! \struct UART_Driver
46 \brief Sturcture representing the uart registers
45 \brief Sturcture representing the uart registers
47 */
46 */
48 struct UART_Driver
47 struct UART_Driver
49 {
48 {
50 int ConfigReg; /**< \brief Configuration register composed of Capture Flag [HEX 0]
49 int ConfigReg; /**< \brief Configuration register composed of Capture Flag [HEX 0]
51 Sended Flag [HEX 1]
50 Sended Flag [HEX 1]
52 NewData Flag [HEX 2]
51 NewData Flag [HEX 2]
53 Dummy "E" [HEX 3/4]
52 Dummy "E" [HEX 3/4]
54 BTrig Freq [HEX 5/6/7] */
53 BTrig Freq [HEX 5/6/7] */
55 int DataWReg; /**< \brief Data Write register */
54 int DataWReg; /**< \brief Data Write register */
56 int DataRReg; /**< \brief Data Read register */
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 /*===================================================
63 F U N C T I O N S
62 F U N C T I O N S
64 ====================================================*/
63 ====================================================*/
65
64
66 /*! \fn UART_Device* openUART(int count);
65 /*! \fn UART_Device* openUART(int count);
67 \brief Return count UART.
66 \brief Return count UART.
68
67
69 This Function scans APB devices table and returns count UART.
68 This Function scans APB devices table and returns count UART.
70
69
71 \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want
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 \return The pointer to the device.
72 \return The pointer to the device.
74 */
73 */
75 UART_Device* openUART(int count);
74 UART_Device* openUART(int count);
76
75
77 /*! \fn void uartputc(UART_Device* dev,char c);
76 /*! \fn void uartputc(UART_Device* dev,char c);
78 \brief Print char over given UART.
77 \brief Print char over given UART.
79
78
80 This Function puts the given char over the given UART.
79 This Function puts the given char over the given UART.
81
80
82 \param dev The UART pointer.
81 \param dev The UART pointer.
83 \param c The char you whant to print.
82 \param c The char you whant to print.
84 */
83 */
85 void uartputc(UART_Device* dev,char c);
84 void uartputc(UART_Device* dev,char c);
86
85
87 /*! \fn void uartputs(UART_Device* dev,char* s);
86 /*! \fn void uartputs(UART_Device* dev,char* s);
88 \brief Print string over given UART.
87 \brief Print string over given UART.
89
88
90 This Function puts the given string over the given UART.
89 This Function puts the given string over the given UART.
91
90
92 \param dev The UART pointer.
91 \param dev The UART pointer.
93 \param s The string you whant to print.
92 \param s The string you whant to print.
94 */
93 */
95 void uartputs(UART_Device* dev,char* s);
94 void uartputs(UART_Device* dev,char* s);
96
95
97 /*! \fn char uartgetc(UART_Device* dev);
96 /*! \fn char uartgetc(UART_Device* dev);
98 \brief Get char from given UART.
97 \brief Get char from given UART.
99
98
100 This Function get char from the given UART.
99 This Function get char from the given UART.
101
100
102 \param dev The UART pointer.
101 \param dev The UART pointer.
103 \return The read char.
102 \return The read char.
104 */
103 */
105 char uartgetc(UART_Device* dev);
104 char uartgetc(UART_Device* dev);
106
105
107 /*! \fn void uartgets(UART_Device* dev,char* s);
106 /*! \fn void uartgets(UART_Device* dev,char* s);
108 \brief Get string from given UART.
107 \brief Get string from given UART.
109
108
110 This Function get string from the given UART.
109 This Function get string from the given UART.
111
110
112 \param dev The UART pointer.
111 \param dev The UART pointer.
113 \param s The read string.
112 \param s The read string.
114 */
113 */
115 void uartgets(UART_Device* dev,char* s);
114 void uartgets(UART_Device* dev,char* s);
116
115
117
116
118 #endif
117 #endif
@@ -1,60 +1,60
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_CNA_DRIVER_H
22 #ifndef APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
23 #define APB_CNA_DRIVER_H
24
24
25 #define DAC_ready 3
25 #define DAC_ready 3
26 #define DAC_enable 1
26 #define DAC_enable 1
27 #define DAC_disable 0
27 #define DAC_disable 0
28
28
29
29
30 /*===================================================
30 /*===================================================
31 T Y P E S D E F
31 T Y P E S D E F
32 ====================================================*/
32 ====================================================*/
33
33
34 /** Structure repr�sentant le registre du CNA */
34 /** Structure repr�sentant le registre du CNA */
35 struct DAC_Driver
35 struct DAC_Driver
36 {
36 {
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
37 int configReg; /**< Registre de configuration: Flag Ready [1] ; Flag Enable [0] */
38 int dataReg; /**< Registre de donn�e sur 16 bits */
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 F U N C T I O N S
44 F U N C T I O N S
45 ====================================================*/
45 ====================================================*/
46
46
47 /** Ouvre l'acc� au CNA */
47 /** Ouvre l'acc� au CNA */
48 DAC_Device* DacOpen(int count);
48 DAC_Device* DacOpen(int count);
49
49
50 //DAC_Device* DacClose(int count);
50 //DAC_Device* DacClose(int count);
51
51
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
52 /** Les donn�es sont lus a partir d'un tableau pour obtenir le signal de CAL (10Khz + 625hz) */
53 int DacTable();
53 int DacTable();
54
54
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
55 /** Les donn�es sont entr�e par l'utilisateur, la conversion se fait a chaque nouvelle donn�e */
56 int DacConst();
56 int DacConst();
57
57
58
58
59
59
60 #endif
60 #endif
@@ -1,78 +1,79
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #include "lpp_apb_functions.h"
22 #include "lpp_apb_functions.h"
23 #include "apb_delay_Driver.h"
23 #include "apb_delay_Driver.h"
24 #include <stdio.h>
24 #include <stdio.h>
25
25
26
26
27 DELAY_Device* openDELAY(int count)
27 DELAY_Device* openDELAY(int count)
28 {
28 {
29 DELAY_Device* delay0;
29 DELAY_Device* delay0;
30 delay0 = (DELAY_Device*) apbgetdevice(LPP_DELAY,VENDOR_LPP,count);
30 delay0 = (DELAY_Device*) apbgetdevice(LPP_DELAY,VENDOR_LPP,count);
31 return delay0;
31 return delay0;
32 }
32 }
33
33
34 int Setup(DELAY_Device* dev,int X)
34 int Setup(DELAY_Device* dev,int X)
35 {
35 {
36 dev->Fboard = X;
36 dev->Fboard = X;
37 dev->Cfg = 0x001;
37 return dev->Fboard;
38 return dev->Fboard;
38 }
39 }
39
40
40
41
41 int Delay_s(DELAY_Device* dev,int T)
42 int Delay_s(DELAY_Device* dev,int T)
42 {
43 {
43 dev->Timer = dev->Fboard * T;
44 dev->Timer = dev->Fboard * T;
44 dev->Cfg = 0x11;
45 dev->Cfg = 0x011;
45 while(dev->Cfg != Delay_End);
46 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
46 dev->Cfg = 0x01;
47 dev->Cfg = 0x101;
47 return dev->Cfg;
48 return dev->Cfg;
48 }
49 }
49
50
50
51
51 int Delay_ms(DELAY_Device* dev,int T)
52 int Delay_ms(DELAY_Device* dev,int T)
52 {
53 {
53 dev->Timer = (dev->Fboard / 1000) * T;
54 dev->Timer = (dev->Fboard / 1000) * T;
54 dev->Cfg = 0x11;
55 dev->Cfg = 0x011;
55 while(dev->Cfg != Delay_End);
56 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
56 dev->Cfg = 0x01;
57 dev->Cfg = 0x101;
57 return dev->Cfg;
58 return dev->Cfg;
58 }
59 }
59
60
60
61
61 int Delay_us(DELAY_Device* dev,int T)
62 int Delay_us(DELAY_Device* dev,int T)
62 {
63 {
63 dev->Timer = (dev->Fboard / 1000000) * T;
64 dev->Timer = (dev->Fboard / 1000000) * T;
64 dev->Cfg = 0x11;
65 dev->Cfg = 0x011;
65 while(dev->Cfg != Delay_End);
66 while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN
66 dev->Cfg = 0x01;
67 dev->Cfg = 0x101;
67 return dev->Cfg;
68 return dev->Cfg;
68 }
69 }
69
70
70
71
71
72
72
73
73
74
74
75
75
76
76
77
77
78
78
79
@@ -1,52 +1,113
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
22 #ifndef APB_DELAY_DRIVER_H
23 #define APB_FIFO_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 T Y P E S D E F
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 struct DELAY_REG
41 struct DELAY_REG
33 {
42 {
34 int Cfg;
43 int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0]
35 int Fboard;
44 Start Flag [HEX 1]
36 int Timer;
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 typedef volatile struct DELAY_REG DELAY_Device;
51 typedef volatile struct DELAY_REG DELAY_Device;
40
52
41 /*===================================================
53 /*===================================================
42 F U N C T I O N S
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 int Delay_us(DELAY_Device* dev,int T);
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 int Delay_ms(DELAY_Device* dev,int T);
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 int Delay_s(DELAY_Device* dev,int T);
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 #endif
113 #endif
@@ -1,98 +1,97
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FFT_DRIVER_H
22 #ifndef APB_FFT_DRIVER_H
23 #define APB_FFT_DRIVER_H
23 #define APB_FFT_DRIVER_H
24
24
25 /*! \file apb_fft_Driver.h
25 /*! \file apb_fft_Driver.h
26 \brief LPP FFT driver.
26 \brief LPP FFT driver.
27
27
28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
28 This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms,
29 from an input data table.
29 from an input data table.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 */
32 */
34
33
35 #define FFT_Empty 0x00100 /**< Used to know when the data can be send to the FFT module */
34 #define FFT_Empty 0x00100 /**< Used to know when the data can be send to the FFT module */
36 #define FFT_Full 0x01000 /**< Used to know when the data can be send to the FFT module */
35 #define FFT_Full 0x01000 /**< Used to know when the data can be send to the FFT module */
37
36
38
37
39 /*===================================================
38 /*===================================================
40 T Y P E S D E F
39 T Y P E S D E F
41 ====================================================*/
40 ====================================================*/
42 /*! \struct FFT_Driver
41 /*! \struct FFT_Driver
43 \brief Sturcture representing the fft registers
42 \brief Sturcture representing the fft registers
44 */
43 */
45 struct FFT_Driver
44 struct FFT_Driver
46 {
45 {
47 int RWDataReg; /**< \brief Data register Write/Read */
46 int RWDataReg; /**< \brief Data register Write/Read */
48 int ReadAddrReg; /**< \brief Address register for the reading operation */
47 int ReadAddrReg; /**< \brief Address register for the reading operation */
49 int ConfigReg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
48 int ConfigReg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
50 Write enable Flag [HEX 1]
49 Write enable Flag [HEX 1]
51 Empty Flag [HEX 2]
50 Empty Flag [HEX 2]
52 Full Flag [HEX 3]
51 Full Flag [HEX 3]
53 Dummy "C" [HEX 4/5/6/7] */
52 Dummy "C" [HEX 4/5/6/7] */
54 int Dummy1; /**< \brief Unused register, aesthetic interest */
53 int Dummy1; /**< \brief Unused register, aesthetic interest */
55 int Dummy0; /**< \brief Unused register, aesthetic interest */
54 int Dummy0; /**< \brief Unused register, aesthetic interest */
56 int WriteAddrReg; /**< \brief Address register for the writing operation */
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 /*===================================================
63 F U N C T I O N S
62 F U N C T I O N S
64 ====================================================*/
63 ====================================================*/
65 /*! \fn FFT_Device* openFFT(int count);
64 /*! \fn FFT_Device* openFFT(int count);
66 \brief Return count FFT.
65 \brief Return count FFT.
67
66
68 This Function scans APB devices table and returns count FFT.
67 This Function scans APB devices table and returns count FFT.
69
68
70 \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want
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 \return The pointer to the device.
71 \return The pointer to the device.
73 */
72 */
74 FFT_Device* openFFT(int count);
73 FFT_Device* openFFT(int count);
75
74
76 /*! \fn int FftInput(int Tbl[],FFT_Device*);
75 /*! \fn int FftInput(int Tbl[],FFT_Device*);
77 \brief Fill in the Input for the FFT
76 \brief Fill in the Input for the FFT
78
77
79 This function provides the data used by the FFT
78 This function provides the data used by the FFT
80
79
81 \param Tbl[] The Table which contains the Data.
80 \param Tbl[] The Table which contains the Data.
82 \param dev The FFT pointer.
81 \param dev The FFT pointer.
83 */
82 */
84 int FftInput(int Tbl[],FFT_Device* dev);
83 int FftInput(int Tbl[],FFT_Device* dev);
85
84
86 /*! \fn int FftOutput(int Tbl[],FFT_Device*);
85 /*! \fn int FftOutput(int Tbl[],FFT_Device*);
87 \brief Save data from the FFT
86 \brief Save data from the FFT
88
87
89 This function save the data generated by the FFT
88 This function save the data generated by the FFT
90
89
91 \param Tbl[] The Table which will contains the Data.
90 \param Tbl[] The Table which will contains the Data.
92 \param dev The FFT pointer.
91 \param dev The FFT pointer.
93 */
92 */
94 int FftOutput(int Tbl[],FFT_Device* dev);
93 int FftOutput(int Tbl[],FFT_Device* dev);
95
94
96
95
97
96
98 #endif
97 #endif
@@ -1,35 +1,45
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #include "lpp_apb_functions.h"
22 #include "lpp_apb_functions.h"
23 #include "apb_fifo_Driver.h"
23 #include "apb_fifo_Driver.h"
24 #include <stdio.h>
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;
29 FIFO_Device* fifo0;
30 fifo0 = (APB_FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count);
30 fifo0 = (FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count);
31 return fifo0;
31 return fifo0;
32 }
32 }
33
33
34
34
35
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 }
@@ -1,76 +1,90
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_FIFO_DRIVER_H
22 #ifndef APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
23 #define APB_FIFO_DRIVER_H
24
24
25 /*! \file apb_fifo_Driver.h
25 /*! \file apb_fifo_Driver.h
26 \brief LPP FIFO driver.
26 \brief LPP FIFO driver.
27
27
28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
28 This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working,
29 used in many type of application.
29 used in many type of application.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
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 /*===================================================
37 T Y P E S D E F
40 T Y P E S D E F
38 ====================================================*/
41 ====================================================*/
39
42
40 /*! \struct APB_FIFO_REG
43 /*! \struct APB_FIFO_REG
41 \brief Sturcture representing the fifo registers
44 \brief Sturcture representing the fifo registers
42 */
45 */
43 struct APB_FIFO_REG
46 struct APB_FIFO_REG
44 {
47 {
45 int rwdata; /**< \brief Data register Write/Read */
48 int rwdata; /**< \brief Data register Write/Read */
46 int raddr; /**< \brief Address register for the reading operation */
49 int raddr; /**< \brief Address register for the reading operation */
47 int cfgreg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
50 int cfgreg; /**< \brief Configuration register composed of Read enable Flag [HEX 0]
48 Write enable Flag [HEX 1]
51 Write enable Flag [HEX 1]
49 Empty Flag [HEX 2]
52 Empty Flag [HEX 2]
50 Full Flag [HEX 3]
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 int dummy0; /**< \brief Unused register, aesthetic interest */
57 int dummy0; /**< \brief Unused register, aesthetic interest */
53 int dummy1; /**< \brief Unused register, aesthetic interest */
58 int dummy1; /**< \brief Unused register, aesthetic interest */
54 int waddr; /**< \brief Address register for the writing operation */
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 F U N C T I O N S
65 F U N C T I O N S
61 ====================================================*/
66 ====================================================*/
62
67
63 /*! \fn APB_FIFO_Device* apbfifoOpen(int count);
68 /*! \fn APB_FIFO_Device* apbfifoOpen(int count);
64 \brief Return count FIFO.
69 \brief Return count FIFO.
65
70
66 This Function scans APB devices table and returns count FIFO.
71 This Function scans APB devices table and returns count FIFO.
67
72
68 \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want
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 \return The pointer to the device.
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 #endif
90 #endif
@@ -1,46 +1,63
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_GPIO_DRIVER_H
22 #ifndef APB_GPIO_DRIVER_H
23 #define APB_GPIO_DRIVER_H
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 T Y P E S D E F
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 struct GPIO_REG
39 struct GPIO_REG
31 {
40 {
32 int Din;
41 int Din; /**< \brief Input GPIO register */
33 int Dout;
42 int Dout; /**< \brief Output GPIO register */
34 int oen;
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 F U N C T I O N S
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 GPIO_Device* openGPIO(int count);
60 GPIO_Device* openGPIO(int count);
44
61
45
62
46 #endif
63 #endif
@@ -1,44 +1,46
1 #------------------------------------------------------------------------------
1 #------------------------------------------------------------------------------
2 #-- This file is a part of the LPP VHDL IP LIBRARY
2 #-- This file is a part of the LPP VHDL IP LIBRARY
3 #-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
3 #-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS
4 #--
4 #--
5 #-- This program is free software; you can redistribute it and/or modify
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
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
7 #-- the Free Software Foundation; either version 3 of the License, or
8 #-- (at your option) any later version.
8 #-- (at your option) any later version.
9 #--
9 #--
10 #-- This program is distributed in the hope that it will be useful,
10 #-- This program is distributed in the hope that it will be useful,
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 #-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #-- GNU General Public License for more details.
13 #-- GNU General Public License for more details.
14 #--
14 #--
15 #-- You should have received a copy of the GNU General Public License
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
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
17 #-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #------------------------------------------------------------------------------
18 #------------------------------------------------------------------------------
19
19
20 include ../rules.mk
20 include ../rules.mk
21
21
22
22
23
23
24 all:
24 all:
25 make all -C AMBA
25 make all -C AMBA
26 make all -C LCD
26 make all -C LCD
27 make all -C DAC
27 make all -C DAC
28 make all -C FIFO
28 make all -C FIFO
29 make all -C UART
29 make all -C UART
30 make all -C FFT
30 make all -C FFT
31 make all -C DELAY
31 make all -C DELAY
32 make all -C GPIO
32 make all -C GPIO
33 make all -C MATRIX
33
34
34
35
35 cleanall:
36 cleanall:
36 make clean -C AMBA
37 make clean -C AMBA
37 make clean -C LCD
38 make clean -C LCD
38 make clean -C DAC
39 make clean -C DAC
39 make clean -C FIFO
40 make clean -C FIFO
40 make clean -C UART
41 make clean -C UART
41 make clean -C FFT
42 make clean -C FFT
42 make clean -C DELAY
43 make clean -C DELAY
43 make clean -C GPIO
44 make clean -C GPIO
45 make clean -C MATRIX
44
46
@@ -1,118 +1,117
1 /*------------------------------------------------------------------------------
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -----------------------------------------------------------------------------*/
21 -----------------------------------------------------------------------------*/
22 #ifndef APB_UART_DRIVER_H
22 #ifndef APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
23 #define APB_UART_DRIVER_H
24
24
25 /*! \file apb_uart_Driver.h
25 /*! \file apb_uart_Driver.h
26 \brief LPP Uart driver.
26 \brief LPP Uart driver.
27
27
28 This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get,
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.
29 char or strings over uart.
30
30
31 \todo Check "DEVICE1 => count = 2" function Open
32 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
31 \author Martin Morlot martin.morlot@lpp.polytechnique.fr
33 */
32 */
34
33
35
34
36
35
37 #define BaudGenOnDuty 0 /**< Used to reset the Baud Generator (Capture Flag) */
36 #define BaudGenOnDuty 0 /**< Used to reset the Baud Generator (Capture Flag) */
38 #define DataSended 0x10 /**< Used to know when the data was send */
37 #define DataSended 0x10 /**< Used to know when the data was send */
39 #define NewData 0x100 /**< Used to know if a New data is ready to be send */
38 #define NewData 0x100 /**< Used to know if a New data is ready to be send */
40
39
41 /*===================================================
40 /*===================================================
42 T Y P E S D E F
41 T Y P E S D E F
43 ====================================================*/
42 ====================================================*/
44
43
45 /*! \struct UART_Driver
44 /*! \struct UART_Driver
46 \brief Sturcture representing the uart registers
45 \brief Sturcture representing the uart registers
47 */
46 */
48 struct UART_Driver
47 struct UART_Driver
49 {
48 {
50 int ConfigReg; /**< \brief Configuration register composed of Capture Flag [HEX 0]
49 int ConfigReg; /**< \brief Configuration register composed of Capture Flag [HEX 0]
51 Sended Flag [HEX 1]
50 Sended Flag [HEX 1]
52 NewData Flag [HEX 2]
51 NewData Flag [HEX 2]
53 Dummy "E" [HEX 3/4]
52 Dummy "E" [HEX 3/4]
54 BTrig Freq [HEX 5/6/7] */
53 BTrig Freq [HEX 5/6/7] */
55 int DataWReg; /**< \brief Data Write register */
54 int DataWReg; /**< \brief Data Write register */
56 int DataRReg; /**< \brief Data Read register */
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 /*===================================================
63 F U N C T I O N S
62 F U N C T I O N S
64 ====================================================*/
63 ====================================================*/
65
64
66 /*! \fn UART_Device* openUART(int count);
65 /*! \fn UART_Device* openUART(int count);
67 \brief Return count UART.
66 \brief Return count UART.
68
67
69 This Function scans APB devices table and returns count UART.
68 This Function scans APB devices table and returns count UART.
70
69
71 \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want
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 \return The pointer to the device.
72 \return The pointer to the device.
74 */
73 */
75 UART_Device* openUART(int count);
74 UART_Device* openUART(int count);
76
75
77 /*! \fn void uartputc(UART_Device* dev,char c);
76 /*! \fn void uartputc(UART_Device* dev,char c);
78 \brief Print char over given UART.
77 \brief Print char over given UART.
79
78
80 This Function puts the given char over the given UART.
79 This Function puts the given char over the given UART.
81
80
82 \param dev The UART pointer.
81 \param dev The UART pointer.
83 \param c The char you whant to print.
82 \param c The char you whant to print.
84 */
83 */
85 void uartputc(UART_Device* dev,char c);
84 void uartputc(UART_Device* dev,char c);
86
85
87 /*! \fn void uartputs(UART_Device* dev,char* s);
86 /*! \fn void uartputs(UART_Device* dev,char* s);
88 \brief Print string over given UART.
87 \brief Print string over given UART.
89
88
90 This Function puts the given string over the given UART.
89 This Function puts the given string over the given UART.
91
90
92 \param dev The UART pointer.
91 \param dev The UART pointer.
93 \param s The string you whant to print.
92 \param s The string you whant to print.
94 */
93 */
95 void uartputs(UART_Device* dev,char* s);
94 void uartputs(UART_Device* dev,char* s);
96
95
97 /*! \fn char uartgetc(UART_Device* dev);
96 /*! \fn char uartgetc(UART_Device* dev);
98 \brief Get char from given UART.
97 \brief Get char from given UART.
99
98
100 This Function get char from the given UART.
99 This Function get char from the given UART.
101
100
102 \param dev The UART pointer.
101 \param dev The UART pointer.
103 \return The read char.
102 \return The read char.
104 */
103 */
105 char uartgetc(UART_Device* dev);
104 char uartgetc(UART_Device* dev);
106
105
107 /*! \fn void uartgets(UART_Device* dev,char* s);
106 /*! \fn void uartgets(UART_Device* dev,char* s);
108 \brief Get string from given UART.
107 \brief Get string from given UART.
109
108
110 This Function get string from the given UART.
109 This Function get string from the given UART.
111
110
112 \param dev The UART pointer.
111 \param dev The UART pointer.
113 \param s The read string.
112 \param s The read string.
114 */
113 */
115 void uartgets(UART_Device* dev,char* s);
114 void uartgets(UART_Device* dev,char* s);
116
115
117
116
118 #endif
117 #endif
@@ -1,132 +1,137
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ------------------------------------------------------------------------------
18 ------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
21 ------------------------------------------------------------------------------
22 library ieee;
22 library ieee;
23 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
24 library grlib;
24 library grlib;
25 use grlib.amba.all;
25 use grlib.amba.all;
26 use grlib.stdlib.all;
26 use grlib.stdlib.all;
27 use grlib.devices.all;
27 use grlib.devices.all;
28 library lpp;
28 library lpp;
29 use lpp.lpp_amba.all;
29 use lpp.lpp_amba.all;
30 use lpp.apb_devices_list.all;
30 use lpp.apb_devices_list.all;
31 use lpp.lpp_delay.all;
31 use lpp.lpp_delay.all;
32
32
33 --! Driver APB, va faire le lien entre l'IP VHDL du convertisseur et le bus Amba
33 --! Driver APB, va faire le lien entre l'IP VHDL du convertisseur et le bus Amba
34
34
35 entity APB_Delay is
35 entity APB_Delay is
36 generic (
36 generic (
37 pindex : integer := 0;
37 pindex : integer := 0;
38 paddr : integer := 0;
38 paddr : integer := 0;
39 pmask : integer := 16#fff#;
39 pmask : integer := 16#fff#;
40 pirq : integer := 0;
40 pirq : integer := 0;
41 abits : integer := 8);
41 abits : integer := 8);
42 port (
42 port (
43 clk : in std_logic; --! Horloge du composant
43 clk : in std_logic; --! Horloge du composant
44 rst : in std_logic; --! Reset general du composant
44 rst : in std_logic; --! Reset general du composant
45 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
45 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
46 apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus
46 apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus
47 );
47 );
48 end APB_Delay;
48 end APB_Delay;
49
49
50
50
51 architecture ar_APB_Delay of APB_Delay is
51 architecture ar_APB_Delay of APB_Delay is
52
52
53 constant REVISION : integer := 1;
53 constant REVISION : integer := 1;
54
54
55 constant pconfig : apb_config_type := (
55 constant pconfig : apb_config_type := (
56 0 => ahb_device_reg (VENDOR_LPP, LPP_DELAY, 0, REVISION, 0),
56 0 => ahb_device_reg (VENDOR_LPP, LPP_DELAY, 0, REVISION, 0),
57 1 => apb_iobar(paddr, pmask));
57 1 => apb_iobar(paddr, pmask));
58
58
59 type DELAY_ctrlr_Reg is record
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 Delay_FreqBoard : std_logic_vector(25 downto 0);
61 Delay_FreqBoard : std_logic_vector(25 downto 0);
62 Delay_Timer : std_logic_vector(25 downto 0);
62 Delay_Timer : std_logic_vector(25 downto 0);
63 end record;
63 end record;
64
64
65 signal Rec : DELAY_ctrlr_Reg;
65 signal Rec : DELAY_ctrlr_Reg;
66 signal Rdata : std_logic_vector(31 downto 0);
66 signal Rdata : std_logic_vector(31 downto 0);
67
67
68 signal Flag_st : std_logic;
68 signal Flag_st : std_logic;
69 signal Flag_end : std_logic;
69 signal Flag_end : std_logic;
70 signal Flag_OKend : std_logic;
70 signal Rz : std_logic;
71 signal Rz : std_logic;
71 signal Raz : std_logic;
72 signal Raz : std_logic;
72
73
73 begin
74 begin
74
75
75 Flag_st <= Rec.Delay_CFG(1);
76 Flag_st <= Rec.Delay_CFG(1);
76 Rec.Delay_CFG(2) <= Flag_end;
77 Rec.Delay_CFG(3) <= Flag_end;
77 Rz <= Rec.Delay_CFG(0);
78 Rz <= Rec.Delay_CFG(0);
79 Flag_OKend <= Rec.Delay_CFG(2);
78
80
79 Raz <= rst and Rz;
81 Raz <= rst and Rz;
80
82
81 Delay0 : TimerDelay
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 process(rst,clk)
86 process(rst,clk)
85 begin
87 begin
86 if(rst='0')then
88 if(rst='0')then
87 Rec.Delay_FreqBoard <= (others => '0');
89 Rec.Delay_FreqBoard <= (others => '0');
88 Rec.Delay_Timer <= (others => '0');
90 Rec.Delay_Timer <= (others => '0');
91 Rec.Delay_CFG(2 downto 0) <= (others => '0');
89
92
90 elsif(clk'event and clk='1')then
93 elsif(clk'event and clk='1')then
91
94
92 --APB Write OP
95 --APB Write OP
93 if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then
96 if (apbi.psel(pindex) and apbi.penable and apbi.pwrite) = '1' then
94 case apbi.paddr(abits-1 downto 2) is
97 case apbi.paddr(abits-1 downto 2) is
95 when "000000" =>
98 when "000000" =>
96 Rec.Delay_CFG(0) <= apbi.pwdata(0);
99 Rec.Delay_CFG(0) <= apbi.pwdata(0);
97 Rec.Delay_CFG(1) <= apbi.pwdata(4);
100 Rec.Delay_CFG(1) <= apbi.pwdata(4);
101 Rec.Delay_CFG(2) <= apbi.pwdata(8);
98 when "000001" =>
102 when "000001" =>
99 Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0);
103 Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0);
100 when "000010" =>
104 when "000010" =>
101 Rec.Delay_Timer <= apbi.pwdata(25 downto 0);
105 Rec.Delay_Timer <= apbi.pwdata(25 downto 0);
102 when others =>
106 when others =>
103 null;
107 null;
104 end case;
108 end case;
105 end if;
109 end if;
106
110
107 --APB READ OP
111 --APB Read OP
108 if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then
112 if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then
109 case apbi.paddr(abits-1 downto 2) is
113 case apbi.paddr(abits-1 downto 2) is
110 when "000000" =>
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 Rdata(11 downto 8) <= "000" & Rec.Delay_CFG(2);
117 Rdata(11 downto 8) <= "000" & Rec.Delay_CFG(2);
113 Rdata(7 downto 4) <= "000" & Rec.Delay_CFG(1);
118 Rdata(7 downto 4) <= "000" & Rec.Delay_CFG(1);
114 Rdata(3 downto 0) <= "000" & Rec.Delay_CFG(0);
119 Rdata(3 downto 0) <= "000" & Rec.Delay_CFG(0);
115 when "000001" =>
120 when "000001" =>
116 Rdata(31 downto 26) <= X"0" & "00";
121 Rdata(31 downto 26) <= X"0" & "00";
117 Rdata(25 downto 0) <= Rec.Delay_FreqBoard;
122 Rdata(25 downto 0) <= Rec.Delay_FreqBoard;
118 when "000010" =>
123 when "000010" =>
119 Rdata(31 downto 26) <= X"0" & "00";
124 Rdata(31 downto 26) <= X"0" & "00";
120 Rdata(25 downto 0) <= Rec.Delay_Timer;
125 Rdata(25 downto 0) <= Rec.Delay_Timer;
121 when others =>
126 when others =>
122 Rdata <= (others => '0');
127 Rdata <= (others => '0');
123 end case;
128 end case;
124 end if;
129 end if;
125
130
126 end if;
131 end if;
127 apbo.pconfig <= pconfig;
132 apbo.pconfig <= pconfig;
128 end process;
133 end process;
129
134
130 apbo.prdata <= Rdata when apbi.penable = '1';
135 apbo.prdata <= Rdata when apbi.penable = '1';
131
136
132 end ar_APB_Delay; No newline at end of file
137 end ar_APB_Delay;
@@ -1,67 +1,74
1 -- TimerDelay.vhd
1 -- TimerDelay.vhd
2 library IEEE;
2 library IEEE;
3 use IEEE.numeric_std.all;
3 use IEEE.numeric_std.all;
4 use IEEE.std_logic_1164.all;
4 use IEEE.std_logic_1164.all;
5
5
6 entity TimerDelay is
6 entity TimerDelay is
7 port(
7 port(
8 clk : in std_logic;
8 clk : in std_logic;
9 raz : in std_logic;
9 raz : in std_logic;
10 Start : in std_logic;
10 Start : in std_logic;
11 OKfin : in std_logic;
11 Fin : out std_logic;
12 Fin : out std_logic;
12 Cpt : in std_logic_vector(25 downto 0)
13 Cpt : in std_logic_vector(25 downto 0)
13 );
14 );
14 end TimerDelay;
15 end TimerDelay;
15
16
16
17
17 architecture ar_TimerDelay of TimerDelay is
18 architecture ar_TimerDelay of TimerDelay is
18
19
19 type state is (stX,st1);
20 type state is (stX,st1,st2);
20 signal ect : state;
21 signal ect : state;
21
22
22 constant MAX : integer := 67_108_863;
23 constant MAX : integer := 67_108_863;
23
24
24 signal delay : integer range 0 to MAX;
25 signal delay : integer range 0 to MAX;
25 signal compt : integer range 0 to MAX;
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 begin
30 begin
30
31
31 delay <= to_integer(unsigned(Cpt));
32 delay <= to_integer(unsigned(Cpt));
32
33
33 process(clk,raz)
34 process(clk,raz)
34 begin
35 begin
35
36
36 if(raz='0')then
37 if(raz='0')then
37 Fin <= '1';
38 Fin <= '1';
38 Start_reg <= '0';
39 --Start_reg <= '0';
39 ect <= stX;
40 ect <= stX;
40
41
41 elsif(clk'event and clk='1')then
42 elsif(clk'event and clk='1')then
42 Start_reg <= Start;
43 --Start_reg <= Start;
43
44
44 case ect is
45 case ect is
45
46
46 when stX =>
47 when stX =>
47 if(Start_reg = '0' and Start = '1')then
48 if(Start = '1')then
48 Fin <= '0';
49 --OKst <= '1';
49 ect <= st1;
50 ect <= st1;
50 end if;
51 end if;
51
52
52
53 when st1 =>
53 when st1 =>
54 if(compt = delay)then
54 if(compt = delay)then
55 compt <= 0;
55 compt <= 0;
56 --OKst <= '0';
56 Fin <= '1';
57 Fin <= '1';
57 ect <= stX;
58 ect <= st2;
58 else
59 else
59 compt <= compt + 1;
60 compt <= compt + 1;
60 ect <= st1;
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 end case;
70 end case;
64 end if;
71 end if;
65 end process;
72 end process;
66
73
67 end ar_TimerDelay; No newline at end of file
74 end ar_TimerDelay;
@@ -1,59 +1,60
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
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
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
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
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ------------------------------------------------------------------------------
18 ------------------------------------------------------------------------------
19 -- Author : Martin Morlot
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 ------------------------------------------------------------------------------
21 ------------------------------------------------------------------------------
22 library ieee;
22 library ieee;
23 use ieee.std_logic_1164.all;
23 use ieee.std_logic_1164.all;
24 library grlib;
24 library grlib;
25 use grlib.amba.all;
25 use grlib.amba.all;
26 use std.textio.all;
26 use std.textio.all;
27 library lpp;
27 library lpp;
28 use lpp.lpp_amba.all;
28 use lpp.lpp_amba.all;
29
29
30 --! Package contenant tous les programmes qui forment le composant int�gr� dans le l�on
30 --! Package contenant tous les programmes qui forment le composant int�gr� dans le l�on
31
31
32 package lpp_delay is
32 package lpp_delay is
33
33
34 component APB_Delay is
34 component APB_Delay is
35 generic (
35 generic (
36 pindex : integer := 0;
36 pindex : integer := 0;
37 paddr : integer := 0;
37 paddr : integer := 0;
38 pmask : integer := 16#fff#;
38 pmask : integer := 16#fff#;
39 pirq : integer := 0;
39 pirq : integer := 0;
40 abits : integer := 8);
40 abits : integer := 8);
41 port (
41 port (
42 clk : in std_logic; --! Horloge du composant
42 clk : in std_logic; --! Horloge du composant
43 rst : in std_logic; --! Reset general du composant
43 rst : in std_logic; --! Reset general du composant
44 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
44 apbi : in apb_slv_in_type; --! Registre de gestion des entr�es du bus
45 apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus
45 apbo : out apb_slv_out_type --! Registre de gestion des sorties du bus
46 );
46 );
47 end component;
47 end component;
48
48
49 component TimerDelay is
49 component TimerDelay is
50 port(
50 port(
51 clk : in std_logic;
51 clk : in std_logic;
52 raz : in std_logic;
52 raz : in std_logic;
53 Start : in std_logic;
53 Start : in std_logic;
54 Fin : out std_logic;
54 OKfin : in std_logic;
55 Cpt : in std_logic_vector(25 downto 0)
55 Fin : out std_logic;
56 Cpt : in std_logic_vector(25 downto 0)
56 );
57 );
57 end component;
58 end component;
58
59
59 end; No newline at end of file
60 end;
General Comments 0
You need to be logged in to leave comments. Login now