Mistake on this page?
Report an issue in GitHub or email us
SPISlaveTester.h
1 /*
2  * Copyright (c) 2019, Arm Limited and affiliates.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef SPI_SLAVE_TESTER_H
19 #define SPI_SLAVE_TESTER_H
20 
21 #include "SPITester.h"
22 
23 class SPISlaveTester: public SPITester {
24 public:
25 
26  SPISlaveTester(const PinList *form_factor, const PinList *exclude_pins)
27  : SPITester(form_factor, exclude_pins)
28  {
29 
30  }
31 
32  /**
33  * Read the number of transfers which have occurred
34  *
35  * @return The number of SPI transfers that have completed since
36  * spi was reset.
37  */
38  uint16_t get_transfer_count();
39 
40  /**
41  * Read a checksum of data sent to the tester
42  *
43  * @return The sum of all bytes sent to the tester since reset.
44  */
45  uint32_t get_receive_checksum();
46 
47  /**
48  * Set the clock mode of the spi_slave module.
49  *
50  * @param mode Spi clock mode
51  */
52  void set_mode(SpiMode mode);
53 
54  /**
55  * Set bit order during transmission of the spi_slave module.
56  *
57  * @param mode Spi clock mode
58  */
59  void set_bit_order(SpiBitOrder bit_order);
60 
61  /**
62  * Set symbol size used during transmission of the spi_slave module.
63  *
64  * @param mode Spi clock mode
65  */
66  void set_sym_size(uint32_t sym_size);
67 
68  /**
69  * Set full-duplex/half-duplex transmission mode of the spi_slave module.
70  *
71  * @param duplex duplex mode used for the transmission
72  */
73  void set_duplex_mode(SpiDuplex duplex);
74 
75  /**
76  * Set tx/rx symbol count.
77  *
78  * @tx_cnt TX symbol count
79  * @rx_cnt RX symbol count
80  *
81  * @note Required only in Half-Duplex mode.
82  */
83  void set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt);
84 
85  /**
86  * Set divisor to generate spi clock from FPGA base clock (100 MHz).
87  *
88  * @clk_div clock divisor.
89  */
90  void set_spi_master_freq(uint16_t clk_div);
91 
92  /**
93  * Set number of symbols to be transmitted by spi master.
94  *
95  * @num_of_sym Number of symbols to be transmitted by spi master.
96  */
97  void set_num_of_symbols(uint16_t num_of_sym);
98 
99  /**
100  * Set delay in us between start request and start of transmission.
101  *
102  * @start_delay_us Delay in us between start request and start of transmission.
103  */
104  void set_start_delay_us(uint8_t start_delay_us);
105 
106  /**
107  * Set delay in ns between transmission of successive symbols.
108  *
109  * @sym_delay_ns Delay in ns between transmission of successive symbols.
110  */
111  void set_sym_delay_ns(uint16_t sym_delay_ns);
112 
113  /**
114  * Request transmission start from FPGA master.
115  *
116  * @note Transmission will be started after the specified delay.
117  */
118  void start_transfer();
119 };
120 
121 #endif
void set_duplex_mode(SpiDuplex duplex)
Set full-duplex/half-duplex transmission mode of the spi_slave module.
uint16_t get_transfer_count()
Read the number of transfers which have occurred.
Definition: pinmap.h:37
uint32_t get_receive_checksum()
Read a checksum of data sent to the tester.
void set_start_delay_us(uint8_t start_delay_us)
Set delay in us between start request and start of transmission.
void set_sym_delay_ns(uint16_t sym_delay_ns)
Set delay in ns between transmission of successive symbols.
void set_mode(SpiMode mode)
Set the clock mode of the spi_slave module.
void set_sym_size(uint32_t sym_size)
Set symbol size used during transmission of the spi_slave module.
void set_bit_order(SpiBitOrder bit_order)
Set bit order during transmission of the spi_slave module.
void set_num_of_symbols(uint16_t num_of_sym)
Set number of symbols to be transmitted by spi master.
void set_spi_master_freq(uint16_t clk_div)
Set divisor to generate spi clock from FPGA base clock (100 MHz).
void start_transfer()
Request transmission start from FPGA master.
void set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt)
Set tx/rx symbol count.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.