ここからは、読み込んでいるヘッダファイルになります。
定義が中心なので特殊なものはありません。
00001 /************************************************************************/ 00002 /* */ 00003 /* FILE : W5300.H */ 00004 /* DATE : 2010.01.12 */ 00005 /* DESCRIPTION : TYPE DEFINE */ 00006 /* CPU TYPE : NO ARCH */ 00007 /* */ 00008 /* CopyRight(C) by MCM Co.,Ltd. */ 00009 /************************************************************************/ 00010 #ifndef _W5300_H_ 00011 #define _W5300_H_ 00012 00013 /************************************************************************/ 00014 /* */ 00015 /* */ 00016 /* */ 00017 /************************************************************************/ 00018 #define write_data16(p, d) *((volatile ushort *)(p)) = d 00019 #define read_data16(p) *((volatile ushort *)(p)) 00020 00021 00022 /************************************************************************/ 00023 /* */ 00024 /* */ 00025 /* */ 00026 /************************************************************************/ 00027 /* BASE ADDRESS CS2空間 */ 00028 #define W5300_BASE ((uchar *)0x400000L) 00029 #define W5300_SOCKET_BASE ((uchar *)0x400200L) 00030 00031 /* for INDIRECT MODE */ 00032 #define IDM_AR (W5300_BASE + 0x002) 00033 #define IDM_DR (W5300_BASE + 0x004) 00034 00035 /* COMMON REGISTER */ 00036 #define MODE_REGISTER (W5300_BASE + 0x000) 00037 #define MODE_INITIAL_DATA (0x3800) 00038 #define MODE_FIFO_SWAP (0x0100) 00039 #define MODE_SW_RESET (0x0080) 00040 #define MODE_MEMORY_TEST (0x0020) 00041 #define MODE_PING_BLOCK (0x0010) 00042 #define MODE_ENABLE_PPPOE (0x0008) 00043 #define MODE_DATA_BUS_SWAP (0x0004) 00044 #define MODE_INDIRECT_ACCESS (0x0001) 00045 00046 #define CMN_REG_IR (W5300_BASE + 0x002) 00047 #define CMN_REG_IR_INITIAL_DATA (0x0000) 00048 #define CMN_REG_IR_IPCF (0x8000) 00049 #define CMN_REG_IR_DPUR (0x4000) 00050 #define CMN_REG_IR_PPPT (0x2000) 00051 #define CMN_REG_IR_FMTU (0x1000) 00052 00053 #define CMN_REG_IMR (W5300_BASE + 0x004) 00054 #define CMN_REG_INITIAL_DATA (0x0000) 00055 #define CMN_REG_IMR_IPCF (0x8000) 00056 #define CMN_REG_IMR_DPUR (0x4000) 00057 #define CMN_REG_IMR_PPPT (0x2000) 00058 #define CMN_REG_IMR_FMTU (0x1000) 00059 00060 #define CMN_MAC_ADDRESS (W5300_BASE + 0x008) 00061 #define CMN_GW_ADDRESS (W5300_BASE + 0x010) 00062 #define CMN_SUBNET_ADDRESS (W5300_BASE + 0x014) 00063 #define CMN_IP_ADDRESS (W5300_BASE + 0x018) 00064 00065 #define CMN_RETRY_TIME (W5300_BASE + 0x01c) 00066 #define CMN_RETRY_TIME_INITD (0x07d0) 00067 00068 #define CMN_RETRY_COUNT (W5300_BASE + 0x01e) /* 8Bit */ 00069 #define CMN_RETRY_COUNT_INITD (0x0008) 00070 00071 #define CMN_TX_MEMSIZE (W5300_BASE + 0x020) 00072 #define CMN_RX_MEMSIZE (W5300_BASE + 0x028) 00073 #define CMN_MEMORY_TYPE (W5300_BASE + 0x030) 00074 00075 /* PPPoE関係 */ 00076 #define CMN_PPPoE_PATR (W5300_BASE + 0x032) 00077 #define CMN_PPPoE_PTIMER (W5300_BASE + 0x036) 00078 #define CMN_PPPoE_PMAGICR (W5300_BASE + 0x038) 00079 #define CMN_PPPoE_PSIDR (W5300_BASE + 0x03c) 00080 #define CMN_PPPoE_PDHAR (W5300_BASE + 0x040) 00081 00082 /* ICMP関係 */ 00083 #define CMN_ICMP_UIPR (W5300_BASE + 0x048) 00084 #define CMN_ICMP_UPORTR (W5300_BASE + 0x04c) 00085 #define CMN_ICMP_FMTUR (W5300_BASE + 0x04e) 00086 00087 00088 /* BRDY Pin */ 00089 #define CMN_Pn_BRDYR (W5300_BASE + 0x060) 00090 #define CMN_Pn_Pn_BDPTHR (W5300_BASE + 0x062) 00091 00092 00093 /* W5300を示す */ 00094 #define CMN_W5300_IDR (W5300_BASE + 0x0fe) 00095 #define CMN_W5300_IDENTFICATION (0x5300) 00096 00097 00098 00099 /* SOCKET REGISTERS OFFSET */ 00100 #define SOCK_MODE (0x000) 00101 #define SOCK_MODE_INITD (0x0020) 00102 #define SOCK_PROT_CLOSE (0x00) 00103 #define SOCK_PROT_TCP (0x01) 00104 #define SOCK_PROT_UDP (0x02) 00105 #define SOCK_PROT_IPRAW (0x03) 00106 #define SOCK_PROT_MACRAW (0x04) 00107 #define SOCK_PROT_PPPoE (0x05) /* PPPoE */ 00108 #define SOCK_COMMAND (0x002) 00109 #define SOCK_CMD_OPEN (0x01) 00110 #define SOCK_CMD_LISTEN (0x02) 00111 #define SOCK_CMD_CONNECT (0x04) 00112 #define SOCK_CMD_DISCON (0x08) 00113 #define SOCK_CMD_CLOSE (0x10) 00114 #define SOCK_CMD_SEND (0x20) 00115 #define SOCK_CMD_SENDMAC (0x21) 00116 #define SOCK_CMD_SENDKEEP (0x22) 00117 #define SOCK_CMD_RECV (0x40) 00118 #define SOCK_IR (0x006) 00119 #ifndef _W5300_SOCK_IR_STATUS_ 00120 #define _W5300_SOCK_IR_STATUS_ 00121 #define SOCK_IR_PRECV (0x80) /* PPPoE */ 00122 #define SOCK_IR_PFAIL (0x40) /* PPPoE */ 00123 #define SOCK_IR_PNEXT (0x20) /* PPPoE */ 00124 #define SOCK_IR_SENDOK (0x10) 00125 #define SOCK_IR_TIMEOUT (0x08) 00126 #define SOCK_IR_RECV (0x04) 00127 #define SOCK_IR_DISCON (0x02) 00128 #define SOCK_IR_CON (0x01) 00129 #endif 00130 00131 #define SOCK_STATUS (0x008) 00132 #ifndef _W5300_SOCK_STATUS_ 00133 #define _W5300_SOCK_STATUS_ 00134 #define SOCK_STATUS_CLOSED (0x00) 00135 #define SOCK_STATUS_INIT (0x13) 00136 #define SOCK_STATUS_LISTEN (0x14) 00137 #define SOCK_STATUS_ESTAB (0x17) 00138 #define SOCK_STATUS_CLOSEWAIT (0x1c) 00139 #define SOCK_STATUS_UDP (0x22) 00140 #define SOCK_STATUS_IPRAW (0x32) 00141 #define SOCK_STATUS_MACRAW (0x42) 00142 #define SOCK_STATUS_PPPoE (0x5f) 00143 #define SOCK_STATUS_SYNSENT (0x15) 00144 #define SOCK_STATUS_SYNRECV (0x16) 00145 #define SOCK_STATUS_FINWAIT (0x18) 00146 #define SOCK_STATUS_TIMEWAIT (0x1b) 00147 #define SOCK_STATUS_LASTACK (0x1d) 00148 #define SOCK_STATUS_SOCKARP (0x01) 00149 #endif 00150 00151 #define SOCK_PORTR (0x00a) 00152 #define SOCK_DHADR (0x00c) 00153 #define SOCK_DPORTR (0x012) 00154 #define SOCK_DIPR (0x014) 00155 #define SOCK_MSSR (0x018) 00156 #define SOCK_KPALVTR (0x01a) 00157 #define SOCK_PROTR (0x01b) /* (注) バイトアクセス */ 00158 #define SOCK_TOSR (0x01c) 00159 #define SOCK_TTLR (0x01e) 00160 #define SOCK_TX_WRSIZE (0x020) /* 4 Bytes */ 00161 #define SOCK_TX_FREESIZE (0x024) /* 4 Bytes */ 00162 #define SOCK_RX_RECVSIZE (0x028) /* 4 Bytes */ 00163 #define SOCK_FRAGR (0x02c) /* 使用禁止 */ 00164 #define SOCK_TX_FIFOR (0x02e) 00165 #define SOCK_RX_FIFOR (0x030) 00166 00167 00168 /************************************************************************/ 00169 /* */ 00170 /* */ 00171 /* */ 00172 /************************************************************************/ 00173 void w5300_soft_reset(void); 00174 ushort get_nic_status(short sock); 00175 void nic_command(short sock, ushort cmd); 00176 void set_sock_ir_mask(ushort sockno, uchar flag); 00177 void clear_master_ir(ushort sockno); 00178 ushort get_sock_ir(short socket); 00179 void clear_sock_ir(short socket, ushort bit); 00180 ushort get_socket_mode(short socket); 00181 void set_socket_mode(short socket, ushort mode); 00182 void set_socket_mss(short socket, ushort mss); 00183 #if 0 00184 void set_mac_adrs(hw_address_t *mac_adr); 00185 #else 00186 void set_mac_adrs(void *mac_adr); 00187 #endif 00188 void set_dest_macadr(short sock, void *mac_adr); 00189 void set_ip_data(void *to, void *data); 00190 ulong get_dest_ip_data(short sock); 00191 void set_dest_ip_data(short sock, ulong data); 00192 void set_my_port_data(short sock, ushort port); 00193 void set_dest_port_data(short sock, ushort port); 00194 void *get_rxfifo_adr(short sock); 00195 void *get_txfifo_adr(short sock); 00196 long get_rx_recv_size(short sock); 00197 long get_tx_free_size(short sock); 00198 00199 ushort get_kpalvtimer(ushort sock); 00200 void set_kpalvtimer(ushort sock, ushort time); 00201 00202 #endif /* ndef(_W5300_H_) */
次項は、API群用のヘッダファイルです。
WIZNet W5300/6へ行く