Sorry in above post i was unable to attach.So written below:
void init_IRQs (void) {
FSL_NVIC->ICPR[1] = 1 << (50% 32); /* IRQ48-LPIT0 ch0: clr any pending IRQ*/
FSL_NVIC->ISER[1] = 1 << (50 % 32); /* IRQ48-LPIT0 ch0: enable IRQ */
FSL_NVIC->IP[50] = 0xA; /* IRQ48-LPIT0 ch0: priority 10 of 0-15*/
}
void init_LPIT0 (void) {
PCC->PCCn[PCC_LPIT0_INDEX] = PCC_PCCn_PCS(6); /* Clock Src = 6 (SPLL2_DIV2_CLK)*/
PCC->PCCn[PCC_LPIT0_INDEX] |= PCC_PCCn_CGC_MASK; /* Enable clk to LPIT0 regs */
LPIT0->MCR = 0x00000001; /* DBG_EN-0: Timer chans stop in Debug mode */
/* DOZE_EN=0: Timer chans are stopped in DOZE mode */
/* SW_RST=0: SW reset does not reset timer chans, regs */
/* M_CEN=1: enable module clk (allows writing other LPIT0 regs) */
LPIT0->MIER = 0x00000004; /* nit TIE2=1: Timer Interrupt Enabled fot Chan 0 */
/* Channel 2*/
LPIT0->TVAL2 = 80000000; /* Chan_2 Timeout period: 80M clocks */
LPIT0->TCTRL2 = 0x00000001; /* T_EN=1: Timer channel is enabled */
}
int main(void) {
init_SOSC_8MHz(); /* Initialize system oscilator for 8 MHz xtal */
init_SPLL_80MHz(); /* Initialize SPLL to 80 MHz with 8 MHz SOSC */
NormalRUNmode_80MHz(); /* Init clocks: 80 MHz SPLL & core, 40 MHz bus, 20 MHz flash */
init_IRQs(); /* Enable desired interrupts and priorities */
init_LPIT2(); /* Initialize PIT0 for 1 second timeout */
for (;;) {
}
}
void LPIT0_Ch2_IRQHandler (void) {
LPIT0->MSR |= LPIT_MSR_TIF2_MASK; /* Clear LPIT0 timer flag 0 */
}