Re: [GSoC2014] arinc653 on rtems (using pok) patches
If you're using git for your development, you can use 'git format-patch' to convert a set of commits into a set of patches. Some properly formatted git patches can make it easier to review and merge your code. Some other notes follow. virtualpok_arinc653.patch: * it seems the only part of this patch specific to the arinc653 code is the Makefile.am and preinstall.am changes? * The virtualizationlayercpu.h is missing. Is this supposed to come from another patch already? * You comment out a few lines in bspstart.c, are these things that were broken? * Is the linkcmds change required for running pok-rtems? hello_init_c.patch: * This would be much improved if you provided a new example instead of replacing the existing one, like 'arinc653_test.c' or similar. libpok_rtems_arinc653.patch: It seems incorrect to remove extern from all of these arrays. Usually for global variables in C code, there should be one declaration of the variable with the 'extern' attribute in a header file that gets included in every c source file that needs that variable, and then one definition of the variable without 'extern' in just one of the .c files. Please explain your changes. Also, the patches that are for pok should be sent to the pok mailing list(s) for review. -Gedare On Sat, Aug 16, 2014 at 4:34 PM, Janek van Oirschot wrote: > A bit unconventional for a new patch but since my patches also include POK > changes this seemed like the best way to upload it. Patches and readme with > explanation on how to duplicate my environment and work are in the tarball. > I do assume that the virtualpok BSP and paravirt_cpu patches are already > installed so I didn't include that with my patches. Working on the wikipage > about arinc653 on rtems right now so that'll be up soon. > > Thanks, > Janek van Oirschot > > ___ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v2] BSP for TMS570LS31x Hercules Development Kit from TI (TMS570LS3137)
On Fri, Aug 15, 2014 at 12:32 PM, Premysl Houdek wrote: > Included variants: > tms570ls3137_hdk_intram - place code and data into internal SRAM > tms570ls3137_hdk_sdram - place code into external SDRAM and data to SRAM > tms570ls3137_hdk - variant prepared for stand-alone RTEMS aplication > stored and running directly from flash. Not working yet. > > Chip initialization code not included in BSP. > External startup generated by TI's HalCoGen was usedfor > testing and debugging. > > More information about TMS570 BSP can be found at > http://www.rtems.org/wiki/index.php/Tms570 > > Patch version 2 > - most of the formatting suggestion applied. > - BSP converted to use clock shell > - console driver "set attributes" tested. Baudrate change working > Todo: > refractor header files (name register fields) > --- > c/src/lib/libbsp/arm/tms570/Makefile.am| 144 + > c/src/lib/libbsp/arm/tms570/README | 67 +++ > c/src/lib/libbsp/arm/tms570/bsp_specs | 13 + > c/src/lib/libbsp/arm/tms570/clock/clock.c | 157 ++ > c/src/lib/libbsp/arm/tms570/configure.ac | 52 ++ > .../lib/libbsp/arm/tms570/console/printk-support.c | 85 +++ > c/src/lib/libbsp/arm/tms570/console/tms570-sci.c | 560 > > c/src/lib/libbsp/arm/tms570/include/bsp.h | 102 > c/src/lib/libbsp/arm/tms570/include/irq.h | 134 + > c/src/lib/libbsp/arm/tms570/include/tms570-pom.h | 101 > c/src/lib/libbsp/arm/tms570/include/tms570-rti.h | 95 > .../libbsp/arm/tms570/include/tms570-sci-driver.h | 40 ++ > c/src/lib/libbsp/arm/tms570/include/tms570-sci.h | 76 +++ > c/src/lib/libbsp/arm/tms570/include/tms570-vim.h | 75 +++ > c/src/lib/libbsp/arm/tms570/include/tms570.h | 28 + > c/src/lib/libbsp/arm/tms570/irq/irq.c | 192 +++ > .../make/custom/tms570ls3137_hdk-testsuite.tcfg| 19 + > .../arm/tms570/make/custom/tms570ls3137_hdk.cfg| 20 + > .../tms570/make/custom/tms570ls3137_hdk_intram.cfg | 21 + > .../tms570/make/custom/tms570ls3137_hdk_sdram.cfg | 20 + > c/src/lib/libbsp/arm/tms570/pom/tms570-pom.c | 100 > c/src/lib/libbsp/arm/tms570/preinstall.am | 123 + > c/src/lib/libbsp/arm/tms570/startup/bspreset.c | 37 ++ > c/src/lib/libbsp/arm/tms570/startup/bspstart.c | 42 ++ > .../lib/libbsp/arm/tms570/startup/bspstarthooks.c | 41 ++ > .../arm/tms570/startup/linkcmds.tms570ls3137_hdk | 27 + > .../startup/linkcmds.tms570ls3137_hdk_intram | 28 + > .../tms570/startup/linkcmds.tms570ls3137_hdk_sdram | 27 + > 28 files changed, 2426 insertions(+) > create mode 100644 c/src/lib/libbsp/arm/tms570/Makefile.am > create mode 100644 c/src/lib/libbsp/arm/tms570/README > create mode 100644 c/src/lib/libbsp/arm/tms570/bsp_specs > create mode 100644 c/src/lib/libbsp/arm/tms570/clock/clock.c > create mode 100644 c/src/lib/libbsp/arm/tms570/configure.ac > create mode 100644 c/src/lib/libbsp/arm/tms570/console/printk-support.c > create mode 100644 c/src/lib/libbsp/arm/tms570/console/tms570-sci.c > create mode 100644 c/src/lib/libbsp/arm/tms570/include/bsp.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/irq.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570-pom.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570-rti.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570-sci-driver.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570-sci.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570-vim.h > create mode 100644 c/src/lib/libbsp/arm/tms570/include/tms570.h > create mode 100644 c/src/lib/libbsp/arm/tms570/irq/irq.c > create mode 100644 > c/src/lib/libbsp/arm/tms570/make/custom/tms570ls3137_hdk-testsuite.tcfg > create mode 100644 > c/src/lib/libbsp/arm/tms570/make/custom/tms570ls3137_hdk.cfg > create mode 100644 > c/src/lib/libbsp/arm/tms570/make/custom/tms570ls3137_hdk_intram.cfg > create mode 100644 > c/src/lib/libbsp/arm/tms570/make/custom/tms570ls3137_hdk_sdram.cfg > create mode 100644 c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.c > create mode 100644 c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.h > create mode 100644 c/src/lib/libbsp/arm/tms570/pom/tms570-pom.c > create mode 100644 c/src/lib/libbsp/arm/tms570/preinstall.am > create mode 100644 c/src/lib/libbsp/arm/tms570/startup/bspreset.c > create mode 100644 c/src/lib/libbsp/arm/tms570/startup/bspstart.c > create mode 100644 c/src/lib/libbsp/arm/tms570/startup/bspstarthooks.c > create mode 100644 > c/src/lib/libbsp/arm/tms570/startup/linkcmds.tms570ls3137_hdk > create mode 100644 > c/src/lib/libbsp/arm/tms570/startup/linkcmds.tms570ls3137_hdk_intram > create mode 100644 > c/src/lib/libbsp/arm/tms570/startup/linkcmds.tms570ls3137_hdk_sdram [...] > diff --git a/c/src/lib/libbsp/arm/tms570/clock/clock.
Re: [PATCH v2] BSP for TMS570LS31x Hercules Development Kit from TI (TMS570LS3137)
On 8/18/2014 8:36 AM, Gedare Bloom wrote: > On Fri, Aug 15, 2014 at 12:32 PM, Premysl Houdek wrote: >> Included variants: >> tms570ls3137_hdk_intram - place code and data into internal SRAM >> tms570ls3137_hdk_sdram - place code into external SDRAM and data to SRAM >> tms570ls3137_hdk - variant prepared for stand-alone RTEMS aplication >> stored and running directly from flash. Not working >> yet. >> >> Chip initialization code not included in BSP. >> External startup generated by TI's HalCoGen was usedfor >> testing and debugging. >> >> More information about TMS570 BSP can be found at >> http://www.rtems.org/wiki/index.php/Tms570 [...] Gedare appears to have caught what I saw. >> diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h >> b/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h >> new file mode 100644 >> index 000..e1bbbcb >> --- /dev/null >> +++ b/c/src/lib/libbsp/arm/tms570/include/tms570-pom.h >> @@ -0,0 +1,101 @@ >> +/** >> + * @file tms570-pom.h >> + * @ingroup tms570 >> + * @brief Parameter Overlay Module (POM) header file >> + */ >> + >> +/* >> + * Copyright (c) 2014 Pavel Pisa >> + * >> + * Czech Technical University in Prague >> + * Zikova 1903/4 >> + * 166 36 Praha 6 >> + * Czech Republic >> + * >> + * The license and distribution terms for this file may be >> + * found in the file LICENSE in this distribution or at >> + * http://www.rtems.org/license/LICENSE. >> + */ >> + >> + >> +#ifndef LIBBSP_ARM_TMS570_POM_H >> +#define LIBBSP_ARM_TMS570_POM_H >> + >> +#include >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif /* __cplusplus */ >> + >> +#define TMS570_POM_REGIONS 32 >> +#define TMS570_POM_GLBCTRL_ENABLE 0x00a0a >> + >> +#define TMS570_POM_REGSIZE_DISABLED 0 >> +#define TMS570_POM_REGSIZE_64B 1 >> +#define TMS570_POM_REGSIZE_128B 2 >> +#define TMS570_POM_REGSIZE_256B 3 >> +#define TMS570_POM_REGSIZE_5120B4 >> +#define TMS570_POM_REGSIZE_1KB 5 >> +#define TMS570_POM_REGSIZE_2KB 6 >> +#define TMS570_POM_REGSIZE_4KB 7 >> +#define TMS570_POM_REGSIZE_8KB 8 >> +#define TMS570_POM_REGSIZE_16KB 9 >> +#define TMS570_POM_REGSIZE_32KB 0xa >> +#define TMS570_POM_REGSIZE_64KB 0xb >> +#define TMS570_POM_REGSIZE_128KB 0xc >> +#define TMS570_POM_REGSIZE_256KB 0xd >> + > These defines would look nicer if you used either decimal or hex. > Why is it 5120B? Are these defines for a field within some register? A comment block above explaining their purpose would be useful. FWIW similar advice applies to most any random group of constants. > +/** > + * @brief Init function of interrupt module > + * > + * Resets vectored interrupt interface to default state. > + * Disables all interrupts. > + * Set all sources as IRQ (not FIR). > + * > + * @retval RTEMS_SUCCESSFUL All is set > + */ > +rtems_status_code bsp_interrupt_facility_initialize(void) > +{ > + void (**vim_vec)(void) = (void (**)(void)) 0xFFF82000; > + unsigned int value = 0x00010203; > + unsigned int i = 0; > + uint32_t sctlr; > + > + /* Disable interrupts */ > + for(i = 0; i < 3; i++) > +TMS570_VIM.REQENACLR[i] = 0x; > + /* Map default events on interrupt vectors */ > + for(i=0;i<24;i+=1,value += 0x04040404) > Add more white space around the parens and operators. Also, I believe > RTEMS prefers to always use { } even if there is only one line > following the conditional/loop statement. Perhaps this is not > explicitly stated though. It isn't but it tends to avoid stupid mistakes. :) I am not even sure it is reliably followed but for for and while loops, it really should. >> +TMS570_VIM.CHANCTRL[i] = value; >> + /* Set all vectors as IRQ (not FIR) */ >> + TMS570_VIM.FIRQPR[0] = 3; >> + TMS570_VIM.FIRQPR[1] = 0; >> + TMS570_VIM.FIRQPR[2] = 0; >> + >> + /*_CPU_ISR_install_vector(ARM_EXCEPTION_IRQ, _ARMV4_Exception_interrupt, >> NULL);*/ >> + for(i = 0; i <= 94; i++) >> +vim_vec[i] = _ARMV4_Exception_interrupt; >> + >> + /* Clear bit VE in SCTLR register to not use VIM IRQ exception bypass*/ >> + asm volatile ("mrc p15, 0, %0, c1, c0, 0\n": "=r" (sctlr)); >> + sctlr &= ~(1 << 24); >> + asm volatile ("mcr p15, 0, %0, c1, c0, 0\n": : "r" (sctlr)); >> + >> + return RTEMS_SUCCESSFUL; >> +} >> + >> + >> + > Remove extra blank lines. > > >> diff --git a/c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.c >> b/c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.c >> new file mode 100644 >> index 000..e69de29 >> diff --git a/c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.h >> b/c/src/lib/libbsp/arm/tms570/network/tms570-ethernet.h >> new file mode 100644 >> index 000..e69de29 > Empty files? > >> diff --git a/c/src/lib/libbsp/arm/tms570/pom/tms570-pom.c >> b/c/src/lib/libbsp/arm/tms570/pom/tms570-pom.c >> new file mode 100644 >> index 000..be2d904 >> --- /dev/null >> +++ b/c/src/lib/libbsp/arm/tms570/pom/tms570-pom.c >> @@ -0,0 +1,100 @@ >> +/** >> + * @file tms570-pom.c >> + * >> + * @in
[PATCH 1/2] Add or1k tick timer register definitions
--- cpukit/score/cpu/or1k/rtems/score/or1k-utility.h | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h b/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h index 74c14d7..6b238b1 100644 --- a/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h +++ b/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h @@ -258,7 +258,21 @@ /*Context ID (Fast Context Switching) */ #define CPU_OR1K_SPR_SR_CID (F << CPU_OR1K_SPR_SR_SHAMT_CID) +/* Tick timer configuration bits */ +#define CPU_OR1K_SPR_TTMR_SHAMT_IP28 +#define CPU_OR1K_SPR_TTMR_SHAMT_IE29 +#define CPU_OR1K_SPR_TTMR_SHAMT_MODE 30 + +#define CPU_OR1K_SPR_TTMR_TP_MASK (0x0FFF) +#define CPU_OR1K_SPR_TTMR_IP(1 << CPU_OR1K_SPR_TTMR_SHAMT_IP) +#define CPU_OR1K_SPR_TTMR_IE(1 << CPU_OR1K_SPR_TTMR_SHAMT_IE) +#define CPU_OR1K_SPR_TTMR_MODE_RESTART (1 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) +#define CPU_OR1K_SPR_TTMR_MODE_ONE_SHOT (2 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) +#define CPU_OR1K_SPR_TTMR_MODE_CONT (3 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) + /* Power management register bits */ + +/* Shift amount macros for bit positions in Power Management register */ #define CPU_OR1K_SPR_PMR_SHAMT_SDF 0 #define CPU_OR1K_SPR_PMR_SHAMT_DME 4 #define CPU_OR1K_SPR_PMR_SHAMT_SME 5 @@ -271,8 +285,6 @@ #define CPU_OR1K_SPR_PMR_DCGE (1 << CPU_OR1K_SPR_PMR_SHAMT_DCGE) #define CPU_OR1K_SPR_PMR_SUME (1 << CPU_OR1K_SPR_PMR_SHAMT_SUME) -/* Shift amount macros for bit positions in Power Management register */ - #ifndef ASM #include -- 1.9.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/2] Add new (first) OpenRISC BSP called or1ksim.
This BSP is intended to run on or1ksim (the main OpenRISC emulator). --- c/src/aclocal/rtems-cpu-subdirs.m4 | 1 + c/src/lib/libbsp/or1k/Makefile.am | 10 + c/src/lib/libbsp/or1k/acinclude.m4 | 10 + c/src/lib/libbsp/or1k/configure.ac | 19 ++ c/src/lib/libbsp/or1k/or1ksim/Makefile.am | 109 +++ c/src/lib/libbsp/or1k/or1ksim/README | 17 ++ c/src/lib/libbsp/or1k/or1ksim/bsp_specs| 12 + c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c | 102 +++ c/src/lib/libbsp/or1k/or1ksim/configure.ac | 31 ++ .../libbsp/or1k/or1ksim/console/console-config.c | 58 c/src/lib/libbsp/or1k/or1ksim/console/uart.c | 144 ++ c/src/lib/libbsp/or1k/or1ksim/include/bsp.h| 46 +++ c/src/lib/libbsp/or1k/or1ksim/include/irq.h| 45 +++ c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h| 121 c/src/lib/libbsp/or1k/or1ksim/include/tm27.h | 8 + c/src/lib/libbsp/or1k/or1ksim/include/uart.h | 42 +++ c/src/lib/libbsp/or1k/or1ksim/irq/irq.c| 42 +++ .../or1k/or1ksim/make/custom/or1k_or1ksim.cfg | 7 + c/src/lib/libbsp/or1k/or1ksim/preinstall.am| 111 +++ c/src/lib/libbsp/or1k/or1ksim/start/start.S| 183 c/src/lib/libbsp/or1k/or1ksim/startup/bspstart.c | 6 + c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds | 320 + c/src/lib/libbsp/or1k/or1ksim/timer/timer.c| 63 c/src/lib/libbsp/or1k/preinstall.am| 7 + .../libbsp/or1k/shared/include/linker-symbols.h| 79 + 25 files changed, 1593 insertions(+) create mode 100644 c/src/lib/libbsp/or1k/Makefile.am create mode 100644 c/src/lib/libbsp/or1k/acinclude.m4 create mode 100644 c/src/lib/libbsp/or1k/configure.ac create mode 100644 c/src/lib/libbsp/or1k/or1ksim/Makefile.am create mode 100644 c/src/lib/libbsp/or1k/or1ksim/README create mode 100644 c/src/lib/libbsp/or1k/or1ksim/bsp_specs create mode 100644 c/src/lib/libbsp/or1k/or1ksim/clock/clockdrv.c create mode 100644 c/src/lib/libbsp/or1k/or1ksim/configure.ac create mode 100644 c/src/lib/libbsp/or1k/or1ksim/console/console-config.c create mode 100644 c/src/lib/libbsp/or1k/or1ksim/console/uart.c create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/bsp.h create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/irq.h create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/or1ksim.h create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/tm27.h create mode 100644 c/src/lib/libbsp/or1k/or1ksim/include/uart.h create mode 100644 c/src/lib/libbsp/or1k/or1ksim/irq/irq.c create mode 100644 c/src/lib/libbsp/or1k/or1ksim/make/custom/or1k_or1ksim.cfg create mode 100644 c/src/lib/libbsp/or1k/or1ksim/preinstall.am create mode 100644 c/src/lib/libbsp/or1k/or1ksim/start/start.S create mode 100644 c/src/lib/libbsp/or1k/or1ksim/startup/bspstart.c create mode 100644 c/src/lib/libbsp/or1k/or1ksim/startup/linkcmds create mode 100644 c/src/lib/libbsp/or1k/or1ksim/timer/timer.c create mode 100644 c/src/lib/libbsp/or1k/preinstall.am create mode 100644 c/src/lib/libbsp/or1k/shared/include/linker-symbols.h diff --git a/c/src/aclocal/rtems-cpu-subdirs.m4 b/c/src/aclocal/rtems-cpu-subdirs.m4 index c5a4a19..9593d34 100644 --- a/c/src/aclocal/rtems-cpu-subdirs.m4 +++ b/c/src/aclocal/rtems-cpu-subdirs.m4 @@ -23,6 +23,7 @@ _RTEMS_CPU_SUBDIR([mips],[$1]);; _RTEMS_CPU_SUBDIR([moxie],[$1]);; _RTEMS_CPU_SUBDIR([nios2],[$1]);; _RTEMS_CPU_SUBDIR([no_cpu],[$1]);; +_RTEMS_CPU_SUBDIR([or1k],[$1]);; _RTEMS_CPU_SUBDIR([powerpc],[$1]);; _RTEMS_CPU_SUBDIR([sh],[$1]);; _RTEMS_CPU_SUBDIR([sparc],[$1]);; diff --git a/c/src/lib/libbsp/or1k/Makefile.am b/c/src/lib/libbsp/or1k/Makefile.am new file mode 100644 index 000..0ce20e6 --- /dev/null +++ b/c/src/lib/libbsp/or1k/Makefile.am @@ -0,0 +1,10 @@ +ACLOCAL_AMFLAGS = -I ../../../aclocal + +## Descend into the @RTEMS_BSP_FAMILY@ directory +## Currently, the shared directory is not explicitly +## added but it is present in the source tree. +SUBDIRS = @RTEMS_BSP_FAMILY@ + +include $(srcdir)/preinstall.am +include $(top_srcdir)/../../../automake/subdirs.am +include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/lib/libbsp/or1k/acinclude.m4 b/c/src/lib/libbsp/or1k/acinclude.m4 new file mode 100644 index 000..c593670 --- /dev/null +++ b/c/src/lib/libbsp/or1k/acinclude.m4 @@ -0,0 +1,10 @@ +# RTEMS_CHECK_BSPDIR(RTEMS_BSP_FAMILY) +AC_DEFUN([RTEMS_CHECK_BSPDIR], +[ + case "$1" in + or1ksim ) +AC_CONFIG_SUBDIRS([or1ksim]);; + *) +AC_MSG_ERROR([Invalid BSP]);; + esac +]) diff --git a/c/src/lib/libbsp/or1k/configure.ac b/c/src/lib/libbsp/or1k/configure.ac new file mode 100644 index 000..96bba16 --- /dev/null +++ b/c/src/lib/libbsp/or1k/configure.ac @@ -0,0 +1,19 @@ +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.69]) +AC_INIT([rtems-c-src-lib-lib
Re: [PATCH 1/2] Add or1k tick timer register definitions
I committed this. I didn't see anything and if I missed something, they can just be fixed on top of it. --joel On 8/18/2014 4:06 PM, Hesham ALMatary wrote: > --- > cpukit/score/cpu/or1k/rtems/score/or1k-utility.h | 16 ++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h > b/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h > index 74c14d7..6b238b1 100644 > --- a/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h > +++ b/cpukit/score/cpu/or1k/rtems/score/or1k-utility.h > @@ -258,7 +258,21 @@ > /*Context ID (Fast Context Switching) */ > #define CPU_OR1K_SPR_SR_CID (F << CPU_OR1K_SPR_SR_SHAMT_CID) > > +/* Tick timer configuration bits */ > +#define CPU_OR1K_SPR_TTMR_SHAMT_IP28 > +#define CPU_OR1K_SPR_TTMR_SHAMT_IE29 > +#define CPU_OR1K_SPR_TTMR_SHAMT_MODE 30 > + > +#define CPU_OR1K_SPR_TTMR_TP_MASK (0x0FFF) > +#define CPU_OR1K_SPR_TTMR_IP(1 << CPU_OR1K_SPR_TTMR_SHAMT_IP) > +#define CPU_OR1K_SPR_TTMR_IE(1 << CPU_OR1K_SPR_TTMR_SHAMT_IE) > +#define CPU_OR1K_SPR_TTMR_MODE_RESTART (1 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) > +#define CPU_OR1K_SPR_TTMR_MODE_ONE_SHOT (2 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) > +#define CPU_OR1K_SPR_TTMR_MODE_CONT (3 << CPU_OR1K_SPR_TTMR_SHAMT_MODE) > + > /* Power management register bits */ > + > +/* Shift amount macros for bit positions in Power Management register */ > #define CPU_OR1K_SPR_PMR_SHAMT_SDF 0 > #define CPU_OR1K_SPR_PMR_SHAMT_DME 4 > #define CPU_OR1K_SPR_PMR_SHAMT_SME 5 > @@ -271,8 +285,6 @@ > #define CPU_OR1K_SPR_PMR_DCGE (1 << CPU_OR1K_SPR_PMR_SHAMT_DCGE) > #define CPU_OR1K_SPR_PMR_SUME (1 << CPU_OR1K_SPR_PMR_SHAMT_SUME) > > -/* Shift amount macros for bit positions in Power Management register */ > - > #ifndef ASM > > #include -- Joel Sherrill, Ph.D. Director of Research & Development joel.sherr...@oarcorp.comOn-Line Applications Research Ask me about RTEMS: a free RTOS Huntsville AL 35805 Support Available(256) 722-9985 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] rtems_termios_puts: Copy and write more than one char at once
I committed this. Thanks. If there is something I missed, please let me know. --joel On 8/14/2014 10:02 AM, Kolja Waschk wrote: > Renamed startXmit(), nToSend is unsigned, just check FL_ORCVXOF, no (void) > cast anymore, compute nToSend in single if/else if/else. > > > --- > cpukit/libcsupport/src/termios.c | 135 > --- > 1 file changed, 85 insertions(+), 50 deletions(-) > > diff --git a/cpukit/libcsupport/src/termios.c > b/cpukit/libcsupport/src/termios.c > index 2448ea1..216834c 100644 > --- a/cpukit/libcsupport/src/termios.c > +++ b/cpukit/libcsupport/src/termios.c > @@ -974,6 +974,49 @@ rtems_termios_ioctl (void *arg) > } > > /* > + * Send as many chars at once as possible to device-specific code. > + * If transmitting==true then assume transmission is already running and > + * an explicit write(0) is needed if output has to stop for flow control. > + */ > +static unsigned int > +startXmit ( > + struct rtems_termios_tty *tty, > + unsigned int newTail, > + bool transmitting > +) > +{ > + unsigned int nToSend; > + > + tty->rawOutBufState = rob_busy; > + > + /* if XOFF was received, do not (re)start output */ > + if (tty->flow_ctrl & FL_ORCVXOF) { > +/* set flag, that output has been stopped */ > +tty->flow_ctrl |= FL_OSTOP; > +nToSend = 0; > +/* stop transmitter */ > +if (transmitting) { > + (*tty->handler.write) (tty, NULL, 0); > +} > + } else { > +/* when flow control XON or XOF, don't send blocks of data */ > +/* to allow fast reaction on incoming flow ctrl and low latency*/ > +/* for outgoing flow control */ > +if (tty->flow_ctrl & (FL_MDXON | FL_MDXOF)) > + nToSend = 1; > +else if (newTail > tty->rawOutBuf.Head) > + nToSend = tty->rawOutBuf.Size - newTail; > +else > + nToSend = tty->rawOutBuf.Head - newTail; > + > +(*tty->handler.write)( > +tty, &tty->rawOutBuf.theBuf[newTail], nToSend); > + } > + > + return nToSend; > +} > + > +/* > * Send characters to device-specific code > */ > void > @@ -989,21 +1032,16 @@ rtems_termios_puts ( > (*tty->handler.write)(tty, buf, len); > return; >} > - newHead = tty->rawOutBuf.Head; > + >while (len) { > -/* > - * Performance improvement could be made here. > - * Copy multiple bytes to raw buffer: > - * if (len > 1) && (space to buffer end, or tail > 1) > - * ncopy = MIN (len, space to buffer end or tail) > - * memcpy (raw buffer, buf, ncopy) > - * buf += ncopy > - * len -= ncopy > - * > - * To minimize latency, the memcpy should be done > - * with interrupts enabled. > - */ > -newHead = (newHead + 1) % tty->rawOutBuf.Size; > +size_t nToCopy; > +size_t nAvail; > + > +/* Check space for at least one char */ > +newHead = tty->rawOutBuf.Head + 1; > +if (newHead >= tty->rawOutBuf.Size) > + newHead -= tty->rawOutBuf.Size; > + > rtems_termios_interrupt_lock_acquire (tty, &lock_context); > while (newHead == tty->rawOutBuf.Tail) { >tty->rawOutBufState = rob_wait; > @@ -1014,21 +1052,41 @@ rtems_termios_puts ( > rtems_fatal_error_occurred (sc); >rtems_termios_interrupt_lock_acquire (tty, &lock_context); > } > -tty->rawOutBuf.theBuf[tty->rawOutBuf.Head] = *buf++; > + > +/* Determine free space up to current tail or end of ring buffer */ > +nToCopy = len; > +if (tty->rawOutBuf.Tail > tty->rawOutBuf.Head) { > + /* Available space is contiguous from Head to Tail */ > + nAvail = tty->rawOutBuf.Tail - tty->rawOutBuf.Head - 1; > +} else { > + /* Available space wraps at buffer end. To keep it simple, utilize > + only the free space from Head to end during this iteration */ > + nAvail = tty->rawOutBuf.Size - tty->rawOutBuf.Head; > + /* Head may not touch Tail after wraparound */ > + if (tty->rawOutBuf.Tail == 0) > +nAvail--; > +} > +if (nToCopy > nAvail) > + nToCopy = nAvail; > + > +/* To minimize latency, the memcpy could be done > + * with interrupts enabled or with limit on nToCopy (TBD) > + */ > +memcpy(&tty->rawOutBuf.theBuf[tty->rawOutBuf.Head], buf, nToCopy); > + > +newHead = tty->rawOutBuf.Head + nToCopy; > +if (newHead >= tty->rawOutBuf.Size) > + newHead -= tty->rawOutBuf.Size; > tty->rawOutBuf.Head = newHead; > + > if (tty->rawOutBufState == rob_idle) { > - /* check, whether XOFF has been received */ > - if (!(tty->flow_ctrl & FL_ORCVXOF)) { > -(*tty->handler.write)( > - tty, &tty->rawOutBuf.theBuf[tty->rawOutBuf.Tail],1); > - } else { > -/* remember that output has been stopped due to flow ctrl*/ > -tty->flow_ctrl |= FL_OSTOP; > - } > - tty->rawOutBufState = rob_busy; > + startXmit (tty, tty->rawOutBuf.Tail, false); > } > + > rtems_termios_interrupt_lock_release (tty,