1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 by Maurus Cuelenaere
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
27 #include "ata-target.h"
29 void ide_power_enable(bool on
){
31 IO_INTC_EINT1
&= ~INTR_EINT1_EXT2
;
34 IO_GIO_BITSET0
= (1 << 14);
38 IO_GIO_BITCLR0
= (1 << 14);
39 IO_INTC_EINT1
|= INTR_EINT1_EXT2
;
44 inline bool ide_powered(){
46 return (IO_GIO_BITSET0
& (1 << 14));
54 /* Disabled until figured out what's wrong */
55 IO_INTC_EINT1
&= ~INTR_EINT1_EXT2
; //disable GIO2 interrupt
58 ide_power_enable(true);
63 IO_GIO_BITSET0
= (1 << 5);
64 IO_GIO_BITCLR0
= (1 << 3);
67 IO_GIO_BITCLR0
= (1 << 5);
69 IO_GIO_BITSET0
= (1 << 3);
70 while(!(ATA_COMMAND
& STATUS_RDY
))
72 IO_INTC_EINT1
|= INTR_EINT1_EXT2
; //enable GIO2 interrupt
76 void ata_enable(bool on
)
82 bool ata_is_coldstart(void)
87 void ata_device_init(void)
89 IO_INTC_EINT1
|= INTR_EINT1_EXT2
; //enable GIO2 interrupt
90 //TODO: mimic OF inits...
97 //printf("GIO2 interrupt...");
99 IO_INTC_IRQ1
= INTR_IRQ1_EXT2
; //Mask GIO2 interrupt