/****************************************************************************** * @fn HalUARTInit * * @brief Initialize the UART * * @param none * * @return none *****************************************************************************/ void HalUARTInit(void) { #if (HAL_UART_DMA && HAL_UART_SPI) // When both are defined, port is run-time choice. if (HAL_UART_PORT) { HalUARTInitSPI(); } else { HalUARTInitDMA(); } #else #if HAL_UART_DMA HalUARTInitDMA(); #endif #if HAL_UART_ISR HalUARTInitISR(); #endif #if HAL_UART_SPI HalUARTInitSPI(); #endif #if HAL_UART_USB HalUARTInitUSB(); #endif #endif }
/****************************************************************************** * @fn HalUARTInit * * @brief Initialize the UART * * @param none * * @return none *****************************************************************************/ void HalUARTInit(void) { #if HAL_UART_DMA HalUARTInitDMA(); #endif #if HAL_UART_ISR HalUARTInitISR(); #endif #if HAL_UART_USB HalUARTInitUSB(); #endif }
/************************************************************************************************** * @fn sblInit * * @brief Initialization for SBL. * * input parameters * * None. * * output parameters * * None. * * @return None. ************************************************************************************************** */ static void sblInit(void) { HAL_BOARD_INIT(); vddWait(VDD_MIN_RUN); magicByte = SB_MAGIC_VALUE; /* This is in place of calling HalDmaInit() which would require init of the other 4 DMA * descriptors in addition to just Channel 0. */ HAL_DMA_SET_ADDR_DESC0(&dmaCh0); #if defined CC2530_MK znpCfg1 = ZNP_CFG1_SPI; #else znpCfg1 = P2_0; #endif if (znpCfg1 == ZNP_CFG1_SPI) { SRDY_CLR(); // Select general purpose on I/O pins. P0SEL &= ~(NP_RDYIn_BIT); // P0.3 MRDY - GPIO P0SEL &= ~(NP_RDYOut_BIT); // P0.4 SRDY - GPIO // Select GPIO direction. P0DIR &= ~NP_RDYIn_BIT; // P0.3 MRDY - IN P0DIR |= NP_RDYOut_BIT; // P0.4 SRDY - OUT P0INP &= ~NP_RDYIn_BIT; // Pullup/down enable of MRDY input. P2INP &= ~BV(5); // Pullup all P0 inputs. HalUARTInitSPI(); } else { halUARTCfg_t uartConfig; HalUARTInitISR(); uartConfig.configured = TRUE; uartConfig.baudRate = HAL_UART_BR_115200; uartConfig.flowControl = FALSE; uartConfig.flowControlThreshold = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.rx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.tx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.idleTimeout = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.intEnable = TRUE; uartConfig.callBackFunc = NULL; HalUARTOpenISR(&uartConfig); } }
/************************************************************************************************** * @fn sblHalInit * * @brief Serial Boot low-level initialization according to the RPC transport. * * input parameters * * None. * * output parameters * * None. * * @return None. */ static void sblHalInit(void) { halUARTCfg_t uartConfig; HalUARTInitISR(); uartConfig.configured = TRUE; uartConfig.baudRate = HAL_UART_BR_115200; uartConfig.flowControl = FALSE; uartConfig.flowControlThreshold = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.rx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.tx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.idleTimeout = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.intEnable = TRUE; uartConfig.callBackFunc = NULL; HalUARTOpenISR(&uartConfig); }
/****************************************************************************** * @fn HalUARTInit * * @brief Initialize the UART * * @param none * * @return none *****************************************************************************/ void HalUARTInit(void) { if (ZNP_CFG1_SPI == znpCfg1) { return; } #if HAL_UART_DMA HalUARTInitDMA(); #endif #if HAL_UART_ISR HalUARTInitISR(); #endif #if HAL_UART_USB HalUARTInitUSB(); #endif }
/************************************************************************************************** * @fn sblInit * * @brief SBL initialization. * * input parameters * * None. * * output parameters * * None. * * @return None. */ static void sblInit(void) { halUARTCfg_t uartConfig; /* This is in place of calling HalDmaInit() which would require init of the other 4 DMA * descriptors in addition to just Channel 0. */ HAL_DMA_SET_ADDR_DESC0(&dmaCh0); HalUARTInitISR(); uartConfig.configured = TRUE; uartConfig.baudRate = HAL_UART_BR_115200; uartConfig.flowControl = FALSE; uartConfig.flowControlThreshold = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.rx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.tx.maxBufSize = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.idleTimeout = 0; // CC2530 by #define - see hal_board_cfg.h uartConfig.intEnable = TRUE; uartConfig.callBackFunc = NULL; HalUARTOpenISR(&uartConfig); SB_INIT_LEDS(); }