summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-01-20 23:29:48 +0000
committerJean-Philippe Bernardy <jeanphilippe.bernardy@gmail.com>2005-01-20 23:29:48 +0000
commita6467334b084f7147cee03dacec2d5f81685e1fb (patch)
tree431b4506ad20898f699f160c9105019bac9ca009
parent99e72c87584524a40a3020b8e8d9b7f7dbe91ac2 (diff)
downloadrockbox-a6467334b084f7147cee03dacec2d5f81685e1fb.tar.gz
rockbox-a6467334b084f7147cee03dacec2d5f81685e1fb.tar.bz2
rockbox-a6467334b084f7147cee03dacec2d5f81685e1fb.zip
Factored out some macros
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5623 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index ae202e803a..20e6247fb9 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -69,7 +69,7 @@
#define ATA_STATUS_IDX ATA_COMMAND_IDX
#define ATA_ALT_STATUS_IDX ATA_CONTROL_IDX
-#define SET_REG(reg, value) (ide_write_register(reg, value))
+#define SET_REG(reg, value) (ide_write_register(reg ## _IDX, value))
#define GET_REG(reg) (ide_read_register(reg))
#define ATA_DATA (GET_REG(ATA_DATA_IDX))
@@ -86,17 +86,6 @@
#define ATA_FEATURE (GET_REG(ATA_FEATURE_IDX))
-#define SET_ATA_DATA(v) (SET_REG(ATA_DATA_IDX,v))
-#define SET_ATA_SELECT(v) (SET_REG(ATA_SELECT_IDX,v))
-#define SET_ATA_NSECTOR(v) (SET_REG(ATA_NSECTOR_IDX,v))
-#define SET_ATA_SECTOR(v) (SET_REG(ATA_SECTOR_IDX,v))
-#define SET_ATA_LCYL(v) (SET_REG(ATA_LCYL_IDX,v))
-#define SET_ATA_HCYL(v) (SET_REG(ATA_HCYL_IDX,v))
-#define SET_ATA_COMMAND(v) (SET_REG(ATA_COMMAND_IDX,v))
-#define SET_ATA_CONTROL(v) (SET_REG(ATA_CONTROL_IDX,v))
-#define SET_ATA_FEATURE(v) (SET_REG(ATA_FEATURE_IDX, v))
-
-
extern int idatastart __attribute__ ((section(".idata")));
static unsigned ide_reg_temp __attribute__ ((section(".idata")));
@@ -153,6 +142,8 @@ int ide_read_register(int reg) {
#define SET_REG(reg, value) ((reg) = (value))
+#endif
+
#define SET_ATA_DATA(v) (SET_REG(ATA_DATA,v))
#define SET_ATA_SELECT(v) (SET_REG(ATA_SELECT,v))
#define SET_ATA_NSECTOR(v) (SET_REG(ATA_NSECTOR,v))
@@ -163,9 +154,6 @@ int ide_read_register(int reg) {
#define SET_ATA_CONTROL(v) (SET_REG(ATA_CONTROL,v))
#define SET_ATA_FEATURE(v) (SET_REG(ATA_FEATURE, v))
-#endif
-
-
#define SELECT_DEVICE1 0x10
#define SELECT_LBA 0x40