📄 sysalib.s
字号:
/******************************************************************************* sysInWord - reads a word from an address, swapping the bytes.** This function reads a swapped word from a specified* address.** RETURNS:* Returns swapped 16 bit data from the specified address.* USHORT sysInWord* (* ULONG address, /@ addr to read from @/* )*/FUNC_BEGIN(sysInWord) lhbrx p0,r0,p0 /* Read and swap */ sync bclr 20,0 /* Return to caller */FUNC_END(sysInWord)/******************************************************************************* sysInLong - reads a long from an address.** 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 sysInLong* (* ULONG address, /@ Virtual addr to read from @/* )*/FUNC_BEGIN(sysInLong) lwbrx p0,r0,p0 /* Read and swap from address */ sync bclr 20,0 /* Return to caller */FUNC_END(sysInLong)/******************************************************************************** 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 */ isync /* Sync I/O operation */ sync bclr 20,0 /* 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 */ isync /* Sync I/O operation */ sync bclr 20,0 /* 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 */ isync /* Sync I/O operation */ sync bclr 20,0FUNC_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) isync /* 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 */ bclr 20,0FUNC_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 */ bclr 20,0FUNC_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) isync /* Sync I/O operation */ lbzx p0,r0,p0 /* Read byte from PCI space */ bclr 20,0 /* 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) isync /* Sync I/O operation */ lhbrx p0,r0,p0 /* Read and swap from PCI space */ bclr 20,0 /* 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) isync /* Sync I/O operation */ lwbrx p0,r0,p0 /* Read and swap from PCI space */ bclr 20,0 /* 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 */ bclr 20,0 /* 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 */ bclr 20,0 /* 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 */ bclr 20,0 /* Return to caller */FUNC_END(sysPciOutLong)FUNC_BEGIN(vxHid2Get) mfspr r3, 1011 blrFUNC_END(vxHid2Get)FUNC_BEGIN(vxHid2Set) mtspr 1011, r3 blrFUNC_END(vxHid2Set)FUNC_BEGIN(vxSvrGet) mfspr r3, 286 blrFUNC_END(vxSvrGet)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -