Skip to content

Commit d6cb385

Browse files
committed
Enlarge event queue in test_socket_attach()
2 parents 8ec9f6b + f0273ec commit d6cb385

File tree

416 files changed

+154614
-2707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

416 files changed

+154614
-2707
lines changed

TESTS/netsocket/socket_sigio/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ void test_socket_attach() {
110110

111111
// Dispatch event queue
112112
Thread eventThread;
113-
EventQueue queue(4*EVENTS_EVENT_SIZE);
113+
EventQueue queue(10*EVENTS_EVENT_SIZE);
114114
eventThread.start(callback(&queue, &EventQueue::dispatch_forever));
115115

116116
printf("TCP client IP Address is %s\r\n", net->get_ip_address());
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
36664e60639dda2b364e6e8b5ecf9a23116d280a
1+
70a8b3b546ebfde84cde7f14525a7b754c819e69

features/TESTS/filesystem/heap_block_device/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323

2424
using namespace utest::v1;
2525

26+
// TODO HACK, replace with available ram/heap property
27+
#if defined(TARGET_MTB_MTS_XDOT)
28+
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
29+
#endif
30+
2631
#define TEST_BLOCK_SIZE 128
2732
#define TEST_BLOCK_DEVICE_SIZE 32*TEST_BLOCK_SIZE
2833
#define TEST_BLOCK_COUNT 10

features/TESTS/filesystem/mbr_block_device/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@
2424

2525
using namespace utest::v1;
2626

27+
// TODO HACK, replace with available ram/heap property
28+
#if defined(TARGET_MTB_MTS_XDOT)
29+
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
30+
#endif
31+
2732
#define BLOCK_COUNT 16
2833
#define BLOCK_SIZE 512
2934

features/TESTS/filesystem/util_block_device/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626

2727
using namespace utest::v1;
2828

29+
// TODO HACK, replace with available ram/heap property
30+
#if defined(TARGET_MTB_MTS_XDOT)
31+
#error [NOT_SUPPORTED] Insufficient heap for heap block device tests
32+
#endif
33+
2934
#define BLOCK_COUNT 16
3035
#define BLOCK_SIZE 512
3136

features/filesystem/bd/BlockDevice.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ class BlockDevice
5959
*/
6060
virtual int deinit() = 0;
6161

62+
/** Ensure data on storage is in sync with the driver
63+
*
64+
* @return 0 on success or a negative error code on failure
65+
*/
66+
virtual int sync()
67+
{
68+
return 0;
69+
}
70+
6271
/** Read blocks from a block device
6372
*
6473
* If a failure occurs, it is not possible to determine how many bytes succeeded
@@ -85,7 +94,8 @@ class BlockDevice
8594

8695
/** Erase blocks on a block device
8796
*
88-
* The state of an erased block is undefined until it has been programmed
97+
* The state of an erased block is undefined until it has been programmed,
98+
* unless get_erase_value returns a non-negative byte value
8999
*
90100
* @param addr Address of block to begin erasing
91101
* @param size Size to erase in bytes, must be a multiple of erase block size
@@ -135,6 +145,20 @@ class BlockDevice
135145
return get_program_size();
136146
}
137147

148+
/** Get the value of storage when erased
149+
*
150+
* If get_erase_value returns a non-negative byte value, the underlying
151+
* storage is set to that value when erased, and storage containing
152+
* that value can be programmed without another erase.
153+
*
154+
* @return The value of storage when erased, or -1 if you can't
155+
* rely on the value of erased storage
156+
*/
157+
virtual int get_erase_value() const
158+
{
159+
return -1;
160+
}
161+
138162
/** Get the total size of the underlying device
139163
*
140164
* @return Size of the underlying device in bytes

features/filesystem/bd/ChainingBlockDevice.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
ChainingBlockDevice::ChainingBlockDevice(BlockDevice **bds, size_t bd_count)
2121
: _bds(bds), _bd_count(bd_count)
2222
, _read_size(0), _program_size(0), _erase_size(0), _size(0)
23+
, _erase_value(-1)
2324
{
2425
}
2526

@@ -33,6 +34,7 @@ int ChainingBlockDevice::init()
3334
_read_size = 0;
3435
_program_size = 0;
3536
_erase_size = 0;
37+
_erase_value = -1;
3638
_size = 0;
3739

3840
// Initialize children block devices, find all sizes and
@@ -66,6 +68,13 @@ int ChainingBlockDevice::init()
6668
MBED_ASSERT(_erase_size > erase && is_aligned(_erase_size, erase));
6769
}
6870

71+
int value = _bds[i]->get_erase_value();
72+
if (i == 0 || value == _erase_value) {
73+
_erase_value = value;
74+
} else {
75+
_erase_value = -1;
76+
}
77+
6978
_size += _bds[i]->size();
7079
}
7180

@@ -84,6 +93,18 @@ int ChainingBlockDevice::deinit()
8493
return 0;
8594
}
8695

96+
int ChainingBlockDevice::sync()
97+
{
98+
for (size_t i = 0; i < _bd_count; i++) {
99+
int err = _bds[i]->sync();
100+
if (err) {
101+
return err;
102+
}
103+
}
104+
105+
return 0;
106+
}
107+
87108
int ChainingBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
88109
{
89110
MBED_ASSERT(is_valid_read(addr, size));
@@ -190,6 +211,11 @@ bd_size_t ChainingBlockDevice::get_erase_size() const
190211
return _erase_size;
191212
}
192213

214+
int ChainingBlockDevice::get_erase_value() const
215+
{
216+
return _erase_value;
217+
}
218+
193219
bd_size_t ChainingBlockDevice::size() const
194220
{
195221
return _size;

features/filesystem/bd/ChainingBlockDevice.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ class ChainingBlockDevice : public BlockDevice
8585
*/
8686
virtual int deinit();
8787

88+
/** Ensure data on storage is in sync with the driver
89+
*
90+
* @return 0 on success or a negative error code on failure
91+
*/
92+
virtual int sync();
93+
8894
/** Read blocks from a block device
8995
*
9096
* @param buffer Buffer to write blocks to
@@ -107,7 +113,8 @@ class ChainingBlockDevice : public BlockDevice
107113

108114
/** Erase blocks on a block device
109115
*
110-
* The state of an erased block is undefined until it has been programmed
116+
* The state of an erased block is undefined until it has been programmed,
117+
* unless get_erase_value returns a non-negative byte value
111118
*
112119
* @param addr Address of block to begin erasing
113120
* @param size Size to erase in bytes, must be a multiple of erase block size
@@ -135,6 +142,17 @@ class ChainingBlockDevice : public BlockDevice
135142
*/
136143
virtual bd_size_t get_erase_size() const;
137144

145+
/** Get the value of storage when erased
146+
*
147+
* If get_erase_value returns a non-negative byte value, the underlying
148+
* storage is set to that value when erased, and storage containing
149+
* that value can be programmed without another erase.
150+
*
151+
* @return The value of storage when erased, or -1 if you can't
152+
* rely on the value of erased storage
153+
*/
154+
virtual int get_erase_value() const;
155+
138156
/** Get the total size of the underlying device
139157
*
140158
* @return Size of the underlying device in bytes
@@ -148,6 +166,7 @@ class ChainingBlockDevice : public BlockDevice
148166
bd_size_t _program_size;
149167
bd_size_t _erase_size;
150168
bd_size_t _size;
169+
int _erase_value;
151170
};
152171

153172

features/filesystem/bd/ExhaustibleBlockDevice.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ int ExhaustibleBlockDevice::deinit()
5353
return _bd->deinit();
5454
}
5555

56+
int ExhaustibleBlockDevice::sync()
57+
{
58+
return _bd->sync();
59+
}
60+
5661
int ExhaustibleBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
5762
{
5863
return _bd->read(buffer, addr, size);
@@ -102,6 +107,11 @@ bd_size_t ExhaustibleBlockDevice::get_erase_size() const
102107
return _bd->get_erase_size();
103108
}
104109

110+
int ExhaustibleBlockDevice::get_erase_value() const
111+
{
112+
return _bd->get_erase_value();
113+
}
114+
105115
bd_size_t ExhaustibleBlockDevice::size() const
106116
{
107117
return _bd->size();

features/filesystem/bd/ExhaustibleBlockDevice.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ class ExhaustibleBlockDevice : public BlockDevice
7070
*/
7171
virtual int deinit();
7272

73+
/** Ensure data on storage is in sync with the driver
74+
*
75+
* @return 0 on success or a negative error code on failure
76+
*/
77+
virtual int sync();
78+
7379
/** Read blocks from a block device
7480
*
7581
* @param buffer Buffer to read blocks into
@@ -92,7 +98,8 @@ class ExhaustibleBlockDevice : public BlockDevice
9298

9399
/** Erase blocks on a block device
94100
*
95-
* The state of an erased block is undefined until it has been programmed
101+
* The state of an erased block is undefined until it has been programmed,
102+
* unless get_erase_value returns a non-negative byte value
96103
*
97104
* @param addr Address of block to begin erasing
98105
* @param size Size to erase in bytes, must be a multiple of erase block size
@@ -118,6 +125,17 @@ class ExhaustibleBlockDevice : public BlockDevice
118125
*/
119126
virtual bd_size_t get_erase_size() const;
120127

128+
/** Get the value of storage when erased
129+
*
130+
* If get_erase_value returns a non-negative byte value, the underlying
131+
* storage is set to that value when erased, and storage containing
132+
* that value can be programmed without another erase.
133+
*
134+
* @return The value of storage when erased, or -1 if you can't
135+
* rely on the value of erased storage
136+
*/
137+
virtual int get_erase_value() const;
138+
121139
/** Get the total size of the underlying device
122140
*
123141
* @return Size of the underlying device in bytes

features/filesystem/bd/MBRBlockDevice.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ int MBRBlockDevice::deinit()
234234
return _bd->deinit();
235235
}
236236

237+
int MBRBlockDevice::sync()
238+
{
239+
return _bd->sync();
240+
}
241+
237242
int MBRBlockDevice::read(void *b, bd_addr_t addr, bd_size_t size)
238243
{
239244
MBED_ASSERT(is_valid_read(addr, size));
@@ -267,6 +272,11 @@ bd_size_t MBRBlockDevice::get_erase_size() const
267272
return _bd->get_erase_size();
268273
}
269274

275+
int MBRBlockDevice::get_erase_value() const
276+
{
277+
return _bd->get_erase_value();
278+
}
279+
270280
bd_size_t MBRBlockDevice::size() const
271281
{
272282
return _size;

features/filesystem/bd/MBRBlockDevice.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ class MBRBlockDevice : public BlockDevice
139139
*/
140140
virtual int deinit();
141141

142+
/** Ensure data on storage is in sync with the driver
143+
*
144+
* @return 0 on success or a negative error code on failure
145+
*/
146+
virtual int sync();
147+
142148
/** Read blocks from a block device
143149
*
144150
* @param buffer Buffer to read blocks into
@@ -161,7 +167,8 @@ class MBRBlockDevice : public BlockDevice
161167

162168
/** Erase blocks on a block device
163169
*
164-
* The state of an erased block is undefined until it has been programmed
170+
* The state of an erased block is undefined until it has been programmed,
171+
* unless get_erase_value returns a non-negative byte value
165172
*
166173
* @param addr Address of block to begin erasing
167174
* @param size Size to erase in bytes, must be a multiple of erase block size
@@ -189,6 +196,17 @@ class MBRBlockDevice : public BlockDevice
189196
*/
190197
virtual bd_size_t get_erase_size() const;
191198

199+
/** Get the value of storage when erased
200+
*
201+
* If get_erase_value returns a non-negative byte value, the underlying
202+
* storage is set to that value when erased, and storage containing
203+
* that value can be programmed without another erase.
204+
*
205+
* @return The value of storage when erased, or -1 if you can't
206+
* rely on the value of erased storage
207+
*/
208+
virtual int get_erase_value() const;
209+
192210
/** Get the total size of the underlying device
193211
*
194212
* @return Size of the underlying device in bytes

features/filesystem/bd/ObservingBlockDevice.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ int ObservingBlockDevice::deinit()
5151
return _bd->deinit();
5252
}
5353

54+
int ObservingBlockDevice::sync()
55+
{
56+
return _bd->sync();
57+
}
58+
5459
int ObservingBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
5560
{
5661
return _bd->read(buffer, addr, size);
@@ -91,6 +96,11 @@ bd_size_t ObservingBlockDevice::get_erase_size() const
9196
return _bd->get_erase_size();
9297
}
9398

99+
int ObservingBlockDevice::get_erase_value() const
100+
{
101+
return _bd->get_erase_value();
102+
}
103+
94104
bd_size_t ObservingBlockDevice::size() const
95105
{
96106
return _bd->size();

features/filesystem/bd/ObservingBlockDevice.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ class ObservingBlockDevice : public BlockDevice
5656
*/
5757
virtual int deinit();
5858

59+
/** Ensure data on storage is in sync with the driver
60+
*
61+
* @return 0 on success or a negative error code on failure
62+
*/
63+
virtual int sync();
64+
5965
/** Read blocks from a block device
6066
*
6167
* @param buffer Buffer to read blocks into
@@ -78,7 +84,8 @@ class ObservingBlockDevice : public BlockDevice
7884

7985
/** Erase blocks on a block device
8086
*
81-
* The state of an erased block is undefined until it has been programmed
87+
* The state of an erased block is undefined until it has been programmed,
88+
* unless get_erase_value returns a non-negative byte value
8289
*
8390
* @param addr Address of block to begin erasing
8491
* @param size Size to erase in bytes, must be a multiple of erase block size
@@ -104,6 +111,17 @@ class ObservingBlockDevice : public BlockDevice
104111
*/
105112
virtual bd_size_t get_erase_size() const;
106113

114+
/** Get the value of storage when erased
115+
*
116+
* If get_erase_value returns a non-negative byte value, the underlying
117+
* storage is set to that value when erased, and storage containing
118+
* that value can be programmed without another erase.
119+
*
120+
* @return The value of storage when erased, or -1 if you can't
121+
* rely on the value of erased storage
122+
*/
123+
virtual int get_erase_value() const;
124+
107125
/** Get the total size of the underlying device
108126
*
109127
* @return Size of the underlying device in bytes

0 commit comments

Comments
 (0)