Mainline:Broadcom Kona/Timers: Difference between revisions
fix timer_match desc - downstream code and decompiled loader both clear all 4 bits of timer_match before writing 1 to disarm the one interrupt they want to disarm |
reorder STCS table |
||
(3 intermediate revisions by the same user not shown) | |||
Line 53: | Line 53: | ||
== Starting the counter == | == Starting the counter == | ||
To set the value and start counting: | |||
* Set the value of <code>KONA_GPTIMER_STCM{n}</code> to the 32-bit value to match for (<code>{n}</code> is the number of the channel) | |||
* Wait for the value to sync by watching the <code>STCM{n}_SYNC</code> value in <code>KONA_GPTIMER_STCS</code> | |||
* In STCS, all in one write: | |||
** Clear the timer match field (bits 3..0) | |||
** Write the timer match bit for the selected channel (bits 3..0) | |||
** Write the compare enable bit for the selected channel (bits 7..4) | |||
== Local tick timer == | == Local tick timer == | ||
Line 69: | Line 78: | ||
!Description | !Description | ||
|- | |- | ||
| | | Reserved | ||
| | | 31:16 | ||
| | | Reserved | ||
|- | |- | ||
| <code> | | <code>STCM{0,3}_SYNC</code> | ||
| | | 15:12 | ||
| | | Sync bit for STCM{0,3} value being set (bit 12 is STCM0, bit 13 is STCM1, bit 14 is STCM2, bit 15 is STCM3). | ||
|- | |- | ||
| <code>STCS_COMPARE_ENABLE_SYNC</code> | | <code>STCS_COMPARE_ENABLE_SYNC</code> | ||
Line 81: | Line 90: | ||
| Sync bit for COMPARE_ENABLE. Same layout as the above. | | Sync bit for COMPARE_ENABLE. Same layout as the above. | ||
|- | |- | ||
| <code> | | <code>STCS_COMPARE_ENABLE</code> | ||
| | | 7:4 | ||
| | | Enable compare (match) on the specified channel(s). When this bit is set for a channel, the value of the STCM{0,3} register will be used for a match.<br><br>- <code>0b0001</code> - enable compare for channel 0<br>- <code>0b0010</code> - enable compare for channel 1<br>- <code>0b0100</code> - enable compare for channel 2<br>- <code>0b1000</code> - enable compare for channel 3 | ||
|- | |- | ||
| | | <code>STCS_TIMER_MATCH</code> | ||
| | | 3:0 | ||
| | | Represents the state of the timer interrupt for each channel; <code>0</code> means the interrupt is enabled, <code>1</code> means the interrupt is cleared.<br><br>To clean the interrupt, clean the entire field and set the bit corresponding to the channel to clear the interrupt for to <code>1</code>. {{Speculation|Leaving the other bits set to 0 while setting will keep the interrupt state intact (TODO - if not, then this means only one interrupt can be serviced at a time?)}} | ||
|} | |} | ||
Line 129: | Line 138: | ||
| <code>STCM{0,3}</code> | | <code>STCM{0,3}</code> | ||
| 31:0 | | 31:0 | ||
| 32-bit time value for timer match. When the counter | | 32-bit time value for timer match. When the lower bits of the counter match this value, the interrupt for the channel is raised and the bit corresponding to the triggered timer number is set in STCS_TIMER_MATCH. | ||
|} | |} | ||