99热成人精品热久久6网站_无码中文亚洲AV吉吉影音_国产精品制服一区二区_中文字幕乱码一区二区三区免费

首頁 > 技術(shù)支持 > 應(yīng)用與案例 > 正文
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 0Dual 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_8bpp
  Background_color_256(Background_color); 
#endif
#ifdef MCU_8bit_ColorDepth_16bpp
  Background_color_65k(Background_color); 
#endif
#ifdef MCU_8bit_ColorDepth_24bpp
  Background_color_16M(Background_color); 
#endif
#ifdef MCU_16bit_ColorDepth_16bpp
  Background_color_65k(Background_color); 
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_1
  Background_color_16M(Background_color); 
#endif
#ifdef MCU_16bit_ColorDepth_24bpp_Mode_2
  Background_color_16M(Background_color); 
#endif
 
nSS_Active();
SPI_Master_FIFO_Data_Put(0x13); //page data read(13h)
SPI_Master_FIFO_Data_Put(0x00); //8Dummy clock
SPI_Master_FIFO_Data_Put((dma_page_addr)>>8);   //page address MSB
SPI_Master_FIFO_Data_Put(dma_page_addr);   //page address LSB
nSS_Inactive();
delay_us(50); //delay for buffer load
 
Memory_Linear_Mode();
SFI_DMA_Source_Start_Address(dma_page_addr);//24bit address
 
#if defined  MCU_8bit_ColorDepth_8bpp
SFI_DMA_Transfer_Number(picture_Width*picture_Height);//picture Width x Height x Color depth(8/8=1)
#endif
#if defined  MCU_8bit_ColorDepth_16bpp 
SFI_DMA_Transfer_Number(picture_Width*picture_Height*2);//picture Width x Height x Color depth(16/8=2)
#endif
#if defined  MCU_16bit_ColorDepth_16bpp
SFI_DMA_Transfer_Number(picture_Width*picture_Height*2);//picture Width x Height x Color depth(16/8=2)
#endif
#if defined  MCU_8bit_ColorDepth_24bpp 
SFI_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_1
SFI_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_2
SFI_DMA_Transfer_Number(picture_Width*picture_Height*3);//picture Width x Height x Color depth(24/8=3)
#endif
SFI_DMA_Destination_Start_Address(pic_buffer_Layer);//DMA to Memory Address 1280*480*3
  
Start_SFI_DMA();
Check_2D_Busy();
 
  BTE_S0_Color_24bpp();
  BTE_S0_Memory_Start_Address(pic_buffer_Layer); //S0 Address 1280*480*3
  BTE_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();
}
直接將此函數(shù)添加進(jìn)API并調(diào)用即可,如果使用本公司提供的開發(fā)板且須添加初始化函數(shù)SPI_NAND_initial_1 (void)初始化或者SPI_NAND_initial_0 (void)選擇CS0還是CS1
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

  • · RA8889開發(fā)板如何通過外部燒錄器進(jìn)行更新FLASH內(nèi)容 [2022-04-01]