code format
This commit is contained in:
parent
ce01496d44
commit
a53b1c7cf1
@ -1 +1 @@
|
||||
Subproject commit f5652a0146606151c83f7af25f9779718a65f097
|
||||
Subproject commit a0849fee9f4b268ccc9798c70c654a835f8e20c8
|
@ -107,6 +107,8 @@ SRC_C += \
|
||||
fatfs_port.c \
|
||||
fifo.c \
|
||||
tick.c \
|
||||
background.c \
|
||||
internal_flash.c \
|
||||
drivers/softpwm.c \
|
||||
drivers/ticker.c \
|
||||
drivers/bluetooth/ble_drv.c \
|
||||
@ -115,7 +117,6 @@ SRC_C += \
|
||||
nrfx/mdk/system_$(MCU_SUB_VARIANT).c \
|
||||
nrfx/hal/nrf_nvmc.c \
|
||||
device/$(MCU_VARIANT)/startup_$(MCU_SUB_VARIANT).c \
|
||||
background.c \
|
||||
lib/oofatfs/ff.c \
|
||||
lib/oofatfs/option/ccsbcs.c \
|
||||
lib/timeutils/timeutils.c \
|
||||
@ -126,25 +127,23 @@ SRC_C += \
|
||||
lib/utils/stdout_helpers.c \
|
||||
lib/libc/string0.c \
|
||||
lib/mp-readline/readline.c \
|
||||
internal_flash.c \
|
||||
|
||||
ifeq ($(MCU_SUB_VARIANT),nrf52840)
|
||||
|
||||
SRC_C += \
|
||||
usb/tusb_descriptors.c \
|
||||
usb/usb_msc_flash.c \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c \
|
||||
lib/tinyusb/src/common/tusb_fifo.c \
|
||||
lib/tinyusb/src/device/usbd.c \
|
||||
lib/tinyusb/src/device/usbd_desc.c \
|
||||
lib/tinyusb/src/class/msc/msc_device.c \
|
||||
lib/tinyusb/src/class/cdc/cdc_device.c \
|
||||
lib/tinyusb/src/tusb.c \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c \
|
||||
lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c \
|
||||
lib/tinyusb/src/common/tusb_fifo.c \
|
||||
lib/tinyusb/src/device/usbd.c \
|
||||
lib/tinyusb/src/device/usbd_desc.c \
|
||||
lib/tinyusb/src/class/msc/msc_device.c \
|
||||
lib/tinyusb/src/class/cdc/cdc_device.c \
|
||||
lib/tinyusb/src/tusb.c \
|
||||
|
||||
endif
|
||||
|
||||
|
||||
DRIVERS_SRC_C += $(addprefix modules/,\
|
||||
ubluepy/modubluepy.c \
|
||||
ubluepy/ubluepy_peripheral.c \
|
||||
@ -264,7 +263,6 @@ hex: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||
$(BUILD)/$(OUTPUT_FILENAME).hex: $(BUILD)/$(OUTPUT_FILENAME).elf
|
||||
$(OBJCOPY) -O ihex $< $@
|
||||
|
||||
|
||||
#####################
|
||||
# Flash with debugger
|
||||
#####################
|
||||
@ -300,7 +298,6 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||
|
||||
endif
|
||||
|
||||
|
||||
#####################
|
||||
# Flash with DFU
|
||||
#####################
|
||||
@ -312,7 +309,6 @@ else
|
||||
NRFUTIL = nrfutil
|
||||
endif
|
||||
|
||||
|
||||
check_defined = \
|
||||
$(strip $(foreach 1,$1, \
|
||||
$(call __check_defined,$1,$(strip $(value 2)))))
|
||||
@ -335,8 +331,6 @@ uf2: $(BUILD)/$(OUTPUT_FILENAME).hex
|
||||
$(ECHO) "Create $(OUTPUT_FILENAME).uf2"
|
||||
$(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^
|
||||
|
||||
|
||||
|
||||
$(BUILD)/dfu-package.zip: dfu-gen
|
||||
|
||||
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
|
||||
|
@ -1,44 +1,32 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file background.c
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2018, Adafruit Industries (adafruit.com)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
/*
|
||||
* This file is part of the MicroPython project, http://micropython.org/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tusb.h"
|
||||
|
||||
|
||||
void run_background_tasks(void) {
|
||||
|
||||
#ifdef NRF52840_XXAA
|
||||
tusb_task();
|
||||
tud_cdc_flush();
|
||||
|
@ -83,8 +83,7 @@ void tud_umount_cb(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
}
|
||||
|
||||
uint32_t tusb_hal_millis(void)
|
||||
{
|
||||
uint32_t tusb_hal_millis(void) {
|
||||
uint64_t ms;
|
||||
uint32_t us;
|
||||
current_tick(&ms, &us);
|
||||
|
@ -35,7 +35,6 @@
|
||||
#define PORT_HEAP_SIZE (128 * 1024)
|
||||
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
|
||||
|
||||
|
||||
// Temp (could be removed) 0: usb cdc (default), 1 : hwuart (jlink)
|
||||
#define CFG_HWUART_FOR_SERIAL 0
|
||||
|
||||
|
@ -34,10 +34,6 @@
|
||||
|
||||
#if MICROPY_PY_BLE_NUS
|
||||
|
||||
#if BLUETOOTH_WEBBLUETOOTH_REPL
|
||||
//#include "hal_time.h"
|
||||
#endif // BLUETOOTH_WEBBLUETOOTH_REPL
|
||||
|
||||
static ubluepy_uuid_obj_t uuid_obj_service = {
|
||||
.base.type = &ubluepy_uuid_type,
|
||||
.type = UBLUEPY_UUID_128_BIT,
|
||||
|
@ -42,19 +42,15 @@
|
||||
#include "nrf_sdm.h"
|
||||
#endif
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* VARIABLES
|
||||
*------------------------------------------------------------------*/
|
||||
|
||||
// defined in linker
|
||||
extern uint32_t __fatfs_flash_start_addr[];
|
||||
extern uint32_t __fatfs_flash_length[];
|
||||
|
||||
#define NO_CACHE 0xffffffff
|
||||
#define FL_PAGE_SZ 4096
|
||||
#define NO_CACHE 0xffffffff
|
||||
#define FL_PAGE_SZ 4096
|
||||
|
||||
uint8_t _fl_cache[FL_PAGE_SZ] __attribute__((aligned(4)));
|
||||
uint32_t _fl_pg_addr = NO_CACHE;
|
||||
uint8_t _flash_cache[FL_PAGE_SZ] __attribute__((aligned(4)));
|
||||
uint32_t _flash_page_addr = NO_CACHE;
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
@ -66,14 +62,14 @@ static inline uint32_t lba2addr(uint32_t block) {
|
||||
|
||||
void internal_flash_init(void) {
|
||||
// Activity LED for flash writes.
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
struct port_config pin_conf;
|
||||
port_get_config_defaults(&pin_conf);
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
struct port_config pin_conf;
|
||||
port_get_config_defaults(&pin_conf);
|
||||
|
||||
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
|
||||
port_pin_set_config(MICROPY_HW_LED_MSC, &pin_conf);
|
||||
port_pin_set_output_level(MICROPY_HW_LED_MSC, false);
|
||||
#endif
|
||||
pin_conf.direction = PORT_PIN_DIR_OUTPUT;
|
||||
port_pin_set_config(MICROPY_HW_LED_MSC, &pin_conf);
|
||||
port_pin_set_output_level(MICROPY_HW_LED_MSC, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t internal_flash_get_block_size(void) {
|
||||
@ -86,16 +82,16 @@ uint32_t internal_flash_get_block_count(void) {
|
||||
|
||||
// TODO support flashing with SD enabled
|
||||
void internal_flash_flush(void) {
|
||||
if (_fl_pg_addr == NO_CACHE) return;
|
||||
if (_flash_page_addr == NO_CACHE) return;
|
||||
|
||||
// Skip if data is the same
|
||||
if (memcmp(_fl_cache, (void *)_fl_pg_addr, FL_PAGE_SZ) != 0) {
|
||||
if (memcmp(_flash_cache, (void *)_flash_page_addr, FL_PAGE_SZ) != 0) {
|
||||
// _is_flashing = true;
|
||||
nrf_nvmc_page_erase(_fl_pg_addr);
|
||||
nrf_nvmc_write_words(_fl_pg_addr, (uint32_t *)_fl_cache, FL_PAGE_SZ / sizeof(uint32_t));
|
||||
nrf_nvmc_page_erase(_flash_page_addr);
|
||||
nrf_nvmc_write_words(_flash_page_addr, (uint32_t *)_flash_cache, FL_PAGE_SZ / sizeof(uint32_t));
|
||||
}
|
||||
|
||||
_fl_pg_addr = NO_CACHE;
|
||||
_flash_page_addr = NO_CACHE;
|
||||
}
|
||||
|
||||
mp_uint_t internal_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num_blocks) {
|
||||
@ -106,39 +102,39 @@ mp_uint_t internal_flash_read_blocks(uint8_t *dest, uint32_t block, uint32_t num
|
||||
|
||||
mp_uint_t internal_flash_write_blocks(const uint8_t *src, uint32_t lba, uint32_t num_blocks) {
|
||||
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
port_pin_set_output_level(MICROPY_HW_LED_MSC, true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
while (num_blocks) {
|
||||
uint32_t const addr = lba2addr(lba);
|
||||
uint32_t const page_addr = addr & ~(FL_PAGE_SZ - 1);
|
||||
|
||||
uint32_t count = 8 - (lba%8); // up to page boundary
|
||||
uint32_t count = 8 - (lba % 8); // up to page boundary
|
||||
count = MIN(num_blocks, count);
|
||||
|
||||
if (page_addr != _fl_pg_addr) {
|
||||
if (page_addr != _flash_page_addr) {
|
||||
internal_flash_flush();
|
||||
|
||||
// writing previous cached data, skip current data until flashing is done
|
||||
// tinyusb stack will invoke write_block() with the same parameters later on
|
||||
// if ( _is_flashing ) return;
|
||||
|
||||
_fl_pg_addr = page_addr;
|
||||
memcpy(_fl_cache, (void *)page_addr, FL_PAGE_SZ);
|
||||
_flash_page_addr = page_addr;
|
||||
memcpy(_flash_cache, (void *)page_addr, FL_PAGE_SZ);
|
||||
}
|
||||
|
||||
memcpy(_fl_cache + (addr & (FL_PAGE_SZ - 1)), src, count*FILESYSTEM_BLOCK_SIZE);
|
||||
memcpy(_flash_cache + (addr & (FL_PAGE_SZ - 1)), src, count * FILESYSTEM_BLOCK_SIZE);
|
||||
|
||||
// adjust for next run
|
||||
lba += count;
|
||||
src += count*FILESYSTEM_BLOCK_SIZE;
|
||||
src += count * FILESYSTEM_BLOCK_SIZE;
|
||||
num_blocks -= count;
|
||||
}
|
||||
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
#ifdef MICROPY_HW_LED_MSC
|
||||
port_pin_set_output_level(MICROPY_HW_LED_MSC, false);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return 0; // success
|
||||
}
|
||||
@ -203,6 +199,10 @@ const mp_obj_type_t internal_flash_type = {
|
||||
.locals_dict = (mp_obj_t)&internal_flash_obj_locals_dict,
|
||||
};
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Flash API
|
||||
*------------------------------------------------------------------*/
|
||||
|
||||
void flash_init_vfs(fs_user_mount_t *vfs) {
|
||||
vfs->base.type = &mp_fat_vfs_type;
|
||||
vfs->flags |= FSUSER_NATIVE | FSUSER_HAVE_IOCTL;
|
||||
|
@ -85,7 +85,7 @@ int mp_hal_stdin_rx_chr(void) {
|
||||
}
|
||||
|
||||
bool mp_hal_stdin_any(void) {
|
||||
return tud_cdc_available() > 0;
|
||||
return tud_cdc_available() > 0;
|
||||
}
|
||||
|
||||
void mp_hal_stdout_tx_strn(const char *str, mp_uint_t len) {
|
||||
@ -128,80 +128,3 @@ void mp_hal_delay_ms(mp_uint_t delay) {
|
||||
}
|
||||
}
|
||||
|
||||
void mp_hal_delay_us(mp_uint_t us)
|
||||
{
|
||||
register uint32_t delay __ASM ("r0") = us;
|
||||
__ASM volatile (
|
||||
#ifdef NRF51
|
||||
".syntax unified\n"
|
||||
#endif
|
||||
"1:\n"
|
||||
" SUBS %0, %0, #1\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
#ifdef NRF52
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
" NOP\n"
|
||||
#endif
|
||||
" BNE 1b\n"
|
||||
#ifdef NRF51
|
||||
".syntax divided\n"
|
||||
#endif
|
||||
: "+r" (delay));
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,5 +50,7 @@ int mp_hal_stdin_rx_chr(void);
|
||||
void mp_hal_stdout_tx_str(const char *str);
|
||||
bool mp_hal_stdin_any(void);
|
||||
|
||||
#define mp_hal_delay_us(us) NRFX_DELAY_US((uint32_t) us)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,193 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2017 - 2018, Nordic Semiconductor ASA
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form, except as embedded into a Nordic
|
||||
* Semiconductor ASA integrated circuit in a product or a software update for
|
||||
* such product, must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* 4. This software, with or without modification, must only be used with a
|
||||
* Nordic Semiconductor ASA integrated circuit.
|
||||
*
|
||||
* 5. Any software provided in binary form under this license must not be reverse
|
||||
* engineered, decompiled, modified and/or disassembled.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
|
||||
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NRF_DRV_USBD_ERRATA_H__
|
||||
#define NRF_DRV_USBD_ERRATA_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
/**
|
||||
* @defgroup nrf_drv_usbd_errata Functions to check if selected PAN is present in current chip
|
||||
* @{
|
||||
* @ingroup nrf_drv_usbd
|
||||
*
|
||||
* Functions here are checking the presence of an error in current chip.
|
||||
* The checking is done at runtime based on the microcontroller version.
|
||||
* This file is subject to removal when nRF51840 prototype support is removed.
|
||||
*/
|
||||
|
||||
#ifndef NRF_DRV_USBD_ERRATA_ENABLE
|
||||
/**
|
||||
* @brief The constant that informs if errata should be enabled at all
|
||||
*
|
||||
* If this constant is set to 0, all the Errata bug fixes will be automatically disabled.
|
||||
*/
|
||||
#define NRF_DRV_USBD_ERRATA_ENABLE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Internal auxiliary function to check if the program is running on NRF52840 chip
|
||||
* @retval true It is NRF52480 chip
|
||||
* @retval false It is other chip
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_type_52840(void)
|
||||
{
|
||||
return ((((*(uint32_t *)0xF0000FE0) & 0xFF) == 0x08) &&
|
||||
(((*(uint32_t *)0xF0000FE4) & 0x0F) == 0x0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Internal auxiliary function to check if the program is running on first sample of
|
||||
* NRF52840 chip
|
||||
* @retval true It is NRF52480 chip and it is first sample version
|
||||
* @retval false It is other chip
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_type_52840_proto1(void)
|
||||
{
|
||||
return ( nrf_drv_usbd_errata_type_52840() &&
|
||||
( ((*(uint32_t *)0xF0000FE8) & 0xF0) == 0x00 ) &&
|
||||
( ((*(uint32_t *)0xF0000FEC) & 0xF0) == 0x00 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Internal auxiliary function to check if the program is running on first final product of
|
||||
* NRF52840 chip
|
||||
* @retval true It is NRF52480 chip and it is first final product
|
||||
* @retval false It is other chip
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_type_52840_fp1(void)
|
||||
{
|
||||
return ( nrf_drv_usbd_errata_type_52840() &&
|
||||
( ((*(uint32_t *)0xF0000FE8) & 0xF0) == 0x20 ) &&
|
||||
( ((*(uint32_t *)0xF0000FEC) & 0xF0) == 0x00 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 104
|
||||
*
|
||||
* Errata: USBD: EPDATA event is not always generated.
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_104(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && nrf_drv_usbd_errata_type_52840_proto1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 154
|
||||
*
|
||||
* Errata: During setup read/write transfer USBD acknowledges setup stage without SETUP task.
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_154(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && nrf_drv_usbd_errata_type_52840_proto1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 166
|
||||
*
|
||||
* Errata: ISO double buffering not functional
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_166(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 171
|
||||
*
|
||||
* Errata: USBD might not reach its active state.
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_171(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 187
|
||||
*
|
||||
* Errata: USB cannot be enabled
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_187(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && nrf_drv_usbd_errata_type_52840_fp1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata ???
|
||||
*
|
||||
* Errata: SIZE.EPOUT not writable
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usbd_errata_sizeepout_rw(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && nrf_drv_usbd_errata_type_52840_proto1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Function to check if chip requires errata 199
|
||||
*
|
||||
* Errata: USBD cannot receive tasks during DMA
|
||||
*
|
||||
* @retval true Errata should be implemented
|
||||
* @retval false Errata should not be implemented
|
||||
*/
|
||||
static inline bool nrf_drv_usb_errata_199(void)
|
||||
{
|
||||
return NRF_DRV_USBD_ERRATA_ENABLE && true;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
#endif /* NRF_DRV_USBD_ERRATA_H__ */
|
Loading…
x
Reference in New Issue
Block a user