Nordic nrfx usb driver integration
This commit is contained in:
40
external/platform/nrfx/templates/nrfx_glue.h
vendored
40
external/platform/nrfx/templates/nrfx_glue.h
vendored
@@ -32,11 +32,13 @@
|
||||
#ifndef NRFX_GLUE_H__
|
||||
#define NRFX_GLUE_H__
|
||||
|
||||
// THIS IS A TEMPLATE FILE.
|
||||
// It should be copied to a suitable location within the host environment into
|
||||
// which nrfx is integrated, and the following macros should be provided with
|
||||
// appropriate implementations.
|
||||
// And this comment should be removed from the customized file.
|
||||
#include <assert.h>
|
||||
#include <arch/atomic.h>
|
||||
#include <arch/arm/cm.h>
|
||||
|
||||
// THIS WAS CREATED FROM THE TEMPLATE FILE INCLUDED WITH THE MDK.
|
||||
// This is the clue that binds macros used in the MDK with LK specific implementations
|
||||
// If the MDK is upgraded in the future, this will need to be carried over.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -54,6 +56,7 @@ extern "C" {
|
||||
// Uncomment this line to use the standard MDK way of binding IRQ handlers
|
||||
// at linking time.
|
||||
//#include <soc/nrfx_irqs.h>
|
||||
#define nrfx_usbd_irq_handler nrf52_USBD_IRQ
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -62,14 +65,14 @@ extern "C" {
|
||||
*
|
||||
* @param expression Expression to be evaluated.
|
||||
*/
|
||||
#define NRFX_ASSERT(expression)
|
||||
#define NRFX_ASSERT(expression) DEBUG_ASSERT(expression)
|
||||
|
||||
/**
|
||||
* @brief Macro for placing a compile time assertion.
|
||||
*
|
||||
* @param expression Expression to be evaluated.
|
||||
*/
|
||||
#define NRFX_STATIC_ASSERT(expression)
|
||||
#define NRFX_STATIC_ASSERT(expression) STATIC_ASSERT(expression)
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -79,14 +82,14 @@ extern "C" {
|
||||
* @param irq_number IRQ number.
|
||||
* @param priority Priority to be set.
|
||||
*/
|
||||
#define NRFX_IRQ_PRIORITY_SET(irq_number, priority)
|
||||
#define NRFX_IRQ_PRIORITY_SET(irq_number, priority) NVIC_SetPriority(irq_number, priority)
|
||||
|
||||
/**
|
||||
* @brief Macro for enabling a specific IRQ.
|
||||
*
|
||||
* @param irq_number IRQ number.
|
||||
*/
|
||||
#define NRFX_IRQ_ENABLE(irq_number)
|
||||
#define NRFX_IRQ_ENABLE(irq_number) NVIC_EnableIRQ(irq_number)
|
||||
|
||||
/**
|
||||
* @brief Macro for checking if a specific IRQ is enabled.
|
||||
@@ -96,28 +99,28 @@ extern "C" {
|
||||
* @retval true If the IRQ is enabled.
|
||||
* @retval false Otherwise.
|
||||
*/
|
||||
#define NRFX_IRQ_IS_ENABLED(irq_number)
|
||||
#define NRFX_IRQ_IS_ENABLED(irq_number) NVIC_GetEnableIRQ(irq_number)
|
||||
|
||||
/**
|
||||
* @brief Macro for disabling a specific IRQ.
|
||||
*
|
||||
* @param irq_number IRQ number.
|
||||
*/
|
||||
#define NRFX_IRQ_DISABLE(irq_number)
|
||||
#define NRFX_IRQ_DISABLE(irq_number) NVIC_DisableIRQ(irq_number)
|
||||
|
||||
/**
|
||||
* @brief Macro for setting a specific IRQ as pending.
|
||||
*
|
||||
* @param irq_number IRQ number.
|
||||
*/
|
||||
#define NRFX_IRQ_PENDING_SET(irq_number)
|
||||
#define NRFX_IRQ_PENDING_SET(irq_number) NVIC_SetPendingIRQ(irq_number)
|
||||
|
||||
/**
|
||||
* @brief Macro for clearing the pending status of a specific IRQ.
|
||||
*
|
||||
* @param irq_number IRQ number.
|
||||
*/
|
||||
#define NRFX_IRQ_PENDING_CLEAR(irq_number)
|
||||
#define NRFX_IRQ_PENDING_CLEAR(irq_number) NVIC_ClearPendingIRQ(irq_number)
|
||||
|
||||
/**
|
||||
* @brief Macro for checking the pending status of a specific IRQ.
|
||||
@@ -125,7 +128,7 @@ extern "C" {
|
||||
* @retval true If the IRQ is pending.
|
||||
* @retval false Otherwise.
|
||||
*/
|
||||
#define NRFX_IRQ_IS_PENDING(irq_number)
|
||||
#define NRFX_IRQ_IS_PENDING(irq_number) NVIC_GetPendingIRQ(irq_number)
|
||||
|
||||
/** @brief Macro for entering into a critical section. */
|
||||
#define NRFX_CRITICAL_SECTION_ENTER()
|
||||
@@ -153,7 +156,7 @@ extern "C" {
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @brief Atomic 32-bit unsigned type. */
|
||||
#define nrfx_atomic_t
|
||||
#define nrfx_atomic_t volatile int
|
||||
|
||||
/**
|
||||
* @brief Macro for storing a value to an atomic object and returning its previous value.
|
||||
@@ -173,7 +176,7 @@ extern "C" {
|
||||
*
|
||||
* @return Previous value of the atomic object.
|
||||
*/
|
||||
#define NRFX_ATOMIC_FETCH_OR(p_data, value)
|
||||
#define NRFX_ATOMIC_FETCH_OR(p_data, value) atomic_or(p_data, value)
|
||||
|
||||
/**
|
||||
* @brief Macro for running a bitwise AND operation on an atomic object
|
||||
@@ -184,8 +187,7 @@ extern "C" {
|
||||
*
|
||||
* @return Previous value of the atomic object.
|
||||
*/
|
||||
#define NRFX_ATOMIC_FETCH_AND(p_data, value)
|
||||
|
||||
#define NRFX_ATOMIC_FETCH_AND(p_data, value) atomic_and(p_data, value)
|
||||
/**
|
||||
* @brief Macro for running a bitwise XOR operation on an atomic object
|
||||
* and returning its previous value.
|
||||
@@ -206,7 +208,7 @@ extern "C" {
|
||||
*
|
||||
* @return Previous value of the atomic object.
|
||||
*/
|
||||
#define NRFX_ATOMIC_FETCH_ADD(p_data, value)
|
||||
#define NRFX_ATOMIC_FETCH_ADD(p_data, value) atomic_add(p_data, value)
|
||||
|
||||
/**
|
||||
* @brief Macro for running a subtraction operation on an atomic object
|
||||
|
||||
@@ -59,6 +59,12 @@ DEFAULT_HANDLER(SPIM2_SPIS2_SPI2_IRQ);
|
||||
DEFAULT_HANDLER(RTC2_IRQ);
|
||||
DEFAULT_HANDLER(I2S_IRQ);
|
||||
DEFAULT_HANDLER(FPU_IRQ);
|
||||
DEFAULT_HANDLER(USBD_IRQ);
|
||||
DEFAULT_HANDLER(UARTE1_IRQ);
|
||||
DEFAULT_HANDLER(QSPI_IRQ);
|
||||
DEFAULT_HANDLER(CRYPTOCELL_IRQ);
|
||||
DEFAULT_HANDLER(PWM3_IRQ);
|
||||
DEFAULT_HANDLER(SPIM3_IRQ);
|
||||
|
||||
|
||||
#define VECTAB_ENTRY(x) [x##n] = nrf52_##x
|
||||
@@ -96,6 +102,8 @@ const void *const __SECTION(".text.boot.vectab2") vectab2[] = {
|
||||
VECTAB_ENTRY(TIMER4_IRQ),
|
||||
VECTAB_ENTRY(PWM0_IRQ),
|
||||
VECTAB_ENTRY(PDM_IRQ),
|
||||
NULL,
|
||||
NULL,
|
||||
VECTAB_ENTRY(MWU_IRQ),
|
||||
VECTAB_ENTRY(PWM1_IRQ),
|
||||
VECTAB_ENTRY(PWM2_IRQ),
|
||||
@@ -103,5 +111,14 @@ const void *const __SECTION(".text.boot.vectab2") vectab2[] = {
|
||||
VECTAB_ENTRY(RTC2_IRQ),
|
||||
VECTAB_ENTRY(I2S_IRQ),
|
||||
VECTAB_ENTRY(FPU_IRQ),
|
||||
VECTAB_ENTRY(USBD_IRQ),
|
||||
VECTAB_ENTRY(UARTE1_IRQ),
|
||||
VECTAB_ENTRY(QSPI_IRQ),
|
||||
VECTAB_ENTRY(CRYPTOCELL_IRQ),
|
||||
NULL,
|
||||
NULL,
|
||||
VECTAB_ENTRY(PWM3_IRQ),
|
||||
NULL,
|
||||
VECTAB_ENTRY(SPIM3_IRQ),
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
TARGET := nrf-pca10056
|
||||
|
||||
GLOBAL_DEFINES += NRF52840_XXAA
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <lk/debug.h>
|
||||
#include <target.h>
|
||||
#include <lk/compiler.h>
|
||||
#include <nrfx_usbd.h>
|
||||
#include <dev/gpio.h>
|
||||
#include <platform/gpio.h>
|
||||
#include <platform/nrf52.h>
|
||||
@@ -29,7 +30,15 @@ void target_early_init(void) {
|
||||
}
|
||||
|
||||
|
||||
static void target_usb_init(void) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void target_init(void) {
|
||||
nrf52_debug_init();
|
||||
dprintf(SPEW,"Target: PCA10056 DK...\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@ PLATFORM := nrf52xxx
|
||||
|
||||
GLOBAL_DEFINES += \
|
||||
ENABLE_UART0=1 \
|
||||
|
||||
NRFX_USBD_ENABLED=1 \
|
||||
NRF52840_XXAA \
|
||||
|
||||
|
||||
MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/init.c
|
||||
|
||||
Reference in New Issue
Block a user