local fork (temporary)

Dependents:   VodafoneUSBModem_bleedingedge2

Fork of lwip-sys by mbed official

Committer:
ashleymills
Date:
Fri Apr 26 16:53:18 2013 +0000
Revision:
9:6ba677cca4d8
Parent:
8:742ae4a0ca3f
Minor change for resolution of error.h

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
emilmont 8:742ae4a0ca3f 43 int32_t data[3];
emilmont 8:742ae4a0ca3f 44 #endif
emilmont 8:742ae4a0ca3f 45 } sys_mutex_t;
emilmont 8:742ae4a0ca3f 46
emilmont 8:742ae4a0ca3f 47 // === MAIL BOX ===
emilmont 8:742ae4a0ca3f 48 #define MB_SIZE 8
emilmont 8:742ae4a0ca3f 49
emilmont 8:742ae4a0ca3f 50 typedef struct {
emilmont 8:742ae4a0ca3f 51 osMessageQId id;
emilmont 8:742ae4a0ca3f 52 osMessageQDef_t def;
emilmont 8:742ae4a0ca3f 53 #ifdef CMSIS_OS_RTX
emilmont 8:742ae4a0ca3f 54 uint32_t queue[MB_SIZE];
emilmont 8:742ae4a0ca3f 55 #endif
emilmont 8:742ae4a0ca3f 56 } sys_mbox_t;
emilmont 8:742ae4a0ca3f 57
emilmont 8:742ae4a0ca3f 58 #define SYS_MBOX_NULL ((uint32_t) NULL)
emilmont 8:742ae4a0ca3f 59 #define sys_mbox_valid(x) (((*x).id == NULL) ? 0 : 1 )
emilmont 8:742ae4a0ca3f 60 #define sys_mbox_set_invalid(x) ( (*x).id = NULL )
emilmont 8:742ae4a0ca3f 61
emilmont 8:742ae4a0ca3f 62 #if ((DEFAULT_RAW_RECVMBOX_SIZE) > (MB_SIZE)) || \
emilmont 8:742ae4a0ca3f 63 ((DEFAULT_UDP_RECVMBOX_SIZE) > (MB_SIZE)) || \
emilmont 8:742ae4a0ca3f 64 ((DEFAULT_TCP_RECVMBOX_SIZE) > (MB_SIZE)) || \
emilmont 8:742ae4a0ca3f 65 ((DEFAULT_ACCEPTMBOX_SIZE) > (MB_SIZE)) || \
emilmont 8:742ae4a0ca3f 66 ((TCPIP_MBOX_SIZE) > (MB_SIZE))
emilmont 8:742ae4a0ca3f 67 # error Mailbox size not supported
emilmont 8:742ae4a0ca3f 68 #endif
emilmont 8:742ae4a0ca3f 69
emilmont 8:742ae4a0ca3f 70 // === THREAD ===
emilmont 8:742ae4a0ca3f 71 typedef struct {
emilmont 8:742ae4a0ca3f 72 osThreadId id;
emilmont 8:742ae4a0ca3f 73 osThreadDef_t def;
emilmont 8:742ae4a0ca3f 74 } sys_thread_data_t;
emilmont 8:742ae4a0ca3f 75 typedef sys_thread_data_t* sys_thread_t;
emilmont 8:742ae4a0ca3f 76
emilmont 8:742ae4a0ca3f 77 #define SYS_THREAD_POOL_N 6
emilmont 8:742ae4a0ca3f 78 #define SYS_DEFAULT_THREAD_STACK_DEPTH DEFAULT_STACK_SIZE
emilmont 8:742ae4a0ca3f 79
emilmont 8:742ae4a0ca3f 80 // === PROTECTION ===
emilmont 8:742ae4a0ca3f 81 typedef int sys_prot_t;
emilmont 8:742ae4a0ca3f 82
emilmont 8:742ae4a0ca3f 83 #else
emilmont 8:742ae4a0ca3f 84 #ifdef __cplusplus
emilmont 8:742ae4a0ca3f 85 extern "C" {
emilmont 8:742ae4a0ca3f 86 #endif
emilmont 8:742ae4a0ca3f 87
emilmont 8:742ae4a0ca3f 88 /** \brief Init systick to 1ms rate
emilmont 8:742ae4a0ca3f 89 *
emilmont 8:742ae4a0ca3f 90 * This init the systick to 1ms rate. This function is only used in standalone
emilmont 8:742ae4a0ca3f 91 * systems.
emilmont 8:742ae4a0ca3f 92 */
emilmont 8:742ae4a0ca3f 93 void SysTick_Init(void);
emilmont 8:742ae4a0ca3f 94
emilmont 8:742ae4a0ca3f 95
emilmont 8:742ae4a0ca3f 96 /** \brief Get the current systick time in milliSeconds
emilmont 8:742ae4a0ca3f 97 *
emilmont 8:742ae4a0ca3f 98 * Returns the current systick time in milliSeconds. This function is only
emilmont 8:742ae4a0ca3f 99 * used in standalone systems.
emilmont 8:742ae4a0ca3f 100 *
emilmont 8:742ae4a0ca3f 101 * /returns current systick time in milliSeconds
emilmont 8:742ae4a0ca3f 102 */
emilmont 8:742ae4a0ca3f 103 uint32_t SysTick_GetMS(void);
emilmont 8:742ae4a0ca3f 104
emilmont 8:742ae4a0ca3f 105 /** \brief Delay for the specified number of milliSeconds
emilmont 8:742ae4a0ca3f 106 *
emilmont 8:742ae4a0ca3f 107 * For standalone systems. This function will block for the specified
emilmont 8:742ae4a0ca3f 108 * number of milliSconds. For RTOS based systems, this function will delay
emilmont 8:742ae4a0ca3f 109 * the task by the specified number of milliSeconds.
emilmont 8:742ae4a0ca3f 110 *
emilmont 8:742ae4a0ca3f 111 * \param[in] ms Time in milliSeconds to delay
emilmont 8:742ae4a0ca3f 112 */
emilmont 8:742ae4a0ca3f 113 void osDelay(uint32_t ms);
emilmont 8:742ae4a0ca3f 114
emilmont 8:742ae4a0ca3f 115 #ifdef __cplusplus
emilmont 8:742ae4a0ca3f 116 }
emilmont 8:742ae4a0ca3f 117 #endif
emilmont 8:742ae4a0ca3f 118 #endif
emilmont 8:742ae4a0ca3f 119
emilmont 8:742ae4a0ca3f 120 #endif /* __ARCH_SYS_ARCH_H__ */