Lines Matching refs:softc

167 static int catc_init_device( catc_softc_t *softc )
172 usbdev_t *dev = softc->dev;
177 usb_get_device_descriptor( softc->dev, &dev_desc, 0 );
183 softc->ven_code = ptr[2];
211 catc_get_mac_addr( dev, softc->mac_addr );
215 VENDOR_NAMES[softc->ven_code], softc->mac_addr);
222 catc_softc_t *softc = (catc_softc_t *) ctx;
223 hs_memcpy_to_hs( mac_addr, softc->mac_addr, 6 );
227 static void catc_queue_rx( catc_softc_t *softc )
229 softc->rx_ur = usb_make_request(softc->dev, softc->bulk_inpipe,
230 softc->rxbuf, sizeof(softc->rxbuf),
232 usb_queue_request(softc->rx_ur);
237 catc_softc_t *softc = (catc_softc_t *) ctx;
238 usb_poll(softc->dev->ud_bus);
239 return( !softc->rx_ur->ur_inprogress );
244 catc_softc_t *softc = (catc_softc_t *) ctx;
248 if( !softc->rx_ur->ur_inprogress ) {
249 rxbuf = softc->rxbuf;
250 len = softc->rx_ur->ur_xferred;
258 usb_free_request(softc->rx_ur);
259 catc_queue_rx( softc );
269 catc_softc_t *softc = (catc_softc_t *) ctx;
283 ur = usb_make_request(softc->dev, softc->bulk_outpipe,
292 static void catc_open_device( catc_softc_t *softc )
297 catc_set_reg( softc->dev, (CATC_ETH_ADDR_0_REG - i), softc->mac_addr[i] );
300 catc_set_reg( softc->dev, CATC_ETH_CTRL_REG, 0x09 );
303 catc_queue_rx( softc );
306 static void catc_close_device( catc_softc_t *softc )
308 usbdev_t *dev = softc->dev;
324 * device and allocating our softc here.
343 catc_softc_t *softc;
348 softc = (catc_softc_t *) KMALLOC( sizeof(catc_softc_t), 0 );
349 if( softc == NULL ) {
350 xprintf( "Failed to allocate softc memory.\n" );
353 memset( softc, 0, sizeof(catc_softc_t) );
354 dev->ud_private = softc;
355 softc->dev = dev;
384 if (catc_init_device(softc) < 0)
388 softc->bulk_inpipe = usb_open_pipe(dev,indscr);
389 softc->bulk_outpipe = usb_open_pipe(dev,outdscr);
392 usbeth_register(&usbeth_catc,softc);
395 catc_open_device( softc );
417 catc_softc_t *softc = (catc_softc_t *) dev->ud_private;
419 if (softc != NULL) {
420 usbeth_unregister( softc );
421 catc_close_device ( softc );
423 softc->dev = NULL;
424 KFREE(softc);
446 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
448 if (softc->dev == NULL)
452 catc_open_device( softc );
459 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
461 if (softc->dev == NULL)
464 buffer->buf_retlen = catc_get_eth_frame( softc, buffer->buf_ptr );
472 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
474 if (softc->dev == NULL)
477 inpstat->inp_status = catc_data_rx( softc );
484 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
486 if (softc->dev == NULL)
490 catc_send_eth_frame( softc, buffer->buf_ptr, buffer->buf_length );
498 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
501 if (softc->dev == NULL)
507 catc_get_dev_addr( softc, buffer->buf_ptr );
545 catc_softc_t *softc = (catc_softc_t *) ctx->dev_softc;
547 if (softc->dev == NULL)
551 catc_close_device( softc );