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

📄 target.h

📁 MICREL 网卡驱动 FOR CE 5.0
💻 H
📖 第 1 页 / 共 5 页
字号:
    *data = readl(( void* )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_WRITE_DWORD( phwi, addr, data )                                  \
    writel( data, ( void* )(( phwi )->m_pVirtualMemory + ( addr )))
#endif

#define HW_PCI_READ_BYTE( phwi, addr, data )                                \
    pci_read_config_byte(( struct pci_dev* )( phwi )->m_pPciCfg,            \
        addr, data )

#define HW_PCI_READ_WORD( phwi, addr, data )                                \
    pci_read_config_word(( struct pci_dev* )( phwi )->m_pPciCfg,            \
        addr, data )

#define HW_PCI_READ_DWORD( phwi, addr, data )                               \
    pci_read_config_dword(( struct pci_dev* )( phwi )->m_pPciCfg,           \
        addr, data )

#define HW_PCI_WRITE_BYTE( phwi, addr, data )                               \
    pci_write_config_byte(( struct pci_dev* )( phwi )->m_pPciCfg,           \
        addr, data )

#define HW_PCI_WRITE_WORD( phwi, addr, data )                               \
    pci_write_config_word(( struct pci_dev* )( phwi )->m_pPciCfg,           \
        addr, data )

#define HW_PCI_WRITE_DWORD( phwi, addr, data )                              \
    pci_write_config_dword(( struct pci_dev* )( phwi )->m_pPciCfg,          \
        addr, data )

#endif

#define MOVE_MEM( dest, src, len )                                          \
    memcpy( dest, src, len )

#endif /* #ifdef DEF_LINUX */

#endif /* #if defined(_WIN32) || defined(DEF_LINUX) */


/* -------------------------------------------------------------------------- *
 *                             QC TEST                                        *
 * -------------------------------------------------------------------------- */

#ifdef KS_ARM

#define cpu_to_le16(x)  ((unsigned short)(x))
#define cpu_to_le32(x)  ((unsigned long)(x))
#define le16_to_cpu(x)  ((unsigned short)(x))
#define le32_to_cpu(x)  ((unsigned long)(x))


/* asm/io.h */
#define __arch_getb(a)			(*(volatile unsigned char *)(a))
#define __arch_getw(a)			(*(volatile unsigned short *)(a))
#define __arch_getl(a)			(*(volatile unsigned int  *)(a))

#define __arch_putb(v,a)		(*(volatile unsigned char *)(a) = (v))
#define __arch_putw(v,a)		(*(volatile unsigned short *)(a) = (v))
#define __arch_putl(v,a)		(*(volatile unsigned int  *)(a) = (v))


#define __raw_writeb(v,a)		__arch_putb(v,a)
#define __raw_writew(v,a)		__arch_putw(v,a)
#define __raw_writel(v,a)		__arch_putl(v,a)

#define __raw_readb(a)			__arch_getb(a)
#define __raw_readw(a)			__arch_getw(a)
#define __raw_readl(a)			__arch_getl(a)


/* asm/arch/io.h */
#define __io(a)				(a)
#define __mem_pci(a)			((unsigned long)(a))


#ifdef __io
#define outb(v,p)			__raw_writeb(v,__io(p))
#define outw(v,p)			__raw_writew(cpu_to_le16(v),__io(p))
#define outl(v,p)			__raw_writel(cpu_to_le32(v),__io(p))

#define inb(p)	({ unsigned int __v = __raw_readb(__io(p)); __v; })
#define inw(p)	({ unsigned int __v = le16_to_cpu(__raw_readw(__io(p))); __v; })
#define inl(p)	({ unsigned int __v = le32_to_cpu(__raw_readl(__io(p))); __v; })

#define outsb(p,d,l)			__raw_writesb(__io(p),d,l)
#define outsw(p,d,l)			__raw_writesw(__io(p),d,l)
#define outsl(p,d,l)			__raw_writesl(__io(p),d,l)

#define insb(p,d,l)			__raw_readsb(__io(p),d,l)
#define insw(p,d,l)			__raw_readsw(__io(p),d,l)
#define insl(p,d,l)			__raw_readsl(__io(p),d,l)
#endif


/*
 * If this architecture has PCI memory IO, then define the read/write
 * macros.  These should only be used with the cookie passed from
 * ioremap.
 */
#ifdef __mem_pci

#define readb(c) ({ unsigned int __v = __raw_readb(__mem_pci(c)); __v; })
#define readw(c) ({ unsigned int __v = le16_to_cpu(__raw_readw(__mem_pci(c))); __v; })
#define readl(c) ({ unsigned int __v = le32_to_cpu(__raw_readl(__mem_pci(c))); __v; })

#define writeb(v,c)		__raw_writeb(v,__mem_pci(c))
#define writew(v,c)		__raw_writew(cpu_to_le16(v),__mem_pci(c))
#define writel(v,c)		__raw_writel(cpu_to_le32(v),__mem_pci(c))

#endif	/* __mem_pci */


#define HZ  100


extern volatile unsigned long jiffies;


#include "platform.h"


typedef unsigned char   BYTE;
typedef unsigned char   UCHAR;
typedef unsigned char   UINT8;
typedef unsigned char*  PUCHAR;
typedef unsigned short  WORD;
typedef unsigned short  USHORT;
typedef unsigned short* PUSHORT;
typedef unsigned long   DWORD;
typedef unsigned long   ULONG;
typedef unsigned long   UINT32;
typedef unsigned long*  PULONG;
typedef void*           PVOID;

typedef int             BOOLEAN;
typedef int*            PBOOLEAN;

typedef unsigned long long  ULONGLONG;
typedef unsigned long long* PULONGLONG;


#define FAR

#ifndef NULL
#define NULL  (( void* ) 0 )
#endif

#define FALSE  0
#define TRUE   1


#define NEWLINE    "\r\n"
#define DBG_PRINT  printf

void flush ( void );


#define CPU_TO_LE32( x )  cpu_to_le32( x )
#define LE32_TO_CPU( x )  le32_to_cpu( x )


void pci_read_config_byte ( PCIDevice_t* pdev, int offset, UCHAR* pbData );
void pci_read_config_word ( PCIDevice_t* pdev, int offset, USHORT* pwData );
void pci_read_config_dword ( PCIDevice_t* pdev, int offset, ULONG* pdwData );
void pci_write_config_byte ( PCIDevice_t* pdev, int offset, UCHAR bData );
void pci_write_config_word ( PCIDevice_t* pdev, int offset, USHORT wData );
void pci_write_config_dword ( PCIDevice_t* pdev, int offset, ULONG dwData );


#ifdef KS_ISA_BUS
#define HW_READ_BUFFER( phwi, addr, data, len )                             \
    insl(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data,              \
        (( len ) + 3 ) >> 2 )

#define HW_WRITE_BUFFER( phwi, addr, data, len )                            \
{                                                                           \
    outsl(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data,             \
        (( len ) + 3 ) >> 2 );                                              \
}

#define HW_READ_BUFFER_BYTE( phwi, addr, data, len )                        \
    insb(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_WRITE_BUFFER_BYTE( phwi, addr, data, len )                       \
    outsb(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_READ_BUFFER_WORD( phwi, addr, data, len )                        \
    insw(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_WRITE_BUFFER_WORD( phwi, addr, data, len )                       \
    outsw(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_READ_BUFFER_DWORD( phwi, addr, data, len )                       \
    insl(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_WRITE_BUFFER_DWORD( phwi, addr, data, len )                      \
    outsl(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )), data, len )

#define HW_READ_BYTE( phwi, addr, data )                                    \
    *data = inb(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))

#define HW_WRITE_BYTE( phwi, addr, data )                                   \
    outb( data, ( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))

#define HW_READ_WORD( phwi, addr, data )                                    \
    *data = inw(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))

#define HW_WRITE_WORD( phwi, addr, data )                                   \
    outw(( USHORT )( data ), ( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))

#define HW_READ_DWORD( phwi, addr, data )                                   \
    *data = inl(( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))

#define HW_WRITE_DWORD( phwi, addr, data )                                  \
    outl( data, ( unsigned )(( phwi )->m_ulVIoAddr + ( addr )))
#endif

#ifdef KS_PCI_BUS
#define HW_READ_BYTE( phwi, addr, data )                                    \
    *data = readb(( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_WRITE_BYTE( phwi, addr, data )                                   \
    writeb( data, ( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_READ_WORD( phwi, addr, data )                                    \
    *data = readw(( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_WRITE_WORD( phwi, addr, data )                                   \
    writew(( USHORT )( data ), ( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_READ_DWORD( phwi, addr, data )                                   \
    *data = readl(( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_WRITE_DWORD( phwi, addr, data )                                  \
    writel( data, ( unsigned )(( phwi )->m_pVirtualMemory + ( addr )))

#define HW_PCI_READ_BYTE( phwi, addr, data )                                \
    pci_read_config_byte(( PCIDevice_t* )( phwi )->m_pPciCfg,               \
        addr, data )

#define HW_PCI_READ_WORD( phwi, addr, data )                                \
    pci_read_config_word(( PCIDevice_t* )( phwi )->m_pPciCfg,               \
        addr, data )

#define HW_PCI_READ_DWORD( phwi, addr, data )                               \
    pci_read_config_dword(( PCIDevice_t* )( phwi )->m_pPciCfg,              \
        addr, data )

#define HW_PCI_WRITE_BYTE( phwi, addr, data )                               \
    pci_write_config_byte(( PCIDevice_t* )( phwi )->m_pPciCfg,              \
        addr, data )

#define HW_PCI_WRITE_WORD( phwi, addr, data )                               \
    pci_write_config_word(( PCIDevice_t* )( phwi )->m_pPciCfg,              \
        addr, data )

#define HW_PCI_WRITE_DWORD( phwi, addr, data )                              \
    pci_write_config_dword(( PCIDevice_t* )( phwi )->m_pPciCfg,             \
        addr, data )

#endif

#define MOVE_MEM( dest, src, len )                                          \
    memcpy( dest, src, len )


#include "util.h"
#endif


/* -------------------------------------------------------------------------- *
 *               Renesas SH7751R MS7751Rse BSP  (32-bit PCI bus\Generic bus)  *
 *                   VxWorks OS  ( Tornado 2.2.1 \vxWorks 5.5.1)              *
 * -------------------------------------------------------------------------- */

#ifdef DEF_VXWORKS
#include "vxWorks.h"                    /* define STATUS */
#include "cacheLib.h"
#include "stdio.h"
#include "string.h"

typedef unsigned char   BYTE;
typedef unsigned char * PUCHAR;
typedef unsigned char * PBYTE;
typedef unsigned short* PUSHORT;
typedef unsigned long * PULONG;
typedef unsigned long   ULONGLONG;
typedef unsigned long * PULONGLONG;
typedef int             BOOLEAN;
typedef	int		      * PBOOLEAN;
typedef void*           PVOID;


#define FAR

#define NEWLINE    "\n"
#define DBG_PRINT  printf

#define CPU_TO_LE32( x )  ( x )
#define LE32_TO_CPU( x )  ( x )

⌨️ 快捷键说明

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