KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
octocpld.h File Reference

This driver encapsulates the functionality of the CPLD on the octopus board. More...

#include "drv/wb/i2c.h"
#include "kernel/tm.h"

Go to the source code of this file.

Enumerations

enum  OCReg { ocRegOn = 0, ocRegFault = 4, ocRegClkEn = 8 }
 Octopus CPLD registers. More...
 

Functions

bool ocRead (I2C_Device *dev, uint8_t addr, OCReg reg, uint32_t *value)
 Reads one of the CPLD registers. More...
 
bool ocWrite (I2C_Device *dev, uint8_t addr, OCReg reg, uint32_t value)
 Writes one of the CPLD registers. More...
 
static bool ocWakeUp (I2C_Device *dev, uint8_t addr)
 Wakes up the octopus board, apparently it needs it. More...
 

Detailed Description

This driver encapsulates the functionality of the CPLD on the octopus board.

Though on the CPLD each registers byte can be read separately this driver groups all 3 bytes into one 32 bit register. Thus when reading the ocRegFault register the fault status of all 20 channels is returned in one 32 bit integer, where each bit position corresponds to its respective channel.

Definition in file octocpld.h.

Enumeration Type Documentation

enum OCReg

Octopus CPLD registers.

Enumerator
ocRegOn 

PMT On register.

ocRegFault 

Fault register.

ocRegClkEn 

Clock enable.

Definition at line 37 of file octocpld.h.

Function Documentation

bool ocRead ( I2C_Device dev,
uint8_t  addr,
OCReg  reg,
uint32_t *  value 
)

Reads one of the CPLD registers.

Parameters
devThe I2C device
addrThe I2C address
regThe CPLD register (ocRegOn, ocRegFault or orRegClkEn)
valueA pointer to a 32 bit integer to fill as bit mask.
Return values
trueSuccess
falseFailure

Definition at line 18 of file octocpld.c.

static bool ocWakeUp ( I2C_Device dev,
uint8_t  addr 
)
inlinestatic

Wakes up the octopus board, apparently it needs it.

Parameters
dev
Returns

Definition at line 76 of file octocpld.h.

bool ocWrite ( I2C_Device dev,
uint8_t  addr,
OCReg  reg,
uint32_t  value 
)

Writes one of the CPLD registers.

Parameters
devThe I2C device
addrThe I2C address
regThe CPLD register (ocRegOn, ocRegFault or orRegClkEn)
valueA 32bit integer as bitmask, where each bit corresponds to its channel
Return values
trueSuccess
falseFailure

Definition at line 31 of file octocpld.c.