Commit 0e8c6c3b20539dda16ecaadf75b6686c6dd51b48
1 parent
2146e89f7c
Exists in
master
ad9915.c & .h : correction de syntaxes de fonction
Showing 1 changed file with 3 additions and 3 deletions Inline Diff
include/ad9915.h
/* | 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 sendReset(int f_dds); | 39 | 39 | void sendReset(int f_dds); | |
void sendIOUpdate (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 writeRegister (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 readRegister (int fd, unsigned char addr, uint32_t *readword); | 42 | 42 | void readRegister (int fd, unsigned char addr, uint32_t *readword); | |
void readRegister_ini (int fd,unsigned char addr); | 43 | 43 | void readRegister_ini (int fd,unsigned char addr); | |
void initializeDDS (int fd, int f_dds); | 44 | 44 | void initializeDDS (int fd, int f_dds); | |
void calibrateDAC(int fd, int f_dds); | 45 | 45 | void calibrateDAC(int fd, int f_dds); | |
void basicSetup(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 modulusSetup(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); | |
int openAndSetDdsFreq( char * device, char * gpio_update, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord); | 50 | 50 | 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); | 51 | 51 | 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); | 52 | 52 | int setDdsFreqFull ( int fd, int f_dds, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord); | |
53 | 53 | |||
//------------ DRCTL | 54 | 54 | //------------ DRCTL | |
55 | 55 | |||
void sendCtrlUp(int fp); | 56 | 56 | void sendCtrlUp(int fp); | |
void SendCtrlDown(int fp); | 57 | 57 | void sendCtrlDown(int fp); | |
void SendHold(int fp); | 58 | 58 | void sendHold(int fp); | |
void SendUnhold(int fp); | 59 | 59 | void sendUnhold(int fp); | |
int testRampFreq(int fd, int f_dds, int fp); | 60 | 60 | int testRampFreq(int fd, int f_dds, int fp); | |
61 | 61 | |||
//-------Profile register mode | 62 | 62 | //-------Profile register mode | |
63 | 63 | |||
int initialisationProfileMode (int fd,int f_dds); | 64 | 64 | int initialisationProfileMode (int fd,int f_dds); | |
int putFrequencyAmpPhaseWord(int fd, int f_dds, double fout, double fclk,double amp, double phase); | 65 | 65 | int putFrequencyAmpPhaseWord(int fd, int f_dds, double fout, double fclk,double amp, double phase); | |
66 | 66 |