1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

cpu/nrf5x: moved nrfmin driver to nrf5x_common

This commit is contained in:
Hauke Petersen 2016-11-11 11:44:43 +01:00
parent f82c7340a5
commit a05233633f
8 changed files with 29 additions and 22 deletions

View File

@ -4,11 +4,6 @@ MODULE = cpu
# add a list of subdirectories, that should also be build
DIRS = periph $(RIOTCPU)/cortexm_common $(RIOTCPU)/nrf5x_common
# build one of the radio drivers, if enabled
ifneq (,$(filter nrfmin,$(USEMODULE)))
DIRS += radio/nrfmin
endif
# (file triggers compiler bug. see #5775)
SRC_NOLTO += vectors.c

View File

@ -1,3 +0,0 @@
MODULE = nrfmin
include $(RIOTBASE)/Makefile.base

View File

@ -1,3 +1,8 @@
DIRS = periph
# build one of the radio drivers, if enabled
ifneq (,$(filter nrfmin,$(USEMODULE)))
DIRS += radio/nrfmin
endif
include $(RIOTBASE)/Makefile.base

View File

@ -7,8 +7,8 @@
*/
/**
* @defgroup drivers_nrf51822_nrfmin NRF Minimal Radio Driver
* @ingroup drivers_netdev
* @defgroup drivers_nrf5x_nrfmin NRF Minimal Radio Driver
* @ingroup drivers_netdev2
* @brief Minimal driver for the NRF51 radio
*
* This driver uses the nRF5x radio in a proprietary/custom way, defining our
@ -42,7 +42,7 @@
* - dst_addr: 16-bit destination address
* - proto: type of data transferred (similar to an Ethertype field)
*
* SUMMERY:
* SUMMARY:
* This driver / link layer supports:
* - 16-bit addressing (16-bit)
* -> extract default address from CPU ID

View File

@ -7,8 +7,8 @@
*/
/**
* @defgroup drivers_nrf51822_nrfmin_gnrc GNRC adapter for nrfmin
* @ingroup drivers_nrf51822_nrfmin
* @defgroup drivers_nrf5x_nrfmin_gnrc GNRC adapter for nrfmin
* @ingroup drivers_nrf5x_nrfmin
* @brief Minimal driver for the NRF51 radio
*
* @{

View File

@ -0,0 +1,9 @@
MODULE = nrfmin
SRC = nrfmin.c
ifneq (,$(filter gnrc_netdev_default,$(USEMODULE)))
SRC += nrfmin_gnrc.c
endif
include $(RIOTBASE)/Makefile.base

View File

@ -7,7 +7,7 @@
*/
/**
* @ingroup drivers_nrf51_nrfmin
* @ingroup drivers_nrf5x_nrfmin
* @{
*
* @file
@ -428,8 +428,9 @@ static int nrfmin_init(netdev2_t *dev)
(CONF_BASE_ADDR_LEN << RADIO_PCNF1_BALEN_Pos) |
(CONF_STATLEN << RADIO_PCNF1_STATLEN_Pos) |
(NRFMIN_PKT_MAX << RADIO_PCNF1_MAXLEN_Pos));
/* configure the CRC unit */
NRF_RADIO->CRCCNF = CONF_CRC_LEN;
/* configure the CRC unit, we skip the address field as this seems to lead
* to wrong checksum calculation on nRF52 devices in some cases */
NRF_RADIO->CRCCNF = CONF_CRC_LEN | RADIO_CRCCNF_SKIPADDR_Msk;
NRF_RADIO->CRCPOLY = CONF_CRC_POLY;
NRF_RADIO->CRCINIT = CONF_CRC_INIT;
/* set shortcuts for more efficient transfer */

View File

@ -7,7 +7,7 @@
*/
/**
* @ingroup drivers_nrf51_nrfmin
* @ingroup drivers_nrf5x_nrfmin_gnrc
* @{
*
* @file
@ -81,7 +81,7 @@ static int hdr_netif_to_nrfmin(nrfmin_hdr_t *nrfmin, gnrc_pktsnip_t *pkt)
return 0;
}
static int nrfmin_gnrc_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt)
static int gnrc_nrfmin_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt)
{
int res;
struct iovec *vec;
@ -124,7 +124,7 @@ static int nrfmin_gnrc_send(gnrc_netdev2_t *dev, gnrc_pktsnip_t *pkt)
return res;
}
static gnrc_pktsnip_t *nrfmin_gnrc_recv(gnrc_netdev2_t *dev)
static gnrc_pktsnip_t *gnrc_nrfmin_recv(gnrc_netdev2_t *dev)
{
int pktsize;
nrfmin_hdr_t *nrfmin;
@ -185,14 +185,14 @@ static gnrc_pktsnip_t *nrfmin_gnrc_recv(gnrc_netdev2_t *dev)
return pkt_snip;
}
void nrfmin_gnrc_init(void)
void gnrc_nrfmin_init(void)
{
/* setup the NRFMIN driver */
nrfmin_setup();
/* initialize the GNRC plug struct */
plug.send = nrfmin_gnrc_send;
plug.recv = nrfmin_gnrc_recv;
plug.send = gnrc_nrfmin_send;
plug.recv = gnrc_nrfmin_recv;
plug.dev = &nrfmin_dev;
gnrc_netdev2_init(stack, sizeof(stack),