Esempio n. 1
0
static u64_t romdisk_read(struct block_t * blk, u8_t * buf, u64_t blkno, u64_t blkcnt)
{
	struct romdisk_t * romdisk = (struct romdisk_t *)(blk->priv);
	u64_t offset = block_offset(blk, blkno);
	u64_t length = block_available_length(blk, blkno, blkcnt);
	u64_t count = block_available_count(blk, blkno, blkcnt);

	memcpy((void *)buf, (const void *)((u8_t *)(romdisk->start) + offset), length);
	return count;
}
Esempio n. 2
0
static u64_t romdisk_read(struct block_t * blk, u8_t * buf, u64_t blkno, u64_t blkcnt)
{
	struct romdisk_pdata_t * pdat = (struct romdisk_pdata_t *)(blk->priv);
	virtual_addr_t offset = pdat->addr + block_offset(blk, blkno);
	u64_t count = block_available_count(blk, blkno, blkcnt);
	u64_t length = block_available_length(blk, blkno, blkcnt);

	memcpy((void *)buf, (const void *)(offset), length);
	return count;
}