]> cloudbase.mooo.com Git - z180-stamp.git/blame - include/z180-serv.h
Adaptions for fatfs R0.12b
[z180-stamp.git] / include / z180-serv.h
CommitLineData
35edb766
L
1/*
2 * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
89adce76
L
7#ifndef Z180_SERV_H
8#define Z180_SERV_H
9
7af9364e 10#include <stdint.h>
cb4fb1ed
L
11#include <stdbool.h>
12#include "ff.h"
13
89adce76
L
14void setup_z180_serv(void);
15void restart_z180_serv(void);
16
cb4fb1ed
L
17
18/* CP/M drive interface */
19
20/* TODO: Variable Disk Format */
21#define CONFIG_CPM_DISKSIZE (8*1024*1024L)
22
23typedef uint8_t drv_opt_t;
24
25#define DRV_OPT_RO (1<<0) /* Drive is write protected */
26#define DRV_OPT_DEBUG (1<<1) /* Debug this drive */
27#define DRV_OPT_REATTATCH (1<<7) /* Change existing attachment */
28
4122fe90
L
29typedef uint8_t drv_flag_t;
30#define DRV_FLG_OPEN (1<<0) /* Drive is logged in from CP/M */
31#define DRV_FLG_DIRTY (2<<0) /* Unwritten data */
32
cb4fb1ed
L
33struct cpm_drive_s {
34 drv_opt_t opt;
4122fe90 35 drv_flag_t flags;
cb4fb1ed
L
36 uint32_t dph;
37 char *img_name;
38 FIL fd;
39};
40
41/* Return codes */
42
43#define AT_OK 0
44#define AT_ERROR 1
45#define AT_RANGE 2
46#define AT_ALREADY 3
47#define AT_NOT 4
48#define AT_NOFILE 5
49#define AT_NOMEM 6
50#define AT_OPEN 7
51#define AT_OTHER 8
52
53
54int drv_list(void);
55int drv_detach(uint8_t drv);
56int drv_attach(uint8_t drv, const char *filename, drv_opt_t options);
57
89adce76 58#endif /* Z180_SERV_H */