ProjetoBB

Dependencies:   F7_Ethernet WebSocketClient mbed mcp3008

Fork of Nucleo_F746ZG_Ethernet by Dieter Graef

Committer:
DieterGraef
Date:
Sat Jun 18 10:49:12 2016 +0000
Revision:
0:f9b6112278fe
Ethernet for the NUCLEO STM32F746 Board Testprogram uses DHCP and NTP to set the clock

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DieterGraef 0:f9b6112278fe 1 /* Copyright (C) 2012 mbed.org, MIT License
DieterGraef 0:f9b6112278fe 2 *
DieterGraef 0:f9b6112278fe 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
DieterGraef 0:f9b6112278fe 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
DieterGraef 0:f9b6112278fe 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
DieterGraef 0:f9b6112278fe 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
DieterGraef 0:f9b6112278fe 7 * furnished to do so, subject to the following conditions:
DieterGraef 0:f9b6112278fe 8 *
DieterGraef 0:f9b6112278fe 9 * The above copyright notice and this permission notice shall be included in all copies or
DieterGraef 0:f9b6112278fe 10 * substantial portions of the Software.
DieterGraef 0:f9b6112278fe 11 *
DieterGraef 0:f9b6112278fe 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
DieterGraef 0:f9b6112278fe 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
DieterGraef 0:f9b6112278fe 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DieterGraef 0:f9b6112278fe 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
DieterGraef 0:f9b6112278fe 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
DieterGraef 0:f9b6112278fe 17 */
DieterGraef 0:f9b6112278fe 18 #ifndef __ARCH_SYS_ARCH_H__
DieterGraef 0:f9b6112278fe 19 #define __ARCH_SYS_ARCH_H__
DieterGraef 0:f9b6112278fe 20
DieterGraef 0:f9b6112278fe 21 #include "lwip/opt.h"
DieterGraef 0:f9b6112278fe 22
DieterGraef 0:f9b6112278fe 23 #if NO_SYS == 0
DieterGraef 0:f9b6112278fe 24 #include "cmsis_os.h"
DieterGraef 0:f9b6112278fe 25
DieterGraef 0:f9b6112278fe 26 // === SEMAPHORE ===
DieterGraef 0:f9b6112278fe 27 typedef struct {
DieterGraef 0:f9b6112278fe 28 osSemaphoreId id;
DieterGraef 0:f9b6112278fe 29 osSemaphoreDef_t def;
DieterGraef 0:f9b6112278fe 30 #ifdef CMSIS_OS_RTX
DieterGraef 0:f9b6112278fe 31 uint32_t data[2];
DieterGraef 0:f9b6112278fe 32 #endif
DieterGraef 0:f9b6112278fe 33 } sys_sem_t;
DieterGraef 0:f9b6112278fe 34
DieterGraef 0:f9b6112278fe 35 #define sys_sem_valid(x) (((*x).id == NULL) ? 0 : 1)
DieterGraef 0:f9b6112278fe 36 #define sys_sem_set_invalid(x) ( (*x).id = NULL)
DieterGraef 0:f9b6112278fe 37
DieterGraef 0:f9b6112278fe 38 // === MUTEX ===
DieterGraef 0:f9b6112278fe 39 typedef struct {
DieterGraef 0:f9b6112278fe 40 osMutexId id;
DieterGraef 0:f9b6112278fe 41 osMutexDef_t def;
DieterGraef 0:f9b6112278fe 42 #ifdef CMSIS_OS_RTX
DieterGraef 0:f9b6112278fe 43 #if defined(__MBED_CMSIS_RTOS_CA9) || defined(__MBED_CMSIS_RTOS_CM)
DieterGraef 0:f9b6112278fe 44 int32_t data[4];
DieterGraef 0:f9b6112278fe 45 #else
DieterGraef 0:f9b6112278fe 46 int32_t data[3];
DieterGraef 0:f9b6112278fe 47 #endif
DieterGraef 0:f9b6112278fe 48 #endif
DieterGraef 0:f9b6112278fe 49 } sys_mutex_t;
DieterGraef 0:f9b6112278fe 50
DieterGraef 0:f9b6112278fe 51 // === MAIL BOX ===
DieterGraef 0:f9b6112278fe 52 #define MB_SIZE 8
DieterGraef 0:f9b6112278fe 53
DieterGraef 0:f9b6112278fe 54 typedef struct {
DieterGraef 0:f9b6112278fe 55 osMessageQId id;
DieterGraef 0:f9b6112278fe 56 osMessageQDef_t def;
DieterGraef 0:f9b6112278fe 57 #ifdef CMSIS_OS_RTX
DieterGraef 0:f9b6112278fe 58 uint32_t queue[4+MB_SIZE]; /* The +4 is required for RTX OS_MCB overhead. */
DieterGraef 0:f9b6112278fe 59 #endif
DieterGraef 0:f9b6112278fe 60 } sys_mbox_t;
DieterGraef 0:f9b6112278fe 61
DieterGraef 0:f9b6112278fe 62 #define SYS_MBOX_NULL ((uint32_t) NULL)
DieterGraef 0:f9b6112278fe 63 #define sys_mbox_valid(x) (((*x).id == NULL) ? 0 : 1 )
DieterGraef 0:f9b6112278fe 64 #define sys_mbox_set_invalid(x) ( (*x).id = NULL )
DieterGraef 0:f9b6112278fe 65
DieterGraef 0:f9b6112278fe 66 #if ((DEFAULT_RAW_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:f9b6112278fe 67 ((DEFAULT_UDP_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:f9b6112278fe 68 ((DEFAULT_TCP_RECVMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:f9b6112278fe 69 ((DEFAULT_ACCEPTMBOX_SIZE) > (MB_SIZE)) || \
DieterGraef 0:f9b6112278fe 70 ((TCPIP_MBOX_SIZE) > (MB_SIZE))
DieterGraef 0:f9b6112278fe 71 # error Mailbox size not supported
DieterGraef 0:f9b6112278fe 72 #endif
DieterGraef 0:f9b6112278fe 73
DieterGraef 0:f9b6112278fe 74 // === THREAD ===
DieterGraef 0:f9b6112278fe 75 typedef struct {
DieterGraef 0:f9b6112278fe 76 osThreadId id;
DieterGraef 0:f9b6112278fe 77 osThreadDef_t def;
DieterGraef 0:f9b6112278fe 78 } sys_thread_data_t;
DieterGraef 0:f9b6112278fe 79 typedef sys_thread_data_t* sys_thread_t;
DieterGraef 0:f9b6112278fe 80
DieterGraef 0:f9b6112278fe 81 #define SYS_THREAD_POOL_N 6
DieterGraef 0:f9b6112278fe 82 #define SYS_DEFAULT_THREAD_STACK_DEPTH DEFAULT_STACK_SIZE
DieterGraef 0:f9b6112278fe 83
DieterGraef 0:f9b6112278fe 84 // === PROTECTION ===
DieterGraef 0:f9b6112278fe 85 typedef int sys_prot_t;
DieterGraef 0:f9b6112278fe 86
DieterGraef 0:f9b6112278fe 87 #else
DieterGraef 0:f9b6112278fe 88 #ifdef __cplusplus
DieterGraef 0:f9b6112278fe 89 extern "C" {
DieterGraef 0:f9b6112278fe 90 #endif
DieterGraef 0:f9b6112278fe 91
DieterGraef 0:f9b6112278fe 92 /** \brief Init systick to 1ms rate
DieterGraef 0:f9b6112278fe 93 *
DieterGraef 0:f9b6112278fe 94 * This init the systick to 1ms rate. This function is only used in standalone
DieterGraef 0:f9b6112278fe 95 * systems.
DieterGraef 0:f9b6112278fe 96 */
DieterGraef 0:f9b6112278fe 97 void SysTick_Init(void);
DieterGraef 0:f9b6112278fe 98
DieterGraef 0:f9b6112278fe 99
DieterGraef 0:f9b6112278fe 100 /** \brief Get the current systick time in milliSeconds
DieterGraef 0:f9b6112278fe 101 *
DieterGraef 0:f9b6112278fe 102 * Returns the current systick time in milliSeconds. This function is only
DieterGraef 0:f9b6112278fe 103 * used in standalone systems.
DieterGraef 0:f9b6112278fe 104 *
DieterGraef 0:f9b6112278fe 105 * /returns current systick time in milliSeconds
DieterGraef 0:f9b6112278fe 106 */
DieterGraef 0:f9b6112278fe 107 uint32_t SysTick_GetMS(void);
DieterGraef 0:f9b6112278fe 108
DieterGraef 0:f9b6112278fe 109 /** \brief Delay for the specified number of milliSeconds
DieterGraef 0:f9b6112278fe 110 *
DieterGraef 0:f9b6112278fe 111 * For standalone systems. This function will block for the specified
DieterGraef 0:f9b6112278fe 112 * number of milliSconds. For RTOS based systems, this function will delay
DieterGraef 0:f9b6112278fe 113 * the task by the specified number of milliSeconds.
DieterGraef 0:f9b6112278fe 114 *
DieterGraef 0:f9b6112278fe 115 * \param[in] ms Time in milliSeconds to delay
DieterGraef 0:f9b6112278fe 116 */
DieterGraef 0:f9b6112278fe 117 void osDelay(uint32_t ms);
DieterGraef 0:f9b6112278fe 118
DieterGraef 0:f9b6112278fe 119 #ifdef __cplusplus
DieterGraef 0:f9b6112278fe 120 }
DieterGraef 0:f9b6112278fe 121 #endif
DieterGraef 0:f9b6112278fe 122 #endif
DieterGraef 0:f9b6112278fe 123
DieterGraef 0:f9b6112278fe 124 #endif /* __ARCH_SYS_ARCH_H__ */