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

📄 sysalib.s

📁 VxWorks下 MV2400的BSP源码
💻 S
📖 第 1 页 / 共 2 页
字号:
sysIn32:	lwz	3,0(3)	eieio	bclr	20,0/******************************************************************************** sysOut32 - writes a 32-bit unsigned value to an address.** This function writes a 32-bit unsigned value to a specified address.** From a C point of view, the routine is defined as follows:**         sysOut32*             (*             UINT32      *addr  - address to write data to*             UINT32       data  - 32-bit data*             )** INPUTS:* r3      = address to write to* r4      = data to be written** RETURNS: N/A*/sysOut32:	stw	4,0(3)	eieio	bclr	20,0/******************************************************************************** sysPciRead32 - read 32 bit PCI data** This routine will read a 32-bit data item from PCI ( I/O or* memory ) space.  From a C programmers point of view, the routine* is defined as follows:**         sysPciRead32*             (*             UINT32      *addr;  - address of data in PCI space*             UINT32      *pdata  - pointer to data being returned*             )                     by the read call ( data is converted*                                   to big-endian )** INPUTS:* r3      = PCI address to read data from* r4      = pointer to store data to** RETURNS: N/A*/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,0/******************************************************************************** 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.  From a* C point of view, the routine is defined as follows:**         sysPciWrite32*             (*             UINT32      *addr  - address to write data to*             UINT32       data  - 32-bit big-endian data*             )** INPUTS:* r3      = PCI address to write to* r4      = data to be written** RETURNS: N/A*/sysPciWrite32:        stwbrx  r4,r0,r3        /* store data as little-endian */	/*	 *	Sync I/O operation	 */	eieio        bclr    20,0/******************************************************************************* sysPciInByte - reads a byte from PCI Config Space.** This function reads a byte from a specified PCI Config Space address.** ARGUMENTS:*       r3      = Config Space address** RETURNS:*       r3      = byte from address.*/sysPciInByte:        /*         *      Read byte from PCI space         */        lbzx    r3,r0,r3        /*         *      Sync I/O operation         */	eieio        /*         *      Return to caller         */        bclr    20,0/******************************************************************************* 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.** ARGUMENTS:*       r3      = Config Space address** RETURNS:*       r3      = word (16-bit big-endian) from address.*/sysPciInWord:        /*         *      Read big-endian word from little-endian PCI space         */        lhbrx   r3,r0,r3        /*         *      Sync I/O operation         */	eieio        /*         *      Return to caller         */        bclr    20,0/******************************************************************************* 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.** ARGUMENTS:*       r3      = Config Space address** RETURNS:*       r3      = long (32-bit big-endian) from address.*/sysPciInLong:        /*         *      Read big-endian long from little-endian PCI space         */        lwbrx   r3,r0,r3        /*         *      Sync I/O operation         */	eieio        /*         *      Return to caller         */        bclr    20,0/******************************************************************************** sysPciOutByte - writes a byte to PCI Config Space.** This function writes a byte to a specified PCI Config Space address.** ARGUMENTS:*       r3      = Config Space address*       r4      = byte to write** RETURNS: N/A*/sysPciOutByte:        /*         *      Write a byte to PCI space         */        stbx    r4,r0,r3        /*         *      Sync I/O operation         */	eieio        /*         *      Return to caller         */        bclr    20,0/******************************************************************************** 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.** ARGUMENTS:*       r3      = Config Space address*       r4      = word (16-bit big-endian) to write** RETURNS: N/A*/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,0/******************************************************************************** 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.** ARGUMENTS:*       r3      = Config Space address*       r4      = long (32-bit big-endian) to write** RETURNS: N/A*/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,0/********************************************************************************* 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 ERRORSTATUS 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 *    )*/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... */        blr/********************************************************************************* sysL2crPut - write to L2CR register of Arthur CPU** This routine will write the contents of r3 to the L2CR* register.*             )* From a C point of view, the routine is defined as follows:**    void sysL2crPut*             (*             ULONG       value to write*             )** RETURNS: NA*/sysL2crPut:	mtspr	1017,r3	bclr	20,0/********************************************************************************* sysL2crGet - read from L2CR register of Arthur CPU** This routine will read the contents the L2CR register.** From a C point of view, the routine is defined as follows:**    UINT sysL2crGet()** RETURNS: value of SPR1017 (in r3)*/sysL2crGet:	mfspr	r3,1017	bclr	20,0/******************************************************************************** sysTimeBaseLGet - Get lower half of Time Base Register** This routine will read the contents the lower half of the Time* Base Register (TBL - TBR 268).** From a C point of view, the routine is defined as follows:**    UINT32 sysTimeBaseLGet(void)** RETURNS: value of TBR 268 (in r3)*/sysTimeBaseLGet:	mftb 3	bclr 20,0

⌨️ 快捷键说明

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