我在omap4460(cortex a9)上編寫裸機代碼(no os),並且我沒有成功正確設置gptimer1。在omap4460上設置gptimer1
這是我的代碼(由下面的OMAP4460 TRM)
/* for forwarding pending interrupts from distributor to Cpu interfaces */
*(volatile unsigned int *)(GICD_BASE + GICD_CTLR) |= 0x00000001;
/* signaling interrupt by the cpu interface to the connected processor*/
*(volatile unsigned int *)(GICC_BASE + GICC_CTLR) |= 0x00000001;
/* position the timer1 handler */
irq_table_function[GPT1_IRQ] = timer1handler;
/* clocks timer1 block */
*(volatile unsigned int *)CM_WKUP_CLKSTCTRL |= 0x00000003;
*(volatile unsigned int *)CM_WKUP_GPTIMER1_CLKCTRL |= 0x01000000;
*(volatile unsigned int *)CM_WKUP_GPTIMER1_CLKCTRL |= 0x00000002;
/* enable GPTimer1 functional and interface blocks */
*(volatile unsigned int *)GPT1MS_TIOCP_CFG |= 0x00000300;
/* capture interrupt enable */
*(volatile unsigned int *)GPT_TIER |= 0x00000004;
/* enable autoreload */
*(volatile unsigned int *)GPT_TCLR |= 0x00000002;
/* prescaler equal to zero */
*(volatile unsigned int *)GPT_TCLR &= ~0x0000003C;
/* positive increment value */
*(volatile unsigned int *)GPT_TPIR = 232000;
/* negative increment value */
*(volatile int *)GPT_TNIR = -768000;
/* load value */
*(volatile unsigned int *)GPT_TLDR = 0xFFFFFFE0;
/* enable timer1 */
*(volatile unsigned int *)GPT_TIER |= 0x00000001;
當我運行的代碼,我從來沒有去我的中斷向量表,我的中斷向量表的設置是否正確,因爲「SVC 0」作品。
我什至不看到計時器計數器運行。
請問我有什麼想法嗎? Rony。
@Pipenbrinck我已經相應修改我的代碼,請參閱我的回答 – bonpiedlaroute