Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
SPIMasterTester.h
00001 /* 00002 * Copyright (c) 2019, Arm Limited and affiliates. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef SPI_MASTER_TESTER_H 00019 #define SPI_MASTER_TESTER_H 00020 00021 #include "SPITester.h" 00022 00023 class SPIMasterTester: public SPITester { 00024 public: 00025 00026 SPIMasterTester(const PinList *form_factor, const PinList *exclude_pins) 00027 : SPITester(form_factor, exclude_pins) 00028 { 00029 00030 } 00031 00032 /** 00033 * Read the number of transfers which have occurred 00034 * 00035 * @return The number of SPI transfers that have completed since 00036 * spi was reset. 00037 */ 00038 uint16_t get_transfer_count(); 00039 00040 /** 00041 * Read a checksum of data send to the tester 00042 * 00043 * @return The sum of all bytes sent to the tester since reset. 00044 */ 00045 uint32_t get_receive_checksum(); 00046 00047 /** 00048 * Set the clock mode of the spi_slave module. 00049 * 00050 * @param mode Spi clock mode 00051 */ 00052 void set_mode(SpiMode mode); 00053 00054 /** 00055 * Set bit order durring transmission of the spi_slave module. 00056 * 00057 * @param mode Spi clock mode 00058 */ 00059 void set_bit_order(SpiBitOrder bit_order); 00060 00061 /** 00062 * Set symbol size used durring transmission of the spi_slave module. 00063 * 00064 * @param mode Spi clock mode 00065 */ 00066 void set_sym_size(uint32_t sym_size); 00067 00068 /** 00069 * Set full-duplex/half-duplex transmission mode of the spi_slave module. 00070 * 00071 * @param duplex duplex mode used for the transmission 00072 */ 00073 void set_duplex_mode(SpiDuplex duplex); 00074 00075 /** 00076 * Set tx/rx symbol count. 00077 * 00078 * @tx_cnt TX symbol count 00079 * @rx_cnt RX symbol count 00080 * 00081 * @note Required only in Half-Duplex mode. 00082 */ 00083 void set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt); 00084 00085 /** 00086 * Get nano seconds between chip select assertion and the first spi clock edge. 00087 * 00088 * @return nano seconds between chip select assertion and the first spi clock edge. 00089 * 00090 * @note Number of nano seconds is calculated based of number of counted clk changes and 00091 * clk frequency (100 MHz => 1 clk tick corresponds to 10 ns). 00092 * Accuracy of the returned value is +/- 10 ns. 00093 */ 00094 uint32_t get_cs_to_first_clk_edge_ns(); 00095 00096 /** 00097 * Get nano seconds between last spi clock edge and chip select de-assertion. 00098 * 00099 * @return nano seconds between last spi clock edge and chip select de-assertion. 00100 * 00101 * @note Number of nano seconds is calculated based of number of counted clk changes and 00102 * clk frequency (100 MHz => 1 clk tick corresponds to 10 ns). 00103 * Accuracy of the returned value is +/- 10 ns. 00104 */ 00105 uint32_t get_last_clk_edge_to_cs_ns(); 00106 00107 /** 00108 * Get SCLK and SIN states on transmission start and stop. 00109 * 00110 * @return latched SCLK and SIN states on transmission start and stop. 00111 * 00112 * @note Stats are encoded as fallows (bit 0 - LSB): 00113 * - bit 0: start SCLK 00114 * - bit 1: start SIN 00115 * - bit 2: stop SCLK, 00116 * - bit 3: stop SIN, 00117 * - other: unused 00118 */ 00119 uint8_t get_start_stop_stats(); 00120 00121 }; 00122 00123 #endif
Generated on Tue Jul 12 2022 13:54:51 by
