BlinkenArea - GitList
Repositories
Blog
Wiki
mips_sys
Code
Commits
Branches
Tags
Search
Tree:
df6d296
Branches
Tags
master
mips_sys
fw
cyc_cnt.c
implemented LCD peripheral
Stefan Schuermans
commited
df6d296
at 2012-02-12 15:31:45
cyc_cnt.c
Blame
History
Raw
#include "cyc_cnt.h" /** * @brief read cycle counter * @return cycle counter value */ unsigned int cyc_cnt_read(void) { volatile unsigned int *p_cyc_cnt = (volatile unsigned int *)0x80001000; return *p_cyc_cnt; } /** * @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); }