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.cpp
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 #include "SPIMasterTester.h" 00019 #include "fpga_config.h" 00020 00021 uint16_t SPIMasterTester::get_transfer_count() 00022 { 00023 return SPITester::get_transfer_count(TESTER_SPI_MASTER_TRANSFERS, TESTER_SPI_MASTER_TRANSFERS_SIZE); 00024 } 00025 00026 uint32_t SPIMasterTester::get_receive_checksum() 00027 { 00028 return SPITester::get_receive_checksum(TESTER_SPI_MASTER_TO_SLAVE_CHECKSUM, TESTER_SPI_MASTER_TO_SLAVE_CHECKSUM_SIZE); 00029 } 00030 00031 void SPIMasterTester::set_mode(SPITester::SpiMode mode) 00032 { 00033 SPITester::set_mode(mode, TESTER_SPI_MASTER_CTRL, TESTER_SPI_MASTER_CTRL_SIZE, TESTER_SPI_MASTER_CLK_MODE_OFFSET, TESTER_SPI_MASTER_CLK_MODE_SIZE); 00034 } 00035 00036 void SPIMasterTester::set_bit_order(SPITester::SpiBitOrder bit_order) 00037 { 00038 SPITester::set_bit_order(bit_order, TESTER_SPI_MASTER_CTRL, TESTER_SPI_MASTER_CTRL_SIZE, TESTER_SPI_MASTER_BIT_ORDER_OFFSET, TESTER_SPI_MASTER_BIT_ORDER_SIZE); 00039 } 00040 00041 void SPIMasterTester::set_sym_size(uint32_t sym_size) 00042 { 00043 SPITester::set_sym_size(sym_size, TESTER_SPI_MASTER_CTRL, TESTER_SPI_MASTER_CTRL_SIZE, TESTER_SPI_MASTER_SYM_SIZE_OFFSET, TESTER_SPI_MASTER_SYM_SIZE_SIZE); 00044 } 00045 00046 void SPIMasterTester::set_duplex_mode(SPITester::SpiDuplex duplex) 00047 { 00048 SPITester::set_duplex_mode(duplex, TESTER_SPI_MASTER_CTRL, TESTER_SPI_MASTER_CTRL_SIZE, TESTER_SPI_MASTER_DUPLEX_OFFSET, TESTER_SPI_MASTER_DUPLEX_SIZE); 00049 } 00050 00051 void SPIMasterTester::set_hd_tx_rx_cnt(uint16_t tx_cnt, uint16_t rx_cnt) 00052 { 00053 SPITester::set_hd_tx_rx_cnt(tx_cnt, rx_cnt, TESTER_SPI_MASTER_HD_RX_CNT, TESTER_SPI_MASTER_HD_RX_CNT_SIZE, TESTER_SPI_MASTER_HD_TX_CNT, TESTER_SPI_MASTER_HD_TX_CNT_SIZE); 00054 } 00055 00056 uint32_t SPIMasterTester::get_cs_to_first_clk_edge_ns() 00057 { 00058 uint32_t delay_ns; 00059 read(TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT, (uint8_t *)&delay_ns, TESTER_SPI_MASTER_CS_TO_FIRST_SCLK_CNT_SIZE); 00060 00061 return (delay_ns * 10); 00062 } 00063 00064 uint32_t SPIMasterTester::get_last_clk_edge_to_cs_ns() 00065 { 00066 uint32_t delay_ns; 00067 read(TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT, (uint8_t *)&delay_ns, TESTER_SPI_MASTER_LAST_SCLK_TO_CS_CNT_SIZE); 00068 00069 return (delay_ns * 10); 00070 } 00071 00072 uint8_t SPIMasterTester::get_start_stop_stats() 00073 { 00074 uint8_t start_stop_stats; 00075 read(TESTER_SPI_MASTER_START_STOP_STATS, (uint8_t *)&start_stop_stats, TESTER_SPI_MASTER_START_STOP_STATS_SIZE); 00076 00077 return start_stop_stats; 00078 }
Generated on Tue Jul 12 2022 13:54:51 by
