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