/* * JR-IDE Project * - (c) 2017 Alan Hightower * * 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef __RPC_H__ #define __RPC_H__ #include #define IDE_CMD_NULL 0x00 #define IDE_CMD_READ_SEC 0x20 #define IDE_CMD_READ_SEC_NORETRY 0x21 #define IDE_CMD_WRITE_SEC 0x30 #define IDE_CMD_WRITE_SEC_NORETRY 0x31 #define IDE_CMD_VERIFY_SEC 0x40 #define IDE_CMD_VERIFY_SEC_NORETRY 0x41 #define IDE_CMD_SEEK 0x70 #define IDE_CMD_REDIRECTOR 0x81 // Vendor specific #define IDE_CMD_PULL_REQUEST 0x8c // Vendor specific #define IDE_CMD_EXEC_DIAG 0x90 #define IDE_CMD_SET_DRIVE_PARM 0x91 #define IDE_CMD_READ_MULTIPLE 0xc4 #define IDE_CMD_WRITE_MULTIPLE 0xc5 #define IDE_CMD_SET_MULTIPLE_MODE 0xc6 #define IDE_CMD_FLUSH_CACHE 0xe7 #define IDE_CMD_IDENTIFY 0xec #define IDE_CMD_SET_FEATURES 0xef #define IDE_CMD_GET_MAX_ADDRESS 0xf8 #define IDE_CMD_SET_MAX_ADDRESS 0xf9 // IDE_CMD_REDIRECTOR feature sub-command #define REDIR_FEAT_GET_STATUS 0x00 // Feature reg #define REDIR_FEAT_GET_DATETIME 0x01 // TBD #define REDIR_FEAT_DIR_FIRST 0x02 #define REDIR_FEAT_DIR_NEXT 0x03 #define REDIR_FEAT_STAT_PUSH 0x04 #define REDIR_FEAT_STAT_PULL 0x05 #define REDIR_STAT_ATTR 0x00 #define REDIR_STAT_CHDIR 0x01 #define REDIR_STAT_RMDIR 0x02 #define REDIR_STAT_MKDIR 0x03 #define REDIR_STAT_RENAME 0x04 #ifdef __WATCOMC__ #pragma pack(push, 1) #define PACKATTRIB #endif #ifdef __GNUC__ #define PACKATTRIB __attribute__((packed)) #endif typedef struct _st_redir_info { uint32_t protocol_magic; #define REDIR_PROTOCOL_MAGIC 0x8fe3b921 uint8_t protocol_ver; #define REDIR_PROTOCOL_VERSION 1 uint8_t flags; uint8_t server_major; uint8_t server_minor; uint8_t cpld_major; uint8_t cpld_minor; uint8_t reserved1[2]; uint16_t bytes_per_sector; uint16_t sector_per_cluster; uint16_t avail_clusters; uint16_t total_clusters; char mount_path[108]; uint8_t time_sec; // Seconds (0-59) uint8_t time_min; // Minutes (0-59) uint8_t time_hour; // Hours (0-23) uint8_t date_mday; // Day of the month (1-31) uint8_t date_wday; // Day of week (0-6) 0 = Sunday uint8_t date_mon; // Month (1-12) uint16_t date_year; // Year } PACKATTRIB redir_info_t; typedef struct _st_redir_opendir { char filename[128]; char filename_nul; char mask[11]; char mask_nul; uint8_t driveno; uint8_t attrib_a; uint8_t attrib_b; } PACKATTRIB redir_opendir_t; typedef struct _st_redir_dentry { char filename[11]; uint8_t attrib; uint16_t dos_time; uint16_t dos_date; uint32_t size; } PACKATTRIB redir_dentry_t; // 20 bytes typedef struct _st_redir_nextdir { uint16_t total; // Total entries in current opendir context uint16_t start; // Starting index represented by this block uint16_t count; // Count of entries in this block uint16_t index; // Used by DOS side to track current entry uint8_t reserved[4]; #define NEXT_DENTRIES 25 redir_dentry_t entry[NEXT_DENTRIES]; } PACKATTRIB redir_nextdir_t; // 512 bytes typedef struct _st_redir_stat { char filename_a[128]; char filename_a_nul; char filename_b[128]; char filename_b_nul; uint8_t driveno; uint8_t statop; uint8_t found; uint8_t attrib; uint16_t dos_time; uint16_t dos_date; uint32_t size; } PACKATTRIB redir_stat_t; #ifdef __WATCOMC__ #pragma pack(pop) #endif #undef PACKATTRIB #endif