Commit 22552aff authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

ertm14: support for power monitors & mac eeprom

parent de46d062
......@@ -105,14 +105,14 @@ obj-$(CONFIG_WR_NODE) += sdb-lib/libsdbfs.a
cflags-$(CONFIG_WR_NODE) += -Isdb-lib
CFLAGS = $(cflags-y) -Wall -Wstrict-prototypes \
-ffunction-sections -fdata-sections -Os -Wmissing-prototypes \
-ffunction-sections -fdata-sections -Os -Wmissing-prototypes \
-include include/wrc.h -ggdb
# Assembler Flags
ASFLAGS = -I.
LDFLAGS = $(ldflags-y) \
-Wl,--gc-sections -Os -lgcc -lc
-Wl,--gc-sections -Os -lgcc -lc -lm -lgcc -lc
WRC-O-FLAGS-$(CONFIG_LM32) = --gc-sections -e _start
......
......@@ -21,7 +21,9 @@ obj-$(CONFIG_EMBEDDED_NODE) += \
dev/phy_calibration.o \
dev/clock_monitor.o \
dev/74x595.o \
dev/ertm15_rf_switches.o
dev/ertm15_rf_switches.o \
dev/24aa025.o \
dev/ad7888.o
obj-$(CONFIG_WR_NODE) += \
......
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2019 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdio.h>
......@@ -7,6 +28,12 @@
#include "dev/ltc6950.h"
#include "dev/ad9910.h"
#include "dev/clock_monitor.h"
#include "dev/24aa025.h"
#include "dev/ad7888.h"
#include "dev/ertm15_rf_distr.h"
#include "dev/i2c.h"
#define BASE_AUXWB 0x28000
#define BASE_CLOCK_MONITOR 0x28100
......@@ -30,6 +57,9 @@ static const struct gpio_pin pin_pll_ext_sclk = { &gpio_aux, 9 };
static const struct gpio_pin pin_pll_ext_reset = { &gpio_aux, 10 };
static const struct gpio_pin pin_pll_ext_lock = { &gpio_aux, 11 };
static const struct gpio_pin pin_mac_addr_scl = { &gpio_aux, 13 };
static const struct gpio_pin pin_mac_addr_sda = { &gpio_aux, 12 };
static const struct gpio_pin pin_main_xo_en_n = { &gpio_aux, 14 };
static const struct gpio_pin pin_ltc6950_sclk = { &gpio_aux, 15 };
......@@ -54,19 +84,31 @@ static const struct gpio_pin pin_ocxo_cs_n = { &gpio_aux, 51 };
static const struct gpio_pin pin_ocxo_sclk = { &gpio_aux, 50 };
static const struct gpio_pin pin_ocxo_data = { &gpio_aux, 49 };
static const struct gpio_pin pin_pwrmon_adc_cs_n = { &gpio_aux, 52 };
static const struct gpio_pin pin_pwrmon_adc_dout = { &gpio_aux, 46 };
static const struct gpio_pin pin_pwrmon_adc_din = { &gpio_aux, 47 };
static const struct gpio_pin pin_pwrmon_adc_sclk = { &gpio_aux, 45 };
struct spi_bus spi_pll_main;
struct spi_bus spi_pll_ext;
struct spi_bus spi_ltc6950;
struct spi_bus spi_ad9910_ref;
struct spi_bus spi_ad9910_lo;
struct spi_bus spi_ocxo_dac;
struct spi_bus spi_ad7888;
struct ad951x_device ad9516_main;
struct ad951x_device ad9516_ext;
struct ltc6950_device ltc6950_pll;
struct ad9910_device dds_ad9910_ref;
struct ad9910_device dds_ad9910_lo;
struct ad7888_device pwrmon_adc;
struct ertm15_rf_distribution_device rf_distr;
struct i2c_bus i2c_mac_addr;
struct m24aa025_device m24_mac_ids[2];
static struct ad951x_config pll_main_dot050_config =
#include "ertm_14_pll_main_dot050_config.h"
......@@ -179,20 +221,35 @@ bb_spi_create( &spi_ad9910_lo,
usleep(1000000);
ad9910_program(&dds_ad9910_ref, 0, 0, 0);
ertm15_rf_switches_init();
#if 0
bb_i2c_init( &i2c_mac_addr, &pin_mac_addr_scl, &pin_mac_addr_sda );
m24aa025_init( &m24_mac_ids[0], &i2c_mac_addr, 0x50 );
m24aa025_init( &m24_mac_ids[1], &i2c_mac_addr, 0x51 );
uint8_t mac[6];
m24aa025_read_mac( &m24_mac_ids[0], mac );
ep_set_mac_addr( mac );
bb_spi_create( &spi_ad7888,
&pin_pwrmon_adc_cs_n,
&pin_pwrmon_adc_din,
&pin_pwrmon_adc_dout,
&pin_pwrmon_adc_sclk,
100 );
ad7888_create( &pwrmon_adc, &spi_ad7888 );
ertm15_rf_distr_init( &rf_distr, &pwrmon_adc );
for(;;)
{
pp_printf("SillyTest\n");
for(i=0;i<10000000;i++) asm volatile("nop");
spll_set_dac(0, 0);
for(i=0;i<10000000;i++) asm volatile("nop");
//bb_spi_cs(&spi_ocxo_dac, 1);
//bb_spi_write(&spi_ocxo_dac, 60000, 16);
//bb_spi_cs(&spi_ocxo_dac, 0);
spll_set_dac(0, 60000);
ertm15_rf_distr_measure_power( &rf_distr );
//ad7888_poll( &pwrmon_adc );
}
#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