📄 ics_dev.c
字号:
/*************************************************************************** ics_dev.c - ICS-5x4 driver ------------------- begin : 2003 authors : Linus Gasser emails : linus.gasser@epfl.ch ***************************************************************************//*************************************************************************** Changes ------- date - name - description 03-09-16 - ineiti - create **************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/#include "system.h"#include "ics_dev.h"#include <linux/pci.h>#include "ql_5064.h"#include "debugging.h"#include "ics_564.h"#include "antenna.h"#include "ics_554.h"#define DBG_LVL 0struct ics_dev board_tx;struct ics_dev board_rx;void clean_dev(void){ // Used to clean forgotton iomaps :( u32 unmap[] = { 0 }; int i; for ( i=0; unmap[i]; i++ ){ PR_DBG( 1, "Unmapping %x\n", unmap[i] ); iounmap( (void*)unmap[i] ); }}int ics_get_board ( struct ics_dev *board, unsigned int device, unsigned int (*irq_handler)(unsigned int, struct pt_regs *) ){ int j; struct pci_dev *dev = NULL; int result; memset(board,0,sizeof(struct ics_dev)); // We suppose there is only one card dev = pci_find_subsys( ICS_VENDOR, ICS_DEVICE, ICS_SUB_VEN, device, NULL ); PR_DBG( 1, "value of DEV = %d\n", dev ); if ( dev ){ board->irq = -1; for(j=0; j < 3; j++) { board->hwbase[j] = pci_resource_start( dev, j ); board->iosize[j] = pci_resource_len( dev, j );; board->iobase[j] = (u64*) ioremap( board->hwbase[j], board->iosize[j]); PR_DBG( 4, "MEM(0x%x) b=0x%x s=0x%x mapped to 0x%x\n",j, (int)board->hwbase[j],board->iosize[j], board->iobase[j]); } board->irq = dev->irq; board->flags |= ICS554_INITIALIZED; PR_DBG( 1, "IRQ = %d\n", board->irq ); // Setting up the IRQ if ( irq_handler ){ result = rtl_request_irq( board->irq, irq_handler ); if(result) { PR_DBG( 1, "can't assign irq(%i)\n",board->irq); rtl_free_irq(board->irq); board->irq = -1; } else { PR_DBG( 1, "Irq %i assigned, result = %d\n", board->irq,result ); } } return 1; } else { return -EIO; } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -