/** Program to load a PRU program that flashes an LED until a button is * pressed. By Derek Molloy, for the book Exploring BeagleBone * based on the example code at: * http://processors.wiki.ti.com/index.php/PRU_Linux_Application_Loader_API_Guide */ #include #include #include #include #define PRU_NUM 0 // using PRU0 for these examples int main (void) { if(getuid()!=0){ printf("You must run this program as root. Exiting.\n"); exit(EXIT_FAILURE); } // Initialize structure used by prussdrv_pruintc_intc // PRUSS_INTC_INITDATA is found in pruss_intc_mapping.h tpruss_intc_initdata pruss_intc_initdata = PRUSS_INTC_INITDATA; // Allocate and initialize memory prussdrv_init (); prussdrv_open (PRU_EVTOUT_0); // Map PRU's interrupts prussdrv_pruintc_init(&pruss_intc_initdata); // Load and execute the PRU program on the PRU prussdrv_exec_program (PRU_NUM, "./FixedPRUClock.bin"); printf("EBB fixed-frequency clock PRU program now running\n"); prussdrv_exit (); return EXIT_SUCCESS; }