diff options
375 files changed, 5990 insertions, 3051 deletions
diff --git a/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb337 b/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb337 index 62db0dfec3..727e49c437 100644 --- a/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb337 +++ b/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb337 @@ -1,6 +1,6 @@ MEMORY { - SDRAM_MMU : ORIGIN = 0x20100000, LENGTH = 16k - SDRAM : ORIGIN = 0x20104000, LENGTH = 15M - 16k + SDRAM : ORIGIN = 0x20100000, LENGTH = 15M - 16k + SDRAM_MMU : ORIGIN = 0x20ffc000, LENGTH = 16k SRAM : ORIGIN = 0x00200000, LENGTH = 16k } diff --git a/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb637 b/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb637 index c86a0ad1a8..32c199e94a 100644 --- a/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb637 +++ b/c/src/lib/libbsp/arm/csb337/startup/linkcmds.csb637 @@ -1,6 +1,6 @@ MEMORY { - SDRAM_MMU : ORIGIN = 0x20100000, LENGTH = 16k - SDRAM : ORIGIN = 0x20104000, LENGTH = 63M - 16k + SDRAM : ORIGIN = 0x20100000, LENGTH = 63M - 16k + SDRAM_MMU : ORIGIN = 0x23ffc000, LENGTH = 16k SRAM : ORIGIN = 0x00200000, LENGTH = 16k } diff --git a/c/src/lib/libbsp/arm/gdbarmsim/start/start.S b/c/src/lib/libbsp/arm/gdbarmsim/start/start.S index 0c5df483d6..5a5613ad0a 100644 --- a/c/src/lib/libbsp/arm/gdbarmsim/start/start.S +++ b/c/src/lib/libbsp/arm/gdbarmsim/start/start.S @@ -311,8 +311,6 @@ __change_mode: mov r0, #0 bl FUNCTION (boot_card) - bl FUNCTION (bsp_cleanup) /* Should not return. */ - #if defined(__thumb__) && !defined(__thumb2__) /* Come out of Thumb mode. This code should be redundant. */ diff --git a/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c b/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c index 6dcda18aad..b7136420b0 100644 --- a/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c +++ b/c/src/lib/libbsp/lm32/milkymist/startup/bspclean.c @@ -56,8 +56,3 @@ void bsp_fatal_extension( else reboot(); } - -void bsp_cleanup(uint32_t status) -{ - rtems_fatal(RTEMS_FATAL_SOURCE_EXIT, status); -} diff --git a/c/src/lib/libbsp/m68k/mcf52235/startup/init52235.c b/c/src/lib/libbsp/m68k/mcf52235/startup/init52235.c index 77a07edc79..0d76e41d46 100644 --- a/c/src/lib/libbsp/m68k/mcf52235/startup/init52235.c +++ b/c/src/lib/libbsp/m68k/mcf52235/startup/init52235.c @@ -4,17 +4,15 @@ * functions can be called from here. */ -#include <stdint.h> +#include <bsp/bootcard.h> extern void _wr_vbr(uint32_t); extern void init_main(void); -extern int boot_card(const char *); /* * From linkcmds */ -extern uint8_t _VBR[]; extern uint8_t _INTERRUPT_VECTOR[]; extern uint8_t _clear_start[]; @@ -39,15 +37,15 @@ void Init52235(void) * Copy the vector table to RAM */ - if (_VBR != _INTERRUPT_VECTOR) { + if (&_VBR != _INTERRUPT_VECTOR) { sp = (uint32_t *) _INTERRUPT_VECTOR; - dp = (uint32_t *) _VBR; + dp = (uint32_t *) &_VBR; for (i = 0; i < 256; i++) { *dp++ = *sp++; } } - _wr_vbr((uint32_t) _VBR); + _wr_vbr((uint32_t) &_VBR); /* * Move initialized data from ROM to RAM. diff --git a/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c b/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c index e8c70c326f..15dd2443dd 100644 --- a/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mcf5225x/startup/bspclean.c @@ -1,6 +1,4 @@ /* - * SBC5206 bsp_cleanup - * * This routine returns control from RTEMS to the monitor. * * Author: @@ -27,10 +25,3 @@ void bsp_fatal_extension( { printk("\nRTEMS exited!\n"); } - -void __attribute__((weak)) bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/m68k/mcf5225x/startup/init5225x.c b/c/src/lib/libbsp/m68k/mcf5225x/startup/init5225x.c index bff1446894..bc27210545 100644 --- a/c/src/lib/libbsp/m68k/mcf5225x/startup/init5225x.c +++ b/c/src/lib/libbsp/m68k/mcf5225x/startup/init5225x.c @@ -8,10 +8,9 @@ * functions can be called from here. */ -#include <stdint.h> +#include <bsp/bootcard.h> extern void _wr_vbr(uint32_t); -extern int boot_card(int, char **, char **); extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount; @@ -19,7 +18,6 @@ extern long _d0_reset,_d1_reset,_M68kSpuriousInterruptCount; * From linkcmds */ -extern uint8_t _VBR[]; extern uint8_t _INTERRUPT_VECTOR[]; extern uint8_t _clear_start[]; @@ -39,9 +37,9 @@ void Init5225x(void) * Copy the vector table to RAM */ - if (_VBR != _INTERRUPT_VECTOR) { + if (&_VBR != _INTERRUPT_VECTOR) { sp = (uint32_t *) _INTERRUPT_VECTOR; - dp = (uint32_t *) _VBR; + dp = (uint32_t *) &_VBR; for (i = 0; i < 256; i++) { *dp++ = *sp++; } @@ -73,13 +71,13 @@ void Init5225x(void) *sbp++ = 0; } -//_wr_vbr((uint32_t) _VBR); - asm volatile("move.l %0,%%d7;movec %%d7,%%vbr\n\t"::"i"(_VBR): "cc"); +//_wr_vbr((uint32_t) &_VBR); + asm volatile("move.l %0,%%d7;movec %%d7,%%vbr\n\t"::"i"(&_VBR): "cc"); /* * We have to call some kind of RTEMS function here! */ - boot_card(0, 0, 0); + boot_card(0); for (;;) ; } diff --git a/c/src/lib/libbsp/m68k/mcf5329/startup/init5329.c b/c/src/lib/libbsp/m68k/mcf5329/startup/init5329.c index 718b433ecf..f85bd511a4 100644 --- a/c/src/lib/libbsp/m68k/mcf5329/startup/init5329.c +++ b/c/src/lib/libbsp/m68k/mcf5329/startup/init5329.c @@ -4,17 +4,15 @@ * functions can be called from here. */ -#include <stdint.h> +#include <bsp/bootcard.h> extern void _wr_vbr(uint32_t); extern void init_main(void); -extern int boot_card(const char *); /* * From linkcmds */ -extern uint8_t _VBR[]; extern uint8_t _INTERRUPT_VECTOR[]; extern uint8_t _clear_start[]; @@ -39,15 +37,15 @@ void Init5329(void) * Copy the vector table to RAM */ - if (_VBR != _INTERRUPT_VECTOR) { + if (&_VBR != _INTERRUPT_VECTOR) { sp = (uint32_t *) _INTERRUPT_VECTOR; - dp = (uint32_t *) _VBR; + dp = (uint32_t *) &_VBR; for (i = 0; i < 256; i++) { *dp++ = *sp++; } } - _wr_vbr((uint32_t) _VBR); + _wr_vbr((uint32_t) &_VBR); /* * Move initialized data from ROM to RAM. diff --git a/c/src/lib/libbsp/m68k/mrm332/Makefile.am b/c/src/lib/libbsp/m68k/mrm332/Makefile.am index 7bec18d655..29b9b4aecc 100644 --- a/c/src/lib/libbsp/m68k/mrm332/Makefile.am +++ b/c/src/lib/libbsp/m68k/mrm332/Makefile.am @@ -31,6 +31,7 @@ libbsp_a_SOURCES = libbsp_a_SOURCES += startup/start_c.c ../../shared/bsplibc.c \ ../../shared/bsppost.c ../../shared/bspstart.c startup/bsppredriverhook.c \ ../../shared/bootcard.c ../../shared/sbrk.c \ + ../../shared/bspclean.c \ ../../shared/setvec.c ../../shared/bsppretaskinghook.c \ ../../shared/bspgetworkarea.c ../../shared/gnatinstallhandler.c \ startup/except_vect_332_ROM.S diff --git a/c/src/lib/libbsp/m68k/mrm332/misc/interr.c b/c/src/lib/libbsp/m68k/mrm332/misc/interr.c index 356a247bc1..d96f909fba 100644 --- a/c/src/lib/libbsp/m68k/mrm332/misc/interr.c +++ b/c/src/lib/libbsp/m68k/mrm332/misc/interr.c @@ -48,8 +48,3 @@ void bsp_fatal_extension( outbyte( (char)(the_error & 0xff) ); RAW_PUTS(").\r\n"); } - -void bsp_cleanup( uint32_t status ) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c index d5ebfba001..c9c94fe552 100644 --- a/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c +++ b/c/src/lib/libbsp/m68k/mrm332/spurious/spinit.c @@ -72,12 +72,10 @@ rtems_isr Spurious_Isr( RAW_PUTI(sp); RAW_PUTS("\n\r"); #endif - bsp_cleanup(1); - - /* BDM SIGEMT */ - __asm__ (" .word 0x4afa"); - - for(;;); + rtems_fatal( + RTEMS_FATAL_SOURCE_BSP_GENERIC, + BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT + ); } void Spurious_Initialize(void) diff --git a/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c b/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c index 819b3abb8b..c4deda3b8f 100644 --- a/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c +++ b/c/src/lib/libbsp/m68k/mrm332/startup/start_c.c @@ -18,12 +18,11 @@ #include <rtems/m68k/sim.h> #define __START_C__ #include "bsp.h" +#include <bsp/bootcard.h> rtems_isr_entry M68Kvec[256]; rtems_isr_entry vectors[256]; -void boot_card(const char *cmdline); - /* * This prototype really should have the noreturn attribute but * that causes a warning. Not sure how to fix that. diff --git a/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c index 50feb5a52c..fa9fb554ef 100644 --- a/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mvme136/startup/bspclean.c @@ -44,10 +44,3 @@ void bsp_fatal_extension( M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */ __asm__ volatile( "trap #13" ); /* insures SUPV mode */ } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c index 405d9262fd..e566c1d5b1 100644 --- a/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mvme147/startup/bspclean.c @@ -43,10 +43,3 @@ void bsp_fatal_extension( M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */ __asm__ volatile( "trap #13" ); /* ensures SUPV mode */ } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c index 3b275d98cd..ca5973923b 100644 --- a/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mvme162/startup/bspclean.c @@ -55,10 +55,3 @@ void bsp_fatal_extension( M68Kvec[ 45 ] = bsp_return_to_monitor_trap; /* install handler */ __asm__ volatile( "trap #13" ); /* insures SUPV mode */ } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c b/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c index 68e127ff2c..820ffe89ed 100644 --- a/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/mvme167/startup/bspclean.c @@ -49,19 +49,7 @@ static void bsp_return_to_monitor_trap( void ) __asm__ volatile( "jmp %0@" : "=a" (start_addr) : "0" (start_addr) ); } -void bsp_fatal_extension( - rtems_fatal_source source, - bool is_internal, - rtems_fatal_code error -) -{ - M68Kvec[ 45 ] = bsp_return_to_monitor_trap; - __asm__ volatile( "trap #13" ); -} - /* - * bsp_cleanup - * * This code was copied from other MC680x0 MVME BSPs. * Our guess is that someone was concerned about the CPU no longer being in * supervisor mode when they got here. This function forces the CPU back to @@ -73,18 +61,13 @@ void bsp_fatal_extension( * problems if 167Bug is invoked before we get to switch the VBR back to * 167Bug because trap 13 is documented as being reserved for the internal * use of the debugger. - * - * Prototyped in rtems/c/src/lib/libbsp/m68k/mvme167/include/bsp.h - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: DOES NOT RETURN */ -void bsp_cleanup( - uint32_t status +void bsp_fatal_extension( + rtems_fatal_source source, + bool is_internal, + rtems_fatal_code error ) { - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); + M68Kvec[ 45 ] = bsp_return_to_monitor_trap; + __asm__ volatile( "trap #13" ); } diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c b/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c index 8e1ff670f6..2d537facc2 100644 --- a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c +++ b/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c @@ -31,6 +31,7 @@ /*****************************************************************************/ #include <bsp.h> +#include <bsp/bootcard.h> #include <rtems/m68k/m68302.h> #include <debugport.h> #include <crc.h> @@ -117,7 +118,6 @@ void boot_phase_2(void) static constructors have not been called, and RTEMS is not initialised. */ -void boot_card(const char* cmdline); void set_debug_traps(void); void breakpoint(void); diff --git a/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c b/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c index dc17af738c..37aac9e1a4 100644 --- a/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c +++ b/c/src/lib/libbsp/m68k/uC5282/startup/bspclean.c @@ -1,6 +1,4 @@ /* - * SBC5206 bsp_cleanup - * * This routine returns control from RTEMS to the monitor. * * Author: W. Eric Norum <norume@aps.anl.gov> @@ -24,10 +22,3 @@ void bsp_fatal_extension( { bsp_reset(); } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c b/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c index 1539e44cf5..f4369b588c 100644 --- a/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c +++ b/c/src/lib/libbsp/powerpc/beatnik/startup/bspclean.c @@ -17,10 +17,3 @@ void bsp_fatal_extension( ); bsp_reset(); } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/powerpc/gen83xx/configure.ac b/c/src/lib/libbsp/powerpc/gen83xx/configure.ac index a187637d94..0b2435785f 100644 --- a/c/src/lib/libbsp/powerpc/gen83xx/configure.ac +++ b/c/src/lib/libbsp/powerpc/gen83xx/configure.ac @@ -63,6 +63,9 @@ RTEMS_BSPOPTS_SET([HAS_UBOOT],[mpc8309som],[1]) RTEMS_BSPOPTS_SET([HAS_UBOOT],[mpc8313erdb],[1]) RTEMS_BSPOPTS_HELP([HAS_UBOOT],[if defined, enables U-Boot support]) +# Disable interrupt nesting for the MPC8313ERDB since the interrupt server +# support requires that. The interrupt server is necessary for the USB stack. +RTEMS_BSPOPTS_SET([GEN83XX_ENABLE_INTERRUPT_NESTING],[mpc8313erdb],[]) RTEMS_BSPOPTS_SET([GEN83XX_ENABLE_INTERRUPT_NESTING],[*],[1]) RTEMS_BSPOPTS_HELP([GEN83XX_ENABLE_INTERRUPT_NESTING],[enable interrupt nesting]) diff --git a/c/src/lib/libbsp/powerpc/gen83xx/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/gen83xx/startup/linkcmds.base index 9def5f0e88..56f14fb080 100644 --- a/c/src/lib/libbsp/powerpc/gen83xx/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/gen83xx/startup/linkcmds.base @@ -225,6 +225,12 @@ SECTIONS { KEEP (*(.gnu.linkonce.d.*personality*)) SORT(CONSTRUCTORS) + . = ALIGN (4); + + _bsd__start_set_sysinit_set = .; + *(_bsd_set_sysinit_set); + _bsd__stop_set_sysinit_set = .; + . = ALIGN (bsp_section_align); } > RAM diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am index 44e1997df4..01977fc67f 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/Makefile.am @@ -30,8 +30,14 @@ dist_project_lib_DATA += startup/linkcmds.mpc5643l_dpu dist_project_lib_DATA += startup/linkcmds.mpc5674fevb dist_project_lib_DATA += startup/linkcmds.mpc5674fevb_spe dist_project_lib_DATA += startup/linkcmds.phycore_mpc5554 +dist_project_lib_DATA += startup/linkcmds.mpc5674f_ecu508 dist_project_lib_DATA += startup/linkcmds.mpc5674f_ecu508_boot dist_project_lib_DATA += startup/linkcmds.mpc5674f_ecu508_app +dist_project_lib_DATA += startup/linkcmds.mpc5674f_rsm6 +dist_project_lib_DATA += startup/linkcmds.mpc5674f_rsm6_koma_boot +dist_project_lib_DATA += startup/linkcmds.mpc5674f_rsm6_koma_app +dist_project_lib_DATA += startup/linkcmds.mpc5674f_rsm6_moma_boot +dist_project_lib_DATA += startup/linkcmds.mpc5674f_rsm6_moma_app noinst_LIBRARIES += libbsp.a libbsp_a_SOURCES = @@ -52,7 +58,6 @@ include_bsp_HEADERS += ../shared/include/linker-symbols.h include_bsp_HEADERS += ../shared/include/start.h include_bsp_HEADERS += ../shared/include/tictac.h include_bsp_HEADERS += include/mpc55xx-config.h -include_bsp_HEADERS += include/mpc55xxevb.h include_bsp_HEADERS += include/smsc9218i.h include_bsp_HEADERS += include/console-esci.h include_bsp_HEADERS += include/console-generic.h @@ -69,6 +74,7 @@ libbsp_a_SOURCES += ../../shared/src/stackalloc.c libbsp_a_SOURCES += ../shared/src/bsp-start-zero.S libbsp_a_SOURCES += ../shared/src/memcpy.c libbsp_a_SOURCES += ../shared/src/tictac.c +libbsp_a_SOURCES += ../shared/src/ppc-exc-handler-table.c libbsp_a_SOURCES += startup/bspstart.c libbsp_a_SOURCES += startup/bspworkareainit.c libbsp_a_SOURCES += startup/exc-vector-base.S @@ -77,6 +83,7 @@ libbsp_a_SOURCES += startup/reset.c libbsp_a_SOURCES += startup/restart.c libbsp_a_SOURCES += startup/idle-thread.c libbsp_a_SOURCES += startup/start-config-clock.c +libbsp_a_SOURCES += startup/start-config-ebi.c libbsp_a_SOURCES += startup/start-config-ebi-cs.c libbsp_a_SOURCES += startup/start-config-ebi-cs-cal.c libbsp_a_SOURCES += startup/start-config-mmu.c diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac b/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac index 7cb99ff994..e691b364d8 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/configure.ac @@ -32,6 +32,14 @@ RTEMS_BSPOPTS_SET_INSTRUCTION_CACHE_ENABLED([gwlcfm],[]) RTEMS_BSPOPTS_SET_INSTRUCTION_CACHE_ENABLED([*],[1]) RTEMS_BSPOPTS_HELP_INSTRUCTION_CACHE_ENABLED +RTEMS_BSPOPTS_SET([PPC_EXC_CONFIG_USE_FIXED_HANDLER],[*],[1]) +RTEMS_BSPOPTS_HELP([PPC_EXC_CONFIG_USE_FIXED_HANDLER], +[use fixed high-level exception handler]) + +RTEMS_BSPOPTS_SET([PPC_EXC_CONFIG_BOOKE_ONLY],[*],[1]) +RTEMS_BSPOPTS_HELP([PPC_EXC_CONFIG_BOOKE_ONLY], +[only support Book E exception types]) + RTEMS_BSPOPTS_SET([BSP_INTERRUPT_HANDLER_TABLE_SIZE],[mpc5643l*],[127]) RTEMS_BSPOPTS_SET([BSP_INTERRUPT_HANDLER_TABLE_SIZE],[mpc5566*],[127]) RTEMS_BSPOPTS_SET([BSP_INTERRUPT_HANDLER_TABLE_SIZE],[mpc5674f*],[255]) @@ -78,6 +86,11 @@ RTEMS_BSPOPTS_SET([MPC55XX_FMPLL_MFD],[*] ,[12]) RTEMS_BSPOPTS_HELP([MPC55XX_FMPLL_MFD], [Must be defined to be the PLL multiplication factor for clock generation]) +RTEMS_BSPOPTS_SET([MPC55XX_FMPLL_ESYNCR1_CLKCFG],[mpc5674f_rsm6*],[6]) +RTEMS_BSPOPTS_SET([MPC55XX_FMPLL_ESYNCR1_CLKCFG],[*],[7]) +RTEMS_BSPOPTS_HELP([MPC55XX_FMPLL_ESYNCR1_CLKCFG], +[the FMPLL ESYNCR1[CLKCFG] value]) + RTEMS_BSPOPTS_SET([MPC55XX_SYSTEM_CLOCK_DIVIDER],[mpc5674f*],[2]) RTEMS_BSPOPTS_SET([MPC55XX_SYSTEM_CLOCK_DIVIDER],[*],[1]) RTEMS_BSPOPTS_HELP([MPC55XX_SYSTEM_CLOCK_DIVIDER], @@ -168,9 +181,18 @@ RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_MPC5566EVB],[if defined, use custom settings f RTEMS_BSPOPTS_SET([MPC55XX_BOARD_GWLCFM],[gwlcfm],[1]) RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_GWLCFM],[if defined, use custom settings for GWLCFM board]) -RTEMS_BSPOPTS_SET([MPC55XX_BOARD_MPC5674F_ECU508],[mpc5674f_ecu508_boot],[1]) +RTEMS_BSPOPTS_SET([MPC55XX_BOARD_MPC5674F_ECU508],[mpc5674f_ecu508*],[1]) RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_MPC5674F_ECU508],[if defined, use custom settings for ECU508 board]) +RTEMS_BSPOPTS_SET([MPC55XX_BOARD_MPC5674F_RSM6],[mpc5674f_rsm6*],[1]) +RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_MPC5674F_RSM6],[if defined, use custom settings for RSM6 board]) + +RTEMS_BSPOPTS_SET([MPC55XX_BOARD_MPC5674F_RSM6_KOMA],[mpc5674f_rsm6_koma*],[1]) +RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_MPC5674F_RSM6_KOMA],[if defined, use custom settings for RSM6 board KoMa controller]) + +RTEMS_BSPOPTS_SET([MPC55XX_BOARD_MPC5674F_RSM6_MOMA],[mpc5674f_rsm6_moma*],[1]) +RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_MPC5674F_RSM6_MOMA],[if defined, use custom settings for RSM6 board MoMa controller]) + RTEMS_BSPOPTS_SET([MPC55XX_BOARD_PHYCORE_MPC5554],[phycore_mpc5554],[1]) RTEMS_BSPOPTS_HELP([MPC55XX_BOARD_PHYCORE_MPC5554],[if defined, use custom settings for phyCORE MPC5554 board]) @@ -179,7 +201,7 @@ RTEMS_BSPOPTS_HELP([RTEMS_BSP_I2C_EEPROM_DEVICE_NAME],[EEPROM name for LibI2C]) RTEMS_BSPOPTS_SET([RTEMS_BSP_I2C_EEPROM_DEVICE_PATH],[gwlcfm],['"/dev/i2c1.eeprom"']) RTEMS_BSPOPTS_HELP([RTEMS_BSP_I2C_EEPROM_DEVICE_PATH],[EEPROM device file path]) -RTEMS_BSPOPTS_SET([MPC55XX_NEEDS_LOW_LEVEL_INIT],[mpc5674f_ecu508_app],[]) +RTEMS_BSPOPTS_SET([MPC55XX_NEEDS_LOW_LEVEL_INIT],[mpc5674f_*app],[]) RTEMS_BSPOPTS_SET([MPC55XX_NEEDS_LOW_LEVEL_INIT],[*],[1]) RTEMS_BSPOPTS_HELP([MPC55XX_NEEDS_LOW_LEVEL_INIT],[if defined, do low level initialization]) diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h index 251404fcde..4595d3d42c 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/bsp.h @@ -37,6 +37,8 @@ #include <rtems/console.h> #include <rtems/clockdrv.h> +#include <libcpu/powerpc-utility.h> + #include <bsp/tictac.h> #include <bsp/default-initial-extension.h> @@ -77,6 +79,26 @@ void *bsp_idle_thread(uintptr_t arg); #define BSP_IDLE_TASK_BODY bsp_idle_thread +LINKER_SYMBOL(bsp_section_dsram_begin) +LINKER_SYMBOL(bsp_section_dsram_end) +LINKER_SYMBOL(bsp_section_dsram_size) +LINKER_SYMBOL(bsp_section_dsram_load_begin) +LINKER_SYMBOL(bsp_section_dsram_load_end) + +#define BSP_DSRAM_SECTION __attribute__((section(".bsp_dsram"))) + +LINKER_SYMBOL(bsp_section_sysram_begin) +LINKER_SYMBOL(bsp_section_sysram_end) +LINKER_SYMBOL(bsp_section_sysram_size) +LINKER_SYMBOL(bsp_section_sysram_load_begin) +LINKER_SYMBOL(bsp_section_sysram_load_end) + +#define BSP_SYSRAM_SECTION __attribute__((section(".bsp_sysram"))) + +typedef enum { + MPC55XX_FATAL_FMPLL_LOCK +} mpc55xx_fatal_code; + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h index a564861457..9db918a118 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xx-config.h @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -43,17 +43,23 @@ typedef struct { union SIU_PCR_tag pcr; } mpc55xx_siu_pcr_config; -extern const mpc55xx_siu_pcr_config mpc55xx_start_config_siu_pcr []; +extern BSP_START_DATA_SECTION const mpc55xx_siu_pcr_config + mpc55xx_start_config_siu_pcr []; -extern const size_t mpc55xx_start_config_siu_pcr_count []; +extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_siu_pcr_count []; -extern const struct MMU_tag mpc55xx_start_config_mmu_early []; +extern BSP_START_DATA_SECTION const struct + MMU_tag mpc55xx_start_config_mmu_early []; -extern const size_t mpc55xx_start_config_mmu_early_count []; +extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_mmu_early_count []; -extern const struct MMU_tag mpc55xx_start_config_mmu []; +extern BSP_START_DATA_SECTION const struct + MMU_tag mpc55xx_start_config_mmu []; -extern const size_t mpc55xx_start_config_mmu_count []; +extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_mmu_count []; #ifdef MPC55XX_HAS_FMPLL typedef struct { @@ -83,16 +89,32 @@ extern const size_t mpc55xx_start_config_mmu_count []; } mpc55xx_clock_config; #endif -extern const mpc55xx_clock_config mpc55xx_start_config_clock []; +extern BSP_START_DATA_SECTION const mpc55xx_clock_config + mpc55xx_start_config_clock []; #ifdef MPC55XX_HAS_EBI - extern const struct EBI_CS_tag mpc55xx_start_config_ebi_cs []; + typedef struct { + union EBI_MCR_tag ebi_mcr; + uint32_t siu_eccr_ebdf; + } mpc55xx_ebi_config; + + extern BSP_START_DATA_SECTION const mpc55xx_ebi_config + mpc55xx_start_config_ebi []; + + extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_ebi_count []; + + extern BSP_START_DATA_SECTION const struct EBI_CS_tag + mpc55xx_start_config_ebi_cs []; - extern const size_t mpc55xx_start_config_ebi_cs_count []; + extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_ebi_cs_count []; - extern const struct EBI_CAL_CS_tag mpc55xx_start_config_ebi_cal_cs []; + extern BSP_START_DATA_SECTION const struct EBI_CAL_CS_tag + mpc55xx_start_config_ebi_cal_cs []; - extern const size_t mpc55xx_start_config_ebi_cal_cs_count []; + extern BSP_START_DATA_SECTION const size_t + mpc55xx_start_config_ebi_cal_cs_count []; #endif void mpc55xx_start_early(void); diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xxevb.h b/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xxevb.h deleted file mode 100644 index 22a8b5cfa5..0000000000 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/include/mpc55xxevb.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * @file - * - * @ingroup mpc55xx - * - * @brief Empty file. - */ - -/* - * Copyright (c) 2008 - * Embedded Brains GmbH - * Obere Lagerstr. 30 - * D-82178 Puchheim - * Germany - * rtems@embedded-brains.de - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.com/license/LICENSE. - */ - -#ifndef LIBBSP_POWERPC_MPC55XXEVB_H -#define LIBBSP_POWERPC_MPC55XXEVB_H - -/* TODO */ - -#endif /* LIBBSP_POWERPC_MPC55XXEVB_H */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5566evb_spe.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5566evb_spe.cfg index 28cf413a1e..b0feb2e1ba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5566evb_spe.cfg +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5566evb_spe.cfg @@ -1,3 +1 @@ -CPU_CFLAGS_FLOAT ?= -mspe - -include $(RTEMS_ROOT)/make/custom/mpc55xx.inc +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc55xx_spe.inc b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc55xx_spe.inc new file mode 100644 index 0000000000..fa69d09a3e --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc55xx_spe.inc @@ -0,0 +1,3 @@ +CPU_CFLAGS_FLOAT ?= -mspe -mabi=spe -mfloat-gprs=single + +include $(RTEMS_ROOT)/make/custom/mpc55xx.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_app.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_app.cfg index 28cf413a1e..b0feb2e1ba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_app.cfg +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_app.cfg @@ -1,3 +1 @@ -CPU_CFLAGS_FLOAT ?= -mspe - -include $(RTEMS_ROOT)/make/custom/mpc55xx.inc +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_boot.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_boot.cfg index 28cf413a1e..b0feb2e1ba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_boot.cfg +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_ecu508_boot.cfg @@ -1,3 +1 @@ -CPU_CFLAGS_FLOAT ?= -mspe - -include $(RTEMS_ROOT)/make/custom/mpc55xx.inc +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_app.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_app.cfg new file mode 100644 index 0000000000..b0feb2e1ba --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_app.cfg @@ -0,0 +1 @@ +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_boot.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_boot.cfg new file mode 100644 index 0000000000..b0feb2e1ba --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_koma_boot.cfg @@ -0,0 +1 @@ +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_app.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_app.cfg new file mode 100644 index 0000000000..b0feb2e1ba --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_app.cfg @@ -0,0 +1 @@ +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_boot.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_boot.cfg new file mode 100644 index 0000000000..b0feb2e1ba --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674f_rsm6_moma_boot.cfg @@ -0,0 +1 @@ +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674fevb_spe.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674fevb_spe.cfg index 28cf413a1e..b0feb2e1ba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674fevb_spe.cfg +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/mpc5674fevb_spe.cfg @@ -1,3 +1 @@ -CPU_CFLAGS_FLOAT ?= -mspe - -include $(RTEMS_ROOT)/make/custom/mpc55xx.inc +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/phycore_mpc5554.cfg b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/phycore_mpc5554.cfg index 886697e1c3..b0feb2e1ba 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/phycore_mpc5554.cfg +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/make/custom/phycore_mpc5554.cfg @@ -1,14 +1 @@ -## -# -# @file -# -# @ingroup mpc55xx_config -# -# @brief configuration file for the Phytec PhyCORE MPC5554 -# - -RTEMS_LINKCMDS=linkcmds.phycore_mpc5554 - -CPU_CFLAGS_FLOAT?=-mfloat-gprs=single -mspe - -include $(RTEMS_ROOT)/make/custom/mpc55xx.inc +include $(RTEMS_ROOT)/make/custom/mpc55xx_spe.inc diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/network/smsc9218i.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/network/smsc9218i.c index 3ccc8cd4a3..013447a7b0 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/network/smsc9218i.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/network/smsc9218i.c @@ -1566,9 +1566,31 @@ static bool smsc9218i_wait_for_eeprom_access( return !busy; } +static bool smsc9218i_get_mac_address( + volatile smsc9218i_registers *regs, + uint8_t address [6] +) +{ + bool ok = false; + + uint32_t low = smsc9218i_mac_read(regs, SMSC9218I_MAC_ADDRL, &ok); + address [0] = (uint8_t) low; + address [1] = (uint8_t) (low >> 8) & 0xff; + address [2] = (uint8_t) (low >> 16); + address [3] = (uint8_t) (low >> 24); + + if (ok) { + uint32_t high = smsc9218i_mac_read(regs, SMSC9218I_MAC_ADDRH, &ok); + address [4] = (uint8_t) high; + address [5] = (uint8_t) (high >> 8); + } + + return ok; +} + static bool smsc9218i_set_mac_address( volatile smsc9218i_registers *regs, - unsigned char address [6] + const uint8_t address [6] ) { bool ok = smsc9218i_mac_write( @@ -1589,22 +1611,48 @@ static bool smsc9218i_set_mac_address( return ok; } +/* Sometimes the write of the MAC address was not reliable */ +static bool smsc9218i_set_and_verify_mac_address( + volatile smsc9218i_registers *regs, + const uint8_t address [6] +) +{ + bool ok = true; + int i; + + for (i = 0; ok && i < 3; ++i) { + ok = smsc9218i_set_mac_address(regs, address); + + if (ok) { + uint8_t actual_address [6]; + + ok = smsc9218i_get_mac_address(regs, actual_address) + && memcmp(address, actual_address, sizeof(actual_address)) == 0; + } + } + + return ok; +} + #if defined(DEBUG) static void smsc9218i_mac_address_dump(volatile smsc9218i_registers *regs) { - uint32_t low = smsc9218i_mac_read(regs, SMSC9218I_MAC_ADDRL, NULL); - uint32_t high = smsc9218i_mac_read(regs, SMSC9218I_MAC_ADDRH, NULL); + uint8_t mac_address [6]; + bool ok = smsc9218i_get_mac_address(regs, mac_address); - printf( - "MAC address: %02" PRIx32 ":%02" PRIx32 ":%02" PRIx32 - ":%02" PRIx32 ":%02" PRIx32 ":%02" PRIx32 "\n", - low & 0xff, - (low >> 8) & 0xff, - (low >> 16) & 0xff, - (low >> 24) & 0xff, - high & 0xff, - (high >> 8) & 0xff - ); + if (ok) { + printf( + "MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n", + mac_address [0], + mac_address [1], + mac_address [2], + mac_address [3], + mac_address [4], + mac_address [5] + ); + } else { + printf("cannot read MAC address\n"); + } } #endif @@ -1774,7 +1822,7 @@ static void smsc9218i_interface_init(void *arg) ok = smsc9218i_wait_for_eeprom_access(regs); if (ok) { - ok = smsc9218i_set_mac_address(regs, e->arpcom.ac_enaddr); + ok = smsc9218i_set_and_verify_mac_address(regs, e->arpcom.ac_enaddr); if (ok) { #if defined(DEBUG) diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/preinstall.am b/c/src/lib/libbsp/powerpc/mpc55xxevb/preinstall.am index 884598e66a..f45e5f9555 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/preinstall.am +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/preinstall.am @@ -93,6 +93,10 @@ $(PROJECT_LIB)/linkcmds.phycore_mpc5554: startup/linkcmds.phycore_mpc5554 $(PROJ $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.phycore_mpc5554 PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.phycore_mpc5554 +$(PROJECT_LIB)/linkcmds.mpc5674f_ecu508: startup/linkcmds.mpc5674f_ecu508 $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508 + $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_boot: startup/linkcmds.mpc5674f_ecu508_boot $(PROJECT_LIB)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_boot PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_boot @@ -101,6 +105,26 @@ $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_app: startup/linkcmds.mpc5674f_ecu508_ap $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_app PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_ecu508_app +$(PROJECT_LIB)/linkcmds.mpc5674f_rsm6: startup/linkcmds.mpc5674f_rsm6 $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6 + +$(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_boot: startup/linkcmds.mpc5674f_rsm6_koma_boot $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_boot +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_boot + +$(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_app: startup/linkcmds.mpc5674f_rsm6_koma_app $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_app +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_koma_app + +$(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_boot: startup/linkcmds.mpc5674f_rsm6_moma_boot $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_boot +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_boot + +$(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_app: startup/linkcmds.mpc5674f_rsm6_moma_app $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_app +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds.mpc5674f_rsm6_moma_app + $(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h @@ -157,10 +181,6 @@ $(PROJECT_INCLUDE)/bsp/mpc55xx-config.h: include/mpc55xx-config.h $(PROJECT_INCL $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mpc55xx-config.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mpc55xx-config.h -$(PROJECT_INCLUDE)/bsp/mpc55xxevb.h: include/mpc55xxevb.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) - $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/mpc55xxevb.h -PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/mpc55xxevb.h - $(PROJECT_INCLUDE)/bsp/smsc9218i.h: include/smsc9218i.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/smsc9218i.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/smsc9218i.h diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c index 824b6f0c37..d0c3405298 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/bspstart.c @@ -48,29 +48,14 @@ unsigned int bsp_clock_speed = 0; uint32_t bsp_clicks_per_usec = 0; -void BSP_panic( char *s) +void _BSP_Fatal_error(unsigned n) { rtems_interrupt_level level; rtems_interrupt_disable( level); - printk( "%s PANIC %s\n", _RTEMS_version, s); - - while (1) { - /* Do nothing */ - } -} - -void _BSP_Fatal_error( unsigned n) -{ - rtems_interrupt_level level; - - rtems_interrupt_disable( level); - - printk( "%s PANIC ERROR %u\n", _RTEMS_version, n); - - while (1) { - /* Do nothing */ + while (true) { + mpc55xx_wait_for_interrupt(); } } @@ -123,7 +108,9 @@ void bsp_start(void) (uintptr_t) bsp_section_work_begin, rtems_configuration_get_interrupt_stack_size() ); - ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler); + #ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler); + #endif /* Initialize interrupts */ bsp_interrupt_initialize(); diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/exc-vector-base.S b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/exc-vector-base.S index 644b7a8f86..71c7d48da8 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/exc-vector-base.S +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/exc-vector-base.S @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -32,7 +32,7 @@ .globl mpc55xx_exc_vector_base - .section ".bsp_start_data", "ax" + .section ".bsp_text", "ax" #if 5510 <= MPC55XX_CHIP_TYPE && MPC55XX_CHIP_TYPE <= 5517 .align 12 @@ -59,9 +59,15 @@ mpc55xx_exc_vector_base: li r4, 4 b ppc_exc_wrap_nopush_std stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32763 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stwu r1, -EXC_GENERIC_SIZE(r1) stw r4, GPR4_OFFSET(r1) li r4, 6 @@ -83,13 +89,25 @@ mpc55xx_exc_vector_base: li r4, 24 b ppc_exc_wrap_nopush_std stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32752 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32749 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stw r1, ppc_exc_lock_crit@sdarel(r13) stw r4, ppc_exc_vector_register_crit@sdarel(r13) li r4, -32748 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/idle-thread.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/idle-thread.c index a83640b55f..dbdc48bc46 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/idle-thread.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/idle-thread.c @@ -22,14 +22,12 @@ #include <bsp.h> -#include <mpc55xx/regs.h> +#include <mpc55xx/mpc55xx.h> void *bsp_idle_thread(uintptr_t arg) { while (true) { - #ifdef MPC55XX_HAS_WAIT_INSTRUCTION - __asm__ volatile ("wait"); - #endif + mpc55xx_wait_for_interrupt(); } return NULL; diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm index 391127f8c7..cabaac2201 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.gwlcfm @@ -22,5 +22,6 @@ REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); +REGION_ALIAS ("REGION_NVRAM", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb index be6b82ba96..4f63fb0e0a 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5566evb @@ -22,5 +22,6 @@ REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); +REGION_ALIAS ("REGION_NVRAM", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb index 07d8f50ab7..1977c92d59 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5643l_evb @@ -28,5 +28,6 @@ REGION_ALIAS ("REGION_WORK", RAM_1); REGION_ALIAS ("REGION_STACK", RAM_1); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); +REGION_ALIAS ("REGION_NVRAM", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508 b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508 new file mode 100644 index 0000000000..1e52a3c6c3 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508 @@ -0,0 +1,51 @@ +MEMORY { + DSROM : ORIGIN = 0x00020000, LENGTH = 64k + SYSROM : ORIGIN = 0x00100000, LENGTH = 4k + RAM : ORIGIN = 0x40000000, LENGTH = 240k + NOCACHE : ORIGIN = 0x4003c000, LENGTH = 16k + DSRAM : ORIGIN = 0x20000000, LENGTH = 64k + RAM_EXT : ORIGIN = 0x20010000, LENGTH = 444k + SYSRAM : ORIGIN = 0x2007f000, LENGTH = 4k + NVRAM : ORIGIN = 0x3ffa0000, LENGTH = 128k +} + +REGION_ALIAS ("REGION_START", STARTROM); +REGION_ALIAS ("REGION_FAST_TEXT", RAM); +REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM); +REGION_ALIAS ("REGION_TEXT", ROM); +REGION_ALIAS ("REGION_TEXT_LOAD", ROM); +REGION_ALIAS ("REGION_RODATA", ROM); +REGION_ALIAS ("REGION_RODATA_LOAD", ROM); +REGION_ALIAS ("REGION_FAST_DATA", RAM); +REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM); +REGION_ALIAS ("REGION_DATA", RAM); +REGION_ALIAS ("REGION_DATA_LOAD", ROM); +REGION_ALIAS ("REGION_BSS", RAM); +REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); +REGION_ALIAS ("REGION_WORK", RAM); +REGION_ALIAS ("REGION_STACK", RAM); +REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); +REGION_ALIAS ("REGION_NVRAM", NVRAM); + +SECTIONS { + .dsram (NOLOAD) : { + bsp_section_dsram_begin = .; + *(SORT(.bsp_dsram*)) + bsp_section_dsram_end = .; + } > DSRAM AT > DSROM + bsp_section_dsram_size = bsp_section_dsram_end - bsp_section_dsram_begin; + bsp_section_dsram_load_begin = LOADADDR (.dsram); + bsp_section_dsram_load_end = bsp_section_dsram_load_begin + bsp_section_dsram_size; + + .sysram : { + bsp_section_sysram_begin = .; + *(SORT(.bsp_sysram*)) + bsp_section_sysram_end = .; + } > SYSRAM AT > SYSROM + bsp_section_sysram_size = bsp_section_sysram_end - bsp_section_sysram_begin; + bsp_section_sysram_load_begin = LOADADDR (.sysram); + bsp_section_sysram_load_end = bsp_section_sysram_load_begin + bsp_section_sysram_size; +} + +INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app index d2da307778..4b94ac50c4 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_app @@ -1,28 +1,8 @@ MEMORY { /* Let space for the binary image library header */ - ROM : ORIGIN = 0x00100000, LENGTH = 3M - 4k - - RAM : ORIGIN = 0x40000000, LENGTH = 256K - 16k - RAM_EXT : ORIGIN = 0x20000000, LENGTH = 512K - NOCACHE : ORIGIN = 0x4003c000, LENGTH = 16k + ROM : ORIGIN = 0x00101000, LENGTH = 3064k } -REGION_ALIAS ("REGION_START", ROM); -REGION_ALIAS ("REGION_FAST_TEXT", RAM); -REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM); -REGION_ALIAS ("REGION_TEXT", ROM); -REGION_ALIAS ("REGION_TEXT_LOAD", ROM); -REGION_ALIAS ("REGION_RODATA", ROM); -REGION_ALIAS ("REGION_RODATA_LOAD", ROM); -REGION_ALIAS ("REGION_FAST_DATA", RAM); -REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM); -REGION_ALIAS ("REGION_DATA", RAM); -REGION_ALIAS ("REGION_DATA_LOAD", ROM); -REGION_ALIAS ("REGION_BSS", RAM); -REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); -REGION_ALIAS ("REGION_WORK", RAM); -REGION_ALIAS ("REGION_STACK", RAM); -REGION_ALIAS ("REGION_NOCACHE", NOCACHE); -REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); +REGION_ALIAS ("STARTROM", ROM); -INCLUDE linkcmds.mpc55xx +INCLUDE linkcmds.mpc5674f_ecu508 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot index 7ba011261e..6dc5a7fcb0 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_ecu508_boot @@ -1,26 +1,6 @@ MEMORY { - ROM : ORIGIN = 0x0, LENGTH = 1M - RAM : ORIGIN = 0x40000000, LENGTH = 256K - 16k - RAM_EXT : ORIGIN = 0x20000000, LENGTH = 512K - NOCACHE : ORIGIN = 0x4003c000, LENGTH = 16k + STARTROM : ORIGIN = 0x0, LENGTH = 32k + ROM : ORIGIN = 0x40000, LENGTH = 768k } -REGION_ALIAS ("REGION_START", ROM); -REGION_ALIAS ("REGION_FAST_TEXT", RAM); -REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM); -REGION_ALIAS ("REGION_TEXT", ROM); -REGION_ALIAS ("REGION_TEXT_LOAD", ROM); -REGION_ALIAS ("REGION_RODATA", ROM); -REGION_ALIAS ("REGION_RODATA_LOAD", ROM); -REGION_ALIAS ("REGION_FAST_DATA", RAM); -REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM); -REGION_ALIAS ("REGION_DATA", RAM); -REGION_ALIAS ("REGION_DATA_LOAD", ROM); -REGION_ALIAS ("REGION_BSS", RAM); -REGION_ALIAS ("REGION_RWEXTRA", RAM_EXT); -REGION_ALIAS ("REGION_WORK", RAM); -REGION_ALIAS ("REGION_STACK", RAM); -REGION_ALIAS ("REGION_NOCACHE", NOCACHE); -REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); - -INCLUDE linkcmds.mpc55xx +INCLUDE linkcmds.mpc5674f_ecu508 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6 b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6 new file mode 100644 index 0000000000..8f6a403ca8 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6 @@ -0,0 +1,28 @@ +MEMORY { + RAM : ORIGIN = 0x40000000, LENGTH = 240k + NOCACHE : ORIGIN = 0x4003c000, LENGTH = 16k + MRAM : ORIGIN = 0x20000000, LENGTH = 4M +} + +REGION_ALIAS ("RAM_EXT", RAM); + +REGION_ALIAS ("REGION_START", STARTROM); +REGION_ALIAS ("REGION_FAST_TEXT", RAM); +REGION_ALIAS ("REGION_FAST_TEXT_LOAD", ROM); +REGION_ALIAS ("REGION_TEXT", ROM); +REGION_ALIAS ("REGION_TEXT_LOAD", ROM); +REGION_ALIAS ("REGION_RODATA", ROM); +REGION_ALIAS ("REGION_RODATA_LOAD", ROM); +REGION_ALIAS ("REGION_FAST_DATA", RAM); +REGION_ALIAS ("REGION_FAST_DATA_LOAD", ROM); +REGION_ALIAS ("REGION_DATA", RAM); +REGION_ALIAS ("REGION_DATA_LOAD", ROM); +REGION_ALIAS ("REGION_BSS", RAM); +REGION_ALIAS ("REGION_RWEXTRA", RAM); +REGION_ALIAS ("REGION_WORK", RAM); +REGION_ALIAS ("REGION_STACK", RAM); +REGION_ALIAS ("REGION_NOCACHE", NOCACHE); +REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); +REGION_ALIAS ("REGION_NVRAM", MRAM); + +INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_app b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_app new file mode 100644 index 0000000000..51e1404256 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_app @@ -0,0 +1,8 @@ +MEMORY { + /* Let space for the binary image library header */ + ROM : ORIGIN = 0x00100000, LENGTH = 3068k +} + +REGION_ALIAS ("STARTROM", ROM); + +INCLUDE linkcmds.mpc5674f_rsm6 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_boot b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_boot new file mode 100644 index 0000000000..7b97282fa1 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_koma_boot @@ -0,0 +1,6 @@ +MEMORY { + STARTROM : ORIGIN = 0x0, LENGTH = 32k + ROM : ORIGIN = 0x40000, LENGTH = 768k +} + +INCLUDE linkcmds.mpc5674f_rsm6 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_app b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_app new file mode 100644 index 0000000000..51e1404256 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_app @@ -0,0 +1,8 @@ +MEMORY { + /* Let space for the binary image library header */ + ROM : ORIGIN = 0x00100000, LENGTH = 3068k +} + +REGION_ALIAS ("STARTROM", ROM); + +INCLUDE linkcmds.mpc5674f_rsm6 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_boot b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_boot new file mode 100644 index 0000000000..7b97282fa1 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674f_rsm6_moma_boot @@ -0,0 +1,6 @@ +MEMORY { + STARTROM : ORIGIN = 0x0, LENGTH = 32k + ROM : ORIGIN = 0x40000, LENGTH = 768k +} + +INCLUDE linkcmds.mpc5674f_rsm6 diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb index 7f59a076cd..3113fb20b7 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.mpc5674fevb @@ -3,6 +3,7 @@ MEMORY { RAM : ORIGIN = 0x40000000, LENGTH = 256K - 16k RAM_EXT : ORIGIN = 0x20000000, LENGTH = 512K NOCACHE : ORIGIN = 0x4003c000, LENGTH = 16k + EMPTY : ORIGIN = 0x0, LENGTH = 0 } REGION_ALIAS ("REGION_START", ROM); @@ -22,5 +23,6 @@ REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); REGION_ALIAS ("REGION_NOCACHE_LOAD", ROM); +REGION_ALIAS ("REGION_NVRAM", EMPTY); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 index 1db3190887..77b8abc5e0 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/linkcmds.phycore_mpc5554 @@ -31,5 +31,6 @@ REGION_ALIAS ("REGION_WORK", RAM_EXT); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", NOCACHE); REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); +REGION_ALIAS ("REGION_NVRAM", NOCACHE); INCLUDE linkcmds.mpc55xx diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c index e3d4405769..b8803f931c 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-clock.c @@ -38,7 +38,7 @@ } if (!lock) { - bsp_reset(); + rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, MPC55XX_FATAL_FMPLL_LOCK); } } #endif diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-clock.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-clock.c index e434c0976a..9e0f98a301 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-clock.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-clock.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -22,8 +22,7 @@ #include <bsp/mpc55xx-config.h> -BSP_START_TEXT_SECTION const mpc55xx_clock_config - mpc55xx_start_config_clock [1] = { { +const mpc55xx_clock_config mpc55xx_start_config_clock [1] = { { #ifdef MPC55XX_HAS_FMPLL .syncr_tmp = { .B = { @@ -80,7 +79,7 @@ BSP_START_TEXT_SECTION const mpc55xx_clock_config }, .esyncr1_final = { .B = { - .CLKCFG = 7, + .CLKCFG = MPC55XX_FMPLL_ESYNCR1_CLKCFG, .EPREDIV = EPREDIV_VAL, .EMFD = EMFD_VAL } diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs-cal.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs-cal.c index 4fa3632756..e9ed8c5c0d 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs-cal.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs-cal.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -21,13 +21,10 @@ */ #include <bsp/mpc55xx-config.h> -#include <bsp/start.h> -#include <bsp.h> #ifdef MPC55XX_HAS_EBI -BSP_START_TEXT_SECTION const struct EBI_CAL_CS_tag - mpc55xx_start_config_ebi_cal_cs [] = { +const struct EBI_CAL_CS_tag mpc55xx_start_config_ebi_cal_cs [] = { #if defined(MPC55XX_BOARD_MPC5674FEVB) /* External SRAM */ { @@ -75,7 +72,8 @@ BSP_START_TEXT_SECTION const struct EBI_CAL_CS_tag } } } -#elif defined(MPC55XX_BOARD_MPC5674F_ECU508) +#elif defined(MPC55XX_BOARD_MPC5674F_ECU508) \ + && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) /* D_CS0 for external SRAM */ { .BR = { @@ -171,11 +169,98 @@ BSP_START_TEXT_SECTION const struct EBI_CAL_CS_tag } } } +#elif defined(MPC55XX_BOARD_MPC5674F_RSM6) \ + && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + /* D_CS0 for MRAM */ + { + .BR = { + .B = { + .BA = 0x20000000 >> 15, + .PS = 0, + .AD_MUX = 1, + .BL = 0, + .WEBS = 1, + .TBDIP = 0, + .SETA = 0, + .BI = 1, + .V = 1 + } + }, + .OR = { + .B = { + .AM = 0xffc00000 >> 15, + .SCY = 4, + .BSCY = 0 + } + } + }, + + /* D_CS1 for FPGA */ + { + .BR = { + .B = { + .BA = 0x21000000 >> 15, + .PS = 0, + .AD_MUX = 1, + .BL = 0, + .WEBS = 0, + .TBDIP = 0, + .SETA = 0, + .BI = 1, + .V = 1 + } + }, + .OR = { + .B = { + .AM = 0xff800000 >> 15, + .SCY = 0, + .BSCY = 0 + } + } + }, + + /* D_CS2 unused */ + { + .BR = { .R = 0x20000002 }, + .OR = { .R = 0xe0000000 } + }, + + #if defined(MPC55XX_BOARD_MPC5674F_RSM6_KOMA) + /* D_CS3 for Ethernet Controller */ + { + .BR = { + .B = { + .BA = 0x23000000 >> 15, + .PS = 1, + .AD_MUX = 1, + .BL = 0, + .WEBS = 1, + .TBDIP = 0, + .SETA = 0, + .BI = 1, + .V = 1 + } + }, + .OR = { + .B = { + .AM = 0xfff80000 >> 15, + .SCY = 8, + .BSCY = 0 + } + } + } + #else + /* D_CS3 unused */ + { + .BR = { .R = 0x20000002 }, + .OR = { .R = 0xe0000000 } + } + #endif #endif }; -BSP_START_TEXT_SECTION const size_t mpc55xx_start_config_ebi_cal_cs_count [] = { - sizeof(mpc55xx_start_config_ebi_cal_cs) / sizeof(mpc55xx_start_config_ebi_cal_cs [0]) +const size_t mpc55xx_start_config_ebi_cal_cs_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_ebi_cal_cs) }; #endif /* MPC55XX_HAS_EBI */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs.c index 819c21e7cc..7f868b964d 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi-cs.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -21,13 +21,10 @@ */ #include <bsp/mpc55xx-config.h> -#include <bsp/start.h> -#include <bsp.h> #ifdef MPC55XX_HAS_EBI -BSP_START_TEXT_SECTION const struct EBI_CS_tag - mpc55xx_start_config_ebi_cs [] = { +const struct EBI_CS_tag mpc55xx_start_config_ebi_cs [] = { #if defined(MPC55XX_BOARD_GWLCFM) /* CS0: External SRAM (16 bit, 1 wait states, 512kB, no burst) */ { @@ -160,8 +157,8 @@ BSP_START_TEXT_SECTION const struct EBI_CS_tag #endif }; -BSP_START_TEXT_SECTION const size_t mpc55xx_start_config_ebi_cs_count [] = { - sizeof(mpc55xx_start_config_ebi_cs) / sizeof(mpc55xx_start_config_ebi_cs [0]) +const size_t mpc55xx_start_config_ebi_cs_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_ebi_cs) }; #endif /* MPC55XX_HAS_EBI */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c new file mode 100644 index 0000000000..aa0f6a7f74 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-ebi.c @@ -0,0 +1,62 @@ +/** + * @file + * + * @ingroup mpc55xx + * + * @brief EBI configuration. + */ + +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <bsp/mpc55xx-config.h> + +#ifdef MPC55XX_HAS_EBI + +const mpc55xx_ebi_config mpc55xx_start_config_ebi [] = { + #if defined(MPC55XX_BOARD_GWLCFM) + { + .ebi_mcr = { + .B = { + .DBM = 1, + .AD_MUX = 1, /* use multiplexed bus */ + .D16_31 = 1 /* use lower AD bus */ + } + }, + .siu_eccr_ebdf = 4 - 1 /* use CLK/4 as bus clock */ + } + #elif (defined(MPC55XX_BOARD_MPC5674FEVB) \ + || defined(MPC55XX_BOARD_MPC5674F_ECU508) \ + || defined(MPC55XX_BOARD_MPC5674F_RSM6)) \ + && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + { + .ebi_mcr = { + .B = { + .ACGE = 0, + .MDIS = 0, + .D16_31 = 1, + .AD_MUX = 0, + .DBM = 0 + } + }, + .siu_eccr_ebdf = 2 - 1 + } + #endif +}; + +const size_t mpc55xx_start_config_ebi_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_ebi) +}; + +#endif /* MPC55XX_HAS_EBI */ diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu-early.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu-early.c index 10483a4a71..5eb5330d88 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu-early.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu-early.c @@ -20,12 +20,15 @@ * http://www.rtems.com/license/LICENSE. */ -#include <bsp/start.h> #include <bsp/mpc55xx-config.h> -BSP_START_TEXT_SECTION const struct MMU_tag - mpc55xx_start_config_mmu_early [] = { -#if MPC55XX_CHIP_FAMILY == 555 +const struct MMU_tag mpc55xx_start_config_mmu_early [] = { +#if (defined(MPC55XX_BOARD_MPC5674F_ECU508) \ + || defined(MPC55XX_BOARD_MPC5674F_RSM6)) \ + && !defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + /* Used as cache-inhibited area later (ADC, DSPI queues) */ + MPC55XX_MMU_TAG_INITIALIZER(14, 0x4003c000, MPC55XX_MMU_16K, 0, 1, 1, 0) +#elif MPC55XX_CHIP_FAMILY == 555 /* Internal SRAM 96k */ MPC55XX_MMU_TAG_INITIALIZER(3, 0x40000000, MPC55XX_MMU_256K, 1, 1, 1, 0), #elif MPC55XX_CHIP_FAMILY == 556 @@ -47,7 +50,6 @@ BSP_START_TEXT_SECTION const struct MMU_tag #endif }; -BSP_START_TEXT_SECTION const size_t mpc55xx_start_config_mmu_early_count [] = { - sizeof(mpc55xx_start_config_mmu_early) - / sizeof(mpc55xx_start_config_mmu_early [0]) +const size_t mpc55xx_start_config_mmu_early_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_mmu_early) }; diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu.c index 034faf012f..f1b321221e 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-mmu.c @@ -20,12 +20,9 @@ * http://www.rtems.com/license/LICENSE. */ -#include <bsp.h> -#include <bsp/start.h> #include <bsp/mpc55xx-config.h> -BSP_START_TEXT_SECTION const struct MMU_tag - mpc55xx_start_config_mmu [] = { +const struct MMU_tag mpc55xx_start_config_mmu [] = { #if defined(MPC55XX_BOARD_GWLCFM) /* External Ethernet Controller 64k */ MPC55XX_MMU_TAG_INITIALIZER(5, 0x3fff8000, MPC55XX_MMU_64K, 0, 1, 1, 1) @@ -75,31 +72,71 @@ BSP_START_TEXT_SECTION const struct MMU_tag /* External Ethernet controller */ MPC55XX_MMU_TAG_INITIALIZER(15, 0x3fff8000, MPC55XX_MMU_64K, 0, 1, 1, 1) #elif defined(MPC55XX_BOARD_MPC5674F_ECU508) - /* Arguments macro: idx, addr, size, x, w, r, io */ - /* Internal flash 4M */ - MPC55XX_MMU_TAG_INITIALIZER(1, 0x00000000, MPC55XX_MMU_64K, 1, 0, 1, 0), /* first 64k unused, to detect null-pointer access */ - MPC55XX_MMU_TAG_INITIALIZER(5, 0x00010000, MPC55XX_MMU_64K, 1, 0, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(6, 0x00020000, MPC55XX_MMU_128K, 1, 0, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(7, 0x00040000, MPC55XX_MMU_256K, 1, 0, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(8, 0x00080000, MPC55XX_MMU_512K, 1, 0, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(9, 0x00100000, MPC55XX_MMU_1M, 1, 0, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(10, 0x00200000, MPC55XX_MMU_2M, 1, 0, 1, 0), - /* External SRAM 2M */ - MPC55XX_MMU_TAG_INITIALIZER(2, 0x20000000, MPC55XX_MMU_2M, 0, 1, 1, 0), - /* Internal SRAM 256k */ - MPC55XX_MMU_TAG_INITIALIZER(3, 0x40000000 + 0 * 1024, MPC55XX_MMU_256K, 0, 1, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(11, 0x40000000 + 128 * 1024, MPC55XX_MMU_64K, 0, 1, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(12, 0x40000000 + 192 * 1024, MPC55XX_MMU_32K, 0, 1, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(13, 0x40000000 + 224 * 1024, MPC55XX_MMU_16K, 0, 1, 1, 0), - MPC55XX_MMU_TAG_INITIALIZER(14, 0x40000000 + 240 * 1024, MPC55XX_MMU_16K, 0, 1, 1, 1), // used as cache-inhibited area (ADC, DSPI queues) - /* External Ethernet controller */ - MPC55XX_MMU_TAG_INITIALIZER(15, 0x3fff8000, MPC55XX_MMU_1K, 0, 1, 1, 1), - /* External MRAM 128k */ - MPC55XX_MMU_TAG_INITIALIZER(16, 0x3ffa0000, MPC55XX_MMU_128K, 0, 1, 1, 0), - /* External ARCNET controller */ - MPC55XX_MMU_TAG_INITIALIZER(17, 0x3ffc0000, MPC55XX_MMU_1K, 0, 1, 1, 1) - /* Peripheral Bridge A-Registers on MMU-table pos 4 */ - /* Peripheral Bridge B-Registers on MMU-table pos 0 */ + #if defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + /* Arguments macro: idx, addr, size, x, w, r, io */ + + /* Internal flash 4M */ + /* First 64k unused, to detect NULL pointer access */ + MPC55XX_MMU_TAG_INITIALIZER(1, 0x00000000, MPC55XX_MMU_64K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(5, 0x00010000, MPC55XX_MMU_64K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(6, 0x00020000, MPC55XX_MMU_128K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(7, 0x00040000, MPC55XX_MMU_256K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(8, 0x00080000, MPC55XX_MMU_512K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(9, 0x00100000, MPC55XX_MMU_1M, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(10, 0x00200000, MPC55XX_MMU_2M, 1, 0, 1, 0), + /* External SRAM 2M */ + MPC55XX_MMU_TAG_INITIALIZER(2, 0x20000000, MPC55XX_MMU_2M, 0, 1, 1, 0), + /* Internal SRAM 256k */ + MPC55XX_MMU_TAG_INITIALIZER(3, 0x40000000, MPC55XX_MMU_256K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(11, 0x40020000, MPC55XX_MMU_64K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(12, 0x40030000, MPC55XX_MMU_32K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(13, 0x40038000, MPC55XX_MMU_16K, 0, 1, 1, 0), + /* Used as cache-inhibited area (ADC, DSPI queues) */ + MPC55XX_MMU_TAG_INITIALIZER(14, 0x4003c000, MPC55XX_MMU_16K, 0, 1, 1, 1), + /* External Ethernet controller */ + MPC55XX_MMU_TAG_INITIALIZER(15, 0x3fff8000, MPC55XX_MMU_1K, 0, 1, 1, 1), + /* External MRAM 128k */ + MPC55XX_MMU_TAG_INITIALIZER(16, 0x3ffa0000, MPC55XX_MMU_128K, 0, 1, 1, 0), + /* External ARCNET controller */ + MPC55XX_MMU_TAG_INITIALIZER(17, 0x3ffc0000, MPC55XX_MMU_1K, 0, 1, 1, 1) + /* Peripheral Bridge A-Registers on MMU-table pos 4 */ + /* Peripheral Bridge B-Registers on MMU-table pos 0 */ + #else + /* Used as cache-inhibited area (ADC, DSPI queues) */ + MPC55XX_MMU_TAG_INITIALIZER(14, 0x4003c000, MPC55XX_MMU_16K, 0, 1, 1, 1), + #endif +#elif defined(MPC55XX_BOARD_MPC5674F_RSM6) + #if defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + /* Arguments macro: idx, addr, size, x, w, r, io */ + + /* Internal flash 4M */ + /* First 64k unused, to detect NULL pointer access */ + MPC55XX_MMU_TAG_INITIALIZER(1, 0x00000000, MPC55XX_MMU_64K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(5, 0x00010000, MPC55XX_MMU_64K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(6, 0x00020000, MPC55XX_MMU_128K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(7, 0x00040000, MPC55XX_MMU_256K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(8, 0x00080000, MPC55XX_MMU_512K, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(9, 0x00100000, MPC55XX_MMU_1M, 1, 0, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(10, 0x00200000, MPC55XX_MMU_2M, 1, 0, 1, 0), + /* Internal SRAM 256k */ + MPC55XX_MMU_TAG_INITIALIZER(3, 0x40000000, MPC55XX_MMU_256K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(11, 0x40020000, MPC55XX_MMU_64K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(12, 0x40030000, MPC55XX_MMU_32K, 0, 1, 1, 0), + MPC55XX_MMU_TAG_INITIALIZER(13, 0x40038000, MPC55XX_MMU_16K, 0, 1, 1, 0), + /* Used as cache-inhibited area (ADC, DSPI queues) */ + MPC55XX_MMU_TAG_INITIALIZER(14, 0x4003c000, MPC55XX_MMU_16K, 0, 1, 1, 1), + /* External MRAM 4M */ + MPC55XX_MMU_TAG_INITIALIZER(15, 0x20000000, MPC55XX_MMU_4M, 0, 1, 1, 0), + /* External FPGA */ + MPC55XX_MMU_TAG_INITIALIZER(16, 0x21000000, MPC55XX_MMU_8M, 0, 1, 1, 1), + #if defined(MPC55XX_BOARD_MPC5674F_RSM6_KOMA) + /* External Ethernet controller */ + MPC55XX_MMU_TAG_INITIALIZER(18, 0x23000000, MPC55XX_MMU_1K, 0, 1, 1, 1), + #endif + #else + /* Used as cache-inhibited area (ADC, DSPI queues) */ + MPC55XX_MMU_TAG_INITIALIZER(14, 0x4003c000, MPC55XX_MMU_16K, 0, 1, 1, 1), + #endif #elif MPC55XX_CHIP_FAMILY == 564 /* Internal flash 1M */ MPC55XX_MMU_TAG_INITIALIZER(0, 0x00000000, MPC55XX_MMU_1M, 1, 0, 1, 0), @@ -112,6 +149,6 @@ BSP_START_TEXT_SECTION const struct MMU_tag #endif }; -BSP_START_TEXT_SECTION const size_t mpc55xx_start_config_mmu_count [] = { - sizeof(mpc55xx_start_config_mmu) / sizeof(mpc55xx_start_config_mmu [0]) +const size_t mpc55xx_start_config_mmu_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_mmu) }; diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-siu-pcr.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-siu-pcr.c index 16de9cecc8..3980450894 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-siu-pcr.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-config-siu-pcr.c @@ -21,11 +21,8 @@ */ #include <bsp/mpc55xx-config.h> -#include <bsp/start.h> -#include <bsp.h> -BSP_START_TEXT_SECTION const mpc55xx_siu_pcr_config - mpc55xx_start_config_siu_pcr [] = { +const mpc55xx_siu_pcr_config mpc55xx_start_config_siu_pcr [] = { #if defined(MPC55XX_BOARD_GWLCFM) { 0,16, 0, {.B.PA = 1, .B.WPE = 0}}, /* PA[ 0..15] analog input */ { 16, 4, 0, {.B.PA = 0,.B.OBE = 1,.B.WPE = 0}}, /* PB[ 0.. 4] LED/CAN_STBN out */ @@ -112,7 +109,8 @@ BSP_START_TEXT_SECTION const mpc55xx_siu_pcr_config { 294, 6, 0, { .B = { .PA = 1, .DSC = 1 } } }, /* D_RD_WR, D_WE0, D_WE1, D_OE, D_TS, D_ALE */ { 301, 1, 0, { .B = { .PA = 1, .DSC = 1 } } }, /* D_CS1 */ { 302, 6, 0, { .B = { .PA = 1, .DSC = 1 } } } /* D_BDIP, D_WE2, D_WE3, D_ADD9 .. D_ADD11 */ -#elif defined(MPC55XX_BOARD_MPC5674F_ECU508) +#elif defined(MPC55XX_BOARD_MPC5674F_ECU508) \ + && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) { 196, 2, 0, { .B = { .PA = 0, .OBE = 1, .WPE = 0 } } }, /* EMIOS17 .. EMIOS18 (5VS_EN, 80V_EN) */ { 200, 4, 0, { .B = { .PA = 0, .OBE = 1, .WPE = 0 } } }, /* EMIOS21 .. EMIOS24 (\KS_RST, \LS_RST, \IGNINJ_RST, \INJDI_RST) */ { 204, 1, 1, { .B = { .PA = 0, .OBE = 1, .WPE = 0 } } }, /* EMIOS25 (HBR12_RST) */ @@ -129,9 +127,25 @@ BSP_START_TEXT_SECTION const mpc55xx_siu_pcr_config { 305, 3, 0, { .B = { .PA = 1, .DSC = 0 } } }, /* D_ADD9 .. D_ADD11 */ { 432, 1, 1, { .B = { .PA = 0, .OBE = 1, .WPE = 0 } } }, /* EMIOS26 (HBR34_RST) */ { 433, 1, 0, { .B = { .PA = 0, .OBE = 1, .WPE = 0 } } } /* EMIOS27 (\ETH_RST) */ +#elif defined(MPC55XX_BOARD_MPC5674F_RSM6) \ + && defined(MPC55XX_NEEDS_LOW_LEVEL_INIT) + { 89, 1, 0, { .B = { .PA = 1, .OBE = 1, .IBE = 1, .WPE = 1, .WPS = 1 } } }, /* TXD_A (ESCI_A)*/ + { 90, 1, 0, { .B = { .PA = 1, .OBE = 0, .IBE = 1, .WPE = 1, .WPS = 1 } } }, /* RXD_A (ESCI_A)*/ + { 256, 1, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_CS0 */ + { 257, 1, 0, { .B = { .PA = 2, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_ADD_DAT31 */ + #if defined(MPC55XX_BOARD_MPC5674F_RSM6_KOMA) + { 258, 1, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_CS3 */ + #endif + { 259, 4, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_ADD12 .. D_ADD15 */ + { 263, 15, 0, { .B = { .PA = 2, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_ADD_DAT16 .. D_ADD_DAT30 */ + { 278, 16, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_ADD_DAT0 .. D_ADD_DAT15 */ + { 294, 6, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_RD_WR, D_WE0, D_WE1, D_OE, D_TS, D_ALE */ + { 301, 1, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_CS1 */ + { 302, 3, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } }, /* D_BDIP, D_WE2, D_WE3 */ + { 305, 3, 0, { .B = { .PA = 1, .DSC = 3, .WPE = 1, .WPS = 1 } } } /* D_ADD9 .. D_ADD11 */ #endif }; -BSP_START_TEXT_SECTION const size_t mpc55xx_start_config_siu_pcr_count [] = { - sizeof(mpc55xx_start_config_siu_pcr) / sizeof(mpc55xx_start_config_siu_pcr [0]) +const size_t mpc55xx_start_config_siu_pcr_count [] = { + RTEMS_ARRAY_SIZE(mpc55xx_start_config_siu_pcr) }; diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c index 3c49f238f5..e756e4c706 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start-early.c @@ -20,8 +20,6 @@ * http://www.rtems.com/license/LICENSE. */ -#include <bsp.h> -#include <bsp/start.h> #include <bsp/mpc55xx-config.h> #include <bsp/linker-symbols.h> @@ -147,46 +145,28 @@ static BSP_START_TEXT_SECTION void mpc55xx_start_siu(void) static BSP_START_TEXT_SECTION void mpc55xx_start_ebi_chip_select(void) { - #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT - #ifdef MPC55XX_HAS_EBI - size_t i = 0; + #ifdef MPC55XX_HAS_EBI + size_t i = 0; - for (i = 0; i < mpc55xx_start_config_ebi_cs_count [0]; ++i) { - EBI.CS [i] = mpc55xx_start_config_ebi_cs [i]; - } + for (i = 0; i < mpc55xx_start_config_ebi_cs_count [0]; ++i) { + EBI.CS [i] = mpc55xx_start_config_ebi_cs [i]; + } - for (i = 0; i < mpc55xx_start_config_ebi_cal_cs_count [0]; ++i) { - EBI.CAL_CS [i] = mpc55xx_start_config_ebi_cal_cs [i]; - } - #endif + for (i = 0; i < mpc55xx_start_config_ebi_cal_cs_count [0]; ++i) { + EBI.CAL_CS [i] = mpc55xx_start_config_ebi_cal_cs [i]; + } #endif } static BSP_START_TEXT_SECTION void mpc55xx_start_ebi(void) { - #ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT - #if defined(MPC55XX_BOARD_GWLCFM) - /* - * init EBI for Muxed AD bus - */ - EBI.MCR.B.DBM = 1; - EBI.MCR.B.AD_MUX = 1; /* use multiplexed bus */ - EBI.MCR.B.D16_31 = 1; /* use lower AD bus */ - - SIU.ECCR.B.EBDF = 3; /* use CLK/4 as bus clock */ - #elif defined(MPC55XX_BOARD_MPC5674FEVB) || defined(MPC55XX_BOARD_MPC5674F_ECU508) - union EBI_MCR_tag mcr = { - .B = { - .ACGE = 0, - .MDIS = 0, - .D16_31 = 1, - .AD_MUX = 0, - .DBM = 0 - } - }; - - EBI.MCR.R = mcr.R; - #endif + #ifdef MPC55XX_HAS_EBI + size_t i = 0; + + for (i = 0; i < mpc55xx_start_config_ebi_count [0]; ++i) { + SIU.ECCR.B.EBDF = mpc55xx_start_config_ebi [i].siu_eccr_ebdf; + EBI.MCR.R = mpc55xx_start_config_ebi [i].ebi_mcr.R; + } #endif } diff --git a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S index 565da0f858..e8ae3c0db4 100644 --- a/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S +++ b/c/src/lib/libbsp/powerpc/mpc55xxevb/startup/start.S @@ -170,15 +170,27 @@ _start: ori r3, r3, 0x4000 mtspr HID0, r3 - /* Enable branch prediction */ - LWI r3, FSL_EIS_BUCSR_BBFI | FSL_EIS_BUCSR_BPEN + /* + * Enable branch prediction. + * + * Errata e4396: e200z7: Erroneous Address Fetch + * + * The propose workaround does not work. + */ +#if MPC55XX_CHIP_FAMILY != 567 + LWI r3, FSL_EIS_BUCSR_BBFI | FSL_EIS_BUCSR_BALLOC_ALL | FSL_EIS_BUCSR_BPRED_NOT_TAKEN | FSL_EIS_BUCSR_BPEN mtspr FSL_EIS_BUCSR, r3 +#endif + +#endif /* MPC55XX_NEEDS_LOW_LEVEL_INIT */ /* MMU early initialization */ LA r3, mpc55xx_start_config_mmu_early LW r4, mpc55xx_start_config_mmu_early_count bl mpc55xx_start_mmu_apply_config +#ifdef MPC55XX_NEEDS_LOW_LEVEL_INIT + /* Initialize intermediate stack (ECC) */ LA r3, bsp_ram_start @@ -217,7 +229,10 @@ zero_intermediate_stack_loop: li r0, 0 stw r0, 0(r1) - /* Load sections */ + /* + * Load sections. This must be performed after the stack switch + * because it may overwrite the initial stack. + */ LA r3, bsp_section_fast_text_begin LA r4, bsp_section_fast_text_load_begin LA r5, bsp_section_fast_text_size diff --git a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c index fc488eab29..0494696dec 100644 --- a/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c +++ b/c/src/lib/libbsp/powerpc/mvme5500/startup/bspclean.c @@ -24,10 +24,3 @@ void bsp_fatal_extension( printk("RTEMS terminated; Boot manually or turn on AUTO_BOOT.\n"); #endif } - -void bsp_cleanup( - uint32_t status -) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/powerpc/qemuppc/startup/cmain.c b/c/src/lib/libbsp/powerpc/qemuppc/startup/cmain.c index f43972aee6..0839db55e8 100644 --- a/c/src/lib/libbsp/powerpc/qemuppc/startup/cmain.c +++ b/c/src/lib/libbsp/powerpc/qemuppc/startup/cmain.c @@ -1,3 +1,5 @@ +#include <bsp/bootcard.h> + static void __outb(int port, unsigned char v) { @@ -31,8 +33,6 @@ extern unsigned char __sbss2_start[], __sbss2_end[]; extern unsigned char __sbss_start[], __sbss_end[]; extern unsigned char __bss_start[], __bss_end[]; -extern void boot_card(void *); - void cmain (void) { diff --git a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am index cc9c8b4a6e..54fc5477ed 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/Makefile.am +++ b/c/src/lib/libbsp/powerpc/qoriq/Makefile.am @@ -64,6 +64,7 @@ libbsp_a_SOURCES += ../../shared/bsplibc.c \ ../../shared/bspclean.c \ ../../shared/bspgetworkarea.c \ ../../shared/src/bsp-uboot-board-info.c \ + ../shared/src/ppc-exc-handler-table.c \ ../shared/src/tictac.c \ ../shared/src/bsp-start-zero.S \ ../shared/startup/bspidle.c \ diff --git a/c/src/lib/libbsp/powerpc/qoriq/configure.ac b/c/src/lib/libbsp/powerpc/qoriq/configure.ac index fc2dbd7a35..0fbc13488f 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/configure.ac +++ b/c/src/lib/libbsp/powerpc/qoriq/configure.ac @@ -20,6 +20,14 @@ RTEMS_BSPOPTS_HELP_INSTRUCTION_CACHE_ENABLED RTEMS_BSPOPTS_SET([BSP_USE_DATA_CACHE_BLOCK_TOUCH],[*],[1]) RTEMS_BSPOPTS_HELP([BSP_USE_DATA_CACHE_BLOCK_TOUCH],[if defined use dcbt instruction]) +RTEMS_BSPOPTS_SET([PPC_EXC_CONFIG_USE_FIXED_HANDLER],[*],[1]) +RTEMS_BSPOPTS_HELP([PPC_EXC_CONFIG_USE_FIXED_HANDLER], +[use fixed high-level exception handler]) + +RTEMS_BSPOPTS_SET([PPC_EXC_CONFIG_BOOKE_ONLY],[*],[1]) +RTEMS_BSPOPTS_HELP([PPC_EXC_CONFIG_BOOKE_ONLY], +[only support Book E exception types]) + RTEMS_BSPOPTS_SET([BSP_CONSOLE_BAUD],[*],[115200]) RTEMS_BSPOPTS_HELP([BSP_CONSOLE_BAUD],[default baud for console and other serial devices]) diff --git a/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c b/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c index d6b18ef0d9..c124db5030 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c +++ b/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2010, 2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2010, 2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -240,7 +240,7 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector) return pic_vector_enable(vector, VPR_MSK); } -static int qoriq_external_exception_handler(BSP_Exception_frame *frame, unsigned exception_number) +static void qoriq_interrupt_dispatch(void) { rtems_vector_number vector = qoriq.pic.iack; @@ -256,9 +256,21 @@ static int qoriq_external_exception_handler(BSP_Exception_frame *frame, unsigned } else { bsp_interrupt_handler_default(vector); } +} + +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER +static int qoriq_external_exception_handler(BSP_Exception_frame *frame, unsigned exception_number) +{ + qoriq_interrupt_dispatch(); return 0; } +#else +void bsp_interrupt_dispatch(void) +{ + qoriq_interrupt_dispatch(); +} +#endif static bool pic_is_ipi(rtems_vector_number vector) { @@ -291,9 +303,11 @@ rtems_status_code bsp_interrupt_facility_initialize(void) rtems_vector_number i = 0; uint32_t processor_id = ppc_processor_id(); +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER if (ppc_exc_set_handler(ASM_EXT_VECTOR, qoriq_external_exception_handler)) { return RTEMS_IO_ERROR; } +#endif if (processor_id == 0) { /* Core 0 must do the basic initialization */ diff --git a/c/src/lib/libbsp/powerpc/qoriq/make/custom/qoriq.inc b/c/src/lib/libbsp/powerpc/qoriq/make/custom/qoriq.inc index fb401f7a9f..8995eec0d6 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/make/custom/qoriq.inc +++ b/c/src/lib/libbsp/powerpc/qoriq/make/custom/qoriq.inc @@ -8,7 +8,8 @@ RTEMS_CPU = powerpc RTEMS_CPU_MODEL = qoriq -CPU_CFLAGS = -mcpu=8540 -meabi -msdata -fno-common -mfloat-gprs=double -mstrict-align \ +CPU_CFLAGS = -mcpu=8540 -meabi -msdata -fno-common -mstrict-align \ + -mspe -mabi=spe -mfloat-gprs=double \ -D__ppc_generic CFLAGS_OPTIMIZE_V = -Os -g diff --git a/c/src/lib/libbsp/powerpc/qoriq/start/start.S b/c/src/lib/libbsp/powerpc/qoriq/start/start.S index 463e6b28aa..d95521c870 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/start/start.S +++ b/c/src/lib/libbsp/powerpc/qoriq/start/start.S @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2010-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -178,9 +178,15 @@ bsp_exc_vector_base: li r4, 4 b ppc_exc_wrap_nopush_std stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32763 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stwu r1, -EXC_GENERIC_SIZE(r1) stw r4, GPR4_OFFSET(r1) li r4, 6 @@ -203,13 +209,25 @@ system_call: li r4, 24 b ppc_exc_wrap_nopush_std stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32752 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw r4, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li r4, -32749 +#endif b ppc_exc_wrap_async_normal +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + nop + nop +#endif stw r1, ppc_exc_lock_crit@sdarel(r13) stw r4, ppc_exc_vector_register_crit@sdarel(r13) li r4, -32748 diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 index 502a26ce58..b27c10f4aa 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_0 @@ -7,6 +7,7 @@ MEMORY { LOW : ORIGIN = 0x4000, LENGTH = 16M - 16k HIGH : ORIGIN = 0x1000000, LENGTH = 32M + EMPTY : ORIGIN = 0x0, LENGTH = 0 } REGION_ALIAS ("REGION_START", LOW); @@ -24,8 +25,9 @@ REGION_ALIAS ("REGION_BSS", HIGH); REGION_ALIAS ("REGION_RWEXTRA", HIGH); REGION_ALIAS ("REGION_WORK", HIGH); REGION_ALIAS ("REGION_STACK", HIGH); -REGION_ALIAS ("REGION_NOCACHE", HIGH); -REGION_ALIAS ("REGION_NOCACHE_LOAD", HIGH); +REGION_ALIAS ("REGION_NOCACHE", EMPTY); +REGION_ALIAS ("REGION_NOCACHE_LOAD", EMPTY); +REGION_ALIAS ("REGION_NVRAM", EMPTY); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 index 82fadf71dd..21a632b9f4 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_core_1 @@ -6,6 +6,7 @@ MEMORY { RAM : ORIGIN = 0x4000000, LENGTH = 64M + EMPTY : ORIGIN = 0x0, LENGTH = 0 } REGION_ALIAS ("REGION_START", RAM); @@ -23,8 +24,9 @@ REGION_ALIAS ("REGION_BSS", RAM); REGION_ALIAS ("REGION_RWEXTRA", RAM); REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); -REGION_ALIAS ("REGION_NOCACHE", RAM); -REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM); +REGION_ALIAS ("REGION_NOCACHE", EMPTY); +REGION_ALIAS ("REGION_NOCACHE_LOAD", EMPTY); +REGION_ALIAS ("REGION_NVRAM", EMPTY); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb index ef7fd575c5..7360843856 100644 --- a/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb +++ b/c/src/lib/libbsp/powerpc/qoriq/startup/linkcmds.qoriq_p1020rdb @@ -7,6 +7,7 @@ MEMORY { LOW : ORIGIN = 0x4000, LENGTH = 16M - 16k HIGH : ORIGIN = 0x1000000, LENGTH = 32M + EMPTY : ORIGIN = 0x0, LENGTH = 0 } REGION_ALIAS ("REGION_START", LOW); @@ -24,8 +25,9 @@ REGION_ALIAS ("REGION_BSS", HIGH); REGION_ALIAS ("REGION_RWEXTRA", HIGH); REGION_ALIAS ("REGION_WORK", HIGH); REGION_ALIAS ("REGION_STACK", HIGH); -REGION_ALIAS ("REGION_NOCACHE", HIGH); -REGION_ALIAS ("REGION_NOCACHE_LOAD", HIGH); +REGION_ALIAS ("REGION_NOCACHE", EMPTY); +REGION_ALIAS ("REGION_NOCACHE_LOAD", EMPTY); +REGION_ALIAS ("REGION_NVRAM", EMPTY); bsp_section_robarrier_align = 0x1000000; bsp_section_rwbarrier_align = 0x1000000; diff --git a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h index 80f54bd4b9..7bfc6e2304 100644 --- a/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h +++ b/c/src/lib/libbsp/powerpc/shared/include/linker-symbols.h @@ -99,12 +99,18 @@ LINKER_SYMBOL(bsp_section_nocache_size) LINKER_SYMBOL(bsp_section_nocache_load_begin) LINKER_SYMBOL(bsp_section_nocache_load_end) +LINKER_SYMBOL(bsp_section_nvram_begin) +LINKER_SYMBOL(bsp_section_nvram_end) +LINKER_SYMBOL(bsp_section_nvram_size) + #define BSP_FAST_TEXT_SECTION __attribute__((section(".bsp_fast_text"))) #define BSP_FAST_DATA_SECTION __attribute__((section(".bsp_fast_data"))) #define BSP_NOCACHE_SECTION __attribute__((section(".bsp_nocache"))) +#define BSP_NVRAM_SECTION __attribute__((section(".bsp_nvram"))) + /** @} */ #ifdef __cplusplus diff --git a/c/src/lib/libbsp/powerpc/shared/src/ppc-exc-handler-table.c b/c/src/lib/libbsp/powerpc/shared/src/ppc-exc-handler-table.c new file mode 100644 index 0000000000..c57f094178 --- /dev/null +++ b/c/src/lib/libbsp/powerpc/shared/src/ppc-exc-handler-table.c @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <bsp/vectors.h> + +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY +static int ppc_exc_interrupt_dispatch(BSP_Exception_frame *f, unsigned vector) +{ + bsp_interrupt_dispatch(); + + return 0; +} +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + +const ppc_exc_handler_t ppc_exc_handler_table [LAST_VALID_EXC + 1] = { + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + ppc_exc_interrupt_dispatch, +#else /* PPC_EXC_CONFIG_BOOKE_ONLY */ + ppc_exc_handler_default, +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default, + ppc_exc_handler_default +}; + +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ diff --git a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base index 1768361100..9f04ebe23c 100644 --- a/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base +++ b/c/src/lib/libbsp/powerpc/shared/startup/linkcmds.base @@ -51,17 +51,9 @@ SECTIONS { . = ALIGN (bsp_section_xbarrier_align); } > REGION_TEXT - .fast_text : { - bsp_section_fast_text_begin = .; - *(.bsp_fast_text) - bsp_section_fast_text_end = .; - } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD - bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin; - bsp_section_fast_text_load_begin = LOADADDR (.fast_text); - bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size; - .text : { bsp_section_text_begin = .; + *(SORT(.bsp_text*)) *(.text.unlikely .text.*_unlikely) *(.text .stub .text.* .gnu.linkonce.t.*) *(.gnu.warning) @@ -79,6 +71,15 @@ SECTIONS { bsp_section_text_load_begin = LOADADDR (.text); bsp_section_text_load_end = bsp_section_text_load_begin + bsp_section_text_size; + .fast_text : { + bsp_section_fast_text_begin = .; + *(.bsp_fast_text) + bsp_section_fast_text_end = .; + } > REGION_FAST_TEXT AT > REGION_FAST_TEXT_LOAD + bsp_section_fast_text_size = bsp_section_fast_text_end - bsp_section_fast_text_begin; + bsp_section_fast_text_load_begin = LOADADDR (.fast_text); + bsp_section_fast_text_load_end = bsp_section_fast_text_load_begin + bsp_section_fast_text_size; + .robarrier : { . = ALIGN (bsp_section_robarrier_align); } > REGION_RODATA @@ -339,6 +340,13 @@ SECTIONS { bsp_section_nocache_load_begin = LOADADDR (.nocache); bsp_section_nocache_load_end = bsp_section_nocache_load_begin + bsp_section_nocache_size; + .nvram (NOLOAD) : { + bsp_section_nvram_begin = .; + *(SORT(.bsp_nvram*)) + bsp_section_nvram_end = .; + } > REGION_NVRAM + bsp_section_nvram_size = bsp_section_nvram_end - bsp_section_nvram_begin; + /* FIXME */ RamBase = ORIGIN (REGION_WORK); RamSize = LENGTH (REGION_WORK); diff --git a/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc index a73da78312..165412f03c 100644 --- a/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc +++ b/c/src/lib/libbsp/powerpc/t32mppc/startup/linkcmds.t32mppc @@ -1,5 +1,6 @@ MEMORY { RAM : ORIGIN = 0x0, LENGTH = 128M + EMPTY : ORIGIN = 0x0, LENGTH = 0 } REGION_ALIAS ("REGION_START", RAM); @@ -19,5 +20,6 @@ REGION_ALIAS ("REGION_WORK", RAM); REGION_ALIAS ("REGION_STACK", RAM); REGION_ALIAS ("REGION_NOCACHE", RAM); REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM); +REGION_ALIAS ("REGION_NVRAM", EMPTY); INCLUDE linkcmds.base diff --git a/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c b/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c index 3a2af5525b..5c7fe3d624 100644 --- a/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c +++ b/c/src/lib/libbsp/powerpc/virtex4/startup/bspclean.c @@ -1,5 +1,4 @@ -/* bsp_cleanup() - * +/* * This routine normally is part of start.s and usually returns * control to a monitor. * @@ -53,8 +52,3 @@ void bsp_fatal_extension( /* All done. Hang out. */ BSP_ask_for_reset(); } - -void bsp_cleanup( uint32_t status ) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c b/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c index 3a2af5525b..5c7fe3d624 100644 --- a/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c +++ b/c/src/lib/libbsp/powerpc/virtex5/startup/bspclean.c @@ -1,5 +1,4 @@ -/* bsp_cleanup() - * +/* * This routine normally is part of start.s and usually returns * control to a monitor. * @@ -53,8 +52,3 @@ void bsp_fatal_extension( /* All done. Hang out. */ BSP_ask_for_reset(); } - -void bsp_cleanup( uint32_t status ) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/shared/bootcard.c b/c/src/lib/libbsp/shared/bootcard.c index 33ad0ee128..a928bb2924 100644 --- a/c/src/lib/libbsp/shared/bootcard.c +++ b/c/src/lib/libbsp/shared/bootcard.c @@ -31,8 +31,7 @@ * - 1st task executes C++ global constructors * .... appplication runs ... * - exit - * + back to here eventually - * + bspclean.c: bsp_cleanup + * + will not return to here * * This style of initialization ensures that the C++ global * constructors are executed after RTEMS is initialized. @@ -69,12 +68,11 @@ const char *bsp_boot_cmdline; * the system while maximizing shared code and keeping BSP code in C * as much as possible. */ -uint32_t boot_card( +void boot_card( const char *cmdline ) { rtems_interrupt_level bsp_isr_level; - uint32_t status = 0; /* * Special case for PowerPC: The interrupt disable mask is stored in SPRG0. @@ -164,22 +162,11 @@ uint32_t boot_card( * Complete initialization of RTEMS and switch to the first task. * Global C++ constructors will be executed in the context of that task. */ - status = rtems_initialize_start_multitasking(); + rtems_initialize_start_multitasking(); /*************************************************************** *************************************************************** - * APPLICATION RUNS HERE!!! When it shuts down, we return!!! * + * APPLICATION RUNS NOW!!! We will not return to here!!! * *************************************************************** - *************************************************************** - */ - - /* - * Perform any BSP specific shutdown actions which are written in C. - */ - bsp_cleanup( status ); - - /* - * Now return to the start code. - */ - return status; + ***************************************************************/ } diff --git a/c/src/lib/libbsp/shared/bspclean.c b/c/src/lib/libbsp/shared/bspclean.c index 3e48c2993d..40955c685e 100644 --- a/c/src/lib/libbsp/shared/bspclean.c +++ b/c/src/lib/libbsp/shared/bspclean.c @@ -1,6 +1,4 @@ /* - * This is a dummy bsp_cleanup routine. - * * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -45,8 +43,3 @@ void bsp_fatal_extension( bsp_reset(); #endif } - -void bsp_cleanup( uint32_t status ) -{ - rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); -} diff --git a/c/src/lib/libbsp/shared/include/bootcard.h b/c/src/lib/libbsp/shared/include/bootcard.h index 237b76daff..f3de76036c 100644 --- a/c/src/lib/libbsp/shared/include/bootcard.h +++ b/c/src/lib/libbsp/shared/include/bootcard.h @@ -55,7 +55,8 @@ extern "C" { */ typedef enum { BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION, - BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION + BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION, + BSP_GENERIC_FATAL_SPURIOUS_INTERRUPT } bsp_generic_fatal_code; /** @@ -71,8 +72,6 @@ void bsp_predriver_hook(void); void bsp_postdriver_hook(void); -void bsp_cleanup(uint32_t status); - void bsp_reset(void); /** @@ -107,15 +106,12 @@ void bsp_reset(void); * - 1st task executes C++ global constructors * - .... application runs ... * - exit - * - back to here eventually - * - bsp_cleanup() - * - * If something goes wrong bsp_cleanup() will be called out of order. + * - will not return to here * * This style of initialization ensures that the C++ global constructors are * executed after RTEMS is initialized. */ -uint32_t boot_card(const char *cmdline); +void boot_card(const char *cmdline) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; #ifdef CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK /** diff --git a/c/src/lib/libcpu/powerpc/Makefile.am b/c/src/lib/libcpu/powerpc/Makefile.am index febcc6b4e0..0537e7380c 100644 --- a/c/src/lib/libcpu/powerpc/Makefile.am +++ b/c/src/lib/libcpu/powerpc/Makefile.am @@ -14,6 +14,7 @@ include_libcpu_HEADERS = shared/include/powerpc-utility.h include_bspdir = $(includedir)/bsp include_bsp_HEADERS = +include_bsp_HEADERS += new-exceptions/bspsupport/vectors.h EXTRA_DIST = @@ -25,8 +26,6 @@ new_exceptions_rtems_cpu_rel_LDFLAGS = $(RTEMS_RELLDFLAGS) if !mpc5xx -include_bsp_HEADERS += new-exceptions/bspsupport/vectors.h - noinst_PROGRAMS += new-exceptions/exc_bspsupport.rel new_exceptions_exc_bspsupport_rel_SOURCES = \ new-exceptions/bspsupport/ppc-code-copy.c \ diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/include/fsl-mpc567x.h b/c/src/lib/libcpu/powerpc/mpc55xx/include/fsl-mpc567x.h index 1ae2a13ed0..69e9897266 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/include/fsl-mpc567x.h +++ b/c/src/lib/libcpu/powerpc/mpc55xx/include/fsl-mpc567x.h @@ -4268,7 +4268,7 @@ extern "C" { struct EQADC_tag { - union { /* Module Configuration Register */ + union EQADC_MCR_tag { /* Module Configuration Register */ uint32_t R; struct { uint32_t:24; @@ -4283,7 +4283,7 @@ extern "C" { uint32_t eQADC_reserved0004; /* 0x0004-0x0007 */ - union { /* Null Message Send Format Register */ + union EQADC_NMSFR_tag { /* Null Message Send Format Register */ uint32_t R; struct { uint32_t:6; @@ -4291,7 +4291,7 @@ extern "C" { } B; } NMSFR; - union { /* External Trigger Digital Filter Register */ + union EQADC_ETDFR_tag { /* External Trigger Digital Filter Register */ uint32_t R; struct { uint32_t:28; @@ -4299,7 +4299,7 @@ extern "C" { } B; } ETDFR; - union { /* CFIFO Push Registers */ + union EQADC_CFPR_tag { /* CFIFO Push Registers */ uint32_t R; struct { uint32_t CFPUSH:32; @@ -4308,7 +4308,7 @@ extern "C" { uint32_t eQADC_reserved0028[2]; /* 0x0028-0x002F */ - union { /* Result FIFO Pop Registers */ + union EQADC_RFPR_tag { /* Result FIFO Pop Registers */ uint32_t R; struct { uint32_t:16; @@ -4450,7 +4450,7 @@ extern "C" { uint32_t eQADC_reserved00B0; /* 0x00B0-0x00B3 */ - union { /* SSI Control Register */ + union EQADC_SSICR_tag { /* SSI Control Register */ uint32_t R; struct { uint32_t:21; diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h b/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h index a43140d700..e7bb83995a 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h +++ b/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -43,7 +43,12 @@ #define LIBCPU_POWERPC_MPC55XX_H #include <stddef.h> -#include <stdint.h> + +#include <mpc55xx/regs.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ int mpc55xx_flash_copy(void *dest, const void *src, size_t nbytes); int mpc55xx_flash_copy_op(void *rdest, const void *src, size_t nbytes, @@ -124,4 +129,17 @@ static inline uint32_t mpc55xx_count_leading_zeros( uint32_t value) return count; } +static inline mpc55xx_wait_for_interrupt(void) +{ + #ifdef MPC55XX_HAS_WAIT_INSTRUCTION + __asm__ volatile ("wait"); + #else + __asm__ volatile (""); + #endif +} + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + #endif /* LIBCPU_POWERPC_MPC55XX_H */ diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c index 7863fb8987..024ea80aa6 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c +++ b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c @@ -7,12 +7,13 @@ */ /* - * Copyright (c) 2008 - * Embedded Brains GmbH - * Obere Lagerstr. 30 - * D-82178 Puchheim - * Germany - * rtems@embedded-brains.de + * Copyright (c) 2008-2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -112,10 +113,7 @@ rtems_status_code mpc55xx_interrupt_handler_install( } } -/** - * @brief External exception handler. - */ -static int mpc55xx_external_exception_handler( BSP_Exception_frame *frame, unsigned exception_number) +static void mpc55xx_interrupt_dispatch(void) { /* Acknowlege interrupt request */ rtems_vector_number vector = INTC.IACKR.B.INTVEC; @@ -131,19 +129,47 @@ static int mpc55xx_external_exception_handler( BSP_Exception_frame *frame, unsig /* End of interrupt */ INTC.EOIR.R = 1; +} + +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + +/** + * @brief External exception handler. + */ +static int mpc55xx_external_exception_handler( BSP_Exception_frame *frame, unsigned exception_number) +{ + mpc55xx_interrupt_dispatch(); return 0; } -rtems_status_code bsp_interrupt_facility_initialize() +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + +void bsp_interrupt_dispatch(void) +{ + mpc55xx_interrupt_dispatch(); +} + +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + +rtems_status_code bsp_interrupt_facility_initialize(void) { + rtems_vector_number vector; + +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER /* Install exception handler */ if (ppc_exc_set_handler( ASM_EXT_VECTOR, mpc55xx_external_exception_handler)) { return RTEMS_IO_ERROR; } +#endif /* Initialize interrupt controller */ + /* Disable all interrupts */ + for (vector = MPC55XX_IRQ_MIN; vector <= MPC55XX_IRQ_MAX; ++vector) { + INTC.PSR [vector].B.PRI = MPC55XX_INTC_DISABLED_PRIORITY; + } + /* Software vector mode */ INTC.MCR.B.VTES = 0; INTC.MCR.B.HVEN = 0; diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h index ea5a3f9614..e3d747f870 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_asm_macros.h @@ -3,7 +3,7 @@ * * Modified and partially rewritten by Till Straumann, 2007-2008 * - * Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>, 2008. + * Modified by Sebastian Huber <sebastian.huber@embedded-brains.de>, 2008-2012. * * Low-level assembly code for PPC exceptions (macros). * @@ -279,6 +279,8 @@ TEST_LOCK_crit_done_\_FLVR: /* Standard*/ .macro RECOVER_CHECK_std _FLVR +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Check if exception is recoverable */ lwz SCRATCH_REGISTER_0, SRR1_FRAME_OFFSET(FRAME_REGISTER) lwz SCRATCH_REGISTER_1, ppc_exc_msr_bits@sdarel(r13) @@ -290,6 +292,8 @@ recover_check_twiddle_std_\_FLVR: /* Not recoverable? */ bne recover_check_twiddle_std_\_FLVR +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + .endm /* Critical */ @@ -302,6 +306,8 @@ recover_check_twiddle_std_\_FLVR: /* Machine check */ .macro RECOVER_CHECK_mchk _FLVR +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Check if exception is recoverable */ lwz SCRATCH_REGISTER_0, SRR1_FRAME_OFFSET(FRAME_REGISTER) lwz SCRATCH_REGISTER_1, ppc_exc_msr_bits@sdarel(r13) @@ -313,6 +319,8 @@ recover_check_twiddle_mchk_\_FLVR: /* Not recoverable? */ bne recover_check_twiddle_mchk_\_FLVR +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + .endm /* @@ -520,6 +528,8 @@ wrap_disable_thread_dispatching_done_\_FLVR: /* Save vector number and exception type */ stw VECTOR_REGISTER, EXCEPTION_NUMBER_OFFSET(FRAME_REGISTER) +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Load MSR bit mask */ lwz SCRATCH_REGISTER_0, ppc_exc_msr_bits@sdarel(r13) @@ -532,6 +542,8 @@ wrap_disable_thread_dispatching_done_\_FLVR: wrap_change_msr_done_\_FLVR: +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + #ifdef __ALTIVEC__ LA SCRATCH_REGISTER_0, _CPU_save_altivec_volatile mtctr SCRATCH_REGISTER_0 @@ -660,11 +672,15 @@ wrap_thread_dispatching_done_\_FLVR: bctrl #endif +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Restore MSR? */ bne CR_MSR, wrap_restore_msr_\_FLVR wrap_restore_msr_done_\_FLVR: +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + /* * At this point r1 is a valid exception frame pointer and * FRAME_REGISTER is no longer needed. @@ -725,6 +741,8 @@ wrap_restore_msr_done_\_FLVR: /* Return */ \_RFI +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + wrap_change_msr_\_FLVR: mfmsr SCRATCH_REGISTER_1 @@ -744,6 +762,8 @@ wrap_restore_msr_\_FLVR: isync b wrap_restore_msr_done_\_FLVR +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + wrap_save_non_volatile_regs_\_FLVR: /* Load pristine stack pointer */ @@ -825,6 +845,8 @@ wrap_call_global_handler_\_FLVR: /* First parameter = exception frame pointer + FRAME_LINK_SPACE */ addi r3, FRAME_REGISTER, FRAME_LINK_SPACE +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + /* Load global handler address */ LW SCRATCH_REGISTER_0, globalExceptHdl @@ -836,6 +858,13 @@ wrap_call_global_handler_\_FLVR: mtctr SCRATCH_REGISTER_0 bctrl +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + + /* Call fixed global handler */ + bl C_exception_handler + +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + b wrap_handler_done_\_FLVR .endm diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_async_normal.S b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_async_normal.S index dd6f694cc8..f123166b0d 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_async_normal.S +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_async_normal.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Obere Lagerstr. 30 @@ -46,14 +46,21 @@ */ #define FRAME_OFFSET(reg) GPR2_OFFSET(reg) +#ifdef PPC_EXC_CONFIG_USE_FIXED_HANDLER + .global bsp_interrupt_dispatch +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + .global ppc_exc_min_prolog_async_tmpl_normal .global ppc_exc_wrap_async_normal ppc_exc_min_prolog_async_tmpl_normal: stwu r1, -PPC_EXC_MINIMAL_FRAME_SIZE(r1) + +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER stw VECTOR_REGISTER, PPC_EXC_VECTOR_PROLOGUE_OFFSET(r1) li VECTOR_REGISTER, 0xffff8000 +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ /* * We store the absolute branch target address here. It will be used @@ -87,6 +94,7 @@ ppc_exc_wrap_async_normal: PPC_GPR_STORE SCRATCH_0_REGISTER, SCRATCH_0_OFFSET(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER #ifdef __SPE__ /* * Save high order part of VECTOR_REGISTER here. The low order part @@ -95,9 +103,14 @@ ppc_exc_wrap_async_normal: evmergehi SCRATCH_0_REGISTER, SCRATCH_0_REGISTER, VECTOR_REGISTER stw SCRATCH_0_REGISTER, VECTOR_OFFSET(r1) #endif +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + /* The vector register has no special purpose in this case */ + PPC_GPR_STORE VECTOR_REGISTER, VECTOR_OFFSET(r1) +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ PPC_GPR_STORE HANDLER_REGISTER, HANDLER_OFFSET(r1) +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER /* * Load the handler address. Get the handler table index from the * vector number. We have to discard the exception type. Take only @@ -108,6 +121,7 @@ ppc_exc_wrap_async_normal: lis HANDLER_REGISTER, ppc_exc_handler_table@h ori HANDLER_REGISTER, HANDLER_REGISTER, ppc_exc_handler_table@l lwzx HANDLER_REGISTER, HANDLER_REGISTER, SCRATCH_0_REGISTER +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ PPC_GPR_STORE SCRATCH_1_REGISTER, SCRATCH_1_OFFSET(r1) PPC_GPR_STORE SCRATCH_2_REGISTER, SCRATCH_2_OFFSET(r1) @@ -149,6 +163,7 @@ ppc_exc_wrap_async_normal: mfspr SCRATCH_0_REGISTER, SPRG1 iselgt r1, r1, SCRATCH_0_REGISTER +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER /* * Call high level exception handler. * @@ -159,6 +174,10 @@ ppc_exc_wrap_async_normal: rlwinm VECTOR_REGISTER, VECTOR_REGISTER, 0, 27, 31 mtctr HANDLER_REGISTER bctrl +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + /* Call fixed high level handler */ + bl bsp_interrupt_dispatch +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ /* Load ISR nest level and thread dispatch disable level */ lis ISR_NEST_HADDR_REGISTER, ISR_NEST_LEVEL@ha diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_global_handler.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_global_handler.c index 008611c6ff..463f429c58 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_global_handler.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_global_handler.c @@ -19,8 +19,6 @@ #include <bsp/vectors.h> -exception_handler_t globalExceptHdl = C_exception_handler; - void C_exception_handler(BSP_Exception_frame *excPtr) { rtems_fatal( diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c index 25d6b26faa..228c030f16 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c @@ -31,6 +31,8 @@ uint32_t ppc_exc_vector_register_std = 0; uint32_t ppc_exc_vector_register_crit = 0; uint32_t ppc_exc_vector_register_mchk = 0; +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* MSR bits to enable once critical status info is saved and the stack * is switched; must be set depending on CPU type * @@ -39,16 +41,24 @@ uint32_t ppc_exc_vector_register_mchk = 0; */ uint32_t ppc_exc_msr_bits = MSR_IR | MSR_DR | MSR_RI; -static int ppc_exc_handler_default(BSP_Exception_frame *f, unsigned int vector) +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + +int ppc_exc_handler_default(BSP_Exception_frame *f, unsigned int vector) { return -1; } +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + +exception_handler_t globalExceptHdl = C_exception_handler; + /* Table of C-handlers */ ppc_exc_handler_t ppc_exc_handler_table [LAST_VALID_EXC + 1] = { [0 ... LAST_VALID_EXC] = ppc_exc_handler_default }; +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + ppc_exc_handler_t ppc_exc_get_handler(unsigned vector) { if ( @@ -65,9 +75,15 @@ rtems_status_code ppc_exc_set_handler(unsigned vector, ppc_exc_handler_t handler { if (vector <= LAST_VALID_EXC) { if (handler == NULL) { - ppc_exc_handler_table [vector] = ppc_exc_handler_default; - } else { + handler = ppc_exc_handler_default; + } + + if (ppc_exc_handler_table [vector] != handler) { +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER ppc_exc_handler_table [vector] = handler; +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + return RTEMS_RESOURCE_IN_USE; +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ } return RTEMS_SUCCESSFUL; diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c index b239cdd60b..872eed49a9 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_initialize.c @@ -192,6 +192,8 @@ void ppc_exc_initialize( ppc_interrupt_set_disable_mask(interrupt_disable_mask); +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Use current MMU / RI settings when running C exception handlers */ ppc_exc_msr_bits = ppc_machine_state_register() & (MSR_DR | MSR_IR | MSR_RI); @@ -199,7 +201,9 @@ void ppc_exc_initialize( /* Need vector unit enabled to save/restore altivec context */ ppc_exc_msr_bits |= MSR_VE; #endif - + +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + if (ppc_cpu_is_bookE() == PPC_BOOKE_STD || ppc_cpu_is_bookE() == PPC_BOOKE_E500) { ppc_exc_initialize_booke(); } @@ -221,6 +225,7 @@ void ppc_exc_initialize( } } +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY /* If we are on a classic PPC with MSR_DR enabled then * assert that the mapping for at least this task's * stack is write-back-caching enabled (see README/CAVEATS) @@ -252,4 +257,5 @@ void ppc_exc_initialize( __asm__ volatile ("dcbz 0, %0"::"b" (p)); /* If we make it thru here then things seem to be OK */ } +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ } diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S index c5df56f7a5..725b08713b 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_naked.S @@ -76,6 +76,8 @@ ppc_exc_wrap_naked: mflr SCRATCH_REGISTER_0 stw SCRATCH_REGISTER_0, EXC_LR_OFFSET(r1) +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Load MSR bit mask */ lwz SCRATCH_REGISTER_0, ppc_exc_msr_bits@sdarel(r13) @@ -88,6 +90,8 @@ ppc_exc_wrap_naked: wrap_change_msr_done_naked: +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + /* * Call high level exception handler */ @@ -127,11 +131,15 @@ wrap_change_msr_done_naked: mtctr SCRATCH_REGISTER_0 bctrl +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + /* Restore MSR? */ bne CR_MSR, wrap_restore_msr_naked wrap_restore_msr_done_naked: +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + /* Restore XER and CTR */ lwz SCRATCH_REGISTER_0, EXC_XER_OFFSET(r1) lwz SCRATCH_REGISTER_1, EXC_CTR_OFFSET(r1) @@ -175,6 +183,8 @@ wrap_restore_msr_done_naked: /* Return */ rfi +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + wrap_change_msr_naked: mfmsr SCRATCH_REGISTER_1 @@ -193,3 +203,5 @@ wrap_restore_msr_naked: sync isync b wrap_restore_msr_done_naked + +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c index 9aa56d1c13..7518f5e496 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_prologue.c @@ -9,7 +9,7 @@ /* * Copyright (C) 2007 Till Straumann <strauman@slac.stanford.edu> * - * Copyright (C) 2009 embedded brains GmbH. + * Copyright (C) 2009-2012 embedded brains GmbH. * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -135,8 +135,12 @@ rtems_status_code ppc_exc_make_prologue( && (ppc_interrupt_get_disable_mask() & MSR_CE) == 0 ) { prologue_template = ppc_exc_min_prolog_async_tmpl_normal; +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER prologue_template_size = (size_t) ppc_exc_min_prolog_size; fixup_vector = true; +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + prologue_template_size = 8; +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ } else { prologue_template = ppc_exc_prologue_templates [category]; prologue_template_size = (size_t) ppc_exc_min_prolog_size; diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h index be909f15bf..a275d2ed75 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/vectors.h @@ -35,6 +35,8 @@ #ifndef LIBCPU_VECTORS_H #define LIBCPU_VECTORS_H +#include <bspopts.h> + #include <libcpu/powerpc-utility.h> #ifdef __cplusplus @@ -262,11 +264,6 @@ typedef CPU_Exception_frame BSP_Exception_frame; typedef void (*exception_handler_t)(BSP_Exception_frame*); /** - * @brief Global exception handler. - */ -extern exception_handler_t globalExceptHdl; - -/** * @brief Default global exception handler. */ void C_exception_handler(BSP_Exception_frame* excPtr); @@ -399,17 +396,23 @@ void ppc_exc_initialize( /** * @brief High-level exception handler type. * - * Exception handlers should return zero if the exception was handled and - * normal execution may resume. - * - * They should return minus one to reject the exception resulting in the - * globalExcHdl() being called. - * - * Other return values are reserved. + * @retval 0 The exception was handled and normal execution may resume. + * @retval -1 Reject the exception resulting in a call of the global exception + * handler. + * @retval other Reserved, do not use. */ typedef int (*ppc_exc_handler_t)(BSP_Exception_frame *f, unsigned vector); /** + * @brief Default high-level exception handler. + * + * @retval -1 Always. + */ +int ppc_exc_handler_default(BSP_Exception_frame *f, unsigned int vector); + +#ifndef PPC_EXC_CONFIG_BOOKE_ONLY + +/** * @brief Bits for MSR update. * * Bits in MSR that are enabled during execution of exception handlers / ISRs @@ -421,6 +424,8 @@ typedef int (*ppc_exc_handler_t)(BSP_Exception_frame *f, unsigned vector); */ extern uint32_t ppc_exc_msr_bits; +#endif /* PPC_EXC_CONFIG_BOOKE_ONLY */ + /** * @brief Cache write back check flag. * @@ -436,6 +441,28 @@ extern uint32_t ppc_exc_msr_bits; */ extern uint32_t ppc_exc_cache_wb_check; +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + /** + * @brief High-level exception handler table. + */ + extern ppc_exc_handler_t ppc_exc_handler_table [LAST_VALID_EXC + 1]; + + /** + * @brief Global exception handler. + */ + extern exception_handler_t globalExceptHdl; +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + /** + * @brief High-level exception handler table. + */ + extern const ppc_exc_handler_t ppc_exc_handler_table [LAST_VALID_EXC + 1]; + + /** + * @brief Interrupt dispatch routine provided by BSP. + */ + void bsp_interrupt_dispatch(void); +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + /** * @brief Set high-level exception handler. * @@ -452,6 +479,11 @@ extern uint32_t ppc_exc_cache_wb_check; * * It is legal to set a NULL handler. This leads to the globalExcHdl * being called if an exception for 'vector' occurs. + * + * @retval RTEMS_SUCCESSFUL Successful operation. + * @retval RTEMS_INVALID_ID Invalid vector number. + * @retval RTEMS_RESOURCE_IN_USE Handler table is read-only and handler does + * not match. */ rtems_status_code ppc_exc_set_handler(unsigned vector, ppc_exc_handler_t hdl); diff --git a/c/src/lib/libcpu/powerpc/preinstall.am b/c/src/lib/libcpu/powerpc/preinstall.am index 79b7d88878..88221241f4 100644 --- a/c/src/lib/libcpu/powerpc/preinstall.am +++ b/c/src/lib/libcpu/powerpc/preinstall.am @@ -54,11 +54,10 @@ $(PROJECT_INCLUDE)/bsp/$(dirstamp): @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp) PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp) -if !mpc5xx $(PROJECT_INCLUDE)/bsp/vectors.h: new-exceptions/bspsupport/vectors.h $(PROJECT_INCLUDE)/bsp/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/vectors.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/vectors.h -endif + if shared $(PROJECT_INCLUDE)/libcpu/io.h: shared/include/io.h $(PROJECT_INCLUDE)/libcpu/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/libcpu/io.h diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index b5569fa280..5b11e7e6f6 100644 --- a/cpukit/Makefile.am +++ b/cpukit/Makefile.am @@ -124,6 +124,7 @@ include_rtems_HEADERS += libblock/include/rtems/flashdisk.h include_rtems_HEADERS += libblock/include/rtems/ramdisk.h include_rtems_HEADERS += libblock/include/rtems/nvdisk.h include_rtems_HEADERS += libblock/include/rtems/nvdisk-sram.h +include_rtems_HEADERS += libblock/include/rtems/sparse-disk.h include_rtems_HEADERS += libblock/include/rtems/ide_part_table.h include_rtems_HEADERS += libblock/include/rtems/bdpart.h include_rtems_HEADERS += libblock/include/rtems/media.h diff --git a/cpukit/libblock/Makefile.am b/cpukit/libblock/Makefile.am index d07eb5e177..cafd1fcba0 100644 --- a/cpukit/libblock/Makefile.am +++ b/cpukit/libblock/Makefile.am @@ -31,6 +31,7 @@ libblock_a_SOURCES = src/bdbuf.c \ src/media-server.c \ src/media-desc.c \ src/media-dev-ident.c \ + src/sparse-disk.c \ include/rtems/bdbuf.h include/rtems/blkdev.h \ include/rtems/diskdevs.h include/rtems/flashdisk.h \ include/rtems/ramdisk.h include/rtems/nvdisk.h include/rtems/nvdisk-sram.h \ diff --git a/cpukit/libblock/include/rtems/sparse-disk.h b/cpukit/libblock/include/rtems/sparse-disk.h new file mode 100644 index 0000000000..3dc806b407 --- /dev/null +++ b/cpukit/libblock/include/rtems/sparse-disk.h @@ -0,0 +1,137 @@ +/** + * @file + * + * @ingroup rtems_sparse_disk + * + * @brief Sparse disk block device API. + */ + +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef SPARSE_DISK_H +#define SPARSE_DISK_H + +#include <stddef.h> +#include <stdint.h> +#include <rtems.h> +#include <rtems/diskdevs.h> + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/** + * @defgroup rtems_sparse_disk Sparse Disk Device + * + * @ingroup rtems_blkdev + * + * @{ + */ + +typedef struct { + rtems_blkdev_bnum block; + void *data; +} rtems_sparse_disk_key; + +typedef struct rtems_sparse_disk rtems_sparse_disk; + +typedef void (*rtems_sparse_disk_delete_handler)(rtems_sparse_disk *sparse_disk); + +struct rtems_sparse_disk { + rtems_id mutex; + rtems_blkdev_bnum blocks_with_buffer; + size_t used_count; + uint32_t media_block_size; + rtems_sparse_disk_delete_handler delete_handler; + uint8_t fill_pattern; + rtems_sparse_disk_key *key_table; +}; + +/** + * @brief Creates and registers a sparse disk. + * + * @param[in] device_file_name The device file name path. + * @param[in] media_block_size The media block size in bytes. + * @param[in] blocks_with_buffer Blocks of the device with a buffer. Other + * blocks can store only fill pattern value bytes. + * @param[in] block_count The media block count of the device. It is the sum + * of blocks with buffer and blocks that contain only fill pattern value bytes. + * @param[in] fill_pattern The fill pattern specifies the byte value of blocks + * without a buffer. It is also the initial value for blocks with a buffer. + * + * @retval RTEMS_SUCCESSFUL Successful operation. + * @retval RTEMS_INVALID_NUMBER Media block size or media block count is not + * positive. The blocks with buffer count is greater than the media block count. + * @retval RTEMS_NO_MEMORY Not enough memory. + * @retval RTEMS_TOO_MANY Cannot create semaphore. + * @retval RTEMS_UNSATISFIED Cannot create generic device node. + * + * @see rtems_sparse_disk_register(). + */ +rtems_status_code rtems_sparse_disk_create_and_register( + const char *device_file_name, + uint32_t media_block_size, + rtems_blkdev_bnum blocks_with_buffer, + rtems_blkdev_bnum media_block_count, + uint8_t fill_pattern +); + +/** + * @brief Frees a sparse disk. + * + * Calls free() on the sparse disk pointer. + */ +void rtems_sparse_disk_free( rtems_sparse_disk *sparse_disk ); + +/** + * @brief Initializes and registers a sparse disk. + * + * This will create one semaphore for mutual exclusion. + * + * @param[in] device_file_name The device file name path. + * @param[in, out] sparse_disk The sparse disk. + * @param[in] media_block_size The media block size in bytes. + * @param[in] blocks_with_buffer Blocks of the device with a buffer. Other + * blocks can store only fill pattern value bytes. + * @param[in] block_count The media block count of the device. It is the sum + * of blocks with buffer and blocks that contain only fill pattern value bytes. + * @param[in] fill_pattern The fill pattern specifies the byte value of blocks + * without a buffer. It is also the initial value for blocks with a buffer. + * @param[in] sparse_disk_delete The sparse disk delete handler. + * + * @retval RTEMS_SUCCESSFUL Successful operation. + * @retval RTEMS_INVALID_NUMBER Media block size or media block count is not + * positive. The blocks with buffer count is greater than the media block count. + * @retval RTEMS_INVALID_ADDRESS Invalid sparse disk address. + * @retval RTEMS_TOO_MANY Cannot create semaphore. + * @retval RTEMS_UNSATISFIED Cannot create generic device node. + */ +rtems_status_code rtems_sparse_disk_register( + const char *device_file_name, + rtems_sparse_disk *sparse_disk, + uint32_t media_block_size, + rtems_blkdev_bnum blocks_with_buffer, + rtems_blkdev_bnum media_block_count, + uint8_t fill_pattern, + rtems_sparse_disk_delete_handler sparse_disk_delete +); + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* SPARSE_DISK_H */ diff --git a/cpukit/libblock/src/sparse-disk.c b/cpukit/libblock/src/sparse-disk.c new file mode 100644 index 0000000000..987ab6d806 --- /dev/null +++ b/cpukit/libblock/src/sparse-disk.c @@ -0,0 +1,387 @@ +/** + * @file + * + * @ingroup rtems_sparse_disk + * + * @brief Sparse disk block device implementation. + */ + +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#include <stdlib.h> +#include <errno.h> +#include <string.h> + +#include <rtems.h> +#include <rtems/blkdev.h> +#include <rtems/fatal.h> + +#include "rtems/sparse-disk.h" + +/* + * Allocate RAM for sparse disk + */ +static rtems_sparse_disk *sparse_disk_allocate( + const uint32_t media_block_size, + const rtems_blkdev_bnum blocks_with_buffer ) +{ + size_t const key_table_size = blocks_with_buffer + * sizeof( rtems_sparse_disk_key ); + size_t const data_size = blocks_with_buffer * media_block_size; + size_t const alloc_size = sizeof( rtems_sparse_disk ) + + key_table_size + data_size; + + rtems_sparse_disk *const sd = (rtems_sparse_disk *) malloc( + alloc_size ); + + return sd; +} + +/* + * Initialize sparse disk data + */ +static rtems_status_code sparse_disk_initialize( rtems_sparse_disk *sd, + const uint32_t media_block_size, + const rtems_blkdev_bnum blocks_with_buffer, + const rtems_sparse_disk_delete_handler sparse_disk_delete, + const uint8_t fill_pattern ) +{ + rtems_status_code sc; + rtems_blkdev_bnum i; + + if ( NULL == sd ) + return RTEMS_INVALID_ADDRESS; + + uint8_t *data = (uint8_t *) sd; + size_t const key_table_size = blocks_with_buffer + * sizeof( rtems_sparse_disk_key ); + size_t const data_size = blocks_with_buffer * media_block_size; + + memset( data, 0, sizeof( rtems_sparse_disk ) + key_table_size ); + + sd->fill_pattern = fill_pattern; + memset( (uint8_t *) ( data + sizeof( rtems_sparse_disk ) + key_table_size ), + sd->fill_pattern, + data_size ); + + sd->delete_handler = sparse_disk_delete; + + sc = rtems_semaphore_create( + rtems_build_name( 'S', 'P', 'A', 'R' ), + 1, + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY, + 0, + &sd->mutex + ); + + if ( sc != RTEMS_SUCCESSFUL ) { + return sc; + } + + data += sizeof( rtems_sparse_disk ); + + sd->blocks_with_buffer = blocks_with_buffer; + sd->key_table = (rtems_sparse_disk_key *) data; + + data += key_table_size; + + for ( i = 0; i < blocks_with_buffer; ++i, data += media_block_size ) { + sd->key_table[i].data = data; + } + + sd->media_block_size = media_block_size; + return RTEMS_SUCCESSFUL; +} + +/* + * Block comparison + */ +static int sparse_disk_compare( const void *aa, const void *bb ) +{ + const rtems_sparse_disk_key *a = aa; + const rtems_sparse_disk_key *b = bb; + + if ( a->block < b->block ) { + return -1; + } else if ( a->block == b->block ) { + return 0; + } else { + return 1; + } +} + +static rtems_sparse_disk_key *sparse_disk_get_new_block( + rtems_sparse_disk *sparse_disk, + const rtems_blkdev_bnum block ) +{ + rtems_sparse_disk_key *key; + + if ( sparse_disk->used_count < sparse_disk->blocks_with_buffer ) { + key = &sparse_disk->key_table[sparse_disk->used_count]; + key->block = block; + ++sparse_disk->used_count; + qsort( sparse_disk->key_table, sparse_disk->used_count, + sizeof( rtems_sparse_disk_key ), sparse_disk_compare ); + } else + return NULL; + + return key; +} + +static int sparse_disk_read_block( + const rtems_sparse_disk *sparse_disk, + const rtems_blkdev_bnum block, + uint8_t *buffer, + const size_t buffer_size ) +{ + rtems_sparse_disk_key *key; + rtems_sparse_disk_key block_key = { + .block = block, + .data = NULL + }; + size_t bytes_to_copy = sparse_disk->media_block_size; + + if ( buffer_size < bytes_to_copy ) + bytes_to_copy = buffer_size; + + key = bsearch( + &block_key, + sparse_disk->key_table, + sparse_disk->used_count, + sizeof( rtems_sparse_disk_key ), + sparse_disk_compare + ); + + if ( NULL != key ) + memcpy( buffer, key->data, bytes_to_copy ); + else + memset( buffer, sparse_disk->fill_pattern, buffer_size ); + + return bytes_to_copy; +} + +static int sparse_disk_write_block( + rtems_sparse_disk *sparse_disk, + const rtems_blkdev_bnum block, + const uint8_t *buffer, + const size_t buffer_size ) +{ + unsigned int i; + bool block_needs_writing = false; + rtems_sparse_disk_key *key; + rtems_sparse_disk_key block_key = { + .block = block, + .data = NULL + }; + size_t bytes_to_copy = sparse_disk->media_block_size; + + if ( buffer_size < bytes_to_copy ) + bytes_to_copy = buffer_size; + + /* we only need to write the block if it is different from the fill pattern. + * If the read method does not find a block it will deliver the fill pattern anyway. + */ + + key = bsearch( + &block_key, + sparse_disk->key_table, + sparse_disk->used_count, + sizeof( rtems_sparse_disk_key ), + sparse_disk_compare + ); + + if ( NULL == key ) { + for ( i = 0; ( !block_needs_writing ) && ( i < bytes_to_copy ); ++i ) { + if ( buffer[i] != sparse_disk->fill_pattern ) + block_needs_writing = true; + } + + if ( block_needs_writing ) { + key = sparse_disk_get_new_block( sparse_disk, block ); + } + } + + if ( NULL != key ) + memcpy( key->data, buffer, bytes_to_copy ); + else if ( block_needs_writing ) + return -1; + + return bytes_to_copy; +} + +/* + * Read/write handling + */ +static int sparse_disk_read_write( + rtems_sparse_disk *sparse_disk, + rtems_blkdev_request *req, + const bool read ) +{ + int rv = 0; + uint32_t req_buffer; + rtems_blkdev_sg_buffer *scatter_gather; + rtems_blkdev_bnum block; + uint8_t *buff; + size_t buff_size; + unsigned int bytes_handled; + + rtems_semaphore_obtain( sparse_disk->mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + + for ( req_buffer = 0; + ( 0 <= rv ) && ( req_buffer < req->bufnum ); + ++req_buffer ) { + scatter_gather = &req->bufs[req_buffer]; + + bytes_handled = 0; + buff = (uint8_t *) scatter_gather->buffer; + block = scatter_gather->block; + buff_size = scatter_gather->length; + + while ( ( 0 <= rv ) && ( 0 < buff_size ) ) { + if ( read ) + rv = sparse_disk_read_block( sparse_disk, + block, + &buff[bytes_handled], + buff_size ); + else + rv = sparse_disk_write_block( sparse_disk, + block, + &buff[bytes_handled], + buff_size ); + + ++block; + bytes_handled += rv; + buff_size -= rv; + } + } + + rtems_semaphore_release( sparse_disk->mutex ); + + if ( 0 > rv ) + rtems_blkdev_request_done( req, RTEMS_IO_ERROR ); + else + rtems_blkdev_request_done( req, RTEMS_SUCCESSFUL ); + + return 0; +} + +/* + * ioctl handler to be passed to the block device handler + */ +static int sparse_disk_ioctl( rtems_disk_device *dd, uint32_t req, void *argp ) +{ + rtems_status_code sc; + rtems_sparse_disk *sd = rtems_disk_get_driver_data( dd ); + + if ( RTEMS_BLKIO_REQUEST == req ) { + rtems_blkdev_request *r = argp; + + switch ( r->req ) { + case RTEMS_BLKDEV_REQ_READ: + case RTEMS_BLKDEV_REQ_WRITE: + return sparse_disk_read_write( sd, r, r->req == RTEMS_BLKDEV_REQ_READ ); + default: + break; + } + } else if ( RTEMS_BLKIO_DELETED == req ) { + sc = rtems_semaphore_delete( sd->mutex ); + + if ( RTEMS_SUCCESSFUL != sc ) + rtems_fatal_error_occurred( 0xdeadbeef ); + + sd->mutex = RTEMS_ID_NONE; + + if ( NULL != sd->delete_handler ) + ( *sd->delete_handler )( sd ); + + return 0; + } else { + return rtems_blkdev_ioctl( dd, req, argp ); + } + + errno = EINVAL; + return -1; +} + +void rtems_sparse_disk_free( rtems_sparse_disk *sd ) +{ + free( sd ); +} + +rtems_status_code rtems_sparse_disk_create_and_register( + const char *device_file_name, + uint32_t media_block_size, + rtems_blkdev_bnum blocks_with_buffer, + rtems_blkdev_bnum media_block_count, + uint8_t fill_pattern ) +{ + rtems_status_code sc = RTEMS_SUCCESSFUL; + rtems_sparse_disk *sparse_disk = sparse_disk_allocate( + media_block_size, + blocks_with_buffer + ); + + if ( sparse_disk != NULL ) { + sc = rtems_sparse_disk_register( + device_file_name, + sparse_disk, + media_block_size, + blocks_with_buffer, + media_block_count, + fill_pattern, + rtems_sparse_disk_free + ); + } else { + sc = RTEMS_NO_MEMORY; + } + + return sc; +} + +rtems_status_code rtems_sparse_disk_register( + const char *device_file_name, + rtems_sparse_disk *sparse_disk, + uint32_t media_block_size, + rtems_blkdev_bnum blocks_with_buffer, + rtems_blkdev_bnum media_block_count, + uint8_t fill_pattern, + rtems_sparse_disk_delete_handler sparse_disk_delete ) +{ + rtems_status_code sc; + + if ( blocks_with_buffer <= media_block_count ) { + sc = sparse_disk_initialize( + sparse_disk, + media_block_size, + blocks_with_buffer, + sparse_disk_delete, + fill_pattern + ); + + if ( RTEMS_SUCCESSFUL == sc ) { + sc = rtems_blkdev_create( + device_file_name, + media_block_size, + media_block_count, + sparse_disk_ioctl, + sparse_disk + ); + } + } else { + sc = RTEMS_INVALID_NUMBER; + } + + return sc; +} diff --git a/cpukit/libcsupport/include/rtems/assoc.h b/cpukit/libcsupport/include/rtems/assoc.h index f55d3fe376..80a2fe7cdf 100644 --- a/cpukit/libcsupport/include/rtems/assoc.h +++ b/cpukit/libcsupport/include/rtems/assoc.h @@ -9,6 +9,11 @@ #ifndef _RTEMS_RTEMS_ASSOC_H #define _RTEMS_RTEMS_ASSOC_H +/** + * @defgroup Associativity Routines + */ +/**@{*/ + #include <stdint.h> /* uint32_t */ #ifdef __cplusplus @@ -51,6 +56,10 @@ uint32_t rtems_assoc_remote_by_name( const rtems_assoc_t *, const char * ); + +/** + * @brief RTEMS Associate Local by Name + */ uint32_t rtems_assoc_local_by_name( const rtems_assoc_t *, const char * @@ -66,6 +75,9 @@ const char *rtems_assoc_name_by_remote( uint32_t ); +/** + * @brief RTEMS Assoc Routines + */ uint32_t rtems_assoc_remote_by_local_bitfield( const rtems_assoc_t *, uint32_t @@ -111,5 +123,5 @@ const char *rtems_assoc_name_bad( #ifdef __cplusplus } #endif - +/**@}*/ #endif /* ! _RTEMS_RTEMS_ASSOC_H */ diff --git a/cpukit/libcsupport/include/rtems/deviceio.h b/cpukit/libcsupport/include/rtems/deviceio.h index d1d37fdfd1..637eef4f6c 100644 --- a/cpukit/libcsupport/include/rtems/deviceio.h +++ b/cpukit/libcsupport/include/rtems/deviceio.h @@ -1,3 +1,7 @@ +/** + * @file rtems/deviceio.h + */ + /* * COPYRIGHT (c) 1989-2012. * On-Line Applications Research Corporation (OAR). @@ -10,12 +14,25 @@ #ifndef _RTEMS_DEVICEIO_H #define _RTEMS_DEVICEIO_H +/** + * @defgroup Device IO Handler + */ +/**@{*/ + #include <rtems/libio.h> #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +/** + * @brief IMFS Device Node Handlers + * + * IMFS Device Node Handlers + * + * This file contains the set of handlers used to map operations on + * IMFS device nodes onto calls to the RTEMS Classic API IO Manager. + */ int rtems_deviceio_errno( rtems_status_code status ); int rtems_deviceio_open( @@ -59,6 +76,8 @@ int rtems_deviceio_control( #ifdef __cplusplus } -#endif /* __cplusplus */ +#endif +/**@}*/ +/* __cplusplus */ #endif /* _RTEMS_DEVICEIO_H */ diff --git a/cpukit/libcsupport/include/rtems/libio_.h b/cpukit/libcsupport/include/rtems/libio_.h index 4f7a432e9a..98f6f63d4d 100644 --- a/cpukit/libcsupport/include/rtems/libio_.h +++ b/cpukit/libcsupport/include/rtems/libio_.h @@ -29,6 +29,14 @@ extern "C" { #endif +/** + * @defgroup LibIOInternal IO Internal Library + * + * @brief Internal IO library API and implementation. + * + * @{ + */ + #define RTEMS_FILESYSTEM_SYMLOOP_MAX 32 /* @@ -800,6 +808,8 @@ static inline bool rtems_filesystem_is_parent_directory( return tokenlen == 2 && token [0] == '.' && token [1] == '.'; } +/** @} */ + #ifdef __cplusplus } #endif diff --git a/cpukit/libcsupport/include/sys/utsname.h b/cpukit/libcsupport/include/sys/utsname.h index ca9e18e799..a56d74abfd 100644 --- a/cpukit/libcsupport/include/sys/utsname.h +++ b/cpukit/libcsupport/include/sys/utsname.h @@ -16,6 +16,11 @@ #ifndef __POSIX_SYS_UTSNAME_h #define __POSIX_SYS_UTSNAME_h +/** + * @defgroup utsname Service + */ +/**@{*/ + #ifdef __cplusplus extern "C" { #endif @@ -47,10 +52,9 @@ struct utsname { /* is running */ }; -/* - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 +/** + * @brief 4.4.1 Get System Name, P1003.1b-1993, p. 90 */ - int uname( struct utsname *name ); @@ -58,5 +62,6 @@ int uname( #ifdef __cplusplus } #endif +/**@}*/ #endif /* end of include file */ diff --git a/cpukit/libcsupport/src/_realloc_r.c b/cpukit/libcsupport/src/_realloc_r.c index 663812ea12..1dcc44178f 100644 --- a/cpukit/libcsupport/src/_realloc_r.c +++ b/cpukit/libcsupport/src/_realloc_r.c @@ -1,6 +1,11 @@ -/* - * _realloc_r Implementation +/** + * @file * + * @brief _realloc_r Implementation + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/access.c b/cpukit/libcsupport/src/access.c index 3319774e36..5013be53b3 100644 --- a/cpukit/libcsupport/src/access.c +++ b/cpukit/libcsupport/src/access.c @@ -1,6 +1,11 @@ -/* - * access() - POSIX 1003.1b 5.6.3 - File Accessibility +/** + * @file * + * @brief access() - POSIX 1003.1b 5.6.3 - File Accessibility + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/assoclocalbyname.c b/cpukit/libcsupport/src/assoclocalbyname.c index ed2d4cdce2..082ee6d812 100644 --- a/cpukit/libcsupport/src/assoclocalbyname.c +++ b/cpukit/libcsupport/src/assoclocalbyname.c @@ -1,6 +1,17 @@ +/** + * @file + * + * @brief RTEMS Associate Local by Name + * @ingroup Associativity Routines + */ + /* - * assoc.c - * rtems assoc routines + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. */ #if HAVE_CONFIG_H diff --git a/cpukit/libcsupport/src/assocremotebylocalbitfield.c b/cpukit/libcsupport/src/assocremotebylocalbitfield.c index 42c5d14963..bc2e98306d 100644 --- a/cpukit/libcsupport/src/assocremotebylocalbitfield.c +++ b/cpukit/libcsupport/src/assocremotebylocalbitfield.c @@ -1,6 +1,17 @@ +/** + * @file + * + * @brief RTEMS Assoc Routines + * @ingroup Associativity Routines + */ + /* - * assoc.c - * rtems assoc routines + * COPYRIGHT (c) 1989-2008. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. */ #if HAVE_CONFIG_H diff --git a/cpukit/libcsupport/src/chdir.c b/cpukit/libcsupport/src/chdir.c index 88e9fcae68..9c49b9ee5e 100644 --- a/cpukit/libcsupport/src/chdir.c +++ b/cpukit/libcsupport/src/chdir.c @@ -1,6 +1,11 @@ -/* - * chdir() - POSIX 1003.1b - 5.2.1 - Change Current Working Directory +/** + * @file * + * @brief POSIX 1003.1b - 5.2.1 - Change Current Working Directory + * @ingroup libio Internal Interface + */ + +/* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/chroot.c b/cpukit/libcsupport/src/chroot.c index 9e63704f95..36f0eaa536 100644 --- a/cpukit/libcsupport/src/chroot.c +++ b/cpukit/libcsupport/src/chroot.c @@ -1,5 +1,11 @@ +/** + * @file + * + * @brief Change Root Directory + * @ingroup libcsupport + */ + /* - * chroot() - Change Root Directory * Author: fernando.ruiz@ctv.es * * COPYRIGHT (c) 1989-2008. diff --git a/cpukit/libcsupport/src/close.c b/cpukit/libcsupport/src/close.c index 2e6279dfd3..9b86d04d05 100644 --- a/cpukit/libcsupport/src/close.c +++ b/cpukit/libcsupport/src/close.c @@ -1,6 +1,11 @@ -/* - * close() - POSIX 1003.1b 6.3.1 - Close a File +/** + * @file * + * @brief POSIX 1003.1b 6.3.1 - Close a File + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/dup.c b/cpukit/libcsupport/src/dup.c index 324659f544..ddfc425b13 100644 --- a/cpukit/libcsupport/src/dup.c +++ b/cpukit/libcsupport/src/dup.c @@ -1,6 +1,11 @@ -/* - * dup() - POSIX 1003.1b 6.2.1 Duplicate an Open File Descriptor +/** + * @file * + * @brief POSIX 1003.1b 6.2.1 Duplicate an Open File Descriptor + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/fcntl.c b/cpukit/libcsupport/src/fcntl.c index ca04a0c20f..53feb669b1 100644 --- a/cpukit/libcsupport/src/fcntl.c +++ b/cpukit/libcsupport/src/fcntl.c @@ -1,6 +1,11 @@ -/* - * fcntl() - POSIX 1003.1b 6.5.2 - File Control +/** + * @file * + * @brief POSIX 1003.1b 6.5.2 - File Control + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/fdatasync.c b/cpukit/libcsupport/src/fdatasync.c index 3fd84df80e..91ec9da7b0 100644 --- a/cpukit/libcsupport/src/fdatasync.c +++ b/cpukit/libcsupport/src/fdatasync.c @@ -1,6 +1,11 @@ -/* - * fdatasync() - POSIX 1003.1b 6.6.2 - Synchronize the Data of a File +/** + * @file * + * @brief POSIX 1003.1b 6.6.2 - Synchronize the Data of a File + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/free.c b/cpukit/libcsupport/src/free.c index 1e29d74e80..4e31555a5e 100644 --- a/cpukit/libcsupport/src/free.c +++ b/cpukit/libcsupport/src/free.c @@ -1,6 +1,11 @@ -/* - * calloc() +/** + * @file * + * @brief calloc() + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/getcwd.c b/cpukit/libcsupport/src/getcwd.c index 337add2702..6e05c5dd22 100644 --- a/cpukit/libcsupport/src/getcwd.c +++ b/cpukit/libcsupport/src/getcwd.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Get Current Working Directory + * @ingroup libcsupport + */ + /* * Copyright (c) 1989, 1991 The Regents of the University of California. * All rights reserved. diff --git a/cpukit/libcsupport/src/ioctl.c b/cpukit/libcsupport/src/ioctl.c index 4a6a2ef66f..b583722d59 100644 --- a/cpukit/libcsupport/src/ioctl.c +++ b/cpukit/libcsupport/src/ioctl.c @@ -1,6 +1,11 @@ -/* - * ioctl() system call +/** + * @file * + * @brief ioctl() system call + * @ingroup libcsupport + */ + +/* * This routine is not defined in the POSIX 1003.1b standard but is * commonly supported on most UNIX and POSIX systems. * diff --git a/cpukit/libcsupport/src/kill_noposix.c b/cpukit/libcsupport/src/kill_noposix.c index 62270e3499..9d1e1acf82 100644 --- a/cpukit/libcsupport/src/kill_noposix.c +++ b/cpukit/libcsupport/src/kill_noposix.c @@ -1,4 +1,9 @@ -/* +/** + * @file + * + * @brief Kill No POSIX + * @ingroup libcsupport + * * Marginal implementations of some POSIX API routines * to be used when POSIX is disabled. * @@ -6,7 +11,9 @@ * + _kill_r * + __kill * + sleep - * + */ + +/* * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. diff --git a/cpukit/libcsupport/src/posix_memalign.c b/cpukit/libcsupport/src/posix_memalign.c index d67c0caf57..961cff05d7 100644 --- a/cpukit/libcsupport/src/posix_memalign.c +++ b/cpukit/libcsupport/src/posix_memalign.c @@ -1,6 +1,11 @@ -/* - * posix_memalign() +/** + * @file * + * @brief Update call statistics + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/setegid.c b/cpukit/libcsupport/src/setegid.c index d2084595b9..d19ced41f9 100644 --- a/cpukit/libcsupport/src/setegid.c +++ b/cpukit/libcsupport/src/setegid.c @@ -1,3 +1,19 @@ +/** + * @file + * + * @brief Get Real User, Effective User, Ral Group, and Effective Group IDs + * @ingroup libcsupport + */ + +/* + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + #if HAVE_CONFIG_H #include "config.h" #endif diff --git a/cpukit/libcsupport/src/sup_fs_deviceerrno.c b/cpukit/libcsupport/src/sup_fs_deviceerrno.c index 4316496561..b03b32329a 100644 --- a/cpukit/libcsupport/src/sup_fs_deviceerrno.c +++ b/cpukit/libcsupport/src/sup_fs_deviceerrno.c @@ -1,9 +1,14 @@ -/* - * IMFS Device Node Handlers +/** + * @file * - * This file contains the set of handlers used to map operations on - * IMFS device nodes onto calls to the RTEMS Classic API IO Manager. + * @brief IMFS Device Node Handlers + * @ingroup Device IO Handler * + * This file contains the set of handlers used to map operations on + * IMFS device nodes onto calls to the RTEMS Classic API IO Manager. + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libcsupport/src/sup_fs_mount_iterate.c b/cpukit/libcsupport/src/sup_fs_mount_iterate.c index 88cfca828c..67f143c5a9 100644 --- a/cpukit/libcsupport/src/sup_fs_mount_iterate.c +++ b/cpukit/libcsupport/src/sup_fs_mount_iterate.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Mount table entry visitor. + * @ingroup Termios Termios + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/libcsupport/src/utsname.c b/cpukit/libcsupport/src/utsname.c index cc9648510d..5af5e1a97d 100644 --- a/cpukit/libcsupport/src/utsname.c +++ b/cpukit/libcsupport/src/utsname.c @@ -1,3 +1,19 @@ +/** + * @file + * + * @brief Get System Name + * @ingroup utsname Service + */ + +/* + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + #if HAVE_CONFIG_H #include "config.h" #endif diff --git a/cpukit/libcsupport/src/write_r.c b/cpukit/libcsupport/src/write_r.c index 9f63b88222..c5e41b3711 100644 --- a/cpukit/libcsupport/src/write_r.c +++ b/cpukit/libcsupport/src/write_r.c @@ -1,6 +1,11 @@ -/* - * write_r() - POSIX 1003.1b 6.4.2 - Write to a File +/** + * @file * + * @brief POSIX 1003.1b 6.4.2 - Write to a File + * @ingroup libcsupport + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/libfs/src/dosfs/dosfs.h b/cpukit/libfs/src/dosfs/dosfs.h index 93d77892d7..48574664ea 100644 --- a/cpukit/libfs/src/dosfs/dosfs.h +++ b/cpukit/libfs/src/dosfs/dosfs.h @@ -26,58 +26,96 @@ extern "C" { int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data); -#define MSDOS_FMT_FATANY 0 -#define MSDOS_FMT_FAT12 1 -#define MSDOS_FMT_FAT16 2 -#define MSDOS_FMT_FAT32 3 +/** + * @defgroup rtems_msdos_format DOSFS Support + * + * @ingroup FileSystemTypesAndMount + * + * @{ + */ #define MSDOS_FMT_INFO_LEVEL_NONE (0) #define MSDOS_FMT_INFO_LEVEL_INFO (1) #define MSDOS_FMT_INFO_LEVEL_DETAIL (2) #define MSDOS_FMT_INFO_LEVEL_DEBUG (3) -/* - * data to be filled out for formatter: parameters for format call - * any parameter set to 0 or NULL will be automatically detected/computed +/** + * @brief FAT file system format request parameters. */ typedef struct { - const char *OEMName; /* OEM Name string or NULL */ - const char *VolLabel; /* Volume Label string or NULL */ - uint32_t sectors_per_cluster; /* request value: sectors per cluster */ - uint32_t fat_num; /* request value: number of FATs on disk */ - uint32_t files_per_root_dir; /* request value: file entries in root */ - uint8_t fattype; /* request value: MSDOS_FMT_FAT12/16/32 */ - uint8_t media; /* media code. default: 0xF8 */ - bool quick_format; /* true: do not clear out data sectors */ - uint32_t cluster_align; /* requested value: cluster alignment */ - /* make sector number of first sector */ - /* of first cluster divisible by this */ - /* value. This can optimize clusters */ - /* to be located at start of track */ - /* or start of flash block */ - int info_level; /* The amount of info to output */ + /** + * @brief OEM name string or NULL. + */ + const char *OEMName; + + /** + * @brief Volume label string or NULL. + */ + const char *VolLabel; + + /** + * @brief Sectors per cluster hint. + * + * The format procedure may choose another value. Use 0 as default value. + */ + uint32_t sectors_per_cluster; + + /** + * @brief Number of FATs hint. + * + * Use 0 as default value. + */ + uint32_t fat_num; + + /** + * @brief Minimum files in root directory for FAT12 and FAT16. + * + * The format procedure may choose a greater value. Use 0 as default value. + */ + uint32_t files_per_root_dir; + + /** + * @brief Media code. + * + * Use 0 as default value. The default media code is 0xf8. + */ + uint8_t media; + + /** + * @brief Quick format. + * + * If set to true, then do not clear data sectors to zero. + */ + bool quick_format; + + /** + * @brief Do not align FAT, data cluster, and root directory to a cluster + * boundary. + */ + bool skip_alignment; + + /** + * @brief The amount of info to output. + */ + int info_level; } msdos_format_request_param_t; -/*=========================================================================*\ -| Function: | -\*-------------------------------------------------------------------------*/ -int msdos_format -( -/*-------------------------------------------------------------------------*\ -| Purpose: | -| format device with msdos filesystem | -+---------------------------------------------------------------------------+ -| Input Parameters: | -\*-------------------------------------------------------------------------*/ - const char *devname, /* device name */ - const msdos_format_request_param_t *rqdata /* requested fmt parameters */ - /* set to NULL for automatic */ - /* determination */ - ); -/*-------------------------------------------------------------------------*\ -| Return Value: | -| 0, if success, -1 and errno if failed | -\*=========================================================================*/ +/** + * @brief Formats a block device with a FAT file system. + * + * @param[in] devname The block device path. + * @param[in] rqdata The FAT file system format request data. Use NULL for + * default parameters. + * + * @retval 0 Successful operation. + * @retval -1 An error occurred. The @c errno indicates the error. + */ +int msdos_format ( + const char *devname, + const msdos_format_request_param_t *rqdata +); + +/** @} */ #ifdef __cplusplus } diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c index c2c3e89b26..c82bf5ac8b 100644 --- a/cpukit/libfs/src/dosfs/fat.c +++ b/cpukit/libfs/src/dosfs/fat.c @@ -17,88 +17,67 @@ #include <unistd.h> #include <errno.h> #include <stdlib.h> +#include <stdint.h> #include <rtems/libio_.h> #include "fat.h" #include "fat_fat_operations.h" -int -fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type, - rtems_bdbuf_buffer **buf) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - uint8_t i; - bool sec_of_fat; +static int + _fat_block_release(fat_fs_info_t *fs_info); +static ssize_t + fat_cluster_read(fat_fs_info_t *fs_info, + uint32_t cln, + void *buff); - if (fs_info->c.state == FAT_CACHE_EMPTY) - { - if (op_type == FAT_OP_TYPE_READ) - sc = rtems_bdbuf_read(fs_info->vol.dd, blk, &fs_info->c.buf); - else - sc = rtems_bdbuf_get(fs_info->vol.dd, blk, &fs_info->c.buf); - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); - fs_info->c.blk_num = blk; - fs_info->c.modified = 0; - fs_info->c.state = FAT_CACHE_ACTUAL; - } - - sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) && - (fs_info->c.blk_num < fs_info->vol.rdir_loc)); +static inline uint32_t +fat_cluster_num_to_block_num (const fat_fs_info_t *fs_info, + uint32_t cln) +{ + uint32_t blk; - if (fs_info->c.blk_num != blk) + if ( (cln == 0) && (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16)) ) + blk = fat_sector_num_to_block_num(fs_info, fs_info->vol.rdir_loc); + else { - if (fs_info->c.modified) - { - if (sec_of_fat && !fs_info->vol.mirror) - memcpy(fs_info->sec_buf, fs_info->c.buf->buffer, - fs_info->vol.bps); + cln -= FAT_RSRVD_CLN; + blk = cln << (fs_info->vol.bpc_log2 - fs_info->vol.bytes_per_block_log2); + blk += fat_sector_num_to_block_num(fs_info, fs_info->vol.data_fsec); + } - sc = rtems_bdbuf_release_modified(fs_info->c.buf); - fs_info->c.state = FAT_CACHE_EMPTY; - fs_info->c.modified = 0; - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); + return blk; +} - if (sec_of_fat && !fs_info->vol.mirror) - { - rtems_bdbuf_buffer *b; +int +fat_buf_access(fat_fs_info_t *fs_info, + const uint32_t sec_num, + const int op_type, + uint8_t **sec_buf) +{ + rtems_status_code sc = RTEMS_SUCCESSFUL; + uint32_t blk = fat_sector_num_to_block_num (fs_info, + sec_num); + uint32_t blk_ofs = fat_sector_offset_to_block_offset (fs_info, + sec_num, + 0); - for (i = 1; i < fs_info->vol.fats; i++) - { - sc = rtems_bdbuf_get(fs_info->vol.dd, - fs_info->c.blk_num + - fs_info->vol.fat_length * i, - &b); - if ( sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(ENOMEM); - memcpy(b->buffer, fs_info->sec_buf, fs_info->vol.bps); - sc = rtems_bdbuf_release_modified(b); - if ( sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(ENOMEM); - } - } - } - else - { - sc = rtems_bdbuf_release(fs_info->c.buf); - fs_info->c.state = FAT_CACHE_EMPTY; - if (sc != RTEMS_SUCCESSFUL) - rtems_set_errno_and_return_minus_one(EIO); + if (fs_info->c.state == FAT_CACHE_EMPTY || fs_info->c.blk_num != sec_num) + { + fat_buf_release(fs_info); - } if (op_type == FAT_OP_TYPE_READ) sc = rtems_bdbuf_read(fs_info->vol.dd, blk, &fs_info->c.buf); else sc = rtems_bdbuf_get(fs_info->vol.dd, blk, &fs_info->c.buf); if (sc != RTEMS_SUCCESSFUL) rtems_set_errno_and_return_minus_one(EIO); - fs_info->c.blk_num = blk; + fs_info->c.blk_num = sec_num; + fs_info->c.modified = 0; fs_info->c.state = FAT_CACHE_ACTUAL; } - *buf = fs_info->c.buf; + *sec_buf = &fs_info->c.buf->buffer[blk_ofs]; return RC_OK; } @@ -106,19 +85,24 @@ int fat_buf_release(fat_fs_info_t *fs_info) { rtems_status_code sc = RTEMS_SUCCESSFUL; - uint8_t i; - bool sec_of_fat; if (fs_info->c.state == FAT_CACHE_EMPTY) return RC_OK; - sec_of_fat = ((fs_info->c.blk_num >= fs_info->vol.fat_loc) && - (fs_info->c.blk_num < fs_info->vol.rdir_loc)); - if (fs_info->c.modified) { + uint32_t sec_num = fs_info->c.blk_num; + bool sec_of_fat = ((sec_num >= fs_info->vol.fat_loc) && + (sec_num < fs_info->vol.rdir_loc)); + uint32_t blk = fat_sector_num_to_block_num(fs_info, sec_num); + uint32_t blk_ofs = fat_sector_offset_to_block_offset(fs_info, + sec_num, + 0); + if (sec_of_fat && !fs_info->vol.mirror) - memcpy(fs_info->sec_buf, fs_info->c.buf->buffer, fs_info->vol.bps); + memcpy(fs_info->sec_buf, + fs_info->c.buf->buffer + blk_ofs, + fs_info->vol.bps); sc = rtems_bdbuf_release_modified(fs_info->c.buf); if (sc != RTEMS_SUCCESSFUL) @@ -127,18 +111,31 @@ fat_buf_release(fat_fs_info_t *fs_info) if (sec_of_fat && !fs_info->vol.mirror) { - rtems_bdbuf_buffer *b; + uint8_t i; for (i = 1; i < fs_info->vol.fats; i++) { - sc = rtems_bdbuf_get(fs_info->vol.dd, - fs_info->c.blk_num + - fs_info->vol.fat_length * i, - &b); + rtems_bdbuf_buffer *bd; + + sec_num = fs_info->c.blk_num + fs_info->vol.fat_length * i, + blk = fat_sector_num_to_block_num(fs_info, sec_num); + blk_ofs = fat_sector_offset_to_block_offset(fs_info, + sec_num, + 0); + + if (blk_ofs == 0 + && fs_info->vol.bps == fs_info->vol.bytes_per_block) + { + sc = rtems_bdbuf_get(fs_info->vol.dd, blk, &bd); + } + else + { + sc = rtems_bdbuf_read(fs_info->vol.dd, blk, &bd); + } if ( sc != RTEMS_SUCCESSFUL) rtems_set_errno_and_return_minus_one(ENOMEM); - memcpy(b->buffer, fs_info->sec_buf, fs_info->vol.bps); - sc = rtems_bdbuf_release_modified(b); + memcpy(bd->buffer + blk_ofs, fs_info->sec_buf, fs_info->vol.bps); + sc = rtems_bdbuf_release_modified(bd); if ( sc != RTEMS_SUCCESSFUL) rtems_set_errno_and_return_minus_one(ENOMEM); } @@ -182,29 +179,66 @@ _fat_block_read( { int rc = RC_OK; ssize_t cmpltd = 0; - uint32_t blk = start; + uint32_t sec_num = start; uint32_t ofs = offset; - rtems_bdbuf_buffer *block = NULL; + uint8_t *sec_buf; uint32_t c = 0; while (count > 0) { - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block); + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_READ, &sec_buf); if (rc != RC_OK) return -1; c = MIN(count, (fs_info->vol.bps - ofs)); - memcpy((buff + cmpltd), (block->buffer + ofs), c); + memcpy((buff + cmpltd), (sec_buf + ofs), c); count -= c; cmpltd += c; - blk++; + sec_num++; ofs = 0; } return cmpltd; } -/* _fat_block_write -- +static ssize_t + fat_block_write( + fat_fs_info_t *fs_info, + const uint32_t start_blk, + const uint32_t offset, + const uint32_t count, + const void *buf, + const bool overwrite_block) +{ + int rc = RC_OK; + uint32_t bytes_to_write = MIN(count, (fs_info->vol.bytes_per_block - offset)); + uint8_t *blk_buf; + uint32_t sec_num = fat_block_num_to_sector_num(fs_info, start_blk); + + if (0 < bytes_to_write) + { + if ( overwrite_block + || (bytes_to_write == fs_info->vol.bytes_per_block)) + { + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_GET, &blk_buf); + } + else + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_READ, &blk_buf); + + if (RC_OK == rc) + { + memcpy(blk_buf + offset, buf, bytes_to_write); + + fat_buf_mark_modified(fs_info); + } + } + if (RC_OK != rc) + return rc; + else + return bytes_to_write; +} + +/* fat_sector_write -- * This function write 'count' bytes to device filesystem is mounted on, * starts at 'start+offset' position where 'start' computed in sectors * and 'offset' is offset inside sector (writing may cross sectors @@ -222,7 +256,7 @@ _fat_block_read( * and errno set appropriately */ ssize_t -_fat_block_write( +fat_sector_write( fat_fs_info_t *fs_info, uint32_t start, uint32_t offset, @@ -231,67 +265,112 @@ _fat_block_write( { int rc = RC_OK; ssize_t cmpltd = 0; - uint32_t blk = start; + uint32_t sec_num = start; uint32_t ofs = offset; - rtems_bdbuf_buffer *block = NULL; + uint8_t *sec_buf; uint32_t c = 0; while(count > 0) { c = MIN(count, (fs_info->vol.bps - ofs)); - if (c == fs_info->vol.bps) - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_GET, &block); + if (c == fs_info->vol.bytes_per_block) + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_GET, &sec_buf); else - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block); + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_READ, &sec_buf); if (rc != RC_OK) return -1; - memcpy((block->buffer + ofs), (buff + cmpltd), c); + memcpy((sec_buf + ofs), (buff + cmpltd), c); fat_buf_mark_modified(fs_info); count -= c; cmpltd +=c; - blk++; + sec_num++; ofs = 0; } return cmpltd; } -int -_fat_block_zero( - fat_fs_info_t *fs_info, - uint32_t start, - uint32_t offset, - uint32_t count) +static ssize_t + fat_block_set ( + fat_fs_info_t *fs_info, + const uint32_t start_blk, + const uint32_t offset, + const uint32_t count, + const uint8_t pattern) { - int rc = RC_OK; - uint32_t blk = start; - uint32_t ofs = offset; - rtems_bdbuf_buffer *block = NULL; - uint32_t c = 0; + int rc = RC_OK; + uint32_t bytes_to_write = MIN(count, (fs_info->vol.bytes_per_block - offset)); + uint8_t *blk_buf; + uint32_t sec_num = fat_block_num_to_sector_num(fs_info, start_blk); - while(count > 0) + if (0 < bytes_to_write) { - c = MIN(count, (fs_info->vol.bps - ofs)); - - if (c == fs_info->vol.bps) - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_GET, &block); + if (bytes_to_write == fs_info->vol.bytes_per_block) + { + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_GET, &blk_buf); + } else - rc = fat_buf_access(fs_info, blk, FAT_OP_TYPE_READ, &block); - if (rc != RC_OK) - return -1; + rc = fat_buf_access(fs_info, sec_num, FAT_OP_TYPE_READ, &blk_buf); - memset((block->buffer + ofs), 0, c); + if (RC_OK == rc) + { + memset(blk_buf + offset, pattern, bytes_to_write); - fat_buf_mark_modified(fs_info); + fat_buf_mark_modified(fs_info); + } + } + if (RC_OK != rc) + return rc; + else + return bytes_to_write; +} - count -= c; - blk++; - ofs = 0; +ssize_t +fat_cluster_set( + fat_fs_info_t *fs_info, + const uint32_t start_cln, + const uint32_t offset, + const uint32_t count, + const uint8_t pattern) +{ + ssize_t rc = RC_OK; + uint32_t bytes_to_write = MIN(count, (fs_info->vol.bpc - offset)); + uint32_t cur_blk = fat_cluster_num_to_block_num(fs_info, start_cln); + uint32_t blocks_in_offset = offset >> fs_info->vol.bytes_per_block_log2; + uint32_t ofs_blk = offset - (blocks_in_offset << fs_info->vol.bytes_per_block_log2); + ssize_t bytes_written = 0; + ssize_t ret; + + cur_blk += blocks_in_offset; + + while ( (RC_OK == rc) + && (0 < bytes_to_write)) + { + uint32_t c = MIN(bytes_to_write, (fs_info->vol.bytes_per_block - ofs_blk)); + + ret = fat_block_set( + fs_info, + cur_blk, + ofs_blk, + c, + pattern); + if (c != ret) + rc = -1; + else + { + bytes_to_write -= ret; + bytes_written += ret; + ++cur_blk; } - return 0; + ofs_blk = 0; + } + if (RC_OK != rc) + return rc; + else + return bytes_written; } /* _fat_block_release -- @@ -338,12 +417,18 @@ fat_cluster_read( } /* fat_cluster_write -- - * wrapper for writting a whole cluster at once + * This function write 'count' bytes to device filesystem is mounted on, + * starts at 'start+offset' position where 'start' computed in clusters + * and 'offset' is offset inside cluster. + * Writing will NOT cross cluster boundaries! * * PARAMETERS: - * fs_info - FS info - * cln - number of cluster to write - * buff - buffer provided by user + * fs_info - FS info + * start_cln - cluster number to start writing to + * offset - offset inside cluster 'start' + * count - count of bytes to write + * buff - buffer provided by user + * overwrite_cluster - true if cluster can get overwritten, false if cluster content must be kept * * RETURNS: * bytes written on success, or -1 if error occured @@ -352,16 +437,55 @@ fat_cluster_read( ssize_t fat_cluster_write( fat_fs_info_t *fs_info, - uint32_t cln, - const void *buff - ) + const uint32_t start_cln, + const uint32_t offset, + const uint32_t count, + const void *buff, + const bool overwrite_cluster) { - uint32_t fsec = 0; - - fsec = fat_cluster_num_to_sector_num(fs_info, cln); + ssize_t rc = RC_OK; + uint32_t bytes_to_write = MIN(count, (fs_info->vol.bpc - offset)); + uint32_t cur_blk = fat_cluster_num_to_block_num(fs_info, start_cln); + uint32_t blocks_in_offset = (offset >> fs_info->vol.bytes_per_block_log2); + uint32_t ofs_blk = offset - (blocks_in_offset << fs_info->vol.bytes_per_block_log2); + ssize_t bytes_written = 0; + uint8_t *buffer = (uint8_t*)buff; + ssize_t ret; + uint32_t c; + + cur_blk += blocks_in_offset; + + while ( (RC_OK == rc) + && (0 < bytes_to_write)) + { + c = MIN(bytes_to_write, (fs_info->vol.bytes_per_block - ofs_blk)); + + ret = fat_block_write( + fs_info, + cur_blk, + ofs_blk, + c, + &buffer[bytes_written], + overwrite_cluster); + if (c != ret) + rc = -1; + else + { + bytes_to_write -= ret; + bytes_written += ret; + ++cur_blk; + } + ofs_blk = 0; + } + if (RC_OK != rc) + return rc; + else + return bytes_written; +} - return _fat_block_write(fs_info, fsec, 0, - fs_info->vol.spc << fs_info->vol.sec_log2, buff); +static bool is_cluster_aligned(const fat_vol_t *vol, uint32_t sec_num) +{ + return (sec_num & (vol->spc - 1)) == 0; } /* fat_init_volume_info -- @@ -444,12 +568,15 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device) close(vol->fd); rtems_set_errno_and_return_minus_one( EINVAL ); } - for (vol->sec_mul = 0, i = (vol->bps >> FAT_SECTOR512_BITS); (i & 1) == 0; i >>= 1, vol->sec_mul++); for (vol->sec_log2 = 0, i = vol->bps; (i & 1) == 0; i >>= 1, vol->sec_log2++); + vol->bytes_per_block = vol->bps; + vol->bytes_per_block_log2 = vol->sec_log2; + vol->sectors_per_block = 1; + vol->spc = FAT_GET_BR_SECTORS_PER_CLUSTER(boot_rec); /* * "sectors per cluster" of zero is invalid @@ -638,6 +765,28 @@ fat_init_volume_info(fat_fs_info_t *fs_info, const char *device) rtems_set_errno_and_return_minus_one( ENOMEM ); } + /* + * If possible we will use the cluster size as bdbuf block size for faster + * file access. This requires that certain sectors are aligned to cluster + * borders. + */ + if (is_cluster_aligned(vol, vol->data_fsec) + && (FAT_FAT32 == vol->type || is_cluster_aligned(vol, vol->rdir_loc))) + { + vol->bytes_per_block = vol->bpc; + vol->bytes_per_block_log2 = vol->bpc_log2; + vol->sectors_per_block = vol->spc; + sc = rtems_bdbuf_set_block_size (vol->dd, vol->bytes_per_block, true); + if (RTEMS_SUCCESSFUL != sc) + { + close(vol->fd); + free(fs_info->vhash); + free(fs_info->rhash); + free(fs_info->uino); + rtems_set_errno_and_return_minus_one( EIO ); + } + } + return RC_OK; } @@ -666,7 +815,7 @@ fat_fat32_update_fsinfo_sector(fat_fs_info_t *fs_info) fs_info->vol.free_cls_in_fs_info = free_count; - ret1 = _fat_block_write(fs_info, + ret1 = fat_sector_write(fs_info, fs_info->vol.info_sec, FAT_FSINFO_FREE_CLUSTER_COUNT_OFFSET, sizeof(le_free_count), @@ -679,7 +828,7 @@ fat_fat32_update_fsinfo_sector(fat_fs_info_t *fs_info) fs_info->vol.next_cl_in_fs_info = next_free; - ret2 = _fat_block_write(fs_info, + ret2 = fat_sector_write(fs_info, fs_info->vol.info_sec, FAT_FSINFO_NEXT_FREE_CLUSTER_OFFSET, sizeof(le_next_free), @@ -780,30 +929,23 @@ fat_init_clusters_chain( int rc = RC_OK; ssize_t ret = 0; uint32_t cur_cln = start_cln; - char *buf; - - buf = calloc(fs_info->vol.bpc, sizeof(char)); - if ( buf == NULL ) - rtems_set_errno_and_return_minus_one( EIO ); while ((cur_cln & fs_info->vol.mask) < fs_info->vol.eoc_val) { - ret = fat_cluster_write(fs_info, cur_cln, buf); - if ( ret == -1 ) + ret = fat_cluster_set(fs_info, cur_cln, 0, fs_info->vol.bpc, 0); + if ( ret != fs_info->vol.bpc ) { - free(buf); return -1; } rc = fat_get_fat_cluster(fs_info, cur_cln, &cur_cln); if ( rc != RC_OK ) { - free(buf); return rc; } } - free(buf); + return rc; } diff --git a/cpukit/libfs/src/dosfs/fat.h b/cpukit/libfs/src/dosfs/fat.h index 260d8aafd9..5d36fb45c0 100644 --- a/cpukit/libfs/src/dosfs/fat.h +++ b/cpukit/libfs/src/dosfs/fat.h @@ -271,6 +271,7 @@ extern "C" { #define FAT_TOTAL_FSINFO_SIZE 512 #define MS_BYTES_PER_CLUSTER_LIMIT 0x8000 /* 32K */ +#define MS_BYTES_PER_CLUSTER_LIMIT_FAT12 0x1000 /* 4K */ #define FAT_BR_EXT_FLAGS_MIRROR 0x0080 @@ -297,6 +298,9 @@ typedef struct fat_vol_s uint8_t spc_log2; /* log2 of spc */ uint16_t bpc; /* bytes per cluster */ uint8_t bpc_log2; /* log2 of bytes per cluster */ + uint8_t sectors_per_block; /* sectors per bdbuf block */ + uint16_t bytes_per_block; /* number of bytes for the bduf block device handling */ + uint8_t bytes_per_block_log2; /* log2 of bytes_per_block */ uint8_t fats; /* number of FATs */ uint8_t type; /* FAT type */ uint32_t mask; @@ -435,6 +439,39 @@ fat_cluster_num_to_sector512_num( fs_info->vol.sec_mul); } +static inline uint32_t + fat_block_num_to_cluster_num (const fat_fs_info_t *fs_info, + const uint32_t block_number) +{ + return block_number >> (fs_info->vol.bpc_log2 - fs_info->vol.bytes_per_block_log2); +} + +static inline uint32_t + fat_block_num_to_sector_num (const fat_fs_info_t *fs_info, + const uint32_t block_number) +{ + return block_number << (fs_info->vol.bytes_per_block_log2 - fs_info->vol.sec_log2); +} + +static inline uint32_t + fat_sector_num_to_block_num (const fat_fs_info_t *fs_info, + const uint32_t sector_number) +{ + return sector_number >> (fs_info->vol.bytes_per_block_log2 - fs_info->vol.sec_log2); +} + +static inline uint32_t + fat_sector_offset_to_block_offset (const fat_fs_info_t *fs_info, + const uint32_t sector, + const uint32_t sector_offset) +{ + return sector_offset + + ((sector - + fat_block_num_to_sector_num (fs_info, + fat_sector_num_to_block_num (fs_info, sector))) + << fs_info->vol.sec_log2); +} + static inline void fat_buf_mark_modified(fat_fs_info_t *fs_info) { @@ -442,8 +479,10 @@ fat_buf_mark_modified(fat_fs_info_t *fs_info) } int -fat_buf_access(fat_fs_info_t *fs_info, uint32_t blk, int op_type, - rtems_bdbuf_buffer **buf); +fat_buf_access(fat_fs_info_t *fs_info, + uint32_t sec_num, + int op_type, + uint8_t **sec_buf); int fat_buf_release(fat_fs_info_t *fs_info); @@ -456,30 +495,27 @@ _fat_block_read(fat_fs_info_t *fs_info, void *buff); ssize_t -_fat_block_write(fat_fs_info_t *fs_info, +fat_cluster_write(fat_fs_info_t *fs_info, + uint32_t start_cln, + uint32_t offset, + uint32_t count, + const void *buff, + bool overwrite_cluster); + +ssize_t +fat_sector_write(fat_fs_info_t *fs_info, uint32_t start, uint32_t offset, uint32_t count, const void *buff); -int -_fat_block_zero(fat_fs_info_t *fs_info, - uint32_t start, - uint32_t offset, - uint32_t count); - -int -_fat_block_release(fat_fs_info_t *fs_info); - ssize_t -fat_cluster_read(fat_fs_info_t *fs_info, - uint32_t cln, - void *buff); +fat_cluster_set(fat_fs_info_t *fs_info, + uint32_t start, + uint32_t offset, + uint32_t count, + uint8_t pattern); -ssize_t -fat_cluster_write(fat_fs_info_t *fs_info, - uint32_t cln, - const void *buff); int fat_init_volume_info(fat_fs_info_t *fs_info, const char *device); diff --git a/cpukit/libfs/src/dosfs/fat_fat_operations.c b/cpukit/libfs/src/dosfs/fat_fat_operations.c index e9485d4b18..7496c09272 100644 --- a/cpukit/libfs/src/dosfs/fat_fat_operations.c +++ b/cpukit/libfs/src/dosfs/fat_fat_operations.c @@ -54,6 +54,7 @@ fat_scan_fat_for_free_clusters( uint32_t save_cln = 0; uint32_t data_cls_val = fs_info->vol.data_cls + 2; uint32_t i = 2; + ssize_t bytes_written; *cls_added = 0; @@ -114,13 +115,14 @@ fat_scan_fat_for_free_clusters( goto cleanup; } - if (zero_fill) { - uint32_t sec = fat_cluster_num_to_sector_num(fs_info, - cl4find); - - rc = _fat_block_zero(fs_info, sec, 0, fs_info->vol.bpc); - if ( rc != RC_OK ) + if (zero_fill) + { + bytes_written = fat_cluster_set (fs_info, cl4find, 0, fs_info->vol.bpc, 0); + if (fs_info->vol.bpc != bytes_written) + { + rc = -1; goto cleanup; + } } save_cln = cl4find; @@ -235,7 +237,7 @@ fat_get_fat_cluster( ) { int rc = RC_OK; - rtems_bdbuf_buffer *block0 = NULL; + uint8_t *sec_buf; uint32_t sec = 0; uint32_t ofs = 0; @@ -247,7 +249,7 @@ fat_get_fat_cluster( fs_info->vol.afat_loc; ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1); - rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &block0); + rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &sec_buf); if (rc != RC_OK) return rc; @@ -258,19 +260,19 @@ fat_get_fat_cluster( * we are enforced in complex computations for FAT12 to escape CPU * align problems for some architectures */ - *ret_val = (*((uint8_t *)(block0->buffer + ofs))); + *ret_val = (*(sec_buf + ofs)); if ( ofs == (fs_info->vol.bps - 1) ) { rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); + &sec_buf); if (rc != RC_OK) return rc; - *ret_val |= (*((uint8_t *)(block0->buffer)))<<8; + *ret_val |= *sec_buf << 8; } else { - *ret_val |= (*((uint8_t *)(block0->buffer + ofs + 1)))<<8; + *ret_val |= *(sec_buf + ofs + 1) << 8; } if ( FAT_CLUSTER_IS_ODD(cln) ) @@ -280,12 +282,12 @@ fat_get_fat_cluster( break; case FAT_FAT16: - *ret_val = *((uint16_t *)(block0->buffer + ofs)); + *ret_val = *((uint16_t *)(sec_buf + ofs)); *ret_val = CF_LE_W(*ret_val); break; case FAT_FAT32: - *ret_val = *((uint32_t *)(block0->buffer + ofs)); + *ret_val = *((uint32_t *)(sec_buf + ofs)); *ret_val = CF_LE_L(*ret_val); break; @@ -322,7 +324,7 @@ fat_set_fat_cluster( uint32_t ofs = 0; uint16_t fat16_clv = 0; uint32_t fat32_clv = 0; - rtems_bdbuf_buffer *block0 = NULL; + uint8_t *sec_buf = NULL; /* sanity check */ if ( (cln < 2) || (cln > (fs_info->vol.data_cls + 1)) ) @@ -332,7 +334,7 @@ fat_set_fat_cluster( fs_info->vol.afat_loc; ofs = FAT_FAT_OFFSET(fs_info->vol.type, cln) & (fs_info->vol.bps - 1); - rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &block0); + rc = fat_buf_access(fs_info, sec, FAT_OP_TYPE_READ, &sec_buf); if (rc != RC_OK) return rc; @@ -342,80 +344,65 @@ fat_set_fat_cluster( if ( FAT_CLUSTER_IS_ODD(cln) ) { fat16_clv = ((uint16_t )in_val) << FAT_FAT12_SHIFT; - *((uint8_t *)(block0->buffer + ofs)) = - (*((uint8_t *)(block0->buffer + ofs))) & 0x0F; + *(sec_buf + ofs) &= 0x0F; - *((uint8_t *)(block0->buffer + ofs)) = - (*((uint8_t *)(block0->buffer + ofs))) | - (uint8_t )(fat16_clv & 0x00FF); + *(sec_buf + ofs) |= (uint8_t)(fat16_clv & 0x00F0); fat_buf_mark_modified(fs_info); if ( ofs == (fs_info->vol.bps - 1) ) { rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); + &sec_buf); if (rc != RC_OK) return rc; - *((uint8_t *)(block0->buffer)) &= 0x00; + *sec_buf &= 0x00; - *((uint8_t *)(block0->buffer)) = - (*((uint8_t *)(block0->buffer))) | - (uint8_t )((fat16_clv & 0xFF00)>>8); + *sec_buf |= (uint8_t)((fat16_clv & 0xFF00)>>8); fat_buf_mark_modified(fs_info); } else { - *((uint8_t *)(block0->buffer + ofs + 1)) &= 0x00; + *(sec_buf + ofs + 1) &= 0x00; - *((uint8_t *)(block0->buffer + ofs + 1)) = - (*((uint8_t *)(block0->buffer + ofs + 1))) | - (uint8_t )((fat16_clv & 0xFF00)>>8); + *(sec_buf + ofs + 1) |= (uint8_t )((fat16_clv & 0xFF00)>>8); } } else { fat16_clv = ((uint16_t )in_val) & FAT_FAT12_MASK; - *((uint8_t *)(block0->buffer + ofs)) &= 0x00; + *(sec_buf + ofs) &= 0x00; - *((uint8_t *)(block0->buffer + ofs)) = - (*((uint8_t *)(block0->buffer + ofs))) | - (uint8_t )(fat16_clv & 0x00FF); + *(sec_buf + ofs) |= (uint8_t)(fat16_clv & 0x00FF); fat_buf_mark_modified(fs_info); if ( ofs == (fs_info->vol.bps - 1) ) { rc = fat_buf_access(fs_info, sec + 1, FAT_OP_TYPE_READ, - &block0); + &sec_buf); if (rc != RC_OK) return rc; - *((uint8_t *)(block0->buffer)) = - (*((uint8_t *)(block0->buffer))) & 0xF0; + *sec_buf &= 0xF0; - *((uint8_t *)(block0->buffer)) = - (*((uint8_t *)(block0->buffer))) | - (uint8_t )((fat16_clv & 0xFF00)>>8); + *sec_buf |= (uint8_t)((fat16_clv & 0xFF00)>>8); fat_buf_mark_modified(fs_info); } else { - *((uint8_t *)(block0->buffer + ofs + 1)) = - (*((uint8_t *)(block0->buffer + ofs + 1))) & 0xF0; + *(sec_buf + ofs + 1) &= 0xF0; - *((uint8_t *)(block0->buffer + ofs+1)) = - (*((uint8_t *)(block0->buffer + ofs+1))) | - (uint8_t )((fat16_clv & 0xFF00)>>8); + *(sec_buf + ofs+1) |= (uint8_t)((fat16_clv & 0xFF00)>>8); } } break; case FAT_FAT16: - *((uint16_t *)(block0->buffer + ofs)) = + *((uint16_t *)(sec_buf + ofs)) = (uint16_t )(CT_LE_W(in_val)); fat_buf_mark_modified(fs_info); break; @@ -423,11 +410,9 @@ fat_set_fat_cluster( case FAT_FAT32: fat32_clv = CT_LE_L((in_val & FAT_FAT32_MASK)); - *((uint32_t *)(block0->buffer + ofs)) = - (*((uint32_t *)(block0->buffer + ofs))) & (CT_LE_L(0xF0000000)); + *((uint32_t *)(sec_buf + ofs)) &= CT_LE_L(0xF0000000); - *((uint32_t *)(block0->buffer + ofs)) = - fat32_clv | (*((uint32_t *)(block0->buffer + ofs))); + *((uint32_t *)(sec_buf + ofs)) |= fat32_clv; fat_buf_mark_modified(fs_info); break; diff --git a/cpukit/libfs/src/dosfs/fat_file.c b/cpukit/libfs/src/dosfs/fat_file.c index ddbe02ceb8..43826c9205 100644 --- a/cpukit/libfs/src/dosfs/fat_file.c +++ b/cpukit/libfs/src/dosfs/fat_file.c @@ -339,6 +339,110 @@ fat_file_read( return cmpltd; } +/* fat_is_fat12_or_fat16_root_dir -- + * Returns true for FAT12 root directories respectively FAT16 + * root directories. Returns false for everything else. + * + * PARAMETERS: + * fat_fd - fat-file descriptor + * volume_type - type of fat volume: FAT_FAT12 or FAT_FAT16 or FAT_FAT32 + * + * RETURNS: + * true if conditions for FAT12 root directory or FAT16 root directory + * match, false if not + */ +static bool + fat_is_fat12_or_fat16_root_dir (const fat_file_fd_t *fat_fd, + const uint8_t volume_type) +{ + return (FAT_FD_OF_ROOT_DIR(fat_fd)) && (volume_type & (FAT_FAT12 | FAT_FAT16)); +} + +/* fat_file_write_fat32_or_non_root_dir -- + * Execute fat file write for FAT32 respectively for non-root + * directories of FAT12 or FAT16 + * + * PARAMETERS: + * fs_info - FS info + * fat_fd - fat-file descriptor + * start - offset(in bytes) to write from + * count - count + * buf - buffer provided by user + * file_cln_initial - initial current cluster number of the file + * + * RETURNS: + * number of bytes actually written to the file on success, or -1 if + * error occured (errno set appropriately) + */ +static ssize_t + fat_file_write_fat32_or_non_root_dir( + fat_fs_info_t *fs_info, + fat_file_fd_t *fat_fd, + const uint32_t start, + const uint32_t count, + const uint8_t *buf, + const uint32_t file_cln_initial) +{ + int rc = RC_OK; + uint32_t cmpltd = 0; + uint32_t cur_cln = 0; + uint32_t save_cln = 0; /* FIXME: This might be incorrect, cf. below */ + uint32_t start_cln = start >> fs_info->vol.bpc_log2; + uint32_t ofs_cln = start - (start_cln << fs_info->vol.bpc_log2); + uint32_t ofs_cln_save = ofs_cln; + uint32_t bytes_to_write = count; + uint32_t file_cln_cnt; + ssize_t ret; + uint32_t c; + bool overwrite_cluster = false; + + rc = fat_file_lseek(fs_info, fat_fd, start_cln, &cur_cln); + if (RC_OK == rc) + { + file_cln_cnt = cur_cln - fat_fd->cln; + while ( (RC_OK == rc) + && (bytes_to_write > 0)) + { + c = MIN(bytes_to_write, (fs_info->vol.bpc - ofs_cln)); + + if (file_cln_initial < file_cln_cnt) + overwrite_cluster = true; + + ret = fat_cluster_write(fs_info, + cur_cln, + ofs_cln, + c, + &buf[cmpltd], + overwrite_cluster); + if (0 > ret) + rc = -1; + + if (RC_OK == rc) + { + ++file_cln_cnt; + bytes_to_write -= ret; + cmpltd += ret; + save_cln = cur_cln; + if (0 < bytes_to_write) + rc = fat_get_fat_cluster(fs_info, cur_cln, &cur_cln); + + ofs_cln = 0; + } + } + + /* update cache */ + /* XXX: check this - I'm not sure :( */ + fat_fd->map.file_cln = start_cln + + ((ofs_cln_save + cmpltd - 1) >> fs_info->vol.bpc_log2); + fat_fd->map.disk_cln = save_cln; + } + + if (RC_OK != rc) + return rc; + else + return cmpltd; +} + /* fat_file_write -- * Write 'count' bytes of data from user supplied buffer to fat-file * starting at offset 'start'. This interface hides the architecture @@ -364,18 +468,15 @@ fat_file_write( const uint8_t *buf ) { - int rc = 0; - ssize_t ret = 0; + int rc = RC_OK; + ssize_t ret; uint32_t cmpltd = 0; - uint32_t cur_cln = 0; - uint32_t save_cln = 0; /* FIXME: This might be incorrect, cf. below */ - uint32_t cl_start = 0; - uint32_t ofs = 0; - uint32_t save_ofs; - uint32_t sec = 0; - uint32_t byte = 0; + uint32_t byte; uint32_t c = 0; bool zero_fill = start > fat_fd->fat_file_size; + uint32_t file_cln_initial = fat_fd->map.file_cln; + uint32_t cln; + if ( count == 0 ) return cmpltd; @@ -387,66 +488,51 @@ fat_file_write( count = fat_fd->size_limit - start; rc = fat_file_extend(fs_info, fat_fd, zero_fill, start + count, &c); - if (rc != RC_OK) - return rc; - - /* - * check whether there was enough room on device to locate - * file of 'start + count' bytes - */ - if (c != (start + count)) - count = c - start; - - if ((FAT_FD_OF_ROOT_DIR(fat_fd)) && - (fs_info->vol.type & (FAT_FAT12 | FAT_FAT16))) + if (RC_OK == rc) { - sec = fat_cluster_num_to_sector_num(fs_info, fat_fd->cln); - sec += (start >> fs_info->vol.sec_log2); - byte = start & (fs_info->vol.bps - 1); - - ret = _fat_block_write(fs_info, sec, byte, count, buf); - if ( ret < 0 ) - return -1; - - return ret; + /* + * check whether there was enough room on device to locate + * file of 'start + count' bytes + */ + if (c != (start + count)) + count = c - start; + + /* for the root directory of FAT12 and FAT16 we need this special handling */ + if (fat_is_fat12_or_fat16_root_dir(fat_fd, fs_info->vol.type)) + { + cln = fat_fd->cln; + cln += (start >> fs_info->vol.bpc_log2); + byte = start & (fs_info->vol.bpc -1); + + ret = fat_cluster_write(fs_info, + cln, + byte, + count, + buf, + false); + if (0 > ret) + rc = -1; + else + cmpltd = ret; + } + else + { + ret = fat_file_write_fat32_or_non_root_dir(fs_info, + fat_fd, + start, + count, + buf, + file_cln_initial); + if (0 > ret) + rc = -1; + else + cmpltd = ret; + } } - - cl_start = start >> fs_info->vol.bpc_log2; - save_ofs = ofs = start & (fs_info->vol.bpc - 1); - - rc = fat_file_lseek(fs_info, fat_fd, cl_start, &cur_cln); - if (rc != RC_OK) + if (RC_OK != rc) return rc; - - while (count > 0) - { - c = MIN(count, (fs_info->vol.bpc - ofs)); - - sec = fat_cluster_num_to_sector_num(fs_info, cur_cln); - sec += (ofs >> fs_info->vol.sec_log2); - byte = ofs & (fs_info->vol.bps - 1); - - ret = _fat_block_write(fs_info, sec, byte, c, buf + cmpltd); - if ( ret < 0 ) - return -1; - - count -= c; - cmpltd += c; - save_cln = cur_cln; - rc = fat_get_fat_cluster(fs_info, cur_cln, &cur_cln); - if ( rc != RC_OK ) - return rc; - - ofs = 0; - } - - /* update cache */ - /* XXX: check this - I'm not sure :( */ - fat_fd->map.file_cln = cl_start + - ((save_ofs + cmpltd - 1) >> fs_info->vol.bpc_log2); - fat_fd->map.disk_cln = save_cln; - - return cmpltd; + else + return cmpltd; } /* fat_file_extend -- @@ -482,6 +568,7 @@ fat_file_extend( uint32_t last_cl = 0; uint32_t bytes_remain = 0; uint32_t cls_added; + ssize_t bytes_written; *a_length = new_length; @@ -508,20 +595,14 @@ fat_file_extend( uint32_t cl_start = start >> fs_info->vol.bpc_log2; uint32_t ofs = start & (fs_info->vol.bpc - 1); uint32_t cur_cln; - uint32_t sec; - uint32_t byte; rc = fat_file_lseek(fs_info, fat_fd, cl_start, &cur_cln); if (rc != RC_OK) return rc; - sec = fat_cluster_num_to_sector_num(fs_info, cur_cln); - sec += ofs >> fs_info->vol.sec_log2; - byte = ofs & (fs_info->vol.bps - 1); - - rc = _fat_block_zero(fs_info, sec, byte, bytes_remain); - if (rc != RC_OK) - return rc; + bytes_written = fat_cluster_set (fs_info, cur_cln, ofs, bytes_remain, 0); + if (bytes_remain != bytes_written) + return -1; } /* diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c index 0406be0f58..a5b9c7abb2 100644 --- a/cpukit/libfs/src/dosfs/msdos_file.c +++ b/cpukit/libfs/src/dosfs/msdos_file.c @@ -191,6 +191,7 @@ msdos_file_stat( rtems_status_code sc = RTEMS_SUCCESSFUL; msdos_fs_info_t *fs_info = loc->mt_entry->fs_info; fat_file_fd_t *fat_fd = loc->node_access; + uint32_t cl_mask = fs_info->fat.vol.bpc - 1; sc = rtems_semaphore_obtain(fs_info->vol_sema, RTEMS_WAIT, MSDOS_VOLUME_SEMAPHORE_TIMEOUT); @@ -202,8 +203,9 @@ msdos_file_stat( buf->st_mode = S_IFREG | S_IRWXU | S_IRWXG | S_IRWXO; buf->st_rdev = 0ll; buf->st_size = fat_fd->fat_file_size; - buf->st_blocks = fat_fd->fat_file_size >> FAT_SECTOR512_BITS; - buf->st_blksize = fs_info->fat.vol.bps; + buf->st_blocks = ((fat_fd->fat_file_size + cl_mask) & ~cl_mask) + >> FAT_SECTOR512_BITS; + buf->st_blksize = fs_info->fat.vol.bpc; buf->st_mtime = fat_fd->mtime; rtems_semaphore_release(fs_info->vol_sema); diff --git a/cpukit/libfs/src/dosfs/msdos_format.c b/cpukit/libfs/src/dosfs/msdos_format.c index 305cec9596..0afe6c4cb2 100644 --- a/cpukit/libfs/src/dosfs/msdos_format.c +++ b/cpukit/libfs/src/dosfs/msdos_format.c @@ -64,9 +64,24 @@ typedef struct { char VolLabel[FAT_BR_VOLLAB_SIZE+1]; bool VolLabel_present; uint32_t vol_id; + bool skip_alignment; } msdos_format_param_t; /* + * Align to cluster borders + */ +static uint32_t + loc_align_object (const uint32_t sectors, + const uint32_t clustersize, + const bool skip_alignment) +{ + if (! skip_alignment) + return (sectors + clustersize - 1) & ~(clustersize - 1); + else + return sectors; +} + +/* * Formatted output. */ static void @@ -278,11 +293,15 @@ static int msdos_format_eval_sectors_per_cluster \*-------------------------------------------------------------------------*/ int fattype, /* type code of FAT (FAT_FAT12 ...) */ uint32_t bytes_per_sector, /* byte count per sector (512) */ - uint32_t fatdata_sec_cnt, /* sectors available for FAT and data */ + const uint32_t total_sector_cnt, /* total number of secters per volume */ + const uint32_t rsvd_sector_cnt, /* number of reserved sectors */ + const uint32_t root_dir_sector_cnt,/* number of sectors for the root dir */ uint8_t fat_num, /* number of fat copies */ uint32_t sectors_per_cluster, /* sectors per cluster (requested) */ + const bool skip_alignment, /* true for no cluster alignment */ uint32_t *sectors_per_cluster_adj, /* ret: sec per cluster (granted) */ - uint32_t *sectors_per_fat_ptr /* ret: sectors needed for one FAT */ + uint32_t *sectors_per_fat_ptr, /* ret: sectors needed for one FAT */ + uint32_t *data_cluster_cnt ) /*-------------------------------------------------------------------------*\ | Return Value: | @@ -295,7 +314,8 @@ static int msdos_format_eval_sectors_per_cluster uint32_t fatdata_cluster_cnt; uint32_t fat_capacity; uint32_t sectors_per_fat; - uint32_t data_cluster_cnt; + uint32_t fatdata_sect_cnt; + uint32_t fat_sectors_cnt; /* * ensure, that maximum cluster size (32KByte) is not exceeded */ @@ -310,30 +330,42 @@ static int msdos_format_eval_sectors_per_cluster * - compute storage size for FAT * - subtract from total cluster count */ - fatdata_cluster_cnt = fatdata_sec_cnt/sectors_per_cluster; + fatdata_sect_cnt = total_sector_cnt + - loc_align_object (rsvd_sector_cnt, sectors_per_cluster, skip_alignment); if (fattype == FAT_FAT12) { - fat_capacity = fatdata_cluster_cnt * 3 / 2; + fatdata_sect_cnt = fatdata_sect_cnt + - loc_align_object (root_dir_sector_cnt, sectors_per_cluster, skip_alignment); + fatdata_cluster_cnt = fatdata_sect_cnt/sectors_per_cluster; + fat_capacity = fatdata_cluster_cnt * 3 / 2; } else if (fattype == FAT_FAT16) { - fat_capacity = fatdata_cluster_cnt * 2; + fatdata_sect_cnt = fatdata_sect_cnt + - loc_align_object (root_dir_sector_cnt, sectors_per_cluster, skip_alignment); + fatdata_cluster_cnt = fatdata_sect_cnt/sectors_per_cluster; + fat_capacity = fatdata_cluster_cnt * 2; } else { /* FAT32 */ - fat_capacity = fatdata_cluster_cnt * 4; + fatdata_cluster_cnt = fatdata_sect_cnt/sectors_per_cluster; + fat_capacity = fatdata_cluster_cnt * 4; } sectors_per_fat = ((fat_capacity + (bytes_per_sector - 1)) / bytes_per_sector); - data_cluster_cnt = (fatdata_cluster_cnt - - (((sectors_per_fat * fat_num) + fat_sectors_cnt = loc_align_object (sectors_per_fat * fat_num, + sectors_per_cluster, + skip_alignment); + + *data_cluster_cnt = (fatdata_cluster_cnt - + ((fat_sectors_cnt + (sectors_per_cluster - 1)) / sectors_per_cluster)); /* - * data cluster count too big? then make sectors bigger + * data cluster count too big? Then make clusters bigger */ - if (((fattype == FAT_FAT12) && (data_cluster_cnt > FAT_FAT12_MAX_CLN)) || - ((fattype == FAT_FAT16) && (data_cluster_cnt > FAT_FAT16_MAX_CLN))) { + if (((fattype == FAT_FAT12) && (*data_cluster_cnt > FAT_FAT12_MAX_CLN)) || + ((fattype == FAT_FAT16) && (*data_cluster_cnt > FAT_FAT16_MAX_CLN))) { sectors_per_cluster *= 2; } else { @@ -342,7 +374,12 @@ static int msdos_format_eval_sectors_per_cluster /* * when maximum cluster size is exceeded, we have invalid data, abort... */ - if ((sectors_per_cluster * bytes_per_sector) + if (fattype == FAT_FAT12) { + if (MS_BYTES_PER_CLUSTER_LIMIT_FAT12 < (sectors_per_cluster * bytes_per_sector)) { + ret_val = EINVAL; + finished = true; + } + } else if ((sectors_per_cluster * bytes_per_sector) > MS_BYTES_PER_CLUSTER_LIMIT) { ret_val = EINVAL; finished = true; @@ -352,11 +389,11 @@ static int msdos_format_eval_sectors_per_cluster if (ret_val != 0) { rtems_set_errno_and_return_minus_one(ret_val); } - else { - *sectors_per_cluster_adj = sectors_per_cluster; - *sectors_per_fat_ptr = sectors_per_fat; - return 0; - } + + *sectors_per_cluster_adj = sectors_per_cluster; + *sectors_per_fat_ptr = fat_sectors_cnt / fat_num; + + return 0; } @@ -381,10 +418,12 @@ static int msdos_format_determine_fmt_params \*=========================================================================*/ { int ret_val = 0; - uint32_t fatdata_sect_cnt; uint32_t onebit; uint32_t sectors_per_cluster_adj = 0; uint64_t total_size = 0; + uint32_t data_clusters_cnt; + uint8_t iteration_cnt = 0; + uint8_t fat_type = UINT8_MAX; memset(fmt_params,0,sizeof(*fmt_params)); @@ -393,7 +432,8 @@ static int msdos_format_determine_fmt_params * At least one thing we don't have to magically guess... */ if (ret_val == 0) { - ret_val = rtems_disk_fd_get_block_size(fd, &fmt_params->bytes_per_sector); + ret_val = rtems_disk_fd_get_media_block_size(fd, &fmt_params->bytes_per_sector); + } if (ret_val == 0) { ret_val = rtems_disk_fd_get_block_count(fd, &fmt_params->totl_sector_cnt); @@ -461,150 +501,188 @@ static int msdos_format_determine_fmt_params */ if (ret_val == 0) { fmt_params->sectors_per_cluster = 1; - if ((rqdata != NULL) && - (rqdata->fattype == MSDOS_FMT_FAT12)) { + /* + * limiting values for disk size, fat type, sectors per cluster + * NOTE: maximum sect_per_clust is arbitrarily choosen with values that + * are a compromise concerning capacity and efficency + */ + uint32_t fat12_sect_per_clust = 8; + uint32_t fat16_sect_per_clust = 32; + + if (rqdata != NULL && rqdata->sectors_per_cluster != 0) { + fat12_sect_per_clust = rqdata->sectors_per_cluster; + fat16_sect_per_clust = rqdata->sectors_per_cluster; + } + + if (fmt_params->totl_sector_cnt < FAT_FAT12_MAX_CLN * fat12_sect_per_clust) { fmt_params->fattype = FAT_FAT12; + /* start trying with small clusters */ + fmt_params->sectors_per_cluster = 2; } - else if ((rqdata != NULL) && - (rqdata->fattype == MSDOS_FMT_FAT16)) { + else if (fmt_params->totl_sector_cnt < FAT_FAT16_MAX_CLN * fat16_sect_per_clust) { fmt_params->fattype = FAT_FAT16; + /* start trying with small clusters */ + fmt_params->sectors_per_cluster = 2; } - else if ((rqdata != NULL) && - (rqdata->fattype == MSDOS_FMT_FAT32)) { + else { + #define ONE_GB (1024L * 1024L * 1024L) + uint32_t gigs = (total_size + ONE_GB) / ONE_GB; + int b; fmt_params->fattype = FAT_FAT32; + /* scale with the size of disk... */ + for (b = 31; b > 0; b--) + if ((gigs & (1 << b)) != 0) + break; + fmt_params->sectors_per_cluster = 1 << b; } - else if ((rqdata != NULL) && - (rqdata->fattype != MSDOS_FMT_FATANY)) { - ret_val = -1; - errno = EINVAL; - } - else { + + while (ret_val == 0 && fmt_params->fattype != fat_type) { /* - * limiting values for disk size, fat type, sectors per cluster - * NOTE: maximum sect_per_clust is arbitrarily choosen with values that - * are a compromise concerning capacity and efficency + * try to use user requested cluster size */ - uint32_t fat12_sect_per_clust = 8; - uint32_t fat16_sect_per_clust = 32; - - if (rqdata != NULL && rqdata->sectors_per_cluster != 0) { - fat12_sect_per_clust = rqdata->sectors_per_cluster; - fat16_sect_per_clust = rqdata->sectors_per_cluster; - } - - if (fmt_params->totl_sector_cnt - < FAT_FAT12_MAX_CLN * fat12_sect_per_clust) { - fmt_params->fattype = FAT_FAT12; - /* start trying with small clusters */ - fmt_params->sectors_per_cluster = 2; - } - else if (fmt_params->totl_sector_cnt - < FAT_FAT16_MAX_CLN * fat16_sect_per_clust) { - fmt_params->fattype = FAT_FAT16; - /* start trying with small clusters */ - fmt_params->sectors_per_cluster = 2; + if (rqdata != NULL && rqdata->sectors_per_cluster > 0) { + fmt_params->sectors_per_cluster = rqdata->sectors_per_cluster; } - else { - #define ONE_GB (1024L * 1024L * 1024L) - uint32_t gigs = (total_size + ONE_GB) / ONE_GB; - int b; - fmt_params->fattype = FAT_FAT32; - /* scale with the size of disk... */ - for (b = 31; b > 0; b--) - if ((gigs & (1 << b)) != 0) - break; - fmt_params->sectors_per_cluster = 1 << b; - } - } - /* - * try to use user requested cluster size - */ - if ((rqdata != NULL) && - (rqdata->sectors_per_cluster > 0)) { - fmt_params->sectors_per_cluster = - rqdata->sectors_per_cluster; - } - /* - * check sectors per cluster. - * must be power of 2 - * must be smaller than or equal to 128 - * sectors_per_cluster*bytes_per_sector must not be bigger than 32K - */ - for (onebit = 128;onebit >= 1;onebit = onebit>>1) { - if (fmt_params->sectors_per_cluster >= onebit) { - fmt_params->sectors_per_cluster = onebit; - if (fmt_params->sectors_per_cluster - <= 32768L/fmt_params->bytes_per_sector) { - /* value is small enough so this value is ok */ - onebit = 1; - } + /* + * check sectors per cluster. + * must be power of 2 + * must be smaller than or equal to 128 + * sectors_per_cluster*bytes_per_sector must not be bigger than 32K + */ + for (onebit = 128; onebit >= 1; onebit = onebit >> 1) { + if (fmt_params->sectors_per_cluster >= onebit) { + fmt_params->sectors_per_cluster = onebit; + if (fmt_params->sectors_per_cluster <= 32768L / fmt_params->bytes_per_sector) { + /* value is small enough so this value is ok */ + onebit = 1; + } + } } - } - } - if (ret_val == 0) { - msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_DETAIL, - "sectors per cluster: %d\n", fmt_params->sectors_per_cluster); - - if (fmt_params->fattype == FAT_FAT32) { - /* recommended: for FAT32, always set reserved sector count to 32 */ - fmt_params->rsvd_sector_cnt = 32; - /* for FAT32, always set files per root directory 0 */ - fmt_params->files_per_root_dir = 0; - /* location of copy of MBR */ - fmt_params->mbr_copy_sec = 6; - /* location of fsinfo sector */ - fmt_params->fsinfo_sec = 1; + /* + * Skip aligning structures or d align them + */ + if (ret_val == 0 && rqdata != NULL) + { + fmt_params->skip_alignment = rqdata->skip_alignment; + if (fmt_params->skip_alignment) + fmt_params->sectors_per_cluster = 1; + } - } - else { - /* recommended: for FAT12/FAT16, always set reserved sector count to 1 */ - fmt_params->rsvd_sector_cnt = 1; - /* recommended: for FAT16, set files per root directory to 512 */ - /* for FAT12/FAT16, set files per root directory */ - /* must fill up an even count of sectors */ - if ((rqdata != NULL) && - (rqdata->files_per_root_dir > 0)) { - fmt_params->files_per_root_dir = rqdata->files_per_root_dir; + if (ret_val == 0) { + msdos_format_printf (rqdata, MSDOS_FMT_INFO_LEVEL_DETAIL, + "sectors per cluster: %d\n", fmt_params->sectors_per_cluster); + + if (fmt_params->fattype == FAT_FAT32) { + /* recommended: for FAT32, always set reserved sector count to 32 */ + fmt_params->rsvd_sector_cnt = 32; + /* for FAT32, always set files per root directory 0 */ + fmt_params->files_per_root_dir = 0; + /* location of copy of MBR */ + fmt_params->mbr_copy_sec = 6; + /* location of fsinfo sector */ + fmt_params->fsinfo_sec = 1; + + } + else { + /* recommended: for FAT12/FAT16, always set reserved sector count to 1 */ + fmt_params->rsvd_sector_cnt = 1; + /* recommended: for FAT16, set files per root directory to 512 */ + /* for FAT12/FAT16, set files per root directory */ + /* must fill up an even count of sectors */ + if ((rqdata != NULL) && + (rqdata->files_per_root_dir > 0)) { + fmt_params->files_per_root_dir = rqdata->files_per_root_dir; + } + else { + if (fmt_params->fattype == FAT_FAT16) { + fmt_params->files_per_root_dir = 512; + } + else { + fmt_params->files_per_root_dir = 64; + } + } + fmt_params->files_per_root_dir = (fmt_params->files_per_root_dir + + (2*fmt_params->bytes_per_sector/ + FAT_DIRENTRY_SIZE-1)); + fmt_params->files_per_root_dir -= (fmt_params->files_per_root_dir % + (2*fmt_params->bytes_per_sector + /FAT_DIRENTRY_SIZE)); + + } + fmt_params->root_dir_sectors = + (((fmt_params->files_per_root_dir * FAT_DIRENTRY_SIZE) + + fmt_params->bytes_per_sector - 1) + / fmt_params->bytes_per_sector); } - else { - if (fmt_params->fattype == FAT_FAT16) { - fmt_params->files_per_root_dir = 512; - } - else { - fmt_params->files_per_root_dir = 64; - } + if (ret_val == 0) { + /* + * check values to get legal arrangement of FAT type and cluster count + */ + + ret_val = msdos_format_eval_sectors_per_cluster(fmt_params->fattype, + fmt_params->bytes_per_sector, + fmt_params->totl_sector_cnt, + fmt_params->rsvd_sector_cnt, + fmt_params->root_dir_sectors, + fmt_params->fat_num, + fmt_params->sectors_per_cluster, + fmt_params->skip_alignment, + §ors_per_cluster_adj, + &fmt_params->sectors_per_fat, + &data_clusters_cnt); + fmt_params->sectors_per_cluster = sectors_per_cluster_adj; + fat_type = fmt_params->fattype; + if (data_clusters_cnt < FAT_FAT12_MAX_CLN ) { + fmt_params->fattype = FAT_FAT12; + if (fat_type != fmt_params->fattype) { + /* start trying with small clusters */ + fmt_params->sectors_per_cluster = 2; + } + } + else if (data_clusters_cnt < FAT_FAT16_MAX_CLN) { + fmt_params->fattype = FAT_FAT16; + if (fat_type != fmt_params->fattype) { + /* start trying with small clusters */ + fmt_params->sectors_per_cluster = 2; + } + } + else { + fmt_params->fattype = FAT_FAT32; + if (fat_type != fmt_params->fattype) { + #define ONE_GB (1024L * 1024L * 1024L) + uint32_t gigs = (total_size + ONE_GB) / ONE_GB; + int b; + /* scale with the size of disk... */ + for (b = 31; b > 0; b--) + if ((gigs & (1 << b)) != 0) + break; + fmt_params->sectors_per_cluster = 1 << b; + } + } + if (fat_type != fmt_params->fattype && 1 < iteration_cnt) { + --fmt_params->totl_sector_cnt; + } + } - fmt_params->files_per_root_dir = (fmt_params->files_per_root_dir + - (2*fmt_params->bytes_per_sector/ - FAT_DIRENTRY_SIZE-1)); - fmt_params->files_per_root_dir -= (fmt_params->files_per_root_dir % - (2*fmt_params->bytes_per_sector - /FAT_DIRENTRY_SIZE)); + + ++iteration_cnt; } - fmt_params->root_dir_sectors = - (((fmt_params->files_per_root_dir * FAT_DIRENTRY_SIZE) - + fmt_params->bytes_per_sector - 1) - / fmt_params->bytes_per_sector); } - if (ret_val == 0) { - fatdata_sect_cnt = (fmt_params->totl_sector_cnt - - fmt_params->rsvd_sector_cnt - - fmt_params->root_dir_sectors); - /* - * check values to get legal arrangement of FAT type and cluster count - */ + if (0 == ret_val) + { + if (FAT_FAT32 != fmt_params->fattype) + { + fmt_params->files_per_root_dir = loc_align_object (fmt_params->root_dir_sectors, + fmt_params->sectors_per_cluster, + fmt_params->skip_alignment) + * (fmt_params->bytes_per_sector / FAT_DIRENTRY_SIZE); + } - ret_val = msdos_format_eval_sectors_per_cluster - (fmt_params->fattype, - fmt_params->bytes_per_sector, - fatdata_sect_cnt, - fmt_params->fat_num, - fmt_params->sectors_per_cluster, - §ors_per_cluster_adj, - &(fmt_params->sectors_per_fat)); - fmt_params->sectors_per_cluster = sectors_per_cluster_adj; + fmt_params->rsvd_sector_cnt = loc_align_object (fmt_params->rsvd_sector_cnt, + fmt_params->sectors_per_cluster, + fmt_params->skip_alignment); } /* @@ -725,6 +803,7 @@ static int msdos_format_determine_fmt_params return 0; } } + /*=========================================================================*\ | Function: | \*-------------------------------------------------------------------------*/ @@ -1063,7 +1142,9 @@ int msdos_format * write FAT entry 1 as EOC * allocate directory in a FAT32 FS */ - if ((ret_val == 0) && fmt_params.VolLabel_present){ + if (ret_val == 0) { + uint32_t start_sector; + /* * empty sector: all clusters are free/do not link further on */ @@ -1106,15 +1187,19 @@ int msdos_format */ FAT_SET_VAL32(tmp_sec,8,FAT_FAT32_EOC); } + + start_sector = loc_align_object (fmt_params.rsvd_sector_cnt, + fmt_params.sectors_per_cluster, + fmt_params.skip_alignment); for (i = 0; (i < fmt_params.fat_num) && (ret_val == 0); i++) { ret_val = msdos_format_write_sec - (fd, - fmt_params.rsvd_sector_cnt - + (i * fmt_params.sectors_per_fat), - fmt_params.bytes_per_sector, - tmp_sec); + (fd, + start_sector + + (i * fmt_params.sectors_per_fat), + fmt_params.bytes_per_sector, + tmp_sec); } } /* diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c index f4de0d5915..5ebf257b5a 100644 --- a/cpukit/libfs/src/dosfs/msdos_misc.c +++ b/cpukit/libfs/src/dosfs/msdos_misc.c @@ -641,7 +641,7 @@ msdos_set_dir_wrt_time_and_date( msdos_date_unix2dos(fat_fd->mtime, &date, &time_val); /* - * calculate input for _fat_block_write: convert (cluster num, offset) to + * calculate input for fat_sector_write: convert (cluster num, offset) to * (sector num, new offset) */ sec = fat_cluster_num_to_sector_num(&fs_info->fat, fat_fd->dir_pos.sname.cln); @@ -650,12 +650,12 @@ msdos_set_dir_wrt_time_and_date( byte = fat_fd->dir_pos.sname.ofs & (fs_info->fat.vol.bps - 1); time_val = CT_LE_W(time_val); - ret1 = _fat_block_write(&fs_info->fat, sec, byte + MSDOS_FILE_WTIME_OFFSET, + ret1 = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FILE_WTIME_OFFSET, 2, (char *)(&time_val)); date = CT_LE_W(date); - ret2 = _fat_block_write(&fs_info->fat, sec, byte + MSDOS_FILE_WDATE_OFFSET, + ret2 = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FILE_WDATE_OFFSET, 2, (char *)(&date)); - ret3 = _fat_block_write(&fs_info->fat, sec, byte + MSDOS_FILE_ADATE_OFFSET, + ret3 = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FILE_ADATE_OFFSET, 2, (char *)(&date)); if ( (ret1 < 0) || (ret2 < 0) || (ret3 < 0) ) @@ -691,7 +691,7 @@ msdos_set_first_cluster_num( uint32_t byte = 0; /* - * calculate input for _fat_block_write: convert (cluster num, offset) to + * calculate input for fat_sector_write: convert (cluster num, offset) to * (sector num, new offset) */ sec = fat_cluster_num_to_sector_num(&fs_info->fat, fat_fd->dir_pos.sname.cln); @@ -700,11 +700,11 @@ msdos_set_first_cluster_num( byte = fat_fd->dir_pos.sname.ofs & (fs_info->fat.vol.bps - 1); le_cl_low = CT_LE_W((uint16_t )(new_cln & 0x0000FFFF)); - ret1 = _fat_block_write(&fs_info->fat, sec, + ret1 = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FIRST_CLUSTER_LOW_OFFSET, 2, (char *)(&le_cl_low)); le_cl_hi = CT_LE_W((uint16_t )((new_cln & 0xFFFF0000) >> 16)); - ret2 = _fat_block_write(&fs_info->fat, sec, + ret2 = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FIRST_CLUSTER_HI_OFFSET, 2, (char *)(&le_cl_hi)); if ( (ret1 < 0) || (ret2 < 0) ) @@ -742,7 +742,7 @@ msdos_set_file_size( byte = (fat_fd->dir_pos.sname.ofs & (fs_info->fat.vol.bps - 1)); le_new_length = CT_LE_L((fat_fd->fat_file_size)); - ret = _fat_block_write(&fs_info->fat, sec, byte + MSDOS_FILE_SIZE_OFFSET, 4, + ret = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FILE_SIZE_OFFSET, 4, (char *)(&le_new_length)); if ( ret < 0 ) return -1; @@ -802,7 +802,7 @@ msdos_set_first_char4file_name( (start.ofs >> fs_info->fat.vol.sec_log2)); uint32_t byte = (start.ofs & (fs_info->fat.vol.bps - 1)); - ret = _fat_block_write(&fs_info->fat, sec, byte + MSDOS_FILE_NAME_OFFSET, + ret = fat_sector_write(&fs_info->fat, sec, byte + MSDOS_FILE_NAME_OFFSET, 1, &fchar); if (ret < 0) return -1; diff --git a/cpukit/libmisc/shell/main_msdosfmt.c b/cpukit/libmisc/shell/main_msdosfmt.c index e684246979..b57d9162d9 100644 --- a/cpukit/libmisc/shell/main_msdosfmt.c +++ b/cpukit/libmisc/shell/main_msdosfmt.c @@ -33,10 +33,9 @@ static int rtems_shell_main_msdos_format( .sectors_per_cluster = 0, .fat_num = 0, .files_per_root_dir = 0, - .fattype = MSDOS_FMT_FATANY, .media = 0, .quick_format = TRUE, - .cluster_align = 0, + .skip_alignment = 0, .info_level = 0 }; @@ -92,27 +91,6 @@ static int rtems_shell_main_msdos_format( rqdata.files_per_root_dir = (uint32_t) tmp; break; - case 't': - arg++; - if (arg == argc) { - fprintf (stderr, "error: no FAT type.\n"); - return 1; - } - - if (strcmp (argv[arg], "any") == 0) - rqdata.fattype = MSDOS_FMT_FATANY; - else if (strcmp (argv[arg], "12") == 0) - rqdata.fattype = MSDOS_FMT_FAT12; - else if (strcmp (argv[arg], "16") == 0) - rqdata.fattype = MSDOS_FMT_FAT16; - else if (strcmp (argv[arg], "32") == 0) - rqdata.fattype = MSDOS_FMT_FAT32; - else { - fprintf (stderr, "error: invalid type, can any, 12, 16, or 32\n"); - return 1; - } - break; - case 'v': rqdata.info_level++; break; @@ -146,10 +124,9 @@ static int rtems_shell_main_msdos_format( printf (" %-20s: %" PRIu32 "\n", "sectors per cluster", rqdata.sectors_per_cluster); printf (" %-20s: %" PRIu32 "\n", "fats", rqdata.fat_num); printf (" %-20s: %" PRIu32 "\n", "files per root dir", rqdata.files_per_root_dir); - printf (" %-20s: %i\n", "fat type", rqdata.fattype); printf (" %-20s: %d\n", "media", rqdata.media); printf (" %-20s: %d\n", "quick_format", rqdata.quick_format); - printf (" %-20s: %" PRIu32 "\n", "cluster align", rqdata.cluster_align); + printf (" %-20s: %s\n", "skip_alignment", (0 == rqdata.skip_alignment) ? "false" : "true"); } if (msdos_format (driver, &rqdata) < 0) { @@ -162,7 +139,7 @@ static int rtems_shell_main_msdos_format( return 0; } -#define OPTIONS "[-V label] [-s sectors/cluster] [-r size] [-t any/12/16/32] [-v]" +#define OPTIONS "[-V label] [-s sectors/cluster] [-r size] [-v]" rtems_shell_cmd_t rtems_shell_MSDOSFMT_Command = { "mkdos", /* name */ diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index 5f1c00fa60..78ea3f5443 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -34,6 +34,7 @@ include_rtems_posix_HEADERS += include/rtems/posix/mutex.h include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h include_rtems_posix_HEADERS += include/rtems/posix/priority.h include_rtems_posix_HEADERS += include/rtems/posix/psignal.h +include_rtems_posix_HEADERS += include/rtems/posix/psignalimpl.h include_rtems_posix_HEADERS += include/rtems/posix/pthread.h include_rtems_posix_HEADERS += include/rtems/posix/ptimer.h include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h diff --git a/cpukit/posix/include/rtems/posix/psignal.h b/cpukit/posix/include/rtems/posix/psignal.h index c630c1fd5f..604b98982c 100644 --- a/cpukit/posix/include/rtems/posix/psignal.h +++ b/cpukit/posix/include/rtems/posix/psignal.h @@ -16,44 +16,9 @@ #ifndef _RTEMS_POSIX_PSIGNAL_H #define _RTEMS_POSIX_PSIGNAL_H -#include <rtems/posix/pthread.h> -#include <rtems/posix/sigset.h> +#include <sys/signal.h> -#define _States_Is_interruptible_signal( _states ) \ - ( ((_states) & \ - (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ - (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) - -#define SIGACTION_TERMINATE \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } -#define SIGACTION_IGNORE \ - { 0, SIGNAL_ALL_MASK, {SIG_IGN} } -#define SIGACTION_STOP \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } -#define SIGACTION_CONTINUE \ - { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } - -#define SIG_ARRAY_MAX (SIGRTMAX + 1) - -/* - * Variables - */ - -extern sigset_t _POSIX_signals_Pending; - -extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; - -extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ]; - -extern Watchdog_Control _POSIX_signals_Alarm_timer; - -extern Watchdog_Control _POSIX_signals_Ualarm_timer; - -extern Thread_queue_Control _POSIX_signals_Wait_queue; - -extern Chain_Control _POSIX_signals_Inactive_siginfo; - -extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; +#include <rtems/score/chain.h> /* * POSIX internal siginfo structure @@ -64,58 +29,5 @@ typedef struct { siginfo_t Info; } POSIX_signals_Siginfo_node; -/* - * Internal routines - */ - -void _POSIX_signals_Manager_Initialization(void); - -void _POSIX_signals_Post_switch_extension( - Thread_Control *the_thread -); - -bool _POSIX_signals_Unblock_thread( - Thread_Control *the_thread, - int signo, - siginfo_t *info -); - -bool _POSIX_signals_Check_signal( - POSIX_API_Control *api, - int signo, - bool is_global -); - -bool _POSIX_signals_Clear_signals( - POSIX_API_Control *api, - int signo, - siginfo_t *info, - bool is_global, - bool check_blocked -); - -int killinfo( - pid_t pid, - int sig, - const union sigval *value -); - -void _POSIX_signals_Set_process_signals( - sigset_t mask -); - -void _POSIX_signals_Clear_process_signals( - int signo -); - -/* - * Default signal handlers - */ - -#define _POSIX_signals_Stop_handler NULL -#define _POSIX_signals_Continue_handler NULL - -void _POSIX_signals_Abnormal_termination_handler( int signo ); - #endif /* end of file */ diff --git a/cpukit/posix/include/rtems/posix/psignalimpl.h b/cpukit/posix/include/rtems/posix/psignalimpl.h new file mode 100644 index 0000000000..6c46f3c49c --- /dev/null +++ b/cpukit/posix/include/rtems/posix/psignalimpl.h @@ -0,0 +1,117 @@ +/** + * @file rtems/posix/psignal.h + * + * This include file defines internal information about POSIX signals. + */ + +/* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_POSIX_PSIGNALIMPL_H +#define _RTEMS_POSIX_PSIGNALIMPL_H + +#include <rtems/posix/psignal.h> +#include <rtems/posix/pthread.h> +#include <rtems/posix/sigset.h> +#include <rtems/score/apiext.h> + +#define _States_Is_interruptible_signal( _states ) \ + ( ((_states) & \ + (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) == \ + (STATES_WAITING_FOR_SIGNAL|STATES_INTERRUPTIBLE_BY_SIGNAL)) + +#define SIGACTION_TERMINATE \ + { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Abnormal_termination_handler} } +#define SIGACTION_IGNORE \ + { 0, SIGNAL_ALL_MASK, {SIG_IGN} } +#define SIGACTION_STOP \ + { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Stop_handler} } +#define SIGACTION_CONTINUE \ + { 0, SIGNAL_ALL_MASK, {_POSIX_signals_Continue_handler} } + +#define SIG_ARRAY_MAX (SIGRTMAX + 1) + +/* + * Variables + */ + +extern sigset_t _POSIX_signals_Pending; + +extern const struct sigaction _POSIX_signals_Default_vectors[ SIG_ARRAY_MAX ]; + +extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ]; + +extern Watchdog_Control _POSIX_signals_Alarm_timer; + +extern Watchdog_Control _POSIX_signals_Ualarm_timer; + +extern Thread_queue_Control _POSIX_signals_Wait_queue; + +extern Chain_Control _POSIX_signals_Inactive_siginfo; + +extern Chain_Control _POSIX_signals_Siginfo[ SIG_ARRAY_MAX ]; + +extern API_extensions_Post_switch_control _POSIX_signals_Post_switch; + +/* + * Internal routines + */ + +void _POSIX_signals_Manager_Initialization(void); + +static inline void _POSIX_signals_Add_post_switch_extension(void) +{ + _API_extensions_Add_post_switch( &_POSIX_signals_Post_switch ); +} + +bool _POSIX_signals_Unblock_thread( + Thread_Control *the_thread, + int signo, + siginfo_t *info +); + +bool _POSIX_signals_Check_signal( + POSIX_API_Control *api, + int signo, + bool is_global +); + +bool _POSIX_signals_Clear_signals( + POSIX_API_Control *api, + int signo, + siginfo_t *info, + bool is_global, + bool check_blocked +); + +int killinfo( + pid_t pid, + int sig, + const union sigval *value +); + +void _POSIX_signals_Set_process_signals( + sigset_t mask +); + +void _POSIX_signals_Clear_process_signals( + int signo +); + +/* + * Default signal handlers + */ + +#define _POSIX_signals_Stop_handler NULL +#define _POSIX_signals_Continue_handler NULL + +void _POSIX_signals_Abnormal_termination_handler( int signo ); + +#endif +/* end of file */ diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am index 119790b17e..a9f6ebbffa 100644 --- a/cpukit/posix/preinstall.am +++ b/cpukit/posix/preinstall.am @@ -80,6 +80,10 @@ $(PROJECT_INCLUDE)/rtems/posix/psignal.h: include/rtems/posix/psignal.h $(PROJEC $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignal.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/psignal.h +$(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h: include/rtems/posix/psignalimpl.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/psignalimpl.h + $(PROJECT_INCLUDE)/rtems/posix/pthread.h: include/rtems/posix/pthread.h $(PROJECT_INCLUDE)/rtems/posix/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/posix/pthread.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/posix/pthread.h diff --git a/cpukit/posix/src/alarm.c b/cpukit/posix/src/alarm.c index 32652b1719..b3c902cbab 100644 --- a/cpukit/posix/src/alarm.c +++ b/cpukit/posix/src/alarm.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> /* * _POSIX_signals_Alarm_TSR diff --git a/cpukit/posix/src/kill.c b/cpukit/posix/src/kill.c index b042e30136..ee59fe4b84 100644 --- a/cpukit/posix/src/kill.c +++ b/cpukit/posix/src/kill.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> int kill( pid_t pid, diff --git a/cpukit/posix/src/kill_r.c b/cpukit/posix/src/kill_r.c index f2e7c20552..301c0603cf 100644 --- a/cpukit/posix/src/kill_r.c +++ b/cpukit/posix/src/kill_r.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #if defined(RTEMS_NEWLIB) diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c index c8b4565e14..95a2459100 100644 --- a/cpukit/posix/src/killinfo.c +++ b/cpukit/posix/src/killinfo.c @@ -19,7 +19,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> #include <rtems/score/isr.h> @@ -114,6 +114,8 @@ int killinfo( _Thread_Disable_dispatch(); + _POSIX_signals_Add_post_switch_extension(); + /* * Is the currently executing thread interested? If so then it will * get it an execute it as soon as the dispatcher executes. diff --git a/cpukit/posix/src/pause.c b/cpukit/posix/src/pause.c index 10fa8b5e4f..3a307d6e93 100644 --- a/cpukit/posix/src/pause.c +++ b/cpukit/posix/src/pause.c @@ -13,13 +13,9 @@ #include "config.h" #endif -#include <pthread.h> +#include <stddef.h> #include <signal.h> -#include <errno.h> - -#include <rtems/system.h> -#include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <unistd.h> /* * 3.4.2 Suspend Process Execution, P1003.1b-1993, p. 81 diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index 6d63b29272..7623920f54 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -28,7 +28,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> @@ -103,7 +103,7 @@ Watchdog_Control _POSIX_signals_Ualarm_timer; * _POSIX_signals_Post_switch_extension */ -void _POSIX_signals_Post_switch_extension( +static void _POSIX_signals_Post_switch_hook( Thread_Control *the_thread ) { @@ -158,6 +158,10 @@ void _POSIX_signals_Post_switch_extension( _Thread_Executing->Wait.return_code = hold_errno; } +API_extensions_Post_switch_control _POSIX_signals_Post_switch = { + .hook = _POSIX_signals_Post_switch_hook +}; + /* * _POSIX_signals_Manager_Initialization */ diff --git a/cpukit/posix/src/psignalchecksignal.c b/cpukit/posix/src/psignalchecksignal.c index 46c0c857ff..171d7c8121 100644 --- a/cpukit/posix/src/psignalchecksignal.c +++ b/cpukit/posix/src/psignalchecksignal.c @@ -26,7 +26,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> diff --git a/cpukit/posix/src/psignalclearprocesssignals.c b/cpukit/posix/src/psignalclearprocesssignals.c index 491f1fad71..3c3cdf4e68 100644 --- a/cpukit/posix/src/psignalclearprocesssignals.c +++ b/cpukit/posix/src/psignalclearprocesssignals.c @@ -22,7 +22,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> diff --git a/cpukit/posix/src/psignalclearsignals.c b/cpukit/posix/src/psignalclearsignals.c index 01f23990d7..390bcd1579 100644 --- a/cpukit/posix/src/psignalclearsignals.c +++ b/cpukit/posix/src/psignalclearsignals.c @@ -22,7 +22,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> diff --git a/cpukit/posix/src/psignalsetprocesssignals.c b/cpukit/posix/src/psignalsetprocesssignals.c index a6fa6ef45e..22609bf2af 100644 --- a/cpukit/posix/src/psignalsetprocesssignals.c +++ b/cpukit/posix/src/psignalsetprocesssignals.c @@ -22,7 +22,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c index 025ce96fab..5dc6ef587b 100644 --- a/cpukit/posix/src/psignalunblockthread.c +++ b/cpukit/posix/src/psignalunblockthread.c @@ -22,7 +22,7 @@ #include <rtems/score/wkspace.h> #include <rtems/seterr.h> #include <rtems/posix/threadsup.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/pthread.h> #include <rtems/posix/time.h> #include <stdio.h> diff --git a/cpukit/posix/src/pthread.c b/cpukit/posix/src/pthread.c index cd2cffec9e..1773c24b69 100644 --- a/cpukit/posix/src/pthread.c +++ b/cpukit/posix/src/pthread.c @@ -25,7 +25,7 @@ #include <rtems/posix/cancel.h> #include <rtems/posix/pthread.h> #include <rtems/posix/priority.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/config.h> #include <rtems/posix/key.h> #include <rtems/posix/time.h> @@ -305,12 +305,10 @@ static void _POSIX_Threads_Initialize_user_threads( void ) * API Extension control structures */ API_extensions_Control _POSIX_Threads_API_extensions = { - { NULL, NULL }, #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) - NULL, /* predriver */ + .predriver_hook = NULL, #endif - _POSIX_Threads_Initialize_user_threads, /* postdriver */ - _POSIX_signals_Post_switch_extension, /* post switch */ + .postdriver_hook = _POSIX_Threads_Initialize_user_threads }; User_extensions_Control _POSIX_Threads_User_extensions = { diff --git a/cpukit/posix/src/pthreadinitthreads.c b/cpukit/posix/src/pthreadinitthreads.c index 06b859b4fc..b2c850fda2 100644 --- a/cpukit/posix/src/pthreadinitthreads.c +++ b/cpukit/posix/src/pthreadinitthreads.c @@ -24,7 +24,6 @@ #include <rtems/posix/cancel.h> #include <rtems/posix/pthread.h> #include <rtems/posix/priority.h> -#include <rtems/posix/psignal.h> #include <rtems/posix/config.h> #include <rtems/posix/key.h> #include <rtems/posix/time.h> diff --git a/cpukit/posix/src/pthreadkill.c b/cpukit/posix/src/pthreadkill.c index ede2d99191..67ef0c7005 100644 --- a/cpukit/posix/src/pthreadkill.c +++ b/cpukit/posix/src/pthreadkill.c @@ -19,7 +19,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/score/isr.h> #include <rtems/seterr.h> @@ -46,6 +46,8 @@ int pthread_kill( * If sig == 0 then just validate arguments */ + _POSIX_signals_Add_post_switch_extension(); + api = the_thread->API_Extensions[ THREAD_API_POSIX ]; if ( sig ) { diff --git a/cpukit/posix/src/pthreadsigmask.c b/cpukit/posix/src/pthreadsigmask.c index 90b174e45b..b424daba78 100644 --- a/cpukit/posix/src/pthreadsigmask.c +++ b/cpukit/posix/src/pthreadsigmask.c @@ -21,7 +21,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> int pthread_sigmask( diff --git a/cpukit/posix/src/ptimer.c b/cpukit/posix/src/ptimer.c index 178ec5e191..2e3526730a 100644 --- a/cpukit/posix/src/ptimer.c +++ b/cpukit/posix/src/ptimer.c @@ -32,7 +32,6 @@ #include <rtems/rtems/types.h> #include <rtems/rtems/timer.h> #include <rtems/rtems/clock.h> -#include <rtems/posix/psignal.h> #include <rtems/score/wkspace.h> #include <pthread.h> #include <stdio.h> diff --git a/cpukit/posix/src/sigaction.c b/cpukit/posix/src/sigaction.c index f3729807d2..9fb04a042d 100644 --- a/cpukit/posix/src/sigaction.c +++ b/cpukit/posix/src/sigaction.c @@ -19,7 +19,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> #include <rtems/score/isr.h> diff --git a/cpukit/posix/src/sigpending.c b/cpukit/posix/src/sigpending.c index 58e41d3b44..9145c988e4 100644 --- a/cpukit/posix/src/sigpending.c +++ b/cpukit/posix/src/sigpending.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> int sigpending( diff --git a/cpukit/posix/src/sigqueue.c b/cpukit/posix/src/sigqueue.c index 0b26eacb67..b1f6cee67e 100644 --- a/cpukit/posix/src/sigqueue.c +++ b/cpukit/posix/src/sigqueue.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> int sigqueue( pid_t pid, diff --git a/cpukit/posix/src/sigsuspend.c b/cpukit/posix/src/sigsuspend.c index 6ef961e25c..f84d11f119 100644 --- a/cpukit/posix/src/sigsuspend.c +++ b/cpukit/posix/src/sigsuspend.c @@ -13,13 +13,11 @@ #include "config.h" #endif +#include <stddef.h> #include <assert.h> #include <signal.h> #include <errno.h> -#include <rtems/system.h> -#include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> #include <rtems/seterr.h> int sigsuspend( @@ -29,9 +27,6 @@ int sigsuspend( sigset_t saved_signals_blocked; sigset_t current_unblocked_signals; int status; - POSIX_API_Control *api; - - api = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; /* * We use SIG_BLOCK and not SIG_SETMASK because there may be diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c index fc8cc9cac6..1f23356056 100644 --- a/cpukit/posix/src/sigtimedwait.c +++ b/cpukit/posix/src/sigtimedwait.c @@ -19,7 +19,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/seterr.h> #include <rtems/posix/time.h> #include <rtems/score/isr.h> diff --git a/cpukit/posix/src/sigwait.c b/cpukit/posix/src/sigwait.c index 5a73e85933..cfb733034b 100644 --- a/cpukit/posix/src/sigwait.c +++ b/cpukit/posix/src/sigwait.c @@ -15,14 +15,10 @@ #include "config.h" #endif -#include <pthread.h> +#include <stddef.h> #include <signal.h> #include <errno.h> -#include <rtems/system.h> -#include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> - int sigwait( const sigset_t *set, int *sig diff --git a/cpukit/posix/src/sigwaitinfo.c b/cpukit/posix/src/sigwaitinfo.c index e90125e0cf..0b2045bcad 100644 --- a/cpukit/posix/src/sigwaitinfo.c +++ b/cpukit/posix/src/sigwaitinfo.c @@ -15,12 +15,8 @@ #include "config.h" #endif +#include <stddef.h> #include <signal.h> -#include <errno.h> - -#include <rtems/system.h> -#include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> int sigwaitinfo( const sigset_t *set, diff --git a/cpukit/posix/src/timercreate.c b/cpukit/posix/src/timercreate.c index 86981eafd0..6dfa75b9c8 100644 --- a/cpukit/posix/src/timercreate.c +++ b/cpukit/posix/src/timercreate.c @@ -20,7 +20,7 @@ #include <rtems/system.h> #include <rtems/seterr.h> #include <rtems/score/thread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/sigset.h> #include <rtems/posix/time.h> #include <rtems/posix/timer.h> diff --git a/cpukit/posix/src/ualarm.c b/cpukit/posix/src/ualarm.c index 0e13908a22..2a2f975d67 100644 --- a/cpukit/posix/src/ualarm.c +++ b/cpukit/posix/src/ualarm.c @@ -18,7 +18,7 @@ #include <rtems/system.h> #include <rtems/posix/pthread.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> #include <rtems/posix/time.h> /* diff --git a/cpukit/preinstall.am b/cpukit/preinstall.am index f6d24bb78f..26b90ecc75 100644 --- a/cpukit/preinstall.am +++ b/cpukit/preinstall.am @@ -272,6 +272,10 @@ $(PROJECT_INCLUDE)/rtems/nvdisk-sram.h: libblock/include/rtems/nvdisk-sram.h $(P $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/nvdisk-sram.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/nvdisk-sram.h +$(PROJECT_INCLUDE)/rtems/sparse-disk.h: libblock/include/rtems/sparse-disk.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sparse-disk.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sparse-disk.h + $(PROJECT_INCLUDE)/rtems/ide_part_table.h: libblock/include/rtems/ide_part_table.h $(PROJECT_INCLUDE)/rtems/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/ide_part_table.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/ide_part_table.h diff --git a/cpukit/rtems/include/rtems/rtems/barrier.h b/cpukit/rtems/include/rtems/rtems/barrier.h index df0e6f2c1d..340c6a16ac 100644 --- a/cpukit/rtems/include/rtems/rtems/barrier.h +++ b/cpukit/rtems/include/rtems/rtems/barrier.h @@ -34,6 +34,10 @@ /**@{*/ /** + * @brief Instantiate Barrier Data + * + * Barrier Manager -- Instantiate Data + * * This constant is defined to extern most of the time when using * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done @@ -80,7 +84,9 @@ RTEMS_BARRIER_EXTERN Objects_Information _Barrier_Information; void _Barrier_Manager_initialization(void); /** - * @brief rtems_barrier_create + * @brief RTEMS Create Barrier + * + * Barrier Manager -- Create a Barrier Instance * * This routine implements the rtems_barrier_create directive. The * barrier will have the name name. The starting count for @@ -125,10 +131,12 @@ rtems_status_code rtems_barrier_ident( ); /** - * @brief rtems_barrier_delete + * @brief RTEMS Delete Barrier * * This routine implements the rtems_barrier_delete directive. The - * barrier indicated by @a id is deleted. + * barrier indicated by @a id is deleted. The barrier is freed back to the + * inactive barrier chain. + * * * @param[in] id indicates the barrier to delete * @@ -158,7 +166,9 @@ rtems_status_code rtems_barrier_wait( ); /** - * @brief rtems_barrier_release + * @brief RTEMS Barrier Release + * + * Barrier Manager -- Release Tasks Waitng at a Barrier * * This routine implements the rtems_barrier_release directive. It * unblocks all of the threads waiting on the barrier associated with diff --git a/cpukit/rtems/include/rtems/rtems/clock.h b/cpukit/rtems/include/rtems/rtems/clock.h index 7c12cce708..7eaa2cbf3e 100644 --- a/cpukit/rtems/include/rtems/rtems/clock.h +++ b/cpukit/rtems/include/rtems/rtems/clock.h @@ -95,6 +95,8 @@ rtems_status_code rtems_clock_get( * This routine implements the rtems_clock_get_tod directive. It returns * the current time of day in the format defined by RTEID. * + * Clock Manager - rtems_clock_get_tod + * * @param[in] time_buffer points to the time of day structure * * @return This method returns RTEMS_SUCCESSFUL if there was not an @@ -191,13 +193,16 @@ rtems_status_code rtems_clock_set( * @return This directive always returns RTEMS_SUCCESSFUL. * * @note This method is typically called from an ISR and is the basis - * for all timeouts and delays. + * for all timeouts and delays. This routine only works for leap-years + * through 2099. */ rtems_status_code rtems_clock_tick( void ); /** * @brief Set the BSP specific Nanoseconds Extension * + * Clock Manager + * * This directive sets the BSP provided nanoseconds since last tick * extension. * @@ -222,6 +227,8 @@ rtems_status_code rtems_clock_set_nanoseconds_extension( * error. Otherwise, a status code is returned indicating the * source of the error. If successful, the uptime will be * filled in. + * + * Clock Manager - get uptime */ rtems_status_code rtems_clock_get_uptime( struct timespec *uptime @@ -242,7 +249,7 @@ void rtems_clock_get_uptime_timeval( struct timeval *uptime ); time_t rtems_clock_get_uptime_seconds( void ); /** - * @brief _TOD_Validate + * @brief TOD Validate * * This support function returns true if @a the_tod contains * a valid time of day, and false otherwise. @@ -250,13 +257,15 @@ time_t rtems_clock_get_uptime_seconds( void ); * @param[in] the_tod is the TOD structure to validate * * @return This method returns true if the TOD is valid and false otherwise. + * + * @note This routine only works for leap-years through 2099. */ bool _TOD_Validate( const rtems_time_of_day *the_tod ); /** - * @brief _TOD_To_seconds + * @brief TOD to Seconds * * This function returns the number seconds between the epoch and @a the_tod. * diff --git a/cpukit/rtems/include/rtems/rtems/dpmem.h b/cpukit/rtems/include/rtems/rtems/dpmem.h index 7ccb2255f6..42601d5779 100644 --- a/cpukit/rtems/include/rtems/rtems/dpmem.h +++ b/cpukit/rtems/include/rtems/rtems/dpmem.h @@ -72,25 +72,37 @@ typedef struct { } Dual_ported_memory_Control; /** + * @brief Define the internal Dual Ported Memory information * The following define the internal Dual Ported Memory information. */ RTEMS_DPMEM_EXTERN Objects_Information _Dual_ported_memory_Information; /** - * @brief _Dual_ported_memory_Manager_initialization + * @brief Dual Ported Memory Manager Initialization * * This routine performs the initialization necessary for this manager. */ void _Dual_ported_memory_Manager_initialization(void); /** - * @brief rtems_port_create + * @brief Creates a port into a dual-ported memory area. * * This routine implements the rtems_port_create directive. The port - * will have the name name. The port maps onto an area of dual ported + * will have the name @a name. The port maps onto an area of dual ported * memory of length bytes which has internal_start and external_start * as the internal and external starting addresses, respectively. * It returns the id of the created port in ID. + * + * @param[in] name is the user defined port name + * @param[in] internal_start is the internal start address of port + * @param[in] external_start is the external start address of port + * @param[in] length is the physical length in bytes + * @param[out] id is the address of port id to set + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the id will + * be filled in with the port id. */ rtems_status_code rtems_port_create( rtems_name name, @@ -101,11 +113,16 @@ rtems_status_code rtems_port_create( ); /** - * @brief rtems_port_ident + * @brief RTEMS Port Name to Id * * This routine implements the rtems_port_ident directive. This directive * returns the port ID associated with name. If more than one port is * named name, then the port to which the ID belongs is arbitrary. + * + * @param[in] name is the user defined port name + * @param[out] id is the pointer to port id + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_port_ident( rtems_name name, @@ -113,21 +130,35 @@ rtems_status_code rtems_port_ident( ); /** - * @brief rtems_port_delete + * @brief RTEMS Delete Port * * This routine implements the rtems_port_delete directive. It deletes * the port associated with ID. + * + * @param[in] id is the dual-ported memory area id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_port_delete( rtems_id id ); /** - * @brief rtems_port_external_to_internal + * @brief RTEMS Port External to Internal * * This routine implements the rtems_port_external_to_internal directive. * It returns the internal port address which maps to the provided - * external port address for the specified port ID. + * external port address for the specified port ID.If the given external + * address is an invalid dual-ported address, then the internal address is + * set to the given external address. + * + * @param[in] id is the id of dp memory object + * @param[in] external is the external address + * @param[out] internal is the pointer of internal address to set + * + * @return RTEMS_SUCCESSFUL */ rtems_status_code rtems_port_external_to_internal( rtems_id id, @@ -136,11 +167,20 @@ rtems_status_code rtems_port_external_to_internal( ); /** - * @brief rtems_port_internal_to_external + * @brief RTEMS Port Internal to External * * This routine implements the Port_internal_to_external directive. * It returns the external port address which maps to the provided - * internal port address for the specified port ID. + * internal port address for the specified port ID. If the given + * internal address is an invalid dual-ported address, then the + * external address is set to the given internal address. + * + * @param[in] id is the id of dual-ported memory object + * @param[in] internal is the internal address to set + * @param[in] external is the pointer to external address + * + * @return RTEMS_SUCCESSFUL and the external will be filled in + * with the external addresses */ rtems_status_code rtems_port_internal_to_external( rtems_id id, diff --git a/cpukit/rtems/include/rtems/rtems/event.h b/cpukit/rtems/include/rtems/rtems/event.h index 8386c43e15..c099f9b88e 100644 --- a/cpukit/rtems/include/rtems/rtems/event.h +++ b/cpukit/rtems/include/rtems/rtems/event.h @@ -70,7 +70,7 @@ extern "C" { * - Events do not hold or transport data. * - Events are not queued. In other words, if an event is sent more than once * to a task before being received, the second and subsequent send - * operations to that same task have no effect. + * operations to that same task have no effect. * * An event set is posted when it is directed (or sent) to a task. A pending * event is an event that has been posted but not received. An event condition @@ -80,7 +80,7 @@ extern "C" { * selected by the user. The @ref RTEMS_EVENT_ANY algorithm states that an * event condition is satisfied when at least a single requested event is * posted. The @ref RTEMS_EVENT_ALL algorithm states that an event condition - * is satisfied when every requested event is posted. + * is satisfied when every requested event is posted. * * An event set or condition is built by a bitwise or of the desired events. * The set of valid events is @ref RTEMS_EVENT_0 through @ref RTEMS_EVENT_31. @@ -92,7 +92,7 @@ extern "C" { * For example, when sending the event set consisting of @ref RTEMS_EVENT_6, * @ref RTEMS_EVENT_15, and @ref RTEMS_EVENT_31, the event parameter to the * rtems_event_send() directive should be @ref RTEMS_EVENT_6 | - * @ref RTEMS_EVENT_15 | @ref RTEMS_EVENT_31. + * @ref RTEMS_EVENT_15 | @ref RTEMS_EVENT_31. * * @{ */ @@ -109,9 +109,9 @@ extern "C" { * If the waiting task's input event condition is * - satisfied, then the task is made ready for execution. * - not satisfied, then the event set is posted but left pending and the - * task remains blocked. + * task remains blocked. * - not waiting for events. - * - The event set is posted and left pending. + * - The event set is posted and left pending. * * Identical events sent to a task are not queued. In other words, the second, * and subsequent, posting of an event to a task before it can perform an @@ -190,7 +190,7 @@ rtems_status_code rtems_event_send ( * @param[in] ticks Time out in ticks. Use @ref RTEMS_NO_TIMEOUT to wait * without a time out (potentially forever). * @param[out] event_out Set of received events (output events). - * + * * @retval RTEMS_SUCCESSFUL Successful operation. * @retval RTEMS_UNSATISFIED Input events not satisfied (only with the * @ref RTEMS_NO_WAIT option). @@ -438,7 +438,12 @@ typedef struct { /** * @brief Event Manager Initialization * + * Event Manager + * * This routine performs the initialization necessary for this manager. + * + * - INTERRUPT LATENCY: + * + single case */ void _Event_Manager_initialization( void ); @@ -455,7 +460,7 @@ void _Event_Seize( /** * @brief Surrender Event - * + * * - INTERRUPT LATENCY: * + before flash * + after flash @@ -469,6 +474,9 @@ void _Event_Surrender( States_Control wait_state ); +/** + * @brief Timeout Event + */ void _Event_Timeout( Objects_Id id, void *arg diff --git a/cpukit/rtems/include/rtems/rtems/eventmp.h b/cpukit/rtems/include/rtems/rtems/eventmp.h index aa09e348cc..a54f79cffe 100644 --- a/cpukit/rtems/include/rtems/rtems/eventmp.h +++ b/cpukit/rtems/include/rtems/rtems/eventmp.h @@ -65,7 +65,7 @@ typedef struct { */ /** - * @brief Event_MP_Send_request_packet + * @brief Event MP Send Packet Request * * This routine performs a remote procedure call so that a * directive operation can be initiated on another node. @@ -77,7 +77,7 @@ rtems_status_code _Event_MP_Send_request_packet ( ); /** - * @brief Event_MP_Send_response_packet + * @brief Event MP Send Packet Response * * This routine performs a remote procedure call so that a * directive can be performed on another node. @@ -88,7 +88,7 @@ void _Event_MP_Send_response_packet ( ); /** - * @brief Event_MP_Process_packet + * @brief Event MP Packet Process * * This routine performs the actions specific to this package for * the request from another node. @@ -120,7 +120,7 @@ void _Event_MP_Process_packet ( */ /** - * @brief Event_MP_Get_packet + * @brief Event MP Get Packet * * This function is used to obtain a event mp packet. */ diff --git a/cpukit/rtems/include/rtems/rtems/message.h b/cpukit/rtems/include/rtems/rtems/message.h index 69eab62d7c..4f44f730b1 100644 --- a/cpukit/rtems/include/rtems/rtems/message.h +++ b/cpukit/rtems/include/rtems/rtems/message.h @@ -97,21 +97,32 @@ typedef struct { RTEMS_MESSAGE_EXTERN Objects_Information _Message_queue_Information; /** - * @brief Message_queue_Manager_initialization + * @brief Message Queue Manager Initialization * * This routine performs the initialization necessary for this manager. */ void _Message_queue_Manager_initialization(void); /** - * @brief rtems_message_queue_create + * @brief RTEMS Create Message Queue * * This routine implements the rtems_message_queue_create directive. The - * message queue will have the name name. If the attribute_set indicates + * message queue will have the @a name. If the @a attribute_set indicates * that the message queue is to be limited in the number of messages - * that can be outstanding, then count indicates the maximum number of + * that can be outstanding, then @a count indicates the maximum number of * messages that will be held. It returns the id of the created - * message queue in ID. + * message queue in @a id. + * + * @param[in] name is the user defined queue name + * @param[in] count is the maximum message and reserved buffer count + * @param[in] max_message_size is the maximum size of each message + * @param[in] attribute_set is the process method + * @param[in] id is the pointer to queue + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the @a id will + * be filled in with the queue id. */ rtems_status_code rtems_message_queue_create( rtems_name name, @@ -131,11 +142,11 @@ rtems_status_code rtems_message_queue_create( * extent of the search for the ID of the message queue named name. * The search can be limited to a particular node or allowed to * encompass all nodes. - * + * * @param[in] name is the user defined message queue name * @param[in] node is the node(s) to be searched * @param[in] id is the pointer to message queue id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * *id filled with the message queue id */ @@ -150,9 +161,9 @@ rtems_status_code rtems_message_queue_ident( * * This routine implements the rtems_message_queue_delete directive. The * message queue indicated by ID is deleted. - * + * * @param[in] id is the queue id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_message_queue_delete( @@ -162,6 +173,8 @@ rtems_status_code rtems_message_queue_delete( /** * @brief rtems_message_queue_send * + * Message Queue Manager - rtems_message_queue_send + * * This routine implements the rtems_message_queue_send directive. * This directive sends the message buffer to the message queue * indicated by ID. If one or more tasks is blocked waiting @@ -186,11 +199,11 @@ rtems_status_code rtems_message_queue_send( * except that if no tasks are waiting, the message buffer will * be placed at the FRONT of the chain of pending messages rather * than at the REAR. - * + * * @param[in] id is the pointer to message queue * @param[in] buffer is the pointer to message buffer * @param[in] size is the size of message to send urgently - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_message_queue_urgent( @@ -206,14 +219,14 @@ rtems_status_code rtems_message_queue_urgent( * This directive sends the message buffer to all of the tasks blocked * waiting for a message on the message queue indicated by ID. * If no tasks are waiting, then the message buffer will not be queued. - * + * * @param[in] id is the pointer to message queue * @param[in] buffer is the pointer to message buffer * @param[in] size is the size of message to broadcast * @param[in] count pointer to area to store number of threads made ready - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and - * *count filled in with number of threads made ready + * *count filled in with number of threads made ready */ rtems_status_code rtems_message_queue_broadcast( rtems_id id, @@ -223,7 +236,7 @@ rtems_status_code rtems_message_queue_broadcast( ); /** - * @brief rtems_message_queue_receive + * @brief RTEMS Message Queue Receive * * This routine implements the rtems_message_queue_receive directive. * This directive is invoked when the calling task wishes to receive @@ -232,6 +245,16 @@ rtems_status_code rtems_message_queue_broadcast( * and the option_set indicates that the task is willing to block, * then the task will be blocked until a message arrives or until, * optionally, timeout clock ticks have passed. + * + * @param[in] id is the queue id + * @param[in] buffer is the pointer to message buffer + * @param[in] size is the size of message receive + * @param[in] option_set is the options on receive + * @param[in] timeout is the number of ticks to wait + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_message_queue_receive( rtems_id id, @@ -248,6 +271,8 @@ rtems_status_code rtems_message_queue_receive( * This directive takes all outstanding messages for the message * queue indicated by ID and returns them to the inactive message * chain. The number of messages flushed is returned in COUNT. + * + * Message Queue Manager */ rtems_status_code rtems_message_queue_flush( rtems_id id, @@ -255,7 +280,9 @@ rtems_status_code rtems_message_queue_flush( ); /** - * @brief rtems_message_queue_get_number_pending + * @brief RTEMS Message Queue Get Number Pending + * + * Message Queue Manager * * This routine implements the rtems_message_queue_get_number_pending * directive. This directive returns the number of pending @@ -286,18 +313,24 @@ rtems_status_code _Message_queue_Submit( ); /** - * @brief Message_queue_Allocate + * @brief Message Queue Allocate * * This function allocates a message queue control block from * the inactive chain of free message queue control blocks. + * + * @return the_message_queue filled in if successful, NULL otherwise */ Message_queue_Control *_Message_queue_Allocate (void); /** - * @brief Message_queue_Translate_core_message_queue_return_code + * @brief Message queue Translate Core Message Queue Return Code + * + * This function returns a RTEMS status code based on + * @a the_message_queue_status. + * + * @param[in] the_message_queue_status is the status code to translate * - * This function returns a RTEMS status code based on the core message queue - * status code specified. + * @return translated RTEMS status code */ rtems_status_code _Message_queue_Translate_core_message_queue_return_code ( uint32_t the_message_queue_status diff --git a/cpukit/rtems/include/rtems/rtems/modes.h b/cpukit/rtems/include/rtems/rtems/modes.h index 0dbf91bf27..f80cb449cc 100644 --- a/cpukit/rtems/include/rtems/rtems/modes.h +++ b/cpukit/rtems/include/rtems/rtems/modes.h @@ -102,7 +102,7 @@ typedef uint32_t Modes_Control; extern const uint32_t rtems_interrupt_mask; /** - * @brief Body for RTEMS_INTERRUPT_LEVEL macro. + * @brief Body for RTEMS_INTERRUPT_LEVEL Macro * * @param[in] level is the desired interrupt level * diff --git a/cpukit/rtems/include/rtems/rtems/mp.h b/cpukit/rtems/include/rtems/rtems/mp.h index c04b0b1c64..f7b5f20c62 100644 --- a/cpukit/rtems/include/rtems/rtems/mp.h +++ b/cpukit/rtems/include/rtems/rtems/mp.h @@ -30,14 +30,14 @@ extern "C" { #endif /** - * @brief Multiprocessing_Manager_initialization + * @brief Multiprocessing Manager Initialization * * This routine performs the initialization necessary for this manager. */ void _Multiprocessing_Manager_initialization ( void ); /** - * @brief rtems_multiprocessing_announce + * @brief RTEMS Multiprocessing Announce * * This routine implements the MULTIPROCESSING_ANNOUNCE directive. * It is invoked by the MPCI layer to indicate that an MPCI packet diff --git a/cpukit/rtems/include/rtems/rtems/object.h b/cpukit/rtems/include/rtems/rtems/object.h index 94a52978a8..7baa80c652 100644 --- a/cpukit/rtems/include/rtems/rtems/object.h +++ b/cpukit/rtems/include/rtems/rtems/object.h @@ -73,6 +73,8 @@ typedef struct { /** * @brief Build Thirty-Two Bit Object Name * + * RTEMS Object Helper -- Build an Object Id + * * This function returns an object name composed of the four characters * C1, C2, C3, and C4. * @@ -89,7 +91,7 @@ typedef struct { _Objects_Build_name( _C1, _C2, _C3, _C4 ) /** - * @brief Obtain name of object + * @brief Obtain Name of Object * * This directive returns the name associated with the specified * object ID. @@ -135,6 +137,8 @@ char *rtems_object_get_name( * object. This can be used to set the name of objects * which do not have a naming scheme per their API. * + * RTEMS Object Helper -- Set Name of Object as String + * * @param[in] id is the Id of the object to obtain the name of * @param[out] name will be set to the name of the object * @@ -150,6 +154,8 @@ rtems_status_code rtems_object_set_name( /** * @brief Get API Portion of Object Id * + * RTEMS Object Helper -- Extract API From Id + * * This function returns the API portion of the Id. * * @param[in] _id is the Id of the object to obtain the API from @@ -167,7 +173,7 @@ rtems_status_code rtems_object_set_name( /** * @brief Get Class Portion of Object Id * - * This function returns the class portion of the ID. + * This function returns the class portion of the @a _id ID. * * @param[in] _id is the Id of the object to obtain the class from * @@ -254,6 +260,7 @@ rtems_status_code rtems_object_set_name( * * @return This method returns the least valid value for * class number for the specified @a api. + * RTEMS Object Helper -- Get Least Valid Class for an API */ int rtems_object_api_minimum_class( int api @@ -327,7 +334,7 @@ const char *rtems_object_get_api_class_name( ); /** - * @brief Get Class Name + * @brief Get Class Information * * This method returns a string containing the name of the * @a the_class from the specified @a api. diff --git a/cpukit/rtems/include/rtems/rtems/part.h b/cpukit/rtems/include/rtems/rtems/part.h index 8415f9ca5b..e62e9043fc 100644 --- a/cpukit/rtems/include/rtems/rtems/part.h +++ b/cpukit/rtems/include/rtems/rtems/part.h @@ -31,6 +31,8 @@ * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done * in a single per manager file. + * + * Partition Manager -- Instantiate Data */ #ifndef RTEMS_PART_EXTERN #define RTEMS_PART_EXTERN extern @@ -84,14 +86,16 @@ typedef struct { RTEMS_PART_EXTERN Objects_Information _Partition_Information; /** - * @brief Partition_Manager_initialization + * @brief Partition Manager Initialization * * This routine performs the initialization necessary for this manager. */ void _Partition_Manager_initialization(void); /** - * @brief rtems_partition_create + * @brief RTEMS Partition Create + * + * Partition Manager * * This routine implements the rtems_partition_create directive. The * partition will have the name name. The memory area managed by @@ -120,11 +124,11 @@ rtems_status_code rtems_partition_create( * extent of the search for the ID of the partition named name. * The search can be limited to a particular node or allowed to * encompass all nodes. - * + * * @param[in] name is the user defined partition name * @param[in] node is(are) the node(s) to be searched * @param[in] id is the pointer to partition id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * *id filled in with the partition id */ @@ -135,21 +139,33 @@ rtems_status_code rtems_partition_ident( ); /** - * @brief rtems_partition_delete + * @brief RTEMS Delete Partition * * This routine implements the rtems_partition_delete directive. The - * partition indicated by ID is deleted. + * partition indicated by ID is deleted, provided that none of its buffers + * are still allocated. + * + * @param[in] id is the partition id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_partition_delete( rtems_id id ); /** - * @brief rtems_partition_get_buffer + * @brief RTEMS Get Partition Buffer * * This routine implements the rtems_partition_get_buffer directive. It * attempts to allocate a buffer from the partition associated with ID. * If a buffer is allocated, its address is returned in buffer. + * + * @param[in] id is the partition id + * @param[out] buffer is the pointer to buffer address + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_partition_get_buffer( rtems_id id, diff --git a/cpukit/rtems/include/rtems/rtems/partmp.h b/cpukit/rtems/include/rtems/rtems/partmp.h index 96decf9697..fee58e9038 100644 --- a/cpukit/rtems/include/rtems/rtems/partmp.h +++ b/cpukit/rtems/include/rtems/rtems/partmp.h @@ -65,6 +65,8 @@ typedef struct { /** * @brief Partition_MP_Send_process_packet * + * Multiprocessing Support for the Partition Manager + * * This routine performs a remote procedure call so that a * process operation can be performed on another node. */ diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h b/cpukit/rtems/include/rtems/rtems/ratemon.h index 93c8e26ba5..475a90a5be 100644 --- a/cpukit/rtems/include/rtems/rtems/ratemon.h +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h @@ -50,6 +50,8 @@ * API calls. The statistics kept include minimum, maximum and average times * for both cpu usage and wall time. The statistics indicate the execution time * used by the owning thread between successive calls to rtems_rate_monotonic_period. + * + * Rate Monotonic Manager -- Reset Statistics for All Periods */ /**@{*/ @@ -269,11 +271,15 @@ RTEMS_RATEMON_EXTERN Objects_Information _Rate_monotonic_Information; * @brief Rate Monotonic Manager Initialization * * This routine performs the initialization necessary for this manager. + * + * @note The Rate Monotonic Manager is built on top of the Watchdog Handler */ void _Rate_monotonic_Manager_initialization(void); /** - * @brief rtems_rate_monotonic_create + * @brief Create a Period + * + * Rate Monotonic Manager * * This routine implements the rate_monotonic_create directive. The * period will have the name name. It returns the id of the @@ -285,11 +291,19 @@ rtems_status_code rtems_rate_monotonic_create( ); /** - * @brief rtems_rate_monotonic_ident + * @brief RTEMS Rate Monotonic Name to Id * * This routine implements the rtems_rate_monotonic_ident directive. * It returns the period ID associated with name. If more than one period * is named name, then the period to which the ID belongs is arbitrary. + * + * @param[in] name is the user defined period name + * @param[in] id is the pointer to period id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the id will + * be filled in with the region id. */ rtems_status_code rtems_rate_monotonic_ident( rtems_name name, @@ -302,22 +316,28 @@ rtems_status_code rtems_rate_monotonic_ident( * This routine implements the rtems_rate_monotonic_cancel directive. This * directive stops the period associated with ID from continuing to * run. - * + * * @param[in] id is the rate monotonic id - * + * * @return RTEMS_SUCCESSFUL if successful and caller is not the owning thread * or error code if unsuccessful - * + * */ rtems_status_code rtems_rate_monotonic_cancel( rtems_id id ); /** - * @brief rtems_rate_monotonic_delete + * @brief RTEMS Delete Rate Monotonic * * This routine implements the rtems_rate_monotonic_delete directive. The * period indicated by ID is deleted. + * + * @param[in] id is the rate monotonic id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_rate_monotonic_delete( rtems_id id @@ -329,6 +349,13 @@ rtems_status_code rtems_rate_monotonic_delete( * This routine implements the rtems_rate_monotonic_get_status directive. * Information about the period indicated by ID is returned. * + * @param[in] id is the rate monotonic id + * @param[in] status is the pointer to status control block + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. + * */ rtems_status_code rtems_rate_monotonic_get_status( rtems_id id, @@ -340,10 +367,10 @@ rtems_status_code rtems_rate_monotonic_get_status( * * This routine implements the rtems_rate_monotonic_get_statistics directive. * Statistics gathered from the use of this period are returned. - * + * * @param[in] id is the rate monotonic id * @param[in] statistics is the pointer to statistics control block - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_rate_monotonic_get_statistics( @@ -352,7 +379,9 @@ rtems_status_code rtems_rate_monotonic_get_statistics( ); /** - * @brief rtems_rate_monotonic_reset_statistics + * @brief RTEMS Rate Monotonic Reset Statistics + * + * Rate Monotonic Manager -- Reset Statistics * * This routine allows a thread to reset the statistics information * on a specific period instance. @@ -370,10 +399,13 @@ rtems_status_code rtems_rate_monotonic_reset_statistics( void rtems_rate_monotonic_reset_all_statistics( void ); /** - * @brief rtems_rate_monotonic_report_statistics + * @brief RTEMS Report Rate Monotonic Statistics * * This routine allows a thread to print the statistics information * on ALL period instances which have non-zero counts using printk. + * The implementation of this directive straddles the fence between + * inside and outside of RTEMS. It is presented as part of the Manager + * but actually uses other services of the Manager. */ void rtems_rate_monotonic_report_statistics_with_plugin( void *context, @@ -381,7 +413,7 @@ void rtems_rate_monotonic_report_statistics_with_plugin( ); /** - * @brief rtems_rate_monotonic_report_statistics + * @brief RTEMS Report Rate Monotonic Statistics * * This routine allows a thread to print the statistics information * on ALL period instances which have non-zero counts using printk. @@ -395,10 +427,10 @@ void rtems_rate_monotonic_report_statistics( void ); * length is non-zero, this directive initiates the period associated with * ID from continuing for a period of length. If length is zero, then * result is set to indicate the current state of the period. - * + * * @param[in] id is the rate monotonic id * @param[in] lenght is the length of period (in ticks) - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_rate_monotonic_period( @@ -415,7 +447,7 @@ rtems_status_code rtems_rate_monotonic_period( * period is restarted. If the owning thread is not waiting for the * period to expire, then the period is placed in the EXPIRED * state and not restarted. - * + * * @param[in] id is the period id */ void _Rate_monotonic_Timeout( diff --git a/cpukit/rtems/include/rtems/rtems/region.h b/cpukit/rtems/include/rtems/rtems/region.h index a35acf97e2..5ab0e47347 100644 --- a/cpukit/rtems/include/rtems/rtems/region.h +++ b/cpukit/rtems/include/rtems/rtems/region.h @@ -45,6 +45,10 @@ /**@{*/ /** + * @brief Instantiate RTEMS Region Data + * + * Region Manager -- Instantiate Data + * * This constant is defined to extern most of the time when using * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done @@ -84,6 +88,8 @@ RTEMS_REGION_EXTERN Objects_Information _Region_Information; /** * @brief _Region_Manager_initialization * + * Region Manager + * * This routine performs the initialization necessary for this manager. */ void _Region_Manager_initialization(void); @@ -91,6 +97,8 @@ void _Region_Manager_initialization(void); /** * @brief rtems_region_create * + * Region Manager + * * This routine implements the rtems_region_create directive. The * region will have the name name. The memory area managed by * the region is of length bytes and starts at starting_address. @@ -109,12 +117,20 @@ rtems_status_code rtems_region_create( ); /** - * @brief rtems_region_extend + * @brief RTEMS Extend Region * * This routine implements the rtems_region_extend directive. The * region will have the name name. The memory area managed by * the region will be attempted to be grown by length bytes using * the memory starting at starting_address. + * + * @param[in] id is the id of region to grow + * @param[in] starting_address starting address of memory area for extension + * @param[in] length is the physical length in bytes to grow the region + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_region_extend( rtems_id id, @@ -123,12 +139,20 @@ rtems_status_code rtems_region_extend( ); /** - * @brief rtems_region_ident + * @brief RTEMS Region Name to Id * * This routine implements the rtems_region_ident directive. * This directive returns the region ID associated with name. * If more than one region is named name, then the region * to which the ID belongs is arbitrary. + * + * @param[in] name is the user defined region name + * @param[in] id is the pointer to region id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the id will + * be filled in with the region id. */ rtems_status_code rtems_region_ident( rtems_name name, @@ -141,10 +165,10 @@ rtems_status_code rtems_region_ident( * This routine implements the rtems_region_get_information directive. * This directive returns information about the heap associated with * this region. - * + * * @param[in] id is the region id * @param[in] the_info is the pointer to region information block - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * *id filled with the region information block */ @@ -154,11 +178,20 @@ rtems_status_code rtems_region_get_information( ); /** - * @brief rtems_region_get_free_information + * @brief RTEMS Get Region Free Information * * This routine implements the rtems_region_get_free_information directive. * This directive returns information about the free blocks in the - * heap associated with this region. + * heap associated with this region. Information about the used blocks + * will be returned as zero. + * + * @param[in] id is the region id + * @param[in] the_info is the pointer to region information block + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the the_info will + * be filled in with the region information block. */ rtems_status_code rtems_region_get_free_information( rtems_id id, @@ -166,25 +199,43 @@ rtems_status_code rtems_region_get_free_information( ); /** - * @brief rtems_region_delete + * @brief RTEMS Delete Region * * This routine implements the rtems_region_delete directive. The - * region indicated by ID is deleted. + * region indicated by ID is deleted, provided that none of its segments are + * still allocated. + * + * @param[in] id is the region id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_region_delete( rtems_id id ); /** - * @brief rtems_region_get_segment + * @brief RTEMS Get Region Segment * * This routine implements the rtems_region_get_segment directive. It - * attempts to allocate a segment from the region associated with ID. - * If a segment of the requested size can be allocated, its address - * is returned in segment. If no segment is available, then the task + * attempts to allocate a segment from the region associated with @a id. + * If a segment of the requested @a size size can be allocated, its address + * is returned in @a segment. If no segment is available, then the task * may return immediately or block waiting for a segment with an optional - * timeout of timeout clock ticks. Whether the task blocks or returns - * immediately is based on the no_wait option in the option_set. + * timeout of @a timeout clock ticks. Whether the task blocks or returns + * immediately is based on the no_wait option in the @a option_set. + * + * @param[in] id is the region id + * @param[in] size is the segment size in bytes + * @param[in] option_set is the wait option + * @param[in] timeout is the number of ticks to wait (0 means wait forever) + * @param[in] segment is the pointer to segment address + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the segment will + * be filled in with the segment address. */ rtems_status_code rtems_region_get_segment( rtems_id id, @@ -195,10 +246,19 @@ rtems_status_code rtems_region_get_segment( ); /** - * @brief rtems_region_get_segment_size + * @brief RTEMS Get Region Segment Size * * This routine implements the rtems_region_get_segment_size directive. It * returns the size in bytes of the specified user memory area. + * + * @param[in] id is the region id + * @param[in] segment is the segment address + * @param[in] size is the pointer to segment size in bytes + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the size will + * be filled in with the segment size in bytes. */ rtems_status_code rtems_region_get_segment_size( rtems_id id, @@ -207,7 +267,7 @@ rtems_status_code rtems_region_get_segment_size( ); /** - * @brief rtems_region_return_segment + * @brief RTEMS Return Region Segment * * This routine implements the rtems_region_return_segment directive. It * frees the segment to the region associated with ID. The segment must @@ -216,6 +276,11 @@ rtems_status_code rtems_region_get_segment_size( * rtems_region_get_segment of the first blocked task, then that task and as * many subsequent tasks as possible will be unblocked with their requests * satisfied. + * + * @param[in] id is the region id + * @param[in] segment is the pointer to segment address + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_region_return_segment( rtems_id id, @@ -234,15 +299,15 @@ rtems_status_code rtems_region_return_segment( * rtems_region_get_segment of the first blocked task, then that task and as * many subsequent tasks as possible will be unblocked with their requests * satisfied. - * + * * @param[in] id is the region id * @param[in] segmet is the pointer to segment address * @param[in] size is the new required size * @return RTEMS_SUCCESSFUL if operation successful, RTEMS_UNSATISFIED if the * the segment can't be resized in place or any other code atfailure - * + * * @note On RTEMS_SUCCESSFUL or RTEMS_UNSATISFIED exit it returns into the - * 'old_size' the old size in bytes of the user memory area of the + * 'old_size' the old size in bytes of the user memory area of the * specified segment. */ rtems_status_code rtems_region_resize_segment( @@ -260,7 +325,7 @@ rtems_status_code rtems_region_resize_segment( * This is a helper routine which is invoked any time memory is * freed. It looks at the set of waiting tasks and attempts to * satisfy all outstanding requests. - * + * * @param[in] the_region is the the region */ extern void _Region_Process_queue(Region_Control *the_region); diff --git a/cpukit/rtems/include/rtems/rtems/regionmp.h b/cpukit/rtems/include/rtems/rtems/regionmp.h index 7465bbfd4f..f4adc2bda1 100644 --- a/cpukit/rtems/include/rtems/rtems/regionmp.h +++ b/cpukit/rtems/include/rtems/rtems/regionmp.h @@ -65,7 +65,7 @@ typedef struct { } Region_MP_Packet; /** - * @brief _Region_MP_Send_process_packet + * @brief Region MP Send Process Packet * * This routine performs a remote procedure call so that a * process operation can be performed on another node. @@ -78,7 +78,7 @@ void _Region_MP_Send_process_packet ( ); /** - * @brief _Region_MP_Send_request_packet + * @brief Region MP Send Request Packet * * This routine performs a remote procedure call so that a * directive operation can be initiated on another node. @@ -93,7 +93,7 @@ rtems_status_code _Region_MP_Send_request_packet ( ); /** - * @brief _Region_MP_Send_response_packet + * @brief Region MP Send Response Packet * * This routine performs a remote procedure call so that a * directive can be performed on another node. @@ -105,7 +105,7 @@ void _Region_MP_Send_response_packet ( ); /** - * @brief _Region_MP_Process_packet + * @brief Region MP Process Packet * * This routine performs the actions specific to this package for * the request from another node. @@ -126,7 +126,7 @@ void _Region_MP_Process_packet ( */ /** - * @brief _Region_MP_Send_extract_proxy + * @brief Region MP Send Extract Proxy * * This routine is invoked when a task is deleted and it * has a proxy which must be removed from a thread queue and @@ -137,7 +137,7 @@ void _Region_MP_Send_extract_proxy ( ); /** - * @brief _Region_MP_Get_packet + * @brief RegionMP Get Packet * * This function is used to obtain a region mp packet. */ diff --git a/cpukit/rtems/include/rtems/rtems/rtemsapi.h b/cpukit/rtems/include/rtems/rtems/rtemsapi.h index d39acd35c0..5d74fa6790 100644 --- a/cpukit/rtems/include/rtems/rtems/rtemsapi.h +++ b/cpukit/rtems/include/rtems/rtems/rtemsapi.h @@ -18,7 +18,7 @@ #include <rtems/config.h> /** - * _RTEMS_API_Initialize + * @brief Initializes the RTEMS API * * This routine initializes the RTEMS API by invoking the initialization * routine for each RTEMS manager with the appropriate parameters diff --git a/cpukit/rtems/include/rtems/rtems/sem.h b/cpukit/rtems/include/rtems/rtems/sem.h index a75ef4130a..ea0aea32ca 100644 --- a/cpukit/rtems/include/rtems/rtems/sem.h +++ b/cpukit/rtems/include/rtems/rtems/sem.h @@ -27,10 +27,15 @@ #define _RTEMS_RTEMS_SEM_H /** + * @brief Instantiate Semaphore Data + * + * Semaphore Manager -- Data Instantiation + * * This constant is defined to extern most of the time when using * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done * in a single per manager file. + * */ #ifndef RTEMS_SEM_EXTERN #define RTEMS_SEM_EXTERN extern @@ -104,7 +109,7 @@ typedef struct { RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information; /** - * @brief Semaphore_Manager_initialization + * @brief Semaphore Manager Initialization * * This routine performs the initialization necessary for this manager. */ @@ -118,6 +123,8 @@ void _Semaphore_Manager_initialization(void); * the semaphore is count. The attribute_set determines if * the semaphore is global or local and the thread queue * discipline. It returns the id of the created semaphore in ID. + * + * Semaphore Manager */ rtems_status_code rtems_semaphore_create( rtems_name name, @@ -137,11 +144,11 @@ rtems_status_code rtems_semaphore_create( * extent of the search for the ID of the semaphore named name. * The search can be limited to a particular node or allowed to * encompass all nodes. - * + * * @param[in] name is the user defined semaphore name * @param[in] node is(are) the node(s) to be searched * @param[in] id is the pointer to semaphore id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * *id filled in with the semaphore id */ @@ -152,17 +159,23 @@ rtems_status_code rtems_semaphore_ident( ); /** - * @brief rtems_semaphore_delete + * @brief RTEMS Delete Semaphore * * This routine implements the rtems_semaphore_delete directive. The * semaphore indicated by ID is deleted. + * + * @param[in] id is the semaphore id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_semaphore_delete( rtems_id id ); /** - * @brief rtems_semaphore_obtain + * @brief RTEMS Obtain Semaphore * * This routine implements the rtems_semaphore_obtain directive. It * attempts to obtain a unit from the semaphore associated with ID. @@ -171,6 +184,14 @@ rtems_status_code rtems_semaphore_delete( * block waiting for a unit with an optional timeout of timeout * clock ticks. Whether the task blocks or returns immediately * is based on the RTEMS_NO_WAIT option in the option_set. + * + * @param[in] id is the semaphore id + * @param[in] option_set is the wait option + * @param[in] timeout is the number of ticks to wait (0 means wait forever) + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_semaphore_obtain( rtems_id id, @@ -179,7 +200,9 @@ rtems_status_code rtems_semaphore_obtain( ); /** - * @brief rtems_semaphore_release + * @brief RTEMS Semaphore Release + * + * Semaphore Manager * * This routine implements the rtems_semaphore_release directive. It * frees a unit to the semaphore associated with ID. If a task was @@ -193,16 +216,16 @@ rtems_status_code rtems_semaphore_release( /** * @brief RTEMS Semaphore Flush - * + * * DESCRIPTION: * This package is the implementation of the flush directive * of the Semaphore Manager. - * + * * This directive allows a thread to flush the threads * pending on the semaphore. * * @param[in] id is the semaphore id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_semaphore_flush( @@ -223,20 +246,28 @@ bool _Semaphore_Seize( ); /** - * @brief _Semaphore_Translate_core_mutex_return_code + * @brief Semaphore Translate Core Mutex Return Code * * This function returns a RTEMS status code based on the mutex * status code specified. + * + * @param[in] the_mutex_status is the mutex status code to translate + * + * @return translated RTEMS status code */ rtems_status_code _Semaphore_Translate_core_mutex_return_code ( uint32_t the_mutex_status ); /** - * @brief _Semaphore_Translate_core_semaphore_return_code + * @brief Semaphore Translate Core Semaphore Return Code * * This function returns a RTEMS status code based on the semaphore * status code specified. + * + * @param[in] status is the semaphore status code to translate + * + * @return translated RTEMS status code */ rtems_status_code _Semaphore_Translate_core_semaphore_return_code ( uint32_t the_mutex_status diff --git a/cpukit/rtems/include/rtems/rtems/signal.h b/cpukit/rtems/include/rtems/rtems/signal.h index 046842f97f..6e242544a3 100644 --- a/cpukit/rtems/include/rtems/rtems/signal.h +++ b/cpukit/rtems/include/rtems/rtems/signal.h @@ -41,19 +41,27 @@ extern "C" { #endif /** - * @brief _Signal_Manager_initialization + * @brief Signal Manager Initialization + * + * Signal Manager * * This routine performs the initialization necessary for this manager. */ void _Signal_Manager_initialization( void ); /** - * @brief rtems_signal_catch + * @brief RTEMS Catch Signal * * This routine implements the rtems_signal_catch directive. This directive * is used to establish asr_handler as the Asynchronous Signal Routine * (RTEMS_ASR) for the calling task. The asr_handler will execute with a * mode of mode_set. + * + * @param[in] asr_handler is the address of asynchronous signal routine (asr) + * ( NULL indicates asr is invalid ) + * @param[in] mode_set is the mode value for asr + * + * @return RTEMS_SUCCESSFUL */ rtems_status_code rtems_signal_catch( rtems_asr_entry asr_handler, @@ -65,10 +73,10 @@ rtems_status_code rtems_signal_catch( * * This routine implements the rtems_signal_send directive. This directive * sends the signal_set to the task specified by ID. - * + * * @param[in] id is the thread thread id * @param[in] signal_set is the signal set - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_signal_send( diff --git a/cpukit/rtems/include/rtems/rtems/signalmp.h b/cpukit/rtems/include/rtems/rtems/signalmp.h index d05daa8dd2..2b373a92ed 100644 --- a/cpukit/rtems/include/rtems/rtems/signalmp.h +++ b/cpukit/rtems/include/rtems/rtems/signalmp.h @@ -65,7 +65,7 @@ typedef struct { */ /** - * @brief Signal_MP_Send_request_packet + * @brief Signal MP Send Request Packet * * This routine performs a remote procedure call so that a * directive operation can be initiated on another node. @@ -77,7 +77,7 @@ rtems_status_code _Signal_MP_Send_request_packet ( ); /** - * @brief Signal_MP_Send_response_packet + * @brief Signal MP Send Response Packet * * This routine performs a remote procedure call so that a * directive can be performed on another node. @@ -88,7 +88,7 @@ void _Signal_MP_Send_response_packet ( ); /** - * @brief Signal_MP_Process_packet + * @brief Signal MP Process Packet * * This routine performs the actions specific to this package for * the request from another node. @@ -120,7 +120,7 @@ void _Signal_MP_Process_packet ( */ /** - * @brief Signal_MP_Get_packet + * @brief Signal MP Get Packet * * This function is used to obtain a signal mp packet. */ diff --git a/cpukit/rtems/include/rtems/rtems/status.h b/cpukit/rtems/include/rtems/rtems/status.h index 2718d4f063..bb2646e24e 100644 --- a/cpukit/rtems/include/rtems/rtems/status.h +++ b/cpukit/rtems/include/rtems/rtems/status.h @@ -183,6 +183,8 @@ typedef enum { #define RTEMS_STATUS_CODES_LAST RTEMS_PROXY_BLOCKING /** + * @brief Status Object Name Errors to Status Array + * * This array is used to map SuperCore Object Handler return * codes to Classic API status codes. */ diff --git a/cpukit/rtems/include/rtems/rtems/support.h b/cpukit/rtems/include/rtems/rtems/support.h index 99bf405a21..30716de72f 100644 --- a/cpukit/rtems/include/rtems/rtems/support.h +++ b/cpukit/rtems/include/rtems/rtems/support.h @@ -63,7 +63,7 @@ extern "C" { */ /** - * @brief Gets workspace information. + * @brief Gets Workspace Information * * Returns information about the heap that is used as the RTEMS Executive * Workspace in @a the_info. @@ -75,7 +75,7 @@ bool rtems_workspace_get_information( ); /** - * @brief Allocates memory from the workspace. + * @brief Allocates Memory from the Workspace * * A number of @a bytes bytes will be allocated from the RTEMS Executive * Workspace and returned in @a pointer. @@ -88,7 +88,7 @@ bool rtems_workspace_allocate( ); /** - * @brief Frees memory allocated from the workspace. + * @brief Frees Memory Allocated from the Workspace * * This frees the memory indicated by @a pointer that was allocated from the * RTEMS Executive Workspace. diff --git a/cpukit/rtems/include/rtems/rtems/taskmp.h b/cpukit/rtems/include/rtems/rtems/taskmp.h index 28fa73d690..7bf4c1bf2e 100644 --- a/cpukit/rtems/include/rtems/rtems/taskmp.h +++ b/cpukit/rtems/include/rtems/rtems/taskmp.h @@ -68,7 +68,9 @@ typedef struct { } RTEMS_tasks_MP_Packet; /** - * @brief _RTEMS_tasks_MP_Send_process_packet + * @brief RTEMS Tasks MP Send Process Packet + * + * Multiprocessing Support for the RTEMS Task Manager * * This routine performs a remote procedure call so that a * process operation can be performed on another node. diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h index b6b1c1c5b2..607f87ca57 100644 --- a/cpukit/rtems/include/rtems/rtems/tasks.h +++ b/cpukit/rtems/include/rtems/rtems/tasks.h @@ -44,6 +44,8 @@ #include <rtems/rtems/status.h> /** + * @brief Instantiate RTEMS Classic API Tasks Data + * * This constant is defined to extern most of the time when using * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done @@ -255,14 +257,14 @@ void _RTEMS_tasks_Manager_initialization(void); * The task's stack will be stack_size bytes. The task will begin * execution with initial_priority and initial_modes. It returns the * id of the created task in ID. - * + * * @param[in] name is the user defined thread name * @param[in] initial_priority is the thread priority * @param[in] stack_size is the stack size in bytes * @param[in] initial_modes is the initial thread mode * @param[in] attribute_set is the thread attributes * @param[in] id is the pointer to thread id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful * and *id thread id filled in */ @@ -276,7 +278,7 @@ rtems_status_code rtems_task_create( ); /** - * @brief rtems_task_ident + * @brief RTEMS Task Name to Id * * This routine implements the rtems_task_ident directive. * This directive returns the task ID associated with name. @@ -285,6 +287,15 @@ rtems_status_code rtems_task_create( * extent of the search for the ID of the task named name. * The search can be limited to a particular node or allowed to * encompass all nodes. + * + * @param[in] name is the user defined thread name + * @param[in] node is(are) the node(s) to be searched + * @param[in] id is the pointer to thread id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. If successful, the id will + * be filled in with the thread id. */ rtems_status_code rtems_task_ident( rtems_name name, @@ -293,21 +304,35 @@ rtems_status_code rtems_task_ident( ); /** - * @brief rtems_task_delete + * @brief RTEMS Delete Task * * This routine implements the rtems_task_delete directive. The - * task indicated by ID is deleted. + * task indicated by ID is deleted. The executive halts execution + * of the thread and frees the thread control block. + * + * @param[in] id is the thread id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error and id is not the requesting thread. Status code is + * returned indicating the source of the error. Nothing + * is returned if id is the requesting thread (always succeeds). */ rtems_status_code rtems_task_delete( rtems_id id ); /** - * @brief rtems_task_get_note + * @brief RTEMS Get Task Node * * This routine implements the rtems_task_get_note directive. The * value of the indicated notepad for the task associated with ID * is returned in note. + * + * @param[in] id is the thread id + * @param[in] notepad is the notepad number + * @param[out] note is the pointer to note + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_task_get_note( rtems_id id, @@ -316,11 +341,19 @@ rtems_status_code rtems_task_get_note( ); /** - * @brief rtems_task_set_note + * @brief RTEMS Set Task Note * * This routine implements the rtems_task_set_note directive. The * value of the indicated notepad for the task associated with ID * is returned in note. + * + * @param[in] id is the thread id + * @param[in] notepad is the notepad number + * @param[in] note is the note value + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_task_set_note( rtems_id id, @@ -329,12 +362,19 @@ rtems_status_code rtems_task_set_note( ); /** - * @brief rtems_task_mode + * @brief RTEMS Task Mode * * This routine implements the rtems_task_mode directive. The current * values of the modes indicated by mask of the calling task are changed * to that indicated in mode_set. The former mode of the task is * returned in mode_set. + * + * @param[in] mode_set is the new mode + * @param[in] mask is the mask + * @param[in] previous_mode_set is the address of previous mode set + * + * @return RTEMS_SUCCESSFUL and previous_mode_set filled in with the + * previous mode set */ rtems_status_code rtems_task_mode( rtems_mode mode_set, @@ -343,11 +383,16 @@ rtems_status_code rtems_task_mode( ); /** - * @brief rtems_task_restart + * @brief RTEMS Task Restart * * This routine implements the rtems_task_restart directive. The * task associated with ID is restarted at its initial entry * point with the new argument. + * + * @param[in] id is the thread id + * @param[in] arg is the thread argument + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_task_restart( rtems_id id, @@ -355,20 +400,33 @@ rtems_status_code rtems_task_restart( ); /** - * @brief rtems_task_suspend + * @brief RTEMS Suspend Task * * This routine implements the rtems_task_suspend directive. The - * SUSPENDED state is set for task associated with ID. + * SUSPENDED state is set for task associated with ID. Note that the + * suspended state can be in addition to other waiting states. + * + * @param[in] id is the thread id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_task_suspend( rtems_id id ); /** - * @brief rtems_task_resume + * @brief RTEMS Resume Task * * This routine implements the rtems_task_resume Directive. The * SUSPENDED state is cleared for task associated with ID. + * + * @param[in] id is the thread id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_task_resume( rtems_id id @@ -381,11 +439,11 @@ rtems_status_code rtems_task_resume( * current priority of the task associated with ID is set to * new_priority. The former priority of that task is returned * in old_priority. - * + * * @param[in] id is the thread to extract * @param[in] new_priority is the thread to extract * @param[in] old_priority is the thread to extract - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * and *old_priority filled in with the previous previous priority */ @@ -396,7 +454,9 @@ rtems_status_code rtems_task_set_priority( ); /** - * @brief rtems_task_start + * @brief RTEMS Start Task + * + * RTEMS Task Manager * * This routine implements the rtems_task_start directive. The * starting execution point of the task associated with ID is @@ -414,9 +474,9 @@ rtems_status_code rtems_task_start( * This routine implements the rtems_task_wake_when directive. The * calling task is blocked until the current time of day is * equal to that indicated by time_buffer. - * + * * @param[in] time_buffer is the pointer to the time and date structure - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_task_wake_when( @@ -429,7 +489,7 @@ rtems_status_code rtems_task_wake_when( * This routine implements the rtems_task_wake_after directive. The * calling task is blocked until the indicated number of clock * ticks have occurred. - * + * * @param[in] ticks is the number of ticks to wait * @return RTEMS_SUCCESSFUL */ @@ -439,16 +499,18 @@ rtems_status_code rtems_task_wake_after( /** * @brief rtems_task_is_suspended - + * * This directive returns a status indicating whether or not * the specified task is suspended. + * + * RTEMS Task Manager */ rtems_status_code rtems_task_is_suspended( rtems_id id ); /** - * @brief rtems_task_variable_add + * @brief RTEMS Add Task Variable * * This directive adds a per task variable. */ @@ -459,7 +521,9 @@ rtems_status_code rtems_task_variable_add( ); /** - * @brief rtems_task_variable_get + * @brief Get a per-task variable + * + * RTEMS Task Variable Get * * This directive gets the value of a task variable. */ @@ -480,7 +544,7 @@ rtems_status_code rtems_task_variable_delete( ); /** - * @brief rtems_task_self + * @brief RTEMS Get Self Task Id * * This directive returns the ID of the currently executing task. */ @@ -495,14 +559,10 @@ rtems_id rtems_task_self(void); void _RTEMS_tasks_Initialize_user_tasks( void ); /** - * @brief _RTEMS_Tasks_Invoke_task_variable_dtor + * @brief RTEMS Tasks Invoke Task Variable Destructor * * This routine invokes the optional user provided destructor on the * task variable and frees the memory for the task variable. - * - * Input parameters: NONE - * - * Output parameters: NONE */ void _RTEMS_Tasks_Invoke_task_variable_dtor( Thread_Control *the_thread, @@ -518,6 +578,8 @@ void _RTEMS_Tasks_Invoke_task_variable_dtor( * Input parameters: NONE * * Output parameters: NONE + * + * RTEMS Task Manager */ extern void _RTEMS_tasks_Initialize_user_tasks_body( void ); diff --git a/cpukit/rtems/include/rtems/rtems/timer.h b/cpukit/rtems/include/rtems/rtems/timer.h index 982f5dabd0..d8c7760403 100644 --- a/cpukit/rtems/include/rtems/rtems/timer.h +++ b/cpukit/rtems/include/rtems/rtems/timer.h @@ -37,6 +37,8 @@ #define _RTEMS_RTEMS_TIMER_H /** + * @brief Instantiate RTEMS Timer Data + * * This constant is defined to extern most of the time when using * this header file. However by defining it to nothing, the data * declared in this header file can be instantiated. This is done @@ -220,18 +222,23 @@ RTEMS_TIMER_EXTERN Timer_server_Control *volatile _Timer_server; RTEMS_TIMER_EXTERN Objects_Information _Timer_Information; /** - * @brief _Timer_Manager_initialization + * @brief Timer Manager Initialization * * This routine performs the initialization necessary for this manager. */ void _Timer_Manager_initialization(void); /** - * @brief rtems_timer_create + * @brief RTEMS Create Timer * * This routine implements the rtems_timer_create directive. The * timer will have the name name. It returns the id of the * created timer in ID. + * + * @param[in] name is the timer name + * @param[out] id is the pointer to timer id + * + * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful */ rtems_status_code rtems_timer_create( rtems_name name, @@ -245,10 +252,10 @@ rtems_status_code rtems_timer_create( * This directive returns the timer ID associated with name. * If more than one timer is named name, then the timer * to which the ID belongs is arbitrary. - * + * * @param[in] name is the user defined message queue name * @param[in] id is the pointer to timer id - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * id filled with the message queue id */ @@ -268,23 +275,38 @@ rtems_status_code rtems_timer_cancel( ); /** - * @brief rtems_timer_delete + * @brief RTEMS Delete Timer * * This routine implements the rtems_timer_delete directive. The * timer indicated by ID is deleted. + * + * @param[in] id is the timer id + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_timer_delete( rtems_id id ); /** - * @brief rtems_timer_fire_after + * @brief RTEMS Timer Fire After * * This routine implements the rtems_timer_fire_after directive. It * initiates the timer associated with ID to fire in ticks clock ticks. * When the timer fires, the routine will be invoked in the context * of the rtems_clock_tick directive which is normally invoked as * part of servicing a periodic interupt. + * + * @param[in] id is the timer id + * @param[in] ticks is the interval until routine is fired + * @param[in] routine is the routine to schedule + * @param[in] user_data is the passed as argument to routine when it is fired + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_timer_fire_after( rtems_id id, @@ -294,13 +316,22 @@ rtems_status_code rtems_timer_fire_after( ); /** - * @brief rtems_timer_server_fire_after + * @brief RTEMS Timer Server Fire After * * This routine implements the rtems_timer_server_fire_after directive. It * initiates the timer associated with ID to fire in ticks clock * ticks. When the timer fires, the routine will be invoked by the * Timer Server in the context of a task NOT IN THE CONTEXT of the * clock tick interrupt. + * + * @param[in] id is the timer id + * @param[in] ticks is the interval until routine is fired + * @param[in] routine is the routine to schedule + * @param[in] user_data is the passed as argument to routine when it is fired + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_timer_server_fire_after( rtems_id id, @@ -310,13 +341,22 @@ rtems_status_code rtems_timer_server_fire_after( ); /** - * @brief rtems_timer_fire_when + * @brief RTEMS Timer Fire When * * This routine implements the rtems_timer_fire_when directive. It * initiates the timer associated with ID to fire at wall_time * When the timer fires, the routine will be invoked in the context * of the rtems_clock_tick directive which is normally invoked as * part of servicing a periodic interupt. + * + * @param[in] id is the timer id + * @param[in] wall_time is the time of day to fire timer + * @param[in] routine is the routine to schedule + * @param[in] user_data is the passed as argument to routine when it is fired + * + * @return This method returns RTEMS_SUCCESSFUL if there was not an + * error. Otherwise, a status code is returned indicating the + * source of the error. */ rtems_status_code rtems_timer_fire_when( rtems_id id, @@ -326,7 +366,9 @@ rtems_status_code rtems_timer_fire_when( ); /** - * @brief rtems_timer_server_fire_when + * @brief RTEMS Timer Server Fire When Directive + * + * Timer Manager - RTEMS Timer Server Fire When Directive * * This routine implements the rtems_timer_server_fire_when directive. It * initiates the timer associated with ID to fire at wall_time @@ -342,7 +384,9 @@ rtems_status_code rtems_timer_server_fire_when( ); /** - * @brief rtems_timer_reset + * @brief RTEMS Timer Reset + * + * Timer Manager - RTEMS Timer Reset * * This routine implements the rtems_timer_reset directive. It is used * to reinitialize the interval timer associated with ID just as if @@ -393,10 +437,10 @@ typedef struct { * * This routine implements the rtems_timer_get_information directive. * This directive returns information about the timer. - * + * * @param[in] id is the timer id * @param[in] the_info is the pointer to timer information block - * + * * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful and * *the_info region information block filled in */ diff --git a/cpukit/rtems/src/barriercreate.c b/cpukit/rtems/src/barriercreate.c index 80d616f1b1..b2450148d0 100644 --- a/cpukit/rtems/src/barriercreate.c +++ b/cpukit/rtems/src/barriercreate.c @@ -1,6 +1,11 @@ -/* - * Barrier Manager -- Create a Barrier Instance +/** + * @file * + * @brief RTEMS Create Barrier + * @ingroup ClassicBarrier Barriers + */ + +/* * COPYRIGHT (c) 1989-2006. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/barrierdata.c b/cpukit/rtems/src/barrierdata.c index f9e03fb5a8..6481dbc3f7 100644 --- a/cpukit/rtems/src/barrierdata.c +++ b/cpukit/rtems/src/barrierdata.c @@ -1,6 +1,11 @@ -/* - * Barrier Manager -- Instantiate Data +/** + * @file * + * @brief Instantiate Barrier Data + * @ingroup ClassicBarrier Barriers + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/barrierdelete.c b/cpukit/rtems/src/barrierdelete.c index 9811773ac6..a73846dc6e 100644 --- a/cpukit/rtems/src/barrierdelete.c +++ b/cpukit/rtems/src/barrierdelete.c @@ -1,6 +1,11 @@ -/* - * Barrier Manager -- Delete a Barrier +/** + * @file * + * @brief RTEMS Delete Barrier + * @ingroup ClassicBarrier + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -21,21 +26,6 @@ #include <rtems/score/thread.h> #include <rtems/score/threadq.h> -/* - * rtems_barrier_delete - * - * This directive allows a thread to delete a barrier specified by - * the barrier id. The barrier is freed back to the inactive - * barrier chain. - * - * Input parameters: - * id - barrier id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_barrier_delete( rtems_id id ) diff --git a/cpukit/rtems/src/barrierrelease.c b/cpukit/rtems/src/barrierrelease.c index 2393d66aab..550d82a2dd 100644 --- a/cpukit/rtems/src/barrierrelease.c +++ b/cpukit/rtems/src/barrierrelease.c @@ -1,6 +1,11 @@ -/* - * Barrier Manager -- Release Tasks Waitng at a Barrier +/** + * @file * + * @brief RTEMS Barrier Release + * @ingroup ClassicBarrier Barriers + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/barriertranslatereturncode.c b/cpukit/rtems/src/barriertranslatereturncode.c index 423de90868..424be88892 100644 --- a/cpukit/rtems/src/barriertranslatereturncode.c +++ b/cpukit/rtems/src/barriertranslatereturncode.c @@ -1,6 +1,11 @@ -/* - * Barrier Manager -- Translate SuperCore Status +/** + * @file * + * @brief Translate SuperCore Barrier Status Code to RTEMS Status Code + * @ingroup ClassicBarrier + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -18,17 +23,6 @@ #include <rtems/rtems/support.h> #include <rtems/rtems/barrier.h> -/* - * _Barrier_Translate_core_barrier_return_code - * - * Input parameters: - * the_barrier_status - barrier status code to translate - * - * Output parameters: - * rtems status code - translated RTEMS status code - * - */ - rtems_status_code _Barrier_Translate_core_barrier_return_code_[] = { RTEMS_SUCCESSFUL, /* CORE_BARRIER_STATUS_SUCCESSFUL */ RTEMS_SUCCESSFUL, /* CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED */ diff --git a/cpukit/rtems/src/clockget.c b/cpukit/rtems/src/clockget.c index 476d046fbd..45f4c299e1 100644 --- a/cpukit/rtems/src/clockget.c +++ b/cpukit/rtems/src/clockget.c @@ -1,6 +1,11 @@ -/* - * Clock Manager +/** + * @file * + * @brief Obtain Current Time of Day + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -21,23 +26,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_clock_get - * - * This directive returns the current date and time. If the time has - * not been set by a tm_set then an error is returned. - * - * Input parameters: - * option - which value to return - * time_buffer - pointer to output buffer (a time and date structure - * or an interval) - * - * Output parameters: - * time_buffer - output filled in - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_clock_get( rtems_clock_get_options option, void *time_buffer diff --git a/cpukit/rtems/src/clockgettickssinceboot.c b/cpukit/rtems/src/clockgettickssinceboot.c index 96a1c5e9a8..cfd91b5c57 100644 --- a/cpukit/rtems/src/clockgettickssinceboot.c +++ b/cpukit/rtems/src/clockgettickssinceboot.c @@ -1,6 +1,11 @@ -/* - * Clock Manager - Get Ticks Since Boot +/** + * @file * + * @brief Obtain Ticks Since Boot + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/clockgettod.c b/cpukit/rtems/src/clockgettod.c index dd68ec578d..18f7773912 100644 --- a/cpukit/rtems/src/clockgettod.c +++ b/cpukit/rtems/src/clockgettod.c @@ -1,6 +1,11 @@ -/* - * Clock Manager - rtems_clock_get_tod +/** + * @file * + * @brief Obtain Current Time of Day (Classic TOD) + * @ingroup ClassicClock Clocks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/clockgettodtimeval.c b/cpukit/rtems/src/clockgettodtimeval.c index a3fb49d92e..b2d7c52784 100644 --- a/cpukit/rtems/src/clockgettodtimeval.c +++ b/cpukit/rtems/src/clockgettodtimeval.c @@ -1,6 +1,11 @@ -/* - * Clock Manager - Get TOD in Time Value Format +/** + * @file * + * @brief Obtain TOD in struct timeval Format + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/clockgetuptime.c b/cpukit/rtems/src/clockgetuptime.c index 05d2575b60..848fd34b04 100644 --- a/cpukit/rtems/src/clockgetuptime.c +++ b/cpukit/rtems/src/clockgetuptime.c @@ -1,6 +1,11 @@ -/* - * Clock Manager - get uptime +/** + * @file * + * @brief Obtain the System Uptime + * @ingroup ClassicClock Clocks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/clockgetuptimeseconds.c b/cpukit/rtems/src/clockgetuptimeseconds.c index dc98d1d9e9..655a18e1e3 100644 --- a/cpukit/rtems/src/clockgetuptimeseconds.c +++ b/cpukit/rtems/src/clockgetuptimeseconds.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Returns the system uptime in seconds. + * @ingroup ClassicClock Clocks + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/rtems/src/clockset.c b/cpukit/rtems/src/clockset.c index 55ec3935ef..74a50f7233 100644 --- a/cpukit/rtems/src/clockset.c +++ b/cpukit/rtems/src/clockset.c @@ -1,6 +1,11 @@ -/* - * Clock Manager +/** + * @file * + * @brief Set the Current TOD + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -22,19 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_clock_set - * - * This directive sets the date and time for this node. - * - * Input parameters: - * tod - pointer to the time and date structure - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_clock_set( const rtems_time_of_day *tod ) diff --git a/cpukit/rtems/src/clocksetnsecshandler.c b/cpukit/rtems/src/clocksetnsecshandler.c index 100db9b167..80cf1dd8e6 100644 --- a/cpukit/rtems/src/clocksetnsecshandler.c +++ b/cpukit/rtems/src/clocksetnsecshandler.c @@ -1,6 +1,11 @@ -/* - * Clock Manager +/** + * @file * + * @brief Set the BSP specific Nanoseconds Extension + * @ingroup ClassicClock Clocks + */ + +/* * COPYRIGHT (c) 1989-2006. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/clocktick.c b/cpukit/rtems/src/clocktick.c index a00d021a2b..1bd91ac336 100644 --- a/cpukit/rtems/src/clocktick.c +++ b/cpukit/rtems/src/clocktick.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Announce a Clock Tick + * @ingroup ClassicClock + */ + /* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). @@ -19,21 +26,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_clock_tick - * - * This directive notifies the executve that a tick has occurred. - * When the tick occurs the time manager updates and maintains - * the calendar time, timeslicing, and any timeout delays. - * - * Input parameters: NONE - * - * Output parameters: - * RTEMS_SUCCESSFUL - always succeeds - * - * NOTE: This routine only works for leap-years through 2099. - */ - rtems_status_code rtems_clock_tick( void ) { _TOD_Tickle_ticks(); diff --git a/cpukit/rtems/src/clocktodtoseconds.c b/cpukit/rtems/src/clocktodtoseconds.c index a27455b056..9f80b5390b 100644 --- a/cpukit/rtems/src/clocktodtoseconds.c +++ b/cpukit/rtems/src/clocktodtoseconds.c @@ -1,6 +1,11 @@ -/* - * Time of Day (TOD) Handler - Classic TOD to Seconds +/** + * @file * + * @brief TOD to Seconds + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -37,20 +42,6 @@ const uint16_t _TOD_Days_to_date[2][13] = { const uint16_t _TOD_Days_since_last_leap_year[4] = { 0, 366, 731, 1096 }; - -/* - * _TOD_To_seconds - * - * This routine returns the seconds from the epoch until the - * current date and time. - * - * Input parameters: - * the_tod - pointer to the time and date structure - * - * Output parameters: - * returns - seconds since epoch until the_tod - */ - uint32_t _TOD_To_seconds( const rtems_time_of_day *the_tod ) diff --git a/cpukit/rtems/src/clocktodvalidate.c b/cpukit/rtems/src/clocktodvalidate.c index 7aa854cd81..a56b1df56b 100644 --- a/cpukit/rtems/src/clocktodvalidate.c +++ b/cpukit/rtems/src/clocktodvalidate.c @@ -1,7 +1,11 @@ -/* - * Time of Day (TOD) Handler -- Validate Classic TOD - * +/** + * @file * + * @brief TOD Validate + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -29,21 +33,6 @@ const uint32_t _TOD_Days_per_month[ 2 ][ 13 ] = { { 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } }; -/* - * _TOD_Validate - * - * This kernel routine checks the validity of a date and time structure. - * - * Input parameters: - * the_tod - pointer to a time and date structure - * - * Output parameters: - * true - if the date, time, and tick are valid - * false - if the the_tod is invalid - * - * NOTE: This routine only works for leap-years through 2099. - */ - bool _TOD_Validate( const rtems_time_of_day *the_tod ) diff --git a/cpukit/rtems/src/dpmem.c b/cpukit/rtems/src/dpmem.c index 168082dc6d..88f06caeee 100644 --- a/cpukit/rtems/src/dpmem.c +++ b/cpukit/rtems/src/dpmem.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief Dual Ported Memory Manager Initialization + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -22,17 +27,6 @@ #include <rtems/score/object.h> #include <rtems/score/thread.h> -/* - * _Dual_ported_memory_Manager_initialization - * - * This routine initializes all dual-ported memory manager related - * data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Dual_ported_memory_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/dpmemcreate.c b/cpukit/rtems/src/dpmemcreate.c index 7ac6ae91fb..6987670e61 100644 --- a/cpukit/rtems/src/dpmemcreate.c +++ b/cpukit/rtems/src/dpmemcreate.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief RTEMS Create Port + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -22,24 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/rtems/dpmem.h> -/* - * rtems_port_create - * - * This directive creates a port into a dual-ported memory area. - * - * Input parameters: - * name - user defined port name - * internal_start - internal start address of port - * external_start - external start address of port - * length - physical length in bytes - * id - address of port id to set - * - * Output parameters: - * id - port id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_port_create( rtems_name name, void *internal_start, diff --git a/cpukit/rtems/src/dpmemdata.c b/cpukit/rtems/src/dpmemdata.c index 088fefea23..dac78730c7 100644 --- a/cpukit/rtems/src/dpmemdata.c +++ b/cpukit/rtems/src/dpmemdata.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager -- Instantiate Data +/** + * @file * + * @brief Define the internal Dual Ported Memory information + * @ingroup ClassicDPMEM Dual Ported Memory + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/dpmemdelete.c b/cpukit/rtems/src/dpmemdelete.c index 02c3fbb901..4f78035346 100644 --- a/cpukit/rtems/src/dpmemdelete.c +++ b/cpukit/rtems/src/dpmemdelete.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief RTEMS Delete Port + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -22,20 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/rtems/dpmem.h> -/* - * rtems_port_delete - * - * This directive allows a thread to delete a dual-ported memory area - * specified by the dual-ported memory identifier. - * - * Input parameters: - * id - dual-ported memory area id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_port_delete( rtems_id id ) diff --git a/cpukit/rtems/src/dpmemexternal2internal.c b/cpukit/rtems/src/dpmemexternal2internal.c index c6f1c11d7b..f5248fe946 100644 --- a/cpukit/rtems/src/dpmemexternal2internal.c +++ b/cpukit/rtems/src/dpmemexternal2internal.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief RTEMS Port External to Internal + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -22,24 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/rtems/dpmem.h> -/* - * rtems_port_external_to_internal - * - * This directive converts an external dual-ported memory address to an - * internal dual-ported memory address. If the given external address - * is an invalid dual-ported address, then the internal address is set - * to the given external address. - * - * Input parameters: - * id - id of dp memory object - * external - external address - * internal - pointer of internal address to set - * - * Output parameters: - * internal - internal address - * RTEMS_SUCCESSFUL - always succeeds - */ - rtems_status_code rtems_port_external_to_internal( rtems_id id, void *external, diff --git a/cpukit/rtems/src/dpmemident.c b/cpukit/rtems/src/dpmemident.c index e8e2a359ac..8004c19ca9 100644 --- a/cpukit/rtems/src/dpmemident.c +++ b/cpukit/rtems/src/dpmemident.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief RTEMS Port Name to Id + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -22,22 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/rtems/dpmem.h> -/* - * rtems_port_ident - * - * This directive returns the system ID associated with - * the port name. - * - * Input parameters: - * name - user defined port name - * id - pointer to port id - * - * Output parameters: - * *id - port id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_port_ident( rtems_name name, rtems_id *id diff --git a/cpukit/rtems/src/dpmeminternal2external.c b/cpukit/rtems/src/dpmeminternal2external.c index 6e61566f43..a6c8d833ae 100644 --- a/cpukit/rtems/src/dpmeminternal2external.c +++ b/cpukit/rtems/src/dpmeminternal2external.c @@ -1,6 +1,11 @@ -/* - * Dual Port Memory Manager +/** + * @file * + * @brief RTEMS Port Internal to External + * @ingroup ClassicDPMEM + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -22,24 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/rtems/dpmem.h> -/* - * rtems_port_internal_to_external - * - * This directive converts an internal dual-ported memory address to an - * external dual-ported memory address. If the given internal address - * is an invalid dual-ported address, then the external address is set - * to the given internal address. - * - * Input parameters: - * id - id of dual-ported memory object - * internal - internal address to set - * external - pointer to external address - * - * Output parameters: - * external - external address - * RTEMS_SUCCESSFUL - always succeeds - */ - rtems_status_code rtems_port_internal_to_external( rtems_id id, void *internal, diff --git a/cpukit/rtems/src/eventmp.c b/cpukit/rtems/src/eventmp.c index 0d640ce7fb..d4c890b434 100644 --- a/cpukit/rtems/src/eventmp.c +++ b/cpukit/rtems/src/eventmp.c @@ -1,6 +1,11 @@ -/* - * Multiprocessing Support for the Event Manager +/** + * @file * + * @brief Event MP Support + * @ingroup ClassicEventMP + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -37,11 +42,6 @@ RTEMS_STATIC_ASSERT( * */ -/* - * _Event_MP_Send_request_packet - * - */ - rtems_status_code _Event_MP_Send_request_packet ( Event_MP_Remote_operations operation, Objects_Id event_id, @@ -82,11 +82,6 @@ rtems_status_code _Event_MP_Send_request_packet ( return RTEMS_SUCCESSFUL; } -/* - * _Event_MP_Send_response_packet - * - */ - void _Event_MP_Send_response_packet ( Event_MP_Remote_operations operation, Thread_Control *the_thread @@ -119,12 +114,6 @@ void _Event_MP_Send_response_packet ( } } -/* - * - * _Event_MP_Process_packet - * - */ - void _Event_MP_Process_packet ( rtems_packet_prefix *the_packet_prefix ) @@ -176,11 +165,6 @@ void _Event_MP_Process_packet ( * */ -/* - * _Event_MP_Get_packet - * - */ - Event_MP_Packet *_Event_MP_Get_packet ( void ) { return ( (Event_MP_Packet *) _MPCI_Get_packet() ); diff --git a/cpukit/rtems/src/eventreceive.c b/cpukit/rtems/src/eventreceive.c index 0361d2c56b..a6e32ba8f8 100644 --- a/cpukit/rtems/src/eventreceive.c +++ b/cpukit/rtems/src/eventreceive.c @@ -1,6 +1,11 @@ -/* - * Event Manager +/** + * @file * + * @brief Constant used to receive the set of currently pending events in + * @ingroup ClassicEventSet Event Set + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c index c88f3f724b..4cb1f80d69 100644 --- a/cpukit/rtems/src/eventseize.c +++ b/cpukit/rtems/src/eventseize.c @@ -1,6 +1,11 @@ -/* - * Event Manager +/** + * @file * + * @brief Event Manager Initialization + * @ingroup ClassicEvent Events + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/eventtimeout.c b/cpukit/rtems/src/eventtimeout.c index 6e81a804ff..58dee84b1b 100644 --- a/cpukit/rtems/src/eventtimeout.c +++ b/cpukit/rtems/src/eventtimeout.c @@ -1,6 +1,11 @@ -/* - * Event Manager +/** + * @file * + * @brief Timeout Event + * @ingroup ClassicEvent + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/modes.c b/cpukit/rtems/src/modes.c index 0c51281177..6e4acff225 100644 --- a/cpukit/rtems/src/modes.c +++ b/cpukit/rtems/src/modes.c @@ -1,12 +1,11 @@ /** * @file * - * @body Body for Mode Routines Implemented as Macros - * - * This file contains bodies for Mode Macros which are - * needed by language bindings other than C and C++. + * @brief Body for RTEMS_INTERRUPT_LEVEL Macro + * @ingroup ClassicModes */ + /* * COPYRIGHT (c) 1989-2012. * On-Line Applications Research Corporation (OAR). diff --git a/cpukit/rtems/src/mp.c b/cpukit/rtems/src/mp.c index dc352ca8e7..2d2996c3c0 100644 --- a/cpukit/rtems/src/mp.c +++ b/cpukit/rtems/src/mp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Manager - * +/** + * @file * + * @brief MP Support + * @ingroup ClassicMP + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -19,20 +23,10 @@ #include <rtems/rtems/mp.h> #include <rtems/score/mpci.h> -/* - * _Multiprocessing_Manager_initialization - * - */ - void _Multiprocessing_Manager_initialization ( void ) { } -/* - * rtems_multiprocessing_announce - * - */ - void rtems_multiprocessing_announce ( void ) { _MPCI_Announce(); diff --git a/cpukit/rtems/src/msg.c b/cpukit/rtems/src/msg.c index 009cc28e3b..9ce07ebd22 100644 --- a/cpukit/rtems/src/msg.c +++ b/cpukit/rtems/src/msg.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief Message Queue Manager Initialization + * @ingroup ClassicMessageQueue + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -33,17 +37,6 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/support.h> -/* - * _Message_queue_Manager_initialization - * - * This routine initializes all message queue manager related - * data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Message_queue_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/msgmp.c b/cpukit/rtems/src/msgmp.c index 666fad21ba..39f824750b 100644 --- a/cpukit/rtems/src/msgmp.c +++ b/cpukit/rtems/src/msgmp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Support for the Message Queue Manager - * +/** + * @file * + * @brief Multiprocessing Support for the Message Queue Manager + * @ingroup ClassicMsgMP Message Queue MP Support + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/msgqallocate.c b/cpukit/rtems/src/msgqallocate.c index 39c60c9e81..7251289314 100644 --- a/cpukit/rtems/src/msgqallocate.c +++ b/cpukit/rtems/src/msgqallocate.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief Message Queue Allocate + * @ingroup ClassicMessageQueue + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -32,20 +36,6 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/support.h> -/* - * _Message_queue_Allocate - * - * Allocate a message queue and the space for its messages - * - * Input parameters: - * the_message_queue - the message queue to allocate message buffers - * count - maximum message and reserved buffer count - * max_message_size - maximum size of each message - * - * Output parameters: - * the_message_queue - set if successful, NULL otherwise - */ - Message_queue_Control *_Message_queue_Allocate(void) { return (Message_queue_Control *) diff --git a/cpukit/rtems/src/msgqcreate.c b/cpukit/rtems/src/msgqcreate.c index a5cce2bd1d..e65dcacfe6 100644 --- a/cpukit/rtems/src/msgqcreate.c +++ b/cpukit/rtems/src/msgqcreate.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief RTEMS Create Message Queue + * @ingroup ClassicMessageQueue + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -32,25 +36,6 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/support.h> -/* - * rtems_message_queue_create - * - * This directive creates a message queue by allocating and initializing - * a message queue data structure. - * - * Input parameters: - * name - user defined queue name - * count - maximum message and reserved buffer count - * max_message_size - maximum size of each message - * attribute_set - process method - * id - pointer to queue - * - * Output parameters: - * id - queue id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_message_queue_create( rtems_name name, uint32_t count, diff --git a/cpukit/rtems/src/msgqflush.c b/cpukit/rtems/src/msgqflush.c index e62047ef0e..a14e96dae0 100644 --- a/cpukit/rtems/src/msgqflush.c +++ b/cpukit/rtems/src/msgqflush.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief rtems_message_queue_flush + * @ingroup ClassicMessageQueue Message Queues + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/msgqgetnumberpending.c b/cpukit/rtems/src/msgqgetnumberpending.c index 9941317652..0139144623 100644 --- a/cpukit/rtems/src/msgqgetnumberpending.c +++ b/cpukit/rtems/src/msgqgetnumberpending.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief RTEMS Message Queue Get Number Pending + * @ingroup ClassicMessageQueue Message Queues + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/msgqreceive.c b/cpukit/rtems/src/msgqreceive.c index 00ed6c2eba..6be06ad67c 100644 --- a/cpukit/rtems/src/msgqreceive.c +++ b/cpukit/rtems/src/msgqreceive.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief RTEMS Message Queue Receive + * @ingroup ClassicMessageQueue + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -32,24 +36,6 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/support.h> -/* - * rtems_message_queue_receive - * - * This directive dequeues a message from the designated message queue - * and copies it into the requesting thread's buffer. - * - * Input parameters: - * id - queue id - * buffer - pointer to message buffer - * size - size of message receive - * option_set - options on receive - * timeout - number of ticks to wait - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_message_queue_receive( rtems_id id, void *buffer, diff --git a/cpukit/rtems/src/msgqsend.c b/cpukit/rtems/src/msgqsend.c index 5fbcfa1c0a..764859d745 100644 --- a/cpukit/rtems/src/msgqsend.c +++ b/cpukit/rtems/src/msgqsend.c @@ -1,6 +1,11 @@ -/* - * Message Queue Manager - rtems_message_queue_send +/** + * @file * + * @brief rtems_message_queue_send + * @ingroup ClassicMessageQueue Message Queues + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/msgqtranslatereturncode.c b/cpukit/rtems/src/msgqtranslatereturncode.c index aa3ba0ce74..d7d1a5610d 100644 --- a/cpukit/rtems/src/msgqtranslatereturncode.c +++ b/cpukit/rtems/src/msgqtranslatereturncode.c @@ -1,7 +1,11 @@ -/* - * Message Queue Manager - * +/** + * @file * + * @brief Message queue Translate Core Message Queue Return Code + * @ingroup ClassicMessageQueue + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -32,17 +36,6 @@ #include <rtems/rtems/options.h> #include <rtems/rtems/support.h> -/* - * _Message_queue_Translate_core_message_queue_return_code - * - * Input parameters: - * the_message_queue_status - message_queue status code to translate - * - * Output parameters: - * rtems status code - translated RTEMS status code - * - */ - rtems_status_code _Message_queue_Translate_core_return_code_[] = { RTEMS_SUCCESSFUL, /* CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL */ RTEMS_INVALID_SIZE, /* CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE */ diff --git a/cpukit/rtems/src/part.c b/cpukit/rtems/src/part.c index 65e5331ed0..042cdaf19a 100644 --- a/cpukit/rtems/src/part.c +++ b/cpukit/rtems/src/part.c @@ -1,6 +1,11 @@ -/* - * Partition Manager +/** + * @file * + * @brief Partition Manager Initialization + * @ingroup ClassicPart + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -23,17 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/score/sysstate.h> -/* - * _Partition_Manager_initialization - * - * This routine initializes all partition manager related - * data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Partition_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/partcreate.c b/cpukit/rtems/src/partcreate.c index ae1ec709b8..536f56e294 100644 --- a/cpukit/rtems/src/partcreate.c +++ b/cpukit/rtems/src/partcreate.c @@ -1,7 +1,11 @@ -/* - * Partition Manager - * +/** + * @file * + * @brief RTEMS Partition Create + * @ingroup ClassicPart Partitions + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/partdata.c b/cpukit/rtems/src/partdata.c index 10332f1dba..b568c4dc0c 100644 --- a/cpukit/rtems/src/partdata.c +++ b/cpukit/rtems/src/partdata.c @@ -1,6 +1,11 @@ -/* - * Partition Manager -- Instantiate Data +/** + * @file * + * @brief Instantiate RTEMS Partition Data + * @ingroup ClassicPart Partitions + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/partdelete.c b/cpukit/rtems/src/partdelete.c index 6cae308b13..6aeee4e422 100644 --- a/cpukit/rtems/src/partdelete.c +++ b/cpukit/rtems/src/partdelete.c @@ -1,7 +1,11 @@ -/* - * Partition Manager - * +/** + * @file * + * @brief RTEMS Delete Partition + * @ingroup ClassicPart + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,21 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/score/sysstate.h> -/* - * rtems_partition_delete - * - * This directive allows a thread to delete a partition specified by - * the partition identifier, provided that none of its buffers are - * still allocated. - * - * Input parameters: - * id - partition id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_partition_delete( rtems_id id ) diff --git a/cpukit/rtems/src/partgetbuffer.c b/cpukit/rtems/src/partgetbuffer.c index 2a32c4e57f..f281fe4e65 100644 --- a/cpukit/rtems/src/partgetbuffer.c +++ b/cpukit/rtems/src/partgetbuffer.c @@ -1,7 +1,11 @@ -/* - * Partition Manager - * +/** + * @file * + * @brief RTEMS Get Partition Buffer + * @ingroup ClassicPart + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,21 +27,6 @@ #include <rtems/score/thread.h> #include <rtems/score/sysstate.h> -/* - * rtems_partition_get_buffer - * - * This directive will obtain a buffer from a buffer partition. - * - * Input parameters: - * id - partition id - * buffer - pointer to buffer address - * - * Output parameters: - * buffer - pointer to buffer address filled in - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_partition_get_buffer( rtems_id id, void **buffer diff --git a/cpukit/rtems/src/partmp.c b/cpukit/rtems/src/partmp.c index 6a1fbc9878..2928238924 100644 --- a/cpukit/rtems/src/partmp.c +++ b/cpukit/rtems/src/partmp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Support for the Partition Manager - * +/** + * @file * + * @brief Partition_MP_Send_process_packet + * @ingroup ClassicPartMP Partition MP Support + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/ratemon.c b/cpukit/rtems/src/ratemon.c index d2eba801da..d96a9b0612 100644 --- a/cpukit/rtems/src/ratemon.c +++ b/cpukit/rtems/src/ratemon.c @@ -1,7 +1,11 @@ -/* - * Rate Monotonic Manager - * +/** + * @file * + * @brief Rate Monotonic Manager Initialization + * @ingroup ClassicRateMon + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -23,20 +27,6 @@ #include <rtems/rtems/ratemon.h> #include <rtems/score/thread.h> -/* - * _Rate_monotonic_Manager_initialization - * - * This routine initializes all Rate Monotonic Manager related - * data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * NOTE: The Rate Monotonic Manager is built on top of the Watchdog - * Handler. - */ - void _Rate_monotonic_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/ratemoncreate.c b/cpukit/rtems/src/ratemoncreate.c index 80627f224a..2e5e975d5d 100644 --- a/cpukit/rtems/src/ratemoncreate.c +++ b/cpukit/rtems/src/ratemoncreate.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Create a Period +/** + * @file * + * @brief Create a Period + * @ingroup ClassicRateMon Rate Monotonic Scheduler + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/ratemondelete.c b/cpukit/rtems/src/ratemondelete.c index 751c7f53d8..15498ea833 100644 --- a/cpukit/rtems/src/ratemondelete.c +++ b/cpukit/rtems/src/ratemondelete.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Delete a Period +/** + * @file * + * @brief RTEMS Delete Rate Monotonic + * @ingroup ClassicRateMon + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -21,19 +26,6 @@ #include <rtems/rtems/ratemon.h> #include <rtems/score/thread.h> -/* - * rtems_rate_monotonic_delete - * - * This directive allows a thread to delete a rate monotonic timer. - * - * Input parameters: - * id - rate monotonic id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_rate_monotonic_delete( rtems_id id ) diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/ratemongetstatus.c index 73c59ee121..5d0d584063 100644 --- a/cpukit/rtems/src/ratemongetstatus.c +++ b/cpukit/rtems/src/ratemongetstatus.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Get Status +/** + * @file * + * @brief RTEMS Rate Monotonic Get Status + * @ingroup ClassicRateMon + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -25,22 +30,6 @@ #include <rtems/score/timespec.h> #endif -/* - * rtems_rate_monotonic_get_status - * - * This directive allows a thread to obtain status information on a - * period. - * - * Input parameters: - * id - rate monotonic id - * status - pointer to status control block - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - * - */ - rtems_status_code rtems_rate_monotonic_get_status( rtems_id id, rtems_rate_monotonic_period_status *status diff --git a/cpukit/rtems/src/ratemonident.c b/cpukit/rtems/src/ratemonident.c index 35e4195e09..def958060d 100644 --- a/cpukit/rtems/src/ratemonident.c +++ b/cpukit/rtems/src/ratemonident.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Name to Id Lookup +/** + * @file * + * @brief RTEMS Rate Monotonic Name to Id + * @ingroup ClassicRateMon + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -21,22 +26,6 @@ #include <rtems/rtems/ratemon.h> #include <rtems/score/thread.h> -/* - * rtems_rate_monotonic_ident - * - * This directive returns the system ID associated with - * the rate monotonic period name. - * - * Input parameters: - * name - user defined period name - * id - pointer to period id - * - * Output parameters: - * *id - region id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_rate_monotonic_ident( rtems_name name, rtems_id *id diff --git a/cpukit/rtems/src/ratemonreportstatistics.c b/cpukit/rtems/src/ratemonreportstatistics.c index c94171c107..daf5fb5c7f 100644 --- a/cpukit/rtems/src/ratemonreportstatistics.c +++ b/cpukit/rtems/src/ratemonreportstatistics.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Report Statistics for All Periods +/** + * @file * + * @brief RTEMS Report Rate Monotonic Statistics + * @ingroup ClassicRateMon + */ + +/* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * @@ -28,14 +33,6 @@ #define NANOSECONDS_FMT "%06" PRId32 #endif -/* - * This directive allows a thread to print the statistics information - * on ALL period instances which have non-zero counts using printk. - * - * The implementation of this directive straddles the fence between - * inside and outside of RTEMS. It is presented as part of the Manager - * but actually uses other services of the Manager. - */ void rtems_rate_monotonic_report_statistics_with_plugin( void *context, rtems_printk_plugin_t print diff --git a/cpukit/rtems/src/ratemonresetall.c b/cpukit/rtems/src/ratemonresetall.c index 5a6fbd1b2b..b2ed414149 100644 --- a/cpukit/rtems/src/ratemonresetall.c +++ b/cpukit/rtems/src/ratemonresetall.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Reset Statistics for All Periods +/** + * @file * + * @brief rtems_rate_monotonic_reset_all_statistics + * @ingroup ClassicRateMon Rate Monotonic Scheduler + */ + +/* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/ratemonresetstatistics.c b/cpukit/rtems/src/ratemonresetstatistics.c index 7a38fee380..a9d3934742 100644 --- a/cpukit/rtems/src/ratemonresetstatistics.c +++ b/cpukit/rtems/src/ratemonresetstatistics.c @@ -1,6 +1,11 @@ -/* - * Rate Monotonic Manager -- Reset Statistics +/** + * @file * + * @brief RTEMS Rate Monotonic Reset Statistics + * @ingroup ClassicRateMon Rate Monotonic Scheduler + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/region.c b/cpukit/rtems/src/region.c index 2fdc3ca222..309b3c6c00 100644 --- a/cpukit/rtems/src/region.c +++ b/cpukit/rtems/src/region.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief _Region_Manager_initialization + * @ingroup ClassicRegion Regions + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/regioncreate.c b/cpukit/rtems/src/regioncreate.c index f97c85a65f..753835536a 100644 --- a/cpukit/rtems/src/regioncreate.c +++ b/cpukit/rtems/src/regioncreate.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief rtems_region_create + * @ingroup ClassicRegion Regions + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/regiondata.c b/cpukit/rtems/src/regiondata.c index 4f5c3da816..97fdc112f1 100644 --- a/cpukit/rtems/src/regiondata.c +++ b/cpukit/rtems/src/regiondata.c @@ -1,6 +1,11 @@ -/* - * Region Manager -- Instantiate Data +/** + * @file * + * @brief Instantiate RTEMS Region Data + * @ingroup ClassicRegion Regions + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/regiondelete.c b/cpukit/rtems/src/regiondelete.c index d691bedd5e..8ad5085553 100644 --- a/cpukit/rtems/src/regiondelete.c +++ b/cpukit/rtems/src/regiondelete.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Delete Region + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -24,21 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_delete - * - * This directive allows a thread to delete a region specified by - * the region identifier, provided that none of its segments are - * still allocated. - * - * Input parameters: - * id - region id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_delete( rtems_id id ) diff --git a/cpukit/rtems/src/regionextend.c b/cpukit/rtems/src/regionextend.c index 205534b246..d5e3cd645e 100644 --- a/cpukit/rtems/src/regionextend.c +++ b/cpukit/rtems/src/regionextend.c @@ -1,6 +1,11 @@ -/* - * Region Manager - Extend (add memory to) a Region +/** + * @file * + * @brief RTEMS Extend Region + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -23,22 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_extend - * - * This directive attempts to grow a region of physical contiguous memory area - * from which variable sized segments can be allocated. - * - * Input parameters: - * id - id of region to grow - * start - starting address of memory area for extension - * length - physical length in bytes to grow the region - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_extend( rtems_id id, void *starting_address, diff --git a/cpukit/rtems/src/regiongetfreeinfo.c b/cpukit/rtems/src/regiongetfreeinfo.c index 52b7135f75..bd16b0ed4b 100644 --- a/cpukit/rtems/src/regiongetfreeinfo.c +++ b/cpukit/rtems/src/regiongetfreeinfo.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Get Region Free Information + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -24,23 +28,6 @@ #include <rtems/score/apimutex.h> #include <rtems/score/thread.h> -/* - * rtems_region_get_free_information - * - * This directive will return information about the free blocks - * in the region specified. Information about the used blocks - * will be returned as zero. - * - * Input parameters: - * id - region id - * the_info - pointer to region information block - * - * Output parameters: - * *the_info - region information block filled in - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_get_free_information( rtems_id id, Heap_Information_block *the_info diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c index 81d363a065..1f38e5cbce 100644 --- a/cpukit/rtems/src/regiongetsegment.c +++ b/cpukit/rtems/src/regiongetsegment.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Get Region Segment + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -24,24 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_get_segment - * - * This directive will obtain a segment from the given region. - * - * Input parameters: - * id - region id - * size - segment size in bytes - * option_set - wait option - * timeout - number of ticks to wait (0 means wait forever) - * segment - pointer to segment address - * - * Output parameters: - * segment - pointer to segment address filled in - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_get_segment( rtems_id id, uintptr_t size, diff --git a/cpukit/rtems/src/regiongetsegmentsize.c b/cpukit/rtems/src/regiongetsegmentsize.c index 8333d160dd..94a66866f1 100644 --- a/cpukit/rtems/src/regiongetsegmentsize.c +++ b/cpukit/rtems/src/regiongetsegmentsize.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Get Region Segment Size + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,22 +27,6 @@ #include <rtems/score/states.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_get_segment_size - * - * This directive will return the size of the segment indicated - * - * Input parameters: - * id - region id - * segment - segment address - * size - pointer to segment size in bytes - * - * Output parameters: - * size - segment size in bytes filled in - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_get_segment_size( rtems_id id, void *segment, diff --git a/cpukit/rtems/src/regionident.c b/cpukit/rtems/src/regionident.c index 6e1809230c..ca15664ed6 100644 --- a/cpukit/rtems/src/regionident.c +++ b/cpukit/rtems/src/regionident.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Region Name to Id + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -24,22 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_ident - * - * This directive returns the system ID associated with - * the region name. - * - * Input parameters: - * name - user defined region name - * id - pointer to region id - * - * Output parameters: - * *id - region id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_ident( rtems_name name, rtems_id *id diff --git a/cpukit/rtems/src/regionmp.c b/cpukit/rtems/src/regionmp.c index 7d8efcb07d..9d2e5fb3a6 100644 --- a/cpukit/rtems/src/regionmp.c +++ b/cpukit/rtems/src/regionmp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Support for the Region Manager - * +/** + * @file * + * @brief Region MP Support + * @ingroup ClassicRegionMP + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -29,11 +33,6 @@ RTEMS_STATIC_ASSERT( Region_MP_Packet ); -/* - * _Region_MP_Send_process_packet - * - */ - void _Region_MP_Send_process_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, @@ -75,11 +74,6 @@ void _Region_MP_Send_process_packet ( } } -/* - * _Region_MP_Send_request_packet - * - */ - rtems_status_code _Region_MP_Send_request_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, @@ -131,11 +125,6 @@ rtems_status_code _Region_MP_Send_request_packet ( return RTEMS_INTERNAL_ERROR; } -/* - * _Region_MP_Send_response_packet - * - */ - void _Region_MP_Send_response_packet ( Region_MP_Remote_operations operation, Objects_Id region_id, @@ -174,12 +163,6 @@ void _Region_MP_Send_response_packet ( } } -/* - * - * _Region_MP_Process_packet - * - */ - void _Region_MP_Process_packet ( rtems_packet_prefix *the_packet_prefix ) @@ -279,11 +262,6 @@ void _Region_MP_Process_packet ( * */ -/* - * _Region_MP_Send_extract_proxy - * - */ - void _Region_MP_Send_extract_proxy ( void *argument ) @@ -298,11 +276,6 @@ void _Region_MP_Send_extract_proxy ( ); } -/* - * _Region_MP_Get_packet - * - */ - Region_MP_Packet *_Region_MP_Get_packet ( void ) { return ( (Region_MP_Packet *) _MPCI_Get_packet() ); diff --git a/cpukit/rtems/src/regionreturnsegment.c b/cpukit/rtems/src/regionreturnsegment.c index 37e4e6f85c..56783a7411 100644 --- a/cpukit/rtems/src/regionreturnsegment.c +++ b/cpukit/rtems/src/regionreturnsegment.c @@ -1,7 +1,11 @@ -/* - * Region Manager - * +/** + * @file * + * @brief RTEMS Return Region Segment + * @ingroup ClassicRegion + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -32,20 +36,6 @@ #include <rtems/score/thread.h> #include <rtems/score/apimutex.h> -/* - * rtems_region_return_segment - * - * This directive will return a segment to its region. - * - * Input parameters: - * id - region id - * segment - pointer to segment address - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_region_return_segment( rtems_id id, void *segment diff --git a/cpukit/rtems/src/rtclock.c b/cpukit/rtems/src/rtclock.c index 515788c808..fb4cb35b51 100644 --- a/cpukit/rtems/src/rtclock.c +++ b/cpukit/rtems/src/rtclock.c @@ -1,6 +1,11 @@ -/* - * Clock Manager +/** + * @file * + * @brief No Initialization Routine + * @ingroup ClassicClock + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsbuildid.c b/cpukit/rtems/src/rtemsbuildid.c index b72e145c73..7c2c48d5fe 100644 --- a/cpukit/rtems/src/rtemsbuildid.c +++ b/cpukit/rtems/src/rtemsbuildid.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Build an Object Id +/** + * @file * + * @brief Build Object Id + * @ingroup ClassicClassInfo Object Class Information + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsbuildname.c b/cpukit/rtems/src/rtemsbuildname.c index a37db76a78..472a71bdcc 100644 --- a/cpukit/rtems/src/rtemsbuildname.c +++ b/cpukit/rtems/src/rtemsbuildname.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Build an Object Name +/** + * @file * + * @brief Build Thirty-Two Bit Object Name + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectapimaximumclass.c b/cpukit/rtems/src/rtemsobjectapimaximumclass.c index 17ad518e42..abeee0365c 100644 --- a/cpukit/rtems/src/rtemsobjectapimaximumclass.c +++ b/cpukit/rtems/src/rtemsobjectapimaximumclass.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Get Greatest Valid Class for an API +/** + * @file * + * @brief Get Highest Valid Class Value + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectapiminimumclass.c b/cpukit/rtems/src/rtemsobjectapiminimumclass.c index 8b0e78ae7a..858bc37ddb 100644 --- a/cpukit/rtems/src/rtemsobjectapiminimumclass.c +++ b/cpukit/rtems/src/rtemsobjectapiminimumclass.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Get Least Valid Class for an API +/** + * @file * + * @brief Get Lowest Valid Class Value + * @ingroup ClassicClassInfo Object Class Information + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectgetapiclassname.c b/cpukit/rtems/src/rtemsobjectgetapiclassname.c index 2550006ee8..93495829f8 100644 --- a/cpukit/rtems/src/rtemsobjectgetapiclassname.c +++ b/cpukit/rtems/src/rtemsobjectgetapiclassname.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Obtain Name of API +/** + * @file * + * @brief Get Class Name + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectgetapiname.c b/cpukit/rtems/src/rtemsobjectgetapiname.c index 4976a92135..2f10ce74d6 100644 --- a/cpukit/rtems/src/rtemsobjectgetapiname.c +++ b/cpukit/rtems/src/rtemsobjectgetapiname.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Obtain Name of API +/** + * @file * + * @brief Get API Name + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectgetclassicname.c b/cpukit/rtems/src/rtemsobjectgetclassicname.c index e34261cc95..559b2e7694 100644 --- a/cpukit/rtems/src/rtemsobjectgetclassicname.c +++ b/cpukit/rtems/src/rtemsobjectgetclassicname.c @@ -1,7 +1,11 @@ -/* - * RTEMS ID To Name Lookup - * +/** + * @file * + * @brief Obtain Name of Object + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -20,21 +24,6 @@ #include <rtems/rtems/types.h> #include <rtems/rtems/object.h> -/* - * rtems_object_get_classic_name - * - * This directive returns the name associated with the specified - * object ID. - * - * Input parameters: - * id - message queue id - * - * Output parameters: - * *name - user defined object name - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_object_get_classic_name( rtems_id id, rtems_name *name diff --git a/cpukit/rtems/src/rtemsobjectgetclassinfo.c b/cpukit/rtems/src/rtemsobjectgetclassinfo.c index aceab69a43..c801c66669 100644 --- a/cpukit/rtems/src/rtemsobjectgetclassinfo.c +++ b/cpukit/rtems/src/rtemsobjectgetclassinfo.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Get Information on Class +/** + * @file * + * @brief Get Class Information + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectidapimaximum.c b/cpukit/rtems/src/rtemsobjectidapimaximum.c index 69cb9d899c..1073cb0c13 100644 --- a/cpukit/rtems/src/rtemsobjectidapimaximum.c +++ b/cpukit/rtems/src/rtemsobjectidapimaximum.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Get Greatest Valid API Number +/** + * @file * + * @brief Get Highest Valid API Index + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectidapiminimum.c b/cpukit/rtems/src/rtemsobjectidapiminimum.c index 0c85a14fb2..c6eb871d47 100644 --- a/cpukit/rtems/src/rtemsobjectidapiminimum.c +++ b/cpukit/rtems/src/rtemsobjectidapiminimum.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Get Least Valid API Number +/** + * @file * + * @brief Get Lowest Valid API Index + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectidgetapi.c b/cpukit/rtems/src/rtemsobjectidgetapi.c index 88bf30b8fb..bce0eaadf6 100644 --- a/cpukit/rtems/src/rtemsobjectidgetapi.c +++ b/cpukit/rtems/src/rtemsobjectidgetapi.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Extract API From Id +/** + * @file * + * @brief Get API Portion of Object Id + * @ingroup ClassicClassInfo Object Class Information + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectidgetclass.c b/cpukit/rtems/src/rtemsobjectidgetclass.c index 2a1a47f948..a9b7df76a7 100644 --- a/cpukit/rtems/src/rtemsobjectidgetclass.c +++ b/cpukit/rtems/src/rtemsobjectidgetclass.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Extract Class From Id +/** + * @file * + * @brief Get Class Portion of Object Id + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectidgetnode.c b/cpukit/rtems/src/rtemsobjectidgetnode.c index eb97a37dd7..15f8cd8a3c 100644 --- a/cpukit/rtems/src/rtemsobjectidgetnode.c +++ b/cpukit/rtems/src/rtemsobjectidgetnode.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Extract Node From Id +/** + * @file * + * @brief Get Node Portion of Object Id + * @ingroup ClassicClassInfo + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemsobjectsetname.c b/cpukit/rtems/src/rtemsobjectsetname.c index e67d77f3b4..2f61231031 100644 --- a/cpukit/rtems/src/rtemsobjectsetname.c +++ b/cpukit/rtems/src/rtemsobjectsetname.c @@ -1,6 +1,11 @@ -/* - * RTEMS Object Helper -- Set Name of Object as String +/** + * @file * + * @brief Set Name of Object + * @ingroup ClassicClassInfo Object Class Information + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/rtemstimer.c b/cpukit/rtems/src/rtemstimer.c index 6a8a3e0246..6bf33c1fb3 100644 --- a/cpukit/rtems/src/rtemstimer.c +++ b/cpukit/rtems/src/rtemstimer.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - * +/** + * @file * + * @brief Timer Manager Initialization + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -24,16 +28,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * _Timer_Manager_initialization - * - * This routine initializes all timer manager related data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Timer_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/rtemstimerdata.c b/cpukit/rtems/src/rtemstimerdata.c index 6a735619dd..b3ed7e97bb 100644 --- a/cpukit/rtems/src/rtemstimerdata.c +++ b/cpukit/rtems/src/rtemstimerdata.c @@ -1,6 +1,11 @@ -/* - * Timer Manager -- Instantiate Data +/** + * @file * + * @brief Instantiate RTEMS Timer Data + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -13,7 +18,6 @@ #include "config.h" #endif -/* instantiate RTEMS timer data */ #define RTEMS_TIMER_EXTERN #include <rtems/system.h> diff --git a/cpukit/rtems/src/sem.c b/cpukit/rtems/src/sem.c index 76c753e114..4e22dacb36 100644 --- a/cpukit/rtems/src/sem.c +++ b/cpukit/rtems/src/sem.c @@ -1,20 +1,11 @@ -/* - * Semaphore Manager - * - * DESCRIPTION: - * - * This package is the implementation of the Semaphore Manager. - * This manager utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * Directives provided are: - * - * + create a semaphore - * + get an ID of a semaphore - * + delete a semaphore - * + acquire a semaphore - * + release a semaphore +/** + * @file * + * @brief Semaphore Manager Initialization + * @ingroup ClassicSem + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -48,16 +39,6 @@ #include <rtems/score/interr.h> -/* - * _Semaphore_Manager_initialization - * - * This routine initializes all semaphore manager related data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Semaphore_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c index a25789064e..e7f7b77c50 100644 --- a/cpukit/rtems/src/semcreate.c +++ b/cpukit/rtems/src/semcreate.c @@ -1,20 +1,11 @@ -/* - * Semaphore Manager - * - * DESCRIPTION: - * - * This package is the implementation of the Semaphore Manager. - * This manager utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * Directives provided are: - * - * + create a semaphore - * + get an ID of a semaphore - * + delete a semaphore - * + acquire a semaphore - * + release a semaphore +/** + * @file * + * @brief rtems_semaphore_create + * @ingroup ClassicSem Semaphores + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/semdata.c b/cpukit/rtems/src/semdata.c index accab0ef44..d19f0cc876 100644 --- a/cpukit/rtems/src/semdata.c +++ b/cpukit/rtems/src/semdata.c @@ -1,6 +1,11 @@ -/* - * Semaphore Manager -- Data Instantiation +/** + * @file * + * @brief Instantiate Semaphore Data + * @ingroup ClassicSem Semaphores + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/semdelete.c b/cpukit/rtems/src/semdelete.c index 54625fac37..57e00db0e5 100644 --- a/cpukit/rtems/src/semdelete.c +++ b/cpukit/rtems/src/semdelete.c @@ -1,20 +1,11 @@ -/* - * Semaphore Manager - * - * DESCRIPTION: - * - * This package is the implementation of the Semaphore Manager. - * This manager utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * Directives provided are: - * - * + create a semaphore - * + get an ID of a semaphore - * + delete a semaphore - * + acquire a semaphore - * + release a semaphore +/** + * @file * + * @brief RTEMS Delete Semaphore + * @ingroup ClassicSem + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -47,21 +38,6 @@ #include <rtems/score/interr.h> -/* - * rtems_semaphore_delete - * - * This directive allows a thread to delete a semaphore specified by - * the semaphore id. The semaphore is freed back to the inactive - * semaphore chain. - * - * Input parameters: - * id - semaphore id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - #if defined(RTEMS_MULTIPROCESSING) #define SEMAPHORE_MP_OBJECT_WAS_DELETED _Semaphore_MP_Send_object_was_deleted #else diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c index 2faaff0cc6..fe5710eefe 100644 --- a/cpukit/rtems/src/semobtain.c +++ b/cpukit/rtems/src/semobtain.c @@ -1,20 +1,11 @@ -/* - * Semaphore Manager - * - * DESCRIPTION: - * - * This package is the implementation of the Semaphore Manager. - * This manager utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * Directives provided are: - * - * + create a semaphore - * + get an ID of a semaphore - * + delete a semaphore - * + acquire a semaphore - * + release a semaphore +/** + * @file * + * @brief RTEMS Obtain Semaphore + * @ingroup ClassicSem + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -47,21 +38,6 @@ #include <rtems/score/interr.h> -/* - * rtems_semaphore_obtain - * - * This directive allows a thread to acquire a semaphore. - * - * Input parameters: - * id - semaphore id - * option_set - wait option - * timeout - number of ticks to wait (0 means wait forever) - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_semaphore_obtain( rtems_id id, rtems_option option_set, diff --git a/cpukit/rtems/src/semrelease.c b/cpukit/rtems/src/semrelease.c index dea8f0bd77..66009667b7 100644 --- a/cpukit/rtems/src/semrelease.c +++ b/cpukit/rtems/src/semrelease.c @@ -1,5 +1,8 @@ -/* - * Semaphore Manager +/** + * @file + * + * @brief RTEMS Semaphore Release + * @ingroup ClassicSem Semaphores * * DESCRIPTION: * @@ -15,6 +18,9 @@ * + acquire a semaphore * + release a semaphore * + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c index 2231df8d1b..a06a84871d 100644 --- a/cpukit/rtems/src/semtranslatereturncode.c +++ b/cpukit/rtems/src/semtranslatereturncode.c @@ -1,20 +1,11 @@ -/* - * Semaphore Manager - * - * DESCRIPTION: - * - * This package is the implementation of the Semaphore Manager. - * This manager utilizes standard Dijkstra counting semaphores to provide - * synchronization and mutual exclusion capabilities. - * - * Directives provided are: - * - * + create a semaphore - * + get an ID of a semaphore - * + delete a semaphore - * + acquire a semaphore - * + release a semaphore +/** + * @file * + * @brief Semaphore Translate Core Mutex and Semaphore Return Code + * @ingroup ClassicSem + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -47,17 +38,6 @@ #include <rtems/score/interr.h> -/* - * _Semaphore_Translate_core_mutex_return_code - * - * Input parameters: - * status - mutex status code to translate - * - * Output parameters: - * rtems status code - translated RTEMS status code - * - */ - const rtems_status_code _Semaphore_Translate_core_mutex_return_code_[] = { RTEMS_SUCCESSFUL, /* CORE_MUTEX_STATUS_SUCCESSFUL */ RTEMS_UNSATISFIED, /* CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT */ @@ -95,17 +75,6 @@ rtems_status_code _Semaphore_Translate_core_mutex_return_code ( return _Semaphore_Translate_core_mutex_return_code_[status]; } -/* - * _Semaphore_Translate_core_semaphore_return_code - * - * Input parameters: - * status - semaphore status code to translate - * - * Output parameters: - * rtems status code - translated RTEMS status code - * - */ - const rtems_status_code _Semaphore_Translate_core_semaphore_return_code_[] = { RTEMS_SUCCESSFUL, /* CORE_SEMAPHORE_STATUS_SUCCESSFUL */ RTEMS_UNSATISFIED, /* CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT */ diff --git a/cpukit/rtems/src/signal.c b/cpukit/rtems/src/signal.c index 9528490db1..13e04d3fdf 100644 --- a/cpukit/rtems/src/signal.c +++ b/cpukit/rtems/src/signal.c @@ -1,7 +1,11 @@ -/* - * Signal Manager - * +/** + * @file * + * @brief Signal Manager Initialization + * @ingroup ClassicSignal Signals + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c index 4170b614e9..1b342e7193 100644 --- a/cpukit/rtems/src/signalcatch.c +++ b/cpukit/rtems/src/signalcatch.c @@ -1,7 +1,11 @@ -/* - * Signal Manager - * +/** + * @file * + * @brief RTEMS Catch Signal + * @ingroup ClassicSignal + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -21,22 +25,49 @@ #include <rtems/rtems/modes.h> #include <rtems/rtems/signal.h> #include <rtems/score/thread.h> +#include <rtems/score/apiext.h> #include <rtems/rtems/tasks.h> -/* - * rtems_signal_catch - * - * This directive allows a thread to specify what action to take when - * catching signals. - * - * Input parameters: - * handler - address of asynchronous signal routine (asr) - * ( NULL indicates asr is invalid ) - * mode_set - mode value for asr - * - * Output parameters: - * RTEMS_SUCCESSFUL - always succeeds - */ +static void _RTEMS_signal_Post_switch_hook( Thread_Control *executing ) +{ + ISR_Level level; + RTEMS_API_Control *api; + ASR_Information *asr; + rtems_signal_set signal_set; + Modes_Control prev_mode; + + api = executing->API_Extensions[ THREAD_API_RTEMS ]; + if ( !api ) + return; + + /* + * Signal Processing + */ + + asr = &api->Signal; + + _ISR_Disable( level ); + signal_set = asr->signals_posted; + asr->signals_posted = 0; + _ISR_Enable( level ); + + + if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */ + return; + + asr->nest_level += 1; + rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); + + (*asr->handler)( signal_set ); + + asr->nest_level -= 1; + rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); + +} + +static API_extensions_Post_switch_control _RTEMS_signal_Post_switch = { + .hook = _RTEMS_signal_Post_switch_hook +}; rtems_status_code rtems_signal_catch( rtems_asr_entry asr_handler, @@ -55,6 +86,8 @@ rtems_status_code rtems_signal_catch( _Thread_Disable_dispatch(); /* cannot reschedule while */ /* the thread is inconsistent */ + _API_extensions_Add_post_switch( &_RTEMS_signal_Post_switch ); + if ( !_ASR_Is_null_handler( asr_handler ) ) { asr->mode_set = mode_set; asr->handler = asr_handler; diff --git a/cpukit/rtems/src/signalmp.c b/cpukit/rtems/src/signalmp.c index b07f160f98..f70a452208 100644 --- a/cpukit/rtems/src/signalmp.c +++ b/cpukit/rtems/src/signalmp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Support for the Signal Manager - * +/** + * @file * + * @brief Signal MP Support + * @ingroup ClassicSignalMP + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -39,11 +43,6 @@ RTEMS_STATIC_ASSERT( * */ -/* - * _Signal_MP_Send_request_packet - * - */ - rtems_status_code _Signal_MP_Send_request_packet ( Signal_MP_Remote_operations operation, Objects_Id task_id, @@ -82,11 +81,6 @@ rtems_status_code _Signal_MP_Send_request_packet ( return RTEMS_INTERNAL_ERROR; } -/* - * _Signal_MP_Send_response_packet - * - */ - void _Signal_MP_Send_response_packet ( Signal_MP_Remote_operations operation, Thread_Control *the_thread @@ -119,12 +113,6 @@ void _Signal_MP_Send_response_packet ( } } -/* - * - * _Signal_MP_Process_packet - * - */ - void _Signal_MP_Process_packet ( rtems_packet_prefix *the_packet_prefix ) @@ -175,11 +163,6 @@ void _Signal_MP_Process_packet ( * */ -/* - * _Signal_MP_Get_packet - * - */ - Signal_MP_Packet *_Signal_MP_Get_packet ( void ) { return ( (Signal_MP_Packet *) _MPCI_Get_packet() ); diff --git a/cpukit/rtems/src/status.c b/cpukit/rtems/src/status.c index 27d60b5ce7..f89a5e700a 100644 --- a/cpukit/rtems/src/status.c +++ b/cpukit/rtems/src/status.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Status Object Name Errors to Status Array + * @ingroup ClassicStatus + */ + /* COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -8,11 +15,6 @@ #include <rtems/rtems/status.h> -/** - * This array is used to map SuperCore Object Handler return - * codes to Classic API status codes. - */ - const rtems_status_code _Status_Object_name_errors_to_status[] = { /** This maps OBJECTS_SUCCESSFUL to RTEMS_SUCCESSFUL. */ RTEMS_SUCCESSFUL, diff --git a/cpukit/rtems/src/taskdata.c b/cpukit/rtems/src/taskdata.c index 46e44747be..2e9666cbb8 100644 --- a/cpukit/rtems/src/taskdata.c +++ b/cpukit/rtems/src/taskdata.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Instantiate RTEMS Classic API Tasks Data + * @ingroup ClassicTasks + */ + /* * RTEMS Task Manager -- Instantiate Data * @@ -13,7 +20,6 @@ #include "config.h" #endif -/* instantiate RTEMS Classic API tasks data */ #define RTEMS_TASKS_EXTERN #include <rtems/system.h> diff --git a/cpukit/rtems/src/taskdelete.c b/cpukit/rtems/src/taskdelete.c index 52045698f8..2f78301ae3 100644 --- a/cpukit/rtems/src/taskdelete.c +++ b/cpukit/rtems/src/taskdelete.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Delete Task + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -30,23 +34,6 @@ #include <rtems/score/sysstate.h> #include <rtems/score/apimutex.h> -/* - * rtems_task_delete - * - * This directive allows a thread to delete itself or the thread - * identified in the id field. The executive halts execution - * of the thread and frees the thread control block. - * - * Input parameters: - * id - thread id - * - * Output parameters: - * nothing - if id is the requesting thread (always succeeds) - * RTEMS_SUCCESSFUL - if successful and id is - * not the requesting thread - * error code - if unsuccessful - */ - rtems_status_code rtems_task_delete( rtems_id id ) diff --git a/cpukit/rtems/src/taskgetnote.c b/cpukit/rtems/src/taskgetnote.c index 3696f9117d..65b2aa21f9 100644 --- a/cpukit/rtems/src/taskgetnote.c +++ b/cpukit/rtems/src/taskgetnote.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Get Task Node + * @ingroup ClassicRTEMS + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -30,23 +34,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_get_note - * - * This directive obtains the note from the specified notepad - * of the specified thread. - * - * Input parameters: - * id - thread id - * notepad - notepad number - * note - pointer to note - * - * Output parameters: - * note - filled in if successful - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_get_note( rtems_id id, uint32_t notepad, diff --git a/cpukit/rtems/src/taskident.c b/cpukit/rtems/src/taskident.c index 570aa3594a..2c3090909a 100644 --- a/cpukit/rtems/src/taskident.c +++ b/cpukit/rtems/src/taskident.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Task Name to Id + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -29,23 +33,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_ident - * - * This directive returns the system ID associated with - * the thread name. - * - * Input parameters: - * name - user defined thread name - * node - node(s) to be searched - * id - pointer to thread id - * - * Output parameters: - * *id - thread id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_ident( rtems_name name, uint32_t node, diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c index 2f4f0f9345..30cc81ae05 100644 --- a/cpukit/rtems/src/taskinitusers.c +++ b/cpukit/rtems/src/taskinitusers.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief _RTEMS_tasks_Initialize_user_tasks_body + * @ingroup ClassicTasks Tasks + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/taskissuspended.c b/cpukit/rtems/src/taskissuspended.c index 179c41e366..6a62dd5b2a 100644 --- a/cpukit/rtems/src/taskissuspended.c +++ b/cpukit/rtems/src/taskissuspended.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief rtems_task_is_suspended + * @ingroup ClassicTasks Tasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/taskmode.c b/cpukit/rtems/src/taskmode.c index 9fab2265e0..63fe29c3dc 100644 --- a/cpukit/rtems/src/taskmode.c +++ b/cpukit/rtems/src/taskmode.c @@ -1,6 +1,11 @@ -/* - * RTEMS Task Manager - Change Task Mode +/** + * @file * + * @brief RTEMS Task Mode + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * @@ -28,22 +33,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_mode - * - * This directive enables and disables several modes of - * execution for the requesting thread. - * - * Input parameters: - * mode_set - new mode - * mask - mask - * previous_mode_set - address of previous mode set - * - * Output: - * *previous_mode_set - previous mode set - * always return RTEMS_SUCCESSFUL; - */ - rtems_status_code rtems_task_mode( rtems_mode mode_set, rtems_mode mask, diff --git a/cpukit/rtems/src/taskmp.c b/cpukit/rtems/src/taskmp.c index ead2513401..c48d9c78c5 100644 --- a/cpukit/rtems/src/taskmp.c +++ b/cpukit/rtems/src/taskmp.c @@ -1,7 +1,11 @@ -/* - * Multiprocessing Support for the RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Tasks MP Send Process Packet + * @ingroup ClassicTaskMP Task MP Support + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/taskrestart.c b/cpukit/rtems/src/taskrestart.c index 3a560a9eb5..75fcbb342e 100644 --- a/cpukit/rtems/src/taskrestart.c +++ b/cpukit/rtems/src/taskrestart.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Task Restart + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -29,23 +33,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_restart - * - * This directive readies the specified thread. It restores - * the thread environment to the original values established - * at thread creation and start time. A thread can be restarted - * from any state except the dormant state. - * - * Input parameters: - * id - thread id - * argument - thread argument - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_restart( rtems_id id, uint32_t argument diff --git a/cpukit/rtems/src/taskresume.c b/cpukit/rtems/src/taskresume.c index e53b5426ac..a3a8f73571 100644 --- a/cpukit/rtems/src/taskresume.c +++ b/cpukit/rtems/src/taskresume.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Resume Task + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -29,20 +33,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_resume - * - * This directive will remove the specified thread - * from the suspended state. - * - * Input parameters: - * id - thread id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_resume( rtems_id id ) diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index 2385cb2d22..99bcef93c6 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/rtems/src/tasks.c @@ -167,58 +167,11 @@ static void _RTEMS_tasks_Switch_extension( } } -/* - * _RTEMS_tasks_Post_switch_extension - * - * This extension routine is invoked at each context switch. - */ - -static void _RTEMS_tasks_Post_switch_extension( - Thread_Control *executing -) -{ - ISR_Level level; - RTEMS_API_Control *api; - ASR_Information *asr; - rtems_signal_set signal_set; - Modes_Control prev_mode; - - api = executing->API_Extensions[ THREAD_API_RTEMS ]; - if ( !api ) - return; - - /* - * Signal Processing - */ - - asr = &api->Signal; - - _ISR_Disable( level ); - signal_set = asr->signals_posted; - asr->signals_posted = 0; - _ISR_Enable( level ); - - - if ( !signal_set ) /* similar to _ASR_Are_signals_pending( asr ) */ - return; - - asr->nest_level += 1; - rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode ); - - (*asr->handler)( signal_set ); - - asr->nest_level -= 1; - rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode ); - -} - API_extensions_Control _RTEMS_tasks_API_extensions = { - { NULL, NULL }, #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) - NULL, /* predriver */ + .predriver_hook = NULL, #endif - _RTEMS_tasks_Initialize_user_tasks, /* postdriver */ - _RTEMS_tasks_Post_switch_extension /* post switch */ + .postdriver_hook = _RTEMS_tasks_Initialize_user_tasks }; User_extensions_Control _RTEMS_tasks_User_extensions = { diff --git a/cpukit/rtems/src/taskself.c b/cpukit/rtems/src/taskself.c index 14fc4ca66b..c13e14c4f9 100644 --- a/cpukit/rtems/src/taskself.c +++ b/cpukit/rtems/src/taskself.c @@ -1,6 +1,11 @@ -/* - * RTEMS Task Manager - Get ID of Self +/** + * @file * + * @brief RTEMS Get Self Task Id + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/tasksetnote.c b/cpukit/rtems/src/tasksetnote.c index 453a2a2f72..b08198db4b 100644 --- a/cpukit/rtems/src/tasksetnote.c +++ b/cpukit/rtems/src/tasksetnote.c @@ -1,6 +1,11 @@ -/* - * RTEMS Task Manager +/** + * @file * + * @brief RTEMS Set Task Note + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -29,22 +34,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_set_note - * - * This directive sets the specified notepad contents to the given - * note. - * - * Input parameters: - * id - thread id - * notepad - notepad number - * note - note value - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_set_note( rtems_id id, uint32_t notepad, diff --git a/cpukit/rtems/src/taskstart.c b/cpukit/rtems/src/taskstart.c index c6f1078902..4a168bf742 100644 --- a/cpukit/rtems/src/taskstart.c +++ b/cpukit/rtems/src/taskstart.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Start Task + * @ingroup ClassicTasks Tasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/tasksuspend.c b/cpukit/rtems/src/tasksuspend.c index e1e82ddd30..8128100c78 100644 --- a/cpukit/rtems/src/tasksuspend.c +++ b/cpukit/rtems/src/tasksuspend.c @@ -1,7 +1,11 @@ -/* - * RTEMS Task Manager - * +/** + * @file * + * @brief RTEMS Suspend Task + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -29,21 +33,6 @@ #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> -/* - * rtems_task_suspend - * - * This directive will place the specified thread in the "suspended" - * state. Note that the suspended state can be in addition to - * other waiting states. - * - * Input parameters: - * id - thread id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_task_suspend( rtems_id id ) diff --git a/cpukit/rtems/src/taskvariable_invoke_dtor.c b/cpukit/rtems/src/taskvariable_invoke_dtor.c index 9f797c45dc..76fc2687d7 100644 --- a/cpukit/rtems/src/taskvariable_invoke_dtor.c +++ b/cpukit/rtems/src/taskvariable_invoke_dtor.c @@ -1,7 +1,11 @@ -/* - * Invoke the destructor on a per-task variable - * +/** + * @file * + * @brief RTEMS Tasks Invoke Task Variable Destructor + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/taskvariableadd.c b/cpukit/rtems/src/taskvariableadd.c index 415fe69fa4..9a0bc3d43f 100644 --- a/cpukit/rtems/src/taskvariableadd.c +++ b/cpukit/rtems/src/taskvariableadd.c @@ -1,7 +1,11 @@ -/* - * rtems_task_variable_add - Add a per-task variable - * +/** + * @file * + * @brief RTEMS Add Task Variable + * @ingroup ClassicTasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -18,12 +22,6 @@ #include <rtems/rtems/tasks.h> #include <rtems/score/wkspace.h> -/* - * rtems_task_variable_add - * - * This directive registers a task variable. - */ - rtems_status_code rtems_task_variable_add( rtems_id tid, void **ptr, diff --git a/cpukit/rtems/src/taskvariableget.c b/cpukit/rtems/src/taskvariableget.c index 8801a24538..d2074b274b 100644 --- a/cpukit/rtems/src/taskvariableget.c +++ b/cpukit/rtems/src/taskvariableget.c @@ -1,7 +1,11 @@ -/* - * rtems_task_variable_get - Get a per-task variable - * +/** + * @file * + * @brief Get a per-task variable + * @ingroup ClassicTasks Tasks + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/timercreate.c b/cpukit/rtems/src/timercreate.c index 8d53fc4ecb..f37b9e18c0 100644 --- a/cpukit/rtems/src/timercreate.c +++ b/cpukit/rtems/src/timercreate.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_create directive - * +/** + * @file * + * @brief RTEMS Create Timer + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * @@ -23,21 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_timer_create - * - * This directive creates a timer and performs some initialization. - * - * Input parameters: - * name - timer name - * id - pointer to timer id - * - * Output parameters: - * id - timer id - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_timer_create( rtems_name name, rtems_id *id diff --git a/cpukit/rtems/src/timerdelete.c b/cpukit/rtems/src/timerdelete.c index e7a0d15492..f25928054a 100644 --- a/cpukit/rtems/src/timerdelete.c +++ b/cpukit/rtems/src/timerdelete.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_delete directive - * +/** + * @file * + * @brief RTEMS Delete Timer + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,19 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_timer_delete - * - * This directive allows a thread to delete a timer. - * - * Input parameters: - * id - timer id - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_timer_delete( rtems_id id ) diff --git a/cpukit/rtems/src/timerfireafter.c b/cpukit/rtems/src/timerfireafter.c index f823a7b35d..267c1cfd98 100644 --- a/cpukit/rtems/src/timerfireafter.c +++ b/cpukit/rtems/src/timerfireafter.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_fire_after directive - * +/** + * @file * + * @brief RTEMS Timer Fire After + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,22 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_timer_fire_after - * - * This directive allows a thread to start a timer. - * - * Input parameters: - * id - timer id - * ticks - interval until routine is fired - * routine - routine to schedule - * user_data - passed as argument to routine when it is fired - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_timer_fire_after( rtems_id id, rtems_interval ticks, diff --git a/cpukit/rtems/src/timerfirewhen.c b/cpukit/rtems/src/timerfirewhen.c index df24e2aad3..487471ffc3 100644 --- a/cpukit/rtems/src/timerfirewhen.c +++ b/cpukit/rtems/src/timerfirewhen.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_fire_when directive - * +/** + * @file * + * @brief RTEMS Timer Fire When + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,22 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_timer_fire_when - * - * This directive allows a thread to start a timer. - * - * Input parameters: - * id - timer id - * wall_time - time of day to fire timer - * routine - routine to schedule - * user_data - passed as argument to routine when it is fired - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_timer_fire_when( rtems_id id, rtems_time_of_day *wall_time, diff --git a/cpukit/rtems/src/timerreset.c b/cpukit/rtems/src/timerreset.c index e86957c9de..0e8052161f 100644 --- a/cpukit/rtems/src/timerreset.c +++ b/cpukit/rtems/src/timerreset.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_reset directive - * +/** + * @file * + * @brief RTEMS Timer Reset + * @ingroup ClassicTimer Timers + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/timerserverfireafter.c b/cpukit/rtems/src/timerserverfireafter.c index d515d5f919..ee8dc8f3da 100644 --- a/cpukit/rtems/src/timerserverfireafter.c +++ b/cpukit/rtems/src/timerserverfireafter.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_server fire_after directive - * +/** + * @file * + * @brief RTEMS Timer Server Fire After + * @ingroup ClassicTimer + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -23,23 +27,6 @@ #include <rtems/score/tod.h> #include <rtems/score/watchdog.h> -/* - * rtems_timer_server_fire_after - * - * This directive allows a thread to start a timer which will by - * executed by the Timer Server when it fires. - * - * Input parameters: - * id - timer id - * ticks - interval until routine is fired - * routine - routine to schedule - * user_data - passed as argument to routine when it is fired - * - * Output parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_timer_server_fire_after( rtems_id id, rtems_interval ticks, diff --git a/cpukit/rtems/src/timerserverfirewhen.c b/cpukit/rtems/src/timerserverfirewhen.c index 5f029a0d35..11a1e15dc8 100644 --- a/cpukit/rtems/src/timerserverfirewhen.c +++ b/cpukit/rtems/src/timerserverfirewhen.c @@ -1,7 +1,11 @@ -/* - * Timer Manager - rtems_timer_server fire_when directive - * +/** + * @file * + * @brief RTEMS Timer Server Fire When Directive + * @ingroup ClassicTimer Timers + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/rtems/src/workspace.c b/cpukit/rtems/src/workspace.c index 7af58978e4..38747be1bf 100644 --- a/cpukit/rtems/src/workspace.c +++ b/cpukit/rtems/src/workspace.c @@ -1,6 +1,11 @@ -/* - * Workspace Handler +/** + * @file * + * @brief RTEMS Workspace Support + * @ingroup ClassicRTEMSWorkspace + */ + +/* * COPYRIGHT (c) 1989-2009. * On-Line Applications Research Corporation (OAR). * @@ -32,9 +37,6 @@ bool rtems_workspace_get_information( return _Protected_heap_Get_information( &_Workspace_Area, the_info ); } -/* - * _Workspace_Allocate - */ bool rtems_workspace_allocate( size_t bytes, void **pointer @@ -62,9 +64,6 @@ bool rtems_workspace_allocate( return true; } -/* - * _Workspace_Allocate - */ bool rtems_workspace_free( void *pointer ) diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index cddfccb80b..3939cf1e34 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -1651,6 +1651,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper = #include <rtems/posix/mutex.h> #include <rtems/posix/key.h> #include <rtems/posix/psignal.h> + #include <rtems/posix/pthread.h> #include <rtems/posix/rwlock.h> #include <rtems/posix/semaphore.h> #include <rtems/posix/spinlock.h> diff --git a/cpukit/sapi/include/rtems/extension.h b/cpukit/sapi/include/rtems/extension.h index f9f1ae1381..3d54092a8c 100644 --- a/cpukit/sapi/include/rtems/extension.h +++ b/cpukit/sapi/include/rtems/extension.h @@ -38,6 +38,11 @@ typedef struct { User_extensions_Control Extension; } Extension_Control; +/** + * @brief Initialize Extension Manager + * + * This routine initializes all extension manager related data structures. + */ void _Extension_Manager_initialization(void); typedef User_extensions_routine diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h index e3a5fdfa12..8b5fab91fd 100644 --- a/cpukit/sapi/include/rtems/init.h +++ b/cpukit/sapi/include/rtems/init.h @@ -69,19 +69,25 @@ void rtems_initialize_before_drivers(void); void rtems_initialize_device_drivers(void); /** - * @brief rtems_initialize_start_multitasking + * @brief Starts the multitasking. * - * This routine implements the early portion of rtems_initialize_executive - * directive up to the pretasking hook. This directive is invoked at system - * startup to initialize the RTEMS multitasking environment. + * This directive initiates multitasking and performs a context switch to the + * first user application task and may enable interrupts as a side-effect of + * that context switch. The context switch saves the executing context. The + * application runs now. The directive rtems_shutdown_executive() will return + * to the saved context. The exit() function will use this directive. * - * @return This method returns the status code passed into the - * @ref rtems_shutdown_executive directive. + * After a return to the saved context a fatal system state is reached. The + * fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value + * passed to rtems_shutdown_executive(). + * + * This directive does not return. */ -uint32_t rtems_initialize_start_multitasking(void); +void rtems_initialize_start_multitasking(void) + RTEMS_COMPILER_NO_RETURN_ATTRIBUTE; /** - * @brief rtems_shutdown_executive + * @brief Shutdown the RTEMS environment * * This routine implements the rtems_shutdown_executive directive. The * invocation of this directive results in the RTEMS environment being diff --git a/cpukit/sapi/include/rtems/io.h b/cpukit/sapi/include/rtems/io.h index 5477860b5a..f4e7d49edc 100644 --- a/cpukit/sapi/include/rtems/io.h +++ b/cpukit/sapi/include/rtems/io.h @@ -100,11 +100,13 @@ rtems_status_code rtems_io_register_driver( ); /** - * @brief Unregisters the device driver with number @a major. + * @brief Unregister a Driver from the Device Driver Table. * - * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered. - * @retval RTEMS_UNSATISFIED Invalid major number. - * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. + * @param[in] major is the device major number. + * + * @retval RTEMS_SUCCESSFUL Device driver successfully unregistered. + * @retval RTEMS_UNSATISFIED Invalid major number. + * @retval RTEMS_CALLED_FROM_ISR Called from interrupt context. */ rtems_status_code rtems_io_unregister_driver( rtems_device_major_number major @@ -126,41 +128,101 @@ rtems_status_code rtems_io_register_name( /** @} */ /** - * @name Device Driver Invocation + * @brief IO Driver Initialization * - * @{ + * This routine is the initialization directive of the IO manager. + * + * @param[in] major is the device drive number + * @param[in] minor is the device number + * @param[in] argument is the pointer to the argument(s) + * + * @return status code */ - rtems_status_code rtems_io_initialize( rtems_device_major_number major, rtems_device_minor_number minor, void *argument ); +/** + * @brief Opening for The IO Manager + * + * Opens a device driver with the number @a major. + * + * @param[in] major is the device driver number. + * @param[in] minor is the device number. + * @param[in] argument is the pointer to the argument(s). + * + * @return Status code. + */ rtems_status_code rtems_io_open( rtems_device_major_number major, rtems_device_minor_number minor, void *argument ); +/** + * @brief Closing for The IO Manager + * + * This routine is the close directive of the IO manager. + * + * @param[in] major is the device driver number. + * @param[in] minor is the device number. + * @param[in] argument is the pointer to the argument(s). + * + * @return Status code. + */ rtems_status_code rtems_io_close( rtems_device_major_number major, rtems_device_minor_number minor, void *argument ); +/** + * @brief Reading for The IO Manager + * + * This routine is the read directive of the IO manager. + * + * @param[in] major is the device driver number. + * @param[in] minor is the device number. + * @param[in] argument is the pointer to the argument(s). + * + * @return Status code. + */ rtems_status_code rtems_io_read( rtems_device_major_number major, rtems_device_minor_number minor, void *argument ); +/** + * @brief Writing for The IO Manager + * + * This routine is the write directive of the IO manager. + * + * @param[in] major is the device driver number. + * @param[in] minor is the device number. + * @param[in] argument is the pointer to the argument(s). + * + * @return Status code. + */ rtems_status_code rtems_io_write( rtems_device_major_number major, rtems_device_minor_number minor, void *argument ); +/** + * @brief Control for The IO Manager + * + * This routine is the control directive of the IO manager. + * + * @param[in] major is the device driver number. + * @param[in] minor is the device number. + * @param[in] argument is the pointer to the argument(s). + * + * @return Status code. + */ rtems_status_code rtems_io_control( rtems_device_major_number major, rtems_device_minor_number minor, @@ -190,8 +252,20 @@ SAPI_IO_EXTERN uint32_t _IO_Number_of_drivers; SAPI_IO_EXTERN rtems_driver_address_table *_IO_Driver_address_table; +/** + * @brief Initialization of Device Drivers + * + * @note The IO manager has been extended to support runtime driver + * registration. The driver table is now allocated in the + * workspace. + */ void _IO_Manager_initialization( void ); +/** + * @brief Initialization of All Device Drivers + * + * Initializes all device drivers. + */ void _IO_Initialize_all_drivers( void ); #ifdef __cplusplus diff --git a/cpukit/sapi/src/debug.c b/cpukit/sapi/src/debug.c index f24bd3a757..f886f3aed8 100644 --- a/cpukit/sapi/src/debug.c +++ b/cpukit/sapi/src/debug.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Debug Manager + * + * @ingroup ClassicDebug + */ + /* * Debug Manager * @@ -16,18 +24,11 @@ #include <rtems/system.h> #include <rtems/debug.h> -/* - * - * _Debug_Manager_initialization - */ void _Debug_Manager_initialization( void ) { rtems_debug_disable( RTEMS_DEBUG_ALL_MASK ); } -/* - * rtems_debug_enable - */ void rtems_debug_enable ( rtems_debug_control to_be_enabled ) @@ -35,9 +36,6 @@ void rtems_debug_enable ( _Debug_Level |= to_be_enabled; } -/* - * rtems_debug_disable - */ void rtems_debug_disable ( rtems_debug_control to_be_disabled ) @@ -45,9 +43,6 @@ void rtems_debug_disable ( _Debug_Level &= ~to_be_disabled; } -/* - * rtems_debug_is_enabled - */ bool rtems_debug_is_enabled( rtems_debug_control level ) diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 2c68434899..34e80750dd 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Device Driver Initialization Functions + * + * @ingroup ClassicRTEMS + */ + /* * Initialization Manager * @@ -217,8 +225,10 @@ void rtems_initialize_device_drivers(void) _API_extensions_Run_postdriver(); } -uint32_t rtems_initialize_start_multitasking(void) +void rtems_initialize_start_multitasking(void) { + uint32_t status; + _System_state_Set( SYSTEM_STATE_BEGIN_MULTITASKING ); _Thread_Start_multitasking(); @@ -232,5 +242,6 @@ uint32_t rtems_initialize_start_multitasking(void) ******************************************************************* *******************************************************************/ - return _Per_CPU_Information[0].idle->Wait.return_code; + status = _Per_CPU_Information[0].idle->Wait.return_code; + rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, status ); } diff --git a/cpukit/sapi/src/exshutdown.c b/cpukit/sapi/src/exshutdown.c index 6e3e1c9897..2b99995825 100644 --- a/cpukit/sapi/src/exshutdown.c +++ b/cpukit/sapi/src/exshutdown.c @@ -51,11 +51,9 @@ void rtems_shutdown_executive( /******************************************************************* ******************************************************************* - ******************************************************************* ****** RETURN TO RTEMS_INITIALIZE_START_MULTITASKING() ****** ****** AND THEN TO BOOT_CARD() ****** ******************************************************************* - ******************************************************************* *******************************************************************/ } _Internal_error_Occurred( diff --git a/cpukit/sapi/src/extension.c b/cpukit/sapi/src/extension.c index 9038b2981f..29ceebcec5 100644 --- a/cpukit/sapi/src/extension.c +++ b/cpukit/sapi/src/extension.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Initialize Extension Manager + * + * @ingroup ClassicUserExtensions + */ + /* * Extension Manager * @@ -20,16 +28,6 @@ #include <rtems/score/thread.h> #include <rtems/extension.h> -/* - * _Extension_Manager_initialization - * - * This routine initializes all extension manager related data structures. - * - * Input parameters: NONE - * - * Output parameters: NONE - */ - void _Extension_Manager_initialization(void) { _Objects_Initialize_information( diff --git a/cpukit/sapi/src/extensiondata.c b/cpukit/sapi/src/extensiondata.c index 1a8c134597..b604274a87 100644 --- a/cpukit/sapi/src/extensiondata.c +++ b/cpukit/sapi/src/extensiondata.c @@ -1,6 +1,12 @@ -/* - * Extension Manager -- Instantiate Data +/** + * @file + * + * @brief Extension Data * + * @ingroup ClassicUserExtensions + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/sapi/src/fatal.c b/cpukit/sapi/src/fatal.c index 08c8a1e2c0..9dc27fabfd 100644 --- a/cpukit/sapi/src/fatal.c +++ b/cpukit/sapi/src/fatal.c @@ -1,3 +1,12 @@ +/** + * @file + * + * @brief Invokes the internal error handler with a source of + * INTERNAL_ERROR_RTEMS_API and is internal set to false. + * + * @ingroup ClassicFatal + */ + /* * Fatal Error Manager * @@ -17,17 +26,6 @@ #include <rtems/fatal.h> #include <rtems/score/interr.h> -/* - * rtems_fatal_error_occurred - * - * This directive will invoke the internal fatal error handler. - * - * Input parameters: - * the_error - fatal error status code - * - * Output parameters: NONE - */ - void rtems_fatal_error_occurred( uint32_t the_error ) diff --git a/cpukit/sapi/src/fatal2.c b/cpukit/sapi/src/fatal2.c index efaf4265ed..0c895b8132 100644 --- a/cpukit/sapi/src/fatal2.c +++ b/cpukit/sapi/src/fatal2.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Invokes the internal error handler with is internal set to false. + * + * @ingroup ClassicFatal + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/sapi/src/getversionstring.c b/cpukit/sapi/src/getversionstring.c index 2518e0f6ce..463fe81652 100644 --- a/cpukit/sapi/src/getversionstring.c +++ b/cpukit/sapi/src/getversionstring.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Get the RTEMS Version as a String + * + * @ingroup ClassicRTEMS + */ + /* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). diff --git a/cpukit/sapi/src/interrdesc.c b/cpukit/sapi/src/interrdesc.c index 5eab68313b..5301475657 100644 --- a/cpukit/sapi/src/interrdesc.c +++ b/cpukit/sapi/src/interrdesc.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Returns a description for an internal error code. + * + * @ingroup ClassicFatal + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/sapi/src/io.c b/cpukit/sapi/src/io.c index 47793c3036..e01417bfe4 100644 --- a/cpukit/sapi/src/io.c +++ b/cpukit/sapi/src/io.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Initialize Device Driver Subsystem +/** + * @file + * + * @brief Initialization of Device Drivers * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -22,15 +28,6 @@ #include <string.h> -/* - * _IO_Manager_initialization - * - * The IO manager has been extended to support runtime driver - * registration. The driver table is now allocated in the - * workspace. - * - */ - void _IO_Manager_initialization(void) { uint32_t index; @@ -80,16 +77,6 @@ void _IO_Manager_initialization(void) _IO_Driver_address_table[index] = driver_table[index]; } -/* - * _IO_Initialize_all_drivers - * - * This routine initializes all device drivers - * - * Input Paramters: NONE - * - * Output Parameters: NONE - */ - void _IO_Initialize_all_drivers( void ) { rtems_device_major_number major; diff --git a/cpukit/sapi/src/ioclose.c b/cpukit/sapi/src/ioclose.c index 3f459f8a4d..d58e9b8a71 100644 --- a/cpukit/sapi/src/ioclose.c +++ b/cpukit/sapi/src/ioclose.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Closing for The IO Manager + * + * @ingroup ClassicIO + */ + /* * Input/Output Manager -- Close Device * @@ -16,20 +24,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_close - * - * This routine is the close directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_close( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/iocontrol.c b/cpukit/sapi/src/iocontrol.c index d1002cb773..fa6ad761d9 100644 --- a/cpukit/sapi/src/iocontrol.c +++ b/cpukit/sapi/src/iocontrol.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Device Control +/** + * @file + * + * @brief Control for The IO Manager * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -16,20 +22,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_control - * - * This routine is the control directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_control( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/iodata.c b/cpukit/sapi/src/iodata.c index 082a28f03c..8809b559d6 100644 --- a/cpukit/sapi/src/iodata.c +++ b/cpukit/sapi/src/iodata.c @@ -1,6 +1,12 @@ -/* - * RTEMS Task Manager -- Instantiate Data +/** + * @file + * + * @brief IO Data * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * diff --git a/cpukit/sapi/src/ioinitialize.c b/cpukit/sapi/src/ioinitialize.c index 273792dd83..62f694bea6 100644 --- a/cpukit/sapi/src/ioinitialize.c +++ b/cpukit/sapi/src/ioinitialize.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Initialize Device +/** + * @file + * + * @brief IO Driver Initialization * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -16,20 +22,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_initialize - * - * This routine is the initialization directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_initialize( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/ioopen.c b/cpukit/sapi/src/ioopen.c index 2d9dc67b38..6d4bf8f768 100644 --- a/cpukit/sapi/src/ioopen.c +++ b/cpukit/sapi/src/ioopen.c @@ -1,3 +1,11 @@ +/** + * @file + * + * @brief Opening for The IO Manager + * + * @ingroup ClassicIO + */ + /* * Input/Output Manager - Open Device * @@ -16,20 +24,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_open - * - * This routine is the open directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_open( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/ioread.c b/cpukit/sapi/src/ioread.c index c219b98911..591be7f252 100644 --- a/cpukit/sapi/src/ioread.c +++ b/cpukit/sapi/src/ioread.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Device Read +/** + * @file + * + * @brief Reading for The IO Manager * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -16,20 +22,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_read - * - * This routine is the read directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_read( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/iounregisterdriver.c b/cpukit/sapi/src/iounregisterdriver.c index 433e94b1a9..7836641d24 100644 --- a/cpukit/sapi/src/iounregisterdriver.c +++ b/cpukit/sapi/src/iounregisterdriver.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Dynamically Unregister Device Driver +/** + * @file + * + * @brief Unregister a Driver from the Device Driver Table. * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -19,19 +25,6 @@ #include <rtems/score/thread.h> #include <string.h> -/* - * rtems_io_unregister_driver - * - * Unregister a driver from the device driver table. - * - * Input Paramters: - * major - device major number - * - * Output Parameters: - * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful - */ - rtems_status_code rtems_io_unregister_driver( rtems_device_major_number major ) diff --git a/cpukit/sapi/src/iowrite.c b/cpukit/sapi/src/iowrite.c index 287461701d..285de30f4a 100644 --- a/cpukit/sapi/src/iowrite.c +++ b/cpukit/sapi/src/iowrite.c @@ -1,6 +1,12 @@ -/* - * Input/Output Manager - Device Write +/** + * @file + * + * @brief Writing for The IO Manager * + * @ingroup ClassicIO + */ + +/* * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * @@ -16,20 +22,6 @@ #include <rtems/system.h> #include <rtems/io.h> -/* - * rtems_io_write - * - * This routine is the write directive of the IO manager. - * - * Input Paramters: - * major - device driver number - * minor - device number - * argument - pointer to argument(s) - * - * Output Parameters: - * returns - return code - */ - rtems_status_code rtems_io_write( rtems_device_major_number major, rtems_device_minor_number minor, diff --git a/cpukit/sapi/src/posixapi.c b/cpukit/sapi/src/posixapi.c index a6ea4cb489..3f65442021 100644 --- a/cpukit/sapi/src/posixapi.c +++ b/cpukit/sapi/src/posixapi.c @@ -1,8 +1,12 @@ -/* - * RTEMS API Initialization Support +/** + * @file * - * NOTE: + * @brief Initialize POSIX API * + * @ingroup ClassicRTEMS + */ + +/* * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * @@ -15,11 +19,6 @@ #include "config.h" #endif -/* - * POSIX_API_INIT is defined so all of the POSIX API - * data will be included in this object file. - */ - #define POSIX_API_INIT #include <rtems/system.h> /* include this before checking RTEMS_POSIX_API */ @@ -45,12 +44,6 @@ #include <rtems/posix/spinlock.h> #include <rtems/posix/time.h> -/* - * _POSIX_API_Initialize - * - * XXX - */ - Objects_Information *_POSIX_Objects[ OBJECTS_POSIX_CLASSES_LAST + 1 ]; void _POSIX_API_Initialize(void) @@ -82,4 +75,3 @@ void _POSIX_API_Initialize(void) } #endif -/* end of file */ diff --git a/cpukit/sapi/src/rtemsapi.c b/cpukit/sapi/src/rtemsapi.c index d90a36edde..d59daa19c5 100644 --- a/cpukit/sapi/src/rtemsapi.c +++ b/cpukit/sapi/src/rtemsapi.c @@ -1,8 +1,12 @@ -/* - * POSIX API Initialization Support +/** + * @file * - * NOTE: + * @brief Initializes the RTEMS API * + * @ingroup ClassicRTEMS + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -15,11 +19,6 @@ #include "config.h" #endif -/* - * RTEMS_API_INIT is defined so all of the RTEMS API - * data will be included in this object file. - */ - #define RTEMS_API_INIT #include <rtems/system.h> @@ -45,12 +44,6 @@ Objects_Information *_RTEMS_Objects[ OBJECTS_RTEMS_CLASSES_LAST + 1 ]; -/* - * _RTEMS_API_Initialize - * - * XXX - */ - void _RTEMS_API_Initialize(void) { /* @@ -75,5 +68,3 @@ void _RTEMS_API_Initialize(void) _Rate_monotonic_Manager_initialization(); _Barrier_Manager_initialization(); } - -/* end of file */ diff --git a/cpukit/score/cpu/arm/armv7m-context-initialize.c b/cpukit/score/cpu/arm/armv7m-context-initialize.c index 451c6b5b55..640adae03d 100644 --- a/cpukit/score/cpu/arm/armv7m-context-initialize.c +++ b/cpukit/score/cpu/arm/armv7m-context-initialize.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU Initialize Context + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-context-restore.c b/cpukit/score/cpu/arm/armv7m-context-restore.c index effa3e704e..477904953b 100644 --- a/cpukit/score/cpu/arm/armv7m-context-restore.c +++ b/cpukit/score/cpu/arm/armv7m-context-restore.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU Restore Context + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-exception-handler-get.c b/cpukit/score/cpu/arm/armv7m-exception-handler-get.c index f6aa663436..cf25cafe77 100644 --- a/cpukit/score/cpu/arm/armv7m-exception-handler-get.c +++ b/cpukit/score/cpu/arm/armv7m-exception-handler-get.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief ARMV7M Get Exception Handler + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-exception-handler-set.c b/cpukit/score/cpu/arm/armv7m-exception-handler-set.c index 1f2564faf0..ea3fce3ca5 100644 --- a/cpukit/score/cpu/arm/armv7m-exception-handler-set.c +++ b/cpukit/score/cpu/arm/armv7m-exception-handler-set.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief ARMV7M Set Exception Handler + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-exception-priority-get.c b/cpukit/score/cpu/arm/armv7m-exception-priority-get.c index 446b5c145c..79224e184f 100644 --- a/cpukit/score/cpu/arm/armv7m-exception-priority-get.c +++ b/cpukit/score/cpu/arm/armv7m-exception-priority-get.c @@ -1,3 +1,8 @@ +/** + * @file + * + * @brief ARMV7M Get Exception Priority + */ /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-exception-priority-set.c b/cpukit/score/cpu/arm/armv7m-exception-priority-set.c index f9d2098df9..085ce2dd96 100644 --- a/cpukit/score/cpu/arm/armv7m-exception-priority-set.c +++ b/cpukit/score/cpu/arm/armv7m-exception-priority-set.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief ARMV7M Set Exception Priority + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-isr-enter-leave.c b/cpukit/score/cpu/arm/armv7m-isr-enter-leave.c index cd5844b255..1bce10ae77 100644 --- a/cpukit/score/cpu/arm/armv7m-isr-enter-leave.c +++ b/cpukit/score/cpu/arm/armv7m-isr-enter-leave.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief ARMV7M Interrupt Service Enter and Leave + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-isr-level-get.c b/cpukit/score/cpu/arm/armv7m-isr-level-get.c index 79a03ee0d2..887e30843d 100644 --- a/cpukit/score/cpu/arm/armv7m-isr-level-get.c +++ b/cpukit/score/cpu/arm/armv7m-isr-level-get.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU Get ISR Level + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-isr-level-set.c b/cpukit/score/cpu/arm/armv7m-isr-level-set.c index 981ac063f4..2f4c36312e 100644 --- a/cpukit/score/cpu/arm/armv7m-isr-level-set.c +++ b/cpukit/score/cpu/arm/armv7m-isr-level-set.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU Set ISR Level + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-isr-vector-install.c b/cpukit/score/cpu/arm/armv7m-isr-vector-install.c index c2f52943cb..82b8e02e2b 100644 --- a/cpukit/score/cpu/arm/armv7m-isr-vector-install.c +++ b/cpukit/score/cpu/arm/armv7m-isr-vector-install.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU ISR Vector Install + */ + /* * Copyright (c) 2011 Sebastian Huber. All rights reserved. * diff --git a/cpukit/score/cpu/arm/armv7m-thread-idle.c b/cpukit/score/cpu/arm/armv7m-thread-idle.c index cc9a05c94d..52a3dbd179 100644 --- a/cpukit/score/cpu/arm/armv7m-thread-idle.c +++ b/cpukit/score/cpu/arm/armv7m-thread-idle.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief CPU Thread Idle Body + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/score/cpu/avr/cpu.c b/cpukit/score/cpu/avr/cpu.c index a3153fc72e..75084821dc 100644 --- a/cpukit/score/cpu/avr/cpu.c +++ b/cpukit/score/cpu/avr/cpu.c @@ -1,7 +1,10 @@ -/* - * AVR CPU Dependent Source - * +/** + * @file * + * @brief AVR CPU Dependent Source + */ + +/* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * @@ -20,16 +23,6 @@ #include <rtems/bspIo.h> /* XXX remove me later */ -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: NONE - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ void _CPU_Initialize(void) { @@ -43,14 +36,6 @@ void _CPU_Initialize(void) /* FP context initialization support goes here */ } -/* - * _CPU_ISR_Get_level - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ - uint32_t _CPU_ISR_Get_level( void ) { /* @@ -81,25 +66,6 @@ void _CPU_ISR_install_raw_handler( */ } -/* - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ - void _CPU_ISR_install_vector( uint32_t vector, proc_ptr new_handler, diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c index 15ff3c7619..c87a76dc0b 100644 --- a/cpukit/score/cpu/i386/cpu.c +++ b/cpukit/score/cpu/i386/cpu.c @@ -1,6 +1,10 @@ -/* - * Intel i386 Dependent Source +/** + * @file * + * @brief Intel i386 Dependent Source + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -22,13 +26,6 @@ #include <rtems/bspIo.h> #include <rtems/score/thread.h> -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: NONE - */ - void _CPU_Initialize(void) { #if CPU_HARDWARE_FP @@ -91,10 +88,6 @@ void _CPU_Initialize(void) #endif } -/* - * _CPU_ISR_Get_level - */ - uint32_t _CPU_ISR_Get_level( void ) { uint32_t level; diff --git a/cpukit/score/cpu/i386/sse_test.c b/cpukit/score/cpu/i386/sse_test.c index 1c8d852da0..416a07f01a 100644 --- a/cpukit/score/cpu/i386/sse_test.c +++ b/cpukit/score/cpu/i386/sse_test.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief Test FPU/SSE Context Save and Restore + */ + /* * Authorship * ---------- diff --git a/cpukit/score/cpu/m32c/context_init.c b/cpukit/score/cpu/m32c/context_init.c index 713f8fa161..d7c1c5dd92 100644 --- a/cpukit/score/cpu/m32c/context_init.c +++ b/cpukit/score/cpu/m32c/context_init.c @@ -1,3 +1,10 @@ +/** + * @file + * + * @brief Initialize Context Area + * @ingroup ScoreContext + */ + /* * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). diff --git a/cpukit/score/cpu/m68k/cpu.c b/cpukit/score/cpu/m68k/cpu.c index 23051c28a6..3776345769 100644 --- a/cpukit/score/cpu/m68k/cpu.c +++ b/cpukit/score/cpu/m68k/cpu.c @@ -1,6 +1,10 @@ -/* - * Motorola MC68xxx Dependent Source +/** + * @file * + * @brief Motorola MC68xxx Dependent Source + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -20,15 +24,6 @@ uint32_t _CPU_cacr_shadow; #endif -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: NONE - * - * OUTPUT PARAMETERS: NONE - */ - void _CPU_Initialize(void) { #if ( M68K_HAS_VBR == 0 ) @@ -47,10 +42,6 @@ void _CPU_Initialize(void) #endif /* M68K_HAS_VBR */ } -/* - * _CPU_ISR_Get_level - */ - uint32_t _CPU_ISR_Get_level( void ) { uint32_t level; @@ -111,20 +102,6 @@ void _CPU_ISR_install_raw_handler( #endif /* M68K_HAS_VBR */ } -/* - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * new_handler - replacement ISR for this vector number - * old_handler - former ISR for this vector number - * - * Output parameters: NONE - */ - void _CPU_ISR_install_vector( uint32_t vector, proc_ptr new_handler, diff --git a/cpukit/score/cpu/no_cpu/cpu.c b/cpukit/score/cpu/no_cpu/cpu.c index 89162bb411..287e5d6e18 100644 --- a/cpukit/score/cpu/no_cpu/cpu.c +++ b/cpukit/score/cpu/no_cpu/cpu.c @@ -1,7 +1,10 @@ -/* - * XXX CPU Dependent Source - * +/** + * @file * + * @brief No CPU Dependent Source + */ + +/* * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * @@ -18,17 +21,6 @@ #include <rtems/score/isr.h> #include <rtems/score/wkspace.h> -/* _CPU_Initialize - * - * This routine performs processor dependent initialization. - * - * INPUT PARAMETERS: NONE - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ - void _CPU_Initialize(void) { /* @@ -41,14 +33,6 @@ void _CPU_Initialize(void) /* FP context initialization support goes here */ } -/* - * _CPU_ISR_Get_level - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ - uint32_t _CPU_ISR_Get_level( void ) { /* @@ -78,25 +62,6 @@ void _CPU_ISR_install_raw_handler( */ } -/* - * _CPU_ISR_install_vector - * - * This kernel routine installs the RTEMS handler for the - * specified vector. - * - * Input parameters: - * vector - interrupt vector number - * old_handler - former ISR for this vector number - * new_handler - replacement ISR for this vector number - * - * Output parameters: NONE - * - * - * NO_CPU Specific Information: - * - * XXX document implementation including references if appropriate - */ - void _CPU_ISR_install_vector( uint32_t vector, proc_ptr new_handler, diff --git a/cpukit/score/cpu/no_cpu/cpu_asm.c b/cpukit/score/cpu/no_cpu/cpu_asm.c index e2e466cbc9..c1e008aafd 100644 --- a/cpukit/score/cpu/no_cpu/cpu_asm.c +++ b/cpukit/score/cpu/no_cpu/cpu_asm.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief No CPU Assembly File + */ + /* cpu_asm.c ===> cpu_asm.S or cpu_asm.s * * This file contains the basic algorithms for all assembly code used diff --git a/cpukit/score/cpu/powerpc/cpu.c b/cpukit/score/cpu/powerpc/cpu.c index a1ede940db..1cac19c887 100644 --- a/cpukit/score/cpu/powerpc/cpu.c +++ b/cpukit/score/cpu/powerpc/cpu.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief PowerPC Dependent Source + */ + /* * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at diff --git a/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c b/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c index 4b8e81a5ea..98eff81a14 100644 --- a/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c +++ b/cpukit/score/cpu/powerpc/ppc-isr-vector-install.c @@ -1,3 +1,9 @@ +/** + * @file + * + * @brief Install Interrupt Handler Vector + */ + /* * Copyright (c) 2012 embedded brains GmbH. All rights reserved. * diff --git a/cpukit/score/include/rtems/debug.h b/cpukit/score/include/rtems/debug.h index 4155775ef2..4087e4ae94 100644 --- a/cpukit/score/include/rtems/debug.h +++ b/cpukit/score/include/rtems/debug.h @@ -45,25 +45,27 @@ typedef uint32_t rtems_debug_control; SCORE_EXTERN rtems_debug_control _Debug_Level; /** - * This routine performs the initialization necessary for this manager. + * @brief Initialize Debug Manager */ void _Debug_Manager_initialization( void ); /** - * This routine enables the specified types of debug checks. + * @brief Enable Debugging */ void rtems_debug_enable( rtems_debug_control to_be_enabled ); /** - * This routine disables the specified types of debug checks. + * @brief Disable Debugging */ void rtems_debug_disable( rtems_debug_control to_be_disabled ); /** + * @brief Check if Debug is Enabled + * * This routine returns TRUE if the requested debug level is * enabled, and FALSE otherwise. */ diff --git a/cpukit/score/include/rtems/score/apiext.h b/cpukit/score/include/rtems/score/apiext.h index 82910bfc0d..db77a8b9c8 100644 --- a/cpukit/score/include/rtems/score/apiext.h +++ b/cpukit/score/include/rtems/score/apiext.h @@ -46,9 +46,9 @@ typedef void (*API_extensions_Postdriver_hook)(void); /** - * This type defines the prototype of the Postswitch Hook. + * This type defines the prototype of the Post Switch Hook. */ -typedef void (*API_extensions_Postswitch_hook)( +typedef void (*API_extensions_Post_switch_hook)( Thread_Control * ); @@ -77,20 +77,34 @@ typedef struct { * @note If this field is NULL, no extension is invoked. */ API_extensions_Postdriver_hook postdriver_hook; +} API_extensions_Control; + +/** + * @brief Control structure for post switch hooks. + */ +typedef struct { + Chain_Node Node; + /** - * This field is the callout invoked during each context switch - * in the context of the heir thread. + * @brief The hook invoked during each context switch in the context of the + * heir thread. * - * @note If this field is NULL, no extension is invoked. + * This hook must not be NULL. */ - API_extensions_Postswitch_hook postswitch_hook; -} API_extensions_Control; + API_extensions_Post_switch_hook hook; +} API_extensions_Post_switch_control; /** * This is the list of API extensions to the system initialization. */ SCORE_EXTERN Chain_Control _API_extensions_List; + +/** + * @brief The API extensions post switch list. + */ +SCORE_EXTERN Chain_Control _API_extensions_Post_switch_list; + /** * @brief Initialize the API Extensions Handler * @@ -109,6 +123,23 @@ void _API_extensions_Add( API_extensions_Control *the_extension ); +/** + * @brief Adds the API extension post switch control to the post switch list. + * + * The post switch control is only added to the list if it is in the off chain + * state. Thus this function can be called multiple times with the same + * post switch control and only the first invocation will actually add it to the + * list. + * + * There is no protection against concurrent access. This function must be + * called within a _Thread_Disable_dispatch() critical section. + * + * @param [in, out] post_switch The post switch control. + */ +void _API_extensions_Add_post_switch( + API_extensions_Post_switch_control *post_switch +); + #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) /** * @brief Execute all Pre-Driver Extensions @@ -126,21 +157,19 @@ void _API_extensions_Add( void _API_extensions_Run_postdriver( void ); /** - * @brief Execute all Post Context Switch Extensions - * - * This routine executes all of the post context switch callouts. + * @brief Runs all API extension post switch hooks. */ -static inline void _API_extensions_Run_postswitch( Thread_Control *executing ) +static inline void _API_extensions_Run_post_switch( Thread_Control *executing ) { - const Chain_Control *chain = &_API_extensions_List; + const Chain_Control *chain = &_API_extensions_Post_switch_list; const Chain_Node *tail = _Chain_Immutable_tail( chain ); const Chain_Node *node = _Chain_Immutable_first( chain ); while ( node != tail ) { - const API_extensions_Control *extension = - (const API_extensions_Control *) node; + const API_extensions_Post_switch_control *post_switch = + (const API_extensions_Post_switch_control *) node; - (*extension->postswitch_hook)( executing ); + (*post_switch->hook)( executing ); node = _Chain_Immutable_next( node ); } diff --git a/cpukit/score/inline/rtems/score/chain.inl b/cpukit/score/inline/rtems/score/chain.inl index f0714eb78c..ebef69521b 100644 --- a/cpukit/score/inline/rtems/score/chain.inl +++ b/cpukit/score/inline/rtems/score/chain.inl @@ -538,6 +538,25 @@ RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected( the_node->previous = old_last; } +/** + * @brief Append a node on the end of a chain if the node is in the off chain + * state (unprotected). + * + * @note It does NOT disable interrupts to ensure the atomicity of the + * append operation. + * + * @see _Chain_Append_unprotected() and _Chain_Is_node_off_chain(). + */ +RTEMS_INLINE_ROUTINE void _Chain_Append_if_is_off_chain_unprotected( + Chain_Control *the_chain, + Chain_Node *the_node +) +{ + if ( _Chain_Is_node_off_chain( the_node ) ) { + _Chain_Append_unprotected( the_chain, the_node ); + } +} + /** @brief Prepend a Node (unprotected) * * This routine prepends the_node onto the front of the_chain. diff --git a/cpukit/score/src/apiext.c b/cpukit/score/src/apiext.c index 73dffee856..fbca353131 100644 --- a/cpukit/score/src/apiext.c +++ b/cpukit/score/src/apiext.c @@ -25,6 +25,7 @@ void _API_extensions_Initialization( void ) { _Chain_Initialize_empty( &_API_extensions_List ); + _Chain_Initialize_empty( &_API_extensions_Post_switch_list ); } void _API_extensions_Add( @@ -34,6 +35,16 @@ void _API_extensions_Add( _Chain_Append( &_API_extensions_List, &the_extension->Node ); } +void _API_extensions_Add_post_switch( + API_extensions_Post_switch_control *post_switch +) +{ + _Chain_Append_if_is_off_chain_unprotected( + &_API_extensions_Post_switch_list, + &post_switch->Node + ); +} + #if defined(FUNCTIONALITY_NOT_CURRENTLY_USED_BY_ANY_API) void _API_extensions_Run_predriver( void ) diff --git a/cpukit/score/src/threaddispatch.c b/cpukit/score/src/threaddispatch.c index 283d27880d..66c7bdcd43 100644 --- a/cpukit/score/src/threaddispatch.c +++ b/cpukit/score/src/threaddispatch.c @@ -69,7 +69,7 @@ void _Thread_Dispatch( void ) * * _Thread_Unnest_dispatch(); * - * _API_extensions_Run_postswitch(); + * _API_extensions_Run_post_switch(); * } * * The interrupt event makes task H ready. The interrupt code will see @@ -202,5 +202,5 @@ post_switch: _Thread_Unnest_dispatch(); #endif - _API_extensions_Run_postswitch( executing ); + _API_extensions_Run_post_switch( executing ); } diff --git a/cpukit/score/src/watchdogadjusttochain.c b/cpukit/score/src/watchdogadjusttochain.c index 3b8684a978..902d9de380 100644 --- a/cpukit/score/src/watchdogadjusttochain.c +++ b/cpukit/score/src/watchdogadjusttochain.c @@ -33,16 +33,9 @@ void _Watchdog_Adjust_to_chain( ISR_Level level; Watchdog_Control *first; - if ( units <= 0 ) { - return; - } - _ISR_Disable( level ); while ( 1 ) { - if ( units <= 0 ) { - break; - } if ( _Chain_Is_empty( header ) ) { break; } diff --git a/doc/bsp_howto/init.t b/doc/bsp_howto/init.t index f91d15f934..d1486cca5f 100644 --- a/doc/bsp_howto/init.t +++ b/doc/bsp_howto/init.t @@ -41,7 +41,6 @@ for this functionality. @example ../../sparc/shared/start.S -../../sparc/shared/bspclean.c @end example @b{NOTE:} In most BSPs, the directory named @code{start340} in the @@ -93,10 +92,9 @@ to the shared @code{bootcard.c} framework then through the C Library, RTEMS, device driver initialization phases, and the context switch to the first application task. After this, the application executes until it calls @code{exit}, @code{rtems_shutdown_executive}, or some -other normal termination initiating routine and control is returned -to @code{bootcard.c} which allows the BSP to perform some cleanup in C -(@code{bsp_cleanup}) and then @code{boot_card} returns to the assembly -language which initially invoked it. +other normal termination initiating routine and a fatal system state is +reached. The optional @code{bsp_fatal_extension} initial extension can perform +BSP specific system termination. The routines invoked during this will be discussed and their location in the RTEMS source tree pointed out as we discuss each. @@ -197,28 +195,26 @@ this point in the initialization sequence. This is the last opportunity for the BSP to insert BSP specific code into the initialization sequence. @item It invokes the RTEMS directive -@code{rtems_initialize_start_multitasking()} which starts multitasking and context switches to the first task. @code{boot_card()} will not return until the application is shutdown. As part of this sequence the following actions occur: - -@itemize @bullet - -@item RTEMS will context switch to the first application task. As a -side-effect of this context switch, processor interrupts will be enabled. -This is often the source of a fatal error during BSP development because -the BSP did not clear and/or disable all interrupt sources and a spurious -interrupt will occur . - -@item When in the context of the first task but before its body has been +@code{rtems_initialize_start_multitasking()} +which initiates multitasking and performs a context switch to the +first user application task and may enable interrupts as a side-effect of +that context switch. The context switch saves the executing context. The +application runs now. The directive rtems_shutdown_executive() will return +to the saved context. The exit() function will use this directive. + +After a return to the saved context a fatal system state is reached. The +fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value +passed to rtems_shutdown_executive(). + +The enabling of interrupts during the first context switch is often the source +for fatal errors during BSP development because the BSP did not clear and/or +disable all interrupt sources and a spurious interrupt will occur. + +When in the context of the first task but before its body has been entered, any C++ Global Constructors will be invoked. @end itemize -@item Finally after the application shutsdown RTEMS and control is -return to @code{boot_card()} from RTEMS, it invokes the BSP specific -routine @code{bsp_cleanup()} to perform any necessary board specific -shutdown actions. - -@end itemize - That's it. We just went through the entire sequence. @subsection bsp_start() - BSP Specific Initialization diff --git a/doc/bsp_howto/support.t b/doc/bsp_howto/support.t index 9856deb0fa..5f8eb1a9c9 100644 --- a/doc/bsp_howto/support.t +++ b/doc/bsp_howto/support.t @@ -179,23 +179,25 @@ this operation. @findex CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK If your BSP does not want to support dynamic heap extension, then you do not have to do anything special. However, if you want to support @code{sbrk}, you must provide an implementation of this method and define @code{CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK} in @code{bsp.h}. This informs @code{rtems/confdefs.h} to configure the Malloc Family Extensions which support @code{sbrk}. -@section bsp_cleanup(uint32_t status) - Cleanup the Hardware +@section bsp_fatal_extension() - Cleanup the Hardware -The @code{bsp_cleanup()} is the last C code invoked. Most of the BSPs -use the same shared version of @code{bsp_cleanup()} that does nothing. -This implementation is located in the following file: +The @code{bsp_fatal_extension()} is an optional BSP specific initial extension +invoked once a fatal system state is reached. Most of the BSPs use the same +shared version of @code{bsp_fatal_extension()} that does nothing or performs a +system reset. This implementation is located in the following file: @example c/src/lib/libbsp/shared/bspclean.c @end example -The @code{bsp_cleanup()} routine can be used to return to a ROM monitor, -insure that interrupt sources are disabled, etc.. This routine is the -last place to ensure a clean shutdown of the hardware. The @code{status} -argument is the value passed to the service which initiated shutting -down RTEMS. All of the non-fatal shutdown sequences ultimately pass -their exit status to @code{rtems_shutdown_executive} and this is what -is passed to this routine. +The @code{bsp_fatal_extension()} routine can be used to return to a ROM +monitor, insure that interrupt sources are disabled, etc.. This routine is the +last place to ensure a clean shutdown of the hardware. The fatal source, +internal error indicator, and the fatal code arguments are available to +evaluate the fatal condition. All of the non-fatal shutdown sequences +ultimately pass their exit status to @code{rtems_shutdown_executive} and this +is what is passed to this routine in case the fatal source is +RTEMS_FATAL_SOURCE_EXIT. On some BSPs, it prints a message indicating that the application completed execution and waits for the user to press a key before diff --git a/doc/user/init.t b/doc/user/init.t index d7da360b17..4fe4926bfd 100644 --- a/doc/user/init.t +++ b/doc/user/init.t @@ -346,7 +346,7 @@ the first context switch. @ifset is-C @findex rtems_initialize_start_multitasking @example -uint32_t rtems_initialize_start_multitasking(void); +void rtems_initialize_start_multitasking(void); @end example @end ifset @@ -358,21 +358,23 @@ NOT SUPPORTED FROM Ada BINDING @subheading DIRECTIVE STATUS CODES: -This directive returns the status code passed in to the -@code{@value{DIRPREFIX}shutdown_executive}. +NONE @subheading DESCRIPTION: -This directive is called after the other Initialization Manager -directives have successfully completed. This directive -initiates multitasking and performs a context switch to -the first user application task and enables interrupts as -a side-effect of that context switch. +This directive initiates multitasking and performs a context switch to the +first user application task and may enable interrupts as a side-effect of +that context switch. The context switch saves the executing context. The +application runs now. The directive rtems_shutdown_executive() will return +to the saved context. The exit() function will use this directive. + +After a return to the saved context a fatal system state is reached. The +fatal source is RTEMS_FATAL_SOURCE_EXIT with a fatal code set to the value +passed to rtems_shutdown_executive(). @subheading NOTES: -This directive @b{DOES NOT RETURN} to the caller until the -@code{@value{DIRPREFIX}shutdown_executive} is invoked. +This directive @b{DOES NOT RETURN} to the caller. This directive causes all nodes in the system to verify that certain configuration parameters are the same as diff --git a/testsuites/fstests/Makefile.am b/testsuites/fstests/Makefile.am index 9bba757b5a..516138027b 100644 --- a/testsuites/fstests/Makefile.am +++ b/testsuites/fstests/Makefile.am @@ -1,6 +1,8 @@ ACLOCAL_AMFLAGS = -I ../aclocal -SUBDIRS = +SUBDIRS = +SUBDIRS += fsdosfswrite01 +SUBDIRS += fsdosfsformat01 SUBDIRS += fsfseeko01 SUBDIRS += fsdosfssync01 SUBDIRS += imfs_fserror diff --git a/testsuites/fstests/configure.ac b/testsuites/fstests/configure.ac index 6dd15acddc..4993beb7c5 100644 --- a/testsuites/fstests/configure.ac +++ b/testsuites/fstests/configure.ac @@ -77,6 +77,8 @@ AC_CHECK_SIZEOF([blkcnt_t]) # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +fsdosfswrite01/Makefile +fsdosfsformat01/Makefile fsfseeko01/Makefile fsdosfssync01/Makefile imfs_fserror/Makefile diff --git a/testsuites/fstests/fsdosfsformat01/Makefile.am b/testsuites/fstests/fsdosfsformat01/Makefile.am new file mode 100644 index 0000000000..d7c91f0802 --- /dev/null +++ b/testsuites/fstests/fsdosfsformat01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = fsdosfsformat01 +fsdosfsformat01_SOURCES = init.c + +dist_rtems_tests_DATA = fsdosfsformat01.scn fsdosfsformat01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(fsdosfsformat01_OBJECTS) +LINK_LIBS = $(fsdosfsformat01_LDLIBS) + +fsdosfsformat01$(EXEEXT): $(fsdosfsformat01_OBJECTS) $(fsdosfsformat01_DEPENDENCIES) + @rm -f fsdosfsformat01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.doc b/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.doc new file mode 100644 index 0000000000..6cdb669433 --- /dev/null +++ b/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.doc @@ -0,0 +1,11 @@ +This file describes the directives and concepts tested by this test set. + +test set name: fsdosfsformat01 + +directives: + + TBD + +concepts: + + TBD diff --git a/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.scn b/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.scn new file mode 100644 index 0000000000..e7462728fc --- /dev/null +++ b/testsuites/fstests/fsdosfsformat01/fsdosfsformat01.scn @@ -0,0 +1,2 @@ +*** TEST FSDOSFSFORMAT 1 *** +*** END OF TEST FSDOSFSFORMAT 1 *** diff --git a/testsuites/fstests/fsdosfsformat01/init.c b/testsuites/fstests/fsdosfsformat01/init.c new file mode 100644 index 0000000000..1af9be8cf5 --- /dev/null +++ b/testsuites/fstests/fsdosfsformat01/init.c @@ -0,0 +1,445 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file_name may be + * found in the file_name LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "tmacros.h" + +#include <fcntl.h> +#include <inttypes.h> +#include <sys/statvfs.h> +#include <rtems/libio.h> +#include <rtems/blkdev.h> +#include <rtems/dosfs.h> +#include <rtems/sparse-disk.h> + +#include <bsp.h> + +#define MAX_PATH_LENGTH 100 /* Maximum number of characters per path */ +#define SECTOR_SIZE 512 /* sector size (bytes) */ +#define FAT12_MAX_CLN 4085 /* maximum + 1 number of clusters for FAT12 */ +#define FAT16_MAX_CLN 65525 /* maximum + 1 number of clusters for FAT16 */ +#define FAT12_DEFAULT_SECTORS_PER_CLUSTER 8 /* Default number of sectors per cluster for FAT12 */ +#define FAT16_DEFAULT_SECTORS_PER_CLUSTER 32 /* Default number of sectors per cluster for FAT16 */ + +static void test_disk_params( + const char *dev_name, + const char *mount_dir, + const blksize_t sector_size, + const blksize_t cluster_size, + const blkcnt_t sectors_per_cluster ) +{ + int rv; + int fildes; + struct stat stat_buff; + char file_name[MAX_PATH_LENGTH + 1]; + ssize_t num_bytes; + unsigned int value = (unsigned int) -1; + + + snprintf( file_name, MAX_PATH_LENGTH, "%s/file1.txt", mount_dir ); + memset( &stat_buff, 0, sizeof( stat_buff ) ); + + rv = mount( dev_name, + mount_dir, + RTEMS_FILESYSTEM_TYPE_DOSFS, + RTEMS_FILESYSTEM_READ_WRITE, + NULL ); + rtems_test_assert( 0 == rv ); + + fildes = open( file_name, + O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ); + rtems_test_assert( -1 != fildes ); + + num_bytes = write( fildes, &value, sizeof( value ) ); + rtems_test_assert( sizeof( value ) == num_bytes ); + + rv = fstat( fildes, &stat_buff ); + rtems_test_assert( 0 == rv ); + rtems_test_assert( S_ISREG( stat_buff.st_mode ) ); + rtems_test_assert( sizeof( value ) == stat_buff.st_size ); + rtems_test_assert( cluster_size == stat_buff.st_blksize ); + rtems_test_assert( sectors_per_cluster + == ( stat_buff.st_blocks * sector_size / 512 ) ); + rtems_test_assert( ( ( ( stat_buff.st_size + cluster_size + - 1 ) / cluster_size ) * cluster_size / 512 ) + == stat_buff.st_blocks ); + rv = close( fildes ); + rtems_test_assert( 0 == rv ); + + rv = unmount( mount_dir ); + rtems_test_assert( 0 == rv ); +} + +static void test_create_file( + const char *mount_dir, + uint32_t file_idx, + bool expect_ok ) +{ + char file_name[MAX_PATH_LENGTH + 1]; + int fd; + + + snprintf( file_name, + MAX_PATH_LENGTH, + "%s/file%" PRIu32 ".txt", + mount_dir, + file_idx ); + fd = open( file_name, + O_RDWR | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ); + + if ( expect_ok ) { + int rv; + + rtems_test_assert( fd >= 0 ); + + rv = close( fd ); + rtems_test_assert( rv == 0 ); + } else { + rtems_test_assert( fd == -1 ); + } +} + +static void test_file_creation( + const char *dev_name, + const char *mount_dir, + const uint32_t number_of_files ) +{ + int rv; + uint32_t file_idx; + char file_name[MAX_PATH_LENGTH + 1]; + + + rv = mount( dev_name, + mount_dir, + RTEMS_FILESYSTEM_TYPE_DOSFS, + RTEMS_FILESYSTEM_READ_WRITE, + NULL ); + rtems_test_assert( 0 == rv ); + + for ( file_idx = 0; file_idx < number_of_files; ++file_idx ) { + test_create_file( mount_dir, file_idx, true ); + } + + test_create_file( mount_dir, file_idx, false ); + + for ( file_idx = 0; file_idx < number_of_files; ++file_idx ) { + snprintf( file_name, + MAX_PATH_LENGTH, + "%s/file%" PRIu32 ".txt", + mount_dir, + file_idx ); + rv = unlink( file_name ); + rtems_test_assert( 0 == rv ); + } + + rv = unmount( mount_dir ); + rtems_test_assert( 0 == rv ); +} + +static void test( void ) +{ + rtems_status_code sc; + int rv; + const char dev_name[] = "/dev/rda"; + const char mount_dir[] = "/mnt"; + msdos_format_request_param_t rqdata; + + + memset( &rqdata, 0, sizeof( rqdata ) ); + + sc = rtems_disk_io_initialize(); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + + rv = mkdir( mount_dir, S_IRWXU | S_IRWXG | S_IRWXO ); + rtems_test_assert( 0 == rv ); + + /* FAT12 */ + /* For 1.44 MB disks */ + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 64, + 2880, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Optimized for disk space */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 1; + rqdata.fat_num = 1; + rqdata.files_per_root_dir = 32; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = true; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, mount_dir, SECTOR_SIZE, SECTOR_SIZE, 1 ); + test_file_creation( dev_name, mount_dir, rqdata.files_per_root_dir ); + + /* Try formatting with invalid values */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 1; + rqdata.fat_num = 7; /* Invalid number of fats */ + rqdata.files_per_root_dir = 32; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = true; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv != 0 ); + + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 1; + rqdata.fat_num = 1; + rqdata.files_per_root_dir = 32; + rqdata.media = 0x11; /* Invalid media code */ + rqdata.quick_format = true; + rqdata.skip_alignment = true; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv != 0 ); + + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 16; /* Invalid number of sectors per cluster for FAT12 */ + rqdata.fat_num = 1; + rqdata.files_per_root_dir = 32; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = false; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv != 0 ); + + /* Optimized for read/write speed */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 8; + rqdata.fat_num = 0; + rqdata.files_per_root_dir = 0; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = false; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * rqdata.sectors_per_cluster, + rqdata.sectors_per_cluster ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + /* Largest FAT12 disk */ + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 64, + ( FAT12_MAX_CLN * FAT12_DEFAULT_SECTORS_PER_CLUSTER ) - 1L, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Default parameters (corresponds to optimization for read/write speed) */ + rv = msdos_format( dev_name, NULL ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * FAT12_DEFAULT_SECTORS_PER_CLUSTER, + FAT12_DEFAULT_SECTORS_PER_CLUSTER ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + /* FAT16 */ + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 1024, + ( FAT16_MAX_CLN * FAT16_DEFAULT_SECTORS_PER_CLUSTER ) - 1L, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Optimized for disk space */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 1; + rqdata.fat_num = 1; + rqdata.files_per_root_dir = 32; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = true; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, mount_dir, SECTOR_SIZE, SECTOR_SIZE, 1 ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 1024, + ( FAT16_MAX_CLN * FAT16_DEFAULT_SECTORS_PER_CLUSTER ) - 1L, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Optimized for read/write speed */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 64; + rqdata.fat_num = 0; + rqdata.files_per_root_dir = 0; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = false; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * rqdata.sectors_per_cluster, + rqdata.sectors_per_cluster ); + + /* Default parameters (corresponds to optimization for read/write speed) */ + rv = msdos_format( dev_name, NULL ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * FAT16_DEFAULT_SECTORS_PER_CLUSTER, + FAT16_DEFAULT_SECTORS_PER_CLUSTER ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 1024, + ( FAT16_MAX_CLN + 10 ) * 64, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 64; + rqdata.fat_num = 0; + rqdata.files_per_root_dir = 0; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = false; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * rqdata.sectors_per_cluster, + rqdata.sectors_per_cluster ); + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + /* FAT32 */ + + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 1024, + ( FAT16_MAX_CLN * FAT16_DEFAULT_SECTORS_PER_CLUSTER ) + 41L, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Default parameters */ + rv = msdos_format( dev_name, NULL ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, mount_dir, SECTOR_SIZE, SECTOR_SIZE, 1 ); + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); + + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 1024, + ( FAT16_MAX_CLN + 20 ) * 64L, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Optimized for read/write speed */ + rqdata.OEMName = NULL; + rqdata.VolLabel = NULL; + rqdata.sectors_per_cluster = 64; + rqdata.fat_num = 0; + rqdata.files_per_root_dir = 0; + rqdata.media = 0; /* Media code. 0 == Default */ + rqdata.quick_format = true; + rqdata.skip_alignment = false; + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + test_disk_params( dev_name, + mount_dir, + SECTOR_SIZE, + SECTOR_SIZE * rqdata.sectors_per_cluster, + rqdata.sectors_per_cluster ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); +} + +static void Init( rtems_task_argument arg ) +{ + puts( "\n\n*** TEST FSDOSFSFORMAT 1 ***" ); + + test(); + + puts( "*** END OF TEST FSDOSFSFORMAT 1 ***" ); + + rtems_test_exit( 0 ); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK + +/* one active file + stdin + stdout + stderr + device file when mounted */ +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5 + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_FILESYSTEM_DOSFS + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 + +#define CONFIGURE_INIT_TASK_STACK_SIZE ( 32 * 1024 ) + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE ( 32 * 1024 ) + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> diff --git a/testsuites/fstests/fsdosfswrite01/Makefile.am b/testsuites/fstests/fsdosfswrite01/Makefile.am new file mode 100644 index 0000000000..2d21751178 --- /dev/null +++ b/testsuites/fstests/fsdosfswrite01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = fsdosfswrite01 +fsdosfswrite01_SOURCES = init.c + +dist_rtems_tests_DATA = fsdosfswrite01.scn fsdosfswrite01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(fsdosfswrite01_OBJECTS) +LINK_LIBS = $(fsdosfswrite01_LDLIBS) + +fsdosfswrite01$(EXEEXT): $(fsdosfswrite01_OBJECTS) $(fsdosfswrite01_DEPENDENCIES) + @rm -f fsdosfswrite01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.doc b/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.doc new file mode 100644 index 0000000000..e18bf06a39 --- /dev/null +++ b/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.doc @@ -0,0 +1,15 @@ +This file describes the directives and concepts tested by this test set. + +test set name: fsdosfswrite01 + +directives: + - fat_file_write() + - fat_file_write_fat32_or_non_root_dir() + +concepts: + - Avoiding uneccessary device reads is to make sure that writing to the device + does not get slowed down unneccesarily. + - Verify that appending data to a file does not result in reading the new + clusters from device. + - Verify writing a whole cluster does not result in reading the cluster from + device. diff --git a/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.scn b/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.scn new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuites/fstests/fsdosfswrite01/fsdosfswrite01.scn diff --git a/testsuites/fstests/fsdosfswrite01/init.c b/testsuites/fstests/fsdosfswrite01/init.c new file mode 100644 index 0000000000..1b231497ec --- /dev/null +++ b/testsuites/fstests/fsdosfswrite01/init.c @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "tmacros.h" +#include <fcntl.h> +#include <rtems/dosfs.h> +#include <rtems/sparse-disk.h> +#include <rtems/blkdev.h> +#include <bsp.h> + +#define MAX_PATH_LENGTH 100 /* Maximum number of characters per path */ +#define SECTOR_SIZE 512 /* sector size (bytes) */ +#define FAT16_MAX_CLN 65525 /* maximum + 1 number of clusters for FAT16 */ +#define FAT16_DEFAULT_SECTORS_PER_CLUSTER 32 /* Default number of sectors per cluster for FAT16 */ +#define SECTORS_PER_CLUSTER 2 + +static void format_and_mount( const char *dev_name, const char *mount_dir ) +{ + static const msdos_format_request_param_t rqdata = { + .sectors_per_cluster = SECTORS_PER_CLUSTER, + .quick_format = true + }; + + int rv; + + + rv = msdos_format( dev_name, &rqdata ); + rtems_test_assert( rv == 0 ); + + rv = mount( dev_name, + mount_dir, + RTEMS_FILESYSTEM_TYPE_DOSFS, + RTEMS_FILESYSTEM_READ_WRITE, + NULL ); + rtems_test_assert( rv == 0 ); +} + +static void do_fsync( const char *file ) +{ + int rv; + int fd; + + + fd = open( file, O_RDONLY ); + rtems_test_assert( fd >= 0 ); + + rv = fsync( fd ); + rtems_test_assert( rv == 0 ); + + rv = close( fd ); + rtems_test_assert( rv == 0 ); +} + +static void check_block_stats( const char *dev_name, + const char *mount_dir, + const rtems_blkdev_stats *expected_stats ) +{ + int fd; + int rv; + rtems_blkdev_stats actual_stats; + + + do_fsync( mount_dir ); + + fd = open( dev_name, O_RDONLY ); + rtems_test_assert( fd >= 0 ); + + rv = ioctl( fd, RTEMS_BLKIO_GETDEVSTATS, &actual_stats ); + rtems_test_assert( rv == 0 ); + rtems_test_assert( memcmp( &actual_stats, expected_stats, + sizeof( actual_stats ) ) == 0 ); + + rv = close( fd ); + rtems_test_assert( rv == 0 ); +} + +static void reset_block_stats( const char *dev_name, const char *mount_dir ) +{ + int fd; + int rv; + + + do_fsync( mount_dir ); + + fd = open( dev_name, O_RDONLY ); + rtems_test_assert( fd >= 0 ); + + rv = ioctl( fd, RTEMS_BLKIO_PURGEDEV ); + rtems_test_assert( rv == 0 ); + + rv = ioctl( fd, RTEMS_BLKIO_RESETDEVSTATS ); + rtems_test_assert( rv == 0 ); + + rv = close( fd ); + rtems_test_assert( rv == 0 ); +} + +static int create_file( const char *file_name ) +{ + mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO; + + + return creat( file_name, mode ); +} + +static void test_normal_file_write( + const char *dev_name, + const char *mount_dir, + const char *file_name ) +{ + static const rtems_blkdev_stats complete_block_stats = { + .read_hits = 0, + .read_misses = 0, + .read_ahead_transfers = 0, + .read_blocks = 0, + .read_errors = 0, + .write_transfers = 1, + .write_blocks = 1, + .write_errors = 0 + }; + static const rtems_blkdev_stats new_block_stats = { + .read_hits = 8, + .read_misses = 2, + .read_ahead_transfers = 0, + .read_blocks = 2, + .read_errors = 0, + .write_transfers = 1, + .write_blocks = 4, + .write_errors = 0 + }; + + int rv; + int fd; + ssize_t num_bytes; + uint8_t cluster_buf[SECTOR_SIZE + * SECTORS_PER_CLUSTER]; + uint32_t cluster_size = sizeof( cluster_buf ); + off_t off; + + + memset( cluster_buf, 0xFE, cluster_size ); + + format_and_mount( dev_name, mount_dir ); + + fd = create_file( file_name ); + rtems_test_assert( fd >= 0 ); + + num_bytes = write( fd, cluster_buf, cluster_size ); + rtems_test_assert( (ssize_t) cluster_size == num_bytes ); + + off = lseek( fd, 0, SEEK_SET ); + rtems_test_assert( off == 0 ); + + reset_block_stats( dev_name, mount_dir ); + + /* Write a complete cluster into an existing file space */ + num_bytes = write( fd, cluster_buf, cluster_size ); + rtems_test_assert( (ssize_t) cluster_size == num_bytes ); + + check_block_stats( dev_name, mount_dir, &complete_block_stats ); + reset_block_stats( dev_name, mount_dir ); + + num_bytes = write( fd, cluster_buf, cluster_size ); + rtems_test_assert( (ssize_t) cluster_size == num_bytes ); + + /* Write a new partial cluster into a new file space */ + num_bytes = write( fd, cluster_buf, 1 ); + rtems_test_assert( num_bytes == 1 ); + + check_block_stats( dev_name, mount_dir, &new_block_stats ); + + rv = close( fd ); + rtems_test_assert( 0 == rv ); + + rv = unmount( mount_dir ); + rtems_test_assert( 0 == rv ); +} + +static void test_fat12_root_directory_write( const char *dev_name, + const char *mount_dir, + const char *file_name ) +{ + static const rtems_blkdev_stats fat12_root_dir_stats = { + .read_hits = 11, + .read_misses = 2, + .read_ahead_transfers = 0, + .read_blocks = 2, + .read_errors = 0, + .write_transfers = 1, + .write_blocks = 1, + .write_errors = 0 + }; + + int fd; + int rv; + + + format_and_mount( dev_name, mount_dir ); + + reset_block_stats( dev_name, mount_dir ); + + fd = create_file( file_name ); + rtems_test_assert( fd >= 0 ); + + rv = close( fd ); + rtems_test_assert( rv == 0 ); + + check_block_stats( dev_name, mount_dir, &fat12_root_dir_stats ); + + rv = unmount( mount_dir ); + rtems_test_assert( rv == 0 ); +} + +static void test( void ) +{ + static const char dev_name[] = "/dev/sda"; + static const char mount_dir[] = "/mnt"; + static const char file_name[] = "/mnt/file.txt"; + + rtems_status_code sc; + int rv; + + + sc = rtems_disk_io_initialize(); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + + rv = mkdir( mount_dir, S_IRWXU | S_IRWXG | S_IRWXO ); + rtems_test_assert( 0 == rv ); + + /* A 1.44 MB disk */ + sc = rtems_sparse_disk_create_and_register( + dev_name, + SECTOR_SIZE, + 64, + 2880, + 0 + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + test_fat12_root_directory_write( dev_name, mount_dir, file_name ); + + test_normal_file_write( dev_name, mount_dir, file_name ); + + rv = unlink( dev_name ); + rtems_test_assert( rv == 0 ); +} + +static void Init( rtems_task_argument arg ) +{ + puts( "\n\n*** TEST FSDOSFSWRITE 1 ***" ); + + test(); + + puts( "*** END OF TEST FSDOSFSWRITE 1 ***" ); + + rtems_test_exit( 0 ); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_FILESYSTEM_DOSFS + +/* 1 device file for blkstats + 1 file for writing + 1 mount_dir + stdin + stdout + stderr + device file when mounted */ +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 8 + +#define CONFIGURE_UNLIMITED_OBJECTS +#define CONFIGURE_UNIFIED_WORK_AREAS + +#define CONFIGURE_INIT_TASK_STACK_SIZE ( 32 * 1024 ) + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE ( 32 * 1024 ) + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h>
\ No newline at end of file diff --git a/testsuites/fstests/mdosfs_support/fs_support.c b/testsuites/fstests/mdosfs_support/fs_support.c index ef4356e65b..62370c9a9b 100644 --- a/testsuites/fstests/mdosfs_support/fs_support.c +++ b/testsuites/fstests/mdosfs_support/fs_support.c @@ -28,13 +28,12 @@ msdos_format_request_param_t rqdata = { OEMName: "RTEMS", VolLabel: "RTEMSDisk", - sectors_per_cluster: 0, + sectors_per_cluster: 2, fat_num: 0, files_per_root_dir: 0, - fattype: MSDOS_FMT_FATANY, media: 0, quick_format: FALSE, - cluster_align: 0, + skip_alignment: 0, info_level: 0 }; diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am index afd8605250..119774277b 100644 --- a/testsuites/libtests/Makefile.am +++ b/testsuites/libtests/Makefile.am @@ -1,6 +1,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = POSIX +SUBDIRS += sparsedisk01 SUBDIRS += block16 SUBDIRS += block15 SUBDIRS += block14 diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac index 83e22ed647..b8be927f47 100644 --- a/testsuites/libtests/configure.ac +++ b/testsuites/libtests/configure.ac @@ -43,6 +43,7 @@ AM_CONDITIONAL(HAS_POSIX,test x"${rtems_cv_RTEMS_POSIX_API}" = x"yes") # Explicitly list all Makefiles here AC_CONFIG_FILES([Makefile +sparsedisk01/Makefile block16/Makefile mghttpd01/Makefile block15/Makefile diff --git a/testsuites/libtests/sparsedisk01/Makefile.am b/testsuites/libtests/sparsedisk01/Makefile.am new file mode 100644 index 0000000000..3a836c84a7 --- /dev/null +++ b/testsuites/libtests/sparsedisk01/Makefile.am @@ -0,0 +1,19 @@ +rtems_tests_PROGRAMS = sparsedisk01 +sparsedisk01_SOURCES = init.c + +dist_rtems_tests_DATA = sparsedisk01.scn sparsedisk01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(sparsedisk01_OBJECTS) +LINK_LIBS = $(sparsedisk01_LDLIBS) + +sparsedisk01$(EXEEXT): $(sparsedisk01_OBJECTS) $(sparsedisk01_DEPENDENCIES) + @rm -f sparsedisk01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/libtests/sparsedisk01/init.c b/testsuites/libtests/sparsedisk01/init.c new file mode 100644 index 0000000000..fa386674aa --- /dev/null +++ b/testsuites/libtests/sparsedisk01/init.c @@ -0,0 +1,443 @@ +/* + * Copyright (c) 2012 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include <fcntl.h> +#include <rtems/blkdev.h> +#include "rtems/sparse-disk.h" + +#include "tmacros.h" + +/* Number of bytes for test pattern within a sparse disk container */ +#define STATIC_PATTERN_SIZE 4096 + +/* Block size used for the sparse disk in a sparse disk container */ +#define STATIC_BLOCK_SIZE 4096 + +/* Number of block allocated for the sparse disk in a sparse disk container */ +#define STATIC_ALLOCATED_BLOCK_COUNT 1 + +/* Blocks simulated by the sparse disk in a disk container */ +#define STATIC_SIMULATED_BLOCK_COUNT 4096 + +/* + * Container which cotains a sparse disk + memory for key table and data as would get + * allocated by rtems_sparse_disk_create() + memory for a memory test pattern + * By using this container white box testing of a sparse disk becomes possible + */ +typedef struct { + rtems_sparse_disk sparse_disk; + rtems_sparse_disk_key keytable[STATIC_ALLOCATED_BLOCK_COUNT]; + uint8_t data[STATIC_BLOCK_SIZE * STATIC_ALLOCATED_BLOCK_COUNT]; + uint8_t pattern[STATIC_PATTERN_SIZE]; +} sparse_disk_container; + +/* + * Black box test the disk parameters of a sparse disk + */ +static void test_disk_params( + const int file_descriptor, + const uint32_t block_size, + const uint32_t media_block_size, + const rtems_blkdev_bnum block_number ) +{ + int rv; + uint32_t value = 0; + rtems_disk_device *fd_dd = NULL; + rtems_blkdev_bnum block_count = 0; + + + rv = rtems_disk_fd_get_media_block_size( file_descriptor, &value ); + rtems_test_assert( 0 == rv ); + rtems_test_assert( media_block_size == value ); + + value = 0; + rv = rtems_disk_fd_get_block_size( file_descriptor, &value ); + rtems_test_assert( 0 == rv ); + rtems_test_assert( block_size == value ); + + block_count = 0; + rv = rtems_disk_fd_get_block_count( file_descriptor, &block_count ); + rtems_test_assert( 0 == rv ); + rtems_test_assert( block_number == block_count ); + + rv = rtems_disk_fd_get_disk_device( file_descriptor, &fd_dd ); + rtems_test_assert( 0 == rv ); + rtems_test_assert( NULL != fd_dd ); +} + +/* + * Verify that writing to a sparse disk delivers expected results + */ +static void test_writing( + const int file_descriptor, + const uint32_t block_size, + const rtems_blkdev_bnum blocks_allocated ) +{ + int rv; + rtems_blkdev_bnum block_count = 0; + unsigned int byte_count; + off_t file_pos; + uint8_t buff[block_size]; + + + /* Write a pattern to all allocated blocks */ + for ( block_count = 0; block_count < blocks_allocated; block_count++ ) { + file_pos = (off_t) block_count * block_size; + rv = lseek( file_descriptor, file_pos, SEEK_SET ); + rtems_test_assert( file_pos == rv ); + + rv = read( file_descriptor, buff, block_size ); + rtems_test_assert( block_size == rv ); + + for ( byte_count = 0; + byte_count < ( block_size / sizeof( byte_count ) ); + byte_count++ ) { + memcpy( buff + ( byte_count * sizeof( byte_count ) ), &byte_count, + sizeof( byte_count ) ); + } + + rv = lseek( file_descriptor, file_pos, SEEK_SET ); + rtems_test_assert( file_pos == rv ); + + rv = write( file_descriptor, buff, block_size ); + rtems_test_assert( block_size == rv ); + } +} + +/* + * Verify that black box reading for a sparse disk delivers expected results + */ +static void test_reading( + const int file_descriptor, + const uint32_t block_size, + const rtems_blkdev_bnum blocks_allocated, + const uint8_t fill_pattern ) +{ + int rv; + rtems_blkdev_bnum block_count = 0; + unsigned int byte_count; + off_t file_pos; + uint8_t buff[block_size]; + uint32_t value = 0; + + + rv = fsync( file_descriptor ); + rtems_test_assert( 0 == rv ); + + /* Read back the patterns */ + for ( block_count = 0; block_count < blocks_allocated; block_count++ ) { + file_pos = (off_t) block_count * block_size; + value = lseek( file_descriptor, file_pos, SEEK_SET ); + rtems_test_assert( file_pos == value ); + + rv = read( file_descriptor, &buff, block_size ); + rtems_test_assert( block_size <= rv ); + + for ( byte_count = 0; + byte_count < ( block_size / sizeof( byte_count ) ); + byte_count++ ) { + rv = memcmp( buff + ( byte_count * sizeof( byte_count ) ), + &byte_count, + sizeof( byte_count ) ); + rtems_test_assert( 0 == rv ); + } + } + + /* Try to read from unallocated block */ + file_pos = (off_t) block_count * block_size; + rv = lseek( file_descriptor, file_pos, SEEK_SET ); + rtems_test_assert( file_pos == rv ); + + rv = read( file_descriptor, buff, block_size ); + rtems_test_assert( block_size == rv ); + + for ( byte_count = 0; byte_count < block_size; ++byte_count ) + rtems_test_assert( fill_pattern == buff[byte_count] ); +} + +/* + * Do black box io testing on a sparse disk + */ +static void test_device_io( const char *device_name, + const uint32_t block_size, + const uint32_t media_block_size, + const rtems_blkdev_bnum block_number, + const rtems_blkdev_bnum blocks_allocated, + const uint8_t fill_pattern ) +{ + int rv; + int file_descriptor; + + + file_descriptor = open( device_name, O_RDWR ); + rtems_test_assert( 0 <= file_descriptor ); + + test_disk_params( + file_descriptor, + block_size, + media_block_size, + block_number + ); + + test_writing( + file_descriptor, + block_size, + blocks_allocated + ); + + test_reading( + file_descriptor, + block_size, + blocks_allocated, + fill_pattern + ); + + rv = close( file_descriptor ); + rtems_test_assert( 0 == rv ); +} + +/* + * In white box testing verify the key table of the sparse disk is correct + */ +static void test_static_key_table( + const sparse_disk_container *disk_container, + const rtems_blkdev_bnum blocks_allocated, + const uint32_t block_size ) +{ + unsigned int i; + + + for ( i = 0; i < blocks_allocated; ++i ) { + rtems_test_assert( i == disk_container->keytable[i].block ); + rtems_test_assert( + &disk_container->data[i * block_size] + == disk_container->keytable[i].data ); + } +} + +/* + * Verify the test pattern used in white box testing is as expected + */ +static void test_static_pattern( + const unsigned int pattern_size, + const uint8_t *pattern ) +{ + unsigned int i; + + + for ( i = 0; i < pattern_size; ++i ) + rtems_test_assert( ( (uint8_t) ( pattern_size - 1 - i ) ) == pattern[i] ); +} + +/* + * Read write testing with a statically allocated disk. Thus white box testing can be done + */ +static void test_with_whitebox( const char *device_name ) +{ + rtems_status_code sc; + int rv; + unsigned int i; + sparse_disk_container disk_container; + int file_descriptor; + rtems_blkdev_bnum block_count = 0; + unsigned int byte_count; + uint8_t fill_pattern = 0; + + + memset( disk_container.data, 0, sizeof( disk_container.data ) ); + memset( disk_container.keytable, 0, sizeof( disk_container.keytable ) ); + + for ( i = 0; i < STATIC_PATTERN_SIZE; ++i ) + disk_container.pattern[i] = (uint8_t) ( STATIC_PATTERN_SIZE - 1 - i ); + + sc = rtems_sparse_disk_register( + "/dev/sda1", + &disk_container.sparse_disk, + STATIC_BLOCK_SIZE, + STATIC_ALLOCATED_BLOCK_COUNT, + STATIC_SIMULATED_BLOCK_COUNT, + fill_pattern, + NULL + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + test_static_key_table( + &disk_container, + STATIC_ALLOCATED_BLOCK_COUNT, + STATIC_BLOCK_SIZE + ); + + for ( i = 0; i < ( STATIC_BLOCK_SIZE * STATIC_ALLOCATED_BLOCK_COUNT ); ++i ) + rtems_test_assert( 0 == disk_container.data[i] ); + + test_static_pattern( + STATIC_PATTERN_SIZE, + &disk_container.pattern[0] + ); + + file_descriptor = open( device_name, O_RDWR ); + rtems_test_assert( 0 <= file_descriptor ); + + test_disk_params( + file_descriptor, + STATIC_BLOCK_SIZE, + STATIC_BLOCK_SIZE, + STATIC_SIMULATED_BLOCK_COUNT + ); + + test_writing( + file_descriptor, + STATIC_BLOCK_SIZE, + STATIC_ALLOCATED_BLOCK_COUNT + ); + + test_reading( + file_descriptor, + STATIC_BLOCK_SIZE, + STATIC_ALLOCATED_BLOCK_COUNT, + fill_pattern + ); + + rv = close( file_descriptor ); + rtems_test_assert( 0 == rv ); + + test_static_key_table( + &disk_container, + STATIC_ALLOCATED_BLOCK_COUNT, + STATIC_BLOCK_SIZE + ); + + for ( block_count = 0; + block_count < STATIC_ALLOCATED_BLOCK_COUNT; + block_count++ ) { + for ( byte_count = 0; + byte_count < ( STATIC_BLOCK_SIZE / sizeof( byte_count ) ); + byte_count++ ) { + rv = memcmp( &disk_container.data[byte_count * sizeof( byte_count )], + &byte_count, + sizeof( byte_count ) ); + rtems_test_assert( 0 == rv ); + } + } + + test_static_pattern( + STATIC_PATTERN_SIZE, + &disk_container.pattern[0] + ); +} + +/* + * The test sequence + */ +static +void test( void ) +{ + rtems_status_code sc; + int rv; + char device_name[] = "/dev/sda1"; + uint32_t block_size; + rtems_blkdev_bnum block_number; + rtems_blkdev_bnum blocks_allocated; + int file_descriptor; + uint8_t fill_pattern = 0; + + + sc = rtems_disk_io_initialize(); + rtems_test_assert( sc == RTEMS_SUCCESSFUL ); + + block_size = 512; + block_number = 4 * 2 * 1024; + blocks_allocated = 8; + sc = rtems_sparse_disk_create_and_register( + "/dev/sda1", + block_size, + blocks_allocated, + block_number, + fill_pattern + ); + rtems_test_assert( RTEMS_SUCCESSFUL == sc ); + + /* Test reading and writing with sector size 512 and 8 such sectors + * allocated. Block size will default to 512 */ + test_device_io( + device_name, + block_size, + block_size, + block_number, + blocks_allocated, + fill_pattern + ); + + file_descriptor = open( device_name, O_RDWR ); + rtems_test_assert( 0 <= file_descriptor ); + + rv = rtems_disk_fd_set_block_size( file_descriptor, + blocks_allocated * block_size ); + rtems_test_assert( 0 == rv ); + + rv = close( file_descriptor ); + rtems_test_assert( 0 == rv ); + + /* Block size was increased to 4k. Thus all to allocated disk space + * corresponds to one block. Repeat the read write tests */ + test_device_io( + device_name, + block_size * blocks_allocated, + block_size, + block_number, + 1, + fill_pattern + ); + + rv = unlink( device_name ); + rtems_test_assert( 0 == rv ); + + /* Do testing with a statically allocated disk. This permits white box + * testing */ + test_with_whitebox( device_name ); +} + +static void Init( rtems_task_argument arg ) +{ + (void) arg; + puts( "\n\n*** TEST SPARSEDISK 1 ***" ); + + test(); + + puts( "*** END OF TEST SPARSEDISK 1 ***" ); + + rtems_test_exit( 0 ); +} + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_SEMAPHORES 1 + +#define CONFIGURE_INIT_TASK_STACK_SIZE ( 16 * 1024 ) + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h>
\ No newline at end of file diff --git a/testsuites/libtests/sparsedisk01/sparsedisk01.doc b/testsuites/libtests/sparsedisk01/sparsedisk01.doc new file mode 100644 index 0000000000..948c61cecc --- /dev/null +++ b/testsuites/libtests/sparsedisk01/sparsedisk01.doc @@ -0,0 +1,12 @@ +This file describes the directives and concepts tested by this test set. + +test set name: sparsedisk01 + +directives: + + - rtems_sparse_disk_create() + - rtems_sparse_disk_register() + +concepts: + + - Ensures that the sparse disk works. diff --git a/testsuites/libtests/sparsedisk01/sparsedisk01.scn b/testsuites/libtests/sparsedisk01/sparsedisk01.scn new file mode 100644 index 0000000000..2420aea516 --- /dev/null +++ b/testsuites/libtests/sparsedisk01/sparsedisk01.scn @@ -0,0 +1,2 @@ +*** TEST SPARSEDISK 1 *** +*** END OF TEST SPARSEDISK 1 *** diff --git a/testsuites/psxtests/psxsignal05/init.c b/testsuites/psxtests/psxsignal05/init.c index 1556a94118..04c78793f2 100644 --- a/testsuites/psxtests/psxsignal05/init.c +++ b/testsuites/psxtests/psxsignal05/init.c @@ -11,6 +11,8 @@ #include "config.h" #endif +#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ + #define TEST_NAME "05" #define TEST_STRING "User Signals" #define SIGNAL_ONE SIGUSR1 @@ -20,7 +22,7 @@ #include <signal.h> #include <errno.h> #include <errno.h> -#include <rtems/posix/psignal.h> +#include <rtems/posix/psignalimpl.h> /* forward declarations to avoid warnings */ void *POSIX_Init(void *argument); diff --git a/testsuites/sptests/spinternalerror01/init.c b/testsuites/sptests/spinternalerror01/init.c index f10b947222..a551af1484 100644 --- a/testsuites/sptests/spinternalerror01/init.c +++ b/testsuites/sptests/spinternalerror01/init.c @@ -25,7 +25,7 @@ #define FATAL_ERROR 0x600df00d -uint32_t boot_card( const char *cmdline ) +void boot_card( const char *cmdline ) { _Internal_error_Occurred( FATAL_SOURCE, FATAL_IS_INTERNAL, FATAL_ERROR ); |