Skip to content

Commit

Permalink
Revert MXC_DMA_INSTANCES to TARGET_NUM checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sihyung-maxim committed May 13, 2024
1 parent a59f777 commit c8d3552
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Libraries/PeriphDrivers/Source/UART/uart_revb.c
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ int MXC_UART_RevB_SetAutoDMAHandlers(mxc_uart_revb_regs_t *uart, bool enable)
return E_NO_ERROR;
}

#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)

void MXC_UART_RevA_DMA0_Handler(void)
{
Expand All @@ -848,7 +848,7 @@ DMA instance.
void MXC_UART_RevB_DMA_SetupAutoHandlers(mxc_dma_regs_t *dma_instance, unsigned int channel)
{
#ifdef __arm__
#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
NVIC_EnableIRQ(MXC_DMA_CH_GET_IRQ(dma_instance, channel));

/* (JC): This is not the cleanest or most scalable way to do this,
Expand Down Expand Up @@ -920,7 +920,7 @@ int MXC_UART_RevB_ReadRXFIFODMA(mxc_uart_revb_regs_t *uart, mxc_dma_regs_t *dma,

if (states[uart_num].auto_dma_handlers && states[uart_num].channelRx < 0) {
/* Acquire channel if we don't have one already */
#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
channel = MXC_DMA_AcquireChannel(dma);
#else
channel = MXC_DMA_AcquireChannel();
Expand Down Expand Up @@ -949,7 +949,7 @@ int MXC_UART_RevB_ReadRXFIFODMA(mxc_uart_revb_regs_t *uart, mxc_dma_regs_t *dma,
MXC_DMA_ConfigChannel(config, srcdst);
MXC_DMA_SetCallback(channel, MXC_UART_DMACallback);

#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
MXC_DMA_EnableInt(dma, channel);
#else
MXC_DMA_EnableInt(channel);
Expand Down Expand Up @@ -978,7 +978,7 @@ int MXC_UART_RevB_WriteTXFIFODMA(mxc_uart_revb_regs_t *uart, mxc_dma_regs_t *dma

if (states[uart_num].auto_dma_handlers && states[uart_num].channelTx < 0) {
/* Acquire channel if we don't have one already */
#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
channel = MXC_DMA_AcquireChannel(dma);
#else
channel = MXC_DMA_AcquireChannel();
Expand Down Expand Up @@ -1007,7 +1007,7 @@ int MXC_UART_RevB_WriteTXFIFODMA(mxc_uart_revb_regs_t *uart, mxc_dma_regs_t *dma
MXC_DMA_ConfigChannel(config, srcdst);
MXC_DMA_SetCallback(channel, MXC_UART_DMACallback);

#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
MXC_DMA_EnableInt(dma, channel);
#else
MXC_DMA_EnableInt(channel);
Expand Down Expand Up @@ -1052,7 +1052,7 @@ int MXC_UART_RevB_TransactionDMA(mxc_uart_revb_req_t *req, mxc_dma_regs_t *dma)
(req->uart)->dma |= (1 << MXC_F_UART_REVB_DMA_RX_THD_VAL_POS);
(req->uart)->dma |= (2 << MXC_F_UART_REVB_DMA_TX_THD_VAL_POS);

#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
MXC_DMA_Init(dma);
#else
MXC_DMA_Init();
Expand All @@ -1066,7 +1066,7 @@ int MXC_UART_RevB_TransactionDMA(mxc_uart_revb_req_t *req, mxc_dma_regs_t *dma)
if ((req->txData != NULL) && (req->txLen)) {
/* Save TX req, the DMA handler will use this later. */
states[uart_num].tx_req = req;
#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
if (MXC_UART_WriteTXFIFODMA((mxc_uart_regs_t *)(req->uart), dma, req->txData, req->txLen,
NULL) != E_NO_ERROR) {
#else
Expand All @@ -1080,7 +1080,7 @@ int MXC_UART_RevB_TransactionDMA(mxc_uart_revb_req_t *req, mxc_dma_regs_t *dma)
//rx
if ((req->rxData != NULL) && (req->rxLen)) {
states[uart_num].rx_req = req;
#if (MXC_DMA_INSTANCES > 1)
#if (TARGET_NUM == 32657)
if (MXC_UART_ReadRXFIFODMA((mxc_uart_regs_t *)(req->uart), dma, req->rxData, req->rxLen,
NULL) != E_NO_ERROR) {
#else
Expand Down

0 comments on commit c8d3552

Please sign in to comment.