#ifndef STOREDEV_ATASD_H_
#define STOREDEV_ATASD_H_

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>

#define STOREDEV_ATASD_SECTORSIZE 512

struct StoreDev;

typedef struct {
  int devno;
  size_t capacity;
  uint16_t iobase;
  uint16_t ctrlbase;
} AtaSdInitExtra;

typedef struct {
  int devno;
  size_t capacity;
  uint16_t iobase;
  uint16_t ctrlbase;
} AtaSd;

int32_t atasd_init(struct StoreDev *sd, void *extra);
int32_t atasd_read(struct StoreDev *sd, uint8_t *const buffer, ptrdiff_t sector, ptrdiff_t off, size_t size);
int32_t atasd_write(struct StoreDev *sd, const uint8_t *const buffer, ptrdiff_t sector, ptrdiff_t off, size_t size);
int32_t atasd_cleanup(struct StoreDev *sd);
size_t atasd_capacity(struct StoreDev *sd);

void ata_probe(void);

#endif // STOREDEV_ATASD_H_
