diff --git a/LPP_drivers/exemples/BenchFIFO/main.c b/LPP_drivers/exemples/BenchFIFO/main.c --- a/LPP_drivers/exemples/BenchFIFO/main.c +++ b/LPP_drivers/exemples/BenchFIFO/main.c @@ -1,33 +1,33 @@ -/*------------------------------------------------------------------------------ --- This file is a part of the LPP VHDL IP LIBRARY --- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS --- --- This program is free software; you can redistribute it and/or modify --- it under the terms of the GNU General Public License as published by --- the Free Software Foundation; either version 3 of the License, or --- (at your option) any later version. --- --- This program is distributed in the hope that it will be useful, --- but WITHOUT ANY WARRANTY; without even the implied warranty of --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --- GNU General Public License for more details. --- --- You should have received a copy of the GNU General Public License --- along with this program; if not, write to the Free Software --- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --------------------------------------------------------------------------------*/ -#include "stdio.h" +/*------------------------------------------------------------------------------ +-- This file is a part of the LPP VHDL IP LIBRARY +-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-------------------------------------------------------------------------------*/ +#include "stdio.h" #include "lpp_apb_functions.h" -#include "apb_fifo_Driver.h" - - - -int main() -{ +#include "apb_fifo_Driver.h" + + + +int main() +{ int d=0; int i=0; - APB_FIFO_Device* FIFO0; - FIFO0 = apbfifoOpen(0); + FIFO_Device* FIFO0; + FIFO0 = openFIFO(0); for(i=0;i<1024;i++) { @@ -37,8 +37,8 @@ int main() for(i=0;i<1024;i++) { printf("%x",FIFO0->rwdata); - } + } + - - return 0; -} + return 0; +} diff --git a/LPP_drivers/exemples/BenchMatrix/Makefile b/LPP_drivers/exemples/BenchMatrix/Makefile new file mode 100644 --- /dev/null +++ b/LPP_drivers/exemples/BenchMatrix/Makefile @@ -0,0 +1,44 @@ +#------------------------------------------------------------------------------ +#-- This file is a part of the LPP VHDL IP LIBRARY +#-- Copyright (C) 2010, Laboratory of Plasmas Physic - CNRS +#-- +#-- This program is free software; you can redistribute it and/or modify +#-- it under the terms of the GNU General Public License as published by +#-- the Free Software Foundation; either version 3 of the License, or +#-- (at your option) any later version. +#-- +#-- This program is distributed in the hope that it will be useful, +#-- but WITHOUT ANY WARRANTY; without even the implied warranty of +#-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#-- GNU General Public License for more details. +#-- +#-- You should have received a copy of the GNU General Public License +#-- along with this program; if not, write to the Free Software +#-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#------------------------------------------------------------------------------ + +include ../../rules.mk +LIBDIR = ../../lib +INCPATH = ../../includes +SCRIPTDIR=../../scripts/ +LIBS=-lapb_Matrix_Driver -llpp_apb_functions -lapb_delay_Driver -lapb_fifo_Driver -lapb_uart_Driver -lapb_gpio_Driver +INPUTFILE=main.c +EXEC=BenchMatrix.bin +OUTBINDIR=bin/ + + +.PHONY:bin + +all:bin + @echo $(EXEC)" file created" + +clean: + rm -f *.{o,a} + + + +help:ruleshelp + @echo " all : makes an executable file called "$(EXEC) + @echo " in "$(OUTBINDIR) + @echo " clean : removes temporary files" + diff --git a/LPP_drivers/exemples/BenchMatrix/main.c b/LPP_drivers/exemples/BenchMatrix/main.c new file mode 100644 --- /dev/null +++ b/LPP_drivers/exemples/BenchMatrix/main.c @@ -0,0 +1,205 @@ +#include +#include "lpp_apb_functions.h" +#include "apb_fifo_Driver.h" +#include "apb_Matrix_Driver.h" +#include "apb_uart_Driver.h" +#include "apb_delay_Driver.h" +#include "apb_gpio_Driver.h" + +int main() +{ + int i=0; + char temp[256]; + 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}; + 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}; + 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}; + 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}; + 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}; + int Table[256]; + + DELAY_Device* delay0 = openDELAY(0); + UART_Device* uart0 = openUART(0); + FIFO_Device* fifo0 = openFIFO(0); + FIFO_Device* fifo1 = openFIFO(1); + static MATRIX_Device* mspec; + mspec = openMatrix(0); + FIFO_Device* fifoOut = openFIFO(2); + GPIO_Device* gpio0 = openGPIO(0); + + + printf("\nDebut Main\n\n"); + + Setup(delay0,30000000); + gpio0->oen = 0x3; + gpio0->Dout = 0x0; + + mspec->Statu = 2; + FillFifo(fifo0,TblB1,256); + FillFifo(fifo1,TblB2,256); + + Delay_ms(delay0,10); + gpio0->Dout = 0x1; + for (i = 0 ; i < 256 ; i++) + { + Table[i] = fifoOut->rwdata; + } + + gpio0->Dout = 0x2; + sprintf(temp,"Reels\tImaginaires\n\r"); + uartputs(uart0,temp); + for (i = 0 ; i < 256 ; i+=2) + { + sprintf(temp,"%d\t%d\n\r",Table[i],Table[i+1]); + uartputs(uart0,temp); + } + + gpio0->Dout = 0x3; + + printf("\nFin Main\n\n"); + return 0; +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/*int main() +{ + int i=0; + 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}; + 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}; + 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}; + 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}; + 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}; + + + printf("\nDebut Main\n\n"); + + FIFO_Device* fifoB1 = openFIFO(0); + FIFO_Device* fifoB2 = openFIFO(1); + FIFO_Device* fifoB3 = openFIFO(2); + FIFO_Device* fifoE1 = openFIFO(3); + FIFO_Device* fifoE2 = openFIFO(4); + + for (i = 0 ; i < 256 ; i++) + { + fifoB1->rwdata = TblB1[i]; + fifoB2->rwdata = TblB2[i]; + fifoB3->rwdata = TblB3[i]; + fifoE1->rwdata = TblE1[i]; + fifoE2->rwdata = TblE2[i]; + } + + fifoB1->cfgreg = fifoB1->cfgreg | Boucle; + fifoB2->cfgreg = fifoB2->cfgreg | Boucle; + fifoB3->cfgreg = fifoB3->cfgreg | Boucle; + fifoE1->cfgreg = fifoE1->cfgreg | Boucle; + fifoE2->cfgreg = fifoE2->cfgreg | Boucle; + + printf("\t*** Bouclé ***\n\n"); + + return 0; +}*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* +while((fifoB1->cfgreg & FIFO_Empty) != FIFO_Empty) // TANT QUE empty a 0 ALORS + { + while((Mspec0->Cfg & Read) != Read); // TANT QUE read a 0 RIEN + + Mspec0->IN1 = fifoB1->rwdata; + Mspec0->IN2 = fifoB1->rwdata; + Mspec0->Cfg = 0x1; + printf("Input: %x / %x\n",Mspec0->IN1,Mspec0->IN2); + + while((Mspec0->Cfg & Read) != Read); // TANT QUE read a 0 RIEN + + Mspec0->IN1 = fifoB1->rwdata; + Mspec0->IN2 = fifoB1->rwdata; + Mspec0->Cfg = 0x0; + printf("Input: %x / %x\n",Mspec0->IN1,Mspec0->IN2); + + while((Mspec0->Cfg & Valid) != Valid); // TANT QUE valid a 0 RIEN + + //printf("Result: %d\n",Mspec0->RES); + Mspec0->Cfg = 0x100; + TabResB1B1[i] = Mspec0->RES; + i++; + printf("Result: %d\n",Mspec0->RES); + + while((Mspec0->Cfg & Valid) != Valid); // TANT QUE valid a 0 RIEN + + //printf("Result: %d\n",Mspec0->RES); + Mspec0->Cfg = 0x000; + TabResB1B1[i] = Mspec0->RES; + i++; + printf("Result: %d\n",Mspec0->RES); + } +*/ diff --git a/LPP_drivers/exemples/Makefile b/LPP_drivers/exemples/Makefile --- a/LPP_drivers/exemples/Makefile +++ b/LPP_drivers/exemples/Makefile @@ -26,4 +26,5 @@ all: make all -C BenchUART make all -C BenchFFT make all -C BenchGPIO + make all -C BenchMatrix diff --git a/LPP_drivers/includes/apb_Matrix_Driver.h b/LPP_drivers/includes/apb_Matrix_Driver.h new file mode 100644 --- /dev/null +++ b/LPP_drivers/includes/apb_Matrix_Driver.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the LPP VHDL IP LIBRARY +-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Martin Morlot +-- Mail : martin.morlot@lpp.polytechnique.fr +-----------------------------------------------------------------------------*/ +#ifndef APB_MATRIX_DRIVER_H +#define APB_MATRIX_DRIVER_H + +/*! \file apb_Matrix_Driver.h + \brief LPP MATRIX driver. + + This library is written to work with LPP_APB_MATRIX VHDL module from LPP's FreeVHDLIB. + + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ + + +/*=================================================== + T Y P E S D E F +====================================================*/ +/*! \struct APB_MATRIX_REG + \brief Sturcture representing the Matrix registers +*/ +struct APB_MATRIX_REG +{ + int Statu; /**< \brief Statu register, To know wich matrix calcul is doing */ +}; + +typedef volatile struct APB_MATRIX_REG MATRIX_Device; + +/*=================================================== + F U N C T I O N S +====================================================*/ +/*! \fn MATRIX_Device* openMatrix(int count); + \brief Return count Matrix. + + This Function scans APB devices table and returns count Matrix. + + \param count The number of the Matrix you whant to get. For example if you have 3 Matrixs on your SOC you want + to use Matrix0 so count = 0. + \return The pointer to the device. +*/ +MATRIX_Device* openMatrix(int count); + + + + +#endif diff --git a/LPP_drivers/includes/apb_dac_Driver.h b/LPP_drivers/includes/apb_dac_Driver.h --- a/LPP_drivers/includes/apb_dac_Driver.h +++ b/LPP_drivers/includes/apb_dac_Driver.h @@ -38,7 +38,7 @@ struct DAC_Driver int dataReg; /**< Registre de donnée sur 16 bits */ }; -typedef struct DAC_Driver DAC_Device; +typedef volatile struct DAC_Driver DAC_Device; /*=================================================== F U N C T I O N S diff --git a/LPP_drivers/includes/apb_delay_Driver.h b/LPP_drivers/includes/apb_delay_Driver.h --- a/LPP_drivers/includes/apb_delay_Driver.h +++ b/LPP_drivers/includes/apb_delay_Driver.h @@ -19,21 +19,33 @@ -- Author : Martin Morlot -- Mail : martin.morlot@lpp.polytechnique.fr -----------------------------------------------------------------------------*/ -#ifndef APB_FIFO_DRIVER_H -#define APB_FIFO_DRIVER_H +#ifndef APB_DELAY_DRIVER_H +#define APB_DELAY_DRIVER_H +/*! \file apb_delay_Driver.h + \brief LPP Interupt driver. + + This library is written to work with LPP_APB_DELAY VHDL module from LPP's FreeVHDLIB. -#define Delay_End 0x111 + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ + +#define Delay_End 0x00001000 /**< Used to know when the VHDL delay counter stoped counting */ /*=================================================== T Y P E S D E F ====================================================*/ - +/*! \struct DELAY_REG + \brief Sturcture representing the Delay registers +*/ struct DELAY_REG { - int Cfg; - int Fboard; - int Timer; + int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0] + Start Flag [HEX 1] + End Flag Received [HEX 2] + End Flag [HEX 3] */ + int Fboard; /**< \brief Board Frequency register */ + int Timer; /**< \brief Delay duration register */ }; typedef volatile struct DELAY_REG DELAY_Device; @@ -41,12 +53,61 @@ typedef volatile struct DELAY_REG DELAY_ /*=================================================== F U N C T I O N S ====================================================*/ +/*! \fn DELAY_Device* openDELAY(int count); + \brief Return count Delay. + + This Function scans APB devices table and returns count Delay. + + \param count The number of the Delay you whant to get. For example if you have 3 Delays on your SOC you want + to use Delay1 so count = 1. + \return The pointer to the device. +*/ +DELAY_Device* openDELAY(int count); -DELAY_Device* openDELAY(int count); +/*! \fn int Setup(DELAY_Device* dev,int X); + \brief Setup the device + + This function setup the device, reset and Board frequency. + + \param dev The Delay pointer. + \param X the Board frequency. +*/ +int Setup(DELAY_Device* dev,int X); + +/*! \fn int Delay_us(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in microsecond. + + \param dev The Delay pointer. + \param T the Delay duration in us. +*/ int Delay_us(DELAY_Device* dev,int T); + +/*! \fn int Delay_ms(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in milisecond. + + \param dev The Delay pointer. + \param T the Delay duration in ms. +*/ int Delay_ms(DELAY_Device* dev,int T); + +/*! \fn int Delay_s(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in second. + + \param dev The Delay pointer. + \param T the Delay duration in s. +*/ int Delay_s(DELAY_Device* dev,int T); -int Setup(DELAY_Device* dev,int X); + + + + + #endif diff --git a/LPP_drivers/includes/apb_fft_Driver.h b/LPP_drivers/includes/apb_fft_Driver.h --- a/LPP_drivers/includes/apb_fft_Driver.h +++ b/LPP_drivers/includes/apb_fft_Driver.h @@ -28,7 +28,6 @@ This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms, from an input data table. - \todo Check "DEVICE1 => count = 2" function Open \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ @@ -56,7 +55,7 @@ struct FFT_Driver int WriteAddrReg; /**< \brief Address register for the writing operation */ }; -typedef struct FFT_Driver FFT_Device; +typedef volatile struct FFT_Driver FFT_Device; /*=================================================== @@ -68,7 +67,7 @@ typedef struct FFT_Driver FFT_Device; This Function scans APB devices table and returns count FFT. \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want - to use FFT1 so count = 2. + to use FFT1 so count = 1. \return The pointer to the device. */ FFT_Device* openFFT(int count); diff --git a/LPP_drivers/includes/apb_fifo_Driver.h b/LPP_drivers/includes/apb_fifo_Driver.h --- a/LPP_drivers/includes/apb_fifo_Driver.h +++ b/LPP_drivers/includes/apb_fifo_Driver.h @@ -28,9 +28,12 @@ This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working, used in many type of application. - \todo Check "DEVICE1 => count = 2" function Open \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ +#define FIFO_Empty 0x00000100 /**< Show that the FIFO is Empty */ +#define FIFO_Full 0x00001000 /**< Show that the FIFO is Full */ +#define Boucle 0x00110000 /**< Configuration for reused the same value of the FIFO */ +#define NoBoucle 0xFFEEFFFF /**< Unlock the previous configuration */ /*=================================================== @@ -48,13 +51,15 @@ struct APB_FIFO_REG Write enable Flag [HEX 1] Empty Flag [HEX 2] Full Flag [HEX 3] - Dummy "C" [HEX 4/5/6/7] */ + ReUse Flag [HEX 4] + Lock Flag [HEX 5] + Dummy "C" [HEX 6/7] */ int dummy0; /**< \brief Unused register, aesthetic interest */ int dummy1; /**< \brief Unused register, aesthetic interest */ int waddr; /**< \brief Address register for the writing operation */ }; -typedef struct APB_FIFO_REG APB_FIFO_Device; +typedef volatile struct APB_FIFO_REG FIFO_Device; /*=================================================== F U N C T I O N S @@ -66,11 +71,20 @@ typedef struct APB_FIFO_REG APB_FIFO_Dev This Function scans APB devices table and returns count FIFO. \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want - to use FIFO1 so count = 2. + to use FIFO1 so count = 1. \return The pointer to the device. */ -APB_FIFO_Device* apbfifoOpen(int count); +FIFO_Device* openFIFO(int count); - +/*! \fn int FillFifo(FIFO_Device* dev,int Tbl[],int A); + \brief a Fill in FIFO function. + + This Function fill in the FIFO with a table data. + + \param dev The FFT pointer. + \param Tbl[] The data table. + \param A The data table size. +*/ +int FillFifo(FIFO_Device* dev,int Tbl[],int A); #endif diff --git a/LPP_drivers/includes/apb_gpio_Driver.h b/LPP_drivers/includes/apb_gpio_Driver.h --- a/LPP_drivers/includes/apb_gpio_Driver.h +++ b/LPP_drivers/includes/apb_gpio_Driver.h @@ -22,24 +22,41 @@ #ifndef APB_GPIO_DRIVER_H #define APB_GPIO_DRIVER_H +/*! \file apb_gpio_Driver.h + \brief Gaisler GPIO driver. + + This library is written to work with Gaisler GPIO VHDL module. + + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ /*=================================================== T Y P E S D E F ====================================================*/ - +/*! \struct GPIO_REG + \brief Sturcture representing the gpio registers +*/ struct GPIO_REG { - int Din; - int Dout; - int oen; + int Din; /**< \brief Input GPIO register */ + int Dout; /**< \brief Output GPIO register */ + int oen; /**< \brief Enable GPIO register */ }; -typedef struct GPIO_REG GPIO_Device; +typedef volatile struct GPIO_REG GPIO_Device; /*=================================================== F U N C T I O N S ====================================================*/ - +/*! \fn GPIO_Device* openGPIO(int count); + \brief Return count GPIO. + + This Function scans APB devices table and returns count GPIO. + + \param count The number of the GPIO you whant to get. For example if you have 3 GPIOs on your SOC you want + to use GPIO1 so count = 1. + \return The pointer to the device. +*/ GPIO_Device* openGPIO(int count); diff --git a/LPP_drivers/includes/apb_uart_Driver.h b/LPP_drivers/includes/apb_uart_Driver.h --- a/LPP_drivers/includes/apb_uart_Driver.h +++ b/LPP_drivers/includes/apb_uart_Driver.h @@ -26,9 +26,8 @@ \brief LPP Uart driver. This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get, - char or strings over uart. - - \todo Check "DEVICE1 => count = 2" function Open + char or strings over uart. + \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ @@ -56,7 +55,7 @@ struct UART_Driver int DataRReg; /**< \brief Data Read register */ }; -typedef struct UART_Driver UART_Device; +typedef volatile struct UART_Driver UART_Device; /*=================================================== @@ -69,7 +68,7 @@ typedef struct UART_Driver UART_Device; This Function scans APB devices table and returns count UART. \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want - to use UART1 so count = 2. + to use UART1 so count = 1. \return The pointer to the device. */ UART_Device* openUART(int count); diff --git a/LPP_drivers/libsrc/DAC/apb_dac_Driver.h b/LPP_drivers/libsrc/DAC/apb_dac_Driver.h --- a/LPP_drivers/libsrc/DAC/apb_dac_Driver.h +++ b/LPP_drivers/libsrc/DAC/apb_dac_Driver.h @@ -38,7 +38,7 @@ struct DAC_Driver int dataReg; /**< Registre de donnée sur 16 bits */ }; -typedef struct DAC_Driver DAC_Device; +typedef volatile struct DAC_Driver DAC_Device; /*=================================================== F U N C T I O N S diff --git a/LPP_drivers/libsrc/DELAY/apb_delay_Driver.c b/LPP_drivers/libsrc/DELAY/apb_delay_Driver.c --- a/LPP_drivers/libsrc/DELAY/apb_delay_Driver.c +++ b/LPP_drivers/libsrc/DELAY/apb_delay_Driver.c @@ -34,6 +34,7 @@ DELAY_Device* openDELAY(int count) int Setup(DELAY_Device* dev,int X) { dev->Fboard = X; + dev->Cfg = 0x001; return dev->Fboard; } @@ -41,9 +42,9 @@ int Setup(DELAY_Device* dev,int X) int Delay_s(DELAY_Device* dev,int T) { dev->Timer = dev->Fboard * T; - dev->Cfg = 0x11; - while(dev->Cfg != Delay_End); - dev->Cfg = 0x01; + dev->Cfg = 0x011; + while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN + dev->Cfg = 0x101; return dev->Cfg; } @@ -51,9 +52,9 @@ int Delay_s(DELAY_Device* dev,int T) int Delay_ms(DELAY_Device* dev,int T) { dev->Timer = (dev->Fboard / 1000) * T; - dev->Cfg = 0x11; - while(dev->Cfg != Delay_End); - dev->Cfg = 0x01; + dev->Cfg = 0x011; + while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN + dev->Cfg = 0x101; return dev->Cfg; } @@ -61,9 +62,9 @@ int Delay_ms(DELAY_Device* dev,int T) int Delay_us(DELAY_Device* dev,int T) { dev->Timer = (dev->Fboard / 1000000) * T; - dev->Cfg = 0x11; - while(dev->Cfg != Delay_End); - dev->Cfg = 0x01; + dev->Cfg = 0x011; + while((dev->Cfg & Delay_End)!= Delay_End); // TANT QUE end a 0 RIEN + dev->Cfg = 0x101; return dev->Cfg; } diff --git a/LPP_drivers/libsrc/DELAY/apb_delay_Driver.h b/LPP_drivers/libsrc/DELAY/apb_delay_Driver.h --- a/LPP_drivers/libsrc/DELAY/apb_delay_Driver.h +++ b/LPP_drivers/libsrc/DELAY/apb_delay_Driver.h @@ -19,21 +19,33 @@ -- Author : Martin Morlot -- Mail : martin.morlot@lpp.polytechnique.fr -----------------------------------------------------------------------------*/ -#ifndef APB_FIFO_DRIVER_H -#define APB_FIFO_DRIVER_H +#ifndef APB_DELAY_DRIVER_H +#define APB_DELAY_DRIVER_H +/*! \file apb_delay_Driver.h + \brief LPP Interupt driver. + + This library is written to work with LPP_APB_DELAY VHDL module from LPP's FreeVHDLIB. -#define Delay_End 0x111 + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ + +#define Delay_End 0x00001000 /**< Used to know when the VHDL delay counter stoped counting */ /*=================================================== T Y P E S D E F ====================================================*/ - +/*! \struct DELAY_REG + \brief Sturcture representing the Delay registers +*/ struct DELAY_REG { - int Cfg; - int Fboard; - int Timer; + int Cfg; /**< \brief Configuration register composed of Reset function [HEX 0] + Start Flag [HEX 1] + End Flag Received [HEX 2] + End Flag [HEX 3] */ + int Fboard; /**< \brief Board Frequency register */ + int Timer; /**< \brief Delay duration register */ }; typedef volatile struct DELAY_REG DELAY_Device; @@ -41,12 +53,61 @@ typedef volatile struct DELAY_REG DELAY_ /*=================================================== F U N C T I O N S ====================================================*/ +/*! \fn DELAY_Device* openDELAY(int count); + \brief Return count Delay. + + This Function scans APB devices table and returns count Delay. + + \param count The number of the Delay you whant to get. For example if you have 3 Delays on your SOC you want + to use Delay1 so count = 1. + \return The pointer to the device. +*/ +DELAY_Device* openDELAY(int count); -DELAY_Device* openDELAY(int count); +/*! \fn int Setup(DELAY_Device* dev,int X); + \brief Setup the device + + This function setup the device, reset and Board frequency. + + \param dev The Delay pointer. + \param X the Board frequency. +*/ +int Setup(DELAY_Device* dev,int X); + +/*! \fn int Delay_us(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in microsecond. + + \param dev The Delay pointer. + \param T the Delay duration in us. +*/ int Delay_us(DELAY_Device* dev,int T); + +/*! \fn int Delay_ms(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in milisecond. + + \param dev The Delay pointer. + \param T the Delay duration in ms. +*/ int Delay_ms(DELAY_Device* dev,int T); + +/*! \fn int Delay_s(DELAY_Device* dev,int T); + \brief Generate delay + + This function genrate a delay in second. + + \param dev The Delay pointer. + \param T the Delay duration in s. +*/ int Delay_s(DELAY_Device* dev,int T); -int Setup(DELAY_Device* dev,int X); + + + + + #endif diff --git a/LPP_drivers/libsrc/FFT/apb_fft_Driver.h b/LPP_drivers/libsrc/FFT/apb_fft_Driver.h --- a/LPP_drivers/libsrc/FFT/apb_fft_Driver.h +++ b/LPP_drivers/libsrc/FFT/apb_fft_Driver.h @@ -28,7 +28,6 @@ This library is written to work with LPP_APB_FFT VHDL module from LPP's FreeVHDLIB. It calculate a fast fourier transforms, from an input data table. - \todo Check "DEVICE1 => count = 2" function Open \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ @@ -56,7 +55,7 @@ struct FFT_Driver int WriteAddrReg; /**< \brief Address register for the writing operation */ }; -typedef struct FFT_Driver FFT_Device; +typedef volatile struct FFT_Driver FFT_Device; /*=================================================== @@ -68,7 +67,7 @@ typedef struct FFT_Driver FFT_Device; This Function scans APB devices table and returns count FFT. \param count The number of the FFT you whant to get. For example if you have 3 FFTS on your SOC you want - to use FFT1 so count = 2. + to use FFT1 so count = 1. \return The pointer to the device. */ FFT_Device* openFFT(int count); diff --git a/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.c b/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.c --- a/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.c +++ b/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.c @@ -24,12 +24,22 @@ #include -APB_FIFO_Device* apbfifoOpen(int count) +FIFO_Device* openFIFO(int count) { - APB_FIFO_Device* fifo0; - fifo0 = (APB_FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count); + FIFO_Device* fifo0; + fifo0 = (FIFO_Device*) apbgetdevice(LPP_FIFO,VENDOR_LPP,count); return fifo0; } - - + +int FillFifo(FIFO_Device* dev,int Tbl[],int A) +{ + int i=0; + while(i <= A) + { + dev->rwdata = Tbl[i]; + i++; + } + + return 0; +} diff --git a/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.h b/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.h --- a/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.h +++ b/LPP_drivers/libsrc/FIFO/apb_fifo_Driver.h @@ -28,9 +28,12 @@ This library is written to work with LPP_APB_FIFO VHDL module from LPP's FreeVHDLIB. It represents a standard FIFO working, used in many type of application. - \todo Check "DEVICE1 => count = 2" function Open \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ +#define FIFO_Empty 0x00000100 /**< Show that the FIFO is Empty */ +#define FIFO_Full 0x00001000 /**< Show that the FIFO is Full */ +#define Boucle 0x00110000 /**< Configuration for reused the same value of the FIFO */ +#define NoBoucle 0xFFEEFFFF /**< Unlock the previous configuration */ /*=================================================== @@ -48,13 +51,15 @@ struct APB_FIFO_REG Write enable Flag [HEX 1] Empty Flag [HEX 2] Full Flag [HEX 3] - Dummy "C" [HEX 4/5/6/7] */ + ReUse Flag [HEX 4] + Lock Flag [HEX 5] + Dummy "C" [HEX 6/7] */ int dummy0; /**< \brief Unused register, aesthetic interest */ int dummy1; /**< \brief Unused register, aesthetic interest */ int waddr; /**< \brief Address register for the writing operation */ }; -typedef struct APB_FIFO_REG APB_FIFO_Device; +typedef volatile struct APB_FIFO_REG FIFO_Device; /*=================================================== F U N C T I O N S @@ -66,11 +71,20 @@ typedef struct APB_FIFO_REG APB_FIFO_Dev This Function scans APB devices table and returns count FIFO. \param count The number of the FIFO you whant to get. For example if you have 3 FIFOS on your SOC you want - to use FIFO1 so count = 2. + to use FIFO1 so count = 1. \return The pointer to the device. */ -APB_FIFO_Device* apbfifoOpen(int count); +FIFO_Device* openFIFO(int count); - +/*! \fn int FillFifo(FIFO_Device* dev,int Tbl[],int A); + \brief a Fill in FIFO function. + + This Function fill in the FIFO with a table data. + + \param dev The FFT pointer. + \param Tbl[] The data table. + \param A The data table size. +*/ +int FillFifo(FIFO_Device* dev,int Tbl[],int A); #endif diff --git a/LPP_drivers/libsrc/GPIO/apb_gpio_Driver.h b/LPP_drivers/libsrc/GPIO/apb_gpio_Driver.h --- a/LPP_drivers/libsrc/GPIO/apb_gpio_Driver.h +++ b/LPP_drivers/libsrc/GPIO/apb_gpio_Driver.h @@ -22,24 +22,41 @@ #ifndef APB_GPIO_DRIVER_H #define APB_GPIO_DRIVER_H +/*! \file apb_gpio_Driver.h + \brief Gaisler GPIO driver. + + This library is written to work with Gaisler GPIO VHDL module. + + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ /*=================================================== T Y P E S D E F ====================================================*/ - +/*! \struct GPIO_REG + \brief Sturcture representing the gpio registers +*/ struct GPIO_REG { - int Din; - int Dout; - int oen; + int Din; /**< \brief Input GPIO register */ + int Dout; /**< \brief Output GPIO register */ + int oen; /**< \brief Enable GPIO register */ }; -typedef struct GPIO_REG GPIO_Device; +typedef volatile struct GPIO_REG GPIO_Device; /*=================================================== F U N C T I O N S ====================================================*/ - +/*! \fn GPIO_Device* openGPIO(int count); + \brief Return count GPIO. + + This Function scans APB devices table and returns count GPIO. + + \param count The number of the GPIO you whant to get. For example if you have 3 GPIOs on your SOC you want + to use GPIO1 so count = 1. + \return The pointer to the device. +*/ GPIO_Device* openGPIO(int count); diff --git a/LPP_drivers/libsrc/MATRIX/Makefile b/LPP_drivers/libsrc/MATRIX/Makefile new file mode 100644 --- /dev/null +++ b/LPP_drivers/libsrc/MATRIX/Makefile @@ -0,0 +1,25 @@ +#------------------------------------------------------------------------------ +#-- This file is a part of the LPP VHDL IP LIBRARY +#-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS +#-- +#-- This program is free software; you can redistribute it and/or modify +#-- it under the terms of the GNU General Public License as published by +#-- the Free Software Foundation; either version 3 of the License, or +#-- (at your option) any later version. +#-- +#-- This program is distributed in the hope that it will be useful, +#-- but WITHOUT ANY WARRANTY; without even the implied warranty of +#-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#-- GNU General Public License for more details. +#-- +#-- You should have received a copy of the GNU General Public License +#-- along with this program; if not, write to the Free Software +#-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +#------------------------------------------------------------------------------ +FILE = apb_Matrix_Driver +LIB = liblpp_Matrix_Driver.a + +include ../../rules.mk + +all: $(FILE).a + @echo $(FILE)".a created" diff --git a/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.c b/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.c new file mode 100644 --- /dev/null +++ b/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.c @@ -0,0 +1,35 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the LPP VHDL IP LIBRARY +-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Martin Morlot +-- Mail : martin.morlot@lpp.polytechnique.fr +-----------------------------------------------------------------------------*/ +#include "lpp_apb_functions.h" +#include "apb_Matrix_Driver.h" +#include + + +MATRIX_Device* openMatrix(int count) +{ + MATRIX_Device* Mspec0; + Mspec0 = (MATRIX_Device*) apbgetdevice(LPP_MATRIX,VENDOR_LPP,count); + return Mspec0; +} + + + diff --git a/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.h b/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.h new file mode 100644 --- /dev/null +++ b/LPP_drivers/libsrc/MATRIX/apb_Matrix_Driver.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------------ +-- This file is a part of the LPP VHDL IP LIBRARY +-- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +------------------------------------------------------------------------------- +-- Author : Martin Morlot +-- Mail : martin.morlot@lpp.polytechnique.fr +-----------------------------------------------------------------------------*/ +#ifndef APB_MATRIX_DRIVER_H +#define APB_MATRIX_DRIVER_H + +/*! \file apb_Matrix_Driver.h + \brief LPP MATRIX driver. + + This library is written to work with LPP_APB_MATRIX VHDL module from LPP's FreeVHDLIB. + + \author Martin Morlot martin.morlot@lpp.polytechnique.fr +*/ + + +/*=================================================== + T Y P E S D E F +====================================================*/ +/*! \struct APB_MATRIX_REG + \brief Sturcture representing the Matrix registers +*/ +struct APB_MATRIX_REG +{ + int Statu; /**< \brief Statu register, To know wich matrix calcul is doing */ +}; + +typedef volatile struct APB_MATRIX_REG MATRIX_Device; + +/*=================================================== + F U N C T I O N S +====================================================*/ +/*! \fn MATRIX_Device* openMatrix(int count); + \brief Return count Matrix. + + This Function scans APB devices table and returns count Matrix. + + \param count The number of the Matrix you whant to get. For example if you have 3 Matrixs on your SOC you want + to use Matrix0 so count = 0. + \return The pointer to the device. +*/ +MATRIX_Device* openMatrix(int count); + + + + +#endif diff --git a/LPP_drivers/libsrc/Makefile b/LPP_drivers/libsrc/Makefile --- a/LPP_drivers/libsrc/Makefile +++ b/LPP_drivers/libsrc/Makefile @@ -30,6 +30,7 @@ all: make all -C FFT make all -C DELAY make all -C GPIO + make all -C MATRIX cleanall: @@ -41,4 +42,5 @@ cleanall: make clean -C FFT make clean -C DELAY make clean -C GPIO + make clean -C MATRIX diff --git a/LPP_drivers/libsrc/UART/apb_uart_Driver.h b/LPP_drivers/libsrc/UART/apb_uart_Driver.h --- a/LPP_drivers/libsrc/UART/apb_uart_Driver.h +++ b/LPP_drivers/libsrc/UART/apb_uart_Driver.h @@ -26,9 +26,8 @@ \brief LPP Uart driver. This library is written to work with LPP_APB_UART VHDL module from LPP's FreeVHDLIB. It help you to print and get, - char or strings over uart. - - \todo Check "DEVICE1 => count = 2" function Open + char or strings over uart. + \author Martin Morlot martin.morlot@lpp.polytechnique.fr */ @@ -56,7 +55,7 @@ struct UART_Driver int DataRReg; /**< \brief Data Read register */ }; -typedef struct UART_Driver UART_Device; +typedef volatile struct UART_Driver UART_Device; /*=================================================== @@ -69,7 +68,7 @@ typedef struct UART_Driver UART_Device; This Function scans APB devices table and returns count UART. \param count The number of the UART you whant to get. For example if you have 3 UARTS on your SOC you want - to use UART1 so count = 2. + to use UART1 so count = 1. \return The pointer to the device. */ UART_Device* openUART(int count); diff --git a/lib/lpp/general_purpose/lpp_delay/APB_Delay.vhd b/lib/lpp/general_purpose/lpp_delay/APB_Delay.vhd --- a/lib/lpp/general_purpose/lpp_delay/APB_Delay.vhd +++ b/lib/lpp/general_purpose/lpp_delay/APB_Delay.vhd @@ -57,7 +57,7 @@ constant pconfig : apb_config_type := ( 1 => apb_iobar(paddr, pmask)); type DELAY_ctrlr_Reg is record - Delay_CFG : std_logic_vector(2 downto 0); + Delay_CFG : std_logic_vector(3 downto 0); Delay_FreqBoard : std_logic_vector(25 downto 0); Delay_Timer : std_logic_vector(25 downto 0); end record; @@ -67,25 +67,28 @@ signal Rdata : std_logic_vector(31 downt signal Flag_st : std_logic; signal Flag_end : std_logic; +signal Flag_OKend : std_logic; signal Rz : std_logic; signal Raz : std_logic; begin Flag_st <= Rec.Delay_CFG(1); -Rec.Delay_CFG(2) <= Flag_end; +Rec.Delay_CFG(3) <= Flag_end; Rz <= Rec.Delay_CFG(0); +Flag_OKend <= Rec.Delay_CFG(2); Raz <= rst and Rz; Delay0 : TimerDelay - port map(clk,Raz,Flag_st,Flag_end,Rec.Delay_Timer); + port map(clk,Raz,Flag_st,Flag_OKend,Flag_end,Rec.Delay_Timer); process(rst,clk) begin if(rst='0')then Rec.Delay_FreqBoard <= (others => '0'); Rec.Delay_Timer <= (others => '0'); + Rec.Delay_CFG(2 downto 0) <= (others => '0'); elsif(clk'event and clk='1')then @@ -95,8 +98,9 @@ Delay0 : TimerDelay when "000000" => Rec.Delay_CFG(0) <= apbi.pwdata(0); Rec.Delay_CFG(1) <= apbi.pwdata(4); + Rec.Delay_CFG(2) <= apbi.pwdata(8); when "000001" => - Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0); + Rec.Delay_FreqBoard <= apbi.pwdata(25 downto 0); when "000010" => Rec.Delay_Timer <= apbi.pwdata(25 downto 0); when others => @@ -104,11 +108,12 @@ Delay0 : TimerDelay end case; end if; - --APB READ OP + --APB Read OP if (apbi.psel(pindex) and (not apbi.pwrite)) = '1' then case apbi.paddr(abits-1 downto 2) is when "000000" => - Rdata(31 downto 12) <= (others => '0'); + Rdata(31 downto 16) <= (others => '0'); + Rdata(15 downto 12) <= "000" & Rec.Delay_CFG(3); Rdata(11 downto 8) <= "000" & Rec.Delay_CFG(2); Rdata(7 downto 4) <= "000" & Rec.Delay_CFG(1); Rdata(3 downto 0) <= "000" & Rec.Delay_CFG(0); diff --git a/lib/lpp/general_purpose/lpp_delay/TimerDelay.vhd b/lib/lpp/general_purpose/lpp_delay/TimerDelay.vhd --- a/lib/lpp/general_purpose/lpp_delay/TimerDelay.vhd +++ b/lib/lpp/general_purpose/lpp_delay/TimerDelay.vhd @@ -8,6 +8,7 @@ port( clk : in std_logic; raz : in std_logic; Start : in std_logic; + OKfin : in std_logic; Fin : out std_logic; Cpt : in std_logic_vector(25 downto 0) ); @@ -16,14 +17,14 @@ end TimerDelay; architecture ar_TimerDelay of TimerDelay is -type state is (stX,st1); +type state is (stX,st1,st2); signal ect : state; constant MAX : integer := 67_108_863; signal delay : integer range 0 to MAX; signal compt : integer range 0 to MAX; -signal Start_reg : std_logic; +--signal Start_reg : std_logic; begin @@ -35,31 +36,37 @@ delay <= to_integer(unsigned(Cpt)); if(raz='0')then Fin <= '1'; - Start_reg <= '0'; + --Start_reg <= '0'; ect <= stX; elsif(clk'event and clk='1')then - Start_reg <= Start; + --Start_reg <= Start; case ect is - when stX => - if(Start_reg = '0' and Start = '1')then - Fin <= '0'; + when stX => + if(Start = '1')then + --OKst <= '1'; ect <= st1; end if; - when st1 => if(compt = delay)then compt <= 0; + --OKst <= '0'; Fin <= '1'; - ect <= stX; + ect <= st2; else compt <= compt + 1; ect <= st1; - end if; + end if; + when st2 => + if(OKfin = '1')then + Fin <= '0'; + ect <= stX; + end if; + end case; end if; end process; diff --git a/lib/lpp/general_purpose/lpp_delay/lpp_delay.vhd b/lib/lpp/general_purpose/lpp_delay/lpp_delay.vhd --- a/lib/lpp/general_purpose/lpp_delay/lpp_delay.vhd +++ b/lib/lpp/general_purpose/lpp_delay/lpp_delay.vhd @@ -50,9 +50,10 @@ component TimerDelay is port( clk : in std_logic; raz : in std_logic; - Start : in std_logic; - Fin : out std_logic; - Cpt : in std_logic_vector(25 downto 0) + Start : in std_logic; + OKfin : in std_logic; + Fin : out std_logic; + Cpt : in std_logic_vector(25 downto 0) ); end component;