Changeset 74864ac in mainline for uspace/srv/hw/netif/dp8390/dp8390.h
- Timestamp:
- 2011-01-06T15:28:51Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0777f4c5
- Parents:
- fc23ef6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/netif/dp8390/dp8390.h
rfc23ef6 r74864ac 11 11 12 12 #include <net/packet.h> 13 14 13 #include "dp8390_port.h" 15 14 16 /** Input/output size. 17 */ 18 #define DP8390_IO_SIZE 0x020 15 /** Input/output size */ 16 #define DP8390_IO_SIZE 0x0020 19 17 20 18 /* National Semiconductor DP8390 Network Interface Controller. */ … … 166 164 #define RSR_DFR 0x80 /* In later manuals: Deferring */ 167 165 168 /** Type definition of the receive header. 169 */ 170 typedef struct dp_rcvhdr 171 { 172 /** Copy of rsr. 173 */ 174 u8_t dr_status; 175 /** Pointer to next packet. 176 */ 177 u8_t dr_next; 178 /** Receive Byte Count Low. 179 */ 180 u8_t dr_rbcl; 181 /** Receive Byte Count High. 182 */ 183 u8_t dr_rbch; 166 /** Type definition of the receive header 167 * 168 */ 169 typedef struct dp_rcvhdr { 170 /** Copy of rsr */ 171 uint8_t dr_status; 172 173 /** Pointer to next packet */ 174 uint8_t dr_next; 175 176 /** Receive Byte Count Low */ 177 uint8_t dr_rbcl; 178 179 /** Receive Byte Count High */ 180 uint8_t dr_rbch; 184 181 } dp_rcvhdr_t; 185 182 186 /** Page size. 187 */ 188 #define DP_PAGESIZE 256 189 190 /* Some macros to simplify accessing the dp8390 */ 183 /** Page size */ 184 #define DP_PAGESIZE 256 185 191 186 /** Reads 1 byte from the zero page register. 192 187 * @param[in] dep The network interface structure. … … 194 189 * @returns The read value. 195 190 */ 196 #define inb_reg0(dep, reg) 191 #define inb_reg0(dep, reg) (inb(dep->de_dp8390_port+reg)) 197 192 198 193 /** Writes 1 byte zero page register. … … 201 196 * @param[in] data The value to be written. 202 197 */ 203 #define outb_reg0(dep, reg, data) 198 #define outb_reg0(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) 204 199 205 200 /** Reads 1 byte from the first page register. … … 208 203 * @returns The read value. 209 204 */ 210 #define inb_reg1(dep, reg) 205 #define inb_reg1(dep, reg) (inb(dep->de_dp8390_port+reg)) 211 206 212 207 /** Writes 1 byte first page register. … … 215 210 * @param[in] data The value to be written. 216 211 */ 217 #define outb_reg1(dep, reg, data) 212 #define outb_reg1(dep, reg, data) (outb(dep->de_dp8390_port+reg, data)) 218 213 219 214 /* Software interface to the dp8390 driver */ … … 222 217 struct iovec_dat; 223 218 224 _PROTOTYPE(typedef void (*dp_initf_t), (struct dpeth *dep) ); 225 _PROTOTYPE(typedef void (*dp_stopf_t), (struct dpeth *dep) ); 226 _PROTOTYPE(typedef void (*dp_user2nicf_t), (struct dpeth *dep, 227 struct iovec_dat *iovp, vir_bytes offset, 228 int nic_addr, vir_bytes count) ); 229 _PROTOTYPE(typedef void (*dp_nic2userf_t), (struct dpeth *dep, 230 int nic_addr, struct iovec_dat *iovp, 231 vir_bytes offset, vir_bytes count) ); 232 _PROTOTYPE(typedef void (*dp_getblock_t), (struct dpeth *dep, 233 int page, size_t offset, size_t size, void *dst) ); 219 typedef void (*dp_initf_t)(struct dpeth *dep); 220 typedef void (*dp_stopf_t)(struct dpeth *dep); 221 typedef void (*dp_user2nicf_t)(struct dpeth *dep, struct iovec_dat *iovp, vir_bytes offset, int nic_addr, vir_bytes count); 222 typedef void (*dp_nic2userf_t)(struct dpeth *dep, int nic_addr, struct iovec_dat *iovp, vir_bytes offset, vir_bytes count); 223 typedef void (*dp_getblock_t)(struct dpeth *dep, int page, size_t offset, size_t size, void *dst); 234 224 235 225 #define IOVEC_NR 1 236 226 237 typedef struct iovec_dat 238 { 227 typedef struct iovec_dat { 239 228 iovec_t iod_iovec[IOVEC_NR]; 240 229 int iod_iovec_s; 241 // no direct process access242 230 int iod_proc_nr; 243 231 vir_bytes iod_iovec_addr; 244 232 } iovec_dat_t; 245 /* 246 typedef struct iovec_dat_s 247 { 248 iovec_s_t iod_iovec[IOVEC_NR]; 249 int iod_iovec_s; 250 int iod_proc_nr; 251 cp_grant_id_t iod_grant; 252 vir_bytes iod_iovec_offset; 253 } iovec_dat_s_t; 254 */ 255 #define SENDQ_NR 1 /* Maximum size of the send queue */ 256 #define SENDQ_PAGES 6 /* 6 * DP_PAGESIZE >= 1514 bytes */ 233 234 #define SENDQ_NR 1 /* Maximum size of the send queue */ 235 #define SENDQ_PAGES 6 /* 6 * DP_PAGESIZE >= 1514 bytes */ 257 236 258 237 /** Maximum number of waiting packets to be sent or received. … … 260 239 #define MAX_PACKETS 4 261 240 262 typedef struct dpeth 263 { 264 /** Outgoing packets queue. 265 */ 241 typedef struct dpeth { 242 /** Outgoing packets queue */ 266 243 packet_t *packet_queue; 267 244 268 /** Outgoing packets count. 269 */ 245 /** Outgoing packets count */ 270 246 int packet_count; 271 247 272 /** Received packets queue. 273 */ 248 /** Received packets queue */ 274 249 packet_t *received_queue; 275 250 276 /** Received packets count. 277 */ 251 /** Received packets count */ 278 252 int received_count; 279 280 /* The de_base_port field is the starting point of the probe. 253 254 /* 255 * The de_base_port field is the starting point of the probe. 281 256 * The conf routine also fills de_linmem and de_irq. If the probe 282 257 * routine knows the irq and/or memory address because they are … … 293 268 char de_name[sizeof("dp8390#n")]; 294 269 295 /* The initf function fills the following fields. Only cards that do 270 /* 271 * The initf function fills the following fields. Only cards that do 296 272 * programmed I/O fill in the de_pata_port field. 297 273 * In addition, the init routine has to fill in the sendq data … … 309 285 /* Do it yourself send queue */ 310 286 struct sendq { 311 int sq_filled; 312 int sq_size; 313 int sq_sendpage; 287 int sq_filled; /* this buffer contains a packet */ 288 int sq_size; /* with this size */ 289 int sq_sendpage; /* starting page of the buffer */ 314 290 } de_sendq[SENDQ_NR]; 315 291 316 292 int de_sendq_nr; 317 int de_sendq_head; 318 int de_sendq_tail; 293 int de_sendq_head; /* Enqueue at the head */ 294 int de_sendq_tail; /* Dequeue at the tail */ 319 295 320 296 /* Fields for internal use by the dp8390 driver. */ … … 333 309 } dpeth_t; 334 310 335 #define DEI_DEFAULT 336 337 #define DEF_EMPTY 338 #define DEF_PACK_SEND 339 #define DEF_PACK_RECV 340 #define DEF_SEND_AVAIL 341 #define DEF_READING 342 #define DEF_PROMISC 343 #define DEF_MULTI 344 #define DEF_BROAD 345 #define DEF_ENABLED 346 #define DEF_STOPPED 347 348 #define DEM_DISABLED 349 #define DEM_SINK 350 #define DEM_ENABLED 311 #define DEI_DEFAULT 0x8000 312 313 #define DEF_EMPTY 0x000 314 #define DEF_PACK_SEND 0x001 315 #define DEF_PACK_RECV 0x002 316 #define DEF_SEND_AVAIL 0x004 317 #define DEF_READING 0x010 318 #define DEF_PROMISC 0x040 319 #define DEF_MULTI 0x080 320 #define DEF_BROAD 0x100 321 #define DEF_ENABLED 0x200 322 #define DEF_STOPPED 0x400 323 324 #define DEM_DISABLED 0x0 325 #define DEM_SINK 0x1 326 #define DEM_ENABLED 0x2 351 327 352 328 #endif
Note:
See TracChangeset
for help on using the changeset viewer.