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

📄 sysalib.s

📁 vxworks的bsp开发包(基于POWERPC的PRPMC800)
💻 S
📖 第 1 页 / 共 2 页
字号:
* RETURNS: 32-bit unsigned value from address.*/FUNC_BEGIN(sysIn32)    lwz     3,0(3)                  /* Read 32 bit value */    bclr    20,0                    /* Return to caller */FUNC_END(sysIn32)/******************************************************************************** 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:* SYNOPSIS* \ss*         sysOut32*             (*             UINT32      *addr  - address to write data to*             UINT32       data  - 32-bit data*             )* \se* INPUTS:* r3      = address to write to* r4      = data to be written** RETURNS: N/A*/FUNC_BEGIN(sysOut32)    stw    4,0(3)                   /* Write 32 bit value */    sync                            /* Sync I/O operation */    bclr    20,0                    /* Return to caller */FUNC_END(sysOut32)/******************************************************************************** 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:* SYNOPSIS* \ss*         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 )* \se* INPUTS:* r3      = PCI address to read data from* r4      = pointer to store data to** RETURNS: N/A*/FUNC_BEGIN(sysPciRead32)    lwbrx   r3,r0,r3                /* get the data and swap the bytes */    stw     r3,0(r4)                /* store into address ptd. to by r4 */    sync                            /* Sync I/O operation */    bclr    20,0                    /* 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.  From a* C point of view, the routine is defined as follows:* SYNOPSIS* \ss*         sysPciWrite32*             (*             UINT32      *addr  - address to write data to*             UINT32       data  - 32-bit big-endian data*             )* \se* INPUTS:* r3      = PCI address to write to* r4      = data to be written** RETURNS: N/A*/FUNC_BEGIN(sysPciWrite32)    stwbrx  r4,r0,r3                /* store data as little-endian */    sync                            /* Sync I/O operation */    bclr    20,0                    /* 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.** ARGUMENTS:*       r3      = Config Space address** RETURNS:*       r3      = byte from address.*/FUNC_BEGIN(sysPciInByte)    lbzx    r3,r0,r3                /* 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.** ARGUMENTS:*       r3      = Config Space address** RETURNS:*       r3      = word (16-bit big-endian) from address.*/FUNC_BEGIN(sysInWord)FUNC_BEGIN(sysPciInWord)    lhbrx   r3,r0,r3                /* Read 16 bit byte reversed */    bclr    20,0                    /* Return to caller */FUNC_END(sysPciInWord)FUNC_END(sysInWord)/******************************************************************************* 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.*/FUNC_BEGIN(sysInLong)FUNC_BEGIN(sysPciInLong)    lwbrx   r3,r0,r3                /* Read 32 bit byte reversed */    bclr    20,0                    /* Return to caller */FUNC_END(sysPciInLong)FUNC_END(sysInLong)/******************************************************************************** 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*/FUNC_BEGIN(sysPciOutByte)    stbx    r4,r0,r3                /* Write a byte to PCI space */    sync                            /* Sync I/O operation */    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.** ARGUMENTS:*       r3      = Config Space address*       r4      = word (16-bit big-endian) to write** RETURNS: N/A*/FUNC_BEGIN(sysOutWord)FUNC_BEGIN(sysPciOutWord)    sthbrx  r4,r0,r3                /* Write byte-reversed 16 bit value */    sync                            /* Sync I/O operation */    bclr    20,0                    /* Return to caller */FUNC_END(sysPciOutWord)FUNC_END(sysOutWord)/******************************************************************************** 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*/FUNC_BEGIN(sysOutLong)FUNC_BEGIN(sysPciOutLong)    stwbrx  r4,r0,r3                /* Write byte-reversed long */    sync                            /* Sync I/O operation */    bclr    20,0                    /* Return to caller */FUNC_END(sysPciOutLong)FUNC_END(sysOutLong)/********************************************************************************* 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* SYNOPSIS* \ss* 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 **    )* \se*/FUNC_BEGIN(sysMemProbeSup)    addi    r10, r3, 0              /* save length to p7 */    xor     r3, r3, r3              /* set return status */    cmpwi   r10, 1                  /* check for byte access */    bne     sbpShort                /* no, go check for short word access */    lbz     r9, 0(r4)               /* load byte from source */    eieio    sync    stb     r9, 0(r5)               /* store byte to destination */    eieio    sync    isync                           /* flush instruction pipe */    blrsbpShort:    cmpwi   r10, 2                  /* check for short word access */    bne     sbpWord                 /* no, check for word access */    lhz     r9, 0(r4)               /* load half word from source */    eieio    sync    sth     r9, 0(r5)               /* store half word to destination */    eieio    sync    isync                           /* flush instruction pipe */    blrsbpWord:    cmpwi   r10, 4                  /* check for short word access */    bne     sysProbeExc             /* no, check for double word access */    lwz     r9, 0(r4)               /* load half word from source */    eieio    sync    stw     r9, 0(r5)               /* store half word to destination */    eieio    sync    isync                           /* flush instruction pipe */    blrsysProbeExc:    li      r3, -1                  /* shouldn't ever get here, but... */    blr                             /* Return to caller */FUNC_END(sysMemProbeSup)/********************************************************************************* 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:* SYSNOPSIS* \ss*    void sysL2crPut*             (*             ULONG       value to write*             )* \se* RETURNS: NA*/FUNC_BEGIN(sysL2crPut)    mtspr    1017,r3    bclr    20,0FUNC_END(sysL2crPut)/********************************************************************************* 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:* SYNOPSIS* \ss*    UINT sysL2crGet()* \se* RETURNS: value of SPR1017 (in r3)*/FUNC_BEGIN(sysL2crGet)    mfspr    r3,1017    bclr    20,0FUNC_END(sysL2crGet)/******************************************************************************** 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:* SYNOPSIS* \ss*    UINT32 sysTimeBaseLGet(void)* \se* RETURNS: value of TBR 268 (in r3)*/FUNC_BEGIN(sysTimeBaseLGet)    mftb 3    bclr 20,0FUNC_END(sysTimeBaseLGet)/******************************************************************************** sysHid1Get - read from HID1 register SPR1009.** This routine will read the contents the HID1 (SPR1009)** From a C point of view, the routine is defined as follows:* SYNOPSIS* \ss*    UINT sysHid1Get()* \se* RETURNS: value of SPR1009 (in r3)*/FUNC_BEGIN(sysHid1Get)    mfspr r3,1009    bclr 20,0FUNC_END(sysHid1Get)/******************************************************************************** sysGetDec - read from the Decrementer register SPR22.** This routine will read the contents the decrementer (SPR22)** From a C point of view, the routine is defined as follows:* SYNOPSIS* \ss*    UINT sysGetDec()* \se* RETURNS: value of SPR22 (in r3)*/sysGetDec:    mfspr r3,22    bclr 20,0/******************************************************************************** sysEEUnlock - unlock interrupts for particular key.* SYNOPSIS* \ss*	sysEEUnlock (int lockKey)* \se*/	sysEEUnlock:    rlwinm  r3,r3,0,16,16       /* select EE bit in lockKey */    mfmsr   r4                 /* move MSR to parm1 */    or      r3,r4,r3           /* restore EE bit */    mtmsr   r3                 /* UNLOCK INTERRUPRS */    isync                      /* Instruction SYNChronization XXX */    blr                        /* return to the caller */

⌨️ 快捷键说明

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