kopia lustrzana https://github.com/F5OEO/rpitx
Major update : New DMA method
rodzic
61a68da1e8
commit
0ae30f8352
13
am/piam.c
13
am/piam.c
|
@ -12,10 +12,10 @@
|
|||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#define ln(x) (log(x)/log(2.718281828459045235f))
|
||||
#define BUFFER_LEN 1024*8
|
||||
int FileFreqTiming;
|
||||
// Test program using SNDFILE
|
||||
|
@ -99,7 +99,14 @@ int main(int argc, char **argv) {
|
|||
x /= 2 ;
|
||||
}
|
||||
//printf("%f \n",x);
|
||||
WriteTone(x*32767*2.0,1e9/48000.0);
|
||||
float FactAmplitude=2.0; // To be analyzed more deeply !
|
||||
/*
|
||||
double A = 87.7f; // compression parameter
|
||||
double ampf=x/32767.0;
|
||||
ampf = (fabs(ampf) < 1.0f/A) ? A*fabs(ampf)/(1.0f+ln(A)) : (1.0f+ln(A*fabs(ampf)))/(1.0f+ln(A)); //compand
|
||||
x= (int)(round(ampf * 32767.0f)) ;
|
||||
*/
|
||||
WriteTone(x*32767*FactAmplitude,1e9/48000.0);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ int main(int argc, char **argv) {
|
|||
/* While there are.frames in the input file, read them, process
|
||||
** them and write them to the output file.
|
||||
*/
|
||||
int Excursion=12500;
|
||||
int Excursion=6000;
|
||||
while ((readcount = sf_readf_float(infile, data, BUFFER_LEN)))
|
||||
{
|
||||
nb_samples = readcount / sfinfo.channels ;
|
||||
|
|
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
Plik binarny nie jest wyświetlany.
|
@ -2,5 +2,5 @@ raspistill -w 320 -h 256 -o picture.jpg -t 1
|
|||
convert -depth 8 picture.jpg picture.rgb
|
||||
|
||||
./pisstv picture.rgb picture.ft
|
||||
sudo ./rpitx -m RF -i picture.ft -f 100000
|
||||
sudo ./rpitx -m RF -i picture.ft -f 50105
|
||||
|
||||
|
|
28
src/RpiDma.c
28
src/RpiDma.c
|
@ -1,8 +1,36 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include "RpiDma.h"
|
||||
#include "RpiGpio.h"
|
||||
char InitDma(void *FunctionTerminate)
|
||||
{
|
||||
DMA_CHANNEL=4;
|
||||
system("rm linuxversion.txt");
|
||||
system("uname -r >> linuxversion.txt");
|
||||
char *line = NULL;
|
||||
size_t size;
|
||||
// int fLinux=open("Flinuxversion.txt", "r');
|
||||
FILE * flinux=fopen("linuxversion.txt", "r");
|
||||
if (getline(&line, &size, flinux) == -1)
|
||||
{
|
||||
printf("Could no get Linux version\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(line[0]=='3')
|
||||
{
|
||||
printf("Wheezy\n");
|
||||
DMA_CHANNEL=DMA_CHANNEL_WHEEZY;
|
||||
}
|
||||
|
||||
if(line[0]=='4')
|
||||
{
|
||||
printf("Jessie\n");
|
||||
DMA_CHANNEL=DMA_CHANNEL_JESSIE;
|
||||
}
|
||||
|
||||
}
|
||||
//printf("Init DMA\n");
|
||||
|
||||
// Catch all signals possible - it is vital we kill the DMA engine
|
||||
|
|
20
src/RpiDma.h
20
src/RpiDma.h
|
@ -24,7 +24,7 @@ uint32_t mem_phys_to_virt(volatile uint32_t phys);
|
|||
#define NUM_CB_PWM_FREQUENCY 8
|
||||
//#define MBFILE DEVICE_FILE_NAME /* From mailbox.h */
|
||||
#define NUM_SAMPLES_MAX (4000)
|
||||
#define CBS_SIZE_BY_SAMPLE (8) // !!!!! With 8 CBS : DMA 2 DOES NOT START !!!!!!!!!!!
|
||||
#define CBS_SIZE_BY_SAMPLE (5)
|
||||
#define NUM_CBS_MAIN ((NUM_SAMPLES_MAX * CBS_SIZE_BY_SAMPLE))
|
||||
#define NUM_CBS (NUM_CBS_MAIN)
|
||||
|
||||
|
@ -73,7 +73,13 @@ struct {
|
|||
//3893 : 111100110101
|
||||
// USE CHANNEL 4 AND 5 which seems to be free
|
||||
// On Jessie, channel 4 and 5 seems to crash : set to DMA 8 .
|
||||
#define DMA_CHANNEL 8
|
||||
#define DMA_CHANNEL_WHEEZY 14
|
||||
#define DMA_CHANNEL_JESSIE 8
|
||||
//#define DMA_CHANNEL_PWMFREQUENCY 5
|
||||
|
||||
char DMA_CHANNEL;
|
||||
|
||||
//#define DMA_CHANNEL 8
|
||||
|
||||
#define DMA_CHANNEL_PWMFREQUENCY (DMA_CHANNEL+1)
|
||||
|
||||
|
@ -92,14 +98,17 @@ page_map_t *page_map;
|
|||
uint8_t *virtbase;
|
||||
|
||||
typedef struct {
|
||||
uint32_t Frequency1;
|
||||
uint32_t Frequency2;
|
||||
//uint32_t Frequency1;
|
||||
//uint32_t Frequency2;
|
||||
uint32_t Amplitude1;
|
||||
uint32_t Amplitude2;
|
||||
uint32_t PWMF1;
|
||||
uint32_t PWMF2;
|
||||
uint32_t WaitForThisSample;
|
||||
uint32_t dummy;
|
||||
uint32_t PCMRegister;
|
||||
uint32_t FrequencyTab[200];
|
||||
uint32_t debugSet;
|
||||
uint32_t debugClear;
|
||||
} sample_t;
|
||||
|
||||
|
||||
|
@ -112,6 +121,7 @@ struct control_data_s {
|
|||
uint32_t SharedFrequency1;
|
||||
uint32_t SharedFrequency2;
|
||||
uint32_t DmaPwmfControlRegister;
|
||||
uint32_t SharedFrequencyTab[100];
|
||||
|
||||
};
|
||||
|
||||
|
|
927
src/RpiTx.c
927
src/RpiTx.c
Plik diff jest za duży
Load Diff
|
@ -1,5 +1,5 @@
|
|||
#include <ctype.h>
|
||||
|
||||
int pitx_init(int SampleRate);
|
||||
int pitx_init(int SampleRate,double TuningFrequency);
|
||||
int pitx_SetTuneFrequencyu(uint32_t Frequency);
|
||||
|
||||
|
|
|
@ -191,6 +191,7 @@ void ssb(float in, int USB, float* out_I, float* out_Q) {
|
|||
|
||||
// low pass filter y to keep only audio band
|
||||
y = fir_filt( audio_fir, y );
|
||||
#define AUDIO_COMPRESSOR
|
||||
#ifdef AUDIO_COMPRESSOR
|
||||
//----------- audio compressor
|
||||
//--- code inspired from http://www.musicdsp.org/showone.php?id=169
|
||||
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char **argv) {
|
|||
printf ("Channels : %d\n", sf_out.channels) ;
|
||||
|
||||
// la porteuse SSB est décalée de +1K
|
||||
ssb_init( 10000 );
|
||||
ssb_init( 1000 );
|
||||
|
||||
/* While there are.frames in the input file, read them, process
|
||||
** them and write them to the output file.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
./piam sampleaudio.wav am.rfa
|
||||
sudo ./rpitx -m RFA -i am.rfa -f 433900 -l
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
./pifm audio48mono.wav fm.ft
|
||||
sudo ./rpitx -m RF -i fm.ft -f 100000 -l
|
||||
./pifm sampleaudio.wav fm.ft
|
||||
sudo ./rpitx -m RF -i fm.ft -f 433900 -l
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
./pifsq Test testfsq.ft
|
||||
sudo ./rpitx -m RF -i testfsq.ft -f 144100 -d 1
|
||||
sudo ./rpitx -m RF -i testfsq.ft -f 7050 -l
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
./pissb audio48mono.wav ssbIQ.wav
|
||||
sudo ./rpitx -m IQ -i ssbIQ.wav -f 50100 -l
|
||||
./pissb ./sampleaudio.wav ./ssbIQ.wav
|
||||
sudo ./rpitx -m IQ -i ./ssbIQ.wav -f 433900 -l
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
sudo ./rpitx -m VFO -f 100000
|
||||
sudo ./rpitx -m VFO -f 433900
|
||||
|
|
Ładowanie…
Reference in New Issue