Commit 6ebbf4da4db915526ce2769ba22971f1c2c32455

Authored by bachi
1 parent 41fb442f69
Exists in master

ad9915.h : normalisation totales des noms de fonctions

Showing 1 changed file with 9 additions and 9 deletions Inline Diff

/* 1 1 /*
dds initialisation et SPI 2 2 dds initialisation et SPI
*/ 3 3 */
4 4
#include <stdint.h> 5 5 #include <stdint.h>
#include <unistd.h> 6 6 #include <unistd.h>
#include <stdio.h> 7 7 #include <stdio.h>
#include <stdlib.h> 8 8 #include <stdlib.h>
#include <getopt.h> 9 9 #include <getopt.h>
#include <fcntl.h> 10 10 #include <fcntl.h>
#include <sys/ioctl.h> 11 11 #include <sys/ioctl.h>
#include <linux/types.h> 12 12 #include <linux/types.h>
#include <linux/spi/spidev.h> 13 13 #include <linux/spi/spidev.h>
/* memory management */ 14 14 /* memory management */
#include <sys/mman.h> 15 15 #include <sys/mman.h>
#include "spi.h" 16 16 #include "spi.h"
#include <string.h> 17 17 #include <string.h>
#include <math.h> 18 18 #include <math.h>
#include <time.h> 19 19 #include <time.h>
20 20
21 21
static const char CFRAddress[] = {0x00,0x01,0x02,0x03}; 22 22 static const char CFRAddress[] = {0x00,0x01,0x02,0x03};
23 23
static const char CFR1Start[] ={0x00, 0x01, 0x00, 0x0a}; 24 24 static const char CFR1Start[] ={0x00, 0x01, 0x00, 0x0a};
//static const char CFR1Start[] ={0x00, 0x01, 0x01, 0x08}; //with osk enable 25 25 //static const char CFR1Start[] ={0x00, 0x01, 0x01, 0x08}; //with osk enable
static const char CFR2Start[] ={0x00, 0x80, 0x09, 0x00}; //0x80 enable prof mode 26 26 static const char CFR2Start[] ={0x00, 0x80, 0x09, 0x00}; //0x80 enable prof mode
static const char CFR3Start[] = {0x00, 0x00, 0x19, 0x1C}; 27 27 static const char CFR3Start[] = {0x00, 0x00, 0x19, 0x1C};
static const char CFR4Start[] = {0x00, 0x05, 0x21, 0x20}; 28 28 static const char CFR4Start[] = {0x00, 0x05, 0x21, 0x20};
//static const char CFR4Start[] = {0x20, 0x21, 0x05, 0x00}; 29 29 //static const char CFR4Start[] = {0x20, 0x21, 0x05, 0x00};
30 30
31 31
static const char USR0Address = 0x1B; 32 32 static const char USR0Address = 0x1B;
static const char FTW0Address = 0x0b; //profile 0 ftw 33 33 static const char FTW0Address = 0x0b; //profile 0 ftw
static const char PA0Address = 0x0c; //profile 0 34 34 static const char PA0Address = 0x0c; //profile 0
35 35
static const char DACCalEnable[] = {0x01, 0x05, 0x21, 0x20}; //Command to enable the DAC Cal, should be 0x01XXXXXX, where X is the last 6 digits of CFR4Start 36 36 static const char DACCalEnable[] = {0x01, 0x05, 0x21, 0x20}; //Command to enable the DAC Cal, should be 0x01XXXXXX, where X is the last 6 digits of CFR4Start
37 37
38 38
void Send_Reset(int f_dds); 39 39 void sendReset(int f_dds);
void Send_IO_Update (int f_dds); //Send the update to set the control registers 40 40 void sendIOUpdate (int f_dds); //Send the update to set the control registers
void write_register (int fd, unsigned char addr, unsigned char d3, unsigned char d2, unsigned char d1, unsigned char d0); 41 41 void writeRegister (int fd, unsigned char addr, unsigned char d3, unsigned char d2, unsigned char d1, unsigned char d0);
void read_register (int fd, unsigned char addr, uint32_t *readword); 42 42 void readRegister (int fd, unsigned char addr, uint32_t *readword);
void read_register_ini (int fd,unsigned char addr); 43 43 void readRegister_ini (int fd,unsigned char addr);
void Initialize_DDS (int fd, int f_dds); 44 44 void initializeDDS (int fd, int f_dds);
void Calibrate_DAC(int fd, int f_dds); 45 45 void calibrateDAC(int fd, int f_dds);
void basic_setup(int fd, int f_dds, uint16_t ampWord, uint16_t phaseWord); 46 46 void basicSetup(int fd, int f_dds, uint16_t ampWord, uint16_t phaseWord);
void modulus_setup(int fd, int f_dds); 47 47 void modulusSetup(int fd, int f_dds);
void setFreqMM(int fd, int f_dds, unsigned int ftw, unsigned int A, unsigned int B); 48 48 void setFreqMM(int fd, int f_dds, unsigned int ftw, unsigned int A, unsigned int B);
void setAmpPhaseWord(int fd, int f_dds,unsigned int phaseAmpWord); 49 49 void setAmpPhaseWord(int fd, int f_dds,unsigned int phaseAmpWord);
void checkSize(void); 50 50 void checkSize(void);
int openAndSetDdsFreq( char * device, char * gpio_update, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord); 51 51 int openAndSetDdsFreq( char * device, char * gpio_update, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord);
int receiveParameterFromPythonServer(char * device, double f_clk, double f_out); 52 52 int receiveParameterFromPythonServer(char * device, double f_clk, double f_out);
int setDdsFreqFull ( int fd, int f_dds, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord); 53 53 int setDdsFreqFull ( int fd, int f_dds, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord);
54 54
//------------ DRCTL 55 55 //------------ DRCTL
56 56
void sendCtrlUp(int fp); 57 57 void sendCtrlUp(int fp);
void SendCtrlDown(int fp); 58 58 void SendCtrlDown(int fp);
void SendHold(int fp); 59 59 void SendHold(int fp);
void SendUnhold(int fp); 60 60 void SendUnhold(int fp);
int testRampFreq(int fd, int f_dds, int fp); 61 61 int testRampFreq(int fd, int f_dds, int fp);
62 62
//-------Profile register mode 63 63 //-------Profile register mode
64 64
int initialisationProfileMode (int fd,int f_dds); 65 65 int initialisationProfileMode (int fd,int f_dds);
int putFrequencyAmpPhaseWord(int fd, int f_dds, double fout, double fclk,double amp, double phase); 66 66 int putFrequencyAmpPhaseWord(int fd, int f_dds, double fout, double fclk,double amp, double phase);
67 67
68 68
int putFrequencyWord(int fd, int f_dds,double fclk, double freq); 69 69 int putFrequencyWord(int fd, int f_dds,double fclk, double freq);
int putPhaseWord(int fd, int f_dds, double phase); 70 70 int putPhaseWord(int fd, int f_dds, double phase);
int putAmpWord(int fd, int f_dds, double amplitude); 71 71 int putAmpWord(int fd, int f_dds, double amplitude);
72 72
//fonctions rampes hardwres 73 73 //fonctions rampes hardwres
74 74
int frequencySweep (int fd, int f_dds,double fclk,double dfUp, double dfDown, double FreqMax,double FreqMin, double DeltaTimeUp, double DeltaTimeDown); 75 75 int frequencySweep (int fd, int f_dds,double fclk,double dfUp, double dfDown, double FreqMax,double FreqMin, double DeltaTimeUp, double DeltaTimeDown);
int continueFrequencySweep (int fd, int f_dds,double fclk,double dfUp, double dfDown, double FreqMax,double FreqMin, double DeltaTimeUp, double DeltaTimeDown); 76 76 int continueFrequencySweep (int fd, int f_dds,double fclk,double dfUp, double dfDown, double FreqMax,double FreqMin, double DeltaTimeUp, double DeltaTimeDown);
int amplitudeSweep (int fd, int f_dds,double fclk,double dAUp, double dADown, double AMax,double AMin, double DeltaTimeUp, double DeltaTimeDown); 77 77 int amplitudeSweep (int fd, int f_dds,double fclk,double dAUp, double dADown, double AMax,double AMin, double DeltaTimeUp, double DeltaTimeDown);