1 /* 2 * Copyright 2019-2020 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #include "fsl_prg.h" 9 10 /* Component ID definition, used by tools. */ 11 #ifndef FSL_COMPONENT_ID 12 #define FSL_COMPONENT_ID "platform.drivers.prg" 13 #endif 14 15 /******************************************************************************* 16 * Definitions 17 ******************************************************************************/ 18 #define PRG_ALIGN_UP(x, align) ((((x)-1U) | ((align)-1U)) + 1U) 19 20 /******************************************************************************* 21 * Prototypes 22 ******************************************************************************/ 23 24 /******************************************************************************* 25 * Variables 26 ******************************************************************************/ 27 28 /******************************************************************************* 29 * Code 30 ******************************************************************************/ 31 /*! 32 * brief Initialize PRG peripheral module. 33 * 34 * param base PRG peripheral address. 35 */ PRG_Init(PRG_Type * base)36void PRG_Init(PRG_Type *base) 37 { 38 } 39 40 /*! 41 * brief Deinitialize the PRG peripheral module. 42 * 43 * param base PRG peripheral address. 44 */ PRG_Deinit(PRG_Type * base)45void PRG_Deinit(PRG_Type *base) 46 { 47 } 48 49 /*! 50 * brief Set the frame buffer configuration. 51 * 52 * param base PRG peripheral address. 53 * param addr Frame buffer address. 54 */ PRG_SetBufferConfig(PRG_Type * base,const prg_buffer_config_t * config)55void PRG_SetBufferConfig(PRG_Type *base, const prg_buffer_config_t *config) 56 { 57 assert(config != NULL); 58 59 base->PRG_HEIGHT.RW = (uint32_t)config->height - 1U; 60 base->PRG_WIDTH.RW = (uint32_t)config->width - 1U; 61 base->PRG_STRIDE.RW = (uint32_t)config->strideBytes - 1U; 62 base->PRG_OFFSET.RW = 0U; 63 base->PRG_CTRL.RW = (base->PRG_CTRL.RW & ~PRG_PRG_CTRL_DES_DATA_TYPE_MASK) | 64 (PRG_PRG_CTRL_DES_DATA_TYPE(config->dataType) | PRG_PRG_CTRL_SHADOW_LOAD_MODE_MASK); 65 } 66 67 /*! 68 * brief Get the frame buffer default configuration. 69 * 70 * param config Pointer to the configuration. 71 */ PRG_BufferGetDefaultConfig(prg_buffer_config_t * config)72void PRG_BufferGetDefaultConfig(prg_buffer_config_t *config) 73 { 74 assert(config != NULL); 75 76 config->width = 1080U; 77 config->height = 1920U; 78 config->strideBytes = 4U * 1080U; 79 config->dataType = kPRG_DataType32Bpp; 80 } 81