📄 os_intr.c
字号:
/*------------------------------------------------------------------------------
$File: //hodad/usblink/3.4/source/os/linux_2_4_18/os_intr.c $
$DateTime: 2003/11/14 13:57:14 $
$Revision: #1 $
Purpose: This file holds all functions for to operating system specific
interrupt functionality.
------------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
CONFIDENTIAL AND PROPRIETARY INFORMATION OF SOFTCONNEX TECHNOLOGIES, INC.
THIS NOTICE IS NOT TO BE DELETED, MODIFIED, MOVED OR CHANGED IN ANY WAY.
Copyright (c) 1999 - 2003 by SoftConnex Technologies, Inc.
This software is protected by copyright laws and international copyright
treaties, as well as other intellectual property laws and treaties. This
software is a CONFIDENTIAL, unpublished work of authorship, and with portions
constituting TRADE SECRETS of SoftConnex Technologies, Inc., a Delaware USA
corporation. Any unauthorized use, disclosure, and/or reproduction of this
software, or any part of this software; or distribution of this software in any
form or by any means; or storage of this software in any database or retrieval
system, without the express written consent of, and license from, SoftConnex
Technologies, Inc. is strictly prohibited. This software is protected under the
copyright and/or trade secret laws in other countries in addition to USA. All
Rights Reserved. Failure to abide by the use, disclosure and/or reproduction
restrictions may result in civil and /or criminal penalties, and will be
prosecuted to the maximum extent of the law.
------------------------------------------------------------------------------*/
#include "usblink.h"
#include <asm/irq.h>
#include <linux/sched.h>
#ifndef DEPRECATE_API
/*------------------------------------------------------------------------------
Name : OS_HookPCIInterruptVector
Purpose : Hook an interrupt handler to a PCI interrupt.
Arguments : Irq - The interrupt requestion number that we want to hook to.
VectorHandler - The interrupt service routine to be called.
Return : SCS_SUCCESS if the funtion succeeds or an error is returned.
Notes : None.
------------------------------------------------------------------------------*/
SctStatus OS_HookPCIInterruptVector(U32 irq, InterruptHandler vectorHandler)
{
SctStatus status;
/* Set up the interrupt service routine at the correct interrupt vector. */
status = request_irq(irq, (void *)vectorHandler, SA_SHIRQ, "usblink", (void *)SCC_USB_INTERRUPT_ID);
if (status != SCS_SUCCESS)
{
PRINT1("(OS_HookPCIInterruptVector) ERROR: request_irq failed.\n");
return(SCS_ERROR);
}
return(SCS_SUCCESS);
}
/*------------------------------------------------------------------------------
Name : OS_HookNonPCIInterruptVector
Purpose : Hook an interrupt handler to a non-PCI interrupt.
Arguments : Irq - The interrupt requestion number that we want to hook to.
vectorHandler - The interrupt service routine to be called.
Return : SCS_SUCCESS if the funtion succeeds or an error is returned.
Notes : None.
------------------------------------------------------------------------------*/
SctStatus OS_HookNonPCIInterruptVector(U32 irq, InterruptHandler vectorHandler)
{
PRINT1("(OS_HookNonPCIInterruptVector) ERROR: Not implemented.\n");
return(SCS_SUCCESS);
}
#endif
/*------------------------------------------------------------------------------
Name : OS_UnhookPciInterruptVector
Purpose : Unhook an interrupt handler to a PCI interrupt.
Arguments : irq - The interrupt requestion number that we want unhook.
vectorHandler - The interrupt service routine previously hooked
to irq.
Return : SCS_SUCCESS if the funtion succeeds or an error is returned.
Notes : None.
------------------------------------------------------------------------------*/
SctStatus OS_UnhookPCIInterruptVector(U32 irq)
{
free_irq(irq, (void *)SCC_USB_INTERRUPT_ID);
return(SCS_SUCCESS);
}
/*------------------------------------------------------------------------------
Name : OS_DisableInterrupt
Purpose : Function disables an interrupt.
Arguments : Irq - The interrupt to disable.
Returns : None.
Notes : None.
------------------------------------------------------------------------------*/
void OS_DisableInterrupts(U32 irq)
{
if (irq == SCC_MASK_ALL_INTERRUPTS)
{
/*cli();*/
local_irq_disable();
}
else
{
disable_irq(irq);
}
}
/*------------------------------------------------------------------------------
Name : OS_EnableInterrupt
Purpose : Function enables an interrupt.
Arguments : Irq - The interrupt to enable.
Returns : None.
Notes : None.
------------------------------------------------------------------------------*/
void OS_EnableInterrupts(U32 irq)
{
if (irq == SCC_MASK_ALL_INTERRUPTS)
{
/*sti();*/
local_irq_enable();
}
else
{
enable_irq(irq);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -