diff options
Diffstat (limited to 'drivers/io/vexpress_nor/io_vexpress_nor_internal.h')
-rw-r--r-- | drivers/io/vexpress_nor/io_vexpress_nor_internal.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/io/vexpress_nor/io_vexpress_nor_internal.h b/drivers/io/vexpress_nor/io_vexpress_nor_internal.h new file mode 100644 index 000000000..e06d492ed --- /dev/null +++ b/drivers/io/vexpress_nor/io_vexpress_nor_internal.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __IO_VEXPRESS_NOR_INTERNAL_H__ +#define __IO_VEXPRESS_NOR_INTERNAL_H__ + +#include <io_driver.h> +#include <io_nor_flash.h> +#include <io_storage.h> + +#define IS_FLASH_ADDRESS_BLOCK_ALIGNED(fp, addr) \ + (((addr) & ((fp)->block_spec->block_size - 1)) == 0) + +/* As we need to be able to keep state for seek, only one file can be open + * at a time. Make this a structure and point to the entity->info. When we + * can malloc memory we can change this to support more open files. + */ +typedef struct { + /* Use the 'in_use' flag as any value for base and file_pos could be + * valid. + */ + int in_use; + uintptr_t base; + size_t file_pos; + + /* Definition of the flash block device */ + const io_nor_flash_spec_t *block_spec; +} file_state_t; + +int flash_block_write(file_state_t *fp, uint32_t address, + const uintptr_t buffer, size_t *written); + +int flash_partial_write(file_state_t *fp, uint32_t address, + const uintptr_t buffer, size_t length, size_t *written); + +#endif /* __IO_VEXPRESS_NOR_INTERNAL_H__ */ |