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

📄 docsys.c

📁 电子盘DEMO板程序
💻 C
📖 第 1 页 / 共 4 页
字号:
   FLWRITE_IO_WORD((FLWord)val,(((volatile FLWord FAR0 *)win)+offset));
}

/*----------------------------------------------------------------------
   f l W r i t e 8 b i t U s i n g 32 b i t s S i n g l e S h i f t

   Note : DiskOnChip is connected with 16-bit data bus.
   Note : Data is written to both data bus 8-bits

   Write 8-bits Using 32-bits operands with single address shifted.
------------------------------------------------------------------------*/

void FAR1 flWrite8bitUsing32bitsSingleShift(volatile  FLByte FAR0 * win, FLWord offset,Reg8bitType val)
{
#ifdef FL_BIG_ENDIAN
   FLWRITE_IO_DWORD(((FLDword)((FLDword)val*0x01010101L)),(((volatile FLDword FAR0 *)win)+(offset>>1)));
#else
   FLWRITE_IO_DWORD((FLDword)val,(((volatile FLDword FAR0 *)win)+(offset>>1)));
#endif /* FL_BIG_ENDIAN */
}

/*----------------------------------------------------------------------
   f l W r i t e 8 b i t U s i n g 32 b i t s D o u b l e S h i f t

   Note : Data is written only to 8-LSB.

   Write 8-bits Using 32-bits operands with Double address shifted.
------------------------------------------------------------------------*/

void FAR1 flWrite8bitUsing32bitsDoubleShift(volatile  FLByte FAR0 * win, FLWord offset,Reg8bitType val)
{
   FLWRITE_IO_DWORD((FLDword)val,(((volatile FLDword FAR0 *)win)+offset));
}

/*********************************************************/
/*     Read 8 bits to DiskOnChip memory window           */
/*********************************************************/

/*----------------------------------------------------------------------
   f l R e a d 8 b i t U s i n g 8 b i t s N o S h i f t

   Read 8-bits Using 8-bits operands with no address shifted.
------------------------------------------------------------------------*/

Reg8bitType FAR1 flRead8bitUsing8bitsNoShift(volatile  FLByte FAR0 * win,FLWord offset)
{
   return FLREAD_IO_BYTE(((volatile void FAR0 *)(win + offset)));
}


/*----------------------------------------------------------------------
   f l R e a d 8 b i t U s i n g 16 b i t s N o S h i f t

   Note : DiskOnChip is connected with 16-bit data bus.

   Read 8-bits Using 16-bits operands with no address shifted.
------------------------------------------------------------------------*/

Reg8bitType FAR1 flRead8bitUsing16bitsNoShift(volatile  FLByte FAR0 * win,FLWord offset)
{
#ifdef FL_BIG_ENDIAN
   return (((offset & 0x1) == 0) ?
#else
   return (( offset & 0x1      ) ?
#endif /* FL_BIG_ENDIAN */
      (Reg8bitType)(FLREAD_IO_WORD(((volatile FLWord FAR0 *)win + (offset>>1))) >> 8) :
      (Reg8bitType)(FLREAD_IO_WORD(((volatile FLWord FAR0 *)win + (offset>>1)))) );

}

/*----------------------------------------------------------------------
   f l R e a d 8 b i t U s i n g 16 b i t s S i n g l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Read 8-bits Using 16-bits operands with Single address shifted.
------------------------------------------------------------------------*/

Reg8bitType FAR1 flRead8bitUsing16bitsSingleShift(volatile  FLByte FAR0 * win,FLWord offset)
{
   return( (Reg8bitType)FLREAD_IO_WORD((((volatile FLWord FAR0 *)win)+offset)) );
}

/*----------------------------------------------------------------------
   f l R e a d 8 b i t U s i n g 32 b i t s S i n g l e S h i f t

   Note : DiskOnChip is connected with 16-bit data bus.

   Read 8-bits Using 16-bits operands with Single address shifted.
------------------------------------------------------------------------*/

Reg8bitType FAR1 flRead8bitUsing32bitsSingleShift(volatile  FLByte FAR0 * win,FLWord offset)
{
#ifdef FL_BIG_ENDIAN
   return (((offset & 0x1) == 0) ?
           (Reg8bitType)(FLREAD_IO_DWORD(((volatile FLDword FAR0 *)win)+(offset>>1))>>24) :
           (Reg8bitType)(FLREAD_IO_DWORD(((volatile FLDword FAR0 *)win)+(offset>>1))>>16));
#else
   return (( offset & 0x1      ) ?
           (Reg8bitType)(FLREAD_IO_DWORD(((volatile FLDword FAR0 *)win)+(offset>>1))>>8) :
           (Reg8bitType)(FLREAD_IO_DWORD(((volatile FLDword FAR0 *)win)+(offset>>1))) );
#endif /* FL_BIG_ENDIAN */
}

/*----------------------------------------------------------------------
   f l R e a d 8 b i t U s i n g 32 b i t s D o u b l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Read 8-bits Using 16-bits operands with Single address shifted.
------------------------------------------------------------------------*/

Reg8bitType FAR1 flRead8bitUsing32bitsDoubleShift(volatile  FLByte FAR0 * win,FLWord offset)
{
   return((Reg8bitType)FLREAD_IO_DWORD(((volatile FLDword FAR0 *)win)+offset));
}

/*********************************************************/
/*********************************************************/
/***    Operation on several bytes (read/write/set)    ***/
/*********************************************************/
/*********************************************************/

/*************************************************/
/*         8-Bit DiskOnChip - No Shift           */
/*************************************************/

/*----------------------------------------------------------------------
   f l 8 b i t D o c R e a d N o S h i f t

   Read 'count' bytes, from a none shifted address bus using tffscpy.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocReadNoShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* dest,FLWord count)
{
#ifndef FL_NO_INIT_MMU_PAGES
  if (count == 0)
     return;

  dest[0] = 0;
  *((FLByte FAR1*)addToFarPointer(dest, (count - 1)) ) = (FLByte)0;
#endif /* FL_NO_INIT_MMU_PAGES */
#ifdef FL_ENVIRONMENT_VARS
  if(flUse8Bit == 1)
  {
	  register int i ;

	  for(i = 0 ; i < count ; i++)
		  dest[i] = FLREAD_IO_BYTE(win + offset + i);
  }
  else
#endif /* FL_ENVIRONMENT_VARS */
     TFFSCPY_FROM_IO_8_BITS(dest,win+offset,count);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c W r i t e N o S h i f t

   Write 'count' bytes, from a none shifted address bus using tffscpy.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocWriteNoShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* src,FLWord count)
{
#ifdef FL_ENVIRONMENT_VARS
  if(flUse8Bit == 1)
  {
	 register int i ;

	 for(i = 0 ; i < count ; i++)
        FLWRITE_IO_BYTE(src[i],win + offset + i);		  
  }
  else
#endif /* FL_ENVIRONMENT_VARS */
     TFFSCPY_TO_IO_8_BITS(win+offset,src,count);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c S e t N o S h i f t

   Set 'count' bytes, from a none shifted address bus using tffsset.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocSetNoShift(volatile  FLByte FAR0 * win,FLWord offset,FLWord count, FLByte val)
{
#ifdef FL_ENVIRONMENT_VARS
  if(flUse8Bit == 1)
  {
	 register int i ;
	 for(i = 0 ; i < count ; i++)
        FLWRITE_IO_BYTE(val,win + offset + i);		  
  }
  else
#endif /* FL_ENVIRONMENT_VARS */
     TFFSSET_IO_8_BITS(win+offset,val,count);
}

/*************************************************/
/*        8-Bit DiskOnChip - Single Shift        */
/*************************************************/

/*----------------------------------------------------------------------
   f l 8 b i t D o c R e a d S i n g l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Read 'count' bytes, from data bus's LSB lane with 1 address shifted
------------------------------------------------------------------------*/

void FAR1 fl8bitDocReadSingleShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* dest,FLWord count)
{
  volatile FLWord FAR0 * doc = ((volatile FLWord FAR0 *)win) + offset;
  register int         i;

#ifndef FL_NO_INIT_MMU_PAGES
  if (count == 0)
     return;

  dest[0] = 0;
  *((FLByte FAR1*)addToFarPointer(dest, (count - 1)) ) = (FLByte)0;
#endif /* FL_NO_INIT_MMU_PAGES */

  for(i=0;( i < count );i++)
    dest[i] = (Reg8bitType)FLREAD_IO_WORD(doc+i);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c W r i t e S i n g l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Write 'count' bytes, to data bus's LSB lane with 1 address shifted.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocWriteSingleShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* src,FLWord count)
{
  volatile FLWord FAR0 * doc = ((volatile FLWord FAR0 *)win) + offset;
  register int  i;

  for(i=0;( i < count );i++)
    FLWRITE_IO_WORD((FLWord)(src[i]),doc+i);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c S e t S i n g l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Set 'count' bytes, of data bus's LSB lane with 1 address shifted.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocSetSingleShift(volatile  FLByte FAR0 * win,FLWord offset,FLWord count, FLByte val)
{
  volatile FLWord FAR0 * doc = ((volatile FLWord FAR0 *)win) + offset;
  register int  i;

   for(i=0;( i < count );i++)
      FLWRITE_IO_WORD((FLWord)val,doc+i);
}

/*************************************************/
/*        8-Bit DiskOnChip - Double Shift        */
/*************************************************/

/*----------------------------------------------------------------------
   f l 8 b i t D o c R e a d D o u b l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Read 'count' bytes, from data bus's LSB lane with 2 address shifted.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocReadDoubleShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* dest,FLWord count)
{
  volatile FLDword FAR0 *doc = ((volatile FLDword FAR0 *)win) + offset;
  register int         i;

#ifndef FL_NO_INIT_MMU_PAGES
  if (count == 0)
     return;

  dest[0] = 0;
  *((FLByte FAR1*)addToFarPointer(dest, (count - 1)) ) = (FLByte)0;
#endif /* FL_NO_INIT_MMU_PAGES */

  for(i=0;( i < count );i++)
     dest[i] = (Reg8bitType)FLREAD_IO_DWORD(doc+i);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c W r i t e D o u b l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Write 'count' bytes, to data bus's LSB lane with 2 address shifted.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocWriteDoubleShift(volatile  FLByte FAR0 * win,FLWord offset,FLByte FAR1* src,FLWord count)
{
  volatile FLDword FAR0 * doc = ((volatile FLDword FAR0 *)win) + offset;
  register int         i;

  for(i=0;( i < count );i++)
    FLWRITE_IO_DWORD((FLDword)(src[i]),doc+i);
}

/*----------------------------------------------------------------------
   f l 8 b i t D o c S e t D o u b l e S h i f t

   Note : Assume data is found in 8-LSB of DiskOnChip

   Set 'count' bytes, of data bus's LSB lane with 2 address shifted.
------------------------------------------------------------------------*/

void FAR1 fl8bitDocSetDoubleShift(volatile  FLByte FAR0 * win,FLWord offset,FLWord count, FLByte val)
{
  volatile FLDword FAR0 * doc = ((volatile FLDword FAR0 *)win)+offset;
  register int         i;

  for(i=0;( i < count );i++)
    FLWRITE_IO_DWORD((FLDword)val,doc+i);
}

/*************************************************/
/*        16-Bit DiskOnChip - No Shift           */
/*************************************************/

/*----------------------------------------------------------------------
   f l 1 6 b i t D o c R e a d N o S h i f t

   Note - this routine can read only even number of bytes 

⌨️ 快捷键说明

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