00001 /* src_experimental/drivers/tty/qsm.c 00002 CubeOS Version 0.4.90 experimental 00003 Copyright (C) 1999,2000 Holger Kenn 00004 00005 CubeOS is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or any later version. 00009 00010 CubeOS is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 */ 00016 #include <cubeos.h> 00017 #include <mc68332.h> 00018 #include <ivtab.h> 00019 #include <qsm.h> 00020 #include <spi.h> 00021 #include <io_sci.h> 00022 00023 extern void QSM_qspiWrapper (); 00024 extern void QSM_sciWrapper (); 00025 00026 int QSM_init () 00027 { 00028 unsigned short v; 00029 00030 writeshort (QSM_QSMCR, 0x8e); 00031 /* Bit15: STOP (QSM clock stopped) 00032 Bit14: FRZ1 (Halt QSM) 00033 Bit7 : SUPV (all QSM registers in supervisor space) 00034 Bit3..0: IARB (of the QSM module) 00035 */ 00036 _KERN_IVTab_setvector (QSM_VECTORNUM, QSM_sciWrapper); 00037 _KERN_IVTab_setvector (QSM_VECTORNUM + 1, QSM_qspiWrapper); 00038 00039 writebyte (QSM_QIVR, QSM_VECTORNUM); 00040 00041 /* Bit7..0 INTV (interrupt vector for the QSM module) */ 00042 v = readbyte (QSM_QILR); 00043 writebyte (QSM_QILR, (v & 0xf8) | 0x6); 00044 /* Bit13..11: ILQSPI (internal iarb level of QSPI) 00045 Bit10..8 : ILSCI (internal iarb level of SCI) 00046 */ 00047 return 0; 00048 }