software_APIs  1.0.0
Functions
user_space.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void User_enableIF ()
 
void USER_writeWord (unsigned int data, int offset)
 
unsigned int USER_readWord (int offset)
 
void USER_writeHalfWord (unsigned short data, unsigned int offset, bool is_first_word)
 
unsigned short USER_readHalfWord (unsigned int offset, bool is_first_word)
 
void USER_writeByte (unsigned char data, unsigned int offset, unsigned char byte_num)
 
unsigned char USER_readByte (unsigned int offset, unsigned char byte_num)
 

Function Documentation

◆ User_enableIF()

void User_enableIF ( )

Enable communication between firmware and user project through wishbone

Warning
This necessary when reading or writing are needed between wishbone and user project if interface isn't enabled no ack would be receive and the writing or reading command will be stuck

◆ USER_readByte()

unsigned char USER_readByte ( unsigned int  offset,
unsigned char  byte_num 
)

Read byte at user address space 32 bit register

Parameters
offsetthe offset of the register to write. Origin at the user project address
byte_numnumber of the in the 4 bytes register (32 bits)
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
byte_num-0 123
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415

◆ USER_readHalfWord()

unsigned short USER_readHalfWord ( unsigned int  offset,
bool  is_first_word 
)

Read half word (2 bytes) at user address space 32 bit register

Parameters
offsetthe offset of the register to write. Origin at the user project address
is_first_wordthe offset of the register to write. Origin at the user project address
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
is first word-11 00
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415

◆ USER_readWord()

unsigned int USER_readWord ( int  offset)

Read word (4 bytes) at user address space 32 bit register

Parameters
offsetthe offset of the register to write. Origin at the user project address
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (4 bytes offset)
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415

◆ USER_writeByte()

void USER_writeByte ( unsigned char  data,
unsigned int  offset,
unsigned char  byte_num 
)

Write byte at user address space 32 bit register

Parameters
databyte data to write
offsetthe offset of the register to write. Origin at the user project address
byte_numnumber of the in the 4 bytes register (32 bits)
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
byte_num-0 123
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415

◆ USER_writeHalfWord()

void USER_writeHalfWord ( unsigned short  data,
unsigned int  offset,
bool  is_first_word 
)

Write half word (2 bytes) at user address space 32 bit register

Parameters
datahalf world data to write
offsetthe offset of the register to write. Origin at the user project address
is_first_wordthe offset of the register to write. Origin at the user project address
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (2byte offset)
is first word-11 00
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415

◆ USER_writeWord()

void USER_writeWord ( unsigned int  data,
int  offset 
)

Write word (4 bytes) at user address space 32 bit register

Parameters
dataworld data to write
offsetthe offset of the register to write. Origin at the user project address
Note
Since offset is a word (4 bytes) and address space represent bytes, offset = address /4
For example if project caravel space are 26 address bit offset = wb_addr_i[25:0]/4
world memory (4 bytes offset)
addressoffset byte0byte1byte2byte3
0x000123
0x414567
0x82891011
0xC312131415