Skip to content

Commit 50d63a1

Browse files
feat(PeriphDrivers): Add new MXC_SPI_GetAndClearFlags API
Add new MXC_SPI_GetAndClearFlags to simultaneously retrieve the current interrupt flags, and clear only the returned flags. This avoids accidentally clearing flags that have been set since a call to get the current flags using the existing MXC_SPI_ClearFlags API. Signed-off-by: Pete Johanson <pete.johanson@analog.com>
1 parent bb9fd75 commit 50d63a1

34 files changed

Lines changed: 290 additions & 0 deletions

File tree

Libraries/PeriphDrivers/Include/MAX32520/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
470470
*/
471471
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
472472

473+
/**
474+
* @brief Gets and clears the interrupt flags that are currently set
475+
*
476+
* These functions should not be used while using non-blocking Transaction Level
477+
* functions (Async or DMA)
478+
*
479+
* @param spi Pointer to SPI registers (selects the SPI block used.)
480+
*
481+
* @return The interrupt flags
482+
*/
483+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
484+
473485
/**
474486
* @brief Enables specific interrupts
475487
*

Libraries/PeriphDrivers/Include/MAX32570/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
478478
*/
479479
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
480480

481+
/**
482+
* @brief Gets and clears the interrupt flags that are currently set
483+
*
484+
* These functions should not be used while using non-blocking Transaction Level
485+
* functions (Async or DMA)
486+
*
487+
* @param spi Pointer to SPI registers (selects the SPI block used.)
488+
*
489+
* @return The interrupt flags
490+
*/
491+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
492+
481493
/**
482494
* @brief Enables specific interrupts
483495
*

Libraries/PeriphDrivers/Include/MAX32572/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
320320
*/
321321
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
322322

323+
/**
324+
* @brief Gets and clears the interrupt flags that are currently set
325+
*
326+
* These functions should not be used while using non-blocking Transaction Level
327+
* functions (Async or DMA)
328+
*
329+
* @param spi Pointer to SPI registers (selects the SPI block used.)
330+
*
331+
* @return The interrupt flags
332+
*/
333+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
334+
323335
/**
324336
* @brief Enables specific interrupts
325337
*

Libraries/PeriphDrivers/Include/MAX32650/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
480480
*/
481481
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
482482

483+
/**
484+
* @brief Gets and clears the interrupt flags that are currently set
485+
*
486+
* These functions should not be used while using non-blocking Transaction Level
487+
* functions (Async or DMA)
488+
*
489+
* @param spi Pointer to SPI registers (selects the SPI block used.)
490+
*
491+
* @return The interrupt flags
492+
*/
493+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
494+
483495
/**
484496
* @brief Enables specific interrupts
485497
*

Libraries/PeriphDrivers/Include/MAX32655/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
523523
*/
524524
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
525525

526+
/**
527+
* @brief Gets and clears the interrupt flags that are currently set
528+
*
529+
* These functions should not be used while using non-blocking Transaction Level
530+
* functions (Async or DMA)
531+
*
532+
* @param spi Pointer to SPI registers (selects the SPI block used.)
533+
*
534+
* @return The interrupt flags
535+
*/
536+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
537+
526538
/**
527539
* @brief Enables specific interrupts
528540
*

Libraries/PeriphDrivers/Include/MAX32657/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
522522
*/
523523
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
524524

525+
/**
526+
* @brief Gets and clears the interrupt flags that are currently set
527+
*
528+
* These functions should not be used while using non-blocking Transaction Level
529+
* functions (Async or DMA)
530+
*
531+
* @param spi Pointer to SPI registers (selects the SPI block used.)
532+
*
533+
* @return The interrupt flags
534+
*/
535+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
536+
525537
/**
526538
* @brief Enables specific interrupts
527539
*

Libraries/PeriphDrivers/Include/MAX32660/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
476476
*/
477477
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
478478

479+
/**
480+
* @brief Gets and clears the interrupt flags that are currently set
481+
*
482+
* These functions should not be used while using non-blocking Transaction Level
483+
* functions (Async or DMA)
484+
*
485+
* @param spi Pointer to SPI registers (selects the SPI block used.)
486+
*
487+
* @return The interrupt flags
488+
*/
489+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
490+
479491
/**
480492
* @brief Enables specific interrupts
481493
*

Libraries/PeriphDrivers/Include/MAX32662/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
501501
*/
502502
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
503503

504+
/**
505+
* @brief Gets and clears the interrupt flags that are currently set
506+
*
507+
* These functions should not be used while using non-blocking Transaction Level
508+
* functions (Async or DMA)
509+
*
510+
* @param spi Pointer to SPI registers (selects the SPI block used.)
511+
*
512+
* @return The interrupt flags
513+
*/
514+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
515+
504516
/**
505517
* @brief Enables specific interrupts
506518
*

Libraries/PeriphDrivers/Include/MAX32665/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
478478
*/
479479
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
480480

481+
/**
482+
* @brief Gets and clears the interrupt flags that are currently set
483+
*
484+
* These functions should not be used while using non-blocking Transaction Level
485+
* functions (Async or DMA)
486+
*
487+
* @param spi Pointer to SPI registers (selects the SPI block used.)
488+
*
489+
* @return The interrupt flags
490+
*/
491+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
492+
481493
/**
482494
* @brief Enables specific interrupts
483495
*

Libraries/PeriphDrivers/Include/MAX32670/spi.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,18 @@ unsigned int MXC_SPI_GetFlags(mxc_spi_regs_t *spi);
476476
*/
477477
void MXC_SPI_ClearFlags(mxc_spi_regs_t *spi);
478478

479+
/**
480+
* @brief Gets and clears the interrupt flags that are currently set
481+
*
482+
* These functions should not be used while using non-blocking Transaction Level
483+
* functions (Async or DMA)
484+
*
485+
* @param spi Pointer to SPI registers (selects the SPI block used.)
486+
*
487+
* @return The interrupt flags
488+
*/
489+
unsigned int MXC_SPI_GetAndClearFlags(mxc_spi_regs_t *spi);
490+
479491
/**
480492
* @brief Enables specific interrupts
481493
*

0 commit comments

Comments
 (0)