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

📄 usbpcistub.c

📁 WINDRIVER MCP750 BSP
💻 C
📖 第 1 页 / 共 2 页
字号:
/***************************************************************************** usbPciByteIn - input a byte from PCI I/O space** Inputs a byte from a PCI I/O address <address>.** RETURNS: byte input from i/o address*/UINT8 usbPciByteIn    (    UINT32 address		/* PCI I/O address */    )    {    return OUR_PCI_IN_BYTE (address);    }/***************************************************************************** usbPciWordIn - input a word from PCI I/O space** Inputs a word from a PCI I/O address <address>.** NOTE: This function adjusts for big vs. little endian environments.** RETURNS: word input from i/o address*/UINT16 usbPciWordIn    (    UINT32 address		/* PCI I/O address */    )    {    UINT16 w = OUR_PCI_IN_WORD (address);    return FROM_LITTLEW (w);    }/***************************************************************************** usbPciDwordIn - input a dword from PCI I/O space** Inputs a dword from a PCI I/O address <address>.** NOTE: This function adjusts for big vs. little endian environments.** RETURNS: dword input from i/o address*/UINT32 usbPciDwordIn    (    UINT32 address		/* PCI I/O address */    )    {    UINT32 l = OUR_PCI_IN_DWORD (address);    return FROM_LITTLEL (l);    }/***************************************************************************** usbPciByteOut - output a byte to PCI I/O space** Outputs <value> to the PCI I/O address <address>.** RETURNS: N/A*/VOID usbPciByteOut    (    UINT32 address,		/* PCI I/O address */    UINT8 value 		/* value */    )    {    OUR_PCI_OUT_BYTE (address, value);    CACHE_PIPE_FLUSH ();    }/***************************************************************************** usbPciWordOut - outputs a word to PCI I/O space** Outputs <value> to the PCI I/O address <address>.** NOTE: This function adjusts for big vs. little endian environments.** RETURNS: N/A*/VOID usbPciWordOut    (    UINT32 address,		/* PCI I/O address */    UINT16 value		/* value */    )    {    UINT16 w = TO_LITTLEW (value);    OUR_PCI_OUT_WORD (address, w);    CACHE_PIPE_FLUSH ();    }/***************************************************************************** usbPciDwordOut - outputs a dword to PCI I/O space** Outputs <value> to the PCI I/O address <address>.** NOTE: This function adjusts for big vs. little endian environments.** RETURNS: N/A*/VOID usbPciDwordOut    (    UINT32 address,		/* PCI I/O address */    UINT32 value		/* value */    )    {    UINT32 l = TO_LITTLEL (value);    OUR_PCI_OUT_DWORD (address, l);    CACHE_PIPE_FLUSH ();    }/***************************************************************************** usbPciMemioOffset - Return PCI MEMIO to CPU MEMIO offset** For memory-mapped I/O, the CPU's view of a memory address may not be the* same as that programmed into the base address register of a PCI adapter.* The CPU should add the value returned by this function to the BAR in order* to produce the correct CPU-visible memory address.** RETURNS: PCI_MEMIO_OFFSET*/UINT32 usbPciMemioOffset (void)    {    return PCI_MEMIO_OFFSET;    }/***************************************************************************** usbMemToPci - Convert a memory address to a PCI-reachable memory address** Converts <pMem> to an equivalent 32-bit memory address visible from the * PCI bus.  This conversion is necessary to allow PCI bus masters to address* the same memory viewed by the processor.** RETURNS: converted memory address*/UINT32 usbMemToPci    (    pVOID pMem			/* memory address to convert */    )    {    pVOID pPhys;        /* The conversion is a two-step process.  First, we need to convert the     * logical processor address (virtual) to a physical address.  Then, we     * convert the physical address to one which can be seen from the PCI     * bus.     */    pPhys = CACHE_DRV_VIRT_TO_PHYS (&cacheUserFuncs, pMem);    return ((UINT32) pPhys) + PCI_MEM_OFFSET;    }/***************************************************************************** usbPciToMem - Convert a PCI-reachable address to a CPU-reachable pointer** Converts <pciAdrs> to an equivalent CPU memory address.  ** RETURNS: pointer to PCI memory*/pVOID usbPciToMem    (    UINT32 pciAdrs		/* 32-bit PCI address to be converted */    )    {    return CACHE_DRV_PHYS_TO_VIRT (&cacheUserFuncs, 	(void *) (pciAdrs - PCI_MEM_OFFSET));    }/***************************************************************************** usbPciMemInvalidate - Invalidate cache for a region of memory** When another bus master, such as a PCI bus master, writes to memory, the* cache may need to be invalidated for that region of memory.** NOTE: Returns immediately if size == 0.** RETURNS: N/A*/VOID usbPciMemInvalidate    (    pVOID pMem, 		/* base of memory region to invalidate */    UINT32 size 		/* size of region to invalidate */    )    {    if (size != 0)	CACHE_USER_INVALIDATE (pMem, size);    }/***************************************************************************** usbPciMemFlush - Flush a region of memory through the cache** In systems which implement a non-write-thru cache, the processor may have* written data to memory which has not yet been flushed to the actual system* memory.  Before other bus masters may interrogate this memory, it may be* necessary to flush the cache.** NOTE: Returns immediately if size == 0.** RETURNS: N/A*/VOID usbPciMemFlush    (    pVOID pMem, 		/* base of memory region to invalidate */    UINT32 size 		/* size of region to invalidate */    )    {    if (size != 0)	CACHE_USER_FLUSH (pMem, size);    }/***************************************************************************** usbPciIntConnect - Connect to a interrupt vector** Connects the <func> to the interrupt number <intNo>.	<param> is an* application-specific value which will be passed to <func> each time* the interrupt handler is invoked.  ** RETURNS: OK, or ERROR if unable to connect/enable interrupt*/STATUS usbPciIntConnect    (    INT_HANDLER_PROTOTYPE func,     /* new interrupt handler */    pVOID param,		    /* parameter for int handler */    UINT16 intNo		    /* interrupt vector number */    )    {    if (INT_CONNECT (intNo, func, param) != OK)	return ERROR;    if (INT_ENABLE (intNo) != OK)	{	INT_DISCONNECT (intNo, func, param);	return ERROR;	}    if (intNo < MAX_INT_NO) 	intUsage [intNo]++;    return OK;    }/***************************************************************************** usbPciIntDisconnect - Removes an interrupt handler** Removes an interrupt handler installed by usbPciIntConnect().  <func>,* <param>, and <intNo> must match the corresponding parameters from an earlier * call to usbPciIntConnect().** RETURNS: N/A*/VOID usbPciIntRestore    (    INT_HANDLER_PROTOTYPE func,     /* int handler to be removed */    pVOID param,		    /* parameter for int handler */    UINT16 intNo		    /* interrupt vector number */    )    {    if (intNo >= MAX_INT_NO || 	(intUsage [intNo] != 0 && --intUsage [intNo] == 0))	{	INT_DISABLE (intNo);	}    INT_DISCONNECT (intNo, func, param);    }/* End of file. */

⌨️ 快捷键说明

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