software_APIs  1.0.0
user_space.h
Go to the documentation of this file.
1 
4 #ifndef USER_ADDR_SPACE_C_HEADER_FILE
5 #define USER_ADDR_SPACE_C_HEADER_FILE
6 
14  #ifdef ARM // ARM use dirrent location
15  reg_wb_enable = reg_wb_enable | 0x8; // for enable writing to reg_debug_1 and reg_debug_2
16  #else
17  reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
18  #endif
19 }
20 
21 
41 void USER_writeWord(unsigned int data,int offset){
42  *(((unsigned int *) USER_SPACE_ADDR)+offset) = data;
43 
44 }
63 unsigned int USER_readWord(int offset){
64  return *(((unsigned int *) USER_SPACE_ADDR)+offset);
65 }
87 void USER_writeHalfWord(unsigned short data,unsigned int offset,bool is_first_word){
88  unsigned int half_word_offset = offset *2 + is_first_word;
89  *(((unsigned int *) USER_SPACE_ADDR)+half_word_offset) = data;
90 
91 }
112 unsigned short USER_readHalfWord(unsigned int offset,bool is_first_word){
113  unsigned int half_word_offset = offset *2 + is_first_word;
114  return *(((unsigned int *) USER_SPACE_ADDR)+half_word_offset);
115 }
137 void USER_writeByte(unsigned char data,unsigned int offset,unsigned char byte_num){
138  if (byte_num > 3)
139  byte_num =0;
140  unsigned int byte_offset = offset *4 + byte_num;
141  *(((unsigned int *) USER_SPACE_ADDR)+byte_offset) = data;
142 }
163 unsigned char USER_readByte( unsigned int offset,unsigned char byte_num){
164  if (byte_num > 3)
165  byte_num =0;
166  unsigned int byte_offset = offset *4 + byte_num;
167  return *(((unsigned int *) USER_SPACE_ADDR)+byte_offset);
168 }
169 
170 #endif // USER_ADDR_SPACE_C_HEADER_FILE
void USER_writeHalfWord(unsigned short data, unsigned int offset, bool is_first_word)
Definition: user_space.h:87
void USER_writeByte(unsigned char data, unsigned int offset, unsigned char byte_num)
Definition: user_space.h:137
unsigned char USER_readByte(unsigned int offset, unsigned char byte_num)
Definition: user_space.h:163
unsigned int USER_readWord(int offset)
Definition: user_space.h:63
void USER_writeWord(unsigned int data, int offset)
Definition: user_space.h:41
unsigned short USER_readHalfWord(unsigned int offset, bool is_first_word)
Definition: user_space.h:112
void User_enableIF()
Definition: user_space.h:13