/***************************************************************************//** * \file cy_scb_common.h * \version 3.20 * * Provides common API declarations of the SCB driver. * ******************************************************************************** * \copyright * Copyright 2016-2021 Cypress Semiconductor Corporation * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ /** * \addtogroup group_scb * \{ * The Serial Communications Block (SCB) supports three serial communication * protocols: Serial Peripheral Interface (SPI), Universal Asynchronous Receiver * Transmitter (UART), and Inter Integrated Circuit (I2C or IIC). Only one of * the protocols is supported by an SCB at any given time. * * The functions and other declarations used in this driver are in cy_scb_spi.h, * cy_scb_uart.h, cy_scb_ezi2c.h, cy_scb_i2c.h respectively. Include cy_pdl.h * to get access to all functions and declarations in the PDL. * \defgroup group_scb_common Common * \defgroup group_scb_ezi2c EZI2C (SCB) * \defgroup group_scb_i2c I2C (SCB) * \defgroup group_scb_spi SPI (SCB) * \defgroup group_scb_uart UART (SCB) * \} */ /** * \addtogroup group_scb * \{ * ******************************************************************************** * \section group_scb_more_information More Information ******************************************************************************** * For more information on the SCB peripheral, refer to the technical reference * manual (TRM). * ******************************************************************************* * \section group_scb_common_changelog Changelog ******************************************************************************* *
| Version | Changes | Reason for Change |
|---|---|---|
| 3.20 | *Added APIs \ref Cy_SCB_UART_EnableSingleWireHalfDuplex, \ref Cy_SCB_UART_DisableSingleWireHalfDuplex. * - Updated struct \ref cy_stc_scb_uart_config_t. * | *UART half duplex mode implementation. Bug fixes. | *
| Added API \ref Cy_SCB_SPI_Transfer_Buffer and new macros. * - Updated struct \ref cy_stc_scb_spi_context_t. | *Added support for SPI transfer with different length and bug fixes for buffer transfer with different sizes. | *|
| 3.10.1 | *Minor documentation updates. | *Documentation enhancement. | *
| 3.10 | *Fixed MISRA 2012 violations. | *MISRA 2012 compliance. | *
| 3.0 | *Updated \ref Cy_SCB_SPI_Init and other internal data handling functions to handle wide range of data widths. | *Defect fixing. | *
| Minor documentation updates. | *Documentation enhancement. | *|
| 2.90 | *A new API, \ref Cy_SCB_SetEzI2CMode, has been added to help set the hardware EZ mode for the I2C protocol. | *The HW EZ Mode for the I2C protocol can be enabled or disabled. | *
| Newly added APIs \ref Cy_SCB_I2C_SetStretchThreshold to set the stretch threshold value, * \ref Cy_SCB_I2C_GetStretchCount to get the stretch count, * \ref Cy_SCB_I2C_IsStretchDetected to detect if I2C SCL is stretched, * \ref Cy_SCB_I2C_IsSyncDetected to check if synchronization is detected on I2C SCL. * \ref Cy_SCB_I2C_IsStretching to check if DUT is stretching the I2C SCL. | *New device support. | *|
| 2.80 | *Updated the behaviour of \ref Cy_SCB_UART_SetEnableMsbFirst and \ref Cy_SCB_UART_GetEnableMsbFirst functions. * Now the value of enableMsbFirst is being set and fetched correctly. * | Defect fixing. | *
| 2.70 | *Newly added API's for runtime parameter set/get functionality which include * \ref Cy_SCB_UART_SetOverSample to set oversample bits of UART, * \ref Cy_SCB_UART_GetOverSample to add return value of oversample, * \ref Cy_SCB_UART_GetDataWidth to get data width, * \ref Cy_SCB_UART_SetDataWidth to set data width, * \ref Cy_SCB_UART_GetParity to get parity, * \ref Cy_SCB_UART_SetParity to set parity, * \ref Cy_SCB_UART_GetStopBits to get stop bits, * \ref Cy_SCB_UART_SetStopBits to set stop bits, * \ref Cy_SCB_UART_GetDropOnParityError to get drop on parity error, * \ref Cy_SCB_UART_SetDropOnParityError to set drop on parity error, * \ref Cy_SCB_UART_GetEnableMsbFirst to get enable MSB first and * \ref Cy_SCB_UART_SetEnableMsbFirst to set enable MSB first. | *Runtime Parameter update. | *
| Newly added API's which include * \ref Cy_SCB_Get_RxDataWidth to return the RX data width, * \ref Cy_SCB_Get_TxDataWidth to return the TX data width, * \ref Cy_SCB_SetMemWidth to set the RX and TX FIFOs byte mode/halfword/word mode. * Updated Structures \ref cy_stc_scb_uart_config_t, \ref cy_en_scb_spi_parity_t, \ref cy_stc_scb_spi_config_t. | *New device support. | *|
| 2.60 | *Fixed the \ref Cy_SCB_UART_GetNumInRingBuffer function to * return correct number of the elements in ring buffer. | *\ref Cy_SCB_UART_GetNumInRingBuffer function works incorrectly, when * write pointer of the ring buffer is behind the read pointer. | *
| Fixed/Documented MISRA 2012 violations. | *MISRA 2012 compliance. | *|
| 2.50 | *Fixed the \ref Cy_SCB_SPI_SetActiveSlaveSelectPolarity function to * properly configure the polarity of the slave select line. | *\ref Cy_SCB_SPI_SetActiveSlaveSelectPolarity function works incorrectly. | *
| 2.40.2 | *Minor documentation updates. | *Documentation enhancement. | *
| 2.40 | *Update level selection logic of RX FIFO trigger in the Cy_SCB_UART_Receive(). | *Fix possible stuck if the RTS level is less than the RX FIFO level. | *
| Exclude self-test assertion macros under release build profile. | *Avoid dependency on CY_ASSERT macro implementation. | *|
| 2.30.1 | *Added header guards CY_IP_MXSCB. | *To enable the PDL compilation with wounded out IP blocks. | *
| 2.30 | *Fixed MISRA violation. | *MISRA compliance. | *
| Changed values CY_SCB_SPI_CPHA0_CPOL1 and CY_SCB_SPI_CPHA1_CPOL0 in enum \ref cy_en_scb_spi_sclk_mode_t. | *The incorrect values in \ref cy_en_scb_spi_sclk_mode_t caused incorrect initialization of the combination of * phases and polarity: "CHPA = 0, CPOL = 1" and "CHPA = 1, CPOL = 0". * | *|
| Added new CY_SCB_UART_RECEIVE_NOT_EMTPY and CY_SCB_UART_TRANSMIT_EMTPY callback events \ref group_scb_uart_macros_callback_events. | *Extended the driver callback events to support the MBED-OS. | *|
| Merged SCB changelogs for each mode into one changelog. | *Changelog optimization. | *|
| Merged SCB MISRA-C Compliance sections for each mode into one section. | *To optimize the SCB MISRA-C Compliance sections. | *|
| 2.20.1 | *Documentation of the MISRA rule violation. | *MISRA compliance. | *
| 2.20 | *Flattened the organization of the driver source code into the single * source directory and the single include directory. * | *Driver library directory-structure simplification. | *
| Added register access layer. Use register access macros instead * of direct register access using dereferenced pointers. | *Makes register access device-independent, so that the PDL does * not need to be recompiled for each supported part number. | *|
| Added the enableDigitalFilter, highPhaseDutyCycle and lowPhaseDutyCycle * fields to the \ref cy_stc_scb_i2c_config_t configuration structure. * | *Added the I2C master data rate configuration using the configuration structure. * | *|
| Fixed the \ref Cy_SCB_I2C_SetDataRate function to properly configure data rates * greater than 400 kbps in Master and Master-Slave modes. \n * Added verification that clk_scb is within the valid range for the desired data rate. * | *The analog filter was enabled for all data rates in Master and Master-Slave modes. * This prevents reaching the maximum supported data rate of 1000 kbps which requires a digital filter. * | *|
| 2.10 | *Fixed the ReStart condition generation sequence for a write * transaction in the \ref Cy_SCB_I2C_MasterWrite function. | *The driver can notify about a zero length write transaction completion * before the address byte is sent if the \ref Cy_SCB_I2C_MasterWrite * function execution was interrupted between setting the restart * generation command and writing the address byte into the TX FIFO. | *
| Added the slave- and master-specific interrupt functions: * \ref Cy_SCB_I2C_SlaveInterrupt and \ref Cy_SCB_I2C_MasterInterrupt. * | *Improved the interrupt configuration options for the I2C slave and * master mode configurations. | *|
| Updated the Start condition generation sequence in the \ref * Cy_SCB_I2C_MasterWrite and \ref Cy_SCB_I2C_MasterRead. | ** | |
| Updated the ReStart condition generation sequence for a write * transaction in the \ref Cy_SCB_I2C_MasterSendReStart function. | ** | |
| 2.0 | *Added parameters validation for public API. * | * |
| Fixed functions which return interrupt status to return only defined * set of interrupt statuses. | ** | |
| Added missing "cy_cb_" to the callback function type names. | ** | |
| Replaced variables that have limited range of values with enumerated * types. | ** | |
| Added function \ref Cy_SCB_UART_SendBreakBlocking for break condition * generation. | ** | |
| Fixed low power callbacks \ref Cy_SCB_UART_DeepSleepCallback and * \ref Cy_SCB_UART_HibernateCallback to prevent the device from entering * low power mode when RX FIFO is not empty. | *The callbacks allowed entering device into low power mode when RX FIFO * had data. | *|
| Fixed SPI callback notification when error event occurred. | *The SPI callback passed incorrect event value if error event occurred. | *|
| Fixed the \ref Cy_SCB_I2C_MasterSendReStart function to properly * generate the ReStart condition when the previous transaction was * a write. | *The master interpreted the address byte written into the TX FIFO as a * data byte and continued a write transaction. The ReStart condition was * generated after the master completed transferring the data byte. * The SCL line was stretched by the master waiting for the address byte * to be written into the TX FIFO after the ReStart condition generation. * The following timeout detection released the bus from the master * control. | *|
| Fixed the slave operation after the address byte was NACKed by the * firmware. | *The observed slave operation failure depends on whether Level 2 assert * is enabled or not. Enabled: the device stuck in the fault handler due * to the assert assignment in the \ref Cy_SCB_I2C_Interrupt. Disabled: * the slave sets the transaction completion status and notifies on the * transaction completion event after the address was NACKed. The failure * is observed only when the slave is configured to accept an address in * the RX FIFO. | *|
| 1.0 | *Initial version. | ** |