1*150812a8SEvalZero /*
2*150812a8SEvalZero * Copyright (c) 2016 - 2018, Nordic Semiconductor ASA
3*150812a8SEvalZero * All rights reserved.
4*150812a8SEvalZero *
5*150812a8SEvalZero * Redistribution and use in source and binary forms, with or without
6*150812a8SEvalZero * modification, are permitted provided that the following conditions are met:
7*150812a8SEvalZero *
8*150812a8SEvalZero * 1. Redistributions of source code must retain the above copyright notice, this
9*150812a8SEvalZero * list of conditions and the following disclaimer.
10*150812a8SEvalZero *
11*150812a8SEvalZero * 2. Redistributions in binary form must reproduce the above copyright
12*150812a8SEvalZero * notice, this list of conditions and the following disclaimer in the
13*150812a8SEvalZero * documentation and/or other materials provided with the distribution.
14*150812a8SEvalZero *
15*150812a8SEvalZero * 3. Neither the name of the copyright holder nor the names of its
16*150812a8SEvalZero * contributors may be used to endorse or promote products derived from this
17*150812a8SEvalZero * software without specific prior written permission.
18*150812a8SEvalZero *
19*150812a8SEvalZero * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20*150812a8SEvalZero * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*150812a8SEvalZero * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*150812a8SEvalZero * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23*150812a8SEvalZero * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*150812a8SEvalZero * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*150812a8SEvalZero * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*150812a8SEvalZero * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*150812a8SEvalZero * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*150812a8SEvalZero * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*150812a8SEvalZero * POSSIBILITY OF SUCH DAMAGE.
30*150812a8SEvalZero */
31*150812a8SEvalZero
32*150812a8SEvalZero #ifndef NRFX_USBD_ERRATA_H__
33*150812a8SEvalZero #define NRFX_USBD_ERRATA_H__
34*150812a8SEvalZero
35*150812a8SEvalZero #include <stdbool.h>
36*150812a8SEvalZero
37*150812a8SEvalZero #ifndef NRFX_USBD_ERRATA_ENABLE
38*150812a8SEvalZero /**
39*150812a8SEvalZero * @brief The constant that informs if errata should be enabled at all.
40*150812a8SEvalZero *
41*150812a8SEvalZero * If this constant is set to 0, all the Errata bug fixes will be automatically disabled.
42*150812a8SEvalZero */
43*150812a8SEvalZero #define NRFX_USBD_ERRATA_ENABLE 1
44*150812a8SEvalZero #endif
45*150812a8SEvalZero
nrfx_usbd_errata_type_52840(void)46*150812a8SEvalZero static inline bool nrfx_usbd_errata_type_52840(void)
47*150812a8SEvalZero {
48*150812a8SEvalZero return (*(uint32_t *)0x10000130UL == 0x8UL);
49*150812a8SEvalZero }
50*150812a8SEvalZero
nrfx_usbd_errata_type_52840_eng_a(void)51*150812a8SEvalZero static inline bool nrfx_usbd_errata_type_52840_eng_a(void)
52*150812a8SEvalZero {
53*150812a8SEvalZero return (nrfx_usbd_errata_type_52840() && (*(uint32_t *)0x10000134UL == 0x0UL));
54*150812a8SEvalZero }
55*150812a8SEvalZero
nrfx_usbd_errata_type_52840_eng_b(void)56*150812a8SEvalZero static inline bool nrfx_usbd_errata_type_52840_eng_b(void)
57*150812a8SEvalZero {
58*150812a8SEvalZero return (nrfx_usbd_errata_type_52840() && (*(uint32_t *)0x10000134UL == 0x1UL));
59*150812a8SEvalZero }
60*150812a8SEvalZero
nrfx_usbd_errata_type_52840_eng_c(void)61*150812a8SEvalZero static inline bool nrfx_usbd_errata_type_52840_eng_c(void)
62*150812a8SEvalZero {
63*150812a8SEvalZero return (nrfx_usbd_errata_type_52840() && (*(uint32_t *)0x10000134UL == 0x2UL));
64*150812a8SEvalZero }
65*150812a8SEvalZero
nrfx_usbd_errata_type_52840_eng_d(void)66*150812a8SEvalZero static inline bool nrfx_usbd_errata_type_52840_eng_d(void)
67*150812a8SEvalZero {
68*150812a8SEvalZero return (nrfx_usbd_errata_type_52840() && (*(uint32_t *)0x10000134UL == 0x3UL));
69*150812a8SEvalZero }
70*150812a8SEvalZero
71*150812a8SEvalZero /* Errata: USBD: EPDATA event is not always generated. */
nrfx_usbd_errata_104(void)72*150812a8SEvalZero static inline bool nrfx_usbd_errata_104(void)
73*150812a8SEvalZero {
74*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && nrfx_usbd_errata_type_52840_eng_a());
75*150812a8SEvalZero }
76*150812a8SEvalZero
77*150812a8SEvalZero /* Errata: During setup read/write transfer USBD acknowledges setup stage without SETUP task. */
nrfx_usbd_errata_154(void)78*150812a8SEvalZero static inline bool nrfx_usbd_errata_154(void)
79*150812a8SEvalZero {
80*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && nrfx_usbd_errata_type_52840_eng_a());
81*150812a8SEvalZero }
82*150812a8SEvalZero
83*150812a8SEvalZero /* Errata: ISO double buffering not functional. */
nrfx_usbd_errata_166(void)84*150812a8SEvalZero static inline bool nrfx_usbd_errata_166(void)
85*150812a8SEvalZero {
86*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && true);
87*150812a8SEvalZero }
88*150812a8SEvalZero
89*150812a8SEvalZero /* Errata: USBD might not reach its active state. */
nrfx_usbd_errata_171(void)90*150812a8SEvalZero static inline bool nrfx_usbd_errata_171(void)
91*150812a8SEvalZero {
92*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && true);
93*150812a8SEvalZero }
94*150812a8SEvalZero
95*150812a8SEvalZero /* Errata: USB cannot be enabled. */
nrfx_usbd_errata_187(void)96*150812a8SEvalZero static inline bool nrfx_usbd_errata_187(void)
97*150812a8SEvalZero {
98*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE &&
99*150812a8SEvalZero (nrfx_usbd_errata_type_52840_eng_b() ||
100*150812a8SEvalZero nrfx_usbd_errata_type_52840_eng_c() ||
101*150812a8SEvalZero nrfx_usbd_errata_type_52840_eng_d())
102*150812a8SEvalZero );
103*150812a8SEvalZero }
104*150812a8SEvalZero
105*150812a8SEvalZero /* Errata: USBD cannot receive tasks during DMA. */
nrfx_usbd_errata_199(void)106*150812a8SEvalZero static inline bool nrfx_usbd_errata_199(void)
107*150812a8SEvalZero {
108*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && true);
109*150812a8SEvalZero }
110*150812a8SEvalZero
111*150812a8SEvalZero /* Errata: SIZE.EPOUT not writable. */
nrfx_usbd_errata_200(void)112*150812a8SEvalZero static inline bool nrfx_usbd_errata_200(void)
113*150812a8SEvalZero {
114*150812a8SEvalZero return (NRFX_USBD_ERRATA_ENABLE && nrfx_usbd_errata_type_52840_eng_a());
115*150812a8SEvalZero }
116*150812a8SEvalZero
117*150812a8SEvalZero #endif // NRFX_USBD_ERRATA_H__
118