int main (void) { unsigned int ret; tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA; printf("\nINFO: Starting %s example.\r\n", "PRU_memAccessPRUDataRam"); /* Initialize the PRU */ prussdrv_init (); /* Open PRU Interrupt */ ret = prussdrv_open(PRU_EVTOUT_0); if (ret) { printf("prussdrv_open open failed\n"); return (ret); } /* Get the interrupt initialized */ prussdrv_pruintc_init(&pruss_intc_initdata); /* Initialize example */ printf("\tINFO: Initializing example.\r\n"); LOCAL_exampleInit(PRU_NUM); /* Execute example on PRU */ printf("\tINFO: Executing example.\r\n"); char path[] = "./PRU_memAccessPRUDataRam.bin"; if(prussdrv_exec_program (PRU_NUM, path)) { fprintf(stderr, "ERROR: Could not open %s\n", path); return 1; } /* Wait until PRU0 has finished execution */ printf("\tINFO: Waiting for HALT command.\r\n"); prussdrv_pru_wait_event (PRU_EVTOUT_0); printf("\tINFO: PRU completed transfer.\r\n"); prussdrv_pru_clear_event (PRU_EVTOUT_0, PRU0_ARM_INTERRUPT); /* Check if example passed */ if ( LOCAL_examplePassed(PRU_NUM) ) { printf("INFO: Example executed succesfully.\r\n"); } else { printf("INFO: Example failed.\r\n"); } /* Disable PRU and close memory mapping*/ prussdrv_pru_disable (PRU_NUM); prussdrv_exit (); return(0); }
int main (void) { unsigned int ret; tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA; printf("\nINFO: Starting %s test.\r\n", "GPIO input level"); /* Initialize the PRU */ prussdrv_init (); /* Open PRU Interrupt */ ret = prussdrv_open(PRU_EVTOUT_0); if (ret) { printf("prussdrv_open open failed\n"); return (ret); } /* Get the interrupt initialized */ prussdrv_pruintc_init(&pruss_intc_initdata); /* Initialize example */ printf("\tINFO: Initializing test.\r\n"); LOCAL_exampleInit(PRU_NUM); /* Execute example on PRU */ printf("\tINFO: Executing test.\r\n"); prussdrv_exec_program (PRU_NUM, "./levelIn.bin"); /* Wait until PRU0 has finished execution */ printf("\tINFO: Waiting for HALT command.\r\n"); prussdrv_pru_wait_event (PRU_EVTOUT_0); printf("\tINFO: PRU completed transfer.\r\n"); prussdrv_pru_clear_event (PRU0_ARM_INTERRUPT); /* Check if example passed */ if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Test executed succesfully.\r\n"); } else { printf("Test failed.\r\n"); } /* Disable PRU and close memory mapping*/ prussdrv_pru_disable(PRU_NUM); prussdrv_exit (); munmap(ddrMem, 0x0FFFFFFF); close(mem_fd); return(0); }
void main() { CSL_TmrRegsOvly timer0Regs = (CSL_TmrRegsOvly)CSL_TMR_0_REGS; printf("Starting %s example.\r\n",exampleName); // Make sure PRU is first disabled/reset PRU_disable(); printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(Uint32))); printf("\tINFO: Initializing example.\r\n"); // Configure Timer0 LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Give PRU some time UTIL_waitLoop(0x100); // Enable Timer0 in one-shot mode timer0Regs->TCR = 0x00000040; // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } // Check to see if the example produced desired result if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example executed succesfully.\r\n"); } else { printf("Example failed.\r\n"); } }
void main() { printf("Starting %s example.\r\n",exampleName); // Make sure PRU is first disabled/reset PRU_disable(); // Enable and load the code to the specified pru printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(Uint32))); printf("\tINFO: Initializing example.\r\n"); LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Wait for EDMA CC0 interrupt. while ( !edmaIntReceived ); printf("\tINFO: EDMA interrupt received.\r\n"); // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } // Check if the example executed successfully if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example completed successfully."); } else { printf("Example failed."); } // Disable the PRUSS when done PRU_disable(); }
Int32 main (void) { printf("Starting PRU %s example.\r\n",exampleName); // Make sure PRU sub system is first disabled/reset PRU_disable(); // Enable and load the code to the specified pru printf("\tINFO: Loading example.\r\n"); PRU_load(PRU_NUM, (Uint32*)PRU_Code, (sizeof(PRU_Code)/sizeof(int))); printf("\tINFO: Initializing example.\r\n"); LOCAL_exampleInit(PRU_NUM); printf("\tINFO: Executing example.\r\n"); PRU_run(PRU_NUM); // Wait for the PRU to call the HALT command if (PRU_waitForHalt(PRU_NUM,-1) == E_PASS) { printf("\tINFO: PRU halted successfully.\r\n"); } else { printf("\tINFO: PRU halt failed.\r\n"); } if ( LOCAL_examplePassed(PRU_NUM) ) { printf("Example completed successfully."); } else { printf("Example failed."); } // Disable the PRUSS when done PRU_disable(); return 0; }