]> git.donarmstrong.com Git - qmk_firmware.git/blob - Bootloaders/MassStorage/BootloaderAPITable.S
30165700d71888130346a83c39621ee4c7e73de2
[qmk_firmware.git] / Bootloaders / MassStorage / BootloaderAPITable.S
1 /*\r
2              LUFA Library\r
3      Copyright (C) Dean Camera, 2017.\r
4 \r
5   dean [at] fourwalledcubicle [dot] com\r
6            www.lufa-lib.org\r
7 */\r
8 \r
9 /*\r
10   Copyright 2017  Dean Camera (dean [at] fourwalledcubicle [dot] com)\r
11 \r
12   Permission to use, copy, modify, distribute, and sell this\r
13   software and its documentation for any purpose is hereby granted\r
14   without fee, provided that the above copyright notice appear in\r
15   all copies and that both that the copyright notice and this\r
16   permission notice and warranty disclaimer appear in supporting\r
17   documentation, and that the name of the author not be used in\r
18   advertising or publicity pertaining to distribution of the\r
19   software without specific, written prior permission.\r
20 \r
21   The author disclaims all warranties with regard to this\r
22   software, including all implied warranties of merchantability\r
23   and fitness.  In no event shall the author be liable for any\r
24   special, indirect or consequential damages or any damages\r
25   whatsoever resulting from loss of use, data or profits, whether\r
26   in an action of contract, negligence or other tortious action,\r
27   arising out of or in connection with the use or performance of\r
28   this software.\r
29 */\r
30 \r
31 #if AUX_BOOT_SECTION_SIZE > 0\r
32 #warning Using a AUX bootloader section in addition to the defined bootloader space (see documentation).\r
33 \r
34 ; Trampoline to jump over the AUX bootloader section to the start of the bootloader,\r
35 ; on devices where an AUX bootloader section is used.\r
36 .section .boot_aux_trampoline, "ax"\r
37 .global Boot_AUX_Trampoline\r
38 Boot_AUX_Trampoline:\r
39         jmp BOOT_START_ADDR\r
40 #endif\r
41 \r
42 ; Trampolines to actual API implementations if the target address is outside the\r
43 ; range of a rjmp instruction (can happen with large bootloader sections)\r
44 .section .apitable_trampolines, "ax"\r
45 .global BootloaderAPI_Trampolines\r
46 BootloaderAPI_Trampolines:\r
47 \r
48         BootloaderAPI_ErasePage_Trampoline:\r
49                 jmp BootloaderAPI_ErasePage\r
50         BootloaderAPI_WritePage_Trampoline:\r
51                 jmp BootloaderAPI_WritePage\r
52         BootloaderAPI_FillWord_Trampoline:\r
53                 jmp BootloaderAPI_FillWord\r
54         BootloaderAPI_ReadSignature_Trampoline:\r
55                 jmp BootloaderAPI_ReadSignature\r
56         BootloaderAPI_ReadFuse_Trampoline:\r
57                 jmp BootloaderAPI_ReadFuse\r
58         BootloaderAPI_ReadLock_Trampoline:\r
59                 jmp BootloaderAPI_ReadLock\r
60         BootloaderAPI_WriteLock_Trampoline:\r
61                 jmp BootloaderAPI_WriteLock\r
62         BootloaderAPI_UNUSED1:\r
63                 ret\r
64         BootloaderAPI_UNUSED2:\r
65                 ret\r
66         BootloaderAPI_UNUSED3:\r
67                 ret\r
68         BootloaderAPI_UNUSED4:\r
69                 ret\r
70         BootloaderAPI_UNUSED5:\r
71                 ret\r
72 \r
73 \r
74 \r
75 ; API function jump table\r
76 .section .apitable_jumptable, "ax"\r
77 .global BootloaderAPI_JumpTable\r
78 BootloaderAPI_JumpTable:\r
79 \r
80         rjmp BootloaderAPI_ErasePage_Trampoline\r
81         rjmp BootloaderAPI_WritePage_Trampoline\r
82         rjmp BootloaderAPI_FillWord_Trampoline\r
83         rjmp BootloaderAPI_ReadSignature_Trampoline\r
84         rjmp BootloaderAPI_ReadFuse_Trampoline\r
85         rjmp BootloaderAPI_ReadLock_Trampoline\r
86         rjmp BootloaderAPI_WriteLock_Trampoline\r
87         rjmp BootloaderAPI_UNUSED1 ; UNUSED ENTRY 1\r
88         rjmp BootloaderAPI_UNUSED2 ; UNUSED ENTRY 2\r
89         rjmp BootloaderAPI_UNUSED3 ; UNUSED ENTRY 3\r
90         rjmp BootloaderAPI_UNUSED4 ; UNUSED ENTRY 4\r
91         rjmp BootloaderAPI_UNUSED5 ; UNUSED ENTRY 5\r
92 \r
93 \r
94 \r
95 ; Bootloader table signatures and information\r
96 .section .apitable_signatures, "ax"\r
97 .global BootloaderAPI_Signatures\r
98 BootloaderAPI_Signatures:\r
99 \r
100         .long BOOT_START_ADDR ; Start address of the bootloader\r
101         .word 0xDF30 ; Signature for the MS class bootloader, V1\r
102         .word 0xDCFB ; Signature for a LUFA class bootloader\r