📄 docsys.c
字号:
/*----------------------------------------------------------------------
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 flRead8bitUsing16bitsSingleShift(volatile byte FAR0 * win,word offset)
{
return( (Reg8bitType)FLREAD_IO_WORD(((volatile word 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 flRead8bitUsing32bitsSingleShift(volatile byte FAR0 * win,word offset)
{
#ifdef FL_BIG_ENDIAN
return (((offset & 0x1) == 0) ?
(Reg8bitType)(FLREAD_IO_DWORD(((volatile dword FAR0 *)win)+(offset>>1))>>24) :
(Reg8bitType)(FLREAD_IO_DWORD(((volatile dword FAR0 *)win)+(offset>>1))>>16));
#else
return (( offset & 0x1 ) ?
(Reg8bitType)(FLREAD_IO_DWORD(((volatile dword FAR0 *)win)+(offset>>1))>>8) :
(Reg8bitType)(FLREAD_IO_DWORD(((volatile dword 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 flRead8bitUsing32bitsDoubleShift(volatile byte FAR0 * win,word offset)
{
return((Reg8bitType)FLREAD_IO_DWORD(((volatile dword 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 fl8bitDocReadNoShift(volatile byte FAR0 * win,word offset,byte FAR1* dest,word count)
{
#ifndef FL_NO_INIT_MMU_PAGES
if (count == 0)
return;
*dest = (byte)0;
*((byte FAR1*)addToFarPointer(dest, (count - 1)) ) = (byte)0;
#endif /* FL_NO_INIT_MMU_PAGES */
TFFSCPY_FROM_IO(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 fl8bitDocWriteNoShift(volatile byte FAR0 * win,word offset,byte FAR1* src,word count)
{
TFFSCPY_TO_IO(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 fl8bitDocSetNoShift(volatile byte FAR0 * win,word offset,word count, byte val)
{
TFFSSET_IO(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 fl8bitDocReadSingleShift(volatile byte FAR0 * win,word offset,byte FAR1* dest,word count)
{
volatile word FAR0 * doc = ((volatile word FAR0 *)win) + offset;
register int i;
#ifndef FL_NO_INIT_MMU_PAGES
if (count == 0)
return;
*dest = (byte)0;
*((byte FAR1*)addToFarPointer(dest, (count - 1)) ) = (byte)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 fl8bitDocWriteSingleShift(volatile byte FAR0 * win,word offset,byte FAR1* src,word count)
{
volatile word FAR0 * doc = ((volatile word FAR0 *)win) + offset;
register int i;
for(i=0;( i < count );i++)
FLWRITE_IO_WORD((word)(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 fl8bitDocSetSingleShift(volatile byte FAR0 * win,word offset,word count, byte val)
{
volatile word FAR0 * doc = ((volatile word FAR0 *)win) + offset;
register int i;
for(i=0;( i < count );i++)
FLWRITE_IO_WORD((word)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 fl8bitDocReadDoubleShift(volatile byte FAR0 * win,word offset,byte FAR1* dest,word count)
{
volatile dword FAR0 *doc = ((volatile dword FAR0 *)win) + offset;
register int i;
#ifndef FL_NO_INIT_MMU_PAGES
if (count == 0)
return;
*dest = (byte)0;
*((byte FAR1*)addToFarPointer(dest, (count - 1)) ) = (byte)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 fl8bitDocWriteDoubleShift(volatile byte FAR0 * win,word offset,byte FAR1* src,word count)
{
volatile dword FAR0 * doc = ((volatile dword FAR0 *)win) + offset;
register int i;
for(i=0;( i < count );i++)
FLWRITE_IO_DWORD((dword)(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 fl8bitDocSetDoubleShift(volatile byte FAR0 * win,word offset,word count, byte val)
{
volatile dword FAR0 * doc = ((volatile dword FAR0 *)win)+offset;
register int i;
for(i=0;( i < count );i++)
FLWRITE_IO_DWORD((dword)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
Read 'count' bytes from M+ DiskOnChip with none shifted address bus.
------------------------------------------------------------------------*/
void fl16bitDocReadNoShift (volatile byte FAR0 * win, word offset, byte FAR1 * dest, word count )
{
volatile word FAR0 * swin = (volatile word FAR0 *)( win + offset);
register int i;
register word tmp;
#ifndef FL_NO_INIT_MMU_PAGES
if (count == 0)
return;
*dest = (byte)0;
*((byte FAR1*)addToFarPointer(dest, (count - 1)) ) = (byte)0;
#endif /* FL_NO_INIT_MMU_PAGES */
if( (dword)dest & 0x1 )
{
/* rare case: unaligned target buffer */
for (i = 0; i < (int)count; )
{
tmp = FLREAD_IO_WORD(swin);
#ifdef FL_BIG_ENDIAN
dest[i++] = (byte)(tmp>>8);
dest[i++] = (byte)tmp;
#else
dest[i++] = (byte)tmp;
dest[i++] = (byte)(tmp>>8);
#endif /* FL_BIG_ENDIAN */
}
}
else
{ /* mainstream case */
#ifdef USE_TFFS_COPY
TFFSCPY_FROM_IO( dest,win + offset,count );
#else
#ifdef ENVIRONMENT_VARS
if (flUse8Bit == 0)
{
FLCPY_FROM_IO( dest,win + offset, count );
}
else
#endif /* ENVIRONMENT_VARS */
{ /* read in short words */
for (i = 0, count = count >> 1; i < (int)count; i++)
#ifndef FL_XSCALE_BOOT_MODE
/* while increamenting DiskOnChip offset */
((word FAR1 *)dest)[i] = FLREAD_IO_WORD(swin+i);
#else
/* but do not increament DiskOnChip offset */
((word FAR1 *)dest)[i] = FLREAD_IO_WORD(swin);
#endif /* FL_XSCALE_BOOT_MODE */
}
#endif /* USE_TFFS_COPY */
}
}
/*----------------------------------------------------------------------
f l 1 6 b i t D o c W r i t e N o S h i f t
Write 'count' bytes to M+ DiskOnChip with none shifted address bus.
------------------------------------------------------------------------*/
void fl16bitDocWriteNoShift ( volatile byte FAR0 * win , word offset ,
byte FAR1 * src, word count )
{
volatile word FAR0 * swin = (volatile word FAR0 *)( win + offset);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -