Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvrm_hardware_access.h

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_gpio.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_i2c.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007-2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33 #ifndef INCLUDED_NVRM_HARDWARE_ACCESS_H
34 #define INCLUDED_NVRM_HARDWARE_ACCESS_H
35
36 #include "nvcommon.h"
37 #include "nvrm_init.h"
38 #include "nvos.h"
39
40 #ifdef __cplusplus
41 extern "C"
42 {
43 #endif /* __cplusplus */
44
45 #if !defined(NV_OAL)
46 #define NV_OAL 0
47 #endif
48
49 // By default, sim is supported on WinXP/x86 and Linux/x86 builds only.
50 #if !defined(NV_DEF_ENVIRONMENT_SUPPORTS_SIM)
51 #if NVCPU_IS_X86 && ((NVOS_IS_WINDOWS && !NVOS_IS_WINDOWS_CE) || NVOS_IS_LINUX) && !NV_OAL
52 #define NV_DEF_ENVIRONMENT_SUPPORTS_SIM 1
53 #else
54 #define NV_DEF_ENVIRONMENT_SUPPORTS_SIM 0
55 #endif
56 #endif
57
58 /**
59 * NV_WRITE* and NV_READ* - low level read/write api to hardware.
60 *
61 * These macros should be used to read and write registers and memory
62 * in NvDDKs so that the DDK will work on simulation and real hardware
63 * with no changes.
64 *
65 * This is for hardware modules that are NOT behind the host. Modules that
66 * are behind the host should use nvrm_channel.h.
67 *
68 * A DDK can obtain a mapping to its registers by using the
69 * NvRmPhysicalMemMap() function. This mapping is always uncached. The
70 * resulting pointer can then be used with NV_READ and NV_WRITE.
71 */
72
73 /*
74 * Maps the given physical address to the user's virtual address space.
75 *
76 * @param phys The physical address to map into the virtual address space
77 * @param size The size of the mapping
78 * @param flags Any flags for the mapping -- exactly match's NVOS_MAP_*
79 * @param memType The memory mapping to use (uncached, write-combined, etc.)
80 * @param ptr Output -- the resulting virtual pointer
81 */
82 // FIXME: NvOs needs to take this up, however I think this is more
83 // complex than just mapping. E.G. does it map into the kernel vaddr, or
84 // the current process vaddr? And how does this work on windows and
85 // windows-ce?
86 NvError NvRmPhysicalMemMap(NvRmPhysAddr phys, size_t size, NvU32 flags,
87 NvOsMemAttribute memType, void **ptr );
88
89 /*
90 * Unmaps the given virtual address from NvRmPhysicalMemMap.
91 */
92 void NvRmPhysicalMemUnmap(void *ptr, size_t size);
93
94 /**
95 * NV_WRITE[8|16|32|64] - Writes N data bits to hardware.
96 *
97 * @param a The address to write.
98 * @param d The data to write.
99 */
100
101 /**
102 * NV_READ[8|16|32|64] - Reads N bits from hardware.
103 *
104 * @param a The address to read.
105 */
106
107 void NvWrite08(void *addr, NvU8 data);
108 void NvWrite16(void *addr, NvU16 data);
109 void NvWrite32(void *addr, NvU32 data);
110 void NvWrite64(void *addr, NvU64 data);
111 NvU8 NvRead08(void *addr);
112 NvU16 NvRead16(void *addr);
113 NvU32 NvRead32(void *addr);
114 NvU64 NvRead64(void *addr);
115 void NvWriteBlk(void *dst, const void *src, NvU32 length);
116 void NvReadBlk(void *dst, const void *src, NvU32 length);
117
118 #if NV_DEF_ENVIRONMENT_SUPPORTS_SIM == 1
119
120 #define NV_WRITE08(a,d) NvWrite08((void *)(a),(d))
121 #define NV_WRITE16(a,d) NvWrite16((void *)(a),(d))
122 #define NV_WRITE32(a,d) NvWrite32((void *)(a),(d))
123 #define NV_WRITE64(a,d) NvWrite64((void *)(a),(d))
124 #define NV_READ8(a) NvRead08((void *)(a))
125 #define NV_READ16(a) NvRead16((void *)(a))
126 #define NV_READ32(a) NvRead32((void *)(a))
127 #define NV_READ64(a) NvRead64((void *)(a))
128 #define NV_WRITE(dst, src, len) NvWriteBlk(dst, src, len)
129 #define NV_READ(dst, src, len) NvReadBlk(dst, src, len)
130
131 #else
132 /* connected to hardware */
133
134 #define NV_WRITE08(a,d) *((volatile NvU8 *)(a)) = (d)
135 #define NV_WRITE16(a,d) *((volatile NvU16 *)(a)) = (d)
136 #define NV_WRITE32(a,d) *((volatile NvU32 *)(a)) = (d)
137 #define NV_WRITE64(a,d) *((volatile NvU64 *)(a)) = (d)
138 #define NV_READ8(a) *((const volatile NvU8 *)(a))
139 #define NV_READ16(a) *((const volatile NvU16 *)(a))
140 #define NV_READ32(a) *((const volatile NvU32 *)(a))
141 #define NV_READ64(a) *((const volatile NvU64 *)(a))
142 #define NV_WRITE(dst, src, len) NvOsMemcpy(dst, src, len)
143 #define NV_READ(dst, src, len) NvOsMemcpy(dst, src, len)
144
145 #endif // !hardware
146
147 #ifdef __cplusplus
148 }
149 #endif /* __cplusplus */
150
151 #endif // INCLUDED_NVRM_HARDWARE_ACCESS_H
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_gpio.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_i2c.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698