20 #include "modules/wltune.h"
31 #define IGNORE_WR_STATE
38 volatile WrxInfo * info =
wrxInfo();
40 if (info->wState == WRX_WRS_IDLE &&
41 info->pState == WRX_PTP_SLAVE &&
42 info->sState == WRX_WR_TRACK_PHASE)
return true;
45 if (info->wState == WRX_WRS_IDLE &&
46 info->pState == WRX_PTP_LISTENING &&
48 logInfo(
"No WhiteRabbit - For testing only!");
55 void _subsNetExecEvent (
ClbEvent event)
60 net.ipmux_srv_ip = 0xFFFFFFFF;
61 net.ipmux_srv_mac[0] = 0xFFFF;
62 net.ipmux_srv_mac[1] = 0xFFFF;
63 net.ipmux_srv_mac[2] = 0xFFFF;
66 net.ipmux_srv_ip = 0xFFFFFFFF;
67 net.ipmux_srv_mac[0] = 0xFFFF;
68 net.ipmux_srv_mac[1] = 0xFFFF;
69 net.ipmux_srv_mac[2] = 0xFFFF;
82 logError(
"Failed to initialize Wavelength tuning");
97 volatile WrxInfo * info =
wrxInfo();
98 #ifdef IGNORE_WR_STATE
99 if (!wrStateValid()) {
100 logWarn(
"Wrx not in correct state: whiteRabbit=%d, PTP=%d, SERVO=%d", info->wState, info->pState, info->sState);
103 if (!wrStateValid()) {
109 if (!
netMuxDest(net.ipmux_srv_ip, net.ipmux_srv_mac)) {
123 static void resolveSvrIp()
127 net.ipmux_srv_mac[0] = 0xD00D;
128 net.ipmux_srv_mac[1] = 0xDAAD;
129 net.ipmux_srv_mac[2] = 0xDEED;
132 ms_ipa_set_u32(net.ipmux_srv_ip, &ip);
134 ms_mac_t * mac = ms_arp_lookup(&ip);
141 ms_mac_get_3u16(mac, net.ipmux_srv_mac);
143 logInfo(
"Resolved MAC: %04x:%04x:%04x\n",
144 net.ipmux_srv_mac[0], net.ipmux_srv_mac[1], net.ipmux_srv_mac[2]);
148 bool _subsNetUpdate(
ClbState state, uint32_t time)
151 if (net.ipmux_srv_ip != 0xFFFFFFFF &&
152 (net.ipmux_srv_mac[0] == 0xFFFF && net.ipmux_srv_mac[1] == 0xFFFF &&
153 net.ipmux_srv_mac[2] == 0xFFFF)) {
163 volatile WrxInfo * info =
wrxInfo();
164 net.wr_delta[NET_WR_DELTA_SLAVE_RX] = info->sDeltaRX;
165 net.wr_delta[NET_WR_DELTA_SLAVE_TX] = info->sDeltaTX;
166 net.wr_delta[NET_WR_DELTA_MASTER_RX] = info->mDeltaRX;
167 net.wr_delta[NET_WR_DELTA_MASTER_TX] = info->mDeltaTX;
168 net.wr_bitslide = info->bitslide;
169 net.wr_mu = info->mu;
171 net.rx_input_power = info->rxInputPower;
172 net.tx_output_power = info->txOutputPower;
173 net.wr_st_gen = info->wState;
174 net.wr_st_ptp = info->pState;
175 net.wr_st_serv = info->sState;
176 net.wr_temp = info->brdTemp * 100 + info->brdTempFrac;;
177 net.sfp_temp = info->sfpTemp * 100 + (info->sfpTempFrac * 100) / 256;
ClbEvent
All state change events.
static void _clbStateModErr(int idx)
Invoked by subsystem to indicate an error happened.
bool netIpValid()
Returns whether or not the Ip is valid.
void ipMuxFlush(uint32_t channelMask, uint8_t ipmFlushOp)
Flushes the IPMUX's FIFO's.
uint8_t clbSys2Idx[6]
Mapping from subsystem ID to index.
bool netMuxDest(uint32_t destIp, uint16_t *destMac)
Sets the IPMux destination.
#define logWarn(MSG,...)
Format a log message with warning level.
bool netInit()
Initializes the network.
Undefined => Idle, for internal use only.
void errPrint(bool clear)
Prints the last error.
bool wrxUp()
Returns whether or not the WhiteRabbit interface is up and running.
void errClear()
Clears the current error.
volatile WrxInfo * wrxInfo()
Returns the whiteRabbit information structure if available, else NULL.
#define logError(MSG,...)
Format a log message with fatal level.
#define LOG_DEF(NAME,...)
Define a logger for a module.
The CLB stare module tracks is responsible for state management of the various sub-systems on the CLB...
void netShowInfo(bool extended)
Shows network configuration information.
Implements a generic logger facility.
void _clbStateError(int idx, int error, const char *message, const char *name)
Invoked by subsystem to indicate an error happened.
WhiteRabbit exchange exchanges information between the 2nd LM32 and WhiteRabbit though a small client...
#define logInfo(MSG,...)
Write a log message with formatting on info level.
void _clbStateUpdate(int idx, ClbEvent event, uint8_t status)
Invoked by the subsystem to indicate a state change has happened.