RTEMS 6.1-rc6
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
36 * driver. The flash device is not registered in this call.
37 * If an rtems_flashdev is created using zqspi_flash_init it must be
38 * destroyed using xqspi_flash_destroy.
39 *
40 * @param[in] zqspiflash A initialised zqspiflash device to wrap.
41 *
42 * @retval A pointer to the rtems_flashdev.
43 * @retval NULL on failure.
44*/
45rtems_flashdev* zqspi_flashdev_init(zqspiflash *bmdriver);
46
47/*
48 * @brief Destroys a rtems_flashdev initialised with zqspi_flash_init.
49 * If an rtems_flashdev is created using zqspi_flash_init it must be
50 * destroyed using zqspi_flash_destroy. The zqspiflash originally passed in
51 * is untouched.
52 *
53 * @param[in] flash The flashdev to destroy
54*/
55void zqspi_flashdev_destroy(rtems_flashdev* flash);
56
57/*
58 * @brief Struct allocating memory space for flash regions. Used by
59 * rtems_flashdev to store region allocations.
60 */
62 rtems_flashdev_region zqspi_flash_regions[ZQSPI_FLASH_MAX_REGIONS];
63 uint32_t zqspi_flash_bit_allocator;
65
66#endif /* _ZYNQ_QSPI_FLASHDEV_H */
Generic Flash API.
General definition for on flash device.
Definition: flashdev.h:188
Flash device.
Definition: flashdev.h:256
Definition: zynq-qspi-flashdev.h:61
Definition: zynq-qspi-flash.h:113