|
|
1.1 ! root 1: /* $Header: /kernel/kersrc/ldrv/RCS/dmalock.c,v 1.1 92/07/17 15:27:50 bin Exp Locker: bin $ ! 2: * ! 3: * The information contained herein is a trade secret of INETCO ! 4: * Systems, Ltd, and is confidential information. It is provided ! 5: * under a license agreement, and may be copied or disclosed only ! 6: * under the terms of that agreement. Any reproduction or ! 7: * disclosure of this material without the express written ! 8: * authorization of INETCO Systems, Ltd. or persuant to the license ! 9: * agreement is unlawful. ! 10: * ! 11: * Copyright (c) 1989 ! 12: * An unpublished work by INETCO Systems, Ltd. ! 13: * All rights reserved. ! 14: * ! 15: * $Description: $ ! 16: * Routines to lock/unlock the DMA controller chip from a loadable driver. ! 17: * ! 18: * $Author: bin $ ! 19: * ! 20: * $Creation: June 29, 1989 $ ! 21: * ! 22: * $Log: dmalock.c,v $ ! 23: * Revision 1.1 92/07/17 15:27:50 bin ! 24: * Initial revision ! 25: * ! 26: * Revision 1.1 89/06/30 16:29:52 src ! 27: * Initial revision ! 28: * ! 29: */ ! 30: ! 31: #include <sys/coherent.h> ! 32: ! 33: typedef void (* vfp_t)(); /* Void function pointer type. */ ! 34: ! 35: /* ! 36: * External functions. ! 37: */ ! 38: extern void Kdmalock(); ! 39: extern void Kdmaunlock(); ! 40: extern void Kldtimcall(); ! 41: extern saddr_t getcs(); ! 42: ! 43: /* ! 44: * int ! 45: * dmalock( tp, fun, arg ) ! 46: * TIM * tp; ! 47: * vfp_t fun; ! 48: * int arg; ! 49: * ! 50: * Inputs: tp = Deferred function structure pointer. ! 51: * fun = Function to call if request is deferred. ! 52: * arg = Argument to pass to function. ! 53: * ! 54: * Action: Calls kernel dmalock() routine. ! 55: * ! 56: * Return: 0 = Lock granted or -1 = Lock deferred. ! 57: * ! 58: * Notes: DMA controller locking was introduced to cure a bug on the ! 59: * NCR DMA controller, where overlapped DMA caused problems. ! 60: * No action is taken if DMA locking is disabled. ! 61: */ ! 62: ! 63: int ! 64: dmalock( tp, fun, arg ) ! 65: register TIM * tp; ! 66: vfp_t fun; ! 67: int arg; ! 68: { ! 69: /* ! 70: * Define loadable driver interface. ! 71: * Kldtimcall will be invoked when a deferred function is executed. ! 72: * It will in turn invoke FP_SEL(tp->t_ldrv):4 (the calling drivers ! 73: * function call entry point), passing FP_OFF(tp->t_ldrv) (the function ! 74: * to call) in AX. ! 75: */ ! 76: FP_SEL(tp->t_ldrv) = getcs(); ! 77: FP_OFF(tp->t_ldrv) = fun; ! 78: return( kcall( Kdmalock, tp, Kldtimcall, arg ) ); ! 79: } ! 80: ! 81: /* ! 82: * void ! 83: * dmaunlock( tp ) ! 84: * TIM * tp; ! 85: * ! 86: * Inputs: tp = Deferred function structure pointer. ! 87: * ! 88: * Action: Calls the kernel dmaunlock(). ! 89: */ ! 90: ! 91: void ! 92: dmaunlock( tp ) ! 93: register TIM * tp; ! 94: { ! 95: kcall( Kdmaunlock, tp ); ! 96: } ! 97:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.