No changes between revisions
/Designs/Oscilloscope/SW/PC_side/qscope/Makefile
1,6 → 1,6
#############################################################################
# Makefile for building: qscope
# Generated by qmake (2.01a) (Qt 4.7.2) on: Sun Aug 14 00:40:57 2011
# Generated by qmake (2.01a) (Qt 4.7.4) on: so 11 12 19:21:14 2011
# Project: qscope.pro
# Template: app
# Command: /usr/bin/qmake -o Makefile qscope.pro
10,13 → 10,13
 
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
DEFINES = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I.
LINK = g++
LFLAGS = -Wl,-O1 -Wl,-rpath,/usr/lib/qt4
LIBS = $(SUBLIBS) -L/usr/lib/qt4 -lQtGui -L/usr/lib/qt4 -L/usr/X11R6/lib -lQtCore -lgthread-2.0 -lrt -lglib-2.0 -lpthread
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lQtGui -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
52,7 → 52,6
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
101,11 → 100,10
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
Makefile: qscope.pro /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
Makefile: qscope.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
/usr/share/qt4/mkspecs/common/unix.conf \
/usr/share/qt4/mkspecs/common/linux.conf \
/usr/share/qt4/mkspecs/qconfig.pri \
/usr/share/qt4/mkspecs/modules/qt_phonon.pri \
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
/usr/share/qt4/mkspecs/features/qt_functions.prf \
/usr/share/qt4/mkspecs/features/qt_config.prf \
122,14 → 120,13
/usr/share/qt4/mkspecs/features/yacc.prf \
/usr/share/qt4/mkspecs/features/lex.prf \
/usr/share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/qt4/libQtGui.prl \
/usr/lib/qt4/libQtCore.prl
/usr/lib/x86_64-linux-gnu/libQtGui.prl \
/usr/lib/x86_64-linux-gnu/libQtCore.prl
$(QMAKE) -o Makefile qscope.pro
/usr/share/qt4/mkspecs/common/g++.conf:
/usr/share/qt4/mkspecs/common/unix.conf:
/usr/share/qt4/mkspecs/common/linux.conf:
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/modules/qt_phonon.pri:
/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri:
/usr/share/qt4/mkspecs/features/qt_functions.prf:
/usr/share/qt4/mkspecs/features/qt_config.prf:
146,8 → 143,8
/usr/share/qt4/mkspecs/features/yacc.prf:
/usr/share/qt4/mkspecs/features/lex.prf:
/usr/share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/qt4/libQtGui.prl:
/usr/lib/qt4/libQtCore.prl:
/usr/lib/x86_64-linux-gnu/libQtGui.prl:
/usr/lib/x86_64-linux-gnu/libQtCore.prl:
qmake: FORCE
@$(QMAKE) -o Makefile qscope.pro
 
178,7 → 175,7
compiler_moc_header_clean:
-$(DEL_FILE) moc_scope.cpp
moc_scope.cpp: scope.h
/usr/bin/moc $(DEFINES) $(INCPATH) scope.h -o moc_scope.cpp
/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) scope.h -o moc_scope.cpp
 
compiler_rcc_make_all:
compiler_rcc_clean:
/Designs/Oscilloscope/SW/PC_side/qscope/qscope
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/Designs/Oscilloscope/SW/PC_side/stty_setting.sh
1,0 → 0,0
#!/bin/bash
stty -F /dev/ttyUSB0 1000000 raw -hupcl -echo -echok -echoctl
/Designs/Oscilloscope/SW/firmware/gnuradio/Makefile
0,0 → 1,33
PRG = scope
OBJ = main.o ./libs/usart.o ./libs/spi.o
MCU_TARGET = atmega8
AVRDUDE_PART = m8
 
OPTIMIZE = -O1
# OPTIMIZE = -Os
 
CC = avr-gcc
override CFLAGS = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
OBJCOPY = avr-objcopy
OBJDUMP = avr-objdump
 
all: hex
 
./libs/spi.o: ./libs/spi.h
./libs/usart.o: ./libs/usart.h
#./libs/timer.o: ./libs/timer.h
 
hex: $(PRG).hex
 
%.hex: %.elf
$(OBJCOPY) -j .text -j .data -O ihex $< $@
 
$(PRG).elf: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
 
load: $(PRG).hex
avrdude -p $(AVRDUDE_PART) -c stk500v2 -P /dev/ttyUSB0 -B 2 -U flash:w:$<
 
clean:
rm -rf *.o $(PRG).elf $(PRG).hex ./libs/*.o
 
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/Designs/Oscilloscope/SW/firmware/gnuradio/libs/spi.c
0,0 → 1,20
#include "spi.h"
 
#include <avr/io.h>
 
void SPI_MasterInit(void)
{
/* Enable SPI, Master, set clock rate fck/4, SCK high when idle, sample on rising */
// SPSR|= 0b00000001; //for fck/2
SPCR = 0b01011100;
}
 
char SPI_MasterTransmit(char cData) {
/* Start transmission */
SPDR = cData;
 
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
;
return SPDR;
}
/Designs/Oscilloscope/SW/firmware/gnuradio/libs/spi.h
0,0 → 1,7
#ifndef SPI_H
#define SPI_H
 
void SPI_MasterInit(void);
char SPI_MasterTransmit(char cData);
 
#endif
/Designs/Oscilloscope/SW/firmware/gnuradio/libs/usart.c
0,0 → 1,128
#include "usart.h"
 
#include <avr/io.h>
 
 
void USART_Init( unsigned int ubrr)
{
/* Set baud rate */
UBRRH = (unsigned char)(ubrr>>8);
UBRRL = (unsigned char)ubrr;
 
/* flush transmitt register Double speed */
UCSRA = (1<<UDRE)|(1 << U2X);
 
/* enable receiver interrupt and transmitter, pins forced */
UCSRB = (1<<RXCIE)|(1<<RXEN)|(1<<TXEN);
 
/* Asynchronous, no parity, Set frame format: 8data, 1stop bit */
UCSRC = (1<<URSEL)|(1<<UCSZ0)|(1<<UCSZ1);
}
 
 
void USART_Transmit( unsigned char data )
{
while ( !( UCSRA & (1<<UDRE)) ); /* Wait for empty transmit buffer */
 
UDR = data; /* Put data into buffer, sends the data */
}
 
 
void USART_Transmit_string( char *data )
{
while ( *data != 0 ) {
USART_Transmit(*data);
data++;
}
}
 
 
void USART_Transmit_longnum(signed long data ) {
unsigned char digits[10],i;
 
if (data==0)
USART_Transmit('0');
else { // PROZKOUMAT!
 
if (data<0) {
USART_Transmit('-');
data*=-1;
}
 
for (i=0;i<10;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=9;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_uint16 (unsigned int data ) {
unsigned char digits[5],i;
 
if (data==0) //podivne, ale nulu to odeslat neumi
USART_Transmit('0');
else {
 
for (i=0;i<5;i++) {
digits[i]=data%10;
data=data/10;
}
 
i=4;
while (digits[i]==0) i--;
while (i>0) {
USART_Transmit(digits[i]+48);
i--;
}
USART_Transmit(digits[0]+48);
 
}
}
 
 
void USART_Transmit_num(unsigned char data ) {
unsigned char a,b,c;
 
c=data%10;
data=data/10;
b=data%10;
data=data/10;
a=data%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}
 
 
/*void USART_Transmit_float( float data ) {
int a,b,c;
 
c=((int)data)%10;
b=((int)(data/10))%10;
a=((int)(data/100))%10;
 
USART_Transmit(a+48);
USART_Transmit(b+48);
USART_Transmit(c+48);
}*/
 
 
void USART_Transmit_byte( char data ) {
unsigned char i;
i=0b10000000;
while (i) {
USART_Transmit( ( (i&data)&&1 ) + 48 );
i>>=1;
}
}
/Designs/Oscilloscope/SW/firmware/gnuradio/libs/usart.h
0,0 → 1,17
#ifndef USART_H
#define USART_H
 
//Inits:
void USART_Init( unsigned int ubrr); // 8b, no parity, 1 stop
// asynchronous, RX interrupt
 
// Busy loops:
void USART_Transmit( unsigned char data ); // send char (1B)
void USART_Transmit_string( char *data ); // send string
void USART_Transmit_num( unsigned char data ); // send ascii
void USART_Transmit_longnum( signed long data ); // send ascii
void USART_Transmit_uint16( unsigned int data ); // send ascii
//void USART_Transmit_float( float data );
void USART_Transmit_byte( char data ); //send in ascii hex reprezentation
 
#endif
/Designs/Oscilloscope/SW/firmware/gnuradio/main.c
0,0 → 1,38
// Oscilloscope firmware, Roman Pavelka, 2011
// written for atmega8
 
#define F_CPU 16000000
#define BAUD 1000000
//#define MYUBRR F_CPU/8/BAUD-1
#define MYUBRR 1
 
#include "./libs/usart.h"
#include "./libs/spi.h"
 
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <inttypes.h>
 
int main (void) {
USART_Init(MYUBRR);
 
DDRB = 0b00100100; //SCK, SS out
PORTB = 0b00000000; // CONV low
 
SPI_MasterInit();
 
 
while(1)
{
PORTB |= 0b00000100;
_delay_us(4);
PORTB &= 0b11111011; //one conversion
 
USART_Transmit(SPI_MasterTransmit(0x0)); //Binary transfer
USART_Transmit(SPI_MasterTransmit(0x0));
_delay_us(4);
}
return 0;
}