SOEM EtherCAT Master library for STM Nucleo F767ZI

Dependents:   EasyCAT_LAB_simple EasyCAT_LAB_very_simple EasyCAT_LAB

  • It has been developed for the EasyCAT LAB , a complete educational and experimental EtherCAT® system, composed of one master and two slaves .

Warning

/media/uploads/EasyCAT/easycat_lab.jpg

Committer:
EasyCAT
Date:
Tue Jun 11 10:29:09 2019 +0000
Revision:
0:543d6784d4cc
SOEM EtherCAT Master Library for STM Nucleo F767ZI

Who changed what in which revision?

UserRevisionLine numberNew contents of line
EasyCAT 0:543d6784d4cc 1 /*
EasyCAT 0:543d6784d4cc 2 * Licensed under the GNU General Public License version 2 with exceptions. See
EasyCAT 0:543d6784d4cc 3 * LICENSE file in the project root for full license information
EasyCAT 0:543d6784d4cc 4 */
EasyCAT 0:543d6784d4cc 5
EasyCAT 0:543d6784d4cc 6 #include "oshw.h"
EasyCAT 0:543d6784d4cc 7 #include <stdlib.h>
EasyCAT 0:543d6784d4cc 8 #include "lwip/def.h"
EasyCAT 0:543d6784d4cc 9
EasyCAT 0:543d6784d4cc 10
EasyCAT 0:543d6784d4cc 11 /**
EasyCAT 0:543d6784d4cc 12 * Host to Network byte order (i.e. to big endian).
EasyCAT 0:543d6784d4cc 13 *
EasyCAT 0:543d6784d4cc 14 * Note that Ethercat uses little endian byte order, except for the Ethernet
EasyCAT 0:543d6784d4cc 15 * header which is big endian as usual.
EasyCAT 0:543d6784d4cc 16 */
EasyCAT 0:543d6784d4cc 17
EasyCAT 0:543d6784d4cc 18
EasyCAT 0:543d6784d4cc 19
EasyCAT 0:543d6784d4cc 20 uint16 oshw_htons(const uint16 host)
EasyCAT 0:543d6784d4cc 21 {
EasyCAT 0:543d6784d4cc 22 return htons (host);
EasyCAT 0:543d6784d4cc 23 }
EasyCAT 0:543d6784d4cc 24
EasyCAT 0:543d6784d4cc 25
EasyCAT 0:543d6784d4cc 26 /**
EasyCAT 0:543d6784d4cc 27 * Network (i.e. big endian) to Host byte order.
EasyCAT 0:543d6784d4cc 28 *
EasyCAT 0:543d6784d4cc 29 * Note that Ethercat uses little endian byte order, except for the Ethernet
EasyCAT 0:543d6784d4cc 30 * header which is big endian as usual.
EasyCAT 0:543d6784d4cc 31 */
EasyCAT 0:543d6784d4cc 32 uint16 oshw_ntohs(const uint16 network)
EasyCAT 0:543d6784d4cc 33 {
EasyCAT 0:543d6784d4cc 34 return ntohs (network);
EasyCAT 0:543d6784d4cc 35 }
EasyCAT 0:543d6784d4cc 36
EasyCAT 0:543d6784d4cc 37 /* Create list over available network adapters.
EasyCAT 0:543d6784d4cc 38 * @return First element in linked list of adapters
EasyCAT 0:543d6784d4cc 39 */
EasyCAT 0:543d6784d4cc 40 ec_adaptert * oshw_find_adapters(void)
EasyCAT 0:543d6784d4cc 41 {
EasyCAT 0:543d6784d4cc 42 ec_adaptert * ret_adapter = NULL;
EasyCAT 0:543d6784d4cc 43
EasyCAT 0:543d6784d4cc 44 /* TODO if needed */
EasyCAT 0:543d6784d4cc 45
EasyCAT 0:543d6784d4cc 46 return ret_adapter;
EasyCAT 0:543d6784d4cc 47 }
EasyCAT 0:543d6784d4cc 48
EasyCAT 0:543d6784d4cc 49 /** Free memory allocated memory used by adapter collection.
EasyCAT 0:543d6784d4cc 50 * @param[in] adapter = First element in linked list of adapters
EasyCAT 0:543d6784d4cc 51 * EC_NOFRAME.
EasyCAT 0:543d6784d4cc 52 */
EasyCAT 0:543d6784d4cc 53 void oshw_free_adapters(ec_adaptert * adapter)
EasyCAT 0:543d6784d4cc 54 {
EasyCAT 0:543d6784d4cc 55 /* TODO if needed */
EasyCAT 0:543d6784d4cc 56 }