# drivers/block/dummy.c File Reference

Dummy block device used for testing. More...

`#include <assert.h>`
`#include <bitops.h>`
`#include <debug.h>`
`#include <malloc.h>`
`#include <status-codes.h>`
`#include <string.h>`
`#include <block/device.h>`
`#include <block/dummy.h>`

Include dependency graph for dummy.c:

Go to the source code of this file.

## Functions
struct block_device * | dummy_blkdev_init (uint16_t block_size, uint32_t nr_blocks, bool writeable)
| Initialize a dummy block device.

## Detailed Description

Dummy block device used for testing.

This block device will silently consume any data written to it and will generate zeroes as data when read.

- Compiler: IAR EWAVR32 and GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file dummy.c.

## Function Documentation

struct block_device* dummy_blkdev_init | ( | uint16_t | block_size,
|  | uint32_t | nr_blocks,
|  | bool | writeable |
| ) |  |  | `[read]`

Initialize a dummy block device.

Parameters:

  | block_size | The size of each block in this device
  | nr_blocks | The number of blocks available
  | writeable | true if the device should be writeable, false if it should be read-only

Returns:
  A new dummy block device, or NULL if insufficient memory is available.

Definition at line 138 of file dummy.c.

References block_device::alloc_req, BDEV_PRESENT, BDEV_WRITEABLE, block_device::block_size, block_device::flags, block_device::free_req, block_device::get_dev_id, memset(), block_device::nr_blocks, block_device::prepare_req, and set_bit().

Here is the call graph for this function: