power tests
This commit is contained in:
@@ -76,9 +76,6 @@ SRC_FILES += \
|
||||
$(SDK_ROOT)/components/libraries/bsp/bsp.c \
|
||||
$(SDK_ROOT)/components/libraries/bsp/bsp_cli.c \
|
||||
\
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_init.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/nrf_hw/nrf_hw_backend_rng_mbedtls.c \
|
||||
$(SDK_ROOT)/external/cifra_AES128-EAX/blockwise.c \
|
||||
$(SDK_ROOT)/external/cifra_AES128-EAX/cifra_cmac.c \
|
||||
$(SDK_ROOT)/external/cifra_AES128-EAX/cifra_eax_aes.c \
|
||||
@@ -88,38 +85,9 @@ SRC_FILES += \
|
||||
$(SDK_ROOT)/external/cifra_AES128-EAX/modes.c \
|
||||
$(SDK_ROOT)/external/fprintf/nrf_fprintf.c \
|
||||
$(SDK_ROOT)/external/fprintf/nrf_fprintf_format.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecc.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdh.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc/micro_ecc_backend_ecdsa.c \
|
||||
$(SDK_ROOT)/integration/nrfx/legacy/nrf_drv_rng.c \
|
||||
$(SDK_ROOT)/modules/nrfx/drivers/src/prs/nrfx_prs.c \
|
||||
$(SDK_ROOT)/modules/nrfx/drivers/src/nrfx_rng.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cifra/cifra_backend_aes_aead.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_aead.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_aes.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_aes_shared.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_ecc.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_ecdh.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_ecdsa.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_error.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_hash.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_hkdf.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_hmac.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_init.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_rng.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/nrf_crypto_shared.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_aes.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_aes_aead.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_chacha_poly_aead.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_ecc.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_ecdh.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_ecdsa.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_hash.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_hmac.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_init.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_mutex.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_rng.c \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310/cc310_backend_shared.c \
|
||||
|
||||
|
||||
|
||||
@@ -193,8 +161,6 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/modules/nrfx/hal \
|
||||
$(SDK_ROOT)/external/fprintf \
|
||||
\
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310 \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cifra \
|
||||
$(SDK_ROOT)/external/fprintf \
|
||||
$(PROJ_DIR) \
|
||||
$(SDK_ROOT)/components/libraries/experimental_section_vars \
|
||||
@@ -209,7 +175,6 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/libraries/mem_manager \
|
||||
$(SDK_ROOT)/external/nrf_oberon \
|
||||
$(SDK_ROOT)/components/libraries/atomic \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/nrf_sw \
|
||||
$(SDK_ROOT)/components/libraries/strerror \
|
||||
$(SDK_ROOT)/integration/nrfx \
|
||||
$(SDK_ROOT)/modules/nrfx/drivers/include \
|
||||
@@ -218,22 +183,15 @@ INC_FOLDERS += \
|
||||
$(SDK_ROOT)/components/libraries/util \
|
||||
$(SDK_ROOT)/modules/nrfx \
|
||||
$(SDK_ROOT)/components/drivers_nrf/nrf_soc_nosd \
|
||||
$(SDK_ROOT)/external/micro-ecc/micro-ecc \
|
||||
$(SDK_ROOT)/external/segger_rtt \
|
||||
$(SDK_ROOT)/modules/nrfx/mdk \
|
||||
$(SDK_ROOT)/modules/nrfx/hal \
|
||||
$(SDK_ROOT)/components/libraries/mutex \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/micro_ecc \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/mbedtls \
|
||||
$(SDK_ROOT)/components/libraries/queue \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/nrf_hw \
|
||||
$(SDK_ROOT)/integration/nrfx/legacy \
|
||||
$(SDK_ROOT)/external/cifra_AES128-EAX \
|
||||
$(SDK_ROOT)/external/nrf_tls/mbedtls/nrf_crypto/config \
|
||||
$(SDK_ROOT)/components/boards \
|
||||
$(SDK_ROOT)/external/nrf_cc310/include \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/cc310_bl \
|
||||
$(SDK_ROOT)/components/libraries/crypto/backend/oberon \
|
||||
|
||||
|
||||
# Libraries common to all targets
|
||||
@@ -256,6 +214,7 @@ CFLAGS += -DNRF52840_XXAA
|
||||
#CFLAGS += -DSTUB_CTAPHID
|
||||
#CFLAGS += -DSTUB_CTAP
|
||||
CFLAGS += -DuECC_PLATFORM=5
|
||||
CFLAGS += -DTEST_POWER
|
||||
CFLAGS += -std=gnu11
|
||||
CFLAGS += -mcpu=cortex-m4
|
||||
CFLAGS += -mthumb -mabi=aapcs
|
||||
|
@@ -6,22 +6,22 @@
|
||||
// <i> or this value is actually used. It depends on which one is bigger.
|
||||
|
||||
#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP
|
||||
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 64
|
||||
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 4096
|
||||
#endif
|
||||
|
||||
// <o> SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Size of upstream buffer.
|
||||
#ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS
|
||||
#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 8
|
||||
#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 16
|
||||
#endif
|
||||
|
||||
// <o> SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of upstream buffer.
|
||||
#ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN
|
||||
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 64
|
||||
#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 8
|
||||
#endif
|
||||
|
||||
// <o> SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Size of upstream buffer.
|
||||
#ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS
|
||||
#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 8
|
||||
#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2
|
||||
#endif
|
||||
|
||||
// <o> SEGGER_RTT_CONFIG_DEFAULT_MODE - RTT behavior if the buffer is full.
|
||||
@@ -36,9 +36,9 @@
|
||||
// <2=> BLOCK_IF_FIFO_FULL
|
||||
|
||||
#ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE
|
||||
#define SEGGER_RTT_CONFIG_DEFAULT_MODE 2
|
||||
#define SEGGER_RTT_CONFIG_DEFAULT_MODE 1
|
||||
|
||||
#define APP_FIFO_ENABLED 1
|
||||
#define APP_FIFO_ENABLED 2
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -179,40 +179,6 @@ void crypto_ecc256_init()
|
||||
ret = SaSi_LibInit();
|
||||
if (ret != SA_SILIB_RET_OK) {
|
||||
printf("Failed SaSi_LibInit - ret = 0x%x\n", ret);
|
||||
/*switch(ret)*/
|
||||
/*{*/
|
||||
/*case SA_SILIB_RET_OK:*/
|
||||
/*printf("SA_SILIB_RET_OK\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_EINVAL_CTX_PTR:*/
|
||||
/*printf("SA_SILIB_RET_EINVAL_CTX_PTR\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_EINVAL_WORK_BUF_PTR:*/
|
||||
/*printf("SA_SILIB_RET_EINVAL_WORK_BUF_PTR\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_HAL:*/
|
||||
/*printf("SA_SILIB_RET_HAL\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_PAL:*/
|
||||
/*printf("SA_SILIB_RET_PAL\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_EINVAL_HW_VERSION :*/
|
||||
/*printf("SA_SILIB_RET_EINVAL_HW_VERSION \n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RET_EINVAL_HW_SIGNATURE:*/
|
||||
/*printf("SA_SILIB_RET_EINVAL_HW_SIGNATURE\n");*/
|
||||
/*break;*/
|
||||
|
||||
/*case SA_SILIB_RESERVE32B:*/
|
||||
/*printf("SA_SILIB_RESERVE32B\n");*/
|
||||
/*break;*/
|
||||
/*}*/
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -223,8 +189,7 @@ void crypto_ecc256_init()
|
||||
ret = CRYS_RndInit(&rndState_ptr, &rndWorkBuff_ptr);
|
||||
if (ret != SA_SILIB_RET_OK) {
|
||||
printf("Failed CRYS_RndInit - ret = 0x%x\n", ret);
|
||||
while(1)
|
||||
;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_es256_curve = CRYS_ECPKI_GetEcDomain(CRYS_ECPKI_DomainID_secp256r1);
|
||||
@@ -374,7 +339,7 @@ void derive_private_key_pair(uint8_t * data, int len, uint8_t * data2, int len2,
|
||||
break;
|
||||
}
|
||||
|
||||
// There isn't a CC310 function for calculating a public key from a private
|
||||
// There isn't a CC310 function for calculating a public key from a private,
|
||||
// so to get around it, we can "fix" the RNG input to GenKeyPair
|
||||
|
||||
if(pubkey != NULL)
|
||||
|
@@ -168,17 +168,21 @@ app_fifo_t USBHID_RECV_FIFO;
|
||||
|
||||
void usbhid_init()
|
||||
{
|
||||
#ifndef TEST_POWER
|
||||
app_fifo_init(&USBHID_RECV_FIFO, fifo_buf, sizeof(fifo_buf));
|
||||
usb_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Receive 64 byte USB HID message, don't block, return size of packet, return 0 if nothing
|
||||
#ifndef TEST_POWER
|
||||
int usbhid_recv(uint8_t * msg)
|
||||
{
|
||||
uint32_t size = 64;
|
||||
app_fifo_read(&USBHID_RECV_FIFO, msg, &size);
|
||||
return size;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Send 64 byte USB HID message
|
||||
@@ -212,12 +216,13 @@ void heartbeat()
|
||||
nrf_gpio_pin_toggle(LED_4);
|
||||
}
|
||||
|
||||
|
||||
#ifndef TEST_POWER
|
||||
void ctaphid_write_block(uint8_t * data)
|
||||
{
|
||||
printf1(TAG_DUMP,"<< "); dump_hex1(TAG_DUMP,data, 64);
|
||||
usbhid_send(data);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int ctap_user_presence_test()
|
||||
|
@@ -13,6 +13,8 @@ void set_logging_tag(uint32_t tag)
|
||||
term++;
|
||||
tag = tag >> 1;
|
||||
}
|
||||
|
||||
_SEGGER_TERM = term;
|
||||
}
|
||||
|
||||
#if defined(__CC_ARM)
|
||||
@@ -44,12 +46,23 @@ int __putchar(int ch, FILE * p_file)
|
||||
int _write(int file, const char * p_char, int len)
|
||||
{
|
||||
int i;
|
||||
static int lastterm = -1;
|
||||
/*char buf[2];*/
|
||||
/*buf[1] = 0;*/
|
||||
|
||||
UNUSED_PARAMETER(file);
|
||||
|
||||
if (_SEGGER_TERM != lastterm)
|
||||
{
|
||||
SEGGER_RTT_SetTerminal(_SEGGER_TERM);
|
||||
lastterm = _SEGGER_TERM;
|
||||
}
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
SEGGER_RTT_PutChar(_SEGGER_TERM, *p_char++);
|
||||
/*buf[0] = *p_char++;*/
|
||||
SEGGER_RTT_PutChar(0, *p_char++);
|
||||
/*SEGGER_RTT_TerminalOut(_SEGGER_TERM, buf);*/
|
||||
}
|
||||
|
||||
return len;
|
||||
@@ -58,11 +71,6 @@ int _write(int file, const char * p_char, int len)
|
||||
int _read(int file, char * p_char, int len)
|
||||
{
|
||||
*p_char = '0';
|
||||
/*UNUSED_PARAMETER(file);*/
|
||||
/*while (app_uart_get((uint8_t *)p_char) == NRF_ERROR_NOT_FOUND)*/
|
||||
/*{*/
|
||||
/*// No implementation needed.*/
|
||||
/*}*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -58,6 +58,7 @@
|
||||
#include "nrf_cli.h"
|
||||
|
||||
#include "util.h"
|
||||
#include "log.h"
|
||||
#include "usb.h"
|
||||
|
||||
#define BTN_DATA_SEND 0
|
||||
@@ -448,7 +449,7 @@ static void respond_setup_data(
|
||||
ret = nrf_drv_usbd_ep_transfer(NRF_DRV_USBD_EPIN0, &transfer);
|
||||
if (ret != NRF_SUCCESS)
|
||||
{
|
||||
printf("Transfer starting failed: %lu", (uint32_t)ret);
|
||||
printf1(TAG_USB,"Transfer starting failed: %lu", (uint32_t)ret);
|
||||
}
|
||||
ASSERT(ret == NRF_SUCCESS);
|
||||
UNUSED_VARIABLE(ret);
|
||||
@@ -538,7 +539,7 @@ static void usbd_setup_GetStatus(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
default:
|
||||
break; // Just go to stall
|
||||
}
|
||||
printf("Unknown status: 0x%2x", p_setup->bmRequestType);
|
||||
printf1(TAG_USB,"Unknown status: 0x%2x", p_setup->bmRequestType);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -568,7 +569,7 @@ static void usbd_setup_ClearFeature(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Unknown feature to clear");
|
||||
printf1(TAG_USB,"Unknown feature to clear");
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -598,7 +599,7 @@ static void usbd_setup_SetFeature(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Unknown feature to set");
|
||||
printf1(TAG_USB, "Unknown feature to set");
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -673,7 +674,7 @@ static void usbd_setup_GetDescriptor(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
if ((p_setup->bmRequestType) == 0x80)
|
||||
{
|
||||
// Which endpoint?
|
||||
printf("endpoint descriptor: %d\n", ((p_setup->wValue) & 0xFF));
|
||||
printf1(TAG_USB,"endpoint descriptor: %d\n", ((p_setup->wValue) & 0xFF));
|
||||
if (((p_setup->wValue) & 0xFF) == 1)
|
||||
{
|
||||
respond_setup_data(
|
||||
@@ -725,7 +726,7 @@ static void usbd_setup_GetDescriptor(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
break; // Not supported - go to stall
|
||||
}
|
||||
|
||||
printf("Unknown : 0x%02x, type: 0x%02x or value: 0x%02x\n",
|
||||
printf1(TAG_USB,"Unknown : 0x%02x, type: 0x%02x or value: 0x%02x\n",
|
||||
p_setup->wValue >> 8,
|
||||
p_setup->bmRequestType,
|
||||
p_setup->wValue & 0xFF);
|
||||
@@ -765,7 +766,7 @@ static void usbd_setup_SetConfig(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Wrong configuration: Index: 0x%2x, Value: 0x%2x.",
|
||||
printf1(TAG_USB,"Wrong configuration: Index: 0x%2x, Value: 0x%2x.",
|
||||
p_setup->wIndex,
|
||||
p_setup->wValue);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
@@ -779,7 +780,7 @@ static void usbd_setup_SetIdle(nrf_drv_usbd_setup_t const * const p_setup)
|
||||
nrf_drv_usbd_setup_clear();
|
||||
return;
|
||||
}
|
||||
printf("Set Idle wrong type: 0x%2x.", p_setup->bmRequestType);
|
||||
printf1(TAG_USB,"Set Idle wrong type: 0x%2x.", p_setup->bmRequestType);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -787,7 +788,7 @@ static void usbd_setup_SetInterface(
|
||||
nrf_drv_usbd_setup_t const * const p_setup)
|
||||
{
|
||||
//no alternate setting is supported - STALL always
|
||||
printf("No alternate interfaces supported.");
|
||||
printf1(TAG_USB,"No alternate interfaces supported.");
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -800,7 +801,7 @@ static void usbd_setup_SetProtocol(
|
||||
nrf_drv_usbd_setup_clear();
|
||||
return;
|
||||
}
|
||||
printf("Set Protocol wrong type: 0x%2x.", p_setup->bmRequestType);
|
||||
printf1(TAG_USB,"Set Protocol wrong type: 0x%2x.", p_setup->bmRequestType);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
|
||||
@@ -818,15 +819,15 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
switch (p_event->type)
|
||||
{
|
||||
case NRF_DRV_USBD_EVT_SUSPEND:
|
||||
printf("SUSPEND state detected\n");
|
||||
printf1(TAG_USB,"SUSPEND state detected\n");
|
||||
m_usbd_suspend_state_req = true;
|
||||
break;
|
||||
case NRF_DRV_USBD_EVT_RESUME:
|
||||
printf("RESUMING from suspend\n");
|
||||
printf1(TAG_USB,"RESUMING from suspend\n");
|
||||
m_usbd_suspend_state_req = false;
|
||||
break;
|
||||
case NRF_DRV_USBD_EVT_WUREQ:
|
||||
printf("RemoteWU initiated\n");
|
||||
printf1(TAG_USB,"RemoteWU initiated\n");
|
||||
m_usbd_suspend_state_req = false;
|
||||
break;
|
||||
case NRF_DRV_USBD_EVT_RESET:
|
||||
@@ -859,7 +860,7 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
app_fifo_write(&USBHID_RECV_FIFO, buf, &size);
|
||||
if (size != 64)
|
||||
{
|
||||
printf("Error, USB FIFO is full\n");
|
||||
printf2(TAG_ERR,"Error, USB FIFO is full\n");
|
||||
APP_ERROR_CHECK(NRF_ERROR_NO_MEM);
|
||||
}
|
||||
break;
|
||||
@@ -869,16 +870,16 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
transfer.size = nrf_drv_usbd_epout_size_get(NRF_DRV_USBD_EPOUT1);;
|
||||
if (transfer.size > 64)
|
||||
{
|
||||
printf("Error, invalid transfer size\n");
|
||||
printf2(TAG_ERR,"Error, invalid transfer size\n");
|
||||
return;
|
||||
}
|
||||
nrf_drv_usbd_ep_transfer(NRF_DRV_USBD_EPOUT1, &transfer);
|
||||
break;
|
||||
case NRF_USBD_EP_OVERLOAD:
|
||||
printf("NRF_USBD_EP_OVERLOAD\n");
|
||||
printf1(TAG_ERR,"NRF_USBD_EP_OVERLOAD\n");
|
||||
break;
|
||||
case NRF_USBD_EP_ABORTED:
|
||||
printf("NRF_USBD_EP_ABORTED\n");
|
||||
printf1(TAG_ERR,"NRF_USBD_EP_ABORTED\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -898,11 +899,11 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
else if (NRF_USBD_EP_ABORTED == p_event->data.eptransfer.status)
|
||||
{
|
||||
/* Just ignore */
|
||||
printf("Transfer aborted event on EPIN0\n");
|
||||
printf1(TAG_USB,"Transfer aborted event on EPIN0\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Transfer failed on EPIN0: %d", p_event->data.eptransfer.status);
|
||||
printf1(TAG_USB,"Transfer failed on EPIN0: %d", p_event->data.eptransfer.status);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
}
|
||||
@@ -923,11 +924,11 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
else if (NRF_USBD_EP_ABORTED == p_event->data.eptransfer.status)
|
||||
{
|
||||
/* Just ignore */
|
||||
printf("Transfer aborted event on EPOUT0\n");
|
||||
printf1(TAG_USB,"Transfer aborted event on EPOUT0\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Transfer failed on EPOUT0: %d", p_event->data.eptransfer.status);
|
||||
printf1(TAG_USB,"Transfer failed on EPOUT0: %d", p_event->data.eptransfer.status);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
}
|
||||
@@ -979,19 +980,19 @@ static void usbd_event_handler(nrf_drv_usbd_evt_t const * const p_event)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Command 0xB. Unknown request: 0x%2x", setup.bmRequestType);
|
||||
printf1(TAG_USB,"Command 0xB. Unknown request: 0x%2x", setup.bmRequestType);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf("Unknown request: 0x%2x", setup.bmRequest);
|
||||
printf1(TAG_USB,"Unknown request: 0x%2x", setup.bmRequest);
|
||||
nrf_drv_usbd_setup_stall();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("unknown usb event\n");
|
||||
printf1(TAG_USB,"unknown usb event\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1003,14 +1004,14 @@ static void power_usb_event_handler(nrf_drv_power_usb_evt_t event)
|
||||
switch (event)
|
||||
{
|
||||
case NRF_DRV_POWER_USB_EVT_DETECTED:
|
||||
printf("USB power detected\n");
|
||||
printf1(TAG_USB,"USB power detected\n");
|
||||
if (!nrf_drv_usbd_is_enabled())
|
||||
{
|
||||
nrf_drv_usbd_enable();
|
||||
}
|
||||
break;
|
||||
case NRF_DRV_POWER_USB_EVT_REMOVED:
|
||||
printf("USB power removed\n");
|
||||
printf1(TAG_USB,"USB power removed\n");
|
||||
m_usbd_configured = false;
|
||||
m_send_mouse_position = false;
|
||||
if (nrf_drv_usbd_is_started())
|
||||
@@ -1026,7 +1027,7 @@ static void power_usb_event_handler(nrf_drv_power_usb_evt_t event)
|
||||
bsp_board_led_off(LED_USB_POWER);
|
||||
break;
|
||||
case NRF_DRV_POWER_USB_EVT_READY:
|
||||
printf("USB ready\n");
|
||||
printf1(TAG_USB,"USB ready\n");
|
||||
bsp_board_led_on(LED_USB_POWER);
|
||||
if (!nrf_drv_usbd_is_started())
|
||||
{
|
||||
|
Reference in New Issue
Block a user