TSN参考链接: link
xilinx内核TSN kernel代码链接: link
petalinux-config -c kernel选择如下:
TSN PL端设备树配置代码
tsn0_axi_firewall_0: axi_firewall@a0020000 {
clock-names = "aclk";
clocks = <&misc_clk_0>;
compatible = "xlnx,axi-firewall-1.2";
reg = <0x0 0xa0020000 0x0 0x1000>;
xlnx,addr-width = <0x20>;
xlnx,aruser-width = <0x0>;
xlnx,awuser-width = <0x0>;
xlnx,buser-width = <0x0>;
xlnx,enable-ctl-clock = <0x0>;
xlnx,enable-initial-delay = <0x1>;
xlnx,enable-pipelining = <0x1>;
xlnx,enable-prescaler = <0x1>;
xlnx,enable-protocol-checks = <0x1>;
xlnx,enable-timeout-checks = <0x1>;
xlnx,firewall-mode = <0x0>;
xlnx,id-width = <0x0>;
xlnx,mask-err-resp = <0x0>;
xlnx,num-read-outstanding = <0x8>;
xlnx,num-read-threads = <0x1>;
xlnx,num-write-outstanding = <0x8>;
xlnx,num-write-threads = <0x1>;
xlnx,protocol = <0x2>;
xlnx,rdata-width = <0x20>;
xlnx,ruser-width = <0x0>;
xlnx,wdata-width = <0x20>;
xlnx,wuser-width = <0x0>;
};
tsn0_axi_intc_0: interrupt-controller@a2001000 {
#interrupt-cells = <2>;
clock-names = "s_axi_aclk";
clocks = <&misc_clk_0>;
compatible = "xlnx,axi-intc-4.1", "xlnx,xps-intc-1.00.a";
interrupt-controller ;
interrupt-names = "irq";
interrupt-parent = <&gic>;
interrupts = <0 89 4>;
reg = <0x0 0xa2001000 0x0 0x1000>;
xlnx,kind-of-intr = <0x2a>;
xlnx,num-intr-inputs = <0xf>;
};
tsn0_axi_mcdma_0: axi_mcdma@a2000000 {
#dma-cells = <1>;
clock-names = "s_axi_aclk", "s_axi_lite_aclk";
clocks = <&misc_clk_0>, <&misc_clk_0>;
compatible = "xlnx,eth-dma";
interrupt-names = "mm2s_ch1_introut", "mm2s_ch2_introut", "s2mm_ch1_introut", "s2mm_ch2_introut", "s2mm_ch3_introut", "s2mm_ch4_introut";
interrupt-parent = <&tsn0_axi_intc_0>;
interrupts = <9 2 10 2 11 2 12 2 13 2 14 2>;
reg = <0x0 0xa2000000 0x0 0x1000>;
xlnx,addrwidth = <0x20>;
xlnx,dlytmr-resolution = <0x7d>;
xlnx,enable-single-intr = <0x0>;
xlnx,group1-mm2s = <0xb>;
xlnx,group1-s2mm = <0x457>;
xlnx,group2-mm2s = <0x0>;
xlnx,group2-s2mm = <0x0>;
xlnx,group3-mm2s = <0x0>;
xlnx,group3-s2mm = <0x0>;
xlnx,group4-mm2s = <0x0>;
xlnx,group4-s2mm = <0x0>;
xlnx,group5-mm2s = <0x0>;
xlnx,group5-s2mm = <0x0>;
xlnx,group6-mm2s = <0x0>;
xlnx,group6-s2mm = <0x0>;
xlnx,include-dre ;
xlnx,include-mm2s = <0x1>;
xlnx,include-mm2s-dre = <0x1>;
xlnx,include-mm2s-sf = <0x1>;
xlnx,include-s2mm = <0x1>;
xlnx,include-s2mm-dre = <0x1>;
xlnx,include-s2mm-sf = <0x1>;
xlnx,include-sg ;
xlnx,mm2s-burst-size = <0x10>;
xlnx,mm2s-scheduler = <0x0>;
xlnx,num-mm2s-channels = <0x2>;
xlnx,num-s2mm-channels = <0x4>;
xlnx,prmry-is-aclk-async = <0x0>;
xlnx,s2mm-burst-size = <0x10>;
xlnx,sg-include-stscntrl-strm = <0x0>;
xlnx,sg-length-width = <0xe>;
xlnx,sg-use-stsapp-length = <0x0>;
dma-channel@a2000000 {
compatible = "xlnx,axi-dma-mm2s-channel";
dma-channels = <0x2>;
interrupt-parent = <&tsn0_axi_intc_0>;
interrupts = <9 2 10 2>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
xlnx,include-dre ;
};
dma-channel@a2000030 {
compatible = "xlnx,axi-dma-s2mm-channel";
dma-channels = <0x4>;
interrupt-parent = <&tsn0_axi_intc_0>;
interrupts = <11 2 12 2 13 2 14 2>;
xlnx,datawidth = <0x20>;
xlnx,device-id = <0x0>;
xlnx,include-dre ;
};
};
tsn_endpoint_ip_0: tsn_endpoint_ip_0 {
#address-cells = <2>;
#size-cells = <2>;
clock-names = "host_txfifo_aclk", "host_rxfifo_aclk", "s_axi_aclk", "gtx_clk", "gtx_clk90", "refclk";
clocks = <&misc_clk_0>, <&misc_clk_0>, <&misc_clk_0>, <&misc_clk_1>, <&misc_clk_1>, <&misc_clk_2>;
compatible = "xlnx,tsn-endpoint-ethernet-mac-2.0";
interrupt-names = "interrupt_ptp_rx_1", "interrupt_ptp_tx_1", "mac_irq_1", "tsn_ep_scheduler_irq", "interrupt_ptp_timer";
interrupt-parent = <&tsn1_axi_intc_0>;
interrupts = <0 2 2 2 4 2 7 2 6 2>;
ranges ;
reg = <0x0 0xb0000000 0x0 0x20000>;
};
misc_clk_1: misc_clk_1 {
#clock-cells = <0>;
clock-frequency = <125000000>;
compatible = "fixed-clock";
};
misc_clk_2: misc_clk_2 {
#clock-cells = <0>;
clock-frequency = <300000000>;
compatible = "fixed-clock";
};
tsn0_ta_dma_0: ta_dma@a1000000 {
clock-names = "dma_clk", "rtc_clk";
clocks = <&misc_clk_0>, <&misc_clk_1>;
compatible = "xlnx,ta-dma-1.0";
interrupt-names = "introut";
interrupt-parent = <&tsn0_axi_intc_0>;
interrupts = <8 2>;
reg = <0x0 0xa1000000 0x0 0x800000>;
xlnx,en-debug = <0x0>;
xlnx,en-int-store-and-fwd = <0x1>;
xlnx,en-statistics = <0x1>;
xlnx,en-unaligined-addr-support = "true";
xlnx,num-buffers-per-stream = <0x40>;
xlnx,num-fetch-entries = <0x8>;
xlnx,num-streams = <0x8>;
};
tsn_talker功能测试:
UDP Socket功能测试:
安装IPIC module:
insmod /lib/modules/5.15.0-xilinx-v2022.1/extra/xilinx_tsn_ip_intercept.ko IPv4_tuple=1,1,0,0,1,1
标签:TSN,MPsoc,petalinux22.2,clock,s2mm,mm2s,interrupt,xlnx,axi
From: https://blog.csdn.net/yiyi201200/article/details/140774741