fix for mbed lib issue 3 (i2c problem) see also https://mbed.org/users/mbed_official/code/mbed/issues/3 affected implementations: LPC812, LPC11U24, LPC1768, LPC2368, LPC4088

Fork of mbed-src by mbed official

Files at this revision

API Documentation at this revision

Comitter:
emilmont
Date:
Mon Feb 18 11:44:18 2013 +0000
Parent:
1:62685faffa05
Child:
3:c24f5ba8a7f9
Commit message:
Update mbed sources to Rev 59

Changed in this revision

capi/analogin_api.h Show annotated file Show diff for this revision Revisions of this file
capi/analogout_api.h Show annotated file Show diff for this revision Revisions of this file
capi/can_api.h Show annotated file Show diff for this revision Revisions of this file
capi/can_helper.h Show annotated file Show diff for this revision Revisions of this file
capi/error.h Show annotated file Show diff for this revision Revisions of this file
capi/ethernet_api.h Show annotated file Show diff for this revision Revisions of this file
capi/exit.c Show annotated file Show diff for this revision Revisions of this file
capi/gpio_api.h Show annotated file Show diff for this revision Revisions of this file
capi/gpio_irq_api.h Show annotated file Show diff for this revision Revisions of this file
capi/i2c_api.h Show annotated file Show diff for this revision Revisions of this file
capi/mbed_debug.h Show annotated file Show diff for this revision Revisions of this file
capi/mbed_interface.c Show annotated file Show diff for this revision Revisions of this file
capi/mbed_interface.h Show annotated file Show diff for this revision Revisions of this file
capi/pinmap.h Show annotated file Show diff for this revision Revisions of this file
capi/pinmap_common.c Show annotated file Show diff for this revision Revisions of this file
capi/port_api.h Show annotated file Show diff for this revision Revisions of this file
capi/pwmout_api.h Show annotated file Show diff for this revision Revisions of this file
capi/rtc_api.h Show annotated file Show diff for this revision Revisions of this file
capi/rtc_time.c Show annotated file Show diff for this revision Revisions of this file
capi/rtc_time.h Show annotated file Show diff for this revision Revisions of this file
capi/semihost_api.c Show annotated file Show diff for this revision Revisions of this file
capi/semihost_api.h Show annotated file Show diff for this revision Revisions of this file
capi/serial_api.h Show annotated file Show diff for this revision Revisions of this file
capi/sleep_api.h Show annotated file Show diff for this revision Revisions of this file
capi/spi_api.h Show annotated file Show diff for this revision Revisions of this file
capi/toolchain.h Show annotated file Show diff for this revision Revisions of this file
capi/us_ticker_api.h Show annotated file Show diff for this revision Revisions of this file
capi/wait_api.c Show annotated file Show diff for this revision Revisions of this file
capi/wait_api.h Show annotated file Show diff for this revision Revisions of this file
cpp/AnalogIn.h Show annotated file Show diff for this revision Revisions of this file
cpp/AnalogOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/BusIn.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/BusIn.h Show annotated file Show diff for this revision Revisions of this file
cpp/BusInOut.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/BusInOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/BusOut.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/BusOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/CAN.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/CAN.h Show annotated file Show diff for this revision Revisions of this file
cpp/DigitalIn.h Show annotated file Show diff for this revision Revisions of this file
cpp/DigitalInOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/DigitalOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/DirHandle.h Show annotated file Show diff for this revision Revisions of this file
cpp/Ethernet.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Ethernet.h Show annotated file Show diff for this revision Revisions of this file
cpp/FileBase.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/FileBase.h Show annotated file Show diff for this revision Revisions of this file
cpp/FileHandle.h Show annotated file Show diff for this revision Revisions of this file
cpp/FileLike.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/FileLike.h Show annotated file Show diff for this revision Revisions of this file
cpp/FilePath.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/FilePath.h Show annotated file Show diff for this revision Revisions of this file
cpp/FileSystemLike.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/FileSystemLike.h Show annotated file Show diff for this revision Revisions of this file
cpp/FunctionPointer.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/FunctionPointer.h Show annotated file Show diff for this revision Revisions of this file
cpp/I2C.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/I2C.h Show annotated file Show diff for this revision Revisions of this file
cpp/I2CSlave.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/I2CSlave.h Show annotated file Show diff for this revision Revisions of this file
cpp/InterruptIn.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/InterruptIn.h Show annotated file Show diff for this revision Revisions of this file
cpp/LocalFileSystem.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/LocalFileSystem.h Show annotated file Show diff for this revision Revisions of this file
cpp/PortIn.h Show annotated file Show diff for this revision Revisions of this file
cpp/PortInOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/PortOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/PwmOut.h Show annotated file Show diff for this revision Revisions of this file
cpp/SPI.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/SPI.h Show annotated file Show diff for this revision Revisions of this file
cpp/SPISlave.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/SPISlave.h Show annotated file Show diff for this revision Revisions of this file
cpp/Serial.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Serial.h Show annotated file Show diff for this revision Revisions of this file
cpp/Stream.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Stream.h Show annotated file Show diff for this revision Revisions of this file
cpp/Ticker.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Ticker.h Show annotated file Show diff for this revision Revisions of this file
cpp/Timeout.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Timeout.h Show annotated file Show diff for this revision Revisions of this file
cpp/Timer.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/Timer.h Show annotated file Show diff for this revision Revisions of this file
cpp/TimerEvent.cpp Show annotated file Show diff for this revision Revisions of this file
cpp/TimerEvent.h Show annotated file Show diff for this revision Revisions of this file
cpp/mbed.h Show annotated file Show diff for this revision Revisions of this file
cpp/platform.h Show annotated file Show diff for this revision Revisions of this file
cpp/stdio.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/capi/analogin_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/analogin_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ANALOGIN_API_H
 #define MBED_ANALOGIN_API_H
--- a/capi/analogout_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/analogout_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ANALOGOUT_API_H
 #define MBED_ANALOGOUT_API_H
--- a/capi/can_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/can_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_CAN_API_H
 #define MBED_CAN_API_H
@@ -26,7 +20,7 @@
 
 #if DEVICE_CAN
 
-#include "PinNames.h" 
+#include "PinNames.h"
 #include "PeripheralNames.h"
 #include "can_helper.h"
 
--- a/capi/can_helper.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/can_helper.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_CAN_HELPER_H
 #define MBED_CAN_HELPER_H
--- a/capi/error.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/error.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ERROR_H
 #define MBED_ERROR_H
@@ -46,12 +40,12 @@
  * error("That shouldn't have happened!");
  * @endcode
  *
- * If the mbed running the program executes this function, it will print the 
+ * If the mbed running the program executes this function, it will print the
  * message via the USB serial port, and then die with the blue lights of death!
  *
- * The message can use printf-style formatting, so you can report variables in the 
+ * The message can use printf-style formatting, so you can report variables in the
  * message too. For example, you could use this to check a run-time condition:
- * 
+ *
  * @code
  * if(x >= 5) {
  *     error("expected x to be less than 5, but got %d", x);
--- a/capi/ethernet_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/ethernet_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ETHERNET_API_H
 #define MBED_ETHERNET_API_H
--- a/capi/exit.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/exit.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,34 +1,30 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "semihost_api.h"
 #include "mbed_interface.h"
 
 void exit(int return_code) {
+#if DEVICE_SEMIHOST
     if (mbed_interface_connected()) {
         semihost_exit();
     }
+#endif
     if (return_code) {
         mbed_die();
     }
-    
+
     while (1);
 }
--- a/capi/gpio_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/gpio_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_GPIO_API_H
 #define MBED_GPIO_API_H
--- a/capi/gpio_irq_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/gpio_irq_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_GPIO_IRQ_API_H
 #define MBED_GPIO_IRQ_API_H
--- a/capi/i2c_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/i2c_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_I2C_API_H
 #define MBED_I2C_API_H
@@ -36,7 +30,7 @@
 void i2c_frequency    (i2c_t *obj, int hz);
 int  i2c_start        (i2c_t *obj);
 void i2c_stop         (i2c_t *obj);
-int  i2c_read         (i2c_t *obj, int address, char *data, int length, int stop); 
+int  i2c_read         (i2c_t *obj, int address, char *data, int length, int stop);
 int  i2c_write        (i2c_t *obj, int address, const char *data, int length, int stop);
 void i2c_reset        (i2c_t *obj);
 int  i2c_byte_read    (i2c_t *obj, int last);
--- a/capi/mbed_debug.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/mbed_debug.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,72 +1,66 @@
-/* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-#ifndef MBED_DEBUG_H
-#define MBED_DEBUG_H
-#include "device.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef DEVICE_STDIO_MESSAGES
-#include <stdio.h>
-#include <stdarg.h>
-
-/** Output a debug message
- * 
- * @param format printf-style format string, followed by variables
- */
-static inline void debug(const char *format, ...) {
-    va_list args;
-    va_start(args, format);
-    vfprintf(stderr, format, args);
-    va_end(args);
-}
- 
-/** Conditionally output a debug message
- * 
- * NOTE: If the condition is constant false (!= 1) and the compiler optimization
- * level is greater than 0, then the whole function will be compiled away.
- * 
- * @param condition output only if condition is true (== 1)
- * @param format printf-style format string, followed by variables
- */
-static inline void debug_if(int condition, const char *format, ...) {
-    if (condition == 1) {
-        va_list args;
-        va_start(args, format);
-        vfprintf(stderr, format, args);
-        va_end(args);
-    }
-}
-
-#else
-static inline void debug(const char *format, ...) {}
-static inline void debug_if(int condition, const char *format, ...) {}
-
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+/* 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_DEBUG_H
+#define MBED_DEBUG_H
+#include "device.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef DEVICE_STDIO_MESSAGES
+#include <stdio.h>
+#include <stdarg.h>
+
+/** Output a debug message
+ *
+ * @param format printf-style format string, followed by variables
+ */
+static inline void debug(const char *format, ...) {
+    va_list args;
+    va_start(args, format);
+    vfprintf(stderr, format, args);
+    va_end(args);
+}
+
+/** Conditionally output a debug message
+ *
+ * NOTE: If the condition is constant false (!= 1) and the compiler optimization
+ * level is greater than 0, then the whole function will be compiled away.
+ *
+ * @param condition output only if condition is true (== 1)
+ * @param format printf-style format string, followed by variables
+ */
+static inline void debug_if(int condition, const char *format, ...) {
+    if (condition == 1) {
+        va_list args;
+        va_start(args, format);
+        vfprintf(stderr, format, args);
+        va_end(args);
+    }
+}
+
+#else
+static inline void debug(const char *format, ...) {}
+static inline void debug_if(int condition, const char *format, ...) {}
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/capi/mbed_interface.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/mbed_interface.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 <stdio.h>
 #include "mbed_interface.h"
@@ -26,6 +20,9 @@
 #include "wait_api.h"
 #include "semihost_api.h"
 #include "error.h"
+#include "toolchain.h"
+
+#if DEVICE_SEMIHOST
 
 // return true if a debugger is attached, indicating mbed interface is connected
 int mbed_interface_connected(void) {
@@ -34,15 +31,15 @@
 
 int mbed_interface_reset(void) {
     if (mbed_interface_connected()) {
-        semihost_reset(); 
+        semihost_reset();
         return 0;
     } else {
         return -1;
     }
 }
 
-int mbed_interface_uid(char *uid) __attribute__((weak));
-int mbed_interface_uid(char *uid) {
+WEAK int mbed_interface_uid(char *uid);
+WEAK int mbed_interface_uid(char *uid) {
     if (mbed_interface_connected()) {
         return semihost_uid(uid); // Returns 0 if successful, -1 on failure
     } else {
@@ -60,7 +57,6 @@
 }
 
 int mbed_interface_powerdown(void) {
-    mbed_interface_disconnect();
     if (mbed_interface_connected()) {
         return semihost_powerdown();
     } else {
@@ -68,36 +64,44 @@
     }
 }
 
-void mbed_mac_address(char *mac) __attribute__((weak));
-void mbed_mac_address(char *mac) {
-    char uid[33];
-    int i;
-    
-    // if we have a UID, extract the MAC
-    if (mbed_interface_uid(uid) == 0) {
-        char *p = uid + 20;
-        for (i=0; i<6; i++) {
-            int byte;
-            sscanf(p, "%2x", &byte);
-            mac[i] = byte;
-            p += 2;
-        }
-    } else {  // else return a default MAC
-        mac[0] = 0x00;
-        mac[1] = 0x02;
-        mac[2] = 0xF7;
-        mac[3] = 0xF0;
-        mac[4] = 0x00;
-        mac[5] = 0x00;
-    }
-}
-
 // for backward compatibility
 void mbed_reset(void) {
     mbed_interface_reset();
 }
 
-int mbed_uid(char *uid) __attribute__((weak));
-int mbed_uid(char *uid) {
+WEAK int mbed_uid(char *uid);
+WEAK int mbed_uid(char *uid) {
     return mbed_interface_uid(uid);
 }
+#endif
+
+WEAK void mbed_mac_address(char *mac);
+WEAK void mbed_mac_address(char *mac) {
+#if DEVICE_SEMIHOST
+    char uid[DEVICE_ID_LENGTH + 1];
+    int i;
+    
+    // if we have a UID, extract the MAC
+    if (mbed_interface_uid(uid) == 0) {
+        char *p = uid;
+#if defined(DEVICE_MAC_OFFSET)
+        p += DEVICE_MAC_OFFSET;
+#endif
+        for (i=0; i<6; i++) {
+            int byte;
+            sscanf(p, "%2x", &byte);
+            mac[i] = byte;
+            p += 2;
+        }
+    } else {  // else return a default MAC
+#endif
+        mac[0] = 0x00;
+        mac[1] = 0x02;
+        mac[2] = 0xF7;
+        mac[3] = 0xF0;
+        mac[4] = 0x00;
+        mac[5] = 0x00;
+#if DEVICE_SEMIHOST
+    }
+#endif
+}
--- a/capi/mbed_interface.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/mbed_interface.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,41 +1,39 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_INTERFACE_H
 #define MBED_INTERFACE_H
 
+#include "device.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if DEVICE_SEMIHOST
+
 /** Functions to control the mbed interface
  *
- * mbed Microcontrollers have a built-in interface to provide functionality such as 
- * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file 
+ * mbed Microcontrollers have a built-in interface to provide functionality such as
+ * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
  * system. These functions provide means to control the interface suing semihost
  * calls it supports.
  */
 
 /** Determine whether the mbed interface is connected, based on whether debug is enabled
- * 
+ *
  *  @returns
  *    1 if interface is connected,
  *    0 otherwise
@@ -59,9 +57,9 @@
  */
 int mbed_interface_disconnect(void);
 
-/** This will disconnect the debug aspect of the interface, and if the USB cable is not 
+/** This will disconnect the debug aspect of the interface, and if the USB cable is not
  * connected, also power down the interface. If the USB cable is connected, the interface
- * will remain powered up and visible to the host 
+ * will remain powered up and visible to the host
  *
  *  @returns
  *    0 if successful,
@@ -80,6 +78,8 @@
  */
 int mbed_interface_uid(char *uid);
 
+#endif
+
 /** This returns a unique 6-byte MAC address, based on the interface UID
  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
  *
@@ -90,7 +90,7 @@
  */
 void mbed_mac_address(char *mac);
 
-/** Cause the mbed to flash the BLOD LED sequence
+/** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
  */
 void mbed_die(void);
 
--- a/capi/pinmap.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/pinmap.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PINMAP_H
 #define MBED_PINMAP_H
--- a/capi/pinmap_common.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/pinmap_common.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,30 +1,24 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "pinmap.h"
 #include "error.h"
 
 void pinmap_pinout(PinName pin, const PinMap *map) {
     if (pin == NC) return;
-    
+
     while (map->pin != NC) {
         if (map->pin == pin) {
             pin_function(pin, map->function);
@@ -39,11 +33,11 @@
 uint32_t pinmap_merge(uint32_t a, uint32_t b) {
     // both are the same (inc both NC)
     if (a == b) return a;
-    
+
     // one (or both) is not connected
     if (a == (uint32_t)NC) return b;
     if (b == (uint32_t)NC) return a;
-    
+
     // mis-match error case
     error("pinmap mis-match");
     return (uint32_t)NC;
@@ -52,13 +46,13 @@
 uint32_t pinmap_peripheral(PinName pin, const PinMap* map) {
     if (pin == (uint32_t)NC)
         return (uint32_t)NC;
-    
+
     while (map->pin != NC) {
         if (map->pin == pin)
             return map->peripheral;
         map++;
     }
-    
+
     // no mapping available
     error("pinmap not found for peripheral");
     return (uint32_t)NC;
--- a/capi/port_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/port_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PORTMAP_H
 #define MBED_PORTMAP_H
--- a/capi/pwmout_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/pwmout_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PWMOUT_API_H
 #define MBED_PWMOUT_API_H
@@ -28,7 +22,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 typedef struct pwmout_s pwmout_t;
 
--- a/capi/rtc_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/rtc_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_RTC_API_H
 #define MBED_RTC_API_H
@@ -30,7 +24,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 void rtc_init(void);
 void rtc_free(void);
--- a/capi/rtc_time.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/rtc_time.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "rtc_api.h"
 
@@ -25,17 +19,22 @@
 #include "rtc_time.h"
 #include "us_ticker_api.h"
 
-time_t time(time_t *timer) {
+#if defined (__ICCARM__)
+time_t __time32(time_t *timer)
+#else
+time_t time(time_t *timer)
+#endif
+{
 #if DEVICE_RTC
     if (!(rtc_isenabled())) {
         set_time(0);
     }
     time_t t = rtc_read();
-    
+
 #else
     time_t t = 0;
 #endif
-    
+
     if (timer != NULL) {
         *timer = t;
     }
--- a/capi/rtc_time.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/rtc_time.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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>
@@ -29,8 +23,8 @@
 /** 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. 
+ * on the microcontroller Real-Time Clock (RTC), plus some
+ * standard C manipulation and formating functions.
  *
  * Example:
  * @code
@@ -38,18 +32,18 @@
  *
  * int main() {
  *     set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
- *      
- *     while(1) {    
+ *
+ *     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);
  *     }
  * }
@@ -59,10 +53,10 @@
 /** 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) 
+ * 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)
  *
  * Example:
  * @code
@@ -72,7 +66,7 @@
  *     set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
  * }
  * @endcode
- */ 
+ */
 void set_time(time_t t);
 
 #ifdef __cplusplus
--- a/capi/semihost_api.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/semihost_api.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "cmsis.h"
 #include "semihost_api.h"
@@ -25,6 +19,8 @@
 #include <stdint.h>
 #include <string.h>
 
+#if DEVICE_SEMIHOST
+
 // ARM Semihosting Commands
 #define SYS_OPEN   (0x1)
 #define SYS_CLOSE  (0x2)
@@ -39,7 +35,7 @@
 #define SYS_EXIT   (0x18)
 
 // mbed Semihosting Commands
-#define RESERVED_FOR_USER_APPLICATIONS (0x100) // 0x100 - 0x1ff 
+#define RESERVED_FOR_USER_APPLICATIONS (0x100) // 0x100 - 0x1ff
 #define USR_XFFIND      (RESERVED_FOR_USER_APPLICATIONS + 0)
 #define USR_UID      (RESERVED_FOR_USER_APPLICATIONS + 1)
 #define USR_RESET     (RESERVED_FOR_USER_APPLICATIONS + 2)
@@ -61,19 +57,21 @@
 }
 
 int semihost_write(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode) {
+    if (length == 0) return 0;
+
     uint32_t args[3];
     args[0] = (uint32_t)fh;
     args[1] = (uint32_t)buffer;
-    args[2] = (uint32_t)length; 
+    args[2] = (uint32_t)length;
     return __semihost(SYS_WRITE, args);
-} 
+}
 
 int semihost_read(FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode) {
     uint32_t args[3];
     args[0] = (uint32_t)fh;
     args[1] = (uint32_t)buffer;
-    args[2] = (uint32_t)length; 
-    return __semihost(SYS_READ, args); 
+    args[2] = (uint32_t)length;
+    return __semihost(SYS_READ, args);
 }
 
 int semihost_istty(FILEHANDLE fh) {
@@ -91,7 +89,7 @@
     return __semihost(SYS_ENSURE, &fh);
 }
 
-long semihost_flen(FILEHANDLE fh) { 
+long semihost_flen(FILEHANDLE fh) {
     return __semihost(SYS_FLEN, &fh);
 }
 
@@ -120,7 +118,7 @@
 int semihost_uid(char *uid) {
     uint32_t args[2];
     args[0] = (uint32_t)uid;
-    args[1] = 33;
+    args[1] = DEVICE_ID_LENGTH + 1;
     return __semihost(USR_UID, &args);
 }
 
@@ -154,3 +152,5 @@
     return __semihost(USR_DISABLEDEBUG, NULL);
 }
 
+#endif
+
--- a/capi/semihost_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/semihost_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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
@@ -29,47 +23,42 @@
 extern "C" {
 #endif
 
-/* __semihost intrinsic
- This intrinsic inserts an SVC or BKPT instruction into the instruction stream
- generated by the compiler. It enables you to make semihosting calls from C or
- C++ that are independent of the target architecture.
- */
+#if DEVICE_SEMIHOST
+
 #ifndef __CC_ARM
-/* Semihost implementation taken from eLua (MIT license):
- *    git://github.com/elua/elua.git/src/semifs.c
- */
 
-/* SWI numbers for RDI (Angel) monitors */
+#if defined(__ICCARM__)
+inline int __semihost(int reason, const void *arg) {
+    return __semihosting(reason, (void*)arg);
+}
+#else
+
 #ifdef __thumb__
-#define AngelSWI            0xAB
+#   define AngelSWI            0xAB
+#   define AngelSWIInsn        "bkpt"
+#   define AngelSWIAsm          bkpt
 #else
-#define AngelSWI            0x123456
-#endif
-/* For Thumb-2 code use the BKPT instruction instead of SWI */
-#ifdef __thumb2__
-#define AngelSWIInsn        "bkpt"
-#define AngelSWIAsm          bkpt
-#else
-#define AngelSWIInsn        "swi"
-#define AngelSWIAsm          swi
+#   define AngelSWI            0x123456
+#   define AngelSWIInsn        "swi"
+#   define AngelSWIAsm          swi
 #endif
 
 inline int __semihost(int reason, const void *arg) {
     int value;
-    asm volatile ("mov r0, %1; mov r1, %2; " AngelSWIInsn " %a3; mov %0, r0"
-       : "=r" (value) /* Outputs */
-       : "r" (reason), "r" (arg), "i" (AngelSWI) /* Inputs */
-       : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc"
-                /* Clobbers r0 and r1, and lr if in supervisor mode */);
-                /* Accordingly to page 13-77 of ARM DUI 0040D other registers
-                   can also be clobbered.  Some memory positions may also be
-                   changed by a system call, so they should not be kept in
-                   registers. Note: we are assuming the manual is right and
-                   Angel is respecting the APCS.  */
-    
+
+    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
@@ -95,6 +84,8 @@
 int semihost_connected(void);
 int semihost_disabledebug(void);
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
--- a/capi/serial_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/serial_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_SERIAL_API_H
 #define MBED_SERIAL_API_H
@@ -65,7 +59,7 @@
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 
--- a/capi/sleep_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/sleep_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_API_H
 #define MBED_SLEEP_API_H
@@ -31,31 +25,31 @@
 #endif
 
 /** Send the microcontroller to sleep
- * 
+ *
  * 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 
+ * 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. 
+ *  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
  */
 void sleep(void);
 
 /** Send the microcontroller to deep sleep
- * 
+ *
  * 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. 
- * 
+ * 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. 
+ *  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
  */
--- a/capi/spi_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/spi_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_SPI_API_H
 #define MBED_SPI_API_H
@@ -44,7 +38,7 @@
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 
--- a/capi/toolchain.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/toolchain.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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
@@ -30,4 +24,12 @@
 typedef int FILEHANDLE;
 #endif
 
+#if defined (__ICCARM__)
+#   define WEAK     __weak
+#   define PACKED   __packed
+#else
+#   define WEAK     __attribute__((weak))
+#   define PACKED   __attribute__((packed))
 #endif
+
+#endif
--- a/capi/us_ticker_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/us_ticker_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_US_TICKER_API_H
 #define MBED_US_TICKER_API_H
--- a/capi/wait_api.c	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/wait_api.c	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "wait_api.h"
 #include "us_ticker_api.h"
--- a/capi/wait_api.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/capi/wait_api.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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
--- a/cpp/AnalogIn.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/AnalogIn.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ANALOGIN_H
 #define MBED_ANALOGIN_H
@@ -35,11 +29,11 @@
  * Example:
  * @code
  * // Print messages when the AnalogIn is greater than 50%
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * AnalogIn temperature(p20);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(temperature > 0.5) {
@@ -55,13 +49,13 @@
 
     /** Create an AnalogIn, connected to the specified pin
      *
-     * @param pin AnalogIn pin to connect to 
+     * @param pin AnalogIn pin to connect to
      * @param name (optional) A string to identify the object
      */
     AnalogIn(PinName pin) {
         analogin_init(&_adc, pin);
     }
-    
+
     /** Read the input voltage, represented as a float in the range [0.0, 1.0]
      *
      * @returns A floating-point value representing the current input voltage, measured as a percentage
@@ -73,7 +67,7 @@
     /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      * @returns
-     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value 
+     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value
      */
     unsigned short read_u16() {
         return analogin_read_u16(&_adc);
@@ -88,7 +82,7 @@
      * @code
      * float x = volume.read();
      * float x = volume;
-     * 
+     *
      * if(volume.read() > 0.25) { ... }
      * if(volume > 0.25) { ... }
      * @endcode
--- a/cpp/AnalogOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/AnalogOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ANALOGOUT_H
 #define MBED_ANALOGOUT_H
@@ -35,9 +29,9 @@
  * Example:
  * @code
  * // Make a sawtooth output
- *  
+ *
  * #include "mbed.h"
- *  
+ *
  * AnalogOut tri(p18);
  * int main() {
  *     while(1) {
@@ -55,16 +49,16 @@
 public:
 
     /** Create an AnalogOut connected to the specified pin
-     * 
+     *
      *  @param AnalogOut pin to connect to (18)
      */
     AnalogOut(PinName pin) {
         analogout_init(&_dac, pin);
     }
-    
+
     /** Set the output voltage, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output voltage, 
+     *  @param value A floating-point value representing the output voltage,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
@@ -72,7 +66,7 @@
     void write(float value) {
         analogout_write(&_dac, value);
     }
-    
+
     /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      *  @param value 16-bit unsigned short representing the output voltage,
@@ -85,7 +79,7 @@
     /** Return the current output voltage setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current voltage being output on the pin, 
+     *    A floating-point value representing the current voltage being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *
@@ -103,7 +97,7 @@
         write(percent);
         return *this;
     }
-    
+
     AnalogOut& operator= (AnalogOut& rhs) {
         write(rhs.read());
         return *this;
--- a/cpp/BusIn.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusIn.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "BusIn.h"
 
@@ -25,13 +19,13 @@
 
 BusIn::BusIn(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
     PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};
-    
+
     for (int i=0; i<16; i++) {
         _pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0;
     }
 }
 
-BusIn::BusIn(PinName pins[16]) { 
+BusIn::BusIn(PinName pins[16]) {
     for (int i=0; i<16; i++) {
         _pin[i] = (pins[i] != NC) ? new DigitalIn(pins[i]) : 0;
     }
--- a/cpp/BusIn.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusIn.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_BUSIN_H
 #define MBED_BUSIN_H
@@ -41,16 +35,16 @@
      * @note
      *  It is only required to specify as many pin variables as is required
      *  for the bus; the rest will default to NC (not connected)
-     */ 
+     */
     BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
           PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
           PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
           PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
 
     BusIn(PinName pins[16]);
-    
+
     virtual ~BusIn();
-    
+
     /** Read the value of the input bus
      *
      *  @returns
--- a/cpp/BusInOut.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusInOut.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "BusInOut.h"
 
@@ -25,7 +19,7 @@
 
 BusInOut::BusInOut(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
     PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};
-    
+
     for (int i=0; i<16; i++) {
         _pin[i] = (pins[i] != NC) ? new DigitalInOut(pins[i]) : 0;
     }
--- a/cpp/BusInOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusInOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_BUSINOUT_H
 #define MBED_BUSINOUT_H
@@ -31,7 +25,7 @@
 class BusInOut {
 
 public:
-    
+
     /** Create an BusInOut, connected to the specified pins
      *
      *  @param p<n> DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
@@ -57,7 +51,7 @@
      */
     void write(int value);
 
-        
+
     /** Read the value currently output on the bus
      *
      *  @returns
@@ -78,7 +72,7 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
- 
+
 #ifdef MBED_OPERATORS
      /** A shorthand for write()
      */
--- a/cpp/BusOut.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusOut.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "BusOut.h"
 
@@ -25,7 +19,7 @@
 
 BusOut::BusOut(PinName p0, PinName p1, PinName p2, PinName p3, PinName p4, PinName p5, PinName p6, PinName p7, PinName p8, PinName p9, PinName p10, PinName p11, PinName p12, PinName p13, PinName p14, PinName p15) {
     PinName pins[16] = {p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15};
-    
+
     for (int i=0; i<16; i++) {
         _pin[i] = (pins[i] != NC) ? new DigitalOut(pins[i]) : 0;
     }
--- a/cpp/BusOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/BusOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_BUSOUT_H
 #define MBED_BUSOUT_H
--- a/cpp/CAN.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/CAN.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "CAN.h"
 
@@ -34,7 +28,7 @@
 CAN::~CAN() {
     can_free(&_can);
 }
-  
+
 int CAN::frequency(int f) {
     return can_frequency(&_can, f);
 }
@@ -42,7 +36,7 @@
 int CAN::write(CANMessage msg) {
     return can_write(&_can, msg, 0);
 }
-    
+
 int CAN::read(CANMessage &msg) {
     return can_read(&_can, &msg);
 }
@@ -69,15 +63,15 @@
 // Control Register, or the mbed hangs
 void can_irq(void) {
     uint32_t icr;
-    
+
     if(LPC_SC->PCONP & (1 << 13)) {
         icr = LPC_CAN1->ICR;
-        
+
         if(icr && (can_obj[0] != NULL)) {
             can_obj[0]->call();
         }
     }
-    
+
     if(LPC_SC->PCONP & (1 << 14)) {
         icr = LPC_CAN2->ICR;
         if(icr && (can_obj[1] != NULL)) {
@@ -104,7 +98,7 @@
         case CAN_1: can_obj[0] = NULL; break;
         case CAN_2: can_obj[1] = NULL; break;
     }
-    
+
     _can.dev->IER &= ~(1);
     if ((can_obj[0] == NULL) && (can_obj[1] == NULL)) {
         NVIC_DisableIRQ(CAN_IRQn);
--- a/cpp/CAN.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/CAN.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_CAN_H
 #define MBED_CAN_H
@@ -27,7 +21,7 @@
 #if DEVICE_CAN
 
 #include "can_api.h"
-#include "can_helper.h" 
+#include "can_helper.h"
 #include "FunctionPointer.h"
 
 namespace mbed {
@@ -46,7 +40,7 @@
         id     = 0;
         memset(data, 0, 8);
     }
-    
+
     /** Creates CAN message with specific content.
      */
     CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) {
@@ -81,23 +75,23 @@
      * Example:
      * @code
      * #include "mbed.h"
-     *  
+     *
      * Ticker ticker;
      * DigitalOut led1(LED1);
      * DigitalOut led2(LED2);
      * CAN can1(p9, p10);
      * CAN can2(p30, p29);
-     *  
+     *
      * char counter = 0;
-     *  
+     *
      * void send() {
      *     if(can1.write(CANMessage(1337, &counter, 1))) {
      *         printf("Message sent: %d\n", counter);
      *         counter++;
-     *     } 
+     *     }
      *     led1 = !led1;
      * }
-     *  
+     *
      * int main() {
      *     ticker.attach(&send, 1);
      *    CANMessage msg;
@@ -105,15 +99,15 @@
      *         if(can2.read(msg)) {
      *             printf("Message received: %d\n\n", msg.data[0]);
      *             led2 = !led2;
-     *         } 
+     *         }
      *         wait(0.2);
      *     }
-     * } 
+     * }
      * @endcode
      */
     CAN(PinName rd, PinName td);
     virtual ~CAN();
-    
+
     /** Set the frequency of the CAN interface
      *
      *  @param hz The bus frequency in hertz
@@ -123,7 +117,7 @@
      *    0 otherwise
      */
     int frequency(int hz);
-    
+
     /** Write a CANMessage to the bus.
      *
      *  @param msg The CANMessage to write.
@@ -133,9 +127,9 @@
      *    1 if write was successful
      */
     int write(CANMessage msg);
-    
+
     /** Read a CANMessage from the bus.
-     * 
+     *
      *  @param msg A CANMessage to read to.
      *
      *  @returns
@@ -143,19 +137,19 @@
      *    1 if message arrived
      */
     int read(CANMessage &msg);
-    
+
     /** Reset CAN interface.
      *
      * To use after error overflow.
      */
     void reset();
-    
+
     /** Puts or removes the CAN interface into silent monitoring mode
      *
      *  @param silent boolean indicating whether to go into silent mode or not
      */
     void monitor(bool silent);
-    
+
     /** Returns number of read errors to detect read overflow errors.
      */
     unsigned char rderror();
@@ -170,7 +164,7 @@
      *  @param fptr A pointer to a void function, or 0 to set as none
      */
     void attach(void (*fptr)(void));
-   
+
    /** Attach a member function to call whenever a CAN frame received interrupt
     *  is generated.
     *
@@ -186,11 +180,11 @@
             remove_interrupt();
         }
     }
-    
+
 private:
     can_t _can;
     FunctionPointer _rxirq;
-    
+
     void setup_interrupt(void);
     void remove_interrupt(void);
 };
--- a/cpp/DigitalIn.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/DigitalIn.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_DIGITALIN_H
 #define MBED_DIGITALIN_H
@@ -33,12 +27,12 @@
  * Example:
  * @code
  * // Flash an LED while a DigitalIn is true
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * DigitalIn enable(p5);
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(enable) {
@@ -60,17 +54,17 @@
     DigitalIn(PinName pin) {
         gpio_init(&gpio, pin, PIN_INPUT);
     }
-    
+
     /** Read the input, represented as 0 or 1 (int)
      *
      *  @returns
-     *    An integer representing the state of the input pin, 
+     *    An integer representing the state of the input pin,
      *    0 for logical 0, 1 for logical 1
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -78,7 +72,7 @@
     void mode(PinMode pull) {
         gpio_mode(&gpio, pull);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** An operator shorthand for read()
      */
--- a/cpp/DigitalInOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/DigitalInOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_DIGITALINOUT_H
 #define MBED_DIGITALINOUT_H
@@ -40,38 +34,38 @@
     DigitalInOut(PinName pin) {
         gpio_init(&gpio, pin, PIN_INPUT);
     }
-    
+
     /** Set the output, specified as 0 or 1 (int)
      *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
     void write(int value) {
         gpio_write(&gpio, value);
     }
-    
+
     /** Return the output setting, represented as 0 or 1 (int)
      *
      *  @returns
-     *    an integer representing the output setting of the pin if it is an output, 
+     *    an integer representing the output setting of the pin if it is an output,
      *    or read the input if set as an input
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
     /** Set as an output
      */
     void output() {
         gpio_dir(&gpio, PIN_OUTPUT);
     }
-    
+
     /** Set as an input
      */
     void input() {
         gpio_dir(&gpio, PIN_INPUT);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -79,7 +73,7 @@
     void mode(PinMode pull) {
         gpio_mode(&gpio, pull);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** A shorthand for write()
      */
@@ -87,12 +81,12 @@
         write(value);
         return *this;
     }
-    
+
     DigitalInOut& operator= (DigitalInOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
     operator int() {
--- a/cpp/DigitalOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/DigitalOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_DIGITALOUT_H
 #define MBED_DIGITALOUT_H
@@ -33,9 +27,9 @@
  * @code
  * // Toggle a LED
  * #include "mbed.h"
- * 
+ *
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = !led;
@@ -54,26 +48,26 @@
     DigitalOut(PinName pin) {
         gpio_init(&gpio, pin, PIN_OUTPUT);
     }
-    
+
     /** Set the output, specified as 0 or 1 (int)
      *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
     void write(int value) {
         gpio_write(&gpio, value);
     }
-    
+
     /** Return the output setting, represented as 0 or 1 (int)
      *
      *  @returns
-     *    an integer representing the output setting of the pin, 
+     *    an integer representing the output setting of the pin,
      *    0 for logical 0, 1 for logical 1
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** A shorthand for write()
      */
@@ -81,12 +75,12 @@
         write(value);
         return *this;
     }
-    
+
     DigitalOut& operator= (DigitalOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
     operator int() {
@@ -100,4 +94,4 @@
 
 } // namespace mbed
 
-#endif 
+#endif
--- a/cpp/DirHandle.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/DirHandle.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,33 +1,29 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_DIRHANDLE_H
 #define MBED_DIRHANDLE_H
 
-#ifdef __ARMCC_VERSION
-# define NAME_MAX 255
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
+#   define NAME_MAX 255
 typedef int mode_t;
+
 #else
-# include <sys/syslimits.h>
+#   include <sys/syslimits.h>
 #endif
+
 #include "FileHandle.h"
 
 struct dirent {
@@ -41,7 +37,7 @@
  *  at least closedir, readdir and rewinddir.
  *
  *  If a FileSystemLike class defines the opendir method, then the
- *  directories of an object of that type can be accessed by 
+ *  directories of an object of that type can be accessed by
  *  DIR *d = opendir("/example/directory") (or opendir("/example")
  *  to open the root of the filesystem), and then using readdir(d) etc.
  *
@@ -59,7 +55,7 @@
      *   -1 on error.
      */
     virtual int closedir()=0;
-    
+
     /** Return the directory entry at the current position, and
      *  advances the position to the next entry.
      *
@@ -87,7 +83,7 @@
      *  @param location The location to seek to. Must be a value returned by telldir.
      */
     virtual void seekdir(off_t location) { }
-    
+
     virtual ~DirHandle() {}
 };
 
--- a/cpp/Ethernet.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Ethernet.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "Ethernet.h"
 
--- a/cpp/Ethernet.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Ethernet.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_ETHERNET_H
 #define MBED_ETHERNET_H
@@ -33,14 +27,14 @@
  * Example:
  * @code
  * // Read destination and source from every ethernet packet
- * 
+ *
  * #include "mbed.h"
  *
  * Ethernet eth;
- *  
+ *
  * int main() {
  *     char buf[0x600];
- *     
+ *
  *     while(1) {
  *         int size = eth.receive();
  *         if(size > 0) {
@@ -50,7 +44,7 @@
  *             printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
  *                     buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
  *         }
- *         
+ *
  *         wait(1);
  *     }
  * }
@@ -59,7 +53,7 @@
 class Ethernet {
 
 public:
-    
+
     /** Initialise the ethernet interface.
      */
     Ethernet();
@@ -79,7 +73,7 @@
     /** Writes into an outgoing ethernet packet.
      *
      *  It will append size bytes of data to the previously written bytes.
-     *  
+     *
      *  @param data An array to write.
      *  @param size The size of data.
      *
@@ -101,7 +95,7 @@
 
     /** Recevies an arrived ethernet packet.
      *
-     *  Receiving an ethernet packet will drop the last received ethernet packet 
+     *  Receiving an ethernet packet will drop the last received ethernet packet
      *  and make a new ethernet packet ready to read.
      *  If no ethernet packet is arrived it will return 0.
      *
@@ -117,14 +111,14 @@
      *  possible to read bytes from this packet.
      *  Read will write up to size bytes into data.
      *
-     *  It is possible to use read multible times. 
+     *  It is possible to use read multible times.
      *  Each time read will start reading after the last read byte before.
      *
      *  @returns
      *  The number of byte read.
      */
     int read(char *data, int size);
-    
+
     /** Gives the ethernet address of the mbed.
      *
      *  @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
@@ -132,7 +126,7 @@
     void address(char *mac);
 
     /** Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up.
-     * 
+     *
      *  @returns
      *   0 if no ethernet link is pressent,
      *   1 if an ethernet link is pressent.
@@ -141,7 +135,7 @@
      * @code
      * // Using the Ethernet link function
      * #include "mbed.h"
-     * 
+     *
      * Ethernet eth;
      *
      * int main() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FileBase.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,83 @@
+/* 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 "FileBase.h"
+
+namespace mbed {
+
+FileBase *FileBase::_head = NULL;
+
+FileBase::FileBase(const char *name, PathType t) {
+    _name = name;
+    _path_type = t;
+
+    if (name != NULL) {
+        // put this object at head of the list
+        _next = _head;
+        _head = this;
+    } else {
+        _next = NULL;
+    }
+}
+
+FileBase::~FileBase() {
+    if (_name != NULL) {
+        // remove this object from the list
+        if (_head == this) { // first in the list, so just drop me
+            _head = _next;
+        } else {             // find the object before me, then drop me
+            FileBase *p = _head;
+            while (p->_next != this) {
+                p = p->_next;
+            }
+            p->_next = _next;
+        }
+    }
+}
+
+FileBase *FileBase::lookup(const char *name, unsigned int len) {
+    FileBase *p = _head;
+    while (p != NULL) {
+        /* Check that p->_name matches name and is the correct length */
+        if (p->_name != NULL && std::strncmp(p->_name, name, len) == 0 && std::strlen(p->_name) == len) {
+            return p;
+        }
+        p = p->_next;
+    }
+    return NULL;
+}
+
+FileBase *FileBase::get(int n) {
+    FileBase *p = _head;
+    int m = 0;
+    while (p != NULL) {
+        if (m == n) return p;
+
+        m++;
+        p = p->_next;
+    }
+    return NULL;
+}
+
+const char* FileBase::getName(void) {
+    return _name;
+}
+
+PathType FileBase::getPathType(void) {
+    return _path_type;
+}
+
+} // namespace mbed
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FileBase.h	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,75 @@
+/* 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_FILEBASE_H
+#define MBED_FILEBASE_H
+
+typedef int FILEHANDLE;
+
+#include <stdio.h>
+
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
+#    define O_RDONLY 0
+#    define O_WRONLY 1
+#    define O_RDWR   2
+#    define O_CREAT  0x0200
+#    define O_TRUNC  0x0400
+#    define O_APPEND 0x0008
+
+#    define NAME_MAX 255
+
+typedef int mode_t;
+typedef int ssize_t;
+typedef long off_t;
+
+#else
+#    include <sys/fcntl.h>
+#    include <sys/types.h>
+#    include <sys/syslimits.h>
+#endif
+
+#include "platform.h"
+
+namespace mbed {
+
+typedef enum {
+    FilePathType,
+    FileSystemPathType
+} PathType;
+
+class FileBase {
+public:
+    FileBase(const char *name, PathType t);
+
+    virtual ~FileBase();
+
+    const char* getName(void);
+    PathType    getPathType(void);
+
+    static FileBase *lookup(const char *name, unsigned int len);
+
+    static FileBase *get(int n);
+
+protected:
+    static FileBase *_head;
+
+    FileBase   *_next;
+    const char *_name;
+    PathType    _path_type;
+};
+
+} // namespace mbed
+
+#endif
--- a/cpp/FileHandle.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/FileHandle.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_FILEHANDLE_H
 #define MBED_FILEHANDLE_H
@@ -25,14 +19,16 @@
 typedef int FILEHANDLE;
 
 #include <stdio.h>
-#ifdef __ARMCC_VERSION
+
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
 typedef int ssize_t;
 typedef long off_t;
+
 #else
-#include <sys/types.h>
+#   include <sys/types.h>
 #endif
 
-namespace mbed { 
+namespace mbed {
 
 /** An OO equivalent of the internal FILEHANDLE variable
  *  and associated _sys_* functions.
@@ -40,7 +36,7 @@
  * FileHandle is an abstract class, needing at least sys_write and
  *  sys_read to be implmented for a simple interactive device.
  *
- * No one ever directly tals to/instanciates a FileHandle - it gets 
+ * No one ever directly tals to/instanciates a FileHandle - it gets
  *  created by FileSystem, and wrapped up by stdio.
  */
 class FileHandle {
@@ -114,7 +110,7 @@
         lseek(pos, SEEK_SET);
         return res;
     }
-    
+
     virtual ~FileHandle();
 };
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FileLike.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,28 @@
+/* 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 "FileLike.h"
+
+namespace mbed {
+
+FileLike::FileLike(const char *name) : FileHandle(), FileBase(name, FilePathType) {
+
+}
+
+FileLike::~FileLike() {
+
+}
+
+} // namespace mbed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FileLike.h	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,44 @@
+/* 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_FILELIKE_H
+#define MBED_FILELIKE_H
+
+#include "FileBase.h"
+#include "FileHandle.h"
+
+namespace mbed {
+
+/* Class FileLike
+ *  A file-like object is one that can be opened with fopen by
+ *  fopen("/name", mode). It is intersection of the classes Base and
+ *  FileHandle.
+ */
+class FileLike : public FileHandle, public FileBase {
+
+public:
+    /* Constructor FileLike
+     *
+     * Variables
+     *  name - The name to use to open the file.
+     */
+    FileLike(const char *name);
+
+    virtual ~FileLike();
+};
+
+} // namespace mbed
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FilePath.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,71 @@
+/* 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 "FilePath.h"
+
+namespace mbed {
+
+FilePath::FilePath(const char* file_path) : file_name(NULL), fb(NULL) {
+    if ((file_path[0] != '/') || (file_path[1] == 0)) return;
+
+    const char* file_system = &file_path[1];
+    file_name = file_system;
+    int len = 0;
+    while (true) {
+        char c = *file_name;
+        if (c == '/') { // end of object name
+            file_name++; // point to one char after the '/'
+            break;
+        }
+        if (c == 0) { // end of object name, with no filename
+            break;
+        }
+        len++;
+        file_name++;
+    }
+
+    FileBase::lookup(file_system, len);
+
+
+    fb = FileBase::lookup(file_system, len);
+}
+
+const char* FilePath::fileName(void) {
+    return file_name;
+}
+
+bool FilePath::isFileSystem(void) {
+    return (fb->getPathType() == FileSystemPathType);
+}
+
+FileSystemLike* FilePath::fileSystem(void) {
+    if (isFileSystem()) {
+        return (FileSystemLike*)fb;
+    }
+    return NULL;
+}
+
+bool FilePath::isFile(void) {
+    return (fb->getPathType() == FilePathType);
+}
+
+FileLike* FilePath::file(void) {
+    if (isFile()) {
+        return (FileLike*)fb;
+    }
+    return NULL;
+}
+
+} // namespace mbed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/FilePath.h	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,45 @@
+/* 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_FILEPATH_H
+#define MBED_FILEPATH_H
+
+#include "platform.h"
+
+#include "FileSystemLike.h"
+#include "FileLike.h"
+
+namespace mbed {
+
+class FilePath {
+public:
+    FilePath(const char* file_path);
+
+    const char* fileName(void);
+
+    bool          isFileSystem(void);
+    FileSystemLike* fileSystem(void);
+
+    bool    isFile(void);
+    FileLike* file(void);
+
+private:
+    const char* file_name;
+    FileBase* fb;
+};
+
+} // namespace mbed
+
+#endif
--- a/cpp/FileSystemLike.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/FileSystemLike.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,67 +1,22 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "FileSystemLike.h"
 
 namespace mbed {
 
-FileSystemLike::FileSystemLike(const char *name) {
-    _name = name;
-    
-    if (name != NULL) {
-        // put this object at head of the list
-        _next = _head;
-        _head = this;
-    } else {
-        _next = NULL;
-    }
-}
-
-FileSystemLike::~FileSystemLike() {
-    if (_name != NULL) {
-        // remove this object from the list
-        if (_head == this) { // first in the list, so just drop me
-            _head = _next;
-        } else {             // find the object before me, then drop me
-            FileSystemLike* p = _head;
-            while (p->_next != this) {
-                p = p->_next;
-            }
-            p->_next = _next;
-        }
-    }
-}
-
-FileSystemLike *FileSystemLike::lookup(const char *name, unsigned int len) {
-    FileSystemLike *p = _head;
-    while (p != NULL) {
-        /* Check that p->_name matches name and is the correct length */
-        if (p->_name != NULL && std::strncmp(p->_name, name, len) == 0 && std::strlen(p->_name) == len) {
-            return p;
-        }
-        p = p->_next;
-    }
-    return NULL;
-}
-
 class BaseDirHandle : public DirHandle {
 public:
     /*
@@ -73,85 +28,51 @@
     */
     off_t n;
     struct dirent cur_entry;
-    
+
     BaseDirHandle() {
         n = 0;
     }
-    
+
     virtual int closedir() {
         delete this;
         return 0;
     }
-    
+
     virtual struct dirent *readdir() {
-        FileSystemLike *ptr = FileSystemLike::_head;
-        /* Find the n'th FileLike or FileSystemLike object in the Base list */
-        int m = 0;
-        while (1) {
-            if (ptr == NULL) {
-                /* No such object */
-                return NULL;
-            }
-            if (m == n) break;
-            
-            m++;
-            ptr = ptr->_next;
-        }
+        FileBase *ptr = FileBase::get(n);
+        if (ptr == NULL) return NULL;
+
         /* Increment n, so next readdir gets the next item */
         n++;
-        /* Setup curentry and return a pointer to it */
-        std::strncpy(cur_entry.d_name, ptr->_name, NAME_MAX);
+
+        /* Setup cur entry and return a pointer to it */
+        std::strncpy(cur_entry.d_name, ptr->getName(), NAME_MAX);
         return &cur_entry;
     }
-    
+
     virtual off_t telldir() {
         return n;
     }
-    
-    virtual void seekdir(off_t offset) { 
+
+    virtual void seekdir(off_t offset) {
         n = offset;
     }
-    
+
     virtual void rewinddir() {
         n = 0;
     }
 };
 
+FileSystemLike::FileSystemLike(const char *name) : FileBase(name, FileSystemPathType) {
+
+}
+
+FileSystemLike::~FileSystemLike() {
+
+}
+
 DirHandle *FileSystemLike::opendir() {
     return new BaseDirHandle();
 }
 
-FileSystemLike *FileSystemLike::_head = NULL;
-
-
-FilePath::FilePath(const char* file_path) : file_name(NULL), fs(NULL) {
-    if ((file_path[0] != '/') || (file_path[1] == 0)) return;
-    
-    const char* file_system = &file_path[1];
-    file_name = file_system;
-    int len = 0;
-    while (true) {
-        char c = *file_name;
-        if (c == '/') { // end of object name
-            file_name++; // point to one char after the '/'
-            break;
-        }
-        if (c == 0) { // end of object name, with no filename
-            break;
-        }
-        len++;
-        file_name++;
-    }
-    
-    fs = FileSystemLike::lookup(file_system, len);
-}
-
-const char* FilePath::fileName(void) {
-    return file_name;
-}
-
-FileSystemLike* FilePath::fileSystem(void) {
-    return fs;
-}
-
 } // namespace mbed
--- a/cpp/FileSystemLike.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/FileSystemLike.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,42 +1,24 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_FILESYSTEMLIKE_H
 #define MBED_FILESYSTEMLIKE_H
 
-#ifdef __ARMCC_VERSION
-#    define O_RDONLY 0
-#    define O_WRONLY 1
-#    define O_RDWR   2
-#    define O_CREAT  0x0200
-#    define O_TRUNC  0x0400
-#    define O_APPEND 0x0008
-typedef int mode_t;
-
-#else
-#    include <sys/fcntl.h>
-#endif
-
 #include "platform.h"
 
+#include "FileBase.h"
 #include "FileHandle.h"
 #include "DirHandle.h"
 
@@ -48,7 +30,7 @@
  *  Implementations must define at least open (the default definitions
  *  of the rest of the functions just return error values).
  */
-class FileSystemLike {
+class FileSystemLike : public FileBase {
 
 public:
     /** FileSystemLike constructor
@@ -56,21 +38,12 @@
      *  @param name The name to use for the filesystem.
      */
     FileSystemLike(const char *name);
-    
+
     virtual ~FileSystemLike();
-    
-    /* Function lookup
-     *  Lookup and return the object that has the given name.
-     *
-     * Variables
-     *  name - the name to lookup.
-     *  len - the length of name.
-     */
-    static FileSystemLike *lookup(const char *name, unsigned int len);
-    
+
     static DirHandle *opendir();
     friend class BaseDirHandle;
-    
+
     /** Opens a file from the filesystem
      *
      *  @param filename The name of the file to open.
@@ -124,23 +97,6 @@
     virtual int mkdir(const char *name, mode_t mode) { return -1; }
 
     // TODO other filesystem functions (mkdir, rm, rn, ls etc)
-
-protected: 
-    static FileSystemLike *_head;
-    FileSystemLike *_next;
-    const char *_name;
-};
-
-class FilePath {
-public:
-    FilePath(const char* file_path);
-    
-    const char* fileName(void);
-    FileSystemLike* fileSystem(void);
-
-private:
-    const char* file_name;
-    FileSystemLike* fs;
 };
 
 } // namespace mbed
--- a/cpp/FunctionPointer.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/FunctionPointer.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "FunctionPointer.h"
 
--- a/cpp/FunctionPointer.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/FunctionPointer.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,30 +1,24 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_FUNCTIONPOINTER_H
 #define MBED_FUNCTIONPOINTER_H
 
 #include <string.h>
 
-namespace mbed { 
+namespace mbed {
 
 /** A class for storing and calling a pointer to a static or member void function
  */
@@ -32,31 +26,31 @@
 public:
 
     /** Create a FunctionPointer, attaching a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     FunctionPointer(void (*function)(void) = 0);
 
     /** Create a FunctionPointer, attaching a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     FunctionPointer(T *object, void (T::*member)(void)) {
         attach(object, member);
     }
-    
+
     /** Attach a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     void attach(void (*function)(void) = 0);
-    
+
     /** Attach a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     void attach(T *object, void (T::*member)(void)) {
@@ -65,7 +59,7 @@
         _membercaller = &FunctionPointer::membercaller<T>;
         _function = 0;
     }
-    
+
     /** Call the attached static or member function
      */
     void call();
@@ -78,7 +72,7 @@
         memcpy((char*)&m, member, sizeof(m));
         (o->*m)();
     }
-    
+
     void (*_function)(void);                // static function pointer - 0 if none attached
     void *_object;                            // object this pointer - 0 if none attached
     char _member[16];                        // raw member function pointer storage - converted back by registered _membercaller
--- a/cpp/I2C.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/I2C.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "I2C.h"
 
@@ -31,17 +25,17 @@
     // The init function also set the frequency to 100000
     i2c_init(&_i2c, sda, scl);
     _hz = 100000;
-    
+
     // Used to avoid unnecessary frequency updates
     _owner = this;
 }
 
 void I2C::frequency(int hz) {
     _hz = hz;
-    
+
     // We want to update the frequency even if we are already the bus owners
     i2c_frequency(&_i2c, _hz);
-    
+
     // Updating the frequency of the bus we become the owners of it
     _owner = this;
 }
@@ -55,11 +49,11 @@
 
 // write - Master Transmitter Mode
 int I2C::write(int address, const char* data, int length, bool repeated) {
-    aquire(); 
-    
+    aquire();
+
     int stop = (repeated) ? 0 : 1;
     int retval = i2c_write(&_i2c, address, data, length, stop);
-    
+
     return retval;
 }
 
@@ -70,10 +64,10 @@
 // read - Master Reciever Mode
 int I2C::read(int address, char* data, int length, bool repeated) {
     aquire();
-    
+
     int stop = (repeated) ? 0 : 1;
     int retval = i2c_read(&_i2c, address, data, length, stop);
-    
+
     return retval;
 }
 
--- a/cpp/I2C.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/I2C.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_I2C_H
 #define MBED_I2C_H
@@ -81,14 +75,14 @@
      * the address is forced to 1 to indicate a read.
      *
      *  @param address 8-bit I2C slave address [ addr | 1 ]
-     *  @param data Pointer to the byte-array to read data in to 
+     *  @param data Pointer to the byte-array to read data in to
      *  @param length Number of bytes to read
      *  @param repeated Repeated start, true - don't send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int read(int address, char *data, int length, bool repeated = false);
 
     /** Read a single byte from the I2C bus
@@ -106,14 +100,14 @@
      * the address is forced to 0 to indicate a write.
      *
      *  @param address 8-bit I2C slave address [ addr | 0 ]
-     *  @param data Pointer to the byte-array data to send 
+     *  @param data Pointer to the byte-array data to send
      *  @param length Number of bytes to send
      *  @param repeated Repeated start, true - do not send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int write(int address, const char *data, int length, bool repeated = false);
 
     /** Write single byte out on the I2C bus
@@ -137,7 +131,7 @@
 
 protected:
     void aquire();
-    
+
     i2c_t _i2c;
     static I2C  *_owner;
     int         _hz;
--- a/cpp/I2CSlave.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/I2CSlave.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "I2CSlave.h"
 
--- a/cpp/I2CSlave.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/I2CSlave.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_I2C_SLAVE_H
 #define MBED_I2C_SLAVE_H
@@ -47,7 +41,7 @@
  *     while (1) {
  *         int i = slave.receive();
  *         switch (i) {
- *             case I2CSlave::ReadAddressed: 
+ *             case I2CSlave::ReadAddressed:
  *                 slave.write(msg, strlen(msg) + 1); // Includes null char
  *                 break;
  *             case I2CSlave::WriteGeneral:
@@ -62,7 +56,7 @@
  *         for(int i = 0; i < 10; i++) buf[i] = 0;    // Clear buffer
  *     }
  * }
- * @endcode                  
+ * @endcode
  */
 class I2CSlave {
 
@@ -94,7 +88,7 @@
      *  - NoData            - the slave has not been addressed
      *  - ReadAddressed     - the master has requested a read from this slave
      *  - WriteAddressed    - the master is writing to this slave
-     *  - WriteGeneral      - the master is writing to all slave 
+     *  - WriteGeneral      - the master is writing to all slave
      */
     int receive(void);
 
@@ -107,7 +101,7 @@
      *       0 on success,
      *   non-0 otherwise
      */
-    int read(char *data, int length); 
+    int read(char *data, int length);
 
     /** Read a single byte from an I2C master.
      *
--- a/cpp/InterruptIn.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/InterruptIn.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,35 +1,26 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "InterruptIn.h"
 
 #if DEVICE_INTERRUPTIN
 
-#include "error.h"
-
 namespace mbed {
 
 InterruptIn::InterruptIn(PinName pin) {
-    if (gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this) != 0)
-        error("[ERROR] InterruptIn init\n");
+    gpio_irq_init(&gpio_irq, pin, (&InterruptIn::_irq_handler), (uint32_t)this);
     gpio_init(&gpio, pin, PIN_INPUT);
 }
 
@@ -37,7 +28,7 @@
     gpio_irq_free(&gpio_irq);
 }
 
-int InterruptIn::read() { 
+int InterruptIn::read() {
     return gpio_read(&gpio);
 }
 
--- a/cpp/InterruptIn.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/InterruptIn.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_INTERRUPTIN_H
 #define MBED_INTERRUPTIN_H
@@ -68,13 +62,13 @@
      */
     InterruptIn(PinName pin);
     virtual ~InterruptIn();
-    
+
      int read();
 #ifdef MBED_OPERATORS
     operator int();
 
 #endif
-     
+
     /** Attach a function to call when a rising edge occurs on the input
      *
      *  @param fptr A pointer to a void function, or 0 to set as none
@@ -82,7 +76,7 @@
     void rise(void (*fptr)(void));
 
     /** Attach a member function to call when a rising edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -99,7 +93,7 @@
     void fall(void (*fptr)(void));
 
     /** Attach a member function to call when a falling edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -114,13 +108,13 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
-    
+
     static void _irq_handler(uint32_t id, gpio_irq_event event);
-    
+
 protected:
     gpio_t gpio;
     gpio_irq_t gpio_irq;
-    
+
     FunctionPointer _rise;
     FunctionPointer _fall;
 };
--- a/cpp/LocalFileSystem.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/LocalFileSystem.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "LocalFileSystem.h"
 
@@ -57,7 +51,7 @@
     param[1] = (unsigned long)strlen(pattern);
     param[2] = (unsigned long)info;
     param[3] = (unsigned long)sizeof(XFINFO);
-    
+
     return __semihost(USR_XFFIND, param);
 }
 
@@ -95,7 +89,7 @@
         /* invalid flags */
         openmode = OPEN_INVALID;
     }
-    
+
     return openmode;
 }
 
@@ -104,12 +98,12 @@
     if (openmode == OPEN_INVALID) {
         return (FILEHANDLE)NULL;
     }
-    
+
     FILEHANDLE fh = semihost_open(name, openmode);
     if (fh == -1) {
         return (FILEHANDLE)NULL;
     }
-    
+
     return fh;
 }
 
@@ -148,7 +142,7 @@
     } else if (whence == SEEK_END) {
         position += semihost_flen(_fh);
     } /* otherwise SEEK_SET, so position is fine */
-    
+
     /* Always seems to return -1, so just ignore for now. */
     semihost_seek(_fh, position);
     pos = position;
@@ -168,16 +162,16 @@
 public:
     struct dirent cur_entry;
     XFINFO info;
-    
+
     LocalDirHandle() {
         info.fileID = 0;
     }
-    
+
     virtual int closedir() {
         delete this;
         return 0;
     }
-    
+
     virtual struct dirent *readdir() {
         if (xffind("*", &info)!=0) {
             return NULL;
@@ -185,16 +179,16 @@
         memcpy(cur_entry.d_name, info.name, sizeof(info.name));
         return &cur_entry;
     }
-    
+
     virtual void rewinddir() {
         info.fileID = 0;
     }
-    
+
     virtual off_t telldir() {
         return info.fileID;
     }
-    
-    virtual void seekdir(off_t offset) { 
+
+    virtual void seekdir(off_t offset) {
         info.fileID = offset;
     }
 };
@@ -206,12 +200,12 @@
             return NULL;
         }
     }
-    
+
     int openmode = posix_to_semihost_open_flags(flags);
     if (openmode == OPEN_INVALID) {
         return NULL;
     }
-    
+
     FILEHANDLE fh = semihost_open(name, openmode);
     if (fh == -1) {
         return NULL;
--- a/cpp/LocalFileSystem.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/LocalFileSystem.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_LOCALFILESYSTEM_H
 #define MBED_LOCALFILESYSTEM_H
@@ -36,19 +30,19 @@
 
 public:
     LocalFileHandle(FILEHANDLE fh);
-    
+
     virtual int close();
-    
+
     virtual ssize_t write(const void *buffer, size_t length);
-    
+
     virtual ssize_t read(void *buffer, size_t length);
-    
+
     virtual int isatty();
-    
+
     virtual off_t lseek(off_t position, int whence);
-    
+
     virtual int fsync();
-    
+
     virtual off_t flen();
 
 protected:
@@ -56,10 +50,10 @@
     int pos;
 };
 
-/** A filesystem for accessing the local mbed Microcontroller USB disk drive 
+/** A filesystem for accessing the local mbed Microcontroller USB disk drive
  *
- *  This allows programs to read and write files on the same disk drive that is used to program the 
- *  mbed Microcontroller. Once created, the standard C file access functions are used to open, 
+ *  This allows programs to read and write files on the same disk drive that is used to program the
+ *  mbed Microcontroller. Once created, the standard C file access functions are used to open,
  *  read and write files.
  *
  * Example:
@@ -70,8 +64,8 @@
  *
  * int main() {
  *     FILE *fp = fopen("/local/out.txt", "w");  // Open "out.txt" on the local file system for writing
- *     fprintf(fp, "Hello World!");              
- *     fclose(fp);                               
+ *     fprintf(fp, "Hello World!");
+ *     fclose(fp);
  *     remove("/local/out.txt");                 // Removes the file "out.txt" from the local file system
  *
  *     DIR *d = opendir("/local");               // Opens the root directory of the local file system
@@ -94,7 +88,7 @@
 
 public:
     LocalFileSystem(const char* n) : FileSystemLike(n) {
-        
+
     }
 
     virtual FileHandle *open(const char* name, int flags);
--- a/cpp/PortIn.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/PortIn.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PORTIN_H
 #define MBED_PORTIN_H
@@ -60,11 +54,11 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-        */ 
+        */
     PortIn(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_INPUT);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -73,7 +67,7 @@
     int read() {
         return port_read(&_port);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -81,10 +75,10 @@
     void mode(PinMode mode) {
         port_mode(&_port, mode);
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/cpp/PortInOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/PortInOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PORTINOUT_H
 #define MBED_PORTINOUT_H
@@ -39,19 +33,19 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
+     */
     PortInOut(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_INPUT);
     }
-    
+
     /** Write the value to the output port
      *
      *  @param value An integer specifying a bit to write for every corresponding port pin
-     */    
+     */
     void write(int value) {
         port_write(&_port, value);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -60,19 +54,19 @@
     int read() {
         return port_read(&_port);
     }
-    
+
     /** Set as an output
      */
     void output() {
         port_dir(&_port, PIN_OUTPUT);
     }
-    
+
     /** Set as an input
      */
     void input() {
         port_dir(&_port, PIN_INPUT);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -80,22 +74,22 @@
     void mode(PinMode mode) {
         port_mode(&_port, mode);
     }
-    
+
     /** A shorthand for write()
-     */    
+     */
     PortInOut& operator= (int value) {
         write(value);
         return *this;
     }
-    
+
     PortInOut& operator= (PortInOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/cpp/PortOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/PortOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PORTOUT_H
 #define MBED_PORTOUT_H
@@ -34,7 +28,7 @@
  * Example:
  * @code
  * // Toggle all four LEDs
- * 
+ *
  * #include "mbed.h"
  *
  * // LED1 = P1.18  LED2 = P1.20  LED3 = P1.21  LED4 = P1.23
@@ -51,7 +45,7 @@
  *     }
  * }
  * @endcode
- */  
+ */
 class PortOut {
 public:
 
@@ -59,19 +53,19 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
+     */
     PortOut(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_OUTPUT);
     }
-    
+
     /** Write the value to the output port
      *
      *  @param value An integer specifying a bit to write for every corresponding PortOut pin
-     */    
+     */
     void write(int value) {
         port_write(&_port, value);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -82,20 +76,20 @@
     }
 
     /** A shorthand for write()
-     */    
-    PortOut& operator= (int value) { 
+     */
+    PortOut& operator= (int value) {
         write(value);
         return *this;
     }
-    
-    PortOut& operator= (PortOut& rhs) { 
+
+    PortOut& operator= (PortOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/cpp/PwmOut.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/PwmOut.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PWMOUT_H
 #define MBED_PWMOUT_H
@@ -37,7 +31,7 @@
  * #include "mbed.h"
  *
  * PwmOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = led + 0.01;
@@ -70,7 +64,7 @@
 
     /** Set the ouput duty-cycle, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output duty-cycle, 
+     *  @param value A floating-point value representing the output duty-cycle,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
@@ -82,7 +76,7 @@
     /** Return the current output duty-cycle setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current duty-cycle being output on the pin, 
+     *    A floating-point value representing the current duty-cycle being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *
@@ -92,7 +86,7 @@
     float read() {
         return pwmout_read(&_pwm);
     }
-    
+
     /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
      *
      *  @note
@@ -140,12 +134,12 @@
         write(value);
         return *this;
     }
-    
+
     PwmOut& operator= (PwmOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** An operator shorthand for read()
      */
     operator float() {
--- a/cpp/SPI.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/SPI.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "SPI.h"
 
@@ -41,7 +35,7 @@
     aquire();
 }
 
-void SPI::frequency(int hz) { 
+void SPI::frequency(int hz) {
     _hz = hz;
     SPI::_owner = NULL; // Not that elegant, but works. rmeyer
     aquire();
--- a/cpp/SPI.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/SPI.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_SPI_H
 #define MBED_SPI_H
@@ -73,11 +67,11 @@
      *  @param mode Clock polarity and phase mode (0 - 3)
      *
      * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
      *   1  |  0   1
-     *   2  |  1   0 
+     *   2  |  1   0
      *   3  |  1   1
      * @endcode
      */
@@ -100,7 +94,7 @@
 
 protected:
     spi_t _spi;
-    
+
     void aquire(void);
     static SPI *_owner;
     int _bits;
--- a/cpp/SPISlave.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/SPISlave.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "SPISlave.h"
 
--- a/cpp/SPISlave.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/SPISlave.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_SPISLAVE_H
 #define MBED_SPISLAVE_H
@@ -79,11 +73,11 @@
      *  @param mode Clock polarity and phase mode (0 - 3)
      *
      * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
      *   1  |  0   1
-     *   2  |  1   0 
+     *   2  |  1   0
      *   3  |  1   1
      * @endcode
      */
@@ -119,7 +113,7 @@
 
 protected:
     spi_t _spi;
-    
+
     int _bits;
     int _mode;
     int _hz;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpp/Serial.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -0,0 +1,70 @@
+/* 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 "Serial.h"
+
+#if DEVICE_SERIAL
+
+namespace mbed {
+
+Serial::Serial(PinName tx, PinName rx, const char *name) : Stream(name) {
+    serial_init(&_serial, tx, rx);
+    serial_irq_handler(&_serial, Serial::_irq_handler, (uint32_t)this);
+}
+
+void Serial::baud(int baudrate) {
+    serial_baud(&_serial, baudrate);
+}
+
+void Serial::format(int bits, Parity parity, int stop_bits) {
+    serial_format(&_serial, bits, (SerialParity)parity, stop_bits);
+}
+
+int Serial::readable() {
+    return serial_readable(&_serial);
+}
+
+
+int Serial::writeable() {
+    return serial_writable(&_serial);
+}
+
+void Serial::attach(void (*fptr)(void), IrqType type) {
+    if (fptr) {
+        _irq[type].attach(fptr);
+        serial_irq_set(&_serial, (SerialIrq)type, 1);
+    } else {
+        serial_irq_set(&_serial, (SerialIrq)type, 0);
+    }
+}
+
+
+void Serial::_irq_handler(uint32_t id, SerialIrq irq_type) {
+    Serial *handler = (Serial*)id;
+    handler->_irq[irq_type].call();
+}
+
+int Serial::_getc() {
+    return serial_getc(&_serial);
+}
+
+int Serial::_putc(int c) {
+    serial_putc(&_serial, c);
+    return c;
+}
+
+} // namespace mbed
+
+#endif
--- a/cpp/Serial.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Serial.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_SERIAL_H
 #define MBED_SERIAL_H
@@ -34,7 +28,7 @@
 
 /** A serial port (UART) for communication with other serial devices
  *
- * Can be used for Full Duplex communication, or Simplex by specifying 
+ * Can be used for Full Duplex communication, or Simplex by specifying
  * one pin as NC (Not Connected)
  *
  * Example:
@@ -53,27 +47,34 @@
 class Serial : public Stream {
 
 public:
-
     /** Create a Serial port, connected to the specified transmit and receive pins
      *
-     *  @param tx Transmit pin 
+     *  @param tx Transmit pin
      *  @param rx Receive pin
      *
      *  @note
      *    Either tx or rx may be specified as NC if unused
      */
-    Serial(PinName tx, PinName rx) {
-        serial_init(&_serial, tx, rx);
-        serial_irq_handler(&_serial, Serial::_irq_handler, (uint32_t)this);
-    }
+    Serial(PinName tx, PinName rx, const char *name=NULL);
 
     /** Set the baud rate of the serial port
-     *  
+     *
      *  @param baudrate The baudrate of the serial port (default = 9600).
      */
-    void baud(int baudrate) {
-        serial_baud(&_serial, baudrate);
-    }
+    void baud(int baudrate);
+
+    enum Parity {
+        None = 0,
+        Odd,
+        Even,
+        Forced1,
+        Forced0
+    };
+
+    enum IrqType {
+        RxIrq = 0,
+        TxIrq
+    };
 
     /** Set the transmission format used by the Serial port
      *
@@ -81,9 +82,7 @@
      *  @param parity The parity used (Serial::None, Serial::Odd, Serial::Even, Serial::Forced1, Serial::Forced0; default = Serial::None)
      *  @param stop The number of stop bits (1 or 2; default = 1)
      */
-    void format(int bits = 8, SerialParity parity=ParityNone, int stop_bits=1) {
-        serial_format(&_serial, bits, parity, stop_bits);
-    }
+    void format(int bits = 8, Parity parity=Serial::None, int stop_bits=1);
 
     /** Determine if there is a character available to read
      *
@@ -91,64 +90,44 @@
      *    1 if there is a character available to read,
      *    0 otherwise
      */
-    int readable() {
-        return serial_readable(&_serial);
-    }
+    int readable();
 
     /** Determine if there is space available to write a character
-     * 
+     *
      *  @returns
      *    1 if there is space to write a character,
      *    0 otherwise
      */
-    int writeable() {
-        return serial_writable(&_serial);
-    }
+    int writeable();
 
     /** Attach a function to call whenever a serial interrupt is generated
      *
      *  @param fptr A pointer to a void function, or 0 to set as none
      *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
      */
-    void attach(void (*fptr)(void), SerialIrq type=RxIrq) {
-        if (fptr) {
-            _irq[type].attach(fptr);
-            serial_irq_set(&_serial, type, 1);
-        } else {
-            serial_irq_set(&_serial, type, 0);
-        }
-    }
+    void attach(void (*fptr)(void), IrqType type=RxIrq);
 
     /** Attach a member function to call whenever a serial interrupt is generated
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
      */
     template<typename T>
-    void attach(T* tptr, void (T::*mptr)(void), SerialIrq type=RxIrq) {
+    void attach(T* tptr, void (T::*mptr)(void), IrqType type=RxIrq) {
         if((mptr != NULL) && (tptr != NULL)) {
             _irq[type].attach(tptr, mptr);
-            serial_irq_set(&_serial, type, 1);
+            serial_irq_set(&_serial, (SerialIrq)type, 1);
         }
     }
-    
-    static void _irq_handler(uint32_t id, SerialIrq irq_type) {
-        Serial *handler = (Serial*)id;
-        handler->_irq[irq_type].call();
-    }
 
+    static void _irq_handler(uint32_t id, SerialIrq irq_type);
+
 protected:
-    virtual int _getc() {
-        return serial_getc(&_serial);
-    }
-    
-    virtual int _putc(int c) {
-        serial_putc(&_serial, c);
-        return c;
-    }
-    
-    serial_t   _serial;
+    virtual int _getc();
+    virtual int _putc(int c);
+
+    serial_t        _serial;
     FunctionPointer _irq[2];
 };
 
--- a/cpp/Stream.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Stream.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "Stream.h"
 
@@ -25,7 +19,7 @@
 
 namespace mbed {
 
-Stream::Stream(void) {
+Stream::Stream(const char *name) : FileLike(name) {
     /* open ourselves */
     char buf[12]; /* :0x12345678 + null byte */
     std::sprintf(buf, ":%p", this);
--- a/cpp/Stream.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Stream.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,36 +1,30 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_STREAM_H
 #define MBED_STREAM_H
 
 #include "platform.h"
-#include "FileHandle.h"
+#include "FileLike.h"
 
 namespace mbed {
 
-class Stream : public FileHandle {
+class Stream : public FileLike {
 
 public:
-    Stream(void);
+    Stream(const char *name=NULL);
     virtual ~Stream();
 
     int putc(int c);
@@ -39,7 +33,7 @@
     char *gets(char *s, int size);
     int printf(const char* format, ...);
     int scanf(const char* format, ...);
-    
+
     operator std::FILE*() {return _file;}
 
 protected:
@@ -53,7 +47,7 @@
 
     virtual int _putc(int c) = 0;
     virtual int _getc() = 0;
-    
+
     std::FILE *_file;
 };
 
--- a/cpp/Ticker.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Ticker.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "Ticker.h"
 
--- a/cpp/Ticker.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Ticker.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_TICKER_H
 #define MBED_TICKER_H
@@ -29,7 +23,7 @@
 
 /** A Ticker is used to call a function at a recurring interval
  *
- *  You can use as many seperate Ticker objects as you require. 
+ *  You can use as many seperate Ticker objects as you require.
  *
  * Example:
  * @code
@@ -40,9 +34,9 @@
  * Ticker timer;
  * DigitalOut led1(LED1);
  * DigitalOut led2(LED2);
- * 
+ *
  * int flip = 0;
- * 
+ *
  * void attime() {
  *     flip = !flip;
  * }
@@ -72,7 +66,7 @@
     void attach(void (*fptr)(void), float t) {
         attach_us(fptr, t * 1000000.0f);
     }
-    
+
     /** Attach a member function to be called by the Ticker, specifiying the interval in seconds
      *
      *  @param tptr pointer to the object to call the member function on
@@ -83,7 +77,7 @@
     void attach(T* tptr, void (T::*mptr)(void), float t) {
         attach_us(tptr, mptr, t * 1000000.0f);
     }
-    
+
     /** Attach a function to be called by the Ticker, specifiying the interval in micro-seconds
      *
      *  @param fptr pointer to the function to be called
@@ -99,13 +93,13 @@
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      *  @param t the time between calls in micro-seconds
-     */    
+     */
     template<typename T>
     void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
         _function.attach(tptr, mptr);
         setup(t);
     }
-    
+
     /** Detach the function
      */
     void detach();
@@ -113,7 +107,7 @@
 protected:
     void setup(unsigned int t);
     virtual void handler();
-    
+
     unsigned int _delay;
     FunctionPointer _function;
 };
--- a/cpp/Timeout.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Timeout.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "Timeout.h"
 
--- a/cpp/Timeout.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Timeout.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_TIMEOUT_H
 #define MBED_TIMEOUT_H
@@ -28,23 +22,23 @@
 
 /** A Timeout is used to call a function at a point in the future
  *
- * You can use as many seperate Timeout objects as you require. 
+ * You can use as many seperate Timeout objects as you require.
  *
  * Example:
  * @code
  * // Blink until timeout.
  *
  * #include "mbed.h"
- * 
+ *
  * Timeout timeout;
  * DigitalOut led(LED1);
- * 
+ *
  * int on = 1;
- * 
+ *
  * void attimeout() {
  *     on = 0;
  * }
- * 
+ *
  * int main() {
  *     timeout.attach(&attimeout, 5);
  *     while(on) {
--- a/cpp/Timer.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Timer.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "Timer.h"
 #include "us_ticker_api.h"
@@ -41,7 +35,7 @@
 int Timer::read_us() {
     return _time + slicetime();
 }
-    
+
 float Timer::read() {
     return (float)read_us() / 1000000.0;
 }
--- a/cpp/Timer.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/Timer.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_TIMER_H
 #define MBED_TIMER_H
@@ -26,18 +20,18 @@
 
 namespace mbed {
 
-/** A general purpose timer 
+/** A general purpose timer
  *
  * Example:
  * @code
  * // Count the time to toggle a LED
  *
  * #include "mbed.h"
- * 
+ *
  * Timer timer;
  * DigitalOut led(LED1);
  * int begin, end;
- * 
+ *
  * int main() {
  *     timer.start();
  *     begin = timer.read_us();
@@ -51,16 +45,16 @@
 
 public:
     Timer();
-    
+
     /** Start the timer
      */
-    void start(); 
+    void start();
 
     /** Stop the timer
      */
-    void stop(); 
+    void stop();
 
-    /** Reset the timer to 0. 
+    /** Reset the timer to 0.
      *
      * If it was already counting, it will continue
      */
@@ -78,7 +72,7 @@
      */
     int read_us();
 
-#ifdef MBED_OPERATORS 
+#ifdef MBED_OPERATORS
     operator float();
 #endif
 
--- a/cpp/TimerEvent.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/TimerEvent.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "TimerEvent.h"
 #include "cmsis.h"
--- a/cpp/TimerEvent.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/TimerEvent.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_TIMEREVENT_H
 #define MBED_TIMEREVENT_H
@@ -31,11 +25,11 @@
 class TimerEvent {
 public:
     TimerEvent();
-    
+
     /** The handler registered with the underlying timer interrupt
      */
     static void irq(uint32_t id);
-    
+
     /** Destruction removes it...
      */
     virtual ~TimerEvent();
@@ -43,13 +37,13 @@
 protected:
     // The handler called to service the timer event of the derived class
     virtual void handler() = 0;
-    
+
     // insert in to linked list
     void insert(unsigned int timestamp);
-    
+
     // remove from linked list, if in it
     void remove();
-    
+
     ticker_event_t event;
 };
 
--- a/cpp/mbed.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/mbed.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_H
 #define MBED_H
@@ -62,6 +56,7 @@
 #include "LocalFileSystem.h"
 #include "InterruptIn.h"
 #include "wait_api.h"
+#include "sleep_api.h"
 #include "rtc_time.h"
 
 using namespace mbed;
--- a/cpp/platform.h	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/platform.h	Mon Feb 18 11:44:18 2013 +0000
@@ -1,23 +1,17 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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_PLATFORM_H
 #define MBED_PLATFORM_H
--- a/cpp/stdio.cpp	Thu Nov 29 15:41:14 2012 +0000
+++ b/cpp/stdio.cpp	Mon Feb 18 11:44:18 2013 +0000
@@ -1,31 +1,26 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2012 ARM Limited
+ * Copyright (c) 2006-2013 ARM Limited
  *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * 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
  *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
+ *     http://www.apache.org/licenses/LICENSE-2.0
  *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * 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 "platform.h"
 #include "FileHandle.h"
 #include "FileSystemLike.h"
+#include "FilePath.h"
 #include "serial_api.h"
 #include <errno.h>
 
-#ifdef __ARMCC_VERSION
+#if defined(__ARMCC_VERSION)
 #   include <rt_sys.h>
 #   define PREFIX(x)    _sys##x
 #   define OPEN_MAX     _SYS_OPEN
@@ -33,6 +28,15 @@
 #       pragma import(__use_full_stdio)
 #   endif
 
+#elif defined(__ICCARM__)
+#   include <yfuns.h>
+#   define PREFIX(x)        _##x
+#   define OPEN_MAX         16
+
+#   define STDIN_FILENO     0
+#   define STDOUT_FILENO    1
+#   define STDERR_FILENO    2
+
 #else
 #   include <sys/stat.h>
 #   include <sys/unistd.h>
@@ -76,30 +80,38 @@
 #endif
 }
 
+static inline int openmode_to_posix(int openmode) {
+    int posix = openmode;
 #ifdef __ARMCC_VERSION
-static int rvct_openmode_to_posix(int openmode) {
-    /* RVCT openmode -> POSIX flags */
-    int tmpmode = openmode;
-    if (tmpmode & OPEN_PLUS) {
-        openmode = O_RDWR;
-    } else if(tmpmode & OPEN_W) {
-        openmode = O_WRONLY;
-    } else if(tmpmode & OPEN_A) {
-        openmode = O_WRONLY|O_APPEND;
+    if (openmode & OPEN_PLUS) {
+        posix = O_RDWR;
+    } else if(openmode & OPEN_W) {
+        posix = O_WRONLY;
+    } else if(openmode & OPEN_A) {
+        posix = O_WRONLY|O_APPEND;
     } else {
-        openmode = O_RDONLY;
+        posix = O_RDONLY;
     }
     /* a, w, a+, w+ all create if file does not already exist */
-    if (tmpmode & (OPEN_A|OPEN_W)) {
-        openmode |= O_CREAT;
+    if (openmode & (OPEN_A|OPEN_W)) {
+        posix |= O_CREAT;
     }
     /* w and w+ truncate */
-    if (tmpmode & OPEN_W) {
-        openmode |= O_TRUNC;
+    if (openmode & OPEN_W) {
+        posix |= O_TRUNC;
     }
-    return openmode;
+#elif defined(__ICCARM__)
+    switch (openmode & _LLIO_RDWRMASK) {
+        case _LLIO_RDONLY: posix = O_RDONLY; break;
+        case _LLIO_WRONLY: posix = O_WRONLY; break;
+        case _LLIO_RDWR  : posix = O_RDWR  ; break;
+    }
+    if (openmode & _LLIO_CREAT ) posix |= O_CREAT;
+    if (openmode & _LLIO_APPEND) posix |= O_APPEND;
+    if (openmode & _LLIO_TRUNC ) posix |= O_TRUNC;
+#endif
+    return posix;
 }
-#endif
 
 extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) {
     /* Use the posix convention that stdin,out,err are filehandles 0,1,2.
@@ -114,7 +126,7 @@
         init_serial();
         return 2;
     }
-    
+
     // find the first empty slot in filehandles
     unsigned int fh_i;
     for (fh_i = 0; fh_i < sizeof(filehandles)/sizeof(*filehandles); fh_i++) {
@@ -123,44 +135,50 @@
     if (fh_i >= sizeof(filehandles)/sizeof(*filehandles)) {
         return -1;
     }
-    
+
     FileHandle *res;
-    
+
     /* FILENAME: ":0x12345678" describes a FileLike* */
     if (name[0] == ':') {
         void *p;
         sscanf(name, ":%p", &p);
         res = (FileHandle*)p;
-    
+
     /* FILENAME: "/file_system/file_name" */
     } else {
         FilePath path(name);
-        
-        FileSystemLike *fs = path.fileSystem();
-        if (fs == NULL) return -1;
-        
-#ifdef __ARMCC_VERSION
-        openmode = rvct_openmode_to_posix(openmode);
-#endif
-        res = fs->open(path.fileName(), openmode); /* NULL if fails */
+
+        if (path.isFile()) {
+            res = path.file();
+        } else {
+            FileSystemLike *fs = path.fileSystem();
+            if (fs == NULL) return -1;
+            int posix_mode = openmode_to_posix(openmode);
+            res = fs->open(path.fileName(), posix_mode); /* NULL if fails */
+        }
     }
-    
+
     if (res == NULL) return -1;
     filehandles[fh_i] = res;
+
     return fh_i + 3; // +3 as filehandles 0-2 are stdin/out/err
 }
 
 extern "C" int PREFIX(_close)(FILEHANDLE fh) {
     if (fh < 3) return 0;
-    
+
     FileHandle* fhc = filehandles[fh-3];
     filehandles[fh-3] = NULL;
     if (fhc == NULL) return -1;
-    
+
     return fhc->close();
 }
 
-extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char* buffer, unsigned int length, int mode) {
+#if defined(__ICCARM__)
+extern "C" size_t    __write (int        fh, const unsigned char *buffer, size_t length) {
+#else
+extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsigned int length, int mode) {
+#endif
     int n; // n is the number of bytes written
     if (fh < 3) {
 #if DEVICE_SERIAL
@@ -173,17 +191,21 @@
     } else {
         FileHandle* fhc = filehandles[fh-3];
         if (fhc == NULL) return -1;
-        
+
         n = fhc->write(buffer, length);
     }
 #ifdef __ARMCC_VERSION
     return length-n;
 #else
     return n;
-#endif 
+#endif
 }
 
-extern "C" int PREFIX(_read)(FILEHANDLE fh, unsigned char* buffer, unsigned int length, int mode) {
+#if defined(__ICCARM__)
+extern "C" size_t    __read (int        fh, unsigned char *buffer, size_t       length) {
+#else
+extern "C" int PREFIX(_read)(FILEHANDLE fh, unsigned char *buffer, unsigned int length, int mode) {
+#endif
     int n; // n is the number of bytes read
     if (fh < 3) {
         // only read a character at a time from stdin
@@ -194,79 +216,80 @@
     } else {
         FileHandle* fhc = filehandles[fh-3];
         if (fhc == NULL) return -1;
-        
+
         n = fhc->read(buffer, length);
     }
 #ifdef __ARMCC_VERSION
     return length-n;
 #else
     return n;
-#endif 
+#endif
 }
 
 #ifdef __ARMCC_VERSION
 extern "C" int PREFIX(_istty)(FILEHANDLE fh)
 #else
-extern "C" int isatty(FILEHANDLE fh)
+extern "C" int _isatty(FILEHANDLE fh)
 #endif
 {
     /* stdin, stdout and stderr should be tty */
     if (fh < 3) return 1;
-    
+
     FileHandle* fhc = filehandles[fh-3];
     if (fhc == NULL) return -1;
-    
+
     return fhc->isatty();
 }
 
-#ifdef __ARMCC_VERSION
-extern "C" int PREFIX(_seek)(FILEHANDLE fh, long position) {
-    if (fh < 3) return 0;
-    
-    FileHandle* fhc = filehandles[fh-3];
-    if (fhc == NULL || fhc->lseek(position, SEEK_SET) == -1) return -1;
-    
-    return 0;
-}
+extern "C"
+#if defined(__ARMCC_VERSION)
+int _sys_seek(FILEHANDLE fh, long position)
+#elif defined(__ICCARM__)
+long __lseek(int fh, long offset, int whence)
 #else
-extern "C" int _lseek(FILEHANDLE fh, int offset, int whence) {
+int _lseek(FILEHANDLE fh, int offset, int whence)
+#endif
+{
     if (fh < 3) return 0;
-    
-    FileHandle *fhc = filehandles[fh-3];
+
+    FileHandle* fhc = filehandles[fh-3];
     if (fhc == NULL) return -1;
-    
+
+#if defined(__ARMCC_VERSION)
+    return fhc->lseek(position, SEEK_SET);
+#else
     return fhc->lseek(offset, whence);
+#endif
 }
-#endif
 
 #ifdef __ARMCC_VERSION
 extern "C" int PREFIX(_ensure)(FILEHANDLE fh) {
     if (fh < 3) return 0;
-    
+
     FileHandle* fhc = filehandles[fh-3];
     if (fhc == NULL) return -1;
-    
+
     return fhc->fsync();
 }
 
 extern "C" long PREFIX(_flen)(FILEHANDLE fh) {
     if (fh < 3) return 0;
-    
+
     FileHandle* fhc = filehandles[fh-3];
     if (fhc == NULL) return -1;
-    
+
     return fhc->flen();
 }
 #endif
 
 
-#ifndef __ARMCC_VERSION
+#if !defined(__ARMCC_VERSION) && !defined(__ICCARM__)
 extern "C" int _fstat(int fd, struct stat *st) {
     if ((STDOUT_FILENO == fd) || (STDERR_FILENO == fd) || (STDIN_FILENO == fd)) {
         st->st_mode = S_IFCHR;
         return  0;
     }
-    
+
     errno = EBADF;
     return -1;
 }
@@ -277,7 +300,7 @@
     FilePath fp(path);
     FileSystemLike *fs = fp.fileSystem();
     if (fs == NULL) return -1;
-    
+
     return fs->remove(fp.fileName());
 }
 
@@ -305,11 +328,11 @@
     if (path[0] == '/' && path[1] == 0) {
         return FileSystemLike::opendir();
     }
-    
+
     FilePath fp(path);
     FileSystemLike* fs = fp.fileSystem();
     if (fs == NULL) return NULL;
-    
+
     return fs->opendir(fp.fileName());
 }
 
@@ -337,7 +360,7 @@
     FilePath fp(path);
     FileSystemLike *fs = fp.fileSystem();
     if (fs == NULL) return -1;
-    
+
     return fs->mkdir(fp.fileName(), mode);
 }