Mercurial > hg > beaglert
comparison core/PRU.cpp @ 253:33e0e4831763 prerelease
Started prerelease branch; updated PRU code to be able to run on either PRU.
author | andrewm |
---|---|
date | Mon, 16 May 2016 12:13:58 +0100 |
parents | c0bf6157f67e |
children | abd3657016ea |
comparison
equal
deleted
inserted
replaced
252:381f352c44eb | 253:33e0e4831763 |
---|---|
36 #include <rtdk.h> | 36 #include <rtdk.h> |
37 | 37 |
38 using namespace std; | 38 using namespace std; |
39 | 39 |
40 #define PRU_MEM_MCASP_OFFSET 0x2000 // Offset within PRU-SHARED RAM | 40 #define PRU_MEM_MCASP_OFFSET 0x2000 // Offset within PRU-SHARED RAM |
41 #define PRU_MEM_MCASP_LENGTH 0x2000 // Length of McASP memory, in bytes | 41 #define PRU_MEM_MCASP_LENGTH 0x1000 // Length of McASP memory, in bytes |
42 #define PRU_MEM_DAC_OFFSET 0x0 // Offset within PRU0 RAM | 42 #define PRU_MEM_DAC_OFFSET 0x0 // Offset within PRU0 RAM |
43 #define PRU_MEM_DAC_LENGTH 0x2000 // Length of ADC+DAC memory, in bytes | 43 #define PRU_MEM_DAC_LENGTH 0x2000 // Length of ADC+DAC memory, in bytes |
44 #define PRU_MEM_COMM_OFFSET 0x0 // Offset within PRU-SHARED RAM | 44 #define PRU_MEM_COMM_OFFSET 0x0 // Offset within PRU-SHARED RAM |
45 #define PRU_MEM_DIGITAL_OFFSET 0x1000 //Offset within PRU-SHARED RAM | 45 #define PRU_MEM_DIGITAL_OFFSET 0x1000 //Offset within PRU-SHARED RAM |
46 #define MEM_DIGITAL_BUFFER1_OFFSET 0x400 //Start pointer to DIGITAL_BUFFER1, which is 256 words. | 46 #define MEM_DIGITAL_BUFFER1_OFFSET 0x400 //Start pointer to DIGITAL_BUFFER1, which is 256 words. |
49 #define PRU_CURRENT_BUFFER 1 | 49 #define PRU_CURRENT_BUFFER 1 |
50 #define PRU_BUFFER_FRAMES 2 | 50 #define PRU_BUFFER_FRAMES 2 |
51 #define PRU_SHOULD_SYNC 3 | 51 #define PRU_SHOULD_SYNC 3 |
52 #define PRU_SYNC_ADDRESS 4 | 52 #define PRU_SYNC_ADDRESS 4 |
53 #define PRU_SYNC_PIN_MASK 5 | 53 #define PRU_SYNC_PIN_MASK 5 |
54 #define PRU_LED_ADDRESS 6 | 54 #define PRU_LED_ADDRESS 6 |
55 #define PRU_LED_PIN_MASK 7 | 55 #define PRU_LED_PIN_MASK 7 |
56 #define PRU_FRAME_COUNT 8 | 56 #define PRU_FRAME_COUNT 8 |
57 #define PRU_USE_SPI 9 | 57 #define PRU_USE_SPI 9 |
58 #define PRU_SPI_NUM_CHANNELS 10 | 58 #define PRU_SPI_NUM_CHANNELS 10 |
59 #define PRU_USE_DIGITAL 11 | 59 #define PRU_USE_DIGITAL 11 |
60 #define PRU_PRU_NUMBER 12 | |
60 | 61 |
61 short int digitalPins[NUM_DIGITALS]={ | 62 short int digitalPins[NUM_DIGITALS]={ |
62 GPIO_NO_BIT_0, | 63 GPIO_NO_BIT_0, |
63 GPIO_NO_BIT_1, | 64 GPIO_NO_BIT_1, |
64 GPIO_NO_BIT_2, | 65 GPIO_NO_BIT_2, |
330 pru_buffer_comm[PRU_CURRENT_BUFFER] = 0; | 331 pru_buffer_comm[PRU_CURRENT_BUFFER] = 0; |
331 pru_buffer_comm[PRU_BUFFER_FRAMES] = context->analogFrames; | 332 pru_buffer_comm[PRU_BUFFER_FRAMES] = context->analogFrames; |
332 pru_buffer_comm[PRU_SHOULD_SYNC] = 0; | 333 pru_buffer_comm[PRU_SHOULD_SYNC] = 0; |
333 pru_buffer_comm[PRU_SYNC_ADDRESS] = 0; | 334 pru_buffer_comm[PRU_SYNC_ADDRESS] = 0; |
334 pru_buffer_comm[PRU_SYNC_PIN_MASK] = 0; | 335 pru_buffer_comm[PRU_SYNC_PIN_MASK] = 0; |
336 pru_buffer_comm[PRU_PRU_NUMBER] = pru_number; | |
335 if(led_enabled) { | 337 if(led_enabled) { |
336 pru_buffer_comm[PRU_LED_ADDRESS] = USERLED3_GPIO_BASE; | 338 pru_buffer_comm[PRU_LED_ADDRESS] = USERLED3_GPIO_BASE; |
337 pru_buffer_comm[PRU_LED_PIN_MASK] = USERLED3_PIN_MASK; | 339 pru_buffer_comm[PRU_LED_PIN_MASK] = USERLED3_PIN_MASK; |
338 } | 340 } |
339 else { | 341 else { |