BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
21e3f0f
Branches
Tags
master
mips_sys
fw
cyc_cnt.c
converted code to use constants in data memory
Stefan Schuermans
commited
21e3f0f
at 2012-02-12 18:24:53
cyc_cnt.c
Blame
History
Raw
#include "cyc_cnt.h" static volatile unsigned int *const cyc_cnt_ptr = (volatile unsigned int *)0x80001000; /** * @brief read cycle counter * @return cycle counter value */ unsigned int cyc_cnt_read(void) { return *cyc_cnt_ptr; } /** * @brief delay for a number of cycles * @param[in] cyc number of cycles */ void cyc_cnt_delay(unsigned int cyc) { unsigned int start = cyc_cnt_read(); while (cyc_cnt_read() - start < cyc) /* wait */; } /** * @brief delay for a number of microseconds * @param[in] us number of microseconds */ void cyc_cnt_delay_us(unsigned int us) { cyc_cnt_delay(us * 50); } /** * @brief delay for a number of milliseconds * @param[in] ms number of milliseconds */ void cyc_cnt_delay_ms(unsigned int ms) { cyc_cnt_delay_us(ms * 1000); }