Blame view

include/ad9915.h 3.62 KB
dfa91a3bc   pyb   libad9915 : add i...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  /*
  dds initialisation et SPI 
  */
  
  #include <stdint.h>
  #include <unistd.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <getopt.h>
  #include <fcntl.h>
  #include <sys/ioctl.h>
  #include <linux/types.h>
  #include <linux/spi/spidev.h>
  /* memory management */
  #include <sys/mman.h>
  #include "spi.h"
  #include <string.h>
  #include <math.h>
  #include <time.h>
  
  
  static const char CFRAddress[] = {0x00,0x01,0x02,0x03};
  
  static const char CFR1Start[] ={0x00, 0x01, 0x00, 0x0a};
  //static const char CFR1Start[] ={0x00, 0x01, 0x01, 0x08}; //with osk enable
  static const char CFR2Start[] ={0x00, 0x80, 0x09, 0x00}; //0x80 enable prof mode
  static const char CFR3Start[] = {0x00, 0x00, 0x19, 0x1C};
09ecc607d   bachi   mise a jour avec ...
28
29
30
  static const char CFR4Start[] =  {0x00, 0x05, 0x21, 0x20}; 
  //static const char CFR4Start[] =  {0x20, 0x21, 0x05, 0x00};
  
dfa91a3bc   pyb   libad9915 : add i...
31
32
33
34
35
36
37
38
  
  static const char USR0Address = 0x1B;
  static const char FTW0Address = 0x0b; //profile 0 ftw
  static const char PA0Address = 0x0c; //profile 0 
  
  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
  
  
6ebbf4da4   bachi   ad9915.h : normal...
39
40
41
42
43
44
45
46
47
  void sendReset(int f_dds);
  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);
  void readRegister (int fd, unsigned char addr, uint32_t *readword);
  void readRegister_ini (int fd,unsigned char addr);
  void initializeDDS (int fd, int f_dds);
  void calibrateDAC(int fd, int f_dds);
  void basicSetup(int fd, int f_dds, uint16_t ampWord, uint16_t phaseWord);
  void modulusSetup(int fd, int f_dds); 
dfa91a3bc   pyb   libad9915 : add i...
48
49
50
51
52
53
  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);
  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);
  int setDdsFreqFull ( int fd, int f_dds, double f_clk, double f_out, uint16_t ampWord, uint16_t phaseWord);
  
09ecc607d   bachi   mise a jour avec ...
54
55
  //------------ DRCTL
  
41fb442f6   bachi   ad9915.c et ad991...
56
57
58
59
  void sendCtrlUp(int fp);
  void SendCtrlDown(int fp);
  void SendHold(int fp);
  void SendUnhold(int fp);
09ecc607d   bachi   mise a jour avec ...
60
61
62
63
  int testRampFreq(int fd, int f_dds, int fp);
  
  //-------Profile register mode
  
41fb442f6   bachi   ad9915.c et ad991...
64
65
  int initialisationProfileMode (int fd,int f_dds);
  int putFrequencyAmpPhaseWord(int fd, int f_dds, double fout, double fclk,double amp, double phase);
09ecc607d   bachi   mise a jour avec ...
66
67
  
  
41fb442f6   bachi   ad9915.c et ad991...
68
69
70
  int putFrequencyWord(int fd, int f_dds,double fclk, double freq);
  int putPhaseWord(int fd, int f_dds, double phase);
  int putAmpWord(int fd, int f_dds, double amplitude);
09ecc607d   bachi   mise a jour avec ...
71
72
73
  
  //fonctions rampes hardwres
  
41fb442f6   bachi   ad9915.c et ad991...
74
75
76
77
78
79
  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);
  int amplitudeSweep (int fd, int f_dds,double fclk,double dAUp, double dADown, double AMax,double AMin, double DeltaTimeUp, double DeltaTimeDown);
  int continueAmplitudeSweep (int fd, int f_dds,double fclk,double dAUp, double dADown, double AMax,double AMin, double DeltaTimeUp, double DeltaTimeDown);
  int phaseSweep (int fd, int f_dds,double fclk,double dphiUp, double dphiDown, double PhiMax,double PhiMin, double DeltaTimeUp, double DeltaTimeDown);
  int continuePhaseSweep (int fd, int f_dds,double fclk,double dphiUp, double dphiDown, double PhiMax,double PhiMin, double DeltaTimeUp, double DeltaTimeDown);
09ecc607d   bachi   mise a jour avec ...
80
81
82
  
  //fin fonctions rampes hardwares