Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
57cdc67b
Commit
57cdc67b
authored
Mar 19, 2020
by
Tomasz Wlostowski
Committed by
Grzegorz Daniluk
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boards/wr-switch: moved WRS-specific code to wr-switch BSP, migrated gpio-wrs to gen_gpio framework
parent
4708780d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
68 deletions
+34
-68
boards.mk
boards/boards.mk
+1
-1
ad9516.c
boards/wr-switch/ad9516.c
+8
-7
ad9516_config.h
boards/wr-switch/ad9516_config.h
+0
-0
gpio-wrs.h
boards/wr-switch/gpio-wrs.h
+18
-0
main.c
boards/wr-switch/main.c
+7
-6
gpio-wrs.h
include/dev/gpio-wrs.h
+0
-54
No files found.
boards/boards.mk
View file @
57cdc67b
obj-$(CONFIG_TARGET_GENERIC_PHY_8BIT) += boards/generic/board.o
obj-$(CONFIG_TARGET_GENERIC_PHY_16BIT) += boards/generic/board.o
obj-$(CONFIG_TARGET_WR_SWITCH) += boards/wr-switch/main.o
obj-$(CONFIG_TARGET_WR_SWITCH) += boards/wr-switch/main.o
boards/wr-switch/gpio-wrs.o boards/wr-switch/ad9516.o
obj-$(CONFIG_TARGET_AFCZ) += boards/afcz/board.o
dev
/ad9516.c
→
boards/wr-switch
/ad9516.c
View file @
57cdc67b
...
...
@@ -19,7 +19,8 @@
#include "board.h"
#include "dev/syscon.h"
#include "dev/gpio-wrs.h"
#include "dev/gpio.h"
#include "gpio-wrs.h"
#include "rt_ipc.h"
...
...
@@ -214,12 +215,12 @@ int ad9516_init(int scb_version, int ljd_present)
void
*
spi_base
=
(
void
*
)
BASE_SPI
;
g
pio_out
(
GPIO_SYS_CLK_SEL
,
0
);
/* switch to the standby reference clock, since the PLL is off after reset */
g
en_gpio_out
(
&
gpio_pin_sys_clk_sel
,
0
);
/* switch to the standby reference clock, since the PLL is off after reset */
/* reset the PLL */
g
pio_out
(
GPIO_PLL_RESET_N
,
0
);
g
en_gpio_out
(
&
gpio_pin_pll_reset_n
,
0
);
timer_delay
(
10
);
g
pio_out
(
GPIO_PLL_RESET_N
,
1
);
g
en_gpio_out
(
&
gpio_pin_pll_reset_n
,
1
);
timer_delay
(
10
);
/* Use unidirectional SPI mode */
...
...
@@ -273,9 +274,9 @@ int ad9516_init(int scb_version, int ljd_present)
pp_printf
(
"AD9516 locked.
\n
"
);
g
pio_out
(
GPIO_SYS_CLK_SEL
,
1
);
/* switch the system clock to the PLL reference */
g
pio_out
(
GPIO_PERIPH_RESET_N
,
0
);
/* reset all peripherals which use AD9516-provided clocks */
g
pio_out
(
GPIO_PERIPH_RESET_N
,
1
);
g
en_gpio_out
(
&
gpio_pin_sys_clk_sel
,
1
);
/* switch the system clock to the PLL reference */
g
en_gpio_out
(
&
gpio_pin_periph_reset_n
,
0
);
/* reset all peripherals which use AD9516-provided clocks */
g
en_gpio_out
(
&
gpio_pin_periph_reset_n
,
1
);
return
0
;
}
...
...
dev
/ad9516_config.h
→
boards/wr-switch
/ad9516_config.h
View file @
57cdc67b
File moved
boards/wr-switch/gpio-wrs.h
0 → 100644
View file @
57cdc67b
/*
* This work is part of the White Rabbit project
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#ifndef __GPIO_WRS_H
#define __GPIO_WRS_H
#include "dev/gpio.h"
extern
const
struct
gpio_pin
gpio_pin_sys_clk_sel
;
extern
const
struct
gpio_pin
gpio_pin_pll_reset_n
;
extern
const
struct
gpio_pin
gpio_pin_periph_reset_n
;
extern
const
struct
gpio_pin
gpio_pin_ljd_board_detect
;
void
wrs_gpio_init
(
void
);
#endif
\ No newline at end of file
boards/wr-switch/main.c
View file @
57cdc67b
...
...
@@ -13,10 +13,10 @@
#include "minipc.h"
#include "revision.h"
#include "system_checks.h"
#include "dev/gpio-wrs.h"
#include "gpio-wrs.h"
int
scb_ver
=
33
;
/* SCB version */
int
scb_ljd_present
=
0
;
/* LJD presence */
extern
struct
spll_stats
stats
;
...
...
@@ -34,16 +34,17 @@ int main(void)
check_reset
();
stats
.
start_cnt
++
;
_endram
=
ENDRAM_MAGIC
;
wrs_gpio_init
();
console_init
();
pp_printf
(
"
\n
"
);
pp_printf
(
"WR Switch Real Time Subsystem (c) CERN 2011 - 20
14
\n
"
);
pp_printf
(
"WR Switch Real Time Subsystem (c) CERN 2011 - 20
20
\n
"
);
pp_printf
(
"Revision: %s, built: %s %s.
\n
"
,
build_revision
,
build_date
,
build_time
);
pp_printf
(
"SCB version: %d. %s
\n
"
,
scb_ver
,(
scb_ver
>=
34
)
?
"10 MHz SMC Output."
:
""
);
pp_printf
(
"Start counter %d
\n
"
,
stats
.
start_cnt
);
/* Low-jitter Daughterboard detection */
ljd_present
=
gpio_in
(
GPIO_LJD_BOARD_DETECT
);
if
(
ljd_present
)
{
scb_ljd_present
=
gen_gpio_in
(
&
gpio_pin_ljd_board_detect
);
if
(
scb_
ljd_present
)
{
pp_printf
(
"
\n
--- WRS Low jitter board detected. ---
\n
"
);
pp_printf
(
"Allow 1 hour of warming up before starting measurements
\n
"
);
}
...
...
@@ -54,7 +55,7 @@ int main(void)
/* for sure problem is in calling second time ad9516_init,
* but not only */
}
ad9516_init
(
scb_ver
,
ljd_present
);
ad9516_init
(
scb_ver
,
scb_
ljd_present
);
rts_init
();
rtipc_init
();
spll_very_init
();
...
...
include/dev/gpio-wrs.h
deleted
100644 → 0
View file @
4708780d
/*
* This work is part of the White Rabbit project
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#ifndef __GPIO_H
#define __GPIO_H
#if 0 // fixme - migrate to new GPIO framework
#include <stdint.h>
#include "board.h"
#define GPIO_SYS_CLK_SEL 0
#define GPIO_PLL_RESET_N 1
#define GPIO_PERIPH_RESET_N 3
#define GPIO_LJD_BOARD_DETECT 4
extern int ljd_present;
struct GPIO_WB
{
uint32_t CODR; /*Clear output register*/
uint32_t SODR; /*Set output register*/
uint32_t DDR; /*Data direction register (1 means out)*/
uint32_t PSR; /*Pin state register*/
};
static volatile struct GPIO_WB *__gpio = (volatile struct GPIO_WB *) BASE_GPIO;
static inline void gpio_out(int pin, int val)
{
if(val)
__gpio->SODR = (1<<pin);
else
__gpio->CODR = (1<<pin);
}
static inline void gpio_dir(int pin, int val)
{
if(val)
__gpio->DDR |= (1<<pin);
else
__gpio->DDR &= ~(1<<pin);
}
static inline int gpio_in(int pin)
{
return __gpio->PSR & (1<<pin) ? 1: 0;
}
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment