1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/driver_edbg_eui/main.c
Benjamin Valentin 616ebf9cfb drivers/edbg_eui: add driver to get MAC address from Atmel EDBG
The EDBG debugger on the `samr21-xpro` contains a unique 64 bit address
intended to be used as a MAC address for the internal radio.

This adds a driver to read that EUI-64 from the debugger, it should match
with the MAC address printed on the label on the board.
2020-05-26 10:44:11 +02:00

51 lines
851 B
C

/*
* Copyright (C) 2020 Benjamin Valentin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief Test application for the EDBG EUI driver
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*
* @}
*/
#include <stdio.h>
#include "edbg_eui.h"
static int test_get_eui64(void)
{
eui64_t e64;
if (edbg_get_eui64(&e64) != 0) {
puts("[FAILED]");
return 1;
}
printf("EUI-64:");
for (unsigned i = 0; i < sizeof(e64.uint8); ++i) {
printf(" %02x", e64.uint8[i]);
}
puts("");
return 0;
}
int main(void)
{
if (test_get_eui64()) {
return -1;
}
puts("[SUCCESS]");
return 0;
}