Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

LINUX/archmnib.c

00001 /*
00002  *      This program is free software; you can redistribute it and/or
00003  *      modify it under the terms of the GNU General Public License
00004  *      as published by the Free Software Foundation; either version
00005  *      2 of the License, or (at your option) any later version.
00006  *
00007  *  Copyright 2005      Tim Schürmann
00008 */
00009 
00010 #ifdef SAVE_RCSID
00011 static char *rcsid =
00012     "@(#) $Id: archmnib.c,v 1.4 2006/03/20 11:26:00 trikalio Exp $";
00013 #endif
00014 
00015 #include <fcntl.h>
00016 #include <stdlib.h>
00017 #include <stdio.h>
00018 #include <string.h>
00019 #include <sys/ioctl.h>
00020 #include <unistd.h>
00021 
00022 #include "opencbm.h"
00023 #include "cbm_module.h"
00024 
00025 #include <linux/errno.h>  /* error codes */
00026 
00027 
00028 /*linux functions needed by parallel burst */
00029 
00030 __u_char cbmarch_parallel_burst_read(CBM_FILE f)
00031 {
00032         return ioctl(f, CBMCTRL_PARBURST_READ);
00033 }
00034 
00035 void cbmarch_parallel_burst_write(CBM_FILE f, __u_char c)
00036 {
00037         ioctl(f, CBMCTRL_PARBURST_WRITE, c);
00038 }
00039 
00040 int cbmarch_parallel_burst_read_track(CBM_FILE f, __u_char *buffer, unsigned int length)
00041 {
00042         int retval;
00043 
00044         PARBURST_RW_VALUE mv;
00045         mv.buffer=buffer;
00046         mv.length=length; /* only needed in write_track */
00047         retval=ioctl(f, CBMCTRL_PARBURST_READ_TRACK, &mv);  /* we have to catch retval to check on EFAULT */
00048         if(retval==(-EFAULT)) {printf("cbm4linux: cbm.c: cbm_parallel_burst_read_track: ioctl returned -EFAULT"); return 0;}
00049         return retval;
00050 }
00051 
00052 int cbmarch_parallel_burst_write_track(CBM_FILE f,  __u_char *buffer, unsigned int length)
00053 {
00054         int retval;
00055         
00056         PARBURST_RW_VALUE mv;
00057         mv.buffer=buffer;
00058         mv.length=length;
00059         retval=ioctl(f, CBMCTRL_PARBURST_WRITE_TRACK, &mv);
00060         if(retval==(-EFAULT)) {printf("cbm4linux: cbm.c: cbm_parallel_burst_write_track: ioctl returned -EFAULT"); return 0;}
00061         return retval;
00062 }

Generated on Sun Apr 30 18:45:43 2006 for opencbm by  doxygen 1.4.2