#ifndef _aplmt_networking_lwip_arch_sysarchapi_h_ #define _aplmt_networking_lwip_arch_sysarchapi_h_ /*---------------------------------------------------------------------------- ** SUMMARY: APLMT Platform Architecture Interface the lwIP Network Stack (LWIPARCH) ** ** DESCRIPTION: ** This file defines the interface for supporting the lwIP sys-arch layer. ** If you haven't read the lwIP documentation, do so now. ** ** NOTE: The current implementation of the sys_arch layer does NOT use the ** the 'light-weight' protection locks (i.e. SYS_LIGHTWEIGHT_PROT is ** turned OFF). This is due to the fact that the light-weight locks ** are used indirectly to bound calls to mem_free(). Since mem_free() ** can take a relatively long time (since its does heap consolidation) ** it is unacceptable to have interrupts disabled that long. ** ** RESOURCES: ** ---------- ** THREADING: LWIPARCH makes uses a Thread Worker Pool for supplying ** threads to LWIP. At least one worker thread is ** required (1 for the stack). Additional threads are ** needed (per connection) if the application is using ** SLIP and/or PPP. ** ** SEMAPHORES: Requires a semaphore factory that can generate at least ** ??? semaphores. ** ** ITC: LWIPARCH uses the SMBOX mailbox interface. It requires ** the AplmtSmboxMsg type be of type: void* ** ** LIBC: LWIP requires such functions as memset(), memcpy(), etc. ** that are typically provided by the platform's standard ** C Library. Use the platform-mapping for the 'cc.h' ** header file to provide this support ** ** CONFIGURATION ** ------------- ** COMPILE: none. ** ** APPLICATION: OPTION_APLMTLWIP_MAX_MSGS_PER_MAILBOX ** OPTION_APLMTLWIP_MAX_MAILBOXES ** OPTION_APLMTLWIP_NUM_THREAD_WORKERS ** ** PLATFORM: none. ** ** ** NOTES: ** 1. Unless explicitly stated otherwise, NONE of the following methods may be ** called from interrupt service routines. ** 2. Unless explicitly stated otherwise, NONE of the following methods may be ** called before the platform's kernel is running. ** 3. Unless explicitly stated otherwise, all of the following methods assume ** that interrupts are enabled at the time of the call. ----------------------------------------------------------------------------*/ #include "aplcfg.h" /* For: Application configuration */ #include "apl/types/types.h" /* For: basic types */ #include "apl/system/errapi.h" /* For: absolute error codes */ #include "apl/containers/slistapi.h" /* For: Rx FIFO */ #include "aplmt/os/workersapi.h" /* For: Thread pool type */ #include "aplmt/os/semaapi.h" /* For: sema factory type */ #ifdef __cplusplus extern "C" { #endif /*-------------- ERRORS ----------------------------------------------------*/ /***/ #define APLMT_ERRSTR_LWIPARCH_OUT_OF_THREADS "LWIP-ARCH: Out of threads." /***/ #define APLMT_ERR_LWIPARCH_OUT_OF_THREADS _APLMT_ERR_LWIPARCH_OUT_OF_THREADS /***/ #define APLMT_ERRSTR_LWIPARCH_OUT_OF_SEMAPHORES "LWIP-ARCH: Out of semaphores." /***/ #define APLMT_ERR_LWIPARCH_OUT_OF_SEMAPHORES _APLMT_ERR_LWIPARCH_OUT_OF_SEMAPHORES /***/ #define APLMT_ERRSTR_LWIPARCH_OUT_OF_MBOXES "LWIP-ARCH: Out of Mailboxes." /***/ #define APLMT_ERR_LWIPARCH_OUT_OF_MBOXES _APLMT_ERR_LWIPARCH_OUT_OF_MBOXES /***/ #define APLMT_ERRSTR_LWIPARCH_DEBUG_ASSERT "LWIP-ARCH: Debug Assertion failed." /***/ #define APLMT_ERR_LWIPARCH_DEBUG_ASSERT _APLMT_ERR_LWIPARCH_DEBUG_ASSERT /***/ #define APLMT_ERRSTR_LWIPARCH_MAILBOX_FULL "LWIP-ARCH: Attempted to post a message to a full mailbox." /***/ #define APLMT_ERR_LWIPARCH_MAILBOX_FULL _APLMT_ERR_LWIPARCH_MAILBOX_FULL /***/ #define APLMT_ERRSTR_LWIPARCH_INTERNAL_MEMORY_ERROR "LWIP-ARCH: Internal memory error." /***/ #define APLMT_ERR_LWIPARCH_INTERNAL_MEMORY_ERROR _APLMT_ERR_LWIPARCH_INTERNAL_MEMORY_ERROR /*-------------- CONSTANTS -------------------------------------------------*/ /** Number of SMBOX mailboxes allocated to LWIP. Default is 16. */ #ifndef OPTION_APLMTLWIP_MAX_MAILBOXES #define OPTION_APLMTLWIP_MAX_MAILBOXES 16 #endif /** Number of messages per mailbox. Default is 64. */ #ifndef OPTION_APLMTLWIP_MAX_MSGS_PER_MAILBOX #define OPTION_APLMTLWIP_MAX_MSGS_PER_MAILBOX 64 #endif /** Number of threads in the Thread Worker Pool assigned to LWIP. Default is 1. NOTE: This value MUST match the number of threads in the the Assigned Thread Worker Pool. */ #ifndef OPTION_APLMTLWIP_NUM_THREAD_WORKERS #define OPTION_APLMTLWIP_NUM_THREAD_WORKERS 1 #endif /*-------------- INLINE PLATFORM IMPLEMENTATION ----------------------------*/ #include "aplmt/networking/lwip/arch/sysarch.h" /*-------------- PUBLIC/PUBLISHED API --------------------------------------*/ /** This method is used by the SYS_ARCH layer to get the semaphore factory it should use. The application is repsonsible for implementing this method. */ AplmtSemafacHdl AplmtLWIP_archGetSemaFactory(void); /** This method is used by the SYS_ARCH layer to get the Thread Worker Pool it should use. The application is repsonsible for implementing this method. */ AplmtThreadWorkerPoolHdl AplmtLWIP_archGetThreadWorkerPool(void); /** This method returns the FIFO that is used to queue the incoming packet messages. This method is implemented by the SYS_ARCH layer. Prototype: AplSListHdl AplmtLWIP_archGetRxFifo(void); */ #define AplmtLWIP_archGetRxFifo _AplmtLWIP_archGetRxFifo #ifdef __cplusplus } #endif /*--------------------------------------------------------------------------*/ #endif /* end _aplmt_networking_lwip_arch_sysarchapi_h_ */