NAND FLASH的調(diào)用
作者:david 發(fā)表日期:2020-09-14 來源: 瀏覽:
RA8889,RA8876,RA8877,RA8873及RAA8871系列控制器 內(nèi)建 SPI master 接口,此功能主要使為了使用外部閃存/ROM,支持的協(xié)議有 4-BUS (Normal Read)、 5-BUS (FAST Read)、 Dual mode 0、 Dual mode 1 與 Mode 0/Mode 3。
外部串行flash我們支持市面上大部分的NOR FLASH,若客戶需要用到大容量NAND FLASH,我們的芯片支持華邦的W25N01GYZEIT,更換為NAND FLASH后DMA的調(diào)用則與NOR FLASH有點(diǎn)不同,操作如下:
需要將flash中的圖片先調(diào)到顯存中,再用BTE搬用顯示,
調(diào)取函數(shù)如下
void SPI_NAND_DMA (unsigned long dma_page_addr,unsigned long X_coordinate,unsigned long Y_coordinate,unsigned int picture_Width,unsigned int picture_Height,unsigned long pic_buffer_Layer,unsigned long Show_pic_Layer,unsigned char chorma,unsigned long Background_color){#ifdef MCU_8bit_ColorDepth_8bppBackground_color_256(Background_color);#endif#ifdef MCU_8bit_ColorDepth_16bppBackground_color_65k(Background_color);#endif#ifdef MCU_8bit_ColorDepth_24bppBackground_color_16M(Background_color);#endif#ifdef MCU_16bit_ColorDepth_16bppBackground_color_65k(Background_color);#endif#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1Background_color_16M(Background_color);#endif#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2Background_color_16M(Background_color);#endifnSS_Active();SPI_Master_FIFO_Data_Put(0x13); //page data read(13h)SPI_Master_FIFO_Data_Put(0x00); //8Dummy clockSPI_Master_FIFO_Data_Put((dma_page_addr)>>8); //page address MSBSPI_Master_FIFO_Data_Put(dma_page_addr); //page address LSBnSS_Inactive();delay_us(50); //delay for buffer loadMemory_Linear_Mode();SFI_DMA_Source_Start_Address(dma_page_addr);//24bit address#if defined MCU_8bit_ColorDepth_8bppSFI_DMA_Transfer_Number(picture_Width*picture_Height);//picture Width x Height x Color depth(8/8=1)#endif#if defined MCU_8bit_ColorDepth_16bppSFI_DMA_Transfer_Number(picture_Width*picture_Height*2);//picture Width x Height x Color depth(16/8=2)#endif#if defined MCU_16bit_ColorDepth_16bppSFI_DMA_Transfer_Number(picture_Width*picture_Height*2);//picture Width x Height x Color depth(16/8=2)#endif#if defined MCU_8bit_ColorDepth_24bppSFI_DMA_Transfer_Number(picture_Width*picture_Height*3);//picture Width x Height x Color depth(24/8=3)#endif#if defined MCU_16bit_ColorDepth_24bpp_Mode_1SFI_DMA_Transfer_Number(picture_Width*picture_Height*3);//picture Width x Height x Color depth(24/8=3)#endif#if defined MCU_16bit_ColorDepth_24bpp_Mode_2SFI_DMA_Transfer_Number(picture_Width*picture_Height*3);//picture Width x Height x Color depth(24/8=3)#endifSFI_DMA_Destination_Start_Address(pic_buffer_Layer);//DMA to Memory Address 1280*480*3Start_SFI_DMA();Check_2D_Busy();BTE_S0_Color_24bpp();BTE_S0_Memory_Start_Address(pic_buffer_Layer); //S0 Address 1280*480*3BTE_S0_Image_Width(picture_Width);BTE_S0_Window_Start_XY(0,0);BTE_Destination_Color_24bpp();BTE_Destination_Memory_Start_Address(Show_pic_Layer);BTE_Destination_Image_Width(canvus_width);BTE_Destination_Window_Start_XY(X_coordinate,Y_coordinate);if(chorma==0){BTE_ROP_Code(12);BTE_Operation_Code(0x02);}if(chorma==1){BTE_Operation_Code(0x05);}BTE_Window_Size(picture_Width,picture_Height);BTE_Enable();Check_BTE_Busy();Memory_XY_Mode();}
void SPI_NAND_initial_1 (void){Memory_Linear_Mode();SPI_Clock_Period(0);// Reset_CPOL();Set_CPOL();// Reset_CPHA();Set_CPHA();Select_nSS_drive_on_xnsfcs1();W25N01_Device_Reset();W25N01_Clear_BUF();W25N01_Set_ECC();//Select_standard_SPI_Mode0_or_Mode3();Select_RA8875_SPI_Mode0_and_Mode3();//Select_SFI_Single_Mode_Dummy_0T_03h();Select_SFI_Single_Mode_Dummy_8T_0Bh();//Select_SFI_Single_Mode_Dummy_16T_1Bh();//Select_SFI_Dual_Mode_Dummy_8T_3Bh();//Select_SFI_Dual_Mode_Dummy_4T_BBh();Enable_SFlash_SPI();Select_SFI_1();Select_SFI_DMA_Mode();Select_SFI_24bit_Address();Memory_XY_Mode();}void SPI_NAND_initial_0 (void){Memory_Linear_Mode();SPI_Clock_Period(0);// Reset_CPOL();Set_CPOL();// Reset_CPHA();Set_CPHA();Select_nSS_drive_on_xnsfcs0();W25N01_Device_Reset();W25N01_Clear_BUF();W25N01_Set_ECC();//Select_standard_SPI_Mode0_or_Mode3();Select_RA8875_SPI_Mode0_and_Mode3();//Select_SFI_Single_Mode_Dummy_0T_03h();Select_SFI_Single_Mode_Dummy_8T_0Bh();//Select_SFI_Single_Mode_Dummy_16T_1Bh();//Select_SFI_Dual_Mode_Dummy_8T_3Bh();//Select_SFI_Dual_Mode_Dummy_4T_BBh();Enable_SFlash_SPI();Select_SFI_0();Select_SFI_DMA_Mode();Select_SFI_24bit_Address();Memory_XY_Mode();}
使用范例:
注意圖片放置地址不可超出顯存大小,例:分辨率為800*480 、24bpp放置到第二個(gè)圖層則為800*480*3 即1152000
這里要根據(jù)圖片實(shí)際信息進(jìn)行設(shè)置
分享到:
相關(guān)熱詞搜索:RA8889,RA8876,RA8875,NAND FLASH
上一篇:RA88xx系列對(duì)顯存直接讀寫點(diǎn)的方法
下一篇:關(guān)于RA8873M及RA8871M的圖層顯示
>>延伸閱讀:1