RTEMS 6.2-rc2
Loading...
Searching...
No Matches
zynq-qspi-flashdev.h
1/*
2 * Copyright (C) 2024 Aaron Nyholm
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
17 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 * POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef _ZYNQ_QSPI_FLASHDEV_H
27#define _ZYNQ_QSPI_FLASHDEV_H
28
29#include <dev/flash/flashdev.h>
30#include <dev/spi/zynq-qspi-flash.h>
31
32#define ZQSPI_FLASH_MAX_REGIONS ((size_t)32)
33
34/*
35 * @brief Initializes a flash device using zynq qspi flash driver.
36 *
37 * The flash device is not registered in this call. If an rtems_flashdev is
38 * created using zqspi_flash_init and is not registered, it must be destroyed
39 * using rtems_flashdev_destroy.
40 *
41 * @param[in] zqspiflash A initialised zqspiflash device to wrap.
42 *
43 * @retval A pointer to the rtems_flashdev.
44 * @retval NULL on failure.
45*/
46rtems_flashdev* zqspi_flashdev_init(zqspiflash *bmdriver);
47
48/*
49 * @brief Struct allocating memory space for flash regions. Used by
50 * rtems_flashdev to store region allocations.
51 */
53 rtems_flashdev_region zqspi_flash_regions[ZQSPI_FLASH_MAX_REGIONS];
54 uint32_t zqspi_flash_bit_allocator;
56
57#endif /* _ZYNQ_QSPI_FLASHDEV_H */
Generic Flash API.
General definition for on flash device.
Definition: flashdev.h:253
Flash device.
Definition: flashdev.h:358
Definition: zynq-qspi-flashdev.h:52
Definition: zynq-qspi-flash.h:113