S90_start_profinet.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. #
  3. # Initialization script for automatic
  4. # start of the pn_lan9662 sample application.
  5. # Copy this script to overlay/etc/init.d/
  6. # to start the application automatically.
  7. #
  8. start() {
  9. # Assume a valid partition on /dev/mmcblk0p2
  10. mkdir /tmp/pn_data
  11. mount -o sync /dev/mmcblk0p2 /tmp/pn_data
  12. echo "Configure network settings for pn_lan9662 profinet sample application"
  13. # Create bridge
  14. ip link add name br0 type bridge
  15. symreg ANA_PGID[61] 0x1ff
  16. ip link set br0 address 12:A9:2D:16:93:89
  17. ip link set br0 up
  18. sysctl -w net.ipv6.conf.br0.disable_ipv6=1
  19. ip link set eth0 master br0
  20. ip link set eth1 master br0
  21. ip link set eth0 up
  22. ip link set eth1 up
  23. # Enable forwarding to chip port 4 (RTE)
  24. symreg qsys_sw_port_mode[4] 0x45000
  25. # Start Profinet application
  26. # Supported modes: none, cpu, full
  27. # Read mode from file
  28. mode="full"
  29. if test -f /tmp/pn_data/mode.txt; then
  30. mode=$(cat /tmp/pn_data/mode.txt)
  31. fi
  32. echo "Starting LAN9662 Profinet sample application"
  33. echo "RTE mode: $mode"
  34. /usr/bin/pn_lan9662 -m $mode -vvvv -p /tmp/pn_data &
  35. # Enable for interleaved ART-Tester logs
  36. #tcpdump -i br0 udp port 514 -v -a &
  37. }
  38. stop() {
  39. printf "Todo - Stop Profinet application"
  40. }
  41. case "$1" in
  42. start)
  43. start
  44. ;;
  45. stop)
  46. stop
  47. ;;
  48. restart|reload)
  49. stop
  50. start
  51. ;;
  52. *)
  53. echo "Usage: $0 {start|stop|restart}"
  54. exit 1
  55. esac
  56. exit $?