-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdeviceapi_block.h
More file actions
30 lines (27 loc) · 1.25 KB
/
deviceapi_block.h
File metadata and controls
30 lines (27 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//*****************************************************************
// This file is part of CosmOS *
// Copyright (C) 2020-2021 Tom Everett *
// Released under the stated terms in the file LICENSE *
// See the file "LICENSE" in the source distribution for details *
// ****************************************************************
/*
* this file defines the interface that all ATA devices will implement
*/
#ifndef _DEVICEAPI_BLOCK_H
#define _DEVICEAPI_BLOCK_H
#include <sys/devicemgr/devicemgr.h>
#include <types.h>
/*
* count is the numvber of *sectors* to read or write. it is assumed that data is at least as big as count*sector_size
*/
typedef void (*block_read_sector_function)(struct device* dev, uint32_t sector, uint8_t* data, uint32_t count);
typedef void (*block_write_sector_function)(struct device* dev, uint32_t sector, uint8_t* data, uint32_t count);
typedef uint16_t (*block_sector_size_function)(struct device* dev);
typedef uint32_t (*block_total_size_function)(struct device* dev);
struct deviceapi_block {
block_read_sector_function read;
block_write_sector_function write;
block_sector_size_function sector_size;
block_total_size_function total_size;
};
#endif