Lines Matching +full:sector +full:- +full:count

5  * SPDX-License-Identifier: Apache-2.0
34 const struct ram_disk_config *config = dev->config; in lba_to_address()
36 return &config->buf[lba * config->sector_size]; in lba_to_address()
45 uint32_t sector, uint32_t count) in disk_ram_access_read() argument
47 const struct device *dev = disk->dev; in disk_ram_access_read()
48 const struct ram_disk_config *config = dev->config; in disk_ram_access_read()
49 uint32_t last_sector = sector + count; in disk_ram_access_read()
51 if (last_sector < sector || last_sector > config->sector_count) { in disk_ram_access_read()
52 LOG_ERR("Sector %" PRIu32 " is outside the range %zu", in disk_ram_access_read()
53 last_sector, config->sector_count); in disk_ram_access_read()
54 return -EIO; in disk_ram_access_read()
57 memcpy(buff, lba_to_address(dev, sector), count * config->sector_size); in disk_ram_access_read()
63 uint32_t sector, uint32_t count) in disk_ram_access_write() argument
65 const struct device *dev = disk->dev; in disk_ram_access_write()
66 const struct ram_disk_config *config = dev->config; in disk_ram_access_write()
67 uint32_t last_sector = sector + count; in disk_ram_access_write()
69 if (last_sector < sector || last_sector > config->sector_count) { in disk_ram_access_write()
70 LOG_ERR("Sector %" PRIu32 " is outside the range %zu", in disk_ram_access_write()
71 last_sector, config->sector_count); in disk_ram_access_write()
72 return -EIO; in disk_ram_access_write()
75 memcpy(lba_to_address(dev, sector), buff, count * config->sector_size); in disk_ram_access_write()
82 const struct ram_disk_config *config = disk->dev->config; in disk_ram_access_ioctl()
88 *(uint32_t *)buff = config->sector_count; in disk_ram_access_ioctl()
91 *(uint32_t *)buff = config->sector_size; in disk_ram_access_ioctl()
100 return -EINVAL; in disk_ram_access_ioctl()
113 struct disk_info *info = dev->data; in disk_ram_init()
115 info->dev = dev; in disk_ram_init()