1
0
Fork 0
forked from len0rd/rockbox

FS#12418 - Merge prototypes from ata-target.h files into new file ata-driver.h. After this change:

- ata.h is for users of ata.c
- ata-driver.h is for functions implemented by target-specific code and used by ata.c
- ata-target.h is for target-specific defines


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31182 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Boris Gjenero 2011-12-08 21:23:53 +00:00
parent d09818d745
commit e4dbcc414b
25 changed files with 98 additions and 82 deletions

View file

@ -32,7 +32,7 @@
#include "power.h"
#include "string.h"
#include "ata_idle_notify.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "ata-defines.h"
#include "storage.h"
@ -240,8 +240,6 @@ STATICIRAM ICODE_ATTR int wait_for_rdy(void)
return 0; /* timeout */
}
#else
extern int ata_wait_for_bsy(void);
extern int ata_wait_for_rdy(void);
#define wait_for_bsy ata_wait_for_bsy
#define wait_for_rdy ata_wait_for_rdy
#endif
@ -1265,7 +1263,7 @@ static int set_features(void)
}
}
#ifdef ATA_SET_DEVICE_FEATURES
#ifdef ATA_SET_PIO_TIMING
ata_set_pio_timings(pio_mode);
#endif

View file

@ -0,0 +1,69 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2011 by Boris Gjenero
*
* 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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __ATA_DRIVER_H__
#define __ATA_DRIVER_H__
#include "config.h" /* for HAVE_ATA_DMA */
#include "ata-target.h" /* for other target-specific defines */
/* Returns true if the interface hasn't been initialised yet */
bool ata_is_coldstart(void);
/* Initializes the interface */
void ata_device_init(void);
/* ata_enable(true) is used after ata_device_init() to enable the interface
* ata_enable(false) is used to disable the interface so
* an ATA to USB bridge chip can use it instead.*/
void ata_enable(bool on);
/* ATA hard reset: pulse the RESET pin */
void ata_reset(void);
/* Optional optimized target-specific PIO transfer */
#ifdef ATA_OPTIMIZED_READING
void copy_read_sectors(unsigned char* buf, int wordcount);
#endif
#ifdef ATA_OPTIMIZED_WRITING
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif
/* Optional target-specific waiting */
#ifdef ATA_TARGET_POLLING
int ata_wait_for_bsy(void);
int ata_wait_for_rdy(void);
#endif
/* Optional setting of controller timings for PIO mode */
#ifdef ATA_SET_PIO_TIMING
void ata_set_pio_timings(int mode);
#endif
#ifdef HAVE_ATA_DMA
/* Used to update last disk activity time while waiting for DMA */
void ata_keep_active(void);
/* Set DMA mode for ATA interface */
void ata_dma_set_mode(unsigned char mode);
/* Sets up DMA transfer */
bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
/* Waits for DMA transfer completion */
bool ata_dma_finish(void);
#endif /* HAVE_ATA_DMA */
#endif /* __ATA_DRIVER_H__ */

View file

@ -65,16 +65,8 @@ long ata_last_disk_activity(void);
int ata_spinup_time(void); /* ticks */
#ifdef HAVE_ATA_DMA
/* Needed to allow updating while waiting for DMA to complete */
void ata_keep_active(void);
/* Returns current DMA mode */
int ata_get_dma_mode(void);
/* Set DMA mode for ATA interface */
void ata_dma_set_mode(unsigned char mode);
/* Sets up DMA transfer */
bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
/* Waits for DMA transfer completion */
bool ata_dma_finish(void);
#endif /* HAVE_ATA_DMA */
#endif /* __ATA_H__ */

View file

@ -30,7 +30,7 @@
#include <stdbool.h>
#include "system.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset()
{

View file

@ -19,6 +19,9 @@
*
****************************************************************************/
#ifndef ATA_TARGET_H
#define ATA_TARGET_H
/* Plain C read & write loops */
#define ATA_IOBASE 0x02400000
@ -33,7 +36,4 @@
#define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE + 0x340)))
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x380)))
void ata_reset(void);
void ata_enable(bool on);
bool ata_is_coldstart(void);
void ata_device_init(void);
#endif /* ATA_TARGET_H */

View file

@ -23,8 +23,7 @@
#include <stdbool.h>
#include "system.h"
#include "ata.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset()
{

View file

@ -23,8 +23,7 @@
#include <stdbool.h>
#include "system.h"
#include "ata.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset()
{

View file

@ -19,6 +19,11 @@
*
****************************************************************************/
#ifndef ATA_TARGET_H
#define ATA_TARGET_H
#include "config.h"
#ifdef CPU_PP
#ifdef HAVE_BOOTLOADER_USB_MODE
@ -49,17 +54,11 @@
/* asm optimized reading and writing */
#define ATA_OPTIMIZED_READING
#define ATA_OPTIMIZED_WRITING
void copy_read_sectors(unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif /* CONFIG_CPU */
#endif
void ata_reset(void);
bool ata_is_coldstart(void);
void ata_device_init(void);
#ifdef HAVE_ATA_DMA
/* IDE DMA controller registers */
@ -88,8 +87,6 @@ void ata_device_init(void);
#define ATA_MAX_UDMA 1
#endif
void ata_dma_set_mode(unsigned char mode);
bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
bool ata_dma_finish(void);
#endif /* HAVE_ATA_DMA */
#endif /* ATA_TARGET_H */

View file

@ -25,9 +25,8 @@
#include "system.h"
#include "power.h"
#include "panic.h"
#include "ata.h"
#include "ata-driver.h"
#include "ata-defines.h"
#include "ata-target.h"
#include "ccm-imx31.h"
#ifdef HAVE_ATA_DMA
#include "sdma-imx31.h"

View file

@ -21,6 +21,8 @@
#ifndef ATA_TARGET_H
#define ATA_TARGET_H
#include "config.h"
#ifdef BOOTLOADER
#define ATA_DRIVER_CLOSE
#endif
@ -46,12 +48,8 @@
#define ATA_COMMAND ATA_DRIVE_COMMAND
#define ATA_CONTROL ATA_DRIVE_CONTROL
void ata_reset(void);
void ata_device_init(void);
bool ata_is_coldstart(void);
#define ATA_SET_DEVICE_FEATURES
void ata_set_pio_timings(int mode);
#define ATA_SET_PIO_TIMING
#define ATA_TARGET_POLLING

View file

@ -26,8 +26,7 @@
#include "power.h"
#include "panic.h"
#include "pcf50606.h"
#include "ata.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "backlight-target.h"
/* ARESET on C7C68300 and RESET on ATA interface (Active Low) */

View file

@ -30,7 +30,6 @@
#define PREFER_C_WRITING
#if !defined(BOOTLOADER)
#define ATA_OPTIMIZED_READING
void copy_read_sectors(unsigned char* buf, int wordcount);
#endif
#define ATA_IOBASE 0x18000000
@ -44,8 +43,5 @@ void copy_read_sectors(unsigned char* buf, int wordcount);
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE + 0x0E)))
#define ATA_CONTROL (*((volatile unsigned char*)(0x20000000 + 0x1C)))
void ata_reset(void);
void ata_device_init(void);
bool ata_is_coldstart(void);
#endif

View file

@ -26,7 +26,7 @@
#include "system.h"
#include "power.h"
#include "panic.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "dm320.h"
#include "ata.h"
#include "string.h"

View file

@ -32,8 +32,6 @@
#define copy_read_sectors dma_ata_read
#define copy_write_sectors dma_ata_write
*/
void copy_read_sectors(const unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
/* Nasty hack, but Creative is nasty... */
#define ata_read_sectors _ata_read_sectors
@ -53,10 +51,6 @@ extern int _ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
#define ATA_COMMAND (*((volatile unsigned char*)(ATA_IOBASE+0xE)))
#define ATA_CONTROL (*((volatile unsigned char*)(ATA_IOBASE+0x800C)))
void ata_reset(void);
void ata_device_init(void);
bool ata_is_coldstart(void);
void ide_power_enable(bool on);
#ifdef BOOTLOADER
int load_minifs_file(char* filename, unsigned char* location);
#endif

View file

@ -26,7 +26,7 @@
#include "dma-target.h"
#include "dm320.h"
#include "ata.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "ata-defines.h"
#include <stdbool.h>

View file

@ -27,8 +27,7 @@
#include "power.h"
#include "panic.h"
#include "pcf50606.h"
#include "ata.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "backlight-target.h"
/* ARESET on C7C68300 and RESET on ATA interface (Active Low) */

View file

@ -31,8 +31,6 @@
#define ATA_OPTIMIZED_READING
#define ATA_OPTIMIZED_WRITING
void copy_read_sectors(const unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif
#define ATA_IOBASE 0x50000000
@ -49,8 +47,5 @@ void copy_write_sectors(const unsigned char* buf, int wordcount);
#define ATA_COMMAND (*((volatile unsigned char*)(REGISTER_OFFSET + (0x07 << IDE_SHIFT))))
#define ATA_CONTROL (*((volatile unsigned char*)(CONTROL_OFFSET + (0x06 << IDE_SHIFT))))
void ata_reset(void);
void ata_device_init(void);
bool ata_is_coldstart(void);
#endif

View file

@ -42,11 +42,5 @@
#define ATA_IN8(reg) ((reg) >> 8)
#define ATA_IN16(reg) (swap16(reg))
void ata_reset(void);
void ata_enable(bool on);
void ata_device_init(void);
bool ata_is_coldstart(void);
void copy_read_sectors(unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif

View file

@ -25,7 +25,7 @@
#include "system.h"
#include "power.h"
#include "pcf50606.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset(void)
{

View file

@ -25,7 +25,7 @@
#include "kernel.h"
#include "system.h"
#include "power.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset(void)
{

View file

@ -25,7 +25,7 @@
#include "system.h"
#include "power.h"
#include "pcf50606.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset(void)
{

View file

@ -25,7 +25,7 @@
#include "kernel.h"
#include "system.h"
#include "power.h"
#include "ata-target.h"
#include "ata-driver.h"
void ata_reset(void)
{

View file

@ -36,11 +36,5 @@
#define ATA_SELECT (*((volatile unsigned short*)(ATA_IOBASE + 0x2c)))
#define ATA_COMMAND (*((volatile unsigned short*)(ATA_IOBASE + 0x2e)))
void ata_reset(void);
void ata_enable(bool on);
void ata_device_init(void);
bool ata_is_coldstart(void);
void copy_read_sectors(unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif

View file

@ -24,7 +24,7 @@
#include <stdbool.h>
#include "kernel.h"
#include "system.h"
#include "ata-target.h"
#include "ata-driver.h"
#include "hwcompat.h"
#define ATA_CONTROL1 ((volatile unsigned char*)0x06200206)

View file

@ -41,11 +41,5 @@
extern volatile unsigned char* ata_control;
void ata_reset(void);
void ata_enable(bool on);
void ata_device_init(void);
bool ata_is_coldstart(void);
void copy_read_sectors(unsigned char* buf, int wordcount);
void copy_write_sectors(const unsigned char* buf, int wordcount);
#endif