diff options
author | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-02-02 06:16:31 +0000 |
---|---|---|
committer | henryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1> | 2008-02-02 06:16:31 +0000 |
commit | fa61e60d06e7a50fd3d681822a5f637f14582d80 (patch) | |
tree | aa67e824b8edeb1c0521933542956863b2752cd2 /openpicc/application/tc_cdiv.c | |
parent | c68c113ee8e1357c718bc492078d41b52dae4767 (diff) |
Commit status quo. Partly or severely broken.
git-svn-id: https://svn.openpcd.org:2342/trunk@402 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/application/tc_cdiv.c')
-rw-r--r-- | openpicc/application/tc_cdiv.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/openpicc/application/tc_cdiv.c b/openpicc/application/tc_cdiv.c index 226abbe..fb7db91 100644 --- a/openpicc/application/tc_cdiv.c +++ b/openpicc/application/tc_cdiv.c @@ -34,6 +34,14 @@ AT91PS_TCB tcb = AT91C_BASE_TCB; /* set carrier divider to a specific */ void __ramfunc tc_cdiv_set_divider(u_int16_t div) { + if(tcb->TCB_TC0.TC_CV > div +#ifdef OPENPICC_USE_CLOCK_GATING + /* Don't spin if FRAME_BURST is clear, the clock is stopped in this case */ + && !(!AT91F_PIO_IsInputSet(AT91C_BASE_PIOA, OPENPICC_PIO_FRAME_BURST)) +#endif + ) { + while(tcb->TCB_TC0.TC_CV > 3); /* Three carrier cycles are about 10 clock cycles, should be enough for the loop */ + } tcb->TCB_TC0.TC_RC = div; /* set to 50% duty cycle */ |