Add firmware for the ATUSB IEEE 802.15.4 USB Adapter
[linux-libre-firmware.git] / atusb / board_atusb.h
1 /*
2  * fw/board_atusb.h - ATUSB Board-specific functions and definitions
3  *
4  * Written 2016 by Stefan Schmidt
5  * Copyright 2016 Stefan Schmidt
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_ATUSB_H
14 #define BOARD_ATUSB_H
15
16 #include <stdbool.h>
17 #include <stdint.h>
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 #define SPI_WAIT_DONE() while (!(UCSR1A & 1 << RXC1))
39 #define SPI_DATA        UDR1
40
41 void set_clkm(void);
42 void board_init(void);
43
44 void spi_begin(void);
45 void spi_off(void);
46 void spi_init(void);
47
48 #endif /* !BOARD_H */