1
0
uboot-1.1.4-kirkwood/drivers/sk98lin/h/skdrv1st.h

207 lines
5.5 KiB
C
Raw Permalink Normal View History

2024-01-07 23:57:24 +01:00
/******************************************************************************
*
* Name: skdrv1st.h
* Project: GEnesis, PCI Gigabit Ethernet Adapter
2024-01-07 23:58:22 +01:00
* Version: $Revision: 1.1.1.1 $
2024-01-08 00:07:02 +01:00
* Date: $Date: 2008/12/15 11:39:21 $
2024-01-07 23:57:24 +01:00
* Purpose: First header file for driver and all other modules
*
******************************************************************************/
/******************************************************************************
*
2024-01-07 23:58:22 +01:00
* (C)Copyright 1998-2002 SysKonnect GmbH.
* (C)Copyright 2002-2005 Marvell.
2024-01-07 23:57:24 +01:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The information in this file is provided "AS IS" without warranty.
*
******************************************************************************/
#ifndef __INC_SKDRV1ST_H
#define __INC_SKDRV1ST_H
2024-01-07 23:58:22 +01:00
#if 0 /* uboot */
2024-01-07 23:57:24 +01:00
/* Check kernel version */
#include <linux/version.h>
#endif
typedef struct s_AC SK_AC;
2024-01-07 23:58:22 +01:00
/* Set card versions */
#define SK_FAR
2024-01-07 23:57:24 +01:00
/* override some default functions with optimized linux functions */
#define SK_PNMI_STORE_U16(p,v) memcpy((char*)(p),(char*)&(v),2)
#define SK_PNMI_STORE_U32(p,v) memcpy((char*)(p),(char*)&(v),4)
#define SK_PNMI_STORE_U64(p,v) memcpy((char*)(p),(char*)&(v),8)
#define SK_PNMI_READ_U16(p,v) memcpy((char*)&(v),(char*)(p),2)
2024-01-07 23:58:22 +01:00
#define SK_PNMI_READ_U32(p,v) memcpy((char*)&(v),(char*)(p),4)
#define SK_PNMI_READ_U64(p,v) memcpy((char*)&(v),(char*)(p),8)
2024-01-07 23:57:24 +01:00
#define SK_ADDR_EQUAL(a1,a2) (!memcmp(a1,a2,6))
2024-01-07 23:58:22 +01:00
#define SK_STRNCMP(s1,s2,len) strncmp(s1,s2,len)
#define SK_STRCPY(dest,src) strcpy(dest,src)
2024-01-07 23:57:24 +01:00
#include <linux/types.h>
2024-01-07 23:58:22 +01:00
#if 0 /* uboot */
2024-01-07 23:57:24 +01:00
#include <linux/kernel.h>
#endif
#include <linux/string.h>
2024-01-07 23:58:22 +01:00
#if 0 /* uboot */
2024-01-07 23:57:24 +01:00
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#endif
2024-01-07 23:58:22 +01:00
2024-01-07 23:57:24 +01:00
#include <asm/byteorder.h>
#include <asm/bitops.h>
#include <asm/io.h>
2024-01-07 23:58:22 +01:00
#if 0 /* uboot */
2024-01-07 23:57:24 +01:00
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <net/checksum.h>
#endif
2024-01-07 23:58:22 +01:00
#define SK_CS_CALCULATE_CHECKSUM
#ifndef CONFIG_X86_64
#define SkCsCalculateChecksum(p,l) ((~ip_compute_csum(p, l)) & 0xffff)
#else
#define SkCsCalculateChecksum(p,l) ((~ip_fast_csum(p, l)) & 0xffff)
#endif
2024-01-07 23:57:24 +01:00
#include "h/sktypes.h"
#include "h/skerror.h"
#include "h/skdebug.h"
#include "h/lm80.h"
#include "h/xmac_ii.h"
#include "u-boot_compat.h"
2024-01-07 23:58:22 +01:00
#ifndef SK_BMU_RX_WM_PEX
#define SK_BMU_RX_WM_PEX 0x80
#endif
2024-01-07 23:57:24 +01:00
#ifdef __LITTLE_ENDIAN
#define SK_LITTLE_ENDIAN
#else
#define SK_BIG_ENDIAN
2024-01-07 23:58:22 +01:00
#define SK_USE_REV_DESC
2024-01-07 23:57:24 +01:00
#endif
2024-01-07 23:58:22 +01:00
#if 0 /* uboot */
2024-01-07 23:57:24 +01:00
#define SK_NET_DEVICE net_device
#else
2024-01-07 23:58:22 +01:00
#define SK_NET_DEVICE eth_device
2024-01-07 23:57:24 +01:00
#endif
/* we use gethrtime(), return unit: nanoseconds */
2024-01-07 23:58:22 +01:00
#define SK_TICKS_PER_SEC 100
2024-01-07 23:57:24 +01:00
#define SK_MEM_MAPPED_IO
2024-01-07 23:58:22 +01:00
// #define SK_RLMT_SLOW_LOOKAHEAD
2024-01-07 23:57:24 +01:00
#define SK_MAX_MACS 2
#define SK_MAX_NETS 2
#define SK_IOC char*
typedef struct s_DrvRlmtMbuf SK_MBUF;
#define SK_CONST64 INT64_C
#define SK_CONSTU64 UINT64_C
#define SK_MEMCPY(dest,src,size) memcpy(dest,src,size)
#define SK_MEMCMP(s1,s2,size) memcmp(s1,s2,size)
#define SK_MEMSET(dest,val,size) memset(dest,val,size)
#define SK_STRLEN(pStr) strlen((char*)(pStr))
#define SK_STRNCPY(pDest,pSrc,size) strncpy((char*)(pDest),(char*)(pSrc),size)
#define SK_STRCMP(pStr1,pStr2) strcmp((char*)(pStr1),(char*)(pStr2))
/* macros to access the adapter */
2024-01-07 23:58:22 +01:00
#define SK_OUT8(b,a,v) writeb((v), ((b)+(a)))
#define SK_OUT16(b,a,v) writew((v), ((b)+(a)))
#define SK_OUT32(b,a,v) writel((v), ((b)+(a)))
2024-01-07 23:57:24 +01:00
#define SK_IN8(b,a,pv) (*(pv) = readb((b)+(a)))
#define SK_IN16(b,a,pv) (*(pv) = readw((b)+(a)))
#define SK_IN32(b,a,pv) (*(pv) = readl((b)+(a)))
#define int8_t char
#define int16_t short
#define int32_t long
#define int64_t long long
#define uint8_t u_char
#define uint16_t u_short
#define uint32_t u_long
#define uint64_t unsigned long long
#define t_scalar_t int
#define t_uscalar_t unsigned int
#define uintptr_t unsigned long
#define __CONCAT__(A,B) A##B
#define INT32_C(a) __CONCAT__(a,L)
#define INT64_C(a) __CONCAT__(a,LL)
#define UINT32_C(a) __CONCAT__(a,UL)
#define UINT64_C(a) __CONCAT__(a,ULL)
2024-01-07 23:58:22 +01:00
#define DEBUG
2024-01-07 23:57:24 +01:00
#ifdef DEBUG
#define SK_DBG_PRINTF printk
#ifndef SK_DEBUG_CHKMOD
#define SK_DEBUG_CHKMOD 0
#endif
#ifndef SK_DEBUG_CHKCAT
#define SK_DEBUG_CHKCAT 0
#endif
/* those come from the makefile */
#define SK_DBG_CHKMOD(pAC) (SK_DEBUG_CHKMOD)
#define SK_DBG_CHKCAT(pAC) (SK_DEBUG_CHKCAT)
extern void SkDbgPrintf(const char *format,...);
#define SK_DBGMOD_DRV 0x00010000
/**** possible driver debug categories ********************************/
#define SK_DBGCAT_DRV_ENTRY 0x00010000
#define SK_DBGCAT_DRV_SAP 0x00020000
#define SK_DBGCAT_DRV_MCA 0x00040000
#define SK_DBGCAT_DRV_TX_PROGRESS 0x00080000
#define SK_DBGCAT_DRV_RX_PROGRESS 0x00100000
#define SK_DBGCAT_DRV_PROGRESS 0x00200000
#define SK_DBGCAT_DRV_MSG 0x00400000
#define SK_DBGCAT_DRV_PROM 0x00800000
#define SK_DBGCAT_DRV_TX_FRAME 0x01000000
#define SK_DBGCAT_DRV_ERROR 0x02000000
#define SK_DBGCAT_DRV_INT_SRC 0x04000000
#define SK_DBGCAT_DRV_EVENT 0x08000000
#endif
#define SK_ERR_LOG SkErrorLog
extern void SkErrorLog(SK_AC*, int, int, char*);
#endif
2024-01-07 23:58:22 +01:00
/*******************************************************************************
*
* End of file
*
******************************************************************************/