summaryrefslogtreecommitdiff
path: root/openpicc/application/tc_cdiv.c
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-02-02 06:16:31 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2008-02-02 06:16:31 +0000
commitfa61e60d06e7a50fd3d681822a5f637f14582d80 (patch)
treeaa67e824b8edeb1c0521933542956863b2752cd2 /openpicc/application/tc_cdiv.c
parentc68c113ee8e1357c718bc492078d41b52dae4767 (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.c8
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 */
personal git repositories of Harald Welte. Your mileage may vary