Home | History | Annotate | Download | only in libbridge
      1 /*
      2  * dspbridge/src/api/linux/dsptrap.c
      3  *
      4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
      5  *
      6  * Copyright (C) 2007 Texas Instruments, Inc.
      7  *
      8  * This program is free software; you can redistribute it and/or modify it
      9  * under the terms of the GNU Lesser General Public License as published
     10  * by the Free Software Foundation version 2.1 of the License.
     11  *
     12  * This program is distributed .as is. WITHOUT ANY WARRANTY of any kind,
     13  * whether express or implied; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  * Lesser General Public License for more details.
     16  */
     17 
     18 
     19 /*
     20  *  ======== dsptrap.c ========
     21  *  Description:
     22  *      Source for trap hand-shaking (involves DeviceIOControl).
     23  *
     24  *
     25  *! Revision History
     26  *! =================
     27  *! 28-Jan-2000 rr: NT_CMD_FROM_OFFSET moved to dsptrap.h
     28  *! 02-Dec-1999 rr: DeviceIOControl now returns BOOL Value so !fSuccess
     29  *!                 indicates failure.
     30  *! 02-Nov-1999 kc: Modified to enable return values from BRD API calls.
     31  *! 01-Oct-1999 ag: DSPTRAP_Trap() now returns correct status.
     32  *! 18-Aug-1999 rr: Created.Ported from WSX tree.
     33  *
     34  */
     35 
     36 /*  ----------------------------------- Host OS */
     37 #include <host_os.h>
     38 
     39 /*  ----------------------------------- DSP/BIOS Bridge */
     40 #include <dbdefs.h>
     41 #include <errbase.h>
     42 
     43 /*  ----------------------------------- This */
     44 #include <dsptrap.h>
     45 #include <_dbdebug.h>
     46 
     47 /*  ----------------------------------- Globals */
     48 extern int hMediaFile;		/* class driver handle */
     49 
     50 /*
     51  * ======== DSPTRAP_Trap ========
     52  */
     53 DWORD DSPTRAP_Trap(Trapped_Args *args, int cmd)
     54 {
     55 	DWORD dwResult = DSP_EHANDLE;/* returned from call into class driver */
     56 
     57 	if (hMediaFile >= 0)
     58 		dwResult = ioctl(hMediaFile, cmd, args);
     59 	else
     60 		DEBUGMSG(DSPAPI_ZONE_FUNCTION, "Invalid handle to driver\n");
     61 
     62 	return dwResult;
     63 }
     64