mbed-os

Fork of mbed-os by erkin yucel

Committer:
xuaner
Date:
Thu Jul 20 14:26:57 2017 +0000
Revision:
1:3deb71413561
Parent:
0:f269e3021894
mbed_os

Who changed what in which revision?

UserRevisionLine numberNew contents of line
elessair 0:f269e3021894 1 #include "test_env.h"
elessair 0:f269e3021894 2 #include "semihost_api.h"
elessair 0:f269e3021894 3
elessair 0:f269e3021894 4 #define MAC_VENDOR_ARM_0 0x00
elessair 0:f269e3021894 5 #define MAC_VENDOR_ARM_1 0x02
elessair 0:f269e3021894 6 #define MAC_VENDOR_ARM_2 0xF7
elessair 0:f269e3021894 7
elessair 0:f269e3021894 8 int main() {
elessair 0:f269e3021894 9 MBED_HOSTTEST_TIMEOUT(10);
elessair 0:f269e3021894 10 MBED_HOSTTEST_SELECT(default_auto);
elessair 0:f269e3021894 11 MBED_HOSTTEST_DESCRIPTION(Semihost);
elessair 0:f269e3021894 12 MBED_HOSTTEST_START("MBED_22");
elessair 0:f269e3021894 13
elessair 0:f269e3021894 14 printf("Semihost connected: %s\n", (semihost_connected()) ? ("Yes") : ("No"));
elessair 0:f269e3021894 15
elessair 0:f269e3021894 16 char uid[DEVICE_ID_LENGTH + 1] = {0};
elessair 0:f269e3021894 17 bool result = true;
elessair 0:f269e3021894 18
elessair 0:f269e3021894 19 const int ret = mbed_interface_uid(uid);
elessair 0:f269e3021894 20 if (ret == 0) {
elessair 0:f269e3021894 21 printf("UID: %s\r\n", uid);
elessair 0:f269e3021894 22 }
elessair 0:f269e3021894 23 else {
elessair 0:f269e3021894 24 result = false;
elessair 0:f269e3021894 25 }
elessair 0:f269e3021894 26
elessair 0:f269e3021894 27 char mac[6] = {0}; // @param mac A 6-byte array to write the MAC address
elessair 0:f269e3021894 28 mbed_mac_address(mac);
elessair 0:f269e3021894 29 printf("MAC Address: %02X:%02X:%02X:%02X:%02X:%02X\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
elessair 0:f269e3021894 30
elessair 0:f269e3021894 31 if (mac[0] == MAC_VENDOR_ARM_0 &&
elessair 0:f269e3021894 32 mac[1] == MAC_VENDOR_ARM_1 &&
elessair 0:f269e3021894 33 mac[2] == MAC_VENDOR_ARM_2) {
elessair 0:f269e3021894 34 printf("MAC Address Prefix: 00:02:F7, Vendor: ARM\r\n");
elessair 0:f269e3021894 35 }
elessair 0:f269e3021894 36
elessair 0:f269e3021894 37 MBED_HOSTTEST_RESULT(result);
elessair 0:f269e3021894 38 }