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