diff options
Diffstat (limited to 'lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID')
16 files changed, 2713 insertions, 0 deletions
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/.skip b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/.skip new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/.skip | |||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/Makefile b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/Makefile new file mode 100644 index 000000000..67c3dd7e1 --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/Makefile | |||
@@ -0,0 +1,33 @@ | |||
1 | HIDAPI_HEADER_PATH = /usr/local/include/hidapi | ||
2 | |||
3 | CC=gcc | ||
4 | IFLAGS=-I$(HIDAPI_HEADER_PATH) | ||
5 | LDLIBS=-lhidapi | ||
6 | CFLAGS = -Wall -Wextra -O2 -g $(IFLAGS) | ||
7 | |||
8 | BUILDDIR = ./build | ||
9 | DEPDIR = ./.dep | ||
10 | |||
11 | SRCS = $(wildcard *.c) | ||
12 | OBJS = $(SRCS:%.c=$(BUILDDIR)/%.o) | ||
13 | EXE = $(BUILDDIR)/test-usb-hid | ||
14 | |||
15 | all: $(EXE) | ||
16 | |||
17 | $(EXE): $(OBJS) | ||
18 | |||
19 | -include $(subst .c,.d,$(SRCS)) | ||
20 | |||
21 | $(BUILDDIR)/%.o: %.o | ||
22 | mv $^ $@ | ||
23 | |||
24 | $(DEPDIR)/%.d: %.c | ||
25 | $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -MM -MF $@ -MP -MT $(subst .c,.o,$<) $< | ||
26 | |||
27 | clean: | ||
28 | rm -f $(EXE) | ||
29 | rm -f $(OBJS) | ||
30 | rm -f $(subst .c,.d,$(SRCS)) | ||
31 | rm -f *~ | ||
32 | |||
33 | .PHONY: clean all | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/test-usb-hid.c b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/test-usb-hid.c new file mode 100644 index 000000000..863c44d4b --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/darwin/test-usb-hid.c | |||
@@ -0,0 +1,177 @@ | |||
1 | /* | ||
2 | Copyright (c) 2014 Guillaume Duc <[email protected]> | ||
3 | Modifications copyright (c) 2020 Alex Lewontin <[email protected]> | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in all | ||
13 | copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | SOFTWARE. | ||
22 | |||
23 | */ | ||
24 | |||
25 | #include "hidapi.h" | ||
26 | |||
27 | #include <assert.h> | ||
28 | #include <errno.h> | ||
29 | #include <fcntl.h> | ||
30 | #include <stdint.h> | ||
31 | #include <stdio.h> | ||
32 | #include <stdlib.h> | ||
33 | #include <string.h> | ||
34 | #include <sys/ioctl.h> | ||
35 | #include <sys/signal.h> | ||
36 | #include <sys/stat.h> | ||
37 | #include <sys/types.h> | ||
38 | #include <unistd.h> | ||
39 | |||
40 | #define USB_HID_IN_REPORT_SIZE 1 | ||
41 | #define USB_HID_OUT_REPORT_SIZE 1 | ||
42 | |||
43 | struct usb_hid_in_report_s { | ||
44 | uint8_t sequence_number; | ||
45 | }; | ||
46 | |||
47 | struct usb_hid_out_report_s { | ||
48 | uint8_t sequence_number; | ||
49 | }; | ||
50 | |||
51 | static uint8_t usb_hid_in_report_buf[USB_HID_IN_REPORT_SIZE]; | ||
52 | /* +1 for the report index */ | ||
53 | static uint8_t usb_hid_out_report_buf[USB_HID_OUT_REPORT_SIZE + 1]; | ||
54 | |||
55 | static struct usb_hid_in_report_s* usb_hid_in_report = | ||
56 | (struct usb_hid_in_report_s*)usb_hid_in_report_buf; | ||
57 | |||
58 | static struct usb_hid_out_report_s* usb_hid_out_report = | ||
59 | (struct usb_hid_out_report_s*)(&usb_hid_out_report_buf[1]); | ||
60 | |||
61 | static hid_device* handle; | ||
62 | |||
63 | static void close_hidapi() __attribute__((noreturn)); | ||
64 | static void close_client() __attribute__((noreturn)); | ||
65 | |||
66 | static void read_in_report() | ||
67 | { | ||
68 | int res, i; | ||
69 | |||
70 | printf("read()\n"); | ||
71 | res = hid_read(handle, usb_hid_in_report_buf, USB_HID_IN_REPORT_SIZE); | ||
72 | if (res < 0) { | ||
73 | perror("read"); | ||
74 | exit(EXIT_FAILURE); | ||
75 | } else { | ||
76 | printf("read() read %d bytes:\t", res); | ||
77 | for (i = 0; i < res; i++) | ||
78 | printf("%02hhx ", usb_hid_in_report_buf[i]); | ||
79 | printf("\n"); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | static void send_out_report() | ||
84 | { | ||
85 | int res; | ||
86 | |||
87 | usb_hid_out_report_buf[0] = 0; | ||
88 | |||
89 | res = | ||
90 | hid_write(handle, usb_hid_out_report_buf, USB_HID_OUT_REPORT_SIZE + 1); | ||
91 | if (res < 0) { | ||
92 | perror("write"); | ||
93 | exit(EXIT_FAILURE); | ||
94 | } | ||
95 | |||
96 | usb_hid_out_report->sequence_number++; | ||
97 | } | ||
98 | |||
99 | static void close_hidapi() | ||
100 | { | ||
101 | int res = hid_exit(); | ||
102 | if (res) { | ||
103 | perror("Could not close hidapi library"); | ||
104 | exit(EXIT_FAILURE); | ||
105 | } | ||
106 | exit(EXIT_SUCCESS); | ||
107 | } | ||
108 | |||
109 | static void close_client() | ||
110 | { | ||
111 | hid_close(handle); | ||
112 | close_hidapi(); | ||
113 | } | ||
114 | |||
115 | int main(int argc, char** argv) | ||
116 | { | ||
117 | int res; | ||
118 | unsigned long vid, pid; | ||
119 | struct hid_device_info *devs, *cur_dev; | ||
120 | |||
121 | if (argc < 2) { | ||
122 | fprintf(stderr, "Usage: %s [VID] [PID]\n", argv[0]); | ||
123 | exit(EXIT_FAILURE); | ||
124 | } | ||
125 | vid = strtoul(argv[1], NULL, 16); | ||
126 | pid = strtoul(argv[2], NULL, 16); | ||
127 | |||
128 | devs = hid_enumerate(0x0, 0x0); | ||
129 | cur_dev = devs; | ||
130 | while (cur_dev) { | ||
131 | printf("Device Found\n type: %04hx %04hx\n path: %s\n serial_number: " | ||
132 | "%ls", | ||
133 | cur_dev->vendor_id, | ||
134 | cur_dev->product_id, | ||
135 | cur_dev->path, | ||
136 | cur_dev->serial_number); | ||
137 | printf("\n"); | ||
138 | printf(" Manufacturer: %ls\n", cur_dev->manufacturer_string); | ||
139 | printf(" Product: %ls\n", cur_dev->product_string); | ||
140 | printf(" Release: %hx\n", cur_dev->release_number); | ||
141 | printf(" Interface: %d\n", cur_dev->interface_number); | ||
142 | printf(" Usage (page): 0x%hx (0x%hx)\n", | ||
143 | cur_dev->usage, | ||
144 | cur_dev->usage_page); | ||
145 | printf("\n"); | ||
146 | cur_dev = cur_dev->next; | ||
147 | } | ||
148 | hid_free_enumeration(devs); | ||
149 | |||
150 | /* Make sure we clean up on CTRL-C interrupt */ | ||
151 | signal(SIGINT, close_client); | ||
152 | |||
153 | res = hid_init(); | ||
154 | if (res) { | ||
155 | perror("Could not load hidapi library"); | ||
156 | exit(EXIT_FAILURE); | ||
157 | } | ||
158 | handle = hid_open(vid, pid, NULL); | ||
159 | if (!handle) { | ||
160 | perror("Unable to open device"); | ||
161 | close_hidapi(); | ||
162 | exit(EXIT_FAILURE); | ||
163 | } | ||
164 | |||
165 | usb_hid_out_report->sequence_number = 4; | ||
166 | send_out_report(); | ||
167 | |||
168 | while (1) { | ||
169 | read_in_report(); | ||
170 | |||
171 | if (usb_hid_in_report->sequence_number == 40) { | ||
172 | usb_hid_out_report->sequence_number = | ||
173 | usb_hid_in_report->sequence_number / 2; | ||
174 | send_out_report(); | ||
175 | } | ||
176 | } | ||
177 | } | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/Makefile b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/Makefile new file mode 100644 index 000000000..ed84ee9aa --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/Makefile | |||
@@ -0,0 +1,23 @@ | |||
1 | CC=gcc | ||
2 | CFLAGS = -Wall -Wextra -O2 -g | ||
3 | |||
4 | SRCS = $(wildcard *.c) | ||
5 | OBJS = $(SRCS:%.c=%.o) | ||
6 | EXE = test-usb-hid | ||
7 | |||
8 | all: $(EXE) | ||
9 | |||
10 | $(EXE): $(OBJS) | ||
11 | |||
12 | -include $(subst .c,.d,$(SRCS)) | ||
13 | |||
14 | %.d: %.c | ||
15 | $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -MM -MF $@ -MP -MT $(subst .c,.o,$<) $< | ||
16 | |||
17 | clean: | ||
18 | rm -f $(EXE) | ||
19 | rm -f $(OBJS) | ||
20 | rm -f $(subst .c,.d,$(SRCS)) | ||
21 | rm -f *~ | ||
22 | |||
23 | .PHONY: clean all | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/test-usb-hid.c b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/test-usb-hid.c new file mode 100644 index 000000000..ee79be209 --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/test-usb-hid.c | |||
@@ -0,0 +1,161 @@ | |||
1 | /* | ||
2 | |||
3 | Copyright (c) 2014 Guillaume Duc <[email protected]> | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in all | ||
13 | copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
21 | SOFTWARE. | ||
22 | |||
23 | */ | ||
24 | |||
25 | #include <assert.h> | ||
26 | #include <errno.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <linux/hidraw.h> | ||
29 | #include <linux/input.h> | ||
30 | #include <linux/types.h> | ||
31 | #include <stdint.h> | ||
32 | #include <stdio.h> | ||
33 | #include <stdlib.h> | ||
34 | #include <string.h> | ||
35 | #include <sys/ioctl.h> | ||
36 | #include <sys/stat.h> | ||
37 | #include <sys/types.h> | ||
38 | #include <unistd.h> | ||
39 | |||
40 | #define USB_HID_IN_REPORT_SIZE 1 | ||
41 | #define USB_HID_OUT_REPORT_SIZE 1 | ||
42 | |||
43 | struct usb_hid_in_report_s { | ||
44 | uint8_t sequence_number; | ||
45 | }; | ||
46 | |||
47 | struct usb_hid_out_report_s { | ||
48 | uint8_t sequence_number; | ||
49 | }; | ||
50 | |||
51 | static uint8_t usb_hid_in_report_buf[USB_HID_IN_REPORT_SIZE]; | ||
52 | /* +1 for the report index */ | ||
53 | static uint8_t usb_hid_out_report_buf[USB_HID_OUT_REPORT_SIZE + 1]; | ||
54 | |||
55 | static struct usb_hid_in_report_s* usb_hid_in_report = | ||
56 | (struct usb_hid_in_report_s*)usb_hid_in_report_buf; | ||
57 | |||
58 | static struct usb_hid_out_report_s* usb_hid_out_report = | ||
59 | (struct usb_hid_out_report_s*)(&usb_hid_out_report_buf[1]); | ||
60 | |||
61 | static int usb_hid_fd; | ||
62 | static uint8_t wkup_pb_old_value = 0; | ||
63 | |||
64 | static void read_in_report() | ||
65 | { | ||
66 | int res, i; | ||
67 | |||
68 | printf("read()\n"); | ||
69 | res = read(usb_hid_fd, usb_hid_in_report_buf, USB_HID_IN_REPORT_SIZE); | ||
70 | if (res < 0) { | ||
71 | perror("read"); | ||
72 | exit(EXIT_FAILURE); | ||
73 | } else { | ||
74 | printf("read() read %d bytes:\t", res); | ||
75 | for (i = 0; i < res; i++) | ||
76 | printf("%02hhx ", usb_hid_in_report_buf[i]); | ||
77 | printf("\n"); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | static void send_out_report() | ||
82 | { | ||
83 | int res; | ||
84 | |||
85 | usb_hid_out_report_buf[0] = 0; | ||
86 | |||
87 | res = write(usb_hid_fd, usb_hid_out_report_buf, USB_HID_OUT_REPORT_SIZE + 1); | ||
88 | if (res < 0) { | ||
89 | perror("write"); | ||
90 | exit(EXIT_FAILURE); | ||
91 | } | ||
92 | |||
93 | usb_hid_out_report->sequence_number++; | ||
94 | } | ||
95 | |||
96 | static void usb_hid_init(const char* dev_name) | ||
97 | { | ||
98 | int i, res; | ||
99 | int desc_size = 0; | ||
100 | char buf[256]; | ||
101 | |||
102 | struct hidraw_report_descriptor rpt_desc; | ||
103 | struct hidraw_devinfo info; | ||
104 | |||
105 | usb_hid_fd = open(dev_name, O_RDWR); | ||
106 | |||
107 | if (usb_hid_fd < 0) { | ||
108 | perror("Unable to open device"); | ||
109 | exit(EXIT_FAILURE); | ||
110 | } | ||
111 | |||
112 | memset(&rpt_desc, 0x0, sizeof(rpt_desc)); | ||
113 | memset(&info, 0x0, sizeof(info)); | ||
114 | memset(buf, 0x0, sizeof(buf)); | ||
115 | |||
116 | /* Get Report Descriptor Size */ | ||
117 | res = ioctl(usb_hid_fd, HIDIOCGRDESCSIZE, &desc_size); | ||
118 | if (res < 0) | ||
119 | perror("HIDIOCGRDESCSIZE"); | ||
120 | else | ||
121 | printf("Report Descriptor Size: %d\n", desc_size); | ||
122 | |||
123 | /* Get Report Descriptor */ | ||
124 | rpt_desc.size = desc_size; | ||
125 | res = ioctl(usb_hid_fd, HIDIOCGRDESC, &rpt_desc); | ||
126 | if (res < 0) { | ||
127 | perror("HIDIOCGRDESC"); | ||
128 | } else { | ||
129 | printf("Report Descriptor:\n"); | ||
130 | for (i = 0; i < rpt_desc.size; i++) | ||
131 | printf("%02hhx ", rpt_desc.value[i]); | ||
132 | puts("\n"); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | int main(int argc, char** argv) | ||
137 | { | ||
138 | if (argc < 2) { | ||
139 | fprintf(stderr, "Usage: %s /dev/hidrawX\n", argv[0]); | ||
140 | return EXIT_FAILURE; | ||
141 | } | ||
142 | |||
143 | memset(usb_hid_out_report_buf, 0, sizeof(usb_hid_out_report_buf)); | ||
144 | |||
145 | usb_hid_init(argv[1]); | ||
146 | usb_hid_out_report->sequence_number = 4; | ||
147 | send_out_report(); | ||
148 | |||
149 | while (1) { | ||
150 | read_in_report(); | ||
151 | |||
152 | if (usb_hid_in_report->sequence_number == 40) { | ||
153 | usb_hid_out_report->sequence_number = usb_hid_in_report->sequence_number / 2; | ||
154 | send_out_report(); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | close(usb_hid_fd); | ||
159 | |||
160 | return EXIT_SUCCESS; | ||
161 | } | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/udev.rules b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/udev.rules new file mode 100644 index 000000000..8c93f15bb --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Client/linux/udev.rules | |||
@@ -0,0 +1,2 @@ | |||
1 | SUBSYSTEM=="usb", ATTR{idVendor}=="0179", ATTR{idProduct}=="0002", MODE:="0666" | ||
2 | KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="0179", ATTRS{idProduct}=="0002", MODE:="0666" | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Makefile b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Makefile new file mode 100644 index 000000000..790106352 --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/Makefile | |||
@@ -0,0 +1,205 @@ | |||
1 | ############################################################################## | ||
2 | # Build global options | ||
3 | # NOTE: Can be overridden externally. | ||
4 | # | ||
5 | # Compiler options here. | ||
6 | ifeq ($(USE_OPT),) | ||
7 | USE_OPT = -ggdb3 -g3 -gdwarf-3 -gstrict-dwarf -fomit-frame-pointer -falign-functions=16 -pedantic -Wextra -Wall | ||
8 | endif | ||
9 | |||
10 | # C specific options here (added to USE_OPT). | ||
11 | ifeq ($(USE_COPT),) | ||
12 | USE_COPT = | ||
13 | endif | ||
14 | |||
15 | # C++ specific options here (added to USE_OPT). | ||
16 | ifeq ($(USE_CPPOPT),) | ||
17 | USE_CPPOPT = -fno-rtti | ||
18 | endif | ||
19 | |||
20 | # Enable this if you want the linker to remove unused code and data. | ||
21 | ifeq ($(USE_LINK_GC),) | ||
22 | USE_LINK_GC = yes | ||
23 | endif | ||
24 | |||
25 | # Linker extra options here. | ||
26 | ifeq ($(USE_LDOPT),) | ||
27 | USE_LDOPT = | ||
28 | endif | ||
29 | |||
30 | # Enable this if you want link time optimizations (LTO). | ||
31 | ifeq ($(USE_LTO),) | ||
32 | USE_LTO = yes | ||
33 | endif | ||
34 | |||
35 | # Enable this if you want to see the full log while compiling. | ||
36 | ifeq ($(USE_VERBOSE_COMPILE),) | ||
37 | USE_VERBOSE_COMPILE = no | ||
38 | endif | ||
39 | |||
40 | # If enabled, this option makes the build process faster by not compiling | ||
41 | # modules not used in the current configuration. | ||
42 | ifeq ($(USE_SMART_BUILD),) | ||
43 | USE_SMART_BUILD = yes | ||
44 | endif | ||
45 | |||
46 | # | ||
47 | # Build global options | ||
48 | ############################################################################## | ||
49 | |||
50 | ############################################################################## | ||
51 | # Architecture or project specific options | ||
52 | # | ||
53 | |||
54 | # Stack size to be allocated to the Cortex-M process stack. This stack is | ||
55 | # the stack used by the main() thread. | ||
56 | ifeq ($(USE_PROCESS_STACKSIZE),) | ||
57 | USE_PROCESS_STACKSIZE = 0x400 | ||
58 | endif | ||
59 | |||
60 | # Stack size to the allocated to the Cortex-M main/exceptions stack. This | ||
61 | # stack is used for processing interrupts and exceptions. | ||
62 | ifeq ($(USE_EXCEPTIONS_STACKSIZE),) | ||
63 | USE_EXCEPTIONS_STACKSIZE = 0x400 | ||
64 | endif | ||
65 | |||
66 | # Enables the use of FPU (no, softfp, hard). | ||
67 | ifeq ($(USE_FPU),) | ||
68 | USE_FPU = no | ||
69 | endif | ||
70 | |||
71 | # FPU-related options. | ||
72 | ifeq ($(USE_FPU_OPT),) | ||
73 | USE_FPU_OPT = -mfloat-abi=$(USE_FPU) -mfpu=fpv4-sp-d16 | ||
74 | endif | ||
75 | |||
76 | # | ||
77 | # Architecture or project specific options | ||
78 | ############################################################################## | ||
79 | |||
80 | ############################################################################## | ||
81 | # Project, target, sources and paths | ||
82 | # | ||
83 | |||
84 | # Define project name here | ||
85 | PROJECT = ch | ||
86 | |||
87 | # Target settings. | ||
88 | MCU = cortex-m0 | ||
89 | |||
90 | # Imported source files and paths. | ||
91 | BASE_PATH := ../../../../../../.. | ||
92 | CHIBIOS := $(BASE_PATH)/ChibiOS/ChibiOS | ||
93 | CHIBIOS_CONTRIB := $(BASE_PATH)/ChibiOS/ChibiOS-Contrib | ||
94 | CONFDIR := ./cfg | ||
95 | BUILDDIR := ./build | ||
96 | DEPDIR := ./.dep | ||
97 | |||
98 | # Licensing files. | ||
99 | include $(CHIBIOS)/os/license/license.mk | ||
100 | # Startup files. | ||
101 | include $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_NUC123.mk | ||
102 | # HAL-OSAL files (optional). | ||
103 | #include $(CHIBIOS)/os/hal/hal.mk | ||
104 | include $(CHIBIOS_CONTRIB)/os/hal/hal.mk | ||
105 | include $(CHIBIOS_CONTRIB)/os/hal/ports/NUMICRO/NUC123/platform.mk | ||
106 | include $(CHIBIOS_CONTRIB)/os/hal/boards/NUTINY-SDK-NUC123-V2.0/board.mk | ||
107 | include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk | ||
108 | # RTOS files (optional). | ||
109 | include $(CHIBIOS)/os/rt/rt.mk | ||
110 | #include $(CHIBIOS)/os/common/ports/ARMv6-M/compilers/GCC/mk/port.mk | ||
111 | include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v6m.mk | ||
112 | # Auto-build files in ./source recursively. | ||
113 | include $(CHIBIOS)/tools/mk/autobuild.mk | ||
114 | # Other files (optional). | ||
115 | #include $(CHIBIOS)/os/hal/lib/streams/streams.mk | ||
116 | |||
117 | # Define linker script file here | ||
118 | LDSCRIPT= $(STARTUPLD_CONTRIB)/NUC123xD4xx0.ld | ||
119 | |||
120 | # C sources that can be compiled in ARM or THUMB mode depending on the global | ||
121 | # setting. | ||
122 | CSRC = $(ALLCSRC) \ | ||
123 | $(TESTSRC) \ | ||
124 | usbcfg.c \ | ||
125 | main.c | ||
126 | |||
127 | # C++ sources that can be compiled in ARM or THUMB mode depending on the global | ||
128 | # setting. | ||
129 | CPPSRC = $(ALLCPPSRC) | ||
130 | |||
131 | # List ASM source files here. | ||
132 | ASMSRC = $(ALLASMSRC) | ||
133 | |||
134 | # List ASM with preprocessor source files here. | ||
135 | ASMXSRC = $(ALLXASMSRC) | ||
136 | |||
137 | # Inclusion directories. | ||
138 | INCDIR = $(CONFDIR) $(ALLINC) $(TESTINC) | ||
139 | |||
140 | # Define C warning options here. | ||
141 | CWARN = -Wall -Wextra -Wundef -Wstrict-prototypes | ||
142 | |||
143 | # Define C++ warning options here. | ||
144 | CPPWARN = -Wall -Wextra -Wundef | ||
145 | |||
146 | # | ||
147 | # Project, target, sources and paths | ||
148 | ############################################################################## | ||
149 | |||
150 | ############################################################################## | ||
151 | # Start of user section | ||
152 | # | ||
153 | |||
154 | # List all user C define here, like -D_DEBUG=1 | ||
155 | UDEFS = | ||
156 | |||
157 | # Define ASM defines here | ||
158 | UADEFS = | ||
159 | |||
160 | # List all user directories here | ||
161 | UINCDIR = | ||
162 | |||
163 | # List the user directory to look for the libraries here | ||
164 | ULIBDIR = | ||
165 | |||
166 | # List all user libraries here | ||
167 | ULIBS = | ||
168 | |||
169 | # | ||
170 | # End of user section | ||
171 | ############################################################################## | ||
172 | |||
173 | ############################################################################## | ||
174 | # Common rules | ||
175 | # | ||
176 | |||
177 | RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk | ||
178 | include $(RULESPATH)/arm-none-eabi.mk | ||
179 | include $(RULESPATH)/rules.mk | ||
180 | |||
181 | # | ||
182 | # Common rules | ||
183 | ############################################################################## | ||
184 | |||
185 | ############################################################################## | ||
186 | # Custom rules | ||
187 | # | ||
188 | |||
189 | READLINK:=greadlink | ||
190 | OPENOCD:=$(shell $(READLINK) -f `which openocd`) | ||
191 | OPENOCDPATH:=$(shell dirname $(OPENOCD))/../share/openocd | ||
192 | |||
193 | install-openocd-config: | ||
194 | rm $(OPENOCDPATH)/scripts/target/numicroM0.cfg && cp numicroM0.cfg $(OPENOCDPATH)/scripts/target/ | ||
195 | |||
196 | connect: | ||
197 | openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg | ||
198 | |||
199 | flash: $(BUILDDIR)/$(PROJECT).elf | ||
200 | openocd -f ../scripts/interface/nulink.cfg -f ../scripts/target/numicroM0.cfg -c "program $< reset exit" | ||
201 | |||
202 | |||
203 | # | ||
204 | # Custom rules | ||
205 | ############################################################################## | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/chconf.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/chconf.h new file mode 100644 index 000000000..fcd9fb9fd --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/chconf.h | |||
@@ -0,0 +1,766 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file rt/templates/chconf.h | ||
19 | * @brief Configuration file template. | ||
20 | * @details A copy of this file must be placed in each project directory, it | ||
21 | * contains the application specific kernel settings. | ||
22 | * | ||
23 | * @addtogroup config | ||
24 | * @details Kernel related settings and hooks. | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef CHCONF_H | ||
29 | #define CHCONF_H | ||
30 | |||
31 | #define _CHIBIOS_RT_CONF_ | ||
32 | #define _CHIBIOS_RT_CONF_VER_6_1_ | ||
33 | |||
34 | /*===========================================================================*/ | ||
35 | /** | ||
36 | * @name System timers settings | ||
37 | * @{ | ||
38 | */ | ||
39 | /*===========================================================================*/ | ||
40 | |||
41 | /** | ||
42 | * @brief System time counter resolution. | ||
43 | * @note Allowed values are 16, 32 or 64 bits. | ||
44 | */ | ||
45 | #if !defined(CH_CFG_ST_RESOLUTION) | ||
46 | #define CH_CFG_ST_RESOLUTION 32 | ||
47 | #endif | ||
48 | |||
49 | /** | ||
50 | * @brief System tick frequency. | ||
51 | * @details Frequency of the system timer that drives the system ticks. This | ||
52 | * setting also defines the system tick time unit. | ||
53 | */ | ||
54 | #if !defined(CH_CFG_ST_FREQUENCY) | ||
55 | #define CH_CFG_ST_FREQUENCY 10000 | ||
56 | #endif | ||
57 | |||
58 | /** | ||
59 | * @brief Time intervals data size. | ||
60 | * @note Allowed values are 16, 32 or 64 bits. | ||
61 | */ | ||
62 | #if !defined(CH_CFG_INTERVALS_SIZE) | ||
63 | #define CH_CFG_INTERVALS_SIZE 32 | ||
64 | #endif | ||
65 | |||
66 | /** | ||
67 | * @brief Time types data size. | ||
68 | * @note Allowed values are 16 or 32 bits. | ||
69 | */ | ||
70 | #if !defined(CH_CFG_TIME_TYPES_SIZE) | ||
71 | #define CH_CFG_TIME_TYPES_SIZE 32 | ||
72 | #endif | ||
73 | |||
74 | /** | ||
75 | * @brief Time delta constant for the tick-less mode. | ||
76 | * @note If this value is zero then the system uses the classic | ||
77 | * periodic tick. This value represents the minimum number | ||
78 | * of ticks that is safe to specify in a timeout directive. | ||
79 | * The value one is not valid, timeouts are rounded up to | ||
80 | * this value. | ||
81 | */ | ||
82 | #if !defined(CH_CFG_ST_TIMEDELTA) | ||
83 | #define CH_CFG_ST_TIMEDELTA 0 | ||
84 | #endif | ||
85 | |||
86 | /** @} */ | ||
87 | |||
88 | /*===========================================================================*/ | ||
89 | /** | ||
90 | * @name Kernel parameters and options | ||
91 | * @{ | ||
92 | */ | ||
93 | /*===========================================================================*/ | ||
94 | |||
95 | /** | ||
96 | * @brief Round robin interval. | ||
97 | * @details This constant is the number of system ticks allowed for the | ||
98 | * threads before preemption occurs. Setting this value to zero | ||
99 | * disables the preemption for threads with equal priority and the | ||
100 | * round robin becomes cooperative. Note that higher priority | ||
101 | * threads can still preempt, the kernel is always preemptive. | ||
102 | * @note Disabling the round robin preemption makes the kernel more compact | ||
103 | * and generally faster. | ||
104 | * @note The round robin preemption is not supported in tickless mode and | ||
105 | * must be set to zero in that case. | ||
106 | */ | ||
107 | #if !defined(CH_CFG_TIME_QUANTUM) | ||
108 | #define CH_CFG_TIME_QUANTUM 0 | ||
109 | #endif | ||
110 | |||
111 | /** | ||
112 | * @brief Idle thread automatic spawn suppression. | ||
113 | * @details When this option is activated the function @p chSysInit() | ||
114 | * does not spawn the idle thread. The application @p main() | ||
115 | * function becomes the idle thread and must implement an | ||
116 | * infinite loop. | ||
117 | */ | ||
118 | #if !defined(CH_CFG_NO_IDLE_THREAD) | ||
119 | #define CH_CFG_NO_IDLE_THREAD FALSE | ||
120 | #endif | ||
121 | |||
122 | /** @} */ | ||
123 | |||
124 | /*===========================================================================*/ | ||
125 | /** | ||
126 | * @name Performance options | ||
127 | * @{ | ||
128 | */ | ||
129 | /*===========================================================================*/ | ||
130 | |||
131 | /** | ||
132 | * @brief OS optimization. | ||
133 | * @details If enabled then time efficient rather than space efficient code | ||
134 | * is used when two possible implementations exist. | ||
135 | * | ||
136 | * @note This is not related to the compiler optimization options. | ||
137 | * @note The default is @p TRUE. | ||
138 | */ | ||
139 | #if !defined(CH_CFG_OPTIMIZE_SPEED) | ||
140 | #define CH_CFG_OPTIMIZE_SPEED TRUE | ||
141 | #endif | ||
142 | |||
143 | /** @} */ | ||
144 | |||
145 | /*===========================================================================*/ | ||
146 | /** | ||
147 | * @name Subsystem options | ||
148 | * @{ | ||
149 | */ | ||
150 | /*===========================================================================*/ | ||
151 | |||
152 | /** | ||
153 | * @brief Time Measurement APIs. | ||
154 | * @details If enabled then the time measurement APIs are included in | ||
155 | * the kernel. | ||
156 | * | ||
157 | * @note The default is @p TRUE. | ||
158 | */ | ||
159 | #if !defined(CH_CFG_USE_TM) | ||
160 | #define CH_CFG_USE_TM FALSE | ||
161 | #endif | ||
162 | |||
163 | /** | ||
164 | * @brief Threads registry APIs. | ||
165 | * @details If enabled then the registry APIs are included in the kernel. | ||
166 | * | ||
167 | * @note The default is @p TRUE. | ||
168 | */ | ||
169 | #if !defined(CH_CFG_USE_REGISTRY) | ||
170 | #define CH_CFG_USE_REGISTRY FALSE | ||
171 | #endif | ||
172 | |||
173 | /** | ||
174 | * @brief Threads synchronization APIs. | ||
175 | * @details If enabled then the @p chThdWait() function is included in | ||
176 | * the kernel. | ||
177 | * | ||
178 | * @note The default is @p TRUE. | ||
179 | */ | ||
180 | #if !defined(CH_CFG_USE_WAITEXIT) | ||
181 | #define CH_CFG_USE_WAITEXIT TRUE | ||
182 | #endif | ||
183 | |||
184 | /** | ||
185 | * @brief Semaphores APIs. | ||
186 | * @details If enabled then the Semaphores APIs are included in the kernel. | ||
187 | * | ||
188 | * @note The default is @p TRUE. | ||
189 | */ | ||
190 | #if !defined(CH_CFG_USE_SEMAPHORES) | ||
191 | #define CH_CFG_USE_SEMAPHORES FALSE | ||
192 | #endif | ||
193 | |||
194 | /** | ||
195 | * @brief Semaphores queuing mode. | ||
196 | * @details If enabled then the threads are enqueued on semaphores by | ||
197 | * priority rather than in FIFO order. | ||
198 | * | ||
199 | * @note The default is @p FALSE. Enable this if you have special | ||
200 | * requirements. | ||
201 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
202 | */ | ||
203 | #if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) | ||
204 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE | ||
205 | #endif | ||
206 | |||
207 | /** | ||
208 | * @brief Mutexes APIs. | ||
209 | * @details If enabled then the mutexes APIs are included in the kernel. | ||
210 | * | ||
211 | * @note The default is @p TRUE. | ||
212 | */ | ||
213 | #if !defined(CH_CFG_USE_MUTEXES) | ||
214 | #define CH_CFG_USE_MUTEXES TRUE | ||
215 | #endif | ||
216 | |||
217 | /** | ||
218 | * @brief Enables recursive behavior on mutexes. | ||
219 | * @note Recursive mutexes are heavier and have an increased | ||
220 | * memory footprint. | ||
221 | * | ||
222 | * @note The default is @p FALSE. | ||
223 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
224 | */ | ||
225 | #if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) | ||
226 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE | ||
227 | #endif | ||
228 | |||
229 | /** | ||
230 | * @brief Conditional Variables APIs. | ||
231 | * @details If enabled then the conditional variables APIs are included | ||
232 | * in the kernel. | ||
233 | * | ||
234 | * @note The default is @p TRUE. | ||
235 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
236 | */ | ||
237 | #if !defined(CH_CFG_USE_CONDVARS) | ||
238 | #define CH_CFG_USE_CONDVARS FALSE | ||
239 | #endif | ||
240 | |||
241 | /** | ||
242 | * @brief Conditional Variables APIs with timeout. | ||
243 | * @details If enabled then the conditional variables APIs with timeout | ||
244 | * specification are included in the kernel. | ||
245 | * | ||
246 | * @note The default is @p TRUE. | ||
247 | * @note Requires @p CH_CFG_USE_CONDVARS. | ||
248 | */ | ||
249 | #if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) | ||
250 | #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE | ||
251 | #endif | ||
252 | |||
253 | /** | ||
254 | * @brief Events Flags APIs. | ||
255 | * @details If enabled then the event flags APIs are included in the kernel. | ||
256 | * | ||
257 | * @note The default is @p TRUE. | ||
258 | */ | ||
259 | #if !defined(CH_CFG_USE_EVENTS) | ||
260 | #define CH_CFG_USE_EVENTS FALSE | ||
261 | #endif | ||
262 | |||
263 | /** | ||
264 | * @brief Events Flags APIs with timeout. | ||
265 | * @details If enabled then the events APIs with timeout specification | ||
266 | * are included in the kernel. | ||
267 | * | ||
268 | * @note The default is @p TRUE. | ||
269 | * @note Requires @p CH_CFG_USE_EVENTS. | ||
270 | */ | ||
271 | #if !defined(CH_CFG_USE_EVENTS_TIMEOUT) | ||
272 | #define CH_CFG_USE_EVENTS_TIMEOUT FALSE | ||
273 | #endif | ||
274 | |||
275 | /** | ||
276 | * @brief Synchronous Messages APIs. | ||
277 | * @details If enabled then the synchronous messages APIs are included | ||
278 | * in the kernel. | ||
279 | * | ||
280 | * @note The default is @p TRUE. | ||
281 | */ | ||
282 | #if !defined(CH_CFG_USE_MESSAGES) | ||
283 | #define CH_CFG_USE_MESSAGES FALSE | ||
284 | #endif | ||
285 | |||
286 | /** | ||
287 | * @brief Synchronous Messages queuing mode. | ||
288 | * @details If enabled then messages are served by priority rather than in | ||
289 | * FIFO order. | ||
290 | * | ||
291 | * @note The default is @p FALSE. Enable this if you have special | ||
292 | * requirements. | ||
293 | * @note Requires @p CH_CFG_USE_MESSAGES. | ||
294 | */ | ||
295 | #if !defined(CH_CFG_USE_MESSAGES_PRIORITY) | ||
296 | #define CH_CFG_USE_MESSAGES_PRIORITY FALSE | ||
297 | #endif | ||
298 | |||
299 | /** | ||
300 | * @brief Dynamic Threads APIs. | ||
301 | * @details If enabled then the dynamic threads creation APIs are included | ||
302 | * in the kernel. | ||
303 | * | ||
304 | * @note The default is @p TRUE. | ||
305 | * @note Requires @p CH_CFG_USE_WAITEXIT. | ||
306 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. | ||
307 | */ | ||
308 | #if !defined(CH_CFG_USE_DYNAMIC) | ||
309 | #define CH_CFG_USE_DYNAMIC FALSE | ||
310 | #endif | ||
311 | |||
312 | /** @} */ | ||
313 | |||
314 | /*===========================================================================*/ | ||
315 | /** | ||
316 | * @name OSLIB options | ||
317 | * @{ | ||
318 | */ | ||
319 | /*===========================================================================*/ | ||
320 | |||
321 | /** | ||
322 | * @brief Mailboxes APIs. | ||
323 | * @details If enabled then the asynchronous messages (mailboxes) APIs are | ||
324 | * included in the kernel. | ||
325 | * | ||
326 | * @note The default is @p TRUE. | ||
327 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
328 | */ | ||
329 | #if !defined(CH_CFG_USE_MAILBOXES) | ||
330 | #define CH_CFG_USE_MAILBOXES FALSE | ||
331 | #endif | ||
332 | |||
333 | /** | ||
334 | * @brief Core Memory Manager APIs. | ||
335 | * @details If enabled then the core memory manager APIs are included | ||
336 | * in the kernel. | ||
337 | * | ||
338 | * @note The default is @p TRUE. | ||
339 | */ | ||
340 | #if !defined(CH_CFG_USE_MEMCORE) | ||
341 | #define CH_CFG_USE_MEMCORE TRUE | ||
342 | #endif | ||
343 | |||
344 | /** | ||
345 | * @brief Managed RAM size. | ||
346 | * @details Size of the RAM area to be managed by the OS. If set to zero | ||
347 | * then the whole available RAM is used. The core memory is made | ||
348 | * available to the heap allocator and/or can be used directly through | ||
349 | * the simplified core memory allocator. | ||
350 | * | ||
351 | * @note In order to let the OS manage the whole RAM the linker script must | ||
352 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | ||
353 | * @note Requires @p CH_CFG_USE_MEMCORE. | ||
354 | */ | ||
355 | #if !defined(CH_CFG_MEMCORE_SIZE) | ||
356 | #define CH_CFG_MEMCORE_SIZE 0 | ||
357 | #endif | ||
358 | |||
359 | /** | ||
360 | * @brief Heap Allocator APIs. | ||
361 | * @details If enabled then the memory heap allocator APIs are included | ||
362 | * in the kernel. | ||
363 | * | ||
364 | * @note The default is @p TRUE. | ||
365 | * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or | ||
366 | * @p CH_CFG_USE_SEMAPHORES. | ||
367 | * @note Mutexes are recommended. | ||
368 | */ | ||
369 | #if !defined(CH_CFG_USE_HEAP) | ||
370 | #define CH_CFG_USE_HEAP TRUE | ||
371 | #endif | ||
372 | |||
373 | /** | ||
374 | * @brief Memory Pools Allocator APIs. | ||
375 | * @details If enabled then the memory pools allocator APIs are included | ||
376 | * in the kernel. | ||
377 | * | ||
378 | * @note The default is @p TRUE. | ||
379 | */ | ||
380 | #if !defined(CH_CFG_USE_MEMPOOLS) | ||
381 | #define CH_CFG_USE_MEMPOOLS FALSE | ||
382 | #endif | ||
383 | |||
384 | /** | ||
385 | * @brief Objects FIFOs APIs. | ||
386 | * @details If enabled then the objects FIFOs APIs are included | ||
387 | * in the kernel. | ||
388 | * | ||
389 | * @note The default is @p TRUE. | ||
390 | */ | ||
391 | #if !defined(CH_CFG_USE_OBJ_FIFOS) | ||
392 | #define CH_CFG_USE_OBJ_FIFOS FALSE | ||
393 | #endif | ||
394 | |||
395 | /** | ||
396 | * @brief Pipes APIs. | ||
397 | * @details If enabled then the pipes APIs are included | ||
398 | * in the kernel. | ||
399 | * | ||
400 | * @note The default is @p TRUE. | ||
401 | */ | ||
402 | #if !defined(CH_CFG_USE_PIPES) | ||
403 | #define CH_CFG_USE_PIPES FALSE | ||
404 | #endif | ||
405 | |||
406 | /** | ||
407 | * @brief Objects Caches APIs. | ||
408 | * @details If enabled then the objects caches APIs are included | ||
409 | * in the kernel. | ||
410 | * | ||
411 | * @note The default is @p TRUE. | ||
412 | */ | ||
413 | #if !defined(CH_CFG_USE_OBJ_CACHES) | ||
414 | #define CH_CFG_USE_OBJ_CACHES FALSE | ||
415 | #endif | ||
416 | |||
417 | /** | ||
418 | * @brief Delegate threads APIs. | ||
419 | * @details If enabled then the delegate threads APIs are included | ||
420 | * in the kernel. | ||
421 | * | ||
422 | * @note The default is @p TRUE. | ||
423 | */ | ||
424 | #if !defined(CH_CFG_USE_DELEGATES) | ||
425 | #define CH_CFG_USE_DELEGATES FALSE | ||
426 | #endif | ||
427 | |||
428 | /** | ||
429 | * @brief Jobs Queues APIs. | ||
430 | * @details If enabled then the jobs queues APIs are included | ||
431 | * in the kernel. | ||
432 | * | ||
433 | * @note The default is @p TRUE. | ||
434 | */ | ||
435 | #if !defined(CH_CFG_USE_JOBS) | ||
436 | #define CH_CFG_USE_JOBS FALSE | ||
437 | #endif | ||
438 | |||
439 | /** @} */ | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /** | ||
443 | * @name Objects factory options | ||
444 | * @{ | ||
445 | */ | ||
446 | /*===========================================================================*/ | ||
447 | |||
448 | /** | ||
449 | * @brief Objects Factory APIs. | ||
450 | * @details If enabled then the objects factory APIs are included in the | ||
451 | * kernel. | ||
452 | * | ||
453 | * @note The default is @p FALSE. | ||
454 | */ | ||
455 | #if !defined(CH_CFG_USE_FACTORY) | ||
456 | #define CH_CFG_USE_FACTORY FALSE | ||
457 | #endif | ||
458 | |||
459 | /** | ||
460 | * @brief Maximum length for object names. | ||
461 | * @details If the specified length is zero then the name is stored by | ||
462 | * pointer but this could have unintended side effects. | ||
463 | */ | ||
464 | #if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) | ||
465 | #define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 | ||
466 | #endif | ||
467 | |||
468 | /** | ||
469 | * @brief Enables the registry of generic objects. | ||
470 | */ | ||
471 | #if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) | ||
472 | #define CH_CFG_FACTORY_OBJECTS_REGISTRY FALSE | ||
473 | #endif | ||
474 | |||
475 | /** | ||
476 | * @brief Enables factory for generic buffers. | ||
477 | */ | ||
478 | #if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) | ||
479 | #define CH_CFG_FACTORY_GENERIC_BUFFERS FALSE | ||
480 | #endif | ||
481 | |||
482 | /** | ||
483 | * @brief Enables factory for semaphores. | ||
484 | */ | ||
485 | #if !defined(CH_CFG_FACTORY_SEMAPHORES) | ||
486 | #define CH_CFG_FACTORY_SEMAPHORES FALSE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables factory for mailboxes. | ||
491 | */ | ||
492 | #if !defined(CH_CFG_FACTORY_MAILBOXES) | ||
493 | #define CH_CFG_FACTORY_MAILBOXES FALSE | ||
494 | #endif | ||
495 | |||
496 | /** | ||
497 | * @brief Enables factory for objects FIFOs. | ||
498 | */ | ||
499 | #if !defined(CH_CFG_FACTORY_OBJ_FIFOS) | ||
500 | #define CH_CFG_FACTORY_OBJ_FIFOS FALSE | ||
501 | #endif | ||
502 | |||
503 | /** | ||
504 | * @brief Enables factory for Pipes. | ||
505 | */ | ||
506 | #if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) | ||
507 | #define CH_CFG_FACTORY_PIPES FALSE | ||
508 | #endif | ||
509 | |||
510 | /** @} */ | ||
511 | |||
512 | /*===========================================================================*/ | ||
513 | /** | ||
514 | * @name Debug options | ||
515 | * @{ | ||
516 | */ | ||
517 | /*===========================================================================*/ | ||
518 | |||
519 | /** | ||
520 | * @brief Debug option, kernel statistics. | ||
521 | * | ||
522 | * @note The default is @p FALSE. | ||
523 | */ | ||
524 | #if !defined(CH_DBG_STATISTICS) | ||
525 | #define CH_DBG_STATISTICS FALSE | ||
526 | #endif | ||
527 | |||
528 | /** | ||
529 | * @brief Debug option, system state check. | ||
530 | * @details If enabled the correct call protocol for system APIs is checked | ||
531 | * at runtime. | ||
532 | * | ||
533 | * @note The default is @p FALSE. | ||
534 | */ | ||
535 | #if !defined(CH_DBG_SYSTEM_STATE_CHECK) | ||
536 | #define CH_DBG_SYSTEM_STATE_CHECK TRUE | ||
537 | #endif | ||
538 | |||
539 | /** | ||
540 | * @brief Debug option, parameters checks. | ||
541 | * @details If enabled then the checks on the API functions input | ||
542 | * parameters are activated. | ||
543 | * | ||
544 | * @note The default is @p FALSE. | ||
545 | */ | ||
546 | #if !defined(CH_DBG_ENABLE_CHECKS) | ||
547 | #define CH_DBG_ENABLE_CHECKS TRUE | ||
548 | #endif | ||
549 | |||
550 | /** | ||
551 | * @brief Debug option, consistency checks. | ||
552 | * @details If enabled then all the assertions in the kernel code are | ||
553 | * activated. This includes consistency checks inside the kernel, | ||
554 | * runtime anomalies and port-defined checks. | ||
555 | * | ||
556 | * @note The default is @p FALSE. | ||
557 | */ | ||
558 | #if !defined(CH_DBG_ENABLE_ASSERTS) | ||
559 | #define CH_DBG_ENABLE_ASSERTS TRUE | ||
560 | #endif | ||
561 | |||
562 | /** | ||
563 | * @brief Debug option, trace buffer. | ||
564 | * @details If enabled then the trace buffer is activated. | ||
565 | * | ||
566 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. | ||
567 | */ | ||
568 | #if !defined(CH_DBG_TRACE_MASK) | ||
569 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL | ||
570 | #endif | ||
571 | |||
572 | /** | ||
573 | * @brief Trace buffer entries. | ||
574 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is | ||
575 | * different from @p CH_DBG_TRACE_MASK_DISABLED. | ||
576 | */ | ||
577 | #if !defined(CH_DBG_TRACE_BUFFER_SIZE) | ||
578 | #define CH_DBG_TRACE_BUFFER_SIZE 128 | ||
579 | #endif | ||
580 | |||
581 | /** | ||
582 | * @brief Debug option, stack checks. | ||
583 | * @details If enabled then a runtime stack check is performed. | ||
584 | * | ||
585 | * @note The default is @p FALSE. | ||
586 | * @note The stack check is performed in a architecture/port dependent way. | ||
587 | * It may not be implemented or some ports. | ||
588 | * @note The default failure mode is to halt the system with the global | ||
589 | * @p panic_msg variable set to @p NULL. | ||
590 | */ | ||
591 | #if !defined(CH_DBG_ENABLE_STACK_CHECK) | ||
592 | #define CH_DBG_ENABLE_STACK_CHECK TRUE | ||
593 | #endif | ||
594 | |||
595 | /** | ||
596 | * @brief Debug option, stacks initialization. | ||
597 | * @details If enabled then the threads working area is filled with a byte | ||
598 | * value when a thread is created. This can be useful for the | ||
599 | * runtime measurement of the used stack. | ||
600 | * | ||
601 | * @note The default is @p FALSE. | ||
602 | */ | ||
603 | #if !defined(CH_DBG_FILL_THREADS) | ||
604 | #define CH_DBG_FILL_THREADS TRUE | ||
605 | #endif | ||
606 | |||
607 | /** | ||
608 | * @brief Debug option, threads profiling. | ||
609 | * @details If enabled then a field is added to the @p thread_t structure that | ||
610 | * counts the system ticks occurred while executing the thread. | ||
611 | * | ||
612 | * @note The default is @p FALSE. | ||
613 | * @note This debug option is not currently compatible with the | ||
614 | * tickless mode. | ||
615 | */ | ||
616 | #if !defined(CH_DBG_THREADS_PROFILING) | ||
617 | #define CH_DBG_THREADS_PROFILING FALSE | ||
618 | #endif | ||
619 | |||
620 | /** @} */ | ||
621 | |||
622 | /*===========================================================================*/ | ||
623 | /** | ||
624 | * @name Kernel hooks | ||
625 | * @{ | ||
626 | */ | ||
627 | /*===========================================================================*/ | ||
628 | |||
629 | /** | ||
630 | * @brief System structure extension. | ||
631 | * @details User fields added to the end of the @p ch_system_t structure. | ||
632 | */ | ||
633 | #define CH_CFG_SYSTEM_EXTRA_FIELDS /* Add threads custom fields here.*/ | ||
634 | |||
635 | /** | ||
636 | * @brief System initialization hook. | ||
637 | * @details User initialization code added to the @p chSysInit() function | ||
638 | * just before interrupts are enabled globally. | ||
639 | */ | ||
640 | #define CH_CFG_SYSTEM_INIT_HOOK() \ | ||
641 | { \ | ||
642 | /* Add threads initialization code here.*/ \ | ||
643 | } | ||
644 | |||
645 | /** | ||
646 | * @brief Threads descriptor structure extension. | ||
647 | * @details User fields added to the end of the @p thread_t structure. | ||
648 | */ | ||
649 | #define CH_CFG_THREAD_EXTRA_FIELDS /* Add threads custom fields here.*/ | ||
650 | |||
651 | /** | ||
652 | * @brief Threads initialization hook. | ||
653 | * @details User initialization code added to the @p _thread_init() function. | ||
654 | * | ||
655 | * @note It is invoked from within @p _thread_init() and implicitly from all | ||
656 | * the threads creation APIs. | ||
657 | */ | ||
658 | #define CH_CFG_THREAD_INIT_HOOK(tp) \ | ||
659 | { \ | ||
660 | /* Add threads initialization code here.*/ \ | ||
661 | } | ||
662 | |||
663 | /** | ||
664 | * @brief Threads finalization hook. | ||
665 | * @details User finalization code added to the @p chThdExit() API. | ||
666 | */ | ||
667 | #define CH_CFG_THREAD_EXIT_HOOK(tp) \ | ||
668 | { \ | ||
669 | /* Add threads finalization code here.*/ \ | ||
670 | } | ||
671 | |||
672 | /** | ||
673 | * @brief Context switch hook. | ||
674 | * @details This hook is invoked just before switching between threads. | ||
675 | */ | ||
676 | #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) \ | ||
677 | { \ | ||
678 | /* Context switch code here.*/ \ | ||
679 | } | ||
680 | |||
681 | /** | ||
682 | * @brief ISR enter hook. | ||
683 | */ | ||
684 | #define CH_CFG_IRQ_PROLOGUE_HOOK() \ | ||
685 | { \ | ||
686 | /* IRQ prologue code here.*/ \ | ||
687 | } | ||
688 | |||
689 | /** | ||
690 | * @brief ISR exit hook. | ||
691 | */ | ||
692 | #define CH_CFG_IRQ_EPILOGUE_HOOK() \ | ||
693 | { \ | ||
694 | /* IRQ epilogue code here.*/ \ | ||
695 | } | ||
696 | |||
697 | /** | ||
698 | * @brief Idle thread enter hook. | ||
699 | * @note This hook is invoked within a critical zone, no OS functions | ||
700 | * should be invoked from here. | ||
701 | * @note This macro can be used to activate a power saving mode. | ||
702 | */ | ||
703 | #define CH_CFG_IDLE_ENTER_HOOK() \ | ||
704 | { \ | ||
705 | /* Idle-enter code here.*/ \ | ||
706 | } | ||
707 | |||
708 | /** | ||
709 | * @brief Idle thread leave hook. | ||
710 | * @note This hook is invoked within a critical zone, no OS functions | ||
711 | * should be invoked from here. | ||
712 | * @note This macro can be used to deactivate a power saving mode. | ||
713 | */ | ||
714 | #define CH_CFG_IDLE_LEAVE_HOOK() \ | ||
715 | { \ | ||
716 | /* Idle-leave code here.*/ \ | ||
717 | } | ||
718 | |||
719 | /** | ||
720 | * @brief Idle Loop hook. | ||
721 | * @details This hook is continuously invoked by the idle thread loop. | ||
722 | */ | ||
723 | #define CH_CFG_IDLE_LOOP_HOOK() \ | ||
724 | { \ | ||
725 | /* Idle loop code here.*/ \ | ||
726 | } | ||
727 | |||
728 | /** | ||
729 | * @brief System tick event hook. | ||
730 | * @details This hook is invoked in the system tick handler immediately | ||
731 | * after processing the virtual timers queue. | ||
732 | */ | ||
733 | #define CH_CFG_SYSTEM_TICK_HOOK() \ | ||
734 | { \ | ||
735 | /* System tick event code here.*/ \ | ||
736 | } | ||
737 | |||
738 | /** | ||
739 | * @brief System halt hook. | ||
740 | * @details This hook is invoked in case to a system halting error before | ||
741 | * the system is halted. | ||
742 | */ | ||
743 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) \ | ||
744 | { \ | ||
745 | /* System halt code here.*/ \ | ||
746 | } | ||
747 | |||
748 | /** | ||
749 | * @brief Trace hook. | ||
750 | * @details This hook is invoked each time a new record is written in the | ||
751 | * trace buffer. | ||
752 | */ | ||
753 | #define CH_CFG_TRACE_HOOK(tep) \ | ||
754 | { \ | ||
755 | /* Trace code here.*/ \ | ||
756 | } | ||
757 | |||
758 | /** @} */ | ||
759 | |||
760 | /*===========================================================================*/ | ||
761 | /* Port-specific settings (override port settings defaulted in chcore.h). */ | ||
762 | /*===========================================================================*/ | ||
763 | |||
764 | #endif /* CHCONF_H */ | ||
765 | |||
766 | /** @} */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf.h new file mode 100644 index 000000000..892caf87b --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf.h | |||
@@ -0,0 +1,533 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief HAL configuration header. | ||
20 | * @details HAL configuration file, this file allows to enable or disable the | ||
21 | * various device drivers from your application. You may also use | ||
22 | * this file in order to override the device drivers default settings. | ||
23 | * | ||
24 | * @addtogroup HAL_CONF | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef HALCONF_H | ||
29 | #define HALCONF_H | ||
30 | |||
31 | #define _CHIBIOS_HAL_CONF_ | ||
32 | #define _CHIBIOS_HAL_CONF_VER_7_1_ | ||
33 | |||
34 | #include "mcuconf.h" | ||
35 | |||
36 | /** | ||
37 | * @brief Enables the PAL subsystem. | ||
38 | */ | ||
39 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
40 | #define HAL_USE_PAL TRUE | ||
41 | #endif | ||
42 | |||
43 | /** | ||
44 | * @brief Enables the ADC subsystem. | ||
45 | */ | ||
46 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
47 | #define HAL_USE_ADC FALSE | ||
48 | #endif | ||
49 | |||
50 | /** | ||
51 | * @brief Enables the CAN subsystem. | ||
52 | */ | ||
53 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
54 | #define HAL_USE_CAN FALSE | ||
55 | #endif | ||
56 | |||
57 | /** | ||
58 | * @brief Enables the cryptographic subsystem. | ||
59 | */ | ||
60 | #if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) | ||
61 | #define HAL_USE_CRY FALSE | ||
62 | #endif | ||
63 | |||
64 | /** | ||
65 | * @brief Enables the DAC subsystem. | ||
66 | */ | ||
67 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
68 | #define HAL_USE_DAC FALSE | ||
69 | #endif | ||
70 | |||
71 | /** | ||
72 | * @brief Enables the EFlash subsystem. | ||
73 | */ | ||
74 | #if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) | ||
75 | #define HAL_USE_EFL FALSE | ||
76 | #endif | ||
77 | |||
78 | /** | ||
79 | * @brief Enables the GPT subsystem. | ||
80 | */ | ||
81 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
82 | #define HAL_USE_GPT FALSE | ||
83 | #endif | ||
84 | |||
85 | /** | ||
86 | * @brief Enables the I2C subsystem. | ||
87 | */ | ||
88 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
89 | #define HAL_USE_I2C FALSE | ||
90 | #endif | ||
91 | |||
92 | /** | ||
93 | * @brief Enables the I2S subsystem. | ||
94 | */ | ||
95 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
96 | #define HAL_USE_I2S FALSE | ||
97 | #endif | ||
98 | |||
99 | /** | ||
100 | * @brief Enables the ICU subsystem. | ||
101 | */ | ||
102 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
103 | #define HAL_USE_ICU FALSE | ||
104 | #endif | ||
105 | |||
106 | /** | ||
107 | * @brief Enables the MAC subsystem. | ||
108 | */ | ||
109 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
110 | #define HAL_USE_MAC FALSE | ||
111 | #endif | ||
112 | |||
113 | /** | ||
114 | * @brief Enables the MMC_SPI subsystem. | ||
115 | */ | ||
116 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
117 | #define HAL_USE_MMC_SPI FALSE | ||
118 | #endif | ||
119 | |||
120 | /** | ||
121 | * @brief Enables the PWM subsystem. | ||
122 | */ | ||
123 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
124 | #define HAL_USE_PWM FALSE | ||
125 | #endif | ||
126 | |||
127 | /** | ||
128 | * @brief Enables the RTC subsystem. | ||
129 | */ | ||
130 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
131 | #define HAL_USE_RTC FALSE | ||
132 | #endif | ||
133 | |||
134 | /** | ||
135 | * @brief Enables the SDC subsystem. | ||
136 | */ | ||
137 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
138 | #define HAL_USE_SDC FALSE | ||
139 | #endif | ||
140 | |||
141 | /** | ||
142 | * @brief Enables the SERIAL subsystem. | ||
143 | */ | ||
144 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
145 | #define HAL_USE_SERIAL FALSE | ||
146 | #endif | ||
147 | |||
148 | /** | ||
149 | * @brief Enables the SERIAL over USB subsystem. | ||
150 | */ | ||
151 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
152 | #define HAL_USE_SERIAL_USB FALSE | ||
153 | #endif | ||
154 | |||
155 | /** | ||
156 | * @brief Enables the SIO subsystem. | ||
157 | */ | ||
158 | #if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) | ||
159 | #define HAL_USE_SIO FALSE | ||
160 | #endif | ||
161 | |||
162 | /** | ||
163 | * @brief Enables the SPI subsystem. | ||
164 | */ | ||
165 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
166 | #define HAL_USE_SPI FALSE | ||
167 | #endif | ||
168 | |||
169 | /** | ||
170 | * @brief Enables the TRNG subsystem. | ||
171 | */ | ||
172 | #if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) | ||
173 | #define HAL_USE_TRNG FALSE | ||
174 | #endif | ||
175 | |||
176 | /** | ||
177 | * @brief Enables the UART subsystem. | ||
178 | */ | ||
179 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
180 | #define HAL_USE_UART FALSE | ||
181 | #endif | ||
182 | |||
183 | /** | ||
184 | * @brief Enables the USB subsystem. | ||
185 | */ | ||
186 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
187 | #define HAL_USE_USB TRUE | ||
188 | #endif | ||
189 | |||
190 | /** | ||
191 | * @brief Enables the WDG subsystem. | ||
192 | */ | ||
193 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
194 | #define HAL_USE_WDG FALSE | ||
195 | #endif | ||
196 | |||
197 | /** | ||
198 | * @brief Enables the WSPI subsystem. | ||
199 | */ | ||
200 | #if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) | ||
201 | #define HAL_USE_WSPI FALSE | ||
202 | #endif | ||
203 | |||
204 | /*===========================================================================*/ | ||
205 | /* PAL driver related settings. */ | ||
206 | /*===========================================================================*/ | ||
207 | |||
208 | /** | ||
209 | * @brief Enables synchronous APIs. | ||
210 | * @note Disabling this option saves both code and data space. | ||
211 | */ | ||
212 | #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
213 | #define PAL_USE_CALLBACKS FALSE | ||
214 | #endif | ||
215 | |||
216 | /** | ||
217 | * @brief Enables synchronous APIs. | ||
218 | * @note Disabling this option saves both code and data space. | ||
219 | */ | ||
220 | #if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) | ||
221 | #define PAL_USE_WAIT FALSE | ||
222 | #endif | ||
223 | |||
224 | /*===========================================================================*/ | ||
225 | /* ADC driver related settings. */ | ||
226 | /*===========================================================================*/ | ||
227 | |||
228 | /** | ||
229 | * @brief Enables synchronous APIs. | ||
230 | * @note Disabling this option saves both code and data space. | ||
231 | */ | ||
232 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
233 | #define ADC_USE_WAIT TRUE | ||
234 | #endif | ||
235 | |||
236 | /** | ||
237 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
238 | * @note Disabling this option saves both code and data space. | ||
239 | */ | ||
240 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
241 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
242 | #endif | ||
243 | |||
244 | /*===========================================================================*/ | ||
245 | /* CAN driver related settings. */ | ||
246 | /*===========================================================================*/ | ||
247 | |||
248 | /** | ||
249 | * @brief Sleep mode related APIs inclusion switch. | ||
250 | */ | ||
251 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
252 | #define CAN_USE_SLEEP_MODE TRUE | ||
253 | #endif | ||
254 | |||
255 | /** | ||
256 | * @brief Enforces the driver to use direct callbacks rather than OSAL events. | ||
257 | */ | ||
258 | #if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) | ||
259 | #define CAN_ENFORCE_USE_CALLBACKS FALSE | ||
260 | #endif | ||
261 | |||
262 | /*===========================================================================*/ | ||
263 | /* CRY driver related settings. */ | ||
264 | /*===========================================================================*/ | ||
265 | |||
266 | /** | ||
267 | * @brief Enables the SW fall-back of the cryptographic driver. | ||
268 | * @details When enabled, this option, activates a fall-back software | ||
269 | * implementation for algorithms not supported by the underlying | ||
270 | * hardware. | ||
271 | * @note Fall-back implementations may not be present for all algorithms. | ||
272 | */ | ||
273 | #if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) | ||
274 | #define HAL_CRY_USE_FALLBACK FALSE | ||
275 | #endif | ||
276 | |||
277 | /** | ||
278 | * @brief Makes the driver forcibly use the fall-back implementations. | ||
279 | */ | ||
280 | #if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) | ||
281 | #define HAL_CRY_ENFORCE_FALLBACK FALSE | ||
282 | #endif | ||
283 | |||
284 | /*===========================================================================*/ | ||
285 | /* DAC driver related settings. */ | ||
286 | /*===========================================================================*/ | ||
287 | |||
288 | /** | ||
289 | * @brief Enables synchronous APIs. | ||
290 | * @note Disabling this option saves both code and data space. | ||
291 | */ | ||
292 | #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) | ||
293 | #define DAC_USE_WAIT TRUE | ||
294 | #endif | ||
295 | |||
296 | /** | ||
297 | * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. | ||
298 | * @note Disabling this option saves both code and data space. | ||
299 | */ | ||
300 | #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
301 | #define DAC_USE_MUTUAL_EXCLUSION TRUE | ||
302 | #endif | ||
303 | |||
304 | /*===========================================================================*/ | ||
305 | /* I2C driver related settings. */ | ||
306 | /*===========================================================================*/ | ||
307 | |||
308 | /** | ||
309 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
310 | */ | ||
311 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
312 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
313 | #endif | ||
314 | |||
315 | /*===========================================================================*/ | ||
316 | /* MAC driver related settings. */ | ||
317 | /*===========================================================================*/ | ||
318 | |||
319 | /** | ||
320 | * @brief Enables the zero-copy API. | ||
321 | */ | ||
322 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
323 | #define MAC_USE_ZERO_COPY FALSE | ||
324 | #endif | ||
325 | |||
326 | /** | ||
327 | * @brief Enables an event sources for incoming packets. | ||
328 | */ | ||
329 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
330 | #define MAC_USE_EVENTS TRUE | ||
331 | #endif | ||
332 | |||
333 | /*===========================================================================*/ | ||
334 | /* MMC_SPI driver related settings. */ | ||
335 | /*===========================================================================*/ | ||
336 | |||
337 | /** | ||
338 | * @brief Delays insertions. | ||
339 | * @details If enabled this options inserts delays into the MMC waiting | ||
340 | * routines releasing some extra CPU time for the threads with | ||
341 | * lower priority, this may slow down the driver a bit however. | ||
342 | * This option is recommended also if the SPI driver does not | ||
343 | * use a DMA channel and heavily loads the CPU. | ||
344 | */ | ||
345 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
346 | #define MMC_NICE_WAITING TRUE | ||
347 | #endif | ||
348 | |||
349 | /*===========================================================================*/ | ||
350 | /* SDC driver related settings. */ | ||
351 | /*===========================================================================*/ | ||
352 | |||
353 | /** | ||
354 | * @brief Number of initialization attempts before rejecting the card. | ||
355 | * @note Attempts are performed at 10mS intervals. | ||
356 | */ | ||
357 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
358 | #define SDC_INIT_RETRY 100 | ||
359 | #endif | ||
360 | |||
361 | /** | ||
362 | * @brief Include support for MMC cards. | ||
363 | * @note MMC support is not yet implemented so this option must be kept | ||
364 | * at @p FALSE. | ||
365 | */ | ||
366 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
367 | #define SDC_MMC_SUPPORT FALSE | ||
368 | #endif | ||
369 | |||
370 | /** | ||
371 | * @brief Delays insertions. | ||
372 | * @details If enabled this options inserts delays into the MMC waiting | ||
373 | * routines releasing some extra CPU time for the threads with | ||
374 | * lower priority, this may slow down the driver a bit however. | ||
375 | */ | ||
376 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
377 | #define SDC_NICE_WAITING TRUE | ||
378 | #endif | ||
379 | |||
380 | /** | ||
381 | * @brief OCR initialization constant for V20 cards. | ||
382 | */ | ||
383 | #if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) | ||
384 | #define SDC_INIT_OCR_V20 0x50FF8000U | ||
385 | #endif | ||
386 | |||
387 | /** | ||
388 | * @brief OCR initialization constant for non-V20 cards. | ||
389 | */ | ||
390 | #if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) | ||
391 | #define SDC_INIT_OCR 0x80100000U | ||
392 | #endif | ||
393 | |||
394 | /*===========================================================================*/ | ||
395 | /* SERIAL driver related settings. */ | ||
396 | /*===========================================================================*/ | ||
397 | |||
398 | /** | ||
399 | * @brief Default bit rate. | ||
400 | * @details Configuration parameter, this is the baud rate selected for the | ||
401 | * default configuration. | ||
402 | */ | ||
403 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
404 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
405 | #endif | ||
406 | |||
407 | /** | ||
408 | * @brief Serial buffers size. | ||
409 | * @details Configuration parameter, you can change the depth of the queue | ||
410 | * buffers depending on the requirements of your application. | ||
411 | * @note The default is 16 bytes for both the transmission and receive | ||
412 | * buffers. | ||
413 | */ | ||
414 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
415 | #define SERIAL_BUFFERS_SIZE 16 | ||
416 | #endif | ||
417 | |||
418 | /*===========================================================================*/ | ||
419 | /* SERIAL_USB driver related setting. */ | ||
420 | /*===========================================================================*/ | ||
421 | |||
422 | /** | ||
423 | * @brief Serial over USB buffers size. | ||
424 | * @details Configuration parameter, the buffer size must be a multiple of | ||
425 | * the USB data endpoint maximum packet size. | ||
426 | * @note The default is 256 bytes for both the transmission and receive | ||
427 | * buffers. | ||
428 | */ | ||
429 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
430 | #define SERIAL_USB_BUFFERS_SIZE 256 | ||
431 | #endif | ||
432 | |||
433 | /** | ||
434 | * @brief Serial over USB number of buffers. | ||
435 | * @note The default is 2 buffers. | ||
436 | */ | ||
437 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
438 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
439 | #endif | ||
440 | |||
441 | /*===========================================================================*/ | ||
442 | /* SPI driver related settings. */ | ||
443 | /*===========================================================================*/ | ||
444 | |||
445 | /** | ||
446 | * @brief Enables synchronous APIs. | ||
447 | * @note Disabling this option saves both code and data space. | ||
448 | */ | ||
449 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
450 | #define SPI_USE_WAIT TRUE | ||
451 | #endif | ||
452 | |||
453 | /** | ||
454 | * @brief Enables circular transfers APIs. | ||
455 | * @note Disabling this option saves both code and data space. | ||
456 | */ | ||
457 | #if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) | ||
458 | #define SPI_USE_CIRCULAR FALSE | ||
459 | #endif | ||
460 | |||
461 | /** | ||
462 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
463 | * @note Disabling this option saves both code and data space. | ||
464 | */ | ||
465 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
466 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
467 | #endif | ||
468 | |||
469 | /** | ||
470 | * @brief Handling method for SPI CS line. | ||
471 | * @note Disabling this option saves both code and data space. | ||
472 | */ | ||
473 | #if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) | ||
474 | #define SPI_SELECT_MODE SPI_SELECT_MODE_PAD | ||
475 | #endif | ||
476 | |||
477 | /*===========================================================================*/ | ||
478 | /* UART driver related settings. */ | ||
479 | /*===========================================================================*/ | ||
480 | |||
481 | /** | ||
482 | * @brief Enables synchronous APIs. | ||
483 | * @note Disabling this option saves both code and data space. | ||
484 | */ | ||
485 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
486 | #define UART_USE_WAIT FALSE | ||
487 | #endif | ||
488 | |||
489 | /** | ||
490 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
491 | * @note Disabling this option saves both code and data space. | ||
492 | */ | ||
493 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
494 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
495 | #endif | ||
496 | |||
497 | /*===========================================================================*/ | ||
498 | /* USB driver related settings. */ | ||
499 | /*===========================================================================*/ | ||
500 | |||
501 | /** | ||
502 | * @brief Enables synchronous APIs. | ||
503 | * @note Disabling this option saves both code and data space. | ||
504 | */ | ||
505 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
506 | #define USB_USE_WAIT FALSE | ||
507 | #endif | ||
508 | |||
509 | /*===========================================================================*/ | ||
510 | /* WSPI driver related settings. */ | ||
511 | /*===========================================================================*/ | ||
512 | |||
513 | /** | ||
514 | * @brief Enables synchronous APIs. | ||
515 | * @note Disabling this option saves both code and data space. | ||
516 | */ | ||
517 | #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) | ||
518 | #define WSPI_USE_WAIT TRUE | ||
519 | #endif | ||
520 | |||
521 | /** | ||
522 | * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. | ||
523 | * @note Disabling this option saves both code and data space. | ||
524 | */ | ||
525 | #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
526 | #define WSPI_USE_MUTUAL_EXCLUSION TRUE | ||
527 | #endif | ||
528 | |||
529 | #include "halconf_community.h" | ||
530 | |||
531 | #endif /* HALCONF_H */ | ||
532 | |||
533 | /** @} */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf_community.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf_community.h new file mode 100644 index 000000000..caa8e3d3b --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/halconf_community.h | |||
@@ -0,0 +1,180 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2014 Uladzimir Pylinsky aka barthess | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef HALCONF_COMMUNITY_H | ||
18 | #define HALCONF_COMMUNITY_H | ||
19 | |||
20 | /** | ||
21 | * @brief Enables the community overlay. | ||
22 | */ | ||
23 | #if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__) | ||
24 | #define HAL_USE_COMMUNITY TRUE | ||
25 | #endif | ||
26 | |||
27 | /** | ||
28 | * @brief Enables the FSMC subsystem. | ||
29 | */ | ||
30 | #if !defined(HAL_USE_FSMC) || defined(__DOXYGEN__) | ||
31 | #define HAL_USE_FSMC FALSE | ||
32 | #endif | ||
33 | |||
34 | /** | ||
35 | * @brief Enables the NAND subsystem. | ||
36 | */ | ||
37 | #if !defined(HAL_USE_NAND) || defined(__DOXYGEN__) | ||
38 | #define HAL_USE_NAND FALSE | ||
39 | #endif | ||
40 | |||
41 | /** | ||
42 | * @brief Enables the 1-wire subsystem. | ||
43 | */ | ||
44 | #if !defined(HAL_USE_ONEWIRE) || defined(__DOXYGEN__) | ||
45 | #define HAL_USE_ONEWIRE FALSE | ||
46 | #endif | ||
47 | |||
48 | /** | ||
49 | * @brief Enables the EICU subsystem. | ||
50 | */ | ||
51 | #if !defined(HAL_USE_EICU) || defined(__DOXYGEN__) | ||
52 | #define HAL_USE_EICU FALSE | ||
53 | #endif | ||
54 | |||
55 | /** | ||
56 | * @brief Enables the CRC subsystem. | ||
57 | */ | ||
58 | #if !defined(HAL_USE_CRC) || defined(__DOXYGEN__) | ||
59 | #define HAL_USE_CRC FALSE | ||
60 | #endif | ||
61 | |||
62 | /** | ||
63 | * @brief Enables the RNG subsystem. | ||
64 | */ | ||
65 | #if !defined(HAL_USE_RNG) || defined(__DOXYGEN__) | ||
66 | #define HAL_USE_RNG FALSE | ||
67 | #endif | ||
68 | |||
69 | /** | ||
70 | * @brief Enables the EEPROM subsystem. | ||
71 | */ | ||
72 | #if !defined(HAL_USE_EEPROM) || defined(__DOXYGEN__) | ||
73 | #define HAL_USE_EEPROM FALSE | ||
74 | #endif | ||
75 | |||
76 | /** | ||
77 | * @brief Enables the TIMCAP subsystem. | ||
78 | */ | ||
79 | #if !defined(HAL_USE_TIMCAP) || defined(__DOXYGEN__) | ||
80 | #define HAL_USE_TIMCAP FALSE | ||
81 | #endif | ||
82 | |||
83 | /** | ||
84 | * @brief Enables the TIMCAP subsystem. | ||
85 | */ | ||
86 | #if !defined(HAL_USE_COMP) || defined(__DOXYGEN__) | ||
87 | #define HAL_USE_COMP FALSE | ||
88 | #endif | ||
89 | |||
90 | /** | ||
91 | * @brief Enables the QEI subsystem. | ||
92 | */ | ||
93 | #if !defined(HAL_USE_QEI) || defined(__DOXYGEN__) | ||
94 | #define HAL_USE_QEI FALSE | ||
95 | #endif | ||
96 | |||
97 | /** | ||
98 | * @brief Enables the USBH subsystem. | ||
99 | */ | ||
100 | #if !defined(HAL_USE_USBH) || defined(__DOXYGEN__) | ||
101 | #define HAL_USE_USBH FALSE | ||
102 | #endif | ||
103 | |||
104 | /** | ||
105 | * @brief Enables the USB_MSD subsystem. | ||
106 | */ | ||
107 | #if !defined(HAL_USE_USB_MSD) || defined(__DOXYGEN__) | ||
108 | #define HAL_USE_USB_MSD FALSE | ||
109 | #endif | ||
110 | |||
111 | /** | ||
112 | * @brief Enables the USB_HID subsystem. | ||
113 | */ | ||
114 | #if !defined(HAL_USE_USB_HID) || defined(__DOXYGEN__) | ||
115 | #define HAL_USE_USB_HID TRUE | ||
116 | #endif | ||
117 | |||
118 | /*===========================================================================*/ | ||
119 | /* FSMCNAND driver related settings. */ | ||
120 | /*===========================================================================*/ | ||
121 | |||
122 | /** | ||
123 | * @brief Enables the @p nandAcquireBus() and @p nanReleaseBus() APIs. | ||
124 | * @note Disabling this option saves both code and data space. | ||
125 | */ | ||
126 | #if !defined(NAND_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
127 | #define NAND_USE_MUTUAL_EXCLUSION TRUE | ||
128 | #endif | ||
129 | |||
130 | /*===========================================================================*/ | ||
131 | /* 1-wire driver related settings. */ | ||
132 | /*===========================================================================*/ | ||
133 | /** | ||
134 | * @brief Enables strong pull up feature. | ||
135 | * @note Disabling this option saves both code and data space. | ||
136 | */ | ||
137 | #define ONEWIRE_USE_STRONG_PULLUP FALSE | ||
138 | |||
139 | /** | ||
140 | * @brief Enables search ROM feature. | ||
141 | * @note Disabling this option saves both code and data space. | ||
142 | */ | ||
143 | #define ONEWIRE_USE_SEARCH_ROM TRUE | ||
144 | |||
145 | /*===========================================================================*/ | ||
146 | /* QEI driver related settings. */ | ||
147 | /*===========================================================================*/ | ||
148 | |||
149 | /** | ||
150 | * @brief Enables discard of overlow | ||
151 | */ | ||
152 | #if !defined(QEI_USE_OVERFLOW_DISCARD) || defined(__DOXYGEN__) | ||
153 | #define QEI_USE_OVERFLOW_DISCARD FALSE | ||
154 | #endif | ||
155 | |||
156 | /** | ||
157 | * @brief Enables min max of overlow | ||
158 | */ | ||
159 | #if !defined(QEI_USE_OVERFLOW_MINMAX) || defined(__DOXYGEN__) | ||
160 | #define QEI_USE_OVERFLOW_MINMAX FALSE | ||
161 | #endif | ||
162 | |||
163 | /*===========================================================================*/ | ||
164 | /* EEProm driver related settings. */ | ||
165 | /*===========================================================================*/ | ||
166 | |||
167 | /** | ||
168 | * @brief Enables 24xx series I2C eeprom device driver. | ||
169 | * @note Disabling this option saves both code and data space. | ||
170 | */ | ||
171 | #define EEPROM_USE_EE24XX FALSE | ||
172 | /** | ||
173 | * @brief Enables 25xx series SPI eeprom device driver. | ||
174 | * @note Disabling this option saves both code and data space. | ||
175 | */ | ||
176 | #define EEPROM_USE_EE25XX FALSE | ||
177 | |||
178 | #endif /* HALCONF_COMMUNITY_H */ | ||
179 | |||
180 | /** @} */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/mcuconf.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/mcuconf.h new file mode 100644 index 000000000..d6c3553ec --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/mcuconf.h | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2020 Alex Lewontin | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _MCUCONF_H_ | ||
18 | #define _MCUCONF_H_ | ||
19 | |||
20 | /* | ||
21 | * Board setting | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * HAL driver system settings. | ||
26 | */ | ||
27 | #define NUC123_HSE_ENABLED TRUE | ||
28 | #define NUC123_PLL_ENABLED TRUE | ||
29 | #define NUC123_PLLSRC NUC123_PLLSRC_HSE | ||
30 | #define NUC123_HCLKSRC NUC123_HCLKSRC_PLL | ||
31 | #define NUC123_HCLKDIV 2 | ||
32 | #define NUC123_PLL_NF 144 | ||
33 | #define NUC123_USB_USE_USB0 TRUE | ||
34 | #define NUC123_USB_USE_USB1 TRUE | ||
35 | |||
36 | #define NUC123_SERIAL_USE_UART0 TRUE | ||
37 | #define NUC123_SERIAL_CLKSRC NUC123_SERIAL_CLKSRC_HSI | ||
38 | |||
39 | #define NUC123_MCUCONF | ||
40 | |||
41 | #endif /* _MCUCONF_H_ */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/osalconf.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/osalconf.h new file mode 100644 index 000000000..47065412b --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/cfg/osalconf.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2020 Alex Lewontin | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/main.c b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/main.c new file mode 100644 index 000000000..ff143e2ba --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/main.c | |||
@@ -0,0 +1,96 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Jonathan Struebel | ||
3 | Modifications copyright (C) 2020 Alex Lewontin | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | #include "hal.h" | ||
18 | |||
19 | #include "usbcfg.h" | ||
20 | |||
21 | /* | ||
22 | * Onboard LED blinker thread, times are in milliseconds. | ||
23 | */ | ||
24 | static THD_WORKING_AREA(waBlinkThread, 128); | ||
25 | static THD_FUNCTION(BlinkThread, arg) | ||
26 | { | ||
27 | |||
28 | (void)arg; | ||
29 | |||
30 | chRegSetThreadName("blinker"); | ||
31 | while (true) { | ||
32 | systime_t time = USBD1.state == USB_ACTIVE ? 250 : 500; | ||
33 | OnboardLED_Toggle(); | ||
34 | chThdSleepMilliseconds(time); | ||
35 | } | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * Application entry point. | ||
40 | */ | ||
41 | int main(void) | ||
42 | { | ||
43 | /* | ||
44 | * System initializations. | ||
45 | * - HAL initialization, this also initializes the configured device drivers | ||
46 | * and performs the board-specific initializations. | ||
47 | * - Kernel initialization, the main() function becomes a thread and the | ||
48 | * RTOS is active. | ||
49 | */ | ||
50 | halInit(); | ||
51 | chSysInit(); | ||
52 | OnboardLED_Init(); | ||
53 | |||
54 | /* | ||
55 | * Turn off the onboard LED. | ||
56 | */ | ||
57 | OnboardLED_Off(); | ||
58 | |||
59 | chDbgSuspendTrace(CH_DBG_TRACE_MASK_SWITCH); | ||
60 | /* | ||
61 | * Initializes a USB HID driver. | ||
62 | */ | ||
63 | hidObjectInit(&UHD1); | ||
64 | hidStart(&UHD1, &usbhidcfg); | ||
65 | |||
66 | /* | ||
67 | * Activates the USB driver and then the USB bus pull-up on D+. | ||
68 | * Note, a delay is inserted in order to not have to disconnect the cable | ||
69 | * after a reset. | ||
70 | */ | ||
71 | |||
72 | usbDisconnectBus(usbhidcfg.usbp); | ||
73 | chThdSleepMilliseconds(1000); | ||
74 | usbStart(usbhidcfg.usbp, &usbcfg); | ||
75 | chThdSleepMilliseconds(1000); | ||
76 | usbConnectBus(usbhidcfg.usbp); | ||
77 | |||
78 | /* | ||
79 | * Creates the blinker thread. | ||
80 | */ | ||
81 | chThdCreateStatic( | ||
82 | waBlinkThread, sizeof(waBlinkThread), NORMALPRIO, BlinkThread, NULL); | ||
83 | |||
84 | while (true) { | ||
85 | if (usbhidcfg.usbp->state == USB_ACTIVE) { | ||
86 | uint8_t report; | ||
87 | size_t n = hidGetReport(0, &report, sizeof(report)); | ||
88 | hidWriteReport(&UHD1, &report, n); | ||
89 | n = hidReadReportt(&UHD1, &report, sizeof(report), TIME_IMMEDIATE); | ||
90 | if (n > 0) | ||
91 | hidSetReport(0, &report, n); | ||
92 | } | ||
93 | |||
94 | chThdSleepMilliseconds(1000); | ||
95 | } | ||
96 | } | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/readme.txt b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/readme.txt new file mode 100644 index 000000000..af865c29d --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/readme.txt | |||
@@ -0,0 +1,36 @@ | |||
1 | ***************************************************************************** | ||
2 | ** ChibiOS/HAL - USB driver demo for NUC123. ** | ||
3 | ***************************************************************************** | ||
4 | |||
5 | ** TARGET ** | ||
6 | |||
7 | The demo runs on a NUTINY-SDK-NUC123-V2.0 board with a NUC123SD4AN0 MCU. | ||
8 | |||
9 | ** The Demo ** | ||
10 | |||
11 | The application demonstrates the use of the NUC123 USB driver. A successful run of the test | ||
12 | should begin with the on-board LED blinking slowly, then faster when the USB driver initializes. | ||
13 | The host should recognize the board as a USB HID, and when run with the appropriate VID/PID, the | ||
14 | supplied client application should communicate with the board. | ||
15 | |||
16 | ** Board Setup ** | ||
17 | |||
18 | - None | ||
19 | |||
20 | ** Build Procedure ** | ||
21 | |||
22 | The demo has been tested using gcc version 9.3.1 (GNU Arm Embedded Toolchain 9-2020-q2-update). | ||
23 | Just modify the TRGT line in the makefile in order to use different GCC ports. | ||
24 | |||
25 | Two versions of the client code are provided. The Linux version uses the kernel's native hidraw API. | ||
26 | The Darwin version uses the hidapi from libusb (https://github.com/libusb/hidapi) | ||
27 | |||
28 | The Darwin client has only been tested using Apple clang version 12.0.0 (clang-1200.0.32.2), on | ||
29 | macOS Catalina 10.15.7. However, it should be easily portable to any platform supported by hidapi. | ||
30 | |||
31 | To build, adjust HIDAPI_HEADER_PATH in Client/darwin/Makefile to the appropriate location. | ||
32 | |||
33 | ** Notes ** | ||
34 | |||
35 | This test was adapted from Jonathan Struebel's USB_HID test for the KINETIS FRDM-KL25Z. All files | ||
36 | are copyright their original authors, as indicated in the headers. | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.c b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.c new file mode 100644 index 000000000..95fe7bfb1 --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.c | |||
@@ -0,0 +1,393 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Jonathan Struebel | ||
3 | Modifications copyright (C) 2020 Alex Lewontin | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | |||
18 | /** | ||
19 | * @file usbcfg.c | ||
20 | * @brief USB driver config. | ||
21 | * | ||
22 | * @addtogroup USB | ||
23 | * @{ | ||
24 | */ | ||
25 | #include "hal.h" | ||
26 | #include "usbcfg.h" | ||
27 | |||
28 | #define VID 0x1209 | ||
29 | #define PID 0x0003 | ||
30 | /* | ||
31 | * Endpoints to be used for USBD1. | ||
32 | */ | ||
33 | #define USBD1_DATA_REQUEST_EP 1 | ||
34 | #define USBD1_DATA_AVAILABLE_EP 1 | ||
35 | |||
36 | /* | ||
37 | * USB HID Driver structure. | ||
38 | */ | ||
39 | USBHIDDriver UHD1; | ||
40 | |||
41 | /* | ||
42 | * Data used for feedback | ||
43 | */ | ||
44 | uint8_t increment_var = 0; | ||
45 | |||
46 | /* | ||
47 | * USB Device Descriptor. | ||
48 | */ | ||
49 | static const uint8_t hid_device_descriptor_data[] = { | ||
50 | USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */ | ||
51 | 0x00, /* bDeviceClass. */ | ||
52 | 0x00, /* bDeviceSubClass. */ | ||
53 | 0x00, /* bDeviceProtocol. */ | ||
54 | 0x40, /* bMaxPacketSize. */ | ||
55 | VID, /* idVendor. */ | ||
56 | PID, /* idProduct. */ | ||
57 | 0x000, /* bcdDevice. */ | ||
58 | 1, /* iManufacturer. */ | ||
59 | 2, /* iProduct. */ | ||
60 | 3, /* iSerialNumber. */ | ||
61 | 1) /* bNumConfigurations. */ | ||
62 | }; | ||
63 | |||
64 | /* | ||
65 | * Device Descriptor wrapper. | ||
66 | */ | ||
67 | static const USBDescriptor hid_device_descriptor = { | ||
68 | sizeof hid_device_descriptor_data, | ||
69 | hid_device_descriptor_data | ||
70 | }; | ||
71 | |||
72 | /* | ||
73 | * Configuration Descriptor tree for a HID device | ||
74 | * | ||
75 | * The HID Specifications version 1.11 require the following order: | ||
76 | * - Configuration Descriptor | ||
77 | * - Interface Descriptor | ||
78 | * - HID Descriptor | ||
79 | * - Endpoints Descriptors | ||
80 | */ | ||
81 | #define HID_DESCRIPTOR_OFFSET 18 | ||
82 | #define HID_DESCRIPTOR_SIZE USB_DESC_HID_SIZE | ||
83 | |||
84 | static const uint8_t hid_configuration_descriptor_data[] = { | ||
85 | /* Configuration Descriptor.*/ | ||
86 | USB_DESC_CONFIGURATION(41, /* wTotalLength. */ | ||
87 | 0x01, /* bNumInterfaces. */ | ||
88 | 0x01, /* bConfigurationValue. */ | ||
89 | 0, /* iConfiguration. */ | ||
90 | 0xC0, /* bmAttributes (self powered). */ | ||
91 | 50), /* bMaxPower (100mA). */ | ||
92 | /* Interface Descriptor.*/ | ||
93 | USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */ | ||
94 | 0x00, /* bAlternateSetting. */ | ||
95 | 0x02, /* bNumEndpoints. */ | ||
96 | 0x03, /* bInterfaceClass (HID Interface | ||
97 | Class). */ | ||
98 | 0x00, /* bInterfaceSubClass (None). */ | ||
99 | 0x00, /* bInterfaceProtocol (None). */ | ||
100 | 0), /* iInterface. */ | ||
101 | /* HID Descriptor.*/ | ||
102 | USB_DESC_HID (0x0110, /* bcdHID. */ | ||
103 | 0x00, /* bCountryCode. */ | ||
104 | 0x01, /* bNumDescriptors. */ | ||
105 | 0x22, /* bDescriptorType (Report | ||
106 | Descriptor). */ | ||
107 | 34), /* wDescriptorLength. */ | ||
108 | /* Endpoint 1 Descriptor.*/ | ||
109 | USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* bEndpointAddress.*/ | ||
110 | 0x03, /* bmAttributes (Interrupt). */ | ||
111 | 0x0040, /* wMaxPacketSize. */ | ||
112 | 0x0A), /* bInterval (10ms). */ | ||
113 | /* Endpoint 1 Descriptor.*/ | ||
114 | USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/ | ||
115 | 0x03, /* bmAttributes (Interrupt). */ | ||
116 | 0x0040, /* wMaxPacketSize. */ | ||
117 | 0x0A) /* bInterval (10ms). */ | ||
118 | }; | ||
119 | |||
120 | /* | ||
121 | * Configuration Descriptor wrapper. | ||
122 | */ | ||
123 | static const USBDescriptor hid_configuration_descriptor = { | ||
124 | sizeof hid_configuration_descriptor_data, | ||
125 | hid_configuration_descriptor_data | ||
126 | }; | ||
127 | |||
128 | /* | ||
129 | * HID Descriptor wrapper. | ||
130 | */ | ||
131 | static const USBDescriptor hid_descriptor = { | ||
132 | HID_DESCRIPTOR_SIZE, | ||
133 | &hid_configuration_descriptor_data[HID_DESCRIPTOR_OFFSET] | ||
134 | }; | ||
135 | |||
136 | /* | ||
137 | * HID Report Descriptor | ||
138 | * | ||
139 | * This is the description of the format and the content of the | ||
140 | * different IN or/and OUT reports that your application can | ||
141 | * receive/send | ||
142 | * | ||
143 | * See "Device Class Definition for Human Interface Devices (HID)" | ||
144 | * (http://www.usb.org/developers/hidpage/HID1_11.pdf) for the | ||
145 | * detailed description of all the fields | ||
146 | */ | ||
147 | static const uint8_t hid_report_descriptor_data[] = { | ||
148 | USB_DESC_BYTE (0x06), /* Usage Page - */ | ||
149 | USB_DESC_WORD (0xFF00), /* Vendor Defined. */ | ||
150 | USB_DESC_BYTE (0x09), /* Usage - */ | ||
151 | USB_DESC_BYTE (0x01), /* Vendor Defined. */ | ||
152 | USB_DESC_BYTE (0xA1), /* Collection - */ | ||
153 | USB_DESC_BYTE (0x01), /* Application. */ | ||
154 | |||
155 | USB_DESC_BYTE (0x09), /* Usage - */ | ||
156 | USB_DESC_BYTE (0x01), /* Vendor Defined. */ | ||
157 | USB_DESC_BYTE (0x15), /* Logical Minimum - */ | ||
158 | USB_DESC_BYTE (0x00), /* 0. */ | ||
159 | USB_DESC_BYTE (0x26), /* Logical Maximum - */ | ||
160 | USB_DESC_WORD (0x00FF), /* 255. */ | ||
161 | USB_DESC_BYTE (0x75), /* Report size - */ | ||
162 | USB_DESC_BYTE (0x08), /* 8 bits. */ | ||
163 | USB_DESC_BYTE (0x95), /* Report count - */ | ||
164 | USB_DESC_BYTE (0x01), /* 1. */ | ||
165 | USB_DESC_BYTE (0x81), /* Input - */ | ||
166 | USB_DESC_BYTE (0x02), /* Data, Variable, Absolute. */ | ||
167 | |||
168 | USB_DESC_BYTE (0x09), /* Usage - */ | ||
169 | USB_DESC_BYTE (0x01), /* Vendor Defined. */ | ||
170 | USB_DESC_BYTE (0x15), /* Logical Minimum - */ | ||
171 | USB_DESC_BYTE (0x00), /* 0. */ | ||
172 | USB_DESC_BYTE (0x26), /* Logical Maximum - */ | ||
173 | USB_DESC_WORD (0x00FF), /* 255. */ | ||
174 | USB_DESC_BYTE (0x75), /* Report Size - */ | ||
175 | USB_DESC_BYTE (0x08), /* 8 bits. */ | ||
176 | USB_DESC_BYTE (0x95), /* Report Count - */ | ||
177 | USB_DESC_BYTE (0x01), /* 1. */ | ||
178 | USB_DESC_BYTE (0x91), /* Output - */ | ||
179 | USB_DESC_BYTE (0x02), /* Data, Variable, Absolute. */ | ||
180 | |||
181 | USB_DESC_BYTE (0xC0) /* End Collection. */ | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * HID Report Descriptor wrapper | ||
186 | */ | ||
187 | static const USBDescriptor hid_report_descriptor = { | ||
188 | sizeof hid_report_descriptor_data, | ||
189 | hid_report_descriptor_data | ||
190 | }; | ||
191 | |||
192 | /* | ||
193 | * U.S. English language identifier. | ||
194 | */ | ||
195 | static const uint8_t usb_string_langid[] = | ||
196 | USB_DESC_STRING(USB_DESC_WORD(0x0409)); /* wLANGID (U.S. English) */ | ||
197 | |||
198 | /* | ||
199 | * Vendor string. | ||
200 | */ | ||
201 | static const uint8_t usb_string_vendor[] = | ||
202 | USB_DESC_STRING('N', 0, 'u', 0, 'v', 0, 'o', 0, 't', 0, 'o', 0, 'n', 0); | ||
203 | |||
204 | /* | ||
205 | * Serial Number string. | ||
206 | */ | ||
207 | static const uint8_t usb_string_serial[] = | ||
208 | USB_DESC_STRING('0', 0, 'x', 0, 'D', 0, 'E', 0, 'A', 0, 'D', 0, 'B', 0, 'E', 0, 'E', 0, 'F', 0); | ||
209 | |||
210 | /* | ||
211 | * Device Description string. | ||
212 | */ | ||
213 | static const uint8_t usb_string_description[] = | ||
214 | USB_DESC_STRING('C', 0, 'h', 0, 'i', 0, 'b', 0, 'i', 0, 'O', 0, 'S', 0, '/', 0, 'H', 0, 'A', 0, | ||
215 | 'L', 0, ' ', 0, 'U', 0, 'S', 0, 'B', 0, ' ', 0, 'D', 0, 'e', 0, 'm', 0, 'o', 0); | ||
216 | /* | ||
217 | * Strings wrappers array. | ||
218 | */ | ||
219 | static const USBDescriptor hid_strings[] = { | ||
220 | {sizeof usb_string_langid, usb_string_langid}, | ||
221 | {sizeof usb_string_vendor, usb_string_vendor}, | ||
222 | {sizeof usb_string_description, usb_string_description}, | ||
223 | {sizeof usb_string_serial, usb_string_serial} | ||
224 | }; | ||
225 | |||
226 | /* | ||
227 | * Handles the GET_DESCRIPTOR callback. All required descriptors must be | ||
228 | * handled here. | ||
229 | */ | ||
230 | static const USBDescriptor *get_descriptor(USBDriver *usbp, | ||
231 | uint8_t dtype, | ||
232 | uint8_t dindex, | ||
233 | uint16_t lang) { | ||
234 | (void)usbp; | ||
235 | (void)lang; | ||
236 | switch (dtype) { | ||
237 | case USB_DESCRIPTOR_DEVICE: | ||
238 | return &hid_device_descriptor; | ||
239 | case USB_DESCRIPTOR_CONFIGURATION: | ||
240 | return &hid_configuration_descriptor; | ||
241 | case USB_DESCRIPTOR_STRING: | ||
242 | if (dindex < 4) | ||
243 | return &hid_strings[dindex]; | ||
244 | case USB_DESCRIPTOR_INTERFACE: | ||
245 | break; | ||
246 | case USB_DESCRIPTOR_ENDPOINT: | ||
247 | break; | ||
248 | case USB_DESCRIPTOR_HID: | ||
249 | return &hid_descriptor; | ||
250 | case HID_REPORT: | ||
251 | return &hid_report_descriptor; | ||
252 | default: | ||
253 | break; | ||
254 | } | ||
255 | return NULL; | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * @brief IN EP1 state. | ||
260 | */ | ||
261 | static USBInEndpointState ep1instate; | ||
262 | |||
263 | /** | ||
264 | * @brief OUT EP1 state. | ||
265 | */ | ||
266 | static USBOutEndpointState ep1outstate; | ||
267 | |||
268 | /** | ||
269 | * @brief EP1 initialization structure (both IN and OUT). | ||
270 | */ | ||
271 | static const USBEndpointConfig ep1config = { | ||
272 | USB_EP_MODE_TYPE_INTR, | ||
273 | NULL, | ||
274 | hidDataTransmitted, | ||
275 | hidDataReceived, | ||
276 | 0x0040, | ||
277 | 0x0040, | ||
278 | &ep1instate, | ||
279 | &ep1outstate, | ||
280 | 0, | ||
281 | NULL | ||
282 | }; | ||
283 | |||
284 | /* | ||
285 | * Handles the USB driver global events. | ||
286 | */ | ||
287 | static void usb_event(USBDriver *usbp, usbevent_t event) { | ||
288 | switch (event) { | ||
289 | case USB_EVENT_RESET: | ||
290 | return; | ||
291 | case USB_EVENT_ADDRESS: | ||
292 | return; | ||
293 | case USB_EVENT_CONFIGURED: | ||
294 | osalSysLockFromISR(); | ||
295 | |||
296 | /* Enables the endpoints specified into the configuration. | ||
297 | Note, this callback is invoked from an ISR so I-Class functions | ||
298 | must be used.*/ | ||
299 | usbInitEndpointI(usbp, USBD1_DATA_REQUEST_EP, &ep1config); | ||
300 | |||
301 | /* Resetting the state of the CDC subsystem.*/ | ||
302 | hidConfigureHookI(&UHD1); | ||
303 | |||
304 | osalSysUnlockFromISR(); | ||
305 | return; | ||
306 | case USB_EVENT_UNCONFIGURED: | ||
307 | return; | ||
308 | case USB_EVENT_SUSPEND: | ||
309 | return; | ||
310 | case USB_EVENT_WAKEUP: | ||
311 | return; | ||
312 | case USB_EVENT_STALLED: | ||
313 | return; | ||
314 | } | ||
315 | return; | ||
316 | } | ||
317 | |||
318 | static bool req_handler(USBDriver *usbp) { | ||
319 | size_t n; | ||
320 | |||
321 | if ((usbp->setup[0] & USB_RTYPE_TYPE_MASK) == USB_RTYPE_TYPE_CLASS) { | ||
322 | switch (usbp->setup[1]) { | ||
323 | case HID_GET_REPORT: | ||
324 | n = hidGetReport(0, &increment_var, sizeof(increment_var)); | ||
325 | usbSetupTransfer(usbp, &increment_var, n, NULL); | ||
326 | return true; | ||
327 | default: | ||
328 | return hidRequestsHook(usbp); | ||
329 | } | ||
330 | } | ||
331 | return hidRequestsHook(usbp); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * @brief Generate HID Report | ||
336 | * @details This function generates the data for an HID report so | ||
337 | * that it can be transferred to the host. | ||
338 | * | ||
339 | * @param[in] id report ID | ||
340 | * @param[out] bp data buffer pointer | ||
341 | * @param[in] n the maximum number of bytes for data buffer | ||
342 | * @return number of bytes of report in data buffer | ||
343 | */ | ||
344 | size_t hidGetReport(uint8_t id, uint8_t *bp, size_t n) { | ||
345 | |||
346 | (void) id; | ||
347 | (void) n; | ||
348 | |||
349 | increment_var++; | ||
350 | *bp = increment_var; | ||
351 | return sizeof(increment_var); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * @brief Set HID Report | ||
356 | * @details This function sets the data for an HID report | ||
357 | * that was transferred from the host. | ||
358 | * | ||
359 | * @param[in] id report ID | ||
360 | * @param[in] bp data buffer pointer | ||
361 | * @param[in] n the number of bytes in data buffer | ||
362 | * @return The operation status. | ||
363 | * @retval MSG_OK if the report was set. | ||
364 | */ | ||
365 | msg_t hidSetReport(uint8_t id, uint8_t *bp, size_t n) { | ||
366 | |||
367 | (void) id; | ||
368 | (void) n; | ||
369 | |||
370 | increment_var = *bp; | ||
371 | return MSG_OK; | ||
372 | } | ||
373 | |||
374 | /* | ||
375 | * USB driver configuration. | ||
376 | */ | ||
377 | const USBConfig usbcfg = { | ||
378 | usb_event, | ||
379 | get_descriptor, | ||
380 | req_handler, | ||
381 | NULL | ||
382 | }; | ||
383 | |||
384 | /* | ||
385 | * USB HID driver configuration. | ||
386 | */ | ||
387 | const USBHIDConfig usbhidcfg = { | ||
388 | &USBD1, | ||
389 | USBD1_DATA_REQUEST_EP, | ||
390 | USBD1_DATA_AVAILABLE_EP | ||
391 | }; | ||
392 | |||
393 | /** @} */ | ||
diff --git a/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.h b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.h new file mode 100644 index 000000000..f82323a9b --- /dev/null +++ b/lib/chibios-contrib/testhal/NUMICRO/NUC123/NUTINY-SDK-NUC123-V2.0/USB_HID/usbcfg.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | Copyright (C) 2016 Jonathan Struebel | ||
3 | Modifications copyright (C) 2020 Alex Lewontin | ||
4 | |||
5 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
6 | you may not use this file except in compliance with the License. | ||
7 | You may obtain a copy of the License at | ||
8 | |||
9 | http://www.apache.org/licenses/LICENSE-2.0 | ||
10 | |||
11 | Unless required by applicable law or agreed to in writing, software | ||
12 | distributed under the License is distributed on an "AS IS" BASIS, | ||
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
14 | See the License for the specific language governing permissions and | ||
15 | limitations under the License. | ||
16 | */ | ||
17 | |||
18 | /** | ||
19 | * @file usbcfg.h | ||
20 | * @brief USB driver config header. | ||
21 | * | ||
22 | * @addtogroup USB | ||
23 | * @{ | ||
24 | */ | ||
25 | |||
26 | #ifndef USBCFG_H | ||
27 | #define USBCFG_H | ||
28 | |||
29 | #include "hal_usb_lld.h" | ||
30 | |||
31 | extern const USBConfig usbcfg; | ||
32 | extern const USBHIDConfig usbhidcfg; | ||
33 | extern USBHIDDriver UHD1; | ||
34 | |||
35 | #define USB_DESC_STRING(...) \ | ||
36 | { \ | ||
37 | USB_DESC_BYTE((sizeof((int[]){__VA_ARGS__}) / sizeof(int)) + 2), \ | ||
38 | USB_DESC_BYTE(USB_DESCRIPTOR_STRING), __VA_ARGS__ \ | ||
39 | } | ||
40 | |||
41 | #ifdef __cplusplus | ||
42 | extern "C" { | ||
43 | #endif | ||
44 | size_t hidGetReport(uint8_t id, uint8_t *bp, size_t n); | ||
45 | msg_t hidSetReport(uint8_t id, uint8_t *bp, size_t n); | ||
46 | #ifdef __cplusplus | ||
47 | } | ||
48 | #endif | ||
49 | |||
50 | #endif /* USBCFG_H */ | ||
51 | |||
52 | /** @} */ | ||