Merged nuttx/nuttx into master
This commit is contained in:
commit
426c628559
1
TODO
1
TODO
@ -937,6 +937,7 @@ o Network (net/, drivers/net)
|
||||
LM3S NO NO
|
||||
TM4C YES YES
|
||||
eZ80 NO NO
|
||||
Kinetis YES YES (not tested)
|
||||
LPC17xx YES YES (not tested)
|
||||
LPC43xx YES YES (not tested)
|
||||
DMxxx NIC NO NO
|
||||
|
@ -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,63 @@ 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
|
||||
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
|
||||
config KINETIS_ENET_MDIOPULLUP
|
||||
bool "MDIO pull-up"
|
||||
default n
|
||||
---help---
|
||||
If there is no on-board pull-up resister on the MII/RMII MDIO line,
|
||||
then this option may be selected in order to configure an internal
|
||||
pull-up on MDIO.
|
||||
|
||||
if KINETIS_SDHC
|
||||
config KINETIS_ENET_NORXER
|
||||
bool "Suppress RXER"
|
||||
default n
|
||||
---help---
|
||||
If selected, then the MII/RMII RXER output will be configured as a
|
||||
GPIO and pulled low.
|
||||
|
||||
comment "Kinetis SDHC Configuration"
|
||||
endmenu # Kinetis Ethernet Configuration
|
||||
|
||||
menu "Kinetis SDHC Configuration"
|
||||
depends on KINETIS_SDHC
|
||||
|
||||
config KINETIS_SDHC_ABSFREQ
|
||||
bool "Custom transfer frequencies"
|
||||
@ -611,11 +622,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
|
||||
|
@ -83,12 +83,12 @@
|
||||
#define PIN_FTM0_CH1_1 (PIN_ALT3 | PIN_PORTA | PIN4)
|
||||
#define PIN_NMI (PIN_ALT7 | PIN_PORTA | PIN4)
|
||||
#define PIN_FTM0_CH2_1 (PIN_ALT3 | PIN_PORTA | PIN5)
|
||||
#if 0
|
||||
#ifdef CONFIG_KINETIS_ENET_NORXER
|
||||
# define PIN_RMII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
# define PIN_MII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_RMII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
# define PIN_MII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_RMII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
# define PIN_MII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#endif
|
||||
#define PIN_CMP2_OUT_1 (PIN_ALT5 | PIN_PORTA | PIN5)
|
||||
#define PIN_I2S0_RX_BCLK_1 (PIN_ALT6 | PIN_PORTA | PIN5)
|
||||
@ -174,7 +174,11 @@
|
||||
#define PIN_TSI0_CH0 (PIN_ANALOG | PIN_PORTB | PIN0)
|
||||
#define PIN_I2C0_SCL_1 (PIN_ALT2 | PIN_PORTB | PIN0)
|
||||
#define PIN_FTM1_CH0_3 (PIN_ALT3 | PIN_PORTB | PIN0)
|
||||
#define PIN_RMII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#ifdef CONFIG_KINETIS_ENET_MDIOPULLUP
|
||||
# define PIN_RMII0_MDIO (PIN_ALT4_PULLUP | PIN_PORTB | PIN0)
|
||||
#else
|
||||
# define PIN_RMII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#endif
|
||||
#define PIN_MII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#define PIN_FTM1_QD_PHA_3 (PIN_ALT6 | PIN_PORTB | PIN0)
|
||||
#define PIN_ADC0_SE9 (PIN_ANALOG | PIN_PORTB | PIN1)
|
||||
|
@ -398,14 +398,22 @@
|
||||
#define PIN_MII0_COL (PIN_ALT4 | PIN_PORTA | PIN29)
|
||||
#define PIN_MII0_CRS (PIN_ALT4 | PIN_PORTA | PIN27)
|
||||
#define PIN_MII0_MDC (PIN_ALT4 | PIN_PORTB | PIN1)
|
||||
#define PIN_MII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#ifdef CONFIG_KINETIS_ENET_MDIOPULLUP
|
||||
# define PIN_MII0_MDIO (PIN_ALT4_PULLUP | PIN_PORTB | PIN0)
|
||||
#else
|
||||
# define PIN_MII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#endif
|
||||
#define PIN_MII0_RXCLK (PIN_ALT4 | PIN_PORTA | PIN11)
|
||||
#define PIN_MII0_RXD0 (PIN_ALT4 | PIN_PORTA | PIN13)
|
||||
#define PIN_MII0_RXD1 (PIN_ALT4 | PIN_PORTA | PIN12)
|
||||
#define PIN_MII0_RXD2 (PIN_ALT4 | PIN_PORTA | PIN10)
|
||||
#define PIN_MII0_RXD3 (PIN_ALT4 | PIN_PORTA | PIN9)
|
||||
#define PIN_MII0_RXDV (PIN_ALT4 | PIN_PORTA | PIN14)
|
||||
#define PIN_MII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#ifdef CONFIG_KINETIS_ENET_NORXER
|
||||
# define PIN_MII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_MII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#endif
|
||||
#define PIN_MII0_TXCLK (PIN_ALT4 | PIN_PORTA | PIN25)
|
||||
#define PIN_MII0_TXD0 (PIN_ALT4 | PIN_PORTA | PIN16)
|
||||
#define PIN_MII0_TXD1 (PIN_ALT4 | PIN_PORTA | PIN17)
|
||||
@ -427,10 +435,18 @@
|
||||
|
||||
#define PIN_RMII0_CRS_DV (PIN_ALT4 | PIN_PORTA | PIN14)
|
||||
#define PIN_RMII0_MDC (PIN_ALT4 | PIN_PORTB | PIN1)
|
||||
#define PIN_RMII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#ifdef CONFIG_KINETIS_ENET_MDIOPULLUP
|
||||
# define PIN_RMII0_MDIO (PIN_ALT4_PULLUP | PIN_PORTB | PIN0)
|
||||
#else
|
||||
# define PIN_RMII0_MDIO (PIN_ALT4 | PIN_PORTB | PIN0)
|
||||
#endif
|
||||
#define PIN_RMII0_RXD0 (PIN_ALT4 | PIN_PORTA | PIN13)
|
||||
#define PIN_RMII0_RXD1 (PIN_ALT4 | PIN_PORTA | PIN12)
|
||||
#define PIN_RMII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#ifdef CONFIG_KINETIS_ENET_NORXER
|
||||
# define PIN_RMII0_RXER (GPIO_PULLDOWN | PIN_PORTA | PIN5)
|
||||
#else
|
||||
# define PIN_RMII0_RXER (PIN_ALT4 | PIN_PORTA | PIN5)
|
||||
#endif
|
||||
#define PIN_RMII0_TXD0 (PIN_ALT4 | PIN_PORTA | PIN16)
|
||||
#define PIN_RMII0_TXD1 (PIN_ALT4 | PIN_PORTA | PIN17)
|
||||
#define PIN_RMII0_TXEN (PIN_ALT4 | PIN_PORTA | PIN15)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -10,9 +10,12 @@ Contents
|
||||
o Freedom K64F Features
|
||||
o Serial Console
|
||||
o LEDs and Buttons
|
||||
o Ethernet
|
||||
o Networking Support
|
||||
o Development Environment
|
||||
o GNU Toolchain Options
|
||||
o Freedom K64F Configuration Options
|
||||
o Configurations
|
||||
o Status
|
||||
|
||||
Kinetis Freedom K64F Features:
|
||||
=============================
|
||||
@ -126,40 +129,286 @@ 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
|
||||
========
|
||||
Networking Support
|
||||
==================
|
||||
|
||||
Ethernet MAC/KSZ8081 PHY
|
||||
------------------------
|
||||
------------ ----------------- --------------------------------------------
|
||||
KSZ8081 Board Signal(s) K64F Pin
|
||||
Pin Signal Function
|
||||
Pin Signal Function pinmux Name
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
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 --- ---
|
||||
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 PIN_RMII0_MDIO
|
||||
11 MDC RMII0_MDC PTB1/RMII0_MDC PIN_RMII0_MDC
|
||||
12 RXD1 RMII0_RXD_1 PTA12/RMII0_RXD1 PIN_RMII0_RXD1
|
||||
13 RXD0 RMII0_RXD_0 PTA13/RMII0_RXD0 PIN_RMII0_RXD0
|
||||
14 VDDIO VDDIO_ENET --- ---
|
||||
15 CRS_DIV PTA14/RMII0_CRS_DV PIN_RMII0_CRS_DV
|
||||
16 REF_CLK RMII_RXCLK PTA18/EXTAL0, PHY clock input ---
|
||||
17 RXER RMII0_RXER PTA5/RMII0_RXER PIN_RMII0_RXER
|
||||
18 INTRP RMII0_INT_B, J14 Pin 2, Apparently not ---
|
||||
PHY_INT_1 available unless jumpered
|
||||
19 TXEN RMII0_TXEN PTA15/RMII0_TXEN PIN_RMII0_TXEN
|
||||
20 TXD0 RMII0_TXD_0 PTA16/RMII0_TXD0 PIN_RMII0_TXD0
|
||||
21 TXD1 RMII0_TXD_1 PTA17/RMII0_TXD1 PIN_RMII0_TXD1
|
||||
22 GND1 --- --- ---
|
||||
24 nRST PHY_RST_B --- ---
|
||||
25 GND2 --- --- ---
|
||||
--- -------- ----------------- --------------------------------------------
|
||||
|
||||
No external pullup is available on MDIO signal when MK64FN1M0VLL12 MCU is
|
||||
requests status of the Ethernet link connection. Internal pullup is required
|
||||
when port configuration for MDIO signal is enabled:
|
||||
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
Networking support via the can be added to NSH by selecting the following
|
||||
configuration options.
|
||||
|
||||
Selecting the EMAC peripheral
|
||||
-----------------------------
|
||||
|
||||
System Type -> Kinetis Peripheral Support
|
||||
CONFIG_KINETIS_ENET=y : Enable the EThernet MAC peripheral
|
||||
|
||||
System Type -> Ethernet Configuration
|
||||
CONFIG_KINETIS_ENETNETHIFS=1
|
||||
CONFIG_KINETIS_ENETNRXBUFFERS=6
|
||||
CONFIG_KINETIS_ENETNTXBUFFERS=2
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
Networking Support
|
||||
CONFIG_NET=y : Enable Neworking
|
||||
CONFIG_NET_ETHERNET=y : Support Ethernet data link
|
||||
CONFIG_NET_NOINTS=y : Should operative at non-interrupt level
|
||||
CONFIG_NET_SOCKOPTS=y : Enable socket operations
|
||||
CONFIG_NET_MULTIBUFFER=y : Multi-packet buffer option required
|
||||
CONFIG_NET_ETH_MTU=590 : Maximum packet size (MTU) 1518 is more standard
|
||||
CONFIG_NET_ETH_TCP_RECVWNDO=536 : Should be the same as CONFIG_NET_ETH_MTU
|
||||
CONFIG_NET_ARP=y : Enable ARP
|
||||
CONFIG_NET_ARPTAB_SIZE=16 : ARP table size
|
||||
CONFIG_NET_ARP_IPIN=y : Enable ARP address harvesting
|
||||
CONFIG_NET_ARP_SEND=y : Send ARP request before sending data
|
||||
CONFIG_NET_TCP=y : Enable TCP/IP networking
|
||||
CONFIG_NET_TCP_READAHEAD=y : Support TCP read-ahead
|
||||
CONFIG_NET_TCP_WRITE_BUFFERS=y : Support TCP write-buffering
|
||||
CONFIG_NET_TCPBACKLOG=y : Support TCP/IP backlog
|
||||
CONFIG_NET_MAX_LISTENPORTS=20 :
|
||||
CONFIG_NET_TCP_READAHEAD_BUFSIZE=536 Read-ahead buffer size
|
||||
CONFIG_NET_UDP=y : Enable UDP networking
|
||||
CONFIG_NET_BROADCAST=y : Needed for DNS name resolution
|
||||
CONFIG_NET_ICMP=y : Enable ICMP networking
|
||||
CONFIG_NET_ICMP_PING=y : Needed for NSH ping command
|
||||
: Defaults should be okay for other options
|
||||
f Application Configuration -> Network Utilities
|
||||
CONFIG_NETDB_DNSCLIENT=y : Enable host address resolution
|
||||
CONFIG_NETUTILS_TELNETD=y : Enable the Telnet daemon
|
||||
CONFIG_NETUTILS_TFTPC=y : Enable TFTP data file transfers for get and put commands
|
||||
CONFIG_NETUTILS_NETLIB=y : Network library support is needed
|
||||
CONFIG_NETUTILS_WEBCLIENT=y : Needed for wget support
|
||||
: Defaults should be okay for other options
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NSH_TELNET=y : Enable NSH session via Telnet
|
||||
CONFIG_NSH_IPADDR=0x0a000002 : Select a fixed IP address
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001 : IP address of gateway/host PC
|
||||
CONFIG_NSH_NETMASK=0xffffff00 : Netmask
|
||||
CONFIG_NSH_NOMAC=y : Need to make up a bogus MAC address
|
||||
: Defaults should be okay for other options
|
||||
|
||||
You can also enable enable the DHCPC client for networks that use
|
||||
dynamically assigned address:
|
||||
|
||||
Application Configuration -> Network Utilities
|
||||
CONFIG_NETUTILS_DHCPC=y : Enables the DHCP client
|
||||
|
||||
Networking Support
|
||||
CONFIG_NET_UDP=y : Depends on broadcast UDP
|
||||
|
||||
Application Configuration -> NSH Library
|
||||
CONFIG_NET_BROADCAST=y
|
||||
CONFIG_NSH_DHCPC=y : Tells NSH to use DHCPC, not
|
||||
: the fixed addresses
|
||||
|
||||
Using the network with NSH
|
||||
--------------------------
|
||||
|
||||
So what can you do with this networking support? First you see that
|
||||
NSH has several new network related commands:
|
||||
|
||||
ifconfig, ifdown, ifup: Commands to help manage your network
|
||||
get and put: TFTP file transfers
|
||||
wget: HTML file transfers
|
||||
ping: Check for access to peers on the network
|
||||
Telnet console: You can access the NSH remotely via telnet.
|
||||
|
||||
You can also enable other add on features like full FTP or a Web
|
||||
Server or XML RPC and others. There are also other features that
|
||||
you can enable like DHCP client (or server) or network name
|
||||
resolution.
|
||||
|
||||
By default, the IP address of the DK-TM4C129X will be 10.0.0.2 and
|
||||
it will assume that your host is the gateway and has the IP address
|
||||
10.0.0.1.
|
||||
|
||||
nsh> ifconfig
|
||||
eth0 HWaddr 00:e0:de:ad:be:ef at UP
|
||||
IPaddr:10.0.0.2 DRaddr:10.0.0.1 Mask:255.255.255.0
|
||||
|
||||
You can use ping to test for connectivity to the host (Careful,
|
||||
Window firewalls usually block ping-related ICMP traffic). On the
|
||||
target side, you can:
|
||||
|
||||
nsh> ping 10.0.0.1
|
||||
PING 10.0.0.1 56 bytes of data
|
||||
56 bytes from 10.0.0.1: icmp_seq=1 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=2 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=3 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=4 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=5 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=6 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=7 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=8 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=9 time=0 ms
|
||||
56 bytes from 10.0.0.1: icmp_seq=10 time=0 ms
|
||||
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
|
||||
|
||||
NOTE: In this configuration is is normal to have packet loss > 0%
|
||||
the first time you ping due to the default handling of the ARP
|
||||
table.
|
||||
|
||||
On the host side, you should also be able to ping the DK-TM4C129X:
|
||||
|
||||
$ ping 10.0.0.2
|
||||
|
||||
You can also log into the NSH from the host PC like this:
|
||||
|
||||
$ telnet 10.0.0.2
|
||||
Trying 10.0.0.2...
|
||||
Connected to 10.0.0.2.
|
||||
Escape character is '^]'.
|
||||
sh_telnetmain: Session [3] Started
|
||||
|
||||
NuttShell (NSH) NuttX-6.31
|
||||
nsh> help
|
||||
help usage: help [-v] [<cmd>]
|
||||
|
||||
[ echo ifconfig mkdir mw sleep
|
||||
? exec ifdown mkfatfs ping test
|
||||
cat exit ifup mkfifo ps umount
|
||||
cp free kill mkrd put usleep
|
||||
cmp get losetup mh rm wget
|
||||
dd help ls mount rmdir xd
|
||||
df hexdump mb mv sh
|
||||
|
||||
Builtin Apps:
|
||||
nsh>
|
||||
|
||||
NOTE: If you enable this networking as described above, you will
|
||||
experience a delay on booting NSH. That is because the start-up logic
|
||||
waits for the network connection to be established before starting
|
||||
NuttX. In a real application, you would probably want to do the
|
||||
network bringup on a separate thread so that access to the NSH prompt
|
||||
is not delayed.
|
||||
|
||||
This delay will be especially long if the board is not connected to
|
||||
a network. On the order of minutes! You will probably think that
|
||||
NuttX has crashed! And then, when it finally does come up after
|
||||
numerous timeouts and retries, the network will not be available --
|
||||
even if the network cable is plugged in later.
|
||||
|
||||
The long delays can be eliminated by using a separate the network
|
||||
initialization thread discussed below. Recovering after the network
|
||||
becomes available requires the network monitor feature, also discussed
|
||||
below.
|
||||
|
||||
Network Initialization Thread
|
||||
-----------------------------
|
||||
There is a configuration option enabled by CONFIG_NSH_NETINIT_THREAD
|
||||
that will do the NSH network bring-up asynchronously in parallel on
|
||||
a separate thread. This eliminates the (visible) networking delay
|
||||
altogether. This current implementation, however, has some limitations:
|
||||
|
||||
- If no network is connected, the network bring-up will fail and
|
||||
the network initialization thread will simply exit. There are no
|
||||
retries and no mechanism to know if the network initialization was
|
||||
successful (it could perform a network Ioctl to see if the link is
|
||||
up and it now, keep trying, but it does not do that now).
|
||||
|
||||
- Furthermore, there is currently no support for detecting loss of
|
||||
network connection and recovery of the connection (similarly, this
|
||||
thread could poll periodically for network status, but does not).
|
||||
|
||||
Both of these shortcomings could be eliminated by enabling the network
|
||||
monitor:
|
||||
|
||||
Network Monitor
|
||||
---------------
|
||||
By default the network initialization thread will bring-up the network
|
||||
then exit, freeing all of the resources that it required. This is a
|
||||
good behavior for systems with limited memory.
|
||||
|
||||
If the CONFIG_NSH_NETINIT_MONITOR option is selected, however, then the
|
||||
network initialization thread will persist forever; it will monitor the
|
||||
network status. In the event that the network goes down (for example, if
|
||||
a cable is removed), then the thread will monitor the link status and
|
||||
attempt to bring the network back up. In this case the resources
|
||||
required for network initialization are never released.
|
||||
|
||||
Pre-requisites:
|
||||
|
||||
- CONFIG_NSH_NETINIT_THREAD as described above.
|
||||
|
||||
- The K64F EMAC block does not support PHY interrupts. The KSZ8081
|
||||
PHY interrupt line is brought to a jumper block and it should be
|
||||
possible to connect that some some interrupt port pin. You would
|
||||
need to provide some custom logic in the Freedcom K64F
|
||||
configuration to set up that PHY interrupt.
|
||||
|
||||
- In addtion to the PHY interrupt, the Network Monitor also requires the
|
||||
following setting:
|
||||
|
||||
CONFIG_NETDEV_PHY_IOCTL. Enable PHY IOCTL commands in the Ethernet
|
||||
device driver. Special IOCTL commands must be provided by the Ethernet
|
||||
driver to support certain PHY operations that will be needed for link
|
||||
management. There operations are not complex and are implemented for
|
||||
the Atmel SAMA5 family.
|
||||
|
||||
CONFIG_ARCH_PHY_INTERRUPT. This is not a user selectable option.
|
||||
Rather, it is set when you select a board that supports PHY
|
||||
interrupts. For the K64F, like most other architectures, the PHY
|
||||
interrupt must be provided via some board-specific GPIO. In any
|
||||
event, the board-specific logic must provide support for the PHY
|
||||
interrupt. To do this, the board logic must do two things: (1) It
|
||||
must provide the function arch_phy_irq() as described and prototyped
|
||||
in the nuttx/include/nuttx/arch.h, and (2) it must select
|
||||
CONFIG_ARCH_PHY_INTERRUPT in the board configuration file to
|
||||
advertise that it supports arch_phy_irq().
|
||||
|
||||
And a few other things: UDP support is required (CONFIG_NET_UDP) and
|
||||
signals must not be disabled (CONFIG_DISABLE_SIGNALS).
|
||||
|
||||
Given those prerequisites, the network monitor can be selected with these
|
||||
additional settings.
|
||||
|
||||
System Type -> Kinetis Ethernet Configuration
|
||||
CONFIG_ARCH_PHY_INTERRUPT=y : (auto-selected)
|
||||
CONFIG_NETDEV_PHY_IOCTL=y : (auto-selected)
|
||||
|
||||
Application Configuration -> NSH Library -> Networking Configuration
|
||||
CONFIG_NSH_NETINIT_THREAD : Enable the network initialization thread
|
||||
CONFIG_NSH_NETINIT_MONITOR=y : Enable the network monitor
|
||||
CONFIG_NSH_NETINIT_RETRYMSEC=2000 : Configure the network monitor as you like
|
||||
CONFIG_NSH_NETINIT_SIGNO=18
|
||||
|
||||
Development Environment
|
||||
=======================
|
||||
|
||||
@ -380,6 +629,41 @@ 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
|
||||
|
||||
3. No external pullup is available on MDIO signal when MK64FN1M0VLL12 MCU
|
||||
is requests status of the Ethernet link connection. Internal pullup is
|
||||
required when port configuration for MDIO signal is enabled:
|
||||
|
||||
CONFIG_KINETIS_ENET_MDIOPULLUP=y
|
||||
|
||||
4. Configured to use a fixed IPv4 address:
|
||||
|
||||
CONFIG_NSH_IPADDR=0x0a000002
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001
|
||||
CONFIG_NSH_NETMASK=0xffffff00
|
||||
|
||||
And a bogus MAC address:
|
||||
|
||||
CONFIG_NSH_NOMAC=y
|
||||
CONFIG_NSH_SWMAC=y
|
||||
CONFIG_NSH_MACADDR=0x00e0deadbeef
|
||||
|
||||
nsh:
|
||||
---
|
||||
Configures the NuttShell (nsh) located at apps/examples/nsh using a
|
||||
@ -401,7 +685,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.
|
||||
@ -426,3 +710,22 @@ 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. The network is basically functional, but a lot more
|
||||
testing is needed to confirm that.
|
||||
|
||||
In testing, I notice a strange thing. If I run at full optimization the
|
||||
code runs (albeit with bugs-to-be-solved). But with no optimization or
|
||||
even at -O1, the system fails to boot. This seems to be related to the
|
||||
watchdog timer.
|
||||
|
||||
|
@ -41,8 +41,9 @@
|
||||
************************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdint.h>
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -68,7 +69,7 @@
|
||||
*
|
||||
* PLL Input frequency: PLLIN = REFCLK / PRDIV = 50 Mhz / 20 = 2.5 MHz
|
||||
* PLL Output frequency: PLLOUT = PLLIN * VDIV = 2.5 Mhz * 48 = 120 MHz
|
||||
* MCG Frequency: PLLOUT = 96MHz
|
||||
* MCG Frequency: PLLOUT = 120 MHz
|
||||
*
|
||||
* PRDIV register value is the divider minus one. So 20 -> 19
|
||||
* VDIV regiser value is offset by 24. So 28 -> 24
|
||||
@ -100,36 +101,37 @@
|
||||
* SDCLK frequency = (base clock) / (prescaler * divisor)
|
||||
*
|
||||
* The SDHC module is always configure configured so that the core clock is the base
|
||||
* clock.
|
||||
* clock. Possible values for presscaler and divisor are:
|
||||
*
|
||||
* SDCLKFS: {2, 4, 8, 16, 32, 63, 128, 256}
|
||||
* DVS: {1..16}
|
||||
*/
|
||||
|
||||
/* Identification mode: 400KHz = 96MHz / ( 16 * 15) */
|
||||
/* Identification mode: Optimal 400KHz, Actual 120MHz / (32 * 10) = 375 Khz */
|
||||
|
||||
#define BOARD_SDHC_IDMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
|
||||
#define BOARD_SDHC_IDMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
|
||||
#define BOARD_SDHC_IDMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV32
|
||||
#define BOARD_SDHC_IDMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(10)
|
||||
|
||||
/* MMC normal mode: 16MHz = 96MHz / (2 * 3) */
|
||||
/* MMC normal mode: Optimal 20MHz, Actual 120MHz / (2 * 3) = 20 MHz */
|
||||
|
||||
#define BOARD_SDHC_MMCMODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
#define BOARD_SDHC_MMCMODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
|
||||
|
||||
/* SD normal mode (1-bit): 16MHz = 96MHz / (2 * 3) */
|
||||
/* SD normal mode (1-bit): Optimal 20MHz, Actual 120MHz / (2 * 3) = 20 MHz */
|
||||
|
||||
#define BOARD_SDHC_SD1MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
#define BOARD_SDHC_SD1MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
|
||||
|
||||
/* SD normal mode (4-bit): 24MHz = 96MHz / (2 * 2) (with DMA)
|
||||
* SD normal mode (4-bit): 16MHz = 96MHz / (2 * 3) (no DMA)
|
||||
/* SD normal mode (4-bit): Optimal 25MHz, Actual 120MHz / (2 * 3) = 20 MHz (with DMA)
|
||||
* SD normal mode (4-bit): Optimal 20MHz, Actual 120MHz / (2 * 3) = 20 MHz (no DMA)
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_SDIO_DMA
|
||||
# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(2)
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
|
||||
#else
|
||||
//# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
//# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
|
||||
# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV16
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(15)
|
||||
# define BOARD_SDHC_SD4MODE_PRESCALER SDHC_SYSCTL_SDCLKFS_DIV2
|
||||
# define BOARD_SDHC_SD4MODE_DIVISOR SDHC_SYSCTL_DVS_DIV(3)
|
||||
#endif
|
||||
|
||||
/* LED definitions ******************************************************************/
|
||||
|
111
configs/freedom-k64f/netnsh/Make.defs
Normal file
111
configs/freedom-k64f/netnsh/Make.defs
Normal file
@ -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 =
|
||||
|
1166
configs/freedom-k64f/netnsh/defconfig
Normal file
1166
configs/freedom-k64f/netnsh/defconfig
Normal file
File diff suppressed because it is too large
Load Diff
77
configs/freedom-k64f/netnsh/setenv.sh
Normal file
77
configs/freedom-k64f/netnsh/setenv.sh
Normal file
@ -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}"
|
@ -192,6 +192,8 @@ CONFIG_ARCH_FAMILY_K64=y
|
||||
CONFIG_KINETIS_UART3=y
|
||||
# CONFIG_KINETIS_UART4 is not set
|
||||
# CONFIG_KINETIS_UART5 is not set
|
||||
# CONFIG_KINETIS_ENET is not set
|
||||
# CONFIG_KINETIS_RNGB is not set
|
||||
# CONFIG_KINETIS_FLEXCAN0 is not set
|
||||
# CONFIG_KINETIS_FLEXCAN1 is not set
|
||||
# CONFIG_KINETIS_SPI0 is not set
|
||||
@ -312,7 +314,14 @@ CONFIG_ARCH_HAVE_IRQBUTTONS=y
|
||||
# Board-Specific Options
|
||||
#
|
||||
# CONFIG_BOARD_CRASHDUMP is not set
|
||||
# CONFIG_LIB_BOARDCTL is not set
|
||||
CONFIG_LIB_BOARDCTL=y
|
||||
# CONFIG_BOARDCTL_RESET is not set
|
||||
# CONFIG_BOARDCTL_UNIQUEID is not set
|
||||
# CONFIG_BOARDCTL_TSCTEST is not set
|
||||
# CONFIG_BOARDCTL_ADCTEST is not set
|
||||
# CONFIG_BOARDCTL_PWMTEST is not set
|
||||
# CONFIG_BOARDCTL_GRAPHICS is not set
|
||||
# CONFIG_BOARDCTL_IOCTL is not set
|
||||
|
||||
#
|
||||
# RTOS Features
|
||||
@ -545,6 +554,7 @@ CONFIG_SYSLOG_SERIAL_CONSOLE=y
|
||||
CONFIG_SYSLOG_CONSOLE=y
|
||||
# CONFIG_SYSLOG_NONE is not set
|
||||
# CONFIG_SYSLOG_FILE is not set
|
||||
# CONFIG_SYSLOG_CHARDEV is not set
|
||||
|
||||
#
|
||||
# Networking Support
|
||||
@ -584,7 +594,15 @@ CONFIG_FS_FAT=y
|
||||
# CONFIG_FS_ROMFS is not set
|
||||
# CONFIG_FS_TMPFS is not set
|
||||
# CONFIG_FS_SMARTFS is not set
|
||||
# CONFIG_FS_PROCFS is not set
|
||||
CONFIG_FS_PROCFS=y
|
||||
CONFIG_FS_PROCFS_REGISTER=y
|
||||
|
||||
#
|
||||
# Exclude individual procfs entries
|
||||
#
|
||||
# CONFIG_FS_PROCFS_EXCLUDE_PROCESS is not set
|
||||
# CONFIG_FS_PROCFS_EXCLUDE_UPTIME is not set
|
||||
# CONFIG_FS_PROCFS_EXCLUDE_MOUNTS is not set
|
||||
# CONFIG_FS_UNIONFS is not set
|
||||
|
||||
#
|
||||
@ -730,6 +748,7 @@ CONFIG_EXAMPLES_NSH=y
|
||||
# CONFIG_EXAMPLES_TELNETD is not set
|
||||
# CONFIG_EXAMPLES_TIFF is not set
|
||||
# CONFIG_EXAMPLES_TOUCHSCREEN is not set
|
||||
# CONFIG_EXAMPLES_USBSERIAL is not set
|
||||
# CONFIG_EXAMPLES_USBTERM is not set
|
||||
# CONFIG_EXAMPLES_WATCHDOG is not set
|
||||
# CONFIG_EXAMPLES_WEBSERVER is not set
|
||||
@ -829,7 +848,6 @@ CONFIG_NSH_DISABLE_LOSMART=y
|
||||
# CONFIG_NSH_DISABLE_MV is not set
|
||||
# CONFIG_NSH_DISABLE_MW is not set
|
||||
# CONFIG_NSH_DISABLE_PS is not set
|
||||
# CONFIG_NSH_DISABLE_PSSTACKUSAGE is not set
|
||||
# CONFIG_NSH_DISABLE_PUT is not set
|
||||
# CONFIG_NSH_DISABLE_PWD is not set
|
||||
# CONFIG_NSH_DISABLE_RM is not set
|
||||
@ -853,6 +871,7 @@ CONFIG_NSH_MMCSDMINOR=0
|
||||
CONFIG_NSH_CMDOPT_DF_H=y
|
||||
CONFIG_NSH_CODECS_BUFSIZE=128
|
||||
CONFIG_NSH_CMDOPT_HEXDUMP=y
|
||||
CONFIG_NSH_PROC_MOUNTPOINT="/proc"
|
||||
CONFIG_NSH_FILEIOSIZE=512
|
||||
|
||||
#
|
||||
@ -867,7 +886,7 @@ CONFIG_NSH_FILEIOSIZE=512
|
||||
#
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
# CONFIG_NSH_ALTCONDEV is not set
|
||||
# CONFIG_NSH_ARCHINIT is not set
|
||||
CONFIG_NSH_ARCHINIT=y
|
||||
# CONFIG_NSH_LOGIN is not set
|
||||
# CONFIG_NSH_CONSOLE_LOGIN is not set
|
||||
|
||||
|
@ -49,6 +49,65 @@
|
||||
* Pre-processor Definitions
|
||||
************************************************************************************/
|
||||
|
||||
/* Application Configuration ********************************************************/
|
||||
|
||||
/* Assume we have everything */
|
||||
|
||||
#define HAVE_PROC 1
|
||||
#define NSH_HAVEUSBDEV 1
|
||||
#define NSH_HAVEMMCSD 1
|
||||
|
||||
/* Automount procfs */
|
||||
|
||||
#if !defined(CONFIG_FS_PROCFS)
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_PROC) && defined(CONFIG_DISABLE_MOUNTPOINT)
|
||||
# warning Mountpoints disabled. No procfs support
|
||||
# undef HAVE_PROC
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NSH_PROC_MOUNTPOINT)
|
||||
# define PROCFS_MOUNTPOUNT CONFIG_NSH_PROC_MOUNTPOINT
|
||||
#else
|
||||
# define PROCFS_MOUNTPOUNT "/proc"
|
||||
#endif
|
||||
|
||||
/* SD card support */
|
||||
|
||||
#define MMCSD_SLOTNO 0
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
|
||||
* is not enabled.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
|
||||
# undef NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error "Only one MMC/SD slot, slot 0"
|
||||
# endif
|
||||
|
||||
/* We expect to receive GPIO interrupts for card insertion events */
|
||||
|
||||
# ifndef CONFIG_GPIO_IRQ
|
||||
# error "CONFIG_GPIO_IRQ required for card detect interrupt"
|
||||
# endif
|
||||
|
||||
# ifndef CONFIG_KINETIS_PORTEINTS
|
||||
# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Can't support USB features if USB is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef NSH_HAVEUSBDEV
|
||||
#endif
|
||||
|
||||
/* How many SPI modules does this chip support? The LM3S6918 supports 2 SPI
|
||||
* modules (others may support more -- in such case, the following must be
|
||||
* expanded).
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
@ -54,58 +55,6 @@
|
||||
|
||||
#if defined(CONFIG_LIB_BOARDCTL) || defined(CONFIG_BOARD_INITIALIZE)
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
/* PORT and SLOT number probably depend on the board configuration */
|
||||
|
||||
#ifdef CONFIG_ARCH_BOARD_FREEDOM_K64F
|
||||
# define NSH_HAVEUSBDEV 1
|
||||
# define NSH_HAVEMMCSD 1
|
||||
# if defined(CONFIG_NSH_MMCSDSLOTNO) && CONFIG_NSH_MMCSDSLOTNO != 0
|
||||
# error "Only one MMC/SD slot, slot 0"
|
||||
# undef CONFIG_NSH_MMCSDSLOTNO
|
||||
# endif
|
||||
# ifndef CONFIG_NSH_MMCSDSLOTNO
|
||||
# define CONFIG_NSH_MMCSDSLOTNO 0
|
||||
# endif
|
||||
#else
|
||||
/* Add configuration for new Kinetis boards here */
|
||||
# error "Unrecognized Kinetis board"
|
||||
# undef NSH_HAVEUSBDEV
|
||||
# undef NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
/* Can't support USB features if USB is not enabled */
|
||||
|
||||
#ifndef CONFIG_USBDEV
|
||||
# undef NSH_HAVEUSBDEV
|
||||
#endif
|
||||
|
||||
/* Can't support MMC/SD features if mountpoints are disabled or if SDHC support
|
||||
* is not enabled.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_DISABLE_MOUNTPOINT) || !defined(CONFIG_KINETIS_SDHC)
|
||||
# undef NSH_HAVEMMCSD
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_NSH_MMCSDMINOR
|
||||
# define CONFIG_NSH_MMCSDMINOR 0
|
||||
#endif
|
||||
|
||||
/* We expect to receive GPIO interrupts for card insertion events */
|
||||
|
||||
#ifndef CONFIG_GPIO_IRQ
|
||||
# error "CONFIG_GPIO_IRQ required for card detect interrupt"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_KINETIS_PORTEINTS
|
||||
# error "CONFIG_KINETIS_PORTEINTS required for card detect interrupt"
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
@ -199,9 +148,24 @@ static int k64_cdinterrupt(int irq, FAR void *context)
|
||||
|
||||
int k64_bringup(void)
|
||||
{
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
int ret;
|
||||
|
||||
#ifdef HAVE_PROC
|
||||
/* Mount the proc filesystem */
|
||||
|
||||
syslog(LOG_INFO, "Mounting procfs to /proc\n");
|
||||
|
||||
ret = mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
syslog(LOG_ERR,
|
||||
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n",
|
||||
ret, errno);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NSH_HAVEMMCSD
|
||||
/* Configure GPIO pins */
|
||||
|
||||
/* Attached the card detect interrupt (but don't enable it yet) */
|
||||
@ -211,19 +175,18 @@ int k64_bringup(void)
|
||||
|
||||
/* Configure the write protect GPIO */
|
||||
|
||||
kinetis_pinconfig(GPIO_SD_WRPROTECT);
|
||||
//kinetis_pinconfig(GPIO_SD_WRPROTECT);
|
||||
|
||||
/* Mount the SDHC-based MMC/SD block driver */
|
||||
/* First, get an instance of the SDHC interface */
|
||||
|
||||
syslog(LOG_INFO, "Initializing SDHC slot %d\n",
|
||||
CONFIG_NSH_MMCSDSLOTNO);
|
||||
syslog(LOG_INFO, "Initializing SDHC slot %d\n", MMCSD_SLOTNO);
|
||||
|
||||
g_nsh.sdhc = sdhc_initialize(CONFIG_NSH_MMCSDSLOTNO);
|
||||
g_nsh.sdhc = sdhc_initialize(MMCSD_SLOTNO);
|
||||
if (!g_nsh.sdhc)
|
||||
{
|
||||
syslog(LOG_ERR, "ERROR: Failed to initialize SDHC slot %d\n",
|
||||
CONFIG_NSH_MMCSDSLOTNO);
|
||||
MMCSD_SLOTNO);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -249,6 +212,8 @@ int k64_bringup(void)
|
||||
|
||||
kinetis_pinirqenable(GPIO_SD_CARDDETECT);
|
||||
#endif
|
||||
|
||||
UNUSED(ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -210,22 +210,60 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
g_mtd_fs = mtd_temp;
|
||||
|
||||
#ifdef CONFIG_MTD_PARTITION
|
||||
/* Setup a partition of 256KiB for our file system. */
|
||||
{
|
||||
FAR struct mtd_geometry_s geo;
|
||||
off_t nblocks;
|
||||
|
||||
#if defined(CONFIG_N25QXXX_SECTOR512)
|
||||
mtd_temp = mtd_partition(g_mtd_fs, 0, 512);
|
||||
#else
|
||||
mtd_temp = mtd_partition(g_mtd_fs, 0, 64);
|
||||
/* Setup a partition of 256KiB for our file system. */
|
||||
|
||||
ret = MTD_IOCTL(g_mtd_fs, MTDIOC_GEOMETRY, (unsigned long)(uintptr_t)&geo);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: MTDIOC_GEOMETRY failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
nblocks = (256*1024) / geo.blocksize;
|
||||
|
||||
mtd_temp = mtd_partition(g_mtd_fs, 0, nblocks);
|
||||
if (!mtd_temp)
|
||||
{
|
||||
_err("ERROR: mtd_partition failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
g_mtd_fs = mtd_temp;
|
||||
}
|
||||
#endif
|
||||
if (!g_mtd_fs)
|
||||
|
||||
#ifdef HAVE_N25QXXX_SMARTFS
|
||||
/* Configure the device with no partition support */
|
||||
|
||||
ret = smart_initialize(N25QXXX_SMART_MINOR, g_mtd_fs, NULL);
|
||||
if (ret != OK)
|
||||
{
|
||||
_err("ERROR: mtd_partition failed\n");
|
||||
_err("ERROR: Failed to initialize SmartFS: %d\n", ret);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_N25QXXX_NXFFS)
|
||||
/* Initialize to provide NXFFS on the N25QXXX MTD interface */
|
||||
|
||||
ret = nxffs_initialize(g_mtd_fs);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: NXFFS initialization failed: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Mount the file system at /mnt/nxffs */
|
||||
|
||||
ret = mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
_err("ERROR: Failed to mount the NXFFS volume: %d\n", errno);
|
||||
return ret;
|
||||
}
|
||||
|
||||
g_mtd_fs = mtd_temp;
|
||||
#endif
|
||||
|
||||
#else /* if defined(HAVE_N25QXXX_CHARDEV) */
|
||||
/* Use the FTL layer to wrap the MTD driver as a block driver */
|
||||
|
||||
ret = ftl_initialize(N25QXXX_MTD_MINOR, g_mtd_fs);
|
||||
@ -256,6 +294,7 @@ FAR struct mtd_dev_s *mtd_temp;
|
||||
_err("ERROR: bchdev_register %s failed: %d\n", chardev, ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -87,7 +87,6 @@
|
||||
# define CONFIG_N25QXXX_DUMMIES 6
|
||||
#endif
|
||||
|
||||
|
||||
/* N25QXXX Commands *****************************************************************/
|
||||
/* Configuration, Status, Erase, Program Commands ***********************************/
|
||||
/* Command Value Description: */
|
||||
@ -98,7 +97,7 @@
|
||||
* 0x01 | SR */
|
||||
#define N25QXXX_READ_VOLCFG 0x85 /* Read volatile configuration register: *
|
||||
* 0x85 | VCR */
|
||||
#define N25QXXX_WRITE_VOLCFG 0x81 /* Write status register: *
|
||||
#define N25QXXX_WRITE_VOLCFG 0x81 /* Write svolatile configuration register: *
|
||||
* 0x81 | VCR */
|
||||
#define N25QXXX_WRITE_ENABLE 0x06 /* Write enable: *
|
||||
* 0x06 */
|
||||
@ -123,7 +122,7 @@
|
||||
/* Command Value Description: */
|
||||
/* Data sequence */
|
||||
|
||||
/* ID/Security Commands *************************&***********************************/
|
||||
/* ID/Security Commands *************************************************************/
|
||||
/* Command Value Description: */
|
||||
/* Data sequence */
|
||||
#define N25QXXX_JEDEC_ID 0x9f /* JEDEC ID: *
|
||||
@ -141,8 +140,8 @@
|
||||
|
||||
/* N25QXXX JEDIC IDs */
|
||||
|
||||
#define N25QXXX3V_JEDEC_DEVICE_TYPE 0xba /* 3v memory device type */
|
||||
#define N25QXXX2V_JEDEC_DEVICE_TYPE 0xbb /* 2v memory device type */
|
||||
#define N25QXXX3V_JEDEC_DEVICE_TYPE 0xba /* 3v memory device type */
|
||||
#define N25QXXX2V_JEDEC_DEVICE_TYPE 0xbb /* 2v memory device type */
|
||||
|
||||
#define N25Q016_JEDEC_CAPACITY 0x15 /* N25Q016 (2 MB) memory capacity */
|
||||
#define N25Q032_JEDEC_CAPACITY 0x16 /* N25Q032 (4 MB) memory capacity */
|
||||
@ -168,7 +167,7 @@
|
||||
#define STATUS_TB_MASK (1 << 5) /* Bit 5: Top / Bottom Protect */
|
||||
# define STATUS_TB_TOP (0 << 5) /* 0 = BP2-BP0 protect Top down */
|
||||
# define STATUS_TB_BOTTOM (1 << 5) /* 1 = BP2-BP0 protect Bottom up */
|
||||
#define STATUS_BP3_MASK (1 << 5) /* Bit 6: BP3 */
|
||||
#define STATUS_BP3_MASK (1 << 5) /* Bit 6: BP3 */
|
||||
#define STATUS_SRP0_MASK (1 << 7) /* Bit 7: Status register protect 0 */
|
||||
# define STATUS_SRP0_UNLOCKED (0 << 7) /* 0 = WP# no effect / PS Lock Down */
|
||||
# define STATUS_SRP0_LOCKED (1 << 7) /* 1 = WP# protect / OTP Lock Down */
|
||||
@ -979,7 +978,7 @@ static int n25qxxx_flush_cache(struct n25qxxx_dev_s *priv)
|
||||
ferr("ERROR: n25qxxx_write_page failed: %d\n", ret);
|
||||
}
|
||||
|
||||
/* The case is no long dirty and the FLASH is no longer erased */
|
||||
/* The cache is no long dirty and the FLASH is no longer erased */
|
||||
|
||||
CLR_DIRTY(priv);
|
||||
CLR_ERASED(priv);
|
||||
@ -1002,7 +1001,7 @@ static FAR uint8_t *n25qxxx_read_cache(struct n25qxxx_dev_s *priv, off_t sector)
|
||||
int ret;
|
||||
|
||||
/* Convert from the 512 byte sector to the erase sector size of the device. For
|
||||
* exmample, if the actual erase sector size if 4Kb (1 << 12), then we first
|
||||
* example, if the actual erase sector size is 4Kb (1 << 12), then we first
|
||||
* shift to the right by 3 to get the sector number in 4096 increments.
|
||||
*/
|
||||
|
||||
@ -1218,11 +1217,11 @@ static ssize_t n25qxxx_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
nbytes >>= N25QXXX_SECTOR512_SHIFT;
|
||||
}
|
||||
#else
|
||||
nbytes = n25qxxx_read(dev, startblock << priv->sectorshift,
|
||||
nblocks << priv->sectorshift, buffer);
|
||||
nbytes = n25qxxx_read(dev, startblock << priv->pageshift,
|
||||
nblocks << priv->pageshift, buffer);
|
||||
if (nbytes > 0)
|
||||
{
|
||||
nbytes >>= priv->sectorshift;
|
||||
nbytes >>= priv->pageshift;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1253,8 +1252,8 @@ static ssize_t n25qxxx_bwrite(FAR struct mtd_dev_s *dev, off_t startblock,
|
||||
}
|
||||
|
||||
#else
|
||||
ret = n25qxxx_write_page(priv, buffer, startblock << priv->sectorshift,
|
||||
nblocks << priv->sectorshift);
|
||||
ret = n25qxxx_write_page(priv, buffer, startblock << priv->pageshift,
|
||||
nblocks << priv->pageshift);
|
||||
if (ret < 0)
|
||||
{
|
||||
ferr("ERROR: n25qxxx_write_page failed: %d\n", ret);
|
||||
@ -1328,7 +1327,7 @@ static int n25qxxx_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
||||
geo->erasesize = (1 << N25QXXX_SECTOR512_SHIFT);
|
||||
geo->neraseblocks = priv->nsectors << (priv->sectorshift - N25QXXX_SECTOR512_SHIFT);
|
||||
#else
|
||||
geo->blocksize = (1 << priv->sectorshift);
|
||||
geo->blocksize = (1 << priv->pageshift);
|
||||
geo->erasesize = (1 << priv->sectorshift);
|
||||
geo->neraseblocks = priv->nsectors;
|
||||
#endif
|
||||
|
@ -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 */
|
||||
|
@ -1691,6 +1691,11 @@ static int smartfs_unlink(struct inode *mountpt, const char *relpath)
|
||||
ret = OK;
|
||||
|
||||
errout_with_semaphore:
|
||||
if (entry.name != NULL)
|
||||
{
|
||||
kmm_free(entry.name);
|
||||
}
|
||||
|
||||
smartfs_semgive(fs);
|
||||
return ret;
|
||||
}
|
||||
@ -1856,6 +1861,11 @@ int smartfs_rmdir(struct inode *mountpt, const char *relpath)
|
||||
ret = OK;
|
||||
|
||||
errout_with_semaphore:
|
||||
if (entry.name != NULL)
|
||||
{
|
||||
kmm_free(entry.name);
|
||||
}
|
||||
|
||||
smartfs_semgive(fs);
|
||||
return ret;
|
||||
}
|
||||
|
@ -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 */
|
||||
|
@ -52,13 +52,12 @@
|
||||
#define M_E128 (M_E64 * M_E64)
|
||||
#define M_E256 (M_E128 * M_E128)
|
||||
#define M_E512 (M_E256 * M_E256)
|
||||
#define M_E1024 (M_E512 * M_E512)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const double g_expi_square_tbl[11] =
|
||||
static const double g_expi_square_tbl[] =
|
||||
{
|
||||
M_E, /* e^1 */
|
||||
M_E2, /* e^2 */
|
||||
@ -69,8 +68,7 @@ static const double g_expi_square_tbl[11] =
|
||||
M_E64, /* e^64 */
|
||||
M_E128, /* e^128 */
|
||||
M_E256, /* e^256 */
|
||||
M_E512, /* e^512 */
|
||||
M_E1024, /* e^1024 */
|
||||
M_E512 /* e^512 */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -82,7 +80,9 @@ double lib_expi(size_t n)
|
||||
size_t i;
|
||||
double val;
|
||||
|
||||
if (n > 1024)
|
||||
/* The largest calculable value for n is floor(ln(DBL_MAX)) */
|
||||
|
||||
if (n > 709)
|
||||
{
|
||||
return INFINITY;
|
||||
}
|
||||
|
@ -49,13 +49,16 @@
|
||||
#define M_E16 (M_E8 * M_E8)
|
||||
#define M_E32 (M_E16 * M_E16)
|
||||
#define M_E64 (M_E32 * M_E32)
|
||||
#define M_E128 (M_E64 * M_E64)
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static const float g_expif_square_tbl[8] =
|
||||
/* Values above M_E64 will never be used since it’s larger than FLT_MAX
|
||||
*(3.402823e+38).
|
||||
*/
|
||||
|
||||
static const float g_expif_square_tbl[] =
|
||||
{
|
||||
(float)M_E, /* e^1 */
|
||||
(float)M_E2, /* e^2 */
|
||||
@ -63,8 +66,7 @@ static const float g_expif_square_tbl[8] =
|
||||
(float)M_E8, /* e^8 */
|
||||
(float)M_E16, /* e^16 */
|
||||
(float)M_E32, /* e^32 */
|
||||
(float)M_E64, /* e^64 */
|
||||
(float)M_E128, /* e^128 */
|
||||
(float)M_E64 /* e^64 */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -76,7 +78,9 @@ float lib_expif(size_t n)
|
||||
size_t i;
|
||||
float val;
|
||||
|
||||
if (n > 128)
|
||||
/* The largest calculable value for n is floor(ln(FLT_MAX)) */
|
||||
|
||||
if (n > 88)
|
||||
{
|
||||
return INFINITY_F;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user