/** * * This function starts the event counters in L2 Cache controller. * * @param None. * * @return None. * * @note None. * *****************************************************************************/ void XL2cc_EventCtrStart(void) { XL2cc_EventCtrReset(); /* Enable counter */ *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET)) = 1; }
/** * * This function starts the event counters in L2 Cache controller. * * @param None. * * @return None. * * @note None. * *****************************************************************************/ void XL2cc_EventCtrStart(void) { u32 *LocalPtr; LocalPtr = (u32 *)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET); XL2cc_EventCtrReset(); /* Enable counter */ /* *((volatile u32*)((void *)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET))) = 1 */ *LocalPtr = (u32)1; }
/** * * This function disables the event counters in L2 Cache controller, saves the * counter values and resets the counters. * * @param EveCtr0 is an output parameter which is used to return the value * in event counter 0. * EveCtr1 is an output parameter which is used to return the value * in event counter 1. * * @return None. * * @note None. * *****************************************************************************/ void XL2cc_EventCtrStop(u32 *EveCtr0, u32 *EveCtr1) { /* Disable counter */ *((volatile u32*) (XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNTRL_OFFSET)) = 0; /* Save counter values */ *EveCtr1 = *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT1_VAL_OFFSET)); *EveCtr0 = *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT0_VAL_OFFSET)); XL2cc_EventCtrReset(); }
/** * * This function initializes the event counters in L2 Cache controller with a * set of event codes specified by the user. * * @param Event0 is the event code for counter 0. * @param Event1 is the event code for counter 1. * Use the event codes defined by XL2CC_* in xl2cc_counter.h. * * @return None. * * @note None. * *****************************************************************************/ void XL2cc_EventCtrInit(int Event0, int Event1) { /* Write event code into cnt1 cfg reg */ *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT1_CTRL_OFFSET)) = (Event1 << 2); /* Write event code into cnt0 cfg reg */ *((volatile u32*)(XPS_L2CC_BASEADDR + XPS_L2CC_EVNT_CNT0_CTRL_OFFSET)) = (Event0 << 2); /* Reset counters */ XL2cc_EventCtrReset(); }