[rtems commit] bsp/atsam: Accept only 8/16 bits per word

Sebastian Huber sebh at rtems.org
Wed Mar 6 12:29:19 UTC 2019


Module:    rtems
Branch:    master
Commit:    85d5f6c17cb2610b99209cac7c2a74d6849d834d
Changeset: http://git.rtems.org/rtems/commit/?id=85d5f6c17cb2610b99209cac7c2a74d6849d834d

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed Mar  6 13:26:29 2019 +0100

bsp/atsam: Accept only 8/16 bits per word

For proper 16 bits per word support we need probably some DMA
adjustments.  For 9 to 15 bits per word we need support for the variable
peripheral select, see SR_MR[PS] register bit.

---

 bsps/arm/atsam/spi/atsam_spi_bus.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/bsps/arm/atsam/spi/atsam_spi_bus.c b/bsps/arm/atsam/spi/atsam_spi_bus.c
index a9d1366..6819de6 100644
--- a/bsps/arm/atsam/spi/atsam_spi_bus.c
+++ b/bsps/arm/atsam/spi/atsam_spi_bus.c
@@ -326,8 +326,7 @@ static int atsam_check_configure_spi(atsam_spi_bus *bus, const spi_ioc_transfer
       || msg->cs != bus->base.cs
   ) {
     if (
-      msg->bits_per_word < 8
-        || msg->bits_per_word > 16
+      (msg->bits_per_word != 8 && msg->bits_per_word != 16)
         || msg->mode > 3
         || msg->speed_hz > bus->base.max_speed_hz
     ) {
@@ -458,9 +457,8 @@ static int atsam_spi_setup(spi_bus *base)
   atsam_spi_bus *bus = (atsam_spi_bus *)base;
 
   if (
-    bus->base.speed_hz > MAX_SPI_FREQUENCY ||
-    bus->base.bits_per_word < 8 ||
-    bus->base.bits_per_word > 16
+    bus->base.speed_hz > MAX_SPI_FREQUENCY
+      || (bus->base.bits_per_word != 8 && bus->base.bits_per_word != 16)
   ) {
       return -EINVAL;
   }



More information about the vc mailing list