-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQspiFstore.c
More file actions
41 lines (35 loc) · 1.16 KB
/
QspiFstore.c
File metadata and controls
41 lines (35 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Low-level setup code for the qspi fstorage library
// This has to be in C so,...
// This is slim and only supports qspi
// Copyright 2019 Mark Zachmann
#include <stdint.h>
// this file defines pins for the qspi chip
#include "../particle_xenon/variant.h"
#include "nrf_block_dev.h"
#include "nrf_block_dev_qspi.h"
#include "diskio_blkdev.h"
// QSPI block device definition
NRF_BLOCK_DEV_QSPI_DEFINE(
m_block_dev_qspi,
NRF_BLOCK_DEV_QSPI_CONFIG(512, NRF_BLOCK_DEV_QSPI_FLAG_CACHE_WRITEBACK, NRF_DRV_QSPI_DEFAULT_CONFIG),
NFR_BLOCK_DEV_INFO_CONFIG("Friend", "QSPI", "0.10")
);
// block device list
#define BLOCKDEV_LIST() ( \
NRF_BLOCKDEV_BASE_ADDR(m_block_dev_qspi, block_dev) \
)
// Initialize
int QspiF_Initialize(void)
{
// Initialize FATFS disk I/O interface by providing the block device.
static diskio_blkdev_t drives[] =
{
DISKIO_BLOCKDEV_CONFIG(NRF_BLOCKDEV_BASE_ADDR(m_block_dev_qspi, block_dev), NULL)
};
diskio_blockdev_register(drives, ARRAY_SIZE(drives));
return (int)disk_initialize(0);
}
void QspiF_Uninitialize(void)
{
UNUSED_RETURN_VALUE(disk_uninitialize(0));
}