1#ifndef _RTL8367C_TYPES_H_ 2#define _RTL8367C_TYPES_H_ 3 4#ifndef __KERNEL__ 5#include <stdio.h> 6#endif 7 8typedef unsigned long long rtk_uint64; 9typedef long long rtk_int64; 10typedef unsigned int rtk_uint32; 11typedef int rtk_int32; 12typedef unsigned short rtk_uint16; 13typedef short rtk_int16; 14typedef unsigned char rtk_uint8; 15typedef char rtk_int8; 16 17#define swapl32(x)\ 18 ((((x) & 0xff000000U) >> 24) | \ 19 (((x) & 0x00ff0000U) >> 8) | \ 20 (((x) & 0x0000ff00U) << 8) | \ 21 (((x) & 0x000000ffU) << 24)) 22#define swaps16(x) \ 23 ((((x) & 0xff00) >> 8) | \ 24 (((x) & 0x00ff) << 8)) 25 26#define _LITTLE_ENDIAN 27#undef ntohl 28#undef ntohs 29#undef htonl 30#undef htons 31#ifdef _LITTLE_ENDIAN 32 #define ntohs(x) (swaps16(x)) 33 #define ntohl(x) (swapl32(x)) 34 #define htons(x) (swaps16(x)) 35 #define htonl(x) (swapl32(x)) 36#else 37 #define ntohs(x) (x) 38 #define ntohl(x) (x) 39 #define htons(x) (x) 40 #define htonl(x) (x) 41#endif 42 43#define CONST_T const 44 45#define RTK_TOTAL_NUM_OF_WORD_FOR_1BIT_PORT_LIST 1 46 47#define RTK_MAX_NUM_OF_PORT 8 48#define RTK_PORT_ID_MAX (RTK_MAX_NUM_OF_PORT-1) 49#define RTK_PHY_ID_MAX (RTK_MAX_NUM_OF_PORT-4) 50#define RTK_MAX_PORT_MASK 0xFF 51 52#define RTK_WHOLE_SYSTEM 0xFF 53 54typedef struct rtk_portmask_s 55{ 56 rtk_uint32 bits[RTK_TOTAL_NUM_OF_WORD_FOR_1BIT_PORT_LIST]; 57} rtk_portmask_t; 58 59typedef enum rtk_enable_e 60{ 61 DISABLED = 0, 62 ENABLED, 63 RTK_ENABLE_END 64} rtk_enable_t; 65 66#ifndef ETHER_ADDR_LEN 67#define ETHER_ADDR_LEN 6 68#endif 69 70/* ethernet address type */ 71typedef struct rtk_mac_s 72{ 73 rtk_uint8 octet[ETHER_ADDR_LEN]; 74} rtk_mac_t; 75 76typedef rtk_uint32 rtk_pri_t; /* priority vlaue */ 77typedef rtk_uint32 rtk_qid_t; /* queue id type */ 78typedef rtk_uint32 rtk_data_t; 79typedef rtk_uint32 rtk_dscp_t; /* dscp vlaue */ 80typedef rtk_uint32 rtk_fid_t; /* filter id type */ 81typedef rtk_uint32 rtk_vlan_t; /* vlan id type */ 82typedef rtk_uint32 rtk_mac_cnt_t; /* MAC count type */ 83typedef rtk_uint32 rtk_meter_id_t; /* meter id type */ 84typedef rtk_uint32 rtk_rate_t; /* rate type */ 85 86typedef enum rtk_port_e 87{ 88 UTP_PORT0 = 0, 89 UTP_PORT1, 90 UTP_PORT2, 91 UTP_PORT3, 92 UTP_PORT4, 93 UTP_PORT5, 94 UTP_PORT6, 95 UTP_PORT7, 96 97 EXT_PORT0 = 16, 98 EXT_PORT1, 99 EXT_PORT2, 100 101 UNDEFINE_PORT = 30, 102 RTK_PORT_MAX = 31 103} rtk_port_t; 104 105 106#ifndef _RTL_TYPES_H 107 108#if 0 109typedef unsigned long long uint64; 110typedef long long int64; 111typedef unsigned int uint32; 112typedef int int32; 113typedef unsigned short uint16; 114typedef short int16; 115typedef unsigned char uint8; 116typedef char int8; 117#endif 118 119typedef rtk_uint32 ipaddr_t; 120typedef rtk_uint32 memaddr; 121 122#ifndef ETHER_ADDR_LEN 123#define ETHER_ADDR_LEN 6 124#endif 125 126typedef struct ether_addr_s { 127 rtk_uint8 octet[ETHER_ADDR_LEN]; 128} ether_addr_t; 129 130#ifdef __KERNEL__ 131#define rtlglue_printf printk 132#else 133#define rtlglue_printf printf 134#endif 135#define PRINT rtlglue_printf 136#endif /*_RTL_TYPES_H*/ 137 138/* type abstraction */ 139#ifdef EMBEDDED_SUPPORT 140 141typedef rtk_int16 rtk_api_ret_t; 142typedef rtk_int16 ret_t; 143typedef rtk_uint32 rtk_u_long; 144 145#else 146 147typedef rtk_int32 rtk_api_ret_t; 148typedef rtk_int32 ret_t; 149typedef rtk_uint64 rtk_u_long_t; 150 151#endif 152 153#ifndef NULL 154#define NULL 0 155#endif 156 157#ifndef TRUE 158#define TRUE 1 159#endif 160 161#ifndef FALSE 162#define FALSE 0 163#endif 164 165#define CONST const 166#endif /* _RTL8367C_TYPES_H_ */ 167