SGPIO: Change bus direction more deliberately.

There may have been an instant where the CPLD and SGPIO were driving the bus simultaneously, when switching from TX to RX.
This commit is contained in:
Jared Boone 2016-08-13 16:42:39 -07:00
parent 2ec1bab5d5
commit 62d2ae2336

View File

@ -299,7 +299,9 @@ void SGPIO::configure(const Direction direction) {
disable_all_slice_counters();
LPC_SGPIO->GPIO_OUTREG = gpio_outreg(direction);
LPC_SGPIO->GPIO_OENREG = gpio_oenreg(direction);
// Set data pins as input, temporarily.
LPC_SGPIO->GPIO_OENREG = gpio_oenreg(Direction::Receive);
LPC_SGPIO->OUT_MUX_CFG[ 8] = out_mux_cfg(P_OUT_CFG::DOUT_DOUTM1, P_OE_CFG::GPIO_OE);
LPC_SGPIO->OUT_MUX_CFG[ 9] = out_mux_cfg(P_OUT_CFG::DOUT_DOUTM1, P_OE_CFG::GPIO_OE);
LPC_SGPIO->OUT_MUX_CFG[10] = out_mux_cfg(P_OUT_CFG::GPIO_OUT, P_OE_CFG::GPIO_OE);
@ -314,6 +316,9 @@ void SGPIO::configure(const Direction direction) {
LPC_SGPIO->OUT_MUX_CFG[i] = data_out_mux_cfg;
}
// Now that output enable sources are set, enable data bus in correct direction.
LPC_SGPIO->GPIO_OENREG = gpio_oenreg(direction);
const auto slice_gpdma = Slice::H;
const size_t slice_count = slice_mode_multislice ? 8 : 1;