mirror of https://github.com/ARMmbed/mbed-os.git
Renamed files in platform to match source names
critical.h -> mbed_critical.h sleep.h -> mbed_sleep.h toolchain.h -> mbed_toolchain.h rtc_time.h -> mbed_rtc_time.h semihost_api.h -> mbed_semihost_api.h wait_api.h -> mbed_wait_api.hpull/3654/head
parent
a8a31da2e8
commit
aff49d8d1e
|
@ -1,4 +1,4 @@
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "greentea-client/test_env.h"
|
#include "greentea-client/test_env.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "utest.h"
|
#include "utest.h"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
int testWeak1() {
|
int testWeak1() {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "greentea-client/test_env.h"
|
#include "greentea-client/test_env.h"
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "utest.h"
|
#include "utest.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "hal/gpio_irq_api.h"
|
#include "hal/gpio_irq_api.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#if defined(NVIC_NUM_VECTORS)
|
#if defined(NVIC_NUM_VECTORS)
|
||||||
|
|
||||||
#include "drivers/InterruptManager.h"
|
#include "drivers/InterruptManager.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define CHAIN_INITIAL_SIZE 4
|
#define CHAIN_INITIAL_SIZE 4
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#if DEVICE_LOCALFILESYSTEM
|
#if DEVICE_LOCALFILESYSTEM
|
||||||
|
|
||||||
#include "platform/semihost_api.h"
|
#include "platform/mbed_semihost_api.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#if DEVICE_PORTIN
|
#if DEVICE_PORTIN
|
||||||
|
|
||||||
#include "hal/port_api.h"
|
#include "hal/port_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#if DEVICE_PORTINOUT
|
#if DEVICE_PORTINOUT
|
||||||
|
|
||||||
#include "hal/port_api.h"
|
#include "hal/port_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#if DEVICE_PORTOUT
|
#if DEVICE_PORTOUT
|
||||||
|
|
||||||
#include "hal/port_api.h"
|
#include "hal/port_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#if DEVICE_PWMOUT
|
#if DEVICE_PWMOUT
|
||||||
#include "hal/pwmout_api.h"
|
#include "hal/pwmout_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "drivers/RawSerial.h"
|
#include "drivers/RawSerial.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "drivers/SPI.h"
|
#include "drivers/SPI.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
#if DEVICE_SPI
|
#if DEVICE_SPI
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "drivers/Serial.h"
|
#include "drivers/Serial.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "drivers/SerialBase.h"
|
#include "drivers/SerialBase.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include "Stream.h"
|
#include "Stream.h"
|
||||||
#include "Callback.h"
|
#include "Callback.h"
|
||||||
#include "serial_api.h"
|
#include "serial_api.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
#if DEVICE_SERIAL_ASYNCH
|
#if DEVICE_SERIAL_ASYNCH
|
||||||
#include "CThunk.h"
|
#include "CThunk.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "drivers/TimerEvent.h"
|
#include "drivers/TimerEvent.h"
|
||||||
#include "platform/FunctionPointer.h"
|
#include "platform/FunctionPointer.h"
|
||||||
#include "hal/ticker_api.h"
|
#include "hal/ticker_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "drivers/TimerEvent.h"
|
#include "drivers/TimerEvent.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup drivers */
|
/** \addtogroup drivers */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "drivers/Timer.h"
|
#include "drivers/Timer.h"
|
||||||
#include "hal/ticker_api.h"
|
#include "hal/ticker_api.h"
|
||||||
#include "hal/us_ticker_api.h"
|
#include "hal/us_ticker_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "nuc472_eth.h"
|
#include "nuc472_eth.h"
|
||||||
#include "lwip/opt.h"
|
#include "lwip/opt.h"
|
||||||
#include "lwip/def.h"
|
#include "lwip/def.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
#define ETH_TRIGGER_RX() do{EMAC->RXST = 0;}while(0)
|
#define ETH_TRIGGER_RX() do{EMAC->RXST = 0;}while(0)
|
||||||
#define ETH_TRIGGER_TX() do{EMAC->TXST = 0;}while(0)
|
#define ETH_TRIGGER_TX() do{EMAC->TXST = 0;}while(0)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "stm32f4xx_hal.h"
|
#include "stm32f4xx_hal.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
#define C029_OTP_START_ADDRESS (0x1FFF7800U)
|
#define C029_OTP_START_ADDRESS (0x1FFF7800U)
|
||||||
#define C029_OTP_END_ADDRESS (C029_OTP_START_ADDRESS + (16*32))
|
#define C029_OTP_END_ADDRESS (C029_OTP_START_ADDRESS + (16*32))
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
#include "utest/utest.h"
|
#include "utest/utest.h"
|
||||||
|
|
||||||
using namespace utest::v1;
|
using namespace utest::v1;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "ns_types.h"
|
#include "ns_types.h"
|
||||||
#include "platform/arm_hal_interrupt.h"
|
#include "platform/arm_hal_interrupt.h"
|
||||||
#include "nanostack/platform/arm_hal_phy.h"
|
#include "nanostack/platform/arm_hal_phy.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "mbed-trace/mbed_trace.h"
|
#include "mbed-trace/mbed_trace.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "netsocket/NetworkStack.h"
|
#include "netsocket/NetworkStack.h"
|
||||||
#include "rtos/Mutex.h"
|
#include "rtos/Mutex.h"
|
||||||
#include "Callback.h"
|
#include "Callback.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
|
|
||||||
/** Abstract socket class
|
/** Abstract socket class
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#define SOCKET_ADDRESS_H
|
#define SOCKET_ADDRESS_H
|
||||||
|
|
||||||
#include "nsapi_types.h"
|
#include "nsapi_types.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
// Predeclared classes
|
// Predeclared classes
|
||||||
class NetworkStack;
|
class NetworkStack;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "USBEndpoints.h"
|
#include "USBEndpoints.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
//#ifdef __GNUC__
|
//#ifdef __GNUC__
|
||||||
//#define __packed __attribute__ ((__packed__))
|
//#define __packed __attribute__ ((__packed__))
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#define USB_INC_H
|
#define USB_INC_H
|
||||||
|
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
enum USB_TYPE {
|
enum USB_TYPE {
|
||||||
USB_TYPE_OK = 0,
|
USB_TYPE_OK = 0,
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "FATFileSystem.h"
|
#include "FATFileSystem.h"
|
||||||
#include "FATFileHandle.h"
|
#include "FATFileHandle.h"
|
||||||
#include "FATDirHandle.h"
|
#include "FATDirHandle.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
DWORD get_fattime(void) {
|
DWORD get_fattime(void) {
|
||||||
time_t rawtime;
|
time_t rawtime;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (c) 2010-2011 ARM Limited. All rights reserved.
|
* Copyright (c) 2010-2011 ARM Limited. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include "SerialHalfDuplex.h"
|
#include "SerialHalfDuplex.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "test_env.h"
|
#include "test_env.h"
|
||||||
#include "semihost_api.h"
|
#include "mbed_semihost_api.h"
|
||||||
|
|
||||||
Serial pc(USBTX, USBRX);
|
Serial pc(USBTX, USBRX);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "test_env.h"
|
#include "test_env.h"
|
||||||
#include "semihost_api.h"
|
#include "mbed_semihost_api.h"
|
||||||
|
|
||||||
#define MAC_VENDOR_ARM_0 0x00
|
#define MAC_VENDOR_ARM_0 0x00
|
||||||
#define MAC_VENDOR_ARM_1 0x02
|
#define MAC_VENDOR_ARM_1 0x02
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "test_env.h"
|
#include "test_env.h"
|
||||||
#include "cmsis_nvic.h"
|
#include "cmsis_nvic.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A)
|
#if defined(TARGET_SAMR21G18A) || defined(TARGET_SAMD21J18A) || defined(TARGET_SAMD21G18A)
|
||||||
|
|
|
@ -65,7 +65,7 @@ TEST(C_String_Format, Sprintf_Negative_Integers)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEVICE_SEMIHOST
|
#ifdef DEVICE_SEMIHOST
|
||||||
#include "semihost_api.h"
|
#include "mbed_semihost_api.h"
|
||||||
|
|
||||||
TEST_GROUP(Device_Semihost)
|
TEST_GROUP(Device_Semihost)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "TestHarness.h"
|
#include "TestHarness.h"
|
||||||
#include "mbed.h"
|
#include "mbed.h"
|
||||||
#include "semihost_api.h"
|
#include "mbed_semihost_api.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define FILENAME "/local/out.txt"
|
#define FILENAME "/local/out.txt"
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
#include "flash_data.h"
|
#include "flash_data.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define MBED_FLASH_ALGO_ERASE 1UL
|
#define MBED_FLASH_ALGO_ERASE 1UL
|
||||||
#define MBED_FLASH_ALGO_PROGRAM 2UL
|
#define MBED_FLASH_ALGO_PROGRAM 2UL
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
*/
|
*/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "hal/ticker_api.h"
|
#include "hal/ticker_api.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
void ticker_set_handler(const ticker_data_t *const data, ticker_event_handler handler) {
|
void ticker_set_handler(const ticker_data_t *const data, ticker_event_handler handler) {
|
||||||
data->interface->init();
|
data->interface->init();
|
||||||
|
|
8
mbed.h
8
mbed.h
|
@ -47,7 +47,7 @@
|
||||||
#include "events/mbed_events.h"
|
#include "events/mbed_events.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "platform/mbed_application.h"
|
#include "platform/mbed_application.h"
|
||||||
|
|
||||||
|
@ -92,10 +92,10 @@
|
||||||
#include "drivers/LowPowerTimer.h"
|
#include "drivers/LowPowerTimer.h"
|
||||||
#include "drivers/LocalFileSystem.h"
|
#include "drivers/LocalFileSystem.h"
|
||||||
#include "drivers/InterruptIn.h"
|
#include "drivers/InterruptIn.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "hal/sleep_api.h"
|
#include "hal/sleep_api.h"
|
||||||
#include "platform/sleep.h"
|
#include "platform/mbed_sleep.h"
|
||||||
#include "platform/rtc_time.h"
|
#include "platform/mbed_rtc_time.h"
|
||||||
|
|
||||||
// mbed Non-hardware components
|
// mbed Non-hardware components
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "platform/CallChain.h"
|
#include "platform/CallChain.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#define MBED_CALLCHAIN_H
|
#define MBED_CALLCHAIN_H
|
||||||
|
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <new>
|
#include <new>
|
||||||
#include "platform/mbed_assert.h"
|
#include "platform/mbed_assert.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup platform */
|
/** \addtogroup platform */
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#ifndef MBED_CIRCULARBUFFER_H
|
#ifndef MBED_CIRCULARBUFFER_H
|
||||||
#define MBED_CIRCULARBUFFER_H
|
#define MBED_CIRCULARBUFFER_H
|
||||||
|
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
/** \addtogroup platform */
|
/** \addtogroup platform */
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#define MBED_FUNCTIONPOINTER_H
|
#define MBED_FUNCTIONPOINTER_H
|
||||||
|
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
|
|
||||||
/** \addtogroup platform */
|
|
||||||
/** @{*/
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
@ -18,342 +15,10 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MBED_UTIL_CRITICAL_H__
|
#ifndef MBED_OLD_CRITICAL_H
|
||||||
#define __MBED_UTIL_CRITICAL_H__
|
#define MBED_OLD_CRITICAL_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#warning critical.h has been replaced by mbed_critical.h, please update to mbed_critical.h [since mbed-os-5.3]
|
||||||
#include <stdint.h>
|
#include "platform/mbed_critical.h"
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** Determine the current interrupts enabled state
|
|
||||||
*
|
|
||||||
* This function can be called to determine whether or not interrupts are currently enabled.
|
|
||||||
* \note
|
|
||||||
* NOTE:
|
|
||||||
* This function works for both cortex-A and cortex-M, although the underlyng implementation
|
|
||||||
* differs.
|
|
||||||
* @return true if interrupts are enabled, false otherwise
|
|
||||||
*/
|
|
||||||
bool core_util_are_interrupts_enabled(void);
|
|
||||||
|
|
||||||
/** Mark the start of a critical section
|
|
||||||
*
|
|
||||||
* This function should be called to mark the start of a critical section of code.
|
|
||||||
* \note
|
|
||||||
* NOTES:
|
|
||||||
* 1) The use of this style of critical section is targetted at C based implementations.
|
|
||||||
* 2) These critical sections can be nested.
|
|
||||||
* 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
|
|
||||||
* section) will be preserved on exit from the section.
|
|
||||||
* 4) This implementation will currently only work on code running in privileged mode.
|
|
||||||
*/
|
|
||||||
void core_util_critical_section_enter(void);
|
|
||||||
|
|
||||||
/** Mark the end of a critical section
|
|
||||||
*
|
|
||||||
* This function should be called to mark the end of a critical section of code.
|
|
||||||
* \note
|
|
||||||
* NOTES:
|
|
||||||
* 1) The use of this style of critical section is targetted at C based implementations.
|
|
||||||
* 2) These critical sections can be nested.
|
|
||||||
* 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
|
|
||||||
* section) will be preserved on exit from the section.
|
|
||||||
* 4) This implementation will currently only work on code running in privileged mode.
|
|
||||||
*/
|
|
||||||
void core_util_critical_section_exit(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic compare and set. It compares the contents of a memory location to a
|
|
||||||
* given value and, only if they are the same, modifies the contents of that
|
|
||||||
* memory location to a given new value. This is done as a single atomic
|
|
||||||
* operation. The atomicity guarantees that the new value is calculated based on
|
|
||||||
* up-to-date information; if the value had been updated by another thread in
|
|
||||||
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
|
||||||
*
|
|
||||||
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
|
||||||
* you to the article on compare-and swap].
|
|
||||||
*
|
|
||||||
* @param ptr The target memory location.
|
|
||||||
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
|
||||||
* expected current value of the data being set atomically.
|
|
||||||
* The computed 'desiredValue' should be a function of this current value.
|
|
||||||
* @Note: This is an in-out parameter. In the
|
|
||||||
* failure case of atomic_cas (where the
|
|
||||||
* destination isn't set), the pointee of expectedCurrentValue is
|
|
||||||
* updated with the current value.
|
|
||||||
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
|
||||||
*
|
|
||||||
* @return true if the memory location was atomically
|
|
||||||
* updated with the desired value (after verifying
|
|
||||||
* that it contained the expectedCurrentValue),
|
|
||||||
* false otherwise. In the failure case,
|
|
||||||
* exepctedCurrentValue is updated with the new
|
|
||||||
* value of the target memory location.
|
|
||||||
*
|
|
||||||
* pseudocode:
|
|
||||||
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
|
||||||
* if *p != *old {
|
|
||||||
* *old = *p
|
|
||||||
* return false
|
|
||||||
* }
|
|
||||||
* *p = new
|
|
||||||
* return true
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @Note: In the failure case (where the destination isn't set), the value
|
|
||||||
* pointed to by expectedCurrentValue is still updated with the current value.
|
|
||||||
* This property helps writing concise code for the following incr:
|
|
||||||
*
|
|
||||||
* function incr(p : pointer to int, a : int) returns int {
|
|
||||||
* done = false
|
|
||||||
* value = *p // This fetch operation need not be atomic.
|
|
||||||
* while not done {
|
|
||||||
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
|
||||||
* }
|
|
||||||
* return value + a
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic compare and set. It compares the contents of a memory location to a
|
|
||||||
* given value and, only if they are the same, modifies the contents of that
|
|
||||||
* memory location to a given new value. This is done as a single atomic
|
|
||||||
* operation. The atomicity guarantees that the new value is calculated based on
|
|
||||||
* up-to-date information; if the value had been updated by another thread in
|
|
||||||
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
|
||||||
*
|
|
||||||
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
|
||||||
* you to the article on compare-and swap].
|
|
||||||
*
|
|
||||||
* @param ptr The target memory location.
|
|
||||||
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
|
||||||
* expected current value of the data being set atomically.
|
|
||||||
* The computed 'desiredValue' should be a function of this current value.
|
|
||||||
* @Note: This is an in-out parameter. In the
|
|
||||||
* failure case of atomic_cas (where the
|
|
||||||
* destination isn't set), the pointee of expectedCurrentValue is
|
|
||||||
* updated with the current value.
|
|
||||||
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
|
||||||
*
|
|
||||||
* @return true if the memory location was atomically
|
|
||||||
* updated with the desired value (after verifying
|
|
||||||
* that it contained the expectedCurrentValue),
|
|
||||||
* false otherwise. In the failure case,
|
|
||||||
* exepctedCurrentValue is updated with the new
|
|
||||||
* value of the target memory location.
|
|
||||||
*
|
|
||||||
* pseudocode:
|
|
||||||
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
|
||||||
* if *p != *old {
|
|
||||||
* *old = *p
|
|
||||||
* return false
|
|
||||||
* }
|
|
||||||
* *p = new
|
|
||||||
* return true
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @Note: In the failure case (where the destination isn't set), the value
|
|
||||||
* pointed to by expectedCurrentValue is still updated with the current value.
|
|
||||||
* This property helps writing concise code for the following incr:
|
|
||||||
*
|
|
||||||
* function incr(p : pointer to int, a : int) returns int {
|
|
||||||
* done = false
|
|
||||||
* value = *p // This fetch operation need not be atomic.
|
|
||||||
* while not done {
|
|
||||||
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
|
||||||
* }
|
|
||||||
* return value + a
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic compare and set. It compares the contents of a memory location to a
|
|
||||||
* given value and, only if they are the same, modifies the contents of that
|
|
||||||
* memory location to a given new value. This is done as a single atomic
|
|
||||||
* operation. The atomicity guarantees that the new value is calculated based on
|
|
||||||
* up-to-date information; if the value had been updated by another thread in
|
|
||||||
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
|
||||||
*
|
|
||||||
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
|
||||||
* you to the article on compare-and swap].
|
|
||||||
*
|
|
||||||
* @param ptr The target memory location.
|
|
||||||
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
|
||||||
* expected current value of the data being set atomically.
|
|
||||||
* The computed 'desiredValue' should be a function of this current value.
|
|
||||||
* @Note: This is an in-out parameter. In the
|
|
||||||
* failure case of atomic_cas (where the
|
|
||||||
* destination isn't set), the pointee of expectedCurrentValue is
|
|
||||||
* updated with the current value.
|
|
||||||
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
|
||||||
*
|
|
||||||
* @return true if the memory location was atomically
|
|
||||||
* updated with the desired value (after verifying
|
|
||||||
* that it contained the expectedCurrentValue),
|
|
||||||
* false otherwise. In the failure case,
|
|
||||||
* exepctedCurrentValue is updated with the new
|
|
||||||
* value of the target memory location.
|
|
||||||
*
|
|
||||||
* pseudocode:
|
|
||||||
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
|
||||||
* if *p != *old {
|
|
||||||
* *old = *p
|
|
||||||
* return false
|
|
||||||
* }
|
|
||||||
* *p = new
|
|
||||||
* return true
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @Note: In the failure case (where the destination isn't set), the value
|
|
||||||
* pointed to by expectedCurrentValue is still updated with the current value.
|
|
||||||
* This property helps writing concise code for the following incr:
|
|
||||||
*
|
|
||||||
* function incr(p : pointer to int, a : int) returns int {
|
|
||||||
* done = false
|
|
||||||
* value = *p // This fetch operation need not be atomic.
|
|
||||||
* while not done {
|
|
||||||
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
|
||||||
* }
|
|
||||||
* return value + a
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic compare and set. It compares the contents of a memory location to a
|
|
||||||
* given value and, only if they are the same, modifies the contents of that
|
|
||||||
* memory location to a given new value. This is done as a single atomic
|
|
||||||
* operation. The atomicity guarantees that the new value is calculated based on
|
|
||||||
* up-to-date information; if the value had been updated by another thread in
|
|
||||||
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
|
||||||
*
|
|
||||||
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
|
||||||
* you to the article on compare-and swap].
|
|
||||||
*
|
|
||||||
* @param ptr The target memory location.
|
|
||||||
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
|
||||||
* expected current value of the data being set atomically.
|
|
||||||
* The computed 'desiredValue' should be a function of this current value.
|
|
||||||
* @Note: This is an in-out parameter. In the
|
|
||||||
* failure case of atomic_cas (where the
|
|
||||||
* destination isn't set), the pointee of expectedCurrentValue is
|
|
||||||
* updated with the current value.
|
|
||||||
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
|
||||||
*
|
|
||||||
* @return true if the memory location was atomically
|
|
||||||
* updated with the desired value (after verifying
|
|
||||||
* that it contained the expectedCurrentValue),
|
|
||||||
* false otherwise. In the failure case,
|
|
||||||
* exepctedCurrentValue is updated with the new
|
|
||||||
* value of the target memory location.
|
|
||||||
*
|
|
||||||
* pseudocode:
|
|
||||||
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
|
||||||
* if *p != *old {
|
|
||||||
* *old = *p
|
|
||||||
* return false
|
|
||||||
* }
|
|
||||||
* *p = new
|
|
||||||
* return true
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* @Note: In the failure case (where the destination isn't set), the value
|
|
||||||
* pointed to by expectedCurrentValue is still updated with the current value.
|
|
||||||
* This property helps writing concise code for the following incr:
|
|
||||||
*
|
|
||||||
* function incr(p : pointer to int, a : int) returns int {
|
|
||||||
* done = false
|
|
||||||
* value = *p // This fetch operation need not be atomic.
|
|
||||||
* while not done {
|
|
||||||
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
|
||||||
* }
|
|
||||||
* return value + a
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic increment.
|
|
||||||
* @param valuePtr Target memory location being incremented.
|
|
||||||
* @param delta The amount being incremented.
|
|
||||||
* @return The new incremented value.
|
|
||||||
*/
|
|
||||||
uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic increment.
|
|
||||||
* @param valuePtr Target memory location being incremented.
|
|
||||||
* @param delta The amount being incremented.
|
|
||||||
* @return The new incremented value.
|
|
||||||
*/
|
|
||||||
uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic increment.
|
|
||||||
* @param valuePtr Target memory location being incremented.
|
|
||||||
* @param delta The amount being incremented.
|
|
||||||
* @return The new incremented value.
|
|
||||||
*/
|
|
||||||
uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic increment.
|
|
||||||
* @param valuePtr Target memory location being incremented.
|
|
||||||
* @param delta The amount being incremented in bytes.
|
|
||||||
* @return The new incremented value.
|
|
||||||
*
|
|
||||||
* @note The type of the pointer argument is not taken into account
|
|
||||||
* and the pointer is incremented by bytes.
|
|
||||||
*/
|
|
||||||
void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic decrement.
|
|
||||||
* @param valuePtr Target memory location being decremented.
|
|
||||||
* @param delta The amount being decremented.
|
|
||||||
* @return The new decremented value.
|
|
||||||
*/
|
|
||||||
uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic decrement.
|
|
||||||
* @param valuePtr Target memory location being decremented.
|
|
||||||
* @param delta The amount being decremented.
|
|
||||||
* @return The new decremented value.
|
|
||||||
*/
|
|
||||||
uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic decrement.
|
|
||||||
* @param valuePtr Target memory location being decremented.
|
|
||||||
* @param delta The amount being decremented.
|
|
||||||
* @return The new decremented value.
|
|
||||||
*/
|
|
||||||
uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Atomic decrement.
|
|
||||||
* @param valuePtr Target memory location being decremented.
|
|
||||||
* @param delta The amount being decremented in bytes.
|
|
||||||
* @return The new decremented value.
|
|
||||||
*
|
|
||||||
* @note The type of the pointer argument is not taken into account
|
|
||||||
* and the pointer is decremented by bytes
|
|
||||||
*/
|
|
||||||
void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif // __MBED_UTIL_CRITICAL_H__
|
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "platform/mbed_mem_trace.h"
|
#include "platform/mbed_mem_trace.h"
|
||||||
#include "platform/mbed_stats.h"
|
#include "platform/mbed_stats.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "platform/PlatformMutex.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
void mbed_assert_internal(const char *expr, const char *file, int line)
|
void mbed_assert_internal(const char *expr, const char *file, int line)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,10 +15,10 @@
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include "hal/serial_api.h"
|
#include "hal/serial_api.h"
|
||||||
|
|
||||||
#if DEVICE_SERIAL
|
#if DEVICE_SERIAL
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
|
|
||||||
/* Declare __STDC_LIMIT_MACROS so stdint.h defines UINT32_MAX when using C++ */
|
/* Declare __STDC_LIMIT_MACROS so stdint.h defines UINT32_MAX when using C++ */
|
||||||
#define __STDC_LIMIT_MACROS
|
#define __STDC_LIMIT_MACROS
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "platform/mbed_assert.h"
|
#include "platform/mbed_assert.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
#define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS))
|
#define EXCLUSIVE_ACCESS (!defined (__CORTEX_M0) && !defined (__CORTEX_M0PLUS))
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,359 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MBED_UTIL_CRITICAL_H__
|
||||||
|
#define __MBED_UTIL_CRITICAL_H__
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/** Determine the current interrupts enabled state
|
||||||
|
*
|
||||||
|
* This function can be called to determine whether or not interrupts are currently enabled.
|
||||||
|
* \note
|
||||||
|
* NOTE:
|
||||||
|
* This function works for both cortex-A and cortex-M, although the underlyng implementation
|
||||||
|
* differs.
|
||||||
|
* @return true if interrupts are enabled, false otherwise
|
||||||
|
*/
|
||||||
|
bool core_util_are_interrupts_enabled(void);
|
||||||
|
|
||||||
|
/** Mark the start of a critical section
|
||||||
|
*
|
||||||
|
* This function should be called to mark the start of a critical section of code.
|
||||||
|
* \note
|
||||||
|
* NOTES:
|
||||||
|
* 1) The use of this style of critical section is targetted at C based implementations.
|
||||||
|
* 2) These critical sections can be nested.
|
||||||
|
* 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
|
||||||
|
* section) will be preserved on exit from the section.
|
||||||
|
* 4) This implementation will currently only work on code running in privileged mode.
|
||||||
|
*/
|
||||||
|
void core_util_critical_section_enter(void);
|
||||||
|
|
||||||
|
/** Mark the end of a critical section
|
||||||
|
*
|
||||||
|
* This function should be called to mark the end of a critical section of code.
|
||||||
|
* \note
|
||||||
|
* NOTES:
|
||||||
|
* 1) The use of this style of critical section is targetted at C based implementations.
|
||||||
|
* 2) These critical sections can be nested.
|
||||||
|
* 3) The interrupt enable state on entry to the first critical section (of a nested set, or single
|
||||||
|
* section) will be preserved on exit from the section.
|
||||||
|
* 4) This implementation will currently only work on code running in privileged mode.
|
||||||
|
*/
|
||||||
|
void core_util_critical_section_exit(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic compare and set. It compares the contents of a memory location to a
|
||||||
|
* given value and, only if they are the same, modifies the contents of that
|
||||||
|
* memory location to a given new value. This is done as a single atomic
|
||||||
|
* operation. The atomicity guarantees that the new value is calculated based on
|
||||||
|
* up-to-date information; if the value had been updated by another thread in
|
||||||
|
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
||||||
|
*
|
||||||
|
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
||||||
|
* you to the article on compare-and swap].
|
||||||
|
*
|
||||||
|
* @param ptr The target memory location.
|
||||||
|
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
||||||
|
* expected current value of the data being set atomically.
|
||||||
|
* The computed 'desiredValue' should be a function of this current value.
|
||||||
|
* @Note: This is an in-out parameter. In the
|
||||||
|
* failure case of atomic_cas (where the
|
||||||
|
* destination isn't set), the pointee of expectedCurrentValue is
|
||||||
|
* updated with the current value.
|
||||||
|
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
||||||
|
*
|
||||||
|
* @return true if the memory location was atomically
|
||||||
|
* updated with the desired value (after verifying
|
||||||
|
* that it contained the expectedCurrentValue),
|
||||||
|
* false otherwise. In the failure case,
|
||||||
|
* exepctedCurrentValue is updated with the new
|
||||||
|
* value of the target memory location.
|
||||||
|
*
|
||||||
|
* pseudocode:
|
||||||
|
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
||||||
|
* if *p != *old {
|
||||||
|
* *old = *p
|
||||||
|
* return false
|
||||||
|
* }
|
||||||
|
* *p = new
|
||||||
|
* return true
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @Note: In the failure case (where the destination isn't set), the value
|
||||||
|
* pointed to by expectedCurrentValue is still updated with the current value.
|
||||||
|
* This property helps writing concise code for the following incr:
|
||||||
|
*
|
||||||
|
* function incr(p : pointer to int, a : int) returns int {
|
||||||
|
* done = false
|
||||||
|
* value = *p // This fetch operation need not be atomic.
|
||||||
|
* while not done {
|
||||||
|
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
||||||
|
* }
|
||||||
|
* return value + a
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
bool core_util_atomic_cas_u8(uint8_t *ptr, uint8_t *expectedCurrentValue, uint8_t desiredValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic compare and set. It compares the contents of a memory location to a
|
||||||
|
* given value and, only if they are the same, modifies the contents of that
|
||||||
|
* memory location to a given new value. This is done as a single atomic
|
||||||
|
* operation. The atomicity guarantees that the new value is calculated based on
|
||||||
|
* up-to-date information; if the value had been updated by another thread in
|
||||||
|
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
||||||
|
*
|
||||||
|
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
||||||
|
* you to the article on compare-and swap].
|
||||||
|
*
|
||||||
|
* @param ptr The target memory location.
|
||||||
|
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
||||||
|
* expected current value of the data being set atomically.
|
||||||
|
* The computed 'desiredValue' should be a function of this current value.
|
||||||
|
* @Note: This is an in-out parameter. In the
|
||||||
|
* failure case of atomic_cas (where the
|
||||||
|
* destination isn't set), the pointee of expectedCurrentValue is
|
||||||
|
* updated with the current value.
|
||||||
|
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
||||||
|
*
|
||||||
|
* @return true if the memory location was atomically
|
||||||
|
* updated with the desired value (after verifying
|
||||||
|
* that it contained the expectedCurrentValue),
|
||||||
|
* false otherwise. In the failure case,
|
||||||
|
* exepctedCurrentValue is updated with the new
|
||||||
|
* value of the target memory location.
|
||||||
|
*
|
||||||
|
* pseudocode:
|
||||||
|
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
||||||
|
* if *p != *old {
|
||||||
|
* *old = *p
|
||||||
|
* return false
|
||||||
|
* }
|
||||||
|
* *p = new
|
||||||
|
* return true
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @Note: In the failure case (where the destination isn't set), the value
|
||||||
|
* pointed to by expectedCurrentValue is still updated with the current value.
|
||||||
|
* This property helps writing concise code for the following incr:
|
||||||
|
*
|
||||||
|
* function incr(p : pointer to int, a : int) returns int {
|
||||||
|
* done = false
|
||||||
|
* value = *p // This fetch operation need not be atomic.
|
||||||
|
* while not done {
|
||||||
|
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
||||||
|
* }
|
||||||
|
* return value + a
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
bool core_util_atomic_cas_u16(uint16_t *ptr, uint16_t *expectedCurrentValue, uint16_t desiredValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic compare and set. It compares the contents of a memory location to a
|
||||||
|
* given value and, only if they are the same, modifies the contents of that
|
||||||
|
* memory location to a given new value. This is done as a single atomic
|
||||||
|
* operation. The atomicity guarantees that the new value is calculated based on
|
||||||
|
* up-to-date information; if the value had been updated by another thread in
|
||||||
|
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
||||||
|
*
|
||||||
|
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
||||||
|
* you to the article on compare-and swap].
|
||||||
|
*
|
||||||
|
* @param ptr The target memory location.
|
||||||
|
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
||||||
|
* expected current value of the data being set atomically.
|
||||||
|
* The computed 'desiredValue' should be a function of this current value.
|
||||||
|
* @Note: This is an in-out parameter. In the
|
||||||
|
* failure case of atomic_cas (where the
|
||||||
|
* destination isn't set), the pointee of expectedCurrentValue is
|
||||||
|
* updated with the current value.
|
||||||
|
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
||||||
|
*
|
||||||
|
* @return true if the memory location was atomically
|
||||||
|
* updated with the desired value (after verifying
|
||||||
|
* that it contained the expectedCurrentValue),
|
||||||
|
* false otherwise. In the failure case,
|
||||||
|
* exepctedCurrentValue is updated with the new
|
||||||
|
* value of the target memory location.
|
||||||
|
*
|
||||||
|
* pseudocode:
|
||||||
|
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
||||||
|
* if *p != *old {
|
||||||
|
* *old = *p
|
||||||
|
* return false
|
||||||
|
* }
|
||||||
|
* *p = new
|
||||||
|
* return true
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @Note: In the failure case (where the destination isn't set), the value
|
||||||
|
* pointed to by expectedCurrentValue is still updated with the current value.
|
||||||
|
* This property helps writing concise code for the following incr:
|
||||||
|
*
|
||||||
|
* function incr(p : pointer to int, a : int) returns int {
|
||||||
|
* done = false
|
||||||
|
* value = *p // This fetch operation need not be atomic.
|
||||||
|
* while not done {
|
||||||
|
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
||||||
|
* }
|
||||||
|
* return value + a
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
bool core_util_atomic_cas_u32(uint32_t *ptr, uint32_t *expectedCurrentValue, uint32_t desiredValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic compare and set. It compares the contents of a memory location to a
|
||||||
|
* given value and, only if they are the same, modifies the contents of that
|
||||||
|
* memory location to a given new value. This is done as a single atomic
|
||||||
|
* operation. The atomicity guarantees that the new value is calculated based on
|
||||||
|
* up-to-date information; if the value had been updated by another thread in
|
||||||
|
* the meantime, the write would fail due to a mismatched expectedCurrentValue.
|
||||||
|
*
|
||||||
|
* Refer to https://en.wikipedia.org/wiki/Compare-and-set [which may redirect
|
||||||
|
* you to the article on compare-and swap].
|
||||||
|
*
|
||||||
|
* @param ptr The target memory location.
|
||||||
|
* @param[in,out] expectedCurrentValue A pointer to some location holding the
|
||||||
|
* expected current value of the data being set atomically.
|
||||||
|
* The computed 'desiredValue' should be a function of this current value.
|
||||||
|
* @Note: This is an in-out parameter. In the
|
||||||
|
* failure case of atomic_cas (where the
|
||||||
|
* destination isn't set), the pointee of expectedCurrentValue is
|
||||||
|
* updated with the current value.
|
||||||
|
* @param[in] desiredValue The new value computed based on '*expectedCurrentValue'.
|
||||||
|
*
|
||||||
|
* @return true if the memory location was atomically
|
||||||
|
* updated with the desired value (after verifying
|
||||||
|
* that it contained the expectedCurrentValue),
|
||||||
|
* false otherwise. In the failure case,
|
||||||
|
* exepctedCurrentValue is updated with the new
|
||||||
|
* value of the target memory location.
|
||||||
|
*
|
||||||
|
* pseudocode:
|
||||||
|
* function cas(p : pointer to int, old : pointer to int, new : int) returns bool {
|
||||||
|
* if *p != *old {
|
||||||
|
* *old = *p
|
||||||
|
* return false
|
||||||
|
* }
|
||||||
|
* *p = new
|
||||||
|
* return true
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @Note: In the failure case (where the destination isn't set), the value
|
||||||
|
* pointed to by expectedCurrentValue is still updated with the current value.
|
||||||
|
* This property helps writing concise code for the following incr:
|
||||||
|
*
|
||||||
|
* function incr(p : pointer to int, a : int) returns int {
|
||||||
|
* done = false
|
||||||
|
* value = *p // This fetch operation need not be atomic.
|
||||||
|
* while not done {
|
||||||
|
* done = atomic_cas(p, &value, value + a) // *value gets updated automatically until success
|
||||||
|
* }
|
||||||
|
* return value + a
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
bool core_util_atomic_cas_ptr(void **ptr, void **expectedCurrentValue, void *desiredValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic increment.
|
||||||
|
* @param valuePtr Target memory location being incremented.
|
||||||
|
* @param delta The amount being incremented.
|
||||||
|
* @return The new incremented value.
|
||||||
|
*/
|
||||||
|
uint8_t core_util_atomic_incr_u8(uint8_t *valuePtr, uint8_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic increment.
|
||||||
|
* @param valuePtr Target memory location being incremented.
|
||||||
|
* @param delta The amount being incremented.
|
||||||
|
* @return The new incremented value.
|
||||||
|
*/
|
||||||
|
uint16_t core_util_atomic_incr_u16(uint16_t *valuePtr, uint16_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic increment.
|
||||||
|
* @param valuePtr Target memory location being incremented.
|
||||||
|
* @param delta The amount being incremented.
|
||||||
|
* @return The new incremented value.
|
||||||
|
*/
|
||||||
|
uint32_t core_util_atomic_incr_u32(uint32_t *valuePtr, uint32_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic increment.
|
||||||
|
* @param valuePtr Target memory location being incremented.
|
||||||
|
* @param delta The amount being incremented in bytes.
|
||||||
|
* @return The new incremented value.
|
||||||
|
*
|
||||||
|
* @note The type of the pointer argument is not taken into account
|
||||||
|
* and the pointer is incremented by bytes.
|
||||||
|
*/
|
||||||
|
void *core_util_atomic_incr_ptr(void **valuePtr, ptrdiff_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic decrement.
|
||||||
|
* @param valuePtr Target memory location being decremented.
|
||||||
|
* @param delta The amount being decremented.
|
||||||
|
* @return The new decremented value.
|
||||||
|
*/
|
||||||
|
uint8_t core_util_atomic_decr_u8(uint8_t *valuePtr, uint8_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic decrement.
|
||||||
|
* @param valuePtr Target memory location being decremented.
|
||||||
|
* @param delta The amount being decremented.
|
||||||
|
* @return The new decremented value.
|
||||||
|
*/
|
||||||
|
uint16_t core_util_atomic_decr_u16(uint16_t *valuePtr, uint16_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic decrement.
|
||||||
|
* @param valuePtr Target memory location being decremented.
|
||||||
|
* @param delta The amount being decremented.
|
||||||
|
* @return The new decremented value.
|
||||||
|
*/
|
||||||
|
uint32_t core_util_atomic_decr_u32(uint32_t *valuePtr, uint32_t delta);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Atomic decrement.
|
||||||
|
* @param valuePtr Target memory location being decremented.
|
||||||
|
* @param delta The amount being decremented in bytes.
|
||||||
|
* @return The new decremented value.
|
||||||
|
*
|
||||||
|
* @note The type of the pointer argument is not taken into account
|
||||||
|
* and the pointer is decremented by bytes
|
||||||
|
*/
|
||||||
|
void *core_util_atomic_decr_ptr(void **valuePtr, ptrdiff_t delta);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __MBED_UTIL_CRITICAL_H__
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -16,7 +16,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/mbed_error.h"
|
#include "platform/mbed_error.h"
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
#if DEVICE_STDIO_MESSAGES
|
#if DEVICE_STDIO_MESSAGES
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
|
|
||||||
#include "hal/gpio_api.h"
|
#include "hal/gpio_api.h"
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "platform/semihost_api.h"
|
#include "platform/mbed_semihost_api.h"
|
||||||
#include "platform/mbed_error.h"
|
#include "platform/mbed_error.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
#if DEVICE_SEMIHOST
|
#if DEVICE_SEMIHOST
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "platform/mbed_mem_trace.h"
|
#include "platform/mbed_mem_trace.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Internal variables, functions and helpers
|
* Internal variables, functions and helpers
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
#include "drivers/FileSystemLike.h"
|
#include "drivers/FileSystemLike.h"
|
||||||
#include "drivers/FilePath.h"
|
#include "drivers/FilePath.h"
|
||||||
#include "hal/serial_api.h"
|
#include "hal/serial_api.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "platform/semihost_api.h"
|
#include "platform/mbed_semihost_api.h"
|
||||||
#include "platform/mbed_interface.h"
|
#include "platform/mbed_interface.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "platform/PlatformMutex.h"
|
|
@ -16,8 +16,8 @@
|
||||||
#include "hal/rtc_api.h"
|
#include "hal/rtc_api.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include "platform/rtc_time.h"
|
#include "platform/mbed_rtc_time.h"
|
||||||
#include "hal/us_ticker_api.h"
|
#include "hal/us_ticker_api.h"
|
||||||
#include "platform/SingletonPtr.h"
|
#include "platform/SingletonPtr.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "platform/PlatformMutex.h"
|
||||||
|
|
|
@ -0,0 +1,92 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2006-2013 ARM Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Implementation of the C time.h functions
|
||||||
|
*
|
||||||
|
* Provides mechanisms to set and read the current time, based
|
||||||
|
* on the microcontroller Real-Time Clock (RTC), plus some
|
||||||
|
* standard C manipulation and formating functions.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* #include "mbed.h"
|
||||||
|
*
|
||||||
|
* int main() {
|
||||||
|
* set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
|
||||||
|
*
|
||||||
|
* while(1) {
|
||||||
|
* time_t seconds = time(NULL);
|
||||||
|
*
|
||||||
|
* printf("Time as seconds since January 1, 1970 = %d\n", seconds);
|
||||||
|
*
|
||||||
|
* printf("Time as a basic string = %s", ctime(&seconds));
|
||||||
|
*
|
||||||
|
* char buffer[32];
|
||||||
|
* strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
|
||||||
|
* printf("Time as a custom formatted string = %s", buffer);
|
||||||
|
*
|
||||||
|
* wait(1);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Set the current time
|
||||||
|
*
|
||||||
|
* Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
|
||||||
|
* to the time represented by the number of seconds since January 1, 1970
|
||||||
|
* (the UNIX timestamp).
|
||||||
|
*
|
||||||
|
* @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
|
||||||
|
*
|
||||||
|
* @Note Synchronization level: Thread safe
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* #include "mbed.h"
|
||||||
|
*
|
||||||
|
* int main() {
|
||||||
|
* set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
void set_time(time_t t);
|
||||||
|
|
||||||
|
/** Attach an external RTC to be used for the C time functions
|
||||||
|
*
|
||||||
|
* @Note Synchronization level: Thread safe
|
||||||
|
*
|
||||||
|
* @param read_rtc pointer to function which returns current UNIX timestamp
|
||||||
|
* @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
|
||||||
|
* @param init_rtc pointer to funtion which initializes RTC, can be NULL
|
||||||
|
* @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
|
||||||
|
*/
|
||||||
|
void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "platform/semihost_api.h"
|
#include "platform/mbed_semihost_api.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
|
@ -0,0 +1,98 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2006-2013 ARM Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef MBED_SEMIHOST_H
|
||||||
|
#define MBED_SEMIHOST_H
|
||||||
|
|
||||||
|
#include "device.h"
|
||||||
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEVICE_SEMIHOST
|
||||||
|
|
||||||
|
#ifndef __CC_ARM
|
||||||
|
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
static inline int __semihost(int reason, const void *arg) {
|
||||||
|
return __semihosting(reason, (void*)arg);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifdef __thumb__
|
||||||
|
# define AngelSWI 0xAB
|
||||||
|
# define AngelSWIInsn "bkpt"
|
||||||
|
# define AngelSWIAsm bkpt
|
||||||
|
#else
|
||||||
|
# define AngelSWI 0x123456
|
||||||
|
# define AngelSWIInsn "swi"
|
||||||
|
# define AngelSWIAsm swi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static inline int __semihost(int reason, const void *arg) {
|
||||||
|
int value;
|
||||||
|
|
||||||
|
asm volatile (
|
||||||
|
"mov r0, %1" "\n\t"
|
||||||
|
"mov r1, %2" "\n\t"
|
||||||
|
AngelSWIInsn " %a3" "\n\t"
|
||||||
|
"mov %0, r0"
|
||||||
|
: "=r" (value) /* output operands */
|
||||||
|
: "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */
|
||||||
|
: "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */
|
||||||
|
);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if DEVICE_LOCALFILESYSTEM
|
||||||
|
FILEHANDLE semihost_open(const char* name, int openmode);
|
||||||
|
int semihost_close (FILEHANDLE fh);
|
||||||
|
int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
|
||||||
|
int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
|
||||||
|
int semihost_ensure(FILEHANDLE fh);
|
||||||
|
long semihost_flen (FILEHANDLE fh);
|
||||||
|
int semihost_seek (FILEHANDLE fh, long position);
|
||||||
|
int semihost_istty (FILEHANDLE fh);
|
||||||
|
|
||||||
|
int semihost_remove(const char *name);
|
||||||
|
int semihost_rename(const char *old_name, const char *new_name);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int semihost_uid(char *uid);
|
||||||
|
int semihost_reset(void);
|
||||||
|
int semihost_vbus(void);
|
||||||
|
int semihost_powerdown(void);
|
||||||
|
int semihost_exit(void);
|
||||||
|
|
||||||
|
int semihost_connected(void);
|
||||||
|
int semihost_disabledebug(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -0,0 +1,85 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2006-2017 ARM Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef MBED_SLEEP_H
|
||||||
|
#define MBED_SLEEP_H
|
||||||
|
|
||||||
|
#include "sleep_api.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Send the microcontroller to sleep
|
||||||
|
*
|
||||||
|
* @note This function can be a noop if not implemented by the platform.
|
||||||
|
* @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
|
||||||
|
*
|
||||||
|
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
|
||||||
|
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
|
||||||
|
* dynamic power used by the processor, memory systems and buses. The processor, peripheral and
|
||||||
|
* memory state are maintained, and the peripherals continue to work and can generate interrupts.
|
||||||
|
*
|
||||||
|
* The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
||||||
|
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
||||||
|
* able to access the LocalFileSystem
|
||||||
|
*/
|
||||||
|
__INLINE static void sleep(void)
|
||||||
|
{
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#if DEVICE_SLEEP
|
||||||
|
hal_sleep();
|
||||||
|
#endif /* DEVICE_SLEEP */
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Send the microcontroller to deep sleep
|
||||||
|
*
|
||||||
|
* @note This function can be a noop if not implemented by the platform.
|
||||||
|
* @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
|
||||||
|
*
|
||||||
|
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
|
||||||
|
* has the same sleep features as sleep plus it powers down peripherals and clocks. All state
|
||||||
|
* is still maintained.
|
||||||
|
*
|
||||||
|
* The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
||||||
|
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
||||||
|
* able to access the LocalFileSystem
|
||||||
|
*/
|
||||||
|
__INLINE static void deepsleep(void)
|
||||||
|
{
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#if DEVICE_SLEEP
|
||||||
|
hal_deepsleep();
|
||||||
|
#endif /* DEVICE_SLEEP */
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -0,0 +1,305 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2006-2013 ARM Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef MBED_TOOLCHAIN_H
|
||||||
|
#define MBED_TOOLCHAIN_H
|
||||||
|
|
||||||
|
#include "mbed_preprocessor.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Warning for unsupported compilers
|
||||||
|
#if !defined(__GNUC__) /* GCC */ \
|
||||||
|
&& !defined(__CC_ARM) /* ARMCC */ \
|
||||||
|
&& !defined(__clang__) /* LLVM/Clang */ \
|
||||||
|
&& !defined(__ICCARM__) /* IAR */
|
||||||
|
#warning "This compiler is not yet supported."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Attributes
|
||||||
|
|
||||||
|
/** MBED_PACKED
|
||||||
|
* Pack a structure, preventing any padding from being added between fields.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_PACKED(struct) foo {
|
||||||
|
* char x;
|
||||||
|
* int y;
|
||||||
|
* };
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_PACKED
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
#define MBED_PACKED(struct) __packed struct
|
||||||
|
#else
|
||||||
|
#define MBED_PACKED(struct) struct __attribute__((packed))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_ALIGN(N)
|
||||||
|
* Declare a variable to be aligned on an N-byte boundary.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* IAR does not support alignment greater than word size on the stack
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_ALIGN(16) char a;
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_ALIGN
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
#define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N))
|
||||||
|
#else
|
||||||
|
#define MBED_ALIGN(N) __attribute__((aligned(N)))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_UNUSED
|
||||||
|
* Declare a function argument to be unused, suppressing compiler warnings
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* void foo(MBED_UNUSED int arg) {
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_UNUSED
|
||||||
|
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
||||||
|
#define MBED_UNUSED __attribute__((__unused__))
|
||||||
|
#else
|
||||||
|
#define MBED_UNUSED
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_WEAK
|
||||||
|
* Mark a function as being weak.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* weak functions are not friendly to making code re-usable, as they can only
|
||||||
|
* be overridden once (and if they are multiply overridden the linker will emit
|
||||||
|
* no warning). You should not normally use weak symbols as part of the API to
|
||||||
|
* re-usable modules.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_WEAK void foo() {
|
||||||
|
* // a weak implementation of foo that can be overriden by a definition
|
||||||
|
* // without __weak
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_WEAK
|
||||||
|
#if defined(__ICCARM__)
|
||||||
|
#define MBED_WEAK __weak
|
||||||
|
#else
|
||||||
|
#define MBED_WEAK __attribute__((weak))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_PURE
|
||||||
|
* Hint to the compiler that a function depends only on parameters
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_PURE int foo(int arg){
|
||||||
|
* // no access to global variables
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_PURE
|
||||||
|
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
||||||
|
#define MBED_PURE __attribute__((const))
|
||||||
|
#else
|
||||||
|
#define MBED_PURE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_FORCEINLINE
|
||||||
|
* Declare a function that must always be inlined. Failure to inline
|
||||||
|
* such a function will result in an error.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_FORCEINLINE void foo() {
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_FORCEINLINE
|
||||||
|
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
||||||
|
#define MBED_FORCEINLINE static inline __attribute__((always_inline))
|
||||||
|
#elif defined(__ICCARM__)
|
||||||
|
#define MBED_FORCEINLINE _Pragma("inline=forced") static
|
||||||
|
#else
|
||||||
|
#define MBED_FORCEINLINE static inline
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_NORETURN
|
||||||
|
* Declare a function that will never return.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_NORETURN void foo() {
|
||||||
|
* // must never return
|
||||||
|
* while (1) {}
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_NORETURN
|
||||||
|
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
||||||
|
#define MBED_NORETURN __attribute__((noreturn))
|
||||||
|
#elif defined(__ICCARM__)
|
||||||
|
#define MBED_NORETURN __noreturn
|
||||||
|
#else
|
||||||
|
#define MBED_NORETURN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_UNREACHABLE
|
||||||
|
* An unreachable statement. If the statement is reached,
|
||||||
|
* behaviour is undefined. Useful in situations where the compiler
|
||||||
|
* cannot deduce the unreachability of code.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* void foo(int arg) {
|
||||||
|
* switch (arg) {
|
||||||
|
* case 1: return 1;
|
||||||
|
* case 2: return 2;
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* MBED_UNREACHABLE;
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_UNREACHABLE
|
||||||
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
|
||||||
|
#define MBED_UNREACHABLE __builtin_unreachable()
|
||||||
|
#else
|
||||||
|
#define MBED_UNREACHABLE while (1)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_DEPRECATED("message string")
|
||||||
|
* Mark a function declaration as deprecated, if it used then a warning will be
|
||||||
|
* issued by the compiler possibly including the provided message. Note that not
|
||||||
|
* all compilers are able to display the message.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_DEPRECATED("don't foo any more, bar instead")
|
||||||
|
* void foo(int arg);
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#ifndef MBED_DEPRECATED
|
||||||
|
#if defined(__CC_ARM)
|
||||||
|
#define MBED_DEPRECATED(M) __attribute__((deprecated))
|
||||||
|
#elif defined(__GNUC__) || defined(__clang__)
|
||||||
|
#define MBED_DEPRECATED(M) __attribute__((deprecated(M)))
|
||||||
|
#else
|
||||||
|
#define MBED_DEPRECATED(M)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** MBED_DEPRECATED_SINCE("version", "message string")
|
||||||
|
* Mark a function declaration as deprecated, noting that the declaration was
|
||||||
|
* deprecated on the specified version. If the function is used then a warning
|
||||||
|
* will be issued by the compiler possibly including the provided message.
|
||||||
|
* Note that not all compilers are able to display this message.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
|
||||||
|
* void foo(int arg);
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
|
||||||
|
|
||||||
|
/** MBED_CALLER_ADDR()
|
||||||
|
* Returns the caller of the current function.
|
||||||
|
*
|
||||||
|
* @note
|
||||||
|
* This macro is only implemented for GCC and ARMCC.
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* #include "mbed_toolchain.h"
|
||||||
|
*
|
||||||
|
* printf("This function was called from %p", MBED_CALLER_ADDR());
|
||||||
|
* @endcode
|
||||||
|
*
|
||||||
|
* @return Address of the calling function
|
||||||
|
*/
|
||||||
|
#ifndef MBED_CALLER_ADDR
|
||||||
|
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
|
||||||
|
#define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0))
|
||||||
|
#elif defined(__CC_ARM)
|
||||||
|
#define MBED_CALLER_ADDR() __builtin_return_address(0)
|
||||||
|
#else
|
||||||
|
#define MBED_CALLER_ADDR() (NULL)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MBED_SECTION
|
||||||
|
#if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM)
|
||||||
|
#define MBED_SECTION(name) __attribute__ ((section (name)))
|
||||||
|
#elif defined(__ICCARM__)
|
||||||
|
#define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name))
|
||||||
|
#else
|
||||||
|
#error "Missing MBED_SECTION directive"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// FILEHANDLE declaration
|
||||||
|
#if defined(TOOLCHAIN_ARM)
|
||||||
|
#include <rt_sys.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FILEHANDLE
|
||||||
|
typedef int FILEHANDLE;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Backwards compatibility
|
||||||
|
#ifndef WEAK
|
||||||
|
#define WEAK MBED_WEAK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PACKED
|
||||||
|
#define PACKED MBED_PACKED()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef EXTERN
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -0,0 +1,71 @@
|
||||||
|
|
||||||
|
/** \addtogroup platform */
|
||||||
|
/** @{*/
|
||||||
|
/* mbed Microcontroller Library
|
||||||
|
* Copyright (c) 2006-2013 ARM Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
#ifndef MBED_WAIT_API_H
|
||||||
|
#define MBED_WAIT_API_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** Generic wait functions.
|
||||||
|
*
|
||||||
|
* These provide simple NOP type wait capabilities.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* @code
|
||||||
|
* #include "mbed.h"
|
||||||
|
*
|
||||||
|
* DigitalOut heartbeat(LED1);
|
||||||
|
*
|
||||||
|
* int main() {
|
||||||
|
* while (1) {
|
||||||
|
* heartbeat = 1;
|
||||||
|
* wait(0.5);
|
||||||
|
* heartbeat = 0;
|
||||||
|
* wait(0.5);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Waits for a number of seconds, with microsecond resolution (within
|
||||||
|
* the accuracy of single precision floating point).
|
||||||
|
*
|
||||||
|
* @param s number of seconds to wait
|
||||||
|
*/
|
||||||
|
void wait(float s);
|
||||||
|
|
||||||
|
/** Waits a number of milliseconds.
|
||||||
|
*
|
||||||
|
* @param ms the whole number of milliseconds to wait
|
||||||
|
*/
|
||||||
|
void wait_ms(int ms);
|
||||||
|
|
||||||
|
/** Waits a number of microseconds.
|
||||||
|
*
|
||||||
|
* @param us the whole number of microseconds to wait
|
||||||
|
*/
|
||||||
|
void wait_us(int us);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/** @}*/
|
|
@ -18,7 +18,7 @@
|
||||||
// if the RTOS is not present.
|
// if the RTOS is not present.
|
||||||
#ifndef MBED_CONF_RTOS_PRESENT
|
#ifndef MBED_CONF_RTOS_PRESENT
|
||||||
|
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "hal/us_ticker_api.h"
|
#include "hal/us_ticker_api.h"
|
||||||
|
|
||||||
void wait(float s) {
|
void wait(float s) {
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
// if the RTOS is present.
|
// if the RTOS is present.
|
||||||
#ifdef MBED_CONF_RTOS_PRESENT
|
#ifdef MBED_CONF_RTOS_PRESENT
|
||||||
|
|
||||||
#include "platform/wait_api.h"
|
#include "platform/mbed_wait_api.h"
|
||||||
#include "hal/us_ticker_api.h"
|
#include "hal/us_ticker_api.h"
|
||||||
#include "rtos/rtos.h"
|
#include "rtos/rtos.h"
|
||||||
#include "platform/critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
|
|
||||||
void wait(float s) {
|
void wait(float s) {
|
||||||
wait_us(s * 1000000.0f);
|
wait_us(s * 1000000.0f);
|
||||||
|
|
|
@ -1,92 +1,24 @@
|
||||||
|
/*
|
||||||
/** \addtogroup platform */
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
/** @{*/
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
* you may not use this file except in compliance with the License.
|
* not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <time.h>
|
#ifndef MBED_OLD_RTC_TIME_H
|
||||||
|
#define MBED_OLD_RTC_TIME_H
|
||||||
|
|
||||||
|
#warning rtc_time.h has been replaced by mbed_rtc_time.h, please update to mbed_rtc_time.h [since mbed-os-5.3]
|
||||||
|
#include "platform/mbed_rtc_time.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Implementation of the C time.h functions
|
|
||||||
*
|
|
||||||
* Provides mechanisms to set and read the current time, based
|
|
||||||
* on the microcontroller Real-Time Clock (RTC), plus some
|
|
||||||
* standard C manipulation and formating functions.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* @code
|
|
||||||
* #include "mbed.h"
|
|
||||||
*
|
|
||||||
* int main() {
|
|
||||||
* set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
|
|
||||||
*
|
|
||||||
* while(1) {
|
|
||||||
* time_t seconds = time(NULL);
|
|
||||||
*
|
|
||||||
* printf("Time as seconds since January 1, 1970 = %d\n", seconds);
|
|
||||||
*
|
|
||||||
* printf("Time as a basic string = %s", ctime(&seconds));
|
|
||||||
*
|
|
||||||
* char buffer[32];
|
|
||||||
* strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
|
|
||||||
* printf("Time as a custom formatted string = %s", buffer);
|
|
||||||
*
|
|
||||||
* wait(1);
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Set the current time
|
|
||||||
*
|
|
||||||
* Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
|
|
||||||
* to the time represented by the number of seconds since January 1, 1970
|
|
||||||
* (the UNIX timestamp).
|
|
||||||
*
|
|
||||||
* @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
|
|
||||||
*
|
|
||||||
* @Note Synchronization level: Thread safe
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* @code
|
|
||||||
* #include "mbed.h"
|
|
||||||
*
|
|
||||||
* int main() {
|
|
||||||
* set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
void set_time(time_t t);
|
|
||||||
|
|
||||||
/** Attach an external RTC to be used for the C time functions
|
|
||||||
*
|
|
||||||
* @Note Synchronization level: Thread safe
|
|
||||||
*
|
|
||||||
* @param read_rtc pointer to function which returns current UNIX timestamp
|
|
||||||
* @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
|
|
||||||
* @param init_rtc pointer to funtion which initializes RTC, can be NULL
|
|
||||||
* @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
|
|
||||||
*/
|
|
||||||
void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -1,98 +1,24 @@
|
||||||
|
/*
|
||||||
/** \addtogroup platform */
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
/** @{*/
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
* you may not use this file except in compliance with the License.
|
* not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef MBED_SEMIHOST_H
|
|
||||||
#define MBED_SEMIHOST_H
|
|
||||||
|
|
||||||
#include "device.h"
|
#ifndef MBED_OLD_SEMIHOST_API_H
|
||||||
#include "platform/toolchain.h"
|
#define MBED_OLD_SEMIHOST_API_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#warning semihost_api.h has been replaced by mbed_semihost_api.h, please update to mbed_semihost_api.h [since mbed-os-5.3]
|
||||||
extern "C" {
|
#include "platform/mbed_semihost_api.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEVICE_SEMIHOST
|
|
||||||
|
|
||||||
#ifndef __CC_ARM
|
|
||||||
|
|
||||||
#if defined(__ICCARM__)
|
|
||||||
static inline int __semihost(int reason, const void *arg) {
|
|
||||||
return __semihosting(reason, (void*)arg);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifdef __thumb__
|
|
||||||
# define AngelSWI 0xAB
|
|
||||||
# define AngelSWIInsn "bkpt"
|
|
||||||
# define AngelSWIAsm bkpt
|
|
||||||
#else
|
|
||||||
# define AngelSWI 0x123456
|
|
||||||
# define AngelSWIInsn "swi"
|
|
||||||
# define AngelSWIAsm swi
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline int __semihost(int reason, const void *arg) {
|
|
||||||
int value;
|
|
||||||
|
|
||||||
asm volatile (
|
|
||||||
"mov r0, %1" "\n\t"
|
|
||||||
"mov r1, %2" "\n\t"
|
|
||||||
AngelSWIInsn " %a3" "\n\t"
|
|
||||||
"mov %0, r0"
|
|
||||||
: "=r" (value) /* output operands */
|
|
||||||
: "r" (reason), "r" (arg), "i" (AngelSWI) /* input operands */
|
|
||||||
: "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" /* list of clobbered registers */
|
|
||||||
);
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if DEVICE_LOCALFILESYSTEM
|
|
||||||
FILEHANDLE semihost_open(const char* name, int openmode);
|
|
||||||
int semihost_close (FILEHANDLE fh);
|
|
||||||
int semihost_read (FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode);
|
|
||||||
int semihost_write (FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode);
|
|
||||||
int semihost_ensure(FILEHANDLE fh);
|
|
||||||
long semihost_flen (FILEHANDLE fh);
|
|
||||||
int semihost_seek (FILEHANDLE fh, long position);
|
|
||||||
int semihost_istty (FILEHANDLE fh);
|
|
||||||
|
|
||||||
int semihost_remove(const char *name);
|
|
||||||
int semihost_rename(const char *old_name, const char *new_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int semihost_uid(char *uid);
|
|
||||||
int semihost_reset(void);
|
|
||||||
int semihost_vbus(void);
|
|
||||||
int semihost_powerdown(void);
|
|
||||||
int semihost_exit(void);
|
|
||||||
|
|
||||||
int semihost_connected(void);
|
|
||||||
int semihost_disabledebug(void);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -1,85 +1,24 @@
|
||||||
|
/*
|
||||||
/** \addtogroup platform */
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
/** @{*/
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2017 ARM Limited
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
* you may not use this file except in compliance with the License.
|
* not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef MBED_SLEEP_H
|
|
||||||
#define MBED_SLEEP_H
|
|
||||||
|
|
||||||
#include "sleep_api.h"
|
#ifndef MBED_OLD_SLEEP_H
|
||||||
|
#define MBED_OLD_SLEEP_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#warning sleep.h has been replaced by mbed_sleep.h, please update to mbed_sleep.h [since mbed-os-5.3]
|
||||||
extern "C" {
|
#include "platform/mbed_sleep.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Send the microcontroller to sleep
|
|
||||||
*
|
|
||||||
* @note This function can be a noop if not implemented by the platform.
|
|
||||||
* @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
|
|
||||||
*
|
|
||||||
* The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
|
|
||||||
* system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
|
|
||||||
* dynamic power used by the processor, memory systems and buses. The processor, peripheral and
|
|
||||||
* memory state are maintained, and the peripherals continue to work and can generate interrupts.
|
|
||||||
*
|
|
||||||
* The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
|
||||||
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
|
||||||
* able to access the LocalFileSystem
|
|
||||||
*/
|
|
||||||
__INLINE static void sleep(void)
|
|
||||||
{
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#if DEVICE_SLEEP
|
|
||||||
hal_sleep();
|
|
||||||
#endif /* DEVICE_SLEEP */
|
|
||||||
#endif /* NDEBUG */
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Send the microcontroller to deep sleep
|
|
||||||
*
|
|
||||||
* @note This function can be a noop if not implemented by the platform.
|
|
||||||
* @note This function will only put device to sleep in release mode (small profile or when NDEBUG is defined).
|
|
||||||
*
|
|
||||||
* This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
|
|
||||||
* has the same sleep features as sleep plus it powers down peripherals and clocks. All state
|
|
||||||
* is still maintained.
|
|
||||||
*
|
|
||||||
* The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
|
|
||||||
* Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
|
|
||||||
* able to access the LocalFileSystem
|
|
||||||
*/
|
|
||||||
__INLINE static void deepsleep(void)
|
|
||||||
{
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#if DEVICE_SLEEP
|
|
||||||
hal_deepsleep();
|
|
||||||
#endif /* DEVICE_SLEEP */
|
|
||||||
#endif /* NDEBUG */
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -16,290 +16,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef MBED_TOOLCHAIN_H
|
|
||||||
#define MBED_TOOLCHAIN_H
|
|
||||||
|
|
||||||
#include "mbed_preprocessor.h"
|
#ifndef MBED_OLD_TOOLCHAIN_H
|
||||||
|
#define MBED_OLD_TOOLCHAIN_H
|
||||||
|
|
||||||
|
#warning toolchain.h has been replaced by mbed_toolchain.h, please update to mbed_toolchain.h [since mbed-os-5.3]
|
||||||
// Warning for unsupported compilers
|
#include "platform/mbed_toolchain.h"
|
||||||
#if !defined(__GNUC__) /* GCC */ \
|
|
||||||
&& !defined(__CC_ARM) /* ARMCC */ \
|
|
||||||
&& !defined(__clang__) /* LLVM/Clang */ \
|
|
||||||
&& !defined(__ICCARM__) /* IAR */
|
|
||||||
#warning "This compiler is not yet supported."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Attributes
|
|
||||||
|
|
||||||
/** MBED_PACKED
|
|
||||||
* Pack a structure, preventing any padding from being added between fields.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_PACKED(struct) foo {
|
|
||||||
* char x;
|
|
||||||
* int y;
|
|
||||||
* };
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PACKED
|
|
||||||
#if defined(__ICCARM__)
|
|
||||||
#define MBED_PACKED(struct) __packed struct
|
|
||||||
#else
|
|
||||||
#define MBED_PACKED(struct) struct __attribute__((packed))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_ALIGN(N)
|
|
||||||
* Declare a variable to be aligned on an N-byte boundary.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* IAR does not support alignment greater than word size on the stack
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_ALIGN(16) char a;
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_ALIGN
|
|
||||||
#if defined(__ICCARM__)
|
|
||||||
#define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N))
|
|
||||||
#else
|
|
||||||
#define MBED_ALIGN(N) __attribute__((aligned(N)))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_UNUSED
|
|
||||||
* Declare a function argument to be unused, suppressing compiler warnings
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* void foo(MBED_UNUSED int arg) {
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_UNUSED
|
|
||||||
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
|
||||||
#define MBED_UNUSED __attribute__((__unused__))
|
|
||||||
#else
|
|
||||||
#define MBED_UNUSED
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_WEAK
|
|
||||||
* Mark a function as being weak.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* weak functions are not friendly to making code re-usable, as they can only
|
|
||||||
* be overridden once (and if they are multiply overridden the linker will emit
|
|
||||||
* no warning). You should not normally use weak symbols as part of the API to
|
|
||||||
* re-usable modules.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_WEAK void foo() {
|
|
||||||
* // a weak implementation of foo that can be overriden by a definition
|
|
||||||
* // without __weak
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_WEAK
|
|
||||||
#if defined(__ICCARM__)
|
|
||||||
#define MBED_WEAK __weak
|
|
||||||
#else
|
|
||||||
#define MBED_WEAK __attribute__((weak))
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_PURE
|
|
||||||
* Hint to the compiler that a function depends only on parameters
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_PURE int foo(int arg){
|
|
||||||
* // no access to global variables
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_PURE
|
|
||||||
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
|
||||||
#define MBED_PURE __attribute__((const))
|
|
||||||
#else
|
|
||||||
#define MBED_PURE
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_FORCEINLINE
|
|
||||||
* Declare a function that must always be inlined. Failure to inline
|
|
||||||
* such a function will result in an error.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_FORCEINLINE void foo() {
|
|
||||||
*
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_FORCEINLINE
|
|
||||||
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
|
||||||
#define MBED_FORCEINLINE static inline __attribute__((always_inline))
|
|
||||||
#elif defined(__ICCARM__)
|
|
||||||
#define MBED_FORCEINLINE _Pragma("inline=forced") static
|
|
||||||
#else
|
|
||||||
#define MBED_FORCEINLINE static inline
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_NORETURN
|
|
||||||
* Declare a function that will never return.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_NORETURN void foo() {
|
|
||||||
* // must never return
|
|
||||||
* while (1) {}
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_NORETURN
|
|
||||||
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
|
||||||
#define MBED_NORETURN __attribute__((noreturn))
|
|
||||||
#elif defined(__ICCARM__)
|
|
||||||
#define MBED_NORETURN __noreturn
|
|
||||||
#else
|
|
||||||
#define MBED_NORETURN
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_UNREACHABLE
|
|
||||||
* An unreachable statement. If the statement is reached,
|
|
||||||
* behaviour is undefined. Useful in situations where the compiler
|
|
||||||
* cannot deduce the unreachability of code.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* void foo(int arg) {
|
|
||||||
* switch (arg) {
|
|
||||||
* case 1: return 1;
|
|
||||||
* case 2: return 2;
|
|
||||||
* ...
|
|
||||||
* }
|
|
||||||
* MBED_UNREACHABLE;
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_UNREACHABLE
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
|
|
||||||
#define MBED_UNREACHABLE __builtin_unreachable()
|
|
||||||
#else
|
|
||||||
#define MBED_UNREACHABLE while (1)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_DEPRECATED("message string")
|
|
||||||
* Mark a function declaration as deprecated, if it used then a warning will be
|
|
||||||
* issued by the compiler possibly including the provided message. Note that not
|
|
||||||
* all compilers are able to display the message.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_DEPRECATED("don't foo any more, bar instead")
|
|
||||||
* void foo(int arg);
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#ifndef MBED_DEPRECATED
|
|
||||||
#if defined(__CC_ARM)
|
|
||||||
#define MBED_DEPRECATED(M) __attribute__((deprecated))
|
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
|
||||||
#define MBED_DEPRECATED(M) __attribute__((deprecated(M)))
|
|
||||||
#else
|
|
||||||
#define MBED_DEPRECATED(M)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** MBED_DEPRECATED_SINCE("version", "message string")
|
|
||||||
* Mark a function declaration as deprecated, noting that the declaration was
|
|
||||||
* deprecated on the specified version. If the function is used then a warning
|
|
||||||
* will be issued by the compiler possibly including the provided message.
|
|
||||||
* Note that not all compilers are able to display this message.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
|
|
||||||
* void foo(int arg);
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
#define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
|
|
||||||
|
|
||||||
/** MBED_CALLER_ADDR()
|
|
||||||
* Returns the caller of the current function.
|
|
||||||
*
|
|
||||||
* @note
|
|
||||||
* This macro is only implemented for GCC and ARMCC.
|
|
||||||
*
|
|
||||||
* @code
|
|
||||||
* #include "toolchain.h"
|
|
||||||
*
|
|
||||||
* printf("This function was called from %p", MBED_CALLER_ADDR());
|
|
||||||
* @endcode
|
|
||||||
*
|
|
||||||
* @return Address of the calling function
|
|
||||||
*/
|
|
||||||
#ifndef MBED_CALLER_ADDR
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
|
|
||||||
#define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0))
|
|
||||||
#elif defined(__CC_ARM)
|
|
||||||
#define MBED_CALLER_ADDR() __builtin_return_address(0)
|
|
||||||
#else
|
|
||||||
#define MBED_CALLER_ADDR() (NULL)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MBED_SECTION
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM)
|
|
||||||
#define MBED_SECTION(name) __attribute__ ((section (name)))
|
|
||||||
#elif defined(__ICCARM__)
|
|
||||||
#define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name))
|
|
||||||
#else
|
|
||||||
#error "Missing MBED_SECTION directive"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// FILEHANDLE declaration
|
|
||||||
#if defined(TOOLCHAIN_ARM)
|
|
||||||
#include <rt_sys.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef FILEHANDLE
|
|
||||||
typedef int FILEHANDLE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Backwards compatibility
|
|
||||||
#ifndef WEAK
|
|
||||||
#define WEAK MBED_WEAK
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef PACKED
|
|
||||||
#define PACKED MBED_PACKED()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef EXTERN
|
|
||||||
#define EXTERN extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -1,71 +1,24 @@
|
||||||
|
/*
|
||||||
/** \addtogroup platform */
|
* Copyright (c) 2015-2016, ARM Limited, All Rights Reserved
|
||||||
/** @{*/
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
/* mbed Microcontroller Library
|
|
||||||
* Copyright (c) 2006-2013 ARM Limited
|
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
* you may not use this file except in compliance with the License.
|
* not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef MBED_WAIT_API_H
|
|
||||||
#define MBED_WAIT_API_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifndef MBED_OLD_WAIT_API_H
|
||||||
extern "C" {
|
#define MBED_OLD_WAIT_API_H
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Generic wait functions.
|
#warning wait_api.h has been replaced by mbed_wait_api.h, please update to mbed_wait_api.h [since mbed-os-5.3]
|
||||||
*
|
#include "platform/mbed_wait_api.h"
|
||||||
* These provide simple NOP type wait capabilities.
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* @code
|
|
||||||
* #include "mbed.h"
|
|
||||||
*
|
|
||||||
* DigitalOut heartbeat(LED1);
|
|
||||||
*
|
|
||||||
* int main() {
|
|
||||||
* while (1) {
|
|
||||||
* heartbeat = 1;
|
|
||||||
* wait(0.5);
|
|
||||||
* heartbeat = 0;
|
|
||||||
* wait(0.5);
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
|
|
||||||
/** Waits for a number of seconds, with microsecond resolution (within
|
|
||||||
* the accuracy of single precision floating point).
|
|
||||||
*
|
|
||||||
* @param s number of seconds to wait
|
|
||||||
*/
|
|
||||||
void wait(float s);
|
|
||||||
|
|
||||||
/** Waits a number of milliseconds.
|
|
||||||
*
|
|
||||||
* @param ms the whole number of milliseconds to wait
|
|
||||||
*/
|
|
||||||
void wait_ms(int ms);
|
|
||||||
|
|
||||||
/** Waits a number of microseconds.
|
|
||||||
*
|
|
||||||
* @param us the whole number of microseconds to wait
|
|
||||||
*/
|
|
||||||
void wait_us(int us);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** @}*/
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
|
|
||||||
namespace rtos {
|
namespace rtos {
|
||||||
/** \addtogroup rtos */
|
/** \addtogroup rtos */
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "cmsis_os.h"
|
#include "cmsis_os.h"
|
||||||
#include "platform/Callback.h"
|
#include "platform/Callback.h"
|
||||||
#include "platform/toolchain.h"
|
#include "platform/mbed_toolchain.h"
|
||||||
#include "rtos/Semaphore.h"
|
#include "rtos/Semaphore.h"
|
||||||
#include "rtos/Mutex.h"
|
#include "rtos/Mutex.h"
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtos/rtos_idle.h"
|
#include "rtos/rtos_idle.h"
|
||||||
#include "platform/sleep.h"
|
#include "platform/mbed_sleep.h"
|
||||||
|
|
||||||
static void default_idle_hook(void)
|
static void default_idle_hook(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "analogin_api.h"
|
#include "analogin_api.h"
|
||||||
#include "gpio_api.h"
|
#include "gpio_api.h"
|
||||||
#include "spi_api.h"
|
#include "spi_api.h"
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
/* States of a possibly combined I2C transfer */
|
/* States of a possibly combined I2C transfer */
|
||||||
typedef enum i2c_transfer_state_t {
|
typedef enum i2c_transfer_state_t {
|
||||||
I2C_TRANSFER_SINGLE, /* Non combined transfer */
|
I2C_TRANSFER_SINGLE, /* Non combined transfer */
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Driver private data structure that should not be shared by multiple
|
* Driver private data structure that should not be shared by multiple
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
|
|
||||||
// SMSC9220 low-level operations
|
// SMSC9220 low-level operations
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
#include "mps2_ethernet_api.h"
|
#include "mps2_ethernet_api.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
#define TX_PKT_SIZE 256
|
#define TX_PKT_SIZE 256
|
||||||
#define RX_PKT_SIZE 300
|
#define RX_PKT_SIZE 300
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
#include "mps2_ethernet_api.h"
|
#include "mps2_ethernet_api.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
#define TX_PKT_SIZE 256
|
#define TX_PKT_SIZE 256
|
||||||
#define RX_PKT_SIZE 300
|
#define RX_PKT_SIZE 300
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "SMM_MPS2.h"
|
#include "SMM_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "fpga.h"
|
#include "fpga.h"
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
static const PinMap PinMap_SPI_SCLK[] = {
|
static const PinMap PinMap_SPI_SCLK[] = {
|
||||||
{SCLK_SPI , SPI_0, 0},
|
{SCLK_SPI , SPI_0, 0},
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
|
|
||||||
// SMSC9220 low-level operations
|
// SMSC9220 low-level operations
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
#include "mps2_ethernet_api.h"
|
#include "mps2_ethernet_api.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
#define TX_PKT_SIZE 256
|
#define TX_PKT_SIZE 256
|
||||||
#define RX_PKT_SIZE 300
|
#define RX_PKT_SIZE 300
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
#include "mps2_ethernet_api.h"
|
#include "mps2_ethernet_api.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "ETH_MPS2.h"
|
#include "ETH_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
#define TX_PKT_SIZE 256
|
#define TX_PKT_SIZE 256
|
||||||
#define RX_PKT_SIZE 300
|
#define RX_PKT_SIZE 300
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "SMM_MPS2.h"
|
#include "SMM_MPS2.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "fpga.h"
|
#include "fpga.h"
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
|
|
||||||
static const PinMap PinMap_SPI_SCLK[] = {
|
static const PinMap PinMap_SPI_SCLK[] = {
|
||||||
{SCLK_SPI , SPI_0, 0},
|
{SCLK_SPI , SPI_0, 0},
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <compiler.h>
|
#include <compiler.h>
|
||||||
#include "sleep.h"
|
#include "mbed_sleep.h"
|
||||||
|
|
||||||
/* SAM3 and SAM4 series */
|
/* SAM3 and SAM4 series */
|
||||||
#if (SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S || SAM4E || SAM4N || SAM4C || \
|
#if (SAM3S || SAM3N || SAM3XA || SAM3U || SAM4S || SAM4E || SAM4N || SAM4C || \
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
#include "flash_data.h"
|
#include "flash_data.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
// This file is automagically generated
|
// This file is automagically generated
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
#include "flash_api.h"
|
#include "flash_api.h"
|
||||||
#include "flash_data.h"
|
#include "flash_data.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
// This file is automagically generated
|
// This file is automagically generated
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "sleep_api.h"
|
#include "sleep_api.h"
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "mbed_interface.h"
|
#include "mbed_interface.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
MBED_WEAK void hal_sleep(void)
|
MBED_WEAK void hal_sleep(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
#include "PeripheralNames.h"
|
#include "PeripheralNames.h"
|
||||||
#include "nrf_delay.h"
|
#include "nrf_delay.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: The micro-second timer API on the nRF51 platform is implemented using
|
* Note: The micro-second timer API on the nRF51 platform is implemented using
|
||||||
|
|
|
@ -233,7 +233,7 @@ void us_ticker_clear_interrupt(void)
|
||||||
// alternative source of RTOS ticks.
|
// alternative source of RTOS ticks.
|
||||||
#if defined(TARGET_MCU_NRF51822)
|
#if defined(TARGET_MCU_NRF51822)
|
||||||
|
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_RTC_COUNTER_VAL ((1uL << RTC_COUNTER_BITS) - 1)
|
#define MAX_RTC_COUNTER_VAL ((1uL << RTC_COUNTER_BITS) - 1)
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define NU_CAN_DEBUG 0
|
#define NU_CAN_DEBUG 0
|
||||||
#define CAN_NUM 1
|
#define CAN_NUM 1
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define NU_I2C_DEBUG 0
|
#define NU_I2C_DEBUG 0
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "sleep_api.h"
|
#include "sleep_api.h"
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
// lp_ticker tick = us = timestamp
|
// lp_ticker tick = us = timestamp
|
||||||
#define US_PER_TICK (1)
|
#define US_PER_TICK (1)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#if DEVICE_RTC
|
#if DEVICE_RTC
|
||||||
|
|
||||||
#include "wait_api.h"
|
#include "mbed_wait_api.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
// us_ticker tick = us = timestamp
|
// us_ticker tick = us = timestamp
|
||||||
#define US_PER_TICK 1
|
#define US_PER_TICK 1
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define NU_CAN_DEBUG 0
|
#define NU_CAN_DEBUG 0
|
||||||
#define CAN_NUM 2
|
#define CAN_NUM 2
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include "mbedtls/aes.h"
|
#include "mbedtls/aes.h"
|
||||||
|
|
||||||
#include "NUC472_442.h"
|
#include "NUC472_442.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
#include "mbed_assert.h"
|
#include "mbed_assert.h"
|
||||||
|
|
||||||
//static int aes_init_done = 0;
|
//static int aes_init_done = 0;
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#include "des_alt.h"
|
#include "des_alt.h"
|
||||||
#include "crypto-misc.h"
|
#include "crypto-misc.h"
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "toolchain.h"
|
#include "mbed_toolchain.h"
|
||||||
|
|
||||||
// Must be a multiple of 64-bit block size
|
// Must be a multiple of 64-bit block size
|
||||||
#define MAXSIZE_DMABUF (8 * 5)
|
#define MAXSIZE_DMABUF (8 * 5)
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include "nu_modutil.h"
|
#include "nu_modutil.h"
|
||||||
#include "nu_miscutil.h"
|
#include "nu_miscutil.h"
|
||||||
#include "nu_bitutil.h"
|
#include "nu_bitutil.h"
|
||||||
#include "critical.h"
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define NU_I2C_DEBUG 0
|
#define NU_I2C_DEBUG 0
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue