Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
nonos_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
38
39#ifndef _FREERTOS_DRIVER_NONOS_USER_H_
40#define _FREERTOS_DRIVER_NONOS_USER_H_
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46#define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS (_u32)(10000000)
47#define SL_TIMESTAMP_MAX_VALUE 0xFFFFFFFF /* 32-bit timer counter */
48
49#include <string.h>
50#include "cc_pal.h"
51
71#define MAX_CONCURRENT_ACTIONS 10
82#define CPU_FREQ_IN_MHZ 80
83
84
125#define SL_INC_ARG_CHECK
126
127
147#define SL_INC_STD_BSD_API_NAMING
148
149
163#define SL_INC_EXT_API
164
178#define SL_INC_WLAN_PKG
179
193#define SL_INC_SOCKET_PKG
194
208#define SL_INC_NET_APP_PKG
209
223#define SL_INC_NET_CFG_PKG
224
238#define SL_INC_NVMEM_PKG
239
253#define SL_INC_SOCK_SERVER_SIDE_API
254
268#define SL_INC_SOCK_CLIENT_SIDE_API
269
283#define SL_INC_SOCK_RECV_API
284
298#define SL_INC_SOCK_SEND_API
299
333#ifndef DISABLE_DEBUGGER_RECONNECT
334#define sl_DeviceEnablePreamble() NwpPowerOnPreamble()
335#else
336#define sl_DeviceEnablePreamble()
337#endif
338
347#define sl_DeviceEnable() NwpPowerOn()
348
356#define sl_DeviceDisable() NwpPowerOff()
357
366#define sl_DeviceDisable_WithNwpLpdsPoll() NwpPowerOff_WithNwpLpdsPoll()
367
397#define _SlFd_t Fd_t
398
432#define sl_IfOpen spi_Open
433
451#define sl_IfClose spi_Close
452
477#define sl_IfRead spi_Read
478
507#define sl_IfWrite spi_Write
508
532#define sl_IfRegIntHdlr(InterruptHdl , pValue) NwpRegisterInterruptHandler(InterruptHdl , pValue)
533
547#define sl_IfMaskIntHdlr() NwpMaskInterrupt()
548
561#define sl_IfUnMaskIntHdlr() NwpUnMaskInterrupt()
562
579/* #define SL_START_WRITE_STAT */
580
593#ifndef SL_TINY_EXT
594#if TARGET_IS_BARE
595#undef sl_GetTimestamp
596/* A timer must be started before using this function */
597/* User must allocate a 32-bit wide timer in order to take timestamps */
598#define sl_GetTimestamp TimerGetCurrentTimestamp
599#endif
600#endif
601
642/*
643#define SL_PLATFORM_MULTI_THREADED
644*/
645
646#ifdef SL_PLATFORM_MULTI_THREADED
647#include "osi.h"
648
649
656#define SL_OS_RET_CODE_OK ((int)OSI_OK)
657
664#define SL_OS_WAIT_FOREVER ((OsiTime_t)OSI_WAIT_FOREVER)
665
672#define SL_OS_NO_WAIT ((OsiTime_t)OSI_NO_WAIT)
673
681#define _SlTime_t OsiTime_t
682
696typedef OsiSyncObj_t _SlSyncObj_t;
697
698
713#define sl_SyncObjCreate(pSyncObj,pName) osi_SyncObjCreate(pSyncObj)
714
715
726#define sl_SyncObjDelete(pSyncObj) osi_SyncObjDelete(pSyncObj)
727
728
741#define sl_SyncObjSignal(pSyncObj) osi_SyncObjSignal(pSyncObj)
742
755#define sl_SyncObjSignalFromIRQ(pSyncObj) osi_SyncObjSignalFromISR(pSyncObj)
756
772#define sl_SyncObjWait(pSyncObj,Timeout) osi_SyncObjWait(pSyncObj,Timeout)
773
784typedef OsiLockObj_t _SlLockObj_t;
785
799#define sl_LockObjCreate(pLockObj,pName) osi_LockObjCreate(pLockObj)
800
811#define sl_LockObjDelete(pLockObj) osi_LockObjDelete(pLockObj)
812
832#define sl_LockObjLock(pLockObj,Timeout) osi_LockObjLock(pLockObj,Timeout)
833
844#define sl_LockObjUnlock(pLockObj) osi_LockObjUnlock(pLockObj)
845#else
846#ifdef NON_OS_PM
847#define _SlSyncWaitLoopCallback SimpleLinkSyncWaitLoopCallback
848#endif
849#endif
867#define SL_PLATFORM_EXTERNAL_SPAWN
868
869#ifdef SL_PLATFORM_EXTERNAL_SPAWN
870#define sl_Spawn(pEntry,pValue,flags) osi_Spawn(pEntry,pValue,flags)
871#endif
872
913/*
914#define SL_MEMORY_MGMT_DYNAMIC 1
915#define SL_MEMORY_MGMT_STATIC 0
916
917#define SL_MEMORY_MGMT SL_MEMORY_MGMT_DYNAMIC
918*/
919#ifdef SL_MEMORY_MGMT_DYNAMIC
920
921#ifdef SL_PLATFORM_MULTI_THREADED
922
929#define sl_Malloc(Size) mem_Malloc(Size)
930
937#define sl_Free(pMem) mem_Free(pMem)
938
939#else
940#include <stdlib.h>
947#define sl_Malloc(Size) malloc(Size)
948
955#define sl_Free(pMem) free(pMem)
956#endif
957
958#endif
959
1010#define _SlDrvHandleGeneralEvents SimpleLinkGeneralEventHandler
1011
1012
1093#define sl_WlanEvtHdlr SimpleLinkWlanEventHandler
1094
1095
1129#define sl_NetAppEvtHdlr SimpleLinkNetAppEventHandler
1130
1166#define sl_HttpServerCallback SimpleLinkHttpServerCallback
1191#define sl_SockEvtHdlr SimpleLinkSockEventHandler
1192
1193
1202#ifdef __cplusplus
1203}
1204#endif // __cplusplus
1205
1206#endif // _FREERTOS_DRIVER_NONOS_USER_H_