2 * Copyright (c) 2015-2021 Arm Limited. All rights reserved.
4 * SPDX-License-Identifier: Apache-2.0
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * -----------------------------------------------------------------------------
20 * Project: CMSIS-Driver Validation
21 * Title: Serial Peripheral Interface Bus (SPI) Driver Validation tests
23 * -----------------------------------------------------------------------------
26 #ifndef __DOXYGEN__ // Exclude form the documentation
33 #include "DV_SPI_Config.h"
34 #include "DV_Framework.h"
36 // Fixed settings for communication with SPI Server (not available through DV_SPI_Config.h)
37 #define SPI_CFG_SRV_FORMAT 0 // Clock Polarity 0 / Clock Phase 0
38 #define SPI_CFG_SRV_DATA_BITS 8 // 8 data bits
39 #define SPI_CFG_SRV_BIT_ORDER 0 // MSB to LSB bit order
41 #include "Driver_SPI.h"
43 #define CMD_LEN 32UL // Length of command to SPI Server
44 #define RESP_GET_VER_LEN 16UL // Length of response from SPI Server to GET VER command
45 #define RESP_GET_CAP_LEN 32UL // Length of response from SPI Server to GET CAP command
46 #define RESP_GET_CNT_LEN 16UL // Length of response from SPI Server to GET CNT command
48 #define OP_SEND 0UL // Send operation
49 #define OP_RECEIVE 1UL // Receive operation
50 #define OP_TRANSFER 2UL // Transfer operation
51 #define OP_ABORT_SEND 3UL // Abort send operation
52 #define OP_ABORT_RECEIVE 4UL // Abort receive operation
53 #define OP_ABORT_TRANSFER 5UL // Abort transfer operation
55 #define MODE_INACTIVE 0UL // Inactive mode
56 #define MODE_MASTER 1UL // Master mode
57 #define MODE_SLAVE 2UL // Slave mode
58 #define SS_MODE_MASTER_UNUSED 0UL // Master mode Slave Select unused
59 #define SS_MODE_MASTER_SW 1UL // Master mode Slave Select Software controlled
60 #define SS_MODE_MASTER_HW_OUTPUT 2UL // Master mode Slave Select Hardware controlled Output
61 #define SS_MODE_MASTER_HW_INPUT 3UL // Master mode Slave Select Hardware monitored Input
62 #define SS_MODE_SLAVE_HW 0UL // Slave mode Slave Select Hardware monitored
63 #define SS_MODE_SLAVE_SW 1UL // Slave mode Slave Select Software controlled
64 #define FORMAT_CPOL0_CPHA0 0UL // Clock Format: Polarity 0, Phase 0
65 #define FORMAT_CPOL0_CPHA1 1UL // Clock Format: Polarity 0, Phase 1
66 #define FORMAT_CPOL1_CPHA0 2UL // Clock Format: Polarity 1, Phase 0
67 #define FORMAT_CPOL1_CPHA1 3UL // Clock Format: Polarity 1, Phase 1
68 #define FORMAT_TI 4UL // Frame Format: Texas Instruments
69 #define FORMAT_MICROWIRE 5UL // Frame Format: National Semiconductor Microwire
70 #define BO_MSB_TO_LSB 0UL // Bit Order MSB to LSB
71 #define BO_LSB_TO_MSB 1UL // Bit Order LSB to MSB
73 // Testing Configuration definitions
74 #if (SPI_CFG_TEST_MODE != 0)
75 #define SPI_SERVER_USED 1
77 #define SPI_SERVER_USED 0
80 // Determine maximum number of items used for testing
81 #if (SPI_CFG_DEF_NUM == 0)
82 #error Default number of items must not be 0!
85 #define SPI_NUM_MAX SPI_CFG_DEF_NUM
86 #if (SPI_CFG_NUM1 > SPI_NUM_MAX)
88 #define SPI_NUM_MAX SPI_CFG_NUM1
90 #if (SPI_CFG_NUM2 > SPI_NUM_MAX)
92 #define SPI_NUM_MAX SPI_CFG_NUM2
94 #if (SPI_CFG_NUM3 > SPI_NUM_MAX)
96 #define SPI_NUM_MAX SPI_CFG_NUM3
98 #if (SPI_CFG_NUM4 > SPI_NUM_MAX)
100 #define SPI_NUM_MAX SPI_CFG_NUM4
102 #if (SPI_CFG_NUM5 > SPI_NUM_MAX)
104 #define SPI_NUM_MAX SPI_CFG_NUM5
107 // Calculate maximum required buffer size
108 #if ((SPI_CFG_DEF_DATA_BITS > 16) || ((SPI_TC_DATA_BIT_EN_MASK & 0xFFFF0000UL) != 0U))
109 #define SPI_BUF_MAX (SPI_NUM_MAX * 4U)
110 #elif ((SPI_CFG_DEF_DATA_BITS > 8) || ((SPI_TC_DATA_BIT_EN_MASK & 0x0000FF00UL) != 0U))
111 #define SPI_BUF_MAX (SPI_NUM_MAX * 2U)
113 #define SPI_BUF_MAX (SPI_NUM_MAX)
115 #if (SPI_SERVER_USED == 1)
116 // If selected Test Mode is SPI Server take into account SPI Server data bit settings
117 #if ((SPI_CFG_SRV_DATA_BITS > 16) && (SPI_BUF_MAX < (SPI_NUM_MAX * 4U)))
119 #define SPI_BUF_MAX (SPI_NUM_MAX * 4U)
120 #elif ((SPI_CFG_SRV_DATA_BITS > 8) && (SPI_BUF_MAX < (SPI_NUM_MAX * 2U)))
122 #define SPI_BUF_MAX (SPI_NUM_MAX * 2U)
126 typedef struct { // SPI Server version structure
127 uint8_t major; // Version major number
128 uint8_t minor; // Version minor number
129 uint16_t patch; // Version patch (revision) number
132 typedef struct { // SPI Server capabilities structure
133 uint32_t mode_mask; // Mode and Slave Select mask
134 uint32_t fmt_mask; // Clock Format or Frame Format mask
135 uint32_t db_mask; // Data Bits mask
136 uint32_t bo_mask; // Bit Order mask
137 uint32_t bs_min; // Min bus speed
138 uint32_t bs_max; // Max bus speed
141 // Register Driver_SPI#
142 #define _ARM_Driver_SPI_(n) Driver_SPI##n
143 #define ARM_Driver_SPI_(n) _ARM_Driver_SPI_(n)
144 extern ARM_DRIVER_SPI ARM_Driver_SPI_(DRV_SPI);
145 static ARM_DRIVER_SPI *drv = &ARM_Driver_SPI_(DRV_SPI);
147 // Global variables (used in this module only)
148 static int8_t buffers_ok;
149 static int8_t driver_ok;
150 static int8_t server_ok;
152 static SPI_SERV_VER_t spi_serv_ver;
153 static SPI_SERV_CAP_t spi_serv_cap;
155 static volatile uint32_t event;
156 static volatile uint32_t duration;
157 static volatile uint32_t data_count_sample;
158 static uint32_t systick_freq;
160 static osEventFlagsId_t event_flags;
162 static char msg_buf[256];
164 // Allocated buffer pointers
165 static void *ptr_tx_buf_alloc;
166 static void *ptr_rx_buf_alloc;
167 static void *ptr_cmp_buf_alloc;
169 // Buffer pointers used for data transfers (must be aligned to 4 byte)
170 static uint8_t *ptr_tx_buf;
171 static uint8_t *ptr_rx_buf;
172 static uint8_t *ptr_cmp_buf;
174 // String representation of various codes
175 static const char *str_srv_status[] = {
180 static const char *str_test_mode[] = {
185 static const char *str_oper[] = {
194 static const char *str_ss_mode[] = {
196 "Software controlled",
197 "Hardware controlled"
200 static const char *str_mode[] = {
205 static const char *str_format[] = {
206 "Clock Polarity 0, Clock Phase 0",
207 "Clock Polarity 0, Clock Phase 1",
208 "Clock Polarity 1, Clock Phase 0",
209 "Clock Polarity 1, Clock Phase 1",
211 "National Semiconductor Microwire"
214 static const char *str_bit_order[] = {
219 static const char *str_ret[] = {
222 "ARM_DRIVER_ERROR_BUSY",
223 "ARM_DRIVER_ERROR_TIMEOUT",
224 "ARM_DRIVER_ERROR_UNSUPPORTED",
225 "ARM_DRIVER_ERROR_PARAMETER",
226 "ARM_DRIVER_ERROR_SPECIFIC",
227 "ARM_SPI_ERROR_MODE",
228 "ARM_SPI_ERROR_FRAME_FORMAT",
229 "ARM_SPI_ERROR_DATA_BITS",
230 "ARM_SPI_ERROR_BIT_ORDER",
231 "ARM_SPI_ERROR_SS_MODE"
235 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
236 static int32_t ComConfigDefault (void);
237 static int32_t ComSendCommand (const void *data_out, uint32_t len);
238 static int32_t ComReceiveResponse ( void *data_in, uint32_t len);
240 static int32_t CmdGetVer (void);
241 static int32_t CmdGetCap (void);
243 static int32_t CmdSetBufTx (char pattern);
244 static int32_t CmdSetBufRx (char pattern);
245 static int32_t CmdGetBufRx (uint32_t len);
246 static int32_t CmdSetCom (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t ss_mode, uint32_t bus_speed);
247 static int32_t CmdXfer (uint32_t num, uint32_t delay_c, uint32_t delay_t, uint32_t timeout);
248 static int32_t ServerInit (void);
249 static int32_t ServerCheck (void);
250 static int32_t ServerCheckSupport (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t bus_speed);
253 static int32_t IsNotLoopback (void);
254 static int32_t IsNotFrameTI (void);
255 static int32_t IsNotFrameMw (void);
256 static int32_t IsFormatValid (void);
257 static int32_t IsBitOrderValid (void);
259 static uint32_t DataBitsToBytes (uint32_t data_bits);
260 static int32_t DriverInit (void);
261 static int32_t BuffersCheck (void);
263 static void SPI_DataExchange_Operation (uint32_t operation, uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t ss_mode, uint32_t bus_speed, uint32_t num);
268 \fn void SPI_DrvEvent (uint32_t evt)
269 \brief Store event(s) into global variable.
270 \detail This is a callback function called by the driver upon an event(s).
271 \param[in] evt SPI event
274 static void SPI_DrvEvent (uint32_t evt) {
277 (void)osEventFlagsSet(event_flags, evt);
281 \fn static uint32_t DataBitsToBytes (uint32_t data_bits)
282 \brief Calculate number of bytes used for an item at required data bits.
283 \return number of bytes per item
285 static uint32_t DataBitsToBytes (uint32_t data_bits) {
289 if (data_bits > 16U) {
291 } else if (data_bits > 8U) {
299 \fn static int32_t DriverInit (void)
300 \brief Initialize and power-on the driver.
301 \return execution status
302 - EXIT_SUCCESS: Driver initialized and powered-up successfully
303 - EXIT_FAILURE: Driver initialization or power-up failed
305 static int32_t DriverInit (void) {
307 if (drv->Initialize (SPI_DrvEvent) == ARM_DRIVER_OK) {
308 if (drv->PowerControl(ARM_POWER_FULL) == ARM_DRIVER_OK) {
313 TEST_FAIL_MESSAGE("[FAILED] SPI driver initialize or power-up. Check driver Initialize and PowerControl functions! Test aborted!");
318 \fn static int32_t BuffersCheck (void)
319 \brief Check if buffers are valid.
320 \return execution status
321 - EXIT_SUCCESS: Buffers are valid
322 - EXIT_FAILURE: Buffers are not valid
324 static int32_t BuffersCheck (void) {
326 if ((ptr_tx_buf != NULL) &&
327 (ptr_rx_buf != NULL) &&
328 (ptr_cmp_buf != NULL)) {
332 TEST_FAIL_MESSAGE("[FAILED] Invalid data buffers! Increase heap memory! Test aborted!");
336 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
339 \fn static int32_t ComConfigDefault (void)
340 \brief Configure SPI Communication Interface to SPI Server default communication configuration.
341 \return execution status
342 - EXIT_SUCCESS: Default configuration successfully
343 - EXIT_FAILURE: Default configuration failed
345 static int32_t ComConfigDefault (void) {
350 if (drv->Control(ARM_SPI_MODE_MASTER |
351 ((SPI_CFG_SRV_FORMAT << ARM_SPI_FRAME_FORMAT_Pos) & ARM_SPI_FRAME_FORMAT_Msk) |
352 ((SPI_CFG_SRV_DATA_BITS << ARM_SPI_DATA_BITS_Pos) & ARM_SPI_DATA_BITS_Msk) |
353 ((SPI_CFG_SRV_BIT_ORDER << ARM_SPI_BIT_ORDER_Pos) & ARM_SPI_BIT_ORDER_Msk) |
354 ((SPI_CFG_SRV_SS_MODE << ARM_SPI_SS_MASTER_MODE_Pos) & ARM_SPI_SS_MASTER_MODE_Msk) ,
355 SPI_CFG_SRV_BUS_SPEED) != ARM_DRIVER_OK) {
359 if ((ret == EXIT_SUCCESS) && (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW)) {
360 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE) != ARM_DRIVER_OK) {
365 if (ret != EXIT_SUCCESS) {
366 TEST_FAIL_MESSAGE("[FAILED] Configure communication interface to SPI Server default settings. Check driver Control function! Test aborted!");
373 \fn static int32_t ComSendCommand (const void *data_out, uint32_t num)
374 \brief Send command to SPI Server.
375 \param[out] data_out Pointer to memory containing data to be sent
376 \param[in] len Number of bytes to be sent
377 \return execution status
378 - EXIT_SUCCESS: Command sent successfully
379 - EXIT_FAILURE: Command send failed
381 static int32_t ComSendCommand (const void *data_out, uint32_t len) {
383 uint32_t flags, num, tout;
386 num = (len + DataBitsToBytes(SPI_CFG_SRV_DATA_BITS) - 1U) / DataBitsToBytes(SPI_CFG_SRV_DATA_BITS);
388 ret = ComConfigDefault();
390 if (ret == EXIT_SUCCESS) {
391 if (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW) {
392 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_ACTIVE) != ARM_DRIVER_OK) {
396 if (ret == EXIT_SUCCESS) {
397 (void)osEventFlagsClear(event_flags, 0x7FFFFFFFU);
398 if (drv->Send(data_out, num) == ARM_DRIVER_OK) {
399 flags = osEventFlagsWait(event_flags, ARM_SPI_EVENT_TRANSFER_COMPLETE, osFlagsWaitAny, SPI_CFG_SRV_CMD_TOUT);
400 if (((flags & 0x80000000U) != 0U) ||
401 ((flags & ARM_SPI_EVENT_TRANSFER_COMPLETE) == 0U)) {
403 (void)drv->Control (ARM_SPI_ABORT_TRANSFER, 0U);
407 if (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW) {
408 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE) != ARM_DRIVER_OK) {
413 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
419 \fn static int32_t ComReceiveResponse (void *data_in, uint32_t num)
420 \brief Receive response from SPI Server.
421 \param[out] data_in Pointer to memory where data will be received
422 \param[in] len Number of data bytes to be received
423 \return execution status
424 - EXIT_SUCCESS: Command received successfully
425 - EXIT_FAILURE: Command reception failed
427 static int32_t ComReceiveResponse (void *data_in, uint32_t len) {
429 uint32_t flags, num, tout;
432 num = (len + DataBitsToBytes(SPI_CFG_SRV_DATA_BITS) - 1U) / DataBitsToBytes(SPI_CFG_SRV_DATA_BITS);
434 ret = ComConfigDefault();
436 if (ret == EXIT_SUCCESS) {
437 if (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW) {
438 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_ACTIVE) != ARM_DRIVER_OK) {
442 if (ret == EXIT_SUCCESS) {
443 (void)osEventFlagsClear(event_flags, 0x7FFFFFFFU);
444 if (drv->Receive(data_in, num) == ARM_DRIVER_OK) {
445 flags = osEventFlagsWait(event_flags, ARM_SPI_EVENT_TRANSFER_COMPLETE, osFlagsWaitAny, SPI_CFG_SRV_CMD_TOUT);
446 if (((flags & 0x80000000U) != 0U) ||
447 ((flags & ARM_SPI_EVENT_TRANSFER_COMPLETE) == 0U)) {
449 (void)drv->Control (ARM_SPI_ABORT_TRANSFER, 0U);
453 if (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW) {
454 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE) != ARM_DRIVER_OK) {
459 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
465 \fn static int32_t CmdGetVer (void)
466 \brief Get version from SPI Server and check that it is valid.
467 \return execution status
468 - EXIT_SUCCESS: Version retrieved successfully
469 - EXIT_FAILURE: Version retreival failed
471 static int32_t CmdGetVer (void) {
479 memset(&spi_serv_ver, 0, sizeof(spi_serv_ver));
481 // Send "GET VER" command to SPI Server
482 memset(ptr_tx_buf, 0, CMD_LEN);
483 memcpy(ptr_tx_buf, "GET VER", 7);
484 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
487 if (ret == EXIT_SUCCESS) {
488 // Receive response to "GET VER" command from SPI Server
489 memset(ptr_rx_buf, (int32_t)'?', RESP_GET_VER_LEN);
490 ret = ComReceiveResponse(ptr_rx_buf, RESP_GET_VER_LEN);
495 if (ret == EXIT_SUCCESS) {
497 ptr_str = (const char *)ptr_rx_buf;
498 if (sscanf(ptr_str, "%hhx", &val8) == 1) {
499 spi_serv_ver.major = val8;
504 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
506 ptr_str = strstr(ptr_str, "."); // Find '.'
507 if (ptr_str != NULL) {
508 ptr_str++; // Skip '.'
509 if (sscanf(ptr_str, "%hhx", &val8) == 1) {
510 spi_serv_ver.minor = val8;
518 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
519 // Parse patch (revision)
520 ptr_str = strstr(ptr_str, "."); // Find next '.'
521 if (ptr_str != NULL) {
522 ptr_str++; // Skip '.'
523 if (sscanf(ptr_str, "%hx", &val16) == 1) {
524 spi_serv_ver.patch = val16;
537 \fn static int32_t CmdGetCap (void)
538 \brief Get capabilities from SPI Server.
539 \return execution status
540 - EXIT_SUCCESS: Capabilities retrieved successfully
541 - EXIT_FAILURE: Capabilities retreival failed
543 static int32_t CmdGetCap (void) {
551 memset(&spi_serv_cap, 0, sizeof(spi_serv_cap));
553 // Send "GET CAP" command to SPI Server
554 memset(ptr_tx_buf, 0, CMD_LEN);
555 memcpy(ptr_tx_buf, "GET CAP", 7);
556 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
559 if (ret == EXIT_SUCCESS) {
560 (void)osDelay(20U); // Give SPI Server 20 ms to auto-detect capabilities
562 // Receive response to "GET CAP" command from SPI Server
563 memset(ptr_rx_buf, (int32_t)'?', RESP_GET_CAP_LEN);
564 ret = ComReceiveResponse(ptr_rx_buf, RESP_GET_CAP_LEN);
568 // Parse capabilities
569 if (ret == EXIT_SUCCESS) {
571 ptr_str = (const char *)ptr_rx_buf;
572 if (sscanf(ptr_str, "%hhx", &val8) == 1) {
573 spi_serv_cap.mode_mask = val8;
578 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
580 ptr_str = strstr(ptr_str, ","); // Find ','
581 if (ptr_str != NULL) {
582 ptr_str++; // Skip ','
583 if (sscanf(ptr_str, "%hhx", &val8) == 1) {
584 spi_serv_cap.fmt_mask = (uint32_t)val8;
592 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
593 // Parse data bit mask
594 ptr_str = strstr(ptr_str, ","); // Find next ','
595 if (ptr_str != NULL) {
596 ptr_str++; // Skip ','
597 if (sscanf(ptr_str, "%x", &val32) == 1) {
598 spi_serv_cap.db_mask = val32;
606 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
607 // Parse bit order mask
608 ptr_str = strstr(ptr_str, ","); // Find next ','
609 if (ptr_str != NULL) {
610 ptr_str++; // Skip ','
611 if (sscanf(ptr_str, "%hhx", &val8) == 1) {
612 spi_serv_cap.bo_mask = (uint32_t)val8;
620 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
621 // Parse minimum bus speed
622 ptr_str = strstr(ptr_str, ","); // Find next ','
623 if (ptr_str != NULL) {
624 ptr_str++; // Skip ','
625 if (sscanf(ptr_str, "%u", &val32) == 1) {
626 spi_serv_cap.bs_min = val32 * 1000U;
634 if ((ret == EXIT_SUCCESS) && (ptr_str != NULL)) {
635 // Parse maximum bus speed
636 ptr_str = strstr(ptr_str, ","); // Find next ','
637 if (ptr_str != NULL) {
638 ptr_str++; // Skip ','
639 if (sscanf(ptr_str, "%u", &val32) == 1) {
640 spi_serv_cap.bs_max = val32 * 1000U;
653 \fn static int32_t CmdSetBufTx (char pattern)
654 \brief Set Tx buffer of SPI Server to pattern.
655 \param[in] pattern Pattern to fill the buffer with
656 \return execution status
657 - EXIT_SUCCESS: Command sent successfully
658 - EXIT_FAILURE: Command send failed
660 static int32_t CmdSetBufTx (char pattern) {
663 // Send "SET BUF TX" command to SPI Server
664 memset(ptr_tx_buf, 0, 32);
665 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "SET BUF TX,0,%02X", (int32_t)pattern);
666 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
669 if (ret != EXIT_SUCCESS) {
670 TEST_FAIL_MESSAGE("[FAILED] Set Tx buffer on SPI Server. Check SPI Server! Test aborted!");
677 \fn static int32_t CmdSetBufRx (char pattern)
678 \brief Set Rx buffer of SPI Server to pattern.
679 \param[in] pattern Pattern to fill the buffer with
680 \return execution status
681 - EXIT_SUCCESS: Command sent successfully
682 - EXIT_FAILURE: Command send failed
684 static int32_t CmdSetBufRx (char pattern) {
687 // Send "SET BUF RX" command to SPI Server
688 memset(ptr_tx_buf, 0, 32);
689 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "SET BUF RX,0,%02X", (int32_t)pattern);
690 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
693 if (ret != EXIT_SUCCESS) {
694 TEST_FAIL_MESSAGE("[FAILED] Set Rx buffer on SPI Server. Check SPI Server! Test aborted!");
701 \fn static int32_t CmdGetBufRx (void)
702 \brief Get Rx buffer from SPI Server (into global array pointed to by ptr_rx_buf).
703 \param[in] len Number of bytes to read from Rx buffer
704 \return execution status
705 - EXIT_SUCCESS: Command sent and response received successfully
706 - EXIT_FAILURE: Command send or response reception failed
708 static int32_t CmdGetBufRx (uint32_t len) {
711 // Send "GET BUF RX" command to SPI Server
712 memset(ptr_tx_buf, 0, 32);
713 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "GET BUF RX,%i", len);
714 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
717 if (ret == EXIT_SUCCESS) {
718 // Receive response to "GET BUF RX" command from SPI Server
719 memset(ptr_rx_buf, (int32_t)'?', len);
720 ret = ComReceiveResponse(ptr_rx_buf, len);
724 if (ret != EXIT_SUCCESS) {
725 TEST_FAIL_MESSAGE("[FAILED] Get Rx buffer from SPI Server. Check SPI Server! Test aborted!");
732 \fn static int32_t CmdSetCom (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t ss_mode, uint32_t bus_speed)
733 \brief Set communication parameters on SPI Server for next XFER command.
734 \param[in] mode mode (0 = Master, 1 = slave)
735 \param[in] format clock / frame format:
736 - value 0 = clock polarity 0, phase 0
737 - value 1 = clock polarity 0, phase 1
738 - value 2 = clock polarity 1, phase 0
739 - value 3 = clock polarity 1, phase 1
740 - value 4 = Texas Instruments frame format
741 - value 5 = Microwire frame format
742 \param[in] data_bits data bits
744 \param[in] bit_order bit order
745 - value 0 = MSB to LSB
746 - value 1 = LSB to MSB
747 \param[in] ss_mode Slave Select mode:
749 - value 1 = used (in Master mode driven, in Slave mode monitored as hw input)
750 \param[in] bus_speed bus speed in bits per second (bps)
751 \return execution status
752 - EXIT_SUCCESS: Command sent successfully
753 - EXIT_FAILURE: Command send failed
755 static int32_t CmdSetCom (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t ss_mode, uint32_t bus_speed) {
758 // Send "SET COM" command to SPI Server
759 memset(ptr_tx_buf, 0, 32);
760 stat = snprintf((char *)ptr_tx_buf, CMD_LEN, "SET COM %i,%i,%i,%i,%i,%i", mode, format, data_bits, bit_order, ss_mode, bus_speed);
761 if ((stat > 0) && (stat < CMD_LEN)) {
762 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
768 if (ret != EXIT_SUCCESS) {
769 TEST_FAIL_MESSAGE("[FAILED] Set communication settings on SPI Server. Check SPI Server! Test aborted!");
776 \fn static int32_t CmdXfer (uint32_t num, uint32_t delay_c, uint32_t delay_t, uint32_t timeout)
777 \brief Activate transfer on SPI Server.
778 \param[in] num number of items (according CMSIS SPI driver specification)
779 \param[in] delay_c delay before control function is called, in milliseconds
780 (0xFFFFFFFF = delay not used)
781 \param[in] delay_t delay after control function is called but before transfer function is called, in milliseconds
782 (0xFFFFFFFF = delay not used)
783 \param[in] timeout timeout in milliseconds, after delay, if delay is specified
784 \return execution status
785 - EXIT_SUCCESS: Command sent successfully
786 - EXIT_FAILURE: Command send failed
788 static int32_t CmdXfer (uint32_t num, uint32_t delay_c, uint32_t delay_t, uint32_t timeout) {
791 // Send "XFER" command to SPI Server
792 memset(ptr_tx_buf, 0, 32);
793 if ((delay_c != osWaitForever) && (delay_t != osWaitForever) && (timeout != 0U)) {
794 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "XFER %i,%i,%i,%i", num, delay_c, delay_t, timeout);
795 } else if ((delay_c != osWaitForever) && (delay_t != osWaitForever)) {
796 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "XFER %i,%i,%i", num, delay_c, delay_t);
797 } else if (delay_c != osWaitForever) {
798 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "XFER %i,%i", num, delay_c);
800 (void)snprintf((char *)ptr_tx_buf, CMD_LEN, "XFER %i", num);
802 ret = ComSendCommand(ptr_tx_buf, CMD_LEN);
804 if (ret != EXIT_SUCCESS) {
805 TEST_FAIL_MESSAGE("[FAILED] Activate transfer on SPI Server. Check SPI Server! Test aborted!");
812 \fn static int32_t ServerInit (void)
813 \brief Initialize communication with SPI Server, get version and capabilities.
814 \return execution status
815 - EXIT_SUCCESS: SPI Server initialized successfully
816 - EXIT_FAILURE: SPI Server initialization failed
818 static int32_t ServerInit (void) {
820 if (server_ok == -1) { // If -1, means it was not yet checked
823 if (drv->Control(ARM_SPI_MODE_MASTER |
824 ((SPI_CFG_SRV_FORMAT << ARM_SPI_FRAME_FORMAT_Pos) & ARM_SPI_FRAME_FORMAT_Msk) |
825 ((SPI_CFG_SRV_DATA_BITS << ARM_SPI_DATA_BITS_Pos) & ARM_SPI_DATA_BITS_Msk) |
826 ((SPI_CFG_SRV_BIT_ORDER << ARM_SPI_BIT_ORDER_Pos) & ARM_SPI_BIT_ORDER_Msk) |
827 ((SPI_CFG_SRV_SS_MODE << ARM_SPI_SS_MASTER_MODE_Pos) & ARM_SPI_SS_MASTER_MODE_Msk) ,
828 SPI_CFG_SRV_BUS_SPEED) != ARM_DRIVER_OK) {
831 if ((server_ok == 1) && (SPI_CFG_SRV_SS_MODE == SS_MODE_MASTER_SW)) {
832 if (drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE) != ARM_DRIVER_OK) {
836 if (server_ok == 0) {
837 TEST_GROUP_INFO("Failed to configure communication interface to SPI Server default settings.\n"\
838 "Driver must support basic settings used for communication with SPI Server!");
841 if (server_ok == 1) {
843 if (CmdGetVer() != EXIT_SUCCESS) {
844 TEST_GROUP_INFO("Failed to Get version from SPI Server.\nCheck SPI Server!\n");
849 if (server_ok == 1) {
850 if ((spi_serv_ver.major <= 1U) && (spi_serv_ver.minor < 1U)) {
851 TEST_GROUP_INFO("SPI Server version must be 1.1.0. or higher.\nUpdate SPI Server to newer version!\n");
856 if (server_ok == 1) {
857 if (CmdGetCap() != EXIT_SUCCESS) {
858 TEST_GROUP_INFO("Failed to Get capabilities from SPI Server.\nCheck SPI Server!\n");
864 if (server_ok == 1) {
872 \fn static int32_t ServerCheck (void)
873 \brief Check if communication with SPI Server is working.
874 \return execution status
875 - EXIT_SUCCESS: If SPI Server status is ok
876 - EXIT_FAILURE: If SPI Server status is fail
878 static int32_t ServerCheck (void) {
880 if (server_ok == 1) {
884 TEST_FAIL_MESSAGE("[FAILED] SPI Server status. Check SPI Server! Test aborted!");
889 \fn static int32_t ServerCheckSupport (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t bus_speed)
890 \brief Check if SPI Server supports desired settings.
891 \param[in] mode mode (0 = Master, 1 = slave)
892 \param[in] format clock / frame format:
893 - value 0 = clock polarity 0, phase 0
894 - value 1 = clock polarity 0, phase 1
895 - value 2 = clock polarity 1, phase 0
896 - value 3 = clock polarity 1, phase 1
897 - value 4 = Texas Instruments frame format
898 - value 5 = Microwire frame format
899 \param[in] data_bits data bits
901 \param[in] bit_order bit order
902 - value 0 = MSB to LSB
903 - value 1 = LSB to MSB
904 \param[in] bus_speed bus speed in bits per second (bps)
905 \return execution status
906 - EXIT_SUCCESS: SPI Server supports desired settings
907 - EXIT_FAILURE: SPI Server does not support desired settings
909 static int32_t ServerCheckSupport (uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t bus_speed) {
911 if ((spi_serv_cap.mode_mask & (1UL << (mode - 1U))) == 0U) {
912 // If SPI Server does not support desired mode
913 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] SPI Server does not support %s mode! Test aborted!", str_mode[mode - 1U]);
914 TEST_MESSAGE(msg_buf);
917 if ((spi_serv_cap.fmt_mask & (1UL << format)) == 0U) {
918 // If SPI Server does not support desired clock / frame format
919 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] SPI Server does not support %s clock / frame format! Test aborted!", str_format[format]);
920 TEST_MESSAGE(msg_buf);
923 if ((spi_serv_cap.db_mask & (1UL << (data_bits - 1U))) == 0U) {
924 // If SPI Server does not support desired data bits
925 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] SPI Server does not support %i data bits! Test aborted!", data_bits);
926 TEST_MESSAGE(msg_buf);
929 if ((spi_serv_cap.bo_mask & (1UL << bit_order)) == 0U) {
930 // If SPI Server does not support desired bit order
931 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] SPI Server does not support %s bit order! Test aborted!", str_bit_order[bit_order]);
932 TEST_MESSAGE(msg_buf);
935 if ((spi_serv_cap.bs_min > bus_speed) ||
936 (spi_serv_cap.bs_max < bus_speed)) {
937 // If SPI Server does not support desired bus speed
938 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] SPI Server does not support %i bps bus speed! Test aborted!", bus_speed);
939 TEST_MESSAGE(msg_buf);
946 #endif // If Test Mode SPI Server is selected
949 \fn static int32_t IsNotLoopback (void)
950 \brief Check if loopback is not selected.
951 \detail This function is used to skip executing a test if it is not supported
953 \return execution status
954 - EXIT_SUCCESS: Loopback is not selected
955 - EXIT_FAILURE: Loopback is selected
957 static int32_t IsNotLoopback (void) {
959 #if (SPI_SERVER_USED == 1)
962 TEST_MESSAGE("[WARNING] Test not supported in Loopback Test Mode! Test not executed!");
968 \fn static int32_t IsNotFrameTI (void)
969 \brief Check if Default Clock / Frame Format selected is not Texas Instruments.
970 \detail This function is used to skip executing a test if it is not supported
971 for Texas Instruments Frame Format.
972 \return execution status
973 - EXIT_SUCCESS: Texas Instruments Frame Format is not selected
974 - EXIT_FAILURE: Texas Instruments Frame Format is selected
976 static int32_t IsNotFrameTI (void) {
978 #if (SPI_CFG_DEF_FORMAT != FORMAT_TI)
981 TEST_MESSAGE("[WARNING] Test not supported for Texas Instruments Frame Format! Test not executed!");
987 \fn static int32_t IsNotFrameMw (void)
988 \brief Check if Default Clock / Frame Format selected is not National Semiconductor Microwire.
989 \detail This function is used to skip executing a test if it is not supported
990 for National Semiconductor Microwire Frame Format.
991 \return execution status
992 - EXIT_SUCCESS: National Semiconductor Microwire Frame Format is not selected
993 - EXIT_FAILURE: National Semiconductor Microwire Frame Format is selected
995 static int32_t IsNotFrameMw (void) {
997 #if (SPI_CFG_DEF_FORMAT != FORMAT_MICROWIRE)
1000 TEST_MESSAGE("[WARNING] Test not supported for National Semiconductor Microwire Frame Format! Test not executed!");
1001 return EXIT_FAILURE;
1006 \fn static int32_t IsFormatValid (void)
1007 \brief Check if default format settings are valid.
1008 \detail This function is used to abort executing a test if Default settings
1009 specify TI or Microwire Frame Format and Slave Select handling
1010 other than Hardware controlled.
1011 \return execution status
1012 - EXIT_SUCCESS: Format is valid
1013 - EXIT_FAILURE: Format is not valid
1015 static int32_t IsFormatValid (void) {
1017 #if ((SPI_CFG_DEF_FORMAT == FORMAT_TI) && (SPI_CFG_DEF_SS_MODE != SS_MODE_MASTER_HW_OUTPUT))
1018 TEST_MESSAGE("[WARNING] TI Frame Format works only with Hardware controlled Slave Select! Test not executed!");
1019 return EXIT_FAILURE;
1020 #elif ((SPI_CFG_DEF_FORMAT == FORMAT_MICROWIRE) && (SPI_CFG_DEF_SS_MODE != SS_MODE_MASTER_HW_OUTPUT))
1021 TEST_MESSAGE("[WARNING] Microwire Frame Format works only with Hardware controlled Slave Select! Test not executed!");
1022 return EXIT_FAILURE;
1024 return EXIT_SUCCESS;
1029 \fn static int32_t IsBitOrderValid (void)
1030 \brief Check if default bit order settings valid.
1031 \detail This function is used to abort executing a test if Default settings
1032 specify TI or Microwire Frame Format and bit order is not MSB to LSB.
1033 \return execution status
1034 - EXIT_SUCCESS: bit order
1035 - EXIT_FAILURE: bit order
1037 static int32_t IsBitOrderValid (void) {
1039 #if ((SPI_CFG_DEF_FORMAT == FORMAT_TI) && (SPI_CFG_DEF_BIT_ORDER != BO_MSB_TO_LSB))
1040 TEST_MESSAGE("[WARNING] TI Frame Format works only with MSB to LSB bit order! Test not executed!");
1041 return EXIT_FAILURE;
1042 #elif ((SPI_CFG_DEF_FORMAT == FORMAT_MICROWIRE) && (SPI_CFG_DEF_BIT_ORDER != BO_MSB_TO_LSB))
1043 TEST_MESSAGE("[WARNING] Microwire Frame Format works only with MSB to LSB bit order! Test not executed!");
1044 return EXIT_FAILURE;
1046 return EXIT_SUCCESS;
1051 \fn void SPI_DV_Initialize (void)
1052 \brief Initialize testing environment for SPI testing.
1053 \detail This function is called by the driver validation framework before SPI testing begins.
1054 It initializes global variables and allocates memory buffers (from heap) used for the SPI testing.
1057 void SPI_DV_Initialize (void) {
1059 // Initialize global variables
1064 duration = 0xFFFFFFFFUL;
1065 systick_freq = osKernelGetSysTimerFreq();
1067 memset(&spi_serv_cap, 0, sizeof(spi_serv_cap));
1068 memset(&msg_buf, 0, sizeof(msg_buf));
1070 // Allocate buffers for transmission, reception and comparison
1071 // (maximum size is incremented by 4 bytes to ensure that buffer can be aligned to 4 bytes)
1073 ptr_tx_buf_alloc = malloc(SPI_BUF_MAX + 4U);
1074 if (((uint32_t)ptr_tx_buf_alloc & 3U) != 0U) {
1075 // If allocated memory is not 4 byte aligned, use next 4 byte aligned address for ptr_tx_buf
1076 ptr_tx_buf = (uint8_t *)((((uint32_t)ptr_tx_buf_alloc) + 3U) & (~3U));
1078 // If allocated memory is 4 byte aligned, use it directly
1079 ptr_tx_buf = (uint8_t *)ptr_tx_buf_alloc;
1081 ptr_rx_buf_alloc = malloc(SPI_BUF_MAX + 4U);
1082 if (((uint32_t)ptr_rx_buf_alloc & 3U) != 0U) {
1083 ptr_rx_buf = (uint8_t *)((((uint32_t)ptr_rx_buf_alloc) + 3U) & (~3U));
1085 ptr_rx_buf = (uint8_t *)ptr_rx_buf_alloc;
1087 ptr_cmp_buf_alloc = malloc(SPI_BUF_MAX + 4U);
1088 if (((uint32_t)ptr_cmp_buf_alloc & 3U) != 0U) {
1089 ptr_cmp_buf = (uint8_t *)((((uint32_t)ptr_cmp_buf_alloc) + 3U) & (~3U));
1091 ptr_cmp_buf = (uint8_t *)ptr_cmp_buf_alloc;
1094 event_flags = osEventFlagsNew(NULL);
1096 // Output configuration settings
1097 (void)snprintf(msg_buf,
1100 "Default settings:\n"\
1101 " - Slave Select: %s\n"\
1103 " - Data bits: %i\n"\
1104 " - Bit order: %s\n"\
1105 " - Bus speed: %i bps\n"\
1106 " - Number of Items: %i",
1107 str_test_mode[SPI_CFG_TEST_MODE],
1108 str_ss_mode [SPI_CFG_DEF_SS_MODE],
1109 str_format [SPI_CFG_DEF_FORMAT],
1110 SPI_CFG_DEF_DATA_BITS,
1111 str_bit_order[SPI_CFG_DEF_BIT_ORDER],
1112 SPI_CFG_DEF_BUS_SPEED,
1114 TEST_GROUP_INFO(msg_buf);
1116 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
1117 // Test communication with SPI Server
1118 int32_t server_status;
1121 // Test communication with SPI Server
1122 if (drv->Initialize (SPI_DrvEvent) == ARM_DRIVER_OK) {
1123 if (drv->PowerControl(ARM_POWER_FULL) == ARM_DRIVER_OK) {
1124 server_status = ServerInit();
1127 (void)drv->PowerControl(ARM_POWER_OFF);
1128 (void)drv->Uninitialize();
1130 //(void)snprintf(msg_buf, sizeof(msg_buf), "Server status: %s\n", str_srv_status[server_status]);
1131 //TEST_GROUP_INFO(msg_buf);
1136 \fn void SPI_DV_Uninitialize (void)
1137 \brief De-initialize testing environment after SPI testing.
1138 \detail This function is called by the driver validation framework after SPI testing is finished.
1139 It frees memory buffers used for the SPI testing.
1142 void SPI_DV_Uninitialize (void) {
1144 (void)osEventFlagsDelete(event_flags);
1146 if (ptr_tx_buf_alloc != NULL) {
1147 free(ptr_tx_buf_alloc);
1149 ptr_tx_buf_alloc = NULL;
1151 if (ptr_rx_buf_alloc != NULL) {
1152 free(ptr_rx_buf_alloc);
1154 ptr_rx_buf_alloc = NULL;
1156 if (ptr_cmp_buf_alloc != NULL) {
1157 free(ptr_cmp_buf_alloc);
1159 ptr_cmp_buf_alloc = NULL;
1163 #endif // End of exclude form the documentation
1165 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1167 \defgroup dv_spi SPI Validation
1168 \brief SPI driver validation
1170 The SPI validation performs the following tests:
1171 - API interface compliance
1172 - Data exchange with various speeds, transfer sizes and communication settings
1175 Two Test Modes are available: <b>Loopback</b> and <b>SPI Server</b>.
1177 Test Mode : <b>Loopback</b>
1178 ---------------------------
1180 This test mode allows only limited validation of the SPI Driver.<br>
1181 It is recommended that this test mode is used only as a proof that driver is
1182 good enough to be tested with the <b>SPI Server</b>.
1184 For this purpose following <b>Default settings</b> should be used:
1185 - Slave Select: Not used
1186 - Clock / Frame Format: Clock Polarity 0, Clock Phase 0
1188 - Bit Order: MSB to LSB
1189 - Bus Speed: same as setting for the SPI Server
1190 - Number of Items: 32
1192 To enable this mode of testing in the <b>DV_SPI_Config.h</b> configuration file select the
1193 <b>Configuration: Test Mode: Loopback</b> setting.
1195 Required pin connection for the <b>Loopback</b> test mode:
1197 \image html spi_loopback_pin_connections.png
1199 \note In this mode following operations / settings cannot be tested:
1201 - Slave Select line functionality
1202 - operation of the Receive function
1203 - data content sent by the Send function
1204 - clock / frame format and bit order settings
1205 - data bit settings other then: 8, 16, 24 and 32
1208 Test Mode : <b>SPI Server</b>
1209 -----------------------------
1211 This test mode allows extensive validation of the SPI Driver.<br>
1212 Results of the Driver Validation in this test mode are relevant as a proof of driver compliance
1213 to the CMSIS-Driver specification.
1215 To perform extensive communication tests, it is required to use an
1216 \ref spi_server "SPI Server" running on a dedicated hardware.
1218 To enable this mode of testing in the <b>DV_SPI_Config.h</b> configuration file select the
1219 <b>Configuration: Test Mode: SPI Server</b> setting.
1221 Required pin connections for the <b>SPI Server</b> test mode:
1223 \image html spi_server_pin_connections.png
1225 \note Slave Select line has to be pulled to Vcc by an external pull-up (for example 10 kOhm).
1226 \note To insure proper signal quality:
1227 - keep the connecting wires as short as possible
1228 - if possible have SCK and GND wires as a twisted pair and MISO, MOSI and Slave Select
1229 wires separate from each other
1230 - insure a good Ground (GND) connection between SPI Server and DUT
1231 \note If you experience issues with corrupt data content try reducing bus speed.
1234 \defgroup spi_tests Tests
1238 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1239 /* SPI Driver Management tests */
1240 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1242 \defgroup spi_tests_drv_mgmt Driver Management
1245 These tests verify API and operation of the SPI driver management functions.
1247 The driver management tests verify the following driver functions
1248 (<a href="http://www.keil.com/pack/doc/CMSIS/Driver/html/group__spi__interface__gr.html" target="_blank">SPI Driver function documentation</a>):
1251 ARM_DRIVER_VERSION GetVersion (void);
1253 - \b GetCapabilities
1255 ARM_SPI_CAPABILITIES GetCapabilities (void);
1259 int32_t Initialize (ARM_SPI_SignalEvent_t cb_event);
1263 int32_t Uninitialize (void);
1267 int32_t PowerControl (ARM_POWER_STATE state);
1273 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1275 \brief Function: Function SPI_GetVersion
1277 The function \b SPI_GetVersion verifies the \b GetVersion function.
1279 ARM_DRIVER_VERSION GetVersion (void);
1283 - Driver is uninitialized and peripheral is powered-off:
1284 - Call GetVersion function
1285 - Assert that GetVersion function returned version structure with API and implementation versions higher or equal to 1.0
1287 void SPI_GetVersion (void) {
1288 ARM_DRIVER_VERSION ver;
1290 ver = drv->GetVersion();
1292 // Assert that GetVersion function returned version structure with API and implementation versions higher or equal to 1.0
1293 TEST_ASSERT((ver.api >= ARM_DRIVER_VERSION_MAJOR_MINOR(1UL,0UL)) && (ver.drv >= ARM_DRIVER_VERSION_MAJOR_MINOR(1UL,0UL)));
1295 (void)snprintf(msg_buf, sizeof(msg_buf), "[INFO] Driver API version %d.%d, Driver version %d.%d", (ver.api >> 8), (ver.api & 0xFFU), (ver.drv >> 8), (ver.drv & 0xFFU));
1296 TEST_MESSAGE(msg_buf);
1299 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1301 \brief Function: Function SPI_GetCapabilities
1303 The function \b SPI_GetCapabilities verifies the \b GetCapabilities function.
1305 ARM_SPI_CAPABILITIES GetCapabilities (void);
1309 - Driver is uninitialized and peripheral is powered-off:
1310 - Call GetCapabilities function
1311 - Assert that GetCapabilities function returned capabilities structure with reserved field 0
1313 void SPI_GetCapabilities (void) {
1314 ARM_SPI_CAPABILITIES cap;
1316 cap = drv->GetCapabilities();
1318 // Assert that GetCapabilities function returned capabilities structure with reserved field 0
1319 TEST_ASSERT_MESSAGE((cap.reserved == 0U), "[FAILED] Capabilities reserved field must be 0");
1322 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1324 \brief Function: Function SPI_Initialize_Uninitialize
1326 The function \b SPI_Initialize_Uninitialize verifies the \b Initialize and \b Uninitialize functions.
1328 int32_t Initialize (ARM_SPI_SignalEvent_t cb_event);
1331 int32_t Uninitialize (void);
1335 - Driver is uninitialized and peripheral is powered-off:
1336 - Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_ERROR status
1337 - Call PowerControl(ARM_POWER_LOW) function and assert that it returned ARM_DRIVER_ERROR status
1338 - Call PowerControl(ARM_POWER_OFF) function and assert that it returned ARM_DRIVER_ERROR status
1339 - Call Send function and assert that it returned ARM_DRIVER_ERROR status
1340 - Call Receive function and assert that it returned ARM_DRIVER_ERROR status
1341 - Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
1342 - Call GetDataCount function and assert that it returned 0
1343 - Call Control function and assert that it returned ARM_DRIVER_ERROR status
1344 - Call GetStatus function
1345 - Assert that GetStatus function returned status structure with busy flag 0
1346 - Assert that GetStatus function returned status structure with data_lost flag 0
1347 - Assert that GetStatus function returned status structure with mode_fault flag 0
1348 - Assert that GetStatus function returned status structure with reserved field 0
1349 - Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
1350 - Driver is initialized and peripheral is powered-off:
1351 - Call Initialize function (without callback specified) again and assert that it returned ARM_DRIVER_OK status
1352 - Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
1353 - Driver is uninitialized and peripheral is powered-off:
1354 - Call Initialize function (with callback specified) and assert that it returned ARM_DRIVER_OK status
1355 - Driver is initialized and peripheral is powered-off:
1356 - Call Initialize function (with callback specified) again and assert that it returned ARM_DRIVER_OK status
1357 - Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
1358 - Driver is uninitialized and peripheral is powered-off:
1359 - Call Uninitialize function again and assert that it returned ARM_DRIVER_OK status
1360 - Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
1361 - Driver is initialized and peripheral is powered-off:
1362 - Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1363 - Driver is initialized and peripheral is powered-on:
1364 - Call Control function and assert that it returned ARM_DRIVER_OK status
1365 - Call Transfer function and assert that it returned ARM_DRIVER_OK status
1366 - Call GetStatus function
1367 - Assert that GetStatus function returned status structure with busy flag 1
1368 - Call Uninitialize function with transfer active and assert that it returned ARM_DRIVER_OK status<br>
1369 (this must unconditionally terminate active transfer, power-off the peripheral and uninitialize the driver)
1370 - Driver is uninitialized and peripheral is powered-off:
1371 - Call GetStatus function
1372 - Assert that GetStatus function returned status structure with busy flag 0
1374 void SPI_Initialize_Uninitialize (void) {
1375 ARM_SPI_STATUS stat;
1377 // Driver is uninitialized and peripheral is powered-off:
1378 // Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_ERROR status
1379 TEST_ASSERT(drv->PowerControl (ARM_POWER_FULL) == ARM_DRIVER_ERROR);
1381 // Call PowerControl(ARM_POWER_LOW) function and assert that it returned ARM_DRIVER_ERROR status
1382 TEST_ASSERT(drv->PowerControl (ARM_POWER_LOW) == ARM_DRIVER_ERROR);
1384 // Call PowerControl(ARM_POWER_OFF) function and assert that it returned ARM_DRIVER_ERROR status
1385 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_ERROR);
1387 // Call Send function and assert that it returned ARM_DRIVER_ERROR status
1388 TEST_ASSERT(drv->Send (ptr_tx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1390 // Call Receive function and assert that it returned ARM_DRIVER_ERROR status
1391 TEST_ASSERT(drv->Receive (ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1393 // Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
1394 TEST_ASSERT(drv->Transfer (ptr_tx_buf, ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1396 // Call GetDataCount function and assert that it returned 0
1397 TEST_ASSERT(drv->GetDataCount () == 0U);
1399 // Call Control function and assert that it returned ARM_DRIVER_ERROR status
1400 TEST_ASSERT(drv->Control (ARM_SPI_MODE_MASTER | ARM_SPI_DATA_BITS(SPI_CFG_DEF_DATA_BITS), SPI_CFG_DEF_BUS_SPEED) == ARM_DRIVER_ERROR);
1402 // Call GetStatus function
1403 stat = drv->GetStatus();
1405 // Assert that GetStatus function returned status structure with busy flag 0
1406 TEST_ASSERT(stat.busy == 0U);
1408 // Assert that GetStatus function returned status structure with data_lost flag 0
1409 TEST_ASSERT(stat.data_lost == 0U);
1411 // Assert that GetStatus function returned status structure with mode_fault flag 0
1412 TEST_ASSERT(stat.mode_fault == 0U);
1414 // Assert that GetStatus function returned status structure with reserved field 0
1415 TEST_ASSERT(stat.reserved == 0U);
1417 // Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
1418 TEST_ASSERT(drv->Initialize (NULL) == ARM_DRIVER_OK);
1420 // Driver is initialized and peripheral is powered-off:
1421 // Call Initialize function (without callback specified) again and assert that it returned ARM_DRIVER_OK status
1422 TEST_ASSERT(drv->Initialize (NULL) == ARM_DRIVER_OK);
1424 // Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
1425 TEST_ASSERT(drv->Uninitialize () == ARM_DRIVER_OK);
1427 // Driver is uninitialized and peripheral is powered-off:
1428 // Call Initialize function (with callback specified) and assert that it returned ARM_DRIVER_OK status
1429 TEST_ASSERT(drv->Initialize (SPI_DrvEvent) == ARM_DRIVER_OK);
1431 // Driver is initialized and peripheral is powered-off:
1432 // Call Initialize function (with callback specified) again and assert that it returned ARM_DRIVER_OK status
1433 TEST_ASSERT(drv->Initialize (SPI_DrvEvent) == ARM_DRIVER_OK);
1435 // Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
1436 TEST_ASSERT(drv->Uninitialize () == ARM_DRIVER_OK);
1438 // Driver is uninitialized and peripheral is powered-off:
1439 // Call Uninitialize function again and assert that it returned ARM_DRIVER_OK status
1440 TEST_ASSERT(drv->Uninitialize () == ARM_DRIVER_OK);
1442 // Call Initialize function (without callback specified) and assert that it returned ARM_DRIVER_OK status
1443 TEST_ASSERT(drv->Initialize (NULL) == ARM_DRIVER_OK);
1445 // Driver is initialized and peripheral is powered-off:
1446 // Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1447 TEST_ASSERT(drv->PowerControl (ARM_POWER_FULL) == ARM_DRIVER_OK);
1449 // Driver is initialized and peripheral is powered-on:
1450 // Call Control function and assert that it returned ARM_DRIVER_OK status
1451 TEST_ASSERT(drv->Control (ARM_SPI_MODE_MASTER | ARM_SPI_DATA_BITS(SPI_CFG_DEF_DATA_BITS), SPI_CFG_DEF_BUS_SPEED) == ARM_DRIVER_OK);
1453 // Call Transfer function and assert that it returned ARM_DRIVER_OK status
1454 TEST_ASSERT(drv->Transfer (ptr_tx_buf, ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_OK);
1456 // Call GetStatus function
1457 stat = drv->GetStatus();
1459 // Assert that GetStatus function returned status structure with busy flag 1
1460 TEST_ASSERT(stat.busy == 1U);
1462 // Call Uninitialize function and assert that it returned ARM_DRIVER_OK status
1463 // (this must unconditionally terminate active transfer, power-off the peripheral and uninitialize the driver)
1464 TEST_ASSERT(drv->Uninitialize () == ARM_DRIVER_OK);
1466 // Driver is uninitialized and peripheral is powered-off:
1467 // Call GetStatus function
1468 stat = drv->GetStatus();
1470 // Assert that GetStatus function returned status structure with busy flag 0
1471 TEST_ASSERT(stat.busy == 0U);
1473 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
1474 // Ensure that SPI Server (if used) is ready for command reception
1479 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1481 \brief Function: Function SPI_PowerControl
1483 The function \b SPI_PowerControl verifies the \b PowerControl function.
1485 int32_t PowerControl (ARM_POWER_STATE state);
1489 - Driver is initialized and peripheral is powered-off:
1490 - Call Send function and assert that it returned ARM_DRIVER_ERROR status
1491 - Call Receive function and assert that it returned ARM_DRIVER_ERROR status
1492 - Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
1493 - Call GetDataCount function and assert that it returned 0
1494 - Call Control function and assert that it returned ARM_DRIVER_ERROR status
1495 - Call GetStatus function
1496 - Assert that GetStatus function returned status structure with busy flag 0
1497 - Assert that GetStatus function returned status structure with data_lost flag 0
1498 - Assert that GetStatus function returned status structure with mode_fault flag 0
1499 - Assert that GetStatus function returned status structure with reserved field 0
1500 - Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
1501 - Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
1502 - Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1503 - Driver is initialized and peripheral is powered-on:
1504 - Call PowerControl(ARM_POWER_FULL) function again and assert that it returned ARM_DRIVER_OK status
1505 - Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
1506 - Driver is initialized and peripheral is powered-off:
1507 - Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
1508 - Call PowerControl(ARM_POWER_LOW) function
1509 - Driver is initialized and peripheral is powered-on or in low-power mode:
1510 - Assert that PowerControl(ARM_POWER_LOW) function returned ARM_DRIVER_OK or ARM_DRIVER_ERROR_UNSUPPORTED status
1511 - Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1512 - Driver is initialized and peripheral is powered-on:
1513 - Call Control function and assert that it returned ARM_DRIVER_OK status
1514 - Call Transfer function and assert that it returned ARM_DRIVER_OK status
1515 - Call GetStatus function
1516 - Assert that GetStatus function returned status structure with busy flag 1
1517 - Call PowerControl(ARM_POWER_OFF) function with transfer active and assert that it returned ARM_DRIVER_OK status<br>
1518 (this must unconditionally terminate active transfer and power-off the peripheral)
1519 - Driver is initialized and peripheral is powered-off:
1520 - Call GetStatus function
1521 - Assert that GetStatus function returned status structure with busy flag 0
1523 void SPI_PowerControl (void) {
1525 ARM_SPI_STATUS stat;
1527 (void)drv->Initialize (NULL);
1529 // Driver is initialized and peripheral is powered-off:
1530 // Call Send function and assert that it returned ARM_DRIVER_ERROR status
1531 TEST_ASSERT(drv->Send (ptr_tx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1533 // Call Receive function and assert that it returned ARM_DRIVER_ERROR status
1534 TEST_ASSERT(drv->Receive (ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1536 // Call Transfer function and assert that it returned ARM_DRIVER_ERROR status
1537 TEST_ASSERT(drv->Transfer (ptr_tx_buf, ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_ERROR);
1539 // Call GetDataCount function and assert that it returned 0
1540 TEST_ASSERT(drv->GetDataCount () == 0U);
1542 // Call Control function and assert that it returned ARM_DRIVER_ERROR status
1543 TEST_ASSERT(drv->Control (ARM_SPI_MODE_MASTER | ARM_SPI_DATA_BITS(SPI_CFG_DEF_DATA_BITS), SPI_CFG_DEF_BUS_SPEED) == ARM_DRIVER_ERROR);
1545 // Call GetStatus function
1546 stat = drv->GetStatus();
1548 // Assert that GetStatus function returned status structure with busy flag 0
1549 TEST_ASSERT(stat.busy == 0U);
1551 // Assert that GetStatus function returned status structure with data_lost flag 0
1552 TEST_ASSERT(stat.data_lost == 0U);
1554 // Assert that GetStatus function returned status structure with mode_fault flag 0
1555 TEST_ASSERT(stat.mode_fault == 0U);
1557 // Assert that GetStatus function returned status structure with reserved field 0
1558 TEST_ASSERT(stat.reserved == 0U);
1560 // Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
1561 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_OK);
1563 // Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
1564 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_OK);
1566 // Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1567 TEST_ASSERT(drv->PowerControl (ARM_POWER_FULL) == ARM_DRIVER_OK);
1569 // Driver is initialized and peripheral is powered-on:
1570 // Call PowerControl(ARM_POWER_FULL) function again and assert that it returned ARM_DRIVER_OK status
1571 TEST_ASSERT(drv->PowerControl (ARM_POWER_FULL) == ARM_DRIVER_OK);
1573 // Call PowerControl(ARM_POWER_OFF) and assert that it returned ARM_DRIVER_OK status
1574 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_OK);
1576 // Driver is initialized and peripheral is powered-off:
1577 // Call PowerControl(ARM_POWER_OFF) again and assert that it returned ARM_DRIVER_OK status
1578 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_OK);
1580 // Call PowerControl(ARM_POWER_LOW) function
1581 ret = drv->PowerControl (ARM_POWER_LOW);
1583 // Driver is initialized and peripheral is powered-on or in low-power mode:
1584 // Assert that PowerControl(ARM_POWER_LOW) function returned ARM_DRIVER_OK or ARM_DRIVER_ERROR_UNSUPPORTED status
1585 TEST_ASSERT((ret == ARM_DRIVER_OK) || (ret == ARM_DRIVER_ERROR_UNSUPPORTED));
1586 if (ret == ARM_DRIVER_ERROR_UNSUPPORTED) {
1587 TEST_MESSAGE("[WARNING] PowerControl (ARM_POWER_LOW) is not supported");
1590 // Call PowerControl(ARM_POWER_FULL) function and assert that it returned ARM_DRIVER_OK status
1591 TEST_ASSERT(drv->PowerControl (ARM_POWER_FULL) == ARM_DRIVER_OK);
1593 // Driver is initialized and peripheral is powered-on:
1594 // Call Control function and assert that it returned ARM_DRIVER_OK status
1595 TEST_ASSERT(drv->Control (ARM_SPI_MODE_MASTER | ARM_SPI_DATA_BITS(SPI_CFG_DEF_DATA_BITS), SPI_CFG_DEF_BUS_SPEED) == ARM_DRIVER_OK);
1597 // Call Transfer function and assert that it returned ARM_DRIVER_OK status
1598 TEST_ASSERT(drv->Transfer (ptr_tx_buf, ptr_rx_buf, SPI_CFG_DEF_NUM) == ARM_DRIVER_OK);
1600 // Call GetStatus function
1601 stat = drv->GetStatus();
1603 // Assert that GetStatus function returned status structure with busy flag 1
1604 TEST_ASSERT(stat.busy == 1U);
1606 // Call PowerControl(ARM_POWER_OFF) function with transfer active and assert that it returned ARM_DRIVER_OK status
1607 // (this must unconditionally terminate active transfer and power-off the peripheral)
1608 TEST_ASSERT(drv->PowerControl (ARM_POWER_OFF) == ARM_DRIVER_OK);
1610 // Driver is initialized and peripheral is powered-off:
1611 // Call GetStatus function
1612 stat = drv->GetStatus();
1614 // Assert that GetStatus function returned status structure with busy flag 0
1615 TEST_ASSERT(stat.busy == 0U);
1617 (void)drv->Uninitialize ();
1619 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
1620 // Ensure that SPI Server (if used) is ready for command reception
1628 // End of spi_tests_drv_mgmt
1630 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1631 /* SPI Data Exchange tests */
1632 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
1634 \defgroup spi_tests_data_xchg Data Exchange
1637 These tests verify API and operation of the SPI data exchange functions.
1639 The data exchange tests verify the following driver functions
1640 (<a href="http://www.keil.com/pack/doc/CMSIS/Driver/html/group__spi__interface__gr.html" target="_blank">SPI Driver function documentation</a>):
1643 int32_t Send (const void *data, uint32_t num);
1647 int32_t Receive ( void *data, uint32_t num);
1651 int32_t Transfer (const void *data_out, void *data_in, uint32_t num);
1655 uint32_t GetDataCount (void);
1659 int32_t Control (uint32_t control, uint32_t arg);
1663 ARM_SPI_STATUS GetStatus (void);
1667 void (*ARM_SPI_SignalEvent_t) (uint32_t event);
1670 All of these tests execute a data exchange and check the result of this data exchange.
1672 Data exchange test procedure when Test Mode <b>SPI Server</b> is selected:
1673 - send command "SET BUF TX,.." to the SPI Server: Set Tx buffer
1674 - send command "SET BUF RX,.." to the SPI Server: Set Rx buffer
1675 - send command "SET COM .." to the SPI Server: Set communication settings for the next XFER command
1676 - send command "XFER .." to the SPI Server: Specify transfer
1677 - driver Control: Configure the SPI interface
1678 - driver Control: Set the default Tx value
1679 - driver Send/Receive/Transfer: Start the requested operation
1680 - driver GetStatus/SignalEvent: Wait for the current operation to finish or time-out<br>
1681 (operation is finished when busy flag is 0 and completed event was signaled)
1682 - assert that operation has finished in expected time
1683 - assert that ARM_SPI_EVENT_TRANSFER_COMPLETE event was signaled
1684 - driver GetStatus: Assert that busy flag is 0
1685 - driver GetDataCount: Assert that number of transferred items is same as requested
1686 - if operation has timed out call driver Control function to Abort operation and wait timeout time<br>
1687 to make sure that the SPI Server is ready for the next command
1688 - assert that received content is as expected
1689 - send command "GET BUF RX,.." to the SPI Server: Get Rx buffer
1690 - assert that sent content (read from the SPI Server's receive buffer) is as expected
1692 Data exchange <b>Abort</b> test procedure when Test Mode <b>SPI Server</b> is selected:
1693 - send command "SET BUF TX,.." to the SPI Server: Set Tx buffer
1694 - send command "SET BUF RX,.." to the SPI Server: Set Rx buffer
1695 - send command "SET COM .." to the SPI Server: Set communication settings for the next XFER command
1696 - send command "XFER .." to the SPI Server: Specify transfer
1697 - driver Control: Configure the SPI interface
1698 - driver Control: Set the default Tx value
1699 - driver Send/Receive/Transfer: Start the requested operation
1701 - driver Control: Abort the current operation
1702 - driver GetStatus: Assert that busy flag is 0
1703 - driver GetDataCount: Assert that number of transferred items is less than requested
1705 Data exchange test procedure when Test Mode <b>Loopback</b> is selected:
1706 - driver Control: Configure the SPI interface
1707 - driver Control: Set the default Tx value
1708 - driver Send/Transfer: Start the requested operation
1709 - driver GetStatus/SignalEvent: Wait for the current operation to finish or time-out<br>
1710 (operation is finished when busy flag is 0 and completed event was signaled)
1711 - assert that operation has finished in expected time
1712 - assert that ARM_SPI_EVENT_TRANSFER_COMPLETE event was signaled
1713 - driver GetStatus: Assert that busy flag is 0
1714 - driver GetDataCount: Assert that number of transferred items is same as requested
1715 - if operation has timed out call driver Control function to Abort operation
1716 - assert that received content is as expected (for Transfer operation only)
1718 \note Limitations of Data Exchange tests if Test Mode <b>Loopback</b> is selected:
1719 - only Master mode with Slave Select not used can be tested
1720 - Receive function cannot be tested
1721 - format tests are not supported
1722 - only 8, 16, 24 and 32 data bit tests are supported
1723 - bit order tests are not supported
1727 #ifndef __DOXYGEN__ // Exclude form the documentation
1729 \brief Execute SPI data exchange or abort operation.
1730 \param[in] operation operation (OP_SEND.. OP_ABORT_TRANSFER)
1731 \param[in] mode mode (MODE_MASTER or MODE_SLAVE)
1732 \param[in] format clock/frame format (0 = polarity0/phase0 .. 5 = Microwire)
1733 \param[in] data_bits data bits (1 .. 32)
1734 \param[in] bit_order bit order (BO_MSB_TO_LSB or BO_LSB_TO_MSB)
1735 \param[in] ss_mode Slave Select mode (SS_MODE_xxx)
1736 \param[in] bus_speed bus speed in bits per second (bps)
1737 \param[in] num number of items to send, receive or transfer
1740 static void SPI_DataExchange_Operation (uint32_t operation, uint32_t mode, uint32_t format, uint32_t data_bits, uint32_t bit_order, uint32_t ss_mode, uint32_t bus_speed, uint32_t num) {
1741 // volatile specifier is used to prevent compiler from optimizing variables
1742 // in a way that they cannot be seen with a debugger
1743 volatile int32_t stat, def_tx_stat;
1744 volatile uint32_t drv_mode, drv_format, drv_data_bits, drv_bit_order, drv_ss_mode;
1745 volatile uint32_t srv_mode, srv_ss_mode;
1746 volatile ARM_SPI_STATUS spi_stat;
1747 volatile uint32_t data_count;
1750 volatile uint32_t srv_delay_c, srv_delay_t;
1751 volatile uint32_t drv_delay_c, drv_delay_t;
1752 uint32_t timeout, start_tick, curr_tick;
1755 // Prepare parameters for SPI Server and Driver configuration
1758 TEST_FAIL_MESSAGE("[FAILED] Inactive mode! Data exchange operation aborted!");
1761 // When Master mode is tested, time diagram is as follows:
1764 // Slave Control (SPI Server) .
1766 // Master Control (SPI Client (DUT)) .
1767 // ... 4 ms SPI_CFG_XFER_TIMEOUT
1768 // Slave Transfer (SPI Server) .
1770 // Master Send/Receive/Transfer (SPI Client (DUT)) .
1771 // ... data exchange _|_
1772 drv_mode = ARM_SPI_MODE_MASTER;
1780 // When Slave mode is tested, time diagram is as follows:
1783 // Slave Control (SPI Client (DUT)) .
1785 // Master Control (SPI Server) .
1786 // ... 4 ms SPI_CFG_XFER_TIMEOUT
1787 // Slave Transfer (SPI Client (DUT)) .
1789 // Master Send/Receive/Transfer (SPI Server) .
1790 // ... data exchange _|_
1791 drv_mode = ARM_SPI_MODE_SLAVE;
1799 TEST_FAIL_MESSAGE("[FAILED] Unknown mode! Data exchange operation aborted!");
1803 // Total transfer timeout (16 ms is overhead before transfer starts)
1804 timeout = SPI_CFG_XFER_TIMEOUT + 16U;
1807 case FORMAT_CPOL0_CPHA0:
1808 drv_format = ARM_SPI_CPOL0_CPHA0;
1810 case FORMAT_CPOL0_CPHA1:
1811 drv_format = ARM_SPI_CPOL0_CPHA1;
1813 case FORMAT_CPOL1_CPHA0:
1814 drv_format = ARM_SPI_CPOL1_CPHA0;
1816 case FORMAT_CPOL1_CPHA1:
1817 drv_format = ARM_SPI_CPOL1_CPHA1;
1820 drv_format = ARM_SPI_TI_SSI;
1822 case FORMAT_MICROWIRE:
1823 drv_format = ARM_SPI_MICROWIRE;
1826 TEST_FAIL_MESSAGE("[FAILED] Unknown clock / frame format! Data exchange operation aborted!");
1830 if ((data_bits > 0U) && (data_bits <= 32U)) {
1831 drv_data_bits = ARM_SPI_DATA_BITS(data_bits);
1833 TEST_FAIL_MESSAGE("[FAILED] Data bits not in range 1 to 32! Data exchange operation aborted!");
1837 switch (bit_order) {
1839 drv_bit_order = ARM_SPI_MSB_LSB;
1842 drv_bit_order = ARM_SPI_LSB_MSB;
1845 TEST_FAIL_MESSAGE("[FAILED] Unknown bit order! Data exchange operation aborted!");
1849 if (mode == MODE_MASTER) {
1851 case SS_MODE_MASTER_UNUSED:
1852 drv_ss_mode = ARM_SPI_SS_MASTER_UNUSED;
1855 case SS_MODE_MASTER_SW:
1856 drv_ss_mode = ARM_SPI_SS_MASTER_SW;
1859 case SS_MODE_MASTER_HW_OUTPUT:
1860 drv_ss_mode = ARM_SPI_SS_MASTER_HW_OUTPUT;
1863 case SS_MODE_MASTER_HW_INPUT:
1864 drv_ss_mode = ARM_SPI_SS_MASTER_UNUSED;
1868 TEST_FAIL_MESSAGE("[FAILED] Unknown Slave Select mode! Data exchange operation aborted!");
1873 case SS_MODE_SLAVE_HW:
1874 drv_ss_mode = ARM_SPI_SS_SLAVE_HW;
1877 case SS_MODE_SLAVE_SW:
1878 drv_ss_mode = ARM_SPI_SS_SLAVE_SW;
1882 TEST_FAIL_MESSAGE("[FAILED] Unknown Slave Select mode! Data exchange operation aborted!");
1887 // Check that SPI status is not busy before starting data exchange test
1888 spi_stat = drv->GetStatus(); // Get SPI status
1889 if (spi_stat.busy != 0U) {
1890 // If busy flag is still active
1891 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "Busy active before operation! Data exchange operation aborted!");
1893 TEST_ASSERT_MESSAGE(spi_stat.busy == 0U, msg_buf);
1896 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
1897 if (CmdSetBufTx('S') != EXIT_SUCCESS) { break; }
1898 if (CmdSetBufRx('?') != EXIT_SUCCESS) { break; }
1899 if (CmdSetCom (srv_mode, format, data_bits, bit_order, srv_ss_mode, bus_speed) != EXIT_SUCCESS) { break; }
1900 if (CmdXfer (num, srv_delay_c, srv_delay_t, SPI_CFG_XFER_TIMEOUT) != EXIT_SUCCESS) { break; }
1901 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
1902 #else // If Test Mode Loopback is selected
1903 // Remove warnings for unused variables
1911 start_tick = osKernelGetTickCount();
1913 // Initialize buffers
1914 memset(ptr_tx_buf, (int32_t)'!' , SPI_BUF_MAX);
1915 memset(ptr_tx_buf, (int32_t)'T' , num * DataBitsToBytes(data_bits));
1916 memset(ptr_rx_buf, (int32_t)'?' , SPI_BUF_MAX);
1917 memset(ptr_cmp_buf, (int32_t)'?' , SPI_BUF_MAX);
1919 // Configure required communication settings
1920 (void)osDelay(drv_delay_c); // Wait specified time before calling Control function
1921 if (mode == MODE_MASTER) {
1922 stat = drv->Control (drv_mode | drv_format | drv_data_bits | drv_bit_order | drv_ss_mode, bus_speed);
1924 // For Slave mode bus speed argument is not used
1925 stat = drv->Control (drv_mode | drv_format | drv_data_bits | drv_bit_order | drv_ss_mode, 0U);
1927 if (stat != ARM_DRIVER_OK) {
1928 // If configuration has failed
1929 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s! Data exchange operation aborted!", str_oper[operation], "Control function returned", str_ret[-stat]);
1931 // Assert that Control function returned ARM_DRIVER_OK
1932 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
1934 // Set default Tx value to 'D' byte values (only for master mode)
1935 if (mode == MODE_MASTER) {
1936 val = ((uint32_t)'D' << 24) | ((uint32_t)'D' << 16) | ((uint32_t)'D' << 8) | (uint32_t)'D';
1937 stat = drv->Control (ARM_SPI_SET_DEFAULT_TX_VALUE, val);
1939 if ((stat != ARM_DRIVER_OK) && (stat != ARM_DRIVER_ERROR_UNSUPPORTED)) {
1940 // If set default Tx value has failed
1941 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s", str_oper[operation], "Set default Tx value returned", str_ret[-stat]);
1943 // Assert that Control function returned ARM_DRIVER_OK or ARM_DRIVER_ERROR_UNSUPPORTED
1944 TEST_ASSERT_MESSAGE((stat == ARM_DRIVER_OK) || (stat == ARM_DRIVER_ERROR_UNSUPPORTED), msg_buf);
1946 if (stat == ARM_DRIVER_ERROR_UNSUPPORTED) {
1947 // If set default Tx value is not supported
1948 (void)snprintf(msg_buf, sizeof(msg_buf), "[WARNING] %s: %s", str_oper[operation], "Set default Tx value is not supported");
1949 TEST_MESSAGE(msg_buf);
1952 // For slave mode default Tx is not tested
1953 def_tx_stat = ARM_DRIVER_ERROR_UNSUPPORTED;
1955 (void)osDelay(drv_delay_t); // Wait specified time before calling Send/Receive/Transfer function
1957 // Prepare local variables
1959 duration = 0xFFFFFFFFUL;
1961 data_count_sample = 0U;
1963 start_cnt = osKernelGetSysTimerCount();
1965 if (((mode == MODE_MASTER) && (ss_mode == SS_MODE_MASTER_SW)) ||
1966 ((mode == MODE_SLAVE) && (ss_mode == SS_MODE_SLAVE_SW))) {
1967 // If operation requires software Slave Select driving, activate Slave Select
1968 stat = drv->Control (ARM_SPI_CONTROL_SS, ARM_SPI_SS_ACTIVE);
1969 if (stat != ARM_DRIVER_OK) {
1970 // If driving of Slave Select to active state has failed
1971 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s", str_oper[operation], "Control function returned", str_ret[-stat]);
1973 // Assert that Control function returned ARM_DRIVER_OK
1974 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
1977 // Start the data exchange operation
1978 switch (operation & 0x0FU) {
1981 stat = drv->Send(ptr_tx_buf, num);
1982 if (stat != ARM_DRIVER_OK) {
1983 // If Send activation has failed
1984 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s! Data exchange operation aborted!", str_oper[operation], "Send function returned", str_ret[-stat]);
1986 // Assert that Send function returned ARM_DRIVER_OK
1987 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
1990 case OP_ABORT_RECEIVE:
1991 stat = drv->Receive(ptr_rx_buf, num);
1992 if (stat != ARM_DRIVER_OK) {
1993 // If Receive activation has failed
1994 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s! Data exchange operation aborted!", str_oper[operation], "Receive function returned", str_ret[-stat]);
1996 // Assert that Receive function returned ARM_DRIVER_OK
1997 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
2000 case OP_ABORT_TRANSFER:
2001 stat = drv->Transfer(ptr_tx_buf, ptr_rx_buf, num);
2002 if (stat != ARM_DRIVER_OK) {
2003 // If Transfer activation has failed
2004 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s! Data exchange operation aborted!", str_oper[operation], "Transfer function returned", str_ret[-stat]);
2006 // Assert that Transfer function returned ARM_DRIVER_OK
2007 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
2010 TEST_FAIL_MESSAGE("[FAILED] Unknown operation! Data exchange operation aborted!");
2013 if (stat != ARM_DRIVER_OK) {
2014 // If Send/Receive/Transfer start has failed
2015 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
2018 if ((operation == OP_ABORT_SEND) || // This IF block tests only abort functionality
2019 (operation == OP_ABORT_RECEIVE) ||
2020 (operation == OP_ABORT_TRANSFER)) {
2021 (void)osDelay(1U); // Wait short time before doing Abort
2022 stat = drv->Control (ARM_SPI_ABORT_TRANSFER, 0U);
2023 if (stat != ARM_DRIVER_OK) {
2024 // If Abort has failed
2025 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s", str_oper[operation], "Control function returned", str_ret[-stat]);
2027 // Assert that Control function returned ARM_DRIVER_OK
2028 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
2030 if (((mode == MODE_MASTER) && (ss_mode == SS_MODE_MASTER_SW)) ||
2031 ((mode == MODE_SLAVE) && (ss_mode == SS_MODE_SLAVE_SW))) {
2032 // If operation requires software Slave Select driving, deactivate Slave Select
2033 drv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE);
2035 spi_stat = drv->GetStatus(); // Get SPI status
2036 if (spi_stat.busy != 0U) {
2037 // If busy flag is still active
2038 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "Busy still active after Abort");
2040 // Assert that busy flag is not active
2041 TEST_ASSERT_MESSAGE(spi_stat.busy == 0U, msg_buf);
2043 data_count = drv->GetDataCount(); // Get data count
2044 if (data_count >= num) {
2045 // If data count is more or equal to number of items then Abort has failed
2046 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %i %s %i %s", str_oper[operation], "GetDataCount returned", data_count, "after Abort of", num, "items");
2048 // Assert data count is less then number of items requested for exchange
2049 TEST_ASSERT_MESSAGE(data_count < num, msg_buf);
2051 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
2053 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
2055 // Wait until timeout expires
2056 curr_tick = osKernelGetTickCount();
2057 if ((curr_tick - start_tick) < timeout) {
2058 (void)osDelay(timeout - (curr_tick - start_tick));
2060 (void)osDelay(20U); // Wait for SPI Server to start reception of next command
2063 return; // Here Abort test is finished, exit
2066 // Wait for operation to finish (status busy is 0 and event complete signaled, or timeout)
2068 if (data_count_sample == 0U) {
2069 // Store first data count different than 0
2070 data_count_sample = drv->GetDataCount(); // Get data count
2072 if ((drv->GetStatus().busy == 0U) && ((event & ARM_SPI_EVENT_TRANSFER_COMPLETE) != 0U)) {
2073 duration = osKernelGetSysTimerCount() - start_cnt;
2076 } while ((osKernelGetTickCount() - start_tick) < timeout);
2078 if (duration == 0xFFFFFFFFUL) {
2079 // If operation has timed out
2080 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "Operation timed out");
2082 // Assert that operation has finished in expected time
2083 TEST_ASSERT_MESSAGE(duration != 0xFFFFFFFFUL, msg_buf);
2085 if (((mode == MODE_MASTER) && (ss_mode == SS_MODE_MASTER_SW)) ||
2086 ((mode == MODE_SLAVE) && (ss_mode == SS_MODE_SLAVE_SW))) {
2087 // If operation requires software Slave Select driving, deactivate Slave Select
2088 stat = drv->Control (ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE);
2089 if (stat != ARM_DRIVER_OK) {
2090 // If driving of Slave Select to inactive state has failed
2091 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %s", str_oper[operation], "Control function returned", str_ret[-stat]);
2093 // Assert that Control function returned ARM_DRIVER_OK
2094 TEST_ASSERT_MESSAGE(stat == ARM_DRIVER_OK, msg_buf);
2097 if ((event & ARM_SPI_EVENT_TRANSFER_COMPLETE) == 0U) {
2098 // If transfer complete event was not signaled
2099 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "ARM_SPI_EVENT_TRANSFER_COMPLETE was not signaled");
2100 chk_data = 0U; // Do not check transferred content
2102 // Assert that ARM_SPI_EVENT_TRANSFER_COMPLETE was signaled
2103 TEST_ASSERT_MESSAGE((event & ARM_SPI_EVENT_TRANSFER_COMPLETE) != 0U, msg_buf);
2105 spi_stat = drv->GetStatus(); // Get SPI status
2106 if (spi_stat.busy != 0U) {
2107 // If busy flag is still active
2108 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "Busy still active after operation");
2109 chk_data = 0U; // Do not check transferred content
2111 // Assert that busy flag is not active
2112 TEST_ASSERT_MESSAGE(spi_stat.busy == 0U, msg_buf);
2114 if ((event & ARM_SPI_EVENT_DATA_LOST) != 0U) {
2115 // If data lost was signaled during the transfer
2116 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s", str_oper[operation], "ARM_SPI_EVENT_DATA_LOST was signaled");
2117 chk_data = 0U; // Do not check transferred content
2119 // Assert that ARM_SPI_EVENT_DATA_LOST was not signaled
2120 TEST_ASSERT_MESSAGE((event & ARM_SPI_EVENT_DATA_LOST) == 0U, msg_buf);
2122 data_count = drv->GetDataCount(); // Get data count
2123 if (data_count != num) {
2124 // If data count is different then number of items, then operation has failed
2125 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s %i %s %i %s", str_oper[operation], "GetDataCount returned", data_count, "expected was", num, "items");
2126 chk_data = 0U; // Do not check transferred content
2128 // Assert that data count is equal to number of items requested for exchange
2129 TEST_ASSERT_MESSAGE(data_count == num, msg_buf);
2131 if ((drv->GetStatus().busy != 0U) || ((event & ARM_SPI_EVENT_TRANSFER_COMPLETE) == 0U)) {
2132 // If transfer did not finish in time, abort it
2133 (void)drv->Control(ARM_SPI_ABORT_TRANSFER, 0U);
2136 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
2138 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
2140 // Wait until timeout expires
2141 curr_tick = osKernelGetTickCount();
2142 if ((curr_tick - start_tick) < timeout) {
2143 (void)osDelay(timeout - (curr_tick - start_tick));
2145 (void)osDelay(20U); // Wait for SPI Server to start reception of next command
2147 if (chk_data != 0U) { // If transferred content should be checked
2148 // Check received content for receive and transfer operations
2149 if ((operation == OP_RECEIVE) || (operation == OP_TRANSFER)) {
2150 memset(ptr_cmp_buf, (int32_t)'S', num * DataBitsToBytes(data_bits));
2151 stat = memcmp(ptr_rx_buf, ptr_cmp_buf, num * DataBitsToBytes(data_bits));
2153 // If data received mismatches
2154 // Find on which byte mismatch starts
2155 for (i = 0U; i < (num * DataBitsToBytes(data_bits)); i++) {
2156 if (ptr_rx_buf[i] != ptr_cmp_buf[i]) {
2160 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s byte %i, received was 0x%02X, expected was 0x%02X", str_oper[operation], "Received data mismatches on", i, ptr_rx_buf[i], ptr_cmp_buf[i]);
2162 // Assert that data received is same as expected
2163 TEST_ASSERT_MESSAGE(stat == 0, msg_buf);
2166 // Check sent content (by checking SPI Server's received buffer content)
2167 if ((mode == MODE_MASTER) || (operation != OP_RECEIVE) || (def_tx_stat == ARM_DRIVER_OK)) {
2168 // Check sent data in all cases except Slave mode Receive operation
2169 // with Default Tx not working or unsupported
2170 if (CmdGetBufRx(SPI_BUF_MAX) != EXIT_SUCCESS) { break; }
2172 if ((operation == OP_RECEIVE) && (def_tx_stat == ARM_DRIVER_OK)) {
2173 // Expected data received by SPI Server should be default Tx value
2174 memset(ptr_cmp_buf, (int32_t)'D', num * DataBitsToBytes(data_bits));
2176 if ((operation == OP_SEND) || (operation == OP_TRANSFER)) {
2177 // Expected data received by SPI Server should be what was sent
2178 memset(ptr_cmp_buf, (int32_t)'T', num * DataBitsToBytes(data_bits));
2181 stat = memcmp(ptr_rx_buf, ptr_cmp_buf, num * DataBitsToBytes(data_bits));
2183 // If data sent mismatches
2184 // Find on which byte mismatch starts
2185 for (i = 0U; i < (num * DataBitsToBytes(data_bits)); i++) {
2186 if (ptr_rx_buf[i] != ptr_cmp_buf[i]) {
2190 if (operation == OP_RECEIVE) {
2191 // If sent was default Tx value, 'D' bytes
2192 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s byte %i, SPI Server received 0x%02X, sent was 0x%02X", str_oper[operation], "Default Tx data mismatches on", i, ptr_rx_buf[i], ptr_cmp_buf[i]);
2194 // If sent was 'T' bytes
2195 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s byte %i, SPI Server received 0x%02X, sent was 0x%02X", str_oper[operation], "Sent data mismatches on", i, ptr_rx_buf[i], ptr_cmp_buf[i]);
2198 // Assert data sent is same as expected
2199 TEST_ASSERT_MESSAGE(stat == 0, msg_buf);
2202 #else // If Test Mode Loopback is selected
2203 if (chk_data != 0U) { // If transferred content should be checked
2204 if (operation == OP_TRANSFER) {
2205 memset(ptr_cmp_buf, (int32_t)'T', num * DataBitsToBytes(data_bits));
2206 stat = memcmp(ptr_rx_buf, ptr_cmp_buf, num * DataBitsToBytes(data_bits));
2208 // If data received mismatches
2209 // Find on which byte mismatch starts
2210 for (i = 0U; i < (num * DataBitsToBytes(data_bits)); i++) {
2211 if (ptr_rx_buf[i] != ptr_cmp_buf[i]) {
2215 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] %s: %s byte %i, received was 0x%02X, expected was 0x%02X", str_oper[operation], "Received data mismatches on", i, ptr_rx_buf[i], ptr_cmp_buf[i]);
2217 // Assert that data received is same as expected
2218 TEST_ASSERT_MESSAGE(stat == 0, msg_buf);
2226 #if (SPI_SERVER_USED == 1) // If Test Mode SPI Server is selected
2227 TEST_FAIL_MESSAGE("[FAILED] Problems in communication with SPI Server. Test aborted!");
2231 #endif // End of exclude form the documentation
2233 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2235 \brief Function: Function SPI_Mode_Master_SS_Unused
2237 The function \b SPI_Mode_Master_SS_Unused verifies data exchange:
2238 - in <b>Master Mode</b> with <b>Slave Select line not used</b>
2239 - with default clock / frame format
2240 - with default data bits
2241 - with default bit order
2242 - at default bus speed
2243 - for default number of data items
2245 \note In Test Mode <b>Loopback</b> Receive function is not checked
2247 void SPI_Mode_Master_SS_Unused (void) {
2249 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2250 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2251 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2252 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2253 #if (SPI_SERVER_USED == 1)
2254 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2255 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2258 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_UNUSED, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2259 #if (SPI_SERVER_USED == 1)
2260 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_UNUSED, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2262 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_UNUSED, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2265 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2267 \brief Function: Function SPI_Mode_Master_SS_Sw_Ctrl
2269 The function \b SPI_Mode_Master_SS_Sw_Ctrl verifies data exchange:
2270 - in <b>Master Mode</b> with <b>Slave Select line Software controlled</b>
2271 - with default clock / frame format
2272 - with default data bits
2273 - with default bit order
2274 - at default bus speed
2275 - for default number of data items
2277 \note In Test Mode <b>Loopback</b> this test is not executed
2279 void SPI_Mode_Master_SS_Sw_Ctrl (void) {
2281 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2282 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2283 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2284 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2285 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2286 #if (SPI_SERVER_USED == 1)
2287 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2288 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2291 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2292 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2293 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2296 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2298 \brief Function: Function SPI_Mode_Master_SS_Hw_Ctrl_Out
2300 The function \b SPI_Mode_Master_SS_Hw_Ctrl_Out verifies data exchange:
2301 - in <b>Master Mode</b> with <b>Slave Select line Hardware controlled Output</b>
2302 - with default clock / frame format
2303 - with default data bits
2304 - with default bit order
2305 - at default bus speed
2306 - for default number of data items
2308 \note In Test Mode <b>Loopback</b> this test not executed
2310 void SPI_Mode_Master_SS_Hw_Ctrl_Out (void) {
2312 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2313 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2314 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2315 #if (SPI_SERVER_USED == 1)
2316 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2317 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2320 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2321 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2322 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2325 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2327 \brief Function: Function SPI_Mode_Master_SS_Hw_Mon_In
2329 The function \b SPI_Mode_Master_SS_Hw_Mon_In verifies data exchange:
2330 - in <b>Master Mode</b> with <b>Slave Select line Hardware monitored Input</b>
2331 - with default clock / frame format
2332 - with default data bits
2333 - with default bit order
2334 - at default bus speed
2335 - for default number of data items
2337 \note In Test Mode <b>Loopback</b> this test not executed
2339 void SPI_Mode_Master_SS_Hw_Mon_In (void) {
2341 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2342 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2343 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2344 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2345 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2346 #if (SPI_SERVER_USED == 1)
2347 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2348 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2351 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_INPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2352 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_INPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2353 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_MASTER_HW_INPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2356 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2358 \brief Function: Function SPI_Mode_Slave_SS_Hw_Mon
2360 The function \b SPI_Mode_Slave_SS_Hw_Mon verifies data exchange:
2361 - in <b>Slave Mode</b> with <b>Slave Select line Hardware monitored</b>
2362 - with default clock / frame format
2363 - with default data bits
2364 - with default bit order
2365 - at default bus speed
2366 - for default number of data items
2368 \note In Test Mode <b>Loopback</b> this test not executed
2370 void SPI_Mode_Slave_SS_Hw_Mon (void) {
2372 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2373 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2374 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2375 #if (SPI_SERVER_USED == 1)
2376 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2377 if (ServerCheckSupport(MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2380 SPI_DataExchange_Operation(OP_SEND, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_HW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2381 SPI_DataExchange_Operation(OP_RECEIVE, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_HW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2382 SPI_DataExchange_Operation(OP_TRANSFER, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_HW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2385 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2387 \brief Function: Function SPI_Mode_Slave_SS_Sw_Ctrl
2389 The function \b SPI_Mode_Slave_SS_Sw_Ctrl verifies data exchange:
2390 - in <b>Slave Mode</b> with <b>Slave Select line Software controlled</b>
2391 - with default clock / frame format
2392 - with default data bits
2393 - with default bit order
2394 - at default bus speed
2395 - for default number of data items
2397 \note In Test Mode <b>Loopback</b> this test not executed
2399 void SPI_Mode_Slave_SS_Sw_Ctrl (void) {
2401 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2402 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2403 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2404 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2405 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2406 #if (SPI_SERVER_USED == 1)
2407 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2408 if (ServerCheckSupport(MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2411 SPI_DataExchange_Operation(OP_SEND, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2412 SPI_DataExchange_Operation(OP_RECEIVE, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2413 SPI_DataExchange_Operation(OP_TRANSFER, MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SS_MODE_SLAVE_SW, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2416 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2418 \brief Function: Function SPI_Format_Clock_Pol0_Pha0
2420 The function \b SPI_Format_Clock_Pol0_Pha0 verifies data exchange:
2421 - in Master Mode with default Slave Select mode
2422 - with clock format: <b>polarity 0 / phase 0</b>
2423 - with default data bits
2424 - with default bit order
2425 - at default bus speed
2426 - for default number of data items
2428 \note In Test Mode <b>Loopback</b> this test not executed
2430 void SPI_Format_Clock_Pol0_Pha0 (void) {
2432 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2433 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2434 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2435 #if (SPI_SERVER_USED == 1)
2436 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2437 if (ServerCheckSupport(MODE_SLAVE, FORMAT_CPOL0_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2440 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_CPOL0_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2441 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_CPOL0_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2442 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_CPOL0_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2445 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2447 \brief Function: Function SPI_Format_Clock_Pol0_Pha1
2449 The function \b SPI_Format_Clock_Pol0_Pha1 verifies data exchange:
2450 - in Master Mode with default Slave Select mode
2451 - with clock format: <b>polarity 0 / phase 1</b>
2452 - with default data bits
2453 - with default bit order
2454 - at default bus speed
2455 - for default number of data items
2457 \note In Test Mode <b>Loopback</b> this test not executed
2459 void SPI_Format_Clock_Pol0_Pha1 (void) {
2461 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2462 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2463 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2464 #if (SPI_SERVER_USED == 1)
2465 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2466 if (ServerCheckSupport(MODE_SLAVE, FORMAT_CPOL0_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2469 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_CPOL0_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2470 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_CPOL0_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2471 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_CPOL0_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2474 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2476 \brief Function: Function SPI_Format_Clock_Pol1_Pha0
2478 The function \b SPI_Format_Clock_Pol1_Pha0 verifies data exchange:
2479 - in Master Mode with default Slave Select mode
2480 - with clock format: <b>polarity 1 / phase 0</b>
2481 - with default data bits
2482 - with default bit order
2483 - at default bus speed
2484 - for default number of data items
2486 \note In Test Mode <b>Loopback</b> this test not executed
2488 void SPI_Format_Clock_Pol1_Pha0 (void) {
2490 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2491 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2492 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2493 #if (SPI_SERVER_USED == 1)
2494 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2495 if (ServerCheckSupport(MODE_SLAVE, FORMAT_CPOL1_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2498 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_CPOL1_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2499 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_CPOL1_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2500 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_CPOL1_CPHA0, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2503 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2505 \brief Function: Function SPI_Format_Clock_Pol1_Pha1
2507 The function \b SPI_Format_Clock_Pol1_Pha1 verifies data exchange:
2508 - in Master Mode with default Slave Select mode
2509 - with clock format: <b>polarity 1 / phase 1</b>
2510 - with default data bits
2511 - with default bit order
2512 - at default bus speed
2513 - for default number of data items
2515 \note In Test Mode <b>Loopback</b> this test not executed
2517 void SPI_Format_Clock_Pol1_Pha1 (void) {
2519 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2520 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2521 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2522 #if (SPI_SERVER_USED == 1)
2523 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2524 if (ServerCheckSupport(MODE_SLAVE, FORMAT_CPOL1_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2527 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_CPOL1_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2528 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_CPOL1_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2529 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_CPOL1_CPHA1, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2532 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2534 \brief Function: Function SPI_Format_Frame_TI
2536 The function \b SPI_Format_Frame_TI verifies data exchange:
2537 - in <b>Master Mode</b> with <b>Slave Select line Hardware controlled Output</b>
2538 - with <b>Texas Instruments frame format</b>
2539 - with default data bits
2540 - with bit order <b>from MSB to LSB</b>
2541 - at default bus speed
2542 - for default number of data items
2544 \note In Test Mode <b>Loopback</b> this test not executed
2546 void SPI_Format_Frame_TI (void) {
2548 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2549 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2550 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2551 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2552 #if (SPI_SERVER_USED == 1)
2553 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2554 if (ServerCheckSupport(MODE_SLAVE, FORMAT_TI, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2557 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_TI, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2558 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_TI, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2559 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_TI, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2562 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2564 \brief Function: Function SPI_Format_Clock_Microwire
2566 The function \b SPI_Format_Clock_Microwire verifies data exchange:
2567 - in <b>Master Mode</b> with <b>Slave Select line Hardware controlled Output</b>
2568 - with <b>National Semiconductor Microwire frame format</b>
2569 - with default data bits
2570 - with bit order <b>from MSB to LSB</b>
2571 - at default bus speed
2572 - for default number of data items
2574 \note In Test Mode <b>Loopback</b> this test not executed
2576 void SPI_Format_Clock_Microwire (void) {
2578 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2579 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2580 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2581 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2582 #if (SPI_SERVER_USED == 1)
2583 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2584 if (ServerCheckSupport(MODE_SLAVE, FORMAT_MICROWIRE, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2587 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, FORMAT_MICROWIRE, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2588 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, FORMAT_MICROWIRE, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2589 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, FORMAT_MICROWIRE, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SS_MODE_MASTER_HW_OUTPUT, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2592 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2594 \brief Function: Function SPI_Data_Bits_1
2596 The function \b SPI_Data_Bits_1 verifies data exchange:
2597 - in Master Mode with default Slave Select mode
2598 - with default clock / frame format
2599 - with <b>1 data bits</b> per frame
2600 - with default bit order
2601 - at default bus speed
2602 - for default number of data items
2604 \note In Test Mode <b>Loopback</b> this test not executed
2606 void SPI_Data_Bits_1 (void) {
2608 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2609 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2610 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2611 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2612 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2613 #if (SPI_SERVER_USED == 1)
2614 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2615 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 1U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2618 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 1U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2619 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 1U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2620 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 1U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2623 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2625 \brief Function: Function SPI_Data_Bits_2
2627 The function \b SPI_Data_Bits_2 verifies data exchange:
2628 - in Master Mode with default Slave Select mode
2629 - with default clock / frame format
2630 - with <b>2 data bits</b> per frame
2631 - with default bit order
2632 - at default bus speed
2633 - for default number of data items
2635 \note In Test Mode <b>Loopback</b> this test not executed
2637 void SPI_Data_Bits_2 (void) {
2639 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2640 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2641 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2642 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2643 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2644 #if (SPI_SERVER_USED == 1)
2645 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2646 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 2U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2649 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 2U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2650 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 2U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2651 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 2U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2654 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2656 \brief Function: Function SPI_Data_Bits_3
2658 The function \b SPI_Data_Bits_3 verifies data exchange:
2659 - in Master Mode with default Slave Select mode
2660 - with default clock / frame format
2661 - with <b>3 data bits</b> per frame
2662 - with default bit order
2663 - at default bus speed
2664 - for default number of data items
2666 \note In Test Mode <b>Loopback</b> this test not executed
2668 void SPI_Data_Bits_3 (void) {
2670 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2671 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
2672 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
2673 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2674 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2675 #if (SPI_SERVER_USED == 1)
2676 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2677 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 3U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2680 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 3U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2681 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 3U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2682 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 3U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2685 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2687 \brief Function: Function SPI_Data_Bits_4
2689 The function \b SPI_Data_Bits_4 verifies data exchange:
2690 - in Master Mode with default Slave Select mode
2691 - with default clock / frame format
2692 - with <b>4 data bits</b> per frame
2693 - with default bit order
2694 - at default bus speed
2695 - for default number of data items
2697 \note In Test Mode <b>Loopback</b> this test not executed
2699 void SPI_Data_Bits_4 (void) {
2701 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2702 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2703 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2704 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2705 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2706 #if (SPI_SERVER_USED == 1)
2707 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2708 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 4U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2711 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 4U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2712 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 4U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2713 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 4U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2716 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2718 \brief Function: Function SPI_Data_Bits_5
2720 The function \b SPI_Data_Bits_5 verifies data exchange:
2721 - in Master Mode with default Slave Select mode
2722 - with default clock / frame format
2723 - with <b>5 data bits</b> per frame
2724 - with default bit order
2725 - at default bus speed
2726 - for default number of data items
2728 \note In Test Mode <b>Loopback</b> this test not executed
2730 void SPI_Data_Bits_5 (void) {
2732 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2733 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2734 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2735 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2736 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2737 #if (SPI_SERVER_USED == 1)
2738 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2739 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 5U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2742 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 5U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2743 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 5U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2744 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 5U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2747 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2749 \brief Function: Function SPI_Data_Bits_6
2751 The function \b SPI_Data_Bits_6 verifies data exchange:
2752 - in Master Mode with default Slave Select mode
2753 - with default clock / frame format
2754 - with <b>6 data bits</b> per frame
2755 - with default bit order
2756 - at default bus speed
2757 - for default number of data items
2759 \note In Test Mode <b>Loopback</b> this test not executed
2761 void SPI_Data_Bits_6 (void) {
2763 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2764 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2765 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2766 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2767 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2768 #if (SPI_SERVER_USED == 1)
2769 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2770 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 6U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2773 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 6U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2774 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 6U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2775 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 6U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2778 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2780 \brief Function: Function SPI_Data_Bits_7
2782 The function \b SPI_Data_Bits_7 verifies data exchange:
2783 - in Master Mode with default Slave Select mode
2784 - with default clock / frame format
2785 - with <b>7 data bits</b> per frame
2786 - with default bit order
2787 - at default bus speed
2788 - for default number of data items
2790 \note In Test Mode <b>Loopback</b> this test not executed
2792 void SPI_Data_Bits_7 (void) {
2794 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2795 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2796 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2797 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2798 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2799 #if (SPI_SERVER_USED == 1)
2800 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2801 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 7U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2804 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 7U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2805 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 7U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2806 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 7U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2809 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2811 \brief Function: Function SPI_Data_Bits_8
2813 The function \b SPI_Data_Bits_8 verifies data exchange:
2814 - in Master Mode with default Slave Select mode
2815 - with default clock / frame format
2816 - with <b>8 data bits</b> per frame
2817 - with default bit order
2818 - at default bus speed
2819 - for default number of data items
2821 void SPI_Data_Bits_8 (void) {
2823 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2824 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2825 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2826 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2827 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2828 #if (SPI_SERVER_USED == 1)
2829 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2830 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 8U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2833 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 8U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2834 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 8U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2835 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 8U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2838 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2840 \brief Function: Function SPI_Data_Bits_9
2842 The function \b SPI_Data_Bits_9 verifies data exchange:
2843 - in Master Mode with default Slave Select mode
2844 - with default clock / frame format
2845 - with <b>9 data bits</b> per frame
2846 - with default bit order
2847 - at default bus speed
2848 - for default number of data items
2850 \note In Test Mode <b>Loopback</b> this test not executed
2852 void SPI_Data_Bits_9 (void) {
2854 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2855 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2856 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2857 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2858 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2859 #if (SPI_SERVER_USED == 1)
2860 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2861 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 9U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2864 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 9U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2865 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 9U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2866 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 9U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2869 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2871 \brief Function: Function SPI_Data_Bits_10
2873 The function \b SPI_Data_Bits_10 verifies data exchange:
2874 - in Master Mode with default Slave Select mode
2875 - with default clock / frame format
2876 - with <b>10 data bits</b> per frame
2877 - with default bit order
2878 - at default bus speed
2879 - for default number of data items
2881 \note In Test Mode <b>Loopback</b> this test not executed
2883 void SPI_Data_Bits_10 (void) {
2885 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2886 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2887 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2888 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2889 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2890 #if (SPI_SERVER_USED == 1)
2891 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2892 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 10U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2895 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 10U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2896 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 10U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2897 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 10U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2900 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2902 \brief Function: Function SPI_Data_Bits_11
2904 The function \b SPI_Data_Bits_11 verifies data exchange:
2905 - in Master Mode with default Slave Select mode
2906 - with default clock / frame format
2907 - with <b>11 data bits</b> per frame
2908 - with default bit order
2909 - at default bus speed
2910 - for default number of data items
2912 \note In Test Mode <b>Loopback</b> this test not executed
2914 void SPI_Data_Bits_11 (void) {
2916 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2917 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2918 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2919 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2920 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2921 #if (SPI_SERVER_USED == 1)
2922 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2923 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 11U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2926 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 11U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2927 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 11U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2928 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 11U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2931 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2933 \brief Function: Function SPI_Data_Bits_12
2935 The function \b SPI_Data_Bits_12 verifies data exchange:
2936 - in Master Mode with default Slave Select mode
2937 - with default clock / frame format
2938 - with <b>12 data bits</b> per frame
2939 - with default bit order
2940 - at default bus speed
2941 - for default number of data items
2943 \note In Test Mode <b>Loopback</b> this test not executed
2945 void SPI_Data_Bits_12 (void) {
2947 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2948 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2949 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2950 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2951 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2952 #if (SPI_SERVER_USED == 1)
2953 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2954 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 12U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2957 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 12U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2958 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 12U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2959 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 12U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2962 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2964 \brief Function: Function SPI_Data_Bits_13
2966 The function \b SPI_Data_Bits_13 verifies data exchange:
2967 - in Master Mode with default Slave Select mode
2968 - with default clock / frame format
2969 - with <b>13 data bits</b> per frame
2970 - with default bit order
2971 - at default bus speed
2972 - for default number of data items
2974 \note In Test Mode <b>Loopback</b> this test not executed
2976 void SPI_Data_Bits_13 (void) {
2978 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
2979 if (IsFormatValid() != EXIT_SUCCESS) { return; }
2980 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
2981 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2982 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2983 #if (SPI_SERVER_USED == 1)
2984 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
2985 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 13U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
2988 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 13U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2989 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 13U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2990 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 13U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
2993 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
2995 \brief Function: Function SPI_Data_Bits_14
2997 The function \b SPI_Data_Bits_14 verifies data exchange:
2998 - in Master Mode with default Slave Select mode
2999 - with default clock / frame format
3000 - with <b>14 data bits</b> per frame
3001 - with default bit order
3002 - at default bus speed
3003 - for default number of data items
3005 \note In Test Mode <b>Loopback</b> this test not executed
3007 void SPI_Data_Bits_14 (void) {
3009 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3010 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3011 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3012 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3013 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3014 #if (SPI_SERVER_USED == 1)
3015 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3016 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 14U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3019 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 14U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3020 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 14U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3021 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 14U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3024 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3026 \brief Function: Function SPI_Data_Bits_15
3028 The function \b SPI_Data_Bits_15 verifies data exchange:
3029 - in Master Mode with default Slave Select mode
3030 - with default clock / frame format
3031 - with <b>15 data bits</b> per frame
3032 - with default bit order
3033 - at default bus speed
3034 - for default number of data items
3036 \note In Test Mode <b>Loopback</b> this test not executed
3038 void SPI_Data_Bits_15 (void) {
3040 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3041 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3042 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3043 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3044 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3045 #if (SPI_SERVER_USED == 1)
3046 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3047 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 15U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3050 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 15U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3051 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 15U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3052 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 15U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3055 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3057 \brief Function: Function SPI_Data_Bits_16
3059 The function \b SPI_Data_Bits_16 verifies data exchange:
3060 - in Master Mode with default Slave Select mode
3061 - with default clock / frame format
3062 - with <b>16 data bits</b> per frame
3063 - with default bit order
3064 - at default bus speed
3065 - for default number of data items
3067 void SPI_Data_Bits_16 (void) {
3069 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3070 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3071 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3072 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3073 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3074 #if (SPI_SERVER_USED == 1)
3075 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3076 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 16U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3079 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 16U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3080 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 16U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3081 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 16U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3084 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3086 \brief Function: Function SPI_Data_Bits_17
3088 The function \b SPI_Data_Bits_17 verifies data exchange:
3089 - in Master Mode with default Slave Select mode
3090 - with default clock / frame format
3091 - with <b>17 data bits</b> per frame
3092 - with default bit order
3093 - at default bus speed
3094 - for default number of data items
3096 \note In Test Mode <b>Loopback</b> this test not executed
3098 void SPI_Data_Bits_17 (void) {
3100 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3101 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3102 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3103 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3104 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3105 #if (SPI_SERVER_USED == 1)
3106 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3107 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 17U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3110 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 17U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3111 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 17U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3112 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 17U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3115 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3117 \brief Function: Function SPI_Data_Bits_18
3119 The function \b SPI_Data_Bits_18 verifies data exchange:
3120 - in Master Mode with default Slave Select mode
3121 - with default clock / frame format
3122 - with <b>18 data bits</b> per frame
3123 - with default bit order
3124 - at default bus speed
3125 - for default number of data items
3127 \note In Test Mode <b>Loopback</b> this test not executed
3129 void SPI_Data_Bits_18 (void) {
3131 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3132 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3133 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3134 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3135 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3136 #if (SPI_SERVER_USED == 1)
3137 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3138 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 18U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3141 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 18U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3142 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 18U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3143 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 18U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3146 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3148 \brief Function: Function SPI_Data_Bits_19
3150 The function \b SPI_Data_Bits_19 verifies data exchange:
3151 - in Master Mode with default Slave Select mode
3152 - with default clock / frame format
3153 - with <b>19 data bits</b> per frame
3154 - with default bit order
3155 - at default bus speed
3156 - for default number of data items
3158 \note In Test Mode <b>Loopback</b> this test is not executed
3160 void SPI_Data_Bits_19 (void) {
3162 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3163 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3164 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3165 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3166 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3167 #if (SPI_SERVER_USED == 1)
3168 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3169 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 19U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3172 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 19U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3173 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 19U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3174 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 19U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3177 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3179 \brief Function: Function SPI_Data_Bits_20
3181 The function \b SPI_Data_Bits_20 verifies data exchange:
3182 - in Master Mode with default Slave Select mode
3183 - with default clock / frame format
3184 - with <b>20 data bits</b> per frame
3185 - with default bit order
3186 - at default bus speed
3187 - for default number of data items
3189 \note In Test Mode <b>Loopback</b> this test is not executed
3191 void SPI_Data_Bits_20 (void) {
3193 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3194 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3195 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3196 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3197 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3198 #if (SPI_SERVER_USED == 1)
3199 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3200 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 20U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3203 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 20U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3204 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 20U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3205 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 20U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3208 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3210 \brief Function: Function SPI_Data_Bits_21
3212 The function \b SPI_Data_Bits_21 verifies data exchange:
3213 - in Master Mode with default Slave Select mode
3214 - with default clock / frame format
3215 - with <b>21 data bits</b> per frame
3216 - with default bit order
3217 - at default bus speed
3218 - for default number of data items
3220 \note In Test Mode <b>Loopback</b> this test is not executed
3222 void SPI_Data_Bits_21 (void) {
3224 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3225 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3226 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3227 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3228 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3229 #if (SPI_SERVER_USED == 1)
3230 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3231 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 21U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3234 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 21U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3235 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 21U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3236 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 21U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3239 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3241 \brief Function: Function SPI_Data_Bits_22
3243 The function \b SPI_Data_Bits_22 verifies data exchange:
3244 - in Master Mode with default Slave Select mode
3245 - with default clock / frame format
3246 - with <b>22 data bits</b> per frame
3247 - with default bit order
3248 - at default bus speed
3249 - for default number of data items
3251 \note In Test Mode <b>Loopback</b> this test is not executed
3253 void SPI_Data_Bits_22 (void) {
3255 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3256 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3257 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3258 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3259 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3260 #if (SPI_SERVER_USED == 1)
3261 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3262 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 22U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3265 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 22U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3266 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 22U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3267 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 22U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3270 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3272 \brief Function: Function SPI_Data_Bits_23
3274 The function \b SPI_Data_Bits_23 verifies data exchange:
3275 - in Master Mode with default Slave Select mode
3276 - with default clock / frame format
3277 - with <b>23 data bits</b> per frame
3278 - with default bit order
3279 - at default bus speed
3280 - for default number of data items
3282 \note In Test Mode <b>Loopback</b> this test is not executed
3284 void SPI_Data_Bits_23 (void) {
3286 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3287 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3288 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3289 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3290 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3291 #if (SPI_SERVER_USED == 1)
3292 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3293 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 23U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3296 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 23U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3297 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 23U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3298 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 23U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3301 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3303 \brief Function: Function SPI_Data_Bits_24
3305 The function \b SPI_Data_Bits_24 verifies data exchange:
3306 - in Master Mode with default Slave Select mode
3307 - with default clock / frame format
3308 - with <b>24 data bits</b> per frame
3309 - with default bit order
3310 - at default bus speed
3311 - for default number of data items
3313 void SPI_Data_Bits_24 (void) {
3315 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3316 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3317 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3318 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3319 #if (SPI_SERVER_USED == 1)
3320 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3321 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 24U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3324 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 24U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3325 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 24U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3326 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 24U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3329 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3331 \brief Function: Function SPI_Data_Bits_25
3333 The function \b SPI_Data_Bits_25 verifies data exchange:
3334 - in Master Mode with default Slave Select mode
3335 - with default clock / frame format
3336 - with <b>25 data bits</b> per frame
3337 - with default bit order
3338 - at default bus speed
3339 - for default number of data items
3341 \note In Test Mode <b>Loopback</b> this test is not executed
3343 void SPI_Data_Bits_25 (void) {
3345 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3346 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3347 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3348 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3349 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3350 #if (SPI_SERVER_USED == 1)
3351 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3352 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 25U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3355 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 25U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3356 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 25U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3357 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 25U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3360 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3362 \brief Function: Function SPI_Data_Bits_26
3364 The function \b SPI_Data_Bits_26 verifies data exchange:
3365 - in Master Mode with default Slave Select mode
3366 - with default clock / frame format
3367 - with <b>26 data bits</b> per frame
3368 - with default bit order
3369 - at default bus speed
3370 - for default number of data items
3372 \note In Test Mode <b>Loopback</b> this test is not executed
3374 void SPI_Data_Bits_26 (void) {
3376 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3377 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3378 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3379 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3380 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3381 #if (SPI_SERVER_USED == 1)
3382 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3383 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 26U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3386 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 26U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3387 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 26U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3388 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 26U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3391 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3393 \brief Function: Function SPI_Data_Bits_27
3395 The function \b SPI_Data_Bits_27 verifies data exchange:
3396 - in Master Mode with default Slave Select mode
3397 - with default clock / frame format
3398 - with <b>27 data bits</b> per frame
3399 - with default bit order
3400 - at default bus speed
3401 - for default number of data items
3403 \note In Test Mode <b>Loopback</b> this test is not executed
3405 void SPI_Data_Bits_27 (void) {
3407 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3408 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3409 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3410 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3411 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3412 #if (SPI_SERVER_USED == 1)
3413 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3414 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 27U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3417 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 27U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3418 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 27U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3419 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 27U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3422 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3424 \brief Function: Function SPI_Data_Bits_28
3426 The function \b SPI_Data_Bits_28 verifies data exchange:
3427 - in Master Mode with default Slave Select mode
3428 - with default clock / frame format
3429 - with <b>28 data bits</b> per frame
3430 - with default bit order
3431 - at default bus speed
3432 - for default number of data items
3434 \note In Test Mode <b>Loopback</b> this test is not executed
3436 void SPI_Data_Bits_28 (void) {
3438 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3439 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3440 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3441 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3442 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3443 #if (SPI_SERVER_USED == 1)
3444 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3445 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 28U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3448 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 28U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3449 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 28U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3450 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 28U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3453 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3455 \brief Function: Function SPI_Data_Bits_29
3457 The function \b SPI_Data_Bits_29 verifies data exchange:
3458 - in Master Mode with default Slave Select mode
3459 - with default clock / frame format
3460 - with <b>29 data bits</b> per frame
3461 - with default bit order
3462 - at default bus speed
3463 - for default number of data items
3465 \note In Test Mode <b>Loopback</b> this test is not executed
3467 void SPI_Data_Bits_29 (void) {
3469 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3470 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3471 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3472 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3473 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3474 #if (SPI_SERVER_USED == 1)
3475 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3476 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 29U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3479 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 29U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3480 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 29U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3481 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 29U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3484 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3486 \brief Function: Function SPI_Data_Bits_30
3488 The function \b SPI_Data_Bits_30 verifies data exchange:
3489 - in Master Mode with default Slave Select mode
3490 - with default clock / frame format
3491 - with <b>30 data bits</b> per frame
3492 - with default bit order
3493 - at default bus speed
3494 - for default number of data items
3496 \note In Test Mode <b>Loopback</b> this test is not executed
3498 void SPI_Data_Bits_30 (void) {
3500 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3501 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3502 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3503 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3504 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3505 #if (SPI_SERVER_USED == 1)
3506 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3507 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 30U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3510 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 30U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3511 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 30U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3512 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 30U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3515 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3517 \brief Function: Function SPI_Data_Bits_31
3519 The function \b SPI_Data_Bits_31 verifies data exchange:
3520 - in Master Mode with default Slave Select mode
3521 - with default clock / frame format
3522 - with <b>31 data bits</b> per frame
3523 - with default bit order
3524 - at default bus speed
3525 - for default number of data items
3527 \note In Test Mode <b>Loopback</b> this test is not executed
3529 void SPI_Data_Bits_31 (void) {
3531 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3532 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3533 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3534 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3535 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3536 #if (SPI_SERVER_USED == 1)
3537 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3538 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 31U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3541 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 31U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3542 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 31U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3543 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 31U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3546 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3548 \brief Function: Function SPI_Data_Bits_32
3550 The function \b SPI_Data_Bits_32 verifies data exchange:
3551 - in Master Mode with default Slave Select mode
3552 - with default clock / frame format
3553 - with <b>32 data bits</b> per frame
3554 - with default bit order
3555 - at default bus speed
3556 - for default number of data items
3558 void SPI_Data_Bits_32 (void) {
3560 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3561 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3562 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3563 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3564 #if (SPI_SERVER_USED == 1)
3565 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3566 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, 32U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3569 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, 32U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3570 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, 32U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3571 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, 32U, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3574 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3576 \brief Function: Function SPI_Bit_Order_MSB_LSB
3578 The function \b SPI_Bit_Order_MSB_LSB verifies data exchange:
3579 - in Master Mode with default Slave Select mode
3580 - with default clock / frame format
3581 - with default data bits
3582 - with bit order <b>from MSB to LSB</b>
3583 - at default bus speed
3584 - for default number of data items
3586 \note In Test Mode <b>Loopback</b> this test is not executed
3588 void SPI_Bit_Order_MSB_LSB (void) {
3590 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3591 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3592 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3593 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3594 #if (SPI_SERVER_USED == 1)
3595 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3596 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3599 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3600 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3601 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_MSB_TO_LSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3604 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3606 \brief Function: Function SPI_Bit_Order_LSB_MSB
3608 The function \b SPI_Bit_Order_LSB_MSB verifies data exchange:
3609 - in Master Mode with default Slave Select mode
3610 - with default clock / frame format
3611 - with default data bits
3612 - with bit order <b>from LSB to MSB</b>
3613 - at default bus speed
3614 - for default number of data items
3616 \note In Test Mode <b>Loopback</b> this test is not executed
3618 void SPI_Bit_Order_LSB_MSB (void) {
3620 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3621 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3622 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3623 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3624 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3625 #if (SPI_SERVER_USED == 1)
3626 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3627 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_LSB_TO_MSB, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3630 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_LSB_TO_MSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3631 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_LSB_TO_MSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3632 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, BO_LSB_TO_MSB, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3635 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3637 \brief Function: Function SPI_Bus_Speed_Min
3639 The function \b SPI_Bus_Speed_Min verifies data exchange:
3640 - in Master Mode with default Slave Select mode
3641 - with default clock / frame format
3642 - with default data bits
3643 - with default bit order
3644 - at <b>minimum bus speed</b> (define <c>SPI_CFG_MIN_BUS_SPEED</c> in DV_SPI_Config.h)
3645 - for default number of data items
3647 This test function checks the following requirements:
3648 - measured bus speed is not 25% lower, or higher than requested
3649 - bus speed value returned by the driver is not negative
3650 - bus speed value returned by the driver is not higher then requested
3651 - bus speed value returned by the driver is not lower then 75% of requested
3653 void SPI_Bus_Speed_Min (void) {
3654 volatile uint64_t bps;
3655 volatile int32_t ret_bus_speed;
3657 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3658 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3659 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3660 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3661 #if (SPI_SERVER_USED == 1)
3662 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3663 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_MIN_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3666 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MIN_BUS_SPEED, SPI_CFG_DEF_NUM);
3667 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MIN_BUS_SPEED, SPI_CFG_DEF_NUM);
3668 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MIN_BUS_SPEED, SPI_CFG_DEF_NUM);
3670 if (duration != 0xFFFFFFFFU) { // If Transfer finished before timeout
3671 if (duration != 0U) { // If duration of transfer was more than 0 SysTick counts
3672 bps = ((uint64_t)systick_freq * SPI_CFG_DEF_DATA_BITS * SPI_CFG_DEF_NUM) / duration;
3673 if ((bps < ((SPI_CFG_MIN_BUS_SPEED * 3) / 4)) ||
3674 (bps > SPI_CFG_MIN_BUS_SPEED)) {
3675 // If measured bus speed is 25% lower, or higher than requested
3676 (void)snprintf(msg_buf, sizeof(msg_buf), "[WARNING] At requested bus speed of %i bps, effective bus speed is %i bps", SPI_CFG_MIN_BUS_SPEED, (uint32_t)bps);
3677 TEST_MESSAGE(msg_buf);
3682 drv->Control (ARM_SPI_SET_BUS_SPEED, SPI_CFG_MIN_BUS_SPEED);
3683 ret_bus_speed = drv->Control (ARM_SPI_GET_BUS_SPEED, 0U);
3684 if (ret_bus_speed < 0) {
3685 // If bus speed value returned by the driver is negative
3686 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] Get bus speed returned negative value %i", ret_bus_speed);
3687 TEST_FAIL_MESSAGE(msg_buf);
3688 } else if ((uint32_t)ret_bus_speed > SPI_CFG_MIN_BUS_SPEED) {
3689 // If bus speed value returned by the driver is higher then requested
3690 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] Get bus speed returned %i bps instead of requested %i bps", ret_bus_speed, SPI_CFG_MIN_BUS_SPEED);
3691 TEST_FAIL_MESSAGE(msg_buf);
3692 } else if ((uint32_t)ret_bus_speed < ((SPI_CFG_MIN_BUS_SPEED * 3) / 4)) {
3693 // If bus speed value returned by the driver is lower then 75% of requested
3694 (void)snprintf(msg_buf, sizeof(msg_buf), "[WARNING] Get bus speed returned %i bps instead of requested %i bps", ret_bus_speed, SPI_CFG_MIN_BUS_SPEED);
3695 TEST_MESSAGE(msg_buf);
3699 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3701 \brief Function: Function SPI_Bus_Speed_Max
3703 The function \b SPI_Bus_Speed_Max verifies data exchange:
3704 - in Master Mode with default Slave Select mode
3705 - with default clock / frame format
3706 - with default data bits
3707 - with default bit order
3708 - at <b>maximum bus speed</b> (define <c>SPI_CFG_MAX_BUS_SPEED</c> in DV_SPI_Config.h)
3709 - for default number of data items
3711 This test function checks the following requirements:
3712 - measured bus speed is not 25% lower, or higher than requested
3713 - bus speed value returned by the driver is not negative
3714 - bus speed value returned by the driver is not higher then requested
3715 - bus speed value returned by the driver is not lower then 75% of requested
3717 void SPI_Bus_Speed_Max (void) {
3718 volatile uint64_t bps;
3719 volatile int32_t ret_bus_speed;
3721 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3722 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3723 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3724 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3725 #if (SPI_SERVER_USED == 1)
3726 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3727 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_MAX_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3730 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MAX_BUS_SPEED, SPI_CFG_DEF_NUM);
3731 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MAX_BUS_SPEED, SPI_CFG_DEF_NUM);
3732 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_MAX_BUS_SPEED, SPI_CFG_DEF_NUM);
3734 if (duration != 0xFFFFFFFFU) { // If Transfer finished before timeout
3735 if (duration != 0U) { // If duration of transfer was more than 0 SysTick counts
3736 bps = ((uint64_t)systick_freq * SPI_CFG_DEF_DATA_BITS * SPI_CFG_DEF_NUM) / duration;
3737 if ((bps < ((SPI_CFG_MAX_BUS_SPEED * 3) / 4)) ||
3738 (bps > SPI_CFG_MAX_BUS_SPEED)) {
3739 // If measured bus speed is 25% lower, or higher than requested
3740 (void)snprintf(msg_buf, sizeof(msg_buf), "[WARNING] At requested bus speed of %i bps, effective bus speed is %i bps", SPI_CFG_MAX_BUS_SPEED, (uint32_t)bps);
3741 TEST_MESSAGE(msg_buf);
3746 drv->Control (ARM_SPI_SET_BUS_SPEED, SPI_CFG_MAX_BUS_SPEED);
3747 ret_bus_speed = drv->Control (ARM_SPI_GET_BUS_SPEED, 0U);
3748 if (ret_bus_speed < 0) {
3749 // If bus speed value returned by the driver is negative
3750 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] Get bus speed returned negative value %i", ret_bus_speed);
3751 TEST_FAIL_MESSAGE(msg_buf);
3752 } else if ((uint32_t)ret_bus_speed > SPI_CFG_MAX_BUS_SPEED) {
3753 // If bus speed value returned by the driver is higher then requested
3754 (void)snprintf(msg_buf, sizeof(msg_buf), "[FAILED] Get bus speed returned %i bps instead of requested %i bps", ret_bus_speed, SPI_CFG_MAX_BUS_SPEED);
3755 TEST_FAIL_MESSAGE(msg_buf);
3756 } else if ((uint32_t)ret_bus_speed < ((SPI_CFG_MAX_BUS_SPEED * 3) / 4)) {
3757 // If bus speed value returned by the driver is lower then 75% of requested
3758 (void)snprintf(msg_buf, sizeof(msg_buf), "[WARNING] Get bus speed returned %i bps instead of requested %i bps", ret_bus_speed, SPI_CFG_MAX_BUS_SPEED);
3759 TEST_MESSAGE(msg_buf);
3763 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3765 \brief Function: Function SPI_Number_Of_Items
3767 The function \b SPI_Number_Of_Items verifies data exchange:
3768 - in Master Mode with default Slave Select mode
3769 - with default clock / frame format
3770 - with default data bits
3771 - with default bit order
3772 - at default bus speed
3773 - for <b>different number of items</b> (defines <c>SPI_CFG_NUM1 .. SPI_CFG_NUM5</c> in DV_SPI_Config.h)
3775 void SPI_Number_Of_Items (void) {
3777 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3778 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3779 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3780 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3781 #if (SPI_SERVER_USED == 1)
3782 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3783 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3786 #if (SPI_CFG_NUM1 != 0U)
3787 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM1);
3788 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM1);
3789 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM1);
3792 #if (SPI_CFG_NUM2 != 0U)
3793 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM2);
3794 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM2);
3795 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM2);
3798 #if (SPI_CFG_NUM3 != 0U)
3799 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM3);
3800 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM3);
3801 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM3);
3804 #if (SPI_CFG_NUM4 != 0U)
3805 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM4);
3806 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM4);
3807 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM4);
3810 #if (SPI_CFG_NUM5 != 0U)
3811 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM5);
3812 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM5);
3813 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_NUM5);
3817 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3819 \brief Function: Function SPI_GetDataCount
3821 The function \b SPI_GetDataCount verifies \b GetDataCount function (count changing) during data exchange:
3822 - in Master Mode with default Slave Select mode
3823 - with default clock / frame format
3824 - with default data bits
3825 - with default bit order
3826 - at default bus speed
3828 void SPI_GetDataCount (void) {
3830 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3831 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3832 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3833 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3834 #if (SPI_SERVER_USED == 1)
3835 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3836 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3839 SPI_DataExchange_Operation(OP_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3840 TEST_ASSERT_MESSAGE((data_count_sample != 0U) && (data_count_sample != SPI_CFG_DEF_NUM), "[FAILED] GetDataCount was not changing during the Send!");
3842 SPI_DataExchange_Operation(OP_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3843 TEST_ASSERT_MESSAGE((data_count_sample != 0U) && (data_count_sample != SPI_CFG_DEF_NUM), "[FAILED] GetDataCount was not changing during the Receive!");
3845 SPI_DataExchange_Operation(OP_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3846 TEST_ASSERT_MESSAGE((data_count_sample != 0U) && (data_count_sample != SPI_CFG_DEF_NUM), "[FAILED] GetDataCount was not changing during the Transfer!");
3849 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3851 \brief Function: Function SPI_Abort
3853 The function \b SPI_Abort verifies \b Abort function abort of data exchange:
3854 - in Master Mode with default Slave Select mode
3855 - with default clock / frame format
3856 - with default data bits
3857 - with default bit order
3858 - at default bus speed
3860 void SPI_Abort (void) {
3862 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3863 if (IsBitOrderValid() != EXIT_SUCCESS) { return; }
3864 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3865 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3866 #if (SPI_SERVER_USED == 1)
3867 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3868 if (ServerCheckSupport(MODE_SLAVE, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3871 SPI_DataExchange_Operation(OP_ABORT_SEND, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3872 SPI_DataExchange_Operation(OP_ABORT_RECEIVE, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3873 SPI_DataExchange_Operation(OP_ABORT_TRANSFER, MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_SS_MODE, SPI_CFG_DEF_BUS_SPEED, SPI_CFG_DEF_NUM);
3879 // End of spi_tests_data_xchg
3881 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3882 /* SPI Event tests */
3883 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3885 \defgroup spi_tests_evt Event
3888 These tests verify API and operation of the SPI event signaling, except ARM_SPI_EVENT_TRANSFER_COMPLETE
3889 signal which is tested in the Data Exchange tests.
3891 The event tests verify the following driver function
3892 (<a href="http://www.keil.com/pack/doc/CMSIS/Driver/html/group__spi__interface__gr.html" target="_blank">SPI Driver function documentation</a>):
3895 void (*ARM_SPI_SignalEvent_t) (uint32_t event);
3898 \note In Test Mode <b>Loopback</b> these tests are not executed
3902 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3904 \brief Function: Function SPI_DataLost
3906 The function \b SPI_DataLost verifies signaling of the <b>ARM_SPI_EVENT_DATA_LOST</b> event:
3907 - in <b>Slave Mode</b> with <b>Slave Select line Hardware monitored</b>
3908 - with default clock / frame format
3909 - with default data bits
3910 - with default bit order
3911 - at default bus speed
3913 it also checks that status data_lost flag was activated.
3915 void SPI_DataLost (void) {
3917 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3918 if (IsFormatValid() != EXIT_SUCCESS) { return; }
3919 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3920 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3921 #if (SPI_SERVER_USED == 1)
3922 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3923 if (ServerCheckSupport(MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3926 if (CmdSetCom (0U, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, 1U, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { break; }
3927 if (CmdXfer (1U, 8U, 8U, SPI_CFG_XFER_TIMEOUT) != EXIT_SUCCESS) { break; }
3928 drv->Control (ARM_SPI_MODE_INACTIVE, 0U);
3932 (void)drv->Control (ARM_SPI_MODE_SLAVE |
3933 ((SPI_CFG_DEF_FORMAT << ARM_SPI_FRAME_FORMAT_Pos) & ARM_SPI_FRAME_FORMAT_Msk) |
3934 ((SPI_CFG_DEF_DATA_BITS << ARM_SPI_DATA_BITS_Pos) & ARM_SPI_DATA_BITS_Msk) |
3935 ((SPI_CFG_DEF_BIT_ORDER << ARM_SPI_BIT_ORDER_Pos) & ARM_SPI_BIT_ORDER_Msk) |
3936 ARM_SPI_SS_SLAVE_HW ,
3939 (void)osDelay(SPI_CFG_XFER_TIMEOUT+20U); // Wait for SPI Server to timeout
3941 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
3942 (void)osDelay(20U); // Wait for SPI Server to start reception of next command
3944 // Assert that event ARM_SPI_EVENT_DATA_LOST was signaled
3945 TEST_ASSERT_MESSAGE((event & ARM_SPI_EVENT_DATA_LOST) != 0U, "[FAILED] Event ARM_SPI_EVENT_DATA_LOST was not signaled!");
3947 // Assert that status data_lost flag is active
3948 TEST_ASSERT_MESSAGE(drv->GetStatus().data_lost != 0U, "[FAILED] Status data_lost flag was not activated!");
3955 /*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
3957 \brief Function: Function SPI_ModeFault
3959 The function \b SPI_ModeFault verifies signaling of the <b>ARM_SPI_EVENT_MODE_FAULT</b> event:
3960 - in <b>Master Mode</b> with <b>Slave Select line Hardware monitored Input</b>
3961 - with default clock / frame format
3962 - with default data bits
3963 - with default bit order
3964 - at default bus speed
3966 it also checks that status mode_fault flag was activated.
3968 void SPI_ModeFault (void) {
3970 if (IsNotLoopback() != EXIT_SUCCESS) { return; }
3971 if (IsNotFrameTI() != EXIT_SUCCESS) { return; }
3972 if (IsNotFrameMw() != EXIT_SUCCESS) { return; }
3973 if (DriverInit() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3974 if (BuffersCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3975 #if (SPI_SERVER_USED == 1)
3976 if (ServerCheck() != EXIT_SUCCESS) { TEST_FAIL(); return; }
3977 if (ServerCheckSupport(MODE_MASTER, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { TEST_FAIL(); return; }
3980 if (CmdSetCom (0U, SPI_CFG_DEF_FORMAT, SPI_CFG_DEF_DATA_BITS, SPI_CFG_DEF_BIT_ORDER, 1U, SPI_CFG_DEF_BUS_SPEED) != EXIT_SUCCESS) { break; }
3981 if (CmdXfer (1U, 8U, 8U, SPI_CFG_XFER_TIMEOUT) != EXIT_SUCCESS) { break; }
3982 drv->Control (ARM_SPI_MODE_INACTIVE, 0U);
3986 (void)drv->Control (ARM_SPI_MODE_MASTER |
3987 ((SPI_CFG_DEF_FORMAT << ARM_SPI_FRAME_FORMAT_Pos) & ARM_SPI_FRAME_FORMAT_Msk) |
3988 ((SPI_CFG_DEF_DATA_BITS << ARM_SPI_DATA_BITS_Pos) & ARM_SPI_DATA_BITS_Msk) |
3989 ((SPI_CFG_DEF_BIT_ORDER << ARM_SPI_BIT_ORDER_Pos) & ARM_SPI_BIT_ORDER_Msk) |
3990 ARM_SPI_SS_MASTER_HW_INPUT ,
3991 SPI_CFG_DEF_BUS_SPEED);
3993 (void)osDelay(SPI_CFG_XFER_TIMEOUT+20U); // Wait for SPI Server to timeout
3995 (void)drv->Control(ARM_SPI_MODE_INACTIVE, 0U);
3996 (void)osDelay(20U); // Wait for SPI Server to start reception of next command
3998 // Assert that event ARM_SPI_EVENT_MODE_FAULT was signaled
3999 TEST_ASSERT_MESSAGE((event & ARM_SPI_EVENT_MODE_FAULT) != 0U, "[FAILED] Event ARM_SPI_EVENT_MODE_FAULT was not signaled!");
4001 // Assert that status mode_fault flag is active
4002 TEST_ASSERT_MESSAGE(drv->GetStatus().mode_fault != 0U, "[FAILED] Status mode_fault flag was not activated!");
4012 // End of spi_tests_evt