Skip to content

Commit 820a2e2

Browse files
authored
Merge pull request #9908 from morser499/pr/cy-mbed-os-5.12.0
Pr/cy mbed os 5.12.0
2 parents d97902b + 4c1ff13 commit 820a2e2

File tree

85 files changed

+99216
-4053
lines changed

Some content is hidden

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

85 files changed

+99216
-4053
lines changed

TESTS/mbedmicro-rtos-mbed/mail/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ using namespace utest::v1;
3333
#define THREAD_STACK_SIZE 512
3434
#elif defined(__ARM_FM)
3535
#define THREAD_STACK_SIZE 512
36-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
36+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
3737
#define THREAD_STACK_SIZE 512
3838
#else
3939
#define THREAD_STACK_SIZE 320 /* larger stack cause out of heap memory on some 16kB RAM boards in multi thread test*/

TESTS/mbedmicro-rtos-mbed/malloc/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ volatile bool thread_should_continue = true;
4141
#define THREAD_STACK_SIZE 512
4242
#elif defined(__ARM_FM)
4343
#define THREAD_STACK_SIZE 512
44-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
44+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
4545
#define THREAD_STACK_SIZE 512
4646
#else
4747
#define THREAD_STACK_SIZE 256

TESTS/mbedmicro-rtos-mbed/threads/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define PARALLEL_THREAD_STACK_SIZE 512
3737
#elif defined(__ARM_FM)
3838
#define PARALLEL_THREAD_STACK_SIZE 512
39-
#elif defined(TARGET_FUTURE_SEQUANA_PSA)
39+
#elif defined(TARGET_FUTURE_SEQUANA_PSA) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
4040
#define PARALLEL_THREAD_STACK_SIZE 512
4141
#else
4242
#define PARALLEL_THREAD_STACK_SIZE 384

components/TARGET_PSA/services/attestation/qcbor/test/UsefulBuf_Tests.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,11 @@ const char *UBUTest_CopyUtil()
681681
return "CopyFloatToUint32 failed";
682682
}
683683

684-
if(UsefulBufUtil_CopyDoubleToUint64(4e-40F) != 0X37C16C2800000000ULL) {
684+
if(UsefulBufUtil_CopyDoubleToUint64(4e-40L) != 0X37C16C2800000000ULL) {
685685
return "CopyDoubleToUint64 failed";
686686
}
687687

688-
if(UsefulBufUtil_CopyUint64ToDouble(0X37C16C2800000000ULL) != 4e-40F) {
688+
if(UsefulBufUtil_CopyUint64ToDouble(0X37C16C2800000000ULL) != 4e-40L) {
689689
return "CopyUint64ToDouble failed";
690690
}
691691

components/TARGET_PSA/services/attestation/qcbor/test/float_tests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ int DoubleAsSmallestTest()
379379
// 70 # text(16)
380380
// 7375626E6F726D616C2073696E676C65 # "subnormal single"
381381
// FB 37C16C2800000000 # primitive(4017611261645684736)
382-
QCBOREncode_AddDoubleAsSmallestToMap(&EC, "subnormal single", 4e-40F);
382+
QCBOREncode_AddDoubleAsSmallestToMap(&EC, "subnormal single", 4e-40L);
383383

384384
// 03 # unsigned(3)
385385
// F9 C000 # primitive(49152)

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CY8C63XX/Psoc6BLE.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* mbed Microcontroller Library
33
* Copyright (c) 2017-2017 ARM Limited
44
* Copyright (c) 2017-2018 Future Electronics
5+
* SPDX-License-Identifier: Apache-2.0
56
*
67
* Licensed under the Apache License, Version 2.0 (the "License");
78
* you may not use this file except in compliance with the License.

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CY8C63XX/drivers/IPCPipeTransportDriver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* mbed Microcontroller Library
33
* Copyright (c) 2017-2017 ARM Limited
44
* Copyright (c) 2017-2018 Future Electronics
5+
* SPDX-License-Identifier: Apache-2.0
56
*
67
* Licensed under the Apache License, Version 2.0 (the "License");
78
* you may not use this file except in compliance with the License.

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CY8C63XX/drivers/IPCPipeTransportDriver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* mbed Microcontroller Library
33
* Copyright (c) 2017-2017 ARM Limited
44
* Copyright (c) 2017-2018 Future Electronics
5+
* SPDX-License-Identifier: Apache-2.0
56
*
67
* Licensed under the Apache License, Version 2.0 (the "License");
78
* you may not use this file except in compliance with the License.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2017-2017 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#if DEVICE_SERIAL && DEVICE_SERIAL_FC
19+
20+
#include "CyH4TransportDriver.h"
21+
#include "cycfg_pins.h"
22+
23+
namespace ble {
24+
namespace vendor {
25+
namespace cypress_ble {
26+
27+
CyH4TransportDriver::CyH4TransportDriver(PinName tx, PinName rx, PinName cts, PinName rts, int baud, PinName bt_host_wake_name, PinName bt_device_wake_name) :
28+
uart(tx, rx, baud), cts(cts), rts(rts),
29+
bt_host_wake_name(bt_host_wake_name),
30+
bt_device_wake_name(bt_device_wake_name),
31+
bt_host_wake(bt_host_wake_name, PIN_INPUT, PullNone, 0),
32+
bt_device_wake(bt_device_wake_name, PIN_OUTPUT, PullDefault, 1)
33+
{
34+
}
35+
36+
void CyH4TransportDriver::bt_host_wake_irq_handler(void)
37+
{
38+
sleep_manager_lock_deep_sleep();
39+
CyH4TransportDriver::on_controller_irq();
40+
sleep_manager_unlock_deep_sleep();
41+
}
42+
43+
void CyH4TransportDriver::initialize()
44+
{
45+
InterruptIn *host_wake_pin;
46+
47+
uart.format(
48+
/* bits */ 8,
49+
/* parity */ SerialBase::None,
50+
/* stop bit */ 1
51+
);
52+
53+
uart.set_flow_control(
54+
/* flow */ SerialBase::RTSCTS,
55+
/* rts */ rts,
56+
/* cts */ cts
57+
);
58+
59+
uart.attach(
60+
callback(this, &CyH4TransportDriver::on_controller_irq),
61+
SerialBase::RxIrq
62+
);
63+
64+
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
65+
//Register IRQ for Host WAKE
66+
host_wake_pin = new InterruptIn(bt_host_wake_name);
67+
host_wake_pin->fall(callback(this, &CyH4TransportDriver::bt_host_wake_irq_handler));
68+
69+
#endif
70+
bt_device_wake = 0;
71+
wait_ms(500);
72+
}
73+
74+
void CyH4TransportDriver::terminate() { }
75+
76+
uint16_t CyH4TransportDriver::write(uint8_t type, uint16_t len, uint8_t *pData)
77+
{
78+
uint16_t i = 0;
79+
80+
assert_bt_dev_wake();
81+
82+
while (i < len + 1) {
83+
uint8_t to_write = i == 0 ? type : pData[i - 1];
84+
while (uart.writeable() == 0);
85+
uart.putc(to_write);
86+
++i;
87+
}
88+
89+
deassert_bt_dev_wake();
90+
return len;
91+
}
92+
93+
void CyH4TransportDriver::on_controller_irq()
94+
{
95+
assert_bt_dev_wake();
96+
97+
while (uart.readable()) {
98+
uint8_t char_received = uart.getc();
99+
on_data_received(&char_received, 1);
100+
}
101+
102+
deassert_bt_dev_wake();
103+
}
104+
105+
void CyH4TransportDriver::assert_bt_dev_wake()
106+
{
107+
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
108+
bt_device_wake = 0;
109+
#endif
110+
}
111+
112+
void CyH4TransportDriver::deassert_bt_dev_wake()
113+
{
114+
#if (defined(MBED_TICKLESS) && DEVICE_SLEEP && DEVICE_LPTICKER)
115+
//De-assert bt_device_wake
116+
bt_device_wake = 1;
117+
#endif
118+
}
119+
120+
} // namespace cypress_ble
121+
} // namespace vendor
122+
} // namespace ble
123+
124+
#endif
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2017-2017 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
#ifndef CY_H4TRANSPORT_DRIVER_H_
19+
#define CY_H4TRANSPORT_DRIVER_H_
20+
21+
#if (DEVICE_SERIAL && DEVICE_SERIAL_FC) || defined(DOXYGEN_ONLY)
22+
23+
#include <stdint.h>
24+
#include "mbed.h"
25+
#include "CordioHCITransportDriver.h"
26+
#include "drivers/DigitalInOut.h"
27+
28+
29+
namespace ble {
30+
namespace vendor {
31+
namespace cypress_ble {
32+
33+
using namespace ble::vendor;
34+
35+
/**
36+
* Implementation of the H4 driver over Cypress based chips.
37+
*/
38+
class CyH4TransportDriver : public cordio::CordioHCITransportDriver {
39+
public:
40+
/**
41+
* Initialize the transport driver.
42+
*
43+
*/
44+
CyH4TransportDriver(PinName tx, PinName rx, PinName cts, PinName rts, int baud, PinName bt_host_wake_name, PinName bt_device_wake_name);
45+
46+
/**
47+
* Destructor
48+
*/
49+
virtual ~CyH4TransportDriver() { }
50+
51+
/**
52+
* @see CordioHCITransportDriver::initialize
53+
*/
54+
virtual void initialize();
55+
56+
/**
57+
* @see CordioHCITransportDriver::terminate
58+
*/
59+
virtual void terminate();
60+
61+
/**
62+
* @see CordioHCITransportDriver::write
63+
*/
64+
virtual uint16_t write(uint8_t type, uint16_t len, uint8_t *pData);
65+
66+
void bt_host_wake_irq_handler();
67+
68+
private:
69+
private:
70+
void on_controller_irq();
71+
void assert_bt_dev_wake();
72+
void deassert_bt_dev_wake();
73+
74+
// Use RawSerial as opposed to Serial as we don't require the locking primitives
75+
// provided by the Serial class (access to the UART should be exclusive to this driver)
76+
// Furthermore, we access the peripheral in interrupt context which would clash
77+
// with Serial's locking facilities
78+
RawSerial uart;
79+
PinName cts;
80+
PinName rts;
81+
PinName bt_host_wake_name;
82+
PinName bt_device_wake_name;
83+
DigitalInOut bt_host_wake;
84+
DigitalInOut bt_device_wake;
85+
};
86+
87+
} // namespace cypress
88+
} // namespace vendor
89+
} // namespace ble
90+
91+
#endif
92+
#endif /* CY_H4TRANSPORT_DRIVER_H_ */

features/FEATURE_BLE/targets/TARGET_Cypress/TARGET_CYW43XXX/HCIDriver.cpp

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2018 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
34
*
45
* Licensed under the Apache License, Version 2.0 (the "License");
56
* you may not use this file except in compliance with the License.
@@ -23,7 +24,7 @@
2324
#include "bstream.h"
2425
#include <stdbool.h>
2526
#include "hci_mbed_os_adaptation.h"
26-
#include "H4TransportDriver.h"
27+
#include "CyH4TransportDriver.h"
2728
#include "cycfg_pins.h"
2829

2930
extern const int brcm_patch_ram_length;
@@ -56,15 +57,9 @@ class HCIDriver : public cordio::CordioHCIDriver {
5657
public:
5758
HCIDriver(
5859
cordio::CordioHCITransportDriver& transport_driver,
59-
PinName bt_host_wake_name,
60-
PinName bt_device_wake_name,
6160
PinName bt_power_name
6261
) : cordio::CordioHCIDriver(transport_driver),
63-
bt_host_wake_name(bt_host_wake_name),
64-
bt_device_wake_name(bt_device_wake_name),
6562
bt_power_name(bt_power_name),
66-
bt_host_wake(bt_host_wake_name, PIN_INPUT, PullNone, 0),
67-
bt_device_wake(bt_device_wake_name, PIN_OUTPUT, PullDefault, 1),
6863
bt_power(bt_power_name, PIN_OUTPUT, PullUp, 0),
6964
service_pack_index(0),
7065
service_pack_ptr(0),
@@ -81,9 +76,6 @@ class HCIDriver : public cordio::CordioHCIDriver {
8176

8277
virtual void do_initialize()
8378
{
84-
bt_device_wake = 0;
85-
wait_ms(500);
86-
8779
bt_power = 1;
8880
wait_ms(500);
8981
}
@@ -351,7 +343,7 @@ class HCIDriver : public cordio::CordioHCIDriver {
351343
uint8_t *pBuf;
352344
if ((pBuf = hciCmdAlloc(HCI_VS_CMD_SET_SLEEP_MODE, 12)) != NULL)
353345
{
354-
pBuf[HCI_CMD_HDR_LEN] = 0x00; // no sleep moode
346+
pBuf[HCI_CMD_HDR_LEN] = 0x00; // no sleep
355347
pBuf[HCI_CMD_HDR_LEN + 1] = 0x00; // no idle threshold host (N/A)
356348
pBuf[HCI_CMD_HDR_LEN + 2] = 0x00; // no idle threshold HC (N/A)
357349
pBuf[HCI_CMD_HDR_LEN + 3] = 0x00; // BT WAKE
@@ -414,11 +406,7 @@ class HCIDriver : public cordio::CordioHCIDriver {
414406
}
415407
}
416408

417-
PinName bt_host_wake_name;
418-
PinName bt_device_wake_name;
419409
PinName bt_power_name;
420-
DigitalInOut bt_host_wake;
421-
DigitalInOut bt_device_wake;
422410
DigitalInOut bt_power;
423411
size_t service_pack_index;
424412
const uint8_t* service_pack_ptr;
@@ -433,13 +421,14 @@ class HCIDriver : public cordio::CordioHCIDriver {
433421
} // namespace ble
434422

435423
ble::vendor::cordio::CordioHCIDriver& ble_cordio_get_hci_driver() {
436-
static ble::vendor::cordio::H4TransportDriver transport_driver(
424+
static ble::vendor::cypress_ble::CyH4TransportDriver transport_driver(
437425
/* TX */ CY_BT_UART_TX, /* RX */ CY_BT_UART_RX,
438-
/* cts */ CY_BT_UART_CTS, /* rts */ CY_BT_UART_RTS, 115200
426+
/* cts */ CY_BT_UART_CTS, /* rts */ CY_BT_UART_RTS, 115200,
427+
CY_BT_PIN_HOST_WAKE, CY_BT_PIN_DEVICE_WAKE
439428
);
440429
static ble::vendor::cypress::HCIDriver hci_driver(
441-
transport_driver, /* host wake */ CY_BT_PIN_HOST_WAKE,
442-
/* device wake */ CY_BT_PIN_DEVICE_WAKE, /* bt_power */ CY_BT_PIN_POWER
430+
transport_driver,
431+
/* bt_power */ CY_BT_PIN_POWER
443432
);
444433
return hci_driver;
445434
}

features/storage/kvstore/conf/global/mbed_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"FUTURE_SEQUANA_M0_PSA": {
1515
"storage_type": "TDB_INTERNAL"
1616
},
17+
"CY8CKIT_062_WIFI_BT_M0_PSA": {
18+
"storage_type": "TDB_INTERNAL"
19+
},
1720
"K66F": {
1821
"storage_type": "TDB_INTERNAL"
1922
},

features/storage/kvstore/conf/tdb_internal/mbed_lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"FUTURE_SEQUANA_M0_PSA": {
1515
"internal_size": "0x8000",
1616
"internal_base_address": "0x10078000"
17+
},
18+
"CY8CKIT_062_WIFI_BT_M0_PSA": {
19+
"internal_size": "0x8000",
20+
"internal_base_address": "0x10078000"
1721
}
1822
}
1923
}

0 commit comments

Comments
 (0)