root/src/simh/sim_disk.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * sim_disk.h: simulator disk support library definitions
   3  *
   4  * vim: filetype=c:tabstop=4:ai:expandtab
   5  * SPDX-License-Identifier: X11
   6  * scspell-id: b7d44bd9-f62a-11ec-8810-80ee73e9b8e7
   7  *
   8  * ---------------------------------------------------------------------------
   9  *
  10  * Copyright (c) 2011 Mark Pizzolato
  11  * Copyright (c) 2021-2022 The DPS8M Development Team
  12  *
  13  * Permission is hereby granted, free of charge, to any person obtaining a
  14  * copy of this software and associated documentation files (the "Software"),
  15  * to deal in the Software without restriction, including without limitation
  16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17  * and/or sell copies of the Software, and to permit persons to whom the
  18  * Software is furnished to do so, subject to the following conditions:
  19  *
  20  * The above copyright notice and this permission notice shall be included
  21  * in all copies or substantial portions of the Software.
  22  *
  23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  26  * IN NO EVENT SHALL ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR
  27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  29  * OTHER DEALINGS IN THE SOFTWARE.
  30  *
  31  * Except as contained in this notice, the names of Robert M. Supnik and
  32  * Mark Pizzolato shall not be used in advertising or otherwise to promote
  33  * the sale, use or other dealings in this Software without prior written
  34  * authorization from Robert M. Supnik and Mark Pizzolato.
  35  *
  36  * ---------------------------------------------------------------------------
  37  */
  38 
  39 #ifndef SIM_DISK_H_
  40 # define SIM_DISK_H_    0
  41 
  42 /* Disk format */
  43 
  44 typedef uint32          t_seccnt;                       /* disk sector count */
  45 typedef uint32          t_lba;                          /* disk logical block address */
  46 
  47 /* Unit flags */
  48 
  49 # define DKUF_V_WLK      (UNIT_V_UF + 0)                 /* write locked */
  50 # define DKUF_V_FMT      (UNIT_V_UF + 1)                 /* disk file format */
  51 # define DKUF_W_FMT      2                               /* 2b of formats */
  52 # define DKUF_N_FMT      (1u << DKUF_W_FMT)              /* number of formats */
  53 # define DKUF_M_FMT      ((1u << DKUF_W_FMT) - 1)
  54 # define DKUF_F_STD      0                              /* SIMH format */
  55 # define DKUF_V_UF       (DKUF_V_FMT + DKUF_W_FMT)
  56 # define DKUF_WLK        (1u << DKUF_V_WLK)
  57 # define DKUF_FMT        (DKUF_M_FMT << DKUF_V_FMT)
  58 # define DKUF_WRP        (DKUF_WLK | UNIT_RO)
  59 # define DK_F_STD        (DKUF_F_STD << DKUF_V_FMT)
  60 # define DK_GET_FMT(u)   (((u)->flags >> DKUF_V_FMT) & DKUF_M_FMT)
  61 
  62 /* Return status codes */
  63 
  64 # define DKSE_OK         0                               /* no error */
  65 
  66 typedef void (*DISK_PCALLBACK)(UNIT *unit, t_stat status);
  67 
  68 /* Prototypes */
  69 
  70 t_stat sim_disk_attach (UNIT *uptr, const char *cptr, size_t sector_size, size_t xfer_element_size, t_bool dontautosize,
  71                         uint32 debugbit, const char *drivetype, uint32 pdp11_tracksize, int completion_delay);
  72 t_stat sim_disk_detach (UNIT *uptr);
  73 t_stat sim_disk_attach_help(FILE *st, DEVICE *dptr, const UNIT *uptr, int32 flag, const char *cptr);
  74 t_stat sim_disk_rdsect (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectsread, t_seccnt sects);
  75 t_stat sim_disk_rdsect_a (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectsread, t_seccnt sects, DISK_PCALLBACK callback);
  76 t_stat sim_disk_wrsect (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectswritten, t_seccnt sects);
  77 t_stat sim_disk_wrsect_a (UNIT *uptr, t_lba lba, uint8 *buf, t_seccnt *sectswritten, t_seccnt sects, DISK_PCALLBACK callback);
  78 t_stat sim_disk_unload (UNIT *uptr);
  79 t_stat sim_disk_set_fmt (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
  80 t_stat sim_disk_show_fmt (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
  81 t_stat sim_disk_set_capac (UNIT *uptr, int32 val, CONST char *cptr, void *desc);
  82 t_stat sim_disk_show_capac (FILE *st, UNIT *uptr, int32 val, CONST void *desc);
  83 t_stat sim_disk_reset (UNIT *uptr);
  84 t_stat sim_disk_perror (UNIT *uptr, const char *msg);
  85 t_stat sim_disk_clearerr (UNIT *uptr);
  86 t_bool sim_disk_isavailable (UNIT *uptr);
  87 t_bool sim_disk_isavailable_a (UNIT *uptr, DISK_PCALLBACK callback);
  88 t_bool sim_disk_wrp (UNIT *uptr);
  89 t_offset sim_disk_size (UNIT *uptr);
  90 t_bool sim_disk_vhd_support (void);
  91 t_bool sim_disk_raw_support (void);
  92 void sim_disk_data_trace (UNIT *uptr, const uint8 *data, size_t lba, size_t len, const char* txt, int detail, uint32 reason);
  93 
  94 #endif

/* [previous][next][first][last][top][bottom][index][help] */