Mercurial > hg > beaglert
diff core/PRU.cpp @ 280:c55c6f6c233c prerelease
Added support for multiplexer capelet and command-line support for choosing PRU
author | andrewm |
---|---|
date | Tue, 17 May 2016 17:49:23 +0100 |
parents | 8d80eda512cd |
children | e4392164b458 |
line wrap: on
line diff
--- a/core/PRU.cpp Tue May 17 16:07:45 2016 +0100 +++ b/core/PRU.cpp Tue May 17 17:49:23 2016 +0100 @@ -48,6 +48,8 @@ #define PRU_MEM_DIGITAL_OFFSET 0x1000 //Offset within PRU-SHARED RAM #define MEM_DIGITAL_BUFFER1_OFFSET 0x400 //Start pointer to DIGITAL_BUFFER1, which is 256 words. // 256 is the maximum number of frames allowed + +// Offsets within CPU <-> PRU communication memory (4 byte slots) #define PRU_SHOULD_STOP 0 #define PRU_CURRENT_BUFFER 1 #define PRU_BUFFER_FRAMES 2 @@ -61,8 +63,9 @@ #define PRU_SPI_NUM_CHANNELS 10 #define PRU_USE_DIGITAL 11 #define PRU_PRU_NUMBER 12 +#define PRU_MUX_CONFIG 13 -short int digitalPins[NUM_DIGITALS]={ +short int digitalPins[NUM_DIGITALS] = { GPIO_NO_BIT_0, GPIO_NO_BIT_1, GPIO_NO_BIT_2, @@ -277,7 +280,7 @@ } // Initialise and open the PRU -int PRU::initialise(int pru_num, int frames_per_buffer, int spi_channels, bool xenomai_test_pin) +int PRU::initialise(int pru_num, int frames_per_buffer, int spi_channels, int mux_channels, bool xenomai_test_pin) { uint32_t *pruMem = 0; @@ -337,6 +340,16 @@ pru_buffer_comm[PRU_SYNC_ADDRESS] = 0; pru_buffer_comm[PRU_SYNC_PIN_MASK] = 0; pru_buffer_comm[PRU_PRU_NUMBER] = pru_number; + + if(mux_channels == 2) + pru_buffer_comm[PRU_MUX_CONFIG] = 1; + else if(mux_channels == 4) + pru_buffer_comm[PRU_MUX_CONFIG] = 2; + else if(mux_channels == 8) + pru_buffer_comm[PRU_MUX_CONFIG] = 3; + else + pru_buffer_comm[PRU_MUX_CONFIG] = 0; + if(led_enabled) { pru_buffer_comm[PRU_LED_ADDRESS] = USERLED3_GPIO_BASE; pru_buffer_comm[PRU_LED_PIN_MASK] = USERLED3_PIN_MASK;