Commit c41204d2 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

uncomment ptp stuff, it's now running with new softpll

parent 263b982d
PLATFORM = lm32 PLATFORM = lm32
OBJS_WRC = wrc_main.o dev/uart.o dev/endpoint.o dev/syscon.o dev/softpll_ng.o lib/mprintf.o dev/ep_pfilter.o dev/dna.o OBJS_WRC = wrc_main.o dev/uart.o dev/endpoint.o dev/minic.o dev/pps_gen.o dev/syscon.o dev/onewire.o dev/softpll_ng.o lib/mprintf.o monitor/monitor.o dev/ep_pfilter.o dev/dna.o
D = ptp-noposix D = ptp-noposix
PTPD_CFLAGS = -ffreestanding -DPTPD_FREESTANDING -DWRPC_EXTRA_SLIM -DPTPD_MSBF -DPTPD_DBG PTPD_CFLAGS = -ffreestanding -DPTPD_FREESTANDING -DWRPC_EXTRA_SLIM -DPTPD_MSBF -DPTPD_DBG
...@@ -9,20 +9,20 @@ PTPD_CFLAGS += -Wall -ggdb -I$D/wrsw_hal \ ...@@ -9,20 +9,20 @@ PTPD_CFLAGS += -Wall -ggdb -I$D/wrsw_hal \
-include $D/compat.h -include $D/PTPWRd/dep/trace.h -include $D/libposix/ptpd-wrappers.h -include $D/compat.h -include $D/PTPWRd/dep/trace.h -include $D/libposix/ptpd-wrappers.h
PTPD_CFLAGS += -DPTPD_NO_DAEMON -DNEW_SINGLE_WRFSM -DPTPD_TRACE_MASK=0 PTPD_CFLAGS += -DPTPD_NO_DAEMON -DNEW_SINGLE_WRFSM -DPTPD_TRACE_MASK=0
#OBJS_PTPD = $D/PTPWRd/arith.o OBJS_PTPD = $D/PTPWRd/arith.o
#OBJS_PTPD += $D/PTPWRd/bmc.o OBJS_PTPD += $D/PTPWRd/bmc.o
#OBJS_PTPD += $D/PTPWRd/dep/msg.o OBJS_PTPD += $D/PTPWRd/dep/msg.o
#OBJS_PTPD += $D/PTPWRd/dep/net.o OBJS_PTPD += $D/PTPWRd/dep/net.o
#OBJS_PTPD += $D/PTPWRd/dep/servo.o OBJS_PTPD += $D/PTPWRd/dep/servo.o
#OBJS_PTPD += $D/PTPWRd/dep/sys.o OBJS_PTPD += $D/PTPWRd/dep/sys.o
#OBJS_PTPD += $D/PTPWRd/dep/timer.o OBJS_PTPD += $D/PTPWRd/dep/timer.o
#OBJS_PTPD += $D/PTPWRd/dep/wr_servo.o OBJS_PTPD += $D/PTPWRd/dep/wr_servo.o
#OBJS_PTPD += $D/PTPWRd/protocol.o OBJS_PTPD += $D/PTPWRd/protocol.o
#OBJS_PTPD += $D/PTPWRd/wr_protocol.o OBJS_PTPD += $D/PTPWRd/wr_protocol.o
#OBJS_PTPD_FREE = $D/libposix/freestanding-startup.o OBJS_PTPD_FREE = $D/libposix/freestanding-startup.o
#OBJS_PTPD_FREE += $D/libposix/freestanding-display.o OBJS_PTPD_FREE += $D/libposix/freestanding-display.o
#OBJS_PTPD_FREE += $D/libposix/wr_nolibs.o OBJS_PTPD_FREE += $D/libposix/wr_nolibs.o
#OBJS_PTPD_FREE += $D/libposix/freestanding-wrapper.o OBJS_PTPD_FREE += $D/libposix/freestanding-wrapper.o
ifeq ($(PLATFORM), zpu) ifeq ($(PLATFORM), zpu)
CFLAGS_PLATFORM = -abel -Wl,--relax -Wl,--gc-sections CFLAGS_PLATFORM = -abel -Wl,--relax -Wl,--gc-sections
......
...@@ -6,65 +6,65 @@ ...@@ -6,65 +6,65 @@
#include "syscon.h" #include "syscon.h"
#include "uart.h" #include "uart.h"
#include "endpoint.h" #include "endpoint.h"
//#include "minic.h" #include "minic.h"
//#include "pps_gen.h" #include "pps_gen.h"
//#include "ptpd.h" #include "ptpd.h"
//#include "ptpd_netif.h" #include "ptpd_netif.h"
//#include "i2c.h" //#include "i2c.h"
//#include "eeprom.h" //#include "eeprom.h"
//#include "onewire.h" #include "onewire.h"
//RunTimeOpts rtOpts = { RunTimeOpts rtOpts = {
// .announceInterval = DEFAULT_ANNOUNCE_INTERVAL, .announceInterval = DEFAULT_ANNOUNCE_INTERVAL,
// .syncInterval = DEFAULT_SYNC_INTERVAL, .syncInterval = DEFAULT_SYNC_INTERVAL,
// .clockQuality.clockAccuracy = DEFAULT_CLOCK_ACCURACY, .clockQuality.clockAccuracy = DEFAULT_CLOCK_ACCURACY,
// .clockQuality.clockClass = DEFAULT_CLOCK_CLASS, .clockQuality.clockClass = DEFAULT_CLOCK_CLASS,
// .clockQuality.offsetScaledLogVariance = DEFAULT_CLOCK_VARIANCE, .clockQuality.offsetScaledLogVariance = DEFAULT_CLOCK_VARIANCE,
// .priority1 = DEFAULT_PRIORITY1, .priority1 = DEFAULT_PRIORITY1,
// .priority2 = DEFAULT_PRIORITY2, .priority2 = DEFAULT_PRIORITY2,
// .domainNumber = DEFAULT_DOMAIN_NUMBER, .domainNumber = DEFAULT_DOMAIN_NUMBER,
// .currentUtcOffset = DEFAULT_UTC_OFFSET, .currentUtcOffset = DEFAULT_UTC_OFFSET,
// .noResetClock = DEFAULT_NO_RESET_CLOCK, .noResetClock = DEFAULT_NO_RESET_CLOCK,
// .noAdjust = NO_ADJUST, .noAdjust = NO_ADJUST,
// .inboundLatency.nanoseconds = DEFAULT_INBOUND_LATENCY, .inboundLatency.nanoseconds = DEFAULT_INBOUND_LATENCY,
// .outboundLatency.nanoseconds = DEFAULT_OUTBOUND_LATENCY, .outboundLatency.nanoseconds = DEFAULT_OUTBOUND_LATENCY,
// .s = DEFAULT_DELAY_S, .s = DEFAULT_DELAY_S,
// .ap = DEFAULT_AP, .ap = DEFAULT_AP,
// .ai = DEFAULT_AI, .ai = DEFAULT_AI,
// .max_foreign_records = DEFAULT_MAX_FOREIGN_RECORDS, .max_foreign_records = DEFAULT_MAX_FOREIGN_RECORDS,
//#ifdef WRPC_SLAVE #ifdef WRPC_SLAVE
// .slaveOnly = TRUE, .slaveOnly = TRUE,
//#else #else
// .slaveOnly = FALSE, .slaveOnly = FALSE,
//#endif #endif
//
// /**************** White Rabbit *************************/ /**************** White Rabbit *************************/
// .autoPortDiscovery = FALSE, /*if TRUE: automagically discovers how many ports we have (and how many up-s); else takes from .portNumber*/ .autoPortDiscovery = FALSE, /*if TRUE: automagically discovers how many ports we have (and how many up-s); else takes from .portNumber*/
// .portNumber = 1, .portNumber = 1,
// .calPeriod = WR_DEFAULT_CAL_PERIOD, .calPeriod = WR_DEFAULT_CAL_PERIOD,
// .E2E_mode = TRUE, .E2E_mode = TRUE,
// .wrStateRetry = WR_DEFAULT_STATE_REPEAT, .wrStateRetry = WR_DEFAULT_STATE_REPEAT,
// .wrStateTimeout= WR_DEFAULT_STATE_TIMEOUT_MS, .wrStateTimeout= WR_DEFAULT_STATE_TIMEOUT_MS,
// .deltasKnown = TRUE, //WR_DEFAULT_DELTAS_KNOWN, .deltasKnown = TRUE, WR_DEFAULT_DELTAS_KNOWN,
// .knownDeltaTx = 0,//WR_DEFAULT_DELTA_TX, .knownDeltaTx = 0, WR_DEFAULT_DELTA_TX,
// .knownDeltaRx = 0,//WR_DEFAULT_DELTA_RX, .knownDeltaRx = 0, WR_DEFAULT_DELTA_RX,
///*SLAVE only or MASTER only*/ /*SLAVE only or MASTER only*/
//#ifdef WRPC_SLAVE #ifdef WRPC_SLAVE
// .primarySource = FALSE, .primarySource = FALSE,
// .wrConfig = WR_S_ONLY, .wrConfig = WR_S_ONLY,
// .masterOnly = FALSE, .masterOnly = FALSE,
//#endif #endif
//#ifdef WRPC_MASTER #ifdef WRPC_MASTER
// .primarySource = TRUE, .primarySource = TRUE,
// .wrConfig = WR_M_ONLY, .wrConfig = WR_M_ONLY,
// .masterOnly = TRUE, .masterOnly = TRUE,
//#endif #endif
// /********************************************************/ /********************************************************/
//}; };
//static PtpPortDS *ptpPortDS; static PtpPortDS *ptpPortDS;
//static PtpClockDS ptpClockDS; static PtpClockDS ptpClockDS;
...@@ -147,10 +147,10 @@ uint8_t get_sfp_id(char *sfp_pn) ...@@ -147,10 +147,10 @@ uint8_t get_sfp_id(char *sfp_pn)
uint8_t data, sum=0; uint8_t data, sum=0;
uint8_t i; uint8_t i;
//wait until SFP signalizes its presence // wait until SFP signalizes its presence
while( gpio_in(GPIO_SFP_DET) ); while( gpio_in(GPIO_SFP_DET) );
//mprintf("wr_core: SFP present\n"); // mprintf("wr_core: SFP present\n");
mi2c_init(WRPC_SFP_I2C); mi2c_init(WRPC_SFP_I2C);
mi2c_start(WRPC_SFP_I2C); mi2c_start(WRPC_SFP_I2C);
...@@ -200,14 +200,23 @@ void wrc_initialize() ...@@ -200,14 +200,23 @@ void wrc_initialize()
mprintf("wr_core: starting up (press G to launch the GUI and D for extra debug messages)....\n"); mprintf("wr_core: starting up (press G to launch the GUI and D for extra debug messages)....\n");
//SFP
#if 0
get_sfp_id(sfp_pn);
if( !access_eeprom(sfp_pn, &sfp_alpha, &sfp_deltaTx, &sfp_deltaRx) )
{
mprintf("SFP: alpha=%d, deltaTx=%d, deltaRx=%d\n", sfp_alpha, sfp_deltaTx, sfp_deltaRx);
}
#endif
//Generate MAC address //Generate MAC address
//ow_init(); ow_init();
//if( ds18x_read_serial(ds18_id) == 0 ) if( ds18x_read_serial(ds18_id) == 0 )
// TRACE_DEV("Found DS18xx sensor: %x:%x:%x:%x:%x:%x:%x:%x\n", TRACE_DEV("Found DS18xx sensor: %x:%x:%x:%x:%x:%x:%x:%x\n",
// ds18_id[7], ds18_id[6], ds18_id[5], ds18_id[4], ds18_id[7], ds18_id[6], ds18_id[5], ds18_id[4],
// ds18_id[3], ds18_id[2], ds18_id[1], ds18_id[0]); ds18_id[3], ds18_id[2], ds18_id[1], ds18_id[0]);
//else else
// TRACE_DEV("DS18B20 not found\n"); TRACE_DEV("DS18B20 not found\n");
mac_addr[0] = 0x08; // mac_addr[0] = 0x08; //
mac_addr[1] = 0x00; // CERN OUI mac_addr[1] = 0x00; // CERN OUI
...@@ -220,19 +229,19 @@ void wrc_initialize() ...@@ -220,19 +229,19 @@ void wrc_initialize()
ep_init(mac_addr); ep_init(mac_addr);
ep_enable(1, 1); ep_enable(1, 1);
//minic_init(); minic_init();
//pps_gen_init(); pps_gen_init();
// for(;;); // for(;;);
// rx_test(); // rx_test();
//netStartup(); netStartup();
//wr_servo_man_adjust_phase(-11600 + 1700); wr_servo_man_adjust_phase(-11600 + 1700);
//displayConfigINFO(&rtOpts); displayConfigINFO(&rtOpts);
//ptpPortDS = ptpdStartup(0, NULL, &ret, &rtOpts, &ptpClockDS); ptpPortDS = ptpdStartup(0, NULL, &ret, &rtOpts, &ptpClockDS);
//initDataClock(&rtOpts, &ptpClockDS); initDataClock(&rtOpts, &ptpClockDS);
} }
#define LINK_WENT_UP 1 #define LINK_WENT_UP 1
...@@ -273,7 +282,7 @@ void wrc_debug_printf(int subsys, const char *fmt, ...) ...@@ -273,7 +282,7 @@ void wrc_debug_printf(int subsys, const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
if(wrc_extra_debug )// || (!wrc_extra_debug && (subsys & TRACE_SERVO))) if(wrc_extra_debug || (!wrc_extra_debug && (subsys & TRACE_SERVO)))
vprintf(fmt, ap); vprintf(fmt, ap);
va_end(ap); va_end(ap);
...@@ -294,7 +303,7 @@ void wrc_handle_input() ...@@ -294,7 +303,7 @@ void wrc_handle_input()
wrc_gui_mode = 1 - wrc_gui_mode; wrc_gui_mode = 1 - wrc_gui_mode;
if(!wrc_gui_mode) if(!wrc_gui_mode)
{ {
//m_term_clear(); m_term_clear();
wrc_debug_printf(0, "Exiting GUI mode\n"); wrc_debug_printf(0, "Exiting GUI mode\n");
} }
break; break;
...@@ -308,7 +317,7 @@ void wrc_handle_input() ...@@ -308,7 +317,7 @@ void wrc_handle_input()
case 't': case 't':
wrc_enable_tracking = 1 - wrc_enable_tracking; wrc_enable_tracking = 1 - wrc_enable_tracking;
//wr_servo_enable_tracking(wrc_enable_tracking); wr_servo_enable_tracking(wrc_enable_tracking);
wrc_debug_printf(0,"Phase tracking %s.\n", wrc_enable_tracking ? "enabled" : "disabled"); wrc_debug_printf(0,"Phase tracking %s.\n", wrc_enable_tracking ? "enabled" : "disabled");
break; break;
...@@ -317,7 +326,7 @@ void wrc_handle_input() ...@@ -317,7 +326,7 @@ void wrc_handle_input()
case '-': case '-':
wrc_man_phase += (x=='+' ? 100 : -100); wrc_man_phase += (x=='+' ? 100 : -100);
wrc_debug_printf(0,"Manual phase adjust: %d\n", wrc_man_phase); wrc_debug_printf(0,"Manual phase adjust: %d\n", wrc_man_phase);
//wr_servo_man_adjust_phase(wrc_man_phase); wr_servo_man_adjust_phase(wrc_man_phase);
break; break;
...@@ -331,13 +340,12 @@ extern volatile int irq_cnt; ...@@ -331,13 +340,12 @@ extern volatile int irq_cnt;
int main(void) int main(void)
{ {
wrc_initialize(); wrc_initialize();
spll_test(); softpll_set_mode(0);
//softpll_enable();
#if 0 // for(;;);
for(;;) for(;;)
{ {
wrc_handle_input(); wrc_handle_input();
...@@ -369,7 +377,5 @@ int main(void) ...@@ -369,7 +377,5 @@ int main(void)
protocol_nonblock(&rtOpts, ptpPortDS); protocol_nonblock(&rtOpts, ptpPortDS);
} }
#endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment