lwip-sys with changes

Fork of lwip-sys by mbed official

Committer:
mbed_official
Date:
Fri Oct 09 08:00:21 2015 +0100
Revision:
17:12e78a2462d0
Parent:
9:d7ad3f3ee934
Child:
18:8b8671ab556f
Synchronized with git revision 3f2632bebc4c13ac78bcd8da89f91c19ef836e7f

Full URL: https://github.com/mbedmicro/mbed/commit/3f2632bebc4c13ac78bcd8da89f91c19ef836e7f/

Reflect the change size of structure of Mutex to Ethernet module

Who changed what in which revision?

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