mirror of
git://projects.qi-hardware.com/nn-usb-fpga.git
synced 2025-01-09 15:00:14 +02:00
Fixing LOGIC and QT_src files.
This commit is contained in:
parent
7545f04d37
commit
bebee7c644
BIN
Examples/ADC/QT_src/ADC
Executable file
BIN
Examples/ADC/QT_src/ADC
Executable file
Binary file not shown.
23
Examples/ADC/QT_src/ADC1.pro
Normal file
23
Examples/ADC/QT_src/ADC1.pro
Normal file
@ -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
|
205
Examples/ADC/QT_src/ADC1.pro.user
Normal file
205
Examples/ADC/QT_src/ADC1.pro.user
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<qtcreator>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-Arguments</variable>
|
||||||
|
<valuelist type="QVariantList" />
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-Executable</variable>
|
||||||
|
<value type="QString" ></value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-RunConfiguration.name</variable>
|
||||||
|
<value type="QString" >Custom Executable</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-UseTerminal</variable>
|
||||||
|
<value type="bool" >false</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-UserEnvironmentChanges</variable>
|
||||||
|
<valuelist type="QVariantList" />
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-UserName</variable>
|
||||||
|
<value type="QString" ></value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-UserSetName</variable>
|
||||||
|
<value type="bool" >false</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-WorkingDirectory</variable>
|
||||||
|
<value type="QString" >$BUILDDIR</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>RunConfiguration0-type</variable>
|
||||||
|
<value type="QString" >ProjectExplorer.CustomExecutableRunConfiguration</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>activeRunConfiguration</variable>
|
||||||
|
<value type="int" >0</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>activebuildconfiguration</variable>
|
||||||
|
<value type="QString" >Debug</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildConfiguration-Debug</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
|
||||||
|
<value key="QtVersionId" type="int" >2</value>
|
||||||
|
<value key="addQDumper" type="" ></value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildconfiguration-Debug-buildstep0</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
|
||||||
|
<valuelist key="abstractProcess.Environment" type="QVariantList" >
|
||||||
|
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cTqMrTHqN2,guid=cb05698ea245dbdf49f1995a4bb51c63</value>
|
||||||
|
<value type="QString" >DESKTOP_SESSION=gnome</value>
|
||||||
|
<value type="QString" >DESKTOP_STARTUP_ID=</value>
|
||||||
|
<value type="QString" >DISPLAY=:0.0</value>
|
||||||
|
<value type="QString" >GDMSESSION=gnome</value>
|
||||||
|
<value type="QString" >GDM_KEYBOARD_LAYOUT=es</value>
|
||||||
|
<value type="QString" >GDM_LANG=en_US.UTF-8</value>
|
||||||
|
<value type="QString" >GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||||
|
<value type="QString" >GNOME_KEYRING_PID=2296</value>
|
||||||
|
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-Z9jTYs/socket</value>
|
||||||
|
<value type="QString" >GTK_MODULES=canberra-gtk-module</value>
|
||||||
|
<value type="QString" >GTK_RC_FILES=/etc/gtk/gtkrc:/home/juan64bits/.gtkrc-1.2-gnome2</value>
|
||||||
|
<value type="QString" >HOME=/home/juan64bits</value>
|
||||||
|
<value type="QString" >LANG=en_US.UTF-8</value>
|
||||||
|
<value type="QString" >LANGUAGE=</value>
|
||||||
|
<value type="QString" >LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
|
||||||
|
<value type="QString" >LOGNAME=juan64bits</value>
|
||||||
|
<value type="QString" >ORBIT_SOCKETDIR=/tmp/orbit-juan64bits</value>
|
||||||
|
<value type="QString" >PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||||
|
<value type="QString" >PWD=/home/juan64bits</value>
|
||||||
|
<value type="QString" >QTDIR=/usr</value>
|
||||||
|
<value type="QString" >SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/2311,unix/Maximus:/tmp/.ICE-unix/2311</value>
|
||||||
|
<value type="QString" >SHELL=/bin/bash</value>
|
||||||
|
<value type="QString" >SHLVL=0</value>
|
||||||
|
<value type="QString" >SPEECHD_PORT=7560</value>
|
||||||
|
<value type="QString" >SSH_AGENT_PID=2357</value>
|
||||||
|
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-Z9jTYs/socket.ssh</value>
|
||||||
|
<value type="QString" >USER=juan64bits</value>
|
||||||
|
<value type="QString" >USERNAME=juan64bits</value>
|
||||||
|
<value type="QString" >XAUTHORITY=/var/run/gdm/auth-for-juan64bits-TMPZko/database</value>
|
||||||
|
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||||
|
<value type="QString" >XDG_SESSION_COOKIE=195688a1fd83f711af67c5214b6a489d-1270160483.283912-172210674</value>
|
||||||
|
</valuelist>
|
||||||
|
<valuelist key="abstractProcess.arguments" type="QVariantList" >
|
||||||
|
<value type="QString" >/home/juan64bits/QT/ADC1/ADC1.pro</value>
|
||||||
|
<value type="QString" >-spec</value>
|
||||||
|
<value type="QString" >/usr/share/qt4/mkspecs/linux-g++</value>
|
||||||
|
<value type="QString" >-r</value>
|
||||||
|
<value type="QString" >CONFIG+=debug</value>
|
||||||
|
</valuelist>
|
||||||
|
<value key="abstractProcess.command" type="QString" >/usr/bin/qmake-qt4</value>
|
||||||
|
<value key="abstractProcess.enabled" type="bool" >false</value>
|
||||||
|
<value key="abstractProcess.workingDirectory" type="QString" >/home/juan64bits/QT/ADC1</value>
|
||||||
|
<value key="buildConfiguration" type="int" >2</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildconfiguration-Debug-buildstep1</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
|
||||||
|
<valuelist key="abstractProcess.Environment" type="QVariantList" >
|
||||||
|
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-cTqMrTHqN2,guid=cb05698ea245dbdf49f1995a4bb51c63</value>
|
||||||
|
<value type="QString" >DESKTOP_SESSION=gnome</value>
|
||||||
|
<value type="QString" >DESKTOP_STARTUP_ID=</value>
|
||||||
|
<value type="QString" >DISPLAY=:0.0</value>
|
||||||
|
<value type="QString" >GDMSESSION=gnome</value>
|
||||||
|
<value type="QString" >GDM_KEYBOARD_LAYOUT=es</value>
|
||||||
|
<value type="QString" >GDM_LANG=en_US.UTF-8</value>
|
||||||
|
<value type="QString" >GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
|
||||||
|
<value type="QString" >GNOME_KEYRING_PID=2296</value>
|
||||||
|
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-Z9jTYs/socket</value>
|
||||||
|
<value type="QString" >GTK_MODULES=canberra-gtk-module</value>
|
||||||
|
<value type="QString" >GTK_RC_FILES=/etc/gtk/gtkrc:/home/juan64bits/.gtkrc-1.2-gnome2</value>
|
||||||
|
<value type="QString" >HOME=/home/juan64bits</value>
|
||||||
|
<value type="QString" >LANG=en_US.UTF-8</value>
|
||||||
|
<value type="QString" >LANGUAGE=</value>
|
||||||
|
<value type="QString" >LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
|
||||||
|
<value type="QString" >LOGNAME=juan64bits</value>
|
||||||
|
<value type="QString" >ORBIT_SOCKETDIR=/tmp/orbit-juan64bits</value>
|
||||||
|
<value type="QString" >PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
|
||||||
|
<value type="QString" >PWD=/home/juan64bits</value>
|
||||||
|
<value type="QString" >QTDIR=/usr</value>
|
||||||
|
<value type="QString" >SESSION_MANAGER=local/Maximus:@/tmp/.ICE-unix/2311,unix/Maximus:/tmp/.ICE-unix/2311</value>
|
||||||
|
<value type="QString" >SHELL=/bin/bash</value>
|
||||||
|
<value type="QString" >SHLVL=0</value>
|
||||||
|
<value type="QString" >SPEECHD_PORT=7560</value>
|
||||||
|
<value type="QString" >SSH_AGENT_PID=2357</value>
|
||||||
|
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-Z9jTYs/socket.ssh</value>
|
||||||
|
<value type="QString" >USER=juan64bits</value>
|
||||||
|
<value type="QString" >USERNAME=juan64bits</value>
|
||||||
|
<value type="QString" >XAUTHORITY=/var/run/gdm/auth-for-juan64bits-TMPZko/database</value>
|
||||||
|
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||||
|
<value type="QString" >XDG_SESSION_COOKIE=195688a1fd83f711af67c5214b6a489d-1270160483.283912-172210674</value>
|
||||||
|
</valuelist>
|
||||||
|
<valuelist key="abstractProcess.arguments" type="QVariantList" >
|
||||||
|
<value type="QString" >-w</value>
|
||||||
|
</valuelist>
|
||||||
|
<value key="abstractProcess.command" type="QString" >/usr/bin/make</value>
|
||||||
|
<value key="abstractProcess.enabled" type="bool" >true</value>
|
||||||
|
<value key="abstractProcess.workingDirectory" type="QString" >/home/juan64bits/QT/ADC1</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildconfiguration-Debug-cleanstep0</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildconfigurations</variable>
|
||||||
|
<valuelist type="QVariantList" >
|
||||||
|
<value type="QString" >Debug</value>
|
||||||
|
</valuelist>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildstep0</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" ></value>
|
||||||
|
<value key="mkspec" type="QString" ></value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildstep1</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" ></value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>buildsteps</variable>
|
||||||
|
<valuelist type="QVariantList" >
|
||||||
|
<value type="QString" >trolltech.qt4projectmanager.qmake</value>
|
||||||
|
<value type="QString" >trolltech.qt4projectmanager.make</value>
|
||||||
|
</valuelist>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>cleanstep0</variable>
|
||||||
|
<valuemap type="QVariantMap" >
|
||||||
|
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" ></value>
|
||||||
|
<value key="clean" type="bool" >true</value>
|
||||||
|
</valuemap>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>cleansteps</variable>
|
||||||
|
<valuelist type="QVariantList" >
|
||||||
|
<value type="QString" >trolltech.qt4projectmanager.make</value>
|
||||||
|
</valuelist>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>defaultFileEncoding</variable>
|
||||||
|
<value type="QByteArray" >System</value>
|
||||||
|
</data>
|
||||||
|
<data>
|
||||||
|
<variable>project</variable>
|
||||||
|
<valuemap type="QVariantMap" />
|
||||||
|
</data>
|
||||||
|
</qtcreator>
|
74
Examples/ADC/QT_src/ADCw.cpp
Normal file
74
Examples/ADC/QT_src/ADCw.cpp
Normal file
@ -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;
|
||||||
|
}
|
21
Examples/ADC/QT_src/ADCw.h
Normal file
21
Examples/ADC/QT_src/ADCw.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef ADCW_H
|
||||||
|
#define ADCW_H
|
||||||
|
|
||||||
|
#include "jz_adc_peripheral.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
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
|
265
Examples/ADC/QT_src/Makefile
Normal file
265
Examples/ADC/QT_src/Makefile
Normal file
@ -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:
|
||||||
|
|
108
Examples/ADC/QT_src/jz47xx_gpio.c
Normal file
108
Examples/ADC/QT_src/jz47xx_gpio.c
Normal file
@ -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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <jz47xx_gpio.h>
|
||||||
|
#include <jz47xx_mmap.h>
|
||||||
|
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
108
Examples/ADC/QT_src/jz47xx_gpio.cpp
Normal file
108
Examples/ADC/QT_src/jz47xx_gpio.cpp
Normal file
@ -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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <jz47xx_gpio.h>
|
||||||
|
#include <jz47xx_mmap.h>
|
||||||
|
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
84
Examples/ADC/QT_src/jz47xx_gpio.h
Normal file
84
Examples/ADC/QT_src/jz47xx_gpio.h
Normal file
@ -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
|
39
Examples/ADC/QT_src/jz47xx_mmap.c
Normal file
39
Examples/ADC/QT_src/jz47xx_mmap.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* JZ47xx GPIO lines
|
||||||
|
*
|
||||||
|
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <jz47xx_mmap.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
39
Examples/ADC/QT_src/jz47xx_mmap.cpp
Normal file
39
Examples/ADC/QT_src/jz47xx_mmap.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* JZ47xx GPIO lines
|
||||||
|
*
|
||||||
|
* Written 2010 by Andres Calderon andres.calderon@emqbit.com
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <jz47xx_mmap.h>
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
14
Examples/ADC/QT_src/jz47xx_mmap.h
Normal file
14
Examples/ADC/QT_src/jz47xx_mmap.h
Normal file
@ -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 <sys/mman.h>
|
||||||
|
|
||||||
|
unsigned int * jz_mmap (off_t address);
|
||||||
|
|
||||||
|
#endif
|
36
Examples/ADC/QT_src/jz_adc_peripheral.c
Normal file
36
Examples/ADC/QT_src/jz_adc_peripheral.c
Normal file
@ -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 <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
59
Examples/ADC/QT_src/jz_adc_peripheral.cpp
Normal file
59
Examples/ADC/QT_src/jz_adc_peripheral.cpp
Normal file
@ -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 <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
84
Examples/ADC/QT_src/jz_adc_peripheral.h
Normal file
84
Examples/ADC/QT_src/jz_adc_peripheral.h
Normal file
@ -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
|
110
Examples/ADC/QT_src/jz_test_adc.c
Normal file
110
Examples/ADC/QT_src/jz_test_adc.c
Normal file
@ -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 <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
10
Examples/ADC/QT_src/main.cpp
Executable file
10
Examples/ADC/QT_src/main.cpp
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#include <QtGui/QApplication>
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
MainWindow w;
|
||||||
|
w.show();
|
||||||
|
return a.exec();
|
||||||
|
}
|
47
Examples/ADC/QT_src/mainwindow.cpp
Executable file
47
Examples/ADC/QT_src/mainwindow.cpp
Executable file
@ -0,0 +1,47 @@
|
|||||||
|
#include "mainwindow.h"
|
||||||
|
#include "ui_mainwindow.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <QTime>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
32
Examples/ADC/QT_src/mainwindow.h
Executable file
32
Examples/ADC/QT_src/mainwindow.h
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
#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
|
62
Examples/ADC/QT_src/mainwindow.ui
Executable file
62
Examples/ADC/QT_src/mainwindow.ui
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>320</width>
|
||||||
|
<height>240</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>ADC Test</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralWidget">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="SignalDisplay" name="Graph" native="true">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<action name="action_Salir">
|
||||||
|
<property name="text">
|
||||||
|
<string>&Salir</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionA_cerca_de">
|
||||||
|
<property name="text">
|
||||||
|
<string>A&cerca de...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionAcerca_de_QT">
|
||||||
|
<property name="text">
|
||||||
|
<string>Acerca de &QT</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionAcerca_de_Qt">
|
||||||
|
<property name="text">
|
||||||
|
<string>Acerca de &Qt...</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>SignalDisplay</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">signaldisplay.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
60
Examples/ADC/QT_src/signaldisplay.cpp
Executable file
60
Examples/ADC/QT_src/signaldisplay.cpp
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
#include "signaldisplay.h"
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
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<nx; ix++){
|
||||||
|
int x = ix*w/nx;
|
||||||
|
p.drawLine(x,0,x,h);
|
||||||
|
}
|
||||||
|
for (int iy = 0; iy < ny; iy++){
|
||||||
|
int y = iy*h/ny;
|
||||||
|
p.drawLine(0,y,w,y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void SignalDisplay::paintEvent(QPaintEvent *event){
|
||||||
|
QPainter painter(this);
|
||||||
|
w = width();
|
||||||
|
h = height();
|
||||||
|
ox = w;
|
||||||
|
oy = h;
|
||||||
|
painter.fillRect(0,0,w,h,Qt::gray);
|
||||||
|
painter.setPen(Qt::white);
|
||||||
|
//painter.drawLine(secsIdx*w/10/60.0/pointsPerPlot/secsPerDiv,0, \
|
||||||
|
// secsIdx*w/10/60.0/pointsPerPlot/secsPerDiv,h);
|
||||||
|
drawGrid(painter, Qt::darkGray,0,0,w,h,4, 10);
|
||||||
|
|
||||||
|
/*for(int i = 0; i < pointsPerPlot; i++)
|
||||||
|
{
|
||||||
|
painter.fillRect(waves[i].x()-w/pointsPerPlot/2,waves[i].y(), \
|
||||||
|
w/pointsPerPlot,h-waves[i].y(), Qt::blue);
|
||||||
|
}*/
|
||||||
|
painter.setPen(colorTrace);
|
||||||
|
painter.drawPolyline(waves,pointsPerPlot);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SignalDisplay::addPoint( int value1)
|
||||||
|
{
|
||||||
|
waves[secsIdx] = QPoint(secsIdx*w/10/60.0/pointsPerPlot/secsPerDiv+w/(2*pointsPerPlot), \
|
||||||
|
oy-value1*h/voltsPerDiv/10);
|
||||||
|
secsIdx = (secsIdx+1) % pointsPerPlot;
|
||||||
|
}
|
||||||
|
|
||||||
|
//EOF
|
31
Examples/ADC/QT_src/signaldisplay.h
Executable file
31
Examples/ADC/QT_src/signaldisplay.h
Executable file
@ -0,0 +1,31 @@
|
|||||||
|
#ifndef SIGNALDISPLAY_H
|
||||||
|
#define SIGNALDISPLAY_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <cmath>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
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
|
@ -2,7 +2,7 @@
|
|||||||
module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
||||||
ADC_SCLK, ADC_SDIN, ADC_SDOUT,
|
ADC_SCLK, ADC_SDIN, ADC_SDOUT,
|
||||||
addr, rdBus, wrBus, we);
|
addr, rdBus, wrBus, we);
|
||||||
|
|
||||||
input clk, reset, ADC_EOC, cs, we;
|
input clk, reset, ADC_EOC, cs, we;
|
||||||
input [10:0] addr;
|
input [10:0] addr;
|
||||||
input [7:0] wrBus;
|
input [7:0] wrBus;
|
||||||
@ -13,7 +13,6 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
|||||||
//RAMB registers
|
//RAMB registers
|
||||||
reg [7:0] rdBus;
|
reg [7:0] rdBus;
|
||||||
wire [7:0] rdBus1;
|
wire [7:0] rdBus1;
|
||||||
wire [7:0] rdBus2;
|
|
||||||
reg [7:0] wrBus2;
|
reg [7:0] wrBus2;
|
||||||
reg [10:0] addr2;
|
reg [10:0] addr2;
|
||||||
reg we1=0;
|
reg we1=0;
|
||||||
@ -24,6 +23,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
|||||||
reg nSample=0;
|
reg nSample=0;
|
||||||
reg [10:0] auto_count=0;
|
reg [10:0] auto_count=0;
|
||||||
reg [4:0] w_st2=0;
|
reg [4:0] w_st2=0;
|
||||||
|
|
||||||
|
|
||||||
//SPI registers
|
//SPI registers
|
||||||
reg [3:0] SPI_in_data=0;
|
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 CMD_TYP;
|
||||||
reg [3:0] CMD_ADC;
|
reg [3:0] CMD_ADC;
|
||||||
reg [7:0] CLKDIV = 0;
|
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
|
//TEMPS
|
||||||
reg [10:0] SIZEB2;
|
reg [9:0] SIZEB2;
|
||||||
reg CMD_DONE2;
|
|
||||||
|
|
||||||
assign ADC_CSTART = 1'b1;
|
assign ADC_CSTART = 1'b1;
|
||||||
|
|
||||||
// Dual-port RAM instatiation
|
// Dual-port RAM instatiation
|
||||||
RAMB16_S9_S9 ba0(
|
RAMB16_S9_S9 ba0(
|
||||||
.DOA(rdBus1), // Port A 8-bit Data Output
|
.DOA(rdBus1), // Port A 8-bit Data Output
|
||||||
.DOB(rdBus2), // Port B 8-bit Data Output
|
.DOB(), // Port B 8-bit Data Output
|
||||||
.DOPA(), // Port A 1-bit Parity Output
|
.DOPA(), // Port A 1-bit Parity Output
|
||||||
.DOPB(), // Port B 1-bit Parity Output
|
.DOPB(), // Port B 1-bit Parity Output
|
||||||
.ADDRA(addr[10:0]), // Port A 11-bit Address Input
|
.ADDRA(addr), // Port A 11-bit Address Input
|
||||||
.ADDRB(addr2[10:0]), // Port B 11-bit Address Input
|
.ADDRB(addr2), // Port B 11-bit Address Input
|
||||||
.CLKA(~clk), // Port A Clock
|
.CLKA(~clk), // Port A Clock
|
||||||
.CLKB(~clk), // Port B Clock
|
.CLKB(~clk), // Port B Clock
|
||||||
.DIA(wrBus), // Port A 8-bit Data Input
|
.DIA(wrBus), // Port A 8-bit Data Input
|
||||||
.DIB(wrBus2), // Port B 8-bit Data Input
|
.DIB(wrBus2), // Port B 8-bit Data Input
|
||||||
.DIPA(1'b0), // Port A 1-bit parity Input
|
.DIPA(1'b0), // Port A 1-bit parity Input
|
||||||
.DIPB(1'b0), // Port-B 1-bit parity Input
|
.DIPB(1'b0), // Port-B 1-bit parity Input
|
||||||
.ENA(1'b1), // Port A RAM Enable Input
|
.ENA(1'b1), // Port A RAM Enable Input
|
||||||
.ENB(1'b1), // Port B RAM Enable Input
|
.ENB(1'b1), // Port B RAM Enable Input
|
||||||
.SSRA(1'b0), // Port A Synchronous Set/Reset Input
|
.SSRA(1'b0), // Port A Synchronous Set/Reset Input
|
||||||
.SSRB(1'b0), // Port B Synchronous Set/Reset Input
|
.SSRB(1'b0), // Port B Synchronous Set/Reset Input
|
||||||
.WEA(we1), // Port A Write Enable Input
|
.WEA(we1), // Port A Write Enable Input
|
||||||
.WEB(we2) ); // Port B Write Enable Input
|
.WEB(we2) ); // Port B Write Enable Input
|
||||||
|
|
||||||
// SPI comunication module instantiation
|
// SPI comunication module instantiation
|
||||||
reg ADC_SCLK_buffer = 0;
|
reg ADC_SCLK_buffer = 0;
|
||||||
reg ADC_SDIN_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 [3:0] in_buffer=0;
|
||||||
reg [9:0] out_buffer;
|
reg [9:0] out_buffer;
|
||||||
reg [7:0] clkcount = 0;
|
reg [7:0] clkcount = 0;
|
||||||
reg [4:0] count = 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;
|
assign ADC_CS = ~busy;
|
||||||
|
|
||||||
always@(SPI_rd or out_buffer or busy or CLKDIV)
|
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)
|
if(SPI_wr)
|
||||||
begin in_buffer = SPI_in_data; busy = 1; end
|
begin in_buffer = SPI_in_data; busy = 1; end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
clkcount = clkcount + 1;
|
clkcount = clkcount + 1;
|
||||||
if(clkcount >= CLKDIV)
|
if(clkcount >= CLKDIV)
|
||||||
begin
|
begin
|
||||||
@ -114,7 +183,7 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
|||||||
busy = 0;
|
busy = 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
always@(posedge ADC_SCLK_buffer)
|
always@(posedge ADC_SCLK_buffer)
|
||||||
@ -124,10 +193,10 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
|||||||
end
|
end
|
||||||
|
|
||||||
assign ADC_SCLK = ADC_SCLK_buffer;
|
assign ADC_SCLK = ADC_SCLK_buffer;
|
||||||
assign ADC_SDIN = ADC_SDIN_buffer;
|
assign ADC_SDIN = ADC_SDIN_buffer;*/
|
||||||
|
|
||||||
// Write control
|
// Write control
|
||||||
always @(negedge clk)
|
always @(posedge clk)
|
||||||
if(reset)
|
if(reset)
|
||||||
{CMD_TYP,CMD_ADC,SIZEB,we1} <= 0;
|
{CMD_TYP,CMD_ADC,SIZEB,we1} <= 0;
|
||||||
else if(we & cs) begin
|
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
|
CMD_ADC[3:0] <= wrBus[3:0]; end
|
||||||
1: begin CLKDIV <= wrBus; end
|
1: begin CLKDIV <= wrBus; end
|
||||||
2: begin SIZEB[7:0] <= wrBus; end
|
2: begin SIZEB[7:0] <= wrBus; end
|
||||||
3: begin SIZEB[10:8] <= wrBus[2:0]; end
|
3: begin SIZEB[9:8] <= wrBus[2:0]; end
|
||||||
default: begin we1 <= 1; end
|
default: begin we1 <= 1; end
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
else if(nSample)
|
else if(nSample)
|
||||||
begin SIZEB <= SIZEB - 1; end
|
begin SIZEB <= SIZEB - 1; end
|
||||||
else
|
else
|
||||||
begin we1 <= 0; end
|
begin we1 <= 0; end
|
||||||
|
|
||||||
// Read control
|
// Read control
|
||||||
always @(posedge clk)
|
always @(posedge clk)
|
||||||
if(reset)
|
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
|
0: begin rdBus <= {CMD_DONE,CMD_TYP,CMD_ADC};end
|
||||||
1: begin rdBus <= CLKDIV; end
|
1: begin rdBus <= CLKDIV; end
|
||||||
2: begin rdBus <= SIZEB[7:0]; 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
|
default: begin rdBus <= rdBus1; end
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
@ -165,42 +235,42 @@ module ADC_peripheral( clk, reset, cs, ADC_EOC, ADC_CS, ADC_CSTART,
|
|||||||
else begin
|
else begin
|
||||||
case (w_st2)
|
case (w_st2)
|
||||||
0: begin w_st2 <= 2; SIZEB2<=SIZEB; end
|
0: begin w_st2 <= 2; SIZEB2<=SIZEB; end
|
||||||
2: begin
|
2: begin
|
||||||
if (SIZEB == 0)
|
if (SIZEB == 0)
|
||||||
begin w_st2 <= 0; CMD_DONE<= 1; auto_count <= 0; end
|
begin w_st2 <= 0; CMD_DONE<= 1; auto_count <= 0; end
|
||||||
else begin
|
else begin
|
||||||
CMD_DONE<= 0;
|
CMD_DONE<= 0;
|
||||||
//Send data to ADC
|
//Send data to ADC
|
||||||
auto_count <= auto_count+1;
|
auto_count <= auto_count+1;
|
||||||
SPI_in_data <= CMD_ADC[3:0];
|
SPI_in_data <= CMD_ADC[3:0];
|
||||||
SPI_wr <= 1; w_st2 <= 3;
|
SPI_wr <= 1; w_st2 <= 3;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
3: begin
|
3: begin
|
||||||
SPI_wr <= 0;
|
SPI_wr <= 0;
|
||||||
//Wait for complete convertion
|
//Wait for complete convertion
|
||||||
if(!ADC_EOC || ADC_CS) begin
|
if(ADC_CS && ADC_EOC) begin
|
||||||
SPI_rd <=1;
|
SPI_rd <=1;
|
||||||
if(CMD_TYP)
|
if(CMD_TYP)
|
||||||
w_st2<= 2;
|
w_st2<= 2;
|
||||||
else
|
else
|
||||||
w_st2<= 4;
|
w_st2<= 4;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
4: begin
|
4: begin
|
||||||
//Write data on BRAM (LOW)
|
//Write data on BRAM (LOW)
|
||||||
wrBus2 <= SPI_out_data[7:0];
|
wrBus2 <= SPI_out_data[7:0];
|
||||||
addr2 <= 4+2*(SIZEB2-SIZEB);
|
addr2 <= 4+2*(SIZEB-SIZEB2);
|
||||||
we2 <= 1; w_st2 <= 5;
|
we2 <= 1; w_st2 <= 5;
|
||||||
end
|
end
|
||||||
5: begin we2 <= 0; w_st2 <= 6; end
|
5: begin we2 <= 0; w_st2 <= 6; end
|
||||||
6: begin
|
6: begin
|
||||||
//Write data on BRAM (HI)
|
//Write data on BRAM (HI)
|
||||||
wrBus2 <= SPI_out_data[9:8];
|
wrBus2 <= SPI_out_data[9:8];
|
||||||
addr2 <= 5+2*(SIZEB2-SIZEB);
|
addr2 <= 5+2*(SIZEB-SIZEB2);
|
||||||
we2 <= 1; w_st2 <= 7; nSample <= 1;
|
we2 <= 1; w_st2 <= 7; nSample <= 1;
|
||||||
end
|
end
|
||||||
7: begin nSample <= 0; we2 <= 0; SPI_rd <=0; w_st2 <= 2; end
|
7: begin nSample <= 0; we2 <= 0; SPI_rd <=0; w_st2 <= 2; end
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user