Ethernet for Nucleo and Disco board STM32F746 works with gcc and arm. IAC is untested

Dependents:   STM32F746_iothub_client_sample_mqtt DISCO-F746NG_Ethernet Nucleo_F746ZG_Ethernet thethingsiO-DISCO_F746NG-mqtt ... more

Committer:
DieterGraef
Date:
Sun Jun 19 16:23:40 2016 +0000
Revision:
0:d26c1b55cfca
Ethernet Library for Nucleo stm32f746ZG and Disco stm32f746NG  works under arm and gcc environment

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:d26c1b55cfca 1 /* Copyright (C) 2012 mbed.org, MIT License
DieterGraef 0:d26c1b55cfca 2 *
DieterGraef 0:d26c1b55cfca 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
DieterGraef 0:d26c1b55cfca 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
DieterGraef 0:d26c1b55cfca 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
DieterGraef 0:d26c1b55cfca 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
DieterGraef 0:d26c1b55cfca 7 * furnished to do so, subject to the following conditions:
DieterGraef 0:d26c1b55cfca 8 *
DieterGraef 0:d26c1b55cfca 9 * The above copyright notice and this permission notice shall be included in all copies or
DieterGraef 0:d26c1b55cfca 10 * substantial portions of the Software.
DieterGraef 0:d26c1b55cfca 11 *
DieterGraef 0:d26c1b55cfca 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
DieterGraef 0:d26c1b55cfca 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
DieterGraef 0:d26c1b55cfca 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DieterGraef 0:d26c1b55cfca 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
DieterGraef 0:d26c1b55cfca 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
DieterGraef 0:d26c1b55cfca 17 */
DieterGraef 0:d26c1b55cfca 18
DieterGraef 0:d26c1b55cfca 19 #ifndef UDPSOCKET_H
DieterGraef 0:d26c1b55cfca 20 #define UDPSOCKET_H
DieterGraef 0:d26c1b55cfca 21
DieterGraef 0:d26c1b55cfca 22 #include "Socket/Socket.h"
DieterGraef 0:d26c1b55cfca 23 #include "Socket/Endpoint.h"
DieterGraef 0:d26c1b55cfca 24
DieterGraef 0:d26c1b55cfca 25 /**
DieterGraef 0:d26c1b55cfca 26 UDP Socket
DieterGraef 0:d26c1b55cfca 27 */
DieterGraef 0:d26c1b55cfca 28 class UDPSocket : public Socket {
DieterGraef 0:d26c1b55cfca 29
DieterGraef 0:d26c1b55cfca 30 public:
DieterGraef 0:d26c1b55cfca 31 /** Instantiate an UDP Socket.
DieterGraef 0:d26c1b55cfca 32 */
DieterGraef 0:d26c1b55cfca 33 UDPSocket();
DieterGraef 0:d26c1b55cfca 34
DieterGraef 0:d26c1b55cfca 35 /** Init the UDP Client Socket without binding it to any specific port
DieterGraef 0:d26c1b55cfca 36 \return 0 on success, -1 on failure.
DieterGraef 0:d26c1b55cfca 37 */
DieterGraef 0:d26c1b55cfca 38 int init(void);
DieterGraef 0:d26c1b55cfca 39
DieterGraef 0:d26c1b55cfca 40 /** Bind a UDP Server Socket to a specific port
DieterGraef 0:d26c1b55cfca 41 \param port The port to listen for incoming connections on
DieterGraef 0:d26c1b55cfca 42 \return 0 on success, -1 on failure.
DieterGraef 0:d26c1b55cfca 43 */
DieterGraef 0:d26c1b55cfca 44 int bind(int port);
DieterGraef 0:d26c1b55cfca 45
DieterGraef 0:d26c1b55cfca 46 /** Join the multicast group at the given address
DieterGraef 0:d26c1b55cfca 47 \param address The address of the multicast group
DieterGraef 0:d26c1b55cfca 48 \return 0 on success, -1 on failure.
DieterGraef 0:d26c1b55cfca 49 */
DieterGraef 0:d26c1b55cfca 50 int join_multicast_group(const char* address);
DieterGraef 0:d26c1b55cfca 51
DieterGraef 0:d26c1b55cfca 52 /** Set the socket in broadcasting mode
DieterGraef 0:d26c1b55cfca 53 \return 0 on success, -1 on failure.
DieterGraef 0:d26c1b55cfca 54 */
DieterGraef 0:d26c1b55cfca 55 int set_broadcasting(bool broadcast=true);
DieterGraef 0:d26c1b55cfca 56
DieterGraef 0:d26c1b55cfca 57 /** Send a packet to a remote endpoint
DieterGraef 0:d26c1b55cfca 58 \param remote The remote endpoint
DieterGraef 0:d26c1b55cfca 59 \param packet The packet to be sent
DieterGraef 0:d26c1b55cfca 60 \param length The length of the packet to be sent
DieterGraef 0:d26c1b55cfca 61 \return the number of written bytes on success (>=0) or -1 on failure
DieterGraef 0:d26c1b55cfca 62 */
DieterGraef 0:d26c1b55cfca 63 int sendTo(Endpoint &remote, char *packet, int length);
DieterGraef 0:d26c1b55cfca 64
DieterGraef 0:d26c1b55cfca 65 /** Receive a packet from a remote endpoint
DieterGraef 0:d26c1b55cfca 66 \param remote The remote endpoint
DieterGraef 0:d26c1b55cfca 67 \param buffer The buffer for storing the incoming packet data. If a packet
DieterGraef 0:d26c1b55cfca 68 is too long to fit in the supplied buffer, excess bytes are discarded
DieterGraef 0:d26c1b55cfca 69 \param length The length of the buffer
DieterGraef 0:d26c1b55cfca 70 \return the number of received bytes on success (>=0) or -1 on failure
DieterGraef 0:d26c1b55cfca 71 */
DieterGraef 0:d26c1b55cfca 72 int receiveFrom(Endpoint &remote, char *buffer, int length);
DieterGraef 0:d26c1b55cfca 73 };
DieterGraef 0:d26c1b55cfca 74
DieterGraef 0:d26c1b55cfca 75 #endif