Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdint.h>
- #include <stddef.h>
- #include "pru_uart.h"
- #include "pru_ecap.h"
- #include "sys_gpio.h"
- // define some r30 bits
- #define CW (1 << 3)
- #define CCW (1 << 7)
- #define delay_us(n) __delay_cycles((n) * 200u)
- #define delay_ms(n) delay_us((n) * 1000u)
- struct Message {
- uint32_t test_message;
- };
- // layout of shared ddr3 memory (filled in by loader)
- struct DDRLayout {
- Message volatile *msgbuf;
- uint16_t num_msgs;
- uint16_t msg_size;
- };
- struct UserControlVars {
- uint16_t pru0_counter;
- uint16_t pru1_counter;
- uint32_t shared_counter;
- };
- far struct DDRLayout ddr __attribute__((location(0x10000))) = {};
- far struct UserControlVars volatile shmem __attribute__((location(0x10100))) = {};
- void main() {
- while(1){
- shmem.pru1_counter++;
- delay_ms(633);
- shmem.shared_counter++;
- }
- }
Add Comment
Please, Sign In to add comment