KSDK: Updated version of the SAI driver to address code-size issues

Signed-off-by: Mahadevan Mahesh <Mahesh.Mahadevan@nxp.com>
pull/2514/head
Mahadevan Mahesh 2016-08-22 13:09:15 -05:00
parent dda7f7d77a
commit 8e8ccee98e
8 changed files with 136 additions and 68 deletions

View File

@ -40,6 +40,12 @@ enum _sai_transfer_state
kSAI_Error /*!< Transfer error occured. */
};
/*! @brief Typedef for sai tx interrupt handler. */
typedef void (*sai_tx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*! @brief Typedef for sai rx interrupt handler. */
typedef void (*sai_rx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*******************************************************************************
* Prototypes
******************************************************************************/
@ -98,6 +104,10 @@ static const IRQn_Type s_saiTxIRQ[] = I2S_TX_IRQS;
static const IRQn_Type s_saiRxIRQ[] = I2S_RX_IRQS;
/* Clock name array */
static const clock_ip_name_t s_saiClock[] = SAI_CLOCKS;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_tx_isr_t s_saiTxIsr;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_rx_isr_t s_saiRxIsr;
/*******************************************************************************
* Code
@ -231,12 +241,13 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -332,12 +343,13 @@ void SAI_RxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -663,6 +675,9 @@ void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiTxIsr = SAI_TransferTxHandleIRQ;
/* Enable Tx irq */
EnableIRQ(s_saiTxIRQ[SAI_GetInstance(base)]);
}
@ -676,6 +691,9 @@ void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiRxIsr = SAI_TransferRxHandleIRQ;
/* Enable Rx irq */
EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]);
}
@ -1011,24 +1029,24 @@ void I2S0_DriverIRQHandler(void)
{
if ((s_saiHandle[0][1]) && ((I2S0->RCSR & kSAI_FIFOWarningFlag) || (I2S0->RCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
if ((s_saiHandle[0][0]) && ((I2S0->TCSR & kSAI_FIFOWarningFlag) || (I2S0->TCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
}
#else
void I2S0_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][0]);
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
void I2S0_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][1]);
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
#endif /* FSL_FEATURE_SAI_INT_SOURCE_NUM */
#endif /* I2S0*/
@ -1037,12 +1055,12 @@ void I2S0_Rx_DriverIRQHandler(void)
void I2S1_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][0]);
SAI_TransferTxHandleIRQ(I2S1, s_saiHandle[1][0]);
s_saiTxIsr(I2S1, s_saiHandle[1][0]);
}
void I2S1_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][1]);
SAI_TransferRxHandleIRQ(I2S1, s_saiHandle[1][1]);
s_saiRxIsr(I2S1, s_saiHandle[1][1]);
}
#endif

View File

@ -38,7 +38,6 @@
* @{
*/
/*! @file */
/*******************************************************************************
* Definitions
@ -46,7 +45,7 @@
/*! @name Driver version */
/*@{*/
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0 */
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) /*!< Version 2.1.1 */
/*@}*/
/*! @brief SAI return status*/
@ -168,7 +167,7 @@ typedef enum _sai_fifo_packing
} sai_fifo_packing_t;
#endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
/*! @brief SAI user configure structure */
/*! @brief SAI user configuration structure */
typedef struct _sai_config
{
sai_protocol_t protocol; /*!< Audio bus protocol in SAI */
@ -276,7 +275,7 @@ extern "C" {
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
@ -292,7 +291,7 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_RxInit(I2S_Type *base, const sai_config_t *config);

View File

@ -40,6 +40,12 @@ enum _sai_transfer_state
kSAI_Error /*!< Transfer error occured. */
};
/*! @brief Typedef for sai tx interrupt handler. */
typedef void (*sai_tx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*! @brief Typedef for sai rx interrupt handler. */
typedef void (*sai_rx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*******************************************************************************
* Prototypes
******************************************************************************/
@ -98,6 +104,10 @@ static const IRQn_Type s_saiTxIRQ[] = I2S_TX_IRQS;
static const IRQn_Type s_saiRxIRQ[] = I2S_RX_IRQS;
/* Clock name array */
static const clock_ip_name_t s_saiClock[] = SAI_CLOCKS;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_tx_isr_t s_saiTxIsr;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_rx_isr_t s_saiRxIsr;
/*******************************************************************************
* Code
@ -231,12 +241,13 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -332,12 +343,13 @@ void SAI_RxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -663,6 +675,9 @@ void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiTxIsr = SAI_TransferTxHandleIRQ;
/* Enable Tx irq */
EnableIRQ(s_saiTxIRQ[SAI_GetInstance(base)]);
}
@ -676,6 +691,9 @@ void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiRxIsr = SAI_TransferRxHandleIRQ;
/* Enable Rx irq */
EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]);
}
@ -1011,24 +1029,24 @@ void I2S0_DriverIRQHandler(void)
{
if ((s_saiHandle[0][1]) && ((I2S0->RCSR & kSAI_FIFOWarningFlag) || (I2S0->RCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
if ((s_saiHandle[0][0]) && ((I2S0->TCSR & kSAI_FIFOWarningFlag) || (I2S0->TCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
}
#else
void I2S0_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][0]);
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
void I2S0_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][1]);
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
#endif /* FSL_FEATURE_SAI_INT_SOURCE_NUM */
#endif /* I2S0*/
@ -1037,12 +1055,12 @@ void I2S0_Rx_DriverIRQHandler(void)
void I2S1_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][0]);
SAI_TransferTxHandleIRQ(I2S1, s_saiHandle[1][0]);
s_saiTxIsr(I2S1, s_saiHandle[1][0]);
}
void I2S1_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][1]);
SAI_TransferRxHandleIRQ(I2S1, s_saiHandle[1][1]);
s_saiRxIsr(I2S1, s_saiHandle[1][1]);
}
#endif

View File

@ -38,7 +38,6 @@
* @{
*/
/*! @file */
/*******************************************************************************
* Definitions
@ -46,7 +45,7 @@
/*! @name Driver version */
/*@{*/
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0 */
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) /*!< Version 2.1.1 */
/*@}*/
/*! @brief SAI return status*/
@ -168,7 +167,7 @@ typedef enum _sai_fifo_packing
} sai_fifo_packing_t;
#endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
/*! @brief SAI user configure structure */
/*! @brief SAI user configuration structure */
typedef struct _sai_config
{
sai_protocol_t protocol; /*!< Audio bus protocol in SAI */
@ -276,7 +275,7 @@ extern "C" {
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
@ -292,7 +291,7 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_RxInit(I2S_Type *base, const sai_config_t *config);

View File

@ -40,6 +40,12 @@ enum _sai_transfer_state
kSAI_Error /*!< Transfer error occured. */
};
/*! @brief Typedef for sai tx interrupt handler. */
typedef void (*sai_tx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*! @brief Typedef for sai rx interrupt handler. */
typedef void (*sai_rx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*******************************************************************************
* Prototypes
******************************************************************************/
@ -98,6 +104,10 @@ static const IRQn_Type s_saiTxIRQ[] = I2S_TX_IRQS;
static const IRQn_Type s_saiRxIRQ[] = I2S_RX_IRQS;
/* Clock name array */
static const clock_ip_name_t s_saiClock[] = SAI_CLOCKS;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_tx_isr_t s_saiTxIsr;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_rx_isr_t s_saiRxIsr;
/*******************************************************************************
* Code
@ -231,12 +241,13 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -332,12 +343,13 @@ void SAI_RxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -663,6 +675,9 @@ void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiTxIsr = SAI_TransferTxHandleIRQ;
/* Enable Tx irq */
EnableIRQ(s_saiTxIRQ[SAI_GetInstance(base)]);
}
@ -676,6 +691,9 @@ void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiRxIsr = SAI_TransferRxHandleIRQ;
/* Enable Rx irq */
EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]);
}
@ -1011,24 +1029,24 @@ void I2S0_DriverIRQHandler(void)
{
if ((s_saiHandle[0][1]) && ((I2S0->RCSR & kSAI_FIFOWarningFlag) || (I2S0->RCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
if ((s_saiHandle[0][0]) && ((I2S0->TCSR & kSAI_FIFOWarningFlag) || (I2S0->TCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
}
#else
void I2S0_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][0]);
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
void I2S0_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][1]);
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
#endif /* FSL_FEATURE_SAI_INT_SOURCE_NUM */
#endif /* I2S0*/
@ -1037,12 +1055,12 @@ void I2S0_Rx_DriverIRQHandler(void)
void I2S1_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][0]);
SAI_TransferTxHandleIRQ(I2S1, s_saiHandle[1][0]);
s_saiTxIsr(I2S1, s_saiHandle[1][0]);
}
void I2S1_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][1]);
SAI_TransferRxHandleIRQ(I2S1, s_saiHandle[1][1]);
s_saiRxIsr(I2S1, s_saiHandle[1][1]);
}
#endif

View File

@ -38,7 +38,6 @@
* @{
*/
/*! @file */
/*******************************************************************************
* Definitions
@ -46,7 +45,7 @@
/*! @name Driver version */
/*@{*/
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0 */
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) /*!< Version 2.1.1 */
/*@}*/
/*! @brief SAI return status*/
@ -168,7 +167,7 @@ typedef enum _sai_fifo_packing
} sai_fifo_packing_t;
#endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
/*! @brief SAI user configure structure */
/*! @brief SAI user configuration structure */
typedef struct _sai_config
{
sai_protocol_t protocol; /*!< Audio bus protocol in SAI */
@ -276,7 +275,7 @@ extern "C" {
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
@ -292,7 +291,7 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_RxInit(I2S_Type *base, const sai_config_t *config);

View File

@ -40,6 +40,12 @@ enum _sai_transfer_state
kSAI_Error /*!< Transfer error occured. */
};
/*! @brief Typedef for sai tx interrupt handler. */
typedef void (*sai_tx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*! @brief Typedef for sai rx interrupt handler. */
typedef void (*sai_rx_isr_t)(I2S_Type *base, sai_handle_t *saiHandle);
/*******************************************************************************
* Prototypes
******************************************************************************/
@ -98,6 +104,10 @@ static const IRQn_Type s_saiTxIRQ[] = I2S_TX_IRQS;
static const IRQn_Type s_saiRxIRQ[] = I2S_RX_IRQS;
/* Clock name array */
static const clock_ip_name_t s_saiClock[] = SAI_CLOCKS;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_tx_isr_t s_saiTxIsr;
/*! @brief Pointer to tx IRQ handler for each instance. */
static sai_rx_isr_t s_saiRxIsr;
/*******************************************************************************
* Code
@ -231,12 +241,13 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -332,12 +343,13 @@ void SAI_RxInit(I2S_Type *base, const sai_config_t *config)
CLOCK_EnableClock(s_saiClock[SAI_GetInstance(base)]);
#if defined(FSL_FEATURE_SAI_HAS_MCR) && (FSL_FEATURE_SAI_HAS_MCR)
/* Configure Master clock output enable */
base->MCR = I2S_MCR_MOE(config->mclkOutputEnable);
/* Master clock source setting */
val = (base->MCR & ~I2S_MCR_MICS_MASK);
base->MCR = (val | I2S_MCR_MICS(config->mclkSource));
/* Configure Master clock output enable */
val = (base->MCR & ~I2S_MCR_MOE_MASK);
base->MCR = (val | I2S_MCR_MOE(config->mclkOutputEnable));
#endif /* FSL_FEATURE_SAI_HAS_MCR */
/* Configure audio protocol */
@ -663,6 +675,9 @@ void SAI_TransferTxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiTxIsr = SAI_TransferTxHandleIRQ;
/* Enable Tx irq */
EnableIRQ(s_saiTxIRQ[SAI_GetInstance(base)]);
}
@ -676,6 +691,9 @@ void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transf
handle->callback = callback;
handle->userData = userData;
/* Set the isr pointer */
s_saiRxIsr = SAI_TransferRxHandleIRQ;
/* Enable Rx irq */
EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]);
}
@ -1011,24 +1029,24 @@ void I2S0_DriverIRQHandler(void)
{
if ((s_saiHandle[0][1]) && ((I2S0->RCSR & kSAI_FIFOWarningFlag) || (I2S0->RCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
if ((s_saiHandle[0][0]) && ((I2S0->TCSR & kSAI_FIFOWarningFlag) || (I2S0->TCSR & kSAI_FIFOErrorFlag)))
{
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
}
#else
void I2S0_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][0]);
SAI_TransferTxHandleIRQ(I2S0, s_saiHandle[0][0]);
s_saiTxIsr(I2S0, s_saiHandle[0][0]);
}
void I2S0_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[0][1]);
SAI_TransferRxHandleIRQ(I2S0, s_saiHandle[0][1]);
s_saiRxIsr(I2S0, s_saiHandle[0][1]);
}
#endif /* FSL_FEATURE_SAI_INT_SOURCE_NUM */
#endif /* I2S0*/
@ -1037,12 +1055,12 @@ void I2S0_Rx_DriverIRQHandler(void)
void I2S1_Tx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][0]);
SAI_TransferTxHandleIRQ(I2S1, s_saiHandle[1][0]);
s_saiTxIsr(I2S1, s_saiHandle[1][0]);
}
void I2S1_Rx_DriverIRQHandler(void)
{
assert(s_saiHandle[1][1]);
SAI_TransferRxHandleIRQ(I2S1, s_saiHandle[1][1]);
s_saiRxIsr(I2S1, s_saiHandle[1][1]);
}
#endif

View File

@ -38,7 +38,6 @@
* @{
*/
/*! @file */
/*******************************************************************************
* Definitions
@ -46,7 +45,7 @@
/*! @name Driver version */
/*@{*/
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 0)) /*!< Version 2.1.0 */
#define FSL_SAI_DRIVER_VERSION (MAKE_VERSION(2, 1, 1)) /*!< Version 2.1.1 */
/*@}*/
/*! @brief SAI return status*/
@ -168,7 +167,7 @@ typedef enum _sai_fifo_packing
} sai_fifo_packing_t;
#endif /* FSL_FEATURE_SAI_HAS_FIFO_PACKING */
/*! @brief SAI user configure structure */
/*! @brief SAI user configuration structure */
typedef struct _sai_config
{
sai_protocol_t protocol; /*!< Audio bus protocol in SAI */
@ -276,7 +275,7 @@ extern "C" {
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
@ -292,7 +291,7 @@ void SAI_TxInit(I2S_Type *base, const sai_config_t *config);
* because the clock is not enabled.
*
* @param base SAI base pointer
* @param config SAI configure structure.
* @param config SAI configuration structure.
*/
void SAI_RxInit(I2S_Type *base, const sai_config_t *config);