]> git.cryptolib.org Git - labortage2013badge.git/blob - firmware/special_functions.S
test commit
[labortage2013badge.git] / firmware / special_functions.S
1 /* special_functions.S */
2 /*
3     This file is part of the Labotage2011_Badge.
4     Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de)
5
6     This program is free software: you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation, either version 3 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <avr/io.h>
21 #include "usbconfig.h"
22
23 .global soft_reset
24 soft_reset:
25         cli
26         andi r24, 0x0F
27         cpi r24, 0x0F
28         breq 1f
29         bst r24, 3
30         bld r24, 5
31         ori r24, 0x08
32         ldi r25, 0x18
33         or r25, r24
34         sbi _SFR_IO_ADDR(PORTB), USB_CFG_DMINUS_BIT
35         out _SFR_IO_ADDR(WDTCR), r25
36         out _SFR_IO_ADDR(WDTCR), r24
37 1:
38         rjmp 1b