![]() |
|
|||
File indexing completed on 2025-05-11 08:22:59
0001 /* 0002 * Copyright (c) 2016, Freescale Semiconductor, Inc. 0003 * Copyright 2016-2021, 2022 NXP 0004 * All rights reserved. 0005 * 0006 * SPDX-License-Identifier: BSD-3-Clause 0007 */ 0008 0009 #ifndef _FSL_FLEXIO_MCULCD_H_ 0010 #define _FSL_FLEXIO_MCULCD_H_ 0011 0012 #include "fsl_common.h" 0013 #include "fsl_flexio.h" 0014 0015 /*! 0016 * @addtogroup flexio_mculcd 0017 * @{ 0018 */ 0019 0020 /******************************************************************************* 0021 * Definitions 0022 ******************************************************************************/ 0023 0024 /*! @name Driver version */ 0025 /*@{*/ 0026 /*! @brief FlexIO MCULCD driver version. */ 0027 #define FSL_FLEXIO_MCULCD_DRIVER_VERSION (MAKE_VERSION(2, 0, 7)) 0028 /*@}*/ 0029 0030 #ifndef FLEXIO_MCULCD_WAIT_COMPLETE_TIME 0031 /*! 0032 * @brief The delay time to wait for FLEXIO transmit complete. 0033 * 0034 * Currently there is no method to detect whether the data has been 0035 * sent out from the shifter, so the driver use a software delay for this. When 0036 * the data is written to shifter buffer, the driver call the delay 0037 * function to wait for the data shift out. 0038 * If this value is too small, then the last few bytes might be lost when writing 0039 * data using interrupt method or DMA method. 0040 */ 0041 #define FLEXIO_MCULCD_WAIT_COMPLETE_TIME 512 0042 #endif 0043 0044 #ifndef FLEXIO_MCULCD_DATA_BUS_WIDTH 0045 /*! 0046 * @brief The data bus width, must be 8 or 16. 0047 */ 0048 #define FLEXIO_MCULCD_DATA_BUS_WIDTH 16UL 0049 #endif 0050 0051 #if (16UL != FLEXIO_MCULCD_DATA_BUS_WIDTH) && (8UL != FLEXIO_MCULCD_DATA_BUS_WIDTH) 0052 #error Only support data bus 8-bit or 16-bit 0053 #endif 0054 0055 /*! @brief FlexIO LCD transfer status */ 0056 enum 0057 { 0058 kStatus_FLEXIO_MCULCD_Idle = MAKE_STATUS(kStatusGroup_FLEXIO_MCULCD, 0), /*!< FlexIO LCD is idle. */ 0059 kStatus_FLEXIO_MCULCD_Busy = MAKE_STATUS(kStatusGroup_FLEXIO_MCULCD, 1), /*!< FlexIO LCD is busy */ 0060 kStatus_FLEXIO_MCULCD_Error = MAKE_STATUS(kStatusGroup_FLEXIO_MCULCD, 2), /*!< FlexIO LCD error occurred */ 0061 }; 0062 0063 /*! @brief Define FlexIO MCULCD pixel format. */ 0064 typedef enum _flexio_mculcd_pixel_format 0065 { 0066 kFLEXIO_MCULCD_RGB565 = 0, /*!< RGB565, 16-bit. */ 0067 kFLEXIO_MCULCD_BGR565, /*!< BGR565, 16-bit. */ 0068 kFLEXIO_MCULCD_RGB888, /*!< RGB888, 24-bit. */ 0069 kFLEXIO_MCULCD_BGR888, /*!< BGR888, 24-bit. */ 0070 } flexio_mculcd_pixel_format_t; 0071 0072 /*! @brief Define FlexIO MCULCD bus type. */ 0073 typedef enum _flexio_mculcd_bus 0074 { 0075 kFLEXIO_MCULCD_8080, /*!< Using Intel 8080 bus. */ 0076 kFLEXIO_MCULCD_6800, /*!< Using Motorola 6800 bus. */ 0077 } flexio_mculcd_bus_t; 0078 0079 /*! @brief Define FlexIO MCULCD interrupt mask. */ 0080 enum _flexio_mculcd_interrupt_enable 0081 { 0082 kFLEXIO_MCULCD_TxEmptyInterruptEnable = (1U << 0U), /*!< Transmit buffer empty interrupt enable. */ 0083 kFLEXIO_MCULCD_RxFullInterruptEnable = (1U << 1U), /*!< Receive buffer full interrupt enable. */ 0084 }; 0085 0086 /*! @brief Define FlexIO MCULCD status mask. */ 0087 enum _flexio_mculcd_status_flags 0088 { 0089 kFLEXIO_MCULCD_TxEmptyFlag = (1U << 0U), /*!< Transmit buffer empty flag. */ 0090 kFLEXIO_MCULCD_RxFullFlag = (1U << 1U), /*!< Receive buffer full flag. */ 0091 }; 0092 0093 /*! @brief Define FlexIO MCULCD DMA mask. */ 0094 enum _flexio_mculcd_dma_enable 0095 { 0096 kFLEXIO_MCULCD_TxDmaEnable = 0x1U, /*!< Tx DMA request source */ 0097 kFLEXIO_MCULCD_RxDmaEnable = 0x2U, /*!< Rx DMA request source */ 0098 }; 0099 0100 /*! @brief Function to set or clear the CS and RS pin. */ 0101 typedef void (*flexio_mculcd_pin_func_t)(bool set); 0102 0103 /*! @brief Define FlexIO MCULCD access structure typedef. */ 0104 typedef struct _flexio_mculcd_type 0105 { 0106 FLEXIO_Type *flexioBase; /*!< FlexIO base pointer. */ 0107 flexio_mculcd_bus_t busType; /*!< The bus type, 8080 or 6800. */ 0108 uint8_t dataPinStartIndex; /*!< Start index of the data pin, the FlexIO pin dataPinStartIndex 0109 to (dataPinStartIndex + FLEXIO_MCULCD_DATA_BUS_WIDTH -1) 0110 will be used for data transfer. Only support data bus width 8 and 16. */ 0111 uint8_t ENWRPinIndex; /*!< Pin select for WR(8080 mode), EN(6800 mode). */ 0112 uint8_t RDPinIndex; /*!< Pin select for RD(8080 mode), not used in 6800 mode. */ 0113 uint8_t txShifterStartIndex; /*!< Start index of shifters used for data write, it must be 0 or 4. */ 0114 uint8_t txShifterEndIndex; /*!< End index of shifters used for data write. */ 0115 uint8_t rxShifterStartIndex; /*!< Start index of shifters used for data read. */ 0116 uint8_t rxShifterEndIndex; /*!< End index of shifters used for data read, it must be 3 or 7. */ 0117 uint8_t timerIndex; /*!< Timer index used in FlexIO MCULCD. */ 0118 flexio_mculcd_pin_func_t setCSPin; /*!< Function to set or clear the CS pin. */ 0119 flexio_mculcd_pin_func_t setRSPin; /*!< Function to set or clear the RS pin. */ 0120 flexio_mculcd_pin_func_t setRDWRPin; /*!< Function to set or clear the RD/WR pin, only used in 6800 mode. */ 0121 } FLEXIO_MCULCD_Type; 0122 0123 /*! @brief Define FlexIO MCULCD configuration structure. */ 0124 typedef struct _flexio_mculcd_config 0125 { 0126 bool enable; /*!< Enable/disable FlexIO MCULCD after configuration. */ 0127 bool enableInDoze; /*!< Enable/disable FlexIO operation in doze mode. */ 0128 bool enableInDebug; /*!< Enable/disable FlexIO operation in debug mode. */ 0129 bool enableFastAccess; /*!< Enable/disable fast access to FlexIO registers, 0130 fast access requires the FlexIO clock to be at least 0131 twice the frequency of the bus clock. */ 0132 uint32_t baudRate_Bps; /*!< Baud rate in Bps. */ 0133 } flexio_mculcd_config_t; 0134 0135 /*! @brief Transfer mode.*/ 0136 typedef enum _flexio_mculcd_transfer_mode 0137 { 0138 kFLEXIO_MCULCD_ReadArray, /*!< Read data into an array. */ 0139 kFLEXIO_MCULCD_WriteArray, /*!< Write data from an array. */ 0140 kFLEXIO_MCULCD_WriteSameValue, /*!< Write the same value many times. */ 0141 } flexio_mculcd_transfer_mode_t; 0142 0143 /*! @brief Define FlexIO MCULCD transfer structure. */ 0144 typedef struct _flexio_mculcd_transfer 0145 { 0146 uint32_t command; /*!< Command to send. */ 0147 flexio_mculcd_transfer_mode_t mode; /*!< Transfer mode. */ 0148 uint32_t dataAddrOrSameValue; /*!< When sending the same value for many times, 0149 this is the value to send. When writing or reading array, 0150 this is the address of the data array. */ 0151 size_t dataSize; /*!< How many bytes to transfer. */ 0152 } flexio_mculcd_transfer_t; 0153 0154 /*! @brief typedef for flexio_mculcd_handle_t in advance. */ 0155 typedef struct _flexio_mculcd_handle flexio_mculcd_handle_t; 0156 0157 /*! @brief FlexIO MCULCD callback for finished transfer. 0158 * 0159 * When transfer finished, the callback function is called and returns the 0160 * @p status as kStatus_FLEXIO_MCULCD_Idle. 0161 */ 0162 typedef void (*flexio_mculcd_transfer_callback_t)(FLEXIO_MCULCD_Type *base, 0163 flexio_mculcd_handle_t *handle, 0164 status_t status, 0165 void *userData); 0166 0167 /*! @brief Define FlexIO MCULCD handle structure. */ 0168 struct _flexio_mculcd_handle 0169 { 0170 uint32_t dataAddrOrSameValue; /*!< When sending the same value for many times, 0171 this is the value to send. When writing or reading array, 0172 this is the address of the data array. */ 0173 size_t dataCount; /*!< Total count to be transferred. */ 0174 volatile size_t remainingCount; /*!< Remaining count to transfer. */ 0175 volatile uint32_t state; /*!< FlexIO MCULCD internal state. */ 0176 flexio_mculcd_transfer_callback_t completionCallback; /*!< FlexIO MCULCD transfer completed callback. */ 0177 void *userData; /*!< Callback parameter. */ 0178 }; 0179 0180 /******************************************************************************* 0181 * API 0182 ******************************************************************************/ 0183 0184 #if defined(__cplusplus) 0185 extern "C" { 0186 #endif /*_cplusplus*/ 0187 0188 /*! 0189 * @name FlexIO MCULCD Configuration 0190 * @{ 0191 */ 0192 0193 /*! 0194 * @brief Ungates the FlexIO clock, resets the FlexIO module, configures the 0195 * FlexIO MCULCD hardware, and configures the FlexIO MCULCD with FlexIO MCULCD 0196 * configuration. 0197 * The configuration structure can be filled by the user, or be set with default 0198 * values 0199 * by the @ref FLEXIO_MCULCD_GetDefaultConfig. 0200 * 0201 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0202 * @param config Pointer to the flexio_mculcd_config_t structure. 0203 * @param srcClock_Hz FlexIO source clock in Hz. 0204 * @retval kStatus_Success Initialization success. 0205 * @retval kStatus_InvalidArgument Initialization failed because of invalid 0206 * argument. 0207 */ 0208 status_t FLEXIO_MCULCD_Init(FLEXIO_MCULCD_Type *base, flexio_mculcd_config_t *config, uint32_t srcClock_Hz); 0209 0210 /*! 0211 * @brief Resets the FLEXIO_MCULCD timer and shifter configuration. 0212 * 0213 * @param base Pointer to the FLEXIO_MCULCD_Type. 0214 */ 0215 void FLEXIO_MCULCD_Deinit(FLEXIO_MCULCD_Type *base); 0216 0217 /*! 0218 * @brief Gets the default configuration to configure the FlexIO MCULCD. 0219 * 0220 * The default configuration value is: 0221 * @code 0222 * config->enable = true; 0223 * config->enableInDoze = false; 0224 * config->enableInDebug = true; 0225 * config->enableFastAccess = true; 0226 * config->baudRate_Bps = 96000000U; 0227 * @endcode 0228 * @param config Pointer to the flexio_mculcd_config_t structure. 0229 */ 0230 void FLEXIO_MCULCD_GetDefaultConfig(flexio_mculcd_config_t *config); 0231 0232 /*@}*/ 0233 0234 /*! 0235 * @name Status 0236 * @{ 0237 */ 0238 0239 /*! 0240 * @brief Gets FlexIO MCULCD status flags. 0241 * 0242 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0243 * @return status flag; OR'ed value or the @ref _flexio_mculcd_status_flags. 0244 * 0245 * @note Don't use this function with DMA APIs. 0246 */ 0247 uint32_t FLEXIO_MCULCD_GetStatusFlags(FLEXIO_MCULCD_Type *base); 0248 0249 /*! 0250 * @brief Clears FlexIO MCULCD status flags. 0251 * 0252 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0253 * @param mask Status to clear, it is the OR'ed value of @ref 0254 * _flexio_mculcd_status_flags. 0255 * 0256 * @note Don't use this function with DMA APIs. 0257 */ 0258 void FLEXIO_MCULCD_ClearStatusFlags(FLEXIO_MCULCD_Type *base, uint32_t mask); 0259 0260 /*@}*/ 0261 0262 /*! 0263 * @name Interrupts 0264 * @{ 0265 */ 0266 0267 /*! 0268 * @brief Enables the FlexIO MCULCD interrupt. 0269 * 0270 * This function enables the FlexIO MCULCD interrupt. 0271 * 0272 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0273 * @param mask Interrupts to enable, it is the OR'ed value of @ref 0274 * _flexio_mculcd_interrupt_enable. 0275 */ 0276 void FLEXIO_MCULCD_EnableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask); 0277 0278 /*! 0279 * @brief Disables the FlexIO MCULCD interrupt. 0280 * 0281 * This function disables the FlexIO MCULCD interrupt. 0282 * 0283 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0284 * @param mask Interrupts to disable, it is the OR'ed value of @ref 0285 * _flexio_mculcd_interrupt_enable. 0286 */ 0287 void FLEXIO_MCULCD_DisableInterrupts(FLEXIO_MCULCD_Type *base, uint32_t mask); 0288 0289 /*@}*/ 0290 0291 /*! 0292 * @name DMA Control 0293 * @{ 0294 */ 0295 0296 /*! 0297 * @brief Enables/disables the FlexIO MCULCD transmit DMA. 0298 * 0299 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0300 * @param enable True means enable DMA, false means disable DMA. 0301 */ 0302 static inline void FLEXIO_MCULCD_EnableTxDMA(FLEXIO_MCULCD_Type *base, bool enable) 0303 { 0304 FLEXIO_EnableShifterStatusDMA(base->flexioBase, (1UL << base->txShifterStartIndex), enable); 0305 } 0306 0307 /*! 0308 * @brief Enables/disables the FlexIO MCULCD receive DMA. 0309 * 0310 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0311 * @param enable True means enable DMA, false means disable DMA. 0312 */ 0313 static inline void FLEXIO_MCULCD_EnableRxDMA(FLEXIO_MCULCD_Type *base, bool enable) 0314 { 0315 FLEXIO_EnableShifterStatusDMA(base->flexioBase, (1UL << base->rxShifterEndIndex), enable); 0316 } 0317 0318 /*! 0319 * @brief Gets the FlexIO MCULCD transmit data register address. 0320 * 0321 * This function returns the MCULCD data register address, which is mainly used 0322 * by DMA/eDMA. 0323 * 0324 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0325 * @return FlexIO MCULCD transmit data register address. 0326 */ 0327 static inline uint32_t FLEXIO_MCULCD_GetTxDataRegisterAddress(FLEXIO_MCULCD_Type *base) 0328 { 0329 return (uint32_t) & (base->flexioBase->SHIFTBUF[base->txShifterStartIndex]); 0330 } 0331 0332 /*! 0333 * @brief Gets the FlexIO MCULCD receive data register address. 0334 * 0335 * This function returns the MCULCD data register address, which is mainly used 0336 * by DMA/eDMA. 0337 * 0338 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0339 * @return FlexIO MCULCD receive data register address. 0340 */ 0341 static inline uint32_t FLEXIO_MCULCD_GetRxDataRegisterAddress(FLEXIO_MCULCD_Type *base) 0342 { 0343 return (uint32_t) & (base->flexioBase->SHIFTBUF[base->rxShifterStartIndex]); 0344 } 0345 0346 /*@}*/ 0347 0348 /*! 0349 * @name Bus Operations 0350 * @{ 0351 */ 0352 0353 /*! 0354 * @brief Set desired baud rate. 0355 * 0356 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0357 * @param baudRate_Bps Desired baud rate. 0358 * @param srcClock_Hz FLEXIO clock frequency in Hz. 0359 * @retval kStatus_Success Set successfully. 0360 * @retval kStatus_InvalidArgument Could not set the baud rate. 0361 */ 0362 status_t FLEXIO_MCULCD_SetBaudRate(FLEXIO_MCULCD_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz); 0363 0364 /*! 0365 * @brief Configures the FLEXIO MCULCD to multiple beats write mode. 0366 * 0367 * At the begining multiple beats write operation, the FLEXIO MCULCD is configured to 0368 * multiple beats write mode using this function. After write operation, the configuration 0369 * is cleared by @ref FLEXIO_MCULCD_ClearSingleBeatWriteConfig. 0370 * 0371 * @param base Pointer to the FLEXIO_MCULCD_Type. 0372 * 0373 * @note This is an internal used function, upper layer should not use. 0374 */ 0375 void FLEXIO_MCULCD_SetSingleBeatWriteConfig(FLEXIO_MCULCD_Type *base); 0376 0377 /*! 0378 * @brief Clear the FLEXIO MCULCD multiple beats write mode configuration. 0379 * 0380 * Clear the write configuration set by @ref FLEXIO_MCULCD_SetSingleBeatWriteConfig. 0381 * 0382 * @param base Pointer to the FLEXIO_MCULCD_Type. 0383 * 0384 * @note This is an internal used function, upper layer should not use. 0385 */ 0386 void FLEXIO_MCULCD_ClearSingleBeatWriteConfig(FLEXIO_MCULCD_Type *base); 0387 0388 /*! 0389 * @brief Configures the FLEXIO MCULCD to multiple beats read mode. 0390 * 0391 * At the begining or multiple beats read operation, the FLEXIO MCULCD is configured 0392 * to multiple beats read mode using this function. After read operation, the configuration 0393 * is cleared by @ref FLEXIO_MCULCD_ClearSingleBeatReadConfig. 0394 * 0395 * @param base Pointer to the FLEXIO_MCULCD_Type. 0396 * 0397 * @note This is an internal used function, upper layer should not use. 0398 */ 0399 void FLEXIO_MCULCD_SetSingleBeatReadConfig(FLEXIO_MCULCD_Type *base); 0400 0401 /*! 0402 * @brief Clear the FLEXIO MCULCD multiple beats read mode configuration. 0403 * 0404 * Clear the read configuration set by @ref FLEXIO_MCULCD_SetSingleBeatReadConfig. 0405 * 0406 * @param base Pointer to the FLEXIO_MCULCD_Type. 0407 * 0408 * @note This is an internal used function, upper layer should not use. 0409 */ 0410 void FLEXIO_MCULCD_ClearSingleBeatReadConfig(FLEXIO_MCULCD_Type *base); 0411 0412 /*! 0413 * @brief Configures the FLEXIO MCULCD to multiple beats write mode. 0414 * 0415 * At the begining multiple beats write operation, the FLEXIO MCULCD is configured to 0416 * multiple beats write mode using this function. After write operation, the configuration 0417 * is cleared by FLEXIO_MCULCD_ClearMultBeatsWriteConfig. 0418 * 0419 * @param base Pointer to the FLEXIO_MCULCD_Type. 0420 * 0421 * @note This is an internal used function, upper layer should not use. 0422 */ 0423 void FLEXIO_MCULCD_SetMultiBeatsWriteConfig(FLEXIO_MCULCD_Type *base); 0424 0425 /*! 0426 * @brief Clear the FLEXIO MCULCD multiple beats write mode configuration. 0427 * 0428 * Clear the write configuration set by FLEXIO_MCULCD_SetMultBeatsWriteConfig. 0429 * 0430 * @param base Pointer to the FLEXIO_MCULCD_Type. 0431 * 0432 * @note This is an internal used function, upper layer should not use. 0433 */ 0434 void FLEXIO_MCULCD_ClearMultiBeatsWriteConfig(FLEXIO_MCULCD_Type *base); 0435 0436 /*! 0437 * @brief Configures the FLEXIO MCULCD to multiple beats read mode. 0438 * 0439 * At the begining or multiple beats read operation, the FLEXIO MCULCD is configured 0440 * to multiple beats read mode using this function. After read operation, the configuration 0441 * is cleared by FLEXIO_MCULCD_ClearMultBeatsReadConfig. 0442 * 0443 * @param base Pointer to the FLEXIO_MCULCD_Type. 0444 * 0445 * @note This is an internal used function, upper layer should not use. 0446 */ 0447 void FLEXIO_MCULCD_SetMultiBeatsReadConfig(FLEXIO_MCULCD_Type *base); 0448 0449 /*! 0450 * @brief Clear the FLEXIO MCULCD multiple beats read mode configuration. 0451 * 0452 * Clear the read configuration set by FLEXIO_MCULCD_SetMultBeatsReadConfig. 0453 * 0454 * @param base Pointer to the FLEXIO_MCULCD_Type. 0455 * 0456 * @note This is an internal used function, upper layer should not use. 0457 */ 0458 void FLEXIO_MCULCD_ClearMultiBeatsReadConfig(FLEXIO_MCULCD_Type *base); 0459 0460 /*! 0461 * @brief Enables/disables the FlexIO MCULCD module operation. 0462 * 0463 * @param base Pointer to the FLEXIO_MCULCD_Type. 0464 * @param enable True to enable, false does not have any effect. 0465 */ 0466 static inline void FLEXIO_MCULCD_Enable(FLEXIO_MCULCD_Type *base, bool enable) 0467 { 0468 if (enable) 0469 { 0470 FLEXIO_Enable(base->flexioBase, enable); 0471 } 0472 } 0473 0474 /*! 0475 * @brief Read data from the FLEXIO MCULCD RX shifter buffer. 0476 * 0477 * Read data from the RX shift buffer directly, it does no check whether the 0478 * buffer is empty or not. 0479 * 0480 * If the data bus width is 8-bit: 0481 * @code 0482 * uint8_t value; 0483 * value = (uint8_t)FLEXIO_MCULCD_ReadData(base); 0484 * @endcode 0485 * 0486 * If the data bus width is 16-bit: 0487 * @code 0488 * uint16_t value; 0489 * value = (uint16_t)FLEXIO_MCULCD_ReadData(base); 0490 * @endcode 0491 * 0492 * @note This function returns the RX shifter buffer value (32-bit) directly. 0493 * The return value should be converted according to data bus width. 0494 * 0495 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0496 * @return The data read out. 0497 * 0498 * @note Don't use this function with DMA APIs. 0499 */ 0500 uint32_t FLEXIO_MCULCD_ReadData(FLEXIO_MCULCD_Type *base); 0501 0502 /*! 0503 * @brief Write data into the FLEXIO MCULCD TX shifter buffer. 0504 * 0505 * Write data into the TX shift buffer directly, it does no check whether the 0506 * buffer is full or not. 0507 * 0508 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0509 * @param data The data to write. 0510 * 0511 * @note Don't use this function with DMA APIs. 0512 */ 0513 static inline void FLEXIO_MCULCD_WriteData(FLEXIO_MCULCD_Type *base, uint32_t data) 0514 { 0515 base->flexioBase->SHIFTBUF[base->txShifterStartIndex] = data; 0516 } 0517 0518 /*! 0519 * @brief Assert the nCS to start transfer. 0520 * 0521 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0522 */ 0523 static inline void FLEXIO_MCULCD_StartTransfer(FLEXIO_MCULCD_Type *base) 0524 { 0525 base->setCSPin(false); 0526 } 0527 0528 /*! 0529 * @brief De-assert the nCS to stop transfer. 0530 * 0531 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0532 */ 0533 static inline void FLEXIO_MCULCD_StopTransfer(FLEXIO_MCULCD_Type *base) 0534 { 0535 base->setCSPin(true); 0536 } 0537 0538 /*! 0539 * @brief Wait for transmit data send out finished. 0540 * 0541 * Currently there is no effective method to wait for the data send out 0542 * from the shiter, so here use a while loop to wait. 0543 * 0544 * @note This is an internal used function. 0545 */ 0546 void FLEXIO_MCULCD_WaitTransmitComplete(void); 0547 0548 /*! 0549 * @brief Send command in blocking way. 0550 * 0551 * This function sends the command and returns when the command has been sent 0552 * out. 0553 * 0554 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0555 * @param command The command to send. 0556 */ 0557 void FLEXIO_MCULCD_WriteCommandBlocking(FLEXIO_MCULCD_Type *base, uint32_t command); 0558 0559 /*! 0560 * @brief Send data array in blocking way. 0561 * 0562 * This function sends the data array and returns when the data sent out. 0563 * 0564 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0565 * @param data The data array to send. 0566 * @param size How many bytes to write. 0567 */ 0568 void FLEXIO_MCULCD_WriteDataArrayBlocking(FLEXIO_MCULCD_Type *base, const void *data, size_t size); 0569 0570 /*! 0571 * @brief Read data into array in blocking way. 0572 * 0573 * This function reads the data into array and returns when the data read 0574 * finished. 0575 * 0576 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0577 * @param data The array to save the data. 0578 * @param size How many bytes to read. 0579 */ 0580 void FLEXIO_MCULCD_ReadDataArrayBlocking(FLEXIO_MCULCD_Type *base, void *data, size_t size); 0581 0582 /*! 0583 * @brief Send the same value many times in blocking way. 0584 * 0585 * This function sends the same value many times. It could be used to clear the 0586 * LCD screen. If the data bus width is 8, this function will send LSB 8 bits of 0587 * @p sameValue for @p size times. If the data bus is 16, this function will send 0588 * LSB 16 bits of @p sameValue for @p size / 2 times. 0589 * 0590 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0591 * @param sameValue The same value to send. 0592 * @param size How many bytes to send. 0593 */ 0594 void FLEXIO_MCULCD_WriteSameValueBlocking(FLEXIO_MCULCD_Type *base, uint32_t sameValue, size_t size); 0595 0596 /*! 0597 * @brief Performs a polling transfer. 0598 * 0599 * @note The API does not return until the transfer finished. 0600 * 0601 * @param base pointer to FLEXIO_MCULCD_Type structure. 0602 * @param xfer pointer to flexio_mculcd_transfer_t structure. 0603 */ 0604 void FLEXIO_MCULCD_TransferBlocking(FLEXIO_MCULCD_Type *base, flexio_mculcd_transfer_t *xfer); 0605 /*@}*/ 0606 0607 /*! 0608 * @name Transactional 0609 * @{ 0610 */ 0611 0612 /*! 0613 * @brief Initializes the FlexIO MCULCD handle, which is used in transactional 0614 * functions. 0615 * 0616 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0617 * @param handle Pointer to the flexio_mculcd_handle_t structure to store the 0618 * transfer state. 0619 * @param callback The callback function. 0620 * @param userData The parameter of the callback function. 0621 * @retval kStatus_Success Successfully create the handle. 0622 * @retval kStatus_OutOfRange The FlexIO type/handle/ISR table out of range. 0623 */ 0624 status_t FLEXIO_MCULCD_TransferCreateHandle(FLEXIO_MCULCD_Type *base, 0625 flexio_mculcd_handle_t *handle, 0626 flexio_mculcd_transfer_callback_t callback, 0627 void *userData); 0628 0629 /*! 0630 * @brief Transfer data using IRQ. 0631 * 0632 * This function sends data using IRQ. This is a non-blocking function, which 0633 * returns right away. When all data is sent out/received, the callback 0634 * function is called. 0635 * 0636 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0637 * @param handle Pointer to the flexio_mculcd_handle_t structure to store the 0638 * transfer state. 0639 * @param xfer FlexIO MCULCD transfer structure. See #flexio_mculcd_transfer_t. 0640 * @retval kStatus_Success Successfully start a transfer. 0641 * @retval kStatus_InvalidArgument Input argument is invalid. 0642 * @retval kStatus_FLEXIO_MCULCD_Busy MCULCD is busy with another transfer. 0643 */ 0644 status_t FLEXIO_MCULCD_TransferNonBlocking(FLEXIO_MCULCD_Type *base, 0645 flexio_mculcd_handle_t *handle, 0646 flexio_mculcd_transfer_t *xfer); 0647 0648 /*! 0649 * @brief Aborts the data transfer, which used IRQ. 0650 * 0651 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0652 * @param handle Pointer to the flexio_mculcd_handle_t structure to store the 0653 * transfer state. 0654 */ 0655 void FLEXIO_MCULCD_TransferAbort(FLEXIO_MCULCD_Type *base, flexio_mculcd_handle_t *handle); 0656 0657 /*! 0658 * @brief Gets the data transfer status which used IRQ. 0659 * 0660 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0661 * @param handle Pointer to the flexio_mculcd_handle_t structure to store the 0662 * transfer state. 0663 * @param count How many bytes transferred so far by the non-blocking transaction. 0664 * @retval kStatus_Success Get the transferred count Successfully. 0665 * @retval kStatus_NoTransferInProgress No transfer in process. 0666 */ 0667 status_t FLEXIO_MCULCD_TransferGetCount(FLEXIO_MCULCD_Type *base, flexio_mculcd_handle_t *handle, size_t *count); 0668 0669 /*! 0670 * @brief FlexIO MCULCD IRQ handler function. 0671 * 0672 * @param base Pointer to the FLEXIO_MCULCD_Type structure. 0673 * @param handle Pointer to the flexio_mculcd_handle_t structure to store the 0674 * transfer state. 0675 */ 0676 void FLEXIO_MCULCD_TransferHandleIRQ(void *base, void *handle); 0677 0678 /*@}*/ 0679 0680 #if defined(__cplusplus) 0681 } 0682 #endif /*_cplusplus*/ 0683 /*@}*/ 0684 0685 #endif /*_FSL_FLEXIO_MCULCD_H_*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |