I'm writing bare metal code(no os) on omap4460 (cortex a9), and i do not succeed to set up correctly gptimer1.
This is my code ( by following the 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;
When i run the code, i never go to my interrupt vector table, my interrupt vector table is correctly set, since "svc 0" works.
I don't even see the timer counter running.
Please any idea, on what i'm missing? Rony.