From: <se...@pr...> - 2004-01-30 15:00:48
|
Update of /cvsroot/gc-linux/linux/arch/ppc/platforms In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16537/arch/ppc/platforms Modified Files: Makefile gamecube.h Added Files: gc-dvdcover.c Log Message: Adding DVD Cover Message Driver Changed name of GameCube Reset Switch option --- NEW FILE: gc-dvdcover.c --- /* ------------------------------------------------------------------------- */ /* gc-dvdcover.c GameCube DVD Cover Close Message Driver */ /* ------------------------------------------------------------------------- */ /* Copyright (C) 2004 Stefan Esser 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* ------------------------------------------------------------------------- */ #include <linux/kernel.h> #include <linux/ioport.h> #include <linux/module.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/interrupt.h> #include <linux/wait.h> #include <asm/irq.h> #include "gamecube.h" #define DVD_IRQ 2 static irqreturn_t gc_dvdcover_handler(int this_irq, void *dev_id, struct pt_regs *regs) { unsigned long reason = GAMECUBE_IN(GAMECUBE_DICVR); // really a DVD cover interrupt? if (reason & 4) { GAMECUBE_OUT(GAMECUBE_DICVR, reason | 4); printk(KERN_ERR "gc_dvdcover: DVD cover was closed\n"); } return IRQ_HANDLED; } static int gc_dvdcover_init(void) { if (request_irq(DVD_IRQ, gc_dvdcover_handler, 0, "GameCube DVD Cover", 0) < 0) { printk(KERN_ERR "gc_dvdcover: Request irq%d failed\n", DVD_IRQ); } else { enable_irq(DVD_IRQ); } GAMECUBE_OUT(GAMECUBE_DICVR, GAMECUBE_IN(GAMECUBE_DICVR) | 2); return 0; } static void gc_dvdcover_exit(void) { disable_irq(DVD_IRQ); free_irq(DVD_IRQ, 0); } MODULE_AUTHOR("Stefan Esser <se...@no...>"); MODULE_DESCRIPTION("GameCube DVD cover close message driver"); MODULE_LICENSE("GPL"); module_init(gc_dvdcover_init); module_exit(gc_dvdcover_exit); Index: Makefile =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Makefile 30 Jan 2004 02:09:35 -0000 1.3 +++ Makefile 30 Jan 2004 14:59:15 -0000 1.4 @@ -48,6 +48,7 @@ obj-$(CONFIG_GAMECUBE) += gamecube.o obj-$(CONFIG_GAMECUBE_CONSOLE) += console.o obj-$(CONFIG_GAMECUBE_RESET_SWITCH) += gc-rsw.o +obj-$(CONFIG_GAMECUBE_DVD_COVER) += gc-dvdcover.o ifeq ($(CONFIG_SMP),y) obj-$(CONFIG_PPC_PMAC) += pmac_smp.o Index: gamecube.h =================================================================== RCS file: /cvsroot/gc-linux/linux/arch/ppc/platforms/gamecube.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- gamecube.h 25 Jan 2004 16:10:44 -0000 1.2 +++ gamecube.h 30 Jan 2004 14:59:16 -0000 1.3 @@ -37,6 +37,7 @@ #define GAMECUBE_PIIC 0xcc003000 /* PI interrupt cause */ #define GAMECUBE_PIIM 0xcc003004 /* PI interrupt mask */ #define GAMECUBE_RESET 0xcc003024 /* RESET */ +#define GAMECUBE_DICVR 0xcc006004 /* DI Cover Register */ #define GAMECUBE_IN(a) (*(u_int *)a) #define GAMECUBE_OUT(a,d) (*(u_int *)a = d) |