From bebee7c64403bf604c6995f06f091eab7e186df6 Mon Sep 17 00:00:00 2001 From: Juan64Bits Date: Mon, 5 Apr 2010 14:06:50 -0500 Subject: [PATCH] Fixing LOGIC and QT_src files. --- Examples/ADC/QT_src/ADC | Bin 0 -> 41849 bytes Examples/ADC/QT_src/ADC1.pro | 23 ++ Examples/ADC/QT_src/ADC1.pro.user | 205 +++++++++++++++++ Examples/ADC/QT_src/ADCw.cpp | 74 ++++++ Examples/ADC/QT_src/ADCw.h | 21 ++ Examples/ADC/QT_src/Makefile | 265 ++++++++++++++++++++++ Examples/ADC/QT_src/jz47xx_gpio.c | 108 +++++++++ Examples/ADC/QT_src/jz47xx_gpio.cpp | 108 +++++++++ Examples/ADC/QT_src/jz47xx_gpio.h | 84 +++++++ Examples/ADC/QT_src/jz47xx_mmap.c | 39 ++++ Examples/ADC/QT_src/jz47xx_mmap.cpp | 39 ++++ Examples/ADC/QT_src/jz47xx_mmap.h | 14 ++ Examples/ADC/QT_src/jz_adc_peripheral.c | 36 +++ Examples/ADC/QT_src/jz_adc_peripheral.cpp | 59 +++++ Examples/ADC/QT_src/jz_adc_peripheral.h | 84 +++++++ Examples/ADC/QT_src/jz_test_adc.c | 110 +++++++++ Examples/ADC/QT_src/main.cpp | 10 + Examples/ADC/QT_src/mainwindow.cpp | 47 ++++ Examples/ADC/QT_src/mainwindow.h | 32 +++ Examples/ADC/QT_src/mainwindow.ui | 62 +++++ Examples/ADC/QT_src/signaldisplay.cpp | 60 +++++ Examples/ADC/QT_src/signaldisplay.h | 31 +++ Examples/ADC/logic/ADC_peripheral.v | 210 +++++++++++------ 23 files changed, 1651 insertions(+), 70 deletions(-) create mode 100755 Examples/ADC/QT_src/ADC create mode 100644 Examples/ADC/QT_src/ADC1.pro create mode 100644 Examples/ADC/QT_src/ADC1.pro.user create mode 100644 Examples/ADC/QT_src/ADCw.cpp create mode 100644 Examples/ADC/QT_src/ADCw.h create mode 100644 Examples/ADC/QT_src/Makefile create mode 100644 Examples/ADC/QT_src/jz47xx_gpio.c create mode 100644 Examples/ADC/QT_src/jz47xx_gpio.cpp create mode 100644 Examples/ADC/QT_src/jz47xx_gpio.h create mode 100644 Examples/ADC/QT_src/jz47xx_mmap.c create mode 100644 Examples/ADC/QT_src/jz47xx_mmap.cpp create mode 100644 Examples/ADC/QT_src/jz47xx_mmap.h create mode 100644 Examples/ADC/QT_src/jz_adc_peripheral.c create mode 100644 Examples/ADC/QT_src/jz_adc_peripheral.cpp create mode 100644 Examples/ADC/QT_src/jz_adc_peripheral.h create mode 100644 Examples/ADC/QT_src/jz_test_adc.c create mode 100755 Examples/ADC/QT_src/main.cpp create mode 100755 Examples/ADC/QT_src/mainwindow.cpp create mode 100755 Examples/ADC/QT_src/mainwindow.h create mode 100755 Examples/ADC/QT_src/mainwindow.ui create mode 100755 Examples/ADC/QT_src/signaldisplay.cpp create mode 100755 Examples/ADC/QT_src/signaldisplay.h diff --git a/Examples/ADC/QT_src/ADC b/Examples/ADC/QT_src/ADC new file mode 100755 index 0000000000000000000000000000000000000000..e7bd47e7dfaedbb2ef9f59604ce934d858c217b3 GIT binary patch literal 41849 zcmeHw4R}pzr?(9Jb+$X(1y`4u#-@G&5eDn9s@6I{%U{mW_o6RO{!Z3E>lJ+TIKvctNC?!OJ zTLi0xM_eV!#WFmFaHn6jAWuMe5SUK^+?;qEcshVPYytU{0P~?AoM{q0u=K#6PbnPu z&|l*L3drZd?LzROd`h5g6yb@HjT3o(U<>7qZZVhBt_kjgFmbn85RB_56yw{SH@#ISH>eN1{z@Lsz~)$_{2Zk#0iZ}TF2h5 zLu!pOA$@DEVgH#)o%0O5*raPrdWT6rYtn1o2HzT!?gK4`yd&iSF$Z*VQ$Xf>(jJgy z=vfeuW#zdlAZEk=r{FIF1rgVvZcdH}q7i|2L7W!OnXRtf);i2v7_OurBA8BqF7 zfzG`#0NeXBzXm(wzX1>HPniZ-uEX<5Jj~0b%q{R}#Pex9aXbM$G#|sW4Nnh&X2PcZ z9?(1SJc6gybkh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}}mI z$u3Z7u%(*OjxF0X`bcP1Oe6V~34WoDAE?VtT(gB-(;bV)x3C#--ayM1405s)g(l?s zbCj!foXWc;KCjeF0e)Ys4{!g)(7?^P%7(lm^Y!NXO*!tey=R^LHD&{C$2>n(zgNz9 zrk`L{-5cGj_b|7#ZHVqQyO&(!x+RkAPvkVdQ6Xx4cADY8C{e1LQ|hQ1kiR;Pv3Vf8 zE81WV(s~nQOaYeugmLhD*L*Vna%Hm_aVj-_-*U43g4wxaLEIzsD#^r+;v z5WXH5>mBIj#19Iem!k0rMY^>L=YCJbvh`$9+Zs&K^Eb1sAk5-09B38X=3uWsXbKP eh@EIT)@5sPwQPe>yPp1tQjRrkEo_*YqxfGqHn0!? literal 0 HcmV?d00001 diff --git a/Examples/ADC/QT_src/ADC1.pro b/Examples/ADC/QT_src/ADC1.pro new file mode 100644 index 0000000..e261ef4 --- /dev/null +++ b/Examples/ADC/QT_src/ADC1.pro @@ -0,0 +1,23 @@ +# ##################################################################### +# Automatically generated by qmake (2.01a) Sat Apr 3 14:28:42 2010 +# ##################################################################### +TEMPLATE = app +TARGET = ADC +DEPENDPATH += . +INCLUDEPATH += . + +# Input +HEADERS += mainwindow.h \ + jz47xx_mmap.h \ + signaldisplay.h \ + ADCw.h \ + jz_adc_peripheral.h \ + jz47xx_gpio.h +FORMS += mainwindow.ui +SOURCES += main.cpp \ + mainwindow.cpp \ + signaldisplay.cpp \ + ADCw.cpp \ + jz_adc_peripheral.cpp \ + jz47xx_gpio.cpp \ + jz47xx_mmap.cpp diff --git a/Examples/ADC/QT_src/ADC1.pro.user b/Examples/ADC/QT_src/ADC1.pro.user new file mode 100644 index 0000000..6725c31 --- /dev/null +++ b/Examples/ADC/QT_src/ADC1.pro.user @@ -0,0 +1,205 @@ + + + + RunConfiguration0-Arguments + + + + RunConfiguration0-Executable + + + + RunConfiguration0-RunConfiguration.name + Custom Executable + + + RunConfiguration0-UseTerminal + false + + + RunConfiguration0-UserEnvironmentChanges + + + + RunConfiguration0-UserName + + + + RunConfiguration0-UserSetName + false + + + RunConfiguration0-WorkingDirectory + $BUILDDIR + + + RunConfiguration0-type + ProjectExplorer.CustomExecutableRunConfiguration + + + activeRunConfiguration + 0 + + + activebuildconfiguration + Debug + + + buildConfiguration-Debug + + Debug + 2 + + + + + buildconfiguration-Debug-buildstep0 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cTqMrTHqN2,guid=cb05698ea245dbdf49f1995a4bb51c63 + DESKTOP_SESSION=gnome + DESKTOP_STARTUP_ID= + DISPLAY=:0.0 + GDMSESSION=gnome + GDM_KEYBOARD_LAYOUT=es + GDM_LANG=en_US.UTF-8 + GNOME_DESKTOP_SESSION_ID=this-is-deprecated + GNOME_KEYRING_PID=2296 + GNOME_KEYRING_SOCKET=/tmp/keyring-Z9jTYs/socket + GTK_MODULES=canberra-gtk-module + GTK_RC_FILES=/etc/gtk/gtkrc:/home/juan64bits/.gtkrc-1.2-gnome2 + HOME=/home/juan64bits + LANG=en_US.UTF-8 + LANGUAGE= + LD_LIBRARY_PATH=/usr/lib/qtcreator: + LOGNAME=juan64bits + ORBIT_SOCKETDIR=/tmp/orbit-juan64bits + PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games + PWD=/home/juan64bits + QTDIR=/usr + SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/2311,unix/Maximus:/tmp/.ICE-unix/2311 + SHELL=/bin/bash + SHLVL=0 + SPEECHD_PORT=7560 + SSH_AGENT_PID=2357 + SSH_AUTH_SOCK=/tmp/keyring-Z9jTYs/socket.ssh + USER=juan64bits + USERNAME=juan64bits + XAUTHORITY=/var/run/gdm/auth-for-juan64bits-TMPZko/database + XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ + XDG_SESSION_COOKIE=195688a1fd83f711af67c5214b6a489d-1270160483.283912-172210674 + + + /home/juan64bits/QT/ADC1/ADC1.pro + -spec + /usr/share/qt4/mkspecs/linux-g++ + -r + CONFIG+=debug + + /usr/bin/qmake-qt4 + false + /home/juan64bits/QT/ADC1 + 2 + + + + buildconfiguration-Debug-buildstep1 + + Debug + + DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cTqMrTHqN2,guid=cb05698ea245dbdf49f1995a4bb51c63 + DESKTOP_SESSION=gnome + DESKTOP_STARTUP_ID= + DISPLAY=:0.0 + GDMSESSION=gnome + GDM_KEYBOARD_LAYOUT=es + GDM_LANG=en_US.UTF-8 + GNOME_DESKTOP_SESSION_ID=this-is-deprecated + GNOME_KEYRING_PID=2296 + GNOME_KEYRING_SOCKET=/tmp/keyring-Z9jTYs/socket + GTK_MODULES=canberra-gtk-module + GTK_RC_FILES=/etc/gtk/gtkrc:/home/juan64bits/.gtkrc-1.2-gnome2 + HOME=/home/juan64bits + LANG=en_US.UTF-8 + LANGUAGE= + LD_LIBRARY_PATH=/usr/lib/qtcreator: + LOGNAME=juan64bits + ORBIT_SOCKETDIR=/tmp/orbit-juan64bits + PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games + PWD=/home/juan64bits + QTDIR=/usr + SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/2311,unix/Maximus:/tmp/.ICE-unix/2311 + SHELL=/bin/bash + SHLVL=0 + SPEECHD_PORT=7560 + SSH_AGENT_PID=2357 + SSH_AUTH_SOCK=/tmp/keyring-Z9jTYs/socket.ssh + USER=juan64bits + USERNAME=juan64bits + XAUTHORITY=/var/run/gdm/auth-for-juan64bits-TMPZko/database + XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ + XDG_SESSION_COOKIE=195688a1fd83f711af67c5214b6a489d-1270160483.283912-172210674 + + + -w + + /usr/bin/make + true + /home/juan64bits/QT/ADC1 + + + + buildconfiguration-Debug-cleanstep0 + + Debug + + + + buildconfigurations + + Debug + + + + buildstep0 + + + + + + + buildstep1 + + + + + + buildsteps + + trolltech.qt4projectmanager.qmake + trolltech.qt4projectmanager.make + + + + cleanstep0 + + + true + + + + cleansteps + + trolltech.qt4projectmanager.make + + + + defaultFileEncoding + System + + + project + + + diff --git a/Examples/ADC/QT_src/ADCw.cpp b/Examples/ADC/QT_src/ADCw.cpp new file mode 100644 index 0000000..a1f0f26 --- /dev/null +++ b/Examples/ADC/QT_src/ADCw.cpp @@ -0,0 +1,74 @@ +#include "ADCw.h" + +ADCw::ADCw() +{ + ADCBuffer = jz_adc_init(); + /*************************Clean FPGA RAM memory****************************/ + for (int i = 0; i < 512; i++) //RAMB16_s9_s9 has 2048 bytes 8-bit + { + ADCBuffer[i] = 0x00000000; //Clean 4 register by cicle + } +} + +void ADCw::testADC() +{ + /****************Configure ADC register on FPGA RAM memory*****************/ + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_SPI_CLKDIV); + usleep (1000); + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_FAST_CONV); + usleep (1000); + printf("\nADC in Fast Convertion Mode (10us) and Fs=9.8KHz (Min)\n"); + + int LENB = 0xFE; // 254 read/cmd + + /******************************* TEST 1 ***********************************/ + printf("\nINIT TEST1: Autoselft {(Vref+) - (Vref-)}/2 -> Return 0x0200 \n"); + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_1); + usleep (1000); + jz_adc_config(ADCBuffer, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_1); + printf("[%08X]", ADCBuffer[0]);fflush (stdout); + while(jz_adc_check_buffer(ADCBuffer)){usleep (10);} + for(int i=1; i< LENB/2+1; i++) + printf("[%08X]", ADCBuffer[i]); + fflush (stdout); + + /******************************* TEST 2 ***********************************/ + printf("\n\nINIT TEST2: Autoselft (Vref-) -> Return 0x0000 \n"); + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_2); + usleep (1000); + jz_adc_config(ADCBuffer, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_2); + printf("[%08X]", ADCBuffer[0]);fflush (stdout); + while(jz_adc_check_buffer(ADCBuffer)){usleep (10);} + for(int i=1; i< LENB/2+1; i++) + printf("[%08X]", ADCBuffer[i]); + fflush (stdout); + + /******************************* TEST 3 ***********************************/ + printf("\n\nINIT TEST3: Autoselft (Vref+) -> Return 0x03FF \n"); + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_3); + usleep (1000); + jz_adc_config(ADCBuffer, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_3); + printf("[%08X]", ADCBuffer[0]);fflush (stdout); + while(jz_adc_check_buffer(ADCBuffer)){usleep (10);} + for(int i=1; i< LENB/2+1; i++) + printf("[%08X]", ADCBuffer[i]); + fflush (stdout); + + printf("\n\nTESTS complete\n"); +} + +void ADCw::powerDownADC() +{ + jz_adc_config(ADCBuffer, 0x01, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_POWER_DOWN); + printf("\nADC in Power Down Mode \n"); +} + +JZ_REG* ADCw::takeSamplesADC(int LENB, uchar CLKDIV, int CHANNEL) +{ + jz_adc_config(ADCBuffer, 0x01, CLKDIV, ADC_CMD_SET_CHANNEL0+CHANNEL); + usleep (1000); + jz_adc_config(ADCBuffer, LENB, CLKDIV, ADC_CMD_READ_CHANNEL0+CHANNEL); + //while(jz_adc_check_buffer(ADCBuffer)){usleep (400000);printf("[%08X]", ADCBuffer[0]);fflush (stdout);} + while(jz_adc_check_buffer(ADCBuffer)){usleep (10);} + return ADCBuffer; +} diff --git a/Examples/ADC/QT_src/ADCw.h b/Examples/ADC/QT_src/ADCw.h new file mode 100644 index 0000000..845e45e --- /dev/null +++ b/Examples/ADC/QT_src/ADCw.h @@ -0,0 +1,21 @@ +#ifndef ADCW_H +#define ADCW_H + +#include "jz_adc_peripheral.h" +#include +#include + +class ADCw +{ +public: + ADCw(); + ~ADCw(){}; + + void testADC(); + void powerDownADC(); + JZ_REG * takeSamplesADC(int LENB, uchar CLKDIV, int CHANNEL); +private: + JZ_REG * ADCBuffer; +}; + +#endif // ADCW_H diff --git a/Examples/ADC/QT_src/Makefile b/Examples/ADC/QT_src/Makefile new file mode 100644 index 0000000..24936e3 --- /dev/null +++ b/Examples/ADC/QT_src/Makefile @@ -0,0 +1,265 @@ +############################################################################# +# Makefile for building: ADC +# Generated by qmake (2.01a) (Qt 4.6.2) on: Mon Apr 5 13:58:40 2010 +# Project: ADC1.pro +# Template: app +# Command: /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/qmake -spec ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-openwrt-g++ -unix -o Makefile ADC1.pro +############################################################################# + +####### Compiler, tools and options + +CC = mipsel-openwrt-linux-uclibc-gcc +CXX = mipsel-openwrt-linux-uclibc-g++ +DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/include/freetype2 -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/include -O2 -Wall -W -D_REENTRANT $(DEFINES) +CXXFLAGS = -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/include/freetype2 -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/include -O2 -Wall -W -D_REENTRANT $(DEFINES) +INCPATH = -I../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-openwrt-g++ -I. -I../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/include/QtCore -I../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/include/QtNetwork -I../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/include/QtGui -I../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/include -I. -I. -I. +LINK = mipsel-openwrt-linux-uclibc-g++ +LFLAGS = -L/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib -L/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/lib -L/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/lib -L/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib -L/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.30.1/lib -Wl,-rpath-link=/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr/lib -Wl,-O1 +LIBS = $(SUBLIBS) -L/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib -lQtGui -L/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib -L/home/juan64bits/ebd/ECB/openwrt-xburst/staging_dir/target-mipsel_uClibc-0.9.30.1/usr//lib -ldirectfb -lfusion -ldirect -lQtNetwork -lQtCore -lpthread +AR = mipsel-openwrt-linux-uclibc-ar cqs +RANLIB = mipsel-openwrt-linux-uclibc-ranlib +QMAKE = /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +STRIP = : +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = main.cpp \ + mainwindow.cpp \ + signaldisplay.cpp \ + ADCw.cpp \ + jz_adc_peripheral.cpp \ + jz47xx_gpio.cpp \ + jz47xx_mmap.cpp moc_mainwindow.cpp +OBJECTS = main.o \ + mainwindow.o \ + signaldisplay.o \ + ADCw.o \ + jz_adc_peripheral.o \ + jz47xx_gpio.o \ + jz47xx_mmap.o \ + moc_mainwindow.o +DIST = ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/g++.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/unix.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/linux.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/qws.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_functions.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_config.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/exclusive_builds.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_pre.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/release.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_post.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/warn_on.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/unix/thread.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/moc.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/resources.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/uic.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/yacc.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/lex.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/include_source_dir.prf \ + ADC1.pro +QMAKE_TARGET = ADC +DESTDIR = +TARGET = ADC + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile $(TARGET) + +$(TARGET): ui_mainwindow.h $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: ADC1.pro ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-openwrt-g++/qmake.conf ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/g++.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/unix.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/linux.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/qws.conf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_functions.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_config.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/exclusive_builds.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_pre.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/release.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_post.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/warn_on.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/unix/thread.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/moc.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/resources.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/uic.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/yacc.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/lex.prf \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/include_source_dir.prf \ + /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtGui.prl \ + /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtNetwork.prl \ + /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtCore.prl + $(QMAKE) -spec ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-openwrt-g++ -unix -o Makefile ADC1.pro +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/g++.conf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/unix.conf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/linux.conf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/common/qws.conf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_functions.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt_config.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/exclusive_builds.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_pre.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/release.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/default_post.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/warn_on.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/qt.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/unix/thread.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/moc.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/resources.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/uic.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/yacc.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/lex.prf: +../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/features/include_source_dir.prf: +/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtGui.prl: +/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtNetwork.prl: +/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -spec ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-openwrt-g++ -unix -o Makefile ADC1.pro + +dist: + @$(CHK_DIR_EXISTS) .tmp/ADC1.0.0 || $(MKDIR) .tmp/ADC1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/ADC1.0.0/ && $(COPY_FILE) --parents mainwindow.h jz47xx_mmap.h signaldisplay.h ADCw.h jz_adc_peripheral.h jz47xx_gpio.h .tmp/ADC1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp signaldisplay.cpp ADCw.cpp jz_adc_peripheral.cpp jz47xx_gpio.cpp jz47xx_mmap.cpp .tmp/ADC1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/ADC1.0.0/ && (cd `dirname .tmp/ADC1.0.0` && $(TAR) ADC1.0.0.tar ADC1.0.0 && $(COMPRESS) ADC1.0.0.tar) && $(MOVE) `dirname .tmp/ADC1.0.0`/ADC1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/ADC1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +/home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/moc: + (cd $(QTDIR)/src/tools/moc && $(MAKE)) + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: moc_mainwindow.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_mainwindow.cpp +moc_mainwindow.cpp: ADCw.h \ + jz_adc_peripheral.h \ + jz47xx_mmap.h \ + jz47xx_gpio.h \ + mainwindow.h \ + ../../../../openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/moc + /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: ui_mainwindow.h +compiler_uic_clean: + -$(DEL_FILE) ui_mainwindow.h +ui_mainwindow.h: mainwindow.ui \ + signaldisplay.h + /home/juan64bits/ebd/ECB/openwrt-xburst/build_dir/target-mipsel_uClibc-0.9.30.1/qt-everywhere-opensource-src-4.6.2/bin/uic mainwindow.ui -o ui_mainwindow.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +main.o: main.cpp mainwindow.h \ + ADCw.h \ + jz_adc_peripheral.h \ + jz47xx_mmap.h \ + jz47xx_gpio.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +mainwindow.o: mainwindow.cpp mainwindow.h \ + ADCw.h \ + jz_adc_peripheral.h \ + jz47xx_mmap.h \ + jz47xx_gpio.h \ + ui_mainwindow.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp + +signaldisplay.o: signaldisplay.cpp signaldisplay.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o signaldisplay.o signaldisplay.cpp + +ADCw.o: ADCw.cpp ADCw.h \ + jz_adc_peripheral.h \ + jz47xx_mmap.h \ + jz47xx_gpio.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o ADCw.o ADCw.cpp + +jz_adc_peripheral.o: jz_adc_peripheral.cpp jz_adc_peripheral.h \ + jz47xx_mmap.h \ + jz47xx_gpio.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz_adc_peripheral.o jz_adc_peripheral.cpp + +jz47xx_gpio.o: jz47xx_gpio.cpp jz47xx_gpio.h \ + jz47xx_mmap.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz47xx_gpio.o jz47xx_gpio.cpp + +jz47xx_mmap.o: jz47xx_mmap.cpp jz47xx_mmap.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o jz47xx_mmap.o jz47xx_mmap.cpp + +moc_mainwindow.o: moc_mainwindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp + +####### Install + +install: FORCE + +uninstall: FORCE + +FORCE: + diff --git a/Examples/ADC/QT_src/jz47xx_gpio.c b/Examples/ADC/QT_src/jz47xx_gpio.c new file mode 100644 index 0000000..affa85e --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_gpio.c @@ -0,0 +1,108 @@ +/* + JZ47xx GPIO at userspace + + Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com + +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 2 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 +#include +#include + +#include +#include + + +#define JZ_GPIO_BASE 0x10010000 + +void +jz_gpio_as_output (JZ_PIO * pio, unsigned int o) +{ + pio->PXFUNC = (1 << (o)); + pio->PXSELC = (1 << (o)); + pio->PXDIRS = (1 << (o)); +} + +void +jz_gpio_as_input (JZ_PIO * pio, unsigned int o) +{ + pio->PXFUNC = (1 << (o)); + pio->PXSELC = (1 << (o)); + pio->PXDIRC = (1 << (o)); +} + +void +jz_gpio_set_pin (JZ_PIO * pio, unsigned int o) +{ + pio->PXDATS = (1 << (o)); +} + +void +jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o) +{ + pio->PXDATC = (1 << (o)); +} + +void +jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val) +{ + if (val == 0) + pio->PXDATC = (1 << (o)); + else + pio->PXDATS = (1 << (o)); +} + +unsigned int +jz_gpio_get_pin (JZ_PIO * pio, unsigned int o) +{ + return (pio->PXPIN & (1 << o)) ? 1 : 0; +} + +int +jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func) +{ + switch (func) + { + case 0: + pio->PXFUNS = (1 << o); + pio->PXTRGC = (1 << o); + pio->PXSELC = (1 << o); + return 1; + + case 1: + pio->PXFUNS = (1 << o); + pio->PXTRGC = (1 << o); + pio->PXSELS = (1 << o); + return 1; + + case 2: + pio->PXFUNS = (1 << o); + pio->PXTRGS = (1 << o); + pio->PXSELC = (1 << o); + return 1; + } + return 0; +} + +JZ_PIO * +jz_gpio_map (int port) +{ + JZ_PIO *pio; + + pio = (JZ_PIO *) jz_mmap (JZ_GPIO_BASE); + pio = (JZ_PIO *) ((unsigned int) pio + port * 0x100); + + return pio; +} diff --git a/Examples/ADC/QT_src/jz47xx_gpio.cpp b/Examples/ADC/QT_src/jz47xx_gpio.cpp new file mode 100644 index 0000000..affa85e --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_gpio.cpp @@ -0,0 +1,108 @@ +/* + JZ47xx GPIO at userspace + + Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com + +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 2 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 +#include +#include + +#include +#include + + +#define JZ_GPIO_BASE 0x10010000 + +void +jz_gpio_as_output (JZ_PIO * pio, unsigned int o) +{ + pio->PXFUNC = (1 << (o)); + pio->PXSELC = (1 << (o)); + pio->PXDIRS = (1 << (o)); +} + +void +jz_gpio_as_input (JZ_PIO * pio, unsigned int o) +{ + pio->PXFUNC = (1 << (o)); + pio->PXSELC = (1 << (o)); + pio->PXDIRC = (1 << (o)); +} + +void +jz_gpio_set_pin (JZ_PIO * pio, unsigned int o) +{ + pio->PXDATS = (1 << (o)); +} + +void +jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o) +{ + pio->PXDATC = (1 << (o)); +} + +void +jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val) +{ + if (val == 0) + pio->PXDATC = (1 << (o)); + else + pio->PXDATS = (1 << (o)); +} + +unsigned int +jz_gpio_get_pin (JZ_PIO * pio, unsigned int o) +{ + return (pio->PXPIN & (1 << o)) ? 1 : 0; +} + +int +jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func) +{ + switch (func) + { + case 0: + pio->PXFUNS = (1 << o); + pio->PXTRGC = (1 << o); + pio->PXSELC = (1 << o); + return 1; + + case 1: + pio->PXFUNS = (1 << o); + pio->PXTRGC = (1 << o); + pio->PXSELS = (1 << o); + return 1; + + case 2: + pio->PXFUNS = (1 << o); + pio->PXTRGS = (1 << o); + pio->PXSELC = (1 << o); + return 1; + } + return 0; +} + +JZ_PIO * +jz_gpio_map (int port) +{ + JZ_PIO *pio; + + pio = (JZ_PIO *) jz_mmap (JZ_GPIO_BASE); + pio = (JZ_PIO *) ((unsigned int) pio + port * 0x100); + + return pio; +} diff --git a/Examples/ADC/QT_src/jz47xx_gpio.h b/Examples/ADC/QT_src/jz47xx_gpio.h new file mode 100644 index 0000000..d8b0113 --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_gpio.h @@ -0,0 +1,84 @@ +/* + JZ47xx GPIO at userspace + + Copyright (C) 2010 Andres Calderon andres.calderon@emqbit.com + +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 2 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 */ + +#ifndef __jz47xx_gpio_h__ +#define __jz47xx_gpio_h__ + +#define JZ_GPIO_PORT_A 0 +#define JZ_GPIO_PORT_B 1 +#define JZ_GPIO_PORT_C 2 +#define JZ_GPIO_PORT_D 3 + +typedef volatile unsigned int JZ_REG; /* Hardware register definition */ + +typedef struct _JZ_PIO +{ + JZ_REG PXPIN; /* PIN Level Register */ + JZ_REG Reserved0; + JZ_REG Reserved1; + JZ_REG Reserved2; + JZ_REG PXDAT; /* Port Data Register */ + JZ_REG PXDATS; /* Port Data Set Register */ + JZ_REG PXDATC; /* Port Data Clear Register */ + JZ_REG Reserved3; + JZ_REG PXIM; /* Interrupt Mask Register */ + JZ_REG PXIMS; /* Interrupt Mask Set Reg */ + JZ_REG PXIMC; /* Interrupt Mask Clear Reg */ + JZ_REG Reserved4; + JZ_REG PXPE; /* Pull Enable Register */ + JZ_REG PXPES; /* Pull Enable Set Reg. */ + JZ_REG PXPEC; /* Pull Enable Clear Reg. */ + JZ_REG Reserved5; + JZ_REG PXFUN; /* Function Register */ + JZ_REG PXFUNS; /* Function Set Register */ + JZ_REG PXFUNC; /* Function Clear Register */ + JZ_REG Reserved6; + JZ_REG PXSEL; /* Select Register */ + JZ_REG PXSELS; /* Select Set Register */ + JZ_REG PXSELC; /* Select Clear Register */ + JZ_REG Reserved7; + JZ_REG PXDIR; /* Direction Register */ + JZ_REG PXDIRS; /* Direction Set Register */ + JZ_REG PXDIRC; /* Direction Clear Register */ + JZ_REG Reserved8; + JZ_REG PXTRG; /* Trigger Register */ + JZ_REG PXTRGS; /* Trigger Set Register */ + JZ_REG PXTRGC; /* Trigger Set Register */ + JZ_REG Reserved9; + JZ_REG PXFLG; /* Port Flag Register */ + JZ_REG PXFLGC; /* Port Flag clear Register */ +} JZ_PIO, *PJZ_PIO; + +void jz_gpio_as_output (JZ_PIO * pio, unsigned int o); + +void jz_gpio_as_input (JZ_PIO * pio, unsigned int o); + +void jz_gpio_set_pin (JZ_PIO * pio, unsigned int o); + +void jz_gpio_clear_pin (JZ_PIO * pio, unsigned int o); + +void jz_gpio_out (JZ_PIO * pio, unsigned int o, unsigned int val); + +unsigned int jz_gpio_get_pin (JZ_PIO * pio, unsigned int o); + +int jz_gpio_as_func (JZ_PIO * pio, unsigned int o, int func); + +JZ_PIO *jz_gpio_map (int port); + +#endif diff --git a/Examples/ADC/QT_src/jz47xx_mmap.c b/Examples/ADC/QT_src/jz47xx_mmap.c new file mode 100644 index 0000000..e8cf317 --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_mmap.c @@ -0,0 +1,39 @@ +/* + * JZ47xx GPIO lines + * + * Written 2010 by Andres Calderon andres.calderon@emqbit.com + */ + +#include +#include +#include +#include +#include +#include + +#include + + +void * +jz_mmap (off_t address) +{ + int fd; + + void *pio; + + if ((fd = open ("/dev/mem", O_RDWR | O_SYNC)) == -1) + { + fprintf (stderr, "Cannot open /dev/mem.\n"); + return 0; + } + + pio = (void *) mmap (0, getpagesize (), PROT_READ | PROT_WRITE, MAP_SHARED, fd, address); + + if (pio == (void *) -1) + { + fprintf (stderr, "Cannot mmap.\n"); + return 0; + } + + return pio; +} diff --git a/Examples/ADC/QT_src/jz47xx_mmap.cpp b/Examples/ADC/QT_src/jz47xx_mmap.cpp new file mode 100644 index 0000000..52266bb --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_mmap.cpp @@ -0,0 +1,39 @@ +/* + * JZ47xx GPIO lines + * + * Written 2010 by Andres Calderon andres.calderon@emqbit.com + */ + +#include +#include +#include +#include +#include +#include + +#include + + +unsigned int * +jz_mmap (off_t address) +{ + int fd; + + unsigned int *pio; + + if ((fd = open ("/dev/mem", O_RDWR | O_SYNC)) == -1) + { + fprintf (stderr, "Cannot open /dev/mem.\n"); + return 0; + } + + pio = (unsigned int *) mmap (0, getpagesize (), PROT_READ | PROT_WRITE, MAP_SHARED, fd, address); + + if (pio == (unsigned int *) -1) + { + fprintf (stderr, "Cannot mmap.\n"); + return 0; + } + + return pio; +} diff --git a/Examples/ADC/QT_src/jz47xx_mmap.h b/Examples/ADC/QT_src/jz47xx_mmap.h new file mode 100644 index 0000000..7380eb6 --- /dev/null +++ b/Examples/ADC/QT_src/jz47xx_mmap.h @@ -0,0 +1,14 @@ +/* + * JZ47xx GPIO lines + * + * Written 2010 by Andres Calderon andres.calderon@emqbit.com + */ + +#ifndef __jz47xx_mmap_h__ +#define __jz47xx_mmap_h__ + +#include + +unsigned int * jz_mmap (off_t address); + +#endif diff --git a/Examples/ADC/QT_src/jz_adc_peripheral.c b/Examples/ADC/QT_src/jz_adc_peripheral.c new file mode 100644 index 0000000..e5f9cd1 --- /dev/null +++ b/Examples/ADC/QT_src/jz_adc_peripheral.c @@ -0,0 +1,36 @@ +/* ADC Peripheral.c + +Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co + Andres Calderon andres.calderon@emqbit.com + +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 2 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 +#include + +#include "jz_adc_peripheral.h" + +void +jz_adc_config(JZ_REG * addr, uchar BUFFER, uchar CLK_DIV, uchar CMD) +{ + addr[0] = (BUFFER << 16) + (CLK_DIV<<8) + CMD; +} + +int +jz_adc_check_buffer(JZ_REG * addr) +{ + return addr[0]&0x00FF0000; +} + diff --git a/Examples/ADC/QT_src/jz_adc_peripheral.cpp b/Examples/ADC/QT_src/jz_adc_peripheral.cpp new file mode 100644 index 0000000..3824f38 --- /dev/null +++ b/Examples/ADC/QT_src/jz_adc_peripheral.cpp @@ -0,0 +1,59 @@ +/* ADC Peripheral.c + +Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co + Andres Calderon andres.calderon@emqbit.com + +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 2 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 +#include + +#include "jz_adc_peripheral.h" + +JZ_REG * +jz_adc_init() +{ + JZ_PIO *pio; + JZ_REG *virt_addr; + + pio = jz_gpio_map (CS2_PORT); + jz_gpio_as_func (pio, CS2_PIN, 0); + + virt_addr = (JZ_REG *) (jz_mmap(0x13010000) + 0x18); + + if (*virt_addr != 0x0FFF7700) + { + *virt_addr = 0x0FFF7700; + printf ("ADC: Configuring CS2 8 bits and 0 WS: %08X\n", *virt_addr); + } + else + printf ("ADC: CS2, already configured: %08X\n", *virt_addr); + + virt_addr = (JZ_REG *) jz_mmap (0x14000000); + + return virt_addr; +} + +void +jz_adc_config(JZ_REG * addr, int BUFFER, uchar CLK_DIV, uchar CMD) +{ + addr[0] = (BUFFER << 16) + (CLK_DIV<<8) + CMD; +} + +int +jz_adc_check_buffer(JZ_REG * addr) +{ + return addr[0]&0x00FF0000; +} diff --git a/Examples/ADC/QT_src/jz_adc_peripheral.h b/Examples/ADC/QT_src/jz_adc_peripheral.h new file mode 100644 index 0000000..6100ad9 --- /dev/null +++ b/Examples/ADC/QT_src/jz_adc_peripheral.h @@ -0,0 +1,84 @@ +/* ADC Peripheral.h + +Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co + Andres Calderon andres.calderon@emqbit.com + +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 2 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 */ + +#ifndef __adc_peripheral_h__ +#define __adc_peripheral_h__ + +#include "jz47xx_mmap.h" +#include "jz47xx_gpio.h" + +#define ADC_CMD_NONE 0x00 /* Nothing to do */ +#define ADC_CMD_SET_SPI_CLKDIV 0x90 /* Set clock divider for ADC sclk */ + +#define ADC_CMD_SET_CHANNEL0 0x50 /* Set channel 0 */ +#define ADC_CMD_READ_CHANNEL0 0x60 /* Read channel 0 */ + +#define ADC_CMD_SET_CHANNEL1 0x51 /* Set channel 1 */ +#define ADC_CMD_READ_CHANNEL1 0x61 /* Read channel 1 */ + +#define ADC_CMD_SET_CHANNEL2 0x52 /* Set channel 2 */ +#define ADC_CMD_READ_CHANNEL2 0x62 /* Read channel 2 */ + +#define ADC_CMD_SET_CHANNEL3 0x53 /* Set channel 3 */ +#define ADC_CMD_READ_CHANNEL3 0x63 /* Read channel 3 */ + +#define ADC_CMD_SET_CHANNEL4 0x54 /* Set channel 4 */ +#define ADC_CMD_READ_CHANNEL4 0x64 /* Read channel 4 */ + +#define ADC_CMD_SET_CHANNEL5 0x55 /* Set channel 5 */ +#define ADC_CMD_READ_CHANNEL5 0x65 /* Read channel 5 */ + +#define ADC_CMD_SET_CHANNEL6 0x56 /* Set channel 6 */ +#define ADC_CMD_READ_CHANNEL6 0x66 /* Read channel 6 */ + +#define ADC_CMD_SET_CHANNEL7 0x57 /* Set channel 7 */ +#define ADC_CMD_READ_CHANNEL7 0x67 /* Read channel 8 */ + +#define ADC_CMD_SET_POWER_DOWN 0X58 /* Set ADC power down mode (1uA) */ + +#define ADC_CMD_SET_FAST_CONV 0X59 /* Initialize ADC Fast Convertion(<10us)*/ + +#define ADC_CMD_SET_LOW_CONV 0X5A /* Initialize ADC Fast Convertion(<40us)*/ + +#define ADC_CMD_SET_AUTOSELFT_1 0x5B /* Set Autoselft ADC {(Vref+)-(Vref-)}/2*/ +#define ADC_CMD_READ_AUTOSELFT_1 0x6B /* Read Autoselft ADC 1 (0x0200) */ + +#define ADC_CMD_SET_AUTOSELFT_2 0x5C /* Set Autoselft ADC (Vref-) */ +#define ADC_CMD_READ_AUTOSELFT_2 0x6C /* Read Autoselft ADC 2 (0x0000) */ + +#define ADC_CMD_SET_AUTOSELFT_3 0x5D /* Set Autoselft ADC (Vref+) */ +#define ADC_CMD_READ_AUTOSELFT_3 0x6D /* Read Autoselft ADC 3 (0x03FF) */ + +#define ADC_SPI_CLKDIV_MIN 0x14 /* 50/(2*20) -> 1.25MHz (MAX=2.8MHz) */ +#define ADC_SPI_CLKDIV_MAX 0xFF /* 50/(2*255) -> 98.04KHz */ + +#define ADC_MAX_BUFFER 0x3FE/* 1022 reads/commands */ + +#define CS2_PORT JZ_GPIO_PORT_B +#define CS2_PIN 26 + +typedef unsigned char uchar; + +JZ_REG *jz_adc_init(); + +void jz_adc_config(JZ_REG * addr, int BUFFER, uchar CLK_DIV, uchar CMD); + +int jz_adc_check_buffer(JZ_REG * addr); + +#endif diff --git a/Examples/ADC/QT_src/jz_test_adc.c b/Examples/ADC/QT_src/jz_test_adc.c new file mode 100644 index 0000000..eda939c --- /dev/null +++ b/Examples/ADC/QT_src/jz_test_adc.c @@ -0,0 +1,110 @@ +/* ADC TEST + +Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co + Andres Calderon andres.calderon@emqbit.com + +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 2 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 +#include + +#include "jz47xx_gpio.h" +#include "jz47xx_mmap.h" +#include "jz_adc_peripheral.h" + +#define TEST_PORT JZ_GPIO_PORT_B +#define TEST_PIN 26 + +int +main () +{ + int i,j; + JZ_PIO *pio; + JZ_REG *virt_addr; + + pio = jz_gpio_map (TEST_PORT); + jz_gpio_as_func (pio, TEST_PIN, 0); + + virt_addr = (JZ_REG *) (jz_mmap (0x13010000) + 0x18); + + if (*virt_addr != 0x0FFF7700) + { + *virt_addr = 0x0FFF7700; + printf ("Configuring CS2 32 bits and 0 WS: %08X\n", *virt_addr); + } + else + printf ("CS2, already configured: %08X\n", *virt_addr); + + virt_addr = (JZ_REG *) jz_mmap (0x14000000); + + /*************************Clean FPGA RAM memory****************************/ + for (i = 0; i < 512; i++) //RAMB16_s9_s9 has 2048 bytes 8-bit + { + virt_addr[i] = 0x00000000; //Clean 4 register by cicle + } + + /****************Configure ADC register on FPGA RAM memory*****************/ + uchar LENB = 0x01; // 1 read/cmd + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_SPI_CLKDIV); + usleep (100); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_FAST_CONV); + usleep (100); + printf("\nADC in Fast Convertion Mode (10us) and Fs=9.8KHz (Min)\n"); + + LENB = ADC_MAX_BUFFER; // 254 read/cmd + + /******************************* TEST 1 ***********************************/ + printf("\nINIT TEST1: Autoselft {(Vref+) - (Vref-)}/2 -> Return 0x0200 \n"); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_1); + usleep (100); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_1); + printf("[%08X]", virt_addr[0]); + while(jz_adc_check_buffer(virt_addr)) + { + printf("[%08X]-", virt_addr[0]); + fflush (stdout); + usleep (10000); + } + for(i=1; i< LENB/2+1; i++) + printf("[%08X]", virt_addr[i]); + + /******************************* TEST 2 ***********************************/ + printf("\n\nINIT TEST2: Autoselft (Vref-) -> Return 0x0000 \n"); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_2); + usleep (100); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_2); + while(jz_adc_check_buffer(virt_addr)){usleep (100);} + for(i=1; i< LENB/2+1; i++) + printf("[%08X]", virt_addr[i]); + + /******************************* TEST 3 ***********************************/ + printf("\n\nINIT TEST3: Autoselft (Vref+) -> Return 0x03FF \n"); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_AUTOSELFT_3); + usleep (100); + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_READ_AUTOSELFT_3); + while(jz_adc_check_buffer(virt_addr)){usleep (100);} + for(i=1; i< LENB/2+1; i++) + printf("[%08X]", virt_addr[i]); + + printf("\n\nTESTS complete\n"); + + LENB = 0x01; // 1 read/cmd + jz_adc_config(virt_addr, LENB, ADC_SPI_CLKDIV_MAX, ADC_CMD_SET_POWER_DOWN); + printf("\nADC in Power Down Mode \n"); + + return 0; +} + + diff --git a/Examples/ADC/QT_src/main.cpp b/Examples/ADC/QT_src/main.cpp new file mode 100755 index 0000000..ee0cfef --- /dev/null +++ b/Examples/ADC/QT_src/main.cpp @@ -0,0 +1,10 @@ +#include +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + MainWindow w; + w.show(); + return a.exec(); +} diff --git a/Examples/ADC/QT_src/mainwindow.cpp b/Examples/ADC/QT_src/mainwindow.cpp new file mode 100755 index 0000000..246050f --- /dev/null +++ b/Examples/ADC/QT_src/mainwindow.cpp @@ -0,0 +1,47 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include + +#include +#include + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent), ui(new Ui::MainWindow) +{ + ui->setupUi(this); + connect(this,SIGNAL(refresh()),ui->Graph, SLOT(repaint())); + ui->Graph->setPointsPerPlot(250); + ui->Graph->setVoltsPerDiv(102); + + timer1 = new QTimer(this); + timer1->start(50); + connect(timer1, SIGNAL(timeout()), this, SLOT(updateGraph())); + + ADC1 = new ADCw; + ADC1->testADC(); + printf("\nTaking 250 samples each 50ms from Channel 0 at Fs=9.8KHz \n"); +} + +MainWindow::~MainWindow() +{ + delete ui; +} + +void MainWindow::updateGraph() +{ + JZ_REG * dataADC =ADC1->takeSamplesADC(250, 0xFF, 1); + int tempD; + + for(int i=1; i< 250/2+1; i++) + { + tempD = dataADC[i]&0xFFFF; //printf("[%08X]",tempD); + ui->Graph->addPoint(tempD); + tempD = dataADC[i]>>16; //printf("[%08X]",tempD); + ui->Graph->addPoint(tempD); + } + //fflush (stdout); + /*for(int i = 0; i<100;i++) + ui->Graph->addPoint(20*sin(6.2832*i/100)+20);*/ + + emit refresh(); +} diff --git a/Examples/ADC/QT_src/mainwindow.h b/Examples/ADC/QT_src/mainwindow.h new file mode 100755 index 0000000..f87f85c --- /dev/null +++ b/Examples/ADC/QT_src/mainwindow.h @@ -0,0 +1,32 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include "ADCw.h" + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + +public slots: + void updateGraph(); + +signals: + void refresh(); + +private: + Ui::MainWindow *ui; + QTimer *timer1; + ADCw *ADC1; +}; + +#endif // MAINWINDOW_H diff --git a/Examples/ADC/QT_src/mainwindow.ui b/Examples/ADC/QT_src/mainwindow.ui new file mode 100755 index 0000000..8a9e77e --- /dev/null +++ b/Examples/ADC/QT_src/mainwindow.ui @@ -0,0 +1,62 @@ + + + MainWindow + + + + 0 + 0 + 320 + 240 + + + + ADC Test + + + + + + + + 100 + 20 + + + + + + + + + &Salir + + + + + A&cerca de... + + + + + Acerca de &QT + + + + + Acerca de &Qt... + + + + + + + SignalDisplay + QWidget +
signaldisplay.h
+ 1 +
+
+ + +
diff --git a/Examples/ADC/QT_src/signaldisplay.cpp b/Examples/ADC/QT_src/signaldisplay.cpp new file mode 100755 index 0000000..dc6678e --- /dev/null +++ b/Examples/ADC/QT_src/signaldisplay.cpp @@ -0,0 +1,60 @@ +#include "signaldisplay.h" +#include +#include + +SignalDisplay::SignalDisplay(QWidget *&parent):QWidget(parent) +{ + colorTrace = Qt::blue; + secsPerDiv = 1.0/600.0; + voltsPerDiv = 20; + setPointsPerPlot(10); +} + +void SignalDisplay::setPointsPerPlot(int value) +{ + pointsPerPlot = value; + waves = new QPoint[pointsPerPlot]; + secsIdx = 0; +} + +void SignalDisplay::drawGrid(QPainter &p, QColor colorGrid, int x, int y, int w, int h, int nx, int ny){ + p.setPen(colorGrid); + for (int ix= 0; ix +#include +#include + +class SignalDisplay : public QWidget +{ +public: + SignalDisplay(QWidget *&parent); + void addPoint( int value1); + void setSecsPerDiv( float value ){ secsPerDiv = fabs(value);} + void setVoltsPerDiv( float value ){ voltsPerDiv = fabs(value);} + float getSecsPerDiv(){ return secsPerDiv; } + void setPointsPerPlot(int value); + void setColorTrace(QColor color){colorTrace=color;}; + +private: + void paintEvent(QPaintEvent *event); + void drawGrid(QPainter &p, QColor colorGrid, int x, int y, int w, int h, int nx, int ny); + QPoint *waves; + float voltsPerDiv; + float secsPerDiv; + QColor colorTrace; + int secsIdx; + int w, h, ox, oy; + int pointsPerPlot; +}; + +#endif // SIGNALDISPLAY_H diff --git a/Examples/ADC/logic/ADC_peripheral.v b/Examples/ADC/logic/ADC_peripheral.v index f49bc02..7e51522 100644 --- a/Examples/ADC/logic/ADC_peripheral.v +++ b/Examples/ADC/logic/ADC_peripheral.v @@ -2,7 +2,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, ADC_SCLK, ADC_SDIN, ADC_SDOUT, addr, rdBus, wrBus, we); - + input clk, reset, ADC_EOC, cs, we; input [10:0] addr; input [7:0] wrBus; @@ -13,7 +13,6 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, //RAMB registers reg [7:0] rdBus; wire [7:0] rdBus1; - wire [7:0] rdBus2; reg [7:0] wrBus2; reg [10:0] addr2; reg we1=0; @@ -24,6 +23,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, reg nSample=0; reg [10:0] auto_count=0; reg [4:0] w_st2=0; + //SPI registers reg [3:0] SPI_in_data=0; @@ -36,44 +36,113 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, reg CMD_TYP; reg [3:0] CMD_ADC; reg [7:0] CLKDIV = 0; - reg [10:0] SIZEB; //[10:8] -> size_hi | [7:0] -> size_low + reg [9:0] SIZEB; //[10:8] -> size_hi | [7:0] -> size_low //TEMPS - reg [10:0] SIZEB2; - reg CMD_DONE2; + reg [9:0] SIZEB2; assign ADC_CSTART = 1'b1; // Dual-port RAM instatiation RAMB16_S9_S9 ba0( - .DOA(rdBus1), // Port A 8-bit Data Output - .DOB(rdBus2), // Port B 8-bit Data Output - .DOPA(), // Port A 1-bit Parity Output - .DOPB(), // Port B 1-bit Parity Output - .ADDRA(addr[10:0]), // Port A 11-bit Address Input - .ADDRB(addr2[10:0]), // Port B 11-bit Address Input - .CLKA(~clk), // Port A Clock - .CLKB(~clk), // Port B Clock - .DIA(wrBus), // Port A 8-bit Data Input - .DIB(wrBus2), // Port B 8-bit Data Input - .DIPA(1'b0), // Port A 1-bit parity Input - .DIPB(1'b0), // Port-B 1-bit parity Input - .ENA(1'b1), // Port A RAM Enable Input - .ENB(1'b1), // Port B RAM Enable Input - .SSRA(1'b0), // Port A Synchronous Set/Reset Input - .SSRB(1'b0), // Port B Synchronous Set/Reset Input - .WEA(we1), // Port A Write Enable Input - .WEB(we2) ); // Port B Write Enable Input + .DOA(rdBus1), // Port A 8-bit Data Output + .DOB(), // Port B 8-bit Data Output + .DOPA(), // Port A 1-bit Parity Output + .DOPB(), // Port B 1-bit Parity Output + .ADDRA(addr), // Port A 11-bit Address Input + .ADDRB(addr2), // Port B 11-bit Address Input + .CLKA(~clk), // Port A Clock + .CLKB(~clk), // Port B Clock + .DIA(wrBus), // Port A 8-bit Data Input + .DIB(wrBus2), // Port B 8-bit Data Input + .DIPA(1'b0), // Port A 1-bit parity Input + .DIPB(1'b0), // Port-B 1-bit parity Input + .ENA(1'b1), // Port A RAM Enable Input + .ENB(1'b1), // Port B RAM Enable Input + .SSRA(1'b0), // Port A Synchronous Set/Reset Input + .SSRB(1'b0), // Port B Synchronous Set/Reset Input + .WEA(we1), // Port A Write Enable Input + .WEB(we2) ); // Port B Write Enable Input // SPI comunication module instantiation reg ADC_SCLK_buffer = 0; reg ADC_SDIN_buffer = 0; - reg busy = 0; + reg busy = 0, load_in = 0; + reg pulse = 0, clkdiv_en = 0; reg [3:0] in_buffer=0; reg [9:0] out_buffer; reg [7:0] clkcount = 0; reg [4:0] count = 0; + reg [4:0] w_st1=0; + + assign ADC_CS = ~busy; + // Clock Generator + always@(posedge clk) + if (clkdiv_en) begin + if(clkcount < CLKDIV) begin + clkcount <= clkcount + 1; pulse <=0; + end else begin + clkcount <= 0; pulse <=1; + if((count>0) && (count < 21)) + ADC_SCLK_buffer <= ~ADC_SCLK_buffer; + end + end else begin + ADC_SCLK_buffer <= 0; pulse <=0; + end + // Control + always @(posedge clk) + if(reset) begin + {w_st1, count, clkdiv_en, busy} <= 0; + end else begin + case (w_st1) + 0: begin + if(SPI_wr) begin + clkdiv_en <= 1; + load_in <= 1; + w_st1 <= 1; busy <= 1; + end + end + 1: begin + load_in <= 0; + if(pulse) + count <= count + 1; + else if (count > 30) begin + clkdiv_en <= 0; busy <= 0; w_st1 <= 0; count <= 0; end + end + endcase + end + + // Receptor + always@(posedge clk) + begin + if((count[0] & pulse) && (count < 21)) begin + out_buffer <= out_buffer << 1; + out_buffer[0] <= ADC_SDOUT; + end + end + + always@(SPI_rd or out_buffer or busy or CLKDIV) + begin + SPI_out_data <= 10'bx; + if(SPI_rd) + begin SPI_out_data <= out_buffer; end + end + + // Transmitter + always@(posedge clk) + begin + if(load_in) in_buffer <= SPI_in_data; + if(!count[0] & pulse) begin + ADC_SDIN_buffer <= in_buffer[3]; + in_buffer <= in_buffer << 1; + end + end + + assign ADC_SCLK = ADC_SCLK_buffer; + assign ADC_SDIN = ADC_SDIN_buffer; + +/* assign ADC_CS = ~busy; always@(SPI_rd or out_buffer or busy or CLKDIV) @@ -90,8 +159,8 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, if(SPI_wr) begin in_buffer = SPI_in_data; busy = 1; end end - else - begin + else + begin clkcount = clkcount + 1; if(clkcount >= CLKDIV) begin @@ -114,7 +183,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, busy = 0; end end - end + end end always@(posedge ADC_SCLK_buffer) @@ -124,10 +193,10 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, end assign ADC_SCLK = ADC_SCLK_buffer; - assign ADC_SDIN = ADC_SDIN_buffer; + assign ADC_SDIN = ADC_SDIN_buffer;*/ // Write control - always @(negedge clk) + always @(posedge clk) if(reset) {CMD_TYP,CMD_ADC,SIZEB,we1} <= 0; else if(we & cs) begin @@ -136,14 +205,15 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, CMD_ADC[3:0] <= wrBus[3:0]; end 1: begin CLKDIV <= wrBus; end 2: begin SIZEB[7:0] <= wrBus; end - 3: begin SIZEB[10:8] <= wrBus[2:0]; end - default: begin we1 <= 1; end + 3: begin SIZEB[9:8] <= wrBus[2:0]; end + default: begin we1 <= 1; end endcase end else if(nSample) begin SIZEB <= SIZEB - 1; end - else - begin we1 <= 0; end + else + begin we1 <= 0; end + // Read control always @(posedge clk) if(reset) @@ -153,7 +223,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, 0: begin rdBus <= {CMD_DONE,CMD_TYP,CMD_ADC};end 1: begin rdBus <= CLKDIV; end 2: begin rdBus <= SIZEB[7:0]; end - 3: begin rdBus <= SIZEB[10:8]; end + 3: begin rdBus <= SIZEB[9:8]; end default: begin rdBus <= rdBus1; end endcase end @@ -165,42 +235,42 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART, else begin case (w_st2) 0: begin w_st2 <= 2; SIZEB2<=SIZEB; end - 2: begin - if (SIZEB == 0) - begin w_st2 <= 0; CMD_DONE<= 1; auto_count <= 0; end - else begin - CMD_DONE<= 0; - //Send data to ADC - auto_count <= auto_count+1; - SPI_in_data <= CMD_ADC[3:0]; - SPI_wr <= 1; w_st2 <= 3; - end - end - 3: begin - SPI_wr <= 0; - //Wait for complete convertion - if(!ADC_EOC || ADC_CS) begin - SPI_rd <=1; - if(CMD_TYP) - w_st2<= 2; - else - w_st2<= 4; - end - end - 4: begin - //Write data on BRAM (LOW) - wrBus2 <= SPI_out_data[7:0]; - addr2 <= 4+2*(SIZEB2-SIZEB); - we2 <= 1; w_st2 <= 5; - end - 5: begin we2 <= 0; w_st2 <= 6; end - 6: begin - //Write data on BRAM (HI) - wrBus2 <= SPI_out_data[9:8]; - addr2 <= 5+2*(SIZEB2-SIZEB); - we2 <= 1; w_st2 <= 7; nSample <= 1; - end - 7: begin nSample <= 0; we2 <= 0; SPI_rd <=0; w_st2 <= 2; end + 2: begin + if (SIZEB == 0) + begin w_st2 <= 0; CMD_DONE<= 1; auto_count <= 0; end + else begin + CMD_DONE<= 0; + //Send data to ADC + auto_count <= auto_count+1; + SPI_in_data <= CMD_ADC[3:0]; + SPI_wr <= 1; w_st2 <= 3; + end + end + 3: begin + SPI_wr <= 0; + //Wait for complete convertion + if(ADC_CS && ADC_EOC) begin + SPI_rd <=1; + if(CMD_TYP) + w_st2<= 2; + else + w_st2<= 4; + end + end + 4: begin + //Write data on BRAM (LOW) + wrBus2 <= SPI_out_data[7:0]; + addr2 <= 4+2*(SIZEB-SIZEB2); + we2 <= 1; w_st2 <= 5; + end + 5: begin we2 <= 0; w_st2 <= 6; end + 6: begin + //Write data on BRAM (HI) + wrBus2 <= SPI_out_data[9:8]; + addr2 <= 5+2*(SIZEB-SIZEB2); + we2 <= 1; w_st2 <= 7; nSample <= 1; + end + 7: begin nSample <= 0; we2 <= 0; SPI_rd <=0; w_st2 <= 2; end endcase end