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_ */

0 commit comments

Comments
 (0)