Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
user.h
1/*
2 * user.h - CC31xx/CC32xx Host Driver Implementation
3 *
4 * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *
14 * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the
17 * distribution.
18 *
19 * Neither the name of Texas Instruments Incorporated nor the names of
20 * its contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *
35*/
36
37#ifndef _FREERTOS_DRIVERS_NET_C32XX_USER_H_
38#define _FREERTOS_DRIVERS_NET_C32XX_USER_H_
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44#include <string.h>
45#undef __CONCAT
46#include "cc_pal.h"
47
48#define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS (_u32)(10000000)
49#define SL_TIMESTAMP_MAX_VALUE 0xFFFFFFFF /* 32-bit timer counter */
50
70#define MAX_CONCURRENT_ACTIONS 10
81#define CPU_FREQ_IN_MHZ 80
82
83
124#define SL_INC_ARG_CHECK
125
126
146//#define SL_INC_STD_BSD_API_NAMING
147
148
162#define SL_INC_EXT_API
163
177#define SL_INC_WLAN_PKG
178
192#define SL_INC_SOCKET_PKG
193
207#define SL_INC_NET_APP_PKG
208
222#define SL_INC_NET_CFG_PKG
223
237#define SL_INC_NVMEM_PKG
238
252#define SL_INC_SOCK_SERVER_SIDE_API
253
267#define SL_INC_SOCK_CLIENT_SIDE_API
268
282#define SL_INC_SOCK_RECV_API
283
297#define SL_INC_SOCK_SEND_API
298
332#ifndef DISABLE_DEBUGGER_RECONNECT
333#define sl_DeviceEnablePreamble() NwpPowerOnPreamble()
334#else
335#define sl_DeviceEnablePreamble()
336#endif
337
346#define sl_DeviceEnable() NwpPowerOn()
347
355#define sl_DeviceDisable() NwpPowerOff()
356
365#define sl_DeviceDisable_WithNwpLpdsPoll() NwpPowerOff_WithNwpLpdsPoll()
366
396#define _SlFd_t Fd_t
397
431#define sl_IfOpen spi_Open
432
450#define sl_IfClose spi_Close
451
476#define sl_IfRead spi_Read
477
506#define sl_IfWrite spi_Write
507
531#define sl_IfRegIntHdlr(InterruptHdl , pValue) NwpRegisterInterruptHandler(InterruptHdl , pValue)
532
546#define sl_IfMaskIntHdlr() NwpMaskInterrupt()
547
560#define sl_IfUnMaskIntHdlr() NwpUnMaskInterrupt()
561
578/* #define SL_START_WRITE_STAT */
579
592#ifndef SL_TINY_EXT
593#if TARGET_IS_BARE
594#undef sl_GetTimestamp
595/* A timer must be started before using this function */
596/* User must allocate a 32-bit wide timer in order to take timestamps */
597#define sl_GetTimestamp TimerGetCurrentTimestamp
598#endif
599#endif
600
642#define SL_PLATFORM_MULTI_THREADED
643
644
645#ifdef SL_PLATFORM_MULTI_THREADED
646#include "osi.h"
647
648
655#define SL_OS_RET_CODE_OK ((int)OSI_OK)
656
663#define SL_OS_WAIT_FOREVER ((OsiTime_t)OSI_WAIT_FOREVER)
664
671#define SL_OS_NO_WAIT ((OsiTime_t)OSI_NO_WAIT)
672
680#define _SlTime_t OsiTime_t
681
695typedef OsiSyncObj_t _SlSyncObj_t;
696
697
712#define sl_SyncObjCreate(pSyncObj,pName) osi_SyncObjCreate(pSyncObj)
713
714
725#define sl_SyncObjDelete(pSyncObj) osi_SyncObjDelete(pSyncObj)
726
727
740#define sl_SyncObjSignal(pSyncObj) osi_SyncObjSignal(pSyncObj)
741
754#define sl_SyncObjSignalFromIRQ(pSyncObj) osi_SyncObjSignalFromISR(pSyncObj)
755
771#define sl_SyncObjWait(pSyncObj,Timeout) osi_SyncObjWait(pSyncObj,Timeout)
772
783typedef OsiLockObj_t _SlLockObj_t;
784
798#define sl_LockObjCreate(pLockObj,pName) osi_LockObjCreate(pLockObj)
799
810#define sl_LockObjDelete(pLockObj) osi_LockObjDelete(pLockObj)
811
831#define sl_LockObjLock(pLockObj,Timeout) osi_LockObjLock(pLockObj,Timeout)
832
843#define sl_LockObjUnlock(pLockObj) osi_LockObjUnlock(pLockObj)
844#else
845#ifdef NON_OS_PM
846#define _SlSyncWaitLoopCallback SimpleLinkSyncWaitLoopCallback
847#endif
848#endif
866#define SL_PLATFORM_EXTERNAL_SPAWN
867
868#ifdef SL_PLATFORM_EXTERNAL_SPAWN
869#define sl_Spawn(pEntry,pValue,flags) osi_Spawn(pEntry,pValue,flags)
870#endif
871
912/*
913#define SL_MEMORY_MGMT_DYNAMIC 1
914#define SL_MEMORY_MGMT_STATIC 0
915
916#define SL_MEMORY_MGMT SL_MEMORY_MGMT_DYNAMIC
917*/
918#ifdef SL_MEMORY_MGMT_DYNAMIC
919
920#ifdef SL_PLATFORM_MULTI_THREADED
921
928#define sl_Malloc(Size) mem_Malloc(Size)
929
936#define sl_Free(pMem) mem_Free(pMem)
937
938#else
939#include <stdlib.h>
946#define sl_Malloc(Size) malloc(Size)
947
954#define sl_Free(pMem) free(pMem)
955#endif
956
957#endif
958
1009#define _SlDrvHandleGeneralEvents SimpleLinkGeneralEventHandler
1010
1011
1092#define sl_WlanEvtHdlr SimpleLinkWlanEventHandler
1093
1094
1128#define sl_NetAppEvtHdlr SimpleLinkNetAppEventHandler
1129
1165#define sl_HttpServerCallback SimpleLinkHttpServerCallback
1190#define sl_SockEvtHdlr SimpleLinkSockEventHandler
1191
1192
1201#ifdef __cplusplus
1202}
1203#endif // __cplusplus
1204
1205#endif // _FREERTOS_DRIVERS_NET_C32XX_USER_H_