📄 variant.c
字号:
/* * $QNXLicenseC: * Copyright 2007, QNX Software Systems. * * Licensed under the Apache License, Version 2.0 (the "License"). You * may not reproduce, modify or distribute this software except in * compliance with the License. You may obtain a copy of the License * at: http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OF ANY KIND, either express or implied. * * This file may contain contributions from others, either as * contributors under the License or as licensors under other terms. * Please review this entire file for other proprietary rights or license * notices, as well as the QNX Development Suite License Guide at * http://licensing.qnx.com/license-guide/ for other information. * $ */#include <crys8900.h>int variant_irq_init(void *handle){ return (0);}int cs8900_variant_load(void *handle){ uint32_t iobase; int cnt, len; char *dst; npkt_t *npkt; net_buf_t *buf; net_iov_t *iov; cs8900_dev_t *cs8900 = (cs8900_dev_t *)handle; iobase = cs8900->iobase; cs8900->tx_bid = 0; cs8900->tx_active = 1; npkt = cs8900->nhead; cs8900->nhead = cs8900->nhead->next; npkt->next = NULL; if (npkt == cs8900->ntail) cs8900->ntail = NULL; cs8900->stats.octets_txed_ok += npkt->framelen; cs8900->out_buf.status = 0; cs8900->out_buf.length = npkt->framelen;; dst = cs8900->out_buf.data; for (buf = TAILQ_FIRST(&npkt->buffers); buf; buf = TAILQ_NEXT(buf, ptrs)) { for (cnt = 0, iov = buf->net_iov; cnt < buf->niov; cnt++, iov++) { len = iov->iov_len; memcpy(dst, iov->iov_base, len); dst += len; } } len = npkt->framelen; dst = cs8900->out_buf.data; while (len > 1) { outle16(iobase + CS8900_PORT_RXTX, *(uint16_t *)dst); dst += 2; len -= 2; } if (len) outle16(iobase + CS8900_PORT_RXTX, *dst); if (npkt->flags & _NPKT_NO_RES) { ion_free( npkt->org_data ); ion_free( npkt ); } else { pthread_mutex_unlock( &cs8900->mutex ); ion_tx_complete( cs8900->reg_hdl, npkt ); pthread_mutex_lock( &cs8900->mutex ); } return (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -