# drivers/block/core.c File Reference

Block device core functionality. More...

`#include <assert.h>`
`#include <debug.h>`
`#include <malloc.h>`
`#include <string.h>`
`#include <types.h>`
`#include <block/device.h>`

Include dependency graph for core.c:

Go to the source code of this file.

## Functions
struct block_request * | block_alloc_request (struct block_device *bdev)
| Allocate a block request.
void | block_free_request (struct block_device *bdev, struct block_request *req)
| Free a block request previously allocated using block_alloc_request().

## Detailed Description

Block device core functionality.

- 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 core.c.

## Function Documentation

struct block_request* block_alloc_request | ( | struct block_device * | bdev | ) | `[read]`

Allocate a block request.

Parameters:

  | bdev | Block device which will handle the request

Returns:
  A new block request object, or NULL if sufficient memory isn't available.

Definition at line 56 of file core.c.

References block_device::alloc_req, assert, block_request::bdev, dbg_warning, and likely.

Referenced by aesblk_alloc_req(), block_copy_set_dest(), and block_copy_set_source().

void block_free_request | ( | struct block_device * | bdev,
|  | struct block_request * | req |
| ) |  |  |

Free a block request previously allocated using block_alloc_request().

Parameters:

  | bdev | The block device for which req was allocated
  | req | The block request object to be freed.

Definition at line 80 of file core.c.

References assert, block_request::bdev, and block_device::free_req.

Referenced by aesblk_free_req(), and block_copy_free().