Change SGPIO CPLD decimation API interface to be one-based (decimation of 1 to 8).
This commit is contained in:
@ -48,7 +48,7 @@ void sgpio_configure_pin_functions() {
|
|||||||
scu_pinmux(SCU_PINMUX_SGPIO14, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); /* GPIO5[13] */
|
scu_pinmux(SCU_PINMUX_SGPIO14, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); /* GPIO5[13] */
|
||||||
scu_pinmux(SCU_PINMUX_SGPIO15, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); /* GPIO5[14] */
|
scu_pinmux(SCU_PINMUX_SGPIO15, SCU_GPIO_FAST | SCU_CONF_FUNCTION4); /* GPIO5[14] */
|
||||||
|
|
||||||
sgpio_cpld_stream_rx_set_decimation(0);
|
sgpio_cpld_stream_rx_set_decimation(1);
|
||||||
|
|
||||||
GPIO_DIR(GPIO5) |= GPIOPIN14 | GPIOPIN13 | GPIOPIN12;
|
GPIO_DIR(GPIO5) |= GPIOPIN14 | GPIOPIN13 | GPIOPIN12;
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ bool sgpio_cpld_stream_is_enabled() {
|
|||||||
return (SGPIO_GPIO_OUTREG & (1L << 10)) == 0; /* SGPIO10 */
|
return (SGPIO_GPIO_OUTREG & (1L << 10)) == 0; /* SGPIO10 */
|
||||||
}
|
}
|
||||||
|
|
||||||
bool sgpio_cpld_stream_rx_set_decimation(const uint_fast8_t skip_n) {
|
bool sgpio_cpld_stream_rx_set_decimation(const uint_fast8_t n) {
|
||||||
/* CPLD interface is three bits, SGPIO[15:13]:
|
/* CPLD interface is three bits, SGPIO[15:13]:
|
||||||
* 111: decimate by 1 (skip_n=0, skip no samples)
|
* 111: decimate by 1 (skip_n=0, skip no samples)
|
||||||
* 110: decimate by 2 (skip_n=1, skip every other sample)
|
* 110: decimate by 2 (skip_n=1, skip every other sample)
|
||||||
@ -294,6 +294,7 @@ bool sgpio_cpld_stream_rx_set_decimation(const uint_fast8_t skip_n) {
|
|||||||
* ...
|
* ...
|
||||||
* 000: decimate by 8 (skip_n=7, skip seven of eight samples)
|
* 000: decimate by 8 (skip_n=7, skip seven of eight samples)
|
||||||
*/
|
*/
|
||||||
|
const uint_fast8_t skip_n = n - 1;
|
||||||
GPIO_SET(GPIO5) = GPIOPIN14 | GPIOPIN13 | GPIOPIN12;
|
GPIO_SET(GPIO5) = GPIOPIN14 | GPIOPIN13 | GPIOPIN12;
|
||||||
GPIO_CLR(GPIO5) = (skip_n & 7) << 12;
|
GPIO_CLR(GPIO5) = (skip_n & 7) << 12;
|
||||||
|
|
||||||
|
@ -41,6 +41,6 @@ void sgpio_cpld_stream_enable();
|
|||||||
void sgpio_cpld_stream_disable();
|
void sgpio_cpld_stream_disable();
|
||||||
bool sgpio_cpld_stream_is_enabled();
|
bool sgpio_cpld_stream_is_enabled();
|
||||||
|
|
||||||
bool sgpio_cpld_stream_rx_set_decimation(const uint_fast8_t skip_n);
|
bool sgpio_cpld_stream_rx_set_decimation(const uint_fast8_t n);
|
||||||
|
|
||||||
#endif//__SGPIO_H__
|
#endif//__SGPIO_H__
|
||||||
|
Reference in New Issue
Block a user