aboutsummaryrefslogtreecommitdiff
path: root/KSDK_1.2.0/usb/adapter/sources/sdk/adapter_sdk.h
blob: f1617189b7c283b286530ce3bbab4e8577be4ce7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**HEADER********************************************************************
*
* Copyright (c) 2013 Freescale Semiconductor;
* All Rights Reserved
*
*
***************************************************************************
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESSED OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL FREESCALE OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
**************************************************************************
*
* $FileName: osadapter_ucos.h$
* $Version :
* $Date    :
*
* Comments:
*
* @brief The file contains the definition of OS adapter base-on SDK OSA.
*
*****************************************************************************/

#ifndef _USB_OSADAPTER_SDK_H
#define _USB_OSADAPTER_SDK_H 1

#include "fsl_os_abstraction.h"
#if !defined (FSL_RTOS_MQX)
#include "compiler.h"
#endif

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "fsl_debug_console.h"

#ifndef BIG_ENDIAN
#define BIG_ENDIAN           0
#define LITTLE_ENDIAN        1
#endif

#define ENDIANNESS           LITTLE_ENDIAN

#define _CODE_PTR_ *

#ifndef FALSE
#define FALSE ((bool)0)
#endif

#ifndef TRUE
#define TRUE ((bool)1)
#endif

#define UNUSED(x)   (void)x;

#define OS_MSGQ_TIMEOUT    (-2)
//extern void * memset (void *, int32_t, unsigned);
//extern int32_t printf_kinetis (const char *fmt, ...);

#define USB_PRINTF                                           PRINTF
//#define OS_install_isr
#define OS_install_isr(num, isr, data)   OSA_InstallIntHandler(num, isr)
#define OS_intr_init(num, prior, subprior, enable)         \
do { \
    NVIC_SetPriority(num, prior); \
    NVIC_EnableIRQ(num); \
}while(0)

#define TICKS_PER_SEC 1000

//#define TICKS_TO_MSEC(ticks) ((ticks)*1000uL/OS_TICKS_PER_SEC)

#define OS_Lock()   OSA_EnterCritical(kCriticalDisableInt)
#define OS_Unlock() OSA_ExitCritical(kCriticalDisableInt)

/* Based on the targets it should be modified, for ColdFire it is MBYTES */
#define OS_dcache_invalidate_mlines(p,n)
#define OS_dcache_flush_mlines(p,n)


#ifndef OS_Mem_alloc_uncached
#define OS_Mem_alloc_uncached             OS_Mem_alloc
#endif

#ifndef OS_Mem_alloc_uncached_zero
#define OS_Mem_alloc_uncached_zero        OS_Mem_alloc_zero
#endif

#define OS_Mem_alloc_zero(n)              OSA_MemAllocZero(n)
#define OS_Mem_alloc(n)                   OSA_MemAlloc(n)
#define OS_Mem_free(ptr)                  OSA_MemFree(ptr)

#define OS_Mem_zero(ptr,n)                memset((ptr),(0),(n))
#define OS_Mem_copy(src,dst,n)            memcpy((dst),(src),(n))
#if defined(__cplusplus)
extern "C"{
#endif
extern uint32_t OS_MsgQ_Is_Empty(os_msgq_handle msgq, void* msg);

#if defined(__cplusplus)
}
#endif
/* TimeDelay */
#define OS_Time_delay                     OSA_TimeDelay

#endif