Landfall

Change of pkg/devices/lib/spi/src/hybrid.cc

236:779f8f6a9587
pkg/devices/lib/spi/src/hybrid.cc cpm-library-improvements
     1.1 --- a/pkg/devices/lib/spi/src/hybrid.cc	Mon Nov 13 01:20:09 2023 +0100
     1.2 +++ b/pkg/devices/lib/spi/src/hybrid.cc	Tue Nov 14 00:02:42 2023 +0100
     1.3 @@ -61,19 +61,34 @@
     1.4    
     1.5  /* Send a byte sequence with control information. */
     1.6  
     1.7 -uint32_t Spi_hybrid::send_dc(uint32_t bytes, const uint8_t data[], const int dc[])
     1.8 +uint32_t Spi_hybrid::send_dc(uint32_t bytes, const uint8_t data[],
     1.9 +                             const int dc[], uint8_t char_size, bool big_endian)
    1.10  {
    1.11 -  return _channel->send_dc(bytes, data, dc);
    1.12 +  return _channel->send_dc(bytes, data, dc, char_size, big_endian);
    1.13  }
    1.14    
    1.15  /* Send a sequence of units having the given character size. */
    1.16  
    1.17  uint32_t Spi_hybrid::send_units(uint32_t bytes, const uint8_t data[],
    1.18 -                                uint8_t unit_size, uint8_t char_size)
    1.19 +                                uint8_t unit_size, uint8_t char_size,
    1.20 +                                bool big_endian)
    1.21  {
    1.22 -  return _channel->send_units(bytes, data, unit_size, char_size);
    1.23 +  return _channel->send_units(bytes, data, unit_size, char_size, big_endian);
    1.24  }
    1.25 -  
    1.26 +
    1.27 +/* Transfer a sequence of units using DMA if available. */
    1.28 +
    1.29 +uint32_t Spi_hybrid::transfer(l4_addr_t vaddr,
    1.30 +                              l4re_dma_space_dma_addr_t paddr,
    1.31 +                              uint32_t count, uint8_t unit_size,
    1.32 +                              uint8_t char_size,
    1.33 +                              l4_addr_t desc_vaddr,
    1.34 +                              l4re_dma_space_dma_addr_t desc_paddr)
    1.35 +{
    1.36 +  return _channel->transfer(vaddr, paddr, count, unit_size, char_size,
    1.37 +                            desc_vaddr, desc_paddr);
    1.38 +}
    1.39 +
    1.40  
    1.41  
    1.42  /* C language interface. */
    1.43 @@ -107,13 +122,34 @@
    1.44  }
    1.45  
    1.46  uint32_t spi_hybrid_send_dc(void *channel, uint32_t bytes, const uint8_t data[],
    1.47 -                            const int dc[])
    1.48 +                            const int dc[], uint8_t char_size, int big_endian)
    1.49  {
    1.50 -  return static_cast<Spi_hybrid *>(channel)->send_dc(bytes, data, dc);
    1.51 +  return static_cast<Spi_hybrid *>(channel)->send_dc(bytes, data, dc, char_size,
    1.52 +    big_endian);
    1.53  }
    1.54  
    1.55  uint32_t spi_hybrid_send_units(void *channel, uint32_t bytes, const uint8_t data[],
    1.56 -                               uint8_t unit_size, uint8_t char_size)
    1.57 +                               uint8_t unit_size, uint8_t char_size,
    1.58 +                               int big_endian)
    1.59 +{
    1.60 +  return static_cast<Spi_hybrid *>(channel)->send_units(bytes, data, unit_size,
    1.61 +    char_size, big_endian);
    1.62 +}
    1.63 +
    1.64 +uint32_t spi_hybrid_transfer(void *channel, l4_addr_t vaddr,
    1.65 +                             l4re_dma_space_dma_addr_t paddr,
    1.66 +                             uint32_t count, uint8_t unit_size,
    1.67 +                             uint8_t char_size)
    1.68  {
    1.69 -  return static_cast<Spi_hybrid *>(channel)->send_units(bytes, data, unit_size, char_size);
    1.70 +  return static_cast<Spi_hybrid *>(channel)->transfer(vaddr, paddr, count, unit_size, char_size);
    1.71  }
    1.72 +
    1.73 +uint32_t spi_hybrid_transfer_descriptor(void *channel, l4_addr_t vaddr,
    1.74 +                                        l4re_dma_space_dma_addr_t paddr,
    1.75 +                                        uint32_t count, uint8_t unit_size,
    1.76 +                                        uint8_t char_size, l4_addr_t desc_vaddr,
    1.77 +                                        l4re_dma_space_dma_addr_t desc_paddr)
    1.78 +{
    1.79 +  return static_cast<Spi_hybrid *>(channel)->transfer(vaddr, paddr, count,
    1.80 +    unit_size, char_size, desc_vaddr, desc_paddr);
    1.81 +}