Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - Software
Commits
8af4aca5
Commit
8af4aca5
authored
Feb 22, 2013
by
Tomasz Wlostowski
Committed by
Alessandro Rubini
Apr 16, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temporary fix to make he acam work in G-Mode
parent
c7e131dc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
200 additions
and
145 deletions
+200
-145
acam.c
kernel/acam.c
+55
-5
calibrate.c
kernel/calibrate.c
+1
-5
fine-delay.h
kernel/fine-delay.h
+2
-1
acam_gpx.h
kernel/hw/acam_gpx.h
+85
-77
fd_channel_regs.h
kernel/hw/fd_channel_regs.h
+4
-1
fd_main_regs.h
kernel/hw/fd_main_regs.h
+44
-56
fdelay-init.c
lib/fdelay-init.c
+7
-0
fdelay-lib.h
lib/fdelay-lib.h
+2
-0
No files found.
kernel/acam.c
View file @
8af4aca5
...
...
@@ -31,6 +31,13 @@ module_param_named(calib_s, fd_calib_period_s, int, 0444);
#define ACAM_FP_BIN ((int)(ACAM_DESIRED_BIN * (1 << 16)))
#define ACAM_FP_TREF (((1000LL * 1000 * 1000) << 16) / ACAM_CLOCK_FREQ_KHZ)
/* Default values of control registers for the ACAM TDC working in G-Mode
(eeprom values are obsolete) */
#define ACAM_GMODE_START_OFFSET 10000
#define ACAM_GMODE_ASOR 17000
#define ACAM_GMODE_ATMCR (26 | (1500 << 8))
#define ACAM_GMODE_ADSFR 84977
static
int
acam_calc_pll
(
uint64_t
tref
,
int
bin
,
int
*
hsdiv_out
,
int
*
refdiv_out
)
{
...
...
@@ -80,7 +87,7 @@ static int acam_calc_pll(uint64_t tref, int bin, int *hsdiv_out,
tmpll
=
div_u64_rem
(
tref
<<
refdiv
,
216
,
&
rem
);
bin
=
div_u64_rem
(
tmpll
,
hsdiv
,
&
rem
);
}
return
(
bin
+
1
)
/
3
;
/* We are in I-Mode, R-Mode bin is 1/3 if this
*/
return
(
bin
+
1
)
;
/* We always return the bin size in the I mode. Other modes should scale it appropriately.
*/
}
static
void
acam_set_address
(
struct
fd_dev
*
fd
,
int
addr
)
...
...
@@ -215,6 +222,32 @@ static struct acam_init_data acam_init_rmode[] = {
{
4
,
AR4_EFlagHiZN
|
AR4_MasterReset
|
AR4_StartTimer
(
0
)},
};
/* Commented values are not constant, they are added at runtime (see later) */
static
struct
acam_init_data
acam_init_gmode
[]
=
{
{
0
,
AR0_ROsc
|
AR0_RiseEn0
|
AR0_RiseEn1
|
AR0_HQSel
},
{
1
,
AR1_Adj
(
0
,
0
)
|
AR1_Adj
(
1
,
0
)
|
AR1_Adj
(
2
,
5
)
|
AR1_Adj
(
3
,
0
)
|
AR1_Adj
(
4
,
5
)
|
AR1_Adj
(
5
,
0
)
|
AR1_Adj
(
6
,
5
)},
{
2
,
AR2_GMode
|
AR2_Adj
(
7
,
0
)
|
AR2_Adj
(
8
,
5
)
|
AR2_DelRise1
(
0
)
|
AR2_DelFall1
(
0
)
|
AR2_DelRise2
(
0
)
|
AR2_DelFall2
(
0
)},
{
3
,
AR3_DelTx
(
1
,
3
)
|
AR3_DelTx
(
2
,
3
)
|
AR3_DelTx
(
3
,
3
)
|
AR3_DelTx
(
4
,
3
)
|
AR3_DelTx
(
5
,
3
)
|
AR3_DelTx
(
6
,
3
)
|
AR3_DelTx
(
7
,
3
)
|
AR3_DelTx
(
8
,
3
)
|
AR3_RaSpeed
(
0
,
3
)
|
AR3_RaSpeed
(
1
,
3
)
|
AR3_RaSpeed
(
2
,
3
)},
{
4
,
AR4_EFlagHiZN
|
AR4_RaSpeed
(
3
,
3
)
|
AR4_RaSpeed
(
4
,
3
)
|
AR4_RaSpeed
(
5
,
3
)
|
AR4_RaSpeed
(
6
,
3
)
|
AR4_RaSpeed
(
7
,
3
)
|
AR4_RaSpeed
(
8
,
3
)},
{
5
,
AR5_StartRetrig
|
0
/* AR5_StartOff1(hw->calib.acam_start_offset) */
|
AR5_MasterAluTrig
},
{
6
,
AR6_Fill
(
200
)
|
AR6_PowerOnECL
},
{
7
,
/* AR7_HSDiv(hsdiv) | AR7_RefClkDiv(refdiv) */
0
|
AR7_ResAdj
|
AR7_NegPhase
},
{
11
,
0x7ff0000
},
{
12
,
0x0000000
},
{
14
,
0
},
/* finally, reset */
{
4
,
AR4_EFlagHiZN
|
AR4_MasterReset
|
AR4_StartTimer
(
0
)},
};
static
struct
acam_init_data
acam_init_imode
[]
=
{
{
0
,
AR0_TRiseEn
(
0
)
|
AR0_HQSel
|
AR0_ROsc
},
{
2
,
AR2_IMode
},
...
...
@@ -245,6 +278,10 @@ static struct acam_mode_setup fd_acam_table[] = {
ACAM_IMODE
,
"I"
,
acam_init_imode
,
ARRAY_SIZE
(
acam_init_imode
)
},
{
ACAM_GMODE
,
"G"
,
acam_init_gmode
,
ARRAY_SIZE
(
acam_init_gmode
)
},
};
/* To configure the thing, follow the table, but treat 5 and 7 as special */
...
...
@@ -264,12 +301,23 @@ static int __acam_config(struct fd_dev *fd, struct acam_mode_setup *s)
/* Disable TDC inputs prior to configuring */
fd_writel
(
fd
,
FD_TDCSR_STOP_DIS
|
FD_TDCSR_START_DIS
,
FD_REG_TDCSR
);
/* Disable the ACAM PLL for a while to make sure it is reset */
acam_writel
(
fd
,
0
,
0
);
acam_writel
(
fd
,
7
,
0
);
msleep
(
100
);
for
(
p
=
s
->
data
,
i
=
0
;
i
<
s
->
data_size
;
p
++
,
i
++
)
{
regval
=
p
->
val
;
if
(
p
->
addr
==
7
)
regval
|=
reg7val
;
if
(
p
->
addr
==
5
&&
s
->
mode
==
ACAM_RMODE
)
regval
|=
AR5_StartOff1
(
fd
->
calib
.
acam_start_offset
);
if
(
p
->
addr
==
5
&&
s
->
mode
==
ACAM_GMODE
)
regval
|=
AR5_StartOff1
(
ACAM_GMODE_START_OFFSET
);
if
(
p
->
addr
==
6
&&
s
->
mode
==
ACAM_GMODE
)
regval
|=
AR6_StartOff2
(
ACAM_GMODE_START_OFFSET
);
acam_writel
(
fd
,
regval
,
p
->
addr
);
}
...
...
@@ -317,7 +365,7 @@ int fd_acam_init(struct fd_dev *fd)
if
(
(
ret
=
fd_calibrate_outputs
(
fd
))
)
return
ret
;
if
(
(
ret
=
fd_acam_config
(
fd
,
ACAM_
R
MODE
))
)
if
(
(
ret
=
fd_acam_config
(
fd
,
ACAM_
G
MODE
))
)
return
ret
;
acam_set_bypass
(
fd
,
0
);
/* Driven by core, not host */
...
...
@@ -330,10 +378,12 @@ int fd_acam_init(struct fd_dev *fd)
* - bin -> internal timebase scalefactor (ADSFR),
* - Start offset (must be consistent with value in ACAM reg 4)
* - timestamp merging control register (ATMCR)
* GMode fix: we no longer use the values from the EEPROM (they are fixed anyway)
*/
fd_writel
(
fd
,
fd
->
calib
.
adsfr_val
,
FD_REG_ADSFR
);
fd_writel
(
fd
,
3
*
fd
->
calib
.
acam_start_offset
,
FD_REG_ASOR
);
fd_writel
(
fd
,
fd
->
calib
.
atmcr_val
,
FD_REG_ATMCR
);
fd_writel
(
fd
,
ACAM_GMODE_ADSFR
,
FD_REG_ADSFR
);
fd_writel
(
fd
,
ACAM_GMODE_ASOR
,
FD_REG_ASOR
);
fd_writel
(
fd
,
ACAM_GMODE_ATMCR
,
FD_REG_ATMCR
);
/* Prepare the timely recalibration */
setup_timer
(
&
fd
->
temp_timer
,
fd_update_calibration
,
(
unsigned
long
)
fd
);
...
...
kernel/calibrate.c
View file @
8af4aca5
...
...
@@ -104,11 +104,7 @@ static uint64_t output_delay_ps(struct fd_dev *fd, int ch, int fine, int n,
/* read the tag, convert to picoseconds (fixed point: 16.16) */
fr
=
acam_readl
(
fd
,
8
/* fifo */
)
&
0x1ffff
;
/*
* This is I-Mode, but fd->bin is for R-Mode, so 3x
* Then, fr is around 0xc00, bin is 0x50.0000: use 3LL for 64b
*/
res
=
fr
*
3LL
*
fd
->
bin
;
res
=
fr
*
fd
->
bin
;
if
(
fd
->
verbose
>
3
)
pr_info
(
"%s: ch %i, fine %i, bin %x got %08x, "
"res 0x%016llx
\n
"
,
__func__
,
ch
,
fine
,
...
...
kernel/fine-delay.h
View file @
8af4aca5
...
...
@@ -260,7 +260,8 @@ static inline void fd_ch_writel(struct fd_dev *fd, int ch,
/* ACAM TDC operation modes */
enum
fd_acam_modes
{
ACAM_RMODE
,
ACAM_IMODE
ACAM_IMODE
,
ACAM_GMODE
};
/*
...
...
kernel/hw/acam_gpx.h
View file @
8af4aca5
#ifndef __ACAM_GPX_H
#define __ACAM_GPX_H
#define AR0_ROsc (1<<0)
#define AR0_RiseEn0 (1<<1)
#define AR0_FallEn0 (1<<2)
#define AR0_RiseEn1 (1<<3)
#define AR0_FallEn1 (1<<4)
#define AR0_RiseEn2 (1<<5)
#define AR0_FallEn2 (1<<6)
#define AR0_HQSel (1<<7)
#define AR0_TRiseEn(port) (1<<(10+port))
#define AR0_TFallEn(port) (1<<(19+port))
#define AR1_Adj(chan, value) (((value) & 0xf) << (chan * 4))
#define AR2_GMode (1<<0)
#define AR2_IMode (1<<1)
#define AR2_RMode (1<<2)
#define AR2_Disable(chan) (1<<(3+chan))
#define AR2_Adj(chan, value) (((value)&0xf) << (12 + 4*(chan-7)))
#define AR3_RaSpeed(num,val) (val << num*2 + 21))
#define AR3_Zero (0) // nothing interesting for the Fine Delay
#define AR4_StartTimer(value) ((value) & 0xff)
#define AR4_Quiet (1<<8)
#define AR4_MMode (1<<9)
#define AR4_MasterReset (1<<22)
#define AR4_PartialReset (1<<23)
#define AR4_AluTrigSoft (1<<24)
#define AR4_EFlagHiZN (1<<25)
#define AR4_MTimerStart (1<<26)
#define AR4_MTimerStop (1<<27)
#define AR5_StartOff1(value) ((value)&0x3ffff)
#define AR5_StopDisStart (1<<21)
#define AR5_StartDisStart (1<<22)
#define AR5_MasterAluTrig (1<<23)
#define AR5_PartialAluTrig (1<<24)
#define AR5_MasterOenTrig (1<<25)
#define AR5_PartialOenTrig (1<<26)
#define AR5_StartRetrig (1<<27)
#define AR6_Fill(value) ((value)&0xff)
#define AR6_StartOff2(value) (((value)&0x3ffff)<<8)
#define AR6_InSelECL (1<<26)
#define AR6_PowerOnECL (1<<27)
#define AR7_HSDiv(value) ((value) & 0xff)
#define AR7_RefClkDiv(value) (((value) & 0x7) << 8)
#define AR7_ResAdj (1<<11)
#define AR7_NegPhase (1<<12)
#define AR7_Track (1<<13)
#define AR7_MTimer(value) (((value) & 0x1ff) << 15)
#define AR14_16BitMode (1<<4)
#define AR8I_IFIFO1(reg) ((reg) & 0x1ffff)
#define AR8I_Slope1(reg) ((reg) & (1<<17) ? 1 : 0)
#define AR8I_StartN1(reg) (((reg) >> 18) & 0xff)
#define AR8I_ChaCode1(reg) (((reg) >> 26) & 0x3)
#define AR9I_IFIFO2(reg) ((reg) & 0x1ffff)
#define AR9I_Slope2(reg) ((reg) &(1<<17) ? 1 : 0)
#define AR9I_StartN2(reg) (((reg) >> 18) & 0xff)
#define AR9I_ChaCode2(reg) (((reg) >> 26) & 0x3)
#define AR8R_IFIFO1(reg) ((reg) & 0x3fffff)
#define AR9R_IFIFO2(reg) ((reg) & 0x3fffff)
#define AR11_StopCounter0(num) ((num) & 0xff)
#define AR11_StopCounter1(num) (((num) & 0xff) << 8)
#define AR11_HFifoErrU(num) (1 << (num+16))
#define AR11_IFifoErrU(num) (1 << (num+24))
#define AR11_NotLockErrU (1 << 26)
#define AR12_HFifoE (1<<11)
#define AR12_NotLocked (1<<10)
#define AR0_ROsc (1<<0)
#define AR0_RiseEn0 (1<<1)
#define AR0_FallEn0 (1<<2)
#define AR0_RiseEn1 (1<<3)
#define AR0_FallEn1 (1<<4)
#define AR0_RiseEn2 (1<<5)
#define AR0_FallEn2 (1<<6)
#define AR0_HQSel (1<<7)
#define AR0_TRiseEn(port) (1<<(10+port))
#define AR0_TFallEn(port) (1<<(19+port))
#define AR1_Adj(chan, value) (((value) & 0xf) << (chan * 4))
#define AR2_GMode (1<<0)
#define AR2_IMode (1<<1)
#define AR2_RMode (1<<2)
#define AR2_Disable(chan) (1<<(3+chan))
#define AR2_Adj(chan, value) (((value)&0xf)<<(12+4*(chan-7)))
#define AR2_DelRise1(value) (((value)&0x3)<<(20))
#define AR2_DelFall1(value) (((value)&0x3)<<(22))
#define AR2_DelRise2(value) (((value)&0x3)<<(24))
#define AR2_DelFall2(value) (((value)&0x3)<<(26))
#define AR3_DelTx(chan, value) (((value)&0x3)<<(5 + (chan -1 ) * 2))
#define AR3_RaSpeed(chan, value) (((value)&0x3)<<(21 + (chan ) * 2))
#define AR4_RaSpeed(chan, value) (((value)&0x3)<<(10 + (chan-3) * 2))
#define AR3_Zero (0) // nothing interesting for the Fine Delay
#define AR4_StartTimer(value) ((value) & 0xff)
#define AR4_Quiet (1<<8)
#define AR4_MMode (1<<9)
#define AR4_MasterReset (1<<22)
#define AR4_PartialReset (1<<23)
#define AR4_AluTrigSoft (1<<24)
#define AR4_EFlagHiZN (1<<25)
#define AR4_MTimerStart (1<<26)
#define AR4_MTimerStop (1<<27)
#define AR5_StartOff1(value) ((value)&0x3ffff)
#define AR5_StopDisStart (1<<21)
#define AR5_StartDisStart (1<<22)
#define AR5_MasterAluTrig (1<<23)
#define AR5_PartialAluTrig (1<<24)
#define AR5_MasterOenTrig (1<<25)
#define AR5_PartialOenTrig (1<<26)
#define AR5_StartRetrig (1<<27)
#define AR6_Fill(value) ((value)&0xff)
#define AR6_StartOff2(value) (((value)&0x3ffff)<<8)
#define AR6_InSelECL (1<<26)
#define AR6_PowerOnECL (1<<27)
#define AR7_HSDiv(value) ((value)&0xff)
#define AR7_RefClkDiv(value) (((value)&0x7)<<8)
#define AR7_ResAdj (1<<11)
#define AR7_NegPhase (1<<12)
#define AR7_Track (1<<13)
#define AR7_MTimer(value) (((value) & 0x1ff)<<15)
#define AR14_16BitMode (1<<4)
#define AR8I_IFIFO1(reg) ((reg) & 0x1ffff)
#define AR8I_Slope1(reg) ((reg) & (1<<17) ? 1 : 0)
#define AR8I_StartN1(reg) (((reg) >> 18) & 0xff)
#define AR8I_ChaCode1(reg) (((reg) >> 26) & 0x3)
#define AR9I_IFIFO2(reg) ((reg) & 0x1ffff)
#define AR9I_Slope2(reg) ((reg) & (1<<17) ? 1 : 0)
#define AR9I_StartN2(reg) (((reg) >> 18) & 0xff)
#define AR9I_ChaCode2(reg) (((reg) >> 26) & 0x3)
#define AR8R_IFIFO1(reg) ((reg) & 0x3fffff)
#define AR9R_IFIFO2(reg) ((reg) & 0x3fffff)
#define AR11_StopCounter0(num) ((num) & 0xff)
#define AR11_StopCounter1(num) (((num) & 0xff) << 8)
#define AR11_HFifoErrU(num) (1 << (num+16))
#define AR11_IFifoErrU(num) (1 << (num+24))
#define AR11_NotLockErrU (1 << 26)
#define AR12_HFifoE (1<<11)
#define AR12_NotLocked (1<<10)
#endif
kernel/hw/fd_channel_regs.h
View file @
8af4aca5
...
...
@@ -3,7 +3,7 @@
* File : fd_channel_regs.h
* Author : auto-generated by wbgen2 from fd_channel_wishbone_slave.wb
* Created :
Wed Feb 29 12:04:02 2012
* Created :
Fri Feb 15 12:07:17 2013
* Standard : ANSI C
THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE fd_channel_wishbone_slave.wb
...
...
@@ -57,6 +57,9 @@
/* definitions for field: Disable Fine Part update in reg: Delay Control Register */
#define FD_DCR_NO_FINE WBGEN2_GEN_MASK(7, 1)
/* definitions for field: Force Output High in reg: Delay Control Register */
#define FD_DCR_FORCE_HI WBGEN2_GEN_MASK(8, 1)
/* definitions for register: Fine Range Register */
/* definitions for register: Pulse start time / offset (MSB TAI seconds) */
...
...
kernel/hw/fd_main_regs.h
View file @
8af4aca5
...
...
@@ -3,7 +3,7 @@
* File : fd_main_regs.h
* Author : auto-generated by wbgen2 from fd_main_wishbone_slave.wb
* Created :
Mon May 21 20:09:50 2012
* Created :
Fri Feb 15 12:07:16 2013
* Standard : ANSI C
THIS FILE WAS GENERATED BY wbgen2 FROM SOURCE FILE fd_main_wishbone_slave.wb
...
...
@@ -64,7 +64,7 @@
/* definitions for field: PLL Locked in reg: Global Control Register */
#define FD_GCR_DDR_LOCKED WBGEN2_GEN_MASK(2, 1)
/* definitions for field: Mezzani
c
e Present in reg: Global Control Register */
/* definitions for field: Mezzani
n
e Present in reg: Global Control Register */
#define FD_GCR_FMC_PRESENT WBGEN2_GEN_MASK(3, 1)
/* definitions for register: Timing Control Register */
...
...
@@ -99,100 +99,88 @@
/* definitions for register: Time Register - sub-second 125 MHz clock cycles */
/* definitions for register: TDC Data Register */
/* definitions for register:
Host-driven
TDC Data Register */
/* definitions for register:
TDC control/status reg
*/
/* definitions for register:
Host-driven TDC Control/Status
*/
/* definitions for field:
Start TDC write in reg: TDC control/status reg
*/
/* definitions for field:
Write to TDC in reg: Host-driven TDC Control/Status
*/
#define FD_TDCSR_WRITE WBGEN2_GEN_MASK(0, 1)
/* definitions for field:
Start TDC read in reg: TDC control/status reg
*/
/* definitions for field:
Read from TDC in reg: Host-driven TDC Control/Status
*/
#define FD_TDCSR_READ WBGEN2_GEN_MASK(1, 1)
/* definitions for field: Empty flag in reg:
TDC control/status reg
*/
/* definitions for field: Empty flag in reg:
Host-driven TDC Control/Status
*/
#define FD_TDCSR_EMPTY WBGEN2_GEN_MASK(2, 1)
/* definitions for field: St
art enable in reg: TDC control/status reg
*/
/* definitions for field: St
op enable in reg: Host-driven TDC Control/Status
*/
#define FD_TDCSR_STOP_EN WBGEN2_GEN_MASK(3, 1)
/* definitions for field: Start disable in reg:
TDC control/status reg
*/
/* definitions for field: Start disable in reg:
Host-driven TDC Control/Status
*/
#define FD_TDCSR_START_DIS WBGEN2_GEN_MASK(4, 1)
/* definitions for field: St
op enable in reg: TDC control/status reg
*/
/* definitions for field: St
art enable in reg: Host-driven TDC Control/Status
*/
#define FD_TDCSR_START_EN WBGEN2_GEN_MASK(5, 1)
/* definitions for field: Stop disable in reg:
TDC control/status reg
*/
/* definitions for field: Stop disable in reg:
Host-driven TDC Control/Status
*/
#define FD_TDCSR_STOP_DIS WBGEN2_GEN_MASK(6, 1)
/* definitions for field:
write 1: Pulse the Alutrigger line in reg: TDC control/status reg
*/
/* definitions for field:
Pulse <code>Alutrigger</code> line in reg: Host-driven TDC Control/Status
*/
#define FD_TDCSR_ALUTRIG WBGEN2_GEN_MASK(7, 1)
/* definitions for register: Calibration register */
/* definitions for field:
Triggers calibration pulses
in reg: Calibration register */
/* definitions for field:
Generate calibration pulses (type 1 calibration)
in reg: Calibration register */
#define FD_CALR_CAL_PULSE WBGEN2_GEN_MASK(0, 1)
/* definitions for field: PPS Calibration output enable in reg: Calibration register */
#define FD_CALR_CAL_PPS WBGEN2_GEN_MASK(1, 1)
/* definitions for field:
Triggers calibration pulses
in reg: Calibration register */
/* definitions for field:
Produce DDMTD calibration pattern (type 2 calibration)
in reg: Calibration register */
#define FD_CALR_CAL_DMTD WBGEN2_GEN_MASK(2, 1)
/* definitions for field:
Enable pulse generation
in reg: Calibration register */
/* definitions for field:
Calibration pulse output select/mask
in reg: Calibration register */
#define FD_CALR_PSEL_MASK WBGEN2_GEN_MASK(3, 4)
#define FD_CALR_PSEL_SHIFT 3
#define FD_CALR_PSEL_W(value) WBGEN2_GEN_WRITE(value, 3, 4)
#define FD_CALR_PSEL_R(reg) WBGEN2_GEN_READ(reg, 3, 4)
/* definitions for field: DMTD Feedback Channel Select in reg: Calibration register */
#define FD_CALR_DMTD_FBSEL WBGEN2_GEN_MASK(7, 1)
/* definitions for register: DMTD Input Tag Register */
/* definitions for field: DMTD Tag in reg:
Calibration r
egister */
#define FD_
CALR_DMTD_TAG_MASK WBGEN2_GEN_MASK(8, 23
)
#define FD_
CALR_DMTD_TAG_SHIFT 8
#define FD_
CALR_DMTD_TAG_W(value) WBGEN2_GEN_WRITE(value, 8, 23
)
#define FD_
CALR_DMTD_TAG_R(reg) WBGEN2_GEN_READ(reg, 8, 23
)
/* definitions for field: DMTD Tag in reg:
DMTD Input Tag R
egister */
#define FD_
DMTR_IN_TAG_MASK WBGEN2_GEN_MASK(0, 31
)
#define FD_
DMTR_IN_TAG_SHIFT 0
#define FD_
DMTR_IN_TAG_W(value) WBGEN2_GEN_WRITE(value, 0, 31
)
#define FD_
DMTR_IN_TAG_R(reg) WBGEN2_GEN_READ(reg, 0, 31
)
/* definitions for field: DMTD Tag Ready in reg:
Calibration r
egister */
#define FD_
CALR_DMTD_TAG_RDY
WBGEN2_GEN_MASK(31, 1)
/* definitions for field: DMTD Tag Ready in reg:
DMTD Input Tag R
egister */
#define FD_
DMTR_IN_RDY
WBGEN2_GEN_MASK(31, 1)
/* definitions for register:
Softpll
Register */
/* definitions for register:
DMTD Output Tag
Register */
/* definitions for field:
Frequency/Phase tag in reg: Softpll
Register */
#define FD_
SPLLR_TAG_MASK WBGEN2_GEN_MASK(0, 20
)
#define FD_
SPLLR_TAG_SHIFT
0
#define FD_
SPLLR_TAG_W(value) WBGEN2_GEN_WRITE(value, 0, 20
)
#define FD_
SPLLR_TAG_R(reg) WBGEN2_GEN_READ(reg, 0, 20
)
/* definitions for field:
DMTD Tag in reg: DMTD Output Tag
Register */
#define FD_
DMTR_OUT_TAG_MASK WBGEN2_GEN_MASK(0, 31
)
#define FD_
DMTR_OUT_TAG_SHIFT
0
#define FD_
DMTR_OUT_TAG_W(value) WBGEN2_GEN_WRITE(value, 0, 31
)
#define FD_
DMTR_OUT_TAG_R(reg) WBGEN2_GEN_READ(reg, 0, 31
)
/* definitions for field: Tag Ready in reg: Softpll Register */
#define FD_SPLLR_TAG_RDY WBGEN2_GEN_MASK(20, 1)
/* definitions for field: Freq/Phase mode select in reg: Softpll Register */
#define FD_SPLLR_MODE WBGEN2_GEN_MASK(21, 1)
/* definitions for register: Softpll DAC Register */
/* definitions for field: DAC Value in reg: Softpll DAC Register */
#define FD_SDACR_DAC_VAL_MASK WBGEN2_GEN_MASK(0, 16)
#define FD_SDACR_DAC_VAL_SHIFT 0
#define FD_SDACR_DAC_VAL_W(value) WBGEN2_GEN_WRITE(value, 0, 16)
#define FD_SDACR_DAC_VAL_R(reg) WBGEN2_GEN_READ(reg, 0, 16)
/* definitions for field: DMTD Tag Ready in reg: DMTD Output Tag Register */
#define FD_DMTR_OUT_RDY WBGEN2_GEN_MASK(31, 1)
/* definitions for register: Acam to Delay line fractional part Scale Factor Register */
/* definitions for register: Acam Timestamp Merging Control Register */
/* definitions for field: Wraparound Coarse Threshold in reg: Acam Timestamp Merging Control Register */
#define FD_ATMCR_C_THR_MASK WBGEN2_GEN_MASK(0,
4
)
#define FD_ATMCR_C_THR_MASK WBGEN2_GEN_MASK(0,
8
)
#define FD_ATMCR_C_THR_SHIFT 0
#define FD_ATMCR_C_THR_W(value) WBGEN2_GEN_WRITE(value, 0,
4
)
#define FD_ATMCR_C_THR_R(reg) WBGEN2_GEN_READ(reg, 0,
4
)
#define FD_ATMCR_C_THR_W(value) WBGEN2_GEN_WRITE(value, 0,
8
)
#define FD_ATMCR_C_THR_R(reg) WBGEN2_GEN_READ(reg, 0,
8
)
/* definitions for field: Wraparound Fine Threshold in reg: Acam Timestamp Merging Control Register */
#define FD_ATMCR_F_THR_MASK WBGEN2_GEN_MASK(
4
, 23)
#define FD_ATMCR_F_THR_SHIFT
4
#define FD_ATMCR_F_THR_W(value) WBGEN2_GEN_WRITE(value,
4
, 23)
#define FD_ATMCR_F_THR_R(reg) WBGEN2_GEN_READ(reg,
4
, 23)
#define FD_ATMCR_F_THR_MASK WBGEN2_GEN_MASK(
8
, 23)
#define FD_ATMCR_F_THR_SHIFT
8
#define FD_ATMCR_F_THR_W(value) WBGEN2_GEN_WRITE(value,
8
, 23)
#define FD_ATMCR_F_THR_R(reg) WBGEN2_GEN_READ(reg,
8
, 23)
/* definitions for register: Acam Start Offset Register */
...
...
@@ -411,16 +399,16 @@
#define FD_REG_TM_SECL 0x00000014
/* [0x18]: REG Time Register - sub-second 125 MHz clock cycles */
#define FD_REG_TM_CYCLES 0x00000018
/* [0x1c]: REG TDC Data Register */
/* [0x1c]: REG
Host-driven
TDC Data Register */
#define FD_REG_TDR 0x0000001c
/* [0x20]: REG
TDC control/status reg
*/
/* [0x20]: REG
Host-driven TDC Control/Status
*/
#define FD_REG_TDCSR 0x00000020
/* [0x24]: REG Calibration register */
#define FD_REG_CALR 0x00000024
/* [0x28]: REG
Softpll
Register */
#define FD_REG_
SPLLR
0x00000028
/* [0x2c]: REG
Softpll DAC
Register */
#define FD_REG_
SDACR
0x0000002c
/* [0x28]: REG
DMTD Input Tag
Register */
#define FD_REG_
DMTR_IN
0x00000028
/* [0x2c]: REG
DMTD Output Tag
Register */
#define FD_REG_
DMTR_OUT
0x0000002c
/* [0x30]: REG Acam to Delay line fractional part Scale Factor Register */
#define FD_REG_ADSFR 0x00000030
/* [0x34]: REG Acam Timestamp Merging Control Register */
...
...
lib/fdelay-init.c
View file @
8af4aca5
...
...
@@ -223,3 +223,10 @@ extern int fdelay_check_wr_mode(struct fdelay_board *userb)
return
errno
;
}
float
fdelay_read_temperature
(
struct
fdelay_board
*
userb
)
{
uint32_t
t
;
fdelay_sysfs_get
(
userb
,
"temperature"
,
&
t
);
return
(
float
)
t
/
16
.
0
;
}
lib/fdelay-lib.h
View file @
8af4aca5
...
...
@@ -81,6 +81,8 @@ extern int fdelay_has_triggered(struct fdelay_board *b, int channel);
extern
int
fdelay_wr_mode
(
struct
fdelay_board
*
b
,
int
on
);
extern
int
fdelay_check_wr_mode
(
struct
fdelay_board
*
b
);
extern
float
fdelay_read_temperature
(
struct
fdelay_board
*
b
);
#ifdef FDELAY_INTERNAL
/* Libray users should ignore what follows */
#include <unistd.h>
#include <fcntl.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment