OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /neorv32/trunk/sw/lib
    from Rev 3 to Rev 4
    Reverse comparison

Rev 3 → Rev 4

/include/neorv32.h
309,17 → 309,17
* @name IO Device: Machine System Timer (MTIME)
**************************************************************************/
/**@{*/
/** MTIME (time register) low word (r/w) */
#define MTIME_LO (*(IO_REG32 0xFFFFFF90))
/** MTIME (time register) high word (r/w) */
#define MTIME_HI (*(IO_REG32 0xFFFFFF94))
/** MTIME (time register) low word (r/-) */
#define MTIME_LO (*(IO_ROM32 0xFFFFFF90))
/** MTIME (time register) high word (r/-) */
#define MTIME_HI (*(IO_ROM32 0xFFFFFF94))
/** MTIMECMP (time compare register) low word (r/w) */
#define MTIMECMP_LO (*(IO_REG32 0xFFFFFF98))
/** MTIMECMP (time register) high word (r/w) */
#define MTIMECMP_HI (*(IO_REG32 0xFFFFFF9C))
 
/** MTIME (time register) 64-bit access (r/w) */
#define MTIME (*(IO_REG64 (&MTIME_LO)))
/** MTIME (time register) 64-bit access (r/-) */
#define MTIME (*(IO_ROM64 (&MTIME_LO)))
/** MTIMECMP (time compare register) low word (r/w) */
#define MTIMECMP (*(IO_REG64 (&MTIMECMP_LO)))
/**@}*/
/include/neorv32_mtime.h
46,7 → 46,6
 
// prototypes
int neorv32_mtime_available(void);
void neorv32_mtime_set_time(uint64_t time);
uint64_t neorv32_mtime_get_time(void);
void neorv32_mtime_set_timecmp(uint64_t timecmp);
uint64_t neorv32_mtime_get_timecmp(void);
/source/neorv32_mtime.c
62,19 → 62,6
 
 
/**********************************************************************//**
* Set new system time.
*
* @note The MTIME timer increments with the primary processor clock.
*
* @param[in] time New system time (uint64_t)
**************************************************************************/
void neorv32_mtime_set_time(uint64_t time) {
 
MTIME = time;
}
 
 
/**********************************************************************//**
* Get current system time since reset.
*
* @note The MTIME timer increments with the primary processor clock.
83,23 → 70,7
**************************************************************************/
uint64_t neorv32_mtime_get_time(void) {
 
union {
uint64_t uint64;
uint32_t uint32[sizeof(uint64_t)/2];
} sys_mtime;
uint32_t tmp;
 
// make sure there is no overflow in mtime_lo during read
while (1) {
sys_mtime.uint32[1] = MTIME_HI;
sys_mtime.uint32[0] = MTIME_LO;
tmp = MTIME_HI;
if (sys_mtime.uint32[1] == tmp) {
break;
}
}
 
return sys_mtime.uint64;
return MTIME;
}
 
 
115,7 → 86,7
**************************************************************************/
void neorv32_mtime_set_timecmp(uint64_t timecmp) {
 
MTIMECMP_LO = 0xFFFFFFFF; // prevent mtimecmp from temporarily becoming smaller than the lesser of the old and new values
MTIMECMP_LO = -1; // prevent mtimecmp from temporarily becoming smaller than the lesser of the old and new values
MTIMECMP = timecmp;
}
 
/source/neorv32_uart.c
130,7 → 130,7
* Send single char via UART.
*
* @note This function is blocking.
* @warning The 'SIMCOM_UART_OVERRIDE' compiler user flag will forward all UART TX data to the SIMCOM simulation console output.
* @warning The 'DEVNULL_UART_OVERRIDE' compiler user flag will forward all UART TX data to the DEVNULL simulation console output.
*
* @param[in] c Char to be send.
**************************************************************************/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.