IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
Source at commit d233c04c86c2fde39b5e069bb6750caef3393f32 created 13 years 16 days ago. By Werner Almesberger, atusb/fw: implemented USB bus reset (to host) and polling of reset from host | |
---|---|
1 | /* |
2 | * fw/board.h - Board-specific functions and definitions |
3 | * |
4 | * Written 2008-2011 by Werner Almesberger |
5 | * Copyright 2008-2011 Werner Almesberger |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or |
10 | * (at your option) any later version. |
11 | */ |
12 | |
13 | #ifndef BOARD_H |
14 | #define BOARD_H |
15 | |
16 | #include <stdint.h> |
17 | |
18 | |
19 | #define LED_PORT B |
20 | #define LED_BIT 6 |
21 | #define nRST_RF_PORT C |
22 | #define nRST_RF_BIT 7 |
23 | #define SLP_TR_PORT B |
24 | #define SLP_TR_BIT 4 |
25 | |
26 | #define SCLK_PORT D |
27 | #define SCLK_BIT 5 |
28 | #define MOSI_PORT D |
29 | #define MOSI_BIT 3 |
30 | |
31 | #define MISO_PORT D |
32 | #define MISO_BIT 2 |
33 | #define nSS_PORT D |
34 | #define nSS_BIT 1 |
35 | #define IRQ_RF_PORT D |
36 | #define IRQ_RF_BIT 0 |
37 | |
38 | |
39 | #define SET_2(p, b) PORT##p |= 1 << (b) |
40 | #define CLR_2(p, b) PORT##p &= ~(1 << (b)) |
41 | #define IN_2(p, b) DDR##p &= ~(1 << (b)) |
42 | #define OUT_2(p, b) DDR##p |= 1 << (b) |
43 | #define PIN_2(p, b) ((PIN##p >> (b)) & 1) |
44 | |
45 | #define SET_1(p, b) SET_2(p, b) |
46 | #define CLR_1(p, b) CLR_2(p, b) |
47 | #define IN_1(p, b) IN_2(p, b) |
48 | #define OUT_1(p, b) OUT_2(p, b) |
49 | #define PIN_1(p, b) PIN_2(p, b) |
50 | |
51 | #define SET(n) SET_1(n##_PORT, n##_BIT) |
52 | #define CLR(n) CLR_1(n##_PORT, n##_BIT) |
53 | #define IN(n) IN_1(n##_PORT, n##_BIT) |
54 | #define OUT(n) OUT_1(n##_PORT, n##_BIT) |
55 | #define PIN(n) PIN_1(n##_PORT, n##_BIT) |
56 | |
57 | |
58 | #define USB_VENDOR 0x20b7 /* Qi Hardware */ |
59 | #define USB_PRODUCT 0x1540 /* ben-wpan atusb */ |
60 | |
61 | #define DFU_USB_VENDOR USB_VENDOR |
62 | #define DFU_USB_PRODUCT USB_PRODUCT |
63 | |
64 | |
65 | void reset_rf(void); |
66 | uint8_t read_irq(void); |
67 | |
68 | void led(int on); |
69 | void panic(void); |
70 | |
71 | void board_init(void); |
72 | |
73 | #endif /* !BOARD_H */ |
74 |