KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
octopus.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : octopus.h
11  * Created : 22 jan. 2014
12  * Author : Vincent van Beveren
13  */
14 
15 #ifndef OCTOPUS_H_
16 #define OCTOPUS_H_
17 
18 /**
19  * @file
20  *
21  * @ingroup modules
22  *
23  * This module implements the functionality required by the octopus board (large).
24  *
25  * From this interface you can control the CPLD on the octopus board and the PROMiS module.
26  *
27  */
28 
29 #include "util/macro.h"
30 #include "cfg_board.h"
31 
32 #include "kernel/err.h"
33 #include "errorcode.h"
34 
35 #include <stdbool.h>
36 #include <stdint.h>
37 
38 
39 #define OCTO_BRD_SMALL 0 //!< Octo small
40 #define OCTO_BRD_LARGE 1 //!< Octo large
41 
42 /**
43  * @param Resets an octopus board. Also resets all PMTs on that board (en Piezo if connected).
44  *
45  * @param brd The Board, either OCTO_BRD_LARGE or OCTO_BRD_SMALL.
46  */
47 void octoResetBoard(int brd);
48 
49 /**
50  * Initializes a channel on the octopus board.
51  *
52  * @param brd The board
53  * @param ch The channel
54  * @param highVolt High voltage level as byte
55  * @param threshold Threshold level as byte
56  *
57  * @retval true Success
58  * @retval false Failure, consult err module for error.
59  */
60 bool octoInitChan(int brd, int ch, uint8_t highVolt, uint8_t threshold);
61 
62 /**
63  * De-Initializes a channel on the octopus board.
64  *
65  * @param brd The board
66  * @param ch The channel
67  *
68  * @retval true Success
69  * @retval false Failure, consult err module for error.
70  */
71 bool octoDeinitChan(int brd, int ch);
72 
73 /**
74  * Reads the fault register of the CLPD. The bit position corresponds to a PMT channel.
75  *
76  * @param brd The board
77  * @param fault Pointer to variable to fill with fault bits.
78  *
79  * @retval true Read Success
80  * @retval false Failure, consult err module for error.
81  */
82 bool octoReadFault(int brd, uint32_t * fault);
83 
84 bool octoReadEnabled(int brd, uint32_t * enabled);
85 
86 /**
87  * Reads a PMT ID.
88  *
89  * @param brd The board
90  * @param fault The fault register.
91  * @param id Pointer to a variable to fill with the ID.
92  *
93  * @retval true Read Success
94  * @retval false Failure, consult err module for error.
95  */
96 bool octoPMTID(int brd, int ch, uint32_t * id, bool * pmtIdFault);
97 
98 /**
99  * Turns the Piezo on or off
100  *
101  * @param on true - turn it on, false - turn it off.
102  *
103  * @retval true Read Success
104  * @retval false Failure, consult err module for error.
105  */
106 bool octoPiezo(bool on);
107 
108 
109 /**
110  * Turns the high-voltage on or off.
111  *
112  * @note High-voltage will cause the PMT-basis to generate high voltage. Use with caution!
113  *
114  * @param brd The board
115  * @param ch The channel
116  * @param on true - turn it on, false - turn it off.
117  *
118  * @retval true Success
119  * @retval false Failure, consult err module for error.
120  */
121 bool octoHighVoltage(int brd, int ch, bool hvOn);
122 
123 
124 
125 
126 /**
127  * Executes a chain-test. Note that the Threshold and High-voltage levels will be reset.
128  *
129  * @note I have no idea what a chain-test does (VvB).
130  *
131  * @param brd The board
132  * @param ch The channel
133  *
134  * @retval true Success
135  * @retval false Failure, consult err module for error.
136  */
137 bool octoChainTest(int brd, int ch);
138 
139 
140 #endif /* OCTOPUS_H_ */
141 
bool octoHighVoltage(int brd, int ch, bool hvOn)
Turns the high-voltage on or off.
Definition: octopus.c:221
bool octoPiezo(bool on)
Turns the Piezo on or off.
Definition: octopus.c:197
bool octoChainTest(int brd, int ch)
Executes a chain-test.
Definition: octopus.c:238
void octoResetBoard(int brd)
Definition: octopus.c:100
bool octoInitChan(int brd, int ch, uint8_t highVolt, uint8_t threshold)
Initializes a channel on the octopus board.
Definition: octopus.c:140
bool octoPMTID(int brd, int ch, uint32_t *id, bool *pmtIdFault)
Reads a PMT ID.
Definition: octopus.c:168
Manages the global system error.
bool octoDeinitChan(int brd, int ch)
De-Initializes a channel on the octopus board.
Definition: octopus.c:130
This module is responsible for distributing error codes.
bool octoReadFault(int brd, uint32_t *fault)
Reads the fault register of the CLPD.
Definition: octopus.c:210
Provides common macros.
Configures the board-specific peripherals, like I2C, SPI etc...