mbed library sources. Supersedes mbed-src.
Fork of mbed-dev by
platform/mbed_error.h@162:16168a1438f3, 2017-04-08 (annotated)
- Committer:
- funshine
- Date:
- Sat Apr 08 17:03:55 2017 +0000
- Revision:
- 162:16168a1438f3
- Parent:
- 149:156823d33999
add code to handle serial port rx error in uart_irq()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 149:156823d33999 | 1 | |
<> | 149:156823d33999 | 2 | /** \addtogroup platform */ |
<> | 149:156823d33999 | 3 | /** @{*/ |
<> | 149:156823d33999 | 4 | /* mbed Microcontroller Library |
<> | 149:156823d33999 | 5 | * Copyright (c) 2006-2013 ARM Limited |
<> | 149:156823d33999 | 6 | * |
<> | 149:156823d33999 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
<> | 149:156823d33999 | 8 | * you may not use this file except in compliance with the License. |
<> | 149:156823d33999 | 9 | * You may obtain a copy of the License at |
<> | 149:156823d33999 | 10 | * |
<> | 149:156823d33999 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
<> | 149:156823d33999 | 12 | * |
<> | 149:156823d33999 | 13 | * Unless required by applicable law or agreed to in writing, software |
<> | 149:156823d33999 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
<> | 149:156823d33999 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
<> | 149:156823d33999 | 16 | * See the License for the specific language governing permissions and |
<> | 149:156823d33999 | 17 | * limitations under the License. |
<> | 149:156823d33999 | 18 | */ |
<> | 149:156823d33999 | 19 | #ifndef MBED_ERROR_H |
<> | 149:156823d33999 | 20 | #define MBED_ERROR_H |
<> | 149:156823d33999 | 21 | |
<> | 149:156823d33999 | 22 | /** To generate a fatal compile-time error, you can use the pre-processor #error directive. |
<> | 149:156823d33999 | 23 | * |
<> | 149:156823d33999 | 24 | * @code |
<> | 149:156823d33999 | 25 | * #error "That shouldn't have happened!" |
<> | 149:156823d33999 | 26 | * @endcode |
<> | 149:156823d33999 | 27 | * |
<> | 149:156823d33999 | 28 | * If the compiler evaluates this line, it will report the error and stop the compile. |
<> | 149:156823d33999 | 29 | * |
<> | 149:156823d33999 | 30 | * For example, you could use this to check some user-defined compile-time variables: |
<> | 149:156823d33999 | 31 | * |
<> | 149:156823d33999 | 32 | * @code |
<> | 149:156823d33999 | 33 | * #define NUM_PORTS 7 |
<> | 149:156823d33999 | 34 | * #if (NUM_PORTS > 4) |
<> | 149:156823d33999 | 35 | * #error "NUM_PORTS must be less than 4" |
<> | 149:156823d33999 | 36 | * #endif |
<> | 149:156823d33999 | 37 | * @endcode |
<> | 149:156823d33999 | 38 | * |
<> | 149:156823d33999 | 39 | * Reporting Run-Time Errors: |
<> | 149:156823d33999 | 40 | * To generate a fatal run-time error, you can use the mbed error() function. |
<> | 149:156823d33999 | 41 | * |
<> | 149:156823d33999 | 42 | * @code |
<> | 149:156823d33999 | 43 | * error("That shouldn't have happened!"); |
<> | 149:156823d33999 | 44 | * @endcode |
<> | 149:156823d33999 | 45 | * |
<> | 149:156823d33999 | 46 | * If the mbed running the program executes this function, it will print the |
<> | 149:156823d33999 | 47 | * message via the USB serial port, and then die with the blue lights of death! |
<> | 149:156823d33999 | 48 | * |
<> | 149:156823d33999 | 49 | * The message can use printf-style formatting, so you can report variables in the |
<> | 149:156823d33999 | 50 | * message too. For example, you could use this to check a run-time condition: |
<> | 149:156823d33999 | 51 | * |
<> | 149:156823d33999 | 52 | * @code |
<> | 149:156823d33999 | 53 | * if(x >= 5) { |
<> | 149:156823d33999 | 54 | * error("expected x to be less than 5, but got %d", x); |
<> | 149:156823d33999 | 55 | * } |
<> | 149:156823d33999 | 56 | * #endcode |
<> | 149:156823d33999 | 57 | */ |
<> | 149:156823d33999 | 58 | |
<> | 149:156823d33999 | 59 | #ifdef __cplusplus |
<> | 149:156823d33999 | 60 | extern "C" { |
<> | 149:156823d33999 | 61 | #endif |
<> | 149:156823d33999 | 62 | |
<> | 149:156823d33999 | 63 | void error(const char* format, ...); |
<> | 149:156823d33999 | 64 | |
<> | 149:156823d33999 | 65 | #ifdef __cplusplus |
<> | 149:156823d33999 | 66 | } |
<> | 149:156823d33999 | 67 | #endif |
<> | 149:156823d33999 | 68 | |
<> | 149:156823d33999 | 69 | #endif |
<> | 149:156823d33999 | 70 | |
<> | 149:156823d33999 | 71 | /** @}*/ |