summaryrefslogtreecommitdiff
path: root/drivers/misc/gpsip/cgdriver/CgCpuOs.h
blob: ab201d961b44ad6ae8b807a1be882d1b5cc33dfa (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/******************************************************************************
 *                                LEGAL NOTICE                                *
 *                                                                            *
 *  USE OF THIS SOFTWARE (including any copy or compiled version thereof) AND *
 *  DOCUMENTATION IS SUBJECT TO THE SOFTWARE LICENSE AND RESTRICTIONS AND THE *
 *  WARRANTY DISLCAIMER SET FORTH IN LEGAL_NOTICE.TXT FILE. IF YOU DO NOT     *
 *  FULLY ACCEPT THE TERMS, YOU MAY NOT INSTALL OR OTHERWISE USE THE SOFTWARE *
 *  OR DOCUMENTATION.                                                         *
 *  NOTWITHSTANDING ANYTHING TO THE CONTRARY IN THIS NOTICE, INSTALLING OR    *
 *  OTHERISE USING THE SOFTWARE OR DOCUMENTATION INDICATES YOUR ACCEPTANCE OF *
 *  THE LICENSE TERMS AS STATED.                                              *
 *                                                                            *
 ******************************************************************************/
/* Version: 1.8.9\3686 */
/* Build  : 13 */
/* Date   : 12/08/2012 */
/**
	\file
	\brief Os depended services requires by CgCpu
	\attention This file should not be modified.
		If you think something is wrong here, please contact CellGuide

*/

#ifndef CG_CPU_OS_H
#define CG_CPU_OS_H

#ifdef __cplusplus
    extern "C"
    {
#endif

// ===========================================================================

#include "CgReturnCodes.h"


// ===========================================================================



/**
    \ingroup cg_cpu_os
	Map physical address space to virtual one

    \param[out]		pObject		Pointer to virtual address for physical memory region
    \param[in]		aBaseAddr	Base address (physical)
    \param[in]		aSize		Number of bytes

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuVirtualAllocate(volatile void **pObject, unsigned long aBaseAddr, unsigned long aSize);


/**
    \ingroup cg_cpu_os
	Un-map physical address space to virtual one

    \param			pObject		Pointer to virtual address for physical memory region

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuVirtualFree(volatile void **pObject);

/**
    \ingroup cg_cpu_os
	Allocate physical memory

    \param[out]		pObject		Pointer to virtual address of allocated memory
    \param[in]		pAddress	Address of allocated memory (physical)
    \param[in]		aSize		Number of bytes

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuPhysicalAllocate(void **pObject, U32 *pAddress, U32 aSize);

/**
    \ingroup cg_cpu_os
	Free physical memory

    \param[out]		pObject		Pointer to virtual address of allocated memory
    \param[out]		pAddress	physical address
    \param[in]		aSize		size in bytes

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuPhysicalFree(void **pObject, U32 *pAddress, unsigned long aSize);


/**
    \ingroup cg_cpu_os
	Enter Kernel mode

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuKernelModeEnter(void);

/**
    \ingroup cg_cpu_os
	Exit Kernel mode

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
TCgReturnCode CgCpuKernelModeExit(void);

/**
    \ingroup cg_cpu_os
	Cache sync

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk Success
*/
//TCgReturnCode strinsCgCpuCacheSync(void);
TCgReturnCode  CgCpuCacheSync(void);

/**
	Read value from host memory location
	Used to read CGsnap memory mapped registers and other memories, as required.

    \param[in]  aBaseAddr		Base address (Virtual Memory)
    \param[in]  aOffset			Offset from base address
    \param[out] apValue			Read value

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk if data ready is 0 (low active)

*/
TCgReturnCode CgxCpuReadMemory(U32 aBaseAddr, U32 aOffset, U32 *apValue);

/**
	Write value to host memory location
	Used to write CGsnap memory mapped registers and other memories, as required.

    \param[in]  aBaseAddr		Base address (Virtual Memory)
    \param[in]  aOffset			Offset from base address
    \param[in]	aValue			Value to write

	\return System wide return code  (see CgReturnCodes.h)
	\retval ECgOk if data ready is 0 (low active)

*/
TCgReturnCode CgxCpuWriteMemory(U32 aBaseAddr, U32 aOffset, U32 aValue);


/**
	Sleep for the specified time.

    \param[in]  milliSeconds	time in miliseconds

	\return System wide return code  (see CgReturnCodes.h)
*/
TCgReturnCode CgxCpuSleep(U32 milliSeconds);


/**
	Return the CPU tick counter (mostly in mSec)
	\note tick counter units are different for each CPU

	\return System wide return code  (see CgReturnCodes.h)
*/
TCgReturnCode CgxCpuTick(U32 * apTickMSec);


// ===========================================================================

#ifdef __cplusplus
    }
#endif

#endif