Linux API/linux2015. 11. 6. 11:09


커널 모듈 소스에서 보다 발견

결론은.. 걍 포인터?


[링크 : http://lxr.free-electrons.com/source/arch/mn10300/include/asm/io.h#L38]


109 #ifndef readb

110 #define readb readb

111 static inline u8 readb(const volatile void __iomem *addr)

112 {

113         return __raw_readb(addr);

114 }

115 #endif

116 

117 #ifndef readw

118 #define readw readw

119 static inline u16 readw(const volatile void __iomem *addr)

120 {

121         return __le16_to_cpu(__raw_readw(addr));

122 }

123 #endif

124 

125 #ifndef readl

126 #define readl readl

127 static inline u32 readl(const volatile void __iomem *addr)

128 {

129         return __le32_to_cpu(__raw_readl(addr));

130 }

131 #endif

132 

133 #ifdef CONFIG_64BIT

134 #ifndef readq

135 #define readq readq

136 static inline u64 readq(const volatile void __iomem *addr)

137 {

138         return __le64_to_cpu(__raw_readq(addr));

139 }

140 #endif

141 #endif /* CONFIG_64BIT */

142 

143 #ifndef writeb

144 #define writeb writeb

145 static inline void writeb(u8 value, volatile void __iomem *addr)

146 {

147         __raw_writeb(value, addr);

148 }

149 #endif

150 

151 #ifndef writew

152 #define writew writew

153 static inline void writew(u16 value, volatile void __iomem *addr)

154 {

155         __raw_writew(cpu_to_le16(value), addr);

156 }

157 #endif

158 

159 #ifndef writel

160 #define writel writel

161 static inline void writel(u32 value, volatile void __iomem *addr)

162 {

163         __raw_writel(__cpu_to_le32(value), addr);

164 }

165 #endif

166 

167 #ifdef CONFIG_64BIT

168 #ifndef writeq

169 #define writeq writeq

170 static inline void writeq(u64 value, volatile void __iomem *addr)

171 {

172         __raw_writeq(__cpu_to_le64(value), addr);

173 }

174 #endif

175 #endif /* CONFIG_64BIT */


[링크 : http://lxr.free-electrons.com/source/include/asm-generic/io.h#L127] 


'Linux API > linux' 카테고리의 다른 글

리눅스 동적 라이브러리(*.so) 사용하기  (0) 2016.04.04
리눅스 커널 모듈 관련 문서  (0) 2015.11.06
리눅스 모듈 프로그래밍 관련  (0) 2015.10.30
linux open mode  (0) 2015.10.29
named pipe / mkfifo()  (0) 2015.10.27
Posted by 구차니