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

📄 sysalib.s

📁 WINDRIVER MCP750 BSP
💻 S
📖 第 1 页 / 共 2 页
字号:
** From a C point of view, the routine is defined as follows:** RETURNS: N/A** From a C point of view, the routine is defined as follows:void sysOutByte    (    ULONG * addr  /@ address to write data to @/    UCHAR   data  /@ 8-bit data to write @/    )* NOMANUAL*/FUNC_BEGIN(sysOutByte)	/*	Write a byte to given address */	stbx	r4,r0,r3	/*	Sync I/O operation */	eieio	/*	Return to caller */	bclr	20,0FUNC_END(sysOutByte)/***************************************************************************** sysIn16 - reads a 16-bit unsigned value from an address.** This function reads a 16-bit unsigned value from a specified address.** RETURNS: 16-bit unsigned value from address.** From a C point of view, the routine is defined as follows:UINT16 sysIn16    (    UINT16 * addr  /@  address of data @/    )* NOMANUAL*/FUNC_BEGIN(sysIn16)	lhz	3,0(3)	eieio	bclr	20,0FUNC_END(sysIn16)/***************************************************************************** sysOut16 - writes a 16-bit unsigned value to an address.** This function writes a 16-bit unsigned value to a specified address.** RETURNS: N/A** From a C point of view, the routine is defined as follows:void sysOut16    (    UINT16 * addr  /@ address to write data to @/    UINT16   data  /@ 8-bit data @/    )* NOMANUAL*/FUNC_BEGIN(sysOut16)	sth	4,0(3)	eieio	bclr	20,0FUNC_END(sysOut16)/***************************************************************************** sysIn32 - reads a 32-bit unsigned value from an address.** This function reads a 32-bit unsigned value from a specified address.** RETURNS: 32-bit unsigned value from address.** From a C point of view, the routine is defined as follows:*UINT32 sysIn32    (    UINT32 * addr;  /@ address of data @/    )* NOMANUAL*/FUNC_BEGIN(sysIn32)	lwz	3,0(3)	eieio	bclr	20,0FUNC_END(sysIn32)/***************************************************************************** sysOut32 - writes a 32-bit unsigned value to an address.** This function writes a 32-bit unsigned value to a specified address.** RETURNS: N/A** From a C point of view, the routine is defined as follows:void sysOut32    (    UINT32 * addr  /@ address to write data to @/    UINT32   data  /@ 32-bit data @/    )* NOMANUAL*/FUNC_BEGIN(sysOut32)	stw	4,0(3)	eieio	bclr	20,0FUNC_END(sysOut32)/***************************************************************************** sysPciRead32 - read 32 bit PCI data** This routine will read a 32-bit data item from PCI ( I/O or* memory ) space.** RETURNS: 32-bit big endian data read from PCI space** From a C point of view, the routine is defined as follows:UINT32 sysPciRead32    (    UINT32 * addr  /@ address of data in PCI space @/    )* NOMANUAL*/FUNC_BEGIN(sysPciRead32)        lwbrx   r3,r0,r3        /* get the data and swap the bytes */	/*	Sync I/O operation */	eieio        stw     r3,0(r4)        /* store into address ptd. to by r4 */        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** From a C point of view, the routine is defined as follows:void sysPciWrite32    (    UINT32 * addr  /@ address to write data to @/    UINT32   data  /@ 32-bit big-endian data @/    )* NOMANUAL*/FUNC_BEGIN(sysPciWrite32)        stwbrx  r4,r0,r3        /* store data as little-endian */	/*	Sync I/O operation */	eieio        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: byte read from address** From a C point of view, the routine is defined as follows:UINT8 sysPciInByte    (    UINT8 * addr	/@ PCI config space address @/    )* NOMANUAL*/FUNC_BEGIN(sysPciInByte)        /*      Read byte from PCI space */        lbzx    r3,r0,r3        /*      Sync I/O operation */	eieio        /*      Return to caller */        bclr    20,0FUNC_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: word (16-bit big-endian) from address** From a C point of view, the routine is defined as follows:UINT16 sysPciInWord    (    UINT16 * addr        /@ PCI config space address @/    )* NOMANUAL*/FUNC_BEGIN(sysPciInWord)        /*      Read big-endian word from little-endian PCI space */        lhbrx   r3,r0,r3        /*      Sync I/O operation */	eieio        /*      Return to caller */        bclr    20,0FUNC_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: long (32-bit big-endian) read from address** From a C point of view, the routine is defined as follows:UINT32 sysPciLong    (    UINT32 * pPciAddr,          /@ Config Space address @/    )* NOMANUAL*/FUNC_BEGIN(sysPciInLong)        /* Read big-endian long from little-endian PCI space */        lwbrx   r3,r0,r3        /* Sync I/O operation */	eieio        /* Return to caller */        bclr    20,0FUNC_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** From a C point of view, the routine is defined as follows:void sysPciOutByte    (    UINT8 * pPciAddr,          /@ Config Space address @/    UINT8 dataOut              /@ byte to write @/    )* NOMANUAL*/FUNC_BEGIN(sysPciOutByte)        /*      Write a byte to PCI space */        stbx    r4,r0,r3        /*      Sync I/O operation */	eieio        /*      Return to caller */        bclr    20,0FUNC_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** From a C point of view, the routine is defined as follows:void sysPciOutWord    (    UINT16 * pPciAddr,          /@ Config Space address @/    UINT16 dataOut              /@ word (16-bit big-endian) to write @/    )* NOMANUAL*/FUNC_BEGIN(sysPciOutWord)        /*      Write a big-endian word to little-endian PCI space */        sthbrx  r4,r0,r3        /*      Sync I/O operation */	eieio        /*      Return to caller */        bclr    20,0FUNC_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** From a C point of view, the routine is defined as follows:void sysPciOutLong    (    UINT32 * pPciAddr,		/@ Config Space address @/    UINT32 dataOut		/@ long (32-bit big-endian) to write @/* NOMANUAL*/FUNC_BEGIN(sysPciOutLong)        /*      Write a big-endian long to little-endian PCI space */        stwbrx  r4,r0,r3        /*      Sync I/O operation */        mr      r3,r4	eieio        /*      Return to caller */        bclr    20,0FUNC_END(sysPciOutLong)/***************************************************************************** sysMemProbeSup - sysBusProbe support routine** This routine is called to try to read byte, word, or long, as specified* by length, from the specified source to the specified destination.** RETURNS: OK if successful probe, else ERROR** From a C point of view, the routine is defined as follows:STATUS sysMemProbeSup (length, src, dest)    (    int         length, /@ length of cell to test (1, 2, 4, 8, 16) @/    char *      src,    /@ address to read @/    char *      dest    /@ address to write @/    )* NOMANUAL*/FUNC_BEGIN(sysMemProbeSup)        addi    p7, p0, 0       /* save length to p7 */        xor     p0, p0, p0      /* set return status */        cmpwi   p7, 1           /* check for byte access */        bne     sbpShort        /* no, go check for short word access */        lbz     p6, 0(p1)       /* load byte from source */        eieio        sync        stb     p6, 0(p2)       /* store byte to destination */        eieio        sync        isync                   /* enforce for immediate exception handling */        blrsbpShort:        cmpwi   p7, 2           /* check for short word access */        bne     sbpWord         /* no, check for word access */        lhz     p6, 0(p1)       /* load half word from source */        eieio        sync        sth     p6, 0(p2)       /* store half word to destination */        eieio        sync        isync                   /* enforce for immediate exception handling */        blrsbpWord:        cmpwi   p7, 4           /* check for short word access */        bne     sysProbeExc     /* no, check for double word access */        lwz     p6, 0(p1)       /* load half word from source */        eieio        sync        stw     p6, 0(p2)       /* store half word to destination */        eieio        sync        isync                   /* enforce for immediate exception handling */        blrsysProbeExc:        li      p0, -1          /* shouldn't ever get here, but... */        blrFUNC_END(sysMemProbeSup)/***************************************************************************** sysL2crPut - write to L2CR register of Arthur CPU (SPR1017)** This routine will write the contents of r3 to the L2CR (SPR 1017)* register.** RETURNS: N/A** From a C point of view, the routine is defined as follows:void sysL2crPut    (    ULONG dataOut      /@ value to write @/    )* NOMANUAL*/FUNC_BEGIN(sysL2crPut)	mtspr	1017,r3	bclr	20,0FUNC_END(sysL2crPut)/***************************************************************************** sysL2crGet - read from L2CR register of Arthur CPU (SPR1017)** This routine will read the contents the L2CR (SPR 1017) register.** RETURNS: value of SPR1017 (in r3)** From a C point of view, the routine is defined as follows:UINT sysL2crGet (void)* NOMANUAL*/FUNC_BEGIN(sysL2crGet)	mfspr	r3,1017	bclr	20,0FUNC_END(sysL2crGet)/***************************************************************************** sysHid1Get - read from HID1 register SPR1009.** This routine will read the contents the HID1 (SPR1009)** RETURNS: value of SPR1009 (in r3)** From a C point of view, the routine is defined as follows:UINT sysHid1Get (void)*/FUNC_BEGIN(sysHid1Get)	mfspr	r3,1009	bclr	20,0FUNC_END(sysHid1Get)/***************************************************************************** sysSioRead - this function reads a register from the UIO chip** In order to read data from the desired Super IO register, the index register* must be written to with the offset of the of the register to be read.  The * desired byte of data is then read from the data register.** RETURNS: byte read from data register** From a C point of view, the routine is defined as follows:UINT8 sysSioRead    (     UINT8 * pSioIndexReg, 	/@ pointer to SIO index register base addr @/    UINT8 sioRegOffset		/@ offset of register to read from @/    )* NOMANUAL*/FUNC_BEGIN(sysSioRead)        stb     r4,0(r3)        /* write index register with register offset */        eieio        sync        lbz     r3,1(r3)        /* retrieve specified reg offset contents */        eieio        sync        bclr    20,0            /* return to caller */FUNC_END(sysSioRead)/***************************************************************************** sysSioWrite - this function writes a register to the UIO chip** In order to write data to the desired Super IO register, the index* register must be written to with the offset of the of the register to be* modified.  The desired byte of data can then be written via the data* register.** RETURNS: N/A** From a C point of view, the routine is defined as follows:void sysSioWrite    (     UINT8 * pSioIndexReg, 	/@ pointer to SIO index register base addr @/    UINT8 sioRegOffset, 	/@ offset of register to write to @/    UINT8 data			/@ 8-bit data to be written @/    )* NOMANUAL*/FUNC_BEGIN(sysSioWrite)        stb     r4,0(r3)        /* write index register with register offset */        eieio        sync        stb     r5,1(r3)        /* 1st write */        eieio        sync        stb     r5,1(r3)        /* 2nd write */        eieio        sync        bclr    20,0            /* return to caller */FUNC_END(sysSioWrite)

⌨️ 快捷键说明

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