├── LICENSE
├── README.md
├── image-management
├── README.md
├── buildSide
│ └── copyBoot
└── sdSide
│ ├── run_selectRelease.pl_bat.bat
│ ├── run_updateRelease.pl_bat.bat
│ └── selectRelease.pl
├── scripts
├── ADD_YOUR_BOARD.md
├── ADVANCED.md
├── README.md
├── constraints
│ ├── roe_framer_xdc_fifosync.xdc
│ └── roe_framer_zcu111_pinout.xdc
├── my_vivado_configs.yml
├── xil_vivado_utils.tcl
├── xroe_build_petalinux.csh
└── xroe_build_vivado.tcl
├── src
├── README.md
├── local-staging
│ └── xroeframer-driver
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── roe_framer_ctrl.h
│ │ ├── sysfs_xroe.c
│ │ ├── sysfs_xroe_framer_cfg.c
│ │ ├── sysfs_xroe_framer_deframer.c
│ │ ├── sysfs_xroe_framer_shared.c
│ │ ├── sysfs_xroe_framer_stats.c
│ │ ├── xroe_framer.c
│ │ └── xroe_framer.h
├── xlnx-ptp-timer
│ ├── xlnx-ptp-timer.c
│ └── xlnx-ptp-timer.h
├── xroe-app
│ ├── LICENSE
│ ├── Makefile
│ ├── README.md
│ ├── client.c
│ ├── client.h
│ ├── commands.h
│ ├── comms.c
│ ├── comms.h
│ ├── disable.c
│ ├── disable_str.h
│ ├── ecpri.c
│ ├── ecpri_proto.c
│ ├── ecpri_proto.h
│ ├── ecpri_str.h
│ ├── enable.c
│ ├── enable_str.h
│ ├── framing.c
│ ├── framing_str.h
│ ├── ip.c
│ ├── ip_str.h
│ ├── parser.c
│ ├── parser.h
│ ├── radio_ctrl.c
│ ├── radio_ctrl_str.h
│ ├── restart.c
│ ├── restart_str.h
│ ├── roe_framer_ctrl.h
│ ├── roe_radio_ctrl.h
│ ├── stats.c
│ ├── stats_str.h
│ ├── template.c
│ ├── template_str.h
│ ├── xroe-app.c
│ ├── xroe_api.c
│ ├── xroe_api.h
│ ├── xroe_types.h
│ └── xroefram_str.h
├── xroe-auto-start
│ ├── runXroe.bash
│ └── xroe-auto-start
├── xroe-scripts
│ ├── xroe-common-procs.sh
│ ├── xroe-config-XXV-ptp.sh
│ ├── xroe-config-XXV.sh
│ ├── xroe-help
│ ├── xroe-help.txt
│ ├── xroe-printk_to.sh
│ ├── xroe-printk_to_6.sh
│ ├── xroe-printk_to_7.sh
│ ├── xroe-printk_to_8.sh
│ ├── xroe-ptp4l.cfg
│ ├── xroe-ptp4lsyncE.cfg
│ ├── xroe-ptp_killall.sh
│ ├── xroe-ptp_mas.sh
│ ├── xroe-ptp_slv.sh
│ ├── xroe-ptp_slv_synce.sh
│ ├── xroe-report-mod-install.sh
│ ├── xroe-run-ptpSyncE.sh
│ ├── xroe-startup.sh
│ ├── xroe-xxv-down.sh
│ └── xroe-xxv-up.sh
└── xtraffic
│ ├── COPYING
│ ├── Makefile
│ ├── README.md
│ ├── roe_radio_ctrl.h
│ ├── sysfs_xroe_traffic_config.c
│ ├── xroe_traffic.c
│ ├── xroe_traffic.h
│ └── xroe_traffic_utils.c
└── yocto-recipes
├── kernel
└── linux
│ ├── linux-xlnx
│ ├── 0001-Re-apply-fix-to-changed-baseline-code.patch
│ ├── 0001-Signed-off-by-Xu-Dong-xud-xilinx.com.patch
│ ├── 0001-net-xilinx-axiethernet-Workaround-for-NOOP-timestamp.patch
│ ├── 0001-si570-patch-adding-sysfs-for-frequency.patch
│ └── fragment1.cfg
│ └── linux-xlnx_%.bbappend
├── meta
├── basic.dtsi
├── system-user.dtsi
├── system-user_102.dtsi
└── system-user_111.dtsi
└── src-bb
├── framer
└── framer.bb
├── init-ifupdown
└── init-ifupdown_%.bbappend
├── xlnx-ptp-timer
└── xlnx-ptp-timer.bb
├── xroe-app
├── README
└── xroe-app.bb
├── xroe-auto-start
└── xroe-auto-start.bb
├── xroe-scripts
└── xroescripts.bb
└── xtraffic
└── xtraffic.bb
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2018, Xilinx
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | * Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Xilinx wireless-apps software repository
2 |
3 | Software for eCPRI 5G wireless IP and PetaLinux
4 |
5 | The directory structure is:
6 | - **src** Source code and end-user scripts.
7 | - **scripts** Build and configuration scripts to help create a PetaLinux project.
8 | - **yocto-recipes** Recipes to build the source code into a PetaLinux project.
9 | - **image-managment** Build and SDSide Perl script to mange BOOT.bin and image.ub copy and selection.
10 |
11 | ## Get started
12 |
13 | There are three options to test and build the Demonstration Subsystem.
14 | - **SDCard** Try the pre-built example avaiable from the eCPRI Lounge (registration required).
15 |
16 | - **HDF** Build from a Vivado HDF using PetaLinux. This provides the most fexibility. See README in **scripts** directory.
17 |
18 | ```console
19 | git clone https://github.com/Xilinx/wireless-apps.git
20 | cd scripts
21 | more README.md
22 | ```
23 |
24 | ## Post Boot
25 | Once the system has booted, the default username and password are both **root**. To help you get started view the onboard help using
26 | ```console
27 | xroe-help
28 | ```
29 |
30 | ## PetaLinux
31 | The PetaLinux landing page can be found here.
32 |
33 | ## O-RAN
34 | The present github repository relates to eCPRI IP. For O-RAN IP, please refer to the github repository here.
--------------------------------------------------------------------------------
/image-management/README.md:
--------------------------------------------------------------------------------
1 | # SDCard Image Managment
2 |
3 | The scripts in this directory can be used to maintain images on an SD Card.
4 |
5 | Build side we copy these to a date stamped directory in your home area.
6 | SD Side we look for new builds(BOOT.bin image.ub) in this directory and copy these over.
7 |
8 | ## Build Side
9 | ```console
10 | ../../image-management/buildSide/copyBoot
11 | ```
12 |
13 | ## Sd Card Side
14 | These scripts should be copied to your SD card. You may need to update the BAT file as the default mapped drive path is **H:**
15 | The SD Manager requires PERL to be installed on your machine.
16 | It also may need to be "Run as Administrator".
17 |
--------------------------------------------------------------------------------
/image-management/buildSide/copyBoot:
--------------------------------------------------------------------------------
1 | ############################################################################
2 | # Some simple setup variables
3 | ############################################################################
4 | set TAG="roe_om0_mymods1_"
5 | set STORE="/home/${USER}/BOOTBINSTORE"
6 | set BINPATH="./images/linux"
7 | set CREATIONTIME=`date --utc +%Y%m%d_%H%M%S`
8 |
9 | ############################################################################
10 | # Alow TAG modification through command line
11 | ############################################################################
12 | if ( $1 != "" ) then
13 | echo "Setting $TAG to $1"
14 | set TAG=$1
15 | endif
16 |
17 | ############################################################################
18 | # Alow STORE modification through command line
19 | ############################################################################
20 | if ( $2 != "" ) then
21 | echo "Setting $STORE to $2"
22 | set STORE=$2
23 | endif
24 |
25 | ############################################################################
26 | # Some simple setup variables
27 | ############################################################################
28 | set DEST=$STORE/${TAG}${CREATIONTIME}
29 |
30 | ############################################################################
31 | # check and make your store directory
32 | ############################################################################
33 | if ( ! -d $STORE ) then
34 | mkdir $STORE
35 | else
36 | echo "Store exists not recreating @ $STORE"
37 | endif
38 |
39 | # make a date_time tagged directory to copy files into
40 | mkdir $DEST
41 |
42 | # Copy the BOOT.bin to your local space
43 | cp ${BINPATH}/BOOT.BIN $DEST/BOOT.bin
44 | cp ${BINPATH}/image.ub $DEST/image.ub
45 |
46 | echo "##### CONTENT OF $DEST"
47 | ls -la $DEST
48 | ############################################################################
49 | # DONE
50 | ############################################################################
51 |
--------------------------------------------------------------------------------
/image-management/sdSide/run_selectRelease.pl_bat.bat:
--------------------------------------------------------------------------------
1 | perl selectRelease.pl -select -boot_store "H:\BOOTBINSTORE"
2 | cmd
3 |
--------------------------------------------------------------------------------
/image-management/sdSide/run_updateRelease.pl_bat.bat:
--------------------------------------------------------------------------------
1 | perl selectRelease.pl -boot_store "H:\BOOTBINSTORE"
2 | cmd
3 |
--------------------------------------------------------------------------------
/image-management/sdSide/selectRelease.pl:
--------------------------------------------------------------------------------
1 | use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);
2 | use File::Copy qw(copy);
3 | use Data::Dumper;
4 | use Getopt::Long;
5 | use File::Stat qw/:all/; # all exports
6 | ###############################################################################
7 | # Simple PERL script to manage copy of releases to SD card and select release
8 | # on the card based on timestamp
9 | ###############################################################################
10 | my $bootBinStore = "A:\BOOTBINSTORE";
11 | my $localBinStore = "./";
12 | my %dirStore;
13 | my $select=0;
14 | GetOptions ("select" => \$select ,
15 | "boot_store=s" => \$bootBinStore ) or die("Error in command line arguments\n");
16 |
17 | # Fill hash with directories in the source and destination
18 | fillHashWithDirContent($bootBinStore, \%{$dirStore{from}});
19 | fillHashWithDirContent($localBinStore, \%{$dirStore{to}});
20 |
21 | #print Dumper(\%dirStore);
22 |
23 | # copy directories that do not exist in the destination#
24 | # This call also fills up the VERSION dict required for the next command
25 | copyDirsFromSrcToDest(\%dirStore);
26 |
27 | my @versionListLatestFirst = sort {$b <=> $a} keys %{$dirStore{to}{VERSION}};
28 |
29 | if($select) {
30 | my $count = 0;
31 |
32 | print "\n\nAVAIABLE RELEASES, select one:\n\n";
33 |
34 | foreach my $datestamp (@versionListLatestFirst) {
35 |
36 | printf ("%3d : %10s : %s\n", $count, humanReadableDateString($datestamp), $dirStore{to}{VERSION}{$datestamp});
37 | $count++;
38 | }
39 | print "\n\nChoose one using left hand select value: ";
40 | my $userSelect = <>;
41 | chomp $userSelect;
42 | print "$userSelect\n\n";
43 |
44 | copyImageFilesToDiskRoot(\%dirStore, \@versionListLatestFirst, $userSelect);
45 |
46 | }else {
47 |
48 | # if its the latest copy content to the root destination directory
49 | # delete directories on the dest that do not exist in the source? optional
50 | # select a version to use, optional
51 | copyImageFilesToDiskRoot(\%dirStore, \@versionListLatestFirst, 0);
52 | }
53 |
54 | #print Dumper(\%dirStore);
55 | ###############################################################################
56 | # functions
57 | ###############################################################################
58 | sub copyImageFilesToDiskRoot {
59 | my ($dirStoreRef, $arrayRef, $select)=@_;
60 | copyFileIfDateDiff("./$dirStoreRef->{to}{VERSION}{@$arrayRef[$select]}/", "./", "BOOT.bin");
61 | copyFileIfDateDiff("./$dirStoreRef->{to}{VERSION}{@$arrayRef[$select]}/", "./", "image.ub");
62 | }
63 |
64 | ###############################################################################
65 | # functions
66 | ###############################################################################
67 | sub copyFileIfDateDiff {
68 | my ($from, $to, $name)=@_;
69 |
70 | $from .= "/$name";
71 | $to .= "/$name";
72 |
73 | my @fs = stat($from);
74 | my @ts = stat($to);
75 |
76 | # 0 dev device number of filesystem
77 | # 1 ino inode number
78 | # 2 mode file mode (type and permissions)
79 | # 3 nlink number of (hard) links to the file
80 | # 4 uid numeric user ID of file's owner
81 | # 5 gid numeric group ID of file's owner
82 | # 6 rdev the device identifier (special files only)
83 | # 7 size total size of file, in bytes
84 | # 8 atime last access time in seconds since the epoch
85 | # 9 mtime last modify time in seconds since the epoch
86 | # 10 ctime inode change time in seconds since the epoch (*)
87 | # 11 blksize preferred I/O size in bytes for interacting with the
88 | # file (may vary from file to file)
89 | # 12 blocks actual number of system-specific blocks allocated
90 | # on disk (often, but not always, 512 bytes each)
91 |
92 |
93 | if ($fs[9] != $ts[9]) {
94 | print "Dates are differnt $fs[9] != $ts[9], copy commence $from $to\n";
95 | copy($from, $to) or die "Copy failed: $!";
96 | } else {
97 | print "Dates match, no copy required $from $to\n";
98 | }
99 | }
100 |
101 | sub copyDirsFromSrcToDest {
102 | my ($dirStoreRef)=@_;
103 | foreach my $dirName (keys %{$dirStoreRef->{from}{NAME}}) {
104 | if(validDateString($dirName)){
105 | $dirStoreRef->{to}{VERSION}{stripDateString($dirName)}=$dirName;
106 | if (! exists $dirStoreRef->{to}{NAME}{$dirName}) {
107 | printf("Directory does not exist in destination, will copy $dirStoreRef->{from}{PATH}/$dirName to $dirStoreRef->{to}{PATH}/$dirName\n");
108 | dircopy("$dirStoreRef->{from}{PATH}/$dirName", "$dirStoreRef->{to}{PATH}/$dirName");
109 | }
110 | }
111 | }
112 | }
113 |
114 | sub humanReadableDateString {
115 | my ($dirName)=@_;
116 | if($dirName =~ m/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/) {
117 | return "$1/$2/$3 $4:$5:$6";
118 | } else {
119 | return 0;
120 | }
121 | }
122 |
123 | sub stripDateString {
124 | my ($dirName)=@_;
125 | if($dirName =~ m/([0-9]{4}[0-9]{2}[0-9]{2})_([0-9]{2}[0-9]{2}[0-9]{2})/) {
126 | return "$1$2";
127 | } else {
128 | return 0;
129 | }
130 | }
131 |
132 | sub validDateString {
133 | my ($dirName)=@_;
134 | if($dirName =~ m/[0-9]{4}[0-9]{2}[0-9]{2}_[0-9]{2}[0-9]{2}[0-9]{2}/) {
135 | return 1;
136 | } else {
137 | return 0;
138 | }
139 | }
140 |
141 | sub fillHashWithDirContent {
142 | my ($dirPath, $hashRef)=@_;
143 | my $count=0;
144 | opendir(my $dh, $dirPath) || die;
145 | $hashRef->{PATH} ="$dirPath";
146 | while(readdir $dh) {
147 | #print "$dirPath/$_\n";
148 | $hashRef->{NAME}{"$_"} = $_;
149 | $count++;
150 | }
151 | closedir $dh;
152 | return $count;
153 | }
--------------------------------------------------------------------------------
/scripts/ADD_YOUR_BOARD.md:
--------------------------------------------------------------------------------
1 | ## Vivado
2 | 1. Open a Vivado project and select the part/board of interest
3 | 2. Create and IPI design and add the framer IP
4 | 3. Run "Block automation"
5 | 4. Add constraints for all the pins, refer to the Board User guide and the included examples.
6 | 5. Check clocking is compatible, refer to boards User Guide and amend if necessary
7 | 5. Generate Bitstream
8 |
9 | ## Petalinux
10 | 1. Generate an XSA from the Vivado project
11 | 2. Review the Petalinux script where there are board type checks, zcu102 for example
12 | 3. Update the content with appropriate updates for your board. If you dont know the values, you can build first and review/update later.
13 | 4. Build
14 |
15 | ## Issues
16 | The roe_framer example system should be targetable at any MPSOC board. Internally it is only tested on the zcu102 & zcu111. Use the following links below for any porting issues.
17 |
18 | ### Vivado & Petalinux
19 | Xilinx Forum
20 |
21 | ### PetaLinux Userguides
22 | The PetaLinux landing page can be found here.
--------------------------------------------------------------------------------
/scripts/ADVANCED.md:
--------------------------------------------------------------------------------
1 | ## **Petalinux** (advanced)
2 | ### Creating a BSP
3 | If you wish to create a BSP from this project, you can do so using the following command.
4 | ```console
5 | petalinux-package --bsp -p --output MY.BSP
6 | ```
7 |
8 | ### Unpacking RPM
9 | If you build custom apps and wish to manually copy the executeable, you will need to recover it from its RPM file. Use the following command to do this.
10 | ```console
11 | rpm2cpio myrpmfile.rpm | cpio -idmv
12 | ```
13 |
14 | ### Having issues?
15 | #### Xilinx Petalinux help
16 | https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/18842475/PetaLinux+Yocto+Tips
17 |
18 | #### Checking the generated device tree
19 | If there are issues when adding blocks to the design, check the device tree. You can decompile the device tree using dtc and check that it was assembled as you require.
20 | ```console
21 | ## You can find the dtc executable in your PL repo at
22 | ## .../petalinux-v2019.1-final/components/yocto/source/arm/buildtools/sysroots/x86_64-petalinux-linux/usr/bin/
23 | dtc -I dtb -O dts -o ./deviceTreeDebugView.dts ./images/linux/system.dtb
24 | ```
25 |
26 | ## **Vivado TCL Script** (advanced)
27 | The following script is provided as an example. It is similar to how Xilinx test the IP and can help maintain consistency between your design runs. It provides hooks for extension. The end result will be the same as the GUI flow asour TCL scripts use the IP block automation.
28 |
29 | Usage:
30 | ```console
31 | vivado -mode tcl -source ./xroe_build_vivado.tcl
32 | ```
33 | Once loaded, review the printed help. When you are familiar with the flow and want to fully script the build, you can call vivado with launch arguments.
34 | ```console
35 | ## This style uses a set of strings concatenated together to tell the
36 | ## script what mode it should built in. Note. case is ignored.
37 | ##
38 | ## 1st TCLARGS = board to use (zcu111|zcu102)
39 | ## 2nd TCLARGS = Ip Mode to select (om0|om5)
40 | ## 3rd TCLARGS = Command mode to run (impl)(exit)(nodate)
41 | ## 4rd TCLARGS = IP Directory (Path to local IP repo.) [optional]
42 |
43 | vivado -mode tcl -source ./xroe_build_vivado.tcl -tclargs om5Impl -tclargs zcu102
44 | ```
45 | ### **Vivado TCL going deeper**
46 | Also provided is `xil_vivado_utils.tcl` should you wish to augment or further explore the vivado design. Both supplied scripts
47 | can be TCL "sourced" in your own flow and extended to achieve your end design.
48 |
49 | ## Build Everything
50 | ### Vivado
51 | To run all the builds serially in a script, the following sequence can be called.
52 | ```console
53 | vivado -mode tcl -source ./xroe_build_vivado.tcl -tclargs zcu102 -tclargs om0 -tclargs implNodateExit
54 | vivado -mode tcl -source ./xroe_build_vivado.tcl -tclargs zcu111 -tclargs om0 -tclargs implNodateExit
55 | vivado -mode tcl -source ./xroe_build_vivado.tcl -tclargs zcu111 -tclargs om0_25 -tclargs implNodateExit
56 | ```
57 | ### Petalinux
58 | Once complete run the Petalinux builds (where "20XX_X" is the release, e.g. 2022.1).
59 | Note the **../** is used as Petalinux needs to create a project and cd up and out to get to the XSA directory.
60 | ```console
61 | ./xroe_build_petalinux.csh om0_z102_0 ../zcu102_om0_20XX_X/zcu102_om0_20XX_X.sdk zcu102 om0
62 | ./xroe_build_petalinux.csh om0_z111_0 ../zcu111_om0_20XX_X/zcu111_om0_20XX_X.sdk zcu111 om0
63 | ./xroe_build_petalinux.csh om0_z111_25g0 ../zcu111_om0_25_20XX_X/zcu111_om0_25_20XX_X.sdk zcu111 om0_25g
64 |
65 | ```
66 |
--------------------------------------------------------------------------------
/scripts/README.md:
--------------------------------------------------------------------------------
1 | # RoE framer scripts
2 |
3 | ## **Build Vivado Project in GUI**
4 | Start vivado choose a supported board/part, place the IP on the IPI canvas and run the Block Automation as detailed in PG312.
5 | See [ADVANCED.md](ADVANCED.md) for Vivado command line examples.
6 |
7 | ## **Petalinux eCPRI/1914 Framer** (Oran_Mode == 0)
8 |
9 | Usage:
10 | ```console
11 | xroe_build_petalinux.csh
12 | ```
13 | This script will populate a project directory with a given XROE_framer-based hardware image, then configure and build the project.
14 | Build output will be in `/images/linux/image.ub` (PetaLinux image) and `/images/linux/BOOT.BIN` (bootloader image).
15 | Copy these to the root directory of an SD card and insert the card into the ZCU102 SD card slot to boot the board.
16 |
17 | ## Advanced
18 | See [ADVANCED.md](ADVANCED.md) for TCL scripting and debug help.
19 |
20 | ## Adding a board
21 | See [ADD_YOUR_BOARD.md](ADD_YOUR_BOARD.md), out of the box boards are shown below.
22 |
23 |
24 | | Mode/Board | | zcu102 | zcu111 |
25 | | --- | --- | :---: | :---: |
26 | | | | |
27 | | 2018.3 OM0 (10G) | | Y | N |
28 | | | | |
29 | | 2019.2 OM0 (10G) | | Y | Y |
30 | | 2019.2 OM0 (25G) | | NA | Y |
31 | | 2020.1 OM0 (10G) | | Y | Y |
32 | | 2020.1 OM0 (25G) | | NA | Y |
33 |
--------------------------------------------------------------------------------
/scripts/constraints/roe_framer_xdc_fifosync.xdc:
--------------------------------------------------------------------------------
1 | set from_list [get_pins -hier -regexp {.*ul_eth_pipe_i\/pkt_rdy_len_reg.*C}]
2 | set to_list [get_pins -hier -regexp {.*ul_eth_pipe_i\/pkt_rdy_len_sync_reg.+(?:CE|D)}]
3 | set_false_path -from $from_list -to $to_list
4 | #report_timing -from $from_list -to $to_list -path_type summary -max_paths 10000
5 |
--------------------------------------------------------------------------------
/scripts/constraints/roe_framer_zcu111_pinout.xdc:
--------------------------------------------------------------------------------
1 |
2 | # 25G ETHERNET INTERFACE CONNECTION
3 |
4 | ## SFP Enable
5 | set_property PACKAGE_PIN G12 [get_ports {sfp_enable[0]}]
6 | set_property IOSTANDARD HSTL_I_12 [get_ports {sfp_enable[0]}]
7 |
8 | #############
9 | # LED
10 | #############
11 | set_property PACKAGE_PIN AV15 [get_ports {LED_tri_o[7]}]
12 | set_property PACKAGE_PIN AN17 [get_ports {LED_tri_o[6]}]
13 | set_property PACKAGE_PIN AN16 [get_ports {LED_tri_o[5]}]
14 | set_property PACKAGE_PIN AP15 [get_ports {LED_tri_o[4]}]
15 | set_property PACKAGE_PIN AP16 [get_ports {LED_tri_o[3]}]
16 | set_property PACKAGE_PIN AR16 [get_ports {LED_tri_o[2]}]
17 | set_property PACKAGE_PIN AP13 [get_ports {LED_tri_o[1]}]
18 | set_property PACKAGE_PIN AR13 [get_ports {LED_tri_o[0]}]
19 |
20 |
21 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[7]}]
22 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[6]}]
23 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[5]}]
24 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[4]}]
25 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[3]}]
26 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[2]}]
27 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[1]}]
28 | set_property IOSTANDARD LVCMOS18 [get_ports {LED_tri_o[0]}]
29 |
30 | #############
31 | # DIP SWITCHES
32 | #############
33 | set_property PACKAGE_PIN AF16 [get_ports {gpio_cdc_dipstatus[0]}]
34 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[0]}]
35 | set_property PACKAGE_PIN AF17 [get_ports {gpio_cdc_dipstatus[1]}]
36 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[1]}]
37 | set_property PACKAGE_PIN AH15 [get_ports {gpio_cdc_dipstatus[2]}]
38 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[2]}]
39 | set_property PACKAGE_PIN AH16 [get_ports {gpio_cdc_dipstatus[3]}]
40 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[3]}]
41 | set_property PACKAGE_PIN AH17 [get_ports {gpio_cdc_dipstatus[4]}]
42 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[4]}]
43 | set_property PACKAGE_PIN AG17 [get_ports {gpio_cdc_dipstatus[5]}]
44 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[5]}]
45 | set_property PACKAGE_PIN AJ15 [get_ports {gpio_cdc_dipstatus[6]}]
46 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[6]}]
47 | set_property PACKAGE_PIN AJ16 [get_ports {gpio_cdc_dipstatus[7]}]
48 | set_property IOSTANDARD LVCMOS18 [get_ports {gpio_cdc_dipstatus[7]}]
49 |
50 | #############
51 | # Clocks
52 | #############
53 |
54 | # 300 MHz Reference Clock
55 | set_property PACKAGE_PIN J19 [get_ports clk_300m_0_clk_p]
56 | set_property PACKAGE_PIN J18 [get_ports clk_300m_0_clk_n]
57 | set_property IOSTANDARD DIFF_HSTL_I_18 [get_ports clk_300m_0_clk_n]
58 |
59 | #############
60 | # QSFP Clocks. This comes from the Quad below the Quad used. USER_MGT_SI570
61 | #############
62 | set_property PACKAGE_PIN V32 [get_ports gt_ref_clk_clk_n]
63 | set_property PACKAGE_PIN V31 [get_ports gt_ref_clk_clk_p]
64 |
65 | #############
66 | # QSFP0 ports
67 | #############
68 |
69 | ## PORT 0
70 | ## quad _128 FOR CONNECTION BELOW
71 | ##
72 | set_property PACKAGE_PIN AA39 [get_ports gt_serial_port_0_grx_n]
73 | set_property PACKAGE_PIN AA38 [get_ports gt_serial_port_0_grx_p]
74 | set_property PACKAGE_PIN Y36 [get_ports gt_serial_port_0_gtx_n]
75 | set_property PACKAGE_PIN Y35 [get_ports gt_serial_port_0_gtx_p]
76 |
77 |
78 | ## Clock constraints
79 | #390.625MHz for 25G ethernet
80 | #create_clock -period 2.560 -name clk_refclk -waveform {0.000 1.280} [get_ports gt_ref_clk_clk_n]
81 | #create_clock -period 2.560 -name clk_refclk -waveform {0.000 1.280} [get_ports gt_ref_clk_clk_p]
82 |
83 | ##-----------------------------------------------------------------------------
84 | ## Use center pushbutton as reset
85 | ##-----------------------------------------------------------------------------
86 | set_property PACKAGE_PIN AF15 [get_ports "pushbutton_reset"]
87 | set_property IOSTANDARD LVCMOS18 [get_ports "pushbutton_reset"]
88 |
89 | ## ONE PPS placement pin
90 | set_property PACKAGE_PIN L14 [get_ports {one_pps_0}]
91 | set_property IOSTANDARD LVCMOS12 [get_ports {one_pps_0}]
92 |
--------------------------------------------------------------------------------
/scripts/my_vivado_configs.yml:
--------------------------------------------------------------------------------
1 |
2 |
3 | cfg:
4 | boards:
5 | zcu111:
6 | PART: "xczu28dr-ffvg1517-2-e"
7 | BOARD: "xilinx.com:zcu111:part0:1.2"
8 | zcu102:
9 | PART: "xczu9eg-ffvb1156-2-e"
10 | BOARD: "xilinx.com:zcu102:part0:3.3"
11 |
12 | ip:
13 | om5:
14 | CONFIG.Oran_Mode : 5
15 | CONFIG.Axis_Ports_Fram: 1
16 | CONFIG.Axis_Ports_Defm: 1
17 |
18 | om5_25:
19 | CONFIG.Oran_Mode : 5
20 | CONFIG.Physical_Ethernet_Rate : "25G"
21 | CONFIG.Axis_Ports_Fram : 1
22 | CONFIG.Axis_Ports_Defm : 1
23 |
24 | om0:
25 | CONFIG.Oran_Mode : 0
26 | CONFIG.Axis_Ports_Fram: 8
27 | CONFIG.Axis_Ports_Defm: 8
28 | CONFIG.Fram_Auto_Start: false
29 |
30 | om0_25:
31 | CONFIG.Oran_Mode : 0
32 | CONFIG.Physical_Ethernet_Rate : "25G"
33 | CONFIG.Axis_Ports_Fram: 8
34 | CONFIG.Axis_Ports_Defm: 8
35 | CONFIG.Fram_Auto_Start: false
36 |
37 | ## Flow settings
38 | flow:
39 | ipName: roe_framer_0
40 | ipType: xilinx.com:ip:roe_framer
41 | bdName: "design_1"
42 |
43 | ## Block automation settings.
44 | bacfg:
45 | cust_repo_ptp: {CONFIG: {processorSelect: ARM_Linux, ptpSelect: XilinxPtpV1, cfg_addBlFifoReset: 1 }}
46 | norm_repo_ptp: {processorSelect: ARM_Linux, ptpSelect: XilinxPtpV1, cfg_addBlFifoReset: 1 }
47 | cust_repo : {CONFIG: {processorSelect: ARM_Linux, cfg_addBlFifoReset: 1 }}
48 | norm_repo : {processorSelect: ARM_Linux, cfg_addBlFifoReset: 1 }
49 |
50 |
--------------------------------------------------------------------------------
/scripts/xil_vivado_utils.tcl:
--------------------------------------------------------------------------------
1 | ## ----------------------------------------------------------------------------
2 | ##
3 | ## ----------------------------------------------------------------------------
4 | namespace eval ::roe::util {
5 |
6 | proc ifDirNotExistsCreate { dirPath } {
7 | if { ! [file exists $dirPath] } {
8 | file mkdir $dirPath
9 | }
10 | }
11 |
12 | proc xroe_matchProjectProp {prop matchString} {
13 | set currentBoard [get_property $prop [get_projects [current_project]]]
14 | if {[regexp $matchString $currentBoard] == 1} {
15 | return true
16 | } else {
17 | return false
18 | }
19 | }
20 |
21 | proc xroe_checkBoardExists {} {
22 | return [xroe_matchProjectProp BOARD_PART ".+"]
23 | }
24 |
25 | proc xroe_checkBoardPart {matchString} {
26 | return [xroe_matchProjectProp BOARD_PART $matchString]
27 | }
28 |
29 | proc xroe_checkPart {matchString} {
30 | return [xroe_matchProjectProp PART $matchString]
31 | }
32 |
33 | proc listBoards { } {
34 | set counter 0;
35 | foreach lBoard [get_boards] {
36 |
37 | ## So the format for get_board_parts is differnt to get_boards, adjust for search
38 | set modBoardName [regsub ".*\.com:" $lBoard "" ]
39 | set modBoardName [regsub ":" $modBoardName "*" ]
40 | set modBoardName "*${modBoardName}"
41 |
42 | ## get the board part so we can query its properties
43 | set board_part [get_board_parts -filter NAME=~$modBoardName ]
44 |
45 | if { $board_part ne "" } {
46 | set partName [get_property PART_NAME [get_board_parts $board_part]]
47 | set xmlFile [get_property FILE_NAME [get_board_parts $board_part]]
48 | } else {
49 | set partName ""
50 | }
51 |
52 | puts "[format %2d $counter] : [format %-30s $lBoard] [format %-40s $partName] $xmlFile";
53 | incr counter
54 |
55 | }
56 | }
57 |
58 |
59 | ##
60 | proc breadDownWorstCasePath { pathStoreRef countKey path_from path_to } {
61 | upvar 1 $pathStoreRef pathStore
62 | set timingReport [report_timing -from [get_pins $path_from] -to [get_pins $path_to] -return_string -no_header]]
63 | foreach line [split $timingReport "\n"] {
64 | if { [regexp {\s+Logic Levels} $line] } {
65 | dict set pathStore $countKey logic $line
66 | }
67 | if { [regexp {\s+Data Path Delay} $line] } {
68 | dict set pathStore $countKey dpath $line
69 | }
70 | }
71 | }
72 |
73 | proc datetime_script { } {
74 | return [ clock format [clock seconds] -format {%Y%m%d_%H%M%S} ]
75 | }
76 |
77 | proc breakDownWorstCasePaths { { numPaths 5 } { logicLevels 0 } {showCommands 0} { reportFile "wcPathAnalysis_DATE.csv" }} {
78 |
79 | set timingReport [report_timing -path_type summary -max_paths $numPaths -return_string -no_header]
80 | set process 0
81 | set count 0
82 | set pathDict {}
83 | set pathStart ""
84 | set pathEnd ""
85 | foreach line [split $timingReport "\n"] {
86 | if { $process } {
87 | if { [regexp {\s{40,}} $line] } {
88 | #puts "TIME: $line"
89 | breadDownWorstCasePath pathDict $count $pathStart $pathEnd
90 | regsub {^\s*} $pathStart "" pathStart;# Update the time
91 | regsub {^\s*} $pathEnd "" pathEnd;# Update the time
92 | dict set pathDict $count start $pathStart
93 | dict set pathDict $count end $pathEnd
94 | dict set pathDict $count slack $line
95 | incr count
96 | } else {
97 | if { [regexp {\s{20,}} $line] } {
98 | set pathEnd $line
99 | } else {
100 | if { [regexp {^\s*[a-zA-Z]} $line] } {
101 | set pathStart $line
102 | }
103 | }
104 | }
105 | }
106 | if { [regexp {^----} $line] } {
107 | set process 1
108 | }
109 | }
110 |
111 | set stringOut [formatOutString startPoint endPoint logic 'Path%' slack]\n
112 | foreach report [dict keys $pathDict] {
113 | regexp "\/inst\/(.*)" [dict get $pathDict $report start] allMatch startPoint
114 | regexp "\/inst\/(.*)" [dict get $pathDict $report end ] allMatch endPoint
115 | regexp "route(.*)" [dict get $pathDict $report dpath] allMatch dpath
116 | regexp {Levels:\s+([0-9]+)} [dict get $pathDict $report logic] allMatch logic
117 | regexp {\s+(.+)} [dict get $pathDict $report slack] allMatch slack
118 | regsub {\s+} $slack "" slack;# Remove all white space
119 | if { $logic >= $logicLevels } {
120 | append stringOut "[formatOutString $startPoint $endPoint $logic $dpath $slack]\n"
121 | if { $showCommands } {
122 | append stringOut "report_timing -from \[get_pins \{[dict get $pathDict $report start]\}\] -to \[get_pins \{[dict get $pathDict $report end ]\}\]\n"
123 | append stringOut "show_schematic -pin_pairs \[get_pins \{[dict get $pathDict $report start] [dict get $pathDict $report end ]\}\]\n"
124 | }
125 | }
126 | }
127 | puts $stringOut
128 | regsub {DATE} $reportFile "[datetime_script]" reportFile;# Update the time
129 | writeStringToFile $reportFile $stringOut
130 | }
131 |
132 | proc formatOutString {sp ep ll dp sl} {
133 | return "[format %-90s $sp],\
134 | [format %-90s $ep],\
135 | [format %7s $ll],\
136 | [format %-20s $dp],\
137 | [format %s $sl],\
138 | "
139 | }
140 |
141 | proc slurpFileRetString { fileNameIn } {
142 | set returnString ""
143 | if { [ file exists $fileNameIn ] } {
144 | set fp [open $fileNameIn r]
145 | set returnString [read $fp]
146 | close $fp
147 | } else {
148 | puts "Cannot open filename $fileNameIn, assuming we didn't need to."
149 | }
150 | return $returnString
151 | }
152 |
153 | package require yaml
154 |
155 | proc yamlFile2Dict { yamlFileName } {
156 | set yamlString [ slurpFileRetString $yamlFileName ]
157 | return [ yaml::yaml2dict $yamlString ]
158 | }
159 |
160 | proc dict2YamlFile { dictContent yamlFileName } {
161 | set fileId [open $yamlFileName "w"]
162 | puts -nonewline $fileId [ yaml::dict2yaml $dictContent ]
163 | close $fileId
164 | }
165 |
166 | proc writeStringToFile { fileName stringOut } {
167 | set fileId [open $fileName "w"]
168 | puts -nonewline $fileId $stringOut
169 | close $fileId
170 | }
171 |
172 | }
173 |
--------------------------------------------------------------------------------
/scripts/xroe_build_petalinux.csh:
--------------------------------------------------------------------------------
1 | #!/bin/tcsh
2 | set sourced=($_)
3 | if ("$sourced" != "") then
4 | set THISFILE=`readlink -f $sourced[2]`
5 | set OUPUT_DIR=$sourced[3]
6 | set HDF_DIR=$sourced[4]
7 | set BOARD=$sourced[5]
8 | set MODE=$sourced[6]
9 | else
10 | set THISFILE=`readlink -f $0`
11 | set OUPUT_DIR=$1
12 | set HDF_DIR=$2
13 | set BOARD=$3
14 | set MODE=$4
15 | endif
16 |
17 | set DELIVERYDIR=`dirname $THISFILE`
18 | set mode_is_oran=`echo $MODE | sed -n /om5/p | wc -l`
19 |
20 |
21 |
22 | petalinux-create --type project --template zynqMP -n $OUPUT_DIR
23 |
24 | cd $OUPUT_DIR/
25 | echo CONFIG_YOCTO_BUILDTOOLS_EXTENDED=y >> ./project-spec/configs/config
26 |
27 | petalinux-config --get-hw-description $HDF_DIR --silentconfig
28 |
29 | #if ("$MODE" == "om5") then
30 | if ( $mode_is_oran == 1 ) then
31 |
32 | echo "xroe: building for OM5 - ORAN mode"
33 | petalinux-create -t modules -n framer --enable
34 | rm ./project-spec/meta-user/recipes-modules/framer/files/framer.c
35 | rm ./project-spec/meta-user/recipes-modules/framer/framer.bb
36 | cp $DELIVERYDIR/../src/local-staging/xroeframer-driver/* ./project-spec/meta-user/recipes-modules/framer/files/
37 | cp $DELIVERYDIR/../yocto-recipes/src-bb/framer/framer.bb ./project-spec/meta-user/recipes-modules/framer/
38 |
39 | else
40 |
41 | echo "xroe: building for OM0 - Framer only mode"
42 | petalinux-create -t modules -n xtraffic --enable
43 | rm ./project-spec/meta-user/recipes-modules/xtraffic/files/*.c
44 | rm ./project-spec/meta-user/recipes-modules/xtraffic/xtraffic.bb
45 | cp $DELIVERYDIR/../src/xtraffic/* ./project-spec/meta-user/recipes-modules/xtraffic/files/
46 | cp $DELIVERYDIR/../yocto-recipes/src-bb/xtraffic/xtraffic.bb ./project-spec/meta-user/recipes-modules/xtraffic/
47 |
48 | endif
49 |
50 | petalinux-create -t modules -n xlnx-ptp-timer --enable
51 | rm ./project-spec/meta-user/recipes-modules/xlnx-ptp-timer/files/xlnx-ptp-timer.c
52 | rm ./project-spec/meta-user/recipes-modules/xlnx-ptp-timer/xlnx-ptp-timer.bb
53 | cp $DELIVERYDIR/../src/xlnx-ptp-timer/* ./project-spec/meta-user/recipes-modules/xlnx-ptp-timer/files/
54 | cp $DELIVERYDIR/../yocto-recipes/src-bb/xlnx-ptp-timer/xlnx-ptp-timer.bb ./project-spec/meta-user/recipes-modules/xlnx-ptp-timer/
55 |
56 | petalinux-create -t apps -n xroe-app --enable
57 | rm ./project-spec/meta-user/recipes-apps/xroe-app/files/xroe-app.c
58 | rm ./project-spec/meta-user/recipes-apps/xroe-app/xroe-app.bb
59 | cp $DELIVERYDIR/../src/xroe-app/* ./project-spec/meta-user/recipes-apps/xroe-app/files/
60 | cp $DELIVERYDIR/../yocto-recipes/src-bb/xroe-app/xroe-app.bb ./project-spec/meta-user/recipes-apps/xroe-app/
61 |
62 | petalinux-create -t apps --template install --name xroescripts --enable
63 | rm ./project-spec/meta-user/recipes-apps/xroescripts/files/xroescripts
64 | cp $DELIVERYDIR/../src/xroe-scripts/* ./project-spec/meta-user/recipes-apps/xroescripts/files/
65 | cp $DELIVERYDIR/../yocto-recipes/src-bb/xroe-scripts/xroescripts.bb ./project-spec/meta-user/recipes-apps/xroescripts/
66 |
67 | petalinux-create -t apps --template install -n xroe-auto-start --enable
68 | cp $DELIVERYDIR/../src/xroe-auto-start/* ./project-spec/meta-user/recipes-apps/xroe-auto-start/files/
69 | cp $DELIVERYDIR/../yocto-recipes/src-bb/xroe-auto-start/xroe-auto-start.bb ./project-spec/meta-user/recipes-apps/xroe-auto-start/
70 |
71 | cp $DELIVERYDIR/../yocto-recipes/meta/system-user.dtsi ./project-spec/meta-user/recipes-bsp/device-tree/files/
72 | if ("$BOARD" == "zcu102") then
73 | cat $DELIVERYDIR/../yocto-recipes/meta/system-user_102.dtsi >> ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
74 | endif
75 | if ("$BOARD" == "zcu111") then
76 | cat $DELIVERYDIR/../yocto-recipes/meta/system-user_111.dtsi >> ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
77 | endif
78 |
79 | mkdir -p project-spec/meta-user/recipes-kernel/
80 | cp -pr $DELIVERYDIR/../yocto-recipes/kernel/* ./project-spec/meta-user/recipes-kernel/
81 |
82 | #if ("$MODE" == "om5") then
83 | if ( $mode_is_oran == 1 ) then
84 | sed -i '/CONFIG_XROE_FRAMER/d' ./project-spec/meta-user/recipes-kernel/linux/linux-xlnx/fragment1.cfg
85 | endif
86 |
87 | echo "xroe: Update init-ifupdown, this enables DHCP on the correct eth port"
88 | mkdir project-spec/meta-user/recipes-core
89 | mkdir project-spec/meta-user/recipes-core/init-ifupdown/
90 | cp ../../yocto-recipes/src-bb/init-ifupdown/init-ifupdown_%.bbappend ./project-spec/meta-user/recipes-core/init-ifupdown/init-ifupdown_%.bbappend
91 |
92 | echo 'IMAGE_INSTALL:append = " linuxptp"' >> ./project-spec/meta-user/conf/petalinuxbsp.conf
93 |
94 | echo "xroe: Update config files using PERL inline replace, provide scripting resource for test and development"
95 | perl -p -i -e 's/^# user packages.*\n\K/CONFIG_linuxptp=y\n/' ./project-spec/configs/rootfs_config
96 | #perl -p -i -e 's/^# CONFIG_python.*\n\K/CONFIG_python=y\n/' ./project-spec/configs/rootfs_config
97 | #perl -p -i -e 's/^# CONFIG_python-unittest.*\n\K/CONFIG_python-unittest=y\n/' ./project-spec/configs/rootfs_config
98 | perl -p -i -e 's/^# CONFIG_perl.*\n\K/CONFIG_perl=y\n/' ./project-spec/configs/rootfs_config
99 | perl -p -i -e 's/^# CONFIG_perl-lib.*\n\K/CONFIG_perl-lib=y\n/' ./project-spec/configs/rootfs_config
100 | perl -p -i -e 's/^# CONFIG_netcat.*\n\K/CONFIG_netcat=y\n/' ./project-spec/configs/rootfs_config
101 | perl -p -i -e 's/^# CONFIG_tcpdump.*\n\K/CONFIG_tcpdump=y\n/' ./project-spec/configs/rootfs_config
102 | #perl -p -i -e 's/^# CONFIG_python-argparse.*\n\K/CONFIG_python-argparse=y\n/' ./project-spec/configs/rootfs_config
103 | perl -p -i -e 's/^# CONFIG_git\s.*\n\K/CONFIG_git=y\n/' ./project-spec/configs/rootfs_config
104 |
105 | echo "xroe: Enable GCC & G++ on board. Allows easier development for simple C programs"
106 | perl -p -i -e 's/^# CONFIG_packagegroup-core-buildessential\s.*\n\K/CONFIG_packagegroup-core-buildessential=y\n/' ./project-spec/configs/rootfs_config
107 | perl -p -i -e 's/^# CONFIG_libgcc\s.*\n\K/CONFIG_libgcc=y\n/' ./project-spec/configs/rootfs_config
108 | perl -p -i -e 's/^# CONFIG_libgcc-dbg\s.*\n\K/CONFIG_libgcc-dbg=y\n/' ./project-spec/configs/rootfs_config
109 | perl -p -i -e 's/^# CONFIG_libgcc-dev\s.*\n\K/CONFIG_libgcc-dev=y\n/' ./project-spec/configs/rootfs_config
110 | perl -p -i -e 's/^# CONFIG_libstdcPLUSPLUS-dev\s.*\n\K/CONFIG_libstdcPLUSPLUS-dev=y\n/' ./project-spec/configs/rootfs_config
111 | perl -p -i -e 's/^# CONFIG_libstdcPLUSPLUS\s.*\n\K/CONFIG_libstdcPLUSPLUS=y\n/' ./project-spec/configs/rootfs_config
112 |
113 | echo "xroe: Enable peekpoke"
114 | perl -p -i -e 's/^# CONFIG_peekpoke.*\n\K/CONFIG_peekpoke=y\n/' ./project-spec/configs/rootfs_config
115 |
116 | echo "xroe: Use sysvint Init Manager"
117 | perl -p -i -e 's/^# CONFIG_Init-manager-sysvinit.*\n\K/CONFIG_Init-manager-sysvinit=y\n/' ./project-spec/configs/rootfs_config
118 | perl -p -i -e 's/^# CONFIG_Init-manager-systemd.*\n\K/CONFIG_Init-manager-systemd=n\n/' ./project-spec/configs/rootfs_config
119 |
120 | ##
121 | if ("$BOARD" == "zcu111") then
122 | echo "xroe: zcu111 support"
123 | perl -p -i -e 's/^.*CONFIG_SUBSYSTEM_MACHINE_NAME.*/CONFIG_SUBSYSTEM_MACHINE_NAME="zcu111-reva"/' ./project-spec/configs/config
124 | perl -p -i -e 's/^.*YOCTO_MACHINE_NAME.*/YOCTO_MACHINE_NAME="zcu111-zynqmp"/' ./project-spec/configs/config
125 | perl -p -i -e 's/^.*CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET.*/CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_zynqmp_virt_defconfig"/' ./project-spec/configs/config
126 | endif
127 |
128 | if ("$BOARD" == "zcu102") then
129 | echo "xroe: zcu102 support"
130 | perl -p -i -e 's/^.*CONFIG_SUBSYSTEM_MACHINE_NAME.*/CONFIG_SUBSYSTEM_MACHINE_NAME="zcu102-rev1.0"/' ./project-spec/configs/config
131 | perl -p -i -e 's/^.*YOCTO_MACHINE_NAME.*/YOCTO_MACHINE_NAME="zcu102-zynqmp"/' ./project-spec/configs/config
132 | perl -p -i -e 's/^.*CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET.*/CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET="xilinx_zynqmp_virt_defconfig"/' ./project-spec/configs/config
133 | endif
134 |
135 | echo "xroe: PL Config"
136 | petalinux-config --silentconfig
137 |
138 | echo "xroe: PL Build"
139 | petalinux-build
140 |
141 | echo "xroe: PL Package"
142 | petalinux-package --boot --fsbl --fpga --pmufw --u-boot --force
143 | #petalinux-package --wic --extra-bootfiles "ramdisk.cpio.gz.u-boot"
144 | #gzip -f images/linux/petalinux-sdimage.wic
145 |
146 | #echo "xroe: Create BSP one level up."
147 | #petalinux-package --bsp -p ./ --output ./../${BOARD}_${MODE}.bsp
148 |
149 | #echo "## Use internal build management using. Copies BOOT.bin/image.ub your home directory."
150 | #echo ""
151 | #echo "cp ../../image-management/buildSide/copyBoot ."
152 | #echo ""
153 | #echo "## To create a BSP"
154 | #echo ""
155 | #echo "petalinux-package --bsp -p ./ --output ../../bsp/2019.2/${BOARD}_${MODE}.bsp"
156 | #echo ""
157 |
--------------------------------------------------------------------------------
/src/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Debugging the application
3 | Compile the app only with the -verbose option to see where the executeable is being created.
4 | ```
5 | petalinux-build -c xroe-app -v -x compile
6 | ```
7 |
8 | Now you can scp it to the board once compiled. This results in the fastest development spin cycle.
9 | ```
10 | scp /tmp/om0_pl00-2019.09.16-13.46.47-qPL/work/aarch64-xilinx-linux/xroe-app/1.0-r0/xroe-app root@xxx.xxx.xxx.xxx/.
11 | ```
12 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/Makefile:
--------------------------------------------------------------------------------
1 | obj-m := framer.o
2 | framer-y := xroe_framer.o sysfs_xroe.o sysfs_xroe_framer_stats.o sysfs_xroe_framer_shared.o sysfs_xroe_framer_deframer.o sysfs_xroe_framer_cfg.o
3 |
4 | ccflags-y := -IInclude
5 |
6 | SRC := $(shell pwd)
7 |
8 | all:
9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC)
10 |
11 | modules_install:
12 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
13 |
14 | clean:
15 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
16 | rm -f Module.markers Module.symvers modules.order
17 | rm -rf .tmp_versions Modules.symvers
18 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/README.md:
--------------------------------------------------------------------------------
1 | Xilinx Radio over Ethernet Framer driver
2 | =========================================
3 |
4 | About the RoE Framer
5 |
6 | The "Radio Over Ethernet Framer" IP (roe_framer) ingests/generates Ethernet
7 | packet data, (de-)multiplexes packets based on protocol into/from various
8 | Radio Antenna data streams.
9 |
10 | It has 2 main, independent, data paths
11 |
12 | - Downlink, from the BaseBand to the Phone, Ethernet to Antenna,
13 | we call this the De-Framer path, or defm on all related IP signals.
14 |
15 | - Uplink, from the Phone to the BaseBand, Antenna to Ethernet,
16 | we call this the Framer path, or fram on all related IP signals.
17 |
18 | Key points:
19 |
20 | - Apart from the AXI4-Lite configuration port and a handful of strobe/control
21 | signals all data interfaces are AXI Stream(AXIS).
22 | - The IP does not contain an Ethernet MAC IP, rather it routes, or creates
23 | packets based on the direction through the roe_framer.
24 | - Currently designed to work with
25 | - 1, 2 or 4 10G Ethernet AXIS stream ports to/from 1, 2, 4, 8, 16,
26 | or 32 antenna ports
27 | Note: each Ethernet port is 64 bit data @ 156.25MHz
28 | - 1 or 2 25G Ethernet AXIS stream ports to/from 1, 2, 4, 8, 16,
29 | or 32 antenna ports
30 | Note: each Ethernet port is 64 bit data @ 390.25MHz
31 | - Contains a filter so that all non-protocol packets, or non-hardware-IP
32 | processed packets can be forwarded to another block for processing. In general
33 | this in a Microprocessor, specifically the Zynq ARM in our case. This filter
34 | function can move into the optional switch when TSN is used.
35 |
36 | About the Linux Driver
37 |
38 | The RoE Framer Linux Driver provides sysfs access to the framer controls. The
39 | loading of the driver to the hardware is possible using Device Tree binding
40 | (see "dt-binding.txt" for more information). When the driver is loaded, the
41 | general controls (such as framing mode, enable, restart etc) are exposed
42 | under /sys/kernel/xroe. Furthermore, specific controls can be found under
43 | /sys/kernel/xroe/framer. These include protocol-specific settings, for
44 | IPv4, IPv6 & UDP.
45 |
46 | There is also the option of accessing the framer's register map using
47 | ioctl calls for both reading and writing (where permitted) directly.
48 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/sysfs_xroe.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include "xroe_framer.h"
14 |
15 | #define XROE_RO_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
16 | struct xroe_reg_attribute attr_##_name = \
17 | { __ATTR(_name, 0444, xroe_reg_show, NULL), _reg_offset, _reg_mask, \
18 | _reg_addr}
19 | #define XROE_RW_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
20 | struct xroe_reg_attribute attr_##_name = \
21 | { __ATTR(_name, 0660, xroe_reg_show, xroe_reg_store), _reg_offset, \
22 | _reg_mask, _reg_addr}
23 |
24 | #define CFG_REG_ARRAY_SIZE 15
25 |
26 | /**
27 | * xroe_reg_show - The generic show function
28 | * @kobj: The kernel object of the entry
29 | * @attr: The attributes of the kernel object
30 | * @buff: The buffer containing the revision string
31 | *
32 | * Prints the requested register's content in hex. The address, offset & mask
33 | * of the register are passed to the function using the xroe_reg_attribute
34 | * struct, during the initialisation of each attribute. This is done using
35 | * container_of() at the beginning of the function
36 | *
37 | * Return: the number of characters printed
38 | */
39 | static ssize_t xroe_reg_show(struct kobject *kobj, struct kobj_attribute *attr,
40 | char *buff)
41 | {
42 | void __iomem *working_address;
43 | u32 buffer, read_value;
44 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
45 | struct xroe_reg_attribute, attr);
46 |
47 | working_address = (void __iomem *)(lp->base_addr +
48 | xroe_read_attr->addr);
49 | buffer = ioread32(working_address);
50 | read_value = (buffer & xroe_read_attr->mask) >> xroe_read_attr->offset;
51 |
52 | return sprintf(buff, "0x%x\n", read_value);
53 | }
54 |
55 | /**
56 | * xroe_reg_store - The generic store function
57 | * @kobj: The kernel object of the entry
58 | * @attr: The attributes of the kernel object
59 | * @buff: The buffer containing the revision string
60 | * @count: The number of characters typed by the user
61 | *
62 | * Stores the input value to the requested register.The address, offset & mask
63 | * of the register are passed to the function using the xroe_reg_attribute
64 | * struct, during the initialisation of each attribute. This is done using
65 | * container_of() at the beginning of the function. The input value is then
66 | * parsed in hex and the register writing takes places after that
67 | *
68 | * Return: the number of characters the user typed
69 | */
70 | static ssize_t xroe_reg_store(struct kobject *kobj, struct kobj_attribute *attr,
71 | const char *buff, size_t count)
72 | {
73 | int ret;
74 | u32 input_value;
75 | void __iomem *working_address;
76 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
77 | struct xroe_reg_attribute, attr);
78 |
79 | ret = kstrtouint(buff, CFG_REG_ARRAY_SIZE, &input_value);
80 | if (ret)
81 | return ret;
82 | working_address = (void __iomem *)(lp->base_addr +
83 | xroe_read_attr->addr);
84 | utils_write32withmask(working_address, input_value,
85 | xroe_read_attr->mask, xroe_read_attr->offset);
86 |
87 | return count;
88 | }
89 |
90 | static XROE_RO_REG_ATTR(version_major, CFG_MAJOR_REVISION_OFFSET,
91 | CFG_MAJOR_REVISION_MASK,
92 | CFG_MAJOR_REVISION_ADDR);
93 | static XROE_RO_REG_ATTR(version_minor, CFG_MINOR_REVISION_OFFSET,
94 | CFG_MINOR_REVISION_MASK,
95 | CFG_MINOR_REVISION_ADDR);
96 | static XROE_RO_REG_ATTR(version_revision, CFG_VERSION_REVISION_OFFSET,
97 | CFG_VERSION_REVISION_MASK,
98 | CFG_VERSION_REVISION_ADDR);
99 | static XROE_RW_REG_ATTR(enable, CFG_MASTER_INT_ENABLE_OFFSET,
100 | CFG_MASTER_INT_ENABLE_MASK,
101 | CFG_MASTER_INT_ENABLE_ADDR);
102 | static XROE_RW_REG_ATTR(framer_disable, FRAM_DISABLE_OFFSET,
103 | FRAM_DISABLE_MASK,
104 | FRAM_DISABLE_ADDR);
105 | static XROE_RW_REG_ATTR(deframer_disable, DEFM_DISABLE_OFFSET,
106 | DEFM_DISABLE_MASK,
107 | DEFM_DISABLE_ADDR);
108 | static XROE_RW_REG_ATTR(xxv_reset, CFG_USER_RW_OUT_OFFSET,
109 | CFG_USER_RW_OUT_MASK,
110 | CFG_USER_RW_OUT_ADDR);
111 | static XROE_RO_REG_ATTR(config_no_of_fram_ants, CFG_CONFIG_NO_OF_FRAM_ANTS_OFFSET,
112 | CFG_CONFIG_NO_OF_FRAM_ANTS_MASK,
113 | CFG_CONFIG_NO_OF_FRAM_ANTS_ADDR);
114 | static XROE_RO_REG_ATTR(config_no_of_defm_ants, CFG_CONFIG_NO_OF_DEFM_ANTS_OFFSET,
115 | CFG_CONFIG_NO_OF_DEFM_ANTS_MASK,
116 | CFG_CONFIG_NO_OF_DEFM_ANTS_ADDR);
117 | static XROE_RO_REG_ATTR(config_no_of_eth_ports, CFG_CONFIG_NO_OF_ETH_PORTS_OFFSET,
118 | CFG_CONFIG_NO_OF_ETH_PORTS_MASK,
119 | CFG_CONFIG_NO_OF_ETH_PORTS_ADDR);
120 | static XROE_RO_REG_ATTR(config_eth_speed, CFG_CONFIG_ETH_SPEED_OFFSET,
121 | CFG_CONFIG_ETH_SPEED_MASK,
122 | CFG_CONFIG_ETH_SPEED_ADDR);
123 | static XROE_RO_REG_ATTR(config_xran_support_mode, CFG_CONFIG_XRAN_SUPPORT_MODE_OFFSET,
124 | CFG_CONFIG_XRAN_SUPPORT_MODE_MASK,
125 | CFG_CONFIG_XRAN_SUPPORT_MODE_ADDR);
126 | static XROE_RO_REG_ATTR(config_xran_max_cc, CFG_CONFIG_XRAN_MAX_CC_OFFSET,
127 | CFG_CONFIG_XRAN_MAX_CC_MASK,
128 | CFG_CONFIG_XRAN_MAX_CC_ADDR);
129 | static XROE_RO_REG_ATTR(config_xran_max_dl_symbols, CFG_CONFIG_XRAN_MAX_DL_SYMBOLS_OFFSET,
130 | CFG_CONFIG_XRAN_MAX_DL_SYMBOLS_MASK,
131 | CFG_CONFIG_XRAN_MAX_DL_SYMBOLS_ADDR);
132 |
133 | static struct attribute *main_attrs[] = {
134 | &attr_version_major.attr.attr,
135 | &attr_version_minor.attr.attr,
136 | &attr_version_revision.attr.attr,
137 | &attr_enable.attr.attr,
138 | &attr_framer_disable.attr.attr,
139 | &attr_deframer_disable.attr.attr,
140 | &attr_xxv_reset.attr.attr,
141 | &attr_config_no_of_fram_ants.attr.attr,
142 | &attr_config_no_of_defm_ants.attr.attr,
143 | &attr_config_no_of_eth_ports.attr.attr,
144 | &attr_config_eth_speed.attr.attr,
145 | &attr_config_xran_support_mode.attr.attr,
146 | &attr_config_xran_max_cc.attr.attr,
147 | &attr_config_xran_max_dl_symbols.attr.attr,
148 | NULL,
149 | };
150 | ATTRIBUTE_GROUPS(main);
151 |
152 | struct kobject *root_xroe_kobj;
153 |
154 | /**
155 | * xroe_sysfs_init - Creates the xroe sysfs directory and entries
156 | *
157 | * Return: 0 on success, negative value in case of failure to
158 | * create the sysfs group
159 | *
160 | * Creates the xroe sysfs directory and entries, as well as the
161 | * subdirectories for deframer, cfg etc
162 | */
163 | int xroe_sysfs_init(void)
164 | {
165 | int ret;
166 |
167 | root_xroe_kobj = kobject_create_and_add("xroe", kernel_kobj);
168 | if (!root_xroe_kobj)
169 | return -ENOMEM;
170 | ret = sysfs_create_group(root_xroe_kobj, *main_groups);
171 | if (ret)
172 | kobject_put(root_xroe_kobj);
173 | ret = xroe_sysfs_stats_init();
174 | if (ret)
175 | return ret;
176 | ret = xroe_sysfs_shared_init();
177 | if (ret)
178 | return ret;
179 | ret = xroe_sysfs_defm_init();
180 | if (ret)
181 | return ret;
182 | ret = xroe_sysfs_cfg_init();
183 | return ret;
184 | }
185 |
186 | /**
187 | * xroe_sysfs_exit - Deletes the xroe sysfs directory and entries
188 | *
189 | * Deletes the xroe sysfs directory and entries
190 | *
191 | */
192 | void xroe_sysfs_exit(void)
193 | {
194 | kobject_del(root_xroe_kobj);
195 | }
196 |
197 | /**
198 | * utils_write32withmask - Writes a masked 32-bit value
199 | * @working_address: The starting address to write
200 | * @value: The value to be written
201 | * @mask: The mask to be used
202 | * @offset: The offset from the provided starting address
203 | *
204 | * Writes a 32-bit value to the provided address with the input mask
205 | *
206 | * Return: 0 on success
207 | */
208 | int utils_write32withmask(void __iomem *working_address, u32 value,
209 | u32 mask, u32 offset)
210 | {
211 | u32 read_register_value = 0;
212 | u32 register_value_to_write = 0;
213 | u32 delta = 0, buffer = 0;
214 |
215 | read_register_value = ioread32(working_address);
216 | buffer = (value << offset);
217 | register_value_to_write = read_register_value & ~mask;
218 | delta = buffer & mask;
219 | register_value_to_write |= delta;
220 | iowrite32(register_value_to_write, working_address);
221 | return 0;
222 | }
223 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/sysfs_xroe_framer_cfg.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include "xroe_framer.h"
15 |
16 | #define XROE_RO_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
17 | struct xroe_reg_attribute attr_##_name = \
18 | { __ATTR(_name, 0444, xroe_reg_show, NULL), _reg_offset, _reg_mask, \
19 | _reg_addr}
20 |
21 | #define XROE_RW_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
22 | struct xroe_reg_attribute attr_##_name = \
23 | { __ATTR(_name, 0660, xroe_reg_show, xroe_reg_store), _reg_offset, \
24 | _reg_mask, _reg_addr}
25 |
26 | /**
27 | * xroe_reg_show - The generic show function
28 | * @kobj: The kernel object of the entry
29 | * @attr: The attributes of the kernel object
30 | * @buff: The buffer containing the revision string
31 | *
32 | * Prints the requested register's content in hex. The address, offset & mask
33 | * of the register are passed to the function using the xroe_reg_attribute
34 | * struct, during the initialisation of each attribute. This is done using
35 | * container_of() at the beginning of the function
36 | *
37 | * Return: the number of characters printed
38 | */
39 | static ssize_t xroe_reg_show(struct kobject *kobj, struct kobj_attribute *attr,
40 | char *buff)
41 | {
42 | int cc_number = 0;
43 | int ret;
44 | void __iomem *working_address;
45 | u32 buffer, read_value;
46 | char *current_path = NULL;
47 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
48 | struct xroe_reg_attribute, attr);
49 |
50 | current_path = kobject_get_path(kobj, GFP_KERNEL);
51 | ret = sscanf(current_path, "/kernel/xroe/oran/cfg/cc_%d/", &cc_number);
52 | if (ret < 0)
53 | return ret;
54 | working_address = (void __iomem *)(lp->base_addr +
55 | (xroe_read_attr->addr + (ADDR_LOOP_OFFSET_CC * cc_number)));
56 |
57 | buffer = ioread32(working_address);
58 | read_value = (buffer & xroe_read_attr->mask) >> xroe_read_attr->offset;
59 |
60 | return sprintf(buff, "0x%x\n", read_value);
61 | }
62 |
63 | /**
64 | * xroe_reg_store - The generic store function
65 | * @kobj: The kernel object of the entry
66 | * @attr: The attributes of the kernel object
67 | * @buff: The buffer containing the revision string
68 | * @count: The number of characters typed by the user
69 | *
70 | * Stores the input value to the requested register.The address, offset & mask
71 | * of the register are passed to the function using the xroe_reg_attribute
72 | * struct, during the initialisation of each attribute. This is done using
73 | * container_of() at the beginning of the function. The input value is then
74 | * parsed in hex and the register writing takes places after that
75 | *
76 | * Return: the number of characters the user typed
77 | */
78 | static ssize_t xroe_reg_store(struct kobject *kobj, struct kobj_attribute *attr,
79 | const char *buff, size_t count)
80 | {
81 | int ret;
82 | u32 input_value;
83 | void __iomem *working_address;
84 | int cc_number = 0;
85 | char *current_path = NULL;
86 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
87 | struct xroe_reg_attribute, attr);
88 |
89 | ret = kstrtouint(buff, 16, &input_value);
90 | if (ret)
91 | return ret;
92 | current_path = kobject_get_path(kobj, GFP_KERNEL);
93 | ret = sscanf(current_path, "/kernel/xroe/oran/cfg/cc_%d/", &cc_number);
94 | if (ret < 0)
95 | return ret;
96 | working_address = (void __iomem *)(lp->base_addr +
97 | (xroe_read_attr->addr + (ADDR_LOOP_OFFSET_CC * cc_number)));
98 | utils_write32withmask(working_address, input_value,
99 | xroe_read_attr->mask, xroe_read_attr->offset);
100 |
101 | return count;
102 | }
103 |
104 | static XROE_RW_REG_ATTR(enable, ORAN_CC_ENABLE_OFFSET,
105 | ORAN_CC_ENABLE_MASK,
106 | ORAN_CC_ENABLE_ADDR);
107 | static XROE_RW_REG_ATTR(numerology, ORAN_CC_NUMEROLOGY_OFFSET,
108 | ORAN_CC_NUMEROLOGY_MASK,
109 | ORAN_CC_NUMEROLOGY_ADDR);
110 | static XROE_RW_REG_ATTR(numrbs, ORAN_CC_NUMRBS_OFFSET,
111 | ORAN_CC_NUMRBS_MASK,
112 | ORAN_CC_NUMRBS_ADDR);
113 | static XROE_RW_REG_ATTR(reload, ORAN_CC_RELOAD_OFFSET,
114 | ORAN_CC_RELOAD_MASK,
115 | ORAN_CC_RELOAD_ADDR);
116 | static XROE_RW_REG_ATTR(dl_ctrl_offsets, ORAN_CC_DL_CTRL_OFFSETS_OFFSET,
117 | ORAN_CC_DL_CTRL_OFFSETS_MASK,
118 | ORAN_CC_DL_CTRL_OFFSETS_ADDR);
119 | static XROE_RW_REG_ATTR(dl_ctrl_unrolled_offsets,
120 | ORAN_CC_DL_CTRL_UNROLLED_OFFSETS_OFFSET,
121 | ORAN_CC_DL_CTRL_UNROLLED_OFFSETS_MASK,
122 | ORAN_CC_DL_CTRL_UNROLLED_OFFSETS_ADDR);
123 | static XROE_RW_REG_ATTR(ul_ctrl_offsets, ORAN_CC_UL_CTRL_OFFSETS_OFFSET,
124 | ORAN_CC_UL_CTRL_OFFSETS_MASK,
125 | ORAN_CC_UL_CTRL_OFFSETS_ADDR);
126 | static XROE_RW_REG_ATTR(ul_ctrl_unrolled_offsets,
127 | ORAN_CC_UL_CTRL_UNROLLED_OFFSETS_OFFSET,
128 | ORAN_CC_UL_CTRL_UNROLLED_OFFSETS_MASK,
129 | ORAN_CC_UL_CTRL_UNROLLED_OFFSETS_ADDR);
130 | static XROE_RW_REG_ATTR(dl_data_sym_start_index,
131 | ORAN_CC_DL_DATA_SYM_START_INDEX_OFFSET,
132 | ORAN_CC_DL_DATA_SYM_START_INDEX_MASK,
133 | ORAN_CC_DL_DATA_SYM_START_INDEX_ADDR);
134 | static XROE_RW_REG_ATTR(dl_data_sym_num_index,
135 | ORAN_CC_DL_DATA_SYM_NUM_INDEX_OFFSET,
136 | ORAN_CC_DL_DATA_SYM_NUM_INDEX_MASK,
137 | ORAN_CC_DL_DATA_SYM_NUM_INDEX_ADDR);
138 | static XROE_RW_REG_ATTR(ul_ud_iq_width, ORAN_CC_UL_UD_IQ_WIDTH_OFFSET,
139 | ORAN_CC_UL_UD_IQ_WIDTH_MASK,
140 | ORAN_CC_UL_UD_IQ_WIDTH_ADDR);
141 | static XROE_RW_REG_ATTR(ul_ud_comp_meth, ORAN_CC_UL_UD_COMP_METH_OFFSET,
142 | ORAN_CC_UL_UD_COMP_METH_MASK,
143 | ORAN_CC_UL_UD_COMP_METH_ADDR);
144 | static XROE_RW_REG_ATTR(ul_mplane_udcomp_param,
145 | ORAN_CC_UL_MPLANE_UDCOMP_PARAM_OFFSET,
146 | ORAN_CC_UL_MPLANE_UDCOMP_PARAM_MASK,
147 | ORAN_CC_UL_MPLANE_UDCOMP_PARAM_ADDR);
148 | static XROE_RW_REG_ATTR(dl_ud_iq_width, ORAN_CC_DL_UD_IQ_WIDTH_OFFSET,
149 | ORAN_CC_DL_UD_IQ_WIDTH_MASK,
150 | ORAN_CC_DL_UD_IQ_WIDTH_ADDR);
151 | static XROE_RW_REG_ATTR(dl_ud_comp_meth, ORAN_CC_DL_UD_COMP_METH_OFFSET,
152 | ORAN_CC_DL_UD_COMP_METH_MASK,
153 | ORAN_CC_DL_UD_COMP_METH_ADDR);
154 | static XROE_RW_REG_ATTR(dl_mplane_udcomp_param,
155 | ORAN_CC_DL_MPLANE_UDCOMP_PARAM_OFFSET,
156 | ORAN_CC_DL_MPLANE_UDCOMP_PARAM_MASK,
157 | ORAN_CC_DL_MPLANE_UDCOMP_PARAM_ADDR);
158 |
159 | static struct attribute *cc_attrs[] = {
160 | &attr_enable.attr.attr,
161 | &attr_numerology.attr.attr,
162 | &attr_numrbs.attr.attr,
163 | &attr_reload.attr.attr,
164 | &attr_dl_ctrl_offsets.attr.attr,
165 | &attr_dl_ctrl_unrolled_offsets.attr.attr,
166 | &attr_ul_ctrl_offsets.attr.attr,
167 | &attr_ul_ctrl_unrolled_offsets.attr.attr,
168 | &attr_dl_data_sym_start_index.attr.attr,
169 | &attr_dl_data_sym_num_index.attr.attr,
170 | &attr_ul_ud_iq_width.attr.attr,
171 | &attr_ul_ud_comp_meth.attr.attr,
172 | &attr_ul_mplane_udcomp_param.attr.attr,
173 | &attr_dl_ud_iq_width.attr.attr,
174 | &attr_dl_ud_comp_meth.attr.attr,
175 | &attr_dl_mplane_udcomp_param.attr.attr,
176 | NULL,
177 | };
178 | ATTRIBUTE_GROUPS(cc);
179 |
180 | /**
181 | * xroe_sysfs_cfg_init - Creates the "cfg" sysfs directory and entries
182 | *
183 | * Return: 0 on success, negative value in case of failure to
184 | * create the sysfs group
185 | *
186 | * Creates the "cfg" sysfs directory and entries, as well as the cc_#
187 | * subdirectories
188 | */
189 | int xroe_sysfs_cfg_init(void)
190 | {
191 | int ret;
192 | int i;
193 | char cc_dir_name[5];
194 | struct kobject *kobj_dir_cfg;
195 | struct kobject *kobj_dir_oran;
196 | struct kobject *kobj_cc[MAX_NUM_ORAN_CC];
197 |
198 | kobj_dir_oran = kobject_create_and_add("oran", root_xroe_kobj);
199 | if (!kobj_dir_oran)
200 | return -ENOMEM;
201 |
202 | kobj_dir_cfg = kobject_create_and_add("cfg", kobj_dir_oran);
203 | if (!kobj_dir_cfg)
204 | return -ENOMEM;
205 | for (i = 0; i < MAX_NUM_ORAN_CC; i++) {
206 | snprintf(cc_dir_name, sizeof(cc_dir_name),
207 | "cc_%d", i);
208 | kobj_cc[i] = kobject_create_and_add(cc_dir_name, kobj_dir_cfg);
209 | if (!kobj_cc[i])
210 | return -ENOMEM;
211 | ret = sysfs_create_group(kobj_cc[i], *cc_groups);
212 | if (ret)
213 | kobject_put(kobj_cc[i]);
214 | }
215 |
216 | return ret;
217 | }
218 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/sysfs_xroe_framer_shared.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2019 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include "xroe_framer.h"
15 |
16 | #define XROE_RO_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
17 | struct xroe_reg_attribute attr_##_name = \
18 | { __ATTR(_name, 0444, xroe_reg_show, NULL), _reg_offset, _reg_mask, \
19 | _reg_addr}
20 | #define XROE_RW_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
21 | struct xroe_reg_attribute attr_##_name = \
22 | { __ATTR(_name, 0660, xroe_reg_show, xroe_reg_store), _reg_offset, \
23 | _reg_mask, _reg_addr}
24 |
25 | /**
26 | * xroe_reg_show - The generic show function for shared entries
27 | * @kobj: The kernel object of the entry
28 | * @attr: The attributes of the kernel object
29 | * @buff: The buffer containing the revision string
30 | *
31 | * Prints the requested register's content in hex. The address, offset & mask
32 | * of the register are passed to the function using the xroe_reg_attribute
33 | * struct, during the initialisation of each attribute. This is done using
34 | * container_of() at the beginning of the function. To determine the current
35 | * eth port, sscanf is used on the current path. The port number is taken into
36 | * account when calculating the working address, and the normal "show" procedure
37 | * continues after that
38 | *
39 | * Return: the number of characters printed
40 | */
41 | static ssize_t xroe_reg_show(struct kobject *kobj, struct kobj_attribute *attr,
42 | char *buff)
43 | {
44 | int port = 0;
45 | int ret;
46 | void __iomem *working_address;
47 | u32 buffer, read_value;
48 | char *current_path = NULL;
49 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
50 | struct xroe_reg_attribute, attr);
51 |
52 | current_path = kobject_get_path(kobj, GFP_KERNEL);
53 | ret = sscanf(current_path, "/kernel/xroe/shared/dl_data_ptr_%d/", &port);
54 | if (ret < 0)
55 | return ret;
56 | working_address = (void __iomem *)(lp->base_addr +
57 | (xroe_read_attr->addr + (ADDR_LOOP_OFFSET_DL_DATA_PTR * port)));
58 | buffer = ioread32(working_address);
59 | read_value = (buffer & xroe_read_attr->mask) >> xroe_read_attr->offset;
60 |
61 | return sprintf(buff, "0x%x\n", read_value);
62 | }
63 |
64 |
65 | /**
66 | * xroe_reg_store - The generic store function
67 | * @kobj: The kernel object of the entry
68 | * @attr: The attributes of the kernel object
69 | * @buff: The buffer containing the revision string
70 | * @count: The number of characters typed by the user
71 | *
72 | * Stores the input value to the requested register.The address, offset & mask
73 | * of the register are passed to the function using the xroe_reg_attribute
74 | * struct, during the initialisation of each attribute. This is done using
75 | * container_of() at the beginning of the function. The input value is then
76 | * parsed in hex and the register writing takes places after that
77 | *
78 | * Return: the number of characters the user typed
79 | */
80 | static ssize_t xroe_reg_store(struct kobject *kobj, struct kobj_attribute *attr,
81 | const char *buff, size_t count)
82 | {
83 | int ret;
84 | u32 input_value;
85 | void __iomem *working_address;
86 | int port = 0;
87 | char *current_path = NULL;
88 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
89 | struct xroe_reg_attribute, attr);
90 |
91 | ret = kstrtouint(buff, 16, &input_value);
92 | if (ret)
93 | return ret;
94 | current_path = kobject_get_path(kobj, GFP_KERNEL);
95 | ret = sscanf(current_path,
96 | "/kernel/xroe/shared/dl_data_ptr_%d/",
97 | &port);
98 | if (ret < 0)
99 | return ret;
100 | working_address = (void __iomem *)(lp->base_addr +
101 | (xroe_read_attr->addr + (ADDR_LOOP_OFFSET_DL_DATA_PTR * port)));
102 |
103 | utils_write32withmask(working_address, input_value,
104 | xroe_read_attr->mask, xroe_read_attr->offset);
105 |
106 | return count;
107 | }
108 |
109 | /* Add registers
110 | */
111 | static XROE_RW_REG_ATTR(cc_dl_data_unroll_offset,
112 | ORAN_CC_DL_DATA_UNROLL_OFFSET_OFFSET,
113 | ORAN_CC_DL_DATA_UNROLL_OFFSET_MASK,
114 | ORAN_CC_DL_DATA_UNROLL_OFFSET_ADDR);
115 |
116 | static struct attribute *shared_attrs[] = {
117 | &attr_cc_dl_data_unroll_offset.attr.attr,
118 | NULL,
119 | };
120 | ATTRIBUTE_GROUPS(shared);
121 |
122 | /**
123 | * xroe_sysfs_shared_init - Creates the xroe sysfs "shared" subdirectory & entries
124 | *
125 | * Return: 0 on success, negative value in case of failure to
126 | * create the sysfs group
127 | *
128 | * Creates the xroe sysfs "shared" subdirectory and entries under "xroe"
129 | */
130 | int xroe_sysfs_shared_init(void)
131 | {
132 | int ret;
133 | int i;
134 | char shared_dir_name[15];
135 | struct kobject *kobj_dir_shared;
136 | struct kobject *kobj_dir_shared_mem[MAX_NUM_ORAN_DL_DATA_PTR];
137 |
138 | kobj_dir_shared = kobject_create_and_add("shared", root_xroe_kobj);
139 | if (!kobj_dir_shared)
140 | return -ENOMEM;
141 | for (i = 0; i < MAX_NUM_ORAN_DL_DATA_PTR; i++) {
142 | snprintf(shared_dir_name, sizeof(shared_dir_name),
143 | "dl_data_ptr_%d", i);
144 | kobj_dir_shared_mem[i] =
145 | kobject_create_and_add(shared_dir_name, kobj_dir_shared);
146 | if (!kobj_dir_shared_mem[i])
147 | return -ENOMEM;
148 | ret = sysfs_create_group(kobj_dir_shared_mem[i], *shared_groups);
149 | if (ret)
150 | kobject_put(kobj_dir_shared_mem[i]);
151 | }
152 |
153 | return ret;
154 | }
155 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/sysfs_xroe_framer_stats.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2019 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include "xroe_framer.h"
15 |
16 | #define XROE_RO_REG_ATTR(_name, _reg_offset, _reg_mask, _reg_addr) \
17 | struct xroe_reg_attribute attr_##_name = \
18 | { __ATTR(_name, 0444, xroe_reg_show, NULL), _reg_offset, _reg_mask, \
19 | _reg_addr}
20 |
21 | /**
22 | * xroe_reg_show - The generic show function for stats entries
23 | * @kobj: The kernel object of the entry
24 | * @attr: The attributes of the kernel object
25 | * @buff: The buffer containing the revision string
26 | *
27 | * Prints the requested register's content in hex. The address, offset & mask
28 | * of the register are passed to the function using the xroe_reg_attribute
29 | * struct, during the initialisation of each attribute. This is done using
30 | * container_of() at the beginning of the function. To determine the current
31 | * eth port, sscanf is used on the current path. The port number is taken into
32 | * account when calculating the working address, and the normal "show" procedure
33 | * continues after that
34 | *
35 | * Return: the number of characters printed
36 | */
37 | static ssize_t xroe_reg_show(struct kobject *kobj, struct kobj_attribute *attr,
38 | char *buff)
39 | {
40 | int port = 0;
41 | int ret;
42 | void __iomem *working_address;
43 | u32 buffer, read_value;
44 | char *current_path = NULL;
45 | struct xroe_reg_attribute *xroe_read_attr = container_of(attr,
46 | struct xroe_reg_attribute, attr);
47 |
48 | current_path = kobject_get_path(kobj, GFP_KERNEL);
49 | ret = sscanf(current_path, "/kernel/xroe/stats/eth_port_%d/", &port);
50 | if (ret < 0)
51 | return ret;
52 | working_address = (void __iomem *)(lp->base_addr +
53 | (xroe_read_attr->addr + (ADDR_LOOP_OFFSET_STATS * port)));
54 | buffer = ioread32(working_address);
55 | read_value = (buffer & xroe_read_attr->mask) >> xroe_read_attr->offset;
56 |
57 | return sprintf(buff, "0x%x\n", read_value);
58 | }
59 |
60 | static XROE_RO_REG_ATTR(total_rx_good_pkt,
61 | STATS_ETH_STATS_TOTAL_RX_GOOD_PKT_CNT_OFFSET,
62 | STATS_ETH_STATS_TOTAL_RX_GOOD_PKT_CNT_MASK,
63 | STATS_ETH_STATS_TOTAL_RX_GOOD_PKT_CNT_ADDR);
64 | static XROE_RO_REG_ATTR(total_rx_bad_pkt,
65 | STATS_ETH_STATS_TOTAL_RX_BAD_PKT_CNT_OFFSET,
66 | STATS_ETH_STATS_TOTAL_RX_BAD_PKT_CNT_MASK,
67 | STATS_ETH_STATS_TOTAL_RX_BAD_PKT_CNT_ADDR);
68 | static XROE_RO_REG_ATTR(total_rx_bad_fcs,
69 | STATS_ETH_STATS_TOTAL_RX_BAD_FCS_CNT_OFFSET,
70 | STATS_ETH_STATS_TOTAL_RX_BAD_FCS_CNT_MASK,
71 | STATS_ETH_STATS_TOTAL_RX_BAD_FCS_CNT_ADDR);
72 | static XROE_RO_REG_ATTR(total_rx_user_pkt,
73 | STATS_ETH_STATS_USER_DATA_RX_PACKETS_CNT_OFFSET,
74 | STATS_ETH_STATS_USER_DATA_RX_PACKETS_CNT_MASK,
75 | STATS_ETH_STATS_USER_DATA_RX_PACKETS_CNT_ADDR);
76 | static XROE_RO_REG_ATTR(total_rx_good_user_pkt,
77 | STATS_ETH_STATS_USER_DATA_RX_GOOD_PKT_CNT_OFFSET,
78 | STATS_ETH_STATS_USER_DATA_RX_GOOD_PKT_CNT_MASK,
79 | STATS_ETH_STATS_USER_DATA_RX_GOOD_PKT_CNT_ADDR);
80 | static XROE_RO_REG_ATTR(total_rx_bad_user_pkt,
81 | STATS_ETH_STATS_USER_DATA_RX_BAD_PKT_CNT_OFFSET,
82 | STATS_ETH_STATS_USER_DATA_RX_BAD_PKT_CNT_MASK,
83 | STATS_ETH_STATS_USER_DATA_RX_BAD_PKT_CNT_ADDR);
84 | static XROE_RO_REG_ATTR(total_rx_bad_user_fcs,
85 | STATS_ETH_STATS_USER_DATA_RX_BAD_FCS_CNT_OFFSET,
86 | STATS_ETH_STATS_USER_DATA_RX_BAD_FCS_CNT_MASK,
87 | STATS_ETH_STATS_USER_DATA_RX_BAD_FCS_CNT_ADDR);
88 | static XROE_RO_REG_ATTR(total_rx_user_ctrl_pkt,
89 | STATS_ETH_STATS_USER_CTRL_RX_PACKETS_CNT_OFFSET,
90 | STATS_ETH_STATS_USER_CTRL_RX_PACKETS_CNT_MASK,
91 | STATS_ETH_STATS_USER_CTRL_RX_PACKETS_CNT_ADDR);
92 | static XROE_RO_REG_ATTR(total_rx_good_user_ctrl_pkt,
93 | STATS_ETH_STATS_USER_CTRL_RX_GOOD_PKT_CNT_OFFSET,
94 | STATS_ETH_STATS_USER_CTRL_RX_GOOD_PKT_CNT_MASK,
95 | STATS_ETH_STATS_USER_CTRL_RX_GOOD_PKT_CNT_ADDR);
96 | static XROE_RO_REG_ATTR(total_rx_bad_user_ctrl_pkt,
97 | STATS_ETH_STATS_USER_CTRL_RX_BAD_PKT_CNT_OFFSET,
98 | STATS_ETH_STATS_USER_CTRL_RX_BAD_PKT_CNT_MASK,
99 | STATS_ETH_STATS_USER_CTRL_RX_BAD_PKT_CNT_ADDR);
100 | static XROE_RO_REG_ATTR(total_rx_bad_user_ctrl_fcs,
101 | STATS_ETH_STATS_USER_CTRL_RX_BAD_FCS_CNT_OFFSET,
102 | STATS_ETH_STATS_USER_CTRL_RX_BAD_FCS_CNT_MASK,
103 | STATS_ETH_STATS_USER_CTRL_RX_BAD_FCS_CNT_ADDR);
104 | static XROE_RO_REG_ATTR(rx_user_pkt_rate,
105 | STATS_ETH_STATS_USER_DATA_RX_PKTS_RATE_OFFSET,
106 | STATS_ETH_STATS_USER_DATA_RX_PKTS_RATE_MASK,
107 | STATS_ETH_STATS_USER_DATA_RX_PKTS_RATE_ADDR);
108 | static XROE_RO_REG_ATTR(rx_user_ctrl_pkt_rate,
109 | STATS_ETH_STATS_USER_CTRL_RX_PKTS_RATE_OFFSET,
110 | STATS_ETH_STATS_USER_CTRL_RX_PKTS_RATE_MASK,
111 | STATS_ETH_STATS_USER_CTRL_RX_PKTS_RATE_ADDR);
112 |
113 | static struct attribute *stats_attrs[] = {
114 | &attr_total_rx_good_pkt.attr.attr,
115 | &attr_total_rx_bad_pkt.attr.attr,
116 | &attr_total_rx_bad_fcs.attr.attr,
117 | &attr_total_rx_user_pkt.attr.attr,
118 | &attr_total_rx_good_user_pkt.attr.attr,
119 | &attr_total_rx_bad_user_pkt.attr.attr,
120 | &attr_total_rx_bad_user_fcs.attr.attr,
121 | &attr_total_rx_user_ctrl_pkt.attr.attr,
122 | &attr_total_rx_good_user_ctrl_pkt.attr.attr,
123 | &attr_total_rx_bad_user_ctrl_pkt.attr.attr,
124 | &attr_total_rx_bad_user_ctrl_fcs.attr.attr,
125 | &attr_rx_user_pkt_rate.attr.attr,
126 | &attr_rx_user_ctrl_pkt_rate.attr.attr,
127 | NULL,
128 | };
129 | ATTRIBUTE_GROUPS(stats);
130 |
131 | /**
132 | * xroe_sysfs_stats_init - Creates the xroe sysfs "stats" subdirectory & entries
133 | *
134 | * Return: 0 on success, negative value in case of failure to
135 | * create the sysfs group
136 | *
137 | * Creates the xroe sysfs "stats" subdirectory and entries under "xroe"
138 | */
139 | int xroe_sysfs_stats_init(void)
140 | {
141 | int ret;
142 | int i;
143 | char eth_port_dir_name[11];
144 | struct kobject *kobj_dir_stats;
145 | struct kobject *kobj_dir_eth_ports[MAX_NUM_ETH_PORTS];
146 |
147 | kobj_dir_stats = kobject_create_and_add("stats", root_xroe_kobj);
148 | if (!kobj_dir_stats)
149 | return -ENOMEM;
150 | for (i = 0; i < MAX_NUM_ETH_PORTS; i++) {
151 | snprintf(eth_port_dir_name, sizeof(eth_port_dir_name),
152 | "eth_port_%d", i);
153 | kobj_dir_eth_ports[i] =
154 | kobject_create_and_add(eth_port_dir_name, kobj_dir_stats);
155 | if (!kobj_dir_eth_ports[i])
156 | return -ENOMEM;
157 | ret = sysfs_create_group(kobj_dir_eth_ports[i], *stats_groups);
158 | if (ret)
159 | kobject_put(kobj_dir_eth_ports[i]);
160 | }
161 |
162 | return ret;
163 | }
164 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/xroe_framer.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include "xroe_framer.h"
22 |
23 | #define DRIVER_NAME "framer"
24 |
25 | /*
26 | * TODO: to be made static as well, so that multiple instances can be used. As
27 | * of now, the "lp" structure is shared among the multiple source files
28 | */
29 | struct framer_local *lp;
30 | static struct platform_driver framer_driver;
31 | /*
32 | * TODO: placeholder for the IRQ once it's been implemented
33 | * in the framer block
34 | */
35 | static irqreturn_t framer_irq(int irq, void *lp)
36 | {
37 | return IRQ_HANDLED;
38 | }
39 |
40 | /**
41 | * framer_probe - Probes the device tree to locate the framer block
42 | * @pdev: The structure containing the device's details
43 | *
44 | * Probes the device tree to locate the framer block and maps it to
45 | * the kernel virtual memory space
46 | *
47 | * Return: 0 on success or a negative errno on error.
48 | */
49 | static int framer_probe(struct platform_device *pdev)
50 | {
51 | struct resource *r_mem; /* IO mem resources */
52 | struct resource *r_irq;
53 | struct device *dev = &pdev->dev;
54 | int rc = 0;
55 |
56 | dev_dbg(dev, "Device Tree Probing\n");
57 | lp = devm_kzalloc(&pdev->dev, sizeof(*lp), GFP_KERNEL);
58 | if (!lp)
59 | return -ENOMEM;
60 |
61 | /* Get iospace for the device */
62 | r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
63 | lp->base_addr = devm_ioremap_resource(&pdev->dev, r_mem);
64 | if (IS_ERR(lp->base_addr))
65 | return PTR_ERR(lp->base_addr);
66 |
67 | dev_set_drvdata(dev, lp);
68 | xroe_sysfs_init();
69 | /* Get IRQ for the device */
70 | /*
71 | * TODO: No IRQ *yet* in the DT from the framer block, as it's still
72 | * under development. To be added once it's in the block, and also
73 | * replace with platform_get_irq_byname()
74 | */
75 | r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
76 | if (IS_ERR(r_irq)) {
77 | dev_info(dev, "no IRQ found\n");
78 | /*
79 | * TODO: Return non-zero (error) code on no IRQ found.
80 | * To be implemented once the IRQ is in the block
81 | */
82 | return 0;
83 | }
84 | rc = devm_request_irq(dev, lp->irq, &framer_irq, 0, DRIVER_NAME, lp);
85 | if (rc) {
86 | dev_err(dev, "testmodule: Could not allocate interrupt %d.\n",
87 | lp->irq);
88 | /*
89 | * TODO: Return non-zero (error) code on no IRQ found.
90 | * To be implemented once the IRQ is in the block
91 | */
92 | return 0;
93 | }
94 |
95 | return rc;
96 | }
97 |
98 | /**
99 | * framer_init - Registers the driver
100 | *
101 | * Return: 0 on success, -1 on allocation error
102 | *
103 | * Registers the framer driver and creates character device drivers
104 | * for the whole block, as well as separate ones for stats and
105 | * radio control.
106 | */
107 | static int __init framer_init(void)
108 | {
109 | int ret;
110 |
111 | pr_debug("XROE framer driver init\n");
112 |
113 | ret = platform_driver_register(&framer_driver);
114 |
115 | return ret;
116 | }
117 |
118 | /**
119 | * framer_exit - Destroys the driver
120 | *
121 | * Unregisters the framer driver and destroys the character
122 | * device driver for the whole block, as well as the separate ones
123 | * for stats and radio control. Returns 0 upon successful execution
124 | */
125 | static void __exit framer_exit(void)
126 | {
127 | xroe_sysfs_exit();
128 | platform_driver_unregister(&framer_driver);
129 | pr_info("XROE Framer exit\n");
130 | }
131 |
132 | module_init(framer_init);
133 | module_exit(framer_exit);
134 |
135 | static const struct of_device_id framer_of_match[] = {
136 | { .compatible = "xlnx,roe-framer-2.0", },
137 | { /* end of list */ },
138 | };
139 | MODULE_DEVICE_TABLE(of, framer_of_match);
140 |
141 | static struct platform_driver framer_driver = {
142 | .driver = {
143 | /*
144 | * TODO: .name shouldn't be necessary, though removing
145 | * it results in kernel panic. To investigate further
146 | */
147 | .name = DRIVER_NAME,
148 | .of_match_table = framer_of_match,
149 | },
150 | .probe = framer_probe,
151 | };
152 |
153 | MODULE_LICENSE("GPL v2");
154 | MODULE_AUTHOR("Xilinx Inc.");
155 | MODULE_DESCRIPTION("framer - Xilinx Radio over Ethernet Framer driver");
156 |
--------------------------------------------------------------------------------
/src/local-staging/xroeframer-driver/xroe_framer.h:
--------------------------------------------------------------------------------
1 | /* SPDX-License-Identifier: GPL-2.0 */
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 | #include "roe_framer_ctrl.h"
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include /* S_IRUSR, S_IWUSR */
27 |
28 | /* TODO: Remove hardcoded value of number of Ethernet ports and read the value
29 | * from the device tree.
30 | * For now user must modify these values to reflect the HW
31 | */
32 | #define MAX_NUM_ETH_PORTS 0x1
33 | #define MAX_NUM_ORAN_CC 2
34 | #define MAX_NUM_ORAN_DL_DATA_PTR 5
35 |
36 | /* TODO: Move any magic numbers in the code to defines here
37 | */
38 | #define ETH_FILTER_LENGTH_IN_WORDS 0x4
39 |
40 | #define ADDR_LOOP_OFFSET_CC 0x20
41 | #define ADDR_LOOP_OFFSET_ETH 0x100
42 | #define ADDR_LOOP_OFFSET_STATS 0x100
43 | #define ADDR_LOOP_OFFSET_FILTER 0x20
44 | #define ADDR_LOOP_OFFSET_DL_DATA_PTR 0x4
45 |
46 |
47 | /* TODO: to be made static as well, so that multiple instances can be used. As
48 | * of now, the following 3 structures are shared among the multiple
49 | * source files
50 | */
51 | extern struct framer_local *lp;
52 | extern struct kobject *root_xroe_kobj;
53 | struct framer_local {
54 | int irq;
55 | unsigned long mem_start;
56 | unsigned long mem_end;
57 | void __iomem *base_addr;
58 | };
59 |
60 | struct xroe_reg_attribute {
61 | struct kobj_attribute attr;
62 | u32 offset;
63 | u32 mask;
64 | u32 addr;
65 | };
66 |
67 | int xroe_sysfs_init(void);
68 | int xroe_sysfs_stats_init(void);
69 | int xroe_sysfs_shared_init(void);
70 | int xroe_sysfs_defm_init(void);
71 | int xroe_sysfs_cfg_init(void);
72 | void xroe_sysfs_exit(void);
73 | int utils_write32withmask(void __iomem *working_address, u32 value, u32 mask,
74 | u32 offset);
75 |
--------------------------------------------------------------------------------
/src/xlnx-ptp-timer/xlnx-ptp-timer.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Xilinx PTP : Linux driver for 1588 timer
3 | *
4 | * Author: Xilinx, Inc.
5 | *
6 | * 2014 (c) Xilinx, Inc. This file is licensed uner the terms of the GNU
7 | * General Public License version 2. This program is licensed "as is"
8 | * without any warranty of any kind, whether express or implied.
9 | *
10 | */
11 |
12 | #ifndef PTP_XILINX_1588_H
13 | #define PTP_XILINX_1588_H
14 |
15 | /* Read/Write access to the registers */
16 | #ifndef out_be32
17 | #if defined(CONFIG_ARCH_ZYNQ) || defined(CONFIG_ARCH_ZYNQMP)
18 | #define in_be32(offset) __raw_readl(offset)
19 | #define out_be32(offset, val) __raw_writel(val, offset)
20 | #endif
21 | #endif
22 |
23 | #endif /* PTP_XILINX_1588_H */
--------------------------------------------------------------------------------
/src/xroe-app/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (C) 2018 Xilinx, Inc. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are met:
5 |
6 | 1. Redistributions of source code must retain the above copyright notice,
7 | this list of conditions and the following disclaimer.
8 |
9 | 2. Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation
11 | and/or other materials provided with the distribution.
12 |
13 | 3. Neither the name of Xilinx nor the names of its contributors may be used
14 | to endorse or promote products derived from this software without
15 | specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 | POSSIBILITY OF SUCH DAMAGE.
28 |
--------------------------------------------------------------------------------
/src/xroe-app/Makefile:
--------------------------------------------------------------------------------
1 | APP = xroe-app
2 |
3 | # Add any other object files to this list below
4 | APP_OBJS = xroe-app.o ip.o ecpri.o stats.o client.o comms.o parser.o enable.o disable.o restart.o radio_ctrl.o framing.o ecpri_proto.o xroe_api.o
5 | CFLAGS += -g -I. -Werror -Wall
6 |
7 | all: build
8 |
9 | build: $(APP)
10 |
11 | $(APP): $(APP_OBJS)
12 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)
13 |
14 | clean:
15 | -rm -f $(APP_OBJS)
16 | -rm -f xroe-app
17 |
--------------------------------------------------------------------------------
/src/xroe-app/README.md:
--------------------------------------------------------------------------------
1 | Xilinx Radio over Ethernet Application Documentation
2 |
3 | The sample application demonstrates how the software stack operates. It is not a complete implementation, and is not intended to be used in a production system. The application runs in the foreground or as a daemon, providing interfaces for serial, socket and filesystem FIFO communications. The sample application is composed of the following modules and libraries.
4 |
5 | C Library API
6 |
7 | This library is ready for reuse in an unmodified form.
8 |
9 | Message Parsing Module
10 |
11 | This module demonstrates how a human-readable message protocol can be used to configure and control the RoE Framer. It provides interfaces to the hardware API library and any protocol modules.
12 |
13 | Communications Module
14 |
15 | This module provides a VFS interface for command line operation and TCP/IP and UDP/IP socket interfaces for remote operation.
16 |
17 | eCPRI Protocol Module
18 |
19 | This module provides a sample implementation of the eCPRI user plane over IP message layer, including one-way delay measurements and remote memory access to a remote node.
20 |
--------------------------------------------------------------------------------
/src/xroe-app/client.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file client.c
10 | * @addtogroup comms_lib
11 | * @{
12 | *
13 | * A sample communication module for UNIX, UDP/IP and TCP/IP sockets.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 |
31 | #include
32 | #include
33 |
34 | /*****************************************************************************/
35 | /**
36 | *
37 | * Sends commands to an instance of the sample application.
38 | * This function takes a user-supplied command string and send it either to the
39 | * sample application listening on the local UNIX socket, or if addr is not NULL
40 | * then the sample application listening on the remore TCP/IP socket at addr.
41 | *
42 | *
43 | * @param [in] addr Address of remote application to send command to.
44 | * @param [in] port Port of remote application.
45 | * @param [in] command Pointer to command string.
46 | *
47 | * @return
48 | * - 0
49 | *
50 | ******************************************************************************/
51 | int client_send_message(in_addr_t addr, int port, char *command)
52 | {
53 | struct sockaddr *serv_addr;
54 | struct sockaddr_in in_serv_addr;
55 | struct sockaddr_un un_serv_addr;
56 | int sockfd, servlen, n;
57 | char buffer[MAX_RESPONSE_LENGTH];
58 |
59 | if (addr)
60 | {
61 | /* Remote network connection */
62 | bzero((char *)&in_serv_addr, sizeof(in_serv_addr));
63 | in_serv_addr.sin_family = AF_INET;
64 | in_serv_addr.sin_addr.s_addr = addr;
65 | in_serv_addr.sin_port = htons(port ? port : XROE_COMM_PORT);
66 | servlen = sizeof(in_serv_addr);
67 |
68 | if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
69 | {
70 | perror("Creating socket");
71 | exit(0);
72 | }
73 |
74 | serv_addr = (struct sockaddr *)&in_serv_addr;
75 | }
76 | else /* Unix file socket */
77 | {
78 | bzero((char *)&un_serv_addr, sizeof(un_serv_addr));
79 | un_serv_addr.sun_family = AF_UNIX;
80 | strcpy(un_serv_addr.sun_path, XROE_SOCKET_FILE);
81 | servlen = strlen(un_serv_addr.sun_path) + sizeof(un_serv_addr.sun_family);
82 |
83 | if ((sockfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
84 | {
85 | perror("Creating socket");
86 | exit(0);
87 | }
88 |
89 | serv_addr = (struct sockaddr *)&un_serv_addr;
90 | }
91 |
92 | /* Connect to daemon */
93 | if (connect(sockfd, serv_addr, servlen) < 0)
94 | {
95 | perror("Connecting");
96 | exit(0);
97 | }
98 | bzero(buffer, MAX_RESPONSE_LENGTH);
99 |
100 | /* Send message to daemon and read response */
101 | if (write(sockfd, command, strlen(command)) < 0 )
102 | {
103 | syslog(LOG_ERR, "Failed write to Send message to daemon\n");
104 | }
105 |
106 | n = read(sockfd, buffer, MAX_RESPONSE_LENGTH);
107 | if(write(1, buffer, n) < 0)
108 | {
109 | syslog(LOG_ERR, "Failed write to Send message to daemon\n");
110 | }
111 | close(sockfd);
112 |
113 | return 0;
114 | }
115 |
116 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/client.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file client.h
10 | * @addtogroup comms_lib
11 | * @{
12 | *
13 | * A sample communication module for UNIX, UDP/IP and TCP/IP sockets.
14 | *
15 | ******************************************************************************/
16 | /************************** Function Prototypes ******************************/
17 | int client_send_message(in_addr_t in_addr, int port, char *command);
18 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/commands.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file commands.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 |
20 | /**
21 | * XROE_MAX_COMMANDS Number of commands handled at the top level.
22 | */
23 | #define XROE_MAX_COMMANDS 11
24 |
25 | /************************** Function Prototypes ******************************/
26 | int help_func(int argc, char **argv, char *resp);
27 | int ecpri_func(int argc, char **argv, char *resp);
28 | int ip_func(int argc, char **argv, char *resp);
29 | int stats_func(int argc, char **argv, char *resp);
30 | int version_func(int argc, char **argv, char *resp);
31 | int enable_func(int argc, char **argv, char *resp);
32 | int disable_func(int argc, char **argv, char *resp);
33 | int framing_func(int argc, char **argv, char *resp);
34 | int restart_func(int argc, char **argv, char *resp);
35 | int radio_ctrl_func(int argc, char **argv, char *resp);
36 |
37 | /**
38 | * cmds The top-level commands handled by the command parser.
39 | */
40 | commands_t cmds[XROE_MAX_COMMANDS] = {
41 | /* Keep this first */
42 | {"help", XROE_HELP_STR, help_func}, /**< "help" command */
43 | /* Insert commands here */
44 | {"ecpri", ECPRI_STR, ecpri_func}, /**< "ecpri" command */
45 | {"ip", IP_STR, ip_func}, /**< "stats" command */
46 | {"stats", STATS_STR, stats_func}, /**< "stats" command */
47 | {"version", XROE_VER_STR, version_func}, /**< "version" command */
48 | {"enable", XROE_ENABLE_STR, enable_func}, /**< "enable" command */
49 | {"disable", XROE_DISABLE_STR, disable_func}, /**< "disable" command */
50 | {"restart", XROE_RESTART_STR, restart_func}, /**< "restart" command */
51 | {"framing", XROE_FRAM_STR, framing_func}, /**< "framing" command */
52 | {"radio", RADIO_CTRL_STR, radio_ctrl_func}, /**< "radio" command */
53 | /* Keep this last - insert commands above */
54 | {NULL, NULL, NULL} /**< NULL command to terminate array */
55 | };
56 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/comms.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file comms.h
10 | * @addtogroup comms_lib
11 | * @{
12 | *
13 | * A sample communication module for UNIX, UDP/IP and TCP/IP sockets.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * XROE_SOCKET_FILE File name for UNIX socket.
19 | */
20 | #define XROE_SOCKET_FILE "/tmp/xroe"
21 |
22 | /**
23 | * MAX_RESPONSE_LENGTH Length of response string.
24 | */
25 | #define MAX_RESPONSE_LENGTH 1024
26 |
27 | /**
28 | * ETH_P_ECPRI Protocol number for eCPRI.
29 | */
30 | #define ETH_P_ECPRI 0xAEFE
31 |
32 | /**
33 | * ETH_P_1914_3 Protocol number for 1914.3.
34 | */
35 | #define ETH_P_1914_3 0xFC3D
36 |
37 | /**
38 | * XROE_COMM_PORT Default port number for UDP/IP and TCP/IP traffic.
39 | */
40 | #define XROE_COMM_PORT 0xAEFE
41 |
42 | /**
43 | * NUM_LISTEN_SOCKETS Number of sockets in the open socket list.
44 | */
45 | #define NUM_LISTEN_SOCKETS 3
46 |
47 | /************************** Function Prototypes ******************************/
48 | int open_connections(int nohw, int port, char *);
49 | int get_message(int nohw, char *command);
50 | void send_response(char *response);
51 | void close_connections(int nohw);
52 |
53 | extern int sock_ip; /**< File descriptor number for UDP/IP socket */
54 | extern int port_ip; /**< Port number for TCP/IP and UDP/IP socket */
55 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/disable.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file disable.c
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | /**
34 | * DISABLE_MAX_COMMANDS Number of commands handled by the disable module.
35 | */
36 | #define DISABLE_MAX_COMMANDS 4
37 |
38 | /************************** Function Prototypes ******************************/
39 | int disable_help_func(int argc, char **argv, char *resp);
40 | int disable_framer_func(int argc, char **argv, char *resp);
41 | int disable_deframer_func(int argc, char **argv, char *resp);
42 |
43 | /**
44 | * disable_cmds The commands handled by the disable module.
45 | */
46 | commands_t disable_cmds[DISABLE_MAX_COMMANDS] = {
47 | /* Keep this first */
48 | {"help", DISABLE_HELP_STR, disable_help_func},
49 | /* Insert commands here */
50 | {"framer", DISABLE_FRAMER_STR, disable_framer_func},
51 | {"deframer", DISABLE_DEFRAMER_STR, disable_deframer_func},
52 | /* Keep this last - insert commands above */
53 | {NULL, NULL, NULL}
54 | };
55 |
56 |
57 | /*****************************************************************************/
58 | /**
59 | *
60 | * Disables the framer by setting the restart value high.
61 | *
62 | *
63 | * @param [in] argc Number of string arguments.
64 | * @param [in] argv Array of strings containg arguments.
65 | * @param [out] resp Pointer to string to place response text in.
66 | *
67 | * @return
68 | * - Return value of FRAMER_API_Framer_Restart()
69 | *
70 | ******************************************************************************/
71 | int disable_framer_func(int argc, char **argv, char *resp)
72 | {
73 | return(FRAMER_API_Framer_Restart(1));
74 | }
75 |
76 | /*****************************************************************************/
77 | /**
78 | *
79 | * Disables the deframer by setting the restart value high.
80 | *
81 | *
82 | * @param [in] argc Number of string arguments.
83 | * @param [in] argv Array of strings containg arguments.
84 | * @param [out] resp Pointer to string to place response text in.
85 | *
86 | * @return
87 | * - Return value of FRAMER_API_Deframer_Restart()
88 | *
89 | ******************************************************************************/
90 | int disable_deframer_func(int argc, char **argv, char *resp)
91 | {
92 | return(FRAMER_API_Deframer_Restart(1));
93 | }
94 |
95 |
96 | /*****************************************************************************/
97 | /**
98 | *
99 | * Returns help strings for disable commands.
100 | *
101 | *
102 | * @param [in] argc Number of string arguments.
103 | * @param [in] argv Array of strings containg arguments.
104 | * @param [out] resp Pointer to string to place response text in.
105 | *
106 | * @return
107 | * - 0
108 | *
109 | ******************************************************************************/
110 | int disable_help_func(int argc, char **argv, char *resp)
111 | {
112 | int i;
113 | char *str = resp;
114 |
115 | str += sprintf(str, "disable help:\n");
116 |
117 | for(i=0; disable_cmds[i].cmd != NULL; i++)
118 | {
119 | str += sprintf(str, "\t%s\t : %s", disable_cmds[i].cmd, disable_cmds[i].helptxt);
120 | }
121 | return 0;
122 | }
123 |
124 |
125 | /*****************************************************************************/
126 | /**
127 | *
128 | * Parses the input command string and calls a handler function (if found).
129 | *
130 | *
131 | * @param [in] argc Number of string arguments.
132 | * @param [in] argv Array of strings containg arguments.
133 | * @param [out] resp Pointer to string to place response text in.
134 | *
135 | * @return
136 | * - 1 if no commands tokens found.
137 | * - 2 if no handler found for command.
138 | * - 0 otherwise.
139 | *
140 | ******************************************************************************/
141 | int disable_func(int argc, char **argv, char *resp)
142 | {
143 | int count = 0;
144 | int found = 0;
145 | char *str = resp;
146 |
147 | if(argc == 0)
148 | {
149 | sprintf(str, "\t%s", DISABLE_USAGE_STR);
150 | return(1);
151 | }
152 |
153 | for(count=0; disable_cmds[count].cmd != NULL; count++)
154 | {
155 | if(strcmp(argv[0], disable_cmds[count].cmd)==0)
156 | {
157 | found = 1;
158 | /* Call the handler function for the command given */
159 | disable_cmds[count].func(argc-1, &argv[1], resp);
160 | }
161 | }
162 |
163 | if(!found)
164 | {
165 | str += sprintf(str, "Command %s not found, try \"help\"\n", argv[0]);
166 | return(2);
167 | }
168 |
169 | return 0;
170 | }
171 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/disable_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file disable_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * DISABLE_USAGE_STR Help text for the disable module.
19 | */
20 | #define DISABLE_USAGE_STR "Usage \"disable \", try \"disable help\" for command list\n"
21 |
22 | /**
23 | * DISABLE_HELP_STR Help text for the disable module "help" option.
24 | */
25 | #define DISABLE_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * DISABLE_FRAMER_STR Help text for the disable module "framer" option.
29 | */
30 | #define DISABLE_FRAMER_STR "Disables the Framer\n"
31 |
32 | /**
33 | * DISABLE_USAGE_STR Help text for the disable module "deframer" option.
34 | */
35 | #define DISABLE_DEFRAMER_STR "Disables the Deframer\n"
36 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/ecpri_proto.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file ecpri_proto.h
10 | * @addtogroup protocol_ecpri
11 | * @{
12 | *
13 | * Sample eCPRI protocol library.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 |
22 | /**
23 | * ECPRI_PROTO_MAGIC_BYTE Magic eCPRI message byte.
24 | */
25 | #define ECPRI_PROTO_MAGIC_BYTE (0x10)
26 |
27 | /**
28 | * ECPRI_PROTO_HEADER_SIZE Size of the eCPRI message header.
29 | */
30 | #define ECPRI_PROTO_HEADER_SIZE (4)
31 |
32 | /**
33 | * ecpri_message_type_t The types of eCPRI user-plane message.
34 | */
35 | typedef enum ecpri_message_type_e
36 | {
37 | ECPRI_MSG_IQ_DATA, /**< IQ Data */
38 | ECPRI_MSG_BIT_SEQ, /**< Bit Sequence */
39 | ECPRI_MSG_RTC_DATA, /**< Real-Time Control Data */
40 | ECPRI_MSG_GENERIC_DATA, /**< Generic Data */
41 | ECPRI_MSG_RMA, /**< Remote Memory Access */
42 | ECPRI_MSG_OWDM, /**< One-Way Delay Measurement */
43 | ECPRI_MSG_REM_RESET, /**< Remote Reset */
44 | ECPRI_MSG_EVENT /**< Event Indication */
45 | } ecpri_message_type_t;
46 |
47 | /**
48 | * ecpri_header_t The eCPRI user-plane message header.
49 | */
50 | typedef struct ecpri_header_s
51 | {
52 | uint8_t magic; /**< Protocol revision and continuation byte */
53 | uint8_t type; /**< Message type @see ecpri_message_type_t */
54 | uint16_t length; /**< Payload length */
55 | } ecpri_header_t;
56 |
57 | /**
58 | * ECPRI_RMA_MSG_READ eCPRI RMA read flag.
59 | */
60 | #define ECPRI_RMA_MSG_READ (0)
61 |
62 | /**
63 | * ECPRI_RMA_MSG_WRITE eCPRI RMA write flag.
64 | */
65 | #define ECPRI_RMA_MSG_WRITE (0x10)
66 |
67 | /**
68 | * ECPRI_RMA_MSG_WR_NO_RESP eCPRI RMA write with no response flag.
69 | */
70 | #define ECPRI_RMA_MSG_WR_NO_RESP (0x20)
71 |
72 | /**
73 | * ECPRI_RMA_MSG_REQ eCPRI RMA request flag.
74 | */
75 | #define ECPRI_RMA_MSG_REQ (0)
76 |
77 | /**
78 | * ECPRI_RMA_MSG_RESP eCPRI RMA response flag.
79 | */
80 | #define ECPRI_RMA_MSG_RESP (0x1)
81 |
82 | /**
83 | * ECPRI_RMA_MSG_FAIL eCPRI RMA request fail flag.
84 | */
85 | #define ECPRI_RMA_MSG_FAIL (0x2)
86 |
87 | /**
88 | * ecpri_rma_msg_t eCPRI RMA message structure.
89 | */
90 | typedef struct ecpri_rma_msg_s
91 | {
92 | uint8_t id; /**< Access ID */
93 | uint8_t rd_wr_req_resp; /**< Read/Write nibble | Request/Response nibble */
94 | uint16_t element_id; /**< Element ID */
95 | uint8_t address[6]; /**< Memory Address */
96 | uint16_t length; /**< Length of read/write */
97 | } ecpri_rma_msg_t;
98 |
99 | /**
100 | * ECPRI_OWDM_MSG_ACTION_REQ eCPRI OWDM action request flag.
101 | */
102 | #define ECPRI_OWDM_MSG_ACTION_REQ (0)
103 |
104 | /**
105 | * ECPRI_OWDM_MSG_ACTION_REQ_FOL_UP eCPRI OWDM action req with follow-up flag.
106 | */
107 | #define ECPRI_OWDM_MSG_ACTION_REQ_FOL_UP (0x1)
108 |
109 | /**
110 | * ECPRI_OWDM_MSG_ACTION_RESP eCPRI OWDM action response flag.
111 | */
112 | #define ECPRI_OWDM_MSG_ACTION_RESP (0x2)
113 |
114 | /**
115 | * ECPRI_OWDM_MSG_ACTION_REM_REQ eCPRI OWDM remote action request flag.
116 | */
117 | #define ECPRI_OWDM_MSG_ACTION_REM_REQ (0x3)
118 |
119 | /**
120 | * ECPRI_OWDM_MSG_ACTION_REM_REQ_FOL_UP OWDM rem act req with follow-up flag.
121 | */
122 | #define ECPRI_OWDM_MSG_ACTION_REM_REQ_FOL_UP (0x4)
123 |
124 | /**
125 | * ECPRI_OWDM_MSG_ACTION_FOL_UP eCPRI OWDM follow-up flag.
126 | */
127 | #define ECPRI_OWDM_MSG_ACTION_FOL_UP (0x5)
128 |
129 | /**
130 | * ecpri_owdm_msg_t eCPRI OWDM message structure.
131 | */
132 | typedef struct ecpri_owdm_msg_s
133 | {
134 | uint8_t id; /**< Measurement ID */
135 | uint8_t action_type; /**< Action Type */
136 | uint8_t ts_sec[6]; /**< Time-stamp (seconds) */
137 | uint8_t ts_nsec[4]; /**< Time-stamp (nano-seconds) */
138 | uint8_t comp[8]; /**< Compensation value */
139 | } ecpri_owdm_msg_t;
140 |
141 | /**
142 | * ecpri_owdm_msg_t eCPRI OWDM direction.
143 | */
144 | typedef enum ecpri_owdn_direction
145 | {
146 | TO_REMOTE, /**< Measure to remote from originator */
147 | FROM_REMOTE /**< Measure to originator from remote */
148 | } ecpri_owdm_direction_type;
149 |
150 | /**
151 | * ECPRI_RMR_MSG_CODE_OP_REM_RESET_REQ eCPRI RMR request flag.
152 | */
153 | #define ECPRI_RMR_MSG_CODE_OP_REM_RESET_REQ (0x1)
154 |
155 | /**
156 | * ECPRI_RMR_MSG_CODE_OP_REM_RESET_RESP eCPRI RMR response flag.
157 | */
158 | #define ECPRI_RMR_MSG_CODE_OP_REM_RESET_RESP (0x2)
159 |
160 | /**
161 | * ecpri_rmr_msg_t eCPRI RMR message structure.
162 | */
163 | typedef struct ecpri_rmr_msg_s
164 | {
165 | uint16_t id; /**< Reset ID */
166 | uint8_t code_op; /**< Reset Operation Code (Request/Indication) */
167 | } ecpri_rmr_msg_t;
168 |
169 | /************************** Function Prototypes ******************************/
170 | int proto_ecpri_rma_send_request(int type, uint16_t data_len, struct sockaddr_in *dest, uint64_t offset, uint8_t *values);
171 | int proto_ecpri_rma_get_response(int type, int *length, struct sockaddr_in *src, uint8_t **values);
172 | int proto_ecpri_owdm_send_request(uint8_t type, struct sockaddr_in *dest);
173 | int proto_ecpri_handle_incoming_msg(int fd, short revents, char *command);
174 | void proto_ecpri_get_owdm_result(int *req_no, int *resp_no, ecpri_owdm_direction_type *direction,
175 | struct in_addr *node, unsigned long long *secs, unsigned long *nsecs);
176 | void proto_ecpri_set_owdm_limit(long limit);
177 | int proto_ecpri_test_mesg_send(struct sockaddr_in *dest);
178 | int proto_ecpri_rmr_send_request(struct sockaddr_in *dest);
179 | int proto_ecpri_rmr_get_response(struct sockaddr_in *src);
180 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/ecpri_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file ecpri_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * ECPRI_USAGE_STR Help text for the ecpri module.
19 | */
20 | #define ECPRI_USAGE_STR "Usage \"ecpri [args]\", try \"ecpri help\" for command list\n"
21 |
22 | /**
23 | * ECPRI_HELP_STR Help text for the ecpri module "help" option.
24 | */
25 | #define ECPRI_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * ECPRI_OWDM_REQ_STR Help text for the ecpri module "owdm_req" option.
29 | */
30 | #define ECPRI_OWDM_REQ_STR "ecpri owdm_req - Request an OWDM measurement to of type \n"
31 |
32 | /**
33 | * ECPRI_OWDM_RES_STR Help text for the ecpri module "owdm_res" option.
34 | */
35 | #define ECPRI_OWDM_RES_STR "ecpri owdm_res - Returns the result of the last OWDM measurement, or \"Pending\" if still underway\n"
36 |
37 | /**
38 | * ECPRI_OWDM_LIMIT_STR Help text for the ecpri module "owdm_limit" option.
39 | */
40 | #define ECPRI_OWDM_LIMIT_STR "ecpri owdm_limit - Sets the report threshold of the OWDM measurement (nsecs), or disables reporting if 0\n"
41 |
42 | /**
43 | * ECPRI_RMA_READ_STR Help text for the ecpri module "rma_read" option.
44 | */
45 | #define ECPRI_RMA_READ_STR "ecpri rma_read - Request a read of bytes at from \n"
46 |
47 | /**
48 | * ECPRI_RMA_WRITE_STR Help text for the ecpri module "rma_write" option.
49 | */
50 | #define ECPRI_RMA_WRITE_STR "ecpri rma_write \"\" - Request a write of to at \n"
51 |
52 | /**
53 | * ECPRI_TEST_MESG_STR Help text for the ecpri module "test_mesg" option.
54 | */
55 | #define ECPRI_TEST_MESG_STR "ecpri test_mesg - TESTING - Send a test message to \n"
56 |
57 | /**
58 | * ECPRI_RMR_REQ_STR Help text for the ecpri module "rmr_req" option.
59 | */
60 | #define ECPRI_RMR_REQ_STR "ecpri rmr_req - Request a remote reset of \n"
61 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/enable.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file enable.c
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | /**
34 | * ENABLE_MAX_COMMANDS Number of commands handled by the enable module.
35 | */
36 | #define ENABLE_MAX_COMMANDS 4
37 |
38 | /************************** Function Prototypes ******************************/
39 | int enable_help_func(int argc, char **argv, char *resp);
40 | int enable_framer_func(int argc, char **argv, char *resp);
41 | int enable_deframer_func(int argc, char **argv, char *resp);
42 |
43 | /**
44 | * enable_cmds The commands handled by the enable module.
45 | */
46 | commands_t enable_cmds[ENABLE_MAX_COMMANDS] = {
47 | /* Keep this first */
48 | {"help", ENABLE_HELP_STR, enable_help_func},
49 | /* Insert commands here */
50 | {"framer", ENABLE_FRAMER_STR, enable_framer_func},
51 | {"deframer", ENABLE_DEFRAMER_STR, enable_deframer_func},
52 | /* Keep this last - insert commands above */
53 | {NULL, NULL, NULL}
54 | };
55 |
56 |
57 | /*****************************************************************************/
58 | /**
59 | *
60 | * Enables the framer by setting the restart value low.
61 | *
62 | *
63 | * @param [in] argc Number of string arguments.
64 | * @param [in] argv Array of strings containg arguments.
65 | * @param [out] resp Pointer to string to place response text in.
66 | *
67 | * @return
68 | * - Return value of FRAMER_API_Framer_Restart()
69 | *
70 | ******************************************************************************/
71 | int enable_framer_func(int argc, char **argv, char *resp)
72 | {
73 | return(FRAMER_API_Framer_Restart(0));
74 | }
75 |
76 | /*****************************************************************************/
77 | /**
78 | *
79 | * Enables the deframer by setting the restart value low.
80 | *
81 | *
82 | * @param [in] argc Number of string arguments.
83 | * @param [in] argv Array of strings containg arguments.
84 | * @param [out] resp Pointer to string to place response text in.
85 | *
86 | * @return
87 | * - Return value of FRAMER_API_Deframer_Restart()
88 | *
89 | ******************************************************************************/
90 | int enable_deframer_func(int argc, char **argv, char *resp)
91 | {
92 | return(FRAMER_API_Deframer_Restart(0));
93 | }
94 |
95 |
96 | /*****************************************************************************/
97 | /**
98 | *
99 | * Returns help strings for enable commands.
100 | *
101 | *
102 | * @param [in] argc Number of string arguments.
103 | * @param [in] argv Array of strings containg arguments.
104 | * @param [out] resp Pointer to string to place response text in.
105 | *
106 | * @return
107 | * - 0
108 | *
109 | ******************************************************************************/
110 | int enable_help_func(int argc, char **argv, char *resp)
111 | {
112 | int i;
113 | char *str = resp;
114 |
115 | str += sprintf(str, "enable help:\n");
116 |
117 | for(i=0; enable_cmds[i].cmd != NULL; i++)
118 | {
119 | str += sprintf(str, "\t%s\t : %s", enable_cmds[i].cmd, enable_cmds[i].helptxt);
120 | }
121 | return 0;
122 | }
123 |
124 |
125 | /*****************************************************************************/
126 | /**
127 | *
128 | * Parses the input command string and calls a handler function (if found).
129 | *
130 | *
131 | * @param [in] argc Number of string arguments.
132 | * @param [in] argv Array of strings containg arguments.
133 | * @param [out] resp Pointer to string to place response text in.
134 | *
135 | * @return
136 | * - 1 if no commands tokens found.
137 | * - 2 if no handler found for command.
138 | * - 0 otherwise.
139 | *
140 | ******************************************************************************/
141 | int enable_func(int argc, char **argv, char *resp)
142 | {
143 | int count = 0;
144 | int found = 0;
145 | char *str = resp;
146 |
147 | if(argc == 0)
148 | {
149 | sprintf(str, "\t%s", ENABLE_USAGE_STR);
150 | return(1);
151 | }
152 |
153 | for(count=0; enable_cmds[count].cmd != NULL; count++)
154 | {
155 | if(strcmp(argv[0], enable_cmds[count].cmd)==0)
156 | {
157 | found = 1;
158 | /* Call the handler function for the command given */
159 | enable_cmds[count].func(argc-1, &argv[1], resp);
160 | }
161 | }
162 |
163 | if(!found)
164 | {
165 | str += sprintf(str, "Command %s not found, try \"help\"\n", argv[0]);
166 | return(2);
167 | }
168 |
169 | return 0;
170 | }
171 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/enable_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file enable_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * ENABLE_USAGE_STR Help text for the enable module.
19 | */
20 | #define ENABLE_USAGE_STR "Usage \"enable \", try \"enable help\" for command list\n"
21 |
22 | /**
23 | * ENABLE_HELP_STR Help text for the enable module "help" option.
24 | */
25 | #define ENABLE_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * ENABLE_FRAMER_STR Help text for the enable module "framer" option.
29 | */
30 | #define ENABLE_FRAMER_STR "Enables the Framer\n"
31 |
32 | /**
33 | * ENABLE_DEFRAMER_STR Help text for the enable module "deframer" option.
34 | */
35 | #define ENABLE_DEFRAMER_STR "Enables the Deframer\n"
36 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/framing_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * FRAMING_USAGE_STR Help text for the framing module.
10 | */
11 | #define FRAMING_USAGE_STR "Usage \"framing \", try \"framing help\" for command list\n"
12 |
13 | /**
14 | * FRAMING_HELP_STR Help text for the framing module "help" option.
15 | */
16 | #define FRAMING_HELP_STR "generates this list of commands\n"
17 |
18 | /**
19 | * FRAMING_SET_FRAM_STR Help text for the framing module "set_fram" option.
20 | */
21 | #define FRAMING_SET_FRAM_STR "Set framer register value, usage \"framing set_fram \", \n" \
22 | "\t\t\t: 0-31\n" \
23 | "\t\t\t: data_pc_id, data_type, data_port, ctrl_pc_id, ctrl_type, ctrl_port\n" \
24 | "\t\t\t: see datasheet\n"
25 |
26 | /**
27 | * FRAMING_GET_FRAM_STR Help text for the framing module "get_fram" option.
28 | */
29 | #define FRAMING_GET_FRAM_STR "Get framer register value, usage \"framing get_fram \", \n" \
30 | "\t\t\t: 0-31\n" \
31 | "\t\t\t: data_pc_id, data_type, data_port, ctrl_pc_id, ctrl_type, ctrl_port\n"
32 |
33 | /**
34 | * FRAMING_SET_DEFR_STR Help text for the framing module "set_defr" option.
35 | */
36 | #define FRAMING_SET_DEFR_STR "Set deframer register value, usage \"framing set_defr \", \n" \
37 | "\t\t\t: 0-31\n" \
38 | "\t\t\t: data_pc_id, ctrl_pc_id\n" \
39 | "\t\t\t: see datasheet\n"
40 |
41 | /**
42 | * FRAMING_GET_DEFR_STR Help text for the framing module "get_defr" option.
43 | */
44 | #define FRAMING_GET_DEFR_STR "Get deframer register value, usage \"framing get_defr \", \n" \
45 | "\t\t\t: 0-31\n" \
46 | "\t\t\t: data_pc_id, ctrl_pc_id,\n" \
47 | "\t\t\t\tdbs_latency, dbs_alignment, dbs_overflow, dbs_underflow, dbs_regular, dbs_rwin\n" \
48 | "\t\t\t\tcbs_latency, cbs_alignment, cbs_overflow, cbs_underflow, cbs_regular, cbs_rwin\n"
49 |
50 |
--------------------------------------------------------------------------------
/src/xroe-app/ip.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file ip.c
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | #include
31 | #include
32 | #include
33 |
34 | /**
35 | * IP_MAX_COMMANDS Number of commands handled by the IP module.
36 | */
37 | #define IP_MAX_COMMANDS 4
38 |
39 | /************************** Function Prototypes ******************************/
40 | int ip_help_func(int argc, char **argv, char *resp);
41 | int ip_peek_func(int argc, char **argv, char *resp);
42 | int ip_poke_func(int argc, char **argv, char *resp);
43 |
44 | /**
45 | * ip_cmds The commands handled by the IP module.
46 | */
47 | commands_t ip_cmds[IP_MAX_COMMANDS] = {
48 | /* Keep this first */
49 | {"help", IP_HELP_STR, ip_help_func},
50 | /* Insert commands here */
51 | {"peek", IP_PEEK_STR, ip_peek_func},
52 | {"poke", IP_POKE_STR, ip_poke_func},
53 | /* Keep this last - insert commands above */
54 | {NULL, NULL, NULL}
55 | };
56 |
57 |
58 | /*****************************************************************************/
59 | /**
60 | *
61 | * Returns help strings for IP commands.
62 | *
63 | *
64 | * @param [in] argc Number of string arguments.
65 | * @param [in] argv Array of strings containg arguments.
66 | * @param [out] resp Pointer to string to place response text in.
67 | *
68 | * @return
69 | * - 0
70 | *
71 | ******************************************************************************/
72 | int ip_help_func(int argc, char **argv, char *resp)
73 | {
74 | int i;
75 | char *str = resp;
76 |
77 | str += sprintf(str, "ip help:\n");
78 |
79 | for(i=0; ip_cmds[i].cmd != NULL; i++)
80 | {
81 | str += sprintf(str, "\t%s\t : %s", ip_cmds[i].cmd, ip_cmds[i].helptxt);
82 | }
83 | return 0;
84 | }
85 |
86 | /*****************************************************************************/
87 | /**
88 | *
89 | * Returns the 32-bits at the given memory address.
90 | *
91 | *
92 | * @param [in] argc Number of string arguments.
93 | * @param [in] argv Array of strings containg arguments.
94 | * @param [out] resp Pointer to string to place response text in.
95 | *
96 | * @return
97 | * - 0
98 | *
99 | ******************************************************************************/
100 | int ip_peek_func(int argc, char **argv, char *resp)
101 | {
102 | int buf;
103 | int addr;
104 | int read = 0;
105 | char *str = resp;
106 |
107 | if(argc == 0)
108 | {
109 | sprintf(str, "\t%s", IP_PEEK_STR);
110 | return(1);
111 | }
112 |
113 | addr = strtol(argv[0], NULL, 0);
114 |
115 | read = IP_API_Read(addr, (uint8_t *)&buf, sizeof(buf));
116 | if(!read)
117 | {
118 | str += sprintf(str, "peek: 0x%08x : 0x%08x\n", addr, buf);
119 | }
120 | else
121 | {
122 | str += sprintf(str, "ip peek 0x%08x: error %d\n", addr, read);
123 | }
124 |
125 | return 0;
126 | }
127 |
128 | /*****************************************************************************/
129 | /**
130 | *
131 | * Writes the 32-bits given to the given memory address.
132 | *
133 | *
134 | * @param [in] argc Number of string arguments.
135 | * @param [in] argv Array of strings containg arguments.
136 | * @param [out] resp Pointer to string to place response text in.
137 | *
138 | * @return
139 | * - 0
140 | *
141 | ******************************************************************************/
142 | int ip_poke_func(int argc, char **argv, char *resp)
143 | {
144 | int buf;
145 | int addr;
146 | int write = 0;
147 | char *str = resp;
148 |
149 | if(argc < 2)
150 | {
151 | sprintf(str, "\t%s", IP_POKE_STR);
152 | return(1);
153 | }
154 |
155 | addr = strtol(argv[0], NULL, 0);
156 | buf = strtol(argv[1], NULL, 0);
157 |
158 | str += sprintf(str, "addr: 0x%08x, value: 0x%08x\n", addr, buf);
159 |
160 | write = IP_API_Write(addr, (uint8_t *)&buf, sizeof(buf));
161 | if(!write)
162 | {
163 | str += sprintf(str, "poke: 0x%08x : 0x%08x\n", addr, buf);
164 | }
165 | else
166 | {
167 | str += sprintf(str, "ip poke 0x%08x: error %d\n", addr, write);
168 | }
169 |
170 | return 0;
171 | }
172 |
173 | /*****************************************************************************/
174 | /**
175 | *
176 | * Parses the input command string and calls a handler function (if found).
177 | *
178 | *
179 | * @param [in] argc Number of string arguments.
180 | * @param [in] argv Array of strings containg arguments.
181 | * @param [out] resp Pointer to string to place response text in.
182 | *
183 | * @return
184 | * - 1 if no commands tokens found.
185 | * - 2 if no handler found for command.
186 | * - 0 otherwise.
187 | *
188 | ******************************************************************************/
189 | int ip_func(int argc, char **argv, char *resp)
190 | {
191 | int count = 0;
192 | int found = 0;
193 | char *str = resp;
194 |
195 | if(argc == 0)
196 | {
197 | sprintf(str, "\t%s", IP_USAGE_STR);
198 | return(1);
199 | }
200 |
201 | for(count=0; ip_cmds[count].cmd != NULL; count++)
202 | {
203 | if(strcmp(argv[0], ip_cmds[count].cmd)==0)
204 | {
205 | found = 1;
206 | /* Call the handler function for the command given */
207 | ip_cmds[count].func(argc-1, &argv[1], str);
208 | }
209 | }
210 |
211 | if(!found)
212 | {
213 | str += sprintf(str, "Command %s not found, try \"help\"\n", argv[0]);
214 | return(2);
215 | }
216 |
217 | return 0;
218 | }
219 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/ip_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file ip_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * IP_USAGE_STR Help text for the enable module.
19 | */
20 | #define IP_USAGE_STR "Usage is \"ip [value]\", try \"ip help\" for command list\n"
21 |
22 | /**
23 | * IP_HELP_STR Help text for the IP module "help" option.
24 | */
25 | #define IP_HELP_STR "generates this list of ip subcommands\n"
26 |
27 | /**
28 | * IP_PEEK_STR Help text for the IP module "peek" option.
29 | */
30 | #define IP_PEEK_STR "ip peek \n"
31 |
32 | /**
33 | * IP_POKE_STR Help text for the IP module "poke" option.
34 | */
35 | #define IP_POKE_STR "ip poke \n"
36 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/parser.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file parser.c
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | /*****************************************************************************/
29 | /**
30 | *
31 | * Returns help strings for top-level commands.
32 | *
33 | *
34 | * @param [in] argc Number of string arguments.
35 | * @param [in] argv Array of strings containg arguments.
36 | * @param [out] resp Pointer to string to place response text in.
37 | *
38 | * @return
39 | * - 0
40 | *
41 | ******************************************************************************/
42 | int help_func(int argc, char **argv, char *resp)
43 | {
44 | int i;
45 | char *str = resp;
46 |
47 | str += sprintf(str, "xroe-app help:\n");
48 |
49 | for (i = 0; i\", try \"radio_ctrl help\" for command list\n"
21 |
22 | /**
23 | * RADIO_CTRL_HELP_STR Help text for the radio_ctrl module "help" option.
24 | */
25 | #define RADIO_CTRL_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * RADIO_CTRL_STATUS_STR Help text for the radio_ctrl module "status" option.
29 | */
30 | #define RADIO_CTRL_STATUS_STR "Returns the enable, error, status and loopback\n"
31 |
32 | /**
33 | * RADIO_CTRL_LOOPBACK_EN_STR Help text for the radio_ctrl module "loopback_en" option.
34 | */
35 | #define RADIO_CTRL_LOOPBACK_EN_STR "Enables the loopback\n"
36 |
37 | /**
38 | * RADIO_CTRL_LOOPBACK_DIS_STR Help text for the radio_ctrl module "loopback_dis" option.
39 | */
40 | #define RADIO_CTRL_LOOPBACK_DIS_STR "Disables the loopback\n"
41 |
42 | /**
43 | * RADIO_CTRL_RADIO_ID_STR Help text for the radio_ctrl module "id" option.
44 | */
45 | #define RADIO_CTRL_RADIO_ID_STR "[DEV] Returns the Radio ID tag\n"
46 |
47 | /**
48 | * RADIO_CTRL_GUI_STR Help text for the radio_ctrl module "gui" option.
49 | */
50 | #define RADIO_CTRL_GUI_STR "[DEV] all radio output for GUI\n"
51 |
52 | /**
53 | * RADIO_CTRL_PEEK_STR Help text for the radio_ctrl module "peek" option.
54 | */
55 | #define RADIO_CTRL_PEEK_STR "radio_ctrl peek \n"
56 |
57 | /**
58 | * RADIO_CTRL_POKE_STR Help text for the radio_ctrl module "poke" option.
59 | */
60 | #define RADIO_CTRL_POKE_STR "radio_ctrl poke \n"
61 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/restart.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file restart.c
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /***************************** Include Files *********************************/
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | /**
34 | * RESTART_MAX_COMMANDS Number of commands handled by the restart module.
35 | */
36 | #define RESTART_MAX_COMMANDS 4
37 |
38 | /************************** Function Prototypes ******************************/
39 | int restart_help_func(int argc, char **argv, char *resp);
40 | int restart_xxv_func(int argc, char **argv, char *resp);
41 |
42 | /**
43 | * restart_cmds The commands handled by the restart module.
44 | */
45 | commands_t restart_cmds[RESTART_MAX_COMMANDS] = {
46 | /* Keep this first */
47 | { "help", RESTART_HELP_STR, restart_help_func },
48 | /* Insert commands here */
49 | { "xxv", RESTART_XXV_RESET_STR, restart_xxv_func },
50 | /* Keep this last - insert commands above */
51 | { NULL, NULL, NULL }
52 | };
53 |
54 |
55 | /*****************************************************************************/
56 | /**
57 | *
58 | * Restarts the XXV Ethernet interface.
59 | *
60 | *
61 | * @param [in] argc Number of string arguments.
62 | * @param [in] argv Array of strings containg arguments.
63 | * @param [out] resp Pointer to string to place response text in.
64 | *
65 | * @return
66 | * - Return value of XXV_API_Reset()
67 | *
68 | ******************************************************************************/
69 | int restart_xxv_func(int argc, char **argv, char *resp)
70 | {
71 | return(XXV_API_Reset());
72 | }
73 |
74 |
75 | /*****************************************************************************/
76 | /**
77 | *
78 | * Returns help strings for restart commands.
79 | *
80 | *
81 | * @param [in] argc Number of string arguments.
82 | * @param [in] argv Array of strings containg arguments.
83 | * @param [out] resp Pointer to string to place response text in.
84 | *
85 | * @return
86 | * - 0
87 | *
88 | ******************************************************************************/
89 | int restart_help_func(int argc, char **argv, char *resp)
90 | {
91 | int i;
92 | char *str = resp;
93 |
94 | str += sprintf(str, "restart help:\n");
95 |
96 | for (i = 0; restart_cmds[i].cmd != NULL; i++)
97 | {
98 | str += sprintf(str, "\t%s\t : %s", restart_cmds[i].cmd, restart_cmds[i].helptxt);
99 | }
100 | return 0;
101 | }
102 |
103 |
104 | /*****************************************************************************/
105 | /**
106 | *
107 | * Parses the input command string and calls a handler function (if found).
108 | *
109 | *
110 | * @param [in] argc Number of string arguments.
111 | * @param [in] argv Array of strings containg arguments.
112 | * @param [out] resp Pointer to string to place response text in.
113 | *
114 | * @return
115 | * - 1 if no commands tokens found.
116 | * - 2 if no handler found for command.
117 | * - 0 otherwise.
118 | *
119 | ******************************************************************************/
120 | int restart_func(int argc, char **argv, char *resp)
121 | {
122 | int count = 0;
123 | int found = 0;
124 | char *str = resp;
125 |
126 | if (argc == 0)
127 | {
128 | sprintf(str, "\t%s", RESTART_USAGE_STR);
129 | return(1);
130 | }
131 |
132 | for (count = 0; restart_cmds[count].cmd != NULL; count++)
133 | {
134 | if (strcmp(argv[0], restart_cmds[count].cmd) == 0)
135 | {
136 | found = 1;
137 | /* Call the handler function for the command given */
138 | restart_cmds[count].func(argc - 1, &argv[1], resp);
139 | }
140 | }
141 |
142 | if (!found)
143 | {
144 | str += sprintf(str, "Command %s not found, try \"help\"\n", argv[0]);
145 | return(2);
146 | }
147 |
148 | return 0;
149 | }
150 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/restart_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file restart_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * RESTART_USAGE_STR Help text for the restart module.
19 | */
20 | #define RESTART_USAGE_STR "Usage \"restart \", try \"restart help\" for command list\n"
21 |
22 | /**
23 | * RESTART_HELP_STR Help text for the restart module "help" option.
24 | */
25 | #define RESTART_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * RESTART_XXV_RESET_STR Help text for the restart module "xxv" option.
29 | */
30 | #define RESTART_XXV_RESET_STR "XXV_Reset\n"
31 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/roe_radio_ctrl.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*-----------------------------------------------------------------------------
3 | * C Header bank BASE definitions
4 | *------------------------------------------------------------------------------
5 | */
6 | #define ROE_RADIO_CFG_BASE_ADDR 0x0 /* 0 */
7 | #define ROE_RADIO_SOURCE_BASE_ADDR 0x1000 /* 4096 */
8 |
9 | /*-----------------------------------------------------------------------------
10 | * C Header bank register definitions for bank roe_radio_cfg
11 | * with prefix radio_ @ address 0x0
12 | *------------------------------------------------------------------------------
13 | */
14 | /* Type = roInt */
15 | #define RADIO_ID_ADDR 0x0 /* 0 */
16 | #define RADIO_ID_MASK 0xffffffff /* 4294967295 */
17 | #define RADIO_ID_OFFSET 0x0 /* 0 */
18 | #define RADIO_ID_WIDTH 0x20 /* 32 */
19 | #define RADIO_ID_DEFAULT 0x120001 /* 1179649 */
20 |
21 | /* Type = rw */
22 | #define RADIO_TIMEOUT_ENABLE_ADDR 0x4 /* 4 */
23 | #define RADIO_TIMEOUT_ENABLE_MASK 0x1 /* 1 */
24 | #define RADIO_TIMEOUT_ENABLE_OFFSET 0x0 /* 0 */
25 | #define RADIO_TIMEOUT_ENABLE_WIDTH 0x1 /* 1 */
26 | #define RADIO_TIMEOUT_ENABLE_DEFAULT 0x0 /* 0 */
27 |
28 | /* Type = ro */
29 | #define RADIO_TIMEOUT_STATUS_ADDR 0x8 /* 8 */
30 | #define RADIO_TIMEOUT_STATUS_MASK 0x1 /* 1 */
31 | #define RADIO_TIMEOUT_STATUS_OFFSET 0x0 /* 0 */
32 | #define RADIO_TIMEOUT_STATUS_WIDTH 0x1 /* 1 */
33 | #define RADIO_TIMEOUT_STATUS_DEFAULT 0x1 /* 1 */
34 |
35 | /* Type = rw */
36 | #define RADIO_TIMEOUT_VALUE_ADDR 0xc /* 12 */
37 | #define RADIO_TIMEOUT_VALUE_MASK 0xfff /* 4095 */
38 | #define RADIO_TIMEOUT_VALUE_OFFSET 0x0 /* 0 */
39 | #define RADIO_TIMEOUT_VALUE_WIDTH 0xc /* 12 */
40 | #define RADIO_TIMEOUT_VALUE_DEFAULT 0x80 /* 128 */
41 |
42 | /* Type = rw */
43 | #define RADIO_GPIO_CDC_LEDMODE2_ADDR 0x10 /* 16 */
44 | #define RADIO_GPIO_CDC_LEDMODE2_MASK 0x1 /* 1 */
45 | #define RADIO_GPIO_CDC_LEDMODE2_OFFSET 0x0 /* 0 */
46 | #define RADIO_GPIO_CDC_LEDMODE2_WIDTH 0x1 /* 1 */
47 | #define RADIO_GPIO_CDC_LEDMODE2_DEFAULT 0x0 /* 0 */
48 |
49 | /* Type = rw */
50 | #define RADIO_GPIO_CDC_LEDGPIO_ADDR 0x10 /* 16 */
51 | #define RADIO_GPIO_CDC_LEDGPIO_MASK 0x30 /* 48 */
52 | #define RADIO_GPIO_CDC_LEDGPIO_OFFSET 0x4 /* 4 */
53 | #define RADIO_GPIO_CDC_LEDGPIO_WIDTH 0x2 /* 2 */
54 | #define RADIO_GPIO_CDC_LEDGPIO_DEFAULT 0x0 /* 0 */
55 |
56 | /* Type = roSig */
57 | #define RADIO_GPIO_CDC_DIPSTATUS_ADDR 0x14 /* 20 */
58 | #define RADIO_GPIO_CDC_DIPSTATUS_MASK 0xff /* 255 */
59 | #define RADIO_GPIO_CDC_DIPSTATUS_OFFSET 0x0 /* 0 */
60 | #define RADIO_GPIO_CDC_DIPSTATUS_WIDTH 0x8 /* 8 */
61 | #define RADIO_GPIO_CDC_DIPSTATUS_DEFAULT 0x0 /* 0 */
62 |
63 | /* Type = wPlsH */
64 | #define RADIO_SW_TRIGGER_ADDR 0x20 /* 32 */
65 | #define RADIO_SW_TRIGGER_MASK 0x1 /* 1 */
66 | #define RADIO_SW_TRIGGER_OFFSET 0x0 /* 0 */
67 | #define RADIO_SW_TRIGGER_WIDTH 0x1 /* 1 */
68 | #define RADIO_SW_TRIGGER_DEFAULT 0x0 /* 0 */
69 |
70 | /* Type = rw */
71 | #define RADIO_CDC_ENABLE_ADDR 0x24 /* 36 */
72 | #define RADIO_CDC_ENABLE_MASK 0x1 /* 1 */
73 | #define RADIO_CDC_ENABLE_OFFSET 0x0 /* 0 */
74 | #define RADIO_CDC_ENABLE_WIDTH 0x1 /* 1 */
75 | #define RADIO_CDC_ENABLE_DEFAULT 0x0 /* 0 */
76 |
77 | /* Type = roSig */
78 | #define RADIO_CDC_ERROR_ADDR 0x24 /* 36 */
79 | #define RADIO_CDC_ERROR_MASK 0x2 /* 2 */
80 | #define RADIO_CDC_ERROR_OFFSET 0x1 /* 1 */
81 | #define RADIO_CDC_ERROR_WIDTH 0x1 /* 1 */
82 | #define RADIO_CDC_ERROR_DEFAULT 0x0 /* 0 */
83 |
84 | /* Type = roSig */
85 | #define RADIO_CDC_STATUS_ADDR 0x24 /* 36 */
86 | #define RADIO_CDC_STATUS_MASK 0x4 /* 4 */
87 | #define RADIO_CDC_STATUS_OFFSET 0x2 /* 2 */
88 | #define RADIO_CDC_STATUS_WIDTH 0x1 /* 1 */
89 | #define RADIO_CDC_STATUS_DEFAULT 0x0 /* 0 */
90 |
91 | /* Type = rw */
92 | #define RADIO_CDC_LOOPBACK_ADDR 0x28 /* 40 */
93 | #define RADIO_CDC_LOOPBACK_MASK 0x1 /* 1 */
94 | #define RADIO_CDC_LOOPBACK_OFFSET 0x0 /* 0 */
95 | #define RADIO_CDC_LOOPBACK_WIDTH 0x1 /* 1 */
96 | #define RADIO_CDC_LOOPBACK_DEFAULT 0x0 /* 0 */
97 |
98 | /* Type = rw */
99 | #define RADIO_SINK_ENABLE_ADDR 0x2c /* 44 */
100 | #define RADIO_SINK_ENABLE_MASK 0x1 /* 1 */
101 | #define RADIO_SINK_ENABLE_OFFSET 0x0 /* 0 */
102 | #define RADIO_SINK_ENABLE_WIDTH 0x1 /* 1 */
103 | #define RADIO_SINK_ENABLE_DEFAULT 0x1 /* 1 */
104 |
105 | /* Type = roSig */
106 | #define RADIO_CDC_ERROR_31_0_ADDR 0x30 /* 48 */
107 | #define RADIO_CDC_ERROR_31_0_MASK 0xffffffff /* 4294967295 */
108 | #define RADIO_CDC_ERROR_31_0_OFFSET 0x0 /* 0 */
109 | #define RADIO_CDC_ERROR_31_0_WIDTH 0x20 /* 32 */
110 | #define RADIO_CDC_ERROR_31_0_DEFAULT 0x0 /* 0 */
111 |
112 | /* Type = roSig */
113 | #define RADIO_CDC_ERROR_63_32_ADDR 0x34 /* 52 */
114 | #define RADIO_CDC_ERROR_63_32_MASK 0xffffffff /* 4294967295 */
115 | #define RADIO_CDC_ERROR_63_32_OFFSET 0x0 /* 0 */
116 | #define RADIO_CDC_ERROR_63_32_WIDTH 0x20 /* 32 */
117 | #define RADIO_CDC_ERROR_63_32_DEFAULT 0x0 /* 0 */
118 |
119 | /* Type = roSig */
120 | #define RADIO_CDC_ERROR_95_64_ADDR 0x38 /* 56 */
121 | #define RADIO_CDC_ERROR_95_64_MASK 0xffffffff /* 4294967295 */
122 | #define RADIO_CDC_ERROR_95_64_OFFSET 0x0 /* 0 */
123 | #define RADIO_CDC_ERROR_95_64_WIDTH 0x20 /* 32 */
124 | #define RADIO_CDC_ERROR_95_64_DEFAULT 0x0 /* 0 */
125 |
126 | /* Type = roSig */
127 | #define RADIO_CDC_ERROR_127_96_ADDR 0x3c /* 60 */
128 | #define RADIO_CDC_ERROR_127_96_MASK 0xffffffff /* 4294967295 */
129 | #define RADIO_CDC_ERROR_127_96_OFFSET 0x0 /* 0 */
130 | #define RADIO_CDC_ERROR_127_96_WIDTH 0x20 /* 32 */
131 | #define RADIO_CDC_ERROR_127_96_DEFAULT 0x0 /* 0 */
132 |
133 | /* Type = roSig */
134 | #define RADIO_CDC_STATUS_31_0_ADDR 0x40 /* 64 */
135 | #define RADIO_CDC_STATUS_31_0_MASK 0xffffffff /* 4294967295 */
136 | #define RADIO_CDC_STATUS_31_0_OFFSET 0x0 /* 0 */
137 | #define RADIO_CDC_STATUS_31_0_WIDTH 0x20 /* 32 */
138 | #define RADIO_CDC_STATUS_31_0_DEFAULT 0x0 /* 0 */
139 |
140 | /* Type = roSig */
141 | #define RADIO_CDC_STATUS_63_32_ADDR 0x44 /* 68 */
142 | #define RADIO_CDC_STATUS_63_32_MASK 0xffffffff /* 4294967295 */
143 | #define RADIO_CDC_STATUS_63_32_OFFSET 0x0 /* 0 */
144 | #define RADIO_CDC_STATUS_63_32_WIDTH 0x20 /* 32 */
145 | #define RADIO_CDC_STATUS_63_32_DEFAULT 0x0 /* 0 */
146 |
147 | /* Type = roSig */
148 | #define RADIO_CDC_STATUS_95_64_ADDR 0x48 /* 72 */
149 | #define RADIO_CDC_STATUS_95_64_MASK 0xffffffff /* 4294967295 */
150 | #define RADIO_CDC_STATUS_95_64_OFFSET 0x0 /* 0 */
151 | #define RADIO_CDC_STATUS_95_64_WIDTH 0x20 /* 32 */
152 | #define RADIO_CDC_STATUS_95_64_DEFAULT 0x0 /* 0 */
153 |
154 | /* Type = roSig */
155 | #define RADIO_CDC_STATUS_127_96_ADDR 0x4c /* 76 */
156 | #define RADIO_CDC_STATUS_127_96_MASK 0xffffffff /* 4294967295 */
157 | #define RADIO_CDC_STATUS_127_96_OFFSET 0x0 /* 0 */
158 | #define RADIO_CDC_STATUS_127_96_WIDTH 0x20 /* 32 */
159 | #define RADIO_CDC_STATUS_127_96_DEFAULT 0x0 /* 0 */
160 |
161 |
162 | /*-----------------------------------------------------------------------------
163 | * C Header bank register definitions for bank roe_radio_source
164 | * with prefix fram_ @ address 0x1000
165 | *------------------------------------------------------------------------------
166 | */
167 | /* Type = rwpdef */
168 | #define FRAM_PACKET_DATA_SIZE_ADDR 0x1000 /* 4096 */
169 | #define FRAM_PACKET_DATA_SIZE_MASK 0x7f /* 127 */
170 | #define FRAM_PACKET_DATA_SIZE_OFFSET 0x0 /* 0 */
171 | #define FRAM_PACKET_DATA_SIZE_WIDTH 0x7 /* 7 */
172 | #define FRAM_PACKET_DATA_SIZE_DEFAULT 0x0 /* 0 */
173 |
174 | /* Type = rwpdef */
175 | #define FRAM_PAUSE_DATA_SIZE_ADDR 0x1004 /* 4100 */
176 | #define FRAM_PAUSE_DATA_SIZE_MASK 0x7f /* 127 */
177 | #define FRAM_PAUSE_DATA_SIZE_OFFSET 0x0 /* 0 */
178 | #define FRAM_PAUSE_DATA_SIZE_WIDTH 0x7 /* 7 */
179 | #define FRAM_PAUSE_DATA_SIZE_DEFAULT 0x0 /* 0 */
180 |
181 |
182 |
--------------------------------------------------------------------------------
/src/xroe-app/stats_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file restart_str.h
10 | * @addtogroup command_parser
11 | * @{
12 | *
13 | * A sample command parser for the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * STATS_USAGE_STR Help text for the stats module.
19 | */
20 | #define STATS_USAGE_STR "Usage \"stats \", try \"stats help\" for command list\n"
21 |
22 | /**
23 | * STATS_HELP_STR Help text for the stats module "help" option.
24 | */
25 | #define STATS_HELP_STR "generates this list of commands\n"
26 |
27 | /**
28 | * STATS_SW_STR Help text for the stats module "sw" option.
29 | */
30 | #define STATS_SW_STR "Software statistics not supported\n"
31 |
32 | /**
33 | * STATS_USER_STR Help text for the stats module "user" option.
34 | */
35 | #define STATS_USER_STR "Returns user data packets stats\n"
36 |
37 | /**
38 | * STATS_CTRL_STR Help text for the stats module "control" option.
39 | */
40 | #define STATS_CTRL_STR "Returns control packets stats\n"
41 |
42 | /**
43 | * STATS_RATE_STR Help text for the stats module "rate" option.
44 | */
45 | #define STATS_RATE_STR "Returns packet rate stats\n"
46 |
47 | /**
48 | * STATS_ALL_STR Help text for the stats module "all" option.
49 | */
50 | #define STATS_ALL_STR "Returns a summary of all stats\n"
51 |
52 | /**
53 | * STATS_DEV_NUM_STR Help text for the stats module "rev" option.
54 | */
55 | #define STATS_DEV_NUM_STR "[DEV] get the internal revision number of the stats device\n"
56 |
57 | /**
58 | * STATS_GUI_NUM_STR Help text for the stats module "gui" option.
59 | */
60 | #define STATS_GUI_NUM_STR "[DEV] all stats output for GUI\n"
61 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/template.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 |
15 | #include
16 | #include
17 |
18 | #define TEMPLATE_MAX_COMMANDS 2
19 |
20 | int template_help_func(int argc, char **argv);
21 |
22 | commands_t template_cmds[TEMPLATE_MAX_COMMANDS] = {
23 | /* Keep this first */
24 | {"help", TEMPLATE_HELP_STR, template_help_func},
25 | /* Insert commands here */
26 | /* Keep this last - insert commands above */
27 | {NULL, NULL, NULL}
28 | };
29 |
30 |
31 | int template_help_func(int argc, char **argv)
32 | {
33 | int i;
34 |
35 | printf("ip help:\n");
36 |
37 | for(i=0; template_cmds[i].cmd != NULL; i++)
38 | {
39 | printf("\t%s\t : %s", template_cmds[i].cmd, template_cmds[i].helptxt);
40 | }
41 | return 0;
42 | }
43 |
44 | int template_func(int argc, char **argv)
45 | {
46 | int count = 0;
47 | int found = 0;
48 |
49 | if(argc < 2)
50 | {
51 | printf("\t%s", TEMPLATE_USAGE_STR);
52 | return(1);
53 | }
54 |
55 | for(count=0; template_cmds[count].cmd != NULL; count++)
56 | {
57 | if(strcmp(argv[1], template_cmds[count].cmd)==0)
58 | {
59 | found = 1;
60 | /* Call the handler function for the command given */
61 | template_cmds[count].func(argc-1, &argv[1]);
62 | }
63 | }
64 |
65 | if(!found)
66 | {
67 | printf("Command %s not found, try \"help\"\n", argv[1]);
68 | return(2);
69 | }
70 |
71 | return 0;
72 | }
73 |
--------------------------------------------------------------------------------
/src/xroe-app/template_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | #define TEMPLATE_USAGE_STR "Usage \"template "\, try \"template help\" for command list\n"
9 | #define TEMPLATE_HELP_STR "generates this list of commands\n"
--------------------------------------------------------------------------------
/src/xroe-app/xroe_api.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file xroe_api.h
10 | * @addtogroup framer_driver_api
11 | * @{
12 | *
13 | * Radio over Ethernet Framer driver API library
14 | *
15 | *
16 | ******************************************************************************/
17 | #ifndef XROE_API_H /* prevent circular inclusions */
18 | #define XROE_API_H /* by using protection macros */
19 | /************************** Function Prototypes ******************************/
20 | int IP_API_Read(int addr, uint8_t *pRead, int length);
21 | int IP_API_Write(int addr, uint8_t *pWrite, int length);
22 | int IP_API_Read_Register(int addr, unsigned int *pRead, int Mask, int Offset);
23 | int IP_API_Write_Register(int addr, unsigned int pWrite, int Mask, int Offset);
24 | int STATS_SYSFS_API_Read(const char *name, char *resp);
25 | int FRAMER_API_Framer_Restart(int restart);
26 | int FRAMER_API_Deframer_Restart(int restart);
27 | int TRAFGEN_SYSFS_API_Read(const char *name, char *resp);
28 | int TRAFGEN_SYSFS_API_Write(const char *name, char *val);
29 | int XXV_API_Reset(void);
30 | #endif /* end of protection macro */
31 | /** @} */
--------------------------------------------------------------------------------
/src/xroe-app/xroe_types.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | typedef int (*CommandFunc)(int argc, char **argv, char *resp);
9 |
10 | typedef struct _commands_t
11 | {
12 | const char *cmd;
13 | const char *helptxt;
14 | CommandFunc func;
15 | } commands_t;
16 |
--------------------------------------------------------------------------------
/src/xroe-app/xroefram_str.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: BSD-3-Clause
2 | /******************************************************************************
3 | *
4 | * Copyright (C) 2018 Xilinx, Inc.
5 | *
6 | ******************************************************************************/
7 |
8 | /**
9 | * @file xroefram_str.h
10 | * @addtogroup sample_app
11 | * @{
12 | *
13 | * A sample application to demonstrate the RoE Framer software modules.
14 | *
15 | ******************************************************************************/
16 |
17 | /**
18 | * XROE_USAGE_STR Help text for the application, listing command line options.
19 | */
20 | #define XROE_USAGE_STR "Xilinx Radio Over Ethernet Framer Application (xroe-app)\n" \
21 | "Usage: [options] [\"command [args]\"]\n" \
22 | "Options:\n" \
23 | " -d daemonise server\n" \
24 | " -s soft server mode, no local hardware\n" \
25 | " -c send command to server\n" \
26 | " -n with -c send command to remote app at \n" \
27 | " -p with -n specifies remote port to send to, with -d or -s specifies server listen port\n" \
28 | " -h produces this help\n" \
29 | "\n" \
30 | "Commands:\n" \
31 | " [args]\n" \
32 | "Try: [-n [-p ]] -c \"help\" for list of server commands\n"
33 |
34 | /**
35 | * XROE_QUIT_STR Response string for quit command.
36 | */
37 | #define XROE_QUIT_STR "Received quit command, exiting\n"
38 |
39 | /**
40 | * XROE_HELP_STR Help text for "help" command.
41 | */
42 | #define XROE_HELP_STR "generates this list of commands\n"
43 |
44 | /**
45 | * XROE_VER_STR Help text for "version" command.
46 | */
47 | #define XROE_VER_STR "Not yet supported\n"
48 |
49 | /**
50 | * XROE_ENABLE_STR Help text for "enable" command.
51 | */
52 | #define XROE_ENABLE_STR "Enable framer/deframer\n"
53 |
54 | /**
55 | * XROE_FRAM_STR Help text for "framing" command.
56 | */
57 | #define XROE_FRAM_STR "Framer/deframer control commands\n"
58 |
59 | /**
60 | * XROE_DISABLE_STR Help text for "disable" command.
61 | */
62 | #define XROE_DISABLE_STR "Disable framer/deframer\n"
63 |
64 | /**
65 | * XROE_RESTART_STR Help text for "restart" command.
66 | */
67 | #define XROE_RESTART_STR "XXV Reset\n"
68 |
69 | /**
70 | * ECPRI_STR Help text for "ecpri" command.
71 | */
72 | #define ECPRI_STR "eCPRI commands\n"
73 |
74 | /**
75 | * IP_STR Help text for "ip" command.
76 | */
77 | #define IP_STR "Raw IP memory device access\n"
78 |
79 | /**
80 | * STATS_STR Help text for "stats" command.
81 | */
82 | #define STATS_STR "Stats device access\n"
83 |
84 | /**
85 | * RADIO_CTRL_STR Help text for "radio" command.
86 | */
87 | #define RADIO_CTRL_STR "Radio control device access\n"
88 | /** @} */
89 |
--------------------------------------------------------------------------------
/src/xroe-auto-start/runXroe.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | XROEROOTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
3 |
4 | ###############################################################################
5 | ## Address Maps
6 | ## In the default example the following base addresses are used for the
7 | ## Radio and Framer.
8 | ## 0xA000_0000 = roe_framer
9 | ## 0xA006_0000 = radio traffic generator
10 | ###############################################################################
11 |
12 | ###############################################################################
13 | ## Local functions
14 | ###############################################################################
15 | USERAPPFILE=${XROEROOTDIR}/xroe-app
16 | LOGGER="/usr/bin/logger -t $0"
17 | LOGGER="echo"
18 |
19 | ###############################################################################
20 | ## Local functions
21 | ###############################################################################
22 |
23 | f_testMaskedValue () {
24 | result=$((($1) & ($2)))
25 | if [ $result -gt 0 ]; then
26 | echo 1
27 | else
28 | echo 0
29 | fi
30 | }
31 |
32 | f_resetXxvMac () {
33 | ## Reset the XXV Mac, using the reset attached to the roe_framer GPIO
34 | devmem 0xa000000C 32 1
35 | devmem 0xa000000C 32 0
36 | }
37 |
38 | ###############################################################################
39 | ## Mask and devmem read Modify Write commands
40 | ###############################################################################
41 | f_maskValue () {
42 | readValue=$1
43 | bitWidth=$2
44 | bitOffset=$3
45 |
46 | ## Create a 32 it mask
47 | maskedVal=$((((((2**($bitWidth))-1) << ($bitOffset))) & ($readValue)))
48 |
49 | echo $maskedVal
50 |
51 | }
52 |
53 | f_readModifyWrite32 () {
54 | address=$1
55 | readValue=$(devmem $address)
56 | bitWidth=$2
57 | bitOffset=$3
58 | newValue=$4
59 |
60 | ## Create a 32 it mask
61 | mask=$(((~(((2**($bitWidth))-1) << ($bitOffset))) & (0xFFFFFFFF)))
62 | writeValue=$((($readValue) & ($mask)))
63 | writeValue=$((($writeValue) | (($newValue) << ($bitOffset))))
64 |
65 | ## Show the result
66 | #printf "@ 0x%x read:0x%x write 0x%x\n" $1 $readValue $writeValue
67 | devmem $address w $writeValue
68 |
69 | }
70 |
71 | ###############################################################################
72 | $LOGGER "********************************************************************"
73 | $LOGGER "** $0"
74 | $LOGGER "** Xilinx roe_framer demonstration platform application initscr **"
75 | $LOGGER "********************************************************************"
76 |
77 | ## Reset the XXV Mac, using the reset attached to the roe_framer GPIO
78 | f_resetXxvMac
79 |
80 | ## Determine which ETH port is used for 10G and 100M Interfaces
81 | eIf="eth0"
82 | driverName=$(basename $(readlink -f /sys/class/net/${eIf}/device/driver))
83 |
84 | if [[ "$driverName" =~ xilinx_axienet ]]; then
85 | eth_10g="eth0"
86 | eth_100m="eth1"
87 | else
88 | eth_10g="eth1"
89 | eth_100m="eth0"
90 | fi
91 |
92 | ${LOGGER} "** Ethernet Interfaces 10G = ${eth_10g}, 10/100 = ${eth_100m}"
93 | ${LOGGER} "** Supported antennas: $(devmem 0xa0000300)"
94 |
95 | ##
96 | ${LOGGER} "Update the AXI4 timeout so we know this has been executed"
97 | devmem 0xa0000018 32 0x81
98 |
99 | ${LOGGER} "Switch the LED mode"
100 | devmem 0xa0060010 32 0x1
101 | sleep 4
102 | devmem 0xa0060010 32 0x0
103 |
104 | ###############################################################################
105 | dipValue=$(devmem 0xa0060014)
106 |
107 | ${LOGGER} "Bring the 10/100 link down->up"
108 | ip link set dev ${eth_100m} down
109 | ip link set dev ${eth_100m} up
110 |
111 | if (( $( f_testMaskedValue $dipValue 0x02 ) != 0 )); then
112 | ${LOGGER} "Unit is slave assign IP address 10 on ${eth_10g}"
113 | xroe-config-XXV-ptp.sh 10 ${eth_10g}
114 | if (( $( f_testMaskedValue $dipValue 0x08 ) == 0 )); then
115 | ip addr add 192.168.10.120/24 dev ${eth_100m}
116 | fi
117 | else
118 | ${LOGGER} "Unit is master assign IP address 9 on ${eth_10g}"
119 | xroe-config-XXV-ptp.sh 9 ${eth_10g}
120 | ## Change the address of eth0, the 10/100 MAC
121 | ## 192.168.99.200 is the address of the PC
122 | if (( $( f_testMaskedValue $dipValue 0x08 ) == 0 )); then
123 | ip addr add 192.168.10.100/24 dev ${eth_100m}
124 | fi
125 | fi
126 | sleep 2
127 |
128 | if (( $( f_testMaskedValue $dipValue 0x01 ) != 0 )); then
129 | ${LOGGER} "Board is in LED Mode 2"
130 | fi
131 |
132 | if (( $( f_testMaskedValue $dipValue 0x80 ) != 0 )); then
133 | ${LOGGER} "Board is in Radio Loopback mode: enable framer"
134 | ## This should be the Master board in the Demo.
135 | devmem 0xa0002000 32 0
136 | fi
137 |
138 | ###############################################################################
139 | ## Start the xroe-app
140 | ###############################################################################
141 | if (( $( f_testMaskedValue $dipValue 0x04 ) != 0 )); then
142 | ${LOGGER} "Auto start PTP4l demo"
143 | if (( $( f_testMaskedValue $dipValue 0x02 ) != 0 )); then
144 | ${LOGGER} "Unit is PTP4l Slave"
145 | ptp4l -m -A -i ${eth_10g} -f ${XROEROOTDIR}/xroe-ptp4lsyncE.cfg -s &
146 | else
147 | ${LOGGER} "Unit is PTP4l Master"
148 | ptp4l -m -A -i ${eth_10g} &
149 | fi
150 | fi
151 |
152 | ###############################################################################
153 | ## Start the xroe-app
154 | ###############################################################################
155 | if [ -e $USERAPPFILE ]; then
156 | ${LOGGER} "Launching $USERAPPFILE -d"
157 | $USERAPPFILE -d -e ${eth_10g}
158 | fi
159 |
160 | ###############################################################################
161 | ${LOGGER} "Bring the 10G link down->up one last time to flush system"
162 | ip link set dev ${eth_10g} down
163 | ip link set dev ${eth_10g} up
164 |
165 | ###############################################################################
166 | runTimeMonitor=${XROEROOTDIR}/xroe_monitor.pl
167 | if [ -e $runTimeMonitor ]; then
168 | ${LOGGER} "Start our monitor apps"
169 | perl -I ${XROEROOTDIR}/xroeLib ${XROEROOTDIR}/xroe_ping.pl &
170 | perl -I ${XROEROOTDIR}/xroeLib ${runTimeMonitor} &
171 | fi
172 |
173 | ###############################################################################
174 | ## System monitor functions
175 | ## 1. Check that block lock is set, if down reset the XXV
176 | ###############################################################################
177 | blStatus=1
178 | blNotSetCount=0
179 | while [ 1 ];
180 | do
181 |
182 | ##--------------------------------------------------------------------------
183 | ## Block lock check
184 | ##--------------------------------------------------------------------------
185 | blockLockStatus=$(devmem 0xa002040c)
186 | blockLockStatus=$(devmem 0xa002040c)
187 |
188 | ## Write BLOCK lock status to app scratch space in the radio
189 | f_readModifyWrite32 0xA0060050 1 0 $(f_maskValue $blockLockStatus 1 0)
190 |
191 | if (( $( f_testMaskedValue $blockLockStatus 0x01 ) == 0 )); then
192 | ${LOGGER} "Block lock has been lost : $(devmem 0xa002040c) : $blockLockStatus : $blNotSetCount"
193 | if (($blNotSetCount > 10)); then
194 | ${LOGGER} "Try XXV reset."
195 | f_resetXxvMac
196 | fi
197 | blStatus=0
198 | blNotSetCount=$((blNotSetCount + 1))
199 | sleep 2
200 | else
201 | if (( $blStatus == 0 )); then
202 | ${LOGGER} "Block lock has been reaquired : $blockLockStatus"
203 | blStatus=1
204 | blNotSetCount=0
205 | fi
206 | fi
207 |
208 | ##--------------------------------------------------------------------------
209 | ## Sleep
210 | ##--------------------------------------------------------------------------
211 | sleep 1
212 |
213 | ##--------------------------------------------------------------------------
214 | ## LED Heartbeat
215 | ##--------------------------------------------------------------------------
216 | ledValue=$(devmem 0xa0060010)
217 | if (( $( f_testMaskedValue $dipValue 0x02 ) != 0 )); then
218 | ## Slave flash bit 1
219 | let ledValue=($ledValue ^ 0x10)
220 | else
221 | ## Master flash bit 2
222 | let ledValue=($ledValue ^ 0x20)
223 | fi
224 | devmem 0xa0060010 32 $ledValue
225 |
226 | done
227 |
--------------------------------------------------------------------------------
/src/xroe-auto-start/xroe-auto-start:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | DAEMON=/usr/bin/xroe-startup.sh
3 | start ()
4 | {
5 | echo " Starting xroe-auto-start"
6 | start-stop-daemon -S -o --background -x $DAEMON
7 | }
8 | stop ()
9 | {
10 | echo " Stoping xroe-auto-start"
11 | start-stop-daemon -K -x $DAEMON
12 | }
13 | restart()
14 | {
15 | stop
16 | start
17 | }
18 | [ -e $DAEMON ] || exit 1
19 | case "$1" in
20 | start)
21 | start; ;;
22 | stop)
23 | stop; ;;
24 | restart)
25 | restart; ;;
26 | *)
27 | echo "Usage: $0 {start|stop|restart}"
28 | exit 1
29 | esac
30 | exit $?
31 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-common-procs.sh:
--------------------------------------------------------------------------------
1 | # This syntax is invalid in new sh version
2 | # use writeDevmem () {
3 | # http://stackoverflow.com/questions/12468889/bash-script-error-function-not-found-why-would-this-appear
4 | # function writeDevmem {
5 | writeDevmem () {
6 | addr=$(($1 + $2))
7 | printf "DEVMEM WRITE: BaseAddr=0x%08x Offset=0x%04x Value=0x%04x to 0x%08x %s\n" $1 $2 $3 $addr $4
8 | devmem $addr 32 $3
9 | }
10 |
11 | readDevmem () {
12 | addr=$(($1 + $2))
13 | local=$(devmem $addr 32)
14 | printf "DEVMEM READ : BaseAddr=0x%08x Offset=0x%04x Value=%s from 0x%08x %s\n" $1 $2 $local $addr
15 | }
16 |
17 | readRxDemuxFilter () {
18 | readDevmem $1 $((0x00 + $2))
19 | readDevmem $1 $((0x04 + $2))
20 | readDevmem $1 $((0x0C + $2))
21 | }
22 |
23 | writeRxDemuxFilter () {
24 | writeDevmem $1 $((0x00 + $2)) $3
25 | writeDevmem $1 $((0x04 + $2)) $4
26 | writeDevmem $1 $((0x0C + $2)) $5
27 | }
28 |
29 | readRxDemuxFilters () {
30 | readRxDemuxFilter $1 0x00
31 | readRxDemuxFilter $1 0x10
32 | readRxDemuxFilter $1 0x20
33 | }
34 |
35 | setRxDemuxAllToCpri () {
36 | writeRxDemuxFilter $1 0x00 0x0 0x0 0x0
37 | writeRxDemuxFilter $1 0x10 0x0 0x0 0x0
38 | writeRxDemuxFilter $1 0x20 0x0 0x0 0x0
39 | }
40 |
41 | setRxDemuxDefault () {
42 | writeRxDemuxFilter $1 0x00 0x010190E2 0x02005E01 0x000000FF
43 | writeRxDemuxFilter $1 0x10 0x080A0020 0xBA68ABEA 0x000000FF
44 | writeRxDemuxFilter $1 0x20 0xFFFFFFFF 0xFFFFFFFF 0x00000000
45 | }
46 |
47 | readMultiRegs () {
48 | number=0
49 | while [ "$number" -lt "$2" ]
50 | do
51 | readDevmem $1 $((0x04 * $number))
52 | number=`expr $number + 1 `
53 | done
54 | }
55 |
56 | readRxDemuxStats () {
57 | readMultiRegs 0x83C50200 10
58 | }
59 |
60 | showRxDemuxStats () {
61 | l1=$(devmem $(($1 + 0x0)) 32)
62 | l2=$(devmem $(($1 + 0x4)) 32)
63 | l3=$(devmem $(($1 + 0x8)) 32)
64 | l4=$(devmem $(($1 + 0xC)) 32)
65 | printf "RXDEMUX READ : MR=%8d AR=%8d BM=%8d BA=%8d\n" $l1
66 | }
67 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-config-XXV-ptp.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | lByte="10"
4 |
5 | if [ ! -v $1 ]
6 | then
7 | lByte=$1
8 | else
9 | echo "No last byte given using ${lByte}."
10 | fi
11 |
12 | if [ ! -v $2 ]
13 | then
14 | eTag=$2
15 | else
16 | eTag="eth1"
17 | fi
18 |
19 | ipAddr="192.168.99.${lByte}"
20 |
21 | echo "Setting up the XXV Ethernet link ${eTag} IP= ${ipAddr}"
22 | ip link set dev ${eTag} up
23 | ip addr add ${ipAddr}/24 dev ${eTag}
24 |
25 | ## Enable jumbo frames - MTU API not hooked up in driver yet
26 | ## but the driver currently forces jumbo frames on at probe() time
27 | #ip link set dev eth1 mtu 9000
28 | # Turn on timestamping in AXI 10G Ethernet full time
29 | echo "Setting timestamped mode using hwstamp_ctl..."
30 | hwstamp_ctl -i ${eTag} -t 1 -r 1
31 |
32 | ip addr
33 |
34 | echo "...done!"
35 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-config-XXV.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | echo "Setting up the 25G Ethernet link..."
4 | ip link set dev eth1 up
5 | ip addr add 192.168.99.10/24 dev eth1
6 |
7 | ip addr
8 |
9 | echo "...done!"
10 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-help:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cat /usr/bin/xroe-help.txt
3 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-help.txt:
--------------------------------------------------------------------------------
1 | ##-----------------------------------------------------------------------------
2 | ## xroe by Xilinx
3 | ## Welcome to the Radio Over Ethernet demonstrator.
4 | ##-----------------------------------------------------------------------------
5 |
6 | ##-----------------------------------------------------------------------------
7 | ## Scripts launched at BOOT.
8 | ##-----------------------------------------------------------------------------
9 | # - xroe-auto-start : Startup daemon. Launches xroe-startup.sh
10 | # - /usr/bin/xroe-startup.sh : Checks for runtime manager script on SDCard,
11 | # else launches default in /usr/bin
12 | # - /usr/bin/runXroe.bash : Example runtime manager script. This can
13 | # be adapted to suit the needs of your
14 | # system. Stop this executing using :
15 | mkdir /var/run/media/mmcblk0p1/xroe
16 | ##-----------------------------------------------------------------------------
17 |
18 | ##-----------------------------------------------------------------------------
19 | ## To make modifications to the startup script and app. Create the following
20 | ## directory and copy these files.
21 | ## /usr/bin/runXroe.bash contains bash examples for subsystem interaction.
22 | ## PERL and Python are also installed, which can be easier to use.
23 | ##-----------------------------------------------------------------------------
24 | mkdir /var/run/media/mmcblk0p1/xroe
25 | cp /usr/bin/runXroe.bash /var/run/media/mmcblk0p1/xroe/.
26 | cp /usr/bin/xroe-ptp4lsyncE.cfg /var/run/media/mmcblk0p1/xroe/.
27 | cp /usr/bin/xroe-app /var/run/media/mmcblk0p1/xroe/.
28 | sync
29 |
30 | ##-----------------------------------------------------------------------------
31 | ## Radio Address Map
32 | ## acc=AccessType
33 | ## bof=BitOffset
34 | ## bwi=BitWidth
35 | ## aof=AddressOffset
36 | ## def=Default
37 | ## doc=Documentation
38 | ##-----------------------------------------------------------------------------
39 | acc bof bwi aof def doc
40 | radio_id : { ro 0 32 0x0000 0x00120001 'Radio ID tag'}
41 |
42 | gpio_cdc_ledmode2 : { rw 0 1 0x0010 0 'Enable LED mode 2'}
43 | gpio_cdc_ledgpio : { rw 4 2 0x0010 0 'Set LED'}
44 | gpio_cdc_dipstatus : { ro 0 8 0x0014 0 'Read DIP signal status'}
45 |
46 | radio_source_enable : { rw 0 1 0x002C 1 'Enable the radio generator'}
47 | radio_sink_enable : { rw 1 1 0x002C 1 'Enable the radio error check mechanism'}
48 |
49 | app_scratch_reg_0 : { rw 0 16 0x0050 0 'Application message passing reg'}
50 | app_scratch_reg_1 : { rw 0 16 0x0054 0 'Application message passing reg'}
51 | app_scratch_reg_2 : { rw 0 16 0x0058 0 'Application message passing reg'}
52 | app_scratch_reg_3 : { rw 0 16 0x005C 0 'Application message passing reg'}
53 |
54 | ##-----------------------------------------------------------------------------
55 | ## ZCU102 DIP Switches (PL_DIP SW13)
56 | ##-----------------------------------------------------------------------------
57 | : ON : OFF
58 | DIP0 (8) : Loopback radio on : Loopback radio off
59 | DIP1 (7) :
60 | DIP2 (6) :
61 | DIP3 (5) :
62 | DIP4 (4) : Use DHCP for 10/100/1000 : Set fixed IP address for eth0.
63 | : connection eth0. : Master : 192.168.10.100
64 | : : Slave : 192.168.10.120
65 | DIP5 (3) : Enable PTP at boot :
66 | DIP6 (2) : Board should act as a : Board should act as a
67 | : remote slave : master device
68 | DIP7 (1) : LED mode 2 : LED mode 1
69 |
70 | DEMO Setup with PTP running. Connect to the Slave using DHCP.
71 | : MASTER : SLAVE :
72 | DIP0 (8) : |* | : | *| :
73 | DIP1 (7) : | *| : | *| :
74 | DIP2 (6) : | *| : | *| :
75 | DIP3 (5) : | *| : | *| :
76 | DIP4 (4) : | *| : |* | :
77 | DIP5 (3) : |* | : |* | :
78 | DIP6 (2) : | *| : |* | :
79 | DIP7 (1) : | *| : | *| :
80 |
81 | ##-----------------------------------------------------------------------------
82 | ## ZCU102 LED
83 | ## Mode 1/2 are selected using DIP7, see above.
84 | ##-----------------------------------------------------------------------------
85 | LED : Mode 1 : Mode 2
86 | 0 : Block lock : gpio_cdc_xxv_loopback
87 | 1 : gpio_cdc_ledgpio[0] : radio_cdc_loopback
88 | 2 : gpio_cdc_ledgpio[1] : radio_cdc_enable
89 | 3 : GT refclk toggle : radio_cdc_error
90 | 4 : XXV 75m clock toggle : radio_cdc_status
91 | 5 : AXI4 Lite clock toggle : 1’d0
92 | 6 : TX clock toggle : 1’d1
93 | 7 : RX clock toggle : 1’d1
94 |
95 | ##-----------------------------------------------------------------------------
96 | ## xroe-app
97 | ##-----------------------------------------------------------------------------
98 | ## Try the help using
99 | xroe-app -help
100 |
101 | ##-----------------------------------------------------------------------------
102 | ## Finding drivers, memory addr range and interface names
103 | ##-----------------------------------------------------------------------------
104 | ## Memory location
105 | cat /proc/iomem | grep framer
106 | ## Find drivers
107 | find /sys | grep drivers.* | grep ethernet
108 | ## Driver and IF is using
109 | basename $(readlink -f /sys/class/net/eth0/device/driver)
110 | ## Cross reference with
111 | ip addr
112 | ## Check the sysfs layout
113 | find /sys/kernel/xroe
114 | find /sys/kernel/xtraffic
115 |
116 | ##-----------------------------------------------------------------------------
117 | ## PTP
118 | ##-----------------------------------------------------------------------------
119 | ## Starting the Master
120 | ptp4l -m -A -i eth1 &
121 | ## Starting the Slave
122 | ptp4l -m -A -i eth1 -f ${XROEROOTDIR}/xroe-ptp4lsyncE.cfg -s &
123 |
124 | ##-----------------------------------------------------------------------------
125 | ## Add and Remove IP address, Manage MAC address
126 | ##-----------------------------------------------------------------------------
127 | ip addr add 192.168.99.44/24 dev eth1
128 | ip addr del 192.168.99.44/24 dev eth1
129 | ifconfig eth0 hw ether 02:01:02:03:04:08
130 |
131 | ## Editing files on the SDCard.
132 | ##
133 | ## Flush the SDCard. Ensure you Unmount the SDCard or force a flush using
134 | sync
135 |
136 | ##-----------------------------------------------------------------------------
137 | ## Check logs, use tail. You can also use watch (runs a commmand every -n secs)
138 | ## and build a custom devmem string. Very useful for debug.
139 | ##-----------------------------------------------------------------------------
140 | tail –n 50 /var/log/messages -f
141 | watch -n 1 " ifconfig | grep 'X packets' ; devmem 0xa000c000 ; devmem 0xa000c004 ; devmem 0xa000c008 ; devmem 0xa000c00c;"
142 |
143 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-printk_to.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | if [ ! -v $1 ]
3 | then
4 | echo "echo $1 to /proc/sys/kernel/printk"
5 | echo $1 > /proc/sys/kernel/printk
6 | else
7 | echo "No value given, exiting."
8 | fi
9 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-printk_to_6.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | echo 6 > /proc/sys/kernel/printk
3 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-printk_to_7.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | echo 7 > /proc/sys/kernel/printk
3 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-printk_to_8.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | echo 8 > /proc/sys/kernel/printk
3 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp4l.cfg:
--------------------------------------------------------------------------------
1 | [global]
2 | #
3 | # Default Data Set
4 | #
5 | twoStepFlag 1
6 | slaveOnly 0
7 | priority1 128
8 | priority2 128
9 | domainNumber 0
10 | clockClass 248
11 | clockAccuracy 0xFE
12 | offsetScaledLogVariance 0xFFFF
13 | free_running 0
14 | freq_est_interval 1
15 | #
16 | # Port Data Set
17 | #
18 | logAnnounceInterval 1
19 | logSyncInterval 0
20 | logMinDelayReqInterval 0
21 | logMinPdelayReqInterval 0
22 | announceReceiptTimeout 3
23 | syncReceiptTimeout 0
24 | delayAsymmetry 0
25 | fault_reset_interval 4
26 | neighborPropDelayThresh 20000000
27 | #
28 | # Run time options
29 | #
30 | assume_two_step 0
31 | logging_level 6
32 | path_trace_enabled 0
33 | follow_up_info 0
34 | tx_timestamp_timeout 200
35 | use_syslog 1
36 | verbose 0
37 | summary_interval 0
38 | kernel_leap 1
39 | check_fup_sync 0
40 | #
41 | # Servo Options
42 | #
43 | pi_proportional_const 0.0
44 | pi_integral_const 0.0
45 | pi_proportional_scale 0.0
46 | pi_proportional_exponent -0.3
47 | pi_proportional_norm_max 0.7
48 | pi_integral_scale 0.0
49 | pi_integral_exponent 0.4
50 | pi_integral_norm_max 0.3
51 | step_threshold 000000002
52 | first_step_threshold 0.00002
53 | max_frequency 900000000
54 | clock_servo pi
55 | sanity_freq_limit 200000000
56 | ntpshm_segment 0
57 | #
58 | # Transport options
59 | #
60 | transportSpecific 0x0
61 | ptp_dst_mac 01:1B:19:00:00:00
62 | p2p_dst_mac 01:80:C2:00:00:0E
63 | udp6_scope 0x0E
64 | uds_address /var/run/ptp4l
65 | #
66 | # Default interface options
67 | #
68 | network_transport UDPv4
69 | delay_mechanism E2E
70 | time_stamping hardware
71 | delay_filter moving_median
72 | delay_filter_length 10
73 | egressLatency 0
74 | ingressLatency 0
75 | boundary_clock_jbod 0
76 | #
77 | # Clock description
78 | #
79 | productDescription ;;
80 | revisionData ;;
81 | manufacturerIdentity 00:00:00
82 | userDescription ;
83 | timeSource 0xA0
84 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp4lsyncE.cfg:
--------------------------------------------------------------------------------
1 | [global]
2 | #
3 | # Default Data Set
4 | #
5 | twoStepFlag 1
6 | slaveOnly 0
7 | priority1 128
8 | priority2 128
9 | domainNumber 0
10 | clockClass 248
11 | clockAccuracy 0xFE
12 | offsetScaledLogVariance 0xFFFF
13 | free_running 0
14 | freq_est_interval 1
15 | #
16 | # Port Data Set
17 | # 16 TS a second use logSyncInterval -4
18 | #
19 | logAnnounceInterval 1
20 | logSyncInterval 0
21 | logMinDelayReqInterval 0
22 | logMinPdelayReqInterval 0
23 | announceReceiptTimeout 3
24 | syncReceiptTimeout 0
25 | delayAsymmetry 0
26 | fault_reset_interval 4
27 | neighborPropDelayThresh 20000000
28 | #
29 | # Run time options
30 | #
31 | assume_two_step 0
32 | logging_level 6
33 | path_trace_enabled 0
34 | follow_up_info 0
35 | tx_timestamp_timeout 200
36 | use_syslog 1
37 | verbose 0
38 | summary_interval 0
39 | kernel_leap 1
40 | check_fup_sync 0
41 | #
42 | # Servo Options
43 | #
44 | pi_proportional_const 0.0
45 | pi_integral_const 0.0
46 | pi_proportional_scale 0.0
47 | pi_proportional_exponent -0.3
48 | pi_proportional_norm_max 0.7
49 | pi_integral_scale 0.0
50 | pi_integral_exponent 0.4
51 | pi_integral_norm_max 0.3
52 | step_threshold 0.00000002
53 | first_step_threshold 0.00002
54 | max_frequency 900000000
55 | clock_servo nullf
56 | sanity_freq_limit 200000000
57 | ntpshm_segment 0
58 | #
59 | # Transport options
60 | #
61 | transportSpecific 0x0
62 | ptp_dst_mac 01:1B:19:00:00:00
63 | p2p_dst_mac 01:80:C2:00:00:0E
64 | udp6_scope 0x0E
65 | uds_address /var/run/ptp4l
66 | #
67 | # Default interface options
68 | #
69 | network_transport UDPv4
70 | delay_mechanism E2E
71 | time_stamping hardware
72 | delay_filter moving_median
73 | delay_filter_length 10
74 | egressLatency 0
75 | ingressLatency 0
76 | boundary_clock_jbod 0
77 | #
78 | # Clock description
79 | #
80 | productDescription ;;
81 | revisionData ;;
82 | manufacturerIdentity 00:00:00
83 | userDescription ;
84 | timeSource 0xA0
85 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp_killall.sh:
--------------------------------------------------------------------------------
1 | killall ptp4l
2 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp_mas.sh:
--------------------------------------------------------------------------------
1 | ptp4l -m -A -i eth1 -f /usr/bin/xroe-ptp4l.cfg &
2 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp_slv.sh:
--------------------------------------------------------------------------------
1 | ptp4l -m -A -i eth1 -s -f /usr/bin/xroe-ptp4l.cfg &
2 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-ptp_slv_synce.sh:
--------------------------------------------------------------------------------
1 | ptp4l -m -A -i eth1 -f /usr/bin/xroe-ptp4lsyncE.cfg -s &
2 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-report-mod-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | dmesg | grep -e ptp -e axie -e roe -e ROE
3 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-run-ptpSyncE.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | xroe-config-XXV-ptp.sh
3 | ptp4l -m -A -i eth1 -f /usr/bin/xroe-ptp4lsyncE.cfg -s
4 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-startup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | USERSDROOTDIR=/run/media/mmcblk0p1/xroe/
3 | PRESTARTUPSLEEPPERIOD=2
4 | POSTSTARTUPSLEEPPERIOD=1
5 | LOGGER="/usr/bin/logger -t $0"
6 |
7 | sleep $PRESTARTUPSLEEPPERIOD
8 | $LOGGER "********************************************************************"
9 | $LOGGER "** Xilinx roe_framer demonstration platform application loader **"
10 | $LOGGER "********************************************************************"
11 | sleep $POSTSTARTUPSLEEPPERIOD
12 |
13 | ## ----------------------------------------------------------------------------
14 | ## Check if there is a xroe Directory on the SD card. If there is run from
15 | ## this instead of the onboard scripts.
16 | ## ----------------------------------------------------------------------------
17 | if [ ! -e $USERSDROOTDIR ]; then
18 | USERSDROOTDIR=/usr/bin
19 | fi
20 |
21 | ## ----------------------------------------------------------------------------
22 | ## Path to main runscript
23 | ## ----------------------------------------------------------------------------
24 | USERBOOTRUNSCRIPTFILE=$USERSDROOTDIR/runXroe.bash
25 |
26 | ## ----------------------------------------------------------------------------
27 | ## Start the runManager if it exists. The user can stop it running by creating
28 | ## an empty directory on the SD card,
29 | ## /run/media/mmcblk0p1/xroe
30 | ## ----------------------------------------------------------------------------
31 | if [ ! -e $USERBOOTRUNSCRIPTFILE ]; then
32 | echo "File $USERBOOTRUNSCRIPTFILE does not exist."
33 | else
34 | echo "User startup script $USERBOOTRUNSCRIPTFILE exists. Executing,"
35 | $USERBOOTRUNSCRIPTFILE
36 | fi
37 |
38 | ## Forever loop
39 | while [ 1 ];
40 | do
41 | sleep 10
42 | done
43 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-xxv-down.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #ipAddr="192.168.99.10"
4 | eTag="eth1"
5 |
6 | if [ ! -v $1 ]
7 | then
8 | eTag=$1
9 | else
10 | echo "No Eth Interface given using ${eTag}."
11 | fi
12 |
13 | echo "Set XXV Ethernet link ${eTag} down..."
14 | ip link set dev ${eTag} down
15 |
16 | #ip addr
17 |
--------------------------------------------------------------------------------
/src/xroe-scripts/xroe-xxv-up.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #ipAddr="192.168.99.10"
4 | eTag="eth1"
5 |
6 | if [ ! -v $1 ]
7 | then
8 | eTag=$1
9 | else
10 | echo "No Eth Interface given using ${eTag}."
11 | fi
12 |
13 | echo "Set XXV Ethernet link ${eTag} up..."
14 | ip link set dev ${eTag} up
15 |
16 | #ip addr
17 |
--------------------------------------------------------------------------------
/src/xtraffic/Makefile:
--------------------------------------------------------------------------------
1 | obj-m := traffic.o
2 | traffic-y := xroe_traffic.o xroe_traffic_utils.o sysfs_xroe_traffic_config.o
3 |
4 | ccflags-y := -IInclude
5 |
6 | SRC := $(shell pwd)
7 |
8 | all:
9 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC)
10 |
11 | modules_install:
12 | $(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
13 |
14 | clean:
15 | rm -f *.o *~ core .depend .*.cmd *.ko *.mod.c
16 | rm -f Module.markers Module.symvers modules.order
17 | rm -rf .tmp_versions Modules.symvers
18 |
--------------------------------------------------------------------------------
/src/xtraffic/README.md:
--------------------------------------------------------------------------------
1 | Xilinx Radio over Ethernet Traffic Generator driver
2 | ===================================================
3 |
4 | About the RoE Framer Traffic Generator
5 |
6 | The Traffic Generator is used for in testing of other RoE IP Blocks (currenty
7 | the XRoE Framer) and simulates an radio antenna interface. It generates rolling
8 | rampdata for eCPRI antenna paths. Each path is tagged with the antenna number.
9 | The sink locks to this ramp data, then checks the next value is as expected.
10 |
11 |
12 | About the Linux Driver
13 |
14 | The RoE Traffic Generator Linux Driver provides sysfs access to control a
15 | simulated radio antenna interface.
16 | The loading of the driver to the hardware is possible using Device Tree binding
17 | (see "dt-binding.txt" for more information). When the driver is loaded, the
18 | general controls (such as sink lock, enable, loopback etc) are exposed
19 | under /sys/kernel/xroetrafficgen.
20 |
--------------------------------------------------------------------------------
/src/xtraffic/roe_radio_ctrl.h:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*-----------------------------------------------------------------------------
3 | * C Header bank BASE definitions
4 | *------------------------------------------------------------------------------
5 | */
6 | #define ROE_RADIO_CFG_BASE_ADDR 0x0 /* 0 */
7 | #define ROE_RADIO_SOURCE_BASE_ADDR 0x1000 /* 4096 */
8 |
9 | /*-----------------------------------------------------------------------------
10 | * C Header bank register definitions for bank roe_radio_cfg
11 | * with prefix radio_ @ address 0x0
12 | *------------------------------------------------------------------------------
13 | */
14 | /* Type = roInt */
15 | #define RADIO_ID_ADDR 0x0 /* 0 */
16 | #define RADIO_ID_MASK 0xffffffff /* 4294967295 */
17 | #define RADIO_ID_OFFSET 0x0 /* 0 */
18 | #define RADIO_ID_WIDTH 0x20 /* 32 */
19 | #define RADIO_ID_DEFAULT 0x120001 /* 1179649 */
20 |
21 | /* Type = rw */
22 | #define RADIO_TIMEOUT_ENABLE_ADDR 0x4 /* 4 */
23 | #define RADIO_TIMEOUT_ENABLE_MASK 0x1 /* 1 */
24 | #define RADIO_TIMEOUT_ENABLE_OFFSET 0x0 /* 0 */
25 | #define RADIO_TIMEOUT_ENABLE_WIDTH 0x1 /* 1 */
26 | #define RADIO_TIMEOUT_ENABLE_DEFAULT 0x0 /* 0 */
27 |
28 | /* Type = ro */
29 | #define RADIO_TIMEOUT_STATUS_ADDR 0x8 /* 8 */
30 | #define RADIO_TIMEOUT_STATUS_MASK 0x1 /* 1 */
31 | #define RADIO_TIMEOUT_STATUS_OFFSET 0x0 /* 0 */
32 | #define RADIO_TIMEOUT_STATUS_WIDTH 0x1 /* 1 */
33 | #define RADIO_TIMEOUT_STATUS_DEFAULT 0x1 /* 1 */
34 |
35 | /* Type = rw */
36 | #define RADIO_TIMEOUT_VALUE_ADDR 0xc /* 12 */
37 | #define RADIO_TIMEOUT_VALUE_MASK 0xfff /* 4095 */
38 | #define RADIO_TIMEOUT_VALUE_OFFSET 0x0 /* 0 */
39 | #define RADIO_TIMEOUT_VALUE_WIDTH 0xc /* 12 */
40 | #define RADIO_TIMEOUT_VALUE_DEFAULT 0x80 /* 128 */
41 |
42 | /* Type = rw */
43 | #define RADIO_GPIO_CDC_LEDMODE2_ADDR 0x10 /* 16 */
44 | #define RADIO_GPIO_CDC_LEDMODE2_MASK 0x1 /* 1 */
45 | #define RADIO_GPIO_CDC_LEDMODE2_OFFSET 0x0 /* 0 */
46 | #define RADIO_GPIO_CDC_LEDMODE2_WIDTH 0x1 /* 1 */
47 | #define RADIO_GPIO_CDC_LEDMODE2_DEFAULT 0x0 /* 0 */
48 |
49 | /* Type = rw */
50 | #define RADIO_GPIO_CDC_LEDGPIO_ADDR 0x10 /* 16 */
51 | #define RADIO_GPIO_CDC_LEDGPIO_MASK 0x30 /* 48 */
52 | #define RADIO_GPIO_CDC_LEDGPIO_OFFSET 0x4 /* 4 */
53 | #define RADIO_GPIO_CDC_LEDGPIO_WIDTH 0x2 /* 2 */
54 | #define RADIO_GPIO_CDC_LEDGPIO_DEFAULT 0x0 /* 0 */
55 |
56 | /* Type = roSig */
57 | #define RADIO_GPIO_CDC_DIPSTATUS_ADDR 0x14 /* 20 */
58 | #define RADIO_GPIO_CDC_DIPSTATUS_MASK 0xff /* 255 */
59 | #define RADIO_GPIO_CDC_DIPSTATUS_OFFSET 0x0 /* 0 */
60 | #define RADIO_GPIO_CDC_DIPSTATUS_WIDTH 0x8 /* 8 */
61 | #define RADIO_GPIO_CDC_DIPSTATUS_DEFAULT 0x0 /* 0 */
62 |
63 | /* Type = wPlsH */
64 | #define RADIO_SW_TRIGGER_ADDR 0x20 /* 32 */
65 | #define RADIO_SW_TRIGGER_MASK 0x1 /* 1 */
66 | #define RADIO_SW_TRIGGER_OFFSET 0x0 /* 0 */
67 | #define RADIO_SW_TRIGGER_WIDTH 0x1 /* 1 */
68 | #define RADIO_SW_TRIGGER_DEFAULT 0x0 /* 0 */
69 |
70 | /* Type = rw */
71 | #define RADIO_CDC_ENABLE_ADDR 0x24 /* 36 */
72 | #define RADIO_CDC_ENABLE_MASK 0x1 /* 1 */
73 | #define RADIO_CDC_ENABLE_OFFSET 0x0 /* 0 */
74 | #define RADIO_CDC_ENABLE_WIDTH 0x1 /* 1 */
75 | #define RADIO_CDC_ENABLE_DEFAULT 0x0 /* 0 */
76 |
77 | /* Type = roSig */
78 | #define RADIO_CDC_ERROR_ADDR 0x24 /* 36 */
79 | #define RADIO_CDC_ERROR_MASK 0x2 /* 2 */
80 | #define RADIO_CDC_ERROR_OFFSET 0x1 /* 1 */
81 | #define RADIO_CDC_ERROR_WIDTH 0x1 /* 1 */
82 | #define RADIO_CDC_ERROR_DEFAULT 0x0 /* 0 */
83 |
84 | /* Type = roSig */
85 | #define RADIO_CDC_STATUS_ADDR 0x24 /* 36 */
86 | #define RADIO_CDC_STATUS_MASK 0x4 /* 4 */
87 | #define RADIO_CDC_STATUS_OFFSET 0x2 /* 2 */
88 | #define RADIO_CDC_STATUS_WIDTH 0x1 /* 1 */
89 | #define RADIO_CDC_STATUS_DEFAULT 0x0 /* 0 */
90 |
91 | /* Type = rw */
92 | #define RADIO_CDC_LOOPBACK_ADDR 0x28 /* 40 */
93 | #define RADIO_CDC_LOOPBACK_MASK 0x1 /* 1 */
94 | #define RADIO_CDC_LOOPBACK_OFFSET 0x0 /* 0 */
95 | #define RADIO_CDC_LOOPBACK_WIDTH 0x1 /* 1 */
96 | #define RADIO_CDC_LOOPBACK_DEFAULT 0x0 /* 0 */
97 |
98 | /* Type = rw */
99 | #define RADIO_SOURCE_ENABLE_ADDR 0x2c /* 44 */
100 | #define RADIO_SOURCE_ENABLE_MASK 0x1 /* 1 */
101 | #define RADIO_SOURCE_ENABLE_OFFSET 0x0 /* 0 */
102 | #define RADIO_SOURCE_ENABLE_WIDTH 0x1 /* 1 */
103 | #define RADIO_SOURCE_ENABLE_DEFAULT 0x1 /* 1 */
104 |
105 | /* Type = rw */
106 | #define RADIO_SINK_ENABLE_ADDR 0x2c /* 44 */
107 | #define RADIO_SINK_ENABLE_MASK 0x2 /* 2 */
108 | #define RADIO_SINK_ENABLE_OFFSET 0x1 /* 1 */
109 | #define RADIO_SINK_ENABLE_WIDTH 0x1 /* 1 */
110 | #define RADIO_SINK_ENABLE_DEFAULT 0x1 /* 1 */
111 |
112 | /* Type = roSig */
113 | #define RADIO_CDC_ERROR_31_0_ADDR 0x30 /* 48 */
114 | #define RADIO_CDC_ERROR_31_0_MASK 0xffffffff /* 4294967295 */
115 | #define RADIO_CDC_ERROR_31_0_OFFSET 0x0 /* 0 */
116 | #define RADIO_CDC_ERROR_31_0_WIDTH 0x20 /* 32 */
117 | #define RADIO_CDC_ERROR_31_0_DEFAULT 0x0 /* 0 */
118 |
119 | /* Type = roSig */
120 | #define RADIO_CDC_ERROR_63_32_ADDR 0x34 /* 52 */
121 | #define RADIO_CDC_ERROR_63_32_MASK 0xffffffff /* 4294967295 */
122 | #define RADIO_CDC_ERROR_63_32_OFFSET 0x0 /* 0 */
123 | #define RADIO_CDC_ERROR_63_32_WIDTH 0x20 /* 32 */
124 | #define RADIO_CDC_ERROR_63_32_DEFAULT 0x0 /* 0 */
125 |
126 | /* Type = roSig */
127 | #define RADIO_CDC_ERROR_95_64_ADDR 0x38 /* 56 */
128 | #define RADIO_CDC_ERROR_95_64_MASK 0xffffffff /* 4294967295 */
129 | #define RADIO_CDC_ERROR_95_64_OFFSET 0x0 /* 0 */
130 | #define RADIO_CDC_ERROR_95_64_WIDTH 0x20 /* 32 */
131 | #define RADIO_CDC_ERROR_95_64_DEFAULT 0x0 /* 0 */
132 |
133 | /* Type = roSig */
134 | #define RADIO_CDC_ERROR_127_96_ADDR 0x3c /* 60 */
135 | #define RADIO_CDC_ERROR_127_96_MASK 0xffffffff /* 4294967295 */
136 | #define RADIO_CDC_ERROR_127_96_OFFSET 0x0 /* 0 */
137 | #define RADIO_CDC_ERROR_127_96_WIDTH 0x20 /* 32 */
138 | #define RADIO_CDC_ERROR_127_96_DEFAULT 0x0 /* 0 */
139 |
140 | /* Type = roSig */
141 | #define RADIO_CDC_STATUS_31_0_ADDR 0x40 /* 64 */
142 | #define RADIO_CDC_STATUS_31_0_MASK 0xffffffff /* 4294967295 */
143 | #define RADIO_CDC_STATUS_31_0_OFFSET 0x0 /* 0 */
144 | #define RADIO_CDC_STATUS_31_0_WIDTH 0x20 /* 32 */
145 | #define RADIO_CDC_STATUS_31_0_DEFAULT 0x0 /* 0 */
146 |
147 | /* Type = roSig */
148 | #define RADIO_CDC_STATUS_63_32_ADDR 0x44 /* 68 */
149 | #define RADIO_CDC_STATUS_63_32_MASK 0xffffffff /* 4294967295 */
150 | #define RADIO_CDC_STATUS_63_32_OFFSET 0x0 /* 0 */
151 | #define RADIO_CDC_STATUS_63_32_WIDTH 0x20 /* 32 */
152 | #define RADIO_CDC_STATUS_63_32_DEFAULT 0x0 /* 0 */
153 |
154 | /* Type = roSig */
155 | #define RADIO_CDC_STATUS_95_64_ADDR 0x48 /* 72 */
156 | #define RADIO_CDC_STATUS_95_64_MASK 0xffffffff /* 4294967295 */
157 | #define RADIO_CDC_STATUS_95_64_OFFSET 0x0 /* 0 */
158 | #define RADIO_CDC_STATUS_95_64_WIDTH 0x20 /* 32 */
159 | #define RADIO_CDC_STATUS_95_64_DEFAULT 0x0 /* 0 */
160 |
161 | /* Type = roSig */
162 | #define RADIO_CDC_STATUS_127_96_ADDR 0x4c /* 76 */
163 | #define RADIO_CDC_STATUS_127_96_MASK 0xffffffff /* 4294967295 */
164 | #define RADIO_CDC_STATUS_127_96_OFFSET 0x0 /* 0 */
165 | #define RADIO_CDC_STATUS_127_96_WIDTH 0x20 /* 32 */
166 | #define RADIO_CDC_STATUS_127_96_DEFAULT 0x0 /* 0 */
167 |
168 | /* Type = rwInt */
169 | #define RADIO_APP_SCRATCH_REG_0_ADDR 0x50 /* 80 */
170 | #define RADIO_APP_SCRATCH_REG_0_MASK 0xffff /* 65535 */
171 | #define RADIO_APP_SCRATCH_REG_0_OFFSET 0x0 /* 0 */
172 | #define RADIO_APP_SCRATCH_REG_0_WIDTH 0x10 /* 16 */
173 | #define RADIO_APP_SCRATCH_REG_0_DEFAULT 0x0 /* 0 */
174 |
175 | /* Type = rwInt */
176 | #define RADIO_APP_SCRATCH_REG_1_ADDR 0x54 /* 84 */
177 | #define RADIO_APP_SCRATCH_REG_1_MASK 0xffff /* 65535 */
178 | #define RADIO_APP_SCRATCH_REG_1_OFFSET 0x0 /* 0 */
179 | #define RADIO_APP_SCRATCH_REG_1_WIDTH 0x10 /* 16 */
180 | #define RADIO_APP_SCRATCH_REG_1_DEFAULT 0x0 /* 0 */
181 |
182 | /* Type = rwInt */
183 | #define RADIO_APP_SCRATCH_REG_2_ADDR 0x58 /* 88 */
184 | #define RADIO_APP_SCRATCH_REG_2_MASK 0xffff /* 65535 */
185 | #define RADIO_APP_SCRATCH_REG_2_OFFSET 0x0 /* 0 */
186 | #define RADIO_APP_SCRATCH_REG_2_WIDTH 0x10 /* 16 */
187 | #define RADIO_APP_SCRATCH_REG_2_DEFAULT 0x0 /* 0 */
188 |
189 | /* Type = rwInt */
190 | #define RADIO_APP_SCRATCH_REG_3_ADDR 0x5c /* 92 */
191 | #define RADIO_APP_SCRATCH_REG_3_MASK 0xffff /* 65535 */
192 | #define RADIO_APP_SCRATCH_REG_3_OFFSET 0x0 /* 0 */
193 | #define RADIO_APP_SCRATCH_REG_3_WIDTH 0x10 /* 16 */
194 | #define RADIO_APP_SCRATCH_REG_3_DEFAULT 0x0 /* 0 */
195 |
196 |
197 | /*-----------------------------------------------------------------------------
198 | * C Header bank register definitions for bank roe_radio_source
199 | * with prefix fram_ @ address 0x1000
200 | *------------------------------------------------------------------------------
201 | */
202 | /* Type = rwpdef */
203 | #define FRAM_PACKET_DATA_SIZE_ADDR 0x1000 /* 4096 */
204 | #define FRAM_PACKET_DATA_SIZE_MASK 0x7f /* 127 */
205 | #define FRAM_PACKET_DATA_SIZE_OFFSET 0x0 /* 0 */
206 | #define FRAM_PACKET_DATA_SIZE_WIDTH 0x7 /* 7 */
207 | #define FRAM_PACKET_DATA_SIZE_DEFAULT 0x0 /* 0 */
208 |
209 | /* Type = rwpdef */
210 | #define FRAM_PAUSE_DATA_SIZE_ADDR 0x1004 /* 4100 */
211 | #define FRAM_PAUSE_DATA_SIZE_MASK 0x7f /* 127 */
212 | #define FRAM_PAUSE_DATA_SIZE_OFFSET 0x0 /* 0 */
213 | #define FRAM_PAUSE_DATA_SIZE_WIDTH 0x7 /* 7 */
214 | #define FRAM_PAUSE_DATA_SIZE_DEFAULT 0x0 /* 0 */
215 |
216 |
217 |
--------------------------------------------------------------------------------
/src/xtraffic/xroe_traffic.c:
--------------------------------------------------------------------------------
1 | // SPDX-License-Identifier: GPL-2.0
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include "xroe_traffic.h"
22 |
23 | #define DRIVER_NAME "traffic"
24 |
25 | /*
26 | * TODO: to be made static as well, so that multiple instances can be used. As
27 | * of now, the "lp" structure is shared among the multiple source files
28 | */
29 | struct traffic_local *lp;
30 | static struct platform_driver traffic_driver;
31 | /*
32 | * TODO: placeholder for the IRQ once it's been implemented
33 | * in the traffic block
34 | */
35 | static irqreturn_t traffic_irq(int irq, void *lp)
36 | {
37 | return IRQ_HANDLED;
38 | }
39 |
40 | /**
41 | * traffic_probe - Probes the device tree to locate the traffic block
42 | * @pdev: The structure containing the device's details
43 | *
44 | * Probes the device tree to locate the traffic block and maps it to
45 | * the kernel virtual memory space
46 | *
47 | * Return: 0 on success or a negative errno on error.
48 | */
49 | static int traffic_probe(struct platform_device *pdev)
50 | {
51 | struct resource *r_mem; /* IO mem resources */
52 | struct resource *r_irq;
53 | struct device *dev = &pdev->dev;
54 | int rc = 0;
55 |
56 | dev_dbg(dev, "Device Tree Probing\n");
57 | lp = devm_kzalloc(&pdev->dev, sizeof(*lp), GFP_KERNEL);
58 | if (!lp)
59 | return -ENOMEM;
60 |
61 | /* Get iospace for the device */
62 | r_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
63 | lp->base_addr = devm_ioremap_resource(&pdev->dev, r_mem);
64 | if (IS_ERR(lp->base_addr))
65 | return PTR_ERR(lp->base_addr);
66 |
67 | dev_set_drvdata(dev, lp);
68 | xroe_sysfs_init();
69 | /* Get IRQ for the device */
70 | /*
71 | * TODO: No IRQ *yet* in the DT from the traffic block, as it's still
72 | * under development. To be added once it's in the block, and also
73 | * replace with platform_get_irq_byname()
74 | */
75 | r_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
76 | if (IS_ERR(r_irq)) {
77 | dev_info(dev, "no IRQ found\n");
78 | /*
79 | * TODO: Return non-zero (error) code on no IRQ found.
80 | * To be implemented once the IRQ is in the block
81 | */
82 | return 0;
83 | }
84 | rc = devm_request_irq(dev, lp->irq, &traffic_irq, 0, DRIVER_NAME, lp);
85 | if (rc) {
86 | dev_err(dev, "testmodule: Could not allocate interrupt %d.\n",
87 | lp->irq);
88 | /*
89 | * TODO: Return non-zero (error) code on no IRQ found.
90 | * To be implemented once the IRQ is in the block
91 | */
92 | return 0;
93 | }
94 |
95 | return rc;
96 | }
97 |
98 | /**
99 | * traffic_init - Registers the driver
100 | *
101 | * Return: 0 on success, -1 on allocation error
102 | *
103 | * Registers the traffic driver and creates character device drivers
104 | * for the whole block, as well as separate ones for stats and
105 | * radio control.
106 | */
107 | static int __init traffic_init(void)
108 | {
109 | int ret;
110 |
111 | pr_debug("XROE traffic driver init\n");
112 |
113 | ret = platform_driver_register(&traffic_driver);
114 |
115 | return ret;
116 | }
117 |
118 | /**
119 | * traffic_exit - Destroys the driver
120 | *
121 | * Unregisters the traffic driver and destroys the character
122 | * device driver for the whole block, as well as the separate ones
123 | * for stats and radio control. Returns 0 upon successful execution
124 | */
125 | static void __exit traffic_exit(void)
126 | {
127 | xroe_sysfs_exit();
128 | platform_driver_unregister(&traffic_driver);
129 | pr_info("XROE traffic exit\n");
130 | }
131 |
132 | module_init(traffic_init);
133 | module_exit(traffic_exit);
134 |
135 | static const struct of_device_id traffic_of_match[] = {
136 | { .compatible = "xlnx,roe-traffic-2.0", },
137 | { /* end of list */ },
138 | };
139 | MODULE_DEVICE_TABLE(of, traffic_of_match);
140 |
141 | static struct platform_driver traffic_driver = {
142 | .driver = {
143 | /*
144 | * TODO: .name shouldn't be necessary, though removing
145 | * it results in kernel panic. To investigate further
146 | */
147 | .name = DRIVER_NAME,
148 | .of_match_table = traffic_of_match,
149 | },
150 | .probe = traffic_probe,
151 | };
152 |
153 | MODULE_LICENSE("GPL v2");
154 | MODULE_AUTHOR("Xilinx Inc.");
155 | MODULE_DESCRIPTION("traffic - Xilinx Radio over Ethernet traffic driver");
156 |
--------------------------------------------------------------------------------
/src/xtraffic/xroe_traffic.h:
--------------------------------------------------------------------------------
1 | /* SPDX-License-Identifier: GPL-2.0 */
2 | /*
3 | * Copyright (C) 2018 Xilinx, Inc.
4 | *
5 | * Vasileios Bimpikas
6 | */
7 | #include "roe_radio_ctrl.h"
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include