diff --git a/Examples/MAX32690/Bluetooth/BLE_otas/dats_main.c b/Examples/MAX32690/Bluetooth/BLE_otas/dats_main.c index 6c8ebd4e8b3..e1748d10954 100644 --- a/Examples/MAX32690/Bluetooth/BLE_otas/dats_main.c +++ b/Examples/MAX32690/Bluetooth/BLE_otas/dats_main.c @@ -450,11 +450,8 @@ static void datsSetup(dmEvt_t *pMsg) { /* Initialize control information */ datsCb.restoringResList = FALSE; - < < < < < < < < < - Temporary merge branch 1 memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName)); - datsScanDataDisc[0] = sizeof(deviceName); - datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME; - == == == == = memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName)); + + memcpy(&datsScanDataDisc[2], deviceName, sizeof(deviceName)); datsScanDataDisc[0] = sizeof(deviceName); datsScanDataDisc[1] = DM_ADV_TYPE_LOCAL_NAME; diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c b/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c index 9d1ce7b3b38..4fc6a866343 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_ai87.c @@ -403,34 +403,19 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -457,36 +442,20 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - default: - return E_BAD_PARAM; - break; - } - } + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - default: - return E_BAD_PARAM; - break; - } + default: + return E_BAD_PARAM; + break; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_es17.c b/Libraries/PeriphDrivers/Source/SPI/spi_es17.c index f4b82cc5a21..de0f94b9b60 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_es17.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_es17.c @@ -252,35 +252,19 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - default: - return E_BAD_PARAM; - } - } - - //tx - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -307,34 +291,19 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me11.c b/Libraries/PeriphDrivers/Source/SPI/spi_me11.c index 6315e4bcc34..927f94c3f6b 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me11.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me11.c @@ -250,34 +250,19 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPIMSSTX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPIMSSRX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPIMSSTX; + reqselRx = MXC_DMA_REQUEST_SPIMSSRX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -304,34 +289,19 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 1: - reqselTx = MXC_DMA_REQUEST_SPIMSSTX; - break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPIMSSTX; + reqselRx = MXC_DMA_REQUEST_SPIMSSRX; + break; - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPIMSSRX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me12.c b/Libraries/PeriphDrivers/Source/SPI/spi_me12.c index ee08ebdc752..762d8913081 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me12.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me12.c @@ -359,34 +359,19 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -413,36 +398,20 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - default: - return E_BAD_PARAM; - break; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - default: - return E_BAD_PARAM; - break; - } + default: + return E_BAD_PARAM; + break; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me13.c b/Libraries/PeriphDrivers/Source/SPI/spi_me13.c index f5544910142..76bcdc18249 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me13.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me13.c @@ -283,42 +283,24 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -344,42 +326,24 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - default: - return E_BAD_PARAM; - } - } + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me14.c b/Libraries/PeriphDrivers/Source/SPI/spi_me14.c index a1f742e90e3..70eeb41e6e0 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me14.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me14.c @@ -348,42 +348,24 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req, mxc_dma_regs_t *dma) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, dma); @@ -413,42 +395,24 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req, mxc_dma_regs_t *dma) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - default: - return E_BAD_PARAM; - } - } + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, dma); diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me15.c b/Libraries/PeriphDrivers/Source/SPI/spi_me15.c index 78edd7916d5..f82cee593fd 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me15.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me15.c @@ -264,42 +264,24 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -326,42 +308,24 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, MXC_DMA); diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me16.c b/Libraries/PeriphDrivers/Source/SPI/spi_me16.c index a2e093446b1..5be9927d2b4 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me16.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me16.c @@ -260,44 +260,26 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2TX; - break; - - case 3: - reqselRx = MXC_DMA_REQUEST_SPI3TX; - break; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0TX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1TX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2TX; + break; + + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3TX; + break; } return MXC_SPI_RevA1_MasterTransactionDMA(req, reqselTx, reqselRx); @@ -323,44 +305,26 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2TX; - break; - - case 3: - reqselRx = MXC_DMA_REQUEST_SPI3TX; - break; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0TX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1TX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2TX; + break; + + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3TX; + break; } return MXC_SPI_RevA1_SlaveTransactionDMA(req, reqselTx, reqselRx); diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me17.c b/Libraries/PeriphDrivers/Source/SPI/spi_me17.c index 21a546d6bd5..2260bcb0d19 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me17.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me17.c @@ -417,34 +417,19 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -471,36 +456,20 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - default: - return E_BAD_PARAM; - break; - } - } + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - default: - return E_BAD_PARAM; - break; - } + default: + return E_BAD_PARAM; + break; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me18.c b/Libraries/PeriphDrivers/Source/SPI/spi_me18.c index 9fee2573d14..9d6c3b2114b 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me18.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me18.c @@ -390,48 +390,29 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; - case 4: - reqselTx = MXC_DMA_REQUEST_SPI4TX; - break; - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - case 3: - reqselRx = MXC_DMA_REQUEST_SPI3RX; - break; - case 4: - reqselRx = MXC_DMA_REQUEST_SPI4RX; - break; - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3RX; + break; + case 4: + reqselTx = MXC_DMA_REQUEST_SPI4TX; + reqselRx = MXC_DMA_REQUEST_SPI4RX; + break; + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -458,50 +439,30 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0TX; - break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1TX; - break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; - case 4: - reqselTx = MXC_DMA_REQUEST_SPI4TX; - break; - default: - return E_BAD_PARAM; - break; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2RX; - break; - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3RX; - break; - case 4: - reqselTx = MXC_DMA_REQUEST_SPI4RX; - break; - default: - return E_BAD_PARAM; - break; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3RX; + break; + case 4: + reqselTx = MXC_DMA_REQUEST_SPI4TX; + reqselRx = MXC_DMA_REQUEST_SPI4RX; + break; + default: + return E_BAD_PARAM; + break; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me21.c b/Libraries/PeriphDrivers/Source/SPI/spi_me21.c index 35aec65543b..738c06522cd 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me21.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me21.c @@ -281,42 +281,24 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -343,43 +325,26 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - case 2: - reqselTx = MXC_DMA_REQUEST_SPI2TX; - break; + case 2: + reqselTx = MXC_DMA_REQUEST_SPI2TX; + reqselRx = MXC_DMA_REQUEST_SPI2RX; + break; - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 2: - reqselRx = MXC_DMA_REQUEST_SPI2RX; - break; - - default: - return E_BAD_PARAM; - } - } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, MXC_DMA); } diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me30.c b/Libraries/PeriphDrivers/Source/SPI/spi_me30.c index ac48b4f2b2d..a98afdde4d0 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me30.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me30.c @@ -347,26 +347,14 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req, mxc_dma_regs_t *dma) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPITX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPIRX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPITX; + reqselRx = MXC_DMA_REQUEST_SPIRX; + break; - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, dma); @@ -396,17 +384,6 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req, mxc_dma_regs_t *dma) switch (spi_num) { case 0: reqselTx = MXC_DMA_REQUEST_SPITX; - break; - - default: - return E_BAD_PARAM; - break; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: reqselRx = MXC_DMA_REQUEST_SPIRX; break; diff --git a/Libraries/PeriphDrivers/Source/SPI/spi_me55.c b/Libraries/PeriphDrivers/Source/SPI/spi_me55.c index 4254d262979..338de200c5d 100644 --- a/Libraries/PeriphDrivers/Source/SPI/spi_me55.c +++ b/Libraries/PeriphDrivers/Source/SPI/spi_me55.c @@ -279,42 +279,24 @@ int MXC_SPI_MasterTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; - - default: - return E_BAD_PARAM; - } - } - - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; - - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 3: - reqselRx = MXC_DMA_REQUEST_SPI3RX; - break; - - default: - return E_BAD_PARAM; - } + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; + + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; + + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3RX; + break; + + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_MasterTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, @@ -340,42 +322,24 @@ int MXC_SPI_SlaveTransactionDMA(mxc_spi_req_t *req) spi_num = MXC_SPI_GET_IDX(req->spi); MXC_ASSERT(spi_num >= 0); - if (req->txData != NULL) { - switch (spi_num) { - case 0: - reqselTx = MXC_DMA_REQUEST_SPI0TX; - break; - - case 1: - reqselTx = MXC_DMA_REQUEST_SPI1TX; - break; - - case 3: - reqselTx = MXC_DMA_REQUEST_SPI3TX; - break; + switch (spi_num) { + case 0: + reqselTx = MXC_DMA_REQUEST_SPI0TX; + reqselRx = MXC_DMA_REQUEST_SPI0RX; + break; - default: - return E_BAD_PARAM; - } - } + case 1: + reqselTx = MXC_DMA_REQUEST_SPI1TX; + reqselRx = MXC_DMA_REQUEST_SPI1RX; + break; - if (req->rxData != NULL) { - switch (spi_num) { - case 0: - reqselRx = MXC_DMA_REQUEST_SPI0RX; - break; + case 3: + reqselTx = MXC_DMA_REQUEST_SPI3TX; + reqselRx = MXC_DMA_REQUEST_SPI3RX; + break; - case 1: - reqselRx = MXC_DMA_REQUEST_SPI1RX; - break; - - case 3: - reqselRx = MXC_DMA_REQUEST_SPI3RX; - break; - - default: - return E_BAD_PARAM; - } + default: + return E_BAD_PARAM; } return MXC_SPI_RevA1_SlaveTransactionDMA((mxc_spi_reva_req_t *)req, reqselTx, reqselRx, diff --git a/Libraries/PeriphDrivers/Source/UART/uart_reva.c b/Libraries/PeriphDrivers/Source/UART/uart_reva.c index f7ce7d44693..35f3b8c6a5b 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_reva.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_reva.c @@ -53,7 +53,17 @@ typedef struct { mxc_dma_regs_t *dma; } uart_reva_req_state_t; -uart_reva_req_state_t states[MXC_UART_INSTANCES]; +// clang-format off +uart_reva_req_state_t states[MXC_UART_INSTANCES] = { + [0 ... MXC_UART_INSTANCES - 1] = { + .tx_req = NULL, + .rx_req = NULL, + .channelTx = -1, + .channelRx = -1, + .auto_dma_handlers = false + } +}; +// clang-format on /* **** Function Prototypes **** */ diff --git a/Libraries/PeriphDrivers/Source/UART/uart_revb.c b/Libraries/PeriphDrivers/Source/UART/uart_revb.c index 5e2067ebf1f..84b08201015 100644 --- a/Libraries/PeriphDrivers/Source/UART/uart_revb.c +++ b/Libraries/PeriphDrivers/Source/UART/uart_revb.c @@ -51,7 +51,17 @@ typedef struct { mxc_dma_regs_t *dma; } uart_revb_req_state_t; -uart_revb_req_state_t states[MXC_UART_INSTANCES]; +// clang-format off +uart_revb_req_state_t states[MXC_UART_INSTANCES] = { + [0 ... MXC_UART_INSTANCES - 1] = { + .tx_req = NULL, + .rx_req = NULL, + .channelTx = -1, + .channelRx = -1, + .auto_dma_handlers = false + } +}; +// clang-format on /* **** Function Prototypes **** */