X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/89adce76dd02f2076ec6de1c6b434bc1f29512f4..61bd408cda6cc14d11bd9815828df2e8dec39bec:/include/z180-serv.h diff --git a/include/z180-serv.h b/include/z180-serv.h index af4b1c0..b6a65b0 100644 --- a/include/z180-serv.h +++ b/include/z180-serv.h @@ -1,7 +1,57 @@ +/* + * (C) Copyright 2014 Leo C. + * + * SPDX-License-Identifier: GPL-2.0+ + */ + #ifndef Z180_SERV_H #define Z180_SERV_H +#include +#include "ff.h" + void setup_z180_serv(void); void restart_z180_serv(void); + +/* CP/M drive interface */ + +/* TODO: Variable Disk Format */ +#define CONFIG_CPM_DISKSIZE (8*1024*1024L) + +typedef uint8_t drv_opt_t; + +#define DRV_OPT_RO (1<<0) /* Drive is write protected */ +#define DRV_OPT_DEBUG (1<<1) /* Debug this drive */ +#define DRV_OPT_REATTATCH (1<<7) /* Change existing attachment */ + +typedef uint8_t drv_flag_t; +#define DRV_FLG_OPEN (1<<0) /* Drive is logged in from CP/M */ +#define DRV_FLG_DIRTY (2<<0) /* Unwritten data */ + +struct cpm_drive_s { + drv_opt_t opt; + drv_flag_t flags; + uint32_t dph; + char *img_name; + FIL fd; +}; + +/* Return codes */ + +#define AT_OK 0 +#define AT_ERROR 1 +#define AT_RANGE 2 +#define AT_ALREADY 3 +#define AT_NOT 4 +#define AT_NOFILE 5 +#define AT_NOMEM 6 +#define AT_OPEN 7 +#define AT_OTHER 8 + + +int drv_list(void); +int drv_detach(uint8_t drv); +int drv_attach(uint8_t drv, const char *filename, drv_opt_t options); + #endif /* Z180_SERV_H */