1 /* 2 * Copyright 2019-2024 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef FSL_SMARTDMA_MCXN_H_ 9 #define FSL_SMARTDMA_MCXN_H_ 10 11 #include "fsl_common.h" 12 13 /*! 14 * @addtogroup smartdma_mcxn MCXN SMARTDMA Firmware 15 * @ingroup smartdma 16 * @{ 17 */ 18 19 /******************************************************************************* 20 * Definitions 21 ******************************************************************************/ 22 #if defined(MCXN236_SERIES) || defined(MCXN235_SERIES) 23 #define SMARTDMA_USE_FLEXIO_SHIFTER_DMA 1 24 #endif 25 26 /*! @brief The firmware used for display. */ 27 extern const uint8_t s_smartdmaDisplayFirmware[]; 28 29 /*! @brief The s_smartdmaDisplayFirmware firmware memory address. */ 30 #define SMARTDMA_DISPLAY_MEM_ADDR 0x04000000U 31 32 /*! @brief Size of s_smartdmaDisplayFirmware */ 33 #define SMARTDMA_DISPLAY_FIRMWARE_SIZE (s_smartdmaDisplayFirmwareSize) 34 35 /*! @brief Size of s_smartdmaDisplayFirmware */ 36 extern const uint32_t s_smartdmaDisplayFirmwareSize; 37 38 /*! @brief The firmware used for camera. */ 39 extern const uint8_t s_smartdmaCameraFirmware[]; 40 41 /*! @brief The s_smartdmaCameraFirmware firmware memory address. */ 42 #define SMARTDMA_CAMERA_MEM_ADDR 0x04000000U 43 44 /*! @brief Size of s_smartdmacameraFirmware */ 45 #define SMARTDMA_CAMERA_FIRMWARE_SIZE (s_smartdmaCameraFirmwareSize) 46 47 /*! @brief Size of s_smartdmacameraFirmware */ 48 extern const uint32_t s_smartdmaCameraFirmwareSize; 49 50 /*! 51 * @brief The API index when using s_smartdmaDisplayFirmware. 52 */ 53 enum _smartdma_display_api 54 { 55 kSMARTDMA_FlexIO_DMA_Endian_Swap = 0U, 56 kSMARTDMA_FlexIO_DMA_Reverse32, 57 kSMARTDMA_FlexIO_DMA, 58 kSMARTDMA_FlexIO_DMA_Reverse, /*!< Send data to FlexIO with reverse order. */ 59 kSMARTDMA_RGB565To888, /*!< Convert RGB565 to RGB888 and save to output memory, use parameter 60 smartdma_rgb565_rgb888_param_t. */ 61 kSMARTDMA_FlexIO_DMA_RGB565To888, /*!< Convert RGB565 to RGB888 and send to FlexIO, use parameter 62 smartdma_flexio_mculcd_param_t. */ 63 kSMARTDMA_FlexIO_DMA_ARGB2RGB, /*!< Convert ARGB to RGB and send to FlexIO, use parameter 64 smartdma_flexio_mculcd_param_t. */ 65 kSMARTDMA_FlexIO_DMA_ARGB2RGB_Endian_Swap, /*!< Convert ARGB to RGB, then swap endian, and send to FlexIO, use 66 parameter smartdma_flexio_mculcd_param_t. */ 67 kSMARTDMA_FlexIO_DMA_ARGB2RGB_Endian_Swap_Reverse, /*!< Convert ARGB to RGB, then swap endian and reverse, and send 68 to FlexIO, use parameter smartdma_flexio_mculcd_param_t. */ 69 }; 70 71 /*! 72 * @brief Parameter for FlexIO MCULCD 73 */ 74 typedef struct _smartdma_flexio_mculcd_param 75 { 76 uint32_t *p_buffer; 77 uint32_t buffersize; 78 uint32_t *smartdma_stack; 79 } smartdma_flexio_mculcd_param_t; 80 81 /*! 82 * @brief Parameter for RGB565To888 83 */ 84 typedef struct _smartdma_rgb565_rgb888_param 85 { 86 uint32_t *inBuf; 87 uint32_t *outBuf; 88 uint32_t buffersize; 89 uint32_t *smartdma_stack; 90 } smartdma_rgb565_rgb888_param_t; 91 92 /*! 93 * @brief The API index when using s_smartdmaCameraFirmware 94 */ 95 enum _smartdma_camera_api 96 { 97 kSMARTDMA_FlexIO_CameraWholeFrame = 0U, /*! Deprecated. Use kSMARTDMA_CameraWholeFrameQVGA instead. */ 98 kSMARTDMA_FlexIO_CameraDiv16Frame = 1U, /*! Deprecated. Use kSMARTDMA_CameraDiv16FrameQVGA instead. */ 99 /*! Save whole frame of QVGA(320x240) to buffer in each interrupt in RGB565 format. */ 100 kSMARTDMA_CameraWholeFrameQVGA = 0U, 101 /*! Save 1/16 frame of QVGA(320x240) to buffer in each interrupt in RGB565 format, 102 takes 16 interrupts to get the whole frame. */ 103 kSMARTDMA_CameraDiv16FrameQVGA = 1U, 104 /*! Save whole frame of 480x320 to buffer in each interrupt in RGB565 format. */ 105 kSMARTDMA_CameraWholeFrame480_320 = 2U, 106 /*! Save 1/4 frame of QVGA(320x240) to buffer in each interrupt in grayscale format, 107 takes 4 interrupts to get the whole frame. */ 108 kSMARTDMA_CameraDiv4FrameQVGAGrayScale = 3U, 109 /*! Save 1/16 frame of QVGA(320x240) to buffer in each interrupt in grayscale format, 110 takes 16 interrupts to get the whole frame. */ 111 kSMARTDMA_CameraDiv16FrameQVGAGrayScale = 4U, 112 /*! Save 1/16 frame of 384x384 to buffer in each interrupt in grayscale format, 113 takes 16 interrupts to get the whole frame. */ 114 kSMARTDMA_CameraDiv16Frame384_384 = 5U, 115 /*! Save whole frame of 320x480 to buffer in each interrupt in RGB565 format. */ 116 kSMARTDMA_CameraWholeFrame320_480 = 6U, 117 }; 118 119 /*! 120 * @brief Parameter for camera 121 */ 122 typedef struct _smartdma_camera_param 123 { 124 uint32_t *smartdma_stack; /*!< Stack used by SMARTDMA, shall be at least 64 bytes. */ 125 uint32_t *p_buffer; /*!< Buffer to store the received camera data. */ 126 uint32_t *p_stripe_index; /*!< Pointer to stripe index. Used when only partial frame is received per interrupt. */ 127 uint32_t *p_buffer_ping_pong; /*!< Buffer to store the 2nd stripe of camera data. Used when only partial frame is 128 received per interrupt. */ 129 } smartdma_camera_param_t; 130 131 /*! 132 * @brief Parameter for all supported APIs. 133 */ 134 typedef union 135 { 136 smartdma_flexio_mculcd_param_t flexioMcuLcdParam; /*!< Parameter for flexio MCULCD. */ 137 smartdma_rgb565_rgb888_param_t rgb565_rgb888Param; /*!< Parameter for RGB565_RGB888 convertion. */ 138 smartdma_camera_param_t cameraParam; /*!< Parameter for camera. */ 139 } smartdma_param_t; 140 141 /******************************************************************************* 142 * APIs 143 ******************************************************************************/ 144 145 #if defined(__cplusplus) 146 extern "C" { 147 #endif /* __cplusplus */ 148 149 #if defined(__cplusplus) 150 } 151 #endif 152 153 /*! @} */ 154 155 #endif /* FSL_SMARTDMA_MCXN_H_ */ 156