Re: Run and debug Fiasco.OC kernel and L4Re using a DSTREAM JTAG device and the ARM DS-5 IDE
Mahdi Aichouch <[email protected]>
| Newsgroups | gmane.comp.micro-kernel.l4.devel |
|---|---|
| Message-ID | <CAGBLRX5U7Jd1SboNOoDABAaH-oTpdZNTJsOqn1186TPEd40RBg@mail.gmail.com> |
Hello everyone,
Thank you very much Adam and Martin for your answers and help.
I used this command line to compile the l4re.
$> make elfimage E=hello BOOTSTRAP_NO_STRIP=y PLATFORM_TYPE=imx6
Then I verified that the right imx platform file is being used as shown
below,
... Generating bootstrap.ld
... Compiling exec.o
... Compiling module.o
... Compiling ARCH-arm/crt0.o
... Compiling region.o
... Compiling startup.o
... Compiling init_kip_f.o
... Compiling libc_support+.o
... Compiling patch.o
... Compiling koptions.o
... Compiling platform_common.o
... Compiling memory.o
... Compiling boot_modules.o
... Compiling platform/imx.o
... Compiling ARCH-arm/reboot.o
... Compiling ARCH-arm/head.o
==> Linking bootstrap.elf
==> Post-processing bootstrap.elf
==> "bootstrap.elf" built
==> Installing bootstrap.elf in image directory
==> Installing bootstrap_hello in image directory
Image size(s) in bytes:
bootstrap_hello.elf: 1320092
Start address: 0x11000000
However, I tried to debug via JTAG, and I checked that the fiasco kernel
and l4re were wroking correctly but I was unable to see anything on the
minicom serial console.
I did some investigation in the UART driver code example from the i.MX 6
Platfrom SDK provided by Freescale, where in this case I was able to see
the debug message on a serial console and to debug the code step by step
via JTAG.
I figured out that the difference between this case and the case of running
a l4 fiasco kernel is that there is a set of configurations that are done
in the case of the UART driver and not in the l4 fiasco kernel bootstrap.
As we can see in attached files the code of the uart driver rely on a
source code that is automatically generated by the IOMUX tool to configure
the board. According to the documentation: "this tool frees the device
driver design developers from design details of each pin and pad. The
source code generated by the tool is used as-is by the SDK."
In the other hand, when the L4-fiasco kernel is started using uboot these
peripherals configuration are done. But if the L4-fiasco kernel is started
alone these configuration are not.
The problem is that if these configurations are integrated to the fiasco
bootstrap, they will be done twice when the kernel is started via uboot:
first in uboot and second in the L4-fiasco bootstrap.
Is there any elegant way to deal with this problematic situation?
My second question is related to the test of the hello world example via
tftp,
as I was able to run l4-fiasco via uboot and tftp and to get the debug
message on the serial terminal.
The problem is that after the bootstrap_hello.uimage file is loaded, the
kernel starts.
Then it is supposed to run the Hello World test example, however, in the
trace there is no Hello World scrolling...
Is there something that I am missing?
Thank you very much.
Best regards,
Mahdi
MX6Q SABRESD U-Boot > setenv bootfile
/var/lib/tftpboot/bootstrap_hello.uimage
MX6Q SABRESD U-Boot > tftp
FEC: Link is Up 796d
Using FEC0 device
TFTP from server 10.8.33.17; our IP address is 10.8.33.200
Filename '/var/lib/tftpboot/bootstrap_hello.uimage'.
Load address: 0x10800000
Loading: #################################################################
##
done
Bytes transferred = 980460 (ef5ec hex)
MX6Q SABRESD U-Boot > bootm
## Booting kernel from Legacy Image at 10800000 ...
Image Name: L4 Image #22
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 980396 Bytes = 957.4 kB
Load Address: 11000000
Entry Point: 11000000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
L4 Bootstrapper
Build: #22 Wed Nov 19 13:22:36 CET 2014, 4.8.3 20140320 (prerelease)
Scanning up to 1024 MB RAM, starting at offset 32MB
Memory size is 1024MB (10000000 - 4fffffff)
RAM: 0000000010000000 - 000000004fffffff: 1048576kB
Total RAM: 1024MB
Scanning fiasco
Scanning sigma0
Scanning moe
Moving up to 5 modules behind 11100000
moving module 02 { 110b5000-110ee63f } -> { 111a5000-111de63f } [235072]
moving module 01 { 110ab000-110b438b } -> { 1119b000-111a438b } [37772]
moving module 00 { 11044000-110aa64b } -> { 11134000-1119a64b } [419404]
moving module 04 { 1102a000-11043597 } -> { 1111a000-11133597 } [103832]
moving module 03 { 11010000-11029473 } -> { 11100000-11119473 } [103540]
Loading fiasco
Loading sigma0
Loading moe
find kernel info page...
found kernel info page at 0x10002000
Regions of list 'regions'
[ 10000000, 100000e3] { e4} Root mbi_rt
[ 10001000, 10001aff] { b00} Kern fiasco
[ 10002000, 10072fff] { 71000} Kern fiasco
[ 10090000, 10096edf] { 6ee0} Sigma0 sigma0
[ 10098000, 1009e177] { 6178} Sigma0 sigma0
[ 10140000, 10171d77] { 31d78} Root moe
[ 10178000, 101934ab] { 1b4ac} Root moe
[ 11000000, 1100f4ff] { f500} Boot bootstrap
[ 11100000, 11133fff] { 34000} Root Module
API Version: (87) experimental
Sigma0 config ip:10090100 sp:00000000
Roottask config ip:10140260 sp:00000000
Starting kernel fiasco at 100012c8
On Tue, Nov 18, 2014 at 6:55 PM, Mahdi Aichouch <[email protected]> wrote:
> Hello Adam,
>
> I used this command line to compile the fiasco kernel and l4re.
>
> $> make -j 4 BOOTSTRAP_NO_STRIP=y PLATFORM_TYPE=imx6 PLATFORM_UART_NR=1
>
> I also added all these options to the src/l4/conf/Makeconf.boot
>
> But when I debug bootstrap_hello.elf binary, I still see that the
> uart_pl011.c that is used.
>
> As we can see in the attached config.all file the platform type is
> configured to i.mx6
>
> Do you have any idea.
>
> Thank you very much.
> Best regards,
>
>
>
> On Mon, Nov 17, 2014 at 11:39 AM, Mahdi Aichouch <[email protected]>
> wrote:
>
>> Hello Adam,
>>
>> Thank you very much for your answer.
>>
>> I didn't tried yet using an SD card or tftp.
>> I am interested in testing it using tftp, is there any guide showing how
>> to setup a working configuration on my development machine?
>>
>> I compiled the kernel using this command line:
>> $> make BOOTSTRAP_NO_STRIP=y PLATFORM_UART_NR=1
>>
>> Now the debugger is not complaining. I have the debug information and I
>> can also see the source code (as shown in the attached screenshot).
>>
>> But I still not get the debug information from the kernel in the minicom
>> serial terminal.
>> I did a step by step walk through the code, the attached file shows all
>> the debug information that I get.
>>
>> Do I used the PLATFORM_UART_NR=1 option correctly, what verification
>> should I do also?
>>
>> Thank you very much in advance.
>>
>> Best regards,
>>
>>
>> On Sat, Nov 15, 2014 at 10:00 PM, Adam Lackorzynski <
>> [email protected]> wrote:
>>
>>> Hi,
>>>
>>> On Fri Nov 14, 2014 at 15:33:50 +0100, Mahdi Aichouch wrote:
>>> > I have a Freescale i.MX 6 ARM Cortex A9 Sabre SD board.
>>> > I would like to test the Hello World example using the generated
>>> > bootstrap.elf binary.
>>> > I compiled the fiasco kernel and the l4re framework for the i.MX 6 ARM
>>> > Cortex-A9 using the menu configuration in both cases.
>>> >
>>> > Instead of using an SD card to run the binary on the board, I would
>>> like to
>>> > flash the RAM with the binary using the DSTREAM JTAG device and the ARM
>>> > DS-5 IDE.
>>> >
>>> > I connected the board to my host using the mini-usb to serial cable,
>>> and I
>>> > used minicom tool as a serial terminal.
>>> >
>>> > I tried to run the binary using the DS-5 debugger while the board is
>>> > connected through JTAG, but I didn't see any debug message on the
>>> serial
>>> > terminal.
>>>
>>> Is it working when you boot via SD card or tftp?
>>>
>>> > The source code I am using is from the "l4re-snapshot-2014092821".
>>> >
>>> > My questions:
>>> >
>>> > 1) Does anyone tried to run and debug fiasco kernel + l4re on a board
>>> using
>>> > a JTAG device?
>>> > What are the steps that I am missing?
>>>
>>> I've done it, however not with this particular board.
>>> I don't really think there could be anything missing. The info on the
>>> screenshot looks ok, the disassembly shows what it has to show.
>>> Did it stop itself? Or does it run and just no output? When you let it
>>> run a few seconds and stop it again, at which PC is it?
>>> Maybe just the wrong UART? UART2 is the default, UART1 would be
>>> PLATFORM_UART_NR=1
>>>
>>> > 2) The debug tool print a message saying that "WARNING(IMG53):
>>> > bootstrap.elf has no source level debug information", what are the
>>> options
>>> > required to include these information compiling the fiasco kernel +
>>> l4re?
>>>
>>> Add BOOTSTRAP_NO_STRIP=y when building the image (you can also put it
>>> into your l4/conf/Makeconf.boot).
>>>
>>>
>>>
>>>
>>> Adam
>>> --
>>> Adam [email protected]
>>> Lackorzynski http://os.inf.tu-dresden.de/~adam/
>>>
>>
>>
>
_______________________________________________
l4-hackers mailing list
[email protected]
http://os.inf.tu-dresden.de/mailman/listinfo/l4-hackers
imx_uart.c
(text/x-csrc, 7.8 KB)
/*
* Copyright (c) 2011-2012, Freescale Semiconductor, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* o 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.
*
* o Neither the name of Freescale Semiconductor, Inc. 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 HOLDER 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.
*/
/*!
* @file imx_uart.c
* @brief UART driver.
* @ingroup diag_uart
*/
#include "sdk.h"
#include "registers/regsuart.h"
#include "uart/imx_uart.h"
#include "core/ccm_pll.h"
#include "core/interrupt.h"
#define UART_UFCR_RFDIV BF_UART_UFCR_RFDIV(4)
//#define UART_UFCR_RFDIV UART_UFCR_RFDIV_4
//#define UART_UFCR_RFDIV UART_UFCR_RFDIV_7
uint32_t uart_get_reffreq(uint32_t instance)
{
uint32_t div = UART_UFCR_RFDIV;
uint32_t ret = 0;
uint32_t freq = get_peri_clock(UART_MODULE_CLK(instance));
if (div == BF_UART_UFCR_RFDIV(4))
ret = freq / 2;
else if (div == BF_UART_UFCR_RFDIV(2))
ret = freq / 4;
else if (div == BF_UART_UFCR_RFDIV(6))
ret = freq / 7;
return ret;
}
uint8_t uart_putchar(uint32_t instance, uint8_t * ch)
{
/* Wait for Tx FIFO not full */
while (HW_UART_UTS(instance).B.TXFULL);
HW_UART_UTXD_WR(instance, *ch);
return *ch;
}
uint8_t uart_getchar(uint32_t instance)
{
uint32_t read_data;
/* If Rx FIFO has no data ready */
if (!(HW_UART_USR2(instance).B.RDR))
return NONE_CHAR;
read_data = HW_UART_URXD_RD(instance);
/* If error are detected */
if (read_data & 0x7C00)
return NONE_CHAR;
return (uint8_t) read_data;
}
void uart_set_FIFO_mode(uint32_t instance, uint8_t fifo, uint8_t trigger_level,
uint8_t service_mode)
{
if (fifo == TX_FIFO) {
/* Configure the TX_FIFO trigger level */
HW_UART_UFCR_CLR(instance,BM_UART_UFCR_TXTL);
HW_UART_UFCR_SET(instance, BF_UART_UFCR_TXTL(trigger_level));
/* Configure the TX_FIFO service mode */
/* Default mode is polling: IRQ and DMA requests are disabled */
HW_UART_UCR1_CLR(instance,(BM_UART_UCR1_TRDYEN | BM_UART_UCR1_TXDMAEN));
if (service_mode == DMA_MODE)
HW_UART_UCR1_SET(instance,BM_UART_UCR1_TXDMAEN);
else if (service_mode == IRQ_MODE)
HW_UART_UCR1_SET(instance,BM_UART_UCR1_TRDYEN);
} else { /* fifo = RX_FIFO */
/* Configure the RX_FIFO trigger level */
HW_UART_UFCR_CLR(instance,BM_UART_UFCR_RXTL);
HW_UART_UFCR_SET(instance,BF_UART_UFCR_RXTL(trigger_level));
/* Configure the RX_FIFO service mode */
/* Default mode is polling: IRQ and DMA requests are disabled */
HW_UART_UCR1_CLR(instance,(BM_UART_UCR1_RRDYEN | BM_UART_UCR1_RXDMAEN));
if (service_mode == DMA_MODE)
HW_UART_UCR1_SET(instance,BM_UART_UCR1_RXDMAEN);
else if (service_mode == IRQ_MODE)
HW_UART_UCR1_SET(instance,BM_UART_UCR1_RRDYEN);
}
}
void uart_set_loopback_mode(uint32_t instance, uint8_t state)
{
if (state == TRUE)
HW_UART_UTS_SET(instance, BM_UART_UTS_LOOP);
else
HW_UART_UTS_CLR(instance, BM_UART_UTS_LOOP);
}
void uart_setup_interrupt(uint32_t instance, void (*irq_subroutine)(void), uint8_t state)
{
uint32_t irq_id = UART_IRQS(instance);
if (state == TRUE) {
/* register the IRQ sub-routine */
register_interrupt_routine(irq_id, irq_subroutine);
/* enable the IRQ */
enable_interrupt(irq_id, CPU_0, 0);
} else
/* disable the IRQ */
disable_interrupt(irq_id, CPU_0);
}
void uart_init(uint32_t instance, uint32_t baudrate, uint8_t parity,
uint8_t stopbits, uint8_t datasize, uint8_t flowcontrol)
{
uint32_t base = REGS_UART_BASE(instance);
/* configure the I/O for the port */
uart_iomux_config(instance);
/* enable the source clocks to the UART port */
clock_gating_config(base, CLOCK_ON);
/* Wait for UART to finish transmitting before changing the configuration */
while (!(HW_UART_UTS(instance).B.TXEMPTY)) ;
/* Disable UART */
HW_UART_UCR1_CLR(instance,BM_UART_UCR1_UARTEN );
/* Configure FIFOs trigger level to half-full and half-empty */
HW_UART_UFCR_WR(instance, BF_UART_UFCR_RXTL(16) | UART_UFCR_RFDIV | BF_UART_UFCR_TXTL(16));
/* Setup One Millisecond timer */
HW_UART_ONEMS_WR(instance, uart_get_reffreq(instance) / 1000);
/* Set parity */
if (parity == PARITY_NONE)
HW_UART_UCR2_CLR(instance,(BM_UART_UCR2_PREN| BM_UART_UCR2_PROE));
else if (parity == PARITY_ODD)
HW_UART_UCR2_SET(instance,(BM_UART_UCR2_PREN| BM_UART_UCR2_PROE));
else { /* parity == PARITY_EVEN */
HW_UART_UCR2_SET(instance, BM_UART_UCR2_PREN);
HW_UART_UCR2_CLR(instance, BM_UART_UCR2_PROE);
}
/* Set stop bit */
if (stopbits == STOPBITS_ONE)
HW_UART_UCR2_CLR(instance, BM_UART_UCR2_STPB);
else /* stopbits == STOPBITS_TWO */
HW_UART_UCR2_SET(instance, BM_UART_UCR2_STPB);
/* Set data size */
if (datasize == EIGHTBITS)
HW_UART_UCR2_SET(instance, BM_UART_UCR2_WS);
else /* stopbits == STOPBITS_TWO */
HW_UART_UCR2_CLR(instance, BM_UART_UCR2_WS);
/* Configure the flow control */
if (flowcontrol == FLOWCTRL_ON) {
/* transmit done when RTS asserted */
HW_UART_UCR2_CLR(instance, BM_UART_UCR2_IRTS );
/* CTS controlled by the receiver */
HW_UART_UCR2_SET(instance, BM_UART_UCR2_CTSC );
} else { /* flowcontrol == FLOWCTRL_OFF */
/* Ignore RTS */
HW_UART_UCR2_SET(instance, BM_UART_UCR2_IRTS);
/* CTS controlled by the CTS bit */
HW_UART_UCR2_CLR(instance, BM_UART_UCR2_CTSC);
}
/* the reference manual says that this bit must always be set */
HW_UART_UCR3_SET(instance, BM_UART_UCR3_RXDMUXSEL);
/* Enable UART */
HW_UART_UCR1_SET(instance, BM_UART_UCR1_UARTEN);
/* Enable FIFOs and does software reset to clear status flags, reset
the transmit and receive state machine, and reset the FIFOs */
HW_UART_UCR2_SET(instance, BM_UART_UCR2_TXEN | BM_UART_UCR2_RXEN | BM_UART_UCR2_SRST);
/* Set the numerator value minus one of the BRM ratio */
HW_UART_UBIR_WR(instance, (baudrate / 100) - 1);
/* Set the denominator value minus one of the BRM ratio */
HW_UART_UBMR_WR(instance, ((uart_get_reffreq(instance) / 1600) - 1));
/* Optional: prevent the UART to enter debug state. Useful when debugging
the code with a JTAG and without active IRQ */
//HW_UART_UTS_SET(instance, BM_UART_UTS_DBGEN);
}
uart1_iomux_config.c
(text/x-csrc, 9.9 KB)
/*
* Copyright (c) 2012, Freescale Semiconductor, Inc.
* All rights reserved.
*
* 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 HOLDER 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.
*/
// File: uart1_iomux_config.c
/* ------------------------------------------------------------------------------
* <auto-generated>
* This code was generated by a tool.
* Runtime Version:3.4.0.0
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
* </auto-generated>
* ------------------------------------------------------------------------------
*/
#include "iomux_config.h"
#include "registers/regsiomuxc.h"
// Function to configure IOMUXC for uart1 module.
void uart1_iomux_config(void)
{
// Config uart1.UART1_RX_DATA to pad CSI0_DATA11(M3)
// HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA11_WR(0x00000003);
// HW_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_WR(0x0001B0B0);
// HW_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_WR(0x00000001);
// Mux Register:
// IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA11(0x020E0284)
// SION [4] - Software Input On Field Reset: DISABLED
// Force the selected mux mode Input path no matter of MUX_MODE functionality.
// DISABLED (0) - Input Path is determined by functionality of the selected mux mode (regular).
// ENABLED (1) - Force input path of pad.
// MUX_MODE [2:0] - MUX Mode Select Field Reset: ALT5
// Select iomux modes to be used for pad.
// ALT0 (0) - Select instance: ipu1 signal: IPU1_CSI0_DATA11
// ALT1 (1) - Select instance: audmux signal: AUD3_RXFS
// ALT2 (2) - Select instance: ecspi2 signal: ECSPI2_SS0
// ALT3 (3) - Select instance: uart1 signal: UART1_RX_DATA
// ALT5 (5) - Select instance: gpio5 signal: GPIO5_IO29
// ALT7 (7) - Select instance: arm signal: ARM_TRACE08
HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA11_WR(
BF_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA11_SION_V(DISABLED) |
BF_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA11_MUX_MODE_V(ALT3));
// Pad Control Register:
// IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11(0x020E0654)
// HYS [16] - Hysteresis Enable Field Reset: ENABLED
// DISABLED (0) - CMOS input
// ENABLED (1) - Schmitt trigger input
// PUS [15:14] - Pull Up / Down Config. Field Reset: 100K_OHM_PU
// 100K_OHM_PD (0) - 100K Ohm Pull Down
// 47K_OHM_PU (1) - 47K Ohm Pull Up
// 100K_OHM_PU (2) - 100K Ohm Pull Up
// 22K_OHM_PU (3) - 22K Ohm Pull Up
// PUE [13] - Pull / Keep Select Field Reset: PULL
// KEEP (0) - Keeper Enabled
// PULL (1) - Pull Enabled
// PKE [12] - Pull / Keep Enable Field Reset: ENABLED
// DISABLED (0) - Pull/Keeper Disabled
// ENABLED (1) - Pull/Keeper Enabled
// ODE [11] - Open Drain Enable Field Reset: DISABLED
// Enables open drain of the pin.
// DISABLED (0) - Output is CMOS.
// ENABLED (1) - Output is Open Drain.
// SPEED [7:6] - Speed Field Reset: 100MHZ
// TBD (0) - TBD
// 50MHZ (1) - Low (50 MHz)
// 100MHZ (2) - Medium (100 MHz)
// 200MHZ (3) - Maximum (200 MHz)
// DSE [5:3] - Drive Strength Field Reset: 40_OHM
// HIZ (0) - HI-Z
// 240_OHM (1) - 240 Ohm
// 120_OHM (2) - 120 Ohm
// 80_OHM (3) - 80 Ohm
// 60_OHM (4) - 60 Ohm
// 48_OHM (5) - 48 Ohm
// 40_OHM (6) - 40 Ohm
// 34_OHM (7) - 34 Ohm
// SRE [0] - Slew Rate Field Reset: SLOW
// Slew rate control.
// SLOW (0) - Slow Slew Rate
// FAST (1) - Fast Slew Rate
HW_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_WR(
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_HYS_V(ENABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_PUS_V(100K_OHM_PU) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_PUE_V(PULL) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_PKE_V(ENABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_ODE_V(DISABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_SPEED_V(100MHZ) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_DSE_V(40_OHM) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA11_SRE_V(SLOW));
// Pad CSI0_DATA11 is involved in Daisy Chain.
// Input Select Register:
// IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT(0x020E0920)
// DAISY [1:0] - MUX Mode Select Field Reset: CSI0_DATA10_ALT3
// Selecting Pads Involved in Daisy Chain.
// CSI0_DATA10_ALT3 (0) - Select signal uart1 UART1_TX_DATA as input from pad CSI0_DATA10(ALT3).
// CSI0_DATA11_ALT3 (1) - Select signal uart1 UART1_RX_DATA as input from pad CSI0_DATA11(ALT3).
// SD3_DATA7_ALT1 (2) - Select signal uart1 UART1_TX_DATA as input from pad SD3_DATA7(ALT1).
// SD3_DATA6_ALT1 (3) - Select signal uart1 UART1_RX_DATA as input from pad SD3_DATA6(ALT1).
HW_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_WR(
BF_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_DAISY_V(CSI0_DATA11_ALT3));
// Config uart1.UART1_TX_DATA to pad CSI0_DATA10(M1)
// HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10_WR(0x00000003);
// HW_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_WR(0x0001B0B0);
// HW_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_WR(0x00000001);
// Mux Register:
// IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10(0x020E0280)
// SION [4] - Software Input On Field Reset: DISABLED
// Force the selected mux mode Input path no matter of MUX_MODE functionality.
// DISABLED (0) - Input Path is determined by functionality of the selected mux mode (regular).
// ENABLED (1) - Force input path of pad.
// MUX_MODE [2:0] - MUX Mode Select Field Reset: ALT5
// Select iomux modes to be used for pad.
// ALT0 (0) - Select instance: ipu1 signal: IPU1_CSI0_DATA10
// ALT1 (1) - Select instance: audmux signal: AUD3_RXC
// ALT2 (2) - Select instance: ecspi2 signal: ECSPI2_MISO
// ALT3 (3) - Select instance: uart1 signal: UART1_TX_DATA
// ALT5 (5) - Select instance: gpio5 signal: GPIO5_IO28
// ALT7 (7) - Select instance: arm signal: ARM_TRACE07
HW_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10_WR(
BF_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10_SION_V(DISABLED) |
BF_IOMUXC_SW_MUX_CTL_PAD_CSI0_DATA10_MUX_MODE_V(ALT3));
// Pad Control Register:
// IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10(0x020E0650)
// HYS [16] - Hysteresis Enable Field Reset: ENABLED
// DISABLED (0) - CMOS input
// ENABLED (1) - Schmitt trigger input
// PUS [15:14] - Pull Up / Down Config. Field Reset: 100K_OHM_PU
// 100K_OHM_PD (0) - 100K Ohm Pull Down
// 47K_OHM_PU (1) - 47K Ohm Pull Up
// 100K_OHM_PU (2) - 100K Ohm Pull Up
// 22K_OHM_PU (3) - 22K Ohm Pull Up
// PUE [13] - Pull / Keep Select Field Reset: PULL
// KEEP (0) - Keeper Enabled
// PULL (1) - Pull Enabled
// PKE [12] - Pull / Keep Enable Field Reset: ENABLED
// DISABLED (0) - Pull/Keeper Disabled
// ENABLED (1) - Pull/Keeper Enabled
// ODE [11] - Open Drain Enable Field Reset: DISABLED
// Enables open drain of the pin.
// DISABLED (0) - Output is CMOS.
// ENABLED (1) - Output is Open Drain.
// SPEED [7:6] - Speed Field Reset: 100MHZ
// TBD (0) - TBD
// 50MHZ (1) - Low (50 MHz)
// 100MHZ (2) - Medium (100 MHz)
// 200MHZ (3) - Maximum (200 MHz)
// DSE [5:3] - Drive Strength Field Reset: 40_OHM
// HIZ (0) - HI-Z
// 240_OHM (1) - 240 Ohm
// 120_OHM (2) - 120 Ohm
// 80_OHM (3) - 80 Ohm
// 60_OHM (4) - 60 Ohm
// 48_OHM (5) - 48 Ohm
// 40_OHM (6) - 40 Ohm
// 34_OHM (7) - 34 Ohm
// SRE [0] - Slew Rate Field Reset: SLOW
// Slew rate control.
// SLOW (0) - Slow Slew Rate
// FAST (1) - Fast Slew Rate
HW_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_WR(
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_HYS_V(ENABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_PUS_V(100K_OHM_PU) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_PUE_V(PULL) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_PKE_V(ENABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_ODE_V(DISABLED) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_SPEED_V(100MHZ) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_DSE_V(40_OHM) |
BF_IOMUXC_SW_PAD_CTL_PAD_CSI0_DATA10_SRE_V(SLOW));
// Pad CSI0_DATA10 is involved in Daisy Chain.
// Input Select Register:
// IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT(0x020E0920)
// DAISY [1:0] - MUX Mode Select Field Reset: CSI0_DATA10_ALT3
// Selecting Pads Involved in Daisy Chain.
// CSI0_DATA10_ALT3 (0) - Select signal uart1 UART1_TX_DATA as input from pad CSI0_DATA10(ALT3).
// CSI0_DATA11_ALT3 (1) - Select signal uart1 UART1_RX_DATA as input from pad CSI0_DATA11(ALT3).
// SD3_DATA7_ALT1 (2) - Select signal uart1 UART1_TX_DATA as input from pad SD3_DATA7(ALT1).
// SD3_DATA6_ALT1 (3) - Select signal uart1 UART1_RX_DATA as input from pad SD3_DATA6(ALT1).
HW_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_WR(
BF_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_DAISY_V(CSI0_DATA11_ALT3));
}
uart_iomux_config.c
(text/x-csrc, 1.8 KB)
/*
* Copyright (c) 2012, Freescale Semiconductor, Inc.
* All rights reserved.
*
* 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 HOLDER 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.
*/
// File: uart_iomux_config.c
/* ------------------------------------------------------------------------------
* <auto-generated>
* This code was generated by a tool.
* Runtime Version:3.4.0.0
*
* Changes to this file may cause incorrect behavior and will be lost if
* the code is regenerated.
* </auto-generated>
* ------------------------------------------------------------------------------
*/
#include "iomux_config.h"
#include "registers/regsiomuxc.h"
#include "registers/regsuart.h"
#include "io.h"
#include <assert.h>
void uart_iomux_config(int instance)
{
switch (instance)
{
case HW_UART1:
return uart1_iomux_config();
case HW_UART2:
return uart2_iomux_config();
case HW_UART3:
return uart3_iomux_config();
case HW_UART4:
return uart4_iomux_config();
case HW_UART5:
return uart5_iomux_config();
default:
assert(false);
}
}