⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myprogram.txt

📁 自己写的nandflash文件系统源代码
💻 TXT
📖 第 1 页 / 共 5 页
字号:
			  x++;  
				y--;
			}
	    else 
			{
				p2 += rx2*(-2*y+3);  
				y--;
			}
			tmp_y = y; //保存y值
			for( i = 1; i <= width && y >0; i++)  //宽度处理
			{
        PlotPoints(pDraw,xcenter, ycenter, x, y--,pclr,octant);
				if(!y)
				{
					 if(x < min_x)
					     min_x =x;
				}
			}
			y = tmp_y;
    }
    if(width == ry)   //填充时,y=0处宽度处理
		{
		  for( x =rx ; x >=0; x--)  
			{
        PlotPoints(pDraw,xcenter, ycenter, x, 0,pclr,octant);
			}
		}

    if((width > 1) && (width < ry) &&(startx == 0) && (endx == rx))   //填充时,y=0处宽度处理
		{
		  for( i = rx; i >= min_x ; i--)  
			{
        PlotPoints(pDraw,xcenter, ycenter,i,0,pclr,octant);
			}
		}

    return  SUCCESS_RETURN;
 }
//----------------------------------------------------------------------------------------------------
//函数名:DrawableBitMap
//输  入: 无
//输  出: 无
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 绘画BMP图像
//-----------------------------------------------------------------------------------------------------
//void DrawBitMap(int x, int y, UInt8 const *p,
//								 int xsize, int ysize,int Diff,const UInt32 *pTrans)
//{
//  UInt32 pixel;
//	x+=Diff;
//	p+=3*Diff;
//	if (y >= SCREEN_HEIGHT)
//   	return;
//	y = y * SCREEN_WIDTH;
//  for (i=0; i< ysize; i++)
//	{
//	  for ( ;xsize>0; xsize--, x++)
//		{
//			pixel = (*p) + ((*(p+1))<<8) + ((*(p+2))<<16);
//			p += 3;
//      //if (pixel ^ LCD_TransColor)
//			*(pVideoBuffer + y + x) = pixel | 0xff000000;
//		}
//		y++;
//	}
//}



//------------------------------------------------------------------------------------------------------
//函数名: setupdot
//输  入: 无
//输  出: 无
//完成人: nxf
//完成日期: 2005-5-26
//描  述: dotfill[][]用于测试画点函数,即利用画点函数画点以填充满整个屏幕。
//------------------------------------------------------------------------------------------------------

void setupdot(void)
{
	int i,j;

	for(i =0 ; i < 600; i++)
		for(j =0; j < 800; j++)
		{
			dotfill[j][i].x = j;
			dotfill[j][i].y = i;
		}

}

//------------------------------------------------------------------------------------------------------
//函数名: DrawableDestroy
//输  入: pDraw 
//输  出: 无
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 释放绘画对象
//------------------------------------------------------------------------------------------------------
void DrawableDestroy(tmhwDrawable_t *pDraw)
{
	tmhwDrawDestroy(pDraw);
  tmhwDrawDeinit();   // kill off the Draw subsystem
}

//=======================================================================================================
//=================blt相关函数定义=======================================================================

typedef struct imagedatainfo
{
  UInt32 Image_ID;    //图像ID号
  char   *pName;      //图像名字
	UInt32 imagewidth;  //图像宽度
	UInt32 imageheight; //图像高度
  UInt32 *pData;      //指向图像数据
  struct imagedatainfo *pNext;   
 }Imagelist;
//------------------------------------------------------------------------------------------------------
//函数名: CreatepLink
//输  入: &name[0] , pImageData ,imagewidth,imageheight
//输  出: (Imagelist *)链表头指针
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 创建一个链表并返回头指针。
//参数说明: 
//imagewidth  - 链表头对应的图像的宽度
//imageheight - 链表头对应的图像的高度
//pImageData  - 指向图像数据的首地址
//------------------------------------------------------------------------------------------------------ 
Imagelist *CreatepLink(char *picname, UInt32 imagewidth, UInt32 imageheight, UInt32 *pImageData)
{
	tmErrorCode_t errcode;
  Imagelist *plinkhead;
	UInt32 *pIntStat;

  tmosalDisableInterrupts(pIntStat);//临界区处理
  if(!(plinkhead=(Imagelist *)malloc(sizeof(Imagelist))))
    {
		 myprintf("plinkhead is Null\n");
     #ifdef PRNT_ERRINFO
         myprintf("malloc memory failed.\n");
     #endif
     return NULL;
    }
  else
	{ 
     plinkhead->Image_ID =1;
     plinkhead->pName = picname;
		 plinkhead->imagewidth = imagewidth;
		 plinkhead->imageheight = imageheight;
     plinkhead->pNext = plinkhead; //指向本身
     plinkhead->pData = pImageData;
     tmosalEnableInterrupts(pIntStat);//临界区处理
     return plinkhead;
   }
}

//------------------------------------------------------------------------------------------------------
//函数名: SearchpLink
//输  入: plinkhead , Image_ID
//输  出: 指定ID号图像的链表指针
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 查找指定Image_ID号的链表指针并返回。
//参数说明:
// 1. plinkhead - 指定链表的头指针
// 2. Image_ID  - 图像ID
//------------------------------------------------------------------------------------------------------ 
Imagelist *SearchpLink(Imagelist *plinkhead,UInt32 Image_ID)
{
  Imagelist *p;

  p=plinkhead->pNext;
  if((!plinkhead) || (Image_ID < 2))
   {
     #ifdef PRNT_ERRINFO
        myprintf("input paramters is wrong.\n");
     #endif
     return NULL; 
   } 
  else
  {
     while(p && p!=plinkhead)
     {
	      if(p->Image_ID ==Image_ID)
               break;
        p = p->pNext;
     }
     if(!p)   //链表发生严重错误,返回
       {
         #ifdef PRNT_ERRINFO
           myprintf("plink has serious problem,system will be panic\n");
         #endif
         return NULL;
        }
     else if(p==plinkhead) //没有找到
         return NULL;
     else              //找到
         return p;
        
  }
}

//------------------------------------------------------------------------------------------------------
//函数名: InsertpLink
//输  入: plinkhead , Image_ID ,imagewidth, imageheight,pImageData
//输  出: 指定ID号图像的链表指针
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 插入指定Image_ID号的链表指针并返回。
//参数说明:
// 1. plinkhead  - 指定链表的头指针
// 2. Image_ID   - 图像ID
// 3. pImageData - 图像数据指针
//------------------------------------------------------------------------------------------------------ 
//
Imagelist *InsertpLink(
											 Imagelist *plinkhead,UInt32 Image_ID,
											 UInt32 imagewidth, UInt32 imageheight,
											 UInt32 *pImageData
)
{
  Imagelist *p;
  Imagelist *p_prv;
  Imagelist *tmp;
	UInt32 *pIntStat;
	tmErrorCode_t errcode;

  UInt32 Max_ID=1; //用于保存指定链表最后一个链表项的Image_ID.初始化为链表中只有一项的情况。

  p=plinkhead->pNext;

   if((!plinkhead)|| Image_ID <= 1)
   {
     #ifdef PRNT_ERRINFO
        myprintf("input paramters is wrong.\n");
     #endif
     return NULL; 
   } 
   else
   {
     while(p && p!=plinkhead)//首先搜索有没有已存在的Image_ID.
     {
	      if(p->Image_ID ==Image_ID)
               break;
        if(p->pNext == plinkhead)
          {
            Max_ID = p->Image_ID;  //保存该链表已存在的最大的Image_ID号。
						myprintf("now input image_id is %d\n",Image_ID);
						myprintf("now Max_ID is %d.\n",Max_ID);
            p_prv = p;             //保存该链表已存在的最大的Image_ID号的链表指针。
          }
			   p = p->pNext;
     }
     if(!p)   //链表发生严重错误,返回
       {
         #ifdef PRNT_ERRINFO
           myprintf("plink has serious problem,system will be panic\n");
         #endif
         return NULL;
        }
     else if(p!=plinkhead) //指定的Image_ID已经存在
		 { 
        #ifdef PRNT_ERRINFO
			    myprintf("Image_ID = %d  are already existed.\n",Image_ID);
        #endif
         return NULL;
		 }
     else if(Image_ID != (Max_ID + 1))//指定的ID不是现有的ID号加1。
      {
         #ifdef PRNT_ERRINFO
           myprintf("Image_ID is too large,Now Max Image ID is %d\n",Max_ID);
         #endif
         return NULL;
       }
     else            //Image_ID不存在,且Image_ID = Max_ID +1,此时的p=plinkhead.
      { 
			 tmosalDisableInterrupts(pIntStat);  //临界区处理
			 if( !(tmp = (Imagelist *)malloc(sizeof(Imagelist))))
         {
            #ifdef PRNT_ERRINFO
              myprintf("malloc memory failed.\n");
            #endif
            return NULL;   
         }
       else
         {  
				 	 tmosalDisableInterrupts(pIntStat);  //临界区处理
           tmp->Image_ID = Image_ID;
           tmp->pName = p->pName;
           tmp->pData = pImageData;
					 tmp->imagewidth = imagewidth;
           tmp->imageheight = imageheight;
           tmp->pNext = p;
           if(Image_ID == 2) //第二个节点
                  p->pNext = tmp;
           else
                  p_prv->pNext = tmp;//其他节点
           tmosalEnableInterrupts(pIntStat);  //临界区处理
            return tmp;
         }     
      }
  }    
}

//------------------------------------------------------------------------------------------------------
//函数名: DelpLink
//输  入: plinkhead , Image_ID , whole_flg
//输  出: NULL 或 SUCCESS_RETURN
//完成人: nxf
//完成日期: 2005-5-27
//描  述: 删除指定Image_ID号的链表指针项 或 删除整个链表.
//参数说明:
// 1. plinkhead  - 指定链表的头指针
// 2. Image_ID   - 图像ID
// 3. pImageData - 图像数据指针
// 4. whole_flg  =
//                 0: 删除某一链表指针项
//                 1: 删除整个链表
//------------------------------------------------------------------------------------------------------
int DelpLink(Imagelist *plinkhead,UInt32 Image_ID,UInt8 whole_flg)
{
 Imagelist *p;
 Imagelist *p_tmp=NULL;
 Imagelist *p_prv=NULL;
 Imagelist *p_prv2=NULL;
 UInt32 Max_ID=1;
 UInt32 *pIntStat;

 p=plinkhead->pNext;

 if(!plinkhead || Image_ID <1)
 {
   #ifdef PRNT_ERRINFO
         myprintf("input parameter is wrong.\n");
   #endif
   return NULL;
 }
 
 while(p && p!=plinkhead && (whole_flg == 0))//首先搜索有没有已存在的Image_ID.
 {
   if(p->Image_ID == Image_ID - 1) //保存搜到指定Image_ID的前一项的链表指针
      p_prv = p;
   if(p->Image_ID ==Image_ID)
          break;
   p = p->pNext;
  }  
  if(!p)   //链表发生严重错误,返回
  {
    #ifdef PRNT_ERRINFO
        myprintf("plink has serious problem,system will be panic\n");
    #endif
    return NULL;
   }

 if((p==plinkhead) && (whole_flg == 0) && (Image_ID !=1)) //没有找到相应的Image_ID.或者当链表只有一项        
	 return NULL;                                                //但输入的Image_ID!=1时的情况。

 if((p==plinkhead) && (whole_flg == 0) && (Image_ID ==1)) //指定whole_flg=0,但此时链表只有一项的情况
 {
	      //free(plinkhead->pData);//added
        free(plinkhead);
				myprintf("free is done.\n");
        return SUCCESS_RETURN;
 }
     
                                                                                       
 switch(whole_flg)
   {
     case 0://删除某一链表指针项
          {
              if(!p_prv)
              {
                #ifdef PRNT_ERRINFO
                    myprintf("plink has serious problem,system will be panic\n");
                #endif
                return NULL;	        
              }
							tmosalDisableInterrupts(pIntStat);  //临界区处理
              p_prv->pNext = p->pNext;
              tmosalEnableInterrupts(pIntStat);
							//free(p->pData); //added
              free(p); //从if(p->Image_ID ==Image_ID) break;语句跳到这里  
				      myprintf("free is done.\n");							
              break;    
           }
     case 1://删除整个链表
          {
						 myprintf("now enter the case 1\n");
              while(p!=plinkhead)
							{
								if(p->pNext == plinkhead)
									   p_prv2 = p;  //定位链表最后一项
                p = p->pNext;
							}
							p = p_prv2;  

	            p->pNext = NULL;//断链

							myprintf("now it has disconnect the link\n");
              p=plinkhead;
              while(!p)
              {
                p_tmp = p->pNext; 
								//free(p->pData); //added
                free(p);
							  myprintf("free is done.\n");
                p = p_tmp;
              }
              break;
           }
     default:
          {
             #ifdef PRNT_ERRINFO
                 myprintf("parameter whole_flg is wrong.\n");
             #endif
             return NULL;
           }
          return SUCCESS_RETURN;    
    }
}
//------------------------------------------------------------------------------------------------------
//函数名: AntimateCacheDisplay
//输  入: pDraw , dstXY ,imagewidth ,imageheight,pImage
//输  出: ERR_RETURN 或 SUCCESS_RETURN
//完成人: nxf
//完成日期: 2005-5-26
//描  述: 完成动画单帧图像的显示。
//参数说明:
// 1. dstXY - 图像显示的起始点
// 2. imagewidht  - 待显图像的宽度(像素单位,字对齐)
// 3. imageheight - 待显图像的高度(像素单位,字对齐) 
// 4. pImage      - 指向图像数据的首地址指针
//------------------------------------------------------------------------------------------------------ 
int
AntimateCacheDisplay( tmhwDrawable_t *pDraw,tmXY_t dstXY,UInt32 imagewidth,UInt32 imageheight,
							  UInt32 *pImage      
)
{
    tmErrorCode_t errcode;
    tmhwDrawable_t *pSrc;
    static const tmXY_t srcPoint =
    {
        0, 0
    };
    tmRect_t dstRect;
    static const tmhwDrawBlt3OpFlags_t bltFlags =
    {
        tmhwDrawRop3SrcCopy,    // rop3
        tmhwDrawCmpOpNone,      // compareOp
        False                   // sync
    };
    tmhwDrawBitsRef_t hImage;
    //UInt32 imageSize;
    static tmDrawFormat_t format =
    {
        sizeof(tmDrawFormat_t), // size
        (0-0),                  // hash
        (0-0),                  // referenceCount
        avdcDraw,               // dataClass
        SCREEN_VTF,             // dataType
        SCREEN_VCF,             // dataSubtype
        SCREEN_VDF,             // description
        gdtSystem,              // drawableType
        {
            (0-0),              // shape
            (0-0)
        },

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -