SimpleLink CC3120/CC3220 Host Driver  Version 2.0.1.22
Simplifies the implementation of Internet connectivity
user.h
1 /*
2  * user.h - CC31xx/CC32xx Host Driver Implementation
3  *
4  * Copyright (C) 2017 Texas Instruments Incorporated - https://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 /******************************************************************************
38 * user.h - CC31xx/CC32xx Host Driver Implementation
39 ******************************************************************************/
40 
41 #ifndef __USER_H__
42 #define __USER_H__
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 
49 #include <string.h>
50 #include <ti/drivers/net/wifi/porting/cc_pal.h>
51 
52 typedef signed int _SlFd_t;
53 
54 #define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS (_u32)(10)
55 #define SL_TIMESTAMP_MAX_VALUE (_u32)(0xFFFFFFFF)
56 
76 #ifndef SL_TINY_EXT
77 #define MAX_CONCURRENT_ACTIONS 10
78 #else
79 #define MAX_CONCURRENT_ACTIONS 1
80 #endif
81 
92 /* #define CPU_FREQ_IN_MHZ 80 */
93 
94 
124 #define SL_RUNTIME_EVENT_REGISTERATION
125 
126 
147 #define SL_INC_ARG_CHECK
148 
149 
177 #define SL_INC_INTERNAL_ERRNO
178 
192 #define SL_INC_EXT_API
193 
194 
208 #define SL_INC_WLAN_PKG
209 
210 
224 #define SL_INC_SOCKET_PKG
225 
226 
240 #define SL_INC_NET_APP_PKG
241 
242 
256 #define SL_INC_NET_CFG_PKG
257 
258 
272 #define SL_INC_NVMEM_PKG
273 
274 
288 #define SL_INC_NVMEM_EXT_PKG
289 
290 
304 #define SL_INC_SOCK_SERVER_SIDE_API
305 
306 
320 #define SL_INC_SOCK_CLIENT_SIDE_API
321 
322 
336 #define SL_INC_SOCK_RECV_API
337 
338 
352 #define SL_INC_SOCK_SEND_API
353 
354 
388 #define sl_DeviceEnablePreamble()
389 
390 
391 
400 #define sl_DeviceEnable() NwpPowerOn()
401 
402 
410 #define sl_DeviceDisable() NwpPowerOff()
411 
412 
442 #define _SlFd_t Fd_t
443 
444 
478 #define sl_IfOpen spi_Open
479 
480 
498 #define sl_IfClose spi_Close
499 
500 
525 #define sl_IfRead spi_Read
526 
527 
556 #define sl_IfWrite spi_Write
557 
558 
582 #define sl_IfRegIntHdlr(InterruptHdl , pValue) NwpRegisterInterruptHandler(InterruptHdl , pValue)
583 
584 
596 #define sl_IfMaskIntHdlr() NwpMaskInterrupt()
597 
598 
610 #define sl_IfUnMaskIntHdlr() NwpUnMaskInterrupt()
611 
612 
629 /* #define SL_START_WRITE_STAT */
630 
631 #ifdef SL_START_WRITE_STAT
632 #define sl_IfStartWriteSequence
633 #define sl_IfEndWriteSequence
634 #endif
635 
636 
654 #ifndef SL_TINY_EXT
655 #undef slcb_GetTimestamp
656 /* A timer must be started before using this function */
657 #define slcb_GetTimestamp TimerGetCurrentTimestamp
658 #endif
659 
660 
671 #define WAIT_NWP_SHUTDOWN_READY NwpWaitForShutDownInd()
672 
688 #ifndef SL_INC_INTERNAL_ERRNO
689 #define slcb_SetErrno
690 #endif
691 
729 /*
730 #define SL_PLATFORM_MULTI_THREADED
731 */
732 
733 #ifdef SL_PLATFORM_MULTI_THREADED
734 
741 #define SL_OS_RET_CODE_OK ((int)OS_OK)
742 
749 #define SL_OS_WAIT_FOREVER ((uint32_t)OS_WAIT_FOREVER)
750 
757 #define SL_OS_NO_WAIT ((uint32_t)OS_NO_WAIT)
758 
766 #define _SlTime_t uint32_t
767 
768 
769 #endif //SL_PLATFORM_MULTI_THREADED
770 
784 #define _SlSyncObj_t SemaphoreP_Handle
785 
786 
801 #define sl_SyncObjCreate(pSyncObj,pName) Semaphore_create_handle(pSyncObj)
802 
803 
814 #define sl_SyncObjDelete(pSyncObj) SemaphoreP_delete_handle(pSyncObj)
815 
816 
829 #define sl_SyncObjSignal(pSyncObj) SemaphoreP_post_handle(pSyncObj)
830 
831 
844 #define sl_SyncObjSignalFromIRQ(pSyncObj) SemaphoreP_post_handle(pSyncObj)
845 
846 
862 #define sl_SyncObjWait(pSyncObj,Timeout) SemaphoreP_pend((*(pSyncObj)),Timeout)
863 
864 
875 #define _SlLockObj_t MutexP_Handle
876 
890 #define sl_LockObjCreate(pLockObj, pName) Mutex_create_handle(pLockObj)
891 
892 
903 #define sl_LockObjDelete(pLockObj) MutexP_delete_handle(pLockObj)
904 
905 
925 #define sl_LockObjLock(pLockObj,Timeout) Mutex_lock(*(pLockObj))
926 
927 
938 #define sl_LockObjUnlock(pLockObj) Mutex_unlock(*(pLockObj))
939 
940 
959 //#define SL_PLATFORM_EXTERNAL_SPAWN
960 
961 #ifdef SL_PLATFORM_EXTERNAL_SPAWN
962 #define sl_Spawn(pEntry,pValue,flags) os_Spawn(pEntry,pValue,flags)
963 #endif
964 
1005 /*
1006 #define SL_MEMORY_MGMT_DYNAMIC 1
1007 #define SL_MEMORY_MGMT_STATIC 0
1008 
1009 #define SL_MEMORY_MGMT SL_MEMORY_MGMT_DYNAMIC
1010 */
1011 #ifdef SL_MEMORY_MGMT_DYNAMIC
1012 
1013 #ifdef SL_PLATFORM_MULTI_THREADED
1014 
1021 #define sl_Malloc(Size) mem_Malloc(Size)
1022 
1029 #define sl_Free(pMem) mem_Free(pMem)
1030 
1031 #else
1032 #include <stdlib.h>
1039 #define sl_Malloc(Size) malloc(Size)
1040 
1047 #define sl_Free(pMem) free(pMem)
1048 #endif
1049 
1050 #endif
1051 
1101 #define slcb_DeviceFatalErrorEvtHdlr SimpleLinkFatalErrorEventHandler
1102 
1113 #define slcb_DeviceGeneralEvtHdlr SimpleLinkGeneralEventHandler
1114 
1195 #define slcb_WlanEvtHdlr SimpleLinkWlanEventHandler
1196 
1197 
1231 #define slcb_NetAppEvtHdlr SimpleLinkNetAppEventHandler
1232 
1268 #define slcb_NetAppHttpServerHdlr SimpleLinkHttpServerEventHandler
1269 
1270 
1271 
1288 #define slcb_NetAppRequestHdlr SimpleLinkNetAppRequestEventHandler
1289 
1290 
1291 
1306 #define slcb_NetAppRequestMemFree SimpleLinkNetAppRequestMemFreeEventHandler
1307 
1308 
1309 
1334 #define slcb_SockEvtHdlr SimpleLinkSockEventHandler
1335 
1336 
1355 #ifndef SL_PLATFORM_MULTI_THREADED
1356 #define slcb_SocketTriggerEventHandler SimpleLinkSocketTriggerEventHandler
1357 #endif
1358 
1366 #ifdef __cplusplus
1367 }
1368 #endif // __cplusplus
1369 
1370 #endif // __USER_H__