Advertisement
Guest User

Untitled

a guest
Aug 17th, 2022
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdint.h>
  2. #include "pru_ctrl.h"
  3.  
  4. // define this to PRU0_CTRL or PRU1_CTRL depending on which core is running this code
  5. #define PRU_CTRL PRU0_CTRL
  6.  
  7. int main() {
  8.     // disable and reset cycle counter
  9.     PRU_CTRL.CTR_EN = 0;
  10.     PRU_CTRL.CYCLE = 0;
  11.  
  12.     // enable cycle counter
  13.     PRU_CTRL.CTR_EN = 1;
  14.  
  15.     // ... do stuff here ...
  16.  
  17.     // read cycle counter
  18.     uint32_t count = PRU_CTRL.CYCLE;
  19.  
  20.     __halt();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement