ARM: get rid of mbed-mbed_assert.h.
No functional change, binary size 16 bytes smaller.
This commit is contained in:
parent
4cfeca08e1
commit
848369608b
|
|
@ -28,8 +28,6 @@
|
||||||
#ifndef MBED_GPIO_OBJECT_H
|
#ifndef MBED_GPIO_OBJECT_H
|
||||||
#define MBED_GPIO_OBJECT_H
|
#define MBED_GPIO_OBJECT_H
|
||||||
|
|
||||||
#include "mbed-mbed_assert.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -42,7 +40,6 @@ typedef struct {
|
||||||
} gpio_t;
|
} gpio_t;
|
||||||
|
|
||||||
static inline void gpio_write(gpio_t *obj, int value) {
|
static inline void gpio_write(gpio_t *obj, int value) {
|
||||||
MBED_ASSERT(obj->pin != (PinName)NC);
|
|
||||||
uint32_t pin_number = ((obj->pin & 0x0F00) >> 8);
|
uint32_t pin_number = ((obj->pin & 0x0F00) >> 8);
|
||||||
if (value)
|
if (value)
|
||||||
*obj->reg_write |= (1 << pin_number);
|
*obj->reg_write |= (1 << pin_number);
|
||||||
|
|
@ -51,7 +48,6 @@ static inline void gpio_write(gpio_t *obj, int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int gpio_read(gpio_t *obj) {
|
static inline int gpio_read(gpio_t *obj) {
|
||||||
MBED_ASSERT(obj->pin != (PinName)NC);
|
|
||||||
return ((*obj->reg_mask_read) ? 1 : 0);
|
return ((*obj->reg_mask_read) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,59 +0,0 @@
|
||||||
/* 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.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Notes for Teacup:
|
|
||||||
|
|
||||||
Copied from $(MBED)/libraries/mbed/api/mbed_assert.h.
|
|
||||||
|
|
||||||
Used only to get things running quickly. Without serial it's almost
|
|
||||||
impossible to see wether code changes work. Should go away soon, because
|
|
||||||
all this MBED stuff is too bloated for Teacup's purposes.
|
|
||||||
*/
|
|
||||||
#ifndef MBED_ASSERT_H
|
|
||||||
#define MBED_ASSERT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Internal mbed assert function which is invoked when MBED_ASSERT macro failes.
|
|
||||||
* This function is active only if NDEBUG is not defined prior to including this
|
|
||||||
* assert header file.
|
|
||||||
* In case of MBED_ASSERT failing condition, the assertation message is printed
|
|
||||||
* to stderr and mbed_die() is called.
|
|
||||||
* @param expr Expresion to be checked.
|
|
||||||
* @param file File where assertation failed.
|
|
||||||
* @param line Failing assertation line number.
|
|
||||||
*/
|
|
||||||
void mbed_assert_internal(const char *expr, const char *file, int line);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NDEBUG
|
|
||||||
#define MBED_ASSERT(expr) ((void)0)
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define MBED_ASSERT(expr) \
|
|
||||||
do { \
|
|
||||||
if (!(expr)) { \
|
|
||||||
mbed_assert_internal(#expr, __FILE__, __LINE__); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -28,12 +28,10 @@
|
||||||
AVR builds.
|
AVR builds.
|
||||||
*/
|
*/
|
||||||
#ifdef __ARMEL__
|
#ifdef __ARMEL__
|
||||||
#include "mbed-mbed_assert.h"
|
|
||||||
#include "mbed-pinmap.h"
|
#include "mbed-pinmap.h"
|
||||||
#include "mbed-mbed_error.h"
|
#include "mbed-mbed_error.h"
|
||||||
|
|
||||||
void pin_function(PinName pin, int function) {
|
void pin_function(PinName pin, int function) {
|
||||||
MBED_ASSERT(pin != (PinName)NC);
|
|
||||||
uint32_t offset = (uint32_t)pin & 0xff;
|
uint32_t offset = (uint32_t)pin & 0xff;
|
||||||
__IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
|
__IO uint32_t *reg = (__IO uint32_t*)(LPC_IOCON_BASE + offset);
|
||||||
|
|
||||||
|
|
@ -42,7 +40,6 @@ void pin_function(PinName pin, int function) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void pin_mode(PinName pin, PinMode mode) {
|
void pin_mode(PinName pin, PinMode mode) {
|
||||||
MBED_ASSERT(pin != (PinName)NC);
|
|
||||||
uint32_t offset = (uint32_t)pin & 0xff;
|
uint32_t offset = (uint32_t)pin & 0xff;
|
||||||
uint32_t drain = ((uint32_t)mode & (uint32_t)OpenDrain) >> 2;
|
uint32_t drain = ((uint32_t)mode & (uint32_t)OpenDrain) >> 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@
|
||||||
- Fixed mbed_uart0_irq() function prototype.
|
- Fixed mbed_uart0_irq() function prototype.
|
||||||
*/
|
*/
|
||||||
#ifdef __ARMEL__
|
#ifdef __ARMEL__
|
||||||
#include "mbed-mbed_assert.h"
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -74,7 +73,6 @@ void mbed_serial_init(serial_t *obj, PinName tx, PinName rx) {
|
||||||
UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
|
UARTName uart_tx = (UARTName)pinmap_peripheral(tx, PinMap_UART_TX);
|
||||||
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
UARTName uart_rx = (UARTName)pinmap_peripheral(rx, PinMap_UART_RX);
|
||||||
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
UARTName uart = (UARTName)pinmap_merge(uart_tx, uart_rx);
|
||||||
MBED_ASSERT((int)uart != NC);
|
|
||||||
|
|
||||||
obj->uart = (LPC_UART_TypeDef *)uart;
|
obj->uart = (LPC_UART_TypeDef *)uart;
|
||||||
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
|
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<12);
|
||||||
|
|
@ -202,10 +200,6 @@ void mbed_serial_baud(serial_t *obj, int baudrate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void mbed_serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
|
void mbed_serial_format(serial_t *obj, int data_bits, SerialParity parity, int stop_bits) {
|
||||||
MBED_ASSERT((stop_bits == 1) || (stop_bits == 2)); // 0: 1 stop bits, 1: 2 stop bits
|
|
||||||
MBED_ASSERT((data_bits > 4) && (data_bits < 9)); // 0: 5 data bits ... 3: 8 data bits
|
|
||||||
MBED_ASSERT((parity == ParityNone) || (parity == ParityOdd) || (parity == ParityEven) ||
|
|
||||||
(parity == ParityForced1) || (parity == ParityForced0));
|
|
||||||
|
|
||||||
stop_bits -= 1;
|
stop_bits -= 1;
|
||||||
data_bits -= 5;
|
data_bits -= 5;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue