|
1 |
| -/* mbed Microcontroller Library |
2 |
| - * Copyright (c) 2006-2019 ARM Limited |
3 |
| - * SPDX-License-Identifier: Apache-2.0 |
| 1 | +/* |
| 2 | + * Copyright (C) 2021, STMicroelectronics, All Rights Reserved |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
4 | 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 |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | + * not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
8 | 8 | *
|
9 |
| - * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
10 | 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. |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | + * 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 | 16 | */
|
17 | 17 |
|
18 | 18 | #include "drivers/RawCan.h"
|
|
22 | 22 | #include "platform/mbed_power_mgmt.h"
|
23 | 23 |
|
24 | 24 | namespace mbed {
|
25 |
| - RawCAN::RawCAN(PinName rd, PinName td): CAN(rd, td) {} |
26 |
| - |
27 |
| - RawCAN::RawCAN(PinName rd, PinName td, int hz): CAN(rd, td, hz) {} |
28 |
| - |
29 |
| - /* There are situations where the RX interrupt of CAN are cleared only by |
30 |
| - * CAN read operations and locks are not allowed in ISR context in mbed |
31 |
| - * hence this provides an unlocked read to resolve such problem without |
32 |
| - * any effect on the performance. This will work only in case of a single |
33 |
| - * thread accessing a CAN instance, multiple threads will lead to race conditions |
34 |
| - */ |
35 |
| - int RawCAN::read(CANMessage &msg, int handle){ |
36 |
| - int ret = can_read(&_can, &msg, handle); |
37 |
| - return ret; |
38 |
| - } |
39 |
| - |
40 |
| -} // namespace |
| 25 | + |
| 26 | +RawCAN::RawCAN(PinName rd, PinName td): CAN(rd, td) {} |
| 27 | + |
| 28 | +RawCAN::RawCAN(PinName rd, PinName td, int hz): CAN(rd, td, hz) {} |
| 29 | + |
| 30 | +/* There are situations where the RX interrupt of CAN are cleared only by |
| 31 | + * CAN read operations and locks are not allowed in ISR context in mbed |
| 32 | + * hence this provides an unlocked read to resolve such problem without |
| 33 | + * any effect on the performance. This will work only in case of a single |
| 34 | + * thread accessing a CAN instance, multiple threads will lead to race conditions |
| 35 | +*/ |
| 36 | +int RawCAN::read(CANMessage &msg, int handle) { |
| 37 | + int ret = can_read(&_can, &msg, handle); |
| 38 | + return ret; |
| 39 | +} |
| 40 | +} |
41 | 41 |
|
42 | 42 | #endif //DEVICE_CAN
|
0 commit comments