KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tdc.c
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : tdc.c
11  * Created : 25 nov 2013
12  * Author : David Calvo
13  */
14 
15 
16 #include "drv/wb/tdc.h"
17 #include "lm32soc/dev_soc.h"
18 
19 
20 void tdcReset ()
21 {
22  TDC->HR_VETO = TDC_HR_VETO_DEFAULT;
23  TDC->EN_CH = 0;
24  TDC->HR_VETO_EN = TDC_CH_ALL_MASK;
25  TDC->MULHIT_EN = TDC_CH_ALL_MASK;
26  TDC->MIN_TOT = TDC_MIN_TOT_DEFAULT;
27 }
28 
29 void tdcSetMinTot(uint32_t m_tot)
30 {
31  TDC->MIN_TOT = m_tot;
32 }
33 void tdcSetHRVeto(uint32_t thrs)
34 {
35  TDC->HR_VETO = thrs;
36 }
37 
38 uint32_t tdcHRVeto()
39 {
40  return TDC->HR_VETO;
41 }
42 
43 
44 void tdcSetChannels(uint32_t channels, uint32_t mask)
45 {
46  TDC->EN_CH = ( TDC->EN_CH & ~mask ) | ( channels & mask );
47 }
48 
49 uint32_t tdcChannels()
50 {
51  return TDC->EN_CH;
52 }
53 
54 
55 uint32_t tdcHrvEnabled()
56 {
57  return TDC->HR_VETO_EN;
58 }
59 
60 void tdcSetHrvEnabled(uint32_t channels)
61 {
62  TDC->HR_VETO_EN = channels;
63 }
64 
65 uint32_t tdcMultiHitEnabled()
66 {
67  return TDC->MULHIT_EN;
68 }
69 
70 void tdcSetMultiHitEnabled(uint32_t channels)
71 {
72  TDC->MULHIT_EN = channels;
73 }
74 
75 void tdcDbgSetBlastFull(uint32_t channels)
76 {
77  TDC->BLAST_FULL = channels;
78 }
79 
80 
81 uint32_t tdcDbgBlastFull()
82 {
83  return TDC->BLAST_FULL;
84 }
85 
void tdcReset()
Resets the TDC to defaults.
Definition: tdc.c:20
void tdcSetMultiHitEnabled(uint32_t channels)
Sets on which channels the mutli-hit veto must be enabled.
Definition: tdc.c:70
uint32_t tdcDbgBlastFull()
Return Blast full FIFOs bitmask for debugging.
Definition: tdc.c:81
uint32_t tdcChannels()
Returns which TDC channels are enabled/disabled.
Definition: tdc.c:49
void tdcSetMinTot(uint32_t m_tot)
Sets the HR veto rate per time-slice.
Definition: tdc.c:29
#define TDC
TDC base pointer.
Definition: dev_soc.h:59
void tdcDbgSetBlastFull(uint32_t channels)
Blast full FIFOs bitmask for debugging.
Definition: tdc.c:75
void tdcSetHRVeto(uint32_t thrs)
Sets the Minimun ToT width allowed.
Definition: tdc.c:33
uint32_t tdcHRVeto()
Returns the HR-veto rate per time-slice.
Definition: tdc.c:38
#define TDC_CH_ALL_MASK
All channels.
Definition: tdc.h:27
TDC Driver.
void tdcSetHrvEnabled(uint32_t channels)
Sets on which channels the high-rate veto must be applied.
Definition: tdc.c:60
This file assigns all device structures to memory mapped structures.
uint32_t tdcHrvEnabled()
Returns on which channels the high-rate veto is applied.
Definition: tdc.c:55
void tdcSetChannels(uint32_t channels, uint32_t mask)
Set the enable/disable channels.
Definition: tdc.c:44