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

Dependencies:   mbed-rtos

Dependents:   IMU_ethernet

Fork of F7_Ethernet by Dieter Graef

Committer:
rctaduio
Date:
Thu Oct 06 16:55:16 2016 +0000
Revision:
2:e0a4035b5cd1
Parent:
0:d26c1b55cfca
Ethernet library for F7

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 #ifndef __ARCH_SYS_ARCH_H__
DieterGraef 0:d26c1b55cfca 19 #define __ARCH_SYS_ARCH_H__
DieterGraef 0:d26c1b55cfca 20
DieterGraef 0:d26c1b55cfca 21 #include "lwip/opt.h"
DieterGraef 0:d26c1b55cfca 22
DieterGraef 0:d26c1b55cfca 23 #if NO_SYS == 0
DieterGraef 0:d26c1b55cfca 24 #include "cmsis_os.h"
DieterGraef 0:d26c1b55cfca 25
DieterGraef 0:d26c1b55cfca 26 // === SEMAPHORE ===
DieterGraef 0:d26c1b55cfca 27 typedef struct {
DieterGraef 0:d26c1b55cfca 28 osSemaphoreId id;
DieterGraef 0:d26c1b55cfca 29 osSemaphoreDef_t def;
DieterGraef 0:d26c1b55cfca 30 #ifdef CMSIS_OS_RTX
DieterGraef 0:d26c1b55cfca 31 uint32_t data[2];
DieterGraef 0:d26c1b55cfca 32 #endif
DieterGraef 0:d26c1b55cfca 33 } sys_sem_t;
DieterGraef 0:d26c1b55cfca 34
DieterGraef 0:d26c1b55cfca 35 #define sys_sem_valid(x) (((*x).id == NULL) ? 0 : 1)
DieterGraef 0:d26c1b55cfca 36 #define sys_sem_set_invalid(x) ( (*x).id = NULL)
DieterGraef 0:d26c1b55cfca 37
DieterGraef 0:d26c1b55cfca 38 // === MUTEX ===
DieterGraef 0:d26c1b55cfca 39 typedef struct {
DieterGraef 0:d26c1b55cfca 40 osMutexId id;
DieterGraef 0:d26c1b55cfca 41 osMutexDef_t def;
DieterGraef 0:d26c1b55cfca 42 #ifdef CMSIS_OS_RTX
DieterGraef 0:d26c1b55cfca 43 #if defined(__MBED_CMSIS_RTOS_CA9) || defined(__MBED_CMSIS_RTOS_CM)
DieterGraef 0:d26c1b55cfca 44 int32_t data[4];
DieterGraef 0:d26c1b55cfca 45 #else
DieterGraef 0:d26c1b55cfca 46 int32_t data[3];
DieterGraef 0:d26c1b55cfca 47 #endif
DieterGraef 0:d26c1b55cfca 48 #endif
DieterGraef 0:d26c1b55cfca 49 } sys_mutex_t;
DieterGraef 0:d26c1b55cfca 50
DieterGraef 0:d26c1b55cfca 51 // === MAIL BOX ===
DieterGraef 0:d26c1b55cfca 52 #define MB_SIZE 8
DieterGraef 0:d26c1b55cfca 53
DieterGraef 0:d26c1b55cfca 54 typedef struct {
DieterGraef 0:d26c1b55cfca 55 osMessageQId id;
DieterGraef 0:d26c1b55cfca 56 osMessageQDef_t def;
DieterGraef 0:d26c1b55cfca 57 #ifdef CMSIS_OS_RTX
DieterGraef 0:d26c1b55cfca 58 uint32_t queue[4+MB_SIZE]; /* The +4 is required for RTX OS_MCB overhead. */
DieterGraef 0:d26c1b55cfca 59 #endif
DieterGraef 0:d26c1b55cfca 60 } sys_mbox_t;
DieterGraef 0:d26c1b55cfca 61
DieterGraef 0:d26c1b55cfca 62 #define SYS_MBOX_NULL ((uint32_t) NULL)
DieterGraef 0:d26c1b55cfca 63 #define sys_mbox_valid(x) (((*x).id == NULL) ? 0 : 1 )
DieterGraef 0:d26c1b55cfca 64 #define sys_mbox_set_invalid(x) ( (*x).id = NULL )
DieterGraef 0:d26c1b55cfca 65
DieterGraef 0:d26c1b55cfca 66 #if ((DEFAULT_RAW_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:d26c1b55cfca 67 ((DEFAULT_UDP_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:d26c1b55cfca 68 ((DEFAULT_TCP_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:d26c1b55cfca 69 ((DEFAULT_ACCEPTMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:d26c1b55cfca 70 ((TCPIP_MBOX_SIZE) > (MB_SIZE))
DieterGraef 0:d26c1b55cfca 71 # error Mailbox size not supported
DieterGraef 0:d26c1b55cfca 72 #endif
DieterGraef 0:d26c1b55cfca 73
DieterGraef 0:d26c1b55cfca 74 // === THREAD ===
DieterGraef 0:d26c1b55cfca 75 typedef struct {
DieterGraef 0:d26c1b55cfca 76 osThreadId id;
DieterGraef 0:d26c1b55cfca 77 osThreadDef_t def;
DieterGraef 0:d26c1b55cfca 78 } sys_thread_data_t;
DieterGraef 0:d26c1b55cfca 79 typedef sys_thread_data_t* sys_thread_t;
DieterGraef 0:d26c1b55cfca 80
DieterGraef 0:d26c1b55cfca 81 #define SYS_THREAD_POOL_N 6
DieterGraef 0:d26c1b55cfca 82 #define SYS_DEFAULT_THREAD_STACK_DEPTH DEFAULT_STACK_SIZE
DieterGraef 0:d26c1b55cfca 83
DieterGraef 0:d26c1b55cfca 84 // === PROTECTION ===
DieterGraef 0:d26c1b55cfca 85 typedef int sys_prot_t;
DieterGraef 0:d26c1b55cfca 86
DieterGraef 0:d26c1b55cfca 87 #else
DieterGraef 0:d26c1b55cfca 88 #ifdef __cplusplus
DieterGraef 0:d26c1b55cfca 89 extern "C" {
DieterGraef 0:d26c1b55cfca 90 #endif
DieterGraef 0:d26c1b55cfca 91
DieterGraef 0:d26c1b55cfca 92 /** \brief Init systick to 1ms rate
DieterGraef 0:d26c1b55cfca 93 *
DieterGraef 0:d26c1b55cfca 94 * This init the systick to 1ms rate. This function is only used in standalone
DieterGraef 0:d26c1b55cfca 95 * systems.
DieterGraef 0:d26c1b55cfca 96 */
DieterGraef 0:d26c1b55cfca 97 void SysTick_Init(void);
DieterGraef 0:d26c1b55cfca 98
DieterGraef 0:d26c1b55cfca 99
DieterGraef 0:d26c1b55cfca 100 /** \brief Get the current systick time in milliSeconds
DieterGraef 0:d26c1b55cfca 101 *
DieterGraef 0:d26c1b55cfca 102 * Returns the current systick time in milliSeconds. This function is only
DieterGraef 0:d26c1b55cfca 103 * used in standalone systems.
DieterGraef 0:d26c1b55cfca 104 *
DieterGraef 0:d26c1b55cfca 105 * /returns current systick time in milliSeconds
DieterGraef 0:d26c1b55cfca 106 */
DieterGraef 0:d26c1b55cfca 107 uint32_t SysTick_GetMS(void);
DieterGraef 0:d26c1b55cfca 108
DieterGraef 0:d26c1b55cfca 109 /** \brief Delay for the specified number of milliSeconds
DieterGraef 0:d26c1b55cfca 110 *
DieterGraef 0:d26c1b55cfca 111 * For standalone systems. This function will block for the specified
DieterGraef 0:d26c1b55cfca 112 * number of milliSconds. For RTOS based systems, this function will delay
DieterGraef 0:d26c1b55cfca 113 * the task by the specified number of milliSeconds.
DieterGraef 0:d26c1b55cfca 114 *
DieterGraef 0:d26c1b55cfca 115 * \param[in] ms Time in milliSeconds to delay
DieterGraef 0:d26c1b55cfca 116 */
DieterGraef 0:d26c1b55cfca 117 void osDelay(uint32_t ms);
DieterGraef 0:d26c1b55cfca 118
DieterGraef 0:d26c1b55cfca 119 #ifdef __cplusplus
DieterGraef 0:d26c1b55cfca 120 }
DieterGraef 0:d26c1b55cfca 121 #endif
DieterGraef 0:d26c1b55cfca 122 #endif
DieterGraef 0:d26c1b55cfca 123
DieterGraef 0:d26c1b55cfca 124 #endif /* __ARCH_SYS_ARCH_H__ */