Skip to content

Commit

Permalink
hard-reset feature complete
Browse files Browse the repository at this point in the history
  • Loading branch information
andysworkshop committed Oct 22, 2014
1 parent 175f415 commit b8362b1
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 150 deletions.
20 changes: 9 additions & 11 deletions examples/net_dhcp/net_dhcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ using namespace stm32plus::net;


/**
* This examples demonstrates the use of the DHCP client to
* fetch your IP address, subnet mask, default gateway and
* DNS servers.
* This examples demonstrates the use of the DHCP client to fetch your IP address, subnet mask,
* default gateway and DNS servers.
*
* A DHCP lease is time limited. Half way through the lease time
* you will receive a notification event informing you that the
* DHCP client is going to automatically renew the lease. An error
* A DHCP lease is time limited. Half way through the lease time you will receive a notification
* event informing you that the DHCP client is going to automatically renew the lease. An error
* notification will be raised if the renewal fails.
*
* The results and any errors are sent to USART3 (57000/8/N/1).
Expand All @@ -40,18 +38,18 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +-----------------------------
*
* This example is also tested using the KSZ8051MLL in MII mode
* instead of the DP83848C/RMII. The KSZ8051MLL test was performed
* on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected
* to the KSZ8051MLL change the physical and datalink layers thus:
* This example is also tested using the KSZ8051MLL in MII mode instead of the DP83848C/RMII. The
* KSZ8051MLL test was performed on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected to the KSZ8051MLL change the
* physical and datalink layers thus:
*
* typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
* typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
*
* Tested on devices:
* STM32F107VCT6
* STM32F407VGT6
* STM32F407ZGT6
*/

class NetDhcpClientTest {
Expand Down
23 changes: 10 additions & 13 deletions examples/net_dns/net_dns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@ using namespace stm32plus::net;


/**
* This examples demonstrates the use of the DNS client to
* look up a host name on the internet. In this example we will
* look up "www.google.co.uk". After obtaining an IP address and
* our DNS servers via DHCP this example will perform the DNS lookup.
* This examples demonstrates the use of the DNS client to look up a host name on the internet.
* In this example we will look up "www.google.co.uk". After obtaining an IP address and our DNS
* servers via DHCP this example will perform the DNS lookup.
*
* The results of the DNS query and any errors are sent to
* USART3 configured as 57600/8/N/1.
* The results of the DNS query and any errors are sent to USART3 configured as 57600/8/N/1.
*
* DHCP lease renewal is not considered here - see the DHCP example for the
* correct procedure.
* DHCP lease renewal is not considered here - see the DHCP example for the correct procedure.
*
* Here's how the network stack for this example is configured:
*
Expand All @@ -40,18 +37,18 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +-----------------------------
*
* This example is also tested using the KSZ8051MLL in MII mode
* instead of the DP83848C/RMII. The KSZ8051MLL test was performed
* on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected
* to the KSZ8051MLL change the physical and datalink layers thus:
* This example is also tested using the KSZ8051MLL in MII mode instead of the DP83848C/RMII.
* The KSZ8051MLL test was performed on the STM32F107. The DP83848C was tested on the STM32F407.
* To reconfigure this demo for the F107 using remapped MAC pins connected to the KSZ8051MLL change
* the physical and datalink layers thus:
*
* typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
* typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
*
* Tested on devices:
* STM32F107VCT6
* STM32F407VGT6
* STM32F407ZGT6
*/


Expand Down
27 changes: 12 additions & 15 deletions examples/net_ftp_server/net_ftp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@ using namespace stm32plus::net;


/**
* This demo brings together a number of the stm32plus components, namely
* the network stack, the RTC, the SD card and the FAT16/32 filesystem
* to build a simple ftp server that listens on port 21.
* This demo brings together a number of the stm32plus components, namely the network stack,
* the RTC, the SD card and the FAT16/32 filesystem to build a simple ftp server that listens
* on port 21.
*
* The server supports authenticated and (optionally) anonymous connections.
* It requires you to create a top-level directory on your SD card called
* "ftp" and that "ftp" directory must contain a text file called "server.ini".
* An example "server.ini" file is included in the same directory as this
* example. Every option is explained in detail in the example server.ini,
* please do read it.
* The server supports authenticated and (optionally) anonymous connections. It requires you to
* create a top-level directory on your SD card called "ftp" and that "ftp" directory must contain
* a text file called "server.ini". An example "server.ini" file is included in the same directory
* as this example. Every option is explained in detail in the example server.ini, please do read it.
*
* Only passive mode is supported by this server. I have tested this server
* against cygwin/linux command line clients as well as IE10, Firefox 13 and
* Chrome 28. The Windows 7 command line ftp client is not supported due to
* its lack of passive mode support.
* Only passive mode is supported by this server. I have tested this server against cygwin/linux
* command line clients as well as IE10, Firefox 13 and Chrome 28. The Windows 7 command line ftp
* client is not supported due to its lack of passive mode support.
*
* +----------------------------+
* APPLICATION: | DhcpClient |
Expand All @@ -47,8 +44,8 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +----------------------------+
*
* This example is only compatible with the F4 because it requires the SDIO
* peripheral to communicate with the SD card.
* This example is only compatible with the F4 because it requires the SDIO peripheral to communicate
* with the SD card.
*
* Tested on devices:
* STM32F407VGT6
Expand Down
30 changes: 13 additions & 17 deletions examples/net_llip/net_llip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,21 @@ using namespace stm32plus::net;


/**
* This examples demonstrates the use of the Link Local IP client
* to automatically select an unused IP address from the "link local"
* class B network: 169.254/16. Link-local addresses can be used
* in a scenario where a DHCP server is not available, such as when
* a number of computers are directly connected to each other.
* This examples demonstrates the use of the Link Local IP client to automatically select an unused
* IP address from the "link local" class B network: 169.254/16. Link-local addresses can be used
* in a scenario where a DHCP server is not available, such as when a number of computers are directly
* connected to each other.
*
* If an address collision is detected while the stack is running then
* a new address will be automatically generated and broadcast to the
* stack modules. You can simulate this condition by using the linux
* NPING utility to hand-craft a colliding ARP packet. For example, if
* you have been assigned 169.254.232.52:
* If an address collision is detected while the stack is running then a new address will be
* automatically generated and broadcast to the stack modules. You can simulate this condition by using
* the linux NPING utility to hand-craft a colliding ARP packet. For example, if you have been assigned
* 169.254.232.52:
*
* $ nping 169.254.232.52 --arp --arp-type arp-request --arp-sender-mac \
* 00:0a:34:30:fe:ae --arp-sender-ip 169.254.232.52 --arp-target-mac \
* 00:00:00:00:00:00 --arp-target-ip 169.254.232.52
*
* You can then use tcpdump or wireshark to observe this module searching
* for a new address.
* You can then use tcpdump or wireshark to observe this module searching for a new address.
*
* The results and any errors are sent to USART3 (57000/8/N/1).
*
Expand All @@ -50,11 +47,10 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +-----------------------------
*
* This example is also tested using the KSZ8051MLL in MII mode
* instead of the DP83848C/RMII. The KSZ8051MLL test was performed
* on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected
* to the KSZ8051MLL change the physical and datalink layers thus:
* This example is also tested using the KSZ8051MLL in MII mode instead of the DP83848C/RMII.
* The KSZ8051MLL test was performed on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected to the KSZ8051MLL change
* the physical and datalink layers thus:
*
* typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
* typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
Expand Down
21 changes: 9 additions & 12 deletions examples/net_ping_client/net_ping_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ using namespace stm32plus::net;


/**
* This example demonstrates the ICMP transport by sending periodic
* echo requests (pings) to a hardcoded IP address (change it to suit your
* network).
* This example demonstrates the ICMP transport by sending periodic echo requests (pings) to a
* hardcoded IP address (change it to suit your network).
*
* This network stack is about as simple as it gets. We don't even
* use DHCP for client configuration so you'll need to be connected to a
* network that understands that you have the static IP address configured
* in this example.
* This network stack is about as simple as it gets. We don't even use DHCP for client configuration
* so you'll need to be connected to a network that understands that you have the static IP address
* configured in this example.
*
* Here's how the network stack for this example is configured:
*
Expand All @@ -39,11 +37,10 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +-----------------------------
*
* This example is also tested using the KSZ8051MLL in MII mode
* instead of the DP83848C/RMII. The KSZ8051MLL test was performed
* on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected
* to the KSZ8051MLL change the physical and datalink layers thus:
* This example is also tested using the KSZ8051MLL in MII mode instead of the DP83848C/RMII. The
* KSZ8051MLL test was performed on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected to the KSZ8051MLL change the
* physical and datalink layers thus:
*
* typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
* typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
Expand Down
10 changes: 5 additions & 5 deletions examples/net_tcp_client/net_tcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ using namespace stm32plus::net;


/**
* This example demonstrates a TCP 'echo' client. It will attempt to connect to a server
* on a remote computer and send it a line of text. The server will read that line of text
* and then send it back in reverse. An example server, written in perl, is included in
* this example code directory. It can be run directly on Linux or Linux-alike systems
* such as cygwin or msys on Windows. The reversed string will be sent to the USART.
* This example demonstrates a TCP 'echo' client. It will attempt to connect to a server on a remote
* computer and send it a line of text. The server will read that line of text and then send it back
* in reverse. An example server, written in perl, is included in this example code directory.
* It can be run directly on Linux or Linux-alike systems such as cygwin or msys on Windows. The
* reversed string will be sent to the USART.
*
* I use Usart3, remap-2 with settings 57000/8/N/1.
*
Expand Down
11 changes: 5 additions & 6 deletions examples/net_tcp_server/net_tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ using namespace stm32plus::net;


/**
* This example demonstrates a TCP 'echo' server. Telnet to this server and type lines of
* text at it to see them echo'd back. Maximum 100 characters per line, please. Multiple
* simultaneous connections are supported up to the configured maximum per server. The
* 'TcpConnectionArray' class takes care of the connection multiplexing for you. All you need
* to do to run a server is subclass TcpConnection and implement the handleRead(), handleWrite()
* and handleClose() methods as demonstrated below.
* This example demonstrates a TCP 'echo' server. Telnet to this server and type lines of text at it
* to see them echo'd back. Maximum 100 characters per line, please. Multiple simultaneous connections
* are supported up to the configured maximum per server. The 'TcpConnectionArray' class takes care of
* the connection multiplexing for you. All you need to do to run a server is subclass TcpConnection
* and implement the handleRead(), handleWrite() and handleClose() methods as demonstrated below.
*
* +----------------------------+
* APPLICATION: | DhcpClient |
Expand Down
22 changes: 10 additions & 12 deletions examples/net_udp_receive/net_udp_receive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,24 @@ using namespace stm32plus::net;


/**
* This example demonstrates how to receive UDP packets from a remote host.
* After obtaining an IP address via DHCP this example will wait for UDP
* datagrams to arrive on port 12345. When a datagram arrives it will print
* the first 10 bytes to USART #3.
* This example demonstrates how to receive UDP packets from a remote host. After obtaining an IP
* address via DHCP this example will wait for UDP datagrams to arrive on port 12345. When a datagram
* arrives it will print the first 10 bytes to USART #3.
*
* For testing I recommend the Linux NPING utility that allows you to create
* hand-crafted network packets to send to your device. For example, here's how
* to send a byte sequence of 1..10 to your device on 192.168.1.5 using nping:
* For testing I recommend the Linux NPING utility that allows you to create hand-crafted network
* packets to send to your device. For example, here's how to send a byte sequence of 1..10 to your
* device on 192.168.1.5 using nping:
*
* nping --udp 192.168.1.10 -p 12345 --data 0102030405060708090a
*
* The ICMP protocol is included to demonstrate how you'll get a "port
* unreachable" error if you try to hit a port other than 12345. This feature
* can be individually controlled or ICMP can be left out entirely.
* The ICMP protocol is included to demonstrate how you'll get a "port unreachable" error if you try
* to hit a port other than 12345. This feature can be individually controlled or ICMP can be left out
* entirely.
*
* If there are any errors then they are output to a USART which for me is
* USART3 57600/8/N/1
*
* DHCP lease renewal is not considered here - see the DHCP example for the
* correct procedure.
* DHCP lease renewal is not considered here - see the DHCP example for the correct procedure.
*
* Here's how the network stack for this example is configured:
*
Expand Down
15 changes: 7 additions & 8 deletions examples/net_udp_receive_async/net_udp_receive_async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ using namespace stm32plus::net;


/**
* This example demonstrates how to receive UDP packets from a remote host.
* After obtaining an IP address via DHCP this example will wait for UDP
* datagrams to arrive on port 12345. When a datagram arrives it will print
* the first 10 bytes to USART #3. The reception is done asynchronously via
* a subscription to an event provided by the network stack's UDP module.
* This example demonstrates how to receive UDP packets from a remote host. After obtaining an IP
* address via DHCP this example will wait for UDP datagrams to arrive on port 12345. When a
* datagram arrives it will print the first 10 bytes to USART #3. The reception is done
* asynchronously via a subscription to an event provided by the network stack's UDP module.
*
* For testing I recommend the Linux NPING utility that allows you to create
* hand-crafted network packets to send to your device. For example, here's how
* to send a byte sequence of 1..10 to your device on 192.168.1.5 using nping:
* For testing I recommend the Linux NPING utility that allows you to create hand-crafted
* network packets to send to your device. For example, here's how to send a byte sequence of
* 1..10 to your device on 192.168.1.5 using nping:
*
* nping --udp 192.168.1.5 -p 12345 --data 0102030405060708090a
*
Expand Down
33 changes: 15 additions & 18 deletions examples/net_udp_send/net_udp_send.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ using namespace stm32plus::net;


/**
* This example demonstrates how to send UDP packets to a remote host. After
* obtaining an IP address via DHCP this example will send three 2Kb UDP packets
* to a remote host every 5 seconds. The target IP address is hardcoded into
* this example code and you can change it to fit your network configuration.
* This example demonstrates how to send UDP packets to a remote host. After obtaining an IP
* address via DHCP this example will send three 2Kb UDP packets to a remote host every 5 seconds.
* The target IP address is hardcoded into this example code and you can change it to fit your
* network configuration.
*
* I recommend either tcpdump (linux) or wireshark (windows) for observing the
* incoming packets. The requisite wireshark filter is "udp.dstport==12345"
* I recommend either tcpdump (linux) or wireshark (windows) for observing the incoming packets.
* The requisite wireshark filter is "udp.dstport==12345"
*
* If there are any errors then they are output to a USART which for me is
* USART3 57600/8/N/1
* If there are any errors then they are output to a USART which for me is USART3 57600/8/N/1
*
* DHCP lease renewal is not considered here - see the DHCP example for the
* correct procedure.
* DHCP lease renewal is not considered here - see the DHCP example for the correct procedure.
*
* Here's how the network stack for this example is configured:
*
Expand All @@ -43,11 +41,10 @@ using namespace stm32plus::net;
* PHYSICAL: | DP83848C |
* +-----------------------------
*
* This example is also tested using the KSZ8051MLL in MII mode
* instead of the DP83848C/RMII. The KSZ8051MLL test was performed
* on the STM32F107. The DP83848C was tested on the STM32F407. To
* reconfigure this demo for the F107 using remapped MAC pins connected
* to the KSZ8051MLL change the physical and datalink layers thus:
* This example is also tested using the KSZ8051MLL in MII mode instead of the DP83848C/RMII.
* The KSZ8051MLL test was performed on the STM32F107. The DP83848C was tested on the STM32F407.
* To reconfigure this demo for the F107 using remapped MAC pins connected to the KSZ8051MLL change
* the physical and datalink layers thus:
*
* typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
* typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
Expand All @@ -65,8 +62,8 @@ class NetUdpSendTest {
* Types that define the network stack
*/

typedef PhysicalLayer<KSZ8051MLL> MyPhysicalLayer;
typedef DatalinkLayer<MyPhysicalLayer,RemapMiiInterface,Mac> MyDatalinkLayer;
typedef PhysicalLayer<KSZ8091RNA> MyPhysicalLayer;
typedef DatalinkLayer<MyPhysicalLayer,DefaultRmiiInterface,Mac> MyDatalinkLayer;
typedef NetworkLayer<MyDatalinkLayer,DefaultIp,Arp> MyNetworkLayer;
typedef TransportLayer<MyNetworkLayer,Udp> MyTransportLayer;
typedef ApplicationLayer<MyTransportLayer,DhcpClient> MyApplicationLayer;
Expand Down Expand Up @@ -144,7 +141,7 @@ class NetUdpSendTest {
// IP multicast senders are supported so feel free to use the multicast host group
// range if that's what you want.

IpAddress ipAddress("192.168.1.2");
IpAddress ipAddress("192.168.1.12");

// Set up a buffer full of a test pattern. The buffer is 50 bytes in size and as such is
// guaranteed to easily fit within the ethernet MTU size.
Expand Down

0 comments on commit b8362b1

Please sign in to comment.