From 151183ed9f4bfdf19db958708ef09810a838d406 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 17 May 2017 16:31:42 +0100 Subject: License and header guard cleanup Fix some of the license headers being GPL2 when the project should be GPL3. Next needs a LICENSE file. Also fix header guards to a more robust _ format. --- asm.h | 24 +++++++++++++++++++++--- crt0.s | 18 ++++++++++++++++++ layout.ld | 18 ++++++++++++++++++ lib/arrlen.h | 6 +++--- lib/cm4.h | 24 +++++++++++++++++++++--- lib/le.c | 24 ++++++++++++------------ lib/le.h | 24 +++++++++++++++++++++--- setup.c | 18 ++++++++++++++++++ uart/uart.c | 18 ++++++++++++++++++ uart/uart.h | 24 +++++++++++++++++++++--- usb/bdt.h | 24 +++++++++++++++++++++--- usb/descriptors.h | 24 +++++++++++++++++++++--- usb/endpt0.c | 18 ++++++++++++++++++ usb/endpt0.h | 24 +++++++++++++++++++++--- usb/endpt1.c | 18 ++++++++++++++++++ usb/endpt1.h | 24 +++++++++++++++++++++--- usb/hid.h | 24 +++++++++++++++++++++--- usb/usb.c | 18 ++++++++++++++++++ usb/usb.h | 24 +++++++++++++++++++++--- vectors.s | 18 ++++++++++++++++++ 20 files changed, 369 insertions(+), 45 deletions(-) diff --git a/asm.h b/asm.h index f638d58..63310b5 100644 --- a/asm.h +++ b/asm.h @@ -1,5 +1,23 @@ -#ifndef ASM_H -#define ASM_H +/* + * asm.h -- ARM thumb assembly instructions + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_ASM_H +#define FMK_ASM_H #include @@ -21,4 +39,4 @@ static inline void set_BASEPRI(uint32_t p) __asm__ volatile ("msr basepri, %0" ::"r"(p)); } -#endif /* ASM_H */ +#endif /* FMK_ASM_H */ diff --git a/crt0.s b/crt0.s index 6949ecc..6ccdad2 100644 --- a/crt0.s +++ b/crt0.s @@ -1,3 +1,21 @@ +/* + * crt0.s -- MK20DX256 initialisation + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ .syntax unified .extern setup diff --git a/layout.ld b/layout.ld index 3be0978..03982c6 100644 --- a/layout.ld +++ b/layout.ld @@ -1,3 +1,21 @@ +/* + * layout.ld -- MK20DX256 memory layout + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ MEMORY { flash : ORIGIN = 0x00000000, LENGTH = 256K ram : ORIGIN = 0x1FFF8000, LENGTH = 64K diff --git a/lib/arrlen.h b/lib/arrlen.h index fdc5532..a687902 100644 --- a/lib/arrlen.h +++ b/lib/arrlen.h @@ -1,6 +1,6 @@ -#ifndef LIB_ARRLEN_H -#define LIB_ARRLEN_H +#ifndef FMK_LIB_ARRLEN_H +#define FMK_LIB_ARRLEN_H #define ARRLEN(a) (sizeof (a) / sizeof (a)[0]) -#endif /* LIB_ARRLEN_H */ +#endif /* FMK_LIB_ARRLEN_H */ diff --git a/lib/cm4.h b/lib/cm4.h index 27c02da..000d249 100644 --- a/lib/cm4.h +++ b/lib/cm4.h @@ -1,5 +1,23 @@ -#ifndef LIB_CM4_H -#define LIB_CM4_H +/* + * lib/cm4.h -- Cortex M4 register definitions + * + * Copyright (C) 2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_LIB_CM4_H +#define FMK_LIB_CM4_H #define CLRPEND(n) REG_32(0xE000E280 + 4 * (n)) #define ISR_CLRPEND(i) CLRPEND((i) / 32) = BV((i) % 32); @@ -9,4 +27,4 @@ #define INTPRI(n) REG_8(0xE000E400 + (n)) -#endif /* LIB_CM4_H */ +#endif /* FMK_LIB_CM4_H */ diff --git a/lib/le.c b/lib/le.c index 47ed5f8..2a1e574 100644 --- a/lib/le.c +++ b/lib/le.c @@ -1,20 +1,20 @@ -/* lib/le.c -- Basic little endian byte order functions +/* + * lib/le.c -- Basic little endian byte order functions * * Copyright (C) 2016 Tomasz Kramkowski * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include diff --git a/lib/le.h b/lib/le.h index a4ebe58..9573d25 100644 --- a/lib/le.h +++ b/lib/le.h @@ -1,5 +1,23 @@ -#ifndef LIB_LE_H -#define LIB_LE_H +/* + * lib/le.h -- Basic little endian byte order functions + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_LIB_LE_H +#define FMK_LIB_LE_H #include @@ -9,4 +27,4 @@ uint32_t le32toh(const void *data); void htole16(void *data, uint16_t value); void htole32(void *data, uint32_t value); -#endif /* LIB_LE_H */ +#endif /* FMK_LIB_LE_H */ diff --git a/setup.c b/setup.c index 71d7d73..fcbce82 100644 --- a/setup.c +++ b/setup.c @@ -1,3 +1,21 @@ +/* + * setup.c -- fmk setup + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include diff --git a/uart/uart.c b/uart/uart.c index a5fd352..ff467eb 100644 --- a/uart/uart.c +++ b/uart/uart.c @@ -1,3 +1,21 @@ +/* + * uart/uart.c -- hardware UART interface + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include diff --git a/uart/uart.h b/uart/uart.h index 2733bb7..bb5c6f7 100644 --- a/uart/uart.h +++ b/uart/uart.h @@ -1,5 +1,23 @@ -#ifndef UART_UART_H -#define UART_UART_H +/* + * uart/uart.h -- hardware UART interface + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_UART_UART_H +#define FMK_UART_UART_H void uart_setup(void); void uart_putchar(int c); @@ -7,4 +25,4 @@ void uart_printf(const char *fmt, ...); void uart_puts(const char *s); void uart0_isr(void); -#endif /* UART_UART_H */ +#endif /* FMK_UART_UART_H */ diff --git a/usb/bdt.h b/usb/bdt.h index f4bc57d..486111d 100644 --- a/usb/bdt.h +++ b/usb/bdt.h @@ -1,5 +1,23 @@ -#ifndef USB_BDT_H -#define USB_BDT_H +/* + * usb/bdt.h -- USB BDT + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_BDT_H +#define FMK_USB_BDT_H #include @@ -10,4 +28,4 @@ extern volatile struct usb0_bd usb_bdt[2][2][2]; #define BDT_EVEN 0 #define BDT_ODD 1 -#endif /* USB_BDT_H */ +#endif /* FMK_USB_BDT_H */ diff --git a/usb/descriptors.h b/usb/descriptors.h index 6ebfded..122ba5c 100644 --- a/usb/descriptors.h +++ b/usb/descriptors.h @@ -1,5 +1,23 @@ -#ifndef USB_DESCRIPTORS_H -#define USB_DESCRIPTORS_H +/* + * usb/descriptors.h -- USB Descriptors + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_DESCRIPTORS_H +#define FMK_USB_DESCRIPTORS_H #include "hid.h" @@ -130,4 +148,4 @@ unsigned char ds_str1[] = { }; _Static_assert(sizeof ds_str1 == DS_STR1_SIZE, "sizeof ds_str1 != DS_STR1_SIZE"); -#endif /* USB_DESCRIPTORS_H */ +#endif /* FMK_USB_DESCRIPTORS_H */ diff --git a/usb/endpt0.c b/usb/endpt0.c index c4c3360..57c994e 100644 --- a/usb/endpt0.c +++ b/usb/endpt0.c @@ -1,3 +1,21 @@ +/* + * usb/endpt0.c -- USB endpoint 0 (control) handling + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include diff --git a/usb/endpt0.h b/usb/endpt0.h index 4ba89ed..706b9f5 100644 --- a/usb/endpt0.h +++ b/usb/endpt0.h @@ -1,5 +1,23 @@ -#ifndef USB_ENDPT0_H -#define USB_ENDPT0_H +/* + * usb/endpt0.h -- USB endpoint 0 (control) handling + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_ENDPT0_H +#define FMK_USB_ENDPT0_H #include @@ -7,4 +25,4 @@ void usb_endpt0_disable(void); void usb_endpt0_enable(void); void usb_endpt0_token(uint8_t state); -#endif /* USB_ENDPT0_H */ +#endif /* FMK_USB_ENDPT0_H */ diff --git a/usb/endpt1.c b/usb/endpt1.c index 65684b5..3139104 100644 --- a/usb/endpt1.c +++ b/usb/endpt1.c @@ -1,3 +1,21 @@ +/* + * usb/endpt1.c -- USB endpoit 1 (HID) handling + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include diff --git a/usb/endpt1.h b/usb/endpt1.h index 9be7522..fa26bd9 100644 --- a/usb/endpt1.h +++ b/usb/endpt1.h @@ -1,8 +1,26 @@ -#ifndef USB_ENDPT1_H -#define USB_ENDPT1_H +/* + * usb/endpt1.h -- USB endpoit 1 (HID) handling + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_ENDPT1_H +#define FMK_USB_ENDPT1_H void usb_endpt1_enable(void); void usb_endpt1_disable(void); void usb_endpt1_token(uint8_t state); -#endif /* USB_ENDPT1_H */ +#endif /* FMK_USB_ENDPT1_H */ diff --git a/usb/hid.h b/usb/hid.h index 949cf8e..102cece 100644 --- a/usb/hid.h +++ b/usb/hid.h @@ -1,5 +1,23 @@ -#ifndef USB_HID_H -#define USB_HID_H +/* + * usb/hid.h -- USB HID definitions + * + * Copyright (C) 2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_HID_H +#define FMK_USB_HID_H #define SHORT_ITEM(tag, type, size) (((tag) & 0xf) << 4 | \ ((type) & 0x3) << 2 | \ @@ -84,4 +102,4 @@ #define HR_BIT_FIELD (0) #define HR_BUFFERED_BYTES (1 << 8) -#endif /* USB_HID_H */ +#endif /* FMK_USB_HID_H */ diff --git a/usb/usb.c b/usb/usb.c index 5a76825..5f00fe0 100644 --- a/usb/usb.c +++ b/usb/usb.c @@ -1,3 +1,21 @@ +/* + * usb/usb.c -- USB 2.0 implementation + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include #include #include diff --git a/usb/usb.h b/usb/usb.h index 64d0585..1d84968 100644 --- a/usb/usb.h +++ b/usb/usb.h @@ -1,7 +1,25 @@ -#ifndef USB_H -#define USB_H +/* + * usb/usb.h -- USB 2.0 implementation + * + * Copyright (C) 2016 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FMK_USB_H +#define FMK_USB_H void usb_setup(void); void usb_isr(void); -#endif /* USB_H */ +#endif /* FMK_USB_H */ diff --git a/vectors.s b/vectors.s index ae53c35..794d194 100644 --- a/vectors.s +++ b/vectors.s @@ -1,3 +1,21 @@ +/* + * vectors.s -- fmk interrupt vector table + * + * Copyright (C) 2016-2017 Tomasz Kramkowski + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ .syntax unified .section ".vectors" -- cgit v1.2.3-54-g00ecf