1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2008 Vitja Makarov
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
35 static inline void ndelay(unsigned long nsecs
)
45 void ata2501_init(void)
47 GPIOD_DIR
|= (RESET
| STB
| SIFMD
| (1 << 8) | (1 << 9));
51 GPIOD
|= (1 << 8) | SIFMD
| (1 << 9);
58 unsigned short ata2501_read(void)
60 unsigned short ret
= 0;
63 for (i
= 0; i
< 12; i
++) {
76 //#define ATA2501_TEST
81 void bits(char *str
, unsigned short val
)
85 for (i
= 0; i
< 12; i
++)
86 str
[i
] = (val
& (1 << i
)) ? '1' : '0';
90 void ata2501_test(void)
99 data
= ata2501_read();
101 lcd_puts(0, line
++, "ATA2501 test");
104 lcd_puts(0, line
++, buf
);