From a8a74a36bf63d887bb20a84404a7558a0a5ff92b Mon Sep 17 00:00:00 2001 From: Edward Longman <el7g15@soton.ac.uk> Date: Fri, 5 Jul 2019 11:18:52 +0100 Subject: [PATCH] Modify F5 to port it to FR5x --- source/lib/uart_drv/uart_drv.c | 82 ---------------------------------- 1 file changed, 82 deletions(-) diff --git a/source/lib/uart_drv/uart_drv.c b/source/lib/uart_drv/uart_drv.c index a9ad626..fceb4be 100644 --- a/source/lib/uart_drv/uart_drv.c +++ b/source/lib/uart_drv/uart_drv.c @@ -460,13 +460,9 @@ void hal_uart_init(void) rx_end_of_str = NO_END_OF_LINE_DETECTED; rx_str_length = 0; -<<<<<<< Updated upstream - UART_PORT_SEL |= UART_PIN_RXD + UART_PIN_TXD; -======= //Due to 3 peripherals per port there are more select bits. UART_PORT_SEL0 |= UART_PIN_RXD + UART_PIN_TXD; UART_PORT_SEL1 &= ~(UART_PIN_RXD + UART_PIN_TXD); ->>>>>>> Stashed changes UART_PORT_DIR |= UART_PIN_TXD; UART_PORT_DIR &= ~UART_PIN_RXD; @@ -493,12 +489,8 @@ void hal_uart_init(void) UCA1BR0 = 138; // 115200 bits per second UCA1BR1 = 0; -<<<<<<< Updated upstream - UCA1MCTL = UCBRS2 + UCBRS1 + UCBRS0; // Modulation UCBRSx = 7 -======= //Slight different modulation options in FR5994 UCA0MCTLW = UCBRS2 + UCBRS1 + UCBRS0; ->>>>>>> Stashed changes UCA1CTL1 &= ~UCSWRST; UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt @@ -519,86 +511,13 @@ void hal_uart_deinit(void) UCA1IE &= ~UCRXIE; UCA1IE &= ~UCTXIE; UCA1CTL1 = UCSWRST; //Reset State -<<<<<<< Updated upstream - UART_PORT_SEL &= ~( UART_PIN_RXD + UART_PIN_TXD ); -======= //Due to 3 peripherals per port there are more select bits. UART_PORT_SEL0 &= ~( UART_PIN_RXD + UART_PIN_TXD); UART_PORT_SEL1 &= ~( UART_PIN_RXD + UART_PIN_TXD); ->>>>>>> Stashed changes UART_PORT_DIR |= UART_PIN_TXD; UART_PORT_DIR |= UART_PIN_RXD; UART_PORT_OUT &= ~(UART_PIN_TXD + UART_PIN_RXD); } -<<<<<<< Updated upstream - -/************************************************************************** - * @brief void hal_uart_start_tx(void) - * - * @param Start the TX ISR, it will automatically stop when FIFO is empty - * - * @return none - **************************************************************************/ -void hal_uart_start_tx(void) -{ - - if(isr_state == TX_ISR_OFF) { - ENTER_CRITICAL_SECTION(isr_flag); - isr_state = TX_ISR_ON; - UCA1IE |= UCTXIE; - UCA1TXBUF = circ_buf_get_data(&uart_tx_buf); - LEAVE_CRITICAL_SECTION(isr_flag); - } -} - -// Echo back RXed character, confirm TX buffer is ready first -#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) -#pragma vector=USCI_A1_VECTOR -__interrupt void USCI_A1_ISR(void) -#elif defined(__GNUC__) -void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void) -#else -#error Compiler not supported! -#endif -{ - char tmp_uart_data; - switch(__even_in_range(UCA1IV,4)) - { - case USCI_NONE: - break; // Vector 0 - no interrupt - case USCI_UCRXIFG: // Vector 2 - RXIFG - tmp_uart_data = UCA1RXBUF; - - circ_buf_put_data(&uart_rx_buf, tmp_uart_data); - - if(uart_state == UART_ECHO_ON) { - uart_put_char(tmp_uart_data); - } - // if its a "return" then activate main-loop - if(tmp_uart_data == 13) { - rx_end_of_str = END_OF_LINE_DETECTED; - rx_str_length = uart_rx_buf.size_of_buffer - circ_buf_remainder(&uart_rx_buf); - __bic_SR_register_on_exit(LPM3_bits); - } - break; - case USCI_UCTXIFG: - // check if there is more data to send - if(circ_buf_remainder(&uart_tx_buf) < uart_tx_buf.size_of_buffer) { - UCA1TXBUF = circ_buf_get_data(&uart_tx_buf); - } else { - isr_state = TX_ISR_OFF; - UCA1IE &= ~UCTXIE; // Disable USCI_A0 TX interrupt - } - break; // Vector 4 - TXIFG - default: - break; - } -} - -#elif UART_SER_INTF == F2_UART_INTF_USCIA0 // Interface to UART - -/************************************************************************** -======= /************************************************************************** * @brief void hal_uart_start_tx(void) @@ -666,7 +585,6 @@ void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void) #elif UART_SER_INTF == F2_UART_INTF_USCIA0 // Interface to UART /************************************************************************** ->>>>>>> Stashed changes * @brief Initializes the serial communications peripheral and GPIO ports * to communicate with the TUSB3410. * -- GitLab