Skip to content

Commit

Permalink
refactor(PeriphDrivers): Update UART Rev. A to support TransactionAsy…
Browse files Browse the repository at this point in the history
…nc calls from callback function (#769)
  • Loading branch information
Jacob-Scheiffler authored Nov 1, 2023
1 parent ee5aafb commit 8fe52f2
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 123 deletions.
24 changes: 15 additions & 9 deletions Libraries/PeriphDrivers/Include/MAX32650/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,19 +607,23 @@ void MXC_UART_DMACallback(int ch, int error);
*
* @param uart The uart
* @param[in] retVal The ret value
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal);
void MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
void MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal);

/**
* @brief stop any async callbacks
*
* @param uart The uart
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AsyncStop(mxc_uart_regs_t *uart);
void MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart);
void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_AsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);

/**
* @brief Abort any asynchronous requests in progress.
Expand All @@ -629,10 +633,12 @@ void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);
* has been terminated.
*
* @param uart Pointer to UART registers (selects the UART block used.)
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AbortAsync(mxc_uart_regs_t *uart);
void MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart);
void MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_AbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart);

/**
* @brief UART interrupt handler.
Expand Down
24 changes: 15 additions & 9 deletions Libraries/PeriphDrivers/Include/MAX32665/uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,19 +644,23 @@ void MXC_UART_DMACallback(int ch, int error);
*
* @param uart The uart
* @param[in] retVal The ret value
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal);
void MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
void MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal);
int MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal);

/**
* @brief stop any async callbacks
*
* @param uart The uart
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AsyncStop(mxc_uart_regs_t *uart);
void MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart);
void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_AsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart);
int MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);

/**
* @brief Abort any asynchronous requests in progress.
Expand All @@ -666,10 +670,12 @@ void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart);
* has been terminated.
*
* @param uart Pointer to UART registers (selects the UART block used.)
*
* @return See \ref MXC_Error_Codes for the list of error return codes.
*/
void MXC_UART_AbortAsync(mxc_uart_regs_t *uart);
void MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart);
void MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_AbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart);
int MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart);

/**
* @brief The processing function for asynchronous transactions.
Expand Down
36 changes: 18 additions & 18 deletions Libraries/PeriphDrivers/Source/UART/uart_me10.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,57 +450,57 @@ void MXC_UART_DMACallback(int ch, int error)
}

/* ************************************************************************* */
void MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_AsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_AsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

/* ************************************************************************* */
void MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_TxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_TxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

/* ************************************************************************* */
void MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_RxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_RxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

/* ************************************************************************* */
void MXC_UART_AsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_AsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_AsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_AsyncStop((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
void MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_TxAsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_TxAsyncStop((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_RxAsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_RxAsyncStop((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
void MXC_UART_AbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_AbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_AbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_AbortAsync((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
void MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_TxAbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_TxAbortAsync((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
void MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_RxAbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_RxAbortAsync((mxc_uart_reva_regs_t *)uart);
}

/* ************************************************************************* */
Expand Down
36 changes: 18 additions & 18 deletions Libraries/PeriphDrivers/Source/UART/uart_me14.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,34 @@ void MXC_UART_DMACallback(int ch, int error)
MXC_UART_RevA_DMACallback(ch, error);
}

void MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_AsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_AsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_AsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

void MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_TxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_TxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_TxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

void MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
int MXC_UART_RxAsyncCallback(mxc_uart_regs_t *uart, int retVal)
{
MXC_UART_RevA_RxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
return MXC_UART_RevA_RxAsyncCallback((mxc_uart_reva_regs_t *)uart, retVal);
}

void MXC_UART_AsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_AsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_AsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_AsyncStop((mxc_uart_reva_regs_t *)uart);
}

void MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_TxAsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_TxAsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_TxAsyncStop((mxc_uart_reva_regs_t *)uart);
}

void MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart)
int MXC_UART_RxAsyncStop(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_RxAsyncStop((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_RxAsyncStop((mxc_uart_reva_regs_t *)uart);
}

int MXC_UART_Init(mxc_uart_regs_t *uart, unsigned int baud, sys_map_t map)
Expand Down Expand Up @@ -417,19 +417,19 @@ int MXC_UART_TransactionDMA(mxc_uart_req_t *req, mxc_dma_regs_t *dma)
return MXC_UART_RevA_TransactionDMA((mxc_uart_reva_req_t *)req, dma);
}

void MXC_UART_AbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_AbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_AbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_AbortAsync((mxc_uart_reva_regs_t *)uart);
}

void MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_TxAbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_TxAbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_TxAbortAsync((mxc_uart_reva_regs_t *)uart);
}

void MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart)
int MXC_UART_RxAbortAsync(mxc_uart_regs_t *uart)
{
MXC_UART_RevA_RxAbortAsync((mxc_uart_reva_regs_t *)uart);
return MXC_UART_RevA_RxAbortAsync((mxc_uart_reva_regs_t *)uart);
}

void MXC_UART_AsyncHandler(mxc_uart_regs_t *uart)
Expand Down
Loading

0 comments on commit 8fe52f2

Please sign in to comment.