LCOV - code coverage report
Current view: top level - SITL - SIM_SPI.h (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 1 100.0 %
Date: 2026-09-09 11:02:08 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :    This program is free software: you can redistribute it and/or modify
       3             :    it under the terms of the GNU General Public License as published by
       4             :    the Free Software Foundation, either version 3 of the License, or
       5             :    (at your option) any later version.
       6             : 
       7             :    This program is distributed in the hope that it will be useful,
       8             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
       9             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      10             :    GNU General Public License for more details.
      11             : 
      12             :    You should have received a copy of the GNU General Public License
      13             :    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      14             :  */
      15             : 
      16             : /*
      17             :   Simulated spi buses and devices
      18             : */
      19             : 
      20             : #pragma once
      21             : 
      22             : #include <AP_Param/AP_Param.h>
      23             : 
      24             : #include "stdint.h"
      25             : 
      26             : namespace SITL {
      27             : 
      28             : class SPI {
      29             : public:
      30        2096 :     SPI() {}
      31             : 
      32             :     void init();
      33             : 
      34             :     // update spi state
      35             :     void update(const class Aircraft &aircraft);
      36             : 
      37             :     int ioctl(uint8_t bus, uint8_t cs_pin, uint8_t ioctl_type, void *data);
      38             : 
      39             :     // the following must be identical to AP_HAL_SITL/SPIDevice.h
      40             :     struct spi_ioc_transfer {
      41             :         uint64_t tx_buf;
      42             :         uint64_t rx_buf;
      43             : 
      44             :         uint32_t len;
      45             :         // uint32_t speed_hz;
      46             : 
      47             :         // uint16_t delay_usecs;
      48             :         // uint8_t bits_per_word;
      49             :         // uint8_t cs_change;
      50             :     };
      51             : 
      52             : #define SPI_TRANSACTION_1LONG 17
      53             : #define SPI_TRANSACTION_2LONG 18
      54             :     // end "the following"
      55             : 
      56             : private:
      57             :     int ioctl_transaction(uint8_t bus, uint8_t cs_pin, uint8_t count, spi_ioc_transfer *data);
      58             : 
      59             : };
      60             : 
      61             : }

Generated by: LCOV version 1.14