Skip to content

Commit 023b287

Browse files
authored
Merge pull request arduino#71 from bcmi-labs/mbr_fix_main
MBRBlockDevice fixes and cleanup
2 parents a7c9a2f + b03dafe commit 023b287

31 files changed

+272
-105
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
BlockDevice.cpp
3+
Copyright (c) 2023 Arduino SA. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13+
Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#include <QSPIFlashBlockDevice.h>
21+
22+
BlockDevice *BlockDevice::get_default_instance()
23+
{
24+
static QSPIFlashBlockDevice default_bd(PIN_QSPI_CLK, PIN_QSPI_SS, PIN_QSPI_D0, PIN_QSPI_D1, PIN_QSPI_D2, PIN_QSPI_D3);
25+
return &default_bd;
26+
}

libraries/BlockDevices/blockDevice.h renamed to libraries/BlockDevices/BlockDevice.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ########################################################################## */
2-
/* - File: blockDevice.h
2+
/* - File: BlockDevice.h
33
- Copyright (c): 2022 Arduino srl. All right reserved.
44
- Author: Daniele Aimo ([email protected])
55
@@ -23,6 +23,7 @@
2323
#define ARDUINO_BLOCK_DEVICE
2424
#include "Arduino.h"
2525
#include <stdint.h>
26+
#include "../Storage/storage_common.h"
2627

2728
#define BLOCK_DEVICE_OK (0)
2829
#define BD_ERROR_OK (0)
@@ -34,7 +35,7 @@ typedef uint32_t bd_size_t;
3435
typedef pin_size_t pin_t;
3536

3637
/* -------------------------------------------------------------------------- */
37-
/* Abstract Base blockDevice class (defines the INTERFACE for all the
38+
/* Abstract Base BlockDevice class (defines the INTERFACE for all the
3839
subclass) */
3940
/* -------------------------------------------------------------------------- */
4041

@@ -52,6 +53,8 @@ class BlockDevice {
5253
BlockDevice(BlockDevice const&) = delete;
5354
void operator=(BlockDevice const&) = delete;
5455

56+
static BlockDevice *get_default_instance();
57+
5558
virtual ~BlockDevice() = default;
5659
/* initialize a block device */
5760
virtual int init() = 0;

libraries/BlockDevices/BufferedBlockDevice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
#include "BufferedBlockDevice.h"
19-
#include "../Storage/storage_common.h"
2019
#include <algorithm>
2120
#include <string.h>
2221

libraries/BlockDevices/BufferedBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#ifndef ARDUINO_BUFFERED_BLOCK_DEVICE_H
2222
#define ARDUINO_BUFFERED_BLOCK_DEVICE_H
2323

24-
#include "blockDevice.h"
24+
#include "BlockDevice.h"
2525

2626
//namespace mbed {
2727

libraries/BlockDevices/ChainingBlockDevice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include "ChainingBlockDevice.h"
1919

20-
2120
//namespace mbed {
2221

2322
ChainingBlockDevice::ChainingBlockDevice(BlockDevice **bds, size_t bd_count)

libraries/BlockDevices/ChainingBlockDevice.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
#ifndef ARDUINO_CHAINING_BLOCK_DEVICE_H
2222
#define ARDUINO_CHAINING_BLOCK_DEVICE_H
2323

24-
#include "blockDevice.h"
25-
#include "../Storage/storage_common.h"
24+
#include "BlockDevice.h"
2625
#include <stdlib.h>
2726

2827
//namespace mbed {

libraries/BlockDevices/DataFlashBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
//#define DATA_FLASH_DEBUG
2424

2525
/* base class for block devices */
26-
#include "blockDevice.h"
26+
#include "BlockDevice.h"
2727

2828
/* Arduino.h to include the defines of the flash type LP or HP*/
2929
#include "Arduino.h"

libraries/BlockDevices/ExhaustibleBlockDevice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
*/
1717

1818
#include "ExhaustibleBlockDevice.h"
19-
#include "../Storage/storage_common.h"
2019

2120
//namespace mbed {
2221

libraries/BlockDevices/ExhaustibleBlockDevice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#ifndef ARDUINO_EXHAUSTIBLE_BLOCK_DEVICE_H
2222
#define ARDUINO_EXHAUSTIBLE_BLOCK_DEVICE_H
2323

24-
#include "blockDevice.h"
24+
#include "BlockDevice.h"
2525

2626
//namespace mbed {
2727

libraries/BlockDevices/FlashSimBlockDevice.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
*/
1717

1818
#include "FlashSimBlockDevice.h"
19-
#include "../Storage/storage_common.h"
2019
#include <algorithm>
2120
#include <stdlib.h>
2221
#include <string.h>
2322

24-
2523
//namespace mbed {
2624

2725
static const bd_size_t min_blank_buf_size = 32;

0 commit comments

Comments
 (0)