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

IPMUX Driver for CLBv2. More...

#include <stdint.h>
#include <stdbool.h>
#include "util/macro.h"

Go to the source code of this file.

Data Structures

struct  IpMuxCfg
 IPMux configuration structure. More...
 

Macros

#define IPMUX_CH_0   BIT(0)
 Channel 1.
 
#define IPMUX_CH_1   BIT(1)
 Channel 2.
 
#define IPMUX_CH_2   BIT(2)
 Channel 3.
 
#define IPMUX_CH_3   BIT(3)
 Channel 4.
 
#define IPMUX_CH_CPU   BIT(4)
 CPU channel.
 
#define IPMUX_FLUSH_OP_START   0x1
 
#define IPMUX_FLUSH_OP_END   0x2
 
#define IPMUX_FLUSH_OP_TOGGLE   (IPMUX_FLUSH_OP_START | IPMUX_FLUSH_OP_END)
 

Functions

void ipMuxInit (IpMuxCfg *modCfg, bool flush)
 Initializes the IPMux local (module) only. More...
 
void ipMuxCfgRemote (IpMuxCfg *svrCfg)
 Configure IPmux with remote settings.
 
void ipMuxSetDest (uint8_t *destIp)
 Set the mux destination (server / destination) More...
 
bool ipMuxRxAvail ()
 Returns whether or not there is data available for reception. More...
 
bool ipMuxRx (void *buf, uint32_t buflen, uint32_t *rxlen)
 Received data from the IPMux's CPU interface. More...
 
bool ipMuxTx (void *buf, uint32_t txlen, bool done)
 Sends data to the IPMux's CPU interface. More...
 
void ipMuxFlush (uint32_t channelMask, uint8_t ipmFlushOp)
 Flushes the IPMUX's FIFO's. More...
 
static void ipMuxFlushCPU ()
 Flushes the.
 
void ipMuxDumpRegs ()
 Debug function to see whats inside.
 

Detailed Description

IPMUX Driver for CLBv2.

This implements all required functionality for configuring and controlling the IPMux.

Definition in file ipmux.h.

Function Documentation

void ipMuxFlush ( uint32_t  channelMask,
uint8_t  ipmFlushOp 
)

Flushes the IPMUX's FIFO's.

Good to use if recovering from an error.

For example:

ipMuxFluch(IPMUX_CH_0 | IPMUX_CH_1);

Flushes channel 0 and 1.

Parameters
channelMaskThe channels to flush

Definition at line 191 of file ipmux.c.

void ipMuxInit ( IpMuxCfg modCfg,
bool  flush 
)

Initializes the IPMux local (module) only.

Parameters
modCfgModule configuration
flushFlush IPMux CPU pipe.

Definition at line 65 of file ipmux.c.

bool ipMuxRx ( void *  buf,
uint32_t  buflen,
uint32_t *  rxlen 
)

Received data from the IPMux's CPU interface.

Parameters
bufThe buffer to write into
buflenThe length of the buffer
rxlenPointer to int32 to fill with actual number of bytes read
Return values
trueOn success
falseIf reception failed, check errCode() for more info.

Possible errors:

  • E_TIMEOUT If the reception of the packet takes too much time
  • E_OUTOFMEM If the packet is bigger than the supplied buffer.

Definition at line 96 of file ipmux.c.

bool ipMuxRxAvail ( )

Returns whether or not there is data available for reception.

Return values
trueThere is at least one packet ready to be read
falseThe CPU FIFO is empty.

Definition at line 77 of file ipmux.c.

void ipMuxSetDest ( uint8_t *  destIp)

Set the mux destination (server / destination)

Parameters
destIpThe IP address, as a char array of 4 bytes.
bool ipMuxTx ( void *  buf,
uint32_t  txlen,
bool  done 
)

Sends data to the IPMux's CPU interface.

Parameters
bufThe buffer with data to send
buflenThe length of the data to send
Return values
trueOn success
falseIf reception failed, check errCode() for more info.

Definition at line 151 of file ipmux.c.