move generic mmio functions to header file

This commit is contained in:
Howard Mao
2017-05-29 14:33:30 -07:00
parent 062d443863
commit 44aa4e25a9
3 changed files with 18 additions and 12 deletions

16
tests/mmio.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef __MMIO_H__
#define __MMIO_H__
static inline void write_reg(unsigned long addr, unsigned int data)
{
volatile unsigned int *ptr = (volatile unsigned int *) addr;
*ptr = data;
}
static inline unsigned long read_reg(unsigned long addr)
{
volatile unsigned int *ptr = (volatile unsigned int *) addr;
return *ptr;
}
#endif