mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Merged nuttx/nuttx into master
This commit is contained in:
+1
-12
@@ -280,16 +280,6 @@ tools/cnvwindeps$(HOSTEXEEXT):
|
||||
# setting up symbolic links with 'generic' directory names to specific,
|
||||
# configured directories.
|
||||
#
|
||||
# Link the apps/include directory to include/apps
|
||||
|
||||
include/apps: Make.defs
|
||||
ifneq ($(APPDIR),)
|
||||
@echo "LN: include/apps to $(APPDIR)/include"
|
||||
$(Q) if [ -d $(TOPDIR)/$(APPDIR)/include ]; then \
|
||||
$(DIRLINK) $(TOPDIR)/$(APPDIR)/include include/apps; \
|
||||
fi
|
||||
endif
|
||||
|
||||
# Link the arch/<arch-name>/include directory to include/arch
|
||||
|
||||
include/arch: Make.defs
|
||||
@@ -324,7 +314,7 @@ ifneq ($(CONFIG_ARCH_CHIP),)
|
||||
$(Q) $(DIRLINK) $(TOPDIR)/$(ARCH_INC)/$(CONFIG_ARCH_CHIP) include/arch/chip
|
||||
endif
|
||||
|
||||
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip include/apps
|
||||
dirlinks: include/arch include/arch/board include/arch/chip $(ARCH_SRC)/board $(ARCH_SRC)/chip
|
||||
|
||||
# context
|
||||
#
|
||||
@@ -354,7 +344,6 @@ clean_context:
|
||||
$(Q) $(DIRUNLINK) include/arch
|
||||
$(Q) $(DIRUNLINK) $(ARCH_SRC)/board
|
||||
$(Q) $(DIRUNLINK) $(ARCH_SRC)/chip
|
||||
$(Q) $(DIRUNLINK) include/apps
|
||||
|
||||
# check_context
|
||||
#
|
||||
|
||||
+1
-15
@@ -275,19 +275,6 @@ tools\mkdeps$(HOSTEXEEXT):
|
||||
# setting up symbolic links with 'generic' directory names to specific,
|
||||
# configured directories.
|
||||
#
|
||||
# Link the apps\include directory to include\apps
|
||||
|
||||
include\apps: Make.defs
|
||||
ifneq ($(APPDIR),)
|
||||
@echo LN: include\apps $(APPDIR)\include
|
||||
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||
$(Q) /user:administrator mklink /d include\apps $(APPDIR)\include
|
||||
else
|
||||
$(Q) xcopy $(APPDIR)\include include\apps /c /q /s /e /y /i
|
||||
$(Q) echo FAKELNK > include\apps\.fakelnk
|
||||
endif
|
||||
endif
|
||||
|
||||
# Link the arch\<arch-name>\include directory to include\arch
|
||||
|
||||
include\arch: Make.defs
|
||||
@@ -347,7 +334,7 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip include\apps
|
||||
dirlinks: include\arch include\arch\board include\arch\chip $(ARCH_SRC)\board $(ARCH_SRC)\chip
|
||||
|
||||
# context
|
||||
#
|
||||
@@ -374,7 +361,6 @@ clean_context:
|
||||
$(call DELDIR, include\arch)
|
||||
$(call DELDIR, $(ARCH_SRC)\board)
|
||||
$(call DELDIR, $(ARCH_SRC)\chip)
|
||||
$(call DELDIR, include\apps)
|
||||
|
||||
# check_context
|
||||
#
|
||||
|
||||
@@ -205,19 +205,22 @@ config KINETIS_UART5
|
||||
config KINETIS_ENET
|
||||
bool "Ethernet"
|
||||
default n
|
||||
depends on ARCH_FAMILY_K60
|
||||
select NET
|
||||
depends on ARCH_FAMILY_K60 || ARCH_FAMILY_K64
|
||||
select ARCH_HAVE_PHY
|
||||
select ARCH_HAVE_NETDEV_STATISTICS
|
||||
select NET
|
||||
select NETDEVICES
|
||||
select NET_MULTIBUFFER
|
||||
---help---
|
||||
Support Ethernet (K60 only)
|
||||
Support Ethernet (K6x only)
|
||||
|
||||
config KINETIS_RNGB
|
||||
bool "Random number generator"
|
||||
default n
|
||||
depends on ARCH_FAMILY_K60
|
||||
depends on ARCH_FAMILY_K60 || ARCH_FAMILY_K64
|
||||
select ARCH_HAVE_RNG
|
||||
---help---
|
||||
Support the random number generator(K60 only)
|
||||
Support the random number generator(K6x only)
|
||||
|
||||
config KINETIS_FLEXCAN0
|
||||
bool "FlexCAN0"
|
||||
@@ -478,7 +481,7 @@ config KINETIS_FTM2_CHANNEL
|
||||
If FTM2 is enabled for PWM usage, you also need specifies the timer output
|
||||
channel {0,..,1}
|
||||
|
||||
comment "Kinetis GPIO Interrupt Configuration"
|
||||
menu "Kinetis GPIO Interrupt Configuration"
|
||||
|
||||
config GPIO_IRQ
|
||||
bool "GPIO pin interrupts"
|
||||
@@ -513,55 +516,54 @@ config KINETIS_PORTEINTS
|
||||
Enable support for 32 interrupts from GPIO port E pins
|
||||
|
||||
endif
|
||||
endmenu # Kinetis GPIO Interrupt Configuration
|
||||
|
||||
if KINETIS_ENET
|
||||
menu "Kinetis Ethernet Configuration"
|
||||
depends on KINETIS_ENET
|
||||
|
||||
comment "Kinetis Ethernet Configuration"
|
||||
|
||||
config ENET_ENHANCEDBD
|
||||
config KINETIS_ENETENHANCEDBD
|
||||
bool "Use enhanced buffer descriptors"
|
||||
default n
|
||||
---help---
|
||||
Use enhanced, 32-byte buffer descriptors
|
||||
|
||||
config ENET_NETHIFS
|
||||
config KINETIS_ENETNETHIFS
|
||||
int "Number of Ethernet interfaces"
|
||||
default 1
|
||||
---help---
|
||||
Number of Ethernet interfaces supported by the hardware. Must be
|
||||
one for now.
|
||||
|
||||
config ENET_NRXBUFFERS
|
||||
config KINETIS_ENETNRXBUFFERS
|
||||
int "Number of Ethernet Rx buffers"
|
||||
default 6
|
||||
---help---
|
||||
Number of Ethernet Rx buffers to use. The size of one buffer is
|
||||
determined by NET_BUFSIZE
|
||||
|
||||
config ENET_NTXBUFFERS
|
||||
config KINETIS_ENETNTXBUFFERS
|
||||
int "Number of Ethernet Tx buffers"
|
||||
default 2
|
||||
---help---
|
||||
Number of Ethernet Tx buffers to use. The size of one buffer is
|
||||
determined by NET_BUFSIZE
|
||||
|
||||
config ENET_PHYADDR
|
||||
config KINETIS_ENETPHYADDR
|
||||
int "PHY address"
|
||||
default 1
|
||||
---help---
|
||||
MII/RMII address of the PHY
|
||||
|
||||
config ENET_USEMII
|
||||
config KINETIS_ENETUSEMII
|
||||
bool "Use MII interface"
|
||||
default n
|
||||
---help---
|
||||
The the MII PHY interface. Default: Use RMII interface
|
||||
|
||||
endif
|
||||
endmenu # Kinetis Ethernet Configuration
|
||||
|
||||
if KINETIS_SDHC
|
||||
|
||||
comment "Kinetis SDHC Configuration"
|
||||
menu "Kinetis SDHC Configuration"
|
||||
depends on KINETIS_SDHC
|
||||
|
||||
config KINETIS_SDHC_ABSFREQ
|
||||
bool "Custom transfer frequencies"
|
||||
@@ -611,11 +613,13 @@ config KINETIS_SDHC_DMAPRIO
|
||||
---help---
|
||||
SDHC DMA priority
|
||||
|
||||
endif
|
||||
endmenu # Kinetis SDHC Configuration
|
||||
|
||||
comment "Kinetis UART Configuration"
|
||||
menu "Kinetis UART Configuration"
|
||||
|
||||
config KINETIS_UARTFIFOS
|
||||
bool "Enable UART0 FIFO"
|
||||
default n
|
||||
depends on KINETIS_UART0
|
||||
|
||||
endmenu # Kinetis UART Configuration
|
||||
|
||||
@@ -76,23 +76,23 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* CONFIG_ENET_NETHIFS determines the number of physical interfaces
|
||||
/* CONFIG_KINETIS_ENETNETHIFS determines the number of physical interfaces
|
||||
* that will be supported.
|
||||
*/
|
||||
|
||||
#if CONFIG_ENET_NETHIFS != 1
|
||||
# error "CONFIG_ENET_NETHIFS must be one for now"
|
||||
#if CONFIG_KINETIS_ENETNETHIFS != 1
|
||||
# error "CONFIG_KINETIS_ENETNETHIFS must be one for now"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ENET_NTXBUFFERS < 1
|
||||
#if CONFIG_KINETIS_ENETNTXBUFFERS < 1
|
||||
# error "Need at least one TX buffer"
|
||||
#endif
|
||||
|
||||
#if CONFIG_ENET_NRXBUFFERS < 1
|
||||
#if CONFIG_KINETIS_ENETNRXBUFFERS < 1
|
||||
# error "Need at least one RX buffer"
|
||||
#endif
|
||||
|
||||
#define NENET_NBUFFERS (CONFIG_ENET_NTXBUFFERS+CONFIG_ENET_NRXBUFFERS)
|
||||
#define NENET_NBUFFERS (CONFIG_KINETIS_ENETNTXBUFFERS+CONFIG_KINETIS_ENETNRXBUFFERS)
|
||||
|
||||
#ifndef CONFIG_NET_MULTIBUFFER
|
||||
# error "CONFIG_NET_MULTIBUFFER is required in the configuration"
|
||||
@@ -108,14 +108,47 @@
|
||||
#define MII_MAXPOLLS (0x1ffff)
|
||||
#define LINK_WAITUS (500*1000)
|
||||
|
||||
/* PHY hardware specifics. This was copied from the FreeScale code examples.
|
||||
* this is a vendor specific register and bit settings. I really should
|
||||
* do the research and find out what this really is.
|
||||
/* PHY definitions.
|
||||
*
|
||||
* The selected PHY must be selected from the drivers/net/Kconfig PHY menu.
|
||||
* A description of the PHY must be provided here. That description must
|
||||
* include:
|
||||
*
|
||||
* 1. BOARD_PHY_NAME: A PHY name string (for debug output),
|
||||
* 2. BOARD_PHYID1 and BOARD_PHYID2: The PHYID1 and PHYID2 values (from
|
||||
* include/nuttx/net/mii.h)
|
||||
* 3. BOARD_PHY_STATUS: The address of the status register to use when
|
||||
* querying link status (from include/nuttx/net/mii.h)
|
||||
* 4. BOARD_PHY_ISDUPLEX: A macro that can convert the status register
|
||||
* value into a boolean: true=duplex mode, false=half-duplex mode
|
||||
* 5. BOARD_PHY_10BASET: A macro that can convert the status register
|
||||
* value into a boolean: true=10Base-T, false=Not 10Base-T
|
||||
* 6. BOARD_PHY_100BASET: A macro that can convert the status register
|
||||
* value into a boolean: true=100Base-T, false=Not 100Base-T
|
||||
*
|
||||
* The Tower SER board uses a KSZ8041 PHY.
|
||||
* The Freedom K64F board uses a KSZ8081 PHY
|
||||
*/
|
||||
|
||||
#define PHY_STATUS (0x1f)
|
||||
#define PHY_DUPLEX_STATUS (4 << 2)
|
||||
#define PHY_SPEED_STATUS (1 << 2)
|
||||
#if defined(CONFIG_ETH0_PHY_KSZ8041)
|
||||
# define BOARD_PHY_NAME "KSZ8041"
|
||||
# define BOARD_PHYID1 MII_PHYID1_KSZ8041
|
||||
# define BOARD_PHYID2 MII_PHYID2_KSZ8041
|
||||
# define BOARD_PHY_STATUS MII_KSZ8041_PHYCTRL2
|
||||
# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
#elif defined(CONFIG_ETH0_PHY_KSZ8081)
|
||||
# define BOARD_PHY_NAME "KSZ8081"
|
||||
# define BOARD_PHYID1 MII_PHYID1_KSZ8081
|
||||
# define BOARD_PHYID2 MII_PHYID2_KSZ8081
|
||||
# define BOARD_PHY_STATUS MII_KSZ8081_PHYCTRL2
|
||||
# define BOARD_PHY_ISDUPLEX(s) (((s) & (4 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
# define BOARD_PHY_10BASET(s) (((s) & (1 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
# define BOARD_PHY_100BASET(s) (((s) & (2 << MII_PHYCTRL2_MODE_SHIFT)) != 0)
|
||||
#else
|
||||
# error "Unrecognized or missing PHY selection"
|
||||
#endif
|
||||
|
||||
/* Estimate the hold time to use based on the peripheral (bus) clock:
|
||||
*
|
||||
@@ -188,7 +221,7 @@ struct kinetis_driver_s
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct kinetis_driver_s g_enet[CONFIG_ENET_NETHIFS];
|
||||
static struct kinetis_driver_s g_enet[CONFIG_KINETIS_ENETNETHIFS];
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
@@ -222,8 +255,8 @@ static int kinetis_interrupt(int irq, FAR void *context);
|
||||
|
||||
/* Watchdog timer expirations */
|
||||
|
||||
static void kinetis_polltimer(int argc, uint32_t arg, ...);
|
||||
static void kinetis_txtimeout(int argc, uint32_t arg, ...);
|
||||
static void kinetis_polltimer(int argc, uint32_t arg, ...);
|
||||
|
||||
/* NuttX callback functions */
|
||||
|
||||
@@ -241,6 +274,10 @@ static int kinetis_ioctl(struct net_driver_s *dev, int cmd, long arg);
|
||||
/* PHY/MII support */
|
||||
|
||||
static inline void kinetis_initmii(struct kinetis_driver_s *priv);
|
||||
static int kinetis_writemii(struct kinetis_driver_s *priv, uint8_t phyaddr,
|
||||
uint8_t regaddr, uint16_t data);
|
||||
static int kinetis_readmii(struct kinetis_driver_s *priv, uint8_t phyaddr,
|
||||
uint8_t regaddr, uint16_t *data);
|
||||
static inline void kinetis_initphy(struct kinetis_driver_s *priv);
|
||||
|
||||
/* Initialization */
|
||||
@@ -323,7 +360,7 @@ static bool kinetics_txringfull(FAR struct kinetis_driver_s *priv)
|
||||
*/
|
||||
|
||||
txnext = priv->txhead + 1;
|
||||
if (txnext >= CONFIG_ENET_NTXBUFFERS)
|
||||
if (txnext >= CONFIG_KINETIS_ENETNTXBUFFERS)
|
||||
{
|
||||
txnext = 0;
|
||||
}
|
||||
@@ -375,7 +412,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s *priv)
|
||||
|
||||
txdesc = &priv->txdesc[priv->txhead];
|
||||
priv->txhead++;
|
||||
if (priv->txhead >= CONFIG_ENET_NTXBUFFERS)
|
||||
if (priv->txhead >= CONFIG_KINETIS_ENETNTXBUFFERS)
|
||||
{
|
||||
priv->txhead = 0;
|
||||
}
|
||||
@@ -392,7 +429,7 @@ static int kinetis_transmit(FAR struct kinetis_driver_s *priv)
|
||||
*/
|
||||
|
||||
txdesc->length = kinesis_swap16(priv->dev.d_len);
|
||||
#ifdef CONFIG_ENET_ENHANCEDBD
|
||||
#ifdef CONFIG_KINETIS_ENETENHANCEDBD
|
||||
txdesc->bdu = 0x00000000;
|
||||
txdesc->status2 = TXDESC_INT | TXDESC_TS; /* | TXDESC_IINS | TXDESC_PINS; */
|
||||
#endif
|
||||
@@ -668,7 +705,7 @@ static void kinetis_receive(FAR struct kinetis_driver_s *priv)
|
||||
/* Update the index to the next descriptor */
|
||||
|
||||
priv->rxtail++;
|
||||
if (priv->rxtail >= CONFIG_ENET_NRXBUFFERS)
|
||||
if (priv->rxtail >= CONFIG_KINETIS_ENETNRXBUFFERS)
|
||||
{
|
||||
priv->rxtail = 0;
|
||||
}
|
||||
@@ -708,7 +745,7 @@ static void kinetis_txdone(FAR struct kinetis_driver_s *priv)
|
||||
/* Yes.. bump up the tail pointer, making space for a new TX descriptor */
|
||||
|
||||
priv->txtail++;
|
||||
if (priv->txtail >= CONFIG_ENET_NTXBUFFERS)
|
||||
if (priv->txtail >= CONFIG_KINETIS_ENETNTXBUFFERS)
|
||||
{
|
||||
priv->txtail = 0;
|
||||
}
|
||||
@@ -961,7 +998,7 @@ static int kinetis_ifup(struct net_driver_s *dev)
|
||||
|
||||
/* Select legacy of enhanced buffer descriptor format */
|
||||
|
||||
#ifdef CONFIG_ENET_ENHANCEDBD
|
||||
#ifdef CONFIG_KINETIS_ENETENHANCEDBD
|
||||
putreg32(ENET_ECR_EN1588, KINETIS_ENET_ECR);
|
||||
#else
|
||||
putreg32(0, KINETIS_ENET_ECR);
|
||||
@@ -1216,7 +1253,7 @@ static int kinetis_ioctl(struct net_driver_s *dev, int cmd, long arg)
|
||||
{
|
||||
struct mii_ioctl_data_s *req =
|
||||
(struct mii_ioctl_data_s *)((uintptr_t)arg);
|
||||
req->phy_id = CONFIG_ENET_PHYADDR;
|
||||
req->phy_id = CONFIG_KINETIS_ENETPHYADDR;
|
||||
ret = OK;
|
||||
}
|
||||
break;
|
||||
@@ -1424,13 +1461,41 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
|
||||
{
|
||||
usleep(LINK_WAITUS);
|
||||
phydata = 0xffff;
|
||||
kinetis_readmii(priv, CONFIG_ENET_PHYADDR, MII_PHYID1, &phydata);
|
||||
kinetis_readmii(priv, CONFIG_KINETIS_ENETPHYADDR, MII_PHYID1, &phydata);
|
||||
}
|
||||
while (phydata == 0xffff);
|
||||
|
||||
#if CONFIG_DEBUG_NET_ERROR
|
||||
/* Verify PHYID1. Compare OUI bits 3-18 */
|
||||
|
||||
ninfo("%s: PHYID1: %04x\n", BOARD_PHY_NAME, phydata);
|
||||
if (phydata != BOARD_PHYID1)
|
||||
{
|
||||
nerr("ERROR: PHYID1=%04x incorrect for %s. Expected %04x\n",
|
||||
phydata, BOARD_PHY_NAME, BOARD_PHYID1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Read PHYID2 */
|
||||
|
||||
kinetis_readmii(priv, CONFIG_KINETIS_ENETPHYADDR, MII_PHYID2, &phydata);
|
||||
ninfo("%s: PHYID2: %04x\n", BOARD_PHY_NAME, phydata);
|
||||
|
||||
/* Verify PHYID2: Compare OUI bits 19-24 and the 6-bit model number
|
||||
* (ignoring the 4-bit revision number).
|
||||
*/
|
||||
|
||||
if ((phydata & 0xfff0) != (BOARD_PHYID2 & 0xfff0))
|
||||
{
|
||||
nerr("ERROR: PHYID2=%04x incorrect for %s. Expected %04x\n",
|
||||
(phydata & 0xfff0), BOARD_PHY_NAME, (BOARD_PHYID2 & 0xfff0));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start auto negotiation */
|
||||
|
||||
kinetis_writemii(priv, CONFIG_ENET_PHYADDR, MII_MCR,
|
||||
kinetis_writemii(priv, CONFIG_KINETIS_ENETPHYADDR, MII_MCR,
|
||||
(MII_MCR_ANRESTART | MII_MCR_ANENABLE));
|
||||
|
||||
/* Wait (potentially forever) for auto negotiation to complete */
|
||||
@@ -1438,21 +1503,24 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
|
||||
do
|
||||
{
|
||||
usleep(LINK_WAITUS);
|
||||
kinetis_readmii(priv, CONFIG_ENET_PHYADDR, MII_MSR, &phydata);
|
||||
|
||||
kinetis_readmii(priv, CONFIG_KINETIS_ENETPHYADDR, MII_MSR, &phydata);
|
||||
}
|
||||
while ((phydata & MII_MSR_ANEGCOMPLETE) == 0);
|
||||
|
||||
ninfo("%s: MII_MSR: %04x\n", BOARD_PHY_NAME, phydata);
|
||||
|
||||
/* When we get here we have a link - Find the negotiated speed and duplex. */
|
||||
|
||||
phydata = 0;
|
||||
kinetis_readmii(priv, CONFIG_ENET_PHYADDR, PHY_STATUS, &phydata);
|
||||
kinetis_readmii(priv, CONFIG_KINETIS_ENETPHYADDR, BOARD_PHY_STATUS, &phydata);
|
||||
|
||||
/* Set up the transmit and receive contrel registers based on the
|
||||
ninfo("%s: BOARD_PHY_STATUS: %04x\n", BOARD_PHY_NAME, phydata);
|
||||
|
||||
/* Set up the transmit and receive control registers based on the
|
||||
* configuration and the auto negotiation results.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_ENET_USEMII
|
||||
#ifdef CONFIG_KINETIS_ENETUSEMII
|
||||
rcr = ENET_RCR_MII_MODE | ENET_RCR_CRCFWD |
|
||||
CONFIG_NET_ETH_MTU << ENET_RCR_MAX_FL_SHIFT |
|
||||
ENET_RCR_MII_MODE;
|
||||
@@ -1468,7 +1536,7 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
|
||||
|
||||
/* Setup half or full duplex */
|
||||
|
||||
if ((phydata & PHY_DUPLEX_STATUS) != 0)
|
||||
if (BOARD_PHY_ISDUPLEX(phydata))
|
||||
{
|
||||
/* Full duplex */
|
||||
|
||||
@@ -1481,12 +1549,17 @@ static inline void kinetis_initphy(struct kinetis_driver_s *priv)
|
||||
rcr |= ENET_RCR_DRT;
|
||||
}
|
||||
|
||||
if ((phydata & PHY_SPEED_STATUS) != 0)
|
||||
if (BOARD_PHY_10BASET(phydata))
|
||||
{
|
||||
/* 10Mbps */
|
||||
|
||||
rcr |= ENET_RCR_RMII_10T;
|
||||
}
|
||||
else if (!BOARD_PHY_100BASET(phydata))
|
||||
{
|
||||
nerr("ERROR: Neither 10- nor 100-BaseT reported: PHY STATUS=%04x\n",
|
||||
phydata);
|
||||
}
|
||||
|
||||
putreg32(rcr, KINETIS_ENET_RCR);
|
||||
putreg32(tcr, KINETIS_ENET_TCR);
|
||||
@@ -1520,7 +1593,7 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
|
||||
/* Get an aligned RX descriptor (array) address */
|
||||
|
||||
addr += CONFIG_ENET_NTXBUFFERS * sizeof(struct enet_desc_s);
|
||||
addr += CONFIG_KINETIS_ENETNTXBUFFERS * sizeof(struct enet_desc_s);
|
||||
priv->rxdesc = (struct enet_desc_s *)addr;
|
||||
|
||||
/* Get the beginning of the first aligned buffer */
|
||||
@@ -1529,12 +1602,12 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
|
||||
/* Then fill in the TX descriptors */
|
||||
|
||||
for (i = 0; i < CONFIG_ENET_NTXBUFFERS; i++)
|
||||
for (i = 0; i < CONFIG_KINETIS_ENETNTXBUFFERS; i++)
|
||||
{
|
||||
priv->txdesc[i].status1 = 0;
|
||||
priv->txdesc[i].length = 0;
|
||||
priv->txdesc[i].data = (uint8_t *)kinesis_swap32((uint32_t)addr);
|
||||
#ifdef CONFIG_ENET_ENHANCEDBD
|
||||
#ifdef CONFIG_KINETIS_ENETENHANCEDBD
|
||||
priv->txdesc[i].status2 = TXDESC_IINS | TXDESC_PINS;
|
||||
#endif
|
||||
addr += KINETIS_BUF_SIZE;
|
||||
@@ -1542,12 +1615,12 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
|
||||
/* Then fill in the RX descriptors */
|
||||
|
||||
for (i = 0; i < CONFIG_ENET_NRXBUFFERS; i++)
|
||||
for (i = 0; i < CONFIG_KINETIS_ENETNRXBUFFERS; i++)
|
||||
{
|
||||
priv->rxdesc[i].status1 = RXDESC_E;
|
||||
priv->rxdesc[i].length = 0;
|
||||
priv->rxdesc[i].data = (uint8_t *)kinesis_swap32((uint32_t)addr);
|
||||
#ifdef CONFIG_ENET_ENHANCEDBD
|
||||
#ifdef CONFIG_KINETIS_ENETENHANCEDBD
|
||||
priv->rxdesc[i].bdu = 0;
|
||||
priv->rxdesc[i].status2 = RXDESC_INT;
|
||||
#endif
|
||||
@@ -1556,8 +1629,8 @@ static void kinetis_initbuffers(struct kinetis_driver_s *priv)
|
||||
|
||||
/* Set the wrap bit in the last descriptors to form a ring */
|
||||
|
||||
priv->txdesc[CONFIG_ENET_NTXBUFFERS-1].status1 |= TXDESC_W;
|
||||
priv->rxdesc[CONFIG_ENET_NRXBUFFERS-1].status1 |= RXDESC_W;
|
||||
priv->txdesc[CONFIG_KINETIS_ENETNTXBUFFERS-1].status1 |= TXDESC_W;
|
||||
priv->rxdesc[CONFIG_KINETIS_ENETNRXBUFFERS-1].status1 |= RXDESC_W;
|
||||
|
||||
/* We start with RX descriptor 0 and with no TX descriptors in use */
|
||||
|
||||
@@ -1631,7 +1704,7 @@ int kinetis_netinitialize(int intf)
|
||||
|
||||
/* Get the interface structure associated with this interface number. */
|
||||
|
||||
DEBUGASSERT(intf < CONFIG_ENET_NETHIFS);
|
||||
DEBUGASSERT(intf < CONFIG_KINETIS_ENETNETHIFS);
|
||||
priv = &g_enet[intf];
|
||||
|
||||
/* Enable the ENET clock */
|
||||
@@ -1646,9 +1719,9 @@ int kinetis_netinitialize(int intf)
|
||||
|
||||
putreg32(0, KINETIS_MPU_CESR);
|
||||
|
||||
#ifdef CONFIG_KINETIS_ENETUSEMII
|
||||
/* Configure all ENET/MII pins */
|
||||
|
||||
#ifdef CONFIG_ENET_USEMII
|
||||
kinetis_pinconfig(PIN_MII0_MDIO);
|
||||
kinetis_pinconfig(PIN_MII0_MDC);
|
||||
kinetis_pinconfig(PIN_MII0_RXDV);
|
||||
@@ -1668,6 +1741,8 @@ int kinetis_netinitialize(int intf)
|
||||
kinetis_pinconfig(PIN_MII0_CRS);
|
||||
kinetis_pinconfig(PIN_MII0_COL);
|
||||
#else
|
||||
/* Use RMII subset */
|
||||
|
||||
kinetis_pinconfig(PIN_RMII0_MDIO);
|
||||
kinetis_pinconfig(PIN_RMII0_MDC);
|
||||
kinetis_pinconfig(PIN_RMII0_CRS_DV);
|
||||
@@ -1773,7 +1848,7 @@ int kinetis_netinitialize(int intf)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if CONFIG_ENET_NETHIFS == 1
|
||||
#if CONFIG_KINETIS_ENETNETHIFS == 1
|
||||
void up_netinitialize(void)
|
||||
{
|
||||
(void)kinetis_netinitialize(0);
|
||||
|
||||
@@ -158,9 +158,12 @@
|
||||
# undef CONFIG_STM32_TIM17
|
||||
#endif
|
||||
|
||||
#undef HAVE_TIM_GPIOCONFIG
|
||||
#if defined(CONFIG_STM32_TIM1)
|
||||
# if defined(GPIO_TIM1_CH1OUT) ||defined(GPIO_TIM1_CH2OUT)||\
|
||||
defined(GPIO_TIM1_CH3OUT) ||defined(GPIO_TIM1_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM1_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -168,6 +171,8 @@
|
||||
#if defined(CONFIG_STM32_TIM2)
|
||||
# if defined(GPIO_TIM2_CH1OUT) ||defined(GPIO_TIM2_CH2OUT)||\
|
||||
defined(GPIO_TIM2_CH3OUT) ||defined(GPIO_TIM2_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM2_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -175,6 +180,8 @@
|
||||
#if defined(CONFIG_STM32_TIM3)
|
||||
# if defined(GPIO_TIM3_CH1OUT) ||defined(GPIO_TIM3_CH2OUT)||\
|
||||
defined(GPIO_TIM3_CH3OUT) ||defined(GPIO_TIM3_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM3_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -182,6 +189,8 @@
|
||||
#if defined(CONFIG_STM32_TIM4)
|
||||
# if defined(GPIO_TIM4_CH1OUT) ||defined(GPIO_TIM4_CH2OUT)||\
|
||||
defined(GPIO_TIM4_CH3OUT) ||defined(GPIO_TIM4_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM4_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -189,6 +198,8 @@
|
||||
#if defined(CONFIG_STM32_TIM5)
|
||||
# if defined(GPIO_TIM5_CH1OUT) ||defined(GPIO_TIM5_CH2OUT)||\
|
||||
defined(GPIO_TIM5_CH3OUT) ||defined(GPIO_TIM5_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM5_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -196,6 +207,8 @@
|
||||
#if defined(CONFIG_STM32_TIM8)
|
||||
# if defined(GPIO_TIM8_CH1OUT) ||defined(GPIO_TIM8_CH2OUT)||\
|
||||
defined(GPIO_TIM8_CH3OUT) ||defined(GPIO_TIM8_CH4OUT)
|
||||
# undef HAVE_TIM_GPIOCONFIG
|
||||
# define HAVE_TIM_GPIOCONFIG 1
|
||||
# define HAVE_TIM8_GPIOCONFIG 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -314,7 +327,10 @@ static void stm32_tim_reload_counter(FAR struct stm32_tim_dev_s *dev);
|
||||
static void stm32_tim_enable(FAR struct stm32_tim_dev_s *dev);
|
||||
static void stm32_tim_disable(FAR struct stm32_tim_dev_s *dev);
|
||||
static void stm32_tim_reset(FAR struct stm32_tim_dev_s *dev);
|
||||
|
||||
#ifdef HAVE_TIM_GPIOCONFIG
|
||||
static void stm32_tim_gpioconfig(uint32_t cfg, stm32_tim_channel_t mode);
|
||||
#endif
|
||||
|
||||
/* Timer methods */
|
||||
|
||||
@@ -637,9 +653,7 @@ static void stm32_tim_reset(FAR struct stm32_tim_dev_s *dev)
|
||||
* Name: stm32_tim_gpioconfig
|
||||
************************************************************************************/
|
||||
|
||||
#if defined(HAVE_TIM1_GPIOCONFIG)||defined(HAVE_TIM2_GPIOCONFIG)||\
|
||||
defined(HAVE_TIM3_GPIOCONFIG)||defined(HAVE_TIM4_GPIOCONFIG)||\
|
||||
defined(HAVE_TIM5_GPIOCONFIG)||defined(HAVE_TIM8_GPIOCONFIG)
|
||||
#ifdef HAVE_TIM_GPIOCONFIG
|
||||
static void stm32_tim_gpioconfig(uint32_t cfg, stm32_tim_channel_t mode)
|
||||
{
|
||||
/* TODO: Add support for input capture and bipolar dual outputs for TIM8 */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/************************************************************************************
|
||||
* arch/arm/src/stm32l4/chip/stm32_pinmap.h
|
||||
* arch/arm/src/stm32l4/chip/stm32l4_pinmap.h
|
||||
*
|
||||
* Copyright (C) 2015 Sebastien Lorquet. All rights reserved.
|
||||
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
#include "chip.h"
|
||||
#include "stm32l4_adc.h"
|
||||
//#include "stm32_bkp.h"
|
||||
//#include "stm32l4_bkp.h"
|
||||
#include "stm32l4_can.h"
|
||||
#include "stm32l4_dbgmcu.h"
|
||||
#include "stm32l4_dma.h"
|
||||
|
||||
@@ -57,14 +57,14 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static struct stm32l4_freerun_s *g_freerun;
|
||||
FAR static struct stm32l4_freerun_s *g_freerun;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_freerun_handler
|
||||
* Name: stm32l4_freerun_handler
|
||||
*
|
||||
* Description:
|
||||
* Timer interrupt callback. When the freerun timer counter overflows,
|
||||
@@ -81,9 +81,9 @@ static struct stm32l4_freerun_s *g_freerun;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_freerun_handler(int irq, void *context)
|
||||
static int stm32l4_freerun_handler(int irq, FAR void *context)
|
||||
{
|
||||
struct stm32l4_freerun_s *freerun = g_freerun;
|
||||
FAR struct stm32l4_freerun_s *freerun = g_freerun;
|
||||
|
||||
DEBUGASSERT(freerun != NULL && freerun->overflow < UINT32_MAX);
|
||||
freerun->overflow++;
|
||||
@@ -115,8 +115,8 @@ static int stm32_freerun_handler(int irq, void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
|
||||
uint16_t resolution)
|
||||
int stm32l4_freerun_initialize(FAR struct stm32l4_freerun_s *freerun, int chan,
|
||||
uint16_t resolution)
|
||||
{
|
||||
uint32_t frequency;
|
||||
|
||||
@@ -149,7 +149,7 @@ int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
|
||||
|
||||
/* Set up to receive the callback when the counter overflow occurs */
|
||||
|
||||
STM32L4_TIM_SETISR(freerun->tch, stm32_freerun_handler, 0);
|
||||
STM32L4_TIM_SETISR(freerun->tch, stm32l4_freerun_handler, 0);
|
||||
|
||||
/* Set timer period */
|
||||
|
||||
@@ -173,7 +173,7 @@ int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
|
||||
* Input Parameters:
|
||||
* freerun Caller allocated instance of the freerun state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_freerun_initialize();
|
||||
* stm32l4_freerun_initialize();
|
||||
* ts The location in which to return the time from the free-running
|
||||
* timer.
|
||||
*
|
||||
@@ -183,8 +183,8 @@ int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
||||
struct timespec *ts)
|
||||
int stm32l4_freerun_counter(FAR struct stm32l4_freerun_s *freerun,
|
||||
FAR struct timespec *ts)
|
||||
{
|
||||
uint64_t usec;
|
||||
uint32_t counter;
|
||||
@@ -197,7 +197,7 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
||||
DEBUGASSERT(freerun && freerun->tch && ts);
|
||||
|
||||
/* Temporarily disable the overflow counter. NOTE that we have to be
|
||||
* careful here because stm32_tc_getpending() will reset the pending
|
||||
* careful here because stm32l4_tc_getpending() will reset the pending
|
||||
* interrupt status. If we do not handle the overflow here then, it will
|
||||
* be lost.
|
||||
*/
|
||||
@@ -267,7 +267,7 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
||||
* Input Parameters:
|
||||
* freerun Caller allocated instance of the freerun state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_freerun_initialize();
|
||||
* stm32l4_freerun_initialize();
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned
|
||||
@@ -275,7 +275,7 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_freerun_uninitialize(struct stm32l4_freerun_s *freerun)
|
||||
int stm32l4_freerun_uninitialize(FAR struct stm32l4_freerun_s *freerun)
|
||||
{
|
||||
DEBUGASSERT(freerun && freerun->tch);
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/* The freerun client must allocate an instance of this structure and called
|
||||
* stm32_freerun_initialize() before using the freerun facilities. The client
|
||||
* stm32l4_freerun_initialize() before using the freerun facilities. The client
|
||||
* should not access the contents of this structure directly since the
|
||||
* contents are subject to change.
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ int stm32l4_freerun_initialize(struct stm32l4_freerun_s *freerun, int chan,
|
||||
* Input Parameters:
|
||||
* freerun Caller allocated instance of the freerun state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_freerun_initialize();
|
||||
* stm32l4_freerun_initialize();
|
||||
* ts The location in which to return the time remaining on the
|
||||
* oneshot timer.
|
||||
*
|
||||
@@ -140,7 +140,7 @@ int stm32l4_freerun_counter(struct stm32l4_freerun_s *freerun,
|
||||
* Input Parameters:
|
||||
* freerun Caller allocated instance of the freerun state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_freerun_initialize();
|
||||
* stm32l4_freerun_initialize();
|
||||
*
|
||||
* Returned Value:
|
||||
* Zero (OK) is returned on success; a negated errno value is returned
|
||||
|
||||
@@ -268,7 +268,7 @@ EXTERN const uint32_t g_gpiobase[STM32L4_NPORTS];
|
||||
* Description:
|
||||
* Configure a GPIO pin based on bit-encoded description of the pin.
|
||||
* Once it is configured as Alternative (GPIO_ALT|GPIO_CNF_AFPP|...)
|
||||
* function, it must be unconfigured with stm32_unconfiggpio() with
|
||||
* function, it must be unconfigured with stm32l4_unconfiggpio() with
|
||||
* the same cfgset first before it can be set to non-alternative function.
|
||||
*
|
||||
* Returns:
|
||||
|
||||
@@ -65,7 +65,7 @@ static struct stm32l4_oneshot_s *g_oneshot;
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_oneshot_handler
|
||||
* Name: stm32l4_oneshot_handler
|
||||
*
|
||||
* Description:
|
||||
* Timer interrupt callback. When the oneshot timer interrupt expires,
|
||||
@@ -83,11 +83,11 @@ static struct stm32l4_oneshot_s *g_oneshot;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_oneshot_handler(int irq, void *context)
|
||||
static int stm32l4_oneshot_handler(int irq, FAR void *context)
|
||||
{
|
||||
struct stm32l4_oneshot_s *oneshot = g_oneshot;
|
||||
FAR struct stm32l4_oneshot_s *oneshot = g_oneshot;
|
||||
oneshot_handler_t oneshot_handler;
|
||||
void *oneshot_arg;
|
||||
FAR void *oneshot_arg;
|
||||
|
||||
tmrinfo("Expired...\n");
|
||||
DEBUGASSERT(oneshot != NULL && oneshot->handler);
|
||||
@@ -138,8 +138,8 @@ static int stm32_oneshot_handler(int irq, void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_oneshot_initialize(struct stm32l4_oneshot_s *oneshot, int chan,
|
||||
uint16_t resolution)
|
||||
int stm32l4_oneshot_initialize(FAR struct stm32l4_oneshot_s *oneshot, int chan,
|
||||
uint16_t resolution)
|
||||
{
|
||||
uint32_t frequency;
|
||||
|
||||
@@ -174,14 +174,15 @@ int stm32l4_oneshot_initialize(struct stm32l4_oneshot_s *oneshot, int chan,
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_oneshot_max_delay
|
||||
* Name: stm32l4_oneshot_max_delay
|
||||
*
|
||||
* Description:
|
||||
* Determine the maximum delay of the one-shot timer (in microseconds)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
|
||||
int stm32l4_oneshot_max_delay(FAR struct stm32l4_oneshot_s *oneshot,
|
||||
FAR uint64_t *usec)
|
||||
{
|
||||
DEBUGASSERT(oneshot != NULL && usec != NULL);
|
||||
|
||||
@@ -199,7 +200,7 @@ int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
|
||||
* Input Parameters:
|
||||
* oneshot Caller allocated instance of the oneshot state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_oneshot_initialize();
|
||||
* stm32l4_oneshot_initialize();
|
||||
* handler The function to call when when the oneshot timer expires.
|
||||
* arg An opaque argument that will accompany the callback.
|
||||
* ts Provides the duration of the one shot timer.
|
||||
@@ -210,9 +211,9 @@ int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
||||
oneshot_handler_t handler, void *arg,
|
||||
const struct timespec *ts)
|
||||
int stm32l4_oneshot_start(FAR struct stm32l4_oneshot_s *oneshot,
|
||||
oneshot_handler_t handler, FAR void *arg,
|
||||
FAR const struct timespec *ts)
|
||||
{
|
||||
uint64_t usec;
|
||||
uint64_t period;
|
||||
@@ -259,7 +260,7 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
||||
|
||||
/* Set up to receive the callback when the interrupt occurs */
|
||||
|
||||
STM32L4_TIM_SETISR(oneshot->tch, stm32_oneshot_handler, 0);
|
||||
STM32L4_TIM_SETISR(oneshot->tch, stm32l4_oneshot_handler, 0);
|
||||
|
||||
/* Set timer period */
|
||||
|
||||
@@ -294,7 +295,7 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
||||
* Input Parameters:
|
||||
* oneshot Caller allocated instance of the oneshot state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_oneshot_initialize();
|
||||
* stm32l4_oneshot_initialize();
|
||||
* ts The location in which to return the time remaining on the
|
||||
* oneshot timer. A time of zero is returned if the timer is
|
||||
* not running. ts may be zero in which case the time remaining
|
||||
@@ -307,8 +308,8 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int stm32l4_oneshot_cancel(struct stm32l4_oneshot_s *oneshot,
|
||||
struct timespec *ts)
|
||||
int stm32l4_oneshot_cancel(FAR struct stm32l4_oneshot_s *oneshot,
|
||||
FAR struct timespec *ts)
|
||||
{
|
||||
irqstate_t flags;
|
||||
uint64_t usec;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
typedef void (*oneshot_handler_t)(void *arg);
|
||||
|
||||
/* The oneshot client must allocate an instance of this structure and called
|
||||
* stm32_oneshot_initialize() before using the oneshot facilities. The client
|
||||
* stm32l4_oneshot_initialize() before using the oneshot facilities. The client
|
||||
* should not access the contents of this structure directly since the
|
||||
* contents are subject to change.
|
||||
*/
|
||||
@@ -139,7 +139,7 @@ int stm32l4_oneshot_max_delay(struct stm32l4_oneshot_s *oneshot, uint64_t *usec)
|
||||
* Input Parameters:
|
||||
* oneshot Caller allocated instance of the oneshot state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_oneshot_initialize();
|
||||
* stm32l4_oneshot_initialize();
|
||||
* handler The function to call when when the oneshot timer expires.
|
||||
* arg An opaque argument that will accompany the callback.
|
||||
* ts Provides the duration of the one shot timer.
|
||||
@@ -166,7 +166,7 @@ int stm32l4_oneshot_start(struct stm32l4_oneshot_s *oneshot,
|
||||
* Input Parameters:
|
||||
* oneshot Caller allocated instance of the oneshot state structure. This
|
||||
* structure must have been previously initialized via a call to
|
||||
* stm32_oneshot_initialize();
|
||||
* stm32l4_oneshot_initialize();
|
||||
* ts The location in which to return the time remaining on the
|
||||
* oneshot timer. A time of zero is returned if the timer is
|
||||
* not running.
|
||||
|
||||
+1057
-1040
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+195
-192
File diff suppressed because it is too large
Load Diff
@@ -140,7 +140,7 @@ static inline void rcc_resetbkp(void)
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_clockconfig
|
||||
* Name: stm32l4_clockconfig
|
||||
*
|
||||
* Description:
|
||||
* Called to establish the clock settings based on the values in board.h.
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define STM32_NALARMS 2
|
||||
#define STM32L4_NALARMS 2
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
@@ -93,7 +93,7 @@ struct stm32l4_lowerhalf_s
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
/* Alarm callback information */
|
||||
|
||||
struct stm32l4_cbinfo_s cbinfo[STM32_NALARMS];
|
||||
struct stm32l4_cbinfo_s cbinfo[STM32L4_NALARMS];
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -200,7 +200,7 @@ static void stm32l4_alarm_callback(FAR void *arg, unsigned int alarmid)
|
||||
#endif /* CONFIG_RTC_ALARM */
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_rdtime
|
||||
* Name: stm32l4_rdtime
|
||||
*
|
||||
* Description:
|
||||
* Implements the rdtime() method of the RTC driver interface
|
||||
|
||||
@@ -535,7 +535,7 @@ static void rtc_resume(void)
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_RTC_ALARM
|
||||
static int stm32l4_rtc_alarm_handler(int irq, void *context)
|
||||
static int stm32l4_rtc_alarm_handler(int irq, FAR void *context)
|
||||
{
|
||||
FAR struct alm_cbinfo_s *cbinfo;
|
||||
alm_callback_t cb;
|
||||
@@ -685,7 +685,7 @@ static int rtchw_check_alrbwf(void)
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Name: stm32_rtchw_set_alrmXr X is a or b
|
||||
* Name: stm32l4_rtchw_set_alrmXr X is a or b
|
||||
*
|
||||
* Description:
|
||||
* Set the alarm (A or B) hardware registers, using the required hardware access
|
||||
|
||||
@@ -1755,7 +1755,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
/* Configure TX as a GPIO output pin and Send a break signal*/
|
||||
|
||||
tx_break = GPIO_OUTPUT | (~(GPIO_MODE_MASK|GPIO_OUTPUT_SET) & priv->tx_gpio);
|
||||
stm32_configgpio(tx_break);
|
||||
stm32l4_configgpio(tx_break);
|
||||
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
@@ -1769,7 +1769,7 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
/* Configure TX back to U(S)ART */
|
||||
|
||||
stm32_configgpio(priv->tx_gpio);
|
||||
stm32l4_configgpio(priv->tx_gpio);
|
||||
|
||||
priv->ie &= ~USART_CR1_IE_BREAK_INPROGRESS;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
struct stm32_tickless_s
|
||||
struct stm32l4_tickless_s
|
||||
{
|
||||
struct stm32l4_oneshot_s oneshot;
|
||||
struct stm32l4_freerun_s freerun;
|
||||
@@ -128,14 +128,14 @@ struct stm32_tickless_s
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static struct stm32_tickless_s g_tickless;
|
||||
static struct stm32l4_tickless_s g_tickless;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_oneshot_handler
|
||||
* Name: stm32l4_oneshot_handler
|
||||
*
|
||||
* Description:
|
||||
* Called when the one shot timer expires
|
||||
@@ -152,7 +152,7 @@ static struct stm32_tickless_s g_tickless;
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void stm32_oneshot_handler(void *arg)
|
||||
static void stm32l4_oneshot_handler(FAR void *arg)
|
||||
{
|
||||
tmrinfo("Expired...\n");
|
||||
sched_timer_expiration();
|
||||
@@ -201,7 +201,7 @@ void up_timer_initialize(void)
|
||||
CONFIG_USEC_PER_TICK);
|
||||
if (ret < 0)
|
||||
{
|
||||
tmrerr("ERROR: stm32_oneshot_initialize failed\n");
|
||||
tmrerr("ERROR: stm32l4_oneshot_initialize failed\n");
|
||||
PANIC();
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ void up_timer_initialize(void)
|
||||
ret = stm32l4_oneshot_max_delay(&g_tickless.oneshot, &max_delay);
|
||||
if (ret < 0)
|
||||
{
|
||||
tmrerr("ERROR: stm32_oneshot_max_delay failed\n");
|
||||
tmrerr("ERROR: stm32l4_oneshot_max_delay failed\n");
|
||||
PANIC();
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ void up_timer_initialize(void)
|
||||
CONFIG_USEC_PER_TICK);
|
||||
if (ret < 0)
|
||||
{
|
||||
tmrerr("ERROR: stm32_freerun_initialize failed\n");
|
||||
tmrerr("ERROR: stm32l4_freerun_initialize failed\n");
|
||||
PANIC();
|
||||
}
|
||||
}
|
||||
@@ -346,6 +346,6 @@ int up_timer_cancel(FAR struct timespec *ts)
|
||||
|
||||
int up_timer_start(FAR const struct timespec *ts)
|
||||
{
|
||||
return stm32l4_oneshot_start(&g_tickless.oneshot, stm32_oneshot_handler, NULL, ts);
|
||||
return stm32l4_oneshot_start(&g_tickless.oneshot, stm32l4_oneshot_handler, NULL, ts);
|
||||
}
|
||||
#endif /* CONFIG_SCHED_TICKLESS */
|
||||
|
||||
+236
-226
File diff suppressed because it is too large
Load Diff
@@ -87,7 +87,7 @@
|
||||
* timer_lowerhalf_s structure.
|
||||
*/
|
||||
|
||||
struct stm32_lowerhalf_s
|
||||
struct stm32l4_lowerhalf_s
|
||||
{
|
||||
FAR const struct timer_ops_s *ops; /* Lower half operations */
|
||||
FAR struct stm32l4_tim_dev_s *tim; /* stm32 timer driver */
|
||||
@@ -104,49 +104,49 @@ struct stm32_lowerhalf_s
|
||||
/* Interrupt handling *******************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM1
|
||||
static int stm32_tim1_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim1_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM2
|
||||
static int stm32_tim2_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim2_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM3
|
||||
static int stm32_tim3_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim3_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM4
|
||||
static int stm32_tim4_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim4_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM5
|
||||
static int stm32_tim5_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim5_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM6
|
||||
static int stm32_tim6_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim6_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM7
|
||||
static int stm32_tim7_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim7_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM8
|
||||
static int stm32_tim8_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim8_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM15
|
||||
static int stm32_tim15_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim15_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM16
|
||||
static int stm32_tim16_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim16_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
#ifdef CONFIG_STM32L4_TIM17
|
||||
static int stm32_tim17_interrupt(int irq, FAR void *context);
|
||||
static int stm32l4_tim17_interrupt(int irq, FAR void *context);
|
||||
#endif
|
||||
|
||||
static int stm32_timer_handler(FAR struct stm32_lowerhalf_s *lower);
|
||||
static int stm32l4_timer_handler(FAR struct stm32l4_lowerhalf_s *lower);
|
||||
|
||||
/* "Lower half" driver methods **********************************************/
|
||||
|
||||
static int stm32_start(FAR struct timer_lowerhalf_s *lower);
|
||||
static int stm32_stop(FAR struct timer_lowerhalf_s *lower);
|
||||
static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout);
|
||||
static tccb_t stm32_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t handler);
|
||||
static int stm32l4_start(FAR struct timer_lowerhalf_s *lower);
|
||||
static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower);
|
||||
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout);
|
||||
static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t handler);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
@@ -155,109 +155,109 @@ static tccb_t stm32_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
|
||||
static const struct timer_ops_s g_timer_ops =
|
||||
{
|
||||
.start = stm32_start,
|
||||
.stop = stm32_stop,
|
||||
.start = stm32l4_start,
|
||||
.stop = stm32l4_stop,
|
||||
.getstatus = NULL,
|
||||
.settimeout = stm32_settimeout,
|
||||
.sethandler = stm32_sethandler,
|
||||
.settimeout = stm32l4_settimeout,
|
||||
.sethandler = stm32l4_sethandler,
|
||||
.ioctl = NULL,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM1
|
||||
static struct stm32_lowerhalf_s g_tim1_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim1_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim1_interrupt,
|
||||
.timhandler = stm32l4_tim1_interrupt,
|
||||
.resolution = STM32L4_TIM1_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM2
|
||||
static struct stm32_lowerhalf_s g_tim2_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim2_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim2_interrupt,
|
||||
.timhandler = stm32l4_tim2_interrupt,
|
||||
.resolution = STM32L4_TIM2_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM3
|
||||
static struct stm32_lowerhalf_s g_tim3_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim3_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim3_interrupt,
|
||||
.timhandler = stm32l4_tim3_interrupt,
|
||||
.resolution = STM32L4_TIM3_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM4
|
||||
static struct stm32_lowerhalf_s g_tim4_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim4_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim4_interrupt,
|
||||
.timhandler = stm32l4_tim4_interrupt,
|
||||
.resolution = STM32L4_TIM4_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM5
|
||||
static struct stm32_lowerhalf_s g_tim5_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim5_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim5_interrupt,
|
||||
.timhandler = stm32l4_tim5_interrupt,
|
||||
.resolution = STM32L4_TIM5_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM6
|
||||
static struct stm32_lowerhalf_s g_tim6_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim6_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim6_interrupt,
|
||||
.timhandler = stm32l4_tim6_interrupt,
|
||||
.resolution = STM32L4_TIM6_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM7
|
||||
static struct stm32_lowerhalf_s g_tim7_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim7_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim7_interrupt,
|
||||
.timhandler = stm32l4_tim7_interrupt,
|
||||
.resolution = STM32L4_TIM7_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM8
|
||||
static struct stm32_lowerhalf_s g_tim8_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim8_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim8_interrupt,
|
||||
.timhandler = stm32l4_tim8_interrupt,
|
||||
.resolution = STM32L4_TIM8_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM15
|
||||
static struct stm32_lowerhalf_s g_tim15_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim15_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim15_interrupt,
|
||||
.timhandler = stm32l4_tim15_interrupt,
|
||||
.resolution = STM32L4_TIM15_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM16
|
||||
static struct stm32_lowerhalf_s g_tim16_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim16_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim16_interrupt,
|
||||
.timhandler = stm32l4_tim16_interrupt,
|
||||
.resolution = STM32L4_TIM16_RES,
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM17
|
||||
static struct stm32_lowerhalf_s g_tim17_lowerhalf =
|
||||
static struct stm32l4_lowerhalf_s g_tim17_lowerhalf =
|
||||
{
|
||||
.ops = &g_timer_ops,
|
||||
.timhandler = stm32_tim17_interrupt,
|
||||
.timhandler = stm32l4_tim17_interrupt,
|
||||
.resolution = STM32L4_TIM17_RES,
|
||||
};
|
||||
#endif
|
||||
@@ -267,7 +267,7 @@ static struct stm32_lowerhalf_s g_tim17_lowerhalf =
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_timN_interrupt, N=1..14
|
||||
* Name: stm32l4_timN_interrupt, N=1..14
|
||||
*
|
||||
* Description:
|
||||
* Individual interrupt handlers for each timer
|
||||
@@ -275,84 +275,84 @@ static struct stm32_lowerhalf_s g_tim17_lowerhalf =
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM1
|
||||
static int stm32_tim1_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim1_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim1_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim1_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM2
|
||||
static int stm32_tim2_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim2_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim2_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim2_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM3
|
||||
static int stm32_tim3_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim3_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim3_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim3_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM4
|
||||
static int stm32_tim4_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim4_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim4_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim4_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM5
|
||||
static int stm32_tim5_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim5_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim5_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim5_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM6
|
||||
static int stm32_tim6_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim6_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim6_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim6_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM7
|
||||
static int stm32_tim7_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim7_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim7_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim7_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM8
|
||||
static int stm32_tim8_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim8_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim8_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim8_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM15
|
||||
static int stm32_tim15_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim15_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim15_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim15_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM16
|
||||
static int stm32_tim16_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim16_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim16_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim16_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STM32L4_TIM17
|
||||
static int stm32_tim17_interrupt(int irq, FAR void *context)
|
||||
static int stm32l4_tim17_interrupt(int irq, FAR void *context)
|
||||
{
|
||||
return stm32_timer_handler(&g_tim17_lowerhalf);
|
||||
return stm32l4_timer_handler(&g_tim17_lowerhalf);
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_timer_handler
|
||||
* Name: stm32l4_timer_handler
|
||||
*
|
||||
* Description:
|
||||
* timer interrupt handler
|
||||
@@ -363,7 +363,7 @@ static int stm32_tim17_interrupt(int irq, FAR void *context)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_timer_handler(FAR struct stm32_lowerhalf_s *lower)
|
||||
static int stm32l4_timer_handler(FAR struct stm32l4_lowerhalf_s *lower)
|
||||
{
|
||||
uint32_t next_interval_us = 0;
|
||||
|
||||
@@ -378,14 +378,14 @@ static int stm32_timer_handler(FAR struct stm32_lowerhalf_s *lower)
|
||||
}
|
||||
else
|
||||
{
|
||||
stm32_stop((struct timer_lowerhalf_s *)lower);
|
||||
stm32l4_stop((struct timer_lowerhalf_s *)lower);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_start
|
||||
* Name: stm32l4_start
|
||||
*
|
||||
* Description:
|
||||
* Start the timer, resetting the time to the current timeout,
|
||||
@@ -399,9 +399,9 @@ static int stm32_timer_handler(FAR struct stm32_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_start(FAR struct timer_lowerhalf_s *lower)
|
||||
static int stm32l4_start(FAR struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)lower;
|
||||
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
|
||||
|
||||
if (!priv->started)
|
||||
{
|
||||
@@ -423,7 +423,7 @@ static int stm32_start(FAR struct timer_lowerhalf_s *lower)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_stop
|
||||
* Name: stm32l4_stop
|
||||
*
|
||||
* Description:
|
||||
* Stop the timer
|
||||
@@ -437,9 +437,9 @@ static int stm32_start(FAR struct timer_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_stop(struct timer_lowerhalf_s *lower)
|
||||
static int stm32l4_stop(FAR struct timer_lowerhalf_s *lower)
|
||||
{
|
||||
struct stm32_lowerhalf_s *priv = (struct stm32_lowerhalf_s *)lower;
|
||||
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
|
||||
|
||||
if (priv->started)
|
||||
{
|
||||
@@ -456,7 +456,7 @@ static int stm32_stop(struct timer_lowerhalf_s *lower)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_settimeout
|
||||
* Name: stm32l4_settimeout
|
||||
*
|
||||
* Description:
|
||||
* Set a new timeout value (and reset the timer)
|
||||
@@ -471,9 +471,10 @@ static int stm32_stop(struct timer_lowerhalf_s *lower)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeout)
|
||||
static int stm32l4_settimeout(FAR struct timer_lowerhalf_s *lower,
|
||||
uint32_t timeout)
|
||||
{
|
||||
FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)lower;
|
||||
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
|
||||
uint64_t maxtimeout;
|
||||
|
||||
if (priv->started)
|
||||
@@ -498,7 +499,7 @@ static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeou
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: stm32_sethandler
|
||||
* Name: stm32l4_sethandler
|
||||
*
|
||||
* Description:
|
||||
* Call this user provided timeout handler.
|
||||
@@ -516,10 +517,10 @@ static int stm32_settimeout(FAR struct timer_lowerhalf_s *lower, uint32_t timeou
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static tccb_t stm32_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t newhandler)
|
||||
static tccb_t stm32l4_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
tccb_t newhandler)
|
||||
{
|
||||
FAR struct stm32_lowerhalf_s *priv = (FAR struct stm32_lowerhalf_s *)lower;
|
||||
FAR struct stm32l4_lowerhalf_s *priv = (FAR struct stm32l4_lowerhalf_s *)lower;
|
||||
|
||||
irqstate_t flags = enter_critical_section();
|
||||
|
||||
@@ -570,7 +571,7 @@ static tccb_t stm32_sethandler(FAR struct timer_lowerhalf_s *lower,
|
||||
|
||||
int stm32l4_timer_initialize(FAR const char *devpath, int timer)
|
||||
{
|
||||
FAR struct stm32_lowerhalf_s *lower;
|
||||
FAR struct stm32l4_lowerhalf_s *lower;
|
||||
|
||||
switch (timer)
|
||||
{
|
||||
|
||||
@@ -10,8 +10,12 @@ Contents
|
||||
o Freedom K64F Features
|
||||
o Serial Console
|
||||
o LEDs and Buttons
|
||||
o Ethernet
|
||||
o Development Environment
|
||||
o GNU Toolchain Options
|
||||
o Freedom K64F Configuration Options
|
||||
o Configurations
|
||||
o Status
|
||||
|
||||
Kinetis Freedom K64F Features:
|
||||
=============================
|
||||
@@ -125,6 +129,40 @@ LEDs and Buttons
|
||||
SW2 PTC6/SPI0_SOUT/PD0_EXTRG/I2S0_RX_BCLK/FB_AD9/I2S0_MCLK/LLWU_P10
|
||||
SW3 PTA4/FTM0_CH1/NMI_b/LLWU_P3
|
||||
|
||||
Ethernet
|
||||
========
|
||||
|
||||
------------ ----------------- --------------------------------------------
|
||||
KSZ8081 Board Signal(s) K64F Pin
|
||||
Pin Signal Function
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
1 VDD_1V2 VDDPLL_1.2V ---
|
||||
2 VDDA_3V3 VDDA_ENET ---
|
||||
3 RXM ENET1_RX- ---
|
||||
4 RXP ENET1_RX+ ---
|
||||
5 TXM ENET1_TX- ---
|
||||
6 TXP ENET1_TX+ ---
|
||||
7 X0 RMII_XTAL0 ---
|
||||
8 XI RMII_XTAL1 ---
|
||||
9 REXT --- ---, Apparently not connected
|
||||
10 MDIO RMII0_MDIO PTB0/RMII0_MDIO
|
||||
11 MDC RMII0_MDC PTB1/RMII0_MDC
|
||||
12 RXD1 RMII0_RXD_1 PTA12/RMII0_RXD1
|
||||
13 RXD0 RMII0_RXD_0 PTA13/RMII0_RXD0
|
||||
14 VDDIO VDDIO_ENET ---
|
||||
15 CRS_DIV PTA14/RMII0_CRS_DV
|
||||
16 REF_CLK RMII_RXCLK PTA18/EXTAL0, PHY clock input
|
||||
17 RXER RMII0_RXER PTA5/RMII0_RXER
|
||||
18 INTRP RMII0_INT_B, J14 Pin 2, Apparently not available unless jumpered
|
||||
PHY_INT_1
|
||||
19 TXEN RMII0_TXEN PTA15/RMII0_TXEN
|
||||
20 TXD0 RMII0_TXD_0 PTA16/RMII0_TXD0
|
||||
21 TXD1 RMII0_TXD_1 PTA17/RMII0_TXD1
|
||||
22 GND1 --- ---
|
||||
24 nRST PHY_RST_B ---
|
||||
25 GND2 --- ---
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
|
||||
Development Environment
|
||||
=======================
|
||||
|
||||
@@ -345,6 +383,23 @@ can be selected as follow:
|
||||
|
||||
Where <subdir> is one of the following:
|
||||
|
||||
netnsh:
|
||||
------
|
||||
This configuration is identical to the nsh configuration described
|
||||
below except that networking support is enabled.
|
||||
|
||||
NOTES:
|
||||
|
||||
1. Most of the notes associated with the nsh configuration apply here
|
||||
as well (see below).
|
||||
|
||||
2. Default platform/toolchain:
|
||||
|
||||
CONFIG_HOST_WINDOWS=y : Cygwin under Windows
|
||||
CONFIG_WINDOWS_CYGWIN=y
|
||||
CONFIG_ARMV7M_TOOLCHAIN_GNU_EABIW=y : ARM/mbed toolcahin (arm-none-elf-gcc)
|
||||
CONFIG_INTELHEX_BINARY=y : Output formats: Intel hex binary
|
||||
|
||||
nsh:
|
||||
---
|
||||
Configures the NuttShell (nsh) located at apps/examples/nsh using a
|
||||
@@ -366,7 +421,7 @@ Where <subdir> is one of the following:
|
||||
CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too).
|
||||
CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc)
|
||||
CONFIG_ARMV7M_OABI_TOOLCHAIN=y : The older OABI version
|
||||
CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary
|
||||
CONFIG_INTELHEX_BINARY=y : Output formats: Intel hex binary
|
||||
|
||||
3. The Serial Console is provided on UART3 with the correct pin
|
||||
configuration for use with an Arduino Serial Shield.
|
||||
@@ -391,3 +446,14 @@ Where <subdir> is one of the following:
|
||||
CONFIG_SCHED_WORKQUEUE=y : Enable the NuttX workqueue
|
||||
|
||||
CONFIG_NSH_ARCHINIT=y : Provide NSH initializeation logic
|
||||
|
||||
Status
|
||||
======
|
||||
|
||||
2016-07-11: Received hardware today and the board came up on the very
|
||||
first try. That does not happen often. At this point, the very basic
|
||||
NSH configuration is working and LEDs are working. The only odd
|
||||
behavior that I see is that pressing SW3 causes an unexpected interrupt
|
||||
error.
|
||||
2016-07-12: Added support for the KSZ8081 PHY and added the netnsh
|
||||
configuration. Untested as of this writing.
|
||||
|
||||
@@ -162,18 +162,18 @@
|
||||
* the Freedom K64F. The following definitions describe how NuttX controls
|
||||
* the LEDs:
|
||||
*
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ----------------------- ----------------- */
|
||||
#define LED_STARTED 1 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 2 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF ON */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON OFF */
|
||||
#define LED_INIRQ 0 /* In an interrupt (no change) */
|
||||
#define LED_SIGNAL 0 /* In a signal handler (no change) */
|
||||
#define LED_ASSERTION 0 /* An assertion failed (no change) */
|
||||
#define LED_PANIC 4 /* The system has crashed FLASH OFF OFF */
|
||||
#undef LED_IDLE /* K64 is in sleep mode (Not used) */
|
||||
* SYMBOL Meaning LED state
|
||||
* RED GREEN BLUE
|
||||
* ------------------- ---------------------------- ----------------- */
|
||||
#define LED_STARTED 1 /* NuttX has been started OFF OFF OFF */
|
||||
#define LED_HEAPALLOCATE 2 /* Heap has been allocated OFF OFF ON */
|
||||
#define LED_IRQSENABLED 0 /* Interrupts enabled OFF OFF ON */
|
||||
#define LED_STACKCREATED 3 /* Idle stack created OFF ON OFF */
|
||||
#define LED_INIRQ 0 /* In an interrupt (no change) */
|
||||
#define LED_SIGNAL 0 /* In a signal handler (no change) */
|
||||
#define LED_ASSERTION 0 /* An assertion failed (no change) */
|
||||
#define LED_PANIC 4 /* The system has crashed FLASH OFF OFF */
|
||||
#undef LED_IDLE /* K64 is in sleep mode (Not used) */
|
||||
|
||||
/* Button definitions ***************************************************************/
|
||||
/* Two push buttons, SW2 and SW3, are available on FRDM-K64F board, where SW2 is
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
############################################################################
|
||||
# configs/freedom-k64f/netnsh/Make.defs
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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 NuttX 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 AND CONTRIBUTORS
|
||||
# "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 OWNER 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
include ${TOPDIR}/tools/Config.mk
|
||||
include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs
|
||||
|
||||
ifeq ($(WINTOOL),y)
|
||||
# Windows-native toolchains
|
||||
DIRLINK = $(TOPDIR)/tools/copydir.sh
|
||||
DIRUNLINK = $(TOPDIR)/tools/unlink.sh
|
||||
MKDEP = $(TOPDIR)/tools/mkwindeps.sh
|
||||
ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}"
|
||||
ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}"
|
||||
ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld}"
|
||||
else
|
||||
# Linux/Cygwin-native toolchain
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps$(HOSTEXEEXT)
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include
|
||||
ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx
|
||||
ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/flash.ld
|
||||
endif
|
||||
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'}
|
||||
ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -g
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_DEBUG_NOOPT),y)
|
||||
ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCFLAGS = -fno-builtin
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef
|
||||
ARCHWARNINGSXX = -Wall -Wshadow -Wundef
|
||||
ARCHDEFINES =
|
||||
ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10
|
||||
|
||||
CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
NXFLATLDFLAGS1 = -r -d -warn-common
|
||||
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
|
||||
LDNXFLATFLAGS = -e main -s 2048
|
||||
|
||||
ASMEXT = .S
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifneq ($(CROSSDEV),arm-nuttx-elf-)
|
||||
LDFLAGS += -nostartfiles -nodefaultlibs
|
||||
endif
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
LDFLAGS += -g
|
||||
endif
|
||||
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -g -pipe
|
||||
HOSTLDFLAGS =
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
#!/bin/bash
|
||||
# configs/freedom-k64f/netnsh/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# 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 NuttX 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 AND CONTRIBUTORS
|
||||
# "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 OWNER 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.
|
||||
#
|
||||
|
||||
if [ "$_" = "$0" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WD=`pwd`
|
||||
if [ ! -x "setenv.sh" ]; then
|
||||
echo "This script must be executed from the top-level NuttX build directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PATH_ORIG}" ]; then
|
||||
export PATH_ORIG="${PATH}"
|
||||
fi
|
||||
|
||||
# This is the Cygwin path to the location where I installed the Atmel GCC
|
||||
# toolchain under Windows. You will also have to edit this if you install
|
||||
# this toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Atmel/Atmel Toolchain/ARM GCC/Native/4.7.3.99/arm-gnu-toolchain/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I installed the CodeSourcery
|
||||
# toolchain under windows. You will also have to edit this if you install
|
||||
# the CodeSourcery toolchain in any other location
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin"
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
# export TOOLCHAIN_BIN="/cygdrive/c/Users/MyName/MentorGraphics/Sourcery_CodeBench_Lite_for_ARM_EABI/bin"
|
||||
|
||||
# This is the location where I installed the ARM "GNU Tools for ARM Embedded Processors"
|
||||
# You can this free toolchain here https://launchpad.net/gcc-arm-embedded
|
||||
export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/GNU Tools ARM Embedded/4.9 2015q2/bin"
|
||||
|
||||
# This is the path to the location where I installed the devkitARM toolchain
|
||||
# You can get this free toolchain from http://devkitpro.org/ or http://sourceforge.net/projects/devkitpro/
|
||||
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/devkitARM/bin"
|
||||
|
||||
# This is the Cygwin path to the location where I build the buildroot
|
||||
# toolchain.
|
||||
#export TOOLCHAIN_BIN="${WD}/../buildroot/build_arm_nofpu/staging_dir/bin"
|
||||
|
||||
# Add the path to the toolchain to the PATH varialble
|
||||
export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}"
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
@@ -91,13 +91,13 @@
|
||||
* LED K64
|
||||
* ------ -------------------------------------------------------
|
||||
* RED PTB22/SPI2_SOUT/FB_AD29/CMP2_OUT
|
||||
* BLUE PTB21/SPI2_SCK/FB_AD30/CMP1_OUT
|
||||
* GREEN PTE26/ENET_1588_CLKIN/UART4_CTS_b/RTC_CLKOUT/USB0_CLKIN
|
||||
* BLUE PTB21/SPI2_SCK/FB_AD30/CMP1_OUT
|
||||
*/
|
||||
|
||||
#define GPIO_LED_R (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTB | PIN22)
|
||||
#define GPIO_LED_G (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTB | PIN21)
|
||||
#define GPIO_LED_B (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTE | PIN26)
|
||||
#define GPIO_LED_G (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTE | PIN26)
|
||||
#define GPIO_LED_B (GPIO_LOWDRIVE | GPIO_OUTPUT_ONE | PIN_PORTB | PIN21)
|
||||
|
||||
/************************************************************************************
|
||||
* Public data
|
||||
|
||||
@@ -71,7 +71,7 @@ ARCHDEFINES =
|
||||
|
||||
# Check if building a 32-bit target with a 64-bit toolchain
|
||||
|
||||
ifeq ($(ARCH_X86_M32),y)
|
||||
ifeq ($(CONFIG_ARCH_X86_M32),y)
|
||||
ARCHCPUFLAGS += -m32
|
||||
endif
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ ARCHDEFINES =
|
||||
|
||||
# Check if building a 32-bit target with a 64-bit toolchain
|
||||
|
||||
ifeq ($(ARCH_X86_M32),y)
|
||||
ifeq ($(CONFIG_ARCH_X86_M32),y)
|
||||
ARCHCPUFLAGS += -m32
|
||||
endif
|
||||
|
||||
|
||||
@@ -136,6 +136,10 @@ ifeq ($(CONFIG_LCD_UG2864HSWEG01),y)
|
||||
CSRCS += stm32_ug2864hsweg01.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_EXAMPLES_OSTEST),y)
|
||||
CSRCS += stm32_ostest.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TIMER),y)
|
||||
CSRCS += stm32_timer.c
|
||||
endif
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/************************************************************************************
|
||||
* configs/stm32f4discovery/src/stm32_ostest.c
|
||||
*
|
||||
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* 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 NuttX 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 AND CONTRIBUTORS
|
||||
* "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 OWNER 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.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
/************************************************************************************
|
||||
* Included Files
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
#include "up_arch.h"
|
||||
#include "up_internal.h"
|
||||
#include "stm32f4discovery.h"
|
||||
|
||||
/************************************************************************************
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Configuration ********************************************************************/
|
||||
|
||||
#undef HAVE_FPU
|
||||
#if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_EXAMPLES_OSTEST_FPUTESTDISABLE) && \
|
||||
defined(CONFIG_EXAMPLES_OSTEST_FPUSIZE) && defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_SIGNALS)
|
||||
# define HAVE_FPU 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FPU
|
||||
|
||||
#if CONFIG_EXAMPLES_OSTEST_FPUSIZE != (4*SW_FPU_REGS)
|
||||
# error "CONFIG_EXAMPLES_OSTEST_FPUSIZE has the wrong size"
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
* Private Data
|
||||
************************************************************************************/
|
||||
|
||||
static uint32_t g_saveregs[XCPTCONTEXT_REGS];
|
||||
|
||||
/************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************/
|
||||
|
||||
/* Given an array of size CONFIG_EXAMPLES_OSTEST_FPUSIZE, this function will return
|
||||
* the current FPU registers.
|
||||
*/
|
||||
|
||||
void arch_getfpu(FAR uint32_t *fpusave)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Take a snapshot of the thread context right now */
|
||||
|
||||
flags = enter_critical_section();
|
||||
up_saveusercontext(g_saveregs);
|
||||
|
||||
/* Return only the floating register values */
|
||||
|
||||
memcpy(fpusave, &g_saveregs[REG_S0], (4*SW_FPU_REGS));
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
/* Given two arrays of size CONFIG_EXAMPLES_OSTEST_FPUSIZE this function
|
||||
* will compare them and return true if they are identical.
|
||||
*/
|
||||
|
||||
bool arch_cmpfpu(FAR const uint32_t *fpusave1, FAR const uint32_t *fpusave2)
|
||||
{
|
||||
return memcmp(fpusave1, fpusave2, (4*SW_FPU_REGS)) == 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_FPU */
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "up_arch.h"
|
||||
#include "kinetis.h"
|
||||
#include "kinetis_usbotg.h"
|
||||
#include "kinetis_sim.h"
|
||||
#include "chip/kinetis_sim.h"
|
||||
#include "teensy-3x.h"
|
||||
|
||||
/************************************************************************************
|
||||
|
||||
+25
-2
@@ -245,6 +245,7 @@ static inline void sst26_unlock(FAR struct spi_dev_s *dev);
|
||||
static inline int sst26_readid(struct sst26_dev_s *priv);
|
||||
static void sst26_waitwritecomplete(struct sst26_dev_s *priv);
|
||||
static void sst26_writeenable(struct sst26_dev_s *priv);
|
||||
static void sst26_writedisable(struct sst26_dev_s *priv);
|
||||
static void sst26_globalunlock(struct sst26_dev_s *priv);
|
||||
static inline void sst26_sectorerase(struct sst26_dev_s *priv, off_t offset, uint8_t type);
|
||||
static inline int sst26_chiperase(struct sst26_dev_s *priv);
|
||||
@@ -427,7 +428,7 @@ static void sst26_globalunlock(struct sst26_dev_s *priv)
|
||||
|
||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
||||
|
||||
/* Send "Write Enable (WREN)" command */
|
||||
/* Send "Global Unlock (ULBPR)" command */
|
||||
|
||||
(void)SPI_SEND(priv->dev, SST26_ULBPR);
|
||||
|
||||
@@ -459,6 +460,27 @@ static void sst26_writeenable(struct sst26_dev_s *priv)
|
||||
sstinfo("Enabled\n");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sst26_writedisable
|
||||
************************************************************************************/
|
||||
|
||||
static void sst26_writedisable(struct sst26_dev_s *priv)
|
||||
{
|
||||
/* Select this FLASH part */
|
||||
|
||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, true);
|
||||
|
||||
/* Send "Write Disable (WRDI)" command */
|
||||
|
||||
(void)SPI_SEND(priv->dev, SST26_WRDI);
|
||||
|
||||
/* Deselect the FLASH */
|
||||
|
||||
SPI_SELECT(priv->dev, SPIDEV_FLASH, false);
|
||||
|
||||
sstinfo("Disabled\n");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
* Name: sst26_sectorerase (4k)
|
||||
************************************************************************************/
|
||||
@@ -939,8 +961,9 @@ FAR struct mtd_dev_s *sst26_initialize_spi(FAR struct spi_dev_s *dev)
|
||||
else
|
||||
{
|
||||
/* Make sure that the FLASH is unprotected so that we can write into it */
|
||||
|
||||
sst26_writeenable(priv);
|
||||
sst26_globalunlock(priv);
|
||||
sst26_writedisable(priv);
|
||||
|
||||
#ifdef CONFIG_MTD_REGISTRATION
|
||||
/* Register the MTD with the procfs system if enabled */
|
||||
|
||||
@@ -871,14 +871,17 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
|
||||
struct inode *inode = filep->f_inode;
|
||||
struct uart_dev_s *dev = inode->i_private;
|
||||
struct u16550_s *priv = (FAR struct u16550_s *)dev->priv;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_SERIAL_UART_ARCH_IOCTL
|
||||
int ret = uart_ioctl(filep, cmd, arg);
|
||||
ret = uart_ioctl(filep, cmd, arg);
|
||||
|
||||
if (ret != -ENOTTY)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
ret = OK;
|
||||
#endif
|
||||
|
||||
switch (cmd)
|
||||
|
||||
+21
-13
@@ -924,8 +924,8 @@ static int tmpfs_find_object(FAR struct tmpfs_s *fs,
|
||||
FAR struct tmpfs_object_s **object,
|
||||
FAR struct tmpfs_directory_s **parent)
|
||||
{
|
||||
FAR struct tmpfs_object_s *to;
|
||||
FAR struct tmpfs_directory_s *tdo;
|
||||
FAR struct tmpfs_object_s *to = NULL;
|
||||
FAR struct tmpfs_directory_s *tdo = NULL;
|
||||
FAR struct tmpfs_directory_s *next_tdo;
|
||||
FAR char *segment;
|
||||
FAR char *next_segment;
|
||||
@@ -1019,24 +1019,30 @@ static int tmpfs_find_object(FAR struct tmpfs_s *fs,
|
||||
|
||||
if (parent)
|
||||
{
|
||||
/* Get exclusive access to the parent and increment the reference
|
||||
* count on the object.
|
||||
*/
|
||||
if (tdo != NULL)
|
||||
{
|
||||
/* Get exclusive access to the parent and increment the reference
|
||||
* count on the object.
|
||||
*/
|
||||
|
||||
tmpfs_lock_directory(tdo);
|
||||
tdo->tdo_refs++;
|
||||
tmpfs_lock_directory(tdo);
|
||||
tdo->tdo_refs++;
|
||||
}
|
||||
|
||||
*parent = tdo;
|
||||
}
|
||||
|
||||
if (object)
|
||||
{
|
||||
/* Get exclusive access to the object and increment the reference
|
||||
* count on the object.
|
||||
*/
|
||||
if (to != NULL)
|
||||
{
|
||||
/* Get exclusive access to the object and increment the reference
|
||||
* count on the object.
|
||||
*/
|
||||
|
||||
tmpfs_lock_object(to);
|
||||
to->to_refs++;
|
||||
tmpfs_lock_object(to);
|
||||
to->to_refs++;
|
||||
}
|
||||
|
||||
*object = to;
|
||||
}
|
||||
@@ -2086,7 +2092,7 @@ static int tmpfs_unlink(FAR struct inode *mountpt, FAR const char *relpath)
|
||||
{
|
||||
FAR struct tmpfs_s *fs;
|
||||
FAR struct tmpfs_directory_s *tdo;
|
||||
FAR struct tmpfs_file_s *tfo;
|
||||
FAR struct tmpfs_file_s *tfo = NULL;
|
||||
FAR const char *name;
|
||||
int ret;
|
||||
|
||||
@@ -2113,6 +2119,8 @@ static int tmpfs_unlink(FAR struct inode *mountpt, FAR const char *relpath)
|
||||
goto errout_with_lock;
|
||||
}
|
||||
|
||||
DEBUGASSERT(tfo != NULL);
|
||||
|
||||
/* Get the file name from the relative path */
|
||||
|
||||
name = strrchr(relpath, '/');
|
||||
|
||||
@@ -93,10 +93,15 @@
|
||||
#define NAN (0.0/0.0)
|
||||
#define HUGE_VAL INFINITY
|
||||
|
||||
#define INFINITY_F (1.0F/0.0F)
|
||||
#define NAN_F (0.0F/0.0F)
|
||||
|
||||
#define isnan(x) ((x) != (x))
|
||||
#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY))
|
||||
#define isfinite(x) (!(isinf(x)) && (x != NAN))
|
||||
|
||||
#define isinf_f(x) (((x) == INFINITY_F) || ((x) == -INFINITY_F))
|
||||
|
||||
/* Exponential and Logarithmic constants ************************************/
|
||||
|
||||
#define M_E 2.7182818284590452353602874713526625
|
||||
@@ -116,6 +121,9 @@
|
||||
#define M_2_PI 0.6366197723675813430755350534900574
|
||||
#define M_2_SQRTPI 1.1283791670955125738961589031215452
|
||||
|
||||
#define M_PI_F ((float)M_PI)
|
||||
#define M_PI_2_F ((float)M_PI_2)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
@@ -547,7 +547,7 @@
|
||||
#define MII_KSZ80x1_INT_LU (1 << 0) /* Link up interrupt */
|
||||
|
||||
/* KSZ8041 Register 0x1e: PHY Control 1 -- To be provided */
|
||||
/* KSZ8041 Register 0x1e: PHY Control 2 */
|
||||
/* KSZ8041 Register 0x1f: PHY Control 2 */
|
||||
|
||||
#define MII_PHYCTRL2_MDIX (1 << 15) /* Bit 15: Micrel/HP MDI/MDI-X state */
|
||||
#define MII_PHYCTRL2_MDIX_SEL (1 << 14) /* Bit 14: MDI/MDI-X select */
|
||||
|
||||
+2
-1
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* libc/libc.h
|
||||
*
|
||||
* Copyright (C) 2007-2014 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2007-2014, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -211,6 +211,7 @@ int lib_checkbase(int base, const char **pptr);
|
||||
/* Defined in lib_expi.c */
|
||||
|
||||
#ifdef CONFIG_LIBM
|
||||
float lib_expif(size_t n);
|
||||
double lib_expi(size_t n);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ CSRCS += lib_tanhl.c lib_asinhl.c lib_acoshl.c lib_atanhl.c lib_erfl.c lib_copys
|
||||
CSRCS += lib_truncl.c
|
||||
|
||||
CSRCS += lib_libexpi.c lib_libsqrtapprox.c
|
||||
CSRCS += lib_libexpif.c
|
||||
|
||||
# Add the floating point math directory to the build
|
||||
|
||||
|
||||
@@ -37,5 +37,5 @@
|
||||
|
||||
float acosf(float x)
|
||||
{
|
||||
return (M_PI_2 - asinf(x));
|
||||
return (M_PI_2_F - asinf(x));
|
||||
}
|
||||
|
||||
@@ -48,5 +48,5 @@
|
||||
|
||||
float acoshf(float x)
|
||||
{
|
||||
return logf(x + sqrtf(x * x - 1));
|
||||
return logf(x + sqrtf(x * x - 1.0F));
|
||||
}
|
||||
|
||||
@@ -47,9 +47,9 @@ float asinf(float x)
|
||||
y_sin = sinf(y);
|
||||
y_cos = cosf(y);
|
||||
|
||||
if (y > M_PI_2 || y < -M_PI_2)
|
||||
if (y > M_PI_2_F || y < -M_PI_2_F)
|
||||
{
|
||||
y = fmodf(y, M_PI);
|
||||
y = fmodf(y, M_PI_F);
|
||||
}
|
||||
|
||||
if (y_sin + FLT_EPSILON >= x && y_sin - FLT_EPSILON <= x)
|
||||
|
||||
@@ -48,5 +48,5 @@
|
||||
|
||||
float asinhf(float x)
|
||||
{
|
||||
return logf(x + sqrtf(x * x + 1));
|
||||
return logf(x + sqrtf(x * x + 1.0F));
|
||||
}
|
||||
|
||||
@@ -43,22 +43,22 @@ float atan2f(float y, float x)
|
||||
}
|
||||
else if (y >= 0 && x < 0)
|
||||
{
|
||||
return atanf(y / x) + M_PI;
|
||||
return atanf(y / x) + M_PI_F;
|
||||
}
|
||||
else if (y < 0)
|
||||
{
|
||||
if (x == 0)
|
||||
{
|
||||
return -M_PI_2;
|
||||
return -M_PI_2_F;
|
||||
}
|
||||
else /* Can only be x < 0 */
|
||||
{
|
||||
return atanf(y / x) - M_PI;
|
||||
return atanf(y / x) - M_PI_F;
|
||||
}
|
||||
}
|
||||
else if (y > 0 && x == 0)
|
||||
{
|
||||
return M_PI_2;
|
||||
return M_PI_2_F;
|
||||
}
|
||||
else /* if (y == 0 && x == 0) Undefined but returns normally 0 */
|
||||
{
|
||||
|
||||
@@ -39,5 +39,5 @@
|
||||
|
||||
float atanf(float x)
|
||||
{
|
||||
return asinf(x / sqrtf(x * x + 1));
|
||||
return asinf(x / sqrtf(x * x + 1.0F));
|
||||
}
|
||||
|
||||
@@ -48,5 +48,5 @@
|
||||
|
||||
float atanhf(float x)
|
||||
{
|
||||
return 0.5 * logf((1 + x) / (1 - x));
|
||||
return 0.5F * logf((1.0F + x) / (1.0F - x));
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@
|
||||
float ceilf(float x)
|
||||
{
|
||||
modff(x, &x);
|
||||
if (x > 0.0)
|
||||
if (x > 0.0F)
|
||||
{
|
||||
x += 1.0;
|
||||
x += 1.0F;
|
||||
}
|
||||
|
||||
return x;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user