Skip to content

Commit

Permalink
saving Progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Mubshr07 committed Jul 10, 2021
1 parent 0062050 commit 4525cdb
Show file tree
Hide file tree
Showing 35 changed files with 10,611 additions and 8,685 deletions.
146 changes: 73 additions & 73 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash

# qtcreator generated files
*.pro.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash

# qtcreator generated files
*.pro.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

127 changes: 69 additions & 58 deletions DAQ.pro
Original file line number Diff line number Diff line change
@@ -1,58 +1,69 @@
QT += core gui printsupport

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
classes/addressing.cpp \
classes/chnlclass_simple.cpp \
classes/qcustomplot.cpp \
classes/globalvars.cpp \
classes/loggerthread.cpp \
configchwin.cpp \
confirmationbox.cpp \
firstwindow.cpp \
graphwin.cpp \
main.cpp \
mainhandler.cpp \
mainwindow.cpp

HEADERS += \
classes/addressing.h \
classes/chnlclass_simple.h \
classes/qcustomplot.h \
classes/globalvars.h \
classes/loggerthread.h \
configchwin.h \
confirmationbox.h \
firstwindow.h \
graphwin.h \
mainhandler.h \
mainwindow.h

FORMS += \
configchwin.ui \
confirmationbox.ui \
firstwindow.ui \
graphwin.ui \
mainwindow.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
pics.qrc
QT += core gui printsupport

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
classes/addressing.cpp \
classes/chnlclass_simple.cpp \
classes/qcustomplot.cpp \
classes/globalvars.cpp \
classes/loggerthread.cpp \
configchwin.cpp \
confirmationbox.cpp \
debugwin.cpp \
firstwindow.cpp \
graphwin.cpp \
main.cpp \
mainhandler.cpp \
mainwindow.cpp \
newdebug.cpp

HEADERS += \
classes/addressing.h \
classes/chnlclass_simple.h \
classes/qcustomplot.h \
classes/globalvars.h \
classes/loggerthread.h \
configchwin.h \
confirmationbox.h \
debugwin.h \
firstwindow.h \
graphwin.h \
mainhandler.h \
mainwindow.h \
newdebug.h

FORMS += \
configchwin.ui \
confirmationbox.ui \
debugwin.ui \
firstwindow.ui \
graphwin.ui \
mainwindow.ui \
newdebug.ui

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

RESOURCES += \
pics.qrc


target.path = /home/root/
INSTALLS += target

75 changes: 23 additions & 52 deletions classes/addressing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,69 +27,40 @@ int fd;
volatile void *h2p_lw_led_addr;
int LEDs = 0x00;

volatile void *ADC_0;
volatile void *ADC_1;
volatile void *ADC_2;
volatile void *ADC_3;
volatile void *ADC_4;
volatile void *ADC_5;
volatile void *ADC_6;
volatile void *ADC_7;
volatile void *FPGA_MAIN;
volatile void *LED_ADDR;


#define ADC0_base (0x20)
#define ADC1_base (0x40)
#define ADC2_base (0x40)
#define ADC3_base (0x40)
#define ADC4_base (0x40)
#define ADC5_base (0x40)
#define ADC6_base (0x40)
#define ADC7_base (0x40)
#define FPGA_base (0x400)
#define LED_base (0x00)

int Addressing::get_address_of_peripherals()
{
// map the address space for the LED registers into user space so we can interact with them.
// we'll actually map in the entire CSR span of the HPS since we want to access various registers within that span
// map the address space for the LED registeFPGA_basers into user space so we can interact with them.
// we'll actually map in the entire CSR span of the HPS since we want to access various registers within that span

// map the address space for the LED registers into user space so we can interact with them.
// we'll actually map in the entire CSR span of the HPS since we want to access various registers within that span


return -1;

/*
if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {
printf( "ERROR: could not open \"/dev/mem\"...\n" );
return -1;
}
virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, HW_REGS_BASE );
if( virtual_base == MAP_FAILED ) {
printf( "ERROR: mmap() failed...\n" ); close( fd );
return -1;
}
ADC_0 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC0_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_1 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC1_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_2 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC2_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_3 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC3_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_4 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC4_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_5 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC5_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_6 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC6_base) & ( unsigned long)( HW_REGS_MASK ) );
ADC_7 = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + ADC7_base) & ( unsigned long)( HW_REGS_MASK ) );
*/
if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {
printf( "ERROR: could not open \"/dev/mem\"...\n" );
return -1;
}
virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, HW_REGS_BASE );
if( virtual_base == MAP_FAILED ) {
printf( "ERROR: mmap() failed...\n" ); close( fd );
return -2;
}
FPGA_MAIN = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + FPGA_base) & ( unsigned long)( HW_REGS_MASK ) );
LED_ADDR = virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + LED_base) & ( unsigned long)( HW_REGS_MASK ) );

return 0;
return 1;
}


int32_t* Addressing::givemeaddr(int a)
uint32_t* Addressing::givemeaddr(int a)
{
if (a == 0) return (int32_t*)ADC_0;
else if (a == 1) return (int32_t*)ADC_1;
else if (a == 2) return (int32_t*)ADC_2;
else if (a == 3) return (int32_t*)ADC_3;
else if (a == 4) return (int32_t*)ADC_4;
else if (a == 5) return (int32_t*)ADC_5;
else if (a == 6) return (int32_t*)ADC_6;
else if (a == 7) return (int32_t*)ADC_7;
else return (int32_t*)ADC_0;
if (a == 0) return (uint32_t*)FPGA_MAIN;
else if (a == 1) return (uint32_t*)LED_ADDR;

else return (uint32_t*)FPGA_MAIN;
}
4 changes: 2 additions & 2 deletions classes/addressing.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef ADDRESSING_H
#define ADDRESSING_H

//#include <sys/mman.h>
#include <sys/mman.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -18,7 +18,7 @@ class Addressing
public:
Addressing();
int get_address_of_peripherals();
int32_t* givemeaddr(int a);
uint32_t* givemeaddr(int a);
};

#endif // ADDRESSING_H
Loading

0 comments on commit 4525cdb

Please sign in to comment.