IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Commit Details
Date: | 2015-06-07 00:28:03 (8 years 6 months ago) |
---|---|
Author: | Stefan Schmidt |
Commit: | 583a7b72ee2177391e6dca273a62ae17b70eb2fa |
Message: | atusb/fw: add EUI64 read and write fw interface to permanently set
an EUI64 The kernel driver will now ask for ATUSB_EUI64_READ during init and sets this extended address if available. Use the atusb-eui64 utility from the tools folder to read or set the permanent address. After a new address is set the device will reset to make sure we are in a sane state after the change. |
Files: |
atusb/fw/ep0.c (4 diffs) atusb/fw/include/atusb/atusb.h (2 diffs) |
Change Details
atusb/fw/ep0.c | ||
---|---|---|
3 | 3 | * |
4 | 4 | * Written 2008-2011, 2013 by Werner Almesberger |
5 | 5 | * Copyright 2008-2011, 2013 Werner Almesberger |
6 | * Copyright 2015-2016 Stefan Schmidt | |
6 | 7 | * |
7 | 8 | * This program is free software; you can redistribute it and/or modify |
8 | 9 | * it under the terms of the GNU General Public License as published by |
... | ... | |
16 | 17 | #include <string.h> |
17 | 18 | |
18 | 19 | #include <avr/io.h> |
20 | #include <avr/eeprom.h> | |
21 | ||
22 | #define F_CPU 8000000UL | |
23 | #include <util/delay.h> | |
19 | 24 | |
20 | 25 | #ifndef NULL |
21 | 26 | #define NULL 0 |
... | ... | |
44 | 49 | static uint8_t size; |
45 | 50 | |
46 | 51 | |
52 | static void do_eeprom_write(void *user) | |
53 | { | |
54 | int i; | |
55 | ||
56 | for (i = 0; i < size; i++) | |
57 | eeprom_update_byte((uint8_t*)i, buf[i]); | |
58 | } | |
59 | ||
47 | 60 | static void do_buf_write(void *user) |
48 | 61 | { |
49 | 62 | uint8_t i; |
... | ... | |
246 | 259 | return mac_rx(setup->wValue); |
247 | 260 | case ATUSB_TO_DEV(ATUSB_TX): |
248 | 261 | return mac_tx(setup->wValue, setup->wIndex, setup->wLength); |
262 | case ATUSB_TO_DEV(ATUSB_EUI64_WRITE): | |
263 | debug("ATUSB_EUI64_WRITE\n"); | |
264 | usb_recv(&eps[0], buf, setup->wLength, do_eeprom_write, NULL); | |
265 | _delay_ms(100); | |
266 | reset_cpu(); | |
267 | return 1; | |
268 | ||
269 | case ATUSB_FROM_DEV(ATUSB_EUI64_READ): | |
270 | debug("ATUSB_EUI64_READ\n"); | |
271 | eeprom_read_block(buf, (const void*)0, 8); | |
272 | usb_send(&eps[0], buf, 8, NULL, NULL); | |
273 | return 1; | |
249 | 274 | |
250 | 275 | default: |
251 | 276 | error("Unrecognized SETUP: 0x%02x 0x%02x ...\n", |
atusb/fw/include/atusb/atusb.h | ||
---|---|---|
46 | 46 | ATUSB_SPI_WRITE2_SYNC, |
47 | 47 | ATUSB_RX_MODE = 0x40, /* HardMAC group */ |
48 | 48 | ATUSB_TX, |
49 | ATUSB_EUI64_WRITE = 0x50, /* Parameter in EEPROM grp */ | |
50 | ATUSB_EUI64_READ, | |
49 | 51 | }; |
50 | 52 | |
51 | 53 | /* |
... | ... | |
77 | 79 | * |
78 | 80 | * host-> ATUSB_RX_MODE on - 0 |
79 | 81 | * host-> ATUSB_TX flags ack_seq #bytes |
82 | * host-> ATUSB_EUI64_WRITE - - #bytes (8) | |
83 | * ->host ATUSB_EUI64_READ - - #bytes (8) | |
80 | 84 | */ |
81 | 85 | |
82 | 86 | #define ATUSB_REQ_FROM_DEV (USB_TYPE_VENDOR | USB_DIR_IN) |