📄 sysalib.s
字号:
* ULONG address, /@ addr to read from @/* )**/FUNC_BEGIN(sysWord) lhbrx retval0,r0,p0 /* Read and swap */ blr /* Return to caller */FUNC_END(sysWord)/***************************************************************************** sysLong - reads a long from an address.** This function reads a long from a specified little-endian* address.** RETURNS:* Returns 32 bit data from the specified register.* ULONG sysLong* (* ULONG address, /@ Virtual addr to read from @/* )**/FUNC_BEGIN(sysLong) lwbrx retval0,r0,p0 /* Read and swap from address */ blr /* Return to caller */FUNC_END(sysLong)#endif/****************************************************************************** sysOutByte - writes a byte to an io address.** This function writes a byte to a specified io address.** RETURNS: N/A** VOID sysOutByte* (* UCHAR * pAddr, /@ Virtual I/O addr to write to @/* UCHAR data /@ data to be written @/* )**/FUNC_BEGIN(sysOutByte) stbx p1,r0,p0 /* Write a byte to PCI space */ eieio /* Sync I/O operation */ sync blr /* Return to caller */FUNC_END(sysOutByte)/***************************************************************************** sysOutWord - writes a word to an address swapping the bytes.** This function writes a swapped word to a specified* address.** RETURNS: N/A** VOID sysOutWord* (* ULONG address, /@ Virtual addr to write to @/* UINT16 data /@ Data to be written @/* )**/FUNC_BEGIN(sysOutWord) sthbrx p1,r0,p0 /* Write with swap to address */ eieio /* Sync I/O operation */ sync blr /* Return to caller */FUNC_END(sysOutWord)/***************************************************************************** sysOutLong - write a swapped long to address.** This routine will store a 32-bit data item (input as big-endian)* into an address in little-endian mode.** RETURNS: N/A** VOID sysOutLong* (* ULONG address, /@ Virtual addr to write to @/* ULONG data /@ Data to be written @/* )**/FUNC_BEGIN(sysOutLong) stwbrx p1,r0,p0 /* store data as little-endian */ eieio /* Sync I/O operation */ sync blr /* Return to caller */FUNC_END(sysOutLong)/****************************************************************************** sysPciRead32 - read 32 bit PCI data** This routine will read a 32-bit data item from PCI (I/O or* memory) space.** RETURNS: N/A** VOID sysPciRead32* (* ULONG * pAddr, /@ Virtual addr to read from @/* ULONG * pResult /@ location to receive data @/* )**/FUNC_BEGIN(sysPciRead32) eieio /* Sync I/O operation */ lwbrx p0,r0,p0 /* get the data and swap the bytes */ stw p0,0(p1) /* store into address ptd. to by p1 */ blr /* Return to caller */FUNC_END(sysPciRead32)/****************************************************************************** sysPciWrite32 - write a 32 bit data item to PCI space** This routine will store a 32-bit data item (input as big-endian)* into PCI (I/O or memory) space in little-endian mode.** RETURNS: N/A** VOID sysPciWrite32* (* ULONG * pAddr, /@ Virtual addr to write to @/* ULONG data /@ Data to be written @/* )**/FUNC_BEGIN(sysPciWrite32) stwbrx p1,r0,p0 /* store data as little-endian */ blr /* Return to caller */FUNC_END(sysPciWrite32)/****************************************************************************** sysPciInByte - reads a byte from PCI Config Space.** This function reads a byte from a specified PCI Config Space address.** RETURNS:* Returns 8 bit data from the specified register. Note that for PCI systems* if no target responds, the data returned to the CPU will be 0xff.** UINT8 sysPciInByte* (* UINT8 * pAddr, /@ Virtual addr to read from @/* )**/FUNC_BEGIN(sysPciInByte) eieio /* Sync I/O operation */ lbzx retval0,r0,p0 /* Read byte from PCI space */ blr /* Return to caller */FUNC_END(sysPciInByte)/****************************************************************************** sysPciInWord - reads a word (16-bit big-endian) from PCI Config Space.** This function reads a word from a specified PCI Config Space* (little-endian)* address.** RETURNS:* Returns 16 bit data from the specified register. Note that for PCI systems* if no target responds, the data returned to the CPU will be 0xffff.** USHORT sysPciInWord* (* USHORT * pAddr, /@ Virtual addr to read from @/* )*/FUNC_BEGIN(sysPciInWord) eieio /* Sync I/O operation */ lhbrx retval0,r0,p0 /* Read and swap from PCI space */ blr /* Return to caller */FUNC_END(sysPciInWord)/***************************************************************************** sysPciInLong - reads a long (32-bit big-endian) from PCI Config Space.** This function reads a long from a specified PCI Config Space* (little-endian)* address.** RETURNS:* Returns 32 bit data from the specified register. Note that for PCI systems* if no target responds, the data returned to the CPU will be 0xffffffff.** ULONG sysPciInLong* (* ULONG * pAddr, /@ Virtual addr to read from @/* )**/FUNC_BEGIN(sysPciInLong) eieio /* Sync I/O operation */ lwbrx retval0,r0,p0 /* Read and swap from PCI space */ blr /* Return to caller */FUNC_END(sysPciInLong)/****************************************************************************** sysPciOutByte - writes a byte to PCI Config Space.** This function writes a byte to a specified PCI Config Space address.** RETURNS: N/A** VOID sysPciOutByte* (* UINT8 * pAddr, /@ Virtual addr to write to @/* UINT8 data /@ Data to be written @/* )**/FUNC_BEGIN(sysPciOutByte) stbx p1,r0,p0 /* Write a byte to PCI space */ blr /* Return to caller */FUNC_END(sysPciOutByte)/****************************************************************************** sysPciOutWord - writes a word (16-bit big-endian) to PCI Config Space.** This function writes a word to a specified PCI Config Space (little-endian)* address.** RETURNS: N/A** VOID sysPciOutWord* (* USHORT * pAddr, /@ Virtual addr to write to @/* USHORT data /@ Data to be written @/* )**/FUNC_BEGIN(sysPciOutWord) sthbrx p1,r0,p0 /* Write with swap to PCI space */ blr /* Return to caller */FUNC_END(sysPciOutWord)/***************************************************************************** sysPciOutLong - writes a long (32-bit big-endian) to PCI Config Space.** This function writes a long to a specified PCI Config Space (little-endian)* address.** RETURNS: N/A** VOID sysPciOutLong* (* ULONG * pAddr, /@ Virtual addr to write to @/* ULONG data /@ Data to be written @/* )**/FUNC_BEGIN(sysPciOutLong) stwbrx p1,r0,p0 /* Write big-endian long to little-endian */ mr p0,p1 /* PCI space */ blr /* Return to caller */FUNC_END(sysPciOutLong) /******************************************************************************** sysPCGet - Get the value of the PC (Program Counter)** This routine returns the value of the PC.** SYNOPSIS* \ss* UINT32 sysPCGet* (* void* )* \se** RETURNS: the Program Counter Register (PC) value.*/FUNC_BEGIN(sysPCGet) mflr r4 /* Save LR value */ bl Next /* Set PC */Next: mflr r3 /* Get PC */ mtlr r4 /* Restor LR value */ blrFUNC_END(sysPCGet)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -