From 93593d7306761163274a873d4aed882868c73bb9 Mon Sep 17 00:00:00 2001 From: guozhanxin Date: Thu, 22 Jul 2021 17:19:49 +0800 Subject: [PATCH] update to 3.1.5 --- .github/workflows/action.yml | 140 + .travis.yml | 125 - ChangeLog.md | 86 + bsp/qemu-vexpress-a9/applications/SConscript | 4 +- bsp/qemu-vexpress-a9/applications/lcd_init.c | 10 + bsp/qemu-vexpress-a9/applications/main.c | 10 + bsp/qemu-vexpress-a9/applications/mnt.c | 10 + bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c | 18 +- bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h | 72 +- .../drivers/audio/drv_pl041.c | 96 +- .../drivers/audio/drv_pl041.h | 94 +- .../drivers/audio/drv_sound.c | 16 +- .../drivers/audio/drv_sound.h | 4 +- bsp/qemu-vexpress-a9/drivers/board.c | 2 +- bsp/qemu-vexpress-a9/drivers/board.h | 8 +- bsp/qemu-vexpress-a9/drivers/drv_smc911x.c | 200 +- bsp/qemu-vexpress-a9/drivers/drv_smc911x.h | 708 +++-- bsp/qemu-vexpress-a9/drivers/drv_timer.c | 10 +- bsp/qemu-vexpress-a9/drivers/drv_timer.h | 2 +- bsp/qemu-vexpress-a9/drivers/secondary_cpu.c | 2 +- bsp/qemu-vexpress-a9/drivers/serial.c | 23 +- bsp/qemu-vexpress-a9/drivers/serial.h | 23 +- bsp/qemu-vexpress-a9/drivers/vexpress_a9.h | 2 +- bsp/qemu-vexpress-a9/rtconfig.h | 2 +- bsp/stm32/libraries/HAL_Drivers/SConscript | 8 + .../HAL_Drivers/config/f0/adc_config.h | 2 +- .../HAL_Drivers/config/f0/dma_config.h | 4 +- .../HAL_Drivers/config/f0/pwm_config.h | 2 +- .../HAL_Drivers/config/f0/spi_config.h | 6 +- .../HAL_Drivers/config/f0/tim_config.h | 2 +- .../HAL_Drivers/config/f0/uart_config.h | 4 +- .../HAL_Drivers/config/f1/adc_config.h | 8 +- .../HAL_Drivers/config/f1/dma_config.h | 2 +- .../config/f1/pulse_encoder_config.h | 2 +- .../HAL_Drivers/config/f1/pwm_config.h | 13 +- .../HAL_Drivers/config/f1/sdio_config.h | 2 +- .../HAL_Drivers/config/f1/spi_config.h | 8 +- .../HAL_Drivers/config/f1/tim_config.h | 2 +- .../HAL_Drivers/config/f1/uart_config.h | 2 +- .../HAL_Drivers/config/f1/usbd_config.h | 2 +- .../HAL_Drivers/config/f2/adc_config.h | 2 +- .../HAL_Drivers/config/f2/dma_config.h | 4 +- .../HAL_Drivers/config/f2/pwm_config.h | 2 +- .../HAL_Drivers/config/f2/sdio_config.h | 2 +- .../HAL_Drivers/config/f2/spi_config.h | 8 +- .../HAL_Drivers/config/f2/tim_config.h | 2 +- .../HAL_Drivers/config/f2/uart_config.h | 14 +- .../HAL_Drivers/config/f4/adc_config.h | 2 +- .../HAL_Drivers/config/f4/dma_config.h | 26 +- .../config/f4/pulse_encoder_config.h | 2 +- .../HAL_Drivers/config/f4/pwm_config.h | 13 +- .../HAL_Drivers/config/f4/qspi_config.h | 4 +- .../HAL_Drivers/config/f4/sdio_config.h | 2 +- .../HAL_Drivers/config/f4/spi_config.h | 12 +- .../HAL_Drivers/config/f4/tim_config.h | 13 +- .../HAL_Drivers/config/f4/uart_config.h | 18 +- .../HAL_Drivers/config/f4/usbd_config.h | 2 +- .../HAL_Drivers/config/f7/adc_config.h | 2 +- .../HAL_Drivers/config/f7/dma_config.h | 2 +- .../HAL_Drivers/config/f7/pwm_config.h | 2 +- .../HAL_Drivers/config/f7/qspi_config.h | 4 +- .../HAL_Drivers/config/f7/sdio_config.h | 2 +- .../HAL_Drivers/config/f7/spi_config.h | 12 +- .../HAL_Drivers/config/f7/tim_config.h | 2 +- .../HAL_Drivers/config/f7/uart_config.h | 6 +- .../HAL_Drivers/config/g0/adc_config.h | 2 +- .../HAL_Drivers/config/g0/dma_config.h | 2 +- .../HAL_Drivers/config/g0/pwm_config.h | 2 +- .../HAL_Drivers/config/g0/spi_config.h | 6 +- .../HAL_Drivers/config/g0/tim_config.h | 2 +- .../HAL_Drivers/config/g0/uart_config.h | 2 +- .../HAL_Drivers/config/g4/adc_config.h | 2 +- .../HAL_Drivers/config/g4/dma_config.h | 2 +- .../config/g4/pulse_encoder_config.h | 2 +- .../HAL_Drivers/config/g4/pwm_config.h | 2 +- .../HAL_Drivers/config/g4/qspi_config.h | 4 +- .../HAL_Drivers/config/g4/sdio_config.h | 2 +- .../HAL_Drivers/config/g4/spi_config.h | 12 +- .../HAL_Drivers/config/g4/tim_config.h | 2 +- .../HAL_Drivers/config/g4/uart_config.h | 12 +- .../HAL_Drivers/config/g4/usbd_config.h | 2 +- .../HAL_Drivers/config/h7/adc_config.h | 98 +- .../HAL_Drivers/config/h7/dma_config.h | 92 +- .../HAL_Drivers/config/h7/pwm_config.h | 2 +- .../HAL_Drivers/config/h7/qspi_config.h | 4 +- .../HAL_Drivers/config/h7/sdio_config.h | 2 +- .../HAL_Drivers/config/h7/spi_config.h | 12 +- .../HAL_Drivers/config/h7/tim_config.h | 2 +- .../HAL_Drivers/config/h7/uart_config.h | 67 +- .../HAL_Drivers/config/h7/usbd_config.h | 2 +- .../HAL_Drivers/config/l0/dma_config.h | 2 +- .../HAL_Drivers/config/l0/uart_config.h | 4 +- .../HAL_Drivers/config/l4/adc_config.h | 2 +- .../HAL_Drivers/config/l4/dma_config.h | 2 +- .../HAL_Drivers/config/l4/pwm_config.h | 2 +- .../HAL_Drivers/config/l4/qspi_config.h | 6 +- .../HAL_Drivers/config/l4/sdio_config.h | 2 +- .../HAL_Drivers/config/l4/spi_config.h | 2 +- .../HAL_Drivers/config/l4/tim_config.h | 2 +- .../HAL_Drivers/config/l4/uart_config.h | 44 +- .../HAL_Drivers/config/l4/usbd_config.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_adc.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_can.c | 29 +- bsp/stm32/libraries/HAL_Drivers/drv_can.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_common.c | 10 +- bsp/stm32/libraries/HAL_Drivers/drv_common.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_config.h | 6 +- bsp/stm32/libraries/HAL_Drivers/drv_dma.h | 9 +- bsp/stm32/libraries/HAL_Drivers/drv_eth.c | 10 +- bsp/stm32/libraries/HAL_Drivers/drv_eth.h | 2 +- .../HAL_Drivers/drv_flash/drv_flash.h | 2 +- .../HAL_Drivers/drv_flash/drv_flash_f0.c | 2 +- .../HAL_Drivers/drv_flash/drv_flash_f1.c | 80 +- .../HAL_Drivers/drv_flash/drv_flash_f2.c | 2 +- .../HAL_Drivers/drv_flash/drv_flash_f4.c | 60 +- .../HAL_Drivers/drv_flash/drv_flash_f7.c | 216 +- .../HAL_Drivers/drv_flash/drv_flash_l4.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_gpio.c | 388 +-- bsp/stm32/libraries/HAL_Drivers/drv_gpio.h | 28 +- bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c | 64 +- bsp/stm32/libraries/HAL_Drivers/drv_lcd.c | 9 +- .../libraries/HAL_Drivers/drv_lcd_mipi.c | 106 +- bsp/stm32/libraries/HAL_Drivers/drv_log.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_lptim.c | 11 +- bsp/stm32/libraries/HAL_Drivers/drv_lptim.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_pm.c | 4 +- .../libraries/HAL_Drivers/drv_pulse_encoder.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_pwm.c | 17 +- bsp/stm32/libraries/HAL_Drivers/drv_qspi.c | 4 +- bsp/stm32/libraries/HAL_Drivers/drv_qspi.h | 17 +- bsp/stm32/libraries/HAL_Drivers/drv_rtc.c | 51 +- bsp/stm32/libraries/HAL_Drivers/drv_sdio.c | 23 +- bsp/stm32/libraries/HAL_Drivers/drv_sdio.h | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_sdram.c | 2 +- .../libraries/HAL_Drivers/drv_soft_i2c.c | 8 +- .../libraries/HAL_Drivers/drv_soft_i2c.h | 8 +- bsp/stm32/libraries/HAL_Drivers/drv_spi.c | 47 +- bsp/stm32/libraries/HAL_Drivers/drv_spi.h | 18 +- bsp/stm32/libraries/HAL_Drivers/drv_usart.c | 296 +- bsp/stm32/libraries/HAL_Drivers/drv_usart.h | 6 +- bsp/stm32/libraries/HAL_Drivers/drv_usbd.c | 2 +- bsp/stm32/libraries/HAL_Drivers/drv_wdt.c | 8 +- bsp/stm32/libraries/Kconfig | 7 +- .../STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h | 1 - .../STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h | 1 - .../STM32F2xx_HAL_Driver/Inc/stm32f2xx_hal.h | 1 - .../STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h | 1 - .../STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h | 1 - .../STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h | 1 - .../Templates/gcc/startup_stm32g431xx.s | 6 +- .../Templates/gcc/startup_stm32g441xx.s | 6 +- .../Templates/gcc/startup_stm32g471xx.s | 6 +- .../Templates/gcc/startup_stm32g473xx.s | 6 +- .../Templates/gcc/startup_stm32g474xx.s | 6 +- .../Templates/gcc/startup_stm32g483xx.s | 6 +- .../Templates/gcc/startup_stm32g484xx.s | 6 +- .../Templates/gcc/startup_stm32gbk1cb.s | 4 +- .../STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h | 1 - .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h | 1 - .../STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h | 1 - .../templates/stm32f0xx/applications/main.c | 2 +- .../templates/stm32f0xx/board/board.c | 8 +- .../templates/stm32f0xx/board/board.h | 2 +- .../libraries/templates/stm32f0xx/rtconfig.h | 2 +- .../templates/stm32f10x/applications/main.c | 2 +- .../templates/stm32f10x/board/board.c | 8 +- .../templates/stm32f10x/board/board.h | 2 +- .../libraries/templates/stm32f10x/rtconfig.h | 2 +- .../templates/stm32f2xx/applications/main.c | 2 +- .../templates/stm32f2xx/board/board.c | 8 +- .../templates/stm32f2xx/board/board.h | 2 +- .../libraries/templates/stm32f2xx/rtconfig.h | 2 +- .../templates/stm32f4xx/applications/main.c | 2 +- .../templates/stm32f4xx/board/board.c | 8 +- .../templates/stm32f4xx/board/board.h | 2 +- .../libraries/templates/stm32f4xx/rtconfig.h | 2 +- .../templates/stm32f7xx/applications/main.c | 2 +- .../templates/stm32f7xx/board/board.c | 10 +- .../templates/stm32f7xx/board/board.h | 2 +- .../libraries/templates/stm32f7xx/rtconfig.h | 2 +- .../templates/stm32h7xx/applications/main.c | 8 +- .../templates/stm32h7xx/board/board.c | 14 +- .../templates/stm32h7xx/board/board.h | 2 +- .../libraries/templates/stm32h7xx/rtconfig.h | 2 +- .../templates/stm32l4xx/applications/main.c | 2 +- .../templates/stm32l4xx/board/board.c | 8 +- .../templates/stm32l4xx/board/board.h | 2 +- .../libraries/templates/stm32l4xx/rtconfig.h | 2 +- .../stm32f072-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f072-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32f072-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f072-st-nucleo/rtconfig.h | 2 +- .../stm32f091-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f091-st-nucleo/board/board.c | 10 +- bsp/stm32/stm32f091-st-nucleo/board/board.h | 2 +- .../stm32f091-st-nucleo/board/ports/fal_cfg.h | 2 +- bsp/stm32/stm32f091-st-nucleo/rtconfig.h | 2 +- .../stm32f103-atk-nano/applications/main.c | 2 +- bsp/stm32/stm32f103-atk-nano/board/board.c | 8 +- bsp/stm32/stm32f103-atk-nano/board/board.h | 2 +- .../stm32f103-atk-nano/board/ports/fal_cfg.h | 2 +- .../board/ports/spi_flash_init.c | 2 +- bsp/stm32/stm32f103-atk-nano/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f103-atk-warshipv3/board/board.c | 8 +- .../stm32f103-atk-warshipv3/board/board.h | 2 +- bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h | 2 +- .../stm32f103-dofly-M3S/applications/main.c | 2 +- .../applications/nrf24l01_init.c | 2 +- bsp/stm32/stm32f103-dofly-M3S/board/board.c | 8 +- bsp/stm32/stm32f103-dofly-M3S/board/board.h | 2 +- .../board/ports/drv_sdcard.c | 2 +- .../stm32f103-dofly-M3S/board/ports/fal_cfg.h | 2 +- .../board/ports/spi_flash_init.c | 2 +- bsp/stm32/stm32f103-dofly-M3S/rtconfig.h | 2 +- .../stm32f103-dofly-lyc8/applications/main.c | 2 +- bsp/stm32/stm32f103-dofly-lyc8/board/board.c | 8 +- bsp/stm32/stm32f103-dofly-lyc8/board/board.h | 2 +- bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h | 2 +- .../applications/main.c | 4 +- .../stm32f103-fire-arbitrary/board/board.c | 8 +- .../stm32f103-fire-arbitrary/board/board.h | 2 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/spi_flash_init.c | 2 +- .../board/ports/w5500_device.c | 2 +- bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f103-gizwits-gokitv21/board/board.c | 8 +- .../stm32f103-gizwits-gokitv21/board/board.h | 2 +- .../stm32f103-gizwits-gokitv21/rtconfig.h | 2 +- .../stm32f103-hw100k-ibox/applications/main.c | 2 +- bsp/stm32/stm32f103-hw100k-ibox/board/board.c | 8 +- bsp/stm32/stm32f103-hw100k-ibox/board/board.h | 2 +- .../board/ports/esp02_device.c | 4 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/on_chip_flash_init.c | 2 +- .../board/ports/w5500_device.c | 2 +- bsp/stm32/stm32f103-hw100k-ibox/rtconfig.h | 2 +- .../stm32f103-mini-system/applications/main.c | 2 +- bsp/stm32/stm32f103-mini-system/board/board.c | 8 +- bsp/stm32/stm32f103-mini-system/board/board.h | 2 +- bsp/stm32/stm32f103-mini-system/rtconfig.h | 2 +- .../stm32f103-yf-ufun/applications/main.c | 2 +- bsp/stm32/stm32f103-yf-ufun/board/board.c | 8 +- bsp/stm32/stm32f103-yf-ufun/board/board.h | 2 +- bsp/stm32/stm32f103-yf-ufun/rtconfig.h | 2 +- .../stm32f107-uc-eval/applications/main.c | 2 +- bsp/stm32/stm32f107-uc-eval/board/board.c | 2 +- bsp/stm32/stm32f107-uc-eval/board/board.h | 2 +- bsp/stm32/stm32f107-uc-eval/rtconfig.h | 2 +- .../stm32f401-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f401-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32f401-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f401-st-nucleo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f405-smdz-breadfruit/board/board.c | 8 +- .../stm32f405-smdz-breadfruit/board/board.h | 2 +- .../stm32f405-smdz-breadfruit/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f407-atk-explorer/board/board.c | 8 +- .../stm32f407-atk-explorer/board/board.h | 2 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/spi_flash_init.c | 2 +- bsp/stm32/stm32f407-atk-explorer/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f407-st-discovery/board/board.c | 8 +- .../stm32f407-st-discovery/board/board.h | 2 +- bsp/stm32/stm32f407-st-discovery/rtconfig.h | 2 +- .../stm32f411-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f411-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32f411-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f411-st-nucleo/rtconfig.h | 2 +- .../stm32f412-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f412-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32f412-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f412-st-nucleo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f427-robomaster-a/board/board.c | 10 +- .../stm32f427-robomaster-a/board/board.h | 2 +- .../board/ports/sdcard_port.c | 2 +- bsp/stm32/stm32f427-robomaster-a/rtconfig.h | 2 +- .../stm32f429-armfly-v6/applications/main.c | 8 +- bsp/stm32/stm32f429-armfly-v6/board/board.c | 14 +- bsp/stm32/stm32f429-armfly-v6/board/board.h | 2 +- .../board/ports/drv_ext_io.h | 178 +- .../stm32f429-armfly-v6/board/ports/fal_cfg.h | 2 +- .../board/ports/lcd_port.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- .../board/ports/spi_flash_init.c | 2 +- bsp/stm32/stm32f429-armfly-v6/rtconfig.h | 2 +- .../stm32f429-atk-apollo/applications/main.c | 2 +- bsp/stm32/stm32f429-atk-apollo/board/board.c | 10 +- bsp/stm32/stm32f429-atk-apollo/board/board.h | 2 +- .../board/ports/audio/drv_mic.c | 4 +- .../board/ports/audio/drv_mic.h | 8 +- .../board/ports/audio/drv_sound.c | 10 +- .../board/ports/audio/drv_sound.h | 12 +- .../board/ports/audio/drv_wm8978.c | 6 +- .../board/ports/audio/drv_wm8978.h | 2 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/phy_reset.c | 6 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- .../board/ports/spi_flash_init.c | 2 +- bsp/stm32/stm32f429-atk-apollo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f429-fire-challenger/board/board.c | 2 +- .../stm32f429-fire-challenger/board/board.h | 2 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/lcd_port.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- .../board/ports/spi_flash_init.c | 2 +- .../stm32f429-fire-challenger/rtconfig.h | 2 +- .../applications/lcd_init.c | 2 +- .../stm32f429-st-disco/applications/main.c | 2 +- bsp/stm32/stm32f429-st-disco/board/board.c | 8 +- bsp/stm32/stm32f429-st-disco/board/board.h | 2 +- .../stm32f429-st-disco/board/ports/fal_cfg.h | 6 +- .../board/ports/touch/drv_touch.c | 6 +- .../board/ports/touch/drv_touch.h | 2 +- bsp/stm32/stm32f429-st-disco/rtconfig.h | 2 +- .../stm32f446-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32f446-st-nucleo/board/board.c | 10 +- bsp/stm32/stm32f446-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32f446-st-nucleo/rtconfig.h | 2 +- .../applications/lcd_init.c | 2 +- .../stm32f469-st-disco/applications/main.c | 2 +- bsp/stm32/stm32f469-st-disco/board/board.c | 10 +- bsp/stm32/stm32f469-st-disco/board/board.h | 2 +- .../board/ports/drv_otm8009a.c | 20 +- .../board/ports/drv_qspi_flash.c | 6 +- .../board/ports/drv_sdcard.c | 12 +- .../stm32f469-st-disco/board/ports/fal_cfg.h | 6 +- .../stm32f469-st-disco/board/ports/lcd_port.h | 14 +- .../stm32f469-st-disco/board/ports/qspi_mnt.c | 2 +- .../board/ports/sdram_port.h | 2 +- .../board/ports/touch/drv_touch.c | 6 +- .../board/ports/touch/drv_touch.h | 4 +- .../board/ports/touch/drv_touch_ft.c | 10 +- bsp/stm32/stm32f469-st-disco/rtconfig.h | 2 +- .../stm32f746-st-disco/applications/main.c | 2 +- bsp/stm32/stm32f746-st-disco/board/board.c | 12 +- bsp/stm32/stm32f746-st-disco/board/board.h | 2 +- .../board/ports/drv_qspi_flash.c | 6 +- .../stm32f746-st-disco/board/ports/fal_cfg.h | 2 +- .../stm32f746-st-disco/board/ports/lcd_port.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- bsp/stm32/stm32f746-st-disco/rtconfig.h | 2 +- .../stm32f767-atk-apollo/applications/main.c | 2 +- bsp/stm32/stm32f767-atk-apollo/board/board.c | 12 +- bsp/stm32/stm32f767-atk-apollo/board/board.h | 2 +- .../board/ports/drv_qspi_flash.c | 6 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/lcd_port.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- bsp/stm32/stm32f767-atk-apollo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32f767-fire-challenger/board/board.c | 10 +- .../stm32f767-fire-challenger/board/board.h | 2 +- .../board/ports/drv_qspi_flash.c | 6 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/lcd_port.h | 2 +- .../board/ports/phy_reset.c | 2 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sdram_port.h | 2 +- .../stm32f767-fire-challenger/rtconfig.h | 2 +- .../stm32f767-st-nucleo/applications/main.c | 4 +- bsp/stm32/stm32f767-st-nucleo/board/board.c | 12 +- bsp/stm32/stm32f767-st-nucleo/board/board.h | 2 +- .../board/ports/phy_reset.c | 4 +- bsp/stm32/stm32f767-st-nucleo/rtconfig.h | 2 +- .../stm32f769-st-disco/applications/main.c | 2 +- bsp/stm32/stm32f769-st-disco/board/board.c | 12 +- bsp/stm32/stm32f769-st-disco/board/board.h | 2 +- bsp/stm32/stm32f769-st-disco/rtconfig.h | 2 +- .../stm32g071-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32g071-st-nucleo/board/board.c | 10 +- bsp/stm32/stm32g071-st-nucleo/board/board.h | 2 +- .../stm32g071-st-nucleo/board/ports/fal_cfg.h | 2 +- bsp/stm32/stm32g071-st-nucleo/rtconfig.h | 2 +- .../stm32g431-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32g431-st-nucleo/board/board.c | 10 +- bsp/stm32/stm32g431-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32g431-st-nucleo/rtconfig.h | 2 +- .../stm32h743-atk-apollo/applications/main.c | 8 +- bsp/stm32/stm32h743-atk-apollo/board/board.c | 14 +- bsp/stm32/stm32h743-atk-apollo/board/board.h | 4 +- .../stm32h743-atk-apollo/board/drv_mpu.c | 2 +- .../board/ports/drv_qspi_flash.c | 6 +- .../board/ports/lcd_port.h | 2 +- .../board/ports/sdram_port.h | 2 +- bsp/stm32/stm32h743-atk-apollo/rtconfig.h | 2 +- .../stm32h743-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32h743-st-nucleo/board/board.c | 2 +- bsp/stm32/stm32h743-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32h743-st-nucleo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32h750-armfly-h7-tool/board/board.c | 12 +- .../stm32h750-armfly-h7-tool/board/board.h | 2 +- bsp/stm32/stm32h750-armfly-h7-tool/rtconfig.h | 2 +- .../stm32l053-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32l053-st-nucleo/board/board.c | 12 +- bsp/stm32/stm32l053-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l053-st-nucleo/rtconfig.h | 2 +- .../stm32l432-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32l432-st-nucleo/board/board.c | 16 +- bsp/stm32/stm32l432-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l432-st-nucleo/rtconfig.h | 2 +- .../stm32l452-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32l452-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32l452-st-nucleo/board/board.h | 2 +- .../stm32l452-st-nucleo/board/ports/fal_cfg.h | 6 +- bsp/stm32/stm32l452-st-nucleo/rtconfig.h | 2 +- .../stm32l475-atk-pandora/applications/main.c | 2 +- .../applications/nrf24l01_init.c | 2 +- bsp/stm32/stm32l475-atk-pandora/board/board.c | 16 +- bsp/stm32/stm32l475-atk-pandora/board/board.h | 2 +- .../board/ports/audio/drv_es8388.c | 4 +- .../board/ports/audio/drv_es8388.h | 4 +- .../board/ports/audio/drv_mic.c | 4 +- .../board/ports/audio/drv_sound.c | 4 +- .../board/ports/audio/drv_sound.h | 4 +- .../board/ports/drv_lcd.c | 4 +- .../board/ports/drv_lcd.h | 4 +- .../board/ports/drv_qspi_flash.c | 6 +- .../board/ports/fal_cfg.h | 12 +- .../board/ports/sdcard_port.c | 2 +- .../board/ports/sensor_port.c | 2 +- bsp/stm32/stm32l475-atk-pandora/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32l475-st-discovery/board/board.c | 8 +- .../stm32l475-st-discovery/board/board.h | 2 +- bsp/stm32/stm32l475-st-discovery/rtconfig.h | 2 +- .../stm32l476-st-nucleo/applications/main.c | 2 +- bsp/stm32/stm32l476-st-nucleo/board/board.c | 2 +- bsp/stm32/stm32l476-st-nucleo/board/board.h | 2 +- bsp/stm32/stm32l476-st-nucleo/rtconfig.h | 2 +- .../applications/main.c | 2 +- .../stm32l496-ali-developer/board/board.c | 16 +- .../stm32l496-ali-developer/board/board.h | 2 +- .../board/ports/drv_spi_lcd.c | 4 +- .../board/ports/fal_cfg.h | 2 +- .../board/ports/sdcard_port.c | 2 +- bsp/stm32/stm32l496-ali-developer/rtconfig.h | 2 +- .../stm32l4r5-st-nucleo/applications/main.c | 6 +- bsp/stm32/stm32l4r5-st-nucleo/board/board.c | 8 +- bsp/stm32/stm32l4r5-st-nucleo/board/board.h | 4 +- bsp/stm32/stm32l4r5-st-nucleo/rtconfig.h | 2 +- .../stm32l4r9-st-eval/applications/main.c | 4 +- bsp/stm32/stm32l4r9-st-eval/board/board.c | 10 +- bsp/stm32/stm32l4r9-st-eval/board/board.h | 4 +- .../board/ports/drv_lcd_dsi.c | 24 +- .../stm32l4r9-st-eval/board/ports/drv_sram.c | 2 +- .../stm32l4r9-st-eval/board/ports/drv_touch.c | 2 +- .../board/ports/drv_touch_ft.c | 8 +- .../board/ports/include/drv_touch.h | 2 +- .../board/ports/include/lcd_port_dsi.h | 2 +- .../board/ports/include/sram_port.h | 2 +- bsp/stm32/stm32l4r9-st-eval/rtconfig.h | 2 +- components/cplusplus/Lock.h | 2 +- components/cplusplus/Mail.h | 2 +- components/cplusplus/Mutex.h | 2 +- components/cplusplus/Queue.h | 2 +- components/cplusplus/Semaphore.h | 2 +- components/cplusplus/Thread.h | 2 +- components/cplusplus/crt.h | 2 +- components/cplusplus/crt_init.c | 2 +- .../cplusplus/{Mutex.cpp => cxx_Mutex.cpp} | 2 +- .../{Semaphore.cpp => cxx_Semaphore.cpp} | 2 +- .../cplusplus/{Thread.cpp => cxx_Thread.cpp} | 2 +- components/cplusplus/{crt.cpp => cxx_crt.cpp} | 2 +- components/dfs/Kconfig | 37 - components/dfs/filesystems/devfs/devfs.c | 8 +- components/dfs/filesystems/devfs/devfs.h | 2 +- components/dfs/filesystems/elmfat/dfs_elm.c | 2 +- components/dfs/filesystems/elmfat/dfs_elm.h | 2 +- components/dfs/filesystems/jffs2/SConscript | 50 - .../filesystems/jffs2/cyg/compress/ChangeLog | 218 -- .../jffs2/cyg/compress/cdl/compress_zlib.cdl | 170 -- .../jffs2/cyg/compress/include/zconf.h | 349 --- .../jffs2/cyg/compress/include/zlib.h | 1358 --------- .../jffs2/cyg/compress/src/ChangeLog | 854 ------ .../filesystems/jffs2/cyg/compress/src/FAQ | 339 --- .../filesystems/jffs2/cyg/compress/src/INDEX | 51 - .../jffs2/cyg/compress/src/Make_vms.com | 461 --- .../jffs2/cyg/compress/src/Makefile | 154 - .../jffs2/cyg/compress/src/Makefile.in | 154 - .../jffs2/cyg/compress/src/Makefile.riscos | 151 - .../filesystems/jffs2/cyg/compress/src/README | 125 - .../jffs2/cyg/compress/src/README.eCos | 27 - .../jffs2/cyg/compress/src/adler32.c | 153 - .../jffs2/cyg/compress/src/algorithm.txt | 209 -- .../jffs2/cyg/compress/src/compress.c | 83 - .../jffs2/cyg/compress/src/configure | 459 --- .../jffs2/cyg/compress/src/deflate.c | 1736 ----------- .../jffs2/cyg/compress/src/deflate.h | 331 --- .../jffs2/cyg/compress/src/descrip.mms | 48 - .../jffs2/cyg/compress/src/example.c | 565 ---- .../filesystems/jffs2/cyg/compress/src/gzio.c | 1026 ------- .../jffs2/cyg/compress/src/infback.c | 623 ---- .../jffs2/cyg/compress/src/infblock.c | 403 --- .../jffs2/cyg/compress/src/infblock.h | 39 - .../jffs2/cyg/compress/src/inffast.c | 318 --- .../jffs2/cyg/compress/src/inffast.h | 11 - .../jffs2/cyg/compress/src/inffixed.h | 94 - .../jffs2/cyg/compress/src/inflate.c | 1368 --------- .../jffs2/cyg/compress/src/inflate.h | 115 - .../jffs2/cyg/compress/src/inftrees.c | 329 --- .../jffs2/cyg/compress/src/inftrees.h | 55 - .../jffs2/cyg/compress/src/infutil.c | 87 - .../jffs2/cyg/compress/src/infutil.h | 98 - .../jffs2/cyg/compress/src/maketree.c | 85 - .../jffs2/cyg/compress/src/minigzip.c | 322 --- .../jffs2/cyg/compress/src/trees.c | 1219 -------- .../jffs2/cyg/compress/src/trees.h | 128 - .../jffs2/cyg/compress/src/uncompr.c | 65 - .../filesystems/jffs2/cyg/compress/src/zlib.3 | 159 -- .../jffs2/cyg/compress/src/zutil.c | 318 --- .../jffs2/cyg/compress/src/zutil.h | 276 -- .../jffs2/cyg/compress/tests/zlib1.c | 232 -- .../jffs2/cyg/compress/tests/zlib2.c | 307 -- .../filesystems/jffs2/cyg/compress/zconf.h | 358 --- .../dfs/filesystems/jffs2/cyg/compress/zlib.h | 1358 --------- .../dfs/filesystems/jffs2/cyg/crc/crc.h | 105 - .../dfs/filesystems/jffs2/cyg/crc/crc16.c | 104 - .../dfs/filesystems/jffs2/cyg/crc/crc32.c | 166 -- .../dfs/filesystems/jffs2/cyg/crc/posix_crc.c | 116 - .../dfs/filesystems/jffs2/cyg/fileio/fileio.h | 489 ---- .../dfs/filesystems/jffs2/cyg/hal/basetype.h | 91 - .../dfs/filesystems/jffs2/cyg/hal/drv_api.h | 250 -- .../filesystems/jffs2/cyg/infra/cyg_type.h | 544 ---- components/dfs/filesystems/jffs2/dfs_jffs2.c | 687 ----- components/dfs/filesystems/jffs2/dfs_jffs2.h | 14 - .../filesystems/jffs2/include/linux/jffs2.h | 229 -- .../jffs2/include/linux/jffs2_fs_i.h | 50 - .../jffs2/include/linux/jffs2_fs_sb.h | 120 - .../filesystems/jffs2/include/port/codes.h | 99 - .../filesystems/jffs2/include/port/fcntl.h | 31 - .../filesystems/jffs2/include/port/sys/stat.h | 294 -- .../jffs2/include/port/sys/types.h | 90 - .../dfs/filesystems/jffs2/jffs2_config.h | 53 - .../dfs/filesystems/jffs2/kernel/asm/atomic.h | 10 - .../dfs/filesystems/jffs2/kernel/asm/bug.h | 6 - .../dfs/filesystems/jffs2/kernel/asm/page.h | 12 - .../filesystems/jffs2/kernel/asm/semaphore.h | 120 - .../dfs/filesystems/jffs2/kernel/linux/TODO | 11 - .../filesystems/jffs2/kernel/linux/compiler.h | 7 - .../jffs2/kernel/linux/completion.h | 13 - .../filesystems/jffs2/kernel/linux/config.h | 12 - .../filesystems/jffs2/kernel/linux/crc32.h | 8 - .../filesystems/jffs2/kernel/linux/errno.h | 2 - .../dfs/filesystems/jffs2/kernel/linux/fs.h | 6 - .../dfs/filesystems/jffs2/kernel/linux/init.h | 3 - .../filesystems/jffs2/kernel/linux/kernel.h | 38 - .../dfs/filesystems/jffs2/kernel/linux/list.h | 147 - .../jffs2/kernel/linux/mtd/compatmac.h | 5 - .../filesystems/jffs2/kernel/linux/mtd/mtd.h | 5 - .../filesystems/jffs2/kernel/linux/pagemap.h | 19 - .../filesystems/jffs2/kernel/linux/rbtree.h | 62 - .../filesystems/jffs2/kernel/linux/rwsem.h | 20 - .../filesystems/jffs2/kernel/linux/sched.h | 7 - .../dfs/filesystems/jffs2/kernel/linux/slab.h | 14 - .../filesystems/jffs2/kernel/linux/spinlock.h | 43 - .../dfs/filesystems/jffs2/kernel/linux/stat.h | 12 - .../filesystems/jffs2/kernel/linux/string.h | 6 - .../filesystems/jffs2/kernel/linux/timer.h | 15 - .../filesystems/jffs2/kernel/linux/types.h | 9 - .../filesystems/jffs2/kernel/linux/version.h | 6 - .../filesystems/jffs2/kernel/linux/vmalloc.h | 3 - .../dfs/filesystems/jffs2/kernel/linux/wait.h | 21 - .../jffs2/kernel/linux/workqueue.h | 18 - .../dfs/filesystems/jffs2/kernel/linux/zlib.h | 15 - .../filesystems/jffs2/kernel/linux/zutil.h | 6 - .../dfs/filesystems/jffs2/kernel/rbtree.c | 408 --- components/dfs/filesystems/jffs2/porting.c | 29 - components/dfs/filesystems/jffs2/porting.h | 51 - components/dfs/filesystems/jffs2/src/LICENCE | 35 - components/dfs/filesystems/jffs2/src/build.c | 371 --- components/dfs/filesystems/jffs2/src/compr.c | 457 --- components/dfs/filesystems/jffs2/src/compr.h | 107 - .../dfs/filesystems/jffs2/src/compr_rtime.c | 156 - .../dfs/filesystems/jffs2/src/compr_rubin.c | 427 --- .../dfs/filesystems/jffs2/src/compr_rubin.h | 21 - .../dfs/filesystems/jffs2/src/compr_zlib.c | 246 -- components/dfs/filesystems/jffs2/src/debug.c | 711 ----- components/dfs/filesystems/jffs2/src/debug.h | 276 -- .../dfs/filesystems/jffs2/src/dir-ecos.c | 369 --- components/dfs/filesystems/jffs2/src/dir.txt | 70 - components/dfs/filesystems/jffs2/src/erase.c | 469 --- .../dfs/filesystems/jffs2/src/flashio.c | 151 - .../dfs/filesystems/jffs2/src/fs-ecos.c | 2174 -------------- components/dfs/filesystems/jffs2/src/gc.c | 1271 --------- .../dfs/filesystems/jffs2/src/gcthread.c | 252 -- components/dfs/filesystems/jffs2/src/histo.h | 3 - .../dfs/filesystems/jffs2/src/histo_mips.h | 2 - .../dfs/filesystems/jffs2/src/malloc-ecos.c | 163 -- .../dfs/filesystems/jffs2/src/nodelist.c | 534 ---- .../dfs/filesystems/jffs2/src/nodelist.h | 415 --- .../dfs/filesystems/jffs2/src/nodemgmt.c | 680 ----- .../dfs/filesystems/jffs2/src/os-ecos.h | 265 -- .../dfs/filesystems/jffs2/src/os-rtthread.h | 263 -- .../dfs/filesystems/jffs2/src/pushpull.h | 72 - components/dfs/filesystems/jffs2/src/read.c | 223 -- .../dfs/filesystems/jffs2/src/readinode.c | 895 ------ components/dfs/filesystems/jffs2/src/scan.c | 946 ------ components/dfs/filesystems/jffs2/src/write.c | 702 ----- components/dfs/filesystems/nfs/dfs_nfs.c | 2 +- components/dfs/filesystems/nfs/dfs_nfs.h | 2 +- components/dfs/filesystems/nfs/mount.h | 84 +- components/dfs/filesystems/nfs/mount_clnt.c | 62 +- components/dfs/filesystems/nfs/mount_xdr.c | 126 +- components/dfs/filesystems/nfs/nfs.h | 866 +++--- components/dfs/filesystems/nfs/nfs_auth.c | 2 +- components/dfs/filesystems/nfs/nfs_clnt.c | 222 +- components/dfs/filesystems/nfs/nfs_xdr.c | 1900 ++++++------- components/dfs/filesystems/nfs/rpc/auth.h | 102 +- .../dfs/filesystems/nfs/rpc/auth_none.c | 98 +- components/dfs/filesystems/nfs/rpc/clnt.h | 240 +- .../dfs/filesystems/nfs/rpc/clnt_generic.c | 2 +- components/dfs/filesystems/nfs/rpc/clnt_udp.c | 544 ++-- components/dfs/filesystems/nfs/rpc/pmap.c | 70 +- components/dfs/filesystems/nfs/rpc/pmap.h | 58 +- components/dfs/filesystems/nfs/rpc/rpc.h | 12 +- components/dfs/filesystems/nfs/rpc/rpc_msg.h | 152 +- components/dfs/filesystems/nfs/rpc/rpc_prot.c | 264 +- components/dfs/filesystems/nfs/rpc/types.h | 2 +- components/dfs/filesystems/nfs/rpc/xdr.c | 830 +++--- components/dfs/filesystems/nfs/rpc/xdr.h | 174 +- components/dfs/filesystems/nfs/rpc/xdr_mem.c | 68 +- components/dfs/filesystems/ramfs/dfs_ramfs.c | 2 +- components/dfs/filesystems/ramfs/dfs_ramfs.h | 2 +- components/dfs/filesystems/romfs/dfs_romfs.c | 4 +- components/dfs/filesystems/romfs/dfs_romfs.h | 2 +- components/dfs/filesystems/romfs/romfs.c | 2 +- .../dfs/filesystems/skeleton/skeleton.c | 2 +- .../dfs/filesystems/skeleton/skeleton.h | 2 +- components/dfs/filesystems/uffs/AUTHORS | 1 - .../dfs/filesystems/uffs/CMakeLists.txt | 27 - components/dfs/filesystems/uffs/COPYING | 339 --- components/dfs/filesystems/uffs/Doxyfile | 275 -- components/dfs/filesystems/uffs/README | 275 -- components/dfs/filesystems/uffs/SConscript | 38 - components/dfs/filesystems/uffs/TODO | 5 - components/dfs/filesystems/uffs/dfs_uffs.c | 660 ----- components/dfs/filesystems/uffs/dfs_uffs.h | 89 - .../uffs/doc/Understanding-UFFS.odp | Bin 369408 -> 0 bytes .../uffs/doc/Understanding-UFFS.pdf | Bin 326206 -> 0 bytes .../uffs/doc/uffs-serial-num-relationship.JPG | Bin 26858 -> 0 bytes .../dfs/filesystems/uffs/src/CMakeLists.txt | 7 - .../filesystems/uffs/src/emu/CMakeLists.txt | 24 - .../dfs/filesystems/uffs/src/emu/cmdline.c | 643 ----- .../dfs/filesystems/uffs/src/emu/cmdline.h | 83 - .../filesystems/uffs/src/emu/helper_cmds.c | 694 ----- .../dfs/filesystems/uffs/src/emu/test_cmds.c | 1186 -------- .../filesystems/uffs/src/emu/uffs_fileem.c | 113 - .../filesystems/uffs/src/emu/uffs_fileem.h | 88 - .../uffs/src/emu/uffs_fileem_ecc_hw.c | 236 -- .../uffs/src/emu/uffs_fileem_ecc_hw_auto.c | 356 --- .../uffs/src/emu/uffs_fileem_ecc_soft.c | 212 -- .../uffs/src/emu/uffs_fileem_share.c | 232 -- .../uffs/src/emu/uffs_fileem_wrap.c | 311 -- .../uffs/src/example/CMakeLists.txt | 22 - .../src/example/flash-interface-example.c | 434 --- .../uffs/src/example/static-mem-allocate.c | 163 -- .../dfs/filesystems/uffs/src/inc/uffs/uffs.h | 101 - .../uffs/src/inc/uffs/uffs_badblock.h | 75 - .../uffs/src/inc/uffs/uffs_blockinfo.h | 107 - .../filesystems/uffs/src/inc/uffs/uffs_buf.h | 178 -- .../filesystems/uffs/src/inc/uffs/uffs_core.h | 59 - .../filesystems/uffs/src/inc/uffs/uffs_crc.h | 46 - .../uffs/src/inc/uffs/uffs_device.h | 211 -- .../filesystems/uffs/src/inc/uffs/uffs_ecc.h | 89 - .../filesystems/uffs/src/inc/uffs/uffs_fd.h | 151 - .../filesystems/uffs/src/inc/uffs/uffs_find.h | 76 - .../uffs/src/inc/uffs/uffs_flash.h | 311 -- .../filesystems/uffs/src/inc/uffs/uffs_fs.h | 138 - .../filesystems/uffs/src/inc/uffs/uffs_mem.h | 83 - .../filesystems/uffs/src/inc/uffs/uffs_mtb.h | 96 - .../filesystems/uffs/src/inc/uffs/uffs_os.h | 75 - .../filesystems/uffs/src/inc/uffs/uffs_pool.h | 94 - .../uffs/src/inc/uffs/uffs_public.h | 336 --- .../filesystems/uffs/src/inc/uffs/uffs_tree.h | 237 -- .../uffs/src/inc/uffs/uffs_types.h | 160 -- .../uffs/src/inc/uffs/uffs_utils.h | 64 - .../uffs/src/inc/uffs/uffs_version.h | 55 - .../uffs/src/platform/CMakeLists.txt | 13 - .../uffs/src/platform/posix/uffs_config.h | 322 --- .../uffs/src/platform/posix/uffs_os.c | 148 - .../uffs/src/platform/win32/uffs_config.h | 317 --- .../uffs/src/platform/win32/uffs_os.c | 148 - .../filesystems/uffs/src/uffs/CMakeLists.txt | 59 - .../filesystems/uffs/src/uffs/uffs_badblock.c | 249 -- .../uffs/src/uffs/uffs_blockinfo.c | 413 --- .../dfs/filesystems/uffs/src/uffs/uffs_buf.c | 1799 ------------ .../dfs/filesystems/uffs/src/uffs/uffs_crc.c | 93 - .../filesystems/uffs/src/uffs/uffs_debug.c | 188 -- .../filesystems/uffs/src/uffs/uffs_device.c | 93 - .../dfs/filesystems/uffs/src/uffs/uffs_ecc.c | 384 --- .../dfs/filesystems/uffs/src/uffs/uffs_fd.c | 746 ----- .../dfs/filesystems/uffs/src/uffs/uffs_find.c | 378 --- .../filesystems/uffs/src/uffs/uffs_flash.c | 1034 ------- .../dfs/filesystems/uffs/src/uffs/uffs_fs.c | 1944 ------------- .../dfs/filesystems/uffs/src/uffs/uffs_init.c | 204 -- .../dfs/filesystems/uffs/src/uffs/uffs_mem.c | 92 - .../dfs/filesystems/uffs/src/uffs/uffs_mtb.c | 366 --- .../dfs/filesystems/uffs/src/uffs/uffs_pool.c | 386 --- .../filesystems/uffs/src/uffs/uffs_public.c | 448 --- .../dfs/filesystems/uffs/src/uffs/uffs_tree.c | 1278 --------- .../filesystems/uffs/src/uffs/uffs_utils.c | 402 --- .../filesystems/uffs/src/uffs/uffs_version.c | 73 - .../filesystems/uffs/src/utils/CMakeLists.txt | 20 - .../dfs/filesystems/uffs/src/utils/mkuffs.c | 493 ---- .../uffs/tools/chomp_uffs_perror.rb | 25 - .../dfs/filesystems/uffs/tools/format_code.rb | 24 - .../filesystems/uffs/tools/make_package.sh | 3 - components/dfs/filesystems/uffs/uffs_config.h | 322 --- components/dfs/filesystems/uffs/uffs_nandif.c | 359 --- .../dfs/filesystems/uffs/uffs_rtthread.c | 158 - components/dfs/include/dfs.h | 3 +- components/dfs/include/dfs_file.h | 2 +- components/dfs/include/dfs_fs.h | 2 +- components/dfs/include/dfs_poll.h | 2 +- components/dfs/include/dfs_posix.h | 2 +- components/dfs/include/dfs_private.h | 2 +- components/dfs/include/dfs_select.h | 2 +- components/dfs/src/dfs.c | 3 +- components/dfs/src/dfs_file.c | 4 +- components/dfs/src/dfs_fs.c | 16 +- components/dfs/src/dfs_posix.c | 2 +- components/dfs/src/poll.c | 22 +- components/dfs/src/select.c | 4 +- components/drivers/Kconfig | 21 +- components/drivers/audio/audio.c | 16 +- components/drivers/audio/audio_pipe.c | 4 +- components/drivers/audio/audio_pipe.h | 7 +- components/drivers/can/can.c | 3 +- components/drivers/cputime/cputime.c | 10 +- components/drivers/cputime/cputime_cortexm.c | 12 +- components/drivers/hwcrypto/hw_bignum.c | 36 +- components/drivers/hwcrypto/hw_bignum.h | 34 +- components/drivers/hwcrypto/hw_crc.c | 10 +- components/drivers/hwcrypto/hw_crc.h | 6 +- components/drivers/hwcrypto/hw_gcm.c | 2 +- components/drivers/hwcrypto/hw_gcm.h | 2 +- components/drivers/hwcrypto/hw_hash.c | 2 +- components/drivers/hwcrypto/hw_hash.h | 2 +- components/drivers/hwcrypto/hw_rng.c | 4 +- components/drivers/hwcrypto/hw_rng.h | 4 +- components/drivers/hwcrypto/hw_symmetric.c | 4 +- components/drivers/hwcrypto/hw_symmetric.h | 2 +- components/drivers/hwcrypto/hwcrypto.c | 2 +- components/drivers/hwcrypto/hwcrypto.h | 2 +- components/drivers/hwtimer/hwtimer.c | 14 +- components/drivers/i2c/i2c-bit-ops.c | 16 +- components/drivers/i2c/i2c_core.c | 2 +- components/drivers/i2c/i2c_dev.c | 6 +- components/drivers/include/drivers/adc.h | 2 +- components/drivers/include/drivers/alarm.h | 11 +- components/drivers/include/drivers/audio.h | 2 +- components/drivers/include/drivers/can.h | 2 +- components/drivers/include/drivers/cputime.h | 2 +- components/drivers/include/drivers/crypto.h | 2 +- components/drivers/include/drivers/hwtimer.h | 4 +- .../drivers/include/drivers/i2c-bit-ops.h | 2 +- components/drivers/include/drivers/i2c.h | 14 +- components/drivers/include/drivers/i2c_dev.h | 2 +- components/drivers/include/drivers/mmc.h | 258 +- .../drivers/include/drivers/mmcsd_card.h | 194 +- .../drivers/include/drivers/mmcsd_cmd.h | 12 +- .../drivers/include/drivers/mmcsd_core.h | 282 +- .../drivers/include/drivers/mmcsd_host.h | 156 +- components/drivers/include/drivers/mtd_nand.h | 2 +- components/drivers/include/drivers/mtd_nor.h | 40 +- components/drivers/include/drivers/pin.h | 2 +- components/drivers/include/drivers/pm.h | 2 +- .../drivers/include/drivers/pulse_encoder.h | 2 +- .../drivers/include/drivers/rt_drv_pwm.h | 2 +- .../drivers/include/drivers/rt_inputcapture.h | 4 +- components/drivers/include/drivers/rtc.h | 2 +- components/drivers/include/drivers/sd.h | 2 +- components/drivers/include/drivers/sdio.h | 14 +- .../drivers/include/drivers/sdio_func_ids.h | 4 +- components/drivers/include/drivers/serial.h | 6 +- components/drivers/include/drivers/spi.h | 28 +- .../drivers/include/drivers/usb_common.h | 36 +- .../drivers/include/drivers/usb_device.h | 16 +- components/drivers/include/drivers/usb_host.h | 38 +- components/drivers/include/drivers/watchdog.h | 2 +- components/drivers/include/drivers/wlan.h | 2 +- components/drivers/include/ipc/completion.h | 2 +- components/drivers/include/ipc/dataqueue.h | 18 +- components/drivers/include/ipc/pipe.h | 2 +- components/drivers/include/ipc/poll.h | 2 +- components/drivers/include/ipc/ringblk_buf.h | 2 +- components/drivers/include/ipc/ringbuffer.h | 3 +- components/drivers/include/ipc/waitqueue.h | 4 +- components/drivers/include/ipc/workqueue.h | 2 +- components/drivers/include/rtdevice.h | 2 +- components/drivers/misc/adc.c | 2 +- components/drivers/misc/pin.c | 2 +- components/drivers/misc/pulse_encoder.c | 2 +- components/drivers/misc/rt_drv_pwm.c | 2 +- components/drivers/misc/rt_inputcapture.c | 2 +- components/drivers/mtd/mtd_nand.c | 2 +- components/drivers/mtd/mtd_nor.c | 4 +- components/drivers/pm/pm.c | 4 +- components/drivers/rtc/alarm.c | 2 +- components/drivers/rtc/rtc.c | 4 +- components/drivers/rtc/soft_rtc.c | 4 +- components/drivers/sdio/block_dev.c | 74 +- components/drivers/sdio/mmc.c | 149 +- components/drivers/sdio/mmcsd_core.c | 92 +- components/drivers/sdio/sd.c | 96 +- components/drivers/sdio/sdio.c | 132 +- components/drivers/sensors/SConscript | 2 +- components/drivers/sensors/sensor.c | 16 +- components/drivers/sensors/sensor.h | 6 +- components/drivers/sensors/sensor_cmd.c | 6 +- components/drivers/serial/serial.c | 67 +- components/drivers/spi/enc28j60.c | 4 +- components/drivers/spi/enc28j60.h | 2 +- components/drivers/spi/qspi_core.c | 10 +- components/drivers/spi/sfud/inc/sfud_cfg.h | 12 + .../drivers/spi/sfud/inc/sfud_flash_def.h | 13 +- components/drivers/spi/sfud/src/sfud.c | 2 +- components/drivers/spi/spi_core.c | 2 +- components/drivers/spi/spi_dev.c | 10 +- components/drivers/spi/spi_flash.h | 10 +- components/drivers/spi/spi_flash_sfud.c | 134 +- components/drivers/spi/spi_flash_sfud.h | 15 +- components/drivers/spi/spi_msd.c | 16 +- components/drivers/spi/spi_msd.h | 14 +- components/drivers/spi/spi_wifi_rw009.c | 2 +- components/drivers/spi/spi_wifi_rw009.h | 2 +- components/drivers/src/completion.c | 2 +- components/drivers/src/dataqueue.c | 141 +- components/drivers/src/pipe.c | 23 +- components/drivers/src/ringblk_buf.c | 2 +- components/drivers/src/ringbuffer.c | 46 +- components/drivers/src/waitqueue.c | 4 +- components/drivers/src/workqueue.c | 4 +- components/drivers/touch/SConscript | 2 +- components/drivers/touch/touch.c | 28 +- components/drivers/touch/touch.h | 7 +- components/drivers/usb/usbdevice/SConscript | 2 +- .../drivers/usb/usbdevice/class/audio_mic.c | 5 +- .../usb/usbdevice/class/audio_speaker.c | 5 +- components/drivers/usb/usbdevice/class/cdc.h | 16 +- .../drivers/usb/usbdevice/class/cdc_vcom.c | 81 +- components/drivers/usb/usbdevice/class/ecm.c | 33 +- components/drivers/usb/usbdevice/class/hid.c | 39 +- components/drivers/usb/usbdevice/class/hid.h | 2 +- .../drivers/usb/usbdevice/class/mstorage.c | 263 +- .../drivers/usb/usbdevice/class/mstorage.h | 6 +- components/drivers/usb/usbdevice/class/ndis.h | 88 +- .../drivers/usb/usbdevice/class/rndis.c | 20 +- .../drivers/usb/usbdevice/class/rndis.h | 196 +- .../drivers/usb/usbdevice/class/winusb.c | 20 +- .../drivers/usb/usbdevice/class/winusb.h | 2 +- .../drivers/usb/usbdevice/core/usbdevice.c | 4 +- .../core/{core.c => usbdevice_core.c} | 166 +- components/drivers/usb/usbhost/SConscript | 2 +- components/drivers/usb/usbhost/class/adk.c | 2 +- components/drivers/usb/usbhost/class/adk.h | 8 +- components/drivers/usb/usbhost/class/hid.c | 136 +- components/drivers/usb/usbhost/class/hid.h | 6 +- components/drivers/usb/usbhost/class/mass.c | 178 +- components/drivers/usb/usbhost/class/mass.h | 10 +- components/drivers/usb/usbhost/class/udisk.c | 4 +- components/drivers/usb/usbhost/class/ukbd.c | 20 +- components/drivers/usb/usbhost/class/umouse.c | 2 +- components/drivers/usb/usbhost/core/driver.c | 22 +- components/drivers/usb/usbhost/core/hub.c | 200 +- components/drivers/usb/usbhost/core/usbhost.c | 6 +- .../usbhost/core/{core.c => usbhost_core.c} | 134 +- components/drivers/watchdog/watchdog.c | 6 +- components/drivers/wlan/wlan_cfg.c | 2 +- components/drivers/wlan/wlan_cfg.h | 2 +- components/drivers/wlan/wlan_cmd.c | 2 +- components/drivers/wlan/wlan_dev.c | 8 +- components/drivers/wlan/wlan_dev.h | 4 +- components/drivers/wlan/wlan_lwip.c | 2 +- components/drivers/wlan/wlan_mgnt.c | 4 +- components/drivers/wlan/wlan_mgnt.h | 2 +- components/drivers/wlan/wlan_prot.c | 2 +- components/drivers/wlan/wlan_prot.h | 2 +- components/drivers/wlan/wlan_workqueue.c | 2 +- components/drivers/wlan/wlan_workqueue.h | 2 +- components/finsh/cmd.c | 2 +- components/finsh/finsh.h | 2 +- components/finsh/finsh_api.h | 2 +- components/finsh/finsh_compiler.c | 2 +- components/finsh/finsh_error.c | 2 +- components/finsh/finsh_error.h | 2 +- components/finsh/finsh_heap.c | 2 +- components/finsh/finsh_heap.h | 2 +- components/finsh/finsh_init.c | 2 +- components/finsh/finsh_node.c | 2 +- components/finsh/finsh_node.h | 2 +- components/finsh/finsh_ops.c | 2 +- components/finsh/finsh_ops.h | 100 +- components/finsh/finsh_parser.c | 2 +- components/finsh/finsh_parser.h | 2 +- components/finsh/finsh_token.c | 2 +- components/finsh/finsh_token.h | 2 +- components/finsh/finsh_var.c | 2 +- components/finsh/finsh_var.h | 2 +- components/finsh/finsh_vm.c | 2 +- components/finsh/finsh_vm.h | 2 +- components/finsh/msh.c | 2 +- components/finsh/msh.h | 2 +- components/finsh/msh_file.c | 7 +- components/finsh/shell.c | 6 +- components/finsh/shell.h | 4 +- components/finsh/symbol.c | 4 +- components/libc/Kconfig | 7 +- components/libc/aio/posix_aio.c | 378 +-- components/libc/aio/posix_aio.h | 2 +- components/libc/compilers/armlibc/README.md | 9 + components/libc/compilers/armlibc/dirent.h | 28 +- components/libc/compilers/armlibc/fcntl.h | 4 +- components/libc/compilers/armlibc/libc.c | 2 +- components/libc/compilers/armlibc/libc.h | 2 +- components/libc/compilers/armlibc/libc_syms.c | 2 +- components/libc/compilers/armlibc/mem_std.c | 2 +- components/libc/compilers/armlibc/stdio.c | 2 +- components/libc/compilers/armlibc/stubs.c | 16 +- components/libc/compilers/armlibc/sys/errno.h | 2 +- components/libc/compilers/armlibc/sys/ioctl.h | 15 + components/libc/compilers/armlibc/sys/mman.h | 2 +- components/libc/compilers/armlibc/sys/stat.h | 2 +- components/libc/compilers/armlibc/sys/types.h | 16 +- .../libc/compilers/armlibc/sys/unistd.h | 30 +- components/libc/compilers/armlibc/termios.h | 15 - components/libc/compilers/armlibc/unistd.h | 2 +- components/libc/compilers/common/SConscript | 11 +- components/libc/compilers/common/readme.md | 10 + components/libc/compilers/common/sys/time.h | 25 +- .../compilers/{newlib => common}/termios.h | 6 +- components/libc/compilers/common/time.c | 6 +- components/libc/compilers/common/unistd.c | 26 + components/libc/compilers/dlib/README.md | 7 +- components/libc/compilers/dlib/dirent.h | 2 +- components/libc/compilers/dlib/environ.c | 2 +- components/libc/compilers/dlib/fcntl.h | 2 +- components/libc/compilers/dlib/libc.c | 2 +- components/libc/compilers/dlib/libc.h | 2 +- components/libc/compilers/dlib/rmtx.c | 4 +- components/libc/compilers/dlib/stdio.c | 2 +- components/libc/compilers/dlib/sys/errno.h | 2 +- components/libc/compilers/dlib/sys/mman.h | 2 +- components/libc/compilers/dlib/sys/signal.h | 2 +- components/libc/compilers/dlib/sys/stat.h | 2 +- components/libc/compilers/dlib/sys/types.h | 15 +- components/libc/compilers/dlib/sys/unistd.h | 34 +- .../libc/compilers/dlib/syscall_close.c | 2 +- .../libc/compilers/dlib/syscall_lseek.c | 2 +- components/libc/compilers/dlib/syscall_mem.c | 2 +- components/libc/compilers/dlib/syscall_open.c | 2 +- components/libc/compilers/dlib/syscall_read.c | 2 +- .../libc/compilers/dlib/syscall_remove.c | 2 +- .../libc/compilers/dlib/syscall_write.c | 2 +- components/libc/compilers/dlib/syscalls.h | 2 +- components/libc/compilers/dlib/termios.h | 15 - components/libc/compilers/dlib/unistd.h | 2 +- components/libc/compilers/minilibc/SConscript | 2 +- components/libc/compilers/minilibc/ctype.c | 34 +- components/libc/compilers/minilibc/ctype.h | 2 +- components/libc/compilers/minilibc/errno.h | 4 +- components/libc/compilers/minilibc/inttypes.h | 2 +- components/libc/compilers/minilibc/math.c | 2 +- components/libc/compilers/minilibc/math.h | 2 +- components/libc/compilers/minilibc/qsort.c | 4 +- components/libc/compilers/minilibc/rand.c | 16 +- components/libc/compilers/minilibc/signal.h | 2 +- components/libc/compilers/minilibc/stddef.h | 2 +- components/libc/compilers/minilibc/stdint.h | 12 +- components/libc/compilers/minilibc/stdio.h | 10 +- components/libc/compilers/minilibc/stdlib.c | 70 +- components/libc/compilers/minilibc/stdlib.h | 2 +- components/libc/compilers/minilibc/string.c | 860 +++--- components/libc/compilers/minilibc/string.h | 32 +- components/libc/compilers/minilibc/sys/mman.h | 2 +- components/libc/compilers/minilibc/sys/stat.h | 50 +- components/libc/compilers/minilibc/sys/time.h | 38 +- .../libc/compilers/minilibc/sys/types.h | 6 +- components/libc/compilers/minilibc/time.c | 2 +- components/libc/compilers/minilibc/time.h | 2 +- components/libc/compilers/newlib/README.md | 9 + components/libc/compilers/newlib/libc.c | 4 +- components/libc/compilers/newlib/libc.h | 4 +- components/libc/compilers/newlib/libc_syms.c | 2 +- components/libc/compilers/newlib/stdio.c | 6 +- components/libc/compilers/newlib/sys/dirent.h | 34 +- components/libc/compilers/newlib/sys/mman.h | 2 +- components/libc/compilers/newlib/sys/statfs.h | 8 +- .../libc/compilers/newlib/sys/termios.h | 2 +- components/libc/compilers/newlib/syscalls.c | 6 +- components/libc/compilers/newlib/time.c | 82 - components/libc/libdl/arch/arm.c | 4 +- components/libc/libdl/arch/x86.c | 10 +- components/libc/libdl/dlclose.c | 2 +- components/libc/libdl/dlelf.c | 10 +- components/libc/libdl/dlelf.h | 4 +- components/libc/libdl/dlerror.c | 6 +- components/libc/libdl/dlfcn.h | 4 +- components/libc/libdl/dlmodule.c | 20 +- components/libc/libdl/dlmodule.h | 2 +- components/libc/libdl/dlopen.c | 6 +- components/libc/libdl/dlsym.c | 4 +- components/libc/mmap/posix_mmap.c | 2 +- components/libc/pthreads/SConscript | 22 +- components/libc/pthreads/mqueue.c | 2 +- components/libc/pthreads/mqueue.h | 2 +- components/libc/pthreads/posix_types.h | 4 +- components/libc/pthreads/pthread.c | 4 +- components/libc/pthreads/pthread.h | 4 +- components/libc/pthreads/pthread_attr.c | 4 +- components/libc/pthreads/pthread_barrier.c | 2 +- components/libc/pthreads/pthread_cond.c | 10 +- components/libc/pthreads/pthread_internal.h | 2 +- components/libc/pthreads/pthread_mutex.c | 4 +- components/libc/pthreads/pthread_rwlock.c | 10 +- components/libc/pthreads/pthread_spin.c | 2 +- components/libc/pthreads/pthread_tls.c | 2 +- components/libc/pthreads/sched.c | 2 +- components/libc/pthreads/sched.h | 2 +- components/libc/pthreads/semaphore.c | 4 +- components/libc/pthreads/semaphore.h | 2 +- components/libc/signal/posix_signal.c | 2 +- components/libc/signal/posix_signal.h | 2 +- components/libc/termios/posix_termios.c | 11 +- components/libc/termios/posix_termios.h | 5 +- components/libc/time/clock_time.c | 4 +- components/libc/time/clock_time.h | 2 +- components/libc/time/posix_sleep.c | 2 +- components/net/Kconfig | 5 +- components/net/SConscript | 2 +- components/net/at/Kconfig | 6 +- components/net/at/at_socket/at_socket.c | 99 +- components/net/at/at_socket/at_socket.h | 4 +- components/net/at/include/at.h | 4 +- components/net/at/include/at_log.h | 2 +- components/net/at/src/at_base_cmd.c | 2 +- components/net/at/src/at_cli.c | 4 +- components/net/at/src/at_client.c | 31 +- components/net/at/src/at_server.c | 2 +- components/net/at/src/at_utils.c | 2 +- .../net/lwip-1.4.1/src/arch/include/arch/cc.h | 7 +- components/net/lwip-1.4.1/src/arch/sys_arch.c | 21 +- .../net/lwip-1.4.1/src/core/snmp/msg_out.c | 4 +- .../net/lwip-1.4.1/src/netif/ethernetif.c | 69 +- .../net/lwip-2.0.2/src/apps/tftp/tftp_port.c | 18 +- .../net/lwip-2.0.2/src/arch/include/arch/cc.h | 7 +- components/net/lwip-2.0.2/src/arch/sys_arch.c | 16 +- .../net/lwip-2.0.2/src/netif/ethernetif.c | 80 +- components/net/lwip-2.1.0/READTEST.md | 12 - components/net/lwip-2.1.0/doc/FILES | 9 - .../net/lwip-2.1.0/doc/NO_SYS_SampleCode.c | 122 - components/net/lwip-2.1.0/doc/ZeroCopyRx.c | 45 - components/net/lwip-2.1.0/doc/contrib.txt | 58 - .../net/lwip-2.1.0/doc/doxygen/generate.bat | 1 - .../net/lwip-2.1.0/doc/doxygen/generate.sh | 3 - .../net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile | 2531 ----------------- .../doc/doxygen/lwip.Doxyfile.cmake.in | 2531 ----------------- .../net/lwip-2.1.0/doc/doxygen/main_page.h | 403 --- .../lwip-2.1.0/doc/doxygen/output/index.html | 10 - components/net/lwip-2.1.0/doc/mdns.txt | 112 - components/net/lwip-2.1.0/doc/mqtt_client.txt | 162 -- components/net/lwip-2.1.0/doc/ppp.txt | 529 ---- components/net/lwip-2.1.0/doc/savannah.txt | 120 - components/net/lwip-2.1.0/src/apps/README.md | 6 - .../net/{lwip-2.1.0 => lwip-2.1.2}/CHANGELOG | 55 + .../{lwip-2.1.0 => lwip-2.1.2}/CMakeLists.txt | 0 .../net/{lwip-2.1.0 => lwip-2.1.2}/COPYING | 0 .../net/{lwip-2.1.0 => lwip-2.1.2}/FEATURES | 0 .../net/{lwip-2.1.0 => lwip-2.1.2}/FILES | 0 .../net/{lwip-2.1.0 => lwip-2.1.2}/README | 0 components/net/lwip-2.1.2/README_RT-THREAD.md | 89 + .../net/{lwip-2.1.0 => lwip-2.1.2}/SConscript | 2 +- .../net/{lwip-2.1.0 => lwip-2.1.2}/UPGRADING | 0 .../net/{lwip-2.1.0 => lwip-2.1.2}/src/FILES | 0 .../src/Filelists.cmake | 2 +- .../src/Filelists.mk | 0 .../src/api/api_lib.c | 2 +- .../src/api/api_msg.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/api/err.c | 0 .../src/api/if_api.c | 0 .../src/api/netbuf.c | 0 .../src/api/netdb.c | 0 .../src/api/netifapi.c | 0 .../src/api/sockets.c | 13 +- .../src/api/tcpip.c | 0 .../src/apps/altcp_tls/altcp_tls_mbedtls.c | 34 +- .../apps/altcp_tls/altcp_tls_mbedtls_mem.c | 0 .../apps/altcp_tls/altcp_tls_mbedtls_mem.h | 0 .../altcp_tls/altcp_tls_mbedtls_structs.h | 0 .../src/apps/http/altcp_proxyconnect.c | 2 + .../src/apps/http/fs.c | 0 .../src/apps/http/fs/404.html | 0 .../src/apps/http/fs/img/sics.gif | Bin .../src/apps/http/fs/index.html | 0 .../src/apps/http/fsdata.c | 0 .../src/apps/http/fsdata.h | 0 .../src/apps/http/http_client.c | 1 + .../src/apps/http/httpd.c | 0 .../src/apps/http/httpd_structs.h | 0 .../src/apps/http/makefsdata/makefsdata | 0 .../src/apps/http/makefsdata/makefsdata.c | 0 .../src/apps/http/makefsdata/readme.txt | 0 .../src/apps/http/makefsdata/tinydir.h | 0 .../src/apps/lwiperf/lwiperf.c | 0 .../src/apps/mdns/mdns.c | 0 .../src/apps/mqtt/mqtt.c | 0 .../src/apps/netbiosns/netbiosns.c | 40 +- .../src/apps/ping/ping.c | 0 .../src/apps/smtp/smtp.c | 7 +- .../src/apps/snmp/snmp_asn1.c | 0 .../src/apps/snmp/snmp_asn1.h | 0 .../src/apps/snmp/snmp_core.c | 0 .../src/apps/snmp/snmp_core_priv.h | 0 .../src/apps/snmp/snmp_mib2.c | 0 .../src/apps/snmp/snmp_mib2_icmp.c | 0 .../src/apps/snmp/snmp_mib2_interfaces.c | 0 .../src/apps/snmp/snmp_mib2_ip.c | 0 .../src/apps/snmp/snmp_mib2_snmp.c | 0 .../src/apps/snmp/snmp_mib2_system.c | 0 .../src/apps/snmp/snmp_mib2_tcp.c | 0 .../src/apps/snmp/snmp_mib2_udp.c | 0 .../src/apps/snmp/snmp_msg.c | 0 .../src/apps/snmp/snmp_msg.h | 0 .../src/apps/snmp/snmp_netconn.c | 0 .../src/apps/snmp/snmp_pbuf_stream.c | 0 .../src/apps/snmp/snmp_pbuf_stream.h | 0 .../src/apps/snmp/snmp_raw.c | 0 .../src/apps/snmp/snmp_scalar.c | 18 +- .../src/apps/snmp/snmp_snmpv2_framework.c | 0 .../src/apps/snmp/snmp_snmpv2_usm.c | 0 .../src/apps/snmp/snmp_table.c | 0 .../src/apps/snmp/snmp_threadsync.c | 18 +- .../src/apps/snmp/snmp_traps.c | 0 .../src/apps/snmp/snmpv3.c | 0 .../src/apps/snmp/snmpv3_mbedtls.c | 0 .../src/apps/snmp/snmpv3_priv.h | 0 .../src/apps/sntp/sntp.c | 0 .../src/apps/tftp/tftp_port.c | 18 +- .../src/apps/tftp/tftp_server.c | 0 .../src/arch/include/arch/bpstruct.h | 0 .../src/arch/include/arch/cc.h | 11 +- .../src/arch/include/arch/epstruct.h | 0 .../src/arch/include/arch/perf.h | 0 .../src/arch/include/arch/sys_arch.h | 50 +- .../src/arch/sys_arch.c | 20 +- .../src/core/altcp.c | 0 .../src/core/altcp_alloc.c | 0 .../src/core/altcp_tcp.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/def.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/dns.c | 0 .../src/core/inet_chksum.c | 0 .../src/core/init.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/ip.c | 0 .../src/core/ipv4/autoip.c | 0 .../src/core/ipv4/dhcp.c | 0 .../src/core/ipv4/etharp.c | 0 .../src/core/ipv4/icmp.c | 0 .../src/core/ipv4/igmp.c | 0 .../src/core/ipv4/ip4.c | 2 +- .../src/core/ipv4/ip4_addr.c | 0 .../src/core/ipv4/ip4_frag.c | 0 .../src/core/ipv6/dhcp6.c | 0 .../src/core/ipv6/ethip6.c | 0 .../src/core/ipv6/icmp6.c | 0 .../src/core/ipv6/inet6.c | 0 .../src/core/ipv6/ip6.c | 0 .../src/core/ipv6/ip6_addr.c | 0 .../src/core/ipv6/ip6_frag.c | 0 .../src/core/ipv6/mld6.c | 0 .../src/core/ipv6/nd6.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/mem.c | 0 .../src/core/memp.c | 0 .../src/core/netif.c | 0 .../src/core/pbuf.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/raw.c | 0 .../src/core/stats.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/sys.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/tcp.c | 24 +- .../src/core/tcp_in.c | 0 .../src/core/tcp_out.c | 0 .../src/core/timeouts.c | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/core/udp.c | 0 .../src/include/compat/posix/arpa/inet.h | 0 .../src/include/compat/posix/net/if.h | 0 .../src/include/compat/posix/netdb.h | 0 .../src/include/compat/posix/sys/socket.h | 0 .../src/include/compat/stdc/errno.h | 0 .../src/include/lwip/altcp.h | 0 .../src/include/lwip/altcp_tcp.h | 0 .../src/include/lwip/altcp_tls.h | 0 .../src/include/lwip/api.h | 0 .../src/include/lwip/apps/FILES | 0 .../include/lwip/apps/altcp_proxyconnect.h | 0 .../lwip/apps/altcp_tls_mbedtls_opts.h | 0 .../src/include/lwip/apps/fs.h | 0 .../src/include/lwip/apps/http_client.h | 0 .../src/include/lwip/apps/httpd.h | 0 .../src/include/lwip/apps/httpd_opts.h | 0 .../src/include/lwip/apps/lwiperf.h | 0 .../src/include/lwip/apps/mdns.h | 0 .../src/include/lwip/apps/mdns_opts.h | 0 .../src/include/lwip/apps/mdns_priv.h | 0 .../src/include/lwip/apps/mqtt.h | 0 .../src/include/lwip/apps/mqtt_opts.h | 0 .../src/include/lwip/apps/mqtt_priv.h | 0 .../src/include/lwip/apps/netbiosns.h | 0 .../src/include/lwip/apps/netbiosns_opts.h | 0 .../src/include/lwip/apps/smtp.h | 0 .../src/include/lwip/apps/smtp_opts.h | 0 .../src/include/lwip/apps/snmp.h | 0 .../src/include/lwip/apps/snmp_core.h | 0 .../src/include/lwip/apps/snmp_mib2.h | 0 .../src/include/lwip/apps/snmp_opts.h | 0 .../src/include/lwip/apps/snmp_scalar.h | 0 .../include/lwip/apps/snmp_snmpv2_framework.h | 0 .../src/include/lwip/apps/snmp_snmpv2_usm.h | 0 .../src/include/lwip/apps/snmp_table.h | 0 .../src/include/lwip/apps/snmp_threadsync.h | 0 .../src/include/lwip/apps/snmpv3.h | 0 .../src/include/lwip/apps/sntp.h | 0 .../src/include/lwip/apps/sntp_opts.h | 0 .../src/include/lwip/apps/tftp_opts.h | 0 .../src/include/lwip/apps/tftp_server.h | 0 .../src/include/lwip/arch.h | 4 +- .../src/include/lwip/autoip.h | 0 .../src/include/lwip/debug.h | 0 .../src/include/lwip/def.h | 16 +- .../src/include/lwip/dhcp.h | 0 .../src/include/lwip/dhcp6.h | 0 .../src/include/lwip/dns.h | 0 .../src/include/lwip/err.h | 16 +- .../src/include/lwip/errno.h | 0 .../src/include/lwip/etharp.h | 0 .../src/include/lwip/ethip6.h | 0 .../src/include/lwip/icmp.h | 0 .../src/include/lwip/icmp6.h | 0 .../src/include/lwip/if_api.h | 0 .../src/include/lwip/igmp.h | 0 .../src/include/lwip/inet.h | 0 .../src/include/lwip/inet_chksum.h | 0 .../src/include/lwip/init.h | 2 +- .../src/include/lwip/init.h.cmake.in | 0 .../src/include/lwip/ip.h | 0 .../src/include/lwip/ip4.h | 0 .../src/include/lwip/ip4_addr.h | 0 .../src/include/lwip/ip4_frag.h | 0 .../src/include/lwip/ip6.h | 0 .../src/include/lwip/ip6_addr.h | 0 .../src/include/lwip/ip6_frag.h | 0 .../src/include/lwip/ip6_zone.h | 0 .../src/include/lwip/ip_addr.h | 0 .../src/include/lwip/mem.h | 0 .../src/include/lwip/memp.h | 0 .../src/include/lwip/mld6.h | 0 .../src/include/lwip/nd6.h | 0 .../src/include/lwip/netbuf.h | 0 .../src/include/lwip/netdb.h | 0 .../src/include/lwip/netif.h | 0 .../src/include/lwip/netifapi.h | 0 .../src/include/lwip/opt.h | 0 .../src/include/lwip/pbuf.h | 0 .../src/include/lwip/priv/altcp_priv.h | 0 .../src/include/lwip/priv/api_msg.h | 0 .../src/include/lwip/priv/mem_priv.h | 0 .../src/include/lwip/priv/memp_priv.h | 0 .../src/include/lwip/priv/memp_std.h | 0 .../src/include/lwip/priv/nd6_priv.h | 0 .../src/include/lwip/priv/raw_priv.h | 0 .../src/include/lwip/priv/sockets_priv.h | 0 .../src/include/lwip/priv/tcp_priv.h | 0 .../src/include/lwip/priv/tcpip_priv.h | 0 .../src/include/lwip/prot/autoip.h | 0 .../src/include/lwip/prot/dhcp.h | 0 .../src/include/lwip/prot/dhcp6.h | 0 .../src/include/lwip/prot/dns.h | 0 .../src/include/lwip/prot/etharp.h | 0 .../src/include/lwip/prot/ethernet.h | 0 .../src/include/lwip/prot/iana.h | 0 .../src/include/lwip/prot/icmp.h | 0 .../src/include/lwip/prot/icmp6.h | 0 .../src/include/lwip/prot/ieee.h | 0 .../src/include/lwip/prot/igmp.h | 0 .../src/include/lwip/prot/ip.h | 0 .../src/include/lwip/prot/ip4.h | 0 .../src/include/lwip/prot/ip6.h | 0 .../src/include/lwip/prot/mld6.h | 0 .../src/include/lwip/prot/nd6.h | 0 .../src/include/lwip/prot/tcp.h | 0 .../src/include/lwip/prot/udp.h | 0 .../src/include/lwip/raw.h | 0 .../src/include/lwip/sio.h | 0 .../src/include/lwip/snmp.h | 0 .../src/include/lwip/sockets.h | 0 .../src/include/lwip/stats.h | 0 .../src/include/lwip/sys.h | 0 .../src/include/lwip/tcp.h | 0 .../src/include/lwip/tcpbase.h | 0 .../src/include/lwip/tcpip.h | 0 .../src/include/lwip/timeouts.h | 0 .../src/include/lwip/udp.h | 0 .../src/include/netif/bridgeif.h | 0 .../src/include/netif/bridgeif_opts.h | 0 .../src/include/netif/etharp.h | 0 .../src/include/netif/ethernet.h | 0 .../src/include/netif/ethernetif.h | 0 .../src/include/netif/ieee802154.h | 0 .../src/include/netif/lowpan6.h | 0 .../src/include/netif/lowpan6_ble.h | 0 .../src/include/netif/lowpan6_common.h | 0 .../src/include/netif/lowpan6_opts.h | 0 .../src/include/netif/ppp/ccp.h | 0 .../src/include/netif/ppp/chap-md5.h | 0 .../src/include/netif/ppp/chap-new.h | 0 .../src/include/netif/ppp/chap_ms.h | 0 .../src/include/netif/ppp/eap.h | 0 .../src/include/netif/ppp/ecp.h | 0 .../src/include/netif/ppp/eui64.h | 0 .../src/include/netif/ppp/fsm.h | 0 .../src/include/netif/ppp/ipcp.h | 0 .../src/include/netif/ppp/ipv6cp.h | 0 .../src/include/netif/ppp/lcp.h | 0 .../src/include/netif/ppp/magic.h | 0 .../src/include/netif/ppp/mppe.h | 0 .../src/include/netif/ppp/polarssl/arc4.h | 0 .../src/include/netif/ppp/polarssl/des.h | 0 .../src/include/netif/ppp/polarssl/md4.h | 0 .../src/include/netif/ppp/polarssl/md5.h | 0 .../src/include/netif/ppp/polarssl/sha1.h | 0 .../src/include/netif/ppp/ppp.h | 0 .../src/include/netif/ppp/ppp_impl.h | 0 .../src/include/netif/ppp/ppp_opts.h | 0 .../src/include/netif/ppp/pppapi.h | 0 .../src/include/netif/ppp/pppcrypt.h | 0 .../src/include/netif/ppp/pppdebug.h | 0 .../src/include/netif/ppp/pppoe.h | 0 .../src/include/netif/ppp/pppol2tp.h | 0 .../src/include/netif/ppp/pppos.h | 0 .../src/include/netif/ppp/upap.h | 0 .../src/include/netif/ppp/vj.h | 0 .../src/include/netif/slipif.h | 0 .../src/include/netif/zepif.h | 0 .../{lwip-2.1.0 => lwip-2.1.2}/src/lwipopts.h | 13 + .../src/lwippools.h | 0 .../src/netif/FILES | 0 .../src/netif/bridgeif.c | 0 .../src/netif/bridgeif_fdb.c | 0 .../src/netif/ethernet.c | 0 .../src/netif/ethernetif.c | 98 +- .../src/netif/lowpan6.c | 10 +- .../src/netif/lowpan6_ble.c | 0 .../src/netif/lowpan6_common.c | 0 .../src/netif/ppp/PPPD_FOLLOWUP | 0 .../src/netif/ppp/auth.c | 0 .../src/netif/ppp/ccp.c | 0 .../src/netif/ppp/chap-md5.c | 0 .../src/netif/ppp/chap-new.c | 0 .../src/netif/ppp/chap_ms.c | 0 .../src/netif/ppp/demand.c | 0 .../src/netif/ppp/eap.c | 0 .../src/netif/ppp/ecp.c | 0 .../src/netif/ppp/eui64.c | 0 .../src/netif/ppp/fsm.c | 0 .../src/netif/ppp/ipcp.c | 0 .../src/netif/ppp/ipv6cp.c | 0 .../src/netif/ppp/lcp.c | 0 .../src/netif/ppp/magic.c | 0 .../src/netif/ppp/mppe.c | 0 .../src/netif/ppp/multilink.c | 0 .../src/netif/ppp/polarssl/README | 0 .../src/netif/ppp/polarssl/arc4.c | 0 .../src/netif/ppp/polarssl/des.c | 0 .../src/netif/ppp/polarssl/md4.c | 0 .../src/netif/ppp/polarssl/md5.c | 0 .../src/netif/ppp/polarssl/sha1.c | 0 .../src/netif/ppp/ppp.c | 0 .../src/netif/ppp/pppapi.c | 0 .../src/netif/ppp/pppcrypt.c | 0 .../src/netif/ppp/pppoe.c | 0 .../src/netif/ppp/pppol2tp.c | 0 .../src/netif/ppp/pppos.c | 2 +- .../src/netif/ppp/upap.c | 0 .../src/netif/ppp/utils.c | 0 .../src/netif/ppp/vj.c | 0 .../src/netif/slipif.c | 0 .../src/netif/zepif.c | 0 .../test/fuzz/Makefile | 0 .../test/fuzz/README | 0 .../test/fuzz/config.h | 0 .../test/fuzz/fuzz.c | 0 .../test/fuzz/lwipopts.h | 0 .../test/fuzz/output_to_pcap.sh | 0 .../test/sockets/sockets_stresstest.c | 0 .../test/sockets/sockets_stresstest.h | 0 .../test/unit/Filelists.cmake | 0 .../test/unit/Filelists.mk | 0 .../test/unit/api/test_sockets.c | 0 .../test/unit/api/test_sockets.h | 0 .../test/unit/arch/sys_arch.c | 0 .../test/unit/arch/sys_arch.h | 0 .../test/unit/core/test_def.c | 0 .../test/unit/core/test_def.h | 0 .../test/unit/core/test_mem.c | 0 .../test/unit/core/test_mem.h | 0 .../test/unit/core/test_netif.c | 0 .../test/unit/core/test_netif.h | 0 .../test/unit/core/test_pbuf.c | 0 .../test/unit/core/test_pbuf.h | 0 .../test/unit/core/test_timers.c | 0 .../test/unit/core/test_timers.h | 0 .../test/unit/dhcp/test_dhcp.c | 0 .../test/unit/dhcp/test_dhcp.h | 0 .../test/unit/etharp/test_etharp.c | 0 .../test/unit/etharp/test_etharp.h | 0 .../test/unit/ip4/test_ip4.c | 0 .../test/unit/ip4/test_ip4.h | 0 .../test/unit/ip6/test_ip6.c | 0 .../test/unit/ip6/test_ip6.h | 0 .../test/unit/lwip_check.h | 0 .../test/unit/lwip_unittests.c | 0 .../test/unit/lwipopts.h | 0 .../test/unit/mdns/test_mdns.c | 0 .../test/unit/mdns/test_mdns.h | 0 .../test/unit/mqtt/test_mqtt.c | 2 + .../test/unit/mqtt/test_mqtt.h | 0 .../test/unit/tcp/tcp_helper.c | 0 .../test/unit/tcp/tcp_helper.h | 0 .../test/unit/tcp/test_tcp.c | 48 + .../test/unit/tcp/test_tcp.h | 0 .../test/unit/tcp/test_tcp_oos.c | 0 .../test/unit/tcp/test_tcp_oos.h | 0 .../test/unit/udp/test_udp.c | 0 .../test/unit/udp/test_udp.h | 0 components/net/lwip_dhcpd/dhcp_server.c | 2 +- components/net/lwip_dhcpd/dhcp_server.h | 2 +- components/net/lwip_dhcpd/dhcp_server_raw.c | 4 +- components/net/netdev/include/arpa/inet.h | 2 +- components/net/netdev/include/netdev.h | 10 +- components/net/netdev/include/netdev_ipaddr.h | 42 +- components/net/netdev/src/netdev.c | 18 +- components/net/netdev/src/netdev_ipaddr.c | 4 +- components/net/sal_socket/dfs_net/dfs_net.c | 6 +- components/net/sal_socket/impl/af_inet.h | 2 +- components/net/sal_socket/impl/af_inet_at.c | 4 +- components/net/sal_socket/impl/af_inet_lwip.c | 8 +- .../net/sal_socket/impl/proto_mbedtls.c | 22 +- .../net/sal_socket/include/dfs_net/dfs_net.h | 2 +- .../include/dfs_net/sys_select/sys/select.h | 2 +- components/net/sal_socket/include/sal.h | 2 +- components/net/sal_socket/include/sal_netdb.h | 2 +- .../net/sal_socket/include/sal_socket.h | 4 +- components/net/sal_socket/include/sal_tls.h | 2 +- .../net/sal_socket/include/socket/netdb.h | 2 +- .../sal_socket/include/socket/netinet/in.h | 2 +- .../sal_socket/include/socket/netinet/tcp.h | 2 +- .../sal_socket/include/socket/netinet/udp.h | 2 +- .../include/socket/sys_socket/sys/socket.h | 2 +- components/net/sal_socket/socket/net_netdb.c | 2 +- .../net/sal_socket/socket/net_sockets.c | 6 +- components/net/sal_socket/src/sal_socket.c | 89 +- components/net/uip/rt-thread/uip_ethernetif.c | 386 +-- components/net/uip/uip/lc-switch.h | 2 +- .../utilities/ulog/backend/console_be.c | 2 +- components/utilities/ulog/syslog/syslog.c | 7 +- components/utilities/ulog/syslog/syslog.h | 2 +- components/utilities/ulog/ulog.c | 10 +- components/utilities/ulog/ulog.h | 2 +- components/utilities/ulog/ulog_def.h | 8 +- components/utilities/utest/utest.c | 2 +- components/utilities/utest/utest.h | 61 +- components/utilities/utest/utest_assert.h | 10 +- components/utilities/utest/utest_log.h | 2 +- components/utilities/ymodem/ry_sy.c | 2 +- components/utilities/ymodem/ymodem.c | 2 +- components/vbus/prio_queue.c | 2 +- components/vbus/prio_queue.h | 2 +- components/vbus/share_hdr/vbus_api.h | 2 +- components/vbus/vbus.c | 12 +- components/vbus/vbus.h | 12 +- components/vbus/vbus_chnx.c | 2 +- components/vbus/watermark_queue.c | 2 +- components/vbus/watermark_queue.h | 2 +- components/vmm/vmm.c | 4 +- components/vmm/vmm.h | 4 +- components/vmm/vmm_context.c | 4 +- components/vmm/vmm_context.h | 4 +- components/vmm/vmm_iomap.c | 4 +- components/vmm/vmm_vector.c | 12 +- documentation/doxygen/kernel.h | 8 +- documentation/doxygen/systeminit.h | 2 +- examples/file/listdir.c | 52 +- examples/file/readspeed.c | 4 +- examples/file/writespeed.c | 38 +- examples/kernel/tc_comm.h | 2 +- examples/pm/timer_app.c | 2 +- examples/pm/wakeup_app.c | 2 +- examples/test/net_test.c | 436 +-- examples/test/rtc_test.c | 38 +- examples/ulog/ulog_example.c | 2 +- include/libc/libc_dirent.h | 2 +- include/libc/libc_errno.h | 8 +- include/libc/libc_fcntl.h | 6 +- include/libc/libc_fdset.h | 4 +- include/libc/libc_ioctl.h | 166 +- include/libc/libc_signal.h | 13 +- include/libc/libc_stat.h | 4 +- include/rtdbg.h | 14 +- include/rtdebug.h | 2 +- include/rtdef.h | 42 +- include/rthw.h | 4 +- include/rtlibc.h | 2 +- include/rtm.h | 2 +- include/rtservice.h | 16 +- include/rtthread.h | 7 +- libcpu/arm/AT91SAM7S/AT91SAM7S.h | 478 ++-- libcpu/arm/AT91SAM7S/cpu.c | 6 +- libcpu/arm/AT91SAM7S/interrupt.c | 46 +- libcpu/arm/AT91SAM7S/serial.c | 582 ++-- libcpu/arm/AT91SAM7S/serial.h | 76 +- libcpu/arm/AT91SAM7S/stack.c | 2 +- libcpu/arm/AT91SAM7S/trap.c | 10 +- libcpu/arm/AT91SAM7X/cpu.c | 6 +- libcpu/arm/AT91SAM7X/interrupt.c | 66 +- libcpu/arm/AT91SAM7X/stack.c | 2 +- libcpu/arm/AT91SAM7X/trap.c | 24 +- libcpu/arm/am335x/am33xx.h | 90 +- libcpu/arm/am335x/context_iar.S | 18 +- libcpu/arm/am335x/cpu.c | 112 +- libcpu/arm/am335x/interrupt.c | 8 +- libcpu/arm/am335x/interrupt.h | 42 +- libcpu/arm/am335x/mmu.c | 108 +- libcpu/arm/am335x/mmu.h | 44 +- libcpu/arm/am335x/stack.c | 2 +- libcpu/arm/am335x/trap.c | 66 +- libcpu/arm/arm926/cpuport.c | 2 +- libcpu/arm/arm926/machine.c | 2 +- libcpu/arm/arm926/mmu.c | 2 +- libcpu/arm/arm926/mmu.h | 2 +- libcpu/arm/arm926/stack.c | 2 +- libcpu/arm/arm926/trap.c | 2 +- libcpu/arm/armv6/armv6.h | 42 +- libcpu/arm/armv6/cpuport.c | 172 +- libcpu/arm/armv6/mmu.c | 638 ++--- libcpu/arm/armv6/mmu.h | 54 +- libcpu/arm/armv6/stack.c | 2 +- libcpu/arm/armv6/vfp.c | 2 +- libcpu/arm/armv6/vfp.h | 4 +- libcpu/arm/common/backtrace.c | 2 +- libcpu/arm/common/div0.c | 4 +- libcpu/arm/common/showmem.c | 34 +- libcpu/arm/cortex-a/armv7.h | 68 +- libcpu/arm/cortex-a/cache.c | 4 +- libcpu/arm/cortex-a/cp15.h | 2 +- libcpu/arm/cortex-a/cpu.c | 2 +- libcpu/arm/cortex-a/gic.c | 5 +- libcpu/arm/cortex-a/gic.h | 2 +- libcpu/arm/cortex-a/interrupt.c | 2 +- libcpu/arm/cortex-a/interrupt.h | 2 +- libcpu/arm/cortex-a/mmu.c | 2 +- libcpu/arm/cortex-a/mmu.h | 2 +- libcpu/arm/cortex-a/pmu.c | 2 +- libcpu/arm/cortex-a/pmu.h | 2 +- libcpu/arm/cortex-a/stack.c | 2 +- libcpu/arm/cortex-a/trap.c | 2 +- libcpu/arm/cortex-m0/context_gcc.S | 4 +- libcpu/arm/cortex-m0/context_iar.S | 4 +- libcpu/arm/cortex-m0/context_rvds.S | 4 +- libcpu/arm/cortex-m0/cpuport.c | 2 +- libcpu/arm/cortex-m3/context_gcc.S | 4 +- libcpu/arm/cortex-m3/context_iar.S | 4 +- libcpu/arm/cortex-m3/context_rvds.S | 4 +- libcpu/arm/cortex-m3/cpuport.c | 6 +- libcpu/arm/cortex-m4/context_gcc.S | 4 +- libcpu/arm/cortex-m4/context_iar.S | 4 +- libcpu/arm/cortex-m4/context_rvds.S | 4 +- libcpu/arm/cortex-m4/cpuport.c | 8 +- libcpu/arm/cortex-m7/context_gcc.S | 4 +- libcpu/arm/cortex-m7/context_iar.S | 4 +- libcpu/arm/cortex-m7/context_rvds.S | 4 +- libcpu/arm/cortex-m7/cpuport.c | 6 +- libcpu/arm/cortex-r4/armv7.h | 36 +- libcpu/arm/cortex-r4/cpu.c | 18 +- libcpu/arm/cortex-r4/interrupt.c | 52 +- libcpu/arm/cortex-r4/stack.c | 2 +- libcpu/arm/cortex-r4/trap.c | 42 +- libcpu/arm/dm36x/cpuport.c | 172 +- libcpu/arm/dm36x/mmu.c | 232 +- libcpu/arm/dm36x/mmu.h | 22 +- libcpu/arm/dm36x/stack.c | 2 +- libcpu/arm/lpc214x/cpuport.c | 134 +- libcpu/arm/lpc24xx/LPC24xx.h | 680 ++--- libcpu/arm/lpc24xx/cpu.c | 6 +- libcpu/arm/lpc24xx/interrupt.c | 76 +- libcpu/arm/lpc24xx/stack.c | 2 +- libcpu/arm/lpc24xx/trap.c | 54 +- libcpu/arm/realview-a8-vmm/armv7.h | 68 +- libcpu/arm/realview-a8-vmm/cp15.h | 2 +- libcpu/arm/realview-a8-vmm/cpu.c | 16 +- libcpu/arm/realview-a8-vmm/gic.c | 2 +- libcpu/arm/realview-a8-vmm/gic.h | 2 +- libcpu/arm/realview-a8-vmm/interrupt.c | 2 +- libcpu/arm/realview-a8-vmm/interrupt.h | 42 +- libcpu/arm/realview-a8-vmm/mmu.c | 2 +- libcpu/arm/realview-a8-vmm/pmu.c | 2 +- libcpu/arm/realview-a8-vmm/pmu.h | 2 +- libcpu/arm/realview-a8-vmm/stack.c | 2 +- libcpu/arm/realview-a8-vmm/trap.c | 4 +- libcpu/arm/s3c24x0/cpu.c | 132 +- libcpu/arm/s3c24x0/interrupt.c | 30 +- libcpu/arm/s3c24x0/mmu.c | 268 +- libcpu/arm/s3c24x0/rtc.c | 226 +- libcpu/arm/s3c24x0/rtc.h | 2 +- libcpu/arm/s3c24x0/s3c24x0.h | 78 +- libcpu/arm/s3c24x0/serial.c | 291 -- libcpu/arm/s3c24x0/serial.h | 66 - libcpu/arm/s3c24x0/stack.c | 2 +- libcpu/arm/s3c24x0/start_gcc.S | 2 +- libcpu/arm/s3c24x0/system_clock.c | 108 +- libcpu/arm/s3c24x0/trap.c | 62 +- libcpu/arm/s3c44b0/cpu.c | 68 +- libcpu/arm/s3c44b0/interrupt.c | 150 +- libcpu/arm/s3c44b0/s3c44b0.h | 480 ++-- libcpu/arm/s3c44b0/serial.c | 72 +- libcpu/arm/s3c44b0/stack.c | 2 +- libcpu/arm/s3c44b0/start_gcc.S | 2 +- libcpu/arm/s3c44b0/trap.c | 100 +- libcpu/arm/sep4020/clk.c | 108 +- libcpu/arm/sep4020/cpu.c | 120 +- libcpu/arm/sep4020/interrupt.c | 24 +- libcpu/arm/sep4020/sep4020.h | 180 +- libcpu/arm/sep4020/serial.c | 430 +-- libcpu/arm/sep4020/serial.h | 62 +- libcpu/arm/sep4020/stack.c | 2 +- libcpu/arm/sep4020/trap.c | 62 +- libcpu/arm/zynq7000/SConscript | 17 - libcpu/arm/zynq7000/armv7.h | 65 - libcpu/arm/zynq7000/context_gcc.S | 92 - libcpu/arm/zynq7000/cp15.h | 22 - libcpu/arm/zynq7000/cp15_gcc.S | 125 - libcpu/arm/zynq7000/cpu.c | 41 - libcpu/arm/zynq7000/gic.c | 229 -- libcpu/arm/zynq7000/gic.h | 31 - libcpu/arm/zynq7000/interrupt.c | 143 - libcpu/arm/zynq7000/interrupt.h | 17 - libcpu/arm/zynq7000/mmu.c | 172 -- libcpu/arm/zynq7000/stack.c | 58 - libcpu/arm/zynq7000/start_gcc.S | 241 -- libcpu/arm/zynq7000/trap.c | 175 -- libcpu/arm/zynq7000/vector_gcc.S | 51 - libcpu/avr32/uc3/cpu.c | 6 +- libcpu/avr32/uc3/exception_gcc.S | 2 +- libcpu/avr32/uc3/serial.c | 396 +-- libcpu/avr32/uc3/serial.h | 20 +- libcpu/avr32/uc3/stack.c | 40 +- libcpu/blackfin/bf53x/cpuport.c | 8 +- libcpu/blackfin/bf53x/serial.c | 430 +-- libcpu/c-sky/ck802/contex_ck802_gcc.S | 18 +- libcpu/c-sky/ck802/core_ck802.c | 18 +- libcpu/c-sky/ck802/core_ck802.h | 18 +- libcpu/c-sky/ck802/stack_ck802.c | 18 +- libcpu/ia32/__udivsi3.c | 46 +- libcpu/ia32/__umodsi3.c | 46 +- libcpu/ia32/backtrace.c | 2 +- libcpu/ia32/interrupt.c | 110 +- libcpu/ia32/showmem.c | 32 +- libcpu/ia32/stack.c | 46 +- libcpu/ia32/trap.c | 88 +- libcpu/m16c/m16c62p/cpuport.c | 2 +- libcpu/mips/common/exception.h | 212 +- libcpu/mips/common/mips.h | 2 +- libcpu/mips/common/mips_addrspace.h | 158 +- libcpu/mips/common/mips_asm.h | 206 +- libcpu/mips/common/mips_cache.c | 36 +- libcpu/mips/common/mips_cache.h | 116 +- libcpu/mips/common/mips_cfg.h | 22 +- libcpu/mips/common/mips_context.h | 452 ++- libcpu/mips/common/mips_def.h | 2248 +++++++-------- libcpu/mips/common/mips_excpt.h | 20 +- libcpu/mips/common/mips_regs.h | 1239 ++++---- libcpu/mips/common/mips_types.h | 20 +- libcpu/mips/common/mipscfg.h | 2 +- libcpu/mips/loongson_1b/cache.c | 198 +- libcpu/mips/loongson_1b/cache.h | 48 +- libcpu/mips/loongson_1b/cpuport.c | 104 +- libcpu/mips/loongson_1b/exception.c | 46 +- libcpu/mips/loongson_1b/interrupt.c | 2 +- libcpu/mips/loongson_1b/ls1b.h | 174 +- libcpu/mips/loongson_1b/mipscfg.c | 60 +- libcpu/mips/loongson_1c/cache.c | 198 +- libcpu/mips/loongson_1c/cache.h | 48 +- libcpu/mips/loongson_1c/cpuport.c | 148 +- libcpu/mips/loongson_1c/exception.c | 46 +- libcpu/mips/loongson_1c/mipscfg.c | 60 +- libcpu/mips/pic32/cpuport.c | 82 +- libcpu/mips/x1000/cache.c | 217 -- libcpu/mips/x1000/cache.h | 41 - libcpu/mips/x1000/cpu.c | 131 - libcpu/mips/x1000/interrupt.c | 215 -- libcpu/mips/x1000/mips_backtrace.c | 208 -- libcpu/mips/x1000/mips_cache_gcc.S | 62 - libcpu/mips/x1000/mips_context_gcc.S | 95 - libcpu/mips/x1000/mips_excpt.c | 382 --- libcpu/mips/x1000/mips_excpt_gcc.S | 102 - libcpu/mips/x1000/mips_fp_gcc.S | 197 -- libcpu/mips/x1000/stack.c | 82 - libcpu/mips/x1000/startup_gcc.S | 328 --- libcpu/mips/x1000/x1000.h | 284 -- libcpu/mips/x1000/x1000_aic.h | 794 ------ libcpu/mips/x1000/x1000_cpm.h | 511 ---- libcpu/mips/x1000/x1000_intc.h | 120 - libcpu/mips/x1000/x1000_otg_dwc.h | 306 -- libcpu/mips/x1000/x1000_slcdc.h | 463 --- libcpu/mips/xburst/SConscript | 11 - libcpu/mips/xburst/cache.c | 118 - libcpu/mips/xburst/cache.h | 62 - libcpu/mips/xburst/cache_gcc.S | 42 - libcpu/mips/xburst/context_gcc.S | 146 - libcpu/mips/xburst/cpu.c | 75 - libcpu/mips/xburst/exception.c | 81 - libcpu/mips/xburst/interrupt.c | 249 -- libcpu/mips/xburst/mipscfg.c | 358 --- libcpu/mips/xburst/stack.c | 103 - libcpu/mips/xburst/stack.h | 28 - libcpu/mips/xburst/start_gcc.S | 150 - libcpu/mips/xburst/x1000.h | 329 --- libcpu/nios/nios_ii/stack.c | 68 +- libcpu/ppc/common/stack.c | 4 +- libcpu/ppc/ppc405/interrupt.c | 92 +- libcpu/risc-v/e310/context_gcc.S | 18 +- libcpu/risc-v/e310/entry_gcc.S | 18 +- libcpu/risc-v/e310/stack.c | 18 +- libcpu/rx/context_iar.S | 8 +- libcpu/rx/cpuport.c | 70 +- libcpu/ti-dsp/c28x/cpuport.c | 2 +- libcpu/unicore32/sep6200/context_gcc.S | 18 +- libcpu/unicore32/sep6200/cpu.c | 124 +- libcpu/unicore32/sep6200/interrupt.c | 144 +- libcpu/unicore32/sep6200/sep6200.h | 236 +- libcpu/unicore32/sep6200/serial.c | 422 ++- libcpu/unicore32/sep6200/serial.h | 84 +- libcpu/unicore32/sep6200/stack.c | 94 +- libcpu/unicore32/sep6200/start_gcc.S | 18 +- libcpu/unicore32/sep6200/trace.c | 18 +- libcpu/unicore32/sep6200/trap.c | 86 +- libcpu/xilinx/microblaze/cpu.c | 4 +- libcpu/xilinx/microblaze/serial.c | 448 +-- libcpu/xilinx/microblaze/stack.c | 72 +- libcpu/xilinx/microblaze/trap.c | 202 +- src/Kconfig | 2 +- src/clock.c | 4 +- src/components.c | 8 +- src/cpu.c | 2 +- src/device.c | 35 +- src/idle.c | 83 +- src/ipc.c | 129 +- src/irq.c | 6 +- src/kservice.c | 25 +- src/mem.c | 8 +- src/memheap.c | 18 +- src/mempool.c | 14 +- src/object.c | 93 +- src/scheduler.c | 20 +- src/signal.c | 2 +- src/slab.c | 2 +- src/thread.c | 107 +- src/timer.c | 147 +- tools/auto-ci.py | 1 - tools/building.py | 11 +- tools/eclipse.py | 54 +- tools/gcc.py | 14 +- tools/keil.py | 3 + tools/menuconfig.py | 42 +- tools/mkdist.py | 2 +- tools/rtthread.mk | 17 + tools/utils.py | 2 +- 1793 files changed, 19512 insertions(+), 90905 deletions(-) create mode 100644 .github/workflows/action.yml delete mode 100644 .travis.yml rename components/cplusplus/{Mutex.cpp => cxx_Mutex.cpp} (91%) rename components/cplusplus/{Semaphore.cpp => cxx_Semaphore.cpp} (91%) rename components/cplusplus/{Thread.cpp => cxx_Thread.cpp} (97%) rename components/cplusplus/{crt.cpp => cxx_crt.cpp} (90%) delete mode 100644 components/dfs/filesystems/jffs2/SConscript delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/ChangeLog delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/cdl/compress_zlib.cdl delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/include/zconf.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/include/zlib.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/ChangeLog delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/FAQ delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/INDEX delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/Make_vms.com delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/Makefile delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.in delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.riscos delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/README delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/README.eCos delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/adler32.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/algorithm.txt delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/compress.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/configure delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/deflate.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/deflate.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/descrip.mms delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/example.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/gzio.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/infback.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/infblock.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/infblock.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inffast.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inffast.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inffixed.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inflate.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inflate.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/infutil.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/infutil.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/maketree.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/minigzip.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/trees.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/trees.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/uncompr.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/zlib.3 delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/zutil.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/tests/zlib1.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/tests/zlib2.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/zconf.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/compress/zlib.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/crc/crc.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/crc/crc16.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/crc/crc32.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/crc/posix_crc.c delete mode 100644 components/dfs/filesystems/jffs2/cyg/fileio/fileio.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/hal/basetype.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/hal/drv_api.h delete mode 100644 components/dfs/filesystems/jffs2/cyg/infra/cyg_type.h delete mode 100644 components/dfs/filesystems/jffs2/dfs_jffs2.c delete mode 100644 components/dfs/filesystems/jffs2/dfs_jffs2.h delete mode 100644 components/dfs/filesystems/jffs2/include/linux/jffs2.h delete mode 100644 components/dfs/filesystems/jffs2/include/linux/jffs2_fs_i.h delete mode 100644 components/dfs/filesystems/jffs2/include/linux/jffs2_fs_sb.h delete mode 100644 components/dfs/filesystems/jffs2/include/port/codes.h delete mode 100644 components/dfs/filesystems/jffs2/include/port/fcntl.h delete mode 100644 components/dfs/filesystems/jffs2/include/port/sys/stat.h delete mode 100644 components/dfs/filesystems/jffs2/include/port/sys/types.h delete mode 100644 components/dfs/filesystems/jffs2/jffs2_config.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/asm/atomic.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/asm/bug.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/asm/page.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/asm/semaphore.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/TODO delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/compiler.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/completion.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/config.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/crc32.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/errno.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/fs.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/init.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/kernel.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/list.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/mtd/compatmac.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/mtd/mtd.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/pagemap.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/rbtree.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/rwsem.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/sched.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/slab.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/spinlock.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/stat.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/string.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/timer.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/types.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/version.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/vmalloc.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/wait.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/workqueue.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/zlib.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/linux/zutil.h delete mode 100644 components/dfs/filesystems/jffs2/kernel/rbtree.c delete mode 100644 components/dfs/filesystems/jffs2/porting.c delete mode 100644 components/dfs/filesystems/jffs2/porting.h delete mode 100644 components/dfs/filesystems/jffs2/src/LICENCE delete mode 100644 components/dfs/filesystems/jffs2/src/build.c delete mode 100644 components/dfs/filesystems/jffs2/src/compr.c delete mode 100644 components/dfs/filesystems/jffs2/src/compr.h delete mode 100644 components/dfs/filesystems/jffs2/src/compr_rtime.c delete mode 100644 components/dfs/filesystems/jffs2/src/compr_rubin.c delete mode 100644 components/dfs/filesystems/jffs2/src/compr_rubin.h delete mode 100644 components/dfs/filesystems/jffs2/src/compr_zlib.c delete mode 100644 components/dfs/filesystems/jffs2/src/debug.c delete mode 100644 components/dfs/filesystems/jffs2/src/debug.h delete mode 100644 components/dfs/filesystems/jffs2/src/dir-ecos.c delete mode 100644 components/dfs/filesystems/jffs2/src/dir.txt delete mode 100644 components/dfs/filesystems/jffs2/src/erase.c delete mode 100644 components/dfs/filesystems/jffs2/src/flashio.c delete mode 100644 components/dfs/filesystems/jffs2/src/fs-ecos.c delete mode 100644 components/dfs/filesystems/jffs2/src/gc.c delete mode 100644 components/dfs/filesystems/jffs2/src/gcthread.c delete mode 100644 components/dfs/filesystems/jffs2/src/histo.h delete mode 100644 components/dfs/filesystems/jffs2/src/histo_mips.h delete mode 100644 components/dfs/filesystems/jffs2/src/malloc-ecos.c delete mode 100644 components/dfs/filesystems/jffs2/src/nodelist.c delete mode 100644 components/dfs/filesystems/jffs2/src/nodelist.h delete mode 100644 components/dfs/filesystems/jffs2/src/nodemgmt.c delete mode 100644 components/dfs/filesystems/jffs2/src/os-ecos.h delete mode 100644 components/dfs/filesystems/jffs2/src/os-rtthread.h delete mode 100644 components/dfs/filesystems/jffs2/src/pushpull.h delete mode 100644 components/dfs/filesystems/jffs2/src/read.c delete mode 100644 components/dfs/filesystems/jffs2/src/readinode.c delete mode 100644 components/dfs/filesystems/jffs2/src/scan.c delete mode 100644 components/dfs/filesystems/jffs2/src/write.c delete mode 100644 components/dfs/filesystems/uffs/AUTHORS delete mode 100644 components/dfs/filesystems/uffs/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/COPYING delete mode 100644 components/dfs/filesystems/uffs/Doxyfile delete mode 100644 components/dfs/filesystems/uffs/README delete mode 100644 components/dfs/filesystems/uffs/SConscript delete mode 100644 components/dfs/filesystems/uffs/TODO delete mode 100644 components/dfs/filesystems/uffs/dfs_uffs.c delete mode 100644 components/dfs/filesystems/uffs/dfs_uffs.h delete mode 100644 components/dfs/filesystems/uffs/doc/Understanding-UFFS.odp delete mode 100644 components/dfs/filesystems/uffs/doc/Understanding-UFFS.pdf delete mode 100644 components/dfs/filesystems/uffs/doc/uffs-serial-num-relationship.JPG delete mode 100644 components/dfs/filesystems/uffs/src/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/emu/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/emu/cmdline.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/cmdline.h delete mode 100644 components/dfs/filesystems/uffs/src/emu/helper_cmds.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/test_cmds.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem.h delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw_auto.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_soft.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem_share.c delete mode 100644 components/dfs/filesystems/uffs/src/emu/uffs_fileem_wrap.c delete mode 100644 components/dfs/filesystems/uffs/src/example/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/example/flash-interface-example.c delete mode 100644 components/dfs/filesystems/uffs/src/example/static-mem-allocate.c delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_badblock.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_blockinfo.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_buf.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_core.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_crc.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_device.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_ecc.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_fd.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_find.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_flash.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_fs.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_mem.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_mtb.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_os.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_pool.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_public.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_tree.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_types.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_utils.h delete mode 100644 components/dfs/filesystems/uffs/src/inc/uffs/uffs_version.h delete mode 100644 components/dfs/filesystems/uffs/src/platform/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/platform/posix/uffs_config.h delete mode 100644 components/dfs/filesystems/uffs/src/platform/posix/uffs_os.c delete mode 100644 components/dfs/filesystems/uffs/src/platform/win32/uffs_config.h delete mode 100644 components/dfs/filesystems/uffs/src/platform/win32/uffs_os.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_badblock.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_blockinfo.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_buf.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_crc.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_debug.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_device.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_ecc.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_fd.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_find.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_flash.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_fs.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_init.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_mem.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_mtb.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_pool.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_public.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_tree.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_utils.c delete mode 100644 components/dfs/filesystems/uffs/src/uffs/uffs_version.c delete mode 100644 components/dfs/filesystems/uffs/src/utils/CMakeLists.txt delete mode 100644 components/dfs/filesystems/uffs/src/utils/mkuffs.c delete mode 100644 components/dfs/filesystems/uffs/tools/chomp_uffs_perror.rb delete mode 100644 components/dfs/filesystems/uffs/tools/format_code.rb delete mode 100644 components/dfs/filesystems/uffs/tools/make_package.sh delete mode 100644 components/dfs/filesystems/uffs/uffs_config.h delete mode 100644 components/dfs/filesystems/uffs/uffs_nandif.c delete mode 100644 components/dfs/filesystems/uffs/uffs_rtthread.c rename components/drivers/usb/usbdevice/core/{core.c => usbdevice_core.c} (96%) rename components/drivers/usb/usbhost/core/{core.c => usbhost_core.c} (94%) create mode 100644 components/libc/compilers/armlibc/README.md create mode 100644 components/libc/compilers/armlibc/sys/ioctl.h delete mode 100644 components/libc/compilers/armlibc/termios.h create mode 100644 components/libc/compilers/common/readme.md rename components/libc/compilers/{newlib => common}/termios.h (64%) create mode 100644 components/libc/compilers/common/unistd.c delete mode 100644 components/libc/compilers/dlib/termios.h create mode 100644 components/libc/compilers/newlib/README.md delete mode 100644 components/libc/compilers/newlib/time.c delete mode 100644 components/net/lwip-2.1.0/READTEST.md delete mode 100644 components/net/lwip-2.1.0/doc/FILES delete mode 100644 components/net/lwip-2.1.0/doc/NO_SYS_SampleCode.c delete mode 100644 components/net/lwip-2.1.0/doc/ZeroCopyRx.c delete mode 100644 components/net/lwip-2.1.0/doc/contrib.txt delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/generate.bat delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/generate.sh delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile.cmake.in delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/main_page.h delete mode 100644 components/net/lwip-2.1.0/doc/doxygen/output/index.html delete mode 100644 components/net/lwip-2.1.0/doc/mdns.txt delete mode 100644 components/net/lwip-2.1.0/doc/mqtt_client.txt delete mode 100644 components/net/lwip-2.1.0/doc/ppp.txt delete mode 100644 components/net/lwip-2.1.0/doc/savannah.txt delete mode 100644 components/net/lwip-2.1.0/src/apps/README.md rename components/net/{lwip-2.1.0 => lwip-2.1.2}/CHANGELOG (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/CMakeLists.txt (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/COPYING (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/FEATURES (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/FILES (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/README (100%) create mode 100644 components/net/lwip-2.1.2/README_RT-THREAD.md rename components/net/{lwip-2.1.0 => lwip-2.1.2}/SConscript (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/UPGRADING (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/FILES (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/Filelists.cmake (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/Filelists.mk (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/api_lib.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/api_msg.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/err.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/if_api.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/netbuf.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/netdb.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/netifapi.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/sockets.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/api/tcpip.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/altcp_tls/altcp_tls_mbedtls.c (97%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/altcp_proxyconnect.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fs.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fs/404.html (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fs/img/sics.gif (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fs/index.html (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fsdata.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/fsdata.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/http_client.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/httpd.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/httpd_structs.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/makefsdata/makefsdata (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/makefsdata/makefsdata.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/makefsdata/readme.txt (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/http/makefsdata/tinydir.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/lwiperf/lwiperf.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/mdns/mdns.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/mqtt/mqtt.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/netbiosns/netbiosns.c (92%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/ping/ping.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/smtp/smtp.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_asn1.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_asn1.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_core.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_core_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_icmp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_interfaces.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_ip.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_snmp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_system.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_tcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_mib2_udp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_msg.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_msg.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_netconn.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_pbuf_stream.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_pbuf_stream.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_raw.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_scalar.c (94%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_snmpv2_framework.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_snmpv2_usm.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_table.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_threadsync.c (91%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmp_traps.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmpv3.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmpv3_mbedtls.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/snmp/snmpv3_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/sntp/sntp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/tftp/tftp_port.c (62%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/apps/tftp/tftp_server.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/include/arch/bpstruct.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/include/arch/cc.h (90%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/include/arch/epstruct.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/include/arch/perf.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/include/arch/sys_arch.h (84%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/arch/sys_arch.c (98%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/altcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/altcp_alloc.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/altcp_tcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/def.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/dns.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/inet_chksum.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/init.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ip.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/autoip.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/dhcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/etharp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/icmp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/igmp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/ip4.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/ip4_addr.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv4/ip4_frag.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/dhcp6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/ethip6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/icmp6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/inet6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/ip6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/ip6_addr.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/ip6_frag.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/mld6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/ipv6/nd6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/mem.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/memp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/netif.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/pbuf.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/raw.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/stats.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/sys.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/tcp.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/tcp_in.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/tcp_out.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/timeouts.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/core/udp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/compat/posix/arpa/inet.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/compat/posix/net/if.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/compat/posix/netdb.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/compat/posix/sys/socket.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/compat/stdc/errno.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/altcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/altcp_tcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/altcp_tls.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/api.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/FILES (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/altcp_proxyconnect.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/altcp_tls_mbedtls_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/fs.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/http_client.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/httpd.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/httpd_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/lwiperf.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mdns.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mdns_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mdns_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mqtt.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mqtt_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/mqtt_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/netbiosns.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/netbiosns_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/smtp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/smtp_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_core.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_mib2.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_scalar.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_snmpv2_framework.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_snmpv2_usm.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_table.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmp_threadsync.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/snmpv3.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/sntp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/sntp_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/tftp_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/apps/tftp_server.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/arch.h (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/autoip.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/debug.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/def.h (94%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/dhcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/dhcp6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/dns.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/err.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/errno.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/etharp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ethip6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/icmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/icmp6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/if_api.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/igmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/inet.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/inet_chksum.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/init.h (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/init.h.cmake.in (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip4.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip4_addr.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip4_frag.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip6_addr.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip6_frag.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip6_zone.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/ip_addr.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/mem.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/memp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/mld6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/nd6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/netbuf.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/netdb.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/netif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/netifapi.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/opt.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/pbuf.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/altcp_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/api_msg.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/mem_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/memp_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/memp_std.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/nd6_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/raw_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/sockets_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/tcp_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/priv/tcpip_priv.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/autoip.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/dhcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/dhcp6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/dns.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/etharp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/ethernet.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/iana.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/icmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/icmp6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/ieee.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/igmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/ip.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/ip4.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/ip6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/mld6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/nd6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/tcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/prot/udp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/raw.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/sio.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/snmp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/sockets.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/stats.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/sys.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/tcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/tcpbase.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/tcpip.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/timeouts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/lwip/udp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/bridgeif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/bridgeif_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/etharp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ethernet.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ethernetif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ieee802154.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/lowpan6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/lowpan6_ble.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/lowpan6_common.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/lowpan6_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ccp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/chap-md5.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/chap-new.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/chap_ms.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/eap.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ecp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/eui64.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/fsm.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ipcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ipv6cp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/lcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/magic.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/mppe.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/polarssl/arc4.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/polarssl/des.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/polarssl/md4.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/polarssl/md5.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/polarssl/sha1.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ppp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ppp_impl.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/ppp_opts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppapi.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppcrypt.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppdebug.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppoe.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppol2tp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/pppos.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/upap.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/ppp/vj.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/slipif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/include/netif/zepif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/lwipopts.h (98%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/lwippools.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/FILES (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/bridgeif.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/bridgeif_fdb.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ethernet.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ethernetif.c (94%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/lowpan6.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/lowpan6_ble.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/lowpan6_common.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/PPPD_FOLLOWUP (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/auth.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/ccp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/chap-md5.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/chap-new.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/chap_ms.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/demand.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/eap.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/ecp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/eui64.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/fsm.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/ipcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/ipv6cp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/lcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/magic.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/mppe.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/multilink.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/README (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/arc4.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/des.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/md4.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/md5.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/polarssl/sha1.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/ppp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/pppapi.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/pppcrypt.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/pppoe.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/pppol2tp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/pppos.c (99%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/upap.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/utils.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/ppp/vj.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/slipif.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/src/netif/zepif.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/Makefile (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/README (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/config.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/fuzz.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/lwipopts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/fuzz/output_to_pcap.sh (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/sockets/sockets_stresstest.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/sockets/sockets_stresstest.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/Filelists.cmake (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/Filelists.mk (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/api/test_sockets.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/api/test_sockets.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/arch/sys_arch.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/arch/sys_arch.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_def.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_def.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_mem.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_mem.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_netif.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_netif.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_pbuf.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_pbuf.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_timers.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/core/test_timers.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/dhcp/test_dhcp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/dhcp/test_dhcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/etharp/test_etharp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/etharp/test_etharp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/ip4/test_ip4.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/ip4/test_ip4.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/ip6/test_ip6.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/ip6/test_ip6.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/lwip_check.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/lwip_unittests.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/lwipopts.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/mdns/test_mdns.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/mdns/test_mdns.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/mqtt/test_mqtt.c (96%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/mqtt/test_mqtt.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/tcp_helper.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/tcp_helper.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/test_tcp.c (97%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/test_tcp.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/test_tcp_oos.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/tcp/test_tcp_oos.h (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/udp/test_udp.c (100%) rename components/net/{lwip-2.1.0 => lwip-2.1.2}/test/unit/udp/test_udp.h (100%) delete mode 100644 libcpu/arm/s3c24x0/serial.c delete mode 100644 libcpu/arm/s3c24x0/serial.h delete mode 100644 libcpu/arm/zynq7000/SConscript delete mode 100644 libcpu/arm/zynq7000/armv7.h delete mode 100644 libcpu/arm/zynq7000/context_gcc.S delete mode 100644 libcpu/arm/zynq7000/cp15.h delete mode 100644 libcpu/arm/zynq7000/cp15_gcc.S delete mode 100644 libcpu/arm/zynq7000/cpu.c delete mode 100644 libcpu/arm/zynq7000/gic.c delete mode 100644 libcpu/arm/zynq7000/gic.h delete mode 100644 libcpu/arm/zynq7000/interrupt.c delete mode 100644 libcpu/arm/zynq7000/interrupt.h delete mode 100644 libcpu/arm/zynq7000/mmu.c delete mode 100644 libcpu/arm/zynq7000/stack.c delete mode 100644 libcpu/arm/zynq7000/start_gcc.S delete mode 100644 libcpu/arm/zynq7000/trap.c delete mode 100644 libcpu/arm/zynq7000/vector_gcc.S delete mode 100644 libcpu/mips/x1000/cache.c delete mode 100644 libcpu/mips/x1000/cache.h delete mode 100644 libcpu/mips/x1000/cpu.c delete mode 100644 libcpu/mips/x1000/interrupt.c delete mode 100644 libcpu/mips/x1000/mips_backtrace.c delete mode 100644 libcpu/mips/x1000/mips_cache_gcc.S delete mode 100644 libcpu/mips/x1000/mips_context_gcc.S delete mode 100644 libcpu/mips/x1000/mips_excpt.c delete mode 100644 libcpu/mips/x1000/mips_excpt_gcc.S delete mode 100644 libcpu/mips/x1000/mips_fp_gcc.S delete mode 100644 libcpu/mips/x1000/stack.c delete mode 100644 libcpu/mips/x1000/startup_gcc.S delete mode 100644 libcpu/mips/x1000/x1000.h delete mode 100644 libcpu/mips/x1000/x1000_aic.h delete mode 100644 libcpu/mips/x1000/x1000_cpm.h delete mode 100644 libcpu/mips/x1000/x1000_intc.h delete mode 100644 libcpu/mips/x1000/x1000_otg_dwc.h delete mode 100644 libcpu/mips/x1000/x1000_slcdc.h delete mode 100644 libcpu/mips/xburst/SConscript delete mode 100644 libcpu/mips/xburst/cache.c delete mode 100644 libcpu/mips/xburst/cache.h delete mode 100644 libcpu/mips/xburst/cache_gcc.S delete mode 100644 libcpu/mips/xburst/context_gcc.S delete mode 100644 libcpu/mips/xburst/cpu.c delete mode 100644 libcpu/mips/xburst/exception.c delete mode 100644 libcpu/mips/xburst/interrupt.c delete mode 100644 libcpu/mips/xburst/mipscfg.c delete mode 100644 libcpu/mips/xburst/stack.c delete mode 100644 libcpu/mips/xburst/stack.h delete mode 100644 libcpu/mips/xburst/start_gcc.S delete mode 100644 libcpu/mips/xburst/x1000.h diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml new file mode 100644 index 000000000..613b24c3b --- /dev/null +++ b/.github/workflows/action.yml @@ -0,0 +1,140 @@ +name: RT-Thread + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the lts-v3.1.x branch +on: + # Runs at 16:00 UTC (BeiJing 00:00) on the 1st of every month + schedule: + - cron: '0 16 1 * *' + push: + branches: + - lts-v3.1.x + paths-ignore: + - documentation/** + - '**/README.md' + - '**/README_zh.md' + pull_request: + branches: + - lts-v3.1.x + paths-ignore: + - documentation/** + - '**/README.md' + - '**/README_zh.md' + +jobs: + build: + runs-on: ubuntu-latest + name: ${{ matrix.legs.RTT_BSP }} + strategy: + fail-fast: false + matrix: + legs: + - {RTT_BSP: "CME_M7", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "apollo2", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "asm9260t", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "at91sam9260", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "allwinner_tina", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "efm32", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "gd32303e-eval", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "gd32450z-eval", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "imx6sx/cortex-a9", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "imxrt/imxrt1052-atk-commander", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "imxrt/imxrt1052-fire-pro", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "imxrt/imxrt1052-nxp-evk", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lm3s8962", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lm4f232", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc43xx/M4", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc178x", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc408x", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc2148", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc2478", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc5410x", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "lpc54114-lite", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "ls1bdev", RTT_TOOL_CHAIN: "sourcery-mips"} + - {RTT_BSP: "ls1cdev", RTT_TOOL_CHAIN: "sourcery-mips"} + - {RTT_BSP: "mb9bf500r", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "mb9bf506r", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "mb9bf618s", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "mb9bf568r", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "qemu-vexpress-a9", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "qemu-vexpress-gemini", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f072-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f091-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-atk-nano", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-atk-warshipv3", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-dofly-lyc8", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-dofly-M3S", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-fire-arbitrary", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-hw100k-ibox", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-mini-system", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f103-yf-ufun", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f107-uc-eval", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f401-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f405-smdz-breadfruit", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f407-atk-explorer", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f407-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f411-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f427-robomaster-a", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f429-armfly-v6", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f429-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f429-fire-challenger", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f429-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f446-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f469-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f746-st-disco", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f767-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f767-fire-challenger", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32f767-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32g071-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32g431-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32h743-atk-apollo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32h743-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l4r9-st-eval", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l432-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l475-atk-pandora", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l475-st-discovery", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l476-st-nucleo", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "stm32/stm32l496-ali-developer", RTT_TOOL_CHAIN: "sourcery-arm"} + - {RTT_BSP: "swm320-lq100", RTT_TOOL_CHAIN: "sourcery-arm"} + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@master + with: + python-version: 3.8 + + - name: Install Tools + shell: bash + run: | + sudo apt-get update + sudo apt-get -qq install gcc-multilib libsdl-dev scons + echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV + echo "RTT_CC=gcc" >> $GITHUB_ENV + + - name: Install Arm ToolChains + if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && success() }} + shell: bash + run: | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/arm-2017q2-v6/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 + sudo tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt + /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version + echo "RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin" >> $GITHUB_ENV + + - name: Install Mips ToolChains + if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-mips' && success() }} + shell: bash + run: | + wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 + sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt + /opt/mips-2016.05/bin/mips-sde-elf-gcc --version + echo "RTT_EXEC_PATH=/opt/mips-2016.05/bin" >> $GITHUB_ENV + + - name: Bsp Scons Compile + if: ${{ success() }} + shell: bash + env: + RTT_BSP: ${{ matrix.legs.RTT_BSP }} + RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }} + run: | + scons -C bsp/$RTT_BSP diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b03d93f07..000000000 --- a/.travis.yml +++ /dev/null @@ -1,125 +0,0 @@ -language: c - -notifications: - email: false - -before_script: -# travis has changed to 64-bit and we require 32-bit compatibility libraries - - sudo apt-get update - # clang - - "sudo apt-get -qq install gcc-multilib libc6:i386 libgcc1:i386 libstdc++5:i386 libstdc++6:i386 libsdl-dev scons || true" - # - sudo apt-get -qq install gcc-arm-none-eabi - # - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && export RTT_EXEC_PATH=/usr/bin && arm-none-eabi-gcc --version || true" - # - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/arm-none-eabi/arm-2014.05-28-arm-none-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/arm-2014.05/bin && /opt/arm-2014.05/bin/arm-none-eabi-gcc --version || true" - - "[ $RTT_TOOL_CHAIN = 'sourcery-arm' ] && wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/arm-2017q2-v6/gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 && sudo tar xjf gcc-arm-none-eabi-6-2017-q2-update-linux.tar.bz2 -C /opt && export RTT_EXEC_PATH=/opt/gcc-arm-none-eabi-6-2017-q2-update/bin && /opt/gcc-arm-none-eabi-6-2017-q2-update/bin/arm-none-eabi-gcc --version || true" - - "[ $RTT_TOOL_CHAIN = 'sourcery-mips' ] && wget -q https://github.com/RT-Thread/toolchains-ci/releases/download/v1.1/mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 && sudo tar xjf mips-2016.05-7-mips-sde-elf-i686-pc-linux-gnu.tar.bz2 -C /opt && export RTT_EXEC_PATH=/opt/mips-2016.05/bin && /opt/mips-2016.05/bin/mips-sde-elf-gcc --version || true" - # - "[ $RTT_TOOL_CHAIN = 'sourcery-ppc' ] && curl -s https://sourcery.mentor.com/public/gnu_toolchain/powerpc-eabi/freescale-2011.03-39-powerpc-eabi-i686-pc-linux-gnu.tar.bz2 | sudo tar xjf - -C /opt && export RTT_EXEC_PATH=/opt/freescale-2011.03/bin && /opt/freescale-2011.03/bin/powerpc-eabi-gcc --version || true" - # - "[ $RTT_TOOL_CHAIN = 'atmel-avr32' ] && curl -s http://www.atmel.com/images/avr32-gnu-toolchain-3.4.1.348-linux.any.x86.tar.gz | sudo tar xzf - -C /opt && export RTT_EXEC_PATH=/opt/avr32-gnu-toolchain-linux_x86/bin && /opt/avr32-gnu-toolchain-linux_x86/bin/avr32-gcc --version && curl -sO http://www.atmel.com/images/avr-headers-3.2.3.970.zip && unzip -qq avr-headers-3.2.3.970.zip -d bsp/$RTT_BSP || true" - - export RTT_ROOT=`pwd` - - "[ x$RTT_CC == x ] && export RTT_CC='gcc' || true" - -env: -# - RTT_BSP='simulator' RTT_CC='clang-analyze' RTT_EXEC_PATH=/usr/share/clang/scan-build - - RTT_BSP='CME_M7' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='apollo2' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='asm9260t' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='at91sam9260' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='allwinner_tina' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='avr32uc3b0' RTT_TOOL_CHAIN='atmel-avr32' -# - RTT_BSP='bf533' # no scons - - RTT_BSP='efm32' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='es32f0334' RTT_TOOL_CHAIN='sourcery-arm' # not support gcc -# - RTT_BSP='es32f0654' RTT_TOOL_CHAIN='sourcery-arm' # not support gcc - - RTT_BSP='gd32303e-eval' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='gd32450z-eval' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='gkipc' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='imx6sx/cortex-a9' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='imxrt/imxrt1052-atk-commander' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='imxrt/imxrt1052-fire-pro' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='imxrt/imxrt1052-nxp-evk' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lm3s8962' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lm3s9b9x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lm4f232' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='tm4c129x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc43xx/M4' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc176x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc178x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc408x' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='lpc824' RTT_TOOL_CHAIN='sourcery-arm' # not support gcc - - RTT_BSP='lpc2148' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc2478' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc5410x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='lpc54114-lite' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='lpc54608-LPCXpresso' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='ls1bdev' RTT_TOOL_CHAIN='sourcery-mips' - - RTT_BSP='ls1cdev' RTT_TOOL_CHAIN='sourcery-mips' -# - RTT_BSP='m16c62p' # m32c - - RTT_BSP='mb9bf500r' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='mb9bf506r' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='mb9bf618s' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='mb9bf568r' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='microblaze' # no scons - - RTT_BSP='mini2440' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='mini4020' # no scons -# - RTT_BSP='mm32l07x' # not support gcc -# - RTT_BSP='nios_ii' # no scons - - RTT_BSP='nuvoton_nuc472' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='nuvoton_m05x' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='pic32ethernet' # no scons - - RTT_BSP='qemu-vexpress-a9' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='qemu-vexpress-gemini' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='sam7x' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='simulator' # x86 - - RTT_BSP='stm32/stm32f072-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f091-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-atk-nano' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-atk-warshipv3' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-dofly-lyc8' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-dofly-M3S' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-fire-arbitrary' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-hw100k-ibox' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-mini-system' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f103-yf-ufun' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f107-uc-eval' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f401-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f405-smdz-breadfruit' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f407-atk-explorer' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f407-st-discovery' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f411-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f427-robomaster-a' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f429-armfly-v6' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f429-atk-apollo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f429-fire-challenger' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f429-st-disco' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f446-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f469-st-disco' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f746-st-disco' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f767-atk-apollo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f767-fire-challenger' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32f767-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32g071-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32g431-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32h743-atk-apollo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32h743-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l4r9-st-eval' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l053-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l432-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l475-atk-pandora' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l475-st-discovery' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l476-st-nucleo' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32/stm32l496-ali-developer' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='stm32f20x' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='swm320-lq100' RTT_TOOL_CHAIN='sourcery-arm' -# - RTT_BSP='taihu' RTT_TOOL_CHAIN='sourcery-ppc' -# - RTT_BSP='upd70f3454' # iar -# - RTT_BSP='x86' # x86 - - RTT_BSP='beaglebone' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='zynq7000' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='frdm-k64f' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='fh8620' RTT_TOOL_CHAIN='sourcery-arm' - - RTT_BSP='x1000' RTT_TOOL_CHAIN='sourcery-mips' - - RTT_BSP='xplorer4330/M4' RTT_TOOL_CHAIN='sourcery-arm' - -stage: compile -script: - - scons -C bsp/$RTT_BSP diff --git a/ChangeLog.md b/ChangeLog.md index 23dc40d1b..8ef0b8028 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,89 @@ +# RT-Thread v3.1.5 Change Log + +Change log since v3.1.4 + +## Kernel + +* Fix the issue when block = NULL in rt_mp_free; +* Fix the software issue when the system timer thread is pending +* Fix the timer/software timer handling issue if the timeout function starts/stops/deletes this timer. +* Fix an issue with rt_timer_start being broken and destroying the timer list +* Fix bug of rt_memheap_detach +* Fix the bug that the linked list is still mounted when the single timer is not modified +* Fix the delay_until issue +* Add mb mq value overflow-check code +* Fix the rt_event_recv function, if the event met without blocking, assigning thread->event_set/event_info will goes well +* Add the definition of the maximum value of ipc type +* Fix the delay_until issue +* fixed __rt_ffs bug on account of armclang LTO. +* fixed rt_timer_list_next_timeout multi-task safe +* fix the software issue when the system timer thread pending. +* Fix the timer/software timer handling issue if the timeout function starts/stops/deletes this timer. +* The cleanup operation is executed before the current thread exits +* Modify cleanup to resolve the issue of unable to free memory and communication between threads +* Fix double release for thread +* Fix thread control bug about `RT_THREAD_CTRL_CLOSE` command +* Fix the issue of critical protection when `rt_thread_delete` change the status of thread; +* Fix bug in rt_realloc of mem.c, which may cause memory leak +* Use object_find to implement thread_find/device_find +* fix the timer code depends on c99 + +## Components + +* Change rt_data_queue_peak to rt_data_queue_peek. +* Add rt_data_queue_deinit and fix bug of dataqueue +* Solve the issue that the do_pollfd function processing the underlying network device returns error -1 +* Fix the issue that when the network card device calls to close dhcp, the bottom layer no need to call the dhcp_stop function to close dhcp +* Modify the spelling error of the macro definition, modify the printing error when printing the IMEI number +* Fix the issue that the server closed the connection when web socket requests the data that comes back from the server, and the socket status is incorrectly judged at that point +* Fix the issue of incorrect sal_getaddrinfo release when sal socket supports multiple network cards +* Adjust where the AT socket callback function +* Fix at_client, avoid creating the same client repeatedly and prevent working exceptions and memory leaks. +* Fix the bug that rx_notice out of sync when the data is received after last rt_device_read() is zero +* Change the header file included in some libc files from to to narrow the scope of inclusion to prevent recursive compilation +* [jffs2] modify the error check of rt_event_recv() +* [audio] Fix compile warning, undefine var, and fixed re-include of audio +* [serial] Fix the crash caused when the serial port receiving buffer is full and ULOG_USING_ISR_LOG is not turned on +* [spi] Fix "response+1" causing hard fault of unaligned access to SPI memory of STM32 HAL library +* [hwtimer] When getting the timer count, prevent overflow update due to the interruption +* [dirver/i2c] i2c driver supports bus lock, STOP control +* [usb] Fix bug in device descriptor that MAC OS enumeration failed +* Fix the bug that USB cannot recognize composite device normally +* Fix USB host core bugs + * Limit >4 USB ports hubs + * Double free intf + * dname buffer size is too small + * Reset child pointer after detaching instance +* remove jffs +* remove uffs + +## BSP and CPU porting + +* Add license info and code cleanup for vexpress-a9 BSP +* Fix spelling mistakes of code +* [allwinner_tina]Fix spi driver bug +* Optimize BSP dist handle process +* fixed a bug that caused system crash by changing the run_mode in low power mode +* drv_flash_f7.c supports single bank mode +* Optimize the pin-index algorithm for stm32 +* Fix the clock configuration issue of STM32 hardware timer +* Adjust the interrupt priority configuration of some peripherals of the STM32 series BSP +* Fix stm32 f1 series rtc bug +* Fix PWM timer init about pwm +* remove zynq7000 +* delete stm32f20x/fh8620/gkipc/realview-a8 +* update sam7x/simulator/qemu-vexpress-a9/imx6ul +* add Copyright_Notice.md + +## Tools + +* Fixed python 2.x `cmp` +* Rename GCC_VERSION to GCC_VERSION_STR +* Optimize project group sort by name +* Improve the logic of generating `rtconfig.h` files in scons with command `scons --menuconfig` +* Fixed an issue that *.s src files couldn't be compiled +* Fixed c99/siginfo_t issue caused by gcc_version + # RT-Thread v3.1.4 Change Log Change log since v3.1.3 diff --git a/bsp/qemu-vexpress-a9/applications/SConscript b/bsp/qemu-vexpress-a9/applications/SConscript index 2ec6848e1..c583d3016 100644 --- a/bsp/qemu-vexpress-a9/applications/SConscript +++ b/bsp/qemu-vexpress-a9/applications/SConscript @@ -1,10 +1,8 @@ -Import('RTT_ROOT') -Import('rtconfig') from building import * cwd = GetCurrentDir() src = Glob('*.c') + Glob('*.cpp') -CPPPATH = [cwd, str(Dir('#'))] +CPPPATH = [cwd] group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) diff --git a/bsp/qemu-vexpress-a9/applications/lcd_init.c b/bsp/qemu-vexpress-a9/applications/lcd_init.c index 6a870440a..7d2d74a08 100644 --- a/bsp/qemu-vexpress-a9/applications/lcd_init.c +++ b/bsp/qemu-vexpress-a9/applications/lcd_init.c @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020/12/31 Bernard Add license info + */ + #include #if defined(RT_USING_RTGUI) || defined(PKG_USING_GUIENGINE) diff --git a/bsp/qemu-vexpress-a9/applications/main.c b/bsp/qemu-vexpress-a9/applications/main.c index d59513bce..c0c1e34d9 100644 --- a/bsp/qemu-vexpress-a9/applications/main.c +++ b/bsp/qemu-vexpress-a9/applications/main.c @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020/12/31 Bernard Add license info + */ + #include #include #include diff --git a/bsp/qemu-vexpress-a9/applications/mnt.c b/bsp/qemu-vexpress-a9/applications/mnt.c index de2cd0b87..be3ee236f 100644 --- a/bsp/qemu-vexpress-a9/applications/mnt.c +++ b/bsp/qemu-vexpress-a9/applications/mnt.c @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020/12/31 Bernard Add license info + */ + #include #ifdef RT_USING_DFS diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c index 46ea2e0fe..bf6c1604b 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.c @@ -1,21 +1,7 @@ /* - * File : drv_ac97.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h index 31d496024..8a63b92e4 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_ac97.h @@ -1,21 +1,7 @@ /* - * File : drv_ac97.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -26,33 +12,33 @@ #define __DRV_AC97_H__ /* Register offsets */ -#define AC97_RESET 0x00 -#define AC97_MASTER 0x02 -#define AC97_HEADPHONE 0x04 -#define AC97_MASTER_MONO 0x06 -#define AC97_MASTER_TONE 0x08 -#define AC97_PC_BEEP 0x0A //mixer volume -#define AC97_PHONE 0x0C -#define AC97_MIC 0x0E //qwert db -#define AC97_LINE 0x10 -#define AC97_CD 0x12 -#define AC97_VIDEO 0x14 -#define AC97_AUX 0x16 -#define AC97_PCM 0x18 -#define AC97_REC_SEL 0x1A //0 represent mic -#define AC97_REC_GAIN 0x1C -#define AC97_REC_GAIN_MIC 0x1E -#define AC97_GENERAL_PURPOSE 0x20 -#define AC97_3D_CONTROL 0x22 -#define AC97_INT_PAGING 0x24 //qwert -#define AC97_POWERDOWN 0x26 -#define AC97_PCM_FRONT_DAC_RATE 0x2c /* PCM Front DAC Rate */ -#define AC97_PCM_SURR_DAC_RATE 0x2e /* PCM Surround DAC Rate */ -#define AC97_PCM_LFE_DAC_RATE 0x30 /* PCM LFE DAC Rate */ -#define AC97_PCM_LR_ADC_RATE 0x32 /* PCM LR ADC Rate */ -#define AC97_PCM_MIC_ADC_RATE 0x34 /* PCM MIC ADC Rate */ -#define AC97_DAC_SLOT_MAP 0x6C -#define AC97_ADC_SLOT_MAP 0x6E +#define AC97_RESET 0x00 +#define AC97_MASTER 0x02 +#define AC97_HEADPHONE 0x04 +#define AC97_MASTER_MONO 0x06 +#define AC97_MASTER_TONE 0x08 +#define AC97_PC_BEEP 0x0A //mixer volume +#define AC97_PHONE 0x0C +#define AC97_MIC 0x0E //qwert db +#define AC97_LINE 0x10 +#define AC97_CD 0x12 +#define AC97_VIDEO 0x14 +#define AC97_AUX 0x16 +#define AC97_PCM 0x18 +#define AC97_REC_SEL 0x1A //0 represent mic +#define AC97_REC_GAIN 0x1C +#define AC97_REC_GAIN_MIC 0x1E +#define AC97_GENERAL_PURPOSE 0x20 +#define AC97_3D_CONTROL 0x22 +#define AC97_INT_PAGING 0x24 //qwert +#define AC97_POWERDOWN 0x26 +#define AC97_PCM_FRONT_DAC_RATE 0x2c /* PCM Front DAC Rate */ +#define AC97_PCM_SURR_DAC_RATE 0x2e /* PCM Surround DAC Rate */ +#define AC97_PCM_LFE_DAC_RATE 0x30 /* PCM LFE DAC Rate */ +#define AC97_PCM_LR_ADC_RATE 0x32 /* PCM LR ADC Rate */ +#define AC97_PCM_MIC_ADC_RATE 0x34 /* PCM MIC ADC Rate */ +#define AC97_DAC_SLOT_MAP 0x6C +#define AC97_ADC_SLOT_MAP 0x6E void ac97_reset(void); rt_err_t ac97_set_vol(int vol); diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c index 0b1ee9827..ad237bbf0 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.c @@ -1,21 +1,7 @@ /* - * File : drv_pl041.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -36,7 +22,7 @@ #include #define FRAME_PERIOD_US (50) -#define PL041_CHANNLE_NUM (4) +#define PL041_CHANNEL_NUM (4) #define PL041_READ(_a) (*(volatile rt_uint32_t *)(_a)) #define PL041_WRITE(_a, _v) (*(volatile rt_uint32_t *)(_a) = (_v)) @@ -47,7 +33,7 @@ struct pl041_irq_def void *user_data; }; -static struct pl041_irq_def irq_tbl[PL041_CHANNLE_NUM]; +static struct pl041_irq_def irq_tbl[PL041_CHANNEL_NUM]; static void aaci_pl041_delay(rt_uint32_t us) { @@ -169,13 +155,13 @@ rt_uint16_t aaci_ac97_read(rt_uint16_t reg) return v; } -int aaci_pl041_channle_disable(int channle) +int aaci_pl041_channel_disable(int channel) { rt_uint32_t v; void *p_rx, *p_tx; - p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channle * 0x14); - p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channle * 0x14); + p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channel * 0x14); + p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channel * 0x14); v = PL041_READ(p_rx); v &= ~AACI_CR_EN; PL041_WRITE(p_rx, v); @@ -185,13 +171,13 @@ int aaci_pl041_channle_disable(int channle) return 0; } -int aaci_pl041_channle_enable(int channle) +int aaci_pl041_channel_enable(int channel) { rt_uint32_t v; void *p_rx, *p_tx; - p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channle * 0x14); - p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channle * 0x14); + p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channel * 0x14); + p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channel * 0x14); v = PL041_READ(p_rx); v |= AACI_CR_EN; PL041_WRITE(p_rx, v); @@ -201,13 +187,13 @@ int aaci_pl041_channle_enable(int channle) return 0; } -int aaci_pl041_channle_read(int channle, rt_uint16_t *buff, int count) +int aaci_pl041_channel_read(int channel, rt_uint16_t *buff, int count) { void *p_data, *p_status; int i = 0; - p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channle * 0x14); - p_data = (void *)((rt_uint32_t)(&(PL041->dr1[0])) + channle * 0x20); + p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channel * 0x14); + p_data = (void *)((rt_uint32_t)(&(PL041->dr1[0])) + channel * 0x20); for (i = 0; (!(PL041_READ(p_status) & AACI_SR_RXFE)) && (i < count); i++) { buff[i] = (rt_uint16_t)PL041_READ(p_data); @@ -215,13 +201,13 @@ int aaci_pl041_channle_read(int channle, rt_uint16_t *buff, int count) return i; } -int aaci_pl041_channle_write(int channle, rt_uint16_t *buff, int count) +int aaci_pl041_channel_write(int channel, rt_uint16_t *buff, int count) { void *p_data, *p_status; int i = 0; - p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channle * 0x14); - p_data = (void *)((rt_uint32_t)(&(PL041->dr1[0])) + channle * 0x20); + p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channel * 0x14); + p_data = (void *)((rt_uint32_t)(&(PL041->dr1[0])) + channel * 0x20); for (i = 0; (!(PL041_READ(p_status) & AACI_SR_TXFF)) && (i < count); i++) { PL041_WRITE(p_data, buff[i]); @@ -229,13 +215,13 @@ int aaci_pl041_channle_write(int channle, rt_uint16_t *buff, int count) return i; } -int aaci_pl041_channle_cfg(int channle, pl041_cfg_t cgf) +int aaci_pl041_channel_cfg(int channel, pl041_cfg_t cgf) { rt_uint32_t v; void *p_rx, *p_tx; - p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channle * 0x14); - p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channle * 0x14); + p_rx = (void *)((rt_uint32_t)(&PL041->rxcr1) + channel * 0x14); + p_tx = (void *)((rt_uint32_t)(&PL041->txcr1) + channel * 0x14); v = AACI_CR_FEN | AACI_CR_SZ16 | cgf->itype; PL041_WRITE(p_rx, v); v = AACI_CR_FEN | AACI_CR_SZ16 | cgf->otype; @@ -247,86 +233,86 @@ int aaci_pl041_channle_cfg(int channle, pl041_cfg_t cgf) return 0; } -void aaci_pl041_irq_enable(int channle, rt_uint32_t vector) +void aaci_pl041_irq_enable(int channel, rt_uint32_t vector) { rt_uint32_t v; void *p_irq; vector &= vector & 0x7f; - p_irq = (void *)((rt_uint32_t)(&PL041->iie1) + channle * 0x14); + p_irq = (void *)((rt_uint32_t)(&PL041->iie1) + channel * 0x14); v = PL041_READ(p_irq); v |= vector; PL041_WRITE(p_irq, v); } -void aaci_pl041_irq_disable(int channle, rt_uint32_t vector) +void aaci_pl041_irq_disable(int channel, rt_uint32_t vector) { rt_uint32_t v; void *p_irq; vector &= vector & 0x7f; - p_irq = (void *)((rt_uint32_t)(&PL041->iie1) + channle * 0x14); + p_irq = (void *)((rt_uint32_t)(&PL041->iie1) + channel * 0x14); v = PL041_READ(p_irq); v &= ~vector; PL041_WRITE(p_irq, v); } -rt_err_t aaci_pl041_irq_register(int channle, pl041_irq_fun_t fun, void *user_data) +rt_err_t aaci_pl041_irq_register(int channel, pl041_irq_fun_t fun, void *user_data) { - if (channle < 0 || channle >= PL041_CHANNLE_NUM) + if (channel < 0 || channel >= PL041_CHANNEL_NUM) { - LOG_E("%s channle:%d err.", __FUNCTION__, channle); + LOG_E("%s channel:%d err.", __FUNCTION__, channel); return -RT_ERROR; } - irq_tbl[channle].fun = fun; - irq_tbl[channle].user_data = user_data; + irq_tbl[channel].fun = fun; + irq_tbl[channel].user_data = user_data; return RT_EOK; } -rt_err_t aaci_pl041_irq_unregister(int channle) +rt_err_t aaci_pl041_irq_unregister(int channel) { - if (channle < 0 || channle >= PL041_CHANNLE_NUM) + if (channel < 0 || channel >= PL041_CHANNEL_NUM) { - LOG_E("%s channle:%d err.", __FUNCTION__, channle); + LOG_E("%s channel:%d err.", __FUNCTION__, channel); return -RT_ERROR; } - irq_tbl[channle].fun = RT_NULL; - irq_tbl[channle].user_data = RT_NULL; + irq_tbl[channel].fun = RT_NULL; + irq_tbl[channel].user_data = RT_NULL; return RT_EOK; } static void aaci_pl041_irq_handle(int irqno, void *param) { - rt_uint32_t mask, channle, m; + rt_uint32_t mask, channel, m; struct pl041_irq_def *_irq = param; void *p_status; mask = PL041_READ(&PL041->allints); PL041_WRITE(&PL041->intclr, mask); - for (channle = 0; (channle < PL041_CHANNLE_NUM) && (mask); channle++) + for (channel = 0; (channel < PL041_CHANNEL_NUM) && (mask); channel++) { mask = mask >> 7; m = mask & 0x7f; if (m & AACI_ISR_ORINTR) { - LOG_W("RX overrun on chan %d", channle); + LOG_W("RX overrun on chan %d", channel); } if (m & AACI_ISR_RXTOINTR) { - LOG_W("RX timeout on chan %d", channle); + LOG_W("RX timeout on chan %d", channel); } if (mask & AACI_ISR_URINTR) { - LOG_W("TX underrun on chan %d", channle); + LOG_W("TX underrun on chan %d", channel); } - p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channle * 0x14); - if (_irq[channle].fun != RT_NULL) + p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channel * 0x14); + if (_irq[channel].fun != RT_NULL) { - _irq[channle].fun(PL041_READ(p_status), _irq[channle].user_data); + _irq[channel].fun(PL041_READ(p_status), _irq[channel].user_data); } } } diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h index 5ea146e43..33b8ac825 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_pl041.h @@ -1,21 +1,7 @@ /* - * File : drv_pl041.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -28,11 +14,11 @@ #define PL041_BASE_ADDR (0x10004000) /* offsets in CTRL_CH */ -#define AACI_RXCR 0x00 /* 29 bits Control Rx FIFO */ -#define AACI_TXCR 0x04 /* 17 bits Control Tx FIFO */ -#define AACI_SR 0x08 /* 12 bits Status */ -#define AACI_ISR 0x0C /* 7 bits Int Status */ -#define AACI_IE 0x10 /* 7 bits Int Enable */ +#define AACI_RXCR 0x00 /* 29 bits Control Rx FIFO */ +#define AACI_TXCR 0x04 /* 17 bits Control Tx FIFO */ +#define AACI_SR 0x08 /* 12 bits Status */ +#define AACI_ISR 0x0C /* 7 bits Int Status */ +#define AACI_IE 0x10 /* 7 bits Int Enable */ /* both for AACI_RXCR and AACI_TXCR */ #define AACI_CR_FEN (1 << 16) /* fifo enable */ @@ -53,7 +39,7 @@ #define AACI_CR_SL3 (1 << 3) #define AACI_CR_SL2 (1 << 2) #define AACI_CR_SL1 (1 << 1) -#define AACI_CR_EN (1 << 0) /* receive enable */ +#define AACI_CR_EN (1 << 0) /* receive enable */ /* status register bits */ #define AACI_SR_RXTOFE (1 << 11) /* rx timeout fifo empty */ @@ -80,29 +66,29 @@ /* interrupt enable */ #define AACI_IE_RXTOIE (1 << 6) /*rx timeout interrupt enable*/ #define AACI_IE_URIE (1 << 5) /*Transmit underrun interrupt enable*/ -#define AACI_IE_ORIE (1 << 4) /*Overrun receive interrupt enable*/ +#define AACI_IE_ORIE (1 << 4) /*Overrun receive interrupt enable*/ #define AACI_IE_RXIE (1 << 3) /*Receive interrupt enable*/ #define AACI_IE_TXIE (1 << 2) /*Transmit interrupt enable*/ #define AACI_IE_RXTIE (1 << 1) /*Receive timeout interrupt enable*/ -#define AACI_IE_TXCIE (1 << 0) /*Transmit complete interrupt enable*/ +#define AACI_IE_TXCIE (1 << 0) /*Transmit complete interrupt enable*/ /* interrupt status */ -#define AACI_ISR_RXTOFE (1 << 6) /* rx timeout fifo empty */ -#define AACI_ISR_UR (1 << 5) /* tx fifo underrun */ -#define AACI_ISR_OR (1 << 4) /* rx fifo overrun */ -#define AACI_ISR_RX (1 << 3) /* rx interrupt status */ -#define AACI_ISR_TX (1 << 2) /* tx interrupt status */ -#define AACI_ISR_RXTO (1 << 1) /* rx timeout */ -#define AACI_ISR_TXC (1 << 0) /* tx complete */ +#define AACI_ISR_RXTOFE (1 << 6) /* rx timeout fifo empty */ +#define AACI_ISR_UR (1 << 5) /* tx fifo underrun */ +#define AACI_ISR_OR (1 << 4) /* rx fifo overrun */ +#define AACI_ISR_RX (1 << 3) /* rx interrupt status */ +#define AACI_ISR_TX (1 << 2) /* tx interrupt status */ +#define AACI_ISR_RXTO (1 << 1) /* rx timeout */ +#define AACI_ISR_TXC (1 << 0) /* tx complete */ /* interrupt enable */ -#define AACI_IE_RXTOFE (1 << 6) /* rx timeout fifo empty */ -#define AACI_IE_UR (1 << 5) /* tx fifo underrun */ -#define AACI_IE_OR (1 << 4) /* rx fifo overrun */ -#define AACI_IE_RX (1 << 3) /* rx interrupt status */ -#define AACI_IE_TX (1 << 2) /* tx interrupt status */ -#define AACI_IE_RXTO (1 << 1) /* rx timeout */ -#define AACI_IE_TXC (1 << 0) /* tx complete */ +#define AACI_IE_RXTOFE (1 << 6) /* rx timeout fifo empty */ +#define AACI_IE_UR (1 << 5) /* tx fifo underrun */ +#define AACI_IE_OR (1 << 4) /* rx fifo overrun */ +#define AACI_IE_RX (1 << 3) /* rx interrupt status */ +#define AACI_IE_TX (1 << 2) /* tx interrupt status */ +#define AACI_IE_RXTO (1 << 1) /* rx timeout */ +#define AACI_IE_TXC (1 << 0) /* tx complete */ /* slot flag register bits */ #define AACI_SLFR_RWIS (1 << 13) /* raw wake-up interrupt status */ @@ -134,7 +120,7 @@ #define AACI_ICLR_RXOEC2 (1 << 2) /* Receive overrun error clear */ #define AACI_ICLR_RXOEC1 (1 << 1) /* Receive overrun error clear */ #define AACI_ICLR_WISC (1 << 0) /* Wake-up interrupt status clear */ - + /* Main control register bits AACI_MAINCR */ #define AACI_MAINCR_SCRA(x) ((x) << 10) /* secondary codec reg access */ #define AACI_MAINCR_DMAEN (1 << 9) /* dma enable */ @@ -155,13 +141,13 @@ #define SYNC_FORCE (1 << 0) /* Main flag register bits. P66 */ -#define MAINFR_TXB (1 << 1) /* transmit busy */ -#define MAINFR_RXB (1 << 0) /* receive busy */ +#define MAINFR_TXB (1 << 1) /* transmit busy */ +#define MAINFR_RXB (1 << 0) /* receive busy */ -#define PL041_CHANNLE_LEFT_DAC (0x1 << 3) -#define PL041_CHANNLE_RIGHT_DAC (0x1 << 3) -#define PL041_CHANNLE_LEFT_ADC (0x1 << 3) -#define PL041_CHANNLE_RIGHT_ADC (0x1 << 3) +#define PL041_CHANNEL_LEFT_DAC (0x1 << 3) +#define PL041_CHANNEL_RIGHT_DAC (0x1 << 3) +#define PL041_CHANNEL_LEFT_ADC (0x1 << 3) +#define PL041_CHANNEL_RIGHT_ADC (0x1 << 3) struct reg_pl041 { @@ -225,13 +211,13 @@ typedef void (*pl041_irq_fun_t)(rt_uint32_t status, void * user_data); rt_err_t aaci_pl041_init(void); void aaci_ac97_write(rt_uint16_t reg, rt_uint16_t val); rt_uint16_t aaci_ac97_read(rt_uint16_t reg); -int aaci_pl041_channle_cfg(int channle, pl041_cfg_t cfg); -int aaci_pl041_channle_write(int channle, rt_uint16_t *buff, int count); -int aaci_pl041_channle_read(int channle, rt_uint16_t *buff, int count); -int aaci_pl041_channle_enable(int channle); -int aaci_pl041_channle_disable(int channle); -rt_err_t aaci_pl041_irq_register(int channle, pl041_irq_fun_t fun, void *user_data); -rt_err_t aaci_pl041_irq_unregister(int channle); -void aaci_pl041_irq_disable(int channle, rt_uint32_t vector); -void aaci_pl041_irq_enable(int channle, rt_uint32_t vector); +int aaci_pl041_channel_cfg(int channel, pl041_cfg_t cfg); +int aaci_pl041_channel_write(int channel, rt_uint16_t *buff, int count); +int aaci_pl041_channel_read(int channel, rt_uint16_t *buff, int count); +int aaci_pl041_channel_enable(int channel); +int aaci_pl041_channel_disable(int channel); +rt_err_t aaci_pl041_irq_register(int channel, pl041_irq_fun_t fun, void *user_data); +rt_err_t aaci_pl041_irq_unregister(int channel); +void aaci_pl041_irq_disable(int channel, rt_uint32_t vector); +void aaci_pl041_irq_enable(int channel, rt_uint32_t vector); #endif diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.c b/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.c index cee67b0a0..226a2cdb5 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.c +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes @@ -227,13 +227,13 @@ static rt_err_t sound_init(struct rt_audio_device *audio) aaci_pl041_init(); - _cfg.itype = PL041_CHANNLE_LEFT_ADC | PL041_CHANNLE_RIGHT_ADC; - _cfg.otype = PL041_CHANNLE_LEFT_DAC | PL041_CHANNLE_RIGHT_DAC; + _cfg.itype = PL041_CHANNEL_LEFT_ADC | PL041_CHANNEL_RIGHT_ADC; + _cfg.otype = PL041_CHANNEL_LEFT_DAC | PL041_CHANNEL_RIGHT_DAC; _cfg.vol = snd_dev->volume; _cfg.rate = snd_dev->replay_config.samplerate; ac97_reset(); - aaci_pl041_channle_cfg(0, &_cfg); + aaci_pl041_channel_cfg(0, &_cfg); aaci_pl041_irq_register(0, rt_hw_aaci_isr, RT_NULL); return result; @@ -246,7 +246,7 @@ static rt_err_t sound_start(struct rt_audio_device *audio, int stream) if (stream == AUDIO_STREAM_REPLAY) { LOG_D("open sound device"); - aaci_pl041_channle_enable(0); + aaci_pl041_channel_enable(0); aaci_pl041_irq_enable(0, AACI_IE_UR | AACI_IE_TX | AACI_IE_TXC); } @@ -263,7 +263,7 @@ static rt_err_t sound_stop(struct rt_audio_device *audio, int stream) rt_thread_mdelay(100); /* disable irq and channels 0 */ aaci_pl041_irq_disable(0, AACI_IE_UR | AACI_IE_TX | AACI_IE_TXC); - aaci_pl041_channle_disable(0); + aaci_pl041_channel_disable(0); LOG_D("close sound device"); } @@ -295,7 +295,7 @@ static rt_size_t sound_transmit(struct rt_audio_device *audio, const void *write RT_ASSERT(audio != RT_NULL); /* write data to channel_0 fifo */ - aaci_pl041_channle_write(0, (rt_uint16_t *)writeBuf, size >> 1); + aaci_pl041_channel_write(0, (rt_uint16_t *)writeBuf, size >> 1); return size; } diff --git a/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.h b/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.h index 7cb47532b..075241849 100644 --- a/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.h +++ b/bsp/qemu-vexpress-a9/drivers/audio/drv_sound.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/qemu-vexpress-a9/drivers/board.c b/bsp/qemu-vexpress-a9/drivers/board.c index e236c68b8..8b26e68ea 100644 --- a/bsp/qemu-vexpress-a9/drivers/board.c +++ b/bsp/qemu-vexpress-a9/drivers/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/qemu-vexpress-a9/drivers/board.h b/bsp/qemu-vexpress-a9/drivers/board.h index ccbe0f8c9..965b5edea 100644 --- a/bsp/qemu-vexpress-a9/drivers/board.h +++ b/bsp/qemu-vexpress-a9/drivers/board.h @@ -1,11 +1,7 @@ /* - * File : board.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c index 91a931125..2b2253328 100644 --- a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c +++ b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.c @@ -1,3 +1,13 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020/12/31 Bernard Add license info + */ + #include #include #include @@ -36,12 +46,12 @@ int mdelay(int value) #if defined (CONFIG_SMC911X_32_BIT) rt_inline uint32_t smc911x_reg_read(struct eth_device_smc911x *dev, uint32_t offset) { - return *(volatile uint32_t*)(dev->iobase + offset); + return *(volatile uint32_t *)(dev->iobase + offset); } rt_inline void smc911x_reg_write(struct eth_device_smc911x *dev, uint32_t offset, uint32_t val) { - *(volatile uint32_t*)(dev->iobase + offset) = val; + *(volatile uint32_t *)(dev->iobase + offset) = val; } #elif defined (CONFIG_SMC911X_16_BIT) @@ -68,47 +78,47 @@ struct chip_id static const struct chip_id chip_ids[] = { - { CHIP_89218,"LAN89218" }, - { CHIP_9115, "LAN9115" }, - { CHIP_9116, "LAN9116" }, - { CHIP_9117, "LAN9117" }, - { CHIP_9118, "LAN9118" }, - { CHIP_9211, "LAN9211" }, - { CHIP_9215, "LAN9215" }, - { CHIP_9216, "LAN9216" }, - { CHIP_9217, "LAN9217" }, - { CHIP_9218, "LAN9218" }, - { CHIP_9220, "LAN9220" }, - { CHIP_9221, "LAN9221" }, + { LAN9118_ID_89218, "LAN89218" }, + { LAN9118_ID_9115, "LAN9115" }, + { LAN9118_ID_9116, "LAN9116" }, + { LAN9118_ID_9117, "LAN9117" }, + { LAN9118_ID_9118, "LAN9118" }, + { LAN9210_ID_9211, "LAN9211" }, + { LAN9218_ID_9215, "LAN9215" }, + { LAN9218_ID_9216, "LAN9216" }, + { LAN9218_ID_9217, "LAN9217" }, + { LAN9218_ID_9218, "LAN9218" }, + { LAN9220_ID_9220, "LAN9220" }, + { LAN9220_ID_9221, "LAN9221" }, { 0, RT_NULL }, }; static uint32_t smc911x_get_mac_csr(struct eth_device_smc911x *dev, uint8_t reg) { - while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY) ; + while (smc911x_reg_read(dev, LAN9118_MAC_CSR_CMD) & LAN9118_MAC_CSR_CMD_BUSY) ; - smc911x_reg_write(dev, MAC_CSR_CMD, MAC_CSR_CMD_CSR_BUSY | MAC_CSR_CMD_R_NOT_W | reg); + smc911x_reg_write(dev, LAN9118_MAC_CSR_CMD, LAN9118_MAC_CSR_CMD_BUSY | LAN9118_MAC_CSR_CMD_R | reg); - while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY) ; + while (smc911x_reg_read(dev, LAN9118_MAC_CSR_CMD) & LAN9118_MAC_CSR_CMD_BUSY) ; - return smc911x_reg_read(dev, MAC_CSR_DATA); + return smc911x_reg_read(dev, LAN9118_MAC_CSR_DATA); } static void smc911x_set_mac_csr(struct eth_device_smc911x *dev, uint8_t reg, uint32_t data) { - while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY) ; + while (smc911x_reg_read(dev, LAN9118_MAC_CSR_CMD) & LAN9118_MAC_CSR_CMD_BUSY) ; - smc911x_reg_write(dev, MAC_CSR_DATA, data); - smc911x_reg_write(dev, MAC_CSR_CMD, MAC_CSR_CMD_CSR_BUSY | reg); + smc911x_reg_write(dev, LAN9118_MAC_CSR_DATA, data); + smc911x_reg_write(dev, LAN9118_MAC_CSR_CMD, LAN9118_MAC_CSR_CMD_BUSY | reg); - while (smc911x_reg_read(dev, MAC_CSR_CMD) & MAC_CSR_CMD_CSR_BUSY) ; + while (smc911x_reg_read(dev, LAN9118_MAC_CSR_CMD) & LAN9118_MAC_CSR_CMD_BUSY) ; } static int smc911x_detect_chip(struct eth_device_smc911x *dev) { unsigned long val, i; - val = smc911x_reg_read(dev, BYTE_TEST); + val = smc911x_reg_read(dev, LAN9118_BYTE_TEST); if (val == 0xffffffff) { /* Special case -- no chip present */ @@ -120,7 +130,7 @@ static int smc911x_detect_chip(struct eth_device_smc911x *dev) return -1; } - val = smc911x_reg_read(dev, ID_REV) >> 16; + val = smc911x_reg_read(dev, LAN9118_ID_REV) >> 16; for (i = 0; chip_ids[i].id != 0; i++) { if (chip_ids[i].id == val) break; @@ -141,16 +151,16 @@ static void smc911x_reset(struct eth_device_smc911x *dev) /* * Take out of PM setting first - * Device is already wake up if PMT_CTRL_READY bit is set + * Device is already wake up if LAN9118_PMT_CTRL_READY bit is set */ - if ((smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY) == 0) + if ((smc911x_reg_read(dev, LAN9118_PMT_CTRL) & LAN9118_PMT_CTRL_READY) == 0) { /* Write to the bytetest will take out of powerdown */ - smc911x_reg_write(dev, BYTE_TEST, 0x0); + smc911x_reg_write(dev, LAN9118_BYTE_TEST, 0x0); timeout = 10; - while (timeout-- && !(smc911x_reg_read(dev, PMT_CTRL) & PMT_CTRL_READY)) + while (timeout-- && !(smc911x_reg_read(dev, LAN9118_PMT_CTRL) & LAN9118_PMT_CTRL_READY)) udelay(10); if (timeout < 0) @@ -162,11 +172,11 @@ static void smc911x_reset(struct eth_device_smc911x *dev) } /* Disable interrupts */ - smc911x_reg_write(dev, INT_EN, 0); - smc911x_reg_write(dev, HW_CFG, HW_CFG_SRST); + smc911x_reg_write(dev, LAN9118_INT_EN, 0); + smc911x_reg_write(dev, LAN9118_HW_CFG, LAN9118_HW_CFG_SRST); timeout = 1000; - while (timeout-- && smc911x_reg_read(dev, E2P_CMD) & E2P_CMD_EPC_BUSY) + while (timeout-- && smc911x_reg_read(dev, LAN9118_E2P_CMD) & LAN9118_E2P_CMD) udelay(10); if (timeout < 0) @@ -176,11 +186,11 @@ static void smc911x_reset(struct eth_device_smc911x *dev) } /* Reset the FIFO level and flow control settings */ - smc911x_set_mac_csr(dev, FLOW, FLOW_FCPT | FLOW_FCEN); - smc911x_reg_write(dev, AFC_CFG, 0x0050287F); + smc911x_set_mac_csr(dev, LAN9118_FLOW, LAN9118_FLOW_FCPT(0xffff) | LAN9118_FLOW_FCEN); + smc911x_reg_write(dev, LAN9118_AFC_CFG, 0x0050287F); /* Set to LED outputs */ - smc911x_reg_write(dev, GPIO_CFG, 0x70070000); + smc911x_reg_write(dev, LAN9118_GPIO_CFG, 0x70070000); } static void smc911x_handle_mac_address(struct eth_device_smc911x *dev) @@ -191,20 +201,20 @@ static void smc911x_handle_mac_address(struct eth_device_smc911x *dev) addrl = m[0] | (m[1] << 8) | (m[2] << 16) | (m[3] << 24); addrh = m[4] | (m[5] << 8); - smc911x_set_mac_csr(dev, ADDRL, addrl); - smc911x_set_mac_csr(dev, ADDRH, addrh); + smc911x_set_mac_csr(dev, LAN9118_ADDRL, addrl); + smc911x_set_mac_csr(dev, LAN9118_ADDRH, addrh); } static int smc911x_eth_phy_read(struct eth_device_smc911x *dev, uint8_t phy, uint8_t reg, uint16_t *val) { - while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY) ; + while (smc911x_get_mac_csr(dev, LAN9118_MII_ACC) & LAN9118_MII_ACC_MIIBZY) ; - smc911x_set_mac_csr(dev, MII_ACC, phy << 11 | reg << 6 | MII_ACC_MII_BUSY); + smc911x_set_mac_csr(dev, LAN9118_MII_ACC, phy << 11 | reg << 6 | LAN9118_MII_ACC_MIIBZY); - while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY) ; + while (smc911x_get_mac_csr(dev, LAN9118_MII_ACC) & LAN9118_MII_ACC_MIIBZY) ; - *val = smc911x_get_mac_csr(dev, MII_DATA); + *val = smc911x_get_mac_csr(dev, LAN9118_MII_DATA); return 0; } @@ -212,14 +222,14 @@ static int smc911x_eth_phy_read(struct eth_device_smc911x *dev, static int smc911x_eth_phy_write(struct eth_device_smc911x *dev, uint8_t phy, uint8_t reg, uint16_t val) { - while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY) + while (smc911x_get_mac_csr(dev, LAN9118_MII_ACC) & LAN9118_MII_ACC_MIIBZY) ; - smc911x_set_mac_csr(dev, MII_DATA, val); - smc911x_set_mac_csr(dev, MII_ACC, - phy << 11 | reg << 6 | MII_ACC_MII_BUSY | MII_ACC_MII_WRITE); + smc911x_set_mac_csr(dev, LAN9118_MII_DATA, val); + smc911x_set_mac_csr(dev, LAN9118_MII_ACC, + phy << 11 | reg << 6 | LAN9118_MII_ACC_MIIBZY | LAN9118_MII_ACC_MIIWNR); - while (smc911x_get_mac_csr(dev, MII_ACC) & MII_ACC_MII_BUSY) + while (smc911x_get_mac_csr(dev, LAN9118_MII_ACC) & LAN9118_MII_ACC_MIIBZY) ; return 0; } @@ -228,10 +238,10 @@ static int smc911x_phy_reset(struct eth_device_smc911x *dev) { uint32_t reg; - reg = smc911x_reg_read(dev, PMT_CTRL); + reg = smc911x_reg_read(dev, LAN9118_PMT_CTRL); reg &= ~0xfffff030; - reg |= PMT_CTRL_PHY_RST; - smc911x_reg_write(dev, PMT_CTRL, reg); + reg |= LAN9118_PMT_CTRL_PHY_RST; + smc911x_reg_write(dev, LAN9118_PMT_CTRL, reg); mdelay(100); @@ -245,10 +255,10 @@ static void smc911x_phy_configure(struct eth_device_smc911x *dev) smc911x_phy_reset(dev); - smc911x_eth_phy_write(dev, 1, MII_BMCR, BMCR_RESET); + smc911x_eth_phy_write(dev, 1, LAN9118_MII_BMCR, LAN9118_BMCR_RESET); mdelay(1); - smc911x_eth_phy_write(dev, 1, MII_ADVERTISE, 0x01e1); - smc911x_eth_phy_write(dev, 1, MII_BMCR, BMCR_ANENABLE | BMCR_ANRESTART); + smc911x_eth_phy_write(dev, 1, LAN9118_MII_ADVERTISE, 0x01e1); + smc911x_eth_phy_write(dev, 1, LAN9118_MII_BMCR, LAN9118_BMCR_ANENABLE | LAN9118_BMCR_ANRESTART); timeout = 5000; do @@ -257,10 +267,10 @@ static void smc911x_phy_configure(struct eth_device_smc911x *dev) if ((timeout--) == 0) goto err_out; - if (smc911x_eth_phy_read(dev, 1, MII_BMSR, &status) != 0) + if (smc911x_eth_phy_read(dev, 1, LAN9118_MII_BMSR, &status) != 0) goto err_out; } - while (!(status & BMSR_LSTATUS)); + while (!(status & LAN9118_BMSR_LSTATUS)); return; @@ -271,17 +281,17 @@ static void smc911x_phy_configure(struct eth_device_smc911x *dev) static void smc911x_enable(struct eth_device_smc911x *dev) { /* Enable TX */ - smc911x_reg_write(dev, HW_CFG, 8 << 16 | HW_CFG_SF); + smc911x_reg_write(dev, LAN9118_HW_CFG, 8 << 16 | LAN9118_HW_CFG_SF); - smc911x_reg_write(dev, GPT_CFG, GPT_CFG_TIMER_EN | 10000); + smc911x_reg_write(dev, LAN9118_GPT_CFG, LAN9118_GPT_CFG_TIMER_EN | 10000); - smc911x_reg_write(dev, TX_CFG, TX_CFG_TX_ON); + smc911x_reg_write(dev, LAN9118_TX_CFG, LAN9118_TX_CFG_TX_ON); /* no padding to start of packets */ - smc911x_reg_write(dev, RX_CFG, 0); + smc911x_reg_write(dev, LAN9118_RX_CFG, 0); - smc911x_set_mac_csr(dev, MAC_CR, MAC_CR_TXEN | MAC_CR_RXEN | - MAC_CR_HBDIS); + smc911x_set_mac_csr(dev, LAN9118_MAC_CR, LAN9118_MAC_CR_TXEN | LAN9118_MAC_CR_RXEN | + LAN9118_MAC_CR_HBDIS); } #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII) @@ -319,13 +329,13 @@ static void smc911x_isr(int vector, void *param) emac = SMC911X_EMAC_DEVICE(param); - status = smc911x_reg_read(emac, INT_STS); - - if (status & INT_STS_RSFL) + status = smc911x_reg_read(emac, LAN9118_INT_STS); + + if (status & LAN9118_INT_STS_RSFL) { eth_device_ready(&emac->parent); } - smc911x_reg_write(emac, INT_STS, status); + smc911x_reg_write(emac, LAN9118_INT_STS, status); return ; } @@ -349,18 +359,18 @@ static rt_err_t smc911x_emac_init(rt_device_t dev) #if 1 /* Interrupt on every received packet */ - smc911x_reg_write(emac, FIFO_INT, 0x01 << 8); - smc911x_reg_write(emac, INT_EN, INT_EN_RDFL_EN | INT_EN_RSFL_EN); + smc911x_reg_write(emac, LAN9118_FIFO_INT, 0x01 << 8); + smc911x_reg_write(emac, LAN9118_INT_EN, LAN9118_INT_EN_RDFL_EN | LAN9118_INT_RSFL); /* enable interrupt */ - smc911x_reg_write(emac, INT_CFG, INT_CFG_IRQ_EN | INT_CFG_IRQ_POL | INT_CFG_IRQ_TYPE); + smc911x_reg_write(emac, LAN9118_IRQ_CFG, LAN9118_IRQ_CFG_IRQ_EN | LAN9118_IRQ_CFG_IRQ_POL | LAN9118_IRQ_CFG_IRQ_TYPE); #else /* disable interrupt */ - smc911x_reg_write(emac, INT_EN, 0); - value = smc911x_reg_read(emac, INT_CFG); - value &= ~INT_CFG_IRQ_EN; - smc911x_reg_write(emac, INT_CFG, value); + smc911x_reg_write(emac, LAN9118_INT_EN, 0); + value = smc911x_reg_read(emac, LAN9118_IRQ_CFG); + value &= ~LAN9118_IRQ_CFG_IRQ_EN; + smc911x_reg_write(emac, LAN9118_IRQ_CFG, value); #endif rt_hw_interrupt_install(emac->irqno, smc911x_isr, emac, "smc911x"); @@ -376,11 +386,11 @@ static rt_err_t smc911x_emac_control(rt_device_t dev, int cmd, void *args) emac = SMC911X_EMAC_DEVICE(dev); RT_ASSERT(emac != RT_NULL); - switch(cmd) + switch (cmd) { case NIOCTL_GADDR: /* get MAC address */ - if(args) rt_memcpy(args, emac->enetaddr, 6); + if (args) rt_memcpy(args, emac->enetaddr, 6); else return -RT_ERROR; break; default : @@ -392,7 +402,7 @@ static rt_err_t smc911x_emac_control(rt_device_t dev, int cmd, void *args) /* Ethernet device interface */ /* transmit packet. */ static uint8_t tx_buf[2048]; -rt_err_t smc911x_emac_tx(rt_device_t dev, struct pbuf* p) +rt_err_t smc911x_emac_tx(rt_device_t dev, struct pbuf *p) { struct eth_device_smc911x *emac; @@ -408,36 +418,36 @@ rt_err_t smc911x_emac_tx(rt_device_t dev, struct pbuf* p) pbuf_copy_partial(p, tx_buf, p->tot_len, 0); /* send it out */ - data = (uint32_t*)tx_buf; + data = (uint32_t *)tx_buf; length = p->tot_len; - smc911x_reg_write(emac, TX_DATA_FIFO, TX_CMD_A_INT_FIRST_SEG | TX_CMD_A_INT_LAST_SEG | length); - smc911x_reg_write(emac, TX_DATA_FIFO, length); + smc911x_reg_write(emac, LAN9118_TXDFIFOP, LAN9118_TXC_A_FS | LAN9118_TXC_A_LS | length); + smc911x_reg_write(emac, LAN9118_TXDFIFOP, length); tmplen = (length + 3) / 4; while (tmplen--) { - smc911x_reg_write(emac, TX_DATA_FIFO, *data++); + smc911x_reg_write(emac, LAN9118_TXDFIFOP, *data++); } /* wait for transmission */ - while (!((smc911x_reg_read(emac, TX_FIFO_INF) & TX_FIFO_INF_TSUSED) >> 16)); + while (!(LAN9118_TX_FIFO_INF_TXSUSED(smc911x_reg_read(emac, LAN9118_TX_FIFO_INF)))); /* get status. Ignore 'no carrier' error, it has no meaning for * full duplex operation */ - status = smc911x_reg_read(emac, TX_STATUS_FIFO) & - (TX_STS_LOC | TX_STS_LATE_COLL | TX_STS_MANY_COLL | - TX_STS_MANY_DEFER | TX_STS_UNDERRUN); + status = smc911x_reg_read(emac, LAN9118_TXSFIFOP) & + (LAN9118_TXS_LOC | LAN9118_TXS_LCOL | LAN9118_TXS_ECOL | + LAN9118_TXS_ED | LAN9118_TX_STS_UNDERRUN); if (!status) return 0; rt_kprintf(DRIVERNAME ": failed to send packet: %s%s%s%s%s\n", - status & TX_STS_LOC ? "TX_STS_LOC " : "", - status & TX_STS_LATE_COLL ? "TX_STS_LATE_COLL " : "", - status & TX_STS_MANY_COLL ? "TX_STS_MANY_COLL " : "", - status & TX_STS_MANY_DEFER ? "TX_STS_MANY_DEFER " : "", - status & TX_STS_UNDERRUN ? "TX_STS_UNDERRUN" : ""); + status & LAN9118_TXS_LOC ? "LAN9118_TXS_LOC " : "", + status & LAN9118_TXS_LCOL ? "LAN9118_TXS_LCOL " : "", + status & LAN9118_TXS_ECOL ? "LAN9118_TXS_ECOL " : "", + status & LAN9118_TXS_ED ? "LAN9118_TXS_ED " : "", + status & LAN9118_TX_STS_UNDERRUN ? "LAN9118_TX_STS_UNDERRUN" : ""); return -RT_EIO; } @@ -445,24 +455,24 @@ rt_err_t smc911x_emac_tx(rt_device_t dev, struct pbuf* p) /* reception packet. */ struct pbuf *smc911x_emac_rx(rt_device_t dev) { - struct pbuf* p = RT_NULL; + struct pbuf *p = RT_NULL; struct eth_device_smc911x *emac; emac = SMC911X_EMAC_DEVICE(dev); RT_ASSERT(emac != RT_NULL); /* take the emac buffer to the pbuf */ - if ((smc911x_reg_read(emac, RX_FIFO_INF) & RX_FIFO_INF_RXSUSED) >> 16) + if (LAN9118_RX_FIFO_INF_RXSUSED(smc911x_reg_read(emac, LAN9118_RX_FIFO_INF))) { uint32_t status; uint32_t pktlen, tmplen; - status = smc911x_reg_read(emac, RX_STATUS_FIFO); + status = smc911x_reg_read(emac, LAN9118_RXSFIFOP); /* get frame length */ - pktlen = (status & RX_STS_PKT_LEN) >> 16; + pktlen = (status & LAN9118_RX_STS_PKT_LEN) >> 16; - smc911x_reg_write(emac, RX_CFG, 0); + smc911x_reg_write(emac, LAN9118_RX_CFG, 0); tmplen = (pktlen + 3) / 4; @@ -473,11 +483,11 @@ struct pbuf *smc911x_emac_rx(rt_device_t dev) uint32_t *data = (uint32_t *)p->payload; while (tmplen--) { - *data++ = smc911x_reg_read(emac, RX_DATA_FIFO); + *data++ = smc911x_reg_read(emac, LAN9118_RXDFIFOP); } } - if (status & RX_STS_ES) + if (status & LAN9118_RXS_ES) { rt_kprintf(DRIVERNAME ": dropped bad packet. Status: 0x%08x\n", status); } @@ -487,7 +497,7 @@ struct pbuf *smc911x_emac_rx(rt_device_t dev) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops smc911x_emac_ops = +const static struct rt_device_ops smc911x_emac_ops = { smc911x_emac_init, RT_NULL, @@ -510,7 +520,7 @@ int smc911x_emac_hw_init(void) } /* set INT CFG */ - smc911x_reg_write(&_emac, INT_CFG, INT_CFG_IRQ_POL | INT_CFG_IRQ_TYPE); + smc911x_reg_write(&_emac, LAN9118_IRQ_CFG, LAN9118_IRQ_CFG_IRQ_POL | LAN9118_IRQ_CFG_IRQ_TYPE); /* test MAC address */ _emac.enetaddr[0] = AUTOMAC0; diff --git a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.h b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.h index abaa24f9f..a4dca4116 100644 --- a/bsp/qemu-vexpress-a9/drivers/drv_smc911x.h +++ b/bsp/qemu-vexpress-a9/drivers/drv_smc911x.h @@ -1,402 +1,342 @@ /* - * SMSC LAN9[12]1[567] Network driver + * Copyright (c) 2006-2021, RT-Thread Development Team * - * (c) 2007 Pengutronix, Sascha Hauer + * SPDX-License-Identifier: Apache-2.0 * - * SPDX-License-Identifier: GPL-2.0+ + * Change Logs: + * Date Author Notes + * 2021-04-21 */ -#ifndef _SMC911X_H_ -#define _SMC911X_H_ -#include - -#define CONFIG_SMC911X_32_BIT - -/* Below are the register offsets and bit definitions - * of the Lan911x memory space +/* $NetBSD: lan9118reg.h,v 1.3 2010/09/27 12:29:03 kiyohara Exp $ */ +/* + * Copyright (c) 2008 KIYOHARA Takashi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ -#define RX_DATA_FIFO 0x00 - -#define TX_DATA_FIFO 0x20 -#define TX_CMD_A_INT_ON_COMP 0x80000000 -#define TX_CMD_A_INT_BUF_END_ALGN 0x03000000 -#define TX_CMD_A_INT_4_BYTE_ALGN 0x00000000 -#define TX_CMD_A_INT_16_BYTE_ALGN 0x01000000 -#define TX_CMD_A_INT_32_BYTE_ALGN 0x02000000 -#define TX_CMD_A_INT_DATA_OFFSET 0x001F0000 -#define TX_CMD_A_INT_FIRST_SEG 0x00002000 -#define TX_CMD_A_INT_LAST_SEG 0x00001000 -#define TX_CMD_A_BUF_SIZE 0x000007FF -#define TX_CMD_B_PKT_TAG 0xFFFF0000 -#define TX_CMD_B_ADD_CRC_DISABLE 0x00002000 -#define TX_CMD_B_DISABLE_PADDING 0x00001000 -#define TX_CMD_B_PKT_BYTE_LENGTH 0x000007FF - -#define RX_STATUS_FIFO 0x40 -#define RX_STS_PKT_LEN 0x3FFF0000 -#define RX_STS_ES 0x00008000 -#define RX_STS_BCST 0x00002000 -#define RX_STS_LEN_ERR 0x00001000 -#define RX_STS_RUNT_ERR 0x00000800 -#define RX_STS_MCAST 0x00000400 -#define RX_STS_TOO_LONG 0x00000080 -#define RX_STS_COLL 0x00000040 -#define RX_STS_ETH_TYPE 0x00000020 -#define RX_STS_WDOG_TMT 0x00000010 -#define RX_STS_MII_ERR 0x00000008 -#define RX_STS_DRIBBLING 0x00000004 -#define RX_STS_CRC_ERR 0x00000002 -#define RX_STATUS_FIFO_PEEK 0x44 -#define TX_STATUS_FIFO 0x48 -#define TX_STS_TAG 0xFFFF0000 -#define TX_STS_ES 0x00008000 -#define TX_STS_LOC 0x00000800 -#define TX_STS_NO_CARR 0x00000400 -#define TX_STS_LATE_COLL 0x00000200 -#define TX_STS_MANY_COLL 0x00000100 -#define TX_STS_COLL_CNT 0x00000078 -#define TX_STS_MANY_DEFER 0x00000004 -#define TX_STS_UNDERRUN 0x00000002 -#define TX_STS_DEFERRED 0x00000001 -#define TX_STATUS_FIFO_PEEK 0x4C -#define ID_REV 0x50 -#define ID_REV_CHIP_ID 0xFFFF0000 /* RO */ -#define ID_REV_REV_ID 0x0000FFFF /* RO */ - -#define INT_CFG 0x54 -#define INT_CFG_INT_DEAS 0xFF000000 /* R/W */ -#define INT_CFG_INT_DEAS_CLR 0x00004000 -#define INT_CFG_INT_DEAS_STS 0x00002000 -#define INT_CFG_IRQ_INT 0x00001000 /* RO */ -#define INT_CFG_IRQ_EN 0x00000100 /* R/W */ -/* R/W Not Affected by SW Reset */ -#define INT_CFG_IRQ_POL 0x00000010 -/* R/W Not Affected by SW Reset */ -#define INT_CFG_IRQ_TYPE 0x00000001 - -#define INT_STS 0x58 -#define INT_STS_SW_INT 0x80000000 /* R/WC */ -#define INT_STS_TXSTOP_INT 0x02000000 /* R/WC */ -#define INT_STS_RXSTOP_INT 0x01000000 /* R/WC */ -#define INT_STS_RXDFH_INT 0x00800000 /* R/WC */ -#define INT_STS_RXDF_INT 0x00400000 /* R/WC */ -#define INT_STS_TX_IOC 0x00200000 /* R/WC */ -#define INT_STS_RXD_INT 0x00100000 /* R/WC */ -#define INT_STS_GPT_INT 0x00080000 /* R/WC */ -#define INT_STS_PHY_INT 0x00040000 /* RO */ -#define INT_STS_PME_INT 0x00020000 /* R/WC */ -#define INT_STS_TXSO 0x00010000 /* R/WC */ -#define INT_STS_RWT 0x00008000 /* R/WC */ -#define INT_STS_RXE 0x00004000 /* R/WC */ -#define INT_STS_TXE 0x00002000 /* R/WC */ -/*#define INT_STS_ERX 0x00001000*/ /* R/WC */ -#define INT_STS_TDFU 0x00000800 /* R/WC */ -#define INT_STS_TDFO 0x00000400 /* R/WC */ -#define INT_STS_TDFA 0x00000200 /* R/WC */ -#define INT_STS_TSFF 0x00000100 /* R/WC */ -#define INT_STS_TSFL 0x00000080 /* R/WC */ -/*#define INT_STS_RXDF 0x00000040*/ /* R/WC */ -#define INT_STS_RDFO 0x00000040 /* R/WC */ -#define INT_STS_RDFL 0x00000020 /* R/WC */ -#define INT_STS_RSFF 0x00000010 /* R/WC */ -#define INT_STS_RSFL 0x00000008 /* R/WC */ -#define INT_STS_GPIO2_INT 0x00000004 /* R/WC */ -#define INT_STS_GPIO1_INT 0x00000002 /* R/WC */ -#define INT_STS_GPIO0_INT 0x00000001 /* R/WC */ -#define INT_EN 0x5C -#define INT_EN_SW_INT_EN 0x80000000 /* R/W */ -#define INT_EN_TXSTOP_INT_EN 0x02000000 /* R/W */ -#define INT_EN_RXSTOP_INT_EN 0x01000000 /* R/W */ -#define INT_EN_RXDFH_INT_EN 0x00800000 /* R/W */ -/*#define INT_EN_RXDF_INT_EN 0x00400000*/ /* R/W */ -#define INT_EN_TIOC_INT_EN 0x00200000 /* R/W */ -#define INT_EN_RXD_INT_EN 0x00100000 /* R/W */ -#define INT_EN_GPT_INT_EN 0x00080000 /* R/W */ -#define INT_EN_PHY_INT_EN 0x00040000 /* R/W */ -#define INT_EN_PME_INT_EN 0x00020000 /* R/W */ -#define INT_EN_TXSO_EN 0x00010000 /* R/W */ -#define INT_EN_RWT_EN 0x00008000 /* R/W */ -#define INT_EN_RXE_EN 0x00004000 /* R/W */ -#define INT_EN_TXE_EN 0x00002000 /* R/W */ -/*#define INT_EN_ERX_EN 0x00001000*/ /* R/W */ -#define INT_EN_TDFU_EN 0x00000800 /* R/W */ -#define INT_EN_TDFO_EN 0x00000400 /* R/W */ -#define INT_EN_TDFA_EN 0x00000200 /* R/W */ -#define INT_EN_TSFF_EN 0x00000100 /* R/W */ -#define INT_EN_TSFL_EN 0x00000080 /* R/W */ -/*#define INT_EN_RXDF_EN 0x00000040*/ /* R/W */ -#define INT_EN_RDFO_EN 0x00000040 /* R/W */ -#define INT_EN_RDFL_EN 0x00000020 /* R/W */ -#define INT_EN_RSFF_EN 0x00000010 /* R/W */ -#define INT_EN_RSFL_EN 0x00000008 /* R/W */ -#define INT_EN_GPIO2_INT 0x00000004 /* R/W */ -#define INT_EN_GPIO1_INT 0x00000002 /* R/W */ -#define INT_EN_GPIO0_INT 0x00000001 /* R/W */ - -#define BYTE_TEST 0x64 -#define FIFO_INT 0x68 -#define FIFO_INT_TX_AVAIL_LEVEL 0xFF000000 /* R/W */ -#define FIFO_INT_TX_STS_LEVEL 0x00FF0000 /* R/W */ -#define FIFO_INT_RX_AVAIL_LEVEL 0x0000FF00 /* R/W */ -#define FIFO_INT_RX_STS_LEVEL 0x000000FF /* R/W */ - -#define RX_CFG 0x6C -#define RX_CFG_RX_END_ALGN 0xC0000000 /* R/W */ -#define RX_CFG_RX_END_ALGN4 0x00000000 /* R/W */ -#define RX_CFG_RX_END_ALGN16 0x40000000 /* R/W */ -#define RX_CFG_RX_END_ALGN32 0x80000000 /* R/W */ -#define RX_CFG_RX_DMA_CNT 0x0FFF0000 /* R/W */ -#define RX_CFG_RX_DUMP 0x00008000 /* R/W */ -#define RX_CFG_RXDOFF 0x00001F00 /* R/W */ -/*#define RX_CFG_RXBAD 0x00000001*/ /* R/W */ - -#define TX_CFG 0x70 -/*#define TX_CFG_TX_DMA_LVL 0xE0000000*/ /* R/W */ -/* R/W Self Clearing */ -/*#define TX_CFG_TX_DMA_CNT 0x0FFF0000*/ -#define TX_CFG_TXS_DUMP 0x00008000 /* Self Clearing */ -#define TX_CFG_TXD_DUMP 0x00004000 /* Self Clearing */ -#define TX_CFG_TXSAO 0x00000004 /* R/W */ -#define TX_CFG_TX_ON 0x00000002 /* R/W */ -#define TX_CFG_STOP_TX 0x00000001 /* Self Clearing */ - -#define HW_CFG 0x74 -#define HW_CFG_TTM 0x00200000 /* R/W */ -#define HW_CFG_SF 0x00100000 /* R/W */ -#define HW_CFG_TX_FIF_SZ 0x000F0000 /* R/W */ -#define HW_CFG_TR 0x00003000 /* R/W */ -#define HW_CFG_PHY_CLK_SEL 0x00000060 /* R/W */ -#define HW_CFG_PHY_CLK_SEL_INT_PHY 0x00000000 /* R/W */ -#define HW_CFG_PHY_CLK_SEL_EXT_PHY 0x00000020 /* R/W */ -#define HW_CFG_PHY_CLK_SEL_CLK_DIS 0x00000040 /* R/W */ -#define HW_CFG_SMI_SEL 0x00000010 /* R/W */ -#define HW_CFG_EXT_PHY_DET 0x00000008 /* RO */ -#define HW_CFG_EXT_PHY_EN 0x00000004 /* R/W */ -#define HW_CFG_32_16_BIT_MODE 0x00000004 /* RO */ -#define HW_CFG_SRST_TO 0x00000002 /* RO */ -#define HW_CFG_SRST 0x00000001 /* Self Clearing */ - -#define RX_DP_CTRL 0x78 -#define RX_DP_CTRL_RX_FFWD 0x80000000 /* R/W */ -#define RX_DP_CTRL_FFWD_BUSY 0x80000000 /* RO */ - -#define RX_FIFO_INF 0x7C -#define RX_FIFO_INF_RXSUSED 0x00FF0000 /* RO */ -#define RX_FIFO_INF_RXDUSED 0x0000FFFF /* RO */ - -#define TX_FIFO_INF 0x80 -#define TX_FIFO_INF_TSUSED 0x00FF0000 /* RO */ -#define TX_FIFO_INF_TDFREE 0x0000FFFF /* RO */ - -#define PMT_CTRL 0x84 -#define PMT_CTRL_PM_MODE 0x00003000 /* Self Clearing */ -#define PMT_CTRL_PHY_RST 0x00000400 /* Self Clearing */ -#define PMT_CTRL_WOL_EN 0x00000200 /* R/W */ -#define PMT_CTRL_ED_EN 0x00000100 /* R/W */ -/* R/W Not Affected by SW Reset */ -#define PMT_CTRL_PME_TYPE 0x00000040 -#define PMT_CTRL_WUPS 0x00000030 /* R/WC */ -#define PMT_CTRL_WUPS_NOWAKE 0x00000000 /* R/WC */ -#define PMT_CTRL_WUPS_ED 0x00000010 /* R/WC */ -#define PMT_CTRL_WUPS_WOL 0x00000020 /* R/WC */ -#define PMT_CTRL_WUPS_MULTI 0x00000030 /* R/WC */ -#define PMT_CTRL_PME_IND 0x00000008 /* R/W */ -#define PMT_CTRL_PME_POL 0x00000004 /* R/W */ -/* R/W Not Affected by SW Reset */ -#define PMT_CTRL_PME_EN 0x00000002 -#define PMT_CTRL_READY 0x00000001 /* RO */ -#define GPIO_CFG 0x88 -#define GPIO_CFG_LED3_EN 0x40000000 /* R/W */ -#define GPIO_CFG_LED2_EN 0x20000000 /* R/W */ -#define GPIO_CFG_LED1_EN 0x10000000 /* R/W */ -#define GPIO_CFG_GPIO2_INT_POL 0x04000000 /* R/W */ -#define GPIO_CFG_GPIO1_INT_POL 0x02000000 /* R/W */ -#define GPIO_CFG_GPIO0_INT_POL 0x01000000 /* R/W */ -#define GPIO_CFG_EEPR_EN 0x00700000 /* R/W */ -#define GPIO_CFG_GPIOBUF2 0x00040000 /* R/W */ -#define GPIO_CFG_GPIOBUF1 0x00020000 /* R/W */ -#define GPIO_CFG_GPIOBUF0 0x00010000 /* R/W */ -#define GPIO_CFG_GPIODIR2 0x00000400 /* R/W */ -#define GPIO_CFG_GPIODIR1 0x00000200 /* R/W */ -#define GPIO_CFG_GPIODIR0 0x00000100 /* R/W */ -#define GPIO_CFG_GPIOD4 0x00000010 /* R/W */ -#define GPIO_CFG_GPIOD3 0x00000008 /* R/W */ -#define GPIO_CFG_GPIOD2 0x00000004 /* R/W */ -#define GPIO_CFG_GPIOD1 0x00000002 /* R/W */ -#define GPIO_CFG_GPIOD0 0x00000001 /* R/W */ +#ifndef _LAN9118REG_H_ +#define _LAN9118REG_H_ -#define GPT_CFG 0x8C -#define GPT_CFG_TIMER_EN 0x20000000 /* R/W */ -#define GPT_CFG_GPT_LOAD 0x0000FFFF /* R/W */ -#define GPT_CNT 0x90 -#define GPT_CNT_GPT_CNT 0x0000FFFF /* RO */ - -#define ENDIAN 0x98 -#define FREE_RUN 0x9C -#define RX_DROP 0xA0 -#define MAC_CSR_CMD 0xA4 -#define MAC_CSR_CMD_CSR_BUSY 0x80000000 /* Self Clearing */ -#define MAC_CSR_CMD_R_NOT_W 0x40000000 /* R/W */ -#define MAC_CSR_CMD_CSR_ADDR 0x000000FF /* R/W */ - -#define MAC_CSR_DATA 0xA8 -#define AFC_CFG 0xAC -#define AFC_CFG_AFC_HI 0x00FF0000 /* R/W */ -#define AFC_CFG_AFC_LO 0x0000FF00 /* R/W */ -#define AFC_CFG_BACK_DUR 0x000000F0 /* R/W */ -#define AFC_CFG_FCMULT 0x00000008 /* R/W */ -#define AFC_CFG_FCBRD 0x00000004 /* R/W */ -#define AFC_CFG_FCADD 0x00000002 /* R/W */ -#define AFC_CFG_FCANY 0x00000001 /* R/W */ - -#define E2P_CMD 0xB0 -#define E2P_CMD_EPC_BUSY 0x80000000 /* Self Clearing */ -#define E2P_CMD_EPC_CMD 0x70000000 /* R/W */ -#define E2P_CMD_EPC_CMD_READ 0x00000000 /* R/W */ -#define E2P_CMD_EPC_CMD_EWDS 0x10000000 /* R/W */ -#define E2P_CMD_EPC_CMD_EWEN 0x20000000 /* R/W */ -#define E2P_CMD_EPC_CMD_WRITE 0x30000000 /* R/W */ -#define E2P_CMD_EPC_CMD_WRAL 0x40000000 /* R/W */ -#define E2P_CMD_EPC_CMD_ERASE 0x50000000 /* R/W */ -#define E2P_CMD_EPC_CMD_ERAL 0x60000000 /* R/W */ -#define E2P_CMD_EPC_CMD_RELOAD 0x70000000 /* R/W */ -#define E2P_CMD_EPC_TIMEOUT 0x00000200 /* RO */ -#define E2P_CMD_MAC_ADDR_LOADED 0x00000100 /* RO */ -#define E2P_CMD_EPC_ADDR 0x000000FF /* R/W */ - -#define E2P_DATA 0xB4 -#define E2P_DATA_EEPROM_DATA 0x000000FF /* R/W */ -/* end of LAN register offsets and bit definitions */ - -/* MAC Control and Status registers */ -#define MAC_CR 0x01 /* R/W */ - -/* MAC_CR - MAC Control Register */ -#define MAC_CR_RXALL 0x80000000 -/* TODO: delete this bit? It is not described in the data sheet. */ -#define MAC_CR_HBDIS 0x10000000 -#define MAC_CR_RCVOWN 0x00800000 -#define MAC_CR_LOOPBK 0x00200000 -#define MAC_CR_FDPX 0x00100000 -#define MAC_CR_MCPAS 0x00080000 -#define MAC_CR_PRMS 0x00040000 -#define MAC_CR_INVFILT 0x00020000 -#define MAC_CR_PASSBAD 0x00010000 -#define MAC_CR_HFILT 0x00008000 -#define MAC_CR_HPFILT 0x00002000 -#define MAC_CR_LCOLL 0x00001000 -#define MAC_CR_BCAST 0x00000800 -#define MAC_CR_DISRTY 0x00000400 -#define MAC_CR_PADSTR 0x00000100 -#define MAC_CR_BOLMT_MASK 0x000000C0 -#define MAC_CR_DFCHK 0x00000020 -#define MAC_CR_TXEN 0x00000008 -#define MAC_CR_RXEN 0x00000004 - -#define ADDRH 0x02 /* R/W mask 0x0000FFFFUL */ -#define ADDRL 0x03 /* R/W mask 0xFFFFFFFFUL */ -#define HASHH 0x04 /* R/W */ -#define HASHL 0x05 /* R/W */ - -#define MII_ACC 0x06 /* R/W */ -#define MII_ACC_PHY_ADDR 0x0000F800 -#define MII_ACC_MIIRINDA 0x000007C0 -#define MII_ACC_MII_WRITE 0x00000002 -#define MII_ACC_MII_BUSY 0x00000001 - -#define MII_DATA 0x07 /* R/W mask 0x0000FFFFUL */ - -#define FLOW 0x08 /* R/W */ -#define FLOW_FCPT 0xFFFF0000 -#define FLOW_FCPASS 0x00000004 -#define FLOW_FCEN 0x00000002 -#define FLOW_FCBSY 0x00000001 - -#define VLAN1 0x09 /* R/W mask 0x0000FFFFUL */ -#define VLAN1_VTI1 0x0000ffff - -#define VLAN2 0x0A /* R/W mask 0x0000FFFFUL */ -#define VLAN2_VTI2 0x0000ffff - -#define WUFF 0x0B /* WO */ - -#define WUCSR 0x0C /* R/W */ -#define WUCSR_GUE 0x00000200 -#define WUCSR_WUFR 0x00000040 -#define WUCSR_MPR 0x00000020 -#define WUCSR_WAKE_EN 0x00000004 -#define WUCSR_MPEN 0x00000002 +#define CONFIG_SMC911X_32_BIT -/* Chip ID values */ -#define CHIP_89218 0x218a -#define CHIP_9115 0x115 -#define CHIP_9116 0x116 -#define CHIP_9117 0x117 -#define CHIP_9118 0x118 -#define CHIP_9211 0x9211 -#define CHIP_9215 0x115a -#define CHIP_9216 0x116a -#define CHIP_9217 0x117a -#define CHIP_9218 0x118a -#define CHIP_9220 0x9220 -#define CHIP_9221 0x9221 +#define LAN9118_IOSIZE 0x100 + +#define LAN9118_ID_89218 0x218a +#define LAN9118_ID_9115 0x0115 +#define LAN9118_ID_9116 0x0116 +#define LAN9118_ID_9117 0x0117 +#define LAN9118_ID_9118 0x0118 +#define LAN9218_ID_9215 0x115a +#define LAN9218_ID_9216 0x116a +#define LAN9218_ID_9217 0x117a +#define LAN9218_ID_9218 0x118a + +#define LAN9210_ID_9210 0x9210 +#define LAN9210_ID_9211 0x9211 +#define LAN9220_ID_9220 0x9220 +#define LAN9220_ID_9221 0x9221 + +#define IS_LAN9118(id) ((id) >= LAN9118_ID_9115 && (id) <= LAN9118_ID_9118) +#define IS_LAN9218(id) ((id) >= LAN9218_ID_9215 && (id) <= LAN9218_ID_9218) + +#define LAN9118_IPHY_ADDR 0x01 /* Internal PHY Address */ + + +#define LAN9118_RXDFIFOP 0x00 /* RX Data FIFO Port */ +#define LAN9118_RXDFIFOAP 0x04 /* RX Data FIFO Alias Ports */ +#define LAN9118_TXDFIFOP 0x20 /* TX Data FIFO Port */ +#define LAN9118_TXDFIFOAP 0x24 /* TX Data FIFO Alias Ports */ +#define LAN9118_RXSFIFOP 0x40 /* RX Status FIFO Port */ +#define LAN9118_RXSFIFOPEEK 0x44 /* RX Status FIFO PEEK */ +#define LAN9118_TXSFIFOP 0x48 /* TX Status FIFO Port */ +#define LAN9118_TXSFIFOPEEK 0x4c /* TX Status FIFO PEEK */ + +/* System Control and Status Registers */ +#define LAN9118_ID_REV 0x50 /* Chip ID and Revision */ +#define LAN9118_ID_REV_ID(x) (((x) >> 16) & 0xffff) +#define LAN9118_ID_REV_REV(x) ((x) & 0xffff) +#define LAN9118_IRQ_CFG 0x54 /* Main Interrupt Configuration */ +#define LAN9118_IRQ_CFG_INT_DEAS(t) ((t) << 24) /* Intr Deassert Interval */ +#define LAN9118_IRQ_CFG_INT_DEAS_CLR (1 << 14) /* Intr Deass Intrval clr */ +#define LAN9118_IRQ_CFG_INT_DEAS_STS (1 << 13) /* Intr Deassert Status */ +#define LAN9118_IRQ_CFG_IRQ_INT (1 << 12) /* Master Interrupt */ +#define LAN9118_IRQ_CFG_IRQ_EN (1 << 8) /* IRQ Enable */ +#define LAN9118_IRQ_CFG_IRQ_POL (1 << 4) /* IRQ Polarity */ +#define LAN9118_IRQ_CFG_IRQ_TYPE (1 << 0) /* IRQ Buffer Type */ +#define LAN9118_INT_STS 0x58 /* Interrupt Status */ +#define LAN9118_INT_EN 0x5c /* Interrupt Enable Register */ +#define LAN9118_INT_SW_INT (1 << 31) /* Software Interrupt */ +#define LAN9118_INT_TXSTOP_INT (1 << 25) /* TX Stopped */ +#define LAN9118_INT_RXSTOP_INT (1 << 24) /* RX Stopped */ +#define LAN9118_INT_RXDFH_INT (1 << 23) /* RX Drppd Frm Cnt Halfway */ +#define LAN9118_INT_TX_IOC (1 << 21) /* TX IOC Interrupt */ +#define LAN9118_INT_RXD_INT (1 << 20) /* RX DMA Interrupt */ +#define LAN9118_INT_GPT_INT (1 << 19) /* GP Timer */ +#define LAN9118_INT_PHY_INT (1 << 18) /* PHY */ +#define LAN9118_INT_PME_INT (1 << 17) /* Power Management Event */ +#define LAN9118_INT_TXSO (1 << 16) /* TX Status FIFO Overflow */ +#define LAN9118_INT_RWT (1 << 15) /* Rcv Watchdog Time-out */ +#define LAN9118_INT_RXE (1 << 14) /* Receive Error */ +#define LAN9118_INT_TXE (1 << 13) /* Transmitter Error */ +#define LAN9118_INT_TDFO (1 << 10) /* TX Data FIFO Overrun */ +#define LAN9118_INT_TDFA (1 << 9) /* TX Data FIFO Available */ +#define LAN9118_INT_TSFF (1 << 8) /* TX Status FIFO Full */ +#define LAN9118_INT_TSFL (1 << 7) /* TX Status FIFO Level */ +#define LAN9118_INT_RXDF_INT (1 << 6) /* RX Dropped Frame Intr */ +#define LAN9118_INT_RSFF (1 << 4) /* RX Status FIFO Full */ +#define LAN9118_INT_RSFL (1 << 3) /* RX Status FIFO Level */ +#define LAN9118_INT_GPIOX_INT(x) (1 << (x)) /* GPIO[2:0] */ +/* 0x60 Reserved for future use */ +#define LAN9118_BYTE_TEST 0x64 /* Read-only byte order testing reg */ +#define LAN9118_BYTE_TEST_VALUE 0x87654321 +#define LAN9118_FIFO_INT 0x68 /* FIFO Level Interrupt */ +#define LAN9118_FIFO_INT_TXDAL(x) ((x) << 24) /* TX Data Available Lvl */ +#define LAN9118_FIFO_INT_TXSL(x) ((x) << 16) /* TX Status Level */ +#define LAN9118_FIFO_INT_RXSL(x) ((x) << 0) /* RX Status Level */ +#define LAN9118_RX_CFG 0x6c /* Receive Configuration */ +#define LAN9118_RX_CFG_RXEA_4B (0 << 30) /* RX End Alignment: 4 Byte */ +#define LAN9118_RX_CFG_RXEA_16B (1 << 30) /* 16 Byte */ +#define LAN9118_RX_CFG_RXEA_32B (2 << 30) /* 32 Byte */ +#define LAN9118_RX_CFG_RX_DMA_CNT(x) ((x) << 16) /* RX DMA Count */ +#define LAN9118_RX_CFG_RX_DUMP (1 << 15) /* Force RX Discard */ +#define LAN9118_RX_CFG_RXDOFF(x) ((x) << 8) /* RX Data Offset */ +#define LAN9118_TX_CFG 0x70 /* Transmit Configuration */ +#define LAN9118_TX_CFG_TXS_DUMP (1 << 15) /* Force TX Status Discard */ +#define LAN9118_TX_CFG_TXD_DUMP (1 << 14) /* Force TX Data Discard */ +#define LAN9118_TX_CFG_TXSAO (1 << 2) /* TX Status Allow Overrun */ +#define LAN9118_TX_CFG_TX_ON (1 << 1) /* Transmitter Enable */ +#define LAN9118_TX_CFG_STOP_TX (1 << 0) /* Stop Transmitter */ +#define LAN9118_HW_CFG 0x74 /* Hardware Configuration */ +#define LAN9118_HW_CFG_MBO (1 << 20)/* Must Be One */ +#define LAN9118_HW_CFG_TX_FIF_MASK (0xf << 16) /* TX FIFO Size */ +#define LAN9118_HW_CFG_TX_FIF_SZ(sz) ((sz) << 16) +#define LAN9118_HW_CFG_PHY_CLK_SEL_MASK (3 << 5) /* PHY Clock Select */ +#define LAN9118_HW_CFG_PHY_CLK_SEL_IPHY (0 << 5) /* Internal PHY */ +#define LAN9118_HW_CFG_PHY_CLK_SEL_EMII (1 << 5) /* External MII Port */ +#define LAN9118_HW_CFG_PHY_CLK_SEL_CD (2 << 5) /* Clock Disabled */ +#define LAN9118_HW_CFG_SMI_SEL (1 << 4) /* Serial Mgmt Interface Sel */ +#define LAN9118_HW_CFG_EXT_PHY_DET (1 << 3) /* External PHY Detect */ +#define LAN9118_HW_CFG_EXT_PHY_EN (1 << 2) /* External PHY Enable */ +#define LAN9118_HW_CFG_SRST_TO (1 << 1) /* Soft Reset Timeout */ +#define LAN9118_HW_CFG_SRST (1 << 0) /* Soft Reset */ +#define LAN9118_RX_DP_CTL 0x78 /* RX Datapath Control */ +#define LAN9118_RX_DP_CTL_RX_FFWD (1 << 31)/* RX Data FIFO Fast Forward */ +#define LAN9118_RX_FIFO_INF 0x7c /* Receive FIFO Information */ +#define LAN9118_RX_FIFO_INF_RXSUSED(x) (((x) >> 16) & 0xff) /*Sts Used Space*/ +#define LAN9118_RX_FIFO_INF_RXDUSED(x) ((x) & 0xffff) /*Data FIFO Used Space*/ +#define LAN9118_TX_FIFO_INF 0x80 /* Transmit FIFO Information */ +#define LAN9118_TX_FIFO_INF_TXSUSED(x) (((x) >> 16) & 0xff) /*Sts Used Space*/ +#define LAN9118_TX_FIFO_INF_TDFREE(x) ((x) & 0xffff) /*Data FIFO Free Space*/ +#define LAN9118_PMT_CTRL 0x84 /* Power Management Control */ +#define LAN9118_PMT_CTRL_PM_MODE_MASK (3 << 12) +#define LAN9118_PMT_CTRL_PM_MODE_D0 (0 << 12) +#define LAN9118_PMT_CTRL_PM_MODE_D1 (1 << 12) +#define LAN9118_PMT_CTRL_PM_MODE_D2 (2 << 12) +#define LAN9118_PMT_CTRL_PHY_RST (1 << 10) /* PHY Reset */ +#define LAN9118_PMT_CTRL_WOL_EN (1 << 9) /* Wake-On-LAN Enable */ +#define LAN9118_PMT_CTRL_ED_EN (1 << 8) /* Energy-Detect Enable */ +#define LAN9118_PMT_CTRL_PME_TYPE (1 << 6) /* PME Buffer Type */ +#define LAN9118_PMT_CTRL_WUPS_NWUED (0 << 4) /* WAKE-UP Status: No Event */ +#define LAN9118_PMT_CTRL_WUPS_ED (1 << 4) /* WAKE-UP Status: Energy */ +#define LAN9118_PMT_CTRL_WUPS_WUD (2 << 4) /* WAKE-UP Status: Wake-up */ +#define LAN9118_PMT_CTRL_PME_IND (1 << 3) /* PME indication */ +#define LAN9118_PMT_CTRL_PME_POL (1 << 2) /* PME Polarity */ +#define LAN9118_PMT_CTRL_PME_EN (1 << 1) /* PME Enable */ +#define LAN9118_PMT_CTRL_READY (1 << 0) /* Device Ready */ +#define LAN9118_GPIO_CFG 0x88 /* General Purpose IO Configuration */ +#define LAN9118_GPIO_CFG_LEDX_EN(x) (1 << ((x) + 28)) /* LED[3:1] enable */ +#define LAN9118_GPIO_CFG_GPIO_INT_POL(p) (1 << ((p) + 24)) /* Intr Polarity */ +#define LAN9118_GPIO_CFG_EEPR_EN (7 << 20) /* EEPROM Enable */ +#define LAN9118_GPIO_CFG_GPIOBUFN(n) (1 << ((n) + 16)) /* Buffer Type */ +#define LAN9118_GPIO_CFG_GPDIRN(n) (1 << ((n) + 8)) /* Direction */ +#define LAN9118_GPIO_CFG_GPODN(n) (1 << (n)) /* GPIO Data (3,4 is WO) */ +#define LAN9118_GPT_CFG 0x8c /* General Purpose Timer Config */ +#define LAN9118_GPT_CNT 0x90 /* General Purpose Timer Count */ +/* 0x94 Reserved for future use */ +#define LAN9118_WORD_SWAP 0x98 /* WORD SWAP Register */ +#define LAN9118_FREE_RUN 0x9c /* Free Run Counter */ +#define LAN9118_RX_DROP 0xa0 /* RX Drop Frame Counter */ +#define LAN9118_MAC_CSR_CMD 0xa4 /* MAC CSR Synchronizer Command */ +#define LAN9118_MAC_CSR_CMD_BUSY (1 << 31) +#define LAN9118_MAC_CSR_CMD_W (0 << 30) +#define LAN9118_MAC_CSR_CMD_R (1 << 30) +#define LAN9118_MAC_CSR_CMD_ADDRESS(a) ((a) & 0xff) +#define LAN9118_MAC_CSR_DATA 0xa8 /* MAC CSR Synchronizer Data */ +#define LAN9118_AFC_CFG 0xac /* Automatic Flow Control Config */ +#define LAN9118_AFC_CFG_AFC_HI(x) ((x) << 16) +#define LAN9118_AFC_CFG_AFC_LO(x) ((x) << 8) +#define LAN9118_AFC_CFG_BACK_DUR(x) ((x) << 4) +#define LAN9118_AFC_CFG_FCMULT (1 << 3) /* Flow Control on Multicast */ +#define LAN9118_AFC_CFG_FCBRD (1 << 2) /* Flow Control on Broadcast */ +#define LAN9118_AFC_CFG_FCADD (1 << 1) /* Flow Control on Addr Dec */ +#define LAN9118_AFC_CFG_FCANY (1 << 0) /* Flow Control on Any Frame */ +#define LAN9118_E2P_CMD 0xb0 /* EEPROM command */ +#define LAN9118_E2P_CMD_EPCB (1 << 31) /* EPC Busy */ +#define LAN9118_E2P_CMD_EPCC_READ (0 << 28) /* EPC Command: READ */ +#define LAN9118_E2P_CMD_EPCC_EWDS (1 << 28) /* EWDS */ +#define LAN9118_E2P_CMD_EPCC_EWEN (2 << 28) /* EWEN */ +#define LAN9118_E2P_CMD_EPCC_WRITE (3 << 28) /* WRITE */ +#define LAN9118_E2P_CMD_EPCC_WRAL (4 << 28) /* WRAL */ +#define LAN9118_E2P_CMD_EPCC_ERASE (5 << 28) /* ERASE */ +#define LAN9118_E2P_CMD_EPCC_ERAL (6 << 28) /* ERAL */ +#define LAN9118_E2P_CMD_EPCC_RELOAD (7 << 28) /* Reload */ +#define LAN9118_E2P_CMD_EPCTO (1 << 9) /* EPC Time-out */ +#define LAN9118_E2P_CMD_MACAL (1 << 8) /* MAC Address Loaded */ +#define LAN9118_E2P_CMD_EPCA(a) ((a) & 0xff) /* EPC Address */ +#define LAN9118_E2P_DATA 0xb4 /* EEPROM Data */ +/* 0xb8 - 0xfc Reserved for future use */ + +/* MAC Control and Status Registers */ +#define LAN9118_MAC_CR 0x1 /* MAC Control Register */ +#define LAN9118_MAC_CR_RXALL (1 << 31) /* Receive All Mode */ +#define LAN9118_MAC_CR_RCVOWN (1 << 23) /* Disable Receive Own */ +#define LAN9118_MAC_CR_LOOPBK (1 << 21) /* Loopback operation Mode */ +#define LAN9118_MAC_CR_FDPX (1 << 20) /* Full Duplex Mode */ +#define LAN9118_MAC_CR_MCPAS (1 << 19) /* Pass All Multicast */ +#define LAN9118_MAC_CR_PRMS (1 << 18) /* Promiscuous Mode */ +#define LAN9118_MAC_CR_INVFILT (1 << 17) /* Inverse filtering */ +#define LAN9118_MAC_CR_PASSBAD (1 << 16) /* Pass Bad Frames */ +#define LAN9118_MAC_CR_HO (1 << 15) /* Hash Only Filtering mode */ +#define LAN9118_MAC_CR_HPFILT (1 << 13) /* Hash/Perfect Flt Mode */ +#define LAN9118_MAC_CR_LCOLL (1 << 12) /* Late Collision Control */ +#define LAN9118_MAC_CR_BCAST (1 << 11) /* Disable Broardcast Frms */ +#define LAN9118_MAC_CR_DISRTY (1 << 10) /* Disable Retry */ +#define LAN9118_MAC_CR_PADSTR (1 << 8) /* Automatic Pad String */ +#define LAN9118_MAC_CR_BOLMT (1 << 7) /* BackOff Limit */ +#define LAN9118_MAC_CR_DFCHK (1 << 5) /* Deferral Check */ +#define LAN9118_MAC_CR_TXEN (1 << 3) /* Transmitter enable */ +#define LAN9118_MAC_CR_RXEN (1 << 2) /* Receiver enable */ +#define LAN9118_ADDRH 0x2 /* MAC Address High */ +#define LAN9118_ADDRL 0x3 /* MAC Address Low */ +#define LAN9118_HASHH 0x4 /* Multicast Hash Table High */ +#define LAN9118_HASHL 0x5 /* Multicast Hash Table Low */ +#define LAN9118_MII_ACC 0x6 /* MII Access */ +#define LAN9118_MII_ACC_PHYA(a) ((a) << 11) /* PHY Address */ +#define LAN9118_MII_ACC_MIIRINDA(i) ((i) << 6) /* MII Register Index */ +#define LAN9118_MII_ACC_MIIWNR (1 << 1) /* MII Write */ +#define LAN9118_MII_ACC_MIIBZY (1 << 0) /* MII Busy */ +#define LAN9118_MII_DATA 0x7 /* MII Data */ +#define LAN9118_FLOW 0x8 /* Flow Control */ +#define LAN9118_FLOW_FCPT(t) ((t) << 16) /* Pause Time */ +#define LAN9118_FLOW_FCPASS (1 << 2) /* Pass Control Frame */ +#define LAN9118_FLOW_FCEN (1 << 1) /* Flow Control Enable */ +#define LAN9118_FLOW_FCBUSY (1 << 0) /* Flow Control Busy */ +#define LAN9118_VLAN1 0x9 /* VLAN1 Tag */ +#define LAN9118_VLAN2 0xa /* VLAN2 Tag */ +#define LAN9118_WUFF 0xb /* Wake-up Frame Filter */ +#define LAN9118_WUCSR 0xc /* Wake-up Control and Status */ + +/* PHY Registers */ +#define LAN9118_MCSR 0x11 /* Mode Control/Status Register */ +#define LAN9118_MCSR_EDPWRDOWN (1 << 13) /* Energy Detect Power Down */ +#define LAN9118_MCSR_ENERGYON (1 << 1) +#define LAN9118_SMR 0x12 /* Special Modes Register */ +#define LAN9118_SMR_PHYAD (0x01) +#define LAN9118_SCSI 0x1b /* Special Control/Status Indications */ +#define LAN9118_SCSI_VCOOFF_LP (1 << 10) +#define LAN9118_SCSI_XPOL (1 << 4) /* Polarity state */ +#define LAN9118_ISR 0x1d /* Interrupt Source Register */ +#define LAN9118_IMR 0x1e /* Interrupt Mask Register */ +#define LAN9118_I_ENERGYON (1 << 7) +#define LAN9118_I_AUTONEGOCOMPL (1 << 6) +#define LAN9118_I_REMOTEFAULT (1 << 5) +#define LAN9118_I_LINKDOWN (1 << 4) +#define LAN9118_I_AUTONEGOLPACK (1 << 3) /* AutoNego LP Acknowledge */ +#define LAN9118_I_PDF (1 << 2) /* Parallel Detection Fault */ +#define LAN9118_I_AUTONEGOPR (1 << 1) /* AutoNego Page Received */ +#define LAN9118_PHYSCSR 0x1f /* PHY Special Control/Status Reg */ +#define LAN9118_PHYSCSR_AUTODONE (1 << 12) /* AutoNego done indication */ +#define LAN9118_PHYSCSR_SI_10 (1 << 2) /* Speed Indication */ +#define LAN9118_PHYSCSR_SI_100 (2 << 2) +#define LAN9118_PHYSCSR_SI_FDX (4 << 2) + + +/* TX Command 'A' Format */ +#define LAN9118_TXC_A_IC (1 << 31) /* Interrupt on Completion */ +#define LAN9118_TXC_A_BEA_4B (0 << 24) /* Buffer End Alignment: 4B */ +#define LAN9118_TXC_A_BEA_16B (1 << 24) /* 16B */ +#define LAN9118_TXC_A_BEA_32B (2 << 24) /* 32B */ +#define LAN9118_TXC_A_DSO(x) ((x) << 16) /*Data Start Offset: bytes*/ +#define LAN9118_TXC_A_FS (1 << 13) /* First Segment */ +#define LAN9118_TXC_A_LS (1 << 12) /* Last Segment */ +#define LAN9118_TXC_A_BS(x) ((x) << 0) /* Buffer Size */ + +/* TX Command 'B' Format */ +#define LAN9118_TXC_B_PT(x) ((x) << 16) /* Packet Tag */ +#define LAN9118_TXC_B_ACRCD (1 << 13) /* Add CRC Disable */ +#define LAN9118_TXC_B_DEFP (1 << 12) /* Dis Ether Frame Padding */ +#define LAN9118_TXC_B_PL(x) ((x) << 0) /* Packet Length */ + +/* TX Status Format */ +#define LAN9118_TXS_PKTTAG(x) (((x) >> 16) & 0xff) /* Packet Tag */ +#define LAN9118_TXS_ES (1 << 15) /* Error Status */ +#define LAN9118_TXS_LOC (1 << 11) /* Loss Of Carrier */ +#define LAN9118_TXS_NC (1 << 10) /* No Carrier */ +#define LAN9118_TXS_LCOL (1 << 9) /* Late Collision */ +#define LAN9118_TXS_ECOL (1 << 8) /* Excessive Collision*/ +#define LAN9118_TXS_COLCNT(x) (((x) >> 3) & 0xf) /* Collision Count */ +#define LAN9118_TXS_ED (1 << 2) /* Excessive Deferral */ +#define LAN9118_TXS_DEFERRED (1 << 0) /* Deferred */ + +/* RX Status Format */ +#define LAN9118_RXS_FILTFAIL (1 << 30) /* Filtering Fail */ +#define LAN9118_RXS_PKTLEN(x) (((x) >> 16) & 0x3fff) /* Packet Len */ +#define LAN9118_RXS_ES (1 << 15) /* Error Status */ +#define LAN9118_RXS_BCF (1 << 13) /* Broadcast Frame */ +#define LAN9118_RXS_LENERR (1 << 12) /* Length Error */ +#define LAN9118_RXS_RUNTF (1 << 11) /* Runt Frame */ +#define LAN9118_RXS_MCF (1 << 10) /* Multicast Frame */ +#define LAN9118_RXS_FTL (1 << 7) /* Frame Too Long */ +#define LAN9118_RXS_COLS (1 << 6) /* Collision Seen */ +#define LAN9118_RXS_FT (1 << 5) /* Frame Type */ +#define LAN9118_RXS_RWTO (1 << 4) /* Rcv Watchdog time-out */ +#define LAN9118_RXS_MIIERR (1 << 3) /* MII Error */ +#define LAN9118_RXS_DBIT (1 << 2) /* Drabbling Bit */ +#define LAN9118_RXS_CRCERR (1 << 1) /* CRC Error */ +/* Basic mode control register. */ +#define LAN9118_BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ +#define LAN9118_BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ +#define LAN9118_BMCR_RESET 0x8000 /* Reset the DP83840 */ +#define LAN9118_BMSR_LSTATUS 0x0004 /* Link status */ /* Generic MII registers. */ +#define LAN9118_MII_BMCR 0x00 /* Basic mode control register */ +#define LAN9118_MII_BMSR 0x01 /* Basic mode status register */ +#define LAN9118_MII_ADVERTISE 0x04 /* Advertisement control register */ -#define MII_BMCR 0x00 /* Basic mode control register */ -#define MII_BMSR 0x01 /* Basic mode status register */ -#define MII_PHYSID1 0x02 /* PHYS ID 1 */ -#define MII_PHYSID2 0x03 /* PHYS ID 2 */ -#define MII_ADVERTISE 0x04 /* Advertisement control reg */ -#define MII_LPA 0x05 /* Link partner ability reg */ -#define MII_EXPANSION 0x06 /* Expansion register */ -#define MII_CTRL1000 0x09 /* 1000BASE-T control */ -#define MII_STAT1000 0x0a /* 1000BASE-T status */ -#define MII_ESTATUS 0x0f /* Extended Status */ -#define MII_DCOUNTER 0x12 /* Disconnect counter */ -#define MII_FCSCOUNTER 0x13 /* False carrier counter */ -#define MII_NWAYTEST 0x14 /* N-way auto-neg test reg */ -#define MII_RERRCOUNTER 0x15 /* Receive error counter */ -#define MII_SREVISION 0x16 /* Silicon revision */ -#define MII_RESV1 0x17 /* Reserved... */ -#define MII_LBRERROR 0x18 /* Lpback, rx, bypass error */ -#define MII_PHYADDR 0x19 /* PHY address */ -#define MII_RESV2 0x1a /* Reserved... */ -#define MII_TPISTATUS 0x1b /* TPI status for 10mbps */ -#define MII_NCONFIG 0x1c /* Network interface config */ +#define LAN9118_GPT_CFG_TIMER_EN 0x20000000 /* R/W */ -/* Basic mode control register. */ -#define BMCR_RESV 0x003f /* Unused... */ -#define BMCR_SPEED1000 0x0040 /* MSB of Speed (1000) */ -#define BMCR_CTST 0x0080 /* Collision test */ -#define BMCR_FULLDPLX 0x0100 /* Full duplex */ -#define BMCR_ANRESTART 0x0200 /* Auto negotiation restart */ -#define BMCR_ISOLATE 0x0400 /* Disconnect DP83840 from MII */ -#define BMCR_PDOWN 0x0800 /* Powerdown the DP83840 */ -#define BMCR_ANENABLE 0x1000 /* Enable auto negotiation */ -#define BMCR_SPEED100 0x2000 /* Select 100Mbps */ -#define BMCR_LOOPBACK 0x4000 /* TXD loopback bits */ -#define BMCR_RESET 0x8000 /* Reset the DP83840 */ +#define LAN9118_RX_STS_PKT_LEN 0x3FFF0000 +#define LAN9118_TX_STS_UNDERRUN 0x00000002 + +#define LAN9118_HW_CFG_SF 0x00100000 /* R/W */ -/* Basic mode status register. */ -#define BMSR_ERCAP 0x0001 /* Ext-reg capability */ -#define BMSR_JCD 0x0002 /* Jabber detected */ -#define BMSR_LSTATUS 0x0004 /* Link status */ -#define BMSR_ANEGCAPABLE 0x0008 /* Able to do auto-negotiation */ -#define BMSR_RFAULT 0x0010 /* Remote fault detected */ -#define BMSR_ANEGCOMPLETE 0x0020 /* Auto-negotiation complete */ -#define BMSR_RESV 0x00c0 /* Unused... */ -#define BMSR_ESTATEN 0x0100 /* Extended Status in R15 */ -#define BMSR_100HALF2 0x0200 /* Can do 100BASE-T2 HDX */ -#define BMSR_100FULL2 0x0400 /* Can do 100BASE-T2 FDX */ -#define BMSR_10HALF 0x0800 /* Can do 10mbps, half-duplex */ -#define BMSR_10FULL 0x1000 /* Can do 10mbps, full-duplex */ -#define BMSR_100HALF 0x2000 /* Can do 100mbps, half-duplex */ -#define BMSR_100FULL 0x4000 /* Can do 100mbps, full-duplex */ -#define BMSR_100BASE4 0x8000 /* Can do 100mbps, 4k packets */ +#define LAN9118_INT_STS_RSFL 0x00000008 /* R/WC */ +#define LAN9118_INT_EN_RDFL_EN 0x00000020 /* R/W */ +#define LAN9118_MAC_CR_HBDIS 0x10000000 -#endif +#endif /* _LAN9118REG_H_ */ diff --git a/bsp/qemu-vexpress-a9/drivers/drv_timer.c b/bsp/qemu-vexpress-a9/drivers/drv_timer.c index 7abfea0fa..6d6001b56 100644 --- a/bsp/qemu-vexpress-a9/drivers/drv_timer.c +++ b/bsp/qemu-vexpress-a9/drivers/drv_timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -89,7 +89,7 @@ void timer_init(int timer, unsigned int preload) { uint32_t val; - if (timer == 0) + if (timer == 0) { /* Setup Timer0 for generating irq */ val = TIMER_CTRL(TIMER01_HW_BASE); @@ -101,8 +101,8 @@ void timer_init(int timer, unsigned int preload) /* enable timer */ TIMER_CTRL(TIMER01_HW_BASE) |= TIMER_CTRL_ENABLE; - } - else + } + else { /* Setup Timer1 for generating irq */ val = TIMER_CTRL(TIMER23_HW_BASE); @@ -122,7 +122,7 @@ void timer_clear_pending(int timer) if (timer == 0) { TIMER_INTCLR(TIMER01_HW_BASE) = 0x01; - } + } else { TIMER_INTCLR(TIMER23_HW_BASE) = 0x01; diff --git a/bsp/qemu-vexpress-a9/drivers/drv_timer.h b/bsp/qemu-vexpress-a9/drivers/drv_timer.h index 718f5d43c..c50b073d3 100644 --- a/bsp/qemu-vexpress-a9/drivers/drv_timer.h +++ b/bsp/qemu-vexpress-a9/drivers/drv_timer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/qemu-vexpress-a9/drivers/secondary_cpu.c b/bsp/qemu-vexpress-a9/drivers/secondary_cpu.c index 3b0428859..cddba63aa 100644 --- a/bsp/qemu-vexpress-a9/drivers/secondary_cpu.c +++ b/bsp/qemu-vexpress-a9/drivers/secondary_cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/qemu-vexpress-a9/drivers/serial.c b/bsp/qemu-vexpress-a9/drivers/serial.c index 786a26a4b..ebb5b31ea 100644 --- a/bsp/qemu-vexpress-a9/drivers/serial.c +++ b/bsp/qemu-vexpress-a9/drivers/serial.c @@ -1,26 +1,7 @@ /* - * serial.c UART driver + * Copyright (c) 2006-2021, RT-Thread Development Team * - * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd - * - * This file is part of RT-Thread (http://www.rt-thread.org) - * Maintainer: bernard.xiong - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/bsp/qemu-vexpress-a9/drivers/serial.h b/bsp/qemu-vexpress-a9/drivers/serial.h index 52e6f07ea..dceea68d1 100644 --- a/bsp/qemu-vexpress-a9/drivers/serial.h +++ b/bsp/qemu-vexpress-a9/drivers/serial.h @@ -1,26 +1,7 @@ /* - * UART driver + * Copyright (c) 2006-2021, RT-Thread Development Team * - * COPYRIGHT (C) 2013, Shanghai Real-Thread Technology Co., Ltd - * - * This file is part of RT-Thread (http://www.rt-thread.org) - * Maintainer: bernard.xiong - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/bsp/qemu-vexpress-a9/drivers/vexpress_a9.h b/bsp/qemu-vexpress-a9/drivers/vexpress_a9.h index a6467973c..5ecb8ecf3 100644 --- a/bsp/qemu-vexpress-a9/drivers/vexpress_a9.h +++ b/bsp/qemu-vexpress-a9/drivers/vexpress_a9.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/qemu-vexpress-a9/rtconfig.h b/bsp/qemu-vexpress-a9/rtconfig.h index 186f3a225..39ba6ab81 100644 --- a/bsp/qemu-vexpress-a9/rtconfig.h +++ b/bsp/qemu-vexpress-a9/rtconfig.h @@ -47,7 +47,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart0" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_A #define ARCH_ARM_CORTEX_A9 diff --git a/bsp/stm32/libraries/HAL_Drivers/SConscript b/bsp/stm32/libraries/HAL_Drivers/SConscript index 02f68afa2..12525b9ff 100644 --- a/bsp/stm32/libraries/HAL_Drivers/SConscript +++ b/bsp/stm32/libraries/HAL_Drivers/SConscript @@ -55,6 +55,9 @@ if GetDepend('BSP_USING_LCD_MIPI'): if GetDepend('BSP_USING_ONCHIP_RTC'): src += ['drv_rtc.c'] +if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32G0']): + src += ['drv_flash/drv_flash_g0.c'] + if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F0']): src += ['drv_flash/drv_flash_f0.c'] @@ -73,6 +76,8 @@ if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32F7']): if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32L4']): src += ['drv_flash/drv_flash_l4.c'] +if GetDepend(['BSP_USING_ON_CHIP_FLASH', 'SOC_SERIES_STM32H7']): + src += ['drv_flash/drv_flash_h7.c'] if GetDepend('RT_USING_HWCRYPTO'): src += ['drv_crypto.c'] @@ -88,6 +93,9 @@ if GetDepend(['BSP_USING_USBD']): if GetDepend(['BSP_USING_PULSE_ENCODER']): src += ['drv_pulse_encoder.c'] +if GetDepend(['BSP_USING_USBH']): + src += ['drv_usbh.c'] + src += ['drv_common.c'] path = [cwd] diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/adc_config.h index 3615ebab5..1c432ca97 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/dma_config.h index a8d177801..077e03896 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { #define UART1_RX_DMA_INSTANCE DMA1_Channel3 #define UART1_RX_DMA_IRQ DMA1_Ch2_3_DMA2_Ch1_2_IRQn #elif defined(BSP_SPI1_RX_USING_DMA) && !defined(SPI1_RX_DMA_INSTANCE) -#define SPI1_DMA_RX_TX_IRQHandler DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler +#define SPI1_DMA_RX_TX_IRQHandler DMA1_Ch2_3_DMA2_Ch1_2_IRQHandler #define SPI1_RX_DMA_RCC RCC_AHBENR_DMA1EN #define SPI1_RX_DMA_INSTANCE DMA1_Channel2 #define SPI1_RX_DMA_IRQ DMA1_Ch2_3_DMA2_Ch1_2_IRQn diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/pwm_config.h index 9ade01dfa..3a91b88dc 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h index 3d66d703e..79523e704 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -59,7 +59,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h index 0bba70cd4..ca37509e0 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f0/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f0/uart_config.h index ea5e767ae..649ec1f4e 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f0/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f0/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -49,7 +49,7 @@ extern "C" { } #endif /* UART2_CONFIG */ #endif /* BSP_USING_UART2 */ - + #if defined(BSP_UART2_RX_USING_DMA) #ifndef UART2_DMA_RX_CONFIG #define UART2_DMA_RX_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/adc_config.h index ac0a7ca37..825aaf102 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -29,7 +29,7 @@ extern "C" { .Init.DiscontinuousConvMode = DISABLE, \ .Init.NbrOfDiscConversion = 1, \ .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - } + } #endif /* ADC1_CONFIG */ #endif /* BSP_USING_ADC1 */ @@ -45,7 +45,7 @@ extern "C" { .Init.DiscontinuousConvMode = DISABLE, \ .Init.NbrOfDiscConversion = 1, \ .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - } + } #endif /* ADC2_CONFIG */ #endif /* BSP_USING_ADC2 */ @@ -61,7 +61,7 @@ extern "C" { .Init.DiscontinuousConvMode = DISABLE, \ .Init.NbrOfDiscConversion = 1, \ .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - } + } #endif /* ADC3_CONFIG */ #endif /* BSP_USING_ADC3 */ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/dma_config.h index 20205c43d..65e136a2c 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/pulse_encoder_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/pulse_encoder_config.h index 94dd8fcd7..1de5c72b2 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/pulse_encoder_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/pulse_encoder_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/pwm_config.h index 1a5575de0..c4d4bcf20 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,6 +17,17 @@ extern "C" { #endif +#ifdef BSP_USING_PWM1 +#ifndef PWM1_CONFIG +#define PWM1_CONFIG \ + { \ + .tim_handle.Instance = TIM1, \ + .name = "pwm1", \ + .channel = 0 \ + } +#endif /* PWM1_CONFIG */ +#endif /* BSP_USING_PWM1 */ + #ifdef BSP_USING_PWM2 #ifndef PWM2_CONFIG #define PWM2_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/sdio_config.h index b68d5ce6b..16d352618 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h index c4bbe3708..bf28c2fc7 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -59,7 +59,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -91,7 +91,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/tim_config.h index 1d3b245dc..07478f146 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/uart_config.h index a08196e99..8605d9089 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f1/usbd_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f1/usbd_config.h index d58b86f6d..686055a70 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f1/usbd_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f1/usbd_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/adc_config.h index bda1a0648..711dd21bb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/dma_config.h index cd2161276..df8883038 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -134,7 +134,7 @@ extern "C" { #endif /* DMA2 stream3 */ -#if defined(BSP_SPI1_TX_USING_DMA) && !defined(SPI1_TX_DMA_INSTANCE) +#if defined(BSP_SPI1_TX_USING_DMA) && !defined(SPI1_TX_DMA_INSTANCE) #define SPI1_DMA_TX_IRQHandler DMA2_Stream3_IRQHandler #define SPI1_TX_DMA_RCC RCC_AHB1ENR_DMA2EN #define SPI1_TX_DMA_INSTANCE DMA2_Stream3 diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/pwm_config.h index 1a5575de0..b8ef2d37f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/sdio_config.h index 26fb77e26..c17ef65fa 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h index cf1e8bcea..b3e9507b1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -61,7 +61,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -95,7 +95,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/tim_config.h index a5b47af3a..4484a2042 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f2/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f2/uart_config.h index 6d8655fc2..118143a82 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f2/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f2/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-10-30 SummerGift first version * 2019-01-03 zylx modify dma support */ - + #ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__ @@ -27,7 +27,7 @@ extern "C" { .irq_type = USART1_IRQn, \ } #endif /* UART1_CONFIG */ - + #if defined(BSP_UART1_RX_USING_DMA) #ifndef UART1_DMA_RX_CONFIG #define UART1_DMA_RX_CONFIG \ @@ -74,7 +74,7 @@ extern "C" { } #endif /* UART2_DMA_RX_CONFIG */ #endif /* BSP_UART2_RX_USING_DMA */ - + #if defined(BSP_UART2_TX_USING_DMA) #ifndef UART2_DMA_TX_CONFIG #define UART2_DMA_TX_CONFIG \ @@ -109,7 +109,7 @@ extern "C" { } #endif /* UART3_DMA_RX_CONFIG */ #endif /* BSP_UART3_RX_USING_DMA */ - + #if defined(BSP_UART3_TX_USING_DMA) #ifndef UART3_DMA_TX_CONFIG #define UART3_DMA_TX_CONFIG \ @@ -179,7 +179,7 @@ extern "C" { } #endif /* UART5_DMA_RX_CONFIG */ #endif /* BSP_UART5_RX_USING_DMA */ - + #if defined(BSP_UART5_TX_USING_DMA) #ifndef UART5_DMA_TX_CONFIG #define UART5_DMA_TX_CONFIG \ @@ -214,7 +214,7 @@ extern "C" { } #endif /* UART6_DMA_RX_CONFIG */ #endif /* BSP_UART6_RX_USING_DMA */ - + #if defined(BSP_UART6_TX_USING_DMA) #ifndef UART6_DMA_TX_CONFIG #define UART6_DMA_TX_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/adc_config.h index bda1a0648..711dd21bb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h index 46411c544..80d45afc7 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -157,12 +157,12 @@ extern "C" { #define SPI1_RX_DMA_INSTANCE DMA2_Stream0 #define SPI1_RX_DMA_CHANNEL DMA_CHANNEL_3 #define SPI1_RX_DMA_IRQ DMA2_Stream0_IRQn -#elif defined(BSP_SPI4_TX_USING_DMA) && !defined(SPI4_TX_DMA_INSTANCE) -#define SPI4_DMA_TX_IRQHandler DMA2_Stream0_IRQHandler -#define SPI4_TX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI4_TX_DMA_INSTANCE DMA2_Stream0 -#define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_4 -#define SPI4_TX_DMA_IRQ DMA2_Stream0_IRQn +#elif defined(BSP_SPI4_RX_USING_DMA) && !defined(SPI4_RX_DMA_INSTANCE) +#define SPI4_DMA_RX_IRQHandler DMA2_Stream0_IRQHandler +#define SPI4_RX_DMA_RCC RCC_AHB1ENR_DMA2EN +#define SPI4_RX_DMA_INSTANCE DMA2_Stream0 +#define SPI4_RX_DMA_CHANNEL DMA_CHANNEL_4 +#define SPI4_RX_DMA_IRQ DMA2_Stream0_IRQn #endif /* DMA2 stream1 */ @@ -208,12 +208,12 @@ extern "C" { #define SPI1_TX_DMA_INSTANCE DMA2_Stream3 #define SPI1_TX_DMA_CHANNEL DMA_CHANNEL_3 #define SPI1_TX_DMA_IRQ DMA2_Stream3_IRQn -#elif defined(BSP_SPI4_TX_USING_DMA) && !defined(SPI4_TX_DMA_INSTANCE) -#define SPI4_DMA_TX_IRQHandler DMA2_Stream3_IRQHandler -#define SPI4_TX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI4_TX_DMA_INSTANCE DMA2_Stream3 -#define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_5 -#define SPI4_TX_DMA_IRQ DMA2_Stream3_IRQn +#elif defined(BSP_SPI4_RX_USING_DMA) && !defined(SPI4_RX_DMA_INSTANCE) +#define SPI4_DMA_RX_IRQHandler DMA2_Stream3_IRQHandler +#define SPI4_RX_DMA_RCC RCC_AHB1ENR_DMA2EN +#define SPI4_RX_DMA_INSTANCE DMA2_Stream3 +#define SPI4_RX_DMA_CHANNEL DMA_CHANNEL_5 +#define SPI4_RX_DMA_IRQ DMA2_Stream3_IRQn #endif /* DMA2 stream4 */ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/pulse_encoder_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/pulse_encoder_config.h index 53320efda..f9534e0a4 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/pulse_encoder_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/pulse_encoder_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/pwm_config.h index 14d4aa2af..c23abe0ae 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -61,6 +61,17 @@ extern "C" { #endif /* PWM5_CONFIG */ #endif /* BSP_USING_PWM5 */ +#ifdef BSP_USING_PWM9 +#ifndef PWM9_CONFIG +#define PWM9_CONFIG \ + { \ + .tim_handle.Instance = TIM9, \ + .name = "pwm9", \ + .channel = 0 \ + } +#endif /* PWM9_CONFIG */ +#endif /* BSP_USING_PWM9 */ + #ifdef BSP_USING_PWM12 #ifndef PWM12_CONFIG #define PWM12_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/qspi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/qspi_config.h index 8450dc257..5089a10bd 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/qspi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/qspi_config.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018-12-22 zylx first version + * 2018-12-22 zylx first version */ #ifndef __QSPI_CONFIG_H__ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/sdio_config.h index a8328b1da..d26002000 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h index 34b0590eb..d03b31ce8 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -61,7 +61,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -95,7 +95,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ @@ -129,7 +129,7 @@ extern "C" { } #endif /* SPI4_BUS_CONFIG */ #endif /* BSP_USING_SPI4 */ - + #ifdef BSP_SPI4_TX_USING_DMA #ifndef SPI4_TX_DMA_CONFIG #define SPI4_TX_DMA_CONFIG \ @@ -163,7 +163,7 @@ extern "C" { } #endif /* SPI5_BUS_CONFIG */ #endif /* BSP_USING_SPI5 */ - + #ifdef BSP_SPI5_TX_USING_DMA #ifndef SPI5_TX_DMA_CONFIG #define SPI5_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/tim_config.h index cd116d9e1..72e0239de 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,6 +27,17 @@ extern "C" { } #endif /* TIM_DEV_INFO_CONFIG */ +#ifdef BSP_USING_TIM3 +#ifndef TIM3_CONFIG +#define TIM3_CONFIG \ + { \ + .tim_handle.Instance = TIM3, \ + .tim_irqn = TIM3_IRQn, \ + .name = "timer3", \ + } +#endif /* TIM3_CONFIG */ +#endif /* BSP_USING_TIM3 */ + #ifdef BSP_USING_TIM11 #ifndef TIM11_CONFIG #define TIM11_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h index e42b5a1a9..acde141c6 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-10-30 SummerGift first version * 2019-01-03 zylx modify dma support */ - + #ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__ @@ -27,7 +27,7 @@ extern "C" { .irq_type = USART1_IRQn, \ } #endif /* UART1_CONFIG */ - + #if defined(BSP_UART1_RX_USING_DMA) #ifndef UART1_DMA_RX_CONFIG #define UART1_DMA_RX_CONFIG \ @@ -74,7 +74,7 @@ extern "C" { } #endif /* UART2_DMA_RX_CONFIG */ #endif /* BSP_UART2_RX_USING_DMA */ - + #if defined(BSP_UART2_TX_USING_DMA) #ifndef UART2_DMA_TX_CONFIG #define UART2_DMA_TX_CONFIG \ @@ -109,7 +109,7 @@ extern "C" { } #endif /* UART3_DMA_RX_CONFIG */ #endif /* BSP_UART3_RX_USING_DMA */ - + #if defined(BSP_UART3_TX_USING_DMA) #ifndef UART3_DMA_TX_CONFIG #define UART3_DMA_TX_CONFIG \ @@ -179,7 +179,7 @@ extern "C" { } #endif /* UART5_DMA_RX_CONFIG */ #endif /* BSP_UART5_RX_USING_DMA */ - + #if defined(BSP_UART5_TX_USING_DMA) #ifndef UART5_DMA_TX_CONFIG #define UART5_DMA_TX_CONFIG \ @@ -214,7 +214,7 @@ extern "C" { } #endif /* UART6_DMA_RX_CONFIG */ #endif /* BSP_UART6_RX_USING_DMA */ - + #if defined(BSP_UART6_TX_USING_DMA) #ifndef UART6_DMA_TX_CONFIG #define UART6_DMA_TX_CONFIG \ @@ -249,7 +249,7 @@ extern "C" { } #endif /* UART7_DMA_RX_CONFIG */ #endif /* BSP_UART7_RX_USING_DMA */ - + #if defined(BSP_UART7_TX_USING_DMA) #ifndef UART7_DMA_TX_CONFIG #define UART7_DMA_TX_CONFIG \ @@ -284,7 +284,7 @@ extern "C" { } #endif /* UART8_DMA_RX_CONFIG */ #endif /* BSP_UART8_RX_USING_DMA */ - + #if defined(BSP_UART8_TX_USING_DMA) #ifndef UART8_DMA_TX_CONFIG #define UART8_DMA_TX_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f4/usbd_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f4/usbd_config.h index a6fc9a4c4..31a648ad1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f4/usbd_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f4/usbd_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/adc_config.h index bda1a0648..711dd21bb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/dma_config.h index f716e2376..43a9955e5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/pwm_config.h index 1a5575de0..b8ef2d37f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/qspi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/qspi_config.h index f4477f498..bee2eb5d8 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/qspi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/qspi_config.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018-12-22 zylx first version + * 2018-12-22 zylx first version */ #ifndef __QSPI_CONFIG_H__ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h index ae1e4bbf6..bea45515c 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h index ef32a32f4..26f230d9b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -26,7 +26,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -60,7 +60,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -94,7 +94,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ @@ -128,7 +128,7 @@ extern "C" { } #endif /* SPI4_BUS_CONFIG */ #endif /* BSP_USING_SPI4 */ - + #ifdef BSP_SPI4_TX_USING_DMA #ifndef SPI4_TX_DMA_CONFIG #define SPI4_TX_DMA_CONFIG \ @@ -162,7 +162,7 @@ extern "C" { } #endif /* SPI5_BUS_CONFIG */ #endif /* BSP_USING_SPI5 */ - + #ifdef BSP_SPI5_TX_USING_DMA #ifndef SPI5_TX_DMA_CONFIG #define SPI5_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/tim_config.h index cd116d9e1..41ef9f9ee 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/f7/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/f7/uart_config.h index 6c5b7c840..7c6f38b69 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/f7/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/f7/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-10-30 SummerGift first version * 2019-01-05 zylx modify dma support */ - + #ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__ @@ -19,7 +19,7 @@ extern "C" { #endif #if defined(BSP_USING_UART1) -#ifndef UART1_CONFIG +#ifndef UART1_CONFIG #define UART1_CONFIG \ { \ .name = "uart1", \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/adc_config.h index 739598e7d..9adaf25fe 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/dma_config.h index 39a79dd53..1340f7c4b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/pwm_config.h index 834903f65..bc9c375b7 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h index a09ec948a..a33777977 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -61,7 +61,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/tim_config.h index 01d3af18f..ac6e402ac 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h index f38baf0b6..3cbb77eef 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g0/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/adc_config.h index bda1a0648..711dd21bb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/dma_config.h index 46411c544..419dff4ae 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/pulse_encoder_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/pulse_encoder_config.h index 53320efda..f9534e0a4 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/pulse_encoder_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/pulse_encoder_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/pwm_config.h index 14d4aa2af..ca382e474 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/qspi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/qspi_config.h index 8450dc257..5089a10bd 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/qspi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/qspi_config.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018-12-22 zylx first version + * 2018-12-22 zylx first version */ #ifndef __QSPI_CONFIG_H__ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/sdio_config.h index 7d6837d74..a61749cea 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h index 34b0590eb..d03b31ce8 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -61,7 +61,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -95,7 +95,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ @@ -129,7 +129,7 @@ extern "C" { } #endif /* SPI4_BUS_CONFIG */ #endif /* BSP_USING_SPI4 */ - + #ifdef BSP_SPI4_TX_USING_DMA #ifndef SPI4_TX_DMA_CONFIG #define SPI4_TX_DMA_CONFIG \ @@ -163,7 +163,7 @@ extern "C" { } #endif /* SPI5_BUS_CONFIG */ #endif /* BSP_USING_SPI5 */ - + #ifdef BSP_SPI5_TX_USING_DMA #ifndef SPI5_TX_DMA_CONFIG #define SPI5_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/tim_config.h index cd116d9e1..41ef9f9ee 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/uart_config.h index 5a77643a5..54a2cc380 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,7 +9,7 @@ * 2019-01-03 zylx modify dma support * 2019-10-03 xuzhuoyi modify for STM32G4 */ - + #ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__ @@ -50,7 +50,7 @@ extern "C" { .irq_type = USART1_IRQn, \ } #endif /* UART1_CONFIG */ - + #if defined(BSP_UART1_RX_USING_DMA) #ifndef UART1_DMA_RX_CONFIG #define UART1_DMA_RX_CONFIG \ @@ -97,7 +97,7 @@ extern "C" { } #endif /* UART2_DMA_RX_CONFIG */ #endif /* BSP_UART2_RX_USING_DMA */ - + #if defined(BSP_UART2_TX_USING_DMA) #ifndef UART2_DMA_TX_CONFIG #define UART2_DMA_TX_CONFIG \ @@ -132,7 +132,7 @@ extern "C" { } #endif /* UART3_DMA_RX_CONFIG */ #endif /* BSP_UART3_RX_USING_DMA */ - + #if defined(BSP_UART3_TX_USING_DMA) #ifndef UART3_DMA_TX_CONFIG #define UART3_DMA_TX_CONFIG \ @@ -202,7 +202,7 @@ extern "C" { } #endif /* UART5_DMA_RX_CONFIG */ #endif /* BSP_UART5_RX_USING_DMA */ - + #if defined(BSP_UART5_TX_USING_DMA) #ifndef UART5_DMA_TX_CONFIG #define UART5_DMA_TX_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/g4/usbd_config.h b/bsp/stm32/libraries/HAL_Drivers/config/g4/usbd_config.h index a6fc9a4c4..31a648ad1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/g4/usbd_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/g4/usbd_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/adc_config.h index bda1a0648..28e31f133 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,63 +19,69 @@ extern "C" { #ifdef BSP_USING_ADC1 #ifndef ADC1_CONFIG -#define ADC1_CONFIG \ - { \ - .Instance = ADC1, \ - .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ - .Init.Resolution = ADC_RESOLUTION_12B, \ - .Init.DataAlign = ADC_DATAALIGN_RIGHT, \ - .Init.ScanConvMode = DISABLE, \ - .Init.EOCSelection = DISABLE, \ - .Init.ContinuousConvMode = DISABLE, \ - .Init.NbrOfConversion = 1, \ - .Init.DiscontinuousConvMode = DISABLE, \ - .Init.NbrOfDiscConversion = 0, \ - .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ - .Init.DMAContinuousRequests = DISABLE, \ +#define ADC1_CONFIG \ + { \ + .Instance = ADC1, \ + .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ + .Init.Resolution = ADC_RESOLUTION_16B, \ + .Init.ScanConvMode = ADC_SCAN_DISABLE, \ + .Init.EOCSelection = ADC_EOC_SINGLE_CONV, \ + .Init.LowPowerAutoWait = DISABLE, \ + .Init.ContinuousConvMode = DISABLE, \ + .Init.NbrOfConversion = 1, \ + .Init.DiscontinuousConvMode = DISABLE, \ + .Init.NbrOfDiscConversion = 1, \ + .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ + .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ + .Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \ + .Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \ + .Init.OversamplingMode = DISABLE, \ } #endif /* ADC1_CONFIG */ #endif /* BSP_USING_ADC1 */ #ifdef BSP_USING_ADC2 #ifndef ADC2_CONFIG -#define ADC2_CONFIG \ - { \ - .Instance = ADC2, \ - .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ - .Init.Resolution = ADC_RESOLUTION_12B, \ - .Init.DataAlign = ADC_DATAALIGN_RIGHT, \ - .Init.ScanConvMode = DISABLE, \ - .Init.EOCSelection = DISABLE, \ - .Init.ContinuousConvMode = DISABLE, \ - .Init.NbrOfConversion = 1, \ - .Init.DiscontinuousConvMode = DISABLE, \ - .Init.NbrOfDiscConversion = 0, \ - .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ - .Init.DMAContinuousRequests = DISABLE, \ +#define ADC2_CONFIG \ + { \ + .Instance = ADC2, \ + .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ + .Init.Resolution = ADC_RESOLUTION_16B, \ + .Init.ScanConvMode = ADC_SCAN_DISABLE, \ + .Init.EOCSelection = ADC_EOC_SINGLE_CONV, \ + .Init.LowPowerAutoWait = DISABLE, \ + .Init.ContinuousConvMode = DISABLE, \ + .Init.NbrOfConversion = 1, \ + .Init.DiscontinuousConvMode = DISABLE, \ + .Init.NbrOfDiscConversion = 1, \ + .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ + .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ + .Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \ + .Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \ + .Init.OversamplingMode = DISABLE, \ } #endif /* ADC2_CONFIG */ #endif /* BSP_USING_ADC2 */ #ifdef BSP_USING_ADC3 #ifndef ADC3_CONFIG -#define ADC3_CONFIG \ - { \ - .Instance = ADC3, \ - .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ - .Init.Resolution = ADC_RESOLUTION_12B, \ - .Init.DataAlign = ADC_DATAALIGN_RIGHT, \ - .Init.ScanConvMode = DISABLE, \ - .Init.EOCSelection = DISABLE, \ - .Init.ContinuousConvMode = DISABLE, \ - .Init.NbrOfConversion = 1, \ - .Init.DiscontinuousConvMode = DISABLE, \ - .Init.NbrOfDiscConversion = 0, \ - .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ - .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ - .Init.DMAContinuousRequests = DISABLE, \ +#define ADC3_CONFIG \ + { \ + .Instance = ADC3, \ + .Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4, \ + .Init.Resolution = ADC_RESOLUTION_16B, \ + .Init.ScanConvMode = ADC_SCAN_DISABLE, \ + .Init.EOCSelection = ADC_EOC_SINGLE_CONV, \ + .Init.LowPowerAutoWait = DISABLE, \ + .Init.ContinuousConvMode = DISABLE, \ + .Init.NbrOfConversion = 1, \ + .Init.DiscontinuousConvMode = DISABLE, \ + .Init.NbrOfDiscConversion = 1, \ + .Init.ExternalTrigConv = ADC_SOFTWARE_START, \ + .Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE, \ + .Init.ConversionDataManagement = ADC_CONVERSIONDATA_DR, \ + .Init.Overrun = ADC_OVR_DATA_OVERWRITTEN, \ + .Init.OversamplingMode = DISABLE, \ } #endif /* ADC3_CONFIG */ #endif /* BSP_USING_ADC3 */ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/dma_config.h index f716e2376..2164bf74f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,27 +19,21 @@ extern "C" { #endif /* DMA1 stream0 */ -#if defined(BSP_SPI3_RX_USING_DMA) && !defined(SPI3_RX_DMA_INSTANCE) -#define SPI3_DMA_RX_IRQHandler DMA1_Stream0_IRQHandler -#define SPI3_RX_DMA_RCC RCC_AHB1ENR_DMA1EN -#define SPI3_RX_DMA_INSTANCE DMA1_Stream0 -#define SPI3_RX_DMA_CHANNEL DMA_CHANNEL_0 -#define SPI3_RX_DMA_IRQ DMA1_Stream0_IRQn -#elif defined(BSP_UART5_RX_USING_DMA) && !defined(UART5_RX_DMA_INSTANCE) -#define UART5_DMA_RX_IRQHandler DMA1_Stream0_IRQHandler -#define UART5_RX_DMA_RCC RCC_AHB1ENR_DMA1EN -#define UART5_RX_DMA_INSTANCE DMA1_Stream0 -#define UART5_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART5_RX_DMA_IRQ DMA1_Stream0_IRQn +#if defined(BSP_UART2_RX_USING_DMA) && !defined(UART2_RX_DMA_INSTANCE) +#define UART2_DMA_RX_IRQHandler DMA1_Stream0_IRQHandler +#define UART2_RX_DMA_RCC RCC_AHB1ENR_DMA1EN +#define UART2_RX_DMA_INSTANCE DMA1_Stream0 +#define UART2_RX_DMA_REQUEST DMA_REQUEST_USART2_RX +#define UART2_RX_DMA_IRQ DMA1_Stream0_IRQn #endif /* DMA1 stream1 */ -#if defined(BSP_UART3_RX_USING_DMA) && !defined(UART3_RX_DMA_INSTANCE) -#define UART3_DMA_RX_IRQHandler DMA1_Stream1_IRQHandler -#define UART3_RX_DMA_RCC RCC_AHB1ENR_DMA1EN -#define UART3_RX_DMA_INSTANCE DMA1_Stream1 -#define UART3_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART3_RX_DMA_IRQ DMA1_Stream1_IRQn +#if defined(BSP_UART2_TX_USING_DMA) && !defined(UART2_TX_DMA_INSTANCE) +#define UART2_DMA_TX_IRQHandler DMA1_Stream1_IRQHandler +#define UART2_TX_DMA_RCC RCC_AHB1ENR_DMA1EN +#define UART2_TX_DMA_INSTANCE DMA1_Stream1 +#define UART2_TX_DMA_REQUEST DMA_REQUEST_USART2_TX +#define UART2_TX_DMA_IRQ DMA1_Stream1_IRQn #endif /* DMA1 stream2 */ @@ -49,12 +43,6 @@ extern "C" { #define SPI3_RX_DMA_INSTANCE DMA1_Stream2 #define SPI3_RX_DMA_CHANNEL DMA_CHANNEL_0 #define SPI3_RX_DMA_IRQ DMA1_Stream2_IRQn -#elif defined(BSP_UART4_RX_USING_DMA) && !defined(UART4_RX_DMA_INSTANCE) -#define UART4_DMA_RX_IRQHandler DMA1_Stream2_IRQHandler -#define UART4_RX_DMA_RCC RCC_AHB1ENR_DMA1EN -#define UART4_RX_DMA_INSTANCE DMA1_Stream2 -#define UART4_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART4_RX_DMA_IRQ DMA1_Stream2_IRQn #endif /* DMA1 stream3 */ @@ -83,12 +71,6 @@ extern "C" { #define SPI3_TX_DMA_INSTANCE DMA1_Stream5 #define SPI3_TX_DMA_CHANNEL DMA_CHANNEL_0 #define SPI3_TX_DMA_IRQ DMA1_Stream5_IRQn -#elif defined(BSP_UART2_RX_USING_DMA) && !defined(UART2_RX_DMA_INSTANCE) -#define UART2_DMA_RX_IRQHandler DMA1_Stream5_IRQHandler -#define UART2_RX_DMA_RCC RCC_AHB1ENR_DMA1EN -#define UART2_RX_DMA_INSTANCE DMA1_Stream5 -#define UART2_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART2_RX_DMA_IRQ DMA1_Stream5_IRQn #endif /* DMA1 stream6 */ @@ -109,12 +91,6 @@ extern "C" { #define SPI1_RX_DMA_INSTANCE DMA2_Stream0 #define SPI1_RX_DMA_CHANNEL DMA_CHANNEL_3 #define SPI1_RX_DMA_IRQ DMA2_Stream0_IRQn -#elif defined(BSP_SPI4_RX_USING_DMA) && !defined(SPI4_RX_DMA_INSTANCE) -#define SPI4_DMA_RX_IRQHandler DMA2_Stream0_IRQHandler -#define SPI4_RX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI4_RX_DMA_INSTANCE DMA2_Stream0 -#define SPI4_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define SPI4_RX_DMA_IRQ DMA2_Stream0_IRQn #endif /* DMA2 stream1 */ @@ -133,18 +109,6 @@ extern "C" { #define SPI1_RX_DMA_INSTANCE DMA2_Stream2 #define SPI1_RX_DMA_CHANNEL DMA_CHANNEL_3 #define SPI1_RX_DMA_IRQ DMA2_Stream2_IRQn -#elif defined(BSP_UART1_RX_USING_DMA) && !defined(UART1_RX_DMA_INSTANCE) -#define UART1_DMA_RX_IRQHandler DMA2_Stream2_IRQHandler -#define UART1_RX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define UART1_RX_DMA_INSTANCE DMA2_Stream2 -#define UART1_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART1_RX_DMA_IRQ DMA2_Stream2_IRQn -#elif defined(BSP_QSPI_USING_DMA) && !defined(QSPI_DMA_INSTANCE) -#define QSPI_DMA_IRQHandler DMA2_Stream2_IRQHandler -#define QSPI_DMA_RCC RCC_AHB1ENR_DMA2EN -#define QSPI_DMA_INSTANCE DMA2_Stream2 -#define QSPI_DMA_CHANNEL DMA_CHANNEL_11 -#define QSPI_DMA_IRQ DMA2_Stream2_IRQn #endif /* DMA2 stream3 */ @@ -154,18 +118,6 @@ extern "C" { #define SPI5_RX_DMA_INSTANCE DMA2_Stream3 #define SPI5_RX_DMA_CHANNEL DMA_CHANNEL_2 #define SPI5_RX_DMA_IRQ DMA2_Stream3_IRQn -#elif defined(BSP_SPI1_TX_USING_DMA) && !defined(SPI1_TX_DMA_INSTANCE) -#define SPI1_DMA_TX_IRQHandler DMA2_Stream3_IRQHandler -#define SPI1_TX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI1_TX_DMA_INSTANCE DMA2_Stream3 -#define SPI1_TX_DMA_CHANNEL DMA_CHANNEL_3 -#define SPI1_TX_DMA_IRQ DMA2_Stream3_IRQn -#elif defined(BSP_SPI4_RX_USING_DMA) && !defined(SPI4_RX_DMA_INSTANCE) -#define SPI4_DMA_RX_IRQHandler DMA2_Stream3_IRQHandler -#define SPI4_RX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI4_RX_DMA_INSTANCE DMA2_Stream3 -#define SPI4_RX_DMA_CHANNEL DMA_CHANNEL_5 -#define SPI4_RX_DMA_IRQ DMA2_Stream3_IRQn #endif /* DMA2 stream4 */ @@ -175,12 +127,6 @@ extern "C" { #define SPI5_TX_DMA_INSTANCE DMA2_Stream4 #define SPI5_TX_DMA_CHANNEL DMA_CHANNEL_2 #define SPI5_TX_DMA_IRQ DMA2_Stream4_IRQn -#elif defined(BSP_SPI4_TX_USING_DMA) && !defined(SPI4_TX_DMA_INSTANCE) -#define SPI4_DMA_TX_IRQHandler DMA2_Stream4_IRQHandler -#define SPI4_TX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI4_TX_DMA_INSTANCE DMA2_Stream4 -#define SPI4_TX_DMA_CHANNEL DMA_CHANNEL_5 -#define SPI4_TX_DMA_IRQ DMA2_Stream4_IRQn #endif /* DMA2 stream5 */ @@ -190,18 +136,6 @@ extern "C" { #define SPI1_TX_DMA_INSTANCE DMA2_Stream5 #define SPI1_TX_DMA_CHANNEL DMA_CHANNEL_3 #define SPI1_TX_DMA_IRQ DMA2_Stream5_IRQn -#elif defined(BSP_UART1_RX_USING_DMA) && !defined(UART1_RX_DMA_INSTANCE) -#define UART1_DMA_RX_IRQHandler DMA2_Stream5_IRQHandler -#define UART1_RX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define UART1_RX_DMA_INSTANCE DMA2_Stream5 -#define UART1_RX_DMA_CHANNEL DMA_CHANNEL_4 -#define UART1_RX_DMA_IRQ DMA2_Stream5_IRQn -#elif defined(BSP_SPI5_RX_USING_DMA) && !defined(SPI5_RX_DMA_INSTANCE) -#define SPI5_DMA_RX_IRQHandler DMA2_Stream5_IRQHandler -#define SPI5_RX_DMA_RCC RCC_AHB1ENR_DMA2EN -#define SPI5_RX_DMA_INSTANCE DMA2_Stream5 -#define SPI5_RX_DMA_CHANNEL DMA_CHANNEL_7 -#define SPI5_RX_DMA_IRQ DMA2_Stream5_IRQn #endif /* DMA2 stream6 */ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h index 1a5575de0..b8ef2d37f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/qspi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/qspi_config.h index f4477f498..bee2eb5d8 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/qspi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/qspi_config.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018-12-22 zylx first version + * 2018-12-22 zylx first version */ #ifndef __QSPI_CONFIG_H__ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/sdio_config.h index 220a615c4..eee9d103b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h index ef32a32f4..26f230d9b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -26,7 +26,7 @@ extern "C" { } #endif /* SPI1_BUS_CONFIG */ #endif /* BSP_USING_SPI1 */ - + #ifdef BSP_SPI1_TX_USING_DMA #ifndef SPI1_TX_DMA_CONFIG #define SPI1_TX_DMA_CONFIG \ @@ -60,7 +60,7 @@ extern "C" { } #endif /* SPI2_BUS_CONFIG */ #endif /* BSP_USING_SPI2 */ - + #ifdef BSP_SPI2_TX_USING_DMA #ifndef SPI2_TX_DMA_CONFIG #define SPI2_TX_DMA_CONFIG \ @@ -94,7 +94,7 @@ extern "C" { } #endif /* SPI3_BUS_CONFIG */ #endif /* BSP_USING_SPI3 */ - + #ifdef BSP_SPI3_TX_USING_DMA #ifndef SPI3_TX_DMA_CONFIG #define SPI3_TX_DMA_CONFIG \ @@ -128,7 +128,7 @@ extern "C" { } #endif /* SPI4_BUS_CONFIG */ #endif /* BSP_USING_SPI4 */ - + #ifdef BSP_SPI4_TX_USING_DMA #ifndef SPI4_TX_DMA_CONFIG #define SPI4_TX_DMA_CONFIG \ @@ -162,7 +162,7 @@ extern "C" { } #endif /* SPI5_BUS_CONFIG */ #endif /* BSP_USING_SPI5 */ - + #ifdef BSP_SPI5_TX_USING_DMA #ifndef SPI5_TX_DMA_CONFIG #define SPI5_TX_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/tim_config.h index cd116d9e1..41ef9f9ee 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/uart_config.h index 2fefa1344..871cddd2d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-10-30 SummerGift first version * 2019-01-05 zylx modify dma support */ - + #ifndef __UART_CONFIG_H__ #define __UART_CONFIG_H__ @@ -19,7 +19,7 @@ extern "C" { #endif #if defined(BSP_USING_UART1) -#ifndef UART1_CONFIG +#ifndef UART1_CONFIG #define UART1_CONFIG \ { \ .name = "uart1", \ @@ -31,12 +31,12 @@ extern "C" { #if defined(BSP_UART1_RX_USING_DMA) #ifndef UART1_DMA_RX_CONFIG -#define UART1_DMA_RX_CONFIG \ +#define UART1_DMA_RX_CONFIG \ { \ - .Instance = UART1_RX_DMA_INSTANCE, \ - .channel = UART1_RX_DMA_CHANNEL, \ - .dma_rcc = UART1_RX_DMA_RCC, \ - .dma_irq = UART1_RX_DMA_IRQ, \ + .Instance = UART1_RX_DMA_INSTANCE, \ + .request = UART1_RX_DMA_REQUEST, \ + .dma_rcc = UART1_RX_DMA_RCC, \ + .dma_irq = UART1_RX_DMA_IRQ, \ } #endif /* UART1_DMA_RX_CONFIG */ #endif /* BSP_UART1_RX_USING_DMA */ @@ -54,15 +54,26 @@ extern "C" { #if defined(BSP_UART2_RX_USING_DMA) #ifndef UART2_DMA_RX_CONFIG -#define UART2_DMA_RX_CONFIG \ +#define UART2_DMA_RX_CONFIG \ { \ - .Instance = UART2_RX_DMA_INSTANCE, \ - .channel = UART2_RX_DMA_CHANNEL, \ - .dma_rcc = UART2_RX_DMA_RCC, \ - .dma_irq = UART2_RX_DMA_IRQ, \ + .Instance = UART2_RX_DMA_INSTANCE, \ + .request = UART2_RX_DMA_REQUEST, \ + .dma_rcc = UART2_RX_DMA_RCC, \ + .dma_irq = UART2_RX_DMA_IRQ, \ } #endif /* UART2_DMA_RX_CONFIG */ #endif /* BSP_UART2_RX_USING_DMA */ +#if defined(BSP_UART2_TX_USING_DMA) +#ifndef UART2_DMA_TX_CONFIG +#define UART2_DMA_TX_CONFIG \ + { \ + .Instance = UART2_TX_DMA_INSTANCE, \ + .request = UART2_TX_DMA_REQUEST, \ + .dma_rcc = UART2_TX_DMA_RCC, \ + .dma_irq = UART2_TX_DMA_IRQ, \ + } +#endif /* UART2_DMA_TX_CONFIG */ +#endif /* BSP_UART2_TX_USING_DMA */ #if defined(BSP_USING_UART3) #ifndef UART3_CONFIG @@ -77,12 +88,12 @@ extern "C" { #if defined(BSP_UART3_RX_USING_DMA) #ifndef UART3_DMA_RX_CONFIG -#define UART3_DMA_RX_CONFIG \ +#define UART3_DMA_RX_CONFIG \ { \ - .Instance = UART3_RX_DMA_INSTANCE, \ - .channel = UART3_RX_DMA_CHANNEL, \ - .dma_rcc = UART3_RX_DMA_RCC, \ - .dma_irq = UART3_RX_DMA_IRQ, \ + .Instance = UART3_RX_DMA_INSTANCE, \ + .request = UART3_RX_DMA_REQUEST, \ + .dma_rcc = UART3_RX_DMA_RCC, \ + .dma_irq = UART3_RX_DMA_IRQ, \ } #endif /* UART3_DMA_RX_CONFIG */ #endif /* BSP_UART3_RX_USING_DMA */ @@ -100,12 +111,12 @@ extern "C" { #if defined(BSP_UART4_RX_USING_DMA) #ifndef UART4_DMA_RX_CONFIG -#define UART4_DMA_RX_CONFIG \ +#define UART4_DMA_RX_CONFIG \ { \ - .Instance = UART4_RX_DMA_INSTANCE, \ - .channel = UART4_RX_DMA_CHANNEL, \ - .dma_rcc = UART4_RX_DMA_RCC, \ - .dma_irq = UART4_RX_DMA_IRQ, \ + .Instance = UART4_RX_DMA_INSTANCE, \ + .request = UART4_RX_DMA_REQUEST, \ + .dma_rcc = UART4_RX_DMA_RCC, \ + .dma_irq = UART4_RX_DMA_IRQ, \ } #endif /* UART4_DMA_RX_CONFIG */ #endif /* BSP_UART4_RX_USING_DMA */ @@ -123,12 +134,12 @@ extern "C" { #if defined(BSP_UART5_RX_USING_DMA) #ifndef UART5_DMA_RX_CONFIG -#define UART5_DMA_RX_CONFIG \ +#define UART5_DMA_RX_CONFIG \ { \ - .Instance = UART5_RX_DMA_INSTANCE, \ - .channel = UART5_RX_DMA_CHANNEL, \ - .dma_rcc = UART5_RX_DMA_RCC, \ - .dma_irq = UART5_RX_DMA_IRQ, \ + .Instance = UART5_RX_DMA_INSTANCE, \ + .request = UART5_RX_DMA_REQUEST, \ + .dma_rcc = UART5_RX_DMA_RCC, \ + .dma_irq = UART5_RX_DMA_IRQ, \ } #endif /* UART5_DMA_RX_CONFIG */ #endif /* BSP_UART5_RX_USING_DMA */ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/h7/usbd_config.h b/bsp/stm32/libraries/HAL_Drivers/config/h7/usbd_config.h index a6fc9a4c4..31a648ad1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/h7/usbd_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/h7/usbd_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h index 803e4706e..9477886ba 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l0/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h index ea5e767ae..649ec1f4e 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l0/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -49,7 +49,7 @@ extern "C" { } #endif /* UART2_CONFIG */ #endif /* BSP_USING_UART2 */ - + #if defined(BSP_UART2_RX_USING_DMA) #ifndef UART2_DMA_RX_CONFIG #define UART2_DMA_RX_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/adc_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/adc_config.h index 47fe0139b..cb3ac9452 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/adc_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/adc_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h index c86148bf7..0762f9048 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/dma_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h index 50ea3791b..c4d4bcf20 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/pwm_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/qspi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/qspi_config.h index 4714c119f..fa8228c6d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/qspi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/qspi_config.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018-12-22 zylx first version + * 2018-12-22 zylx first version */ #ifndef __QSPI_CONFIG_H__ @@ -28,7 +28,7 @@ extern "C" { } #endif /* QSPI_BUS_CONFIG */ #endif /* BSP_USING_QSPI */ - + #ifdef BSP_QSPI_USING_DMA #ifndef QSPI_DMA_CONFIG #define QSPI_DMA_CONFIG \ diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/sdio_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/sdio_config.h index 71811dba8..fa066e5cf 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/sdio_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/sdio_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h index d7518805b..d510ca379 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/spi_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/tim_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/tim_config.h index 4df13ca08..b90879c15 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/tim_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/tim_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/uart_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/uart_config.h index d6f972e7d..297ab30d5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/uart_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/uart_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -60,8 +60,20 @@ extern "C" { .dma_irq = UART1_RX_DMA_IRQ, \ } #endif /* UART1_DMA_RX_CONFIG */ -#endif /* BSP_UART1_RX_USING_DMA */ - +#endif /* BSP_UART1_RX_USING_DMA */ + +#if defined(BSP_UART1_TX_USING_DMA) +#ifndef UART1_DMA_TX_CONFIG +#define UART1_DMA_TX_CONFIG \ + { \ + .Instance = UART1_TX_DMA_INSTANCE, \ + .request = UART1_TX_DMA_REQUEST, \ + .dma_rcc = UART1_TX_DMA_RCC, \ + .dma_irq = UART1_TX_DMA_IRQ, \ + } +#endif /* UART1_DMA_TX_CONFIG */ +#endif /* BSP_UART1_TX_USING_DMA */ + #if defined(BSP_USING_UART2) #ifndef UART2_CONFIG #define UART2_CONFIG \ @@ -85,6 +97,18 @@ extern "C" { #endif /* UART2_DMA_RX_CONFIG */ #endif /* BSP_UART2_RX_USING_DMA */ +#if defined(BSP_UART2_TX_USING_DMA) +#ifndef UART2_DMA_TX_CONFIG +#define UART2_DMA_TX_CONFIG \ + { \ + .Instance = UART2_TX_DMA_INSTANCE, \ + .request = UART2_TX_DMA_REQUEST, \ + .dma_rcc = UART2_TX_DMA_RCC, \ + .dma_irq = UART2_TX_DMA_IRQ, \ + } +#endif /* UART2_DMA_TX_CONFIG */ +#endif /* BSP_UART2_TX_USING_DMA */ + #if defined(BSP_USING_UART3) #ifndef UART3_CONFIG #define UART3_CONFIG \ @@ -108,8 +132,20 @@ extern "C" { #endif /* UART3_DMA_RX_CONFIG */ #endif /* BSP_UART3_RX_USING_DMA */ +#if defined(BSP_UART3_TX_USING_DMA) +#ifndef UART3_DMA_TX_CONFIG +#define UART3_DMA_TX_CONFIG \ + { \ + .Instance = UART3_TX_DMA_INSTANCE, \ + .request = UART3_TX_DMA_REQUEST, \ + .dma_rcc = UART3_TX_DMA_RCC, \ + .dma_irq = UART3_TX_DMA_IRQ, \ + } +#endif /* UART3_DMA_TX_CONFIG */ +#endif /* BSP_UART3_TX_USING_DMA */ + #ifdef __cplusplus } -#endif +#endif #endif diff --git a/bsp/stm32/libraries/HAL_Drivers/config/l4/usbd_config.h b/bsp/stm32/libraries/HAL_Drivers/config/l4/usbd_config.h index a6fc9a4c4..31a648ad1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/config/l4/usbd_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/config/l4/usbd_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c index 97ddc4d81..edf704f65 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_adc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_adc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_can.c b/bsp/stm32/libraries/HAL_Drivers/drv_can.c index 449009447..83d58ec80 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_can.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_can.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -59,6 +59,19 @@ static const struct stm32_baud_rate_tab can_baud_rate_tab[] = {CAN20kBaud, (CAN_SJW_2TQ | CAN_BS1_10TQ | CAN_BS2_7TQ | 150)}, {CAN10kBaud, (CAN_SJW_2TQ | CAN_BS1_10TQ | CAN_BS2_7TQ | 300)} }; +#elif defined (SOC_SERIES_STM32L4)/* APB1 80MHz(max) */ +static const struct stm32_baud_rate_tab can_baud_rate_tab[] = +{ + {CAN1MBaud, (CAN_SJW_2TQ | CAN_BS1_5TQ | CAN_BS2_2TQ | 10)}, + {CAN800kBaud, (CAN_SJW_2TQ | CAN_BS1_14TQ | CAN_BS2_5TQ | 5)}, + {CAN500kBaud, (CAN_SJW_2TQ | CAN_BS1_7TQ | CAN_BS2_2TQ | 16)}, + {CAN250kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 20)}, + {CAN125kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 40)}, + {CAN100kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 50)}, + {CAN50kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 100)}, + {CAN20kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 250)}, + {CAN10kBaud, (CAN_SJW_2TQ | CAN_BS1_13TQ | CAN_BS2_2TQ | 500)} +}; #endif #ifdef BSP_USING_CAN1 @@ -292,8 +305,8 @@ static rt_err_t _can_control(struct rt_can_device *can, int cmd, void *arg) { drv_can->FilterConfig.FilterBank = filter_cfg->items[i].hdr; drv_can->FilterConfig.FilterIdHigh = (filter_cfg->items[i].id >> 13) & 0xFFFF; - drv_can->FilterConfig.FilterIdLow = ((filter_cfg->items[i].id << 3) | - (filter_cfg->items[i].ide << 2) | + drv_can->FilterConfig.FilterIdLow = ((filter_cfg->items[i].id << 3) | + (filter_cfg->items[i].ide << 2) | (filter_cfg->items[i].rtr << 1)) & 0xFFFF; drv_can->FilterConfig.FilterMaskIdHigh = (filter_cfg->items[i].mask >> 16) & 0xFFFF; drv_can->FilterConfig.FilterMaskIdLow = filter_cfg->items[i].mask & 0xFFFF; @@ -688,9 +701,9 @@ void CAN1_SCE_IRQHandler(void) drv_can1.device.status.ackerrcnt++; if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) rt_hw_can_isr(&drv_can1.device, RT_CAN_EVENT_TX_FAIL | 0 << 8); - else if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) + else if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK1)) rt_hw_can_isr(&drv_can1.device, RT_CAN_EVENT_TX_FAIL | 1 << 8); - else if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) + else if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK2)) rt_hw_can_isr(&drv_can1.device, RT_CAN_EVENT_TX_FAIL | 2 << 8); break; case RT_CAN_BUS_IMPLICIT_BIT_ERR: @@ -806,11 +819,11 @@ void CAN2_SCE_IRQHandler(void) break; case RT_CAN_BUS_ACK_ERR: drv_can2.device.status.ackerrcnt++; - if (!READ_BIT(drv_can1.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) + if (!READ_BIT(drv_can2.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) rt_hw_can_isr(&drv_can2.device, RT_CAN_EVENT_TX_FAIL | 0 << 8); - else if (!READ_BIT(drv_can2.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) + else if (!READ_BIT(drv_can2.CanHandle.Instance->TSR, CAN_FLAG_TXOK1)) rt_hw_can_isr(&drv_can2.device, RT_CAN_EVENT_TX_FAIL | 1 << 8); - else if (!READ_BIT(drv_can2.CanHandle.Instance->TSR, CAN_FLAG_TXOK0)) + else if (!READ_BIT(drv_can2.CanHandle.Instance->TSR, CAN_FLAG_TXOK2)) rt_hw_can_isr(&drv_can2.device, RT_CAN_EVENT_TX_FAIL | 2 << 8); break; case RT_CAN_BUS_IMPLICIT_BIT_ERR: diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_can.h b/bsp/stm32/libraries/HAL_Drivers/drv_can.h index b0ae3072e..900793a15 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_can.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_can.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_common.c b/bsp/stm32/libraries/HAL_Drivers/drv_common.c index 1203757a6..d01fafdda 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_common.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -102,10 +102,12 @@ void rt_hw_us_delay(rt_uint32_t us) start = SysTick->VAL; reload = SysTick->LOAD; us_tick = SystemCoreClock / 1000000UL; - do { + do + { now = SysTick->VAL; - delta = start > now ? start - now : reload + start - now; - } while(delta < us_tick * us); + delta = start >= now ? start - now : reload + start - now; + } + while (delta < us_tick * us); } /** diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_common.h b/bsp/stm32/libraries/HAL_Drivers/drv_common.h index bffedddcd..c45041129 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_common.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_config.h b/bsp/stm32/libraries/HAL_Drivers/drv_config.h index cc1c3f5bd..5be22fc56 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_config.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_config.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-10-30 SummerGift first version */ - + #ifndef __DRV_CONFIG_H__ #define __DRV_CONFIG_H__ @@ -42,7 +42,7 @@ extern "C" { #include "f2/adc_config.h" #include "f2/tim_config.h" #include "f2/sdio_config.h" -#include "f2/pwm_config.h" +#include "f2/pwm_config.h" #elif defined(SOC_SERIES_STM32F4) #include "f4/dma_config.h" #include "f4/uart_config.h" diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_dma.h b/bsp/stm32/libraries/HAL_Drivers/drv_dma.h index 934579349..d22a3b23d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_dma.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_dma.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,10 +19,10 @@ extern "C" { #endif #if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L0) \ - || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) + || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) #define DMA_INSTANCE_TYPE DMA_Channel_TypeDef #elif defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7)\ - || defined(SOC_SERIES_STM32H7) + || defined(SOC_SERIES_STM32H7) #define DMA_INSTANCE_TYPE DMA_Stream_TypeDef #endif /* defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32L4) */ @@ -35,7 +35,8 @@ struct dma_config { rt_uint32_t channel; #endif -#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) +#if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4)\ + || defined(SOC_SERIES_STM32H7) rt_uint32_t request; #endif }; diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_eth.c b/bsp/stm32/libraries/HAL_Drivers/drv_eth.c index 097a1622e..0506f6495 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_eth.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_eth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,7 +19,7 @@ /* * Emac driver uses CubeMX tool to generate emac and phy's configuration, -* the configuration files can be found in CubeMX_Config floder. +* the configuration files can be found in CubeMX_Config folder. */ /* debug option */ @@ -248,7 +248,7 @@ rt_err_t rt_stm32_eth_tx(rt_device_t dev, struct pbuf *p) /* Prepare transmit descriptors to give to DMA */ /* TODO Optimize data send speed*/ - LOG_D("transmit frame lenth :%d", framelength); + LOG_D("transmit frame length :%d", framelength); /* wait for unlocked */ while (EthHandle.Lock == HAL_LOCKED); @@ -411,11 +411,11 @@ static void phy_linkchange() if (status & (PHY_AUTONEGO_COMPLETE_MASK | PHY_LINKED_STATUS_MASK)) { - rt_uint32_t SR; + rt_uint32_t SR = 0; phy_speed_new |= PHY_LINK; - SR = HAL_ETH_ReadPHYRegister(&EthHandle, PHY_Status_REG, (uint32_t *)&SR); + HAL_ETH_ReadPHYRegister(&EthHandle, PHY_Status_REG, (uint32_t *)&SR); LOG_D("phy control status reg is 0x%X", SR); if (PHY_Status_SPEED_100M(SR)) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_eth.h b/bsp/stm32/libraries/HAL_Drivers/drv_eth.h index 07f25b107..44eb75bbb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_eth.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_eth.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h index 3a9d5be06..8243e80bb 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c index b8d42c849..778fbe1a8 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f0.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c index 8f7d45ade..f17f2867a 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f1.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -122,16 +122,17 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size) } /** - * Erase data on flash. + * Erase data on flash with bank. * @note This operation is irreversible. * @note This operation's units is different which on many chips. * + * @param bank flash bank * @param addr flash address * @param size erase bytes size * * @return result */ -int stm32_flash_erase(rt_uint32_t addr, size_t size) +int stm32_flash_erase_bank(uint32_t bank, rt_uint32_t addr, size_t size) { rt_err_t result = RT_EOK; uint32_t PAGEError = 0; @@ -151,6 +152,7 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size) EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES; EraseInitStruct.PageAddress = GetPage(addr); EraseInitStruct.NbPages = (size + FLASH_PAGE_SIZE - 1) / FLASH_PAGE_SIZE; + EraseInitStruct.Banks = bank; if (HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError) != HAL_OK) { @@ -170,6 +172,78 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size) return size; } +/** + * Erase data on flash . + * @note This operation is irreversible. + * @note This operation's units is different which on many chips. + * + * @param addr flash address + * @param size erase bytes size + * + * @return result + */ +int stm32_flash_erase(rt_uint32_t addr, size_t size) +{ +#if defined(FLASH_BANK2_END) + rt_err_t result = RT_EOK; + rt_uint32_t addr_bank1 = 0; + rt_uint32_t size_bank1 = 0; + rt_uint32_t addr_bank2 = 0; + rt_uint32_t size_bank2 = 0; + + if((addr + size) <= FLASH_BANK1_END) + { + addr_bank1 = addr; + size_bank1 = size; + size_bank2 = 0; + } + else if(addr > FLASH_BANK1_END) + { + size_bank1 = 0; + addr_bank2 = addr; + size_bank2 = size; + } + else + { + addr_bank1 = addr; + size_bank1 = FLASH_BANK1_END + 1 - addr_bank1; + addr_bank2 = FLASH_BANK1_END + 1; + size_bank2 = addr + size - (FLASH_BANK1_END + 1); + } + + if(size_bank1) + { + LOG_D("bank1: addr (0x%p), size %d", (void *)addr_bank1, size_bank1); + if(size_bank1 != stm32_flash_erase_bank(FLASH_BANK_1, addr_bank1, size_bank1)) + { + result = -RT_ERROR; + goto __exit; + } + } + + if(size_bank2) + { + LOG_D("bank2: addr (0x%p), size %d", (void *)addr_bank2, size_bank2); + if(size_bank2 != stm32_flash_erase_bank(FLASH_BANK_2, addr_bank2, size_bank2)) + { + result = -RT_ERROR; + goto __exit; + } + } + +__exit: + if(result != RT_EOK) + { + return result; + } + + return size_bank1 + size_bank2; +#else + return stm32_flash_erase_bank(FLASH_BANK_1, addr, size); +#endif +} + + #if defined(PKG_USING_FAL) static int fal_flash_read(long offset, rt_uint8_t *buf, size_t size); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f2.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f2.c index b3ddf1ae6..d716b46ff 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f2.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c index f36d5cdc6..c65ecb20f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f4.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -211,6 +211,8 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size) { rt_err_t result = RT_EOK; rt_uint32_t end_addr = addr + size; + rt_uint32_t written_size = 0; + rt_uint32_t write_size = 0; if ((end_addr) > STM32_FLASH_END_ADDRESS) { @@ -227,22 +229,61 @@ int stm32_flash_write(rt_uint32_t addr, const rt_uint8_t *buf, size_t size) __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGPERR | FLASH_FLAG_PGSERR); - for (size_t i = 0; i < size; i++, addr++, buf++) + while (written_size < size) { - /* write data to flash */ - if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, addr, (rt_uint64_t)(*buf)) == HAL_OK) + if (((addr + written_size) % 4 == 0) && (size - written_size >= 4)) { - if (*(rt_uint8_t *)addr != *buf) + if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, addr + written_size, *((rt_uint32_t *)(buf + written_size))) == HAL_OK) + { + if (*(rt_uint32_t *)(addr + written_size) != *(rt_uint32_t *)(buf + written_size)) + { + result = -RT_ERROR; + break; + } + } + else { result = -RT_ERROR; break; } + write_size = 4; + } + else if (((addr + written_size) % 2 == 0) && (size - written_size >= 2)) + { + if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, addr + written_size, *((rt_uint16_t *)(buf + written_size))) == HAL_OK) + { + if (*(rt_uint16_t *)(addr + written_size) != *(rt_uint16_t *)(buf + written_size)) + { + result = -RT_ERROR; + break; + } + } + else + { + result = -RT_ERROR; + break; + } + write_size = 2; } else { - result = -RT_ERROR; - break; + if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, addr + written_size, *((rt_uint8_t *)(buf + written_size))) == HAL_OK) + { + if (*(rt_uint8_t *)(addr + written_size) != *(rt_uint8_t *)(buf + written_size)) + { + result = -RT_ERROR; + break; + } + } + else + { + result = -RT_ERROR; + break; + } + write_size = 1; } + + written_size += write_size; } HAL_FLASH_Lock(); @@ -277,6 +318,11 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size) return -RT_EINVAL; } + if (size < 1) + { + return -RT_EINVAL; + } + /*Variable used for Erase procedure*/ FLASH_EraseInitTypeDef EraseInitStruct; diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c index 3ecb0be5e..522dc8e6a 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_f7.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,6 +7,7 @@ * Date Author Notes * 2018-12-5 SummerGift first version * 2019-3-2 jinsheng add Macro judgment + * 2020-1-6 duminmin support single bank mode */ #include "board.h" @@ -22,32 +23,6 @@ //#define DRV_DEBUG #define LOG_TAG "drv.flash" #include -#if defined (FLASH_OPTCR_nDBANK) -#define ADDR_FLASH_SECTOR_0 ((rt_uint32_t)0x08000000) /* Base address of Sector 0, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_1 ((rt_uint32_t)0x08004000) /* Base address of Sector 1, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_2 ((rt_uint32_t)0x08008000) /* Base address of Sector 2, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_3 ((rt_uint32_t)0x0800C000) /* Base address of Sector 3, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_4 ((rt_uint32_t)0x08010000) /* Base address of Sector 4, 64 Kbytes */ -#define ADDR_FLASH_SECTOR_5 ((rt_uint32_t)0x08020000) /* Base address of Sector 5, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_6 ((rt_uint32_t)0x08040000) /* Base address of Sector 6, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_7 ((rt_uint32_t)0x08060000) /* Base address of Sector 7, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_8 ((rt_uint32_t)0x08080000) /* Base address of Sector 8, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_9 ((rt_uint32_t)0x080A0000) /* Base address of Sector 9, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_10 ((rt_uint32_t)0x080C0000) /* Base address of Sector 10, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_11 ((rt_uint32_t)0x080E0000) /* Base address of Sector 11, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_12 ((rt_uint32_t)0x08100000) /* Base address of Sector 12, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_13 ((rt_uint32_t)0x08104000) /* Base address of Sector 13, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_14 ((rt_uint32_t)0x08108000) /* Base address of Sector 14, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_15 ((rt_uint32_t)0x0810C000) /* Base address of Sector 15, 16 Kbytes */ -#define ADDR_FLASH_SECTOR_16 ((rt_uint32_t)0x08110000) /* Base address of Sector 16, 64 Kbytes */ -#define ADDR_FLASH_SECTOR_17 ((rt_uint32_t)0x08120000) /* Base address of Sector 17, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_18 ((rt_uint32_t)0x08140000) /* Base address of Sector 18, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_19 ((rt_uint32_t)0x08160000) /* Base address of Sector 19, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_20 ((rt_uint32_t)0x08180000) /* Base address of Sector 20, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_21 ((rt_uint32_t)0x081A0000) /* Base address of Sector 21, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_22 ((rt_uint32_t)0x081C0000) /* Base address of Sector 22, 128 Kbytes */ -#define ADDR_FLASH_SECTOR_23 ((rt_uint32_t)0x081E0000) /* Base address of Sector 23, 128 Kbytes */ -#else #define ADDR_FLASH_SECTOR_0 ((rt_uint32_t)0x08000000) /* Base address of Sector 0, 32 Kbytes */ #define ADDR_FLASH_SECTOR_1 ((rt_uint32_t)0x08008000) /* Base address of Sector 1, 32 Kbytes */ #define ADDR_FLASH_SECTOR_2 ((rt_uint32_t)0x08010000) /* Base address of Sector 2, 32 Kbytes */ @@ -60,7 +35,6 @@ #define ADDR_FLASH_SECTOR_9 ((rt_uint32_t)0x08140000) /* Base address of Sector 9, 256 Kbytes */ #define ADDR_FLASH_SECTOR_10 ((rt_uint32_t)0x08180000) /* Base address of Sector 10, 256 Kbytes */ #define ADDR_FLASH_SECTOR_11 ((rt_uint32_t)0x081C0000) /* Base address of Sector 11, 256 Kbytes */ -#endif /** * @brief Gets the sector of a given address * @param None @@ -68,116 +42,73 @@ */ static rt_uint32_t GetSector(rt_uint32_t Address) { - rt_uint32_t sector = 0; + uint32_t sector = 0; + #if defined (FLASH_OPTCR_nDBANK) - if ((Address < ADDR_FLASH_SECTOR_1) && (Address >= ADDR_FLASH_SECTOR_0)) - { - sector = FLASH_SECTOR_0; - } - else if ((Address < ADDR_FLASH_SECTOR_2) && (Address >= ADDR_FLASH_SECTOR_1)) - { - sector = FLASH_SECTOR_1; - } -#if (FLASH_SECTOR_TOTAL >= 4) - else if ((Address < ADDR_FLASH_SECTOR_3) && (Address >= ADDR_FLASH_SECTOR_2)) - { - sector = FLASH_SECTOR_2; - } - else if ((Address < ADDR_FLASH_SECTOR_4) && (Address >= ADDR_FLASH_SECTOR_3)) - { - sector = FLASH_SECTOR_3; - } -#elif (FLASH_SECTOR_TOTAL >= 8) - else if ((Address < ADDR_FLASH_SECTOR_5) && (Address >= ADDR_FLASH_SECTOR_4)) - { - sector = FLASH_SECTOR_4; - } - else if ((Address < ADDR_FLASH_SECTOR_6) && (Address >= ADDR_FLASH_SECTOR_5)) - { - sector = FLASH_SECTOR_5; - } - else if ((Address < ADDR_FLASH_SECTOR_7) && (Address >= ADDR_FLASH_SECTOR_6)) - { - sector = FLASH_SECTOR_6; - } - else if ((Address < ADDR_FLASH_SECTOR_8) && (Address >= ADDR_FLASH_SECTOR_7)) - { - sector = FLASH_SECTOR_7; - } -#elif (FLASH_SECTOR_TOTAL >= 24) - else if ((Address < ADDR_FLASH_SECTOR_9) && (Address >= ADDR_FLASH_SECTOR_8)) - { - sector = FLASH_SECTOR_8; - } - else if ((Address < ADDR_FLASH_SECTOR_10) && (Address >= ADDR_FLASH_SECTOR_9)) - { - sector = FLASH_SECTOR_9; - } - else if ((Address < ADDR_FLASH_SECTOR_11) && (Address >= ADDR_FLASH_SECTOR_10)) - { - sector = FLASH_SECTOR_10; - } - else if ((Address < ADDR_FLASH_SECTOR_12) && (Address >= ADDR_FLASH_SECTOR_11)) - { - sector = FLASH_SECTOR_11; - } - else if ((Address < ADDR_FLASH_SECTOR_13) && (Address >= ADDR_FLASH_SECTOR_12)) - { - sector = FLASH_SECTOR_12; - } - else if ((Address < ADDR_FLASH_SECTOR_14) && (Address >= ADDR_FLASH_SECTOR_13)) - { - sector = FLASH_SECTOR_13; - } - else if ((Address < ADDR_FLASH_SECTOR_15) && (Address >= ADDR_FLASH_SECTOR_14)) - { - sector = FLASH_SECTOR_14; - } - else if ((Address < ADDR_FLASH_SECTOR_16) && (Address >= ADDR_FLASH_SECTOR_15)) - { - sector = FLASH_SECTOR_15; - } - else if ((Address < ADDR_FLASH_SECTOR_17) && (Address >= ADDR_FLASH_SECTOR_16)) - { - sector = FLASH_SECTOR_16; - } - else if ((Address < ADDR_FLASH_SECTOR_18) && (Address >= ADDR_FLASH_SECTOR_17)) - { - sector = FLASH_SECTOR_17; - } - else if ((Address < ADDR_FLASH_SECTOR_19) && (Address >= ADDR_FLASH_SECTOR_18)) - { - sector = FLASH_SECTOR_18; - } - else if ((Address < ADDR_FLASH_SECTOR_20) && (Address >= ADDR_FLASH_SECTOR_19)) - { - sector = FLASH_SECTOR_19; - } - else if ((Address < ADDR_FLASH_SECTOR_21) && (Address >= ADDR_FLASH_SECTOR_20)) - { - sector = FLASH_SECTOR_20; - } - else if ((Address < ADDR_FLASH_SECTOR_22) && (Address >= ADDR_FLASH_SECTOR_21)) + FLASH_OBProgramInitTypeDef OBInit; + uint32_t nbank = 0; + + //get duel bank ability:nDBANK(Bit29) + HAL_FLASHEx_OBGetConfig(&OBInit); + nbank = ((OBInit.USERConfig & 0x20000000U) >> 29); + //1:single bank mode + if (1 == nbank) { - sector = FLASH_SECTOR_21; + if ((Address < ADDR_FLASH_SECTOR_1) && (Address >= ADDR_FLASH_SECTOR_0)) + { + sector = FLASH_SECTOR_0; + } + else if ((Address < ADDR_FLASH_SECTOR_2) && (Address >= ADDR_FLASH_SECTOR_1)) + { + sector = FLASH_SECTOR_1; + } + else if ((Address < ADDR_FLASH_SECTOR_3) && (Address >= ADDR_FLASH_SECTOR_2)) + { + sector = FLASH_SECTOR_2; + } + else if ((Address < ADDR_FLASH_SECTOR_4) && (Address >= ADDR_FLASH_SECTOR_3)) + { + sector = FLASH_SECTOR_3; + } + else if ((Address < ADDR_FLASH_SECTOR_5) && (Address >= ADDR_FLASH_SECTOR_4)) + { + sector = FLASH_SECTOR_4; + } + else if ((Address < ADDR_FLASH_SECTOR_6) && (Address >= ADDR_FLASH_SECTOR_5)) + { + sector = FLASH_SECTOR_5; + } + else if ((Address < ADDR_FLASH_SECTOR_7) && (Address >= ADDR_FLASH_SECTOR_6)) + { + sector = FLASH_SECTOR_6; + } + else if ((Address < ADDR_FLASH_SECTOR_8) && (Address >= ADDR_FLASH_SECTOR_7)) + { + sector = FLASH_SECTOR_7; + } + else if ((Address < ADDR_FLASH_SECTOR_9) && (Address >= ADDR_FLASH_SECTOR_8)) + { + sector = FLASH_SECTOR_8; + } + else if ((Address < ADDR_FLASH_SECTOR_10) && (Address >= ADDR_FLASH_SECTOR_9)) + { + sector = FLASH_SECTOR_9; + } + else if ((Address < ADDR_FLASH_SECTOR_11) && (Address >= ADDR_FLASH_SECTOR_10)) + { + sector = FLASH_SECTOR_10; + } + else + { + sector = FLASH_SECTOR_11; + } } - else if ((Address < ADDR_FLASH_SECTOR_23) && (Address >= ADDR_FLASH_SECTOR_22)) - { - sector = FLASH_SECTOR_22; - } -#else - else + else //0:dual bank mode { -#if (FLASH_SECTOR_TOTAL == 4) - sector = FLASH_SECTOR_4; -#elif (FLASH_SECTOR_TOTAL == 8) - sector = FLASH_SECTOR_8; -#elif (FLASH_SECTOR_TOTAL == 24) - sector = FLASH_SECTOR_23; -#endif + LOG_E("rtthread doesn't support duel bank mode yet!"); + RT_ASSERT(0); } -#endif -#else +#else //no dual bank ability if ((Address < ADDR_FLASH_SECTOR_1) && (Address >= ADDR_FLASH_SECTOR_0)) { sector = FLASH_SECTOR_0; @@ -186,7 +117,6 @@ static rt_uint32_t GetSector(rt_uint32_t Address) { sector = FLASH_SECTOR_1; } -#if (FLASH_SECTOR_TOTAL >= 4) else if ((Address < ADDR_FLASH_SECTOR_3) && (Address >= ADDR_FLASH_SECTOR_2)) { sector = FLASH_SECTOR_2; @@ -195,7 +125,6 @@ static rt_uint32_t GetSector(rt_uint32_t Address) { sector = FLASH_SECTOR_3; } -#elif (FLASH_SECTOR_TOTAL >= 8) else if ((Address < ADDR_FLASH_SECTOR_5) && (Address >= ADDR_FLASH_SECTOR_4)) { sector = FLASH_SECTOR_4; @@ -212,7 +141,6 @@ static rt_uint32_t GetSector(rt_uint32_t Address) { sector = FLASH_SECTOR_7; } -#elif (FLASH_SECTOR_TOTAL >= 24) else if ((Address < ADDR_FLASH_SECTOR_9) && (Address >= ADDR_FLASH_SECTOR_8)) { sector = FLASH_SECTOR_8; @@ -225,22 +153,15 @@ static rt_uint32_t GetSector(rt_uint32_t Address) { sector = FLASH_SECTOR_10; } -#else else { -#if (FLASH_SECTOR_TOTAL == 4) - sector = FLASH_SECTOR_4; -#elif (FLASH_SECTOR_TOTAL == 8) - sector = FLASH_SECTOR_8; -#elif (FLASH_SECTOR_TOTAL == 24) sector = FLASH_SECTOR_11; -#endif } -#endif #endif return sector; } + /** * Read data from flash. * @note This operation's units is word. @@ -386,6 +307,13 @@ int stm32_flash_erase(rt_uint32_t addr, size_t size) } #if defined(PKG_USING_FAL) +#define FLASH_SIZE_GRANULARITY_32K (4 * 32 * 1024) +#define FLASH_SIZE_GRANULARITY_128K (128 * 1024) +#define FLASH_SIZE_GRANULARITY_256K (7 * 256 *1024) + +#define STM32_FLASH_START_ADRESS_32K (STM32_FLASH_START_ADRESS) +#define STM32_FLASH_START_ADRESS_128K (STM32_FLASH_START_ADRESS_32K + FLASH_SIZE_GRANULARITY_32K) +#define STM32_FLASH_START_ADRESS_256K (STM32_FLASH_START_ADRESS_128K + FLASH_SIZE_GRANULARITY_128K) static int fal_flash_read_32k(long offset, rt_uint8_t *buf, size_t size); static int fal_flash_read_128k(long offset, rt_uint8_t *buf, size_t size); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c index 00f84711f..4da420796 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_flash/drv_flash_l4.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c index 81434d73c..dffce87f5 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,6 +7,7 @@ * Date Author Notes * 2018-11-06 balanceTWK first version * 2019-04-23 WillianChan Fix GPIO serial number disorder + * 2020-09-18 geniusgogo optimization design pin-index algorithm */ #include @@ -14,207 +15,43 @@ #ifdef RT_USING_PIN -static const struct pin_index pins[] = -{ -#if defined(GPIOA) - __STM32_PIN(0 , A, 0 ), - __STM32_PIN(1 , A, 1 ), - __STM32_PIN(2 , A, 2 ), - __STM32_PIN(3 , A, 3 ), - __STM32_PIN(4 , A, 4 ), - __STM32_PIN(5 , A, 5 ), - __STM32_PIN(6 , A, 6 ), - __STM32_PIN(7 , A, 7 ), - __STM32_PIN(8 , A, 8 ), - __STM32_PIN(9 , A, 9 ), - __STM32_PIN(10, A, 10), - __STM32_PIN(11, A, 11), - __STM32_PIN(12, A, 12), - __STM32_PIN(13, A, 13), - __STM32_PIN(14, A, 14), - __STM32_PIN(15, A, 15), -#if defined(GPIOB) - __STM32_PIN(16, B, 0), - __STM32_PIN(17, B, 1), - __STM32_PIN(18, B, 2), - __STM32_PIN(19, B, 3), - __STM32_PIN(20, B, 4), - __STM32_PIN(21, B, 5), - __STM32_PIN(22, B, 6), - __STM32_PIN(23, B, 7), - __STM32_PIN(24, B, 8), - __STM32_PIN(25, B, 9), - __STM32_PIN(26, B, 10), - __STM32_PIN(27, B, 11), - __STM32_PIN(28, B, 12), - __STM32_PIN(29, B, 13), - __STM32_PIN(30, B, 14), - __STM32_PIN(31, B, 15), -#if defined(GPIOC) - __STM32_PIN(32, C, 0), - __STM32_PIN(33, C, 1), - __STM32_PIN(34, C, 2), - __STM32_PIN(35, C, 3), - __STM32_PIN(36, C, 4), - __STM32_PIN(37, C, 5), - __STM32_PIN(38, C, 6), - __STM32_PIN(39, C, 7), - __STM32_PIN(40, C, 8), - __STM32_PIN(41, C, 9), - __STM32_PIN(42, C, 10), - __STM32_PIN(43, C, 11), - __STM32_PIN(44, C, 12), - __STM32_PIN(45, C, 13), - __STM32_PIN(46, C, 14), - __STM32_PIN(47, C, 15), -#if defined(GPIOD) - __STM32_PIN(48, D, 0), - __STM32_PIN(49, D, 1), - __STM32_PIN(50, D, 2), - __STM32_PIN(51, D, 3), - __STM32_PIN(52, D, 4), - __STM32_PIN(53, D, 5), - __STM32_PIN(54, D, 6), - __STM32_PIN(55, D, 7), - __STM32_PIN(56, D, 8), - __STM32_PIN(57, D, 9), - __STM32_PIN(58, D, 10), - __STM32_PIN(59, D, 11), - __STM32_PIN(60, D, 12), - __STM32_PIN(61, D, 13), - __STM32_PIN(62, D, 14), - __STM32_PIN(63, D, 15), -#if defined(GPIOE) - __STM32_PIN(64, E, 0), - __STM32_PIN(65, E, 1), - __STM32_PIN(66, E, 2), - __STM32_PIN(67, E, 3), - __STM32_PIN(68, E, 4), - __STM32_PIN(69, E, 5), - __STM32_PIN(70, E, 6), - __STM32_PIN(71, E, 7), - __STM32_PIN(72, E, 8), - __STM32_PIN(73, E, 9), - __STM32_PIN(74, E, 10), - __STM32_PIN(75, E, 11), - __STM32_PIN(76, E, 12), - __STM32_PIN(77, E, 13), - __STM32_PIN(78, E, 14), - __STM32_PIN(79, E, 15), -#if defined(GPIOF) - __STM32_PIN(80, F, 0), - __STM32_PIN(81, F, 1), - __STM32_PIN(82, F, 2), - __STM32_PIN(83, F, 3), - __STM32_PIN(84, F, 4), - __STM32_PIN(85, F, 5), - __STM32_PIN(86, F, 6), - __STM32_PIN(87, F, 7), - __STM32_PIN(88, F, 8), - __STM32_PIN(89, F, 9), - __STM32_PIN(90, F, 10), - __STM32_PIN(91, F, 11), - __STM32_PIN(92, F, 12), - __STM32_PIN(93, F, 13), - __STM32_PIN(94, F, 14), - __STM32_PIN(95, F, 15), -#if defined(GPIOG) - __STM32_PIN(96, G, 0), - __STM32_PIN(97, G, 1), - __STM32_PIN(98, G, 2), - __STM32_PIN(99, G, 3), - __STM32_PIN(100, G, 4), - __STM32_PIN(101, G, 5), - __STM32_PIN(102, G, 6), - __STM32_PIN(103, G, 7), - __STM32_PIN(104, G, 8), - __STM32_PIN(105, G, 9), - __STM32_PIN(106, G, 10), - __STM32_PIN(107, G, 11), - __STM32_PIN(108, G, 12), - __STM32_PIN(109, G, 13), - __STM32_PIN(110, G, 14), - __STM32_PIN(111, G, 15), -#if defined(GPIOH) - __STM32_PIN(112, H, 0), - __STM32_PIN(113, H, 1), - __STM32_PIN(114, H, 2), - __STM32_PIN(115, H, 3), - __STM32_PIN(116, H, 4), - __STM32_PIN(117, H, 5), - __STM32_PIN(118, H, 6), - __STM32_PIN(119, H, 7), - __STM32_PIN(120, H, 8), - __STM32_PIN(121, H, 9), - __STM32_PIN(122, H, 10), - __STM32_PIN(123, H, 11), - __STM32_PIN(124, H, 12), - __STM32_PIN(125, H, 13), - __STM32_PIN(126, H, 14), - __STM32_PIN(127, H, 15), -#if defined(GPIOI) - __STM32_PIN(128, I, 0), - __STM32_PIN(129, I, 1), - __STM32_PIN(130, I, 2), - __STM32_PIN(131, I, 3), - __STM32_PIN(132, I, 4), - __STM32_PIN(133, I, 5), - __STM32_PIN(134, I, 6), - __STM32_PIN(135, I, 7), - __STM32_PIN(136, I, 8), - __STM32_PIN(137, I, 9), - __STM32_PIN(138, I, 10), - __STM32_PIN(139, I, 11), - __STM32_PIN(140, I, 12), - __STM32_PIN(141, I, 13), - __STM32_PIN(142, I, 14), - __STM32_PIN(143, I, 15), -#if defined(GPIOJ) - __STM32_PIN(144, J, 0), - __STM32_PIN(145, J, 1), - __STM32_PIN(146, J, 2), - __STM32_PIN(147, J, 3), - __STM32_PIN(148, J, 4), - __STM32_PIN(149, J, 5), - __STM32_PIN(150, J, 6), - __STM32_PIN(151, J, 7), - __STM32_PIN(152, J, 8), - __STM32_PIN(153, J, 9), - __STM32_PIN(154, J, 10), - __STM32_PIN(155, J, 11), - __STM32_PIN(156, J, 12), - __STM32_PIN(157, J, 13), - __STM32_PIN(158, J, 14), - __STM32_PIN(159, J, 15), -#if defined(GPIOK) - __STM32_PIN(160, K, 0), - __STM32_PIN(161, K, 1), - __STM32_PIN(162, K, 2), - __STM32_PIN(163, K, 3), - __STM32_PIN(164, K, 4), - __STM32_PIN(165, K, 5), - __STM32_PIN(166, K, 6), - __STM32_PIN(167, K, 7), - __STM32_PIN(168, K, 8), - __STM32_PIN(169, K, 9), - __STM32_PIN(170, K, 10), - __STM32_PIN(171, K, 11), - __STM32_PIN(172, K, 12), - __STM32_PIN(173, K, 13), - __STM32_PIN(174, K, 14), - __STM32_PIN(175, K, 15), -#endif /* defined(GPIOK) */ -#endif /* defined(GPIOJ) */ -#endif /* defined(GPIOI) */ -#endif /* defined(GPIOH) */ -#endif /* defined(GPIOG) */ -#endif /* defined(GPIOF) */ -#endif /* defined(GPIOE) */ -#endif /* defined(GPIOD) */ -#endif /* defined(GPIOC) */ -#endif /* defined(GPIOB) */ -#endif /* defined(GPIOA) */ -}; +#define PIN_NUM(port, no) (((((port) & 0xFu) << 4) | ((no) & 0xFu))) +#define PIN_PORT(pin) ((uint8_t)(((pin) >> 4) & 0xFu)) +#define PIN_NO(pin) ((uint8_t)((pin) & 0xFu)) + +#define PIN_STPORT(pin) ((GPIO_TypeDef *)(GPIOA_BASE + (0x400u * PIN_PORT(pin)))) +#define PIN_STPIN(pin) ((uint16_t)(1u << PIN_NO(pin))) + +#if defined(GPIOZ) +#define __STM32_PORT_MAX 12u +#elif defined(GPIOK) +#define __STM32_PORT_MAX 11u +#elif defined(GPIOJ) +#define __STM32_PORT_MAX 10u +#elif defined(GPIOI) +#define __STM32_PORT_MAX 9u +#elif defined(GPIOH) +#define __STM32_PORT_MAX 8u +#elif defined(GPIOG) +#define __STM32_PORT_MAX 7u +#elif defined(GPIOF) +#define __STM32_PORT_MAX 6u +#elif defined(GPIOE) +#define __STM32_PORT_MAX 5u +#elif defined(GPIOD) +#define __STM32_PORT_MAX 4u +#elif defined(GPIOC) +#define __STM32_PORT_MAX 3u +#elif defined(GPIOB) +#define __STM32_PORT_MAX 2u +#elif defined(GPIOA) +#define __STM32_PORT_MAX 1u +#else +#define __STM32_PORT_MAX 0u +#error Unsupported STM32 GPIO peripheral. +#endif + +#define PIN_STPORT_MAX __STM32_PORT_MAX static const struct pin_irq_map pin_irq_map[] = { @@ -234,7 +71,7 @@ static const struct pin_irq_map pin_irq_map[] = {GPIO_PIN_12, EXTI4_15_IRQn}, {GPIO_PIN_13, EXTI4_15_IRQn}, {GPIO_PIN_14, EXTI4_15_IRQn}, - {GPIO_PIN_15, EXTI4_15_IRQn}, + {GPIO_PIN_15, EXTI4_15_IRQn}, #else {GPIO_PIN_0, EXTI0_IRQn}, {GPIO_PIN_1, EXTI1_IRQn}, @@ -277,68 +114,48 @@ static struct rt_pin_irq_hdr pin_irq_hdr_tab[] = static uint32_t pin_irq_enable_mask=0; #define ITEM_NUM(items) sizeof(items) / sizeof(items[0]) -static const struct pin_index *get_pin(uint8_t pin) -{ - const struct pin_index *index; - - if (pin < ITEM_NUM(pins)) - { - index = &pins[pin]; - if (index->index == -1) - index = RT_NULL; - } - else - { - index = RT_NULL; - } - - return index; -}; static void stm32_pin_write(rt_device_t dev, rt_base_t pin, rt_base_t value) { - const struct pin_index *index; + GPIO_TypeDef *gpio_port; + uint16_t gpio_pin; - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) < PIN_STPORT_MAX) { - return; - } + gpio_port = PIN_STPORT(pin); + gpio_pin = PIN_STPIN(pin); - HAL_GPIO_WritePin(index->gpio, index->pin, (GPIO_PinState)value); + HAL_GPIO_WritePin(gpio_port, gpio_pin, (GPIO_PinState)value); + } } static int stm32_pin_read(rt_device_t dev, rt_base_t pin) { - int value; - const struct pin_index *index; + GPIO_TypeDef *gpio_port; + uint16_t gpio_pin; + int value = PIN_LOW; - value = PIN_LOW; - - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) < PIN_STPORT_MAX) { - return value; + gpio_port = PIN_STPORT(pin); + gpio_pin = PIN_STPIN(pin); + value = HAL_GPIO_ReadPin(gpio_port, gpio_pin); } - value = HAL_GPIO_ReadPin(index->gpio, index->pin); - return value; } static void stm32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) { - const struct pin_index *index; GPIO_InitTypeDef GPIO_InitStruct; - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) >= PIN_STPORT_MAX) { return; } /* Configure GPIO_InitStructure */ - GPIO_InitStruct.Pin = index->pin; + GPIO_InitStruct.Pin = PIN_STPIN(pin); GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; @@ -374,7 +191,7 @@ static void stm32_pin_mode(rt_device_t dev, rt_base_t pin, rt_base_t mode) GPIO_InitStruct.Pull = GPIO_NOPULL; } - HAL_GPIO_Init(index->gpio, &GPIO_InitStruct); + HAL_GPIO_Init(PIN_STPORT(pin), &GPIO_InitStruct); } rt_inline rt_int32_t bit2bitno(rt_uint32_t bit) @@ -403,16 +220,15 @@ rt_inline const struct pin_irq_map *get_pin_irq_map(uint32_t pinbit) static rt_err_t stm32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint32_t mode, void (*hdr)(void *args), void *args) { - const struct pin_index *index; rt_base_t level; rt_int32_t irqindex = -1; - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) >= PIN_STPORT_MAX) { - return RT_ENOSYS; + return -RT_ENOSYS; } - irqindex = bit2bitno(index->pin); + + irqindex = bit2bitno(PIN_STPIN(pin)); if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) { return RT_ENOSYS; @@ -420,9 +236,9 @@ static rt_err_t stm32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, level = rt_hw_interrupt_disable(); if (pin_irq_hdr_tab[irqindex].pin == pin && - pin_irq_hdr_tab[irqindex].hdr == hdr && - pin_irq_hdr_tab[irqindex].mode == mode && - pin_irq_hdr_tab[irqindex].args == args) + pin_irq_hdr_tab[irqindex].hdr == hdr && + pin_irq_hdr_tab[irqindex].mode == mode && + pin_irq_hdr_tab[irqindex].args == args) { rt_hw_interrupt_enable(level); return RT_EOK; @@ -443,16 +259,15 @@ static rt_err_t stm32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, static rt_err_t stm32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin) { - const struct pin_index *index; rt_base_t level; rt_int32_t irqindex = -1; - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) >= PIN_STPORT_MAX) { - return RT_ENOSYS; + return -RT_ENOSYS; } - irqindex = bit2bitno(index->pin); + + irqindex = bit2bitno(PIN_STPIN(pin)); if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) { return RT_ENOSYS; @@ -476,21 +291,19 @@ static rt_err_t stm32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin) static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled) { - const struct pin_index *index; const struct pin_irq_map *irqmap; rt_base_t level; rt_int32_t irqindex = -1; GPIO_InitTypeDef GPIO_InitStruct; - index = get_pin(pin); - if (index == RT_NULL) + if (PIN_PORT(pin) >= PIN_STPORT_MAX) { - return RT_ENOSYS; + return -RT_ENOSYS; } if (enabled == PIN_IRQ_ENABLE) { - irqindex = bit2bitno(index->pin); + irqindex = bit2bitno(PIN_STPIN(pin)); if (irqindex < 0 || irqindex >= ITEM_NUM(pin_irq_map)) { return RT_ENOSYS; @@ -507,7 +320,7 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, irqmap = &pin_irq_map[irqindex]; /* Configure GPIO_InitStructure */ - GPIO_InitStruct.Pin = index->pin; + GPIO_InitStruct.Pin = PIN_STPIN(pin); GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; switch (pin_irq_hdr_tab[irqindex].mode) { @@ -524,7 +337,7 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; break; } - HAL_GPIO_Init(index->gpio, &GPIO_InitStruct); + HAL_GPIO_Init(PIN_STPORT(pin), &GPIO_InitStruct); HAL_NVIC_SetPriority(irqmap->irqno, 5, 0); HAL_NVIC_EnableIRQ(irqmap->irqno); @@ -534,7 +347,7 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, } else if (enabled == PIN_IRQ_DISABLE) { - irqmap = get_pin_irq_map(index->pin); + irqmap = get_pin_irq_map(PIN_STPIN(pin)); if (irqmap == RT_NULL) { return RT_ENOSYS; @@ -542,57 +355,57 @@ static rt_err_t stm32_pin_irq_enable(struct rt_device *device, rt_base_t pin, level = rt_hw_interrupt_disable(); - HAL_GPIO_DeInit(index->gpio, index->pin); + HAL_GPIO_DeInit(PIN_STPORT(pin), PIN_STPIN(pin)); pin_irq_enable_mask &= ~irqmap->pinbit; #if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) - if (( irqmap->pinbit>=GPIO_PIN_0 )&&( irqmap->pinbit<=GPIO_PIN_1 )) + if ((irqmap->pinbit >= GPIO_PIN_0) && (irqmap->pinbit <= GPIO_PIN_1)) { - if(!(pin_irq_enable_mask&(GPIO_PIN_0|GPIO_PIN_1))) - { + if (!(pin_irq_enable_mask & (GPIO_PIN_0 | GPIO_PIN_1))) + { HAL_NVIC_DisableIRQ(irqmap->irqno); } } - else if (( irqmap->pinbit>=GPIO_PIN_2 )&&( irqmap->pinbit<=GPIO_PIN_3 )) + else if ((irqmap->pinbit >= GPIO_PIN_2) && (irqmap->pinbit <= GPIO_PIN_3)) { - if(!(pin_irq_enable_mask&(GPIO_PIN_2|GPIO_PIN_3))) - { + if (!(pin_irq_enable_mask & (GPIO_PIN_2 | GPIO_PIN_3))) + { HAL_NVIC_DisableIRQ(irqmap->irqno); } } - else if (( irqmap->pinbit>=GPIO_PIN_4 )&&( irqmap->pinbit<=GPIO_PIN_15 )) + else if ((irqmap->pinbit >= GPIO_PIN_4) && (irqmap->pinbit <= GPIO_PIN_15)) { - if(!(pin_irq_enable_mask&(GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9| - GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15))) - { + if (!(pin_irq_enable_mask & (GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9 | + GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15))) + { HAL_NVIC_DisableIRQ(irqmap->irqno); } - } + } else { HAL_NVIC_DisableIRQ(irqmap->irqno); - } -#else - if (( irqmap->pinbit>=GPIO_PIN_5 )&&( irqmap->pinbit<=GPIO_PIN_9 )) + } +#else + if ((irqmap->pinbit >= GPIO_PIN_5) && (irqmap->pinbit <= GPIO_PIN_9)) { - if(!(pin_irq_enable_mask&(GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_8|GPIO_PIN_9))) - { + if (!(pin_irq_enable_mask & (GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7 | GPIO_PIN_8 | GPIO_PIN_9))) + { HAL_NVIC_DisableIRQ(irqmap->irqno); } } - else if (( irqmap->pinbit>=GPIO_PIN_10 )&&( irqmap->pinbit<=GPIO_PIN_15 )) + else if ((irqmap->pinbit >= GPIO_PIN_10) && (irqmap->pinbit <= GPIO_PIN_15)) { - if(!(pin_irq_enable_mask&(GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15))) - { + if (!(pin_irq_enable_mask & (GPIO_PIN_10 | GPIO_PIN_11 | GPIO_PIN_12 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15))) + { HAL_NVIC_DisableIRQ(irqmap->irqno); } } else { HAL_NVIC_DisableIRQ(irqmap->irqno); - } -#endif - rt_hw_interrupt_enable(level); + } +#endif + rt_hw_interrupt_enable(level); } else { @@ -609,6 +422,7 @@ const static struct rt_pin_ops _stm32_pin_ops = stm32_pin_attach_irq, stm32_pin_dettach_irq, stm32_pin_irq_enable, + }; rt_inline void pin_irq_hdr(int irqno) @@ -736,15 +550,15 @@ int rt_hw_pin_init(void) #if defined(__HAL_RCC_GPIOA_CLK_ENABLE) __HAL_RCC_GPIOA_CLK_ENABLE(); #endif - + #if defined(__HAL_RCC_GPIOB_CLK_ENABLE) __HAL_RCC_GPIOB_CLK_ENABLE(); #endif - + #if defined(__HAL_RCC_GPIOC_CLK_ENABLE) __HAL_RCC_GPIOC_CLK_ENABLE(); #endif - + #if defined(__HAL_RCC_GPIOD_CLK_ENABLE) __HAL_RCC_GPIOD_CLK_ENABLE(); #endif diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.h b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.h index 98c704e97..13b51389b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_gpio.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_gpio.h @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-06 balanceTWK first version + * 2020-09-18 geniusgogo optimization design pin-index algorithm */ #ifndef __DRV_GPIO_H__ @@ -14,27 +15,14 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + #define __STM32_PORT(port) GPIO##port##_BASE #define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__STM32_PORT(PORTx) - (rt_base_t)GPIOA_BASE)/(0x0400UL) )) + PIN) -#define __STM32_PIN(index, gpio, gpio_index) \ - { \ - index, GPIO##gpio, GPIO_PIN_##gpio_index \ - } - -#define __STM32_PIN_RESERVE \ - { \ - -1, 0, 0 \ - } - -/* STM32 GPIO driver */ -struct pin_index -{ - int index; - GPIO_TypeDef *gpio; - uint32_t pin; -}; struct pin_irq_map { @@ -44,5 +32,9 @@ struct pin_irq_map int rt_hw_pin_init(void); +#ifdef __cplusplus +} +#endif + #endif /* __DRV_GPIO_H__ */ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c index dfc96ae26..92944510e 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_hwtimer.c @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-12-10 zylx first version + * 2020-08-25 linyongkang Fix the timer clock frequency doubling problem */ #include @@ -151,9 +152,47 @@ static struct stm32_hwtimer stm32_hwtimer_obj[] = #endif }; +/* APBx timer clocks frequency doubler state related to APB1CLKDivider value */ +static void pclkx_doubler_get(rt_uint32_t *pclk1_doubler, rt_uint32_t *pclk2_doubler) +{ + rt_uint32_t flatency = 0; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + + RT_ASSERT(pclk1_doubler != RT_NULL); + RT_ASSERT(pclk1_doubler != RT_NULL); + + HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &flatency); + + *pclk1_doubler = 1; + *pclk2_doubler = 1; + +#if defined(SOC_SERIES_STM32MP1) + if (RCC_ClkInitStruct.APB1_Div != RCC_APB1_DIV1) + { + *pclk1_doubler = 2; + } + if (RCC_ClkInitStruct.APB2_Div != RCC_APB2_DIV1) + { + *pclk2_doubler = 2; + } +#else + if (RCC_ClkInitStruct.APB1CLKDivider != RCC_HCLK_DIV1) + { + *pclk1_doubler = 2; + } +#if !defined(SOC_SERIES_STM32F0) && !defined(SOC_SERIES_STM32G0) + if (RCC_ClkInitStruct.APB2CLKDivider != RCC_HCLK_DIV1) + { + *pclk2_doubler = 2; + } +#endif +#endif +} + static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state) { uint32_t prescaler_value = 0; + uint32_t pclk1_doubler, pclk2_doubler; TIM_HandleTypeDef *tim = RT_NULL; struct stm32_hwtimer *tim_device = RT_NULL; @@ -163,6 +202,8 @@ static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state) tim = (TIM_HandleTypeDef *)timer->parent.user_data; tim_device = (struct stm32_hwtimer *)timer; + pclkx_doubler_get(&pclk1_doubler, &pclk2_doubler); + /* time init */ #if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) if (tim->Instance == TIM9 || tim->Instance == TIM10 || tim->Instance == TIM11) @@ -173,12 +214,12 @@ static void timer_init(struct rt_hwtimer_device *timer, rt_uint32_t state) #endif { #if !defined(SOC_SERIES_STM32F0) && !defined(SOC_SERIES_STM32G0) - prescaler_value = (uint32_t)(HAL_RCC_GetPCLK2Freq() * 2 / 10000) - 1; + prescaler_value = (uint32_t)(HAL_RCC_GetPCLK2Freq() * pclk2_doubler / 10000) - 1; #endif } else { - prescaler_value = (uint32_t)(HAL_RCC_GetPCLK1Freq() * 2 / 10000) - 1; + prescaler_value = (uint32_t)(HAL_RCC_GetPCLK1Freq() * pclk1_doubler / 10000) - 1; } tim->Init.Period = 10000 - 1; tim->Init.Prescaler = prescaler_value; @@ -241,7 +282,7 @@ static rt_err_t timer_start(rt_hwtimer_t *timer, rt_uint32_t t, rt_hwtimer_mode_ { tim->Instance->CR1 &= (~TIM_OPMODE_SINGLE); } - + /* start timer */ if (HAL_TIM_Base_Start_IT(tim) != HAL_OK) { @@ -271,6 +312,7 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg) { TIM_HandleTypeDef *tim = RT_NULL; rt_err_t result = RT_EOK; + uint32_t pclk1_doubler, pclk2_doubler; RT_ASSERT(timer != RT_NULL); RT_ASSERT(arg != RT_NULL); @@ -287,6 +329,8 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg) /* set timer frequence */ freq = *((rt_uint32_t *)arg); + pclkx_doubler_get(&pclk1_doubler, &pclk2_doubler); + #if defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) if (tim->Instance == TIM9 || tim->Instance == TIM10 || tim->Instance == TIM11) #elif defined(SOC_SERIES_STM32L4) @@ -295,19 +339,13 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg) if (0) #endif { -#if defined(SOC_SERIES_STM32L4) - val = HAL_RCC_GetPCLK2Freq() / freq; -#elif defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) - val = HAL_RCC_GetPCLK2Freq() * 2 / freq; +#if !defined(SOC_SERIES_STM32F0) && !defined(SOC_SERIES_STM32G0) + val = HAL_RCC_GetPCLK2Freq() * pclk2_doubler / freq; #endif } else { -#if defined(SOC_SERIES_STM32F1) || defined(SOC_SERIES_STM32F2) || defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) - val = HAL_RCC_GetPCLK1Freq() * 2 / freq; -#elif defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) - val = HAL_RCC_GetPCLK1Freq() / freq; -#endif + val = HAL_RCC_GetPCLK1Freq() * pclk1_doubler / freq; } __HAL_TIM_SET_PRESCALER(tim, val - 1); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_lcd.c b/bsp/stm32/libraries/HAL_Drivers/drv_lcd.c index 3f6de0286..5d170016b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_lcd.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_lcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -254,6 +254,11 @@ void turn_on_lcd_backlight(void) rt_pin_write(LCD_DISP_GPIO_NUM, PIN_HIGH); rt_pin_write(LCD_BL_GPIO_NUM, PIN_HIGH); +} +#else +void turn_on_lcd_backlight(void) +{ + } #endif @@ -333,7 +338,7 @@ int drv_lcd_hw_init(void) __exit: if (result != RT_EOK) { - rt_sem_delete(&_lcd.lcd_lock); + rt_sem_detach(&_lcd.lcd_lock); if (_lcd.lcd_info.framebuffer) { diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_lcd_mipi.c b/bsp/stm32/libraries/HAL_Drivers/drv_lcd_mipi.c index 392835315..275a18e92 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_lcd_mipi.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_lcd_mipi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2019-05-23 WillianChan first version */ - + #include #ifdef BSP_USING_LCD_MIPI @@ -23,7 +23,7 @@ struct stm32_lcd struct rt_device parent; struct rt_device_graphic_info info; }; -static struct stm32_lcd lcd; +static struct stm32_lcd lcd; extern void stm32_mipi_lcd_init(void); extern void stm32_mipi_lcd_config(rt_uint32_t pixel_format); @@ -32,14 +32,14 @@ extern void stm32_mipi_display_off(void); rt_err_t ltdc_init(void) { - uint32_t lcd_clock = 27429; + uint32_t lcd_clock = 27429; uint32_t lanebyte_clock = 62500; - + uint32_t HSA = LCD_HSYNC, HFP = LCD_HFP, HBP = LCD_HBP, HACT = LCD_WIDTH; uint32_t VSA = LCD_VSYNC, VFP = LCD_VFP, VBP = LCD_VBP, VACT = LCD_HEIGHT; stm32_mipi_lcd_init(); - + __HAL_RCC_LTDC_CLK_ENABLE(); __HAL_RCC_LTDC_FORCE_RESET(); __HAL_RCC_LTDC_RELEASE_RESET(); @@ -47,92 +47,92 @@ rt_err_t ltdc_init(void) __HAL_RCC_DSI_CLK_ENABLE(); __HAL_RCC_DSI_FORCE_RESET(); __HAL_RCC_DSI_RELEASE_RESET(); - + RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; - + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC; PeriphClkInitStruct.PLLSAI.PLLSAIN = 384; PeriphClkInitStruct.PLLSAI.PLLSAIR = 7; PeriphClkInitStruct.PLLSAIDivR = RCC_PLLSAIDIVR_2; HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); - + HAL_NVIC_SetPriority(LTDC_IRQn, 3, 0); HAL_NVIC_SetPriority(DSI_IRQn, 3, 0); HAL_NVIC_EnableIRQ(LTDC_IRQn); HAL_NVIC_EnableIRQ(DSI_IRQn); - + DSI_PLLInitTypeDef dsi_pll; - - hdsi.Instance = DSI; + + hdsi.Instance = DSI; hdsi.Init.NumberOfLanes = DSI_TWO_DATA_LANES; hdsi.Init.TXEscapeCkdiv = lanebyte_clock / 15620; - + dsi_pll.PLLNDIV = 125; dsi_pll.PLLIDF = DSI_PLL_IN_DIV2; - dsi_pll.PLLODF = DSI_PLL_OUT_DIV1; - + dsi_pll.PLLODF = DSI_PLL_OUT_DIV1; + HAL_DSI_DeInit(&hdsi); - HAL_DSI_Init(&hdsi, &dsi_pll); - + HAL_DSI_Init(&hdsi, &dsi_pll); + hdsi_video.VirtualChannelID = 0; hdsi_video.ColorCoding = DSI_RGB888; hdsi_video.VSPolarity = DSI_VSYNC_ACTIVE_HIGH; hdsi_video.HSPolarity = DSI_HSYNC_ACTIVE_HIGH; hdsi_video.DEPolarity = DSI_DATA_ENABLE_ACTIVE_HIGH; - hdsi_video.Mode = DSI_VID_MODE_BURST; + hdsi_video.Mode = DSI_VID_MODE_BURST; hdsi_video.NullPacketSize = 0xFFF; hdsi_video.NumberOfChunks = 0; - hdsi_video.PacketSize = HACT; + hdsi_video.PacketSize = HACT; hdsi_video.HorizontalSyncActive = (HSA * lanebyte_clock) / lcd_clock; hdsi_video.HorizontalBackPorch = (HBP * lanebyte_clock) / lcd_clock; - hdsi_video.HorizontalLine = ((HACT + HSA + HBP + HFP) * lanebyte_clock) / lcd_clock; + hdsi_video.HorizontalLine = ((HACT + HSA + HBP + HFP) * lanebyte_clock) / lcd_clock; hdsi_video.VerticalSyncActive = VSA; hdsi_video.VerticalBackPorch = VBP; hdsi_video.VerticalFrontPorch = VFP; - hdsi_video.VerticalActive = VACT; - hdsi_video.LPCommandEnable = DSI_LP_COMMAND_ENABLE; + hdsi_video.VerticalActive = VACT; + hdsi_video.LPCommandEnable = DSI_LP_COMMAND_ENABLE; hdsi_video.LPLargestPacketSize = 16; hdsi_video.LPVACTLargestPacketSize = 0; - hdsi_video.LPHorizontalFrontPorchEnable = DSI_LP_HFP_ENABLE; - hdsi_video.LPHorizontalBackPorchEnable = DSI_LP_HBP_ENABLE; - hdsi_video.LPVerticalActiveEnable = DSI_LP_VACT_ENABLE; - hdsi_video.LPVerticalFrontPorchEnable = DSI_LP_VFP_ENABLE; - hdsi_video.LPVerticalBackPorchEnable = DSI_LP_VBP_ENABLE; - hdsi_video.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_ENABLE; - HAL_DSI_ConfigVideoMode(&hdsi, &hdsi_video); - + hdsi_video.LPHorizontalFrontPorchEnable = DSI_LP_HFP_ENABLE; + hdsi_video.LPHorizontalBackPorchEnable = DSI_LP_HBP_ENABLE; + hdsi_video.LPVerticalActiveEnable = DSI_LP_VACT_ENABLE; + hdsi_video.LPVerticalFrontPorchEnable = DSI_LP_VFP_ENABLE; + hdsi_video.LPVerticalBackPorchEnable = DSI_LP_VBP_ENABLE; + hdsi_video.LPVerticalSyncActiveEnable = DSI_LP_VSYNC_ENABLE; + HAL_DSI_ConfigVideoMode(&hdsi, &hdsi_video); + DSI_PHY_TimerTypeDef dsi_phy; - + dsi_phy.ClockLaneHS2LPTime = 35; dsi_phy.ClockLaneLP2HSTime = 35; dsi_phy.DataLaneHS2LPTime = 35; dsi_phy.DataLaneLP2HSTime = 35; dsi_phy.DataLaneMaxReadTime = 0; dsi_phy.StopWaitTime = 10; - HAL_DSI_ConfigPhyTimer(&hdsi, &dsi_phy); - + HAL_DSI_ConfigPhyTimer(&hdsi, &dsi_phy); + hltdc.Instance = LTDC; - + hltdc.Init.PCPolarity = LTDC_PCPOLARITY_IPC; hltdc.Init.HorizontalSync = (HSA - 1); hltdc.Init.AccumulatedHBP = (HSA + HBP - 1); hltdc.Init.AccumulatedActiveW = (LCD_WIDTH + HSA + HBP - 1); hltdc.Init.TotalWidth = (LCD_WIDTH + HSA + HBP + HFP - 1); - + hltdc.LayerCfg->ImageWidth = LCD_WIDTH; - hltdc.LayerCfg->ImageHeight = LCD_HEIGHT; + hltdc.LayerCfg->ImageHeight = LCD_HEIGHT; hltdc.Init.Backcolor.Blue = 0x00; hltdc.Init.Backcolor.Green = 0x00; hltdc.Init.Backcolor.Red = 0x00; - HAL_LTDCEx_StructInitFromVideoConfig(&hltdc, &(hdsi_video)); + HAL_LTDCEx_StructInitFromVideoConfig(&hltdc, &(hdsi_video)); HAL_LTDC_Init(&(hltdc)); - - HAL_DSI_Start(&(hdsi)); + + HAL_DSI_Start(&(hdsi)); stm32_mipi_lcd_config(RTGRAPHIC_PIXEL_FORMAT_ARGB888); - - return RT_EOK; + + return RT_EOK; } void ltdc_layer_init(uint16_t index, uint32_t framebuffer) @@ -140,7 +140,7 @@ void ltdc_layer_init(uint16_t index, uint32_t framebuffer) LTDC_LayerCfgTypeDef layer_cfg; layer_cfg.WindowX0 = 0; - layer_cfg.WindowX1 = LCD_WIDTH; + layer_cfg.WindowX1 = LCD_WIDTH; layer_cfg.WindowY0 = 0; layer_cfg.WindowY1 = LCD_HEIGHT; layer_cfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888; @@ -161,7 +161,7 @@ void ltdc_layer_init(uint16_t index, uint32_t framebuffer) void LTDC_IRQHandler(void) { rt_interrupt_enter(); - HAL_LTDC_IRQHandler(&hltdc); + HAL_LTDC_IRQHandler(&hltdc); rt_interrupt_leave(); } @@ -171,11 +171,11 @@ static rt_err_t stm32_lcd_init(rt_device_t device) lcd.info.height = LCD_HEIGHT; lcd.info.pixel_format = RTGRAPHIC_PIXEL_FORMAT_ARGB888; lcd.info.bits_per_pixel = 32; - lcd.info.framebuffer = (void *)rt_malloc_align(LCD_WIDTH * LCD_HEIGHT * (lcd.info.bits_per_pixel / 8), 32); + lcd.info.framebuffer = (void *)rt_malloc_align(LCD_WIDTH * LCD_HEIGHT * (lcd.info.bits_per_pixel / 8), 32); memset(lcd.info.framebuffer, 0, LCD_WIDTH * LCD_HEIGHT * (lcd.info.bits_per_pixel / 8)); ltdc_init(); - ltdc_layer_init(0, (uint32_t)lcd.info.framebuffer); - + ltdc_layer_init(0, (uint32_t)lcd.info.framebuffer); + return RT_EOK; } @@ -186,12 +186,12 @@ static rt_err_t stm32_lcd_control(rt_device_t device, int cmd, void *args) case RTGRAPHIC_CTRL_RECT_UPDATE: break; - case RTGRAPHIC_CTRL_POWERON: - stm32_mipi_display_on(); + case RTGRAPHIC_CTRL_POWERON: + stm32_mipi_display_on(); break; - case RTGRAPHIC_CTRL_POWEROFF: - stm32_mipi_display_off(); + case RTGRAPHIC_CTRL_POWEROFF: + stm32_mipi_display_off(); break; case RTGRAPHIC_CTRL_GET_INFO: @@ -210,9 +210,9 @@ static rt_err_t stm32_lcd_control(rt_device_t device, int cmd, void *args) int rt_hw_lcd_init(void) { - rt_err_t ret; - - rt_memset(&lcd, 0x00, sizeof(lcd)); + rt_err_t ret; + + rt_memset(&lcd, 0x00, sizeof(lcd)); lcd.parent.type = RT_Device_Class_Graphic; lcd.parent.init = stm32_lcd_init; diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_log.h b/bsp/stm32/libraries/HAL_Drivers/drv_log.h index 7e0bfee5b..3fe511789 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_log.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_lptim.c b/bsp/stm32/libraries/HAL_Drivers/drv_lptim.c index 64e602fa5..7986a247d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_lptim.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_lptim.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,15 +13,6 @@ static LPTIM_HandleTypeDef LptimHandle; -void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim) -{ - if (hlptim->Instance == LPTIM1) - { - /* Peripheral clock enable */ - __HAL_RCC_LPTIM1_CLK_ENABLE(); - } -} - void LPTIM1_IRQHandler(void) { HAL_LPTIM_IRQHandler(&LptimHandle); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_lptim.h b/bsp/stm32/libraries/HAL_Drivers/drv_lptim.h index 0fd51b5ea..b9fa2952a 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_lptim.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_lptim.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pm.c index 84ddf6cd4..2c3b9276f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -95,11 +95,13 @@ static void run(struct rt_pm *pm, uint8_t mode) { case PM_RUN_MODE_HIGH_SPEED: case PM_RUN_MODE_NORMAL_SPEED: + HAL_PWREx_DisableLowPowerRunMode(); SystemClock_80M(); /* Configure the main internal regulator output voltage (Range1 by default)*/ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); break; case PM_RUN_MODE_MEDIUM_SPEED: + HAL_PWREx_DisableLowPowerRunMode(); SystemClock_24M(); /* Configure the main internal regulator output voltage */ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE2); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c b/bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c index 55e7bf45e..d6f85f25e 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pulse_encoder.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c index 2c2af0dcc..6173d208f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_pwm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -205,7 +205,7 @@ static rt_err_t drv_pwm_get(TIM_HandleTypeDef *htim, struct rt_pwm_configuration tim_clock = HAL_RCC_GetPCLK1Freq() * 2; #endif } - + if (__HAL_TIM_GET_CLOCKDIVISION(htim) == TIM_CLOCKDIVISION_DIV2) { tim_clock = tim_clock / 2; @@ -323,9 +323,9 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) tim->Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; #endif - if (HAL_TIM_Base_Init(tim) != HAL_OK) + if (HAL_TIM_PWM_Init(tim) != HAL_OK) { - LOG_E("%s time base init failed", device->name); + LOG_E("%s pwm init failed", device->name); result = -RT_ERROR; goto __exit; } @@ -338,13 +338,6 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) goto __exit; } - if (HAL_TIM_PWM_Init(tim) != HAL_OK) - { - LOG_E("%s pwm init failed", device->name); - result = -RT_ERROR; - goto __exit; - } - master_config.MasterOutputTrigger = TIM_TRGO_RESET; master_config.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(tim, &master_config) != HAL_OK) @@ -358,6 +351,8 @@ static rt_err_t stm32_hw_pwm_init(struct stm32_pwm *device) oc_config.Pulse = 0; oc_config.OCPolarity = TIM_OCPOLARITY_HIGH; oc_config.OCFastMode = TIM_OCFAST_DISABLE; + oc_config.OCNIdleState = TIM_OCNIDLESTATE_RESET; + oc_config.OCIdleState = TIM_OCIDLESTATE_RESET; /* config pwm channel */ if (device->channel & 0x01) diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c index 52c184290..24e7f57a3 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -104,7 +104,7 @@ static int stm32_qspi_init(struct rt_qspi_device *device, struct rt_qspi_configu { __HAL_RCC_DMA2_CLK_ENABLE(); } - + HAL_DMA_DeInit(qspi_bus->QSPI_Handler.hdma); DMA_HandleTypeDef hdma_quadspi_config = QSPI_DMA_CONFIG; qspi_bus->hdma_quadspi = hdma_quadspi_config; diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.h b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.h index d4609e3dc..fb48dd45b 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_qspi.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_qspi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,11 +7,20 @@ * Date Author Notes * 2018-11-27 zylx first version */ - -#ifndef __DRV_QSPI_H_ -#define __DRV_QSPI_H_ + +#ifndef __DRV_QSPI_H__ +#define __DRV_QSPI_H__ + #include +#ifdef __cplusplus +extern "C" { +#endif + rt_err_t stm32_qspi_bus_attach_device(const char *bus_name, const char *device_name, rt_uint32_t pin, rt_uint8_t data_line_width, void (*enter_qspi_mode)(), void (*exit_qspi_mode)()); +#ifdef __cplusplus +} #endif + +#endif /* __DRV_QSPI_H__ */ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c index f62ed0b8f..a6a9d2f01 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_rtc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -37,7 +37,7 @@ static time_t get_rtc_timestamp(void) { RTC_TimeTypeDef RTC_TimeStruct = {0}; RTC_DateTypeDef RTC_DateStruct = {0}; - struct tm tm_new; + struct tm tm_new = {0}; HAL_RTC_GetTime(&RTC_Handler, &RTC_TimeStruct, RTC_FORMAT_BIN); HAL_RTC_GetDate(&RTC_Handler, &RTC_DateStruct, RTC_FORMAT_BIN); @@ -84,6 +84,15 @@ static rt_err_t set_rtc_time_stamp(time_t time_stamp) LOG_D("set rtc time."); HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR1, BKUP_REG_DATA); + +#ifdef SOC_SERIES_STM32F1 + /* F1 series does't save year/month/date datas. so keep those datas to bkp reg */ + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR2, RTC_DateStruct.Year); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR3, RTC_DateStruct.Month); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR4, RTC_DateStruct.Date); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR5, RTC_DateStruct.WeekDay); +#endif + return RT_EOK; } @@ -108,6 +117,36 @@ static void rt_rtc_init(void) HAL_RCC_OscConfig(&RCC_OscInitStruct); } +#ifdef SOC_SERIES_STM32F1 +/* update RTC_BKP_DRx*/ +static void rt_rtc_f1_bkp_update(void) +{ + RTC_DateTypeDef RTC_DateStruct = {0}; + + HAL_PWR_EnableBkUpAccess(); + __HAL_RCC_BKP_CLK_ENABLE(); + + RTC_DateStruct.Year = HAL_RTCEx_BKUPRead(&RTC_Handler, RTC_BKP_DR2); + RTC_DateStruct.Month = HAL_RTCEx_BKUPRead(&RTC_Handler, RTC_BKP_DR3); + RTC_DateStruct.Date = HAL_RTCEx_BKUPRead(&RTC_Handler, RTC_BKP_DR4); + RTC_DateStruct.WeekDay = HAL_RTCEx_BKUPRead(&RTC_Handler, RTC_BKP_DR5); + if (HAL_RTC_SetDate(&RTC_Handler, &RTC_DateStruct, RTC_FORMAT_BIN) != HAL_OK) + { + Error_Handler(); + } + + HAL_RTC_GetDate(&RTC_Handler, &RTC_DateStruct, RTC_FORMAT_BIN); + if (HAL_RTCEx_BKUPRead(&RTC_Handler, RTC_BKP_DR4) != RTC_DateStruct.Date) + { + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR1, BKUP_REG_DATA); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR2, RTC_DateStruct.Year); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR3, RTC_DateStruct.Month); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR4, RTC_DateStruct.Date); + HAL_RTCEx_BKUPWrite(&RTC_Handler, RTC_BKP_DR5, RTC_DateStruct.WeekDay); + } +} +#endif + static rt_err_t rt_rtc_config(struct rt_device *dev) { RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; @@ -167,6 +206,14 @@ static rt_err_t rt_rtc_config(struct rt_device *dev) return -RT_ERROR; } } +#ifdef SOC_SERIES_STM32F1 + else + { + /* F1 series need update by bkp reg datas */ + rt_rtc_f1_bkp_update(); + } +#endif + return RT_EOK; } diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_sdio.c b/bsp/stm32/libraries/HAL_Drivers/drv_sdio.c index 61387f24e..d7241e912 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_sdio.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_sdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,8 @@ * Date Author Notes * 2018-06-22 tyx first * 2018-12-12 balanceTWK first version - * 2019-06-11 WillianChan Add SD card hot plug detection + * 2019-06-11 WillianChan Add SD card hot plug detection + * 2020-11-09 whj4674672 fix sdio non-aligned access problem */ #include "board.h" @@ -352,7 +353,7 @@ static void rthw_sdio_send_command(struct rthw_sdio *sdio, struct sdio_pkg *pkg) /** * @brief This function send sdio request. - * @param sdio rthw_sdio + * @param host rt_mmcsd_host * @param req request * @retval None */ @@ -366,7 +367,7 @@ static void rthw_sdio_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *r if (req->cmd != RT_NULL) { - memset(&pkg, 0, sizeof(pkg)); + rt_memset(&pkg, 0, sizeof(pkg)); data = req->cmd->data; pkg.cmd = req->cmd; @@ -382,7 +383,7 @@ static void rthw_sdio_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *r pkg.buff = cache_buf; if (data->flags & DATA_DIR_WRITE) { - memcpy(cache_buf, data->buf, size); + rt_memcpy(cache_buf, data->buf, size); } } } @@ -391,13 +392,13 @@ static void rthw_sdio_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *r if ((data != RT_NULL) && (data->flags & DATA_DIR_READ) && ((rt_uint32_t)data->buf & (SDIO_ALIGN_LEN - 1))) { - memcpy(data->buf, cache_buf, data->blksize * data->blks); + rt_memcpy(data->buf, cache_buf, data->blksize * data->blks); } } if (req->stop != RT_NULL) { - memset(&pkg, 0, sizeof(pkg)); + rt_memset(&pkg, 0, sizeof(pkg)); pkg.cmd = req->stop; rthw_sdio_send_command(sdio, &pkg); } @@ -524,11 +525,11 @@ void rthw_sdio_irq_update(struct rt_mmcsd_host *host, rt_int32_t enable) } /** - * @brief This function delect sdcard. + * @brief This function detect sdcard. * @param host rt_mmcsd_host * @retval 0x01 */ -static rt_int32_t rthw_sd_delect(struct rt_mmcsd_host *host) +static rt_int32_t rthw_sd_detect(struct rt_mmcsd_host *host) { LOG_D("try to detect device"); return 0x01; @@ -604,7 +605,7 @@ static const struct rt_mmcsd_host_ops ops = { rthw_sdio_request, rthw_sdio_iocfg, - rthw_sd_delect, + rthw_sd_detect, rthw_sdio_irq_update, }; @@ -852,7 +853,7 @@ int rt_hw_sdio_init(void) /* enable DMA clock && Delay after an RCC peripheral clock enabling*/ SET_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc); tmpreg = READ_BIT(RCC->AHBENR, sdio_config.dma_rx.dma_rcc); -#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) +#elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32F2) SET_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc); /* Delay after an RCC peripheral clock enabling */ tmpreg = READ_BIT(RCC->AHB1ENR, sdio_config.dma_rx.dma_rcc); diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_sdio.h b/bsp/stm32/libraries/HAL_Drivers/drv_sdio.h index 565a4bed0..920808f9d 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_sdio.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_sdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_sdram.c b/bsp/stm32/libraries/HAL_Drivers/drv_sdram.c index 97731ff3b..4ae336c3f 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_sdram.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_sdram.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.c b/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.c index af89ae703..871686650 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -207,10 +207,10 @@ int rt_hw_i2c_init(void) result = rt_i2c_bit_add_bus(&i2c_obj[i].i2c2_bus, soft_i2c_config[i].bus_name); RT_ASSERT(result == RT_EOK); stm32_i2c_bus_unlock(&soft_i2c_config[i]); - + LOG_D("software simulation %s init done, pin scl: %d, pin sda %d", - soft_i2c_config[i].bus_name, - soft_i2c_config[i].scl, + soft_i2c_config[i].bus_name, + soft_i2c_config[i].scl, soft_i2c_config[i].sda); } diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.h b/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.h index 31cba68f9..a9683e3e2 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_soft_i2c.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -37,7 +37,7 @@ struct stm32_i2c .bus_name = "i2c1", \ } #endif - + #ifdef BSP_USING_I2C2 #define I2C2_BUS_CONFIG \ { \ @@ -46,7 +46,7 @@ struct stm32_i2c .bus_name = "i2c2", \ } #endif - + #ifdef BSP_USING_I2C3 #define I2C3_BUS_CONFIG \ { \ @@ -55,7 +55,7 @@ struct stm32_i2c .bus_name = "i2c3", \ } #endif - + #ifdef BSP_USING_I2C4 #define I2C4_BUS_CONFIG \ { \ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_spi.c b/bsp/stm32/libraries/HAL_Drivers/drv_spi.c index 993e4cbc1..6de9dafd2 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_spi.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_spi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -10,12 +10,13 @@ * 2019-01-03 zylx modify DMA initialization and spixfer function */ +#include +#include #include "board.h" #ifdef RT_USING_SPI #if defined(BSP_USING_SPI1) || defined(BSP_USING_SPI2) || defined(BSP_USING_SPI3) || defined(BSP_USING_SPI4) || defined(BSP_USING_SPI5) || defined(BSP_USING_SPI6) -/* this driver can be disabled at menuconfig → RT-Thread Components → Device Drivers */ #include "drv_spi.h" #include "drv_config.h" @@ -136,7 +137,7 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur if (cfg->mode & RT_SPI_NO_CS) { - spi_handle->Init.NSS = SPI_NSS_SOFT; + spi_handle->Init.NSS = SPI_NSS_HARD_OUTPUT; } else { @@ -147,6 +148,8 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur #if defined(SOC_SERIES_STM32F0) || defined(SOC_SERIES_STM32G0) SPI_APB_CLOCK = HAL_RCC_GetPCLK1Freq(); +#elif defined(SOC_SERIES_STM32H7) + SPI_APB_CLOCK = HAL_RCC_GetSysClockFreq(); #else SPI_APB_CLOCK = HAL_RCC_GetPCLK2Freq(); #endif @@ -205,6 +208,20 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur spi_handle->State = HAL_SPI_STATE_RESET; #if defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32F0) spi_handle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE; +#elif defined(SOC_SERIES_STM32H7) + spi_handle->Init.Mode = SPI_MODE_MASTER; + spi_handle->Init.NSS = SPI_NSS_SOFT; + spi_handle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + spi_handle->Init.NSSPolarity = SPI_NSS_POLARITY_LOW; + spi_handle->Init.CRCPolynomial = 7; + spi_handle->Init.TxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN; + spi_handle->Init.RxCRCInitializationPattern = SPI_CRC_INITIALIZATION_ALL_ZERO_PATTERN; + spi_handle->Init.MasterSSIdleness = SPI_MASTER_SS_IDLENESS_00CYCLE; + spi_handle->Init.MasterInterDataIdleness = SPI_MASTER_INTERDATA_IDLENESS_00CYCLE; + spi_handle->Init.MasterReceiverAutoSusp = SPI_MASTER_RX_AUTOSUSP_DISABLE; + spi_handle->Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE; + spi_handle->Init.IOSwap = SPI_IO_SWAP_DISABLE; + spi_handle->Init.FifoThreshold = SPI_FIFO_THRESHOLD_08DATA; #endif if (HAL_SPI_Init(spi_handle) != HAL_OK) @@ -240,8 +257,6 @@ static rt_err_t stm32_spi_init(struct stm32_spi *spi_drv, struct rt_spi_configur HAL_NVIC_EnableIRQ(spi_drv->config->dma_tx->dma_irq); } - __HAL_SPI_ENABLE(spi_handle); - LOG_D("%s init done", spi_drv->config->bus_name); return RT_EOK; } @@ -263,7 +278,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * SPI_HandleTypeDef *spi_handle = &spi_drv->handle; struct stm32_hw_spi_cs *cs = device->parent.user_data; - if (message->cs_take) + if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS)) { HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_RESET); } @@ -295,7 +310,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * already_send_length = message->length - send_length - message_length; send_buf = (rt_uint8_t *)message->send_buf + already_send_length; recv_buf = (rt_uint8_t *)message->recv_buf + already_send_length; - + /* start once data exchange in DMA mode */ if (message->send_buf && message->recv_buf) { @@ -318,6 +333,12 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * { state = HAL_SPI_Transmit(spi_handle, (uint8_t *)send_buf, send_length, 1000); } + + if (message->cs_release && (device->config.mode & RT_SPI_3WIRE)) + { + /* release the CS by disable SPI when using 3 wires SPI */ + __HAL_SPI_DISABLE(spi_handle); + } } else { @@ -328,6 +349,8 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * } else { + /* clear the old error flag */ + __HAL_SPI_CLEAR_OVRFLAG(spi_handle); state = HAL_SPI_Receive(spi_handle, (uint8_t *)recv_buf, send_length, 1000); } } @@ -349,7 +372,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message * while (HAL_SPI_GetState(spi_handle) != HAL_SPI_STATE_READY); } - if (message->cs_release) + if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS)) { HAL_GPIO_WritePin(cs->GPIOx, cs->GPIO_Pin, GPIO_PIN_SET); } @@ -862,23 +885,23 @@ static void stm32_get_dma_info(void) } #if defined(SOC_SERIES_STM32F0) -void SPI1_DMA_RX_TX_IRQHandler(void) +void SPI1_DMA_RX_TX_IRQHandler(void) { #if defined(BSP_USING_SPI1) && defined(BSP_SPI1_TX_USING_DMA) SPI1_DMA_TX_IRQHandler(); #endif - + #if defined(BSP_USING_SPI1) && defined(BSP_SPI1_RX_USING_DMA) SPI1_DMA_RX_IRQHandler(); #endif } -void SPI2_DMA_RX_TX_IRQHandler(void) +void SPI2_DMA_RX_TX_IRQHandler(void) { #if defined(BSP_USING_SPI2) && defined(BSP_SPI2_TX_USING_DMA) SPI2_DMA_TX_IRQHandler(); #endif - + #if defined(BSP_USING_SPI2) && defined(BSP_SPI2_RX_USING_DMA) SPI2_DMA_RX_IRQHandler(); #endif diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_spi.h b/bsp/stm32/libraries/HAL_Drivers/drv_spi.h index 763a44dfd..f30d97f77 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_spi.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_spi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,8 +8,8 @@ * 2018-11-5 SummerGift first version */ -#ifndef __DRV_SPI_H_ -#define __DRV_SPI_H_ +#ifndef __DRV_SPI_H__ +#define __DRV_SPI_H__ #include #include "rtdevice.h" @@ -17,8 +17,16 @@ #include #include "drv_dma.h" +#ifdef __cplusplus +extern "C" { +#endif + rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, GPIO_TypeDef* cs_gpiox, uint16_t cs_gpio_pin); +#ifdef __cplusplus +} +#endif + struct stm32_hw_spi_cs { GPIO_TypeDef* GPIOx; @@ -54,9 +62,9 @@ struct stm32_spi DMA_HandleTypeDef handle_rx; DMA_HandleTypeDef handle_tx; } dma; - + rt_uint8_t spi_dma_flag; struct rt_spi_bus spi_bus; }; -#endif /*__DRV_SPI_H_ */ +#endif /*__DRV_SPI_H__ */ diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c index 7418d6f50..6a94e64f1 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -146,6 +146,10 @@ static rt_err_t stm32_configure(struct rt_serial_device *serial, struct serial_c break; } +#ifdef RT_SERIAL_USING_DMA + uart->dma_rx.last_index = 0; +#endif + if (HAL_UART_Init(&uart->handle) != HAL_OK) { return -RT_ERROR; @@ -172,11 +176,37 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar NVIC_DisableIRQ(uart->config->irq_type); /* disable interrupt */ __HAL_UART_DISABLE_IT(&(uart->handle), UART_IT_RXNE); + +#ifdef RT_SERIAL_USING_DMA + /* disable DMA */ + if (ctrl_arg == RT_DEVICE_FLAG_DMA_RX) + { + HAL_NVIC_DisableIRQ(uart->config->dma_rx->dma_irq); + if (HAL_DMA_Abort(&(uart->dma_rx.handle)) != HAL_OK) + { + RT_ASSERT(0); + } + + if (HAL_DMA_DeInit(&(uart->dma_rx.handle)) != HAL_OK) + { + RT_ASSERT(0); + } + } + else if(ctrl_arg == RT_DEVICE_FLAG_DMA_TX) + { + HAL_NVIC_DisableIRQ(uart->config->dma_tx->dma_irq); + if (HAL_DMA_DeInit(&(uart->dma_tx.handle)) != HAL_OK) + { + RT_ASSERT(0); + } + } +#endif break; /* enable interrupt */ case RT_DEVICE_CTRL_SET_INT: /* enable rx irq */ - NVIC_EnableIRQ(uart->config->irq_type); + HAL_NVIC_SetPriority(uart->config->irq_type, 1, 0); + HAL_NVIC_EnableIRQ(uart->config->irq_type); /* enable interrupt */ __HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_RXNE); break; @@ -186,6 +216,14 @@ static rt_err_t stm32_control(struct rt_serial_device *serial, int cmd, void *ar stm32_dma_config(serial, ctrl_arg); break; #endif + + case RT_DEVICE_CTRL_CLOSE: + if (HAL_UART_DeInit(&(uart->handle)) != HAL_OK ) + { + RT_ASSERT(0) + } + break; + } return RT_EOK; } @@ -233,13 +271,14 @@ static rt_size_t stm32_dma_transmit(struct rt_serial_device *serial, rt_uint8_t { struct stm32_uart *uart; RT_ASSERT(serial != RT_NULL); + RT_ASSERT(buf != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); - + if (size == 0) { return 0; } - + if (RT_SERIAL_DMA_TX == direction) { if (HAL_UART_Transmit_DMA(&uart->handle, buf, size) == HAL_OK) @@ -254,15 +293,6 @@ static rt_size_t stm32_dma_transmit(struct rt_serial_device *serial, rt_uint8_t return 0; } -static const struct rt_uart_ops stm32_uart_ops = -{ - .configure = stm32_configure, - .control = stm32_control, - .putc = stm32_putc, - .getc = stm32_getc, - .dma_transmit = stm32_dma_transmit -}; - /** * Uart common interrupt process. This need add to uart ISR. * @@ -301,16 +331,14 @@ static void uart_isr(struct rt_serial_device *serial) } __HAL_UART_CLEAR_IDLEFLAG(&uart->handle); } - else if (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) != RESET) + else if (__HAL_UART_GET_FLAG(&(uart->handle), UART_FLAG_TC) && + (__HAL_UART_GET_IT_SOURCE(&(uart->handle), UART_IT_TC) != RESET)) { if ((serial->parent.open_flag & RT_DEVICE_FLAG_DMA_TX) != 0) { HAL_UART_IRQHandler(&(uart->handle)); } - else - { - UART_INSTANCE_CLEAR_FUNCTION(&(uart->handle), UART_FLAG_TC); - } + UART_INSTANCE_CLEAR_FUNCTION(&(uart->handle), UART_FLAG_TC); } #endif else @@ -714,6 +742,93 @@ void LPUART1_DMA_RX_IRQHandler(void) #endif /* defined(RT_SERIAL_USING_DMA) && defined(BSP_LPUART1_RX_USING_DMA) */ #endif /* BSP_USING_LPUART1*/ +static void stm32_uart_get_dma_config(void) +{ +#ifdef BSP_USING_UART1 + uart_obj[UART1_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART1_RX_USING_DMA + uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart1_dma_rx = UART1_DMA_RX_CONFIG; + uart_config[UART1_INDEX].dma_rx = &uart1_dma_rx; +#endif +#ifdef BSP_UART1_TX_USING_DMA + uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart1_dma_tx = UART1_DMA_TX_CONFIG; + uart_config[UART1_INDEX].dma_tx = &uart1_dma_tx; +#endif +#endif + +#ifdef BSP_USING_UART2 + uart_obj[UART2_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART2_RX_USING_DMA + uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart2_dma_rx = UART2_DMA_RX_CONFIG; + uart_config[UART2_INDEX].dma_rx = &uart2_dma_rx; +#endif +#ifdef BSP_UART2_TX_USING_DMA + uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart2_dma_tx = UART2_DMA_TX_CONFIG; + uart_config[UART2_INDEX].dma_tx = &uart2_dma_tx; +#endif +#endif + +#ifdef BSP_USING_UART3 + uart_obj[UART3_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART3_RX_USING_DMA + uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart3_dma_rx = UART3_DMA_RX_CONFIG; + uart_config[UART3_INDEX].dma_rx = &uart3_dma_rx; +#endif +#ifdef BSP_UART3_TX_USING_DMA + uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart3_dma_tx = UART3_DMA_TX_CONFIG; + uart_config[UART3_INDEX].dma_tx = &uart3_dma_tx; +#endif +#endif + +#ifdef BSP_USING_UART4 + uart_obj[UART4_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART4_RX_USING_DMA + uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart4_dma_rx = UART4_DMA_RX_CONFIG; + uart_config[UART4_INDEX].dma_rx = &uart4_dma_rx; +#endif +#ifdef BSP_UART4_TX_USING_DMA + uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart4_dma_tx = UART4_DMA_TX_CONFIG; + uart_config[UART4_INDEX].dma_tx = &uart4_dma_tx; +#endif +#endif + +#ifdef BSP_USING_UART5 + uart_obj[UART5_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART5_RX_USING_DMA + uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart5_dma_rx = UART5_DMA_RX_CONFIG; + uart_config[UART5_INDEX].dma_rx = &uart5_dma_rx; +#endif +#ifdef BSP_UART5_TX_USING_DMA + uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart5_dma_tx = UART5_DMA_TX_CONFIG; + uart_config[UART5_INDEX].dma_tx = &uart5_dma_tx; +#endif +#endif + +#ifdef BSP_USING_UART6 + uart_obj[UART6_INDEX].uart_dma_flag = 0; +#ifdef BSP_UART6_RX_USING_DMA + uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; + static struct dma_config uart6_dma_rx = UART6_DMA_RX_CONFIG; + uart_config[UART6_INDEX].dma_rx = &uart6_dma_rx; +#endif +#ifdef BSP_UART6_TX_USING_DMA + uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; + static struct dma_config uart6_dma_tx = UART6_DMA_TX_CONFIG; + uart_config[UART6_INDEX].dma_tx = &uart6_dma_tx; +#endif +#endif +} + #ifdef RT_SERIAL_USING_DMA static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) { @@ -721,7 +836,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) DMA_HandleTypeDef *DMA_Handle; struct dma_config *dma_config; struct stm32_uart *uart; - + RT_ASSERT(serial != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); @@ -745,14 +860,17 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) SET_BIT(RCC->AHBENR, dma_config->dma_rcc); tmpreg = READ_BIT(RCC->AHBENR, dma_config->dma_rcc); #elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32L4) \ - || defined(SOC_SERIES_STM32G4) + || defined(SOC_SERIES_STM32G4)|| defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32WB) /* enable DMA clock && Delay after an RCC peripheral clock enabling*/ SET_BIT(RCC->AHB1ENR, dma_config->dma_rcc); tmpreg = READ_BIT(RCC->AHB1ENR, dma_config->dma_rcc); -#if (defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G4)) && defined(DMAMUX1) +#if (defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB)) && defined(DMAMUX1) /* enable DMAMUX clock for L4+ and G4 */ __HAL_RCC_DMAMUX1_CLK_ENABLE(); +#elif defined(SOC_SERIES_STM32MP1) + __HAL_RCC_DMAMUX_CLK_ENABLE(); + __HAL_RCC_DMA2_CLK_ENABLE(); #endif #endif @@ -773,7 +891,8 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) #elif defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) DMA_Handle->Instance = dma_config->Instance; DMA_Handle->Init.Channel = dma_config->channel; -#elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) +#elif defined(SOC_SERIES_STM32L4) || defined(SOC_SERIES_STM32G0) || defined(SOC_SERIES_STM32G4) || defined(SOC_SERIES_STM32WB)\ + || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) DMA_Handle->Instance = dma_config->Instance; DMA_Handle->Init.Request = dma_config->request; #endif @@ -781,7 +900,7 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) DMA_Handle->Init.MemInc = DMA_MINC_ENABLE; DMA_Handle->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; DMA_Handle->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; - + if (RT_DEVICE_FLAG_DMA_RX == flag) { DMA_Handle->Init.Direction = DMA_PERIPH_TO_MEMORY; @@ -792,9 +911,9 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) DMA_Handle->Init.Direction = DMA_MEMORY_TO_PERIPH; DMA_Handle->Init.Mode = DMA_NORMAL; } - + DMA_Handle->Init.Priority = DMA_PRIORITY_MEDIUM; -#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) +#if defined(SOC_SERIES_STM32F4) || defined(SOC_SERIES_STM32F7) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32MP1) DMA_Handle->Init.FIFOMode = DMA_FIFOMODE_DISABLE; #endif if (HAL_DMA_DeInit(DMA_Handle) != HAL_OK) @@ -820,8 +939,8 @@ static void stm32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag) CLEAR_BIT(uart->handle.Instance->CR3, USART_CR3_EIE); __HAL_UART_ENABLE_IT(&(uart->handle), UART_IT_IDLE); } - - /* enable irq */ + + /* DMA irq should set in DMA TX mode, or HAL_UART_TxCpltCallback function will not be called */ HAL_NVIC_SetPriority(dma_config->dma_irq, 0, 0); HAL_NVIC_EnableIRQ(dma_config->dma_irq); @@ -865,7 +984,7 @@ void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) /** * @brief Rx Half transfer completed callback * @param huart: UART handle - * @note This example shows a simple way to report end of DMA Rx Half transfer, + * @note This example shows a simple way to report end of DMA Rx Half transfer, * and you can add your own implementation. * @retval None */ @@ -876,101 +995,50 @@ void HAL_UART_RxHalfCpltCallback(UART_HandleTypeDef *huart) uart = (struct stm32_uart *)huart; dma_isr(&uart->serial); } + +static void _dma_tx_complete(struct rt_serial_device *serial) +{ + struct stm32_uart *uart; + rt_size_t trans_total_index; + rt_base_t level; + + RT_ASSERT(serial != RT_NULL); + uart = rt_container_of(serial, struct stm32_uart, serial); + + level = rt_hw_interrupt_disable(); + trans_total_index = __HAL_DMA_GET_COUNTER(&(uart->dma_tx.handle)); + rt_hw_interrupt_enable(level); + + if (trans_total_index == 0) + { + rt_hw_serial_isr(serial, RT_SERIAL_EVENT_TX_DMADONE); + } +} + +/** + * @brief HAL_UART_TxCpltCallback + * @param huart: UART handle + * @note This callback can be called by two functions, first in UART_EndTransmit_IT when + * UART Tx complete and second in UART_DMATransmitCplt function in DMA Circular mode. + * @retval None + */ void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) { struct stm32_uart *uart; RT_ASSERT(huart != NULL); uart = (struct stm32_uart *)huart; - rt_hw_serial_isr(&uart->serial, RT_SERIAL_EVENT_TX_DMADONE); + _dma_tx_complete(&uart->serial); } #endif /* RT_SERIAL_USING_DMA */ -static void stm32_uart_get_dma_config(void) +static const struct rt_uart_ops stm32_uart_ops = { -#ifdef BSP_USING_UART1 - uart_obj[UART1_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART1_RX_USING_DMA - uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart1_dma_rx = UART1_DMA_RX_CONFIG; - uart_config[UART1_INDEX].dma_rx = &uart1_dma_rx; -#endif -#ifdef BSP_UART1_TX_USING_DMA - uart_obj[UART1_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart1_dma_tx = UART1_DMA_TX_CONFIG; - uart_config[UART1_INDEX].dma_tx = &uart1_dma_tx; -#endif -#endif - -#ifdef BSP_USING_UART2 - uart_obj[UART2_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART2_RX_USING_DMA - uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart2_dma_rx = UART2_DMA_RX_CONFIG; - uart_config[UART2_INDEX].dma_rx = &uart2_dma_rx; -#endif -#ifdef BSP_UART2_TX_USING_DMA - uart_obj[UART2_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart2_dma_tx = UART2_DMA_TX_CONFIG; - uart_config[UART2_INDEX].dma_tx = &uart2_dma_tx; -#endif -#endif - -#ifdef BSP_USING_UART3 - uart_obj[UART3_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART3_RX_USING_DMA - uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart3_dma_rx = UART3_DMA_RX_CONFIG; - uart_config[UART3_INDEX].dma_rx = &uart3_dma_rx; -#endif -#ifdef BSP_UART3_TX_USING_DMA - uart_obj[UART3_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart3_dma_tx = UART3_DMA_TX_CONFIG; - uart_config[UART3_INDEX].dma_tx = &uart3_dma_tx; -#endif -#endif - -#ifdef BSP_USING_UART4 - uart_obj[UART4_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART4_RX_USING_DMA - uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart4_dma_rx = UART4_DMA_RX_CONFIG; - uart_config[UART4_INDEX].dma_rx = &uart4_dma_rx; -#endif -#ifdef BSP_UART4_TX_USING_DMA - uart_obj[UART4_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart4_dma_tx = UART4_DMA_TX_CONFIG; - uart_config[UART4_INDEX].dma_tx = &uart4_dma_tx; -#endif -#endif - -#ifdef BSP_USING_UART5 - uart_obj[UART5_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART5_RX_USING_DMA - uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart5_dma_rx = UART5_DMA_RX_CONFIG; - uart_config[UART5_INDEX].dma_rx = &uart5_dma_rx; -#endif -#ifdef BSP_UART5_TX_USING_DMA - uart_obj[UART5_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart5_dma_tx = UART5_DMA_TX_CONFIG; - uart_config[UART5_INDEX].dma_tx = &uart5_dma_tx; -#endif -#endif - -#ifdef BSP_USING_UART6 - uart_obj[UART6_INDEX].uart_dma_flag = 0; -#ifdef BSP_UART6_RX_USING_DMA - uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_RX; - static struct dma_config uart6_dma_rx = UART6_DMA_RX_CONFIG; - uart_config[UART6_INDEX].dma_rx = &uart6_dma_rx; -#endif -#ifdef BSP_UART6_TX_USING_DMA - uart_obj[UART6_INDEX].uart_dma_flag |= RT_DEVICE_FLAG_DMA_TX; - static struct dma_config uart6_dma_tx = UART6_DMA_TX_CONFIG; - uart_config[UART6_INDEX].dma_tx = &uart6_dma_tx; -#endif -#endif -} + .configure = stm32_configure, + .control = stm32_control, + .putc = stm32_putc, + .getc = stm32_getc, + .dma_transmit = stm32_dma_transmit +}; int rt_hw_usart_init(void) { diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usart.h b/bsp/stm32/libraries/HAL_Drivers/drv_usart.h index f8b0703a3..2f6b37217 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usart.h +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usart.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018.10.30 SummerGift first version - * 2019.03.05 whj4674672 add stm32h7 + * 2019.03.05 whj4674672 add stm32h7 */ #ifndef __DRV_USART_H__ @@ -50,7 +50,7 @@ struct stm32_uart { UART_HandleTypeDef handle; struct stm32_uart_config *config; - + #ifdef RT_SERIAL_USING_DMA struct { diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c index 19e8d7f3d..4f8f08fef 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_usbd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c b/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c index dad7db9be..01319fb22 100644 --- a/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c +++ b/bsp/stm32/libraries/HAL_Drivers/drv_wdt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,12 +18,12 @@ struct stm32_wdt_obj { + rt_watchdog_t watchdog; IWDG_HandleTypeDef hiwdg; rt_uint16_t is_start; }; static struct stm32_wdt_obj stm32_wdt; static struct rt_watchdog_ops ops; -static rt_watchdog_t watchdog; static rt_err_t wdt_init(rt_watchdog_t *wdt) { @@ -116,9 +116,9 @@ int rt_wdt_init(void) ops.init = &wdt_init; ops.control = &wdt_control; - watchdog.ops = &ops; + stm32_wdt.watchdog.ops = &ops; /* register watchdog device */ - if (rt_hw_watchdog_register(&watchdog, "wdt", RT_DEVICE_FLAG_DEACTIVATE, RT_NULL) != RT_EOK) + if (rt_hw_watchdog_register(&stm32_wdt.watchdog, "wdt", RT_DEVICE_FLAG_DEACTIVATE, RT_NULL) != RT_EOK) { LOG_E("wdt device register failed."); return -RT_ERROR; diff --git a/bsp/stm32/libraries/Kconfig b/bsp/stm32/libraries/Kconfig index 12d9c7f35..b46fbf027 100644 --- a/bsp/stm32/libraries/Kconfig +++ b/bsp/stm32/libraries/Kconfig @@ -30,7 +30,12 @@ config SOC_SERIES_STM32L0 bool select ARCH_ARM_CORTEX_M0 select SOC_FAMILY_STM32 - + +config SOC_SERIES_STM32L1 + bool + select ARCH_ARM_CORTEX_M3 + select SOC_FAMILY_STM32 + config SOC_SERIES_STM32L4 bool select ARCH_ARM_CORTEX_M4 diff --git a/bsp/stm32/libraries/STM32F0xx_HAL/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h b/bsp/stm32/libraries/STM32F0xx_HAL/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h index f09577117..e9747eead 100644 --- a/bsp/stm32/libraries/STM32F0xx_HAL/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h +++ b/bsp/stm32/libraries/STM32F0xx_HAL/STM32F0xx_HAL_Driver/Inc/stm32f0xx_hal.h @@ -44,7 +44,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_hal_conf.h" -#include /** @addtogroup STM32F0xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32F1xx_HAL/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h b/bsp/stm32/libraries/STM32F1xx_HAL/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h index 32f2dd4a7..ba2f673e8 100644 --- a/bsp/stm32/libraries/STM32F1xx_HAL/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h +++ b/bsp/stm32/libraries/STM32F1xx_HAL/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal.h @@ -28,7 +28,6 @@ extern "C" { /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal_conf.h" -#include /** @addtogroup STM32F1xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32F2xx_HAL/STM32F2xx_HAL_Driver/Inc/stm32f2xx_hal.h b/bsp/stm32/libraries/STM32F2xx_HAL/STM32F2xx_HAL_Driver/Inc/stm32f2xx_hal.h index 345d1305b..1fa049d31 100644 --- a/bsp/stm32/libraries/STM32F2xx_HAL/STM32F2xx_HAL_Driver/Inc/stm32f2xx_hal.h +++ b/bsp/stm32/libraries/STM32F2xx_HAL/STM32F2xx_HAL_Driver/Inc/stm32f2xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f2xx_hal_conf.h" -#include /** @addtogroup STM32F2xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h b/bsp/stm32/libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h index a8af863dd..5b800df7d 100644 --- a/bsp/stm32/libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h +++ b/bsp/stm32/libraries/STM32F4xx_HAL/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f4xx_hal_conf.h" -#include /** @addtogroup STM32F4xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32F7xx_HAL/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h b/bsp/stm32/libraries/STM32F7xx_HAL/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h index 9f81701a6..4df6fe312 100644 --- a/bsp/stm32/libraries/STM32F7xx_HAL/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h +++ b/bsp/stm32/libraries/STM32F7xx_HAL/STM32F7xx_HAL_Driver/Inc/stm32f7xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32f7xx_hal_conf.h" -#include /** @addtogroup STM32F7xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32G0xx_HAL/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h b/bsp/stm32/libraries/STM32G0xx_HAL/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h index 499a9d2c5..e7e964dfa 100644 --- a/bsp/stm32/libraries/STM32G0xx_HAL/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h +++ b/bsp/stm32/libraries/STM32G0xx_HAL/STM32G0xx_HAL_Driver/Inc/stm32g0xx_hal.h @@ -28,7 +28,6 @@ extern "C" { /* Includes ------------------------------------------------------------------*/ #include "stm32g0xx_hal_conf.h" -#include /** @addtogroup STM32G0xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g431xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g431xx.s index be5cc3fc2..895acc38c 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g431xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g431xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g441xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g441xx.s index dc621f9ad..cc8cb00ce 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g441xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g441xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g471xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g471xx.s index 918ebee87..3924adbc0 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g471xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g471xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g473xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g473xx.s index 3b10aeb6e..86e0db30e 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g473xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g473xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g474xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g474xx.s index 2b39625b6..8a418820c 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g474xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g474xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g483xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g483xx.s index 15e3ca132..c6c52988d 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g483xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g483xx.s @@ -79,7 +79,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -97,9 +97,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g484xx.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g484xx.s index be0640457..42d8b4c3a 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g484xx.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32g484xx.s @@ -78,7 +78,7 @@ LoopCopyDataInit: adds r4, r0, r3 cmp r4, r1 bcc CopyDataInit - + /* Zero fill the bss segment. */ ldr r2, =_sbss ldr r4, =_ebss @@ -96,9 +96,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32gbk1cb.s b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32gbk1cb.s index f302f4273..ae2df5a66 100644 --- a/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32gbk1cb.s +++ b/bsp/stm32/libraries/STM32G4xx_HAL/CMSIS/Device/ST/STM32G4xx/Source/Templates/gcc/startup_stm32gbk1cb.s @@ -93,9 +93,9 @@ LoopFillZerobss: /* Call the clock system intitialization function.*/ bl SystemInit /* Call static constructors */ - bl __libc_init_array +/* bl __libc_init_array */ /* Call the application's entry point.*/ - bl main + bl entry LoopForever: b LoopForever diff --git a/bsp/stm32/libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h b/bsp/stm32/libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h index 015519510..094f7bfe8 100644 --- a/bsp/stm32/libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h +++ b/bsp/stm32/libraries/STM32H7xx_HAL/STM32H7xx_HAL_Driver/Inc/stm32h7xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32h7xx_hal_conf.h" -#include /** @addtogroup STM32H7xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h index 9e8ea13b5..13d3923cb 100644 --- a/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h +++ b/bsp/stm32/libraries/STM32L0xx_HAL/STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32l0xx_hal_conf.h" -#include /** @addtogroup STM32L0xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h b/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h index 84d6d9c9b..9643b494d 100644 --- a/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h +++ b/bsp/stm32/libraries/STM32L4xx_HAL/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h @@ -28,7 +28,6 @@ /* Includes ------------------------------------------------------------------*/ #include "stm32l4xx_hal_conf.h" -#include /** @addtogroup STM32L4xx_HAL_Driver * @{ diff --git a/bsp/stm32/libraries/templates/stm32f0xx/applications/main.c b/bsp/stm32/libraries/templates/stm32f0xx/applications/main.c index 68a938bbe..79ae25a18 100644 --- a/bsp/stm32/libraries/templates/stm32f0xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f0xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f0xx/board/board.c b/bsp/stm32/libraries/templates/stm32f0xx/board/board.c index 9115460e7..8a6b2d18f 100644 --- a/bsp/stm32/libraries/templates/stm32f0xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f0xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-12-21 zylx first version */ - + #include "board.h" void SystemClock_Config(void) @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1; diff --git a/bsp/stm32/libraries/templates/stm32f0xx/board/board.h b/bsp/stm32/libraries/templates/stm32f0xx/board/board.h index fbc2af5eb..7559754ae 100644 --- a/bsp/stm32/libraries/templates/stm32f0xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f0xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f0xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32f0xx/rtconfig.h index acb44c265..14472b017 100644 --- a/bsp/stm32/libraries/templates/stm32f0xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32f0xx/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M0 diff --git a/bsp/stm32/libraries/templates/stm32f10x/applications/main.c b/bsp/stm32/libraries/templates/stm32f10x/applications/main.c index 487ddf44f..6d19a46ed 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f10x/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f10x/board/board.c b/bsp/stm32/libraries/templates/stm32f10x/board/board.c index 9f1ba0dda..849343940 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f10x/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/libraries/templates/stm32f10x/board/board.h b/bsp/stm32/libraries/templates/stm32f10x/board/board.h index fc435ee02..1be364929 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f10x/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f10x/rtconfig.h b/bsp/stm32/libraries/templates/stm32f10x/rtconfig.h index 28b67df11..a1e38c6cc 100644 --- a/bsp/stm32/libraries/templates/stm32f10x/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32f10x/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M3 diff --git a/bsp/stm32/libraries/templates/stm32f2xx/applications/main.c b/bsp/stm32/libraries/templates/stm32f2xx/applications/main.c index 487ddf44f..6d19a46ed 100644 --- a/bsp/stm32/libraries/templates/stm32f2xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f2xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f2xx/board/board.c b/bsp/stm32/libraries/templates/stm32f2xx/board/board.c index 91fd90722..00cc73299 100644 --- a/bsp/stm32/libraries/templates/stm32f2xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f2xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -29,7 +29,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/libraries/templates/stm32f2xx/board/board.h b/bsp/stm32/libraries/templates/stm32f2xx/board/board.h index b93a301f4..34b46a390 100644 --- a/bsp/stm32/libraries/templates/stm32f2xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f2xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f2xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32f2xx/rtconfig.h index b3da386b5..d6e2d392f 100644 --- a/bsp/stm32/libraries/templates/stm32f2xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32f2xx/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M3 diff --git a/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c b/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c index 487ddf44f..6d19a46ed 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f4xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f4xx/board/board.c b/bsp/stm32/libraries/templates/stm32f4xx/board/board.c index ef1f24cbb..190ca080c 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f4xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,11 +15,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -33,7 +33,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h index 514155b82..f68ddcac3 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f4xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f4xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32f4xx/rtconfig.h index 7d83eb4f9..559ec62b8 100644 --- a/bsp/stm32/libraries/templates/stm32f4xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32f4xx/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M4 diff --git a/bsp/stm32/libraries/templates/stm32f7xx/applications/main.c b/bsp/stm32/libraries/templates/stm32f7xx/applications/main.c index 5a4bbf9f4..881793e67 100644 --- a/bsp/stm32/libraries/templates/stm32f7xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32f7xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f7xx/board/board.c b/bsp/stm32/libraries/templates/stm32f7xx/board/board.c index 4194e6db1..72d9f50fa 100644 --- a/bsp/stm32/libraries/templates/stm32f7xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32f7xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -34,13 +34,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/libraries/templates/stm32f7xx/board/board.h b/bsp/stm32/libraries/templates/stm32f7xx/board/board.h index 295123567..7d4c7c4ba 100644 --- a/bsp/stm32/libraries/templates/stm32f7xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32f7xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32f7xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32f7xx/rtconfig.h index f6ccc5501..4f9eed53b 100644 --- a/bsp/stm32/libraries/templates/stm32f7xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32f7xx/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M7 diff --git a/bsp/stm32/libraries/templates/stm32h7xx/applications/main.c b/bsp/stm32/libraries/templates/stm32h7xx/applications/main.c index 19a43a12e..376d3c78f 100644 --- a/bsp/stm32/libraries/templates/stm32h7xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32h7xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,9 +18,9 @@ int main(void) { int count = 1; - /* set LED0 pin mode to output */ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { rt_pin_write(LED0_PIN, PIN_HIGH); diff --git a/bsp/stm32/libraries/templates/stm32h7xx/board/board.c b/bsp/stm32/libraries/templates/stm32h7xx/board/board.c index 2e4fab6c8..6b975ea95 100644 --- a/bsp/stm32/libraries/templates/stm32h7xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32h7xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,18 +16,18 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Supply configuration update enable + /**Supply configuration update enable */ MODIFY_REG(PWR->CR3, PWR_CR3_SCUEN, 0); - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) + while ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) { - + } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -45,7 +45,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 diff --git a/bsp/stm32/libraries/templates/stm32h7xx/board/board.h b/bsp/stm32/libraries/templates/stm32h7xx/board/board.h index 72d84ff29..32eb25f14 100644 --- a/bsp/stm32/libraries/templates/stm32h7xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32h7xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32h7xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32h7xx/rtconfig.h index b807cc2f6..2c7b7eaa6 100644 --- a/bsp/stm32/libraries/templates/stm32h7xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32h7xx/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40001 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M7 diff --git a/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c b/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c index 487ddf44f..6d19a46ed 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c +++ b/bsp/stm32/libraries/templates/stm32l4xx/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32l4xx/board/board.c b/bsp/stm32/libraries/templates/stm32l4xx/board/board.c index 7797c2337..bc32bedd1 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/board/board.c +++ b/bsp/stm32/libraries/templates/stm32l4xx/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -31,7 +31,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -50,7 +50,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { diff --git a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h index b5120ac47..a8e6ad850 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/board/board.h +++ b/bsp/stm32/libraries/templates/stm32l4xx/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/libraries/templates/stm32l4xx/rtconfig.h b/bsp/stm32/libraries/templates/stm32l4xx/rtconfig.h index 649d49023..23191c90e 100644 --- a/bsp/stm32/libraries/templates/stm32l4xx/rtconfig.h +++ b/bsp/stm32/libraries/templates/stm32l4xx/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x40000 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M4 diff --git a/bsp/stm32/stm32f072-st-nucleo/applications/main.c b/bsp/stm32/stm32f072-st-nucleo/applications/main.c index 81b03091e..486ed6128 100644 --- a/bsp/stm32/stm32f072-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f072-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f072-st-nucleo/board/board.c b/bsp/stm32/stm32f072-st-nucleo/board/board.c index 8adbcd7bd..5f06e3253 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f072-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-12-21 zylx first version */ - + #include "board.h" void SystemClock_Config(void) @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48; RCC_OscInitStruct.HSI48State = RCC_HSI48_ON; @@ -25,7 +25,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1; diff --git a/bsp/stm32/stm32f072-st-nucleo/board/board.h b/bsp/stm32/stm32f072-st-nucleo/board/board.h index bfd037104..51a9f80ed 100644 --- a/bsp/stm32/stm32f072-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f072-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f072-st-nucleo/rtconfig.h b/bsp/stm32/stm32f072-st-nucleo/rtconfig.h index 309b2ec20..e04103a5d 100644 --- a/bsp/stm32/stm32f072-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f072-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M0 diff --git a/bsp/stm32/stm32f091-st-nucleo/applications/main.c b/bsp/stm32/stm32f091-st-nucleo/applications/main.c index 421f897bc..9783d01e5 100644 --- a/bsp/stm32/stm32f091-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f091-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f091-st-nucleo/board/board.c b/bsp/stm32/stm32f091-st-nucleo/board/board.c index db5c101a9..ec74fe9af 100644 --- a/bsp/stm32/stm32f091-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f091-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-12-21 zylx first version */ - + #include "board.h" void SystemClock_Config(void) @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Configure LSE Drive Capability + /**Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_HIGH); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI14 |RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_LSE; @@ -38,7 +38,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1; diff --git a/bsp/stm32/stm32f091-st-nucleo/board/board.h b/bsp/stm32/stm32f091-st-nucleo/board/board.h index 7a7813647..a9ba91377 100644 --- a/bsp/stm32/stm32f091-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f091-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f091-st-nucleo/board/ports/fal_cfg.h b/bsp/stm32/stm32f091-st-nucleo/board/ports/fal_cfg.h index 78bf24d25..b9964e015 100644 --- a/bsp/stm32/stm32f091-st-nucleo/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f091-st-nucleo/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f091-st-nucleo/rtconfig.h b/bsp/stm32/stm32f091-st-nucleo/rtconfig.h index 513fc6963..a3b0e27ab 100644 --- a/bsp/stm32/stm32f091-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f091-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M0 diff --git a/bsp/stm32/stm32f103-atk-nano/applications/main.c b/bsp/stm32/stm32f103-atk-nano/applications/main.c index 6d75fd13c..be493624c 100644 --- a/bsp/stm32/stm32f103-atk-nano/applications/main.c +++ b/bsp/stm32/stm32f103-atk-nano/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-nano/board/board.c b/bsp/stm32/stm32f103-atk-nano/board/board.c index bb35832bf..de585efe3 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/board.c +++ b/bsp/stm32/stm32f103-atk-nano/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 balanceTWK first version */ - + #include "board.h" void SystemClock_Config(void) @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -32,7 +32,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-atk-nano/board/board.h b/bsp/stm32/stm32f103-atk-nano/board/board.h index a33ef3cd5..498459073 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/board.h +++ b/bsp/stm32/stm32f103-atk-nano/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-nano/board/ports/fal_cfg.h b/bsp/stm32/stm32f103-atk-nano/board/ports/fal_cfg.h index 0ca9acb3e..3eb4fd7c0 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f103-atk-nano/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c index 43f726525..789248943 100644 --- a/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-atk-nano/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-nano/rtconfig.h b/bsp/stm32/stm32f103-atk-nano/rtconfig.h index fc5e6f56d..b29bfe6dc 100644 --- a/bsp/stm32/stm32f103-atk-nano/rtconfig.h +++ b/bsp/stm32/stm32f103-atk-nano/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-atk-warshipv3/applications/main.c b/bsp/stm32/stm32f103-atk-warshipv3/applications/main.c index ab323bcb8..df0457fad 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/applications/main.c +++ b/bsp/stm32/stm32f103-atk-warshipv3/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/board.c b/bsp/stm32/stm32f103-atk-warshipv3/board/board.c index 17bfd29f2..2dc4c9cab 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/board.c +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-atk-warshipv3/board/board.h b/bsp/stm32/stm32f103-atk-warshipv3/board/board.h index 68ac34f5f..80c80984b 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/board/board.h +++ b/bsp/stm32/stm32f103-atk-warshipv3/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h index d4f8e7ce3..8cf8b1ed7 100644 --- a/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h +++ b/bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-dofly-M3S/applications/main.c b/bsp/stm32/stm32f103-dofly-M3S/applications/main.c index 7b7f00c8e..0ec493066 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/applications/main.c +++ b/bsp/stm32/stm32f103-dofly-M3S/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c b/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c index 038725b78..695510d1a 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c +++ b/bsp/stm32/stm32f103-dofly-M3S/applications/nrf24l01_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/board.c b/bsp/stm32/stm32f103-dofly-M3S/board/board.c index 7b6a3ea94..d32a5096b 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/board.c +++ b/bsp/stm32/stm32f103-dofly-M3S/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-11-06 SummerGift first version * 2019-04-09 WillianChan add stm32f103-dofly-M3S BSP */ - + #include "board.h" void SystemClock_Config(void) @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -29,7 +29,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/board.h b/bsp/stm32/stm32f103-dofly-M3S/board/board.h index 62f903042..8662bff0f 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/board.h +++ b/bsp/stm32/stm32f103-dofly-M3S/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c b/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c index 5ffa50ba1..13d235b69 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c +++ b/bsp/stm32/stm32f103-dofly-M3S/board/ports/drv_sdcard.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/ports/fal_cfg.h b/bsp/stm32/stm32f103-dofly-M3S/board/ports/fal_cfg.h index 5f83366ea..0f0183422 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f103-dofly-M3S/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c index 060c6d59b..e22efac3c 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-dofly-M3S/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-M3S/rtconfig.h b/bsp/stm32/stm32f103-dofly-M3S/rtconfig.h index 74ebb6373..1e8a0b466 100644 --- a/bsp/stm32/stm32f103-dofly-M3S/rtconfig.h +++ b/bsp/stm32/stm32f103-dofly-M3S/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-dofly-lyc8/applications/main.c b/bsp/stm32/stm32f103-dofly-lyc8/applications/main.c index 18dbaac95..dc4e9cbb7 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/applications/main.c +++ b/bsp/stm32/stm32f103-dofly-lyc8/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/board.c b/bsp/stm32/stm32f103-dofly-lyc8/board/board.c index 9f1ba0dda..849343940 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/board.c +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-dofly-lyc8/board/board.h b/bsp/stm32/stm32f103-dofly-lyc8/board/board.h index ae6f2c67e..8d8cc4643 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/board/board.h +++ b/bsp/stm32/stm32f103-dofly-lyc8/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h index 85d63532a..9f2c9dd1b 100644 --- a/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h +++ b/bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c b/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c index 5f0f0db8e..7ddaa5ee9 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-5 SummerGift first version */ - + #include #include #include diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/board.c b/bsp/stm32/stm32f103-fire-arbitrary/board/board.c index 080a22ff4..abbc74be3 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/board.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 balanceTWK first version */ - + #include #include "board.h" @@ -17,7 +17,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -33,7 +33,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h index 968ac8e2e..7aa3c0f70 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/board.h +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/fal_cfg.h b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/fal_cfg.h index 5f83366ea..0f0183422 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/sdcard_port.c b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/sdcard_port.c index bf5f3e10a..55baa2c26 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c index 96b2034f2..519080ae0 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c index 68348d2ba..378d8f827 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c +++ b/bsp/stm32/stm32f103-fire-arbitrary/board/ports/w5500_device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h index 61e88f612..72da8edeb 100644 --- a/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h +++ b/bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-gizwits-gokitv21/applications/main.c b/bsp/stm32/stm32f103-gizwits-gokitv21/applications/main.c index 70f60f3f8..bf9e60aae 100644 --- a/bsp/stm32/stm32f103-gizwits-gokitv21/applications/main.c +++ b/bsp/stm32/stm32f103-gizwits-gokitv21/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.c b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.c index 66a0c7f73..55faf0d89 100644 --- a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.c +++ b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" /** @@ -19,7 +19,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -32,7 +32,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h index 7f0ae67d4..cdb13091c 100644 --- a/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h +++ b/bsp/stm32/stm32f103-gizwits-gokitv21/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-gizwits-gokitv21/rtconfig.h b/bsp/stm32/stm32f103-gizwits-gokitv21/rtconfig.h index ed7973ad0..508274464 100644 --- a/bsp/stm32/stm32f103-gizwits-gokitv21/rtconfig.h +++ b/bsp/stm32/stm32f103-gizwits-gokitv21/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-hw100k-ibox/applications/main.c b/bsp/stm32/stm32f103-hw100k-ibox/applications/main.c index d0ab2cc6e..096b4df40 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/applications/main.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/board.c b/bsp/stm32/stm32f103-hw100k-ibox/board/board.c index 0598b6af0..779d73198 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/board.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -32,7 +32,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/board.h b/bsp/stm32/stm32f103-hw100k-ibox/board/board.h index fe3ea19e7..239f0afdd 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/board.h +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/esp02_device.c b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/esp02_device.c index 0de060a35..f18b6318b 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/esp02_device.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/esp02_device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -21,6 +21,6 @@ int esp_02_device_init() rt_pin_write(ESP8266_CH_PD_Pin,PIN_HIGH) ; rt_pin_write(ESP8266_RST,PIN_HIGH) ; - return RT_EOK ; + return RT_EOK ; } INIT_DEVICE_EXPORT(esp_02_device_init); diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h index 5f83366ea..0f0183422 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c index be8978c63..ae0660b29 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/on_chip_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c index a0174bbb0..59d139a8a 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c +++ b/bsp/stm32/stm32f103-hw100k-ibox/board/ports/w5500_device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.h b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.h index 9783d4c2e..7daf94d5d 100644 --- a/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.h +++ b/bsp/stm32/stm32f103-hw100k-ibox/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-mini-system/applications/main.c b/bsp/stm32/stm32f103-mini-system/applications/main.c index c5fa5a595..8c68b17b8 100644 --- a/bsp/stm32/stm32f103-mini-system/applications/main.c +++ b/bsp/stm32/stm32f103-mini-system/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-mini-system/board/board.c b/bsp/stm32/stm32f103-mini-system/board/board.c index b7ca2b846..0b7edacbd 100644 --- a/bsp/stm32/stm32f103-mini-system/board/board.c +++ b/bsp/stm32/stm32f103-mini-system/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2019-03-08 obito0 first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-mini-system/board/board.h b/bsp/stm32/stm32f103-mini-system/board/board.h index 7f0ae67d4..cdb13091c 100644 --- a/bsp/stm32/stm32f103-mini-system/board/board.h +++ b/bsp/stm32/stm32f103-mini-system/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-mini-system/rtconfig.h b/bsp/stm32/stm32f103-mini-system/rtconfig.h index 84ff242e5..80724bb79 100644 --- a/bsp/stm32/stm32f103-mini-system/rtconfig.h +++ b/bsp/stm32/stm32f103-mini-system/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f103-yf-ufun/applications/main.c b/bsp/stm32/stm32f103-yf-ufun/applications/main.c index 737c362b2..ffe4955e1 100644 --- a/bsp/stm32/stm32f103-yf-ufun/applications/main.c +++ b/bsp/stm32/stm32f103-yf-ufun/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-yf-ufun/board/board.c b/bsp/stm32/stm32f103-yf-ufun/board/board.c index 4df20fbd4..5271b59c7 100644 --- a/bsp/stm32/stm32f103-yf-ufun/board/board.c +++ b/bsp/stm32/stm32f103-yf-ufun/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-06 SummerGift first version */ - + #include "board.h" void SystemClock_Config(void) @@ -15,7 +15,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -28,7 +28,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f103-yf-ufun/board/board.h b/bsp/stm32/stm32f103-yf-ufun/board/board.h index 8c0aa1d76..738f37080 100644 --- a/bsp/stm32/stm32f103-yf-ufun/board/board.h +++ b/bsp/stm32/stm32f103-yf-ufun/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f103-yf-ufun/rtconfig.h b/bsp/stm32/stm32f103-yf-ufun/rtconfig.h index b9c9fed8f..49685b7fb 100644 --- a/bsp/stm32/stm32f103-yf-ufun/rtconfig.h +++ b/bsp/stm32/stm32f103-yf-ufun/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f107-uc-eval/applications/main.c b/bsp/stm32/stm32f107-uc-eval/applications/main.c index 11587e49d..9dca242b1 100644 --- a/bsp/stm32/stm32f107-uc-eval/applications/main.c +++ b/bsp/stm32/stm32f107-uc-eval/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f107-uc-eval/board/board.c b/bsp/stm32/stm32f107-uc-eval/board/board.c index a63b07016..f053579c2 100644 --- a/bsp/stm32/stm32f107-uc-eval/board/board.c +++ b/bsp/stm32/stm32f107-uc-eval/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f107-uc-eval/board/board.h b/bsp/stm32/stm32f107-uc-eval/board/board.h index 98df6d51f..44a96208c 100644 --- a/bsp/stm32/stm32f107-uc-eval/board/board.h +++ b/bsp/stm32/stm32f107-uc-eval/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f107-uc-eval/rtconfig.h b/bsp/stm32/stm32f107-uc-eval/rtconfig.h index 1f17f7c40..c48c565e5 100644 --- a/bsp/stm32/stm32f107-uc-eval/rtconfig.h +++ b/bsp/stm32/stm32f107-uc-eval/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f401-st-nucleo/applications/main.c b/bsp/stm32/stm32f401-st-nucleo/applications/main.c index 86c4508d1..48009f1c7 100644 --- a/bsp/stm32/stm32f401-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f401-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f401-st-nucleo/board/board.c b/bsp/stm32/stm32f401-st-nucleo/board/board.c index 942d080c5..9c33cdbba 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f401-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,11 +15,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -34,7 +34,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f401-st-nucleo/board/board.h b/bsp/stm32/stm32f401-st-nucleo/board/board.h index 4c6f84d17..82647a83a 100644 --- a/bsp/stm32/stm32f401-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f401-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f401-st-nucleo/rtconfig.h b/bsp/stm32/stm32f401-st-nucleo/rtconfig.h index b5b8cc523..923a665a7 100644 --- a/bsp/stm32/stm32f401-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f401-st-nucleo/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/applications/main.c b/bsp/stm32/stm32f405-smdz-breadfruit/applications/main.c index 453681a90..47358c8a6 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/applications/main.c +++ b/bsp/stm32/stm32f405-smdz-breadfruit/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.c b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.c index ef1f24cbb..190ca080c 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.c +++ b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,11 +15,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -33,7 +33,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h index 5b30f605d..844f5e35e 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h +++ b/bsp/stm32/stm32f405-smdz-breadfruit/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.h b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.h index 9a961bb1b..e403f6400 100644 --- a/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.h +++ b/bsp/stm32/stm32f405-smdz-breadfruit/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f407-atk-explorer/applications/main.c b/bsp/stm32/stm32f407-atk-explorer/applications/main.c index e3ae33205..2fc9307ca 100644 --- a/bsp/stm32/stm32f407-atk-explorer/applications/main.c +++ b/bsp/stm32/stm32f407-atk-explorer/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.c b/bsp/stm32/stm32f407-atk-explorer/board/board.c index c2c90a5e8..02a3a3d53 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -37,7 +37,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f407-atk-explorer/board/board.h b/bsp/stm32/stm32f407-atk-explorer/board/board.h index 70a4c0ed1..6d80e38f7 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/board.h +++ b/bsp/stm32/stm32f407-atk-explorer/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h index a587e207c..995136cd5 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/phy_reset.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/phy_reset.c index 838216ffa..ec5c61f1b 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/sdcard_port.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/sdcard_port.c index 0a9c36fd4..bc7e8b676 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c index 4705cc011..b92344fa4 100644 --- a/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f407-atk-explorer/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-atk-explorer/rtconfig.h b/bsp/stm32/stm32f407-atk-explorer/rtconfig.h index bfb52698c..818d24999 100644 --- a/bsp/stm32/stm32f407-atk-explorer/rtconfig.h +++ b/bsp/stm32/stm32f407-atk-explorer/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f407-st-discovery/applications/main.c b/bsp/stm32/stm32f407-st-discovery/applications/main.c index c7ffc240c..2651a7507 100644 --- a/bsp/stm32/stm32f407-st-discovery/applications/main.c +++ b/bsp/stm32/stm32f407-st-discovery/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-st-discovery/board/board.c b/bsp/stm32/stm32f407-st-discovery/board/board.c index 8a3dbd993..5fff5426f 100644 --- a/bsp/stm32/stm32f407-st-discovery/board/board.c +++ b/bsp/stm32/stm32f407-st-discovery/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,11 +15,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -33,7 +33,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f407-st-discovery/board/board.h b/bsp/stm32/stm32f407-st-discovery/board/board.h index 7ba6c79de..539e3abf4 100644 --- a/bsp/stm32/stm32f407-st-discovery/board/board.h +++ b/bsp/stm32/stm32f407-st-discovery/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f407-st-discovery/rtconfig.h b/bsp/stm32/stm32f407-st-discovery/rtconfig.h index a9c710bc9..181b78726 100644 --- a/bsp/stm32/stm32f407-st-discovery/rtconfig.h +++ b/bsp/stm32/stm32f407-st-discovery/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f411-st-nucleo/applications/main.c b/bsp/stm32/stm32f411-st-nucleo/applications/main.c index b29630d93..0e109663a 100644 --- a/bsp/stm32/stm32f411-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f411-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f411-st-nucleo/board/board.c b/bsp/stm32/stm32f411-st-nucleo/board/board.c index e9e6ffb5e..1d8338671 100644 --- a/bsp/stm32/stm32f411-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f411-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; @@ -35,7 +35,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f411-st-nucleo/board/board.h b/bsp/stm32/stm32f411-st-nucleo/board/board.h index e05c78512..062038ffd 100644 --- a/bsp/stm32/stm32f411-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f411-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f411-st-nucleo/rtconfig.h b/bsp/stm32/stm32f411-st-nucleo/rtconfig.h index aa1986fba..6e040ffc1 100644 --- a/bsp/stm32/stm32f411-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f411-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f412-st-nucleo/applications/main.c b/bsp/stm32/stm32f412-st-nucleo/applications/main.c index 317bc6051..2cf35c5bc 100644 --- a/bsp/stm32/stm32f412-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f412-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f412-st-nucleo/board/board.c b/bsp/stm32/stm32f412-st-nucleo/board/board.c index 504407b16..b8f8168df 100644 --- a/bsp/stm32/stm32f412-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f412-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; @@ -35,7 +35,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f412-st-nucleo/board/board.h b/bsp/stm32/stm32f412-st-nucleo/board/board.h index 3e2d7384c..5c463d04e 100644 --- a/bsp/stm32/stm32f412-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f412-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f412-st-nucleo/rtconfig.h b/bsp/stm32/stm32f412-st-nucleo/rtconfig.h index ac186e316..ff6f23548 100644 --- a/bsp/stm32/stm32f412-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f412-st-nucleo/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart3" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f427-robomaster-a/applications/main.c b/bsp/stm32/stm32f427-robomaster-a/applications/main.c index 7c2182383..6cef3cbb3 100644 --- a/bsp/stm32/stm32f427-robomaster-a/applications/main.c +++ b/bsp/stm32/stm32f427-robomaster-a/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f427-robomaster-a/board/board.c b/bsp/stm32/stm32f427-robomaster-a/board/board.c index a0901feba..780e089fc 100644 --- a/bsp/stm32/stm32f427-robomaster-a/board/board.c +++ b/bsp/stm32/stm32f427-robomaster-a/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,11 +19,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -37,13 +37,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Activate the Over-Drive mode + /** Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f427-robomaster-a/board/board.h b/bsp/stm32/stm32f427-robomaster-a/board/board.h index 57c8e4a95..72cb49ec3 100644 --- a/bsp/stm32/stm32f427-robomaster-a/board/board.h +++ b/bsp/stm32/stm32f427-robomaster-a/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f427-robomaster-a/board/ports/sdcard_port.c b/bsp/stm32/stm32f427-robomaster-a/board/ports/sdcard_port.c index b46537d31..6a79c8352 100644 --- a/bsp/stm32/stm32f427-robomaster-a/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f427-robomaster-a/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f427-robomaster-a/rtconfig.h b/bsp/stm32/stm32f427-robomaster-a/rtconfig.h index f4fcdc5c5..606eb617a 100644 --- a/bsp/stm32/stm32f427-robomaster-a/rtconfig.h +++ b/bsp/stm32/stm32f427-robomaster-a/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart6" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f429-armfly-v6/applications/main.c b/bsp/stm32/stm32f429-armfly-v6/applications/main.c index 70c2a3b0f..21b7c14ec 100644 --- a/bsp/stm32/stm32f429-armfly-v6/applications/main.c +++ b/bsp/stm32/stm32f429-armfly-v6/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,10 +18,10 @@ int main(void) int count = 1; HC574_SetPin(LED1,0); - HC574_SetPin(LED2,0); + HC574_SetPin(LED2,0); HC574_SetPin(LED3,0); HC574_SetPin(LED4,0); - + while (count++) { HC574_SetPin(LED1,1); @@ -29,6 +29,6 @@ int main(void) HC574_SetPin(LED1,0); rt_thread_mdelay(500); } - + return RT_EOK; } diff --git a/bsp/stm32/stm32f429-armfly-v6/board/board.c b/bsp/stm32/stm32f429-armfly-v6/board/board.c index f314b7c45..2d37e631e 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/board.c +++ b/bsp/stm32/stm32f429-armfly-v6/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,12 +17,12 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - - /**Configure the main internal regulator output voltage + + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -39,13 +39,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -53,7 +53,7 @@ void SystemClock_Config(void) RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; - + if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) { Error_Handler(); diff --git a/bsp/stm32/stm32f429-armfly-v6/board/board.h b/bsp/stm32/stm32f429-armfly-v6/board/board.h index f0ea803bb..c0d30df24 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/board.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/drv_ext_io.h b/bsp/stm32/stm32f429-armfly-v6/board/ports/drv_ext_io.h index 09740d357..3f336dd7a 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/drv_ext_io.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/drv_ext_io.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,64 +13,64 @@ #include "rtthread.h" /* - armfly STM32-V6 Development board Extend IO - D0 - GPRS_RERM_ON - D1 - GPRS_RESET - D2 - NRF24L01_CE - D3 - NRF905_TX_EN - D4 - NRF905_TRX_CE/VS1053_XDCS - D5 - NRF905_PWR_UP - D6 - ESP8266_G0 - D7 - ESP8266_G2 - - D8 - LED1 - D9 - LED2 - D10 - LED3 - D11 - LED4 - D12 - TP_NRST - D13 - AD7606_OS0 - D14 - AD7606_OS1 - D15 - AD7606_OS2 - - GPIO can output 5V - D16 - Y50_0 - D17 - Y50_1 - D18 - Y50_2 - D19 - Y50_3 - D20 - Y50_4 - D21 - Y50_5 - D22 - Y50_6 - D23 - Y50_7 + armfly STM32-V6 Development board Extend IO + D0 - GPRS_RERM_ON + D1 - GPRS_RESET + D2 - NRF24L01_CE + D3 - NRF905_TX_EN + D4 - NRF905_TRX_CE/VS1053_XDCS + D5 - NRF905_PWR_UP + D6 - ESP8266_G0 + D7 - ESP8266_G2 - GPIO can output 3.3V - D24 - AD7606_RESET - D25 - AD7606_RAGE - D26 - Y33_2 - D27 - Y33_3 - D28 - Y33_4 - D29 - Y33_5 - D30 - Y33_6 - D31 - Y33_7 + D8 - LED1 + D9 - LED2 + D10 - LED3 + D11 - LED4 + D12 - TP_NRST + D13 - AD7606_OS0 + D14 - AD7606_OS1 + D15 - AD7606_OS2 + + GPIO can output 5V + D16 - Y50_0 + D17 - Y50_1 + D18 - Y50_2 + D19 - Y50_3 + D20 - Y50_4 + D21 - Y50_5 + D22 - Y50_6 + D23 - Y50_7 + + GPIO can output 3.3V + D24 - AD7606_RESET + D25 - AD7606_RAGE + D26 - Y33_2 + D27 - Y33_3 + D28 - Y33_4 + D29 - Y33_5 + D30 - Y33_6 + D31 - Y33_7 */ #ifndef GPIO_Pin_0 - #define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */ - #define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */ - #define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */ - #define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */ - #define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */ - #define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */ - #define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */ - #define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */ - #define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */ - #define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */ - #define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */ - #define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */ - #define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */ - #define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */ - #define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */ - #define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */ -#endif + #define GPIO_Pin_0 ((uint16_t)0x0001) /* Pin 0 selected */ + #define GPIO_Pin_1 ((uint16_t)0x0002) /* Pin 1 selected */ + #define GPIO_Pin_2 ((uint16_t)0x0004) /* Pin 2 selected */ + #define GPIO_Pin_3 ((uint16_t)0x0008) /* Pin 3 selected */ + #define GPIO_Pin_4 ((uint16_t)0x0010) /* Pin 4 selected */ + #define GPIO_Pin_5 ((uint16_t)0x0020) /* Pin 5 selected */ + #define GPIO_Pin_6 ((uint16_t)0x0040) /* Pin 6 selected */ + #define GPIO_Pin_7 ((uint16_t)0x0080) /* Pin 7 selected */ + #define GPIO_Pin_8 ((uint16_t)0x0100) /* Pin 8 selected */ + #define GPIO_Pin_9 ((uint16_t)0x0200) /* Pin 9 selected */ + #define GPIO_Pin_10 ((uint16_t)0x0400) /* Pin 10 selected */ + #define GPIO_Pin_11 ((uint16_t)0x0800) /* Pin 11 selected */ + #define GPIO_Pin_12 ((uint16_t)0x1000) /* Pin 12 selected */ + #define GPIO_Pin_13 ((uint16_t)0x2000) /* Pin 13 selected */ + #define GPIO_Pin_14 ((uint16_t)0x4000) /* Pin 14 selected */ + #define GPIO_Pin_15 ((uint16_t)0x8000) /* Pin 15 selected */ +#endif #define GPIO_Pin_16 ((uint32_t)0x00010000) /* Pin 0 selected */ #define GPIO_Pin_17 ((uint32_t)0x00020000) /* Pin 1 selected */ @@ -90,42 +90,42 @@ #define GPIO_Pin_31 ((uint32_t)0x80000000) /* Pin 15 selected */ /* Rename the macro for the sake of memory */ -#define GPRS_TERM_ON GPIO_Pin_0 -#define GPRS_RESET GPIO_Pin_1 -#define NRF24L01_CE GPIO_Pin_2 -#define NRF905_TX_EN GPIO_Pin_3 -#define NRF905_TRX_CE GPIO_Pin_4 +#define GPRS_TERM_ON GPIO_Pin_0 +#define GPRS_RESET GPIO_Pin_1 +#define NRF24L01_CE GPIO_Pin_2 +#define NRF905_TX_EN GPIO_Pin_3 +#define NRF905_TRX_CE GPIO_Pin_4 #define VS1053_XDCS GPIO_Pin_4 -#define NRF905_PWR_UP GPIO_Pin_5 -#define ESP8266_G0 GPIO_Pin_6 -#define ESP8266_G2 GPIO_Pin_7 - -#define LED1 GPIO_Pin_8 -#define LED2 GPIO_Pin_9 -#define LED3 GPIO_Pin_10 -#define LED4 GPIO_Pin_11 -#define TP_NRST GPIO_Pin_12 -#define AD7606_OS0 GPIO_Pin_13 -#define AD7606_OS1 GPIO_Pin_14 -#define AD7606_OS2 GPIO_Pin_15 - -#define Y50_0 GPIO_Pin_16 -#define Y50_1 GPIO_Pin_17 -#define Y50_2 GPIO_Pin_18 -#define Y50_3 GPIO_Pin_19 -#define Y50_4 GPIO_Pin_20 -#define Y50_5 GPIO_Pin_21 -#define Y50_6 GPIO_Pin_22 -#define Y50_7 GPIO_Pin_23 +#define NRF905_PWR_UP GPIO_Pin_5 +#define ESP8266_G0 GPIO_Pin_6 +#define ESP8266_G2 GPIO_Pin_7 + +#define LED1 GPIO_Pin_8 +#define LED2 GPIO_Pin_9 +#define LED3 GPIO_Pin_10 +#define LED4 GPIO_Pin_11 +#define TP_NRST GPIO_Pin_12 +#define AD7606_OS0 GPIO_Pin_13 +#define AD7606_OS1 GPIO_Pin_14 +#define AD7606_OS2 GPIO_Pin_15 + +#define Y50_0 GPIO_Pin_16 +#define Y50_1 GPIO_Pin_17 +#define Y50_2 GPIO_Pin_18 +#define Y50_3 GPIO_Pin_19 +#define Y50_4 GPIO_Pin_20 +#define Y50_5 GPIO_Pin_21 +#define Y50_6 GPIO_Pin_22 +#define Y50_7 GPIO_Pin_23 -#define AD7606_RESET GPIO_Pin_24 -#define AD7606_RANGE GPIO_Pin_25 -#define Y33_2 GPIO_Pin_26 -#define Y33_3 GPIO_Pin_27 -#define Y33_4 GPIO_Pin_28 -#define Y33_5 GPIO_Pin_29 -#define Y33_6 GPIO_Pin_30 -#define Y33_7 GPIO_Pin_31 +#define AD7606_RESET GPIO_Pin_24 +#define AD7606_RANGE GPIO_Pin_25 +#define Y33_2 GPIO_Pin_26 +#define Y33_3 GPIO_Pin_27 +#define Y33_4 GPIO_Pin_28 +#define Y33_5 GPIO_Pin_29 +#define Y33_6 GPIO_Pin_30 +#define Y33_7 GPIO_Pin_31 void HC574_SetPin(rt_uint32_t _pin, uint8_t _value); rt_uint8_t HC574_GetPin(rt_uint32_t _pin); diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h b/bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h index a587e207c..995136cd5 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/lcd_port.h b/bsp/stm32/stm32f429-armfly-v6/board/ports/lcd_port.h index 31e2b9a39..0fda72929 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/phy_reset.c b/bsp/stm32/stm32f429-armfly-v6/board/ports/phy_reset.c index 36296b486..6d97b5a97 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/sdcard_port.c b/bsp/stm32/stm32f429-armfly-v6/board/ports/sdcard_port.c index b46537d31..6a79c8352 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/sdram_port.h b/bsp/stm32/stm32f429-armfly-v6/board/ports/sdram_port.h index 1e57acb19..9b5a363b6 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c index 526835b59..21ac8bf31 100644 --- a/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-armfly-v6/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-armfly-v6/rtconfig.h b/bsp/stm32/stm32f429-armfly-v6/rtconfig.h index a96e413e7..4501ff943 100644 --- a/bsp/stm32/stm32f429-armfly-v6/rtconfig.h +++ b/bsp/stm32/stm32f429-armfly-v6/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f429-atk-apollo/applications/main.c b/bsp/stm32/stm32f429-atk-apollo/applications/main.c index 487ddf44f..6d19a46ed 100644 --- a/bsp/stm32/stm32f429-atk-apollo/applications/main.c +++ b/bsp/stm32/stm32f429-atk-apollo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/board.c b/bsp/stm32/stm32f429-atk-apollo/board/board.c index c13619f75..36d2ff17d 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/board.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,11 +18,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -39,13 +39,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f429-atk-apollo/board/board.h b/bsp/stm32/stm32f429-atk-apollo/board/board.h index 9173f50c4..077b0af71 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/board.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.c index ce1021fb6..889c5b0de 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -86,7 +86,7 @@ void SAIB_config_set(struct rt_audio_configure config) SAIB_samplerate_set(config.samplerate); SAIB_samplebits_set(config.samplebits); } - + static void SAIB_config_init() { _sai_b.hsai.Instance = SAI1_Block_B; diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.h b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.h index 8aeede498..0cc55f7aa 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_mic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,10 +8,10 @@ * 2019-07-28 Ernest the first version */ -#ifndef __DRV_MIC_H_ -#define __DRV_MIC_H_ +#ifndef __DRV_MIC_H_ +#define __DRV_MIC_H_ -#include +#include #include #endif diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.c index 4a51ef634..f564cc1b8 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,7 +16,7 @@ #define DBG_LVL DBG_INFO #include -#define CODEC_I2C_NAME ("i2c1") +#define CODEC_I2C_NAME ("i2c1") #define TX_DMA_FIFO_SIZE (2048) @@ -49,7 +49,7 @@ void SAIA_samplerate_set(rt_uint32_t freq) { RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; int i; - + /* check frequence */ for (i = 0; i < (sizeof(SAI_PSC_TBL) / sizeof(SAI_PSC_TBL[0])); i++) { @@ -60,12 +60,12 @@ void SAIA_samplerate_set(rt_uint32_t freq) LOG_E("Can not support this frequence: %d.", freq); return; } - + PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_SAI_PLLI2S; PeriphClkInitStruct.PLLI2S.PLLI2SN = SAI_PSC_TBL[i][1]; PeriphClkInitStruct.PLLI2S.PLLI2SQ = SAI_PSC_TBL[i][2]; PeriphClkInitStruct.PLLI2SDivQ = SAI_PSC_TBL[i][3] + 1; - + HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct); __HAL_RCC_SAI_BLOCKACLKSOURCE_CONFIG(RCC_SAIACLKSOURCE_PLLI2S); diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.h b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.h index 216481444..28a1ea210 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_sound.h @@ -1,19 +1,19 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2019-07-28 Ernest the first version + * 2019-07-28 Ernest the first version */ -#ifndef __DRV_SOUND_H_ -#define __DRV_SOUND_H_ +#ifndef __DRV_SOUND_H_ +#define __DRV_SOUND_H_ -#include +#include #include -#include +#include #define AUDIO_FREQUENCY_048K ((rt_uint32_t) 48000) #define AUDIO_FREQUENCY_044K ((rt_uint32_t) 44100) diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.c index 5c7b8084c..0f650538f 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -763,8 +763,8 @@ rt_err_t wm8978_init(struct rt_i2c_bus_device *dev) wm8978_interface_cfg(dev, I2S_FOMAT_SELECT, 16); wm8978_mic_enabled(dev, 0); - - return RT_EOK; + + return RT_EOK; } void wm8978_DAC_enabled(struct rt_i2c_bus_device *dev, rt_bool_t bool) diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.h b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.h index d385255f9..fe476ec0b 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/audio/drv_wm8978.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h b/bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h index a587e207c..995136cd5 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/phy_reset.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/phy_reset.c index 666d053b2..826f8c7de 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,8 +16,8 @@ #include #define ETH_RESET_IO 7 //PHY RESET PIN -#define I2C_BUS_NAME "i2c1" -#define PCF8574_ADDR 0x20 +#define I2C_BUS_NAME "i2c1" +#define PCF8574_ADDR 0x20 /* pcf8574 hardware init */ pcf8574_device_t pcf8574_hw_init(char * dev_name, int addr) diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/sdcard_port.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/sdcard_port.c index 0a9c36fd4..bc7e8b676 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/sdram_port.h b/bsp/stm32/stm32f429-atk-apollo/board/ports/sdram_port.h index ff948cb61..85697210f 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c index 26a9b2d2a..7e35a36c8 100644 --- a/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-atk-apollo/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-atk-apollo/rtconfig.h b/bsp/stm32/stm32f429-atk-apollo/rtconfig.h index 1ddb40942..4cd790b68 100644 --- a/bsp/stm32/stm32f429-atk-apollo/rtconfig.h +++ b/bsp/stm32/stm32f429-atk-apollo/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f429-fire-challenger/applications/main.c b/bsp/stm32/stm32f429-fire-challenger/applications/main.c index 1078b6428..64e40b75c 100644 --- a/bsp/stm32/stm32f429-fire-challenger/applications/main.c +++ b/bsp/stm32/stm32f429-fire-challenger/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/board.c b/bsp/stm32/stm32f429-fire-challenger/board/board.c index ec47ab0d3..5ca583d59 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/board.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/board.h b/bsp/stm32/stm32f429-fire-challenger/board/board.h index ab9e1733e..c51f6a93c 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/board.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h b/bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h index a587e207c..995136cd5 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/lcd_port.h b/bsp/stm32/stm32f429-fire-challenger/board/ports/lcd_port.h index 2660f3931..8d297ec91 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/phy_reset.c b/bsp/stm32/stm32f429-fire-challenger/board/ports/phy_reset.c index 298dd14e2..8eaf6dcd5 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/sdcard_port.c b/bsp/stm32/stm32f429-fire-challenger/board/ports/sdcard_port.c index d7b740ae4..01111ab4d 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/sdram_port.h b/bsp/stm32/stm32f429-fire-challenger/board/ports/sdram_port.h index 72d7c8d06..1e5978871 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c b/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c index 5a1a4a258..94a550cf3 100644 --- a/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c +++ b/bsp/stm32/stm32f429-fire-challenger/board/ports/spi_flash_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-fire-challenger/rtconfig.h b/bsp/stm32/stm32f429-fire-challenger/rtconfig.h index 3e0f467e3..dce3880f5 100644 --- a/bsp/stm32/stm32f429-fire-challenger/rtconfig.h +++ b/bsp/stm32/stm32f429-fire-challenger/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f429-st-disco/applications/lcd_init.c b/bsp/stm32/stm32f429-st-disco/applications/lcd_init.c index 277a754ae..2660e6ef7 100644 --- a/bsp/stm32/stm32f429-st-disco/applications/lcd_init.c +++ b/bsp/stm32/stm32f429-st-disco/applications/lcd_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-st-disco/applications/main.c b/bsp/stm32/stm32f429-st-disco/applications/main.c index 8e6e8caef..992f2b5d7 100644 --- a/bsp/stm32/stm32f429-st-disco/applications/main.c +++ b/bsp/stm32/stm32f429-st-disco/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-st-disco/board/board.c b/bsp/stm32/stm32f429-st-disco/board/board.c index ca12c3724..5e9e6f4c7 100644 --- a/bsp/stm32/stm32f429-st-disco/board/board.c +++ b/bsp/stm32/stm32f429-st-disco/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,11 +17,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -35,7 +35,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f429-st-disco/board/board.h b/bsp/stm32/stm32f429-st-disco/board/board.h index 47e439a26..2d2b2088a 100644 --- a/bsp/stm32/stm32f429-st-disco/board/board.h +++ b/bsp/stm32/stm32f429-st-disco/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-st-disco/board/ports/fal_cfg.h b/bsp/stm32/stm32f429-st-disco/board/ports/fal_cfg.h index 46ecb322c..ac75718bc 100644 --- a/bsp/stm32/stm32f429-st-disco/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f429-st-disco/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -57,7 +57,7 @@ extern struct fal_flash_dev nor_flash0; &nor_flash0, \ } -#define ONCHIP_FLASH_PART_TABLE +#define ONCHIP_FLASH_PART_TABLE #define QSPI_FLASH_PART_TABLE \ {FAL_PART_MAGIC_WROD, "qspiflash", FAL_USING_NOR_FLASH_DEV_NAME, 0 , (16 * 1024 * 1024), 0}, @@ -76,7 +76,7 @@ extern struct fal_flash_dev nor_flash0; {FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \ {FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, -#define QSPI_FLASH_PART_TABLE +#define QSPI_FLASH_PART_TABLE #else diff --git a/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.c b/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.c index 8559b69f9..d70e444ef 100644 --- a/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.c +++ b/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -154,7 +154,7 @@ int32_t touch_get_state(struct touch_state *state) res = touch_read(STMPE811_TSC_CTRL, &val); if (res < 0) return -1; state->pressed = (val & (1 << 7)) ? 1 : 0; - + if (state->pressed) { val = STMPE811_TSC_DATA; @@ -218,7 +218,7 @@ static int rt_hw_touch_init(void) /* register touch device to RT-Thread */ rt_device_register(&touch, "touch", RT_DEVICE_FLAG_RDWR); - + return RT_EOK; } INIT_BOARD_EXPORT(rt_hw_touch_init); diff --git a/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.h b/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.h index 68c8f92b7..a7b6328f1 100644 --- a/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.h +++ b/bsp/stm32/stm32f429-st-disco/board/ports/touch/drv_touch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f429-st-disco/rtconfig.h b/bsp/stm32/stm32f429-st-disco/rtconfig.h index 8b1fadcdd..3ffec6ebc 100644 --- a/bsp/stm32/stm32f429-st-disco/rtconfig.h +++ b/bsp/stm32/stm32f429-st-disco/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f446-st-nucleo/applications/main.c b/bsp/stm32/stm32f446-st-nucleo/applications/main.c index 0f283769a..897c6eec1 100644 --- a/bsp/stm32/stm32f446-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f446-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f446-st-nucleo/board/board.c b/bsp/stm32/stm32f446-st-nucleo/board/board.c index aba3df89e..a2500ee68 100644 --- a/bsp/stm32/stm32f446-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f446-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -35,13 +35,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f446-st-nucleo/board/board.h b/bsp/stm32/stm32f446-st-nucleo/board/board.h index 1800e4407..8cb4438f8 100644 --- a/bsp/stm32/stm32f446-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f446-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f446-st-nucleo/rtconfig.h b/bsp/stm32/stm32f446-st-nucleo/rtconfig.h index c00a2f24b..775de8fa3 100644 --- a/bsp/stm32/stm32f446-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f446-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f469-st-disco/applications/lcd_init.c b/bsp/stm32/stm32f469-st-disco/applications/lcd_init.c index 277a754ae..2660e6ef7 100644 --- a/bsp/stm32/stm32f469-st-disco/applications/lcd_init.c +++ b/bsp/stm32/stm32f469-st-disco/applications/lcd_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f469-st-disco/applications/main.c b/bsp/stm32/stm32f469-st-disco/applications/main.c index 8feca1992..759572d37 100644 --- a/bsp/stm32/stm32f469-st-disco/applications/main.c +++ b/bsp/stm32/stm32f469-st-disco/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f469-st-disco/board/board.c b/bsp/stm32/stm32f469-st-disco/board/board.c index 8c4c361dc..fefb07faf 100644 --- a/bsp/stm32/stm32f469-st-disco/board/board.c +++ b/bsp/stm32/stm32f469-st-disco/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,11 +17,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -36,13 +36,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Activate the Over-Drive mode + /** Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f469-st-disco/board/board.h b/bsp/stm32/stm32f469-st-disco/board/board.h index 0880c1f38..607aa3877 100644 --- a/bsp/stm32/stm32f469-st-disco/board/board.h +++ b/bsp/stm32/stm32f469-st-disco/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/drv_otm8009a.c b/bsp/stm32/stm32f469-st-disco/board/ports/drv_otm8009a.c index 84202f84c..8fde3a56a 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/drv_otm8009a.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/drv_otm8009a.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2019-05-23 WillianChan first version */ - + #include #ifdef BSP_USING_LCD_OTM8009A extern DSI_HandleTypeDef hdsi; @@ -93,9 +93,9 @@ const rt_uint8_t RDS49[] = {0xF5, 0x06}; const rt_uint8_t RDS50[] = {0x00, 0xB1}; const rt_uint8_t RDS51[] = {0xC6, 0x06}; -void otm8009a_reset(void) +void otm8009a_reset(void) { - rt_pin_mode (GET_PIN(H, 7), PIN_MODE_OUTPUT); + rt_pin_mode (GET_PIN(H, 7), PIN_MODE_OUTPUT); rt_pin_write(GET_PIN(H, 7), PIN_LOW); rt_thread_delay(rt_tick_from_millisecond(20)); rt_pin_write(GET_PIN(H, 7), PIN_HIGH); @@ -116,7 +116,7 @@ static void otm8009a_write_cmd(uint8_t *p, uint32_t num) static void otm8009a_delay(uint32_t d) { - rt_thread_delay(rt_tick_from_millisecond(d)); + rt_thread_delay(rt_tick_from_millisecond(d)); } static void otm8009a_config(rt_uint32_t pixel_format) @@ -127,11 +127,11 @@ static void otm8009a_config(rt_uint32_t pixel_format) otm8009a_write_cmd((rt_uint8_t *)RDL02, 2); otm8009a_write_cmd((rt_uint8_t *)RDS02, 0); otm8009a_write_cmd((rt_uint8_t *)RDS03, 0); - otm8009a_delay(10); + otm8009a_delay(10); otm8009a_write_cmd((rt_uint8_t *)RDS04, 0); otm8009a_write_cmd((rt_uint8_t *)RDS05, 0); - otm8009a_delay(10); + otm8009a_delay(10); otm8009a_write_cmd((rt_uint8_t *)RDS06, 0); otm8009a_write_cmd((rt_uint8_t *)RDS07, 0); @@ -215,8 +215,8 @@ static void otm8009a_config(rt_uint32_t pixel_format) otm8009a_write_cmd((rt_uint8_t *)RDS01, 0); otm8009a_write_cmd((rt_uint8_t *)RDL04, 16); otm8009a_write_cmd((rt_uint8_t *)RDS36, 0); - otm8009a_delay(120); - + otm8009a_delay(120); + switch (pixel_format) { case RTGRAPHIC_PIXEL_FORMAT_RGB565: @@ -248,7 +248,7 @@ void stm32_mipi_lcd_init(void) void stm32_mipi_lcd_config(rt_uint32_t pixel_format) { - otm8009a_config(pixel_format); + otm8009a_config(pixel_format); } void stm32_mipi_display_on(void) diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32f469-st-disco/board/ports/drv_qspi_flash.c index f5fe27d6e..ff1b11e34 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2018-11-27 zylx first version * 2019-04-11 ZYH port from stm32f7serial */ - + #include #include #include @@ -64,7 +64,7 @@ void n25qxxa_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, n25qxxa_enter_qspi_mode, RT_NULL); - + /* init n25qxx */ if (RT_NULL == rt_sfud_flash_probe(FAL_USING_NOR_FLASH_DEV_NAME, "qspi10")) { diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/drv_sdcard.c b/bsp/stm32/stm32f469-st-disco/board/ports/drv_sdcard.c index cfe6f59e1..9fd2d11fd 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/drv_sdcard.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/drv_sdcard.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -29,7 +29,7 @@ static void _sdcard_mount(void) { rt_device_t device; - + device = rt_device_find("sd0"); if (device == NULL) { @@ -56,7 +56,7 @@ static void _sdcard_unmount(void) rt_thread_mdelay(200); dfs_unmount("/"); LOG_I("Unmount \"/\""); - + mmcsd_wait_cd_changed(0); stm32_mmcsd_change(); mmcsd_wait_cd_changed(RT_WAITING_FOREVER); @@ -65,7 +65,7 @@ static void _sdcard_unmount(void) static void sd_mount(void *parameter) { rt_uint8_t re_sd_check_pin = 1; - + while (1) { rt_thread_mdelay(200); @@ -73,7 +73,7 @@ static void sd_mount(void *parameter) { _sdcard_mount(); } - + if (!re_sd_check_pin && (re_sd_check_pin = rt_pin_read(SD_CHECK_PIN)) != 0) { _sdcard_unmount(); @@ -84,7 +84,7 @@ static void sd_mount(void *parameter) int stm32_sdcard_mount(void) { rt_thread_t tid; - + rt_pin_mode(SD_CHECK_PIN, PIN_MODE_INPUT_PULLUP); tid = rt_thread_create("sd_mount", sd_mount, RT_NULL, diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/fal_cfg.h b/bsp/stm32/stm32f469-st-disco/board/ports/fal_cfg.h index 46ecb322c..ac75718bc 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f469-st-disco/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -57,7 +57,7 @@ extern struct fal_flash_dev nor_flash0; &nor_flash0, \ } -#define ONCHIP_FLASH_PART_TABLE +#define ONCHIP_FLASH_PART_TABLE #define QSPI_FLASH_PART_TABLE \ {FAL_PART_MAGIC_WROD, "qspiflash", FAL_USING_NOR_FLASH_DEV_NAME, 0 , (16 * 1024 * 1024), 0}, @@ -76,7 +76,7 @@ extern struct fal_flash_dev nor_flash0; {FAL_PART_MAGIC_WROD, "param", "onchip_flash_64k", 0 , FLASH_SIZE_GRANULARITY_64K , 0}, \ {FAL_PART_MAGIC_WROD, "app", "onchip_flash_128k", 0 , FLASH_SIZE_GRANULARITY_128K, 0}, -#define QSPI_FLASH_PART_TABLE +#define QSPI_FLASH_PART_TABLE #else diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/lcd_port.h b/bsp/stm32/stm32f469-st-disco/board/ports/lcd_port.h index d5ee2b13b..b23a97053 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f469-st-disco/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,19 +7,19 @@ * Date Author Notes * 2018-07-28 liu2guang the first version for STM32F469NI-Discovery. */ - -#ifndef __DRV_LCD_H_ -#define __DRV_LCD_H_ -#include +#ifndef __DRV_LCD_H_ +#define __DRV_LCD_H_ + +#include #include -#include +#include #define LCD_WIDTH (800U) #define LCD_HEIGHT (480U) #define LCD_HSYNC (1U) -#define LCD_HBP (15U) +#define LCD_HBP (15U) #define LCD_HFP (16U) #define LCD_VSYNC (2U) #define LCD_VBP (34U) diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/qspi_mnt.c b/bsp/stm32/stm32f469-st-disco/board/ports/qspi_mnt.c index f90b46846..5b311a391 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/qspi_mnt.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/qspi_mnt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/sdram_port.h b/bsp/stm32/stm32f469-st-disco/board/ports/sdram_port.h index 14d44f711..7b33d3636 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f469-st-disco/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c index 1ff29544f..53437f34e 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-02-08 Zhangyihong the first version */ - + #include "drv_touch.h" #include #ifdef BSP_USING_TOUCH @@ -105,7 +105,7 @@ static void touch_thread_entry(void *parameter) { continue; } - + while(touch->ops->read_point(&msg) == RT_EOK) { switch (msg.event) diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.h b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.h index a8fea21d5..21bea39f8 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.h +++ b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-02-08 Zhangyihong the first version */ - + #ifndef __DRV_TOUCH_H__ #define __DRV_TOUCH_H__ diff --git a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft.c b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft.c index a7e927544..e85e79357 100644 --- a/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft.c +++ b/bsp/stm32/stm32f469-st-disco/board/ports/touch/drv_touch_ft.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -109,7 +109,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) { return RT_ERROR; } - + if (point_num == 0) { if (s_tp_down) @@ -121,7 +121,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) msg->event = TOUCH_EVENT_NONE; return RT_ERROR; } - + ret = ft_read(ft_i2c_bus, 0x03, point, 6); if (ret < 0) { @@ -130,7 +130,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) msg->y = (point[0]&0x0F) << 8 | point[1]; msg->x = (point[2]&0x0F) << 8 | point[3]; - + if (s_tp_down) { msg->event = TOUCH_EVENT_MOVE; @@ -138,7 +138,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) } msg->event = TOUCH_EVENT_DOWN; s_tp_down = 1; - + return RT_EOK; } diff --git a/bsp/stm32/stm32f469-st-disco/rtconfig.h b/bsp/stm32/stm32f469-st-disco/rtconfig.h index 448513318..1f2207b40 100644 --- a/bsp/stm32/stm32f469-st-disco/rtconfig.h +++ b/bsp/stm32/stm32f469-st-disco/rtconfig.h @@ -43,7 +43,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart3" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f746-st-disco/applications/main.c b/bsp/stm32/stm32f746-st-disco/applications/main.c index 669d889e5..0024ce1c0 100644 --- a/bsp/stm32/stm32f746-st-disco/applications/main.c +++ b/bsp/stm32/stm32f746-st-disco/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/board.c b/bsp/stm32/stm32f746-st-disco/board/board.c index bf92d115e..da2564d51 100644 --- a/bsp/stm32/stm32f746-st-disco/board/board.c +++ b/bsp/stm32/stm32f746-st-disco/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,14 +20,14 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure LSE Drive Capability + /**Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -42,13 +42,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f746-st-disco/board/board.h b/bsp/stm32/stm32f746-st-disco/board/board.h index 98e3799e0..b0c120fb4 100644 --- a/bsp/stm32/stm32f746-st-disco/board/board.h +++ b/bsp/stm32/stm32f746-st-disco/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32f746-st-disco/board/ports/drv_qspi_flash.c index ca7641f86..4e37f4ec2 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32f746-st-disco/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2019-01-26 jinsheng first version */ - + #include #include #include @@ -63,7 +63,7 @@ void n25qxx_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, n25qxx_enter_qspi_mode, RT_NULL); - + /* init n25q128 */ if (RT_NULL == rt_sfud_flash_probe("n25q128", "qspi10")) { diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/fal_cfg.h b/bsp/stm32/stm32f746-st-disco/board/ports/fal_cfg.h index c886dab45..d7ce29347 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f746-st-disco/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/lcd_port.h b/bsp/stm32/stm32f746-st-disco/board/ports/lcd_port.h index f534e5052..8ea00b0ed 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f746-st-disco/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/phy_reset.c b/bsp/stm32/stm32f746-st-disco/board/ports/phy_reset.c index 3d5f75c7f..5825f775c 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f746-st-disco/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/sdcard_port.c b/bsp/stm32/stm32f746-st-disco/board/ports/sdcard_port.c index 0797f9326..66e8dfefa 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f746-st-disco/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/board/ports/sdram_port.h b/bsp/stm32/stm32f746-st-disco/board/ports/sdram_port.h index 4c49e0f21..91bb91b01 100644 --- a/bsp/stm32/stm32f746-st-disco/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f746-st-disco/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f746-st-disco/rtconfig.h b/bsp/stm32/stm32f746-st-disco/rtconfig.h index 06498c58b..cabded7fe 100644 --- a/bsp/stm32/stm32f746-st-disco/rtconfig.h +++ b/bsp/stm32/stm32f746-st-disco/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f767-atk-apollo/applications/main.c b/bsp/stm32/stm32f767-atk-apollo/applications/main.c index 7d7440f05..71e6132ea 100644 --- a/bsp/stm32/stm32f767-atk-apollo/applications/main.c +++ b/bsp/stm32/stm32f767-atk-apollo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/board.c b/bsp/stm32/stm32f767-atk-apollo/board/board.c index d9959f930..726b7783b 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/board.c +++ b/bsp/stm32/stm32f767-atk-apollo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,15 +16,15 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Configure LSE Drive Capability + /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -41,13 +41,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Activate the Over-Drive mode + /** Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f767-atk-apollo/board/board.h b/bsp/stm32/stm32f767-atk-apollo/board/board.h index 3d986024a..e91271055 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/board.h +++ b/bsp/stm32/stm32f767-atk-apollo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32f767-atk-apollo/board/ports/drv_qspi_flash.c index 5cabc9d4d..72e589aea 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-27 zylx first version */ - + #include #include #include @@ -63,7 +63,7 @@ void w25qxx_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL); - + /* init W25Q256 */ if (RT_NULL == rt_sfud_flash_probe("W25Q256", "qspi10")) { diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h b/bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h index 891beb201..5ddddaa2c 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/lcd_port.h b/bsp/stm32/stm32f767-atk-apollo/board/ports/lcd_port.h index ca894bb04..156ba2e2c 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/phy_reset.c b/bsp/stm32/stm32f767-atk-apollo/board/ports/phy_reset.c index d00e6c06e..18bed5f8e 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/sdcard_port.c b/bsp/stm32/stm32f767-atk-apollo/board/ports/sdcard_port.c index 0a9c36fd4..bc7e8b676 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/board/ports/sdram_port.h b/bsp/stm32/stm32f767-atk-apollo/board/ports/sdram_port.h index ff948cb61..85697210f 100644 --- a/bsp/stm32/stm32f767-atk-apollo/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f767-atk-apollo/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-atk-apollo/rtconfig.h b/bsp/stm32/stm32f767-atk-apollo/rtconfig.h index 6326cdbd8..29467cc5c 100644 --- a/bsp/stm32/stm32f767-atk-apollo/rtconfig.h +++ b/bsp/stm32/stm32f767-atk-apollo/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f767-fire-challenger/applications/main.c b/bsp/stm32/stm32f767-fire-challenger/applications/main.c index 9ed652971..4cf67f2e9 100644 --- a/bsp/stm32/stm32f767-fire-challenger/applications/main.c +++ b/bsp/stm32/stm32f767-fire-challenger/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/board.c b/bsp/stm32/stm32f767-fire-challenger/board/board.c index f5b0c783c..de621405e 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/board.c +++ b/bsp/stm32/stm32f767-fire-challenger/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -34,13 +34,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f767-fire-challenger/board/board.h b/bsp/stm32/stm32f767-fire-challenger/board/board.h index 1beb8c5f8..e9a127784 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/board.h +++ b/bsp/stm32/stm32f767-fire-challenger/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32f767-fire-challenger/board/ports/drv_qspi_flash.c index 36ecb754e..a3091fd2e 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-27 zylx first version */ - + #include #include #include @@ -63,7 +63,7 @@ void w25qxx_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL); - + /* init w25q128 */ if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10")) { diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h b/bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h index 891beb201..5ddddaa2c 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/lcd_port.h b/bsp/stm32/stm32f767-fire-challenger/board/ports/lcd_port.h index 2660f3931..8d297ec91 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/lcd_port.h +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/phy_reset.c b/bsp/stm32/stm32f767-fire-challenger/board/ports/phy_reset.c index 298dd14e2..8eaf6dcd5 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c b/bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c index 615ad6e06..f1a7b8c27 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/board/ports/sdram_port.h b/bsp/stm32/stm32f767-fire-challenger/board/ports/sdram_port.h index 0d9c7e691..7f9485aa4 100644 --- a/bsp/stm32/stm32f767-fire-challenger/board/ports/sdram_port.h +++ b/bsp/stm32/stm32f767-fire-challenger/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-fire-challenger/rtconfig.h b/bsp/stm32/stm32f767-fire-challenger/rtconfig.h index 2c6d6610b..e4f1f7485 100644 --- a/bsp/stm32/stm32f767-fire-challenger/rtconfig.h +++ b/bsp/stm32/stm32f767-fire-challenger/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f767-st-nucleo/applications/main.c b/bsp/stm32/stm32f767-st-nucleo/applications/main.c index ed3fc2c34..a0967c132 100644 --- a/bsp/stm32/stm32f767-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32f767-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,5 +30,5 @@ int main(void) rt_thread_mdelay(500); } - return RT_EOK; + return RT_EOK; } diff --git a/bsp/stm32/stm32f767-st-nucleo/board/board.c b/bsp/stm32/stm32f767-st-nucleo/board/board.c index 0c63bfe48..4e00f2688 100644 --- a/bsp/stm32/stm32f767-st-nucleo/board/board.c +++ b/bsp/stm32/stm32f767-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -21,14 +21,14 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /**Configure LSE Drive Capability + /**Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; @@ -42,13 +42,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Activate the Over-Drive mode + /**Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f767-st-nucleo/board/board.h b/bsp/stm32/stm32f767-st-nucleo/board/board.h index 1d1e1d110..1d82defe0 100644 --- a/bsp/stm32/stm32f767-st-nucleo/board/board.h +++ b/bsp/stm32/stm32f767-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f767-st-nucleo/board/ports/phy_reset.c b/bsp/stm32/stm32f767-st-nucleo/board/ports/phy_reset.c index 8a833eec2..79b8fecc1 100644 --- a/bsp/stm32/stm32f767-st-nucleo/board/ports/phy_reset.c +++ b/bsp/stm32/stm32f767-st-nucleo/board/ports/phy_reset.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,6 +16,6 @@ void phy_reset(void) * The PHY reset pin of NUCLEO-F767ZI is connected to the MCU reset pin, * so no additional reset is required. */ - + return ; } diff --git a/bsp/stm32/stm32f767-st-nucleo/rtconfig.h b/bsp/stm32/stm32f767-st-nucleo/rtconfig.h index 620997f11..adf4b64d4 100644 --- a/bsp/stm32/stm32f767-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32f767-st-nucleo/rtconfig.h @@ -41,7 +41,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32f769-st-disco/applications/main.c b/bsp/stm32/stm32f769-st-disco/applications/main.c index 14a2f68f8..d61afe14c 100644 --- a/bsp/stm32/stm32f769-st-disco/applications/main.c +++ b/bsp/stm32/stm32f769-st-disco/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f769-st-disco/board/board.c b/bsp/stm32/stm32f769-st-disco/board/board.c index 97bbbe307..55126435b 100644 --- a/bsp/stm32/stm32f769-st-disco/board/board.c +++ b/bsp/stm32/stm32f769-st-disco/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,14 +20,14 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Configure LSE Drive Capability + /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -42,13 +42,13 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Activate the Over-Drive mode + /** Activate the Over-Drive mode */ if (HAL_PWREx_EnableOverDrive() != HAL_OK) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32f769-st-disco/board/board.h b/bsp/stm32/stm32f769-st-disco/board/board.h index 85c900e4c..813dd5b27 100644 --- a/bsp/stm32/stm32f769-st-disco/board/board.h +++ b/bsp/stm32/stm32f769-st-disco/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32f769-st-disco/rtconfig.h b/bsp/stm32/stm32f769-st-disco/rtconfig.h index 6582a6405..9e9adbcce 100644 --- a/bsp/stm32/stm32f769-st-disco/rtconfig.h +++ b/bsp/stm32/stm32f769-st-disco/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32g071-st-nucleo/applications/main.c b/bsp/stm32/stm32g071-st-nucleo/applications/main.c index 8541bd3b9..5f22fcae6 100644 --- a/bsp/stm32/stm32g071-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32g071-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32g071-st-nucleo/board/board.c b/bsp/stm32/stm32g071-st-nucleo/board/board.c index 5d634db15..28d4e56e4 100644 --- a/bsp/stm32/stm32g071-st-nucleo/board/board.c +++ b/bsp/stm32/stm32g071-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,10 +16,10 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -36,7 +36,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1; @@ -48,7 +48,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the peripherals clocks + /**Initializes the peripherals clocks */ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_LPUART1; PeriphClkInit.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PCLK1; diff --git a/bsp/stm32/stm32g071-st-nucleo/board/board.h b/bsp/stm32/stm32g071-st-nucleo/board/board.h index f0345a129..d36387892 100644 --- a/bsp/stm32/stm32g071-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g071-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32g071-st-nucleo/board/ports/fal_cfg.h b/bsp/stm32/stm32g071-st-nucleo/board/ports/fal_cfg.h index ee65e188d..277b98ba7 100644 --- a/bsp/stm32/stm32g071-st-nucleo/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32g071-st-nucleo/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32g071-st-nucleo/rtconfig.h b/bsp/stm32/stm32g071-st-nucleo/rtconfig.h index 034846917..ace1e988f 100644 --- a/bsp/stm32/stm32g071-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32g071-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "lpuart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M0 diff --git a/bsp/stm32/stm32g431-st-nucleo/applications/main.c b/bsp/stm32/stm32g431-st-nucleo/applications/main.c index aad9acb9b..fa4fd35a6 100644 --- a/bsp/stm32/stm32g431-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32g431-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32g431-st-nucleo/board/board.c b/bsp/stm32/stm32g431-st-nucleo/board/board.c index f025a3e23..7aeb08863 100644 --- a/bsp/stm32/stm32g431-st-nucleo/board/board.c +++ b/bsp/stm32/stm32g431-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,10 +17,10 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -36,7 +36,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -49,7 +49,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the peripherals clocks + /** Initializes the peripherals clocks */ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1; PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2; diff --git a/bsp/stm32/stm32g431-st-nucleo/board/board.h b/bsp/stm32/stm32g431-st-nucleo/board/board.h index 9b91078b0..6fd0c9789 100644 --- a/bsp/stm32/stm32g431-st-nucleo/board/board.h +++ b/bsp/stm32/stm32g431-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32g431-st-nucleo/rtconfig.h b/bsp/stm32/stm32g431-st-nucleo/rtconfig.h index 5ab284afc..1269a93da 100644 --- a/bsp/stm32/stm32g431-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32g431-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "lpuart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32h743-atk-apollo/applications/main.c b/bsp/stm32/stm32h743-atk-apollo/applications/main.c index 19a43a12e..376d3c78f 100644 --- a/bsp/stm32/stm32h743-atk-apollo/applications/main.c +++ b/bsp/stm32/stm32h743-atk-apollo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,9 +18,9 @@ int main(void) { int count = 1; - /* set LED0 pin mode to output */ - rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); - + /* set LED0 pin mode to output */ + rt_pin_mode(LED0_PIN, PIN_MODE_OUTPUT); + while (count++) { rt_pin_write(LED0_PIN, PIN_HIGH); diff --git a/bsp/stm32/stm32h743-atk-apollo/board/board.c b/bsp/stm32/stm32h743-atk-apollo/board/board.c index 118063328..0b0dc623f 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/board.c +++ b/bsp/stm32/stm32h743-atk-apollo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,22 +16,22 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Supply configuration update enable + /** Supply configuration update enable */ HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} - /** Configure LSE Drive Capability + /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); - /** Macro to configure the PLL clock source + /** Macro to configure the PLL clock source */ __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -52,7 +52,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 diff --git a/bsp/stm32/stm32h743-atk-apollo/board/board.h b/bsp/stm32/stm32h743-atk-apollo/board/board.h index ffb9772ee..c9ec7a30d 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/board.h +++ b/bsp/stm32/stm32h743-atk-apollo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,7 +20,7 @@ extern "C" { #endif -#if !defined (LSI_VALUE) +#if !defined (LSI_VALUE) #define LSI_VALUE ((uint32_t)32000) #endif diff --git a/bsp/stm32/stm32h743-atk-apollo/board/drv_mpu.c b/bsp/stm32/stm32h743-atk-apollo/board/drv_mpu.c index 088d7a0bb..1d5e13f9c 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/drv_mpu.c +++ b/bsp/stm32/stm32h743-atk-apollo/board/drv_mpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-atk-apollo/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32h743-atk-apollo/board/ports/drv_qspi_flash.c index 5cabc9d4d..72e589aea 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32h743-atk-apollo/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-27 zylx first version */ - + #include #include #include @@ -63,7 +63,7 @@ void w25qxx_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL); - + /* init W25Q256 */ if (RT_NULL == rt_sfud_flash_probe("W25Q256", "qspi10")) { diff --git a/bsp/stm32/stm32h743-atk-apollo/board/ports/lcd_port.h b/bsp/stm32/stm32h743-atk-apollo/board/ports/lcd_port.h index ca894bb04..156ba2e2c 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/ports/lcd_port.h +++ b/bsp/stm32/stm32h743-atk-apollo/board/ports/lcd_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-atk-apollo/board/ports/sdram_port.h b/bsp/stm32/stm32h743-atk-apollo/board/ports/sdram_port.h index 5784f7903..50804561e 100644 --- a/bsp/stm32/stm32h743-atk-apollo/board/ports/sdram_port.h +++ b/bsp/stm32/stm32h743-atk-apollo/board/ports/sdram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-atk-apollo/rtconfig.h b/bsp/stm32/stm32h743-atk-apollo/rtconfig.h index 74882398a..f72ea3009 100644 --- a/bsp/stm32/stm32h743-atk-apollo/rtconfig.h +++ b/bsp/stm32/stm32h743-atk-apollo/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32h743-st-nucleo/applications/main.c b/bsp/stm32/stm32h743-st-nucleo/applications/main.c index 2a4d35d4d..9a8ac51bb 100644 --- a/bsp/stm32/stm32h743-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32h743-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-st-nucleo/board/board.c b/bsp/stm32/stm32h743-st-nucleo/board/board.c index dc2e79d04..b5a5a4245 100644 --- a/bsp/stm32/stm32h743-st-nucleo/board/board.c +++ b/bsp/stm32/stm32h743-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-st-nucleo/board/board.h b/bsp/stm32/stm32h743-st-nucleo/board/board.h index 72d84ff29..32eb25f14 100644 --- a/bsp/stm32/stm32h743-st-nucleo/board/board.h +++ b/bsp/stm32/stm32h743-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h743-st-nucleo/rtconfig.h b/bsp/stm32/stm32h743-st-nucleo/rtconfig.h index 823cc2266..5f2ceb27e 100644 --- a/bsp/stm32/stm32h743-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32h743-st-nucleo/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart3" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32h750-armfly-h7-tool/applications/main.c b/bsp/stm32/stm32h750-armfly-h7-tool/applications/main.c index 73691fa78..b19e338dc 100644 --- a/bsp/stm32/stm32h750-armfly-h7-tool/applications/main.c +++ b/bsp/stm32/stm32h750-armfly-h7-tool/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.c b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.c index 7783d407a..6426138e1 100644 --- a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.c +++ b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,18 +20,18 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0}; - /** Supply configuration update enable + /** Supply configuration update enable */ HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY); - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {} - /** Macro to configure the PLL clock source + /** Macro to configure the PLL clock source */ __HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI48|RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -50,7 +50,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2 diff --git a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h index a0455aec7..b41ed17e4 100644 --- a/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h +++ b/bsp/stm32/stm32h750-armfly-h7-tool/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32h750-armfly-h7-tool/rtconfig.h b/bsp/stm32/stm32h750-armfly-h7-tool/rtconfig.h index ba99fbfa6..102e249ce 100644 --- a/bsp/stm32/stm32h750-armfly-h7-tool/rtconfig.h +++ b/bsp/stm32/stm32h750-armfly-h7-tool/rtconfig.h @@ -38,7 +38,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 128 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l053-st-nucleo/applications/main.c b/bsp/stm32/stm32l053-st-nucleo/applications/main.c index 8541bd3b9..5f22fcae6 100644 --- a/bsp/stm32/stm32l053-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l053-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l053-st-nucleo/board/board.c b/bsp/stm32/stm32l053-st-nucleo/board/board.c index 858d59660..62621eed0 100644 --- a/bsp/stm32/stm32l053-st-nucleo/board/board.c +++ b/bsp/stm32/stm32l053-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,11 +17,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -35,7 +35,7 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -56,11 +56,11 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Configure the Systick interrupt time + /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); - /**Configure the Systick + /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); diff --git a/bsp/stm32/stm32l053-st-nucleo/board/board.h b/bsp/stm32/stm32l053-st-nucleo/board/board.h index 016e4ec4e..f88ee5194 100644 --- a/bsp/stm32/stm32l053-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l053-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l053-st-nucleo/rtconfig.h b/bsp/stm32/stm32l053-st-nucleo/rtconfig.h index 3f42cdbbb..615bc6420 100644 --- a/bsp/stm32/stm32l053-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32l053-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define ARCH_ARM_CORTEX_M #define ARCH_ARM_CORTEX_M0 diff --git a/bsp/stm32/stm32l432-st-nucleo/applications/main.c b/bsp/stm32/stm32l432-st-nucleo/applications/main.c index e1755ec81..336347c11 100644 --- a/bsp/stm32/stm32l432-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l432-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l432-st-nucleo/board/board.c b/bsp/stm32/stm32l432-st-nucleo/board/board.c index 79f7c0344..93000dc18 100644 --- a/bsp/stm32/stm32l432-st-nucleo/board/board.c +++ b/bsp/stm32/stm32l432-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,13 +17,13 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInit; - /**Configure LSE Drive Capability + /**Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE|RCC_OSCILLATORTYPE_MSI; RCC_OscInitStruct.LSEState = RCC_LSE_ON; @@ -42,7 +42,7 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -63,22 +63,22 @@ void SystemClock_Config(void) _Error_Handler(__FILE__, __LINE__); } - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); } - /**Configure the Systick interrupt time + /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); - /**Configure the Systick + /**Configure the Systick */ HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); - /**Enable MSI Auto calibration + /**Enable MSI Auto calibration */ HAL_RCCEx_EnableMSIPLLMode(); diff --git a/bsp/stm32/stm32l432-st-nucleo/board/board.h b/bsp/stm32/stm32l432-st-nucleo/board/board.h index 3b3a77e10..77db7fce6 100644 --- a/bsp/stm32/stm32l432-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l432-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l432-st-nucleo/rtconfig.h b/bsp/stm32/stm32l432-st-nucleo/rtconfig.h index 9cd2cf4fa..94331f953 100644 --- a/bsp/stm32/stm32l432-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32l432-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l452-st-nucleo/applications/main.c b/bsp/stm32/stm32l452-st-nucleo/applications/main.c index aad9acb9b..fa4fd35a6 100644 --- a/bsp/stm32/stm32l452-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l452-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l452-st-nucleo/board/board.c b/bsp/stm32/stm32l452-st-nucleo/board/board.c index 5ab9da967..d6c090b6b 100644 --- a/bsp/stm32/stm32l452-st-nucleo/board/board.c +++ b/bsp/stm32/stm32l452-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,7 +20,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -36,7 +36,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -55,7 +55,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { diff --git a/bsp/stm32/stm32l452-st-nucleo/board/board.h b/bsp/stm32/stm32l452-st-nucleo/board/board.h index 1ea1e6be9..0c9006dc4 100644 --- a/bsp/stm32/stm32l452-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l452-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l452-st-nucleo/board/ports/fal_cfg.h b/bsp/stm32/stm32l452-st-nucleo/board/ports/fal_cfg.h index db782a599..09c420dae 100644 --- a/bsp/stm32/stm32l452-st-nucleo/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32l452-st-nucleo/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,9 +20,9 @@ extern const struct fal_flash_dev stm32_onchip_flash; /* ========================= Device Configuration ========================== */ #ifdef BSP_USING_ON_CHIP_FLASH -#define ONCHIP_FLASH_DEV &stm32_onchip_flash, +#define ONCHIP_FLASH_DEV &stm32_onchip_flash, #else -#define ONCHIP_FLASH_DEV +#define ONCHIP_FLASH_DEV #endif /* BSP_USING_ON_CHIP_FLASH */ /* flash device table */ diff --git a/bsp/stm32/stm32l452-st-nucleo/rtconfig.h b/bsp/stm32/stm32l452-st-nucleo/rtconfig.h index 08284d505..5d4cb9dc9 100644 --- a/bsp/stm32/stm32l452-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32l452-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/main.c b/bsp/stm32/stm32l475-atk-pandora/applications/main.c index 97e08a7d4..dfad8c68c 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/main.c +++ b/bsp/stm32/stm32l475-atk-pandora/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c b/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c index 59c27ee55..e29115423 100644 --- a/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c +++ b/bsp/stm32/stm32l475-atk-pandora/applications/nrf24l01_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-atk-pandora/board/board.c b/bsp/stm32/stm32l475-atk-pandora/board/board.c index e97c6784a..6e2be4bf4 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/board.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/board.c @@ -1,11 +1,7 @@ /* - * File : board.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009 RT-Thread Develop Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -22,11 +18,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Configure LSE Drive Capability + /** Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_HSE |RCC_OSCILLATORTYPE_LSE; @@ -44,7 +40,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -76,7 +72,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { diff --git a/bsp/stm32/stm32l475-atk-pandora/board/board.h b/bsp/stm32/stm32l475-atk-pandora/board/board.h index ee516b50d..a1029a3e9 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/board.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.c index fe115eb59..5d9844c6b 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.h index 472c844fc..ac758960f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_es8388.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_mic.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_mic.c index c4ea570dd..ac604875f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_mic.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_mic.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.c index bccf9c62d..b19d584d3 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.h index 4dc76631c..d573b0dee 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/audio/drv_sound.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team - * + * Copyright (c) 2006-2021, RT-Thread Development Team + * * SPDX-License-Identifier: Apache-2.0 * * Date Author Notes diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.c index 65bdcd85f..f80ca3a4b 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -955,7 +955,7 @@ rt_err_t lcd_show_qrcode(rt_uint16_t x, rt_uint16_t y, rt_uint8_t version, rt_ui { enlargement_factor = enlargement; } - + /* malloc memory for quick display of qrcode */ qrcode_buf = rt_malloc(qrcode.size * 2 * enlargement_factor * enlargement_factor); if (qrcode_buf == RT_NULL) diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.h index ca4c28595..394305012 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_lcd.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-08-14 flybreak the first version - * 2018-09-18 balanceTWK add sleep mode function + * 2018-09-18 balanceTWK add sleep mode function */ #ifndef __DRV_LCD_H__ diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_qspi_flash.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_qspi_flash.c index aef222623..f866d2741 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_qspi_flash.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/drv_qspi_flash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-27 zylx first version */ - + #include #include #include @@ -63,7 +63,7 @@ void w25qxx_enter_qspi_mode(struct rt_qspi_device *device) static int rt_hw_qspi_flash_with_sfud_init(void) { stm32_qspi_bus_attach_device("qspi1", "qspi10", RT_NULL, 4, w25qxx_enter_qspi_mode, RT_NULL); - + /* init w25q128 */ if (RT_NULL == rt_sfud_flash_probe("W25Q128", "qspi10")) { diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/fal_cfg.h b/bsp/stm32/stm32l475-atk-pandora/board/ports/fal_cfg.h index a1575859a..b96477b81 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -24,15 +24,15 @@ extern struct fal_flash_dev nor_flash0; /* ========================= Device Configuration ========================== */ #ifdef BSP_USING_ON_CHIP_FLASH -#define ONCHIP_FLASH_DEV &stm32_onchip_flash, +#define ONCHIP_FLASH_DEV &stm32_onchip_flash, #else -#define ONCHIP_FLASH_DEV +#define ONCHIP_FLASH_DEV #endif /* BSP_USING_ON_CHIP_FLASH */ #ifdef BSP_USING_QSPI_FLASH -#define SPI_FLASH_DEV &nor_flash0, +#define SPI_FLASH_DEV &nor_flash0, #else -#define SPI_FLASH_DEV +#define SPI_FLASH_DEV #endif /* BSP_USING_QSPI_FLASH */ /* flash device table */ @@ -55,7 +55,7 @@ extern struct fal_flash_dev nor_flash0; #ifdef BSP_USING_QSPI_FLASH #define SPI_FLASH_PARTITION {FAL_PART_MAGIC_WROD, "filesystem", "W25Q128", 9 * 1024 * 1024, 16 * 1024 * 1024, 0}, #else -#define SPI_FLASH_PARTITION +#define SPI_FLASH_PARTITION #endif /* partition table */ diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/sdcard_port.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/sdcard_port.c index e1af10945..9db3ec01f 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c index d253cc179..fac1209a6 100644 --- a/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c +++ b/bsp/stm32/stm32l475-atk-pandora/board/ports/sensor_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-atk-pandora/rtconfig.h b/bsp/stm32/stm32l475-atk-pandora/rtconfig.h index 20117697f..e51fb3142 100644 --- a/bsp/stm32/stm32l475-atk-pandora/rtconfig.h +++ b/bsp/stm32/stm32l475-atk-pandora/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l475-st-discovery/applications/main.c b/bsp/stm32/stm32l475-st-discovery/applications/main.c index 2c4ca35a6..bddb8abe6 100644 --- a/bsp/stm32/stm32l475-st-discovery/applications/main.c +++ b/bsp/stm32/stm32l475-st-discovery/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-st-discovery/board/board.c b/bsp/stm32/stm32l475-st-discovery/board/board.c index bdd1307a9..cd2f9a598 100644 --- a/bsp/stm32/stm32l475-st-discovery/board/board.c +++ b/bsp/stm32/stm32l475-st-discovery/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,7 +16,7 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -32,7 +32,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -51,7 +51,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { diff --git a/bsp/stm32/stm32l475-st-discovery/board/board.h b/bsp/stm32/stm32l475-st-discovery/board/board.h index e49d71c68..2b5f830eb 100644 --- a/bsp/stm32/stm32l475-st-discovery/board/board.h +++ b/bsp/stm32/stm32l475-st-discovery/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l475-st-discovery/rtconfig.h b/bsp/stm32/stm32l475-st-discovery/rtconfig.h index 7bca20275..d6b6aea23 100644 --- a/bsp/stm32/stm32l475-st-discovery/rtconfig.h +++ b/bsp/stm32/stm32l475-st-discovery/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l476-st-nucleo/applications/main.c b/bsp/stm32/stm32l476-st-nucleo/applications/main.c index e92ed8da7..b22a8b8e8 100644 --- a/bsp/stm32/stm32l476-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l476-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l476-st-nucleo/board/board.c b/bsp/stm32/stm32l476-st-nucleo/board/board.c index 88600d4b4..0d279e679 100644 --- a/bsp/stm32/stm32l476-st-nucleo/board/board.c +++ b/bsp/stm32/stm32l476-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l476-st-nucleo/board/board.h b/bsp/stm32/stm32l476-st-nucleo/board/board.h index b59fe1b3b..c0b6a905f 100644 --- a/bsp/stm32/stm32l476-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l476-st-nucleo/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l476-st-nucleo/rtconfig.h b/bsp/stm32/stm32l476-st-nucleo/rtconfig.h index 9e604a624..98f907b82 100644 --- a/bsp/stm32/stm32l476-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32l476-st-nucleo/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart2" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l496-ali-developer/applications/main.c b/bsp/stm32/stm32l496-ali-developer/applications/main.c index d4926deb0..86d1cf72d 100644 --- a/bsp/stm32/stm32l496-ali-developer/applications/main.c +++ b/bsp/stm32/stm32l496-ali-developer/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l496-ali-developer/board/board.c b/bsp/stm32/stm32l496-ali-developer/board/board.c index f9413f8f9..9622e7303 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/board.c +++ b/bsp/stm32/stm32l496-ali-developer/board/board.c @@ -1,11 +1,7 @@ /* - * File : board.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2009 RT-Thread Develop Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rt-thread.org/license/LICENSE + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -20,11 +16,11 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Configure LSE Drive Capability + /**Configure LSE Drive Capability */ HAL_PWR_EnableBkUpAccess(); __HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW); - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSI|RCC_OSCILLATORTYPE_LSE |RCC_OSCILLATORTYPE_MSI; @@ -44,7 +40,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; @@ -77,7 +73,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1) != HAL_OK) { diff --git a/bsp/stm32/stm32l496-ali-developer/board/board.h b/bsp/stm32/stm32l496-ali-developer/board/board.h index 78cc07314..6d9902252 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/board.h +++ b/bsp/stm32/stm32l496-ali-developer/board/board.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c b/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c index e37a67f4a..be6c2a574 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c +++ b/bsp/stm32/stm32l496-ali-developer/board/ports/drv_spi_lcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2018-11-27 zylx first version */ - + #include #include #include diff --git a/bsp/stm32/stm32l496-ali-developer/board/ports/fal_cfg.h b/bsp/stm32/stm32l496-ali-developer/board/ports/fal_cfg.h index d7a1db25e..a0598e9d8 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/ports/fal_cfg.h +++ b/bsp/stm32/stm32l496-ali-developer/board/ports/fal_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l496-ali-developer/board/ports/sdcard_port.c b/bsp/stm32/stm32l496-ali-developer/board/ports/sdcard_port.c index 8a2c1cade..6abc52c3b 100644 --- a/bsp/stm32/stm32l496-ali-developer/board/ports/sdcard_port.c +++ b/bsp/stm32/stm32l496-ali-developer/board/ports/sdcard_port.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l496-ali-developer/rtconfig.h b/bsp/stm32/stm32l496-ali-developer/rtconfig.h index 6d88cf5e4..989c3f473 100644 --- a/bsp/stm32/stm32l496-ali-developer/rtconfig.h +++ b/bsp/stm32/stm32l496-ali-developer/rtconfig.h @@ -39,7 +39,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "lpuart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l4r5-st-nucleo/applications/main.c b/bsp/stm32/stm32l4r5-st-nucleo/applications/main.c index df59d02ff..2dbb2b2c8 100644 --- a/bsp/stm32/stm32l4r5-st-nucleo/applications/main.c +++ b/bsp/stm32/stm32l4r5-st-nucleo/applications/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,12 +19,12 @@ /* defined the LED3 pin: PB14 */ #define LED3_PIN GET_PIN(B, 14) -#define LED_RUN_PIN LED3_PIN +#define LED_RUN_PIN LED3_PIN int main(void) { int count = 1; - + rt_pin_mode(LED_RUN_PIN, PIN_MODE_OUTPUT); while (count++) diff --git a/bsp/stm32/stm32l4r5-st-nucleo/board/board.c b/bsp/stm32/stm32l4r5-st-nucleo/board/board.c index 7ab82ccd5..4b1fccdb4 100644 --- a/bsp/stm32/stm32l4r5-st-nucleo/board/board.c +++ b/bsp/stm32/stm32l4r5-st-nucleo/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,13 +16,13 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /** Configure the main internal regulator output voltage + /** Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST) != HAL_OK) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; @@ -38,7 +38,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /** Initializes the CPU, AHB and APB busses clocks + /** Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; diff --git a/bsp/stm32/stm32l4r5-st-nucleo/board/board.h b/bsp/stm32/stm32l4r5-st-nucleo/board/board.h index 095f50342..b90222c6e 100644 --- a/bsp/stm32/stm32l4r5-st-nucleo/board/board.h +++ b/bsp/stm32/stm32l4r5-st-nucleo/board/board.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-5 SummerGift first version - * 2019-04-09 jhb + * 2019-04-09 jhb */ #ifndef __BOARD_H__ diff --git a/bsp/stm32/stm32l4r5-st-nucleo/rtconfig.h b/bsp/stm32/stm32l4r5-st-nucleo/rtconfig.h index 01b49d13a..23fda8be2 100644 --- a/bsp/stm32/stm32l4r5-st-nucleo/rtconfig.h +++ b/bsp/stm32/stm32l4r5-st-nucleo/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "lpuart1" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/bsp/stm32/stm32l4r9-st-eval/applications/main.c b/bsp/stm32/stm32l4r9-st-eval/applications/main.c index ee74c2edd..c53f70fb9 100644 --- a/bsp/stm32/stm32l4r9-st-eval/applications/main.c +++ b/bsp/stm32/stm32l4r9-st-eval/applications/main.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-06 SummerGift first version - * 2019-04-09 jhb + * 2019-04-09 jhb */ #include diff --git a/bsp/stm32/stm32l4r9-st-eval/board/board.c b/bsp/stm32/stm32l4r9-st-eval/board/board.c index af69f1272..cf4231f00 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/board.c +++ b/bsp/stm32/stm32l4r9-st-eval/board/board.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,13 +16,13 @@ void SystemClock_Config(void) RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; - /**Configure the main internal regulator output voltage + /**Configure the main internal regulator output voltage */ if (HAL_PWREx_ControlVoltageScaling(PWR_REGULATOR_VOLTAGE_SCALE1_BOOST) != HAL_OK) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -37,7 +37,7 @@ void SystemClock_Config(void) { Error_Handler(); } - /**Initializes the CPU, AHB and APB busses clocks + /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; @@ -63,5 +63,5 @@ void SystemClock_Config(void) if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); - } + } } diff --git a/bsp/stm32/stm32l4r9-st-eval/board/board.h b/bsp/stm32/stm32l4r9-st-eval/board/board.h index f9f8adbcf..7d85022bb 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/board.h +++ b/bsp/stm32/stm32l4r9-st-eval/board/board.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2018-11-5 SummerGift first version - * 2019-04-09 jhb + * 2019-04-09 jhb */ #ifndef __BOARD_H__ diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_lcd_dsi.c b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_lcd_dsi.c index 8e926d7e2..e00616eaa 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_lcd_dsi.c +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_lcd_dsi.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -706,17 +706,17 @@ void line() lcd = (struct drv_lcd_dsi_device *)rt_device_find("lcd_dsi"); rt_uint8_t *ptr = lcd->lcd_info.framebuffer; - /* red */ - for (unsigned long long i = LCD_DSI_BUF_SIZE/4/2; i parent, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL); - - + /* red */ + for (unsigned long long i = LCD_DSI_BUF_SIZE/4/2; i parent, RTGRAPHIC_CTRL_RECT_UPDATE, RT_NULL); + + } MSH_CMD_EXPORT(line, line); diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_sram.c b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_sram.c index f77fa05ae..416e6863a 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_sram.c +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_sram.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch.c b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch.c index 314b1d707..dc24066f5 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch.c +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch_ft.c b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch_ft.c index 726be84e0..0d3904444 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch_ft.c +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/drv_touch_ft.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -119,7 +119,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) { return RT_ERROR; } - + if (point_num == 0) { if (s_tp_down) @@ -131,7 +131,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) msg->event = TOUCH_EVENT_NONE; return RT_ERROR; } - + ret = ft_read(ft_i2c_bus, 0x03, point, 6); if (ret < 0) { @@ -147,7 +147,7 @@ static rt_err_t ft_read_point(touch_msg_t msg) } msg->event = TOUCH_EVENT_DOWN; s_tp_down = 1; - + return RT_EOK; } diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/drv_touch.h b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/drv_touch.h index 0e0cfae50..b70dd3eb2 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/drv_touch.h +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/drv_touch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/lcd_port_dsi.h b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/lcd_port_dsi.h index fbc56b4a4..4d602fc34 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/lcd_port_dsi.h +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/lcd_port_dsi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/sram_port.h b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/sram_port.h index a5d89f1d8..f02a735dc 100644 --- a/bsp/stm32/stm32l4r9-st-eval/board/ports/include/sram_port.h +++ b/bsp/stm32/stm32l4r9-st-eval/board/ports/include/sram_port.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/bsp/stm32/stm32l4r9-st-eval/rtconfig.h b/bsp/stm32/stm32l4r9-st-eval/rtconfig.h index ad1ab0532..bd9d6d8d3 100644 --- a/bsp/stm32/stm32l4r9-st-eval/rtconfig.h +++ b/bsp/stm32/stm32l4r9-st-eval/rtconfig.h @@ -40,7 +40,7 @@ #define RT_USING_CONSOLE #define RT_CONSOLEBUF_SIZE 256 #define RT_CONSOLE_DEVICE_NAME "uart3" -#define RT_VER_NUM 0x30104 +#define RT_VER_NUM 0x30105 #define ARCH_ARM #define RT_USING_CPU_FFS #define ARCH_ARM_CORTEX_M diff --git a/components/cplusplus/Lock.h b/components/cplusplus/Lock.h index 08d57c485..c3cc1d2da 100644 --- a/components/cplusplus/Lock.h +++ b/components/cplusplus/Lock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Mail.h b/components/cplusplus/Mail.h index a4c98e400..ae3bfb5c4 100644 --- a/components/cplusplus/Mail.h +++ b/components/cplusplus/Mail.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Mutex.h b/components/cplusplus/Mutex.h index 6fee31515..63efb4a6e 100644 --- a/components/cplusplus/Mutex.h +++ b/components/cplusplus/Mutex.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Queue.h b/components/cplusplus/Queue.h index 23a463879..f6b91e1a2 100644 --- a/components/cplusplus/Queue.h +++ b/components/cplusplus/Queue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Semaphore.h b/components/cplusplus/Semaphore.h index cebaf9123..45c916e16 100644 --- a/components/cplusplus/Semaphore.h +++ b/components/cplusplus/Semaphore.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Thread.h b/components/cplusplus/Thread.h index b57865948..0e681e5c2 100644 --- a/components/cplusplus/Thread.h +++ b/components/cplusplus/Thread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/crt.h b/components/cplusplus/crt.h index 84e5a4b82..903d4c86c 100644 --- a/components/cplusplus/crt.h +++ b/components/cplusplus/crt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/crt_init.c b/components/cplusplus/crt_init.c index fe1293245..a799f36e6 100644 --- a/components/cplusplus/crt_init.c +++ b/components/cplusplus/crt_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Mutex.cpp b/components/cplusplus/cxx_Mutex.cpp similarity index 91% rename from components/cplusplus/Mutex.cpp rename to components/cplusplus/cxx_Mutex.cpp index 229e84244..293e12e68 100644 --- a/components/cplusplus/Mutex.cpp +++ b/components/cplusplus/cxx_Mutex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Semaphore.cpp b/components/cplusplus/cxx_Semaphore.cpp similarity index 91% rename from components/cplusplus/Semaphore.cpp rename to components/cplusplus/cxx_Semaphore.cpp index c977a27c1..c6e364767 100644 --- a/components/cplusplus/Semaphore.cpp +++ b/components/cplusplus/cxx_Semaphore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/Thread.cpp b/components/cplusplus/cxx_Thread.cpp similarity index 97% rename from components/cplusplus/Thread.cpp rename to components/cplusplus/cxx_Thread.cpp index b21fbdce1..c75e56602 100644 --- a/components/cplusplus/Thread.cpp +++ b/components/cplusplus/cxx_Thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/cplusplus/crt.cpp b/components/cplusplus/cxx_crt.cpp similarity index 90% rename from components/cplusplus/crt.cpp rename to components/cplusplus/cxx_crt.cpp index d4cb84f77..fa9f2f602 100644 --- a/components/cplusplus/crt.cpp +++ b/components/cplusplus/cxx_crt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/Kconfig b/components/dfs/Kconfig index c93fd02e6..313072a3d 100644 --- a/components/dfs/Kconfig +++ b/components/dfs/Kconfig @@ -116,43 +116,6 @@ if RT_USING_DFS select RT_USING_MEMHEAP default n - config RT_USING_DFS_UFFS - bool "Enable UFFS file system: Ultra-low-cost Flash File System" - select RT_USING_MTD_NAND - default n - - if RT_USING_DFS_UFFS - choice - prompt "UFFS ECC mode" - default RT_UFFS_ECC_MODE_1 - - config RT_UFFS_ECC_MODE_0 - bool "0: Do not use ECC" - - config RT_UFFS_ECC_MODE_1 - bool "1: UFFS calculate the ECC" - - config RT_UFFS_ECC_MODE_2 - bool "2: Flash driver(or by hardware) calculate the ECC" - - config RT_UFFS_ECC_MODE_3 - bool "3: Hardware calculate the ECC and automatically write to spare." - endchoice - - config RT_UFFS_ECC_MODE - int - default 0 if RT_UFFS_ECC_MODE_0 - default 1 if RT_UFFS_ECC_MODE_1 - default 2 if RT_UFFS_ECC_MODE_2 - default 3 if RT_UFFS_ECC_MODE_3 - - endif - - config RT_USING_DFS_JFFS2 - bool "Enable JFFS2 file system" - select RT_USING_MTD_NOR - default n - config RT_USING_DFS_NFS bool "Using NFS v3 client file system" depends on RT_USING_LWIP diff --git a/components/dfs/filesystems/devfs/devfs.c b/components/dfs/filesystems/devfs/devfs.c index 936b074ce..2e2248d5c 100644 --- a/components/dfs/filesystems/devfs/devfs.c +++ b/components/dfs/filesystems/devfs/devfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -186,6 +186,7 @@ int dfs_device_fs_open(struct dfs_fd *file) result = file->fops->open(file); if (result == RT_EOK || result == -RT_ENOSYS) { + file->type = FT_DEVICE; return 0; } } @@ -197,6 +198,7 @@ int dfs_device_fs_open(struct dfs_fd *file) if (result == RT_EOK || result == -RT_ENOSYS) { file->data = device; + file->type = FT_DEVICE; return RT_EOK; } } @@ -269,7 +271,7 @@ int dfs_device_fs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t co if (count == 0) return -EINVAL; - for (index = 0; index < count && index + root_dirent->read_index < root_dirent->device_count; + for (index = 0; index < count && index + root_dirent->read_index < root_dirent->device_count; index ++) { object = (rt_object_t)root_dirent->devices[root_dirent->read_index + index]; @@ -324,7 +326,7 @@ static const struct dfs_filesystem_ops _device_fs = int devfs_init(void) { - /* register rom file system */ + /* register device file system */ dfs_register(&_device_fs); return 0; diff --git a/components/dfs/filesystems/devfs/devfs.h b/components/dfs/filesystems/devfs/devfs.h index ab2134043..30a9482a3 100644 --- a/components/dfs/filesystems/devfs/devfs.h +++ b/components/dfs/filesystems/devfs/devfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index b4c4c627a..c554003eb 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/elmfat/dfs_elm.h b/components/dfs/filesystems/elmfat/dfs_elm.h index 1e9f57706..36a49bf18 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.h +++ b/components/dfs/filesystems/elmfat/dfs_elm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/jffs2/SConscript b/components/dfs/filesystems/jffs2/SConscript deleted file mode 100644 index 47854393e..000000000 --- a/components/dfs/filesystems/jffs2/SConscript +++ /dev/null @@ -1,50 +0,0 @@ -# RT-Thread building script for component - -from building import * - -cwd = GetCurrentDir() -src = Split(''' -dfs_jffs2.c -porting.c - -cyg/compress/src/adler32.c -cyg/compress/src/compress.c -cyg/compress/src/deflate.c -cyg/compress/src/infback.c -cyg/compress/src/inffast.c -cyg/compress/src/inflate.c -cyg/compress/src/inftrees.c -cyg/compress/src/trees.c -cyg/compress/src/uncompr.c -cyg/compress/src/zutil.c - -cyg/crc/crc16.c -cyg/crc/crc32.c -cyg/crc/posix_crc.c -kernel/rbtree.c -src/build.c -src/compr.c -src/compr_rtime.c -src/compr_rubin.c -src/compr_zlib.c -src/debug.c -src/dir-ecos.c -src/erase.c -src/flashio.c -src/fs-ecos.c -src/gc.c -src/gcthread.c -src/malloc-ecos.c -src/nodelist.c -src/nodemgmt.c -src/read.c -src/readinode.c -src/scan.c -src/write.c -''') - -CPPPATH = [cwd, cwd + '/include', cwd + '/src', cwd + '/cyg', cwd + '/kernel', cwd + '/cyg/compress'] - -group = DefineGroup('Filesystem', src, depend = ['RT_USING_DFS', 'RT_USING_DFS_JFFS2'], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/dfs/filesystems/jffs2/cyg/compress/ChangeLog b/components/dfs/filesystems/jffs2/cyg/compress/ChangeLog deleted file mode 100644 index 295e5cdd4..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/ChangeLog +++ /dev/null @@ -1,218 +0,0 @@ -2009-03-09 John Dallaway - - * cdl/compress_zlib.cdl: Reference test executable filenames for - compatibility with the eCos Configuration Tool. - -2005-10-16 Peter Korsgaard - - * cdl/compress_zlib.cdl (CYGFUN_COMPRESS_ZLIB_GZIO): New option to - include zlib stdio-like utility functions. - -2005-07-27 Peter Korsgaard - - * src/ChangeLog: - * src/configure: - * src/deflate.c: - * src/deflate.h: - * src/FAQ: - * src/gzio.c: - * src/Make_vms.com: - * src/adler32.c: - * src/compress.c: - * src/example.c: - * src/minigzip.c: - * src/infback.c: - * src/inffast.c: - * src/inflate.c: - * src/inflate.h: - * src/inftrees.c: - * src/inftrees.h: - * src/Makefile: - * src/Makefile.in: - * src/README: - * src/README.eCos: - * src/trees.c: - * src/zlib.3: - * src/zutil.c: - * src/zutil.h: - * include/zlib.h: - * include/zconf.h: Upgrade to zlib-1.2.3 - -2005-06-28 Peter Korsgaard - - * src/ChangeLog: - * src/configure: - * src/deflate.c: - * src/deflate.h: - * src/FAQ: - * src/gzio.c: - * src/INDEX: - * src/infback.c: - * src/inffast.c: - * src/inflate.c: - * src/Makefile: - * src/Makefile.in: - * src/README: - * src/trees.c: - * src/zlib.3: - * src/zutil.h: - * include/zlib.h: - * include/zconf.h: Upgrade to zlib-1.2.2 - -2005-03-27 Andrew Lunn - - * tests/zlib1.c: Include diag.h for diag_printf proto. - -2004-05-25 Gary Thomas - - * src/zutil.h: Fix redefine of 'crc32' - - * include/zconf.h: Force define of __ECOS__ to make it easier for - applications to use this library. Also define Z_PREFIX to minimize - namespace pollution. !CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP now - implies NO_GZCOMPRESS and NO_GZIP. - -2004-05-24 Gary Thomas - - * tests/zlib2.c: - * tests/zlib1.c: - * src/zutil.h: - * src/zutil.c: - * src/zlib.3: - * src/uncompr.c: - * src/trees.c: - * src/minigzip.c: - * src/inftrees.h: - * src/inftrees.c: - * src/inflate.h: - * src/inflate.c: - * src/inffixed.h: - * src/inffast.h: - * src/inffast.c: - * src/infback.c: - * src/gzio.c: - * src/example.c: - * src/deflate.h: - * src/deflate.c: - * src/configure: - * src/compress.c: - * src/algorithm.txt: - * src/adler32.c: - * src/README.eCos: - * src/README: - * src/Makefile.in: - * src/Makefile: - * src/INDEX: - * src/FAQ: - * include/zlib.h: - * include/zconf.h: - * cdl/compress_zlib.cdl: Upgrade to zlib-1.2.1 - -2004-04-29 Oyvind Harboe - - * src/inffixed.h: added "const" to tables that do not - change in order to save RAM. Ca. 4k. - -2003-11-20 Andrew Lunn - - * tests/zlib[12].c: Modified the text to the gcc3.3 friendly. - -2003-11-13 Daniel Néri - - * Upgrade to zlib 1.1.4 and additional fix for inflate bug on - machines with 16-bit pointers. - -2003-09-08 Thomas Koeller - - * cdl/compress_zlib.cdl : Displayed package name was wrong. - -2002-10-10 Andrew Lunn - - * include/zutil.h: - * include/zlib.h: - * src/inflate.c (inflate): Use the CRC function from the CRC - package. - * src/crc32.c: Removed. - -2002-09-09 Mark Salter - - * inflate.c (inflate): Fix CRC calculation over multiple invocations - with same output buffer. - -2002-02-18 Jesper Skov - - * src/infblock.c: Applied fix for double-free which could cause a - zlib crash. Fixed indentation. - -2001-10-15 Gary Thomas - - * include/zconf.h: - * cdl/compress_zlib.cdl: - Define new interface CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC which allows - users of this code (applications) to provide their own allocators. - -2001-04-02 Jesper Skov - - * tests/zlib2.c: Removed BAD_CRC state. - -2001-03-12 Jesper Skov - - * src/inflate.c: Remove BAD_CRC state. Do separate CRC for - gzippped data. - * include/zlib.h: Removed Z_BAD_CRC hack. Rename crc32 function. - * src/crc32.c: Include zlib.h header from - include/cyg/compress. Rename function. - * cdl/compress_zlib.cdl: Build the crc32.c file. - -2001-03-09 Jesper Skov - - * src/compress.c: Include zlib.h header from include/cyg/compress. - * src/uncompr.c: Same. - * tests/zlib1.c: Added. - * tests/zlib2.c: Added. - * cdl/compress_zlib.cdl: Compile tests. Compile - files holding compress/uncompress functions. - - * cdl/compress_zlib.cdl: Don't warn about prototypes when building. - -2001-03-08 Jesper Skov - - * cdl/compress_zlib.cdl: Add isoinfra requirement. - - * include/zconf.h: Override STDC check. - - * include/zlib.h: Added new BAD_CRC return type. Comment out crc32 - declaration. - - * src/inflate.c: Added additional states to allow for gzip header - decoding. - - * src/adler32.c: Include zlib.h header from include/cyg/compress. - * src/zutil.h: Same. - - * Import zlib 1.1.3 sources, but leave out some sub - directories. See src/README.eCos for details. - -//=========================================================================== -// ####GPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 or (at your option) any -// later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the -// Free Software Foundation, Inc., 51 Franklin Street, -// Fifth Floor, Boston, MA 02110-1301, USA. -// ------------------------------------------- -// ####GPLCOPYRIGHTEND#### -//=========================================================================== diff --git a/components/dfs/filesystems/jffs2/cyg/compress/cdl/compress_zlib.cdl b/components/dfs/filesystems/jffs2/cyg/compress/cdl/compress_zlib.cdl deleted file mode 100644 index d5787570b..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/cdl/compress_zlib.cdl +++ /dev/null @@ -1,170 +0,0 @@ -# ==================================================================== -# -# compress_zlib.cdl -# -# Zlib compress/decompress configuration data -# -# ==================================================================== -## ####ECOSGPLCOPYRIGHTBEGIN#### -## ------------------------------------------- -## This file is part of eCos, the Embedded Configurable Operating System. -## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. -## -## eCos is free software; you can redistribute it and/or modify it under -## the terms of the GNU General Public License as published by the Free -## Software Foundation; either version 2 or (at your option) any later -## version. -## -## eCos is distributed in the hope that it will be useful, but WITHOUT -## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -## for more details. -## -## You should have received a copy of the GNU General Public License -## along with eCos; if not, write to the Free Software Foundation, Inc., -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -## -## As a special exception, if other files instantiate templates or use -## macros or inline functions from this file, or you compile this file -## and link it with other works to produce a work based on this file, -## this file does not by itself cause the resulting work to be covered by -## the GNU General Public License. However the source code for this file -## must still be made available in accordance with section (3) of the GNU -## General Public License v2. -## -## This exception does not invalidate any other reasons why a work based -## on this file might be covered by the GNU General Public License. -## ------------------------------------------- -## ####ECOSGPLCOPYRIGHTEND#### -# ==================================================================== -######DESCRIPTIONBEGIN#### -# -# Author(s): jskov -# Contributors: -# Date: 2001-03-06 -# -#####DESCRIPTIONEND#### -# -# ==================================================================== - -cdl_package CYGPKG_COMPRESS_ZLIB { - display "Zlib compress and decompress package" - description " - This package provides support for compression and - decompression." - include_dir cyg/compress - - requires CYGPKG_ISOINFRA - requires CYGPKG_CRC - - compile adler32.c compress.c uncompr.c zutil.c trees.c - compile deflate.c infback.c inffast.c inflate.c inftrees.c - - cdl_interface CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC { - display "Override memory allocation routines." - } - - cdl_option CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP { - display "Should deflate() produce 'gzip' compatible output?" - flavor bool - default_value 1 - description " - If this option is set then the output of calling deflate() - will be wrapped up as a 'gzip' compatible file." - } - - cdl_option CYGSEM_COMPRESS_ZLIB_NEEDS_MALLOC { - display "Does this library need malloc?" - flavor bool - active_if { CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC == 0 } - requires CYGPKG_MEMALLOC - no_define - default_value 1 - description " - This pseudo-option will force the memalloc library to be - required iff the application does not provide it's own - infrastructure." - } - - cdl_option CYGFUN_COMPRESS_ZLIB_GZIO { - display "Include stdio-like utility functions" - flavor bool - requires CYGINT_ISO_STDIO_FILEPOS - requires CYGINT_ISO_STRING_STRFUNCS - requires CYGINT_ISO_STDIO_FORMATTED_IO - requires CYGINT_ISO_STDIO_FILEACCESS - default_value { CYGPKG_LIBC_STDIO_OPEN ? 1 : 0 } - compile gzio.c - description " - This option enables the stdio-like zlib utility functions - (gzread/gzwrite and friends) provided in gzio.c." - } - - -# ==================================================================== - - cdl_component CYGPKG_COMPRESS_ZLIB_OPTIONS { - display "Zlib compress and decompress package build options" - flavor none - no_define - description " - Package specific build options including control over - compiler flags used only in building this package, - and details of which tests are built." - - cdl_option CYGPKG_COMPRESS_ZLIB_CFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "-D__ECOS__ -DNO_ERRNO_H" } - description " - This option modifies the set of compiler flags for - building this package. These flags are used in addition - to the set of global flags." - } - - cdl_option CYGPKG_COMPRESS_ZLIB_CFLAGS_REMOVE { - display "Suppressed compiler flags" - flavor data - no_define - default_value { "-Wstrict-prototypes" } - description " - This option modifies the set of compiler flags for - building this package. These flags are removed from - the set of global flags if present." - } - - cdl_option CYGPKG_COMPRESS_ZLIB_LDFLAGS_ADD { - display "Additional compiler flags" - flavor data - no_define - default_value { "" } - description " - This option modifies the set of compiler flags for - building this package. These flags are used in addition - to the set of global flags." - } - - cdl_option CYGPKG_COMPRESS_ZLIB_LDFLAGS_REMOVE { - display "Suppressed compiler flags" - flavor data - no_define - default_value { "" } - description " - This option modifies the set of compiler flags for - building this package. These flags are removed from - the set of global flags if present." - } - - } - - cdl_option CYGPKG_COMPRESS_ZLIB_TESTS { - display "zlib tests" - flavor data - no_define - calculated { "tests/zlib1 tests/zlib2" } - } -} - -# ==================================================================== -# EOF compress_zlib.cdl diff --git a/components/dfs/filesystems/jffs2/cyg/compress/include/zconf.h b/components/dfs/filesystems/jffs2/cyg/compress/include/zconf.h deleted file mode 100644 index 09608dcc3..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/include/zconf.h +++ /dev/null @@ -1,349 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -// #ifdef __ECOS__ -#undef __ECOS__ -#define __ECOS__ -#define Z_PREFIX -#include -#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0 -#define MY_ZCALLOC -#endif -#ifdef CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP -#undef MAX_WBITS -#define MAX_WBITS 15+16 /* 32K LZ77 window */ -#else -#define NO_GZIP -#define NO_GZCOMPRESS -#endif -// #endif - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/include/zlib.h b/components/dfs/filesystems/jffs2/cyg/compress/include/zlib.h deleted file mode 100644 index 081e7c912..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/include/zlib.h +++ /dev/null @@ -1,1358 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumualte before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it gets to the next deflate block boundary. When decoding the - zlib or gzip format, this will cause inflate() to return immediately after - the header and before the first block. When doing a raw inflate, inflate() - will go ahead and process the first block, and will return when it gets to - the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. Z_FIXED prevents the - use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. In addition, the - current implementation of deflate will use at most the window size minus - 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - a crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg - is set to null if there is no error message. inflateInit2 does not perform - any decompression apart from reading the zlib header if present: this will - be done by inflate(). (So next_in and avail_in may be modified, but next_out - and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK can be used to - force inflate() to return immediately after header processing is complete - and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When - any of extra, name, or comment are not Z_NULL and the respective field is - not present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns 1 if file is being read directly without decompression, otherwise - zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -#ifndef __ECOS__ -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is NULL, this function returns the required initial - value for the for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ -#endif // __ECOS__ - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/ChangeLog b/components/dfs/filesystems/jffs2/cyg/compress/src/ChangeLog deleted file mode 100644 index dfdd0295e..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/ChangeLog +++ /dev/null @@ -1,854 +0,0 @@ - ChangeLog file for zlib - -Changes in 1.2.2 (3 October 2004) -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Added zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/FAQ b/components/dfs/filesystems/jffs2/cyg/compress/src/FAQ deleted file mode 100644 index 441d910da..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/FAQ +++ /dev/null @@ -1,339 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://www.zlib.org which may have more recent information. -The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. - See the file win32/DLL_FAQ.txt in the zlib distribution. - Pointers to the precompiled DLL are found in the zlib web site at - http://www.zlib.org. - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm - * contrib/visual-basic.txt in the zlib distribution - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress, the length of the compressed - buffer is equal to the total size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not - zero. When setting the parameter flush equal to Z_FINISH, also make sure - that avail_out is big enough to allow processing all pending input. - Note that a Z_BUF_ERROR is not fatal--another call to deflate() or - inflate() can be made with more input or output space. A Z_BUF_ERROR - may in fact be unavoidable depending on how the functions are used, since - it is not possible to tell whether or not there is more output pending - when strm.avail_out returns with zero. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h for the moment, and Francis S. Lin has converted it to a - web page zlib.html. Volunteers to transform this to Unix-style man pages, - please contact us (zlib@gzip.org). Examples of zlib usage are in the files - example.c and minigzip.c. - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple - package. zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of - zlib. Please try to reproduce the problem with a small program and send - the corresponding source to us at zlib@gzip.org . Do not send - multi-megabyte data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - make clean - ./configure -s - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to it. - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ . - To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip - formats use the same compressed data format internally, but have different - headers and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about - a single file, such as the name and last modification date. The zlib - format on the other hand was designed for in-memory and communication - channel applications, and has a much more compact header and trailer and - uses a faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode - the gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's Init functions allow - for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - It should. It has been tested on 64-bit machines, and has no dependence - on any data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format - than does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically - use Z_FULL_FLUSH, carefully write all the pending data at those points, - and keep an index of those locations, then you can start decompression - at those points. You have to be careful to not use Z_FULL_FLUSH too - often, since it can significantly degrade compression. - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - We don't know for sure. We have heard occasional reports of success on - these systems. If you do use it on one of these, please provide us with - a report, instructions, and patches that we can reference when we get - these questions. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at - to understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit - only if the compiler's "long" type is 32 bits. If the compiler's "long" - type is 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib - is compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of a 4K string space, other than the caller of - gzprintf() assuring that the output will not exceed 4K. On the other - hand, if zlib is compiled to use snprintf() or vsnprintf(), which should - normally be the case, then there is no vulnerability. The ./configure - script will display warnings if an insecure variation of sprintf() will - be used by gzprintf(). Also the zlibCompileFlags() function will return - information on what variant of sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://www.zlib.org/ - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly. So now, we simply make sure that the code always - works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of - deflate is not affected. This only started showing up recently since - zlib 1.2.x uses malloc() by default for allocations, whereas earlier - versions used calloc(), which zeros out the allocated memory. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very weak - and can be broken with freely available programs. To get strong encryption, - use GnuPG, http://www.gnupg.org/ , which already includes zlib compression. - For PKZIP compatible "encryption", look at http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion - with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specficiation in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. - In any case, the compression improvements are so modest compared to other - more modern approaches, that it's not worth the effort to implement. - -41. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/INDEX b/components/dfs/filesystems/jffs2/cyg/compress/src/INDEX deleted file mode 100644 index 0587e5902..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/INDEX +++ /dev/null @@ -1,51 +0,0 @@ -ChangeLog history of changes -FAQ Frequently Asked Questions about zlib -INDEX this file -Makefile makefile for Unix (generated by configure) -Makefile.in makefile for Unix (template for configure) -README guess what -algorithm.txt description of the (de)compression algorithm -configure configure script for Unix -zconf.in.h template for zconf.h (used by configure) - -amiga/ makefiles for Amiga SAS C -as400/ makefiles for IBM AS/400 -msdos/ makefiles for MSDOS -old/ makefiles for various architectures and zlib documentation - files that have not yet been updated for zlib 1.2.x -projects/ projects for various Integrated Development Environments -qnx/ makefiles for QNX -win32/ makefiles for Windows - - zlib public header files (must be kept): -zconf.h -zlib.h - - private source files used to build the zlib library: -adler32.c -compress.c -crc32.c -crc32.h -deflate.c -deflate.h -gzio.c -infback.c -inffast.c -inffast.h -inffixed.h -inflate.c -inflate.h -inftrees.c -inftrees.h -trees.c -trees.h -uncompr.c -zutil.c -zutil.h - - source files for sample programs: -example.c -minigzip.c - - unsupported contribution by third parties -See contrib/README.contrib diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/Make_vms.com b/components/dfs/filesystems/jffs2/cyg/compress/src/Make_vms.com deleted file mode 100644 index c2a1fb54b..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/Make_vms.com +++ /dev/null @@ -1,461 +0,0 @@ -$! make libz under VMS written by -$! Martin P.J. Zinser -$! -$! -$ on error then goto err_exit -$! -$! -$! Just some general constants... -$! -$ true = 1 -$ false = 0 -$ tmpnam = "temp_" + f$getjpi("","pid") -$ SAY = "WRITE SYS$OUTPUT" -$! -$! Setup variables holding "config" information -$! -$ Make = "" -$ name = "Zlib" -$ version = "?.?.?" -$ v_string = "ZLIB_VERSION" -$ v_file = "zlib.h" -$ ccopt = "" -$ lopts = "" -$ linkonly = false -$ optfile = name + ".opt" -$ its_decc = false -$ its_vaxc = false -$ its_gnuc = false -$ axp = f$getsyi("HW_MODEL").ge.1024 -$ s_case = false -$! Check for MMK/MMS -$! -$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" -$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" -$! -$! -$ gosub find_version -$! -$ gosub check_opts -$! -$! Look for the compiler used -$! -$ gosub check_compiler -$ if its_decc -$ then -$ ccopt = "/prefix=all" + ccopt -$ if f$trnlnm("SYS") .eqs. "" -$ then -$ if axp -$ then -$ define sys sys$library: -$ else -$ ccopt = "/decc" + ccopt -$ define sys decc$library_include: -$ endif -$ endif -$ endif -$ if its_vaxc .or. its_gnuc -$ then -$ if f$trnlnm("SYS").eqs."" then define sys sys$library: -$ endif -$! -$! Build the thing plain or with mms -$! -$ write sys$output "Compiling Zlib sources ..." -$ if make.eqs."" -$ then -$ dele example.obj;*,minigzip.obj;* -$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - - adler32.c zlib.h zconf.h -$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - - compress.c zlib.h zconf.h -$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - - crc32.c zlib.h zconf.h -$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - - deflate.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - - gzio.c zutil.h zlib.h zconf.h -$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - - infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - - inffast.c zutil.h zlib.h zconf.h inffast.h -$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - - inflate.c zutil.h zlib.h zconf.h infblock.h -$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - - inftrees.c zutil.h zlib.h zconf.h inftrees.h -$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - - trees.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - - uncompr.c zlib.h zconf.h -$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - - zutil.c zutil.h zlib.h zconf.h -$ write sys$output "Building Zlib ..." -$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ -$ write sys$output "Building example..." -$ CALL MAKE example.OBJ "CC ''CCOPT' example" - - example.c zlib.h zconf.h -$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb -$ if f$search("x11vms:xvmsutils.olb") .nes. "" -$ then -$ write sys$output "Building minigzip..." -$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - - minigzip.c zlib.h zconf.h -$ call make minigzip.exe - - "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - - minigzip.obj libz.olb -$ endif -$ else -$ gosub crea_mms -$ SAY "Make ''name' ''version' with ''Make' " -$ 'make' -$ endif -$! -$! Alpha gets a shareable image -$! -$ If axp -$ Then -$ gosub crea_olist -$ write sys$output "Creating libzshr.exe" -$ call anal_obj_axp modules.opt _link.opt -$ if s_case -$ then -$ open/append optf modules.opt -$ write optf "case_sensitive=YES" -$ close optf -$ endif -$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt -$ endif -$ write sys$output "Zlib build completed" -$ exit -$CC_ERR: -$ write sys$output "C compiler required to build ''name'" -$ goto err_exit -$ERR_EXIT: -$ set message/facil/ident/sever/text -$ write sys$output "Exiting..." -$ exit 2 -$! -$! -$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES -$ V = 'F$Verify(0) -$! P1 = What we are trying to make -$! P2 = Command to make it -$! P3 - P8 What it depends on -$ -$ If F$Search(P1) .Eqs. "" Then Goto Makeit -$ Time = F$CvTime(F$File(P1,"RDT")) -$arg=3 -$Loop: -$ Argument = P'arg -$ If Argument .Eqs. "" Then Goto Exit -$ El=0 -$Loop2: -$ File = F$Element(El," ",Argument) -$ If File .Eqs. " " Then Goto Endl -$ AFile = "" -$Loop3: -$ OFile = AFile -$ AFile = F$Search(File) -$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl -$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit -$ Goto Loop3 -$NextEL: -$ El = El + 1 -$ Goto Loop2 -$EndL: -$ arg=arg+1 -$ If arg .Le. 8 Then Goto Loop -$ Goto Exit -$ -$Makeit: -$ VV=F$VERIFY(0) -$ write sys$output P2 -$ 'P2 -$ VV='F$Verify(VV) -$Exit: -$ If V Then Set Verify -$ENDSUBROUTINE -$!------------------------------------------------------------------------------ -$! -$! Check command line options and set symbols accordingly -$! -$ CHECK_OPTS: -$ i = 1 -$ OPT_LOOP: -$ if i .lt. 9 -$ then -$ cparm = f$edit(p'i',"upcase") -$ if cparm .eqs. "DEBUG" -$ then -$ ccopt = ccopt + "/noopt/deb" -$ lopts = lopts + "/deb" -$ endif -$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ ccopt = ccopt + f$extract(start,len,cparm) -$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) - - then s_case = true -$ endif -$ if cparm .eqs. "LINK" then linkonly = true -$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ lopts = lopts + f$extract(start,len,cparm) -$ endif -$ if f$locate("CC=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ cc_com = f$extract(start,len,cparm) - if (cc_com .nes. "DECC") .and. - - (cc_com .nes. "VAXC") .and. - - (cc_com .nes. "GNUC") -$ then -$ write sys$output "Unsupported compiler choice ''cc_com' ignored" -$ write sys$output "Use DECC, VAXC, or GNUC instead" -$ else -$ if cc_com .eqs. "DECC" then its_decc = true -$ if cc_com .eqs. "VAXC" then its_vaxc = true -$ if cc_com .eqs. "GNUC" then its_gnuc = true -$ endif -$ endif -$ if f$locate("MAKE=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ mmks = f$extract(start,len,cparm) -$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") -$ then -$ make = mmks -$ else -$ write sys$output "Unsupported make choice ''mmks' ignored" -$ write sys$output "Use MMK or MMS instead" -$ endif -$ endif -$ i = i + 1 -$ goto opt_loop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Look for the compiler used -$! -$CHECK_COMPILER: -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then -$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "") -$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "") -$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "") -$ endif -$! -$! Exit if no compiler available -$! -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then goto CC_ERR -$ else -$ if its_decc then write sys$output "CC compiler check ... Compaq C" -$ if its_vaxc then write sys$output "CC compiler check ... VAX C" -$ if its_gnuc then write sys$output "CC compiler check ... GNU C" -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! If MMS/MMK are available dump out the descrip.mms if required -$! -$CREA_MMS: -$ write sys$output "Creating descrip.mms..." -$ create descrip.mms -$ open/append out descrip.mms -$ copy sys$input: out -$ deck -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser -# - -OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, \ - inftrees.obj, inffast.obj - -$ eod -$ write out "CFLAGS=", ccopt -$ write out "LOPTS=", lopts -$ copy sys$input: out -$ deck - -all : example.exe minigzip.exe libz.olb - @ write sys$output " Example applications available" - -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link $(LOPTS) example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib - -clean : - delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* - - -# Other dependencies. -adler32.obj : adler32.c zutil.h zlib.h zconf.h -compress.obj : compress.c zlib.h zconf.h -crc32.obj : crc32.c zutil.h zlib.h zconf.h -deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h -example.obj : example.c zlib.h zconf.h -gzio.obj : gzio.c zutil.h zlib.h zconf.h -inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h -inflate.obj : inflate.c zutil.h zlib.h zconf.h -inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h -minigzip.obj : minigzip.c zlib.h zconf.h -trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h -uncompr.obj : uncompr.c zlib.h zconf.h -zutil.obj : zutil.c zutil.h zlib.h zconf.h -infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ eod -$ close out -$ return -$!------------------------------------------------------------------------------ -$! -$! Read list of core library sources from makefile.in and create options -$! needed to build shareable image -$! -$CREA_OLIST: -$ open/read min makefile.in -$ open/write mod modules.opt -$ src_check = "OBJS =" -$MRLOOP: -$ read/end=mrdone min rec -$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop -$ rec = rec - src_check -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone -$MRSLOOP: -$ read/end=mrdone min rec -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop -$MRDONE: -$ close min -$ close mod -$ return -$!------------------------------------------------------------------------------ -$! -$! Take record extracted in crea_olist and split it into single filenames -$! -$EXTRA_FILNAM: -$ myrec = f$edit(rec - "\", "trim,compress") -$ i = 0 -$FELOOP: -$ srcfil = f$element(i," ", myrec) -$ if (srcfil .nes. " ") -$ then -$ write mod f$parse(srcfil,,,"NAME"), ".obj" -$ i = i + 1 -$ goto feloop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Find current Zlib version number -$! -$FIND_VERSION: -$ open/read h_in 'v_file' -$hloop: -$ read/end=hdone h_in rec -$ rec = f$edit(rec,"TRIM") -$ if (f$extract(0,1,rec) .nes. "#") then goto hloop -$ rec = f$edit(rec - "#", "TRIM") -$ if f$element(0," ",rec) .nes. "define" then goto hloop -$ if f$element(1," ",rec) .eqs. v_string -$ then -$ version = 'f$element(2," ",rec)' -$ goto hdone -$ endif -$ goto hloop -$hdone: -$ close h_in -$ return -$!------------------------------------------------------------------------------ -$! -$! Analyze Object files for OpenVMS AXP to extract Procedure and Data -$! information to build a symbol vector for a shareable image -$! All the "brains" of this logic was suggested by Hartmut Becker -$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me -$! (zinser@decus.de), so if you do have problem reports please do not -$! bother Hartmut/HP, but get in touch with me -$! -$ ANAL_OBJ_AXP: Subroutine -$ V = 'F$Verify(0) -$ SAY := "WRITE_ SYS$OUTPUT" -$ -$ IF F$SEARCH("''P1'") .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available" -$ goto exit_aa -$ ENDIF -$ IF "''P2'" .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP: Error, no output file provided" -$ goto exit_aa -$ ENDIF -$ -$ open/read in 'p1 -$ create a.tmp -$ open/append atmp a.tmp -$ loop: -$ read/end=end_loop in line -$ f= f$search(line) -$ if f .eqs. "" -$ then -$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'" -$ goto loop -$ endif -$ define/user sys$output nl: -$ define/user sys$error nl: -$ anal/obj/gsd 'f /out=x.tmp -$ open/read xtmp x.tmp -$ XLOOP: -$ read/end=end_xloop xtmp xline -$ xline = f$edit(xline,"compress") -$ write atmp xline -$ goto xloop -$ END_XLOOP: -$ close xtmp -$ goto loop -$ end_loop: -$ close in -$ close atmp -$ if f$search("a.tmp") .eqs. "" - - then $ exit -$ ! all global definitions -$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp -$ ! all procedures -$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp -$ search c.tmp "symbol:"/out=d.tmp -$ define/user sys$output nl: -$ edito/edt/command=sys$input d.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=PROCEDURE)/whole -exit -$ ! all data -$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp -$ search e.tmp "symbol:"/out=f.tmp -$ define/user sys$output nl: -$ edito/edt/command=sys$input f.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=DATA)/whole -exit -$ sort/nodupl d.tmp,f.tmp 'p2' -$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;* -$ if f$search("x.tmp") .nes. "" - - then $ delete x.tmp;* -$! -$ EXIT_AA: -$ if V then set verify -$ endsubroutine -$!------------------------------------------------------------------------------ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile b/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile deleted file mode 100644 index 2fd6e45c4..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile +++ /dev/null @@ -1,154 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2005 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# The call of configure is optional if you don't have special requirements -# If you wish to build zlib as a shared library, use: ./configure -s - -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -LDFLAGS=libz.a -LDSHARED=$(CC) -CPP=$(CC) -E - -LIBS=libz.a -SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.3 -SHAREDLIBM=libz.so.1 - -AR=ar rc -RANLIB=ranlib -TAR=tar -SHELL=/bin/sh -EXE= - -prefix = /usr/local -exec_prefix = ${prefix} -libdir = ${exec_prefix}/lib -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example$(EXE) minigzip$(EXE) - -check: test -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -$(SHAREDLIBV): $(OBJS) - $(LDSHARED) -o $@ $(OBJS) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) - -example$(EXE): example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip$(EXE): minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -install: $(LIBS) - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi - cp zlib.h zconf.h $(includedir) - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h - cp $(LIBS) $(libdir) - cd $(libdir); chmod 755 $(LIBS) - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 - cd $(libdir); if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIB) $(SHAREDLIBM); \ - ln -s $(SHAREDLIBV) $(SHAREDLIB); \ - ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ - (ldconfig || true) >/dev/null 2>&1; \ - fi - cp zlib.3 $(man3dir) - chmod 644 $(man3dir)/zlib.3 -# The ranlib in install is needed on NeXTSTEP which checks file times -# ldconfig is for Linux - -uninstall: - cd $(includedir); \ - cd $(libdir); rm -f libz.a; \ - if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ - fi - cd $(man3dir); rm -f zlib.3 - -mostlyclean: clean -clean: - rm -f *.o *~ example$(EXE) minigzip$(EXE) \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o - -maintainer-clean: distclean -distclean: clean - cp -p Makefile.in Makefile - cp -p zconf.in.h zconf.h - rm -f .DS_Store - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.in b/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.in deleted file mode 100644 index 2fd6e45c4..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.in +++ /dev/null @@ -1,154 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2005 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# The call of configure is optional if you don't have special requirements -# If you wish to build zlib as a shared library, use: ./configure -s - -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -LDFLAGS=libz.a -LDSHARED=$(CC) -CPP=$(CC) -E - -LIBS=libz.a -SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.3 -SHAREDLIBM=libz.so.1 - -AR=ar rc -RANLIB=ranlib -TAR=tar -SHELL=/bin/sh -EXE= - -prefix = /usr/local -exec_prefix = ${prefix} -libdir = ${exec_prefix}/lib -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example$(EXE) minigzip$(EXE) - -check: test -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -$(SHAREDLIBV): $(OBJS) - $(LDSHARED) -o $@ $(OBJS) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) - -example$(EXE): example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip$(EXE): minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -install: $(LIBS) - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi - cp zlib.h zconf.h $(includedir) - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h - cp $(LIBS) $(libdir) - cd $(libdir); chmod 755 $(LIBS) - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 - cd $(libdir); if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIB) $(SHAREDLIBM); \ - ln -s $(SHAREDLIBV) $(SHAREDLIB); \ - ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ - (ldconfig || true) >/dev/null 2>&1; \ - fi - cp zlib.3 $(man3dir) - chmod 644 $(man3dir)/zlib.3 -# The ranlib in install is needed on NeXTSTEP which checks file times -# ldconfig is for Linux - -uninstall: - cd $(includedir); \ - cd $(libdir); rm -f libz.a; \ - if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ - fi - cd $(man3dir); rm -f zlib.3 - -mostlyclean: clean -clean: - rm -f *.o *~ example$(EXE) minigzip$(EXE) \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o - -maintainer-clean: distclean -distclean: clean - cp -p Makefile.in Makefile - cp -p zconf.in.h zconf.h - rm -f .DS_Store - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.riscos b/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.riscos deleted file mode 100644 index d97f44923..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/Makefile.riscos +++ /dev/null @@ -1,151 +0,0 @@ -# Project: zlib_1_03 -# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 -# test works out-of-the-box, installs `somewhere' on demand - -# Toolflags: -CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah -C++flags = -c -depend !Depend -IC: -throwback -Linkflags = -aif -c++ -o $@ -ObjAsmflags = -throwback -NoCache -depend !Depend -CMHGflags = -LibFileflags = -c -l -o $@ -Squeezeflags = -o $@ - -# change the line below to where _you_ want the library installed. -libdest = lib:zlib - -# Final targets: -@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ - @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ - @.o.uncompr @.o.zutil - LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ - @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ - @.o.trees @.o.uncompr @.o.zutil -test: @.minigzip @.example @.lib - @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV - @echo running tests: hang on. - @/@.minigzip -f -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -f -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -1 libc - @/@.minigzip -d libc-gz - @diff @.lib @.libc - @echo that should have reported '@.lib and @.libc identical' if you have diff. - @/@.example @.fred @.fred - @echo that will have given lots of hello!'s. - -@.minigzip: @.o.minigzip @.lib C:o.Stubs - Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs -@.example: @.o.example @.lib C:o.Stubs - Link $(Linkflags) @.o.example @.lib C:o.Stubs - -install: @.lib - cdir $(libdest) - cdir $(libdest).h - @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV - @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV - @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV - @echo okay, installed zlib in $(libdest) - -clean:; remove @.minigzip - remove @.example - remove @.libc - -wipe @.o.* F~r~cV - remove @.fred - -# User-editable dependencies: -.c.o: - cc $(ccflags) -o $@ $< - -# Static dependencies: - -# Dynamic dependencies: -o.example: c.example -o.example: h.zlib -o.example: h.zconf -o.minigzip: c.minigzip -o.minigzip: h.zlib -o.minigzip: h.zconf -o.adler32: c.adler32 -o.adler32: h.zlib -o.adler32: h.zconf -o.compress: c.compress -o.compress: h.zlib -o.compress: h.zconf -o.crc32: c.crc32 -o.crc32: h.zlib -o.crc32: h.zconf -o.deflate: c.deflate -o.deflate: h.deflate -o.deflate: h.zutil -o.deflate: h.zlib -o.deflate: h.zconf -o.gzio: c.gzio -o.gzio: h.zutil -o.gzio: h.zlib -o.gzio: h.zconf -o.infblock: c.infblock -o.infblock: h.zutil -o.infblock: h.zlib -o.infblock: h.zconf -o.infblock: h.infblock -o.infblock: h.inftrees -o.infblock: h.infcodes -o.infblock: h.infutil -o.infcodes: c.infcodes -o.infcodes: h.zutil -o.infcodes: h.zlib -o.infcodes: h.zconf -o.infcodes: h.inftrees -o.infcodes: h.infblock -o.infcodes: h.infcodes -o.infcodes: h.infutil -o.infcodes: h.inffast -o.inffast: c.inffast -o.inffast: h.zutil -o.inffast: h.zlib -o.inffast: h.zconf -o.inffast: h.inftrees -o.inffast: h.infblock -o.inffast: h.infcodes -o.inffast: h.infutil -o.inffast: h.inffast -o.inflate: c.inflate -o.inflate: h.zutil -o.inflate: h.zlib -o.inflate: h.zconf -o.inflate: h.infblock -o.inftrees: c.inftrees -o.inftrees: h.zutil -o.inftrees: h.zlib -o.inftrees: h.zconf -o.inftrees: h.inftrees -o.inftrees: h.inffixed -o.infutil: c.infutil -o.infutil: h.zutil -o.infutil: h.zlib -o.infutil: h.zconf -o.infutil: h.infblock -o.infutil: h.inftrees -o.infutil: h.infcodes -o.infutil: h.infutil -o.trees: c.trees -o.trees: h.deflate -o.trees: h.zutil -o.trees: h.zlib -o.trees: h.zconf -o.trees: h.trees -o.uncompr: c.uncompr -o.uncompr: h.zlib -o.uncompr: h.zconf -o.zutil: c.zutil -o.zutil: h.zutil -o.zutil: h.zlib -o.zutil: h.zconf diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/README b/components/dfs/filesystems/jffs2/cyg/compress/src/README deleted file mode 100644 index 758cc5002..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/README +++ /dev/null @@ -1,125 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.3 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). These documents are also available in other -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile. In short "make test; make install" should work for most -machines. For Unix: "./configure; make test; make install". For MSDOS, use one -of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, -please check this site to verify that you have the latest version of zlib; -otherwise get the latest version and check whether the problem still exists or -not. - -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking -for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://dogma.net/markn/articles/zlibtool/zlibtool.htm - -The changes made in version 1.2.3 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html -See the zlib home page http://www.zlib.org for details. - -A Perl interface to zlib written by Paul Marquess is in the -CPAN (Comprehensive Perl Archive Network) sites -http://www.cpan.org/modules/by-module/Compress/ - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries is -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - -- When building a shared, i.e. dynamic library on Mac OS X, the library must be - installed before testing (do "make install" before "make test"), since the - library location is specified in the library. - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. Please -read the FAQ for more information on the distribution of modified source -versions. diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/README.eCos b/components/dfs/filesystems/jffs2/cyg/compress/src/README.eCos deleted file mode 100644 index 88011312f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/README.eCos +++ /dev/null @@ -1,27 +0,0 @@ -See the main site http://www.gzip.org/zlib/ for places to download the -complete sources. Currently based on zlib-1.2.3 - -Note that these are not the complete zlib sources - the following -directories have been deleted since they are irrelevant for the -eCos support: - -amiga/ -as400/ -contrib/ -msdos/ -old/ -projects/ -qnx/ -win32/ - -Additionally, local changes has been made to the remaining files. Code -changes are marked by __ECOS__ (comments or definitions). Finally, the -headers zlib.h and zconf.h have been moved out of the directory into -../include. - -crc32.c + crc32.h has also been removed as it is provided by services/crc/. - -Note: zconf.h always defines __ECOS__. This is necessary to support -programs built outside of the eCos tree which may wish to use this -library (so those programs needn't worry about defining __ECOS__) - diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/adler32.c b/components/dfs/filesystems/jffs2/cyg/compress/src/adler32.c deleted file mode 100644 index 2522ee212..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/adler32.c +++ /dev/null @@ -1,153 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#ifdef __ECOS__ -#include -#else -#include "zlib.h" -#endif // __ECOS__ - -#define BASE 65521UL /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware */ -#ifdef NO_DIVIDE -# define MOD(a) \ - do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD4(a) \ - do { \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD4(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD4(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* the derivation of this formula is left as an exercise for the reader */ - rem = (unsigned)(len2 % BASE); - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 > BASE) sum1 -= BASE; - if (sum1 > BASE) sum1 -= BASE; - if (sum2 > (BASE << 1)) sum2 -= (BASE << 1); - if (sum2 > BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/algorithm.txt b/components/dfs/filesystems/jffs2/cyg/compress/src/algorithm.txt deleted file mode 100644 index b022dde31..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/algorithm.txt +++ /dev/null @@ -1,209 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The key question is how to represent a Huffman code (or any prefix code) so -that you can decode fast. The most important characteristic is that shorter -codes are much more common than longer codes, so pay attention to decoding the -short codes fast, and let the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then -to set that variable for the maximum speed. - -For inflate, which has 286 possible codes for the literal/length tree, the size -of the first table is nine bits. Also the distance trees have 30 possible -values, and the size of the first table is six bits. Note that for each of -those cases, the table ended up one bit longer than the ``average'' code -length, i.e. the code length of an approximately flat code which would be a -little more than eight bits for 286 symbols and a little less than five bits -for 30 symbols. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend two much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode as and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -http://www.ietf.org/rfc/rfc1951.txt diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/compress.c b/components/dfs/filesystems/jffs2/cyg/compress/src/compress.c deleted file mode 100644 index f94974537..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/compress.c +++ /dev/null @@ -1,83 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#ifdef __ECOS__ -#include -#else -#include "zlib.h" -#endif // __ECOS__ - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/configure b/components/dfs/filesystems/jffs2/cyg/compress/src/configure deleted file mode 100644 index d7ffdc345..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/configure +++ /dev/null @@ -1,459 +0,0 @@ -#!/bin/sh -# configure script for zlib. This script is needed only if -# you wish to build a shared library and your system supports them, -# of if you need special compiler, flags or install directory. -# Otherwise, you can just use directly "make test; make install" -# -# To create a shared library, use "configure --shared"; by default a static -# library is created. If the primitive shared library support provided here -# does not work, use ftp://prep.ai.mit.edu/pub/gnu/libtool-*.tar.gz -# -# To impose specific compiler or flags or install directory, use for example: -# prefix=$HOME CC=cc CFLAGS="-O4" ./configure -# or for csh/tcsh users: -# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) -# LDSHARED is the command to be used to create a shared library - -# Incorrect settings of CC or CFLAGS may prevent creating a shared library. -# If you have problems, try without defining CC and CFLAGS before reporting -# an error. - -LIBS=libz.a -LDFLAGS="-L. ${LIBS}" -VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` -VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` -AR=${AR-"ar rc"} -RANLIB=${RANLIB-"ranlib"} -prefix=${prefix-/usr/local} -exec_prefix=${exec_prefix-'${prefix}'} -libdir=${libdir-'${exec_prefix}/lib'} -includedir=${includedir-'${prefix}/include'} -mandir=${mandir-'${prefix}/share/man'} -shared_ext='.so' -shared=0 -gcc=0 -old_cc="$CC" -old_cflags="$CFLAGS" - -while test $# -ge 1 -do -case "$1" in - -h* | --h*) - echo 'usage:' - echo ' configure [--shared] [--prefix=PREFIX] [--exec_prefix=EXPREFIX]' - echo ' [--libdir=LIBDIR] [--includedir=INCLUDEDIR]' - exit 0;; - -p*=* | --p*=*) prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; - -e*=* | --e*=*) exec_prefix=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; - -l*=* | --libdir=*) libdir=`echo $1 | sed 's/[-a-z_]*=//'`; shift;; - -i*=* | --includedir=*) includedir=`echo $1 | sed 's/[-a-z_]*=//'`;shift;; - -p* | --p*) prefix="$2"; shift; shift;; - -e* | --e*) exec_prefix="$2"; shift; shift;; - -l* | --l*) libdir="$2"; shift; shift;; - -i* | --i*) includedir="$2"; shift; shift;; - -s* | --s*) shared=1; shift;; - *) echo "unknown option: $1"; echo "$0 --help for help"; exit 1;; - esac -done - -test=ztest$$ -cat > $test.c </dev/null; then - CC="$cc" - SFLAGS=${CFLAGS-"-fPIC -O3"} - CFLAGS="$cflags" - case `(uname -s || echo unknown) 2>/dev/null` in - Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; - CYGWIN* | Cygwin* | cygwin* | OS/2* ) - EXE='.exe';; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};; - HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so';; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl';; - esac;; - Darwin*) shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};; - *) LDSHARED=${LDSHARED-"$cc -shared"};; - esac -else - # find system name and corresponding cc options - CC=${CC-cc} - case `(uname -sr || echo unknown) 2>/dev/null` in - HP-UX*) SFLAGS=${CFLAGS-"-O +z"} - CFLAGS=${CFLAGS-"-O"} -# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} - LDSHARED=${LDSHARED-"ld -b"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so';; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl';; - esac;; - IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} - CFLAGS=${CFLAGS-"-ansi -O2"} - LDSHARED=${LDSHARED-"cc -shared"};; - OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};; - OSF1*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared"};; - QNX*) SFLAGS=${CFLAGS-"-4 -O"} - CFLAGS=${CFLAGS-"-4 -O"} - LDSHARED=${LDSHARED-"cc"} - RANLIB=${RANLIB-"true"} - AR="cc -A";; - SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} - CFLAGS=${CFLAGS-"-O3"} - LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};; - SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."} - CFLAGS=${CFLAGS-"-fast -xcg89"} - LDSHARED=${LDSHARED-"cc -G"};; - SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} - CFLAGS=${CFLAGS-"-O2"} - LDSHARED=${LDSHARED-"ld"};; - SunStudio\ 9*) SFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} - CFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xtarget=ultra3 -xarch=v9b"} - LDSHARED=${LDSHARED-"cc -xarch=v9b"};; - UNIX_System_V\ 4.2.0) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - UNIX_SV\ 4.2MP) - SFLAGS=${CFLAGS-"-Kconform_pic -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - OpenUNIX\ 5) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - AIX*) # Courtesy of dbakker@arrayasolutions.com - SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - LDSHARED=${LDSHARED-"xlc -G"};; - # send working options for other systems to support@gzip.org - *) SFLAGS=${CFLAGS-"-O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -shared"};; - esac -fi - -SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} -SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} -SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} - -if test $shared -eq 1; then - echo Checking for shared library support... - # we must test in two steps (cc then ld), required at least on SunOS 4.x - if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && - test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then - CFLAGS="$SFLAGS" - LIBS="$SHAREDLIBV" - echo Building shared library $SHAREDLIBV with $CC. - elif test -z "$old_cc" -a -z "$old_cflags"; then - echo No shared library support. - shared=0; - else - echo 'No shared library support; try without defining CC and CFLAGS' - shared=0; - fi -fi -if test $shared -eq 0; then - LDSHARED="$CC" - echo Building static library $LIBS version $VER with $CC. -else - LDFLAGS="-L. ${SHAREDLIBV}" -fi - -cat > $test.c < -int main() { return 0; } -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h - echo "Checking for unistd.h... Yes." -else - cp -p zconf.in.h zconf.h - echo "Checking for unistd.h... No." -fi - -cat > $test.c < -#include -#include "zconf.h" - -int main() -{ -#ifndef STDC - choke me -#endif - - return 0; -} -EOF - -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()" - - cat > $test.c < -#include - -int mytest(char *fmt, ...) -{ - char buf[20]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return 0; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then - echo "Checking for vsnprintf() in stdio.h... Yes." - - cat >$test.c < -#include - -int mytest(char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - - va_start(ap, fmt); - n = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return n; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of vsnprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_vsnprintf_void" - echo "Checking for return value of vsnprintf()... No." - echo " WARNING: apparently vsnprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - else - CFLAGS="$CFLAGS -DNO_vsnprintf" - echo "Checking for vsnprintf() in stdio.h... No." - echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" - echo " can build but will be open to possible buffer-overflow security" - echo " vulnerabilities." - - cat >$test.c < -#include - -int mytest(char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - - va_start(ap, fmt); - n = vsprintf(buf, fmt, ap); - va_end(ap); - return n; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of vsprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_vsprintf_void" - echo "Checking for return value of vsprintf()... No." - echo " WARNING: apparently vsprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - fi -else - echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()" - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - snprintf(buf, sizeof(buf), "%s", "foo"); - return 0; -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then - echo "Checking for snprintf() in stdio.h... Yes." - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - return snprintf(buf, sizeof(buf), "%s", "foo"); -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of snprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_snprintf_void" - echo "Checking for return value of snprintf()... No." - echo " WARNING: apparently snprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - else - CFLAGS="$CFLAGS -DNO_snprintf" - echo "Checking for snprintf() in stdio.h... No." - echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" - echo " can build but will be open to possible buffer-overflow security" - echo " vulnerabilities." - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - return sprintf(buf, "%s", "foo"); -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of sprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_sprintf_void" - echo "Checking for return value of sprintf()... No." - echo " WARNING: apparently sprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - fi -fi - -cat >$test.c < -int main() { return 0; } -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for errno.h... Yes." -else - echo "Checking for errno.h... No." - CFLAGS="$CFLAGS -DNO_ERRNO_H" -fi - -cat > $test.c < -#include -#include -caddr_t hello() { - return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); -} -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - CFLAGS="$CFLAGS -DUSE_MMAP" - echo Checking for mmap support... Yes. -else - echo Checking for mmap support... No. -fi - -CPP=${CPP-"$CC -E"} -case $CFLAGS in - *ASMV*) - if test "`nm $test.o | grep _hello`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. - else - echo Checking for underline in external names... Yes. - fi;; -esac - -rm -f $test.[co] $test $test$shared_ext - -# udpate Makefile -sed < Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^CPP *=/s#=.*#=$CPP# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^LIBS *=/s#=.*#=$LIBS# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^RANLIB *=/s#=.*#=$RANLIB# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -" > Makefile diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.c b/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.c deleted file mode 100644 index 29ce1f64a..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.c +++ /dev/null @@ -1,1736 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifndef FASTEST -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif -#endif -local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; - - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); - - if (length < MIN_MATCH) return Z_OK; - if (length > MAX_DIST(s)) { - length = MAX_DIST(s); - dictionary += dictLength - length; /* use the tail of the dictionary */ - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - lm_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if (func != configuration_table[level].func && strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_PARTIAL_FLUSH); - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; - s->nice_match = nice_length; - s->max_chain_length = max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds - * for every combination of windowBits and memLevel, as well as wrap. - * But even the conservative upper bound of about 14% expansion does not - * seem onerous for output buffer allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong destLen; - - /* conservative upper bound */ - destLen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; - - /* if can't get parameters, return conservative bound */ - if (strm == Z_NULL || strm->state == Z_NULL) - return destLen; - - /* if not default parameters, return conservative bound */ - s = strm->state; - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return destLen; - - /* default settings: return tight bound for that case */ - return compressBound(sourceLen); -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len = strm->state->pending; - - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, strm->state->pending_out, len); - strm->next_out += len; - strm->state->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_FINISH || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } -#ifdef GZIP - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; - } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; - } - } - else - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } - } - else - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; - } - else - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) - flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - } - } - else - s->status = BUSY_STATE; - } -#endif - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy(dest, source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy(ds, ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); - } -#endif - zmemcpy(buf, strm->next_in, len); - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ -#endif /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for level == 1 or strategy == Z_RLE only - */ -local uInt longest_match_fast(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - /* %%% avoid this when Z_RLE */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) return; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, eof) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (eof)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, eof) { \ - FLUSH_BLOCK_ONLY(s, eof); \ - if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ -#ifdef FASTEST - if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) || - (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { - s->match_length = longest_match_fast (s, hash_head); - } -#else - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } -#endif - /* longest_match() or longest_match_fast() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } - /* longest_match() or longest_match_fast() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif /* FASTEST */ - -#if 0 -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt run; /* length of run */ - uInt max; /* maximum length of run */ - uInt prev; /* byte at distance one to match */ - Bytef *scan; /* scan for end of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest encodable run. - */ - if (s->lookahead < MAX_MATCH) { - fill_window(s); - if (s->lookahead < MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - run = 0; - if (s->strstart > 0) { /* if there is a previous byte, that is */ - max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH; - scan = s->window + s->strstart - 1; - prev = *scan++; - do { - if (*scan++ != prev) - break; - } while (++run < max); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (run >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, run); - _tr_tally_dist(s, 1, run - MIN_MATCH, bflush); - s->lookahead -= run; - s->strstart += run; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.h b/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.h deleted file mode 100644 index 05a5ab3a2..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/deflate.h +++ /dev/null @@ -1,331 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2004 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - - /* in trees.c */ -void _tr_init OF((deflate_state *s)); -int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); -void _tr_align OF((deflate_state *s)); -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch _length_code[]; - extern uch _dist_code[]; -#else - extern const uch _length_code[]; - extern const uch _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/descrip.mms b/components/dfs/filesystems/jffs2/cyg/compress/src/descrip.mms deleted file mode 100644 index 9d364598a..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/descrip.mms +++ /dev/null @@ -1,48 +0,0 @@ -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser - -cc_defs = -c_deb = - -.ifdef __DECC__ -pref = /prefix=all -.endif - -OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\ - inftrees.obj, infcodes.obj, infutil.obj, inffast.obj - -CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF) - -all : example.exe minigzip.exe - @ write sys$output " Example applications available" -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib - -clean : - delete *.obj;*,libz.olb;* - - -# Other dependencies. -adler32.obj : zutil.h zlib.h zconf.h -compress.obj : zlib.h zconf.h -crc32.obj : zutil.h zlib.h zconf.h -deflate.obj : deflate.h zutil.h zlib.h zconf.h -example.obj : zlib.h zconf.h -gzio.obj : zutil.h zlib.h zconf.h -infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h -infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h -inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h -inflate.obj : zutil.h zlib.h zconf.h infblock.h -inftrees.obj : zutil.h zlib.h zconf.h inftrees.h -infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h -minigzip.obj : zlib.h zconf.h -trees.obj : deflate.h zutil.h zlib.h zconf.h -uncompr.obj : zlib.h zconf.h -zutil.obj : zutil.h zlib.h zconf.h diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/example.c b/components/dfs/filesystems/jffs2/cyg/compress/src/example.c deleted file mode 100644 index 6c8a0ee76..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/example.c +++ /dev/null @@ -1,565 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2004 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include -#include "zlib.h" - -#ifdef STDC -# include -# include -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -const char dictionary[] = "hello"; -uLong dictId; /* Adler32 value of the dictionary */ - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, - Byte *uncompr, uLong uncomprLen)); -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = (uLong)strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(fname, uncompr, uncomprLen) - const char *fname; /* compressed file name */ - Byte *uncompr; - uLong uncomprLen; -{ -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - int len = (int)strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - strcpy((char*)uncompr, "garbage"); - - if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - if (gzungetc(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - - gzclose(file); -#endif -} - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uLong len = (uLong)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uInt len = (uInt)strlen(hello)+1; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (Bytef*)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = (alloc_func)0; - c_stream.zfree = (free_func)0; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (Bytef*)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = (alloc_func)0; - d_stream.zfree = (free_func)0; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/gzio.c b/components/dfs/filesystems/jffs2/cyg/compress/src/gzio.c deleted file mode 100644 index 7e90f4928..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/gzio.c +++ /dev/null @@ -1,1026 +0,0 @@ -/* gzio.c -- IO on .gz files - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. - */ - -/* @(#) $Id$ */ - -#include - -#include "zutil.h" - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef Z_BUFSIZE -# ifdef MAXSEG_64K -# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ -# else -# define Z_BUFSIZE 16384 -# endif -#endif -#ifndef Z_PRINTF_BUFSIZE -# define Z_PRINTF_BUFSIZE 4096 -#endif - -#ifdef __MVS__ -# pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern void free OF((voidpf ptr)); -#endif - -#define ALLOC(size) malloc(size) -#define TRYFREE(p) {if (p) free(p);} - -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define RESERVED 0xE0 /* bits 5..7: reserved */ - -typedef struct gz_stream { - z_stream stream; - int z_err; /* error code for last stream operation */ - int z_eof; /* set if end of input file */ - FILE *file; /* .gz file */ - Byte *inbuf; /* input buffer */ - Byte *outbuf; /* output buffer */ - uLong crc; /* crc32 of uncompressed data */ - char *msg; /* error message */ - char *path; /* path name for debugging only */ - int transparent; /* 1 if input file is not a .gz file */ - char mode; /* 'w' or 'r' */ - z_off_t start; /* start of compressed data in file (header skipped) */ - z_off_t in; /* bytes into deflate or inflate */ - z_off_t out; /* bytes out of deflate or inflate */ - int back; /* one character push-back */ - int last; /* true if push-back is last character */ -} gz_stream; - - -local gzFile gz_open OF((const char *path, const char *mode, int fd)); -local int do_flush OF((gzFile file, int flush)); -local int get_byte OF((gz_stream *s)); -local void check_header OF((gz_stream *s)); -local int destroy OF((gz_stream *s)); -local void putLong OF((FILE *file, uLong x)); -local uLong getLong OF((gz_stream *s)); - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb"). The file is given either by file descriptor - or path name (if fd == -1). - gz_open returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -*/ -local gzFile gz_open (path, mode, fd) - const char *path; - const char *mode; - int fd; -{ - int err; - int level = Z_DEFAULT_COMPRESSION; /* compression level */ - int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ - char *p = (char*)mode; - gz_stream *s; - char fmode[80]; /* copy of mode, without the compression level */ - char *m = fmode; - - if (!path || !mode) return Z_NULL; - - s = (gz_stream *)ALLOC(sizeof(gz_stream)); - if (!s) return Z_NULL; - - s->stream.zalloc = (alloc_func)0; - s->stream.zfree = (free_func)0; - s->stream.opaque = (voidpf)0; - s->stream.next_in = s->inbuf = Z_NULL; - s->stream.next_out = s->outbuf = Z_NULL; - s->stream.avail_in = s->stream.avail_out = 0; - s->file = NULL; - s->z_err = Z_OK; - s->z_eof = 0; - s->in = 0; - s->out = 0; - s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); - s->msg = NULL; - s->transparent = 0; - - s->path = (char*)ALLOC(strlen(path)+1); - if (s->path == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - strcpy(s->path, path); /* do this early for debugging */ - - s->mode = '\0'; - do { - if (*p == 'r') s->mode = 'r'; - if (*p == 'w' || *p == 'a') s->mode = 'w'; - if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else if (*p == 'R') { - strategy = Z_RLE; - } else { - *m++ = *p; /* copy the mode */ - } - } while (*p++ && m != fmode + sizeof(fmode)); - if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateInit2(&(s->stream), level, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); - /* windowBits is passed < 0 to suppress zlib header */ - - s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); -#endif - if (err != Z_OK || s->outbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } else { - s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); - - err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are - * present after the compressed stream. - */ - if (err != Z_OK || s->inbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } - s->stream.avail_out = Z_BUFSIZE; - - errno = 0; - s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); - - if (s->file == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - if (s->mode == 'w') { - /* Write a very simple .gz header: - */ - fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->start = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an - * fflush on some systems. This version of the library doesn't use - * start anyway in write mode, so this initialization is not - * necessary. - */ - } else { - check_header(s); /* skip the .gz header */ - s->start = ftell(s->file) - s->stream.avail_in; - } - - return (gzFile)s; -} - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. -*/ -gzFile ZEXPORT gzopen (path, mode) - const char *path; - const char *mode; -{ - return gz_open (path, mode, -1); -} - -/* =========================================================================== - Associate a gzFile with the file descriptor fd. fd is not dup'ed here - to mimic the behavio(u)r of fdopen. -*/ -gzFile ZEXPORT gzdopen (fd, mode) - int fd; - const char *mode; -{ - char name[46]; /* allow for up to 128-bit integers */ - - if (fd < 0) return (gzFile)Z_NULL; - sprintf(name, "", fd); /* for debugging */ - - return gz_open (name, mode, fd); -} - -/* =========================================================================== - * Update the compression level and strategy - */ -int ZEXPORT gzsetparams (file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - /* Make room to allow flushing */ - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; - } - - return deflateParams (&(s->stream), level, strategy); -} - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ -local int get_byte(s) - gz_stream *s; -{ - if (s->z_eof) return EOF; - if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; - } - s->stream.avail_in--; - return *(s->stream.next_in)++; -} - -/* =========================================================================== - Check the gzip header of a gz_stream opened for reading. Set the stream - mode to transparent if the gzip magic header is not present; set s->err - to Z_DATA_ERROR if the magic header is present but the rest of the header - is incorrect. - IN assertion: the stream s has already been created sucessfully; - s->stream.avail_in is zero for the first time, but may be non-zero - for concatenated .gz files. -*/ -local void check_header(s) - gz_stream *s; -{ - int method; /* method byte */ - int flags; /* flags byte */ - uInt len; - int c; - - /* Assure two bytes in the buffer so we can peek ahead -- handle case - where first byte of header is at the end of the buffer after the last - gzip segment */ - len = s->stream.avail_in; - if (len < 2) { - if (len) s->inbuf[0] = s->stream.next_in[0]; - errno = 0; - len = (uInt)fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); - if (len == 0 && ferror(s->file)) s->z_err = Z_ERRNO; - s->stream.avail_in += len; - s->stream.next_in = s->inbuf; - if (s->stream.avail_in < 2) { - s->transparent = s->stream.avail_in; - return; - } - } - - /* Peek ahead to check the gzip magic header */ - if (s->stream.next_in[0] != gz_magic[0] || - s->stream.next_in[1] != gz_magic[1]) { - s->transparent = 1; - return; - } - s->stream.avail_in -= 2; - s->stream.next_in += 2; - - /* Check the rest of the gzip header */ - method = get_byte(s); - flags = get_byte(s); - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; - } - - /* Discard time, xflags and OS code: */ - for (len = 0; len < 6; len++) (void)get_byte(s); - - if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; - } - if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); - } - s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; -} - - /* =========================================================================== - * Cleanup then free the given gz_stream. Return a zlib error code. - Try freeing in the reverse order of allocations. - */ -local int destroy (s) - gz_stream *s; -{ - int err = Z_OK; - - if (!s) return Z_STREAM_ERROR; - - TRYFREE(s->msg); - - if (s->stream.state != NULL) { - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateEnd(&(s->stream)); -#endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } - } - if (s->file != NULL && fclose(s->file)) { -#ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ -#endif - err = Z_ERRNO; - } - if (s->z_err < 0) err = s->z_err; - - TRYFREE(s->inbuf); - TRYFREE(s->outbuf); - TRYFREE(s->path); - TRYFREE(s); - return err; -} - -/* =========================================================================== - Reads the given number of uncompressed bytes from the compressed file. - gzread returns the number of bytes actually read (0 for end of file). -*/ -int ZEXPORT gzread (file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - Bytef *start = (Bytef*)buf; /* starting point for crc computation */ - Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ - - if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; - - if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; - if (s->z_err == Z_STREAM_END) return 0; /* EOF */ - - next_out = (Byte*)buf; - s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; - - if (s->stream.avail_out && s->back != EOF) { - *next_out++ = s->back; - s->stream.next_out++; - s->stream.avail_out--; - s->back = EOF; - s->out++; - start++; - if (s->last) { - s->z_err = Z_STREAM_END; - return 1; - } - } - - while (s->stream.avail_out != 0) { - - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= - (uInt)fread(next_out, 1, s->stream.avail_out, s->file); - } - len -= s->stream.avail_out; - s->in += len; - s->out += len; - if (len == 0) s->z_eof = 1; - return (int)len; - } - if (s->stream.avail_in == 0 && !s->z_eof) { - - errno = 0; - s->stream.avail_in = (uInt)fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (ferror(s->file)) { - s->z_err = Z_ERRNO; - break; - } - } - s->stream.next_in = s->inbuf; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; - - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); - /* The uncompressed length returned by above getlong() may be - * different from s->out in case of concatenated .gz files. - * Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - inflateReset(&(s->stream)); - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; - } - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - - if (len == s->stream.avail_out && - (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO)) - return -1; - return (int)(len - s->stream.avail_out); -} - - -/* =========================================================================== - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ -int ZEXPORT gzgetc(file) - gzFile file; -{ - unsigned char c; - - return gzread(file, &c, 1) == 1 ? c : -1; -} - - -/* =========================================================================== - Push one byte back onto the stream. -*/ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; - s->back = c; - s->out--; - s->last = (s->z_err == Z_STREAM_END); - if (s->last) s->z_err = Z_OK; - s->z_eof = 0; - return c; -} - - -/* =========================================================================== - Reads bytes from the compressed file until len-1 characters are - read, or a newline character is read and transferred to buf, or an - end-of-file condition is encountered. The string is then terminated - with a null character. - gzgets returns buf, or Z_NULL in case of error. - - The current implementation is not optimized at all. -*/ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - char *b = buf; - if (buf == Z_NULL || len <= 0) return Z_NULL; - - while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; - *buf = '\0'; - return b == buf && len > 0 ? Z_NULL : b; -} - - -#ifndef NO_GZCOMPRESS -/* =========================================================================== - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of bytes actually written (0 in case of error). -*/ -int ZEXPORT gzwrite (file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.next_in = (Bytef*)buf; - s->stream.avail_in = len; - - while (s->stream.avail_in != 0) { - - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - break; - } - s->stream.avail_out = Z_BUFSIZE; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - if (s->z_err != Z_OK) break; - } - s->crc = crc32(s->crc, (const Bytef *)buf, len); - - return (int)(len - s->stream.avail_in); -} - - -/* =========================================================================== - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ -#ifdef STDC -#include - -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) -{ - char buf[Z_PRINTF_BUFSIZE]; - va_list va; - int len; - - buf[sizeof(buf) - 1] = 0; - va_start(va, format); -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(buf, format, va); - va_end(va); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = vsprintf(buf, format, va); - va_end(va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(buf, sizeof(buf), format, va); - va_end(va); - len = strlen(buf); -# else - len = vsnprintf(buf, sizeof(buf), format, va); - va_end(va); -# endif -#endif - if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, (unsigned)len); -} -#else /* not ANSI C */ - -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - char buf[Z_PRINTF_BUFSIZE]; - int len; - - buf[sizeof(buf) - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(buf); -# else - len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, len); -} -#endif - -/* =========================================================================== - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char cc = (unsigned char) c; /* required for big endian systems */ - - return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; -} - - -/* =========================================================================== - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ -int ZEXPORT gzputs(file, s) - gzFile file; - const char *s; -{ - return gzwrite(file, (char*)s, (unsigned)strlen(s)); -} - - -/* =========================================================================== - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. -*/ -local int do_flush (file, flush) - gzFile file; - int flush; -{ - uInt len; - int done = 0; - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.avail_in = 0; /* should be zero already anyway */ - - for (;;) { - len = Z_BUFSIZE - s->stream.avail_out; - - if (len != 0) { - if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { - s->z_err = Z_ERRNO; - return Z_ERRNO; - } - s->stream.next_out = s->outbuf; - s->stream.avail_out = Z_BUFSIZE; - } - if (done) break; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), flush); - s->out -= s->stream.avail_out; - - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; - - /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: - */ - done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - - if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; - } - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} - -int ZEXPORT gzflush (file, flush) - gzFile file; - int flush; -{ - gz_stream *s = (gz_stream*)file; - int err = do_flush (file, flush); - - if (err) return err; - fflush(s->file); - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} -#endif /* NO_GZCOMPRESS */ - -/* =========================================================================== - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error. - SEEK_END is not implemented, returns error. - In this version of the library, gzseek can be extremely slow. -*/ -z_off_t ZEXPORT gzseek (file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; - } - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return -1L; -#else - if (whence == SEEK_SET) { - offset -= s->in; - } - if (offset < 0) return -1L; - - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - if (s->inbuf == Z_NULL) return -1L; - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; - - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; - - offset -= size; - } - return s->in; -#endif - } - /* Rest of function is for reading only */ - - /* compute absolute position */ - if (whence == SEEK_CUR) { - offset += s->out; - } - if (offset < 0) return -1L; - - if (s->transparent) { - /* map to fseek */ - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - - s->in = s->out = offset; - return offset; - } - - /* For a negative seek, rewind and use positive seek */ - if (offset >= s->out) { - offset -= s->out; - } else if (gzrewind(file) < 0) { - return -1L; - } - /* offset is now the number of bytes to skip. */ - - if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); - if (s->outbuf == Z_NULL) return -1L; - } - if (offset && s->back != EOF) { - s->back = EOF; - s->out++; - offset--; - if (s->last) s->z_err = Z_STREAM_END; - } - while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; - - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; - } - return s->out; -} - -/* =========================================================================== - Rewinds input file. -*/ -int ZEXPORT gzrewind (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return -1; - - s->z_err = Z_OK; - s->z_eof = 0; - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - s->crc = crc32(0L, Z_NULL, 0); - if (!s->transparent) (void)inflateReset(&s->stream); - s->in = 0; - s->out = 0; - return fseek(s->file, s->start, SEEK_SET); -} - -/* =========================================================================== - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -*/ -z_off_t ZEXPORT gztell (file) - gzFile file; -{ - return gzseek(file, 0L, SEEK_CUR); -} - -/* =========================================================================== - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ -int ZEXPORT gzeof (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - /* With concatenated compressed files that can have embedded - * crc trailers, z_eof is no longer the only/best indicator of EOF - * on a gz_stream. Handle end-of-stream error explicitly here. - */ - if (s == NULL || s->mode != 'r') return 0; - if (s->z_eof) return 1; - return s->z_err == Z_STREAM_END; -} - -/* =========================================================================== - Returns 1 if reading and doing so transparently, otherwise zero. -*/ -int ZEXPORT gzdirect (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return 0; - return s->transparent; -} - -/* =========================================================================== - Outputs a long in LSB order to the given file -*/ -local void putLong (file, x) - FILE *file; - uLong x; -{ - int n; - for (n = 0; n < 4; n++) { - fputc((int)(x & 0xff), file); - x >>= 8; - } -} - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets z_err in case - of error. -*/ -local uLong getLong (s) - gz_stream *s; -{ - uLong x = (uLong)get_byte(s); - int c; - - x += ((uLong)get_byte(s))<<8; - x += ((uLong)get_byte(s))<<16; - c = get_byte(s); - if (c == EOF) s->z_err = Z_DATA_ERROR; - x += ((uLong)c)<<24; - return x; -} - -/* =========================================================================== - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. -*/ -int ZEXPORT gzclose (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return Z_STREAM_ERROR; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return Z_STREAM_ERROR; -#else - if (do_flush (file, Z_FINISH) != Z_OK) - return destroy((gz_stream*)file); - - putLong (s->file, s->crc); - putLong (s->file, (uLong)(s->in & 0xffffffff)); -#endif - } - return destroy((gz_stream*)file); -} - -#ifdef STDC -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -/* =========================================================================== - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ -const char * ZEXPORT gzerror (file, errnum) - gzFile file; - int *errnum; -{ - char *m; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) { - *errnum = Z_STREAM_ERROR; - return (const char*)ERR_MSG(Z_STREAM_ERROR); - } - *errnum = s->z_err; - if (*errnum == Z_OK) return (const char*)""; - - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); - - if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); - - TRYFREE(s->msg); - s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); - if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); - strcpy(s->msg, s->path); - strcat(s->msg, ": "); - strcat(s->msg, m); - return (const char*)s->msg; -} - -/* =========================================================================== - Clear the error and end-of-file flags, and do the same for the real file. -*/ -void ZEXPORT gzclearerr (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return; - if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; - s->z_eof = 0; - clearerr(s->file); -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/infback.c b/components/dfs/filesystems/jffs2/cyg/compress/src/infback.c deleted file mode 100644 index 455dbc9ee..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/infback.c +++ /dev/null @@ -1,623 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->write = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - - /* process literal */ - if (this.op == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.c b/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.c deleted file mode 100644 index c2521d5a8..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.c +++ /dev/null @@ -1,403 +0,0 @@ -/* infblock.c -- interpret and process block types to last block - * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infblock.h" -#include "inftrees.h" -//#include "infcodes.h" //no such file! -#include "infutil.h" - -struct inflate_codes_state {int dummy;}; /* for buggy compilers */ - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - -/* Table for deflate from PKZIP's appnote.txt. */ -local const uInt border[] = { /* Order of the bit length code lengths */ - 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - -/* - Notes beyond the 1.93a appnote.txt: - - 1. Distance pointers never point before the beginning of the output - stream. - 2. Distance pointers can point back across blocks, up to 32k away. - 3. There is an implied maximum of 7 bits for the bit length table and - 15 bits for the actual data. - 4. If only one code exists, then it is encoded using one bit. (Zero - would be more efficient, but perhaps a little confusing.) If two - codes exist, they are coded using one bit each (0 and 1). - 5. There is no way of sending zero distance codes--a dummy must be - sent if there are none. (History: a pre 2.0 version of PKZIP would - store blocks with no distance codes, but this was discovered to be - too harsh a criterion.) Valid only for 1.93a. 2.04c does allow - zero distance codes, which is sent as one code of zero bits in - length. - 6. There are up to 286 literal/length codes. Code 256 represents the - end-of-block. Note however that the static length tree defines - 288 codes just to fill out the Huffman codes. Codes 286 and 287 - cannot be used though, since there is no length base or extra bits - defined for them. Similarily, there are up to 30 distance codes. - However, static trees define 32 codes (all 5 bits) to fill out the - Huffman codes, but the last two had better not show up in the data. - 7. Unzip can check dynamic Huffman blocks for complete code sets. - The exception is that a single code would not be complete (see #4). - 8. The five bits following the block type is really the number of - literal codes sent minus 257. - 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits - (1+6+6). Therefore, to output three times the length, you output - three codes (1+1+1), whereas to output four times the same length, - you only need two codes (1+3). Hmm. - 10. In the tree reconstruction algorithm, Code = Code + Increment - only if BitLength(i) is not zero. (Pretty obvious.) - 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) - 12. Note: length code 284 can represent 227-258, but length code 285 - really is 258. The last length deserves its own, short code - since it gets used a lot in very redundant files. The length - 258 is special since 258 - 3 (the min match length) is 255. - 13. The literal/length and distance code bit lengths are read as a - single stream of lengths. It is possible (and advantageous) for - a repeat code (16, 17, or 18) to go across the boundary between - the two sets of lengths. - */ - - -void inflate_blocks_reset(s, z, c) -inflate_blocks_statef *s; -z_streamp z; -uLongf *c; -{ - if (c != Z_NULL) - *c = s->check; - if (s->mode == BTREE || s->mode == DTREE) - ZFREE(z, s->sub.trees.blens); - if (s->mode == CODES) - inflate_codes_free(s->sub.decode.codes, z); - s->mode = TYPE; - s->bitk = 0; - s->bitb = 0; - s->read = s->write = s->window; - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0); - Tracev((stderr, "inflate: blocks reset\n")); -} - - -inflate_blocks_statef *inflate_blocks_new(z, c, w) -z_streamp z; -check_func c; -uInt w; -{ - inflate_blocks_statef *s; - - if ((s = (inflate_blocks_statef *)ZALLOC - (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) - return s; - if ((s->hufts = - (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) - { - ZFREE(z, s); - return Z_NULL; - } - if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) - { - ZFREE(z, s->hufts); - ZFREE(z, s); - return Z_NULL; - } - s->end = s->window + w; - s->checkfn = c; - s->mode = TYPE; - Tracev((stderr, "inflate: blocks allocated\n")); - inflate_blocks_reset(s, z, Z_NULL); - return s; -} - - -int inflate_blocks(s, z, r) -inflate_blocks_statef *s; -z_streamp z; -int r; -{ - uInt t; /* temporary storage */ - uLong b; /* bit buffer */ - uInt k; /* bits in bit buffer */ - Bytef *p; /* input data pointer */ - uInt n; /* bytes available there */ - Bytef *q; /* output window write pointer */ - uInt m; /* bytes to end of window or read pointer */ - - /* copy input/output information to locals (UPDATE macro restores) */ - LOAD - - /* process input based on current state */ - while (1) switch (s->mode) - { - case TYPE: - NEEDBITS(3) - t = (uInt)b & 7; - s->last = t & 1; - switch (t >> 1) - { - case 0: /* stored */ - Tracev((stderr, "inflate: stored block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - t = k & 7; /* go to byte boundary */ - DUMPBITS(t) - s->mode = LENS; /* get length of stored block */ - break; - case 1: /* fixed */ - Tracev((stderr, "inflate: fixed codes block%s\n", - s->last ? " (last)" : "")); - { - uInt bl, bd; - inflate_huft *tl, *td; - - inflate_trees_fixed(&bl, &bd, &tl, &td, z); - s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); - if (s->sub.decode.codes == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - } - DUMPBITS(3) - s->mode = CODES; - break; - case 2: /* dynamic */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - s->last ? " (last)" : "")); - DUMPBITS(3) - s->mode = TABLE; - break; - case 3: /* illegal */ - DUMPBITS(3) - s->mode = BAD; - z->msg = (char*)"invalid block type"; - r = Z_DATA_ERROR; - LEAVE - } - break; - case LENS: - NEEDBITS(32) - if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) - { - s->mode = BAD; - z->msg = (char*)"invalid stored block lengths"; - r = Z_DATA_ERROR; - LEAVE - } - s->sub.left = (uInt)b & 0xffff; - b = k = 0; /* dump bits */ - Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); - s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); - break; - case STORED: - if (n == 0) - LEAVE - NEEDOUT - t = s->sub.left; - if (t > n) t = n; - if (t > m) t = m; - zmemcpy(q, p, t); - p += t; n -= t; - q += t; m -= t; - if ((s->sub.left -= t) != 0) - break; - Tracev((stderr, "inflate: stored end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - s->mode = s->last ? DRY : TYPE; - break; - case TABLE: - NEEDBITS(14) - s->sub.trees.table = t = (uInt)b & 0x3fff; -#ifndef PKZIP_BUG_WORKAROUND - if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) - { - s->mode = BAD; - z->msg = (char*)"too many length or distance symbols"; - r = Z_DATA_ERROR; - LEAVE - } -#endif - t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); - if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - DUMPBITS(14) - s->sub.trees.index = 0; - Tracev((stderr, "inflate: table sizes ok\n")); - s->mode = BTREE; - case BTREE: - while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) - { - NEEDBITS(3) - s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; - DUMPBITS(3) - } - while (s->sub.trees.index < 19) - s->sub.trees.blens[border[s->sub.trees.index++]] = 0; - s->sub.trees.bb = 7; - t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, - &s->sub.trees.tb, s->hufts, z); - if (t != Z_OK) - { - r = t; - if (r == Z_DATA_ERROR) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - } - LEAVE - } - s->sub.trees.index = 0; - Tracev((stderr, "inflate: bits tree ok\n")); - s->mode = DTREE; - case DTREE: - while (t = s->sub.trees.table, - s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) - { - inflate_huft *h; - uInt i, j, c; - - t = s->sub.trees.bb; - NEEDBITS(t) - h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); - t = h->bits; - c = h->base; - if (c < 16) - { - DUMPBITS(t) - s->sub.trees.blens[s->sub.trees.index++] = c; - } - else /* c == 16..18 */ - { - i = c == 18 ? 7 : c - 14; - j = c == 18 ? 11 : 3; - NEEDBITS(t + i) - DUMPBITS(t) - j += (uInt)b & inflate_mask[i]; - DUMPBITS(i) - i = s->sub.trees.index; - t = s->sub.trees.table; - if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || - (c == 16 && i < 1)) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - z->msg = (char*)"invalid bit length repeat"; - r = Z_DATA_ERROR; - LEAVE - } - c = c == 16 ? s->sub.trees.blens[i - 1] : 0; - do { - s->sub.trees.blens[i++] = c; - } while (--j); - s->sub.trees.index = i; - } - } - s->sub.trees.tb = Z_NULL; - { - uInt bl, bd; - inflate_huft *tl, *td; - inflate_codes_statef *c; - - bl = 9; /* must be <= 9 for lookahead assumptions */ - bd = 6; /* must be <= 9 for lookahead assumptions */ - t = s->sub.trees.table; - t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), - s->sub.trees.blens, &bl, &bd, &tl, &td, - s->hufts, z); - if (t != Z_OK) - { - if (t == (uInt)Z_DATA_ERROR) - { - ZFREE(z, s->sub.trees.blens); - s->mode = BAD; - } - r = t; - LEAVE - } - Tracev((stderr, "inflate: trees ok\n")); - if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) - { - r = Z_MEM_ERROR; - LEAVE - } - s->sub.decode.codes = c; - } - ZFREE(z, s->sub.trees.blens); - s->mode = CODES; - case CODES: - UPDATE - if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) - return inflate_flush(s, z, r); - r = Z_OK; - inflate_codes_free(s->sub.decode.codes, z); - LOAD - Tracev((stderr, "inflate: codes end, %lu total out\n", - z->total_out + (q >= s->read ? q - s->read : - (s->end - s->read) + (q - s->window)))); - if (!s->last) - { - s->mode = TYPE; - break; - } - s->mode = DRY; - case DRY: - FLUSH - if (s->read != s->write) - LEAVE - s->mode = DONE; - case DONE: - r = Z_STREAM_END; - LEAVE - case BAD: - r = Z_DATA_ERROR; - LEAVE - default: - r = Z_STREAM_ERROR; - LEAVE - } -} - - -int inflate_blocks_free(s, z) -inflate_blocks_statef *s; -z_streamp z; -{ - inflate_blocks_reset(s, z, Z_NULL); - ZFREE(z, s->window); - ZFREE(z, s->hufts); - ZFREE(z, s); - Tracev((stderr, "inflate: blocks freed\n")); - return Z_OK; -} - - -void inflate_set_dictionary(s, d, n) -inflate_blocks_statef *s; -const Bytef *d; -uInt n; -{ - zmemcpy(s->window, d, n); - s->read = s->write = s->window + n; -} - - -/* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. - * IN assertion: s != Z_NULL - */ -int inflate_blocks_sync_point(s) -inflate_blocks_statef *s; -{ - return s->mode == LENS; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.h b/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.h deleted file mode 100644 index 17ffbda2f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/infblock.h +++ /dev/null @@ -1,39 +0,0 @@ -/* infblock.h -- header to use infblock.c - * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -struct inflate_blocks_state; -typedef struct inflate_blocks_state FAR inflate_blocks_statef; -typedef uLong (*check_func) OF((uLong check, const Bytef *buf, uInt len)); // add by prife -extern inflate_blocks_statef * inflate_blocks_new OF(( - z_streamp z, - check_func c, /* check function */ - uInt w)); /* window size */ - -extern int inflate_blocks OF(( - inflate_blocks_statef *, - z_streamp , - int)); /* initial return code */ - -extern void inflate_blocks_reset OF(( - inflate_blocks_statef *, - z_streamp , - uLongf *)); /* check value on output */ - -extern int inflate_blocks_free OF(( - inflate_blocks_statef *, - z_streamp)); - -extern void inflate_set_dictionary OF(( - inflate_blocks_statef *s, - const Bytef *d, /* dictionary */ - uInt n)); /* dictionary length */ - -extern int inflate_blocks_sync_point OF(( - inflate_blocks_statef *s)); diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.c b/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.c deleted file mode 100644 index bbee92ed1..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.c +++ /dev/null @@ -1,318 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code this; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - write = state->write; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = lcode[hold & lmask]; - dolen: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op == 0) { /* literal */ - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - PUP(out) = (unsigned char)(this.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = dcode[hold & dmask]; - dodist: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - from = window - OFF; - if (write == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (write < op) { /* wrap around window */ - from += wsize + write - op; - op -= write; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (write < len) { /* some from start of window */ - op = write; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += write - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - this = dcode[this.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - this = lcode[this.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and write == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.h b/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.h deleted file mode 100644 index 1e88d2d97..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inffixed.h b/components/dfs/filesystems/jffs2/cyg/compress/src/inffixed.h deleted file mode 100644 index 75ed4b597..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.c b/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.c deleted file mode 100644 index 792fdee8e..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.c +++ /dev/null @@ -1,1368 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common write == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - strm->adler = 1; /* to support ill-conceived Java test suite */ - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->wsize = 0; - state->whave = 0; - state->write = 0; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; - return Z_OK; -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - if (windowBits < 0) { - state->wrap = 0; - windowBits = -windowBits; - } - else { - state->wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) windowBits &= 15; -#endif - } - if (windowBits < 8 || windowBits > 15) { - ZFREE(strm, state); - strm->state = Z_NULL; - return Z_STREAM_ERROR; - } - state->wbits = (unsigned)windowBits; - state->window = Z_NULL; - return inflateReset(strm); -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, out) -z_streamp strm; -unsigned out; -{ - struct inflate_state FAR *state; - unsigned copy, dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->write = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; - if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->write = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->write; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->write, strm->next_out - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); - state->write = copy; - state->whave = state->wsize; - } - else { - state->write += dist; - if (state->write == state->wsize) state->write = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - break; - } - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - if ((int)(this.op) == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - state->mode = LIT; - break; - } - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(this.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->mode = DIST; - case DIST: - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - state->extra = (unsigned)(this.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - if (state->offset > state->whave + out - left) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->write) { - copy -= state->write; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->write - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - REVERSE(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) - if (updatewindow(strm, out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long id; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary id */ - if (state->mode == DICT) { - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy(dest, source, sizeof(z_stream)); - zmemcpy(copy, state, sizeof(struct inflate_state)); - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.h b/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.h deleted file mode 100644 index 07bd3e78a..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inflate.h +++ /dev/null @@ -1,115 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2004 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN, /* i: waiting for length/lit code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD or MEM mode -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME - NAME -> COMMENT -> HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or CHECK - STORED -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.c b/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.c deleted file mode 100644 index 8a9c13ff0..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.c +++ /dev/null @@ -1,329 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.3 Copyright 1995-2005 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code this; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)1; - this.val = (unsigned short)0; - *(*table)++ = this; /* make a table to force an error */ - *(*table)++ = this; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min <= MAXBITS; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked when a LENS table is being made - against the space in *table, ENOUGH, minus the maximum space needed by - the worst case distance code, MAXD. This should never happen, but the - sufficiency of ENOUGH has not been proven exhaustively, hence the check. - This assumes that when type == LENS, bits == 9. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - this.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - this.op = (unsigned char)0; - this.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - this.op = (unsigned char)(extra[work[sym]]); - this.val = base[work[sym]]; - } - else { - this.op = (unsigned char)(32 + 64); /* end of block */ - this.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = this; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)(len - drop); - this.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - this.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = this; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.h b/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.h deleted file mode 100644 index b1104c87e..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/inftrees.h +++ /dev/null @@ -1,55 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1444 code structures (852 for length/literals - and 592 for distances, the latter actually the result of an - exhaustive search). The true maximum is not known, but the value - below is more than safe. */ -#define ENOUGH 2048 -#define MAXD 592 - -/* Type of code to build for inftable() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.c b/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.c deleted file mode 100644 index 9a076221f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.c +++ /dev/null @@ -1,87 +0,0 @@ -/* inflate_util.c -- data and routines common to blocks and codes - * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "infblock.h" -#include "inftrees.h" -#include "infcodes.h" -#include "infutil.h" - -struct inflate_codes_state {int dummy;}; /* for buggy compilers */ - -/* And'ing with mask[n] masks the lower n bits */ -uInt inflate_mask[17] = { - 0x0000, - 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, - 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff -}; - - -/* copy as much as possible from the sliding window to the output area */ -int inflate_flush(s, z, r) -inflate_blocks_statef *s; -z_streamp z; -int r; -{ - uInt n; - Bytef *p; - Bytef *q; - - /* local copies of source and destination pointers */ - p = z->next_out; - q = s->read; - - /* compute number of bytes to copy as far as end of window */ - n = (uInt)((q <= s->write ? s->write : s->end) - q); - if (n > z->avail_out) n = z->avail_out; - if (n && r == Z_BUF_ERROR) r = Z_OK; - - /* update counters */ - z->avail_out -= n; - z->total_out += n; - - /* update check information */ - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); - - /* copy as far as end of window */ - zmemcpy(p, q, n); - p += n; - q += n; - - /* see if more to copy at beginning of window */ - if (q == s->end) - { - /* wrap pointers */ - q = s->window; - if (s->write == s->end) - s->write = s->window; - - /* compute bytes to copy */ - n = (uInt)(s->write - q); - if (n > z->avail_out) n = z->avail_out; - if (n && r == Z_BUF_ERROR) r = Z_OK; - - /* update counters */ - z->avail_out -= n; - z->total_out += n; - - /* update check information */ - if (s->checkfn != Z_NULL) - z->adler = s->check = (*s->checkfn)(s->check, q, n); - - /* copy */ - zmemcpy(p, q, n); - p += n; - q += n; - } - - /* update pointers */ - z->next_out = p; - s->read = q; - - /* done */ - return r; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.h b/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.h deleted file mode 100644 index 4401df82f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/infutil.h +++ /dev/null @@ -1,98 +0,0 @@ -/* infutil.h -- types and macros common to blocks and codes - * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -#ifndef _INFUTIL_H -#define _INFUTIL_H - -typedef enum { - TYPE, /* get type bits (3, including end bit) */ - LENS, /* get lengths for stored */ - STORED, /* processing stored block */ - TABLE, /* get table lengths */ - BTREE, /* get bit lengths tree for a dynamic block */ - DTREE, /* get length, distance trees for a dynamic block */ - CODES, /* processing fixed or dynamic block */ - DRY, /* output remaining window bytes */ - DONE, /* finished last block, done */ - BAD} /* got a data error--stuck here */ -inflate_block_mode; - -/* inflate blocks semi-private state */ -struct inflate_blocks_state { - - /* mode */ - inflate_block_mode mode; /* current inflate_block mode */ - - /* mode dependent information */ - union { - uInt left; /* if STORED, bytes left to copy */ - struct { - uInt table; /* table lengths (14 bits) */ - uInt index; /* index into blens (or border) */ - uIntf *blens; /* bit lengths of codes */ - uInt bb; /* bit length tree depth */ - inflate_huft *tb; /* bit length decoding tree */ - } trees; /* if DTREE, decoding info for trees */ - struct { - inflate_codes_statef - *codes; - } decode; /* if CODES, current state */ - } sub; /* submode */ - uInt last; /* true if this block is the last block */ - - /* mode independent information */ - uInt bitk; /* bits in bit buffer */ - uLong bitb; /* bit buffer */ - inflate_huft *hufts; /* single malloc for tree space */ - Bytef *window; /* sliding window */ - Bytef *end; /* one byte after sliding window */ - Bytef *read; /* window read pointer */ - Bytef *write; /* window write pointer */ - check_func checkfn; /* check function */ - uLong check; /* check on output */ - -}; - - -/* defines for inflate input/output */ -/* update pointers and return */ -#define UPDBITS {s->bitb=b;s->bitk=k;} -#define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;} -#define UPDOUT {s->write=q;} -#define UPDATE {UPDBITS UPDIN UPDOUT} -#define LEAVE {UPDATE return inflate_flush(s,z,r);} -/* get bytes and bits */ -#define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} -#define NEEDBYTE {if(n)r=Z_OK;else LEAVE} -#define NEXTBYTE (n--,*p++) -#define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);} -/* output bytes */ -#define WAVAIL (uInt)(qread?s->read-q-1:s->end-q) -#define LOADOUT {q=s->write;m=(uInt)WAVAIL;} -#define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} -#define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} -#define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} -#define OUTBYTE(a) {*q++=(Byte)(a);m--;} -/* load local pointers */ -#define LOAD {LOADIN LOADOUT} - -/* masks for lower bits (size given to avoid silly warnings with Visual C++) */ -extern uInt inflate_mask[17]; - -/* copy as much as possible from the sliding window to the output area */ -extern int inflate_flush OF(( - inflate_blocks_statef *, - z_streamp , - int)); - -struct internal_state {int dummy;}; /* for buggy compilers */ - -#endif diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/maketree.c b/components/dfs/filesystems/jffs2/cyg/compress/src/maketree.c deleted file mode 100644 index a16d4b146..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/maketree.c +++ /dev/null @@ -1,85 +0,0 @@ -/* maketree.c -- make inffixed.h table for decoding fixed codes - * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* This program is included in the distribution for completeness. - You do not need to compile or run this program since inffixed.h - is already included in the distribution. To use this program - you need to compile zlib with BUILDFIXED defined and then compile - and link this program with the zlib library. Then the output of - this program can be piped to inffixed.h. */ - -#include -#include -#include "zutil.h" -#include "inftrees.h" - -/* simplify the use of the inflate_huft type with some defines */ -#define exop word.what.Exop -#define bits word.what.Bits - -/* generate initialization table for an inflate_huft structure array */ -void maketree(uInt b, inflate_huft *t) -{ - int i, e; - - i = 0; - while (1) - { - e = t[i].exop; - if (e && (e & (16+64)) == 0) /* table pointer */ - { - fprintf(stderr, "maketree: cannot initialize sub-tables!\n"); - exit(1); - } - if (i % 4 == 0) - printf("\n "); - printf(" {{{%u,%u}},%u}", t[i].exop, t[i].bits, t[i].base); - if (++i == (1< -#include "zlib.h" - -#ifdef STDC -# include -# include -#endif - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) -# include -# include -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#ifdef VMS -# define unlink delete -# define GZ_SUFFIX "-gz" -#endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fileno */ -#endif - -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); -#endif - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 -#define MAX_NAME_LEN 1024 - -#ifdef MAXSEG_64K -# define local static - /* Needed for systems with limitation on stack size. */ -#else -# define local -#endif - -char *prog; - -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); -#ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); -#endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Display error message and exit - */ -void error(msg) - const char *msg; -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(in, out) - FILE *in; - gzFile out; -{ - local char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - for (;;) { - len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); - } - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; -{ - int len; - int err; - int ifd = fileno(in); - caddr_t buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (caddr_t)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = gzwrite(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(gzerror(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - local char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (gzclose(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(file, mode) - char *file; - char *mode; -{ - local char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - strcpy(outfile, file); - strcat(outfile, GZ_SUFFIX); - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = gzopen(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(file) - char *file; -{ - local char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - uInt len = (uInt)strlen(file); - - strcpy(buf, file); - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; - strcat(infile, GZ_SUFFIX); - } - in = gzopen(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - - -/* =========================================================================== - * Usage: minigzip [-d] [-f] [-h] [-r] [-1 to -9] [files...] - * -d : decompress - * -f : compress with Z_FILTERED - * -h : compress with Z_HUFFMAN_ONLY - * -r : compress with Z_RLE - * -1 to -9 : compression level - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - int uncompr = 0; - gzFile file; - char outmode[20]; - - strcpy(outmode, "wb6 "); - - prog = argv[0]; - argc--, argv++; - - while (argc > 0) { - if (strcmp(*argv, "-d") == 0) - uncompr = 1; - else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; - else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; - else if (strcmp(*argv, "-r") == 0) - outmode[3] = 'R'; - else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; - else - break; - argc--, argv++; - } - if (outmode[3] == ' ') - outmode[3] = 0; - if (argc == 0) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = gzdopen(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - do { - if (uncompr) { - file_uncompress(*argv); - } else { - file_compress(*argv, outmode); - } - } while (argv++, --argc); - } - return 0; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/trees.c b/components/dfs/filesystems/jffs2/cyg/compress/src/trees.c deleted file mode 100644 index 395e4e168..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/trees.c +++ /dev/null @@ -1,1219 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2005 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); -local void set_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (value << s->bi_valid); - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (val << s->bi_valid);\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void _tr_stored_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. - */ -void _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void _tr_flush_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN) - set_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, eof); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+eof, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+eof, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (eof) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*eof)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; -} - -/* =========================================================================== - * Set the data type to BINARY or TEXT, using a crude approximation: - * set it to Z_TEXT if all symbols are either printable characters (33 to 255) - * or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise. - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local void set_data_type(s) - deflate_state *s; -{ - int n; - - for (n = 0; n < 9; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - if (n == 9) - for (n = 14; n < 32; n++) - if (s->dyn_ltree[n].Freq != 0) - break; - s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/trees.h b/components/dfs/filesystems/jffs2/cyg/compress/src/trees.h deleted file mode 100644 index 72facf900..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/uncompr.c b/components/dfs/filesystems/jffs2/cyg/compress/src/uncompr.c deleted file mode 100644 index 52040203b..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/uncompr.c +++ /dev/null @@ -1,65 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#ifdef __ECOS__ -#include -#else -#include "zlib.h" -#endif // __ECOS__ - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/zlib.3 b/components/dfs/filesystems/jffs2/cyg/compress/src/zlib.3 deleted file mode 100644 index 90b816287..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/zlib.3 +++ /dev/null @@ -1,159 +0,0 @@ -.TH ZLIB 3 "18 July 2005" -.SH NAME -zlib \- compression/decompression library -.SH SYNOPSIS -[see -.I zlib.h -for full description] -.SH DESCRIPTION -The -.I zlib -library is a general purpose data compression library. -The code is thread safe. -It provides in-memory compression and decompression functions, -including integrity checks of the uncompressed data. -This version of the library supports only one compression method (deflation) -but other algorithms will be added later -and will have the same stream interface. -.LP -Compression can be done in a single step if the buffers are large enough -(for example if an input file is mmap'ed), -or can be done by repeated calls of the compression function. -In the latter case, -the application must provide more input and/or consume the output -(providing more output space) before each call. -.LP -The library also supports reading and writing files in -.IR gzip (1) -(.gz) format -with an interface similar to that of stdio. -.LP -The library does not install any signal handler. -The decoder checks the consistency of the compressed data, -so the library should never crash even in case of corrupted input. -.LP -All functions of the compression library are documented in the file -.IR zlib.h . -The distribution source includes examples of use of the library -in the files -.I example.c -and -.IR minigzip.c . -.LP -Changes to this version are documented in the file -.I ChangeLog -that accompanies the source, -and are concerned primarily with bug fixes and portability enhancements. -.LP -A Java implementation of -.I zlib -is available in the Java Development Kit 1.1: -.IP -http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html -.LP -A Perl interface to -.IR zlib , -written by Paul Marquess (pmqs@cpan.org), -is available at CPAN (Comprehensive Perl Archive Network) sites, -including: -.IP -http://www.cpan.org/modules/by-module/Compress/ -.LP -A Python interface to -.IR zlib , -written by A.M. Kuchling (amk@magnet.com), -is available in Python 1.5 and later versions: -.IP -http://www.python.org/doc/lib/module-zlib.html -.LP -A -.I zlib -binding for -.IR tcl (1), -written by Andreas Kupries (a.kupries@westend.com), -is availlable at: -.IP -http://www.westend.com/~kupries/doc/trf/man/man.html -.LP -An experimental package to read and write files in .zip format, -written on top of -.I zlib -by Gilles Vollant (info@winimage.com), -is available at: -.IP -http://www.winimage.com/zLibDll/unzip.html -and also in the -.I contrib/minizip -directory of the main -.I zlib -web site. -.SH "SEE ALSO" -The -.I zlib -web site can be found at either of these locations: -.IP -http://www.zlib.org -.br -http://www.gzip.org/zlib/ -.LP -The data format used by the zlib library is described by RFC -(Request for Comments) 1950 to 1952 in the files: -.IP -http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format) -.br -http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format) -.br -http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format) -.LP -These documents are also available in other formats from: -.IP -ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html -.LP -Mark Nelson (markn@ieee.org) wrote an article about -.I zlib -for the Jan. 1997 issue of Dr. Dobb's Journal; -a copy of the article is available at: -.IP -http://dogma.net/markn/articles/zlibtool/zlibtool.htm -.SH "REPORTING PROBLEMS" -Before reporting a problem, -please check the -.I zlib -web site to verify that you have the latest version of -.IR zlib ; -otherwise, -obtain the latest version and see if the problem still exists. -Please read the -.I zlib -FAQ at: -.IP -http://www.gzip.org/zlib/zlib_faq.html -.LP -before asking for help. -Send questions and/or comments to zlib@gzip.org, -or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). -.SH AUTHORS -Version 1.2.3 -Copyright (C) 1995-2005 Jean-loup Gailly (jloup@gzip.org) -and Mark Adler (madler@alumni.caltech.edu). -.LP -This software is provided "as-is," -without any express or implied warranty. -In no event will the authors be held liable for any damages -arising from the use of this software. -See the distribution directory with respect to requirements -governing redistribution. -The deflate format used by -.I zlib -was defined by Phil Katz. -The deflate and -.I zlib -specifications were written by L. Peter Deutsch. -Thanks to all the people who reported problems and suggested various -improvements in -.IR zlib ; -who are too numerous to cite here. -.LP -UNIX manual page by R. P. C. Rodgers, -U.S. National Library of Medicine (rodgers@nlm.nih.gov). -.\" end of man page diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.c b/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.c deleted file mode 100644 index d55f5948a..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.c +++ /dev/null @@ -1,318 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch (sizeof(uInt)) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch (sizeof(uLong)) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch (sizeof(voidpf)) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch (sizeof(z_off_t)) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#ifdef STDC -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int z_verbose = verbose; - -void z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h b/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h deleted file mode 100644 index 013754a1f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/src/zutil.h +++ /dev/null @@ -1,276 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#define ZLIB_INTERNAL -#ifdef __ECOS__ -#include -#include -#undef crc32 -#define crc32 cyg_ether_crc32_accumulate -#else -#include "zlib.h" -#endif // __ECOS__ - -#ifdef STDC -# ifndef _WIN32_WCE -# include -# endif -# include -# include -#endif -#ifdef NO_ERRNO_H -# ifdef _WIN32_WCE - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. We rename it to - * avoid conflict with other libraries that use the same workaround. - */ -# define errno z_errno -# endif - extern int errno; -#else -# ifndef _WIN32_WCE -# include -# endif -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# ifdef M_I86 - #include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# define vsnprintf _vsnprintf -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif -#ifdef VMS -# define NO_vsnprintf -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int z_verbose; - extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib1.c b/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib1.c deleted file mode 100644 index 22b2d397b..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib1.c +++ /dev/null @@ -1,232 +0,0 @@ -//================================================================= -// -// zlib1.c -// -// zlib compression/decompression test 1 -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jskov -// Contributors: jskov -// Date: 2001-03-09 -// Description: Tests zlib compress/decompress functionality. -//####DESCRIPTIONEND#### - - -#include // CYGNUM_HAL_STACK_SIZE_TYPICAL - -#include - -#include -#include - -#ifdef CYGFUN_KERNEL_API_C - -#include -#include - -#define NTHREADS 1 -#define STACKSIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL > 8192 ? CYGNUM_HAL_STACK_SIZE_TYPICAL : 8192) - -static cyg_handle_t thread[NTHREADS]; - -static cyg_thread thread_obj[NTHREADS]; -static char stack[NTHREADS][STACKSIZE]; - -static char license_txt[] = -"Red Hat eCos Public License v1.1\n" -"\n" -"\n" -"1. DEFINITIONS\n" -"\n" -"1.1. \"Contributor\" means each entity that creates or\n" -"contributes to the creation of Modifications.\n" -"\n" -"1.2. \"Contributor Version\" means the combination of the\n" -"Original Code, prior Modifications used by a\n" -"Contributor, and the Modifications made by that\n" -"particular Contributor.\n" -"\n" -"1.3. \"Covered Code\" means the Original Code or\n" -"Modifications or the combination of the Original Code\n" -"and Modifications, in each case including portions\n" -"thereof.\n" -"\n" -"1.4. \"Electronic Distribution Mechanism\" means a\n" -"mechanism generally accepted in the software development\n" -"community for the electronic transfer of data.\n" -"\n" -"1.5. \"Executable\" means Covered Code in any form other\n" -"than Source Code.\n" -"1.6. \"Initial Developer\" means the individual or entity\n" -"identified as the Initial Developer in the Source Code\n" -"notice required by Exhibit A.\n" -"\n" -"1.7. \"Larger Work\" means a work which combines Covered\n" -"Code or portions thereof with code not governed by the\n" -"terms of this License.\n" -"\n" -"1.8. \"License\" means this document.\n" -"\n" -"1.9. \"Modifications\" means any addition to or deletion\n" -"from the substance or structure of either the Original\n" -"Code or any previous Modifications. When Covered Code is\n" -"released as a series of files, a Modification is:\n" -"\n" -" A. Any addition to or deletion from the\n" -" contents of a file containing Original Code or\n" -" previous Modifications.\n" -"\n" -" B. Any new file that contains any part of the\n" -" Original Code or previous Modifications.\n" -"\n" -"1.10. \"Original Code\" means Source Code of computer\n" -"software code which is described in the Source Code\n" -"notice required by Exhibit A as Original Code, and\n" -"which, at the time of its release under this License is\n" -"not already Covered Code governed by this License.\n" -"\n" -"1.11. \"Source Code\" means the preferred form of the\n" -"Covered Code for making modifications to it, including\n" -"all modules it contains, plus any associated interface\n" -"definition files, scripts used to control compilation\n" -"and installation of an Executable, or a list of source\n" -"code differential comparisons against either the\n" -"Original Code or another well known, available Covered\n" -"Code of the Contributor's choice. The Source Code can be\n" -"in a compressed or archival form, provided the\n" -"appropriate decompression or de-archiving software is\n" -"widely available for no charge.\n" -"\n" -"1.12. \"You\" means an individual or a legal entity\n" -"exercising rights under, and complying with all of the\n" -"terms of, this License or a future version of this\n" -"License issued under Section 6.1. For legal entities,\n" -"\"You\" includes any entity which controls, is controlled\n" -"by, or is under common control with You. For purposes of\n" -"this definition, \"control\" means (a) the power, direct\n" -"or indirect, to cause the direction or management of\n" -"such entity, whether by contract or otherwise, or (b)\n" -"ownership of fifty percent (50%) or more of the\n" -"outstanding shares or beneficial ownership of such\n" -"entity.\n" -"\n" -"1.13. \"Red Hat Branded Code\" is code that Red Hat\n" -"distributes and/or permits others to distribute under\n" -"different terms than the Red Hat eCos Public License.\n" -"Red Hat's Branded Code may contain part or all of the\n" -"Covered Code.\n"; - -static void entry0( cyg_addrword_t data ) -{ - int i; - unsigned long len; - int err; - int buf_size = sizeof(license_txt)+512; - unsigned char* packed = malloc(buf_size); - unsigned char* unpacked = malloc(buf_size); - - if (NULL == packed || NULL == unpacked) - CYG_TEST_NA("Not enough memory for buffers"); - - CYG_TEST_INFO("Compressing"); - - len = buf_size; - err = compress(packed, &len, license_txt, sizeof(license_txt)); - diag_printf("len = %d", len); - diag_dump_buf(packed, len); - - if (Z_OK != err) - CYG_TEST_NA("Not enough memory for compression"); - - - CYG_TEST_INFO("Decompressing"); - err = uncompress(unpacked, &buf_size, packed, len); - - switch (err) { - case Z_OK: - break; - case Z_MEM_ERROR: - CYG_TEST_NA("Not enough memory for decompression"); - break; - case Z_BUF_ERROR: - CYG_TEST_FAIL_FINISH("Decompressed data larger than original"); - break; - case Z_DATA_ERROR: - CYG_TEST_FAIL_FINISH("Decompression failed"); - break; - default: - CYG_TEST_FAIL_FINISH("Unknown decompression error"); - break; - } - - for (i = 0; i < sizeof(license_txt)-1; i++) { - if (license_txt[i] != unpacked[i]) - CYG_TEST_FAIL_FINISH("Verify failed"); - } - - CYG_TEST_PASS_FINISH("zlib1 OK"); -} - -void zlib1_main( void ) -{ - CYG_TEST_INIT(); - - cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1", - (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]); - cyg_thread_resume(thread[0]); - - cyg_scheduler_start(); - - CYG_TEST_FAIL_FINISH("Not reached"); -} - -externC void -cyg_start( void ) -{ - zlib1_main(); -} - -#else /* def CYGFUN_KERNEL_API_C */ -externC void -cyg_start( void ) -{ - CYG_TEST_INIT(); - CYG_TEST_NA("Kernel C API layer disabled"); -} -#endif /* def CYGFUN_KERNEL_API_C */ - -// EOF zlib1.c diff --git a/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib2.c b/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib2.c deleted file mode 100644 index 11e36e136..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/tests/zlib2.c +++ /dev/null @@ -1,307 +0,0 @@ -//================================================================= -// -// zlib2.c -// -// zlib decompression test 2 -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jskov -// Contributors: jskov -// Date: 2001-03-09 -// Description: Tests zlib compression of gz compressed image. -//####DESCRIPTIONEND#### - - -#include // CYGNUM_HAL_STACK_SIZE_TYPICAL - -#include - -#include - -#ifdef CYGFUN_KERNEL_API_C - -#include -#include - -#define NTHREADS 1 -#define STACKSIZE (CYGNUM_HAL_STACK_SIZE_TYPICAL > 8192 ? CYGNUM_HAL_STACK_SIZE_TYPICAL : 8192) - -static cyg_handle_t thread[NTHREADS]; - -static cyg_thread thread_obj[NTHREADS]; -static char stack[NTHREADS][STACKSIZE]; - - -unsigned char gzip_test[] = { -0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x8d, 0x56, 0xdb, 0x6e, 0xe3, 0x36, -0x10, 0xed, 0x33, 0xbf, 0x82, 0x08, 0x50, 0x74, 0x03, 0xb8, 0xee, 0xa6, 0xed, 0x6e, 0x2f, 0x6f, -0xd9, 0x24, 0x8b, 0x06, 0xd8, 0x4b, 0x91, 0x2c, 0xba, 0xe8, 0x23, 0x4d, 0x8d, 0x6c, 0x22, 0x12, -0xa9, 0x92, 0x94, 0x9d, 0xfc, 0x7d, 0xcf, 0x0c, 0x25, 0x59, 0x72, 0x1a, 0xa0, 0x7e, 0x32, 0x45, -0x72, 0xe6, 0xcc, 0xcc, 0x99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 0x67, 0xfe, 0x94, 0x0f, 0xe0, 0x02, 0xe9, 0x48, 0xff, 0xf4, 0x2e, 0x16, -0x46, 0xdd, 0x3c, 0xee, 0xdc, 0xc6, 0x65, 0x7d, 0x29, 0x61, 0xfd, 0x02, 0x34, 0x1f, 0x4c, 0xdc, -0xe2, 0xfa, 0xd7, 0x10, 0x1f, 0xa6, 0xd4, 0xea, 0x03, 0x56, 0xfa, 0xb0, 0x73, 0x5c, 0x38, 0x29, -0x3a, 0x4d, 0xd1, 0xaa, 0x81, 0x22, 0x53, 0x09, 0xf5, 0x50, 0x42, 0x7d, 0x70, 0x99, 0x8f, 0x63, -0x17, 0x8e, 0xf5, 0x96, 0x8f, 0xfb, 0xe2, 0x95, 0x69, 0x9f, 0x29, 0xb6, 0xa9, 0xd0, 0xc6, 0xa5, -0xb1, 0x81, 0x05, 0xc5, 0xaf, 0x8c, 0xa2, 0xac, 0x8f, 0x99, 0xc0, 0x99, 0x2a, 0xd8, 0x9e, 0xeb, -0x25, 0x87, 0x7e, 0xc3, 0xa1, 0x05, 0xb5, 0x26, 0xb0, 0x48, 0xba, 0xa9, 0x2a, 0x27, 0x2c, 0x41, -0xdb, 0x02, 0x59, 0x85, 0x72, 0xf2, 0x52, 0xd5, 0x31, 0xb4, 0x85, 0x06, 0xfd, 0x26, 0x65, 0xe3, -0xad, 0x00, 0x07, 0xab, 0x7a, 0x9b, 0x7b, 0x90, 0x02, 0x68, 0xc8, 0x31, 0xfc, 0x05, 0x97, 0xa7, -0x08, 0xd9, 0x74, 0x17, 0x69, 0xef, 0x42, 0x9f, 0x4e, 0xda, 0x5f, 0x7f, 0xdd, 0x91, 0x3f, 0x21, -0x40, 0x52, 0x11, 0x8e, 0x4d, 0x2a, 0x55, 0x32, 0x3a, 0x51, 0x74, 0x24, 0x21, 0xd7, 0xae, 0x21, -0xf4, 0x82, 0x59, 0x18, 0xc1, 0x85, 0xdf, 0x95, 0xd2, 0xfc, 0xbb, 0x5c, 0xeb, 0xcb,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0x93, 0x48, 0x78, 0x6d, 0x2c, 0xa9, 0x8a, 0x6a, 0xe7, -0x0b, 0xff, 0x06, 0xbe, 0x72, 0xb6, 0xbb, 0x3c, 0x8c, 0x23, 0xb8, 0x91, 0x01, 0x19, 0x1a, 0xa9, -0x93, 0x6b, 0xc4, 0xbd, 0x48, 0x3e, 0x8c, 0x67, 0x38, 0x9d, 0x06, 0x03, 0x64, 0xef, 0x28, 0x96, -0x2b, 0xe9, 0x24, 0xdd, 0x40, 0xcc, 0x79, 0x2f, 0x49, 0x02, 0x94, 0x14, 0x16, 0x51, 0x20, 0x6a, -0x96, 0x36, 0x53, 0x8c, 0x9a, 0xe8, 0x12, 0x87, 0x64, 0xb6, 0x0c, 0x38, 0xcf, 0x9a, 0x53, 0x3d, -0x23, 0x9c, 0xf1, 0xa2, 0xb2, 0xfa, 0x40, 0x08, 0xf7, 0xc1, 0x87, 0x83, 0x47, 0x25, 0xf7, 0x06, -0xb8, 0xe0, 0xf4, 0x44, 0xac, 0xca, 0xac, 0x9a, 0x0d, 0xc4, 0xef, 0x92, 0xb6, 0xbb, 0x80, 0xe2, -0xac, 0xf5, 0x97, 0x25, 0x8f, 0x30, 0xa8, 0xbc, 0xde, 0x90, 0x62, 0x39, 0x17, 0x4c, 0x91, 0x12, -0x87, 0xcf, 0x1e, 0xa3, 0xdd, 0xb9, 0x3d, 0x20, 0x70, 0x8d, 0x78, 0x70, 0x07, 0x08, 0x35, 0xc9, -0x48, 0x56, 0xa6, 0xc3, 0x12, 0xa3, 0x1c, 0x39, 0x05, 0x4d, 0xc7, 0x7b, 0x92, 0x0f, 0x6e, 0xe4, -0xef, 0xcb, 0x5d, 0x2e, 0xde, 0xc4, 0x6d, 0x10, 0xe9, 0x80, 0xfb, 0x3c, 0xb4, 0x26, 0xd8, 0x5c, -0x64, 0x8f, 0x44, 0xef, 0x58, 0x94, 0x0b, 0x6b, 0xf8, 0x91, 0xf1, 0x77, 0xe8, 0x8f, 0x72, 0x77, -0x32, 0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 0x97, 0x4a, 0x63, 0xbc, 0xda, 0x9c, 0x2b, -0x50, 0x17, 0xa9, 0xdd, 0xb9, 0xae, 0x8c, 0x8a, 0x1a, 0xb9, 0xc0, 0x40, 0xb7, 0x6c, 0xf3, 0xd5, -0x9b, 0xd7, 0xdf, 0x9e, 0x8b, 0x9f, 0x10, 0x47, 0x1e, 0xab, 0xd0, 0x67, 0x1e, 0x66, 0xf2, 0x8e, -0x4a, 0x60, 0x8a, 0xbc, 0x5e, 0xc1, 0x59, 0x8f, 0x20, 0x2d, 0xb7, 0xd2, 0xc2, 0x20, 0x63, 0x52, -0x05, 0x53, 0x21, 0x14, 0xbf, 0x03, 0xef, 0x86, 0x37, 0xf5, 0x3b, 0x3c, 0x76, 0xaa, 0xe9, 0x3d, -0x28, 0x19, 0xaf, 0x06, 0xfd, 0x1f, 0x8e, 0xa8, 0x6a, 0x7c, 0x85, 0x49, 0xb5, 0xaa, 0x1f, 0x38, -0xbd, 0x20, 0x0b, 0xab, 0xa4, 0x84, 0x22, 0x02, 0x74, 0x3c, 0x54, 0xca, 0xa3, 0xa6, 0xd6, 0xd6, -0x85, 0x59, 0xf2, 0x16, 0xe2, 0xec, 0xdd, 0xbd, 0xfc, 0x9a, 0x5f, 0xab, 0x61, 0x13, 0xdd, 0x39, -0x07, 0x86, 0x24, 0x3f, 0x8d, 0x2a, 0x36, 0x4c, 0xa2, 0x38, 0xe7, 0xee, 0x5c, 0x26, 0xd7, 0xea, -0x9b, 0x7f, 0x01, 0x21, 0xe0, 0xda, 0x98, 0x30, 0x0c, 0x00, 0x00}; - -unsigned char gzip_test_ref[] = -"Red Hat eCos Public License v1.1\n" -"\n" -"\n" -"\n" -"1. DEFINITIONS\n" -"\n" -"1.1. \"Contributor\" means each entity that creates or\n" -"contributes to the creation of Modifications.\n" -"\n" -"1.2. \"Contributor Version\" means the combination of the\n" -"Original Code, prior Modifications used by a\n" -"Contributor, and the Modifications made by that\n" -"particular Contributor.\n" -"\n" -"1.3. \"Covered Code\" means the Original Code or\n" -"Modifications or the combination of the Original Code\n" -"and Modifications, in each case including portions\n" -"thereof.\n" -"\n" -"1.4. \"Electronic Distribution Mechanism\" means a\n" -"mechanism generally accepted in the software development\n" -"community for the electronic transfer of data.\n" -"\n" -"1.5. \"Executable\" means Covered Code in any form other\n" -"than Source Code.\n" -"1.6. \"Initial Developer\" means the individual or entity\n" -"identified as the Initial Developer in the Source Code\n" -"notice required by Exhibit A.\n" -"\n" -"1.7. \"Larger Work\" means a work which combines Covered\n" -"Code or portions thereof with code not governed by the\n" -"terms of this License.\n" -"\n" -"1.8. \"License\" means this document.\n" -"\n" -"1.9. \"Modifications\" means any addition to or deletion\n" -"from the substance or structure of either the Original\n" -"Code or any previous Modifications. When Covered Code is\n" -"released as a series of files, a Modification is:\n" -"\n" -" A. Any addition to or deletion from the\n" -" contents of a file containing Original Code or\n" -" previous Modifications.\n" -"\n" -" B. Any new file that contains any part of the\n" -" Original Code or previous Modifications.\n" -"\n" -"1.10. \"Original Code\" means Source Code of computer\n" -"software code which is described in the Source Code\n" -"notice required by Exhibit A as Original Code, and\n" -"which, at the time of its release under this License is\n" -"not already Covered Code governed by this License.\n" -"\n" -"1.11. \"Source Code\" means the preferred form of the\n" -"Covered Code for making modifications to it, including\n" -"all modules it contains, plus any associated interface\n" -"definition files, scripts used to control compilation\n" -"and installation of an Executable, or a list of source\n" -"code differential comparisons against either the\n" -"Original Code or another well known, available Covered\n" -"Code of the Contributor's choice. The Source Code can be\n" -"in a compressed or archival form, provided the\n" -"appropriate decompression or de-archiving software is\n" -"widely available for no charge.\n" -"\n" -"1.12. \"You\" means an individual or a legal entity\n" -"exercising rights under, and complying with all of the\n" -"terms of, this License or a future version of this\n" -"License issued under Section 6.1. For legal entities,\n" -"\"You\" includes any entity which controls, is controlled\n" -"by, or is under common control with You. For purposes of\n" -"this definition, \"control\" means (a) the power, direct\n" -"or indirect, to cause the direction or management of\n" -"such entity, whether by contract or otherwise, or (b)\n" -"ownership of fifty percent (50%) or more of the\n" -"outstanding shares or beneficial ownership of such\n" -"entity.\n" -"\n" -"1.13. \"Red Hat Branded Code\" is code that Red Hat\n" -"distributes and/or permits others to distribute under\n" -"different terms than the Red Hat eCos Public License.\n" -"Red Hat's Branded Code may contain part or all of the\n" -"Covered Code.\n"; - -static void entry0( cyg_addrword_t data ) -{ - int i; - unsigned long len; - int err; - int buf_size = sizeof(gzip_test_ref)+512; - unsigned char* unpacked = malloc(buf_size); - - if (NULL == unpacked) - CYG_TEST_NA("Not enough memory for buffers"); - - CYG_TEST_INFO("Decompressing"); - len = buf_size; - err = uncompress(unpacked, &len, gzip_test, sizeof(gzip_test)); - - switch (err) { - case Z_OK: - break; - case Z_MEM_ERROR: - CYG_TEST_NA("Not enough memory for decompression"); - break; - case Z_BUF_ERROR: - CYG_TEST_FAIL_FINISH("Decompressed data larger than original"); - break; - case Z_DATA_ERROR: - CYG_TEST_FAIL_FINISH("Decompression failed"); - break; - default: - CYG_TEST_FAIL_FINISH("Unknown decompression error"); - break; - } - - for (i = 0; i < sizeof(gzip_test_ref)-1; i++) { - if (gzip_test_ref[i] != unpacked[i]) - CYG_TEST_FAIL_FINISH("Verify failed"); - } - - CYG_TEST_PASS_FINISH("zlib2 OK"); -} - -void zlib2_main( void ) -{ - CYG_TEST_INIT(); - - cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "zlib1", - (void *)stack[0], STACKSIZE,&thread[0], &thread_obj[0]); - cyg_thread_resume(thread[0]); - - cyg_scheduler_start(); - - CYG_TEST_FAIL_FINISH("Not reached"); -} - -externC void -cyg_start( void ) -{ - zlib2_main(); -} - -#else /* def CYGFUN_KERNEL_API_C */ -externC void -cyg_start( void ) -{ - CYG_TEST_INIT(); - CYG_TEST_NA("Kernel C API layer disabled"); -} -#endif /* def CYGFUN_KERNEL_API_C */ - -// EOF zlib1.c diff --git a/components/dfs/filesystems/jffs2/cyg/compress/zconf.h b/components/dfs/filesystems/jffs2/cyg/compress/zconf.h deleted file mode 100644 index dc360d8ff..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/zconf.h +++ /dev/null @@ -1,358 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -// #ifdef __ECOS__ -#undef __ECOS__ -#define __ECOS__ -#include - -#ifndef RT_USING_LIBC -#define malloc rt_malloc -#define free rt_free -#define printf rt_kprintf -#endif - -//#define Z_PREFIX //by prife -//#include //prife no such file. - -#if CYGINT_COMPRESS_ZLIB_LOCAL_ALLOC != 0 -#define MY_ZCALLOC -#endif -#ifdef CYGSEM_COMPRESS_ZLIB_DEFLATE_MAKES_GZIP -#undef MAX_WBITS -#define MAX_WBITS 15+16 /* 32K LZ77 window */ -#else -#define NO_GZIP -#define NO_GZCOMPRESS -#endif -// #endif - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define deflatePrime z_deflatePrime -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table -# define zError z_zError - -# define alloc_func z_alloc_func -# define free_func z_free_func -# define in_func z_in_func -# define out_func z_out_func -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -# define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/compress/zlib.h b/components/dfs/filesystems/jffs2/cyg/compress/zlib.h deleted file mode 100644 index 081e7c912..000000000 --- a/components/dfs/filesystems/jffs2/cyg/compress/zlib.h +++ /dev/null @@ -1,1358 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.3, July 18th, 2005 - - Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.3" -#define ZLIB_VERNUM 0x1230 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumualte before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it gets to the next deflate block boundary. When decoding the - zlib or gzip format, this will cause inflate() to return immediately after - the header and before the first block. When doing a raw inflate, inflate() - will go ahead and process the first block, and will return when it gets to - the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. Z_FIXED prevents the - use of dynamic Huffman codes, allowing for a simpler decoder for special - applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. In addition, the - current implementation of deflate will use at most the window size minus - 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is - a crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a null strm). msg - is set to null if there is no error message. inflateInit2 does not perform - any decompression apart from reading the zlib header if present: this will - be done by inflate(). (So next_in and avail_in may be modified, but next_out - and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called - immediately after inflateInit2() or inflateReset() and before any call of - inflate() to set the dictionary. The application must insure that the - dictionary that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK can be used to - force inflate() to return immediately after header processing is complete - and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When - any of extra, name, or comment are not Z_NULL and the respective field is - not present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns 1 if file is being read directly without decompression, otherwise - zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -#ifndef __ECOS__ -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); -/* - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is NULL, this function returns the required initial - value for the for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ -#endif // __ECOS__ - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - -/* - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/components/dfs/filesystems/jffs2/cyg/crc/crc.h b/components/dfs/filesystems/jffs2/cyg/crc/crc.h deleted file mode 100644 index 7b7db10e9..000000000 --- a/components/dfs/filesystems/jffs2/cyg/crc/crc.h +++ /dev/null @@ -1,105 +0,0 @@ -//========================================================================== -// -// crc.h -// -// Interface for the CRC algorithms. -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 2002, 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): Andrew Lunn -// Contributors: Andrew Lunn -// Date: 2002-08-06 -// Purpose: -// Description: -// -// This code is part of eCos (tm). -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#ifndef _SERVICES_CRC_CRC_H_ -#define _SERVICES_CRC_CRC_H_ - -#include - -#ifndef __externC -# ifdef __cplusplus -# define __externC extern "C" -# else -# define __externC extern -# endif -#endif - -// Compute a CRC, using the POSIX 1003 definition - -__externC cyg_uint32 -cyg_posix_crc32(unsigned char *s, int len); - -// Gary S. Brown's 32 bit CRC - -__externC cyg_uint32 -cyg_crc32(unsigned char *s, int len); - -// Gary S. Brown's 32 bit CRC, but accumulate the result from a -// previous CRC calculation - -__externC cyg_uint32 -cyg_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len); - -// Ethernet FCS Algorithm - -__externC cyg_uint32 -cyg_ether_crc32(unsigned char *s, int len); - -// Ethernet FCS algorithm, but accumulate the result from a previous -// CRC calculation. - -__externC cyg_uint32 -cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char *s, int len); - -// 16 bit CRC with polynomial x^16+x^12+x^5+1 - -__externC cyg_uint16 -cyg_crc16(unsigned char *s, int len); - -__externC cyg_uint16 -cyg_crc16_accumulate(cyg_uint16 crc, unsigned char *s, int len); - -#endif // _SERVICES_CRC_CRC_H_ - - - diff --git a/components/dfs/filesystems/jffs2/cyg/crc/crc16.c b/components/dfs/filesystems/jffs2/cyg/crc/crc16.c deleted file mode 100644 index 7d6fa3810..000000000 --- a/components/dfs/filesystems/jffs2/cyg/crc/crc16.c +++ /dev/null @@ -1,104 +0,0 @@ -//========================================================================== -// -// crc16.c -// -// 16 bit CRC with polynomial x^16+x^12+x^5+1 -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas,asl -// Date: 2001-01-31 -// Purpose: -// Description: -// -// This code is part of eCos (tm). -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include - -// Table of CRC constants - implements x^16+x^12+x^5+1 -static const cyg_uint16 crc16_tab[] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, -}; - -cyg_uint16 -cyg_crc16(unsigned char *buf, int len) -{ - int i; - cyg_uint16 cksum; - - cksum = 0; - for (i = 0; i < len; i++) { - cksum = crc16_tab[((cksum>>8) ^ *buf++) & 0xFF] ^ (cksum << 8); - } - return cksum; -} - diff --git a/components/dfs/filesystems/jffs2/cyg/crc/crc32.c b/components/dfs/filesystems/jffs2/cyg/crc/crc32.c deleted file mode 100644 index 7e4ea269f..000000000 --- a/components/dfs/filesystems/jffs2/cyg/crc/crc32.c +++ /dev/null @@ -1,166 +0,0 @@ -//========================================================================== -// -// crc32.c -// -// Gary S. Brown's 32 bit CRC -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas,asl -// Date: 2001-01-31 -// Purpose: -// Description: -// -// This code is part of eCos (tm). -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include - - /* ====================================================================== */ - /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ - /* code or tables extracted from it, as desired without restriction. */ - /* */ - /* First, the polynomial itself and its table of feedback terms. The */ - /* polynomial is */ - /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ - /* */ - /* ====================================================================== */ - -static const cyg_uint32 crc32_tab[] = { - 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, - 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, - 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, - 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, - 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, - 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, - 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, - 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, - 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, - 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, - 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, - 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, - 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, - 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, - 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, - 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, - 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, - 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, - 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, - 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, - 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, - 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, - 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, - 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, - 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, - 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, - 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, - 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, - 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, - 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, - 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, - 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, - 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, - 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, - 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, - 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, - 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, - 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, - 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, - 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, - 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, - 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, - 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, - 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, - 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, - 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, - 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, - 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, - 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, - 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, - 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, - 0x2d02ef8dL - }; - -/* This is the standard Gary S. Brown's 32 bit CRC algorithm, but - accumulate the CRC into the result of a previous CRC. */ -cyg_uint32 -cyg_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len) -{ - int i; - - for (i = 0; i < len; i++) { - crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8); - } - return crc32val; -} - -/* This is the standard Gary S. Brown's 32 bit CRC algorithm */ -cyg_uint32 -cyg_crc32(unsigned char *s, int len) -{ - return (cyg_crc32_accumulate(0,s,len)); -} - -/* Return a 32-bit CRC of the contents of the buffer accumulating the - result from a previous CRC calculation. This uses the Ethernet FCS - algorithm.*/ -cyg_uint32 -cyg_ether_crc32_accumulate(cyg_uint32 crc32val, unsigned char *s, int len) -{ - int i; - - if (s == 0) return 0L; - - crc32val = crc32val ^ 0xffffffff; - for (i = 0; i < len; i++) { - crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8); - } - return crc32val ^ 0xffffffff; -} - -/* Return a 32-bit CRC of the contents of the buffer, using the - Ethernet FCS algorithm. */ -cyg_uint32 -cyg_ether_crc32(unsigned char *s, int len) -{ - return cyg_ether_crc32_accumulate(0,s,len); -} - - diff --git a/components/dfs/filesystems/jffs2/cyg/crc/posix_crc.c b/components/dfs/filesystems/jffs2/cyg/crc/posix_crc.c deleted file mode 100644 index 0da50e9a4..000000000 --- a/components/dfs/filesystems/jffs2/cyg/crc/posix_crc.c +++ /dev/null @@ -1,116 +0,0 @@ -//========================================================================== -// -// posix_crc.c -// -// POSIX CRC calculation -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): gthomas -// Contributors: gthomas,asl -// Date: 2001-01-31 -// Purpose: -// Description: -// -// This code is part of eCos (tm). -// -//####DESCRIPTIONEND#### -// -//========================================================================== - -#include - -// Compute a CRC, using the POSIX 1003 definition - -// Same basic algorithm as CRC-16, but the bits are defined in the -// opposite order. This computation matches the output of the -// Linux 'cksum' program. - -static const cyg_uint32 posix_crc32_tab[] = { - 0x00000000, 0x04C11DB7, 0x09823B6E, 0x0D4326D9, 0x130476DC, 0x17C56B6B, 0x1A864DB2, 0x1E475005, - 0x2608EDB8, 0x22C9F00F, 0x2F8AD6D6, 0x2B4BCB61, 0x350C9B64, 0x31CD86D3, 0x3C8EA00A, 0x384FBDBD, - 0x4C11DB70, 0x48D0C6C7, 0x4593E01E, 0x4152FDA9, 0x5F15ADAC, 0x5BD4B01B, 0x569796C2, 0x52568B75, - 0x6A1936C8, 0x6ED82B7F, 0x639B0DA6, 0x675A1011, 0x791D4014, 0x7DDC5DA3, 0x709F7B7A, 0x745E66CD, - 0x9823B6E0, 0x9CE2AB57, 0x91A18D8E, 0x95609039, 0x8B27C03C, 0x8FE6DD8B, 0x82A5FB52, 0x8664E6E5, - 0xBE2B5B58, 0xBAEA46EF, 0xB7A96036, 0xB3687D81, 0xAD2F2D84, 0xA9EE3033, 0xA4AD16EA, 0xA06C0B5D, - 0xD4326D90, 0xD0F37027, 0xDDB056FE, 0xD9714B49, 0xC7361B4C, 0xC3F706FB, 0xCEB42022, 0xCA753D95, - 0xF23A8028, 0xF6FB9D9F, 0xFBB8BB46, 0xFF79A6F1, 0xE13EF6F4, 0xE5FFEB43, 0xE8BCCD9A, 0xEC7DD02D, - 0x34867077, 0x30476DC0, 0x3D044B19, 0x39C556AE, 0x278206AB, 0x23431B1C, 0x2E003DC5, 0x2AC12072, - 0x128E9DCF, 0x164F8078, 0x1B0CA6A1, 0x1FCDBB16, 0x018AEB13, 0x054BF6A4, 0x0808D07D, 0x0CC9CDCA, - 0x7897AB07, 0x7C56B6B0, 0x71159069, 0x75D48DDE, 0x6B93DDDB, 0x6F52C06C, 0x6211E6B5, 0x66D0FB02, - 0x5E9F46BF, 0x5A5E5B08, 0x571D7DD1, 0x53DC6066, 0x4D9B3063, 0x495A2DD4, 0x44190B0D, 0x40D816BA, - 0xACA5C697, 0xA864DB20, 0xA527FDF9, 0xA1E6E04E, 0xBFA1B04B, 0xBB60ADFC, 0xB6238B25, 0xB2E29692, - 0x8AAD2B2F, 0x8E6C3698, 0x832F1041, 0x87EE0DF6, 0x99A95DF3, 0x9D684044, 0x902B669D, 0x94EA7B2A, - 0xE0B41DE7, 0xE4750050, 0xE9362689, 0xEDF73B3E, 0xF3B06B3B, 0xF771768C, 0xFA325055, 0xFEF34DE2, - 0xC6BCF05F, 0xC27DEDE8, 0xCF3ECB31, 0xCBFFD686, 0xD5B88683, 0xD1799B34, 0xDC3ABDED, 0xD8FBA05A, - 0x690CE0EE, 0x6DCDFD59, 0x608EDB80, 0x644FC637, 0x7A089632, 0x7EC98B85, 0x738AAD5C, 0x774BB0EB, - 0x4F040D56, 0x4BC510E1, 0x46863638, 0x42472B8F, 0x5C007B8A, 0x58C1663D, 0x558240E4, 0x51435D53, - 0x251D3B9E, 0x21DC2629, 0x2C9F00F0, 0x285E1D47, 0x36194D42, 0x32D850F5, 0x3F9B762C, 0x3B5A6B9B, - 0x0315D626, 0x07D4CB91, 0x0A97ED48, 0x0E56F0FF, 0x1011A0FA, 0x14D0BD4D, 0x19939B94, 0x1D528623, - 0xF12F560E, 0xF5EE4BB9, 0xF8AD6D60, 0xFC6C70D7, 0xE22B20D2, 0xE6EA3D65, 0xEBA91BBC, 0xEF68060B, - 0xD727BBB6, 0xD3E6A601, 0xDEA580D8, 0xDA649D6F, 0xC423CD6A, 0xC0E2D0DD, 0xCDA1F604, 0xC960EBB3, - 0xBD3E8D7E, 0xB9FF90C9, 0xB4BCB610, 0xB07DABA7, 0xAE3AFBA2, 0xAAFBE615, 0xA7B8C0CC, 0xA379DD7B, - 0x9B3660C6, 0x9FF77D71, 0x92B45BA8, 0x9675461F, 0x8832161A, 0x8CF30BAD, 0x81B02D74, 0x857130C3, - 0x5D8A9099, 0x594B8D2E, 0x5408ABF7, 0x50C9B640, 0x4E8EE645, 0x4A4FFBF2, 0x470CDD2B, 0x43CDC09C, - 0x7B827D21, 0x7F436096, 0x7200464F, 0x76C15BF8, 0x68860BFD, 0x6C47164A, 0x61043093, 0x65C52D24, - 0x119B4BE9, 0x155A565E, 0x18197087, 0x1CD86D30, 0x029F3D35, 0x065E2082, 0x0B1D065B, 0x0FDC1BEC, - 0x3793A651, 0x3352BBE6, 0x3E119D3F, 0x3AD08088, 0x2497D08D, 0x2056CD3A, 0x2D15EBE3, 0x29D4F654, - 0xC5A92679, 0xC1683BCE, 0xCC2B1D17, 0xC8EA00A0, 0xD6AD50A5, 0xD26C4D12, 0xDF2F6BCB, 0xDBEE767C, - 0xE3A1CBC1, 0xE760D676, 0xEA23F0AF, 0xEEE2ED18, 0xF0A5BD1D, 0xF464A0AA, 0xF9278673, 0xFDE69BC4, - 0x89B8FD09, 0x8D79E0BE, 0x803AC667, 0x84FBDBD0, 0x9ABC8BD5, 0x9E7D9662, 0x933EB0BB, 0x97FFAD0C, - 0xAFB010B1, 0xAB710D06, 0xA6322BDF, 0xA2F33668, 0xBCB4666D, 0xB8757BDA, 0xB5365D03, 0xB1F740B4 - }; - -cyg_uint32 -cyg_posix_crc32(unsigned char *s, int len) -{ - int i; - cyg_uint32 crc32val; - unsigned long length; - - crc32val = 0; - for (i = 0; i < len; i++) { - crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ *s++) & 0xFF]; - } - length = len; - while (length > 0) { - crc32val = (crc32val << 8) ^ posix_crc32_tab[((crc32val >> 24) ^ length) & 0xFF]; - length >>= 8; - } - crc32val = ~crc32val; - return crc32val; -} - diff --git a/components/dfs/filesystems/jffs2/cyg/fileio/fileio.h b/components/dfs/filesystems/jffs2/cyg/fileio/fileio.h deleted file mode 100644 index d364ae3b4..000000000 --- a/components/dfs/filesystems/jffs2/cyg/fileio/fileio.h +++ /dev/null @@ -1,489 +0,0 @@ -#ifndef CYGONCE_FILEIO_H -#define CYGONCE_FILEIO_H -//============================================================================= -// -// fileio.h -// -// Fileio header -// -//============================================================================= -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//============================================================================= -//#####DESCRIPTIONBEGIN#### -// -// Author(s): nickg -// Contributors: nickg -// Date: 2000-05-25 -// Purpose: Fileio header -// Description: This header contains the external definitions of the general file -// IO subsystem for POSIX and EL/IX compatability. -// -// Usage: -// #include -// ... -// -// -//####DESCRIPTIONEND#### -// -//============================================================================= - -//#include -//#include - -//#include -//#include -#ifdef CYGFUN_IO_FILEIO_SELECT -#include -#endif - -#include // NULL, size_t -#include -#if defined(__GNUC__) && !defined(__CC_ARM) -#include -#include -#else -#include -#include -#endif -//#include "os_sys_stat.h"//#include - -//============================================================================= -// forward definitions - -struct cyg_mtab_entry; -typedef struct cyg_mtab_entry cyg_mtab_entry; - -struct cyg_fstab_entry; -typedef struct cyg_fstab_entry cyg_fstab_entry; - -struct CYG_FILEOPS_TAG; -typedef struct CYG_FILEOPS_TAG cyg_fileops; - -struct CYG_FILE_TAG; -typedef struct CYG_FILE_TAG cyg_file; - -struct CYG_IOVEC_TAG; -typedef struct CYG_IOVEC_TAG cyg_iovec; - -struct CYG_UIO_TAG; -typedef struct CYG_UIO_TAG cyg_uio; - -struct CYG_SELINFO_TAG; -typedef struct CYG_SELINFO_TAG cyg_selinfo; - -//============================================================================= -// Directory pointer - -typedef CYG_ADDRWORD cyg_dir; - -#define CYG_DIR_NULL 0 - -//============================================================================= -// Filesystem table entry - -typedef int cyg_fsop_mount ( cyg_fstab_entry *fste, cyg_mtab_entry *mte ); -typedef int cyg_fsop_umount ( cyg_mtab_entry *mte ); -typedef int cyg_fsop_open ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - int mode, cyg_file *fte ); -typedef int cyg_fsop_unlink ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); -typedef int cyg_fsop_mkdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); -typedef int cyg_fsop_rmdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name ); -typedef int cyg_fsop_rename ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, - cyg_dir dir2, const char *name2 ); -typedef int cyg_fsop_link ( cyg_mtab_entry *mte, cyg_dir dir1, const char *name1, - cyg_dir dir2, const char *name2, int type ); -typedef int cyg_fsop_opendir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - cyg_file *fte ); -typedef int cyg_fsop_chdir ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - cyg_dir *dir_out ); -typedef int cyg_fsop_stat ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - struct stat *buf); -typedef int cyg_fsop_getinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - int key, void *buf, int len ); -typedef int cyg_fsop_setinfo ( cyg_mtab_entry *mte, cyg_dir dir, const char *name, - int key, void *buf, int len ); - - -struct cyg_fstab_entry -{ - const char *name; // filesystem name - CYG_ADDRWORD data; // private data value -//#ifdef CYGOPT_FS_JFFS2_GCTHREAD -// struct rt_mutex syncmode; // synchronization mode -//#endif - cyg_uint32 syncmode; // synchronization mode - cyg_fsop_mount *mount; - cyg_fsop_umount *umount; - cyg_fsop_open *open; - cyg_fsop_unlink *unlink; - cyg_fsop_mkdir *mkdir; - cyg_fsop_rmdir *rmdir; - cyg_fsop_rename *rename; - cyg_fsop_link *link; - cyg_fsop_opendir *opendir; - cyg_fsop_chdir *chdir; - cyg_fsop_stat *stat; - cyg_fsop_getinfo *getinfo; - cyg_fsop_setinfo *setinfo; -} ;// CYG_HAL_TABLE_TYPE; //prife - -//----------------------------------------------------------------------------- -// Keys for getinfo() and setinfo() - -#define FS_INFO_CONF 1 /* pathconf() */ -#define FS_INFO_ACCESS 2 /* access() */ -#define FS_INFO_GETCWD 3 /* getcwd() */ -#define FS_INFO_SYNC 4 /* cyg_fs_fssync() */ -#define FS_INFO_ATTRIB 5 /* cyg_fs_(get|set)_attrib() */ -#ifdef CYGSEM_FILEIO_INFO_DISK_USAGE -#define FS_INFO_DISK_USAGE 6 /* get_disk_usage() */ -#endif -#define FS_INFO_CHMOD 7 /* chmod() */ - -//----------------------------------------------------------------------------- -// Types for link() - -#define CYG_FSLINK_HARD 1 /* form a hard link */ -#define CYG_FSLINK_SOFT 2 /* form a soft link */ - -//----------------------------------------------------------------------------- -// getinfo() and setinfo() buffers structures. - -struct cyg_getcwd_info -{ - char *buf; /* buffer for cwd string */ - size_t size; /* size of buffer */ -}; - -struct cyg_fs_disk_usage{ - cyg_uint64 total_blocks; - cyg_uint64 free_blocks; - cyg_uint32 block_size; -}; - -typedef cyg_uint32 cyg_fs_attrib_t; - -//----------------------------------------------------------------------------- -// Macro to define an initialized fstab entry - -#define FSTAB_ENTRY( _l, _name, _data, _syncmode, _mount, _umount, \ - _open, _unlink, _mkdir, _rmdir, _rename, _link, \ - _opendir, _chdir, _stat, _getinfo, _setinfo) \ -struct cyg_fstab_entry _l /*CYG_HAL_TABLE_ENTRY(fstab) prife*/ = \ -{ \ - _name, \ - _data, \ - _syncmode, \ - _mount, \ - _umount, \ - _open, \ - _unlink, \ - _mkdir, \ - _rmdir, \ - _rename, \ - _link, \ - _opendir, \ - _chdir, \ - _stat, \ - _getinfo, \ - _setinfo \ -}; - -//============================================================================= -// Mount table entry - -struct cyg_mtab_entry -{ - const char *name; // name of mount point - const char *fsname; // name of implementing filesystem - const char *devname; // name of hardware device - CYG_ADDRWORD data; // private data value - - // The following are filled in after a successful mount operation - cyg_bool valid; // Valid entry? - cyg_fstab_entry *fs; // pointer to fstab entry - cyg_dir root; // root directory pointer -} ; // CYG_HAL_TABLE_TYPE; // prife - - -// This macro defines an initialized mtab entry - -#define MTAB_ENTRY( _l, _name, _fsname, _devname, _data ) \ -struct cyg_mtab_entry _l /*CYG_HAL_TABLE_ENTRY(mtab) prife */ = \ -{ \ - _name, \ - _fsname, \ - _devname, \ - _data, \ - false, \ - NULL, \ - CYG_DIR_NULL \ -}; - -//============================================================================= -// IO vector descriptors - -struct CYG_IOVEC_TAG -{ - void *iov_base; /* Base address. */ - ssize_t iov_len; /* Length. */ -}; - -enum cyg_uio_rw { UIO_READ, UIO_WRITE }; - -/* Segment flag values. */ -enum cyg_uio_seg -{ - UIO_USERSPACE, /* from user data space */ - UIO_SYSSPACE /* from system space */ -}; - -struct CYG_UIO_TAG -{ - struct CYG_IOVEC_TAG *uio_iov; /* pointer to array of iovecs */ - int uio_iovcnt; /* number of iovecs in array */ - off_t uio_offset; /* offset into file this uio corresponds to */ - ssize_t uio_resid; /* residual i/o count */ - enum cyg_uio_seg uio_segflg; /* see above */ - enum cyg_uio_rw uio_rw; /* see above */ -}; - -// Limits -#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ - -//============================================================================= -// Description of open file - -typedef int cyg_fileop_readwrite (struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); -typedef cyg_fileop_readwrite cyg_fileop_read; -typedef cyg_fileop_readwrite cyg_fileop_write; -typedef int cyg_fileop_lseek (struct CYG_FILE_TAG *fp, off_t *pos, int whence ); -typedef int cyg_fileop_ioctl (struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, - CYG_ADDRWORD data); -typedef cyg_bool cyg_fileop_select (struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info); -typedef int cyg_fileop_fsync (struct CYG_FILE_TAG *fp, int mode ); -typedef int cyg_fileop_close (struct CYG_FILE_TAG *fp); -typedef int cyg_fileop_fstat (struct CYG_FILE_TAG *fp, struct stat *buf ); -typedef int cyg_fileop_getinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); -typedef int cyg_fileop_setinfo (struct CYG_FILE_TAG *fp, int key, void *buf, int len ); - -struct CYG_FILEOPS_TAG -{ - cyg_fileop_read *fo_read; - cyg_fileop_write *fo_write; - cyg_fileop_lseek *fo_lseek; - cyg_fileop_ioctl *fo_ioctl; - cyg_fileop_select *fo_select; - cyg_fileop_fsync *fo_fsync; - cyg_fileop_close *fo_close; - cyg_fileop_fstat *fo_fstat; - cyg_fileop_getinfo *fo_getinfo; - cyg_fileop_setinfo *fo_setinfo; -}; - -struct CYG_FILE_TAG -{ - cyg_uint32 f_flag; /* file state */ - cyg_uint16 f_ucount; /* use count */ - cyg_uint16 f_type; /* descriptor type */ - cyg_uint32 f_syncmode; /* synchronization protocol */ - struct CYG_FILEOPS_TAG *f_ops; /* file operations */ - off_t f_offset; /* current offset */ - CYG_ADDRWORD f_data; /* file or socket */ - CYG_ADDRWORD f_xops; /* extra type specific ops */ - cyg_mtab_entry *f_mte; /* mount table entry */ -}; - -//----------------------------------------------------------------------------- -// File flags - -// Allocation here is that bits 0..15 are copies of bits from the open -// flags, bits 16..23 are extra bits that are visible to filesystems but -// are not derived from the open call, and bits 24..31 are reserved for -// the fileio infrastructure. -#define CYG_FREAD O_RDONLY -#define CYG_FWRITE O_WRONLY -#define CYG_FNONBLOCK O_NONBLOCK -#define CYG_FAPPEND O_APPEND -#define CYG_FASYNC 0x00010000 -#define CYG_FDIR 0x00020000 - -#define CYG_FLOCKED 0x01000000 // Set if file is locked -#define CYG_FLOCK 0x02000000 // Lock during file ops -#define CYG_FALLOC 0x80000000 // File is "busy", i.e. allocated - -// Mask for open mode bits stored in file object -#define CYG_FILE_MODE_MASK (CYG_FREAD|CYG_FWRITE|CYG_FNONBLOCK|CYG_FAPPEND) - -//----------------------------------------------------------------------------- -// Type of file - -#define CYG_FILE_TYPE_FILE 1 /* file */ -#define CYG_FILE_TYPE_SOCKET 2 /* communications endpoint */ -#define CYG_FILE_TYPE_DEVICE 3 /* device */ - -//----------------------------------------------------------------------------- -// Keys for getinfo() and setinfo() - -#define FILE_INFO_CONF 1 /* fpathconf() */ - -//----------------------------------------------------------------------------- -// Modes for fsync() - -#define CYG_FSYNC 1 -#define CYG_FDATASYNC 2 - -//----------------------------------------------------------------------------- -// Get/set info buffer structures - -// This is used for pathconf() and fpathconf() -struct cyg_pathconf_info -{ - int name; // POSIX defined variable name - long value; // Returned variable value -}; - -//============================================================================= -// Synchronization modes -// These values are filled into the syncmode fields of the above structures -// and define the synchronization protocol used when accessing the object in -// question. - -#define CYG_SYNCMODE_NONE (0) // no locking required - -#define CYG_SYNCMODE_FILE_FILESYSTEM 0x0002 // lock fs during file ops -#define CYG_SYNCMODE_FILE_MOUNTPOINT 0x0004 // lock mte during file ops -#define CYG_SYNCMODE_IO_FILE 0x0010 // lock file during io ops -#define CYG_SYNCMODE_IO_FILESYSTEM 0x0020 // lock fs during io ops -#define CYG_SYNCMODE_IO_MOUNTPOINT 0x0040 // lock mte during io ops -#define CYG_SYNCMODE_SOCK_FILE 0x0100 // lock socket during socket ops -#define CYG_SYNCMODE_SOCK_NETSTACK 0x0800 // lock netstack during socket ops - -#define CYG_SYNCMODE_IO_SHIFT (4) // shift for IO to file bits -#define CYG_SYNCMODE_SOCK_SHIFT (8) // shift for sock to file bits - -//============================================================================= -// Mount and umount functions - -__externC int mount( const char *devname, - const char *dir, - const char *fsname); - -__externC int umount( const char *name); - -//============================================================================= -// Get/Set info functions - -__externC int cyg_fs_getinfo( const char *path, int key, void *buf, int len ); -__externC int cyg_fs_setinfo( const char *path, int key, void *buf, int len ); -__externC int cyg_fs_fgetinfo( int fd, int key, void *buf, int len ); -__externC int cyg_fs_fsetinfo( int fd, int key, void *buf, int len ); - -#ifdef CYGFUN_IO_FILEIO_SELECT -//============================================================================= -// Select support - -//----------------------------------------------------------------------------- -// Data structure for embedding in client data structures. A pointer to this -// must be passed to cyg_selrecord() and cyg_selwakeup(). - -struct CYG_SELINFO_TAG -{ - CYG_ADDRWORD si_info; // info passed through from fo_select() - cyg_flag_value_t si_waitFlag; // select wait flags -}; - -//----------------------------------------------------------------------------- -// Select support functions. - -// cyg_selinit() is used to initialize a selinfo structure. -__externC void cyg_selinit( struct CYG_SELINFO_TAG *sip ); - -// cyg_selrecord() is called when a client device needs to register -// the current thread for selection. -__externC void cyg_selrecord( CYG_ADDRWORD info, struct CYG_SELINFO_TAG *sip ); - -// cyg_selwakeup() is called when the client device matches the select -// criterion, and needs to wake up a selector. -__externC void cyg_selwakeup( struct CYG_SELINFO_TAG *sip ); -#endif -//============================================================================= -// Timestamp support - -// Provides the current time as a time_t timestamp for use in filesystem -// data strucures. - -__externC time_t jffs2_get_timestamp(void); - -//============================================================================= -// Miscellaneous functions. - -// Provide a function to synchronize an individual file system. (ie write -// file and directory information to disk) -__externC int cyg_fs_fssync(const char *path); - -// Functions to set and get attributes of a file, eg FAT attributes -// like hidden and system. -__externC int cyg_fs_set_attrib( const char *fname, - const cyg_fs_attrib_t new_attrib ); -__externC int cyg_fs_get_attrib( const char *fname, - cyg_fs_attrib_t * const file_attrib ); - -// Functions to lock and unlock a filesystem. These are normally used -// internally by the fileio layer, but the file system might need to -// use them when it needs to lock itself, eg when performing garbage -// collect. -__externC void cyg_fs_lock( cyg_mtab_entry *mte, cyg_uint32 syncmode ); - -__externC void cyg_fs_unlock( cyg_mtab_entry *mte, cyg_uint32 syncmode ); - -// To be able to lock the filesystem you need the mte. This function -// allows the table of mounted filesystems to be searched to find an -// mte which uses the give filesystem root. - -__externC cyg_mtab_entry * cyg_fs_root_lookup( cyg_dir *root ); - -//============================================================================= -// Default functions. -// Cast to the appropriate type, these functions can be put into any of -// the operation table slots to provide the defined error code. - -__externC int cyg_fileio_enosys(void); -__externC int cyg_fileio_erofs(void); -__externC int cyg_fileio_enoerr(void); -__externC int cyg_fileio_enotdir(void); -__externC cyg_fileop_select cyg_fileio_seltrue; - -//----------------------------------------------------------------------------- -#endif // ifndef CYGONCE_FILEIO_H -// End of fileio.h diff --git a/components/dfs/filesystems/jffs2/cyg/hal/basetype.h b/components/dfs/filesystems/jffs2/cyg/hal/basetype.h deleted file mode 100644 index 6f3455c0d..000000000 --- a/components/dfs/filesystems/jffs2/cyg/hal/basetype.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef CYGONCE_HAL_BASETYPE_H -#define CYGONCE_HAL_BASETYPE_H - -//============================================================================= -// -// basetype.h -// -// Standard types for this architecture. -// -//============================================================================= -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//============================================================================= -//#####DESCRIPTIONBEGIN#### -// -// Author(s): nickg, gthomas -// Contributors: nickg, gthomas -// Date: 1998-09-11 -// Purpose: Define architecture base types. -// Usage: Included by "cyg_type.h", do not use directly - -// -//####DESCRIPTIONEND#### -// - -//----------------------------------------------------------------------------- -// Characterize the architecture - -#ifdef __ARMEB__ -# define CYG_BYTEORDER CYG_MSBFIRST // Big endian -#else -# define CYG_BYTEORDER CYG_LSBFIRST // Little endian -#endif - -#if defined(__ARMEL__) && defined(__VFP_FP__) -# define CYG_DOUBLE_BYTEORDER CYG_LSBFIRST -#else -# define CYG_DOUBLE_BYTEORDER CYG_MSBFIRST // Big? endian -#endif - -//----------------------------------------------------------------------------- -// ARM does not usually use labels with underscores. - -#define CYG_LABEL_NAME(_name_) _name_ -#define CYG_LABEL_DEFN(_name_) _name_ - -//----------------------------------------------------------------------------- -// Override the alignment definitions from cyg_type.h. ARM only allows 4 -// byte alignment whereas the default is 8 byte. - -#define CYGARC_ALIGNMENT 4 -#define CYGARC_P2ALIGNMENT 2 - -//----------------------------------------------------------------------------- -// Define the standard variable sizes - -// The ARM architecture uses the default definitions of the base types, -// so we do not need to define any here. - -//----------------------------------------------------------------------------- -#endif // CYGONCE_HAL_BASETYPE_H -// End of basetype.h diff --git a/components/dfs/filesystems/jffs2/cyg/hal/drv_api.h b/components/dfs/filesystems/jffs2/cyg/hal/drv_api.h deleted file mode 100644 index de4346673..000000000 --- a/components/dfs/filesystems/jffs2/cyg/hal/drv_api.h +++ /dev/null @@ -1,250 +0,0 @@ -#ifndef CYGONCE_HAL_DRV_API_H -#define CYGONCE_HAL_DRV_API_H - -/*========================================================================== -// -// drv_api.h -// -// Native API for Kernel -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): nickg -// Date: 1999-02-24 -// Purpose: Driver API -// Description: This file defines the API used by device drivers to access -// system services. When the kernel is present it maps directly -// to the Kernel C API. When the kernel is absent, it is provided -// by a set of HAL functions. -// -// Usage: #include -// -//####DESCRIPTIONEND#### -// -//========================================================================*/ - -//#include //mod by prife -#include - -#ifdef CYGPKG_KERNEL - -/*------------------------------------------------------------------------*/ -/* Kernel co-resident version of API */ - -#include - -#ifndef CYGFUN_KERNEL_API_C -#error Driver API requres Kernel API to be present -#endif - -#include - -#define cyg_drv_isr_lock cyg_interrupt_disable -#define cyg_drv_isr_unlock cyg_interrupt_enable - -#define cyg_drv_dsr_lock cyg_scheduler_lock -#define cyg_drv_dsr_unlock cyg_scheduler_unlock - -#define cyg_drv_mutex_t cyg_mutex_t -#define cyg_drv_mutex_init cyg_mutex_init -#define cyg_drv_mutex_destroy cyg_mutex_destroy -#define cyg_drv_mutex_lock cyg_mutex_lock -#define cyg_drv_mutex_trylock cyg_mutex_trylock -#define cyg_drv_mutex_unlock cyg_mutex_unlock -#define cyg_drv_mutex_release cyg_mutex_release - -#define cyg_drv_cond_t cyg_cond_t -#define cyg_drv_cond_init cyg_cond_init -#define cyg_drv_cond_destroy cyg_cond_destroy -#define cyg_drv_cond_wait cyg_cond_wait -#define cyg_drv_cond_signal cyg_cond_signal -#define cyg_drv_cond_broadcast cyg_cond_broadcast - -#define cyg_drv_interrupt_create cyg_interrupt_create -#define cyg_drv_interrupt_delete cyg_interrupt_delete -#define cyg_drv_interrupt_attach cyg_interrupt_attach -#define cyg_drv_interrupt_detach cyg_interrupt_detach -#define cyg_drv_interrupt_mask cyg_interrupt_mask -#define cyg_drv_interrupt_unmask cyg_interrupt_unmask -#define cyg_drv_interrupt_mask_intunsafe cyg_interrupt_mask_intunsafe -#define cyg_drv_interrupt_unmask_intunsafe cyg_interrupt_unmask_intunsafe -#define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge -#define cyg_drv_interrupt_configure cyg_interrupt_configure -#define cyg_drv_interrupt_level cyg_interrupt_level -#define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu -#define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu - -#define cyg_drv_spinlock_t cyg_spinlock_t -#define cyg_drv_spinlock_init cyg_spinlock_init -#define cyg_drv_spinlock_spin cyg_spinlock_spin -#define cyg_drv_spinlock_clear cyg_spinlock_clear -#define cyg_drv_spinlock_try cyg_spinlock_try -#define cyg_drv_spinlock_test cyg_spinlock_test -#define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave -#define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave - -#else /* CYGPKG_KERNEL */ - -/*------------------------------------------------------------------------*/ -/* Non-kernel version of API */ - -typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */ -typedef cyg_addrword_t cyg_handle_t; /* Object handle */ -typedef cyg_uint32 cyg_priority_t; /* type for priorities */ -typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */ -typedef cyg_uint32 cyg_cpu_t; /* CPU id */ -typedef int cyg_bool_t; -typedef cyg_int32 cyg_code_t; /* type for various codes */ - -typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, cyg_addrword_t data); -typedef void cyg_DSR_t(cyg_vector_t vector, - cyg_ucount32 count, - cyg_addrword_t data); - - -externC void cyg_drv_isr_lock(void); -externC void cyg_drv_isr_unlock(void); - -externC void cyg_drv_dsr_lock(void); -externC void cyg_drv_dsr_unlock(void); - -typedef struct -{ - cyg_atomic lock; -} cyg_drv_mutex_t; - -externC void cyg_drv_mutex_init( cyg_drv_mutex_t *mutex ); -externC void cyg_drv_mutex_destroy( cyg_drv_mutex_t *mutex ); -externC cyg_bool_t cyg_drv_mutex_lock( cyg_drv_mutex_t *mutex ); -externC cyg_bool_t cyg_drv_mutex_trylock( cyg_drv_mutex_t *mutex ); -externC void cyg_drv_mutex_unlock( cyg_drv_mutex_t *mutex ); -externC void cyg_drv_mutex_release( cyg_drv_mutex_t *mutex ); - -typedef struct -{ - cyg_atomic wait; - cyg_drv_mutex_t *mutex; -} cyg_drv_cond_t; - -externC void cyg_drv_cond_init( cyg_drv_cond_t *cond, cyg_drv_mutex_t *mutex ); -externC void cyg_drv_cond_destroy( cyg_drv_cond_t *cond ); -externC cyg_bool_t cyg_drv_cond_wait( cyg_drv_cond_t *cond ); -externC void cyg_drv_cond_signal( cyg_drv_cond_t *cond ); -externC void cyg_drv_cond_broadcast( cyg_drv_cond_t *cond ); - -typedef struct cyg_interrupt -{ - cyg_vector_t vector; - cyg_priority_t priority; - cyg_ISR_t *isr; - cyg_DSR_t *dsr; - CYG_ADDRWORD data; - - struct cyg_interrupt* volatile next_dsr; - volatile cyg_int32 dsr_count; - -#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN - struct cyg_interrupt *next; -#endif - -} cyg_interrupt; - -externC void cyg_drv_interrupt_create( - cyg_vector_t vector, - cyg_priority_t priority, - cyg_addrword_t data, - cyg_ISR_t *isr, - cyg_DSR_t *dsr, - cyg_handle_t *handle, - cyg_interrupt *intr - ); -externC void cyg_drv_interrupt_delete( cyg_handle_t interrupt ); -externC void cyg_drv_interrupt_attach( cyg_handle_t interrupt ); -externC void cyg_drv_interrupt_detach( cyg_handle_t interrupt ); - -externC void cyg_drv_interrupt_mask( cyg_vector_t vector ); -externC void cyg_drv_interrupt_mask_intunsafe( cyg_vector_t vector ); -externC void cyg_drv_interrupt_unmask( cyg_vector_t vector ); -externC void cyg_drv_interrupt_unmask_intunsafe( cyg_vector_t vector ); -externC void cyg_drv_interrupt_acknowledge( cyg_vector_t vector ); -externC void cyg_drv_interrupt_configure( - cyg_vector_t vector, - cyg_bool_t level, - cyg_bool_t up - ); -externC void cyg_drv_interrupt_level( cyg_vector_t vector, cyg_priority_t level ); -externC void cyg_drv_interrupt_set_cpu( cyg_vector_t vector, cyg_cpu_t cpu ); -externC cyg_cpu_t cyg_drv_interrupt_get_cpu( cyg_vector_t vector ); - - -enum cyg_ISR_results -{ - CYG_ISR_HANDLED = 1, /* Interrupt was handled */ - CYG_ISR_CALL_DSR = 2 /* Schedule DSR */ -}; - - -typedef struct -{ - cyg_atomic lock; -} cyg_drv_spinlock_t; - -void cyg_drv_spinlock_init( - cyg_drv_spinlock_t *lock, /* spinlock to initialize */ - cyg_bool_t locked /* init locked or unlocked */ -); - -void cyg_drv_spinlock_destroy( cyg_drv_spinlock_t *lock ); - -void cyg_drv_spinlock_spin( cyg_drv_spinlock_t *lock ); - -void cyg_drv_spinlock_clear( cyg_drv_spinlock_t *lock ); - -cyg_bool_t cyg_drv_spinlock_try( cyg_drv_spinlock_t *lock ); - -cyg_bool_t cyg_drv_spinlock_test( cyg_drv_spinlock_t *lock ); - -void cyg_drv_spinlock_spin_intsave( cyg_drv_spinlock_t *lock, - cyg_addrword_t *istate ); - -void cyg_drv_spinlock_clear_intsave( cyg_drv_spinlock_t *lock, - cyg_addrword_t istate ); - -#endif /* CYGPKG_KERNEL */ - -/*------------------------------------------------------------------------*/ -/* EOF drv_api.h */ -#endif // CYGONCE_HAL_DRV_API_H diff --git a/components/dfs/filesystems/jffs2/cyg/infra/cyg_type.h b/components/dfs/filesystems/jffs2/cyg/infra/cyg_type.h deleted file mode 100644 index 01b60c509..000000000 --- a/components/dfs/filesystems/jffs2/cyg/infra/cyg_type.h +++ /dev/null @@ -1,544 +0,0 @@ -#ifndef CYGONCE_INFRA_CYG_TYPE_H -#define CYGONCE_INFRA_CYG_TYPE_H - -//========================================================================== -// -// cyg_type.h -// -// Standard types, and some useful coding macros. -// -//========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2009 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): nickg from an original by hmt -// Contributors: nickg -// Date: 1997-09-08 -// Purpose: share unambiguously sized types. -// Description: we typedef [cyg_][u]int8,16,32 &c for general use. -// Usage: #include "cyg/infra/cyg_type.h" -// ... -// cyg_int32 my_32bit_integer; -// -//####DESCRIPTIONEND#### -// - -#include // Definition of NULL from the compiler - -// ------------------------------------------------------------------------- -// Some useful macros. These are defined here by default. - -// __externC is used in mixed C/C++ headers to force C linkage on an external -// definition. It avoids having to put all sorts of ifdefs in. - -#ifdef __cplusplus -# define __externC extern "C" -#else -# define __externC extern -#endif -// Also define externC for now - but it is deprecated -#define externC __externC - -// Compiler version. -#ifdef __GNUC__ -# if defined(__GNU_PATCHLEVEL__) -# define __GNUC_VERSION__ (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) -# else -# define __GNUC_VERSION__ (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100) -# endif -#endif - -// ------------------------------------------------------------------------- -// The header defines the base types used here. It is -// supplied either by the target architecture HAL, or by the host -// porting kit. They are all defined as macros, and only those that -// make choices other than the defaults given below need be defined. - -#define CYG_LSBFIRST 1234 -#define CYG_MSBFIRST 4321 - -#include - -#if (CYG_BYTEORDER != CYG_LSBFIRST) && (CYG_BYTEORDER != CYG_MSBFIRST) -# error You must define CYG_BYTEORDER to equal CYG_LSBFIRST or CYG_MSBFIRST -#endif - -#ifndef CYG_DOUBLE_BYTEORDER -#define CYG_DOUBLE_BYTEORDER CYG_BYTEORDER -#endif - -#ifndef cyg_halint8 -# define cyg_halint8 char -#endif -#ifndef cyg_halint16 -# define cyg_halint16 short -#endif -#ifndef cyg_halint32 -# define cyg_halint32 int -#endif -#ifndef cyg_halint64 -# define cyg_halint64 long long -#endif - -#ifndef cyg_halcount8 -# define cyg_halcount8 int -#endif -#ifndef cyg_halcount16 -# define cyg_halcount16 int -#endif -#ifndef cyg_halcount32 -# define cyg_halcount32 int -#endif -#ifndef cyg_halcount64 -# define cyg_halcount64 long long -#endif - -#ifndef cyg_haladdress -# define cyg_haladdress cyg_uint32 -#endif -#ifndef cyg_haladdrword -# define cyg_haladdrword cyg_uint32 -#endif - -#ifndef cyg_halbool -# define cyg_halbool int -#endif - -#ifndef cyg_halatomic -# define cyg_halatomic cyg_halint8 -#endif - -// ------------------------------------------------------------------------- -// Provide a default architecture alignment -// This may be overridden in basetype.h if necessary. -// These should be straightforward numbers to allow use in assembly. - -#ifndef CYGARC_ALIGNMENT -# define CYGARC_ALIGNMENT 8 -#endif -// And corresponding power of two alignment -#ifndef CYGARC_P2ALIGNMENT -# define CYGARC_P2ALIGNMENT 3 -#endif -#if (CYGARC_ALIGNMENT) != (1 << CYGARC_P2ALIGNMENT) -# error "Inconsistent CYGARC_ALIGNMENT and CYGARC_P2ALIGNMENT values" -#endif - -// ------------------------------------------------------------------------- -// The obvious few that compilers may define for you. -// But in case they don't: - -#ifndef NULL -# define NULL 0 -#endif - -#ifndef __cplusplus - -typedef cyg_halbool bool; - -# ifndef false -# define false 0 -# endif - -# ifndef true -# define true (!false) -# endif - -#endif - -// ------------------------------------------------------------------------- -// Allow creation of procedure-like macros that are a single statement, -// and must be followed by a semi-colon - -#define CYG_MACRO_START do { -#define CYG_MACRO_END } while (0) - -#define CYG_EMPTY_STATEMENT CYG_MACRO_START CYG_MACRO_END - -#define CYG_UNUSED_PARAM( _type_, _name_ ) CYG_MACRO_START \ - _type_ __tmp1 = (_name_); \ - _type_ __tmp2 = __tmp1; \ - __tmp1 = __tmp2; \ -CYG_MACRO_END - - -//---------------------------------------------------------------------------- -// The unused attribute stops the compiler warning about the variable -// not being used. -// The used attribute prevents the compiler from optimizing it away. - -#define CYG_REFERENCE_OBJECT(__object__) \ - CYG_MACRO_START \ - static const void* __cygvar_discard_me__ \ - __attribute__ ((unused, used)) = (const void*)&(__object__); \ - CYG_MACRO_END - -// ------------------------------------------------------------------------- -// Define basic types for using integers in memory and structures; -// depends on compiler defaults and CPU type. - -typedef unsigned cyg_halint8 cyg_uint8 ; -typedef signed cyg_halint8 cyg_int8 ; - -typedef unsigned cyg_halint16 cyg_uint16 ; -typedef signed cyg_halint16 cyg_int16 ; - -typedef unsigned cyg_halint32 cyg_uint32 ; -typedef signed cyg_halint32 cyg_int32 ; - -typedef unsigned cyg_halint64 cyg_uint64 ; -typedef signed cyg_halint64 cyg_int64 ; - -typedef cyg_halbool cyg_bool ; - -// ------------------------------------------------------------------------- -// Define types for using integers in registers for looping and the like; -// depends on CPU type, choose what it is most comfortable with, with at -// least the range required. - -typedef unsigned cyg_halcount8 cyg_ucount8 ; -typedef signed cyg_halcount8 cyg_count8 ; - -typedef unsigned cyg_halcount16 cyg_ucount16 ; -typedef signed cyg_halcount16 cyg_count16 ; - -typedef unsigned cyg_halcount32 cyg_ucount32 ; -typedef signed cyg_halcount32 cyg_count32 ; - -typedef unsigned cyg_halcount64 cyg_ucount64 ; -typedef signed cyg_halcount64 cyg_count64 ; - -// ------------------------------------------------------------------------- -// Define a type to be used for atomic accesses. This type is guaranteed -// to be read or written in a single uninterruptible operation. This type -// is at least a single byte. - -typedef volatile unsigned cyg_halatomic cyg_atomic; -typedef volatile unsigned cyg_halatomic CYG_ATOMIC; - -// ------------------------------------------------------------------------- -// Define types for access plain, on-the-metal memory or devices. - -typedef cyg_uint32 CYG_WORD; -typedef cyg_uint8 CYG_BYTE; -typedef cyg_uint16 CYG_WORD16; -typedef cyg_uint32 CYG_WORD32; -typedef cyg_uint64 CYG_WORD64; - -typedef cyg_haladdress CYG_ADDRESS; -typedef cyg_haladdrword CYG_ADDRWORD; - -// ------------------------------------------------------------------------- -// Number of elements in a (statically allocated) array. - -#define CYG_NELEM(a) (sizeof(a) / sizeof((a)[0])) - -// ------------------------------------------------------------------------- -// Constructor ordering macros. These are added as annotations to all -// static objects to order the constuctors appropriately. - -#if defined(__cplusplus) && defined(__GNUC__) && \ - !defined(CYGBLD_ATTRIB_INIT_PRI) -# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) __attribute__((init_priority(_pri_))) -#elif !defined(CYGBLD_ATTRIB_INIT_PRI) -// FIXME: should maybe just bomb out if this is attempted anywhere else? -// Not sure -# define CYGBLD_ATTRIB_INIT_PRI( _pri_ ) -#endif - -// The following will be removed eventually as it doesn't allow the use of -// e.g. pri+5 format -#define CYG_INIT_PRIORITY( _pri_ ) CYGBLD_ATTRIB_INIT_PRI( CYG_INIT_##_pri_ ) - -#define CYGBLD_ATTRIB_INIT_BEFORE( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_-100) -#define CYGBLD_ATTRIB_INIT_AFTER( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_+100) - -#if defined(__GNUC__) && !defined(__cplusplus) && (__GNUC_VERSION__ >= 40300) -// Equivalents of the above for C functions, available from gcc 4.3 onwards. -# define CYGBLD_ATTRIB_C_INIT_PRI( _pri_) __attribute__((constructor (_pri_))) -# define CYGBLD_ATTRIB_C_INIT_BEFORE( _pri_ ) __attribute__((constructor (_pri_-100))) -# define CYGBLD_ATTRIB_C_INIT_AFTER( _pri_ ) __attribute__((constructor (_pri_+100))) -#endif - -// Start with initializing everything inside the cpu and the main memory. -#define CYG_INIT_HAL 10000 -#define CYG_INIT_SCHEDULER 11000 -#define CYG_INIT_IDLE_THREAD 11100 -#define CYG_INIT_INTERRUPTS 12000 -#define CYG_INIT_CLOCK 14000 -#define CYG_INIT_THREADS 16000 -#define CYG_INIT_KERNEL 19000 -#define CYG_INIT_MEMALLOC 20000 -// Now move on to I/O subsystems and device drivers. These can make use of -// kernel and HAL functionality, and can dynamically allocate memory if -// absolutely needed. For now they can also assume that diag_printf() -// functionality is available, but that may change in future. -// -// Primary buses are ones very closely tied to the processor, e.g. PCI. -#define CYG_INIT_BUS_PRIMARY 30000 -// Not yet: on some targets cyg_pci_init() has to be called very early -// on for HAL diagnostics to work. -// #define CYG_INIT_BUS_PCI CYG_INIT_BUS_PRIMARY -// -// Secondary buses may hang off primary buses, e.g. USB host. -#define CYG_INIT_BUS_SECONDARY 31000 -// Tertiary buses are everything else. -#define CYG_INIT_BUS_TERTIARY 32000 -#define CYG_INIT_BUS_I2C CYG_INIT_BUS_TERTIARY -#define CYG_INIT_BUS_SPI CYG_INIT_BUS_TERTIARY -// -// In future HAL diag initialization may happen at this point. -// -// Watchdogs and wallclocks often hang off a tertiary bus but -// have no dependencies -#define CYG_INIT_DEV_WATCHDOG 35000 -#define CYG_INIT_DEV_WALLCLOCK 36000 -// A primary block configuration can be initialized with no need -// for per-unit configuration information. -#define CYG_INIT_DEV_BLOCK_PRIMARY 37000 -#define CYG_INIT_DEV_FLASH CYG_INIT_DEV_BLOCK_PRIMARY -// Per-unit configuration data extracted from primary storage. -// NOTE: for future use, not implemented yet. -#define CYG_INIT_CONFIG 38000 -// Secondary block devices may use per-unit configuration data -// for e.g. interpreting partition layout. Few devices are expected -// to fall into this category. Note that these devices, as well as -// some char devices, may not actually be usable until interrupts -// are enabled. -#define CYG_INIT_DEV_BLOCK_SECONDARY 40000 -// Char devices are everything else: serial, ethernet, CAN, ... -#define CYG_INIT_DEV_CHAR 41000 -// For backwards compatibility. Subject to change in future so -// a CYG_INIT_DEV_ priority should be used instead. -#define CYG_INIT_DRIVERS 48000 -// CYG_INIT_IO and CYG_INIT_IO_FS are poorly defined at present, -// and may get reorganized in future. -#define CYG_INIT_IO 49000 -#define CYG_INIT_IO_FS 50000 -// The I/O subsystems and device drivers have been initialized. -#define CYG_INIT_LIBC 56000 -#define CYG_INIT_COMPAT 58000 -#define CYG_INIT_APPLICATION 60000 -#define CYG_INIT_PREDEFAULT 65534 -#define CYG_INIT_DEFAULT 65535 - -// ------------------------------------------------------------------------- -// Label name macros. Some toolsets generate labels with initial -// underscores and others don't. CYG_LABEL_NAME should be used on -// labels in C/C++ code that are defined in assembly code or linker -// scripts. CYG_LABEL_DEFN is for use in assembly code and linker -// scripts where we need to manufacture labels that can be used from -// C/C++. -// These are default implementations that should work for most targets. -// They may be overridden in basetype.h if necessary. - -#ifndef CYG_LABEL_NAME - -#define CYG_LABEL_NAME(_name_) _name_ - -#endif - -#ifndef CYG_LABEL_DEFN - -#define CYG_LABEL_DEFN(_label) _label - -#endif - -// ------------------------------------------------------------------------- -// COMPILER-SPECIFIC STUFF - -#ifdef __GNUC__ -// Force a 'C' routine to be called like a 'C++' contructor -# if !defined(CYGBLD_ATTRIB_CONSTRUCTOR) -# define CYGBLD_ATTRIB_CONSTRUCTOR __attribute__((constructor)) -# endif - -// Define a compiler-specific rune for saying a function doesn't return -# if !defined(CYGBLD_ATTRIB_NORET) -# define CYGBLD_ATTRIB_NORET __attribute__((noreturn)) -# endif - -// How to define weak symbols - this is only relevant for ELF and a.out, -// but that won't be a problem for eCos -# if !defined(CYGBLD_ATTRIB_WEAK) -# define CYGBLD_ATTRIB_WEAK __attribute__ ((weak)) -# endif - -// How to define alias to symbols. Just pass in the symbol itself, not -// the string name of the symbol -# if !defined(CYGBLD_ATTRIB_ALIAS) -# define CYGBLD_ATTRIB_ALIAS(__symbol__) \ - __attribute__ ((alias (#__symbol__))) -# endif - -// This effectively does the reverse of the previous macro. It defines -// a name that the attributed variable or function will actually have -// in assembler. -# if !defined(CYGBLD_ATTRIB_ASM_ALIAS) -# define __Str(x) #x -# define __Xstr(x) __Str(x) -# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) \ - __asm__ ( __Xstr( CYG_LABEL_DEFN( __symbol__ ) ) ) -# endif - -// Shows that a function returns the same value when given the same args, but -// note this can't be used if there are pointer args -# if !defined(CYGBLD_ATTRIB_CONST) -# define CYGBLD_ATTRIB_CONST __attribute__((const)) -#endif - -// Assign a defined variable to a specific section -# if !defined(CYGBLD_ATTRIB_SECTION) -# define CYGBLD_ATTRIB_SECTION(__sect__) __attribute__((section (__sect__))) -# endif - -// Give a type or object explicit minimum alignment -# if !defined(CYGBLD_ATTRIB_ALIGN) -# define CYGBLD_ATTRIB_ALIGN(__align__) __attribute__((aligned(__align__))) -# endif - -# if !defined(CYGBLD_ATTRIB_ALIGN_MAX) -# define CYGBLD_ATTRIB_ALIGN_MAX __attribute__((aligned)) -# endif - -# if !defined(CYGBLD_ATTRIB_ALIGNOFTYPE) -# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) \ - __attribute__((aligned(__alignof__( _type_ )))) -# endif - -// Teach compiler how to check format of printf-like functions -# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) \ - __attribute__((format (printf, __format__, __args__))) - -// Teach compiler how to check format of scanf-like functions -# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__) \ - __attribute__((format (scanf, __format__, __args__))) - -// Teach compiler how to check format of strftime-like functions -# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) \ - __attribute__((format (strftime, __format__, __args__))) - -// Tell the compiler not to throw away a variable or function. Only known -// available on 3.3.2 or above. Old version's didn't throw them away, -// but using the unused attribute should stop warnings. -# if !defined(CYGBLD_ATTRIB_USED) -# if __GNUC_VERSION__ >= 30302 -# define CYGBLD_ATTRIB_USED __attribute__((used)) -# else -# define CYGBLD_ATTRIB_USED __attribute__((unused)) -# endif -# endif -#else // non-GNU - -# define CYGBLD_ATTRIB_CONSTRUCTOR - -# define CYGBLD_ATTRIB_NORET - // This intentionally gives an error only if we actually try to - // use it. #error would give an error if we simply can't. -// FIXME: Had to disarm the bomb - the CYGBLD_ATTRIB_WEAK macro is now -// (indirectly) used in host tools. -# define CYGBLD_ATTRIB_WEAK /* !!!-- Attribute weak not defined --!!! */ - -# define CYGBLD_ATTRIB_ALIAS(__x__) !!!-- Attribute alias not defined --!!! - -# define CYGBLD_ATTRIB_ASM_ALIAS(__symbol__) !!!-- Asm alias not defined --!!! - -# define CYGBLD_ATTRIB_CONST - -# define CYGBLD_ATTRIB_ALIGN(__align__) !!!-- Alignment alias not defined --!!! - -# define CYGBLD_ATTRIB_ALIGN_MAX !!!-- Alignment alias not defined --!!! - -# define CYGBLD_ATTRIB_ALIGNOFTYPE( _type_ ) !!!-- Alignment alias not defined --!!! - -# define CYGBLD_ATTRIB_PRINTF_FORMAT(__format__, __args__) - -# define CYGBLD_ATTRIB_SCANF_FORMAT(__format__, __args__) - -# define CYGBLD_ATTRIB_STRFTIME_FORMAT(__format__, __args__) - - -#endif - -// How to define weak aliases. Currently this is simply a mixture of the -// above - -# define CYGBLD_ATTRIB_WEAK_ALIAS(__symbol__) \ - CYGBLD_ATTRIB_WEAK CYGBLD_ATTRIB_ALIAS(__symbol__) - -#ifdef __cplusplus -# define __THROW throw() -#else -# define __THROW -#endif - -// ------------------------------------------------------------------------- -// Variable annotations -// These annotations may be added to various static variables in the -// HAL and kernel to indicate which component they belong to. These -// are used by some targets to optimize memory placement of these -// variables. - -#ifndef CYGBLD_ANNOTATE_VARIABLE_HAL -#define CYGBLD_ANNOTATE_VARIABLE_HAL -#endif -#ifndef CYGBLD_ANNOTATE_VARIABLE_SCHED -#define CYGBLD_ANNOTATE_VARIABLE_SCHED -#endif -#ifndef CYGBLD_ANNOTATE_VARIABLE_CLOCK -#define CYGBLD_ANNOTATE_VARIABLE_CLOCK -#endif -#ifndef CYGBLD_ANNOTATE_VARIABLE_INTR -#define CYGBLD_ANNOTATE_VARIABLE_INTR -#endif - -// ------------------------------------------------------------------------- -// Various "flavours" of memory regions that can be described by the -// Memory Layout Tool (MLT). - -#define CYGMEM_REGION_ATTR_R 0x01 // Region can be read -#define CYGMEM_REGION_ATTR_W 0x02 // Region can be written - -#if defined (__GNUC__) -#elif defined (MSVC) -#define __inline__ __inline -#define inline __inline -#else -#endif -// ------------------------------------------------------------------------- -#endif // CYGONCE_INFRA_CYG_TYPE_H multiple inclusion protection -// EOF cyg_type.h diff --git a/components/dfs/filesystems/jffs2/dfs_jffs2.c b/components/dfs/filesystems/jffs2/dfs_jffs2.c deleted file mode 100644 index c082c21d7..000000000 --- a/components/dfs/filesystems/jffs2/dfs_jffs2.c +++ /dev/null @@ -1,687 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2012-1-7 prife the first version - */ - -#include -#include - -#include "cyg/infra/cyg_type.h" -#include "cyg/fileio/fileio.h" -#include "port/codes.h" -#include "port/fcntl.h" -#undef mode_t - -#include -#include - -#include "dfs_jffs2.h" -#include "jffs2_config.h" -#include "porting.h" -#include - -#if DEVICE_PART_MAX > 1 - #error "support only one jffs2 partition on a flash device!" -#endif - -/* make sure the following struct var had been initilased to 0! */ -struct device_part -{ - struct cyg_mtab_entry * mte; - struct rt_mtd_nor_device *dev; -}; -static struct device_part device_partition[DEVICE_PART_MAX] = {0}; -static struct rt_mutex jffs2_lock; - -#define jffs2_mount jffs2_fste.mount -#define jffs2_umount jffs2_fste.umount -#define jffs2_open jffs2_fste.open -#define jffs2_file_unlink jffs2_fste.unlink -#define jffs2_mkdir jffs2_fste.mkdir -#define jffs2_rmdir jffs2_fste.rmdir -#define jffs2_rename jffs2_fste.rename -#define jffs2_link jffs2_fste.link -#define jffs2_opendir jffs2_fste.opendir -#define jffs2_chdir jffs2_fste.chdir -#define jffs2_ops_stat jffs2_fste.stat -#define jffs2_getinfo jffs2_fste.getinfo -#define jffs2_setinfo jffs2_fste.setinfo - -#define jffs2_file_read jffs2_fileops.fo_read -#define jffs2_file_write jffs2_fileops.fo_write -#define jffs2_file_lseek jffs2_fileops.fo_lseek -#define jffs2_file_ioctl jffs2_fileops.fo_ioctl -#define jffs2_file_select jffs2_fileops.fo_select -#define jffs2_file_fsync jffs2_fileops.fo_fsync -#define jffs2_file_colse jffs2_fileops.fo_close -#define jffs2_file_fstat jffs2_fileops.fo_fstat -#define jffs2_file_getinfo jffs2_fileops.fo_getinfo -#define jffs2_file_setinfo jffs2_fileops.fo_setinfo - -#define jffs2_dir_read jffs2_dirops.fo_read -//#define jffs2_dir_write jffs2_dirops.fo_write -#define jffs2_dir_lseek jffs2_dirops.fo_lseek -//#define jffs2_dir_ioctl jffs2_dirops.fo_ioctl -#define jffs2_dir_select jffs2_dirops.fo_select -//#define jffs2_dir_fsync jffs2_dirops.fo_fsync -#define jffs2_dir_colse jffs2_dirops.fo_close -//#define jffs2_dir_fstat jffs2_dirops.fo_fstat -//#define jffs2_dir_getinfo jffs2_dirops.fo_getinfo -//#define jffs2_dir_setinfo jffs2_dirops.fo_setinfo - -/* - * RT-Thread Device Interface for jffs2 - */ - -/* these code is in src/flashio.c */ -static int jffs2_result_to_dfs(int result) -{ - if (result < 0) return result; - if (result > 0) return -result; - - return 0; -} - -/* - * RT-Thread DFS Interface for jffs2 - */ -static int dfs_jffs2_mount(struct dfs_filesystem* fs, - unsigned long rwflag, - const void* data) -{ - unsigned index; - struct cyg_mtab_entry * mte; - int result; - - /* find a empty entry in partition table */ - for (index = 0; index < DEVICE_PART_MAX; index ++) - { - if (device_partition[index].dev == RT_NULL) - break; - } - if (index == DEVICE_PART_MAX) - return -ENOSPC; - - mte = rt_malloc(sizeof(struct cyg_mtab_entry)); - if (mte == RT_NULL) - return -ENOMEM; - - mte->name = fs->path; - mte->fsname = "jffs2"; - mte->devname = NULL; - /* note that, i use mte->data to store rtt's device - * while, in jffs2_mount, mte->data will be copy into - * s_dev in struct super_block, and mte->data will be - * filled with jffs2_sb(see the source of jffs2_mount. - */ - mte->data = (CYG_ADDRWORD)fs->dev_id; - - device_partition[index].dev = RT_MTD_NOR_DEVICE(fs->dev_id); - /* after jffs2_mount, mte->data will not be dev_id any more */ - result = jffs2_mount(NULL, mte); - if (result != 0) - { - device_partition[index].dev = NULL; - return jffs2_result_to_dfs(result); - } - - /* save this pointer */ - device_partition[index].mte = mte; - return 0; -} - -static int _find_fs(struct cyg_mtab_entry ** mte, rt_device_t dev_id) -{ - unsigned index; - - /* find device index */ - for (index = 0; index < DEVICE_PART_MAX; index++) - { - if (device_partition[index].dev == RT_MTD_NOR_DEVICE(dev_id)) - { - *mte = device_partition[index].mte; - return 0; - } - } - - rt_kprintf("error, could not found the fs!"); - return -1; -} - -static int dfs_jffs2_unmount(struct dfs_filesystem* fs) -{ - int result; - unsigned index; - - /* find device index, then umount it */ - for (index = 0; index < DEVICE_PART_MAX; index++) - { - if (device_partition[index].dev == RT_MTD_NOR_DEVICE(fs->dev_id)) - { - result = jffs2_umount(device_partition[index].mte); - if (result) return jffs2_result_to_dfs(result); - - rt_free(device_partition[index].mte); - device_partition[index].dev = NULL; - device_partition[index].mte = NULL; - return RT_EOK; - } - } - - return -ENOENT; -} - -static int dfs_jffs2_mkfs(rt_device_t dev_id) -{ - /* just erase all blocks on this nand partition */ - return -ENOSYS; -} - -static int dfs_jffs2_statfs(struct dfs_filesystem* fs, - struct statfs *buf) -{ - /* since the limit of unsigned long, so the max size of flash device is 4G */ - struct cyg_mtab_entry * mte; - struct jffs2_fs_info info; - int result; - - result = _find_fs(&mte, fs->dev_id); - if (result) - return -ENOENT; - - RT_ASSERT(mte->data != 0); - - jffs2_get_info_from_sb((void *)mte->data, &info); - buf->f_bsize = info.sector_size; - buf->f_blocks = info.nr_blocks; - buf->f_bfree = info.free_size / info.sector_size; - - return 0; -} - -static const char jffs2_root_path[] = "."; - -static int dfs_jffs2_open(struct dfs_fd* file) -{ - int result; - int oflag, mode; - const char * name; - cyg_file * jffs2_file; - struct dfs_filesystem *fs; - struct cyg_mtab_entry * mte; - - oflag = file->flags; - fs = (struct dfs_filesystem *)file->data; - RT_ASSERT(fs != RT_NULL); - - jffs2_file = rt_malloc(sizeof(cyg_file)); - if (jffs2_file == RT_NULL) - return -ENOMEM; - - /* just escape '/' provided by dfs code */ - name = file->path; - if ((name[0] == '/') && (name[1] == 0)) - name = jffs2_root_path; - else /* name[0] still will be '/' */ - name ++; - - result = _find_fs(&mte, fs->dev_id); - if (result) - { - rt_free(jffs2_file); - return -ENOENT; - } - - /* set mount table */ - jffs2_file->f_mte = mte; - - if (oflag & O_DIRECTORY) /* operations about dir */ - { - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - if (oflag & O_CREAT) /* create a dir*/ - { - /* fixme, should test file->path can end with '/' */ - result = jffs2_mkdir(mte, mte->root, name); - if (result) - { - rt_mutex_release(&jffs2_lock); - rt_free(jffs2_file); - return jffs2_result_to_dfs(result); - } - } - - /* open dir */ - result = jffs2_opendir(mte, mte->root, name, jffs2_file); - rt_mutex_release(&jffs2_lock); - if (result) - { - rt_free(jffs2_file); - return jffs2_result_to_dfs(result); - } -#ifdef CONFIG_JFFS2_NO_RELATIVEDIR - jffs2_file->f_offset = 2; -#endif - /* save this pointer, it will be used by dfs_jffs2_getdents*/ - file->data = jffs2_file; - return 0; - } - /* regular file operations */ - mode = JFFS2_O_RDONLY; - if (oflag & O_WRONLY) mode |= JFFS2_O_WRONLY; - if (oflag & O_RDWR) mode |= JFFS2_O_RDWR; - /* Opens the file, if it is existing. If not, a new file is created. */ - if (oflag & O_CREAT) mode |= JFFS2_O_CREAT; - /* Creates a new file. If the file is existing, it is truncated and overwritten. */ - if (oflag & O_TRUNC) mode |= JFFS2_O_TRUNC; - /* Creates a new file. The function fails if the file is already existing. */ - if (oflag & O_EXCL) mode |= JFFS2_O_EXCL; - - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_open(mte, 0, name, mode, jffs2_file); - if (result != 0) - { - rt_mutex_release(&jffs2_lock); - rt_free(jffs2_file); - return jffs2_result_to_dfs(result); - } - - /* save this pointer, it will be used when calling read(), write(), - flush(), lessk(), and will be rt_free when calling close()*/ - file->data = jffs2_file; - file->pos = jffs2_file->f_offset; - file->size = 0; - jffs2_file_lseek(jffs2_file, (off_t *)(&(file->size)), SEEK_END); - jffs2_file->f_offset = (off_t)file->pos; - rt_mutex_release(&jffs2_lock); - - if (oflag & O_APPEND) - { - file->pos = file->size; - jffs2_file->f_offset = file->size; - } - - return 0; -} - -static int dfs_jffs2_close(struct dfs_fd* file) -{ - int result; - cyg_file * jffs2_file; - - RT_ASSERT(file->data != NULL); - jffs2_file = (cyg_file *)(file->data); - - if (file->flags & O_DIRECTORY) /* operations about dir */ - { - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_dir_colse(jffs2_file); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - - rt_free(jffs2_file); - return 0; - } - /* regular file operations */ - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_file_colse(jffs2_file); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - - /* release memory */ - rt_free(jffs2_file); - return 0; -} - -static int dfs_jffs2_ioctl(struct dfs_fd* file, int cmd, void* args) -{ - return -ENOSYS; -} - -static int dfs_jffs2_read(struct dfs_fd* file, void* buf, size_t len) -{ - cyg_file * jffs2_file; - struct CYG_UIO_TAG uio_s; - struct CYG_IOVEC_TAG iovec; - int char_read; - int result; - - RT_ASSERT(file->data != NULL); - jffs2_file = (cyg_file *)(file->data); - uio_s.uio_iov = &iovec; - uio_s.uio_iov->iov_base = buf; - uio_s.uio_iov->iov_len = len; - uio_s.uio_iovcnt = 1; //must be 1 - //uio_s.uio_offset //not used... - uio_s.uio_resid = uio_s.uio_iov->iov_len; //seem no use in jffs2; - - char_read = jffs2_file->f_offset; /* the current offset */ - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_file_read(jffs2_file, &uio_s); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - - /* update position */ - file->pos = jffs2_file->f_offset; - char_read = jffs2_file->f_offset - char_read; - return char_read; -} - -static int dfs_jffs2_write(struct dfs_fd* file, - const void* buf, - size_t len) -{ - cyg_file * jffs2_file; - struct CYG_UIO_TAG uio_s; - struct CYG_IOVEC_TAG iovec; - int char_write; - int result; - - RT_ASSERT(file->data != NULL); - jffs2_file = (cyg_file *)(file->data); - uio_s.uio_iov = &iovec; - uio_s.uio_iov->iov_base = (void *)buf; - uio_s.uio_iov->iov_len = len; - uio_s.uio_iovcnt = 1; //must be 1 - //uio_s.uio_offset //not used... - uio_s.uio_resid = uio_s.uio_iov->iov_len; //seem no use in jffs2; - - char_write = jffs2_file->f_offset; - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_file_write(jffs2_file, &uio_s); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - - /* update position */ - file->pos = jffs2_file->f_offset; - char_write = jffs2_file->f_offset - char_write; - return char_write; -} - -static int dfs_jffs2_flush(struct dfs_fd* file) -{ - /* infact, jffs2 not support, jffs2_fo_sync just return ok */ - return -ENOSYS; -} - -/* fixme warning: the offset is rt_off_t, so maybe the size of a file is must <= 2G*/ -static int dfs_jffs2_lseek(struct dfs_fd* file, - rt_off_t offset) -{ - cyg_file * jffs2_file; - int result; - - RT_ASSERT(file->data != NULL); - jffs2_file = (cyg_file *)(file->data); - - /* set offset as current offset */ - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_file_lseek(jffs2_file, &offset, SEEK_SET); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - /* update file position */ - file->pos = offset; - return offset; -} - -/* return the size of struct dirent*/ -static int dfs_jffs2_getdents(struct dfs_fd* file, - struct dirent* dirp, - rt_uint32_t count) -{ - cyg_file * jffs2_file; - struct CYG_UIO_TAG uio_s; - struct CYG_IOVEC_TAG iovec; - struct jffs2_dirent jffs2_d; - struct dirent * d; - rt_uint32_t index; -#if !defined (CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE) - struct jffs2_stat s; - cyg_mtab_entry * mte; - char * fullname; -#endif - int result; - - RT_ASSERT(file->data != RT_NULL); - jffs2_file = (cyg_file*)(file->data); - mte = jffs2_file->f_mte; - - //set jffs2_d - memset(&jffs2_d, 0, sizeof(struct jffs2_dirent)); - //set CYG_UIO_TAG uio_s - uio_s.uio_iov = &iovec; - uio_s.uio_iov->iov_base = &jffs2_d; - uio_s.uio_iov->iov_len = sizeof(struct jffs2_dirent);; - uio_s.uio_iovcnt = 1; //must be 1 - uio_s.uio_offset = 0;//not used... - uio_s.uio_resid = uio_s.uio_iov->iov_len; //seem no use in jffs2; - - /* make integer count, usually count is 1 */ - count = (count / sizeof(struct dirent)) * sizeof(struct dirent); - if (count == 0) return -EINVAL; - - index = 0; - /* usually, the while loop should only be looped only once! */ - while (1) - { - d = dirp + index; - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_dir_read(jffs2_file, &uio_s); - rt_mutex_release(&jffs2_lock); - /* if met a error or all entry are read over, break while*/ - if (result || jffs2_d.d_name[0] == 0) - break; - -#if defined (CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE) - switch(jffs2_d.d_type & JFFS2_S_IFMT) - { - case JFFS2_S_IFREG: d->d_type = DT_REG; break; - case JFFS2_S_IFDIR: d->d_type = DT_DIR; break; - default: d->d_type = DT_UNKNOWN; break; - } -#else - fullname = rt_malloc(FILE_PATH_MAX); - if(fullname == RT_NULL) - return -ENOMEM; - - /* make a right entry */ - if ((file->path[0] == '/') ) - { - if (file->path[1] == 0) - strcpy(fullname, jffs2_d.d_name); - else - rt_sprintf(fullname, "%s/%s", file->path+1, jffs2_d.d_name); - } - else - rt_sprintf(fullname, "%s/%s", file->path, jffs2_d.d_name); - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_porting_stat(mte, mte->root, fullname, (void *)&s); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - - rt_free(fullname); - /* convert to dfs stat structure */ - switch(s.st_mode & JFFS2_S_IFMT) - { - case JFFS2_S_IFREG: d->d_type = DT_REG; break; - case JFFS2_S_IFDIR: d->d_type = DT_DIR; break; - default: d->d_type = DT_UNKNOWN; break; - } -#endif - /* write the rest fields of struct dirent* dirp */ - d->d_namlen = rt_strlen(jffs2_d.d_name); - d->d_reclen = (rt_uint16_t)sizeof(struct dirent); - rt_strncpy(d->d_name, jffs2_d.d_name, d->d_namlen + 1); - - index ++; - if (index * sizeof(struct dirent) >= count) - break; - } - if (result) - return jffs2_result_to_dfs(result); - return index * sizeof(struct dirent); -} - -static int dfs_jffs2_unlink(struct dfs_filesystem* fs, const char* path) -{ - int result; - struct jffs2_stat s; - cyg_mtab_entry * mte; - - result = _find_fs(&mte, fs->dev_id); - if (result) - return -ENOENT; - - /* deal path */ - if (path[0] == '/') - path++; - - /* judge file type, dir is to be delete by rmdir, others by unlink */ - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_porting_stat(mte, mte->root, path, (void *)&s); - if (result) - { - rt_mutex_release(&jffs2_lock); - return jffs2_result_to_dfs(result); - } - - switch(s.st_mode & JFFS2_S_IFMT) - { - case JFFS2_S_IFREG: - result = jffs2_file_unlink(mte, mte->root, path); - break; - case JFFS2_S_IFDIR: - result = jffs2_rmdir(mte, mte->root, path); - break; - default: - /* unknown file type */ - rt_mutex_release(&jffs2_lock); - return -1; - } - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - return 0; -} - -static int dfs_jffs2_rename(struct dfs_filesystem* fs, - const char* oldpath, - const char* newpath) -{ - int result; - cyg_mtab_entry * mte; - - result = _find_fs(&mte, fs->dev_id); - if (result) - return -ENOENT; - - if (*oldpath == '/') - oldpath += 1; - if (*newpath == '/') - newpath += 1; - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_rename(mte, mte->root, oldpath, mte->root, newpath); - rt_mutex_release(&jffs2_lock); - if (result) - return jffs2_result_to_dfs(result); - return 0; -} - -static int dfs_jffs2_stat(struct dfs_filesystem* fs, const char *path, struct stat *st) -{ - int result; - struct jffs2_stat s; - cyg_mtab_entry * mte; - - /* deal the path for jffs2 */ - RT_ASSERT(!((path[0] == '/') && (path[1] == 0))); - - if (path[0] == '/') - path++; - - result = _find_fs(&mte, fs->dev_id); - if (result) - return -ENOENT; - - rt_mutex_take(&jffs2_lock, RT_WAITING_FOREVER); - result = jffs2_porting_stat(mte, mte->root, path, (void *)&s); - rt_mutex_release(&jffs2_lock); - - if (result) - return jffs2_result_to_dfs(result); - /* convert to dfs stat structure */ - switch(s.st_mode & JFFS2_S_IFMT) - { - case JFFS2_S_IFREG: - st->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | - S_IWUSR | S_IWGRP | S_IWOTH; - break; - - case JFFS2_S_IFDIR: - st->st_mode = S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; - break; - - default: - st->st_mode = DT_UNKNOWN; //fixme - break; - } - - st->st_dev = 0; - st->st_size = s.st_size; - st->st_mtime = s.st_mtime; - - return 0; -} - -static const struct dfs_file_ops _jffs2_fops = -{ - dfs_jffs2_open, - dfs_jffs2_close, - dfs_jffs2_ioctl, - dfs_jffs2_read, - dfs_jffs2_write, - dfs_jffs2_flush, - dfs_jffs2_lseek, - dfs_jffs2_getdents, -}; - -static const struct dfs_filesystem_ops _jffs2_ops = -{ - "jffs2", - DFS_FS_FLAG_DEFAULT, - &_jffs2_fops, - - dfs_jffs2_mount, - dfs_jffs2_unmount, - dfs_jffs2_mkfs, - dfs_jffs2_statfs, - - dfs_jffs2_unlink, - dfs_jffs2_stat, - dfs_jffs2_rename, -}; - -int dfs_jffs2_init(void) -{ - /* register fatfs file system */ - dfs_register(&_jffs2_ops); - - /* initialize mutex */ - if (rt_mutex_init(&jffs2_lock, "jffs2lock", RT_IPC_FLAG_FIFO) != RT_EOK) - { - rt_kprintf("init jffs2 lock mutex failed\n"); - } - rt_kprintf("init jffs2 lock mutex okay\n"); - return 0; -} -INIT_COMPONENT_EXPORT(dfs_jffs2_init); diff --git a/components/dfs/filesystems/jffs2/dfs_jffs2.h b/components/dfs/filesystems/jffs2/dfs_jffs2.h deleted file mode 100644 index 1be403a19..000000000 --- a/components/dfs/filesystems/jffs2/dfs_jffs2.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef __DFS_JFFS2_H__ -#define __DFS_JFFS2_H__ - -int dfs_jffs2_init(void); - -#endif diff --git a/components/dfs/filesystems/jffs2/include/linux/jffs2.h b/components/dfs/filesystems/jffs2/include/linux/jffs2.h deleted file mode 100644 index ab034effe..000000000 --- a/components/dfs/filesystems/jffs2/include/linux/jffs2.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in the - * jffs2 directory. - * - * $Id: jffs2.h,v 1.36 2005/07/26 13:19:36 havasi Exp $ - * - */ - -#ifndef __LINUX_JFFS2_H__ -#define __LINUX_JFFS2_H__ - -/* You must include something which defines the C99 uintXX_t types. - We don't do it from here because this file is used in too many - different environments. */ - -#define JFFS2_SUPER_MAGIC 0x72b6 - -/* Values we may expect to find in the 'magic' field */ -#define JFFS2_OLD_MAGIC_BITMASK 0x1984 -#define JFFS2_MAGIC_BITMASK 0x1985 -#define KSAMTIB_CIGAM_2SFFJ 0x8519 /* For detecting wrong-endian fs */ -#define JFFS2_EMPTY_BITMASK 0xffff -#define JFFS2_DIRTY_BITMASK 0x0000 - -/* We only allow a single char for length, and 0xFF is empty flash so - we don't want it confused with a real length. Hence max 254. -*/ -#define JFFS2_MAX_NAME_LEN 254 - -/* How small can we sensibly write nodes? */ -#define JFFS2_MIN_DATA_LEN 128 - -#define JFFS2_COMPR_NONE 0x00 -#define JFFS2_COMPR_ZERO 0x01 -#define JFFS2_COMPR_RTIME 0x02 -#define JFFS2_COMPR_RUBINMIPS 0x03 -#define JFFS2_COMPR_COPY 0x04 -#define JFFS2_COMPR_DYNRUBIN 0x05 -#define JFFS2_COMPR_ZLIB 0x06 -/* Compatibility flags. */ -#define JFFS2_COMPAT_MASK 0xc000 /* What do to if an unknown nodetype is found */ -#define JFFS2_NODE_ACCURATE 0x2000 -/* INCOMPAT: Fail to mount the filesystem */ -#define JFFS2_FEATURE_INCOMPAT 0xc000 -/* ROCOMPAT: Mount read-only */ -#define JFFS2_FEATURE_ROCOMPAT 0x8000 -/* RWCOMPAT_COPY: Mount read/write, and copy the node when it's GC'd */ -#define JFFS2_FEATURE_RWCOMPAT_COPY 0x4000 -/* RWCOMPAT_DELETE: Mount read/write, and delete the node when it's GC'd */ -#define JFFS2_FEATURE_RWCOMPAT_DELETE 0x0000 - -#define JFFS2_NODETYPE_DIRENT (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 1) -#define JFFS2_NODETYPE_INODE (JFFS2_FEATURE_INCOMPAT | JFFS2_NODE_ACCURATE | 2) -#define JFFS2_NODETYPE_CLEANMARKER (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) -#define JFFS2_NODETYPE_PADDING (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 4) - -// Maybe later... -//#define JFFS2_NODETYPE_CHECKPOINT (JFFS2_FEATURE_RWCOMPAT_DELETE | JFFS2_NODE_ACCURATE | 3) -//#define JFFS2_NODETYPE_OPTIONS (JFFS2_FEATURE_RWCOMPAT_COPY | JFFS2_NODE_ACCURATE | 4) - - -#define JFFS2_INO_FLAG_PREREAD 1 /* Do read_inode() for this one at - mount time, don't wait for it to - happen later */ -#define JFFS2_INO_FLAG_USERCOMPR 2 /* User has requested a specific - compression type */ - - -/* These can go once we've made sure we've caught all uses without - byteswapping */ -#include - -#if defined(__GNUC__) || (__CC_ARM) -typedef struct { - uint32_t v32; -} __attribute__((packed)) jint32_t; - -typedef struct { - uint32_t m; -} __attribute__((packed)) jmode_t; - -typedef struct { - uint16_t v16; -} __attribute__((packed)) jint16_t; - -struct jffs2_unknown_node -{ - /* All start like this */ - jint16_t magic; - jint16_t nodetype; - jint32_t totlen; /* So we can skip over nodes we don't grok */ - jint32_t hdr_crc; -} __attribute__((packed)); - -struct jffs2_raw_dirent -{ - jint16_t magic; - jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ - jint32_t totlen; - jint32_t hdr_crc; - jint32_t pino; - jint32_t version; - jint32_t ino; /* == zero for unlink */ - jint32_t mctime; - uint8_t nsize; - uint8_t type; - uint8_t unused[2]; - jint32_t node_crc; - jint32_t name_crc; - uint8_t name[0]; -} __attribute__((packed)); - -/* The JFFS2 raw inode structure: Used for storage on physical media. */ -/* The uid, gid, atime, mtime and ctime members could be longer, but - are left like this for space efficiency. If and when people decide - they really need them extended, it's simple enough to add support for - a new type of raw node. -*/ -struct jffs2_raw_inode -{ - jint16_t magic; /* A constant magic number. */ - jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ - jint32_t totlen; /* Total length of this node (inc data, etc.) */ - jint32_t hdr_crc; - jint32_t ino; /* Inode number. */ - jint32_t version; /* Version number. */ - jmode_t mode; /* The file's type or mode. */ - jint16_t uid; /* The file's owner. */ - jint16_t gid; /* The file's group. */ - jint32_t isize; /* Total resultant size of this inode (used for truncations) */ - jint32_t atime; /* Last access time. */ - jint32_t mtime; /* Last modification time. */ - jint32_t ctime; /* Change time. */ - jint32_t offset; /* Where to begin to write. */ - jint32_t csize; /* (Compressed) data size */ - jint32_t dsize; /* Size of the node's data. (after decompression) */ - uint8_t compr; /* Compression algorithm used */ - uint8_t usercompr; /* Compression algorithm requested by the user */ - jint16_t flags; /* See JFFS2_INO_FLAG_* */ - jint32_t data_crc; /* CRC for the (compressed) data. */ - jint32_t node_crc; /* CRC for the raw inode (excluding data) */ - uint8_t data[0]; -} __attribute__((packed)); - -#elif defined (MSVC) -typedef uint32_t jint32_t; -//typedef uint32_t jmode_t; -typedef struct { - uint32_t m; -} jmode_t; -typedef uint16_t jint16_t; - -#pragma pack(1) -struct jffs2_unknown_node -{ - /* All start like this */ - jint16_t magic; - jint16_t nodetype; - jint32_t totlen; /* So we can skip over nodes we don't grok */ - jint32_t hdr_crc; -}; - -struct jffs2_raw_dirent -{ - jint16_t magic; - jint16_t nodetype; /* == JFFS2_NODETYPE_DIRENT */ - jint32_t totlen; - jint32_t hdr_crc; - jint32_t pino; - jint32_t version; - jint32_t ino; /* == zero for unlink */ - jint32_t mctime; - uint8_t nsize; - uint8_t type; - uint8_t unused[2]; - jint32_t node_crc; - jint32_t name_crc; - uint8_t name[0]; -}; - -/* The JFFS2 raw inode structure: Used for storage on physical media. */ -/* The uid, gid, atime, mtime and ctime members could be longer, but - are left like this for space efficiency. If and when people decide - they really need them extended, it's simple enough to add support for - a new type of raw node. -*/ -struct jffs2_raw_inode -{ - jint16_t magic; /* A constant magic number. */ - jint16_t nodetype; /* == JFFS2_NODETYPE_INODE */ - jint32_t totlen; /* Total length of this node (inc data, etc.) */ - jint32_t hdr_crc; - jint32_t ino; /* Inode number. */ - jint32_t version; /* Version number. */ - jmode_t mode; /* The file's type or mode. */ - jint16_t uid; /* The file's owner. */ - jint16_t gid; /* The file's group. */ - jint32_t isize; /* Total resultant size of this inode (used for truncations) */ - jint32_t atime; /* Last access time. */ - jint32_t mtime; /* Last modification time. */ - jint32_t ctime; /* Change time. */ - jint32_t offset; /* Where to begin to write. */ - jint32_t csize; /* (Compressed) data size */ - jint32_t dsize; /* Size of the node's data. (after decompression) */ - uint8_t compr; /* Compression algorithm used */ - uint8_t usercompr; /* Compression algorithm requested by the user */ - jint16_t flags; /* See JFFS2_INO_FLAG_* */ - jint32_t data_crc; /* CRC for the (compressed) data. */ - jint32_t node_crc; /* CRC for the raw inode (excluding data) */ - uint8_t data[0]; -}; -#pragma pack() -#else -#endif - - -union jffs2_node_union { - struct jffs2_raw_inode i; - struct jffs2_raw_dirent d; - struct jffs2_unknown_node u; -}; - -#endif /* __LINUX_JFFS2_H__ */ diff --git a/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_i.h b/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_i.h deleted file mode 100644 index 7f3028265..000000000 --- a/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_i.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $Id: jffs2_fs_i.h,v 1.18 2005/07/17 11:13:48 dedekind Exp $ */ - -#ifndef _JFFS2_FS_I -#define _JFFS2_FS_I - -#include -#include -#include - -struct jffs2_inode_info { - /* We need an internal semaphore similar to inode->i_sem. - Unfortunately, we can't used the existing one, because - either the GC would deadlock, or we'd have to release it - before letting GC proceed. Or we'd have to put ugliness - into the GC code so it didn't attempt to obtain the i_sem - for the inode(s) which are already locked */ - struct semaphore sem; - - /* The highest (datanode) version number used for this ino */ - uint32_t highest_version; - - /* List of data fragments which make up the file */ - struct rb_root fragtree; - - /* There may be one datanode which isn't referenced by any of the - above fragments, if it contains a metadata update but no actual - data - or if this is a directory inode */ - /* This also holds the _only_ dnode for symlinks/device nodes, - etc. */ - struct jffs2_full_dnode *metadata; - - /* Directory entries */ - struct jffs2_full_dirent *dents; - - /* The target path if this is the inode of a symlink */ - unsigned char *target; - - /* Some stuff we just have to keep in-core at all times, for each inode. */ - struct jffs2_inode_cache *inocache; - - uint16_t flags; - uint8_t usercompr; -#if !defined (__ECOS) && !defined(RT_THREAD) -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,2) - struct inode vfs_inode; -#endif -#endif -}; - -#endif /* _JFFS2_FS_I */ diff --git a/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_sb.h b/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_sb.h deleted file mode 100644 index 066e9400b..000000000 --- a/components/dfs/filesystems/jffs2/include/linux/jffs2_fs_sb.h +++ /dev/null @@ -1,120 +0,0 @@ -/* $Id: jffs2_fs_sb.h,v 1.52 2005/05/19 16:12:17 gleixner Exp $ */ - -#ifndef _JFFS2_FS_SB -#define _JFFS2_FS_SB - -#include "jffs2_config.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define JFFS2_SB_FLAG_RO 1 -#define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */ -#define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */ - -struct jffs2_inodirty; - -/* A struct for the overall file system control. Pointers to - jffs2_sb_info structs are named `c' in the source code. - Nee jffs_control -*/ -struct jffs2_sb_info { - struct mtd_info *mtd; - - uint32_t highest_ino; - uint32_t checked_ino; - - unsigned int flags; - - struct task_struct *gc_task; /* GC task struct */ - struct completion gc_thread_start; /* GC thread start completion */ - struct completion gc_thread_exit; /* GC thread exit completion port */ - - struct semaphore alloc_sem; /* Used to protect all the following - fields, and also to protect against - out-of-order writing of nodes. And GC. */ - uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER - (i.e. zero for OOB CLEANMARKER */ - - uint32_t flash_size; - uint32_t used_size; - uint32_t dirty_size; - uint32_t wasted_size; - uint32_t free_size; - uint32_t erasing_size; - uint32_t bad_size; - uint32_t sector_size; - uint32_t unchecked_size; - - uint32_t nr_free_blocks; - uint32_t nr_erasing_blocks; - - /* Number of free blocks there must be before we... */ - uint8_t resv_blocks_write; /* ... allow a normal filesystem write */ - uint8_t resv_blocks_deletion; /* ... allow a normal filesystem deletion */ - uint8_t resv_blocks_gctrigger; /* ... wake up the GC thread */ - uint8_t resv_blocks_gcbad; /* ... pick a block from the bad_list to GC */ - uint8_t resv_blocks_gcmerge; /* ... merge pages when garbage collecting */ - - uint32_t nospc_dirty_size; - - uint32_t nr_blocks; - struct jffs2_eraseblock *blocks; /* The whole array of blocks. Used for getting blocks - * from the offset (blocks[ofs / sector_size]) */ - struct jffs2_eraseblock *nextblock; /* The block we're currently filling */ - - struct jffs2_eraseblock *gcblock; /* The block we're currently garbage-collecting */ - - struct list_head clean_list; /* Blocks 100% full of clean data */ - struct list_head very_dirty_list; /* Blocks with lots of dirty space */ - struct list_head dirty_list; /* Blocks with some dirty space */ - struct list_head erasable_list; /* Blocks which are completely dirty, and need erasing */ - struct list_head erasable_pending_wbuf_list; /* Blocks which need erasing but only after the current wbuf is flushed */ - struct list_head erasing_list; /* Blocks which are currently erasing */ - struct list_head erase_pending_list; /* Blocks which need erasing now */ - struct list_head erase_complete_list; /* Blocks which are erased and need the clean marker written to them */ - struct list_head free_list; /* Blocks which are free and ready to be used */ - struct list_head bad_list; /* Bad blocks. */ - struct list_head bad_used_list; /* Bad blocks with valid data in. */ - - spinlock_t erase_completion_lock; /* Protect free_list and erasing_list - against erase completion handler */ - wait_queue_head_t erase_wait; /* For waiting for erases to complete */ - - wait_queue_head_t inocache_wq; - struct jffs2_inode_cache **inocache_list; - spinlock_t inocache_lock; - - /* Sem to allow jffs2_garbage_collect_deletion_dirent to - drop the erase_completion_lock while it's holding a pointer - to an obsoleted node. I don't like this. Alternatives welcomed. */ - struct semaphore erase_free_sem; - -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - /* Write-behind buffer for NAND flash */ - unsigned char *wbuf; - uint32_t wbuf_ofs; - uint32_t wbuf_len; - uint32_t wbuf_pagesize; - struct jffs2_inodirty *wbuf_inodes; - - struct rw_semaphore wbuf_sem; /* Protects the write buffer */ - - /* Information about out-of-band area usage... */ - struct nand_oobinfo *oobinfo; - uint32_t badblock_pos; - uint32_t fsdata_pos; - uint32_t fsdata_len; -#endif - - /* OS-private pointer for getting back to master superblock info */ - void *os_priv; -}; - -#endif /* _JFFS2_FB_SB */ diff --git a/components/dfs/filesystems/jffs2/include/port/codes.h b/components/dfs/filesystems/jffs2/include/port/codes.h deleted file mode 100644 index 2426465c8..000000000 --- a/components/dfs/filesystems/jffs2/include/port/codes.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef CYGONCE_ERROR_CODES_H -#define CYGONCE_ERROR_CODES_H -/*=========================================================================== -// -// codes.h -// -// Common error code definitions -// -//=========================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//=========================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jlarmour -// Contributors: jlarmour -// Date: 2000-04-14 -// Purpose: To provide a common set of error codes -// Description: This provides a common set of error codes that all -// packages can agree on. It doesn't preclude them defining -// their own error return system, but this is a preferable -// system to use to help error support be as general as -// possible. -// -// We try and conform to the ANSI/POSIX error code format, -// namely starting with the character 'E' -// -// Usage: #include -// -// Example: -// -// err=myfun(); -// if (err != ENOERR) -// { -// str=strerror(err); -// printf("myfun returned error: %s\n", str); -// } -// else .... -// -//####DESCRIPTIONEND#### -// -//=========================================================================*/ - -/* CONFIGURATION */ - -//#include prife // Configuration header - -#ifdef __cplusplus -extern "C" { -#endif - -/* TYPE DEFINITIONS */ - -/* A type for error codes which may be useful to explain the purpose of - * a variable or return code. It shows that it contains an error code - * of the type defined below */ - -typedef int Cyg_ErrNo; - -#include - -#define ENOERR RT_EOK - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* CYGONCE_ERROR_CODES_H multiple inclusion protection */ - -/* EOF codes.h */ diff --git a/components/dfs/filesystems/jffs2/include/port/fcntl.h b/components/dfs/filesystems/jffs2/include/port/fcntl.h deleted file mode 100644 index fcc3088fc..000000000 --- a/components/dfs/filesystems/jffs2/include/port/fcntl.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef CYGONCE_ISO_FCNTL_H -#define CYGONCE_ISO_FCNTL_H - -/*------------------------------------------------------------------------*/ -/* for dfs_jffs2.c */ -/*------------------------------------------------------------------------*/ -/* File access modes used for open() and fnctl() */ -#define JFFS2_O_RDONLY (O_RDONLY) /* Open for reading only */ -#define JFFS2_O_WRONLY (O_WRONLY) /* Open for writing only */ -#define JFFS2_O_RDWR (O_RDONLY|O_WRONLY) /* Open for reading and writing */ - -/* File access mode mask */ -#define JFFS2_O_ACCMODE (O_RDONLY|O_RDWR|O_WRONLY) - -/* open() mode flags */ - -#define JFFS2_O_CREAT (O_CREAT) /* Create file it it does not exist */ -#define JFFS2_O_EXCL (O_EXCL) /* Exclusive use */ -#define JFFS2_O_NOCTTY (O_NOCTTY) /* Do not assign a controlling terminal */ -#define JFFS2_O_TRUNC (O_TRUNC) /* Truncate */ - -/* File status flags used for open() and fcntl() */ -#define JFFS2_O_APPEND (O_APPEND) /* Set append mode */ -#define JFFS2_O_DSYNC (O_DSYNC) /* Synchronized I/O data integrity writes */ -#define JFFS2_O_NONBLOCK (O_NONBLOCK)/* No delay */ -#define JFFS2_O_RSYNC (O_RSYNC) /* Synchronized read I/O */ -#define JFFS2_O_SYNC (O_SYNC) /* Synchronized I/O file integrity writes */ - -#endif - -/* EOF fcntl.h */ diff --git a/components/dfs/filesystems/jffs2/include/port/sys/stat.h b/components/dfs/filesystems/jffs2/include/port/sys/stat.h deleted file mode 100644 index 43958a752..000000000 --- a/components/dfs/filesystems/jffs2/include/port/sys/stat.h +++ /dev/null @@ -1,294 +0,0 @@ -#ifndef CYGONCE_ISO_SYS_TYPES_H -#define CYGONCE_ISO_SYS_TYPES_H -/*======================================================================== -// -// sys/types.h -// -// POSIX types -// -//======================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//======================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jlarmour -// Contributors: -// Date: 2000-04-14 -// Purpose: This file provides various types required by POSIX 1003.1. -// Description: The real contents of this file get set from the -// configuration (set by the implementation) -// Usage: #include -// -//####DESCRIPTIONEND#### -// -//====================================================================== -*/ - -/* CONFIGURATION */ - -//#include -//#include /* Configuration header */ - -/* INCLUDES */ - -/* This is the "standard" way to get size_t from stddef.h, - * which is the canonical location of the definition. - */ -//#define __need_size_t -//#include -#include "port/codes.h" - -/* -#ifndef dev_t -typedef short dev_t; -#endif - -#ifndef ino_t -typedef unsigned int ino_t; -#endif - -#ifndef mode_t -typedef unsigned int mode_t; -#endif -*/ - -typedef unsigned short nlink_t; -typedef long off_t; - -typedef unsigned short gid_t; -typedef unsigned short uid_t; -typedef int pid_t; - -// -typedef void *cyg_io_handle_t; - -/* Variable names for pathconf() */ -#define _PC_ASYNC_IO 1 -#define _PC_CHOWN_RESTRICTED 2 -#define _PC_LINK_MAX 3 -#define _PC_MAX_CANON 4 -#define _PC_MAX_INPUT 5 -#define _PC_NAME_MAX 6 -#define _PC_NO_TRUNC 7 -#define _PC_PATH_MAX 8 -#define _PC_PIPE_BUF 9 -#define _PC_PRIO_IO 10 -#define _PC_SYNC_IO 11 -#define _PC_VDISABLE 12 - -//limit.h -/* DEFINES */ - -/*----------------------------------------------------------------------------- - * Minimum values from POSIX.1 tables 2-3, 2-7 and 2-7a. - - * These are the standard-mandated minimum values. - * These values do not vary with the implementation - they may - * simply be defined - */ - -/* Minimum number of operations in one list I/O call. */ -#define _POSIX_AIO_LISTIO_MAX 2 - -/* Minimal number of outstanding asynchronous I/O operations. */ -#define _POSIX_AIO_MAX 1 - -/* Maximum length of arguments to `execve', including environment. */ -#define _POSIX_ARG_MAX 4096 - -/* Maximum simultaneous processes per real user ID. */ -#define _POSIX_CHILD_MAX 6 - -/* Minimal number of timer expiration overruns. */ -#define _POSIX_DELAYTIMER_MAX 32 - -/* Maximum link count of a file. */ -#define _POSIX_LINK_MAX 8 - -/* Size of storage required for a login name */ -#define _POSIX_LOGIN_NAME_MAX 9 - -/* Number of bytes in a terminal canonical input queue. */ -#define _POSIX_MAX_CANON 255 - -/* Number of bytes for which space will be - available in a terminal input queue. */ -#define _POSIX_MAX_INPUT 255 - -/* Maximum number of message queues open for a process. */ -#define _POSIX_MQ_OPEN_MAX 8 - -/* Maximum number of supported message priorities. */ -#define _POSIX_MQ_PRIO_MAX 32 - -/* Number of bytes in a filename. */ -#define _POSIX_NAME_MAX 14 - -/* Number of simultaneous supplementary group IDs per process. */ -#define _POSIX_NGROUPS_MAX 0 - -/* Number of files one process can have open at once. */ -#define _POSIX_OPEN_MAX 16 - -/* Number of bytes in a pathname. */ -#define _POSIX_PATH_MAX 255 - -/* Number of bytes than can be written atomically to a pipe. */ -#define _POSIX_PIPE_BUF 512 - -/* Minimal number of realtime signals reserved for the application. */ -#define _POSIX_RTSIG_MAX 8 - -/* Number of semaphores a process can have. */ -#define _POSIX_SEM_NSEMS_MAX 256 - -/* Maximal value of a semaphore. */ -#define _POSIX_SEM_VALUE_MAX 32767 - -/* Number of pending realtime signals. */ -#define _POSIX_SIGQUEUE_MAX 32 - -/* Largest value of a `ssize_t'. */ -#define _POSIX_SSIZE_MAX 32767 - -/* Number of streams a process can have open at once. */ -#define _POSIX_STREAM_MAX 8 - -/* Controlling the iterations of destructors for thread-specific data. */ -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 - -/* The number of data keys per process. */ -#define _POSIX_THREAD_KEYS_MAX 128 - -/* The number of threads per process. */ -#define _POSIX_THREAD_THREADS_MAX 64 - -/* Maximum number of characters in a tty name. */ -#define _POSIX_TTY_NAME_MAX 9 - -/* Number of timer for a process. */ -#define _POSIX_TIMER_MAX 32 - -/* Maximum length of a timezone name (element of `tzname'). */ -#define _POSIX_TZNAME_MAX 3 - -/* Maximum clock resolution in nanoseconds. */ -#define _POSIX_CLOCKRES_MIN 20000000 - - -#ifdef CYGBLD_ISO_SSIZET_HEADER -# include CYGBLD_ISO_SSIZET_HEADER -#else -# ifndef __STRICT_ANSI__ -# define SSIZE_MAX LONG_MAX -# endif -#endif - -/* INCLUDES */ - -#ifdef CYGBLD_ISO_OPEN_MAX_HEADER -# include CYGBLD_ISO_OPEN_MAX_HEADER -#else -# ifndef __STRICT_ANSI__ -# define OPEN_MAX _POSIX_OPEN_MAX -# endif -#endif - -#ifdef CYGBLD_ISO_LINK_MAX_HEADER -# include CYGBLD_ISO_LINK_MAX_HEADER -#else -# ifndef __STRICT_ANSI__ -# define LINK_MAX _POSIX_LINK_MAX -# endif -#endif - -#ifdef CYGBLD_ISO_NAME_MAX_HEADER -# include CYGBLD_ISO_NAME_MAX_HEADER -#else -# ifndef __STRICT_ANSI__ -# define NAME_MAX _POSIX_NAME_MAX -# endif -#endif - -#ifdef CYGBLD_ISO_PATH_MAX_HEADER -# include CYGBLD_ISO_PATH_MAX_HEADER -#else -# ifndef __STRICT_ANSI__ -# define PATH_MAX _POSIX_PATH_MAX -# endif -#endif - -#if CYGINT_ISO_POSIX_LIMITS -# ifdef CYGBLD_ISO_POSIX_LIMITS_HEADER -# include CYGBLD_ISO_POSIX_LIMITS_HEADER -# endif -#endif - - -#define CYGNUM_FILEIO_MTAB_MAX 16 - -//----------------------------------------------- -// stat.h need by fs-ecos.h -//----------------------------------------------- -#define __stat_mode_DIR (1<<0) -#define __stat_mode_CHR (1<<1) -#define __stat_mode_BLK (1<<2) -#define __stat_mode_REG (1<<3) -#define __stat_mode_FIFO (1<<4) -#define __stat_mode_MQ (1<<5) -#define __stat_mode_SEM (1<<6) -#define __stat_mode_SHM (1<<7) -#define __stat_mode_LNK (1<<8) -#define __stat_mode_SOCK (1<<9) - -#if defined(MSVC) -/* for time_t */ -#include -typedef unsigned long mode_t; -typedef unsigned int ino_t; -typedef unsigned int dev_t; -typedef long ssize_t; -#elif defined(__CC_ARM) -#define mode_t unsigned long -typedef unsigned int ino_t; -typedef unsigned int dev_t; -typedef long ssize_t; -typedef long time_t; -#elif defined(__GNUC__) && !defined(__CC_ARM) -#include -#endif - -#endif /* CYGONCE_ISO_SYS_TYPES_H multiple inclusion protection */ - -/* EOF sys/types.h */ - diff --git a/components/dfs/filesystems/jffs2/include/port/sys/types.h b/components/dfs/filesystems/jffs2/include/port/sys/types.h deleted file mode 100644 index ab195a57e..000000000 --- a/components/dfs/filesystems/jffs2/include/port/sys/types.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef CYGONCE_ISO_SYS_TYPES_H -#define CYGONCE_ISO_SYS_TYPES_H -/*======================================================================== -// -// sys/types.h -// -// POSIX types -// -//======================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//======================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): jlarmour -// Contributors: -// Date: 2000-04-14 -// Purpose: This file provides various types required by POSIX 1003.1. -// Description: The real contents of this file get set from the -// configuration (set by the implementation) -// Usage: #include -// -//####DESCRIPTIONEND#### -// -//====================================================================== -*/ - -/* CONFIGURATION */ - -//#include -//#include /* Configuration header */ - -/* INCLUDES */ - -/* This is the "standard" way to get size_t from stddef.h, - * which is the canonical location of the definition. - */ -//#define __need_size_t -//#include - -typedef long ssize_t; - -typedef short dev_t; -typedef unsigned int ino_t; -typedef unsigned short nlink_t; -typedef long off_t; - -typedef unsigned short gid_t; -typedef unsigned short uid_t; -typedef int pid_t; - -#if defined(MSVC) -#include -#else -typedef int time_t; -#endif -//#include "os_sys_stat.h" -#endif /* CYGONCE_ISO_SYS_TYPES_H multiple inclusion protection */ - -/* EOF sys/types.h */ - diff --git a/components/dfs/filesystems/jffs2/jffs2_config.h b/components/dfs/filesystems/jffs2/jffs2_config.h deleted file mode 100644 index 3340f1ff1..000000000 --- a/components/dfs/filesystems/jffs2/jffs2_config.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef JFFS2_CONFIG_H -#define JFFS2_CONFIG_H - -#define __ECOS /* must be defined */ - -#define FILE_PATH_MAX 128 /* the longest file path */ -#define CONFIG_JFFS2_ENTRY_NAME_MAX 23 -#define JFFS2_NAME_MAX CONFIG_JFFS2_ENTRY_NAME_MAX -#define JFFS2_PATH_MAX FILE_PATH_MAX - -#define DEVICE_PART_MAX 1 /* the max partions on a nand deivce*/ - -/* memory page size in kernel/asm/page.h, it is correspond with flash read/write - * option, so this size has a great impact on reading/writing speed */ -#define CONFIG_JFFS2_PAGE_SHIFT 12 /* (1<<12) 4096bytes*/ - -/* jffs2 support relative dir, command "ls" will get - * +-------------------------------+ - * | finsh>>ls("/") | - * | Directory /: | - * | . | - * | .. | - * | dir1 | - * +-------------------------------+ - */ -#define CONFIG_JFFS2_NO_RELATIVEDIR - -//#define CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE -#if defined(CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE) - #define CYGPKG_FILEIO_DIRENT_DTYPE -#endif - -#define CYGOPT_FS_JFFS2_WRITE /* if not defined, jffs2 is read only*/ - -/* jffs2 debug output opion */ -#define CONFIG_JFFS2_FS_DEBUG 0 /* 1 or 2 */ - -/* jffs2 gc thread section */ -//#define CYGOPT_FS_JFFS2_GCTHREAD -#define CYGNUM_JFFS2_GC_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX-2) /* GC thread's priority */ -#define CYGNUM_JFFS2_GS_THREAD_TICKS 20 /* event timeout ticks */ -#define CYGNUM_JFFS2_GC_THREAD_TICKS 20 /* GC thread's running ticks */ - -//#define CONFIG_JFFS2_FS_WRITEBUFFER /* should not be enabled */ - -/* zlib section*/ -//#define CONFIG_JFFS2_ZLIB -//#define CONFIG_JFFS2_RTIME -//#define CONFIG_JFFS2_RUBIN -//#define CONFIG_JFFS2_CMODE_NONE -//#define CONFIG_JFFS2_CMODE_SIZE - -#endif diff --git a/components/dfs/filesystems/jffs2/kernel/asm/atomic.h b/components/dfs/filesystems/jffs2/kernel/asm/atomic.h deleted file mode 100644 index 5cb72ff8c..000000000 --- a/components/dfs/filesystems/jffs2/kernel/asm/atomic.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __ASM_ATOMIC_H__ -#define __ASM_ATOMIC_H__ - -#define atomic_t int -#define atomic_inc(atom) (*atom)++ -#define atomic_dec(atom) (*atom)-- -#define atomic_read(atom) (*atom) - - -#endif /* __ASM_ATOMIC_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/asm/bug.h b/components/dfs/filesystems/jffs2/kernel/asm/bug.h deleted file mode 100644 index 054dedc3d..000000000 --- a/components/dfs/filesystems/jffs2/kernel/asm/bug.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_BUG_H__ -#define __ASM_BUG_H__ - -#define BUG() do { printf("BUG() at %s %d\n", __FILE__, __LINE__); *(int *)0=0; } while (0) - -#endif /* __ASM_BUG_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/asm/page.h b/components/dfs/filesystems/jffs2/kernel/asm/page.h deleted file mode 100644 index af3081164..000000000 --- a/components/dfs/filesystems/jffs2/kernel/asm/page.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __ASM_PAGE_H__ -#define __ASM_PAGE_H__ - -//#include //mod by prife -#include "jffs2_config.h" -#define PAGE_SHIFT CONFIG_JFFS2_PAGE_SHIFT -/* These aren't used by much yet. If that changes, you might want - to make them actually correct :) */ -#define PAGE_SIZE (0x1 << PAGE_SHIFT) - - -#endif /* __ASM_PAGE_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/asm/semaphore.h b/components/dfs/filesystems/jffs2/kernel/asm/semaphore.h deleted file mode 100644 index 94a4f3abd..000000000 --- a/components/dfs/filesystems/jffs2/kernel/asm/semaphore.h +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef __ASM_SEMAPHORE_H__ -#define __ASM_SEMAPHORE_H__ - -#define CONFIG_JFFS2_SEMAPHORE 0 // no mutex, 1 use static, 2 use dynamic -#if CONFIG_JFFS2_SEMAPHORE == 0 -//#include - -struct semaphore { - int x; -}; - -#define DECLARE_MUTEX(x) -#define DECLARE_MUTEX_LOCKED(x) - -#define init_MUTEX(sem) -#define init_MUTEX_LOCKED(sem) -#define down(sem) -#define down_interruptible(sem) 0 -#define down_trylock(sem) -#define up(sem) - -#elif CONFIG_JFFS2_SEMAPHORE == 1 -#include - -struct semaphore { - struct rt_mutex mutex; -}; - -#define DECLARE_MUTEX(x) -#define DECLARE_MUTEX_LOCKED(x) -rt_inline void init_MUTEX(struct semaphore * sem) -{ - if (rt_mutex_init((rt_mutex_t)sem, "mutex", RT_IPC_FLAG_FIFO) == RT_EOK) - { - /* detach the object from system object container */ - rt_object_detach(&(((rt_mutex_t)sem)->parent.parent)); - return; - } - rt_kprintf("get an error at %s:%d \n", __FUNCTION__, __LINE__); - RT_ASSERT(0); -} - -rt_inline void init_MUTEX_LOCKED(struct semaphore * sem) -{ - rt_enter_critical(); - if (rt_mutex_init((rt_mutex_t)sem, "mutex", RT_IPC_FLAG_FIFO) == RT_EOK) - { - /* detach the object from system object container */ - rt_object_detach(&(((rt_mutex_t)sem)->parent.parent)); - rt_exit_critical(); - rt_mutex_take((rt_mutex_t)sem, RT_WAITING_FOREVER); - return; - } - rt_exit_critical(); - - rt_kprintf("get an error at %s:%d \n", __FUNCTION__, __LINE__); - RT_ASSERT(0); -} - -rt_inline down(struct semaphore * sem) -{ - rt_mutex_take((rt_mutex_t)sem, RT_WAITING_FOREVER); -} -rt_inline int down_interruptible(struct semaphore* sem) -{ - rt_mutex_take((rt_mutex_t)sem, RT_WAITING_FOREVER); - return 0; -} -rt_inline up(struct semaphore * sem) -{ - rt_mutex_release((rt_mutex_t)sem); -} -#elif CONFIG_JFFS2_SEMAPHORE == 2 - -#include - -struct semaphore { - rt_mutex_t mutex; -}; - -#define DECLARE_MUTEX(x) -#define DECLARE_MUTEX_LOCKED(x) - -rt_inline void init_MUTEX(struct semaphore * sem) -{ - sem->mutex = rt_mutex_create("mutex", RT_IPC_FLAG_FIFO); -} -rt_inline init_MUTEX_LOCKED(struct semaphore * sem) -{ - sem->mutex = rt_mutex_create("mutex", RT_IPC_FLAG_FIFO); - rt_mutex_take(sem->mutex, RT_WAITING_FOREVER); -} -rt_inline down(struct semaphore * sem) -{ - rt_mutex_take(sem->mutex, RT_WAITING_FOREVER); -} -rt_inline int down_interruptible(struct semaphore* sem) -{ - rt_mutex_take(sem->mutex, RT_WAITING_FOREVER); - return 0; -} -/* -Attempt to lock the mutex pointed to by the mutex argument without waiting. -If the mutex is already locked by some other thread then this function -returns FALSE. If the function can lock the mutex without waiting, then -TRUE is returned. -void cyg_drv_mutex_unlock( cyg_drv_mutex *mutex ) -*/ - -//#define down_trylock(struct semaphore * sem) rt_mutex_take((rt_mutex_t)sem, RT_WAITING_NO) -rt_inline up(struct semaphore * sem) -{ - rt_mutex_release(sem->mutex); -} - -#else -#error "CONFIG_JFFS2_SEMAPHORE should be 0, 1 or 2" -#endif - -#endif /* __ASM_SEMAPHORE_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/TODO b/components/dfs/filesystems/jffs2/kernel/linux/TODO deleted file mode 100644 index df8a6d1a5..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/TODO +++ /dev/null @@ -1,11 +0,0 @@ - -This contains a very limited set of Linux-compatibility headers, initially -just for getting JFFS2 to build. - -Some things are simply stubs which don't _work_, to allow the JFFS2 code -to compile. Note that you may need to implement these _properly_ in order -to use these for making other Linux code work, or indeed for making the -JFFS2 NAND support work. - -The non-working parts include, but are not limited to: - workqueue.h, wait.h, timer.h, spinlock.h, sched.h, compiler.h diff --git a/components/dfs/filesystems/jffs2/kernel/linux/compiler.h b/components/dfs/filesystems/jffs2/kernel/linux/compiler.h deleted file mode 100644 index fb253651a..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/compiler.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __LINUX_COMPILER_H__ -#define __LINUX_COMPILER_H__ - -#define likely(x) (x) -#define unlikely(x) (x) - -#endif /* __LINUX_COMPILER_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/completion.h b/components/dfs/filesystems/jffs2/kernel/linux/completion.h deleted file mode 100644 index d2493b271..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/completion.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __LINUX_COMPLETION_H__ -#define __LINUX_COMPLETION_H__ - -#if defined (__GNUC__) -struct completion { } ; -#elif defined (MSVC) -struct completion {int no; } ; -#else -#error "please use a right C compiler" -#endif - -#endif /* __LINUX_COMPLETION_H__ */ - diff --git a/components/dfs/filesystems/jffs2/kernel/linux/config.h b/components/dfs/filesystems/jffs2/kernel/linux/config.h deleted file mode 100644 index 355e175f6..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/config.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __LINUX_CONFIG_H__ -#define __LINUX_CONFIG_H__ - -#define GFP_KERNEL 0 - -/* #define CONFIG_JFFS2_FS_WRITEBUFFER 0 */ -/* #define CONFIG_JFFS2_PROC */ -/* #define CONFIG_JFFS2_RTIME */ -/* #define CONFIG_JFFS2_RUBIN */ -/* #define CONFIG_JFFS2_ZLIB */ - -#endif /* __LINUX_CONFIG_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/crc32.h b/components/dfs/filesystems/jffs2/kernel/linux/crc32.h deleted file mode 100644 index 8d19a1eb6..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/crc32.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CRC32_H -#define CRC32_H - -#include - -#define crc32(val, s, len) cyg_crc32_accumulate(val, (unsigned char *)s, len) - -#endif diff --git a/components/dfs/filesystems/jffs2/kernel/linux/errno.h b/components/dfs/filesystems/jffs2/kernel/linux/errno.h deleted file mode 100644 index 293863241..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/errno.h +++ /dev/null @@ -1,2 +0,0 @@ -//#include -#include "port/codes.h" //fixme diff --git a/components/dfs/filesystems/jffs2/kernel/linux/fs.h b/components/dfs/filesystems/jffs2/kernel/linux/fs.h deleted file mode 100644 index 94f493c91..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/fs.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LINUX_FS_H__ -#define __LINUX_FS_H__ - -#include - -#endif /* __LINUX_FS_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/init.h b/components/dfs/filesystems/jffs2/kernel/linux/init.h deleted file mode 100644 index e4c702f99..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/init.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef __LINUX_INIT_H__ -#define __LINUX_INIT_H__ -#endif diff --git a/components/dfs/filesystems/jffs2/kernel/linux/kernel.h b/components/dfs/filesystems/jffs2/kernel/linux/kernel.h deleted file mode 100644 index a0c94a199..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/kernel.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef __LINUX_KERNEL_H__ -#define __LINUX_KERNEL_H__ -//#include -//#include //mod by prife @ 2011/11/20 -#include "jffs2_config.h" - -#define jiffies 100 - -#define ERR_PTR(err) ((void*)(err)) -#define PTR_ERR(err) ((unsigned long)(err)) -#define IS_ERR(err) ((unsigned long)err > (unsigned long)-1000L) - -#define CURRENT_TIME jffs2_get_timestamp() - -#define KERN_EMERG "<0>" // system is unusable -#define KERN_ALERT "<1>" // action must be taken immediately -#define KERN_CRIT "<2>" // critical conditions -#define KERN_ERR "<3>" // error conditions -#define KERN_WARNING "<4>" // warning conditions -#define KERN_NOTICE "<5>" // normal but significant condition -#define KERN_INFO "<6>" // informational -#define KERN_DEBUG "<7>" // debug-level messages -#define printk rt_kprintf//diag_printf //mod by prife - -#ifndef min //mod by prife -#define min(x,y) (x - * - *=========================================================================== - * ####ECOSGPLCOPYRIGHTBEGIN#### - * ------------------------------------------- - * This file is part of eCos, the Embedded Configurable Operating System. - * Copyright (C) 2002, 2003 Free Software Foundation, Inc. - * - * eCos is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 or (at your option) any later - * version. - * - * eCos is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - * - * You should have received a copy of the GNU General Public License - * along with eCos; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * As a special exception, if other files instantiate templates or use - * macros or inline functions from this file, or you compile this file - * and link it with other works to produce a work based on this file, - * this file does not by itself cause the resulting work to be covered by - * the GNU General Public License. However the source code for this file - * must still be made available in accordance with section (3) of the GNU - * General Public License v2. - * - * This exception does not invalidate any other reasons why a work based - * on this file might be covered by the GNU General Public License. - * ------------------------------------------- - * ####ECOSGPLCOPYRIGHTEND#### - *=========================================================================== - * - */ - -#ifndef CYGONCE_FS_JFFS2_LIST_H -#define CYGONCE_FS_JFFS2_LIST_H - - -/* -----------------------------------------------------------------------*/ - -/* Doubly linked list implementation to replace the GPL'd one used in - the Linux kernel. */ - -#include -#include - -/* TYPES */ - -struct list_head { - struct list_head *next; - struct list_head *prev; -}; - -/* MACROS */ - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD( _list_ ) \ -CYG_MACRO_START \ -(_list_)->next = (_list_)->prev = (_list_); \ -CYG_MACRO_END - -/* FUNCTIONS */ - -/* Insert an entry _after_ the specified entry */ -static __inline__ void -list_add( struct list_head *newent, struct list_head *afterthisent ) -{ - struct list_head *next = afterthisent->next; - newent->next = next; - newent->prev = afterthisent; - afterthisent->next = newent; - next->prev = newent; -} /* list_add() */ - -/* Insert an entry _before_ the specified entry */ -static __inline__ void -list_add_tail( struct list_head *newent, struct list_head *beforethisent ) -{ - struct list_head *prev = beforethisent->prev; - newent->prev = prev; - newent->next = beforethisent; - beforethisent->prev = newent; - prev->next = newent; -} /* list_add_tail() */ - -/* Delete the specified entry */ -static __inline__ void -list_del( struct list_head *ent ) -{ - ent->prev->next = ent->next; - ent->next->prev = ent->prev; -} /* list_del() */ - -/* Is this list empty? */ -static __inline__ int -list_empty( struct list_head *list ) -{ - return ( list->next == list ); -} /* list_empty() */ - -/* list_entry - Assuming you have a struct of type _type_ that contains a - list which has the name _member_ in that struct type, then given the - address of that list in the struct, _list_, this returns the address - of the container structure */ - -#define list_entry( _list_, _type_, _member_ ) \ - ((_type_ *)((char *)(_list_)-(char *)(offsetof(_type_,_member_)))) - -/* list_for_each - using _ent_, iterate through list _list_ */ - -#define list_for_each( _ent_, _list_ ) \ - for ( (_ent_) = (_list_)->next; \ - (_ent_) != (_list_); \ - (_ent_) = (_ent_)->next ) - -/* - * list_for_each_entry - this function can be use to iterate over all - * items in a list* _list_ with it's head at _head_ and link _item_ - */ -#if defined (__GNUC__) -#define list_for_each_entry(_list_, _head_, _item_) \ -for ((_list_) = list_entry((_head_)->next, typeof(*_list_), _item_); \ - &((_list_)->_item_) != (_head_); \ - (_list_) = list_entry((_list_)->_item_.next, typeof(*_list_), _item_)) - -#elif defined (MSVC) -#define list_for_each_entry(_list_, _head_, _item_) \ -for ((_list_) = list_entry((_head_)->next, struct jffs2_compressor, _item_); \ - &((_list_)->_item_) != (_head_); \ - (_list_) = list_entry((_list_)->_item_.next, struct jffs2_compressor, _item_)) -#else -#endif -/* -----------------------------------------------------------------------*/ -#endif /* #ifndef CYGONCE_FS_JFFS2_LIST_H */ -/* EOF list.h */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/mtd/compatmac.h b/components/dfs/filesystems/jffs2/kernel/linux/mtd/compatmac.h deleted file mode 100644 index cee374925..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/mtd/compatmac.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __LINUX_MTD_COMPATMAC_H__ -#define __LINUX_MTD_COMPATMAC_H__ - - -#endif /* __LINUX_MTD_COMPATMAC_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/mtd/mtd.h b/components/dfs/filesystems/jffs2/kernel/linux/mtd/mtd.h deleted file mode 100644 index 817d31cf6..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/mtd/mtd.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef __LINUX_MTD_MTD_H__ -#define __LINUX_MTD_MTD_H__ - - -#endif /* __LINUX_MTD_MTD_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/pagemap.h b/components/dfs/filesystems/jffs2/kernel/linux/pagemap.h deleted file mode 100644 index fccf9c406..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/pagemap.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __LINUX_PAGEMAP_H__ -#define __LINUX_PAGEMAP_H__ - -#include -#include - -#define PAGE_CACHE_SHIFT PAGE_SHIFT -#define PAGE_CACHE_SIZE PAGE_SIZE - -#define PageLocked(pg) 1 -#define Page_Uptodate(pg) 0 -#define UnlockPage(pg) -#define PAGE_BUG(pg) BUG() -#define ClearPageUptodate(pg) -#define SetPageError(pg) -#define ClearPageError(pg) -#define SetPageUptodate(pg) - -#endif /* __LINUX_PAGEMAP_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/rbtree.h b/components/dfs/filesystems/jffs2/kernel/linux/rbtree.h deleted file mode 100644 index ffda277e8..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/rbtree.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _LINUX_RBTREE_H -#define _LINUX_RBTREE_H - -#if defined (__GNUC__) -#elif defined (MSVC) -#define __inline__ __inline -#define inline __inline -#else -#endif - -struct rb_node { - struct rb_node *rb_left; /* left element */ - struct rb_node *rb_right; /* right element */ - struct rb_node *rb_parent; /* parent element */ - int rb_color; /* node color */ -}; - -struct rb_root { - struct rb_node *rb_node; /* root of the tree */ -}; - -#ifndef NULL -#define NULL ((void *)0) -#endif - -#if defined (__GNUC__) -#define RB_ROOT ((struct rb_root){NULL}) -#elif defined (MSVC) -#define RB_ROOT {NULL}//{struct rb_root _x = {NULL};} -#else -#endif - -#define rb_entry(p, container, field) \ - ((container *) ((char *)p - ((char *)&(((container *)0)->field)))) - -#define RB_BLACK 0 -#define RB_RED 1 - - -extern void rb_insert_color(struct rb_node *, struct rb_root *); -extern void rb_erase(struct rb_node *, struct rb_root *); - -/* Find logical next and previous nodes in a tree */ -extern struct rb_node *rb_next(struct rb_node *); -extern struct rb_node *rb_prev(struct rb_node *); -extern struct rb_node *rb_first(struct rb_root *); - -/* Fast replacement of a single node without remove/rebalance/add/rebalance */ -extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, - struct rb_root *root); - -static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, - struct rb_node ** rb_link) -{ - node->rb_parent = parent; - node->rb_color = RB_RED; - node->rb_left = node->rb_right = NULL; - - *rb_link = node; -} - -#endif /* _LINUX_RBTREE_H */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/rwsem.h b/components/dfs/filesystems/jffs2/kernel/linux/rwsem.h deleted file mode 100644 index d648a150c..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/rwsem.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __LINUX_RWSEM_H__ -#define __LINUX_RWSEM_H__ - -// eCos does not have the concept of a read/write semaphore. So just -// map them onto normal semaphores and hope we don't deadlock -// somewhere. - -#include - -struct rw_semaphore; - -#define down_read(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem) -#define down_read_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem) -#define down_write(sem) cyg_drv_mutex_lock((cyg_drv_mutex_t *)sem) -#define down_write_trylock(sem) cyg_drv_mutex_trylock((cyg_drv_mutex_t *)sem) -#define up_read(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem) -#define up_write(sem) cyg_drv_mutex_unlock((cyg_drv_mutex_t *)sem) -#define downgrade_write(sem) - -#endif // __LINUX_RWSEM_H__ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/sched.h b/components/dfs/filesystems/jffs2/kernel/linux/sched.h deleted file mode 100644 index 14a735975..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/sched.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __LINUX_SCHED_H__ -#define __LINUX_SCHED_H__ - -#define cond_resched() do { } while(0) -#define signal_pending(x) (0) - -#endif /* __LINUX_SCHED_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/slab.h b/components/dfs/filesystems/jffs2/kernel/linux/slab.h deleted file mode 100644 index f5c5745b0..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/slab.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef __LINUX_SLAB_H__ -#define __LINUX_SLAB_H__ - -//#include //prife - -#include /* Don't ask. Linux headers are a mess. */ - -#define kmalloc(x, y) rt_malloc(x) -#define kfree(x) rt_free(x) -#define vmalloc(x) rt_malloc(x) -#define vfree(x) rt_free(x) - -#endif /* __LINUX_SLAB_H__ */ - diff --git a/components/dfs/filesystems/jffs2/kernel/linux/spinlock.h b/components/dfs/filesystems/jffs2/kernel/linux/spinlock.h deleted file mode 100644 index db3f4d450..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/spinlock.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __LINUX_SPINLOCK_H__ -#define __LINUX_SPINLOCK_H__ - -#if defined (__GNUC__) -typedef struct { } spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) { } -#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED -#elif defined (MSVC) -typedef struct {int no; } spinlock_t; - -#define SPIN_LOCK_UNLOCKED (spinlock_t) ( 0) -#define DEFINE_SPINLOCK(x) spinlock_t x -#else -#error "please use a right C compiler" -#endif - -#define spin_lock_init(lock) \ -CYG_MACRO_START; \ -CYG_UNUSED_PARAM(spinlock_t *, lock); \ -CYG_MACRO_END - -#define spin_lock(lock) \ -CYG_MACRO_START; \ -CYG_UNUSED_PARAM(spinlock_t *, lock); \ -CYG_MACRO_END - -#define spin_unlock(lock) \ -CYG_MACRO_START; \ -CYG_UNUSED_PARAM(spinlock_t *, lock); \ -CYG_MACRO_END - -#define spin_lock_bh(lock) \ -CYG_MACRO_START; \ -CYG_UNUSED_PARAM(spinlock_t *, lock); \ -CYG_MACRO_END - -#define spin_unlock_bh(lock) \ -CYG_MACRO_START; \ -CYG_UNUSED_PARAM(spinlock_t *, lock); \ -CYG_MACRO_END - -#endif /* __LINUX_SPINLOCK_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/stat.h b/components/dfs/filesystems/jffs2/kernel/linux/stat.h deleted file mode 100644 index 8c7920522..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/stat.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __LINUX_STAT_H__ -#define __LINUX_STAT_H__ - - -#include "port/sys/stat.h" //mod by prife - -#define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH) -#define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH) -#define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH) -#define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO) - -#endif /* __LINUX_STAT_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/string.h b/components/dfs/filesystems/jffs2/kernel/linux/string.h deleted file mode 100644 index fc14ba607..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/string.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LINUX_STRING_H__ -#define __LINUX_STRING_H__ - -#include - -#endif /* __LINUX_STRING_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/timer.h b/components/dfs/filesystems/jffs2/kernel/linux/timer.h deleted file mode 100644 index d6f91a68b..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/timer.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __LINUX_TIMER_H__ -#define __LINUX_TIMER_H__ - -/* Not yet */ - -#if defined (__GNUC__) -struct timer_list { } ; -#elif defined (MSVC) -struct timer_list {int no; } ; -#else -#error "please use a right C compiler" -#endif - -#endif /* __LINUX_TIMER_H__ */ - diff --git a/components/dfs/filesystems/jffs2/kernel/linux/types.h b/components/dfs/filesystems/jffs2/kernel/linux/types.h deleted file mode 100644 index bfa09c14c..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/types.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __LINUX_TYPES_H__ -#define __LINUX_TYPES_H__ - -#include "cyg/infra/cyg_type.h" - -#define loff_t off_t - -#define kvec iovec -#endif /* __LINUX_TYPES_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/version.h b/components/dfs/filesystems/jffs2/kernel/linux/version.h deleted file mode 100644 index cd3a45aa3..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/version.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LINUX_VERSION_H__ -#define __LINUX_VERSION_H__ - -#include - -#endif /* __LINUX_VERSION_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/vmalloc.h b/components/dfs/filesystems/jffs2/kernel/linux/vmalloc.h deleted file mode 100644 index 6f18ab225..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/vmalloc.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef __LINUX_VMALLOC_H__ -#define __LINUX_VMALLOC_H__ -#endif diff --git a/components/dfs/filesystems/jffs2/kernel/linux/wait.h b/components/dfs/filesystems/jffs2/kernel/linux/wait.h deleted file mode 100644 index db3fd7a60..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/wait.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __LINUX_WAIT_H__ -#define __LINUX_WAIT_H__ - - -#if defined (__GNUC__) -typedef struct { } wait_queue_head_t; -#elif defined (MSVC) -typedef struct {int no; } wait_queue_head_t; -#else -#error "please use a right C compiler" -#endif - -#define init_waitqueue_head(wait) do{} while (0) -#define add_wait_queue(wait,new_wait) do{} while (0) -#define remove_wait_queue(wait,old_wait) do{} while (0) -#define DECLARE_WAITQUEUE(wait,current) do{} while (0) - -static inline void wake_up(wait_queue_head_t *erase_wait) -{ /* Only used for waking up threads blocks on erases. Not used in eCos */ } - -#endif /* __LINUX_WAIT_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/workqueue.h b/components/dfs/filesystems/jffs2/kernel/linux/workqueue.h deleted file mode 100644 index 8b334d559..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/workqueue.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __LINUX_WORKQUEUE_H__ -#define __LINUX_WORKQUEUE_H__ - -/* We don't do this yet */ -#if defined (__GNUC__) -struct work_struct { } ; -#elif defined (MSVC) -struct work_struct {int no; } ; -#else -#error "please use a right C compiler" -#endif - - -#define INIT_WORK(x,y,z) /* */ -#define schedule_work(x) do { } while(0) -#define flush_scheduled_work() do { } while(0) - -#endif /* __LINUX_WORKQUEUE_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/zlib.h b/components/dfs/filesystems/jffs2/kernel/linux/zlib.h deleted file mode 100644 index 4c32b68c9..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/zlib.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __LINUX_ZLIB_H__ -#define __LINUX_ZLIB_H__ - -#include - -#define zlib_deflateInit(x,y) deflateInit(x,y) -#define zlib_deflate(x,y) deflate(x,y) -#define zlib_deflateEnd(x) deflateEnd(x) -#define zlib_inflateInit(x) inflateInit(x) -#define zlib_inflateInit2(x,y) inflateInit2(x,y) -#define zlib_inflate(x,y) inflate(x,y) -#define zlib_inflateEnd(x) inflateEnd(x) - - -#endif /* __LINUX_ZLIB_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/linux/zutil.h b/components/dfs/filesystems/jffs2/kernel/linux/zutil.h deleted file mode 100644 index c3774baf9..000000000 --- a/components/dfs/filesystems/jffs2/kernel/linux/zutil.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __LINUX_ZUTIL_H__ -#define __LINUX_ZUTIL_H__ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - -#endif /* __LINUX_ZUTIL_H__ */ diff --git a/components/dfs/filesystems/jffs2/kernel/rbtree.c b/components/dfs/filesystems/jffs2/kernel/rbtree.c deleted file mode 100644 index 5bc1cc53e..000000000 --- a/components/dfs/filesystems/jffs2/kernel/rbtree.c +++ /dev/null @@ -1,408 +0,0 @@ -/*======================================================================== -// -// rbtree.c -// -// Red Black tree implementation -// -//======================================================================== -// ####ECOSGPLCOPYRIGHTBEGIN#### -// ------------------------------------------- -// This file is part of eCos, the Embedded Configurable Operating System. -// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -// -// eCos is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free -// Software Foundation; either version 2 or (at your option) any later -// version. -// -// eCos is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License -// along with eCos; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -// As a special exception, if other files instantiate templates or use -// macros or inline functions from this file, or you compile this file -// and link it with other works to produce a work based on this file, -// this file does not by itself cause the resulting work to be covered by -// the GNU General Public License. However the source code for this file -// must still be made available in accordance with section (3) of the GNU -// General Public License v2. -// -// This exception does not invalidate any other reasons why a work based -// on this file might be covered by the GNU General Public License. -// ------------------------------------------- -// ####ECOSGPLCOPYRIGHTEND#### -//======================================================================== -//#####DESCRIPTIONBEGIN#### -// -// Author(s): Niels Provos/OpenBSD -// Contributors: dwmw2 -// Date: 2003-01-21 -// Purpose: This file provides an implementation of red-black trees. -// Description: Derived from OpenBSD src/sys/sys/tree.h -// Usage: -// -//####DESCRIPTIONEND#### -// -//====================================================================== -*/ - -/* $OpenBSD: tree.h,v 1.7 2002/10/17 21:51:54 art Exp $ */ -/* - * Copyright 2002 Niels Provos - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* Fields renamed to match Linux ones. */ -#include - - -#define RB_HEAD(head) (head)->rb_node -#define RB_LEFT(elm) (elm)->rb_left -#define RB_RIGHT(elm) (elm)->rb_right -#define RB_PARENT(elm) (elm)->rb_parent -#define RB_COLOR(elm) (elm)->rb_color - - -#define RB_SET(elm, parent) do { \ - RB_PARENT(elm) = parent; \ - RB_LEFT(elm) = RB_RIGHT(elm) = NULL; \ - RB_COLOR(elm) = RB_RED; \ -} while (0) - -#define RB_SET_BLACKRED(black, red) do { \ - RB_COLOR(black) = RB_BLACK; \ - RB_COLOR(red) = RB_RED; \ -} while (0) - -#ifndef RB_AUGMENT -#define RB_AUGMENT(x) -#endif - -#define RB_ROTATE_LEFT(head, elm, tmp) do { \ - (tmp) = RB_RIGHT(elm); \ - if ((RB_RIGHT(elm) = RB_LEFT(tmp))) { \ - RB_PARENT(RB_LEFT(tmp)) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp) = RB_PARENT(elm))) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm))) \ - RB_LEFT(RB_PARENT(elm)) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm)) = (tmp); \ - } else \ - (head)->rb_node = (tmp); \ - RB_LEFT(tmp) = (elm); \ - RB_PARENT(elm) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp))) \ - RB_AUGMENT(RB_PARENT(tmp)); \ -} while (0) - -#define RB_ROTATE_RIGHT(head, elm, tmp) do { \ - (tmp) = RB_LEFT(elm); \ - if ((RB_LEFT(elm) = RB_RIGHT(tmp))) { \ - RB_PARENT(RB_RIGHT(tmp)) = (elm); \ - } \ - RB_AUGMENT(elm); \ - if ((RB_PARENT(tmp) = RB_PARENT(elm))) { \ - if ((elm) == RB_LEFT(RB_PARENT(elm))) \ - RB_LEFT(RB_PARENT(elm)) = (tmp); \ - else \ - RB_RIGHT(RB_PARENT(elm)) = (tmp); \ - } else \ - (head)->rb_node = (tmp); \ - RB_RIGHT(tmp) = (elm); \ - RB_PARENT(elm) = (tmp); \ - RB_AUGMENT(tmp); \ - if ((RB_PARENT(tmp))) \ - RB_AUGMENT(RB_PARENT(tmp)); \ -} while(0) - -/* Note args swapped to match Linux */ -void rb_insert_color(struct rb_node *elm, struct rb_root *head) -{ - struct rb_node *parent, *gparent, *tmp; - while ((parent = RB_PARENT(elm)) && - RB_COLOR(parent) == RB_RED) { - gparent = RB_PARENT(parent); - if (parent == RB_LEFT(gparent)) { - tmp = RB_RIGHT(gparent); - if (tmp && RB_COLOR(tmp) == RB_RED) { - RB_COLOR(tmp) = RB_BLACK; - RB_SET_BLACKRED(parent, gparent); - elm = gparent; - continue; - } - if (RB_RIGHT(parent) == elm) { - RB_ROTATE_LEFT(head, parent, tmp); - tmp = parent; - parent = elm; - elm = tmp; - } - RB_SET_BLACKRED(parent, gparent); - RB_ROTATE_RIGHT(head, gparent, tmp); - } else { - tmp = RB_LEFT(gparent); - if (tmp && RB_COLOR(tmp) == RB_RED) { - RB_COLOR(tmp) = RB_BLACK; - RB_SET_BLACKRED(parent, gparent); - elm = gparent; - continue; - } - if (RB_LEFT(parent) == elm) { - RB_ROTATE_RIGHT(head, parent, tmp); - tmp = parent; - parent = elm; - elm = tmp; - } - RB_SET_BLACKRED(parent, gparent); - RB_ROTATE_LEFT(head, gparent, tmp); - } - } - RB_COLOR(head->rb_node) = RB_BLACK; -} - - -static void rb_remove_color(struct rb_root *head, struct rb_node *parent, - struct rb_node *elm) -{ - struct rb_node *tmp; - while ((elm == NULL || RB_COLOR(elm) == RB_BLACK) && - elm != RB_HEAD(head)) { - if (RB_LEFT(parent) == elm) { - tmp = RB_RIGHT(parent); - if (RB_COLOR(tmp) == RB_RED) { - RB_SET_BLACKRED(tmp, parent); - RB_ROTATE_LEFT(head, parent, tmp); - tmp = RB_RIGHT(parent); - } - if ((RB_LEFT(tmp) == NULL || - RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) && - (RB_RIGHT(tmp) == NULL || - RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK)) { - RB_COLOR(tmp) = RB_RED; - elm = parent; - parent = RB_PARENT(elm); - } else { - if (RB_RIGHT(tmp) == NULL || - RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK) { - struct rb_node *oleft; - if ((oleft = RB_LEFT(tmp))) - RB_COLOR(oleft) = RB_BLACK; - RB_COLOR(tmp) = RB_RED; - RB_ROTATE_RIGHT(head, tmp, oleft); - tmp = RB_RIGHT(parent); - } - RB_COLOR(tmp) = RB_COLOR(parent); - RB_COLOR(parent) = RB_BLACK; - if (RB_RIGHT(tmp)) - RB_COLOR(RB_RIGHT(tmp)) = RB_BLACK; - RB_ROTATE_LEFT(head, parent, tmp); - elm = RB_HEAD(head); - break; - } - } else { - tmp = RB_LEFT(parent); - if (RB_COLOR(tmp) == RB_RED) { - RB_SET_BLACKRED(tmp, parent); - RB_ROTATE_RIGHT(head, parent, tmp); - tmp = RB_LEFT(parent); - } - if ((RB_LEFT(tmp) == NULL || - RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) && - (RB_RIGHT(tmp) == NULL || - RB_COLOR(RB_RIGHT(tmp)) == RB_BLACK)) { - RB_COLOR(tmp) = RB_RED; - elm = parent; - parent = RB_PARENT(elm); - } else { - if (RB_LEFT(tmp) == NULL || - RB_COLOR(RB_LEFT(tmp)) == RB_BLACK) { - struct rb_node *oright; - if ((oright = RB_RIGHT(tmp))) - RB_COLOR(oright) = RB_BLACK; - RB_COLOR(tmp) = RB_RED; - RB_ROTATE_LEFT(head, tmp, oright); - tmp = RB_LEFT(parent); - } - RB_COLOR(tmp) = RB_COLOR(parent); - RB_COLOR(parent) = RB_BLACK; - if (RB_LEFT(tmp)) - RB_COLOR(RB_LEFT(tmp)) = RB_BLACK; - RB_ROTATE_RIGHT(head, parent, tmp); - elm = RB_HEAD(head); - break; - } - } - } - if (elm) - RB_COLOR(elm) = RB_BLACK; -} - -/* Note name changed. Guess why :) */ -void rb_erase(struct rb_node *elm, struct rb_root *head) -{ - struct rb_node *child, *parent, *old = elm; - int color; - if (RB_LEFT(elm) == NULL) - child = RB_RIGHT(elm); - else if (RB_RIGHT(elm) == NULL) - child = RB_LEFT(elm); - else { - struct rb_node *left; - elm = RB_RIGHT(elm); - while ((left = RB_LEFT(elm))) - elm = left; - child = RB_RIGHT(elm); - parent = RB_PARENT(elm); - color = RB_COLOR(elm); - if (child) - RB_PARENT(child) = parent; - if (parent) { - if (RB_LEFT(parent) == elm) - RB_LEFT(parent) = child; - else - RB_RIGHT(parent) = child; - RB_AUGMENT(parent); - } else - RB_HEAD(head) = child; - if (RB_PARENT(elm) == old) - parent = elm; - *(elm) = *(old); - if (RB_PARENT(old)) { - if (RB_LEFT(RB_PARENT(old)) == old) - RB_LEFT(RB_PARENT(old)) = elm; - else - RB_RIGHT(RB_PARENT(old)) = elm; - RB_AUGMENT(RB_PARENT(old)); - } else - RB_HEAD(head) = elm; - RB_PARENT(RB_LEFT(old)) = elm; - if (RB_RIGHT(old)) - RB_PARENT(RB_RIGHT(old)) = elm; - if (parent) { - left = parent; - do { - RB_AUGMENT(left); - } while ((left = RB_PARENT(left))); - } - goto color; - } - parent = RB_PARENT(elm); - color = RB_COLOR(elm); - if (child) - RB_PARENT(child) = parent; - if (parent) { - if (RB_LEFT(parent) == elm) - RB_LEFT(parent) = child; - else - RB_RIGHT(parent) = child; - RB_AUGMENT(parent); - } else - RB_HEAD(head) = child; -color: - if (color == RB_BLACK) - rb_remove_color(head, parent, child); -} - -struct rb_node *rb_next(struct rb_node *elm) -{ - if (RB_RIGHT(elm)) { - elm = RB_RIGHT(elm); - while (RB_LEFT(elm)) - elm = RB_LEFT(elm); - } else { - if (RB_PARENT(elm) && - (elm == RB_LEFT(RB_PARENT(elm)))) - elm = RB_PARENT(elm); - else { - while (RB_PARENT(elm) && - (elm == RB_RIGHT(RB_PARENT(elm)))) - elm = RB_PARENT(elm); - elm = RB_PARENT(elm); - } - } - return (elm); -} - -struct rb_node *rb_prev(struct rb_node *elm) -{ - if (RB_LEFT(elm)) { - elm = RB_LEFT(elm); - while (RB_RIGHT(elm)) - elm = RB_RIGHT(elm); - } else { - if (RB_PARENT(elm) && - (elm == RB_RIGHT(RB_PARENT(elm)))) - elm = RB_PARENT(elm); - else { - while (RB_PARENT(elm) && - (elm == RB_LEFT(RB_PARENT(elm)))) - elm = RB_PARENT(elm); - elm = RB_PARENT(elm); - } - } - return (elm); -} - -/* These ones are lifted from Linux -- but that's OK because I - wrote them. dwmw2. */ -struct rb_node *rb_first(struct rb_root *root) -{ - struct rb_node *n; - - n = root->rb_node; - if (!n) - return 0; - while (n->rb_left) - n = n->rb_left; - return n; -} - -void rb_replace_node(struct rb_node *victim, struct rb_node *new, - struct rb_root *root) -{ - struct rb_node *parent = victim->rb_parent; - - /* Set the surrounding nodes to point to the replacement */ - if (parent) { - if (victim == parent->rb_left) - parent->rb_left = new; - else - parent->rb_right = new; - } else { - root->rb_node = new; - } - if (victim->rb_left) - victim->rb_left->rb_parent = new; - if (victim->rb_right) - victim->rb_right->rb_parent = new; - - /* Copy the pointers/colour from the victim to the replacement */ - *new = *victim; -} diff --git a/components/dfs/filesystems/jffs2/porting.c b/components/dfs/filesystems/jffs2/porting.c deleted file mode 100644 index 81290bdc3..000000000 --- a/components/dfs/filesystems/jffs2/porting.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include "nodelist.h" - -#include "porting.h" - -time_t jffs2_get_timestamp(void) -{ - return 0; -} - -void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info) -{ - struct jffs2_fs_info; - struct super_block *jffs2_sb; - struct jffs2_sb_info *c; - - jffs2_sb = (struct super_block *)(data); - c = JFFS2_SB_INFO(jffs2_sb); - - info->sector_size = c->sector_size; - info->nr_blocks = c->nr_blocks; - info->free_size = c->free_size + c->dirty_size; //fixme need test! -} - -int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - void * stat_buf) -{ - return jffs2_fste.stat(mte, mte->root, name, (struct stat *)stat_buf); -} diff --git a/components/dfs/filesystems/jffs2/porting.h b/components/dfs/filesystems/jffs2/porting.h deleted file mode 100644 index 2671f46dd..000000000 --- a/components/dfs/filesystems/jffs2/porting.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _PORTING_H -#define _PORTING_H - -#include "jffs2_config.h" -/* the following should be same with os_sys_stat.h */ -#define JFFS2_S_IFMT 0x000003FF -#define JFFS2_S_IFDIR (1<<0) -#define JFFS2_S_IFREG (1<<3) - -struct jffs2_fs_info -{ - unsigned sector_size; /* a erasing block size*/ - unsigned nr_blocks; /* number of blocks in flash */ - unsigned free_size; -}; - -struct jffs2_stat { - unsigned long st_mode; /* File mode */ - unsigned int st_ino; /* File serial number */ - unsigned int st_dev; /* ID of device containing file */ - unsigned short st_nlink; /* Number of hard links */ - unsigned short st_uid; /* User ID of the file owner */ - unsigned short st_gid; /* Group ID of the file's group */ - long st_size; /* File size (regular files only) */ - long st_atime; /* Last access time */ - long st_mtime; /* Last data modification time */ - long st_ctime; /* Last file status change time */ -}; - -struct jffs2_dirent -{ -#ifdef CYGPKG_FILEIO_DIRENT_DTYPE - - unsigned long d_type; // Only supported with FATFS, RAMFS, ROMFS, - // and JFFS2. - // d_type is not part of POSIX so - // should be used with caution. -#endif - char d_name[JFFS2_NAME_MAX+1]; -}; - -extern cyg_fileops jffs2_fileops; -extern cyg_fileops jffs2_dirops; -extern struct cyg_fstab_entry jffs2_fste; - -time_t jffs2_get_timestamp(void); -void jffs2_get_info_from_sb(void * data, struct jffs2_fs_info * info); -int jffs2_porting_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - void * stat_buf); - -#endif diff --git a/components/dfs/filesystems/jffs2/src/LICENCE b/components/dfs/filesystems/jffs2/src/LICENCE deleted file mode 100644 index f3f9a6f6e..000000000 --- a/components/dfs/filesystems/jffs2/src/LICENCE +++ /dev/null @@ -1,35 +0,0 @@ -The files in this directory and elsewhere which refer to this LICENCE -file are part of JFFS2, the Journalling Flash File System v2. - - Copyright (C) 2001-2003 Red Hat, Inc. - -JFFS2 is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2 or (at your option) any later -version. - -JFFS2 is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License along -with JFFS2; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - -As a special exception, if other files instantiate templates or use -macros or inline functions from these files, or you compile these -files and link them with other works to produce a work based on these -files, these files do not by themselves cause the resulting work to be -covered by the GNU General Public License. However the source code for -these files must still be made available in accordance with section (3) -of the GNU General Public License. - -This exception does not invalidate any other reasons why a work based on -this file might be covered by the GNU General Public License. - -For information on obtaining alternative licences for JFFS2, see -http://sources.redhat.com/jffs2/jffs2-licence.html - - - $Id: LICENCE,v 1.2 2003/10/04 08:33:05 dwmw2 Exp $ diff --git a/components/dfs/filesystems/jffs2/src/build.c b/components/dfs/filesystems/jffs2/src/build.c deleted file mode 100644 index 158b01a82..000000000 --- a/components/dfs/filesystems/jffs2/src/build.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: build.c,v 1.75 2005/07/22 10:32:07 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include "nodelist.h" - -static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *, struct jffs2_inode_cache *, struct jffs2_full_dirent **); - -static inline struct jffs2_inode_cache * -first_inode_chain(int *i, struct jffs2_sb_info *c) -{ - for (; *i < INOCACHE_HASHSIZE; (*i)++) { - if (c->inocache_list[*i]) - return c->inocache_list[*i]; - } - return NULL; -} - -static inline struct jffs2_inode_cache * -next_inode(int *i, struct jffs2_inode_cache *ic, struct jffs2_sb_info *c) -{ - /* More in this chain? */ - if (ic->next) - return ic->next; - (*i)++; - return first_inode_chain(i, c); -} - -#define for_each_inode(i, c, ic) \ - for (i = 0, ic = first_inode_chain(&i, (c)); \ - ic; \ - ic = next_inode(&i, ic, (c))) - - -static inline void jffs2_build_inode_pass1(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) -{ - struct jffs2_full_dirent *fd; - - D1(printk(KERN_DEBUG "jffs2_build_inode building directory inode #%u\n", ic->ino)); - - /* For each child, increase nlink */ - for(fd = ic->scan_dents; fd; fd = fd->next) { - struct jffs2_inode_cache *child_ic; - if (!fd->ino) - continue; - - /* XXX: Can get high latency here with huge directories */ - - child_ic = jffs2_get_ino_cache(c, fd->ino); - if (!child_ic) { - printk(KERN_NOTICE "Eep. Child \"%s\" (ino #%u) of dir ino #%u doesn't exist!\n", - fd->name, fd->ino, ic->ino); - jffs2_mark_node_obsolete(c, fd->raw); - continue; - } - - if (child_ic->nlink++ && fd->type == DT_DIR) { - printk(KERN_NOTICE "Child dir \"%s\" (ino #%u) of dir ino #%u appears to be a hard link\n", fd->name, fd->ino, ic->ino); - if (fd->ino == 1 && ic->ino == 1) { - printk(KERN_NOTICE "This is mostly harmless, and probably caused by creating a JFFS2 image\n"); - printk(KERN_NOTICE "using a buggy version of mkfs.jffs2. Use at least v1.17.\n"); - } - /* What do we do about it? */ - } - D1(printk(KERN_DEBUG "Increased nlink for child \"%s\" (ino #%u)\n", fd->name, fd->ino)); - /* Can't free them. We might need them in pass 2 */ - } -} - -/* Scan plan: - - Scan physical nodes. Build map of inodes/dirents. Allocate inocaches as we go - - Scan directory tree from top down, setting nlink in inocaches - - Scan inocaches for inodes with nlink==0 -*/ -static int jffs2_build_filesystem(struct jffs2_sb_info *c) -{ - int ret; - int i; - struct jffs2_inode_cache *ic; - struct jffs2_full_dirent *fd; - struct jffs2_full_dirent *dead_fds = NULL; - - /* First, scan the medium and build all the inode caches with - lists of physical nodes */ - - c->flags |= JFFS2_SB_FLAG_SCANNING; - ret = jffs2_scan_medium(c); - c->flags &= ~JFFS2_SB_FLAG_SCANNING; - if (ret) - goto exit; - - D1(printk(KERN_DEBUG "Scanned flash completely\n")); - jffs2_dbg_dump_block_lists_nolock(c); - - c->flags |= JFFS2_SB_FLAG_BUILDING; - /* Now scan the directory tree, increasing nlink according to every dirent found. */ - for_each_inode(i, c, ic) { - D1(printk(KERN_DEBUG "Pass 1: ino #%u\n", ic->ino)); - - D1(BUG_ON(ic->ino > c->highest_ino)); - - if (ic->scan_dents) { - jffs2_build_inode_pass1(c, ic); - cond_resched(); - } - } - - D1(printk(KERN_DEBUG "Pass 1 complete\n")); - - /* Next, scan for inodes with nlink == 0 and remove them. If - they were directories, then decrement the nlink of their - children too, and repeat the scan. As that's going to be - a fairly uncommon occurrence, it's not so evil to do it this - way. Recursion bad. */ - D1(printk(KERN_DEBUG "Pass 2 starting\n")); - - for_each_inode(i, c, ic) { - D1(printk(KERN_DEBUG "Pass 2: ino #%u, nlink %d, ic %p, nodes %p\n", ic->ino, ic->nlink, ic, ic->nodes)); - if (ic->nlink) - continue; - - jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); - cond_resched(); - } - - D1(printk(KERN_DEBUG "Pass 2a starting\n")); - - while (dead_fds) { - fd = dead_fds; - dead_fds = fd->next; - - ic = jffs2_get_ino_cache(c, fd->ino); - D1(printk(KERN_DEBUG "Removing dead_fd ino #%u (\"%s\"), ic at %p\n", fd->ino, fd->name, ic)); - - if (ic) - jffs2_build_remove_unlinked_inode(c, ic, &dead_fds); - jffs2_free_full_dirent(fd); - } - - D1(printk(KERN_DEBUG "Pass 2 complete\n")); - - /* Finally, we can scan again and free the dirent structs */ - for_each_inode(i, c, ic) { - D1(printk(KERN_DEBUG "Pass 3: ino #%u, ic %p, nodes %p\n", ic->ino, ic, ic->nodes)); - - while(ic->scan_dents) { - fd = ic->scan_dents; - ic->scan_dents = fd->next; - jffs2_free_full_dirent(fd); - } - ic->scan_dents = NULL; - cond_resched(); - } - c->flags &= ~JFFS2_SB_FLAG_BUILDING; - - D1(printk(KERN_DEBUG "Pass 3 complete\n")); - jffs2_dbg_dump_block_lists_nolock(c); - - /* Rotate the lists by some number to ensure wear levelling */ - jffs2_rotate_lists(c); - - ret = 0; - -exit: - if (ret) { - for_each_inode(i, c, ic) { - while(ic->scan_dents) { - fd = ic->scan_dents; - ic->scan_dents = fd->next; - jffs2_free_full_dirent(fd); - } - } - } - - return ret; -} - -static void jffs2_build_remove_unlinked_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, struct jffs2_full_dirent **dead_fds) -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_full_dirent *fd; - - D1(printk(KERN_DEBUG "JFFS2: Removing ino #%u with nlink == zero.\n", ic->ino)); - - raw = ic->nodes; - while (raw != (void *)ic) { - struct jffs2_raw_node_ref *next = raw->next_in_ino; - D1(printk(KERN_DEBUG "obsoleting node at 0x%08x\n", ref_offset(raw))); - jffs2_mark_node_obsolete(c, raw); - raw = next; - } - - if (ic->scan_dents) { - int whinged = 0; - D1(printk(KERN_DEBUG "Inode #%u was a directory which may have children...\n", ic->ino)); - - while(ic->scan_dents) { - struct jffs2_inode_cache *child_ic; - - fd = ic->scan_dents; - ic->scan_dents = fd->next; - - if (!fd->ino) { - /* It's a deletion dirent. Ignore it */ - D1(printk(KERN_DEBUG "Child \"%s\" is a deletion dirent, skipping...\n", fd->name)); - jffs2_free_full_dirent(fd); - continue; - } - if (!whinged) { - whinged = 1; - printk(KERN_NOTICE "Inode #%u was a directory with children - removing those too...\n", ic->ino); - } - - D1(printk(KERN_DEBUG "Removing child \"%s\", ino #%u\n", - fd->name, fd->ino)); - - child_ic = jffs2_get_ino_cache(c, fd->ino); - if (!child_ic) { - printk(KERN_NOTICE "Cannot remove child \"%s\", ino #%u, because it doesn't exist\n", fd->name, fd->ino); - jffs2_free_full_dirent(fd); - continue; - } - - /* Reduce nlink of the child. If it's now zero, stick it on the - dead_fds list to be cleaned up later. Else just free the fd */ - - child_ic->nlink--; - - if (!child_ic->nlink) { - D1(printk(KERN_DEBUG "Inode #%u (\"%s\") has now got zero nlink. Adding to dead_fds list.\n", - fd->ino, fd->name)); - fd->next = *dead_fds; - *dead_fds = fd; - } else { - D1(printk(KERN_DEBUG "Inode #%u (\"%s\") has now got nlink %d. Ignoring.\n", - fd->ino, fd->name, child_ic->nlink)); - jffs2_free_full_dirent(fd); - } - } - } - - /* - We don't delete the inocache from the hash list and free it yet. - The erase code will do that, when all the nodes are completely gone. - */ -} - -static void jffs2_calc_trigger_levels(struct jffs2_sb_info *c) -{ - uint32_t size; - - /* Deletion should almost _always_ be allowed. We're fairly - buggered once we stop allowing people to delete stuff - because there's not enough free space... */ - c->resv_blocks_deletion = 2; - - /* Be conservative about how much space we need before we allow writes. - On top of that which is required for deletia, require an extra 2% - of the medium to be available, for overhead caused by nodes being - split across blocks, etc. */ - - size = c->flash_size / 50; /* 2% of flash size */ - size += c->nr_blocks * 100; /* And 100 bytes per eraseblock */ - size += c->sector_size - 1; /* ... and round up */ - - c->resv_blocks_write = c->resv_blocks_deletion + (size / c->sector_size); - - /* When do we let the GC thread run in the background */ - - c->resv_blocks_gctrigger = c->resv_blocks_write + 1; - - /* When do we allow garbage collection to merge nodes to make - long-term progress at the expense of short-term space exhaustion? */ - c->resv_blocks_gcmerge = c->resv_blocks_deletion + 1; - - /* When do we allow garbage collection to eat from bad blocks rather - than actually making progress? */ - c->resv_blocks_gcbad = 0;//c->resv_blocks_deletion + 2; - - /* If there's less than this amount of dirty space, don't bother - trying to GC to make more space. It'll be a fruitless task */ - c->nospc_dirty_size = c->sector_size + (c->flash_size / 100); - - D1(printk(KERN_DEBUG "JFFS2 trigger levels (size %d KiB, block size %d KiB, %d blocks)\n", - c->flash_size / 1024, c->sector_size / 1024, c->nr_blocks)); - D1(printk(KERN_DEBUG "Blocks required to allow deletion: %d (%d KiB)\n", - c->resv_blocks_deletion, c->resv_blocks_deletion*c->sector_size/1024)); - D1(printk(KERN_DEBUG "Blocks required to allow writes: %d (%d KiB)\n", - c->resv_blocks_write, c->resv_blocks_write*c->sector_size/1024)); - D1(printk(KERN_DEBUG "Blocks required to quiesce GC thread: %d (%d KiB)\n", - c->resv_blocks_gctrigger, c->resv_blocks_gctrigger*c->sector_size/1024)); - D1(printk(KERN_DEBUG "Blocks required to allow GC merges: %d (%d KiB)\n", - c->resv_blocks_gcmerge, c->resv_blocks_gcmerge*c->sector_size/1024)); - D1(printk(KERN_DEBUG "Blocks required to GC bad blocks: %d (%d KiB)\n", - c->resv_blocks_gcbad, c->resv_blocks_gcbad*c->sector_size/1024)); - D1(printk(KERN_DEBUG "Amount of dirty space required to GC: %d bytes\n", - c->nospc_dirty_size)); -} - -int jffs2_do_mount_fs(struct jffs2_sb_info *c) -{ - int i; - - c->free_size = c->flash_size; - c->nr_blocks = c->flash_size / c->sector_size; -#ifndef __ECOS - if (c->mtd->flags & MTD_NO_VIRTBLOCKS) - c->blocks = vmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks); - else -#endif - c->blocks = kmalloc(sizeof(struct jffs2_eraseblock) * c->nr_blocks, GFP_KERNEL); - if (!c->blocks) - return -ENOMEM; - for (i=0; inr_blocks; i++) { - INIT_LIST_HEAD(&c->blocks[i].list); - c->blocks[i].offset = i * c->sector_size; - c->blocks[i].free_size = c->sector_size; - c->blocks[i].dirty_size = 0; - c->blocks[i].wasted_size = 0; - c->blocks[i].unchecked_size = 0; - c->blocks[i].used_size = 0; - c->blocks[i].first_node = NULL; - c->blocks[i].last_node = NULL; - c->blocks[i].bad_count = 0; - } - - INIT_LIST_HEAD(&c->clean_list); - INIT_LIST_HEAD(&c->very_dirty_list); - INIT_LIST_HEAD(&c->dirty_list); - INIT_LIST_HEAD(&c->erasable_list); - INIT_LIST_HEAD(&c->erasing_list); - INIT_LIST_HEAD(&c->erase_pending_list); - INIT_LIST_HEAD(&c->erasable_pending_wbuf_list); - INIT_LIST_HEAD(&c->erase_complete_list); - INIT_LIST_HEAD(&c->free_list); - INIT_LIST_HEAD(&c->bad_list); - INIT_LIST_HEAD(&c->bad_used_list); - c->highest_ino = 1; - - if (jffs2_build_filesystem(c)) { - D1(printk(KERN_DEBUG "build_fs failed\n")); - jffs2_free_ino_caches(c); - jffs2_free_raw_node_refs(c); -#ifndef __ECOS - if (c->mtd->flags & MTD_NO_VIRTBLOCKS) - vfree(c->blocks); - else -#endif - kfree(c->blocks); - - return -EIO; - } - - jffs2_calc_trigger_levels(c); - - return 0; -} diff --git a/components/dfs/filesystems/jffs2/src/compr.c b/components/dfs/filesystems/jffs2/src/compr.c deleted file mode 100644 index c9e54b97d..000000000 --- a/components/dfs/filesystems/jffs2/src/compr.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * Created by Arjan van de Ven - * - * Copyright (C) 2004 Ferenc Havasi , - * University of Szeged, Hungary - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: compr.c,v 1.45 2005/07/26 13:24:40 havasi Exp $ - * - */ - -#include "compr.h" - -static DEFINE_SPINLOCK(jffs2_compressor_list_lock); - -/* Available compressors are on this list */ -static LIST_HEAD(jffs2_compressor_list); - -/* Actual compression mode */ -static int jffs2_compression_mode = JFFS2_COMPR_MODE_PRIORITY; - -/* Statistics for blocks stored without compression */ -static uint32_t none_stat_compr_blocks=0,none_stat_decompr_blocks=0,none_stat_compr_size=0; - -/* jffs2_compress: - * @data: Pointer to uncompressed data - * @cdata: Pointer to returned pointer to buffer for compressed data - * @datalen: On entry, holds the amount of data available for compression. - * On exit, expected to hold the amount of data actually compressed. - * @cdatalen: On entry, holds the amount of space available for compressed - * data. On exit, expected to hold the actual size of the compressed - * data. - * - * Returns: Lower byte to be stored with data indicating compression type used. - * Zero is used to show that the data could not be compressed - the - * compressed version was actually larger than the original. - * Upper byte will be used later. (soon) - * - * If the cdata buffer isn't large enough to hold all the uncompressed data, - * jffs2_compress should compress as much as will fit, and should set - * *datalen accordingly to show the amount of data which were compressed. - */ -uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned char *data_in, unsigned char **cpage_out, - uint32_t *datalen, uint32_t *cdatalen) -{ - int ret = JFFS2_COMPR_NONE; - int compr_ret; - struct jffs2_compressor *this, *best=NULL; - unsigned char *output_buf = NULL, *tmp_buf; - uint32_t orig_slen, orig_dlen; - uint32_t best_slen=0, best_dlen=0; - - switch (jffs2_compression_mode) { - case JFFS2_COMPR_MODE_NONE: - break; - case JFFS2_COMPR_MODE_PRIORITY: - output_buf = kmalloc(*cdatalen,GFP_KERNEL); - if (!output_buf) { - printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n"); - goto out; - } - orig_slen = *datalen; - orig_dlen = *cdatalen; - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - /* Skip decompress-only backwards-compatibility and disabled modules */ - if ((!this->compress)||(this->disabled)) - continue; - - this->usecount++; - spin_unlock(&jffs2_compressor_list_lock); - *datalen = orig_slen; - *cdatalen = orig_dlen; - compr_ret = this->compress(data_in, output_buf, datalen, cdatalen, NULL); - spin_lock(&jffs2_compressor_list_lock); - this->usecount--; - if (!compr_ret) { - ret = this->compr; - this->stat_compr_blocks++; - this->stat_compr_orig_size += *datalen; - this->stat_compr_new_size += *cdatalen; - break; - } - } - spin_unlock(&jffs2_compressor_list_lock); - if (ret == JFFS2_COMPR_NONE) kfree(output_buf); - break; - case JFFS2_COMPR_MODE_SIZE: - orig_slen = *datalen; - orig_dlen = *cdatalen; - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - /* Skip decompress-only backwards-compatibility and disabled modules */ - if ((!this->compress)||(this->disabled)) - continue; - /* Allocating memory for output buffer if necessary */ - if ((this->compr_buf_sizecompr_buf)) { - spin_unlock(&jffs2_compressor_list_lock); - kfree(this->compr_buf); - spin_lock(&jffs2_compressor_list_lock); - this->compr_buf_size=0; - this->compr_buf=NULL; - } - if (!this->compr_buf) { - spin_unlock(&jffs2_compressor_list_lock); - tmp_buf = kmalloc(orig_dlen,GFP_KERNEL); - spin_lock(&jffs2_compressor_list_lock); - if (!tmp_buf) { - printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n",orig_dlen); - continue; - } - else { - this->compr_buf = tmp_buf; - this->compr_buf_size = orig_dlen; - } - } - this->usecount++; - spin_unlock(&jffs2_compressor_list_lock); - *datalen = orig_slen; - *cdatalen = orig_dlen; - compr_ret = this->compress(data_in, this->compr_buf, datalen, cdatalen, NULL); - spin_lock(&jffs2_compressor_list_lock); - this->usecount--; - if (!compr_ret) { - if ((!best_dlen)||(best_dlen>*cdatalen)) { - best_dlen = *cdatalen; - best_slen = *datalen; - best = this; - } - } - } - if (best_dlen) { - *cdatalen = best_dlen; - *datalen = best_slen; - output_buf = best->compr_buf; - best->compr_buf = NULL; - best->compr_buf_size = 0; - best->stat_compr_blocks++; - best->stat_compr_orig_size += best_slen; - best->stat_compr_new_size += best_dlen; - ret = best->compr; - } - spin_unlock(&jffs2_compressor_list_lock); - break; - default: - printk(KERN_ERR "JFFS2: unknow compression mode.\n"); - } - out: - if (ret == JFFS2_COMPR_NONE) { - *cpage_out = data_in; - *datalen = *cdatalen; - none_stat_compr_blocks++; - none_stat_compr_size += *datalen; - } - else { - *cpage_out = output_buf; - } - return ret; -} - -int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - uint16_t comprtype, unsigned char *cdata_in, - unsigned char *data_out, uint32_t cdatalen, uint32_t datalen) -{ - struct jffs2_compressor *this; - int ret; - - /* Older code had a bug where it would write non-zero 'usercompr' - fields. Deal with it. */ - if ((comprtype & 0xff) <= JFFS2_COMPR_ZLIB) - comprtype &= 0xff; - - switch (comprtype & 0xff) { - case JFFS2_COMPR_NONE: - /* This should be special-cased elsewhere, but we might as well deal with it */ - memcpy(data_out, cdata_in, datalen); - none_stat_decompr_blocks++; - break; - case JFFS2_COMPR_ZERO: - memset(data_out, 0, datalen); - break; - default: - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - if (comprtype == this->compr) { - this->usecount++; - spin_unlock(&jffs2_compressor_list_lock); - ret = this->decompress(cdata_in, data_out, cdatalen, datalen, NULL); - spin_lock(&jffs2_compressor_list_lock); - if (ret) { - printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); - } - else { - this->stat_decompr_blocks++; - } - this->usecount--; - spin_unlock(&jffs2_compressor_list_lock); - return ret; - } - } - printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); - spin_unlock(&jffs2_compressor_list_lock); - return -EIO; - } - return 0; -} - -int jffs2_register_compressor(struct jffs2_compressor *comp) -{ - struct jffs2_compressor *this; - - if (!comp->name) { - printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n"); - return -1; - } - comp->compr_buf_size=0; - comp->compr_buf=NULL; - comp->usecount=0; - comp->stat_compr_orig_size=0; - comp->stat_compr_new_size=0; - comp->stat_compr_blocks=0; - comp->stat_decompr_blocks=0; - D1(printk(KERN_DEBUG "Registering JFFS2 compressor \"%s\"\n", comp->name)); - - spin_lock(&jffs2_compressor_list_lock); - - list_for_each_entry(this, &jffs2_compressor_list, list) { - if (this->priority < comp->priority) { - list_add(&comp->list, this->list.prev); - goto out; - } - } - list_add_tail(&comp->list, &jffs2_compressor_list); -out: - D2(list_for_each_entry(this, &jffs2_compressor_list, list) { - printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority); - }) - - spin_unlock(&jffs2_compressor_list_lock); - - return 0; -} - -int jffs2_unregister_compressor(struct jffs2_compressor *comp) -{ - D2(struct jffs2_compressor *this;) - - D1(printk(KERN_DEBUG "Unregistering JFFS2 compressor \"%s\"\n", comp->name)); - - spin_lock(&jffs2_compressor_list_lock); - - if (comp->usecount) { - spin_unlock(&jffs2_compressor_list_lock); - printk(KERN_WARNING "JFFS2: Compressor modul is in use. Unregister failed.\n"); - return -1; - } - list_del(&comp->list); - - D2(list_for_each_entry(this, &jffs2_compressor_list, list) { - printk(KERN_DEBUG "Compressor \"%s\", prio %d\n", this->name, this->priority); - }) - spin_unlock(&jffs2_compressor_list_lock); - return 0; -} - -#ifdef CONFIG_JFFS2_PROC - -#define JFFS2_STAT_BUF_SIZE 16000 - -char *jffs2_list_compressors(void) -{ - struct jffs2_compressor *this; - char *buf, *act_buf; - - act_buf = buf = kmalloc(JFFS2_STAT_BUF_SIZE,GFP_KERNEL); - list_for_each_entry(this, &jffs2_compressor_list, list) { - act_buf += sprintf(act_buf, "%10s priority:%d ", this->name, this->priority); - if ((this->disabled)||(!this->compress)) - act_buf += sprintf(act_buf,"disabled"); - else - act_buf += sprintf(act_buf,"enabled"); - act_buf += sprintf(act_buf,"\n"); - } - return buf; -} - -char *jffs2_stats(void) -{ - struct jffs2_compressor *this; - char *buf, *act_buf; - - act_buf = buf = kmalloc(JFFS2_STAT_BUF_SIZE,GFP_KERNEL); - - act_buf += sprintf(act_buf,"JFFS2 compressor statistics:\n"); - act_buf += sprintf(act_buf,"%10s ","none"); - act_buf += sprintf(act_buf,"compr: %d blocks (%d) decompr: %d blocks\n", none_stat_compr_blocks, - none_stat_compr_size, none_stat_decompr_blocks); - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - act_buf += sprintf(act_buf,"%10s ",this->name); - if ((this->disabled)||(!this->compress)) - act_buf += sprintf(act_buf,"- "); - else - act_buf += sprintf(act_buf,"+ "); - act_buf += sprintf(act_buf,"compr: %d blocks (%d/%d) decompr: %d blocks ", this->stat_compr_blocks, - this->stat_compr_new_size, this->stat_compr_orig_size, - this->stat_decompr_blocks); - act_buf += sprintf(act_buf,"\n"); - } - spin_unlock(&jffs2_compressor_list_lock); - - return buf; -} - -char *jffs2_get_compression_mode_name(void) -{ - switch (jffs2_compression_mode) { - case JFFS2_COMPR_MODE_NONE: - return "none"; - case JFFS2_COMPR_MODE_PRIORITY: - return "priority"; - case JFFS2_COMPR_MODE_SIZE: - return "size"; - } - return "unkown"; -} - -int jffs2_set_compression_mode_name(const char *name) -{ - if (!strcmp("none",name)) { - jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; - return 0; - } - if (!strcmp("priority",name)) { - jffs2_compression_mode = JFFS2_COMPR_MODE_PRIORITY; - return 0; - } - if (!strcmp("size",name)) { - jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; - return 0; - } - return 1; -} - -static int jffs2_compressor_Xable(const char *name, int disabled) -{ - struct jffs2_compressor *this; - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - if (!strcmp(this->name, name)) { - this->disabled = disabled; - spin_unlock(&jffs2_compressor_list_lock); - return 0; - } - } - spin_unlock(&jffs2_compressor_list_lock); - printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name); - return 1; -} - -int jffs2_enable_compressor_name(const char *name) -{ - return jffs2_compressor_Xable(name, 0); -} - -int jffs2_disable_compressor_name(const char *name) -{ - return jffs2_compressor_Xable(name, 1); -} - -int jffs2_set_compressor_priority(const char *name, int priority) -{ - struct jffs2_compressor *this,*comp; - spin_lock(&jffs2_compressor_list_lock); - list_for_each_entry(this, &jffs2_compressor_list, list) { - if (!strcmp(this->name, name)) { - this->priority = priority; - comp = this; - goto reinsert; - } - } - spin_unlock(&jffs2_compressor_list_lock); - printk(KERN_WARNING "JFFS2: compressor %s not found.\n",name); - return 1; -reinsert: - /* list is sorted in the order of priority, so if - we change it we have to reinsert it into the - good place */ - list_del(&comp->list); - list_for_each_entry(this, &jffs2_compressor_list, list) { - if (this->priority < comp->priority) { - list_add(&comp->list, this->list.prev); - spin_unlock(&jffs2_compressor_list_lock); - return 0; - } - } - list_add_tail(&comp->list, &jffs2_compressor_list); - spin_unlock(&jffs2_compressor_list_lock); - return 0; -} - -#endif - -void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig) -{ - if (orig != comprbuf) - kfree(comprbuf); -} - -int jffs2_compressors_init(void) -{ -/* Registering compressors */ -#ifdef CONFIG_JFFS2_ZLIB - jffs2_zlib_init(); -#endif -#ifdef CONFIG_JFFS2_RTIME - jffs2_rtime_init(); -#endif -#ifdef CONFIG_JFFS2_RUBIN - jffs2_rubinmips_init(); - jffs2_dynrubin_init(); -#endif -/* Setting default compression mode */ -#ifdef CONFIG_JFFS2_CMODE_NONE - jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; - D1(printk(KERN_INFO "JFFS2: default compression mode: none\n");) -#else -#ifdef CONFIG_JFFS2_CMODE_SIZE - jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; - D1(printk(KERN_INFO "JFFS2: default compression mode: size\n");) -#else - D1(printk(KERN_INFO "JFFS2: default compression mode: priority\n");) -#endif -#endif - return 0; -} - -int jffs2_compressors_exit(void) -{ -/* Unregistering compressors */ -#ifdef CONFIG_JFFS2_RUBIN - jffs2_dynrubin_exit(); - jffs2_rubinmips_exit(); -#endif -#ifdef CONFIG_JFFS2_RTIME - jffs2_rtime_exit(); -#endif -#ifdef CONFIG_JFFS2_ZLIB - jffs2_zlib_exit(); -#endif - return 0; -} diff --git a/components/dfs/filesystems/jffs2/src/compr.h b/components/dfs/filesystems/jffs2/src/compr.h deleted file mode 100644 index 9ec6e37d3..000000000 --- a/components/dfs/filesystems/jffs2/src/compr.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2004 Ferenc Havasi , - * University of Szeged, Hungary - * - * For licensing information, see the file 'LICENCE' in the - * jffs2 directory. - * - * $Id: compr.h,v 1.8 2005/07/26 13:24:40 havasi Exp $ - * - */ - -#ifndef __JFFS2_COMPR_H__ -#define __JFFS2_COMPR_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" - -#define JFFS2_RUBINMIPS_PRIORITY 10 -#define JFFS2_DYNRUBIN_PRIORITY 20 -#define JFFS2_LZARI_PRIORITY 30 -#define JFFS2_LZO_PRIORITY 40 -#define JFFS2_RTIME_PRIORITY 50 -#define JFFS2_ZLIB_PRIORITY 60 - -#define JFFS2_RUBINMIPS_DISABLED /* RUBINs will be used only */ -#define JFFS2_DYNRUBIN_DISABLED /* for decompression */ - -#define JFFS2_COMPR_MODE_NONE 0 -#define JFFS2_COMPR_MODE_PRIORITY 1 -#define JFFS2_COMPR_MODE_SIZE 2 - -struct jffs2_compressor { - struct list_head list; - int priority; /* used by prirority comr. mode */ - char *name; - char compr; /* JFFS2_COMPR_XXX */ - int (*compress)(unsigned char *data_in, unsigned char *cpage_out, - uint32_t *srclen, uint32_t *destlen, void *model); - int (*decompress)(unsigned char *cdata_in, unsigned char *data_out, - uint32_t cdatalen, uint32_t datalen, void *model); - int usecount; - int disabled; /* if seted the compressor won't compress */ - unsigned char *compr_buf; /* used by size compr. mode */ - uint32_t compr_buf_size; /* used by size compr. mode */ - uint32_t stat_compr_orig_size; - uint32_t stat_compr_new_size; - uint32_t stat_compr_blocks; - uint32_t stat_decompr_blocks; -}; - -int jffs2_register_compressor(struct jffs2_compressor *comp); -int jffs2_unregister_compressor(struct jffs2_compressor *comp); - -int jffs2_compressors_init(void); -int jffs2_compressors_exit(void); - -uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned char *data_in, unsigned char **cpage_out, - uint32_t *datalen, uint32_t *cdatalen); - -int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - uint16_t comprtype, unsigned char *cdata_in, - unsigned char *data_out, uint32_t cdatalen, uint32_t datalen); - -void jffs2_free_comprbuf(unsigned char *comprbuf, unsigned char *orig); - -#ifdef CONFIG_JFFS2_PROC -int jffs2_enable_compressor_name(const char *name); -int jffs2_disable_compressor_name(const char *name); -int jffs2_set_compression_mode_name(const char *mode_name); -char *jffs2_get_compression_mode_name(void); -int jffs2_set_compressor_priority(const char *mode_name, int priority); -char *jffs2_list_compressors(void); -char *jffs2_stats(void); -#endif - -/* Compressor modules */ -/* These functions will be called by jffs2_compressors_init/exit */ - -#ifdef CONFIG_JFFS2_RUBIN -int jffs2_rubinmips_init(void); -void jffs2_rubinmips_exit(void); -int jffs2_dynrubin_init(void); -void jffs2_dynrubin_exit(void); -#endif -#ifdef CONFIG_JFFS2_RTIME -int jffs2_rtime_init(void); -void jffs2_rtime_exit(void); -#endif -#ifdef CONFIG_JFFS2_ZLIB -int jffs2_zlib_init(void); -void jffs2_zlib_exit(void); -#endif - -#endif /* __JFFS2_COMPR_H__ */ diff --git a/components/dfs/filesystems/jffs2/src/compr_rtime.c b/components/dfs/filesystems/jffs2/src/compr_rtime.c deleted file mode 100644 index c7f6b2914..000000000 --- a/components/dfs/filesystems/jffs2/src/compr_rtime.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by Arjan van de Ven - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: compr_rtime.c,v 1.15 2005/03/17 20:23:06 gleixner Exp $ - * - * - * Very simple lz77-ish encoder. - * - * Theory of operation: Both encoder and decoder have a list of "last - * occurrences" for every possible source-value; after sending the - * first source-byte, the second byte indicated the "run" length of - * matches - * - * The algorithm is intended to only send "whole bytes", no bit-messing. - * - */ - -#include -#include -#include -#include -#include -#include "compr.h" - -/* _compress returns the compressed size, -1 if bigger */ -static int jffs2_rtime_compress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t *sourcelen, uint32_t *dstlen, - void *model) -{ - short positions[256]; - int outpos = 0; - int pos=0; - - memset(positions,0,sizeof(positions)); - - while (pos < (*sourcelen) && outpos <= (*dstlen)-2) { - int backpos, runlen=0; - unsigned char value; - - value = data_in[pos]; - - cpage_out[outpos++] = data_in[pos++]; - - backpos = positions[value]; - positions[value]=pos; - - while ((backpos < pos) && (pos < (*sourcelen)) && - (data_in[pos]==data_in[backpos++]) && (runlen<255)) { - pos++; - runlen++; - } - cpage_out[outpos++] = runlen; - } - - if (outpos >= pos) { - /* We failed */ - return -1; - } - - /* Tell the caller how much we managed to compress, and how much space it took */ - *sourcelen = pos; - *dstlen = outpos; - return 0; -} - - -static int jffs2_rtime_decompress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t srclen, uint32_t destlen, - void *model) -{ - short positions[256]; - int outpos = 0; - int pos=0; - - memset(positions,0,sizeof(positions)); - - while (outpos= outpos) { - while(repeat) { - cpage_out[outpos++] = cpage_out[backoffs++]; - repeat--; - } - } else { - memcpy(&cpage_out[outpos],&cpage_out[backoffs],repeat); - outpos+=repeat; - } - } - } - return 0; -} - -#if defined (__GNUC__) -static struct jffs2_compressor jffs2_rtime_comp = { - .priority = JFFS2_RTIME_PRIORITY, - .name = "rtime", - .compr = JFFS2_COMPR_RTIME, - .compress = &jffs2_rtime_compress, - .decompress = &jffs2_rtime_decompress, -#ifdef JFFS2_RTIME_DISABLED - .disabled = 1, -#else - .disabled = 0, -#endif -}; -#elif defined (MSVC) -static struct jffs2_compressor jffs2_rtime_comp = { - {NULL}, - JFFS2_RTIME_PRIORITY,//.priority = - "rtime",//.name = - JFFS2_COMPR_RTIME,//.compr = - &jffs2_rtime_compress,//.compress = - &jffs2_rtime_decompress,//.decompress = - 0, -#ifdef JFFS2_RTIME_DISABLED - 1,//.disabled = -#else - 0,//.disabled = -#endif - NULL, - 0, - 0, - 0, - 0, - 0 -}; -#else -#endif - -int jffs2_rtime_init(void) -{ - return jffs2_register_compressor(&jffs2_rtime_comp); -} - -void jffs2_rtime_exit(void) -{ - jffs2_unregister_compressor(&jffs2_rtime_comp); -} diff --git a/components/dfs/filesystems/jffs2/src/compr_rubin.c b/components/dfs/filesystems/jffs2/src/compr_rubin.c deleted file mode 100644 index e1030d677..000000000 --- a/components/dfs/filesystems/jffs2/src/compr_rubin.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001, 2002 Red Hat, Inc. - * - * Created by Arjan van de Ven - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: compr_rubin.c,v 1.21 2005/05/20 15:39:54 gleixner Exp $ - * - */ - - -#include -#include -#include -#include "compr_rubin.h" -#include "histo_mips.h" -#include "compr.h" - -static void init_rubin(struct rubin_state *rs, int div, int *bits) -{ - int c; - - rs->q = 0; - rs->p = (long) (2 * UPPER_BIT_RUBIN); - rs->bit_number = (long) 0; - rs->bit_divider = div; - for (c=0; c<8; c++) - rs->bits[c] = bits[c]; -} - - -static int encode(struct rubin_state *rs, long A, long B, int symbol) -{ - - long i0, i1; - int ret; - - while ((rs->q >= UPPER_BIT_RUBIN) || ((rs->p + rs->q) <= UPPER_BIT_RUBIN)) { - rs->bit_number++; - - ret = pushbit(&rs->pp, (rs->q & UPPER_BIT_RUBIN) ? 1 : 0, 0); - if (ret) - return ret; - rs->q &= LOWER_BITS_RUBIN; - rs->q <<= 1; - rs->p <<= 1; - } - i0 = A * rs->p / (A + B); - if (i0 <= 0) { - i0 = 1; - } - if (i0 >= rs->p) { - i0 = rs->p - 1; - } - i1 = rs->p - i0; - - if (symbol == 0) - rs->p = i0; - else { - rs->p = i1; - rs->q += i0; - } - return 0; -} - - -static void end_rubin(struct rubin_state *rs) -{ - - int i; - - for (i = 0; i < RUBIN_REG_SIZE; i++) { - pushbit(&rs->pp, (UPPER_BIT_RUBIN & rs->q) ? 1 : 0, 1); - rs->q &= LOWER_BITS_RUBIN; - rs->q <<= 1; - } -} - - -static void init_decode(struct rubin_state *rs, int div, int *bits) -{ - init_rubin(rs, div, bits); - - /* behalve lower */ - rs->rec_q = 0; - - for (rs->bit_number = 0; rs->bit_number++ < RUBIN_REG_SIZE; rs->rec_q = rs->rec_q * 2 + (long) (pullbit(&rs->pp))) - ; -} - -static void __do_decode(struct rubin_state *rs, unsigned long p, unsigned long q) -{ - register unsigned long lower_bits_rubin = LOWER_BITS_RUBIN; - unsigned long rec_q; - int c, bits = 0; - - /* - * First, work out how many bits we need from the input stream. - * Note that we have already done the initial check on this - * loop prior to calling this function. - */ - do { - bits++; - q &= lower_bits_rubin; - q <<= 1; - p <<= 1; - } while ((q >= UPPER_BIT_RUBIN) || ((p + q) <= UPPER_BIT_RUBIN)); - - rs->p = p; - rs->q = q; - - rs->bit_number += bits; - - /* - * Now get the bits. We really want this to be "get n bits". - */ - rec_q = rs->rec_q; - do { - c = pullbit(&rs->pp); - rec_q &= lower_bits_rubin; - rec_q <<= 1; - rec_q += c; - } while (--bits); - rs->rec_q = rec_q; -} - -static int decode(struct rubin_state *rs, long A, long B) -{ - unsigned long p = rs->p, q = rs->q; - long i0, threshold; - int symbol; - - if (q >= UPPER_BIT_RUBIN || ((p + q) <= UPPER_BIT_RUBIN)) - __do_decode(rs, p, q); - - i0 = A * rs->p / (A + B); - if (i0 <= 0) { - i0 = 1; - } - if (i0 >= rs->p) { - i0 = rs->p - 1; - } - - threshold = rs->q + i0; - symbol = rs->rec_q >= threshold; - if (rs->rec_q >= threshold) { - rs->q += i0; - i0 = rs->p - i0; - } - - rs->p = i0; - - return symbol; -} - - - -static int out_byte(struct rubin_state *rs, unsigned char byte) -{ - int i, ret; - struct rubin_state rs_copy; - rs_copy = *rs; - - for (i=0;i<8;i++) { - ret = encode(rs, rs->bit_divider-rs->bits[i],rs->bits[i],byte&1); - if (ret) { - /* Failed. Restore old state */ - *rs = rs_copy; - return ret; - } - byte=byte>>1; - } - return 0; -} - -static int in_byte(struct rubin_state *rs) -{ - int i, result = 0, bit_divider = rs->bit_divider; - - for (i = 0; i < 8; i++) - result |= decode(rs, bit_divider - rs->bits[i], rs->bits[i]) << i; - - return result; -} - - - -static int rubin_do_compress(int bit_divider, int *bits, unsigned char *data_in, - unsigned char *cpage_out, uint32_t *sourcelen, uint32_t *dstlen) - { - int outpos = 0; - int pos=0; - struct rubin_state rs; - - init_pushpull(&rs.pp, (char *)cpage_out, *dstlen * 8, 0, 32); - - init_rubin(&rs, bit_divider, bits); - - while (pos < (*sourcelen) && !out_byte(&rs, data_in[pos])) - pos++; - - end_rubin(&rs); - - if (outpos > pos) { - /* We failed */ - return -1; - } - - /* Tell the caller how much we managed to compress, - * and how much space it took */ - - outpos = (pushedbits(&rs.pp)+7)/8; - - if (outpos >= pos) - return -1; /* We didn't actually compress */ - *sourcelen = pos; - *dstlen = outpos; - return 0; -} -#if 0 -/* _compress returns the compressed size, -1 if bigger */ -int jffs2_rubinmips_compress(unsigned char *data_in, unsigned char *cpage_out, - uint32_t *sourcelen, uint32_t *dstlen, void *model) -{ - return rubin_do_compress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); -} -#endif -static int jffs2_dynrubin_compress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t *sourcelen, uint32_t *dstlen, - void *model) -{ - int bits[8]; - unsigned char histo[256]; - int i; - int ret; - uint32_t mysrclen, mydstlen; - - mysrclen = *sourcelen; - mydstlen = *dstlen - 8; - - if (*dstlen <= 12) - return -1; - - memset(histo, 0, 256); - for (i=0; i 255) bits[i] = 255; - cpage_out[i] = bits[i]; - } - - ret = rubin_do_compress(256, bits, data_in, cpage_out+8, &mysrclen, &mydstlen); - if (ret) - return ret; - - /* Add back the 8 bytes we took for the probabilities */ - mydstlen += 8; - - if (mysrclen <= mydstlen) { - /* We compressed */ - return -1; - } - - *sourcelen = mysrclen; - *dstlen = mydstlen; - return 0; -} - -static void rubin_do_decompress(int bit_divider, int *bits, unsigned char *cdata_in, - unsigned char *page_out, uint32_t srclen, uint32_t destlen) -{ - int outpos = 0; - struct rubin_state rs; - - init_pushpull(&rs.pp, (char *)cdata_in, srclen, 0, 0); - init_decode(&rs, bit_divider, bits); - - while (outpos < destlen) { - page_out[outpos++] = in_byte(&rs); - } -} - - -static int jffs2_rubinmips_decompress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t sourcelen, uint32_t dstlen, - void *model) -{ - rubin_do_decompress(BIT_DIVIDER_MIPS, bits_mips, data_in, cpage_out, sourcelen, dstlen); - return 0; -} - -static int jffs2_dynrubin_decompress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t sourcelen, uint32_t dstlen, - void *model) -{ - int bits[8]; - int c; - - for (c=0; c<8; c++) - bits[c] = data_in[c]; - - rubin_do_decompress(256, bits, data_in+8, cpage_out, sourcelen-8, dstlen); - return 0; -} - -#if defined (__GNUC__) -static struct jffs2_compressor jffs2_rubinmips_comp = { - .priority = JFFS2_RUBINMIPS_PRIORITY, - .name = "rubinmips", - .compr = JFFS2_COMPR_DYNRUBIN, - .compress = NULL, /*&jffs2_rubinmips_compress,*/ - .decompress = &jffs2_rubinmips_decompress, -#ifdef JFFS2_RUBINMIPS_DISABLED - .disabled = 1, -#else - .disabled = 0, -#endif -}; -#elif defined (MSVC) -static struct jffs2_compressor jffs2_rubinmips_comp = { - {NULL}, - JFFS2_RUBINMIPS_PRIORITY, - "rubinmips", - JFFS2_COMPR_DYNRUBIN, - NULL, /*&jffs2_rubinmips_compress,*/ - &jffs2_rubinmips_decompress, - 0, -#ifdef JFFS2_RUBINMIPS_DISABLED - 1, -#else - 0, -#endif - NULL, - 0, - 0, - 0, - 0, - 0 -}; -#else -#endif - -int jffs2_rubinmips_init(void) -{ - return jffs2_register_compressor(&jffs2_rubinmips_comp); -} - -void jffs2_rubinmips_exit(void) -{ - jffs2_unregister_compressor(&jffs2_rubinmips_comp); -} - -#if defined (__GNUC__) -static struct jffs2_compressor jffs2_dynrubin_comp = { - .priority = JFFS2_DYNRUBIN_PRIORITY, - .name = "dynrubin", - .compr = JFFS2_COMPR_RUBINMIPS, - .compress = jffs2_dynrubin_compress, - .decompress = &jffs2_dynrubin_decompress, -#ifdef JFFS2_DYNRUBIN_DISABLED - .disabled = 1, -#else - .disabled = 0, -#endif -}; -#elif defined (MSVC) -static struct jffs2_compressor jffs2_dynrubin_comp = { - {NULL}, - JFFS2_DYNRUBIN_PRIORITY, - "dynrubin", - JFFS2_COMPR_RUBINMIPS, - jffs2_dynrubin_compress, - &jffs2_dynrubin_decompress, - 0, -#ifdef JFFS2_DYNRUBIN_DISABLED - 1, -#else - 0, -#endif - NULL, - 0, - 0, - 0, - 0, - 0 -}; -#else -#endif - -int jffs2_dynrubin_init(void) -{ - return jffs2_register_compressor(&jffs2_dynrubin_comp); -} - -void jffs2_dynrubin_exit(void) -{ - jffs2_unregister_compressor(&jffs2_dynrubin_comp); -} diff --git a/components/dfs/filesystems/jffs2/src/compr_rubin.h b/components/dfs/filesystems/jffs2/src/compr_rubin.h deleted file mode 100644 index cf51e34f6..000000000 --- a/components/dfs/filesystems/jffs2/src/compr_rubin.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Rubin encoder/decoder header */ -/* work started at : aug 3, 1994 */ -/* last modification : aug 15, 1994 */ -/* $Id: compr_rubin.h,v 1.6 2002/01/25 01:49:26 dwmw2 Exp $ */ - -#include "pushpull.h" - -#define RUBIN_REG_SIZE 16 -#define UPPER_BIT_RUBIN (((long) 1)<<(RUBIN_REG_SIZE-1)) -#define LOWER_BITS_RUBIN ((((long) 1)<<(RUBIN_REG_SIZE-1))-1) - - -struct rubin_state { - unsigned long p; - unsigned long q; - unsigned long rec_q; - long bit_number; - struct pushpull pp; - int bit_divider; - int bits[8]; -}; diff --git a/components/dfs/filesystems/jffs2/src/compr_zlib.c b/components/dfs/filesystems/jffs2/src/compr_zlib.c deleted file mode 100644 index 7fe18e088..000000000 --- a/components/dfs/filesystems/jffs2/src/compr_zlib.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: compr_zlib.c,v 1.31 2005/05/20 19:30:06 gleixner Exp $ - * - */ -#include "jffs2_config.h" -#if !defined(__KERNEL__) && !defined(__ECOS) -#error "The userspace support got too messy and was removed. Update your mkfs.jffs2" -#endif - -#include -#include -#include -#include -#include -#include -#include "nodelist.h" -#include "compr.h" - - /* Plan: call deflate() with avail_in == *sourcelen, - avail_out = *dstlen - 12 and flush == Z_FINISH. - If it doesn't manage to finish, call it again with - avail_in == 0 and avail_out set to the remaining 12 - bytes for it to clean up. - Q: Is 12 bytes sufficient? - */ -#define STREAM_END_SPACE 12 - -static DECLARE_MUTEX(deflate_sem); -static DECLARE_MUTEX(inflate_sem); -static z_stream inf_strm, def_strm; - -#ifdef __KERNEL__ /* Linux-only */ -#include -#include - -static int __init alloc_workspaces(void) -{ - def_strm.workspace = vmalloc(zlib_deflate_workspacesize()); - if (!def_strm.workspace) { - printk(KERN_WARNING "Failed to allocate %d bytes for deflate workspace\n", zlib_deflate_workspacesize()); - return -ENOMEM; - } - D1(printk(KERN_DEBUG "Allocated %d bytes for deflate workspace\n", zlib_deflate_workspacesize())); - inf_strm.workspace = vmalloc(zlib_inflate_workspacesize()); - if (!inf_strm.workspace) { - printk(KERN_WARNING "Failed to allocate %d bytes for inflate workspace\n", zlib_inflate_workspacesize()); - vfree(def_strm.workspace); - return -ENOMEM; - } - D1(printk(KERN_DEBUG "Allocated %d bytes for inflate workspace\n", zlib_inflate_workspacesize())); - return 0; -} - -static void free_workspaces(void) -{ - vfree(def_strm.workspace); - vfree(inf_strm.workspace); -} -#else -#define alloc_workspaces() (0) -#define free_workspaces() do { } while(0) -#endif /* __KERNEL__ */ - -static int jffs2_zlib_compress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t *sourcelen, uint32_t *dstlen, - void *model) -{ - int ret; - - if (*dstlen <= STREAM_END_SPACE) - return -1; - - down(&deflate_sem); - - if (Z_OK != zlib_deflateInit(&def_strm, 3)) { - printk(KERN_WARNING "deflateInit failed\n"); - up(&deflate_sem); - return -1; - } - - def_strm.next_in = data_in; - def_strm.total_in = 0; - - def_strm.next_out = cpage_out; - def_strm.total_out = 0; - - while (def_strm.total_out < *dstlen - STREAM_END_SPACE && def_strm.total_in < *sourcelen) { - def_strm.avail_out = *dstlen - (def_strm.total_out + STREAM_END_SPACE); - def_strm.avail_in = min((unsigned)(*sourcelen-def_strm.total_in), def_strm.avail_out); - D1(printk(KERN_DEBUG "calling deflate with avail_in %d, avail_out %d\n", - def_strm.avail_in, def_strm.avail_out)); - ret = zlib_deflate(&def_strm, Z_PARTIAL_FLUSH); - D1(printk(KERN_DEBUG "deflate returned with avail_in %d, avail_out %d, total_in %ld, total_out %ld\n", - def_strm.avail_in, def_strm.avail_out, def_strm.total_in, def_strm.total_out)); - if (ret != Z_OK) { - D1(printk(KERN_DEBUG "deflate in loop returned %d\n", ret)); - zlib_deflateEnd(&def_strm); - up(&deflate_sem); - return -1; - } - } - def_strm.avail_out += STREAM_END_SPACE; - def_strm.avail_in = 0; - ret = zlib_deflate(&def_strm, Z_FINISH); - zlib_deflateEnd(&def_strm); - - if (ret != Z_STREAM_END) { - D1(printk(KERN_DEBUG "final deflate returned %d\n", ret)); - ret = -1; - goto out; - } - - if (def_strm.total_out >= def_strm.total_in) { - D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld; failing\n", - def_strm.total_in, def_strm.total_out)); - ret = -1; - goto out; - } - - D1(printk(KERN_DEBUG "zlib compressed %ld bytes into %ld\n", - def_strm.total_in, def_strm.total_out)); - - *dstlen = def_strm.total_out; - *sourcelen = def_strm.total_in; - ret = 0; - out: - up(&deflate_sem); - return ret; -} - -static int jffs2_zlib_decompress(unsigned char *data_in, - unsigned char *cpage_out, - uint32_t srclen, uint32_t destlen, - void *model) -{ - int ret; - int wbits = MAX_WBITS; - - down(&inflate_sem); - - inf_strm.next_in = data_in; - inf_strm.avail_in = srclen; - inf_strm.total_in = 0; - - inf_strm.next_out = cpage_out; - inf_strm.avail_out = destlen; - inf_strm.total_out = 0; - - /* If it's deflate, and it's got no preset dictionary, then - we can tell zlib to skip the adler32 check. */ - if (srclen > 2 && !(data_in[1] & PRESET_DICT) && - ((data_in[0] & 0x0f) == Z_DEFLATED) && - !(((data_in[0]<<8) + data_in[1]) % 31)) { - - D2(printk(KERN_DEBUG "inflate skipping adler32\n")); - wbits = -((data_in[0] >> 4) + 8); - inf_strm.next_in += 2; - inf_strm.avail_in -= 2; - } else { - /* Let this remain D1 for now -- it should never happen */ - D1(printk(KERN_DEBUG "inflate not skipping adler32\n")); - } - - - if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { - printk(KERN_WARNING "inflateInit failed\n"); - up(&inflate_sem); - return 1; - } - - while((ret = zlib_inflate(&inf_strm, Z_FINISH)) == Z_OK) - ; - if (ret != Z_STREAM_END) { - printk(KERN_NOTICE "inflate returned %d\n", ret); - } - zlib_inflateEnd(&inf_strm); - up(&inflate_sem); - return 0; -} - -#if defined (__GNUC__) -static struct jffs2_compressor jffs2_zlib_comp = { - .priority = JFFS2_ZLIB_PRIORITY, - .name = "zlib", - .compr = JFFS2_COMPR_ZLIB, - .compress = &jffs2_zlib_compress, - .decompress = &jffs2_zlib_decompress, -#ifdef JFFS2_ZLIB_DISABLED - .disabled = 1, -#else - .disabled = 0, -#endif -}; -#elif defined (MSVC) -static struct jffs2_compressor jffs2_zlib_comp = { - {NULL}, - JFFS2_ZLIB_PRIORITY,//.priority = - "zlib",//.name = - JFFS2_COMPR_ZLIB,//.compr = - &jffs2_zlib_compress,//.compress = - &jffs2_zlib_decompress,//.decompress = - 0, -#ifdef JFFS2_ZLIB_DISABLED - 1,//.disabled = -#else - 0,//.disabled = -#endif - NULL, - 0, - 0, - 0, - 0, - 0 -}; -#else -#endif - -int __init jffs2_zlib_init(void) -{ - int ret; - - ret = alloc_workspaces(); - if (ret) - return ret; - - ret = jffs2_register_compressor(&jffs2_zlib_comp); - if (ret) - free_workspaces(); - - return ret; -} - -void jffs2_zlib_exit(void) -{ - jffs2_unregister_compressor(&jffs2_zlib_comp); - free_workspaces(); -} diff --git a/components/dfs/filesystems/jffs2/src/debug.c b/components/dfs/filesystems/jffs2/src/debug.c deleted file mode 100644 index 3a7c5ea6f..000000000 --- a/components/dfs/filesystems/jffs2/src/debug.c +++ /dev/null @@ -1,711 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: debug.c,v 1.1 2005/07/30 15:30:42 asl Exp $ - * - */ -#include -#include -#include -#include -#include -#include -#include "nodelist.h" -#include "debug.h" - -#ifdef JFFS2_DBG_PARANOIA_CHECKS -/* - * Check the fragtree. - */ -void -__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f) -{ - down(&f->sem); - __jffs2_dbg_fragtree_paranoia_check_nolock(f); - up(&f->sem); -} - -void -__jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f) -{ - struct jffs2_node_frag *frag; - int bitched = 0; - - for (frag = frag_first(&f->fragtree); frag; frag = frag_next(frag)) { - struct jffs2_full_dnode *fn = frag->node; - - if (!fn || !fn->raw) - continue; - - if (ref_flags(fn->raw) == REF_PRISTINE) { - if (fn->frags > 1) { - JFFS2_ERROR("REF_PRISTINE node at 0x%08x had %d frags. Tell dwmw2.\n", - ref_offset(fn->raw), fn->frags); - bitched = 1; - } - - /* A hole node which isn't multi-page should be garbage-collected - and merged anyway, so we just check for the frag size here, - rather than mucking around with actually reading the node - and checking the compression type, which is the real way - to tell a hole node. */ - if (frag->ofs & (PAGE_CACHE_SIZE-1) && frag_prev(frag) - && frag_prev(frag)->size < PAGE_CACHE_SIZE && frag_prev(frag)->node) { - JFFS2_ERROR("REF_PRISTINE node at 0x%08x had a previous non-hole frag " - "in the same page. Tell dwmw2.\n", ref_offset(fn->raw)); - bitched = 1; - } - - if ((frag->ofs+frag->size) & (PAGE_CACHE_SIZE-1) && frag_next(frag) - && frag_next(frag)->size < PAGE_CACHE_SIZE && frag_next(frag)->node) { - JFFS2_ERROR("REF_PRISTINE node at 0x%08x (%08x-%08x) had a following " - "non-hole frag in the same page. Tell dwmw2.\n", - ref_offset(fn->raw), frag->ofs, frag->ofs+frag->size); - bitched = 1; - } - } - } - - if (bitched) { - JFFS2_ERROR("fragtree is corrupted.\n"); - __jffs2_dbg_dump_fragtree_nolock(f); - BUG(); - } -} - -/* - * Check if the flash contains all 0xFF before we start writing. - */ -void -__jffs2_dbg_prewrite_paranoia_check(struct jffs2_sb_info *c, - uint32_t ofs, int len) -{ - size_t retlen; - int ret, i; - unsigned char *buf; - - buf = kmalloc(len, GFP_KERNEL); - if (!buf) - return; - - ret = jffs2_flash_read(c, ofs, len, &retlen, buf); - if (ret || (retlen != len)) { - JFFS2_WARNING("read %d bytes failed or short. ret %d, retlen %zd.\n", - len, ret, retlen); - kfree(buf); - return; - } - - ret = 0; - for (i = 0; i < len; i++) - if (buf[i] != 0xff) - ret = 1; - - if (ret) { - JFFS2_ERROR("argh, about to write node to %#08x on flash, but there are data " - "already there. The first corrupted byte is at %#08x offset.\n", ofs, ofs + i); - __jffs2_dbg_dump_buffer(buf, len, ofs); - kfree(buf); - BUG(); - } - - kfree(buf); -} - -/* - * Check the space accounting and node_ref list correctness for the JFFS2 erasable block 'jeb'. - */ -void -__jffs2_dbg_acct_paranoia_check(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - spin_lock(&c->erase_completion_lock); - __jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - spin_unlock(&c->erase_completion_lock); -} - -void -__jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - uint32_t my_used_size = 0; - uint32_t my_unchecked_size = 0; - uint32_t my_dirty_size = 0; - struct jffs2_raw_node_ref *ref2 = jeb->first_node; - - while (ref2) { - uint32_t totlen = ref_totlen(c, jeb, ref2); - - if (ref2->flash_offset < jeb->offset || - ref2->flash_offset > jeb->offset + c->sector_size) { - JFFS2_ERROR("node_ref %#08x shouldn't be in block at %#08x.\n", - ref_offset(ref2), jeb->offset); - goto error; - - } - if (ref_flags(ref2) == REF_UNCHECKED) - my_unchecked_size += totlen; - else if (!ref_obsolete(ref2)) - my_used_size += totlen; - else - my_dirty_size += totlen; - - if ((!ref2->next_phys) != (ref2 == jeb->last_node)) { - JFFS2_ERROR("node_ref for node at %#08x (mem %p) has next_phys at %#08x (mem %p), " - "last_node is at %#08x (mem %p).\n", - ref_offset(ref2), ref2, ref_offset(ref2->next_phys), ref2->next_phys, - ref_offset(jeb->last_node), jeb->last_node); - goto error; - } - ref2 = ref2->next_phys; - } - - if (my_used_size != jeb->used_size) { - JFFS2_ERROR("Calculated used size %#08x != stored used size %#08x.\n", - my_used_size, jeb->used_size); - goto error; - } - - if (my_unchecked_size != jeb->unchecked_size) { - JFFS2_ERROR("Calculated unchecked size %#08x != stored unchecked size %#08x.\n", - my_unchecked_size, jeb->unchecked_size); - goto error; - } - -#if 0 - /* This should work when we implement ref->__totlen elemination */ - if (my_dirty_size != jeb->dirty_size + jeb->wasted_size) { - JFFS2_ERROR("Calculated dirty+wasted size %#08x != stored dirty + wasted size %#08x\n", - my_dirty_size, jeb->dirty_size + jeb->wasted_size); - goto error; - } - - if (jeb->free_size == 0 - && my_used_size + my_unchecked_size + my_dirty_size != c->sector_size) { - JFFS2_ERROR("The sum of all nodes in block (%#x) != size of block (%#x)\n", - my_used_size + my_unchecked_size + my_dirty_size, - c->sector_size); - goto error; - } -#endif - - return; - -error: - __jffs2_dbg_dump_node_refs_nolock(c, jeb); - __jffs2_dbg_dump_jeb_nolock(jeb); - __jffs2_dbg_dump_block_lists_nolock(c); - BUG(); - -} -#endif /* JFFS2_DBG_PARANOIA_CHECKS */ - -#if defined(JFFS2_DBG_DUMPS) || defined(JFFS2_DBG_PARANOIA_CHECKS) -/* - * Dump the node_refs of the 'jeb' JFFS2 eraseblock. - */ -void -__jffs2_dbg_dump_node_refs(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - spin_lock(&c->erase_completion_lock); - __jffs2_dbg_dump_node_refs_nolock(c, jeb); - spin_unlock(&c->erase_completion_lock); -} - -void -__jffs2_dbg_dump_node_refs_nolock(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - struct jffs2_raw_node_ref *ref; - int i = 0; - - JFFS2_DEBUG("Dump node_refs of the eraseblock %#08x\n", jeb->offset); - if (!jeb->first_node) { - JFFS2_DEBUG("no nodes in the eraseblock %#08x\n", jeb->offset); - return; - } - - printk(JFFS2_DBG_LVL); - for (ref = jeb->first_node; ; ref = ref->next_phys) { - printk("%#08x(%#x)", ref_offset(ref), ref->__totlen); - if (ref->next_phys) - printk("->"); - else - break; - if (++i == 4) { - i = 0; - printk("\n" JFFS2_DBG_LVL); - } - } - printk("\n"); -} - -/* - * Dump an eraseblock's space accounting. - */ -void -__jffs2_dbg_dump_jeb(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) -{ - spin_lock(&c->erase_completion_lock); - __jffs2_dbg_dump_jeb_nolock(jeb); - spin_unlock(&c->erase_completion_lock); -} - -void -__jffs2_dbg_dump_jeb_nolock(struct jffs2_eraseblock *jeb) -{ - if (!jeb) - return; - - JFFS2_DEBUG("dump space accounting for the eraseblock at %#08x:\n", - jeb->offset); - - printk(JFFS2_DBG_LVL "used_size: %#08x\n", jeb->used_size); - printk(JFFS2_DBG_LVL "dirty_size: %#08x\n", jeb->dirty_size); - printk(JFFS2_DBG_LVL "wasted_size: %#08x\n", jeb->wasted_size); - printk(JFFS2_DBG_LVL "unchecked_size: %#08x\n", jeb->unchecked_size); - printk(JFFS2_DBG_LVL "free_size: %#08x\n", jeb->free_size); -} - -void -__jffs2_dbg_dump_block_lists(struct jffs2_sb_info *c) -{ - spin_lock(&c->erase_completion_lock); - __jffs2_dbg_dump_block_lists_nolock(c); - spin_unlock(&c->erase_completion_lock); -} - -void -__jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c) -{ - JFFS2_DEBUG("dump JFFS2 blocks lists:\n"); - - printk(JFFS2_DBG_LVL "flash_size: %#08x\n", c->flash_size); - printk(JFFS2_DBG_LVL "used_size: %#08x\n", c->used_size); - printk(JFFS2_DBG_LVL "dirty_size: %#08x\n", c->dirty_size); - printk(JFFS2_DBG_LVL "wasted_size: %#08x\n", c->wasted_size); - printk(JFFS2_DBG_LVL "unchecked_size: %#08x\n", c->unchecked_size); - printk(JFFS2_DBG_LVL "free_size: %#08x\n", c->free_size); - printk(JFFS2_DBG_LVL "erasing_size: %#08x\n", c->erasing_size); - printk(JFFS2_DBG_LVL "bad_size: %#08x\n", c->bad_size); - printk(JFFS2_DBG_LVL "sector_size: %#08x\n", c->sector_size); - printk(JFFS2_DBG_LVL "jffs2_reserved_blocks size: %#08x\n", - c->sector_size * c->resv_blocks_write); - - if (c->nextblock) - printk(JFFS2_DBG_LVL "nextblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - c->nextblock->offset, c->nextblock->used_size, - c->nextblock->dirty_size, c->nextblock->wasted_size, - c->nextblock->unchecked_size, c->nextblock->free_size); - else - printk(JFFS2_DBG_LVL "nextblock: NULL\n"); - - if (c->gcblock) - printk(JFFS2_DBG_LVL "gcblock: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - c->gcblock->offset, c->gcblock->used_size, c->gcblock->dirty_size, - c->gcblock->wasted_size, c->gcblock->unchecked_size, c->gcblock->free_size); - else - printk(JFFS2_DBG_LVL "gcblock: NULL\n"); - - if (list_empty(&c->clean_list)) { - printk(JFFS2_DBG_LVL "clean_list: empty\n"); - } else { - struct list_head *this; - int numblocks = 0; - uint32_t dirty = 0; - - list_for_each(this, &c->clean_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - numblocks ++; - dirty += jeb->wasted_size; - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "clean_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - - printk (JFFS2_DBG_LVL "Contains %d blocks with total wasted size %u, average wasted size: %u\n", - numblocks, dirty, dirty / numblocks); - } - - if (list_empty(&c->very_dirty_list)) { - printk(JFFS2_DBG_LVL "very_dirty_list: empty\n"); - } else { - struct list_head *this; - int numblocks = 0; - uint32_t dirty = 0; - - list_for_each(this, &c->very_dirty_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - numblocks ++; - dirty += jeb->dirty_size; - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "very_dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - - printk (JFFS2_DBG_LVL "Contains %d blocks with total dirty size %u, average dirty size: %u\n", - numblocks, dirty, dirty / numblocks); - } - - if (list_empty(&c->dirty_list)) { - printk(JFFS2_DBG_LVL "dirty_list: empty\n"); - } else { - struct list_head *this; - int numblocks = 0; - uint32_t dirty = 0; - - list_for_each(this, &c->dirty_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - numblocks ++; - dirty += jeb->dirty_size; - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "dirty_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - - printk (JFFS2_DBG_LVL "contains %d blocks with total dirty size %u, average dirty size: %u\n", - numblocks, dirty, dirty / numblocks); - } - - if (list_empty(&c->erasable_list)) { - printk(JFFS2_DBG_LVL "erasable_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->erasable_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "erasable_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->erasing_list)) { - printk(JFFS2_DBG_LVL "erasing_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->erasing_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "erasing_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->erase_pending_list)) { - printk(JFFS2_DBG_LVL "erase_pending_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->erase_pending_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "erase_pending_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->erasable_pending_wbuf_list)) { - printk(JFFS2_DBG_LVL "erasable_pending_wbuf_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->erasable_pending_wbuf_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "erasable_pending_wbuf_list: %#08x (used %#08x, dirty %#08x, " - "wasted %#08x, unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->free_list)) { - printk(JFFS2_DBG_LVL "free_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->free_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "free_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->bad_list)) { - printk(JFFS2_DBG_LVL "bad_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->bad_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "bad_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } - - if (list_empty(&c->bad_used_list)) { - printk(JFFS2_DBG_LVL "bad_used_list: empty\n"); - } else { - struct list_head *this; - - list_for_each(this, &c->bad_used_list) { - struct jffs2_eraseblock *jeb = list_entry(this, struct jffs2_eraseblock, list); - - if (!(jeb->used_size == 0 && jeb->dirty_size == 0 && jeb->wasted_size == 0)) { - printk(JFFS2_DBG_LVL "bad_used_list: %#08x (used %#08x, dirty %#08x, wasted %#08x, " - "unchecked %#08x, free %#08x)\n", - jeb->offset, jeb->used_size, jeb->dirty_size, jeb->wasted_size, - jeb->unchecked_size, jeb->free_size); - } - } - } -} - -void -__jffs2_dbg_dump_fragtree(struct jffs2_inode_info *f) -{ - down(&f->sem); - jffs2_dbg_dump_fragtree_nolock(f); - up(&f->sem); -} - -void -__jffs2_dbg_dump_fragtree_nolock(struct jffs2_inode_info *f) -{ - struct jffs2_node_frag *this = frag_first(&f->fragtree); - uint32_t lastofs = 0; - int buggy = 0; - - JFFS2_DEBUG("dump fragtree of ino #%u\n", f->inocache->ino); - while(this) { - if (this->node) - printk(JFFS2_DBG_LVL "frag %#04x-%#04x: %#08x(%d) on flash (*%p), left (%p), " - "right (%p), parent (%p)\n", - this->ofs, this->ofs+this->size, ref_offset(this->node->raw), - ref_flags(this->node->raw), this, frag_left(this), frag_right(this), - frag_parent(this)); - else - printk(JFFS2_DBG_LVL "frag %#04x-%#04x: hole (*%p). left (%p), right (%p), parent (%p)\n", - this->ofs, this->ofs+this->size, this, frag_left(this), - frag_right(this), frag_parent(this)); - if (this->ofs != lastofs) - buggy = 1; - lastofs = this->ofs + this->size; - this = frag_next(this); - } - - if (f->metadata) - printk(JFFS2_DBG_LVL "metadata at 0x%08x\n", ref_offset(f->metadata->raw)); - - if (buggy) { - JFFS2_ERROR("frag tree got a hole in it.\n"); - BUG(); - } -} - -#define JFFS2_BUFDUMP_BYTES_PER_LINE 32 -void -__jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs) -{ - int skip; - int i; - - JFFS2_DEBUG("dump from offset %#08x to offset %#08x (%x bytes).\n", - offs, offs + len, len); - i = skip = offs % JFFS2_BUFDUMP_BYTES_PER_LINE; - offs = offs & ~(JFFS2_BUFDUMP_BYTES_PER_LINE - 1); - - if (skip != 0) - printk(JFFS2_DBG_LVL "%#08x: ", offs); - - while (skip--) - printk(" "); - - while (i < len) { - if ((i % JFFS2_BUFDUMP_BYTES_PER_LINE) == 0 && i != len -1) { - if (i != 0) - printk("\n"); - offs += JFFS2_BUFDUMP_BYTES_PER_LINE; - printk(JFFS2_DBG_LVL "%0#8x: ", offs); - } - - printk("%02x ", buf[i]); - - i += 1; - } - - printk("\n"); -} - -/* - * Dump a JFFS2 node. - */ -void -__jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs) -{ - union jffs2_node_union node; - int len = sizeof(union jffs2_node_union); - size_t retlen; - uint32_t crc; - int ret; - - JFFS2_DEBUG("dump node at offset %#08x.\n", ofs); - - ret = jffs2_flash_read(c, ofs, len, &retlen, (unsigned char *)&node); - if (ret || (retlen != len)) { - JFFS2_ERROR("read %d bytes failed or short. ret %d, retlen %zd.\n", - len, ret, retlen); - return; - } - - printk(JFFS2_DBG_LVL "magic:\t%#04x\n", - je16_to_cpu(node.u.magic)); - printk(JFFS2_DBG_LVL "nodetype:\t%#04x\n", - je16_to_cpu(node.u.nodetype)); - printk(JFFS2_DBG_LVL "totlen:\t%#08x\n", - je32_to_cpu(node.u.totlen)); - printk(JFFS2_DBG_LVL "hdr_crc:\t%#08x\n", - je32_to_cpu(node.u.hdr_crc)); - - crc = crc32(0, &node.u, sizeof(node.u) - 4); - if (crc != je32_to_cpu(node.u.hdr_crc)) { - JFFS2_ERROR("wrong common header CRC.\n"); - return; - } - - if (je16_to_cpu(node.u.magic) != JFFS2_MAGIC_BITMASK && - je16_to_cpu(node.u.magic) != JFFS2_OLD_MAGIC_BITMASK) - { - JFFS2_ERROR("wrong node magic: %#04x instead of %#04x.\n", - je16_to_cpu(node.u.magic), JFFS2_MAGIC_BITMASK); - return; - } - - switch(je16_to_cpu(node.u.nodetype)) { - - case JFFS2_NODETYPE_INODE: - - printk(JFFS2_DBG_LVL "the node is inode node\n"); - printk(JFFS2_DBG_LVL "ino:\t%#08x\n", - je32_to_cpu(node.i.ino)); - printk(JFFS2_DBG_LVL "version:\t%#08x\n", - je32_to_cpu(node.i.version)); - printk(JFFS2_DBG_LVL "mode:\t%#08x\n", - node.i.mode.m); - printk(JFFS2_DBG_LVL "uid:\t%#04x\n", - je16_to_cpu(node.i.uid)); - printk(JFFS2_DBG_LVL "gid:\t%#04x\n", - je16_to_cpu(node.i.gid)); - printk(JFFS2_DBG_LVL "isize:\t%#08x\n", - je32_to_cpu(node.i.isize)); - printk(JFFS2_DBG_LVL "atime:\t%#08x\n", - je32_to_cpu(node.i.atime)); - printk(JFFS2_DBG_LVL "mtime:\t%#08x\n", - je32_to_cpu(node.i.mtime)); - printk(JFFS2_DBG_LVL "ctime:\t%#08x\n", - je32_to_cpu(node.i.ctime)); - printk(JFFS2_DBG_LVL "offset:\t%#08x\n", - je32_to_cpu(node.i.offset)); - printk(JFFS2_DBG_LVL "csize:\t%#08x\n", - je32_to_cpu(node.i.csize)); - printk(JFFS2_DBG_LVL "dsize:\t%#08x\n", - je32_to_cpu(node.i.dsize)); - printk(JFFS2_DBG_LVL "compr:\t%#02x\n", - node.i.compr); - printk(JFFS2_DBG_LVL "usercompr:\t%#02x\n", - node.i.usercompr); - printk(JFFS2_DBG_LVL "flags:\t%#04x\n", - je16_to_cpu(node.i.flags)); - printk(JFFS2_DBG_LVL "data_crc:\t%#08x\n", - je32_to_cpu(node.i.data_crc)); - printk(JFFS2_DBG_LVL "node_crc:\t%#08x\n", - je32_to_cpu(node.i.node_crc)); - crc = crc32(0, &node.i, sizeof(node.i) - 8); - if (crc != je32_to_cpu(node.i.node_crc)) { - JFFS2_ERROR("wrong node header CRC.\n"); - return; - } - break; - - case JFFS2_NODETYPE_DIRENT: - - printk(JFFS2_DBG_LVL "the node is dirent node\n"); - printk(JFFS2_DBG_LVL "pino:\t%#08x\n", - je32_to_cpu(node.d.pino)); - printk(JFFS2_DBG_LVL "version:\t%#08x\n", - je32_to_cpu(node.d.version)); - printk(JFFS2_DBG_LVL "ino:\t%#08x\n", - je32_to_cpu(node.d.ino)); - printk(JFFS2_DBG_LVL "mctime:\t%#08x\n", - je32_to_cpu(node.d.mctime)); - printk(JFFS2_DBG_LVL "nsize:\t%#02x\n", - node.d.nsize); - printk(JFFS2_DBG_LVL "type:\t%#02x\n", - node.d.type); - printk(JFFS2_DBG_LVL "node_crc:\t%#08x\n", - je32_to_cpu(node.d.node_crc)); - printk(JFFS2_DBG_LVL "name_crc:\t%#08x\n", - je32_to_cpu(node.d.name_crc)); - - node.d.name[node.d.nsize] = '\0'; - printk(JFFS2_DBG_LVL "name:\t\"%s\"\n", node.d.name); - - crc = crc32(0, &node.d, sizeof(node.d) - 8); - if (crc != je32_to_cpu(node.d.node_crc)) { - JFFS2_ERROR("wrong node header CRC.\n"); - return; - } - break; - - default: - printk(JFFS2_DBG_LVL "node type is unknown\n"); - break; - } -} -#endif /* JFFS2_DBG_DUMPS || JFFS2_DBG_PARANOIA_CHECKS */ diff --git a/components/dfs/filesystems/jffs2/src/debug.h b/components/dfs/filesystems/jffs2/src/debug.h deleted file mode 100644 index 652f59068..000000000 --- a/components/dfs/filesystems/jffs2/src/debug.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: debug.h,v 1.1 2005/07/30 15:30:42 asl Exp $ - * - */ -#ifndef _JFFS2_DEBUG_H_ -#define _JFFS2_DEBUG_H_ -#include "jffs2_config.h" -#include - -#ifndef CONFIG_JFFS2_FS_DEBUG -#define CONFIG_JFFS2_FS_DEBUG 0 -#endif - -#if CONFIG_JFFS2_FS_DEBUG == 1 -/* Enable "paranoia" checks and dumps */ -#define JFFS2_DBG_PARANOIA_CHECKS -#define JFFS2_DBG_DUMPS -#define JFFS2_DBG_READINODE_MESSAGES -#define JFFS2_DBG_FRAGTREE_MESSAGES -#define JFFS2_DBG_DENTLIST_MESSAGES -#define JFFS2_DBG_NODEREF_MESSAGES -#define JFFS2_DBG_INOCACHE_MESSAGES -#endif - -#if CONFIG_JFFS2_FS_DEBUG == 2 -#define JFFS2_DBG_FRAGTREE2_MESSAGES -#endif - -/* Enable JFFS2 sanity checks by default */ -#define JFFS2_DBG_SANITY_CHECKS - -/* - * Dx() are mainly used for debugging messages, they must go away and be - * superseded by nicer JFFS2_DBG_XXX() macros... - */ -#if CONFIG_JFFS2_FS_DEBUG > 0 -#define D1(x) x -#else -#define D1(x) -#endif - -#if CONFIG_JFFS2_FS_DEBUG > 1 -#define D2(x) x -#else -#define D2(x) -#endif - -/* The prefixes of JFFS2 messages */ -#define JFFS2_DBG_MSG_PREFIX "[JFFS2 DBG]" -#define JFFS2_ERR_MSG_PREFIX "JFFS2 error: " -#define JFFS2_WARN_MSG_PREFIX "JFFS2 warning: " -#define JFFS2_NOTICE_MSG_PREFIX "JFFS2 notice: " - -#define JFFS2_ERR_LVL KERN_ERR -#define JFFS2_WARN_LVL KERN_WARNING -#define JFFS2_NOTICE_LVL KERN_NOTICE -#define JFFS2_DBG_LVL KERN_DEBUG - -/* JFFS2 message macros */ -#define JFFS2_ERROR(fmt, ...) \ - do { \ - printk(JFFS2_ERR_LVL JFFS2_ERR_MSG_PREFIX " %s: " \ - fmt, __FUNCTION__, ##__VA_ARGS__); \ - } while(0) - -#define JFFS2_WARNING(fmt, ...) \ - do { \ - printk(JFFS2_WARN_LVL JFFS2_WARN_MSG_PREFIX " %s: " \ - fmt, __FUNCTION__, ##__VA_ARGS__); \ - } while(0) - -#define JFFS2_NOTICE(fmt, ...) \ - do { \ - printk(JFFS2_NOTICE_LVL JFFS2_NOTICE_MSG_PREFIX " %s: " \ - fmt, __FUNCTION__, ##__VA_ARGS__); \ - } while(0) - -#define JFFS2_DEBUG(fmt, ...) \ - do { \ - printk(JFFS2_DBG_LVL JFFS2_DBG_MSG_PREFIX " %s: " \ - fmt, __FUNCTION__, ##__VA_ARGS__); \ - } while(0) - -/* - * We split our debugging messages on several parts, depending on the JFFS2 - * subsystem the message belongs to. - */ -/* Read inode debugging messages */ -#ifdef JFFS2_DBG_READINODE_MESSAGES -#define JFFS2_DBG_READINODE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_READINODE(fmt, ...) -#endif - -/* Fragtree build debugging messages */ -#ifdef JFFS2_DBG_FRAGTREE_MESSAGES -#define JFFS2_DBG_FRAGTREE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_FRAGTREE(fmt, ...) -#endif - -/* Directory entry list manilulation debugging messages */ -#ifdef JFFS2_DBG_DENTLIST_MESSAGES -#define JFFS2_DBG_DENTLIST(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_DENTLIST(fmt, ...) -#endif -#ifdef JFFS2_DBG_FRAGTREE2_MESSAGES -#define JFFS2_DBG_FRAGTREE2(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_FRAGTREE2(fmt, ...) -#endif - -/* Print the messages about manipulating node_refs */ -#ifdef JFFS2_DBG_NODEREF_MESSAGES -#define JFFS2_DBG_NODEREF(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_NODEREF(fmt, ...) -#endif - -/* Manipulations with the list of inodes (JFFS2 inocache) */ -#ifdef JFFS2_DBG_INOCACHE_MESSAGES -#define JFFS2_DBG_INOCACHE(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_INOCACHE(fmt, ...) -#endif - -/* Watch the object allocations */ -#ifdef JFFS2_DBG_MEMALLOC_MESSAGES -#define JFFS2_DBG_MEMALLOC(fmt, ...) JFFS2_DEBUG(fmt, ##__VA_ARGS__) -#else -#define JFFS2_DBG_MEMALLOC(fmt, ...) -#endif - - -/* "Paranoia" checks */ -void -__jffs2_dbg_fragtree_paranoia_check(struct jffs2_inode_info *f); -void -__jffs2_dbg_fragtree_paranoia_check_nolock(struct jffs2_inode_info *f); -void -__jffs2_dbg_acct_paranoia_check(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_acct_paranoia_check_nolock(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_prewrite_paranoia_check(struct jffs2_sb_info *c, - uint32_t ofs, int len); - -/* "Dump" functions */ -void -__jffs2_dbg_dump_jeb(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_dump_jeb_nolock(struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_dump_block_lists(struct jffs2_sb_info *c); -void -__jffs2_dbg_dump_block_lists_nolock(struct jffs2_sb_info *c); -void -__jffs2_dbg_dump_node_refs(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_dump_node_refs_nolock(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb); -void -__jffs2_dbg_dump_fragtree(struct jffs2_inode_info *f); -void -__jffs2_dbg_dump_fragtree_nolock(struct jffs2_inode_info *f); -void -__jffs2_dbg_dump_buffer(unsigned char *buf, int len, uint32_t offs); -void -__jffs2_dbg_dump_node(struct jffs2_sb_info *c, uint32_t ofs); - -#ifdef JFFS2_DBG_PARANOIA_CHECKS -#define jffs2_dbg_fragtree_paranoia_check(f) \ - __jffs2_dbg_fragtree_paranoia_check(f) -#define jffs2_dbg_fragtree_paranoia_check_nolock(f) \ - __jffs2_dbg_fragtree_paranoia_check_nolock(f) -#define jffs2_dbg_acct_paranoia_check(c, jeb) \ - __jffs2_dbg_acct_paranoia_check(c,jeb) -#define jffs2_dbg_acct_paranoia_check_nolock(c, jeb) \ - __jffs2_dbg_acct_paranoia_check_nolock(c,jeb) -#define jffs2_dbg_prewrite_paranoia_check(c, ofs, len) \ - __jffs2_dbg_prewrite_paranoia_check(c, ofs, len) -#else -#define jffs2_dbg_fragtree_paranoia_check(f) -#define jffs2_dbg_fragtree_paranoia_check_nolock(f) -#define jffs2_dbg_acct_paranoia_check(c, jeb) -#define jffs2_dbg_acct_paranoia_check_nolock(c, jeb) -#define jffs2_dbg_prewrite_paranoia_check(c, ofs, len) -#endif /* !JFFS2_PARANOIA_CHECKS */ - -#ifdef JFFS2_DBG_DUMPS -#define jffs2_dbg_dump_jeb(c, jeb) \ - __jffs2_dbg_dump_jeb(c, jeb); -#define jffs2_dbg_dump_jeb_nolock(jeb) \ - __jffs2_dbg_dump_jeb_nolock(jeb); -#define jffs2_dbg_dump_block_lists(c) \ - __jffs2_dbg_dump_block_lists(c) -#define jffs2_dbg_dump_block_lists_nolock(c) \ - __jffs2_dbg_dump_block_lists_nolock(c) -#define jffs2_dbg_dump_fragtree(f) \ - __jffs2_dbg_dump_fragtree(f); -#define jffs2_dbg_dump_fragtree_nolock(f) \ - __jffs2_dbg_dump_fragtree_nolock(f); -#define jffs2_dbg_dump_buffer(buf, len, offs) \ - __jffs2_dbg_dump_buffer(*buf, len, offs); -#define jffs2_dbg_dump_node(c, ofs) \ - __jffs2_dbg_dump_node(c, ofs); -#else -#define jffs2_dbg_dump_jeb(c, jeb) -#define jffs2_dbg_dump_jeb_nolock(jeb) -#define jffs2_dbg_dump_block_lists(c) -#define jffs2_dbg_dump_block_lists_nolock(c) -#define jffs2_dbg_dump_fragtree(f) -#define jffs2_dbg_dump_fragtree_nolock(f) -#define jffs2_dbg_dump_buffer(buf, len, offs) -#define jffs2_dbg_dump_node(c, ofs) -#endif /* !JFFS2_DBG_DUMPS */ - -/* - * Sanity checks are supposed to be light-weight and enabled by default. - */ -#ifdef JFFS2_DBG_SANITY_CHECKS -/* - * Check the space accounting of the file system and of - * the JFFS2 erasable block 'jeb'. - */ -static inline void -jffs2_dbg_acct_sanity_check_nolock(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - if (unlikely(jeb && jeb->used_size + jeb->dirty_size + - jeb->free_size + jeb->wasted_size + - jeb->unchecked_size != c->sector_size)) { - JFFS2_ERROR("eeep, space accounting for block at 0x%08x is screwed.\n", jeb->offset); - JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + wasted %#08x + unchecked " - "%#08x != total %#08x.\n", jeb->free_size, jeb->dirty_size, jeb->used_size, - jeb->wasted_size, jeb->unchecked_size, c->sector_size); - BUG(); - } - - if (unlikely(c->used_size + c->dirty_size + c->free_size + c->erasing_size + c->bad_size - + c->wasted_size + c->unchecked_size != c->flash_size)) { - JFFS2_ERROR("eeep, space accounting superblock info is screwed.\n"); - JFFS2_ERROR("free %#08x + dirty %#08x + used %#08x + erasing %#08x + bad %#08x + " - "wasted %#08x + unchecked %#08x != total %#08x.\n", - c->free_size, c->dirty_size, c->used_size, c->erasing_size, c->bad_size, - c->wasted_size, c->unchecked_size, c->flash_size); - BUG(); - } -} - -static inline void -jffs2_dbg_acct_sanity_check(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - spin_lock(&c->erase_completion_lock); - jffs2_dbg_acct_sanity_check_nolock(c, jeb); - spin_unlock(&c->erase_completion_lock); -} -#else -#define jffs2_dbg_acct_sanity_check(c, jeb) -#define jffs2_dbg_acct_sanity_check_nolock(c, jeb) -#endif /* !JFFS2_DBG_SANITY_CHECKS */ - -#endif /* _JFFS2_DEBUG_H_ */ diff --git a/components/dfs/filesystems/jffs2/src/dir-ecos.c b/components/dfs/filesystems/jffs2/src/dir-ecos.c deleted file mode 100644 index b52b89928..000000000 --- a/components/dfs/filesystems/jffs2/src/dir-ecos.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Free Software Foundation, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: dir-ecos.c,v 1.11 2005/02/08 19:36:27 lunn Exp $ - * - */ - -#include -#include -#include "nodelist.h" - -/***********************************************************************/ - -/* Takes length argument because it can be either NUL-terminated or '/'-terminated */ -struct _inode *jffs2_lookup(struct _inode *dir_i, const unsigned char *d_name, int namelen) -{ - struct jffs2_inode_info *dir_f; - struct jffs2_full_dirent *fd = NULL, *fd_list; - uint32_t ino = 0; - uint32_t hash = full_name_hash(d_name, namelen); - struct _inode *inode = NULL; - - D1(printk("jffs2_lookup()\n")); - - dir_f = JFFS2_INODE_INFO(dir_i); - - down(&dir_f->sem); - - /* NB: The 2.2 backport will need to explicitly check for '.' and '..' here */ - for (fd_list = dir_f->dents; fd_list && fd_list->nhash <= hash; fd_list = fd_list->next) { - if (fd_list->nhash == hash && - (!fd || fd_list->version > fd->version) && - strlen((char *)fd_list->name) == namelen && - !strncmp((char *)fd_list->name, (char *)d_name, namelen)) { - fd = fd_list; - } - } - if (fd) - ino = fd->ino; - up(&dir_f->sem); - if (ino) { - inode = jffs2_iget(dir_i->i_sb, ino); - if (IS_ERR(inode)) { - printk("jffs2_iget() failed for ino #%u\n", ino); - return inode; - } - } - - return inode; -} - -/***********************************************************************/ - - - -int jffs2_create(struct _inode *dir_i, const unsigned char *d_name, int mode, - struct _inode **new_i) -{ - struct jffs2_raw_inode *ri; - struct jffs2_inode_info *f, *dir_f; - struct jffs2_sb_info *c; - struct _inode *inode; - int ret; - - ri = jffs2_alloc_raw_inode(); - if (!ri) - return -ENOMEM; - - c = JFFS2_SB_INFO(dir_i->i_sb); - - D1(printk(KERN_DEBUG "jffs2_create()\n")); - - inode = jffs2_new_inode(dir_i, mode, ri); - - if (IS_ERR(inode)) { - D1(printk(KERN_DEBUG "jffs2_new_inode() failed\n")); - jffs2_free_raw_inode(ri); - return PTR_ERR(inode); - } - - f = JFFS2_INODE_INFO(inode); - dir_f = JFFS2_INODE_INFO(dir_i); - - ret = jffs2_do_create(c, dir_f, f, ri, - (const char *)d_name, - strlen((char *)d_name)); - - if (ret) { - inode->i_nlink = 0; - jffs2_iput(inode); - jffs2_free_raw_inode(ri); - return ret; - } - - jffs2_free_raw_inode(ri); - - D1(printk(KERN_DEBUG "jffs2_create: Created ino #%lu with mode %o, nlink %d(%d)\n", - inode->i_ino, inode->i_mode, inode->i_nlink, f->inocache->nlink)); - *new_i = inode; - return 0; -} - -/***********************************************************************/ - - -int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name) -{ - struct jffs2_sb_info *c = JFFS2_SB_INFO(dir_i->i_sb); - struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); - struct jffs2_inode_info *dead_f = JFFS2_INODE_INFO(d_inode); - int ret; - - ret = jffs2_do_unlink(c, dir_f, (const char *)d_name, - strlen((char *)d_name), dead_f); - if (dead_f->inocache) - d_inode->i_nlink = dead_f->inocache->nlink; - return ret; -} -/***********************************************************************/ - - -int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned char *d_name) -{ - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_d_inode->i_sb); - struct jffs2_inode_info *f = JFFS2_INODE_INFO(old_d_inode); - struct jffs2_inode_info *dir_f = JFFS2_INODE_INFO(dir_i); - int ret; - - /* XXX: This is ugly */ - uint8_t type = (old_d_inode->i_mode & S_IFMT) >> 12; - if (!type) type = DT_REG; - - ret = jffs2_do_link(c, dir_f, f->inocache->ino, type, - (const char * )d_name, - strlen((char *)d_name)); - - if (!ret) { - down(&f->sem); - old_d_inode->i_nlink = ++f->inocache->nlink; - up(&f->sem); - } - return ret; -} - -int jffs2_mkdir (struct _inode *dir_i, const unsigned char *d_name, int mode) -{ - struct jffs2_inode_info *f, *dir_f; - struct jffs2_sb_info *c; - struct _inode *inode; - struct jffs2_raw_inode *ri; - struct jffs2_raw_dirent *rd; - struct jffs2_full_dnode *fn; - struct jffs2_full_dirent *fd; - int namelen; - uint32_t alloclen, phys_ofs; - int ret; - - mode |= S_IFDIR; - - ri = jffs2_alloc_raw_inode(); - if (!ri) - return -ENOMEM; - - c = JFFS2_SB_INFO(dir_i->i_sb); - - /* Try to reserve enough space for both node and dirent. - * Just the node will do for now, though - */ - namelen = strlen((char *)d_name); - ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); - - if (ret) { - jffs2_free_raw_inode(ri); - return ret; - } - - inode = jffs2_new_inode(dir_i, mode, ri); - - if (IS_ERR(inode)) { - jffs2_free_raw_inode(ri); - jffs2_complete_reservation(c); - return PTR_ERR(inode); - } - - f = JFFS2_INODE_INFO(inode); - - ri->data_crc = cpu_to_je32(0); - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - - fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL); - - jffs2_free_raw_inode(ri); - - if (IS_ERR(fn)) { - /* Eeek. Wave bye bye */ - up(&f->sem); - jffs2_complete_reservation(c); - inode->i_nlink = 0; - jffs2_iput(inode); - return PTR_ERR(fn); - } - /* No data here. Only a metadata node, which will be - obsoleted by the first data write - */ - f->metadata = fn; - up(&f->sem); - - jffs2_complete_reservation(c); - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); - if (ret) { - /* Eep. */ - inode->i_nlink = 0; - jffs2_iput(inode); - return ret; - } - - rd = jffs2_alloc_raw_dirent(); - if (!rd) { - /* Argh. Now we treat it like a normal delete */ - jffs2_complete_reservation(c); - inode->i_nlink = 0; - jffs2_iput(inode); - return -ENOMEM; - } - - dir_f = JFFS2_INODE_INFO(dir_i); - down(&dir_f->sem); - - rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); - rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); - rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); - - rd->pino = cpu_to_je32(dir_i->i_ino); - rd->version = cpu_to_je32(++dir_f->highest_version); - rd->ino = cpu_to_je32(inode->i_ino); - rd->mctime = cpu_to_je32(jffs2_get_timestamp()); - rd->nsize = namelen; - rd->type = DT_DIR; - rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); - rd->name_crc = cpu_to_je32(crc32(0, d_name, namelen)); - - fd = jffs2_write_dirent(c, dir_f, rd, d_name, namelen, phys_ofs, ALLOC_NORMAL); - - jffs2_complete_reservation(c); - jffs2_free_raw_dirent(rd); - - if (IS_ERR(fd)) { - /* dirent failed to write. Delete the inode normally - as if it were the final unlink() */ - up(&dir_f->sem); - inode->i_nlink = 0; - jffs2_iput(inode); - return PTR_ERR(fd); - } - - /* Link the fd into the inode's list, obsoleting an old - one if necessary. */ - jffs2_add_fd_to_list(c, fd, &dir_f->dents); - up(&dir_f->sem); - - jffs2_iput(inode); - return 0; -} - -int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name) -{ - struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode); - struct jffs2_full_dirent *fd; - - for (fd = f->dents ; fd; fd = fd->next) { - if (fd->ino) - return EPERM; //-ENOTEMPTY; - } - return jffs2_unlink(dir_i, d_inode, d_name); -} - -int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsigned char *old_d_name, - struct _inode *new_dir_i, const unsigned char *new_d_name) -{ - int ret; - struct jffs2_sb_info *c = JFFS2_SB_INFO(old_dir_i->i_sb); - struct jffs2_inode_info *victim_f = NULL; - uint8_t type; - -#if 0 /* FIXME -- this really doesn't belong in individual file systems. - The fileio code ought to do this for us, or at least part of it */ - if (new_dentry->d_inode) { - if (S_ISDIR(d_inode->i_mode) && - !S_ISDIR(new_dentry->d_inode->i_mode)) { - /* Cannot rename directory over non-directory */ - return -EINVAL; - } - - victim_f = JFFS2_INODE_INFO(new_dentry->d_inode); - - if (S_ISDIR(new_dentry->d_inode->i_mode)) { - struct jffs2_full_dirent *fd; - - if (!S_ISDIR(d_inode->i_mode)) { - /* Cannot rename non-directory over directory */ - return -EINVAL; - } - down(&victim_f->sem); - for (fd = victim_f->dents; fd; fd = fd->next) { - if (fd->ino) { - up(&victim_f->sem); - return -ENOTEMPTY; - } - } - up(&victim_f->sem); - } - } -#endif - - /* XXX: We probably ought to alloc enough space for - both nodes at the same time. Writing the new link, - then getting -ENOSPC, is quite bad :) - */ - - /* Make a hard link */ - - /* XXX: This is ugly */ - type = (d_inode->i_mode & S_IFMT) >> 12; - if (!type) type = DT_REG; - - ret = jffs2_do_link(c, JFFS2_INODE_INFO(new_dir_i), - d_inode->i_ino, type, - (const char *)new_d_name, - strlen((char *)new_d_name)); - - if (ret) - return ret; - - if (victim_f) { - /* There was a victim. Kill it off nicely */ - /* Don't oops if the victim was a dirent pointing to an - inode which didn't exist. */ - if (victim_f->inocache) { - down(&victim_f->sem); - victim_f->inocache->nlink--; - up(&victim_f->sem); - } - } - - /* Unlink the original */ - ret = jffs2_do_unlink(c, JFFS2_INODE_INFO(old_dir_i), - (const char *)old_d_name, - strlen((char *)old_d_name), NULL); - - if (ret) { - /* Oh shit. We really ought to make a single node which can do both atomically */ - struct jffs2_inode_info *f = JFFS2_INODE_INFO(d_inode); - down(&f->sem); - if (f->inocache) - d_inode->i_nlink = f->inocache->nlink++; - up(&f->sem); - - printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); - } - return ret; -} - diff --git a/components/dfs/filesystems/jffs2/src/dir.txt b/components/dfs/filesystems/jffs2/src/dir.txt deleted file mode 100644 index 93767aa2b..000000000 --- a/components/dfs/filesystems/jffs2/src/dir.txt +++ /dev/null @@ -1,70 +0,0 @@ -Îļþ¼Ð PATH Áбí -¾íÐòÁкÅΪ 00000200 38BE:1B05 -F:. -jffs2/dfs_jffs2.c -jffs2/porting.c - -adler32.c - -compress.c -configure -deflate.c - -example.c - -gzio.c - -infback.c -infblock.c - -inffast.c - - -inflate.c - -inftrees.c - -infutil.c - - - - -maketree.c - -minigzip.c - - -trees.c - -uncompr.c - -zutil.c - - -jffs2/crc/crcd -jffs2/crc/crc16.c -jffs2/crc/crc32.c -jffs2/crc/posix_crc.c - -jffs2/kernel/rbtree.c - -jffs2/src/build.c -jffs2/src/compr.c -jffs2/src/compr_rtime.c -jffs2/src/compr_rubin.c -jffs2/src/compr_zlib.c -jffs2/src/debug.c -jffs2/src/dir-ecos.c -jffs2/src/erase.c -jffs2/src/flashio.c -jffs2/src/fs-ecos.c -jffs2/src/gc.c -jffs2/src/gcthread.c -jffs2/src/malloc-ecos.c -jffs2/src/nodelist.c -jffs2/src/nodemgmt.c -jffs2/src/read.c -jffs2/src/readinode.c -jffs2/src/scan.c -jffs2/src/write.c - diff --git a/components/dfs/filesystems/jffs2/src/erase.c b/components/dfs/filesystems/jffs2/src/erase.c deleted file mode 100644 index 3844e1d38..000000000 --- a/components/dfs/filesystems/jffs2/src/erase.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: erase.c,v 1.83 2005/07/22 10:32:08 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" - -struct erase_priv_struct { - struct jffs2_eraseblock *jeb; - struct jffs2_sb_info *c; -}; - -#ifndef __ECOS -static void jffs2_erase_callback(struct erase_info *); -#endif -static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_offset); -static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); - -static void jffs2_erase_block(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb) -{ - int ret; - uint32_t bad_offset; -#ifdef __ECOS - ret = jffs2_flash_erase(c, jeb); - if (!ret) { - jffs2_erase_succeeded(c, jeb); - return; - } - bad_offset = jeb->offset; -#else /* Linux */ - struct erase_info *instr; - - D1(printk(KERN_DEBUG "jffs2_erase_block(): erase block %#08x (range %#08x-%#08x)\n", - jeb->offset, jeb->offset, jeb->offset + c->sector_size)); - instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL); - if (!instr) { - printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); - spin_lock(&c->erase_completion_lock); - list_del(&jeb->list); - list_add(&jeb->list, &c->erase_pending_list); - c->erasing_size -= c->sector_size; - c->dirty_size += c->sector_size; - jeb->dirty_size = c->sector_size; - spin_unlock(&c->erase_completion_lock); - return; - } - - memset(instr, 0, sizeof(*instr)); - - instr->mtd = c->mtd; - instr->addr = jeb->offset; - instr->len = c->sector_size; - instr->callback = jffs2_erase_callback; - instr->priv = (unsigned long)(&instr[1]); - instr->fail_addr = 0xffffffff; - - ((struct erase_priv_struct *)instr->priv)->jeb = jeb; - ((struct erase_priv_struct *)instr->priv)->c = c; - - ret = c->mtd->erase(c->mtd, instr); - if (!ret) - return; - - bad_offset = instr->fail_addr; - kfree(instr); -#endif /* __ECOS */ - - if (ret == -ENOMEM || ret == -EAGAIN) { - /* Erase failed immediately. Refile it on the list */ - D1(printk(KERN_DEBUG "Erase at 0x%08x failed: %d. Refiling on erase_pending_list\n", jeb->offset, ret)); - spin_lock(&c->erase_completion_lock); - list_del(&jeb->list); - list_add(&jeb->list, &c->erase_pending_list); - c->erasing_size -= c->sector_size; - c->dirty_size += c->sector_size; - jeb->dirty_size = c->sector_size; - spin_unlock(&c->erase_completion_lock); - return; - } - - if (ret == -EROFS) - printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset); - else - printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret); - - jffs2_erase_failed(c, jeb, bad_offset); -} - -void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count) -{ - struct jffs2_eraseblock *jeb; - - down(&c->erase_free_sem); - - spin_lock(&c->erase_completion_lock); - - while (!list_empty(&c->erase_complete_list) || - !list_empty(&c->erase_pending_list)) { - - if (!list_empty(&c->erase_complete_list)) { - jeb = list_entry(c->erase_complete_list.next, struct jffs2_eraseblock, list); - list_del(&jeb->list); - spin_unlock(&c->erase_completion_lock); - jffs2_mark_erased_block(c, jeb); - - if (!--count) { - D1(printk(KERN_DEBUG "Count reached. jffs2_erase_pending_blocks leaving\n")); - goto done; - } - - } else if (!list_empty(&c->erase_pending_list)) { - jeb = list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list); - D1(printk(KERN_DEBUG "Starting erase of pending block 0x%08x\n", jeb->offset)); - list_del(&jeb->list); - c->erasing_size += c->sector_size; - c->wasted_size -= jeb->wasted_size; - c->free_size -= jeb->free_size; - c->used_size -= jeb->used_size; - c->dirty_size -= jeb->dirty_size; - jeb->wasted_size = jeb->used_size = jeb->dirty_size = jeb->free_size = 0; - jffs2_free_all_node_refs(c, jeb); - list_add(&jeb->list, &c->erasing_list); - spin_unlock(&c->erase_completion_lock); - - jffs2_erase_block(c, jeb); - - } else { - BUG(); - } - - /* Be nice */ - cond_resched(); - spin_lock(&c->erase_completion_lock); - } - - spin_unlock(&c->erase_completion_lock); - done: - D1(printk(KERN_DEBUG "jffs2_erase_pending_blocks completed\n")); - - up(&c->erase_free_sem); -} - -static void jffs2_erase_succeeded(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) -{ - D1(printk(KERN_DEBUG "Erase completed successfully at 0x%08x\n", jeb->offset)); - spin_lock(&c->erase_completion_lock); - list_del(&jeb->list); - list_add_tail(&jeb->list, &c->erase_complete_list); - spin_unlock(&c->erase_completion_lock); - /* Ensure that kupdated calls us again to mark them clean */ - jffs2_erase_pending_trigger(c); -} - -static void jffs2_erase_failed(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t bad_offset) -{ - /* For NAND, if the failure did not occur at the device level for a - specific physical page, don't bother updating the bad block table. */ - if (jffs2_cleanmarker_oob(c) && (bad_offset != 0xffffffff)) { - /* We had a device-level failure to erase. Let's see if we've - failed too many times. */ - if (!jffs2_write_nand_badblock(c, jeb, bad_offset)) { - /* We'd like to give this block another try. */ - spin_lock(&c->erase_completion_lock); - list_del(&jeb->list); - list_add(&jeb->list, &c->erase_pending_list); - c->erasing_size -= c->sector_size; - c->dirty_size += c->sector_size; - jeb->dirty_size = c->sector_size; - spin_unlock(&c->erase_completion_lock); - return; - } - } - - spin_lock(&c->erase_completion_lock); - c->erasing_size -= c->sector_size; - c->bad_size += c->sector_size; - list_del(&jeb->list); - list_add(&jeb->list, &c->bad_list); - c->nr_erasing_blocks--; - spin_unlock(&c->erase_completion_lock); - wake_up(&c->erase_wait); -} - -#ifndef __ECOS -static void jffs2_erase_callback(struct erase_info *instr) -{ - struct erase_priv_struct *priv = (void *)instr->priv; - - if(instr->state != MTD_ERASE_DONE) { - printk(KERN_WARNING "Erase at 0x%08x finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", instr->addr, instr->state); - jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr); - } else { - jffs2_erase_succeeded(priv->c, priv->jeb); - } - kfree(instr); -} -#endif /* !__ECOS */ - -/* Hmmm. Maybe we should accept the extra space it takes and make - this a standard doubly-linked list? */ -static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, - struct jffs2_raw_node_ref *ref, struct jffs2_eraseblock *jeb) -{ - struct jffs2_inode_cache *ic = NULL; - struct jffs2_raw_node_ref **prev; - - prev = &ref->next_in_ino; - - /* Walk the inode's list once, removing any nodes from this eraseblock */ - while (1) { - if (!(*prev)->next_in_ino) { - /* We're looking at the jffs2_inode_cache, which is - at the end of the linked list. Stash it and continue - from the beginning of the list */ - ic = (struct jffs2_inode_cache *)(*prev); - prev = &ic->nodes; - continue; - } - - if (SECTOR_ADDR((*prev)->flash_offset) == jeb->offset) { - /* It's in the block we're erasing */ - struct jffs2_raw_node_ref *this; - - this = *prev; - *prev = this->next_in_ino; - this->next_in_ino = NULL; - - if (this == ref) - break; - - continue; - } - /* Not to be deleted. Skip */ - prev = &((*prev)->next_in_ino); - } - - /* PARANOIA */ - if (!ic) { - printk(KERN_WARNING "inode_cache not found in remove_node_refs()!!\n"); - return; - } - - D1(printk(KERN_DEBUG "Removed nodes in range 0x%08x-0x%08x from ino #%u\n", - jeb->offset, jeb->offset + c->sector_size, ic->ino)); - - D2({ - int i=0; - struct jffs2_raw_node_ref *this; - printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG); - - this = ic->nodes; - - while(this) { - printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this)); - if (++i == 5) { - printk("\n" KERN_DEBUG); - i=0; - } - this = this->next_in_ino; - } - printk("\n"); - }); - - if (ic->nodes == (void *)ic && ic->nlink == 0) - jffs2_del_ino_cache(c, ic); -} - -static void jffs2_free_all_node_refs(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb) -{ - struct jffs2_raw_node_ref *ref; - D1(printk(KERN_DEBUG "Freeing all node refs for eraseblock offset 0x%08x\n", jeb->offset)); - while(jeb->first_node) { - ref = jeb->first_node; - jeb->first_node = ref->next_phys; - - /* Remove from the inode-list */ - if (ref->next_in_ino) - jffs2_remove_node_refs_from_ino_list(c, ref, jeb); - /* else it was a non-inode node or already removed, so don't bother */ - - jffs2_free_raw_node_ref(ref); - } - jeb->last_node = NULL; -} - -static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, uint32_t *bad_offset) -{ - void *ebuf; - uint32_t ofs; - size_t retlen; - int ret = -EIO; - - ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL); - if (!ebuf) { - printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset); - return -EAGAIN; - } - - D1(printk(KERN_DEBUG "Verifying erase at 0x%08x\n", jeb->offset)); - - for (ofs = jeb->offset; ofs < jeb->offset + c->sector_size; ) { - uint32_t readlen = min((uint32_t)PAGE_SIZE, jeb->offset + c->sector_size - ofs); - int i; - - *bad_offset = ofs; - - ret = jffs2_flash_read(c, ofs, readlen, &retlen, ebuf); - if (ret) { - printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); - goto fail; - } - if (retlen != readlen) { - printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen); - goto fail; - } - for (i=0; ioffset)); - bad_offset = jeb->offset; - - /* Cleanmarker in oob area or no cleanmarker at all ? */ - if (jffs2_cleanmarker_oob(c) || c->cleanmarker_size == 0) { - - if (jffs2_cleanmarker_oob(c)) { - if (jffs2_write_nand_cleanmarker(c, jeb)) - goto filebad; - } - - jeb->first_node = jeb->last_node = NULL; - jeb->free_size = c->sector_size; - jeb->used_size = 0; - jeb->dirty_size = 0; - jeb->wasted_size = 0; - - } else { - - struct kvec vecs[1]; - #if defined (__GNUC__) - struct jffs2_unknown_node marker = { - .magic = cpu_to_je16(JFFS2_MAGIC_BITMASK), - .nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), - .totlen = cpu_to_je32(c->cleanmarker_size) - }; - #elif defined (MSVC) - struct jffs2_unknown_node marker = { - cpu_to_je16(JFFS2_MAGIC_BITMASK), - cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER), - cpu_to_je32(c->cleanmarker_size), - 0 - }; - #else - #endif - - marker_ref = jffs2_alloc_raw_node_ref(); - if (!marker_ref) { - printk(KERN_WARNING "Failed to allocate raw node ref for clean marker. Refiling\n"); - goto refile; - } - - marker.hdr_crc = cpu_to_je32(crc32(0, &marker, sizeof(struct jffs2_unknown_node)-4)); - - vecs[0].iov_base = (unsigned char *) ▮ - vecs[0].iov_len = sizeof(marker); - ret = jffs2_flash_direct_writev(c, vecs, 1, jeb->offset, &retlen); - - if (ret || retlen != sizeof(marker)) { - if (ret) - printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", - jeb->offset, ret); - else - printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n", - jeb->offset, sizeof(marker), retlen); - - jffs2_free_raw_node_ref(marker_ref); - goto filebad; - } - - marker_ref->next_in_ino = NULL; - marker_ref->next_phys = NULL; - marker_ref->flash_offset = jeb->offset | REF_NORMAL; - marker_ref->__totlen = c->cleanmarker_size; - - jeb->first_node = jeb->last_node = marker_ref; - - jeb->free_size = c->sector_size - c->cleanmarker_size; - jeb->used_size = c->cleanmarker_size; - jeb->dirty_size = 0; - jeb->wasted_size = 0; - } - - spin_lock(&c->erase_completion_lock); - c->erasing_size -= c->sector_size; - c->free_size += jeb->free_size; - c->used_size += jeb->used_size; - - jffs2_dbg_acct_sanity_check_nolock(c,jeb); - jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - - list_add_tail(&jeb->list, &c->free_list); - c->nr_erasing_blocks--; - c->nr_free_blocks++; - spin_unlock(&c->erase_completion_lock); - wake_up(&c->erase_wait); - return; - -filebad: - spin_lock(&c->erase_completion_lock); - /* Stick it on a list (any list) so erase_failed can take it - right off again. Silly, but shouldn't happen often. */ - list_add(&jeb->list, &c->erasing_list); - spin_unlock(&c->erase_completion_lock); - jffs2_erase_failed(c, jeb, bad_offset); - return; - -refile: - /* Stick it back on the list from whence it came and come back later */ - jffs2_erase_pending_trigger(c); - spin_lock(&c->erase_completion_lock); - list_add(&jeb->list, &c->erase_complete_list); - spin_unlock(&c->erase_completion_lock); - return; -} diff --git a/components/dfs/filesystems/jffs2/src/flashio.c b/components/dfs/filesystems/jffs2/src/flashio.c deleted file mode 100644 index 37c332de7..000000000 --- a/components/dfs/filesystems/jffs2/src/flashio.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by Dominic Ostrowski - * Contributors: David Woodhouse, Nick Garnett, Richard Panton. - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: flashio.c,v 1.1 2003/11/26 14:09:29 dwmw2 Exp $ - * - */ - -#include -#include "nodelist.h" -#include - -int jffs2_flash_read(struct jffs2_sb_info * c, cyg_uint32 offset, - const size_t size, - size_t * return_size, - unsigned char *buffer) -{ - uint32_t len; - struct super_block *sb = OFNI_BS_2SFFJ(c); - - len = rt_mtd_nor_read(RT_MTD_NOR_DEVICE(sb->s_dev), offset, buffer, size); - if (len != size) - return -EIO; - - * return_size = len; - return ENOERR; -} - -int jffs2_flash_write(struct jffs2_sb_info * c, - cyg_uint32 offset, const size_t size, - size_t * return_size, unsigned char *buffer) -{ - uint32_t len; - struct super_block *sb = OFNI_BS_2SFFJ(c); - - len = rt_mtd_nor_write(RT_MTD_NOR_DEVICE(sb->s_dev), offset, buffer, size); - if (len != size) - return -EIO; - - * return_size = len; - return ENOERR; -} - -int jffs2_flash_erase(struct jffs2_sb_info * c, - struct jffs2_eraseblock * jeb) -{ - rt_err_t result; - struct super_block *sb = OFNI_BS_2SFFJ(c); - - result = rt_mtd_nor_erase_block(RT_MTD_NOR_DEVICE(sb->s_dev), jeb->offset, c->sector_size); - if (result != RT_EOK) - return -EIO; - - return ENOERR; -} - -int jffs2_flash_direct_writev(struct jffs2_sb_info *c, - const struct iovec *vecs, unsigned long count, loff_t to, - size_t * retlen) -{ - unsigned long i; - size_t totlen = 0, thislen; - int ret = 0; - - for (i = 0; i < count; i++) - { - // writes need to be aligned but the data we're passed may not be - // Observation suggests most unaligned writes are small, so we - // optimize for that case. - - if (((vecs[i].iov_len & (sizeof(int) - 1))) || - (((unsigned long) vecs[i].iov_base & (sizeof(unsigned long) - 1)))) - { - // are there iov's after this one? Or is it so much we'd need - // to do multiple writes anyway? - if ((i + 1) < count || vecs[i].iov_len > 256) - { - // cop out and malloc - unsigned long j; - ssize_t sizetomalloc = 0, totvecsize = 0; - char *cbuf, *cbufptr; - - for (j = i; j < count; j++) - totvecsize += vecs[j].iov_len; - - // pad up in case unaligned - sizetomalloc = totvecsize + sizeof(int) - 1; - sizetomalloc &= ~(sizeof(int) - 1); - cbuf = (char *) rt_malloc(sizetomalloc); - // malloc returns aligned memory - if (!cbuf) - { - ret = -ENOMEM; - goto writev_out; - } - cbufptr = cbuf; - for (j = i; j < count; j++) - { - memcpy(cbufptr, vecs[j].iov_base, vecs[j].iov_len); - cbufptr += vecs[j].iov_len; - } - //rt_kprintf("direct_write: offset %d, size %d\n", to, sizetomalloc); - ret = jffs2_flash_write(c, to, sizetomalloc, &thislen, - (unsigned char *) cbuf); - if (thislen > totvecsize) // in case it was aligned up - thislen = totvecsize; - totlen += thislen; - rt_free(cbuf); - goto writev_out; - } - else - { - // otherwise optimize for the common case - int buf[256/sizeof(int)]; // int, so int aligned - size_t lentowrite; - - lentowrite = vecs[i].iov_len; - // pad up in case its unaligned - lentowrite += sizeof(int) - 1; - lentowrite &= ~(sizeof(int) - 1); - memcpy(buf, vecs[i].iov_base, lentowrite); - - //rt_kprintf("direct_write: offset %d, size %d\n", to, lentowrite); - ret = jffs2_flash_write(c, to, lentowrite, &thislen, - (unsigned char *) &buf); - if (thislen > vecs[i].iov_len) - thislen = vecs[i].iov_len; - } - } - else - { - //rt_kprintf("direct_writev: offset %d, size %d\n", to, vecs[i].iov_len); - ret = jffs2_flash_write(c, to, vecs[i].iov_len, &thislen, - vecs[i].iov_base); - } - totlen += thislen; - if (ret || thislen != vecs[i].iov_len) break; - to += vecs[i].iov_len; - } - -writev_out: - if (retlen) *retlen = totlen; - - return ret; -} diff --git a/components/dfs/filesystems/jffs2/src/fs-ecos.c b/components/dfs/filesystems/jffs2/src/fs-ecos.c deleted file mode 100644 index 814d2e301..000000000 --- a/components/dfs/filesystems/jffs2/src/fs-ecos.c +++ /dev/null @@ -1,2174 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Free Software Foundation, Inc. - * - * Created by Dominic Ostrowski - * Contributors: David Woodhouse, Nick Garnett, Richard Panton. - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: fs-ecos.c,v 1.44 2005/07/24 15:29:57 dedekind Exp $ - * - */ - -#include //prife for SEEK_SET SEEK_CUR SEEK_END -#include -#include "nodelist.h" -#include -#include -#include "compr.h" -#include - -#include - -//-------------------------------------------- -cyg_mtab_entry *cyg_cdir_mtab_entry = NULL; -cyg_dir cyg_cdir_dir = CYG_DIR_NULL; -//========================================================================== -// Default functions - -__externC int cyg_fileio_enosys() { return ENOSYS; } -__externC int cyg_fileio_erofs() { return EROFS; } -__externC int cyg_fileio_enoerr() { return ENOERR; } -__externC int cyg_fileio_enotdir() { return ENOTDIR; } - -__externC cyg_bool cyg_fileio_seltrue (struct CYG_FILE_TAG *fp, int which, CYG_ADDRWORD info) -{ return 1; } - -//-------------------------------------------- -//========================================================================== -// Forward definitions - -// Filesystem operations -int jffs2_mount(cyg_fstab_entry * fste, cyg_mtab_entry * mte); -static int jffs2_umount(cyg_mtab_entry * mte); -int jffs2_open(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int mode, cyg_file * fte); -#ifdef CYGOPT_FS_JFFS2_WRITE -static int jffs2_ops_unlink(cyg_mtab_entry * mte, cyg_dir dir, - const char *name); -static int jffs2_ops_mkdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name); -static int jffs2_ops_rmdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name); -static int jffs2_ops_rename(cyg_mtab_entry * mte, cyg_dir dir1, - const char *name1, cyg_dir dir2, const char *name2); -static int jffs2_ops_link(cyg_mtab_entry * mte, cyg_dir dir1, const char *name1, - cyg_dir dir2, const char *name2, int type); -#endif -static int jffs2_opendir(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - cyg_file * fte); -static int jffs2_chdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - cyg_dir * dir_out); -static int jffs2_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - struct stat *buf); -static int jffs2_getinfo(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int key, void *buf, int len); -static int jffs2_setinfo(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int key, void *buf, int len); - -// File operations -int jffs2_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); -#ifdef CYGOPT_FS_JFFS2_WRITE -static int jffs2_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); -#endif -static int jffs2_fo_lseek(struct CYG_FILE_TAG *fp, off_t * pos, int whence); -static int jffs2_fo_ioctl(struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, - CYG_ADDRWORD data); -static int jffs2_fo_fsync(struct CYG_FILE_TAG *fp, int mode); -static int jffs2_fo_close(struct CYG_FILE_TAG *fp); -static int jffs2_fo_fstat(struct CYG_FILE_TAG *fp, struct stat *buf); -static int jffs2_fo_getinfo(struct CYG_FILE_TAG *fp, int key, void *buf, - int len); -static int jffs2_fo_setinfo(struct CYG_FILE_TAG *fp, int key, void *buf, - int len); - -// Directory operations -static int jffs2_fo_dirread(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio); -static int jffs2_fo_dirlseek(struct CYG_FILE_TAG *fp, off_t * pos, int whence); - - -static int jffs2_read_inode (struct _inode *inode); -static void jffs2_clear_inode (struct _inode *inode); -static int jffs2_truncate_file (struct _inode *inode); - -//========================================================================== -// Filesystem table entries - -// ------------------------------------------------------------------------- -// Fstab entry. -// This defines the entry in the filesystem table. -// For simplicity we use _FILESYSTEM synchronization for all accesses since -// we should never block in any filesystem operations. - -#ifdef CYGOPT_FS_JFFS2_WRITE -FSTAB_ENTRY(jffs2_fste, "jffs2", 0, - CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM, - jffs2_mount, - jffs2_umount, - jffs2_open, - jffs2_ops_unlink, - jffs2_ops_mkdir, - jffs2_ops_rmdir, - jffs2_ops_rename, - jffs2_ops_link, - jffs2_opendir, - jffs2_chdir, jffs2_stat, jffs2_getinfo, jffs2_setinfo); -#else -FSTAB_ENTRY(jffs2_fste, "jffs2", 0, - CYG_SYNCMODE_FILE_FILESYSTEM | CYG_SYNCMODE_IO_FILESYSTEM, - jffs2_mount, - jffs2_umount, - jffs2_open, - (cyg_fsop_unlink *)cyg_fileio_erofs, - (cyg_fsop_mkdir *)cyg_fileio_erofs, - (cyg_fsop_rmdir *)cyg_fileio_erofs, - (cyg_fsop_rename *)cyg_fileio_erofs, - (cyg_fsop_link *)cyg_fileio_erofs, - jffs2_opendir, - jffs2_chdir, jffs2_stat, jffs2_getinfo, jffs2_setinfo); -#endif - -// ------------------------------------------------------------------------- -// File operations. -// This set of file operations are used for normal open files. - -cyg_fileops jffs2_fileops = { - jffs2_fo_read, -#ifdef CYGOPT_FS_JFFS2_WRITE - jffs2_fo_write, -#else - (cyg_fileop_write *) cyg_fileio_erofs, -#endif - jffs2_fo_lseek, - jffs2_fo_ioctl, - cyg_fileio_seltrue, - jffs2_fo_fsync, - jffs2_fo_close, - jffs2_fo_fstat, - jffs2_fo_getinfo, - jffs2_fo_setinfo -}; - -// ------------------------------------------------------------------------- -// Directory file operations. -// This set of operations are used for open directories. Most entries -// point to error-returning stub functions. Only the read, lseek and -// close entries are functional. - -cyg_fileops jffs2_dirops = { - jffs2_fo_dirread, - (cyg_fileop_write *) cyg_fileio_enosys, - jffs2_fo_dirlseek, - (cyg_fileop_ioctl *) cyg_fileio_enosys, - cyg_fileio_seltrue, - (cyg_fileop_fsync *) cyg_fileio_enosys, - jffs2_fo_close, - (cyg_fileop_fstat *) cyg_fileio_enosys, - (cyg_fileop_getinfo *) cyg_fileio_enosys, - (cyg_fileop_setinfo *) cyg_fileio_enosys -}; - -//========================================================================== -// STATIC VARIABLES !!! - -static unsigned char gc_buffer[PAGE_CACHE_SIZE]; //avoids malloc when user may be under memory pressure -static unsigned char n_fs_mounted = 0; // a counter to track the number of jffs2 instances mounted - -//========================================================================== -// Directory operations - -struct jffs2_dirsearch { - struct _inode *dir; // directory to search - const unsigned char *path; // path to follow - struct _inode *node; // Node found - const unsigned char *name; // last name fragment used - int namelen; // name fragment length - cyg_bool last; // last name in path? -}; - -typedef struct jffs2_dirsearch jffs2_dirsearch; - -//========================================================================== -// Ref count and nlink management - - -// FIXME: This seems like real cruft. Wouldn't it be better just to do the -// right thing? -static void icache_evict(struct _inode *root_i, struct _inode *i) -{ - struct _inode *this = root_i, *next; - - restart: - D2(printf("icache_evict\n")); - // If this is an absolute search path from the root, - // remove all cached inodes with i_count of zero (these are only - // held where needed for dotdot filepaths) - while (this) { - next = this->i_cache_next; - if (this != i && this->i_count == 0) { - struct _inode *parent = this->i_parent; - if (this->i_cache_next) - this->i_cache_next->i_cache_prev = this->i_cache_prev; - if (this->i_cache_prev) - this->i_cache_prev->i_cache_next = this->i_cache_next; - jffs2_clear_inode(this); - memset(this, 0x5a, sizeof(*this)); - rt_free(this); - if (parent && parent != this) { - parent->i_count--; - this = root_i; - goto restart; - } - } - this = next; - } -} - -//========================================================================== -// Directory search - -// ------------------------------------------------------------------------- -// init_dirsearch() -// Initialize a dirsearch object to start a search - -static void init_dirsearch(jffs2_dirsearch * ds, - struct _inode *dir, const unsigned char *name) -{ - D2(printf("init_dirsearch name = %s\n", name)); - D2(printf("init_dirsearch dir = %x\n", dir)); - - dir->i_count++; - ds->dir = dir; - ds->path = name; - ds->node = dir; - ds->name = name; - ds->namelen = 0; - ds->last = false; -} - -// ------------------------------------------------------------------------- -// find_entry() -// Search a single directory for the next name in a path and update the -// dirsearch object appropriately. - -static int find_entry(jffs2_dirsearch * ds) -{ - struct _inode *dir = ds->dir; - const unsigned char *name = ds->path; - const unsigned char *n = name; - char namelen = 0; - struct _inode *d; - - D2(printf("find_entry\n")); - - // check that we really have a directory - if (!S_ISDIR(dir->i_mode)) - return ENOTDIR; - - // Isolate the next element of the path name. - while (*n != '\0' && *n != '/') - n++, namelen++; - - // Check if this is the last path element. - while( *n == '/') n++; - if (*n == '\0') - ds->last = true; - - // update name in dirsearch object - ds->name = name; - ds->namelen = namelen; - - if (name[0] == '.') - switch (namelen) { - default: - break; - case 2: - // Dot followed by not Dot, treat as any other name - if (name[1] != '.') - break; - // Dot Dot - // Move back up the search path - D2(printf("find_entry found ..\n")); - ds->dir = ds->node; - ds->node = ds->dir->i_parent; - ds->node->i_count++; - return ENOERR; - case 1: - // Dot is consumed - D2(printf("find_entry found .\n")); - ds->node = ds->dir; - ds->dir->i_count++; - return ENOERR; - } - - // Here we have the name and its length set up. - // Search the directory for a matching entry - - D2(printf("find_entry for name = %s\n", ds->path)); - d = jffs2_lookup(dir, name, namelen); - D2(printf("find_entry got dir = %x\n", d)); - - if (d == NULL) - return ENOENT; - if (IS_ERR(d)) - return -PTR_ERR(d); - - // If it's a new directory inode, increase refcount on its parent - if (S_ISDIR(d->i_mode) && !d->i_parent) { - d->i_parent = dir; - dir->i_count++; - } - - // pass back the node we have found - ds->node = d; - return ENOERR; - -} - -// ------------------------------------------------------------------------- -// jffs2_find() -// Main interface to directory search code. This is used in all file -// level operations to locate the object named by the pathname. - -// Returns with use count incremented on both the sought object and -// the directory it was found in -static int jffs2_find(jffs2_dirsearch * d) -{ - int err; - - D2(printf("jffs2_find for path =%s\n", d->path)); - - // Short circuit empty paths - if (*(d->path) == '\0') { - d->node->i_count++; - return ENOERR; - } - - // iterate down directory tree until we find the object - // we want. - for (;;) { - err = find_entry(d); - - if (err != ENOERR) - return err; - - if (d->last) - return ENOERR; - - /* We're done with it, although it we found a subdir that - will have caused the refcount to have been increased */ - jffs2_iput(d->dir); - - // Update dirsearch object to search next directory. - d->dir = d->node; - d->path += d->namelen; - while (*(d->path) == '/') - d->path++; // skip dirname separators - } -} - -//========================================================================== -// Pathconf support -// This function provides support for pathconf() and fpathconf(). - -static int jffs2_pathconf(struct _inode *node, struct cyg_pathconf_info *info) -{ - int err = ENOERR; - D2(printf("jffs2_pathconf\n")); - - switch (info->name) { - case _PC_LINK_MAX: - info->value = LINK_MAX; - break; - - case _PC_MAX_CANON: - info->value = -1; // not supported - err = EINVAL; - break; - - case _PC_MAX_INPUT: - info->value = -1; // not supported - err = EINVAL; - break; - - case _PC_NAME_MAX: - info->value = JFFS2_NAME_MAX; - break; - - case _PC_PATH_MAX: - info->value = JFFS2_PATH_MAX; - break; - - case _PC_PIPE_BUF: - info->value = -1; // not supported - err = EINVAL; - break; - - case _PC_ASYNC_IO: - info->value = -1; // not supported - err = EINVAL; - break; - - case _PC_CHOWN_RESTRICTED: - info->value = -1; // not supported - err = EINVAL; - break; - - case _PC_NO_TRUNC: - info->value = 0; - break; - - case _PC_PRIO_IO: - info->value = 0; - break; - - case _PC_SYNC_IO: - info->value = 0; - break; - - case _PC_VDISABLE: - info->value = -1; // not supported - err = EINVAL; - break; - - default: - err = EINVAL; - break; - } - - return err; -} - -//========================================================================== -// Filesystem operations -// ------------------------------------------------------------------------- -// jffs2_mount() -// Process a mount request. This mainly creates a root for the -// filesystem. -static int jffs2_read_super(struct super_block *sb) -{ - Cyg_ErrNo err; - struct jffs2_sb_info *c; - struct rt_mtd_nor_device *device; - - c = JFFS2_SB_INFO(sb); - device = RT_MTD_NOR_DEVICE(sb->s_dev); - - /* initialize mutex lock */ - init_MUTEX(&c->alloc_sem); - init_MUTEX(&c->erase_free_sem); - - /* sector size is the erase block size */ - c->sector_size = device->block_size; - c->flash_size = (device->block_end - device->block_start) * device->block_size; - c->cleanmarker_size = sizeof(struct jffs2_unknown_node); - - err = jffs2_do_mount_fs(c); - if (err) return -err; - - D1(printk(KERN_DEBUG "jffs2_read_super(): Getting root inode\n")); - sb->s_root = jffs2_iget(sb, 1); - if (IS_ERR(sb->s_root)) { - D1(printk(KERN_WARNING "get root inode failed\n")); - err = PTR_ERR(sb->s_root); - sb->s_root = NULL; - goto out_nodes; - } - return 0; - -out_nodes: - jffs2_free_ino_caches(c); - jffs2_free_raw_node_refs(c); - rt_free(c->blocks); - - return err; -} - -int jffs2_mount(cyg_fstab_entry * fste, cyg_mtab_entry * mte) -{ -// extern cyg_mtab_entry cyg_mtab[], cyg_mtab_end; - struct super_block *jffs2_sb = NULL; - struct jffs2_sb_info *c; -// cyg_mtab_entry *m; - cyg_io_handle_t t; - Cyg_ErrNo err; - - D2(printf("jffs2_mount\n")); - -//prife -// err = cyg_io_lookup(mte->devname, &t); -// if (err != ENOERR) -// return -err; - -// // Iterate through the mount table to see if we're mounted -// // FIXME: this should be done better - perhaps if the superblock -// // can be stored as an inode in the icache. -// for (m = &cyg_mtab[0]; m != &cyg_mtab_end; m++) { -// // stop if there are more than the configured maximum -// if (m - &cyg_mtab[0] >= CYGNUM_FILEIO_MTAB_MAX) { -// m = &cyg_mtab_end; -// break; -// } -// if (m->valid && strcmp(m->fsname, "jffs2") == 0 && -// strcmp(m->devname, mte->devname) == 0) { -// jffs2_sb = (struct super_block *) m->data; -// } -// } - jffs2_sb = NULL; - t = (cyg_io_handle_t)mte->data; //get from dfs_jffs2; - if (jffs2_sb == NULL) { - jffs2_sb = rt_malloc(sizeof (struct super_block)); - - if (jffs2_sb == NULL) - return ENOMEM; - - c = JFFS2_SB_INFO(jffs2_sb); - memset(jffs2_sb, 0, sizeof (struct super_block)); - jffs2_sb->s_dev = t; - - c->inocache_list = rt_malloc(sizeof(struct jffs2_inode_cache *) * INOCACHE_HASHSIZE); - if (!c->inocache_list) { - rt_free(jffs2_sb); - return ENOMEM; - } - memset(c->inocache_list, 0, sizeof(struct jffs2_inode_cache *) * INOCACHE_HASHSIZE); - if (n_fs_mounted++ == 0) { - jffs2_create_slab_caches(); // No error check, cannot fail - jffs2_compressors_init(); - } - - err = jffs2_read_super(jffs2_sb); - - if (err) { - if (--n_fs_mounted == 0) { - jffs2_destroy_slab_caches(); - jffs2_compressors_exit(); - } - - rt_free(jffs2_sb); - rt_free(c->inocache_list); - return err; - } - - jffs2_sb->s_root->i_parent = jffs2_sb->s_root; // points to itself, no dotdot paths above mountpoint - jffs2_sb->s_root->i_cache_prev = NULL; // root inode, so always null - jffs2_sb->s_root->i_cache_next = NULL; - jffs2_sb->s_root->i_count = 1; // Ensures the root inode is always in ram until umount - - D2(printf("jffs2_mount erasing pending blocks\n")); -#ifdef CYGOPT_FS_JFFS2_WRITE - if (!jffs2_is_readonly(c)) - jffs2_erase_pending_blocks(c,0); -#endif -#ifdef CYGOPT_FS_JFFS2_GCTHREAD - jffs2_start_garbage_collect_thread(c); -#endif - } - mte->data = (CYG_ADDRWORD) jffs2_sb; - - jffs2_sb->s_mount_count++; - mte->root = (cyg_dir) jffs2_sb->s_root; - D2(printf("jffs2_mounted superblock at %x\n", mte->root)); - - return ENOERR; -} - -extern cyg_dir cyg_cdir_dir; -extern cyg_mtab_entry *cyg_cdir_mtab_entry; - -// ------------------------------------------------------------------------- -// jffs2_umount() -// Unmount the filesystem. - -static int jffs2_umount(cyg_mtab_entry * mte) -{ - struct _inode *root = (struct _inode *) mte->root; - struct super_block *jffs2_sb = root->i_sb; - struct jffs2_sb_info *c = JFFS2_SB_INFO(jffs2_sb); - struct jffs2_full_dirent *fd, *next; - - D2(printf("jffs2_umount\n")); - - // Only really umount if this is the only mount - if (jffs2_sb->s_mount_count == 1) { - icache_evict(root, NULL); - if (root->i_cache_next != NULL) { - struct _inode *inode = root; - printf("Refuse to unmount.\n"); - while (inode) { - printf("Ino #%u has use count %d\n", - inode->i_ino, inode->i_count); - inode = inode->i_cache_next; - } - // root icount was set to 1 on mount - return EBUSY; - } - if (root->i_count == 2 && - cyg_cdir_mtab_entry == mte && - cyg_cdir_dir == (cyg_dir)root && - !strcmp(mte->name, "/")) { - /* If we were mounted on root, there's no - way for the cwd to change out and free - the file system for unmounting. So we hack - it -- if cwd is '/' we unset it. Perhaps - we should allow chdir(NULL) to unset - cyg_cdir_dir? */ - cyg_cdir_dir = CYG_DIR_NULL; - jffs2_iput(root); - } - /* Argh. The fileio code sets this; never clears it */ - if (cyg_cdir_mtab_entry == mte) - cyg_cdir_mtab_entry = NULL; - - if (root->i_count != 1) { - printf("Ino #1 has use count %d\n", - root->i_count); - return EBUSY; - } -#ifdef CYGOPT_FS_JFFS2_GCTHREAD - jffs2_stop_garbage_collect_thread(c); -#endif - jffs2_iput(root); // Time to free the root inode - - // free directory entries - for (fd = root->jffs2_i.dents; fd; fd = next) { - next=fd->next; - jffs2_free_full_dirent(fd); - } - - rt_free(root); - //Clear root inode - //root_i = NULL; - - // Clean up the super block and root inode - jffs2_free_ino_caches(c); - jffs2_free_raw_node_refs(c); - rt_free(c->blocks); - rt_free(c->inocache_list); - rt_free(jffs2_sb); - // Clear superblock & root pointer - mte->root = CYG_DIR_NULL; - mte->data = 0; - mte->fs->data = 0; // fstab entry, visible to all mounts. No current mount - // That's all folks. - D2(printf("jffs2_umount No current mounts\n")); - } else { - jffs2_sb->s_mount_count--; - } - if (--n_fs_mounted == 0) { - jffs2_destroy_slab_caches(); - jffs2_compressors_exit(); - } - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_open() -// Open a file for reading or writing. - -int jffs2_open(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int mode, cyg_file * file) -{ - - jffs2_dirsearch ds; - struct _inode *node = NULL; - int err; - - D2(printf("jffs2_open\n")); - - /* If no chdir has been called and we were the first file system - mounted, we get called with dir == NULL. Deal with it */ - if (!dir) - dir = mte->root; - -#ifndef CYGOPT_FS_JFFS2_WRITE - if (mode & (O_CREAT|O_TRUNC|O_WRONLY)) - return EROFS; -#endif - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *) name); - - err = jffs2_find(&ds); - - if (err == ENOENT) { -#ifdef CYGOPT_FS_JFFS2_WRITE - if (ds.last && (mode & O_CREAT)) { - - // No node there, if the O_CREAT bit is set then we must - // create a new one. The dir and name fields of the dirsearch - // object will have been updated so we know where to put it. - - err = jffs2_create(ds.dir, ds.name, S_IRUGO|S_IXUGO|S_IWUSR|S_IFREG, &node); - - if (err != 0) { - //Possible orphaned inode on the flash - but will be gc'd - jffs2_iput(ds.dir); - return -err; - } - - err = ENOERR; - } -#endif - } else if (err == ENOERR) { - // The node exists. If the O_CREAT and O_EXCL bits are set, we - // must fail the open. - - if ((mode & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) { - jffs2_iput(ds.node); - err = EEXIST; - } else - node = ds.node; - } - - // Finished with the directory now - jffs2_iput(ds.dir); - - if (err != ENOERR) - return err; - - // Check that we actually have a file here - if (S_ISDIR(node->i_mode)) { - jffs2_iput(node); - return EISDIR; - } - - // If the O_TRUNC bit is set we must clean out the file data. - if (mode & O_TRUNC) { -#ifdef CYGOPT_FS_JFFS2_WRITE - err = jffs2_truncate_file(node); - if (err) { - jffs2_iput(node); - return err; - } -#else - jffs2_iput(node); - return EROFS; -#endif - } - - // Initialise the file object - file->f_flag = mode & CYG_FILE_MODE_MASK; - file->f_type = CYG_FILE_TYPE_FILE; - file->f_ops = &jffs2_fileops; - file->f_offset = (mode & O_APPEND) ? node->i_size : 0; - file->f_data = (CYG_ADDRWORD) node; - file->f_xops = 0; - - return ENOERR; -} - -#ifdef CYGOPT_FS_JFFS2_WRITE -// ------------------------------------------------------------------------- -// jffs2_ops_unlink() -// Remove a file link from its directory. - -static int jffs2_ops_unlink(cyg_mtab_entry * mte, cyg_dir dir, const char *name) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_ops_unlink\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *)name); - - err = jffs2_find(&ds); - - if (err != ENOERR) { - jffs2_iput(ds.dir); - return err; - } - - // Cannot unlink directories, use rmdir() instead - if (S_ISDIR(ds.node->i_mode)) { - jffs2_iput(ds.dir); - jffs2_iput(ds.node); - return EPERM; - } - - // Delete it from its directory - - err = jffs2_unlink(ds.dir, ds.node, ds.name); - jffs2_iput(ds.dir); - jffs2_iput(ds.node); - - return -err; -} - -// ------------------------------------------------------------------------- -// jffs2_ops_mkdir() -// Create a new directory. - -static int jffs2_ops_mkdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_ops_mkdir\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *)name); - - err = jffs2_find(&ds); - - if (err == ENOENT) { - if (ds.last) { - // The entry does not exist, and it is the last element in - // the pathname, so we can create it here. - - err = -jffs2_mkdir(ds.dir, ds.name, S_IRUGO|S_IXUGO|S_IWUSR); - } - // If this was not the last element, then an intermediate - // directory does not exist. - } else { - // If there we no error, something already exists with that - // name, so we cannot create another one. - if (err == ENOERR) { - jffs2_iput(ds.node); - err = EEXIST; - } - } - jffs2_iput(ds.dir); - return err; -} - -// ------------------------------------------------------------------------- -// jffs2_ops_rmdir() -// Remove a directory. - -static int jffs2_ops_rmdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_ops_rmdir\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *)name); - - err = jffs2_find(&ds); - - if (err != ENOERR) { - jffs2_iput(ds.dir); - return err; - } - - // Check that this is actually a directory. - if (!S_ISDIR(ds.node->i_mode)) { - jffs2_iput(ds.dir); - jffs2_iput(ds.node); - return EPERM; - } - - err = jffs2_rmdir(ds.dir, ds.node, ds.name); - - jffs2_iput(ds.dir); - jffs2_iput(ds.node); - return -err; -} - -// ------------------------------------------------------------------------- -// jffs2_ops_rename() -// Rename a file/dir. - -static int jffs2_ops_rename(cyg_mtab_entry * mte, cyg_dir dir1, - const char *name1, cyg_dir dir2, const char *name2) -{ - jffs2_dirsearch ds1, ds2; - int err; - - D2(printf("jffs2_ops_rename\n")); - - init_dirsearch(&ds1, (struct _inode *) dir1, - (const unsigned char *)name1); - - err = jffs2_find(&ds1); - - if (err != ENOERR) { - jffs2_iput(ds1.dir); - return err; - } - - init_dirsearch(&ds2, (struct _inode *) dir2, - (const unsigned char *)name2); - - err = jffs2_find(&ds2); - - // Allow through renames to non-existent objects. - if (ds2.last && err == ENOENT) { - ds2.node = NULL; - err = ENOERR; - } - - if (err != ENOERR) { - jffs2_iput(ds1.dir); - jffs2_iput(ds1.node); - jffs2_iput(ds2.dir); - return err; - } - - // Null rename, just return - if (ds1.node == ds2.node) { - err = ENOERR; - goto out; - } - - // First deal with any entry that is at the destination - if (ds2.node) { - // Check that we are renaming like-for-like - - if (!S_ISDIR(ds1.node->i_mode) && S_ISDIR(ds2.node->i_mode)) { - err = EISDIR; - goto out; - } - - if (S_ISDIR(ds1.node->i_mode) && !S_ISDIR(ds2.node->i_mode)) { - err = ENOTDIR; - goto out; - } - - // Now delete the destination directory entry - /* Er, what happened to atomicity of rename()? */ - err = -jffs2_unlink(ds2.dir, ds2.node, ds2.name); - - if (err != 0) - goto out; - - } - // Now we know that there is no clashing node at the destination, - // make a new direntry at the destination and delete the old entry - // at the source. - - err = -jffs2_rename(ds1.dir, ds1.node, ds1.name, ds2.dir, ds2.name); - - // Update directory times - if (!err) - ds1.dir->i_ctime = - ds1.dir->i_mtime = - ds2.dir->i_ctime = ds2.dir->i_mtime = jffs2_get_timestamp(); - out: - jffs2_iput(ds1.dir); - if (S_ISDIR(ds1.node->i_mode)) { - /* Renamed a directory to elsewhere... so fix up its - i_parent pointer and the i_counts of its old and - new parents. */ - jffs2_iput(ds1.node->i_parent); - ds1.node->i_parent = ds2.dir; - /* We effectively increase its use count by not... */ - } else { - jffs2_iput(ds2.dir); /* ... doing this */ - } - jffs2_iput(ds1.node); - if (ds2.node) - jffs2_iput(ds2.node); - - return err; -} - -// ------------------------------------------------------------------------- -// jffs2_ops_link() -// Make a new directory entry for a file. - -static int jffs2_ops_link(cyg_mtab_entry * mte, cyg_dir dir1, const char *name1, - cyg_dir dir2, const char *name2, int type) -{ - jffs2_dirsearch ds1, ds2; - int err; - - D2(printf("jffs2_ops_link\n")); - - // Only do hard links for now in this filesystem - if (type != CYG_FSLINK_HARD) - return EINVAL; - - init_dirsearch(&ds1, (struct _inode *) dir1, - (const unsigned char *) name1); - - err = jffs2_find(&ds1); - - if (err != ENOERR) { - jffs2_iput(ds1.dir); - return err; - } - - init_dirsearch(&ds2, (struct _inode *) dir2, - (const unsigned char *) name2); - - err = jffs2_find(&ds2); - - // Don't allow links to existing objects - if (err == ENOERR) { - jffs2_iput(ds1.dir); - jffs2_iput(ds1.node); - jffs2_iput(ds2.dir); - jffs2_iput(ds2.node); - return EEXIST; - } - - // Allow through links to non-existing terminal objects - if (ds2.last && err == ENOENT) { - ds2.node = NULL; - err = ENOERR; - } - - if (err != ENOERR) { - jffs2_iput(ds1.dir); - jffs2_iput(ds1.node); - jffs2_iput(ds2.dir); - return err; - } - - // Now we know that there is no existing node at the destination, - // make a new direntry at the destination. - - err = jffs2_link(ds1.node, ds2.dir, ds2.name); - - if (err == 0) - ds1.node->i_ctime = - ds2.dir->i_ctime = ds2.dir->i_mtime = jffs2_get_timestamp(); - - jffs2_iput(ds1.dir); - jffs2_iput(ds1.node); - jffs2_iput(ds2.dir); - - return -err; -} -#endif /* CYGOPT_FS_JFFS2_WRITE */ -// ------------------------------------------------------------------------- -// jffs2_opendir() -// Open a directory for reading. - -static int jffs2_opendir(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - cyg_file * file) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_opendir\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *) name); - - err = jffs2_find(&ds); - - jffs2_iput(ds.dir); - - if (err != ENOERR) - return err; - - // check it is really a directory. - if (!S_ISDIR(ds.node->i_mode)) { - jffs2_iput(ds.node); - return ENOTDIR; - } - - // Initialize the file object, setting the f_ops field to a - // special set of file ops. - - file->f_flag = 0; - file->f_type = CYG_FILE_TYPE_FILE; - file->f_ops = &jffs2_dirops; - file->f_offset = 0; - file->f_data = (CYG_ADDRWORD) ds.node; - file->f_xops = 0; - - return ENOERR; - -} - -// ------------------------------------------------------------------------- -// jffs2_chdir() -// Change directory support. - -static int jffs2_chdir(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - cyg_dir * dir_out) -{ - D2(printf("jffs2_chdir\n")); - - if (dir_out != NULL) { - // This is a request to get a new directory pointer in - // *dir_out. - - jffs2_dirsearch ds; - int err; - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *) name); - - err = jffs2_find(&ds); - jffs2_iput(ds.dir); - - if (err != ENOERR) - return err; - - // check it is a directory - if (!S_ISDIR(ds.node->i_mode)) { - jffs2_iput(ds.node); - return ENOTDIR; - } - - // Pass it out - *dir_out = (cyg_dir) ds.node; - } else { - // If no output dir is required, this means that the mte and - // dir arguments are the current cdir setting and we should - // forget this fact. - - struct _inode *node = (struct _inode *) dir; - - // Just decrement directory reference count. - jffs2_iput(node); - } - - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_stat() -// Get struct stat info for named object. - -static int jffs2_stat(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - struct stat *buf) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_stat\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *) name); - - err = jffs2_find(&ds); - jffs2_iput(ds.dir); - - if (err != ENOERR) - return err; - - // Fill in the status - buf->st_mode = ds.node->i_mode; - buf->st_ino = ds.node->i_ino; - buf->st_dev = 0; - buf->st_nlink = ds.node->i_nlink; - buf->st_uid = ds.node->i_uid; - buf->st_gid = ds.node->i_gid; - buf->st_size = ds.node->i_size; - buf->st_atime = ds.node->i_atime; - buf->st_mtime = ds.node->i_mtime; - buf->st_ctime = ds.node->i_ctime; - - jffs2_iput(ds.node); - - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_getinfo() -// Getinfo. Currently only support pathconf(). - -static int jffs2_getinfo(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int key, void *buf, int len) -{ - jffs2_dirsearch ds; - int err; - - D2(printf("jffs2_getinfo\n")); - - init_dirsearch(&ds, (struct _inode *) dir, - (const unsigned char *) name); - - err = jffs2_find(&ds); - jffs2_iput(ds.dir); - - if (err != ENOERR) - return err; - - switch (key) { - case FS_INFO_CONF: - err = jffs2_pathconf(ds.node, (struct cyg_pathconf_info *) buf); - break; - - default: - err = EINVAL; - } - - jffs2_iput(ds.node); - return err; -} - -// ------------------------------------------------------------------------- -// jffs2_setinfo() -// Setinfo. Nothing to support here at present. - -static int jffs2_setinfo(cyg_mtab_entry * mte, cyg_dir dir, const char *name, - int key, void *buf, int len) -{ - // No setinfo keys supported at present - - D2(printf("jffs2_setinfo\n")); - - return EINVAL; -} - -//========================================================================== -// File operations - -// ------------------------------------------------------------------------- -// jffs2_fo_read() -// Read data from the file. - -int jffs2_fo_read(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) -{ - struct _inode *inode = (struct _inode *) fp->f_data; - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - int i; - ssize_t resid = uio->uio_resid; - off_t pos = fp->f_offset; - - down(&f->sem); - - // Loop over the io vectors until there are none left - for (i = 0; i < uio->uio_iovcnt && pos < inode->i_size; i++) { - int ret; - cyg_iovec *iov = &uio->uio_iov[i]; - off_t len = min(iov->iov_len, inode->i_size - pos); - - D2(printf("jffs2_fo_read inode size %d\n", inode->i_size)); - - ret = - jffs2_read_inode_range(c, f, - (unsigned char *) iov->iov_base, pos, - len); - if (ret) { - D1(printf - ("jffs2_fo_read(): read_inode_range failed %d\n", - ret)); - uio->uio_resid = resid; - up(&f->sem); - return -ret; - } - resid -= len; - pos += len; - } - - // We successfully read some data, update the node's access time - // and update the file offset and transfer residue. - - inode->i_atime = jffs2_get_timestamp(); - - uio->uio_resid = resid; - fp->f_offset = pos; - - up(&f->sem); - - return ENOERR; -} - - -#ifdef CYGOPT_FS_JFFS2_WRITE -// ------------------------------------------------------------------------- -// jffs2_fo_write() -// Write data to file. -static int jffs2_extend_file (struct _inode *inode, struct jffs2_raw_inode *ri, - unsigned long offset) -{ - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_full_dnode *fn; - uint32_t phys_ofs, alloc_len; - int ret = 0; - - /* Make new hole frag from old EOF to new page */ - D1(printk(KERN_DEBUG "Writing new hole frag 0x%x-0x%x between current EOF and new page\n", - (unsigned int)inode->i_size, offset)); - - ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloc_len, ALLOC_NORMAL); - if (ret) - return ret; - - down(&f->sem); - - ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri->totlen = cpu_to_je32(sizeof(*ri)); - ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)); - - ri->version = cpu_to_je32(++f->highest_version); - ri->isize = cpu_to_je32(max((uint32_t)inode->i_size, offset)); - - ri->offset = cpu_to_je32(inode->i_size); - ri->dsize = cpu_to_je32(offset - inode->i_size); - ri->csize = cpu_to_je32(0); - ri->compr = JFFS2_COMPR_ZERO; - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - ri->data_crc = cpu_to_je32(0); - - fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL); - jffs2_complete_reservation(c); - if (IS_ERR(fn)) { - ret = PTR_ERR(fn); - up(&f->sem); - return ret; - } - ret = jffs2_add_full_dnode_to_inode(c, f, fn); - if (f->metadata) { - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - f->metadata = NULL; - } - if (ret) { - D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in prepare_write, returned %d\n", ret)); - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - up(&f->sem); - return ret; - } - inode->i_size = offset; - up(&f->sem); - return 0; -} - -// jffs2_fo_open() -// Truncate a file -static int jffs2_truncate_file (struct _inode *inode) -{ - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - struct jffs2_full_dnode *new_metadata, * old_metadata; - struct jffs2_raw_inode *ri; - uint32_t phys_ofs, alloclen; - int err; - - ri = jffs2_alloc_raw_inode(); - if (!ri) { - return ENOMEM; - } - err = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); - - if (err) { - jffs2_free_raw_inode(ri); - return err; - } - down(&f->sem); - ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri->totlen = cpu_to_je32(sizeof(*ri)); - ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)); - - ri->ino = cpu_to_je32(inode->i_ino); - ri->version = cpu_to_je32(++f->highest_version); - - ri->uid = cpu_to_je16(inode->i_uid); - ri->gid = cpu_to_je16(inode->i_gid); - ri->mode = cpu_to_jemode(inode->i_mode); - ri->isize = cpu_to_je32(0); - ri->atime = cpu_to_je32(inode->i_atime); - ri->mtime = cpu_to_je32(jffs2_get_timestamp()); - ri->offset = cpu_to_je32(0); - ri->csize = ri->dsize = cpu_to_je32(0); - ri->compr = JFFS2_COMPR_NONE; - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - ri->data_crc = cpu_to_je32(0); - new_metadata = jffs2_write_dnode(c, f, ri, NULL, 0, - phys_ofs, ALLOC_NORMAL); - if (IS_ERR(new_metadata)) { - jffs2_complete_reservation(c); - jffs2_free_raw_inode(ri); - up(&f->sem); - return PTR_ERR(new_metadata); - } - - /* It worked. Update the inode */ - inode->i_mtime = jffs2_get_timestamp(); - inode->i_size = 0; - old_metadata = f->metadata; - jffs2_truncate_fragtree (c, &f->fragtree, 0); - f->metadata = new_metadata; - if (old_metadata) { - jffs2_mark_node_obsolete(c, old_metadata->raw); - jffs2_free_full_dnode(old_metadata); - } - jffs2_free_raw_inode(ri); - - up(&f->sem); - jffs2_complete_reservation(c); - - return 0; -} - -static int jffs2_fo_write(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) -{ - struct _inode *inode = (struct _inode *) fp->f_data; - off_t pos = fp->f_offset; - ssize_t resid = uio->uio_resid; - struct jffs2_raw_inode ri; - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - int i; - - // If the APPEND mode bit was supplied, force all writes to - // the end of the file. - if (fp->f_flag & CYG_FAPPEND) - pos = fp->f_offset = inode->i_size; - - if (pos < 0) - return EINVAL; - - memset(&ri, 0, sizeof(ri)); - - ri.ino = cpu_to_je32(f->inocache->ino); - ri.mode = cpu_to_jemode(inode->i_mode); - ri.uid = cpu_to_je16(inode->i_uid); - ri.gid = cpu_to_je16(inode->i_gid); - ri.atime = ri.ctime = ri.mtime = cpu_to_je32(jffs2_get_timestamp()); - - if (pos > inode->i_size) { - int err; - ri.version = cpu_to_je32(++f->highest_version); - err = jffs2_extend_file(inode, &ri, pos); - if (err) - return -err; - } - ri.isize = cpu_to_je32(inode->i_size); - - // Now loop over the iovecs until they are all done, or - // we get an error. - for (i = 0; i < uio->uio_iovcnt; i++) { - cyg_iovec *iov = &uio->uio_iov[i]; - unsigned char *buf = iov->iov_base; - off_t len = iov->iov_len; - - uint32_t writtenlen; - int err; - - D2(printf("jffs2_fo_write page_start_pos %d\n", pos)); - D2(printf("jffs2_fo_write transfer size %d\n", len)); - - err = jffs2_write_inode_range(c, f, &ri, buf, - pos, len, &writtenlen); - if (err) - return -err; - - if (writtenlen != len) - return ENOSPC; - - pos += len; - resid -= len; - } - - // We wrote some data successfully, update the modified and access - // times of the inode, increase its size appropriately, and update - // the file offset and transfer residue. - inode->i_mtime = inode->i_ctime = je32_to_cpu(ri.mtime); - if (pos > inode->i_size) - inode->i_size = pos; - - uio->uio_resid = resid; - fp->f_offset = pos; - - return ENOERR; -} -#endif /* CYGOPT_FS_JFFS2_WRITE */ - -// ------------------------------------------------------------------------- -// jffs2_fo_lseek() -// Seek to a new file position. - -static int jffs2_fo_lseek(struct CYG_FILE_TAG *fp, off_t * apos, int whence) -{ - struct _inode *node = (struct _inode *) fp->f_data; - off_t pos = *apos; - - D2(printf("jffs2_fo_lseek\n")); - - switch (whence) { - case SEEK_SET: - // Pos is already where we want to be. - break; - - case SEEK_CUR: - // Add pos to current offset. - pos += fp->f_offset; - break; - - case SEEK_END: - // Add pos to file size. - pos += node->i_size; - break; - - default: - return EINVAL; - } - - if (pos < 0 ) - return EINVAL; - - // All OK, set fp offset and return new position. - *apos = fp->f_offset = pos; - - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_ioctl() -// Handle ioctls. Currently none are defined. - -static int jffs2_fo_ioctl(struct CYG_FILE_TAG *fp, CYG_ADDRWORD com, - CYG_ADDRWORD data) -{ - // No Ioctls currenly defined. - - D2(printf("jffs2_fo_ioctl\n")); - - return EINVAL; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_fsync(). -// Force the file out to data storage. - -static int jffs2_fo_fsync(struct CYG_FILE_TAG *fp, int mode) -{ - // Data is always permanently where it belongs, nothing to do - // here. - - D2(printf("jffs2_fo_fsync\n")); - - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_close() -// Close a file. We just decrement the refcnt and let it go away if -// that is all that is keeping it here. - -static int jffs2_fo_close(struct CYG_FILE_TAG *fp) -{ - struct _inode *node = (struct _inode *) fp->f_data; - - D2(printf("jffs2_fo_close\n")); - - jffs2_iput(node); - - fp->f_data = 0; // zero data pointer - - return ENOERR; -} - -// ------------------------------------------------------------------------- -//jffs2_fo_fstat() -// Get file status. - -static int jffs2_fo_fstat(struct CYG_FILE_TAG *fp, struct stat *buf) -{ - struct _inode *node = (struct _inode *) fp->f_data; - - D2(printf("jffs2_fo_fstat\n")); - - // Fill in the status - buf->st_mode = node->i_mode; - buf->st_ino = node->i_ino; - buf->st_dev = 0; - buf->st_nlink = node->i_nlink; - buf->st_uid = node->i_uid; - buf->st_gid = node->i_gid; - buf->st_size = node->i_size; - buf->st_atime = node->i_atime; - buf->st_mtime = node->i_mtime; - buf->st_ctime = node->i_ctime; - - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_getinfo() -// Get info. Currently only supports fpathconf(). - -static int jffs2_fo_getinfo(struct CYG_FILE_TAG *fp, int key, void *buf, - int len) -{ - struct _inode *node = (struct _inode *) fp->f_data; - int err; - - D2(printf("jffs2_fo_getinfo\n")); - - switch (key) { - case FS_INFO_CONF: - err = jffs2_pathconf(node, (struct cyg_pathconf_info *) buf); - break; - - default: - err = EINVAL; - } - return err; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_setinfo() -// Set info. Nothing supported here. - -static int jffs2_fo_setinfo(struct CYG_FILE_TAG *fp, int key, void *buf, - int len) -{ - // No setinfo key supported at present - - D2(printf("jffs2_fo_setinfo\n")); - - return ENOERR; -} - -//========================================================================== -// Directory operations - -// ------------------------------------------------------------------------- -// jffs2_fo_dirread() -// Read a single directory entry from a file. - -static __inline void filldir(char *nbuf, int nlen, const unsigned char *name, int namlen) -{ - int len = nlen < namlen ? nlen : namlen; - memcpy(nbuf, name, len); - nbuf[len] = '\0'; -} - -static int jffs2_fo_dirread(struct CYG_FILE_TAG *fp, struct CYG_UIO_TAG *uio) -{ - struct _inode *d_inode = (struct _inode *) fp->f_data; - struct dirent *ent = (struct dirent *) uio->uio_iov[0].iov_base; - char *nbuf = ent->d_name; -#ifdef CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE - struct _inode *c_ino; -#endif - int nlen = sizeof (ent->d_name) - 1; - off_t len = uio->uio_iov[0].iov_len; - struct jffs2_inode_info *f; - struct _inode *inode = d_inode; - struct jffs2_full_dirent *fd; - unsigned long offset, curofs; - int found = 1; - - if (len < sizeof (struct dirent)) - return EINVAL; - - D1(printk - (KERN_DEBUG "jffs2_readdir() for dir_i #%lu\n", d_inode->i_ino)); - - f = JFFS2_INODE_INFO(inode); - - offset = fp->f_offset; - - if (offset == 0) { - D1(printk - (KERN_DEBUG "Dirent 0: \".\", ino #%lu\n", inode->i_ino)); - filldir(nbuf, nlen, (const unsigned char *) ".", 1); -#ifdef CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE - // Flags here are the same as jffs2_mkdir. Make sure - // d_type is the same as st_mode of calling stat. - ent->d_type = - jemode_to_cpu(cpu_to_jemode(S_IRUGO|S_IXUGO|S_IWUSR|S_IFDIR)); -#endif - goto out; - } - if (offset == 1) { - filldir(nbuf, nlen, (const unsigned char *) "..", 2); -#ifdef CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE - // Flags here are the same as jffs2_mkdir. Make sure - // d_type is the same as st_mode of calling stat. - ent->d_type = - jemode_to_cpu(cpu_to_jemode(S_IRUGO|S_IXUGO|S_IWUSR|S_IFDIR)); -#endif - goto out; - } - - curofs = 1; - down(&f->sem); - for (fd = f->dents; fd; fd = fd->next) { - - curofs++; - /* First loop: curofs = 2; offset = 2 */ - if (curofs < offset) { - D2(printk - (KERN_DEBUG - "Skipping dirent: \"%s\", ino #%u, type %d, because curofs %ld < offset %ld\n", - fd->name, fd->ino, fd->type, curofs, offset)); - continue; - } - if (!fd->ino) { - D2(printk - (KERN_DEBUG "Skipping deletion dirent \"%s\"\n", - fd->name)); - offset++; - continue; - } - D2(printk - (KERN_DEBUG "Dirent %ld: \"%s\", ino #%u, type %d\n", offset, - fd->name, fd->ino, fd->type)); - filldir(nbuf, nlen, fd->name, strlen((char *)fd->name)); -#ifdef CYGPKG_FS_JFFS2_RET_DIRENT_DTYPE - c_ino = jffs2_iget(inode->i_sb, fd->ino); - if(IS_ERR(c_ino)) { - D1(printk(KERN_WARNING "get entry inode failed\n")); - // fileio already set it to zero, so not needed here - // ent->d_type = 0; - } - else { - ent->d_type = c_ino->i_mode; - jffs2_iput(c_ino); - } -#endif - goto out_sem; - } - /* Reached the end of the directory */ - found = 0; - out_sem: - up(&f->sem); - out: - fp->f_offset = ++offset; - if (found) { - uio->uio_resid -= sizeof (struct dirent); - } - return ENOERR; -} - -// ------------------------------------------------------------------------- -// jffs2_fo_dirlseek() -// Seek directory to start. - -static int jffs2_fo_dirlseek(struct CYG_FILE_TAG *fp, off_t * pos, int whence) -{ - // Only allow SEEK_SET to zero - - D2(printf("jffs2_fo_dirlseek\n")); - - if (whence != SEEK_SET || *pos != 0) - return EINVAL; - - *pos = fp->f_offset = 0; - - return ENOERR; -} - -//========================================================================== -// -// Called by JFFS2 -// =============== -// -// -//========================================================================== - -unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, - struct jffs2_inode_info *f, - unsigned long offset, - unsigned long *priv) -{ - /* FIXME: This works only with one file system mounted at a time */ - int ret; - - ret = jffs2_read_inode_range(c, f, gc_buffer, - offset & ~(PAGE_CACHE_SIZE-1), PAGE_CACHE_SIZE); - if (ret) - return ERR_PTR(ret); - - return gc_buffer; -} - -void jffs2_gc_release_page(struct jffs2_sb_info *c, - unsigned char *ptr, - unsigned long *priv) -{ - /* Do nothing */ -} - -static struct _inode *new_inode(struct super_block *sb) -{ - struct _inode *inode; - struct _inode *cached_inode; - - inode = rt_malloc(sizeof (struct _inode)); - if (inode == NULL) - return 0; - - D2(printf("malloc new_inode %x ####################################\n", - inode)); - - memset(inode, 0, sizeof (struct _inode)); - inode->i_sb = sb; - inode->i_ino = 1; - inode->i_count = 1; - inode->i_nlink = 1; // Let JFFS2 manage the link count - inode->i_size = 0; - - inode->i_cache_next = NULL; // Newest inode, about to be cached - - // Add to the icache - for (cached_inode = sb->s_root; cached_inode != NULL; - cached_inode = cached_inode->i_cache_next) { - if (cached_inode->i_cache_next == NULL) { - cached_inode->i_cache_next = inode; // Current last in cache points to newcomer - inode->i_cache_prev = cached_inode; // Newcomer points back to last - break; - } - } - return inode; -} - -static struct _inode *ilookup(struct super_block *sb, cyg_uint32 ino) -{ - struct _inode *inode = NULL; - - D2(printf("ilookup\n")); - // Check for this inode in the cache - for (inode = sb->s_root; inode != NULL; inode = inode->i_cache_next) { - if (inode->i_ino == ino) { - inode->i_count++; - break; - } - } - return inode; -} - -struct _inode *jffs2_iget(struct super_block *sb, cyg_uint32 ino) -{ - // Called in super.c jffs2_read_super, dir.c jffs2_lookup, - // and gc.c jffs2_garbage_collect_pass - - // Must first check for cached inode - // If this fails let new_inode create one - - struct _inode *inode; - int err; - - D2(printf("jffs2_iget\n")); - - inode = ilookup(sb, ino); - if (inode) - return inode; - - // Not cached, so malloc it - inode = new_inode(sb); - if (inode == NULL) - return ERR_PTR(-ENOMEM); - - inode->i_ino = ino; - - err = jffs2_read_inode(inode); - if (err) { - printf("jffs2_read_inode() failed\n"); - inode->i_nlink = 0; // free _this_ bad inode right now - jffs2_iput(inode); - inode = NULL; - return ERR_PTR(err); - } - return inode; -} - -// ------------------------------------------------------------------------- -// Decrement the reference count on an inode. If this makes the ref count -// zero, then this inode can be freed. - -void jffs2_iput(struct _inode *i) -{ - // Called in jffs2_find - // (and jffs2_open and jffs2_ops_mkdir?) - // super.c jffs2_read_super, - // and gc.c jffs2_garbage_collect_pass - recurse: - if (!i) { - printf("jffs2_iput() called with NULL inode\n"); - // and let it fault... - } - - i->i_count--; - - if (i->i_count < 0) - BUG(); - - if (i->i_count) - return; - - if (!i->i_nlink) { - struct _inode *parent; - - // Remove from the icache linked list and free immediately - if (i->i_cache_prev) - i->i_cache_prev->i_cache_next = i->i_cache_next; - if (i->i_cache_next) - i->i_cache_next->i_cache_prev = i->i_cache_prev; - - parent = i->i_parent; - jffs2_clear_inode(i); - memset(i, 0x5a, sizeof(*i)); - rt_free(i); - - if (parent && parent != i) { - i = parent; - goto recurse; - } - - } else { - // Evict some _other_ inode with i_count zero, leaving - // this latest one in the cache for a while - icache_evict(i->i_sb->s_root, i); - } -} - - -// ------------------------------------------------------------------------- -// EOF jffs2.c - - -static inline void jffs2_init_inode_info(struct jffs2_inode_info *f) -{ - memset(f, 0, sizeof(*f)); - init_MUTEX_LOCKED(&f->sem); -} - -static void jffs2_clear_inode (struct _inode *inode) -{ - /* We can forget about this inode for now - drop all - * the nodelists associated with it, etc. - */ - struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); - struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); - - D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode)); - - jffs2_do_clear_inode(c, f); -} - - -/* jffs2_new_inode: allocate a new inode and inocache, add it to the hash, - fill in the raw_inode while you're at it. */ -struct _inode *jffs2_new_inode (struct _inode *dir_i, int mode, struct jffs2_raw_inode *ri) -{ - struct _inode *inode; - struct super_block *sb = dir_i->i_sb; - struct jffs2_sb_info *c; - struct jffs2_inode_info *f; - int ret; - - D1(printk(KERN_DEBUG "jffs2_new_inode(): dir_i %ld, mode 0x%x\n", dir_i->i_ino, mode)); - - c = JFFS2_SB_INFO(sb); - - inode = new_inode(sb); - - if (!inode) - return ERR_PTR(-ENOMEM); - - f = JFFS2_INODE_INFO(inode); - jffs2_init_inode_info(f); - - memset(ri, 0, sizeof(*ri)); - /* Set OS-specific defaults for new inodes */ - ri->uid = ri->gid = cpu_to_je16(0); - ri->mode = cpu_to_jemode(mode); - ret = jffs2_do_new_inode (c, f, mode, ri); - if (ret) { - // forceful evict: f->sem is locked already, and the - // inode is bad. - if (inode->i_cache_prev) - inode->i_cache_prev->i_cache_next = inode->i_cache_next; - if (inode->i_cache_next) - inode->i_cache_next->i_cache_prev = inode->i_cache_prev; - up(&(f->sem)); - jffs2_clear_inode(inode); - memset(inode, 0x6a, sizeof(*inode)); - rt_free(inode); - return ERR_PTR(ret); - } - inode->i_nlink = 1; - inode->i_ino = je32_to_cpu(ri->ino); - inode->i_mode = jemode_to_cpu(ri->mode); - inode->i_gid = je16_to_cpu(ri->gid); - inode->i_uid = je16_to_cpu(ri->uid); - inode->i_atime = inode->i_ctime = inode->i_mtime = jffs2_get_timestamp(); - ri->atime = ri->mtime = ri->ctime = cpu_to_je32(inode->i_mtime); - - inode->i_size = 0; - - return inode; -} - - -static int jffs2_read_inode (struct _inode *inode) -{ - struct jffs2_inode_info *f; - struct jffs2_sb_info *c; - struct jffs2_raw_inode latest_node; - int ret; - - D1(printk(KERN_DEBUG "jffs2_read_inode(): inode->i_ino == %lu\n", inode->i_ino)); - - f = JFFS2_INODE_INFO(inode); - c = JFFS2_SB_INFO(inode->i_sb); - - jffs2_init_inode_info(f); - - ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); - - if (ret) { - up(&f->sem); - return ret; - } - inode->i_mode = jemode_to_cpu(latest_node.mode); - inode->i_uid = je16_to_cpu(latest_node.uid); - inode->i_gid = je16_to_cpu(latest_node.gid); - inode->i_size = je32_to_cpu(latest_node.isize); - inode->i_atime = je32_to_cpu(latest_node.atime); - inode->i_mtime = je32_to_cpu(latest_node.mtime); - inode->i_ctime = je32_to_cpu(latest_node.ctime); - - inode->i_nlink = f->inocache->nlink; - up(&f->sem); - - D1(printk(KERN_DEBUG "jffs2_read_inode() returning\n")); - return 0; -} - - -void jffs2_gc_release_inode(struct jffs2_sb_info *c, - struct jffs2_inode_info *f) -{ - jffs2_iput(OFNI_EDONI_2SFFJ(f)); -} - -struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, - int inum, int nlink) -{ - struct _inode *inode; - struct jffs2_inode_cache *ic; - if (!nlink) { - /* The inode has zero nlink but its nodes weren't yet marked - obsolete. This has to be because we're still waiting for - the final (close() and) jffs2_iput() to happen. - - There's a possibility that the final jffs2_iput() could have - happened while we were contemplating. In order to ensure - that we don't cause a new read_inode() (which would fail) - for the inode in question, we use ilookup() in this case - instead of jffs2_iget(). - - The nlink can't _become_ zero at this point because we're - holding the alloc_sem, and jffs2_do_unlink() would also - need that while decrementing nlink on any inode. - */ - inode = ilookup(OFNI_BS_2SFFJ(c), inum); - if (!inode) { - D1(printk(KERN_DEBUG "ilookup() failed for ino #%u; inode is probably deleted.\n", - inum)); - - spin_lock(&c->inocache_lock); - ic = jffs2_get_ino_cache(c, inum); - if (!ic) { - D1(printk(KERN_DEBUG "Inode cache for ino #%u is gone.\n", inum)); - spin_unlock(&c->inocache_lock); - return NULL; - } - if (ic->state != INO_STATE_CHECKEDABSENT) { - /* Wait for progress. Don't just loop */ - D1(printk(KERN_DEBUG "Waiting for ino #%u in state %d\n", - ic->ino, ic->state)); - sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); - } else { - spin_unlock(&c->inocache_lock); - } - - return NULL; - } - } else { - /* Inode has links to it still; they're not going away because - jffs2_do_unlink() would need the alloc_sem and we have it. - Just jffs2_iget() it, and if read_inode() is necessary that's OK. - */ - inode = jffs2_iget(OFNI_BS_2SFFJ(c), inum); - if (IS_ERR(inode)) - return (void *)inode; - } - - return JFFS2_INODE_INFO(inode); -} - - - -uint32_t jffs2_from_os_mode(uint32_t osmode) -{ - uint32_t jmode = ((osmode & S_IRUSR)?00400:0) | - ((osmode & S_IWUSR)?00200:0) | - ((osmode & S_IXUSR)?00100:0) | - ((osmode & S_IRGRP)?00040:0) | - ((osmode & S_IWGRP)?00020:0) | - ((osmode & S_IXGRP)?00010:0) | - ((osmode & S_IROTH)?00004:0) | - ((osmode & S_IWOTH)?00002:0) | - ((osmode & S_IXOTH)?00001:0); - - switch (osmode & S_IFMT) { -// case S_IFSOCK: -// return jmode | 0140000; -// case S_IFLNK: -// return jmode | 0120000; - case S_IFREG: - return jmode | 0100000; - case S_IFBLK: - return jmode | 0060000; - case S_IFDIR: - return jmode | 0040000; - case S_IFCHR: - return jmode | 0020000; - case S_IFIFO: - return jmode | 0010000; - case S_ISUID: - return jmode | 0004000; - case S_ISGID: - return jmode | 0002000; -#ifdef S_ISVTX - case S_ISVTX: - return jmode | 0001000; -#endif - } - printf("os_to_jffs2_mode() cannot convert 0x%x\n", osmode); - BUG(); - return 0; -} - -uint32_t jffs2_to_os_mode (uint32_t jmode) -{ - uint32_t osmode = ((jmode & 00400)?S_IRUSR:0) | - ((jmode & 00200)?S_IWUSR:0) | - ((jmode & 00100)?S_IXUSR:0) | - ((jmode & 00040)?S_IRGRP:0) | - ((jmode & 00020)?S_IWGRP:0) | - ((jmode & 00010)?S_IXGRP:0) | - ((jmode & 00004)?S_IROTH:0) | - ((jmode & 00002)?S_IWOTH:0) | - ((jmode & 00001)?S_IXOTH:0); - - switch(jmode & 00170000) { -// case 0140000: prife -// return osmode | S_IFSOCK; prife -// case 0120000: prife -// return osmode | S_IFLNK; prife - case 0100000: - return osmode | S_IFREG; - case 0060000: - return osmode | S_IFBLK; - case 0040000: - return osmode | S_IFDIR; - case 0020000: - return osmode | S_IFCHR; - case 0010000: - return osmode | S_IFIFO; - case 0004000: - return osmode | S_ISUID; - case 0002000: - return osmode | S_ISGID; -#ifdef S_ISVTX - case 0001000: - return osmode | S_ISVTX; -#endif - } - printf("jffs2_to_os_mode() cannot convert 0x%x\n", osmode); - BUG(); - return 0; -} diff --git a/components/dfs/filesystems/jffs2/src/gc.c b/components/dfs/filesystems/jffs2/src/gc.c deleted file mode 100644 index 34ad6ca54..000000000 --- a/components/dfs/filesystems/jffs2/src/gc.c +++ /dev/null @@ -1,1271 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: gc.c,v 1.152 2005/07/24 15:14:14 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" -#include "compr.h" - -static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, - struct jffs2_inode_cache *ic, - struct jffs2_raw_node_ref *raw); -static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fd); -static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dirent *fd); -static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dirent *fd); -static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, - uint32_t start, uint32_t end); -static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, - uint32_t start, uint32_t end); -static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_node_ref *raw, struct jffs2_inode_info *f); - -/* Called with erase_completion_lock held */ -static struct jffs2_eraseblock *jffs2_find_gc_block(struct jffs2_sb_info *c) -{ - struct jffs2_eraseblock *ret; - struct list_head *nextlist = NULL; - int n = jiffies % 128; - - /* Pick an eraseblock to garbage collect next. This is where we'll - put the clever wear-levelling algorithms. Eventually. */ - /* We possibly want to favour the dirtier blocks more when the - number of free blocks is low. */ -again: - if (!list_empty(&c->bad_used_list) && c->nr_free_blocks > c->resv_blocks_gcbad) { - D1(printk(KERN_DEBUG "Picking block from bad_used_list to GC next\n")); - nextlist = &c->bad_used_list; - } else if (n < 50 && !list_empty(&c->erasable_list)) { - /* Note that most of them will have gone directly to be erased. - So don't favour the erasable_list _too_ much. */ - D1(printk(KERN_DEBUG "Picking block from erasable_list to GC next\n")); - nextlist = &c->erasable_list; - } else if (n < 110 && !list_empty(&c->very_dirty_list)) { - /* Most of the time, pick one off the very_dirty list */ - D1(printk(KERN_DEBUG "Picking block from very_dirty_list to GC next\n")); - nextlist = &c->very_dirty_list; - } else if (n < 126 && !list_empty(&c->dirty_list)) { - D1(printk(KERN_DEBUG "Picking block from dirty_list to GC next\n")); - nextlist = &c->dirty_list; - } else if (!list_empty(&c->clean_list)) { - D1(printk(KERN_DEBUG "Picking block from clean_list to GC next\n")); - nextlist = &c->clean_list; - } else if (!list_empty(&c->dirty_list)) { - D1(printk(KERN_DEBUG "Picking block from dirty_list to GC next (clean_list was empty)\n")); - - nextlist = &c->dirty_list; - } else if (!list_empty(&c->very_dirty_list)) { - D1(printk(KERN_DEBUG "Picking block from very_dirty_list to GC next (clean_list and dirty_list were empty)\n")); - nextlist = &c->very_dirty_list; - } else if (!list_empty(&c->erasable_list)) { - D1(printk(KERN_DEBUG "Picking block from erasable_list to GC next (clean_list and {very_,}dirty_list were empty)\n")); - - nextlist = &c->erasable_list; - } else if (!list_empty(&c->erasable_pending_wbuf_list)) { - /* There are blocks are wating for the wbuf sync */ - D1(printk(KERN_DEBUG "Synching wbuf in order to reuse erasable_pending_wbuf_list blocks\n")); - spin_unlock(&c->erase_completion_lock); - jffs2_flush_wbuf_pad(c); - spin_lock(&c->erase_completion_lock); - goto again; - } else { - /* Eep. All were empty */ - D1(printk(KERN_NOTICE "jffs2: No clean, dirty _or_ erasable blocks to GC from! Where are they all?\n")); - return NULL; - } - - ret = list_entry(nextlist->next, struct jffs2_eraseblock, list); - list_del(&ret->list); - c->gcblock = ret; - ret->gc_node = ret->first_node; - if (!ret->gc_node) { - printk(KERN_WARNING "Eep. ret->gc_node for block at 0x%08x is NULL\n", ret->offset); - BUG(); - } - - /* Have we accidentally picked a clean block with wasted space ? */ - if (ret->wasted_size) { - D1(printk(KERN_DEBUG "Converting wasted_size %08x to dirty_size\n", ret->wasted_size)); - ret->dirty_size += ret->wasted_size; - c->wasted_size -= ret->wasted_size; - c->dirty_size += ret->wasted_size; - ret->wasted_size = 0; - } - - return ret; -} - -/* jffs2_garbage_collect_pass - * Make a single attempt to progress GC. Move one node, and possibly - * start erasing one eraseblock. - */ -int jffs2_garbage_collect_pass(struct jffs2_sb_info *c) -{ - struct jffs2_inode_info *f; - struct jffs2_inode_cache *ic; - struct jffs2_eraseblock *jeb; - struct jffs2_raw_node_ref *raw; - int ret = 0, inum, nlink; - - if (down_interruptible(&c->alloc_sem)) - return -EINTR; - - for (;;) { - spin_lock(&c->erase_completion_lock); - if (!c->unchecked_size) - break; - - /* We can't start doing GC yet. We haven't finished checking - the node CRCs etc. Do it now. */ - - /* checked_ino is protected by the alloc_sem */ - if (c->checked_ino > c->highest_ino) { - printk(KERN_CRIT "Checked all inodes but still 0x%x bytes of unchecked space?\n", - c->unchecked_size); - jffs2_dbg_dump_block_lists_nolock(c); - spin_unlock(&c->erase_completion_lock); - BUG(); - } - - spin_unlock(&c->erase_completion_lock); - - spin_lock(&c->inocache_lock); - - ic = jffs2_get_ino_cache(c, c->checked_ino++); - - if (!ic) { - spin_unlock(&c->inocache_lock); - continue; - } - - if (!ic->nlink) { - D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink zero\n", - ic->ino)); - spin_unlock(&c->inocache_lock); - continue; - } - switch(ic->state) { - case INO_STATE_CHECKEDABSENT: - case INO_STATE_PRESENT: - D1(printk(KERN_DEBUG "Skipping ino #%u already checked\n", ic->ino)); - spin_unlock(&c->inocache_lock); - continue; - - case INO_STATE_GC: - case INO_STATE_CHECKING: - printk(KERN_WARNING "Inode #%u is in state %d during CRC check phase!\n", ic->ino, ic->state); - spin_unlock(&c->inocache_lock); - BUG(); - - case INO_STATE_READING: - /* We need to wait for it to finish, lest we move on - and trigger the BUG() above while we haven't yet - finished checking all its nodes */ - D1(printk(KERN_DEBUG "Waiting for ino #%u to finish reading\n", ic->ino)); - up(&c->alloc_sem); - sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); - return 0; - - default: - BUG(); - - case INO_STATE_UNCHECKED: - ; - } - ic->state = INO_STATE_CHECKING; - spin_unlock(&c->inocache_lock); - - D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() triggering inode scan of ino#%u\n", ic->ino)); - - ret = jffs2_do_crccheck_inode(c, ic); - if (ret) - printk(KERN_WARNING "Returned error for crccheck of ino #%u. Expect badness...\n", ic->ino); - - jffs2_set_inocache_state(c, ic, INO_STATE_CHECKEDABSENT); - up(&c->alloc_sem); - return ret; - } - - /* First, work out which block we're garbage-collecting */ - jeb = c->gcblock; - - if (!jeb) - jeb = jffs2_find_gc_block(c); - - if (!jeb) { - D1 (printk(KERN_NOTICE "jffs2: Couldn't find erase block to garbage collect!\n")); - spin_unlock(&c->erase_completion_lock); - up(&c->alloc_sem); - return -EIO; - } - - D1(printk(KERN_DEBUG "GC from block %08x, used_size %08x, dirty_size %08x, free_size %08x\n", jeb->offset, jeb->used_size, jeb->dirty_size, jeb->free_size)); - D1(if (c->nextblock) - printk(KERN_DEBUG "Nextblock at %08x, used_size %08x, dirty_size %08x, wasted_size %08x, free_size %08x\n", c->nextblock->offset, c->nextblock->used_size, c->nextblock->dirty_size, c->nextblock->wasted_size, c->nextblock->free_size)); - - if (!jeb->used_size) { - up(&c->alloc_sem); - goto eraseit; - } - - raw = jeb->gc_node; - - while(ref_obsolete(raw)) { - D1(printk(KERN_DEBUG "Node at 0x%08x is obsolete... skipping\n", ref_offset(raw))); - raw = raw->next_phys; - if (unlikely(!raw)) { - printk(KERN_WARNING "eep. End of raw list while still supposedly nodes to GC\n"); - printk(KERN_WARNING "erase block at 0x%08x. free_size 0x%08x, dirty_size 0x%08x, used_size 0x%08x\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size); - jeb->gc_node = raw; - spin_unlock(&c->erase_completion_lock); - up(&c->alloc_sem); - BUG(); - } - } - jeb->gc_node = raw; - - D1(printk(KERN_DEBUG "Going to garbage collect node at 0x%08x\n", ref_offset(raw))); - - if (!raw->next_in_ino) { - /* Inode-less node. Clean marker, snapshot or something like that */ - /* FIXME: If it's something that needs to be copied, including something - we don't grok that has JFFS2_NODETYPE_RWCOMPAT_COPY, we should do so */ - spin_unlock(&c->erase_completion_lock); - jffs2_mark_node_obsolete(c, raw); - up(&c->alloc_sem); - goto eraseit_lock; - } - - ic = jffs2_raw_ref_to_ic(raw); - - /* We need to hold the inocache. Either the erase_completion_lock or - the inocache_lock are sufficient; we trade down since the inocache_lock - causes less contention. */ - spin_lock(&c->inocache_lock); - - spin_unlock(&c->erase_completion_lock); - - D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass collecting from block @0x%08x. Node @0x%08x(%d), ino #%u\n", jeb->offset, ref_offset(raw), ref_flags(raw), ic->ino)); - - /* Three possibilities: - 1. Inode is already in-core. We must iget it and do proper - updating to its fragtree, etc. - 2. Inode is not in-core, node is REF_PRISTINE. We lock the - inocache to prevent a read_inode(), copy the node intact. - 3. Inode is not in-core, node is not pristine. We must iget() - and take the slow path. - */ - - switch(ic->state) { - case INO_STATE_CHECKEDABSENT: - /* It's been checked, but it's not currently in-core. - We can just copy any pristine nodes, but have - to prevent anyone else from doing read_inode() while - we're at it, so we set the state accordingly */ - if (ref_flags(raw) == REF_PRISTINE) - ic->state = INO_STATE_GC; - else { - D1(printk(KERN_DEBUG "Ino #%u is absent but node not REF_PRISTINE. Reading.\n", - ic->ino)); - } - break; - - case INO_STATE_PRESENT: - /* It's in-core. GC must iget() it. */ - break; - - case INO_STATE_UNCHECKED: - case INO_STATE_CHECKING: - case INO_STATE_GC: - /* Should never happen. We should have finished checking - by the time we actually start doing any GC, and since - we're holding the alloc_sem, no other garbage collection - can happen. - */ - printk(KERN_CRIT "Inode #%u already in state %d in jffs2_garbage_collect_pass()!\n", - ic->ino, ic->state); - up(&c->alloc_sem); - spin_unlock(&c->inocache_lock); - BUG(); - - case INO_STATE_READING: - /* Someone's currently trying to read it. We must wait for - them to finish and then go through the full iget() route - to do the GC. However, sometimes read_inode() needs to get - the alloc_sem() (for marking nodes invalid) so we must - drop the alloc_sem before sleeping. */ - - up(&c->alloc_sem); - D1(printk(KERN_DEBUG "jffs2_garbage_collect_pass() waiting for ino #%u in state %d\n", - ic->ino, ic->state)); - sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); - /* And because we dropped the alloc_sem we must start again from the - beginning. Ponder chance of livelock here -- we're returning success - without actually making any progress. - - Q: What are the chances that the inode is back in INO_STATE_READING - again by the time we next enter this function? And that this happens - enough times to cause a real delay? - - A: Small enough that I don't care :) - */ - return 0; - } - - /* OK. Now if the inode is in state INO_STATE_GC, we are going to copy the - node intact, and we don't have to muck about with the fragtree etc. - because we know it's not in-core. If it _was_ in-core, we go through - all the iget() crap anyway */ - - if (ic->state == INO_STATE_GC) { - spin_unlock(&c->inocache_lock); - - ret = jffs2_garbage_collect_pristine(c, ic, raw); - - spin_lock(&c->inocache_lock); - ic->state = INO_STATE_CHECKEDABSENT; - wake_up(&c->inocache_wq); - - if (ret != -EBADFD) { - spin_unlock(&c->inocache_lock); - goto release_sem; - } - - /* Fall through if it wanted us to, with inocache_lock held */ - } - - /* Prevent the fairly unlikely race where the gcblock is - entirely obsoleted by the final close of a file which had - the only valid nodes in the block, followed by erasure, - followed by freeing of the ic because the erased block(s) - held _all_ the nodes of that inode.... never been seen but - it's vaguely possible. */ - - inum = ic->ino; - nlink = ic->nlink; - spin_unlock(&c->inocache_lock); - - f = jffs2_gc_fetch_inode(c, inum, nlink); - if (IS_ERR(f)) { - ret = PTR_ERR(f); - goto release_sem; - } - if (!f) { - ret = 0; - goto release_sem; - } - - ret = jffs2_garbage_collect_live(c, jeb, raw, f); - - jffs2_gc_release_inode(c, f); - - release_sem: - up(&c->alloc_sem); - - eraseit_lock: - /* If we've finished this block, start it erasing */ - spin_lock(&c->erase_completion_lock); - - eraseit: - if (c->gcblock && !c->gcblock->used_size) { - D1(printk(KERN_DEBUG "Block at 0x%08x completely obsoleted by GC. Moving to erase_pending_list\n", c->gcblock->offset)); - /* We're GC'ing an empty block? */ - list_add_tail(&c->gcblock->list, &c->erase_pending_list); - c->gcblock = NULL; - c->nr_erasing_blocks++; - jffs2_erase_pending_trigger(c); - } - spin_unlock(&c->erase_completion_lock); - - return ret; -} - -static int jffs2_garbage_collect_live(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_node_ref *raw, struct jffs2_inode_info *f) -{ - struct jffs2_node_frag *frag; - struct jffs2_full_dnode *fn = NULL; - struct jffs2_full_dirent *fd; - uint32_t start = 0, end = 0, nrfrags = 0; - int ret = 0; - - down(&f->sem); - - /* Now we have the lock for this inode. Check that it's still the one at the head - of the list. */ - - spin_lock(&c->erase_completion_lock); - - if (c->gcblock != jeb) { - spin_unlock(&c->erase_completion_lock); - D1(printk(KERN_DEBUG "GC block is no longer gcblock. Restart\n")); - goto upnout; - } - if (ref_obsolete(raw)) { - spin_unlock(&c->erase_completion_lock); - D1(printk(KERN_DEBUG "node to be GC'd was obsoleted in the meantime.\n")); - /* They'll call again */ - goto upnout; - } - spin_unlock(&c->erase_completion_lock); - - /* OK. Looks safe. And nobody can get us now because we have the semaphore. Move the block */ - if (f->metadata && f->metadata->raw == raw) { - fn = f->metadata; - ret = jffs2_garbage_collect_metadata(c, jeb, f, fn); - goto upnout; - } - - /* FIXME. Read node and do lookup? */ - for (frag = frag_first(&f->fragtree); frag; frag = frag_next(frag)) { - if (frag->node && frag->node->raw == raw) { - fn = frag->node; - end = frag->ofs + frag->size; - if (!nrfrags++) - start = frag->ofs; - if (nrfrags == frag->node->frags) - break; /* We've found them all */ - } - } - if (fn) { - if (ref_flags(raw) == REF_PRISTINE) { - ret = jffs2_garbage_collect_pristine(c, f->inocache, raw); - if (!ret) { - /* Urgh. Return it sensibly. */ - frag->node->raw = f->inocache->nodes; - } - if (ret != -EBADFD) - goto upnout; - } - /* We found a datanode. Do the GC */ - if((start >> PAGE_CACHE_SHIFT) < ((end-1) >> PAGE_CACHE_SHIFT)) { - /* It crosses a page boundary. Therefore, it must be a hole. */ - ret = jffs2_garbage_collect_hole(c, jeb, f, fn, start, end); - } else { - /* It could still be a hole. But we GC the page this way anyway */ - ret = jffs2_garbage_collect_dnode(c, jeb, f, fn, start, end); - } - goto upnout; - } - - /* Wasn't a dnode. Try dirent */ - for (fd = f->dents; fd; fd=fd->next) { - if (fd->raw == raw) - break; - } - - if (fd && fd->ino) { - ret = jffs2_garbage_collect_dirent(c, jeb, f, fd); - } else if (fd) { - ret = jffs2_garbage_collect_deletion_dirent(c, jeb, f, fd); - } else { - printk(KERN_WARNING "Raw node at 0x%08x wasn't in node lists for ino #%u\n", - ref_offset(raw), f->inocache->ino); - if (ref_obsolete(raw)) { - printk(KERN_WARNING "But it's obsolete so we don't mind too much\n"); - } else { - jffs2_dbg_dump_node(c, ref_offset(raw)); - BUG(); - } - } - upnout: - up(&f->sem); - - return ret; -} - -static int jffs2_garbage_collect_pristine(struct jffs2_sb_info *c, - struct jffs2_inode_cache *ic, - struct jffs2_raw_node_ref *raw) -{ - union jffs2_node_union *node; - struct jffs2_raw_node_ref *nraw; - size_t retlen; - int ret; - uint32_t phys_ofs, alloclen; - uint32_t crc, rawlen; - int retried = 0; - - D1(printk(KERN_DEBUG "Going to GC REF_PRISTINE node at 0x%08x\n", ref_offset(raw))); - - rawlen = ref_totlen(c, c->gcblock, raw); - - /* Ask for a small amount of space (or the totlen if smaller) because we - don't want to force wastage of the end of a block if splitting would - work. */ - ret = jffs2_reserve_space_gc(c, min_t(uint32_t, sizeof(struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN, - rawlen), &phys_ofs, &alloclen); - if (ret) - return ret; - - if (alloclen < rawlen) { - /* Doesn't fit untouched. We'll go the old route and split it */ - return -EBADFD; - } - - node = kmalloc(rawlen, GFP_KERNEL); - if (!node) - return -ENOMEM; - - ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (unsigned char *)node); - if (!ret && retlen != rawlen) - ret = -EIO; - if (ret) - goto out_node; - - crc = crc32(0, node, sizeof(struct jffs2_unknown_node)-4); - if (je32_to_cpu(node->u.hdr_crc) != crc) { - printk(KERN_WARNING "Header CRC failed on REF_PRISTINE node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ref_offset(raw), je32_to_cpu(node->u.hdr_crc), crc); - goto bail; - } - - switch(je16_to_cpu(node->u.nodetype)) { - case JFFS2_NODETYPE_INODE: - crc = crc32(0, node, sizeof(node->i)-8); - if (je32_to_cpu(node->i.node_crc) != crc) { - printk(KERN_WARNING "Node CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ref_offset(raw), je32_to_cpu(node->i.node_crc), crc); - goto bail; - } - - if (je32_to_cpu(node->i.dsize)) { - crc = crc32(0, node->i.data, je32_to_cpu(node->i.csize)); - if (je32_to_cpu(node->i.data_crc) != crc) { - printk(KERN_WARNING "Data CRC failed on REF_PRISTINE data node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ref_offset(raw), je32_to_cpu(node->i.data_crc), crc); - goto bail; - } - } - break; - - case JFFS2_NODETYPE_DIRENT: - crc = crc32(0, node, sizeof(node->d)-8); - if (je32_to_cpu(node->d.node_crc) != crc) { - printk(KERN_WARNING "Node CRC failed on REF_PRISTINE dirent node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ref_offset(raw), je32_to_cpu(node->d.node_crc), crc); - goto bail; - } - - if (node->d.nsize) { - crc = crc32(0, node->d.name, node->d.nsize); - if (je32_to_cpu(node->d.name_crc) != crc) { - printk(KERN_WARNING "Name CRC failed on REF_PRISTINE dirent ode at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ref_offset(raw), je32_to_cpu(node->d.name_crc), crc); - goto bail; - } - } - break; - default: - printk(KERN_WARNING "Unknown node type for REF_PRISTINE node at 0x%08x: 0x%04x\n", - ref_offset(raw), je16_to_cpu(node->u.nodetype)); - goto bail; - } - - nraw = jffs2_alloc_raw_node_ref(); - if (!nraw) { - ret = -ENOMEM; - goto out_node; - } - - /* OK, all the CRCs are good; this node can just be copied as-is. */ - retry: - nraw->flash_offset = phys_ofs; - nraw->__totlen = rawlen; - nraw->next_phys = NULL; - - ret = jffs2_flash_write(c, phys_ofs, rawlen, &retlen, (unsigned char *)node); - - if (ret || (retlen != rawlen)) { - printk(KERN_NOTICE "Write of %d bytes at 0x%08x failed. returned %d, retlen %zd\n", - rawlen, phys_ofs, ret, retlen); - if (retlen) { - /* Doesn't belong to any inode */ - nraw->next_in_ino = NULL; - - nraw->flash_offset |= REF_OBSOLETE; - jffs2_add_physical_node_ref(c, nraw); - jffs2_mark_node_obsolete(c, nraw); - } else { - printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", nraw->flash_offset); - jffs2_free_raw_node_ref(nraw); - } - if (!retried && (nraw = jffs2_alloc_raw_node_ref())) { - /* Try to reallocate space and retry */ - uint32_t dummy; - struct jffs2_eraseblock *jeb = &c->blocks[phys_ofs / c->sector_size]; - - retried = 1; - - D1(printk(KERN_DEBUG "Retrying failed write of REF_PRISTINE node.\n")); - - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - - ret = jffs2_reserve_space_gc(c, rawlen, &phys_ofs, &dummy); - - if (!ret) { - D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", phys_ofs)); - - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - - goto retry; - } - D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret)); - jffs2_free_raw_node_ref(nraw); - } - - jffs2_free_raw_node_ref(nraw); - if (!ret) - ret = -EIO; - goto out_node; - } - nraw->flash_offset |= REF_PRISTINE; - jffs2_add_physical_node_ref(c, nraw); - - /* Link into per-inode list. This is safe because of the ic - state being INO_STATE_GC. Note that if we're doing this - for an inode which is in-core, the 'nraw' pointer is then - going to be fetched from ic->nodes by our caller. */ - spin_lock(&c->erase_completion_lock); - nraw->next_in_ino = ic->nodes; - ic->nodes = nraw; - spin_unlock(&c->erase_completion_lock); - - jffs2_mark_node_obsolete(c, raw); - D1(printk(KERN_DEBUG "WHEEE! GC REF_PRISTINE node at 0x%08x succeeded\n", ref_offset(raw))); - - out_node: - kfree(node); - return ret; - bail: - ret = -EBADFD; - goto out_node; -} - -static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fn) -{ - struct jffs2_full_dnode *new_fn; - struct jffs2_raw_inode ri; - struct jffs2_node_frag *last_frag; - jint16_t dev; - char *mdata = NULL, mdatalen = 0; - uint32_t alloclen, phys_ofs, ilen; - int ret; - - if (S_ISBLK(JFFS2_F_I_MODE(f)) || - S_ISCHR(JFFS2_F_I_MODE(f)) ) { - /* For these, we don't actually need to read the old node */ - /* FIXME: for minor or major > 255. */ - dev = cpu_to_je16(((JFFS2_F_I_RDEV_MAJ(f) << 8) | - JFFS2_F_I_RDEV_MIN(f))); - mdata = (char *)&dev; - mdatalen = sizeof(dev); - D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bytes of kdev_t\n", mdatalen)); - } else if (S_ISLNK(JFFS2_F_I_MODE(f))) { - mdatalen = fn->size; - mdata = kmalloc(fn->size, GFP_KERNEL); - if (!mdata) { - printk(KERN_WARNING "kmalloc of mdata failed in jffs2_garbage_collect_metadata()\n"); - return -ENOMEM; - } - ret = jffs2_read_dnode(c, f, fn, (unsigned char *)mdata, 0, mdatalen); - if (ret) { - printk(KERN_WARNING "read of old metadata failed in jffs2_garbage_collect_metadata(): %d\n", ret); - kfree(mdata); - return ret; - } - D1(printk(KERN_DEBUG "jffs2_garbage_collect_metadata(): Writing %d bites of symlink target\n", mdatalen)); - - } - - ret = jffs2_reserve_space_gc(c, sizeof(ri) + mdatalen, &phys_ofs, &alloclen); - if (ret) { - printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_metadata failed: %d\n", - sizeof(ri)+ mdatalen, ret); - goto out; - } - - last_frag = frag_last(&f->fragtree); - if (last_frag) - /* Fetch the inode length from the fragtree rather then - * from i_size since i_size may have not been updated yet */ - ilen = last_frag->ofs + last_frag->size; - else - ilen = JFFS2_F_I_SIZE(f); - - memset(&ri, 0, sizeof(ri)); - ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri.totlen = cpu_to_je32(sizeof(ri) + mdatalen); - ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4)); - - ri.ino = cpu_to_je32(f->inocache->ino); - ri.version = cpu_to_je32(++f->highest_version); - ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f)); - ri.uid = cpu_to_je16(JFFS2_F_I_UID(f)); - ri.gid = cpu_to_je16(JFFS2_F_I_GID(f)); - ri.isize = cpu_to_je32(ilen); - ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f)); - ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f)); - ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f)); - ri.offset = cpu_to_je32(0); - ri.csize = cpu_to_je32(mdatalen); - ri.dsize = cpu_to_je32(mdatalen); - ri.compr = JFFS2_COMPR_NONE; - ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); - ri.data_crc = cpu_to_je32(crc32(0, mdata, mdatalen)); - - new_fn = jffs2_write_dnode(c, f, &ri, (const unsigned char *)mdata, mdatalen, phys_ofs, ALLOC_GC); - - if (IS_ERR(new_fn)) { - printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); - ret = PTR_ERR(new_fn); - goto out; - } - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - f->metadata = new_fn; - out: - if (S_ISLNK(JFFS2_F_I_MODE(f))) - kfree(mdata); - return ret; -} - -static int jffs2_garbage_collect_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dirent *fd) -{ - struct jffs2_full_dirent *new_fd; - struct jffs2_raw_dirent rd; - uint32_t alloclen, phys_ofs; - int ret; - - rd.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - rd.nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); - rd.nsize = strlen((const char *)fd->name); - rd.totlen = cpu_to_je32(sizeof(rd) + rd.nsize); - rd.hdr_crc = cpu_to_je32(crc32(0, &rd, sizeof(struct jffs2_unknown_node)-4)); - - rd.pino = cpu_to_je32(f->inocache->ino); - rd.version = cpu_to_je32(++f->highest_version); - rd.ino = cpu_to_je32(fd->ino); - rd.mctime = cpu_to_je32(max(JFFS2_F_I_MTIME(f), JFFS2_F_I_CTIME(f))); - rd.type = fd->type; - rd.node_crc = cpu_to_je32(crc32(0, &rd, sizeof(rd)-8)); - rd.name_crc = cpu_to_je32(crc32(0, fd->name, rd.nsize)); - - ret = jffs2_reserve_space_gc(c, sizeof(rd)+rd.nsize, &phys_ofs, &alloclen); - if (ret) { - printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dirent failed: %d\n", - sizeof(rd)+rd.nsize, ret); - return ret; - } - new_fd = jffs2_write_dirent(c, f, &rd, fd->name, rd.nsize, phys_ofs, ALLOC_GC); - - if (IS_ERR(new_fd)) { - printk(KERN_WARNING "jffs2_write_dirent in garbage_collect_dirent failed: %ld\n", PTR_ERR(new_fd)); - return PTR_ERR(new_fd); - } - jffs2_add_fd_to_list(c, new_fd, &f->dents); - return 0; -} - -static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dirent *fd) -{ - struct jffs2_full_dirent **fdp = &f->dents; - int found = 0; - - /* On a medium where we can't actually mark nodes obsolete - pernamently, such as NAND flash, we need to work out - whether this deletion dirent is still needed to actively - delete a 'real' dirent with the same name that's still - somewhere else on the flash. */ - if (!jffs2_can_mark_obsolete(c)) { - struct jffs2_raw_dirent *rd; - struct jffs2_raw_node_ref *raw; - int ret; - size_t retlen; - int name_len = strlen((const char *)fd->name); - uint32_t name_crc = crc32(0, fd->name, name_len); - uint32_t rawlen = ref_totlen(c, jeb, fd->raw); - - rd = kmalloc(rawlen, GFP_KERNEL); - if (!rd) - return -ENOMEM; - - /* Prevent the erase code from nicking the obsolete node refs while - we're looking at them. I really don't like this extra lock but - can't see any alternative. Suggestions on a postcard to... */ - down(&c->erase_free_sem); - - for (raw = f->inocache->nodes; raw != (void *)f->inocache; raw = raw->next_in_ino) { - - /* We only care about obsolete ones */ - if (!(ref_obsolete(raw))) - continue; - - /* Any dirent with the same name is going to have the same length... */ - if (ref_totlen(c, NULL, raw) != rawlen) - continue; - - /* Doesn't matter if there's one in the same erase block. We're going to - delete it too at the same time. */ - if (SECTOR_ADDR(raw->flash_offset) == SECTOR_ADDR(fd->raw->flash_offset)) - continue; - - D1(printk(KERN_DEBUG "Check potential deletion dirent at %08x\n", ref_offset(raw))); - - /* This is an obsolete node belonging to the same directory, and it's of the right - length. We need to take a closer look...*/ - ret = jffs2_flash_read(c, ref_offset(raw), rawlen, &retlen, (unsigned char *)rd); - if (ret) { - printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Read error (%d) reading obsolete node at %08x\n", ret, ref_offset(raw)); - /* If we can't read it, we don't need to continue to obsolete it. Continue */ - continue; - } - if (retlen != rawlen) { - printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %u) reading header from obsolete node at %08x\n", - retlen, rawlen, ref_offset(raw)); - continue; - } - - if (je16_to_cpu(rd->nodetype) != JFFS2_NODETYPE_DIRENT) - continue; - - /* If the name CRC doesn't match, skip */ - if (je32_to_cpu(rd->name_crc) != name_crc) - continue; - - /* If the name length doesn't match, or it's another deletion dirent, skip */ - if (rd->nsize != name_len || !je32_to_cpu(rd->ino)) - continue; - - /* OK, check the actual name now */ - if (memcmp(rd->name, fd->name, name_len)) - continue; - - /* OK. The name really does match. There really is still an older node on - the flash which our deletion dirent obsoletes. So we have to write out - a new deletion dirent to replace it */ - up(&c->erase_free_sem); - - D1(printk(KERN_DEBUG "Deletion dirent at %08x still obsoletes real dirent \"%s\" at %08x for ino #%u\n", - ref_offset(fd->raw), fd->name, ref_offset(raw), je32_to_cpu(rd->ino))); - kfree(rd); - - return jffs2_garbage_collect_dirent(c, jeb, f, fd); - } - - up(&c->erase_free_sem); - kfree(rd); - } - - /* No need for it any more. Just mark it obsolete and remove it from the list */ - while (*fdp) { - if ((*fdp) == fd) { - found = 1; - *fdp = fd->next; - break; - } - fdp = &(*fdp)->next; - } - if (!found) { - printk(KERN_WARNING "Deletion dirent \"%s\" not found in list for ino #%u\n", fd->name, f->inocache->ino); - } - jffs2_mark_node_obsolete(c, fd->raw); - jffs2_free_full_dirent(fd); - return 0; -} - -static int jffs2_garbage_collect_hole(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, - uint32_t start, uint32_t end) -{ - struct jffs2_raw_inode ri; - struct jffs2_node_frag *frag; - struct jffs2_full_dnode *new_fn; - uint32_t alloclen, phys_ofs, ilen; - int ret; - - D1(printk(KERN_DEBUG "Writing replacement hole node for ino #%u from offset 0x%x to 0x%x\n", - f->inocache->ino, start, end)); - - memset(&ri, 0, sizeof(ri)); - - if(fn->frags > 1) { - size_t readlen; - uint32_t crc; - /* It's partially obsoleted by a later write. So we have to - write it out again with the _same_ version as before */ - ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(ri), &readlen, (unsigned char *)&ri); - if (readlen != sizeof(ri) || ret) { - printk(KERN_WARNING "Node read failed in jffs2_garbage_collect_hole. Ret %d, retlen %zd. Data will be lost by writing new hole node\n", ret, readlen); - goto fill; - } - if (je16_to_cpu(ri.nodetype) != JFFS2_NODETYPE_INODE) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had node type 0x%04x instead of JFFS2_NODETYPE_INODE(0x%04x)\n", - ref_offset(fn->raw), - je16_to_cpu(ri.nodetype), JFFS2_NODETYPE_INODE); - return -EIO; - } - if (je32_to_cpu(ri.totlen) != sizeof(ri)) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had totlen 0x%x instead of expected 0x%zx\n", - ref_offset(fn->raw), - je32_to_cpu(ri.totlen), sizeof(ri)); - return -EIO; - } - crc = crc32(0, &ri, sizeof(ri)-8); - if (crc != je32_to_cpu(ri.node_crc)) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Node at 0x%08x had CRC 0x%08x which doesn't match calculated CRC 0x%08x\n", - ref_offset(fn->raw), - je32_to_cpu(ri.node_crc), crc); - /* FIXME: We could possibly deal with this by writing new holes for each frag */ - printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", - start, end, f->inocache->ino); - goto fill; - } - if (ri.compr != JFFS2_COMPR_ZERO) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Node 0x%08x wasn't a hole node!\n", ref_offset(fn->raw)); - printk(KERN_WARNING "Data in the range 0x%08x to 0x%08x of inode #%u will be lost\n", - start, end, f->inocache->ino); - goto fill; - } - } else { - fill: - ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri.totlen = cpu_to_je32(sizeof(ri)); - ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4)); - - ri.ino = cpu_to_je32(f->inocache->ino); - ri.version = cpu_to_je32(++f->highest_version); - ri.offset = cpu_to_je32(start); - ri.dsize = cpu_to_je32(end - start); - ri.csize = cpu_to_je32(0); - ri.compr = JFFS2_COMPR_ZERO; - } - - frag = frag_last(&f->fragtree); - if (frag) - /* Fetch the inode length from the fragtree rather then - * from i_size since i_size may have not been updated yet */ - ilen = frag->ofs + frag->size; - else - ilen = JFFS2_F_I_SIZE(f); - - ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f)); - ri.uid = cpu_to_je16(JFFS2_F_I_UID(f)); - ri.gid = cpu_to_je16(JFFS2_F_I_GID(f)); - ri.isize = cpu_to_je32(ilen); - ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f)); - ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f)); - ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f)); - ri.data_crc = cpu_to_je32(0); - ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); - - ret = jffs2_reserve_space_gc(c, sizeof(ri), &phys_ofs, &alloclen); - if (ret) { - printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_hole failed: %d\n", - sizeof(ri), ret); - return ret; - } - new_fn = jffs2_write_dnode(c, f, &ri, NULL, 0, phys_ofs, ALLOC_GC); - - if (IS_ERR(new_fn)) { - printk(KERN_WARNING "Error writing new hole node: %ld\n", PTR_ERR(new_fn)); - return PTR_ERR(new_fn); - } - if (je32_to_cpu(ri.version) == f->highest_version) { - jffs2_add_full_dnode_to_inode(c, f, new_fn); - if (f->metadata) { - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - f->metadata = NULL; - } - return 0; - } - - /* - * We should only get here in the case where the node we are - * replacing had more than one frag, so we kept the same version - * number as before. (Except in case of error -- see 'goto fill;' - * above.) - */ - D1(if(unlikely(fn->frags <= 1)) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Replacing fn with %d frag(s) but new ver %d != highest_version %d of ino #%d\n", - fn->frags, je32_to_cpu(ri.version), f->highest_version, - je32_to_cpu(ri.ino)); - }); - - /* This is a partially-overlapped hole node. Mark it REF_NORMAL not REF_PRISTINE */ - mark_ref_normal(new_fn->raw); - - for (frag = jffs2_lookup_node_frag(&f->fragtree, fn->ofs); - frag; frag = frag_next(frag)) { - if (frag->ofs > fn->size + fn->ofs) - break; - if (frag->node == fn) { - frag->node = new_fn; - new_fn->frags++; - fn->frags--; - } - } - if (fn->frags) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: Old node still has frags!\n"); - BUG(); - } - if (!new_fn->frags) { - printk(KERN_WARNING "jffs2_garbage_collect_hole: New node has no frags!\n"); - BUG(); - } - - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - - return 0; -} - -static int jffs2_garbage_collect_dnode(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_inode_info *f, struct jffs2_full_dnode *fn, - uint32_t start, uint32_t end) -{ - struct jffs2_full_dnode *new_fn; - struct jffs2_raw_inode ri; - uint32_t alloclen, phys_ofs, offset, orig_end, orig_start; - int ret = 0; - unsigned char *comprbuf = NULL, *writebuf; - unsigned long pg; - unsigned char *pg_ptr; - - memset(&ri, 0, sizeof(ri)); - - D1(printk(KERN_DEBUG "Writing replacement dnode for ino #%u from offset 0x%x to 0x%x\n", - f->inocache->ino, start, end)); - - orig_end = end; - orig_start = start; - - if (c->nr_free_blocks + c->nr_erasing_blocks > c->resv_blocks_gcmerge) { - /* Attempt to do some merging. But only expand to cover logically - adjacent frags if the block containing them is already considered - to be dirty. Otherwise we end up with GC just going round in - circles dirtying the nodes it already wrote out, especially - on NAND where we have small eraseblocks and hence a much higher - chance of nodes having to be split to cross boundaries. */ - - struct jffs2_node_frag *frag; - uint32_t min, max; - - min = start & ~(PAGE_CACHE_SIZE-1); - max = min + PAGE_CACHE_SIZE; - - frag = jffs2_lookup_node_frag(&f->fragtree, start); - - /* BUG_ON(!frag) but that'll happen anyway... */ - - BUG_ON(frag->ofs != start); - - /* First grow down... */ - while((frag = frag_prev(frag)) && frag->ofs >= min) { - - /* If the previous frag doesn't even reach the beginning, there's - excessive fragmentation. Just merge. */ - if (frag->ofs > min) { - D1(printk(KERN_DEBUG "Expanding down to cover partial frag (0x%x-0x%x)\n", - frag->ofs, frag->ofs+frag->size)); - start = frag->ofs; - continue; - } - /* OK. This frag holds the first byte of the page. */ - if (!frag->node || !frag->node->raw) { - D1(printk(KERN_DEBUG "First frag in page is hole (0x%x-0x%x). Not expanding down.\n", - frag->ofs, frag->ofs+frag->size)); - break; - } else { - - /* OK, it's a frag which extends to the beginning of the page. Does it live - in a block which is still considered clean? If so, don't obsolete it. - If not, cover it anyway. */ - - struct jffs2_raw_node_ref *raw = frag->node->raw; - struct jffs2_eraseblock *jeb; - - jeb = &c->blocks[raw->flash_offset / c->sector_size]; - - if (jeb == c->gcblock) { - D1(printk(KERN_DEBUG "Expanding down to cover frag (0x%x-0x%x) in gcblock at %08x\n", - frag->ofs, frag->ofs+frag->size, ref_offset(raw))); - start = frag->ofs; - break; - } - if (!ISDIRTY(jeb->dirty_size + jeb->wasted_size)) { - D1(printk(KERN_DEBUG "Not expanding down to cover frag (0x%x-0x%x) in clean block %08x\n", - frag->ofs, frag->ofs+frag->size, jeb->offset)); - break; - } - - D1(printk(KERN_DEBUG "Expanding down to cover frag (0x%x-0x%x) in dirty block %08x\n", - frag->ofs, frag->ofs+frag->size, jeb->offset)); - start = frag->ofs; - break; - } - } - - /* ... then up */ - - /* Find last frag which is actually part of the node we're to GC. */ - frag = jffs2_lookup_node_frag(&f->fragtree, end-1); - - while((frag = frag_next(frag)) && frag->ofs+frag->size <= max) { - - /* If the previous frag doesn't even reach the beginning, there's lots - of fragmentation. Just merge. */ - if (frag->ofs+frag->size < max) { - D1(printk(KERN_DEBUG "Expanding up to cover partial frag (0x%x-0x%x)\n", - frag->ofs, frag->ofs+frag->size)); - end = frag->ofs + frag->size; - continue; - } - - if (!frag->node || !frag->node->raw) { - D1(printk(KERN_DEBUG "Last frag in page is hole (0x%x-0x%x). Not expanding up.\n", - frag->ofs, frag->ofs+frag->size)); - break; - } else { - - /* OK, it's a frag which extends to the beginning of the page. Does it live - in a block which is still considered clean? If so, don't obsolete it. - If not, cover it anyway. */ - - struct jffs2_raw_node_ref *raw = frag->node->raw; - struct jffs2_eraseblock *jeb; - - jeb = &c->blocks[raw->flash_offset / c->sector_size]; - - if (jeb == c->gcblock) { - D1(printk(KERN_DEBUG "Expanding up to cover frag (0x%x-0x%x) in gcblock at %08x\n", - frag->ofs, frag->ofs+frag->size, ref_offset(raw))); - end = frag->ofs + frag->size; - break; - } - if (!ISDIRTY(jeb->dirty_size + jeb->wasted_size)) { - D1(printk(KERN_DEBUG "Not expanding up to cover frag (0x%x-0x%x) in clean block %08x\n", - frag->ofs, frag->ofs+frag->size, jeb->offset)); - break; - } - - D1(printk(KERN_DEBUG "Expanding up to cover frag (0x%x-0x%x) in dirty block %08x\n", - frag->ofs, frag->ofs+frag->size, jeb->offset)); - end = frag->ofs + frag->size; - break; - } - } - D1(printk(KERN_DEBUG "Expanded dnode to write from (0x%x-0x%x) to (0x%x-0x%x)\n", - orig_start, orig_end, start, end)); - - D1(BUG_ON(end > frag_last(&f->fragtree)->ofs + frag_last(&f->fragtree)->size)); - BUG_ON(end < orig_end); - BUG_ON(start > orig_start); - } - - /* First, use readpage() to read the appropriate page into the page cache */ - /* Q: What happens if we actually try to GC the _same_ page for which commit_write() - * triggered garbage collection in the first place? - * A: I _think_ it's OK. read_cache_page shouldn't deadlock, we'll write out the - * page OK. We'll actually write it out again in commit_write, which is a little - * suboptimal, but at least we're correct. - */ - pg_ptr = jffs2_gc_fetch_page(c, f, start, &pg); - - if (IS_ERR(pg_ptr)) { - printk(KERN_WARNING "read_cache_page() returned error: %ld\n", PTR_ERR(pg_ptr)); - return PTR_ERR(pg_ptr); - } - - offset = start; - while(offset < orig_end) { - uint32_t datalen; - uint32_t cdatalen; - uint16_t comprtype = JFFS2_COMPR_NONE; - - ret = jffs2_reserve_space_gc(c, sizeof(ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, &alloclen); - - if (ret) { - printk(KERN_WARNING "jffs2_reserve_space_gc of %zd bytes for garbage_collect_dnode failed: %d\n", - sizeof(ri)+ JFFS2_MIN_DATA_LEN, ret); - break; - } - cdatalen = min_t(uint32_t, alloclen - sizeof(ri), end - offset); - datalen = end - offset; - - writebuf = pg_ptr + (offset & (PAGE_CACHE_SIZE -1)); - - comprtype = jffs2_compress(c, f, writebuf, &comprbuf, &datalen, &cdatalen); - - ri.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri.nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri.totlen = cpu_to_je32(sizeof(ri) + cdatalen); - ri.hdr_crc = cpu_to_je32(crc32(0, &ri, sizeof(struct jffs2_unknown_node)-4)); - - ri.ino = cpu_to_je32(f->inocache->ino); - ri.version = cpu_to_je32(++f->highest_version); - ri.mode = cpu_to_jemode(JFFS2_F_I_MODE(f)); - ri.uid = cpu_to_je16(JFFS2_F_I_UID(f)); - ri.gid = cpu_to_je16(JFFS2_F_I_GID(f)); - ri.isize = cpu_to_je32(JFFS2_F_I_SIZE(f)); - ri.atime = cpu_to_je32(JFFS2_F_I_ATIME(f)); - ri.ctime = cpu_to_je32(JFFS2_F_I_CTIME(f)); - ri.mtime = cpu_to_je32(JFFS2_F_I_MTIME(f)); - ri.offset = cpu_to_je32(offset); - ri.csize = cpu_to_je32(cdatalen); - ri.dsize = cpu_to_je32(datalen); - ri.compr = comprtype & 0xff; - ri.usercompr = (comprtype >> 8) & 0xff; - ri.node_crc = cpu_to_je32(crc32(0, &ri, sizeof(ri)-8)); - ri.data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); - - new_fn = jffs2_write_dnode(c, f, &ri, comprbuf, cdatalen, phys_ofs, ALLOC_GC); - - jffs2_free_comprbuf(comprbuf, writebuf); - - if (IS_ERR(new_fn)) { - printk(KERN_WARNING "Error writing new dnode: %ld\n", PTR_ERR(new_fn)); - ret = PTR_ERR(new_fn); - break; - } - ret = jffs2_add_full_dnode_to_inode(c, f, new_fn); - offset += datalen; - if (f->metadata) { - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - f->metadata = NULL; - } - } - - jffs2_gc_release_page(c, pg_ptr, &pg); - return ret; -} - diff --git a/components/dfs/filesystems/jffs2/src/gcthread.c b/components/dfs/filesystems/jffs2/src/gcthread.c deleted file mode 100644 index 4005ec478..000000000 --- a/components/dfs/filesystems/jffs2/src/gcthread.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: gcthread.c,v 1.3 2005/01/22 16:01:12 lunn Exp $ - * - */ -#include -#include "nodelist.h" -//#include prife - -#if defined(CYGOPT_FS_JFFS2_GCTHREAD) - -#define GC_THREAD_FLAG_TRIG 1 -#define GC_THREAD_FLAG_STOP 2 -#define GC_THREAD_FLAG_HAS_EXIT 4 - -#if 0 -static cyg_thread_entry_t jffs2_garbage_collect_thread; - -void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - - /* Wake up the thread */ - D1(printk("jffs2_garbage_collect_trigger\n")); - - cyg_flag_setbits(&sb->s_gc_thread_flags,GC_THREAD_FLAG_TRIG); -} - - -void -jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - - RT_ASSERT(c); - RT_ASSERT(!sb->s_gc_thread_handle); - - cyg_flag_init(&sb->s_gc_thread_flags); - cyg_mutex_init(&sb->s_lock); - - D1(printk("jffs2_start_garbage_collect_thread\n")); - /* Start the thread. Doesn't matter if it fails -- it's only an - * optimisation anyway */ - cyg_thread_create(CYGNUM_JFFS2_GC_THREAD_PRIORITY, - jffs2_garbage_collect_thread, - (unsigned long)c,"jffs2 gc thread", - (void*)sb->s_gc_thread_stack, - sizeof(sb->s_gc_thread_stack), - &sb->s_gc_thread_handle, - &sb->s_gc_thread); - - cyg_thread_resume(sb->s_gc_thread_handle); -} - -void -jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - - RT_ASSERT(sb->s_gc_thread_handle); - - D1(printk("jffs2_stop_garbage_collect_thread\n")); - /* Stop the thread and wait for it if necessary */ - - cyg_flag_setbits(&sb->s_gc_thread_flags,GC_THREAD_FLAG_STOP); - - D1(printk("jffs2_stop_garbage_collect_thread wait\n")); - - cyg_flag_wait(&sb->s_gc_thread_flags, - GC_THREAD_FLAG_HAS_EXIT, - CYG_FLAG_WAITMODE_OR| CYG_FLAG_WAITMODE_CLR); - - // Kill and free the resources ... this is safe due to the flag - // from the thread. - cyg_thread_kill(sb->s_gc_thread_handle); - cyg_thread_delete(sb->s_gc_thread_handle); - - cyg_mutex_destroy(&sb->s_lock); - cyg_flag_destroy(&sb->s_gc_thread_flags); -} - - -static void -jffs2_garbage_collect_thread(unsigned long data) -{ - struct jffs2_sb_info *c=(struct jffs2_sb_info *)data; - struct super_block *sb=OFNI_BS_2SFFJ(c); - cyg_flag_value_t flag; - cyg_mtab_entry *mte; - - D1(printk("jffs2_garbage_collect_thread START\n")); - - while(1) { - flag=cyg_flag_timed_wait(&sb->s_gc_thread_flags, - GC_THREAD_FLAG_TRIG|GC_THREAD_FLAG_STOP, - CYG_FLAG_WAITMODE_OR| CYG_FLAG_WAITMODE_CLR, - cyg_current_time()+ - CYGNUM_JFFS2_GS_THREAD_TICKS); - - if (flag & GC_THREAD_FLAG_STOP) - break; - - D1(printk("jffs2: GC THREAD GC BEGIN\n")); - - mte=cyg_fs_root_lookup((cyg_dir *) sb->s_root); - CYG_ASSERT(mte, "Bad mount point"); - cyg_fs_lock(mte, mte->fs->syncmode); - - if (jffs2_garbage_collect_pass(c) == -ENOSPC) { - printf("No space for garbage collection. " - "Aborting JFFS2 GC thread\n"); - break; - } - cyg_fs_unlock(mte, mte->fs->syncmode); - D1(printk("jffs2: GC THREAD GC END\n")); - } - - D1(printk("jffs2_garbage_collect_thread EXIT\n")); - cyg_flag_setbits(&sb->s_gc_thread_flags,GC_THREAD_FLAG_HAS_EXIT); -} -#endif - -rt_uint32_t cyg_current_time(void) -{ - return 0; -} - -static void -jffs2_garbage_collect_thread(unsigned long data); - -void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - - /* Wake up the thread */ - D1(printk("jffs2_garbage_collect_trigger\n")); - - rt_event_send(&sb->s_gc_thread_flags,GC_THREAD_FLAG_TRIG); -} - -static struct rt_thread gc_thread; -void -jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - cyg_mtab_entry *mte; - int result; - - RT_ASSERT(c); - //RT_ASSERT(!sb->s_gc_thread_handle); - - mte=(cyg_dir *) sb->s_root; - RT_ASSERT(mte); - - rt_event_init(&sb->s_gc_thread_flags, "gc_event", RT_IPC_FLAG_FIFO); - rt_mutex_init(&sb->s_lock, "gc_mutex", RT_IPC_FLAG_FIFO); -// rt_mutex_init(&mte->fs->syncmode, "fs_lock", RT_IPC_FLAG_FIFO); - - D1(printk("jffs2_start_garbage_collect_thread\n")); - /* Start the thread. Doesn't matter if it fails -- it's only an - * optimisation anyway */ - result = rt_thread_init(&sb->s_gc_thread, - "jffs2_gc_thread", - jffs2_garbage_collect_thread, - (void *)c, - (void*)sb->s_gc_thread_stack, - sizeof(sb->s_gc_thread_stack), - CYGNUM_JFFS2_GC_THREAD_PRIORITY, - CYGNUM_JFFS2_GC_THREAD_TICKS - ); - if (result != RT_EOK) { - rt_thread_startup(&sb->s_gc_thread); - /* how to deal with the following filed? */ - /* sb->s_gc_thread_handle; */ - } -} - -void -jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) -{ - struct super_block *sb=OFNI_BS_2SFFJ(c); - cyg_mtab_entry *mte; - rt_uint32_t e; - - //RT_ASSERT(sb->s_gc_thread_handle); - - D1(printk("jffs2_stop_garbage_collect_thread\n")); - /* Stop the thread and wait for it if necessary */ - - rt_event_send(&sb->s_gc_thread_flags,GC_THREAD_FLAG_STOP); - - D1(printk("jffs2_stop_garbage_collect_thread wait\n")); - - rt_event_recv(&sb->s_gc_thread_flags, - GC_THREAD_FLAG_HAS_EXIT, - RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, - RT_WAITING_FOREVER, &e); - - // Kill and free the resources ... this is safe due to the flag - // from the thread. - rt_thread_detach(&sb->s_gc_thread); - rt_sem_detach(&sb->s_lock); - rt_event_detach(&sb->s_gc_thread_flags); -} - - -static void -jffs2_garbage_collect_thread(unsigned long data) -{ - struct jffs2_sb_info *c=(struct jffs2_sb_info *)data; - struct super_block *sb=OFNI_BS_2SFFJ(c); - cyg_mtab_entry *mte; - rt_uint32_t flag = 0; - - D1(printk("jffs2_garbage_collect_thread START\n")); - - while(1) { - rt_event_recv(&sb->s_gc_thread_flags, - GC_THREAD_FLAG_TRIG | GC_THREAD_FLAG_STOP, - RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, - cyg_current_time() + CYGNUM_JFFS2_GS_THREAD_TICKS, - &flag); - - if (flag & GC_THREAD_FLAG_STOP) - break; - - D1(printk("jffs2: GC THREAD GC BEGIN\n")); - - mte=(cyg_dir *) sb->s_root; - RT_ASSERT(mte != NULL); -// rt_mutex_take(&mte->fs->syncmode, RT_WAITING_FOREVER); - - if (jffs2_garbage_collect_pass(c) == -ENOSPC) { - printf("No space for garbage collection. " - "Aborting JFFS2 GC thread\n"); - break; - } -// rt_mutex_release(&mte->fs->syncmode); - D1(printk("jffs2: GC THREAD GC END\n")); - } - - D1(printk("jffs2_garbage_collect_thread EXIT\n")); - rt_event_send(&sb->s_gc_thread_flags,GC_THREAD_FLAG_HAS_EXIT); -} -#endif diff --git a/components/dfs/filesystems/jffs2/src/histo.h b/components/dfs/filesystems/jffs2/src/histo.h deleted file mode 100644 index 84f184f08..000000000 --- a/components/dfs/filesystems/jffs2/src/histo.h +++ /dev/null @@ -1,3 +0,0 @@ -/* This file provides the bit-probabilities for the input file */ -#define BIT_DIVIDER 629 -static int bits[9] = { 179,167,183,165,159,198,178,119,}; /* ia32 .so files */ diff --git a/components/dfs/filesystems/jffs2/src/histo_mips.h b/components/dfs/filesystems/jffs2/src/histo_mips.h deleted file mode 100644 index 9a443268d..000000000 --- a/components/dfs/filesystems/jffs2/src/histo_mips.h +++ /dev/null @@ -1,2 +0,0 @@ -#define BIT_DIVIDER_MIPS 1043 -static int bits_mips[8] = { 277,249,290,267,229,341,212,241}; /* mips32 */ diff --git a/components/dfs/filesystems/jffs2/src/malloc-ecos.c b/components/dfs/filesystems/jffs2/src/malloc-ecos.c deleted file mode 100644 index df6e3c0f5..000000000 --- a/components/dfs/filesystems/jffs2/src/malloc-ecos.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Free Software Foundation, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: malloc-ecos.c,v 1.4 2003/11/26 15:55:35 dwmw2 Exp $ - * - */ - -#include -#include -#include "nodelist.h" - -#if !defined(CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE) -# define CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE 0 -#endif - -struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize) -{ - return rt_malloc(sizeof(struct jffs2_full_dirent) + namesize); -} - -void jffs2_free_full_dirent(struct jffs2_full_dirent *x) -{ - rt_free(x); -} - -struct jffs2_full_dnode *jffs2_alloc_full_dnode(void) -{ - return rt_malloc(sizeof(struct jffs2_full_dnode)); -} - -void jffs2_free_full_dnode(struct jffs2_full_dnode *x) -{ - rt_free(x); -} - -struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void) -{ - return rt_malloc(sizeof(struct jffs2_raw_dirent)); -} - -void jffs2_free_raw_dirent(struct jffs2_raw_dirent *x) -{ - rt_free(x); -} - -struct jffs2_raw_inode *jffs2_alloc_raw_inode(void) -{ - return rt_malloc(sizeof(struct jffs2_raw_inode)); -} - -void jffs2_free_raw_inode(struct jffs2_raw_inode *x) -{ - rt_free(x); -} - -struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void) -{ - return rt_malloc(sizeof(struct jffs2_tmp_dnode_info)); -} - -void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *x) -{ - rt_free(x); -} - -struct jffs2_node_frag *jffs2_alloc_node_frag(void) -{ - return rt_malloc(sizeof(struct jffs2_node_frag)); -} - -void jffs2_free_node_frag(struct jffs2_node_frag *x) -{ - rt_free(x); -} - -#if CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE == 0 - -int jffs2_create_slab_caches(void) -{ - return 0; -} - -void jffs2_destroy_slab_caches(void) -{ -} - -struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) -{ - return rt_malloc(sizeof(struct jffs2_raw_node_ref)); -} - -void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) -{ - rt_free(x); -} - -#else // CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE == 0 - -static struct jffs2_raw_node_ref - rnr_pool[CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE] __attribute__ ((aligned (4))), - * first = NULL; -static cyg_drv_mutex_t mutex; - -int jffs2_create_slab_caches(void) -{ - struct jffs2_raw_node_ref * p; - cyg_drv_mutex_init(&mutex); - for ( - p = rnr_pool; - p < rnr_pool + CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE - 1; - p++ - ) - p->next_phys = p + 1; - rnr_pool[CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE - 1].next_phys = NULL; - first = &rnr_pool[0]; - return 0; -} - -void jffs2_destroy_slab_caches(void) -{ -} - -struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void) -{ - struct jffs2_raw_node_ref * p; - - cyg_drv_mutex_lock(&mutex); - p = first; - if (p != NULL) - first = p->next_phys; - cyg_drv_mutex_unlock(&mutex); - return p; -} - -void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *x) -{ - cyg_drv_mutex_lock(&mutex); - x->next_phys = first; - first = x; - cyg_drv_mutex_unlock(&mutex); -} - -#endif // CYGNUM_FS_JFFS2_RAW_NODE_REF_CACHE_POOL_SIZE == 0 - -struct jffs2_inode_cache *jffs2_alloc_inode_cache(void) -{ - struct jffs2_inode_cache *ret = rt_malloc(sizeof(struct jffs2_inode_cache)); - D1(printk(KERN_DEBUG "Allocated inocache at %p\n", ret)); - return ret; -} - -void jffs2_free_inode_cache(struct jffs2_inode_cache *x) -{ - D1(printk(KERN_DEBUG "Freeing inocache at %p\n", x)); - rt_free(x); -} - diff --git a/components/dfs/filesystems/jffs2/src/nodelist.c b/components/dfs/filesystems/jffs2/src/nodelist.c deleted file mode 100644 index aee9d88cf..000000000 --- a/components/dfs/filesystems/jffs2/src/nodelist.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: nodelist.c,v 1.102 2005/07/28 12:45:10 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" - -void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list) -{ - struct jffs2_full_dirent **prev = list; - - JFFS2_DBG_DENTLIST("add dirent \"%s\", ino #%u\n", new->name, new->ino); - - while ((*prev) && (*prev)->nhash <= new->nhash) { - if ((*prev)->nhash == new->nhash && !strcmp((const char *)((*prev)->name), (const char *)new->name)) { - /* Duplicate. Free one */ - if (new->version < (*prev)->version) { - JFFS2_DBG_DENTLIST("Eep! Marking new dirent node is obsolete, old is \"%s\", ino #%u\n", - (*prev)->name, (*prev)->ino); - jffs2_mark_node_obsolete(c, new->raw); - jffs2_free_full_dirent(new); - } else { - JFFS2_DBG_DENTLIST("marking old dirent \"%s\", ino #%u bsolete\n", - (*prev)->name, (*prev)->ino); - new->next = (*prev)->next; - jffs2_mark_node_obsolete(c, ((*prev)->raw)); - jffs2_free_full_dirent(*prev); - *prev = new; - } - return; - } - prev = &((*prev)->next); - } - new->next = *prev; - *prev = new; -} - -void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this) -{ - if (this->node) { - this->node->frags--; - if (!this->node->frags) { - /* The node has no valid frags left. It's totally obsoleted */ - JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) obsolete\n", - ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size); - jffs2_mark_node_obsolete(c, this->node->raw); - jffs2_free_full_dnode(this->node); - } else { - JFFS2_DBG_FRAGTREE2("marking old node @0x%08x (0x%04x-0x%04x) REF_NORMAL. frags is %d\n", - ref_offset(this->node->raw), this->node->ofs, this->node->ofs+this->node->size, this->node->frags); - mark_ref_normal(this->node->raw); - } - - } - jffs2_free_node_frag(this); -} - -static void jffs2_fragtree_insert(struct jffs2_node_frag *newfrag, struct jffs2_node_frag *base) -{ - struct rb_node *parent = &base->rb; - struct rb_node **link = &parent; - - JFFS2_DBG_FRAGTREE2("insert frag (0x%04x-0x%04x)\n", newfrag->ofs, newfrag->ofs + newfrag->size); - - while (*link) { - parent = *link; - base = rb_entry(parent, struct jffs2_node_frag, rb); - - JFFS2_DBG_FRAGTREE2("considering frag at 0x%08x\n", base->ofs); - if (newfrag->ofs > base->ofs) - link = &base->rb.rb_right; - else if (newfrag->ofs < base->ofs) - link = &base->rb.rb_left; - else { - JFFS2_ERROR("duplicate frag at %08x (%p,%p)\n", newfrag->ofs, newfrag, base); - BUG(); - } - } - - rb_link_node(&newfrag->rb, &base->rb, link); -} - -/* Doesn't set inode->i_size */ -static int jffs2_add_frag_to_fragtree(struct jffs2_sb_info *c, struct rb_root *list, struct jffs2_node_frag *newfrag) -{ - struct jffs2_node_frag *this; - uint32_t lastend; - - /* Skip all the nodes which are completed before this one starts */ - this = jffs2_lookup_node_frag(list, newfrag->node->ofs); - - if (this) { - JFFS2_DBG_FRAGTREE2("lookup gave frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", - this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this); - lastend = this->ofs + this->size; - } else { - JFFS2_DBG_FRAGTREE2("lookup gave no frag\n"); - lastend = 0; - } - - /* See if we ran off the end of the list */ - if (lastend <= newfrag->ofs) { - /* We did */ - - /* Check if 'this' node was on the same page as the new node. - If so, both 'this' and the new node get marked REF_NORMAL so - the GC can take a look. - */ - if (lastend && (lastend-1) >> PAGE_CACHE_SHIFT == newfrag->ofs >> PAGE_CACHE_SHIFT) { - if (this->node) - mark_ref_normal(this->node->raw); - mark_ref_normal(newfrag->node->raw); - } - - if (lastend < newfrag->node->ofs) { - /* ... and we need to put a hole in before the new node */ - struct jffs2_node_frag *holefrag = jffs2_alloc_node_frag(); - if (!holefrag) { - jffs2_free_node_frag(newfrag); - return -ENOMEM; - } - holefrag->ofs = lastend; - holefrag->size = newfrag->node->ofs - lastend; - holefrag->node = NULL; - if (this) { - /* By definition, the 'this' node has no right-hand child, - because there are no frags with offset greater than it. - So that's where we want to put the hole */ - JFFS2_DBG_FRAGTREE2("adding hole frag (%p) on right of node at (%p)\n", holefrag, this); - rb_link_node(&holefrag->rb, &this->rb, &this->rb.rb_right); - } else { - JFFS2_DBG_FRAGTREE2("adding hole frag (%p) at root of tree\n", holefrag); - rb_link_node(&holefrag->rb, NULL, &list->rb_node); - } - rb_insert_color(&holefrag->rb, list); - this = holefrag; - } - if (this) { - /* By definition, the 'this' node has no right-hand child, - because there are no frags with offset greater than it. - So that's where we want to put new fragment */ - JFFS2_DBG_FRAGTREE2("adding new frag (%p) on right of node at (%p)\n", newfrag, this); - rb_link_node(&newfrag->rb, &this->rb, &this->rb.rb_right); - } else { - JFFS2_DBG_FRAGTREE2("adding new frag (%p) at root of tree\n", newfrag); - rb_link_node(&newfrag->rb, NULL, &list->rb_node); - } - rb_insert_color(&newfrag->rb, list); - return 0; - } - - JFFS2_DBG_FRAGTREE2("dealing with frag 0x%04x-0x%04x; phys 0x%08x (*%p)\n", - this->ofs, this->ofs+this->size, this->node?(ref_offset(this->node->raw)):0xffffffff, this); - - /* OK. 'this' is pointing at the first frag that newfrag->ofs at least partially obsoletes, - * - i.e. newfrag->ofs < this->ofs+this->size && newfrag->ofs >= this->ofs - */ - if (newfrag->ofs > this->ofs) { - /* This node isn't completely obsoleted. The start of it remains valid */ - - /* Mark the new node and the partially covered node REF_NORMAL -- let - the GC take a look at them */ - mark_ref_normal(newfrag->node->raw); - if (this->node) - mark_ref_normal(this->node->raw); - - if (this->ofs + this->size > newfrag->ofs + newfrag->size) { - /* The new node splits 'this' frag into two */ - struct jffs2_node_frag *newfrag2 = jffs2_alloc_node_frag(); - if (!newfrag2) { - jffs2_free_node_frag(newfrag); - return -ENOMEM; - } - if (this->node) - JFFS2_DBG_FRAGTREE2("split old frag 0x%04x-0x%04x, phys 0x%08x\n", - this->ofs, this->ofs+this->size, ref_offset(this->node->raw)); - else - JFFS2_DBG_FRAGTREE2("split old hole frag 0x%04x-0x%04x\n", - this->ofs, this->ofs+this->size, ref_offset(this->node->raw)); - - /* New second frag pointing to this's node */ - newfrag2->ofs = newfrag->ofs + newfrag->size; - newfrag2->size = (this->ofs+this->size) - newfrag2->ofs; - newfrag2->node = this->node; - if (this->node) - this->node->frags++; - - /* Adjust size of original 'this' */ - this->size = newfrag->ofs - this->ofs; - - /* Now, we know there's no node with offset - greater than this->ofs but smaller than - newfrag2->ofs or newfrag->ofs, for obvious - reasons. So we can do a tree insert from - 'this' to insert newfrag, and a tree insert - from newfrag to insert newfrag2. */ - jffs2_fragtree_insert(newfrag, this); - rb_insert_color(&newfrag->rb, list); - - jffs2_fragtree_insert(newfrag2, newfrag); - rb_insert_color(&newfrag2->rb, list); - - return 0; - } - /* New node just reduces 'this' frag in size, doesn't split it */ - this->size = newfrag->ofs - this->ofs; - - /* Again, we know it lives down here in the tree */ - jffs2_fragtree_insert(newfrag, this); - rb_insert_color(&newfrag->rb, list); - } else { - /* New frag starts at the same point as 'this' used to. Replace - it in the tree without doing a delete and insertion */ - JFFS2_DBG_FRAGTREE2("inserting newfrag (*%p),%d-%d in before 'this' (*%p),%d-%d\n", - newfrag, newfrag->ofs, newfrag->ofs+newfrag->size, this, this->ofs, this->ofs+this->size); - - rb_replace_node(&this->rb, &newfrag->rb, list); - - if (newfrag->ofs + newfrag->size >= this->ofs+this->size) { - JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x)\n", this, this->ofs, this->ofs+this->size); - jffs2_obsolete_node_frag(c, this); - } else { - this->ofs += newfrag->size; - this->size -= newfrag->size; - - jffs2_fragtree_insert(this, newfrag); - rb_insert_color(&this->rb, list); - return 0; - } - } - /* OK, now we have newfrag added in the correct place in the tree, but - frag_next(newfrag) may be a fragment which is overlapped by it - */ - while ((this = frag_next(newfrag)) && newfrag->ofs + newfrag->size >= this->ofs + this->size) { - /* 'this' frag is obsoleted completely. */ - JFFS2_DBG_FRAGTREE2("obsoleting node frag %p (%x-%x) and removing from tree\n", - this, this->ofs, this->ofs+this->size); - rb_erase(&this->rb, list); - jffs2_obsolete_node_frag(c, this); - } - /* Now we're pointing at the first frag which isn't totally obsoleted by - the new frag */ - - if (!this || newfrag->ofs + newfrag->size == this->ofs) { - return 0; - } - /* Still some overlap but we don't need to move it in the tree */ - this->size = (this->ofs + this->size) - (newfrag->ofs + newfrag->size); - this->ofs = newfrag->ofs + newfrag->size; - - /* And mark them REF_NORMAL so the GC takes a look at them */ - if (this->node) - mark_ref_normal(this->node->raw); - mark_ref_normal(newfrag->node->raw); - - return 0; -} - -/* Given an inode, probably with existing list of fragments, add the new node - * to the fragment list. - */ -int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn) -{ - int ret; - struct jffs2_node_frag *newfrag; - - if (unlikely(!fn->size)) - return 0; - - newfrag = jffs2_alloc_node_frag(); - if (unlikely(!newfrag)) - return -ENOMEM; - - JFFS2_DBG_FRAGTREE("adding node %#04x-%#04x @0x%08x on flash, newfrag *%p\n", - fn->ofs, fn->ofs+fn->size, ref_offset(fn->raw), newfrag); - - newfrag->ofs = fn->ofs; - newfrag->size = fn->size; - newfrag->node = fn; - newfrag->node->frags = 1; - - ret = jffs2_add_frag_to_fragtree(c, &f->fragtree, newfrag); - if (unlikely(ret)) - return ret; - - /* If we now share a page with other nodes, mark either previous - or next node REF_NORMAL, as appropriate. */ - if (newfrag->ofs & (PAGE_CACHE_SIZE-1)) { - struct jffs2_node_frag *prev = frag_prev(newfrag); - - mark_ref_normal(fn->raw); - /* If we don't start at zero there's _always_ a previous */ - if (prev->node) - mark_ref_normal(prev->node->raw); - } - - if ((newfrag->ofs+newfrag->size) & (PAGE_CACHE_SIZE-1)) { - struct jffs2_node_frag *next = frag_next(newfrag); - - if (next) { - mark_ref_normal(fn->raw); - if (next->node) - mark_ref_normal(next->node->raw); - } - } - jffs2_dbg_fragtree_paranoia_check_nolock(f); - jffs2_dbg_dump_fragtree_nolock(f); - return 0; -} - - -void jffs2_set_inocache_state(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, int state) -{ - spin_lock(&c->inocache_lock); - ic->state = state; - wake_up(&c->inocache_wq); - spin_unlock(&c->inocache_lock); -} - -/* During mount, this needs no locking. During normal operation, its - callers want to do other stuff while still holding the inocache_lock. - Rather than introducing special case get_ino_cache functions or - callbacks, we just let the caller do the locking itself. */ - -struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t ino) -{ - struct jffs2_inode_cache *ret; - - ret = c->inocache_list[ino % INOCACHE_HASHSIZE]; - while (ret && ret->ino < ino) { - ret = ret->next; - } - - if (ret && ret->ino != ino) - ret = NULL; - - return ret; -} - -void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new) -{ - struct jffs2_inode_cache **prev; - - spin_lock(&c->inocache_lock); - if (!new->ino) - new->ino = ++c->highest_ino; - - JFFS2_DBG_INOCACHE("add %p (ino #%u)\n", new, new->ino); - - prev = &c->inocache_list[new->ino % INOCACHE_HASHSIZE]; - - while ((*prev) && (*prev)->ino < new->ino) { - prev = &(*prev)->next; - } - new->next = *prev; - *prev = new; - - spin_unlock(&c->inocache_lock); -} - -void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old) -{ - struct jffs2_inode_cache **prev; - - JFFS2_DBG_INOCACHE("del %p (ino #%u)\n", old, old->ino); - spin_lock(&c->inocache_lock); - - prev = &c->inocache_list[old->ino % INOCACHE_HASHSIZE]; - - while ((*prev) && (*prev)->ino < old->ino) { - prev = &(*prev)->next; - } - if ((*prev) == old) { - *prev = old->next; - } - - /* Free it now unless it's in READING or CLEARING state, which - are the transitions upon read_inode() and clear_inode(). The - rest of the time we know nobody else is looking at it, and - if it's held by read_inode() or clear_inode() they'll free it - for themselves. */ - if (old->state != INO_STATE_READING && old->state != INO_STATE_CLEARING) - jffs2_free_inode_cache(old); - - spin_unlock(&c->inocache_lock); -} - -void jffs2_free_ino_caches(struct jffs2_sb_info *c) -{ - int i; - struct jffs2_inode_cache *this, *next; - - for (i=0; iinocache_list[i]; - while (this) { - next = this->next; - jffs2_free_inode_cache(this); - this = next; - } - c->inocache_list[i] = NULL; - } -} - -void jffs2_free_raw_node_refs(struct jffs2_sb_info *c) -{ - int i; - struct jffs2_raw_node_ref *this, *next; - - for (i=0; inr_blocks; i++) { - this = c->blocks[i].first_node; - while(this) { - next = this->next_phys; - jffs2_free_raw_node_ref(this); - this = next; - } - c->blocks[i].first_node = c->blocks[i].last_node = NULL; - } -} - -struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_t offset) -{ - /* The common case in lookup is that there will be a node - which precisely matches. So we go looking for that first */ - struct rb_node *next; - struct jffs2_node_frag *prev = NULL; - struct jffs2_node_frag *frag = NULL; - - JFFS2_DBG_FRAGTREE2("root %p, offset %d\n", fragtree, offset); - - next = fragtree->rb_node; - - while(next) { - frag = rb_entry(next, struct jffs2_node_frag, rb); - - JFFS2_DBG_FRAGTREE2("considering frag %#04x-%#04x (%p). left %p, right %p\n", - frag->ofs, frag->ofs+frag->size, frag, frag->rb.rb_left, frag->rb.rb_right); - if (frag->ofs + frag->size <= offset) { - JFFS2_DBG_FRAGTREE2("going right from frag %#04x-%#04x, before the region we care about\n", - frag->ofs, frag->ofs+frag->size); - /* Remember the closest smaller match on the way down */ - if (!prev || frag->ofs > prev->ofs) - prev = frag; - next = frag->rb.rb_right; - } else if (frag->ofs > offset) { - JFFS2_DBG_FRAGTREE2("going left from frag %#04x-%#04x, after the region we care about\n", - frag->ofs, frag->ofs+frag->size); - next = frag->rb.rb_left; - } else { - JFFS2_DBG_FRAGTREE2("returning frag %#04x-%#04x, matched\n", - frag->ofs, frag->ofs+frag->size); - return frag; - } - } - - /* Exact match not found. Go back up looking at each parent, - and return the closest smaller one */ - - if (prev) - JFFS2_DBG_FRAGTREE2("no match. Returning frag %#04x-%#04x, closest previous\n", - prev->ofs, prev->ofs+prev->size); - else - JFFS2_DBG_FRAGTREE2("returning NULL, empty fragtree\n"); - - return prev; -} - -/* Pass 'c' argument to indicate that nodes should be marked obsolete as - they're killed. */ -void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c) -{ - struct jffs2_node_frag *frag; - struct jffs2_node_frag *parent; - - if (!root->rb_node) - return; - - JFFS2_DBG_FRAGTREE("killing\n"); - - frag = (rb_entry(root->rb_node, struct jffs2_node_frag, rb)); - while(frag) { - if (frag->rb.rb_left) { - JFFS2_DBG_FRAGTREE2("going left from frag (%p) %#04x-%#04x\n", - frag, frag->ofs, frag->ofs+frag->size); - frag = frag_left(frag); - continue; - } - if (frag->rb.rb_right) { - JFFS2_DBG_FRAGTREE2("going right from frag (%p) %#04x-%#04x\n", - frag, frag->ofs, frag->ofs+frag->size); - frag = frag_right(frag); - continue; - } - - JFFS2_DBG_FRAGTREE2("frag %#04x-%#04x: node %p, frags %d\n", - frag->ofs, frag->ofs+frag->size, frag->node, frag->node?frag->node->frags:0); - - if (frag->node && !(--frag->node->frags)) { - /* Not a hole, and it's the final remaining frag - of this node. Free the node */ - if (c) - jffs2_mark_node_obsolete(c, frag->node->raw); - - jffs2_free_full_dnode(frag->node); - } - parent = frag_parent(frag); - if (parent) { - if (frag_left(parent) == frag) - parent->rb.rb_left = NULL; - else - parent->rb.rb_right = NULL; - } - - jffs2_free_node_frag(frag); - frag = parent; - - cond_resched(); - } -} diff --git a/components/dfs/filesystems/jffs2/src/nodelist.h b/components/dfs/filesystems/jffs2/src/nodelist.h deleted file mode 100644 index 53cdb49bb..000000000 --- a/components/dfs/filesystems/jffs2/src/nodelist.h +++ /dev/null @@ -1,415 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: nodelist.h,v 1.135 2005/07/27 14:46:11 dedekind Exp $ - * - */ - -#ifndef __JFFS2_NODELIST_H__ -#define __JFFS2_NODELIST_H__ - -#include "jffs2_config.h" -#include -#include -#include -#include -#include -#include - -#ifdef __ECOS -#include "os-ecos.h" -#elif defined(RT_THREAD) -#include "os-rtthread.h" -#else -#include /* For compatibility with older kernels */ -#include "os-linux.h" -#endif - -#define JFFS2_NATIVE_ENDIAN - -/* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from - whatever OS we're actually running on here too. */ - -#if defined(JFFS2_NATIVE_ENDIAN) -#if defined (__GNUC__) -#define cpu_to_je16(x) ((jint16_t){x}) -#define cpu_to_je32(x) ((jint32_t){x}) -#define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)}) - -#define je16_to_cpu(x) ((x).v16) -#define je32_to_cpu(x) ((x).v32) -#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m)) -#elif defined (MSVC) -#define cpu_to_je16(x) ((jint16_t)(x)) -#define cpu_to_je32(x) ((jint32_t)(x)) -static __inline jmode_t cpu_to_jemode(x) -{ - jmode_t _x; - _x.m = os_to_jffs2_mode(x); - return _x; -} - -#define je16_to_cpu(x) (x) -#define je32_to_cpu(x) (x) -#define jemode_to_cpu(x) (jffs2_to_os_mode((x).m)) -#else -#endif - - -#elif defined(JFFS2_BIG_ENDIAN) -#define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)}) -#define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)}) -#define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))}) - -#define je16_to_cpu(x) (be16_to_cpu(x.v16)) -#define je32_to_cpu(x) (be32_to_cpu(x.v32)) -#define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m))) -#elif defined(JFFS2_LITTLE_ENDIAN) -#define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)}) -#define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)}) -#define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))}) - -#define je16_to_cpu(x) (le16_to_cpu(x.v16)) -#define je32_to_cpu(x) (le32_to_cpu(x.v32)) -#define jemode_to_cpu(x) (le32_to_cpu(jffs2_to_os_mode((x).m))) -#else -#error wibble -#endif - -/* - This is all we need to keep in-core for each raw node during normal - operation. As and when we do read_inode on a particular inode, we can - scan the nodes which are listed for it and build up a proper map of - which nodes are currently valid. JFFSv1 always used to keep that whole - map in core for each inode. -*/ -struct jffs2_raw_node_ref -{ - struct jffs2_raw_node_ref *next_in_ino; /* Points to the next raw_node_ref - for this inode. If this is the last, it points to the inode_cache - for this inode instead. The inode_cache will have NULL in the first - word so you know when you've got there :) */ - struct jffs2_raw_node_ref *next_phys; - uint32_t flash_offset; - uint32_t __totlen; /* This may die; use ref_totlen(c, jeb, ) below */ -}; - - /* flash_offset & 3 always has to be zero, because nodes are - always aligned at 4 bytes. So we have a couple of extra bits - to play with, which indicate the node's status; see below: */ -#define REF_UNCHECKED 0 /* We haven't yet checked the CRC or built its inode */ -#define REF_OBSOLETE 1 /* Obsolete, can be completely ignored */ -#define REF_PRISTINE 2 /* Completely clean. GC without looking */ -#define REF_NORMAL 3 /* Possibly overlapped. Read the page and write again on GC */ -#define ref_flags(ref) ((ref)->flash_offset & 3) -#define ref_offset(ref) ((ref)->flash_offset & ~3) -#define ref_obsolete(ref) (((ref)->flash_offset & 3) == REF_OBSOLETE) -#define mark_ref_normal(ref) do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0) - -/* For each inode in the filesystem, we need to keep a record of - nlink, because it would be a PITA to scan the whole directory tree - at read_inode() time to calculate it, and to keep sufficient information - in the raw_node_ref (basically both parent and child inode number for - dirent nodes) would take more space than this does. We also keep - a pointer to the first physical node which is part of this inode, too. -*/ -struct jffs2_inode_cache { - struct jffs2_full_dirent *scan_dents; /* Used during scan to hold - temporary lists of dirents, and later must be set to - NULL to mark the end of the raw_node_ref->next_in_ino - chain. */ - struct jffs2_inode_cache *next; - struct jffs2_raw_node_ref *nodes; - uint32_t ino; - int nlink; - int state; -}; - -/* Inode states for 'state' above. We need the 'GC' state to prevent - someone from doing a read_inode() while we're moving a 'REF_PRISTINE' - node without going through all the iget() nonsense */ -#define INO_STATE_UNCHECKED 0 /* CRC checks not yet done */ -#define INO_STATE_CHECKING 1 /* CRC checks in progress */ -#define INO_STATE_PRESENT 2 /* In core */ -#define INO_STATE_CHECKEDABSENT 3 /* Checked, cleared again */ -#define INO_STATE_GC 4 /* GCing a 'pristine' node */ -#define INO_STATE_READING 5 /* In read_inode() */ -#define INO_STATE_CLEARING 6 /* In clear_inode() */ - -#define INOCACHE_HASHSIZE 128 - -/* - Larger representation of a raw node, kept in-core only when the - struct inode for this particular ino is instantiated. -*/ - -struct jffs2_full_dnode -{ - struct jffs2_raw_node_ref *raw; - uint32_t ofs; /* The offset to which the data of this node belongs */ - uint32_t size; - uint32_t frags; /* Number of fragments which currently refer - to this node. When this reaches zero, - the node is obsolete. */ -}; - -/* - Even larger representation of a raw node, kept in-core only while - we're actually building up the original map of which nodes go where, - in read_inode() -*/ -struct jffs2_tmp_dnode_info -{ - struct rb_node rb; - struct jffs2_full_dnode *fn; - uint32_t version; -}; - -struct jffs2_full_dirent -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_full_dirent *next; - uint32_t version; - uint32_t ino; /* == zero for unlink */ - unsigned int nhash; - unsigned char type; - unsigned char name[0]; -}; - -/* - Fragments - used to build a map of which raw node to obtain - data from for each part of the ino -*/ -struct jffs2_node_frag -{ - struct rb_node rb; - struct jffs2_full_dnode *node; /* NULL for holes */ - uint32_t size; - uint32_t ofs; /* The offset to which this fragment belongs */ -}; - -struct jffs2_eraseblock -{ - struct list_head list; - int bad_count; - uint32_t offset; /* of this block in the MTD */ - - uint32_t unchecked_size; - uint32_t used_size; - uint32_t dirty_size; - uint32_t wasted_size; - uint32_t free_size; /* Note that sector_size - free_size - is the address of the first free space */ - struct jffs2_raw_node_ref *first_node; - struct jffs2_raw_node_ref *last_node; - - struct jffs2_raw_node_ref *gc_node; /* Next node to be garbage collected */ -}; - -/* Calculate totlen from surrounding nodes or eraseblock */ -static inline uint32_t __ref_totlen(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb, - struct jffs2_raw_node_ref *ref) -{ - uint32_t ref_end; - - if (ref->next_phys) - ref_end = ref_offset(ref->next_phys); - else { - if (!jeb) - jeb = &c->blocks[ref->flash_offset / c->sector_size]; - - /* Last node in block. Use free_space */ - BUG_ON(ref != jeb->last_node); - ref_end = jeb->offset + c->sector_size - jeb->free_size; - } - return ref_end - ref_offset(ref); -} - -static inline uint32_t ref_totlen(struct jffs2_sb_info *c, - struct jffs2_eraseblock *jeb, - struct jffs2_raw_node_ref *ref) -{ - uint32_t ret; - -#if CONFIG_JFFS2_FS_DEBUG > 0 - if (jeb && jeb != &c->blocks[ref->flash_offset / c->sector_size]) { - printk(KERN_CRIT "ref_totlen called with wrong block -- at 0x%08x instead of 0x%08x; ref 0x%08x\n", - jeb->offset, c->blocks[ref->flash_offset / c->sector_size].offset, ref_offset(ref)); - BUG(); - } -#endif - -#if 1 - ret = ref->__totlen; -#else - /* This doesn't actually work yet */ - ret = __ref_totlen(c, jeb, ref); - if (ret != ref->__totlen) { - printk(KERN_CRIT "Totlen for ref at %p (0x%08x-0x%08x) miscalculated as 0x%x instead of %x\n", - ref, ref_offset(ref), ref_offset(ref)+ref->__totlen, - ret, ref->__totlen); - if (!jeb) - jeb = &c->blocks[ref->flash_offset / c->sector_size]; - jffs2_dbg_dump_node_refs_nolock(c, jeb); - BUG(); - } -#endif - return ret; -} - -#define ALLOC_NORMAL 0 /* Normal allocation */ -#define ALLOC_DELETION 1 /* Deletion node. Best to allow it */ -#define ALLOC_GC 2 /* Space requested for GC. Give it or die */ -#define ALLOC_NORETRY 3 /* For jffs2_write_dnode: On failure, return -EAGAIN instead of retrying */ - -/* How much dirty space before it goes on the very_dirty_list */ -#define VERYDIRTY(c, size) ((size) >= ((c)->sector_size / 2)) - -/* check if dirty space is more than 255 Byte */ -#define ISDIRTY(size) ((size) > sizeof (struct jffs2_raw_inode) + JFFS2_MIN_DATA_LEN) - -#define PAD(x) (((x)+3)&~3) - -static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_node_ref *raw) -{ - while(raw->next_in_ino) { - raw = raw->next_in_ino; - } - - return ((struct jffs2_inode_cache *)raw); -} - -static inline struct jffs2_node_frag *frag_first(struct rb_root *root) -{ - struct rb_node *node = root->rb_node; - - if (!node) - return NULL; - while(node->rb_left) - node = node->rb_left; - return rb_entry(node, struct jffs2_node_frag, rb); -} - -static inline struct jffs2_node_frag *frag_last(struct rb_root *root) -{ - struct rb_node *node = root->rb_node; - - if (!node) - return NULL; - while(node->rb_right) - node = node->rb_right; - return rb_entry(node, struct jffs2_node_frag, rb); -} - -#define rb_parent(rb) ((rb)->rb_parent) -#define frag_next(frag) rb_entry(rb_next(&(frag)->rb), struct jffs2_node_frag, rb) -#define frag_prev(frag) rb_entry(rb_prev(&(frag)->rb), struct jffs2_node_frag, rb) -#define frag_parent(frag) rb_entry(rb_parent(&(frag)->rb), struct jffs2_node_frag, rb) -#define frag_left(frag) rb_entry((frag)->rb.rb_left, struct jffs2_node_frag, rb) -#define frag_right(frag) rb_entry((frag)->rb.rb_right, struct jffs2_node_frag, rb) -#define frag_erase(frag, list) rb_erase(&frag->rb, list); - -/* nodelist.c */ -void jffs2_add_fd_to_list(struct jffs2_sb_info *c, struct jffs2_full_dirent *new, struct jffs2_full_dirent **list); -void jffs2_set_inocache_state(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic, int state); -struct jffs2_inode_cache *jffs2_get_ino_cache(struct jffs2_sb_info *c, uint32_t ino); -void jffs2_add_ino_cache (struct jffs2_sb_info *c, struct jffs2_inode_cache *new); -void jffs2_del_ino_cache(struct jffs2_sb_info *c, struct jffs2_inode_cache *old); -void jffs2_free_ino_caches(struct jffs2_sb_info *c); -void jffs2_free_raw_node_refs(struct jffs2_sb_info *c); -struct jffs2_node_frag *jffs2_lookup_node_frag(struct rb_root *fragtree, uint32_t offset); -void jffs2_kill_fragtree(struct rb_root *root, struct jffs2_sb_info *c_delete); -struct rb_node *rb_next(struct rb_node *); -struct rb_node *rb_prev(struct rb_node *); -void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root); -void jffs2_obsolete_node_frag(struct jffs2_sb_info *c, struct jffs2_node_frag *this); -int jffs2_add_full_dnode_to_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_full_dnode *fn); - -/* nodemgmt.c */ -int jffs2_thread_should_wake(struct jffs2_sb_info *c); -int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, int prio); -int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len); -int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new); -void jffs2_complete_reservation(struct jffs2_sb_info *c); -void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *raw); - -/* write.c */ -int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri); - -struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, int alloc_mode); -struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, int alloc_mode); -int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - struct jffs2_raw_inode *ri, unsigned char *buf, - uint32_t offset, uint32_t writelen, uint32_t *retlen); -int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen); -int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, const char *name, int namelen, struct jffs2_inode_info *dead_f); -int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, uint8_t type, const char *name, int namelen); - - -/* readinode.c */ -void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size); -int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - uint32_t ino, struct jffs2_raw_inode *latest_node); -int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic); -void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f); - -/* malloc.c */ -int jffs2_create_slab_caches(void); -void jffs2_destroy_slab_caches(void); - -struct jffs2_full_dirent *jffs2_alloc_full_dirent(int namesize); -void jffs2_free_full_dirent(struct jffs2_full_dirent *); -struct jffs2_full_dnode *jffs2_alloc_full_dnode(void); -void jffs2_free_full_dnode(struct jffs2_full_dnode *); -struct jffs2_raw_dirent *jffs2_alloc_raw_dirent(void); -void jffs2_free_raw_dirent(struct jffs2_raw_dirent *); -struct jffs2_raw_inode *jffs2_alloc_raw_inode(void); -void jffs2_free_raw_inode(struct jffs2_raw_inode *); -struct jffs2_tmp_dnode_info *jffs2_alloc_tmp_dnode_info(void); -void jffs2_free_tmp_dnode_info(struct jffs2_tmp_dnode_info *); -struct jffs2_raw_node_ref *jffs2_alloc_raw_node_ref(void); -void jffs2_free_raw_node_ref(struct jffs2_raw_node_ref *); -struct jffs2_node_frag *jffs2_alloc_node_frag(void); -void jffs2_free_node_frag(struct jffs2_node_frag *); -struct jffs2_inode_cache *jffs2_alloc_inode_cache(void); -void jffs2_free_inode_cache(struct jffs2_inode_cache *); - -/* gc.c */ -int jffs2_garbage_collect_pass(struct jffs2_sb_info *c); - -/* read.c */ -int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - struct jffs2_full_dnode *fd, unsigned char *buf, - int ofs, int len); -int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned char *buf, uint32_t offset, uint32_t len); -char *jffs2_getlink(struct jffs2_sb_info *c, struct jffs2_inode_info *f); - -/* scan.c */ -int jffs2_scan_medium(struct jffs2_sb_info *c); -void jffs2_rotate_lists(struct jffs2_sb_info *c); - -/* build.c */ -int jffs2_do_mount_fs(struct jffs2_sb_info *c); - -/* erase.c */ -void jffs2_erase_pending_blocks(struct jffs2_sb_info *c, int count); - -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER -/* wbuf.c */ -int jffs2_flush_wbuf_gc(struct jffs2_sb_info *c, uint32_t ino); -int jffs2_flush_wbuf_pad(struct jffs2_sb_info *c); -int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); -#endif - -#include "debug.h" - -#endif /* __JFFS2_NODELIST_H__ */ diff --git a/components/dfs/filesystems/jffs2/src/nodemgmt.c b/components/dfs/filesystems/jffs2/src/nodemgmt.c deleted file mode 100644 index ef2167aad..000000000 --- a/components/dfs/filesystems/jffs2/src/nodemgmt.c +++ /dev/null @@ -1,680 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: nodemgmt.c,v 1.124 2005/07/20 15:32:28 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include /* For cond_resched() */ -#include "nodelist.h" - -/** - * jffs2_reserve_space - request physical space to write nodes to flash - * @c: superblock info - * @minsize: Minimum acceptable size of allocation - * @ofs: Returned value of node offset - * @len: Returned value of allocation length - * @prio: Allocation type - ALLOC_{NORMAL,DELETION} - * - * Requests a block of physical space on the flash. Returns zero for success - * and puts 'ofs' and 'len' into the appriopriate place, or returns -ENOSPC - * or other error if appropriate. - * - * If it returns zero, jffs2_reserve_space() also downs the per-filesystem - * allocation semaphore, to prevent more than one allocation from being - * active at any time. The semaphore is later released by jffs2_commit_allocation() - * - * jffs2_reserve_space() may trigger garbage collection in order to make room - * for the requested allocation. - */ - -static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len); - -int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len, int prio) -{ - int ret = -EAGAIN; - int blocksneeded = c->resv_blocks_write; - /* align it */ - minsize = PAD(minsize); - - D1(printk(KERN_DEBUG "jffs2_reserve_space(): Requested 0x%x bytes\n", minsize)); - down(&c->alloc_sem); - - D1(printk(KERN_DEBUG "jffs2_reserve_space(): alloc sem got\n")); - - spin_lock(&c->erase_completion_lock); - - /* this needs a little more thought (true :)) */ - while(ret == -EAGAIN) { - while(c->nr_free_blocks + c->nr_erasing_blocks < blocksneeded) { - int ret; - uint32_t dirty, avail; - - /* calculate real dirty size - * dirty_size contains blocks on erase_pending_list - * those blocks are counted in c->nr_erasing_blocks. - * If one block is actually erased, it is not longer counted as dirty_space - * but it is counted in c->nr_erasing_blocks, so we add it and subtract it - * with c->nr_erasing_blocks * c->sector_size again. - * Blocks on erasable_list are counted as dirty_size, but not in c->nr_erasing_blocks - * This helps us to force gc and pick eventually a clean block to spread the load. - * We add unchecked_size here, as we hopefully will find some space to use. - * This will affect the sum only once, as gc first finishes checking - * of nodes. - */ - dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size + c->unchecked_size; - if (dirty < c->nospc_dirty_size) { - if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) { - D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on dirty space to GC, but it's a deletion. Allowing...\n")); - break; - } - D1(printk(KERN_DEBUG "dirty size 0x%08x + unchecked_size 0x%08x < nospc_dirty_size 0x%08x, returning -ENOSPC\n", - dirty, c->unchecked_size, c->sector_size)); - - spin_unlock(&c->erase_completion_lock); - up(&c->alloc_sem); - return -ENOSPC; - } - - /* Calc possibly available space. Possibly available means that we - * don't know, if unchecked size contains obsoleted nodes, which could give us some - * more usable space. This will affect the sum only once, as gc first finishes checking - * of nodes. - + Return -ENOSPC, if the maximum possibly available space is less or equal than - * blocksneeded * sector_size. - * This blocks endless gc looping on a filesystem, which is nearly full, even if - * the check above passes. - */ - avail = c->free_size + c->dirty_size + c->erasing_size + c->unchecked_size; - if ( (avail / c->sector_size) <= blocksneeded) { - if (prio == ALLOC_DELETION && c->nr_free_blocks + c->nr_erasing_blocks >= c->resv_blocks_deletion) { - D1(printk(KERN_NOTICE "jffs2_reserve_space(): Low on possibly available space, but it's a deletion. Allowing...\n")); - break; - } - - D1(printk(KERN_DEBUG "max. available size 0x%08x < blocksneeded * sector_size 0x%08x, returning -ENOSPC\n", - avail, blocksneeded * c->sector_size)); - spin_unlock(&c->erase_completion_lock); - up(&c->alloc_sem); - return -ENOSPC; - } - - up(&c->alloc_sem); - - D1(printk(KERN_DEBUG "Triggering GC pass. nr_free_blocks %d, nr_erasing_blocks %d, free_size 0x%08x, dirty_size 0x%08x, wasted_size 0x%08x, used_size 0x%08x, erasing_size 0x%08x, bad_size 0x%08x (total 0x%08x of 0x%08x)\n", - c->nr_free_blocks, c->nr_erasing_blocks, c->free_size, c->dirty_size, c->wasted_size, c->used_size, c->erasing_size, c->bad_size, - c->free_size + c->dirty_size + c->wasted_size + c->used_size + c->erasing_size + c->bad_size, c->flash_size)); - spin_unlock(&c->erase_completion_lock); - - ret = jffs2_garbage_collect_pass(c); - if (ret) - return ret; - - cond_resched(); - - if (signal_pending(current)) - return -EINTR; - - down(&c->alloc_sem); - spin_lock(&c->erase_completion_lock); - } - - ret = jffs2_do_reserve_space(c, minsize, ofs, len); - if (ret) { - D1(printk(KERN_DEBUG "jffs2_reserve_space: ret is %d\n", ret)); - } - } - spin_unlock(&c->erase_completion_lock); - if (ret) - up(&c->alloc_sem); - return ret; -} - -int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len) -{ - int ret = -EAGAIN; - minsize = PAD(minsize); - - D1(printk(KERN_DEBUG "jffs2_reserve_space_gc(): Requested 0x%x bytes\n", minsize)); - - spin_lock(&c->erase_completion_lock); - while(ret == -EAGAIN) { - ret = jffs2_do_reserve_space(c, minsize, ofs, len); - if (ret) { - D1(printk(KERN_DEBUG "jffs2_reserve_space_gc: looping, ret is %d\n", ret)); - } - } - spin_unlock(&c->erase_completion_lock); - return ret; -} - -/* Called with alloc sem _and_ erase_completion_lock */ -static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, uint32_t *ofs, uint32_t *len) -{ - struct jffs2_eraseblock *jeb = c->nextblock; - - restart: - if (jeb && minsize > jeb->free_size) { - /* Skip the end of this block and file it as having some dirty space */ - /* If there's a pending write to it, flush now */ - if (jffs2_wbuf_dirty(c)) { - spin_unlock(&c->erase_completion_lock); - D1(printk(KERN_DEBUG "jffs2_do_reserve_space: Flushing write buffer\n")); - jffs2_flush_wbuf_pad(c); - spin_lock(&c->erase_completion_lock); - jeb = c->nextblock; - goto restart; - } - c->wasted_size += jeb->free_size; - c->free_size -= jeb->free_size; - jeb->wasted_size += jeb->free_size; - jeb->free_size = 0; - - /* Check, if we have a dirty block now, or if it was dirty already */ - if (ISDIRTY (jeb->wasted_size + jeb->dirty_size)) { - c->dirty_size += jeb->wasted_size; - c->wasted_size -= jeb->wasted_size; - jeb->dirty_size += jeb->wasted_size; - jeb->wasted_size = 0; - if (VERYDIRTY(c, jeb->dirty_size)) { - D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to very_dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); - list_add_tail(&jeb->list, &c->very_dirty_list); - } else { - D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to dirty_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); - list_add_tail(&jeb->list, &c->dirty_list); - } - } else { - D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); - list_add_tail(&jeb->list, &c->clean_list); - } - c->nextblock = jeb = NULL; - } - - if (!jeb) { - struct list_head *next; - /* Take the next block off the 'free' list */ - - if (list_empty(&c->free_list)) { - - if (!c->nr_erasing_blocks && - !list_empty(&c->erasable_list)) { - struct jffs2_eraseblock *ejeb; - - ejeb = list_entry(c->erasable_list.next, struct jffs2_eraseblock, list); - list_del(&ejeb->list); - list_add_tail(&ejeb->list, &c->erase_pending_list); - c->nr_erasing_blocks++; - jffs2_erase_pending_trigger(c); - D1(printk(KERN_DEBUG "jffs2_do_reserve_space: Triggering erase of erasable block at 0x%08x\n", - ejeb->offset)); - } - - if (!c->nr_erasing_blocks && - !list_empty(&c->erasable_pending_wbuf_list)) { - D1(printk(KERN_DEBUG "jffs2_do_reserve_space: Flushing write buffer\n")); - /* c->nextblock is NULL, no update to c->nextblock allowed */ - spin_unlock(&c->erase_completion_lock); - jffs2_flush_wbuf_pad(c); - spin_lock(&c->erase_completion_lock); - /* Have another go. It'll be on the erasable_list now */ - return -EAGAIN; - } - - if (!c->nr_erasing_blocks) { - /* Ouch. We're in GC, or we wouldn't have got here. - And there's no space left. At all. */ - printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n", - c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no", - list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"); - return -ENOSPC; - } - - spin_unlock(&c->erase_completion_lock); - /* Don't wait for it; just erase one right now */ - jffs2_erase_pending_blocks(c, 1); - spin_lock(&c->erase_completion_lock); - - /* An erase may have failed, decreasing the - amount of free space available. So we must - restart from the beginning */ - return -EAGAIN; - } - - next = c->free_list.next; - list_del(next); - c->nextblock = jeb = list_entry(next, struct jffs2_eraseblock, list); - c->nr_free_blocks--; - - if (jeb->free_size != c->sector_size - c->cleanmarker_size) { - printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size); - goto restart; - } - } - /* OK, jeb (==c->nextblock) is now pointing at a block which definitely has - enough space */ - *ofs = jeb->offset + (c->sector_size - jeb->free_size); - *len = jeb->free_size; - - if (c->cleanmarker_size && jeb->used_size == c->cleanmarker_size && - !jeb->first_node->next_in_ino) { - /* Only node in it beforehand was a CLEANMARKER node (we think). - So mark it obsolete now that there's going to be another node - in the block. This will reduce used_size to zero but We've - already set c->nextblock so that jffs2_mark_node_obsolete() - won't try to refile it to the dirty_list. - */ - spin_unlock(&c->erase_completion_lock); - jffs2_mark_node_obsolete(c, jeb->first_node); - spin_lock(&c->erase_completion_lock); - } - - D1(printk(KERN_DEBUG "jffs2_do_reserve_space(): Giving 0x%x bytes at 0x%x\n", *len, *ofs)); - return 0; -} - -/** - * jffs2_add_physical_node_ref - add a physical node reference to the list - * @c: superblock info - * @new: new node reference to add - * @len: length of this physical node - * @dirty: dirty flag for new node - * - * Should only be used to report nodes for which space has been allocated - * by jffs2_reserve_space. - * - * Must be called with the alloc_sem held. - */ - -int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *new) -{ - struct jffs2_eraseblock *jeb; - uint32_t len; - - jeb = &c->blocks[new->flash_offset / c->sector_size]; - len = ref_totlen(c, jeb, new); - - D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x(%d), size 0x%x\n", ref_offset(new), ref_flags(new), len)); -#if 1 - /* we could get some obsolete nodes after nextblock was refiled - in wbuf.c */ - if ((c->nextblock || !ref_obsolete(new)) - &&(jeb != c->nextblock || ref_offset(new) != jeb->offset + (c->sector_size - jeb->free_size))) { - printk(KERN_WARNING "argh. node added in wrong place\n"); - jffs2_free_raw_node_ref(new); - return -EINVAL; - } -#endif - spin_lock(&c->erase_completion_lock); - - if (!jeb->first_node) - jeb->first_node = new; - if (jeb->last_node) - jeb->last_node->next_phys = new; - jeb->last_node = new; - - jeb->free_size -= len; - c->free_size -= len; - if (ref_obsolete(new)) { - jeb->dirty_size += len; - c->dirty_size += len; - } else { - jeb->used_size += len; - c->used_size += len; - } - - if (!jeb->free_size && !jeb->dirty_size && !ISDIRTY(jeb->wasted_size)) { - /* If it lives on the dirty_list, jffs2_reserve_space will put it there */ - D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); - if (jffs2_wbuf_dirty(c)) { - /* Flush the last write in the block if it's outstanding */ - spin_unlock(&c->erase_completion_lock); - jffs2_flush_wbuf_pad(c); - spin_lock(&c->erase_completion_lock); - } - - list_add_tail(&jeb->list, &c->clean_list); - c->nextblock = NULL; - } - jffs2_dbg_acct_sanity_check_nolock(c,jeb); - jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - - spin_unlock(&c->erase_completion_lock); - - return 0; -} - - -void jffs2_complete_reservation(struct jffs2_sb_info *c) -{ - D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n")); - jffs2_garbage_collect_trigger(c); - up(&c->alloc_sem); -} - -static inline int on_list(struct list_head *obj, struct list_head *head) -{ - struct list_head *this; - - list_for_each(this, head) { - if (this == obj) { - D1(printk("%p is on list at %p\n", obj, head)); - return 1; - - } - } - return 0; -} - -void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref *ref) -{ - struct jffs2_eraseblock *jeb; - int blocknr; - struct jffs2_unknown_node n; - int ret, addedsize; - size_t retlen; - - if(!ref) { - printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n"); - return; - } - if (ref_obsolete(ref)) { - D1(printk(KERN_DEBUG "jffs2_mark_node_obsolete called with already obsolete node at 0x%08x\n", ref_offset(ref))); - return; - } - blocknr = ref->flash_offset / c->sector_size; - if (blocknr >= c->nr_blocks) { - printk(KERN_NOTICE "raw node at 0x%08x is off the end of device!\n", ref->flash_offset); - BUG(); - } - jeb = &c->blocks[blocknr]; - - if (jffs2_can_mark_obsolete(c) && !jffs2_is_readonly(c) && - !(c->flags & (JFFS2_SB_FLAG_SCANNING | JFFS2_SB_FLAG_BUILDING))) { - /* Hm. This may confuse static lock analysis. If any of the above - three conditions is false, we're going to return from this - function without actually obliterating any nodes or freeing - any jffs2_raw_node_refs. So we don't need to stop erases from - happening, or protect against people holding an obsolete - jffs2_raw_node_ref without the erase_completion_lock. */ - down(&c->erase_free_sem); - } - - spin_lock(&c->erase_completion_lock); - - if (ref_flags(ref) == REF_UNCHECKED) { - D1(if (unlikely(jeb->unchecked_size < ref_totlen(c, jeb, ref))) { - printk(KERN_NOTICE "raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n", - ref_totlen(c, jeb, ref), blocknr, ref->flash_offset, jeb->used_size); - BUG(); - }) - D1(printk(KERN_DEBUG "Obsoleting previously unchecked node at 0x%08x of len %x: ", ref_offset(ref), ref_totlen(c, jeb, ref))); - jeb->unchecked_size -= ref_totlen(c, jeb, ref); - c->unchecked_size -= ref_totlen(c, jeb, ref); - } else { - D1(if (unlikely(jeb->used_size < ref_totlen(c, jeb, ref))) { - printk(KERN_NOTICE "raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n", - ref_totlen(c, jeb, ref), blocknr, ref->flash_offset, jeb->used_size); - BUG(); - }) - D1(printk(KERN_DEBUG "Obsoleting node at 0x%08x of len %#x: ", ref_offset(ref), ref_totlen(c, jeb, ref))); - jeb->used_size -= ref_totlen(c, jeb, ref); - c->used_size -= ref_totlen(c, jeb, ref); - } - - // Take care, that wasted size is taken into concern - if ((jeb->dirty_size || ISDIRTY(jeb->wasted_size + ref_totlen(c, jeb, ref))) && jeb != c->nextblock) { - D1(printk(KERN_DEBUG "Dirtying\n")); - addedsize = ref_totlen(c, jeb, ref); - jeb->dirty_size += ref_totlen(c, jeb, ref); - c->dirty_size += ref_totlen(c, jeb, ref); - - /* Convert wasted space to dirty, if not a bad block */ - if (jeb->wasted_size) { - if (on_list(&jeb->list, &c->bad_used_list)) { - D1(printk(KERN_DEBUG "Leaving block at %08x on the bad_used_list\n", - jeb->offset)); - addedsize = 0; /* To fool the refiling code later */ - } else { - D1(printk(KERN_DEBUG "Converting %d bytes of wasted space to dirty in block at %08x\n", - jeb->wasted_size, jeb->offset)); - addedsize += jeb->wasted_size; - jeb->dirty_size += jeb->wasted_size; - c->dirty_size += jeb->wasted_size; - c->wasted_size -= jeb->wasted_size; - jeb->wasted_size = 0; - } - } - } else { - D1(printk(KERN_DEBUG "Wasting\n")); - addedsize = 0; - jeb->wasted_size += ref_totlen(c, jeb, ref); - c->wasted_size += ref_totlen(c, jeb, ref); - } - ref->flash_offset = ref_offset(ref) | REF_OBSOLETE; - - jffs2_dbg_acct_sanity_check_nolock(c, jeb); - jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - - if (c->flags & JFFS2_SB_FLAG_SCANNING) { - /* Flash scanning is in progress. Don't muck about with the block - lists because they're not ready yet, and don't actually - obliterate nodes that look obsolete. If they weren't - marked obsolete on the flash at the time they _became_ - obsolete, there was probably a reason for that. */ - spin_unlock(&c->erase_completion_lock); - /* We didn't lock the erase_free_sem */ - return; - } - - if (jeb == c->nextblock) { - D2(printk(KERN_DEBUG "Not moving nextblock 0x%08x to dirty/erase_pending list\n", jeb->offset)); - } else if (!jeb->used_size && !jeb->unchecked_size) { - if (jeb == c->gcblock) { - D1(printk(KERN_DEBUG "gcblock at 0x%08x completely dirtied. Clearing gcblock...\n", jeb->offset)); - c->gcblock = NULL; - } else { - D1(printk(KERN_DEBUG "Eraseblock at 0x%08x completely dirtied. Removing from (dirty?) list...\n", jeb->offset)); - list_del(&jeb->list); - } - if (jffs2_wbuf_dirty(c)) { - D1(printk(KERN_DEBUG "...and adding to erasable_pending_wbuf_list\n")); - list_add_tail(&jeb->list, &c->erasable_pending_wbuf_list); - } else { - if (jiffies & 127) { - /* Most of the time, we just erase it immediately. Otherwise we - spend ages scanning it on mount, etc. */ - D1(printk(KERN_DEBUG "...and adding to erase_pending_list\n")); - list_add_tail(&jeb->list, &c->erase_pending_list); - c->nr_erasing_blocks++; - jffs2_erase_pending_trigger(c); - } else { - /* Sometimes, however, we leave it elsewhere so it doesn't get - immediately reused, and we spread the load a bit. */ - D1(printk(KERN_DEBUG "...and adding to erasable_list\n")); - list_add_tail(&jeb->list, &c->erasable_list); - } - } - D1(printk(KERN_DEBUG "Done OK\n")); - } else if (jeb == c->gcblock) { - D2(printk(KERN_DEBUG "Not moving gcblock 0x%08x to dirty_list\n", jeb->offset)); - } else if (ISDIRTY(jeb->dirty_size) && !ISDIRTY(jeb->dirty_size - addedsize)) { - D1(printk(KERN_DEBUG "Eraseblock at 0x%08x is freshly dirtied. Removing from clean list...\n", jeb->offset)); - list_del(&jeb->list); - D1(printk(KERN_DEBUG "...and adding to dirty_list\n")); - list_add_tail(&jeb->list, &c->dirty_list); - } else if (VERYDIRTY(c, jeb->dirty_size) && - !VERYDIRTY(c, jeb->dirty_size - addedsize)) { - D1(printk(KERN_DEBUG "Eraseblock at 0x%08x is now very dirty. Removing from dirty list...\n", jeb->offset)); - list_del(&jeb->list); - D1(printk(KERN_DEBUG "...and adding to very_dirty_list\n")); - list_add_tail(&jeb->list, &c->very_dirty_list); - } else { - D1(printk(KERN_DEBUG "Eraseblock at 0x%08x not moved anywhere. (free 0x%08x, dirty 0x%08x, used 0x%08x)\n", - jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); - } - - spin_unlock(&c->erase_completion_lock); - - if (!jffs2_can_mark_obsolete(c) || jffs2_is_readonly(c) || - (c->flags & JFFS2_SB_FLAG_BUILDING)) { - /* We didn't lock the erase_free_sem */ - return; - } - - /* The erase_free_sem is locked, and has been since before we marked the node obsolete - and potentially put its eraseblock onto the erase_pending_list. Thus, we know that - the block hasn't _already_ been erased, and that 'ref' itself hasn't been freed yet - by jffs2_free_all_node_refs() in erase.c. Which is nice. */ - - D1(printk(KERN_DEBUG "obliterating obsoleted node at 0x%08x\n", ref_offset(ref))); - ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (unsigned char *)&n); - if (ret) { - printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); - goto out_erase_sem; - } - if (retlen != sizeof(n)) { - printk(KERN_WARNING "Short read from obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); - goto out_erase_sem; - } - if (PAD(je32_to_cpu(n.totlen)) != PAD(ref_totlen(c, jeb, ref))) { - printk(KERN_WARNING "Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n", je32_to_cpu(n.totlen), ref_totlen(c, jeb, ref)); - goto out_erase_sem; - } - if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) { - D1(printk(KERN_DEBUG "Node at 0x%08x was already marked obsolete (nodetype 0x%04x)\n", ref_offset(ref), je16_to_cpu(n.nodetype))); - goto out_erase_sem; - } - /* XXX FIXME: This is ugly now */ - n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE); - ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (unsigned char *)&n); - if (ret) { - printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); - goto out_erase_sem; - } - if (retlen != sizeof(n)) { - printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); - goto out_erase_sem; - } - - /* Nodes which have been marked obsolete no longer need to be - associated with any inode. Remove them from the per-inode list. - - Note we can't do this for NAND at the moment because we need - obsolete dirent nodes to stay on the lists, because of the - horridness in jffs2_garbage_collect_deletion_dirent(). Also - because we delete the inocache, and on NAND we need that to - stay around until all the nodes are actually erased, in order - to stop us from giving the same inode number to another newly - created inode. */ - if (ref->next_in_ino) { - struct jffs2_inode_cache *ic; - struct jffs2_raw_node_ref **p; - - spin_lock(&c->erase_completion_lock); - - ic = jffs2_raw_ref_to_ic(ref); - for (p = &ic->nodes; (*p) != ref; p = &((*p)->next_in_ino)) - ; - - *p = ref->next_in_ino; - ref->next_in_ino = NULL; - - if (ic->nodes == (void *)ic && ic->nlink == 0) - jffs2_del_ino_cache(c, ic); - - spin_unlock(&c->erase_completion_lock); - } - - - /* Merge with the next node in the physical list, if there is one - and if it's also obsolete and if it doesn't belong to any inode */ - if (ref->next_phys && ref_obsolete(ref->next_phys) && - !ref->next_phys->next_in_ino) { - struct jffs2_raw_node_ref *n = ref->next_phys; - - spin_lock(&c->erase_completion_lock); - - ref->__totlen += n->__totlen; - ref->next_phys = n->next_phys; - if (jeb->last_node == n) jeb->last_node = ref; - if (jeb->gc_node == n) { - /* gc will be happy continuing gc on this node */ - jeb->gc_node=ref; - } - spin_unlock(&c->erase_completion_lock); - - jffs2_free_raw_node_ref(n); - } - - /* Also merge with the previous node in the list, if there is one - and that one is obsolete */ - if (ref != jeb->first_node ) { - struct jffs2_raw_node_ref *p = jeb->first_node; - - spin_lock(&c->erase_completion_lock); - - while (p->next_phys != ref) - p = p->next_phys; - - if (ref_obsolete(p) && !ref->next_in_ino) { - p->__totlen += ref->__totlen; - if (jeb->last_node == ref) { - jeb->last_node = p; - } - if (jeb->gc_node == ref) { - /* gc will be happy continuing gc on this node */ - jeb->gc_node=p; - } - p->next_phys = ref->next_phys; - jffs2_free_raw_node_ref(ref); - } - spin_unlock(&c->erase_completion_lock); - } - out_erase_sem: - up(&c->erase_free_sem); -} - -int jffs2_thread_should_wake(struct jffs2_sb_info *c) -{ - int ret = 0; - uint32_t dirty; - - if (c->unchecked_size) { - D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): unchecked_size %d, checked_ino #%d\n", - c->unchecked_size, c->checked_ino)); - return 1; - } - - /* dirty_size contains blocks on erase_pending_list - * those blocks are counted in c->nr_erasing_blocks. - * If one block is actually erased, it is not longer counted as dirty_space - * but it is counted in c->nr_erasing_blocks, so we add it and subtract it - * with c->nr_erasing_blocks * c->sector_size again. - * Blocks on erasable_list are counted as dirty_size, but not in c->nr_erasing_blocks - * This helps us to force gc and pick eventually a clean block to spread the load. - */ - dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks * c->sector_size; - - if (c->nr_free_blocks + c->nr_erasing_blocks < c->resv_blocks_gctrigger && - (dirty > c->nospc_dirty_size)) - ret = 1; - - D1(printk(KERN_DEBUG "jffs2_thread_should_wake(): nr_free_blocks %d, nr_erasing_blocks %d, dirty_size 0x%x: %s\n", - c->nr_free_blocks, c->nr_erasing_blocks, c->dirty_size, ret?"yes":"no")); - - return ret; -} diff --git a/components/dfs/filesystems/jffs2/src/os-ecos.h b/components/dfs/filesystems/jffs2/src/os-ecos.h deleted file mode 100644 index b6d2a0e8c..000000000 --- a/components/dfs/filesystems/jffs2/src/os-ecos.h +++ /dev/null @@ -1,265 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2002-2003 Free Software Foundation, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: os-ecos.h,v 1.24 2005/02/09 09:23:55 pavlov Exp $ - * - */ - -#ifndef __JFFS2_OS_ECOS_H__ -#define __JFFS2_OS_ECOS_H__ -#include "jffs2_config.h" -#include -#define printf rt_kprintf - -//#include -//#include -//#include -#include -#include -#include - -//#include -//#include -//#include - -//#include // tracing macros -//#include // assertion macros - -//#if defined (__GNUC__) -//#include -//#elif defined (MSVC) -//#else -//#endif - -#include "port/sys/stat.h"//#include -//#include -//#include -//#include //fixme - -//#include - -struct dirent -{ -#ifdef CYGPKG_FILEIO_DIRENT_DTYPE - - mode_t d_type; // Only supported with FATFS, RAMFS, ROMFS, - // and JFFS2. - // d_type is not part of POSIX so - // should be used with caution. -#endif - char d_name[JFFS2_NAME_MAX+1]; -}; - - -//#include -#include - -#include //prife - -//#include -//#include - -//#include - -#include -#include -#include - -//#define printf diag_printf //prife - -struct _inode; -struct super_block; - -struct iovec { - void *iov_base; - ssize_t iov_len; -}; - -static inline unsigned int full_name_hash(const unsigned char * name, unsigned int len) { - - unsigned hash = 0; - while (len--) { - hash = (hash << 4) | (hash >> 28); - hash ^= *(name++); - } - return hash; -} - -#ifdef CYGOPT_FS_JFFS2_WRITE -#define jffs2_is_readonly(c) (0) -#else -#define jffs2_is_readonly(c) (1) -#endif - -/* NAND flash not currently supported on eCos */ -#define jffs2_can_mark_obsolete(c) (1) - -#define JFFS2_INODE_INFO(i) (&(i)->jffs2_i) -#define OFNI_EDONI_2SFFJ(f) ((struct _inode *) ( ((char *)f) - ((char *)(&((struct _inode *)NULL)->jffs2_i)) ) ) - -#define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) -#define JFFS2_F_I_MODE(f) (OFNI_EDONI_2SFFJ(f)->i_mode) -#define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) -#define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) -#define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime) -#define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime) -#define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime) - -/* FIXME: eCos doesn't hav a concept of device major/minor numbers */ -#define JFFS2_F_I_RDEV_MIN(f) ((OFNI_EDONI_2SFFJ(f)->i_rdev)&0xff) -#define JFFS2_F_I_RDEV_MAJ(f) ((OFNI_EDONI_2SFFJ(f)->i_rdev)>>8) - -#define get_seconds jffs2_get_timestamp - -struct _inode { - cyg_uint32 i_ino; - - int i_count; - mode_t i_mode; - nlink_t i_nlink; // Could we dispense with this? - uid_t i_uid; - gid_t i_gid; - time_t i_atime; - time_t i_mtime; - time_t i_ctime; -// union { - unsigned short i_rdev; // For devices only - struct _inode * i_parent; // For directories only - off_t i_size; // For files only -// }; - struct super_block * i_sb; - - struct jffs2_inode_info jffs2_i; - - struct _inode * i_cache_prev; // We need doubly-linked? - struct _inode * i_cache_next; -}; - -#define JFFS2_SB_INFO(sb) (&(sb)->jffs2_sb) -#define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->jffs2_sb)) ) ) - -struct super_block { - struct jffs2_sb_info jffs2_sb; - struct _inode * s_root; - unsigned long s_mount_count; - cyg_io_handle_t s_dev; - -//#ifdef CYGOPT_FS_JFFS2_GCTHREAD -// cyg_mutex_t s_lock; // Lock the inode cache -// cyg_flag_t s_gc_thread_flags; // Communication with the gcthread -// cyg_handle_t s_gc_thread_handle; -// cyg_thread s_gc_thread; -//#if (CYGNUM_JFFS2_GC_THREAD_STACK_SIZE >= CYGNUM_HAL_STACK_SIZE_MINIMUM) -// char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; -//#else -// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; -//#endif -// cyg_mtab_entry *mte; -//#endif - -#ifdef CYGOPT_FS_JFFS2_GCTHREAD - struct rt_mutex s_lock; // Lock the inode cache - struct rt_event s_gc_thread_flags; // Communication with the gcthread - //void (*s_gc_thread_handle)(void *parameter); - struct rt_thread s_gc_thread; -//#if (CYGNUM_JFFS2_GC_THREAD_STACK_SIZE >= CYGNUM_HAL_STACK_SIZE_MINIMUM) -// char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; -//#else -// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; -//#endif - #define CYGNUM_JFFS2_GC_THREAD_STACK_SIZE (1024*4) - char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; - - cyg_mtab_entry *mte; -#endif - -}; - -#define sleep_on_spinunlock(wq, sl) spin_unlock(sl) -#define EBADFD 32767 - -/* background.c */ -#ifdef CYGOPT_FS_JFFS2_GCTHREAD -void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c); -void jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c); -void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c); -#else -static inline void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) -{ - /* We don't have a GC thread in eCos (yet) */ -} -#endif - -/* fs-ecos.c */ -struct _inode *jffs2_new_inode (struct _inode *dir_i, int mode, struct jffs2_raw_inode *ri); -struct _inode *jffs2_iget(struct super_block *sb, cyg_uint32 ino); -void jffs2_iput(struct _inode * i); -void jffs2_gc_release_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f); -struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, int inum, int nlink); -unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned long offset, unsigned long *priv); -void jffs2_gc_release_page(struct jffs2_sb_info *c, unsigned char *pg, unsigned long *priv); - -/* Avoid polluting eCos namespace with names not starting in jffs2_ */ -#define os_to_jffs2_mode(x) jffs2_from_os_mode(x) -uint32_t jffs2_from_os_mode(uint32_t osmode); -uint32_t jffs2_to_os_mode (uint32_t jmode); - - -/* flashio.c */ -int jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset, - const size_t size, size_t * return_size, unsigned char * write_buffer); -int jffs2_flash_write(struct jffs2_sb_info *c, cyg_uint32 write_buffer_offset, - const size_t size, size_t * return_size, unsigned char * read_buffer); -int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs, - unsigned long count, loff_t to, size_t *retlen); -int jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); - -// dir-ecos.c -struct _inode *jffs2_lookup(struct _inode *dir_i, const unsigned char *name, int namelen); -int jffs2_create(struct _inode *dir_i, const unsigned char *d_name, int mode, struct _inode **new_i); -int jffs2_mkdir (struct _inode *dir_i, const unsigned char *d_name, int mode); -int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned char *d_name); -int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name); -int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name); -int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsigned char *old_d_name, - struct _inode *new_dir_i, const unsigned char *new_d_name); - -/* erase.c */ -static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) -{ } - -#ifndef CONFIG_JFFS2_FS_WRITEBUFFER -#define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) ) -#define jffs2_can_mark_obsolete(c) (1) -#define jffs2_cleanmarker_oob(c) (0) -#define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) - -#define jffs2_flush_wbuf_pad(c) (c=c) -#define jffs2_flush_wbuf_gc(c, i) ({ (void)(c), (void) i, 0; }) -#define jffs2_nand_read_failcnt(c,jeb) do { ; } while(0) -#define jffs2_write_nand_badblock(c,jeb,p) (0) -#define jffs2_flash_setup(c) (0) -#define jffs2_nand_flash_cleanup(c) do {} while(0) -#define jffs2_wbuf_dirty(c) (0) -#define jffs2_flash_writev(a,b,c,d,e,f) jffs2_flash_direct_writev(a,b,c,d,e) -#define jffs2_wbuf_timeout NULL -#define jffs2_wbuf_process NULL -#define jffs2_nor_ecc(c) (0) -#else -#error no nand yet -#endif - -#ifndef BUG_ON -#define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0) -#endif - -#define __init - -#endif /* __JFFS2_OS_ECOS_H__ */ diff --git a/components/dfs/filesystems/jffs2/src/os-rtthread.h b/components/dfs/filesystems/jffs2/src/os-rtthread.h deleted file mode 100644 index 95496c2e7..000000000 --- a/components/dfs/filesystems/jffs2/src/os-rtthread.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2002-2003 Free Software Foundation, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: os-ecos.h,v 1.24 2005/02/09 09:23:55 pavlov Exp $ - * - */ - -#ifndef __JFFS2_OS_RTTHREAD_H__ -#define __JFFS2_OS_RTTHREAD_H__ -#include "jffs2_config.h" -#include -#define printf rt_kprintf - -//#include -//#include -//#include -#include -#include -#include - -//#include -//#include -//#include - -//#include // tracing macros -//#include // assertion macros - -//#if defined (__GNUC__) -//#include -//#elif defined (MSVC) -//#else -//#endif - -#include "os_sys_stat.h"//#include -//#include -//#include -//#include //fixme - -//#include -#define CYGPKG_FILEIO_DIRENT_DTYPE -struct dirent -{ -#ifdef CYGPKG_FILEIO_DIRENT_DTYPE - - mode_t d_type; // Only supported with FATFS, RAMFS, ROMFS, - // and JFFS2. - // d_type is not part of POSIX so - // should be used with caution. -#endif - char d_name[NAME_MAX+1]; -}; - -#include - -#include //prife - -//#include -//#include - -//#include - -#include -#include -#include - -//#define printf diag_printf //prife - -struct _inode; -struct super_block; - -struct iovec { - void *iov_base; - ssize_t iov_len; -}; - -static inline unsigned int full_name_hash(const unsigned char * name, unsigned int len) { - - unsigned hash = 0; - while (len--) { - hash = (hash << 4) | (hash >> 28); - hash ^= *(name++); - } - return hash; -} - -#ifdef CYGOPT_FS_JFFS2_WRITE -#define jffs2_is_readonly(c) (0) -#else -#define jffs2_is_readonly(c) (1) -#endif - -/* NAND flash not currently supported on eCos */ -#define jffs2_can_mark_obsolete(c) (1) - -#define JFFS2_INODE_INFO(i) (&(i)->jffs2_i) -#define OFNI_EDONI_2SFFJ(f) ((struct _inode *) ( ((char *)f) - ((char *)(&((struct _inode *)NULL)->jffs2_i)) ) ) - -#define JFFS2_F_I_SIZE(f) (OFNI_EDONI_2SFFJ(f)->i_size) -#define JFFS2_F_I_MODE(f) (OFNI_EDONI_2SFFJ(f)->i_mode) -#define JFFS2_F_I_UID(f) (OFNI_EDONI_2SFFJ(f)->i_uid) -#define JFFS2_F_I_GID(f) (OFNI_EDONI_2SFFJ(f)->i_gid) -#define JFFS2_F_I_CTIME(f) (OFNI_EDONI_2SFFJ(f)->i_ctime) -#define JFFS2_F_I_MTIME(f) (OFNI_EDONI_2SFFJ(f)->i_mtime) -#define JFFS2_F_I_ATIME(f) (OFNI_EDONI_2SFFJ(f)->i_atime) - -/* FIXME: eCos doesn't hav a concept of device major/minor numbers */ -#define JFFS2_F_I_RDEV_MIN(f) ((OFNI_EDONI_2SFFJ(f)->i_rdev)&0xff) -#define JFFS2_F_I_RDEV_MAJ(f) ((OFNI_EDONI_2SFFJ(f)->i_rdev)>>8) - -#define get_seconds jffs2_get_timestamp - -struct _inode { - cyg_uint32 i_ino; - - int i_count; - mode_t i_mode; - nlink_t i_nlink; // Could we dispense with this? - uid_t i_uid; - gid_t i_gid; - time_t i_atime; - time_t i_mtime; - time_t i_ctime; -// union { - unsigned short i_rdev; // For devices only - struct _inode * i_parent; // For directories only - off_t i_size; // For files only -// }; - struct super_block * i_sb; - - struct jffs2_inode_info jffs2_i; - - struct _inode * i_cache_prev; // We need doubly-linked? - struct _inode * i_cache_next; -}; - -#define JFFS2_SB_INFO(sb) (&(sb)->jffs2_sb) -#define OFNI_BS_2SFFJ(c) ((struct super_block *) ( ((char *)c) - ((char *)(&((struct super_block *)NULL)->jffs2_sb)) ) ) - -struct super_block { - struct jffs2_sb_info jffs2_sb; - struct _inode * s_root; - unsigned long s_mount_count; - cyg_io_handle_t s_dev; - -//#ifdef CYGOPT_FS_JFFS2_GCTHREAD -// cyg_mutex_t s_lock; // Lock the inode cache -// cyg_flag_t s_gc_thread_flags; // Communication with the gcthread -// cyg_handle_t s_gc_thread_handle; -// cyg_thread s_gc_thread; -//#if (CYGNUM_JFFS2_GC_THREAD_STACK_SIZE >= CYGNUM_HAL_STACK_SIZE_MINIMUM) -// char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; -//#else -// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; -//#endif -// cyg_mtab_entry *mte; -//#endif - -#ifdef CYGOPT_FS_JFFS2_GCTHREAD - struct rt_mutex s_lock; // Lock the inode cache - struct rt_event s_gc_thread_flags; // Communication with the gcthread - //void (*s_gc_thread_handle)(void *parameter); - struct rt_thread s_gc_thread; -//#if (CYGNUM_JFFS2_GC_THREAD_STACK_SIZE >= CYGNUM_HAL_STACK_SIZE_MINIMUM) -// char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; -//#else -// char s_gc_thread_stack[CYGNUM_HAL_STACK_SIZE_MINIMUM]; -//#endif - #define CYGNUM_JFFS2_GC_THREAD_STACK_SIZE (1024*4) - char s_gc_thread_stack[CYGNUM_JFFS2_GC_THREAD_STACK_SIZE]; - - cyg_mtab_entry *mte; -#endif - -}; - -#define sleep_on_spinunlock(wq, sl) spin_unlock(sl) -#define EBADFD 32767 - -/* background.c */ -#ifdef CYGOPT_FS_JFFS2_GCTHREAD -void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c); -void jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c); -void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c); -#else -static inline void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c) -{ - /* We don't have a GC thread in eCos (yet) */ -} -#endif - -/* fs-ecos.c */ -struct _inode *jffs2_new_inode (struct _inode *dir_i, int mode, struct jffs2_raw_inode *ri); -struct _inode *jffs2_iget(struct super_block *sb, cyg_uint32 ino); -void jffs2_iput(struct _inode * i); -void jffs2_gc_release_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f); -struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, int inum, int nlink); -unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned long offset, unsigned long *priv); -void jffs2_gc_release_page(struct jffs2_sb_info *c, unsigned char *pg, unsigned long *priv); - -/* Avoid polluting eCos namespace with names not starting in jffs2_ */ -#define os_to_jffs2_mode(x) jffs2_from_os_mode(x) -uint32_t jffs2_from_os_mode(uint32_t osmode); -uint32_t jffs2_to_os_mode (uint32_t jmode); - - -/* flashio.c */ -int jffs2_flash_read(struct jffs2_sb_info *c, cyg_uint32 read_buffer_offset, - const size_t size, size_t * return_size, unsigned char * write_buffer); -int jffs2_flash_write(struct jffs2_sb_info *c, cyg_uint32 write_buffer_offset, - const size_t size, size_t * return_size, unsigned char * read_buffer); -int jffs2_flash_direct_writev(struct jffs2_sb_info *c, const struct iovec *vecs, - unsigned long count, loff_t to, size_t *retlen); -int jffs2_flash_erase(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb); - -// dir-ecos.c -struct _inode *jffs2_lookup(struct _inode *dir_i, const unsigned char *name, int namelen); -int jffs2_create(struct _inode *dir_i, const unsigned char *d_name, int mode, struct _inode **new_i); -int jffs2_mkdir (struct _inode *dir_i, const unsigned char *d_name, int mode); -int jffs2_link (struct _inode *old_d_inode, struct _inode *dir_i, const unsigned char *d_name); -int jffs2_unlink(struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name); -int jffs2_rmdir (struct _inode *dir_i, struct _inode *d_inode, const unsigned char *d_name); -int jffs2_rename (struct _inode *old_dir_i, struct _inode *d_inode, const unsigned char *old_d_name, - struct _inode *new_dir_i, const unsigned char *new_d_name); - -/* erase.c */ -static inline void jffs2_erase_pending_trigger(struct jffs2_sb_info *c) -{ } - -#ifndef CONFIG_JFFS2_FS_WRITEBUFFER -#define SECTOR_ADDR(x) ( ((unsigned long)(x) & ~(c->sector_size-1)) ) -#define jffs2_can_mark_obsolete(c) (1) -#define jffs2_cleanmarker_oob(c) (0) -#define jffs2_write_nand_cleanmarker(c,jeb) (-EIO) - -#define jffs2_flush_wbuf_pad(c) (c=c) -#define jffs2_flush_wbuf_gc(c, i) ({ (void)(c), (void) i, 0; }) -#define jffs2_nand_read_failcnt(c,jeb) do { ; } while(0) -#define jffs2_write_nand_badblock(c,jeb,p) (0) -#define jffs2_flash_setup(c) (0) -#define jffs2_nand_flash_cleanup(c) do {} while(0) -#define jffs2_wbuf_dirty(c) (0) -#define jffs2_flash_writev(a,b,c,d,e,f) jffs2_flash_direct_writev(a,b,c,d,e) -#define jffs2_wbuf_timeout NULL -#define jffs2_wbuf_process NULL -#define jffs2_nor_ecc(c) (0) -#else -#error no nand yet -#endif - -#ifndef BUG_ON -#define BUG_ON(x) do { if (unlikely(x)) BUG(); } while(0) -#endif - -#define __init - -#endif /* __JFFS2_OS_ECOS_H__ */ diff --git a/components/dfs/filesystems/jffs2/src/pushpull.h b/components/dfs/filesystems/jffs2/src/pushpull.h deleted file mode 100644 index 4e84ee38a..000000000 --- a/components/dfs/filesystems/jffs2/src/pushpull.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001, 2002 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: pushpull.h,v 1.10 2004/11/16 20:36:11 dwmw2 Exp $ - * - */ - -#ifndef __PUSHPULL_H__ -#define __PUSHPULL_H__ - -#include - -struct pushpull { - unsigned char *buf; - unsigned int buflen; - unsigned int ofs; - unsigned int reserve; -}; - - -static inline void init_pushpull(struct pushpull *pp, char *buf, unsigned buflen, unsigned ofs, unsigned reserve) -{ - pp->buf = (unsigned char *)buf; - pp->buflen = buflen; - pp->ofs = ofs; - pp->reserve = reserve; -} - -static inline int pushbit(struct pushpull *pp, int bit, int use_reserved) -{ - if (pp->ofs >= pp->buflen - (use_reserved?0:pp->reserve)) { - return -ENOSPC; - } - - if (bit) { - pp->buf[pp->ofs >> 3] |= (1<<(7-(pp->ofs &7))); - } - else { - pp->buf[pp->ofs >> 3] &= ~(1<<(7-(pp->ofs &7))); - } - pp->ofs++; - - return 0; -} - -static inline int pushedbits(struct pushpull *pp) -{ - return pp->ofs; -} - -static inline int pullbit(struct pushpull *pp) -{ - int bit; - - bit = (pp->buf[pp->ofs >> 3] >> (7-(pp->ofs & 7))) & 1; - - pp->ofs++; - return bit; -} - -static inline int pulledbits(struct pushpull *pp) -{ - return pp->ofs; -} - -#endif /* __PUSHPULL_H__ */ diff --git a/components/dfs/filesystems/jffs2/src/read.c b/components/dfs/filesystems/jffs2/src/read.c deleted file mode 100644 index a70edd9bc..000000000 --- a/components/dfs/filesystems/jffs2/src/read.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: read.c,v 1.41 2005/07/22 10:32:08 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include "nodelist.h" -#include "compr.h" - -int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - struct jffs2_full_dnode *fd, unsigned char *buf, - int ofs, int len) -{ - struct jffs2_raw_inode *ri; - size_t readlen; - uint32_t crc; - unsigned char *decomprbuf = NULL; - unsigned char *readbuf = NULL; - int ret = 0,i=0; - - ri = jffs2_alloc_raw_inode(); - if (!ri) - return -ENOMEM; - - ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (unsigned char *)ri); - if (ret) { - jffs2_free_raw_inode(ri); - printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret); - return ret; - } - if (readlen != sizeof(*ri)) { - jffs2_free_raw_inode(ri); - printk(KERN_WARNING "Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n", - ref_offset(fd->raw), sizeof(*ri), readlen); - return -EIO; - } - crc = crc32(0, ri, sizeof(*ri)-8); - - D1(printk(KERN_DEBUG "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n", - ref_offset(fd->raw), je32_to_cpu(ri->node_crc), - crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), - je32_to_cpu(ri->offset), buf)); - if (crc != je32_to_cpu(ri->node_crc)) { - printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", - je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw)); - ret = -EIO; - goto out_ri; - } - /* There was a bug where we wrote hole nodes out with csize/dsize - swapped. Deal with it */ - if (ri->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(ri->dsize) && - je32_to_cpu(ri->csize)) { - ri->dsize = ri->csize; - ri->csize = cpu_to_je32(0); - } - - D1(if(ofs + len > je32_to_cpu(ri->dsize)) { - printk(KERN_WARNING "jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n", - len, ofs, je32_to_cpu(ri->dsize)); - ret = -EINVAL; - goto out_ri; - }); - - - if (ri->compr == JFFS2_COMPR_ZERO) { - memset(buf, 0, len); - goto out_ri; - } - - /* Cases: - Reading whole node and it's uncompressed - read directly to buffer provided, check CRC. - Reading whole node and it's compressed - read into comprbuf, check CRC and decompress to buffer provided - Reading partial node and it's uncompressed - read into readbuf, check CRC, and copy - Reading partial node and it's compressed - read into readbuf, check checksum, decompress to decomprbuf and copy - */ - if (ri->compr == JFFS2_COMPR_NONE && len == je32_to_cpu(ri->dsize)) { - readbuf = buf; - } else { - readbuf = kmalloc(je32_to_cpu(ri->csize), GFP_KERNEL); - if (!readbuf) { - ret = -ENOMEM; - goto out_ri; - } - } - if (ri->compr != JFFS2_COMPR_NONE) { - if (len < je32_to_cpu(ri->dsize)) { - decomprbuf = kmalloc(je32_to_cpu(ri->dsize), GFP_KERNEL); - if (!decomprbuf) { - ret = -ENOMEM; - goto out_readbuf; - } - } else { - decomprbuf = buf; - } - } else { - decomprbuf = readbuf; - } - - D2(printk(KERN_DEBUG "Read %d bytes to %p\n", je32_to_cpu(ri->csize), - readbuf)); - ret = jffs2_flash_read(c, (ref_offset(fd->raw)) + sizeof(*ri), - je32_to_cpu(ri->csize), &readlen, readbuf); - - if (!ret && readlen != je32_to_cpu(ri->csize)) - ret = -EIO; - if (ret) - goto out_decomprbuf; - - crc = crc32(0, readbuf, je32_to_cpu(ri->csize)); - if (crc != je32_to_cpu(ri->data_crc)) { - printk(KERN_WARNING "Data CRC %08x != calculated CRC %08x for node at %08x\n", - je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw)); - ret = -EIO; - goto out_decomprbuf; - } - D2(printk(KERN_DEBUG "Data CRC matches calculated CRC %08x\n", crc)); - if (ri->compr != JFFS2_COMPR_NONE) { - D2(printk(KERN_DEBUG "Decompress %d bytes from %p to %d bytes at %p\n", - je32_to_cpu(ri->csize), readbuf, je32_to_cpu(ri->dsize), decomprbuf)); - //add for debug -// for (i=0; icsize); i++) -// { -// printf("%02x ", readbuf[i]); -// if( (i+1) % 16 == 0) -// printf("\n"); -// } - //end debug - ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize)); - if (ret) { - printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); - goto out_decomprbuf; - } - } - - if (len < je32_to_cpu(ri->dsize)) { - memcpy(buf, decomprbuf+ofs, len); - } - out_decomprbuf: - if(decomprbuf != buf && decomprbuf != readbuf) - kfree(decomprbuf); - out_readbuf: - if(readbuf != buf) - kfree(readbuf); - out_ri: - jffs2_free_raw_inode(ri); - - return ret; -} - -int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - unsigned char *buf, uint32_t offset, uint32_t len) -{ - uint32_t end = offset + len; - struct jffs2_node_frag *frag; - int ret; - - D1(printk(KERN_DEBUG "jffs2_read_inode_range: ino #%u, range 0x%08x-0x%08x\n", - f->inocache->ino, offset, offset+len)); - - frag = jffs2_lookup_node_frag(&f->fragtree, offset); - - /* XXX FIXME: Where a single physical node actually shows up in two - frags, we read it twice. Don't do that. */ - /* Now we're pointing at the first frag which overlaps our page */ - while(offset < end) { - D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end)); - if (unlikely(!frag || frag->ofs > offset)) { - uint32_t holesize = end - offset; - if (frag) { - D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset)); - holesize = min(holesize, frag->ofs - offset); - } - D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize)); - memset(buf, 0, holesize); - buf += holesize; - offset += holesize; - continue; - } else if (unlikely(!frag->node)) { - uint32_t holeend = min(end, frag->ofs + frag->size); - D1(printk(KERN_DEBUG "Filling frag hole from %d-%d (frag 0x%x 0x%x)\n", offset, holeend, frag->ofs, frag->ofs + frag->size)); - memset(buf, 0, holeend - offset); - buf += holeend - offset; - offset = holeend; - frag = frag_next(frag); - continue; - } else { - uint32_t readlen; - uint32_t fragofs; /* offset within the frag to start reading */ - - fragofs = offset - frag->ofs; - readlen = min(frag->size - fragofs, end - offset); - D1(printk(KERN_DEBUG "Reading %d-%d from node at 0x%08x (%d)\n", - frag->ofs+fragofs, frag->ofs+fragofs+readlen, - ref_offset(frag->node->raw), ref_flags(frag->node->raw))); - ret = jffs2_read_dnode(c, f, frag->node, buf, fragofs + frag->ofs - frag->node->ofs, readlen); - D2(printk(KERN_DEBUG "node read done\n")); - if (ret) { - D1(printk(KERN_DEBUG"jffs2_read_inode_range error %d\n",ret)); - memset(buf, 0, readlen); - return ret; - } - buf += readlen; - offset += readlen; - frag = frag_next(frag); - D2(printk(KERN_DEBUG "node read was OK. Looping\n")); - } - } - return 0; -} - diff --git a/components/dfs/filesystems/jffs2/src/readinode.c b/components/dfs/filesystems/jffs2/src/readinode.c deleted file mode 100644 index ae1481fd2..000000000 --- a/components/dfs/filesystems/jffs2/src/readinode.c +++ /dev/null @@ -1,895 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: readinode.c,v 1.132 2005/07/28 14:46:40 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" - -void jffs2_truncate_fragtree (struct jffs2_sb_info *c, struct rb_root *list, uint32_t size) -{ - struct jffs2_node_frag *frag = jffs2_lookup_node_frag(list, size); - - JFFS2_DBG_FRAGTREE("truncating fragtree to 0x%08x bytes\n", size); - - /* We know frag->ofs <= size. That's what lookup does for us */ - if (frag && frag->ofs != size) { - if (frag->ofs+frag->size >= size) { - JFFS2_DBG_FRAGTREE2("truncating frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size); - frag->size = size - frag->ofs; - } - frag = frag_next(frag); - } - while (frag && frag->ofs >= size) { - struct jffs2_node_frag *next = frag_next(frag); - - JFFS2_DBG_FRAGTREE("removing frag 0x%08x-0x%08x\n", frag->ofs, frag->ofs+frag->size); - frag_erase(frag, list); - jffs2_obsolete_node_frag(c, frag); - frag = next; - } -} - -/* - * Put a new tmp_dnode_info into the temporaty RB-tree, keeping the list in - * order of increasing version. - */ -static void jffs2_add_tn_to_tree(struct jffs2_tmp_dnode_info *tn, struct rb_root *list) -{ - struct rb_node **p = &list->rb_node; - struct rb_node * parent = NULL; - struct jffs2_tmp_dnode_info *this; - - while (*p) { - parent = *p; - this = rb_entry(parent, struct jffs2_tmp_dnode_info, rb); - - /* There may actually be a collision here, but it doesn't - actually matter. As long as the two nodes with the same - version are together, it's all fine. */ - if (tn->version < this->version) - p = &(*p)->rb_left; - else - p = &(*p)->rb_right; - } - - rb_link_node(&tn->rb, parent, p); - rb_insert_color(&tn->rb, list); -} - -static void jffs2_free_tmp_dnode_info_list(struct rb_root *list) -{ - struct rb_node *this; - struct jffs2_tmp_dnode_info *tn; - - this = list->rb_node; - - /* Now at bottom of tree */ - while (this) { - if (this->rb_left) - this = this->rb_left; - else if (this->rb_right) - this = this->rb_right; - else { - tn = rb_entry(this, struct jffs2_tmp_dnode_info, rb); - jffs2_free_full_dnode(tn->fn); - jffs2_free_tmp_dnode_info(tn); - - this = this->rb_parent; - if (!this) - break; - - if (this->rb_left == &tn->rb) - this->rb_left = NULL; - else if (this->rb_right == &tn->rb) - this->rb_right = NULL; - else BUG(); - } - } - list->rb_node = NULL; -} - -static void jffs2_free_full_dirent_list(struct jffs2_full_dirent *fd) -{ - struct jffs2_full_dirent *next; - - while (fd) { - next = fd->next; - jffs2_free_full_dirent(fd); - fd = next; - } -} - -/* Returns first valid node after 'ref'. May return 'ref' */ -static struct jffs2_raw_node_ref *jffs2_first_valid_node(struct jffs2_raw_node_ref *ref) -{ - while (ref && ref->next_in_ino) { - if (!ref_obsolete(ref)) - return ref; - JFFS2_DBG_NODEREF("node at 0x%08x is obsoleted. Ignoring.\n", ref_offset(ref)); - ref = ref->next_in_ino; - } - return NULL; -} - -/* - * Helper function for jffs2_get_inode_nodes(). - * It is called every time an directory entry node is found. - * - * Returns: 0 on succes; - * 1 if the node should be marked obsolete; - * negative error code on failure. - */ -static inline int -read_direntry(struct jffs2_sb_info *c, - struct jffs2_raw_node_ref *ref, - struct jffs2_raw_dirent *rd, - uint32_t read, - struct jffs2_full_dirent **fdp, - int32_t *latest_mctime, - uint32_t *mctime_ver) -{ - struct jffs2_full_dirent *fd; - - /* The direntry nodes are checked during the flash scanning */ - BUG_ON(ref_flags(ref) == REF_UNCHECKED); - /* Obsoleted. This cannot happen, surely? dwmw2 20020308 */ - BUG_ON(ref_obsolete(ref)); - - /* Sanity check */ - if (unlikely(PAD((rd->nsize + sizeof(*rd))) != PAD(je32_to_cpu(rd->totlen)))) { - JFFS2_ERROR("illegal nsize in node at %#08x: nsize %#02x, totlen %#04x\n", - ref_offset(ref), rd->nsize, je32_to_cpu(rd->totlen)); - return 1; - } - - fd = jffs2_alloc_full_dirent(rd->nsize + 1); - if (unlikely(!fd)) - return -ENOMEM; - - fd->raw = ref; - fd->version = je32_to_cpu(rd->version); - fd->ino = je32_to_cpu(rd->ino); - fd->type = rd->type; - - /* Pick out the mctime of the latest dirent */ - if(fd->version > *mctime_ver) { - *mctime_ver = fd->version; - *latest_mctime = je32_to_cpu(rd->mctime); - } - - /* - * Copy as much of the name as possible from the raw - * dirent we've already read from the flash. - */ - if (read > sizeof(*rd)) - memcpy(&fd->name[0], &rd->name[0], - min_t(uint32_t, rd->nsize, (read - sizeof(*rd)) )); - - /* Do we need to copy any more of the name directly from the flash? */ - if (rd->nsize + sizeof(*rd) > read) { - /* FIXME: point() */ - int err; - int already = read - sizeof(*rd); - - err = jffs2_flash_read(c, (ref_offset(ref)) + read, - rd->nsize - already, (size_t*)&read, &fd->name[already]); - if (unlikely(read != rd->nsize - already) && likely(!err)) - return -EIO; - - if (unlikely(err)) { - JFFS2_ERROR("read remainder of name: error %d\n", err); - jffs2_free_full_dirent(fd); - return -EIO; - } - } - - fd->nhash = full_name_hash(fd->name, rd->nsize); - fd->next = NULL; - fd->name[rd->nsize] = '\0'; - - /* - * Wheee. We now have a complete jffs2_full_dirent structure, with - * the name in it and everything. Link it into the list - */ - jffs2_add_fd_to_list(c, fd, fdp); - - return 0; -} - -/* - * Helper function for jffs2_get_inode_nodes(). - * It is called every time an inode node is found. - * - * Returns: 0 on succes; - * 1 if the node should be marked obsolete; - * negative error code on failure. - */ -static inline int -read_dnode(struct jffs2_sb_info *c, - struct jffs2_raw_node_ref *ref, - struct jffs2_raw_inode *rd, - uint32_t read, - struct rb_root *tnp, - int32_t *latest_mctime, - uint32_t *mctime_ver) -{ - struct jffs2_eraseblock *jeb; - struct jffs2_tmp_dnode_info *tn; - - /* Obsoleted. This cannot happen, surely? dwmw2 20020308 */ - BUG_ON(ref_obsolete(ref)); - - /* If we've never checked the CRCs on this node, check them now */ - if (ref_flags(ref) == REF_UNCHECKED) { - uint32_t crc, len; - - crc = crc32(0, rd, sizeof(*rd) - 8); - if (unlikely(crc != je32_to_cpu(rd->node_crc))) { - JFFS2_NOTICE("header CRC failed on node at %#08x: read %#08x, calculated %#08x\n", - ref_offset(ref), je32_to_cpu(rd->node_crc), crc); - return 1; - } - - /* Sanity checks */ - if (unlikely(je32_to_cpu(rd->offset) > je32_to_cpu(rd->isize)) || - unlikely(PAD(je32_to_cpu(rd->csize) + sizeof(*rd)) != PAD(je32_to_cpu(rd->totlen)))) { - JFFS2_WARNING("inode node header CRC is corrupted at %#08x\n", ref_offset(ref)); - jffs2_dbg_dump_node(c, ref_offset(ref)); - return 1; - } - - if (rd->compr != JFFS2_COMPR_ZERO && je32_to_cpu(rd->csize)) { - unsigned char *buf = NULL; - uint32_t pointed = 0; - int err; -#ifndef __ECOS - if (c->mtd->point) { - err = c->mtd->point (c->mtd, ref_offset(ref) + sizeof(*rd), je32_to_cpu(rd->csize), - &read, &buf); - if (unlikely(read < je32_to_cpu(rd->csize)) && likely(!err)) { - JFFS2_ERROR("MTD point returned len too short: 0x%zx\n", read); - c->mtd->unpoint(c->mtd, buf, ref_offset(ref) + sizeof(*rd), - je32_to_cpu(rd->csize)); - } else if (unlikely(err)){ - JFFS2_ERROR("MTD point failed %d\n", err); - } else - pointed = 1; /* succefully pointed to device */ - } -#endif - if(!pointed){ - buf = kmalloc(je32_to_cpu(rd->csize), GFP_KERNEL); - if (!buf) - return -ENOMEM; - - err = jffs2_flash_read(c, ref_offset(ref) + sizeof(*rd), je32_to_cpu(rd->csize), - (size_t*)&read, buf); - if (unlikely(read != je32_to_cpu(rd->csize)) && likely(!err)) - err = -EIO; - if (err) { - kfree(buf); - return err; - } - } - crc = crc32(0, buf, je32_to_cpu(rd->csize)); - if(!pointed) - kfree(buf); -#ifndef __ECOS - else - c->mtd->unpoint(c->mtd, buf, ref_offset(ref) + sizeof(*rd), je32_to_cpu(rd->csize)); -#endif - - if (crc != je32_to_cpu(rd->data_crc)) { - JFFS2_NOTICE("data CRC failed on node at %#08x: read %#08x, calculated %#08x\n", - ref_offset(ref), je32_to_cpu(rd->data_crc), crc); - return 1; - } - - } - - /* Mark the node as having been checked and fix the accounting accordingly */ - jeb = &c->blocks[ref->flash_offset / c->sector_size]; - len = ref_totlen(c, jeb, ref); - - spin_lock(&c->erase_completion_lock); - jeb->used_size += len; - jeb->unchecked_size -= len; - c->used_size += len; - c->unchecked_size -= len; - - /* If node covers at least a whole page, or if it starts at the - beginning of a page and runs to the end of the file, or if - it's a hole node, mark it REF_PRISTINE, else REF_NORMAL. - - If it's actually overlapped, it'll get made NORMAL (or OBSOLETE) - when the overlapping node(s) get added to the tree anyway. - */ - if ((je32_to_cpu(rd->dsize) >= PAGE_CACHE_SIZE) || - ( ((je32_to_cpu(rd->offset) & (PAGE_CACHE_SIZE-1))==0) && - (je32_to_cpu(rd->dsize) + je32_to_cpu(rd->offset) == je32_to_cpu(rd->isize)))) { - JFFS2_DBG_READINODE("marking node at %#08x REF_PRISTINE\n", ref_offset(ref)); - ref->flash_offset = ref_offset(ref) | REF_PRISTINE; - } else { - JFFS2_DBG_READINODE("marking node at %#08x REF_NORMAL\n", ref_offset(ref)); - ref->flash_offset = ref_offset(ref) | REF_NORMAL; - } - spin_unlock(&c->erase_completion_lock); - } - - tn = jffs2_alloc_tmp_dnode_info(); - if (!tn) { - JFFS2_ERROR("alloc tn failed\n"); - return -ENOMEM; - } - - tn->fn = jffs2_alloc_full_dnode(); - if (!tn->fn) { - JFFS2_ERROR("alloc fn failed\n"); - jffs2_free_tmp_dnode_info(tn); - return -ENOMEM; - } - - tn->version = je32_to_cpu(rd->version); - tn->fn->ofs = je32_to_cpu(rd->offset); - tn->fn->raw = ref; - - /* There was a bug where we wrote hole nodes out with - csize/dsize swapped. Deal with it */ - if (rd->compr == JFFS2_COMPR_ZERO && !je32_to_cpu(rd->dsize) && je32_to_cpu(rd->csize)) - tn->fn->size = je32_to_cpu(rd->csize); - else // normal case... - tn->fn->size = je32_to_cpu(rd->dsize); - - JFFS2_DBG_READINODE("dnode @%08x: ver %u, offset %#04x, dsize %#04x\n", - ref_offset(ref), je32_to_cpu(rd->version), je32_to_cpu(rd->offset), je32_to_cpu(rd->dsize)); - - jffs2_add_tn_to_tree(tn, tnp); - - return 0; -} - -/* - * Helper function for jffs2_get_inode_nodes(). - * It is called every time an unknown node is found. - * - * Returns: 0 on succes; - * 1 if the node should be marked obsolete; - * negative error code on failure. - */ -static inline int -read_unknown(struct jffs2_sb_info *c, - struct jffs2_raw_node_ref *ref, - struct jffs2_unknown_node *un, - uint32_t read) -{ - /* We don't mark unknown nodes as REF_UNCHECKED */ - BUG_ON(ref_flags(ref) == REF_UNCHECKED); - - un->nodetype = cpu_to_je16(JFFS2_NODE_ACCURATE | je16_to_cpu(un->nodetype)); - - if (crc32(0, un, sizeof(struct jffs2_unknown_node) - 4) != je32_to_cpu(un->hdr_crc)) { - /* Hmmm. This should have been caught at scan time. */ - JFFS2_NOTICE("node header CRC failed at %#08x. But it must have been OK earlier.\n", ref_offset(ref)); - jffs2_dbg_dump_node(c, ref_offset(ref)); - return 1; - } else { - switch(je16_to_cpu(un->nodetype) & JFFS2_COMPAT_MASK) { - - case JFFS2_FEATURE_INCOMPAT: - JFFS2_ERROR("unknown INCOMPAT nodetype %#04X at %#08x\n", - je16_to_cpu(un->nodetype), ref_offset(ref)); - /* EEP */ - BUG(); - break; - - case JFFS2_FEATURE_ROCOMPAT: - JFFS2_ERROR("unknown ROCOMPAT nodetype %#04X at %#08x\n", - je16_to_cpu(un->nodetype), ref_offset(ref)); - BUG_ON(!(c->flags & JFFS2_SB_FLAG_RO)); - break; - - case JFFS2_FEATURE_RWCOMPAT_COPY: - JFFS2_NOTICE("unknown RWCOMPAT_COPY nodetype %#04X at %#08x\n", - je16_to_cpu(un->nodetype), ref_offset(ref)); - break; - - case JFFS2_FEATURE_RWCOMPAT_DELETE: - JFFS2_NOTICE("unknown RWCOMPAT_DELETE nodetype %#04X at %#08x\n", - je16_to_cpu(un->nodetype), ref_offset(ref)); - return 1; - } - } - - return 0; -} - -/* Get tmp_dnode_info and full_dirent for all non-obsolete nodes associated - with this ino, returning the former in order of version */ - -static int jffs2_get_inode_nodes(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - struct rb_root *tnp, struct jffs2_full_dirent **fdp, - uint32_t *highest_version, uint32_t *latest_mctime, - uint32_t *mctime_ver) -{ - struct jffs2_raw_node_ref *ref, *valid_ref; - struct rb_root ret_tn = RB_ROOT; - struct jffs2_full_dirent *ret_fd = NULL; - union jffs2_node_union node; - size_t retlen; - int err; - - *mctime_ver = 0; - - JFFS2_DBG_READINODE("ino #%u\n", f->inocache->ino); - - spin_lock(&c->erase_completion_lock); - - valid_ref = jffs2_first_valid_node(f->inocache->nodes); - - if (!valid_ref && (f->inocache->ino != 1)) - JFFS2_WARNING("no valid nodes for ino #%u\n", f->inocache->ino); - - while (valid_ref) { - /* We can hold a pointer to a non-obsolete node without the spinlock, - but _obsolete_ nodes may disappear at any time, if the block - they're in gets erased. So if we mark 'ref' obsolete while we're - not holding the lock, it can go away immediately. For that reason, - we find the next valid node first, before processing 'ref'. - */ - ref = valid_ref; - valid_ref = jffs2_first_valid_node(ref->next_in_ino); - spin_unlock(&c->erase_completion_lock); - - cond_resched(); - - /* FIXME: point() */ - err = jffs2_flash_read(c, (ref_offset(ref)), - min_t(uint32_t, ref_totlen(c, NULL, ref), sizeof(node)), - &retlen, (void *)&node); - if (err) { - JFFS2_ERROR("error %d reading node at 0x%08x in get_inode_nodes()\n", err, ref_offset(ref)); - goto free_out; - } - - switch (je16_to_cpu(node.u.nodetype)) { - - case JFFS2_NODETYPE_DIRENT: - JFFS2_DBG_READINODE("node at %08x (%d) is a dirent node\n", ref_offset(ref), ref_flags(ref)); - - if (retlen < sizeof(node.d)) { - JFFS2_ERROR("short read dirent at %#08x\n", ref_offset(ref)); - err = -EIO; - goto free_out; - } - - err = read_direntry(c, ref, &node.d, retlen, &ret_fd, (int32_t *)latest_mctime, mctime_ver); - if (err == 1) { - jffs2_mark_node_obsolete(c, ref); - break; - } else if (unlikely(err)) - goto free_out; - - if (je32_to_cpu(node.d.version) > *highest_version) - *highest_version = je32_to_cpu(node.d.version); - - break; - - case JFFS2_NODETYPE_INODE: - JFFS2_DBG_READINODE("node at %08x (%d) is a data node\n", ref_offset(ref), ref_flags(ref)); - - if (retlen < sizeof(node.i)) { - JFFS2_ERROR("short read dnode at %#08x\n", ref_offset(ref)); - err = -EIO; - goto free_out; - } - - err = read_dnode(c, ref, &node.i, retlen, &ret_tn, (int32_t *)latest_mctime, mctime_ver); - if (err == 1) { - jffs2_mark_node_obsolete(c, ref); - break; - } else if (unlikely(err)) - goto free_out; - - if (je32_to_cpu(node.i.version) > *highest_version) - *highest_version = je32_to_cpu(node.i.version); - - JFFS2_DBG_READINODE("version %d, highest_version now %d\n", - je32_to_cpu(node.i.version), *highest_version); - - break; - - default: - /* Check we've managed to read at least the common node header */ - if (retlen < sizeof(struct jffs2_unknown_node)) { - JFFS2_ERROR("short read unknown node at %#08x\n", ref_offset(ref)); - return -EIO; - } - - err = read_unknown(c, ref, &node.u, retlen); - if (err == 1) { - jffs2_mark_node_obsolete(c, ref); - break; - } else if (unlikely(err)) - goto free_out; - - } - spin_lock(&c->erase_completion_lock); - - } - spin_unlock(&c->erase_completion_lock); - *tnp = ret_tn; - *fdp = ret_fd; - - return 0; - - free_out: - jffs2_free_tmp_dnode_info_list(&ret_tn); - jffs2_free_full_dirent_list(ret_fd); - return err; -} - -static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c, - struct jffs2_inode_info *f, - struct jffs2_raw_inode *latest_node) -{ - struct jffs2_tmp_dnode_info *tn = NULL; - struct rb_root tn_list; - struct rb_node *rb, *repl_rb; - struct jffs2_full_dirent *fd_list; - struct jffs2_full_dnode *fn = NULL; - uint32_t crc; - uint32_t latest_mctime, mctime_ver; - uint32_t mdata_ver = 0; - size_t retlen; - int ret; - - JFFS2_DBG_READINODE("ino #%u nlink is %d\n", f->inocache->ino, f->inocache->nlink); - - /* Grab all nodes relevant to this ino */ - ret = jffs2_get_inode_nodes(c, f, &tn_list, &fd_list, &f->highest_version, &latest_mctime, &mctime_ver); - - if (ret) { - JFFS2_ERROR("cannot read nodes for ino %u, returned error is %d\n", f->inocache->ino, ret); - if (f->inocache->state == INO_STATE_READING) - jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); - return ret; - } - f->dents = fd_list; - - rb = rb_first(&tn_list); - - while (rb) { - tn = rb_entry(rb, struct jffs2_tmp_dnode_info, rb); - fn = tn->fn; - - if (f->metadata) { - if (likely(tn->version >= mdata_ver)) { - JFFS2_DBG_READINODE("obsoleting old metadata at 0x%08x\n", ref_offset(f->metadata->raw)); - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - f->metadata = NULL; - - mdata_ver = 0; - } else { - /* This should never happen. */ - JFFS2_ERROR("Er. New metadata at 0x%08x with ver %d is actually older than previous ver %d at 0x%08x\n", - ref_offset(fn->raw), tn->version, mdata_ver, ref_offset(f->metadata->raw)); - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - /* Fill in latest_node from the metadata, not this one we're about to free... */ - fn = f->metadata; - goto next_tn; - } - } - - if (fn->size) { - jffs2_add_full_dnode_to_inode(c, f, fn); - } else { - /* Zero-sized node at end of version list. Just a metadata update */ - JFFS2_DBG_READINODE("metadata @%08x: ver %d\n", ref_offset(fn->raw), tn->version); - f->metadata = fn; - mdata_ver = tn->version; - } - next_tn: - BUG_ON(rb->rb_left); - if (rb->rb_parent && rb->rb_parent->rb_left == rb) { - /* We were then left-hand child of our parent. We need - to move our own right-hand child into our place. */ - repl_rb = rb->rb_right; - if (repl_rb) - repl_rb->rb_parent = rb->rb_parent; - } else - repl_rb = NULL; - - rb = rb_next(rb); - - /* Remove the spent tn from the tree; don't bother rebalancing - but put our right-hand child in our own place. */ - if (tn->rb.rb_parent) { - if (tn->rb.rb_parent->rb_left == &tn->rb) - tn->rb.rb_parent->rb_left = repl_rb; - else if (tn->rb.rb_parent->rb_right == &tn->rb) - tn->rb.rb_parent->rb_right = repl_rb; - else BUG(); - } else if (tn->rb.rb_right) - tn->rb.rb_right->rb_parent = NULL; - - jffs2_free_tmp_dnode_info(tn); - } - jffs2_dbg_fragtree_paranoia_check_nolock(f); - - if (!fn) { - /* No data nodes for this inode. */ - if (f->inocache->ino != 1) { - JFFS2_WARNING("no data nodes found for ino #%u\n", f->inocache->ino); - if (!fd_list) { - if (f->inocache->state == INO_STATE_READING) - jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); - return -EIO; - } - JFFS2_NOTICE("but it has children so we fake some modes for it\n"); - } - latest_node->mode = cpu_to_jemode(S_IFDIR|S_IRUGO|S_IWUSR|S_IXUGO); - latest_node->version = cpu_to_je32(0); - latest_node->atime = latest_node->ctime = latest_node->mtime = cpu_to_je32(0); - latest_node->isize = cpu_to_je32(0); - latest_node->gid = cpu_to_je16(0); - latest_node->uid = cpu_to_je16(0); - if (f->inocache->state == INO_STATE_READING) - jffs2_set_inocache_state(c, f->inocache, INO_STATE_PRESENT); - return 0; - } - - ret = jffs2_flash_read(c, ref_offset(fn->raw), sizeof(*latest_node), &retlen, (void *)latest_node); - if (ret || retlen != sizeof(*latest_node)) { - JFFS2_ERROR("failed to read from flash: error %d, %zd of %zd bytes read\n", - ret, retlen, sizeof(*latest_node)); - /* FIXME: If this fails, there seems to be a memory leak. Find it. */ - up(&f->sem); - jffs2_do_clear_inode(c, f); - return ret?ret:-EIO; - } - - crc = crc32(0, latest_node, sizeof(*latest_node)-8); - if (crc != je32_to_cpu(latest_node->node_crc)) { - JFFS2_ERROR("CRC failed for read_inode of inode %u at physical location 0x%x\n", - f->inocache->ino, ref_offset(fn->raw)); - up(&f->sem); - jffs2_do_clear_inode(c, f); - return -EIO; - } - - switch(jemode_to_cpu(latest_node->mode) & S_IFMT) { - case S_IFDIR: - if (mctime_ver > je32_to_cpu(latest_node->version)) { - /* The times in the latest_node are actually older than - mctime in the latest dirent. Cheat. */ - latest_node->ctime = latest_node->mtime = cpu_to_je32(latest_mctime); - } - break; - - - case S_IFREG: - /* If it was a regular file, truncate it to the latest node's isize */ - jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(latest_node->isize)); - break; - -// case S_IFLNK: prife -// /* Hack to work around broken isize in old symlink code. -// Remove this when dwmw2 comes to his senses and stops -// symlinks from being an entirely gratuitous special -// case. */ -// if (!je32_to_cpu(latest_node->isize)) -// latest_node->isize = latest_node->dsize; -// -// if (f->inocache->state != INO_STATE_CHECKING) { -// /* Symlink's inode data is the target path. Read it and -// * keep in RAM to facilitate quick follow symlink -// * operation. */ -// f->target = kmalloc(je32_to_cpu(latest_node->csize) + 1, GFP_KERNEL); -// if (!f->target) { -// JFFS2_ERROR("can't allocate %d bytes of memory for the symlink target path cache\n", je32_to_cpu(latest_node->csize)); -// up(&f->sem); -// jffs2_do_clear_inode(c, f); -// return -ENOMEM; -// } -// -// ret = jffs2_flash_read(c, ref_offset(fn->raw) + sizeof(*latest_node), -// je32_to_cpu(latest_node->csize), &retlen, (char *)f->target); -// -// if (ret || retlen != je32_to_cpu(latest_node->csize)) { -// if (retlen != je32_to_cpu(latest_node->csize)) -// ret = -EIO; -// kfree(f->target); -// f->target = NULL; -// up(&f->sem); -// jffs2_do_clear_inode(c, f); -// return -ret; -// } -// -// f->target[je32_to_cpu(latest_node->csize)] = '\0'; -// JFFS2_DBG_READINODE("symlink's target '%s' cached\n", f->target); -// } -// -// /* fall through... */ - - case S_IFBLK: - case S_IFCHR: - /* Certain inode types should have only one data node, and it's - kept as the metadata node */ - if (f->metadata) { - JFFS2_ERROR("Argh. Special inode #%u with mode 0%o had metadata node\n", - f->inocache->ino, jemode_to_cpu(latest_node->mode)); - up(&f->sem); - jffs2_do_clear_inode(c, f); - return -EIO; - } - if (!frag_first(&f->fragtree)) { - JFFS2_ERROR("Argh. Special inode #%u with mode 0%o has no fragments\n", - f->inocache->ino, jemode_to_cpu(latest_node->mode)); - up(&f->sem); - jffs2_do_clear_inode(c, f); - return -EIO; - } - /* ASSERT: f->fraglist != NULL */ - if (frag_next(frag_first(&f->fragtree))) { - JFFS2_ERROR("Argh. Special inode #%u with mode 0x%x had more than one node\n", - f->inocache->ino, jemode_to_cpu(latest_node->mode)); - /* FIXME: Deal with it - check crc32, check for duplicate node, check times and discard the older one */ - up(&f->sem); - jffs2_do_clear_inode(c, f); - return -EIO; - } - /* OK. We're happy */ - f->metadata = frag_first(&f->fragtree)->node; - jffs2_free_node_frag(frag_first(&f->fragtree)); - f->fragtree.rb_node = NULL;//f->fragtree = RB_ROOT; // modify it for vs - break; - } - if (f->inocache->state == INO_STATE_READING) - jffs2_set_inocache_state(c, f->inocache, INO_STATE_PRESENT); - - return 0; -} - -/* Scan the list of all nodes present for this ino, build map of versions, etc. */ -int jffs2_do_read_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - uint32_t ino, struct jffs2_raw_inode *latest_node) -{ - JFFS2_DBG_READINODE("read inode #%u\n", ino); - - retry_inocache: - spin_lock(&c->inocache_lock); - f->inocache = jffs2_get_ino_cache(c, ino); - - if (f->inocache) { - /* Check its state. We may need to wait before we can use it */ - switch(f->inocache->state) { - case INO_STATE_UNCHECKED: - case INO_STATE_CHECKEDABSENT: - f->inocache->state = INO_STATE_READING; - break; - - case INO_STATE_CHECKING: - case INO_STATE_GC: - /* If it's in either of these states, we need - to wait for whoever's got it to finish and - put it back. */ - JFFS2_DBG_READINODE("waiting for ino #%u in state %d\n", ino, f->inocache->state); - sleep_on_spinunlock(&c->inocache_wq, &c->inocache_lock); - goto retry_inocache; - - case INO_STATE_READING: - case INO_STATE_PRESENT: - /* Eep. This should never happen. It can - happen if Linux calls read_inode() again - before clear_inode() has finished though. */ - JFFS2_ERROR("Eep. Trying to read_inode #%u when it's already in state %d!\n", ino, f->inocache->state); - /* Fail. That's probably better than allowing it to succeed */ - f->inocache = NULL; - break; - - default: - BUG(); - } - } - spin_unlock(&c->inocache_lock); - - if (!f->inocache && ino == 1) { - /* Special case - no root inode on medium */ - f->inocache = jffs2_alloc_inode_cache(); - if (!f->inocache) { - JFFS2_ERROR("cannot allocate inocache for root inode\n"); - return -ENOMEM; - } - JFFS2_DBG_READINODE("creating inocache for root inode\n"); - memset(f->inocache, 0, sizeof(struct jffs2_inode_cache)); - f->inocache->ino = f->inocache->nlink = 1; - f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; - f->inocache->state = INO_STATE_READING; - jffs2_add_ino_cache(c, f->inocache); - } - if (!f->inocache) { - JFFS2_ERROR("requestied to read an nonexistent ino %u\n", ino); - return -ENOENT; - } - - return jffs2_do_read_inode_internal(c, f, latest_node); -} - -int jffs2_do_crccheck_inode(struct jffs2_sb_info *c, struct jffs2_inode_cache *ic) -{ - struct jffs2_raw_inode n; - struct jffs2_inode_info *f = kmalloc(sizeof(*f), GFP_KERNEL); - int ret; - - if (!f) - return -ENOMEM; - - memset(f, 0, sizeof(*f)); - init_MUTEX_LOCKED(&f->sem); - f->inocache = ic; - - ret = jffs2_do_read_inode_internal(c, f, &n); - if (!ret) { - up(&f->sem); - jffs2_do_clear_inode(c, f); - } - kfree (f); - return ret; -} - -void jffs2_do_clear_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f) -{ - struct jffs2_full_dirent *fd, *fds; - int deleted; - - down(&f->sem); - deleted = f->inocache && !f->inocache->nlink; - - if (f->inocache && f->inocache->state != INO_STATE_CHECKING) - jffs2_set_inocache_state(c, f->inocache, INO_STATE_CLEARING); - - if (f->metadata) { - if (deleted) - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - } - - jffs2_kill_fragtree(&f->fragtree, deleted?c:NULL); - - if (f->target) { - kfree(f->target); - f->target = NULL; - } - - fds = f->dents; - while(fds) { - fd = fds; - fds = fd->next; - jffs2_free_full_dirent(fd); - } - - if (f->inocache && f->inocache->state != INO_STATE_CHECKING) { - jffs2_set_inocache_state(c, f->inocache, INO_STATE_CHECKEDABSENT); - if (f->inocache->nodes == (void *)f->inocache) - jffs2_del_ino_cache(c, f->inocache); - } - - up(&f->sem); -} diff --git a/components/dfs/filesystems/jffs2/src/scan.c b/components/dfs/filesystems/jffs2/src/scan.c deleted file mode 100644 index f67d122a1..000000000 --- a/components/dfs/filesystems/jffs2/src/scan.c +++ /dev/null @@ -1,946 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: scan.c,v 1.121 2005/07/20 15:32:28 dedekind Exp $ - * - */ -#include -#include -#include -#include -#include -#include -#include -#include "nodelist.h" - -#define DEFAULT_EMPTY_SCAN_SIZE 1024 - -#if defined (__GNUC__) -#elif defined (MSVC) -#define typeof(x) uint32_t -#else -#endif - -#define DIRTY_SPACE(x) do { typeof(x) _x = (x); \ - c->free_size -= _x; c->dirty_size += _x; \ - jeb->free_size -= _x ; jeb->dirty_size += _x; \ - }while(0) -#define USED_SPACE(x) do { typeof(x) _x = (x); \ - c->free_size -= _x; c->used_size += _x; \ - jeb->free_size -= _x ; jeb->used_size += _x; \ - }while(0) -#define UNCHECKED_SPACE(x) do { typeof(x) _x = (x); \ - c->free_size -= _x; c->unchecked_size += _x; \ - jeb->free_size -= _x ; jeb->unchecked_size += _x; \ - }while(0) - -#if defined (__GNUC__) -#define noisy_printk(noise, args...) do { \ - if (*(noise)) { \ - printk(KERN_NOTICE args); \ - (*(noise))--; \ - if (!(*(noise))) { \ - printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); \ - } \ - } \ -} while(0) -#elif defined (MSVC) -#define noisy_printk(noise, ...) do { \ - if (*(noise)) { \ - printk(KERN_NOTICE ##__VA_ARGS__); \ - (*(noise))--; \ - if (!(*(noise))) { \ - printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); \ - } \ - } \ -} while(0) -#else -#endif - -static uint32_t pseudo_random; - -static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - unsigned char *buf, uint32_t buf_size); - -/* These helper functions _must_ increase ofs and also do the dirty/used space accounting. - * Returning an error will abort the mount - bad checksums etc. should just mark the space - * as dirty. - */ -static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_inode *ri, uint32_t ofs); -static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_dirent *rd, uint32_t ofs); - -#define BLK_STATE_ALLFF 0 -#define BLK_STATE_CLEAN 1 -#define BLK_STATE_PARTDIRTY 2 -#define BLK_STATE_CLEANMARKER 3 -#define BLK_STATE_ALLDIRTY 4 -#define BLK_STATE_BADBLOCK 5 - -static inline int min_free(struct jffs2_sb_info *c) -{ - uint32_t min = 2 * sizeof(struct jffs2_raw_inode); -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (!jffs2_can_mark_obsolete(c) && min < c->wbuf_pagesize) - return c->wbuf_pagesize; -#endif - return min; - -} - -static inline uint32_t EMPTY_SCAN_SIZE(uint32_t sector_size) { - if (sector_size < DEFAULT_EMPTY_SCAN_SIZE) - return sector_size; - else - return DEFAULT_EMPTY_SCAN_SIZE; -} - -int jffs2_scan_medium(struct jffs2_sb_info *c) -{ - int i, ret; - uint32_t empty_blocks = 0, bad_blocks = 0; - unsigned char *flashbuf = NULL; - uint32_t buf_size = 0; -#ifndef __ECOS - size_t pointlen; - - if (c->mtd->point) { - ret = c->mtd->point (c->mtd, 0, c->mtd->size, &pointlen, &flashbuf); - if (!ret && pointlen < c->mtd->size) { - /* Don't muck about if it won't let us point to the whole flash */ - D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); - c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); - flashbuf = NULL; - } - if (ret) - D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); - } -#endif - if (!flashbuf) { - /* For NAND it's quicker to read a whole eraseblock at a time, - apparently */ - if (jffs2_cleanmarker_oob(c)) - buf_size = c->sector_size; - else - buf_size = PAGE_SIZE; - - /* Respect kmalloc limitations */ - if (buf_size > 128*1024) - buf_size = 128*1024; - - D1(printk(KERN_DEBUG "Allocating readbuf of %d bytes\n", buf_size)); - flashbuf = kmalloc(buf_size, GFP_KERNEL); - if (!flashbuf) - return -ENOMEM; - } - - for (i=0; inr_blocks; i++) { - struct jffs2_eraseblock *jeb = &c->blocks[i]; - - ret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb->offset), buf_size); - - if (ret < 0) - goto out; - - jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - - /* Now decide which list to put it on */ - switch(ret) { - case BLK_STATE_ALLFF: - /* - * Empty block. Since we can't be sure it - * was entirely erased, we just queue it for erase - * again. It will be marked as such when the erase - * is complete. Meanwhile we still count it as empty - * for later checks. - */ - empty_blocks++; - list_add(&jeb->list, &c->erase_pending_list); - c->nr_erasing_blocks++; - break; - - case BLK_STATE_CLEANMARKER: - /* Only a CLEANMARKER node is valid */ - if (!jeb->dirty_size) { - /* It's actually free */ - list_add(&jeb->list, &c->free_list); - c->nr_free_blocks++; - } else { - /* Dirt */ - D1(printk(KERN_DEBUG "Adding all-dirty block at 0x%08x to erase_pending_list\n", jeb->offset)); - list_add(&jeb->list, &c->erase_pending_list); - c->nr_erasing_blocks++; - } - break; - - case BLK_STATE_CLEAN: - /* Full (or almost full) of clean data. Clean list */ - list_add(&jeb->list, &c->clean_list); - break; - - case BLK_STATE_PARTDIRTY: - /* Some data, but not full. Dirty list. */ - /* We want to remember the block with most free space - and stick it in the 'nextblock' position to start writing to it. */ - if (jeb->free_size > min_free(c) && - (!c->nextblock || c->nextblock->free_size < jeb->free_size)) { - /* Better candidate for the next writes to go to */ - if (c->nextblock) { - c->nextblock->dirty_size += c->nextblock->free_size + c->nextblock->wasted_size; - c->dirty_size += c->nextblock->free_size + c->nextblock->wasted_size; - c->free_size -= c->nextblock->free_size; - c->wasted_size -= c->nextblock->wasted_size; - c->nextblock->free_size = c->nextblock->wasted_size = 0; - if (VERYDIRTY(c, c->nextblock->dirty_size)) { - list_add(&c->nextblock->list, &c->very_dirty_list); - } else { - list_add(&c->nextblock->list, &c->dirty_list); - } - } - c->nextblock = jeb; - } else { - jeb->dirty_size += jeb->free_size + jeb->wasted_size; - c->dirty_size += jeb->free_size + jeb->wasted_size; - c->free_size -= jeb->free_size; - c->wasted_size -= jeb->wasted_size; - jeb->free_size = jeb->wasted_size = 0; - if (VERYDIRTY(c, jeb->dirty_size)) { - list_add(&jeb->list, &c->very_dirty_list); - } else { - list_add(&jeb->list, &c->dirty_list); - } - } - break; - - case BLK_STATE_ALLDIRTY: - /* Nothing valid - not even a clean marker. Needs erasing. */ - /* For now we just put it on the erasing list. We'll start the erases later */ - D1(printk(KERN_NOTICE "JFFS2: Erase block at 0x%08x is not formatted. It will be erased\n", jeb->offset)); - list_add(&jeb->list, &c->erase_pending_list); - c->nr_erasing_blocks++; - break; - - case BLK_STATE_BADBLOCK: - D1(printk(KERN_NOTICE "JFFS2: Block at 0x%08x is bad\n", jeb->offset)); - list_add(&jeb->list, &c->bad_list); - c->bad_size += c->sector_size; - c->free_size -= c->sector_size; - bad_blocks++; - break; - default: - printk(KERN_WARNING "jffs2_scan_medium(): unknown block state\n"); - BUG(); - } - } - - /* Nextblock dirty is always seen as wasted, because we cannot recycle it now */ - if (c->nextblock && (c->nextblock->dirty_size)) { - c->nextblock->wasted_size += c->nextblock->dirty_size; - c->wasted_size += c->nextblock->dirty_size; - c->dirty_size -= c->nextblock->dirty_size; - c->nextblock->dirty_size = 0; - } -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (!jffs2_can_mark_obsolete(c) && c->nextblock && (c->nextblock->free_size & (c->wbuf_pagesize-1))) { - /* If we're going to start writing into a block which already - contains data, and the end of the data isn't page-aligned, - skip a little and align it. */ - - uint32_t skip = c->nextblock->free_size & (c->wbuf_pagesize-1); - - D1(printk(KERN_DEBUG "jffs2_scan_medium(): Skipping %d bytes in nextblock to ensure page alignment\n", - skip)); - c->nextblock->wasted_size += skip; - c->wasted_size += skip; - - c->nextblock->free_size -= skip; - c->free_size -= skip; - } -#endif - if (c->nr_erasing_blocks) { - if ( !c->used_size && ((c->nr_free_blocks+empty_blocks+bad_blocks)!= c->nr_blocks || bad_blocks == c->nr_blocks) ) { - printk(KERN_NOTICE "Cowardly refusing to erase blocks on filesystem with no valid JFFS2 nodes\n"); - printk(KERN_NOTICE "empty_blocks %d, bad_blocks %d, c->nr_blocks %d\n",empty_blocks,bad_blocks,c->nr_blocks); - ret = -EIO; - goto out; - } - jffs2_erase_pending_trigger(c); - } - ret = 0; - out: - if (buf_size) - kfree(flashbuf); -#ifndef __ECOS - else - c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); -#endif - return ret; -} - -static int jffs2_fill_scan_buf (struct jffs2_sb_info *c, unsigned char *buf, - uint32_t ofs, uint32_t len) -{ - int ret; - size_t retlen; - - ret = jffs2_flash_read(c, ofs, len, &retlen, buf); - if (ret) { - D1(printk(KERN_WARNING "mtd->read(0x%x bytes from 0x%x) returned %d\n", len, ofs, ret)); - return ret; - } - if (retlen < len) { - D1(printk(KERN_WARNING "Read at 0x%x gave only 0x%zx bytes\n", ofs, retlen)); - return -EIO; - } - D2(printk(KERN_DEBUG "Read 0x%x bytes from 0x%08x into buf\n", len, ofs)); - D2(printk(KERN_DEBUG "000: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", - buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15])); - return 0; -} - -static int jffs2_scan_eraseblock (struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - unsigned char *buf, uint32_t buf_size) { - struct jffs2_unknown_node *node; - struct jffs2_unknown_node crcnode; - uint32_t ofs, prevofs; - uint32_t hdr_crc, buf_ofs, buf_len; - int err; - int noise = 0; -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - int cleanmarkerfound = 0; -#endif - - ofs = jeb->offset; - prevofs = jeb->offset - 1; - - D1(printk(KERN_DEBUG "jffs2_scan_eraseblock(): Scanning block at 0x%x\n", ofs)); - -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (jffs2_cleanmarker_oob(c)) { - int ret = jffs2_check_nand_cleanmarker(c, jeb); - D2(printk(KERN_NOTICE "jffs_check_nand_cleanmarker returned %d\n",ret)); - /* Even if it's not found, we still scan to see - if the block is empty. We use this information - to decide whether to erase it or not. */ - switch (ret) { - case 0: cleanmarkerfound = 1; break; - case 1: break; - case 2: return BLK_STATE_BADBLOCK; - case 3: return BLK_STATE_ALLDIRTY; /* Block has failed to erase min. once */ - default: return ret; - } - } -#endif - buf_ofs = jeb->offset; - - if (!buf_size) { - buf_len = c->sector_size; - } else { - buf_len = EMPTY_SCAN_SIZE(c->sector_size); - err = jffs2_fill_scan_buf(c, buf, buf_ofs, buf_len); - if (err) - return err; - } - - /* We temporarily use 'ofs' as a pointer into the buffer/jeb */ - ofs = 0; - - /* Scan only 4KiB of 0xFF before declaring it's empty */ - while(ofs < EMPTY_SCAN_SIZE(c->sector_size) && *(uint32_t *)(&buf[ofs]) == 0xFFFFFFFF) - ofs += 4; - - if (ofs == EMPTY_SCAN_SIZE(c->sector_size)) { -#ifdef CONFIG_JFFS2_FS_WRITEBUFFER - if (jffs2_cleanmarker_oob(c)) { - /* scan oob, take care of cleanmarker */ - int ret = jffs2_check_oob_empty(c, jeb, cleanmarkerfound); - D2(printk(KERN_NOTICE "jffs2_check_oob_empty returned %d\n",ret)); - switch (ret) { - case 0: return cleanmarkerfound ? BLK_STATE_CLEANMARKER : BLK_STATE_ALLFF; - case 1: return BLK_STATE_ALLDIRTY; - default: return ret; - } - } -#endif - D1(printk(KERN_DEBUG "Block at 0x%08x is empty (erased)\n", jeb->offset)); - if (c->cleanmarker_size == 0) - return BLK_STATE_CLEANMARKER; /* don't bother with re-erase */ - else - return BLK_STATE_ALLFF; /* OK to erase if all blocks are like this */ - } - if (ofs) { - D1(printk(KERN_DEBUG "Free space at %08x ends at %08x\n", jeb->offset, - jeb->offset + ofs)); - DIRTY_SPACE(ofs); - } - - /* Now ofs is a complete physical flash offset as it always was... */ - ofs += jeb->offset; - - noise = 10; - -scan_more: - while(ofs < jeb->offset + c->sector_size) { - - jffs2_dbg_acct_paranoia_check_nolock(c, jeb); - - cond_resched(); - - if (ofs & 3) { - printk(KERN_WARNING "Eep. ofs 0x%08x not word-aligned!\n", ofs); - ofs = PAD(ofs); - continue; - } - if (ofs == prevofs) { - printk(KERN_WARNING "ofs 0x%08x has already been seen. Skipping\n", ofs); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - prevofs = ofs; - - if (jeb->offset + c->sector_size < ofs + sizeof(*node)) { - D1(printk(KERN_DEBUG "Fewer than %zd bytes left to end of block. (%x+%x<%x+%zx) Not reading\n", sizeof(struct jffs2_unknown_node), - jeb->offset, c->sector_size, ofs, sizeof(*node))); - DIRTY_SPACE((jeb->offset + c->sector_size)-ofs); - break; - } - - if (buf_ofs + buf_len < ofs + sizeof(*node)) { - buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); - D1(printk(KERN_DEBUG "Fewer than %zd bytes (node header) left to end of buf. Reading 0x%x at 0x%08x\n", - sizeof(struct jffs2_unknown_node), buf_len, ofs)); - err = jffs2_fill_scan_buf(c, buf, ofs, buf_len); - if (err) - return err; - buf_ofs = ofs; - } - - node = (struct jffs2_unknown_node *)&buf[ofs-buf_ofs]; - - if (*(uint32_t *)(&buf[ofs-buf_ofs]) == 0xffffffff) { - uint32_t inbuf_ofs; - uint32_t empty_start; - - empty_start = ofs; - ofs += 4; - - D1(printk(KERN_DEBUG "Found empty flash at 0x%08x\n", ofs)); - more_empty: - inbuf_ofs = ofs - buf_ofs; - while (inbuf_ofs < buf_len) { - if (*(uint32_t *)(&buf[inbuf_ofs]) != 0xffffffff) { - printk(KERN_WARNING "Empty flash at 0x%08x ends at 0x%08x\n", - empty_start, ofs); - DIRTY_SPACE(ofs-empty_start); - goto scan_more; - } - - inbuf_ofs+=4; - ofs += 4; - } - /* Ran off end. */ - D1(printk(KERN_DEBUG "Empty flash to end of buffer at 0x%08x\n", ofs)); - - /* If we're only checking the beginning of a block with a cleanmarker, - bail now */ - if (buf_ofs == jeb->offset && jeb->used_size == PAD(c->cleanmarker_size) && - c->cleanmarker_size && !jeb->dirty_size && !jeb->first_node->next_phys) { - D1(printk(KERN_DEBUG "%d bytes at start of block seems clean... assuming all clean\n", EMPTY_SCAN_SIZE(c->sector_size))); - return BLK_STATE_CLEANMARKER; - } - - /* See how much more there is to read in this eraseblock... */ - buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); - if (!buf_len) { - /* No more to read. Break out of main loop without marking - this range of empty space as dirty (because it's not) */ - D1(printk(KERN_DEBUG "Empty flash at %08x runs to end of block. Treating as free_space\n", - empty_start)); - break; - } - D1(printk(KERN_DEBUG "Reading another 0x%x at 0x%08x\n", buf_len, ofs)); - err = jffs2_fill_scan_buf(c, buf, ofs, buf_len); - if (err) - return err; - buf_ofs = ofs; - goto more_empty; - } - - if (ofs == jeb->offset && je16_to_cpu(node->magic) == KSAMTIB_CIGAM_2SFFJ) { - printk(KERN_WARNING "Magic bitmask is backwards at offset 0x%08x. Wrong endian filesystem?\n", ofs); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - if (je16_to_cpu(node->magic) == JFFS2_DIRTY_BITMASK) { - D1(printk(KERN_DEBUG "Dirty bitmask at 0x%08x\n", ofs)); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - if (je16_to_cpu(node->magic) == JFFS2_OLD_MAGIC_BITMASK) { - printk(KERN_WARNING "Old JFFS2 bitmask found at 0x%08x\n", ofs); - printk(KERN_WARNING "You cannot use older JFFS2 filesystems with newer kernels\n"); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - if (je16_to_cpu(node->magic) != JFFS2_MAGIC_BITMASK) { - /* OK. We're out of possibilities. Whinge and move on */ - noisy_printk(&noise, "jffs2_scan_eraseblock(): Magic bitmask 0x%04x not found at 0x%08x: 0x%04x instead\n", - JFFS2_MAGIC_BITMASK, ofs, - je16_to_cpu(node->magic)); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - /* We seem to have a node of sorts. Check the CRC */ - crcnode.magic = node->magic; - crcnode.nodetype = cpu_to_je16( je16_to_cpu(node->nodetype) | JFFS2_NODE_ACCURATE); - crcnode.totlen = node->totlen; - hdr_crc = crc32(0, &crcnode, sizeof(crcnode)-4); - - if (hdr_crc != je32_to_cpu(node->hdr_crc)) { - noisy_printk(&noise, "jffs2_scan_eraseblock(): Node at 0x%08x {0x%04x, 0x%04x, 0x%08x) has invalid CRC 0x%08x (calculated 0x%08x)\n", - ofs, je16_to_cpu(node->magic), - je16_to_cpu(node->nodetype), - je32_to_cpu(node->totlen), - je32_to_cpu(node->hdr_crc), - hdr_crc); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - - if (ofs + je32_to_cpu(node->totlen) > - jeb->offset + c->sector_size) { - /* Eep. Node goes over the end of the erase block. */ - printk(KERN_WARNING "Node at 0x%08x with length 0x%08x would run over the end of the erase block\n", - ofs, je32_to_cpu(node->totlen)); - printk(KERN_WARNING "Perhaps the file system was created with the wrong erase size?\n"); - DIRTY_SPACE(4); - ofs += 4; - continue; - } - - if (!(je16_to_cpu(node->nodetype) & JFFS2_NODE_ACCURATE)) { - /* Wheee. This is an obsoleted node */ - D2(printk(KERN_DEBUG "Node at 0x%08x is obsolete. Skipping\n", ofs)); - DIRTY_SPACE(PAD(je32_to_cpu(node->totlen))); - ofs += PAD(je32_to_cpu(node->totlen)); - continue; - } - - switch(je16_to_cpu(node->nodetype)) { - case JFFS2_NODETYPE_INODE: - if (buf_ofs + buf_len < ofs + sizeof(struct jffs2_raw_inode)) { - buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); - D1(printk(KERN_DEBUG "Fewer than %zd bytes (inode node) left to end of buf. Reading 0x%x at 0x%08x\n", - sizeof(struct jffs2_raw_inode), buf_len, ofs)); - err = jffs2_fill_scan_buf(c, buf, ofs, buf_len); - if (err) - return err; - buf_ofs = ofs; - node = (void *)buf; - } - err = jffs2_scan_inode_node(c, jeb, (void *)node, ofs); - if (err) return err; - ofs += PAD(je32_to_cpu(node->totlen)); - break; - - case JFFS2_NODETYPE_DIRENT: - if (buf_ofs + buf_len < ofs + je32_to_cpu(node->totlen)) { - buf_len = min_t(uint32_t, buf_size, jeb->offset + c->sector_size - ofs); - D1(printk(KERN_DEBUG "Fewer than %d bytes (dirent node) left to end of buf. Reading 0x%x at 0x%08x\n", - je32_to_cpu(node->totlen), buf_len, ofs)); - err = jffs2_fill_scan_buf(c, buf, ofs, buf_len); - if (err) - return err; - buf_ofs = ofs; - node = (void *)buf; - } - err = jffs2_scan_dirent_node(c, jeb, (void *)node, ofs); - if (err) return err; - ofs += PAD(je32_to_cpu(node->totlen)); - break; - - case JFFS2_NODETYPE_CLEANMARKER: - D1(printk(KERN_DEBUG "CLEANMARKER node found at 0x%08x\n", ofs)); - if (je32_to_cpu(node->totlen) != c->cleanmarker_size) { - printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x has totlen 0x%x != normal 0x%x\n", - ofs, je32_to_cpu(node->totlen), c->cleanmarker_size); - DIRTY_SPACE(PAD(sizeof(struct jffs2_unknown_node))); - ofs += PAD(sizeof(struct jffs2_unknown_node)); - } else if (jeb->first_node) { - printk(KERN_NOTICE "CLEANMARKER node found at 0x%08x, not first node in block (0x%08x)\n", ofs, jeb->offset); - DIRTY_SPACE(PAD(sizeof(struct jffs2_unknown_node))); - ofs += PAD(sizeof(struct jffs2_unknown_node)); - } else { - struct jffs2_raw_node_ref *marker_ref = jffs2_alloc_raw_node_ref(); - if (!marker_ref) { - printk(KERN_NOTICE "Failed to allocate node ref for clean marker\n"); - return -ENOMEM; - } - marker_ref->next_in_ino = NULL; - marker_ref->next_phys = NULL; - marker_ref->flash_offset = ofs | REF_NORMAL; - marker_ref->__totlen = c->cleanmarker_size; - jeb->first_node = jeb->last_node = marker_ref; - - USED_SPACE(PAD(c->cleanmarker_size)); - ofs += PAD(c->cleanmarker_size); - } - break; - - case JFFS2_NODETYPE_PADDING: - DIRTY_SPACE(PAD(je32_to_cpu(node->totlen))); - ofs += PAD(je32_to_cpu(node->totlen)); - break; - - default: - switch (je16_to_cpu(node->nodetype) & JFFS2_COMPAT_MASK) { - case JFFS2_FEATURE_ROCOMPAT: - printk(KERN_NOTICE "Read-only compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs); - c->flags |= JFFS2_SB_FLAG_RO; - if (!(jffs2_is_readonly(c))) - return -EROFS; - DIRTY_SPACE(PAD(je32_to_cpu(node->totlen))); - ofs += PAD(je32_to_cpu(node->totlen)); - break; - - case JFFS2_FEATURE_INCOMPAT: - printk(KERN_NOTICE "Incompatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs); - return -EINVAL; - - case JFFS2_FEATURE_RWCOMPAT_DELETE: - D1(printk(KERN_NOTICE "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs)); - DIRTY_SPACE(PAD(je32_to_cpu(node->totlen))); - ofs += PAD(je32_to_cpu(node->totlen)); - break; - - case JFFS2_FEATURE_RWCOMPAT_COPY: - D1(printk(KERN_NOTICE "Unknown but compatible feature node (0x%04x) found at offset 0x%08x\n", je16_to_cpu(node->nodetype), ofs)); - USED_SPACE(PAD(je32_to_cpu(node->totlen))); - ofs += PAD(je32_to_cpu(node->totlen)); - break; - } - } - } - - - D1(printk(KERN_DEBUG "Block at 0x%08x: free 0x%08x, dirty 0x%08x, unchecked 0x%08x, used 0x%08x\n", jeb->offset, - jeb->free_size, jeb->dirty_size, jeb->unchecked_size, jeb->used_size)); - - /* mark_node_obsolete can add to wasted !! */ - if (jeb->wasted_size) { - jeb->dirty_size += jeb->wasted_size; - c->dirty_size += jeb->wasted_size; - c->wasted_size -= jeb->wasted_size; - jeb->wasted_size = 0; - } - - if ((jeb->used_size + jeb->unchecked_size) == PAD(c->cleanmarker_size) && !jeb->dirty_size - && (!jeb->first_node || !jeb->first_node->next_phys) ) - return BLK_STATE_CLEANMARKER; - - /* move blocks with max 4 byte dirty space to cleanlist */ - else if (!ISDIRTY(c->sector_size - (jeb->used_size + jeb->unchecked_size))) { - c->dirty_size -= jeb->dirty_size; - c->wasted_size += jeb->dirty_size; - jeb->wasted_size += jeb->dirty_size; - jeb->dirty_size = 0; - return BLK_STATE_CLEAN; - } else if (jeb->used_size || jeb->unchecked_size) - return BLK_STATE_PARTDIRTY; - else - return BLK_STATE_ALLDIRTY; -} - -static struct jffs2_inode_cache *jffs2_scan_make_ino_cache(struct jffs2_sb_info *c, uint32_t ino) -{ - struct jffs2_inode_cache *ic; - - ic = jffs2_get_ino_cache(c, ino); - if (ic) - return ic; - - if (ino > c->highest_ino) - c->highest_ino = ino; - - ic = jffs2_alloc_inode_cache(); - if (!ic) { - printk(KERN_NOTICE "jffs2_scan_make_inode_cache(): allocation of inode cache failed\n"); - return NULL; - } - memset(ic, 0, sizeof(*ic)); - - ic->ino = ino; - ic->nodes = (void *)ic; - jffs2_add_ino_cache(c, ic); - if (ino == 1) - ic->nlink = 1; - return ic; -} - -static int jffs2_scan_inode_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_inode *ri, uint32_t ofs) -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_inode_cache *ic; - uint32_t ino = je32_to_cpu(ri->ino); - - D1(printk(KERN_DEBUG "jffs2_scan_inode_node(): Node at 0x%08x\n", ofs)); - - /* We do very little here now. Just check the ino# to which we should attribute - this node; we can do all the CRC checking etc. later. There's a tradeoff here -- - we used to scan the flash once only, reading everything we want from it into - memory, then building all our in-core data structures and freeing the extra - information. Now we allow the first part of the mount to complete a lot quicker, - but we have to go _back_ to the flash in order to finish the CRC checking, etc. - Which means that the _full_ amount of time to get to proper write mode with GC - operational may actually be _longer_ than before. Sucks to be me. */ - - raw = jffs2_alloc_raw_node_ref(); - if (!raw) { - printk(KERN_NOTICE "jffs2_scan_inode_node(): allocation of node reference failed\n"); - return -ENOMEM; - } - - ic = jffs2_get_ino_cache(c, ino); - if (!ic) { - /* Inocache get failed. Either we read a bogus ino# or it's just genuinely the - first node we found for this inode. Do a CRC check to protect against the former - case */ - uint32_t crc = crc32(0, ri, sizeof(*ri)-8); - - if (crc != je32_to_cpu(ri->node_crc)) { - printk(KERN_NOTICE "jffs2_scan_inode_node(): CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ofs, je32_to_cpu(ri->node_crc), crc); - /* We believe totlen because the CRC on the node _header_ was OK, just the node itself failed. */ - DIRTY_SPACE(PAD(je32_to_cpu(ri->totlen))); - jffs2_free_raw_node_ref(raw); - return 0; - } - ic = jffs2_scan_make_ino_cache(c, ino); - if (!ic) { - jffs2_free_raw_node_ref(raw); - return -ENOMEM; - } - } - - /* Wheee. It worked */ - - raw->flash_offset = ofs | REF_UNCHECKED; - raw->__totlen = PAD(je32_to_cpu(ri->totlen)); - raw->next_phys = NULL; - raw->next_in_ino = ic->nodes; - - ic->nodes = raw; - if (!jeb->first_node) - jeb->first_node = raw; - if (jeb->last_node) - jeb->last_node->next_phys = raw; - jeb->last_node = raw; - - D1(printk(KERN_DEBUG "Node is ino #%u, version %d. Range 0x%x-0x%x\n", - je32_to_cpu(ri->ino), je32_to_cpu(ri->version), - je32_to_cpu(ri->offset), - je32_to_cpu(ri->offset)+je32_to_cpu(ri->dsize))); - - pseudo_random += je32_to_cpu(ri->version); - - UNCHECKED_SPACE(PAD(je32_to_cpu(ri->totlen))); - return 0; -} - -static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb, - struct jffs2_raw_dirent *rd, uint32_t ofs) -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_full_dirent *fd; - struct jffs2_inode_cache *ic; - uint32_t crc; - - D1(printk(KERN_DEBUG "jffs2_scan_dirent_node(): Node at 0x%08x\n", ofs)); - - /* We don't get here unless the node is still valid, so we don't have to - mask in the ACCURATE bit any more. */ - crc = crc32(0, rd, sizeof(*rd)-8); - - if (crc != je32_to_cpu(rd->node_crc)) { - printk(KERN_NOTICE "jffs2_scan_dirent_node(): Node CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ofs, je32_to_cpu(rd->node_crc), crc); - /* We believe totlen because the CRC on the node _header_ was OK, just the node itself failed. */ - DIRTY_SPACE(PAD(je32_to_cpu(rd->totlen))); - return 0; - } - - pseudo_random += je32_to_cpu(rd->version); - - fd = jffs2_alloc_full_dirent(rd->nsize+1); - if (!fd) { - return -ENOMEM; - } - memcpy(&fd->name, rd->name, rd->nsize); - fd->name[rd->nsize] = 0; - - crc = crc32(0, fd->name, rd->nsize); - if (crc != je32_to_cpu(rd->name_crc)) { - printk(KERN_NOTICE "jffs2_scan_dirent_node(): Name CRC failed on node at 0x%08x: Read 0x%08x, calculated 0x%08x\n", - ofs, je32_to_cpu(rd->name_crc), crc); - D1(printk(KERN_NOTICE "Name for which CRC failed is (now) '%s', ino #%d\n", fd->name, je32_to_cpu(rd->ino))); - jffs2_free_full_dirent(fd); - /* FIXME: Why do we believe totlen? */ - /* We believe totlen because the CRC on the node _header_ was OK, just the name failed. */ - DIRTY_SPACE(PAD(je32_to_cpu(rd->totlen))); - return 0; - } - raw = jffs2_alloc_raw_node_ref(); - if (!raw) { - jffs2_free_full_dirent(fd); - printk(KERN_NOTICE "jffs2_scan_dirent_node(): allocation of node reference failed\n"); - return -ENOMEM; - } - ic = jffs2_scan_make_ino_cache(c, je32_to_cpu(rd->pino)); - if (!ic) { - jffs2_free_full_dirent(fd); - jffs2_free_raw_node_ref(raw); - return -ENOMEM; - } - - raw->__totlen = PAD(je32_to_cpu(rd->totlen)); - raw->flash_offset = ofs | REF_PRISTINE; - raw->next_phys = NULL; - raw->next_in_ino = ic->nodes; - ic->nodes = raw; - if (!jeb->first_node) - jeb->first_node = raw; - if (jeb->last_node) - jeb->last_node->next_phys = raw; - jeb->last_node = raw; - - fd->raw = raw; - fd->next = NULL; - fd->version = je32_to_cpu(rd->version); - fd->ino = je32_to_cpu(rd->ino); - fd->nhash = full_name_hash(fd->name, rd->nsize); - fd->type = rd->type; - USED_SPACE(PAD(je32_to_cpu(rd->totlen))); - jffs2_add_fd_to_list(c, fd, &ic->scan_dents); - - return 0; -} - -static int count_list(struct list_head *l) -{ - uint32_t count = 0; - struct list_head *tmp; - - list_for_each(tmp, l) { - count++; - } - return count; -} - -/* Note: This breaks if list_empty(head). I don't care. You - might, if you copy this code and use it elsewhere :) */ -static void rotate_list(struct list_head *head, uint32_t count) -{ - struct list_head *n = head->next; - - list_del(head); - while(count--) { - n = n->next; - } - list_add(head, n); -} - -void jffs2_rotate_lists(struct jffs2_sb_info *c) -{ - uint32_t x; - uint32_t rotateby; - - x = count_list(&c->clean_list); - if (x) { - rotateby = pseudo_random % x; - D1(printk(KERN_DEBUG "Rotating clean_list by %d\n", rotateby)); - - rotate_list((&c->clean_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of clean_list is at %08x\n", - list_entry(c->clean_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty clean_list\n")); - } - - x = count_list(&c->very_dirty_list); - if (x) { - rotateby = pseudo_random % x; - D1(printk(KERN_DEBUG "Rotating very_dirty_list by %d\n", rotateby)); - - rotate_list((&c->very_dirty_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of very_dirty_list is at %08x\n", - list_entry(c->very_dirty_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty very_dirty_list\n")); - } - - x = count_list(&c->dirty_list); - if (x) { - rotateby = pseudo_random % x; - D1(printk(KERN_DEBUG "Rotating dirty_list by %d\n", rotateby)); - - rotate_list((&c->dirty_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of dirty_list is at %08x\n", - list_entry(c->dirty_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty dirty_list\n")); - } - - x = count_list(&c->erasable_list); - if (x) { - rotateby = pseudo_random % x; - D1(printk(KERN_DEBUG "Rotating erasable_list by %d\n", rotateby)); - - rotate_list((&c->erasable_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of erasable_list is at %08x\n", - list_entry(c->erasable_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty erasable_list\n")); - } - - if (c->nr_erasing_blocks) { - rotateby = pseudo_random % c->nr_erasing_blocks; - D1(printk(KERN_DEBUG "Rotating erase_pending_list by %d\n", rotateby)); - - rotate_list((&c->erase_pending_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of erase_pending_list is at %08x\n", - list_entry(c->erase_pending_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty erase_pending_list\n")); - } - - if (c->nr_free_blocks) { - rotateby = pseudo_random % c->nr_free_blocks; - D1(printk(KERN_DEBUG "Rotating free_list by %d\n", rotateby)); - - rotate_list((&c->free_list), rotateby); - - D1(printk(KERN_DEBUG "Erase block at front of free_list is at %08x\n", - list_entry(c->free_list.next, struct jffs2_eraseblock, list)->offset)); - } else { - D1(printk(KERN_DEBUG "Not rotating empty free_list\n")); - } -} diff --git a/components/dfs/filesystems/jffs2/src/write.c b/components/dfs/filesystems/jffs2/src/write.c deleted file mode 100644 index dcfc3a49c..000000000 --- a/components/dfs/filesystems/jffs2/src/write.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * JFFS2 -- Journalling Flash File System, Version 2. - * - * Copyright (C) 2001-2003 Red Hat, Inc. - * - * Created by David Woodhouse - * - * For licensing information, see the file 'LICENCE' in this directory. - * - * $Id: write.c,v 1.94 2005/07/20 15:50:51 dedekind Exp $ - * - */ - -#include -#include -#include -#include -#include -#include -#include "nodelist.h" -#include "compr.h" - - -int jffs2_do_new_inode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, uint32_t mode, struct jffs2_raw_inode *ri) -{ - struct jffs2_inode_cache *ic; - - ic = jffs2_alloc_inode_cache(); - if (!ic) { - return -ENOMEM; - } - - memset(ic, 0, sizeof(*ic)); - - f->inocache = ic; - f->inocache->nlink = 1; - f->inocache->nodes = (struct jffs2_raw_node_ref *)f->inocache; - f->inocache->state = INO_STATE_PRESENT; - - - jffs2_add_ino_cache(c, f->inocache); - D1(printk(KERN_DEBUG "jffs2_do_new_inode(): Assigned ino# %d\n", f->inocache->ino)); - ri->ino = cpu_to_je32(f->inocache->ino); - - ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri->totlen = cpu_to_je32(PAD(sizeof(*ri))); - ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)); - ri->mode = cpu_to_jemode(mode); - - f->highest_version = 1; - ri->version = cpu_to_je32(f->highest_version); - - return 0; -} - -/* jffs2_write_dnode - given a raw_inode, allocate a full_dnode for it, - write it to the flash, link it into the existing inode/fragment list */ - -struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const unsigned char *data, uint32_t datalen, uint32_t flash_ofs, int alloc_mode) - -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_full_dnode *fn; - size_t retlen; - struct kvec vecs[2]; - int ret; - int retried = 0; - unsigned long cnt = 2; - - D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) { - printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n"); - BUG(); - } - ); - vecs[0].iov_base = ri; - vecs[0].iov_len = sizeof(*ri); - vecs[1].iov_base = (unsigned char *)data; - vecs[1].iov_len = datalen; - - jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len); - - if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { - printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen); - } - raw = jffs2_alloc_raw_node_ref(); - if (!raw) - return ERR_PTR(-ENOMEM); - - fn = jffs2_alloc_full_dnode(); - if (!fn) { - jffs2_free_raw_node_ref(raw); - return ERR_PTR(-ENOMEM); - } - - fn->ofs = je32_to_cpu(ri->offset); - fn->size = je32_to_cpu(ri->dsize); - fn->frags = 0; - - /* check number of valid vecs */ - if (!datalen || !data) - cnt = 1; - retry: - fn->raw = raw; - - raw->flash_offset = flash_ofs; - raw->__totlen = PAD(sizeof(*ri)+datalen); - raw->next_phys = NULL; - - if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(ri->version) < f->highest_version)) { - BUG_ON(!retried); - D1(printk(KERN_DEBUG "jffs2_write_dnode : dnode_version %d, " - "highest version %d -> updating dnode\n", - je32_to_cpu(ri->version), f->highest_version)); - ri->version = cpu_to_je32(++f->highest_version); - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - } - - ret = jffs2_flash_writev(c, vecs, cnt, flash_ofs, &retlen, - (alloc_mode==ALLOC_GC)?0:f->inocache->ino); - - if (ret || (retlen != sizeof(*ri) + datalen)) { - printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", - sizeof(*ri)+datalen, flash_ofs, ret, retlen); - - /* Mark the space as dirtied */ - if (retlen) { - /* Doesn't belong to any inode */ - raw->next_in_ino = NULL; - - /* Don't change raw->size to match retlen. We may have - written the node header already, and only the data will - seem corrupted, in which case the scan would skip over - any node we write before the original intended end of - this node */ - raw->flash_offset |= REF_OBSOLETE; - jffs2_add_physical_node_ref(c, raw); - jffs2_mark_node_obsolete(c, raw); - } else { - printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); - jffs2_free_raw_node_ref(raw); - } - if (!retried && alloc_mode != ALLOC_NORETRY && (raw = jffs2_alloc_raw_node_ref())) { - /* Try to reallocate space and retry */ - uint32_t dummy; - struct jffs2_eraseblock *jeb = &c->blocks[flash_ofs / c->sector_size]; - - retried = 1; - - D1(printk(KERN_DEBUG "Retrying failed write.\n")); - - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - - if (alloc_mode == ALLOC_GC) { - ret = jffs2_reserve_space_gc(c, sizeof(*ri) + datalen, &flash_ofs, &dummy); - } else { - /* Locking pain */ - up(&f->sem); - jffs2_complete_reservation(c); - - ret = jffs2_reserve_space(c, sizeof(*ri) + datalen, &flash_ofs, &dummy, alloc_mode); - down(&f->sem); - } - - if (!ret) { - D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); - - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - - goto retry; - } - D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret)); - jffs2_free_raw_node_ref(raw); - } - /* Release the full_dnode which is now useless, and return */ - jffs2_free_full_dnode(fn); - return ERR_PTR(ret?ret:-EIO); - } - /* Mark the space used */ - /* If node covers at least a whole page, or if it starts at the - beginning of a page and runs to the end of the file, or if - it's a hole node, mark it REF_PRISTINE, else REF_NORMAL. - */ - if ((je32_to_cpu(ri->dsize) >= PAGE_CACHE_SIZE) || - ( ((je32_to_cpu(ri->offset)&(PAGE_CACHE_SIZE-1))==0) && - (je32_to_cpu(ri->dsize)+je32_to_cpu(ri->offset) == je32_to_cpu(ri->isize)))) { - raw->flash_offset |= REF_PRISTINE; - } else { - raw->flash_offset |= REF_NORMAL; - } - jffs2_add_physical_node_ref(c, raw); - - /* Link into per-inode list */ - spin_lock(&c->erase_completion_lock); - raw->next_in_ino = f->inocache->nodes; - f->inocache->nodes = raw; - spin_unlock(&c->erase_completion_lock); - - D1(printk(KERN_DEBUG "jffs2_write_dnode wrote node at 0x%08x(%d) with dsize 0x%x, csize 0x%x, node_crc 0x%08x, data_crc 0x%08x, totlen 0x%08x\n", - flash_ofs, ref_flags(raw), je32_to_cpu(ri->dsize), - je32_to_cpu(ri->csize), je32_to_cpu(ri->node_crc), - je32_to_cpu(ri->data_crc), je32_to_cpu(ri->totlen))); - - if (retried) { - jffs2_dbg_acct_sanity_check(c,NULL); - } - - return fn; -} - -struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jffs2_inode_info *f, struct jffs2_raw_dirent *rd, const unsigned char *name, uint32_t namelen, uint32_t flash_ofs, int alloc_mode) -{ - struct jffs2_raw_node_ref *raw; - struct jffs2_full_dirent *fd; - size_t retlen; - struct kvec vecs[2]; - int retried = 0; - int ret; - - D1(printk(KERN_DEBUG "jffs2_write_dirent(ino #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x)\n", - je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino), - je32_to_cpu(rd->name_crc))); - - D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { - printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n"); - BUG(); - } - ); - - vecs[0].iov_base = rd; - vecs[0].iov_len = sizeof(*rd); - vecs[1].iov_base = (unsigned char *)name; - vecs[1].iov_len = namelen; - - jffs2_dbg_prewrite_paranoia_check(c, flash_ofs, vecs[0].iov_len + vecs[1].iov_len); - - raw = jffs2_alloc_raw_node_ref(); - - if (!raw) - return ERR_PTR(-ENOMEM); - - fd = jffs2_alloc_full_dirent(namelen+1); - if (!fd) { - jffs2_free_raw_node_ref(raw); - return ERR_PTR(-ENOMEM); - } - - fd->version = je32_to_cpu(rd->version); - fd->ino = je32_to_cpu(rd->ino); - fd->nhash = full_name_hash(name, strlen((const char *)name)); - fd->type = rd->type; - memcpy(fd->name, name, namelen); - fd->name[namelen]=0; - - retry: - fd->raw = raw; - - raw->flash_offset = flash_ofs; - raw->__totlen = PAD(sizeof(*rd)+namelen); - raw->next_phys = NULL; - - if ((alloc_mode!=ALLOC_GC) && (je32_to_cpu(rd->version) < f->highest_version)) { - BUG_ON(!retried); - D1(printk(KERN_DEBUG "jffs2_write_dirent : dirent_version %d, " - "highest version %d -> updating dirent\n", - je32_to_cpu(rd->version), f->highest_version)); - rd->version = cpu_to_je32(++f->highest_version); - fd->version = je32_to_cpu(rd->version); - rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); - } - - ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen, - (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino)); - if (ret || (retlen != sizeof(*rd) + namelen)) { - printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", - sizeof(*rd)+namelen, flash_ofs, ret, retlen); - /* Mark the space as dirtied */ - if (retlen) { - raw->next_in_ino = NULL; - raw->flash_offset |= REF_OBSOLETE; - jffs2_add_physical_node_ref(c, raw); - jffs2_mark_node_obsolete(c, raw); - } else { - printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", raw->flash_offset); - jffs2_free_raw_node_ref(raw); - } - if (!retried && (raw = jffs2_alloc_raw_node_ref())) { - /* Try to reallocate space and retry */ - uint32_t dummy; - struct jffs2_eraseblock *jeb = &c->blocks[flash_ofs / c->sector_size]; - - retried = 1; - - D1(printk(KERN_DEBUG "Retrying failed write.\n")); - - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - - if (alloc_mode == ALLOC_GC) { - ret = jffs2_reserve_space_gc(c, sizeof(*rd) + namelen, &flash_ofs, &dummy); - } else { - /* Locking pain */ - up(&f->sem); - jffs2_complete_reservation(c); - - ret = jffs2_reserve_space(c, sizeof(*rd) + namelen, &flash_ofs, &dummy, alloc_mode); - down(&f->sem); - } - - if (!ret) { - D1(printk(KERN_DEBUG "Allocated space at 0x%08x to retry failed write.\n", flash_ofs)); - jffs2_dbg_acct_sanity_check(c,jeb); - jffs2_dbg_acct_paranoia_check(c, jeb); - goto retry; - } - D1(printk(KERN_DEBUG "Failed to allocate space to retry failed write: %d!\n", ret)); - jffs2_free_raw_node_ref(raw); - } - /* Release the full_dnode which is now useless, and return */ - jffs2_free_full_dirent(fd); - return ERR_PTR(ret?ret:-EIO); - } - /* Mark the space used */ - raw->flash_offset |= REF_PRISTINE; - jffs2_add_physical_node_ref(c, raw); - - spin_lock(&c->erase_completion_lock); - raw->next_in_ino = f->inocache->nodes; - f->inocache->nodes = raw; - spin_unlock(&c->erase_completion_lock); - - if (retried) { - jffs2_dbg_acct_sanity_check(c,NULL); - } - - return fd; -} - -/* The OS-specific code fills in the metadata in the jffs2_raw_inode for us, so that - we don't have to go digging in struct inode or its equivalent. It should set: - mode, uid, gid, (starting)isize, atime, ctime, mtime */ -int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, - struct jffs2_raw_inode *ri, unsigned char *buf, - uint32_t offset, uint32_t writelen, uint32_t *retlen) -{ - int ret = 0; - uint32_t writtenlen = 0; - - D1(printk(KERN_DEBUG "jffs2_write_inode_range(): Ino #%u, ofs 0x%x, len 0x%x\n", - f->inocache->ino, offset, writelen)); - - while(writelen) { - struct jffs2_full_dnode *fn; - unsigned char *comprbuf = NULL; - uint16_t comprtype = JFFS2_COMPR_NONE; - uint32_t phys_ofs, alloclen; - uint32_t datalen, cdatalen; - int retried = 0; - - retry: - D2(printk(KERN_DEBUG "jffs2_commit_write() loop: 0x%x to write to 0x%x\n", writelen, offset)); - - ret = jffs2_reserve_space(c, sizeof(*ri) + JFFS2_MIN_DATA_LEN, &phys_ofs, &alloclen, ALLOC_NORMAL); - if (ret) { - D1(printk(KERN_DEBUG "jffs2_reserve_space returned %d\n", ret)); - break; - } - down(&f->sem); - datalen = min_t(uint32_t, writelen, PAGE_CACHE_SIZE - (offset & (PAGE_CACHE_SIZE-1))); - cdatalen = min_t(uint32_t, alloclen - sizeof(*ri), datalen); - - comprtype = jffs2_compress(c, f, buf, &comprbuf, &datalen, &cdatalen); - - ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); - ri->totlen = cpu_to_je32(sizeof(*ri) + cdatalen); - ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)); - - ri->ino = cpu_to_je32(f->inocache->ino); - ri->version = cpu_to_je32(++f->highest_version); - ri->isize = cpu_to_je32(max(je32_to_cpu(ri->isize), offset + datalen)); - ri->offset = cpu_to_je32(offset); - ri->csize = cpu_to_je32(cdatalen); - ri->dsize = cpu_to_je32(datalen); - ri->compr = comprtype & 0xff; - ri->usercompr = (comprtype >> 8 ) & 0xff; - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - ri->data_crc = cpu_to_je32(crc32(0, comprbuf, cdatalen)); - - fn = jffs2_write_dnode(c, f, ri, comprbuf, cdatalen, phys_ofs, ALLOC_NORETRY); - - jffs2_free_comprbuf(comprbuf, buf); - - if (IS_ERR(fn)) { - ret = PTR_ERR(fn); - up(&f->sem); - jffs2_complete_reservation(c); - if (!retried) { - /* Write error to be retried */ - retried = 1; - D1(printk(KERN_DEBUG "Retrying node write in jffs2_write_inode_range()\n")); - goto retry; - } - break; - } - ret = jffs2_add_full_dnode_to_inode(c, f, fn); - if (f->metadata) { - jffs2_mark_node_obsolete(c, f->metadata->raw); - jffs2_free_full_dnode(f->metadata); - f->metadata = NULL; - } - if (ret) { - /* Eep */ - D1(printk(KERN_DEBUG "Eep. add_full_dnode_to_inode() failed in commit_write, returned %d\n", ret)); - jffs2_mark_node_obsolete(c, fn->raw); - jffs2_free_full_dnode(fn); - - up(&f->sem); - jffs2_complete_reservation(c); - break; - } - up(&f->sem); - jffs2_complete_reservation(c); - if (!datalen) { - printk(KERN_WARNING "Eep. We didn't actually write any data in jffs2_write_inode_range()\n"); - ret = -EIO; - break; - } - D1(printk(KERN_DEBUG "increasing writtenlen by %d\n", datalen)); - writtenlen += datalen; - offset += datalen; - writelen -= datalen; - buf += datalen; - } - *retlen = writtenlen; - return ret; -} - -int jffs2_do_create(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, struct jffs2_inode_info *f, struct jffs2_raw_inode *ri, const char *name, int namelen) -{ - struct jffs2_raw_dirent *rd; - struct jffs2_full_dnode *fn; - struct jffs2_full_dirent *fd; - uint32_t alloclen, phys_ofs; - int ret; - - /* Try to reserve enough space for both node and dirent. - * Just the node will do for now, though - */ - ret = jffs2_reserve_space(c, sizeof(*ri), &phys_ofs, &alloclen, ALLOC_NORMAL); - D1(printk(KERN_DEBUG "jffs2_do_create(): reserved 0x%x bytes\n", alloclen)); - if (ret) { - up(&f->sem); - return ret; - } - - ri->data_crc = cpu_to_je32(0); - ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); - - fn = jffs2_write_dnode(c, f, ri, NULL, 0, phys_ofs, ALLOC_NORMAL); - - D1(printk(KERN_DEBUG "jffs2_do_create created file with mode 0x%x\n", - jemode_to_cpu(ri->mode))); - - if (IS_ERR(fn)) { - D1(printk(KERN_DEBUG "jffs2_write_dnode() failed\n")); - /* Eeek. Wave bye bye */ - up(&f->sem); - jffs2_complete_reservation(c); - return PTR_ERR(fn); - } - /* No data here. Only a metadata node, which will be - obsoleted by the first data write - */ - f->metadata = fn; - - up(&f->sem); - jffs2_complete_reservation(c); - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); - - if (ret) { - /* Eep. */ - D1(printk(KERN_DEBUG "jffs2_reserve_space() for dirent failed\n")); - return ret; - } - - rd = jffs2_alloc_raw_dirent(); - if (!rd) { - /* Argh. Now we treat it like a normal delete */ - jffs2_complete_reservation(c); - return -ENOMEM; - } - - down(&dir_f->sem); - - rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); - rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); - rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); - - rd->pino = cpu_to_je32(dir_f->inocache->ino); - rd->version = cpu_to_je32(++dir_f->highest_version); - rd->ino = ri->ino; - rd->mctime = ri->ctime; - rd->nsize = namelen; - rd->type = DT_REG; - rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); - rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); - - fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_NORMAL); - - jffs2_free_raw_dirent(rd); - - if (IS_ERR(fd)) { - /* dirent failed to write. Delete the inode normally - as if it were the final unlink() */ - jffs2_complete_reservation(c); - up(&dir_f->sem); - return PTR_ERR(fd); - } - - /* Link the fd into the inode's list, obsoleting an old - one if necessary. */ - jffs2_add_fd_to_list(c, fd, &dir_f->dents); - - jffs2_complete_reservation(c); - up(&dir_f->sem); - - return 0; -} - - -int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, - const char *name, int namelen, struct jffs2_inode_info *dead_f) -{ - struct jffs2_raw_dirent *rd; - struct jffs2_full_dirent *fd; - uint32_t alloclen, phys_ofs; - int ret; - - if (1 /* alternative branch needs testing */ || - !jffs2_can_mark_obsolete(c)) { - /* We can't mark stuff obsolete on the medium. We need to write a deletion dirent */ - - rd = jffs2_alloc_raw_dirent(); - if (!rd) - return -ENOMEM; - - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_DELETION); - if (ret) { - jffs2_free_raw_dirent(rd); - return ret; - } - - down(&dir_f->sem); - - /* Build a deletion node */ - rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); - rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); - rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); - - rd->pino = cpu_to_je32(dir_f->inocache->ino); - rd->version = cpu_to_je32(++dir_f->highest_version); - rd->ino = cpu_to_je32(0); - rd->mctime = cpu_to_je32(get_seconds()); - rd->nsize = namelen; - rd->type = DT_UNKNOWN; - rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); - rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); - - fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_DELETION); - - jffs2_free_raw_dirent(rd); - - if (IS_ERR(fd)) { - jffs2_complete_reservation(c); - up(&dir_f->sem); - return PTR_ERR(fd); - } - - /* File it. This will mark the old one obsolete. */ - jffs2_add_fd_to_list(c, fd, &dir_f->dents); - up(&dir_f->sem); - } else { - struct jffs2_full_dirent **prev = &dir_f->dents; - uint32_t nhash = full_name_hash((const unsigned char *)name, namelen); - - down(&dir_f->sem); - - while ((*prev) && (*prev)->nhash <= nhash) { - if ((*prev)->nhash == nhash && - !memcmp((*prev)->name, name, namelen) && - !(*prev)->name[namelen]) { - struct jffs2_full_dirent *this = *prev; - - D1(printk(KERN_DEBUG "Marking old dirent node (ino #%u) @%08x obsolete\n", - this->ino, ref_offset(this->raw))); - - *prev = this->next; - jffs2_mark_node_obsolete(c, (this->raw)); - jffs2_free_full_dirent(this); - break; - } - prev = &((*prev)->next); - } - up(&dir_f->sem); - } - - /* dead_f is NULL if this was a rename not a real unlink */ - /* Also catch the !f->inocache case, where there was a dirent - pointing to an inode which didn't exist. */ - if (dead_f && dead_f->inocache) { - - down(&dead_f->sem); - - if (S_ISDIR(OFNI_EDONI_2SFFJ(dead_f)->i_mode)) { - while (dead_f->dents) { - /* There can be only deleted ones */ - fd = dead_f->dents; - - dead_f->dents = fd->next; - - if (fd->ino) { - printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n", - dead_f->inocache->ino, fd->name, fd->ino); - } else { - D1(printk(KERN_DEBUG "Removing deletion dirent for \"%s\" from dir ino #%u\n", - fd->name, dead_f->inocache->ino)); - } - jffs2_mark_node_obsolete(c, fd->raw); - jffs2_free_full_dirent(fd); - } - } - - dead_f->inocache->nlink--; - /* NB: Caller must set inode nlink if appropriate */ - up(&dead_f->sem); - } - - jffs2_complete_reservation(c); - - return 0; -} - - -int jffs2_do_link (struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, uint32_t ino, uint8_t type, const char *name, int namelen) -{ - struct jffs2_raw_dirent *rd; - struct jffs2_full_dirent *fd; - uint32_t alloclen, phys_ofs; - int ret; - - rd = jffs2_alloc_raw_dirent(); - if (!rd) - return -ENOMEM; - - ret = jffs2_reserve_space(c, sizeof(*rd)+namelen, &phys_ofs, &alloclen, ALLOC_NORMAL); - if (ret) { - jffs2_free_raw_dirent(rd); - return ret; - } - - down(&dir_f->sem); - - /* Build a deletion node */ - rd->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); - rd->nodetype = cpu_to_je16(JFFS2_NODETYPE_DIRENT); - rd->totlen = cpu_to_je32(sizeof(*rd) + namelen); - rd->hdr_crc = cpu_to_je32(crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)); - - rd->pino = cpu_to_je32(dir_f->inocache->ino); - rd->version = cpu_to_je32(++dir_f->highest_version); - rd->ino = cpu_to_je32(ino); - rd->mctime = cpu_to_je32(get_seconds()); - rd->nsize = namelen; - - rd->type = type; - - rd->node_crc = cpu_to_je32(crc32(0, rd, sizeof(*rd)-8)); - rd->name_crc = cpu_to_je32(crc32(0, name, namelen)); - - fd = jffs2_write_dirent(c, dir_f, rd, (const unsigned char *)name, namelen, phys_ofs, ALLOC_NORMAL); - - jffs2_free_raw_dirent(rd); - - if (IS_ERR(fd)) { - jffs2_complete_reservation(c); - up(&dir_f->sem); - return PTR_ERR(fd); - } - - /* File it. This will mark the old one obsolete. */ - jffs2_add_fd_to_list(c, fd, &dir_f->dents); - - jffs2_complete_reservation(c); - up(&dir_f->sem); - - return 0; -} diff --git a/components/dfs/filesystems/nfs/dfs_nfs.c b/components/dfs/filesystems/nfs/dfs_nfs.c index e60f6f98c..e7ad488f7 100644 --- a/components/dfs/filesystems/nfs/dfs_nfs.c +++ b/components/dfs/filesystems/nfs/dfs_nfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/nfs/dfs_nfs.h b/components/dfs/filesystems/nfs/dfs_nfs.h index d607776ef..460027410 100644 --- a/components/dfs/filesystems/nfs/dfs_nfs.h +++ b/components/dfs/filesystems/nfs/dfs_nfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/nfs/mount.h b/components/dfs/filesystems/nfs/mount.h index aac0fd6be..ff0cec76f 100644 --- a/components/dfs/filesystems/nfs/mount.h +++ b/components/dfs/filesystems/nfs/mount.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,7 +12,7 @@ */ #ifndef _MOUNT_H_RPCGEN -#define _MOUNT_H_RPCGEN +#define _MOUNT_H_RPCGEN #include @@ -23,13 +23,13 @@ extern "C" { /* This file is copied from RFC1813 * Copyright 1995 Sun Micrososystems (I assume) */ -#define MNTPATHLEN 1024 -#define MNTNAMLEN 255 -#define FHSIZE3 64 +#define MNTPATHLEN 1024 +#define MNTNAMLEN 255 +#define FHSIZE3 64 typedef struct { - unsigned int fhandle3_len; - char *fhandle3_val; + unsigned int fhandle3_len; + char *fhandle3_val; } fhandle3; typedef char *dirpath; @@ -43,70 +43,70 @@ typedef struct groupnode *groups; typedef struct mountbody *mountlist; enum mountstat3 { - MNT3_OK = 0, - MNT3ERR_PERM = 1, - MNT3ERR_NOENT = 2, - MNT3ERR_IO = 5, - MNT3ERR_ACCES = 13, - MNT3ERR_NOTDIR = 20, - MNT3ERR_INVAL = 22, - MNT3ERR_NAMETOOLONG = 63, - MNT3ERR_NOTSUPP = 10004, - MNT3ERR_SERVERFAULT = 10006 + MNT3_OK = 0, + MNT3ERR_PERM = 1, + MNT3ERR_NOENT = 2, + MNT3ERR_IO = 5, + MNT3ERR_ACCES = 13, + MNT3ERR_NOTDIR = 20, + MNT3ERR_INVAL = 22, + MNT3ERR_NAMETOOLONG = 63, + MNT3ERR_NOTSUPP = 10004, + MNT3ERR_SERVERFAULT = 10006 }; typedef enum mountstat3 mountstat3; struct mountres3_ok { - fhandle3 fhandle; - struct { - unsigned int auth_flavors_len; - int *auth_flavors_val; - } auth_flavors; + fhandle3 fhandle; + struct { + unsigned int auth_flavors_len; + int *auth_flavors_val; + } auth_flavors; }; typedef struct mountres3_ok mountres3_ok; struct mountres3 { - mountstat3 fhs_status; - union { - mountres3_ok mountinfo; - } mountres3_u; + mountstat3 fhs_status; + union { + mountres3_ok mountinfo; + } mountres3_u; }; typedef struct mountres3 mountres3; struct mountbody { - name ml_hostname; - dirpath ml_directory; - mountlist ml_next; + name ml_hostname; + dirpath ml_directory; + mountlist ml_next; }; typedef struct mountbody mountbody; struct groupnode { - name gr_name; - groups gr_next; + name gr_name; + groups gr_next; }; typedef struct groupnode groupnode; struct exportnode { - dirpath ex_dir; - groups ex_groups; - exports ex_next; + dirpath ex_dir; + groups ex_groups; + exports ex_next; }; typedef struct exportnode exportnode; -#define MOUNT_PROGRAM 100005 -#define MOUNT_V3 3 +#define MOUNT_PROGRAM 100005 +#define MOUNT_V3 3 -#define MOUNTPROC3_NULL 0 +#define MOUNTPROC3_NULL 0 extern enum clnt_stat mountproc3_null_3(void *, CLIENT *); -#define MOUNTPROC3_MNT 1 +#define MOUNTPROC3_MNT 1 extern enum clnt_stat mountproc3_mnt_3(dirpath , mountres3 *, CLIENT *); -#define MOUNTPROC3_DUMP 2 +#define MOUNTPROC3_DUMP 2 extern enum clnt_stat mountproc3_dump_3(mountlist *, CLIENT *); -#define MOUNTPROC3_UMNT 3 +#define MOUNTPROC3_UMNT 3 extern enum clnt_stat mountproc3_umnt_3(dirpath , void *, CLIENT *); -#define MOUNTPROC3_UMNTALL 4 +#define MOUNTPROC3_UMNTALL 4 extern enum clnt_stat mountproc3_umntall_3(void *, CLIENT *); -#define MOUNTPROC3_EXPORT 5 +#define MOUNTPROC3_EXPORT 5 extern enum clnt_stat mountproc3_export_3(exports *, CLIENT *); /* the xdr functions */ diff --git a/components/dfs/filesystems/nfs/mount_clnt.c b/components/dfs/filesystems/nfs/mount_clnt.c index 5c65e75aa..9e05f7ee6 100644 --- a/components/dfs/filesystems/nfs/mount_clnt.c +++ b/components/dfs/filesystems/nfs/mount_clnt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -23,56 +23,56 @@ typedef char* caddr_t; /* Default timeout can be changed using clnt_control() */ static struct timeval TIMEOUT = { 25, 0 }; -enum clnt_stat +enum clnt_stat mountproc3_null_3(void *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_NULL, - (xdrproc_t) xdr_void, (caddr_t) NULL, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_NULL, + (xdrproc_t) xdr_void, (caddr_t) NULL, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat mountproc3_mnt_3(dirpath arg1, mountres3 *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_MNT, - (xdrproc_t) xdr_dirpath, (caddr_t) &arg1, - (xdrproc_t) xdr_mountres3, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_MNT, + (xdrproc_t) xdr_dirpath, (caddr_t) &arg1, + (xdrproc_t) xdr_mountres3, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat mountproc3_dump_3(mountlist *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_DUMP, - (xdrproc_t) xdr_void, (caddr_t) NULL, - (xdrproc_t) xdr_mountlist, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_DUMP, + (xdrproc_t) xdr_void, (caddr_t) NULL, + (xdrproc_t) xdr_mountlist, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat mountproc3_umnt_3(dirpath arg1, void *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_UMNT, - (xdrproc_t) xdr_dirpath, (caddr_t) &arg1, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_UMNT, + (xdrproc_t) xdr_dirpath, (caddr_t) &arg1, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat mountproc3_umntall_3(void *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_UMNTALL, - (xdrproc_t) xdr_void, (caddr_t) NULL, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_UMNTALL, + (xdrproc_t) xdr_void, (caddr_t) NULL, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat mountproc3_export_3(exports *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, MOUNTPROC3_EXPORT, - (xdrproc_t) xdr_void, (caddr_t) NULL, - (xdrproc_t) xdr_exports, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, MOUNTPROC3_EXPORT, + (xdrproc_t) xdr_void, (caddr_t) NULL, + (xdrproc_t) xdr_exports, (caddr_t) clnt_res, + TIMEOUT)); } diff --git a/components/dfs/filesystems/nfs/mount_xdr.c b/components/dfs/filesystems/nfs/mount_xdr.c index 04faa3bb7..e1e797000 100644 --- a/components/dfs/filesystems/nfs/mount_xdr.c +++ b/components/dfs/filesystems/nfs/mount_xdr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,124 +19,124 @@ bool_t xdr_fhandle3(register XDR *xdrs, fhandle3 *objp) { - if (!xdr_bytes(xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, FHSIZE3)) - return (FALSE); - return (TRUE); + if (!xdr_bytes(xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, FHSIZE3)) + return (FALSE); + return (TRUE); } bool_t xdr_dirpath(register XDR *xdrs, dirpath *objp) { - if (!xdr_string(xdrs, objp, MNTPATHLEN)) - return (FALSE); - return (TRUE); + if (!xdr_string(xdrs, objp, MNTPATHLEN)) + return (FALSE); + return (TRUE); } bool_t xdr_name(register XDR *xdrs, name *objp) { - if (!xdr_string(xdrs, objp, MNTNAMLEN)) - return (FALSE); - return (TRUE); + if (!xdr_string(xdrs, objp, MNTNAMLEN)) + return (FALSE); + return (TRUE); } bool_t xdr_exports(register XDR *xdrs, exports *objp) { - if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) - return (FALSE); - return (TRUE); + if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) + return (FALSE); + return (TRUE); } bool_t xdr_groups(register XDR *xdrs, groups *objp) { - if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) - return (FALSE); - return (TRUE); + if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) + return (FALSE); + return (TRUE); } bool_t xdr_mountlist(register XDR *xdrs, mountlist *objp) { - if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) - return (FALSE); - return (TRUE); + if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) + return (FALSE); + return (TRUE); } bool_t xdr_mountstat3(register XDR *xdrs, mountstat3 *objp) { - int enum_objp; + int enum_objp; - enum_objp = *objp; + enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)&enum_objp)) - { - *objp = (mountstat3)enum_objp; - return (FALSE); - } + if (!xdr_enum(xdrs, (enum_t *)&enum_objp)) + { + *objp = (mountstat3)enum_objp; + return (FALSE); + } - return (TRUE); + return (TRUE); } bool_t xdr_mountres3_ok(register XDR *xdrs, mountres3_ok *objp) { - if (!xdr_fhandle3(xdrs, &objp->fhandle)) - return (FALSE); - if (!xdr_array(xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0, - sizeof (int), (xdrproc_t) xdr_int)) - return (FALSE); - return (TRUE); + if (!xdr_fhandle3(xdrs, &objp->fhandle)) + return (FALSE); + if (!xdr_array(xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0, + sizeof (int), (xdrproc_t) xdr_int)) + return (FALSE); + return (TRUE); } bool_t xdr_mountres3(register XDR *xdrs, mountres3 *objp) { - if (!xdr_mountstat3(xdrs, &objp->fhs_status)) - return (FALSE); - switch (objp->fhs_status) { - case MNT3_OK: - if (!xdr_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo)) - return (FALSE); - break; - default : - return (FALSE); - } - return (TRUE); + if (!xdr_mountstat3(xdrs, &objp->fhs_status)) + return (FALSE); + switch (objp->fhs_status) { + case MNT3_OK: + if (!xdr_mountres3_ok(xdrs, &objp->mountres3_u.mountinfo)) + return (FALSE); + break; + default : + return (FALSE); + } + return (TRUE); } bool_t xdr_mountbody(register XDR *xdrs, mountbody *objp) { - if (!xdr_name(xdrs, &objp->ml_hostname)) - return (FALSE); - if (!xdr_dirpath(xdrs, &objp->ml_directory)) - return (FALSE); - if (!xdr_mountlist(xdrs, &objp->ml_next)) - return (FALSE); - return (TRUE); + if (!xdr_name(xdrs, &objp->ml_hostname)) + return (FALSE); + if (!xdr_dirpath(xdrs, &objp->ml_directory)) + return (FALSE); + if (!xdr_mountlist(xdrs, &objp->ml_next)) + return (FALSE); + return (TRUE); } bool_t xdr_groupnode(register XDR *xdrs, groupnode *objp) { - if (!xdr_name(xdrs, &objp->gr_name)) - return (FALSE); - if (!xdr_groups(xdrs, &objp->gr_next)) - return (FALSE); - return (TRUE); + if (!xdr_name(xdrs, &objp->gr_name)) + return (FALSE); + if (!xdr_groups(xdrs, &objp->gr_next)) + return (FALSE); + return (TRUE); } bool_t xdr_exportnode(register XDR *xdrs, exportnode *objp) { - if (!xdr_dirpath(xdrs, &objp->ex_dir)) - return (FALSE); - if (!xdr_groups(xdrs, &objp->ex_groups)) - return (FALSE); - if (!xdr_exports(xdrs, &objp->ex_next)) - return (FALSE); - return (TRUE); + if (!xdr_dirpath(xdrs, &objp->ex_dir)) + return (FALSE); + if (!xdr_groups(xdrs, &objp->ex_groups)) + return (FALSE); + if (!xdr_exports(xdrs, &objp->ex_next)) + return (FALSE); + return (TRUE); } diff --git a/components/dfs/filesystems/nfs/nfs.h b/components/dfs/filesystems/nfs/nfs.h index 34054b008..8c417ec7f 100644 --- a/components/dfs/filesystems/nfs/nfs.h +++ b/components/dfs/filesystems/nfs/nfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,7 +12,7 @@ */ #ifndef _NFS_H_RPCGEN -#define _NFS_H_RPCGEN +#define _NFS_H_RPCGEN #include @@ -23,20 +23,20 @@ extern "C" { /* This file is copied from RFC1813 * Copyright 1995 Sun Micrososystems (I assume) */ -#define NFS3_FHSIZE 64 -#define NFS3_COOKIEVERFSIZE 8 -#define NFS3_CREATEVERFSIZE 8 -#define NFS3_WRITEVERFSIZE 8 -#define ACCESS3_READ 0x0001 -#define ACCESS3_LOOKUP 0x0002 -#define ACCESS3_MODIFY 0x0004 -#define ACCESS3_EXTEND 0x0008 -#define ACCESS3_DELETE 0x0010 -#define ACCESS3_EXECUTE 0x0020 -#define FSF3_LINK 0x0001 -#define FSF3_SYMLINK 0x0002 -#define FSF3_HOMOGENEOUS 0x0008 -#define FSF3_CANSETTIME 0x0010 +#define NFS3_FHSIZE 64 +#define NFS3_COOKIEVERFSIZE 8 +#define NFS3_CREATEVERFSIZE 8 +#define NFS3_WRITEVERFSIZE 8 +#define ACCESS3_READ 0x0001 +#define ACCESS3_LOOKUP 0x0002 +#define ACCESS3_MODIFY 0x0004 +#define ACCESS3_EXTEND 0x0008 +#define ACCESS3_DELETE 0x0010 +#define ACCESS3_EXECUTE 0x0020 +#define FSF3_LINK 0x0001 +#define FSF3_SYMLINK 0x0002 +#define FSF3_HOMOGENEOUS 0x0008 +#define FSF3_CANSETTIME 0x0010 typedef unsigned long long uint64; @@ -73,900 +73,900 @@ typedef uint32 mode3; typedef uint32 count3; enum nfsstat3 { - NFS3_OK = 0, - NFS3ERR_PERM = 1, - NFS3ERR_NOENT = 2, - NFS3ERR_IO = 5, - NFS3ERR_NXIO = 6, - NFS3ERR_ACCES = 13, - NFS3ERR_EXIST = 17, - NFS3ERR_XDEV = 18, - NFS3ERR_NODEV = 19, - NFS3ERR_NOTDIR = 20, - NFS3ERR_ISDIR = 21, - NFS3ERR_INVAL = 22, - NFS3ERR_FBIG = 27, - NFS3ERR_NOSPC = 28, - NFS3ERR_ROFS = 30, - NFS3ERR_MLINK = 31, - NFS3ERR_NAMETOOLONG = 63, - NFS3ERR_NOTEMPTY = 66, - NFS3ERR_DQUOT = 69, - NFS3ERR_STALE = 70, - NFS3ERR_REMOTE = 71, - NFS3ERR_BADHANDLE = 10001, - NFS3ERR_NOT_SYNC = 10002, - NFS3ERR_BAD_COOKIE = 10003, - NFS3ERR_NOTSUPP = 10004, - NFS3ERR_TOOSMALL = 10005, - NFS3ERR_SERVERFAULT = 10006, - NFS3ERR_BADTYPE = 10007, - NFS3ERR_JUKEBOX = 10008 + NFS3_OK = 0, + NFS3ERR_PERM = 1, + NFS3ERR_NOENT = 2, + NFS3ERR_IO = 5, + NFS3ERR_NXIO = 6, + NFS3ERR_ACCES = 13, + NFS3ERR_EXIST = 17, + NFS3ERR_XDEV = 18, + NFS3ERR_NODEV = 19, + NFS3ERR_NOTDIR = 20, + NFS3ERR_ISDIR = 21, + NFS3ERR_INVAL = 22, + NFS3ERR_FBIG = 27, + NFS3ERR_NOSPC = 28, + NFS3ERR_ROFS = 30, + NFS3ERR_MLINK = 31, + NFS3ERR_NAMETOOLONG = 63, + NFS3ERR_NOTEMPTY = 66, + NFS3ERR_DQUOT = 69, + NFS3ERR_STALE = 70, + NFS3ERR_REMOTE = 71, + NFS3ERR_BADHANDLE = 10001, + NFS3ERR_NOT_SYNC = 10002, + NFS3ERR_BAD_COOKIE = 10003, + NFS3ERR_NOTSUPP = 10004, + NFS3ERR_TOOSMALL = 10005, + NFS3ERR_SERVERFAULT = 10006, + NFS3ERR_BADTYPE = 10007, + NFS3ERR_JUKEBOX = 10008 }; typedef enum nfsstat3 nfsstat3; enum ftype3 { - NFS3REG = 1, - NFS3DIR = 2, - NFS3BLK = 3, - NFS3CHR = 4, - NFS3LNK = 5, - NFS3SOCK = 6, - NFS3FIFO = 7 + NFS3REG = 1, + NFS3DIR = 2, + NFS3BLK = 3, + NFS3CHR = 4, + NFS3LNK = 5, + NFS3SOCK = 6, + NFS3FIFO = 7 }; typedef enum ftype3 ftype3; enum stable_how { - UNSTABLE = 0, - DATA_SYNC = 1, - FILE_SYNC = 2 + UNSTABLE = 0, + DATA_SYNC = 1, + FILE_SYNC = 2 }; typedef enum stable_how stable_how; enum createmode3 { - UNCHECKED = 0, - GUARDED = 1, - EXCLUSIVE = 2 + UNCHECKED = 0, + GUARDED = 1, + EXCLUSIVE = 2 }; typedef enum createmode3 createmode3; struct specdata3 { - uint32 specdata1; - uint32 specdata2; + uint32 specdata1; + uint32 specdata2; }; typedef struct specdata3 specdata3; struct nfs_fh3 { - struct { - unsigned int data_len; - char *data_val; - } data; + struct { + unsigned int data_len; + char *data_val; + } data; }; typedef struct nfs_fh3 nfs_fh3; struct nfstime3 { - uint32 seconds; - uint32 nseconds; + uint32 seconds; + uint32 nseconds; }; typedef struct nfstime3 nfstime3; struct fattr3 { - ftype3 type; - mode3 mode; - uint32 nlink; - uid3 uid; - gid3 gid; - size3 size; - size3 used; - specdata3 rdev; - uint64 fsid; - fileid3 fileid; - nfstime3 atime; - nfstime3 mtime; - nfstime3 ctime; + ftype3 type; + mode3 mode; + uint32 nlink; + uid3 uid; + gid3 gid; + size3 size; + size3 used; + specdata3 rdev; + uint64 fsid; + fileid3 fileid; + nfstime3 atime; + nfstime3 mtime; + nfstime3 ctime; }; typedef struct fattr3 fattr3; struct post_op_attr { - bool_t attributes_follow; - union { - fattr3 attributes; - } post_op_attr_u; + bool_t attributes_follow; + union { + fattr3 attributes; + } post_op_attr_u; }; typedef struct post_op_attr post_op_attr; struct wcc_attr { - size3 size; - nfstime3 mtime; - nfstime3 ctime; + size3 size; + nfstime3 mtime; + nfstime3 ctime; }; typedef struct wcc_attr wcc_attr; struct pre_op_attr { - bool_t attributes_follow; - union { - wcc_attr attributes; - } pre_op_attr_u; + bool_t attributes_follow; + union { + wcc_attr attributes; + } pre_op_attr_u; }; typedef struct pre_op_attr pre_op_attr; struct wcc_data { - pre_op_attr before; - post_op_attr after; + pre_op_attr before; + post_op_attr after; }; typedef struct wcc_data wcc_data; struct post_op_fh3 { - bool_t handle_follows; - union { - nfs_fh3 handle; - } post_op_fh3_u; + bool_t handle_follows; + union { + nfs_fh3 handle; + } post_op_fh3_u; }; typedef struct post_op_fh3 post_op_fh3; enum time_how { - DONT_CHANGE = 0, - SET_TO_SERVER_TIME = 1, - SET_TO_CLIENT_TIME = 2 + DONT_CHANGE = 0, + SET_TO_SERVER_TIME = 1, + SET_TO_CLIENT_TIME = 2 }; typedef enum time_how time_how; struct set_mode3 { - bool_t set_it; - union { - mode3 mode; - } set_mode3_u; + bool_t set_it; + union { + mode3 mode; + } set_mode3_u; }; typedef struct set_mode3 set_mode3; struct set_uid3 { - bool_t set_it; - union { - uid3 uid; - } set_uid3_u; + bool_t set_it; + union { + uid3 uid; + } set_uid3_u; }; typedef struct set_uid3 set_uid3; struct set_gid3 { - bool_t set_it; - union { - gid3 gid; - } set_gid3_u; + bool_t set_it; + union { + gid3 gid; + } set_gid3_u; }; typedef struct set_gid3 set_gid3; struct set_size3 { - bool_t set_it; - union { - size3 size; - } set_size3_u; + bool_t set_it; + union { + size3 size; + } set_size3_u; }; typedef struct set_size3 set_size3; struct set_atime { - time_how set_it; - union { - nfstime3 atime; - } set_atime_u; + time_how set_it; + union { + nfstime3 atime; + } set_atime_u; }; typedef struct set_atime set_atime; struct set_mtime { - time_how set_it; - union { - nfstime3 mtime; - } set_mtime_u; + time_how set_it; + union { + nfstime3 mtime; + } set_mtime_u; }; typedef struct set_mtime set_mtime; struct sattr3 { - set_mode3 mode; - set_uid3 uid; - set_gid3 gid; - set_size3 size; - set_atime atime; - set_mtime mtime; + set_mode3 mode; + set_uid3 uid; + set_gid3 gid; + set_size3 size; + set_atime atime; + set_mtime mtime; }; typedef struct sattr3 sattr3; struct diropargs3 { - nfs_fh3 dir; - filename3 name; + nfs_fh3 dir; + filename3 name; }; typedef struct diropargs3 diropargs3; struct GETATTR3args { - nfs_fh3 object; + nfs_fh3 object; }; typedef struct GETATTR3args GETATTR3args; struct GETATTR3resok { - fattr3 obj_attributes; + fattr3 obj_attributes; }; typedef struct GETATTR3resok GETATTR3resok; struct GETATTR3res { - nfsstat3 status; - union { - GETATTR3resok resok; - } GETATTR3res_u; + nfsstat3 status; + union { + GETATTR3resok resok; + } GETATTR3res_u; }; typedef struct GETATTR3res GETATTR3res; struct sattrguard3 { - bool_t check; - union { - nfstime3 obj_ctime; - } sattrguard3_u; + bool_t check; + union { + nfstime3 obj_ctime; + } sattrguard3_u; }; typedef struct sattrguard3 sattrguard3; struct SETATTR3args { - nfs_fh3 object; - sattr3 new_attributes; - sattrguard3 guard; + nfs_fh3 object; + sattr3 new_attributes; + sattrguard3 guard; }; typedef struct SETATTR3args SETATTR3args; struct SETATTR3resok { - wcc_data obj_wcc; + wcc_data obj_wcc; }; typedef struct SETATTR3resok SETATTR3resok; struct SETATTR3resfail { - wcc_data obj_wcc; + wcc_data obj_wcc; }; typedef struct SETATTR3resfail SETATTR3resfail; struct SETATTR3res { - nfsstat3 status; - union { - SETATTR3resok resok; - SETATTR3resfail resfail; - } SETATTR3res_u; + nfsstat3 status; + union { + SETATTR3resok resok; + SETATTR3resfail resfail; + } SETATTR3res_u; }; typedef struct SETATTR3res SETATTR3res; struct LOOKUP3args { - diropargs3 what; + diropargs3 what; }; typedef struct LOOKUP3args LOOKUP3args; struct LOOKUP3resok { - nfs_fh3 object; - post_op_attr obj_attributes; - post_op_attr dir_attributes; + nfs_fh3 object; + post_op_attr obj_attributes; + post_op_attr dir_attributes; }; typedef struct LOOKUP3resok LOOKUP3resok; struct LOOKUP3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct LOOKUP3resfail LOOKUP3resfail; struct LOOKUP3res { - nfsstat3 status; - union { - LOOKUP3resok resok; - LOOKUP3resfail resfail; - } LOOKUP3res_u; + nfsstat3 status; + union { + LOOKUP3resok resok; + LOOKUP3resfail resfail; + } LOOKUP3res_u; }; typedef struct LOOKUP3res LOOKUP3res; struct ACCESS3args { - nfs_fh3 object; - uint32 access; + nfs_fh3 object; + uint32 access; }; typedef struct ACCESS3args ACCESS3args; struct ACCESS3resok { - post_op_attr obj_attributes; - uint32 access; + post_op_attr obj_attributes; + uint32 access; }; typedef struct ACCESS3resok ACCESS3resok; struct ACCESS3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct ACCESS3resfail ACCESS3resfail; struct ACCESS3res { - nfsstat3 status; - union { - ACCESS3resok resok; - ACCESS3resfail resfail; - } ACCESS3res_u; + nfsstat3 status; + union { + ACCESS3resok resok; + ACCESS3resfail resfail; + } ACCESS3res_u; }; typedef struct ACCESS3res ACCESS3res; struct READLINK3args { - nfs_fh3 symlink; + nfs_fh3 symlink; }; typedef struct READLINK3args READLINK3args; struct READLINK3resok { - post_op_attr symlink_attributes; - nfspath3 data; + post_op_attr symlink_attributes; + nfspath3 data; }; typedef struct READLINK3resok READLINK3resok; struct READLINK3resfail { - post_op_attr symlink_attributes; + post_op_attr symlink_attributes; }; typedef struct READLINK3resfail READLINK3resfail; struct READLINK3res { - nfsstat3 status; - union { - READLINK3resok resok; - READLINK3resfail resfail; - } READLINK3res_u; + nfsstat3 status; + union { + READLINK3resok resok; + READLINK3resfail resfail; + } READLINK3res_u; }; typedef struct READLINK3res READLINK3res; struct READ3args { - nfs_fh3 file; - offset3 offset; - count3 count; + nfs_fh3 file; + offset3 offset; + count3 count; }; typedef struct READ3args READ3args; struct READ3resok { - post_op_attr file_attributes; - count3 count; - bool_t eof; - struct { - unsigned int data_len; - char *data_val; - } data; + post_op_attr file_attributes; + count3 count; + bool_t eof; + struct { + unsigned int data_len; + char *data_val; + } data; }; typedef struct READ3resok READ3resok; struct READ3resfail { - post_op_attr file_attributes; + post_op_attr file_attributes; }; typedef struct READ3resfail READ3resfail; struct READ3res { - nfsstat3 status; - union { - READ3resok resok; - READ3resfail resfail; - } READ3res_u; + nfsstat3 status; + union { + READ3resok resok; + READ3resfail resfail; + } READ3res_u; }; typedef struct READ3res READ3res; struct WRITE3args { - nfs_fh3 file; - offset3 offset; - count3 count; - stable_how stable; - struct { - unsigned int data_len; - char *data_val; - } data; + nfs_fh3 file; + offset3 offset; + count3 count; + stable_how stable; + struct { + unsigned int data_len; + char *data_val; + } data; }; typedef struct WRITE3args WRITE3args; struct WRITE3resok { - wcc_data file_wcc; - count3 count; - stable_how committed; - writeverf3 verf; + wcc_data file_wcc; + count3 count; + stable_how committed; + writeverf3 verf; }; typedef struct WRITE3resok WRITE3resok; struct WRITE3resfail { - wcc_data file_wcc; + wcc_data file_wcc; }; typedef struct WRITE3resfail WRITE3resfail; struct WRITE3res { - nfsstat3 status; - union { - WRITE3resok resok; - WRITE3resfail resfail; - } WRITE3res_u; + nfsstat3 status; + union { + WRITE3resok resok; + WRITE3resfail resfail; + } WRITE3res_u; }; typedef struct WRITE3res WRITE3res; struct createhow3 { - createmode3 mode; - union { - sattr3 obj_attributes; - createverf3 verf; - } createhow3_u; + createmode3 mode; + union { + sattr3 obj_attributes; + createverf3 verf; + } createhow3_u; }; typedef struct createhow3 createhow3; struct CREATE3args { - diropargs3 where; - createhow3 how; + diropargs3 where; + createhow3 how; }; typedef struct CREATE3args CREATE3args; struct CREATE3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct CREATE3resok CREATE3resok; struct CREATE3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct CREATE3resfail CREATE3resfail; struct CREATE3res { - nfsstat3 status; - union { - CREATE3resok resok; - CREATE3resfail resfail; - } CREATE3res_u; + nfsstat3 status; + union { + CREATE3resok resok; + CREATE3resfail resfail; + } CREATE3res_u; }; typedef struct CREATE3res CREATE3res; struct MKDIR3args { - diropargs3 where; - sattr3 attributes; + diropargs3 where; + sattr3 attributes; }; typedef struct MKDIR3args MKDIR3args; struct MKDIR3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct MKDIR3resok MKDIR3resok; struct MKDIR3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct MKDIR3resfail MKDIR3resfail; struct MKDIR3res { - nfsstat3 status; - union { - MKDIR3resok resok; - MKDIR3resfail resfail; - } MKDIR3res_u; + nfsstat3 status; + union { + MKDIR3resok resok; + MKDIR3resfail resfail; + } MKDIR3res_u; }; typedef struct MKDIR3res MKDIR3res; struct symlinkdata3 { - sattr3 symlink_attributes; - nfspath3 symlink_data; + sattr3 symlink_attributes; + nfspath3 symlink_data; }; typedef struct symlinkdata3 symlinkdata3; struct SYMLINK3args { - diropargs3 where; - symlinkdata3 symlink; + diropargs3 where; + symlinkdata3 symlink; }; typedef struct SYMLINK3args SYMLINK3args; struct SYMLINK3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct SYMLINK3resok SYMLINK3resok; struct SYMLINK3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct SYMLINK3resfail SYMLINK3resfail; struct SYMLINK3res { - nfsstat3 status; - union { - SYMLINK3resok resok; - SYMLINK3resfail resfail; - } SYMLINK3res_u; + nfsstat3 status; + union { + SYMLINK3resok resok; + SYMLINK3resfail resfail; + } SYMLINK3res_u; }; typedef struct SYMLINK3res SYMLINK3res; struct devicedata3 { - sattr3 dev_attributes; - specdata3 spec; + sattr3 dev_attributes; + specdata3 spec; }; typedef struct devicedata3 devicedata3; struct mknoddata3 { - ftype3 type; - union { - devicedata3 device; - sattr3 pipe_attributes; - } mknoddata3_u; + ftype3 type; + union { + devicedata3 device; + sattr3 pipe_attributes; + } mknoddata3_u; }; typedef struct mknoddata3 mknoddata3; struct MKNOD3args { - diropargs3 where; - mknoddata3 what; + diropargs3 where; + mknoddata3 what; }; typedef struct MKNOD3args MKNOD3args; struct MKNOD3resok { - post_op_fh3 obj; - post_op_attr obj_attributes; - wcc_data dir_wcc; + post_op_fh3 obj; + post_op_attr obj_attributes; + wcc_data dir_wcc; }; typedef struct MKNOD3resok MKNOD3resok; struct MKNOD3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct MKNOD3resfail MKNOD3resfail; struct MKNOD3res { - nfsstat3 status; - union { - MKNOD3resok resok; - MKNOD3resfail resfail; - } MKNOD3res_u; + nfsstat3 status; + union { + MKNOD3resok resok; + MKNOD3resfail resfail; + } MKNOD3res_u; }; typedef struct MKNOD3res MKNOD3res; struct REMOVE3args { - diropargs3 object; + diropargs3 object; }; typedef struct REMOVE3args REMOVE3args; struct REMOVE3resok { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct REMOVE3resok REMOVE3resok; struct REMOVE3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct REMOVE3resfail REMOVE3resfail; struct REMOVE3res { - nfsstat3 status; - union { - REMOVE3resok resok; - REMOVE3resfail resfail; - } REMOVE3res_u; + nfsstat3 status; + union { + REMOVE3resok resok; + REMOVE3resfail resfail; + } REMOVE3res_u; }; typedef struct REMOVE3res REMOVE3res; struct RMDIR3args { - diropargs3 object; + diropargs3 object; }; typedef struct RMDIR3args RMDIR3args; struct RMDIR3resok { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct RMDIR3resok RMDIR3resok; struct RMDIR3resfail { - wcc_data dir_wcc; + wcc_data dir_wcc; }; typedef struct RMDIR3resfail RMDIR3resfail; struct RMDIR3res { - nfsstat3 status; - union { - RMDIR3resok resok; - RMDIR3resfail resfail; - } RMDIR3res_u; + nfsstat3 status; + union { + RMDIR3resok resok; + RMDIR3resfail resfail; + } RMDIR3res_u; }; typedef struct RMDIR3res RMDIR3res; struct RENAME3args { - diropargs3 from; - diropargs3 to; + diropargs3 from; + diropargs3 to; }; typedef struct RENAME3args RENAME3args; struct RENAME3resok { - wcc_data fromdir_wcc; - wcc_data todir_wcc; + wcc_data fromdir_wcc; + wcc_data todir_wcc; }; typedef struct RENAME3resok RENAME3resok; struct RENAME3resfail { - wcc_data fromdir_wcc; - wcc_data todir_wcc; + wcc_data fromdir_wcc; + wcc_data todir_wcc; }; typedef struct RENAME3resfail RENAME3resfail; struct RENAME3res { - nfsstat3 status; - union { - RENAME3resok resok; - RENAME3resfail resfail; - } RENAME3res_u; + nfsstat3 status; + union { + RENAME3resok resok; + RENAME3resfail resfail; + } RENAME3res_u; }; typedef struct RENAME3res RENAME3res; struct LINK3args { - nfs_fh3 file; - diropargs3 link; + nfs_fh3 file; + diropargs3 link; }; typedef struct LINK3args LINK3args; struct LINK3resok { - post_op_attr file_attributes; - wcc_data linkdir_wcc; + post_op_attr file_attributes; + wcc_data linkdir_wcc; }; typedef struct LINK3resok LINK3resok; struct LINK3resfail { - post_op_attr file_attributes; - wcc_data linkdir_wcc; + post_op_attr file_attributes; + wcc_data linkdir_wcc; }; typedef struct LINK3resfail LINK3resfail; struct LINK3res { - nfsstat3 status; - union { - LINK3resok resok; - LINK3resfail resfail; - } LINK3res_u; + nfsstat3 status; + union { + LINK3resok resok; + LINK3resfail resfail; + } LINK3res_u; }; typedef struct LINK3res LINK3res; struct READDIR3args { - nfs_fh3 dir; - cookie3 cookie; - cookieverf3 cookieverf; - count3 count; + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 count; }; typedef struct READDIR3args READDIR3args; struct entry3 { - fileid3 fileid; - filename3 name; - cookie3 cookie; - struct entry3 *nextentry; + fileid3 fileid; + filename3 name; + cookie3 cookie; + struct entry3 *nextentry; }; typedef struct entry3 entry3; struct dirlist3 { - entry3 *entries; - bool_t eof; + entry3 *entries; + bool_t eof; }; typedef struct dirlist3 dirlist3; struct READDIR3resok { - post_op_attr dir_attributes; - cookieverf3 cookieverf; - dirlist3 reply; + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlist3 reply; }; typedef struct READDIR3resok READDIR3resok; struct READDIR3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct READDIR3resfail READDIR3resfail; struct READDIR3res { - nfsstat3 status; - union { - READDIR3resok resok; - READDIR3resfail resfail; - } READDIR3res_u; + nfsstat3 status; + union { + READDIR3resok resok; + READDIR3resfail resfail; + } READDIR3res_u; }; typedef struct READDIR3res READDIR3res; struct READDIRPLUS3args { - nfs_fh3 dir; - cookie3 cookie; - cookieverf3 cookieverf; - count3 dircount; - count3 maxcount; + nfs_fh3 dir; + cookie3 cookie; + cookieverf3 cookieverf; + count3 dircount; + count3 maxcount; }; typedef struct READDIRPLUS3args READDIRPLUS3args; struct entryplus3 { - fileid3 fileid; - filename3 name; - cookie3 cookie; - post_op_attr name_attributes; - post_op_fh3 name_handle; - struct entryplus3 *nextentry; + fileid3 fileid; + filename3 name; + cookie3 cookie; + post_op_attr name_attributes; + post_op_fh3 name_handle; + struct entryplus3 *nextentry; }; typedef struct entryplus3 entryplus3; struct dirlistplus3 { - entryplus3 *entries; - bool_t eof; + entryplus3 *entries; + bool_t eof; }; typedef struct dirlistplus3 dirlistplus3; struct READDIRPLUS3resok { - post_op_attr dir_attributes; - cookieverf3 cookieverf; - dirlistplus3 reply; + post_op_attr dir_attributes; + cookieverf3 cookieverf; + dirlistplus3 reply; }; typedef struct READDIRPLUS3resok READDIRPLUS3resok; struct READDIRPLUS3resfail { - post_op_attr dir_attributes; + post_op_attr dir_attributes; }; typedef struct READDIRPLUS3resfail READDIRPLUS3resfail; struct READDIRPLUS3res { - nfsstat3 status; - union { - READDIRPLUS3resok resok; - READDIRPLUS3resfail resfail; - } READDIRPLUS3res_u; + nfsstat3 status; + union { + READDIRPLUS3resok resok; + READDIRPLUS3resfail resfail; + } READDIRPLUS3res_u; }; typedef struct READDIRPLUS3res READDIRPLUS3res; struct FSSTAT3args { - nfs_fh3 fsroot; + nfs_fh3 fsroot; }; typedef struct FSSTAT3args FSSTAT3args; struct FSSTAT3resok { - post_op_attr obj_attributes; - size3 tbytes; - size3 fbytes; - size3 abytes; - size3 tfiles; - size3 ffiles; - size3 afiles; - uint32 invarsec; + post_op_attr obj_attributes; + size3 tbytes; + size3 fbytes; + size3 abytes; + size3 tfiles; + size3 ffiles; + size3 afiles; + uint32 invarsec; }; typedef struct FSSTAT3resok FSSTAT3resok; struct FSSTAT3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct FSSTAT3resfail FSSTAT3resfail; struct FSSTAT3res { - nfsstat3 status; - union { - FSSTAT3resok resok; - FSSTAT3resfail resfail; - } FSSTAT3res_u; + nfsstat3 status; + union { + FSSTAT3resok resok; + FSSTAT3resfail resfail; + } FSSTAT3res_u; }; typedef struct FSSTAT3res FSSTAT3res; struct FSINFO3args { - nfs_fh3 fsroot; + nfs_fh3 fsroot; }; typedef struct FSINFO3args FSINFO3args; struct FSINFO3resok { - post_op_attr obj_attributes; - uint32 rtmax; - uint32 rtpref; - uint32 rtmult; - uint32 wtmax; - uint32 wtpref; - uint32 wtmult; - uint32 dtpref; - size3 maxfilesize; - nfstime3 time_delta; - uint32 properties; + post_op_attr obj_attributes; + uint32 rtmax; + uint32 rtpref; + uint32 rtmult; + uint32 wtmax; + uint32 wtpref; + uint32 wtmult; + uint32 dtpref; + size3 maxfilesize; + nfstime3 time_delta; + uint32 properties; }; typedef struct FSINFO3resok FSINFO3resok; struct FSINFO3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct FSINFO3resfail FSINFO3resfail; struct FSINFO3res { - nfsstat3 status; - union { - FSINFO3resok resok; - FSINFO3resfail resfail; - } FSINFO3res_u; + nfsstat3 status; + union { + FSINFO3resok resok; + FSINFO3resfail resfail; + } FSINFO3res_u; }; typedef struct FSINFO3res FSINFO3res; struct PATHCONF3args { - nfs_fh3 object; + nfs_fh3 object; }; typedef struct PATHCONF3args PATHCONF3args; struct PATHCONF3resok { - post_op_attr obj_attributes; - uint32 linkmax; - uint32 name_max; - bool_t no_trunc; - bool_t chown_restricted; - bool_t case_insensitive; - bool_t case_preserving; + post_op_attr obj_attributes; + uint32 linkmax; + uint32 name_max; + bool_t no_trunc; + bool_t chown_restricted; + bool_t case_insensitive; + bool_t case_preserving; }; typedef struct PATHCONF3resok PATHCONF3resok; struct PATHCONF3resfail { - post_op_attr obj_attributes; + post_op_attr obj_attributes; }; typedef struct PATHCONF3resfail PATHCONF3resfail; struct PATHCONF3res { - nfsstat3 status; - union { - PATHCONF3resok resok; - PATHCONF3resfail resfail; - } PATHCONF3res_u; + nfsstat3 status; + union { + PATHCONF3resok resok; + PATHCONF3resfail resfail; + } PATHCONF3res_u; }; typedef struct PATHCONF3res PATHCONF3res; struct COMMIT3args { - nfs_fh3 file; - offset3 offset; - count3 count; + nfs_fh3 file; + offset3 offset; + count3 count; }; typedef struct COMMIT3args COMMIT3args; struct COMMIT3resok { - wcc_data file_wcc; - writeverf3 verf; + wcc_data file_wcc; + writeverf3 verf; }; typedef struct COMMIT3resok COMMIT3resok; struct COMMIT3resfail { - wcc_data file_wcc; + wcc_data file_wcc; }; typedef struct COMMIT3resfail COMMIT3resfail; struct COMMIT3res { - nfsstat3 status; - union { - COMMIT3resok resok; - COMMIT3resfail resfail; - } COMMIT3res_u; + nfsstat3 status; + union { + COMMIT3resok resok; + COMMIT3resfail resfail; + } COMMIT3res_u; }; typedef struct COMMIT3res COMMIT3res; -#define NFS_PROGRAM 100003 -#define NFS_V3 3 +#define NFS_PROGRAM 100003 +#define NFS_V3 3 -#define NFSPROC3_NULL 0 +#define NFSPROC3_NULL 0 extern enum clnt_stat nfsproc3_null_3(void *, CLIENT *); -#define NFSPROC3_GETATTR 1 +#define NFSPROC3_GETATTR 1 extern enum clnt_stat nfsproc3_getattr_3(GETATTR3args , GETATTR3res *, CLIENT *); -#define NFSPROC3_SETATTR 2 +#define NFSPROC3_SETATTR 2 extern enum clnt_stat nfsproc3_setattr_3(SETATTR3args , SETATTR3res *, CLIENT *); -#define NFSPROC3_LOOKUP 3 +#define NFSPROC3_LOOKUP 3 extern enum clnt_stat nfsproc3_lookup_3(LOOKUP3args , LOOKUP3res *, CLIENT *); -#define NFSPROC3_ACCESS 4 +#define NFSPROC3_ACCESS 4 extern enum clnt_stat nfsproc3_access_3(ACCESS3args , ACCESS3res *, CLIENT *); -#define NFSPROC3_READLINK 5 +#define NFSPROC3_READLINK 5 extern enum clnt_stat nfsproc3_readlink_3(READLINK3args , READLINK3res *, CLIENT *); -#define NFSPROC3_READ 6 +#define NFSPROC3_READ 6 extern enum clnt_stat nfsproc3_read_3(READ3args , READ3res *, CLIENT *); -#define NFSPROC3_WRITE 7 +#define NFSPROC3_WRITE 7 extern enum clnt_stat nfsproc3_write_3(WRITE3args , WRITE3res *, CLIENT *); -#define NFSPROC3_CREATE 8 +#define NFSPROC3_CREATE 8 extern enum clnt_stat nfsproc3_create_3(CREATE3args , CREATE3res *, CLIENT *); -#define NFSPROC3_MKDIR 9 +#define NFSPROC3_MKDIR 9 extern enum clnt_stat nfsproc3_mkdir_3(MKDIR3args , MKDIR3res *, CLIENT *); -#define NFSPROC3_SYMLINK 10 +#define NFSPROC3_SYMLINK 10 extern enum clnt_stat nfsproc3_symlink_3(SYMLINK3args , SYMLINK3res *, CLIENT *); -#define NFSPROC3_MKNOD 11 +#define NFSPROC3_MKNOD 11 extern enum clnt_stat nfsproc3_mknod_3(MKNOD3args , MKNOD3res *, CLIENT *); -#define NFSPROC3_REMOVE 12 +#define NFSPROC3_REMOVE 12 extern enum clnt_stat nfsproc3_remove_3(REMOVE3args , REMOVE3res *, CLIENT *); -#define NFSPROC3_RMDIR 13 +#define NFSPROC3_RMDIR 13 extern enum clnt_stat nfsproc3_rmdir_3(RMDIR3args , RMDIR3res *, CLIENT *); -#define NFSPROC3_RENAME 14 +#define NFSPROC3_RENAME 14 extern enum clnt_stat nfsproc3_rename_3(RENAME3args , RENAME3res *, CLIENT *); -#define NFSPROC3_LINK 15 +#define NFSPROC3_LINK 15 extern enum clnt_stat nfsproc3_link_3(LINK3args , LINK3res *, CLIENT *); -#define NFSPROC3_READDIR 16 +#define NFSPROC3_READDIR 16 extern enum clnt_stat nfsproc3_readdir_3(READDIR3args , READDIR3res *, CLIENT *); -#define NFSPROC3_READDIRPLUS 17 +#define NFSPROC3_READDIRPLUS 17 extern enum clnt_stat nfsproc3_readdirplus_3(READDIRPLUS3args , READDIRPLUS3res *, CLIENT *); -#define NFSPROC3_FSSTAT 18 +#define NFSPROC3_FSSTAT 18 extern enum clnt_stat nfsproc3_fsstat_3(FSSTAT3args , FSSTAT3res *, CLIENT *); -#define NFSPROC3_FSINFO 19 +#define NFSPROC3_FSINFO 19 extern enum clnt_stat nfsproc3_fsinfo_3(FSINFO3args , FSINFO3res *, CLIENT *); -#define NFSPROC3_PATHCONF 20 +#define NFSPROC3_PATHCONF 20 extern enum clnt_stat nfsproc3_pathconf_3(PATHCONF3args , PATHCONF3res *, CLIENT *); -#define NFSPROC3_COMMIT 21 +#define NFSPROC3_COMMIT 21 extern enum clnt_stat nfsproc3_commit_3(COMMIT3args , COMMIT3res *, CLIENT *); /* the xdr functions */ diff --git a/components/dfs/filesystems/nfs/nfs_auth.c b/components/dfs/filesystems/nfs/nfs_auth.c index c65a1126a..4b6be8d49 100644 --- a/components/dfs/filesystems/nfs/nfs_auth.c +++ b/components/dfs/filesystems/nfs/nfs_auth.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/nfs/nfs_clnt.c b/components/dfs/filesystems/nfs/nfs_clnt.c index c17fee9e8..b50cf7ff1 100644 --- a/components/dfs/filesystems/nfs/nfs_clnt.c +++ b/components/dfs/filesystems/nfs/nfs_clnt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -23,200 +23,200 @@ typedef char* caddr_t; /* Default timeout can be changed using clnt_control() */ static struct timeval TIMEOUT = { 25, 0 }; -enum clnt_stat +enum clnt_stat nfsproc3_null_3(void *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_NULL, - (xdrproc_t) xdr_void, (caddr_t) NULL, - (xdrproc_t) xdr_void, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_NULL, + (xdrproc_t) xdr_void, (caddr_t) NULL, + (xdrproc_t) xdr_void, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_getattr_3(GETATTR3args arg1, GETATTR3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_GETATTR, - (xdrproc_t) xdr_GETATTR3args, (caddr_t) &arg1, - (xdrproc_t) xdr_GETATTR3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_GETATTR, + (xdrproc_t) xdr_GETATTR3args, (caddr_t) &arg1, + (xdrproc_t) xdr_GETATTR3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_setattr_3(SETATTR3args arg1, SETATTR3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_SETATTR, - (xdrproc_t) xdr_SETATTR3args, (caddr_t) &arg1, - (xdrproc_t) xdr_SETATTR3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_SETATTR, + (xdrproc_t) xdr_SETATTR3args, (caddr_t) &arg1, + (xdrproc_t) xdr_SETATTR3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_lookup_3(LOOKUP3args arg1, LOOKUP3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_LOOKUP, - (xdrproc_t) xdr_LOOKUP3args, (caddr_t) &arg1, - (xdrproc_t) xdr_LOOKUP3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_LOOKUP, + (xdrproc_t) xdr_LOOKUP3args, (caddr_t) &arg1, + (xdrproc_t) xdr_LOOKUP3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_access_3(ACCESS3args arg1, ACCESS3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_ACCESS, - (xdrproc_t) xdr_ACCESS3args, (caddr_t) &arg1, - (xdrproc_t) xdr_ACCESS3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_ACCESS, + (xdrproc_t) xdr_ACCESS3args, (caddr_t) &arg1, + (xdrproc_t) xdr_ACCESS3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_readlink_3(READLINK3args arg1, READLINK3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_READLINK, - (xdrproc_t) xdr_READLINK3args, (caddr_t) &arg1, - (xdrproc_t) xdr_READLINK3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_READLINK, + (xdrproc_t) xdr_READLINK3args, (caddr_t) &arg1, + (xdrproc_t) xdr_READLINK3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_read_3(READ3args arg1, READ3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_READ, - (xdrproc_t) xdr_READ3args, (caddr_t) &arg1, - (xdrproc_t) xdr_READ3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_READ, + (xdrproc_t) xdr_READ3args, (caddr_t) &arg1, + (xdrproc_t) xdr_READ3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_write_3(WRITE3args arg1, WRITE3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_WRITE, - (xdrproc_t) xdr_WRITE3args, (caddr_t) &arg1, - (xdrproc_t) xdr_WRITE3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_WRITE, + (xdrproc_t) xdr_WRITE3args, (caddr_t) &arg1, + (xdrproc_t) xdr_WRITE3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_create_3(CREATE3args arg1, CREATE3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_CREATE, - (xdrproc_t) xdr_CREATE3args, (caddr_t) &arg1, - (xdrproc_t) xdr_CREATE3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_CREATE, + (xdrproc_t) xdr_CREATE3args, (caddr_t) &arg1, + (xdrproc_t) xdr_CREATE3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_mkdir_3(MKDIR3args arg1, MKDIR3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_MKDIR, - (xdrproc_t) xdr_MKDIR3args, (caddr_t) &arg1, - (xdrproc_t) xdr_MKDIR3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_MKDIR, + (xdrproc_t) xdr_MKDIR3args, (caddr_t) &arg1, + (xdrproc_t) xdr_MKDIR3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_symlink_3(SYMLINK3args arg1, SYMLINK3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_SYMLINK, - (xdrproc_t) xdr_SYMLINK3args, (caddr_t) &arg1, - (xdrproc_t) xdr_SYMLINK3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_SYMLINK, + (xdrproc_t) xdr_SYMLINK3args, (caddr_t) &arg1, + (xdrproc_t) xdr_SYMLINK3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_mknod_3(MKNOD3args arg1, MKNOD3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_MKNOD, - (xdrproc_t) xdr_MKNOD3args, (caddr_t) &arg1, - (xdrproc_t) xdr_MKNOD3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_MKNOD, + (xdrproc_t) xdr_MKNOD3args, (caddr_t) &arg1, + (xdrproc_t) xdr_MKNOD3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_remove_3(REMOVE3args arg1, REMOVE3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_REMOVE, - (xdrproc_t) xdr_REMOVE3args, (caddr_t) &arg1, - (xdrproc_t) xdr_REMOVE3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_REMOVE, + (xdrproc_t) xdr_REMOVE3args, (caddr_t) &arg1, + (xdrproc_t) xdr_REMOVE3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_rmdir_3(RMDIR3args arg1, RMDIR3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_RMDIR, - (xdrproc_t) xdr_RMDIR3args, (caddr_t) &arg1, - (xdrproc_t) xdr_RMDIR3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_RMDIR, + (xdrproc_t) xdr_RMDIR3args, (caddr_t) &arg1, + (xdrproc_t) xdr_RMDIR3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_rename_3(RENAME3args arg1, RENAME3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_RENAME, - (xdrproc_t) xdr_RENAME3args, (caddr_t) &arg1, - (xdrproc_t) xdr_RENAME3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_RENAME, + (xdrproc_t) xdr_RENAME3args, (caddr_t) &arg1, + (xdrproc_t) xdr_RENAME3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_link_3(LINK3args arg1, LINK3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_LINK, - (xdrproc_t) xdr_LINK3args, (caddr_t) &arg1, - (xdrproc_t) xdr_LINK3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_LINK, + (xdrproc_t) xdr_LINK3args, (caddr_t) &arg1, + (xdrproc_t) xdr_LINK3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_readdir_3(READDIR3args arg1, READDIR3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_READDIR, - (xdrproc_t) xdr_READDIR3args, (caddr_t) &arg1, - (xdrproc_t) xdr_READDIR3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_READDIR, + (xdrproc_t) xdr_READDIR3args, (caddr_t) &arg1, + (xdrproc_t) xdr_READDIR3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_readdirplus_3(READDIRPLUS3args arg1, READDIRPLUS3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_READDIRPLUS, - (xdrproc_t) xdr_READDIRPLUS3args, (caddr_t) &arg1, - (xdrproc_t) xdr_READDIRPLUS3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_READDIRPLUS, + (xdrproc_t) xdr_READDIRPLUS3args, (caddr_t) &arg1, + (xdrproc_t) xdr_READDIRPLUS3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_fsstat_3(FSSTAT3args arg1, FSSTAT3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_FSSTAT, - (xdrproc_t) xdr_FSSTAT3args, (caddr_t) &arg1, - (xdrproc_t) xdr_FSSTAT3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_FSSTAT, + (xdrproc_t) xdr_FSSTAT3args, (caddr_t) &arg1, + (xdrproc_t) xdr_FSSTAT3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_fsinfo_3(FSINFO3args arg1, FSINFO3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_FSINFO, - (xdrproc_t) xdr_FSINFO3args, (caddr_t) &arg1, - (xdrproc_t) xdr_FSINFO3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_FSINFO, + (xdrproc_t) xdr_FSINFO3args, (caddr_t) &arg1, + (xdrproc_t) xdr_FSINFO3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_pathconf_3(PATHCONF3args arg1, PATHCONF3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_PATHCONF, - (xdrproc_t) xdr_PATHCONF3args, (caddr_t) &arg1, - (xdrproc_t) xdr_PATHCONF3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_PATHCONF, + (xdrproc_t) xdr_PATHCONF3args, (caddr_t) &arg1, + (xdrproc_t) xdr_PATHCONF3res, (caddr_t) clnt_res, + TIMEOUT)); } -enum clnt_stat +enum clnt_stat nfsproc3_commit_3(COMMIT3args arg1, COMMIT3res *clnt_res, CLIENT *clnt) { - return (clnt_call(clnt, NFSPROC3_COMMIT, - (xdrproc_t) xdr_COMMIT3args, (caddr_t) &arg1, - (xdrproc_t) xdr_COMMIT3res, (caddr_t) clnt_res, - TIMEOUT)); + return (clnt_call(clnt, NFSPROC3_COMMIT, + (xdrproc_t) xdr_COMMIT3args, (caddr_t) &arg1, + (xdrproc_t) xdr_COMMIT3res, (caddr_t) clnt_res, + TIMEOUT)); } diff --git a/components/dfs/filesystems/nfs/nfs_xdr.c b/components/dfs/filesystems/nfs/nfs_xdr.c index 33563976c..2662a17df 100644 --- a/components/dfs/filesystems/nfs/nfs_xdr.c +++ b/components/dfs/filesystems/nfs/nfs_xdr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,1604 +19,1604 @@ bool_t xdr_uint64(register XDR *xdrs, uint64 *objp) { - if (!xdr_u_longlong_t(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_u_longlong_t(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_int64(register XDR *xdrs, int64 *objp) { - if (!xdr_longlong_t(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_longlong_t(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_uint32(register XDR *xdrs, uint32 *objp) { - if (!xdr_u_long(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_u_long(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_int32(register XDR *xdrs, int32 *objp) { - if (!xdr_long(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_long(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_filename3(register XDR *xdrs, filename3 *objp) { - if (!xdr_string(xdrs, objp, ~0)) - return (FALSE); - return (TRUE); + if (!xdr_string(xdrs, objp, ~0)) + return (FALSE); + return (TRUE); } bool_t xdr_nfspath3(register XDR *xdrs, nfspath3 *objp) { - if (!xdr_string(xdrs, objp, ~0)) - return (FALSE); - return (TRUE); + if (!xdr_string(xdrs, objp, ~0)) + return (FALSE); + return (TRUE); } bool_t xdr_fileid3(register XDR *xdrs, fileid3 *objp) { - if (!xdr_uint64(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint64(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_cookie3(register XDR *xdrs, cookie3 *objp) { - if (!xdr_uint64(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint64(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_cookieverf3(register XDR *xdrs, cookieverf3 objp) { - if (!xdr_opaque(xdrs, objp, NFS3_COOKIEVERFSIZE)) - return (FALSE); - return (TRUE); + if (!xdr_opaque(xdrs, objp, NFS3_COOKIEVERFSIZE)) + return (FALSE); + return (TRUE); } bool_t xdr_createverf3(register XDR *xdrs, createverf3 objp) { - if (!xdr_opaque(xdrs, objp, NFS3_CREATEVERFSIZE)) - return (FALSE); - return (TRUE); + if (!xdr_opaque(xdrs, objp, NFS3_CREATEVERFSIZE)) + return (FALSE); + return (TRUE); } bool_t xdr_writeverf3(register XDR *xdrs, writeverf3 objp) { - if (!xdr_opaque(xdrs, objp, NFS3_WRITEVERFSIZE)) - return (FALSE); - return (TRUE); + if (!xdr_opaque(xdrs, objp, NFS3_WRITEVERFSIZE)) + return (FALSE); + return (TRUE); } bool_t xdr_uid3(register XDR *xdrs, uid3 *objp) { - if (!xdr_uint32(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_gid3(register XDR *xdrs, gid3 *objp) { - if (!xdr_uint32(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_size3(register XDR *xdrs, size3 *objp) { - if (!xdr_uint64(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint64(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_offset3(register XDR *xdrs, offset3 *objp) { - if (!xdr_uint64(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint64(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_mode3(register XDR *xdrs, mode3 *objp) { - if (!xdr_uint32(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_count3(register XDR *xdrs, count3 *objp) { - if (!xdr_uint32(xdrs, objp)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, objp)) + return (FALSE); + return (TRUE); } bool_t xdr_nfsstat3(register XDR *xdrs, nfsstat3 *objp) { - int enum_objp; - enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)objp)) - { - *objp = (nfsstat3)enum_objp; - return (FALSE); - } + int enum_objp; + enum_objp = *objp; + if (!xdr_enum(xdrs, (enum_t *)objp)) + { + *objp = (nfsstat3)enum_objp; + return (FALSE); + } - return (TRUE); + return (TRUE); } bool_t xdr_ftype3(register XDR *xdrs, ftype3 *objp) { - int enum_objp; - enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)objp)) - { - *objp = (ftype3)enum_objp; - return (FALSE); - } - - return (TRUE); + int enum_objp; + enum_objp = *objp; + if (!xdr_enum(xdrs, (enum_t *)objp)) + { + *objp = (ftype3)enum_objp; + return (FALSE); + } + + return (TRUE); } bool_t xdr_stable_how(register XDR *xdrs, stable_how *objp) { - int enum_objp; - enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)objp)) - { - *objp = (stable_how)enum_objp; - return (FALSE); - } - - return (TRUE); + int enum_objp; + enum_objp = *objp; + if (!xdr_enum(xdrs, (enum_t *)objp)) + { + *objp = (stable_how)enum_objp; + return (FALSE); + } + + return (TRUE); } bool_t xdr_createmode3(register XDR *xdrs, createmode3 *objp) { - int enum_objp; - enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)objp)) - { - *objp = (createmode3)enum_objp; - return (FALSE); - } - - return (TRUE); + int enum_objp; + enum_objp = *objp; + if (!xdr_enum(xdrs, (enum_t *)objp)) + { + *objp = (createmode3)enum_objp; + return (FALSE); + } + + return (TRUE); } bool_t xdr_specdata3(register XDR *xdrs, specdata3 *objp) { - if (!xdr_uint32(xdrs, &objp->specdata1)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->specdata2)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, &objp->specdata1)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->specdata2)) + return (FALSE); + return (TRUE); } bool_t xdr_nfs_fh3(register XDR *xdrs, nfs_fh3 *objp) { - if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, NFS3_FHSIZE)) - return (FALSE); - return (TRUE); + if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, NFS3_FHSIZE)) + return (FALSE); + return (TRUE); } bool_t xdr_nfstime3(register XDR *xdrs, nfstime3 *objp) { - if (!xdr_uint32(xdrs, &objp->seconds)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->nseconds)) - return (FALSE); - return (TRUE); + if (!xdr_uint32(xdrs, &objp->seconds)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->nseconds)) + return (FALSE); + return (TRUE); } bool_t xdr_fattr3(register XDR *xdrs, fattr3 *objp) { - if (!xdr_ftype3(xdrs, &objp->type)) - return (FALSE); - if (!xdr_mode3(xdrs, &objp->mode)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->nlink)) - return (FALSE); - if (!xdr_uid3(xdrs, &objp->uid)) - return (FALSE); - if (!xdr_gid3(xdrs, &objp->gid)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->size)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->used)) - return (FALSE); - if (!xdr_specdata3(xdrs, &objp->rdev)) - return (FALSE); - if (!xdr_uint64(xdrs, &objp->fsid)) - return (FALSE); - if (!xdr_fileid3(xdrs, &objp->fileid)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->atime)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->mtime)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->ctime)) - return (FALSE); - return (TRUE); + if (!xdr_ftype3(xdrs, &objp->type)) + return (FALSE); + if (!xdr_mode3(xdrs, &objp->mode)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->nlink)) + return (FALSE); + if (!xdr_uid3(xdrs, &objp->uid)) + return (FALSE); + if (!xdr_gid3(xdrs, &objp->gid)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->size)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->used)) + return (FALSE); + if (!xdr_specdata3(xdrs, &objp->rdev)) + return (FALSE); + if (!xdr_uint64(xdrs, &objp->fsid)) + return (FALSE); + if (!xdr_fileid3(xdrs, &objp->fileid)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->atime)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->mtime)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->ctime)) + return (FALSE); + return (TRUE); } bool_t xdr_post_op_attr(register XDR *xdrs, post_op_attr *objp) { - if (!xdr_bool(xdrs, &objp->attributes_follow)) - return (FALSE); - switch (objp->attributes_follow) { - case TRUE: - if (!xdr_fattr3(xdrs, &objp->post_op_attr_u.attributes)) - return (FALSE); - break; - case FALSE: - break; - default: - return (FALSE); - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->attributes_follow)) + return (FALSE); + switch (objp->attributes_follow) { + case TRUE: + if (!xdr_fattr3(xdrs, &objp->post_op_attr_u.attributes)) + return (FALSE); + break; + case FALSE: + break; + default: + return (FALSE); + } + return (TRUE); } bool_t xdr_wcc_attr(register XDR *xdrs, wcc_attr *objp) { - if (!xdr_size3(xdrs, &objp->size)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->mtime)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->ctime)) - return (FALSE); - return (TRUE); + if (!xdr_size3(xdrs, &objp->size)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->mtime)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->ctime)) + return (FALSE); + return (TRUE); } bool_t xdr_pre_op_attr(register XDR *xdrs, pre_op_attr *objp) { - if (!xdr_bool(xdrs, &objp->attributes_follow)) - return (FALSE); - switch (objp->attributes_follow) { - case TRUE: - if (!xdr_wcc_attr(xdrs, &objp->pre_op_attr_u.attributes)) - return (FALSE); - break; - case FALSE: - break; - default: - return (FALSE); - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->attributes_follow)) + return (FALSE); + switch (objp->attributes_follow) { + case TRUE: + if (!xdr_wcc_attr(xdrs, &objp->pre_op_attr_u.attributes)) + return (FALSE); + break; + case FALSE: + break; + default: + return (FALSE); + } + return (TRUE); } bool_t xdr_wcc_data(register XDR *xdrs, wcc_data *objp) { - if (!xdr_pre_op_attr(xdrs, &objp->before)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->after)) - return (FALSE); - return (TRUE); + if (!xdr_pre_op_attr(xdrs, &objp->before)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->after)) + return (FALSE); + return (TRUE); } bool_t xdr_post_op_fh3(register XDR *xdrs, post_op_fh3 *objp) { - if (!xdr_bool(xdrs, &objp->handle_follows)) - return (FALSE); - switch (objp->handle_follows) { - case TRUE: - if (!xdr_nfs_fh3(xdrs, &objp->post_op_fh3_u.handle)) - return (FALSE); - break; - case FALSE: - break; - default: - return (FALSE); - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->handle_follows)) + return (FALSE); + switch (objp->handle_follows) { + case TRUE: + if (!xdr_nfs_fh3(xdrs, &objp->post_op_fh3_u.handle)) + return (FALSE); + break; + case FALSE: + break; + default: + return (FALSE); + } + return (TRUE); } bool_t xdr_time_how(register XDR *xdrs, time_how *objp) { - int enum_objp; - enum_objp = *objp; - if (!xdr_enum(xdrs, (enum_t *)objp)) - { - *objp = (time_how)enum_objp; - return (FALSE); - } - - return (TRUE); + int enum_objp; + enum_objp = *objp; + if (!xdr_enum(xdrs, (enum_t *)objp)) + { + *objp = (time_how)enum_objp; + return (FALSE); + } + + return (TRUE); } bool_t xdr_set_mode3(register XDR *xdrs, set_mode3 *objp) { - if (!xdr_bool(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case TRUE: - if (!xdr_mode3(xdrs, &objp->set_mode3_u.mode)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case TRUE: + if (!xdr_mode3(xdrs, &objp->set_mode3_u.mode)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_set_uid3(register XDR *xdrs, set_uid3 *objp) { - if (!xdr_bool(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case TRUE: - if (!xdr_uid3(xdrs, &objp->set_uid3_u.uid)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case TRUE: + if (!xdr_uid3(xdrs, &objp->set_uid3_u.uid)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_set_gid3(register XDR *xdrs, set_gid3 *objp) { - if (!xdr_bool(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case TRUE: - if (!xdr_gid3(xdrs, &objp->set_gid3_u.gid)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case TRUE: + if (!xdr_gid3(xdrs, &objp->set_gid3_u.gid)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_set_size3(register XDR *xdrs, set_size3 *objp) { - if (!xdr_bool(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case TRUE: - if (!xdr_size3(xdrs, &objp->set_size3_u.size)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case TRUE: + if (!xdr_size3(xdrs, &objp->set_size3_u.size)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_set_atime(register XDR *xdrs, set_atime *objp) { - if (!xdr_time_how(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case SET_TO_CLIENT_TIME: - if (!xdr_nfstime3(xdrs, &objp->set_atime_u.atime)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_time_how(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case SET_TO_CLIENT_TIME: + if (!xdr_nfstime3(xdrs, &objp->set_atime_u.atime)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_set_mtime(register XDR *xdrs, set_mtime *objp) { - if (!xdr_time_how(xdrs, &objp->set_it)) - return (FALSE); - switch (objp->set_it) { - case SET_TO_CLIENT_TIME: - if (!xdr_nfstime3(xdrs, &objp->set_mtime_u.mtime)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_time_how(xdrs, &objp->set_it)) + return (FALSE); + switch (objp->set_it) { + case SET_TO_CLIENT_TIME: + if (!xdr_nfstime3(xdrs, &objp->set_mtime_u.mtime)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_sattr3(register XDR *xdrs, sattr3 *objp) { - if (!xdr_set_mode3(xdrs, &objp->mode)) - return (FALSE); - if (!xdr_set_uid3(xdrs, &objp->uid)) - return (FALSE); - if (!xdr_set_gid3(xdrs, &objp->gid)) - return (FALSE); - if (!xdr_set_size3(xdrs, &objp->size)) - return (FALSE); - if (!xdr_set_atime(xdrs, &objp->atime)) - return (FALSE); - if (!xdr_set_mtime(xdrs, &objp->mtime)) - return (FALSE); - return (TRUE); + if (!xdr_set_mode3(xdrs, &objp->mode)) + return (FALSE); + if (!xdr_set_uid3(xdrs, &objp->uid)) + return (FALSE); + if (!xdr_set_gid3(xdrs, &objp->gid)) + return (FALSE); + if (!xdr_set_size3(xdrs, &objp->size)) + return (FALSE); + if (!xdr_set_atime(xdrs, &objp->atime)) + return (FALSE); + if (!xdr_set_mtime(xdrs, &objp->mtime)) + return (FALSE); + return (TRUE); } bool_t xdr_diropargs3(register XDR *xdrs, diropargs3 *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->dir)) - return (FALSE); - if (!xdr_filename3(xdrs, &objp->name)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->dir)) + return (FALSE); + if (!xdr_filename3(xdrs, &objp->name)) + return (FALSE); + return (TRUE); } bool_t xdr_GETATTR3args(register XDR *xdrs, GETATTR3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->object)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->object)) + return (FALSE); + return (TRUE); } bool_t xdr_GETATTR3resok(register XDR *xdrs, GETATTR3resok *objp) { - if (!xdr_fattr3(xdrs, &objp->obj_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_fattr3(xdrs, &objp->obj_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_GETATTR3res(register XDR *xdrs, GETATTR3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_GETATTR3resok(xdrs, &objp->GETATTR3res_u.resok)) - return (FALSE); - break; - default : - return (FALSE); - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_GETATTR3resok(xdrs, &objp->GETATTR3res_u.resok)) + return (FALSE); + break; + default : + return (FALSE); + } + return (TRUE); } bool_t xdr_sattrguard3(register XDR *xdrs, sattrguard3 *objp) { - if (!xdr_bool(xdrs, &objp->check)) - return (FALSE); - switch (objp->check) { - case TRUE: - if (!xdr_nfstime3(xdrs, &objp->sattrguard3_u.obj_ctime)) - return (FALSE); - break; - case FALSE: - break; - default: - return (FALSE); - } - return (TRUE); + if (!xdr_bool(xdrs, &objp->check)) + return (FALSE); + switch (objp->check) { + case TRUE: + if (!xdr_nfstime3(xdrs, &objp->sattrguard3_u.obj_ctime)) + return (FALSE); + break; + case FALSE: + break; + default: + return (FALSE); + } + return (TRUE); } bool_t xdr_SETATTR3args(register XDR *xdrs, SETATTR3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->object)) - return (FALSE); - if (!xdr_sattr3(xdrs, &objp->new_attributes)) - return (FALSE); - if (!xdr_sattrguard3(xdrs, &objp->guard)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->object)) + return (FALSE); + if (!xdr_sattr3(xdrs, &objp->new_attributes)) + return (FALSE); + if (!xdr_sattrguard3(xdrs, &objp->guard)) + return (FALSE); + return (TRUE); } bool_t xdr_SETATTR3resok(register XDR *xdrs, SETATTR3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->obj_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->obj_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_SETATTR3resfail(register XDR *xdrs, SETATTR3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->obj_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->obj_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_SETATTR3res(register XDR *xdrs, SETATTR3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_SETATTR3resok(xdrs, &objp->SETATTR3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_SETATTR3resfail(xdrs, &objp->SETATTR3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_SETATTR3resok(xdrs, &objp->SETATTR3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_SETATTR3resfail(xdrs, &objp->SETATTR3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_LOOKUP3args(register XDR *xdrs, LOOKUP3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->what)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->what)) + return (FALSE); + return (TRUE); } bool_t xdr_LOOKUP3resok(register XDR *xdrs, LOOKUP3resok *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->object)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->object)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_LOOKUP3resfail(register XDR *xdrs, LOOKUP3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_LOOKUP3res(register XDR *xdrs, LOOKUP3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_LOOKUP3resok(xdrs, &objp->LOOKUP3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_LOOKUP3resfail(xdrs, &objp->LOOKUP3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_LOOKUP3resok(xdrs, &objp->LOOKUP3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_LOOKUP3resfail(xdrs, &objp->LOOKUP3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_ACCESS3args(register XDR *xdrs, ACCESS3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->object)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->access)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->object)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->access)) + return (FALSE); + return (TRUE); } bool_t xdr_ACCESS3resok(register XDR *xdrs, ACCESS3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->access)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->access)) + return (FALSE); + return (TRUE); } bool_t xdr_ACCESS3resfail(register XDR *xdrs, ACCESS3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_ACCESS3res(register XDR *xdrs, ACCESS3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_ACCESS3resok(xdrs, &objp->ACCESS3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_ACCESS3resfail(xdrs, &objp->ACCESS3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_ACCESS3resok(xdrs, &objp->ACCESS3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_ACCESS3resfail(xdrs, &objp->ACCESS3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_READLINK3args(register XDR *xdrs, READLINK3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->symlink)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->symlink)) + return (FALSE); + return (TRUE); } bool_t xdr_READLINK3resok(register XDR *xdrs, READLINK3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes)) - return (FALSE); - if (!xdr_nfspath3(xdrs, &objp->data)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes)) + return (FALSE); + if (!xdr_nfspath3(xdrs, &objp->data)) + return (FALSE); + return (TRUE); } bool_t xdr_READLINK3resfail(register XDR *xdrs, READLINK3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->symlink_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_READLINK3res(register XDR *xdrs, READLINK3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_READLINK3resok(xdrs, &objp->READLINK3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_READLINK3resfail(xdrs, &objp->READLINK3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_READLINK3resok(xdrs, &objp->READLINK3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_READLINK3resfail(xdrs, &objp->READLINK3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_READ3args(register XDR *xdrs, READ3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->file)) - return (FALSE); - if (!xdr_offset3(xdrs, &objp->offset)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->file)) + return (FALSE); + if (!xdr_offset3(xdrs, &objp->offset)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + return (TRUE); } bool_t xdr_READ3resok(register XDR *xdrs, READ3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->eof)) - return (FALSE); - if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, ~0)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->eof)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, ~0)) + return (FALSE); + return (TRUE); } bool_t xdr_READ3resfail(register XDR *xdrs, READ3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_READ3res(register XDR *xdrs, READ3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_READ3resok(xdrs, &objp->READ3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_READ3resfail(xdrs, &objp->READ3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_READ3resok(xdrs, &objp->READ3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_READ3resfail(xdrs, &objp->READ3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_WRITE3args(register XDR *xdrs, WRITE3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->file)) - return (FALSE); - if (!xdr_offset3(xdrs, &objp->offset)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - if (!xdr_stable_how(xdrs, &objp->stable)) - return (FALSE); - if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, ~0)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->file)) + return (FALSE); + if (!xdr_offset3(xdrs, &objp->offset)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + if (!xdr_stable_how(xdrs, &objp->stable)) + return (FALSE); + if (!xdr_bytes(xdrs, (char **)&objp->data.data_val, (unsigned int *) &objp->data.data_len, ~0)) + return (FALSE); + return (TRUE); } bool_t xdr_WRITE3resok(register XDR *xdrs, WRITE3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->file_wcc)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - if (!xdr_stable_how(xdrs, &objp->committed)) - return (FALSE); - if (!xdr_writeverf3(xdrs, objp->verf)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->file_wcc)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + if (!xdr_stable_how(xdrs, &objp->committed)) + return (FALSE); + if (!xdr_writeverf3(xdrs, objp->verf)) + return (FALSE); + return (TRUE); } bool_t xdr_WRITE3resfail(register XDR *xdrs, WRITE3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->file_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->file_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_WRITE3res(register XDR *xdrs, WRITE3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_WRITE3resok(xdrs, &objp->WRITE3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_WRITE3resfail(xdrs, &objp->WRITE3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_WRITE3resok(xdrs, &objp->WRITE3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_WRITE3resfail(xdrs, &objp->WRITE3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_createhow3(register XDR *xdrs, createhow3 *objp) { - if (!xdr_createmode3(xdrs, &objp->mode)) - return (FALSE); - switch (objp->mode) { - case UNCHECKED: - case GUARDED: - if (!xdr_sattr3(xdrs, &objp->createhow3_u.obj_attributes)) - return (FALSE); - break; - case EXCLUSIVE: - if (!xdr_createverf3(xdrs, objp->createhow3_u.verf)) - return (FALSE); - break; - default: - return (FALSE); - } - return (TRUE); + if (!xdr_createmode3(xdrs, &objp->mode)) + return (FALSE); + switch (objp->mode) { + case UNCHECKED: + case GUARDED: + if (!xdr_sattr3(xdrs, &objp->createhow3_u.obj_attributes)) + return (FALSE); + break; + case EXCLUSIVE: + if (!xdr_createverf3(xdrs, objp->createhow3_u.verf)) + return (FALSE); + break; + default: + return (FALSE); + } + return (TRUE); } bool_t xdr_CREATE3args(register XDR *xdrs, CREATE3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->where)) - return (FALSE); - if (!xdr_createhow3(xdrs, &objp->how)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->where)) + return (FALSE); + if (!xdr_createhow3(xdrs, &objp->how)) + return (FALSE); + return (TRUE); } bool_t xdr_CREATE3resok(register XDR *xdrs, CREATE3resok *objp) { - if (!xdr_post_op_fh3(xdrs, &objp->obj)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_fh3(xdrs, &objp->obj)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_CREATE3resfail(register XDR *xdrs, CREATE3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_CREATE3res(register XDR *xdrs, CREATE3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_CREATE3resok(xdrs, &objp->CREATE3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_CREATE3resfail(xdrs, &objp->CREATE3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_CREATE3resok(xdrs, &objp->CREATE3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_CREATE3resfail(xdrs, &objp->CREATE3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_MKDIR3args(register XDR *xdrs, MKDIR3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->where)) - return (FALSE); - if (!xdr_sattr3(xdrs, &objp->attributes)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->where)) + return (FALSE); + if (!xdr_sattr3(xdrs, &objp->attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_MKDIR3resok(register XDR *xdrs, MKDIR3resok *objp) { - if (!xdr_post_op_fh3(xdrs, &objp->obj)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_fh3(xdrs, &objp->obj)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_MKDIR3resfail(register XDR *xdrs, MKDIR3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_MKDIR3res(register XDR *xdrs, MKDIR3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_MKDIR3resok(xdrs, &objp->MKDIR3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_MKDIR3resfail(xdrs, &objp->MKDIR3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_MKDIR3resok(xdrs, &objp->MKDIR3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_MKDIR3resfail(xdrs, &objp->MKDIR3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_symlinkdata3(register XDR *xdrs, symlinkdata3 *objp) { - if (!xdr_sattr3(xdrs, &objp->symlink_attributes)) - return (FALSE); - if (!xdr_nfspath3(xdrs, &objp->symlink_data)) - return (FALSE); - return (TRUE); + if (!xdr_sattr3(xdrs, &objp->symlink_attributes)) + return (FALSE); + if (!xdr_nfspath3(xdrs, &objp->symlink_data)) + return (FALSE); + return (TRUE); } bool_t xdr_SYMLINK3args(register XDR *xdrs, SYMLINK3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->where)) - return (FALSE); - if (!xdr_symlinkdata3(xdrs, &objp->symlink)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->where)) + return (FALSE); + if (!xdr_symlinkdata3(xdrs, &objp->symlink)) + return (FALSE); + return (TRUE); } bool_t xdr_SYMLINK3resok(register XDR *xdrs, SYMLINK3resok *objp) { - if (!xdr_post_op_fh3(xdrs, &objp->obj)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_fh3(xdrs, &objp->obj)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_SYMLINK3resfail(register XDR *xdrs, SYMLINK3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_SYMLINK3res(register XDR *xdrs, SYMLINK3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_SYMLINK3resok(xdrs, &objp->SYMLINK3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_SYMLINK3resfail(xdrs, &objp->SYMLINK3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_SYMLINK3resok(xdrs, &objp->SYMLINK3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_SYMLINK3resfail(xdrs, &objp->SYMLINK3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_devicedata3(register XDR *xdrs, devicedata3 *objp) { - if (!xdr_sattr3(xdrs, &objp->dev_attributes)) - return (FALSE); - if (!xdr_specdata3(xdrs, &objp->spec)) - return (FALSE); - return (TRUE); + if (!xdr_sattr3(xdrs, &objp->dev_attributes)) + return (FALSE); + if (!xdr_specdata3(xdrs, &objp->spec)) + return (FALSE); + return (TRUE); } bool_t xdr_mknoddata3(register XDR *xdrs, mknoddata3 *objp) { - if (!xdr_ftype3(xdrs, &objp->type)) - return (FALSE); - switch (objp->type) { - case NFS3CHR: - case NFS3BLK: - if (!xdr_devicedata3(xdrs, &objp->mknoddata3_u.device)) - return (FALSE); - break; - case NFS3SOCK: - case NFS3FIFO: - if (!xdr_sattr3(xdrs, &objp->mknoddata3_u.pipe_attributes)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_ftype3(xdrs, &objp->type)) + return (FALSE); + switch (objp->type) { + case NFS3CHR: + case NFS3BLK: + if (!xdr_devicedata3(xdrs, &objp->mknoddata3_u.device)) + return (FALSE); + break; + case NFS3SOCK: + case NFS3FIFO: + if (!xdr_sattr3(xdrs, &objp->mknoddata3_u.pipe_attributes)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_MKNOD3args(register XDR *xdrs, MKNOD3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->where)) - return (FALSE); - if (!xdr_mknoddata3(xdrs, &objp->what)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->where)) + return (FALSE); + if (!xdr_mknoddata3(xdrs, &objp->what)) + return (FALSE); + return (TRUE); } bool_t xdr_MKNOD3resok(register XDR *xdrs, MKNOD3resok *objp) { - if (!xdr_post_op_fh3(xdrs, &objp->obj)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_fh3(xdrs, &objp->obj)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_MKNOD3resfail(register XDR *xdrs, MKNOD3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_MKNOD3res(register XDR *xdrs, MKNOD3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_MKNOD3resok(xdrs, &objp->MKNOD3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_MKNOD3resfail(xdrs, &objp->MKNOD3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_MKNOD3resok(xdrs, &objp->MKNOD3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_MKNOD3resfail(xdrs, &objp->MKNOD3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_REMOVE3args(register XDR *xdrs, REMOVE3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->object)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->object)) + return (FALSE); + return (TRUE); } bool_t xdr_REMOVE3resok(register XDR *xdrs, REMOVE3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_REMOVE3resfail(register XDR *xdrs, REMOVE3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_REMOVE3res(register XDR *xdrs, REMOVE3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_REMOVE3resok(xdrs, &objp->REMOVE3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_REMOVE3resfail(xdrs, &objp->REMOVE3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_REMOVE3resok(xdrs, &objp->REMOVE3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_REMOVE3resfail(xdrs, &objp->REMOVE3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_RMDIR3args(register XDR *xdrs, RMDIR3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->object)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->object)) + return (FALSE); + return (TRUE); } bool_t xdr_RMDIR3resok(register XDR *xdrs, RMDIR3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_RMDIR3resfail(register XDR *xdrs, RMDIR3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->dir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_RMDIR3res(register XDR *xdrs, RMDIR3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_RMDIR3resok(xdrs, &objp->RMDIR3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_RMDIR3resfail(xdrs, &objp->RMDIR3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_RMDIR3resok(xdrs, &objp->RMDIR3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_RMDIR3resfail(xdrs, &objp->RMDIR3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_RENAME3args(register XDR *xdrs, RENAME3args *objp) { - if (!xdr_diropargs3(xdrs, &objp->from)) - return (FALSE); - if (!xdr_diropargs3(xdrs, &objp->to)) - return (FALSE); - return (TRUE); + if (!xdr_diropargs3(xdrs, &objp->from)) + return (FALSE); + if (!xdr_diropargs3(xdrs, &objp->to)) + return (FALSE); + return (TRUE); } bool_t xdr_RENAME3resok(register XDR *xdrs, RENAME3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->todir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->todir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_RENAME3resfail(register XDR *xdrs, RENAME3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->todir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->fromdir_wcc)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->todir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_RENAME3res(register XDR *xdrs, RENAME3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_RENAME3resok(xdrs, &objp->RENAME3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_RENAME3resfail(xdrs, &objp->RENAME3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_RENAME3resok(xdrs, &objp->RENAME3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_RENAME3resfail(xdrs, &objp->RENAME3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_LINK3args(register XDR *xdrs, LINK3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->file)) - return (FALSE); - if (!xdr_diropargs3(xdrs, &objp->link)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->file)) + return (FALSE); + if (!xdr_diropargs3(xdrs, &objp->link)) + return (FALSE); + return (TRUE); } bool_t xdr_LINK3resok(register XDR *xdrs, LINK3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_LINK3resfail(register XDR *xdrs, LINK3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) - return (FALSE); - if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->file_attributes)) + return (FALSE); + if (!xdr_wcc_data(xdrs, &objp->linkdir_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_LINK3res(register XDR *xdrs, LINK3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_LINK3resok(xdrs, &objp->LINK3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_LINK3resfail(xdrs, &objp->LINK3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_LINK3resok(xdrs, &objp->LINK3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_LINK3resfail(xdrs, &objp->LINK3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_READDIR3args(register XDR *xdrs, READDIR3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->dir)) - return (FALSE); - if (!xdr_cookie3(xdrs, &objp->cookie)) - return (FALSE); - if (!xdr_cookieverf3(xdrs, objp->cookieverf)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->dir)) + return (FALSE); + if (!xdr_cookie3(xdrs, &objp->cookie)) + return (FALSE); + if (!xdr_cookieverf3(xdrs, objp->cookieverf)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + return (TRUE); } bool_t xdr_entry3(register XDR *xdrs, entry3 *objp) { - if (!xdr_fileid3(xdrs, &objp->fileid)) - return (FALSE); - if (!xdr_filename3(xdrs, &objp->name)) - return (FALSE); - if (!xdr_cookie3(xdrs, &objp->cookie)) - return (FALSE); - if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof (entry3), (xdrproc_t) xdr_entry3)) - return (FALSE); - return (TRUE); + if (!xdr_fileid3(xdrs, &objp->fileid)) + return (FALSE); + if (!xdr_filename3(xdrs, &objp->name)) + return (FALSE); + if (!xdr_cookie3(xdrs, &objp->cookie)) + return (FALSE); + if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof (entry3), (xdrproc_t) xdr_entry3)) + return (FALSE); + return (TRUE); } bool_t xdr_dirlist3(register XDR *xdrs, dirlist3 *objp) { - if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entry3), (xdrproc_t) xdr_entry3)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->eof)) - return (FALSE); - return (TRUE); + if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entry3), (xdrproc_t) xdr_entry3)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->eof)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIR3resok(register XDR *xdrs, READDIR3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - if (!xdr_cookieverf3(xdrs, objp->cookieverf)) - return (FALSE); - if (!xdr_dirlist3(xdrs, &objp->reply)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + if (!xdr_cookieverf3(xdrs, objp->cookieverf)) + return (FALSE); + if (!xdr_dirlist3(xdrs, &objp->reply)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIR3resfail(register XDR *xdrs, READDIR3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIR3res(register XDR *xdrs, READDIR3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_READDIR3resok(xdrs, &objp->READDIR3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_READDIR3resfail(xdrs, &objp->READDIR3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_READDIR3resok(xdrs, &objp->READDIR3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_READDIR3resfail(xdrs, &objp->READDIR3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_READDIRPLUS3args(register XDR *xdrs, READDIRPLUS3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->dir)) - return (FALSE); - if (!xdr_cookie3(xdrs, &objp->cookie)) - return (FALSE); - if (!xdr_cookieverf3(xdrs, objp->cookieverf)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->dircount)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->maxcount)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->dir)) + return (FALSE); + if (!xdr_cookie3(xdrs, &objp->cookie)) + return (FALSE); + if (!xdr_cookieverf3(xdrs, objp->cookieverf)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->dircount)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->maxcount)) + return (FALSE); + return (TRUE); } bool_t xdr_entryplus3(register XDR *xdrs, entryplus3 *objp) { - if (!xdr_fileid3(xdrs, &objp->fileid)) - return (FALSE); - if (!xdr_filename3(xdrs, &objp->name)) - return (FALSE); - if (!xdr_cookie3(xdrs, &objp->cookie)) - return (FALSE); - if (!xdr_post_op_attr(xdrs, &objp->name_attributes)) - return (FALSE); - if (!xdr_post_op_fh3(xdrs, &objp->name_handle)) - return (FALSE); - if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof (entryplus3), (xdrproc_t) xdr_entryplus3)) - return (FALSE); - return (TRUE); + if (!xdr_fileid3(xdrs, &objp->fileid)) + return (FALSE); + if (!xdr_filename3(xdrs, &objp->name)) + return (FALSE); + if (!xdr_cookie3(xdrs, &objp->cookie)) + return (FALSE); + if (!xdr_post_op_attr(xdrs, &objp->name_attributes)) + return (FALSE); + if (!xdr_post_op_fh3(xdrs, &objp->name_handle)) + return (FALSE); + if (!xdr_pointer(xdrs, (char **)&objp->nextentry, sizeof (entryplus3), (xdrproc_t) xdr_entryplus3)) + return (FALSE); + return (TRUE); } bool_t xdr_dirlistplus3(register XDR *xdrs, dirlistplus3 *objp) { - if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entryplus3), (xdrproc_t) xdr_entryplus3)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->eof)) - return (FALSE); - return (TRUE); + if (!xdr_pointer(xdrs, (char **)&objp->entries, sizeof (entryplus3), (xdrproc_t) xdr_entryplus3)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->eof)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIRPLUS3resok(register XDR *xdrs, READDIRPLUS3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - if (!xdr_cookieverf3(xdrs, objp->cookieverf)) - return (FALSE); - if (!xdr_dirlistplus3(xdrs, &objp->reply)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + if (!xdr_cookieverf3(xdrs, objp->cookieverf)) + return (FALSE); + if (!xdr_dirlistplus3(xdrs, &objp->reply)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIRPLUS3resfail(register XDR *xdrs, READDIRPLUS3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->dir_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_READDIRPLUS3res(register XDR *xdrs, READDIRPLUS3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_READDIRPLUS3resok(xdrs, &objp->READDIRPLUS3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_READDIRPLUS3resfail(xdrs, &objp->READDIRPLUS3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_READDIRPLUS3resok(xdrs, &objp->READDIRPLUS3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_READDIRPLUS3resfail(xdrs, &objp->READDIRPLUS3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_FSSTAT3args(register XDR *xdrs, FSSTAT3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->fsroot)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->fsroot)) + return (FALSE); + return (TRUE); } bool_t xdr_FSSTAT3resok(register XDR *xdrs, FSSTAT3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->tbytes)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->fbytes)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->abytes)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->tfiles)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->ffiles)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->afiles)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->invarsec)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->tbytes)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->fbytes)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->abytes)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->tfiles)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->ffiles)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->afiles)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->invarsec)) + return (FALSE); + return (TRUE); } bool_t xdr_FSSTAT3resfail(register XDR *xdrs, FSSTAT3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_FSSTAT3res(register XDR *xdrs, FSSTAT3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_FSSTAT3resok(xdrs, &objp->FSSTAT3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_FSSTAT3resfail(xdrs, &objp->FSSTAT3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_FSSTAT3resok(xdrs, &objp->FSSTAT3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_FSSTAT3resfail(xdrs, &objp->FSSTAT3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_FSINFO3args(register XDR *xdrs, FSINFO3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->fsroot)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->fsroot)) + return (FALSE); + return (TRUE); } bool_t xdr_FSINFO3resok(register XDR *xdrs, FSINFO3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->rtmax)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->rtpref)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->rtmult)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->wtmax)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->wtpref)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->wtmult)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->dtpref)) - return (FALSE); - if (!xdr_size3(xdrs, &objp->maxfilesize)) - return (FALSE); - if (!xdr_nfstime3(xdrs, &objp->time_delta)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->properties)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->rtmax)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->rtpref)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->rtmult)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->wtmax)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->wtpref)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->wtmult)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->dtpref)) + return (FALSE); + if (!xdr_size3(xdrs, &objp->maxfilesize)) + return (FALSE); + if (!xdr_nfstime3(xdrs, &objp->time_delta)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->properties)) + return (FALSE); + return (TRUE); } bool_t xdr_FSINFO3resfail(register XDR *xdrs, FSINFO3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_FSINFO3res(register XDR *xdrs, FSINFO3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_FSINFO3resok(xdrs, &objp->FSINFO3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_FSINFO3resfail(xdrs, &objp->FSINFO3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_FSINFO3resok(xdrs, &objp->FSINFO3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_FSINFO3resfail(xdrs, &objp->FSINFO3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_PATHCONF3args(register XDR *xdrs, PATHCONF3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->object)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->object)) + return (FALSE); + return (TRUE); } bool_t xdr_PATHCONF3resok(register XDR *xdrs, PATHCONF3resok *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->linkmax)) - return (FALSE); - if (!xdr_uint32(xdrs, &objp->name_max)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->no_trunc)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->chown_restricted)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->case_insensitive)) - return (FALSE); - if (!xdr_bool(xdrs, &objp->case_preserving)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->linkmax)) + return (FALSE); + if (!xdr_uint32(xdrs, &objp->name_max)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->no_trunc)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->chown_restricted)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->case_insensitive)) + return (FALSE); + if (!xdr_bool(xdrs, &objp->case_preserving)) + return (FALSE); + return (TRUE); } bool_t xdr_PATHCONF3resfail(register XDR *xdrs, PATHCONF3resfail *objp) { - if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) - return (FALSE); - return (TRUE); + if (!xdr_post_op_attr(xdrs, &objp->obj_attributes)) + return (FALSE); + return (TRUE); } bool_t xdr_PATHCONF3res(register XDR *xdrs, PATHCONF3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_PATHCONF3resok(xdrs, &objp->PATHCONF3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_PATHCONF3resfail(xdrs, &objp->PATHCONF3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_PATHCONF3resok(xdrs, &objp->PATHCONF3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_PATHCONF3resfail(xdrs, &objp->PATHCONF3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } bool_t xdr_COMMIT3args(register XDR *xdrs, COMMIT3args *objp) { - if (!xdr_nfs_fh3(xdrs, &objp->file)) - return (FALSE); - if (!xdr_offset3(xdrs, &objp->offset)) - return (FALSE); - if (!xdr_count3(xdrs, &objp->count)) - return (FALSE); - return (TRUE); + if (!xdr_nfs_fh3(xdrs, &objp->file)) + return (FALSE); + if (!xdr_offset3(xdrs, &objp->offset)) + return (FALSE); + if (!xdr_count3(xdrs, &objp->count)) + return (FALSE); + return (TRUE); } bool_t xdr_COMMIT3resok(register XDR *xdrs, COMMIT3resok *objp) { - if (!xdr_wcc_data(xdrs, &objp->file_wcc)) - return (FALSE); - if (!xdr_writeverf3(xdrs, objp->verf)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->file_wcc)) + return (FALSE); + if (!xdr_writeverf3(xdrs, objp->verf)) + return (FALSE); + return (TRUE); } bool_t xdr_COMMIT3resfail(register XDR *xdrs, COMMIT3resfail *objp) { - if (!xdr_wcc_data(xdrs, &objp->file_wcc)) - return (FALSE); - return (TRUE); + if (!xdr_wcc_data(xdrs, &objp->file_wcc)) + return (FALSE); + return (TRUE); } bool_t xdr_COMMIT3res(register XDR *xdrs, COMMIT3res *objp) { - if (!xdr_nfsstat3(xdrs, &objp->status)) - return (FALSE); - switch (objp->status) { - case NFS3_OK: - if (!xdr_COMMIT3resok(xdrs, &objp->COMMIT3res_u.resok)) - return (FALSE); - break; - default: - if (!xdr_COMMIT3resfail(xdrs, &objp->COMMIT3res_u.resfail)) - return (FALSE); - break; - } - return (TRUE); + if (!xdr_nfsstat3(xdrs, &objp->status)) + return (FALSE); + switch (objp->status) { + case NFS3_OK: + if (!xdr_COMMIT3resok(xdrs, &objp->COMMIT3res_u.resok)) + return (FALSE); + break; + default: + if (!xdr_COMMIT3resfail(xdrs, &objp->COMMIT3res_u.resfail)) + return (FALSE); + break; + } + return (TRUE); } diff --git a/components/dfs/filesystems/nfs/rpc/auth.h b/components/dfs/filesystems/nfs/rpc/auth.h index f7dd76c23..0dc947a88 100644 --- a/components/dfs/filesystems/nfs/rpc/auth.h +++ b/components/dfs/filesystems/nfs/rpc/auth.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,28 +15,28 @@ * Status returned from authentication check */ enum auth_stat { - AUTH_OK=0, - /* - * failed at remote end - */ - AUTH_BADCRED=1, /* bogus credentials (seal broken) */ - AUTH_REJECTEDCRED=2, /* client should begin new session */ - AUTH_BADVERF=3, /* bogus verifier (seal broken) */ - AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ - AUTH_TOOWEAK=5, /* rejected due to security reasons */ - /* - * failed locally - */ - AUTH_INVALIDRESP=6, /* bogus response verifier */ - AUTH_FAILED=7 /* some unknown reason */ + AUTH_OK=0, + /* + * failed at remote end + */ + AUTH_BADCRED=1, /* bogus credentials (seal broken) */ + AUTH_REJECTEDCRED=2, /* client should begin new session */ + AUTH_BADVERF=3, /* bogus verifier (seal broken) */ + AUTH_REJECTEDVERF=4, /* verifier expired or was replayed */ + AUTH_TOOWEAK=5, /* rejected due to security reasons */ + /* + * failed locally + */ + AUTH_INVALIDRESP=6, /* bogus response verifier */ + AUTH_FAILED=7 /* some unknown reason */ }; union des_block { - struct { - uint32_t high; - uint32_t low; - } key; - char c[8]; + struct { + uint32_t high; + uint32_t low; + } key; + char c[8]; }; typedef union des_block des_block; @@ -44,9 +44,9 @@ typedef union des_block des_block; * Authentication info. Opaque to client. */ struct opaque_auth { - enum_t oa_flavor; /* flavor of auth */ - char* oa_base; /* address of more auth stuff */ - unsigned int oa_length; /* not to exceed MAX_AUTH_BYTES */ + enum_t oa_flavor; /* flavor of auth */ + char* oa_base; /* address of more auth stuff */ + unsigned int oa_length; /* not to exceed MAX_AUTH_BYTES */ }; /* @@ -59,11 +59,11 @@ struct AUTH { union des_block ah_key; struct auth_ops { void (*ah_nextverf) (AUTH *); - int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */ + int (*ah_marshal) (AUTH *, XDR *); /* nextverf & serialize */ int (*ah_validate) (AUTH *, struct opaque_auth *); - /* validate verifier */ - int (*ah_refresh) (AUTH *); /* refresh credentials */ - void (*ah_destroy) (AUTH *); /* destroy this structure */ + /* validate verifier */ + int (*ah_refresh) (AUTH *); /* refresh credentials */ + void (*ah_destroy) (AUTH *); /* destroy this structure */ } *ah_ops; char* ah_private; }; @@ -75,37 +75,37 @@ extern struct opaque_auth _null_auth; * Authentication ops. * The ops and the auth handle provide the interface to the authenticators. * - * AUTH *auth; - * XDR *xdrs; + * AUTH *auth; + * XDR *xdrs; * struct opaque_auth verf; */ -#define AUTH_NEXTVERF(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define auth_nextverf(auth) \ - ((*((auth)->ah_ops->ah_nextverf))(auth)) +#define AUTH_NEXTVERF(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) +#define auth_nextverf(auth) \ + ((*((auth)->ah_ops->ah_nextverf))(auth)) -#define AUTH_MARSHALL(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define auth_marshall(auth, xdrs) \ - ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) +#define AUTH_MARSHALL(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) +#define auth_marshall(auth, xdrs) \ + ((*((auth)->ah_ops->ah_marshal))(auth, xdrs)) -#define AUTH_VALIDATE(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define auth_validate(auth, verfp) \ - ((*((auth)->ah_ops->ah_validate))((auth), verfp)) +#define AUTH_VALIDATE(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) +#define auth_validate(auth, verfp) \ + ((*((auth)->ah_ops->ah_validate))((auth), verfp)) -#define AUTH_REFRESH(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) -#define auth_refresh(auth) \ - ((*((auth)->ah_ops->ah_refresh))(auth)) +#define AUTH_REFRESH(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) +#define auth_refresh(auth) \ + ((*((auth)->ah_ops->ah_refresh))(auth)) -#define AUTH_DESTROY(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) -#define auth_destroy(auth) \ - ((*((auth)->ah_ops->ah_destroy))(auth)) +#define AUTH_DESTROY(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) +#define auth_destroy(auth) \ + ((*((auth)->ah_ops->ah_destroy))(auth)) -#define MAX_AUTH_BYTES 400 -#define MAXNETNAMELEN 255 /* maximum length of network user's name */ +#define MAX_AUTH_BYTES 400 +#define MAXNETNAMELEN 255 /* maximum length of network user's name */ AUTH *authnone_create(void); diff --git a/components/dfs/filesystems/nfs/rpc/auth_none.c b/components/dfs/filesystems/nfs/rpc/auth_none.c index 9f5ad0500..7e22e7d86 100644 --- a/components/dfs/filesystems/nfs/rpc/auth_none.c +++ b/components/dfs/filesystems/nfs/rpc/auth_none.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC */ +/* @(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -14,23 +14,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -38,15 +38,15 @@ #if !defined(lint) && defined(SCCSIDS) static char sccsid[] = - "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro"; + "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro"; #endif /* * auth_none.c - * Creates a client authentication handle for passing "null" - * credentials and verifiers to remote systems. - * - * Copyright (C) 1984, Sun Microsystems, Inc. + * Creates a client authentication handle for passing "null" + * credentials and verifiers to remote systems. + * + * Copyright (C) 1984, Sun Microsystems, Inc. */ #include @@ -63,55 +63,55 @@ static bool_t authnone_marshal(AUTH *client, XDR *xdrs); struct opaque_auth _null_auth; static struct auth_ops ops = { - authnone_verf, - authnone_marshal, - authnone_validate, - authnone_refresh, - authnone_destroy + authnone_verf, + authnone_marshal, + authnone_validate, + authnone_refresh, + authnone_destroy }; static struct authnone_private { - AUTH no_client; - char marshalled_client[MAX_MARSHEL_SIZE]; - unsigned int mcnt; + AUTH no_client; + char marshalled_client[MAX_MARSHEL_SIZE]; + unsigned int mcnt; } *authnone_private; AUTH *authnone_create() { - register struct authnone_private *ap = authnone_private; - XDR xdr_stream; - register XDR *xdrs; + register struct authnone_private *ap = authnone_private; + XDR xdr_stream; + register XDR *xdrs; extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap); - if (ap == 0) { - ap = (struct authnone_private *) rt_malloc (sizeof(*ap)); - if (ap == 0) return NULL; - memset(ap, 0, sizeof(*ap)); - authnone_private = ap; - } - if (!ap->mcnt) { - ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; - ap->no_client.ah_ops = &ops; - xdrs = &xdr_stream; - xdrmem_create(xdrs, ap->marshalled_client, - (unsigned int) MAX_MARSHEL_SIZE, XDR_ENCODE); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); - (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); - ap->mcnt = XDR_GETPOS(xdrs); - XDR_DESTROY(xdrs); - } - return (&ap->no_client); + if (ap == 0) { + ap = (struct authnone_private *) rt_malloc (sizeof(*ap)); + if (ap == 0) return NULL; + memset(ap, 0, sizeof(*ap)); + authnone_private = ap; + } + if (!ap->mcnt) { + ap->no_client.ah_cred = ap->no_client.ah_verf = _null_auth; + ap->no_client.ah_ops = &ops; + xdrs = &xdr_stream; + xdrmem_create(xdrs, ap->marshalled_client, + (unsigned int) MAX_MARSHEL_SIZE, XDR_ENCODE); + (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_cred); + (void) xdr_opaque_auth(xdrs, &ap->no_client.ah_verf); + ap->mcnt = XDR_GETPOS(xdrs); + XDR_DESTROY(xdrs); + } + return (&ap->no_client); } -/*ARGSUSED*/ +/*ARGSUSED*/ static bool_t authnone_marshal(AUTH *client, XDR *xdrs) { - register struct authnone_private *ap = authnone_private; + register struct authnone_private *ap = authnone_private; - if (ap == 0) - return (0); - return ((*xdrs->x_ops->x_putbytes) (xdrs, - ap->marshalled_client, ap->mcnt)); + if (ap == 0) + return (0); + return ((*xdrs->x_ops->x_putbytes) (xdrs, + ap->marshalled_client, ap->mcnt)); } static void authnone_verf(AUTH *x) @@ -121,13 +121,13 @@ static void authnone_verf(AUTH *x) static bool_t authnone_validate(AUTH *x, struct opaque_auth *x1) { - return (TRUE); + return (TRUE); } static bool_t authnone_refresh(AUTH *x) { - return (FALSE); + return (FALSE); } static void authnone_destroy(AUTH *x) diff --git a/components/dfs/filesystems/nfs/rpc/clnt.h b/components/dfs/filesystems/nfs/rpc/clnt.h index e86f8be78..1d27dee35 100644 --- a/components/dfs/filesystems/nfs/rpc/clnt.h +++ b/components/dfs/filesystems/nfs/rpc/clnt.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ +/* @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC; from 1.31 88/02/08 SMI*/ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -43,7 +43,7 @@ */ #ifndef _RPC_CLNT_H -#define _RPC_CLNT_H 1 +#define _RPC_CLNT_H 1 #include #include @@ -55,47 +55,47 @@ * independent) list of errors. */ enum clnt_stat { - RPC_SUCCESS=0, /* call succeeded */ - /* - * local errors - */ - RPC_CANTENCODEARGS=1, /* can't encode arguments */ - RPC_CANTDECODERES=2, /* can't decode results */ - RPC_CANTSEND=3, /* failure in sending call */ - RPC_CANTRECV=4, /* failure in receiving result */ - RPC_TIMEDOUT=5, /* call timed out */ - /* - * remote errors - */ - RPC_VERSMISMATCH=6, /* rpc versions not compatible */ - RPC_AUTHERROR=7, /* authentication error */ - RPC_PROGUNAVAIL=8, /* program not available */ - RPC_PROGVERSMISMATCH=9, /* program version mismatched */ - RPC_PROCUNAVAIL=10, /* procedure unavailable */ - RPC_CANTDECODEARGS=11, /* decode arguments error */ - RPC_SYSTEMERROR=12, /* generic "other problem" */ - RPC_NOBROADCAST = 21, /* Broadcasting not supported */ - /* - * callrpc & clnt_create errors - */ - RPC_UNKNOWNHOST=13, /* unknown host name */ - RPC_UNKNOWNPROTO=17, /* unknown protocol */ - RPC_UNKNOWNADDR = 19, /* Remote address unknown */ + RPC_SUCCESS=0, /* call succeeded */ + /* + * local errors + */ + RPC_CANTENCODEARGS=1, /* can't encode arguments */ + RPC_CANTDECODERES=2, /* can't decode results */ + RPC_CANTSEND=3, /* failure in sending call */ + RPC_CANTRECV=4, /* failure in receiving result */ + RPC_TIMEDOUT=5, /* call timed out */ + /* + * remote errors + */ + RPC_VERSMISMATCH=6, /* rpc versions not compatible */ + RPC_AUTHERROR=7, /* authentication error */ + RPC_PROGUNAVAIL=8, /* program not available */ + RPC_PROGVERSMISMATCH=9, /* program version mismatched */ + RPC_PROCUNAVAIL=10, /* procedure unavailable */ + RPC_CANTDECODEARGS=11, /* decode arguments error */ + RPC_SYSTEMERROR=12, /* generic "other problem" */ + RPC_NOBROADCAST = 21, /* Broadcasting not supported */ + /* + * callrpc & clnt_create errors + */ + RPC_UNKNOWNHOST=13, /* unknown host name */ + RPC_UNKNOWNPROTO=17, /* unknown protocol */ + RPC_UNKNOWNADDR = 19, /* Remote address unknown */ - /* - * rpcbind errors - */ - RPC_RPCBFAILURE=14, /* portmapper failed in its call */ + /* + * rpcbind errors + */ + RPC_RPCBFAILURE=14, /* portmapper failed in its call */ #define RPC_PMAPFAILURE RPC_RPCBFAILURE - RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ - RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */ - /* - * unspecified error - */ - RPC_FAILED=16, - RPC_INTR=18, - RPC_TLIERROR=20, - RPC_UDERROR=23, + RPC_PROGNOTREGISTERED=15, /* remote program is not registered */ + RPC_N2AXLATEFAILURE = 22, /* Name to addr translation failed */ + /* + * unspecified error + */ + RPC_FAILED=16, + RPC_INTR=18, + RPC_TLIERROR=20, + RPC_UDERROR=23, /* * asynchronous errors */ @@ -110,21 +110,21 @@ enum clnt_stat { struct rpc_err { int re_status; union { - int RE_errno; /* related system error */ - int RE_why; /* why the auth error occurred */ + int RE_errno; /* related system error */ + int RE_why; /* why the auth error occurred */ struct { - unsigned long low; /* lowest verion supported */ - unsigned long high; /* highest verion supported */ + unsigned long low; /* lowest verion supported */ + unsigned long high; /* highest verion supported */ } RE_vers; - struct { /* maybe meaningful if RPC_FAILED */ + struct { /* maybe meaningful if RPC_FAILED */ long s1; long s2; - } RE_lb; /* life boot & debugging only */ + } RE_lb; /* life boot & debugging only */ } ru; -#define re_errno ru.RE_errno -#define re_why ru.RE_why -#define re_vers ru.RE_vers -#define re_lb ru.RE_lb +#define re_errno ru.RE_errno +#define re_why ru.RE_why +#define re_vers ru.RE_vers +#define re_lb ru.RE_lb }; @@ -135,21 +135,21 @@ struct rpc_err { */ typedef struct CLIENT CLIENT; struct CLIENT { - AUTH *cl_auth; /* authenticator */ + AUTH *cl_auth; /* authenticator */ struct clnt_ops { enum clnt_stat (*cl_call) (CLIENT *, unsigned long, xdrproc_t, char*, xdrproc_t, - char*, struct timeval); - /* call remote procedure */ - void (*cl_abort) (void); /* abort a call */ + char*, struct timeval); + /* call remote procedure */ + void (*cl_abort) (void); /* abort a call */ void (*cl_geterr) (CLIENT *, struct rpc_err *); - /* get specific error code */ + /* get specific error code */ bool_t (*cl_freeres) (CLIENT *, xdrproc_t, char*); - /* frees results */ + /* frees results */ void (*cl_destroy) (CLIENT *); /* destroy this structure */ bool_t (*cl_control) (CLIENT *, int, char *); - /* the ioctl() of rpc */ + /* the ioctl() of rpc */ } *cl_ops; - char* cl_private; /* private stuff */ + char* cl_private; /* private stuff */ }; @@ -163,45 +163,45 @@ struct CLIENT { /* * enum clnt_stat * CLNT_CALL(rh, proc, xargs, argsp, xres, resp, timeout) - * CLIENT *rh; - * unsigned long proc; - * xdrproc_t xargs; - * char* argsp; - * xdrproc_t xres; - * char* resp; - * struct timeval timeout; + * CLIENT *rh; + * unsigned long proc; + * xdrproc_t xargs; + * char* argsp; + * xdrproc_t xres; + * char* resp; + * struct timeval timeout; */ -#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) -#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ - ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) +#define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) +#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \ + ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) /* * void * CLNT_ABORT(rh); - * CLIENT *rh; + * CLIENT *rh; */ -#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) -#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) +#define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh)) +#define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) /* * struct rpc_err * CLNT_GETERR(rh); - * CLIENT *rh; + * CLIENT *rh; */ -#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) -#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) +#define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) /* * bool_t * CLNT_FREERES(rh, xres, resp); - * CLIENT *rh; - * xdrproc_t xres; - * char* resp; + * CLIENT *rh; + * xdrproc_t xres; + * char* resp; */ -#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) -#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) +#define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) +#define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp)) /* * bool_t @@ -210,8 +210,8 @@ struct CLIENT { * unsigned int request; * char *info; */ -#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) -#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) +#define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) +#define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) /* * control operations that apply to all transports @@ -239,16 +239,16 @@ struct CLIENT { /* * Connectionless only control operations */ -#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ -#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ +#define CLSET_RETRY_TIMEOUT 4 /* set retry timeout (timeval) */ +#define CLGET_RETRY_TIMEOUT 5 /* get retry timeout (timeval) */ /* * void * CLNT_DESTROY(rh); - * CLIENT *rh; + * CLIENT *rh; */ -#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) -#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) +#define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) +#define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) /* @@ -257,10 +257,10 @@ struct CLIENT { * and network administration. */ -#define RPCTEST_PROGRAM ((unsigned long)1) -#define RPCTEST_VERSION ((unsigned long)1) -#define RPCTEST_NULL_PROC ((unsigned long)2) -#define RPCTEST_NULL_BATCH_PROC ((unsigned long)3) +#define RPCTEST_PROGRAM ((unsigned long)1) +#define RPCTEST_VERSION ((unsigned long)1) +#define RPCTEST_NULL_PROC ((unsigned long)2) +#define RPCTEST_NULL_BATCH_PROC ((unsigned long)3) /* * By convention, procedure 0 takes null arguments and returns them @@ -279,51 +279,51 @@ struct CLIENT { * "unix" * CLIENT * * clnt_create(host, prog, vers, prot) - * char *host; -- hostname - * unsigned long prog; -- program number - * u_ong vers; -- version number - * char *prot; -- protocol + * char *host; -- hostname + * unsigned long prog; -- program number + * u_ong vers; -- version number + * char *prot; -- protocol */ extern CLIENT *clnt_create (const char *__host, const unsigned long __prog, - const unsigned long __vers, const char *__prot) + const unsigned long __vers, const char *__prot) ; /* * UDP based rpc. * CLIENT * * clntudp_create(raddr, program, version, wait, sockp) - * struct sockaddr_in *raddr; - * unsigned long program; - * unsigned long version; - * struct timeval wait_resend; - * int *sockp; + * struct sockaddr_in *raddr; + * unsigned long program; + * unsigned long version; + * struct timeval wait_resend; + * int *sockp; * * Same as above, but you specify max packet sizes. * CLIENT * * clntudp_bufcreate(raddr, program, version, wait, sockp, sendsz, recvsz) - * struct sockaddr_in *raddr; - * unsigned long program; - * unsigned long version; - * struct timeval wait_resend; - * int *sockp; - * unsigned int sendsz; - * unsigned int recvsz; + * struct sockaddr_in *raddr; + * unsigned long program; + * unsigned long version; + * struct timeval wait_resend; + * int *sockp; + * unsigned int sendsz; + * unsigned int recvsz; */ extern CLIENT *clntudp_create (struct sockaddr_in *__raddr, unsigned long __program, - unsigned long __version, struct timeval __wait_resend, - int *__sockp); + unsigned long __version, struct timeval __wait_resend, + int *__sockp); extern CLIENT *clntudp_bufcreate (struct sockaddr_in *__raddr, - unsigned long __program, unsigned long __version, - struct timeval __wait_resend, int *__sockp, - unsigned int __sendsz, unsigned int __recvsz); + unsigned long __program, unsigned long __version, + struct timeval __wait_resend, int *__sockp, + unsigned int __sendsz, unsigned int __recvsz); extern int callrpc (const char *__host, const unsigned long __prognum, - const unsigned long __versnum, const unsigned long __procnum, - const xdrproc_t __inproc, const char *__in, - const xdrproc_t __outproc, char *__out); + const unsigned long __versnum, const unsigned long __procnum, + const xdrproc_t __inproc, const char *__in, + const xdrproc_t __outproc, char *__out); -#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ -#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ +#define UDPMSGSIZE 8800 /* rpc imposed limit on udp msg size */ +#define RPCSMALLMSGSIZE 400 /* a more reasonable packet size */ void clnt_perror(CLIENT *rpch, const char *s); diff --git a/components/dfs/filesystems/nfs/rpc/clnt_generic.c b/components/dfs/filesystems/nfs/rpc/clnt_generic.c index bd241b583..bbcd8011e 100644 --- a/components/dfs/filesystems/nfs/rpc/clnt_generic.c +++ b/components/dfs/filesystems/nfs/rpc/clnt_generic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/nfs/rpc/clnt_udp.c b/components/dfs/filesystems/nfs/rpc/clnt_udp.c index 6b4f7bfb1..17933539d 100644 --- a/components/dfs/filesystems/nfs/rpc/clnt_udp.c +++ b/components/dfs/filesystems/nfs/rpc/clnt_udp.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */ +/* @(#)clnt_udp.c 2.2 88/08/01 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -53,12 +53,12 @@ static char sccsid[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro"; * UDP bases client side rpc operations */ static enum clnt_stat clntudp_call(register CLIENT *cl, /* client handle */ - unsigned long proc, /* procedure number */ - xdrproc_t xargs, /* xdr routine for args */ - char* argsp, /* pointer to args */ - xdrproc_t xresults, /* xdr routine for results */ - char* resultsp, /* pointer to results */ - struct timeval utimeout); + unsigned long proc, /* procedure number */ + xdrproc_t xargs, /* xdr routine for args */ + char* argsp, /* pointer to args */ + xdrproc_t xresults, /* xdr routine for results */ + char* resultsp, /* pointer to results */ + struct timeval utimeout); static void clntudp_abort(void); static void clntudp_geterr(CLIENT *, struct rpc_err *); @@ -68,12 +68,12 @@ static void clntudp_destroy(CLIENT *); static struct clnt_ops udp_ops = { - clntudp_call, - clntudp_abort, - clntudp_geterr, - clntudp_freeres, - clntudp_destroy, - clntudp_control + clntudp_call, + clntudp_abort, + clntudp_geterr, + clntudp_freeres, + clntudp_destroy, + clntudp_control }; /* @@ -81,19 +81,19 @@ static struct clnt_ops udp_ops = */ struct cu_data { - int cu_sock; - bool_t cu_closeit; - struct sockaddr_in cu_raddr; - int cu_rlen; - struct timeval cu_wait; - struct timeval cu_total; - struct rpc_err cu_error; - XDR cu_outxdrs; - unsigned int cu_xdrpos; - unsigned int cu_sendsz; - char *cu_outbuf; - unsigned int cu_recvsz; - char cu_inbuf[1]; + int cu_sock; + bool_t cu_closeit; + struct sockaddr_in cu_raddr; + int cu_rlen; + struct timeval cu_wait; + struct timeval cu_total; + struct rpc_err cu_error; + XDR cu_outxdrs; + unsigned int cu_xdrpos; + unsigned int cu_sendsz; + char *cu_outbuf; + unsigned int cu_recvsz; + char cu_inbuf[1]; }; /* @@ -112,241 +112,241 @@ struct cu_data * sendsz and recvsz are the maximum allowable packet sizes that can be * sent and received. */ -CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr, - unsigned long program, - unsigned long version, - struct timeval wait, - int *sockp, - unsigned int sendsz, - unsigned int recvsz) +CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr, + unsigned long program, + unsigned long version, + struct timeval wait, + int *sockp, + unsigned int sendsz, + unsigned int recvsz) { - CLIENT *cl; - register struct cu_data *cu = NULL; - struct rpc_msg call_msg; - static int xid_count = 0; - - cl = (CLIENT *) rt_malloc (sizeof(CLIENT)); - if (cl == NULL) - { - rt_kprintf("clntudp_create: out of memory\n"); - goto fooy; - } - sendsz = ((sendsz + 3) / 4) * 4; - recvsz = ((recvsz + 3) / 4) * 4; - cu = (struct cu_data *) rt_malloc (sizeof(*cu) + sendsz + recvsz); - if (cu == NULL) - { - rt_kprintf("clntudp_create: out of memory\n"); - goto fooy; - } - cu->cu_outbuf = &cu->cu_inbuf[recvsz]; - - if (raddr->sin_port == 0) { - unsigned short port; - extern unsigned short pmap_getport(struct sockaddr_in *address, - unsigned long program, - unsigned long version, - unsigned int protocol); - - if ((port = - pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) { - goto fooy; - } - raddr->sin_port = htons(port); - } - - cl->cl_ops = &udp_ops; - cl->cl_private = (char*) cu; - cu->cu_raddr = *raddr; - cu->cu_rlen = sizeof(cu->cu_raddr); - cu->cu_wait = wait; - cu->cu_total.tv_sec = -1; - cu->cu_total.tv_usec = -1; - cu->cu_sendsz = sendsz; - cu->cu_recvsz = recvsz; - call_msg.rm_xid = ((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++); - call_msg.rm_direction = CALL; - call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; - call_msg.rm_call.cb_prog = program; - call_msg.rm_call.cb_vers = version; - xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE); - if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) - { - goto fooy; - } - cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); - if (*sockp < 0) - { - *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (*sockp < 0) - { - rt_kprintf("create socket error\n"); - goto fooy; - } - cu->cu_closeit = TRUE; - } - else - { - cu->cu_closeit = FALSE; - } - cu->cu_sock = *sockp; - cl->cl_auth = authnone_create(); - return (cl); + CLIENT *cl; + register struct cu_data *cu = NULL; + struct rpc_msg call_msg; + static int xid_count = 0; + + cl = (CLIENT *) rt_malloc (sizeof(CLIENT)); + if (cl == NULL) + { + rt_kprintf("clntudp_create: out of memory\n"); + goto fooy; + } + sendsz = ((sendsz + 3) / 4) * 4; + recvsz = ((recvsz + 3) / 4) * 4; + cu = (struct cu_data *) rt_malloc (sizeof(*cu) + sendsz + recvsz); + if (cu == NULL) + { + rt_kprintf("clntudp_create: out of memory\n"); + goto fooy; + } + cu->cu_outbuf = &cu->cu_inbuf[recvsz]; + + if (raddr->sin_port == 0) { + unsigned short port; + extern unsigned short pmap_getport(struct sockaddr_in *address, + unsigned long program, + unsigned long version, + unsigned int protocol); + + if ((port = + pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) { + goto fooy; + } + raddr->sin_port = htons(port); + } + + cl->cl_ops = &udp_ops; + cl->cl_private = (char*) cu; + cu->cu_raddr = *raddr; + cu->cu_rlen = sizeof(cu->cu_raddr); + cu->cu_wait = wait; + cu->cu_total.tv_sec = -1; + cu->cu_total.tv_usec = -1; + cu->cu_sendsz = sendsz; + cu->cu_recvsz = recvsz; + call_msg.rm_xid = ((unsigned long)rt_thread_self()) ^ ((unsigned long)rt_tick_get()) ^ (xid_count++); + call_msg.rm_direction = CALL; + call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION; + call_msg.rm_call.cb_prog = program; + call_msg.rm_call.cb_vers = version; + xdrmem_create(&(cu->cu_outxdrs), cu->cu_outbuf, sendsz, XDR_ENCODE); + if (!xdr_callhdr(&(cu->cu_outxdrs), &call_msg)) + { + goto fooy; + } + cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); + if (*sockp < 0) + { + *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (*sockp < 0) + { + rt_kprintf("create socket error\n"); + goto fooy; + } + cu->cu_closeit = TRUE; + } + else + { + cu->cu_closeit = FALSE; + } + cu->cu_sock = *sockp; + cl->cl_auth = authnone_create(); + return (cl); fooy: - if (cu) rt_free(cu); - if (cl) rt_free(cl); + if (cu) rt_free(cu); + if (cl) rt_free(cl); - return ((CLIENT *) NULL); + return ((CLIENT *) NULL); } -CLIENT *clntudp_create(struct sockaddr_in *raddr, - unsigned long program, - unsigned long version, - struct timeval wait, - int *sockp) +CLIENT *clntudp_create(struct sockaddr_in *raddr, + unsigned long program, + unsigned long version, + struct timeval wait, + int *sockp) { - return (clntudp_bufcreate(raddr, program, version, wait, sockp, - UDPMSGSIZE, UDPMSGSIZE)); + return (clntudp_bufcreate(raddr, program, version, wait, sockp, + UDPMSGSIZE, UDPMSGSIZE)); } -static enum clnt_stat clntudp_call(CLIENT *cl, unsigned long proc, - xdrproc_t xargs, char* argsp, - xdrproc_t xresults, char* resultsp, - struct timeval utimeout) +static enum clnt_stat clntudp_call(CLIENT *cl, unsigned long proc, + xdrproc_t xargs, char* argsp, + xdrproc_t xresults, char* resultsp, + struct timeval utimeout) { - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - register XDR *xdrs; - register int outlen; - register int inlen; - socklen_t fromlen; - - struct sockaddr_in from; - struct rpc_msg reply_msg; - XDR reply_xdrs; - bool_t ok; - int nrefreshes = 2; /* number of times to refresh cred */ + register struct cu_data *cu = (struct cu_data *) cl->cl_private; + register XDR *xdrs; + register int outlen; + register int inlen; + socklen_t fromlen; + + struct sockaddr_in from; + struct rpc_msg reply_msg; + XDR reply_xdrs; + bool_t ok; + int nrefreshes = 2; /* number of times to refresh cred */ call_again: - xdrs = &(cu->cu_outxdrs); - xdrs->x_op = XDR_ENCODE; - XDR_SETPOS(xdrs, cu->cu_xdrpos); + xdrs = &(cu->cu_outxdrs); + xdrs->x_op = XDR_ENCODE; + XDR_SETPOS(xdrs, cu->cu_xdrpos); - /* - * the transaction is the first thing in the out buffer - */ - (*(unsigned long *) (cu->cu_outbuf))++; + /* + * the transaction is the first thing in the out buffer + */ + (*(unsigned long *) (cu->cu_outbuf))++; - if ((!XDR_PUTLONG(xdrs, (long *) &proc)) || - (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) + if ((!XDR_PUTLONG(xdrs, (long *) &proc)) || + (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) { cu->cu_error.re_status = RPC_CANTENCODEARGS; - return RPC_CANTENCODEARGS; + return RPC_CANTENCODEARGS; } - outlen = (int) XDR_GETPOS(xdrs); + outlen = (int) XDR_GETPOS(xdrs); send_again: - if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0, - (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen) - != outlen) - { - cu->cu_error.re_errno = errno; + if (sendto(cu->cu_sock, cu->cu_outbuf, outlen, 0, + (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen) + != outlen) + { + cu->cu_error.re_errno = errno; cu->cu_error.re_status = RPC_CANTSEND; - - return RPC_CANTSEND; - } - - /* - * sub-optimal code appears here because we have - * some clock time to spare while the packets are in flight. - * (We assume that this is actually only executed once.) - */ - reply_msg.acpted_rply.ar_verf = _null_auth; - reply_msg.acpted_rply.ar_results.where = resultsp; - reply_msg.acpted_rply.ar_results.proc = xresults; - - /* do recv */ - do - { - fromlen = sizeof(struct sockaddr); - - inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, - (int) cu->cu_recvsz, 0, - (struct sockaddr *) &from, &fromlen); - }while (inlen < 0 && errno == EINTR); - - if (inlen < 4) - { - rt_kprintf("recv error, len %d\n", inlen); - cu->cu_error.re_errno = errno; - cu->cu_error.re_status = RPC_CANTRECV; - - return RPC_CANTRECV; - } - - /* see if reply transaction id matches sent id */ - if (*((uint32_t *) (cu->cu_inbuf)) != *((uint32_t *) (cu->cu_outbuf))) - goto send_again; - - /* we now assume we have the proper reply */ - - /* - * now decode and validate the response - */ - xdrmem_create(&reply_xdrs, cu->cu_inbuf, (unsigned int) inlen, XDR_DECODE); - ok = xdr_replymsg(&reply_xdrs, &reply_msg); - /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */ - if (ok) - { - _seterr_reply(&reply_msg, &(cu->cu_error)); - if (cu->cu_error.re_status == RPC_SUCCESS) - { - if (!AUTH_VALIDATE(cl->cl_auth, - &reply_msg.acpted_rply.ar_verf)) - { - cu->cu_error.re_status = RPC_AUTHERROR; - cu->cu_error.re_why = AUTH_INVALIDRESP; - } - if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) - { - extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap); - - xdrs->x_op = XDR_FREE; - (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); - } - } /* end successful completion */ - else - { - /* maybe our credentials need to be refreshed ... */ - if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) - { - nrefreshes--; - goto call_again; - } - } /* end of unsuccessful completion */ - } /* end of valid reply message */ - else - { - cu->cu_error.re_status = RPC_CANTDECODERES; - } - - return (enum clnt_stat)(cu->cu_error.re_status); + + return RPC_CANTSEND; + } + + /* + * sub-optimal code appears here because we have + * some clock time to spare while the packets are in flight. + * (We assume that this is actually only executed once.) + */ + reply_msg.acpted_rply.ar_verf = _null_auth; + reply_msg.acpted_rply.ar_results.where = resultsp; + reply_msg.acpted_rply.ar_results.proc = xresults; + + /* do recv */ + do + { + fromlen = sizeof(struct sockaddr); + + inlen = recvfrom(cu->cu_sock, cu->cu_inbuf, + (int) cu->cu_recvsz, 0, + (struct sockaddr *) &from, &fromlen); + }while (inlen < 0 && errno == EINTR); + + if (inlen < 4) + { + rt_kprintf("recv error, len %d\n", inlen); + cu->cu_error.re_errno = errno; + cu->cu_error.re_status = RPC_CANTRECV; + + return RPC_CANTRECV; + } + + /* see if reply transaction id matches sent id */ + if (*((uint32_t *) (cu->cu_inbuf)) != *((uint32_t *) (cu->cu_outbuf))) + goto send_again; + + /* we now assume we have the proper reply */ + + /* + * now decode and validate the response + */ + xdrmem_create(&reply_xdrs, cu->cu_inbuf, (unsigned int) inlen, XDR_DECODE); + ok = xdr_replymsg(&reply_xdrs, &reply_msg); + /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */ + if (ok) + { + _seterr_reply(&reply_msg, &(cu->cu_error)); + if (cu->cu_error.re_status == RPC_SUCCESS) + { + if (!AUTH_VALIDATE(cl->cl_auth, + &reply_msg.acpted_rply.ar_verf)) + { + cu->cu_error.re_status = RPC_AUTHERROR; + cu->cu_error.re_why = AUTH_INVALIDRESP; + } + if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) + { + extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap); + + xdrs->x_op = XDR_FREE; + (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); + } + } /* end successful completion */ + else + { + /* maybe our credentials need to be refreshed ... */ + if (nrefreshes > 0 && AUTH_REFRESH(cl->cl_auth)) + { + nrefreshes--; + goto call_again; + } + } /* end of unsuccessful completion */ + } /* end of valid reply message */ + else + { + cu->cu_error.re_status = RPC_CANTDECODERES; + } + + return (enum clnt_stat)(cu->cu_error.re_status); } static void clntudp_geterr(CLIENT *cl, struct rpc_err *errp) { - register struct cu_data *cu = (struct cu_data *) cl->cl_private; + register struct cu_data *cu = (struct cu_data *) cl->cl_private; - *errp = cu->cu_error; + *errp = cu->cu_error; } static bool_t clntudp_freeres(CLIENT *cl, xdrproc_t xdr_res, char* res_ptr) { - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - register XDR *xdrs = &(cu->cu_outxdrs); + register struct cu_data *cu = (struct cu_data *) cl->cl_private; + register XDR *xdrs = &(cu->cu_outxdrs); - xdrs->x_op = XDR_FREE; - return ((*xdr_res) (xdrs, res_ptr)); + xdrs->x_op = XDR_FREE; + return ((*xdr_res) (xdrs, res_ptr)); } static void clntudp_abort() @@ -355,50 +355,50 @@ static void clntudp_abort() static bool_t clntudp_control(CLIENT *cl, int request, char *info) { - register struct cu_data *cu = (struct cu_data *) cl->cl_private; - - switch (request) - { - case CLSET_TIMEOUT: - { - int mtimeout; - - cu->cu_total = *(struct timeval *) info; - mtimeout = ((cu->cu_total.tv_sec * 1000) + ((cu->cu_total.tv_usec + 500)/1000)); - - /* set socket option, note: lwip only support msecond timeout */ - setsockopt(cu->cu_sock, SOL_SOCKET, SO_RCVTIMEO, - &mtimeout, sizeof(mtimeout)); - } - break; - case CLGET_TIMEOUT: - *(struct timeval *) info = cu->cu_total; - break; - case CLSET_RETRY_TIMEOUT: - cu->cu_wait = *(struct timeval *) info; - break; - case CLGET_RETRY_TIMEOUT: - *(struct timeval *) info = cu->cu_wait; - break; - case CLGET_SERVER_ADDR: - *(struct sockaddr_in *) info = cu->cu_raddr; - break; - default: - return (FALSE); - } - return (TRUE); + register struct cu_data *cu = (struct cu_data *) cl->cl_private; + + switch (request) + { + case CLSET_TIMEOUT: + { + int mtimeout; + + cu->cu_total = *(struct timeval *) info; + mtimeout = ((cu->cu_total.tv_sec * 1000) + ((cu->cu_total.tv_usec + 500)/1000)); + + /* set socket option, note: lwip only support msecond timeout */ + setsockopt(cu->cu_sock, SOL_SOCKET, SO_RCVTIMEO, + &mtimeout, sizeof(mtimeout)); + } + break; + case CLGET_TIMEOUT: + *(struct timeval *) info = cu->cu_total; + break; + case CLSET_RETRY_TIMEOUT: + cu->cu_wait = *(struct timeval *) info; + break; + case CLGET_RETRY_TIMEOUT: + *(struct timeval *) info = cu->cu_wait; + break; + case CLGET_SERVER_ADDR: + *(struct sockaddr_in *) info = cu->cu_raddr; + break; + default: + return (FALSE); + } + return (TRUE); } static void clntudp_destroy(CLIENT *cl) { - register struct cu_data *cu = (struct cu_data *) cl->cl_private; + register struct cu_data *cu = (struct cu_data *) cl->cl_private; - if (cu->cu_closeit) - { - lwip_close(cu->cu_sock); - } + if (cu->cu_closeit) + { + lwip_close(cu->cu_sock); + } - XDR_DESTROY(&(cu->cu_outxdrs)); - rt_free(cu); - rt_free(cl); + XDR_DESTROY(&(cu->cu_outxdrs)); + rt_free(cu); + rt_free(cl); } diff --git a/components/dfs/filesystems/nfs/rpc/pmap.c b/components/dfs/filesystems/nfs/rpc/pmap.c index dc5a2ccb8..afa2583d0 100644 --- a/components/dfs/filesystems/nfs/rpc/pmap.c +++ b/components/dfs/filesystems/nfs/rpc/pmap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,11 +16,11 @@ static struct timeval tottimeout = { 60, 0 }; bool_t xdr_pmap(XDR *xdrs, struct pmap *regs) { - if (xdr_u_long(xdrs, ®s->pm_prog) && - xdr_u_long(xdrs, ®s->pm_vers) && - xdr_u_long(xdrs, ®s->pm_prot)) - return (xdr_u_long(xdrs, ®s->pm_port)); - return (FALSE); + if (xdr_u_long(xdrs, ®s->pm_prog) && + xdr_u_long(xdrs, ®s->pm_vers) && + xdr_u_long(xdrs, ®s->pm_prot)) + return (xdr_u_long(xdrs, ®s->pm_port)); + return (FALSE); } /* @@ -30,33 +30,33 @@ bool_t xdr_pmap(XDR *xdrs, struct pmap *regs) */ unsigned short pmap_getport(struct sockaddr_in *address, unsigned long program, unsigned long version, unsigned int protocol) { - unsigned short port = 0; - int socket = -1; - register CLIENT *client = RT_NULL; - struct pmap parms; - - address->sin_port = htons((unsigned short)PMAPPORT); - if (protocol == IPPROTO_UDP) - client = clntudp_bufcreate(address, PMAPPROG, PMAPVERS, timeout, - &socket, RPCSMALLMSGSIZE, - RPCSMALLMSGSIZE); - - if (client != (CLIENT *) NULL) - { - parms.pm_prog = program; - parms.pm_vers = version; - parms.pm_prot = protocol; - parms.pm_port = 0; /* not needed or used */ - if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (char*)&parms, - (xdrproc_t)xdr_u_short, (char*)&port, tottimeout) != RPC_SUCCESS) - { - rt_kprintf("pmap failure\n"); - } - CLNT_DESTROY(client); - } - - (void) lwip_close(socket); - address->sin_port = 0; - - return (port); + unsigned short port = 0; + int socket = -1; + register CLIENT *client = RT_NULL; + struct pmap parms; + + address->sin_port = htons((unsigned short)PMAPPORT); + if (protocol == IPPROTO_UDP) + client = clntudp_bufcreate(address, PMAPPROG, PMAPVERS, timeout, + &socket, RPCSMALLMSGSIZE, + RPCSMALLMSGSIZE); + + if (client != (CLIENT *) NULL) + { + parms.pm_prog = program; + parms.pm_vers = version; + parms.pm_prot = protocol; + parms.pm_port = 0; /* not needed or used */ + if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap, (char*)&parms, + (xdrproc_t)xdr_u_short, (char*)&port, tottimeout) != RPC_SUCCESS) + { + rt_kprintf("pmap failure\n"); + } + CLNT_DESTROY(client); + } + + (void) lwip_close(socket); + address->sin_port = 0; + + return (port); } diff --git a/components/dfs/filesystems/nfs/rpc/pmap.h b/components/dfs/filesystems/nfs/rpc/pmap.h index 8ae706c0a..3a0305a6b 100644 --- a/components/dfs/filesystems/nfs/rpc/pmap.h +++ b/components/dfs/filesystems/nfs/rpc/pmap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,51 +14,51 @@ /* The following procedures are supported by the protocol: * * PMAPPROC_NULL() returns () - * takes nothing, returns nothing + * takes nothing, returns nothing * * PMAPPROC_SET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Registers the tuple - * [prog, vers, prot, port]. + * TRUE is success, FALSE is failure. Registers the tuple + * [prog, vers, prot, port]. * * PMAPPROC_UNSET(struct pmap) returns (bool_t) - * TRUE is success, FALSE is failure. Un-registers pair - * [prog, vers]. prot and port are ignored. + * TRUE is success, FALSE is failure. Un-registers pair + * [prog, vers]. prot and port are ignored. * * PMAPPROC_GETPORT(struct pmap) returns (long unsigned). - * 0 is failure. Otherwise returns the port number where the pair - * [prog, vers] is registered. It may lie! + * 0 is failure. Otherwise returns the port number where the pair + * [prog, vers] is registered. It may lie! * * PMAPPROC_DUMP() RETURNS (struct pmaplist *) * * PMAPPROC_CALLIT(unsigned, unsigned, unsigned, string<>) - * RETURNS (port, string<>); + * RETURNS (port, string<>); * usage: encapsulatedresults = PMAPPROC_CALLIT(prog, vers, proc, encapsulatedargs); - * Calls the procedure on the local machine. If it is not registered, - * this procedure is quite; ie it does not return error information!!! - * This procedure only is supported on rpc/udp and calls via - * rpc/udp. This routine only passes null authentication parameters. - * This file has no interface to xdr routines for PMAPPROC_CALLIT. + * Calls the procedure on the local machine. If it is not registered, + * this procedure is quite; ie it does not return error information!!! + * This procedure only is supported on rpc/udp and calls via + * rpc/udp. This routine only passes null authentication parameters. + * This file has no interface to xdr routines for PMAPPROC_CALLIT. * * The service supports remote procedure calls on udp/ip or tcp/ip socket 111. */ -#define PMAPPORT ((unsigned short)111) -#define PMAPPROG ((unsigned long)100000) -#define PMAPVERS ((unsigned long)2) -#define PMAPVERS_PROTO ((unsigned long)2) -#define PMAPVERS_ORIG ((unsigned long)1) -#define PMAPPROC_NULL ((unsigned long)0) -#define PMAPPROC_SET ((unsigned long)1) -#define PMAPPROC_UNSET ((unsigned long)2) -#define PMAPPROC_GETPORT ((unsigned long)3) -#define PMAPPROC_DUMP ((unsigned long)4) -#define PMAPPROC_CALLIT ((unsigned long)5) +#define PMAPPORT ((unsigned short)111) +#define PMAPPROG ((unsigned long)100000) +#define PMAPVERS ((unsigned long)2) +#define PMAPVERS_PROTO ((unsigned long)2) +#define PMAPVERS_ORIG ((unsigned long)1) +#define PMAPPROC_NULL ((unsigned long)0) +#define PMAPPROC_SET ((unsigned long)1) +#define PMAPPROC_UNSET ((unsigned long)2) +#define PMAPPROC_GETPORT ((unsigned long)3) +#define PMAPPROC_DUMP ((unsigned long)4) +#define PMAPPROC_CALLIT ((unsigned long)5) struct pmap { - long unsigned pm_prog; - long unsigned pm_vers; - long unsigned pm_prot; - long unsigned pm_port; + long unsigned pm_prog; + long unsigned pm_vers; + long unsigned pm_prot; + long unsigned pm_port; }; extern bool_t xdr_pmap (XDR *__xdrs, struct pmap *__regs); diff --git a/components/dfs/filesystems/nfs/rpc/rpc.h b/components/dfs/filesystems/nfs/rpc/rpc.h index 7256d336a..12d2477ef 100644 --- a/components/dfs/filesystems/nfs/rpc/rpc.h +++ b/components/dfs/filesystems/nfs/rpc/rpc.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ +/* @(#)rpc.h 2.3 88/08/10 4.0 RPCSRC; from 1.9 88/02/08 SMI */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -46,17 +46,17 @@ #ifndef _RPC_RPC_H #define _RPC_RPC_H 1 -#include /* some typedefs */ +#include /* some typedefs */ /* external data representation interfaces */ -#include /* generic (de)serializer */ +#include /* generic (de)serializer */ #include /* Client side (mostly) remote procedure call */ -#include /* generic rpc stuff */ +#include /* generic rpc stuff */ /* semi-private protocol headers */ -#include /* protocol for rpc messages */ +#include /* protocol for rpc messages */ #endif diff --git a/components/dfs/filesystems/nfs/rpc/rpc_msg.h b/components/dfs/filesystems/nfs/rpc/rpc_msg.h index a21ca1ce7..358c3f790 100644 --- a/components/dfs/filesystems/nfs/rpc/rpc_msg.h +++ b/components/dfs/filesystems/nfs/rpc/rpc_msg.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ +/* @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -50,8 +50,8 @@ * Copyright (C) 1984, Sun Microsystems, Inc. */ -#define RPC_MSG_VERSION ((unsigned long) 2) -#define RPC_SERVICE_PORT ((unsigned short) 2048) +#define RPC_MSG_VERSION ((unsigned long) 2) +#define RPC_SERVICE_PORT ((unsigned short) 2048) /* * Bottom up definition of an rpc message. @@ -60,27 +60,27 @@ */ enum msg_type { - CALL=0, - REPLY=1 + CALL=0, + REPLY=1 }; enum reply_stat { - MSG_ACCEPTED=0, - MSG_DENIED=1 + MSG_ACCEPTED=0, + MSG_DENIED=1 }; enum accept_stat { - SUCCESS=0, - PROG_UNAVAIL=1, - PROG_MISMATCH=2, - PROC_UNAVAIL=3, - GARBAGE_ARGS=4, - SYSTEM_ERR=5 + SUCCESS=0, + PROG_UNAVAIL=1, + PROG_MISMATCH=2, + PROC_UNAVAIL=3, + GARBAGE_ARGS=4, + SYSTEM_ERR=5 }; enum reject_stat { - RPC_MISMATCH=0, - AUTH_ERROR=1 + RPC_MISMATCH=0, + AUTH_ERROR=1 }; /* @@ -93,111 +93,111 @@ enum reject_stat { * accepted. */ struct accepted_reply { - struct opaque_auth ar_verf; - int ar_stat; - union { - struct { - unsigned long low; - unsigned long high; - } AR_versions; - struct { - char* where; - xdrproc_t proc; - } AR_results; - /* and many other null cases */ - } ru; -#define ar_results ru.AR_results -#define ar_vers ru.AR_versions + struct opaque_auth ar_verf; + int ar_stat; + union { + struct { + unsigned long low; + unsigned long high; + } AR_versions; + struct { + char* where; + xdrproc_t proc; + } AR_results; + /* and many other null cases */ + } ru; +#define ar_results ru.AR_results +#define ar_vers ru.AR_versions }; /* * Reply to an rpc request that was rejected by the server. */ struct rejected_reply { - int rj_stat; - union { - struct { - unsigned long low; - unsigned long high; - } RJ_versions; - int RJ_why; /* why authentication did not work */ - } ru; -#define rj_vers ru.RJ_versions -#define rj_why ru.RJ_why + int rj_stat; + union { + struct { + unsigned long low; + unsigned long high; + } RJ_versions; + int RJ_why; /* why authentication did not work */ + } ru; +#define rj_vers ru.RJ_versions +#define rj_why ru.RJ_why }; /* * Body of a reply to an rpc request. */ struct reply_body { - int rp_stat; - union { - struct accepted_reply RP_ar; - struct rejected_reply RP_dr; - } ru; -#define rp_acpt ru.RP_ar -#define rp_rjct ru.RP_dr + int rp_stat; + union { + struct accepted_reply RP_ar; + struct rejected_reply RP_dr; + } ru; +#define rp_acpt ru.RP_ar +#define rp_rjct ru.RP_dr }; /* * Body of an rpc request call. */ struct call_body { - unsigned long cb_rpcvers; /* must be equal to two */ - unsigned long cb_prog; - unsigned long cb_vers; - unsigned long cb_proc; - struct opaque_auth cb_cred; - struct opaque_auth cb_verf; /* protocol specific - provided by client */ + unsigned long cb_rpcvers; /* must be equal to two */ + unsigned long cb_prog; + unsigned long cb_vers; + unsigned long cb_proc; + struct opaque_auth cb_cred; + struct opaque_auth cb_verf; /* protocol specific - provided by client */ }; /* * The rpc message */ struct rpc_msg { - unsigned long rm_xid; - int rm_direction; - union { - struct call_body RM_cmb; - struct reply_body RM_rmb; - } ru; -#define rm_call ru.RM_cmb -#define rm_reply ru.RM_rmb + unsigned long rm_xid; + int rm_direction; + union { + struct call_body RM_cmb; + struct reply_body RM_rmb; + } ru; +#define rm_call ru.RM_cmb +#define rm_reply ru.RM_rmb }; -#define acpted_rply ru.RM_rmb.ru.RP_ar -#define rjcted_rply ru.RM_rmb.ru.RP_dr +#define acpted_rply ru.RM_rmb.ru.RP_ar +#define rjcted_rply ru.RM_rmb.ru.RP_dr /* * XDR routine to handle a rpc message. * xdr_callmsg(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; + * XDR *xdrs; + * struct rpc_msg *cmsg; */ -extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg); +extern bool_t xdr_callmsg (XDR *__xdrs, struct rpc_msg *__cmsg); /* * XDR routine to pre-serialize the static part of a rpc message. * xdr_callhdr(xdrs, cmsg) - * XDR *xdrs; - * struct rpc_msg *cmsg; + * XDR *xdrs; + * struct rpc_msg *cmsg; */ -extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg); +extern bool_t xdr_callhdr (XDR *__xdrs, struct rpc_msg *__cmsg); /* * XDR routine to handle a rpc reply. * xdr_replymsg(xdrs, rmsg) - * XDR *xdrs; - * struct rpc_msg *rmsg; + * XDR *xdrs; + * struct rpc_msg *rmsg; */ -extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg); +extern bool_t xdr_replymsg (XDR *__xdrs, struct rpc_msg *__rmsg); /* * Fills in the error part of a reply message. * _seterr_reply(msg, error) - * struct rpc_msg *msg; - * struct rpc_err *error; + * struct rpc_msg *msg; + * struct rpc_err *error; */ -extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error); +extern void _seterr_reply (struct rpc_msg *__msg, struct rpc_err *__error); #endif /* rpc/rpc_msg.h */ diff --git a/components/dfs/filesystems/nfs/rpc/rpc_prot.c b/components/dfs/filesystems/nfs/rpc/rpc_prot.c index 427d7a11e..61cb6cbc8 100644 --- a/components/dfs/filesystems/nfs/rpc/rpc_prot.c +++ b/components/dfs/filesystems/nfs/rpc/rpc_prot.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */ +/* @(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -14,23 +14,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -63,10 +63,10 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro"; bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap) { - if (xdr_enum(xdrs, &(ap->oa_flavor))) - return (xdr_bytes(xdrs, &ap->oa_base, - &ap->oa_length, MAX_AUTH_BYTES)); - return (FALSE); + if (xdr_enum(xdrs, &(ap->oa_flavor))) + return (xdr_bytes(xdrs, &ap->oa_base, + &ap->oa_length, MAX_AUTH_BYTES)); + return (FALSE); } /* @@ -74,7 +74,7 @@ bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap) */ bool_t xdr_des_block(XDR *xdrs, des_block *blkp) { - return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block))); + return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block))); } /* * * * * * * * * * * * * * XDR RPC MESSAGE * * * * * * * * * * * * * * * */ @@ -85,22 +85,22 @@ bool_t xdr_des_block(XDR *xdrs, des_block *blkp) static bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar) { - /* personalized union, rather than calling xdr_union */ - if (!xdr_opaque_auth(xdrs, &(ar->ar_verf))) - return (FALSE); - if (!xdr_enum(xdrs, (enum_t *) & (ar->ar_stat))) - return (FALSE); - switch (ar->ar_stat) { - - case SUCCESS: - return ((*(ar->ar_results.proc)) (xdrs, ar->ar_results.where)); - - case PROG_MISMATCH: - if (!xdr_u_long(xdrs, &(ar->ar_vers.low))) - return (FALSE); - return (xdr_u_long(xdrs, &(ar->ar_vers.high))); - } - return (TRUE); /* TRUE => open ended set of problems */ + /* personalized union, rather than calling xdr_union */ + if (!xdr_opaque_auth(xdrs, &(ar->ar_verf))) + return (FALSE); + if (!xdr_enum(xdrs, (enum_t *) & (ar->ar_stat))) + return (FALSE); + switch (ar->ar_stat) { + + case SUCCESS: + return ((*(ar->ar_results.proc)) (xdrs, ar->ar_results.where)); + + case PROG_MISMATCH: + if (!xdr_u_long(xdrs, &(ar->ar_vers.low))) + return (FALSE); + return (xdr_u_long(xdrs, &(ar->ar_vers.high))); + } + return (TRUE); /* TRUE => open ended set of problems */ } /* @@ -109,26 +109,26 @@ static bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar) static bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr) { - /* personalized union, rather than calling xdr_union */ - if (!xdr_enum(xdrs, (enum_t *) & (rr->rj_stat))) - return (FALSE); - switch (rr->rj_stat) { + /* personalized union, rather than calling xdr_union */ + if (!xdr_enum(xdrs, (enum_t *) & (rr->rj_stat))) + return (FALSE); + switch (rr->rj_stat) { - case RPC_MISMATCH: - if (!xdr_u_long(xdrs, &(rr->rj_vers.low))) - return (FALSE); - return (xdr_u_long(xdrs, &(rr->rj_vers.high))); + case RPC_MISMATCH: + if (!xdr_u_long(xdrs, &(rr->rj_vers.low))) + return (FALSE); + return (xdr_u_long(xdrs, &(rr->rj_vers.high))); - case AUTH_ERROR: - return (xdr_enum(xdrs, (enum_t *) & (rr->rj_why))); - } - return (FALSE); + case AUTH_ERROR: + return (xdr_enum(xdrs, (enum_t *) & (rr->rj_why))); + } + return (FALSE); } static struct xdr_discrim reply_dscrm[3] = { - {(int) MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply}, - {(int) MSG_DENIED, (xdrproc_t)xdr_rejected_reply}, - {__dontcare__, NULL_xdrproc_t} + {(int) MSG_ACCEPTED, (xdrproc_t)xdr_accepted_reply}, + {(int) MSG_DENIED, (xdrproc_t)xdr_rejected_reply}, + {__dontcare__, NULL_xdrproc_t} }; /* @@ -136,13 +136,13 @@ static struct xdr_discrim reply_dscrm[3] = { */ bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg) { - if (xdr_u_long(xdrs, &(rmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) && - (rmsg->rm_direction == REPLY)) - return (xdr_union(xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat), - (char*) & (rmsg->rm_reply.ru), reply_dscrm, - NULL_xdrproc_t)); - return (FALSE); + if (xdr_u_long(xdrs, &(rmsg->rm_xid)) && + xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) && + (rmsg->rm_direction == REPLY)) + return (xdr_union(xdrs, (enum_t *) & (rmsg->rm_reply.rp_stat), + (char*) & (rmsg->rm_reply.ru), reply_dscrm, + NULL_xdrproc_t)); + return (FALSE); } @@ -154,16 +154,16 @@ bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg) bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg) { - cmsg->rm_direction = CALL; - cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION; - if ( - (xdrs->x_op == XDR_ENCODE) && - xdr_u_long(xdrs, &(cmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog))) - return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers))); - return (FALSE); + cmsg->rm_direction = CALL; + cmsg->rm_call.cb_rpcvers = RPC_MSG_VERSION; + if ( + (xdrs->x_op == XDR_ENCODE) && + xdr_u_long(xdrs, &(cmsg->rm_xid)) && + xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog))) + return (xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers))); + return (FALSE); } /* ************************** Client utility routine ************* */ @@ -171,55 +171,55 @@ bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg) static void accepted(enum accept_stat acpt_stat, struct rpc_err *error) { - switch (acpt_stat) { + switch (acpt_stat) { - case PROG_UNAVAIL: - error->re_status = RPC_PROGUNAVAIL; - return; + case PROG_UNAVAIL: + error->re_status = RPC_PROGUNAVAIL; + return; - case PROG_MISMATCH: - error->re_status = RPC_PROGVERSMISMATCH; - return; + case PROG_MISMATCH: + error->re_status = RPC_PROGVERSMISMATCH; + return; - case PROC_UNAVAIL: - error->re_status = RPC_PROCUNAVAIL; - return; + case PROC_UNAVAIL: + error->re_status = RPC_PROCUNAVAIL; + return; - case GARBAGE_ARGS: - error->re_status = RPC_CANTDECODEARGS; - return; + case GARBAGE_ARGS: + error->re_status = RPC_CANTDECODEARGS; + return; - case SYSTEM_ERR: - error->re_status = RPC_SYSTEMERROR; - return; + case SYSTEM_ERR: + error->re_status = RPC_SYSTEMERROR; + return; - case SUCCESS: - error->re_status = RPC_SUCCESS; - return; - } - /* something's wrong, but we don't know what ... */ - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) MSG_ACCEPTED; - error->re_lb.s2 = (long) acpt_stat; + case SUCCESS: + error->re_status = RPC_SUCCESS; + return; + } + /* something's wrong, but we don't know what ... */ + error->re_status = RPC_FAILED; + error->re_lb.s1 = (long) MSG_ACCEPTED; + error->re_lb.s2 = (long) acpt_stat; } static void rejected(enum reject_stat rjct_stat, struct rpc_err *error) { - switch (rjct_stat) { + switch (rjct_stat) { - case RPC_VERSMISMATCH: - error->re_status = RPC_VERSMISMATCH; - return; + case RPC_VERSMISMATCH: + error->re_status = RPC_VERSMISMATCH; + return; - case AUTH_ERROR: - error->re_status = RPC_AUTHERROR; - return; - } - /* something's wrong, but we don't know what ... */ - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) MSG_DENIED; - error->re_lb.s2 = (long) rjct_stat; + case AUTH_ERROR: + error->re_status = RPC_AUTHERROR; + return; + } + /* something's wrong, but we don't know what ... */ + error->re_status = RPC_FAILED; + error->re_lb.s1 = (long) MSG_DENIED; + error->re_lb.s2 = (long) rjct_stat; } /* @@ -228,40 +228,40 @@ static void rejected(enum reject_stat rjct_stat, struct rpc_err *error) void _seterr_reply(struct rpc_msg *msg, struct rpc_err *error) { - /* optimized for normal, SUCCESSful case */ - switch (msg->rm_reply.rp_stat) { - - case MSG_ACCEPTED: - if (msg->acpted_rply.ar_stat == SUCCESS) { - error->re_status = RPC_SUCCESS; - return; - }; - accepted((enum accept_stat)msg->acpted_rply.ar_stat, error); - break; - - case MSG_DENIED: - rejected((enum reject_stat)msg->rjcted_rply.rj_stat, error); - break; - - default: - error->re_status = RPC_FAILED; - error->re_lb.s1 = (long) (msg->rm_reply.rp_stat); - break; - } - switch (error->re_status) { - - case RPC_VERSMISMATCH: - error->re_vers.low = msg->rjcted_rply.rj_vers.low; - error->re_vers.high = msg->rjcted_rply.rj_vers.high; - break; - - case RPC_AUTHERROR: - error->re_why = msg->rjcted_rply.rj_why; - break; - - case RPC_PROGVERSMISMATCH: - error->re_vers.low = msg->acpted_rply.ar_vers.low; - error->re_vers.high = msg->acpted_rply.ar_vers.high; - break; - } + /* optimized for normal, SUCCESSful case */ + switch (msg->rm_reply.rp_stat) { + + case MSG_ACCEPTED: + if (msg->acpted_rply.ar_stat == SUCCESS) { + error->re_status = RPC_SUCCESS; + return; + }; + accepted((enum accept_stat)msg->acpted_rply.ar_stat, error); + break; + + case MSG_DENIED: + rejected((enum reject_stat)msg->rjcted_rply.rj_stat, error); + break; + + default: + error->re_status = RPC_FAILED; + error->re_lb.s1 = (long) (msg->rm_reply.rp_stat); + break; + } + switch (error->re_status) { + + case RPC_VERSMISMATCH: + error->re_vers.low = msg->rjcted_rply.rj_vers.low; + error->re_vers.high = msg->rjcted_rply.rj_vers.high; + break; + + case RPC_AUTHERROR: + error->re_why = msg->rjcted_rply.rj_why; + break; + + case RPC_PROGVERSMISMATCH: + error->re_vers.low = msg->acpted_rply.ar_vers.low; + error->re_vers.high = msg->acpted_rply.ar_vers.high; + break; + } } diff --git a/components/dfs/filesystems/nfs/rpc/types.h b/components/dfs/filesystems/nfs/rpc/types.h index 254fcd339..4e50c5384 100644 --- a/components/dfs/filesystems/nfs/rpc/types.h +++ b/components/dfs/filesystems/nfs/rpc/types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/nfs/rpc/xdr.c b/components/dfs/filesystems/nfs/rpc/xdr.c index a6b1b67af..fa3b12ef0 100644 --- a/components/dfs/filesystems/nfs/rpc/xdr.c +++ b/components/dfs/filesystems/nfs/rpc/xdr.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */ +/* @(#)xdr.c 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -14,23 +14,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -58,9 +58,9 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; /* * constants specific to the xdr "protocol" */ -#define XDR_FALSE ((long) 0) -#define XDR_TRUE ((long) 1) -#define LASTUNSIGNED ((unsigned int) 0-1) +#define XDR_FALSE ((long) 0) +#define XDR_TRUE ((long) 1) +#define LASTUNSIGNED ((unsigned int) 0-1) /* * for unit alignment @@ -73,21 +73,21 @@ static char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; */ void xdr_free(xdrproc_t proc, char* objp) { - XDR x; + XDR x; - x.x_op = XDR_FREE; - (*proc) (&x, objp); + x.x_op = XDR_FREE; + (*proc) (&x, objp); } /* * XDR nothing */ bool_t xdr_void( /* xdrs, addr */ ) - /* XDR *xdrs; */ - /* char* addr; */ + /* XDR *xdrs; */ + /* char* addr; */ { - return (TRUE); + return (TRUE); } /* @@ -95,25 +95,25 @@ bool_t xdr_void( /* xdrs, addr */ ) */ bool_t xdr_int(XDR* xdrs, int* ip) { - if (sizeof(int) == sizeof(long)) { - return (xdr_long(xdrs, (long *) ip)); - } else if (sizeof(int) < sizeof(long)) { - long l; - switch (xdrs->x_op) { - case XDR_ENCODE: - l = (long) *ip; - return XDR_PUTLONG(xdrs, &l); - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) - return FALSE; - *ip = (int) l; - case XDR_FREE: - return TRUE; - } - return FALSE; - } else { - return (xdr_short(xdrs, (short *) ip)); - } + if (sizeof(int) == sizeof(long)) { + return (xdr_long(xdrs, (long *) ip)); + } else if (sizeof(int) < sizeof(long)) { + long l; + switch (xdrs->x_op) { + case XDR_ENCODE: + l = (long) *ip; + return XDR_PUTLONG(xdrs, &l); + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, &l)) + return FALSE; + *ip = (int) l; + case XDR_FREE: + return TRUE; + } + return FALSE; + } else { + return (xdr_short(xdrs, (short *) ip)); + } } /* @@ -121,25 +121,25 @@ bool_t xdr_int(XDR* xdrs, int* ip) */ bool_t xdr_u_int(XDR* xdrs, unsigned int* up) { - if (sizeof(unsigned int) == sizeof(unsigned long)) { - return (xdr_u_long(xdrs, (unsigned long *) up)); - } else if (sizeof(unsigned int) < sizeof(unsigned long)) { - unsigned long l; - switch (xdrs->x_op) { - case XDR_ENCODE: - l = (unsigned long) *up; - return XDR_PUTLONG(xdrs, (long*)&l); - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long*)&l)) - return FALSE; - *up = (unsigned int) l; - case XDR_FREE: - return TRUE; - } - return FALSE; - } else { - return (xdr_short(xdrs, (short *) up)); - } + if (sizeof(unsigned int) == sizeof(unsigned long)) { + return (xdr_u_long(xdrs, (unsigned long *) up)); + } else if (sizeof(unsigned int) < sizeof(unsigned long)) { + unsigned long l; + switch (xdrs->x_op) { + case XDR_ENCODE: + l = (unsigned long) *up; + return XDR_PUTLONG(xdrs, (long*)&l); + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, (long*)&l)) + return FALSE; + *up = (unsigned int) l; + case XDR_FREE: + return TRUE; + } + return FALSE; + } else { + return (xdr_short(xdrs, (short *) up)); + } } /* @@ -149,18 +149,18 @@ bool_t xdr_u_int(XDR* xdrs, unsigned int* up) bool_t xdr_long(XDR* xdrs, long* lp) { - if (xdrs->x_op == XDR_ENCODE - && (sizeof(int32_t) == sizeof(long) - || (int32_t) *lp == *lp)) - return (XDR_PUTLONG(xdrs, lp)); + if (xdrs->x_op == XDR_ENCODE + && (sizeof(int32_t) == sizeof(long) + || (int32_t) *lp == *lp)) + return (XDR_PUTLONG(xdrs, lp)); - if (xdrs->x_op == XDR_DECODE) - return (XDR_GETLONG(xdrs, lp)); + if (xdrs->x_op == XDR_DECODE) + return (XDR_GETLONG(xdrs, lp)); - if (xdrs->x_op == XDR_FREE) - return (TRUE); + if (xdrs->x_op == XDR_FREE) + return (TRUE); - return (FALSE); + return (FALSE); } /* @@ -171,25 +171,25 @@ bool_t xdr_u_long(XDR* xdrs, unsigned long* ulp) { if (xdrs->x_op == XDR_DECODE) { - long l; - if (XDR_GETLONG(xdrs, &l) == FALSE) - return FALSE; - *ulp = (uint32_t) l; - return TRUE; + long l; + if (XDR_GETLONG(xdrs, &l) == FALSE) + return FALSE; + *ulp = (uint32_t) l; + return TRUE; } if (xdrs->x_op == XDR_ENCODE) { - if (sizeof(uint32_t) != sizeof(unsigned long) - && (uint32_t) *ulp != *ulp) - return FALSE; + if (sizeof(uint32_t) != sizeof(unsigned long) + && (uint32_t) *ulp != *ulp) + return FALSE; - return (XDR_PUTLONG(xdrs, (long *) ulp)); + return (XDR_PUTLONG(xdrs, (long *) ulp)); } - if (xdrs->x_op == XDR_FREE) - return (TRUE); + if (xdrs->x_op == XDR_FREE) + return (TRUE); - return (FALSE); + return (FALSE); } @@ -254,25 +254,25 @@ bool_t xdr_u_longlong_t (XDR * xdrs, unsigned long long* ullp) */ bool_t xdr_short(XDR* xdrs, short* sp) { - long l; + long l; - switch (xdrs->x_op) { + switch (xdrs->x_op) { - case XDR_ENCODE: - l = (long) *sp; - return (XDR_PUTLONG(xdrs, &l)); + case XDR_ENCODE: + l = (long) *sp; + return (XDR_PUTLONG(xdrs, &l)); - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &l)) { - return (FALSE); - } - *sp = (short) l; - return (TRUE); + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, &l)) { + return (FALSE); + } + *sp = (short) l; + return (TRUE); - case XDR_FREE: - return (TRUE); - } - return (FALSE); + case XDR_FREE: + return (TRUE); + } + return (FALSE); } /* @@ -280,25 +280,25 @@ bool_t xdr_short(XDR* xdrs, short* sp) */ bool_t xdr_u_short(XDR* xdrs, unsigned short* usp) { - unsigned long l; + unsigned long l; - switch (xdrs->x_op) { + switch (xdrs->x_op) { - case XDR_ENCODE: - l = (unsigned long) * usp; - return (XDR_PUTLONG(xdrs, (long*)&l)); + case XDR_ENCODE: + l = (unsigned long) * usp; + return (XDR_PUTLONG(xdrs, (long*)&l)); - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, (long*)&l)) { - return (FALSE); - } - *usp = (unsigned short) l; - return (TRUE); + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, (long*)&l)) { + return (FALSE); + } + *usp = (unsigned short) l; + return (TRUE); - case XDR_FREE: - return (TRUE); - } - return (FALSE); + case XDR_FREE: + return (TRUE); + } + return (FALSE); } @@ -307,14 +307,14 @@ bool_t xdr_u_short(XDR* xdrs, unsigned short* usp) */ bool_t xdr_char(XDR* xdrs, char* cp) { - int i; - - i = (*cp); - if (!xdr_int(xdrs, &i)) { - return (FALSE); - } - *cp = i; - return (TRUE); + int i; + + i = (*cp); + if (!xdr_int(xdrs, &i)) { + return (FALSE); + } + *cp = i; + return (TRUE); } /* @@ -322,14 +322,14 @@ bool_t xdr_char(XDR* xdrs, char* cp) */ bool_t xdr_u_char(XDR* xdrs, unsigned char* cp) { - unsigned int u; - - u = (*cp); - if (!xdr_u_int(xdrs, &u)) { - return (FALSE); - } - *cp = u; - return (TRUE); + unsigned int u; + + u = (*cp); + if (!xdr_u_int(xdrs, &u)) { + return (FALSE); + } + *cp = u; + return (TRUE); } /* @@ -337,25 +337,25 @@ bool_t xdr_u_char(XDR* xdrs, unsigned char* cp) */ bool_t xdr_bool(XDR *xdrs, bool_t *bp) { - long lb; + long lb; - switch (xdrs->x_op) { + switch (xdrs->x_op) { - case XDR_ENCODE: - lb = *bp ? XDR_TRUE : XDR_FALSE; - return (XDR_PUTLONG(xdrs, &lb)); + case XDR_ENCODE: + lb = *bp ? XDR_TRUE : XDR_FALSE; + return (XDR_PUTLONG(xdrs, &lb)); - case XDR_DECODE: - if (!XDR_GETLONG(xdrs, &lb)) { - return (FALSE); - } - *bp = (lb == XDR_FALSE) ? FALSE : TRUE; - return (TRUE); + case XDR_DECODE: + if (!XDR_GETLONG(xdrs, &lb)) { + return (FALSE); + } + *bp = (lb == XDR_FALSE) ? FALSE : TRUE; + return (TRUE); - case XDR_FREE: - return (TRUE); - } - return (FALSE); + case XDR_FREE: + return (TRUE); + } + return (FALSE); } /* @@ -363,10 +363,10 @@ bool_t xdr_bool(XDR *xdrs, bool_t *bp) */ bool_t xdr_enum(XDR *xdrs, enum_t *ep) { - /* - * enums are treated as ints - */ - return (xdr_long(xdrs, (long *) ep)); + /* + * enums are treated as ints + */ + return (xdr_long(xdrs, (long *) ep)); } /* @@ -376,45 +376,45 @@ bool_t xdr_enum(XDR *xdrs, enum_t *ep) */ bool_t xdr_opaque(XDR *xdrs, char* cp, unsigned int cnt) { - register unsigned int rndup; - static char crud[BYTES_PER_XDR_UNIT]; - - /* - * if no data we are done - */ - if (cnt == 0) - return (TRUE); - - /* - * round byte count to full xdr units - */ - rndup = cnt % BYTES_PER_XDR_UNIT; - if (rndup > 0) - rndup = BYTES_PER_XDR_UNIT - rndup; - - if (xdrs->x_op == XDR_DECODE) { - if (!XDR_GETBYTES(xdrs, cp, cnt)) { - return (FALSE); - } - if (rndup == 0) - return (TRUE); - return (XDR_GETBYTES(xdrs, crud, rndup)); - } - - if (xdrs->x_op == XDR_ENCODE) { - if (!XDR_PUTBYTES(xdrs, cp, cnt)) { - return (FALSE); - } - if (rndup == 0) - return (TRUE); - return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); - } - - if (xdrs->x_op == XDR_FREE) { - return (TRUE); - } - - return (FALSE); + register unsigned int rndup; + static char crud[BYTES_PER_XDR_UNIT]; + + /* + * if no data we are done + */ + if (cnt == 0) + return (TRUE); + + /* + * round byte count to full xdr units + */ + rndup = cnt % BYTES_PER_XDR_UNIT; + if (rndup > 0) + rndup = BYTES_PER_XDR_UNIT - rndup; + + if (xdrs->x_op == XDR_DECODE) { + if (!XDR_GETBYTES(xdrs, cp, cnt)) { + return (FALSE); + } + if (rndup == 0) + return (TRUE); + return (XDR_GETBYTES(xdrs, crud, rndup)); + } + + if (xdrs->x_op == XDR_ENCODE) { + if (!XDR_PUTBYTES(xdrs, cp, cnt)) { + return (FALSE); + } + if (rndup == 0) + return (TRUE); + return (XDR_PUTBYTES(xdrs, xdr_zero, rndup)); + } + + if (xdrs->x_op == XDR_FREE) { + return (TRUE); + } + + return (FALSE); } /* @@ -424,49 +424,49 @@ bool_t xdr_opaque(XDR *xdrs, char* cp, unsigned int cnt) */ bool_t xdr_bytes(XDR *xdrs, char** cpp, unsigned int *sizep, unsigned int maxsize) { - register char *sp = *cpp; /* sp is the actual string pointer */ - register unsigned int nodesize; - - /* - * first deal with the length since xdr bytes are counted - */ - if (!xdr_u_int(xdrs, sizep)) { - return (FALSE); - } - nodesize = *sizep; - if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { - return (FALSE); - } - - /* - * now deal with the actual bytes - */ - switch (xdrs->x_op) { - - case XDR_DECODE: - if (nodesize == 0) { - return (TRUE); - } - if (sp == NULL) { - *cpp = sp = (char *) rt_malloc(nodesize); - } - if (sp == NULL) { - rt_kprintf("xdr_bytes: out of memory\n"); - return (FALSE); - } - /* fall into ... */ - - case XDR_ENCODE: - return (xdr_opaque(xdrs, sp, nodesize)); - - case XDR_FREE: - if (sp != NULL) { - rt_free(sp); - *cpp = NULL; - } - return (TRUE); - } - return (FALSE); + register char *sp = *cpp; /* sp is the actual string pointer */ + register unsigned int nodesize; + + /* + * first deal with the length since xdr bytes are counted + */ + if (!xdr_u_int(xdrs, sizep)) { + return (FALSE); + } + nodesize = *sizep; + if ((nodesize > maxsize) && (xdrs->x_op != XDR_FREE)) { + return (FALSE); + } + + /* + * now deal with the actual bytes + */ + switch (xdrs->x_op) { + + case XDR_DECODE: + if (nodesize == 0) { + return (TRUE); + } + if (sp == NULL) { + *cpp = sp = (char *) rt_malloc(nodesize); + } + if (sp == NULL) { + rt_kprintf("xdr_bytes: out of memory\n"); + return (FALSE); + } + /* fall into ... */ + + case XDR_ENCODE: + return (xdr_opaque(xdrs, sp, nodesize)); + + case XDR_FREE: + if (sp != NULL) { + rt_free(sp); + *cpp = NULL; + } + return (TRUE); + } + return (FALSE); } /* @@ -474,7 +474,7 @@ bool_t xdr_bytes(XDR *xdrs, char** cpp, unsigned int *sizep, unsigned int maxsiz */ bool_t xdr_netobj(XDR *xdrs, struct netobj *np) { - return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); + return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); } /* @@ -490,30 +490,30 @@ bool_t xdr_netobj(XDR *xdrs, struct netobj *np) */ bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim* choices, xdrproc_t dfault) { - register enum_t dscm; - - /* - * we deal with the discriminator; it's an enum - */ - if (!xdr_enum(xdrs, dscmp)) { - return (FALSE); - } - dscm = *dscmp; - - /* - * search choices for a value that matches the discriminator. - * if we find one, execute the xdr routine for that value. - */ - for (; choices->proc != NULL_xdrproc_t; choices++) { - if (choices->value == dscm) - return ((*(choices->proc)) (xdrs, unp, LASTUNSIGNED)); - } - - /* - * no match - execute the default xdr routine if there is one - */ - return ((dfault == NULL_xdrproc_t) ? FALSE : - (*dfault) (xdrs, unp, LASTUNSIGNED)); + register enum_t dscm; + + /* + * we deal with the discriminator; it's an enum + */ + if (!xdr_enum(xdrs, dscmp)) { + return (FALSE); + } + dscm = *dscmp; + + /* + * search choices for a value that matches the discriminator. + * if we find one, execute the xdr routine for that value. + */ + for (; choices->proc != NULL_xdrproc_t; choices++) { + if (choices->value == dscm) + return ((*(choices->proc)) (xdrs, unp, LASTUNSIGNED)); + } + + /* + * no match - execute the default xdr routine if there is one + */ + return ((dfault == NULL_xdrproc_t) ? FALSE : + (*dfault) (xdrs, unp, LASTUNSIGNED)); } @@ -533,70 +533,70 @@ bool_t xdr_union(XDR* xdrs, enum_t* dscmp, char* unp, const struct xdr_discrim* */ bool_t xdr_string(XDR *xdrs, char **cpp, unsigned int maxsize) { - register char *sp = *cpp; /* sp is the actual string pointer */ - unsigned int size; - unsigned int nodesize; - - /* - * first deal with the length since xdr strings are counted-strings - */ - switch (xdrs->x_op) { - case XDR_FREE: - if (sp == NULL) { - return (TRUE); /* already free */ - } - /* fall through... */ - case XDR_ENCODE: - size = strlen(sp); - break; - } - if (!xdr_u_int(xdrs, &size)) { - return (FALSE); - } - if (size > maxsize) { - return (FALSE); - } - nodesize = size + 1; - - /* - * now deal with the actual bytes - */ - switch (xdrs->x_op) { - - case XDR_DECODE: - if (nodesize == 0) { - return (TRUE); - } - if (sp == NULL) - *cpp = sp = (char *) rt_malloc(nodesize); - if (sp == NULL) { - rt_kprintf("xdr_string: out of memory\n"); - return (FALSE); - } - sp[size] = 0; - /* fall into ... */ - - case XDR_ENCODE: - return (xdr_opaque(xdrs, sp, size)); - - case XDR_FREE: - rt_free(sp); - *cpp = NULL; - return (TRUE); - } - return (FALSE); + register char *sp = *cpp; /* sp is the actual string pointer */ + unsigned int size; + unsigned int nodesize; + + /* + * first deal with the length since xdr strings are counted-strings + */ + switch (xdrs->x_op) { + case XDR_FREE: + if (sp == NULL) { + return (TRUE); /* already free */ + } + /* fall through... */ + case XDR_ENCODE: + size = strlen(sp); + break; + } + if (!xdr_u_int(xdrs, &size)) { + return (FALSE); + } + if (size > maxsize) { + return (FALSE); + } + nodesize = size + 1; + + /* + * now deal with the actual bytes + */ + switch (xdrs->x_op) { + + case XDR_DECODE: + if (nodesize == 0) { + return (TRUE); + } + if (sp == NULL) + *cpp = sp = (char *) rt_malloc(nodesize); + if (sp == NULL) { + rt_kprintf("xdr_string: out of memory\n"); + return (FALSE); + } + sp[size] = 0; + /* fall into ... */ + + case XDR_ENCODE: + return (xdr_opaque(xdrs, sp, size)); + + case XDR_FREE: + rt_free(sp); + *cpp = NULL; + return (TRUE); + } + return (FALSE); } -/* - * Wrapper for xdr_string that can be called directly from +/* + * Wrapper for xdr_string that can be called directly from * routines like clnt_call */ bool_t xdr_wrapstring(XDR *xdrs, char **cpp) { - if (xdr_string(xdrs, cpp, LASTUNSIGNED)) { - return (TRUE); - } - return (FALSE); + if (xdr_string(xdrs, cpp, LASTUNSIGNED)) { + return (TRUE); + } + return (FALSE); } /* @@ -608,69 +608,69 @@ bool_t xdr_wrapstring(XDR *xdrs, char **cpp) */ bool_t xdr_array(XDR *xdrs, char **addrp, unsigned int *sizep, unsigned int maxsize, unsigned int elsize, xdrproc_t elproc) { - register unsigned int i; - register char* target = *addrp; - register unsigned int c; /* the actual element count */ - register bool_t stat = TRUE; - register unsigned int nodesize; - - /* like strings, arrays are really counted arrays */ - if (!xdr_u_int(xdrs, sizep)) { - return (FALSE); - } - c = *sizep; - if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) { - return (FALSE); - } - /* duh, look for integer overflow (fefe) */ - { - unsigned int i; - nodesize = 0; - for (i=c; i; --i) { - unsigned int tmp=nodesize+elsize; - if (tmpx_op) { - case XDR_DECODE: - if (c == 0) - return (TRUE); - *addrp = target = rt_malloc(nodesize); - if (target == NULL) { - rt_kprintf("xdr_array: out of memory\n"); - return (FALSE); - } - memset(target, 0, nodesize); - break; - - case XDR_FREE: - return (TRUE); - } - - /* - * now we xdr each element of array - */ - for (i = 0; (i < c) && stat; i++) { - stat = (*elproc) (xdrs, target, LASTUNSIGNED); - target += elsize; - } - - /* - * the array may need freeing - */ - if (xdrs->x_op == XDR_FREE) { - rt_free(*addrp); - *addrp = NULL; - } - return (stat); + register unsigned int i; + register char* target = *addrp; + register unsigned int c; /* the actual element count */ + register bool_t stat = TRUE; + register unsigned int nodesize; + + /* like strings, arrays are really counted arrays */ + if (!xdr_u_int(xdrs, sizep)) { + return (FALSE); + } + c = *sizep; + if ((c > maxsize) && (xdrs->x_op != XDR_FREE)) { + return (FALSE); + } + /* duh, look for integer overflow (fefe) */ + { + unsigned int i; + nodesize = 0; + for (i=c; i; --i) { + unsigned int tmp=nodesize+elsize; + if (tmpx_op) { + case XDR_DECODE: + if (c == 0) + return (TRUE); + *addrp = target = rt_malloc(nodesize); + if (target == NULL) { + rt_kprintf("xdr_array: out of memory\n"); + return (FALSE); + } + memset(target, 0, nodesize); + break; + + case XDR_FREE: + return (TRUE); + } + + /* + * now we xdr each element of array + */ + for (i = 0; (i < c) && stat; i++) { + stat = (*elproc) (xdrs, target, LASTUNSIGNED); + target += elsize; + } + + /* + * the array may need freeing + */ + if (xdrs->x_op == XDR_FREE) { + rt_free(*addrp); + *addrp = NULL; + } + return (stat); } /* @@ -685,17 +685,17 @@ bool_t xdr_array(XDR *xdrs, char **addrp, unsigned int *sizep, unsigned int maxs */ bool_t xdr_vector(XDR *xdrs, char *basep, unsigned int nelem, unsigned int elemsize, xdrproc_t xdr_elem) { - register unsigned int i; - register char *elptr; - - elptr = basep; - for (i = 0; i < nelem; i++) { - if (!(*xdr_elem) (xdrs, elptr, LASTUNSIGNED)) { - return (FALSE); - } - elptr += elemsize; - } - return (TRUE); + register unsigned int i; + register char *elptr; + + elptr = basep; + for (i = 0; i < nelem; i++) { + if (!(*xdr_elem) (xdrs, elptr, LASTUNSIGNED)) { + return (FALSE); + } + elptr += elemsize; + } + return (TRUE); } @@ -710,31 +710,31 @@ bool_t xdr_vector(XDR *xdrs, char *basep, unsigned int nelem, unsigned int elems */ bool_t xdr_reference(XDR *xdrs, char **pp, unsigned int size, xdrproc_t proc) { - register char* loc = *pp; - register bool_t stat; - - if (loc == NULL) - switch (xdrs->x_op) { - case XDR_FREE: - return (TRUE); - - case XDR_DECODE: - *pp = loc = (char*) rt_malloc(size); - if (loc == NULL) { - rt_kprintf("xdr_reference: out of memory\n"); - return (FALSE); - } - memset(loc, 0, (int) size); - break; - } - - stat = (*proc) (xdrs, loc, LASTUNSIGNED); - - if (xdrs->x_op == XDR_FREE) { - rt_free(loc); - *pp = NULL; - } - return (stat); + register char* loc = *pp; + register bool_t stat; + + if (loc == NULL) + switch (xdrs->x_op) { + case XDR_FREE: + return (TRUE); + + case XDR_DECODE: + *pp = loc = (char*) rt_malloc(size); + if (loc == NULL) { + rt_kprintf("xdr_reference: out of memory\n"); + return (FALSE); + } + memset(loc, 0, (int) size); + break; + } + + stat = (*proc) (xdrs, loc, LASTUNSIGNED); + + if (xdrs->x_op == XDR_FREE) { + rt_free(loc); + *pp = NULL; + } + return (stat); } @@ -760,15 +760,15 @@ bool_t xdr_reference(XDR *xdrs, char **pp, unsigned int size, xdrproc_t proc) bool_t xdr_pointer(XDR *xdrs, char **objpp, unsigned int obj_size, xdrproc_t xdr_obj) { - bool_t more_data; - - more_data = (*objpp != NULL); - if (!xdr_bool(xdrs, &more_data)) { - return (FALSE); - } - if (!more_data) { - *objpp = NULL; - return (TRUE); - } - return (xdr_reference(xdrs, objpp, obj_size, xdr_obj)); + bool_t more_data; + + more_data = (*objpp != NULL); + if (!xdr_bool(xdrs, &more_data)) { + return (FALSE); + } + if (!more_data) { + *objpp = NULL; + return (TRUE); + } + return (xdr_reference(xdrs, objpp, obj_size, xdr_obj)); } diff --git a/components/dfs/filesystems/nfs/rpc/xdr.h b/components/dfs/filesystems/nfs/rpc/xdr.h index fe38c4d12..d938f0eaa 100644 --- a/components/dfs/filesystems/nfs/rpc/xdr.h +++ b/components/dfs/filesystems/nfs/rpc/xdr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -93,7 +93,7 @@ enum xdr_op { /* * This is the number of bytes per unit of external data. */ -#define BYTES_PER_XDR_UNIT (4) +#define BYTES_PER_XDR_UNIT (4) /* * This only works if the above is a power of 2. But it's defined to be * 4 by the appropriate RFCs. So it will work. And it's normally quicker @@ -110,35 +110,35 @@ enum xdr_op { typedef struct XDR XDR; struct XDR { - enum xdr_op x_op; /* operation; fast additional param */ + enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { - bool_t (*x_getlong) (XDR *__xdrs, long *__lp); - /* get a long from underlying stream */ - bool_t (*x_putlong) (XDR *__xdrs, const long *__lp); - /* put a long to " */ - bool_t (*x_getbytes) (XDR *__xdrs, char* __addr, unsigned int __len); - /* get some bytes from " */ - bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, unsigned int __len); - /* put some bytes to " */ - unsigned int (*x_getpostn) (const XDR *__xdrs); - /* returns bytes off from beginning */ - bool_t (*x_setpostn) (XDR *__xdrs, unsigned int __pos); - /* lets you reposition the stream */ - int32_t *(*x_inline) (XDR *__xdrs, unsigned int __len); - /* buf quick ptr to buffered data */ - void (*x_destroy) (XDR *__xdrs); - /* free privates of this xdr_stream */ - bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip); - /* get a int from underlying stream */ - bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip); - /* put a int to " */ + bool_t (*x_getlong) (XDR *__xdrs, long *__lp); + /* get a long from underlying stream */ + bool_t (*x_putlong) (XDR *__xdrs, const long *__lp); + /* put a long to " */ + bool_t (*x_getbytes) (XDR *__xdrs, char* __addr, unsigned int __len); + /* get some bytes from " */ + bool_t (*x_putbytes) (XDR *__xdrs, const char *__addr, unsigned int __len); + /* put some bytes to " */ + unsigned int (*x_getpostn) (const XDR *__xdrs); + /* returns bytes off from beginning */ + bool_t (*x_setpostn) (XDR *__xdrs, unsigned int __pos); + /* lets you reposition the stream */ + int32_t *(*x_inline) (XDR *__xdrs, unsigned int __len); + /* buf quick ptr to buffered data */ + void (*x_destroy) (XDR *__xdrs); + /* free privates of this xdr_stream */ + bool_t (*x_getint32) (XDR *__xdrs, int32_t *__ip); + /* get a int from underlying stream */ + bool_t (*x_putint32) (XDR *__xdrs, const int32_t *__ip); + /* put a int to " */ } *x_ops; - char* x_public; /* users' data */ - char* x_private; /* pointer to private data */ - char* x_base; /* private used for position info */ - unsigned int x_handy; /* extra private word */ + char* x_public; /* users' data */ + char* x_private; /* pointer to private data */ + char* x_base; /* private used for position info */ + unsigned int x_handy; /* extra private word */ }; /* @@ -173,51 +173,51 @@ typedef bool_t (*xdrproc_t) (XDR *, void *,...); #define xdr_putint32(xdrs, int32p) \ (*(xdrs)->x_ops->x_putint32)(xdrs, int32p) -#define XDR_GETLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) -#define xdr_getlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, longp) - -#define XDR_PUTLONG(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) -#define xdr_putlong(xdrs, longp) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, longp) - -#define XDR_GETBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) -#define xdr_getbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) - -#define XDR_PUTBYTES(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) -#define xdr_putbytes(xdrs, addr, len) \ - (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) - -#define XDR_GETPOS(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) -#define xdr_getpos(xdrs) \ - (*(xdrs)->x_ops->x_getpostn)(xdrs) - -#define XDR_SETPOS(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) -#define xdr_setpos(xdrs, pos) \ - (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) - -#define XDR_INLINE(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) -#define xdr_inline(xdrs, len) \ - (*(xdrs)->x_ops->x_inline)(xdrs, len) - -#define XDR_DESTROY(xdrs) \ - do { \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs); \ - } while (0) -#define xdr_destroy(xdrs) \ - do { \ - if ((xdrs)->x_ops->x_destroy) \ - (*(xdrs)->x_ops->x_destroy)(xdrs); \ - } while (0) +#define XDR_GETLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) +#define xdr_getlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_getlong)(xdrs, longp) + +#define XDR_PUTLONG(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) +#define xdr_putlong(xdrs, longp) \ + (*(xdrs)->x_ops->x_putlong)(xdrs, longp) + +#define XDR_GETBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) +#define xdr_getbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len) + +#define XDR_PUTBYTES(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) +#define xdr_putbytes(xdrs, addr, len) \ + (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len) + +#define XDR_GETPOS(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) +#define xdr_getpos(xdrs) \ + (*(xdrs)->x_ops->x_getpostn)(xdrs) + +#define XDR_SETPOS(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) +#define xdr_setpos(xdrs, pos) \ + (*(xdrs)->x_ops->x_setpostn)(xdrs, pos) + +#define XDR_INLINE(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) +#define xdr_inline(xdrs, len) \ + (*(xdrs)->x_ops->x_inline)(xdrs, len) + +#define XDR_DESTROY(xdrs) \ + do { \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) +#define xdr_destroy(xdrs) \ + do { \ + if ((xdrs)->x_ops->x_destroy) \ + (*(xdrs)->x_ops->x_destroy)(xdrs); \ + } while (0) /* * Support struct for discriminated unions. @@ -261,10 +261,10 @@ struct xdr_discrim * and shouldn't be used any longer. Code which use this defines or longs * in the RPC code will not work on 64bit Solaris platforms ! */ -#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf)) -#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v))) -#define IXDR_GET_U_LONG(buf) ((unsigned long)IXDR_GET_LONG(buf)) -#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) +#define IXDR_GET_LONG(buf) ((long)IXDR_GET_U_INT32(buf)) +#define IXDR_PUT_LONG(buf, v) ((long)IXDR_PUT_INT32(buf, (long)(v))) +#define IXDR_GET_U_LONG(buf) ((unsigned long)IXDR_GET_LONG(buf)) +#define IXDR_PUT_U_LONG(buf, v) IXDR_PUT_LONG(buf, (long)(v)) #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) @@ -305,24 +305,24 @@ extern bool_t xdr_uint64_t (XDR *__xdrs, uint64_t *__up); extern bool_t xdr_bool (XDR *__xdrs, bool_t *__bp); extern bool_t xdr_enum (XDR *__xdrs, enum_t *__ep); extern bool_t xdr_array (XDR * _xdrs, char* *__addrp, unsigned int *__sizep, - unsigned int __maxsize, unsigned int __elsize, xdrproc_t __elproc); + unsigned int __maxsize, unsigned int __elsize, xdrproc_t __elproc); extern bool_t xdr_bytes (XDR *xdrs, char **cpp, unsigned int *sizep, - unsigned int maxsize); + unsigned int maxsize); extern bool_t xdr_opaque (XDR *__xdrs, char* __cp, unsigned int __cnt); extern bool_t xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize); extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp, - const struct xdr_discrim *__choices, - xdrproc_t dfault); + const struct xdr_discrim *__choices, + xdrproc_t dfault); extern bool_t xdr_char (XDR *__xdrs, char *__cp); extern bool_t xdr_u_char (XDR *__xdrs, unsigned char *__cp); extern bool_t xdr_vector (XDR *__xdrs, char *__basep, unsigned int __nelem, - unsigned int __elemsize, xdrproc_t __xdr_elem); + unsigned int __elemsize, xdrproc_t __xdr_elem); extern bool_t xdr_float (XDR *__xdrs, float *__fp); extern bool_t xdr_double (XDR *__xdrs, double *__dp); extern bool_t xdr_reference (XDR *__xdrs, char* *__xpp, unsigned int __size, - xdrproc_t __proc); + xdrproc_t __proc); extern bool_t xdr_pointer (XDR *__xdrs, char **__objpp, - unsigned int __obj_size, xdrproc_t __xdr_obj); + unsigned int __obj_size, xdrproc_t __xdr_obj); extern bool_t xdr_wrapstring (XDR *__xdrs, char **cpp); extern unsigned long xdr_sizeof (xdrproc_t, void *); @@ -346,13 +346,13 @@ extern bool_t xdr_netobj (XDR *__xdrs, struct netobj *__np); /* XDR using memory buffers */ extern void xdrmem_create (XDR *__xdrs, const char* __addr, - unsigned int __size, enum xdr_op __xop); + unsigned int __size, enum xdr_op __xop); /* XDR pseudo records for tcp */ extern void xdrrec_create (XDR *__xdrs, unsigned int __sendsize, - unsigned int __recvsize, char* __tcp_handle, - int (*__readit) (char *, char *, int), - int (*__writeit) (char *, char *, int)); + unsigned int __recvsize, char* __tcp_handle, + int (*__readit) (char *, char *, int), + int (*__writeit) (char *, char *, int)); /* make end of xdr record */ extern bool_t xdrrec_endofrecord (XDR *__xdrs, bool_t __sendnow); diff --git a/components/dfs/filesystems/nfs/rpc/xdr_mem.c b/components/dfs/filesystems/nfs/rpc/xdr_mem.c index ca69ed364..7bd4737e1 100644 --- a/components/dfs/filesystems/nfs/rpc/xdr_mem.c +++ b/components/dfs/filesystems/nfs/rpc/xdr_mem.c @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ -/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */ +/* @(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC */ /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape @@ -14,23 +14,23 @@ * may copy or modify Sun RPC without charge, but are not authorized * to license or distribute it to anyone else except as part of a product or * program developed by the user. - * + * * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE. - * + * * Sun RPC is provided with no support and without any obligation on the * part of Sun Microsystems, Inc. to assist in its use, correction, * modification or enhancement. - * + * * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC * OR ANY PART THEREOF. - * + * * In no event will Sun Microsystems, Inc. be liable for any lost revenue * or profits or other special, indirect and consequential damages, even if * Sun has been advised of the possibility of such damages. - * + * * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 @@ -65,30 +65,30 @@ static int32_t *xdrmem_inline (XDR *, unsigned int); static void xdrmem_destroy (XDR *); static struct xdr_ops xdrmem_ops = { - xdrmem_getlong, - xdrmem_putlong, - xdrmem_getbytes, - xdrmem_putbytes, - xdrmem_getpos, - xdrmem_setpos, - xdrmem_inline, - xdrmem_destroy, - NULL, - NULL + xdrmem_getlong, + xdrmem_putlong, + xdrmem_getbytes, + xdrmem_putbytes, + xdrmem_getpos, + xdrmem_setpos, + xdrmem_inline, + xdrmem_destroy, + NULL, + NULL }; /* * The procedure xdrmem_create initializes a stream descriptor for a - * memory buffer. + * memory buffer. */ void xdrmem_create (XDR *xdrs, const char* addr, unsigned int size, enum xdr_op op) { - xdrs->x_op = op; - xdrs->x_ops = &xdrmem_ops; - xdrs->x_private = xdrs->x_base = (char*)addr; - xdrs->x_handy = size; + xdrs->x_op = op; + xdrs->x_ops = &xdrmem_ops; + xdrs->x_private = xdrs->x_base = (char*)addr; + xdrs->x_handy = size; } static void @@ -140,7 +140,7 @@ xdrmem_putbytes (XDR *xdrs, const char *addr, unsigned int len) static unsigned int xdrmem_getpos (const XDR *xdrs) { - return ((unsigned long) xdrs->x_private - (unsigned long) xdrs->x_base); + return ((unsigned long) xdrs->x_private - (unsigned long) xdrs->x_base); } static bool_t xdrmem_setpos(XDR *xdrs, unsigned int pos) @@ -149,9 +149,9 @@ static bool_t xdrmem_setpos(XDR *xdrs, unsigned int pos) register char* lastaddr = xdrs->x_private + xdrs->x_handy; if ((long) newaddr > (long) lastaddr - || (UINT_MAX < LONG_MAX - && (long) UINT_MAX < (long) lastaddr - (long) newaddr)) - return (FALSE); + || (UINT_MAX < LONG_MAX + && (long) UINT_MAX < (long) lastaddr - (long) newaddr)) + return (FALSE); xdrs->x_private = newaddr; xdrs->x_handy = (long) lastaddr - (long) newaddr; return (TRUE); @@ -160,13 +160,13 @@ static bool_t xdrmem_setpos(XDR *xdrs, unsigned int pos) static int32_t * xdrmem_inline (XDR *xdrs, unsigned int len) { - int32_t *buf = 0; - - if (xdrs->x_handy >= len) { - xdrs->x_handy -= len; - buf = (int32_t *) xdrs->x_private; - xdrs->x_private += len; - } - return (buf); + int32_t *buf = 0; + + if (xdrs->x_handy >= len) { + xdrs->x_handy -= len; + buf = (int32_t *) xdrs->x_private; + xdrs->x_private += len; + } + return (buf); } diff --git a/components/dfs/filesystems/ramfs/dfs_ramfs.c b/components/dfs/filesystems/ramfs/dfs_ramfs.c index aa85081e1..cc58590de 100644 --- a/components/dfs/filesystems/ramfs/dfs_ramfs.c +++ b/components/dfs/filesystems/ramfs/dfs_ramfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/ramfs/dfs_ramfs.h b/components/dfs/filesystems/ramfs/dfs_ramfs.h index 4975ecb33..87adde99a 100644 --- a/components/dfs/filesystems/ramfs/dfs_ramfs.h +++ b/components/dfs/filesystems/ramfs/dfs_ramfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/romfs/dfs_romfs.c b/components/dfs/filesystems/romfs/dfs_romfs.c index dcc34e583..1b2693fc3 100644 --- a/components/dfs/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/filesystems/romfs/dfs_romfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -62,7 +62,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch return root_dirent; } - /* goto root directy entries */ + /* goto root directory entries */ dirent = (struct romfs_dirent *)root_dirent->data; dirent_size = root_dirent->size; diff --git a/components/dfs/filesystems/romfs/dfs_romfs.h b/components/dfs/filesystems/romfs/dfs_romfs.h index ba6a3d7df..affa4bf99 100644 --- a/components/dfs/filesystems/romfs/dfs_romfs.h +++ b/components/dfs/filesystems/romfs/dfs_romfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/romfs/romfs.c b/components/dfs/filesystems/romfs/romfs.c index cfce09a09..847fcc6e2 100644 --- a/components/dfs/filesystems/romfs/romfs.c +++ b/components/dfs/filesystems/romfs/romfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/skeleton/skeleton.c b/components/dfs/filesystems/skeleton/skeleton.c index 0c20513e8..b8dc06e9b 100644 --- a/components/dfs/filesystems/skeleton/skeleton.c +++ b/components/dfs/filesystems/skeleton/skeleton.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/skeleton/skeleton.h b/components/dfs/filesystems/skeleton/skeleton.h index 8a783eace..30c721d14 100644 --- a/components/dfs/filesystems/skeleton/skeleton.h +++ b/components/dfs/filesystems/skeleton/skeleton.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/filesystems/uffs/AUTHORS b/components/dfs/filesystems/uffs/AUTHORS deleted file mode 100644 index adaedefb4..000000000 --- a/components/dfs/filesystems/uffs/AUTHORS +++ /dev/null @@ -1 +0,0 @@ -Ricky Zheng diff --git a/components/dfs/filesystems/uffs/CMakeLists.txt b/components/dfs/filesystems/uffs/CMakeLists.txt deleted file mode 100644 index cc36f060e..000000000 --- a/components/dfs/filesystems/uffs/CMakeLists.txt +++ /dev/null @@ -1,27 +0,0 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6 ) -PROJECT( uffs ) - -SET(CMAKE_CXX_FLAGS_VGL "-O0 -g") -SET(CMAKE_C_FLAGS_VGL "-O0 -g") - -SET(CMAKE_C_FLAGS_GCOV "-g -O0 -Wall -fprofile-arcs -ftest-coverage") -SET(CMAKE_CXX_FLAGS_GCOV "-g -O0 -Wall -fprofile-arcs -ftest-coverage") -SET(CMAKE_EXE_LINKER_FLAGS_GCOV "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage -lgcov") - -IF (CMAKE_COMPILER_IS_GNUCC) -IF (APPLE) - SET(CMAKE_CXX_FLAGS "-fPIC -Wall -Werror -g -rdynamic") - SET(CMAKE_C_FLAGS "-fPIC -Wall -Werror -g -rdynamic") -ELSE () - SET(CMAKE_CXX_FLAGS "-fPIC -Wall -Werror -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-parameter-type -Woverride-init -Wtype-limits -Wuninitialized -g -rdynamic") - SET(CMAKE_C_FLAGS "-fPIC -Wall -Werror -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-parameter-type -Woverride-init -Wtype-limits -Wuninitialized -g -rdynamic") -ENDIF() -ENDIF() - -IF (UNIX) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIX") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUNIX") -ENDIF() - -ADD_SUBDIRECTORY( src ) - diff --git a/components/dfs/filesystems/uffs/COPYING b/components/dfs/filesystems/uffs/COPYING deleted file mode 100644 index d511905c1..000000000 --- a/components/dfs/filesystems/uffs/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/components/dfs/filesystems/uffs/Doxyfile b/components/dfs/filesystems/uffs/Doxyfile deleted file mode 100644 index f46a4c0af..000000000 --- a/components/dfs/filesystems/uffs/Doxyfile +++ /dev/null @@ -1,275 +0,0 @@ -# Doxyfile 1.4.1-KDevelop - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = uffs-doc -PROJECT_NUMBER = 0.1 -OUTPUT_DIRECTORY = doc/doxygen-doc -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = NO -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = YES -STRIP_FROM_PATH = ./ -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO -TAB_SIZE = 4 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -SUBGROUPING = YES -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = YES -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = NO -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = YES -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = YES -CASE_SENSE_NAMES = NO -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = YES -SORT_BY_SCOPE_NAME = YES -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ./src -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.C \ - *.CC \ - *.C++ \ - *.II \ - *.I++ \ - *.H \ - *.HH \ - *.H++ \ - *.CS \ - *.PHP \ - *.PHP3 \ - *.M \ - *.MM \ - *.C \ - *.H \ - *.tlh \ - *.diff \ - *.patch \ - *.moc \ - *.xpm \ - *.dox -RECURSIVE = YES -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = YES -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -VERBATIM_HEADERS = YES -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = uffs.tag -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/components/dfs/filesystems/uffs/README b/components/dfs/filesystems/uffs/README deleted file mode 100644 index 0828cf134..000000000 --- a/components/dfs/filesystems/uffs/README +++ /dev/null @@ -1,275 +0,0 @@ -UFFS: Ultra-low-cost Flash File System - -Project: http://uffs.sf.net/ -Blog: http://all-about-uffs.blogspot.com/ -Q/A: http://groups.google.com/group/uffs/ - -Author: Ricky Zheng - -INTRODUCTION ------------- - -UFFS is a nand flash file system designed for embedded system. - -UFFS have some unique and advanced features: - * Low cost: e.g. it needs only 41K bytes RAM for 64MB NAND flash (page size 2048). - - * Fast booting: it reads only a few spares from each block, typically - mounting a fully filled file system (Gbits) within one second. - - * Superb Reliability: - - The file system is designed for the embedded system which may - frequently lost power/reset without care. - - Journal file system, the file system will automatically rollback - to the last state when lost power on the middle of flash programing. - - When 'write' return without error, the data is guarenteed been - saved on flash. - - * Fast file create/read/write/seek. - * Bad-block tolerant, ECC enable and good ware-leveling. - * There is no garbage collection needed for UFFS. - * Support multiple NAND flash class in one system. - * Support bare flash hardware, no operating system needed. - * Support static memory allocation (works without 'malloc'). - * Fully simulated on PC (Windows/Linux) platform. - -Disadvantage: - * space inefficency for small files: UFFS use at least one - 'block'(the minial erase unit for NAND flash, e.g. 16K ) for a file. - * maximum supported blocks: 2^16 = 65535 - -Memory consuming example: - For page size = 512: - [VARY]Tree nodes: 16 * total_blocks - [CONST]Page Bufs: MAX_CACHED_BUFFERS(10) * (40 + pageSize(512)) = 5.4K - [CONST]Block Info caches: (24 + 14 * pages_per_block (32)) * MAX_CACHED_BLOCK_INFO (10) = 4.6K - - Example 1: 128M bytes NAND, 8192 blocks, total memory cost: - (16 * 8192)128K + 5.4K + 4.6K = 138K bytes. - - Example 2: 32M Bytes NAND, 2048 blocks, total memory cost: - (16 * 2048)32K + 5.4K + 4.6K = 42K bytes. - - Example 3: 16M bytes NAND, 1024 blocks, total memory cost: - (16 * 1024)16K + 5.4K + 4.6K = 26K bytes. - - For page size = 2048: - [VARY]Tree nodes: 16 * total_blocks - [CONST]Page Bufs: MAX_CACHED_BUFFERS(10) * (40 + pageSize(2048)) = 20.4K - [CONST]Block Info caches: (24 + 14 * pages_per_block (32)) * MAX_CACHED_BLOCK_INFO (10) = 4.6K - - Example 1: 512M bytes NAND, 8192 blocks, total memory cost: - (16 * 8192)128K + 20.4K + 4.6K = 153K bytes. - - Example 2: 128M Bytes NAND, 2048 blocks, total memory cost: - (16 * 2048)32K + 20.4K + 4.6K = 57K bytes. - - Example 3: 64M bytes NAND, 1024 blocks, total memory cost: - (16 * 1024)16K + 20.4K + 4.6K = 41K bytes. - - -BUILD SIMULATOR REQUIREMENT ---------------------------- -From V1.2.0, build uffs simulator requires 'cmake'. -'cmake' can be downloaded from: http://www.cmake.org/ - -or, under Debian/Ubuntu: - sudo apt-get install cmake - -BUILD SIMULATOR ON LINUX ------------------------- -1) create a 'build' dir: - -mkdir -p ~/build/uffs - -2) create Makefiles and build: - cd ~/build/uffs - cmake - make - -5) run simulator (interactive mode): - src/utils/mkuffs - - -BUILD SIMULATOR ON WINDOWS --------------------------- - -1) create a 'build' dir along with uffs source dir, - d:\build\uffs - -2) Create VC project files: - cd build\uffs - cmake - -3) Open uffs.dsw (or uffs.sln for VC > 6 ), compile & run. - - -LATEST SOURCE CODE ------------------- -You can get the latest source code from git repository: - git clone git://uffs.git.sourceforge.net/gitroot/uffs/uffs - - -CURRENT STATUS --------------- -UFFS 0.1.x is a working version on PC simulator, also has been ported to -uBase embedded OS as a 'real world' product for thousands of copies, -it works fine so far. - -UFFS 0.2.0 implementes full directory. - -UFFS 1.0.0 is the first stable release at sf.net. - -UFFS 1.1.0: support NAND flash with large page size (up to 2K). - -UFFS 1.1.1: bug fixes. a tool for making uffs disk image. - -UFFS 1.1.2: bug fixes. add more Flash Class. change Licence from GNU GPLv2 to GNU LGPLv2 - -UFFS 1.2.0: - - eliminate 'current path' and relatives. Now you should use absolute path in all - uffs APIs. For dir, the fullname should end with '/'. - - allow using static memory allocation, 'malloc' is no longer needed. - - using cmake for building simulator. - - bug fixes & minor changes. - -UFFS 1.2.1: - - improve bad block management - - bug fixes - - change Licence to modified GNU GPLv2. - -UFFS 1.3.0: - - improved flash interface - - support hardware ECC - - support user defined spare layout (for customized NAND flash controller) - - support 4K page size - - no partial page program required, support MLC NAND flash - - reduced buffer flushes by grouping buffers - - structual improvments and bug fixes - -UFFS v1.3.1: - - Tidy up three memory allocators: static, native and system. - - Fix bugs in flash interface example. - - Fix memory allocation bugs when using static memory allocator. - - Add flash driver interface 'WriteFullPage()'. - - Fix compilation errors for BlackFin DSP compiler. - -UFFS v1.3.2: - - Add POSIX like file system APIs. - - Bug fixes. - -UFFS v1.3.3: - - Change Flash Interface, simplify interface. - - Improved bad block handling. - - Better support for MLC NAND flash. - - Added hardware ECC and RS-ECC controller emulator. - - Bug fixes. - -UFFS v1.3.4 - - New UO_NOECC option for skipping ECC (fast reading). - - POSIX compliance uffs_seek(). - - Improved unclean page detection (add new 'seal' byte in spare area). - - Optional page data CRC. - - Bug fixes. - - Other improvements. - -LICENCE -------- - From v1.2.1, UFFS is released under a modified GNU GPLv2. (the same as eCos Licence) - The full licence text can be found in the header of source files: - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. - - -TESTING UFFS WITH SQLITE3 REGRESSION TEST CASES ------------------------------------------------ -UFFS can be tested with sqlite3 regression test cases (on Linux). - -1) install tcl8.5-dev on host PC: - apt-get install tcl8.5 tcl8.5-dev - - # make sure your Linux is using tcl8.5 as the default tclsh: - sudo update-alternatives --config tclsh - (select "tclsh8.5" from the list.) - -2) build uffs: - mkdir -p ~/build/uffs - cd ~/build/uffs - cmake - -3) build sqlite3: - cd /src/test/sqlite3/sqlite-src-3070900 - ./configure # create some build support files - git checkout -f Makefile config.h # restore modified Makefile and config.h - make test # start build 'testfixture' program. - - # now you'll see something like: - Connect: Connection refused - Assert (uffs_ret == ret && ret == bak_ret) fail at /home/.../src/test/api_test/os_uffs.c:os_unlink:329: unlink("/home/.../src/test/sqlite3/sqlite-src-3070900/./test.db-journal"), unix return 0, uffs return -1, bak return -1 - make: *** [test] Error 1 - -4) run test cases: - Open two terminals. - on termional A: - cd ~/build/uffs - src/utils/mkuffs -t 1024 - - #on uffs simulator command line, enter: - format / - apisrv - - on terminal B: - cd /src/test/sqlite3/sqlite-src-3070900 - ./test-uffs.sh - - Note: if you want to run mkuffs on another PC, for example, a Windows PC, you need to specify the IP address in test-uffs.sh. - - The test will take 1~4 hours, depends on how fast your Linux box is. - - -ACKNOWLEDGMENT ---------------- -Special thanks for your contributions to: -(list in no particular order) - -* Chen Jun -* Michail -* Sjpu -* RobertGray -* Dongbo -* Cag -* Sergey -* Chris Conrad -* Vladimir -* Thien Pham -* Emmanuel Blot -* Michael -* Mick D -* Paul -* Rogerz - - diff --git a/components/dfs/filesystems/uffs/SConscript b/components/dfs/filesystems/uffs/SConscript deleted file mode 100644 index 53f7713fc..000000000 --- a/components/dfs/filesystems/uffs/SConscript +++ /dev/null @@ -1,38 +0,0 @@ -# RT-Thread building script for component - -from building import * - -cwd = GetCurrentDir() - -src = Glob('*.c') - -uffs = Split(''' -src/uffs/uffs_badblock.c -src/uffs/uffs_blockinfo.c -src/uffs/uffs_buf.c -src/uffs/uffs_debug.c -src/uffs/uffs_device.c -src/uffs/uffs_ecc.c -src/uffs/uffs_crc.c -src/uffs/uffs_fd.c -src/uffs/uffs_find.c -src/uffs/uffs_flash.c -src/uffs/uffs_fs.c -src/uffs/uffs_init.c -src/uffs/uffs_mem.c -src/uffs/uffs_mtb.c -src/uffs/uffs_pool.c -src/uffs/uffs_public.c -src/uffs/uffs_tree.c -src/uffs/uffs_utils.c -src/uffs/uffs_version.c - -''') - -src = src + uffs - -CPPPATH = [cwd, cwd + '/src/inc'] - -group = DefineGroup('Filesystem', src , depend = ['RT_USING_DFS', 'RT_USING_DFS_UFFS'], CPPPATH = CPPPATH) - -Return('group') diff --git a/components/dfs/filesystems/uffs/TODO b/components/dfs/filesystems/uffs/TODO deleted file mode 100644 index bf6b4fb66..000000000 --- a/components/dfs/filesystems/uffs/TODO +++ /dev/null @@ -1,5 +0,0 @@ -TODO list for v1.3: - -* New API: int uffs_SkipObject(uffs_Object *obj, int size); -* Introduce buffer group -* Interface to Linux MTD diff --git a/components/dfs/filesystems/uffs/dfs_uffs.c b/components/dfs/filesystems/uffs/dfs_uffs.c deleted file mode 100644 index fb8caf9dd..000000000 --- a/components/dfs/filesystems/uffs/dfs_uffs.c +++ /dev/null @@ -1,660 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2011-10-22 prife the first version - * 2012-03-28 prife use mtd device interface - * 2012-04-05 prife update uffs with official repo and use uffs_UnMount/Mount - * 2017-04-12 lizhen9880 fix the f_bsize and f_blocks issue in function dfs_uffs_statfs - */ - -#include - -#include -#include -#include - -#include "dfs_uffs.h" - -#include "uffs/uffs_fd.h" /* posix file api is here */ -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_mem.h" -#include "uffs/uffs_utils.h" - -/* - * RT-Thread DFS Interface for uffs - */ -#define UFFS_DEVICE_MAX 2 /* the max partions on a nand deivce*/ -#define UFFS_MOUNT_PATH_MAX 128 /* the mount point max length */ -#define FILE_PATH_MAX 256 /* the longest file path */ - -struct _nand_dev -{ - struct rt_mtd_nand_device *dev; - struct uffs_StorageAttrSt storage; - uffs_Device uffs_dev; - uffs_MountTable mount_table; - char mount_path[UFFS_MOUNT_PATH_MAX]; - void *data; /* when uffs use static buf, it will save ptr here */ -}; -/* make sure the following struct var had been initilased to 0! */ -static struct _nand_dev nand_part[UFFS_DEVICE_MAX] = {0}; - -static int uffs_result_to_dfs(int result) -{ - int status = -1; - - result = result < 0 ? -result : result; - switch (result) - { - case UENOERR:/** no error */ - break; - case UEACCES:/** Tried to open read-only file for writing, or files sharing mode - does not allow specified operations, or given path is directory */ - status = -EINVAL; - break;/* no suitable */ - case UEEXIST: /** _O_CREAT and _O_EXCL flags specified, but filename already exists */ - status = -EEXIST; - break; - case UEINVAL: /** Invalid oflag or pmode argument */ - status = -EINVAL; - break; - case UEMFILE: /** No more file handles available(too many open files) */ - status = -1; - break; - case UENOENT: /** file or path not found */ - status = -ENOENT; - break; - case UETIME: /** can't set file time */ - status = -1; - break; - case UEBADF: /** invalid file handle */ - status = -EBADF; - break; - case UENOMEM:/** no enough memory */ - status = -ENOSPC; - break; - case UEIOERR: /** I/O error from lower level flash operation */ - status = -EIO; - break; - case UENOTDIR: /** Not a directory */ - status = -ENOTDIR; - break; - case UEISDIR: /** Is a directory */ - status = -EISDIR; - break; - case UEUNKNOWN_ERR: - default: - status = -1; - break; /* unknown error! */ - } - - return status; -} - -static URET _device_init(uffs_Device *dev) -{ - dev->attr->_private = NULL; // hook nand_chip data structure to attr->_private - dev->ops = (struct uffs_FlashOpsSt *)&nand_ops; - - return U_SUCC; -} - -static URET _device_release(uffs_Device *dev) -{ - return U_SUCC; -} - -static int init_uffs_fs( - struct _nand_dev *nand_part) -{ - uffs_MountTable *mtb; - struct rt_mtd_nand_device *nand; - struct uffs_StorageAttrSt *flash_storage; - - mtb = &nand_part->mount_table; - nand = nand_part->dev; - flash_storage = &nand_part->storage; - - /* setup nand storage attributes */ - uffs_setup_storage(flash_storage, nand); - - /* register mount table */ - if (mtb->dev) - { - /* set memory allocator for uffs */ -#if CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 0 - uffs_MemSetupSystemAllocator(&mtb->dev->mem); -#endif - /* setup device init/release entry */ - mtb->dev->Init = _device_init; - mtb->dev->Release = _device_release; - mtb->dev->attr = flash_storage; - - uffs_RegisterMountTable(mtb); - } - /* mount uffs partion on nand device */ - return uffs_Mount(nand_part->mount_path) == U_SUCC ? 0 : -1; -} - -static int dfs_uffs_mount( - struct dfs_filesystem *fs, - unsigned long rwflag, - const void *data) -{ - rt_base_t index; - uffs_MountTable *mount_part; - struct rt_mtd_nand_device *dev; - - RT_ASSERT(rt_strlen(fs->path) < (UFFS_MOUNT_PATH_MAX - 1)); - dev = RT_MTD_NAND_DEVICE(fs->dev_id); - - /*1. find a empty entry in partition table */ - for (index = 0; index < UFFS_DEVICE_MAX ; index ++) - { - if (nand_part[index].dev == RT_NULL) - break; - } - if (index == UFFS_DEVICE_MAX) - return -ENOENT; - - /*2. fill partition structure */ - nand_part[index].dev = dev; - - /* make a right mount path for uffs, end with '/' */ - rt_snprintf(nand_part[index].mount_path, UFFS_MOUNT_PATH_MAX, "%s/", fs->path); - if (nand_part[index].mount_path[1] == '/') - nand_part[index].mount_path[1] = 0; - - mount_part = &(nand_part[index].mount_table); - mount_part->mount = nand_part[index].mount_path; - mount_part->dev = &(nand_part[index].uffs_dev); - rt_memset(mount_part->dev, 0, sizeof(uffs_Device));//in order to make uffs happy. - mount_part->dev->_private = dev; /* save dev_id into uffs */ - mount_part->start_block = dev->block_start; - mount_part->end_block = dev->block_end; - /*3. mount uffs */ - if (init_uffs_fs(&nand_part[index]) < 0) - { - return uffs_result_to_dfs(uffs_get_error()); - } - return 0; -} - -static int dfs_uffs_unmount(struct dfs_filesystem *fs) -{ - rt_base_t index; - int result; - - /* find the device index and then unmount it */ - for (index = 0; index < UFFS_DEVICE_MAX; index++) - { - if (nand_part[index].dev == RT_MTD_NAND_DEVICE(fs->dev_id)) - { - nand_part[index].dev = RT_NULL; - result = uffs_UnMount(nand_part[index].mount_path); - if (result != U_SUCC) - break; - - result = uffs_UnRegisterMountTable(& nand_part[index].mount_table); - return (result == U_SUCC) ? RT_EOK : -1; - } - } - return -ENOENT; -} - -static int dfs_uffs_mkfs(rt_device_t dev_id) -{ - rt_base_t index; - rt_uint32_t block; - struct rt_mtd_nand_device *mtd; - - /*1. find the device index */ - for (index = 0; index < UFFS_DEVICE_MAX; index++) - { - if (nand_part[index].dev == (struct rt_mtd_nand_device *)dev_id) - break; - } - - if (index == UFFS_DEVICE_MAX) - { - /* can't find device driver */ - return -ENOENT; - } - - /*2. then unmount the partition */ - uffs_UnMount(nand_part[index].mount_path); - mtd = nand_part[index].dev; - - /*3. erase all blocks on the partition */ - block = mtd->block_start; - for (; block <= mtd->block_end; block++) - { - rt_mtd_nand_erase_block(mtd, block); -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - if (rt_mtd_nand_check_block(mtd, block) != RT_EOK) - { - rt_kprintf("found bad block %d\n", block); - rt_mtd_nand_mark_badblock(mtd, block); - } -#endif - } - - /*4. remount it */ - if (init_uffs_fs(&nand_part[index]) < 0) - { - return uffs_result_to_dfs(uffs_get_error()); - } - return RT_EOK; -} - -static int dfs_uffs_statfs(struct dfs_filesystem *fs, - struct statfs *buf) -{ - rt_base_t index; - struct rt_mtd_nand_device *mtd = RT_MTD_NAND_DEVICE(fs->dev_id); - - RT_ASSERT(mtd != RT_NULL); - - /* find the device index */ - for (index = 0; index < UFFS_DEVICE_MAX; index++) - { - if (nand_part[index].dev == (void *)mtd) - break; - } - if (index == UFFS_DEVICE_MAX) - return -ENOENT; - - buf->f_bsize = mtd->page_size * mtd->pages_per_block; - buf->f_blocks = (mtd->block_end - mtd->block_start + 1); - buf->f_bfree = uffs_GetDeviceFree(&nand_part[index].uffs_dev) / buf->f_bsize ; - - return 0; -} - -static int dfs_uffs_open(struct dfs_fd *file) -{ - int fd; - int oflag, mode; - char *file_path; - - oflag = file->flags; - if (oflag & O_DIRECTORY) /* operations about dir */ - { - uffs_DIR *dir; - - if (oflag & O_CREAT) /* create a dir*/ - { - if (uffs_mkdir(file->path) < 0) - return uffs_result_to_dfs(uffs_get_error()); - } - /* open dir */ - file_path = rt_malloc(FILE_PATH_MAX); - if (file_path == RT_NULL) - return -ENOMEM; - - if (file->path[0] == '/' && !(file->path[1] == 0)) - rt_snprintf(file_path, FILE_PATH_MAX, "%s/", file->path); - else - { - file_path[0] = '/'; - file_path[1] = 0; - } - - dir = uffs_opendir(file_path); - - if (dir == RT_NULL) - { - rt_free(file_path); - return uffs_result_to_dfs(uffs_get_error()); - } - /* save this pointer,will used by dfs_uffs_getdents*/ - file->data = dir; - rt_free(file_path); - return RT_EOK; - } - /* regular file operations */ - /* int uffs_open(const char *name, int oflag, ...); what is this? - * uffs_open can open dir!! **/ - mode = 0; - if (oflag & O_RDONLY) mode |= UO_RDONLY; - if (oflag & O_WRONLY) mode |= UO_WRONLY; - if (oflag & O_RDWR) mode |= UO_RDWR; - /* Opens the file, if it is existing. If not, a new file is created. */ - if (oflag & O_CREAT) mode |= UO_CREATE; - /* Creates a new file. If the file is existing, it is truncated and overwritten. */ - if (oflag & O_TRUNC) mode |= UO_TRUNC; - /* Creates a new file. The function fails if the file is already existing. */ - if (oflag & O_EXCL) mode |= UO_EXCL; - - fd = uffs_open(file->path, mode); - if (fd < 0) - { - return uffs_result_to_dfs(uffs_get_error()); - } - - /* save this pointer, it will be used when calling read(), write(), - * flush(), seek(), and will be free when calling close()*/ - - file->data = (void *)fd; - file->pos = uffs_seek(fd, 0, USEEK_CUR); - file->size = uffs_seek(fd, 0, USEEK_END); - uffs_seek(fd, file->pos, USEEK_SET); - - if (oflag & O_APPEND) - { - file->pos = uffs_seek(fd, 0, USEEK_END); - } - return 0; -} - -static int dfs_uffs_close(struct dfs_fd *file) -{ - int oflag; - int fd; - - oflag = file->flags; - if (oflag & O_DIRECTORY) - { - /* operations about dir */ - if (uffs_closedir((uffs_DIR *)(file->data)) < 0) - return uffs_result_to_dfs(uffs_get_error()); - - return 0; - } - /* regular file operations */ - fd = (int)(file->data); - - if (uffs_close(fd) == 0) - return 0; - - return uffs_result_to_dfs(uffs_get_error()); -} - -static int dfs_uffs_ioctl(struct dfs_fd *file, int cmd, void *args) -{ - return -ENOSYS; -} - -static int dfs_uffs_read(struct dfs_fd *file, void *buf, size_t len) -{ - int fd; - int char_read; - - fd = (int)(file->data); - char_read = uffs_read(fd, buf, len); - if (char_read < 0) - return uffs_result_to_dfs(uffs_get_error()); - - /* update position */ - file->pos = uffs_seek(fd, 0, USEEK_CUR); - return char_read; -} - -static int dfs_uffs_write(struct dfs_fd *file, - const void *buf, - size_t len) -{ - int fd; - int char_write; - - fd = (int)(file->data); - - char_write = uffs_write(fd, buf, len); - if (char_write < 0) - return uffs_result_to_dfs(uffs_get_error()); - - /* update position */ - file->pos = uffs_seek(fd, 0, USEEK_CUR); - return char_write; -} - -static int dfs_uffs_flush(struct dfs_fd *file) -{ - int fd; - int result; - - fd = (int)(file->data); - - result = uffs_flush(fd); - if (result < 0) - return uffs_result_to_dfs(uffs_get_error()); - return 0; -} - -int uffs_seekdir(uffs_DIR *dir, long offset) -{ - int i = 0; - - while (i < offset) - { - if (uffs_readdir(dir) == RT_NULL) - return -1; - i++; - } - return 0; -} - - -static int dfs_uffs_seek(struct dfs_fd *file, - rt_off_t offset) -{ - int result; - - /* set offset as current offset */ - if (file->type == FT_DIRECTORY) - { - uffs_rewinddir((uffs_DIR *)(file->data)); - result = uffs_seekdir((uffs_DIR *)(file->data), offset / sizeof(struct dirent)); - if (result >= 0) - { - file->pos = offset; - return offset; - } - } - else if (file->type == FT_REGULAR) - { - result = uffs_seek((int)(file->data), offset, USEEK_SET); - if (result >= 0) - return offset; - } - - return uffs_result_to_dfs(uffs_get_error()); -} - -/* return the size of struct dirent*/ -static int dfs_uffs_getdents( - struct dfs_fd *file, - struct dirent *dirp, - uint32_t count) -{ - rt_uint32_t index; - char *file_path; - struct dirent *d; - uffs_DIR *dir; - struct uffs_dirent *uffs_d; - - dir = (uffs_DIR *)(file->data); - RT_ASSERT(dir != RT_NULL); - - /* round count, count is always 1 */ - count = (count / sizeof(struct dirent)) * sizeof(struct dirent); - if (count == 0) return -EINVAL; - - /* allocate file name */ - file_path = rt_malloc(FILE_PATH_MAX); - if (file_path == RT_NULL) - return -ENOMEM; - - index = 0; - /* usually, the while loop should only be looped only once! */ - while (1) - { - struct uffs_stat s; - - d = dirp + index; - - uffs_d = uffs_readdir(dir); - if (uffs_d == RT_NULL) - { - rt_free(file_path); - return (uffs_result_to_dfs(uffs_get_error())); - } - - if (file->path[0] == '/' && !(file->path[1] == 0)) - rt_snprintf(file_path, FILE_PATH_MAX, "%s/%s", file->path, uffs_d->d_name); - else - rt_strncpy(file_path, uffs_d->d_name, FILE_PATH_MAX); - - uffs_stat(file_path, &s); - switch (s.st_mode & US_IFMT) /* file type mark */ - { - case US_IFREG: /* directory */ - d->d_type = DT_REG; - break; - case US_IFDIR: /* regular file */ - d->d_type = DT_DIR; - break; - case US_IFLNK: /* symbolic link */ - case US_IREAD: /* read permission */ - case US_IWRITE:/* write permission */ - default: - d->d_type = DT_UNKNOWN; - break; - } - - /* write the rest args of struct dirent* dirp */ - d->d_namlen = rt_strlen(uffs_d->d_name); - d->d_reclen = (rt_uint16_t)sizeof(struct dirent); - rt_strncpy(d->d_name, uffs_d->d_name, rt_strlen(uffs_d->d_name) + 1); - - index ++; - if (index * sizeof(struct dirent) >= count) - break; - } - - /* free file name buf */ - rt_free(file_path); - - if (index == 0) - return uffs_result_to_dfs(uffs_get_error()); - - file->pos += index * sizeof(struct dirent); - - return index * sizeof(struct dirent); -} - -static int dfs_uffs_unlink(struct dfs_filesystem *fs, const char *path) -{ - int result; - struct uffs_stat s; - - /* judge file type, dir is to be delete by uffs_rmdir, others by uffs_remove */ - if (uffs_lstat(path, &s) < 0) - { - return uffs_result_to_dfs(uffs_get_error()); - } - - switch (s.st_mode & US_IFMT) - { - case US_IFREG: - result = uffs_remove(path); - break; - case US_IFDIR: - result = uffs_rmdir(path); - break; - default: - /* unknown file type */ - return -1; - } - if (result < 0) - return uffs_result_to_dfs(uffs_get_error()); - - return 0; -} - -static int dfs_uffs_rename( - struct dfs_filesystem *fs, - const char *oldpath, - const char *newpath) -{ - int result; - - result = uffs_rename(oldpath, newpath); - if (result < 0) - return uffs_result_to_dfs(uffs_get_error()); - - return 0; -} - -static int dfs_uffs_stat(struct dfs_filesystem *fs, const char *path, struct stat *st) -{ - int result; - struct uffs_stat s; - - result = uffs_stat(path, &s); - if (result < 0) - return uffs_result_to_dfs(uffs_get_error()); - - /* convert uffs stat to dfs stat structure */ - /* FIXME, these field may not be the same */ - st->st_dev = 0; - st->st_mode = s.st_mode; - st->st_size = s.st_size; - st->st_mtime = s.st_mtime; - - return 0; -} - -static const struct dfs_file_ops dfs_uffs_fops = -{ - dfs_uffs_open, - dfs_uffs_close, - dfs_uffs_ioctl, - dfs_uffs_read, - dfs_uffs_write, - dfs_uffs_flush, - dfs_uffs_seek, - dfs_uffs_getdents, -}; - -static const struct dfs_filesystem_ops dfs_uffs_ops = -{ - "uffs", /* file system type: uffs */ -#if RTTHREAD_VERSION >= 10100 - DFS_FS_FLAG_FULLPATH, -#else -#error "uffs can only work with rtthread whose version should >= 1.01\n" -#endif - &dfs_uffs_fops, - - dfs_uffs_mount, - dfs_uffs_unmount, - dfs_uffs_mkfs, - dfs_uffs_statfs, - - dfs_uffs_unlink, - dfs_uffs_stat, - dfs_uffs_rename, -}; - -int dfs_uffs_init(void) -{ - /* register uffs file system */ - dfs_register(&dfs_uffs_ops); - - if (uffs_InitObjectBuf() == U_SUCC) - { - if (uffs_DirEntryBufInit() == U_SUCC) - { - uffs_InitGlobalFsLock(); - return RT_EOK; - } - } - return -RT_ERROR; -} -INIT_COMPONENT_EXPORT(dfs_uffs_init); - diff --git a/components/dfs/filesystems/uffs/dfs_uffs.h b/components/dfs/filesystems/uffs/dfs_uffs.h deleted file mode 100644 index 72f0ee924..000000000 --- a/components/dfs/filesystems/uffs/dfs_uffs.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2012-03-30 prife the first version - */ - -#ifndef DFS_UFFS_H_ -#define DFS_UFFS_H_ - -#include "uffs_config.h" -#include "uffs/uffs_public.h" - -/* the UFFS ECC mode opitons */ -#ifndef RT_UFFS_ECC_MODE -#define RT_UFFS_ECC_MODE 1 -#endif - -/* - * RT_UFFS_ECC_MODE: - * 0, Do not use ECC - * 1, UFFS calculate the ECC - * 2, Flash driver(or by hardware) calculate the ECC - * 3, Hardware calculate the ECC and automatically write to spare. - */ -#if RT_UFFS_ECC_MODE == 0 -#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE -#elif RT_UFFS_ECC_MODE == 1 -#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT -#elif RT_UFFS_ECC_MODE == 2 -#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW -#elif RT_UFFS_ECC_MODE == 3 -#define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW_AUTO -#endif - -/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_HW_AUTO */ -/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_SOFT */ -/* #define RT_CONFIG_UFFS_ECC_MODE UFFS_ECC_NONE */ - -/* enable this ,you need provide a mark_badblock/check_block funciton */ -/* #define RT_UFFS_USE_CHECK_MARK_FUNCITON */ - -#if RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT /* let uffs do soft ecc */ -#define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */ - -#elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO /* nand driver make ecc and do ecc correct */ -#define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_FLASH - -#elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_NONE -#define RT_CONFIG_UFFS_LAYOUT UFFS_LAYOUT_UFFS /* UFFS_LAYOUT_FLASH */ - -#else -#error "uffs under rt-thread do not support this ECC mode" -#endif /* RT_CONFIG_UFFS_ECC_MODE */ - -#if (!CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR) -#define RT_UFFS_MEMORY_ALLOCATOR 1 /* use system memory allocator */ -#elif (CONFIG_USE_STATIC_MEMORY_ALLOCATOR) && (!CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR) -#define RT_UFFS_MEMORY_ALLOCATOR 0 /* use static memory allocator */ -#else -#error "UFFS: CONFIG_USE_STATIC_MEMORY_ALLOCATOR ,CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR are invalid!" -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0 -#error "dfs_uffs only support CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR" -#endif - -#if defined(CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME) -#error "dfs_uffs not support CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME" -#endif - -#if (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_FLASH) -#error "when use UFFS_ECC_HW_AUTO, you must use UFFS_LAYOUT_FLASH" - -#elif (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT) && (RT_CONFIG_UFFS_LAYOUT != UFFS_LAYOUT_UFFS) -#warning "when use UFFS_ECC_SOFT, it is recommended to use UFFS_LAYOUT_UFFS" -#endif - -extern const uffs_FlashOps nand_ops; - -extern void uffs_setup_storage( - struct uffs_StorageAttrSt *attr, - struct rt_mtd_nand_device *nand); - -extern int dfs_uffs_init(void); -#endif /* DFS_UFFS_H_ */ diff --git a/components/dfs/filesystems/uffs/doc/Understanding-UFFS.odp b/components/dfs/filesystems/uffs/doc/Understanding-UFFS.odp deleted file mode 100644 index b39f4d0f320d781dc1ef2e793491150701f9a814..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 369408 zcmeFYbyOWq(=R%(H|_)t9w4~8LkO;c;O+r}yIX)jHXa}ZcL)~T-Q8V+Z`@rk&uia% zzV)7S&pH3ywQjBM>6)IZ+P|)u*)3D8EC&MP001HYh;sXgaJ(%pU;zN&ul!O4*jU<_ zIeXZf8QI%^wlpzvwzRWlakVvNwli|FbYix%H?uXhGjXvovvp>+cQkW)DgP#;{683d zvGXr_{lbac*_vBgxH$ez)QO$N=|#!K$=Jw|tQgv&n~@t^dF|HH4@JK9;ic<$et|DQDf6VAVW?7y7$zpLeJXZQJktwr`9 zP+Hm;S(rJoyt8z+F|v31Z%rJvH}1T300VzzrWa*pOA}|8mo~AmvHlyev$Oy0jDww3 zT#WZUny7n)8+e-!jcmRk-0KhLC>kBxT zn7{KdFFHWRKk8qa0F&`wHemn3zj*-$`Ug+`BK~)R2SES8@nZR3SOxzL>-+zP6$bY2 znB-sTVgJEnzx}7Z_m&ox&PJcfl|R`z+mS0f+L^yRC@-&|(PseAf6;hJ|0?|-kO9n> zx8$GYi(eOkF8~M@_OJ9p;Fko42nPoS!yzLez$2m}q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9$h5h-HSJhuzMMzMMj^g?Z>HBmTsD z2!$RP$qH_SJ)a2|kp8u9ygpEV(F`bVxb`*;= zv94s_Yvd+^TVHZwW%Y=cV@doMNlK;PE#*>C-L0E>8UL}qTStuNSP2Qzj6WYMa~JVQ zO5G<=G|S@%@qt;&jEa1_hl%2wycOCT{QF-Tf+D#dA+pngGM=>IQILt&hz;!P$~iqM z4jamjg`AL9q!za(Br=bi^mJ;Z)F~i++erj<+eMemc(u3j_-Z=5+3h7nDfo}ZrQ6T= z@TKE70b>S2hedsa*#HzOiAc%c*IB+=`9b=I!%87$488LEV?i9Oy&hbY`V0KcxKU3Y zu=oV^&r1s%kTYH9#aoIEcQ<#Dubd@R=~r1qgz1>nif1zgrt1%F=<#*dXkXX}4MJXB z%Q5pCvQv1Yck%bt$bHDRnpt6=rs3tSu(;9Sn3rN&CWt0@MK?2FM|$_Y*Q3wtNH%De z+XjBO1#nJ9p0IxuSx;gmz7+NAp@@kjiT?%A?+BusVE6IuChl7TuK}~q7_Y6GJ#H?a8(j^Jq@uN91azG=oRTCUZNz7?b>Qu

*/ -static int cmd_mkdir(int argc, char *argv[]) -{ - const char *name; - - CHK_ARGC(2, 0); - - name = argv[1]; - - if (uffs_mkdir(name) < 0) { - MSGLN("Create %s fail, err: %d", name, uffs_get_error()); - return -1; - } - else { - MSGLN("Create %s succ.", name); - } - - return 0; -} - - -static int CountObjectUnder(const char *dir) -{ - int count = 0; - uffs_DIR *dirp; - - dirp = uffs_opendir(dir); - if (dirp) { - while (uffs_readdir(dirp) != NULL) - count++; - uffs_closedir(dirp); - } - return count; -} - -static int cmd_pwd(int argc, char *argv[]) -{ - MSGLN("not supported."); - return 0; -} - -static int cmd_cd(int argc, char *argv[]) -{ - MSGLN("Not supported"); - return 0; -} - -/** ls [] */ -static int cmd_ls(int argc, char *argv[]) -{ - uffs_DIR *dirp; - struct uffs_dirent *ent; - struct uffs_stat stat_buf; - int count = 0; - char buf[MAX_PATH_LENGTH+2]; - const char *name = "/"; - char *sub; - int ret = 0; - - CHK_ARGC(1, 2); - - if (argc > 1) - name = argv[1]; - - dirp = uffs_opendir(name); - if (dirp == NULL) { - MSGLN("Can't open '%s' for list", name); - ret = -1; - } - else { - MSG("------name-----------size---------serial-----" TENDSTR); - ent = uffs_readdir(dirp); - while (ent) { - MSG("%9s", ent->d_name); - strcpy(buf, name); - sub = buf; - if (name[strlen(name)-1] != '/') - sub = strcat(buf, "/"); - sub = strcat(sub, ent->d_name); - if (ent->d_type & FILE_ATTR_DIR) { - sub = strcat(sub, "/"); - MSG("/ \t<%8d>", CountObjectUnder(sub)); - } - else { - uffs_stat(sub, &stat_buf); - MSG(" \t %8d ", stat_buf.st_size); - } - MSG("\t%6d" TENDSTR, ent->d_ino); - count++; - ent = uffs_readdir(dirp); - } - - uffs_closedir(dirp); - - MSG("Total: %d objects." TENDSTR, count); - } - - return ret; -} - -/** rm */ -static int cmd_rm(int argc, char *argv[]) -{ - const char *name = NULL; - int ret = 0; - struct uffs_stat st; - - CHK_ARGC(2, 2); - - name = argv[1]; - - ret = uffs_stat(name, &st); - if (ret < 0) { - MSGLN("Can't stat '%s'", name); - return ret; - } - - if (st.st_mode & US_IFDIR) { - ret = uffs_rmdir(name); - } - else { - ret = uffs_remove(name); - } - - if (ret == 0) - MSGLN("Delete '%s' succ.", name); - else - MSGLN("Delete '%s' fail!", name); - - return ret; -} - -/** ren|mv */ -static int cmd_ren(int argc, char *argv[]) -{ - const char *oldname; - const char *newname; - int ret; - - CHK_ARGC(3, 3); - - oldname = argv[1]; - newname = argv[2]; - - if ((ret = uffs_rename(oldname, newname)) == 0) { - MSGLN("Rename from '%s' to '%s' succ.", oldname, newname); - } - else { - MSGLN("Rename from '%s' to '%s' fail!", oldname, newname); - } - - return ret; -} - -static void dump_msg_to_stdout(struct uffs_DeviceSt *dev, const char *fmt, ...) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - va_list args; - - va_start(args, fmt); - //vprintf(fmt, args); - if (emu && emu->dump_fp) - vfprintf(emu->dump_fp, fmt, args); - va_end(args); -} - -/** dump [] */ -static int cmd_dump(int argc, char *argv[]) -{ - uffs_Device *dev; - uffs_FileEmu *emu; - const char *mount = "/"; - const char *dump_file = "dump.txt"; - - if (argc > 1) { - mount = argv[1]; - if (argc > 2) - dump_file = argv[2]; - } - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point %s", mount); - return -1; - } - - emu = (uffs_FileEmu *)(dev->attr->_private); - emu->dump_fp = fopen(dump_file, "w"); - - uffs_DumpDevice(dev, dump_msg_to_stdout); - - if (emu->dump_fp) - fclose(emu->dump_fp); - - uffs_PutDevice(dev); - - return 0; -} - -/** st [] */ -static int cmd_st(int argc, char *argv[]) -{ - uffs_Device *dev; - const char *mount = "/"; - uffs_FlashStat *s; - TreeNode *node; - - if (argc > 1) { - mount = argv[1]; - } - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point %s", mount); - return -1; - } - - s = &(dev->st); - - MSG("----------- basic info -----------" TENDSTR); - MSG("TreeNode size: %d" TENDSTR, sizeof(TreeNode)); - MSG("TagStore size: %d" TENDSTR, sizeof(struct uffs_TagStoreSt)); - MSG("MaxCachedBlockInfo: %d" TENDSTR, dev->cfg.bc_caches); - MSG("MaxPageBuffers: %d" TENDSTR, dev->cfg.page_buffers); - MSG("MaxDirtyPagesPerBlock: %d" TENDSTR, dev->cfg.dirty_pages); - MSG("MaxPathLength: %d" TENDSTR, MAX_PATH_LENGTH); - MSG("MaxObjectHandles: %d" TENDSTR, MAX_OBJECT_HANDLE); - MSG("FreeObjectHandles: %d" TENDSTR, uffs_GetFreeObjectHandlers()); - MSG("MaxDirHandles: %d" TENDSTR, MAX_DIR_HANDLE); - MSG("FreeDirHandles: %d" TENDSTR, uffs_PoolGetFreeCount(uffs_DirEntryBufGetPool())); - - MSG("----------- statistics for '%s' -----------" TENDSTR, mount); - MSG("Device Ref: %d" TENDSTR, dev->ref_count); - MSG("Block Erased: %d" TENDSTR, s->block_erase_count); - MSG("Write Page: %d" TENDSTR, s->page_write_count); - MSG("Write Spare: %d" TENDSTR, s->spare_write_count); - MSG("Read Page: %d" TENDSTR, s->page_read_count - s->page_header_read_count); - MSG("Read Header: %d" TENDSTR, s->page_header_read_count); - MSG("Read Spare: %d" TENDSTR, s->spare_read_count); - MSG("I/O Read: %lu" TENDSTR, s->io_read); - MSG("I/O Write: %lu" TENDSTR, s->io_write); - - MSG("--------- partition info for '%s' ---------" TENDSTR, mount); - MSG("Space total: %d" TENDSTR, uffs_GetDeviceTotal(dev)); - MSG("Space used: %d" TENDSTR, uffs_GetDeviceUsed(dev)); - MSG("Space free: %d" TENDSTR, uffs_GetDeviceFree(dev)); - MSG("Page Size: %d" TENDSTR, dev->attr->page_data_size); - MSG("Spare Size: %d" TENDSTR, dev->attr->spare_size); - MSG("Pages Per Block: %d" TENDSTR, dev->attr->pages_per_block); - MSG("Block size: %d" TENDSTR, dev->attr->page_data_size * dev->attr->pages_per_block); - MSG("Total blocks: %d of %d" TENDSTR, (dev->par.end - dev->par.start + 1), dev->attr->total_blocks); - if (dev->tree.bad) { - MSG("Bad blocks: "); - node = dev->tree.bad; - while(node) { - MSG("%d, ", node->u.list.block); - node = node->u.list.next; - } - MSG(TENDSTR); - } - - uffs_PutDevice(dev); - - return 0; - -} - -/** cp */ -static int cmd_cp(int argc, char *argv[]) -{ - const char *src; - const char *des; - char buf[100]; - int fd1 = -1, fd2 = -1; - int len; - BOOL src_local = FALSE, des_local = FALSE; - FILE *fp1 = NULL, *fp2 = NULL; - int ret = -1; - - CHK_ARGC(3, 3); - - src = argv[1]; - des = argv[2]; - - if (memcmp(src, "::", 2) == 0) { - src += 2; - src_local = TRUE; - } - if (memcmp(des, "::", 2) == 0) { - des += 2; - des_local = TRUE; - } - - if (src_local) { - if ((fp1 = fopen(src, "rb")) == NULL) { - MSGLN("Can't open %s for copy.", src); - goto fail_ext; - } - } - else { - if ((fd1 = uffs_open(src, UO_RDONLY)) < 0) { - MSGLN("Can't open %s for copy.", src); - goto fail_ext; - } - } - - if (des_local) { - if ((fp2 = fopen(des, "wb")) == NULL) { - MSGLN("Can't open %s for copy.", des); - goto fail_ext; - } - } - else { - if ((fd2 = uffs_open(des, UO_RDWR|UO_CREATE|UO_TRUNC)) < 0) { - MSGLN("Can't open %s for copy.", des); - goto fail_ext; - } - } - - ret = 0; - while ( (src_local ? (feof(fp1) == 0) : (uffs_eof(fd1) == 0)) ) { - ret = -1; - if (src_local) { - len = fread(buf, 1, sizeof(buf), fp1); - } - else { - len = uffs_read(fd1, buf, sizeof(buf)); - } - if (len == 0) { - ret = -1; - break; - } - if (len < 0) { - MSGLN("read file %s fail ?", src); - break; - } - if (des_local) { - if ((int)fwrite(buf, 1, len, fp2) != len) { - MSGLN("write file %s fail ? ", des); - break; - } - } - else { - if (uffs_write(fd2, buf, len) != len) { - MSGLN("write file %s fail ? ", des); - break; - } - } - ret = 0; - } - -fail_ext: - if (fd1 > 0) - uffs_close(fd1); - if (fd2 > 0) - uffs_close(fd2); - if (fp1) - fclose(fp1); - if (fp2) - fclose(fp2); - - return ret; -} - -/** cat [] [] */ -static int cmd_cat(int argc, char *argv[]) -{ - int fd; - const char *name = NULL; - char buf[100]; - int start = 0, size = 0, printed = 0, n, len; - int ret = -1; - - CHK_ARGC(2, 4); - - name = argv[1]; - - if ((fd = uffs_open(name, UO_RDONLY)) < 0) { - MSGLN("Can't open %s", name); - goto fail; - } - - if (argc > 2) { - start = strtol(argv[2], NULL, 10); - if (argc > 3) size = strtol(argv[3], NULL, 10); - } - - if (start >= 0) - uffs_seek(fd, start, USEEK_SET); - else - uffs_seek(fd, -start, USEEK_END); - - while (uffs_eof(fd) == 0) { - len = uffs_read(fd, buf, sizeof(buf) - 1); - if (len == 0) - break; - if (len > 0) { - if (size == 0 || printed < size) { - n = (size == 0 ? len : (size - printed > len ? len : size - printed)); - buf[n] = 0; - MSG("%s", buf); - printed += n; - } - else { - break; - } - } - } - MSG(TENDSTR); - uffs_close(fd); - - ret = 0; -fail: - - return ret; -} - -/** mount partition or show mounted partitions - * mount [] - */ -static int cmd_mount(int argc, char *argv[]) -{ - uffs_MountTable *tab; - const char *mount = NULL; - - if (argc == 1) { - tab = uffs_MtbGetMounted(); - while (tab) { - MSG(" %s : (%d) ~ (%d)\n", tab->mount, tab->start_block, tab->end_block); - tab = tab->next; - } - } - else { - mount = argv[1]; - if (uffs_Mount(mount) < 0) { - MSGLN("Can't mount %s", mount); - return -1; - } - } - return 0; -} - -/** unmount parition or show unmounted partitions - * umount [] - */ -static int cmd_unmount(int argc, char *argv[]) -{ - uffs_MountTable *tab; - const char *mount = NULL; - - if (argc == 1) { - tab = uffs_MtbGetUnMounted(); - while (tab) { - MSG(" %s : (%d) ~ (%d)\n", tab->mount, tab->start_block, tab->end_block); - tab = tab->next; - } - } - else { - mount = argv[1]; - if (uffs_UnMount(mount) < 0) { - MSGLN("Can't unmount %s", mount); - return -1; - } - } - - return 0; -} - -/** inspect buffers - * inspb [] - */ -static int cmd_inspb(int argc, char *argv[]) -{ - uffs_Device *dev; - const char *mount = "/"; - - CHK_ARGC(1, 2); - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point %s", mount); - return -1; - } - uffs_BufInspect(dev); - uffs_PutDevice(dev); - - return 0; - -} - -/** print block wear-leveling information - * wl [] - */ -static int cmd_wl(int argc, char *argv[]) -{ - const char *mount = "/"; - uffs_Device *dev; - struct uffs_PartitionSt *par; - uffs_FileEmu *emu; - int i, max; - u32 n; - -#define NUM_PER_LINE 10 - - CHK_ARGC(1, 2); - - if (argc > 1) { - mount = argv[1]; - } - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point %s", mount); - return -1; - } - - par = &dev->par; - emu = (uffs_FileEmu *)(dev->attr->_private); - max = -1; - - for (i = 0; i < par->end - par->start; i++) { - if ((i % NUM_PER_LINE) == 0) { - MSG("%04d:", i + par->start); - } - n = i + par->start; - max = (max == -1 ? n : - (emu->em_monitor_block[n] > emu->em_monitor_block[max] ? n : max) - ); - MSG(" %4d", emu->em_monitor_block[n]); - if (uffs_TreeFindBadNodeByBlock(dev, n)) - MSG("%c", 'x'); - else if (uffs_TreeFindErasedNodeByBlock(dev, n)) - MSG("%c", ' '); - else - MSG("%c", '.'); - if (((i + 1) % NUM_PER_LINE) == 0) - MSG("\n"); - } - MSG("\n"); - MSG("Total blocks %d, peak erase count %d at block %d\n", - par->end - par->start, max == -1 ? 0 : emu->em_monitor_block[max], max); - - uffs_PutDevice(dev); - - return 0; -} - -static const struct cli_command helper_cmds[] = -{ - { cmd_format, "format", "[]", "Format device" }, - { cmd_mkf, "mkfile", "", "create a new file" }, - { cmd_mkdir, "mkdir", "", "create a new directory" }, - { cmd_rm, "rm", "", "delete file/directory" }, - { cmd_ren, "mv|ren", " ", "rename file/directory" }, - { cmd_ls, "ls", "", "list dirs and files" }, - { cmd_st, "info|st", "", "show statistic infomation" }, - { cmd_cp, "cp", " ", "copy files. the local file name start with '::'" }, - { cmd_cat, "cat", "", "show file content" }, - { cmd_pwd, "pwd", NULL, "show current dir" }, - { cmd_cd, "cd", "", "change current dir" }, - { cmd_mount, "mount", "[]", "mount partition or list mounted partitions" }, - { cmd_unmount, "umount", "[]", "unmount partition" }, - { cmd_dump, "dump", "[]", "dump file system", }, - { cmd_wl, "wl", "[]", "show block wear-leveling info", }, - { cmd_inspb, "inspb", "[]", "inspect buffer", }, - { NULL, NULL, NULL, NULL } -}; - -static struct cli_commandset helper_cmdset = { - helper_cmds, -}; - -struct cli_commandset * get_helper_cmds() -{ - return &helper_cmdset; -}; diff --git a/components/dfs/filesystems/uffs/src/emu/test_cmds.c b/components/dfs/filesystems/uffs/src/emu/test_cmds.c deleted file mode 100644 index a4bc1eca4..000000000 --- a/components/dfs/filesystems/uffs/src/emu/test_cmds.c +++ /dev/null @@ -1,1186 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file test_cmds.c - * \brief commands for test uffs - * \author Ricky Zheng - */ -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_fd.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_find.h" -#include "uffs/uffs_badblock.h" -#include "cmdline.h" -#include "api_test.h" - -#define PFX "test: " - -#define MAX_TEST_BUF_LEN 8192 - -#define SEQ_INIT 10 -#define SEQ_MOD_LEN 120 - -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - - -static void memcp_seq(void *des, int size, int start_pos) -{ - int i; - u8 *p = (u8 *)des; - - for (i = 0; i < size; i++, p++) { - *p = (start_pos + SEQ_INIT + i) % SEQ_MOD_LEN; - } -} - -static UBOOL check_entry_exist(const char *name) -{ - struct uffs_stat sb; - - return uffs_stat(name, &sb) < 0 ? U_FALSE : U_TRUE; -} - -static URET do_write_test_file(int fd, int size) -{ - long pos; - unsigned char buf[100]; - int len; - - while (size > 0) { - pos = uffs_seek(fd, 0, USEEK_CUR); - len = (size > sizeof(buf) ? sizeof(buf) : size); - memcp_seq(buf, len, pos); - if (uffs_write(fd, buf, len) != len) { - MSGLN("Write file failed, size %d at %d", len, pos); - return U_FAIL; - } - size -= len; - } - - return U_SUCC; -} - -static URET test_write_file(const char *file_name, int pos, int size) -{ - int ret = U_FAIL; - int fd = -1; - - if ((fd = uffs_open(file_name, UO_RDWR|UO_CREATE)) < 0) { - MSGLN("Can't open file %s for write.", file_name); - goto test_exit; - } - - if (uffs_seek(fd, pos, USEEK_SET) != pos) { - MSGLN("Can't seek file %s at pos %d", file_name, pos); - goto test_failed; - } - - if (do_write_test_file(fd, size) == U_FAIL) { - MSGLN("Write file %s failed.", file_name); - goto test_failed; - } - ret = U_SUCC; - -test_failed: - uffs_close(fd); - -test_exit: - - return ret; -} - - -static URET test_verify_file(const char *file_name, UBOOL noecc) -{ - int fd; - int ret = U_FAIL; - unsigned char buf[100]; - int i, pos, len; - u8 x; - - if ((fd = uffs_open(file_name, (noecc ? UO_RDONLY|UO_NOECC : UO_RDONLY))) < 0) { - MSGLN("Can't open file %s for read.", file_name); - goto test_exit; - } - - pos = 0; - while (!uffs_eof(fd)) { - len = uffs_read(fd, buf, sizeof(buf)); - if (len <= 0) - goto test_failed; - for (i = 0; i < len; i++) { - x = (SEQ_INIT + pos + i) % SEQ_MOD_LEN; - if (buf[i] != x) { - MSGLN("Verify file %s failed at: %d, expect 0x%02x but got 0x%02x", file_name, pos + i, x, buf[i]); - goto test_failed; - } - } - pos += len; - } - - if (pos != uffs_seek(fd, 0, USEEK_END)) { - MSGLN("Verify file %s failed. invalid file length.", file_name); - goto test_failed; - } - - MSGLN("Verify file %s succ.", file_name); - ret = U_SUCC; - -test_failed: - uffs_close(fd); - -test_exit: - - return ret; -} - -static URET test_append_file(const char *file_name, int size) -{ - int ret = U_FAIL; - int fd = -1; - - if ((fd = uffs_open(file_name, UO_RDWR|UO_APPEND|UO_CREATE)) < 0) { - MSGLN("Can't open file %s for append.", file_name); - goto test_exit; - } - - uffs_seek(fd, 0, USEEK_END); - - if (do_write_test_file(fd, size) == U_FAIL) { - MSGLN("Write file %s failed.", file_name); - goto test_failed; - } - ret = U_SUCC; - -test_failed: - uffs_close(fd); - -test_exit: - - return ret; -} - - -/* test create file, write file and read back */ -static int cmd_t1(int argc, char *argv[]) -{ - int fd; - URET ret; - char buf[100]; - const char *name; - - if (argc < 2) { - return CLI_INVALID_ARG; - } - - name = argv[1]; - - fd = uffs_open(name, UO_RDWR|UO_CREATE|UO_TRUNC); - if (fd < 0) { - MSGLN("Can't open %s", name); - goto fail; - } - - sprintf(buf, "123456789ABCDEF"); - ret = uffs_write(fd, buf, strlen(buf)); - MSGLN("write %d bytes to file, content: %s", ret, buf); - - ret = uffs_seek(fd, 3, USEEK_SET); - MSGLN("new file position: %d", ret); - - memset(buf, 0, sizeof(buf)); - ret = uffs_read(fd, buf, 5); - MSGLN("read %d bytes, content: %s", ret, buf); - - uffs_close(fd); - - return 0; -fail: - - return -1; -} - - -static URET DoTest2(void) -{ - int fd = -1; - URET ret = U_FAIL; - char buf[100], buf_1[100]; - - fd = uffs_open("/abc/", UO_RDWR|UO_DIR); - if (fd < 0) { - MSGLN("Can't open dir abc, err: %d", uffs_get_error()); - MSGLN("Try to create a new one..."); - fd = uffs_open("/abc/", UO_RDWR|UO_CREATE|UO_DIR); - if (fd < 0) { - MSGLN("Can't create new dir /abc/"); - goto exit_test; - } - else { - uffs_close(fd); - } - } - else { - uffs_close(fd); - } - - fd = uffs_open("/abc/test.txt", UO_RDWR|UO_CREATE); - if (fd < 0) { - MSGLN("Can't open /abc/test.txt"); - goto exit_test; - } - - sprintf(buf, "123456789ABCDEF"); - ret = uffs_write(fd, buf, strlen(buf)); - MSGLN("write %d bytes to file, content: %s", ret, buf); - - ret = uffs_seek(fd, 3, USEEK_SET); - MSGLN("new file position: %d", ret); - - memset(buf_1, 0, sizeof(buf_1)); - ret = uffs_read(fd, buf_1, 5); - MSGLN("read %d bytes, content: %s", ret, buf_1); - - if (memcmp(buf + 3, buf_1, 5) != 0) { - ret = U_FAIL; - } - else { - ret = U_SUCC; - } - - uffs_close(fd); - -exit_test: - - return ret; -} - - -static int cmd_t2(int argc, char *argv[]) -{ - URET ret; - MSGLN("Test return: %s !", (ret = DoTest2()) == U_SUCC ? "succ" : "failed"); - - return (ret == U_SUCC) ? 0 : -1; -} - - -static int cmd_VerifyFile(int argc, char *argv[]) -{ - const char *name; - UBOOL noecc = U_FALSE; - - if (argc < 2) { - return CLI_INVALID_ARG; - } - - name = argv[1]; - if (argc > 2 && strcmp(argv[2], "noecc") == 0) { - noecc = U_TRUE; - } - - MSGLN("Check file %s ... ", name); - if (test_verify_file(name, noecc) != U_SUCC) { - MSGLN("Verify file %s failed.", name); - return -1; - } - - return 0; -} - -/* Test file append and 'random' write */ -static int cmd_t3(int argc, char *argv[]) -{ - const char *name; - int i; - UBOOL noecc = U_FALSE; - int write_test_seq[] = { 20, 10, 500, 40, 1140, 900, 329, 4560, 352, 1100 }; - - if (argc < 2) { - return CLI_INVALID_ARG; - } - - name = argv[1]; - if (argv[2] && strcmp(argv[2], "noecc") == 0) { - noecc = U_TRUE; - } - - if (check_entry_exist(name)) { - MSGLN("Check file %s ... ", name); - if (test_verify_file(name, noecc) != U_SUCC) { - MSGLN("Verify file %s failed.", name); - return -1; - } - } - - MSGLN("Test append file %s ...", name); - for (i = 1; i < 500; i += 29) { - if (test_append_file(name, i) != U_SUCC) { - MSGLN("Append file %s test failed at %d !", name, i); - return -1; - } - } - - MSGLN("Check file %s ... ", name); - if (test_verify_file(name, noecc) != U_SUCC) { - MSGLN("Verify file %s failed.", name); - return -1; - } - - MSGLN("Test write file ..."); - for (i = 0; i < sizeof(write_test_seq) / sizeof(int) - 1; i++) { - if (test_write_file(name, write_test_seq[i], write_test_seq[i+1]) != U_SUCC) { - MSGLN("Test write file failed !"); - return -1; - } - } - - MSGLN("Check file %s ... ", name); - if (test_verify_file(name, noecc) != U_SUCC) { - MSGLN("Verify file %s failed.", name); - return -1; - } - - MSGLN("Test succ !"); - - return 0; -} - -/* open two files and test write */ -static int cmd_t4(int argc, char *argv[]) -{ - int fd1 = -1, fd2 = -1; - - MSGLN("open /a ..."); - if ((fd1 = uffs_open("/a", UO_RDWR | UO_CREATE)) < 0) { - MSGLN("Can't open /a"); - goto fail_exit; - } - - MSGLN("open /b ..."); - if ((fd2 = uffs_open("/b", UO_RDWR | UO_CREATE)) < 0) { - MSGLN("Can't open /b"); - uffs_close(fd1); - goto fail_exit; - } - - MSGLN("write (1) to /a ..."); - uffs_write(fd1, "Hello,", 6); - MSGLN("write (1) to /b ..."); - uffs_write(fd2, "Hello,", 6); - MSGLN("write (2) to /a ..."); - uffs_write(fd1, "World.", 6); - MSGLN("write (2) to /b ..."); - uffs_write(fd2, "World.", 6); - MSGLN("close /a ..."); - uffs_close(fd1); - MSGLN("close /b ..."); - uffs_close(fd2); - - return 0; - -fail_exit: - return -1; -} - -/* test appending file */ -static int cmd_t5(int argc, char *argv[]) -{ - int fd = -1; - URET ret; - char buf[100]; - const char *name; - - if (argc < 2) { - return CLI_INVALID_ARG; - } - - name = argv[1]; - - fd = uffs_open(name, UO_RDWR|UO_APPEND); - if (fd < 0) { - MSGLN("Can't open %s", name); - goto fail; - } - - sprintf(buf, "append test..."); - ret = uffs_write(fd, buf, strlen(buf)); - if (ret != strlen(buf)) { - MSGLN("write file failed, %d/%d", ret, strlen(buf)); - ret = -1; - } - else { - MSGLN("write %d bytes to file, content: %s", ret, buf); - ret = 0; - } - - uffs_close(fd); - - return ret; -fail: - return -1; -} - - -/* usage: t_pgrw - * - * This test case test page read/write - */ -static int cmd_TestPageReadWrite(int argc, char *argv[]) -{ - TreeNode *node = NULL; - uffs_Device *dev; - uffs_Tags local_tag; - uffs_Tags *tag = &local_tag; - int ret; - u16 block; - u16 page; - uffs_Buf *buf = NULL; - - u32 i; - int rc = -1; - - dev = uffs_GetDeviceFromMountPoint("/"); - if (!dev) - goto ext; - - buf = uffs_BufClone(dev, NULL); - if (!buf) - goto ext; - - node = uffs_TreeGetErasedNode(dev); - if (!node) { - MSGLN("no free block ?"); - goto ext; - } - - for (i = 0; i < dev->com.pg_data_size; i++) { - buf->data[i] = i & 0xFF; - } - - block = node->u.list.block; - page = 1; - - TAG_DIRTY_BIT(tag) = TAG_DIRTY; - TAG_VALID_BIT(tag) = TAG_VALID; - TAG_DATA_LEN(tag) = dev->com.pg_data_size; - TAG_TYPE(tag) = UFFS_TYPE_DATA; - TAG_PAGE_ID(tag) = 3; - TAG_PARENT(tag) = 100; - TAG_SERIAL(tag) = 10; - TAG_BLOCK_TS(tag) = 1; - SEAL_TAG(tag); - - ret = uffs_FlashWritePageCombine(dev, block, page, buf, tag); - if (UFFS_FLASH_HAVE_ERR(ret)) { - MSGLN("Write page error: %d", ret); - goto ext; - } - - ret = uffs_FlashReadPage(dev, block, page, buf, U_FALSE); - if (UFFS_FLASH_HAVE_ERR(ret)) { - MSGLN("Read page error: %d", ret); - goto ext; - } - - for (i = 0; i < dev->com.pg_data_size; i++) { - if (buf->data[i] != (i & 0xFF)) { - MSGLN("Data verify fail at: %d", i); - goto ext; - } - } - - ret = uffs_FlashReadPageTag(dev, block, page, tag); - if (UFFS_FLASH_HAVE_ERR(ret)) { - MSGLN("Read tag (page spare) error: %d", ret); - goto ext; - } - - // verify tag: - if (!TAG_IS_SEALED(tag)) { - MSGLN("not sealed ? Tag verify fail!"); - goto ext; - } - - if (!TAG_IS_DIRTY(tag)) { - MSGLN("not dirty ? Tag verify fail!"); - goto ext; - } - - if (!TAG_IS_VALID(tag)) { - MSGLN("not valid ? Tag verify fail!"); - goto ext; - } - - if (TAG_DATA_LEN(tag) != dev->com.pg_data_size || - TAG_TYPE(tag) != UFFS_TYPE_DATA || - TAG_PAGE_ID(tag) != 3 || - TAG_PARENT(tag) != 100 || - TAG_SERIAL(tag) != 10 || - TAG_BLOCK_TS(tag) != 1) { - - MSGLN("Tag verify fail!"); - goto ext; - } - - MSGLN("Page read/write test succ."); - rc = 0; - -ext: - if (node) { - uffs_FlashEraseBlock(dev, node->u.list.block); - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - } - - if (dev) - uffs_PutDevice(dev); - - if (buf) - uffs_BufFreeClone(dev, buf); - - return rc; -} - -/* t_format : test format partition */ -static int cmd_TestFormat(int argc, char *argv[]) -{ - URET ret; - const char *mount = "/"; - uffs_Device *dev; - UBOOL force = U_FALSE; - const char *test_file = "/a.txt"; - int fd; - int rc = -1; - - if (argc > 1) { - mount = argv[1]; - if (argc > 2 && strcmp(argv[2], "-f") == 0) - force = U_TRUE; - } - - fd = uffs_open(test_file, UO_RDWR | UO_CREATE); - if (fd < 0) { - MSGLN("can't create test file %s", test_file); - goto ext; - } - - MSGLN("Formating %s ... ", mount); - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point."); - goto ext; - } - else { - ret = uffs_FormatDevice(dev, force); - if (ret != U_SUCC) { - MSGLN("Format fail."); - } - else { - MSGLN("Format succ."); - rc = 0; - } - uffs_PutDevice(dev); - } - - uffs_close(fd); // this should fail on signature check ! -ext: - return rc; -} - - - -/** - * usage: t_pfs - * - * for example: t_pfs /x/ 100 - * - * This test case performs: - * 1) create files under , write full file name as file content - * 2) list files under , check files are all listed once - * 3) check file content aganist file name - * 4) delete files on success - */ -static int cmd_TestPopulateFiles(int argc, char *argv[]) -{ - const char *start = "/"; - int count = 80; - int i, fd, num; - char name[128]; - char buf[128]; - uffs_DIR *dirp; - struct uffs_dirent *ent; - unsigned long bitmap[50] = {0}; // one bit per file, maximu 32*50 = 1600 files - UBOOL succ = U_TRUE; - -#define SBIT(n) bitmap[(n)/(sizeof(bitmap[0]) * 8)] |= (1 << ((n) % (sizeof(bitmap[0]) * 8))) -#define GBIT(n) (bitmap[(n)/(sizeof(bitmap[0]) * 8)] & (1 << ((n) % (sizeof(bitmap[0]) * 8)))) - - if (argc > 1) { - start = argv[1]; - if (argc > 2) { - count = strtol(argv[2], NULL, 10); - } - } - - if (count > sizeof(bitmap) * 8) - count = sizeof(bitmap) * 8; - - for (i = 0, fd = -1; i < count; i++) { - sprintf(name, "%sFile%03d", start, i); - fd = uffs_open(name, UO_RDWR|UO_CREATE|UO_TRUNC); - if (fd < 0) { - MSGLN("Create file %s failed", name); - break; - } - if (uffs_write(fd, name, strlen(name)) != strlen(name)) { // write full path name to file - MSGLN("Write to file %s failed", name); - uffs_close(fd); - break; - } - uffs_close(fd); - } - - if (i < count) { - // not success, need to clean up - for (; i >= 0; i--) { - sprintf(name, "%sFile%03d", start, i); - if (uffs_remove(name) < 0) - MSGLN("Delete file %s failed", name); - } - succ = U_FALSE; - goto ext; - } - - MSGLN("%d files created.", count); - - // list files - dirp = uffs_opendir(start); - if (dirp == NULL) { - MSGLN("Can't open dir %s !", start); - succ = U_FALSE; - goto ext; - } - ent = uffs_readdir(dirp); - while (ent && succ) { - - if (!(ent->d_type & FILE_ATTR_DIR) && // not a dir - ent->d_namelen == strlen("File000") && // check file name length - memcmp(ent->d_name, "File", strlen("File")) == 0) { // file name start with "File" - - MSGLN("List entry %s", ent->d_name); - - num = strtol(ent->d_name + 4, NULL, 10); - if (GBIT(num)) { - // file already listed ? - MSGLN("File %d listed twice !", ent->d_name); - succ = U_FALSE; - break; - } - SBIT(num); - - // check file content - sprintf(name, "%s%s", start, ent->d_name); - fd = uffs_open(name, UO_RDONLY); - if (fd < 0) { - MSGLN("Open file %d for read failed !", name); - } - else { - memset(buf, 0, sizeof(buf)); - num = uffs_read(fd, buf, sizeof(buf)); - if (num != strlen(name)) { - MSGLN("%s Read data length expect %d but got %d !", name, strlen(name), num); - succ = U_FALSE; - } - else { - if (memcmp(name, buf, num) != 0) { - MSGLN("File %s have wrong content '%s' !", name, buf); - succ = U_FALSE; - } - } - uffs_close(fd); - } - } - ent = uffs_readdir(dirp); - } - uffs_closedir(dirp); - - // check absent files - for (i = 0; i < count; i++) { - if (GBIT(i) == 0) { - sprintf(name, "%sFile%03d", start, i); - MSGLN("File %s not listed !", name); - succ = U_FALSE; - } - } - - // delete files if pass the test - for (i = 0; succ && i < count; i++) { - sprintf(name, "%sFile%03d", start, i); - if (uffs_remove(name) < 0) { - MSGLN("Delete file %s failed", name); - succ = U_FALSE; - } - } - -ext: - MSGLN("Populate files test %s !", succ ? "SUCC" : "FAILED"); - return succ ? 0 : -1; - -} - -/** - * Open with , save fd to $1 - * - * t_open - */ -static int cmd_topen(int argc, char *argv[]) -{ - int fd; - const char *name; - char *p; - int oflag = 0; - - CHK_ARGC(3, 3); - - name = argv[2]; - p = argv[1]; - while(*p) { - switch(*p++) { - case 'a': - oflag |= UO_APPEND; - break; - case 'c': - oflag |= UO_CREATE; - break; - case 't': - oflag |= UO_TRUNC; - break; - case 'w': - oflag |= UO_RDWR; - break; - case 'r': - oflag |= UO_RDONLY; - break; - } - } - - fd = uffs_open(name, oflag); - - if (fd >= 0) { - cli_env_set('1', fd); - return 0; - } - else { - return -1; - } -} - -/** - * seek file pointer - * t_seek [] - * if success, $1 = file position after seek - */ -static int cmd_tseek(int argc, char *argv[]) -{ - int origin = USEEK_SET; - int offset; - int fd; - int ret; - - CHK_ARGC(3, 4); - - if (sscanf(argv[1], "%d", &fd) != 1 || - sscanf(argv[2], "%d", &offset) != 1) - { - return CLI_INVALID_ARG; - } - - if (argc > 3) { - switch(argv[3][0]) { - case 's': - origin = USEEK_SET; - break; - case 'c': - origin = USEEK_CUR; - break; - case 'e': - origin = USEEK_END; - break; - default: - return CLI_INVALID_ARG; - } - } - - ret = uffs_seek(fd, offset, origin); - if (ret >= 0) { - cli_env_set('1', ret); - return 0; - } - else { - return -1; - } -} - -/** - * close file - * t_close - */ -static int cmd_tclose(int argc, char *argv[]) -{ - int fd; - - CHK_ARGC(2, 2); - - if (sscanf(argv[1], "%d", &fd) == 1) { - return uffs_close(fd); - } - else - return -1; -} - -/** - * write file - * t_write [..] - */ -static int cmd_twrite(int argc, char *argv[]) -{ - int fd; - int i, len = 0; - int ret = 0; - - CHK_ARGC(3, 0); - if (sscanf(argv[1], "%d", &fd) != 1) { - return -1; - } - else { - for (i = 2; i < argc; i++) { - len = strlen(argv[i]); - if (uffs_write(fd, argv[i], len) != len) { - ret = -1; - break; - } - } - } - - if (ret == 0) - cli_env_set('1', len); - - return ret; -} - -/** - * read and check seq file - * t_check_seq - */ -static int cmd_tcheck_seq(int argc, char *argv[]) -{ - int fd; - int len, size; - int ret = 0, r_ret = 0; - long pos; - u8 buf[MAX_TEST_BUF_LEN]; - int i; - u8 x; - - CHK_ARGC(3, 3); - - if (sscanf(argv[1], "%d", &fd) != 1) { - return -1; - } - - if (sscanf(argv[2], "%d", &len) != 1) { - return -1; - } - - pos = uffs_tell(fd); - while (len > 0) { - size = (len > sizeof(buf) ? sizeof(buf) : len); - if ((r_ret = uffs_read(fd, buf, size)) < 0) { - MSGLN("Read fail! fd = %d, size = %d, pos = %ld", fd, size, pos); - ret = -1; - break; - } - - // check seq - for (i = 0; i < r_ret; i++) { - x = (pos + SEQ_INIT + i) % SEQ_MOD_LEN; - if (buf[i] != x) { - MSGLN("Check fail! fd = %d, pos = %ld (expect 0x%02x but 0x%02x)\n", fd, pos + i, x, buf[i]); - ret = -1; - break; - } - } - - if (ret < 0) - break; - - len -= r_ret; - pos += r_ret; - } - - return ret; -} - - - -/** - * write random seq to file - * t_write_seq - */ -static int cmd_twrite_seq(int argc, char *argv[]) -{ - int fd; - int len = 0, size = 0; - long pos = 0; - int ret = 0, w_ret = 0; - u8 buf[MAX_TEST_BUF_LEN]; - - CHK_ARGC(3, 3); - if (sscanf(argv[1], "%d", &fd) != 1) { - return -1; - } - - if (sscanf(argv[2], "%d", &len) != 1) { - return -1; - } - - pos = uffs_tell(fd); - while (len > 0) { - size = (len < sizeof(buf) ? len : sizeof(buf)); - memcp_seq(buf, size, pos); - if ((w_ret = uffs_write(fd, buf, size)) < 0) { - MSGLN("write fail! fd = %d, size = %d, pos = %ld", fd, size, pos); - ret = -1; - break; - } - pos += w_ret; - len -= w_ret; - } - - if (ret == 0) - cli_env_set('1', len); - - return ret; -} - - -/** - * read and check file - * t_read - */ -static int cmd_tread(int argc, char *argv[]) -{ - int fd; - int len, n; - int ret = 0; - char buf[64]; - char *p; - - CHK_ARGC(3, 3); - - if (sscanf(argv[1], "%d", &fd) != 1) { - return -1; - } - else { - len = strlen(argv[2]); - n = 0; - p = argv[2]; - while (n < len) { - n = (len > sizeof(buf) ? sizeof(buf) : len); - if (uffs_read(fd, buf, n) != n || - memcmp(buf, p, n) != 0) { - ret = -1; - break; - } - len -= n; - p += n; - } - } - - return ret; -} - - -static void do_dump_page(uffs_Device *dev, uffs_Buf *buf) -{ - int i, j; - const int line = 16; - struct uffs_MiniHeaderSt *header = (struct uffs_MiniHeaderSt *)buf->header; - MSG(" header.status = %d\n", header->status); - if (header->status != 0xFF) { - for (i = 0; i < 64; i += line) { - MSG(" "); - for (j = 0; j < line; j++) - MSG("%02X ", buf->header[i+j]); - MSG("\n"); - } - MSG("\n"); - } -} - -static void do_dump_tag(uffs_Device *dev, uffs_Tags *tag) -{ - MSG(" tag sealed: %s\n", TAG_IS_SEALED(tag) ? "yes" : "no"); - if (TAG_IS_GOOD(tag)) { - if (TAG_IS_DIRTY(tag)) { - MSG(" block_ts = %d\n", tag->s.block_ts); - MSG(" type = %d\n", tag->s.type); - MSG(" dirty = %d\n", tag->s.dirty); - MSG(" page_id = %d\n", tag->s.page_id); - MSG(" serial = %d\n", tag->s.serial); - MSG(" parent = %d\n", tag->s.parent); - MSG(" data_len = %d\n", tag->s.data_len); - } - else { - MSG(" tag is GOOD but NOT DIRTY !!!???\n"); - } - } - else if (TAG_IS_SEALED(tag)) { - MSG(" tag is INVALID\n"); - } -} - -static void do_dump_device(uffs_Device *dev) -{ - URET ret; - int block, page; - uffs_Tags tag; - uffs_Buf *buf; - - buf = uffs_BufClone(dev, NULL); - if (buf == NULL) { - MSGLN("Can't clone buf"); - return; - } - - for (block = dev->par.start; block <= dev->par.end; block++) { - MSG("---- block %d ----\n", block); - for (page = 0; page < dev->attr->pages_per_block; page++) { - MSG(" == page %d ==\n", page); - ret = uffs_FlashReadPage(dev, block, page, buf, U_FALSE); - if (UFFS_FLASH_HAVE_ERR(ret)) { - MSG(" !!! Read page failed, ret = %d !!!\n", ret); - } - else { - do_dump_page(dev, buf); - if (buf->header[0] != 0xFF) { - ret = uffs_FlashReadPageTag(dev, block, page, &tag); - if (UFFS_FLASH_HAVE_ERR(ret)) { - MSG(" !!! Read TAG failed, ret = %d !!!\n", ret); - } - else { - do_dump_tag(dev, &tag); - } - } - } - } - } - uffs_BufFreeClone(dev, buf); -} - -static int cmd_dump(int argc, char *argv[]) -{ - const char *mount = "/"; - uffs_Device *dev; - - if (argc > 1) { - mount = argv[1]; - } - - MSGLN("Dumping %s ... ", mount); - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point."); - } - else { - do_dump_device(dev); - uffs_PutDevice(dev); - } - - return 0; -} - -static int cmd_apisrv(int argc, char *argv[]) -{ - return api_server_start(); -} - -static const struct cli_command test_cmds[] = -{ - { cmd_t1, "t1", "", "test 1" }, - { cmd_t2, "t2", NULL, "test 2" }, - { cmd_t3, "t3", " []", "test 3" }, - { cmd_t4, "t4", NULL, "test 4" }, - { cmd_t5, "t5", "", "test 5" }, - { cmd_TestPageReadWrite, "t_pgrw", NULL, "test page read/write" }, - { cmd_TestFormat, "t_format", NULL, "test format file system" }, - { cmd_TestPopulateFiles, "t_pfs", "[ []]", "test populate files under " }, - { cmd_VerifyFile, "t_vf", " []", "verify file" }, - - { cmd_topen, "t_open", " ", "open file, fd save to $1", }, - { cmd_tread, "t_read", " ", "read and check against ", }, - { cmd_tcheck_seq, "t_check_seq", " ", "read seq file and check", }, - { cmd_twrite, "t_write", " [...]", "write ", }, - { cmd_twrite_seq, "t_write_seq", " ", "write seq file ", }, - { cmd_tseek, "t_seek", " []", "seek file pointer to from ", }, - { cmd_tclose, "t_close", "", "close ", }, - { cmd_dump, "dump", "", "dump ", }, - - { cmd_apisrv, "apisrv", NULL, "start API test server", }, - - { NULL, NULL, NULL, NULL } -}; - -static struct cli_commandset test_cmdset = { - test_cmds, -}; - -struct cli_commandset * get_test_cmds() -{ - return &test_cmdset; -}; - - - diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem.c deleted file mode 100644 index 1f66cdf84..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem.c - * \brief emulate uffs file system - * \author Ricky Zheng, created 9th May, 2005 - */ - - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs_fileem.h" - -#define PFX "femu: " -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - - -static struct uffs_StorageAttrSt g_femu_storage = {0}; - -static struct uffs_FileEmuSt g_femu_private = {0}; - - -struct uffs_StorageAttrSt * femu_GetStorage() -{ - return &g_femu_storage; -} - -struct uffs_FileEmuSt *femu_GetPrivate() -{ - return &g_femu_private; -} - -URET femu_InitDevice(uffs_Device *dev) -{ - uffs_FileEmu *emu = femu_GetPrivate(); - - // setup device storage attr and private data structure. - // all femu partition share one storage attribute - - dev->attr = femu_GetStorage(); - dev->attr->_private = (void *) emu; - - // setup flash driver operations, according to the ecc option. - switch(dev->attr->ecc_opt) { - case UFFS_ECC_NONE: - case UFFS_ECC_SOFT: - dev->ops = &g_femu_ops_ecc_soft; - break; - case UFFS_ECC_HW: - dev->ops = &g_femu_ops_ecc_hw; - break; - case UFFS_ECC_HW_AUTO: - dev->ops = &g_femu_ops_ecc_hw_auto; - break; - default: - break; - } - -#ifdef UFFS_FEMU_ENABLE_INJECTION - // setup wrap functions, for inject ECC errors, etc. - // check wrap_inited so that multiple devices can share the same driver - if (!emu->wrap_inited) { - femu_setup_wrapper_functions(dev); - emu->wrap_inited = U_TRUE; - } -#endif - - return U_SUCC; -} - -/* Nothing to do here */ -URET femu_ReleaseDevice(uffs_Device *dev) -{ - return U_SUCC; -} - - -///////////////////////////////////////////////////////////////////////////////// diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem.h b/components/dfs/filesystems/uffs/src/emu/uffs_fileem.h deleted file mode 100644 index 8be7f3e83..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem.h - * \brief Emulate NAND flash with host file. - * \author Ricky Zheng - */ - -#ifndef _UFFS_FILEEM_H_ -#define _UFFS_FILEEM_H_ - -#include "uffs/uffs_device.h" - -#define UFFS_FEMU_FILE_NAME "uffsemfile.bin" - -#define UFFS_FEMU_MAX_BLOCKS (1024 * 16) // maximum 16K blocks - -#define UFFS_FEMU_ENABLE_INJECTION // enable bad block & ecc error injection - -extern struct uffs_FlashOpsSt g_femu_ops_ecc_soft; // for software ECC or no ECC. -extern struct uffs_FlashOpsSt g_femu_ops_ecc_hw; // for hardware ECC -extern struct uffs_FlashOpsSt g_femu_ops_ecc_hw_auto; // for auto hardware ECC - -#define PAGE_DATA_WRITE_COUNT_LIMIT 1 -#define PAGE_SPARE_WRITE_COUNT_LIMIT 1 - -typedef struct uffs_FileEmuSt { - int initCount; - FILE *fp; - FILE *dump_fp; - u8 *em_monitor_page; // page write monitor - u8 * em_monitor_spare; // spare write monitor - u32 *em_monitor_block; // block erease monitor - const char *emu_filename; -#ifdef UFFS_FEMU_ENABLE_INJECTION - struct uffs_FlashOpsSt ops_orig; - UBOOL wrap_inited; -#endif -} uffs_FileEmu; - -/* file emulator device init/release entry */ -URET femu_InitDevice(uffs_Device *dev); -URET femu_ReleaseDevice(uffs_Device *dev); - -struct uffs_StorageAttrSt * femu_GetStorage(void); -struct uffs_FileEmuSt * femu_GetPrivate(void); - -#ifdef UFFS_FEMU_ENABLE_INJECTION -void femu_setup_wrapper_functions(uffs_Device *dev); -#endif - -/* internal used functions, shared by all ecc option implementations */ -int femu_InitFlash(uffs_Device *dev); -int femu_ReleaseFlash(uffs_Device *dev); -int femu_EraseBlock(uffs_Device *dev, u32 blockNumber); - -#endif - diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw.c deleted file mode 100644 index c7781ebe6..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2010 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem_ecc_hw.c - * \brief emulate uffs file system for hardware ECC. - * - * In this emulator, we call 'uffs_FlashMakeSpare()' to do the layout job - * and call 'uffs_EccMake()' to calculate ECC. - * - * \author Ricky Zheng @ Oct, 2010 - */ - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs_fileem.h" -#include "uffs/uffs_ecc.h" - -#define PFX "femu: " -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -static int femu_hw_WritePageWithLayout(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *ecc, const uffs_TagStore *ts) -{ - int written; - int abs_page; - int full_page_size; - uffs_FileEmu *emu; - struct uffs_StorageAttrSt *attr = dev->attr; - u8 spare[UFFS_MAX_SPARE_SIZE]; - u8 ecc_buf[UFFS_MAX_ECC_SIZE]; - int spare_len; - - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto err; - } - - abs_page = attr->pages_per_block * block + page; - full_page_size = attr->page_data_size + attr->spare_size; - - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto err; - - emu->em_monitor_page[abs_page]++; - if (emu->em_monitor_page[abs_page] > PAGE_DATA_WRITE_COUNT_LIMIT) { - MSG("Warrning: block %d page %d exceed it's maximum write time!", block, page); - goto err; - } - - fseek(emu->fp, abs_page * full_page_size, SEEK_SET); - - written = fwrite(data, 1, data_len, emu->fp); - - if (written != data_len) { - MSG("write page I/O error ?"); - goto err; - } - - dev->st.page_write_count++; - dev->st.io_write += written; - - } - - if (ts) { - - emu->em_monitor_spare[abs_page]++; - if (emu->em_monitor_spare[abs_page] > PAGE_SPARE_WRITE_COUNT_LIMIT) { - MSG("Warrning: block %d page %d (spare) exceed it's maximum write time!", block, page); - goto err; - } - - if (!uffs_Assert(data != NULL, "BUG: Write spare without data ?")) - goto err; - - uffs_EccMake(data, data_len, ecc_buf); - uffs_FlashMakeSpare(dev, ts, ecc_buf, spare); - spare_len = dev->mem.spare_data_size; - - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size, SEEK_SET); - written = fwrite(spare, 1, spare_len, emu->fp); - if (written != spare_len) { - MSG("write spare I/O error ?"); - goto err; - } - - dev->st.spare_write_count++; - dev->st.io_write += written; - } - - if (data == NULL && ts == NULL) { - // mark bad block - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size + attr->block_status_offs, SEEK_SET); - written = fwrite("\0", 1, 1, emu->fp); - if (written != 1) { - MSG("write bad block mark I/O error ?"); - goto err; - } - dev->st.io_write++; - } - - fflush(emu->fp); - return UFFS_FLASH_NO_ERR; -err: - fflush(emu->fp); - return UFFS_FLASH_IO_ERR; -} - - -static URET femu_hw_ReadPageWithLayout(uffs_Device *dev, u32 block, u32 page, u8* data, int data_len, u8 *ecc, - uffs_TagStore *ts, u8 *ecc_store) -{ - int nread; - uffs_FileEmu *emu; - int abs_page; - int full_page_size; - struct uffs_StorageAttrSt *attr = dev->attr; - unsigned char status; - u8 spare[UFFS_MAX_SPARE_SIZE]; - int spare_len; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto err; - } - - abs_page = attr->pages_per_block * block + page; - full_page_size = attr->page_data_size + attr->spare_size; - - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto err; - - fseek(emu->fp, abs_page * full_page_size, SEEK_SET); - nread = fread(data, 1, data_len, emu->fp); - - if (nread != data_len) { - MSG("read page I/O error ?"); - goto err; - } - dev->st.io_read += nread; - dev->st.page_read_count++; - - if (ecc) { - // calculate ECC for data - uffs_EccMake(data, data_len, ecc); - } - } - - if (ts) { - - spare_len = dev->mem.spare_data_size; - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size, SEEK_SET); - nread = fread(spare, 1, spare_len, emu->fp); - - if (nread != spare_len) { - MSG("read page spare I/O error ?"); - goto err; - } - - // unload ts and ecc from spare - uffs_FlashUnloadSpare(dev, spare, ts, ecc_store); - - dev->st.io_read += nread; - dev->st.spare_read_count++; - } - - if (data == NULL && ts == NULL) { - // read bad block mark - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size + attr->block_status_offs, SEEK_SET); - nread = fread(&status, 1, 1, emu->fp); - - if (nread != 1) { - MSG("read badblock mark I/O error ?"); - goto err; - } - dev->st.io_read++; - - return status == 0xFF ? UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK; - } - - return UFFS_FLASH_NO_ERR; -err: - return UFFS_FLASH_IO_ERR; -} - - -uffs_FlashOps g_femu_ops_ecc_hw = { - femu_InitFlash, // InitFlash() - femu_ReleaseFlash, // ReleaseFlash() - NULL, // ReadPage() - femu_hw_ReadPageWithLayout, // ReadPageWithLayout() - NULL, // WritePage() - femu_hw_WritePageWithLayout,// WritePageWithLayout() - NULL, // IsBadBlock(), let UFFS take care of it. - NULL, // MarkBadBlock(), let UFFS take care of it. - femu_EraseBlock, // EraseBlock() -}; diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw_auto.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw_auto.c deleted file mode 100644 index ae86f7f16..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_hw_auto.c +++ /dev/null @@ -1,356 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2010 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem_ecc_hw_auto.c - * - * \brief Emulate uffs file system for auto hardware ECC or RS error collection. - * - * This emulator emulate LPC32x0 MLC NAND controller which generate 10 bytes - * Reed-Solomon error correction code (RS-ECC) for every 518 bytes data. - * - * For small page MLC have 16 bytes spare area leves only 6 bytes for 'meta-data', - * no enough room for UFFS's 8 bytes tag and bad block mark. For this reason, - * we adjust page data/spare boundary to 508/20. - * - * This emulator does not calculate real RS-ECC code, instead, we use software ECC - * to calculate 6 bytes ECC code, so this solution does not have the same error - * correcting cabability of RS-ECC. - * - * Note: the MLC controller strictly require sequencial access to serial data buffer. - * - * \author Ricky Zheng @ Oct, 2010 - */ - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_ecc.h" -#include "uffs_fileem.h" - -#define PFX "femu: " -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -#define RS_ECC_SIZE 10 -#define PAGE_DATA_SIZE 508 -#define PAGE_SPARE_SIZE 20 -#define PAGE_FULL_SIZE (PAGE_DATA_SIZE + PAGE_SPARE_SIZE) -static u8 g_sdata_buf[PAGE_FULL_SIZE]; // emulating LPC32x0's 528-bytes serial data buffer - -static int g_sdata_buf_pointer = 0; - -static void start_sdata_access() -{ - g_sdata_buf_pointer = 0; -} - -static void feed_sdata(const u8 *data, int len) -{ - if (!uffs_Assert(g_sdata_buf_pointer + len <= sizeof(g_sdata_buf), "BUG: Serial Data Buffer overflow !!")) - return; - - if (data) - memcpy(g_sdata_buf + g_sdata_buf_pointer, data, len); - g_sdata_buf_pointer += len; -} - -static void feed_sdata_constant(u8 val, int num) -{ - if (!uffs_Assert(g_sdata_buf_pointer + num <= sizeof(g_sdata_buf), "BUG: Serial Data Buffer overflow !!")) - return; - - memset(g_sdata_buf + g_sdata_buf_pointer, val, num); - g_sdata_buf_pointer += num; -} - -static void drain_sdata(u8 *data, int len) -{ - if (!uffs_Assert( (int)sizeof(g_sdata_buf) - g_sdata_buf_pointer >= len, "BUG: Serial Data Buffer overdrain !!")) - return; - - if (data) - memcpy(data, g_sdata_buf + g_sdata_buf_pointer, len); - g_sdata_buf_pointer += len; -} - -static int load_sdata(uffs_Device *dev, int block, int page) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - int abs_page; - struct uffs_StorageAttrSt *attr = dev->attr; - int nread; - int ret; - u8 ecc_buf[RS_ECC_SIZE]; - u8 *ecc_store; - - abs_page = attr->pages_per_block * block + page; - - fseek(emu->fp, abs_page * PAGE_FULL_SIZE, SEEK_SET); - nread = fread(g_sdata_buf, 1, PAGE_FULL_SIZE, emu->fp); - g_sdata_buf_pointer = 0; - - ret = ((nread == PAGE_FULL_SIZE) ? UFFS_FLASH_NO_ERR : UFFS_FLASH_IO_ERR); - - if (ret == UFFS_FLASH_NO_ERR) { - - // Perform ECC check & correction - // In the real world, this is done by MLC controller hardware - memset(ecc_buf, 0xFF, RS_ECC_SIZE); - uffs_EccMake(g_sdata_buf, attr->page_data_size, ecc_buf); - - ecc_store = g_sdata_buf + PAGE_FULL_SIZE - RS_ECC_SIZE; - - ret = uffs_EccCorrect(g_sdata_buf, attr->page_data_size, ecc_store, ecc_buf); - - ret = (ret < 0 ? UFFS_FLASH_ECC_FAIL : - (ret > 0 ? UFFS_FLASH_ECC_OK : UFFS_FLASH_NO_ERR)); - - } - - return ret; -} - -static int program_sdata(uffs_Device *dev, int block, int page) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - int abs_page; - struct uffs_StorageAttrSt *attr = dev->attr; - u8 ecc_buf[RS_ECC_SIZE]; - int writtern = 0; - - // In the real world, MLC controller will generate RS-ECC code in serial data buffer - // and might start auto programing NAND flash. Here, we use software ECC to emulate RS-ECC. - memset(ecc_buf, 0xFF, sizeof(ecc_buf)); - uffs_EccMake(g_sdata_buf, attr->page_data_size, ecc_buf); - feed_sdata(ecc_buf, RS_ECC_SIZE); - - if (!uffs_Assert(g_sdata_buf_pointer == PAGE_FULL_SIZE, "Serial Data Buffer is not fully filled !!")) - goto ext; - - abs_page = attr->pages_per_block * block + page; - - fseek(emu->fp, abs_page * PAGE_FULL_SIZE, SEEK_SET); - writtern = fwrite(g_sdata_buf, 1, PAGE_FULL_SIZE, emu->fp); -ext: - return (writtern == PAGE_FULL_SIZE) ? UFFS_FLASH_NO_ERR : UFFS_FLASH_IO_ERR; -} - - -static int femu_hw_auto_InitFlash(uffs_Device *dev) -{ - struct uffs_StorageAttrSt *attr = dev->attr; - - // now this is a good chance to adjust page data/spare boundary - if (attr->page_data_size + attr->spare_size != PAGE_FULL_SIZE) { - MSGLN("This emulator emulates only for page size %d bytes !", PAGE_FULL_SIZE); - return -1; - } - if (attr->spare_size < PAGE_SPARE_SIZE) { - attr->page_data_size -= (PAGE_SPARE_SIZE - attr->spare_size); - attr->spare_size = PAGE_SPARE_SIZE; - MSGLN("Adjust page data/spare boundary to %d/%d", attr->page_data_size, attr->spare_size); - } - - // and fix ECC size - attr->ecc_size = RS_ECC_SIZE; - MSGLN("Adjust ECC size to %d bytes", attr->ecc_size); - - return femu_InitFlash(dev); -} - - -static int femu_hw_auto_WritePageWithLayout(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *ecc, const uffs_TagStore *ts) -{ - int abs_page; - uffs_FileEmu *emu; - struct uffs_StorageAttrSt *attr = dev->attr; - u8 spare[PAGE_SPARE_SIZE]; - int ret = UFFS_FLASH_IO_ERR; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto err; - } - - abs_page = attr->pages_per_block * block + page; - - start_sdata_access(); - - dev->st.page_write_count++; - dev->st.spare_write_count++; - dev->st.io_write += PAGE_FULL_SIZE; - - if (data || ts) { - // normal page write - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto err; - - emu->em_monitor_page[abs_page]++; - if (emu->em_monitor_page[abs_page] > PAGE_DATA_WRITE_COUNT_LIMIT) { - MSGLN("Warrning: block %d page %d exceed it's maximum write time!", block, page); - goto err; - } - - // Copy data to serial data buffer - feed_sdata(data, data_len); - - // Pad the rest data as 0xFF - feed_sdata_constant(0xFF, attr->page_data_size - data_len); - - } - else { - // We still need to feed data to serial data buffer to make MLC controller happy - // The current UFFS won't write ts only, so we'll never run to here. - feed_sdata_constant(0xFF, attr->page_data_size); - } - - if (ts) { - - emu->em_monitor_spare[abs_page]++; - if (emu->em_monitor_spare[abs_page] > PAGE_SPARE_WRITE_COUNT_LIMIT) { - MSGLN("Warrning: block %d page %d (spare) exceed it's maximum write time!", block, page); - goto err; - } - - memset(spare, 0xFF, sizeof(spare)); - uffs_FlashMakeSpare(dev, ts, NULL, spare); // do not pack ECC, as MLC controller will - // automatically write RS-ECC to the latest 10 bytes. - - // feed spare data to serial data buffer - feed_sdata(spare, PAGE_SPARE_SIZE - RS_ECC_SIZE); - } - } - else { - // mark bad block - - // feed data to serial data buffer to make MLC controller happy - feed_sdata_constant(0xFF, attr->page_data_size); - - memset(spare, 0xFF, sizeof(spare)); - spare[attr->block_status_offs] = 0; - - // feed spare data to serial data buffer - feed_sdata(spare, PAGE_SPARE_SIZE - RS_ECC_SIZE); - - dev->st.io_write++; - } - - // now, program serial data buffer to NAND flash - ret = program_sdata(dev, block, page); - - fflush(emu->fp); - return ret; -err: - fflush(emu->fp); - return ret; -} - - -static URET femu_hw_auto_ReadPageWithLayout(uffs_Device *dev, u32 block, u32 page, u8* data, int data_len, u8 *ecc, - uffs_TagStore *ts, u8 *ecc_store) -{ - uffs_FileEmu *emu; - int abs_page; - struct uffs_StorageAttrSt *attr = dev->attr; - unsigned char status; - u8 spare[PAGE_SPARE_SIZE]; - int ret = UFFS_FLASH_IO_ERR; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto ext; - } - - abs_page = attr->pages_per_block * block + page; - - // now load full page to serial data buffer - ret = load_sdata(dev, block, page); - if (ret != UFFS_FLASH_NO_ERR) - goto ext; - - start_sdata_access(); - - dev->st.io_read += PAGE_FULL_SIZE; - dev->st.page_read_count++; - dev->st.spare_read_count++; - - if (data || ts) { - - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto ext; - - drain_sdata(data, data_len); - } - - if (ts) { - if (g_sdata_buf_pointer < attr->page_data_size) - drain_sdata(NULL, attr->page_data_size - g_sdata_buf_pointer); - - drain_sdata(spare, PAGE_SPARE_SIZE - RS_ECC_SIZE); - - // unload ts from spare - uffs_FlashUnloadSpare(dev, spare, ts, NULL); - } - } - else { - // read bad block mark - drain_sdata(NULL, attr->page_data_size + attr->block_status_offs - 1); - drain_sdata(&status, 1); - - ret = (status == 0xFF ? UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK); - } - -ext: - return ret; -} - - -uffs_FlashOps g_femu_ops_ecc_hw_auto = { - femu_hw_auto_InitFlash, // InitFlash() - femu_ReleaseFlash, // ReleaseFlash() - NULL, // ReadPage() - femu_hw_auto_ReadPageWithLayout, // ReadPageWithLayout() - NULL, // WritePage() - femu_hw_auto_WritePageWithLayout, // WirtePageWithLayout() - NULL, // IsBadBlock(), let UFFS take care of it. - NULL, // MarkBadBlock(), let UFFS take care of it. - femu_EraseBlock, // EraseBlock() -}; diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_soft.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_soft.c deleted file mode 100644 index f65706614..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_ecc_soft.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2010 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem_ecc_soft.c - * \brief emulate uffs file system for software ECC - * \author Ricky Zheng @ Oct, 2010 - */ - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_flash.h" -#include "uffs_fileem.h" - -#define PFX "femu: " -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -static int femu_WritePage(uffs_Device *dev, u32 block, u32 page_num, - const u8 *data, int data_len, const u8 *spare, int spare_len) -{ - int written; - int abs_page; - int full_page_size; - uffs_FileEmu *emu; - struct uffs_StorageAttrSt *attr = dev->attr; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto err; - } - - abs_page = attr->pages_per_block * block + page_num; - full_page_size = attr->page_data_size + attr->spare_size; - - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto err; - - emu->em_monitor_page[abs_page]++; - if (emu->em_monitor_page[abs_page] > PAGE_DATA_WRITE_COUNT_LIMIT) { - MSGLN("Warrning: block %d page %d exceed it's maximum write time!", block, page_num); - goto err; - } - - fseek(emu->fp, abs_page * full_page_size, SEEK_SET); - - written = fwrite(data, 1, data_len, emu->fp); - - if (written != data_len) { - MSGLN("write page I/O error ?"); - goto err; - } - - dev->st.page_write_count++; - dev->st.io_write += written; - } - - if (spare && spare_len > 0) { - if (spare_len > attr->spare_size) - goto err; - - emu->em_monitor_spare[abs_page]++; - if (emu->em_monitor_spare[abs_page] > PAGE_SPARE_WRITE_COUNT_LIMIT) { - MSGLN("Warrning: block %d page %d (spare) exceed it's maximum write time!", block, page_num); - goto err; - } - - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size, SEEK_SET); - written = fwrite(spare, 1, spare_len, emu->fp); - if (written != spare_len) { - MSGLN("write spare I/O error ?"); - goto err; - } - - dev->st.spare_write_count++; - dev->st.io_write += written; - } - - if (data == NULL && spare == NULL) { - // mark bad block - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size + attr->block_status_offs, SEEK_SET); - written = fwrite("\0", 1, 1, emu->fp); - if (written != 1) { - MSGLN("write bad block mark I/O error ?"); - goto err; - } - dev->st.io_write++; - } - - fflush(emu->fp); - return UFFS_FLASH_NO_ERR; -err: - fflush(emu->fp); - return UFFS_FLASH_IO_ERR; -} - - -static URET femu_ReadPage(uffs_Device *dev, u32 block, u32 page_num, u8 *data, int data_len, u8 *ecc, - u8 *spare, int spare_len) -{ - int nread; - uffs_FileEmu *emu; - int abs_page; - int full_page_size; - struct uffs_StorageAttrSt *attr = dev->attr; - unsigned char status; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (!emu || !(emu->fp)) { - goto err; - } - - abs_page = attr->pages_per_block * block + page_num; - full_page_size = attr->page_data_size + attr->spare_size; - - if (data && data_len > 0) { - if (data_len > attr->page_data_size) - goto err; - - fseek(emu->fp, abs_page * full_page_size, SEEK_SET); - nread = fread(data, 1, data_len, emu->fp); - - if (nread != data_len) { - MSGLN("read page I/O error ?"); - goto err; - } - dev->st.io_read += nread; - dev->st.page_read_count++; - } - - if (spare && spare_len > 0) { - if (spare_len > attr->spare_size) - goto err; - - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size, SEEK_SET); - nread = fread(spare, 1, spare_len, emu->fp); - - if (nread != spare_len) { - MSGLN("read page spare I/O error ?"); - goto err; - } - dev->st.io_read += nread; - dev->st.spare_read_count++; - } - - if (data == NULL && spare == NULL) { - // read bad block mark - fseek(emu->fp, abs_page * full_page_size + attr->page_data_size + attr->block_status_offs, SEEK_SET); - nread = fread(&status, 1, 1, emu->fp); - - if (nread != 1) { - MSGLN("read badblock mark I/O error ?"); - goto err; - } - dev->st.io_read++; - - return status == 0xFF ? UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK; - } - - return UFFS_FLASH_NO_ERR; -err: - return UFFS_FLASH_IO_ERR; -} - - -uffs_FlashOps g_femu_ops_ecc_soft = { - femu_InitFlash, // InitFlash() - femu_ReleaseFlash, // ReleaseFlash() - femu_ReadPage, // ReadPage() - NULL, // ReadPageWithLayout - femu_WritePage, // WritePage() - NULL, // WirtePageWithLayout - NULL, // IsBadBlock(), let UFFS take care of it. - NULL, // MarkBadBlock(), let UFFS take care of it. - femu_EraseBlock, // EraseBlock() -}; diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_share.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem_share.c deleted file mode 100644 index 6bd759bb8..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_share.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem_share.c - * \brief emulate uffs file system, shared functions - * \author Ricky Zheng, created Nov, 2010 - */ - - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs_fileem.h" - -#define PFX "femu: " - -/****************************************************************/ -/* Shared flash driver functions: */ -/* */ -/* femu_InitFlash(), femu_ReleaseFlash(), femu_EraseBlock() */ -/* */ -/****************************************************************/ - -static u8 g_page_buf[UFFS_MAX_PAGE_SIZE + UFFS_MAX_SPARE_SIZE]; - -/* - * Create emulator disk, initialise monitors, inject manufacture bad blocks, etc. - * - */ -int femu_InitFlash(uffs_Device *dev) -{ - int i; - int fSize; - int written; - u8 * p = g_page_buf; - uffs_FileEmu *emu; - - struct uffs_StorageAttrSt *attr = dev->attr; - - int full_page_size = attr->page_data_size + attr->spare_size; - int total_pages = attr->total_blocks * attr->pages_per_block; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - if (emu->initCount > 0) { - emu->initCount++; - return 0; - } - - if (emu->emu_filename == NULL) - emu->emu_filename = UFFS_FEMU_FILE_NAME; - - uffs_Perror(UFFS_MSG_NORMAL, "femu device init."); - - emu->em_monitor_page = (u8 *) malloc(sizeof(emu->em_monitor_page[0]) * total_pages); - if (!emu->em_monitor_page) - return -1; - emu->em_monitor_spare = (u8 *) malloc(sizeof(emu->em_monitor_spare[0]) * total_pages); - if (!emu->em_monitor_spare) - return -1; - - emu->em_monitor_block = (u32 *) malloc(sizeof(emu->em_monitor_block[0]) * attr->total_blocks); - if (!emu->em_monitor_block) - return -1; - - //clear monitor - memset(emu->em_monitor_page, 0, sizeof(emu->em_monitor_page[0]) * total_pages); - memset(emu->em_monitor_spare, 0, sizeof(emu->em_monitor_spare[0]) * total_pages); - memset(emu->em_monitor_block, 0, sizeof(emu->em_monitor_block[0]) * attr->total_blocks); - - emu->fp = fopen(emu->emu_filename, "rb"); - if (emu->fp == NULL) { - emu->fp = fopen(emu->emu_filename, "ab+"); - if (emu->fp == NULL) { - printf(PFX"Failed to create uffs emulation file."); - return -1; - } - - fseek(emu->fp, 0, SEEK_END); - fSize = ftell(emu->fp); - - if (fSize < total_pages * full_page_size) { - printf("Creating uffs emulation file\n"); - fseek(emu->fp, 0, SEEK_SET); - memset(p, 0xff, full_page_size); - for (i = 0; i < total_pages; i++) { - written = fwrite(p, 1, full_page_size, emu->fp); - if (written != full_page_size) { - printf("Write failed\n"); - fclose(emu->fp); - emu->fp = NULL; - return -1; - } - } - } - } - - fflush(emu->fp); - fclose(emu->fp); - - emu->fp = fopen(emu->emu_filename, "rb+"); - if (emu->fp == NULL) { - printf(PFX"Can't open emulation file.\n"); - return -1; - } - - emu->initCount++; - - return 0; -} - -/* - * Release resources - */ -int femu_ReleaseFlash(uffs_Device *dev) -{ - uffs_FileEmu *emu; - - emu = (uffs_FileEmu *)(dev->attr->_private); - - emu->initCount--; - - if (emu->initCount == 0) { - - uffs_Perror(UFFS_MSG_NORMAL, "femu device release."); - - if (emu->fp) { - fclose(emu->fp); - emu->fp = NULL; - } - - if (emu->em_monitor_page) - free(emu->em_monitor_page); - if (emu->em_monitor_spare) - free(emu->em_monitor_spare); - if (emu->em_monitor_block) - free(emu->em_monitor_block); - emu->em_monitor_page = NULL; - emu->em_monitor_spare = NULL; - emu->em_monitor_block = NULL; - } - - return 0; -} - -int femu_EraseBlock(uffs_Device *dev, u32 blockNumber) -{ - - int i; - u8 * pg = g_page_buf; - int pg_size, pgd_size, sp_size, blks, blk_pgs, blk_size; - uffs_FileEmu *emu; - emu = (uffs_FileEmu *)(dev->attr->_private); - if (!emu || !(emu->fp)) - goto err; - - pg_size = dev->attr->page_data_size + dev->attr->spare_size; - pgd_size = dev->attr->page_data_size; - sp_size = dev->attr->spare_size; - blk_pgs = dev->attr->pages_per_block; - blks = dev->attr->total_blocks; - blk_size = dev->attr->page_data_size * dev->attr->pages_per_block; - - printf("femu: erase block %d\n", blockNumber); - - if ((int)blockNumber >= blks) { - printf("Attempt to erase non-existant block %d\n",blockNumber); - goto err; - } - else { - - //clear this block monitors - memset(emu->em_monitor_page + (blockNumber * blk_pgs), - 0, - blk_pgs * sizeof(u8)); - memset(emu->em_monitor_spare + (blockNumber * blk_pgs), - 0, - blk_pgs * sizeof(u8)); - - emu->em_monitor_block[blockNumber]++; - - memset(pg, 0xff, (pgd_size + sp_size)); - - fseek(emu->fp, blockNumber * blk_pgs * (pgd_size + sp_size), SEEK_SET); - - for (i = 0; i < blk_pgs; i++) { - fwrite(pg, 1, (pgd_size + sp_size), emu->fp); - } - - fflush(emu->fp); - dev->st.block_erase_count++; - } - - return UFFS_FLASH_NO_ERR; -err: - return UFFS_FLASH_IO_ERR; - -} - diff --git a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_wrap.c b/components/dfs/filesystems/uffs/src/emu/uffs_fileem_wrap.c deleted file mode 100644 index 9893aa2ed..000000000 --- a/components/dfs/filesystems/uffs/src/emu/uffs_fileem_wrap.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fileem_wrap.c - * - * \brief file emulator wrapper functions for injecting bad blocks or ECC errors. - * - * \author Ricky Zheng, created Nov, 2010 - */ - -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs_fileem.h" - -#define PFX "femu: " -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -// #define UFFS_FEMU_SHOW_FLASH_IO - -#ifdef UFFS_FEMU_ENABLE_INJECTION - -struct uffs_FileEmuBitFlip { - int block; - int page; - int offset; - u8 mask; -}; - -/* simulate bad blocks */ -#define FILEEMU_STOCK_BAD_BLOCKS {5, 180} // bad block come from manufacture -#define FILEEMU_ERASE_BAD_BLOCKS {100, 150} // new bad block discovered when erasing - -/* simulating bit flip */ -#define FILEEMU_WRITE_BIT_FLIP \ - { \ - {20, 2, 10, 1 << 4}, /* block 20, page 2, offset 10, bit 4 */ \ - {24, 4, -3, 1 << 2}, /* block 24, page 4, spare offset 3, bit 2*/ \ - {60, 1, 5, 1 << 3}, /* block 60, page 1, offset 5, bit 3 */ \ - {66, 1, 15, 1 << 7}, /* block 66, page 1, offset 300, bit 7 */ \ - {80, 2, 2, 1 << 1}, /* block 80, page 2, offset 2, bit 1 */ \ - {88, 2, 100, 1 << 5}, /* block 88, page 2, offset 100, bit 5 */ \ - } - - -static int femu_InitFlash_wrap(uffs_Device *dev); - -static int femu_ReadPage_wrap(uffs_Device *dev, u32 block, u32 page, u8 *data, int data_len, u8 *ecc, - u8 *spare, int spare_len); -static int femu_ReadPageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, u8* data, int data_len, u8 *ecc, - uffs_TagStore *ts, u8 *ecc_store); -static int femu_WritePage_wrap(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *spare, int spare_len); -static int femu_WritePageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, const u8* data, int data_len, const u8 *ecc, - const uffs_TagStore *ts); -static int femu_EraseBlock_wrap(uffs_Device *dev, u32 blockNumber); - - -///////////////////////////////////////////////////////////////////////////////// - -void femu_setup_wrapper_functions(uffs_Device *dev) -{ - uffs_FileEmu *emu; - emu = (uffs_FileEmu *)(dev->attr->_private); - - // setup wrap functions, for inject ECC errors, etc. - - memcpy(&emu->ops_orig, dev->ops, sizeof(struct uffs_FlashOpsSt)); - - if (dev->ops->InitFlash) - dev->ops->InitFlash = femu_InitFlash_wrap; - if (dev->ops->EraseBlock) - dev->ops->EraseBlock = femu_EraseBlock_wrap; - if (dev->ops->ReadPage) - dev->ops->ReadPage = femu_ReadPage_wrap; - if (dev->ops->ReadPageWithLayout) - dev->ops->ReadPageWithLayout = femu_ReadPageWithLayout_wrap; - if (dev->ops->WritePage) - dev->ops->WritePage = femu_WritePage_wrap; - if (dev->ops->WritePageWithLayout) - dev->ops->WritePageWithLayout = femu_WritePageWithLayout_wrap; -} - -static int femu_InitFlash_wrap(uffs_Device *dev) -{ - int ret; - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - -#ifdef FILEEMU_STOCK_BAD_BLOCKS - u32 bad_blocks[] = FILEEMU_STOCK_BAD_BLOCKS; - int j; - u8 x = 0; - struct uffs_StorageAttrSt *attr = dev->attr; - int full_page_size = attr->page_data_size + attr->spare_size; - int blk_size = full_page_size * attr->pages_per_block; -#endif - - if (emu->initCount == 0) { - ret = emu->ops_orig.InitFlash(dev); -#ifdef FILEEMU_STOCK_BAD_BLOCKS - if (ret >= 0) { - for (j = 0; j < ARRAY_SIZE(bad_blocks); j++) { - if (bad_blocks[j] < dev->attr->total_blocks) { - printf(" --- manufacture bad block %d ---\n", bad_blocks[j]); - fseek(emu->fp, bad_blocks[j] * blk_size + attr->page_data_size + dev->attr->block_status_offs, SEEK_SET); - fwrite(&x, 1, 1, emu->fp); - } - } - } -#endif - } - else { - ret = emu->ops_orig.InitFlash(dev); - } - - return ret; -} - -static int femu_ReadPage_wrap(uffs_Device *dev, u32 block, u32 page, u8 *data, int data_len, u8 *ecc, - u8 *spare, int spare_len) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - -#ifdef UFFS_FEMU_SHOW_FLASH_IO - if (data || spare) { - MSG(PFX " Read block %d page %d", block, page); - if (data) - MSG(" DATA[%d]", data_len); - if (spare) - MSG(" SPARE[%d]", spare_len); - MSG(TENDSTR); - } -#endif - return emu->ops_orig.ReadPage(dev, block, page, data, data_len, ecc, spare, spare_len); -} - -static int femu_ReadPageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, u8* data, int data_len, u8 *ecc, - uffs_TagStore *ts, u8 *ecc_store) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - -#ifdef UFFS_FEMU_SHOW_FLASH_IO - if (data || ts) { - MSG(PFX " Read block %d page %d", block, page); - if (data) - MSG(" DATA[%d]", data_len); - if (ts) - MSG(" TS"); - MSG(TENDSTR); - } -#endif - return emu->ops_orig.ReadPageWithLayout(dev, block, page, data, data_len, ecc, ts, ecc_store); -} - - -////////////////////// wraper functions /////////////////////////// - -static void InjectBitFlip(uffs_Device *dev, u32 block, u32 page) -{ -#ifdef FILEEMU_WRITE_BIT_FLIP - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - struct uffs_FileEmuBitFlip flips[] = FILEEMU_WRITE_BIT_FLIP; - struct uffs_FileEmuBitFlip *x; - u8 buf[UFFS_MAX_PAGE_SIZE + UFFS_MAX_SPARE_SIZE]; - u8 *data = buf; - u8 *spare = buf + dev->attr->page_data_size; - int full_page_size = dev->attr->page_data_size + dev->attr->spare_size; - int blk_size = full_page_size * dev->attr->pages_per_block; - int page_offset = block * blk_size + full_page_size * page; - - int i; - u8 *p; - - fseek(emu->fp, page_offset, SEEK_SET); - fread(buf, 1, full_page_size, emu->fp); - - p = NULL; - for (i = 0; i < ARRAY_SIZE(flips); i++) { - x = &flips[i]; - if (x->block == block && x->page == page) { - if (x->offset >= 0) { - printf(" --- Inject data bit flip at block%d, page%d, offset%d, mask%d --- \n", block, page, x->offset, x->mask); - p = (u8 *)(data + x->offset); - } - else { - printf(" --- Inject spare bit flip at block%d, page%d, offset%d, mask%d --- \n", block, page, -x->offset, x->mask); - p = (u8 *)(spare - x->offset); - } - *p = (*p & ~x->mask) | (~(*p & x->mask) & x->mask); - } - } - - if (p) { - fseek(emu->fp, page_offset, SEEK_SET); - fwrite(buf, 1, full_page_size, emu->fp); - } -#endif -} - -static int femu_WritePage_wrap(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *spare, int spare_len) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - int ret; - -#ifdef UFFS_FEMU_SHOW_FLASH_IO - if (data || spare) { - MSG(PFX " Write block %d page %d", block, page); - if (data) - MSG(" DATA[%d]", data_len); - if (spare) - MSG(" SPARE[%d]", spare_len); - MSG(TENDSTR); - } -#endif - - ret = emu->ops_orig.WritePage(dev, block, page, data, data_len, spare, spare_len); - - InjectBitFlip(dev, block, page); - - return ret; -} - -static int femu_WritePageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, const u8* data, int data_len, const u8 *ecc, - const uffs_TagStore *ts) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - int ret; - -#ifdef UFFS_FEMU_SHOW_FLASH_IO - if (data || ts) { - MSG(PFX " Write block %d page %d", block, page); - if (data) - MSG(" DATA[%d]", data_len); - if (ts) - MSG(" TS"); - MSG(TENDSTR); - } -#endif - - ret = emu->ops_orig.WritePageWithLayout(dev, block, page, data, data_len, ecc, ts); - - InjectBitFlip(dev, block, page); - - return ret; -} - - -static int femu_EraseBlock_wrap(uffs_Device *dev, u32 blockNumber) -{ - uffs_FileEmu *emu = (uffs_FileEmu *)(dev->attr->_private); - -#ifdef FILEEMU_ERASE_BAD_BLOCKS - int blocks[] = FILEEMU_ERASE_BAD_BLOCKS; - int i; - URET ret; - ret = emu->ops_orig.EraseBlock(dev, blockNumber); - - for (i = 0; i < ARRAY_SIZE(blocks); i++) { - if (blockNumber == blocks[i]) { - printf(" --- Inject bad block%d when erasing --- \n", blockNumber); - ret = UFFS_FLASH_BAD_BLK; - } - } - - return ret; - -#else - - return emu->ops_orig.EraseBlock(dev, blockNumber); - -#endif -} - -#endif // UFFS_FEMU_ENABLE_INJECTION - -///////////////////////////////////////////////////////////////////////////////// diff --git a/components/dfs/filesystems/uffs/src/example/CMakeLists.txt b/components/dfs/filesystems/uffs/src/example/CMakeLists.txt deleted file mode 100644 index 18cb30715..000000000 --- a/components/dfs/filesystems/uffs/src/example/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -IF (UNIX) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/posix) -ENDIF() -IF (WIN32) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/win32) -ENDIF() -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc) -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/emu) - -LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/emu) -LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/uffs) - -SET(static_mem_SRCS static-mem-allocate.c) -SET(flash_if_SRCS flash-interface-example.c) -ADD_EXECUTABLE(static-mem-example ${static_mem_SRCS}) -ADD_EXECUTABLE(flash-if-example ${flash_if_SRCS}) -TARGET_LINK_LIBRARIES(static-mem-example emu uffs emu platform apitest_server) -TARGET_LINK_LIBRARIES(flash-if-example emu uffs emu platform) -IF (UNIX) - TARGET_LINK_LIBRARIES(static-mem-example pthread) -ENDIF () - diff --git a/components/dfs/filesystems/uffs/src/example/flash-interface-example.c b/components/dfs/filesystems/uffs/src/example/flash-interface-example.c deleted file mode 100644 index 9a6e00826..000000000 --- a/components/dfs/filesystems/uffs/src/example/flash-interface-example.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file flash-interface-example.c - * \brief example for using flash driver and multiple partitions, with static memory allocator. - * \author Ricky Zheng, created at 27 Nov, 2007 - */ - -#include -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_flash.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_fs.h" - -#define PFX "ndrv: " - -struct my_nand_chip { - void *IOR_ADDR; - void *IOW_ADDR; - UBOOL inited; - // ... -}; - -/* - * Standard NAND flash commands - */ -#define NAND_CMD_READ0 0 -#define NAND_CMD_READ1 1 -#define NAND_CMD_RNDOUT 5 -#define NAND_CMD_PAGEPROG 0x10 -#define NAND_CMD_READOOB 0x50 -#define NAND_CMD_ERASE1 0x60 -#define NAND_CMD_STATUS 0x70 -#define NAND_CMD_STATUS_MULTI 0x71 -#define NAND_CMD_SEQIN 0x80 -#define NAND_CMD_RNDIN 0x85 -#define NAND_CMD_READID 0x90 -#define NAND_CMD_ERASE2 0xd0 -#define NAND_CMD_RESET 0xff - - -/* impelent the following functions for your NAND flash */ -#define CHIP_SET_CLE(chip) { chip = chip; } -#define CHIP_CLR_CLE(chip) {} -#define CHIP_SET_ALE(chip) {} -#define CHIP_CLR_ALE(chip) {} -#define CHIP_SET_NCS(chip) {} -#define CHIP_CLR_NCS(chip) {} -#define CHIP_BUSY(chip) {} -#define CHIP_READY(chip) {} -#define WRITE_COMMAND(chip, cmd) {} -#define WRITE_DATA_ADDR(chip, block, page, offset) {} -#define WRITE_ERASE_ADDR(chip, block) {} -#define WRITE_DATA(chip, data, len) {} -#define READ_DATA(chip, data, len) {} - -#define PARSE_STATUS(v) (UFFS_FLASH_NO_ERR) // parse status to UFFS_FLASH_NO_ERR or UFFS_FLASH_BAD_BLK - - - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR == 0 -int main() -{ - uffs_Perror(UFFS_MSG_NORMAL, "This example need CONFIG_USE_STATIC_MEMORY_ALLOCATOR = 1"); - return 0; -} -#else - - -static int nand_read_page(uffs_Device *dev, u32 block, u32 page, u8 *data, int data_len, u8 *ecc, - u8 *spare, int spare_len) -{ - u8 val = 0; - int ret = UFFS_FLASH_NO_ERR; - struct my_nand_chip *chip = (struct my_nand_chip *) dev->attr->_private; - - CHIP_CLR_NCS(chip); - if (data && data_len > 0) { - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READ0); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, 0); - CHIP_CLR_ALE(chip); - READ_DATA(chip, data, data_len); - - // for now, we return all 0xFF to pass UFFS mount, you should remove this at your driver - memset(data, 0xFF, data_len); - } - - if (spare && spare_len > 0) { - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READOOB); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, dev->attr->page_data_size); - CHIP_CLR_ALE(chip); - READ_DATA(chip, spare, spare_len); - - // for now, we return all 0xFF to pass UFFS mount, you should remove this at your driver - memset(spare, 0xFF, spare_len); - } - - if (data == NULL && spare == NULL) { - // read bad block mark - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READOOB); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, dev->attr->page_data_size + attr->block_status_offs); - CHIP_CLR_ALE(chip); - READ_DATA(chip, &val, 1); - ret = (val == 0xFF ? UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK); - - // for now, we return UFFS_FLASH_NO_ERR to pass UFFS mount, you should remove this at your driver - ret = UFFS_FLASH_NO_ERR; - } - - CHIP_SET_NCS(chip); - - return ret; -} - -static int nand_write_page(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *spare, int spare_len) -{ - u8 val = 0; - int ret = UFFS_FLASH_NO_ERR; - UBOOL fall_through = FALSE; - struct my_nand_chip *chip = (struct my_nand_chip *) dev->attr->_private; - - CHIP_CLR_NCS(chip); - - if (data && data_len > 0) { - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READ0); - WRITE_COMMAND(chip, NAND_CMD_SEQIN); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, 0); - CHIP_CLR_ALE(chip); - CHIP_BUSY(chip); - WRITE_DATA(chip, data, data_len); - if (data_len == dev->attr->page_data_size) - fall_through = U_TRUE; - else { - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_PAGEPROG); - WRITE_COMMAND(chip, NAND_CMD_STATUS); - CHIP_CLR_CLE(chip); - CHIP_READY(chip); - READ_DATA(chip, &val, 1); - ret = PARSE_STATUS(val); - } - } - - if (ret != UFFS_FLASH_NO_ERR) - goto ext; - - if (spare && spare_len > 0) { - if (!fall_through) { - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READOOB); - WRITE_COMMAND(chip, NAND_CMD_SEQIN); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, dev->attr->page_data_size); - CHIP_CLR_ALE(chip); - CHIP_BUSY(chip); - } - WRITE_DATA(chip, spare, spare_len); - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_PAGEPROG); - WRITE_COMMAND(chip, NAND_CMD_STATUS); - CHIP_CLR_CLE(chip); - CHIP_READY(chip); - READ_DATA(chip, &val, 1); - ret = PARSE_STATUS(val); - } - - if (data == NULL && spare == NULL) { - // mark bad block - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_READOOB); - WRITE_COMMAND(chip, NAND_CMD_SEQIN); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_DATA_ADDR(chip, block, page, dev->attr->page_data_size + attr->block_status_offs); - CHIP_CLR_ALE(chip); - CHIP_BUSY(chip); - val = 0; - WRITE_DATA(chip, &val, 1); - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_PAGEPROG); - WRITE_COMMAND(chip, NAND_CMD_STATUS); - CHIP_CLR_CLE(chip); - CHIP_READY(chip); - READ_DATA(chip, &val, 1); - ret = PARSE_STATUS(val); - } - -ext: - CHIP_SET_NCS(chip); - - return ret; -} - -static int nand_erase_block(uffs_Device *dev, u32 block) -{ - u8 val = 0; - struct my_nand_chip *chip = (struct my_nand_chip *) dev->attr->_private; - - CHIP_CLR_NCS(chip); - - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_ERASE1); - CHIP_CLR_CLE(chip); - CHIP_SET_ALE(chip); - WRITE_ERASE_ADDR(chip, blcok); - CHIP_CLR_ALE(chip); - CHIP_SET_CLE(chip); - WRITE_COMMAND(chip, NAND_CMD_ERASE2); - WRITE_COMMAND(chip, NAND_CMD_STATUS); - CHIP_CLR_CLE(chip); - CHIP_READY(chip); - READ_DATA(chip, &val, 1); - - CHIP_SET_NCS(chip); - - val = val; // just for eliminating warning - - return PARSE_STATUS(val); -} - - -static int nand_init_flash(uffs_Device *dev) -{ - // initialize your hardware here ... - struct my_nand_chip *chip = (struct my_nand_chip *) dev->attr->_private; - - if (!chip->inited) { - // setup chip I/O address, setup NAND flash controller ... etc. - // chip->IOR_ADDR = 0xF0000000 - // chip->IOW_ADDR = 0xF0000000 - chip->inited = U_TRUE; - } - return 0; -} - -static int nand_release_flash(uffs_Device *dev) -{ - // release your hardware here - struct my_nand_chip *chip = (struct my_nand_chip *) dev->attr->_private; - - chip = chip; - - return 0; -} - -static uffs_FlashOps g_my_nand_ops = { - nand_init_flash, // InitFlash() - nand_release_flash, // ReleaseFlash() - nand_read_page, // ReadPage() - NULL, // ReadPageWithLayout - nand_write_page, // WritePage() - NULL, // WirtePageWithLayout - NULL, // IsBadBlock(), let UFFS take care of it. - NULL, // MarkBadBlock(), let UFFS take care of it. - nand_erase_block, // EraseBlock() -}; - -///////////////////////////////////////////////////////////////////////////////// - -// change these parameters to fit your nand flash specification - -#define TOTAL_BLOCKS 1024 -#define PAGE_DATA_SIZE 512 -#define PAGE_SPARE_SIZE 16 -#define PAGES_PER_BLOCK 32 -#define PAGE_SIZE (PAGE_DATA_SIZE + PAGE_SPARE_SIZE) -#define BLOCK_DATA_SIZE (PAGE_DATA_SIZE * PAGES_PER_BLOCK) - -#define NR_PARTITION 2 /* total partitions */ -#define PAR_1_BLOCKS 100 /* partition 1 */ -#define PAR_2_BLOCKS (TOTAL_BLOCKS - PAR_1_BLOCKS) /* partition 2 */ - -struct my_nand_chip g_nand_chip = {0}; -static struct uffs_StorageAttrSt g_my_flash_storage = {0}; - -/* define mount table */ -static uffs_Device demo_device_1 = {0}; -static uffs_Device demo_device_2 = {0}; - -static uffs_MountTable demo_mount_table[] = { - { &demo_device_1, 0, PAR_1_BLOCKS - 1, "/data/" }, - { &demo_device_2, PAR_1_BLOCKS, PAR_1_BLOCKS + PAR_2_BLOCKS - 1, "/" }, - { NULL, 0, 0, NULL } -}; - -/* static alloc the memory for each partition */ -static int static_buffer_par1[UFFS_STATIC_BUFF_SIZE(PAGES_PER_BLOCK, PAGE_SIZE, PAR_1_BLOCKS) / sizeof(int)]; -static int static_buffer_par2[UFFS_STATIC_BUFF_SIZE(PAGES_PER_BLOCK, PAGE_SIZE, PAR_2_BLOCKS) / sizeof(int)];; - -static void init_nand_chip(struct my_nand_chip *chip) -{ - // init chip IO address, etc. -} - -static void setup_flash_storage(struct uffs_StorageAttrSt *attr) -{ - memset(attr, 0, sizeof(struct uffs_StorageAttrSt)); - - // setup NAND flash attributes. - attr->total_blocks = TOTAL_BLOCKS; /* total blocks */ - attr->page_data_size = PAGE_DATA_SIZE; /* page data size */ - attr->pages_per_block = PAGES_PER_BLOCK; /* pages per block */ - attr->spare_size = PAGE_SPARE_SIZE; /* page spare size */ - attr->block_status_offs = 4; /* block status offset is 5th byte in spare */ - attr->ecc_opt = UFFS_ECC_SOFT; /* ecc option */ - attr->layout_opt = UFFS_LAYOUT_UFFS; /* let UFFS do the spare layout */ -} - -static URET my_InitDevice(uffs_Device *dev) -{ - dev->attr = &g_my_flash_storage; // NAND flash attributes - dev->attr->_private = (void *) &g_nand_chip;// hook nand_chip data structure to attr->_private - dev->ops = &g_my_nand_ops; // NAND driver - - init_nand_chip(&g_nand_chip); - - return U_SUCC; -} - -static URET my_ReleaseDevice(uffs_Device *dev) -{ - return U_SUCC; -} - - -static int my_init_filesystem(void) -{ - uffs_MountTable *mtbl = &(demo_mount_table[0]); - - /* setup nand storage attributes */ - setup_flash_storage(&g_my_flash_storage); - - /* setup memory allocator */ - uffs_MemSetupStaticAllocator(&demo_device_1.mem, static_buffer_par1, sizeof(static_buffer_par1)); - uffs_MemSetupStaticAllocator(&demo_device_2.mem, static_buffer_par2, sizeof(static_buffer_par2)); - - /* register mount table */ - while(mtbl->dev) { - // setup device init/release entry - mtbl->dev->Init = my_InitDevice; - mtbl->dev->Release = my_ReleaseDevice; - uffs_RegisterMountTable(mtbl); - mtbl++; - } - - // mount partitions - for (mtbl = &(demo_mount_table[0]); mtbl->mount != NULL; mtbl++) { - uffs_Mount(mtbl->mount); - } - - return uffs_InitFileSystemObjects() == U_SUCC ? 0 : -1; -} - -static int my_release_filesystem(void) -{ - uffs_MountTable *mtb; - int ret = 0; - - // unmount parttions - for (mtb = &(demo_mount_table[0]); ret == 0 && mtb->mount != NULL; mtb++) { - ret = uffs_UnMount(mtb->mount); - } - - // release objects - if (ret == 0) - ret = (uffs_ReleaseFileSystemObjects() == U_SUCC ? 0 : -1); - - return ret; -} - -/* application entry */ -int main() -{ - uffs_SetupDebugOutput(); // setup debug output as early as possible - - my_init_filesystem(); - - // ... my application codes .... - // read/write/create/delete files ... - - my_release_filesystem(); - - return 0; -} - -#endif - - -///////////////////////////////////////////////////////////////////////////////// diff --git a/components/dfs/filesystems/uffs/src/example/static-mem-allocate.c b/components/dfs/filesystems/uffs/src/example/static-mem-allocate.c deleted file mode 100644 index 59aff8e63..000000000 --- a/components/dfs/filesystems/uffs/src/example/static-mem-allocate.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file static-mem-allocate.c - * \brief demostrate how to use static memory allocation. This example use - * file emulated NAND flash, one partition only. - * \author Ricky Zheng - */ - -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_mtb.h" -#include "cmdline.h" -#include "uffs_fileem.h" - -#define PFX "sexp: " - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR == 0 -int main() -{ - uffs_Perror(UFFS_MSG_NORMAL, "This example need CONFIG_USE_STATIC_MEMORY_ALLOCATOR = 1"); - return 0; -} -#else - -extern struct cli_commandset * get_helper_cmds(void); -extern struct cli_commandset * get_test_cmds(void); - -#define PAGE_DATA_SIZE 512 -#define PAGE_SPARE_SIZE 16 -#define PAGES_PER_BLOCK 32 -#define TOTAL_BLOCKS 128 - -#define PAGE_SIZE (PAGE_DATA_SIZE + PAGE_SPARE_SIZE) -#define BLOCK_DATA_SIZE (PAGES_PER_BLOCK * PAGE_DATA_SIZE) -#define TOTAL_DATA_SIZE (TOTAL_BLOCKS * BLOCK_DATA_SIZE) -#define BLOCK_SIZE (PAGES_PER_BLOCK * PAGE_SIZE) -#define TOTAL_SIZE (BLOCK_SIZE * TOTAL_BLOCKS) - -#define MAX_MOUNT_TABLES 10 -#define MAX_MOUNT_POINT_NAME 32 - -static uffs_Device demo_device = {0}; -static struct uffs_MountTableEntrySt demo_mount = { - &demo_device, - 0, /* start from block 0 */ - -1, /* use whole chip */ - "/", /* mount point */ - NULL -}; - -/* static alloc the memory */ -static int static_buffer_pool[UFFS_STATIC_BUFF_SIZE(PAGES_PER_BLOCK, PAGE_SIZE, TOTAL_BLOCKS) / sizeof(int)]; - - -static void setup_storage(struct uffs_StorageAttrSt *attr) -{ - attr->total_blocks = TOTAL_BLOCKS; /* total blocks */ - attr->page_data_size = PAGE_DATA_SIZE; /* page data size */ - attr->spare_size = PAGE_SPARE_SIZE; /* page spare size */ - attr->pages_per_block = PAGES_PER_BLOCK; /* pages per block */ - attr->block_status_offs = 4; /* block status offset is 5th byte in spare */ - attr->ecc_opt = UFFS_ECC_SOFT; /* use UFFS software ecc */ - attr->layout_opt = UFFS_LAYOUT_UFFS; /* let UFFS do the spare layout */ -} - -static void setup_device(uffs_Device *dev) -{ - // using file emulator device - dev->Init = femu_InitDevice; - dev->Release = femu_ReleaseDevice; - dev->attr = femu_GetStorage(); -} - -static int init_uffs_fs(void) -{ - struct uffs_MountTableEntrySt *mtbl = &demo_mount; - - /* setup flash storage attributes */ - setup_storage(femu_GetStorage()); - - /* setup memory allocator */ - uffs_MemSetupStaticAllocator(&mtbl->dev->mem, static_buffer_pool, sizeof(static_buffer_pool)); - - /* setup device: init, release, attr */ - setup_device(mtbl->dev); - - /* register mount table */ - uffs_RegisterMountTable(mtbl); - - /* mount it */ - uffs_Mount("/"); - - return uffs_InitFileSystemObjects() == U_SUCC ? 0 : -1; -} - -static int release_uffs_fs(void) -{ - uffs_UnMount("/"); - - return uffs_ReleaseFileSystemObjects(); -} - -int main(int argc, char *argv[]) -{ - int ret; - - uffs_SetupDebugOutput(); // setup debug output as early as possible - - ret = init_uffs_fs(); - - if (ret != 0) { - printf ("Init file system fail: %d\n", ret); - return -1; - } - - cli_add_commandset(get_helper_cmds()); - cli_add_commandset(get_test_cmds()); - cli_main_entry(); - - release_uffs_fs(); - - return 0; -} - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs.h deleted file mode 100644 index 12121cd1a..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file uffs.h - * \brief uffs basic defines - * \author Ricky Zheng - */ - -#ifndef _UFFS_H_ -#define _UFFS_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - -#define UO_RDONLY 0x0000 /** read only */ -#define UO_WRONLY 0x0001 /** write only */ -#define UO_RDWR 0x0002 /** read and write */ -#define UO_APPEND 0x0008 /** append */ - -#define UO_BINARY 0x0000 /** no used in uffs */ - -#define UO_CREATE 0x0100 -#define UO_TRUNC 0x0200 -#define UO_EXCL 0x0400 - -#define UO_NOECC 0x0800 /** skip ECC when reading file data from media */ - - -#define UO_DIR 0x1000 /** open a directory */ - - - -#define UENOERR 0 /** no error */ -#define UEACCES 1 /** Tried to open read-only file - for writing, or files sharing mode - does not allow specified operations, - or given path is directory */ - -#define UEEXIST 2 /** _O_CREAT and _O_EXCL flags specified, - but filename already exists */ -#define UEINVAL 3 /** Invalid oflag or pmode argument */ -#define UEMFILE 4 /** No more file handles available - (too many open files) */ -#define UENOENT 5 /** file or path not found */ -#define UETIME 6 /** can't set file time */ -#define UEBADF 9 /** invalid file handle */ -#define UENOMEM 10 /** no enough memory */ -#define UEIOERR 11 /** I/O error from lower level flash operation */ -#define UENOTDIR 12 /** Not a directory */ -#define UEISDIR 13 /** Is a directory */ - -#define UEUNKNOWN_ERR 100 /** unknown error */ - - - -#define _SEEK_CUR 0 /** seek from current position */ -#define _SEEK_SET 1 /** seek from beginning of file */ -#define _SEEK_END 2 /** seek from end of file */ - -#define USEEK_CUR _SEEK_CUR -#define USEEK_SET _SEEK_SET -#define USEEK_END _SEEK_END - - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_badblock.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_badblock.h deleted file mode 100644 index b44bbb817..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_badblock.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file uffs_badblock.h - * \brief bad block management - * \author Ricky Zheng - */ - -#ifndef _UFFS_BADBLOCK_H_ -#define _UFFS_BADBLOCK_H_ - -#include "uffs/uffs_public.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -#define HAVE_BADBLOCK(dev) (dev->bad.block != UFFS_INVALID_BLOCK) - -/** initialize bad block management data structures for uffs device */ -void uffs_BadBlockInit(uffs_Device *dev); - -/** processing bad block: erase bad block, - mark it as 'bad' and put it to bad block list */ -void uffs_BadBlockProcess(uffs_Device *dev, TreeNode *node); - -/** processing bad block: erase bad block, - mark it as 'bad' and put it to suspend block list */ -void uffs_BadBlockProcessSuspend(uffs_Device *dev, TreeNode *node); - -/** try to recover data from a new discovered bad block */ -void uffs_BadBlockRecover(uffs_Device *dev); - -/** put a new block to the bad block waiting list */ -void uffs_BadBlockAdd(uffs_Device *dev, int block); - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_blockinfo.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_blockinfo.h deleted file mode 100644 index dfd3a9be7..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_blockinfo.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file uffs_blockinfo.h - * \brief data structure for operating block information - * \author Ricky Zheng - */ - -#ifndef _UFFS_BLOCKINFO_H_ -#define _UFFS_BLOCKINFO_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif -/** - * \struct uffs_PageSpareSt - * \brief this structure is for storing uffs tag and more. - */ -struct uffs_PageSpareSt { - uffs_Tags tag; //!< page tag - int expired:1; -}; - -/** - * \struct uffs_BlockInfoSt - * \brief block information data. Block info is frequently accessed, - UFFS use a cache system to speed up block info access. - */ -struct uffs_BlockInfoSt { - struct uffs_BlockInfoSt *next; - struct uffs_BlockInfoSt *prev; - u16 block; //!< block number - struct uffs_PageSpareSt *spares; //!< page spare info array - int expired_count; //!< how many pages expired in this block ? - int ref_count; //!< reference counter, it's safe to reuse this block memory when the counter is 0. -}; - -/** get tag from block info */ -#define GET_TAG(bc, page) (&(bc)->spares[page].tag) - - -/** initialize block info caches */ -URET uffs_BlockInfoInitCache(uffs_Device *dev, int maxCachedBlocks); - -/** release block info caches */ -URET uffs_BlockInfoReleaseCache(uffs_Device *dev); - -/** load page spare to block info cache */ -URET uffs_BlockInfoLoad(uffs_Device *dev, uffs_BlockInfo *work, int page); - -/** find block info cache */ -uffs_BlockInfo * uffs_BlockInfoFindInCache(uffs_Device *dev, int block); - -/** get block info cache, load it on demand */ -uffs_BlockInfo * uffs_BlockInfoGet(uffs_Device *dev, int block); - -/** put info cache back to pool, should be called with #uffs_BlockInfoGet in pairs. */ -void uffs_BlockInfoPut(uffs_Device *dev, uffs_BlockInfo *p); - -/** explicitly expire a block info cache */ -void uffs_BlockInfoExpire(uffs_Device *dev, uffs_BlockInfo *p, int page); - -/** no one hold any block info cache ? safe to release block info caches */ -UBOOL uffs_BlockInfoIsAllFree(uffs_Device *dev); - -/** explicitly expire all block info caches */ -void uffs_BlockInfoExpireAll(uffs_Device *dev); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_buf.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_buf.h deleted file mode 100644 index b5c99f6d5..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_buf.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_buf.h - * \brief page buffers - * \author Ricky Zheng - */ - -#ifndef UFFS_BUF_H -#define UFFS_BUF_H - -#include "uffs/uffs_types.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_tree.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#define CLONE_BUF_MARK 0xffff //!< set uffs_BufSt::ref_count to this for a 'cloned' buffer - -/** for uffs_BufSt::mark */ -#define UFFS_BUF_EMPTY 0 //!< buffer is empty -#define UFFS_BUF_VALID 1 //!< buffer is holding valid data -#define UFFS_BUF_DIRTY 2 //!< buffer data is modified - -/** for uffs_BufSt::ext_mark */ -#define UFFS_BUF_EXT_MARK_TRUNC_TAIL 1 //!< the last page of file (when truncating a file) - -/** uffs page buffer */ -struct uffs_BufSt{ - struct uffs_BufSt *next; //!< link to next buffer - struct uffs_BufSt *prev; //!< link to previous buffer - struct uffs_BufSt *next_dirty; //!< link to next dirty buffer - struct uffs_BufSt *prev_dirty; //!< link to previous dirty buffer - u8 type; //!< #UFFS_TYPE_DIR or #UFFS_TYPE_FILE or #UFFS_TYPE_DATA - u8 ext_mark; //!< extension mark. - u16 parent; //!< parent serial - u16 serial; //!< serial - u16 page_id; //!< page id - u16 mark; //!< #UFFS_BUF_EMPTY or #UFFS_BUF_VALID, or #UFFS_BUF_DIRTY ? - u16 ref_count; //!< reference counter, or #CLONE_BUF_MARK for a cloned buffer - u16 data_len; //!< length of data - u16 check_sum; //!< checksum field - u8 * data; //!< data buffer - u8 * header; //!< header -}; - -#define uffs_BufIsFree(buf) (buf->ref_count == 0 ? U_TRUE : U_FALSE) - -/** initialize page buffers */ -URET uffs_BufInit(struct uffs_DeviceSt *dev, int buf_max, int dirty_buf_max); - -/** release page buffers */ -URET uffs_BufReleaseAll(struct uffs_DeviceSt *dev); - -/** find the page buffer, move to link list head if found */ -uffs_Buf * uffs_BufGet(struct uffs_DeviceSt *dev, u16 parent, u16 serial, u16 page_id); -uffs_Buf *uffs_BufGetEx(struct uffs_DeviceSt *dev, u8 type, TreeNode *node, u16 page_id, int oflag); - -/** alloc a new page buffer */ -uffs_Buf *uffs_BufNew(struct uffs_DeviceSt *dev, u8 type, u16 parent, u16 serial, u16 page_id); - -/** find the page buffer (not affect the reference counter) */ -uffs_Buf * uffs_BufFind(uffs_Device *dev, u16 parent, u16 serial, u16 page_id); - -/** find the page buffer from #start (not affect the reference counter) */ -uffs_Buf * uffs_BufFindFrom(uffs_Device *dev, uffs_Buf *start, - u16 parent, u16 serial, u16 page_id); - -/** put page buffer back to pool, called in pair with #uffs_Get,#uffs_GetEx or #uffs_BufNew */ -URET uffs_BufPut(uffs_Device *dev, uffs_Buf *buf); - -/** increase buffer references */ -void uffs_BufIncRef(uffs_Buf *buf); - -/** decrease buffer references */ -void uffs_BufDecRef(uffs_Buf *buf); - -/** write data to a page buffer */ -URET uffs_BufWrite(struct uffs_DeviceSt *dev, uffs_Buf *buf, void *data, u32 ofs, u32 len); - -/** read data from a page buffer */ -URET uffs_BufRead(struct uffs_DeviceSt *dev, uffs_Buf *buf, void *data, u32 ofs, u32 len); - -/** mark buffer as #UFFS_BUF_EMPTY if ref_count == 0, and discard all data it holds */ -void uffs_BufMarkEmpty(uffs_Device *dev, uffs_Buf *buf); - -/** if there is no free dirty group slot, flush the most dirty group */ -URET uffs_BufFlush(struct uffs_DeviceSt *dev); -URET uffs_BufFlushEx(struct uffs_DeviceSt *dev, UBOOL force_block_recover); - -/** flush dirty group */ -URET uffs_BufFlushGroup(struct uffs_DeviceSt *dev, u16 parent, u16 serial); -URET uffs_BufFlushGroupEx(struct uffs_DeviceSt *dev, u16 parent, u16 serial, UBOOL force_block_recover); - -/** find free dirty group slot */ -int uffs_BufFindFreeGroupSlot(struct uffs_DeviceSt *dev); - -/** find the dirty group slot */ -int uffs_BufFindGroupSlot(struct uffs_DeviceSt *dev, u16 parent, u16 serial); - -/** lock dirty group */ -URET uffs_BufLockGroup(struct uffs_DeviceSt *dev, int slot); - -/** unlock dirty group */ -URET uffs_BufUnLockGroup(struct uffs_DeviceSt *dev, int slot); - -/** flush most dirty group */ -URET uffs_BufFlushMostDirtyGroup(struct uffs_DeviceSt *dev); - -/** flush all groups under the same parent number */ -URET uffs_BufFlushGroupMatchParent(struct uffs_DeviceSt *dev, u16 parent); - -/** flush all page buffers */ -URET uffs_BufFlushAll(struct uffs_DeviceSt *dev); - -/** no one holding any page buffer ? safe to release page buffers */ -UBOOL uffs_BufIsAllFree(struct uffs_DeviceSt *dev); - -/** are all page buffer marked with #UFFS_BUF_EMPTY ? */ -UBOOL uffs_BufIsAllEmpty(struct uffs_DeviceSt *dev); - -/** mark all page buffer as #UFFS_BUF_EMPTY */ -URET uffs_BufSetAllEmpty(struct uffs_DeviceSt *dev); - -/** clone a page buffer */ -uffs_Buf * uffs_BufClone(struct uffs_DeviceSt *dev, uffs_Buf *buf); - -/** release a cloned page buffer, call in pair with #uffs_BufClone */ -URET uffs_BufFreeClone(uffs_Device *dev, uffs_Buf *buf); - -/** load physical storage data to page buffer */ -URET uffs_BufLoadPhyData(uffs_Device *dev, uffs_Buf *buf, u32 block, u32 page); - -/** load physical storage data to page buffer withouth checking ECC */ -URET uffs_LoadPhyDataToBufEccUnCare(uffs_Device *dev, uffs_Buf *buf, u32 block, u32 page); - -/** showing page buffers info, for debug only */ -void uffs_BufInspect(uffs_Device *dev); - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_core.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_core.h deleted file mode 100644 index 1f18007f0..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_core.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_CORE_H_ -#define _UFFS_CORE_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - -/** \typedef uffs_Device */ -typedef struct uffs_DeviceSt uffs_Device; -/** \typedef uffs_FlashOps */ -typedef struct uffs_FlashOpsSt uffs_FlashOps; - -typedef struct uffs_BlockInfoSt uffs_BlockInfo; -typedef struct uffs_PageSpareSt uffs_PageSpare; -typedef struct uffs_TagsSt uffs_Tags; //!< UFFS page tags -typedef struct uffs_TagStoreSt uffs_TagStore; //!< UFFS page tags physical store structure - -typedef struct uffs_BufSt uffs_Buf; - - -#ifdef __cplusplus -} -#endif - - - -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_crc.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_crc.h deleted file mode 100644 index a31bb21c9..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_crc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_crc.h - * \author Ricky Zheng, created 23 Nov, 2011 - */ - -#ifndef _UFFS_CRC_H_ -#define _UFFS_CRC_H_ - -#include "uffs/uffs_types.h" - -u16 uffs_crc16update(const void *data, int length, u16 crc); -u16 uffs_crc16sum(const void *data, int length); - -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_device.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_device.h deleted file mode 100644 index 22614528a..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_device.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_device.h - * \brief uffs device structures definition - * \author Ricky Zheng - */ - -#ifndef UFFS_DEVICE_H -#define UFFS_DEVICE_H - -#include "uffs/uffs_types.h" -#include "uffs/uffs_buf.h" -#include "uffs/uffs_blockinfo.h" -#include "uffs/uffs_pool.h" -#include "uffs/uffs_tree.h" -#include "uffs/uffs_mem.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_flash.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -/** - * \def MAX_DIRTY_BUF_GROUPS - */ -#define MAX_DIRTY_BUF_GROUPS 3 - - -/** - * \struct uffs_BlockInfoCacheSt - * \brief block information structure, used to manager block information caches - */ -struct uffs_BlockInfoCacheSt { - uffs_BlockInfo *head; //!< buffer head of block info(spares) - uffs_BlockInfo *tail; //!< buffer tail - void *mem_pool; //!< internal memory pool, used for release whole buffer -}; - -/** - * \struct uffs_PartitionSt - * \brief partition basic information - */ -struct uffs_PartitionSt { - u16 start; //!< start block number of partition - u16 end; //!< end block number of partition -}; - -/** - * \struct uffs_LockSt - * \brief lock stuffs - */ -struct uffs_LockSt { - OSSEM sem; - int task_id; - int counter; -}; - -/** - * \struct uffs_DirtyGroupSt - * \brief manager dirty page buffers - */ -struct uffs_DirtyGroupSt { - int count; //!< dirty buffers count - int lock; //!< dirty group lock (0: unlocked, >0: locked) - uffs_Buf *dirty; //!< dirty buffer list -}; - -/** - * \struct uffs_PageBufDescSt - * \brief uffs page buffers descriptor - */ -struct uffs_PageBufDescSt { - uffs_Buf *head; //!< head of buffers - uffs_Buf *tail; //!< tail of buffers - struct uffs_DirtyGroupSt dirtyGroup[MAX_DIRTY_BUF_GROUPS]; //!< dirty buffer groups - int buf_max; //!< maximum buffers - int dirty_buf_max; //!< maximum dirty buffer allowed - void *pool; //!< memory pool for buffers -}; - - -/** - * \struct uffs_PageCommInfoSt - * \brief common data for device, should be initialised at early - * \note it is possible that pg_size is smaller than physical page size, but normally they are the same. - * \note page data layout: [HEADER] + [DATA] - */ -struct uffs_PageCommInfoSt { - u16 pg_data_size; //!< page data size - u16 header_size; //!< header size - u16 pg_size; //!< page size -}; - -/** - * \struct uffs_NewBadBlockSt - * \brief holding new discovered bad block - */ -struct uffs_NewBadBlockSt { - u16 block; //!< bad block, FIX ME to process more than one bad block -}; - -/** - * \struct uffs_FlashStatSt - * \typedef uffs_FlashStat - * \brief statistic data of flash read/write/erase activities - */ -typedef struct uffs_FlashStatSt { - int block_erase_count; - int page_write_count; - int page_read_count; - int page_header_read_count; - int spare_write_count; - int spare_read_count; - unsigned long io_read; - unsigned long io_write; -} uffs_FlashStat; - - -/** - * \struct uffs_ConfigSt - * \typedef uffs_Config - * \brief uffs config parameters - */ -typedef struct uffs_ConfigSt { - int bc_caches; - int page_buffers; - int dirty_pages; - int dirty_groups; - int reserved_free_blocks; -} uffs_Config; - - -/** - * \struct uffs_DeviceSt - * \brief The core data structure of UFFS, all information needed by manipulate UFFS object - * \note one partition corresponding one uffs device. - */ -struct uffs_DeviceSt { - URET (*Init)(uffs_Device *dev); //!< low level initialisation - URET (*Release)(uffs_Device *dev); //!< low level release - void *_private; //!< private data for device - - struct uffs_StorageAttrSt *attr; //!< storage attribute - struct uffs_PartitionSt par; //!< partition information - struct uffs_FlashOpsSt *ops; //!< flash operations - struct uffs_BlockInfoCacheSt bc; //!< block info cache - struct uffs_LockSt lock; //!< lock data structure - struct uffs_PageBufDescSt buf; //!< page buffers - struct uffs_PageCommInfoSt com; //!< common information - struct uffs_TreeSt tree; //!< tree list of block - struct uffs_NewBadBlockSt bad; //!< new discovered bad block - struct uffs_FlashStatSt st; //!< statistic (counters) - struct uffs_memAllocatorSt mem; //!< uffs memory allocator - struct uffs_ConfigSt cfg; //!< uffs config - u32 ref_count; //!< device reference count - int dev_num; //!< device number (partition number) -}; - - -/** create the lock for uffs device */ -void uffs_DeviceInitLock(uffs_Device *dev); - -/** delete the lock of uffs device */ -void uffs_DeviceReleaseLock(uffs_Device *dev); - -/** lock uffs device */ -void uffs_DeviceLock(uffs_Device *dev); - -/** unlock uffs device */ -void uffs_DeviceUnLock(uffs_Device *dev); - - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_ecc.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_ecc.h deleted file mode 100644 index 18fbd92a3..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_ecc.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_ecc.h - * \brief file handle operations - * \author Ricky Zheng, created 8th Jun, 2005 - */ - -#ifndef _UFFS_ECC_H_ -#define _UFFS_ECC_H_ - -#include - -#include "uffs/uffs_fs.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - - -#define MAX_ECC_LENGTH 24 //!< 2K page ecc length is 24 bytes. - -/** - * calculate ECC - * \return length of generated ECC. (3 bytes ECC per 256 data) - */ -int uffs_EccMake(const void *data, int data_len, void *ecc); - -/** - * correct data by ECC. - * - * return: 0 -- no error - * -1 -- can not be corrected - * >0 -- how many bits are corrected - */ -int uffs_EccCorrect(void *data, int data_len, void *read_ecc, const void *test_ecc); - - -/** - * generate 12 bit ecc for maximum 8 bytes data - */ -u16 uffs_EccMake8(const void *data, int data_len); - -/** - * correct maximum 8 bytes data from 12 bits ECC - * - * return: 0 -- no error - * -1 -- can not be corrected - * >0 -- how many bits are corrected - */ -int uffs_EccCorrect8(void *data, u16 read_ecc, u16 test_ecc, int errtop); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fd.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fd.h deleted file mode 100644 index c5d815907..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fd.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fd.h - * \brief PISIX like file operations - * \author Ricky Zheng, created 8th Jun, 2005 - */ - -#ifndef _UFFS_FD_H_ -#define _UFFS_FD_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - -#include "uffs/uffs.h" - -/** - * \brief definitions for uffs_stat::st_mode - */ -#define US_IFMT 0xF000 /* file type make */ -#define US_IFREG 0x8000 /* regular */ -#define US_IFLNK 0xA000 /* symbolic link */ -#define US_IFDIR 0x4000 /* directory */ -#define US_IREAD 0000400 /* read permission */ -#define US_IWRITE 0000200 /* write permission */ - -#define US_IRWXU 00700 /* RWX owner */ -#define US_IRUSR 00400 /* R owner */ -#define US_IWUSR 00200 /* W owner */ -#define US_IXUSR 00100 /* X owner */ -#define US_IRWXG 00070 /* RWX group */ -#define US_IRGRP 00040 /* R group */ -#define US_IWGRP 00020 /* W group */ -#define US_IXGRP 00010 /* X group */ -#define US_IRWXO 00007 /* RWX other */ -#define US_IROTH 00004 /* R other */ -#define US_IWOTH 00002 /* W other */ -#define US_IXOTH 00001 /* X other */ - -/** - * \brief POSIX dirent - */ -struct uffs_dirent { - int d_ino; /* inode number (serial number of this object) */ - int d_off; /* offset to this dirent */ - unsigned short int d_reclen; /* length of this uffs_dirent */ - unsigned short int d_namelen; /* length of this d_name */ - unsigned char d_type; /* type of this record */ - char d_name[256]; /* name of this object */ -}; - -struct uffs_dirSt; -typedef struct uffs_dirSt uffs_DIR; - -/** - * \brief POSIX stat - */ -struct uffs_stat { - int st_dev; /* ID of device containing file */ - int st_ino; /* inode number */ - int st_mode; /* protection */ - int st_nlink; /* number of hard links */ - int st_uid; /* user ID of owner */ - int st_gid; /* group ID of owner */ - int st_rdev; /* device ID (if special file) */ - long st_size; /* total size, in bytes */ - int st_blksize; /* blocksize for filesystem I/O */ - int st_blocks; /* number of blocks allocated */ - unsigned int st_atime; /* time of last access */ - unsigned int st_mtime; /* time of last modification */ - unsigned int st_ctime; /* time of last status change */ -}; - -/* POSIX complaint file system APIs */ - -int uffs_open(const char *name, int oflag, ...); -int uffs_close(int fd); -int uffs_read(int fd, void *data, int len); -int uffs_write(int fd, const void *data, int len); -long uffs_seek(int fd, long offset, int origin); -long uffs_tell(int fd); -int uffs_eof(int fd); -int uffs_flush(int fd); -int uffs_rename(const char *old_name, const char *new_name); -int uffs_remove(const char *name); -int uffs_ftruncate(int fd, long remain); - -int uffs_mkdir(const char *name, ...); -int uffs_rmdir(const char *name); - -int uffs_stat(const char *name, struct uffs_stat *buf); -int uffs_lstat(const char *name, struct uffs_stat *buf); -int uffs_fstat(int fd, struct uffs_stat *buf); - -int uffs_closedir(uffs_DIR *dirp); -uffs_DIR * uffs_opendir(const char *path); -struct uffs_dirent * uffs_readdir(uffs_DIR *dirp); - -void uffs_rewinddir(uffs_DIR *dirp); - - -int uffs_get_error(void); -int uffs_set_error(int err); - -int uffs_version(void); -int uffs_format(const char *mount_point); - -long uffs_space_total(const char *mount_point); -long uffs_space_used(const char *mount_point); -long uffs_space_free(const char *mount_point); - -void uffs_flush_all(const char *mount_point); - -#ifdef __cplusplus -} -#endif -#endif - - - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_find.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_find.h deleted file mode 100644 index 3408cf33c..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_find.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_find.h - * \brief find objects under dir - * \author Ricky Zheng - */ - -#ifndef _UFFS_FIND_H_ -#define _UFFS_FIND_H_ - -#include "uffs/uffs_fs.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -typedef struct uffs_FindInfoSt { - uffs_Device *dev; //!< the device to be searched - u16 serial; //!< the dir serial number - int step; //!< step: 0 - working on dir entries, - // 1 - working on file entries, - // 2 - stoped. - int hash; //!< hash entry, internal used - TreeNode *work; //!< working node, internal used. - int pos; //!< current position -} uffs_FindInfo; - - -URET uffs_GetObjectInfo(uffs_Object *obj, uffs_ObjectInfo *info, int *err); -URET uffs_FindObjectOpen(uffs_FindInfo *find_handle, uffs_Object *dir); -URET uffs_FindObjectOpenEx(uffs_FindInfo *f, uffs_Device *dev, int dir); -URET uffs_FindObjectFirst(uffs_ObjectInfo *info, uffs_FindInfo *find_handle); -URET uffs_FindObjectNext(uffs_ObjectInfo *info, uffs_FindInfo *find_handle); -URET uffs_FindObjectRewind(uffs_FindInfo *find_handle); -URET uffs_FindObjectClose(uffs_FindInfo * find_handle); - - -#ifdef __cplusplus -} -#endif - - -#endif - - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_flash.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_flash.h deleted file mode 100644 index 1d0344ff8..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_flash.h +++ /dev/null @@ -1,311 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_public.h - * \brief flash interface for UFFS - * \author Ricky Zheng - */ - -#ifndef _UFFS_FLASH_H_ -#define _UFFS_FLASH_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_fs.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -/** ECC options (uffs_StorageAttrSt.ecc_opt) */ -#define UFFS_ECC_NONE 0 //!< do not use ECC -#define UFFS_ECC_SOFT 1 //!< UFFS calculate the ECC -#define UFFS_ECC_HW 2 //!< Flash driver(or by hardware) calculate the ECC -#define UFFS_ECC_HW_AUTO 3 //!< Hardware calculate the ECC and automatically write to spare. - -#define UFFS_ECC_OPTION_STRING \ - { "none", "soft", "hw", "auto" } // index is the ecc option value. - -/** spare layout options (uffs_StorageAttrSt.layout_opt) */ -#define UFFS_LAYOUT_UFFS 0 //!< do layout by dev->attr information -#define UFFS_LAYOUT_FLASH 1 //!< flash driver do the layout - -#define UFFS_SPARE_LAYOUT_SIZE 6 //!< maximum spare layout array size, 2 segments - -/** flash operation return code */ -#define UFFS_FLASH_NO_ERR 0 //!< no error -#define UFFS_FLASH_ECC_OK 1 //!< bit-flip found, but corrected by ECC -#define UFFS_FLASH_NOT_SEALED 2 //!< page spare area is not sealed properly (only for ReadPageWithLayout()) -#define UFFS_FLASH_IO_ERR -1 //!< I/O error -#define UFFS_FLASH_ECC_FAIL -2 //!< ECC failed -#define UFFS_FLASH_BAD_BLK -3 //!< bad block -#define UFFS_FLASH_CRC_ERR -4 //!< CRC failed -#define UFFS_FLASH_UNKNOWN_ERR -100 //!< unkown error? - -#define UFFS_FLASH_HAVE_ERR(e) ((e) < 0) - -#if defined(CONFIG_BAD_BLOCK_POLICY_STRICT) -# define UFFS_FLASH_IS_BAD_BLOCK(e) \ - ((e) == UFFS_FLASH_ECC_FAIL || (e) == UFFS_FLASH_ECC_OK || (e) == UFFS_FLASH_BAD_BLK || (e) == UFFS_FLASH_CRC_ERR) -#else -# define UFFS_FLASH_IS_BAD_BLOCK(e) \ - ((e) == UFFS_FLASH_ECC_FAIL || (e) == UFFS_FLASH_BAD_BLK || (e) == UFFS_FLASH_CRC_ERR) -#endif - - -/** defines for page info (data length and data sum) */ -#define UFFS_PAGE_INFO_CLEAN 0xFFFFFFFF -#define UFFS_PAGE_INFO_IOERR 0xDEADFFFF -#define UFFS_PAGE_GET_LEN(info) (info & 0xFFFF) -#define UFFS_PAGE_GET_DSUM(info) (info >> 16) -#define UFFS_PAGE_MAKE_INFO(d_len, d_sum) ((d_sum << 16) | d_len) - -/** - * \struct uffs_StorageAttrSt - * \brief uffs device storage attribute, provide by nand specific file - */ -struct uffs_StorageAttrSt { - u32 total_blocks; //!< total blocks in this chip - u16 page_data_size; //!< page data size (physical page data size, e.g. 512) - u16 pages_per_block; //!< pages per block - u8 spare_size; //!< page spare size (physical page spare size, e.g. 16) - u8 block_status_offs; //!< block status byte offset in spare - int ecc_opt; //!< ecc option ( #UFFS_ECC_[NONE|SOFT|HW|HW_AUTO] ) - int layout_opt; //!< layout option (#UFFS_LAYOUT_UFFS or #UFFS_LAYOUT_FLASH) - int ecc_size; //!< ecc size in bytes - const u8 *ecc_layout; //!< page data ECC layout: [ofs1, size1, ofs2, size2, ..., 0xFF, 0] - const u8 *data_layout; //!< spare data layout: [ofs1, size1, ofs2, size2, ..., 0xFF, 0] - u8 _uffs_ecc_layout[UFFS_SPARE_LAYOUT_SIZE]; //!< uffs spare ecc layout - u8 _uffs_data_layout[UFFS_SPARE_LAYOUT_SIZE]; //!< uffs spare data layout - void *_private; //!< private data for storage attribute -}; - - -/** - * \struct uffs_FlashOpsSt - * \brief low level flash operations, should be implement in flash driver - */ -struct uffs_FlashOpsSt { - /** - * Initilize flash driver, called once when UFFS initilize partition - * - * \return 0 if no error, return -1 when failed. - * - * \note This function is optional. - */ - int (*InitFlash)(uffs_Device *dev); - - /** - * Release flash driver, called once when UFFS unmount partition - * - * \return 0 if no error, return -1 when failed. - * - * \note This function is optional. - */ - int (*ReleaseFlash)(uffs_Device *dev); - - /** - * Read a full nand page, UFFS do the layout. - * - * \param[out] ecc ecc of page data - * if ecc_opt is UFFS_ECC_HW, flash driver must calculate and return ecc of data(if ecc != NULL). - * if ecc_opt is UFFS_ECC_HW_AUTO, flash driver do ecc correction before return data and flash driver do not need to return ecc. - * if ecc_opt is UFFS_ECC_NONE or UFFS_ECC_SOFT, flash driver do not need to calculate data ecc and return ecc. - * - * \return #UFFS_FLASH_NO_ERR: success and/or has no flip bits. - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_ECC_FAIL: page data has flip bits and ecc correct failed (when ecc_opt == UFFS_ECC_HW_AUTO) - * #UFFS_FLASH_ECC_OK: page data has flip bits and corrected by ecc (when ecc_opt == UFFS_ECC_HW_AUTO) - * #UFFS_FLASH_BAD_BLK: if the block is a bad block (e.g., the bad block mark byte is not 0xFF). - * - * \note if data is NULL, do not return data; if spare is NULL, do not return spare; if both data and spare are all NULL, - * then read bad block mark and return UFFS_FLASH_BAD_BLK if bad block mark is not 0xFF. - * - * \note pad 0xFF for calculating ECC if len < page_data_size - */ - int (*ReadPage)(uffs_Device *dev, u32 block, u32 page, u8 *data, int data_len, u8 *ecc, - u8 *spare, int spare_len); - - /** - * Read a full nand page, driver do the layout. - * - * \param[out] ecc ecc of page data - * if ecc_opt is UFFS_ECC_HW, flash driver must calculate and return ecc of data(if ecc != NULL). - * if ecc_opt is UFFS_ECC_HW_AUTO, flash driver do ecc correction before return data and flash driver do not need to return ecc. - * if ecc_opt is UFFS_ECC_NONE or UFFS_ECC_SOFT, flash driver do not need calculate data ecc and return ecc. - * - * \param[out] ecc_store ecc store on spare area - * if ecc_opt is UFFS_ECC_NONE or UFFS_ECC_HW_AUTO, do not need to return ecc_store. - * - * \note flash driver must provide this function if layout_opt is UFFS_LAYOUT_FLASH. - * UFFS will use this function (if exist) prio to 'ReadPageSpare()' - * - * \return #UFFS_FLASH_NO_ERR: success - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_ECC_FAIL: page data has flip bits and ecc correct failed (when ecc_opt == UFFS_ECC_HW_AUTO) - * #UFFS_FLASH_ECC_OK: page data has flip bits and corrected by ecc (when ecc_opt == UFFS_ECC_HW_AUTO) - * #UFFS_FLASH_BAD_BLK: if the block is a bad block (e.g., the bad block mark byte is not 0xFF) - * #UFFS_FLASH_NOT_SEALED: if the page spare is not sealed properly - * - * \note if data is NULL, do not return data; if ts is NULL, do not read tag; if both data and ts are NULL, - * then read bad block mark and return UFFS_FLASH_BAD_BLK if bad block mark is not 0xFF. - * - * \note flash driver DO NOT need to do ecc correction for tag, - * UFFS will take care of tag ecc. - */ - int (*ReadPageWithLayout)(uffs_Device *dev, u32 block, u32 page, u8* data, int data_len, u8 *ecc, - uffs_TagStore *ts, u8 *ecc_store); - - /** - * Write a full page, UFFS do the layout for spare area. - * - * \note If you have ecc_opt UFFS_ECC_HW or UFFS_ECC_HW_AUTO, you MUST implement WritePageWithLayout(). - * Implement WritePage() function if you have ecc_opt UFFS_ECC_NONE or UFFS_ECC_SOFT and - * WritePageWithLayout() is not implemented. - * - * \note If data == NULL && spare == NULL, driver should mark this block as a 'bad block'. - * - * \return #UFFS_FLASH_NO_ERR: success - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_BAD_BLK: a bad block detected. - */ - int (*WritePage)(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *spare, int spare_len); - - /** - * Write full page, flash driver do the layout for spare area. - * - * \note if layout_opt is UFFS_LAYOUT_FLASH or ecc_opt is UFFS_ECC_HW/UFFS_ECC_HW_AUTO, flash driver MUST implement - * this function. UFFS will use this function (if provided) prio to 'WritePage()' - * - * \param[in] ecc ecc of data. if ecc_opt is UFFS_ECC_SOFT and this function is implemented, - * UFFS will calculate page data ecc and pass it to WritePageWithLayout(). - * if ecc_opt is UFFS_ECC_NONE/UFFS_ECC_HW/UFFS_ECC_HW_AUTO, UFFS pass ecc = NULL. - * - * \note If data == NULL && ts == NULL, driver should mark this block as a 'bad block'. - * - * \return #UFFS_FLASH_NO_ERR: success - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_BAD_BLK: a bad block detected. - */ - int (*WritePageWithLayout)(uffs_Device *dev, u32 block, u32 page, - const u8 *data, int data_len, const u8 *ecc, const uffs_TagStore *ts); - - /** - * Check block status. - * - * \note flash driver may maintain a bad block table to speed up bad block checking or - * it will require one or two read spare I/O to check block status. - * - * \note if this function is not implented by driver, UFFS check the block_status byte in spare. - * - * \return 1 if it's a bad block, 0 if it's not. - */ - int (*IsBadBlock)(uffs_Device *dev, u32 block); - - /** - * Mark a new bad block. - * - * \note if this function is not implemented, UFFS mark bad block by call 'WritePage()/WritePageWithLayout()' - * with: data == NULL && spare == NULL && ts == NULL. - * - * \return 0 if success, otherwise return -1. - */ - int (*MarkBadBlock)(uffs_Device *dev, u32 block); - - /** - * Erase a block, driver MUST implement this function. - * - * \return #UFFS_FLASH_NO_ERR: success - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_BAD_BLK: a bad block detected. - */ - int (*EraseBlock)(uffs_Device *dev, u32 block); -}; - -/** make spare from tag store and ecc */ -void uffs_FlashMakeSpare(uffs_Device *dev, const uffs_TagStore *ts, const u8 *ecc, u8* spare); - -/** unload tag and ecc from spare */ -void uffs_FlashUnloadSpare(uffs_Device *dev, const u8 *spare, struct uffs_TagStoreSt *ts, u8 *ecc); - -/** read page spare and fill to tag */ -int uffs_FlashReadPageTag(uffs_Device *dev, int block, int page, uffs_Tags *tag); - -/** read page data to page buf and do ECC correct */ -int uffs_FlashReadPage(uffs_Device *dev, int block, int page, uffs_Buf *buf, UBOOL skip_ecc); - -/** write page data and spare */ -int uffs_FlashWritePageCombine(uffs_Device *dev, int block, int page, uffs_Buf *buf, uffs_Tags *tag); - -/** Mark this block as bad block */ -int uffs_FlashMarkBadBlock(uffs_Device *dev, int block); - -/** Is this block a bad block ? */ -UBOOL uffs_FlashIsBadBlock(uffs_Device *dev, int block); - -/** Erase flash block */ -int uffs_FlashEraseBlock(uffs_Device *dev, int block); - -/* mark a clean page as 'dirty' (and 'invalid') */ -int uffs_FlashMarkDirtyPage(uffs_Device *dev, uffs_BlockInfo *bc, int page); - -/* check if the block pages are all clean */ -URET uffs_FlashCheckErasedBlock(uffs_Device *dev, int block); - -/** - * get page head info - * - * \return #UFFS_PAGE_INFO_IOERR if I/O error, otherwise return page info - */ -u32 uffs_FlashGetPageInfo(uffs_Device *dev, int block, int page); - -/** load uffs_FileInfo from flash storage */ -URET uffs_FlashReadFileinfoPhy(uffs_Device *dev, int block, int page, uffs_FileInfo *info); - -/** - * Initialize UFFS flash interface - */ -URET uffs_FlashInterfaceInit(uffs_Device *dev); - -/** - * Release UFFS flash interface - */ -URET uffs_FlashInterfaceRelease(uffs_Device *dev); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fs.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fs.h deleted file mode 100644 index 7bda09052..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_fs.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fs.h - * \brief uffs basic file operations - * \author Ricky Zheng - */ - -#ifndef _UFFS_FS_H_ -#define _UFFS_FS_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -/** file object */ -struct uffs_ObjectSt { - /******* objects manager ********/ - int dev_lock_count; - int dev_get_count; - - /******** init level 0 ********/ - const char * name; //!< pointer to the start of name, for open or create - u32 name_len; //!< name length - u16 sum; //!< sum of name - uffs_Device *dev; //!< uffs device - u32 oflag; - u8 type; - u16 head_pages; //!< data pages on file head block - u16 parent; - - /******* init level 1 ********/ - TreeNode *node; //!< file entry node in tree - u16 serial; - - /******* output ******/ - int err; //!< error number - - /******* current *******/ - u32 pos; //!< current position in file - - /***** others *******/ - UBOOL attr_loaded; //!< attributes loaded ? - UBOOL open_succ; //!< U_TRUE or U_FALSE - -}; - -typedef struct uffs_ObjectSt uffs_Object; - - - -#define uffs_GetObjectErr(obj) ((obj)->err) -#define uffs_ClearObjectErr(obj) do { (obj)->err = UENOERR; } while (0) - -uffs_Pool * uffs_GetObjectPool(void); - -URET uffs_InitObjectBuf(void); -URET uffs_ReleaseObjectBuf(void); -int uffs_PutAllObjectBuf(uffs_Device *dev); -uffs_Object * uffs_GetObject(void); -void uffs_PutObject(uffs_Object *obj); -int uffs_GetObjectIndex(uffs_Object *obj); -uffs_Object * uffs_GetObjectByIndex(int idx); - - -/** - * Re-initialize an object. - * should call this function if you want to re-use an object. - */ -URET uffs_ReInitObject(uffs_Object *obj); - -URET uffs_ParseObject(uffs_Object *obj, const char *name); - -URET uffs_CreateObjectEx(uffs_Object *obj, uffs_Device *dev, - int dir, const char *name, int name_len, int oflag); -URET uffs_OpenObjectEx(uffs_Object *obj, uffs_Device *dev, - int dir, const char *name, int name_len, int oflag); - -URET uffs_OpenObject(uffs_Object *obj, const char *fullname, int oflag); -URET uffs_TruncateObject(uffs_Object *obj, u32 remain); -URET uffs_CreateObject(uffs_Object *obj, const char *fullname, int oflag); - -URET uffs_CloseObject(uffs_Object *obj); -int uffs_WriteObject(uffs_Object *obj, const void *data, int len); -int uffs_ReadObject(uffs_Object *obj, void *data, int len); -long uffs_SeekObject(uffs_Object *obj, long offset, int origin); -int uffs_GetCurOffset(uffs_Object *obj); -int uffs_EndOfFile(uffs_Object *obj); -URET uffs_FlushObject(uffs_Object *obj); - -URET uffs_RenameObject(const char *old_name, const char *new_name, int *err); -URET uffs_DeleteObject(const char * name, int *err); - -int uffs_GetFreeObjectHandlers(void); - - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mem.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mem.h deleted file mode 100644 index ad9a38f45..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mem.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_MEM_H_ -#define _UFFS_MEM_H_ - -#include "uffs/uffs_device.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -/** uffs memory allocator */ -typedef struct uffs_memAllocatorSt { - URET (*init)(struct uffs_DeviceSt *dev); //!< init memory allocator, setup buffer sizes - URET (*release)(struct uffs_DeviceSt *dev); //!< release memory allocator (for dynamic memory allocation) - - void * (*malloc)(struct uffs_DeviceSt *dev, unsigned int size); //!< allocate memory (for dynamic memory allocation) - URET (*free)(struct uffs_DeviceSt *dev, void *p); //!< free memory (for dynamic memory allocation) - - void * blockinfo_pool_buf; //!< block info cache buffers - void * pagebuf_pool_buf; //!< page buffers - void * tree_nodes_pool_buf; //!< tree nodes buffer - void * spare_pool_buf; //!< spare buffers - - int blockinfo_pool_size; //!< block info cache buffers size - int pagebuf_pool_size; //!< page buffers size - int tree_nodes_pool_size; //!< tree nodes buffer size - int spare_pool_size; //!< spare buffer pool size - - uffs_Pool tree_pool; - uffs_Pool spare_pool; - - int spare_data_size; //!< spare size consumed by UFFS, - //!< calculated by UFFS according to the layout information. - - /* for static memory allocator */ - char *buf_start; - int buf_size; - int pos; - - -} uffs_MemAllocator; - -void uffs_MemSetupSystemAllocator(uffs_MemAllocator *allocator); -void uffs_MemSetupStaticAllocator(uffs_MemAllocator *allocator, void *pool, int size); - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mtb.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mtb.h deleted file mode 100644 index 41259e57e..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_mtb.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_mtb.h - * \brief mount table related stuff - * \author Ricky Zheng - */ - -#ifndef _UFFS_MTB_H_ -#define _UFFS_MTB_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -typedef struct uffs_MountTableEntrySt { - uffs_Device *dev; // UFFS 'device' - core internal data structure for partition - int start_block; // partition start block - int end_block; // partition end block ( if < 0, reserve space form the end of storage) - const char *mount; // mount point - struct uffs_MountTableEntrySt *prev; - struct uffs_MountTableEntrySt *next; -} uffs_MountTable; - -/** Register mount entry, will be put at 'unmounted' list */ -int uffs_RegisterMountTable(uffs_MountTable *mtb); - -/** Remove mount entry from the list */ -int uffs_UnRegisterMountTable(uffs_MountTable *mtb); - -/** mount partition */ -int uffs_Mount(const char *mount); - -/** unmount parttion */ -int uffs_UnMount(const char *mount); - -/** get mounted entry list */ -uffs_MountTable * uffs_MtbGetMounted(void); - -/** get unmounted entry list */ -uffs_MountTable * uffs_MtbGetUnMounted(void); - -/** get matched mount point from absolute path */ -int uffs_GetMatchedMountPointSize(const char *path); - -/** get uffs device from mount point */ -uffs_Device * uffs_GetDeviceFromMountPoint(const char *mount); - -/** get uffs device from mount point */ -uffs_Device * uffs_GetDeviceFromMountPointEx(const char *mount, int len); - -/** get mount point name from uffs device */ -const char * uffs_GetDeviceMountPoint(uffs_Device *dev); - -/** down crease uffs device references by uffs_GetDeviceXXX() */ -void uffs_PutDevice(uffs_Device *dev); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_os.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_os.h deleted file mode 100644 index b75e77bcc..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_os.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_OS_H_ -#define _UFFS_OS_H_ - -#include -#define RT_THREAD -#if !defined(RT_THREAD) -#include -#endif - -#ifdef __cplusplus -extern "C"{ -#endif - -#define UFFS_TASK_ID_NOT_EXIST -1 - -typedef void * OSSEM; -#define OSSEM_NOT_INITED (NULL) - -#if !defined(RT_THREAD) -struct uffs_DebugMsgOutputSt { - void (*output)(const char *msg); - void (*vprintf)(const char *fmt, va_list args); -}; - -void uffs_SetupDebugOutput(void); -#endif - -/* OS specific functions */ -int uffs_SemCreate(OSSEM *sem); -int uffs_SemWait(OSSEM sem); -int uffs_SemSignal(OSSEM sem); -int uffs_SemDelete(OSSEM *sem); - -int uffs_OSGetTaskId(void); //get current task id -unsigned int uffs_GetCurDateTime(void); - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_pool.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_pool.h deleted file mode 100644 index 78826fc24..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_pool.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_pool.h - * \brief Fast fixed size memory pool management. - * \author Ricky Zheng, Simon Kallweit - */ - -#ifndef _UFFS_POOL_H_ -#define _UFFS_POOL_H_ - - -#include "uffs/uffs_types.h" -#include "uffs/uffs_os.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -/** - * \struct uffs_PoolEntrySt - * \brief Helper type for free buffer entries. - */ -typedef struct uffs_PoolEntrySt { - struct uffs_PoolEntrySt *next; -} uffs_PoolEntry; - -/** - * \struct uffs_PoolSt - * \brief Memory pool. - */ -typedef struct uffs_PoolSt { - u8 *mem; //!< memory pool - u32 buf_size; //!< size of a buffer - u32 num_bufs; //!< number of buffers in the pool - uffs_PoolEntry *free_list; //!< linked list of free buffers - OSSEM sem; //!< buffer lock -} uffs_Pool; - -URET uffs_PoolInit(uffs_Pool *pool, void *mem, u32 mem_size, u32 buf_size, u32 num_bufs); -URET uffs_PoolRelease(uffs_Pool *pool); - -UBOOL uffs_PoolVerify(uffs_Pool *pool, void *p); - -void *uffs_PoolGet(uffs_Pool *pool); -void *uffs_PoolGetLocked(uffs_Pool *pool); - -int uffs_PoolPut(uffs_Pool *pool, void *p); -int uffs_PoolPutLocked(uffs_Pool *pool, void *p); - -void *uffs_PoolGetBufByIndex(uffs_Pool *pool, u32 index); -u32 uffs_PoolGetIndex(uffs_Pool *pool, void *p); -UBOOL uffs_PoolCheckFreeList(uffs_Pool *pool, void *p); - -void * uffs_PoolFindNextAllocated(uffs_Pool *pool, void *from); - -int uffs_PoolGetFreeCount(uffs_Pool *pool); -int uffs_PoolPutAll(uffs_Pool *pool); - -#ifdef __cplusplus -} -#endif - -#endif // _UFFS_POOL_H_ diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_public.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_public.h deleted file mode 100644 index 9c2200489..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_public.h +++ /dev/null @@ -1,336 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_public.h - * \brief public data structures for uffs - * \author Ricky Zheng - */ - -#ifndef _UFFS_PUBLIC_H_ -#define _UFFS_PUBLIC_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs.h" -#include "uffs/uffs_pool.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(ar) (sizeof(ar) / sizeof(ar[0])) -#endif - -#ifndef offsetof -# define offsetof(T, x) ((size_t) &((T *)0)->x) -#endif -#ifndef container_of -#define container_of(p, T, x) ((T *)((char *)(p) - offsetof(T,x))) -#endif - -/** - * \def MAX_FILENAME_LENGTH - * \note Be careful: it's part of the physical format (see: uffs_FileInfoSt.name) - * !!DO NOT CHANGE IT AFTER FILE SYSTEM IS FORMATED!! - */ -#define MAX_FILENAME_LENGTH 128 - -/** \note 8-bits attr goes to uffs_dirent::d_type */ -#define FILE_ATTR_DIR (1 << 7) //!< attribute for directory -#define FILE_ATTR_WRITE (1 << 0) //!< writable - - -/** - * \structure uffs_FileInfoSt - * \brief file/dir entry info in physical storage format - */ -struct uffs_FileInfoSt { - u32 attr; //!< file/dir attribute - u32 create_time; - u32 last_modify; - u32 access; - u32 reserved; - u32 name_len; //!< length of file/dir name - char name[MAX_FILENAME_LENGTH]; -}; //6*4 + sizeof(name) = 24 + 128 = 152 Bytes -typedef struct uffs_FileInfoSt uffs_FileInfo; - -/** - * \struct uffs_ObjectInfoSt - * \brief object info - */ -typedef struct uffs_ObjectInfoSt { - uffs_FileInfo info; - u32 len; //!< length of file - u16 serial; //!< object serial num -} uffs_ObjectInfo; - - -/** - * \struct uffs_TagStoreSt - * \brief uffs tag, 8 bytes, will be store in page spare area. - */ -struct uffs_TagStoreSt { - u32 dirty:1; //!< 0: dirty, 1: clear - u32 valid:1; //!< 0: valid, 1: invalid - u32 type:2; //!< block type: #UFFS_TYPE_DIR, #UFFS_TYPE_FILE, #UFFS_TYPE_DATA - u32 block_ts:2; //!< time stamp of block; - u32 data_len:12; //!< length of page data - u32 serial:14; //!< serial number - - u32 parent:10; //!< parent's serial number - u32 page_id:6; //!< page id - u32 reserved:4; //!< reserved, for UFFS2 - u32 tag_ecc:12; //!< tag ECC -}; - -#define TAG_ECC_DEFAULT (0xFFF) //!< 12-bit '1' - - -/** - * \struct uffs_TagsSt - */ -struct uffs_TagsSt { - struct uffs_TagStoreSt s; /* store must be the first member */ - - /** data_sum for file or dir name */ - u16 data_sum; - - /** internal used */ - u8 seal_byte; //!< seal byte. -}; - -/** - * \struct uffs_MiniHeaderSt - * \brief the mini header resides on the head of page data - */ -struct uffs_MiniHeaderSt { - u8 status; - u8 reserved; - u16 crc; -}; - - -/** uffs_TagsSt.dirty */ -#define TAG_VALID 0 -#define TAG_INVALID 1 - -/** uffs_TagsSt.valid */ -#define TAG_DIRTY 0 -#define TAG_CLEAR 1 - -#define TAG_IS_DIRTY(tag) (*((u32 *) &((tag)->s)) != 0xFFFFFFFF) // tag is dirty if first 4 bytes not all 0xFF -#define TAG_IS_VALID(tag) ((tag)->s.valid == TAG_VALID) -#define TAG_IS_SEALED(tag) ((tag)->seal_byte != 0xFF) - -#define TAG_IS_GOOD(tag) (TAG_IS_SEALED(tag) && TAG_IS_VALID(tag)) - -#define TAG_VALID_BIT(tag) (tag)->s.valid -#define TAG_DIRTY_BIT(tag) (tag)->s.dirty -#define TAG_SERIAL(tag) (tag)->s.serial -#define TAG_PARENT(tag) (tag)->s.parent -#define TAG_PAGE_ID(tag) (tag)->s.page_id -#define TAG_DATA_LEN(tag) (tag)->s.data_len -#define TAG_TYPE(tag) (tag)->s.type -#define TAG_BLOCK_TS(tag) (tag)->s.block_ts -#define SEAL_TAG(tag) (tag)->seal_byte = 0 - -int uffs_GetFirstBlockTimeStamp(void); -int uffs_GetNextBlockTimeStamp(int prev); -UBOOL uffs_IsSrcNewerThanObj(int src, int obj); - - -#include "uffs_device.h" - - - -/********************************** debug & error *************************************/ -#define UFFS_MSG_NOISY -1 -#define UFFS_MSG_NORMAL 0 -#define UFFS_MSG_SERIOUS 1 -#define UFFS_MSG_DEAD 2 -#define UFFS_MSG_NOMSG 100 - -#define TENDSTR "\n" - -#if !defined(RT_THREAD) -struct uffs_DebugMsgOutputSt; -URET uffs_InitDebugMessageOutput(struct uffs_DebugMsgOutputSt *ops, int msg_level); -void uffs_DebugSetMessageLevel(int msg_level); - -void uffs_DebugMessage(int level, const char *prefix, const char *suffix, const char *errFmt, ...); -void uffs_AssertCall(const char *file, int line, const char *msg, ...); -#else - -#define UFFS_DBG_LEVEL UFFS_MSG_NORMAL - -#ifdef CONFIG_ENABLE_UFFS_DEBUG_MSG -#define uffs_DebugMessage(level, prefix, suffix, errFmt, ...) do { \ - if (level >= UFFS_DBG_LEVEL) \ - rt_kprintf(prefix errFmt suffix, ##__VA_ARGS__); \ -} while(0) - -#define uffs_AssertCall(file, line, msg, ...) \ - rt_kprintf("ASSERT %s:%d - :" msg "\n", (const char *)file, (int)line, ##__VA_ARGS__) -#else -#define uffs_DebugMessage(level, prefix, suffix, errFmt, ...) -#define uffs_AssertCall(file, line, msg, ...) -#endif //CONFIG_ENABLE_UFFS_DEBUG_MSG -#endif //RT_THREAD - -#ifdef _COMPILER_DO_NOT_SUPPORT_MACRO_VALIST_REPLACE_ -/* For those compilers do not support valist parameter replace in macro define */ -void uffs_Perror(int level, const char *fmt, ...); -void uffs_PerrorRaw(int level, const char *fmt, ...); -UBOOL uffs_Assert(UBOOL expr, const char *fmt, ...); -#else - -#if !defined(RT_THREAD) -#define uffs_Perror(level, fmt, ... ) \ - uffs_DebugMessage(level, PFX, TENDSTR, fmt, ## __VA_ARGS__) - -#define uffs_PerrorRaw(level, fmt, ... ) \ - uffs_DebugMessage(level, NULL, NULL, fmt, ## __VA_ARGS__) - -#else - -#ifdef CONFIG_ENABLE_UFFS_DEBUG_MSG - -#define uffs_Perror(level, fmt, ... ) do{\ - if (level >= UFFS_DBG_LEVEL) \ - rt_kprintf(PFX fmt TENDSTR, ##__VA_ARGS__); \ -} while(0) - -#define uffs_PerrorRaw(level, fmt, ... ) do{\ - if (level >= UFFS_DBG_LEVEL) \ - rt_kprintf(fmt, ##__VA_ARGS__); \ -} while(0) -#else -#define uffs_Perror(level, fmt, ... ) -#define uffs_PerrorRaw(level, fmt, ... ) -#endif // CONFIG_ENABLE_UFFS_DEBUG_MSG -#endif // RT_THREAD - -#define uffs_Assert(expr, msg, ...) \ - ((expr) ? U_TRUE : (uffs_AssertCall(__FILE__, __LINE__, msg, ## __VA_ARGS__), U_FALSE)) - -#endif //_COMPILER_DO_NOT_SUPPORT_MACRO_VALIST_REPLACE_ - -#define uffs_Panic() \ - do { \ - uffs_AssertCall(__FILE__, __LINE__, "Bam !!\n"); \ - while(1); \ - } while(0) - -/********************************** NAND **********************************************/ -//NAND flash specific file must implement these interface -URET uffs_LoadPageSpare(uffs_Device *dev, int block, int page, uffs_Tags *tag); -URET uffs_WritePageSpare(uffs_Device *dev, int block, int page, uffs_Tags *tag); -URET uffs_MakePageValid(uffs_Device *dev, int block, int page, uffs_Tags *tag); -UBOOL uffs_IsBlockBad(uffs_Device *dev, uffs_BlockInfo *bc); - -/********************************** Public defines *****************************/ -/** - * \def UFFS_ALL_PAGES - * \brief UFFS_ALL_PAGES if this value presented, that means the objects are all pages in the block - */ -#define UFFS_ALL_PAGES (0xffff) - -/** - * \def UFFS_INVALID_PAGE - * \brief macro for invalid page number - */ -#define UFFS_INVALID_PAGE (0xfffe) - -/** - * \def UFFS_INVALID_BLOCK - * \brief macro for invalid block number - */ -#define UFFS_INVALID_BLOCK (0xfffe) - - -URET uffs_NewBlock(uffs_Device *dev, u16 block, uffs_Tags *tag, uffs_Buf *buf); -URET uffs_BlockRecover(uffs_Device *dev, uffs_BlockInfo *old, u16 newBlock); -URET uffs_PageRecover(uffs_Device *dev, - uffs_BlockInfo *bc, - u16 oldPage, - u16 newPage, - uffs_Buf *buf); -int uffs_FindFreePageInBlock(uffs_Device *dev, uffs_BlockInfo *bc); -u16 uffs_FindBestPageInBlock(uffs_Device *dev, uffs_BlockInfo *bc, u16 page); -u16 uffs_FindFirstFreePage(uffs_Device *dev, uffs_BlockInfo *bc, u16 pageFrom); -u16 uffs_FindPageInBlockWithPageId(uffs_Device *dev, uffs_BlockInfo *bc, u16 page_id); - -u8 uffs_MakeSum8(const void *p, int len); -u16 uffs_MakeSum16(const void *p, int len); -URET uffs_CreateNewFile(uffs_Device *dev, u16 parent, u16 serial, uffs_BlockInfo *bc, uffs_FileInfo *fi); - -int uffs_GetBlockFileDataLength(uffs_Device *dev, uffs_BlockInfo *bc, u8 type); -UBOOL uffs_IsPageErased(uffs_Device *dev, uffs_BlockInfo *bc, u16 page); -int uffs_GetFreePagesCount(uffs_Device *dev, uffs_BlockInfo *bc); -UBOOL uffs_IsDataBlockReguFull(uffs_Device *dev, uffs_BlockInfo *bc); -UBOOL uffs_IsThisBlockUsed(uffs_Device *dev, uffs_BlockInfo *bc); - -int uffs_GetBlockTimeStamp(uffs_Device *dev, uffs_BlockInfo *bc); - -int uffs_GetDeviceUsed(uffs_Device *dev); -int uffs_GetDeviceFree(uffs_Device *dev); -int uffs_GetDeviceTotal(uffs_Device *dev); - -URET uffs_LoadMiniHeader(uffs_Device *dev, int block, u16 page, struct uffs_MiniHeaderSt *header); - - -/* some functions from uffs_fd.c */ -void uffs_FdSignatureIncrease(void); -URET uffs_DirEntryBufInit(void); -URET uffs_DirEntryBufRelease(void); -uffs_Pool * uffs_DirEntryBufGetPool(void); -int uffs_DirEntryBufPutAll(uffs_Device *dev); - - -/************************************************************************/ -/* init functions */ -/************************************************************************/ -URET uffs_InitDevice(uffs_Device *dev); -URET uffs_ReleaseDevice(uffs_Device *dev); - -URET uffs_InitFileSystemObjects(void); -URET uffs_ReleaseFileSystemObjects(void); - - -#ifdef __cplusplus -} -#endif -#endif // _UFFS_PUBLIC_H_ - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_tree.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_tree.h deleted file mode 100644 index 6a505a839..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_tree.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_TREE_H_ -#define _UFFS_TREE_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_pool.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - -#define UFFS_TYPE_DIR 0 -#define UFFS_TYPE_FILE 1 -#define UFFS_TYPE_DATA 2 -#define UFFS_TYPE_RESV 3 -#define UFFS_TYPE_INVALID 0xFF - -struct uffs_NodeTypeNameMapSt { - int type; - const char *name; -}; - -#define UFFS_TYPE_NAME_MAP { \ - {UFFS_TYPE_DIR, "DIR"}, \ - {UFFS_TYPE_FILE, "FILE"}, \ - {UFFS_TYPE_DATA, "DATA"}, \ - {UFFS_TYPE_RESV, "RESV"}, \ - {UFFS_TYPE_INVALID, "INVALID"} \ -} - -struct BlockListSt { /* 12 bytes */ - struct uffs_TreeNodeSt * next; - struct uffs_TreeNodeSt * prev; - u16 block; - union { - u16 serial; /* for suspended block list */ - u8 need_check; /* for erased block list */ - } u; -}; - -struct DirhSt { /* 8 bytes */ - u16 checksum; /* check sum of dir name */ - u16 block; - u16 parent; - u16 serial; -}; - - -struct FilehSt { /* 12 bytes */ - u16 block; - u16 checksum; /* check sum of file name */ - u16 parent; - u16 serial; - u32 len; /* file length total */ -}; - -struct FdataSt { /* 10 bytes */ - u16 block; - u16 parent; - u32 len; /* file data length on this block */ - u16 serial; -}; - -//UFFS TreeNode (14 or 16 bytes) -typedef struct uffs_TreeNodeSt { - union { - struct BlockListSt list; - struct DirhSt dir; - struct FilehSt file; - struct FdataSt data; - } u; - u16 hash_next; - u16 hash_prev; -} TreeNode; - - -//TODO: UFFS2 Tree structures -/* -struct FdataSt { - u32 len; -}; - -struct filebSt { - u16 bls; //how many blocks this file contents ... - u8 offs; //the offset of this file header on FILE block - u8 sum; //short sum of file name -}; - -//Extra data structure for storing file length information -struct FilehSt { - u32 len; -}; - -//UFFS2 TreeNode (12 bytes) -typedef struct uffs_TreeNodeSt { - u16 nextIdx; - u16 block; - u16 parent; - u16 serial; - union { - struct FilehSt h; - struct filedSt file; - struct data; - } u; -} TreeNode; - -*/ - - -#define EMPTY_NODE 0xffff //!< special index num of empty node. - -#define ROOT_DIR_SERIAL 0 //!< serial num of root dir -#define MAX_UFFS_FSN 0x3ff //!< maximum dir|file serial number (uffs_TagStore#parent: 10 bits) -#define MAX_UFFS_FDN 0x3fff //!< maximum file data block serial numbers (uffs_TagStore#serial: 14 bits) -#define PARENT_OF_ROOT 0xfffd //!< parent of ROOT ? kidding me ... -#define INVALID_UFFS_SERIAL 0xffff //!< invalid serial num - -#define DIR_NODE_HASH_MASK 0x1f -#define DIR_NODE_ENTRY_LEN (DIR_NODE_HASH_MASK + 1) - -#define FILE_NODE_HASH_MASK 0x3f -#define FILE_NODE_ENTRY_LEN (FILE_NODE_HASH_MASK + 1) - -#define DATA_NODE_HASH_MASK 0x1ff -#define DATA_NODE_ENTRY_LEN (DATA_NODE_HASH_MASK + 1) -#define FROM_IDX(idx, pool) ((TreeNode *)uffs_PoolGetBufByIndex(pool, idx)) -#define TO_IDX(p, pool) ((u16)uffs_PoolGetIndex(pool, (void *) p)) - - -#define GET_FILE_HASH(serial) (serial & FILE_NODE_HASH_MASK) -#define GET_DIR_HASH(serial) (serial & DIR_NODE_HASH_MASK) -#define GET_DATA_HASH(parent, serial) ((parent + serial) & DATA_NODE_HASH_MASK) - - -struct uffs_TreeSt { - TreeNode *erased; //!< erased block list head - TreeNode *erased_tail; //!< erased block list tail - TreeNode *suspend; //!< suspended block list - int erased_count; //!< erased block counter - TreeNode *bad; //!< bad block list - int bad_count; //!< bad block count - u16 dir_entry[DIR_NODE_ENTRY_LEN]; - u16 file_entry[FILE_NODE_ENTRY_LEN]; - u16 data_entry[DATA_NODE_ENTRY_LEN]; - u16 max_serial; -}; - - -URET uffs_TreeInit(uffs_Device *dev); -URET uffs_TreeRelease(uffs_Device *dev); -URET uffs_BuildTree(uffs_Device *dev); -u16 uffs_FindFreeFsnSerial(uffs_Device *dev); -TreeNode * uffs_TreeFindFileNode(uffs_Device *dev, u16 serial); -TreeNode * uffs_TreeFindFileNodeWithParent(uffs_Device *dev, u16 parent); -TreeNode * uffs_TreeFindDirNode(uffs_Device *dev, u16 serial); -TreeNode * uffs_TreeFindDirNodeWithParent(uffs_Device *dev, u16 parent); -TreeNode * uffs_TreeFindFileNodeByName(uffs_Device *dev, const char *name, u32 len, u16 sum, u16 parent); -TreeNode * uffs_TreeFindDirNodeByName(uffs_Device *dev, const char *name, u32 len, u16 sum, u16 parent); -TreeNode * uffs_TreeFindDataNode(uffs_Device *dev, u16 parent, u16 serial); - - -TreeNode * uffs_TreeFindDirNodeByBlock(uffs_Device *dev, u16 block); -TreeNode * uffs_TreeFindFileNodeByBlock(uffs_Device *dev, u16 block); -TreeNode * uffs_TreeFindDataNodeByBlock(uffs_Device *dev, u16 block); -TreeNode * uffs_TreeFindErasedNodeByBlock(uffs_Device *dev, u16 block); -TreeNode * uffs_TreeFindBadNodeByBlock(uffs_Device *dev, u16 block); - -void uffs_TreeSuspendAdd(uffs_Device *dev, TreeNode *node); -TreeNode * uffs_TreeFindSuspendNode(uffs_Device *dev, u16 serial); -void uffs_TreeRemoveSuspendNode(uffs_Device *dev, TreeNode *node); - -#define SEARCH_REGION_DIR 1 -#define SEARCH_REGION_FILE 2 -#define SEARCH_REGION_DATA 4 -#define SEARCH_REGION_BAD 8 -#define SEARCH_REGION_ERASED 16 -TreeNode * uffs_TreeFindNodeByBlock(uffs_Device *dev, u16 block, int *region); - - - -UBOOL uffs_TreeCompareFileName(uffs_Device *dev, const char *name, u32 len, u16 sum, TreeNode *node, int type); - -TreeNode * uffs_TreeGetErasedNode(uffs_Device *dev); - -void uffs_InsertNodeToTree(uffs_Device *dev, u8 type, TreeNode *node); -void uffs_InsertToErasedListHead(uffs_Device *dev, TreeNode *node); -void uffs_TreeInsertToErasedListTail(uffs_Device *dev, TreeNode *node); -void uffs_TreeInsertToErasedListTailEx(uffs_Device *dev, TreeNode *node, int need_check); -void uffs_TreeInsertToBadBlockList(uffs_Device *dev, TreeNode *node); - -void uffs_BreakFromEntry(uffs_Device *dev, u8 type, TreeNode *node); - -void uffs_TreeSetNodeBlock(u8 type, TreeNode *node, u16 block); - - -#ifdef __cplusplus -} -#endif - - - -#endif - - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_types.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_types.h deleted file mode 100644 index c81b37970..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_types.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_TYPES_H_ -#define _UFFS_TYPES_H_ - -#ifdef __CDT_PARSER__ -#undef __cplusplus -#endif - -#ifdef __cplusplus -extern "C"{ -#endif - -#ifdef _UBASE_ -#include -#endif - -/** - * \file uffs_types.h - * \brief basic types used on uffs - * \author Ricky Zheng - */ - -/* basic types */ - -/** \typedef i8 - * \brief 8 bit integer - */ -typedef char i8; - -/** \typedef u8 - * \brief 8 bit unsigned integer - */ -typedef unsigned char u8; - -/** \typedef i16 - * \brief 16 bit integer - */ -typedef short int i16; - - -/** \typedef u16 - * \brief 16 bit unsigned integer - */ -typedef unsigned short int u16; - - -/** \typedef i32 - * \brief 32 bit integer - */ -typedef int i32; - -/** \typedef u32 - * \brief 32 bit unsigned integer - */ -typedef unsigned int u32; - - -#ifndef _UBASE_ - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -/* boolean type */ - -/** \typedef UBOOL - * \brief boolean type for uffs, the value would be: #U_TRUE or #U_FALSE - */ -typedef int UBOOL; - -/** \def U_TRUE - * \brief boolean true for uffs - */ -#define U_TRUE (TRUE) - - -/** \def U_FALSE - * \brief boolean false for uffs - */ -#define U_FALSE (FALSE) - - -/** \typedef URET - * \brief return type for uffs, should be #U_FAIL or #U_SUCC - */ -typedef int URET; - -/** \def U_FAIL - * \brief indicator of fail - */ -#define U_FAIL -1 - -/** \def U_SUCC - * \brief indicator of successful - */ -#define U_SUCC 0 - -/** \def IS_SUCC(ret) - * \brief is it successful ? - */ -#define IS_SUCC(ret) (ret >= 0 ? U_TRUE : U_FALSE) - - -/** \def IS_FAIL(ret) - * \brief is it fail ? - */ -#define IS_FAIL(ret) (ret < 0 ? U_TRUE : U_FALSE) - -#ifndef NULL -/** \def NULL - * \brief zero for pointer - */ -#define NULL 0 -#endif - -#endif // _UBASE_ - - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_utils.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_utils.h deleted file mode 100644 index ae03cb4ab..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_utils.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_UTILS_H_ -#define _UFFS_UTILS_H_ - -#include "uffs/uffs_types.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_core.h" - -#ifdef __cplusplus -extern "C"{ -#endif - - -//get UFFS disk version, if fail, return 0 -int uffs_GetUFFSVersion(struct uffs_DeviceSt *dev); - -void uffs_InitGlobalFsLock(void); -void uffs_ReleaseGlobalFsLock(void); -void uffs_GlobalFsLockLock(void); -void uffs_GlobalFsLockUnlock(void); - -URET uffs_FormatDevice(uffs_Device *dev, UBOOL force); - -#ifdef __cplusplus -} -#endif - -typedef void dump_msg_cb(struct uffs_DeviceSt *dev, const char *fmt, ...); - -void uffs_DumpDevice(struct uffs_DeviceSt *dev, dump_msg_cb *dump); - -#endif - diff --git a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_version.h b/components/dfs/filesystems/uffs/src/inc/uffs/uffs_version.h deleted file mode 100644 index 9ea315420..000000000 --- a/components/dfs/filesystems/uffs/src/inc/uffs/uffs_version.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -#ifndef _UFFS_VERSION_H_ -#define _UFFS_VERSION_H_ - -#ifdef __cplusplus -extern "C"{ -#endif - - -#define UFFS_VERSION 0x01030400 //"01.03.0400" - -const char * uffs_Version2Str(int ver); -int uffs_GetVersion(void); -int uffs_GetMainVersion(int ver); -int uffs_GetMinorVersion(int ver); -int uffs_GetTrivialVersion(int ver); - -#ifdef __cplusplus -} -#endif - - -#endif - diff --git a/components/dfs/filesystems/uffs/src/platform/CMakeLists.txt b/components/dfs/filesystems/uffs/src/platform/CMakeLists.txt deleted file mode 100644 index dd33c737e..000000000 --- a/components/dfs/filesystems/uffs/src/platform/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -IF (UNIX) - SET (libplatform_SRCS posix/uffs_os.c posix/uffs_config.h) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/posix) -ENDIF() - -IF (WIN32) - SET (libplatform_SRCS win32/uffs_os.c win32/uffs_config.h) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/win32) -ENDIF() - -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc) -ADD_LIBRARY(platform STATIC ${libplatform_SRCS} ) - diff --git a/components/dfs/filesystems/uffs/src/platform/posix/uffs_config.h b/components/dfs/filesystems/uffs/src/platform/posix/uffs_config.h deleted file mode 100644 index 2f0b6992b..000000000 --- a/components/dfs/filesystems/uffs/src/platform/posix/uffs_config.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_config.h - * \brief basic configuration of uffs - * \author Ricky Zheng - */ - -#ifndef _UFFS_CONFIG_H_ -#define _UFFS_CONFIG_H_ - -/** - * \def UFFS_MAX_PAGE_SIZE - * \note maximum page size UFFS support - */ -#define UFFS_MAX_PAGE_SIZE 2048 - -/** - * \def UFFS_MAX_SPARE_SIZE - */ -#define UFFS_MAX_SPARE_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 8) - -/** - * \def UFFS_MAX_ECC_SIZE - */ -#define UFFS_MAX_ECC_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 5) - -/** - * \def MAX_CACHED_BLOCK_INFO - * \note uffs cache the block info for opened directories and files, - * a practical value is 5 ~ MAX_OBJECT_HANDLE - */ -#define MAX_CACHED_BLOCK_INFO 50 - -/** - * \def MAX_PAGE_BUFFERS - * \note the bigger value will bring better read/write performance. - * but few writing performance will be improved when this - * value is become larger than 'max pages per block' - */ -#define MAX_PAGE_BUFFERS 40 - - -/** - * \def CLONE_BUFFER_THRESHOLD - * \note reserve buffers for clone. 1 or 2 should be enough. - */ -#define CLONE_BUFFERS_THRESHOLD 2 - -/** - * \def MAX_SPARE_BUFFERS - * \note spare buffers are used for lower level flash operations, - * 5 should be enough. - */ -#define MAX_SPARE_BUFFERS 5 - - -/** - * \def MAX_DIRTY_PAGES_IN_A_BLOCK - * \note this value should be between '2' and the lesser of - * 'max pages per block' and (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1). - * - * the smaller the value the frequently the buffer will be flushed. - */ -#define MAX_DIRTY_PAGES_IN_A_BLOCK 32 - -/** - * \def MAX_DIRTY_BUF_GROUPS - */ -#define MAX_DIRTY_BUF_GROUPS 3 - -/** - * \def CONFIG_ENABLE_UFFS_DEBUG_MSG - * \note Enable debug message output. You must call uffs_InitDebugMessageOutput() - * to initialize debug apart from enable debug feature. - */ -#define CONFIG_ENABLE_UFFS_DEBUG_MSG - -/** - * \def CONFIG_USE_GLOBAL_FS_LOCK - * \note use global lock instead of per-device lock. - * this is required if you use fd APIs in multi-thread environment. - */ -#define CONFIG_USE_GLOBAL_FS_LOCK - - -/** - * \def CONFIG_USE_PER_DEVICE_LOCK - * \note use per-device lock. - * this is required if you use fs APIs in multi-thread environment. - */ -//#define CONFIG_USE_PER_DEVICE_LOCK - - - -/** - * \def CONFIG_USE_STATIC_MEMORY_ALLOCATOR - * \note uffs will use static memory allocator if this is defined. - * to use static memory allocator, you need to provide memory - * buffer when creating uffs_Device. - * - * use UFFS_STATIC_BUFF_SIZE() to calculate memory buffer size. - */ -#define CONFIG_USE_STATIC_MEMORY_ALLOCATOR 0 - -/** - * \def CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR - * \note using system platform's 'malloc' and 'free'. - */ -#define CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR 1 - - - -/** - * \def CONFIG_FLUSH_BUF_AFTER_WRITE - * \note UFFS will write all data directly into flash in - * each 'write' call if you enable this option. - * (which means lesser data lost when power failure but - * poorer writing performance). - * It's not recommended to open this define for normal applications. - */ -#define CONFIG_FLUSH_BUF_AFTER_WRITE - - -/** - * \def CONFIG_UFFS_AUTO_LAYOUT_MTD_COMP - * \note Use Linux MTD compatiable spare placement for UFFS_LAYOUT_AUTO, - * only valid for page data size 512 or 2048. - */ -//#define CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME - - -/** - * \def MAX_OBJECT_HANDLE - * maximum number of object handle - */ -#define MAX_OBJECT_HANDLE 50 -#define FD_SIGNATURE_SHIFT 6 - - -/** - * \def MAX_DIR_HANDLE - * maximum number of uffs_DIR - */ -#define MAX_DIR_HANDLE 10 - -/** - * \def MINIMUN_ERASED_BLOCK - * UFFS will not allow appending or creating new files when the free/erased block - * is lower then MINIMUN_ERASED_BLOCK. - */ -#define MINIMUN_ERASED_BLOCK 2 - -/** - * \def CONFIG_CHANGE_MODIFY_TIME - * \note If defined, closing a file which is opened for writing/appending will - * update the file's modify time as well. Disable this feature will save a - * lot of writing activities if you frequently open files for write and close it. - */ -//#define CONFIG_CHANGE_MODIFY_TIME - - -/** - * \def CONFIG_ENABLE_BAD_BLOCK_VERIFY - * \note allow erase and verify block marked as 'bad' when format UFFS partition. - * it's not recommended for most NAND flash. - */ -#define CONFIG_ENABLE_BAD_BLOCK_VERIFY - -/** - * \def CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - * \note erase block again before mark bad block - */ -//#define CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - -/** - * \def CONFIG_PAGE_WRITE_VERIFY - * \note verify page data after write, for extra safe data storage. - */ -#define CONFIG_PAGE_WRITE_VERIFY - -/** - * \def CONFIG_BAD_BLOCK_POLICY_STRICT - * \note If this is enabled, UFFS will report the block as 'bad' if any bit-flips found; - * otherwise, UFFS report bad block only when ECC failed or reported - * by low level flash driver. - * - * \note Enable this will ensure your data always be stored on completely good blocks. - */ -#define CONFIG_BAD_BLOCK_POLICY_STRICT - - -/** - * \def CONFIG_ENABLE_PAGE_DATA_CRC - * \note If this is enabled, UFFS save page data CRC16 sum in mini header, - * it provides extra protection for data integrity. - */ -#define CONFIG_ENABLE_PAGE_DATA_CRC - - -/** micros for calculating buffer sizes */ - -/** - * \def UFFS_BLOCK_INFO_BUFFER_SIZE - * \brief calculate memory bytes for block info caches - */ -#define UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) \ - ( \ - ( \ - sizeof(uffs_BlockInfo) + \ - sizeof(uffs_PageSpare) * n_pages_per_block \ - ) * MAX_CACHED_BLOCK_INFO \ - ) - -/** - * \def UFFS_PAGE_BUFFER_SIZE - * \brief calculate memory bytes for page buffers - */ -#define UFFS_PAGE_BUFFER_SIZE(n_page_size) \ - ( \ - ( \ - sizeof(uffs_Buf) + n_page_size \ - ) * MAX_PAGE_BUFFERS \ - ) - -/** - * \def UFFS_TREE_BUFFER_SIZE - * \brief calculate memory bytes for tree nodes - */ -#define UFFS_TREE_BUFFER_SIZE(n_blocks) (sizeof(TreeNode) * n_blocks) - - -#define UFFS_SPARE_BUFFER_SIZE (MAX_SPARE_BUFFERS * UFFS_MAX_SPARE_SIZE) - - -/** - * \def UFFS_STATIC_BUFF_SIZE - * \brief calculate total memory usage of uffs system - */ -#define UFFS_STATIC_BUFF_SIZE(n_pages_per_block, n_page_size, n_blocks) \ - ( \ - UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) + \ - UFFS_PAGE_BUFFER_SIZE(n_page_size) + \ - UFFS_TREE_BUFFER_SIZE(n_blocks) + \ - UFFS_SPARE_BUFFER_SIZE \ - ) - - - -/* config check */ -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD) < 3 -#error "MAX_PAGE_BUFFERS is too small" -#endif - -#if (MAX_DIRTY_PAGES_IN_A_BLOCK < 2) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should >= 2" -#endif - -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1 < MAX_DIRTY_PAGES_IN_A_BLOCK) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should < (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD)" -#endif - -#if defined(CONFIG_PAGE_WRITE_VERIFY) && (CLONE_BUFFERS_THRESHOLD < 2) -#error "CLONE_BUFFERS_THRESHOLD should >= 2 when CONFIG_PAGE_WRITE_VERIFY is enabled." -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 1 -#error "Please enable ONLY one memory allocator" -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR == 0 -#error "Please enable ONE of memory allocators" -#endif - -#if defined(CONFIG_USE_GLOBAL_FS_LOCK) && defined(CONFIG_USE_PER_DEVICE_LOCK) -#error "enable either CONFIG_USE_GLOBAL_FS_LOCK or CONFIG_USE_PER_DEVICE_LOCK, not both" -#endif - -#if (MAX_OBJECT_HANDLE > (1 << FD_SIGNATURE_SHIFT)) -#error "Please increase FD_SIGNATURE_SHIFT !" -#endif - -#ifdef WIN32 -# pragma warning(disable : 4996) -# pragma warning(disable : 4244) -# pragma warning(disable : 4214) -# pragma warning(disable : 4127) -# pragma warning(disable : 4389) -# pragma warning(disable : 4100) -#endif - -#endif diff --git a/components/dfs/filesystems/uffs/src/platform/posix/uffs_os.c b/components/dfs/filesystems/uffs/src/platform/posix/uffs_os.c deleted file mode 100644 index 170c457ad..000000000 --- a/components/dfs/filesystems/uffs/src/platform/posix/uffs_os.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_os_posix.c - * \brief Emulation on POSIX host. This is just a dumb implementation, does not really create semaphores. - * \author Ricky Zheng - */ - -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include -#include -#include -#include -#include - -#define PFX "os : " - -int uffs_SemCreate(OSSEM *sem) -{ - pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t)); - int ret = -1; - - if (mutex) { - ret = pthread_mutex_init(mutex, NULL /* default attr */); - if (ret == 0) { - *sem = (OSSEM *)mutex; - } - else { - free(mutex); - } - } - - return ret; -} - -int uffs_SemWait(OSSEM sem) -{ - return pthread_mutex_lock((pthread_mutex_t *)sem); -} - -int uffs_SemSignal(OSSEM sem) -{ - return pthread_mutex_unlock((pthread_mutex_t *)sem);; -} - -int uffs_SemDelete(OSSEM *sem) -{ - pthread_mutex_t *mutex = (pthread_mutex_t *) (*sem); - int ret = -1; - - if (mutex) { - ret = pthread_mutex_destroy(mutex); - if (ret == 0) { - free(mutex); - *sem = 0; - } - } - return ret; -} - -int uffs_OSGetTaskId(void) -{ - //TODO: ... return current task ID ... - return 0; -} - -unsigned int uffs_GetCurDateTime(void) -{ - // FIXME: return system time, please modify this for your platform ! - // or just return 0 if you don't care about file time. - time_t tvalue; - - tvalue = time(NULL); - - return (unsigned int)tvalue; -} - -#if CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 0 -static void * sys_malloc(struct uffs_DeviceSt *dev, unsigned int size) -{ - dev = dev; - uffs_Perror(UFFS_MSG_NORMAL, "system memory alloc %d bytes", size); - return malloc(size); -} - -static URET sys_free(struct uffs_DeviceSt *dev, void *p) -{ - dev = dev; - free(p); - return U_SUCC; -} - -void uffs_MemSetupSystemAllocator(uffs_MemAllocator *allocator) -{ - allocator->malloc = sys_malloc; - allocator->free = sys_free; -} -#endif - - -/* debug message output throught 'printf' */ -static void output_dbg_msg(const char *msg); -static struct uffs_DebugMsgOutputSt m_dbg_ops = { - output_dbg_msg, - NULL, -}; - -static void output_dbg_msg(const char *msg) -{ - printf("%s", msg); -} - -void uffs_SetupDebugOutput(void) -{ - uffs_InitDebugMessageOutput(&m_dbg_ops, UFFS_MSG_NOISY); -} diff --git a/components/dfs/filesystems/uffs/src/platform/win32/uffs_config.h b/components/dfs/filesystems/uffs/src/platform/win32/uffs_config.h deleted file mode 100644 index 3f9daa9cd..000000000 --- a/components/dfs/filesystems/uffs/src/platform/win32/uffs_config.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_config.h - * \brief basic configuration of uffs - * \author Ricky Zheng - */ - -#ifndef _UFFS_CONFIG_H_ -#define _UFFS_CONFIG_H_ - -/** - * \def UFFS_MAX_PAGE_SIZE - * \note maximum page size UFFS support - */ -#define UFFS_MAX_PAGE_SIZE 2048 - -/** - * \def UFFS_MAX_SPARE_SIZE - */ -#define UFFS_MAX_SPARE_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 8) - -/** - * \def UFFS_MAX_ECC_SIZE - */ -#define UFFS_MAX_ECC_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 5) - -/** - * \def MAX_CACHED_BLOCK_INFO - * \note uffs cache the block info for opened directories and files, - * a practical value is 5 ~ MAX_OBJECT_HANDLE - */ -#define MAX_CACHED_BLOCK_INFO 50 - -/** - * \def MAX_PAGE_BUFFERS - * \note the bigger value will bring better read/write performance. - * but few writing performance will be improved when this - * value is become larger than 'max pages per block' - */ -#define MAX_PAGE_BUFFERS 40 - - -/** - * \def CLONE_BUFFER_THRESHOLD - * \note reserve buffers for clone. 1 or 2 should be enough. - */ -#define CLONE_BUFFERS_THRESHOLD 2 - -/** - * \def MAX_SPARE_BUFFERS - * \note spare buffers are used for lower level flash operations, - * 5 should be enough. - */ -#define MAX_SPARE_BUFFERS 5 - - -/** - * \def MAX_DIRTY_PAGES_IN_A_BLOCK - * \note this value should be between '2' and the lesser of - * 'max pages per block' and (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1). - * - * the smaller the value the frequently the buffer will be flushed. - */ -#define MAX_DIRTY_PAGES_IN_A_BLOCK 32 - -/** - * \def CONFIG_ENABLE_UFFS_DEBUG_MSG - * \note Enable debug message output. You must call uffs_InitDebugMessageOutput() - * to initialize debug apart from enable debug feature. - */ -#define CONFIG_ENABLE_UFFS_DEBUG_MSG - -/** - * \def CONFIG_USE_GLOBAL_FS_LOCK - * \note use global lock instead of per-device lock. - * this is required if you use fd APIs in multi-thread environment. - */ -#define CONFIG_USE_GLOBAL_FS_LOCK - - -/** - * \def CONFIG_USE_PER_DEVICE_LOCK - * \note use per-device lock. - * this is required if you use fs APIs in multi-thread environment. - */ -//#define CONFIG_USE_PER_DEVICE_LOCK - - - -/** - * \def CONFIG_USE_STATIC_MEMORY_ALLOCATOR - * \note uffs will use static memory allocator if this is defined. - * to use static memory allocator, you need to provide memory - * buffer when creating uffs_Device. - * - * use UFFS_STATIC_BUFF_SIZE() to calculate memory buffer size. - */ -#define CONFIG_USE_STATIC_MEMORY_ALLOCATOR 0 - -/** - * \def CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR - * \note using system platform's 'malloc' and 'free'. - */ -#define CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR 1 - - - -/** - * \def CONFIG_FLUSH_BUF_AFTER_WRITE - * \note UFFS will write all data directly into flash in - * each 'write' call if you enable this option. - * (which means lesser data lost when power failure but - * poorer writing performance). - * It's not recommended to open this define for normal applications. - */ -//#define CONFIG_FLUSH_BUF_AFTER_WRITE - - -/** - * \def CONFIG_UFFS_AUTO_LAYOUT_MTD_COMP - * \note Use Linux MTD compatiable spare placement for UFFS_LAYOUT_AUTO, - * only valid for page data size 512 or 2048. - */ -//#define CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME - - -/** - * \def MAX_OBJECT_HANDLE - * maximum number of object handle - */ -#define MAX_OBJECT_HANDLE 50 -#define FD_SIGNATURE_SHIFT 6 - - -/** - * \def MAX_DIR_HANDLE - * maximum number of uffs_DIR - */ -#define MAX_DIR_HANDLE 10 - -/** - * \def MINIMUN_ERASED_BLOCK - * UFFS will not allow appending or creating new files when the free/erased block - * is lower then MINIMUN_ERASED_BLOCK. - */ -#define MINIMUN_ERASED_BLOCK 2 - -/** - * \def CONFIG_CHANGE_MODIFY_TIME - * \note If defined, closing a file which is opened for writing/appending will - * update the file's modify time as well. Disable this feature will save a - * lot of writing activities if you frequently open files for write and close it. - */ -//#define CONFIG_CHANGE_MODIFY_TIME - - -/** - * \def CONFIG_ENABLE_BAD_BLOCK_VERIFY - * \note allow erase and verify block marked as 'bad' when format UFFS partition. - * it's not recommended for most NAND flash. - */ -#define CONFIG_ENABLE_BAD_BLOCK_VERIFY - -/** - * \def CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - * \note erase block again before mark bad block - */ -//#define CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - -/** - * \def CONFIG_PAGE_WRITE_VERIFY - * \note verify page data after write, for extra safe data storage. - */ -#define CONFIG_PAGE_WRITE_VERIFY - -/** - * \def CONFIG_BAD_BLOCK_POLICY_STRICT - * \note If this is enabled, UFFS will report the block as 'bad' if any bit-flips found; - * otherwise, UFFS report bad block only when ECC failed or reported - * by low level flash driver. - * - * \note Enable this will ensure your data always be stored on completely good blocks. - */ -#define CONFIG_BAD_BLOCK_POLICY_STRICT - - -/** - * \def CONFIG_ENABLE_PAGE_DATA_CRC - * \note If this is enabled, UFFS save page data CRC16 sum in mini header, - * it provides extra protection for data integrity. - */ -//#define CONFIG_ENABLE_PAGE_DATA_CRC - - -/** micros for calculating buffer sizes */ - -/** - * \def UFFS_BLOCK_INFO_BUFFER_SIZE - * \brief calculate memory bytes for block info caches - */ -#define UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) \ - ( \ - ( \ - sizeof(uffs_BlockInfo) + \ - sizeof(uffs_PageSpare) * n_pages_per_block \ - ) * MAX_CACHED_BLOCK_INFO \ - ) - -/** - * \def UFFS_PAGE_BUFFER_SIZE - * \brief calculate memory bytes for page buffers - */ -#define UFFS_PAGE_BUFFER_SIZE(n_page_size) \ - ( \ - ( \ - sizeof(uffs_Buf) + n_page_size \ - ) * MAX_PAGE_BUFFERS \ - ) - -/** - * \def UFFS_TREE_BUFFER_SIZE - * \brief calculate memory bytes for tree nodes - */ -#define UFFS_TREE_BUFFER_SIZE(n_blocks) (sizeof(TreeNode) * n_blocks) - - -#define UFFS_SPARE_BUFFER_SIZE (MAX_SPARE_BUFFERS * UFFS_MAX_SPARE_SIZE) - - -/** - * \def UFFS_STATIC_BUFF_SIZE - * \brief calculate total memory usage of uffs system - */ -#define UFFS_STATIC_BUFF_SIZE(n_pages_per_block, n_page_size, n_blocks) \ - ( \ - UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) + \ - UFFS_PAGE_BUFFER_SIZE(n_page_size) + \ - UFFS_TREE_BUFFER_SIZE(n_blocks) + \ - UFFS_SPARE_BUFFER_SIZE \ - ) - - - -/* config check */ -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD) < 3 -#error "MAX_PAGE_BUFFERS is too small" -#endif - -#if (MAX_DIRTY_PAGES_IN_A_BLOCK < 2) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should >= 2" -#endif - -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1 < MAX_DIRTY_PAGES_IN_A_BLOCK) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should < (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD)" -#endif - -#if defined(CONFIG_PAGE_WRITE_VERIFY) && (CLONE_BUFFERS_THRESHOLD < 2) -#error "CLONE_BUFFERS_THRESHOLD should >= 2 when CONFIG_PAGE_WRITE_VERIFY is enabled." -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 1 -#error "Please enable ONLY one memory allocator" -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR == 0 -#error "Please enable ONE of memory allocators" -#endif - -#if defined(CONFIG_USE_GLOBAL_FS_LOCK) && defined(CONFIG_USE_PER_DEVICE_LOCK) -#error "enable either CONFIG_USE_GLOBAL_FS_LOCK or CONFIG_USE_PER_DEVICE_LOCK, not both" -#endif - -#if (MAX_OBJECT_HANDLE > (1 << FD_SIGNATURE_SHIFT)) -#error "Please increase FD_SIGNATURE_SHIFT !" -#endif - -#ifdef WIN32 -# pragma warning(disable : 4996) -# pragma warning(disable : 4244) -# pragma warning(disable : 4214) -# pragma warning(disable : 4127) -# pragma warning(disable : 4389) -# pragma warning(disable : 4100) -#endif - -#endif diff --git a/components/dfs/filesystems/uffs/src/platform/win32/uffs_os.c b/components/dfs/filesystems/uffs/src/platform/win32/uffs_os.c deleted file mode 100644 index d05c44abb..000000000 --- a/components/dfs/filesystems/uffs/src/platform/win32/uffs_os.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_os.c - * \brief Emulation on win32 host - * \author Ricky Zheng - */ - -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include -#include -#include -#include -#include - -#define PFX "os : " - -int uffs_SemCreate(OSSEM *sem) -{ - HANDLE mutex = CreateMutex( - NULL, // default security attributes - FALSE, // initially not owned - NULL); // unnamed mutex - - if (mutex == NULL) { - printf("Create mutex failed !\n"); - return -1; - } - else { - *sem = (OSSEM)mutex; - } - - return 0; -} - -int uffs_SemWait(OSSEM sem) -{ - DWORD result; - - result = WaitForSingleObject( - (HANDLE)sem, // handle to mutex - INFINITE); // no time-out interval - - return result == WAIT_ABANDONED ? -1 : 0; -} - -int uffs_SemSignal(OSSEM sem) -{ - return ReleaseMutex((HANDLE)sem) ? 0 : -1; -} - -int uffs_SemDelete(OSSEM *sem) -{ - if (CloseHandle((HANDLE)(*sem))) { - *sem = 0; - return 0; - } - else - return -1; -} - -int uffs_OSGetTaskId(void) -{ - return 0; -} - -unsigned int uffs_GetCurDateTime(void) -{ - // FIXME: return system time, please modify this for your platform ! - // or just return 0 if you don't care about file time. - time_t tvalue; - - tvalue = time(NULL); - - return (unsigned int)tvalue; -} - -#if CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 0 -static void * sys_malloc(struct uffs_DeviceSt *dev, unsigned int size) -{ - dev = dev; - uffs_Perror(UFFS_MSG_NORMAL, "system memory alloc %d bytes", size); - return malloc(size); -} - -static URET sys_free(struct uffs_DeviceSt *dev, void *p) -{ - dev = dev; - free(p); - return U_SUCC; -} - -void uffs_MemSetupSystemAllocator(uffs_MemAllocator *allocator) -{ - allocator->malloc = sys_malloc; - allocator->free = sys_free; -} -#endif - - -/* debug message output throught 'printf' */ -static void output_dbg_msg(const char *msg); -static struct uffs_DebugMsgOutputSt m_dbg_ops = { - output_dbg_msg, - NULL, -}; - -static void output_dbg_msg(const char *msg) -{ - printf("%s", msg); -} - -void uffs_SetupDebugOutput(void) -{ - uffs_InitDebugMessageOutput(&m_dbg_ops, UFFS_MSG_NOISY); -} diff --git a/components/dfs/filesystems/uffs/src/uffs/CMakeLists.txt b/components/dfs/filesystems/uffs/src/uffs/CMakeLists.txt deleted file mode 100644 index 24b726b8c..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/CMakeLists.txt +++ /dev/null @@ -1,59 +0,0 @@ -SET (libuffs_SRCS - uffs_badblock.c - uffs_blockinfo.c - uffs_buf.c - uffs_debug.c - uffs_device.c - uffs_ecc.c - uffs_fd.c - uffs_fs.c - uffs_init.c - uffs_mem.c - uffs_pool.c - uffs_public.c - uffs_tree.c - uffs_utils.c - uffs_mtb.c - uffs_find.c - uffs_flash.c - uffs_version.c - uffs_crc.c - ) - -SET (HDR ${uffs_SOURCE_DIR}/src/inc/uffs) - -SET (libuffs_HEADS - ${HDR}/uffs.h - ${HDR}/uffs_badblock.h - ${HDR}/uffs_blockinfo.h - ${HDR}/uffs_buf.h - ${HDR}/uffs_core.h - ${HDR}/uffs_device.h - ${HDR}/uffs_ecc.h - ${HDR}/uffs_fd.h - ${HDR}/uffs_fs.h - ${HDR}/uffs_mem.h - ${HDR}/uffs_os.h - ${HDR}/uffs_pool.h - ${HDR}/uffs_public.h - ${HDR}/uffs_tree.h - ${HDR}/uffs_types.h - ${HDR}/uffs_utils.h - ${HDR}/uffs_mtb.h - ${HDR}/uffs_find.h - ${HDR}/uffs_flash.h - ${HDR}/uffs_version.h - ${HDR}/uffs_crc.h - ) - -IF (UNIX) -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/posix) -ENDIF() - -IF (WIN32) -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/win32) -ENDIF() - -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc) - -ADD_LIBRARY( uffs STATIC ${libuffs_SRCS} ${libuffs_HEADS} ) diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_badblock.c b/components/dfs/filesystems/uffs/src/uffs/uffs_badblock.c deleted file mode 100644 index 6145b9e54..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_badblock.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_badblock.c - * \brief bad block checking and recovering - * \author Ricky Zheng, created in 13th Jun, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_ecc.h" -#include "uffs/uffs_badblock.h" -#include - -#define PFX "bbl : " - -void uffs_BadBlockInit(uffs_Device *dev) -{ - dev->bad.block = UFFS_INVALID_BLOCK; -} - - -/** - * \brief process bad block: erase bad block, mark it as 'bad' - * and put the node to bad block list. - * \param[in] dev uffs device - * \param[in] node bad block tree node - * (before the block turn 'bad', it must belong to something ...) - */ -void uffs_BadBlockProcess(uffs_Device *dev, TreeNode *node) -{ - if (HAVE_BADBLOCK(dev)) { - // mark the bad block - uffs_FlashMarkBadBlock(dev, dev->bad.block); - - // and put it into bad block list - if (node != NULL) - uffs_TreeInsertToBadBlockList(dev, node); - - //clear bad block mark. - dev->bad.block = UFFS_INVALID_BLOCK; - - } -} - -/** - * \brief process bad block and put the node in 'suspend' list. - * \param[in] dev uffs device - * \param[in] node bad block tree node - */ -void uffs_BadBlockProcessSuspend(uffs_Device *dev, TreeNode *node) -{ - if (HAVE_BADBLOCK(dev)) { - // mark the bad block - uffs_FlashMarkBadBlock(dev, dev->bad.block); - - // and put it into bad block list - if (node != NULL) - uffs_TreeSuspendAdd(dev, node); - - //clear bad block mark. - dev->bad.block = UFFS_INVALID_BLOCK; - } -} - -/** - * \brief recover bad block - * \param[in] dev uffs device - */ -void uffs_BadBlockRecover(uffs_Device *dev) -{ - TreeNode *good, *bad; - uffs_Buf *buf; - u16 i; - u16 page; - uffs_BlockInfo *bc = NULL; - uffs_Tags *tag; - uffs_Tags newTag; - UBOOL succRecov; - UBOOL goodBlockIsDirty = U_FALSE; - int ret; - int region; - u8 type; - - if (dev->bad.block == UFFS_INVALID_BLOCK) - return; - - // pick up an erased good block - good = uffs_TreeGetErasedNode(dev); - if (good == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "no free block to replace bad block!"); - return; - } - - //recover block - bc = uffs_BlockInfoGet(dev, dev->bad.block); - - if (bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get bad block info"); - return; - } - - succRecov = U_TRUE; - for (i = 0; i < dev->attr->pages_per_block; i++) { - page = uffs_FindPageInBlockWithPageId(dev, bc, i); - if (page == UFFS_INVALID_PAGE) { - break; //end of last valid page, normal break - } - page = uffs_FindBestPageInBlock(dev, bc, page); - if (page == UFFS_INVALID_PAGE) { - // got an invalid page ? it's bad block anyway ... - uffs_Perror(UFFS_MSG_SERIOUS, "bad block recover (block %d) not finished", bc->block); - break; - } - tag = GET_TAG(bc, page); - buf = uffs_BufClone(dev, NULL); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't clone a new buf!"); - succRecov = U_FALSE; - break; - } - //NOTE: since this is a bad block, we can't guarantee the data is ECC ok, - // so just load data even ECC is not OK. - ret = uffs_LoadPhyDataToBufEccUnCare(dev, buf, bc->block, page); - if (ret == U_FAIL) { - uffs_Perror(UFFS_MSG_SERIOUS, "I/O error ?"); - uffs_BufFreeClone(dev, buf); - succRecov = U_FALSE; - break; - } - buf->data_len = TAG_DATA_LEN(tag); - if (buf->data_len > dev->com.pg_data_size) { - uffs_Perror(UFFS_MSG_NOISY, "data length over flow!!!"); - buf->data_len = dev->com.pg_data_size; - } - - buf->parent = TAG_PARENT(tag); - buf->serial = TAG_SERIAL(tag); - buf->type = TAG_TYPE(tag); - buf->page_id = TAG_PAGE_ID(tag); - - // new tag copied from old tag, and increase time-stamp. - newTag = *tag; - TAG_BLOCK_TS(&newTag) = uffs_GetNextBlockTimeStamp(TAG_BLOCK_TS(tag)); - - ret = uffs_FlashWritePageCombine(dev, good->u.list.block, i, buf, &newTag); - - goodBlockIsDirty = U_TRUE; - uffs_BufFreeClone(dev, buf); - - if (ret == UFFS_FLASH_IO_ERR) { - uffs_Perror(UFFS_MSG_NORMAL, "I/O error ?"); - succRecov = U_FALSE; - break; - } - } - - - if (succRecov == U_TRUE) { - // successful recover bad block, so need to mark bad block, - // and replace with good one - - region = SEARCH_REGION_DIR|SEARCH_REGION_FILE|SEARCH_REGION_DATA; - bad = uffs_TreeFindNodeByBlock(dev, dev->bad.block, ®ion); - if (bad != NULL) { - switch (region) { - case SEARCH_REGION_DIR: - bad->u.dir.block = good->u.list.block; - type = UFFS_TYPE_DIR; - break; - case SEARCH_REGION_FILE: - bad->u.file.block = good->u.list.block; - type = UFFS_TYPE_FILE; - break; - case SEARCH_REGION_DATA: - bad->u.data.block = good->u.list.block; - type = UFFS_TYPE_DATA; - } - - //from now, the 'bad' is actually good block :))) - uffs_Perror(UFFS_MSG_NOISY, - "new bad block %d found, and replaced by %d, type %d!", - dev->bad.block, good->u.list.block, type); - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); - //we reuse the 'good' node as bad block node, and process the bad block. - good->u.list.block = dev->bad.block; - uffs_BadBlockProcess(dev, good); - } - else { - uffs_Perror(UFFS_MSG_SERIOUS, - "can't find the reported bad block(%d) in the tree???", - dev->bad.block); - if (goodBlockIsDirty == U_TRUE) - dev->ops->EraseBlock(dev, good->u.list.block); - uffs_TreeInsertToErasedListTail(dev, good); - } - } - else { - if (goodBlockIsDirty == U_TRUE) - dev->ops->EraseBlock(dev, good->u.list.block); - uffs_TreeInsertToErasedListTail(dev, good); //put back to erased list - } - - uffs_BlockInfoPut(dev, bc); - -} - - -/** put a new block to the bad block waiting list */ -void uffs_BadBlockAdd(uffs_Device *dev, int block) -{ - if (dev->bad.block == block) - return; - - if (dev->bad.block != UFFS_INVALID_BLOCK) - uffs_Perror(UFFS_MSG_SERIOUS, "Can't add more then one bad block !"); - else - dev->bad.block = block; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_blockinfo.c b/components/dfs/filesystems/uffs/src/uffs/uffs_blockinfo.c deleted file mode 100644 index f80bc6113..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_blockinfo.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_blockinfo.c - * \brief block information cache system manipulations - * \author Ricky Zheng, created 10th May, 2005 - */ - -#include "uffs_config.h" -#include "uffs/uffs_blockinfo.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_os.h" - -#include - -#define PFX "bc : " - -#define UFFS_CLONE_BLOCK_INFO_NEXT ((uffs_BlockInfo *)(-2)) - -/** - * \brief before block info cache is enable, - * this function should be called to initialize it - * - * \param[in] dev uffs device - * \param[in] maxCachedBlocks maximum cache buffers to be allocated - * \return result of initialization - * \retval U_SUCC successful - * \retval U_FAIL failed - */ -URET uffs_BlockInfoInitCache(uffs_Device *dev, int maxCachedBlocks) -{ - uffs_BlockInfo * blockInfos = NULL; - uffs_PageSpare * pageSpares = NULL; - void * buf = NULL; - uffs_BlockInfo *work = NULL; - int size, i, j; - - if (dev->bc.head != NULL) { - uffs_Perror(UFFS_MSG_NOISY, - "block info cache has been inited already, " - "now release it first."); - uffs_BlockInfoReleaseCache(dev); - } - - size = ( - sizeof(uffs_BlockInfo) + - sizeof(uffs_PageSpare) * dev->attr->pages_per_block - ) * maxCachedBlocks; - - if (dev->mem.blockinfo_pool_size == 0) { - if (dev->mem.malloc) { - dev->mem.blockinfo_pool_buf = dev->mem.malloc(dev, size); - if (dev->mem.blockinfo_pool_buf) - dev->mem.blockinfo_pool_size = size; - } - } - if (size > dev->mem.blockinfo_pool_size) { - uffs_Perror(UFFS_MSG_DEAD, - "Block cache buffer require %d but only %d available.", - size, dev->mem.blockinfo_pool_size); - return U_FAIL; - } - - uffs_Perror(UFFS_MSG_NOISY, "alloc info cache %d bytes.", size); - - buf = dev->mem.blockinfo_pool_buf; - - memset(buf, 0, size); - - dev->bc.mem_pool = buf; - - size = 0; - blockInfos = (uffs_BlockInfo *)buf; - size += sizeof(uffs_BlockInfo) * maxCachedBlocks; - - pageSpares = (uffs_PageSpare *)((char *)buf + size); - - //initialize block info - work = &(blockInfos[0]); - dev->bc.head = work; - work->ref_count = 0; - work->prev = NULL; - work->next = &(blockInfos[1]); - work->block = UFFS_INVALID_BLOCK; - - for (i = 0; i < maxCachedBlocks - 2; i++) { - work = &(blockInfos[i+1]); - work->prev = &(blockInfos[i]); - work->next = &(blockInfos[i+2]); - work->ref_count = 0; - work->block = UFFS_INVALID_BLOCK; - } - //the last node - work = &(blockInfos[i+1]); - work->prev = &(blockInfos[i]); - work->next = NULL; - work->block = UFFS_INVALID_BLOCK; - work->ref_count = 0; - dev->bc.tail = work; - - //initialize spares - work = dev->bc.head; - for (i = 0; i < maxCachedBlocks; i++) { - work->spares = &(pageSpares[i*dev->attr->pages_per_block]); - for (j = 0; j < dev->attr->pages_per_block; j++) { - work->spares[j].expired = 1; - } - work->expired_count = dev->attr->pages_per_block; - work = work->next; - } - return U_SUCC; -} - -/** - * \brief release all allocated memory of block info cache, - * this function should be called when unmount file system - * \param[in] dev uffs device - */ -URET uffs_BlockInfoReleaseCache(uffs_Device *dev) -{ - uffs_BlockInfo *work; - - if (dev->bc.head) { - for (work = dev->bc.head; work != NULL; work = work->next) { - if (work->ref_count != 0) { - uffs_Perror(UFFS_MSG_SERIOUS, - "There have refed block info cache, release cache fail."); - return U_FAIL; - } - } - if (dev->mem.free) { - dev->mem.free(dev, dev->bc.mem_pool); - dev->mem.blockinfo_pool_size = 0; - } - } - - dev->bc.head = dev->bc.tail = NULL; - dev->bc.mem_pool = NULL; - - return U_SUCC; -} - -static void _BreakBcFromList(uffs_Device *dev, uffs_BlockInfo *bc) -{ - if (bc->prev) - bc->prev->next = bc->next; - - if (bc->next) - bc->next->prev = bc->prev; - - if (dev->bc.head == bc) - dev->bc.head = bc->next; - - if (dev->bc.tail == bc) - dev->bc.tail = bc->prev; -} - -static void _InsertToBcListTail(uffs_Device *dev, uffs_BlockInfo *bc) -{ - bc->next = NULL; - bc->prev = dev->bc.tail; - bc->prev->next = bc; - dev->bc.tail = bc; -} - -static void _MoveBcToTail(uffs_Device *dev, uffs_BlockInfo *bc) -{ - _BreakBcFromList(dev, bc); - _InsertToBcListTail(dev, bc); -} - - -/** - * \brief load page spare data to given block info structure - * with given page number - * \param[in] dev uffs device - * \param[in] work given block info to be filled with - * \param[in] page given page number to be read from, - * if #UFFS_ALL_PAGES is presented, it will read - * all pages, otherwise it will read only one given page. - * \return load result - * \retval U_SUCC successful - * \retval U_FAIL fail to load - * \note work->block must be set before load block info - */ -URET uffs_BlockInfoLoad(uffs_Device *dev, uffs_BlockInfo *work, int page) -{ - int i, ret; - uffs_PageSpare *spare; - - if (page == UFFS_ALL_PAGES) { - for (i = 0; i < dev->attr->pages_per_block; i++) { - spare = &(work->spares[i]); - if (spare->expired == 0) - continue; - - ret = uffs_FlashReadPageTag(dev, work->block, i, - &(spare->tag)); - if (UFFS_FLASH_HAVE_ERR(ret)) { - uffs_Perror(UFFS_MSG_SERIOUS, - "load block %d page %d spare fail.", - work->block, i); - return U_FAIL; - } - spare->expired = 0; - work->expired_count--; - } - } - else { - if (page < 0 || page >= dev->attr->pages_per_block) { - uffs_Perror(UFFS_MSG_SERIOUS, "page out of range !"); - return U_FAIL; - } - spare = &(work->spares[page]); - if (spare->expired != 0) { - ret = uffs_FlashReadPageTag(dev, work->block, page, - &(spare->tag)); - if (UFFS_FLASH_HAVE_ERR(ret)) { - uffs_Perror(UFFS_MSG_SERIOUS, - "load block %d page %d spare fail.", - work->block, page); - return U_FAIL; - } - spare->expired = 0; - work->expired_count--; - } - } - return U_SUCC; -} - - -/** - * \brief find a block cache with given block number - * \param[in] dev uffs device - * \param[in] block block number - * \return found block cache - * \retval NULL cache not found - * \retval non-NULL found cache pointer - */ -uffs_BlockInfo * uffs_BlockInfoFindInCache(uffs_Device *dev, int block) -{ - uffs_BlockInfo *work; - - //search cached block - for (work = dev->bc.head; work != NULL; work = work->next) { - if (work->block == block) { - work->ref_count++; - return work; - } - } - return NULL; -} - - -/** - * \brief Find a cached block in cache pool, - * if the cached block exist then return the pointer, - * if the block does not cached already, find a non-used cache. - * if all of cached are used out, return NULL. - * \param[in] dev uffs device - * \param[in] block block number to be found - * \return found block cache buffer - * \retval NULL caches used out - * \retval non-NULL buffer pointer of given block - */ -uffs_BlockInfo * uffs_BlockInfoGet(uffs_Device *dev, int block) -{ - uffs_BlockInfo *work; - int i; - - //search cached block - if ((work = uffs_BlockInfoFindInCache(dev, block)) != NULL) { - _MoveBcToTail(dev, work); - return work; - } - - //can't find block from cache, need to find a free(unlocked) cache - for (work = dev->bc.head; work != NULL; work = work->next) { - if(work->ref_count == 0) break; - } - if (work == NULL) { - //caches used out ! - uffs_Perror(UFFS_MSG_SERIOUS, "insufficient block info cache"); - return NULL; - } - - work->block = block; - work->expired_count = dev->attr->pages_per_block; - for (i = 0; i < dev->attr->pages_per_block; i++) { - work->spares[i].expired = 1; - - // TODO: init tag - } - - work->ref_count = 1; - - _MoveBcToTail(dev, work); - - return work; -} - -/** - * \brief put block info buffer back to pool, - * should be called with #uffs_BlockInfoGet in pairs. - * \param[in] dev uffs device - * \param[in] p pointer of block info buffer - */ -void uffs_BlockInfoPut(uffs_Device *dev, uffs_BlockInfo *p) -{ - dev = dev; - if (p) - { - if (p->ref_count == 0) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Put an unused block info cache back ?"); - } - else { - p->ref_count--; - } - } -} - - -/** - * \brief make the given pages expired in given block info buffer - * \param[in] dev uffs device - * \param[in] p pointer of block info buffer - * \param[in] page given page number. - * if #UFFS_ALL_PAGES presented, all pages in the block should be made expired. - */ -void uffs_BlockInfoExpire(uffs_Device *dev, uffs_BlockInfo *p, int page) -{ - int i; - uffs_PageSpare *spare; - - if (page == UFFS_ALL_PAGES) { - for (i = 0; i < dev->attr->pages_per_block; i++) { - spare = &(p->spares[i]); - if (spare->expired == 0) { - spare->expired = 1; - p->expired_count++; - } - } - } - else { - if (page >= 0 && page < dev->attr->pages_per_block) { - spare = &(p->spares[page]); - if (spare->expired == 0) { - spare->expired = 1; - p->expired_count++; - } - } - } -} - -/** - * Is all blcok info cache free (not referenced) ? - */ -UBOOL uffs_BlockInfoIsAllFree(uffs_Device *dev) -{ - uffs_BlockInfo *work; - - work = dev->bc.head; - while (work) { - if (work->ref_count != 0) - return U_FALSE; - work = work->next; - } - - return U_TRUE; -} - -void uffs_BlockInfoExpireAll(uffs_Device *dev) -{ - uffs_BlockInfo *bc; - - bc = dev->bc.head; - while (bc) { - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); - bc = bc->next; - } - return; -} diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_buf.c b/components/dfs/filesystems/uffs/src/uffs/uffs_buf.c deleted file mode 100644 index fd646aa73..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_buf.c +++ /dev/null @@ -1,1799 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file uffs_buf.c - * \brief uffs page buffers manipulations - * \author Ricky Zheng - * \note Created in 11th May, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_buf.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_pool.h" -#include "uffs/uffs_ecc.h" -#include "uffs/uffs_badblock.h" -#include - -#define PFX "pbuf: " - - -URET _BufFlush(struct uffs_DeviceSt *dev, UBOOL force_block_recover, int slot); - - -/** - * \brief inspect (print) uffs page buffers. - * \param[in] dev uffs device to be inspected. - */ -void uffs_BufInspect(uffs_Device *dev) -{ - struct uffs_PageBufDescSt *pb = &dev->buf; - uffs_Buf *buf; - - uffs_PerrorRaw(UFFS_MSG_NORMAL, - "------------- page buffer inspect ---------" TENDSTR); - uffs_PerrorRaw(UFFS_MSG_NORMAL, "all buffers: " TENDSTR); - for (buf = pb->head; buf; buf = buf->next) { - if (buf->mark != 0) { - uffs_PerrorRaw(UFFS_MSG_NORMAL, - "\tF:%04x S:%04x P:%02d R:%02d D:%03d M:%c EM:%d" TENDSTR, - buf->parent, buf->serial, - buf->page_id, buf->ref_count, - buf->data_len, buf->mark == UFFS_BUF_VALID ? 'V' : 'D', - buf->ext_mark); - } - } - uffs_PerrorRaw(UFFS_MSG_NORMAL, - "--------------------------------------------" TENDSTR); -} - -/** - * \brief initialize page buffers for device - * in UFFS, each device has one buffer pool - * \param[in] dev uffs device - * \param[in] buf_max maximum buffer number, normally use #MAX_PAGE_BUFFERS - * \param[in] dirty_buf_max maximum dirty buffer allowed, - * if the dirty buffer over this number, - * than need to be flush to flash - */ -URET uffs_BufInit(uffs_Device *dev, int buf_max, int dirty_buf_max) -{ - void *pool; - u8 *data; - uffs_Buf *buf; - int size; - int i, slot; - - if (!dev) - return U_FAIL; - - //init device common parameters, which are needed by page buffers - dev->com.pg_size = dev->attr->page_data_size; // we use the whole page. - dev->com.header_size = sizeof(struct uffs_MiniHeaderSt); // mini header - dev->com.pg_data_size = dev->com.pg_size - dev->com.header_size; - - if (dev->buf.pool != NULL) { - uffs_Perror(UFFS_MSG_NORMAL, - "buf.pool is not NULL, buf already inited ?"); - return U_FAIL; - } - - size = (sizeof(uffs_Buf) + dev->com.pg_size) * buf_max; - if (dev->mem.pagebuf_pool_size == 0) { - if (dev->mem.malloc) { - dev->mem.pagebuf_pool_buf = dev->mem.malloc(dev, size); - if (dev->mem.pagebuf_pool_buf) - dev->mem.pagebuf_pool_size = size; - } - } - if (size > dev->mem.pagebuf_pool_size) { - uffs_Perror(UFFS_MSG_DEAD, - "page buffers require %d but only %d available.", - size, dev->mem.pagebuf_pool_size); - return U_FAIL; - } - pool = dev->mem.pagebuf_pool_buf; - - uffs_Perror(UFFS_MSG_NOISY, "alloc %d bytes.", size); - dev->buf.pool = pool; - - for (i = 0; i < buf_max; i++) { - buf = (uffs_Buf *)((u8 *)pool + (sizeof(uffs_Buf) * i)); - memset(buf, 0, sizeof(uffs_Buf)); - data = (u8 *)pool + (sizeof(uffs_Buf) * buf_max) + (dev->com.pg_size * i); - buf->header = data; - buf->data = data + dev->com.header_size; - buf->mark = UFFS_BUF_EMPTY; - memset(buf->header, 0, dev->com.pg_size); - if (i == 0) { - buf->prev = NULL; - dev->buf.head = buf; - } - else { - buf->prev = (uffs_Buf *)((u8 *)buf - sizeof(uffs_Buf)); - } - - if (i == (buf_max - 1)) { - buf->next = NULL; - dev->buf.tail = buf; - } - else { - buf->next = (uffs_Buf *)((u8 *)buf + sizeof(uffs_Buf)); - } - } - - dev->buf.buf_max = buf_max; - dev->buf.dirty_buf_max = (dirty_buf_max > dev->attr->pages_per_block ? - dev->attr->pages_per_block : dirty_buf_max); - - for (slot = 0; slot < dev->cfg.dirty_groups; slot++) { - dev->buf.dirtyGroup[slot].dirty = NULL; - dev->buf.dirtyGroup[slot].count = 0; - } - return U_SUCC; -} - -/** - * \brief flush all buffers - */ -URET uffs_BufFlushAll(struct uffs_DeviceSt *dev) -{ - int slot; - for (slot = 0; slot < dev->cfg.dirty_groups; slot++) { - if(_BufFlush(dev, FALSE, slot) != U_SUCC) { - uffs_Perror(UFFS_MSG_NORMAL, - "fail to flush buffer(slot %d)", slot); - return U_FAIL; - } - } - return U_SUCC; -} - -/** - * \brief release all page buffer, this function should be called - when unmounting a uffs device - * \param[in] dev uffs device - * \note if there are page buffers in used, it may cause fail to release - */ -URET uffs_BufReleaseAll(uffs_Device *dev) -{ - uffs_Buf *p; - - if (!dev) - return U_FAIL; - - //now release all buffer - p = dev->buf.head; - while (p) { - if (p->ref_count != 0) { - uffs_Perror(UFFS_MSG_NORMAL, PFX - "can't release buffers, parent:%d, serial:%d, \ - page_id:%d still in used.\n", - p->parent, p->serial, p->page_id); - return U_FAIL; - } - p = p->next; - } - - if (uffs_BufFlushAll(dev) != U_SUCC) { - uffs_Perror(UFFS_MSG_NORMAL, - "can't release buf, fail to flush buffer"); - return U_FAIL; - } - - if (dev->mem.free) { - dev->mem.free(dev, dev->buf.pool); - dev->mem.pagebuf_pool_size = 0; - } - - dev->buf.pool = NULL; - dev->buf.head = dev->buf.tail = NULL; - - return U_SUCC; -} - - -static void _BreakFromBufList(uffs_Device *dev, uffs_Buf *buf) -{ - if(buf->next) - buf->next->prev = buf->prev; - - if(buf->prev) - buf->prev->next = buf->next; - - if(dev->buf.head == buf) - dev->buf.head = buf->next; - - if(dev->buf.tail == buf) - dev->buf.tail = buf->prev; - -} - -static void _LinkToBufListHead(uffs_Device *dev, uffs_Buf *buf) -{ - if (buf == dev->buf.head) - return; - - buf->prev = NULL; - buf->next = dev->buf.head; - - if (dev->buf.head) - dev->buf.head->prev = buf; - - if (dev->buf.tail == NULL) - dev->buf.tail = buf; - - dev->buf.head = buf; -} - -static void _LinkToBufListTail(uffs_Device *dev, uffs_Buf *buf) -{ - if (dev->buf.tail == buf) - return; - - buf->prev = dev->buf.tail; - buf->next = NULL; - - if (dev->buf.tail) - dev->buf.tail->next = buf; - - if (dev->buf.head == NULL) - dev->buf.head = buf; - - dev->buf.tail = buf; -} - -//move a node which linked in the list to the head of list -static void _MoveNodeToHead(uffs_Device *dev, uffs_Buf *p) -{ - if (p == dev->buf.head) - return; - - //break from list - _BreakFromBufList(dev, p); - - //link to head - _LinkToBufListHead(dev, p); -} - -// check if the buf is already in dirty list -static UBOOL _IsBufInInDirtyList(uffs_Device *dev, int slot, uffs_Buf *buf) -{ - uffs_Buf *work; - work = dev->buf.dirtyGroup[slot].dirty; - while (work) { - if (work == buf) - return U_TRUE; - work = work->next_dirty; - } - - return U_FALSE; -} - -static void _LinkToDirtyList(uffs_Device *dev, int slot, uffs_Buf *buf) -{ - - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Try to insert a NULL node into dirty list ?"); - return; - } - - buf->mark = UFFS_BUF_DIRTY; - buf->prev_dirty = NULL; - buf->next_dirty = dev->buf.dirtyGroup[slot].dirty; - - if (dev->buf.dirtyGroup[slot].dirty) - dev->buf.dirtyGroup[slot].dirty->prev_dirty = buf; - - dev->buf.dirtyGroup[slot].dirty = buf; - dev->buf.dirtyGroup[slot].count++; -} - -static int CountFreeBuf(uffs_Device *dev) -{ - int count = 0; - - uffs_Buf *buf = dev->buf.head; - - while (buf) { - - if (buf->ref_count == 0 && - buf->mark != UFFS_BUF_DIRTY) - count++; - - buf = buf->next; - } - - return count; -} - -static uffs_Buf * _FindFreeBufEx(uffs_Device *dev, int clone) -{ - uffs_Buf *buf; - - if (!clone && CountFreeBuf(dev) <= CLONE_BUFFERS_THRESHOLD) - return NULL; - -#if 0 - buf = dev->buf.head; - while (buf) { - - if (buf->ref_count == 0 && - buf->mark != UFFS_BUF_DIRTY) - return buf; - - buf = buf->next; - } -#else - buf = dev->buf.tail; - while (buf) { - - if(buf->ref_count == 0 && - buf->mark != UFFS_BUF_DIRTY) - return buf; - - buf = buf->prev; - } -#endif - - return buf; -} - -static uffs_Buf * _FindFreeBuf(uffs_Device *dev) -{ - return _FindFreeBufEx(dev, 0); -} - - -/** - * load psychical page data into buf and do ecc check - * \param[in] dev uffs device - * \param[in] buf buf to be load in - * \param[in] block psychical block number - * \param[in] page psychical page number - * \return return U_SUCC if no error, - * return U_FAIL if I/O error or ecc check fail - */ -URET uffs_BufLoadPhyData(uffs_Device *dev, uffs_Buf *buf, u32 block, u32 page) -{ - int ret; - - ret = uffs_FlashReadPage(dev, block, page, buf, U_FALSE); - - if (UFFS_FLASH_HAVE_ERR(ret)) { - buf->mark = UFFS_BUF_EMPTY; - return U_FAIL; - } - else { - buf->mark = UFFS_BUF_VALID; - return U_SUCC; - } -} - -/** - * \brief load psychical page data into buf and ignore ECC result - * - * \param[in] dev uffs device - * \param[in] buf buf to be load in - * \param[in] block psychical block number - * \param[in] page psychical page number - * - * \return return U_SUCC if no error, return U_FAIL if I/O error - * \note this function should be only used when doing bad block recover. - */ -URET uffs_LoadPhyDataToBufEccUnCare(uffs_Device *dev, - uffs_Buf *buf, u32 block, u32 page) -{ - int ret; - - ret = uffs_FlashReadPage(dev, block, page, buf, U_TRUE); - - if (ret == UFFS_FLASH_IO_ERR) { - buf->mark = UFFS_BUF_EMPTY; - return U_FAIL; - } - else { - buf->mark = UFFS_BUF_VALID; - return U_SUCC; - } -} - -/** - * find a buffer in the pool - * \param[in] dev uffs device - * \param[in] start buf to search from - * \param[in] parent parent serial num - * \param[in] serial serial num - * \param[in] page_id page_id (if page_id == UFFS_ALL_PAGES then any page would match) - * \return return found buffer, return NULL if buffer not found - */ -uffs_Buf * uffs_BufFindFrom(uffs_Device *dev, uffs_Buf *start, - u16 parent, u16 serial, u16 page_id) -{ - uffs_Buf *p = start; - - while (p) { - if( p->parent == parent && - p->serial == serial && - (page_id == UFFS_ALL_PAGES || p->page_id == page_id) && - p->mark != UFFS_BUF_EMPTY) - { - //they have match one - return p; - } - p = p->next; - } - - return NULL; //buffer not found -} - -/** - * find a buffer in the pool - * \param[in] dev uffs device - * \param[in] parent parent serial num - * \param[in] serial serial num - * \param[in] page_id page_id (if page_id == UFFS_ALL_PAGES then any page would match) - * \return return found buffer, return NULL if buffer not found - */ -uffs_Buf * uffs_BufFind(uffs_Device *dev, - u16 parent, u16 serial, u16 page_id) -{ - uffs_Buf *p = dev->buf.head; - - return uffs_BufFindFrom(dev, p, parent, serial, page_id); -} - - -static uffs_Buf * _FindBufInDirtyList(uffs_Buf *dirty, u16 page_id) -{ - while(dirty) { - if (dirty->page_id == page_id) - return dirty; - dirty = dirty->next_dirty; - } - return NULL; -} - -static URET _BreakFromDirty(uffs_Device *dev, uffs_Buf *dirtyBuf) -{ - int slot = -1; - - if (dirtyBuf->mark != UFFS_BUF_DIRTY) { - uffs_Perror(UFFS_MSG_NORMAL, - "try to break a non-dirty buf from dirty list ?"); - return U_FAIL; - } - - slot = uffs_BufFindGroupSlot(dev, dirtyBuf->parent, dirtyBuf->serial); - if (slot < 0) { - uffs_Perror(UFFS_MSG_NORMAL, "no dirty list exit ?"); - return U_FAIL; - } - - // break from the link - if (dirtyBuf->next_dirty) { - dirtyBuf->next_dirty->prev_dirty = dirtyBuf->prev_dirty; - } - - if (dirtyBuf->prev_dirty) { - dirtyBuf->prev_dirty->next_dirty = dirtyBuf->next_dirty; - } - - // check if it's the link head ... - if (dev->buf.dirtyGroup[slot].dirty == dirtyBuf) { - dev->buf.dirtyGroup[slot].dirty = dirtyBuf->next_dirty; - } - - dirtyBuf->next_dirty = dirtyBuf->prev_dirty = NULL; // clear dirty link - - dev->buf.dirtyGroup[slot].count--; - - return U_SUCC; -} - -static u16 _GetDirOrFileNameSum(uffs_Device *dev, uffs_Buf *buf) -{ - u16 data_sum = 0; //default: 0 - uffs_FileInfo *fi; - - dev = dev; - //FIXME: We use the same schema for both dir and file. - if (buf->type == UFFS_TYPE_FILE || buf->type == UFFS_TYPE_DIR) { - if (buf->page_id == 0) { - fi = (uffs_FileInfo *)(buf->data); - data_sum = uffs_MakeSum16(fi->name, fi->name_len); - } - } - - return data_sum; -} - - -static URET _CheckDirtyList(uffs_Buf *dirty) -{ - u16 parent; - u16 serial; - - if (dirty == NULL) { - return U_SUCC; - } - - parent = dirty->parent; - serial = dirty->serial; - dirty = dirty->next_dirty; - - while (dirty) { - if (parent != dirty->parent || - serial != dirty->serial) { - uffs_Perror(UFFS_MSG_SERIOUS, - "parent or serial in dirty pages buffer are not the same ?"); - return U_FAIL; - } - if (dirty->mark != UFFS_BUF_DIRTY) { - uffs_Perror(UFFS_MSG_SERIOUS, - "non-dirty page buffer in dirty buffer list ?"); - return U_FAIL; - } - dirty = dirty->next_dirty; - } - return U_SUCC; -} - -/** find a page in dirty list, which has minimum page_id */ -uffs_Buf * _FindMinimunPageIdFromDirtyList(uffs_Buf *dirtyList) -{ - uffs_Buf * work = dirtyList; - uffs_Buf * buf = dirtyList; - - if (buf) { - work = work->next_dirty; - while (work) { - if (work->page_id < buf->page_id) - buf = work; - work = work->next_dirty; - } - - uffs_Assert(buf->mark == UFFS_BUF_DIRTY, - "buf (serial = %d, parent = %d, page_id = %d, type = %d) in dirty list but mark is 0x%x ?", - buf->serial, buf->parent, buf->page_id, buf->type, buf->mark); - } - - return buf; -} - - -/** - * \brief flush buffer with block recover - * - * Scenario: - * 1. get a free (erased) block --> newNode
- * 2. copy from old block ---> oldNode, or copy from dirty list,
- * sorted by page_id, to new block. Skips the invalid pages when copy pages.
- * 3. erased old block. set new info to oldNode, set newNode->block = old block,
- * and put newNode to erased list.
- * \note IT'S IMPORTANT TO KEEP OLD NODE IN THE LIST, - * so you don't need to update the obj->node :-) - */ -static URET uffs_BufFlush_Exist_With_BlockCover( - uffs_Device *dev, - int slot, //!< dirty group slot - TreeNode *node, //!< old data node on tree - uffs_BlockInfo *bc //!< old data block info - ) -{ - u16 i; - u8 type, timeStamp; - u16 page, parent, serial; - uffs_Buf *buf; - TreeNode *newNode; - uffs_BlockInfo *newBc; - uffs_Tags *tag, *oldTag; - int x; - u16 newBlock; - UBOOL succRecover; //U_TRUE: recover successful, erase old block, - //U_FALSE: fail to recover, erase new block - UBOOL flash_op_err; - u16 data_sum = 0xFFFF; - - UBOOL useCloneBuf; - - type = dev->buf.dirtyGroup[slot].dirty->type; - parent = dev->buf.dirtyGroup[slot].dirty->parent; - serial = dev->buf.dirtyGroup[slot].dirty->serial; - -retry: - uffs_BlockInfoLoad(dev, bc, UFFS_ALL_PAGES); - - flash_op_err = UFFS_FLASH_NO_ERR; - succRecover = U_FALSE; - - newNode = uffs_TreeGetErasedNode(dev); - if (newNode == NULL) { - uffs_Perror(UFFS_MSG_NOISY, "no enough erased block!"); - goto ext; - } - newBlock = newNode->u.list.block; - newBc = uffs_BlockInfoGet(dev, newBlock); - if (newBc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "get block info fail!"); - uffs_InsertToErasedListHead(dev, newNode); //put node back to erased list - //because it doesn't use, so put to head - goto ext; - } - - //uffs_Perror(UFFS_MSG_NOISY, "flush buffer with block cover to %d", newBlock); - -#if 0 - // this assert seems not necessary ... - if (!uffs_Assert(newBc->expired_count == dev->attr->pages_per_block, - "We have block cache for erased block ? expired_count = %d, block = %d\n", - newBc->expired_count, newBc->block)) { - uffs_BlockInfoExpire(dev, newBc, UFFS_ALL_PAGES); - } -#endif - - uffs_BlockInfoLoad(dev, newBc, UFFS_ALL_PAGES); - timeStamp = uffs_GetNextBlockTimeStamp(uffs_GetBlockTimeStamp(dev, bc)); - -// uffs_Perror(UFFS_MSG_NOISY, "Flush buffers with Block Recover, from %d to %d", -// bc->block, newBc->block); - - for (i = 0; i < dev->attr->pages_per_block; i++) { - tag = GET_TAG(newBc, i); - TAG_DIRTY_BIT(tag) = TAG_DIRTY; - TAG_VALID_BIT(tag) = TAG_VALID; - TAG_BLOCK_TS(tag) = timeStamp; - TAG_PARENT(tag) = parent; - TAG_SERIAL(tag) = serial; - TAG_TYPE(tag) = type; - TAG_PAGE_ID(tag) = (u8)(i & 0xFF); // now, page_id = page. - // FIX ME!! if more than 256 pages in a block - - SEAL_TAG(tag); - - buf = _FindBufInDirtyList(dev->buf.dirtyGroup[slot].dirty, i); - if (buf != NULL) { - if (i == 0) - data_sum = _GetDirOrFileNameSum(dev, buf); - - TAG_DATA_LEN(tag) = buf->data_len; - - if (buf->data_len == 0 || (buf->ext_mark & UFFS_BUF_EXT_MARK_TRUNC_TAIL)) { // this only happen when truncating a file - - // when truncating a file, the last dirty buf will be - // set as UFFS_BUF_EXT_MARK_TAIL. so that we don't do page recovery - // for the rest pages in the block. (file is ended at this page) - - if (!uffs_Assert((buf->ext_mark & UFFS_BUF_EXT_MARK_TRUNC_TAIL) != 0, - "buf->data == 0 but not the last page of truncating ? block = %d, page_id = %d", - bc->block, i)) { - - // We can't do more about it for now ... - } - - if (buf->data_len > 0) { - flash_op_err = uffs_FlashWritePageCombine(dev, newBlock, i, buf, tag); - } - else { - // data_len == 0, no I/O needed. - flash_op_err = UFFS_FLASH_NO_ERR; - } - succRecover = U_TRUE; - break; - } - else - flash_op_err = uffs_FlashWritePageCombine(dev, newBlock, i, buf, tag); - - if (flash_op_err != UFFS_FLASH_NO_ERR) { - if (flash_op_err == UFFS_FLASH_BAD_BLK) { - uffs_Perror(UFFS_MSG_NORMAL, - "new bad block %d discovered.", newBlock); - break; - } - else if (flash_op_err == UFFS_FLASH_IO_ERR) { - uffs_Perror(UFFS_MSG_NORMAL, - "writing to block %d page %d, I/O error ?", - (int)newBlock, (int)i); - break; - } - else { - uffs_Perror(UFFS_MSG_SERIOUS, "Unhandled flash op result: %d", flash_op_err); - break; - } - } - } - else { - page = uffs_FindPageInBlockWithPageId(dev, bc, i); - if (page == UFFS_INVALID_PAGE) { - succRecover = U_TRUE; - break; //end of last page, normal break - } - page = uffs_FindBestPageInBlock(dev, bc, page); - - if (!uffs_Assert(page != UFFS_INVALID_PAGE, "got an invalid page ?\n")) - break; - - oldTag = GET_TAG(bc, page); - - // First, try to find existing cached buffer. - // Note: do not call uffs_BufGetEx() as it may trigger buf flush and result in infinite loop - buf = uffs_BufGet(dev, parent, serial, i); - - if (buf == NULL) { // no cached page buffer, use clone buffer. - useCloneBuf = U_TRUE; - buf = uffs_BufClone(dev, NULL); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't clone a new buf!"); - break; - } - x = uffs_BufLoadPhyData(dev, buf, bc->block, page); - if (x == U_FAIL) { - if (HAVE_BADBLOCK(dev) && dev->bad.block == bc->block) { - // the old block is a bad block, we'll process it later. - uffs_Perror(UFFS_MSG_SERIOUS, - "the old block %d is a bad block, \ - but ignore it for now.", - bc->block); - } - else { - uffs_Perror(UFFS_MSG_SERIOUS, "I/O error ?"); - uffs_BufFreeClone(dev, buf); - flash_op_err = UFFS_FLASH_IO_ERR; - break; - } - } - - buf->type = type; - buf->parent = parent; - buf->serial = serial; - buf->page_id = TAG_PAGE_ID(oldTag); - buf->data_len = TAG_DATA_LEN(oldTag); - - } - else { - useCloneBuf = U_FALSE; - - uffs_Assert(buf->page_id == TAG_PAGE_ID(oldTag), "buf->page_id = %d, tag page id: %d", buf->page_id, TAG_PAGE_ID(oldTag)); - uffs_Assert(buf->data_len == TAG_DATA_LEN(oldTag), "buf->data_len = %d, tag data len: %d", buf->data_len, TAG_DATA_LEN(oldTag)); - } - - if (buf->data_len > dev->com.pg_data_size) { - uffs_Perror(UFFS_MSG_NOISY, "data length over flow, truncated !"); - buf->data_len = dev->com.pg_data_size; - } - - if (!uffs_Assert(buf->data_len != 0, "data_len == 0 ? block %d, page %d, serial %d, parent %d", - bc->block, page, buf->serial, buf->parent)) { - // this could be some error on flash ? we can't do more about it for now ... - } - - TAG_DATA_LEN(tag) = buf->data_len; - - if (i == 0) - data_sum = _GetDirOrFileNameSum(dev, buf); - - flash_op_err = uffs_FlashWritePageCombine(dev, newBlock, i, buf, tag); - - if (buf) { - if (useCloneBuf) - uffs_BufFreeClone(dev, buf); - else - uffs_BufPut(dev, buf); - } - - if (flash_op_err == UFFS_FLASH_BAD_BLK) { - uffs_Perror(UFFS_MSG_NORMAL, - "new bad block %d discovered.", newBlock); - break; - } - else if (flash_op_err == UFFS_FLASH_IO_ERR) { - uffs_Perror(UFFS_MSG_NORMAL, "I/O error ?", newBlock); - break; - } - } - } //end of for - - if (i == dev->attr->pages_per_block) - succRecover = U_TRUE; - else { - // expire last page info cache in case the 'tag' is not written. - uffs_BlockInfoExpire(dev, newBc, i); - } - - if (flash_op_err == UFFS_FLASH_BAD_BLK) { - uffs_BlockInfoExpire(dev, newBc, UFFS_ALL_PAGES); - uffs_BlockInfoPut(dev, newBc); - if (newNode->u.list.block == dev->bad.block) { - // the recovered block is a BAD block (buy me a lotto, please :-), we need to - // deal with it immediately (mark it as 'bad' and put into bad block list). - uffs_BadBlockProcess(dev, newNode); - } - - uffs_Perror(UFFS_MSG_NORMAL, "Retry block cover ..."); - - goto retry; // retry on a new erased block ... - } - - if (succRecover == U_TRUE) { - // now it's time to clean the dirty buffers - for (i = 0; i < dev->attr->pages_per_block; i++) { - buf = _FindBufInDirtyList(dev->buf.dirtyGroup[slot].dirty, i); - if (buf) { - if (_BreakFromDirty(dev, buf) == U_SUCC) { - buf->mark = UFFS_BUF_VALID; - buf->ext_mark &= ~UFFS_BUF_EXT_MARK_TRUNC_TAIL; - _MoveNodeToHead(dev, buf); - } - } - } - - // swap the old block node and new block node. - // it's important that we 'swap' the block and keep the node unchanged - // so that allowing someone hold the node pointer unawared. - switch (type) { - case UFFS_TYPE_DIR: - node->u.dir.parent = parent; - node->u.dir.serial = serial; - node->u.dir.block = newBlock; - node->u.dir.checksum = data_sum; - break; - case UFFS_TYPE_FILE: - node->u.file.parent = parent; - node->u.file.serial = serial; - node->u.file.block = newBlock; - node->u.file.checksum = data_sum; - break; - case UFFS_TYPE_DATA: - node->u.data.parent = parent; - node->u.data.serial = serial; - node->u.data.block = newBlock; - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "UNKNOW TYPE"); - break; - } - - newNode->u.list.block = bc->block; - - // if the recovered block is a bad block, it's time to process it. - if (HAVE_BADBLOCK(dev) && dev->bad.block == newNode->u.list.block) { - //uffs_Perror(UFFS_MSG_SERIOUS, "Still have bad block ?"); - uffs_BadBlockProcess(dev, newNode); - } - else { - // erase recovered block, put it back to erased block list. - if (uffs_IsThisBlockUsed(dev, bc)) { - uffs_FlashEraseBlock(dev, bc->block); - } - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, newNode); - else - uffs_TreeInsertToErasedListTail(dev, newNode); - } - } - else { - - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); // FIXME: this might not be necessary ... - - uffs_FlashEraseBlock(dev, newBlock); - newNode->u.list.block = newBlock; - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, newNode); - else - uffs_TreeInsertToErasedListTail(dev, newNode); - } - - if (dev->buf.dirtyGroup[slot].dirty != NULL || - dev->buf.dirtyGroup[slot].count != 0) { - uffs_Perror(UFFS_MSG_NORMAL, "still have dirty buffer ?"); - } - - uffs_BlockInfoPut(dev, newBc); - -ext: - return (succRecover == U_TRUE ? U_SUCC : U_FAIL); - -} - - - -/** - * \brief flush buffer to a new block which is not registered in tree - * - * Scenario: - * 1. get a new block - * 2. write pages in dirty list to new block, sorted by page_id - * 3. insert new block to tree - */ -static URET _BufFlush_NewBlock(uffs_Device *dev, int slot) -{ - u8 type; - TreeNode *node; - uffs_BlockInfo *bc; - URET ret; - - ret = U_FAIL; - - node = uffs_TreeGetErasedNode(dev); - if (node == NULL) { - uffs_Perror(UFFS_MSG_NOISY, "no erased block!"); - goto ext; - } - bc = uffs_BlockInfoGet(dev, node->u.list.block); - if (bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "get block info fail!"); - uffs_InsertToErasedListHead(dev, node); //put node back to erased list - goto ext; - } - - type = dev->buf.dirtyGroup[slot].dirty->type; - - ret = uffs_BufFlush_Exist_With_BlockCover(dev, slot, node, bc); - - if (ret == U_SUCC) - uffs_InsertNodeToTree(dev, type, node); - else { - uffs_FlashEraseBlock(dev, bc->block); - uffs_TreeInsertToErasedListTail(dev, node); - } - - uffs_BlockInfoPut(dev, bc); -ext: - return ret; -} - - -/** - * \brief flush buffer to a block with enough free pages - * - * pages in dirty list must be sorted by page_id to write to flash - */ -static -URET - uffs_BufFlush_Exist_With_Enough_FreePage( - uffs_Device *dev, - int slot, //!< dirty group slot - TreeNode *node, //!< tree node - uffs_BlockInfo *bc //!< block info (Source, also destination) - ) -{ - u16 page; - uffs_Buf *buf; - uffs_Tags *tag; - URET ret = U_FAIL; - int x; - -// uffs_Perror(UFFS_MSG_NOISY, -// "Flush buffers with Enough Free Page to block %d", -// bc->block); - - for (page = 1; // page 0 won't be a free page, so we start from 1. - page < dev->attr->pages_per_block && - dev->buf.dirtyGroup[slot].count > 0; //still has dirty pages? - page++) { - - // locate to the free page (make sure the page is a erased page, so an unclean page won't sneak in) - for (; page < dev->attr->pages_per_block; page++) { - if (uffs_IsPageErased(dev, bc, page)) - break; - } - - if (!uffs_Assert(page < dev->attr->pages_per_block, "no free page? buf flush not finished.")) - break; - - buf = _FindMinimunPageIdFromDirtyList(dev->buf.dirtyGroup[slot].dirty); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "count > 0, but no dirty pages in list ?"); - goto ext; - } - - //write the dirty page (id: buf->page_id) to page (free page) - tag = GET_TAG(bc, page); - TAG_DIRTY_BIT(tag) = TAG_DIRTY; - TAG_VALID_BIT(tag) = TAG_VALID; - TAG_BLOCK_TS(tag) = uffs_GetBlockTimeStamp(dev, bc); - TAG_DATA_LEN(tag) = buf->data_len; - TAG_TYPE(tag) = buf->type; - TAG_PARENT(tag) = buf->parent; - TAG_SERIAL(tag) = buf->serial; - TAG_PAGE_ID(tag) = (u8)(buf->page_id); - - SEAL_TAG(tag); - - x = uffs_FlashWritePageCombine(dev, bc->block, page, buf, tag); - if (x == UFFS_FLASH_IO_ERR) { - uffs_Perror(UFFS_MSG_NORMAL, "I/O error <1>?"); - goto ext; - } - else if (x == UFFS_FLASH_BAD_BLK) { - uffs_Perror(UFFS_MSG_NORMAL, "Bad blcok found, start block cover ..."); - ret = uffs_BufFlush_Exist_With_BlockCover(dev, slot, node, bc); - goto ext; - } - else { - if(_BreakFromDirty(dev, buf) == U_SUCC) { - buf->mark = UFFS_BUF_VALID; - _MoveNodeToHead(dev, buf); - } - } - } //end of for - - if (dev->buf.dirtyGroup[slot].dirty != NULL || - dev->buf.dirtyGroup[slot].count != 0) { - uffs_Perror(UFFS_MSG_NORMAL, "still has dirty buffer ?"); - } - else { - ret = U_SUCC; - } - -ext: - return ret; -} - - -URET _BufFlush(struct uffs_DeviceSt *dev, - UBOOL force_block_recover, int slot) -{ - uffs_Buf *dirty; - TreeNode *node; - uffs_BlockInfo *bc; - u16 n; - URET ret; - u8 type; - u16 parent; - u16 serial; - int block; - - if (dev->buf.dirtyGroup[slot].count == 0) { - return U_SUCC; - } - - dirty = dev->buf.dirtyGroup[slot].dirty; - - if (_CheckDirtyList(dirty) == U_FAIL) - return U_FAIL; - - type = dirty->type; - parent = dirty->parent; - serial = dirty->serial; - - switch (type) { - case UFFS_TYPE_DIR: - node = uffs_TreeFindDirNode(dev, serial); - break; - case UFFS_TYPE_FILE: - node = uffs_TreeFindFileNode(dev, serial); - break; - case UFFS_TYPE_DATA: - node = uffs_TreeFindDataNode(dev, parent, serial); - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "unknown type"); - return U_FAIL; - } - - if (node == NULL) { - //not found in the tree, need to generate a new block - ret = _BufFlush_NewBlock(dev, slot); - } - else { - switch (type) { - case UFFS_TYPE_DIR: - block = node->u.dir.block; - break; - case UFFS_TYPE_FILE: - block = node->u.file.block; - break; - case UFFS_TYPE_DATA: - block = node->u.data.block; - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "unknown type."); - return U_FAIL; - } - bc = uffs_BlockInfoGet(dev, block); - if(bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "get block info fail."); - return U_FAIL; - } - - ret = uffs_BlockInfoLoad(dev, bc, UFFS_ALL_PAGES); - if (ret == U_SUCC) { - - n = uffs_GetFreePagesCount(dev, bc); - - if (n >= dev->buf.dirtyGroup[slot].count && !force_block_recover) { - //The free pages are enough for the dirty pages - ret = uffs_BufFlush_Exist_With_Enough_FreePage(dev, slot, node, bc); - } - else { - ret = uffs_BufFlush_Exist_With_BlockCover(dev, slot, node, bc); - } - } - uffs_BlockInfoPut(dev, bc); - } - - return ret; -} - -static int _FindMostDirtyGroup(struct uffs_DeviceSt *dev) -{ - int i, slot = -1; - int max_count = 0; - - for (i = 0; i < dev->cfg.dirty_groups; i++) { - if (dev->buf.dirtyGroup[i].dirty && - dev->buf.dirtyGroup[i].lock == 0) { - if (dev->buf.dirtyGroup[i].count > max_count) { - max_count = dev->buf.dirtyGroup[i].count; - slot = i; - } - } - } - - return slot; -} - -/** lock dirty group */ -URET uffs_BufLockGroup(struct uffs_DeviceSt *dev, int slot) -{ - URET ret = U_FAIL; - if (slot >= 0 && slot < dev->cfg.dirty_groups) { - dev->buf.dirtyGroup[slot].lock++; - ret = U_SUCC; - } - return ret; -} - -/** unlock dirty group */ -URET uffs_BufUnLockGroup(struct uffs_DeviceSt *dev, int slot) -{ - URET ret = U_FAIL; - - if (slot >= 0 && slot < dev->cfg.dirty_groups) { - if (dev->buf.dirtyGroup[slot].lock > 0) - dev->buf.dirtyGroup[slot].lock--; - else { - uffs_Perror(UFFS_MSG_SERIOUS, "Try to unlock an unlocked group ?"); - } - ret = U_SUCC; - } - return ret; -} - - -/** - * flush buffers to flash. - * this will flush all dirty groups. - * \param[in] dev uffs device - */ -URET uffs_BufFlush(struct uffs_DeviceSt *dev) -{ - int slot; - - slot = uffs_BufFindFreeGroupSlot(dev); - if (slot >= 0) - return U_SUCC; // do nothing if there is free slot - else - return uffs_BufFlushMostDirtyGroup(dev); -} - -/** - * flush most dirty group - * \param[in] dev uffs device - */ -URET uffs_BufFlushMostDirtyGroup(struct uffs_DeviceSt *dev) -{ - int slot; - - slot = _FindMostDirtyGroup(dev); - if (slot >= 0) { - return _BufFlush(dev, U_FALSE, slot); - } - return U_SUCC; -} - -/** - * flush buffers to flash - * this will pick up a most dirty group, - * and flush it if there is no free dirty group slot. - * - * \param[in] dev uffs device - * \param[in] force_block_recover #U_TRUE: force a block recover - * even there are enough free pages - */ -URET uffs_BufFlushEx(struct uffs_DeviceSt *dev, UBOOL force_block_recover) -{ - int slot; - - slot = uffs_BufFindFreeGroupSlot(dev); - if (slot >= 0) { - return U_SUCC; //there is free slot, do nothing. - } - else { - slot = _FindMostDirtyGroup(dev); - return _BufFlush(dev, force_block_recover, slot); - } -} - -/** - * flush buffer group with given parent/serial num. - * - * \param[in] dev uffs device - * \param[in] parent parent num of the group - * \param[in] serial serial num of the group - */ -URET uffs_BufFlushGroup(struct uffs_DeviceSt *dev, u16 parent, u16 serial) -{ - int slot; - - slot = uffs_BufFindGroupSlot(dev, parent, serial); - if (slot >= 0) { - return _BufFlush(dev, U_FALSE, slot); - } - - return U_SUCC; -} - -/** - * flush buffer group with given parent/serial num - * and force_block_recover indicator. - * - * \param[in] dev uffs device - * \param[in] parent parent num of the group - * \param[in] serial serial num of group - * \param[in] force_block_recover indicator - */ -URET uffs_BufFlushGroupEx(struct uffs_DeviceSt *dev, - u16 parent, u16 serial, UBOOL force_block_recover) -{ - int slot; - - slot = uffs_BufFindGroupSlot(dev, parent, serial); - if (slot >= 0) { - return _BufFlush(dev, force_block_recover, slot); - } - - return U_SUCC; -} - - -/** - * flush buffer group/groups which match given parent num. - * - * \param[in] dev uffs device - * \param[in] parent parent num of the group - * \param[in] serial serial num of group - * \param[in] force_block_recover indicator - */ -URET uffs_BufFlushGroupMatchParent(struct uffs_DeviceSt *dev, u16 parent) -{ - int slot; - uffs_Buf *buf; - URET ret = U_SUCC; - - for (slot = 0; slot < dev->cfg.dirty_groups && ret == U_SUCC; slot++) { - if (dev->buf.dirtyGroup[slot].dirty) { - buf = dev->buf.dirtyGroup[slot].dirty; - if (buf->parent == parent) { - ret = _BufFlush(dev, U_FALSE, slot); - } - } - } - - return ret; -} - -/** - * find a free dirty group slot - * - * \param[in] dev uffs device - * \return slot index (0 to MAX_DIRTY_BUF_GROUPS - 1) if found one, - * otherwise return -1. - */ -int uffs_BufFindFreeGroupSlot(struct uffs_DeviceSt *dev) -{ - int i, slot = -1; - - for (i = 0; i < dev->cfg.dirty_groups; i++) { - if (dev->buf.dirtyGroup[i].dirty == NULL) { - slot = i; - break; - } - } - return slot; -} - -/** - * find a dirty group slot with given parent/serial num. - * - * \param[in] dev uffs device - * \param[in] parent parent num of the group - * \param[in] serial serial num of group - * \return slot index (0 to MAX_DIRTY_BUF_GROUPS - 1) if found one, - * otherwise return -1. - */ -int uffs_BufFindGroupSlot(struct uffs_DeviceSt *dev, u16 parent, u16 serial) -{ - uffs_Buf *buf; - int i, slot = -1; - - for (i = 0; i < dev->cfg.dirty_groups; i++) { - if (dev->buf.dirtyGroup[i].dirty) { - buf = dev->buf.dirtyGroup[i].dirty; - if (buf->parent == parent && buf->serial == serial) { - slot = i; - break; - } - } - } - return slot; -} - -/** - * \brief get a page buffer - * \param[in] dev uffs device - * \param[in] parent parent serial num - * \param[in] serial serial num - * \param[in] page_id page_id - * \return return the buffer found in buffer list, if not found, return NULL. - */ -uffs_Buf * uffs_BufGet(struct uffs_DeviceSt *dev, - u16 parent, u16 serial, u16 page_id) -{ - uffs_Buf *p; - - //first, check whether the buffer exist in buf list ? - p = uffs_BufFind(dev, parent, serial, page_id); - - if (p) { - p->ref_count++; - _MoveNodeToHead(dev, p); - } - - return p; -} - -/** - * New generate a buffer - */ -uffs_Buf *uffs_BufNew(struct uffs_DeviceSt *dev, - u8 type, u16 parent, u16 serial, u16 page_id) -{ - uffs_Buf *buf; - - buf = uffs_BufGet(dev, parent, serial, page_id); - if (buf) { - if (buf->ref_count > 1) { - uffs_Perror(UFFS_MSG_SERIOUS, "When create new buf, \ - an exist buffer has ref count %d, possibly bug!", - buf->ref_count); - } - else { - buf->data_len = 0; - } - _MoveNodeToHead(dev, buf); - return buf; - } - - buf = _FindFreeBuf(dev); - if (buf == NULL) { - uffs_BufFlushMostDirtyGroup(dev); - buf = _FindFreeBuf(dev); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "no free page buf!"); - return NULL; - } - } - - buf->mark = UFFS_BUF_EMPTY; - buf->type = type; - buf->parent = parent; - buf->serial = serial; - buf->page_id = page_id; - buf->data_len = 0; - buf->ref_count++; - memset(buf->data, 0xff, dev->com.pg_data_size); - - _MoveNodeToHead(dev, buf); - - return buf; -} - - - -/** - * get a page buffer - * \param[in] dev uffs device - * \param[in] type dir, file or data ? - * \param[in] node node on the tree - * \param[in] page_id page_id - * \param[in] oflag the open flag of current file/dir object - * \return return the buffer if found in buffer list, if not found in - * buffer list, it will get a free buffer, and load data from flash. - * return NULL if not free buffer. - */ -uffs_Buf *uffs_BufGetEx(struct uffs_DeviceSt *dev, - u8 type, TreeNode *node, u16 page_id, int oflag) -{ - uffs_Buf *buf; - u16 parent, serial, block, page; - uffs_BlockInfo *bc; - - switch (type) { - case UFFS_TYPE_DIR: - parent = node->u.dir.parent; - serial = node->u.dir.serial; - block = node->u.dir.block; - break; - case UFFS_TYPE_FILE: - parent = node->u.file.parent; - serial = node->u.file.serial; - block = node->u.file.block; - break; - case UFFS_TYPE_DATA: - parent = node->u.data.parent; - serial = node->u.data.serial; - block = node->u.data.block; - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "unknown type"); - return NULL; - } - - buf = uffs_BufFind(dev, parent, serial, page_id); - if (buf) { - buf->ref_count++; - return buf; - } - - buf = _FindFreeBuf(dev); - if (buf == NULL) { - uffs_BufFlushMostDirtyGroup(dev); - buf = _FindFreeBuf(dev); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "no free page buf!"); - return NULL; - } - - /* Note: if uffs_BufFlushMostDirtyGroup() flush the same block as we'll write to, - * the block will be changed to a new one! (and the content of 'node' is changed). - * So here we need to update block number from the new 'node'. - */ - switch (type) { - case UFFS_TYPE_DIR: - block = node->u.dir.block; - break; - case UFFS_TYPE_FILE: - block = node->u.file.block; - break; - case UFFS_TYPE_DATA: - block = node->u.data.block; - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "unknown type"); - return NULL; - } - } - - bc = uffs_BlockInfoGet(dev, block); - if (bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't get block info!"); - return NULL; - } - - page = uffs_FindPageInBlockWithPageId(dev, bc, page_id); - if (page == UFFS_INVALID_PAGE) { - uffs_BlockInfoPut(dev, bc); - uffs_Perror(UFFS_MSG_SERIOUS, "can't find right page ? block %d page_id %d", bc->block, page_id); - return NULL; - } - page = uffs_FindBestPageInBlock(dev, bc, page); - if (!uffs_Assert(page != UFFS_INVALID_PAGE, "got an invalid page?\n")) - return NULL; - - uffs_BlockInfoPut(dev, bc); - - buf->mark = UFFS_BUF_EMPTY; - buf->type = type; - buf->parent = parent; - buf->serial = serial; - buf->page_id = page_id; - - if (UFFS_FLASH_HAVE_ERR(uffs_FlashReadPage(dev, block, page, buf, oflag & UO_NOECC ? U_TRUE : U_FALSE))) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't load page from flash !"); - return NULL; - } - - buf->data_len = TAG_DATA_LEN(GET_TAG(bc, page)); - buf->mark = UFFS_BUF_VALID; - buf->ref_count++; - - _MoveNodeToHead(dev, buf); - - return buf; - -} - -/** - * \brief Put back a page buffer, make reference count decrease by one - * \param[in] dev uffs device - * \param[in] buf buffer to be put back - */ -URET uffs_BufPut(uffs_Device *dev, uffs_Buf *buf) -{ - URET ret = U_FAIL; - - dev = dev; - if (buf == NULL) { - uffs_Perror(UFFS_MSG_NORMAL, "Can't put an NULL buffer!"); - } - else if (buf->ref_count == 0) { - uffs_Perror(UFFS_MSG_NORMAL, "Putting an unused page buffer ? "); - } - else if (buf->ref_count == CLONE_BUF_MARK) { - uffs_Perror(UFFS_MSG_NORMAL, "Putting an cloned page buffer ? "); - ret = uffs_BufFreeClone(dev, buf); - } - else { - buf->ref_count--; - ret = U_SUCC; - } - - return ret; -} - - -/** - * \brief clone from an exist buffer. - allocate memory for new buffer, and copy data from original buffer if - original buffer is not NULL. - * \param[in] dev uffs device - * \param[in] buf page buffer to be clone from. - * if NULL presented here, data copy will not be processed - * \return return the cloned page buffer, all data copied from source - * \note the cloned buffer is not linked in page buffer list in uffs device, - * so you should use #uffs_BufFreeClone instead of #uffs_BufPut - * when you put back or release buffer - */ -uffs_Buf * uffs_BufClone(uffs_Device *dev, uffs_Buf *buf) -{ - uffs_Buf *p; - - p = _FindFreeBufEx(dev, 1); - if (p == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "no enough free pages for clone! " \ - "Please increase Clone Buffer Count threshold."); - } - else { - _BreakFromBufList(dev, p); - - if (buf) { - p->parent = buf->parent; - p->type = buf->type; - p->serial = buf->serial; - p->page_id = buf->page_id; - - p->data_len = buf->data_len; - //athough the valid data length is .data_len, - //but we still need copy the whole buffer, include header - memcpy(p->header, buf->header, dev->com.pg_size); - } - p->next = p->prev = NULL; // the cloned one is not linked to device buffer - p->next_dirty = p->prev_dirty = NULL; - p->ref_count = CLONE_BUF_MARK; // CLONE_BUF_MARK indicates that - // this is an cloned buffer - } - - return p; -} - -/** - * \brief release cloned buffer - * \param[in] dev uffs device - * \param[in] buf cloned buffer - */ -URET uffs_BufFreeClone(uffs_Device *dev, uffs_Buf *buf) -{ - dev = dev; //make compiler happy - if (!buf) - return U_FAIL; - - if (buf->ref_count != CLONE_BUF_MARK) { - /* a cloned buffer must have a ref_count of CLONE_BUF_MARK */ - uffs_Perror(UFFS_MSG_SERIOUS, - "Try to release a non-cloned page buffer ?"); - return U_FAIL; - } - - buf->ref_count = 0; - buf->mark = UFFS_BUF_EMPTY; - _LinkToBufListTail(dev, buf); - - return U_SUCC; -} - - - -UBOOL uffs_BufIsAllFree(struct uffs_DeviceSt *dev) -{ - uffs_Buf *buf = dev->buf.head; - - while (buf) { - if(buf->ref_count != 0) return U_FALSE; - buf = buf->next; - } - - return U_TRUE; -} - -UBOOL uffs_BufIsAllEmpty(struct uffs_DeviceSt *dev) -{ - uffs_Buf *buf = dev->buf.head; - - while (buf) { - if(buf->mark != UFFS_BUF_EMPTY) return U_FALSE; - buf = buf->next; - } - - return U_TRUE; -} - - -URET uffs_BufSetAllEmpty(struct uffs_DeviceSt *dev) -{ - uffs_Buf *buf = dev->buf.head; - - while (buf) { - buf->mark = UFFS_BUF_EMPTY; - buf = buf->next; - } - return U_SUCC; -} - - -void uffs_BufIncRef(uffs_Buf *buf) -{ - buf->ref_count++; -} - -void uffs_BufDecRef(uffs_Buf *buf) -{ - if (buf->ref_count > 0) - buf->ref_count--; -} - -/** mark buffer as #UFFS_BUF_EMPTY if ref_count == 0, - and discard all data it holds */ -void uffs_BufMarkEmpty(uffs_Device *dev, uffs_Buf *buf) -{ - if (buf->mark != UFFS_BUF_EMPTY) { - if (buf->ref_count == 0) { - if (buf->mark == UFFS_BUF_DIRTY) - _BreakFromDirty(dev, buf); - buf->mark = UFFS_BUF_EMPTY; - } - } -} - -#if 0 -static UBOOL _IsBufInDirtyList(struct uffs_DeviceSt *dev, uffs_Buf *buf) -{ - uffs_Buf *p = dev->buf.dirtyGroup[slot].dirty; - - while (p) { - if(p == buf) return U_TRUE; - p = p->next_dirty; - } - - return U_FALSE; -} -#endif - -URET uffs_BufWrite(struct uffs_DeviceSt *dev, - uffs_Buf *buf, void *data, u32 ofs, u32 len) -{ - int slot; - - if(ofs + len > dev->com.pg_data_size) { - uffs_Perror(UFFS_MSG_SERIOUS, - "data length out of range! %d+%d", ofs, len); - return U_FAIL; - } - - slot = uffs_BufFindGroupSlot(dev, buf->parent, buf->serial); - - if (slot < 0) { - // need to take a free slot - slot = uffs_BufFindFreeGroupSlot(dev); - if (slot < 0) { - // no free slot ? flush buffer - if (uffs_BufFlushMostDirtyGroup(dev) != U_SUCC) - return U_FAIL; - - slot = uffs_BufFindFreeGroupSlot(dev); - if (slot < 0) { - // still no free slot ?? - uffs_Perror(UFFS_MSG_SERIOUS, "no free slot ?"); - return U_FAIL; - } - } - } - - if (data) - memcpy(buf->data + ofs, data, len); - else - memset(buf->data + ofs, 0, len); // if data == NULL, then fill all '\0'. - - if (ofs + len > buf->data_len) - buf->data_len = ofs + len; - - if (_IsBufInInDirtyList(dev, slot, buf) == U_FALSE) { - _LinkToDirtyList(dev, slot, buf); - } - - if (dev->buf.dirtyGroup[slot].count >= dev->buf.dirty_buf_max) { - if (uffs_BufFlushGroup(dev, buf->parent, buf->serial) != U_SUCC) { - return U_FAIL; - } - } - - return U_SUCC; -} - -URET uffs_BufRead(struct uffs_DeviceSt *dev, - uffs_Buf *buf, void *data, u32 ofs, u32 len) -{ - u32 readSize; - u32 pg_data_size = dev->com.pg_data_size; - - readSize = (ofs >= pg_data_size ? - 0 : (ofs + len >= pg_data_size ? pg_data_size - ofs : len) - ); - - if (readSize > 0) - memcpy(data, buf->data + ofs, readSize); - - return U_SUCC; -} - - - - - - - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_crc.c b/components/dfs/filesystems/uffs/src/uffs/uffs_crc.c deleted file mode 100644 index 0ef95bf7f..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_crc.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ -/** - * \file uffs_crc.c - * \brief simple CRC functions - * \author Ricky Zheng - * \note Created in 23 Nov, 2011 - */ - -#include "uffs/uffs_crc.h" - -/* CRC16 Table */ -static const u16 CRC16_TBL[256] = { - 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, - 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, - 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, - 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, - 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, - 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, - 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, - 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, - 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, - 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, - 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, - 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, - 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, - 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, - 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, - 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, - 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, - 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, - 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, - 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, - 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, - 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, - 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, - 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, - 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, - 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, - 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, - 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, - 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, - 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, - 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, - 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 -}; - -#define CRC16(v, x) v = ((v) >> 8) ^ CRC16_TBL[((v) ^ (x)) & 0x00ff] - -u16 uffs_crc16update(const void *data, int length, u16 crc) -{ - int i; - const u8 *p = (const u8 *)data; - for (i = 0; i < length; i++, p++) { - CRC16(crc, *p); - } - - return crc; -} - -u16 uffs_crc16sum(const void *data, int length) -{ - return uffs_crc16update(data, length, 0xFFFF); -} diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_debug.c b/components/dfs/filesystems/uffs/src/uffs/uffs_debug.c deleted file mode 100644 index 5f6c1558e..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_debug.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_debug.c - * \brief output debug messages - * \author Ricky Zheng, created 10th May, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" - -#if !defined(RT_THREAD) -#include -#include -#include - -#define MAX_DEBUG_MSG_LINE_LENGTH 128 - -static struct uffs_DebugMsgOutputSt * m_ops = NULL; -static int m_msg_level = UFFS_MSG_NORMAL; - -static void uffs_vprintf(const char *fmt, va_list args) -{ - char line_buf[MAX_DEBUG_MSG_LINE_LENGTH]; - - if (m_ops && m_ops->output) { -#ifdef _COMPILER_CLIB_DO_NOT_HAVE_VSNPRINTF_ - vsprintf(line_buf, fmt, args); -#else - vsnprintf(line_buf, MAX_DEBUG_MSG_LINE_LENGTH, fmt, args); -#endif - m_ops->output(line_buf); - } -} - -/** - * \brief Initialize debug message output functions - */ -URET uffs_InitDebugMessageOutput(struct uffs_DebugMsgOutputSt *ops, int msg_level) -{ - m_ops = ops; - - if (m_ops == NULL || m_ops->output == NULL) { - m_ops = NULL; - return U_FAIL; - } - else if (m_ops->vprintf == NULL) - m_ops->vprintf = uffs_vprintf; - - m_msg_level = msg_level; - - return U_SUCC; -} - -void uffs_DebugSetMessageLevel(int msg_level) -{ - m_msg_level = msg_level; -} -#endif - -#ifdef CONFIG_ENABLE_UFFS_DEBUG_MSG - -/** - * \brief The main debug message output function - */ -#if !defined(RT_THREAD) -void uffs_DebugMessage(int level, const char *prefix, - const char *suffix, const char *errFmt, ...) -{ - va_list arg; - - if (m_ops && level >= m_msg_level) { - if (prefix) - m_ops->output(prefix); - - va_start(arg, errFmt); - m_ops->vprintf(errFmt, arg); - va_end(arg); - - if (suffix) - m_ops->output(suffix); - } -} - -/** - * \brief Called when an assert occurred. - * This method is called when an assert occurred and should stop the - * application from running, as this there is a severe error condition. - * \param[in] file Source filename - * \param[in] line Source line of code - * \param[in] msg Assert message - */ -void uffs_AssertCall(const char *file, int line, const char *msg, ...) -{ - va_list args; - char buf[32]; - - if (m_ops && m_msg_level < UFFS_MSG_NOMSG) { - m_ops->output("ASSERT "); - m_ops->output(file); - sprintf(buf, ":%d - :", line); - m_ops->output(buf); - va_start(args, msg); - m_ops->vprintf(msg, args); - va_end(args); - m_ops->output(TENDSTR); - } -} -#endif - -#ifdef _COMPILER_DO_NOT_SUPPORT_MACRO_VALIST_REPLACE_ -void uffs_Perror(int level, const char *fmt, ...) -{ - va_list args; - if (m_ops && level >= m_msg_level) { - va_start(args, fmt); - m_ops->vprintf(fmt, args); - va_end(args); - m_ops->output(TENDSTR); - } -} - -void uffs_PerrorRaw(int level, const char *fmt, ...) -{ - va_list args; - if (m_ops && level >= m_msg_level) { - va_start(args, fmt); - m_ops->vprintf(fmt, args); - va_end(args); - } -} - -UBOOL uffs_Assert(UBOOL expr, const char *fmt, ...) -{ - va_list args; - if (m_ops && !expr && m_msg_level < UFFS_MSG_NOMSG) { - m_ops->output("ASSERT FAILED: "); - va_start(args, fmt); - m_ops->vprintf(fmt, args); - va_end(args); - m_ops->output(TENDSTR); - } - return expr ? U_TRUE : U_FALSE; -} -#endif - -#else - -void uffs_DebugMessage(int level, const char *prefix, const char *suffix, const char *errFmt, ...) {}; -void uffs_AssertCall(const char *file, int line, const char *msg, ...) {}; - -#ifdef _COMPILER_DO_NOT_SUPPORT_MACRO_VALIST_REPLACE_ -void uffs_Perror(int level, const char *fmt, ...) {} -void uffs_PerrorRaw(int level, const char *fmt, ...) {} -UBOOL uffs_Assert(UBOOL expr, const char *fmt, ...) { return expr ? U_TRUE : U_FALSE; } -#endif - -#endif diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_device.c b/components/dfs/filesystems/uffs/src/uffs/uffs_device.c deleted file mode 100644 index 7b6a14de8..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_device.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_device.c - * \brief uffs device operation - * \author Ricky Zheng, created 10th May, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_mtb.h" -#include - -#define PFX "dev : " - - -#ifdef CONFIG_USE_PER_DEVICE_LOCK -void uffs_DeviceInitLock(uffs_Device *dev) -{ - uffs_SemCreate(&dev->lock.sem); - dev->lock.task_id = UFFS_TASK_ID_NOT_EXIST; - dev->lock.counter = 0; -} - -void uffs_DeviceReleaseLock(uffs_Device *dev) -{ - uffs_SemDelete(&dev->lock.sem); -} - -void uffs_DeviceLock(uffs_Device *dev) -{ - uffs_SemWait(dev->lock.sem); - - if (dev->lock.counter != 0) { - uffs_Perror(UFFS_MSG_NORMAL, - "Lock device, counter %d NOT zero?!", dev->lock.counter); - } - - dev->lock.counter++; -} - -void uffs_DeviceUnLock(uffs_Device *dev) -{ - dev->lock.counter--; - - if (dev->lock.counter != 0) { - uffs_Perror(UFFS_MSG_NORMAL, - "Unlock device, counter %d NOT zero?!", dev->lock.counter); - } - - uffs_SemSignal(dev->lock.sem); -} - -#else - -/* dummy stubs */ -void uffs_DeviceInitLock(uffs_Device *dev) {} -void uffs_DeviceReleaseLock(uffs_Device *dev) {} -void uffs_DeviceLock(uffs_Device *dev) {} -void uffs_DeviceUnLock(uffs_Device *dev) {} - -#endif diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_ecc.c b/components/dfs/filesystems/uffs/src/uffs/uffs_ecc.c deleted file mode 100644 index 3d10c2d3f..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_ecc.c +++ /dev/null @@ -1,384 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_ecc.c - * \brief ecc maker and correct - * \author Ricky Zheng, created in 12th Jun, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_fs.h" -#include - -#define PFX "ecc : " - -static const u8 bits_tbl[256] = { - 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, - 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8, -}; - -static const u8 line_parity_tbl[16] = { - 0x00, 0x02, 0x08, 0x0a, 0x20, 0x22, 0x28, 0x2a, - 0x80, 0x82, 0x88, 0x8a, 0xa0, 0xa2, 0xa8, 0xaa -}; - -static const u8 line_parity_prime_tbl[16] = { - 0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15, - 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55 -}; - -static const u8 column_parity_tbl[256] = { - 0x00, 0x55, 0x59, 0x0c, 0x65, 0x30, 0x3c, 0x69, - 0x69, 0x3c, 0x30, 0x65, 0x0c, 0x59, 0x55, 0x00, - 0x95, 0xc0, 0xcc, 0x99, 0xf0, 0xa5, 0xa9, 0xfc, - 0xfc, 0xa9, 0xa5, 0xf0, 0x99, 0xcc, 0xc0, 0x95, - 0x99, 0xcc, 0xc0, 0x95, 0xfc, 0xa9, 0xa5, 0xf0, - 0xf0, 0xa5, 0xa9, 0xfc, 0x95, 0xc0, 0xcc, 0x99, - 0x0c, 0x59, 0x55, 0x00, 0x69, 0x3c, 0x30, 0x65, - 0x65, 0x30, 0x3c, 0x69, 0x00, 0x55, 0x59, 0x0c, - 0xa5, 0xf0, 0xfc, 0xa9, 0xc0, 0x95, 0x99, 0xcc, - 0xcc, 0x99, 0x95, 0xc0, 0xa9, 0xfc, 0xf0, 0xa5, - 0x30, 0x65, 0x69, 0x3c, 0x55, 0x00, 0x0c, 0x59, - 0x59, 0x0c, 0x00, 0x55, 0x3c, 0x69, 0x65, 0x30, - 0x3c, 0x69, 0x65, 0x30, 0x59, 0x0c, 0x00, 0x55, - 0x55, 0x00, 0x0c, 0x59, 0x30, 0x65, 0x69, 0x3c, - 0xa9, 0xfc, 0xf0, 0xa5, 0xcc, 0x99, 0x95, 0xc0, - 0xc0, 0x95, 0x99, 0xcc, 0xa5, 0xf0, 0xfc, 0xa9, - 0xa9, 0xfc, 0xf0, 0xa5, 0xcc, 0x99, 0x95, 0xc0, - 0xc0, 0x95, 0x99, 0xcc, 0xa5, 0xf0, 0xfc, 0xa9, - 0x3c, 0x69, 0x65, 0x30, 0x59, 0x0c, 0x00, 0x55, - 0x55, 0x00, 0x0c, 0x59, 0x30, 0x65, 0x69, 0x3c, - 0x30, 0x65, 0x69, 0x3c, 0x55, 0x00, 0x0c, 0x59, - 0x59, 0x0c, 0x00, 0x55, 0x3c, 0x69, 0x65, 0x30, - 0xa5, 0xf0, 0xfc, 0xa9, 0xc0, 0x95, 0x99, 0xcc, - 0xcc, 0x99, 0x95, 0xc0, 0xa9, 0xfc, 0xf0, 0xa5, - 0x0c, 0x59, 0x55, 0x00, 0x69, 0x3c, 0x30, 0x65, - 0x65, 0x30, 0x3c, 0x69, 0x00, 0x55, 0x59, 0x0c, - 0x99, 0xcc, 0xc0, 0x95, 0xfc, 0xa9, 0xa5, 0xf0, - 0xf0, 0xa5, 0xa9, 0xfc, 0x95, 0xc0, 0xcc, 0x99, - 0x95, 0xc0, 0xcc, 0x99, 0xf0, 0xa5, 0xa9, 0xfc, - 0xfc, 0xa9, 0xa5, 0xf0, 0x99, 0xcc, 0xc0, 0x95, - 0x00, 0x55, 0x59, 0x0c, 0x65, 0x30, 0x3c, 0x69, - 0x69, 0x3c, 0x30, 0x65, 0x0c, 0x59, 0x55, 0x00, -}; - -/** - * calculate 3 bytes ECC for 256 bytes data. - * - * \param[in] data input data - * \param[out] ecc output ecc - * \param[in] length of data in bytes - */ -static void uffs_EccMakeChunk256(const void *data, void *ecc, u16 len) -{ - u8 *pecc = (u8 *)ecc; - const u8 *p = (const u8 *)data; - u8 b, col_parity = 0, line_parity = 0, line_parity_prime = 0; - u16 i; - - for (i = 0; i < len; i++) { - b = column_parity_tbl[*p++]; - col_parity ^= b; - if (b & 0x01) { // odd number of bits in the byte - line_parity ^= i; - line_parity_prime ^= ~i; - } - } - - // ECC layout: - // Byte[0] P64 | P64' | P32 | P32' | P16 | P16' | P8 | P8' - // Byte[1] P1024 | P1024' | P512 | P512' | P256 | P256' | P128 | P128' - // Byte[2] P4 | P4' | P2 | P2' | P1 | P1' | 1 | 1 - pecc[0] = ~(line_parity_tbl[line_parity & 0xf] | - line_parity_prime_tbl[line_parity_prime & 0xf]); - pecc[1] = ~(line_parity_tbl[line_parity >> 4] | - line_parity_prime_tbl[line_parity_prime >> 4]); - pecc[2] = (~col_parity) | 0x03; - -} - - -/** - * calculate ECC. (3 bytes ECC per 256 data) - * - * \param[in] data input data - * \param[in] data_len length of data in byte - * \param[out] ecc output ecc - * - * \return length of ECC in byte. (3 bytes ECC per 256 data) - */ -int uffs_EccMake(const void *data, int data_len, void *ecc) -{ - const u8 *p_data = (const u8 *)data; - u8 *p_ecc = (u8 *)ecc; - int len; - - if (data == NULL || ecc == NULL) - return 0; - - while (data_len > 0) { - len = data_len > 256 ? 256 : data_len; - uffs_EccMakeChunk256(p_data, p_ecc, len); - data_len -= len; - p_data += len; - p_ecc += 3; - } - - return p_ecc - (u8 *)ecc; -} - -/** - * perform ECC error correct for 256 bytes data chunk. - * - * \param[in|out] data input data to be corrected - * \param[in] read_ecc 3 bytes ECC read from storage - * \param[in] test_ecc 3 bytes ECC calculated from data - * \param[in] errtop top position of error - * - * \return: 0 -- no error - * -1 -- can not be corrected - * >0 -- how many bits corrected - */ -static int uffs_EccCorrectChunk256(void *data, void *read_ecc, - const void *test_ecc, int errtop) -{ - u8 d0, d1, d2; /* deltas */ - u8 *p = (u8 *)data; - u8 *pread_ecc = (u8 *)read_ecc, *ptest_ecc = (u8 *)test_ecc; - - d0 = pread_ecc[0] ^ ptest_ecc[0]; - d1 = pread_ecc[1] ^ ptest_ecc[1]; - d2 = pread_ecc[2] ^ ptest_ecc[2]; - - if ((d0 | d1 | d2) == 0) - return 0; - - if( ((d0 ^ (d0 >> 1)) & 0x55) == 0x55 && - ((d1 ^ (d1 >> 1)) & 0x55) == 0x55 && - ((d2 ^ (d2 >> 1)) & 0x54) == 0x54) - { - // Single bit (recoverable) error in data - - u8 b; - u8 bit; - - bit = b = 0; - - if(d1 & 0x80) b |= 0x80; - if(d1 & 0x20) b |= 0x40; - if(d1 & 0x08) b |= 0x20; - if(d1 & 0x02) b |= 0x10; - if(d0 & 0x80) b |= 0x08; - if(d0 & 0x20) b |= 0x04; - if(d0 & 0x08) b |= 0x02; - if(d0 & 0x02) b |= 0x01; - - if(d2 & 0x80) bit |= 0x04; - if(d2 & 0x20) bit |= 0x02; - if(d2 & 0x08) bit |= 0x01; - - if (b >= errtop) return -1; - - p[b] ^= (1 << bit); - - return 1; - } - - if ((bits_tbl[d0] + bits_tbl[d1] + bits_tbl[d2]) == 1) { - // error in ecc, no action need - return 1; - } - - // Unrecoverable error - return -1; -} - -/** - * perform ECC error correct - * - * \param[in|out] data input data to be corrected - * \param[in] data_len length of data in byte - * \param[in] read_ecc ECC read from storage - * \param[in] test_ecc ECC calculated from data - * - * \return: 0 -- no error - * -1 -- can not be corrected - * >0 -- how many bits corrected - */ - -int uffs_EccCorrect(void *data, int data_len, - void *read_ecc, const void *test_ecc) -{ - u8 *p_data = (u8 *)data; - u8 *p_read_ecc = (u8 *)read_ecc; - u8 *p_test_ecc = (u8 *)test_ecc; - int total = 0, ret, len; - - if (data == NULL || read_ecc == NULL || test_ecc == NULL) - return -1; - - while (data_len > 0) { - len = (data_len > 256 ? 256 : data_len); - ret = uffs_EccCorrectChunk256(p_data, p_read_ecc, p_test_ecc, len); - if (ret < 0) { - total = ret; - break; - } - else - total += ret; - - p_data += len; - p_read_ecc += 3; - p_test_ecc += 3; - data_len -= len; - } - - return total; - -} - -/** - * generate 12 bit ecc for 8 bytes data. - * (use 0xFF padding if the data length is less then 8 bytes) - * - * \param[in] data input data - * \param[in] data_len length of data in byte - * - * \return 12 bits ECC data (lower 12 bits). - */ -u16 uffs_EccMake8(void *data, int data_len) -{ - u8 *p = (u8 *)data; - u8 b, col_parity = 0, line_parity = 0, line_parity_prime = 0; - u8 i; - u16 ecc = 0; - - - data_len = (data_len > 8 ? 8 : data_len); - - for (i = 0; i < data_len; i++) { - b = column_parity_tbl[*p++]; - col_parity ^= b; - if (b & 0x01) { // odd number of bits in the byte - line_parity ^= i; - line_parity_prime ^= ~i; - } - } - - // ECC layout: - // row: (1) | (1) | P32 | P32' | P16 | P16' | P8 | P8' - // column: P4 | P4' | P2 | P2' | P1 | P1' | (1) | (1) - // 12-bit ecc: P32 | P32' | P16 | P16' | P8 | P8' | P4 | P4' | P2 | P2' | P1 | P1' | - ecc = (~( - line_parity_tbl[line_parity & 0xf] | - line_parity_prime_tbl[line_parity_prime & 0xf] - )) << 6; - ecc |= (((~col_parity) >> 2) & 0x3f); - - return ecc & 0xfff; -} - -/** - * correct 8 bytes data from 12 bits ECC - * - * \param[in|out] data input data - * \param[in] read_ecc ecc read from storage - * \param[in] test_ecc ecc calculated from data - * \param[in] errtop top position of error. - * - * \return: 0 -- no error - * -1 -- can not be corrected - * >0 -- how many bits corrected - */ -int uffs_EccCorrect8(void *data, u16 read_ecc, u16 test_ecc, int errtop) -{ - u8 d0, d1; /* deltas */ - u8 *p = (u8 *)data; - - read_ecc &= 0xfff; - test_ecc &= 0xfff; - - d0 = (read_ecc >> 6) ^ (test_ecc >> 6); - d1 = (read_ecc & 0x3f) ^ (test_ecc & 0x3f); - - if ((d0 | d1) == 0) - return 0; - - if( ((d0 ^ (d0 >> 1)) & 0x15) == 0x15 && - ((d1 ^ (d1 >> 1)) & 0x15) == 0x15) - { - // Single bit (recoverable) error in data - - u8 b; - u8 bit; - - bit = b = 0; - - if(d0 & 0x20) b |= 0x04; - if(d0 & 0x08) b |= 0x02; - if(d0 & 0x02) b |= 0x01; - - if(d1 & 0x20) bit |= 0x04; - if(d1 & 0x08) bit |= 0x02; - if(d1 & 0x02) bit |= 0x01; - - if (b >= (u8)errtop) return -1; - if (bit >= 8) return -1; - - p[b] ^= (1 << bit); - - return 1; - } - - if ((bits_tbl[d0] + bits_tbl[d1]) == 1) { - // error in ecc, no action need - return 1; - } - - // Unrecoverable error - return -1; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_fd.c b/components/dfs/filesystems/uffs/src/uffs/uffs_fd.c deleted file mode 100644 index bbc1bb880..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_fd.c +++ /dev/null @@ -1,746 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fd.c - * \brief POSIX like, hight level file operations - * \author Ricky Zheng, created 8th Jun, 2005 - */ - -#include -#include "uffs_config.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_fd.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_version.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_find.h" - -#define PFX "fd : " - -/** - * \brief POSIX DIR - */ -struct uffs_dirSt { - struct uffs_ObjectSt *obj; /* dir object */ - struct uffs_FindInfoSt f; /* find info */ - struct uffs_ObjectInfoSt info; /* object info */ - struct uffs_dirent dirent; /* dir entry */ -}; - - -#define FD_OFFSET 3 //!< just make file handler more like POSIX (0, 1, 2 for stdin/stdout/stderr) - -#define OBJ2FD(obj) \ - ( \ - ( \ - uffs_PoolGetIndex(uffs_GetObjectPool(), obj) | \ - (_fd_signature << FD_SIGNATURE_SHIFT) \ - ) \ - + FD_OFFSET \ - ) - -/** - * check #fd signature, convert #fd to #obj - * if success, hold global file system lock, otherwise return with #ret - */ -#define CHK_OBJ_LOCK(fd, obj, ret) \ - do { \ - uffs_GlobalFsLockLock(); \ - fd -= FD_OFFSET; \ - if ( (fd >> FD_SIGNATURE_SHIFT) != _fd_signature ) { \ - uffs_set_error(-UEBADF); \ - uffs_Perror(UFFS_MSG_NOISY, "invalid fd: %d (sig: %d, expect: %d)", \ - fd + FD_OFFSET, fd >> FD_SIGNATURE_SHIFT, _fd_signature); \ - uffs_GlobalFsLockUnlock(); \ - return (ret); \ - } \ - fd = fd & ((1 << FD_SIGNATURE_SHIFT) - 1); \ - obj = (uffs_Object *)uffs_PoolGetBufByIndex(uffs_GetObjectPool(), fd); \ - if ((obj) == NULL || \ - uffs_PoolVerify(uffs_GetObjectPool(), (obj)) == U_FALSE || \ - uffs_PoolCheckFreeList(uffs_GetObjectPool(), (obj)) == U_TRUE) { \ - uffs_set_error(-UEBADF); \ - uffs_Perror(UFFS_MSG_NOISY, "invalid obj"); \ - uffs_GlobalFsLockUnlock(); \ - return (ret); \ - } \ - } while(0) - -/** - * check #dirp signature, - * if success, hold global file system lock, - * otherwise return with #ret - */ -#define CHK_DIR_LOCK(dirp, ret) \ - do { \ - uffs_GlobalFsLockLock(); \ - if ((dirp) == NULL || \ - uffs_PoolVerify(&_dir_pool, (dirp)) == U_FALSE || \ - uffs_PoolCheckFreeList(&_dir_pool, (dirp)) == U_TRUE) { \ - uffs_set_error(-UEBADF); \ - uffs_Perror(UFFS_MSG_NOISY, "invalid dirp"); \ - uffs_GlobalFsLockUnlock(); \ - return (ret); \ - } \ - } while(0) - -/** - * check #dirp signature, - * if success, hold global file system lock, - * otherwise return void - */ -#define CHK_DIR_VOID_LOCK(dirp) \ - do { \ - uffs_GlobalFsLockLock(); \ - if ((dirp) == NULL || \ - uffs_PoolVerify(&_dir_pool, (dirp)) == U_FALSE || \ - uffs_PoolCheckFreeList(&_dir_pool, (dirp)) == U_TRUE) { \ - uffs_set_error(-UEBADF); \ - uffs_Perror(UFFS_MSG_NOISY, "invalid dirp"); \ - uffs_GlobalFsLockUnlock(); \ - return; \ - } \ - } while(0) - - -static int _dir_pool_data[sizeof(uffs_DIR) * MAX_DIR_HANDLE / sizeof(int)]; -static uffs_Pool _dir_pool; -static int _uffs_errno = 0; - - -// -// What is fd signature ? fd signature is for detecting file system get formated by other party. -// A thread open a file, read()...sleep()...write()...sleep()... -// B thread format UFFS partition, increase fd signature. -// A thread ...sleep()...read() --> Opps, fd signature changed ! read() return error(expected). -// -#define MAX_FD_SIGNATURE_ROUND (100) -static int _fd_signature = 0; - -// -// only get called when formating UFFS partition -// -void uffs_FdSignatureIncrease(void) -{ - if (_fd_signature++ > MAX_FD_SIGNATURE_ROUND) - _fd_signature = 0; -} - -/** - * initialise uffs_DIR buffers, called by UFFS internal - */ -URET uffs_DirEntryBufInit(void) -{ - return uffs_PoolInit(&_dir_pool, _dir_pool_data, - sizeof(_dir_pool_data), - sizeof(uffs_DIR), MAX_DIR_HANDLE); -} - -/** - * Release uffs_DIR buffers, called by UFFS internal - */ -URET uffs_DirEntryBufRelease(void) -{ - return uffs_PoolRelease(&_dir_pool); -} - -/** - * Put all dir entry buf match dev - */ -int uffs_DirEntryBufPutAll(uffs_Device *dev) -{ - int count = 0; - uffs_DIR *dirp = NULL; - - do { - dirp = (uffs_DIR *) uffs_PoolFindNextAllocated(&_dir_pool, dirp); - if (dirp && dirp->obj && dirp->obj->dev && - dirp->obj->dev->dev_num == dev->dev_num) { - uffs_PoolPut(&_dir_pool, dirp); - count++; - } - } while (dirp); - - return count; -} - - -uffs_Pool * uffs_DirEntryBufGetPool(void) -{ - return &_dir_pool; -} - -static uffs_DIR * GetDirEntry(void) -{ - uffs_DIR *dirp = (uffs_DIR *) uffs_PoolGet(&_dir_pool); - - if (dirp) - memset(dirp, 0, sizeof(uffs_DIR)); - - return dirp; -} - -static void PutDirEntry(uffs_DIR *p) -{ - uffs_PoolPut(&_dir_pool, p); -} - - -/** get global errno - */ -int uffs_get_error(void) -{ - return _uffs_errno; -} - -/** set global errno - */ -int uffs_set_error(int err) -{ - return (_uffs_errno = err); -} - -/* POSIX compliant file system APIs */ - -int uffs_open(const char *name, int oflag, ...) -{ - uffs_Object *obj; - int ret = 0; - - uffs_GlobalFsLockLock(); - - obj = uffs_GetObject(); - if (obj == NULL) { - uffs_set_error(-UEMFILE); - ret = -1; - } - else { - if (uffs_OpenObject(obj, name, oflag) == U_FAIL) { - uffs_set_error(-uffs_GetObjectErr(obj)); - uffs_PutObject(obj); - ret = -1; - } - else { - ret = OBJ2FD(obj); - } - } - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_close(int fd) -{ - int ret = 0; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - - uffs_ClearObjectErr(obj); - if (uffs_CloseObject(obj) == U_FAIL) { - uffs_set_error(-uffs_GetObjectErr(obj)); - ret = -1; - } - else { - uffs_PutObject(obj); - ret = 0; - } - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_read(int fd, void *data, int len) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = uffs_ReadObject(obj, data, len); - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_write(int fd, const void *data, int len) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = uffs_WriteObject(obj, data, len); - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -long uffs_seek(int fd, long offset, int origin) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = uffs_SeekObject(obj, offset, origin); - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -long uffs_tell(int fd) -{ - long ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = (long) uffs_GetCurOffset(obj); - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_eof(int fd) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = uffs_EndOfFile(obj); - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_flush(int fd) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = (uffs_FlushObject(obj) == U_SUCC) ? 0 : -1; - uffs_set_error(-uffs_GetObjectErr(obj)); - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_rename(const char *old_name, const char *new_name) -{ - int err = 0; - int ret = 0; - - uffs_GlobalFsLockLock(); - ret = (uffs_RenameObject(old_name, new_name, &err) == U_SUCC) ? 0 : -1; - uffs_set_error(-err); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_remove(const char *name) -{ - int err = 0; - int ret = 0; - struct uffs_stat st; - - if (uffs_stat(name, &st) < 0) { - err = UENOENT; - ret = -1; - } - else if (st.st_mode & US_IFDIR) { - err = UEISDIR; - ret = -1; - } - else { - uffs_GlobalFsLockLock(); - if (uffs_DeleteObject(name, &err) == U_SUCC) { - ret = 0; - } - else { - ret = -1; - } - uffs_GlobalFsLockUnlock(); - } - - uffs_set_error(-err); - return ret; -} - -int uffs_ftruncate(int fd, long remain) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - uffs_ClearObjectErr(obj); - ret = (uffs_TruncateObject(obj, remain) == U_SUCC) ? 0 : -1; - uffs_set_error(-uffs_GetObjectErr(obj)); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -static int do_stat(uffs_Object *obj, struct uffs_stat *buf) -{ - uffs_ObjectInfo info; - int ret = 0; - int err = 0; - - if (uffs_GetObjectInfo(obj, &info, &err) == U_FAIL) { - ret = -1; - } - else { - buf->st_dev = obj->dev->dev_num; - buf->st_ino = info.serial; - buf->st_nlink = 0; - buf->st_uid = 0; - buf->st_gid = 0; - buf->st_rdev = 0; - buf->st_size = info.len; - buf->st_blksize = obj->dev->com.pg_data_size; - buf->st_blocks = 0; - buf->st_atime = info.info.last_modify; - buf->st_mtime = info.info.last_modify; - buf->st_ctime = info.info.create_time; - buf->st_mode = (info.info.attr & FILE_ATTR_DIR ? US_IFDIR : US_IFREG); - if (info.info.attr & FILE_ATTR_WRITE) - buf->st_mode |= US_IRWXU; - } - - uffs_set_error(-err); - return ret; -} - -int uffs_stat(const char *name, struct uffs_stat *buf) -{ - uffs_Object *obj; - int ret = 0; - int err = 0; - URET result; - - uffs_GlobalFsLockLock(); - - obj = uffs_GetObject(); - if (obj) { - if (*name && name[strlen(name) - 1] == '/') { - result = uffs_OpenObject(obj, name, UO_RDONLY | UO_DIR); - } - else { - if ((result = uffs_OpenObject(obj, name, UO_RDONLY)) != U_SUCC) // try file - result = uffs_OpenObject(obj, name, UO_RDONLY | UO_DIR); // then try dir - } - if (result == U_SUCC) { - ret = do_stat(obj, buf); - uffs_CloseObject(obj); - } - else { - err = uffs_GetObjectErr(obj); - ret = -1; - } - uffs_PutObject(obj); - } - else { - err = UENOMEM; - ret = -1; - } - - uffs_set_error(-err); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_lstat(const char *name, struct uffs_stat *buf) -{ - return uffs_stat(name, buf); -} - -int uffs_fstat(int fd, struct uffs_stat *buf) -{ - int ret; - uffs_Object *obj; - - CHK_OBJ_LOCK(fd, obj, -1); - - ret = do_stat(obj, buf); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_closedir(uffs_DIR *dirp) -{ - CHK_DIR_LOCK(dirp, -1); - - uffs_FindObjectClose(&dirp->f); - if (dirp->obj) { - uffs_CloseObject(dirp->obj); - uffs_PutObject(dirp->obj); - } - PutDirEntry(dirp); - uffs_GlobalFsLockUnlock(); - - return 0; -} - -uffs_DIR * uffs_opendir(const char *path) -{ - int err = 0; - uffs_DIR *ret = NULL; - uffs_DIR *dirp; - - uffs_GlobalFsLockLock(); - - dirp = GetDirEntry(); - - if (dirp) { - dirp->obj = uffs_GetObject(); - if (dirp->obj) { - if (uffs_OpenObject(dirp->obj, path, UO_RDONLY | UO_DIR) == U_SUCC) { - if (uffs_FindObjectOpen(&dirp->f, dirp->obj) == U_SUCC) { - ret = dirp; - goto ext; - } - else { - uffs_CloseObject(dirp->obj); - } - } - else { - err = uffs_GetObjectErr(dirp->obj); - } - uffs_PutObject(dirp->obj); - dirp->obj = NULL; - } - else { - err = UEMFILE; - } - PutDirEntry(dirp); - } - else { - err = UEMFILE; - } -ext: - uffs_set_error(-err); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -struct uffs_dirent * uffs_readdir(uffs_DIR *dirp) -{ - struct uffs_dirent *ent = NULL; - - CHK_DIR_LOCK(dirp, NULL); - - if (uffs_FindObjectNext(&dirp->info, &dirp->f) == U_SUCC) { - ent = &dirp->dirent; - ent->d_ino = dirp->info.serial; - ent->d_namelen = dirp->info.info.name_len < (sizeof(ent->d_name) - 1) ? dirp->info.info.name_len : (sizeof(ent->d_name) - 1); - memcpy(ent->d_name, dirp->info.info.name, ent->d_namelen); - ent->d_name[ent->d_namelen] = '\0'; - ent->d_off = dirp->f.pos; - ent->d_reclen = sizeof(struct uffs_dirent); - ent->d_type = dirp->info.info.attr; - } - uffs_GlobalFsLockUnlock(); - - return ent; -} - -void uffs_rewinddir(uffs_DIR *dirp) -{ - CHK_DIR_VOID_LOCK(dirp); - - uffs_FindObjectRewind(&dirp->f); - - uffs_GlobalFsLockUnlock(); -} - - -int uffs_mkdir(const char *name, ...) -{ - uffs_Object *obj; - int ret = 0; - int err = 0; - - uffs_GlobalFsLockLock(); - - obj = uffs_GetObject(); - if (obj) { - if (uffs_CreateObject(obj, name, UO_CREATE|UO_DIR) != U_SUCC) { - err = obj->err; - ret = -1; - } - else { - uffs_CloseObject(obj); - ret = 0; - } - uffs_PutObject(obj); - } - else { - err = UEMFILE; - ret = -1; - } - - uffs_set_error(-err); - uffs_GlobalFsLockUnlock(); - - return ret; -} - -int uffs_rmdir(const char *name) -{ - int err = 0; - int ret = 0; - struct uffs_stat st; - - if (uffs_stat(name, &st) < 0) { - err = UENOENT; - ret = -1; - } - else if ((st.st_mode & US_IFDIR) == 0) { - err = UENOTDIR; - ret = -1; - } - else { - uffs_GlobalFsLockLock(); - if (uffs_DeleteObject(name, &err) == U_SUCC) { - ret = 0; - } - else { - ret = -1; - } - uffs_GlobalFsLockUnlock(); - } - uffs_set_error(-err); - return ret; -} - -int uffs_version(void) -{ - return uffs_GetVersion(); -} - -int uffs_format(const char *mount_point) -{ - uffs_Device *dev = NULL; - URET ret = U_FAIL; - - dev = uffs_GetDeviceFromMountPoint(mount_point); - if (dev) { - uffs_GlobalFsLockLock(); - ret = uffs_FormatDevice(dev, U_TRUE); - uffs_GlobalFsLockUnlock(); - } - - return ret == U_SUCC ? 0 : -1; -} - -long uffs_space_total(const char *mount_point) -{ - uffs_Device *dev = NULL; - long ret = -1L; - - dev = uffs_GetDeviceFromMountPoint(mount_point); - if (dev) { - uffs_GlobalFsLockLock(); - ret = (long) uffs_GetDeviceTotal(dev); - uffs_GlobalFsLockUnlock(); - } - - return ret; -} - -long uffs_space_used(const char *mount_point) -{ - uffs_Device *dev = NULL; - long ret = -1L; - - dev = uffs_GetDeviceFromMountPoint(mount_point); - if (dev) { - uffs_GlobalFsLockLock(); - ret = (long) uffs_GetDeviceUsed(dev); - uffs_GlobalFsLockUnlock(); - } - - return ret; -} - -long uffs_space_free(const char *mount_point) -{ - uffs_Device *dev = NULL; - long ret = -1L; - - dev = uffs_GetDeviceFromMountPoint(mount_point); - if (dev) { - uffs_GlobalFsLockLock(); - ret = (long) uffs_GetDeviceFree(dev); - uffs_GlobalFsLockUnlock(); - } - - return ret; -} - - -void uffs_flush_all(const char *mount_point) -{ - uffs_Device *dev = NULL; - - dev = uffs_GetDeviceFromMountPoint(mount_point); - if (dev) { - uffs_GlobalFsLockLock(); - uffs_BufFlushAll(dev); - uffs_PutDevice(dev); - uffs_GlobalFsLockUnlock(); - } -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_find.c b/components/dfs/filesystems/uffs/src/uffs/uffs_find.c deleted file mode 100644 index e79da042f..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_find.c +++ /dev/null @@ -1,378 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_find.c - * \brief find objects under dir - * \author Ricky Zheng, created 13th July, 2009 - */ - -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_find.h" - -#define TPOOL(dev) &((dev)->mem.tree_pool) - -static void ResetFindInfo(uffs_FindInfo *f) -{ - f->hash = 0; - f->work = NULL; - f->step = 0; - f->pos = 0; -} - -static URET _LoadObjectInfo(uffs_Device *dev, - TreeNode *node, - uffs_ObjectInfo *info, - int type, - int *err) -{ - uffs_Buf *buf; - - buf = uffs_BufGetEx(dev, (u8)type, node, 0, 0); - - if (buf == NULL) { - if (err) - *err = UENOMEM; - return U_FAIL; - } - - memcpy(&(info->info), buf->data, sizeof(uffs_FileInfo)); - - if (type == UFFS_TYPE_DIR) { - info->len = 0; - info->serial = node->u.dir.serial; - } - else { - info->len = node->u.file.len; - info->serial = node->u.file.serial; - } - - uffs_BufPut(dev, buf); - - return U_SUCC; -} - -/** - * get object information - * - * \param[in] obj the object to be revealed - * \param[out] info object information will be loaded to info - * \param[out] err return error code if failed - * - * \return U_SUCC or U_FAIL - * - * \node the obj should be openned before call this function. - */ -URET uffs_GetObjectInfo(uffs_Object *obj, uffs_ObjectInfo *info, int *err) -{ - uffs_Device *dev = obj->dev; - URET ret = U_FAIL; - - uffs_DeviceLock(dev); - - if (obj && dev && info) { - if (obj->parent == PARENT_OF_ROOT) { - // this is ROOT. UFFS does not physically has root, just fake it ... - memset(info, 0, sizeof(uffs_ObjectInfo)); - info->serial = obj->serial; - info->info.attr |= (FILE_ATTR_DIR | FILE_ATTR_WRITE); - if (err) - *err = UENOERR; - ret = U_SUCC; - } - else - ret = _LoadObjectInfo(dev, obj->node, info, obj->type, err); - } - else { - if (err) - *err = UEINVAL; - } - - uffs_DeviceUnLock(dev); - - return ret; -} - - -/** - * Open a FindInfo for finding objects under dir - * - * \param[out] f uffs_FindInfo structure - * \param[in] dir an openned dir object (openned by uffs_OpenObject() ). - * - * \return U_SUCC if success, U_FAIL if invalid param or the dir - * is not been openned. - */ -URET uffs_FindObjectOpen(uffs_FindInfo *f, uffs_Object *dir) -{ - if (f == NULL || dir == NULL || - dir->dev == NULL || dir->open_succ != U_TRUE) - return U_FAIL; - - f->dev = dir->dev; - f->serial = dir->serial; - ResetFindInfo(f); - - return U_SUCC; -} - -/** - * Open a FindInfo for finding objects under dir - * - * \param[out] f uffs_FindInfo structure - * \param[in] dev uffs device - * \param[in] dir serial number of the dir to be searched - * - * \return U_SUCC if success, U_FAIL if invalid param or the dir - * serial number is not valid. - */ -URET uffs_FindObjectOpenEx(uffs_FindInfo *f, uffs_Device *dev, int dir) -{ - TreeNode *node; - - if (f == NULL || dev == NULL) - return U_FAIL; - - node = uffs_TreeFindDirNode(dev, dir); - - if (node == NULL) - return U_FAIL; - - f->serial = dir; - f->dev = dev; - ResetFindInfo(f); - - return U_SUCC; -} - - -static URET do_FindObject(uffs_FindInfo *f, uffs_ObjectInfo *info, u16 x) -{ - URET ret = U_SUCC; - TreeNode *node; - uffs_Device *dev = f->dev; - - if (f->step == 0) { //!< working on dirs - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.parent == f->serial) { - f->work = node; - f->pos++; - if (info) - ret = _LoadObjectInfo(dev, node, info, UFFS_TYPE_DIR, NULL); - goto ext; - } - x = node->hash_next; - } - - f->hash++; //come to next hash entry - - for (; f->hash < DIR_NODE_ENTRY_LEN; f->hash++) { - x = dev->tree.dir_entry[f->hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.parent == f->serial) { - f->work = node; - f->pos++; - if (info) - ret = _LoadObjectInfo(dev, node, info, UFFS_TYPE_DIR, NULL); - goto ext; - } - x = node->hash_next; - } - } - - //no subdirs, then lookup files .. - f->step++; - f->hash = 0; - x = dev->tree.file_entry[f->hash]; - } - - if (f->step == 1) { - - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.parent == f->serial) { - f->work = node; - f->pos++; - if (info) - ret = _LoadObjectInfo(dev, node, info, UFFS_TYPE_FILE, NULL); - goto ext; - } - x = node->hash_next; - } - - f->hash++; //come to next hash entry - - for (; f->hash < FILE_NODE_ENTRY_LEN; f->hash++) { - x = dev->tree.file_entry[f->hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.parent == f->serial) { - f->work = node; - f->pos++; - if (info) - ret = _LoadObjectInfo(dev, node, info, UFFS_TYPE_FILE, NULL); - goto ext; - } - x = node->hash_next; - } - } - - //no any files, stopped. - f->step++; - } - - ret = U_FAIL; -ext: - - return ret; - -} - - -/** - * Find the first object - * - * \param[out] info the object information will be filled to info. - * if info is NULL, then skip this object. - * \param[in] f uffs_FindInfo structure, openned by uffs_FindObjectOpen(). - * - * \return U_SUCC if an object is found, U_FAIL if no object is found. - */ -URET uffs_FindObjectFirst(uffs_ObjectInfo * info, uffs_FindInfo * f) -{ - uffs_Device *dev = f->dev; - URET ret = U_SUCC; - - uffs_DeviceLock(dev); - ResetFindInfo(f); - ret = do_FindObject(f, info, dev->tree.dir_entry[0]); - uffs_DeviceUnLock(dev); - - return ret; -} - -/** - * Find the next object. - * - * \param[out] info the object information will be filled to info. - * if info is NULL, then skip this object. - * \param[in] f uffs_FindInfo structure, openned by uffs_FindObjectOpen(). - * - * \return U_SUCC if an object is found, U_FAIL if no object is found. - * - * \note uffs_FindObjectFirst() should be called before uffs_FindObjectNext(). - */ -URET uffs_FindObjectNext(uffs_ObjectInfo *info, uffs_FindInfo * f) -{ - uffs_Device *dev = f->dev; - URET ret = U_SUCC; - - if (dev == NULL || f->step > 1) - return U_FAIL; - - if (f->work == NULL) - return uffs_FindObjectFirst(info, f); - - uffs_DeviceLock(dev); - ret = do_FindObject(f, info, f->work->hash_next); - uffs_DeviceUnLock(dev); - - return ret; -} - -/** - * Rewind a find object process. - * - * \note After rewind, you can call uffs_FindObjectFirst() to - * start find object process. - */ -URET uffs_FindObjectRewind(uffs_FindInfo *f) -{ - if (f == NULL) - return U_FAIL; - - ResetFindInfo(f); - - return U_SUCC; -} - -/** - * Close Find Object. - * - * \param[in] f uffs_FindInfo structure, openned by uffs_FindObjectOpen(). - * - * \return U_SUCC if success, U_FAIL if invalid param. - */ -URET uffs_FindObjectClose(uffs_FindInfo * f) -{ - if (f == NULL) - return U_FAIL; - - f->dev = NULL; - ResetFindInfo(f); - - return U_SUCC; -} - -/** - * Count objects - * - * \param[in] f uffs_FindInfo structure, openned by uffs_FindObjectOpen(). - * - * \return object counts - * \note after call this function, you need to call - * uffs_FindObjectRewind() to start finding process. - */ -int uffs_FindObjectCount(uffs_FindInfo *f) -{ - if (uffs_FindObjectFirst(NULL, f) == U_SUCC) { - while (uffs_FindObjectNext(NULL, f) == U_SUCC) { }; - } - return f->pos; -} - -/** - * Return current finding position - * - * \param[in] f uffs_FindInfo structure, openned by uffs_FindObjectOpen(). - * - * \return current finding position - */ -int uffs_FindObjectTell(uffs_FindInfo *f) -{ - return f->pos; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_flash.c b/components/dfs/filesystems/uffs/src/uffs/uffs_flash.c deleted file mode 100644 index be4f4246d..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_flash.c +++ /dev/null @@ -1,1034 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_flash.c - * \brief UFFS flash interface - * \author Ricky Zheng, created 17th July, 2009 - */ -#include "uffs_config.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_ecc.h" -#include "uffs/uffs_flash.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_badblock.h" -#include "uffs/uffs_crc.h" -#include - -#define PFX "flsh: " - -#define SPOOL(dev) &((dev)->mem.spare_pool) -#define HEADER(buf) ((struct uffs_MiniHeaderSt *)(buf)->header) - -#define ECC_SIZE(dev) ((dev)->attr->ecc_size) -#define NOMINAL_ECC_SIZE(dev) (3 * ((((dev)->attr->page_data_size - 1) / 256) + 1)) - -#define TAG_STORE_SIZE (sizeof(struct uffs_TagStoreSt)) - -#define SEAL_BYTE(dev, spare) spare[(dev)->mem.spare_data_size - 1] // seal byte is the last byte of spare data - -#if defined(CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME) -/** Linux MTD spare layout for 512 and 2K page size */ -static const u8 MTD512_LAYOUT_ECC[] = {0, 4, 6, 2, 0xFF, 0}; -static const u8 MTD512_LAYOUT_DATA[] = {8, 8, 0xFF, 0}; -static const u8 MTD2K_LAYOUT_ECC[] = {40, 24, 0xFF, 0}; -static const u8 MTD2K_LAYOUT_DATA[] = {2, 38, 0xFF, 0}; -#endif - -static void TagMakeEcc(struct uffs_TagStoreSt *ts) -{ - ts->tag_ecc = 0xFFF; - ts->tag_ecc = uffs_EccMake8(ts, sizeof(struct uffs_TagStoreSt)); -} - -static int TagEccCorrect(struct uffs_TagStoreSt *ts) -{ - u16 ecc_store, ecc_read; - int ret; - - ecc_store = ts->tag_ecc; - ts->tag_ecc = 0xFFF; - ecc_read = uffs_EccMake8(ts, sizeof(struct uffs_TagStoreSt)); - ret = uffs_EccCorrect8(ts, ecc_read, ecc_store, sizeof(struct uffs_TagStoreSt)); - ts->tag_ecc = ecc_store; // restore tag ecc - - return ret; - -} - -/** setup UFFS spare data & ecc layout */ -static void InitSpareLayout(uffs_Device *dev) -{ - u8 s; // status byte offset - u8 *p; - - s = dev->attr->block_status_offs; - - if (s < TAG_STORE_SIZE) { /* status byte is within 0 ~ TAG_STORE_SIZE-1 */ - - /* spare data layout */ - p = dev->attr->_uffs_data_layout; - if (s > 0) { - *p++ = 0; - *p++ = s; - } - *p++ = s + 1; - *p++ = TAG_STORE_SIZE - s; - *p++ = 0xFF; - *p++ = 0; - - /* spare ecc layout */ - p = dev->attr->_uffs_ecc_layout; - if (dev->attr->ecc_opt != UFFS_ECC_NONE) { - *p++ = TAG_STORE_SIZE + 1; - *p++ = ECC_SIZE(dev); - } - *p++ = 0xFF; - *p++ = 0; - } - else { /* status byte > TAG_STORE_SIZE-1 */ - - /* spare data layout */ - p = dev->attr->_uffs_data_layout; - *p++ = 0; - *p++ = TAG_STORE_SIZE; - *p++ = 0xFF; - *p++ = 0; - - /* spare ecc layout */ - p = dev->attr->_uffs_ecc_layout; - if (dev->attr->ecc_opt != UFFS_ECC_NONE) { - if (s < TAG_STORE_SIZE + ECC_SIZE(dev)) { - if (s > TAG_STORE_SIZE) { - *p++ = TAG_STORE_SIZE; - *p++ = s - TAG_STORE_SIZE; - } - *p++ = s + 1; - *p++ = TAG_STORE_SIZE + ECC_SIZE(dev) - s; - } - else { - *p++ = TAG_STORE_SIZE; - *p++ = ECC_SIZE(dev); - } - } - *p++ = 0xFF; - *p++ = 0; - } - - dev->attr->data_layout = dev->attr->_uffs_data_layout; - dev->attr->ecc_layout = dev->attr->_uffs_ecc_layout; -} - -static int CalculateSpareDataSize(uffs_Device *dev) -{ - const u8 *p; - int ecc_last = 0, tag_last = 0; - int ecc_size, tag_size; - int n; - - ecc_size = (dev->attr->ecc_opt == UFFS_ECC_NONE ? 0 : ECC_SIZE(dev)); - - p = dev->attr->ecc_layout; - if (p) { - while (*p != 0xFF && ecc_size > 0) { - n = (p[1] > ecc_size ? ecc_size : p[1]); - ecc_last = p[0] + n; - ecc_size -= n; - p += 2; - } - } - - tag_size = TAG_STORE_SIZE; - p = dev->attr->data_layout; - if (p) { - while (*p != 0xFF && tag_size > 0) { - n = (p[1] > tag_size ? tag_size : p[1]); - tag_last = p[0] + n; - tag_size -= n; - p += 2; - } - } - - n = (ecc_last > tag_last ? ecc_last : tag_last); - n = (n > dev->attr->block_status_offs + 1 ? - n : dev->attr->block_status_offs + 1); - - return n + 1; // plus one seal byte. -} - - -/** - * Initialize UFFS flash interface - */ -URET uffs_FlashInterfaceInit(uffs_Device *dev) -{ - URET ret = U_FAIL; - struct uffs_StorageAttrSt *attr = dev->attr; - uffs_Pool *pool = SPOOL(dev); - - if (dev->mem.spare_pool_size == 0) { - if (dev->mem.malloc) { - dev->mem.spare_pool_buf = dev->mem.malloc(dev, UFFS_SPARE_BUFFER_SIZE); - if (dev->mem.spare_pool_buf) - dev->mem.spare_pool_size = UFFS_SPARE_BUFFER_SIZE; - } - } - - if (UFFS_SPARE_BUFFER_SIZE > dev->mem.spare_pool_size) { - uffs_Perror(UFFS_MSG_DEAD, - "Spare buffer require %d but only %d available.", - UFFS_SPARE_BUFFER_SIZE, dev->mem.spare_pool_size); - memset(pool, 0, sizeof(uffs_Pool)); - goto ext; - } - - uffs_Perror(UFFS_MSG_NOISY, - "alloc spare buffers %d bytes.", - UFFS_SPARE_BUFFER_SIZE); - uffs_PoolInit(pool, dev->mem.spare_pool_buf, - dev->mem.spare_pool_size, - UFFS_MAX_SPARE_SIZE, MAX_SPARE_BUFFERS); - - // init flash driver - if (dev->ops->InitFlash) { - if (dev->ops->InitFlash(dev) < 0) - goto ext; - } - - if (dev->ops->WritePage == NULL && dev->ops->WritePageWithLayout == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Flash driver must provide 'WritePage' or 'WritePageWithLayout' function!"); - goto ext; - } - - if (dev->ops->ReadPage == NULL && dev->ops->ReadPageWithLayout == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Flash driver must provide 'ReadPage' or 'ReadPageWithLayout' function!"); - goto ext; - } - - if (dev->attr->layout_opt == UFFS_LAYOUT_UFFS) { - /* sanity check */ - - if (dev->attr->ecc_size == 0 && dev->attr->ecc_opt != UFFS_ECC_NONE) { - dev->attr->ecc_size = NOMINAL_ECC_SIZE(dev); - } - - uffs_Perror(UFFS_MSG_NORMAL, "ECC size %d", dev->attr->ecc_size); - - if ((dev->attr->data_layout && !dev->attr->ecc_layout) || - (!dev->attr->data_layout && dev->attr->ecc_layout)) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Please setup data_layout and ecc_layout, " - "or leave them all NULL !"); - goto ext; - } - - if (!attr->data_layout && !attr->ecc_layout) { -#if defined(CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME) - switch(attr->page_data_size) { - case 512: - attr->ecc_layout = MTD512_LAYOUT_ECC; - attr->data_layout = MTD512_LAYOUT_DATA; - break; - case 2048: - attr->ecc_layout = MTD2K_LAYOUT_ECC; - attr->data_layout = MTD2K_LAYOUT_DATA; - break; - default: - InitSpareLayout(dev); - break; - } -#else - InitSpareLayout(dev); -#endif - } - } - else if (dev->attr->layout_opt == UFFS_LAYOUT_FLASH) { - if (dev->ops->WritePageWithLayout == NULL || dev->ops->ReadPageWithLayout == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "When using UFFS_LAYOUT_FLASH option, " - "flash driver must provide 'WritePageWithLayout' and 'ReadPageWithLayout' function!"); - goto ext; - } - } - else { - uffs_Perror(UFFS_MSG_SERIOUS, "Invalid layout_opt: %d", dev->attr->layout_opt); - goto ext; - } - - if (dev->ops->EraseBlock == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Flash driver MUST implement 'EraseBlock()' function !"); - goto ext; - } - - dev->mem.spare_data_size = CalculateSpareDataSize(dev); - uffs_Perror(UFFS_MSG_NORMAL, "UFFS consume spare data size %d", dev->mem.spare_data_size); - - if (dev->mem.spare_data_size > dev->attr->spare_size) { - uffs_Perror(UFFS_MSG_SERIOUS, "NAND spare(%dB) can't hold UFFS spare data(%dB) !", - dev->attr->spare_size, dev->mem.spare_data_size); - goto ext; - } - - ret = U_SUCC; -ext: - return ret; -} - -/** - * Release UFFS flash interface - */ -URET uffs_FlashInterfaceRelease(uffs_Device *dev) -{ - uffs_Pool *pool; - - pool = SPOOL(dev); - if (pool->mem && dev->mem.free) { - dev->mem.free(dev, pool->mem); - pool->mem = NULL; - dev->mem.spare_pool_size = 0; - } - uffs_PoolRelease(pool); - memset(pool, 0, sizeof(uffs_Pool)); - - // release flash driver - if (dev->ops->ReleaseFlash) { - if (dev->ops->ReleaseFlash(dev) < 0) - return U_FAIL; - } - - return U_SUCC; -} - -/** - * unload spare to tag and ecc. - */ -void uffs_FlashUnloadSpare(uffs_Device *dev, - const u8 *spare, struct uffs_TagStoreSt *ts, u8 *ecc) -{ - u8 *p_tag = (u8 *)ts; - int tag_size = TAG_STORE_SIZE; - int ecc_size = dev->attr->ecc_size; - int n; - const u8 *p; - - // unload ecc - p = dev->attr->ecc_layout; - if (p && ecc) { - while (*p != 0xFF && ecc_size > 0) { - n = (p[1] > ecc_size ? ecc_size : p[1]); - memcpy(ecc, spare + p[0], n); - ecc_size -= n; - ecc += n; - p += 2; - } - } - - // unload tag - if (ts) { - p = dev->attr->data_layout; - while (*p != 0xFF && tag_size > 0) { - n = (p[1] > tag_size ? tag_size : p[1]); - memcpy(p_tag, spare + p[0], n); - tag_size -= n; - p_tag += n; - p += 2; - } - } -} - -/** - * Read tag from page spare - * - * \param[in] dev uffs device - * \param[in] block flash block num - * \param[in] page flash page num - * \param[out] tag tag to be filled - * - * \return #UFFS_FLASH_NO_ERR: success and/or has no flip bits. - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_ECC_FAIL: spare data has flip bits and ecc correct failed. - * #UFFS_FLASH_ECC_OK: spare data has flip bits and corrected by ecc. -*/ -int uffs_FlashReadPageTag(uffs_Device *dev, - int block, int page, uffs_Tags *tag) -{ - uffs_FlashOps *ops = dev->ops; - u8 * spare_buf; - int ret = UFFS_FLASH_UNKNOWN_ERR; - int tmp_ret; - UBOOL is_bad = U_FALSE; - - spare_buf = (u8 *) uffs_PoolGet(SPOOL(dev)); - if (spare_buf == NULL) - goto ext; - - if (ops->ReadPageWithLayout) { - ret = ops->ReadPageWithLayout(dev, block, page, NULL, 0, NULL, tag ? &tag->s : NULL, NULL); - if (tag) - tag->seal_byte = (ret == UFFS_FLASH_NOT_SEALED ? 0xFF : 0); - } - else { - ret = ops->ReadPage(dev, block, page, NULL, 0, NULL, - spare_buf, dev->mem.spare_data_size); - - if (tag) { - tag->seal_byte = SEAL_BYTE(dev, spare_buf); - - if (!UFFS_FLASH_HAVE_ERR(ret)) - uffs_FlashUnloadSpare(dev, spare_buf, &tag->s, NULL); - } - } - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - - if (tag) { - if (!TAG_IS_SEALED(tag)) // not sealed ? don't try tag ECC correction - goto ext; - - if (!TAG_IS_VALID(tag)) { - if (dev->attr->ecc_opt != UFFS_ECC_NONE) { - /* - * There could be a special case if: - * a) tag is sealed (so we are here), and - * b) s.valid == 1 and this bit is a 'bad' bit, and - * c) after tag ECC (corrected by tag ECC) s.valid == 0. - * - * So we need to try tag ECC (don't treat it as bad block if ECC failed) - */ - - struct uffs_TagStoreSt s; - - memcpy(&s, &tag->s, sizeof(s)); - tmp_ret = TagEccCorrect(&s); - - if (tmp_ret <= 0 || !TAG_IS_VALID(tag)) // can not corrected by ECC. - goto ext; - } - else { - goto ext; - } - } - - // do tag ecc correction - if (dev->attr->ecc_opt != UFFS_ECC_NONE) { - ret = TagEccCorrect(&tag->s); - ret = (ret < 0 ? UFFS_FLASH_ECC_FAIL : - (ret > 0 ? UFFS_FLASH_ECC_OK : UFFS_FLASH_NO_ERR)); - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - } - } - -ext: - if (is_bad) { - uffs_BadBlockAdd(dev, block); - uffs_Perror(UFFS_MSG_NORMAL, - "A new bad block (%d) is detected.", block); - } - - if (spare_buf) - uffs_PoolPut(SPOOL(dev), spare_buf); - - return ret; -} - -/** - * Read page data to buf (do ECC error correction if needed) - * \param[in] dev uffs device - * \param[in] block flash block num - * \param[in] page flash page num of the block - * \param[out] buf holding the read out data - * \param[in] skip_ecc skip ecc when reading data from flash - * - * \return #UFFS_FLASH_NO_ERR: success and/or has no flip bits. - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_ECC_FAIL: spare data has flip bits and ecc correct failed. - * #UFFS_FLASH_ECC_OK: spare data has flip bits and corrected by ecc. - * #UFFS_FLASH_CRC_ERR: CRC verification failed. - * #UFFS_FLASH_UNKNOWN_ERR: - * - * \note if skip_ecc is U_TRUE, skip CRC as well. - */ -int uffs_FlashReadPage(uffs_Device *dev, int block, int page, uffs_Buf *buf, UBOOL skip_ecc) -{ - uffs_FlashOps *ops = dev->ops; - struct uffs_StorageAttrSt *attr = dev->attr; - int size = dev->com.pg_size; - u8 ecc_buf[UFFS_MAX_ECC_SIZE]; - u8 ecc_store[UFFS_MAX_ECC_SIZE]; - UBOOL is_bad = U_FALSE; -#ifdef CONFIG_ENABLE_PAGE_DATA_CRC - UBOOL crc_ok = U_TRUE; -#endif - u8 * spare; - - int ret = UFFS_FLASH_UNKNOWN_ERR; - - spare = (u8 *) uffs_PoolGet(SPOOL(dev)); - if (spare == NULL) - goto ext; - - if (ops->ReadPageWithLayout) { - if (skip_ecc) - ret = ops->ReadPageWithLayout(dev, block, page, buf->header, size, NULL, NULL, NULL); - else - ret = ops->ReadPageWithLayout(dev, block, page, buf->header, size, ecc_buf, NULL, ecc_store); - } - else { - if (skip_ecc) - ret = ops->ReadPage(dev, block, page, buf->header, size, NULL, NULL, 0); - else - ret = ops->ReadPage(dev, block, page, buf->header, size, ecc_buf, spare, dev->mem.spare_data_size); - } - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - -#ifdef CONFIG_ENABLE_PAGE_DATA_CRC - if (!skip_ecc) { - crc_ok = (HEADER(buf)->crc == uffs_crc16sum(buf->data, size - sizeof(struct uffs_MiniHeaderSt)) ? U_TRUE : U_FALSE); - - if (crc_ok) - goto ext; // CRC is matched, no need to do ECC correction. - else { - if (dev->attr->ecc_opt == UFFS_ECC_NONE || dev->attr->ecc_opt == UFFS_ECC_HW_AUTO) { - // ECC is not enabled or ecc correction already done, error return immediately, - // otherwise, we try CRC check again after ecc correction. - ret = UFFS_FLASH_CRC_ERR; - goto ext; - } - } - } -#endif - - // make ECC for UFFS_ECC_SOFT - if (attr->ecc_opt == UFFS_ECC_SOFT && !skip_ecc) - uffs_EccMake(buf->header, size, ecc_buf); - - // unload ecc_store if driver doesn't do the layout - if (ops->ReadPageWithLayout == NULL) { - if (!skip_ecc && (attr->ecc_opt == UFFS_ECC_SOFT || attr->ecc_opt == UFFS_ECC_HW)) - uffs_FlashUnloadSpare(dev, spare, NULL, ecc_store); - } - - // check page data ecc - if (!skip_ecc && (dev->attr->ecc_opt == UFFS_ECC_SOFT || dev->attr->ecc_opt == UFFS_ECC_HW)) { - - ret = uffs_EccCorrect(buf->header, size, ecc_store, ecc_buf); - ret = (ret < 0 ? UFFS_FLASH_ECC_FAIL : - (ret > 0 ? UFFS_FLASH_ECC_OK : UFFS_FLASH_NO_ERR)); - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - } - -#ifdef CONFIG_ENABLE_PAGE_DATA_CRC - if (!skip_ecc && !UFFS_FLASH_HAVE_ERR(ret)) { - // Everything seems ok, do CRC check again. - if (HEADER(buf)->crc == uffs_crc16sum(buf->data, size - sizeof(struct uffs_MiniHeaderSt))) { - ret = UFFS_FLASH_CRC_ERR; - goto ext; - } - } -#endif - -ext: - switch(ret) { - case UFFS_FLASH_IO_ERR: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d I/O error", block, page); - break; - case UFFS_FLASH_ECC_FAIL: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d ECC failed", block, page); - ret = UFFS_FLASH_BAD_BLK; // treat ECC FAIL as BAD BLOCK - is_bad = U_TRUE; - break; - case UFFS_FLASH_ECC_OK: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d bit flip corrected by ECC", block, page); - break; - case UFFS_FLASH_BAD_BLK: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d BAD BLOCK found", block, page); - break; - case UFFS_FLASH_UNKNOWN_ERR: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d UNKNOWN error!", block, page); - break; - case UFFS_FLASH_CRC_ERR: - uffs_Perror(UFFS_MSG_NORMAL, "Read block %d page %d CRC failed", block, page); - break; - default: - break; - } - - if (is_bad) - uffs_BadBlockAdd(dev, block); - - if (spare) - uffs_PoolPut(SPOOL(dev), spare); - - - return ret; -} - -/** - * make spare from tag and ecc - * - * \param[in] dev uffs dev - * \param[in] ts uffs tag store, NULL if don't pack tag store - * \param[in] ecc ecc of data, NULL if don't pack ecc - * \param[out] spare output buffer - * \note spare buffer size: dev->mem.spare_data_size, - * all unpacked bytes will be inited 0xFF - */ -void uffs_FlashMakeSpare(uffs_Device *dev, - const uffs_TagStore *ts, const u8 *ecc, u8* spare) -{ - u8 *p_ts = (u8 *)ts; - int ts_size = TAG_STORE_SIZE; - int ecc_size = ECC_SIZE(dev); - int n; - const u8 *p; - - if (!uffs_Assert(spare != NULL, "invalid param")) - return; - - memset(spare, 0xFF, dev->mem.spare_data_size); // initialize as 0xFF. - SEAL_BYTE(dev, spare) = 0; // set seal byte = 0. - - // load ecc - p = dev->attr->ecc_layout; - if (p && ecc) { - while (*p != 0xFF && ecc_size > 0) { - n = (p[1] > ecc_size ? ecc_size : p[1]); - memcpy(spare + p[0], ecc, n); - ecc_size -= n; - ecc += n; - p += 2; - } - } - - p = dev->attr->data_layout; - while (*p != 0xFF && ts_size > 0) { - n = (p[1] > ts_size ? ts_size : p[1]); - memcpy(spare + p[0], p_ts, n); - ts_size -= n; - p_ts += n; - p += 2; - } - - uffs_Assert(SEAL_BYTE(dev, spare) == 0, "Make spare fail!"); -} - -/** - * write the whole page, include data and tag - * - * \param[in] dev uffs device - * \param[in] block - * \param[in] page - * \param[in] buf contains data to be wrote - * \param[in] tag tag to be wrote - * - * \return #UFFS_FLASH_NO_ERR: success. - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_BAD_BLK: a new bad block detected. - */ -int uffs_FlashWritePageCombine(uffs_Device *dev, - int block, int page, - uffs_Buf *buf, uffs_Tags *tag) -{ - uffs_FlashOps *ops = dev->ops; - int size = dev->com.pg_size; - u8 ecc_buf[UFFS_MAX_ECC_SIZE]; - u8 *ecc = NULL; - u8 *spare; - struct uffs_MiniHeaderSt *header; - int ret = UFFS_FLASH_UNKNOWN_ERR; - UBOOL is_bad = U_FALSE; - uffs_Buf *verify_buf; -#ifdef CONFIG_PAGE_WRITE_VERIFY - uffs_Tags chk_tag; -#endif - - spare = (u8 *) uffs_PoolGet(SPOOL(dev)); - if (spare == NULL) - goto ext; - - // setup header - header = HEADER(buf); - memset(header, 0xFF, sizeof(struct uffs_MiniHeaderSt)); - header->status = 0; -#ifdef CONFIG_ENABLE_PAGE_DATA_CRC - header->crc = uffs_crc16sum(buf->data, size - sizeof(struct uffs_MiniHeaderSt)); -#endif - - // setup tag - TAG_DIRTY_BIT(tag) = TAG_DIRTY; //!< set dirty bit - TAG_VALID_BIT(tag) = TAG_VALID; //!< set valid bit - SEAL_TAG(tag); //!< seal tag (the real seal byte will be set in uffs_FlashMakeSpare()) - - if (dev->attr->ecc_opt != UFFS_ECC_NONE) - TagMakeEcc(&tag->s); - else - tag->s.tag_ecc = TAG_ECC_DEFAULT; - - if (dev->attr->ecc_opt == UFFS_ECC_SOFT) { - uffs_EccMake(buf->header, size, ecc_buf); - ecc = ecc_buf; - } - else if (dev->attr->ecc_opt == UFFS_ECC_HW) { - ecc = ecc_buf; - } - - if (ops->WritePageWithLayout) { - ret = ops->WritePageWithLayout(dev, block, page, - buf->header, size, ecc, &tag->s); - } - else { - - if (!uffs_Assert(!(dev->attr->layout_opt == UFFS_LAYOUT_FLASH || - dev->attr->ecc_opt == UFFS_ECC_HW || - dev->attr->ecc_opt == UFFS_ECC_HW_AUTO), "WritePageWithLayout() not implemented ?")) { - ret = UFFS_FLASH_IO_ERR; - goto ext; - } - - uffs_FlashMakeSpare(dev, &tag->s, ecc, spare); - - ret = ops->WritePage(dev, block, page, buf->header, size, spare, dev->mem.spare_data_size); - - } - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - -#ifdef CONFIG_PAGE_WRITE_VERIFY - verify_buf = uffs_BufClone(dev, NULL); - if (verify_buf) { - ret = uffs_FlashReadPage(dev, block, page, verify_buf, U_FALSE); - if (!UFFS_FLASH_HAVE_ERR(ret)) { - if (memcmp(buf->header, verify_buf->header, size) != 0) { - uffs_Perror(UFFS_MSG_NORMAL, - "Page write verify failed (block %d page %d)", - block, page); - ret = UFFS_FLASH_BAD_BLK; - } - } - - uffs_BufFreeClone(dev, verify_buf); - } - else { - uffs_Perror(UFFS_MSG_SERIOUS, "Insufficient buf, clone buf failed."); - } - - ret = uffs_FlashReadPageTag(dev, block, page, &chk_tag); - if (UFFS_FLASH_HAVE_ERR(ret)) - goto ext; - - if (memcmp(&tag->s, &chk_tag.s, sizeof(uffs_TagStore)) != 0) { - uffs_Perror(UFFS_MSG_NORMAL, "Page tag write verify failed (block %d page %d)", - block, page); - ret = UFFS_FLASH_BAD_BLK; - } - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - -#endif -ext: - if (is_bad) - uffs_BadBlockAdd(dev, block); - - if (spare) - uffs_PoolPut(SPOOL(dev), spare); - - return ret; -} - -/** - * mark a clean page tag as 'dirty' and 'invalid'. - * - * \param[in] dev uffs device - * \param[in] bc block info - * \param[in] page - * - * \return #UFFS_FLASH_NO_ERR: success. - * #UFFS_FLASH_IO_ERR: I/O error, expect retry ? - * #UFFS_FLASH_BAD_BLK: a new bad block detected. - */ -int uffs_FlashMarkDirtyPage(uffs_Device *dev, uffs_BlockInfo *bc, int page) -{ - u8 *spare; - uffs_FlashOps *ops = dev->ops; - UBOOL is_bad = U_FALSE; - int ret = UFFS_FLASH_UNKNOWN_ERR; - int block = bc->block; - uffs_Tags *tag = GET_TAG(bc, page); - struct uffs_TagStoreSt *ts = &tag->s; - - spare = (u8 *) uffs_PoolGet(SPOOL(dev)); - if (spare == NULL) - goto ext; - - memset(ts, 0xFF, sizeof(struct uffs_TagStoreSt)); - ts->dirty = TAG_DIRTY; // set only 'dirty' bit, leave 'valid' bit to 1 (invalid). - - if (dev->attr->ecc_opt != UFFS_ECC_NONE) - TagMakeEcc(ts); - - if (ops->WritePageWithLayout) { - ret = ops->WritePageWithLayout(dev, block, page, NULL, 0, NULL, ts); - } - else { - uffs_FlashMakeSpare(dev, ts, NULL, spare); - ret = ops->WritePage(dev, block, page, NULL, 0, spare, dev->mem.spare_data_size); - } - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - is_bad = U_TRUE; - -ext: - if (is_bad) - uffs_BadBlockAdd(dev, block); - - if (spare) - uffs_PoolPut(SPOOL(dev), spare); - - return ret; -} - -/** Mark this block as bad block */ -URET uffs_FlashMarkBadBlock(uffs_Device *dev, int block) -{ - int ret; - uffs_BlockInfo *bc; - - uffs_Perror(UFFS_MSG_NORMAL, "Mark bad block: %d", block); - - bc = uffs_BlockInfoGet(dev, block); - if (bc) { - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); // expire this block, just in case it's been cached before - uffs_BlockInfoPut(dev, bc); - } - - if (dev->ops->MarkBadBlock) - return dev->ops->MarkBadBlock(dev, block) == 0 ? U_SUCC : U_FAIL; - -#ifdef CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - ret = dev->ops->EraseBlock(dev, block); - if (ret != UFFS_FLASH_IO_ERR) { - // note: even EraseBlock return UFFS_FLASH_BAD_BLK, - // we still process it ... not recommended for most NAND flash. -#endif - if (dev->ops->WritePageWithLayout) - ret = dev->ops->WritePageWithLayout(dev, block, 0, NULL, 0, NULL, NULL); - else - ret = dev->ops->WritePage(dev, block, 0, NULL, 0, NULL, 0); - -#ifdef CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - } -#endif - - return ret == UFFS_FLASH_NO_ERR ? U_SUCC : U_FAIL; -} - -/** Is this block a bad block ? */ -UBOOL uffs_FlashIsBadBlock(uffs_Device *dev, int block) -{ - struct uffs_FlashOpsSt *ops = dev->ops; - UBOOL ret = U_FALSE; - - if (ops->IsBadBlock) { - /* if flash driver provide 'IsBadBlock' function, call it */ - ret = (ops->IsBadBlock(dev, block) == 0 ? U_FALSE : U_TRUE); - } - else { - /* otherwise we call ReadPage[WithLayout]() to get bad block status byte */ - /* check the first page */ - if (ops->ReadPageWithLayout) { - ret = (ops->ReadPageWithLayout(dev, block, 0, NULL, 0, NULL, NULL, NULL) - == UFFS_FLASH_BAD_BLK ? U_TRUE : U_FALSE); - } - else { - ret = (ops->ReadPage(dev, block, 0, NULL, 0, NULL, NULL, 0) - == UFFS_FLASH_BAD_BLK ? U_TRUE : U_FALSE); - } - - if (ret == U_FALSE) { - /* check the second page */ - if (ops->ReadPageWithLayout) { - ret = (ops->ReadPageWithLayout(dev, block, 0, NULL, 0, NULL, NULL, NULL) - == UFFS_FLASH_BAD_BLK ? U_TRUE : U_FALSE); - } - else { - ret = (ops->ReadPage(dev, block, 0, NULL, 0, NULL, NULL, 0) - == UFFS_FLASH_BAD_BLK ? U_TRUE : U_FALSE); - } - } - } - - //uffs_Perror(UFFS_MSG_NOISY, "Block %d is %s", block, ret ? "BAD" : "GOOD"); - - return ret; -} - -/** Erase flash block */ -URET uffs_FlashEraseBlock(uffs_Device *dev, int block) -{ - int ret; - uffs_BlockInfo *bc; - - ret = dev->ops->EraseBlock(dev, block); - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - uffs_BadBlockAdd(dev, block); - - bc = uffs_BlockInfoGet(dev, block); - if (bc) { - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); - uffs_BlockInfoPut(dev, bc); - } - return UFFS_FLASH_HAVE_ERR(ret) ? U_FAIL : U_SUCC; -} - -/** - * Check the block by reading all pages. - * - * \return U_SUCC - all pages are clean, - * U_FAIL - block is not clean - */ -URET uffs_FlashCheckErasedBlock(uffs_Device *dev, int block) -{ - u8 *spare = NULL; - uffs_FlashOps *ops = dev->ops; - int ret = U_SUCC; - int page; - int flash_ret; - u8 ecc_store[UFFS_MAX_ECC_SIZE]; - uffs_TagStore ts; - uffs_Buf *buf = NULL; - int size = dev->com.pg_size; - int i; - u8 *p; - - spare = (u8 *) uffs_PoolGet(SPOOL(dev)); - - if (spare == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't allocate spare buf."); - goto ext; - } - - buf = uffs_BufClone(dev, NULL); - - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't clone buf."); - goto ext; - } - - for (page = 0; page < dev->attr->pages_per_block; page++) { - if (ops->ReadPageWithLayout) { - - flash_ret = ops->ReadPageWithLayout(dev, block, page, buf->header, size, NULL, &ts, ecc_store); - - if (flash_ret != UFFS_FLASH_IO_ERR) { - // check page tag, should be all 0xFF - for (i = 0, p = (u8 *)(&ts); i < sizeof(ts); i++, p++) { - if (*p != 0xFF) { - ret = U_FAIL; - goto ext; - } - } - - // for hw or soft ecc, check stored ecc, should be all 0xFF - if (dev->attr->ecc_opt == UFFS_ECC_HW || - dev->attr->ecc_opt == UFFS_ECC_SOFT) - { - for (i = 0, p = ecc_store; i < ECC_SIZE(dev); i++, p++) { - if (*p != 0xFF) { - ret = U_FAIL; - goto ext; - } - } - } - } - } - else { - - flash_ret = ops->ReadPage(dev, block, page, buf->header, size, NULL, spare, dev->attr->spare_size); - if (flash_ret != UFFS_FLASH_IO_ERR) { - // check spare data, should be all 0xFF - for (i = 0, p = spare; i < dev->attr->spare_size; i++, p++) { - if (*p != 0xFF) { - ret = U_FAIL; - goto ext; - } - } - } - } - - if (flash_ret != UFFS_FLASH_IO_ERR) { - // check page data, should be all 0xFF - for (i = 0, p = buf->header; i < size; i++, p++) { - if (*p != 0xFF) { - ret = U_FAIL; - goto ext; - } - } - } - - } - - -ext: - if (spare) - uffs_PoolPut(SPOOL(dev), spare); - - if (buf) - uffs_BufFreeClone(dev, buf); - - - return ret; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_fs.c b/components/dfs/filesystems/uffs/src/uffs/uffs_fs.c deleted file mode 100644 index d467c3ec9..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_fs.c +++ /dev/null @@ -1,1944 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_fs.c - * \brief basic file operations - * \author Ricky Zheng, created 12th May, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_pool.h" -#include "uffs/uffs_ecc.h" -#include "uffs/uffs_badblock.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_utils.h" -#include -#include - -#define PFX "fs : " - -#define GET_OBJ_NODE_SERIAL(obj) \ - ( \ - (obj)->type == UFFS_TYPE_DIR ? \ - (obj)->node->u.dir.serial : (obj)->node->u.file.serial \ - ) - -#define GET_OBJ_NODE_FATHER(obj) \ - ( \ - (obj)->type == UFFS_TYPE_DIR ? \ - (obj)->node->u.dir.parent : (obj)->node->u.file.parent \ - ) - -#define GET_SERIAL_FROM_OBJECT(obj) \ - ((obj)->node ? GET_OBJ_NODE_SERIAL(obj) : obj->serial) - -#define GET_FATHER_FROM_OBJECT(obj) \ - ((obj)->node ? GET_OBJ_NODE_FATHER(obj) : obj->parent) - - -#define GET_BLOCK_FROM_NODE(obj) \ - ( \ - (obj)->type == UFFS_TYPE_DIR ? \ - (obj)->node->u.dir.block : (obj)->node->u.file.block \ - ) - -typedef enum { - eDRY_RUN = 0, - eREAL_RUN, -} RunOptionE; - - -static void do_ReleaseObjectResource(uffs_Object *obj); -static URET do_TruncateObject(uffs_Object *obj, u32 remain, RunOptionE run_opt); - - -static int _object_data[(sizeof(struct uffs_ObjectSt) * MAX_OBJECT_HANDLE) / sizeof(int)]; - -static uffs_Pool _object_pool; - - -uffs_Pool * uffs_GetObjectPool(void) -{ - return &_object_pool; -} - -/** - * initialise object buffers, called by UFFS internal - */ -URET uffs_InitObjectBuf(void) -{ - return uffs_PoolInit(&_object_pool, _object_data, sizeof(_object_data), - sizeof(uffs_Object), MAX_OBJECT_HANDLE); -} - -/** - * Release object buffers, called by UFFS internal - */ -URET uffs_ReleaseObjectBuf(void) -{ - return uffs_PoolRelease(&_object_pool); -} - -/** - * Get free object handlers - */ -int uffs_GetFreeObjectHandlers(void) -{ - int count = 0; - - uffs_GlobalFsLockLock(); - count = uffs_PoolGetFreeCount(&_object_pool); - uffs_GlobalFsLockUnlock(); - - return count; -} - -/** - * Put all object which match dev - */ -int uffs_PutAllObjectBuf(uffs_Device *dev) -{ - int count = 0; - uffs_Object * obj = NULL; - - do { - obj = (uffs_Object *) uffs_PoolFindNextAllocated(&_object_pool, (void *)obj); - if (obj && obj->dev && obj->dev->dev_num == dev->dev_num) { - uffs_PutObject(obj); - count++; - } - } while (obj); - - return count; -} - -/** - * alloc a new object structure - * \return the new object - */ -uffs_Object * uffs_GetObject(void) -{ - uffs_Object * obj; - - obj = (uffs_Object *) uffs_PoolGet(&_object_pool); - if (obj) { - memset(obj, 0, sizeof(uffs_Object)); - obj->attr_loaded = U_FALSE; - obj->open_succ = U_FALSE; - } - - return obj; -} - -/** - * re-initialize an object. - * - * \return U_SUCC or U_FAIL if the object is openned. - */ -URET uffs_ReInitObject(uffs_Object *obj) -{ - if (obj == NULL) - return U_FAIL; - - if (obj->open_succ == U_TRUE) - return U_FAIL; // can't re-init an openned object. - - memset(obj, 0, sizeof(uffs_Object)); - obj->attr_loaded = U_FALSE; - obj->open_succ = U_FALSE; - - return U_SUCC; -} - -/** - * put the object struct back to system - */ -void uffs_PutObject(uffs_Object *obj) -{ - if (obj) - uffs_PoolPut(&_object_pool, obj); -} - -/** - * \return the internal index num of object - */ -int uffs_GetObjectIndex(uffs_Object *obj) -{ - return uffs_PoolGetIndex(&_object_pool, obj); -} - -/** - * \return the object by the internal index - */ -uffs_Object * uffs_GetObjectByIndex(int idx) -{ - return (uffs_Object *) uffs_PoolGetBufByIndex(&_object_pool, idx); -} - -#ifdef CONFIG_PER_DEVICE_LOCK -static void uffs_ObjectDevLock(uffs_Object *obj) -{ - if (obj) { - if (obj->dev) { - uffs_DeviceLock(obj->dev); - obj->dev_lock_count++; - } - } -} - -static void uffs_ObjectDevUnLock(uffs_Object *obj) -{ - if (obj) { - if (obj->dev) { - obj->dev_lock_count--; - uffs_DeviceUnLock(obj->dev); - } - } -} -#else -#define uffs_ObjectDevLock(obj) do { } while (0) -#define uffs_ObjectDevUnLock(obj) do { } while (0) - -#endif - - - -/** - * create a new object and open it if success - */ -URET uffs_CreateObject(uffs_Object *obj, const char *fullname, int oflag) -{ - URET ret = U_FAIL; - - oflag |= UO_CREATE; - - if (uffs_ParseObject(obj, fullname) == U_SUCC) - uffs_CreateObjectEx(obj, obj->dev, obj->parent, - obj->name, obj->name_len, oflag); - - if (obj->err == UENOERR) { - ret = U_SUCC; - } - else { - if (obj->dev) { - uffs_PutDevice(obj->dev); - obj->dev = NULL; - } - ret = U_FAIL; - } - - return ret; -} - - - -/** - * return the dir length from a path. - * for example, path = "abc/def/xyz", return 8 ("abc/def/") - */ -static int GetDirLengthFromPath(const char *path, int path_len) -{ - const char *p = path; - - if (path_len > 0) { - if (path[path_len - 1] == '/') - path_len--; // skip the last '/' - - p = path + path_len - 1; - while (p > path && *p != '/') - p--; - } - - return p - path; -} - -/** - * Create an object under the given dir. - * - * \param[in|out] obj to be created, obj is returned from uffs_GetObject() - * \param[in] dev uffs device - * \param[in] dir object parent dir serial NO. - * \param[in] name point to the object name - * \param[in] name_len object name length - * \param[in] oflag open flag. UO_DIR should be passed for an dir object. - * - * \return U_SUCC or U_FAIL (error code in obj->err). - */ -URET uffs_CreateObjectEx(uffs_Object *obj, uffs_Device *dev, - int dir, const char *name, int name_len, int oflag) -{ - uffs_Buf *buf = NULL; - uffs_FileInfo fi; - TreeNode *node; - - obj->dev = dev; - obj->parent = dir; - obj->type = (oflag & UO_DIR ? UFFS_TYPE_DIR : UFFS_TYPE_FILE); - obj->name = name; - obj->name_len = name_len; - - if (obj->type == UFFS_TYPE_DIR) { - if (name[obj->name_len - 1] == '/') // get rid of ending '/' for dir - obj->name_len--; - } - else { - if (name[obj->name_len - 1] == '/') { // file name can't end with '/' - obj->err = UENOENT; - goto ext; - } - } - - if (obj->name_len == 0) { // empty name ? - obj->err = UENOENT; - goto ext; - } - - obj->sum = uffs_MakeSum16(obj->name, obj->name_len); - - uffs_ObjectDevLock(obj); - - if (obj->type == UFFS_TYPE_DIR) { - //find out whether have file with the same name - node = uffs_TreeFindFileNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - if (node != NULL) { - obj->err = UEEXIST; // we can't create a dir has the - // same name with exist file. - goto ext_1; - } - obj->node = uffs_TreeFindDirNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - if (obj->node != NULL) { - obj->err = UEEXIST; // we can't create a dir already exist. - goto ext_1; - } - } - else { - //find out whether have dir with the same name - node = uffs_TreeFindDirNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - if (node != NULL) { - obj->err = UEEXIST; - goto ext_1; - } - obj->node = uffs_TreeFindFileNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - if (obj->node) { - /* file already exist, truncate it to zero length */ - obj->serial = GET_OBJ_NODE_SERIAL(obj); - obj->open_succ = U_TRUE; // set open_succ to U_TRUE before - // call do_TruncateObject() - if (do_TruncateObject(obj, 0, eDRY_RUN) == U_SUCC) - do_TruncateObject(obj, 0, eREAL_RUN); - goto ext_1; - } - } - - /* dir|file does not exist, create a new one */ - obj->serial = uffs_FindFreeFsnSerial(obj->dev); - if (obj->serial == INVALID_UFFS_SERIAL) { - uffs_Perror(UFFS_MSG_SERIOUS, "No free serial num!"); - obj->err = UENOMEM; - goto ext_1; - } - - if (obj->dev->tree.erased_count < obj->dev->cfg.reserved_free_blocks) { - uffs_Perror(UFFS_MSG_NOISY, - "insufficient block in create obj"); - obj->err = UENOMEM; - goto ext_1; - } - - buf = uffs_BufNew(obj->dev, obj->type, obj->parent, obj->serial, 0); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Can't create new buffer when create obj!"); - goto ext_1; - } - - memset(&fi, 0, sizeof(uffs_FileInfo)); - fi.name_len = obj->name_len < sizeof(fi.name) ? obj->name_len : sizeof(fi.name) - 1; - memcpy(fi.name, obj->name, fi.name_len); - fi.name[fi.name_len] = '\0'; - - fi.access = 0; - fi.attr |= FILE_ATTR_WRITE; - - if (obj->type == UFFS_TYPE_DIR) - fi.attr |= FILE_ATTR_DIR; - - fi.create_time = fi.last_modify = uffs_GetCurDateTime(); - - uffs_BufWrite(obj->dev, buf, &fi, 0, sizeof(uffs_FileInfo)); - uffs_BufPut(obj->dev, buf); - - // flush buffer immediately, - // so that the new node will be inserted into the tree - uffs_BufFlushGroup(obj->dev, obj->parent, obj->serial); - - // update obj->node: after buf flushed, - // the NEW node can be found in the tree - if (obj->type == UFFS_TYPE_DIR) - obj->node = uffs_TreeFindDirNode(obj->dev, obj->serial); - else - obj->node = uffs_TreeFindFileNode(obj->dev, obj->serial); - - if (obj->node == NULL) { - uffs_Perror(UFFS_MSG_NOISY, "Can't find the node in the tree ?"); - obj->err = UEIOERR; - goto ext_1; - } - - if (obj->type == UFFS_TYPE_FILE) - obj->node->u.file.len = 0; //init the length to 0 - - if (HAVE_BADBLOCK(obj->dev)) - uffs_BadBlockRecover(obj->dev); - - obj->open_succ = U_TRUE; - -ext_1: - uffs_ObjectDevUnLock(obj); -ext: - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -/** - * Open object under the given dir. - * - * \param[in|out] obj to be open, obj is returned from uffs_GetObject() - * \param[in] dev uffs device - * \param[in] dir object parent dir serial NO. - * \param[in] name point to the object name - * \param[in] name_len object name length - * \param[in] oflag open flag. UO_DIR should be passed for an dir object. - * - * \return U_SUCC or U_FAIL (error code in obj->err). - */ -URET uffs_OpenObjectEx(uffs_Object *obj, uffs_Device *dev, - int dir, const char *name, int name_len, int oflag) -{ - - obj->err = UENOERR; - obj->open_succ = U_FALSE; - - if (dev == NULL) { - obj->err = UEINVAL; - goto ext; - } - - if ((oflag & (UO_WRONLY | UO_RDWR)) == (UO_WRONLY | UO_RDWR)) { - /* UO_WRONLY and UO_RDWR can't appear together */ - uffs_Perror(UFFS_MSG_NOISY, - "UO_WRONLY and UO_RDWR can't appear together"); - obj->err = UEINVAL; - goto ext; - } - - obj->oflag = oflag; - obj->parent = dir; - obj->type = (oflag & UO_DIR ? UFFS_TYPE_DIR : UFFS_TYPE_FILE); - obj->pos = 0; - obj->dev = dev; - obj->name = name; - obj->name_len = name_len; - - // adjust the name length - if (obj->type == UFFS_TYPE_DIR) { - if (obj->name_len > 0 && name[obj->name_len - 1] == '/') - obj->name_len--; // truncate the ending '/' for dir - } - - obj->sum = (obj->name_len > 0 ? uffs_MakeSum16(name, obj->name_len) : 0); - obj->head_pages = obj->dev->attr->pages_per_block - 1; - - if (obj->type == UFFS_TYPE_DIR) { - if (obj->name_len == 0) { - if (dir != PARENT_OF_ROOT) { - uffs_Perror(UFFS_MSG_SERIOUS, "Bad parent for root dir!"); - obj->err = UEINVAL; - } - else { - obj->serial = ROOT_DIR_SERIAL; - } - goto ext; - } - } - else { - if (obj->name_len == 0 || name[obj->name_len - 1] == '/') { - uffs_Perror(UFFS_MSG_SERIOUS, "Bad file name."); - obj->err = UEINVAL; - } - } - - - uffs_ObjectDevLock(obj); - - if (obj->type == UFFS_TYPE_DIR) { - obj->node = uffs_TreeFindDirNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - } - else { - obj->node = uffs_TreeFindFileNodeByName(obj->dev, obj->name, - obj->name_len, obj->sum, - obj->parent); - } - - if (obj->node == NULL) { // dir or file not exist - if (obj->oflag & UO_CREATE) { // expect to create a new one - uffs_ObjectDevUnLock(obj); - if (obj->name == NULL || obj->name_len == 0) - obj->err = UEEXIST; - else - uffs_CreateObjectEx(obj, dev, dir, obj->name, obj->name_len, oflag); - goto ext; - } - else { - obj->err = UENOENT; - goto ext_1; - } - } - - if ((obj->oflag & (UO_CREATE | UO_EXCL)) == (UO_CREATE | UO_EXCL)){ - obj->err = UEEXIST; - goto ext_1; - } - - obj->serial = GET_OBJ_NODE_SERIAL(obj); - obj->open_succ = U_TRUE; - - if (obj->oflag & UO_TRUNC) - if (do_TruncateObject(obj, 0, eDRY_RUN) == U_SUCC) { - //NOTE: obj->err will be set in do_TruncateObject() if failed. - do_TruncateObject(obj, 0, eREAL_RUN); - } - -ext_1: - uffs_ObjectDevUnLock(obj); -ext: - obj->open_succ = (obj->err == UENOERR ? U_TRUE : U_FALSE); - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - - -/** - * Parse the full path name, initialize obj. - * - * \param[out] obj object to be initialize. - * \param[in] name full path name. - * - * \return U_SUCC if the name is parsed correctly, - * U_FAIL if failed, and obj->err is set. - * - * \note the following fields in obj will be initialized: - * obj->dev - * obj->parent - * obj->name - * obj->name_len - */ -URET uffs_ParseObject(uffs_Object *obj, const char *name) -{ - int len, m_len, d_len; - uffs_Device *dev; - const char *start, *p, *dname; - u16 dir; - TreeNode *node; - u16 sum; - - if (uffs_ReInitObject(obj) == U_FAIL) - return U_FAIL; - - len = strlen(name); - m_len = uffs_GetMatchedMountPointSize(name); - dev = uffs_GetDeviceFromMountPointEx(name, m_len); - - if (dev) { - start = name + m_len; - d_len = GetDirLengthFromPath(start, len - m_len); - p = start; - obj->dev = dev; - if (m_len == len) { - obj->parent = PARENT_OF_ROOT; - obj->name = NULL; - obj->name_len = 0; - } - else { - dir = ROOT_DIR_SERIAL; - dname = start; - while (p - start < d_len) { - while (*p != '/') p++; - sum = uffs_MakeSum16(dname, p - dname); - node = uffs_TreeFindDirNodeByName(dev, dname, p - dname, sum, dir); - if (node == NULL) { - obj->err = UENOENT; - break; - } - else { - dir = node->u.dir.serial; - p++; // skip the '/' - dname = p; - } - } - obj->parent = dir; - obj->name = start + (d_len > 0 ? d_len + 1 : 0); - obj->name_len = len - (d_len > 0 ? d_len + 1 : 0) - m_len; - } - - if (obj->err != UENOERR) { - uffs_PutDevice(obj->dev); - obj->dev = NULL; - } - } - else { - obj->err = UENOENT; - } - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - - -static void do_ReleaseObjectResource(uffs_Object *obj) -{ - if (obj) { - if (obj->dev) { - if (HAVE_BADBLOCK(obj->dev)) - uffs_BadBlockRecover(obj->dev); - if (obj->dev_lock_count > 0) { - uffs_ObjectDevUnLock(obj); - } - uffs_PutDevice(obj->dev); - obj->dev = NULL; - obj->open_succ = U_FALSE; - } - } -} - -/** - * Open a UFFS object - * - * \param[in|out] obj the object to be open - * \param[in] name the full name of the object - * \param[in] oflag open flag - * - * \return U_SUCC if object is opened successfully, - * U_FAIL if failed, error code will be set to obj->err. - */ -URET uffs_OpenObject(uffs_Object *obj, const char *name, int oflag) -{ - URET ret; - - if (obj == NULL) - return U_FAIL; - - if ((ret = uffs_ParseObject(obj, name)) == U_SUCC) { - ret = uffs_OpenObjectEx(obj, obj->dev, obj->parent, - obj->name, obj->name_len, oflag); - } - if (ret != U_SUCC) - do_ReleaseObjectResource(obj); - - return ret; -} - -static URET do_FlushObject(uffs_Object *obj) -{ - uffs_Device *dev; - URET ret = U_SUCC; - TreeNode *node = NULL; - - dev = obj->dev; - if (obj->node) { - node = obj->node; - if (obj->type == UFFS_TYPE_DIR) - ret = uffs_BufFlushGroup(dev, obj->node->u.dir.parent, - obj->node->u.dir.serial); - else { - ret = ( - uffs_BufFlushGroupMatchParent(dev, obj->node->u.file.serial) == U_SUCC && - uffs_BufFlushGroup(dev, obj->node->u.file.parent, obj->node->u.file.serial) == U_SUCC - ) ? U_SUCC : U_FAIL; - } - uffs_Assert(node == obj->node, "obj->node change!\n"); - } - - return ret; -} - -/** - * Flush object data. - * - * \param[in] obj object to be flushed - * \return U_SUCC or U_FAIL (error code in obj->err). - */ -URET uffs_FlushObject(uffs_Object *obj) -{ - if(obj->dev == NULL || obj->open_succ != U_TRUE) { - obj->err = UEBADF; - goto ext; - } - - uffs_ObjectDevLock(obj); - - if (do_FlushObject(obj) != U_SUCC) - obj->err = UEIOERR; - - uffs_ObjectDevUnLock(obj); - -ext: - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -/** - * Close an openned object. - * - * \param[in] obj object to be closed - * \return U_SUCC or U_FAIL (error code in obj->err). - */ -URET uffs_CloseObject(uffs_Object *obj) -{ -#ifdef CONFIG_CHANGE_MODIFY_TIME - uffs_Device *dev; - uffs_Buf *buf; - uffs_FileInfo fi; -#endif - - if(obj->dev == NULL || obj->open_succ != U_TRUE) { - obj->err = UEBADF; - goto ext; - } - - - uffs_ObjectDevLock(obj); - - if (obj->oflag & (UO_WRONLY|UO_RDWR|UO_APPEND|UO_CREATE|UO_TRUNC)) { - -#ifdef CONFIG_CHANGE_MODIFY_TIME - dev = obj->dev; - if (obj->node) { - //need to change the last modify time stamp - if (obj->type == UFFS_TYPE_DIR) - buf = uffs_BufGetEx(dev, UFFS_TYPE_DIR, obj->node, 0, obj->oflag); - else - buf = uffs_BufGetEx(dev, UFFS_TYPE_FILE, obj->node, 0, obj->oflag); - - if(buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get file header"); - do_FlushObject(obj); - uffs_ObjectDevUnLock(obj); - goto ext; - } - uffs_BufRead(dev, buf, &fi, 0, sizeof(uffs_FileInfo)); - fi.last_modify = uffs_GetCurDateTime(); - uffs_BufWrite(dev, buf, &fi, 0, sizeof(uffs_FileInfo)); - uffs_BufPut(dev, buf); - } -#endif - do_FlushObject(obj); - } - - uffs_ObjectDevUnLock(obj); - -ext: - do_ReleaseObjectResource(obj); - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -static u16 GetFdnByOfs(uffs_Object *obj, u32 ofs) -{ - uffs_Device *dev = obj->dev; - - if (ofs < (u32)(obj->head_pages * dev->com.pg_data_size)) { - return 0; - } - else { - ofs -= obj->head_pages * dev->com.pg_data_size; - return (ofs / (dev->com.pg_data_size * dev->attr->pages_per_block)) + 1; - } -} - - -static u32 GetStartOfDataBlock(uffs_Object *obj, u16 fdn) -{ - if (fdn == 0) { - return 0; - } - else { - return (obj->head_pages * obj->dev->com.pg_data_size) + - (fdn - 1) * (obj->dev->com.pg_data_size * - obj->dev->attr->pages_per_block); - } -} - - -static int do_WriteNewBlock(uffs_Object *obj, - const void *data, u32 len, - u16 parent, - u16 serial) -{ - uffs_Device *dev = obj->dev; - u16 page_id; - int wroteSize = 0; - int size; - uffs_Buf *buf; - URET ret; - - for (page_id = 0; page_id < dev->attr->pages_per_block; page_id++) { - size = (len - wroteSize) > dev->com.pg_data_size ? - dev->com.pg_data_size : len - wroteSize; - if (size <= 0) - break; - - buf = uffs_BufNew(dev, UFFS_TYPE_DATA, parent, serial, page_id); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't create a new page ?"); - break; - } - // Note: if data == NULL, we will fill '\0' - ret = uffs_BufWrite(dev, buf, data == NULL ? NULL : (u8 *)data + wroteSize, 0, size); - uffs_BufPut(dev, buf); - - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "write data fail!"); - break; - } - wroteSize += size; - obj->node->u.file.len += size; - } - - return wroteSize; -} - -static int do_WriteInternalBlock(uffs_Object *obj, - TreeNode *node, - u16 fdn, - const void *data, - u32 len, - u32 blockOfs) -{ - uffs_Device *dev = obj->dev; - u16 maxPageID; - u16 page_id; - u32 size; - u32 pageOfs; - u32 wroteSize = 0; - URET ret; - uffs_Buf *buf; - u32 block_start; - u8 type; - u16 parent, serial; - - block_start = GetStartOfDataBlock(obj, fdn); - - if (fdn == 0) { - type = UFFS_TYPE_FILE; - parent = node->u.file.parent; - serial = node->u.file.serial; - } - else { - type = UFFS_TYPE_DATA; - parent = node->u.data.parent; - serial = fdn; - } - - if (fdn == 0) - maxPageID = obj->head_pages; - else - maxPageID = dev->attr->pages_per_block - 1; - - - while (wroteSize < len) { - page_id = blockOfs / dev->com.pg_data_size; - if (fdn == 0) - page_id++; //in file header, page_id start from 1, not 0. - if (page_id > maxPageID) - break; - - pageOfs = blockOfs % dev->com.pg_data_size; - size = (len - wroteSize + pageOfs) > dev->com.pg_data_size ? - (dev->com.pg_data_size - pageOfs) : (len - wroteSize); - - if ((obj->node->u.file.len % dev->com.pg_data_size) == 0 && - (blockOfs + block_start) == obj->node->u.file.len) { - - buf = uffs_BufNew(dev, type, parent, serial, page_id); - - if(buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can create a new buf!"); - break; - } - } - else { - buf = uffs_BufGetEx(dev, type, node, page_id, obj->oflag); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get buffer ?"); - break; - } - } - - // Note: if data == NULL, then we will fill '\0' - ret = uffs_BufWrite(dev, buf, data == NULL ? NULL : (u8 *)data + wroteSize, pageOfs, size); - - uffs_BufPut(dev, buf); - - if (ret == U_FAIL) { - uffs_Perror(UFFS_MSG_SERIOUS, "write inter data fail!"); - break; - } - - wroteSize += size; - blockOfs += size; - - if (block_start + blockOfs > obj->node->u.file.len) - obj->node->u.file.len = block_start + blockOfs; - - } - - return wroteSize; -} - - -/** - * write data to obj, return remain data (0 if all data been written). - */ -static int do_WriteObject(uffs_Object *obj, const void *data, int len) -{ - uffs_Device *dev = obj->dev; - TreeNode *fnode = obj->node; - int remain = len; - u16 fdn; - u32 write_start; - TreeNode *dnode; - u32 size; - - while (remain > 0) { - write_start = obj->pos + len - remain; - if (write_start > fnode->u.file.len) { - uffs_Perror(UFFS_MSG_SERIOUS, "write point out of file ?"); - break; - } - - fdn = GetFdnByOfs(obj, write_start); - - if (write_start == fnode->u.file.len && fdn > 0 && - write_start == GetStartOfDataBlock(obj, fdn)) { - if (dev->tree.erased_count < dev->cfg.reserved_free_blocks) { - uffs_Perror(UFFS_MSG_NOISY, "insufficient block in write obj, new block"); - break; - } - size = do_WriteNewBlock(obj, data ? (u8 *)data + len - remain : NULL, - remain, fnode->u.file.serial, fdn); - - // - // Flush the new block buffers immediately, so that the new data node will be - // created and put in the tree. - // - // But before do that, we need to make sure the previous - // data block (if exist) been flushed first. - // - if (fdn > 1) { - uffs_BufFlushGroup(dev, fnode->u.file.serial, fdn - 1); - } - else { - uffs_BufFlushGroup(dev, fnode->u.file.parent, fnode->u.file.serial); - } - // Now flush the new block. - uffs_BufFlushGroup(dev, fnode->u.file.serial, fdn); - - if (size == 0) - break; - - remain -= size; - } - else { - - if(fdn == 0) - dnode = obj->node; - else - dnode = uffs_TreeFindDataNode(dev, fnode->u.file.serial, fdn); - - if(dnode == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't find data node in tree ?"); - obj->err = UEUNKNOWN_ERR; - break; - } - size = do_WriteInternalBlock(obj, dnode, fdn, - data ? (u8 *)data + len - remain : NULL, remain, - write_start - GetStartOfDataBlock(obj, fdn)); -#ifdef CONFIG_FLUSH_BUF_AFTER_WRITE - if (fdn == 0) - uffs_BufFlushGroup(dev, fnode->u.file.parent, fnode->u.file.serial); - else - uffs_BufFlushGroup(dev, fnode->u.file.serial, fdn); -#endif - if (size == 0) - break; - - remain -= size; - } - } - - uffs_Assert(fnode == obj->node, "obj->node change!\n"); - - return remain; -} - - -/** - * write data to obj, from obj->pos - * - * \param[in] obj file obj - * \param[in] data data pointer - * \param[in] len length of data to be write - * - * \return bytes wrote to obj - */ -int uffs_WriteObject(uffs_Object *obj, const void *data, int len) -{ - uffs_Device *dev = obj->dev; - TreeNode *fnode = NULL; - int remain; - u32 pos; - int wrote = 0; - - if (obj == NULL) - return 0; - - if (obj->dev == NULL || obj->open_succ != U_TRUE) { - obj->err = UEBADF; - return 0; - } - - if (obj->type == UFFS_TYPE_DIR) { - uffs_Perror(UFFS_MSG_NOISY, "Can't write to an dir object!"); - obj->err = UEACCES; - return 0; - } - - if (obj->oflag == UO_RDONLY) { - obj->err = UEACCES; // can't write to 'read only' mode opened file - return 0; - } - - fnode = obj->node; - - uffs_ObjectDevLock(obj); - - if (obj->oflag & UO_APPEND) - obj->pos = fnode->u.file.len; - else { - if (obj->pos > fnode->u.file.len) { - // current pos pass over the end of file, need to fill the gap with '\0' - pos = obj->pos; // save desired pos - obj->pos = fnode->u.file.len; // filling gap from the end of the file. - remain = do_WriteObject(obj, NULL, pos - fnode->u.file.len); // Write filling bytes. Note: the filling data does not count as 'wrote' in this write operation. - obj->pos = pos - remain; - if (remain > 0) // fail to fill the gap ? stop. - goto ext; - } - } - - remain = do_WriteObject(obj, data, len); - wrote = len - remain; - obj->pos += wrote; - -ext: - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockRecover(dev); - - uffs_ObjectDevUnLock(obj); - - uffs_Assert(fnode == obj->node, "obj->node change!\n"); - - return wrote; -} - -/** - * read data from obj - * - * \param[in] obj uffs object - * \param[out] data output data buffer - * \param[in] len required length of data to be read from object->pos - * - * \return return bytes of data have been read - */ -int uffs_ReadObject(uffs_Object *obj, void *data, int len) -{ - uffs_Device *dev = obj->dev; - TreeNode *fnode = NULL; - u32 remain = len; - u16 fdn; - u32 read_start; - TreeNode *dnode; - u32 size; - uffs_Buf *buf; - u32 blockOfs; - u16 page_id; - u8 type; - u32 pageOfs; - - if (obj == NULL) - return 0; - - fnode = obj->node; - - if (obj->dev == NULL || obj->open_succ == U_FALSE) { - obj->err = UEBADF; - return 0; - } - - if (obj->type == UFFS_TYPE_DIR) { - uffs_Perror(UFFS_MSG_NOISY, "Can't read data from a dir object!"); - obj->err = UEBADF; - return 0; - } - - if (obj->pos > fnode->u.file.len) { - return 0; //can't read file out of range - } - - if (obj->oflag & UO_WRONLY) { - obj->err = UEACCES; - return 0; - } - - uffs_ObjectDevLock(obj); - - while (remain > 0) { - read_start = obj->pos + len - remain; - if (read_start >= fnode->u.file.len) { - //uffs_Perror(UFFS_MSG_NOISY, "read point out of file ?"); - break; - } - - fdn = GetFdnByOfs(obj, read_start); - if (fdn == 0) { - dnode = obj->node; - type = UFFS_TYPE_FILE; - } - else { - type = UFFS_TYPE_DATA; - dnode = uffs_TreeFindDataNode(dev, fnode->u.file.serial, fdn); - if (dnode == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get data node in entry!"); - obj->err = UEUNKNOWN_ERR; - break; - } - } - - blockOfs = GetStartOfDataBlock(obj, fdn); - page_id = (read_start - blockOfs) / dev->com.pg_data_size; - - if (fdn == 0) { - /** - * fdn == 0: this means that the reading is start from the first block, - * since the page 0 is for file attr, so we move to the next page ID. - */ - page_id++; - } - - buf = uffs_BufGetEx(dev, type, dnode, (u16)page_id, obj->oflag); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get buffer when read obj."); - obj->err = UEIOERR; - break; - } - - pageOfs = read_start % dev->com.pg_data_size; - if (pageOfs >= buf->data_len) { - //uffs_Perror(UFFS_MSG_NOISY, "read data out of page range ?"); - uffs_BufPut(dev, buf); - break; - } - size = (remain + pageOfs > buf->data_len ? buf->data_len - pageOfs : remain); - - uffs_BufRead(dev, buf, (u8 *)data + len - remain, pageOfs, size); - uffs_BufPut(dev, buf); - - remain -= size; - } - - obj->pos += (len - remain); - - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockRecover(dev); - - uffs_ObjectDevUnLock(obj); - - uffs_Assert(fnode == obj->node, "obj->node change!\n"); - - return len - remain; -} - -/** - * move the file pointer - * - * \param[in] obj uffs object - * \param[in] offset offset from origin - * \param[in] origin the origin position, one of: - * #USEEK_CUR, #USEEK_SET or #USEEK_END - * - * \return the new file pointer position if success, - * or -1 if the new position would be negative. - */ -long uffs_SeekObject(uffs_Object *obj, long offset, int origin) -{ - if (obj->type == UFFS_TYPE_DIR) { - uffs_Perror(UFFS_MSG_NOISY, "Can't seek a dir object!"); - obj->err = UEACCES; - } - else { - uffs_ObjectDevLock(obj); - switch (origin) { - case USEEK_CUR: - if ((long)obj->pos + offset < 0) { - obj->err = UEINVAL; - } - else { - obj->pos += offset; - } - break; - case USEEK_SET: - if (offset < 0) { - obj->err = UEINVAL; - } - else { - obj->pos = offset; - } - break; - case USEEK_END: - if ((long)obj->node->u.file.len + offset < 0) { - obj->err = UEINVAL; - } - else { - obj->pos = obj->node->u.file.len + offset; - } - break; - } - uffs_ObjectDevUnLock(obj); - } - - return (obj->err == UENOERR ? (long)obj->pos : -1); -} - -/** - * get current file pointer - * - * \param[in] obj uffs object - * - * \return return the file pointer position if the obj is valid, - * return -1 if obj is invalid. - */ -int uffs_GetCurOffset(uffs_Object *obj) -{ - if (obj) { - if (obj->dev && obj->open_succ == U_TRUE) - return obj->pos; - } - return -1; -} - -/** - * check whether the file pointer is at the end of file - * - * \param[in] obj uffs object - * - * \return return 1 if file pointer is at the end of file, - * return -1 if error occur, else return 0. - */ -int uffs_EndOfFile(uffs_Object *obj) -{ - if (obj) { - if (obj->dev && obj->type == UFFS_TYPE_FILE && obj->open_succ == U_TRUE) { - if (obj->pos >= obj->node->u.file.len) { - return 1; - } - else { - return 0; - } - } - } - - return -1; -} - -// -// To trancate the file, this is the last block to be trancated. -// We need to discard one or more pages within this block, hence requires 'block recover'. -// -static URET do_TruncateInternalWithBlockRecover(uffs_Object *obj, - u16 fdn, u32 remain, RunOptionE run_opt) -{ - uffs_Device *dev = obj->dev; - TreeNode *fnode = obj->node; - u16 page_id, max_page_id; - TreeNode *node; - uffs_Buf *buf = NULL; - u8 type; - u32 block_start; - u16 parent, serial; - int slot; - uffs_BlockInfo *bc = NULL; - int block = -1; - - if (fdn == 0) { - node = fnode; - type = UFFS_TYPE_FILE; - max_page_id = obj->head_pages; - block_start = 0; - parent = node->u.file.parent; - serial = node->u.file.serial; - block = node->u.file.block; - } - else { - node = uffs_TreeFindDataNode(dev, fnode->u.file.serial, fdn); - if (node == NULL) { - obj->err = UEIOERR; - uffs_Perror(UFFS_MSG_SERIOUS, - "can't find data node when truncate obj"); - goto ext; - } - block = node->u.data.block; - type = UFFS_TYPE_DATA; - max_page_id = dev->attr->pages_per_block - 1; - block_start = obj->head_pages * dev->com.pg_data_size + - (fdn - 1) * dev->com.pg_data_size * - dev->attr->pages_per_block; - parent = node->u.data.parent; - serial = node->u.data.serial; - } - - if (run_opt == eDRY_RUN) { - // checking the buffer. this is the main reason why we need the 'dry run' mode. - for (page_id = 0; page_id <= max_page_id; page_id++) { - buf = uffs_BufFind(dev, parent, serial, page_id); - if (buf) { - //!< ok, the buffer was loaded before ... - if (uffs_BufIsFree(buf) == U_FALSE) { - obj->err = UEEXIST; - break; //!< and someone is still holding the buffer, - // can't truncate it !!! - } - } - } - buf = NULL; - goto ext; - } - - // find the last page *after* truncate - for (page_id = (fdn == 0 ? 1 : 0); page_id <= max_page_id; page_id++) { - if (block_start + (page_id + 1) * dev->com.pg_data_size >= remain) - break; - } - - if (!uffs_Assert(page_id <= max_page_id, "fdn = %d, block_start = %d, remain = %d\n", fdn, block_start, remain)) { - obj->err = UEUNKNOWN_ERR; - goto ext; - } - - // flush buffer before performing block recovery - uffs_BufFlushGroup(dev, parent, serial); - - // load the last page - buf = uffs_BufGetEx(dev, type, node, page_id, obj->oflag); - if (buf == NULL) { - obj->err = UENOMEM; - uffs_Perror(UFFS_MSG_SERIOUS, "Can't get buf"); - goto ext; - } - - uffs_BufWrite(dev, buf, NULL, 0, 0); // just make this buf dirty - - // lock the group - slot = uffs_BufFindGroupSlot(dev, parent, serial); - uffs_BufLockGroup(dev, slot); - - if (remain == 0) // remain == 0: means discard all data in this block. - buf->data_len = 0; - else { - remain = (remain % dev->com.pg_data_size); - // remain == 0: means that we need to keep all data in this page. - buf->data_len = (remain == 0 ? dev->com.pg_data_size : remain); - } - - /* mark this buf as UFFS_BUF_EXT_MARK_TRUNC_TAIL, when flushing - dirty buffers, UFFS will not do page recover for pages after - this buf page id (because this file is ended at this page) */ - buf->ext_mark |= UFFS_BUF_EXT_MARK_TRUNC_TAIL; - - uffs_BufPut(dev, buf); - - // invalidate the rest page buf - page_id++; - for (; page_id <= max_page_id; page_id++) { - buf = uffs_BufFind(dev, parent, serial, page_id); - if (buf) - uffs_BufMarkEmpty(dev, buf); - } - - // flush dirty buffer immediately, forcing block recovery. - uffs_BufFlushGroupEx(dev, parent, serial, U_TRUE); - - // unlock the group - uffs_BufUnLockGroup(dev, slot); - - // Invalidate block info cache for the 'old' block - bc = uffs_BlockInfoGet(dev, block); - if (bc) { - uffs_BlockInfoExpire(dev, bc, UFFS_ALL_PAGES); - uffs_BlockInfoPut(dev, bc); - } - -ext: - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -/** - * truncate an object - * - * \param[in] obj object to be truncated - * \param[in] remain data bytes to be remained in this object - * - * \return U_SUCC or U_FAIL (error code in obj->err) - */ -URET uffs_TruncateObject(uffs_Object *obj, u32 remain) -{ - uffs_ObjectDevLock(obj); - if (do_TruncateObject(obj, remain, eDRY_RUN) == U_SUCC) - do_TruncateObject(obj, remain, eREAL_RUN); - uffs_ObjectDevUnLock(obj); - - uffs_FlushObject(obj); - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -/** truncate obj without lock device */ -static URET do_TruncateObject(uffs_Object *obj, u32 remain, RunOptionE run_opt) -{ - uffs_Device *dev = obj->dev; - TreeNode *fnode = obj->node; - u16 fdn; - u32 flen; - u32 block_start; - TreeNode *node; - uffs_BlockInfo *bc; - uffs_Buf *buf; - u16 page; - int pos; - - pos = obj->pos; // save current file position - - if (obj->dev == NULL || obj->open_succ == U_FALSE || fnode == NULL) { - obj->err = UEBADF; - goto ext; - } - - /* can't truncate a dir */ - /* TODO: delete files under dir ? */ - if (obj->type == UFFS_TYPE_DIR) { - obj->err = UEEXIST; - goto ext; - } - - if (remain >= fnode->u.file.len) { - goto ext; //!< nothing to do ... - } - - flen = fnode->u.file.len; - - if (flen < remain) { - // file is shorter than 'reamin', fill the gap with '\0' - if (run_opt == eREAL_RUN) { - obj->pos = flen; // move file pointer to the end - if (do_WriteObject(obj, NULL, remain - flen) > 0) { // fill '\0' ... - uffs_Perror(UFFS_MSG_SERIOUS, "Write object not finished. expect %d but only %d wrote.", - remain - flen, fnode->u.file.len - flen); - obj->err = UEIOERR; // likely be an I/O error. - } - flen = obj->node->u.file.len; - } - } - else { - while (flen > remain) { - fdn = GetFdnByOfs(obj, flen - 1); - - //uffs_BufFlushGroup(dev, obj->serial, fdn); //!< flush the buffer - - block_start = GetStartOfDataBlock(obj, fdn); - if (remain <= block_start && fdn > 0) { - node = uffs_TreeFindDataNode(dev, obj->serial, fdn); - if (node == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "can't find data node when trancate obj."); - obj->err = UEIOERR; - goto ext; - } - bc = uffs_BlockInfoGet(dev, node->u.data.block); - if (bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "can't get block info when trancate obj."); - obj->err = UEIOERR; - goto ext; - } - - for (page = 0; page < dev->attr->pages_per_block; page++) { - buf = uffs_BufFind(dev, fnode->u.file.serial, fdn, page); - if (buf) { - //!< ok, the buffer was loaded before ... - if (uffs_BufIsFree(buf) == U_FALSE) { - uffs_BlockInfoPut(dev, bc); - goto ext; //!< and someone is still holding the buffer, - // can't truncate it !!! - } - else if (run_opt == eREAL_RUN) - uffs_BufMarkEmpty(dev, buf); //!< discard the buffer - } - } - - if (run_opt == eREAL_RUN) { - uffs_BreakFromEntry(dev, UFFS_TYPE_DATA, node); - uffs_FlashEraseBlock(dev, bc->block); - node->u.list.block = bc->block; - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - - fnode->u.file.len = block_start; - } - - flen = block_start; - uffs_BlockInfoPut(dev, bc); - } - else { - if (do_TruncateInternalWithBlockRecover(obj, fdn, - remain, run_opt) == U_SUCC) { - if (run_opt == eREAL_RUN) - fnode->u.file.len = remain; - flen = remain; - } - } - } - } - - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockRecover(dev); -ext: - obj->pos = pos; // keep file pointer offset not changed. - - uffs_Assert(fnode == obj->node, "obj->node change!\n"); - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); - -} - -/** - * \brief check if there are anyone holding buf of this obj. - * If no one holding the buffers, expire the buffer. - * \return - * 0 : no one holding any buf of this obj - * >0 : the ref_count of buf which refer to this obj. - */ -int _CheckObjBufRef(uffs_Object *obj) -{ - uffs_Device *dev = obj->dev; - uffs_Buf *buf; - TreeNode *node = obj->node; - u16 parent, serial, last_serial; - - // check the DIR or FILE block - for (buf = uffs_BufFind(dev, obj->parent, obj->serial, UFFS_ALL_PAGES); - buf != NULL; - buf = uffs_BufFindFrom(dev, buf->next, obj->parent, obj->serial, UFFS_ALL_PAGES)) - { - if (buf->ref_count > 0) { - // oops ... - uffs_Perror(UFFS_MSG_SERIOUS, "someone still hold buf parent = %d, serial = %d, ref_count", - obj->parent, obj->serial, buf->ref_count); - - return buf->ref_count; - } - else { - buf->mark = UFFS_BUF_EMPTY; - } - } - - if (buf == NULL || buf->ref_count == 0) { - // check the DATA block - if (obj->type == UFFS_TYPE_FILE && node->u.file.len > 0) { - - parent = obj->serial; - last_serial = GetFdnByOfs(obj, node->u.file.len - 1); - for (serial = 1; serial <= last_serial; serial++) { - - for (buf = uffs_BufFind(dev, parent, serial, UFFS_ALL_PAGES); - buf != NULL; - buf = uffs_BufFindFrom(dev, buf->next, parent, serial, UFFS_ALL_PAGES)) - { - if (buf->ref_count != 0) { - // oops ... - uffs_Perror(UFFS_MSG_SERIOUS, "someone still hold buf parent = %d, serial = %d, ref_count", - parent, serial, buf->ref_count); - - return buf->ref_count; - } - else { - buf->mark = UFFS_BUF_EMPTY; - } - } - } - } - } - - return 0; -} - - - -/** - * \brief delete uffs object - * - * \param[in] name full name of object - * \param[out] err return error code - * - * \return U_SUCC if object is deleted successfully. - * return U_FAIL if error happen, error code is set to *err. - */ -URET uffs_DeleteObject(const char * name, int *err) -{ - uffs_Object *obj, *work; - TreeNode *node, *d_node; - uffs_Device *dev = NULL; - u16 block; - u16 serial, parent, last_serial; - UBOOL bad = U_FALSE; - URET ret = U_FAIL; - - obj = uffs_GetObject(); - if (obj == NULL) { - if (err) - *err = UEMFILE; - goto ext_unlock; - } - - if (uffs_OpenObject(obj, name, UO_RDWR|UO_DIR) == U_FAIL) { - if (uffs_OpenObject(obj, name, UO_RDWR) == U_FAIL) { - if (err) - *err = UENOENT; - goto ext_unlock; - } - } - - dev = obj->dev; - - // working throught object pool see if the object is opened ... - uffs_ObjectDevLock(obj); - work = NULL; - while ((work = (uffs_Object *)uffs_PoolFindNextAllocated(&_object_pool, work)) != NULL) { - if (work != obj && - work->dev && - work->dev == obj->dev && - work->node && - work->node == obj->node) { - // this object is opened, can't delete it. - if (err) - *err = UEACCES; - goto ext_lock; - } - } - - if (obj->type == UFFS_TYPE_DIR) { - // if the dir is not empty, can't delete it. - node = uffs_TreeFindDirNodeWithParent(dev, obj->serial); - if (node != NULL) { - if (err) - *err = UEACCES; - goto ext_lock; //have sub dirs ? - } - - node = uffs_TreeFindFileNodeWithParent(dev, obj->serial); - if (node != NULL) { - if (err) - *err = UEACCES; - goto ext_lock; //have sub files ? - } - } - - // before erase the block, we need to take care of the buffer ... - uffs_BufFlushAll(dev); - - if (_CheckObjBufRef(obj) > 0) { - if (err) - *err = UEACCES; - goto ext_lock; - } - - node = obj->node; - - // ok, now we are safe to erase DIR/FILE block :-) - block = GET_BLOCK_FROM_NODE(obj); - parent = obj->serial; - last_serial = (obj->type == UFFS_TYPE_FILE && node->u.file.len > 0 ? GetFdnByOfs(obj, node->u.file.len - 1) : 0); - - uffs_BreakFromEntry(dev, obj->type, node); - uffs_FlashEraseBlock(dev, block); - node->u.list.block = block; - node->u.list.u.serial = obj->serial; - - // From now on, the object is gone physically, - // but we need to 'suspend' this node so that no one will re-use - // the serial number during deleting the reset part of object. - - if (HAVE_BADBLOCK(dev)) { - uffs_BadBlockProcessSuspend(dev, node); - bad = U_TRUE; // will be put into 'bad' list later - } - else { - uffs_TreeSuspendAdd(dev, node); - bad = U_FALSE; // will be put into erased list later - } - - // now erase DATA blocks - if (obj->type == UFFS_TYPE_FILE && last_serial > 0) { - for (serial = 1; serial <= last_serial; serial++) { - - uffs_ObjectDevUnLock(obj); - ; // yield CPU to improve responsive when deleting large file. - uffs_ObjectDevLock(obj); - - d_node = uffs_TreeFindDataNode(dev, parent, serial); - if (uffs_Assert(d_node != NULL, "Can't find DATA node parent = %d, serial = %d\n", parent, serial)) { - uffs_BreakFromEntry(dev, UFFS_TYPE_DATA, d_node); - block = d_node->u.data.block; - uffs_FlashEraseBlock(dev, block); - d_node->u.list.block = block; - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, d_node); - else - uffs_TreeInsertToErasedListTail(dev, d_node); - } - } - } - - // now process the suspend node - uffs_TreeRemoveSuspendNode(dev, node); - if (bad) - uffs_TreeInsertToBadBlockList(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - - ret = U_SUCC; - -ext_lock: - uffs_ObjectDevUnLock(obj); -ext_unlock: - do_ReleaseObjectResource(obj); - - uffs_PutObject(obj); - - return ret; -} - -/** - * Remove object under a new parent, change object name. - * - * \param[in|out] obj - * \param[in] new_parent new parent's serial number - * \param[in] new_name new name of the object. - * if new_name == NULL, keep the old name. - * \param[in] name_len new name length. - * - * \return U_SUCC or U_FAIL (obj->err for the reason) - */ -URET uffs_MoveObjectEx(uffs_Object *obj, - int new_parent, const char *new_name, int name_len) -{ - uffs_Buf *buf; - uffs_FileInfo fi; - uffs_Device *dev = obj->dev; - TreeNode *node = obj->node; - - if (dev == NULL || node == NULL || obj->open_succ != U_TRUE) { - obj->err = UEBADF; - goto ext; - } - - uffs_ObjectDevLock(obj); - - obj->parent = new_parent; - - if (name_len > 0) { - - buf = uffs_BufGetEx(dev, obj->type, node, 0, obj->oflag); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get buf when rename!"); - obj->err = UEIOERR; - goto ext_1; - } - - memcpy(&fi, buf->data, sizeof(uffs_FileInfo)); - - if (new_name[name_len-1] == '/') - name_len--; - - memcpy(fi.name, new_name, name_len); - fi.name[name_len] = 0; - fi.name_len = name_len; - fi.last_modify = uffs_GetCurDateTime(); - - buf->parent = new_parent; // !! need to manually change the 'parent' !! - uffs_BufWrite(dev, buf, &fi, 0, sizeof(uffs_FileInfo)); - uffs_BufPut(dev, buf); - - // !! force a block recover so that all old tag will be expired !! - // This is important so we only need to check - // the first spare when mount UFFS :) - uffs_BufFlushGroupEx(dev, obj->parent, obj->serial, U_TRUE); - - obj->name = new_name; - obj->name_len = name_len; - obj->sum = uffs_MakeSum16(fi.name, fi.name_len); - } - - //update the check sum and new parent of tree node - if (obj->type == UFFS_TYPE_DIR) { - obj->node->u.dir.checksum = obj->sum; - obj->node->u.dir.parent = new_parent; - } - else { - obj->node->u.file.checksum = obj->sum; - obj->node->u.file.parent = new_parent; - } - -ext_1: - uffs_ObjectDevUnLock(obj); -ext: - - return (obj->err == UENOERR ? U_SUCC : U_FAIL); -} - -/** - * \brief rename(move) file or dir. - * \return U_SUCC if success, otherwise return U_FAIL and set error code to *err. - * \note rename/move file between different mount point is not allowed. - */ -URET uffs_RenameObject(const char *old_name, const char *new_name, int *err) -{ - uffs_Object *obj = NULL, *new_obj = NULL; - URET ret = U_FAIL; - int oflag; - - obj = uffs_GetObject(); - new_obj = uffs_GetObject(); - - if (obj == NULL || new_obj == NULL) { - if (err) - *err = UEINVAL; - goto ext; - } - - oflag = UO_RDONLY; - if (uffs_OpenObject(new_obj, new_name, oflag) == U_SUCC) { - uffs_CloseObject(new_obj); - uffs_Perror(UFFS_MSG_NOISY, "new object already exist!"); - if (err) - *err = UEEXIST; - goto ext; - } - oflag |= UO_DIR; - if (uffs_OpenObject(new_obj, new_name, oflag) == U_SUCC) { - uffs_CloseObject(new_obj); - uffs_Perror(UFFS_MSG_NOISY, "new object already exist!"); - if (err) - *err = UEEXIST; - goto ext; - } - - if (uffs_ParseObject(new_obj, new_name) != U_SUCC) { - uffs_Perror(UFFS_MSG_NOISY, "parse new name fail !"); - if (err) - *err = UENOENT; - goto ext; - } - - if (new_obj->name_len == 0) { - uffs_Perror(UFFS_MSG_NOISY, "invalid new name"); - if (err) - *err = UEINVAL; - goto ext; - } - - oflag = UO_RDONLY; - if (uffs_OpenObject(obj, old_name, oflag) != U_SUCC) { - oflag |= UO_DIR; - if (uffs_OpenObject(obj, old_name, oflag) != U_SUCC) { - uffs_Perror(UFFS_MSG_NOISY, "Can't open old object !"); - if (err) - *err = UEACCES; - goto ext; - } - } - - if (obj->dev != new_obj->dev) { - uffs_Perror(UFFS_MSG_NOISY, - "Can't move object between different mount point"); - if (err) - *err = UEACCES; - } - else { - ret = uffs_MoveObjectEx(obj, new_obj->parent, - new_obj->name, new_obj->name_len); - if (ret == U_FAIL && err) - *err = obj->err; - } - - uffs_CloseObject(obj); - -ext: - if (obj) uffs_PutObject(obj); - if (new_obj) { - do_ReleaseObjectResource(new_obj); - uffs_PutObject(new_obj); - } - - return ret; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_init.c b/components/dfs/filesystems/uffs/src/uffs/uffs_init.c deleted file mode 100644 index bc0a5ca89..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_init.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_init.c - * \brief initialize uffs file system device - * \author Ricky Zheng, created 12th May, 2005 - */ - -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_tree.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_badblock.h" -#include "uffs/uffs_utils.h" -#include - -#define PFX "init: " - -static URET uffs_InitDeviceConfig(uffs_Device *dev) -{ - if (dev->cfg.dirty_groups == 0) - dev->cfg.dirty_groups = MAX_DIRTY_BUF_GROUPS; - - if (!uffs_Assert(dev->cfg.dirty_groups >= 1 && dev->cfg.dirty_groups <= MAX_DIRTY_BUF_GROUPS, - "invalid config: dirty_groups = %d\n", dev->cfg.dirty_groups)) - return U_FAIL; - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0 - dev->cfg.bc_caches = MAX_CACHED_BLOCK_INFO; - dev->cfg.page_buffers = MAX_PAGE_BUFFERS; - dev->cfg.dirty_pages = MAX_DIRTY_PAGES_IN_A_BLOCK; - dev->cfg.reserved_free_blocks = MINIMUN_ERASED_BLOCK; -#else - if (dev->cfg.bc_caches == 0) - dev->cfg.bc_caches = MAX_CACHED_BLOCK_INFO; - if (dev->cfg.page_buffers == 0) - dev->cfg.page_buffers = MAX_PAGE_BUFFERS; - if (dev->cfg.dirty_pages == 0) - dev->cfg.dirty_pages = MAX_DIRTY_PAGES_IN_A_BLOCK; - if (dev->cfg.reserved_free_blocks == 0) - dev->cfg.reserved_free_blocks = MINIMUN_ERASED_BLOCK; - - if (!uffs_Assert(dev->cfg.page_buffers - CLONE_BUFFERS_THRESHOLD >= 3, "invalid config: page_buffers = %d\n", dev->cfg.page_buffers)) - return U_FAIL; - -#endif - return U_SUCC; -} - -URET uffs_InitDevice(uffs_Device *dev) -{ - URET ret; - - ret = uffs_InitDeviceConfig(dev); - if (ret != U_SUCC) - return U_FAIL; - - if (dev->mem.init) { - if (dev->mem.init(dev) != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "Init memory allocator fail."); - return U_FAIL; - } - } - - memset(&(dev->st), 0, sizeof(uffs_FlashStat)); - - uffs_DeviceInitLock(dev); - uffs_BadBlockInit(dev); - - - if (uffs_FlashInterfaceInit(dev) != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "Can't initialize flash interface !"); - goto fail; - } - - uffs_Perror(UFFS_MSG_NOISY, "init page buf"); - ret = uffs_BufInit(dev, dev->cfg.page_buffers, dev->cfg.dirty_pages); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_DEAD, "Initialize page buffers fail"); - goto fail; - } - uffs_Perror(UFFS_MSG_NOISY, "init block info cache"); - ret = uffs_BlockInfoInitCache(dev, dev->cfg.bc_caches); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_DEAD, "Initialize block info fail"); - goto fail; - } - - ret = uffs_TreeInit(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to init tree buffers"); - goto fail; - } - - ret = uffs_BuildTree(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to build tree"); - goto fail; - } - - return U_SUCC; - -fail: - uffs_DeviceReleaseLock(dev); - - return U_FAIL; -} - -URET uffs_ReleaseDevice(uffs_Device *dev) -{ - URET ret; - - ret = uffs_BlockInfoReleaseCache(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to release block info."); - goto ext; - } - - ret = uffs_BufReleaseAll(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to release page buffers"); - goto ext; - } - - ret = uffs_TreeRelease(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to release tree buffers!"); - goto ext; - } - - ret = uffs_FlashInterfaceRelease(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to release tree buffers!"); - goto ext; - } - - if (dev->mem.release) - ret = dev->mem.release(dev); - - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "fail to release memory allocator!"); - } - - uffs_DeviceReleaseLock(dev); - -ext: - return ret; - -} - -URET uffs_InitFileSystemObjects(void) -{ - if (uffs_InitObjectBuf() == U_SUCC) { - if (uffs_DirEntryBufInit() == U_SUCC) { - uffs_InitGlobalFsLock(); - return U_SUCC; - } - } - - return U_FAIL; -} - -URET uffs_ReleaseFileSystemObjects(void) -{ - if (uffs_ReleaseObjectBuf() == U_SUCC) { - if (uffs_DirEntryBufRelease() == U_SUCC) { - uffs_ReleaseGlobalFsLock(); - return U_SUCC; - } - } - - return U_FAIL; -} diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_mem.c b/components/dfs/filesystems/uffs/src/uffs/uffs_mem.c deleted file mode 100644 index 9763cd7c4..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_mem.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_mem.c - * \brief uffs static memory allocator - * \author Ricky Zheng, created 23th Feb, 2007 - */ - -#include -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_mem.h" - -#define PFX "mem : " - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0 -static void * static_malloc(struct uffs_DeviceSt *dev, unsigned int size) -{ - struct uffs_memAllocatorSt *mem = &dev->mem; - void *p = NULL; - - size += (size % sizeof(long) ? sizeof(long) - (size % sizeof(long)) : 0); - - if (mem->buf_size - mem->pos < (int)size) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Memory alloc failed! (alloc %d, free %d)", - size, mem->buf_size - mem->pos); - } - else { - p = mem->buf_start + mem->pos; - mem->pos += size; - uffs_Perror(UFFS_MSG_NOISY, - "0x%p: Allocated %d, free %d", - p, size, mem->buf_size - mem->pos); - } - - return p; -} - -void uffs_MemSetupStaticAllocator(uffs_MemAllocator *allocator, - void *pool, int size) -{ - allocator->buf_start = (char *)pool; - allocator->buf_size = size; - allocator->pos = 0; - allocator->malloc = static_malloc; - allocator->free = NULL; //never free memory for static memory allocator - - uffs_Perror(UFFS_MSG_NOISY, - "System static memory: %d bytes", allocator->buf_size); - -} - -#endif - - - - - - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_mtb.c b/components/dfs/filesystems/uffs/src/uffs/uffs_mtb.c deleted file mode 100644 index ca7f19724..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_mtb.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_mtb.c - * \brief mount table operations - * \author Ricky Zheng, created 11th July, 2009 - */ -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_tree.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_fd.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_fs.h" -#include - -#define PFX "mtb : " - -static struct uffs_MountTableEntrySt *m_head = NULL; // list of mounted entries -static struct uffs_MountTableEntrySt *m_free_head = NULL; // list of unmounted entries - -/** Return mounted entries header */ -uffs_MountTable * uffs_MtbGetMounted(void) -{ - return m_head; -} - -/** Return unmounted entries header */ -uffs_MountTable * uffs_MtbGetUnMounted(void) -{ - return m_free_head; -} - -/** - * \brief Register mount table - * \param mtb mount table entry - * \return 0 succ - * -1 failed (e.g. already registered and mounted) - */ -int uffs_RegisterMountTable(uffs_MountTable *mtb) -{ - uffs_MountTable *work = NULL; - static int dev_num = 0; - - if (mtb == NULL) - return -1; - - for (work = m_head; work; work = work->next) { - if (work == mtb) - return -1; // already mounted ? - } - - for (work = m_free_head; work; work = work->next) { - if (work == mtb) - return 0; // already registered. - } - - /* replace the free head */ - if (m_free_head) - m_free_head->prev = mtb; - mtb->prev = NULL; - mtb->next = m_free_head; - m_free_head = mtb; - - mtb->dev->dev_num = ++dev_num; - - return 0; -} - -/** - * \brief Remove mount entry from the table - * \param mtb mount table entry - * \return 0 removed succ - * -1 entry in used or not in the 'unmounted' list - */ -int uffs_UnRegisterMountTable(uffs_MountTable *mtb) -{ - uffs_MountTable *work = NULL; - - if (mtb == NULL) - return -1; - - for (work = m_head; work; work = work->next) { - if (work == mtb) - return -1; // in the mounted list ? busy, return - } - - for (work = m_free_head; work; work = work->next) { - if (work == mtb) { - // found, remove it from the list - if (work->next) - work->next->prev = work->prev; - if (work->prev) - work->prev->next = work->next; - if (work == m_free_head) - m_free_head = work->next; - - break; - } - } - - return work ? 0 : -1; -} - -static uffs_MountTable * uffs_GetMountTableByMountPoint(const char *mount, uffs_MountTable *head) -{ - uffs_MountTable *work = NULL; - - for (work = head; work; work = work->next) { - if (strcmp(work->mount, mount) == 0) - break; - } - return work; -} - -/** - * \brief mount partition - * \param[in] mount partition mount point - * \return 0 succ - * <0 fail - * - * \note use uffs_RegisterMountTable() register mount entry before you can mount it. - * mount point should ended with '/', e.g. '/sys/' - */ -int uffs_Mount(const char *mount) -{ - uffs_MountTable *mtb; - - if (uffs_GetMountTableByMountPoint(mount, m_head) != NULL) { - uffs_Perror(UFFS_MSG_NOISY, "'%s' already mounted", mount); - return -1; // already mounted ? - } - - mtb = uffs_GetMountTableByMountPoint(mount, m_free_head); - if (mtb == NULL) { - uffs_Perror(UFFS_MSG_NOISY, "'%s' not registered", mount); - return -1; // not registered ? - } - - uffs_Perror(UFFS_MSG_NOISY, - "init device for mount point %s ...", - mtb->mount); - - mtb->dev->par.start = mtb->start_block; - if (mtb->end_block < 0) { - mtb->dev->par.end = - mtb->dev->attr->total_blocks + mtb->end_block; - } - else { - mtb->dev->par.end = mtb->end_block; - } - - if (mtb->dev->Init(mtb->dev) == U_FAIL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "init device for mount point %s fail", - mtb->mount); - return -1; - } - - uffs_Perror(UFFS_MSG_NOISY, "mount partiton: %d,%d", - mtb->dev->par.start, mtb->dev->par.end); - - if (uffs_InitDevice(mtb->dev) != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "init device fail !"); - return -1; - } - - /* now break it from unmounted list */ - if (mtb->prev) - mtb->prev->next = mtb->next; - if (mtb->next) - mtb->next->prev = mtb->prev; - if (m_free_head == mtb) - m_free_head = mtb->next; - - /* link to mounted list */ - mtb->prev = NULL; - mtb->next = m_head; - if (m_head) - m_head->prev = mtb; - m_head = mtb; - - return 0; -} - -/** - * \brief unmount parttion - * \param[in] mount partition mount point - * \return 0 succ - * <0 fail - */ -int uffs_UnMount(const char *mount) -{ - uffs_MountTable *mtb = uffs_GetMountTableByMountPoint(mount, m_head); - - if (mtb == NULL) { - uffs_Perror(UFFS_MSG_NOISY, "'%s' not mounted ?", mount); - return -1; // not mounted ? - } - - if (uffs_GetMountTableByMountPoint(mount, m_free_head) != NULL) { - uffs_Perror(UFFS_MSG_NOISY, "'%s' already unmounted ?", mount); - return -1; // already unmounted ? - } - - if (mtb->dev->ref_count != 0) { - uffs_Perror(UFFS_MSG_NORMAL, "Can't unmount '%s' - busy", mount); - return -1; - } - - if (uffs_ReleaseDevice(mtb->dev) == U_FAIL) { - uffs_Perror(UFFS_MSG_NORMAL, "Can't release device for mount point '%s'", mount); - return -1; - } - - mtb->dev->Release(mtb->dev); - - // break from mounted list - if (mtb->prev) - mtb->prev->next = mtb->next; - if (mtb->next) - mtb->next->prev = mtb->prev; - if (mtb == m_head) - m_head = mtb->next; - - // put to unmounted list - mtb->prev = NULL; - mtb->next = m_free_head; - if (m_free_head) - m_free_head->prev = mtb; - m_free_head = mtb; - - return 0; -} - -/** - * find the matched mount point from a given full absolute path. - * - * \param[in] path full path - * \return the length of mount point. - */ -int uffs_GetMatchedMountPointSize(const char *path) -{ - int pos; - uffs_Device *dev; - - if (path[0] != '/') - return 0; - - pos = strlen(path); - - while (pos > 0) { - if ((dev = uffs_GetDeviceFromMountPointEx(path, pos)) != NULL ) { - uffs_PutDevice(dev); - return pos; - } - else { - if (path[pos-1] == '/') - pos--; - //back forward search the next '/' - for (; pos > 0 && path[pos-1] != '/'; pos--) - ; - } - } - - return pos; -} - -/** - * get device from mount point. - * - * \param[in] mount mount point name. - * \return NULL if mount point is not found. - */ -uffs_Device * uffs_GetDeviceFromMountPoint(const char *mount) -{ - uffs_MountTable *mtb = uffs_GetMountTableByMountPoint(mount, m_head); - - if (mtb) { - mtb->dev->ref_count++; - return mtb->dev; - } - - return NULL; -} - -/** - * get device from mount point. - * - * \param[in] mount mount point name. - * \param[in] len mount point name length. - * \return NULL if mount point is not found. - */ -uffs_Device * uffs_GetDeviceFromMountPointEx(const char *mount, int len) -{ - uffs_MountTable *work = NULL; - - for (work = m_head; work; work = work->next) { - if (strlen(work->mount) == len && - strncmp(mount, work->mount, len) == 0) { - work->dev->ref_count++; - return work->dev; - } - } - - return NULL; -} - - -/** - * return mount point from device - * - * \param[in] dev uffs device - * \return NULL if mount point is not found, - * otherwise return mount point name in mount table. - */ -const char * uffs_GetDeviceMountPoint(uffs_Device *dev) -{ - uffs_MountTable *work = NULL; - - for (work = m_head; work; work = work->next) { - if (work->dev == dev) { - return work->mount; - } - } - - return NULL; -} - -void uffs_PutDevice(uffs_Device *dev) -{ - dev->ref_count--; -} - - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_pool.c b/components/dfs/filesystems/uffs/src/uffs/uffs_pool.c deleted file mode 100644 index 22adc53f3..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_pool.c +++ /dev/null @@ -1,386 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_pool.c - * \brief Fast fixed size memory pool management. - * \author Ricky Zheng, Simon Kallweit - */ - -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_pool.h" - -/* - - usage: - - #define BUF_SIZE 32 - #define NUM_BUFS 1024 - - static int pool_mem[NUM_BUFS * BUF_SIZE / sizeof(int)]; - static uffs_Pool pool; - - uffs_PoolInit(&pool, pool_mem, sizeof(pool_mem), BUF_SIZE, NUM_BUFS); - - void * p; - p = uffs_PoolGet(&pool); - ... - uffs_PoolPut(p, &pool); - - notice: - - uffs_PoolInit will assert when NUM_BUFS is not at least 1, or BUF_SIZE is - not aligned to the platforms pointer size. - -*/ - - -/** - * \brief Initializes the memory pool. - * \param[in] pool memory pool - * \param[in] mem pool memory - * \param[in] mem_size size of pool memory - * \param[in] buf_size size of a single buffer - * \param[in] num_bufs number of buffers - * \return Returns U_SUCC if successful. - */ -URET uffs_PoolInit(uffs_Pool *pool, - void *mem, u32 mem_size, u32 buf_size, u32 num_bufs) -{ - unsigned int i; - uffs_PoolEntry *e1, *e2; - - if (!uffs_Assert(pool != NULL, "pool missing") || - !uffs_Assert(mem != NULL, "pool memory missing") || - !uffs_Assert(num_bufs > 0, "not enough buffers") || - !uffs_Assert(buf_size % sizeof(void *) == 0, - "buffer size not aligned to pointer size") || - !uffs_Assert(mem_size == num_bufs * buf_size, - "pool memory size is wrong")) - { - return U_FAIL; - } - - pool->mem = (u8 *)mem; - pool->buf_size = buf_size; - pool->num_bufs = num_bufs; - - uffs_SemCreate(&pool->sem); - uffs_SemWait(pool->sem); - - // Initialize the free_list - e1 = e2 = pool->free_list = (uffs_PoolEntry *) pool->mem; - for (i = 1; i < pool->num_bufs; i++) { - e2 = (uffs_PoolEntry *) (pool->mem + i * pool->buf_size); - e1->next = e2; - e1 = e2; - } - e2->next = NULL; - - uffs_SemSignal(pool->sem); - - return U_SUCC; -} - -/** - * \brief verify pointer validity aganist memory pool - * \return U_TRUE if valid, U_FALSE if invalid. - */ -UBOOL uffs_PoolVerify(uffs_Pool *pool, void *p) -{ - return p && - (u8 *)p >= pool->mem && - (u8 *)p < pool->mem + (pool->buf_size * pool->num_bufs) && - (((u8 *)p - pool->mem) % pool->buf_size) == 0 ? U_TRUE : U_FALSE; -} - -/** - * \brief Releases the memory pool. - * \param[in] pool memory pool - * \return Returns U_SUCC if successful. - */ -URET uffs_PoolRelease(uffs_Pool *pool) -{ - if (!uffs_Assert(pool != NULL, "pool missing")) - return U_FAIL; - - uffs_SemDelete(&pool->sem); - - return U_SUCC; -} - -/** - * \brief Get a buffer from the memory pool. - * \param[in] pool memory pool - * \return Returns a pointer to the buffer or NULL if none is available. - */ -void *uffs_PoolGet(uffs_Pool *pool) -{ - uffs_PoolEntry *e; - - if (!uffs_Assert(pool != NULL, "pool missing")) - return NULL; - - e = pool->free_list; - if (e) - pool->free_list = e->next; - - return e; -} - -/** - * \brief Get a buffer from the memory pool. - * This version is locked and should be used when multiple threads access the - * same memory pool. - * \param[in] pool memory pool - * \return Returns a pointer to the buffer or NULL if none is available. - */ -void *uffs_PoolGetLocked(uffs_Pool *pool) -{ - uffs_PoolEntry *e; - - if (!uffs_Assert(pool != NULL, "pool missing")) - return NULL; - - uffs_SemWait(pool->sem); - e = pool->free_list; - if (e) - pool->free_list = e->next; - uffs_SemSignal(pool->sem); - - return e; -} - -/** - * \brief Puts a buffer back to the memory pool. - * \param[in] pool memory pool - * \param[in] p buffer to put back - * \return Returns 0 if successful. - */ -int uffs_PoolPut(uffs_Pool *pool, void *p) -{ - uffs_PoolEntry *e = (uffs_PoolEntry *)p; - - if (!uffs_Assert(pool != NULL, "pool missing")) - return -1; - - if (e) { - e->next = pool->free_list; - pool->free_list = e; - return 0; - } - - return -1; -} - -/** - * \brief Puts a buffer back to the memory pool. - * This version is locked and should be used when multiple threads access the - * same memory pool. - * \param[in] pool memory pool - * \param[in] p buffer to put back - * \return Returns 0 if successful. - */ -int uffs_PoolPutLocked(uffs_Pool *pool, void *p) -{ - uffs_PoolEntry *e = (uffs_PoolEntry *)p; - - if (!uffs_Assert(pool != NULL, "pool missing")) - return -1; - - if (e) { - uffs_SemWait(pool->sem); - e->next = pool->free_list; - pool->free_list = e; - uffs_SemSignal(pool->sem); - return 0; - } - - return -1; -} - -/** - * \brief Gets a buffer by index (offset). - * This method returns a buffer from the memory pool by index. - * \param[in] pool memory pool - * \param[in] index index - * \return Returns a pointer to the buffer. - */ -void *uffs_PoolGetBufByIndex(uffs_Pool *pool, u32 index) -{ - if (!uffs_Assert(pool != NULL, "pool missing") || - !uffs_Assert(index < pool->num_bufs, - "index(%d) out of range(max %d)", index, pool->num_bufs)) - { - return NULL; - } - - return (u8 *) pool->mem + index * pool->buf_size; -} - -/** - * \brief Gets the index (offset) of a buffer. - * This method returns the index of a buffer from the memory pool. - * \param[in] pool memory pool - * \param[in] p buffer to get index from - * \return Returns the index of the buffer. - */ -u32 uffs_PoolGetIndex(uffs_Pool *pool, void *p) -{ - if (!uffs_Assert(pool != NULL, "pool missing") || - !uffs_Assert(p >= (void *) pool->mem && - p < (void *) (pool->mem + pool->num_bufs * pool->buf_size), - "pointer out of range")) - { - uffs_Panic(); - } - - return ((u8 *) p - pool->mem) / pool->buf_size; -} - -/** - * \brief Check given buffer in free list - * \return U_TRUE if it's in free list, U_FALSE if not. - */ -UBOOL uffs_PoolCheckFreeList(uffs_Pool *pool, void *p) -{ - uffs_PoolEntry *e; - for (e = pool->free_list; e; e = e->next) { - if ((void *)e == p) - return U_TRUE; - } - return U_FALSE; -} - -/** - * \brief this is more efficient version for small nodes number memory pool (< 32) - */ -static void * FindNextAllocatedInSmallPool(uffs_Pool *pool, void *from) -{ - u32 map = 0; - uffs_PoolEntry *e; - u32 i; - - for (e = pool->free_list; e; e = e->next) - map |= (1 << uffs_PoolGetIndex(pool, e)); - - for (i = uffs_PoolGetIndex(pool, from); - (map & (1 << i)) && i < 32 && i < pool->num_bufs; - i++); - - return i < 32 && i < pool->num_bufs ? - uffs_PoolGetBufByIndex(pool, i) : NULL; -} - - -/** - * \brief Find next allocated memory block - * - * \param[in] pool memory pool - * \param[in] from search start address, if NULL, from pool->mem - * - * \return next allocated memory block, NULL if not found. - * - * \note This is NOT efficient, don't do it on a pool with large free nodes ! - */ -void * uffs_PoolFindNextAllocated(uffs_Pool *pool, void *from) -{ - uffs_PoolEntry *e = NULL; - u8 *p = (u8 *)from; - - if (p == NULL) - p = pool->mem; - else - p += pool->buf_size; - - if (pool->num_bufs < 32) - return FindNextAllocatedInSmallPool(pool, p); - - // work through the free list, stop if not in free list, - // otherwise move to next entry and search free list again. - - if (pool->free_list) { - while (uffs_PoolVerify(pool, p)) { - e = pool->free_list; - while (e) { - if (p == (u8 *)e) { - p += pool->buf_size; // in free list, move to next entry - break; - } - e = e->next; - } - if (e == NULL) // not in free_list, gotcha - break; - } - } - - return uffs_PoolVerify(pool, p) ? p : NULL ; -} - -/** - * \brief get free memory block count - */ -int uffs_PoolGetFreeCount(uffs_Pool *pool) -{ - int count = 0; - uffs_PoolEntry *e; - - e = pool->free_list; - while (e) { - count++; - e = e->next; - } - - return count; -} - -/** - * \brief put all memory block back, return how many memory blocks were put back - */ -int uffs_PoolPutAll(uffs_Pool *pool) -{ - void *p = NULL; - int count = 0; - - do { - p = uffs_PoolFindNextAllocated(pool, p); - if (p) { - uffs_PoolPut(pool, p); - count++; - } - } while (p); - - return count; -} diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_public.c b/components/dfs/filesystems/uffs/src/uffs/uffs_public.c deleted file mode 100644 index 348b7892d..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_public.c +++ /dev/null @@ -1,448 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_public.c - * \brief public and miscellaneous functions - * \author Ricky Zheng, created 10th May, 2005 - */ - -#include "uffs_config.h" -#include "uffs/uffs_types.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_crc.h" - -#include - -#define PFX "pub : " - - -int uffs_GetFirstBlockTimeStamp(void) -{ - return 0; -} - -int uffs_GetNextBlockTimeStamp(int prev) -{ - return (prev + 1) % 3; -} - -UBOOL uffs_IsSrcNewerThanObj(int src, int obj) -{ - switch (src - obj) { - case 0: - uffs_Perror(UFFS_MSG_SERIOUS, - "the two block have the same time stamp ?"); - break; - case 1: - case -2: - return U_TRUE; - case -1: - case 2: - return U_FALSE; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "time stamp out of range !"); - break; - } - - return U_FALSE; -} - - -/** - * \brief given a page, search the block to find - * a better page with the same page id - * - * \param[in] dev uffs device - * \param[in] bc block info - * \param[in] page page number to be compared with - * - * \return the better page number, could be the same with the given page. - * if the given page does not have good tag, return UFFS_INVALID_PAGE. - */ -u16 uffs_FindBestPageInBlock(uffs_Device *dev, uffs_BlockInfo *bc, u16 page) -{ - int i; - uffs_Tags *tag, *tag_old; - - if (!uffs_Assert(page != UFFS_INVALID_PAGE, "invalid param !")) - return page; // just in case ... - - uffs_BlockInfoLoad(dev, bc, page); // load old page - tag_old = GET_TAG(bc, page); - - if (!uffs_Assert(TAG_IS_GOOD(tag_old), "try to find a invalid page ?")) - return UFFS_INVALID_PAGE; - - if (page == dev->attr->pages_per_block - 1) // already the last page ? - return page; - - for (i = dev->attr->pages_per_block - 1; i > page; i--) { - uffs_BlockInfoLoad(dev, bc, i); - tag = GET_TAG(bc, i); - if (TAG_IS_GOOD(tag) && - TAG_PAGE_ID(tag) == TAG_PAGE_ID(tag_old) && - TAG_PARENT(tag) == TAG_PARENT(tag_old) && - TAG_SERIAL(tag) == TAG_SERIAL(tag_old)) - { - break; - } - } - - return i; -} - -/** - * \brief find a valid page with given page_id - * \param[in] dev uffs device - * \param[in] bc block info - * \param[in] page_id page_id to be find - * \return the valid page number which has given page_id - * \retval >=0 page number - * \retval UFFS_INVALID_PAGE page not found - */ -u16 uffs_FindPageInBlockWithPageId(uffs_Device *dev, - uffs_BlockInfo *bc, u16 page_id) -{ - u16 page; - uffs_Tags *tag; - - //Indeed, the page which has page_id, should ahead of page_id ... - for (page = page_id; page < dev->attr->pages_per_block; page++) { - uffs_BlockInfoLoad(dev, bc, page); - tag = &(bc->spares[page].tag); - if (TAG_IS_GOOD(tag) && TAG_PAGE_ID(tag) == page_id) - return page; - } - - return UFFS_INVALID_PAGE; -} - -/** - * Are all the pages in the block used ? - */ -UBOOL uffs_IsBlockPagesFullUsed(uffs_Device *dev, uffs_BlockInfo *bc) -{ - uffs_Tags *tag; - - // if the last page is dirty, then the whole block is full - uffs_BlockInfoLoad(dev, bc, dev->attr->pages_per_block - 1); - tag = GET_TAG(bc, dev->attr->pages_per_block - 1); - - return TAG_IS_GOOD(tag) ? U_TRUE : U_FALSE; -} - -/** - * Is this block used ? - * \param[in] dev uffs device - * \param[in] bc block info - * \retval U_TRUE block is used - * \retval U_FALSE block is free - */ -UBOOL uffs_IsThisBlockUsed(uffs_Device *dev, uffs_BlockInfo *bc) -{ - uffs_Tags *tag; - - // if the first page is dirty, then this block is used. - uffs_BlockInfoLoad(dev, bc, 0); - tag = GET_TAG(bc, 0); - - return TAG_IS_DIRTY(tag) ? U_TRUE : U_FALSE; -} - -/** - * get block time stamp from a exist block - * \param[in] dev uffs device - * \param[in] bc block info - */ -int uffs_GetBlockTimeStamp(uffs_Device *dev, uffs_BlockInfo *bc) -{ - if(uffs_IsThisBlockUsed(dev, bc) == U_FALSE) - return uffs_GetFirstBlockTimeStamp(); - else{ - uffs_BlockInfoLoad(dev, bc, 0); - return TAG_BLOCK_TS(GET_TAG(bc, 0)); - } - -} - -/** - * find first free page from 'pageFrom' - * \param[in] dev uffs device - * \param[in] bc block info - * \param[in] pageFrom search from this page - * \return return first free page number from 'pageFrom' - * \retval UFFS_INVALID_PAGE no free page found - * \retval >=0 the first free page number - */ -u16 uffs_FindFirstFreePage(uffs_Device *dev, - uffs_BlockInfo *bc, u16 pageFrom) -{ - u16 i; - - for (i = pageFrom; i < dev->attr->pages_per_block; i++) { - uffs_BlockInfoLoad(dev, bc, i); - if (uffs_IsPageErased(dev, bc, i) == U_TRUE) - return i; - } - - return UFFS_INVALID_PAGE; //free page not found -} - - -/** - * calculate sum of data, 8bit version - * \param[in] p data pointer - * \param[in] len length of data - * \return return sum of data, 8bit - */ -u8 uffs_MakeSum8(const void *p, int len) -{ - return uffs_crc16sum(p, len) & 0xFF; -} - -/** - * calculate sum of datam, 16bit version - * \param[in] p data pointer - * \param[in] len length of data - * \return return sum of data, 16bit - */ -u16 uffs_MakeSum16(const void *p, int len) -{ - return uffs_crc16sum(p, len); -} - -/** - * create a new file on a free block - * \param[in] dev uffs device - * \param[in] parent parent dir serial num - * \param[in] serial serial num of this new file - * \param[in] bc block information - * \param[in] fi file information - * \note parent, serial, bc must be provided before, - * and all information in fi should be filled well before. - */ -URET uffs_CreateNewFile(uffs_Device *dev, - u16 parent, u16 serial, - uffs_BlockInfo *bc, uffs_FileInfo *fi) -{ - uffs_Tags *tag; - uffs_Buf *buf; - - uffs_BlockInfoLoad(dev, bc, 0); - - tag = GET_TAG(bc, 0); - TAG_PARENT(tag) = parent; - TAG_SERIAL(tag) = serial; - TAG_DATA_LEN(tag) = sizeof(uffs_FileInfo); - - buf = uffs_BufGet(dev, parent, serial, 0); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "get buf fail."); - return U_FAIL; - } - - memcpy(buf->data, fi, TAG_DATA_LEN(tag)); - buf->data_len = TAG_DATA_LEN(tag); - - return uffs_BufPut(dev, buf); -} - - -/** - * \brief calculate data length of a file block - * \param[in] dev uffs device - * \param[in] bc block info - */ -int uffs_GetBlockFileDataLength(uffs_Device *dev, uffs_BlockInfo *bc, u8 type) -{ - u16 page_id; - u16 i; - uffs_Tags *tag; - int size = 0; - u16 page; - u16 lastPage = dev->attr->pages_per_block - 1; - - uffs_BlockInfoLoad(dev, bc, lastPage); - tag = GET_TAG(bc, lastPage); - - if (TAG_IS_GOOD(tag)) { - // First try the last page. - // if it's the full loaded file/data block, then we have a quick path. - if (type == UFFS_TYPE_FILE) { - if (TAG_PAGE_ID(tag) == (lastPage - 1)) { - size = dev->com.pg_data_size * (dev->attr->pages_per_block - 2) + TAG_DATA_LEN(tag); - return size; - } - } - if (type == UFFS_TYPE_DATA) { - if (TAG_PAGE_ID(tag) == lastPage) { - size = dev->com.pg_data_size * (dev->attr->pages_per_block - 1) + TAG_DATA_LEN(tag); - return size; - } - } - } - - // ok, it's not the full loaded file/data block, - // need to read all spares.... - uffs_BlockInfoLoad(dev, bc, UFFS_ALL_PAGES); - tag = GET_TAG(bc, 0); - if (uffs_Assert(TAG_IS_GOOD(tag), "block %d page 0 does not have good tag ?", bc->block)) { - if (TAG_TYPE(tag) == UFFS_TYPE_FILE) { - page_id = 1; //In file header block, file data page_id from 1 - i = 1; //search from page 1 - } - else { - page_id = 0; //in normal file data block, page_id from 0 - i = 0; //in normal file data block, search from page 0 - } - for (; i < dev->attr->pages_per_block; i++) { - tag = GET_TAG(bc, i); - if (TAG_IS_GOOD(tag)) { - if (page_id == TAG_PAGE_ID(tag)) { - page = uffs_FindBestPageInBlock(dev, bc, i); - if (uffs_Assert(page != UFFS_INVALID_PAGE, "got an invalid page ?")) { - size += TAG_DATA_LEN(GET_TAG(bc, page)); - page_id++; - } - } - } - } - } - - return size; -} - -/** - * get free pages number - * \param[in] dev uffs device - * \param[in] bc block info - */ -int uffs_GetFreePagesCount(uffs_Device *dev, uffs_BlockInfo *bc) -{ - int count = 0; - int i; - - // search from the last page ... to first page - for (i = dev->attr->pages_per_block - 1; i >= 0; i--) { - uffs_BlockInfoLoad(dev, bc, i); - if (uffs_IsPageErased(dev, bc, (u16)i) == U_TRUE) { - count++; - } - else { - if (TAG_IS_GOOD(GET_TAG(bc, i))) // it won't be any free page if we see a good tag. - break; - } - } - - return count; -} -/** - * \brief Is the block erased ? - * \param[in] dev uffs device - * \param[in] bc block info - * \param[in] page page number to be check - * \retval U_TRUE block is erased, ready to use - * \retval U_FALSE block is dirty, maybe use by file - */ -UBOOL uffs_IsPageErased(uffs_Device *dev, uffs_BlockInfo *bc, u16 page) -{ - uffs_Tags *tag; - - uffs_BlockInfoLoad(dev, bc, page); - tag = GET_TAG(bc, page); - - if (!TAG_IS_SEALED(tag) && - !TAG_IS_DIRTY(tag) && - !TAG_IS_VALID(tag)) { - return U_TRUE; - } - - return U_FALSE; -} - -/** - * get partition used (bytes) - */ -int uffs_GetDeviceUsed(uffs_Device *dev) -{ - return (dev->par.end - dev->par.start + 1 - - dev->tree.bad_count - dev->tree.erased_count - ) * - dev->attr->page_data_size * - dev->attr->pages_per_block; -} - -/** - * get partition free (bytes) - */ -int uffs_GetDeviceFree(uffs_Device *dev) -{ - return dev->tree.erased_count * - dev->attr->page_data_size * - dev->attr->pages_per_block; -} - -/** - * get partition total size (bytes) - */ -int uffs_GetDeviceTotal(uffs_Device *dev) -{ - return (dev->par.end - dev->par.start + 1) * - dev->attr->page_data_size * - dev->attr->pages_per_block; -} - -/** - * load mini hader from flash - */ -URET uffs_LoadMiniHeader(uffs_Device *dev, - int block, u16 page, struct uffs_MiniHeaderSt *header) -{ - int ret; - struct uffs_FlashOpsSt *ops = dev->ops; - - if (ops->ReadPageWithLayout) { - ret = ops->ReadPageWithLayout(dev, block, page, (u8 *)header, - sizeof(struct uffs_MiniHeaderSt), NULL, NULL, NULL); - } - else { - ret = ops->ReadPage(dev, block, page, (u8 *)header, sizeof(struct uffs_MiniHeaderSt), NULL, NULL, 0); - } - - dev->st.page_header_read_count++; - - return UFFS_FLASH_HAVE_ERR(ret) ? U_FAIL : U_SUCC; -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_tree.c b/components/dfs/filesystems/uffs/src/uffs/uffs_tree.c deleted file mode 100644 index 7e51a9275..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_tree.c +++ /dev/null @@ -1,1278 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_tree.c - * \brief seting up uffs tree data structure - * \author Ricky Zheng, created 13th May, 2005 - */ - -#include "uffs_config.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_pool.h" -#include "uffs/uffs_flash.h" -#include "uffs/uffs_badblock.h" - -#include - -#define TPOOL(dev) &(dev->mem.tree_pool) - -#define PFX "tree: " - -static void uffs_InsertToFileEntry(uffs_Device *dev, TreeNode *node); -static void uffs_InsertToDirEntry(uffs_Device *dev, TreeNode *node); -static void uffs_InsertToDataEntry(uffs_Device *dev, TreeNode *node); - -static TreeNode * uffs_TreeGetErasedNodeNoCheck(uffs_Device *dev); - - -struct BlockTypeStatSt { - int dir; - int file; - int data; -}; - -/** - * \brief initialize tree buffers - * \param[in] dev uffs device - */ -URET uffs_TreeInit(uffs_Device *dev) -{ - int size; - int num; - uffs_Pool *pool; - int i; - - size = sizeof(TreeNode); - num = dev->par.end - dev->par.start + 1; - - pool = &(dev->mem.tree_pool); - - if (dev->mem.tree_nodes_pool_size == 0) { - if (dev->mem.malloc) { - dev->mem.tree_nodes_pool_buf = dev->mem.malloc(dev, size * num); - if (dev->mem.tree_nodes_pool_buf) - dev->mem.tree_nodes_pool_size = size * num; - } - } - if (size * num > dev->mem.tree_nodes_pool_size) { - uffs_Perror(UFFS_MSG_DEAD, - "Tree buffer require %d but only %d available.", - size * num, dev->mem.tree_nodes_pool_size); - memset(pool, 0, sizeof(uffs_Pool)); - return U_FAIL; - } - uffs_Perror(UFFS_MSG_NOISY, "alloc tree nodes %d bytes.", size * num); - - uffs_PoolInit(pool, dev->mem.tree_nodes_pool_buf, - dev->mem.tree_nodes_pool_size, size, num); - - dev->tree.erased = NULL; - dev->tree.erased_tail = NULL; - dev->tree.erased_count = 0; - dev->tree.bad = NULL; - dev->tree.bad_count = 0; - - for (i = 0; i < DIR_NODE_ENTRY_LEN; i++) { - dev->tree.dir_entry[i] = EMPTY_NODE; - } - - for (i = 0; i < FILE_NODE_ENTRY_LEN; i++) { - dev->tree.file_entry[i] = EMPTY_NODE; - } - - for (i = 0; i < DATA_NODE_ENTRY_LEN; i++) { - dev->tree.data_entry[i] = EMPTY_NODE; - } - - dev->tree.max_serial = ROOT_DIR_SERIAL; - - return U_SUCC; -} -/** - * \brief release tree buffers, call this function when unmount - * \param[in] dev uffs device - */ -URET uffs_TreeRelease(uffs_Device *dev) -{ - uffs_Pool *pool; - - pool = &(dev->mem.tree_pool); - if (pool->mem && dev->mem.free) { - dev->mem.free(dev, pool->mem); - pool->mem = NULL; - dev->mem.tree_nodes_pool_size = 0; - } - uffs_PoolRelease(pool); - memset(pool, 0, sizeof(uffs_Pool)); - - return U_SUCC; -} - -static u16 _GetBlockFromNode(u8 type, TreeNode *node) -{ - switch (type) { - case UFFS_TYPE_DIR: - return node->u.dir.block; - case UFFS_TYPE_FILE: - return node->u.file.block; - case UFFS_TYPE_DATA: - return node->u.data.block; - } - uffs_Perror(UFFS_MSG_SERIOUS, "unkown type, X-block"); - return UFFS_INVALID_BLOCK; -} - -#if 0 -static u16 _GetParentFromNode(u8 type, TreeNode *node) -{ - switch (type) { - case UFFS_TYPE_DIR: - return node->u.dir.parent; - case UFFS_TYPE_FILE: - return node->u.file.parent; - case UFFS_TYPE_DATA: - return node->u.data.parent; - } - uffs_Perror(UFFS_MSG_SERIOUS, "unkown type, X-parent"); - return INVALID_UFFS_SERIAL; -} - - -static u16 _GetSerialFromNode(u8 type, TreeNode *node) -{ - switch (type) { - case UFFS_TYPE_DIR: - return node->u.dir.serial; - case UFFS_TYPE_FILE: - return node->u.file.serial; - case UFFS_TYPE_DATA: - return node->u.data.serial; - } - uffs_Perror(UFFS_MSG_SERIOUS, "unkown type, X-serial"); - return INVALID_UFFS_SERIAL; -} -#endif - -/** - * insert a TreeNode *node to tree - * \param[in] dev uffs device - * \param[in] type type of node - * \param[in] node node to be insert to - */ -void uffs_InsertNodeToTree(uffs_Device *dev, u8 type, TreeNode *node) -{ - switch (type) { - case UFFS_TYPE_DIR: - uffs_InsertToDirEntry(dev, node); - break; - case UFFS_TYPE_FILE: - uffs_InsertToFileEntry(dev, node); - break; - case UFFS_TYPE_DATA: - uffs_InsertToDataEntry(dev, node); - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, - "unkown type, can't insert to tree"); - break; - } -} - -/** - * find a node from tree - * \param[in] dev uffs device - * \param[in] type type of node - * \param[in] parent parent serial num - * \param[in] serial serial num - */ -TreeNode * uffs_FindFromTree(uffs_Device *dev, - u8 type, u16 parent, u16 serial) -{ - switch (type) { - case UFFS_TYPE_DIR: - return uffs_TreeFindDirNode(dev, serial); - case UFFS_TYPE_FILE: - return uffs_TreeFindFileNode(dev, serial); - case UFFS_TYPE_DATA: - return uffs_TreeFindDataNode(dev, parent, serial); - } - uffs_Perror(UFFS_MSG_SERIOUS, - "unkown type, can't find node"); - return NULL; -} - - - -static URET _BuildValidTreeNode(uffs_Device *dev, - TreeNode *node, //!< empty node - uffs_BlockInfo *bc, - struct BlockTypeStatSt *st) -{ - uffs_Tags *tag; - TreeNode *node_alt; - u16 block, parent, serial, block_alt, block_save; - uffs_BlockInfo *bc_alt; - u8 type; - int page; - UBOOL needToInsertToTree = U_FALSE; - uffs_Buf *buf = NULL; - uffs_FileInfo *info; - u16 data_sum = 0; - - // check the first page on the block ... - uffs_BlockInfoLoad(dev, bc, 0); - - tag = GET_TAG(bc, 0); //get first page's tag - - if (!TAG_IS_DIRTY(tag)) { - // should never go here ... unless mark dirty page failed ? - uffs_Perror(UFFS_MSG_NORMAL, - "First page is clean in a non-erased block ?"); - return U_FAIL; - } - - if (!TAG_IS_VALID(tag)) { - //first page is invalid ? should be erased now! - uffs_Perror(UFFS_MSG_NORMAL, - "first page in block %d is invalid, will be erased now!", - bc->block); - goto process_invalid_block; - } - - block = bc->block; - parent = TAG_PARENT(tag); - serial = TAG_SERIAL(tag); - type = TAG_TYPE(tag); - - // check if there is an 'alternative block' - // (node which has the same serial number) in tree ? - node_alt = uffs_FindFromTree(dev, type, parent, serial); - - if (node_alt != NULL) { - //find a alternate node ! need to check the timestamp ! - - block_alt = _GetBlockFromNode(type, node_alt); - - uffs_Perror(UFFS_MSG_NORMAL, - "Process unclean block (%d vs %d)", block, block_alt); - - if (block_alt == INVALID_UFFS_SERIAL) { - uffs_Perror(UFFS_MSG_SERIOUS, "invalid block ?"); - return U_FAIL; - } - - bc_alt = uffs_BlockInfoGet(dev, block_alt); - if (bc_alt == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get block info "); - return U_FAIL; - } - uffs_BlockInfoLoad(dev, bc_alt, 0); - if (uffs_IsSrcNewerThanObj ( - TAG_BLOCK_TS(tag), - TAG_BLOCK_TS(GET_TAG(bc_alt, 0))) == U_TRUE) { - - //the node is newer than node_alt, so keep node_alt, and erase node - uffs_FlashEraseBlock(dev, block); - node->u.list.block = block; - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - - uffs_BlockInfoPut(dev, bc_alt); //put back bc_alt before we return. - return U_SUCC; - } - else { - //the node is older than node_alt, so keep node, and erase node_alt - //we use node as erased node to insert to erased list - - block_save = _GetBlockFromNode(type, node_alt); - uffs_FlashEraseBlock(dev, block_save); - node->u.list.block = block_save; - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - - //put back bc_alt because we don't need it anymore. - uffs_BlockInfoPut(dev, bc_alt); - - //use node_alt to store new informations in following - node = node_alt; - - needToInsertToTree = U_FALSE; - } - } - else { - needToInsertToTree = U_TRUE; - } - - if (type == UFFS_TYPE_DIR || type == UFFS_TYPE_FILE) { - buf = uffs_BufClone(dev, NULL); - if (buf == NULL) - return U_FAIL; - uffs_BlockInfoLoad(dev, bc, UFFS_ALL_PAGES); - page = uffs_FindPageInBlockWithPageId(dev, bc, 0); - if (page == UFFS_INVALID_PAGE) { - uffs_BufFreeClone(dev, buf); - uffs_Perror(UFFS_MSG_SERIOUS, - "Can't find any valid page for page_id=0 ? invalid block !" - "this might be caused by the tag layout change.\n"); - goto process_invalid_block; - } - page = uffs_FindBestPageInBlock(dev, bc, page); - uffs_FlashReadPage(dev, block, page, buf, U_FALSE); - info = (uffs_FileInfo *) (buf->data); - data_sum = uffs_MakeSum16(info->name, info->name_len); - uffs_BufFreeClone(dev, buf); - } - - switch (type) { - case UFFS_TYPE_DIR: - node->u.dir.block = bc->block; - node->u.dir.checksum = data_sum; - node->u.dir.parent = TAG_PARENT(tag); - node->u.dir.serial = TAG_SERIAL(tag); - st->dir++; - break; - case UFFS_TYPE_FILE: - node->u.file.block = bc->block; - node->u.file.checksum = data_sum; - node->u.file.parent = TAG_PARENT(tag); - node->u.file.serial = TAG_SERIAL(tag); - node->u.file.len = uffs_GetBlockFileDataLength(dev, bc, UFFS_TYPE_FILE); - st->file++; - break; - case UFFS_TYPE_DATA: - node->u.data.block = bc->block; - node->u.data.parent = TAG_PARENT(tag); - node->u.data.serial = TAG_SERIAL(tag); - node->u.data.len = uffs_GetBlockFileDataLength(dev, bc, UFFS_TYPE_DATA); - st->data++; - break; - } - - if (needToInsertToTree == U_TRUE) { - uffs_InsertNodeToTree(dev, type, node); - } - - return U_SUCC; - -process_invalid_block: - /* erase the invalid block */ - uffs_FlashEraseBlock(dev, bc->block); - - node->u.list.block = bc->block; - - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, node); - else - uffs_TreeInsertToErasedListTail(dev, node); - - return U_SUCC; -} - - -static URET _ScanAndFixUnCleanPage(uffs_Device *dev, uffs_BlockInfo *bc) -{ - int page; - uffs_Tags *tag; - struct uffs_MiniHeaderSt header; - - /* in most case, the valid block contents fewer free page, - so it's better scan from the last page ... to page 1. - note: scanning page 0 is not necessary, will check it later. - - The worse case: read (pages_per_block - 1) * (mini header + spares) ! - most case: read one spare. - */ - for (page = dev->attr->pages_per_block - 1; page > 0; page--) { - uffs_BlockInfoLoad(dev, bc, page); - tag = GET_TAG(bc, page); - - if (TAG_IS_SEALED(tag)) - break; // tag sealed, no unclean page in this block. - - if (TAG_IS_DIRTY(tag) || TAG_IS_VALID(tag)) { // tag not sealed but dirty/valid ? - uffs_Perror(UFFS_MSG_NORMAL, - "unclean page found, block %d page %d", - bc->block, page); - - // ok, an unclean page found. - // This unclean page can be identified by tag. - // We can leave it as it is, but performing a block recover would be good ? - // There won't be another unclean page in this block ... stop here. - break; - } - - // now we have a clean tag (all 0xFF ?). Need to check mini header to see if it's an unclean page. - if (uffs_LoadMiniHeader(dev, bc->block, page, &header) == U_FAIL) - return U_FAIL; - - if (header.status != 0xFF) { - // page data is dirty? this is an unclean page and we should explicitly mark tag as 'dirty and invalid'. - // This writing does not violate "no partial program" claim, because we are writing to a clean page spare. - uffs_Perror(UFFS_MSG_NORMAL, - "unclean page found, block %d page %d, mark it.", - bc->block, page); - uffs_FlashMarkDirtyPage(dev, bc, page); - } - } - - return U_SUCC; -} - - -static URET _BuildTreeStepOne(uffs_Device *dev) -{ - int block_lt; - uffs_BlockInfo *bc = NULL; - TreeNode *node; - struct uffs_TreeSt *tree; - uffs_Pool *pool; - struct uffs_MiniHeaderSt header; - URET ret = U_SUCC; - struct BlockTypeStatSt st = {0, 0, 0}; - - tree = &(dev->tree); - pool = TPOOL(dev); - - tree->bad = NULL; - tree->bad_count = 0; - tree->erased = NULL; - tree->erased_tail = NULL; - tree->erased_count = 0; - - uffs_Perror(UFFS_MSG_NOISY, "build tree step one"); - -// printf("s:%d e:%d\n", dev->par.start, dev->par.end); - for (block_lt = dev->par.start; block_lt <= dev->par.end; block_lt++) { - bc = uffs_BlockInfoGet(dev, block_lt); - if (bc == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "step one:fail to get block info"); - ret = U_FAIL; - break; - } - node = (TreeNode *)uffs_PoolGet(pool); - if (node == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "insufficient tree node!"); - ret = U_FAIL; - break; - } - - // Need to check bad block at first ! - if (uffs_FlashIsBadBlock(dev, block_lt) == U_TRUE) { - node->u.list.block = block_lt; - uffs_TreeInsertToBadBlockList(dev, node); - uffs_Perror(UFFS_MSG_NORMAL, "found bad block %d", block_lt); - } - else if (uffs_IsPageErased(dev, bc, 0) == U_TRUE) { //@ read one spare: 0 - // page 0 tag shows it's an erased block, we need to check the mini header status to make sure it is clean. - if (uffs_LoadMiniHeader(dev, block_lt, 0, &header) == U_FAIL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "I/O error when reading mini header !" - "block %d page %d", - block_lt, 0); - ret = U_FAIL; - break; - } - - if (header.status != 0xFF) { - // page 0 tag is clean but page data is dirty ??? - // this block should be erased immediately ! - uffs_FlashEraseBlock(dev, block_lt); - } - node->u.list.block = block_lt; - if (HAVE_BADBLOCK(dev)) { - uffs_Perror(UFFS_MSG_NORMAL, - "New bad block (%d) discovered.", block_lt); - uffs_BadBlockProcess(dev, node); - } - else { - // page 0 is clean does not means all pages in this block are clean, - // need to check this block later before use it. - uffs_TreeInsertToErasedListTailEx(dev, node, 1); - } - } - else { - - // this block have valid data page(s). - - ret = _ScanAndFixUnCleanPage(dev, bc); - if (ret == U_FAIL) - break; - - ret = _BuildValidTreeNode(dev, node, bc, &st); - if (ret == U_FAIL) - break; - - } - uffs_BlockInfoPut(dev, bc); - } //end of for - - if(ret == U_FAIL) - uffs_BlockInfoPut(dev, bc); - - uffs_Perror(UFFS_MSG_NORMAL, - "DIR %d, FILE %d, DATA %d", st.dir, st.file, st.data); - - return ret; -} - -static URET _BuildTreeStepTwo(uffs_Device *dev) -{ - //Randomise the start point of erased block to implement wear levelling - u32 startCount = 0; - u32 endPoint; - TreeNode *node; - - uffs_Perror(UFFS_MSG_NOISY, "build tree step two"); - - endPoint = uffs_GetCurDateTime() % (dev->tree.erased_count + 1); - while (startCount < endPoint) { - node = uffs_TreeGetErasedNodeNoCheck(dev); - if (node == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "No erased block ?"); - return U_FAIL; - } - uffs_TreeInsertToErasedListTailEx(dev, node, -1); - startCount++; - } - - return U_SUCC; -} - -TreeNode * uffs_TreeFindFileNode(uffs_Device *dev, u16 serial) -{ - int hash; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - hash = serial & FILE_NODE_HASH_MASK; - x = tree->file_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.serial == serial) { - return node; - } - else { - x = node->hash_next; - } - } - return NULL; -} - -/** add a node into suspend list */ -void uffs_TreeSuspendAdd(uffs_Device *dev, TreeNode *node) -{ - node->u.list.next = dev->tree.suspend; - node->u.list.prev = NULL; - - if (dev->tree.suspend) - dev->tree.suspend->u.list.prev = node; - dev->tree.suspend = node; -} - -/** search suspend list */ -TreeNode * uffs_TreeFindSuspendNode(uffs_Device *dev, u16 serial) -{ - TreeNode *node = dev->tree.suspend; - while (node) { - if (node->u.list.u.serial == serial) - break; - - node = node->u.list.next; - } - - return node; -} - -/** remove a node from suspend list */ -void uffs_TreeRemoveSuspendNode(uffs_Device *dev, TreeNode *node) -{ - if (node->u.list.prev) - node->u.list.prev->u.list.next = node->u.list.next; - if (node->u.list.next) - node->u.list.next->u.list.prev = node->u.list.prev; - if (node == dev->tree.suspend) - dev->tree.suspend = NULL; -} - -TreeNode * uffs_TreeFindFileNodeWithParent(uffs_Device *dev, u16 parent) -{ - int hash; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - for (hash = 0; hash < FILE_NODE_ENTRY_LEN; hash++) { - x = tree->file_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.parent == parent) { - return node; - } - else { - x = node->hash_next; - } - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindDirNode(uffs_Device *dev, u16 serial) -{ - int hash; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - hash = serial & DIR_NODE_HASH_MASK; - x = tree->dir_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.serial == serial) { - return node; - } - else { - x = node->hash_next; - } - } - return NULL; -} - -TreeNode * uffs_TreeFindDirNodeWithParent(uffs_Device *dev, u16 parent) -{ - int hash; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - for (hash = 0; hash < DIR_NODE_ENTRY_LEN; hash++) { - x = tree->dir_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.parent == parent) { - return node; - } - else { - x = node->hash_next; - } - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindFileNodeByName(uffs_Device *dev, - const char *name, - u32 len, - u16 sum, u16 parent) -{ - int i; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - for (i = 0; i < FILE_NODE_ENTRY_LEN; i++) { - x = tree->file_entry[i]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.checksum == sum && node->u.file.parent == parent) { - //read file name from flash, and compare... - if (uffs_TreeCompareFileName(dev, name, len, sum, - node, UFFS_TYPE_FILE) == U_TRUE) { - //Got it! - return node; - } - } - x = node->hash_next; - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindDataNode(uffs_Device *dev, u16 parent, u16 serial) -{ - int hash; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - u16 x; - - hash = GET_DATA_HASH(parent, serial); - x = tree->data_entry[hash]; - while(x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - - if(node->u.data.parent == parent && - node->u.data.serial == serial) - return node; - - x = node->hash_next; - } - - return NULL; -} - -TreeNode * uffs_TreeFindDirNodeByBlock(uffs_Device *dev, u16 block) -{ - int hash; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - u16 x; - - for (hash = 0; hash < DIR_NODE_ENTRY_LEN; hash++) { - x = tree->dir_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.block == block) - return node; - x = node->hash_next; - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindErasedNodeByBlock(uffs_Device *dev, u16 block) -{ - TreeNode *node; - node = dev->tree.erased; - - while (node) { - if (node->u.list.block == block) - return node; - node = node->u.list.next; - } - - return NULL; -} - -TreeNode * uffs_TreeFindBadNodeByBlock(uffs_Device *dev, u16 block) -{ - TreeNode *node; - node = dev->tree.bad; - - while (node) { - if (node->u.list.block == block) - return node; - node = node->u.list.next; - } - - return NULL; -} - -TreeNode * uffs_TreeFindFileNodeByBlock(uffs_Device *dev, u16 block) -{ - int hash; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - u16 x; - - for (hash = 0; hash < FILE_NODE_ENTRY_LEN; hash++) { - x = tree->file_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.file.block == block) - return node; - x = node->hash_next; - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindDataNodeByBlock(uffs_Device *dev, u16 block) -{ - int hash; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - u16 x; - - for (hash = 0; hash < DATA_NODE_ENTRY_LEN; hash++) { - x = tree->data_entry[hash]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.data.block == block) - return node; - x = node->hash_next; - } - } - - return NULL; -} - -TreeNode * uffs_TreeFindNodeByBlock(uffs_Device *dev, u16 block, int *region) -{ - TreeNode *node = NULL; - - if (*region & SEARCH_REGION_DATA) { - node = uffs_TreeFindDataNodeByBlock(dev, block); - if (node) { - *region &= SEARCH_REGION_DATA; - return node; - } - } - if (*region & SEARCH_REGION_FILE) { - node = uffs_TreeFindFileNodeByBlock(dev, block); - if (node) { - *region &= SEARCH_REGION_FILE; - return node; - } - } - if (*region & SEARCH_REGION_DIR) { - node = uffs_TreeFindDirNodeByBlock(dev, block); - if (node) { - *region &= SEARCH_REGION_DIR; - return node; - } - } - if (*region & SEARCH_REGION_ERASED) { - node = uffs_TreeFindErasedNodeByBlock(dev, block); - if (node) { - *region &= SEARCH_REGION_ERASED; - return node; - } - } - if (*region & SEARCH_REGION_BAD) { - node = uffs_TreeFindBadNodeByBlock(dev, block); - if (node) { - *region &= SEARCH_REGION_BAD; - return node; - } - } - - return node; -} - -TreeNode * uffs_TreeFindDirNodeByName(uffs_Device *dev, - const char *name, u32 len, - u16 sum, u16 parent) -{ - int i; - u16 x; - TreeNode *node; - struct uffs_TreeSt *tree = &(dev->tree); - - for (i = 0; i < DIR_NODE_ENTRY_LEN; i++) { - x = tree->dir_entry[i]; - while (x != EMPTY_NODE) { - node = FROM_IDX(x, TPOOL(dev)); - if (node->u.dir.checksum == sum && - node->u.dir.parent == parent) { - //read file name from flash, and compare... - if (uffs_TreeCompareFileName(dev, name, len, sum, - node, UFFS_TYPE_DIR) == U_TRUE) { - //Got it! - return node; - } - } - x = node->hash_next; - } - } - - return NULL; - -} - -UBOOL uffs_CompareFileName(const char *src, int src_len, const char *des) -{ - while (src_len-- > 0) { - if(*src++ != *des++) - return U_FALSE; - } - - return U_TRUE; -} - -/** compare [name] with tree [node] represented object name by loading - uffs_FileInfo from storage */ -UBOOL uffs_TreeCompareFileName(uffs_Device *dev, - const char *name, u32 len, u16 sum, - TreeNode *node, int type) -{ - UBOOL matched = U_FALSE; - uffs_FileInfo *fi; - uffs_Buf *buf; - u16 data_sum; - - buf = uffs_BufGetEx(dev, type, node, 0, 0); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, "can't get buf !\n "); - goto ext; - } - fi = (uffs_FileInfo *)(buf->data); - data_sum = uffs_MakeSum16(fi->name, fi->name_len); - - if (data_sum != sum) { - uffs_Perror(UFFS_MSG_NORMAL, - "the obj's sum in storage is different with given sum!"); - goto ext; - } - - if (fi->name_len == len) { - if(uffs_CompareFileName(fi->name, fi->name_len, name) == U_TRUE) { - matched = U_TRUE; - } - } -ext: - if (buf) - uffs_BufPut(dev, buf); - - return matched; -} - - -/* calculate file length, etc */ -static URET _BuildTreeStepThree(uffs_Device *dev) -{ - int i; - u16 x; - TreeNode *work; - TreeNode *node; - struct uffs_TreeSt *tree; - uffs_Pool *pool; - u16 blockSave; - - TreeNode *cache = NULL; - u16 cacheSerial = INVALID_UFFS_SERIAL; - - tree = &(dev->tree); - pool = TPOOL(dev); - - uffs_Perror(UFFS_MSG_NOISY, "build tree step three"); - - for (i = 0; i < DATA_NODE_ENTRY_LEN; i++) { - x = tree->data_entry[i]; - while (x != EMPTY_NODE) { - work = FROM_IDX(x, pool); - if (work->u.data.parent == cacheSerial) { - node = cache; - } - else { - node = uffs_TreeFindFileNode(dev, work->u.data.parent); - cache = node; - cacheSerial = work->u.data.parent; - } - if (node == NULL) { - x = work->hash_next; - //this data block does not belong to any file ? - //should be erased. - uffs_Perror(UFFS_MSG_NORMAL, - "find a orphan data block:%d, " - "parent:%d, serial:%d, will be erased!", - work->u.data.block, - work->u.data.parent, work->u.data.serial); - - uffs_BreakFromEntry(dev, UFFS_TYPE_DATA, work); - blockSave = work->u.data.block; - work->u.list.block = blockSave; - uffs_FlashEraseBlock(dev, blockSave); - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, work); - else - uffs_TreeInsertToErasedListTail(dev, work); - } - else { - node->u.file.len += work->u.data.len; - x = work->hash_next; - } - } - } - - return U_SUCC; -} - -/** - * \brief build tree structure from flash - * \param[in] dev uffs device - */ -URET uffs_BuildTree(uffs_Device *dev) -{ - URET ret; - - /***** step one: scan all page spares, classify DIR/FILE/DATA nodes, - check bad blocks/uncompleted(conflicted) blocks as well *****/ - - /* if the disk is big and full filled of data this step could be - the most time consuming .... */ - - ret = _BuildTreeStepOne(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "build tree step one fail!"); - return ret; - } - - /***** step two: randomize the erased blocks, for ware-leveling purpose *****/ - /* this step is very fast :) */ - ret = _BuildTreeStepTwo(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "build tree step two fail!"); - return ret; - } - - /***** step three: check DATA nodes, find orphan nodes and erase them *****/ - /* if there are a lot of files and disk is fully filled, this step - could be very time consuming ... */ - ret = _BuildTreeStepThree(dev); - if (ret != U_SUCC) { - uffs_Perror(UFFS_MSG_SERIOUS, "build tree step three fail!"); - return ret; - } - - return U_SUCC; -} - -/** - * find a free file or dir serial NO - * \param[in] dev uffs device - * \return if no free serial found, return #INVALID_UFFS_SERIAL - */ -u16 uffs_FindFreeFsnSerial(uffs_Device *dev) -{ - u16 i; - TreeNode *node; - - //TODO!! Do we need a faster serial number generating method? - // it depends on how often creating files or directories - - for (i = ROOT_DIR_SERIAL + 1; i < MAX_UFFS_FSN; i++) { - node = uffs_TreeFindDirNode(dev, i); - if (node == NULL) { - node = uffs_TreeFindFileNode(dev, i); - if (node == NULL) { - node = uffs_TreeFindSuspendNode(dev, i); - if (node == NULL) - return i; - } - } - } - - return INVALID_UFFS_SERIAL; -} - -static TreeNode * uffs_TreeGetErasedNodeNoCheck(uffs_Device *dev) -{ - TreeNode *node = NULL; - if (dev->tree.erased) { - node = dev->tree.erased; - dev->tree.erased->u.list.prev = NULL; - dev->tree.erased = dev->tree.erased->u.list.next; - if(dev->tree.erased == NULL) - dev->tree.erased_tail = NULL; - dev->tree.erased_count--; - } - - return node; -} - -TreeNode * uffs_TreeGetErasedNode(uffs_Device *dev) -{ - TreeNode *node = uffs_TreeGetErasedNodeNoCheck(dev); - u16 block; - - if (node && node->u.list.u.need_check) { - block = node->u.list.block; - if (uffs_FlashCheckErasedBlock(dev, block) != U_SUCC) { - // Hmm, this block is not fully erased ? erase it immediately. - uffs_FlashEraseBlock(dev, block); - node->u.list.u.need_check = 0; - } - } - return node; -} - -static void _InsertToEntry(uffs_Device *dev, u16 *entry, - int hash, TreeNode *node) -{ - node->hash_next = entry[hash]; - node->hash_prev = EMPTY_NODE; - if (entry[hash] != EMPTY_NODE) { - FROM_IDX(entry[hash], TPOOL(dev))->hash_prev = TO_IDX(node, TPOOL(dev)); - } - entry[hash] = TO_IDX(node, TPOOL(dev)); -} - - -/** - * break the node from entry - */ -void uffs_BreakFromEntry(uffs_Device *dev, u8 type, TreeNode *node) -{ - u16 *entry; - int hash; - TreeNode *work; - - switch (type) { - case UFFS_TYPE_DIR: - hash = GET_DIR_HASH(node->u.dir.serial); - entry = &(dev->tree.dir_entry[hash]); - break; - case UFFS_TYPE_FILE: - hash = GET_FILE_HASH(node->u.file.serial); - entry = &(dev->tree.file_entry[hash]); - break; - case UFFS_TYPE_DATA: - hash = GET_DATA_HASH(node->u.data.parent, node->u.data.serial); - entry = &(dev->tree.data_entry[hash]); - break; - default: - uffs_Perror(UFFS_MSG_SERIOUS, "unknown type when break..."); - return; - } - - if (node->hash_prev != EMPTY_NODE) { - work = FROM_IDX(node->hash_prev, &(dev->mem.tree_pool)); - work->hash_next = node->hash_next; - } - if (node->hash_next != EMPTY_NODE) { - work = FROM_IDX(node->hash_next, &(dev->mem.tree_pool)); - work->hash_prev = node->hash_prev; - } - - if (*entry == TO_IDX(node, &(dev->mem.tree_pool))) { - *entry = node->hash_next; - } -} - -static void uffs_InsertToFileEntry(uffs_Device *dev, TreeNode *node) -{ - _InsertToEntry(dev, dev->tree.file_entry, - GET_FILE_HASH(node->u.file.serial), - node); -} - -static void uffs_InsertToDirEntry(uffs_Device *dev, TreeNode *node) -{ - _InsertToEntry(dev, dev->tree.dir_entry, - GET_DIR_HASH(node->u.dir.serial), - node); -} - -static void uffs_InsertToDataEntry(uffs_Device *dev, TreeNode *node) -{ - _InsertToEntry(dev, dev->tree.data_entry, - GET_DATA_HASH(node->u.data.parent, node->u.data.serial), - node); -} - -void uffs_InsertToErasedListHead(uffs_Device *dev, TreeNode *node) -{ - struct uffs_TreeSt *tree; - tree = &(dev->tree); - - node->u.list.next = tree->erased; - node->u.list.prev = NULL; - - if (tree->erased) { - tree->erased->u.list.prev = node; - } - - tree->erased = node; - if (node->u.list.next == tree->erased_tail) { - tree->erased_tail = node; - } - tree->erased_count++; -} - -/** - * insert node to erased list. - * \param need_check: 0 - no need to check later - * 1 - need to check later - * < 0 - keep 'node->u.list.need_check' value - */ -void uffs_TreeInsertToErasedListTailEx(uffs_Device *dev, TreeNode *node, int need_check) -{ - struct uffs_TreeSt *tree; - tree = &(dev->tree); - - if (need_check >= 0) - node->u.list.u.need_check = need_check; - - node->u.list.next = NULL; - node->u.list.prev = tree->erased_tail; - if (tree->erased_tail) { - tree->erased_tail->u.list.next = node; - } - - tree->erased_tail = node; - if(tree->erased == NULL) { - tree->erased = node; - } - tree->erased_count++; -} - -void uffs_TreeInsertToErasedListTail(uffs_Device *dev, TreeNode *node) -{ - // this function is called after the block is erased, so don't need to check. - uffs_TreeInsertToErasedListTailEx(dev, node, 0); -} - -void uffs_TreeInsertToBadBlockList(uffs_Device *dev, TreeNode *node) -{ - struct uffs_TreeSt *tree; - - tree = &(dev->tree); - node->u.list.prev = NULL; - node->u.list.next = tree->bad; - - if (tree->bad) { - tree->bad->u.list.prev = node; - } - - tree->bad = node; - tree->bad_count++; -} - -/** - * set tree node block value - */ -void uffs_TreeSetNodeBlock(u8 type, TreeNode *node, u16 block) -{ - switch (type) { - case UFFS_TYPE_FILE: - node->u.file.block = block; - break; - case UFFS_TYPE_DIR: - node->u.dir.block = block; - break; - case UFFS_TYPE_DATA: - node->u.data.block = block; - break; - } -} - diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_utils.c b/components/dfs/filesystems/uffs/src/uffs/uffs_utils.c deleted file mode 100644 index bf3ea3b6d..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_utils.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_utils.c - * \brief utilities of uffs - * \author Ricky Zheng, created 12th May, 2005 - */ -#include "uffs_config.h" -#include "uffs/uffs_device.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_version.h" -#include "uffs/uffs_badblock.h" -#include "uffs/uffs_fd.h" -#include "uffs/uffs_fs.h" - -#include -#include - -#define PFX "util: " - -#define SPOOL(dev) &((dev)->mem.spare_pool) - -#ifdef CONFIG_USE_GLOBAL_FS_LOCK -static OSSEM _global_lock = OSSEM_NOT_INITED; - -/* global file system lock */ -void uffs_InitGlobalFsLock(void) -{ - uffs_SemCreate(&_global_lock); -} - -void uffs_ReleaseGlobalFsLock(void) -{ - uffs_SemDelete(&_global_lock); -} - -void uffs_GlobalFsLockLock(void) -{ - uffs_SemWait(_global_lock); -} - -void uffs_GlobalFsLockUnlock(void) -{ - uffs_SemSignal(_global_lock); -} - -#else - -void uffs_InitGlobalFsLock(void) {} -void uffs_ReleaseGlobalFsLock(void) {} -void uffs_GlobalFsLockLock(void) {} -void uffs_GlobalFsLockUnlock(void) {} - -#endif - - -#ifdef CONFIG_ENABLE_BAD_BLOCK_VERIFY -static void _ForceFormatAndCheckBlock(uffs_Device *dev, int block) -{ - int i, j; - uffs_Buf *buf = NULL; - UBOOL bad = U_TRUE; - URET ret; - struct uffs_FlashOpsSt *ops = dev->ops; - struct uffs_TagStoreSt ts; - u8 *spare = NULL; - - buf = uffs_BufClone(dev, NULL); - if (buf == NULL) { - uffs_Perror(UFFS_MSG_SERIOUS, - "Alloc page buffer fail ! Format stoped."); - goto ext; - } - - spare = (u8 *)uffs_PoolGet(SPOOL(dev)); - if (spare == NULL) - goto ext; - - //step 1: Erase, fully fill with 0x0, and check - ret = uffs_FlashEraseBlock(dev, block); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - - memset(buf->header, 0, dev->com.pg_size); - memset(&ts, 0, sizeof(ts)); - memset(spare, 0, dev->attr->spare_size); - - for (i = 0; i < dev->attr->pages_per_block; i++) { - if (ops->WritePageWithLayout) - ret = ops->WritePageWithLayout(dev, block, i, buf->header, dev->com.pg_size, NULL, &ts); - else - ret = ops->WritePage(dev, block, i, buf->header, dev->com.pg_size, spare, dev->attr->spare_size); - - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - } - for (i = 0; i < dev->attr->pages_per_block; i++) { - memset(buf->header, 0xFF, dev->com.pg_size); - memset(&ts, 0xFF, sizeof(ts)); - memset(spare, 0xFF, dev->attr->spare_size); - - if (ops->ReadPageWithLayout) { - ret = ops->ReadPageWithLayout(dev, block, i, buf->header, dev->com.pg_size, NULL, &ts, NULL); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - for (j = 0; j < dev->com.pg_size; j++) - if (buf->header[j] != 0) - goto bad_out; - for (j = 0; j < sizeof(ts); j++) - if (((u8 *)&ts)[j] != 0) - goto bad_out; - } - else { - ret = ops->ReadPage(dev, block, i, buf->header, dev->com.pg_size, NULL, spare, dev->attr->spare_size); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - for (j = 0; j < dev->com.pg_size; j++) - if (buf->header[j] != 0) - goto bad_out; - for (j = 0; j < dev->attr->spare_size; j++) - if (spare[j] != 0) - goto bad_out; - } - } - - //step 2: Erase, and check - ret = uffs_FlashEraseBlock(dev, block); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - - for (i = 0; i < dev->attr->pages_per_block; i++) { - memset(buf->header, 0, dev->com.pg_size); - memset(&ts, 0, sizeof(ts)); - memset(spare, 0, dev->attr->spare_size); - - if (ops->ReadPageWithLayout) { - ret = ops->ReadPageWithLayout(dev, block, i, buf->header, dev->com.pg_size, NULL, &ts, NULL); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - for (j = 0; j < dev->com.pg_size; j++) - if (buf->header[j] != 0xFF) - goto bad_out; - for (j = 0; j < sizeof(ts); j++) - if (((u8 *)&ts)[j] != 0xFF) - goto bad_out; - } - else { - ret = ops->ReadPage(dev, block, i, buf->header, dev->com.pg_size, NULL, spare, dev->attr->spare_size); - if (UFFS_FLASH_IS_BAD_BLOCK(ret)) - goto bad_out; - for (j = 0; j < dev->com.pg_size; j++) - if (buf->header[j] != 0xFF) - goto bad_out; - for (j = 0; j < dev->attr->spare_size; j++) - if (spare[j] != 0xFF) - goto bad_out; - } - } - - // format succ - bad = U_FALSE; - -bad_out: - if (bad == U_TRUE) - uffs_FlashMarkBadBlock(dev, block); -ext: - if (buf) - uffs_BufFreeClone(dev, buf); - - if (spare) - uffs_PoolPut(SPOOL(dev), spare); - - return; -} -#endif - - - -URET uffs_FormatDevice(uffs_Device *dev, UBOOL force) -{ - u16 i, slot; - URET ret = U_SUCC; - - if (dev == NULL) - return U_FAIL; - - if (dev->ops == NULL) - return U_FAIL; - - uffs_GlobalFsLockLock(); - - ret = uffs_BufFlushAll(dev); - - if (dev->ref_count > 1 && !force) { - uffs_Perror(UFFS_MSG_NORMAL, - "can't format when dev->ref_count = %d", - dev->ref_count); - ret = U_FAIL; - } - - if (ret == U_SUCC && force) { - uffs_DirEntryBufPutAll(dev); - uffs_PutAllObjectBuf(dev); - uffs_FdSignatureIncrease(); - } - - if (ret == U_SUCC && - uffs_BufIsAllFree(dev) == U_FALSE && - !force) - { - uffs_Perror(UFFS_MSG_NORMAL, "some page still in used!"); - ret = U_FAIL; - } - - if (!force) { - for (slot = 0; ret == U_SUCC && slot < dev->cfg.dirty_groups; slot++) { - if (dev->buf.dirtyGroup[slot].count > 0) { - uffs_Perror(UFFS_MSG_SERIOUS, "there still have dirty pages!"); - ret = U_FAIL; - } - } - } - - if (ret == U_SUCC) - uffs_BufSetAllEmpty(dev); - - - if (ret == U_SUCC && uffs_BlockInfoIsAllFree(dev) == U_FALSE && !force) { - uffs_Perror(UFFS_MSG_NORMAL, - "there still have block info cache ? fail to format"); - ret = U_FAIL; - } - - if (ret == U_SUCC) - uffs_BlockInfoExpireAll(dev); - - for (i = dev->par.start; ret == U_SUCC && i <= dev->par.end; i++) { - if (uffs_FlashIsBadBlock(dev, i) == U_FALSE) { - uffs_FlashEraseBlock(dev, i); - if (HAVE_BADBLOCK(dev)) - uffs_BadBlockProcess(dev, NULL); - } - else { -#ifdef CONFIG_ENABLE_BAD_BLOCK_VERIFY - _ForceFormatAndCheckBlock(dev, i); -#endif - } - } - - if (ret == U_SUCC && uffs_TreeRelease(dev) == U_FAIL) { - ret = U_FAIL; - } - - if (ret == U_SUCC && uffs_TreeInit(dev) == U_FAIL) { - ret = U_FAIL; - } - - if (ret == U_SUCC && uffs_BuildTree(dev) == U_FAIL) { - ret = U_FAIL; - } - - uffs_GlobalFsLockUnlock(); - - return ret; -} - -static const char * GetTagName(struct uffs_TagStoreSt *s) -{ - const char *name = "UNKNOWN"; - struct uffs_NodeTypeNameMapSt maps[] = UFFS_TYPE_NAME_MAP; - int i; - - for (i = 0; i < ARRAY_SIZE(maps); i++) { - if (s->type == maps[i].type) - name = maps[i].name; - } - - return name; -} - -static void DumpBufHex(struct uffs_DeviceSt *dev, const u8* buf, int len, dump_msg_cb *dump) -{ - int i; - for (i = 0; i < len; i++) - dump(dev, "%02X ", buf[i]); -} - -// return -1 if do not need to read next tag -static int DumpTag(struct uffs_DeviceSt *dev, int block, int page, uffs_Tags *tag, dump_msg_cb *dump) -{ - struct uffs_TagStoreSt *s = &tag->s; - struct uffs_MiniHeaderSt header; - URET ret; - - if (!TAG_IS_DIRTY(tag)) { - // is a clean page ? - ret = uffs_LoadMiniHeader(dev, block, page, &header); - if (ret == U_FAIL) { - dump(dev, "Fail to load mini header from page 0\n"); - } - else { - if (header.status == 0xFF) - dump(dev, "page %d CLEAN\n", page); - else { - dump(dev, "page %d NOT clean ! header: ", page); - DumpBufHex(dev, (u8 *)&header, sizeof(header), dump); - dump(dev, ", tag: "); - DumpBufHex(dev, (u8 *)s, sizeof(struct uffs_TagStoreSt), dump); - dump(dev, "\n"); - } - } - return -1; - } - - dump(dev, " - page %2d/%2d %s %d/%d len%4d\n", page, s->page_id, GetTagName(s), s->serial, s->parent, s->data_len); - - return 0; -} - -static void DumpBlock(struct uffs_DeviceSt *dev, int block, dump_msg_cb *dump) -{ - int i; - struct uffs_StorageAttrSt *attr = dev->attr; - uffs_Tags tag; - URET ret; - - dump(dev, "--- Block %d ---\n", block); - - if (uffs_FlashIsBadBlock(dev, block)) { - dump(dev, "Bad block\n\n"); - return; - } - - for (i = 0; i < attr->pages_per_block; i++) { - - memset(&tag, 0xFF, sizeof(tag)); - ret = uffs_FlashReadPageTag(dev, block, i, &tag); - - if (ret == UFFS_FLASH_IO_ERR) { - dump(dev, "page %d tag I/O error\n", i); - continue; - } - else if (ret == UFFS_FLASH_ECC_FAIL) { - dump(dev, "page %d tag ECC error\n", i); - continue; - } - else if (ret == UFFS_FLASH_NO_ERR || ret == UFFS_FLASH_ECC_OK) { - if (ret == UFFS_FLASH_ECC_OK) - dump(dev, "page %d tag has bit flip, corrected by ECC\n", i); - - if (DumpTag(dev, block, i, &tag, dump) == 0) - continue; - else - break; - } - else { - dump(dev, "read page %d tag return unexpected: %d\n", i, ret); - continue; - } - } - dump(dev, "\n"); -} - -void uffs_DumpDevice(struct uffs_DeviceSt *dev, dump_msg_cb *dump) -{ - int i; - for (i = dev->par.start; i <= dev->par.end; i++) { - DumpBlock(dev, i, dump); - } -} diff --git a/components/dfs/filesystems/uffs/src/uffs/uffs_version.c b/components/dfs/filesystems/uffs/src/uffs/uffs_version.c deleted file mode 100644 index e6cd98e3f..000000000 --- a/components/dfs/filesystems/uffs/src/uffs/uffs_version.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_version.c - * \brief uffs version information - * \author Ricky Zheng, created 8th May, 2005 - */ - -#include "uffs_config.h" -#include "uffs/uffs_version.h" - -#include -#define PFX "ver : " - - -static char version_buf[16]; - -const char * uffs_Version2Str(int ver) -{ - sprintf(version_buf, "%1d.%02d.%04d", - (ver & 0xff000000) >> 24, (ver & 0xff0000) >> 16, (ver & 0xffff)); - return version_buf; -} - -int uffs_GetVersion(void) -{ - return UFFS_VERSION; -} - -int uffs_GetMainVersion(int ver) -{ - return (ver & 0xff000000) >> 24; -} - -int uffs_GetMinorVersion(int ver) -{ - return (ver & 0xff0000) >> 16; -} - -int uffs_GetTrivialVersion(int ver) -{ - return (ver & 0xff00) >> 8; -} \ No newline at end of file diff --git a/components/dfs/filesystems/uffs/src/utils/CMakeLists.txt b/components/dfs/filesystems/uffs/src/utils/CMakeLists.txt deleted file mode 100644 index 37660d6f4..000000000 --- a/components/dfs/filesystems/uffs/src/utils/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -IF (UNIX) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/posix) -ENDIF() -IF (WIN32) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/win32) -ENDIF() -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc) -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/emu) - -LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/emu) -LINK_DIRECTORIES(${uffs_BINARY_DIR}/src/uffs) - -SET(mkuffs_SRCS mkuffs.c) -ADD_EXECUTABLE(mkuffs ${mkuffs_SRCS}) -TARGET_LINK_LIBRARIES(mkuffs emu uffs emu platform apitest_server) -IF (UNIX) - TARGET_LINK_LIBRARIES(mkuffs pthread) -ENDIF () - - diff --git a/components/dfs/filesystems/uffs/src/utils/mkuffs.c b/components/dfs/filesystems/uffs/src/utils/mkuffs.c deleted file mode 100644 index 3f92069fe..000000000 --- a/components/dfs/filesystems/uffs/src/utils/mkuffs.c +++ /dev/null @@ -1,493 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_test.c - * \brief uffs test main entry - * \author Ricky Zheng - */ - -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_mtb.h" - -#include "cmdline.h" -#include "uffs_fileem.h" - -#define PFX NULL -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0 -int main() -{ - MSGLN("Static memory allocator is not supported."); - return 0; -} -#else - -extern struct cli_commandset * get_helper_cmds(void); -extern struct cli_commandset * get_test_cmds(void); -extern void femu_init_uffs_device(uffs_Device *dev); - -static int conf_command_line_mode = 0; -static int conf_verbose_mode = 0; - -static int conf_exec_script = 0; -static char script_command[256]; - -#define DEFAULT_EMU_FILENAME "uffsemfile.bin" -const char * conf_emu_filename = DEFAULT_EMU_FILENAME; - - -/* default basic parameters of the NAND device */ -#define PAGES_PER_BLOCK_DEFAULT 32 -#define PAGE_DATA_SIZE_DEFAULT 512 -#define PAGE_SPARE_SIZE_DEFAULT 16 -#define STATUS_BYTE_OFFSET_DEFAULT 5 -#define TOTAL_BLOCKS_DEFAULT 128 -#define ECC_OPTION_DEFAULT UFFS_ECC_SOFT -//#define ECC_OPTION_DEFAULT UFFS_ECC_HW -//#define ECC_OPTION_DEFAULT UFFS_ECC_HW_AUTO - -#define MAX_MOUNT_TABLES 10 -#define MAX_MOUNT_POINT_NAME 32 - -static int conf_pages_per_block = PAGES_PER_BLOCK_DEFAULT; -static int conf_page_data_size = PAGE_DATA_SIZE_DEFAULT; -static int conf_page_spare_size = PAGE_SPARE_SIZE_DEFAULT; -static int conf_status_byte_offset = STATUS_BYTE_OFFSET_DEFAULT; -static int conf_total_blocks = TOTAL_BLOCKS_DEFAULT; -static int conf_ecc_option = ECC_OPTION_DEFAULT; -static int conf_ecc_size = 0; // 0 - Let UFFS choose the size - -static const char *g_ecc_option_strings[] = UFFS_ECC_OPTION_STRING; - -static struct uffs_MountTableEntrySt conf_mounts[MAX_MOUNT_TABLES] = {{0}}; -static uffs_Device conf_devices[MAX_MOUNT_TABLES] = {{0}}; -static char mount_point_name[MAX_MOUNT_TABLES][MAX_MOUNT_POINT_NAME] = {{0}}; - -static void setup_storage(struct uffs_StorageAttrSt *attr) -{ - attr->total_blocks = conf_total_blocks; /* total blocks */ - attr->page_data_size = conf_page_data_size; /* page data size */ - attr->spare_size = conf_page_spare_size; /* page spare size */ - attr->pages_per_block = conf_pages_per_block; /* pages per block */ - - attr->block_status_offs = conf_status_byte_offset; /* block status offset is 5th byte in spare */ - attr->ecc_opt = conf_ecc_option; /* ECC option */ - attr->ecc_size = conf_ecc_size; /* ECC size */ - attr->layout_opt = UFFS_LAYOUT_UFFS; /* let UFFS handle layout */ -} - - -static void setup_device(uffs_Device *dev) -{ - dev->Init = femu_InitDevice; - dev->Release = femu_ReleaseDevice; - dev->attr = femu_GetStorage(); -} - -static void setup_emu_private(uffs_FileEmu *emu) -{ - memset(emu, 0, sizeof(uffs_FileEmu)); - emu->emu_filename = conf_emu_filename; -} - -static int init_uffs_fs(void) -{ - static int bIsFileSystemInited = 0; - struct uffs_MountTableEntrySt *mtbl = &(conf_mounts[0]); - struct uffs_ConfigSt cfg = { - 0, // bc_caches - default - 0, // page_buffers - default - 0, // dirty_pages - default - 0, // dirty_groups - default - 0, // reserved_free_blocks - default - }; - - if (bIsFileSystemInited) - return -4; - - bIsFileSystemInited = 1; - - while (mtbl->dev) { - - memcpy(&mtbl->dev->cfg, &cfg, sizeof(struct uffs_ConfigSt)); - -#if CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 0 - uffs_MemSetupSystemAllocator(&mtbl->dev->mem); -#endif - setup_device(mtbl->dev); - uffs_RegisterMountTable(mtbl); - mtbl++; - } - - // mount partitions - for (mtbl = &(conf_mounts[0]); mtbl->mount != NULL; mtbl++) { - uffs_Mount(mtbl->mount); - } - - return uffs_InitFileSystemObjects() == U_SUCC ? 0 : -1; -} - -static int release_uffs_fs(void) -{ - int ret = 0; - uffs_MountTable *mtb; - - for (mtb = &(conf_mounts[0]); ret == 0 && mtb->mount != NULL; mtb++) { - uffs_UnMount(mtb->mount); - } - - if (ret == 0) - ret = (uffs_ReleaseFileSystemObjects() == U_SUCC ? 0 : -1); - - return ret; -} - -/* mount point arg: /sys/,100,-1 */ -static int parse_mount_point(char *arg, int m_idx) -{ - int start = 0, end = -1; - char *p = arg; - struct uffs_MountTableEntrySt *mtbl = &(conf_mounts[m_idx]); - - while(*p && *p != ',' && *p != ' ' && *p != '\t') - p++; - - if (*p == 0 || p == arg) - return -1; - - mtbl->mount = &(mount_point_name[m_idx][0]); - memcpy((char *)mtbl->mount, arg, p - arg); - ((char *)(mtbl->mount))[p - arg] = 0; - - p++; - arg = p; - while(*p && *p != ',' && *p != ' ' && *p != '\t') - p++; - - if (p != arg) { - if (sscanf(arg, "%i", &start) < 1) - return -1; - p++; - arg = p; - - while(*p && *p != ',' && *p != ' ' && *p != '\t') - p++; - - if (p != arg) { - if (sscanf(arg, "%i", &end) < 1) - return -1; - } - } - mtbl->start_block = start; - mtbl->end_block = end; - mtbl->dev = &(conf_devices[m_idx]); - - return 0; -} - -static int parse_options(int argc, char *argv[]) -{ - int iarg; - int usage = 0; - int m_idx = 0; - static char em_file[128]; - int i; - - for (iarg = 1; iarg < argc && !usage; iarg++) { - const char *arg = argv[iarg]; - - if (arg[0] == '-') { - if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) { - usage++; - } - else if (!strcmp(arg, "-f") || !strcmp(arg, "--file")) { - if (++iarg >= argc) - usage++; - else { - strcpy(em_file, argv[iarg]); - conf_emu_filename = (const char *)em_file; - } - } - else if (!strcmp(arg, "-c") || !strcmp(arg, "--command-line")) { - conf_command_line_mode = 1; - } - else if (!strcmp(arg, "-p") || !strcmp(arg, "--page-size")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_page_data_size) < 1) - usage++; - if (conf_page_data_size <= 0 || conf_page_data_size > UFFS_MAX_PAGE_SIZE) { - MSGLN("ERROR: Invalid page data size"); - usage++; - } - } - else if (!strcmp(arg, "-s") || !strcmp(arg, "--spare-size")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_page_spare_size) < 1) - usage++; - if (conf_page_spare_size < sizeof(struct uffs_TagStoreSt) + 1 || - (conf_page_spare_size % 4) != 0 || conf_page_spare_size > UFFS_MAX_SPARE_SIZE) { - MSGLN("ERROR: Invalid spare size"); - usage++; - } - } - else if (!strcmp(arg, "-o") || !strcmp(arg, "--status-offset")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_status_byte_offset) < 1) - usage++; - if (conf_status_byte_offset < 0) - usage++; - } - else if (!strcmp(arg, "-b") || !strcmp(arg, "--block-pages")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_pages_per_block) < 1) - usage++; - if (conf_pages_per_block < 2) - usage++; - } - else if (!strcmp(arg, "-t") || !strcmp(arg, "--total-blocks")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_total_blocks) < 1) - usage++; - if (conf_total_blocks < 2) - usage++; - } - else if (!strcmp(arg, "-v") || !strcmp(arg, "--verbose")) { - conf_verbose_mode++; - } - else if (!strcmp(arg, "-m") || !strcmp(arg, "--mount")) { - if (++iarg > argc) - usage++; - else if (parse_mount_point(argv[iarg], m_idx) < 0) - usage++; - m_idx++; - } - else if (!strcmp(arg, "-e") || !strcmp(arg, "--exec")) { - if (++iarg > argc) - usage++; - else { - sprintf(script_command, "script %s", argv[iarg]); - conf_exec_script = 1; - } - } - else if (!strcmp(arg, "-x") || !strcmp(arg, "--ecc-option")) { - if (++iarg > argc) - usage++; - else { - for (i = 0; i < ARRAY_SIZE(g_ecc_option_strings); i++) { - if (!strcmp(argv[iarg], g_ecc_option_strings[i])) { - conf_ecc_option = i; - break; - } - } - if (i == ARRAY_SIZE(g_ecc_option_strings)) { - MSGLN("ERROR: Invalid ECC option"); - usage++; - } - } - } - else if (!strcmp(arg, "-z") || !strcmp(arg, "--ecc-size")) { - if (++iarg >= argc) - usage++; - else if (sscanf(argv[iarg], "%i", &conf_ecc_size) < 1) - usage++; - if (conf_ecc_size < 0 || conf_ecc_size > UFFS_MAX_ECC_SIZE) { - MSGLN("ERROR: Invalid ecc size"); - usage++; - } - } - else { - MSGLN("Unknown option: %s, try %s --help", arg, argv[0]); - return -1; - } - } - else { - MSGLN("Unexpected parameter: %s, try %s --help", arg, argv[0]); - return -1; - } - } - - if (usage) { - MSGLN("Usage: %s [options]", argv[0]); - MSGLN(" -h --help show usage"); - MSGLN(" -c --command-line command line mode"); - MSGLN(" -v --verbose verbose mode"); - MSGLN(" -f --file uffs image file"); - MSGLN(" -p --page-size page data size, default=%d", PAGE_DATA_SIZE_DEFAULT); - MSGLN(" -s --spare-size page spare size, default=%d", PAGE_SPARE_SIZE_DEFAULT); - MSGLN(" -o --status-offset status byte offset, default=%d", STATUS_BYTE_OFFSET_DEFAULT); - MSGLN(" -b --block-pages pages per block, default=%d", PAGES_PER_BLOCK_DEFAULT); - MSGLN(" -t --total-blocks total blocks"); - MSGLN(" -m --mount , for example: -m /,0,-1"); - MSGLN(" -x --ecc-option ECC option, default=%s", g_ecc_option_strings[ECC_OPTION_DEFAULT]); - MSGLN(" -z --ecc-size ECC size, default=0 (auto)"); - MSGLN(" -e --exec execute a script file"); - MSGLN(""); - - return -1; - } - - if (m_idx == 0) { - // if not given mount information, use default ('/' for whole partition) - parse_mount_point("/,0,-1", 0); - } - - return 0; -} - - -static void print_mount_points(void) -{ - struct uffs_MountTableEntrySt *m; - - m = &(conf_mounts[0]); - while (m->dev) { - MSGLN ("Mount point: %s, start: %d, end: %d", m->mount, m->start_block, m->end_block); - m++; - } -} - -static void print_params(void) -{ - MSGLN("Parameters summary:"); - MSGLN(" uffs image file: %s", conf_emu_filename); - MSGLN(" page size: %d", conf_page_data_size); - MSGLN(" page spare size: %d", conf_page_spare_size); - MSGLN(" pages per block: %d", conf_pages_per_block); - MSGLN(" total blocks: %d", conf_total_blocks); - MSGLN(" ecc option: %d (%s)", conf_ecc_option, g_ecc_option_strings[conf_ecc_option]); - MSGLN(" ecc size: %d%s", conf_ecc_size, conf_ecc_size == 0 ? " (auto)" : ""); - MSGLN(" bad block status offset: %d", conf_status_byte_offset); - MSGLN(""); -} - -#ifdef UNIX -#include -#include -void crash_handler(int sig) -{ - void *array[10]; - size_t size; - - // get void*'s for all entries on the stack - size = backtrace(array, 10); - - // print out all the frames to stderr - fprintf(stderr, "Error: signal %d:\n", sig); - backtrace_symbols_fd(array, size, 2); - exit(1); -} -#endif - -int main(int argc, char *argv[]) -{ - int ret; - -#ifdef UNIX - signal(SIGSEGV, crash_handler); -#endif - - uffs_SetupDebugOutput(); // setup debug output as early as possible - - if (parse_options(argc, argv) < 0) { - return -1; - } - - if (conf_verbose_mode) { - #if 1 - MSGLN("Internal data structure size:"); - MSGLN(" TreeNode: %d", sizeof(TreeNode)); - MSGLN(" struct BlockListSt: %d", sizeof(struct BlockListSt)); - MSGLN(" struct DirhSt: %d", sizeof(struct DirhSt)); - MSGLN(" struct FilehSt: %d", sizeof(struct FilehSt)); - MSGLN(" struct FdataSt: %d", sizeof(struct FdataSt)); - MSGLN(" struct uffs_TagStoreSt: %d", sizeof(struct uffs_TagStoreSt)); - MSGLN(" uffs_Buf: %d", sizeof(uffs_Buf)); - MSGLN(" struct uffs_BlockInfoSt: %d", sizeof(struct uffs_BlockInfoSt)); - MSGLN(""); - #endif - print_params(); - print_mount_points(); - } - - // setup file emulator storage with parameters from command line - setup_storage(femu_GetStorage()); - - // setup file emulator private data - setup_emu_private(femu_GetPrivate()); - - ret = init_uffs_fs(); - if (ret != 0) { - MSGLN ("Init file system fail: %d", ret); - return -1; - } - - cli_add_commandset(get_helper_cmds()); - cli_add_commandset(get_test_cmds()); - if (conf_command_line_mode) { - if (conf_exec_script) { - cli_interpret(script_command); - } - cli_main_entry(); - } - else { - if (conf_exec_script) { - cli_interpret(script_command); - } - else { - cli_main_entry(); - } - } - - release_uffs_fs(); - - return 0; -} -#endif - - - diff --git a/components/dfs/filesystems/uffs/tools/chomp_uffs_perror.rb b/components/dfs/filesystems/uffs/tools/chomp_uffs_perror.rb deleted file mode 100644 index e8b9460ae..000000000 --- a/components/dfs/filesystems/uffs/tools/chomp_uffs_perror.rb +++ /dev/null @@ -1,25 +0,0 @@ -#usage: -# find . -name "*.c" | xargs /usr/bin/ruby path/to/chomp_uffs_perror.rb -# - -ARGV.each do |file| - lines = [] - count = 0 - File.open(file).each_line do |line| - if line =~ /^(.*uffs_Perror.+)PFX(\s*".+)$/ - lines << ($1 + $2) - count += 1 - #puts ($1 + $2) - else - lines << line - end - end - if count > 0 - f = File.open(file, "w") - lines.each do |s| - f.puts s - end - f.close - puts "Fix file #{file}, modified lines: #{count}" - end -end diff --git a/components/dfs/filesystems/uffs/tools/format_code.rb b/components/dfs/filesystems/uffs/tools/format_code.rb deleted file mode 100644 index 7847db236..000000000 --- a/components/dfs/filesystems/uffs/tools/format_code.rb +++ /dev/null @@ -1,24 +0,0 @@ -#usage: -# find . -name "*.c" | xargs /usr/bin/ruby path/to/format_code.rb -# - -ARGV.each do |file| - lines = [] - count = 0 - File.open(file).each_line do |line| - if line =~ /^(.*)\s$/ - lines << $1.dup - count += 1 - else - lines << line - end - end - if count > 0 - f = File.open(file, "w") - lines.each do |s| - f.puts s - end - f.close - puts "Fix file #{file}, modified lines: #{count}" - end -end diff --git a/components/dfs/filesystems/uffs/tools/make_package.sh b/components/dfs/filesystems/uffs/tools/make_package.sh deleted file mode 100644 index a78c3fa2f..000000000 --- a/components/dfs/filesystems/uffs/tools/make_package.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -git ls-tree --name-only --full-name -r $1 | xargs tar -jcvf uffs-$1.tar.bz2 \ No newline at end of file diff --git a/components/dfs/filesystems/uffs/uffs_config.h b/components/dfs/filesystems/uffs/uffs_config.h deleted file mode 100644 index 2f0b6992b..000000000 --- a/components/dfs/filesystems/uffs/uffs_config.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_config.h - * \brief basic configuration of uffs - * \author Ricky Zheng - */ - -#ifndef _UFFS_CONFIG_H_ -#define _UFFS_CONFIG_H_ - -/** - * \def UFFS_MAX_PAGE_SIZE - * \note maximum page size UFFS support - */ -#define UFFS_MAX_PAGE_SIZE 2048 - -/** - * \def UFFS_MAX_SPARE_SIZE - */ -#define UFFS_MAX_SPARE_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 8) - -/** - * \def UFFS_MAX_ECC_SIZE - */ -#define UFFS_MAX_ECC_SIZE ((UFFS_MAX_PAGE_SIZE / 256) * 5) - -/** - * \def MAX_CACHED_BLOCK_INFO - * \note uffs cache the block info for opened directories and files, - * a practical value is 5 ~ MAX_OBJECT_HANDLE - */ -#define MAX_CACHED_BLOCK_INFO 50 - -/** - * \def MAX_PAGE_BUFFERS - * \note the bigger value will bring better read/write performance. - * but few writing performance will be improved when this - * value is become larger than 'max pages per block' - */ -#define MAX_PAGE_BUFFERS 40 - - -/** - * \def CLONE_BUFFER_THRESHOLD - * \note reserve buffers for clone. 1 or 2 should be enough. - */ -#define CLONE_BUFFERS_THRESHOLD 2 - -/** - * \def MAX_SPARE_BUFFERS - * \note spare buffers are used for lower level flash operations, - * 5 should be enough. - */ -#define MAX_SPARE_BUFFERS 5 - - -/** - * \def MAX_DIRTY_PAGES_IN_A_BLOCK - * \note this value should be between '2' and the lesser of - * 'max pages per block' and (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1). - * - * the smaller the value the frequently the buffer will be flushed. - */ -#define MAX_DIRTY_PAGES_IN_A_BLOCK 32 - -/** - * \def MAX_DIRTY_BUF_GROUPS - */ -#define MAX_DIRTY_BUF_GROUPS 3 - -/** - * \def CONFIG_ENABLE_UFFS_DEBUG_MSG - * \note Enable debug message output. You must call uffs_InitDebugMessageOutput() - * to initialize debug apart from enable debug feature. - */ -#define CONFIG_ENABLE_UFFS_DEBUG_MSG - -/** - * \def CONFIG_USE_GLOBAL_FS_LOCK - * \note use global lock instead of per-device lock. - * this is required if you use fd APIs in multi-thread environment. - */ -#define CONFIG_USE_GLOBAL_FS_LOCK - - -/** - * \def CONFIG_USE_PER_DEVICE_LOCK - * \note use per-device lock. - * this is required if you use fs APIs in multi-thread environment. - */ -//#define CONFIG_USE_PER_DEVICE_LOCK - - - -/** - * \def CONFIG_USE_STATIC_MEMORY_ALLOCATOR - * \note uffs will use static memory allocator if this is defined. - * to use static memory allocator, you need to provide memory - * buffer when creating uffs_Device. - * - * use UFFS_STATIC_BUFF_SIZE() to calculate memory buffer size. - */ -#define CONFIG_USE_STATIC_MEMORY_ALLOCATOR 0 - -/** - * \def CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR - * \note using system platform's 'malloc' and 'free'. - */ -#define CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR 1 - - - -/** - * \def CONFIG_FLUSH_BUF_AFTER_WRITE - * \note UFFS will write all data directly into flash in - * each 'write' call if you enable this option. - * (which means lesser data lost when power failure but - * poorer writing performance). - * It's not recommended to open this define for normal applications. - */ -#define CONFIG_FLUSH_BUF_AFTER_WRITE - - -/** - * \def CONFIG_UFFS_AUTO_LAYOUT_MTD_COMP - * \note Use Linux MTD compatiable spare placement for UFFS_LAYOUT_AUTO, - * only valid for page data size 512 or 2048. - */ -//#define CONFIG_UFFS_AUTO_LAYOUT_USE_MTD_SCHEME - - -/** - * \def MAX_OBJECT_HANDLE - * maximum number of object handle - */ -#define MAX_OBJECT_HANDLE 50 -#define FD_SIGNATURE_SHIFT 6 - - -/** - * \def MAX_DIR_HANDLE - * maximum number of uffs_DIR - */ -#define MAX_DIR_HANDLE 10 - -/** - * \def MINIMUN_ERASED_BLOCK - * UFFS will not allow appending or creating new files when the free/erased block - * is lower then MINIMUN_ERASED_BLOCK. - */ -#define MINIMUN_ERASED_BLOCK 2 - -/** - * \def CONFIG_CHANGE_MODIFY_TIME - * \note If defined, closing a file which is opened for writing/appending will - * update the file's modify time as well. Disable this feature will save a - * lot of writing activities if you frequently open files for write and close it. - */ -//#define CONFIG_CHANGE_MODIFY_TIME - - -/** - * \def CONFIG_ENABLE_BAD_BLOCK_VERIFY - * \note allow erase and verify block marked as 'bad' when format UFFS partition. - * it's not recommended for most NAND flash. - */ -#define CONFIG_ENABLE_BAD_BLOCK_VERIFY - -/** - * \def CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - * \note erase block again before mark bad block - */ -//#define CONFIG_ERASE_BLOCK_BEFORE_MARK_BAD - -/** - * \def CONFIG_PAGE_WRITE_VERIFY - * \note verify page data after write, for extra safe data storage. - */ -#define CONFIG_PAGE_WRITE_VERIFY - -/** - * \def CONFIG_BAD_BLOCK_POLICY_STRICT - * \note If this is enabled, UFFS will report the block as 'bad' if any bit-flips found; - * otherwise, UFFS report bad block only when ECC failed or reported - * by low level flash driver. - * - * \note Enable this will ensure your data always be stored on completely good blocks. - */ -#define CONFIG_BAD_BLOCK_POLICY_STRICT - - -/** - * \def CONFIG_ENABLE_PAGE_DATA_CRC - * \note If this is enabled, UFFS save page data CRC16 sum in mini header, - * it provides extra protection for data integrity. - */ -#define CONFIG_ENABLE_PAGE_DATA_CRC - - -/** micros for calculating buffer sizes */ - -/** - * \def UFFS_BLOCK_INFO_BUFFER_SIZE - * \brief calculate memory bytes for block info caches - */ -#define UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) \ - ( \ - ( \ - sizeof(uffs_BlockInfo) + \ - sizeof(uffs_PageSpare) * n_pages_per_block \ - ) * MAX_CACHED_BLOCK_INFO \ - ) - -/** - * \def UFFS_PAGE_BUFFER_SIZE - * \brief calculate memory bytes for page buffers - */ -#define UFFS_PAGE_BUFFER_SIZE(n_page_size) \ - ( \ - ( \ - sizeof(uffs_Buf) + n_page_size \ - ) * MAX_PAGE_BUFFERS \ - ) - -/** - * \def UFFS_TREE_BUFFER_SIZE - * \brief calculate memory bytes for tree nodes - */ -#define UFFS_TREE_BUFFER_SIZE(n_blocks) (sizeof(TreeNode) * n_blocks) - - -#define UFFS_SPARE_BUFFER_SIZE (MAX_SPARE_BUFFERS * UFFS_MAX_SPARE_SIZE) - - -/** - * \def UFFS_STATIC_BUFF_SIZE - * \brief calculate total memory usage of uffs system - */ -#define UFFS_STATIC_BUFF_SIZE(n_pages_per_block, n_page_size, n_blocks) \ - ( \ - UFFS_BLOCK_INFO_BUFFER_SIZE(n_pages_per_block) + \ - UFFS_PAGE_BUFFER_SIZE(n_page_size) + \ - UFFS_TREE_BUFFER_SIZE(n_blocks) + \ - UFFS_SPARE_BUFFER_SIZE \ - ) - - - -/* config check */ -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD) < 3 -#error "MAX_PAGE_BUFFERS is too small" -#endif - -#if (MAX_DIRTY_PAGES_IN_A_BLOCK < 2) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should >= 2" -#endif - -#if (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD - 1 < MAX_DIRTY_PAGES_IN_A_BLOCK) -#error "MAX_DIRTY_PAGES_IN_A_BLOCK should < (MAX_PAGE_BUFFERS - CLONE_BUFFERS_THRESHOLD)" -#endif - -#if defined(CONFIG_PAGE_WRITE_VERIFY) && (CLONE_BUFFERS_THRESHOLD < 2) -#error "CLONE_BUFFERS_THRESHOLD should >= 2 when CONFIG_PAGE_WRITE_VERIFY is enabled." -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 1 -#error "Please enable ONLY one memory allocator" -#endif - -#if CONFIG_USE_STATIC_MEMORY_ALLOCATOR + CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR == 0 -#error "Please enable ONE of memory allocators" -#endif - -#if defined(CONFIG_USE_GLOBAL_FS_LOCK) && defined(CONFIG_USE_PER_DEVICE_LOCK) -#error "enable either CONFIG_USE_GLOBAL_FS_LOCK or CONFIG_USE_PER_DEVICE_LOCK, not both" -#endif - -#if (MAX_OBJECT_HANDLE > (1 << FD_SIGNATURE_SHIFT)) -#error "Please increase FD_SIGNATURE_SHIFT !" -#endif - -#ifdef WIN32 -# pragma warning(disable : 4996) -# pragma warning(disable : 4244) -# pragma warning(disable : 4214) -# pragma warning(disable : 4127) -# pragma warning(disable : 4389) -# pragma warning(disable : 4100) -#endif - -#endif diff --git a/components/dfs/filesystems/uffs/uffs_nandif.c b/components/dfs/filesystems/uffs/uffs_nandif.c deleted file mode 100644 index 47cb88b6a..000000000 --- a/components/dfs/filesystems/uffs/uffs_nandif.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * RT-Thread Device Interface for uffs - */ - -#include -#include -#include "dfs_uffs.h" - -static int nand_init_flash(uffs_Device *dev) -{ - return UFFS_FLASH_NO_ERR; -} - -static int nand_release_flash(uffs_Device *dev) -{ - return UFFS_FLASH_NO_ERR; -} -static int nand_erase_block(uffs_Device *dev, unsigned block) -{ - int res; - - res = rt_mtd_nand_erase_block(RT_MTD_NAND_DEVICE(dev->_private), block); - - return res == RT_EOK ? UFFS_FLASH_NO_ERR : UFFS_FLASH_IO_ERR; -} - -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) -static int nand_check_block(uffs_Device *dev, unsigned block) -{ - int res; - - res = rt_mtd_nand_check_block(RT_MTD_NAND_DEVICE(dev->_private), block); - - return res == RT_EOK ? UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK; -} - -static int nand_mark_badblock(uffs_Device *dev, unsigned block) -{ - int res; - - res = rt_mtd_nand_mark_badblock(RT_MTD_NAND_DEVICE(dev->_private), block); - - return res == RT_EOK ? UFFS_FLASH_NO_ERR : UFFS_FLASH_IO_ERR; -} -#endif - -#if (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_NONE) || (RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_SOFT) -static int nand_read_page(uffs_Device *dev, - u32 block, - u32 page, - u8 *data, - int data_len, - u8 *ecc, - rt_uint8_t *spare, - int spare_len) -{ - int res; - - page = block * dev->attr->pages_per_block + page; - if (data == NULL && spare == NULL) - { -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - RT_ASSERT(0); //should not be here -#else - /* check block status: bad or good */ - rt_uint8_t spare[UFFS_MAX_SPARE_SIZE]; - - rt_memset(spare, 0, UFFS_MAX_SPARE_SIZE); - - rt_mtd_nand_read(RT_MTD_NAND_DEVICE(dev->_private), - page, RT_NULL, 0, - spare, dev->attr->spare_size);//dev->mem.spare_data_size - - res = spare[dev->attr->block_status_offs] == 0xFF ? - UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK; - - return res; -#endif - } - - rt_mtd_nand_read(RT_MTD_NAND_DEVICE(dev->_private), - page, data, data_len, spare, spare_len); - - return UFFS_FLASH_NO_ERR; -} - -static int nand_write_page(uffs_Device *dev, - u32 block, - u32 page, - const u8 *data, - int data_len, - const u8 *spare, - int spare_len) -{ - int res; - - RT_ASSERT(UFFS_MAX_SPARE_SIZE >= dev->attr->spare_size); - - page = block * dev->attr->pages_per_block + page; - - if (data == NULL && spare == NULL) - { -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - RT_ASSERT(0); //should not be here -#else - /* mark bad block */ - rt_uint8_t spare[UFFS_MAX_SPARE_SIZE]; - - rt_memset(spare, 0xFF, UFFS_MAX_SPARE_SIZE); - spare[dev->attr->block_status_offs] = 0x00; - - res = rt_mtd_nand_write(RT_MTD_NAND_DEVICE(dev->_private), - page, RT_NULL, 0, - spare, dev->attr->spare_size);//dev->mem.spare_data_size - if (res != RT_EOK) - goto __error; -#endif - } - - res = rt_mtd_nand_write(RT_MTD_NAND_DEVICE(dev->_private), - page, data, data_len, spare, spare_len); - if (res != RT_EOK) - goto __error; - - return UFFS_FLASH_NO_ERR; - -__error: - return UFFS_FLASH_IO_ERR; -} - -const uffs_FlashOps nand_ops = -{ - nand_init_flash, /* InitFlash() */ - nand_release_flash, /* ReleaseFlash() */ - nand_read_page, /* ReadPage() */ - NULL, /* ReadPageWithLayout */ - nand_write_page, /* WritePage() */ - NULL, /* WirtePageWithLayout */ -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - nand_check_block, - nand_mark_badblock, -#else - NULL, /* IsBadBlock(), let UFFS take care of it. */ - NULL, /* MarkBadBlock(), let UFFS take care of it. */ -#endif - nand_erase_block, /* EraseBlock() */ -}; - -void uffs_setup_storage(struct uffs_StorageAttrSt *attr, - struct rt_mtd_nand_device *nand) -{ - rt_memset(attr, 0, sizeof(struct uffs_StorageAttrSt)); - -// attr->total_blocks = nand->end_block - nand->start_block + 1;/* no use */ - attr->page_data_size = nand->page_size; /* page data size */ - attr->pages_per_block = nand->pages_per_block; /* pages per block */ - attr->spare_size = nand->oob_size; /* page spare size */ - attr->ecc_opt = RT_CONFIG_UFFS_ECC_MODE; /* ecc option */ - attr->ecc_size = 0; /* ecc size is 0 , the uffs will calculate the ecc size*/ - attr->block_status_offs = attr->ecc_size; /* indicate block bad or good, offset in spare */ - attr->layout_opt = RT_CONFIG_UFFS_LAYOUT; /* let UFFS do the spare layout */ -} - -#elif RT_CONFIG_UFFS_ECC_MODE == UFFS_ECC_HW_AUTO -static int WritePageWithLayout(uffs_Device *dev, - u32 block, - u32 page, - const u8 *data, - int data_len, - const u8 *ecc, //NULL - const uffs_TagStore *ts) -{ - int res; - int spare_len; - rt_uint8_t spare[UFFS_MAX_SPARE_SIZE]; - - RT_ASSERT(UFFS_MAX_SPARE_SIZE >= dev->attr->spare_size); - - page = block * dev->attr->pages_per_block + page; - spare_len = dev->mem.spare_data_size; - - if (data == NULL && ts == NULL) - { -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - RT_ASSERT(0); //should not be here -#else - /* mark bad block */ - rt_memset(spare, 0xFF, UFFS_MAX_SPARE_SIZE); - spare[dev->attr->block_status_offs] = 0x00; - - res = rt_mtd_nand_write(RT_MTD_NAND_DEVICE(dev->_private), - page, RT_NULL, 0, - spare, dev->attr->spare_size);//dev->mem.spare_data_size - if (res != RT_EOK) - goto __error; - - dev->st.io_write++; - return UFFS_FLASH_NO_ERR; -#endif - } - - if (data != NULL && data_len != 0) - { - RT_ASSERT(data_len == dev->attr->page_data_size); - - dev->st.page_write_count++; - dev->st.io_write += data_len; - } - - if (ts != RT_NULL) - { - uffs_FlashMakeSpare(dev, ts, RT_NULL, (u8 *)spare); - dev->st.spare_write_count++; - dev->st.io_write += spare_len; - } - - res = rt_mtd_nand_write(RT_MTD_NAND_DEVICE(dev->_private), - page, data, data_len, spare, spare_len); - if (res != RT_EOK) - goto __error; - - return UFFS_FLASH_NO_ERR; - -__error: - return UFFS_FLASH_IO_ERR; -} - -static URET ReadPageWithLayout(uffs_Device *dev, - u32 block, - u32 page, - u8 *data, - int data_len, - u8 *ecc, //NULL - uffs_TagStore *ts, - u8 *ecc_store) //NULL -{ - int res = UFFS_FLASH_NO_ERR; - int spare_len; - rt_uint8_t spare[UFFS_MAX_SPARE_SIZE]; - - RT_ASSERT(UFFS_MAX_SPARE_SIZE >= dev->attr->spare_size); - - page = block * dev->attr->pages_per_block + page; - spare_len = dev->mem.spare_data_size; - - if (data == RT_NULL && ts == RT_NULL) - { -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - RT_ASSERT(0); //should not be here -#else - /* check block good or bad */ - - rt_mtd_nand_read(RT_MTD_NAND_DEVICE(dev->_private), - page, RT_NULL, 0, - spare, dev->attr->spare_size);//dev->mem.spare_data_size - - dev->st.io_read++; - - res = spare[dev->attr->block_status_offs] == 0xFF ? - UFFS_FLASH_NO_ERR : UFFS_FLASH_BAD_BLK; - return res; -#endif - } - - if (data != RT_NULL) - { - dev->st.io_read += data_len; - dev->st.page_read_count++; - } - - res = rt_mtd_nand_read(RT_MTD_NAND_DEVICE(dev->_private), - page, data, data_len, spare, spare_len); - if (res == 0) - res = UFFS_FLASH_NO_ERR; - else if (res == -1) - { - //TODO ecc correct, add code to use hardware do ecc correct - res = UFFS_FLASH_ECC_OK; - } - else - res = UFFS_FLASH_ECC_FAIL; - - if (ts != RT_NULL) - { - // unload ts and ecc from spare, you can modify it if you like - uffs_FlashUnloadSpare(dev, (const u8 *)spare, ts, RT_NULL); - - if ((spare[spare_len - 1] == 0xFF) && (res == UFFS_FLASH_NO_ERR)) - res = UFFS_FLASH_NOT_SEALED; - - dev->st.io_read += spare_len; - dev->st.spare_read_count++; - } - - return res; -} - -const uffs_FlashOps nand_ops = -{ - nand_init_flash, /* InitFlash() */ - nand_release_flash, /* ReleaseFlash() */ - NULL, /* ReadPage() */ - ReadPageWithLayout, /* ReadPageWithLayout */ - NULL, /* WritePage() */ - WritePageWithLayout,/* WirtePageWithLayout */ - -#if defined(RT_UFFS_USE_CHECK_MARK_FUNCITON) - nand_check_block, - nand_mark_badblock, -#else - NULL, /* IsBadBlock(), let UFFS take care of it. */ - NULL, /* MarkBadBlock(), let UFFS take care of it. */ -#endif - nand_erase_block, /* EraseBlock() */ -}; - -static rt_uint8_t hw_flash_data_layout[UFFS_SPARE_LAYOUT_SIZE] = -{ - 0x05, 0x08, 0xFF, 0x00 -}; - -static rt_uint8_t hw_flash_ecc_layout[UFFS_SPARE_LAYOUT_SIZE] = -{ - 0x00, 0x04, 0xFF, 0x00 -}; - -void uffs_setup_storage(struct uffs_StorageAttrSt *attr, - struct rt_mtd_nand_device *nand) -{ - rt_memset(attr, 0, sizeof(struct uffs_StorageAttrSt)); - -// attr->total_blocks = nand->end_block - nand->start_block + 1;/* no use */ - attr->page_data_size = nand->page_size; /* page data size */ - attr->pages_per_block = nand->pages_per_block; /* pages per block */ - attr->spare_size = nand->oob_size; /* page spare size */ - attr->ecc_opt = RT_CONFIG_UFFS_ECC_MODE; /* ecc option */ - attr->ecc_size = nand->oob_size-nand->oob_free; /* ecc size */ - attr->block_status_offs = attr->ecc_size; /* indicate block bad or good, offset in spare */ - attr->layout_opt = RT_CONFIG_UFFS_LAYOUT; /* let UFFS do the spare layout */ - - /* calculate the ecc layout array */ - hw_flash_data_layout[0] = attr->ecc_size + 1; /* ecc size + 1byte block status */ - hw_flash_data_layout[1] = 0x08; - hw_flash_data_layout[2] = 0xFF; - hw_flash_data_layout[3] = 0x00; - - hw_flash_ecc_layout[0] = 0; - hw_flash_ecc_layout[1] = attr->ecc_size; - hw_flash_ecc_layout[2] = 0xFF; - hw_flash_ecc_layout[3] = 0x00; - - /* initialize _uffs_data_layout and _uffs_ecc_layout */ - rt_memcpy(attr->_uffs_data_layout, hw_flash_data_layout, UFFS_SPARE_LAYOUT_SIZE); - rt_memcpy(attr->_uffs_ecc_layout, hw_flash_ecc_layout, UFFS_SPARE_LAYOUT_SIZE); - - attr->data_layout = attr->_uffs_data_layout; - attr->ecc_layout = attr->_uffs_ecc_layout; -} -#endif diff --git a/components/dfs/filesystems/uffs/uffs_rtthread.c b/components/dfs/filesystems/uffs/uffs_rtthread.c deleted file mode 100644 index bad456f04..000000000 --- a/components/dfs/filesystems/uffs/uffs_rtthread.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file uffs_os_posix.c - * \brief Emulation on POSIX host. This is just a dumb implementation, does not really create semaphores. - * \author Ricky Zheng - */ - -#include "uffs_config.h" -#include "uffs/uffs_os.h" -#include "uffs/uffs_public.h" -//#include - -#define PFX "os : " - -int uffs_SemCreate(OSSEM *sem) -{ - static int count = 0; - char name [RT_NAME_MAX+1]; - struct rt_mutex *mutex = RT_NULL; - - rt_snprintf(name, sizeof(name), "usem%d", count++); - mutex = rt_mutex_create(name, RT_IPC_FLAG_FIFO); - if (mutex != RT_NULL) - { - *sem = (OSSEM *)mutex; - return 0; - } - uffs_Perror(UFFS_MSG_SERIOUS, "can't get a semphore"); - return -1; -} - -int uffs_SemWait(OSSEM sem) -{ - return rt_mutex_take((struct rt_mutex *)sem, RT_WAITING_FOREVER); -} - -int uffs_SemSignal(OSSEM sem) -{ - return rt_mutex_release((struct rt_mutex *)sem); -} - -int uffs_SemDelete(OSSEM *sem) -{ - int ret = -1; - - if (sem) { - ret = rt_mutex_delete((struct rt_mutex *)(*sem)); - if (ret == RT_EOK) { - *sem = 0; - } - } - return ret; -} - -int uffs_OSGetTaskId(void) -{ - //TODO: ... return current task ID ... - return 0; -} - -unsigned int uffs_GetCurDateTime(void) -{ - // FIXME: return system time, please modify this for your platform ! - // or just return 0 if you don't care about file time. -#if 0 - time_t tvalue; - - tvalue = time(NULL); - - return (unsigned int)tvalue; -#endif - return 0; -} - -#if CONFIG_USE_SYSTEM_MEMORY_ALLOCATOR > 0 -static void * sys_malloc(struct uffs_DeviceSt *dev, unsigned int size) -{ - dev = dev; - uffs_Perror(UFFS_MSG_NORMAL, "system memory alloc %d bytes", size); - return rt_malloc(size); -} - -static URET sys_free(struct uffs_DeviceSt *dev, void *p) -{ - dev = dev; - rt_free(p); - return U_SUCC; -} - -void uffs_MemSetupSystemAllocator(uffs_MemAllocator *allocator) -{ - allocator->malloc = sys_malloc; - allocator->free = sys_free; -} -#endif - -#if !defined(RT_THREAD) -/* debug message output throught 'printf' */ -static void output_dbg_msg(const char *msg); -static struct uffs_DebugMsgOutputSt m_dbg_ops = { - output_dbg_msg, - NULL, -}; - -static void output_dbg_msg(const char *msg) -{ - rt_kprintf("%s", msg); -} - -void uffs_SetupDebugOutput(void) -{ - uffs_InitDebugMessageOutput(&m_dbg_ops, UFFS_MSG_NOISY); -} -#else - -void uffs_SetupDebugOutput(void) -{ -} -#endif diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index eb32a4b41..80dc43378 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -55,6 +55,7 @@ #define FT_SOCKET 1 /* socket file */ #define FT_DIRECTORY 2 /* directory */ #define FT_USER 3 /* user defined */ +#define FT_DEVICE 4 /* device */ /* File flags */ #define DFS_F_OPEN 0x01000000 diff --git a/components/dfs/include/dfs_file.h b/components/dfs/include/dfs_file.h index 2dfacd653..df1013d69 100644 --- a/components/dfs/include/dfs_file.h +++ b/components/dfs/include/dfs_file.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/include/dfs_fs.h b/components/dfs/include/dfs_fs.h index 58a9e5cf5..cbf2e9552 100644 --- a/components/dfs/include/dfs_fs.h +++ b/components/dfs/include/dfs_fs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/include/dfs_poll.h b/components/dfs/include/dfs_poll.h index d9597a436..096a5fe71 100644 --- a/components/dfs/include/dfs_poll.h +++ b/components/dfs/include/dfs_poll.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index 87d5f0771..0475460d9 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/include/dfs_private.h b/components/dfs/include/dfs_private.h index fccd260ac..e602c2173 100644 --- a/components/dfs/include/dfs_private.h +++ b/components/dfs/include/dfs_private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/include/dfs_select.h b/components/dfs/include/dfs_select.h index 3ac581787..458691df2 100644 --- a/components/dfs/include/dfs_select.h +++ b/components/dfs/include/dfs_select.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/src/dfs.c b/components/dfs/src/dfs.c index b20de1398..8155b088f 100644 --- a/components/dfs/src/dfs.c +++ b/components/dfs/src/dfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -542,6 +542,7 @@ int list_fd(void) else if (fd->type == FT_REGULAR) rt_kprintf("%-7.7s ", "file"); else if (fd->type == FT_SOCKET) rt_kprintf("%-7.7s ", "socket"); else if (fd->type == FT_USER) rt_kprintf("%-7.7s ", "user"); + else if (fd->type == FT_DEVICE) rt_kprintf("%-7.7s ", "device"); else rt_kprintf("%-8.8s ", "unknown"); rt_kprintf("%3d ", fd->ref_count); rt_kprintf("%04x ", fd->magic); diff --git a/components/dfs/src/dfs_file.c b/components/dfs/src/dfs_file.c index 91d39597f..aa6494457 100644 --- a/components/dfs/src/dfs_file.c +++ b/components/dfs/src/dfs_file.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -157,7 +157,7 @@ int dfs_file_ioctl(struct dfs_fd *fd, int cmd, void *args) return -EINVAL; /* regular file system fd */ - if (fd->type == FT_REGULAR) + if (fd->type == FT_REGULAR || fd->type == FT_DEVICE) { switch (cmd) { diff --git a/components/dfs/src/dfs_fs.c b/components/dfs/src/dfs_fs.c index 164beed71..611f03581 100644 --- a/components/dfs/src/dfs_fs.c +++ b/components/dfs/src/dfs_fs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -129,7 +129,7 @@ const char *dfs_filesystem_get_mounted_path(struct rt_device *device) for (iter = &filesystem_table[0]; iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++) { - /* fint the mounted device */ + /* find the mounted device */ if (iter->ops == NULL) continue; else if (iter->dev_id == device) { @@ -321,7 +321,7 @@ int dfs_mount(const char *device_name, if (rt_device_open(fs->dev_id, RT_DEVICE_OFLAG_RDWR) != RT_EOK) { - /* The underlaying device has error, clear the entry. */ + /* The underlying device has error, clear the entry. */ dfs_lock(); memset(fs, 0, sizeof(struct dfs_filesystem)); @@ -522,16 +522,16 @@ INIT_ENV_EXPORT(dfs_mount_table); int dfs_mount_device(rt_device_t dev) { int index = 0; - + if(dev == RT_NULL) { rt_kprintf("the device is NULL to be mounted.\n"); return -RT_ERROR; } - + while (1) { if (mount_table[index].path == NULL) break; - + if(strcmp(mount_table[index].device_name, dev->parent.name) == 0) { if (dfs_mount(mount_table[index].device_name, mount_table[index].path, @@ -548,10 +548,10 @@ int dfs_mount_device(rt_device_t dev) return RT_EOK; } } - + index ++; } - + rt_kprintf("can't find device:%s to be mounted.\n", dev->parent.name); return -RT_ERROR; } diff --git a/components/dfs/src/dfs_posix.c b/components/dfs/src/dfs_posix.c index fc603df43..a7c306366 100644 --- a/components/dfs/src/dfs_posix.c +++ b/components/dfs/src/dfs_posix.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c index 3f304549f..d1e037249 100644 --- a/components/dfs/src/poll.c +++ b/components/dfs/src/poll.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -137,6 +137,14 @@ static int do_pollfd(struct pollfd *pollfd, rt_pollreq_t *req) req->_key = pollfd->events | POLLERR | POLLHUP; mask = f->fops->poll(f, req); + + /* dealwith the device return error -1*/ + if (mask < 0) + { + fd_put(f); + pollfd->revents = 0; + return mask; + } } /* Mask out unneeded events. */ mask &= pollfd->events | POLLERR | POLLHUP; @@ -154,6 +162,7 @@ static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, in int istimeout = 0; int n; struct pollfd *pf; + int ret = 0; if (msec == 0) { @@ -168,7 +177,14 @@ static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, in for (n = 0; n < nfds; n ++) { - if (do_pollfd(pf, &pt->req)) + ret = do_pollfd(pf, &pt->req); + if(ret < 0) + { + /*dealwith the device return error -1 */ + pt->req._proc = RT_NULL; + return ret; + } + else if(ret > 0) { num ++; pt->req._proc = RT_NULL; @@ -216,4 +232,4 @@ int poll(struct pollfd *fds, nfds_t nfds, int timeout) return num; } -#endif +#endif diff --git a/components/dfs/src/select.c b/components/dfs/src/select.c index 181855bc7..c9286ca97 100644 --- a/components/dfs/src/select.c +++ b/components/dfs/src/select.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -180,4 +180,4 @@ int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struc return ret; } -#endif +#endif diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index c567233c8..a966c7a41 100644 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -89,18 +89,18 @@ config RT_USING_I2C if RT_USING_I2C config RT_I2C_DEBUG - bool "Use I2C debug mesage" + bool "Use I2C debug message" default n config RT_USING_I2C_BITOPS bool "Use GPIO to simulate I2C" default y -endif -if RT_USING_I2C_BITOPS - config RT_I2C_BITOPS_DEBUG - bool "Use simulate I2C debug mesage" - default n + if RT_USING_I2C_BITOPS + config RT_I2C_BITOPS_DEBUG + bool "Use simulate I2C debug message" + default n + endif endif config RT_USING_PIN @@ -257,11 +257,11 @@ config RT_USING_AUDIO if RT_USING_AUDIO config RT_AUDIO_REPLAY_MP_BLOCK_SIZE - int "Replay memmory pool block size" + int "Replay memory pool block size" default 4096 config RT_AUDIO_REPLAY_MP_BLOCK_COUNT - int "Replay memmory pool block count" + int "Replay memory pool block count" default 2 config RT_AUDIO_RECORD_PIPE_SIZE @@ -283,6 +283,11 @@ endif config RT_USING_TOUCH bool "Using Touch device drivers" default n + if RT_USING_TOUCH + config RT_TOUCH_PIN_IRQ + bool "touch irq use pin irq" + default n + endif menuconfig RT_USING_HWCRYPTO bool "Using Hardware Crypto drivers" diff --git a/components/drivers/audio/audio.c b/components/drivers/audio/audio.c index 28ddf0fe5..f9d42aeb5 100644 --- a/components/drivers/audio/audio.c +++ b/components/drivers/audio/audio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,14 +12,15 @@ #include #include #include -#include #include #define DBG_TAG "audio" #define DBG_LVL DBG_INFO #include +#ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif enum { @@ -33,7 +34,7 @@ static rt_err_t _audio_send_replay_frame(struct rt_audio_device *audio) rt_err_t result = RT_EOK; rt_uint8_t *data; rt_size_t dst_size, src_size; - rt_uint16_t position, remain_bytes, index = 0; + rt_uint16_t position, remain_bytes = 0, index = 0; struct rt_audio_buf_info *buf_info; RT_ASSERT(audio != RT_NULL); @@ -43,8 +44,8 @@ static rt_err_t _audio_send_replay_frame(struct rt_audio_device *audio) position = audio->replay->pos; dst_size = buf_info->block_size; - /* check repaly queue is empty */ - if (rt_data_queue_peak(&audio->replay->queue, (const void **)&data, &src_size) != RT_EOK) + /* check replay queue is empty */ + if (rt_data_queue_peek(&audio->replay->queue, (const void **)&data, &src_size) != RT_EOK) { /* ack stop event */ if (audio->replay->event & REPLAY_EVT_STOP) @@ -63,7 +64,7 @@ static rt_err_t _audio_send_replay_frame(struct rt_audio_device *audio) /* copy data from memory pool to hardware device fifo */ while (index < dst_size) { - result = rt_data_queue_peak(&audio->replay->queue, (const void **)&data, &src_size); + result = rt_data_queue_peek(&audio->replay->queue, (const void **)&data, &src_size); if (result != RT_EOK) { LOG_D("under run %d, remain %d", audio->replay->pos, remain_bytes); @@ -235,7 +236,7 @@ static rt_err_t _audio_dev_init(struct rt_device *dev) if (replay->mp == RT_NULL) { rt_free(replay); - LOG_E("create memory pool for repaly failed"); + LOG_E("create memory pool for replay failed"); return -RT_ENOMEM; } @@ -588,7 +589,6 @@ int rt_audio_samplerate_to_speed(rt_uint32_t bitValue) speed = 192000; break; default: - break; } diff --git a/components/drivers/audio/audio_pipe.c b/components/drivers/audio/audio_pipe.c index d7c37009b..4dd113861 100644 --- a/components/drivers/audio/audio_pipe.c +++ b/components/drivers/audio/audio_pipe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,9 +9,7 @@ */ #include -#include #include - #include "audio_pipe.h" static void _rt_pipe_resume_writer(struct rt_audio_pipe *pipe) diff --git a/components/drivers/audio/audio_pipe.h b/components/drivers/audio/audio_pipe.h index 85a3eb179..6c4719d56 100644 --- a/components/drivers/audio/audio_pipe.h +++ b/components/drivers/audio/audio_pipe.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,7 +12,6 @@ /** * Pipe Device */ -#include #include #ifndef RT_PIPE_BUFSZ @@ -71,6 +70,6 @@ rt_err_t rt_audio_pipe_detach(struct rt_audio_pipe *pipe); #ifdef RT_USING_HEAP rt_err_t rt_audio_pipe_create(const char *name, rt_int32_t flag, rt_size_t size); void rt_audio_pipe_destroy(struct rt_audio_pipe *pipe); -#endif -#endif +#endif /* RT_USING_HEAP */ +#endif /* __AUDIO_PIPE_H__ */ diff --git a/components/drivers/can/can.c b/components/drivers/can/can.c index 3d60dbaa5..55444c3a0 100644 --- a/components/drivers/can/can.c +++ b/components/drivers/can/can.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -422,6 +422,7 @@ static rt_err_t rt_can_close(struct rt_device *dev) tx_fifo = (struct rt_can_tx_fifo *)can->can_tx; RT_ASSERT(tx_fifo != RT_NULL); + rt_sem_detach(&(tx_fifo->sem)); rt_free(tx_fifo); dev->open_flag &= ~RT_DEVICE_FLAG_INT_TX; can->can_tx = RT_NULL; diff --git a/components/drivers/cputime/cputime.c b/components/drivers/cputime/cputime.c index 3ec860d5c..4a9eee3a7 100644 --- a/components/drivers/cputime/cputime.c +++ b/components/drivers/cputime/cputime.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,7 +14,7 @@ static const struct rt_clock_cputime_ops *_cputime_ops = RT_NULL; /** - * The clock_cpu_getres() function shall return the resolution of CPU time, the + * The clock_cpu_getres() function shall return the resolution of CPU time, the * number of nanosecond per tick. * * @return the number of nanosecond per tick @@ -43,7 +43,7 @@ uint32_t clock_cpu_gettime(void) } /** - * The clock_cpu_microsecond() fucntion shall return the microsecond according to + * The clock_cpu_microsecond() fucntion shall return the microsecond according to * cpu_tick parameter. * * @param cpu_tick the cpu tick @@ -58,7 +58,7 @@ uint32_t clock_cpu_microsecond(uint32_t cpu_tick) } /** - * The clock_cpu_microsecond() fucntion shall return the millisecond according to + * The clock_cpu_microsecond() fucntion shall return the millisecond according to * cpu_tick parameter. * * @param cpu_tick the cpu tick @@ -74,7 +74,7 @@ uint32_t clock_cpu_millisecond(uint32_t cpu_tick) /** * The clock_cpu_seops() function shall set the ops of cpu time. - * + * * @return always return 0. */ int clock_cpu_setops(const struct rt_clock_cputime_ops *ops) diff --git a/components/drivers/cputime/cputime_cortexm.c b/components/drivers/cputime/cputime_cortexm.c index 05ed6ed44..071acfe9b 100644 --- a/components/drivers/cputime/cputime_cortexm.c +++ b/components/drivers/cputime/cputime_cortexm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,7 +19,7 @@ static float cortexm_cputime_getres(void) { float ret = 1000 * 1000 * 1000; - + ret = ret / SystemCoreClock; return ret; } @@ -29,7 +29,7 @@ static uint32_t cortexm_cputime_gettime(void) return DWT->CYCCNT; } -const static struct rt_clock_cputime_ops _cortexm_ops = +const static struct rt_clock_cputime_ops _cortexm_ops = { cortexm_cputime_getres, cortexm_cputime_gettime @@ -38,13 +38,13 @@ const static struct rt_clock_cputime_ops _cortexm_ops = int cortexm_cputime_init(void) { /* check support bit */ - if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0) + if ((DWT->CTRL & (1UL << DWT_CTRL_NOCYCCNT_Pos)) == 0) { /* enable trace*/ CoreDebug->DEMCR |= (1UL << CoreDebug_DEMCR_TRCENA_Pos); - + /* whether cycle counter not enabled */ - if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0) + if ((DWT->CTRL & (1UL << DWT_CTRL_CYCCNTENA_Pos)) == 0) { /* enable cycle counter */ DWT->CTRL |= (1UL << DWT_CTRL_CYCCNTENA_Pos); diff --git a/components/drivers/hwcrypto/hw_bignum.c b/components/drivers/hwcrypto/hw_bignum.c index 88813566b..0488a16f0 100644 --- a/components/drivers/hwcrypto/hw_bignum.c +++ b/components/drivers/hwcrypto/hw_bignum.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -56,7 +56,7 @@ rt_err_t rt_hwcrypto_bignum_default(struct rt_hwcrypto_device *device) /** * @brief Init bignum obj - * + * * @param n bignum obj */ void rt_hwcrypto_bignum_init(struct hw_bignum_mpi *n) @@ -87,9 +87,9 @@ void rt_hwcrypto_bignum_free(struct hw_bignum_mpi *n) /** * @brief Get length of bignum as an unsigned binary buffer - * + * * @param n bignum obj - * + * * @return binary buffer length */ int rt_hwcrypto_bignum_get_len(const struct hw_bignum_mpi *n) @@ -112,11 +112,11 @@ int rt_hwcrypto_bignum_get_len(const struct hw_bignum_mpi *n) /** * @brief Export n into unsigned binary data, big endian - * + * * @param n bignum obj * @param buf Buffer for the binary number * @param len Length of the buffer - * + * * @return export bin length */ int rt_hwcrypto_bignum_export_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) @@ -139,11 +139,11 @@ int rt_hwcrypto_bignum_export_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int /** * @brief Import n from unsigned binary data, big endian - * + * * @param n bignum obj * @param buf Buffer for the binary number * @param len Length of the buffer - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len) @@ -179,11 +179,11 @@ rt_err_t rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, /** * @brief x = a + b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_add(struct hw_bignum_mpi *x, @@ -206,11 +206,11 @@ rt_err_t rt_hwcrypto_bignum_add(struct hw_bignum_mpi *x, /** * @brief x = a - b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_sub(struct hw_bignum_mpi *x, @@ -233,11 +233,11 @@ rt_err_t rt_hwcrypto_bignum_sub(struct hw_bignum_mpi *x, /** * @brief x = a * b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_mul(struct hw_bignum_mpi *x, @@ -260,11 +260,11 @@ rt_err_t rt_hwcrypto_bignum_mul(struct hw_bignum_mpi *x, /** * @brief x = a * b (mod c) - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_mulmod(struct hw_bignum_mpi *x, @@ -288,11 +288,11 @@ rt_err_t rt_hwcrypto_bignum_mulmod(struct hw_bignum_mpi *x, /** * @brief x = a ^ b (mod c) - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_exptmod(struct hw_bignum_mpi *x, diff --git a/components/drivers/hwcrypto/hw_bignum.h b/components/drivers/hwcrypto/hw_bignum.h index a1f567e68..442b28f55 100644 --- a/components/drivers/hwcrypto/hw_bignum.h +++ b/components/drivers/hwcrypto/hw_bignum.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -83,42 +83,42 @@ void rt_hwcrypto_bignum_free(struct hw_bignum_mpi *n); /** * @brief Get length of bignum as an unsigned binary buffer - * + * * @param n bignum obj - * + * * @return binary buffer Length */ int rt_hwcrypto_bignum_get_len(const struct hw_bignum_mpi *n); /** * @brief Export n into unsigned binary data, big endian - * + * * @param n bignum obj * @param buf Buffer for the binary number * @param len Length of the buffer - * + * * @return export bin length */ int rt_hwcrypto_bignum_export_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len); /** * @brief Import n from unsigned binary data, big endian - * + * * @param n bignum obj * @param buf Buffer for the binary number * @param len Length of the buffer - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_import_bin(struct hw_bignum_mpi *n, rt_uint8_t *buf, int len); /** * @brief x = a + b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_add(struct hw_bignum_mpi *x, @@ -127,11 +127,11 @@ rt_err_t rt_hwcrypto_bignum_add(struct hw_bignum_mpi *x, /** * @brief x = a - b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_sub(struct hw_bignum_mpi *x, @@ -140,11 +140,11 @@ rt_err_t rt_hwcrypto_bignum_sub(struct hw_bignum_mpi *x, /** * @brief x = a * b - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_mul(struct hw_bignum_mpi *x, @@ -153,11 +153,11 @@ rt_err_t rt_hwcrypto_bignum_mul(struct hw_bignum_mpi *x, /** * @brief x = a * b (mod c) - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_mulmod(struct hw_bignum_mpi *x, @@ -167,11 +167,11 @@ rt_err_t rt_hwcrypto_bignum_mulmod(struct hw_bignum_mpi *x, /** * @brief x = a ^ b (mod c) - * + * * @param a bignum obj * @param b bignum obj * @param c bignum obj - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_bignum_exptmod(struct hw_bignum_mpi *x, diff --git a/components/drivers/hwcrypto/hw_crc.c b/components/drivers/hwcrypto/hw_crc.c index 20579711e..a1d95793e 100644 --- a/components/drivers/hwcrypto/hw_crc.c +++ b/components/drivers/hwcrypto/hw_crc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,7 +20,7 @@ * * @return CRC context */ -struct rt_hwcrypto_ctx *rt_hwcrypto_crc_create(struct rt_hwcrypto_device *device, +struct rt_hwcrypto_ctx *rt_hwcrypto_crc_create(struct rt_hwcrypto_device *device, hwcrypto_crc_mode mode) { struct hwcrypto_crc *crc_ctx; @@ -89,8 +89,8 @@ void rt_hwcrypto_crc_destroy(struct rt_hwcrypto_ctx *ctx) * * @return RT_EOK on success. */ -rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, - const rt_uint8_t *input, +rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, + const rt_uint8_t *input, rt_size_t length) { struct hwcrypto_crc *crc_ctx = (struct hwcrypto_crc *)ctx; @@ -107,7 +107,7 @@ rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, * @param ctx CRC context * @param cfg CRC config */ -void rt_hwcrypto_crc_cfg(struct rt_hwcrypto_ctx *ctx, +void rt_hwcrypto_crc_cfg(struct rt_hwcrypto_ctx *ctx, struct hwcrypto_crc_cfg *cfg) { if (cfg) diff --git a/components/drivers/hwcrypto/hw_crc.h b/components/drivers/hwcrypto/hw_crc.h index a6df92a2e..8e0fcefcc 100644 --- a/components/drivers/hwcrypto/hw_crc.h +++ b/components/drivers/hwcrypto/hw_crc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -129,7 +129,7 @@ void rt_hwcrypto_crc_destroy(struct rt_hwcrypto_ctx *ctx); * * @return CRC value */ -rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, +rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, const rt_uint8_t *input, rt_size_t length); /** @@ -138,7 +138,7 @@ rt_uint32_t rt_hwcrypto_crc_update(struct rt_hwcrypto_ctx *ctx, * @param ctx CRC context * @param cfg CRC config */ -void rt_hwcrypto_crc_cfg(struct rt_hwcrypto_ctx *ctx, +void rt_hwcrypto_crc_cfg(struct rt_hwcrypto_ctx *ctx, struct hwcrypto_crc_cfg *cfg); #ifdef __cplusplus diff --git a/components/drivers/hwcrypto/hw_gcm.c b/components/drivers/hwcrypto/hw_gcm.c index 8d0f49149..a8106694f 100644 --- a/components/drivers/hwcrypto/hw_gcm.c +++ b/components/drivers/hwcrypto/hw_gcm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hw_gcm.h b/components/drivers/hwcrypto/hw_gcm.h index a73b2b063..3a2f87bc3 100644 --- a/components/drivers/hwcrypto/hw_gcm.h +++ b/components/drivers/hwcrypto/hw_gcm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hw_hash.c b/components/drivers/hwcrypto/hw_hash.c index b20069ac0..cf5ec8d70 100644 --- a/components/drivers/hwcrypto/hw_hash.c +++ b/components/drivers/hwcrypto/hw_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hw_hash.h b/components/drivers/hwcrypto/hw_hash.h index de0310e84..41abd06c4 100644 --- a/components/drivers/hwcrypto/hw_hash.h +++ b/components/drivers/hwcrypto/hw_hash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hw_rng.c b/components/drivers/hwcrypto/hw_rng.c index 13a17cc6b..b6f62db34 100644 --- a/components/drivers/hwcrypto/hw_rng.c +++ b/components/drivers/hwcrypto/hw_rng.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -81,7 +81,7 @@ rt_err_t rt_hwcrypto_rng_default(struct rt_hwcrypto_device *device) * @brief Getting Random Numbers from RNG Context * * @param ctx RNG context - * + * * @return Random number */ rt_uint32_t rt_hwcrypto_rng_update_ctx(struct rt_hwcrypto_ctx *ctx) diff --git a/components/drivers/hwcrypto/hw_rng.h b/components/drivers/hwcrypto/hw_rng.h index fc28afdb1..3c014f6be 100644 --- a/components/drivers/hwcrypto/hw_rng.h +++ b/components/drivers/hwcrypto/hw_rng.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -60,7 +60,7 @@ rt_err_t rt_hwcrypto_rng_default(struct rt_hwcrypto_device *device); * @brief Getting Random Numbers from RNG Context * * @param ctx RNG context - * + * * @return Random number */ rt_uint32_t rt_hwcrypto_rng_update_ctx(struct rt_hwcrypto_ctx *ctx); diff --git a/components/drivers/hwcrypto/hw_symmetric.c b/components/drivers/hwcrypto/hw_symmetric.c index 789c5c1a2..9398298fe 100644 --- a/components/drivers/hwcrypto/hw_symmetric.c +++ b/components/drivers/hwcrypto/hw_symmetric.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -215,7 +215,7 @@ void rt_hwcrypto_symmetric_get_ivoff(struct rt_hwcrypto_ctx *ctx, rt_int32_t *iv * * @param des The destination symmetric crypto context * @param src The symmetric crypto context to be copy - * + * * @return RT_EOK on success. */ rt_err_t rt_hwcrypto_symmetric_cpy(struct rt_hwcrypto_ctx *des, const struct rt_hwcrypto_ctx *src) diff --git a/components/drivers/hwcrypto/hw_symmetric.h b/components/drivers/hwcrypto/hw_symmetric.h index 12f4dbec3..f3f78fb21 100644 --- a/components/drivers/hwcrypto/hw_symmetric.h +++ b/components/drivers/hwcrypto/hw_symmetric.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hwcrypto.c b/components/drivers/hwcrypto/hwcrypto.c index bbe1ff63f..473b52fb9 100644 --- a/components/drivers/hwcrypto/hwcrypto.c +++ b/components/drivers/hwcrypto/hwcrypto.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwcrypto/hwcrypto.h b/components/drivers/hwcrypto/hwcrypto.h index a428f4437..cdf057c49 100644 --- a/components/drivers/hwcrypto/hwcrypto.h +++ b/components/drivers/hwcrypto/hwcrypto.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c index 83a76c7b9..49a57be9a 100644 --- a/components/drivers/hwtimer/hwtimer.c +++ b/components/drivers/hwtimer/hwtimer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -10,6 +10,7 @@ #include #include +#include rt_inline rt_uint32_t timeout_calc(rt_hwtimer_t *timer, rt_hwtimerval_t *tv) { @@ -144,19 +145,25 @@ static rt_size_t rt_hwtimer_read(struct rt_device *dev, rt_off_t pos, void *buff rt_hwtimer_t *timer; rt_hwtimerval_t tv; rt_uint32_t cnt; + rt_base_t level; + rt_int32_t overflow; float t; timer = (rt_hwtimer_t *)dev; if (timer->ops->count_get == RT_NULL) return 0; + level = rt_hw_interrupt_disable(); cnt = timer->ops->count_get(timer); + overflow = timer->overflow; + rt_hw_interrupt_enable(level); + if (timer->info->cntmode == HWTIMER_CNTMODE_DW) { cnt = (timer->freq * timer->period_sec) - cnt; } - t = timer->overflow * timer->period_sec + cnt/(float)timer->freq; + t = overflow * timer->period_sec + cnt/(float)timer->freq; tv.sec = t; tv.usec = (t - tv.sec) * 1000000; size = size > sizeof(tv)? sizeof(tv) : size; @@ -255,6 +262,7 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args) *((struct rt_hwtimer_info*)args) = *timer->info; } + break; case HWTIMER_CTRL_MODE_SET: { rt_hwtimer_mode_t *m; @@ -317,7 +325,7 @@ void rt_device_hwtimer_isr(rt_hwtimer_t *timer) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops hwtimer_ops = +const static struct rt_device_ops hwtimer_ops = { rt_hwtimer_init, rt_hwtimer_open, diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index 99338eef5..7e55f6da4 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -375,8 +375,6 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, rt_int32_t i, ret; rt_uint16_t ignore_nack; - LOG_D("send start condition"); - i2c_start(ops); for (i = 0; i < num; i++) { msg = &msgs[i]; @@ -387,6 +385,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { i2c_restart(ops); } + else + { + LOG_D("send start condition"); + i2c_start(ops); + } ret = i2c_bit_send_address(bus, msg); if ((ret != RT_EOK) && !ignore_nack) { @@ -423,8 +426,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, ret = i; out: - LOG_D("send stop condition"); - i2c_stop(ops); + if (!(msg->flags & RT_I2C_NO_STOP)) + { + LOG_D("send stop condition"); + i2c_stop(ops); + } return ret; } diff --git a/components/drivers/i2c/i2c_core.c b/components/drivers/i2c/i2c_core.c index f358c2b75..87178e37d 100644 --- a/components/drivers/i2c/i2c_core.c +++ b/components/drivers/i2c/i2c_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/i2c/i2c_dev.c b/components/drivers/i2c/i2c_dev.c index 59f728be0..4f567f822 100644 --- a/components/drivers/i2c/i2c_dev.c +++ b/components/drivers/i2c/i2c_dev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -97,9 +97,9 @@ static rt_err_t i2c_bus_device_control(rt_device_t dev, } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops i2c_ops = +const static struct rt_device_ops i2c_ops = { - RT_NULL, + RT_NULL, RT_NULL, RT_NULL, i2c_bus_device_read, diff --git a/components/drivers/include/drivers/adc.h b/components/drivers/include/drivers/adc.h index 8e3498e79..e2ce087fb 100644 --- a/components/drivers/include/drivers/adc.h +++ b/components/drivers/include/drivers/adc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/alarm.h b/components/drivers/include/drivers/alarm.h index b5ebbc86d..11637df94 100644 --- a/components/drivers/include/drivers/alarm.h +++ b/components/drivers/include/drivers/alarm.h @@ -1,11 +1,13 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2012-10-27 heyuanjie87 first version. + * 2013-05-17 aozima initial alarm event & mutex in system init. + * 2020-10-15 zhangsz add alarm flags hour minute second. */ #ifndef __ALARM_H__ @@ -22,6 +24,9 @@ #define RT_ALARM_WEEKLY 0x200 /* alarm weekly at Monday or Friday etc. */ #define RT_ALARM_MONTHLY 0x400 /* alarm monthly at someday */ #define RT_ALARM_YAERLY 0x800 /* alarm yearly at a certain date */ +#define RT_ALARM_HOUR 0x1000 /* alarm each hour at a certain min:second */ +#define RT_ALARM_MINUTE 0x2000 /* alarm each minute at a certain second */ +#define RT_ALARM_SECOND 0x4000 /* alarm each second */ /* alarm control cmd */ #define RT_ALARM_CTRL_MODIFY 1 /* modify alarm time or alarm flag */ @@ -44,6 +49,8 @@ struct rt_alarm rt_uint32_t flag; rt_alarm_callback_t callback; struct tm wktime; + + void *user_data; }; struct rt_alarm_setup @@ -67,6 +74,6 @@ void rt_alarm_update(rt_device_t dev, rt_uint32_t event); rt_err_t rt_alarm_delete(rt_alarm_t alarm); rt_err_t rt_alarm_start(rt_alarm_t alarm); rt_err_t rt_alarm_stop(rt_alarm_t alarm); -void rt_alarm_system_init(void); +int rt_alarm_system_init(void); #endif /* __ALARM_H__ */ diff --git a/components/drivers/include/drivers/audio.h b/components/drivers/include/drivers/audio.h index 86057e762..45c31be2f 100644 --- a/components/drivers/include/drivers/audio.h +++ b/components/drivers/include/drivers/audio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/can.h b/components/drivers/include/drivers/can.h index d4fcc845b..bb05317d4 100644 --- a/components/drivers/include/drivers/can.h +++ b/components/drivers/include/drivers/can.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/cputime.h b/components/drivers/include/drivers/cputime.h index 78c22fc1d..0141f2480 100644 --- a/components/drivers/include/drivers/cputime.h +++ b/components/drivers/include/drivers/cputime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/crypto.h b/components/drivers/include/drivers/crypto.h index 5341d9ee4..8270a78b0 100644 --- a/components/drivers/include/drivers/crypto.h +++ b/components/drivers/include/drivers/crypto.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/hwtimer.h b/components/drivers/include/drivers/hwtimer.h index cbfeec2bf..0bf489379 100644 --- a/components/drivers/include/drivers/hwtimer.h +++ b/components/drivers/include/drivers/hwtimer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -70,7 +70,7 @@ typedef struct rt_hwtimer_device rt_int32_t freq; /* counting frequency set by the user */ rt_int32_t overflow; /* timer overflows */ - float period_sec; + float period_sec; rt_int32_t cycles; /* how many times will generate a timeout event after overflow */ rt_int32_t reload; /* reload cycles(using in period mode) */ rt_hwtimer_mode_t mode; /* timing mode(oneshot/period) */ diff --git a/components/drivers/include/drivers/i2c-bit-ops.h b/components/drivers/include/drivers/i2c-bit-ops.h index ddf9a36d7..0d94de114 100644 --- a/components/drivers/include/drivers/i2c-bit-ops.h +++ b/components/drivers/include/drivers/i2c-bit-ops.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/i2c.h b/components/drivers/include/drivers/i2c.h index 17d57288c..50ce021d5 100644 --- a/components/drivers/include/drivers/i2c.h +++ b/components/drivers/include/drivers/i2c.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -23,6 +23,7 @@ extern "C" { #define RT_I2C_NO_START (1u << 4) #define RT_I2C_IGNORE_NACK (1u << 5) #define RT_I2C_NO_READ_ACK (1u << 6) /* when I2C reading, we do not ACK */ +#define RT_I2C_NO_STOP (1u << 7) struct rt_i2c_msg { @@ -83,6 +84,17 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus, rt_uint16_t flags, rt_uint8_t *buf, rt_uint32_t count); + +rt_inline rt_err_t rt_i2c_bus_lock(struct rt_i2c_bus_device *bus, rt_tick_t timeout) +{ + return rt_mutex_take(&bus->lock, timeout); +} + +rt_inline rt_err_t rt_i2c_bus_unlock(struct rt_i2c_bus_device *bus) +{ + return rt_mutex_release(&bus->lock); +} + int rt_i2c_core_init(void); #ifdef __cplusplus diff --git a/components/drivers/include/drivers/i2c_dev.h b/components/drivers/include/drivers/i2c_dev.h index 5ef9dd1a8..94f110c05 100644 --- a/components/drivers/include/drivers/i2c_dev.h +++ b/components/drivers/include/drivers/i2c_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/mmc.h b/components/drivers/include/drivers/mmc.h index 95dce7178..d472bbbc5 100644 --- a/components/drivers/include/drivers/mmc.h +++ b/components/drivers/include/drivers/mmc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,163 +22,163 @@ extern "C" { * EXT_CSD fields */ -#define EXT_CSD_FLUSH_CACHE 32 /* W */ -#define EXT_CSD_CACHE_CTRL 33 /* R/W */ -#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ -#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */ -#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */ -#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */ -#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ -#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ -#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ -#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ -#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ -#define EXT_CSD_HPI_MGMT 161 /* R/W */ -#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ -#define EXT_CSD_BKOPS_EN 163 /* R/W */ -#define EXT_CSD_BKOPS_START 164 /* W */ -#define EXT_CSD_SANITIZE_START 165 /* W */ -#define EXT_CSD_WR_REL_PARAM 166 /* RO */ -#define EXT_CSD_RPMB_MULT 168 /* RO */ -#define EXT_CSD_BOOT_WP 173 /* R/W */ -#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ -#define EXT_CSD_PART_CONFIG 179 /* R/W */ -#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ -#define EXT_CSD_BUS_WIDTH 183 /* R/W */ -#define EXT_CSD_HS_TIMING 185 /* R/W */ -#define EXT_CSD_POWER_CLASS 187 /* R/W */ -#define EXT_CSD_REV 192 /* RO */ -#define EXT_CSD_STRUCTURE 194 /* RO */ -#define EXT_CSD_CARD_TYPE 196 /* RO */ -#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */ +#define EXT_CSD_FLUSH_CACHE 32 /* W */ +#define EXT_CSD_CACHE_CTRL 33 /* R/W */ +#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */ +#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */ +#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */ +#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */ +#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */ +#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */ +#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */ +#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ +#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ +#define EXT_CSD_HPI_MGMT 161 /* R/W */ +#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */ +#define EXT_CSD_BKOPS_EN 163 /* R/W */ +#define EXT_CSD_BKOPS_START 164 /* W */ +#define EXT_CSD_SANITIZE_START 165 /* W */ +#define EXT_CSD_WR_REL_PARAM 166 /* RO */ +#define EXT_CSD_RPMB_MULT 168 /* RO */ +#define EXT_CSD_BOOT_WP 173 /* R/W */ +#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ +#define EXT_CSD_PART_CONFIG 179 /* R/W */ +#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ +#define EXT_CSD_BUS_WIDTH 183 /* R/W */ +#define EXT_CSD_HS_TIMING 185 /* R/W */ +#define EXT_CSD_POWER_CLASS 187 /* R/W */ +#define EXT_CSD_REV 192 /* RO */ +#define EXT_CSD_STRUCTURE 194 /* RO */ +#define EXT_CSD_CARD_TYPE 196 /* RO */ +#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */ #define EXT_CSD_PART_SWITCH_TIME 199 /* RO */ -#define EXT_CSD_PWR_CL_52_195 200 /* RO */ -#define EXT_CSD_PWR_CL_26_195 201 /* RO */ -#define EXT_CSD_PWR_CL_52_360 202 /* RO */ -#define EXT_CSD_PWR_CL_26_360 203 /* RO */ -#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ -#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ -#define EXT_CSD_REL_WR_SEC_C 222 /* RO */ -#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */ -#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ -#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ -#define EXT_CSD_BOOT_MULT 226 /* RO */ -#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ -#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ -#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ -#define EXT_CSD_TRIM_MULT 232 /* RO */ -#define EXT_CSD_PWR_CL_200_195 236 /* RO */ -#define EXT_CSD_PWR_CL_200_360 237 /* RO */ -#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */ -#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */ -#define EXT_CSD_BKOPS_STATUS 246 /* RO */ -#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ -#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ -#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ -#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ -#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ -#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ -#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ -#define EXT_CSD_MAX_PACKED_READS 501 /* RO */ -#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */ -#define EXT_CSD_HPI_FEATURES 503 /* RO */ +#define EXT_CSD_PWR_CL_52_195 200 /* RO */ +#define EXT_CSD_PWR_CL_26_195 201 /* RO */ +#define EXT_CSD_PWR_CL_52_360 202 /* RO */ +#define EXT_CSD_PWR_CL_26_360 203 /* RO */ +#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ +#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ +#define EXT_CSD_REL_WR_SEC_C 222 /* RO */ +#define EXT_CSD_HC_WP_GRP_SIZE 221 /* RO */ +#define EXT_CSD_ERASE_TIMEOUT_MULT 223 /* RO */ +#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */ +#define EXT_CSD_BOOT_MULT 226 /* RO */ +#define EXT_CSD_SEC_TRIM_MULT 229 /* RO */ +#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ +#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ +#define EXT_CSD_TRIM_MULT 232 /* RO */ +#define EXT_CSD_PWR_CL_200_195 236 /* RO */ +#define EXT_CSD_PWR_CL_200_360 237 /* RO */ +#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */ +#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */ +#define EXT_CSD_BKOPS_STATUS 246 /* RO */ +#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */ +#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */ +#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */ +#define EXT_CSD_PWR_CL_DDR_200_360 253 /* RO */ +#define EXT_CSD_TAG_UNIT_SIZE 498 /* RO */ +#define EXT_CSD_DATA_TAG_SUPPORT 499 /* RO */ +#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */ +#define EXT_CSD_MAX_PACKED_READS 501 /* RO */ +#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */ +#define EXT_CSD_HPI_FEATURES 503 /* RO */ /* * EXT_CSD field definitions */ -#define EXT_CSD_WR_REL_PARAM_EN (1<<2) +#define EXT_CSD_WR_REL_PARAM_EN (1<<2) -#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40) -#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10) -#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04) -#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01) +#define EXT_CSD_BOOT_WP_B_PWR_WP_DIS (0x40) +#define EXT_CSD_BOOT_WP_B_PERM_WP_DIS (0x10) +#define EXT_CSD_BOOT_WP_B_PERM_WP_EN (0x04) +#define EXT_CSD_BOOT_WP_B_PWR_WP_EN (0x01) -#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) -#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) -#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3) -#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) +#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7) +#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1) +#define EXT_CSD_PART_CONFIG_ACC_RPMB (0x3) +#define EXT_CSD_PART_CONFIG_ACC_GP0 (0x4) -#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) +#define EXT_CSD_PART_SUPPORT_PART_EN (0x1) -#define EXT_CSD_CMD_SET_NORMAL (1<<0) -#define EXT_CSD_CMD_SET_SECURE (1<<1) -#define EXT_CSD_CMD_SET_CPSECURE (1<<2) +#define EXT_CSD_CMD_SET_NORMAL (1<<0) +#define EXT_CSD_CMD_SET_SECURE (1<<1) +#define EXT_CSD_CMD_SET_CPSECURE (1<<2) -#define EXT_CSD_CARD_TYPE_HS_26 (1<<0) /* Card can run at 26MHz */ -#define EXT_CSD_CARD_TYPE_HS_52 (1<<1) /* Card can run at 52MHz */ -#define EXT_CSD_CARD_TYPE_HS (EXT_CSD_CARD_TYPE_HS_26 | \ +#define EXT_CSD_CARD_TYPE_HS_26 (1<<0) /* Card can run at 26MHz */ +#define EXT_CSD_CARD_TYPE_HS_52 (1<<1) /* Card can run at 52MHz */ +#define EXT_CSD_CARD_TYPE_HS (EXT_CSD_CARD_TYPE_HS_26 | \ EXT_CSD_CARD_TYPE_HS_52) #define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ /* DDR mode @1.8V or 3V I/O */ #define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ - /* DDR mode @1.2V I/O */ + /* DDR mode @1.2V I/O */ #define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ | EXT_CSD_CARD_TYPE_DDR_1_2V) -#define EXT_CSD_CARD_TYPE_HS200_1_8V (1<<4) /* Card can run at 200MHz */ -#define EXT_CSD_CARD_TYPE_HS200_1_2V (1<<5) /* Card can run at 200MHz */ - /* SDR mode @1.2V I/O */ -#define EXT_CSD_CARD_TYPE_HS200 (EXT_CSD_CARD_TYPE_HS200_1_8V | \ - EXT_CSD_CARD_TYPE_HS200_1_2V) -#define EXT_CSD_CARD_TYPE_HS400_1_8V (1<<6) /* Card can run at 200MHz DDR, 1.8V */ -#define EXT_CSD_CARD_TYPE_HS400_1_2V (1<<7) /* Card can run at 200MHz DDR, 1.2V */ -#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | \ - EXT_CSD_CARD_TYPE_HS400_1_2V) - -#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ -#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ -#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ -#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */ -#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */ - -#define EXT_CSD_TIMING_BC 0 /* Backwards compatility */ -#define EXT_CSD_TIMING_HS 1 /* High speed */ -#define EXT_CSD_TIMING_HS200 2 /* HS200 */ -#define EXT_CSD_TIMING_HS400 3 /* HS400 */ - -#define EXT_CSD_SEC_ER_EN BIT(0) -#define EXT_CSD_SEC_BD_BLK_EN BIT(2) -#define EXT_CSD_SEC_GB_CL_EN BIT(4) -#define EXT_CSD_SEC_SANITIZE BIT(6) /* v4.5 only */ - -#define EXT_CSD_RST_N_EN_MASK 0x3 -#define EXT_CSD_RST_N_ENABLED 1 /* RST_n is enabled on card */ - -#define EXT_CSD_NO_POWER_NOTIFICATION 0 -#define EXT_CSD_POWER_ON 1 -#define EXT_CSD_POWER_OFF_SHORT 2 -#define EXT_CSD_POWER_OFF_LONG 3 - -#define EXT_CSD_PWR_CL_8BIT_MASK 0xF0 /* 8 bit PWR CLS */ -#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */ -#define EXT_CSD_PWR_CL_8BIT_SHIFT 4 -#define EXT_CSD_PWR_CL_4BIT_SHIFT 0 - -#define EXT_CSD_PACKED_EVENT_EN BIT(3) +#define EXT_CSD_CARD_TYPE_HS200_1_8V (1<<4) /* Card can run at 200MHz */ +#define EXT_CSD_CARD_TYPE_HS200_1_2V (1<<5) /* Card can run at 200MHz */ + /* SDR mode @1.2V I/O */ +#define EXT_CSD_CARD_TYPE_HS200 (EXT_CSD_CARD_TYPE_HS200_1_8V | \ + EXT_CSD_CARD_TYPE_HS200_1_2V) +#define EXT_CSD_CARD_TYPE_HS400_1_8V (1<<6) /* Card can run at 200MHz DDR, 1.8V */ +#define EXT_CSD_CARD_TYPE_HS400_1_2V (1<<7) /* Card can run at 200MHz DDR, 1.2V */ +#define EXT_CSD_CARD_TYPE_HS400 (EXT_CSD_CARD_TYPE_HS400_1_8V | \ + EXT_CSD_CARD_TYPE_HS400_1_2V) + +#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ +#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ +#define EXT_CSD_BUS_WIDTH_8 2 /* Card is in 8 bit mode */ +#define EXT_CSD_DDR_BUS_WIDTH_4 5 /* Card is in 4 bit DDR mode */ +#define EXT_CSD_DDR_BUS_WIDTH_8 6 /* Card is in 8 bit DDR mode */ + +#define EXT_CSD_TIMING_BC 0 /* Backwards compatility */ +#define EXT_CSD_TIMING_HS 1 /* High speed */ +#define EXT_CSD_TIMING_HS200 2 /* HS200 */ +#define EXT_CSD_TIMING_HS400 3 /* HS400 */ + +#define EXT_CSD_SEC_ER_EN BIT(0) +#define EXT_CSD_SEC_BD_BLK_EN BIT(2) +#define EXT_CSD_SEC_GB_CL_EN BIT(4) +#define EXT_CSD_SEC_SANITIZE BIT(6) /* v4.5 only */ + +#define EXT_CSD_RST_N_EN_MASK 0x3 +#define EXT_CSD_RST_N_ENABLED 1 /* RST_n is enabled on card */ + +#define EXT_CSD_NO_POWER_NOTIFICATION 0 +#define EXT_CSD_POWER_ON 1 +#define EXT_CSD_POWER_OFF_SHORT 2 +#define EXT_CSD_POWER_OFF_LONG 3 + +#define EXT_CSD_PWR_CL_8BIT_MASK 0xF0 /* 8 bit PWR CLS */ +#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */ +#define EXT_CSD_PWR_CL_8BIT_SHIFT 4 +#define EXT_CSD_PWR_CL_4BIT_SHIFT 0 + +#define EXT_CSD_PACKED_EVENT_EN BIT(3) /* * EXCEPTION_EVENT_STATUS field */ -#define EXT_CSD_URGENT_BKOPS BIT(0) -#define EXT_CSD_DYNCAP_NEEDED BIT(1) -#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2) -#define EXT_CSD_PACKED_FAILURE BIT(3) +#define EXT_CSD_URGENT_BKOPS BIT(0) +#define EXT_CSD_DYNCAP_NEEDED BIT(1) +#define EXT_CSD_SYSPOOL_EXHAUSTED BIT(2) +#define EXT_CSD_PACKED_FAILURE BIT(3) -#define EXT_CSD_PACKED_GENERIC_ERROR BIT(0) -#define EXT_CSD_PACKED_INDEXED_ERROR BIT(1) +#define EXT_CSD_PACKED_GENERIC_ERROR BIT(0) +#define EXT_CSD_PACKED_INDEXED_ERROR BIT(1) /* * BKOPS status level */ -#define EXT_CSD_BKOPS_LEVEL_2 0x2 +#define EXT_CSD_BKOPS_LEVEL_2 0x2 /* * MMC_SWITCH access modes */ -#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */ -#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */ -#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */ -#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */ - +#define MMC_SWITCH_MODE_CMD_SET 0x00 /* Change the command set */ +#define MMC_SWITCH_MODE_SET_BITS 0x01 /* Set bits which are 1 in value */ +#define MMC_SWITCH_MODE_CLEAR_BITS 0x02 /* Clear bits which are 1 in value */ +#define MMC_SWITCH_MODE_WRITE_BYTE 0x03 /* Set target to value */ + /* * extern function */ diff --git a/components/drivers/include/drivers/mmcsd_card.h b/components/drivers/include/drivers/mmcsd_card.h index 3ee5a2046..511cc1167 100644 --- a/components/drivers/include/drivers/mmcsd_card.h +++ b/components/drivers/include/drivers/mmcsd_card.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2011-07-25 weety first version + * Date Author Notes + * 2011-07-25 weety first version */ #ifndef __MMCSD_CARD_H__ @@ -17,87 +17,87 @@ extern "C" { #endif -#define SD_SCR_BUS_WIDTH_1 (1 << 0) -#define SD_SCR_BUS_WIDTH_4 (1 << 2) +#define SD_SCR_BUS_WIDTH_1 (1 << 0) +#define SD_SCR_BUS_WIDTH_4 (1 << 2) struct rt_mmcsd_cid { - rt_uint8_t mid; /* ManufacturerID */ - rt_uint8_t prv; /* Product Revision */ - rt_uint16_t oid; /* OEM/Application ID */ - rt_uint32_t psn; /* Product Serial Number */ - rt_uint8_t pnm[5]; /* Product Name */ - rt_uint8_t reserved1;/* reserved */ - rt_uint16_t mdt; /* Manufacturing Date */ - rt_uint8_t crc; /* CID CRC */ - rt_uint8_t reserved2;/* not used, always 1 */ + rt_uint8_t mid; /* ManufacturerID */ + rt_uint8_t prv; /* Product Revision */ + rt_uint16_t oid; /* OEM/Application ID */ + rt_uint32_t psn; /* Product Serial Number */ + rt_uint8_t pnm[5]; /* Product Name */ + rt_uint8_t reserved1;/* reserved */ + rt_uint16_t mdt; /* Manufacturing Date */ + rt_uint8_t crc; /* CID CRC */ + rt_uint8_t reserved2;/* not used, always 1 */ }; struct rt_mmcsd_csd { - rt_uint8_t csd_structure; /* CSD register version */ - rt_uint8_t taac; - rt_uint8_t nsac; - rt_uint8_t tran_speed; /* max data transfer rate */ - rt_uint16_t card_cmd_class; /* card command classes */ - rt_uint8_t rd_blk_len; /* max read data block length */ - rt_uint8_t rd_blk_part; - rt_uint8_t wr_blk_misalign; - rt_uint8_t rd_blk_misalign; - rt_uint8_t dsr_imp; /* DSR implemented */ - rt_uint8_t c_size_mult; /* CSD 1.0 , device size multiplier */ - rt_uint32_t c_size; /* device size */ - rt_uint8_t r2w_factor; - rt_uint8_t wr_blk_len; /* max wtire data block length */ - rt_uint8_t wr_blk_partial; - rt_uint8_t csd_crc; - + rt_uint8_t csd_structure; /* CSD register version */ + rt_uint8_t taac; + rt_uint8_t nsac; + rt_uint8_t tran_speed; /* max data transfer rate */ + rt_uint16_t card_cmd_class; /* card command classes */ + rt_uint8_t rd_blk_len; /* max read data block length */ + rt_uint8_t rd_blk_part; + rt_uint8_t wr_blk_misalign; + rt_uint8_t rd_blk_misalign; + rt_uint8_t dsr_imp; /* DSR implemented */ + rt_uint8_t c_size_mult; /* CSD 1.0 , device size multiplier */ + rt_uint32_t c_size; /* device size */ + rt_uint8_t r2w_factor; + rt_uint8_t wr_blk_len; /* max wtire data block length */ + rt_uint8_t wr_blk_partial; + rt_uint8_t csd_crc; + }; struct rt_sd_scr { - rt_uint8_t sd_version; - rt_uint8_t sd_bus_widths; + rt_uint8_t sd_version; + rt_uint8_t sd_bus_widths; }; struct rt_sdio_cccr { - rt_uint8_t sdio_version; - rt_uint8_t sd_version; - rt_uint8_t direct_cmd:1, /* Card Supports Direct Commands during data transfer - only SD mode, not used for SPI mode */ - multi_block:1, /* Card Supports Multi-Block */ - read_wait:1, /* Card Supports Read Wait - only SD mode, not used for SPI mode */ - suspend_resume:1, /* Card supports Suspend/Resume - only SD mode, not used for SPI mode */ - s4mi:1, /* generate interrupts during a 4-bit - multi-block data transfer */ - e4mi:1, /* Enable the multi-block IRQ during - 4-bit transfer for the SDIO card */ - low_speed:1, /* Card is a Low-Speed card */ - low_speed_4:1; /* 4-bit support for Low-Speed cards */ - - rt_uint8_t bus_width:1, /* Support SDIO bus width, 1:4bit, 0:1bit */ - cd_disable:1, /* Connect[0]/Disconnect[1] the 10K-90K ohm pull-up - resistor on CD/DAT[3] (pin 1) of the card */ - power_ctrl:1, /* Support Master Power Control */ - high_speed:1; /* Support High-Speed */ - - + rt_uint8_t sdio_version; + rt_uint8_t sd_version; + rt_uint8_t direct_cmd:1, /* Card Supports Direct Commands during data transfer + only SD mode, not used for SPI mode */ + multi_block:1, /* Card Supports Multi-Block */ + read_wait:1, /* Card Supports Read Wait + only SD mode, not used for SPI mode */ + suspend_resume:1, /* Card supports Suspend/Resume + only SD mode, not used for SPI mode */ + s4mi:1, /* generate interrupts during a 4-bit + multi-block data transfer */ + e4mi:1, /* Enable the multi-block IRQ during + 4-bit transfer for the SDIO card */ + low_speed:1, /* Card is a Low-Speed card */ + low_speed_4:1; /* 4-bit support for Low-Speed cards */ + + rt_uint8_t bus_width:1, /* Support SDIO bus width, 1:4bit, 0:1bit */ + cd_disable:1, /* Connect[0]/Disconnect[1] the 10K-90K ohm pull-up + resistor on CD/DAT[3] (pin 1) of the card */ + power_ctrl:1, /* Support Master Power Control */ + high_speed:1; /* Support High-Speed */ + + }; struct rt_sdio_cis { - rt_uint16_t manufacturer; - rt_uint16_t product; - rt_uint16_t func0_blk_size; - rt_uint32_t max_tran_speed; + rt_uint16_t manufacturer; + rt_uint16_t product; + rt_uint16_t func0_blk_size; + rt_uint32_t max_tran_speed; }; /* * SDIO function CIS tuple (unknown to the core) */ struct rt_sdio_function_tuple { - struct rt_sdio_function_tuple *next; - rt_uint8_t code; - rt_uint8_t size; - rt_uint8_t *data; + struct rt_sdio_function_tuple *next; + rt_uint8_t code; + rt_uint8_t size; + rt_uint8_t *data; }; struct rt_sdio_function; @@ -107,60 +107,60 @@ typedef void (rt_sdio_irq_handler_t)(struct rt_sdio_function *); * SDIO function devices */ struct rt_sdio_function { - struct rt_mmcsd_card *card; /* the card this device belongs to */ - rt_sdio_irq_handler_t *irq_handler; /* IRQ callback */ - rt_uint8_t num; /* function number */ + struct rt_mmcsd_card *card; /* the card this device belongs to */ + rt_sdio_irq_handler_t *irq_handler; /* IRQ callback */ + rt_uint8_t num; /* function number */ + + rt_uint8_t func_code; /* Standard SDIO Function interface code */ + rt_uint16_t manufacturer; /* manufacturer id */ + rt_uint16_t product; /* product id */ - rt_uint8_t func_code; /* Standard SDIO Function interface code */ - rt_uint16_t manufacturer; /* manufacturer id */ - rt_uint16_t product; /* product id */ + rt_uint32_t max_blk_size; /* maximum block size */ + rt_uint32_t cur_blk_size; /* current block size */ - rt_uint32_t max_blk_size; /* maximum block size */ - rt_uint32_t cur_blk_size; /* current block size */ + rt_uint32_t enable_timeout_val; /* max enable timeout in msec */ - rt_uint32_t enable_timeout_val; /* max enable timeout in msec */ + struct rt_sdio_function_tuple *tuples; - struct rt_sdio_function_tuple *tuples; - void *priv; }; -#define SDIO_MAX_FUNCTIONS 7 +#define SDIO_MAX_FUNCTIONS 7 struct rt_mmcsd_card { - struct rt_mmcsd_host *host; - rt_uint32_t rca; /* card addr */ - rt_uint32_t resp_cid[4]; /* card CID register */ - rt_uint32_t resp_csd[4]; /* card CSD register */ - rt_uint32_t resp_scr[2]; /* card SCR register */ - - rt_uint16_t tacc_clks; /* data access time by ns */ - rt_uint32_t tacc_ns; /* data access time by clk cycles */ - rt_uint32_t max_data_rate; /* max data transfer rate */ - rt_uint32_t card_capacity; /* card capacity, unit:KB */ - rt_uint32_t card_blksize; /* card block size */ - rt_uint32_t erase_size; /* erase size in sectors */ - rt_uint16_t card_type; + struct rt_mmcsd_host *host; + rt_uint32_t rca; /* card addr */ + rt_uint32_t resp_cid[4]; /* card CID register */ + rt_uint32_t resp_csd[4]; /* card CSD register */ + rt_uint32_t resp_scr[2]; /* card SCR register */ + + rt_uint16_t tacc_clks; /* data access time by ns */ + rt_uint32_t tacc_ns; /* data access time by clk cycles */ + rt_uint32_t max_data_rate; /* max data transfer rate */ + rt_uint32_t card_capacity; /* card capacity, unit:KB */ + rt_uint32_t card_blksize; /* card block size */ + rt_uint32_t erase_size; /* erase size in sectors */ + rt_uint16_t card_type; #define CARD_TYPE_MMC 0 /* MMC card */ #define CARD_TYPE_SD 1 /* SD card */ #define CARD_TYPE_SDIO 2 /* SDIO card */ #define CARD_TYPE_SDIO_COMBO 3 /* SD combo (IO+mem) card */ - rt_uint16_t flags; + rt_uint16_t flags; #define CARD_FLAG_HIGHSPEED (1 << 0) /* SDIO bus speed 50MHz */ #define CARD_FLAG_SDHC (1 << 1) /* SDHC card */ #define CARD_FLAG_SDXC (1 << 2) /* SDXC card */ - struct rt_sd_scr scr; - struct rt_mmcsd_csd csd; - rt_uint32_t hs_max_data_rate; /* max data transfer rate in high speed mode */ + struct rt_sd_scr scr; + struct rt_mmcsd_csd csd; + rt_uint32_t hs_max_data_rate; /* max data transfer rate in high speed mode */ - rt_uint8_t sdio_function_num; /* totol number of SDIO functions */ - struct rt_sdio_cccr cccr; /* common card info */ - struct rt_sdio_cis cis; /* common tuple info */ - struct rt_sdio_function *sdio_function[SDIO_MAX_FUNCTIONS + 1]; /* SDIO functions (devices) */ + rt_uint8_t sdio_function_num; /* totol number of SDIO functions */ + struct rt_sdio_cccr cccr; /* common card info */ + struct rt_sdio_cis cis; /* common tuple info */ + struct rt_sdio_function *sdio_function[SDIO_MAX_FUNCTIONS + 1]; /* SDIO functions (devices) */ }; diff --git a/components/drivers/include/drivers/mmcsd_cmd.h b/components/drivers/include/drivers/mmcsd_cmd.h index 7c2f26e89..2993fe540 100644 --- a/components/drivers/include/drivers/mmcsd_cmd.h +++ b/components/drivers/include/drivers/mmcsd_cmd.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2011-07-25 weety first version + * Date Author Notes + * 2011-07-25 weety first version */ #ifndef __CMD_H__ @@ -85,9 +85,9 @@ extern "C" { #define SD_APP_OP_COND 41 /* bcr [31:0] OCR R3 */ #define SD_APP_SEND_SCR 51 /* adtc R1 */ -#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */ -#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */ -#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */ +#define SCR_SPEC_VER_0 0 /* Implements system specification 1.0 - 1.01 */ +#define SCR_SPEC_VER_1 1 /* Implements system specification 1.10 */ +#define SCR_SPEC_VER_2 2 /* Implements system specification 2.00 */ /* SDIO commands type argument response */ diff --git a/components/drivers/include/drivers/mmcsd_core.h b/components/drivers/include/drivers/mmcsd_core.h index 05a5af6d7..11b1386b2 100644 --- a/components/drivers/include/drivers/mmcsd_core.h +++ b/components/drivers/include/drivers/mmcsd_core.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2011-07-25 weety first version + * Date Author Notes + * 2011-07-25 weety first version */ #ifndef __CORE_H__ @@ -27,139 +27,139 @@ extern "C" { #endif struct rt_mmcsd_data { - rt_uint32_t blksize; - rt_uint32_t blks; - rt_uint32_t *buf; - rt_int32_t err; - rt_uint32_t flags; -#define DATA_DIR_WRITE (1 << 0) -#define DATA_DIR_READ (1 << 1) -#define DATA_STREAM (1 << 2) - - unsigned int bytes_xfered; - - struct rt_mmcsd_cmd *stop; /* stop command */ - struct rt_mmcsd_req *mrq; /* associated request */ - - rt_uint32_t timeout_ns; - rt_uint32_t timeout_clks; + rt_uint32_t blksize; + rt_uint32_t blks; + rt_uint32_t *buf; + rt_int32_t err; + rt_uint32_t flags; +#define DATA_DIR_WRITE (1 << 0) +#define DATA_DIR_READ (1 << 1) +#define DATA_STREAM (1 << 2) + + unsigned int bytes_xfered; + + struct rt_mmcsd_cmd *stop; /* stop command */ + struct rt_mmcsd_req *mrq; /* associated request */ + + rt_uint32_t timeout_ns; + rt_uint32_t timeout_clks; }; struct rt_mmcsd_cmd { - rt_uint32_t cmd_code; - rt_uint32_t arg; - rt_uint32_t resp[4]; - rt_uint32_t flags; -/*rsponse types + rt_uint32_t cmd_code; + rt_uint32_t arg; + rt_uint32_t resp[4]; + rt_uint32_t flags; +/*rsponse types *bits:0~3 */ -#define RESP_MASK (0xF) -#define RESP_NONE (0) -#define RESP_R1 (1 << 0) -#define RESP_R1B (2 << 0) -#define RESP_R2 (3 << 0) -#define RESP_R3 (4 << 0) -#define RESP_R4 (5 << 0) -#define RESP_R6 (6 << 0) -#define RESP_R7 (7 << 0) -#define RESP_R5 (8 << 0) /*SDIO command response type*/ -/*command types +#define RESP_MASK (0xF) +#define RESP_NONE (0) +#define RESP_R1 (1 << 0) +#define RESP_R1B (2 << 0) +#define RESP_R2 (3 << 0) +#define RESP_R3 (4 << 0) +#define RESP_R4 (5 << 0) +#define RESP_R6 (6 << 0) +#define RESP_R7 (7 << 0) +#define RESP_R5 (8 << 0) /*SDIO command response type*/ +/*command types *bits:4~5 */ -#define CMD_MASK (3 << 4) /* command type */ -#define CMD_AC (0 << 4) -#define CMD_ADTC (1 << 4) -#define CMD_BC (2 << 4) -#define CMD_BCR (3 << 4) +#define CMD_MASK (3 << 4) /* command type */ +#define CMD_AC (0 << 4) +#define CMD_ADTC (1 << 4) +#define CMD_BC (2 << 4) +#define CMD_BCR (3 << 4) -#define resp_type(cmd) ((cmd)->flags & RESP_MASK) +#define resp_type(cmd) ((cmd)->flags & RESP_MASK) -/*spi rsponse types +/*spi rsponse types *bits:6~8 */ -#define RESP_SPI_MASK (0x7 << 6) -#define RESP_SPI_R1 (1 << 6) -#define RESP_SPI_R1B (2 << 6) -#define RESP_SPI_R2 (3 << 6) -#define RESP_SPI_R3 (4 << 6) -#define RESP_SPI_R4 (5 << 6) -#define RESP_SPI_R5 (6 << 6) -#define RESP_SPI_R7 (7 << 6) - -#define spi_resp_type(cmd) ((cmd)->flags & RESP_SPI_MASK) +#define RESP_SPI_MASK (0x7 << 6) +#define RESP_SPI_R1 (1 << 6) +#define RESP_SPI_R1B (2 << 6) +#define RESP_SPI_R2 (3 << 6) +#define RESP_SPI_R3 (4 << 6) +#define RESP_SPI_R4 (5 << 6) +#define RESP_SPI_R5 (6 << 6) +#define RESP_SPI_R7 (7 << 6) + +#define spi_resp_type(cmd) ((cmd)->flags & RESP_SPI_MASK) /* * These are the command types. */ -#define cmd_type(cmd) ((cmd)->flags & CMD_MASK) - - rt_int32_t retries; /* max number of retries */ - rt_int32_t err; +#define cmd_type(cmd) ((cmd)->flags & CMD_MASK) - struct rt_mmcsd_data *data; - struct rt_mmcsd_req *mrq; /* associated request */ + rt_int32_t retries; /* max number of retries */ + rt_int32_t err; + + struct rt_mmcsd_data *data; + struct rt_mmcsd_req *mrq; /* associated request */ }; struct rt_mmcsd_req { - struct rt_mmcsd_data *data; - struct rt_mmcsd_cmd *cmd; - struct rt_mmcsd_cmd *stop; + struct rt_mmcsd_data *data; + struct rt_mmcsd_cmd *cmd; + struct rt_mmcsd_cmd *stop; }; /*the following is response bit*/ -#define R1_OUT_OF_RANGE (1 << 31) /* er, c */ -#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */ -#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */ -#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */ -#define R1_ERASE_PARAM (1 << 27) /* ex, c */ -#define R1_WP_VIOLATION (1 << 26) /* erx, c */ -#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */ -#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */ -#define R1_COM_CRC_ERROR (1 << 23) /* er, b */ -#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */ -#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */ -#define R1_CC_ERROR (1 << 20) /* erx, c */ -#define R1_ERROR (1 << 19) /* erx, c */ -#define R1_UNDERRUN (1 << 18) /* ex, c */ -#define R1_OVERRUN (1 << 17) /* ex, c */ -#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */ -#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */ -#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ -#define R1_ERASE_RESET (1 << 13) /* sr, c */ +#define R1_OUT_OF_RANGE (1 << 31) /* er, c */ +#define R1_ADDRESS_ERROR (1 << 30) /* erx, c */ +#define R1_BLOCK_LEN_ERROR (1 << 29) /* er, c */ +#define R1_ERASE_SEQ_ERROR (1 << 28) /* er, c */ +#define R1_ERASE_PARAM (1 << 27) /* ex, c */ +#define R1_WP_VIOLATION (1 << 26) /* erx, c */ +#define R1_CARD_IS_LOCKED (1 << 25) /* sx, a */ +#define R1_LOCK_UNLOCK_FAILED (1 << 24) /* erx, c */ +#define R1_COM_CRC_ERROR (1 << 23) /* er, b */ +#define R1_ILLEGAL_COMMAND (1 << 22) /* er, b */ +#define R1_CARD_ECC_FAILED (1 << 21) /* ex, c */ +#define R1_CC_ERROR (1 << 20) /* erx, c */ +#define R1_ERROR (1 << 19) /* erx, c */ +#define R1_UNDERRUN (1 << 18) /* ex, c */ +#define R1_OVERRUN (1 << 17) /* ex, c */ +#define R1_CID_CSD_OVERWRITE (1 << 16) /* erx, c, CID/CSD overwrite */ +#define R1_WP_ERASE_SKIP (1 << 15) /* sx, c */ +#define R1_CARD_ECC_DISABLED (1 << 14) /* sx, a */ +#define R1_ERASE_RESET (1 << 13) /* sr, c */ #define R1_STATUS(x) (x & 0xFFFFE000) -#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ -#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ -#define R1_APP_CMD (1 << 5) /* sr, c */ - - -#define R1_SPI_IDLE (1 << 0) -#define R1_SPI_ERASE_RESET (1 << 1) -#define R1_SPI_ILLEGAL_COMMAND (1 << 2) -#define R1_SPI_COM_CRC (1 << 3) -#define R1_SPI_ERASE_SEQ (1 << 4) -#define R1_SPI_ADDRESS (1 << 5) -#define R1_SPI_PARAMETER (1 << 6) +#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ +#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ +#define R1_APP_CMD (1 << 5) /* sr, c */ + + +#define R1_SPI_IDLE (1 << 0) +#define R1_SPI_ERASE_RESET (1 << 1) +#define R1_SPI_ILLEGAL_COMMAND (1 << 2) +#define R1_SPI_COM_CRC (1 << 3) +#define R1_SPI_ERASE_SEQ (1 << 4) +#define R1_SPI_ADDRESS (1 << 5) +#define R1_SPI_PARAMETER (1 << 6) /* R1 bit 7 is always zero */ -#define R2_SPI_CARD_LOCKED (1 << 8) -#define R2_SPI_WP_ERASE_SKIP (1 << 9) /* or lock/unlock fail */ -#define R2_SPI_LOCK_UNLOCK_FAIL R2_SPI_WP_ERASE_SKIP -#define R2_SPI_ERROR (1 << 10) -#define R2_SPI_CC_ERROR (1 << 11) -#define R2_SPI_CARD_ECC_ERROR (1 << 12) -#define R2_SPI_WP_VIOLATION (1 << 13) -#define R2_SPI_ERASE_PARAM (1 << 14) -#define R2_SPI_OUT_OF_RANGE (1 << 15) /* or CSD overwrite */ -#define R2_SPI_CSD_OVERWRITE R2_SPI_OUT_OF_RANGE - -#define CARD_BUSY 0x80000000 /* Card Power up status bit */ +#define R2_SPI_CARD_LOCKED (1 << 8) +#define R2_SPI_WP_ERASE_SKIP (1 << 9) /* or lock/unlock fail */ +#define R2_SPI_LOCK_UNLOCK_FAIL R2_SPI_WP_ERASE_SKIP +#define R2_SPI_ERROR (1 << 10) +#define R2_SPI_CC_ERROR (1 << 11) +#define R2_SPI_CARD_ECC_ERROR (1 << 12) +#define R2_SPI_WP_VIOLATION (1 << 13) +#define R2_SPI_ERASE_PARAM (1 << 14) +#define R2_SPI_OUT_OF_RANGE (1 << 15) /* or CSD overwrite */ +#define R2_SPI_CSD_OVERWRITE R2_SPI_OUT_OF_RANGE + +#define CARD_BUSY 0x80000000 /* Card Power up status bit */ /* R5 response bits */ -#define R5_COM_CRC_ERROR (1 << 15) -#define R5_ILLEGAL_COMMAND (1 << 14) -#define R5_ERROR (1 << 11) -#define R5_FUNCTION_NUMBER (1 << 9) -#define R5_OUT_OF_RANGE (1 << 8) -#define R5_STATUS(x) (x & 0xCB00) -#define R5_IO_CURRENT_STATE(x) ((x & 0x3000) >> 12) +#define R5_COM_CRC_ERROR (1 << 15) +#define R5_ILLEGAL_COMMAND (1 << 14) +#define R5_ERROR (1 << 11) +#define R5_FUNCTION_NUMBER (1 << 9) +#define R5_OUT_OF_RANGE (1 << 8) +#define R5_STATUS(x) (x & 0xCB00) +#define R5_IO_CURRENT_STATE(x) ((x & 0x3000) >> 12) @@ -173,36 +173,36 @@ struct rt_mmcsd_req { rt_inline rt_uint32_t __rt_fls(rt_uint32_t val) { - rt_uint32_t bit = 32; - - if (!val) - return 0; - if (!(val & 0xffff0000u)) - { - val <<= 16; - bit -= 16; - } - if (!(val & 0xff000000u)) - { - val <<= 8; - bit -= 8; - } - if (!(val & 0xf0000000u)) - { - val <<= 4; - bit -= 4; - } - if (!(val & 0xc0000000u)) - { - val <<= 2; - bit -= 2; - } - if (!(val & 0x80000000u)) - { - bit -= 1; - } - - return bit; + rt_uint32_t bit = 32; + + if (!val) + return 0; + if (!(val & 0xffff0000u)) + { + val <<= 16; + bit -= 16; + } + if (!(val & 0xff000000u)) + { + val <<= 8; + bit -= 8; + } + if (!(val & 0xf0000000u)) + { + val <<= 4; + bit -= 4; + } + if (!(val & 0xc0000000u)) + { + val <<= 2; + bit -= 2; + } + if (!(val & 0x80000000u)) + { + bit -= 1; + } + + return bit; } #define MMCSD_HOST_PLUGED 0 diff --git a/components/drivers/include/drivers/mmcsd_host.h b/components/drivers/include/drivers/mmcsd_host.h index 1253062ae..c7f673aeb 100644 --- a/components/drivers/include/drivers/mmcsd_host.h +++ b/components/drivers/include/drivers/mmcsd_host.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: - * Date Author Notes - * 2011-07-25 weety first version + * Date Author Notes + * 2011-07-25 weety first version */ #ifndef __HOST_H__ @@ -18,33 +18,33 @@ extern "C" { #endif struct rt_mmcsd_io_cfg { - rt_uint32_t clock; /* clock rate */ - rt_uint16_t vdd; + rt_uint32_t clock; /* clock rate */ + rt_uint16_t vdd; /* vdd stores the bit number of the selected voltage range from below. */ - rt_uint8_t bus_mode; /* command output mode */ + rt_uint8_t bus_mode; /* command output mode */ -#define MMCSD_BUSMODE_OPENDRAIN 1 -#define MMCSD_BUSMODE_PUSHPULL 2 +#define MMCSD_BUSMODE_OPENDRAIN 1 +#define MMCSD_BUSMODE_PUSHPULL 2 - rt_uint8_t chip_select; /* SPI chip select */ + rt_uint8_t chip_select; /* SPI chip select */ -#define MMCSD_CS_IGNORE 0 -#define MMCSD_CS_HIGH 1 -#define MMCSD_CS_LOW 2 +#define MMCSD_CS_IGNORE 0 +#define MMCSD_CS_HIGH 1 +#define MMCSD_CS_LOW 2 - rt_uint8_t power_mode; /* power supply mode */ + rt_uint8_t power_mode; /* power supply mode */ -#define MMCSD_POWER_OFF 0 -#define MMCSD_POWER_UP 1 -#define MMCSD_POWER_ON 2 +#define MMCSD_POWER_OFF 0 +#define MMCSD_POWER_UP 1 +#define MMCSD_POWER_ON 2 - rt_uint8_t bus_width; /* data bus width */ + rt_uint8_t bus_width; /* data bus width */ -#define MMCSD_BUS_WIDTH_1 0 -#define MMCSD_BUS_WIDTH_4 2 -#define MMCSD_BUS_WIDTH_8 3 +#define MMCSD_BUS_WIDTH_1 0 +#define MMCSD_BUS_WIDTH_4 2 +#define MMCSD_BUS_WIDTH_8 3 }; @@ -52,71 +52,71 @@ struct rt_mmcsd_host; struct rt_mmcsd_req; struct rt_mmcsd_host_ops { - void (*request)(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req); - void (*set_iocfg)(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io_cfg); - rt_int32_t (*get_card_status)(struct rt_mmcsd_host *host); - void (*enable_sdio_irq)(struct rt_mmcsd_host *host, rt_int32_t en); + void (*request)(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req); + void (*set_iocfg)(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io_cfg); + rt_int32_t (*get_card_status)(struct rt_mmcsd_host *host); + void (*enable_sdio_irq)(struct rt_mmcsd_host *host, rt_int32_t en); }; struct rt_mmcsd_host { - struct rt_mmcsd_card *card; - const struct rt_mmcsd_host_ops *ops; - rt_uint32_t freq_min; - rt_uint32_t freq_max; - struct rt_mmcsd_io_cfg io_cfg; - rt_uint32_t valid_ocr; /* current valid OCR */ -#define VDD_165_195 (1 << 7) /* VDD voltage 1.65 - 1.95 */ -#define VDD_20_21 (1 << 8) /* VDD voltage 2.0 ~ 2.1 */ -#define VDD_21_22 (1 << 9) /* VDD voltage 2.1 ~ 2.2 */ -#define VDD_22_23 (1 << 10) /* VDD voltage 2.2 ~ 2.3 */ -#define VDD_23_24 (1 << 11) /* VDD voltage 2.3 ~ 2.4 */ -#define VDD_24_25 (1 << 12) /* VDD voltage 2.4 ~ 2.5 */ -#define VDD_25_26 (1 << 13) /* VDD voltage 2.5 ~ 2.6 */ -#define VDD_26_27 (1 << 14) /* VDD voltage 2.6 ~ 2.7 */ -#define VDD_27_28 (1 << 15) /* VDD voltage 2.7 ~ 2.8 */ -#define VDD_28_29 (1 << 16) /* VDD voltage 2.8 ~ 2.9 */ -#define VDD_29_30 (1 << 17) /* VDD voltage 2.9 ~ 3.0 */ -#define VDD_30_31 (1 << 18) /* VDD voltage 3.0 ~ 3.1 */ -#define VDD_31_32 (1 << 19) /* VDD voltage 3.1 ~ 3.2 */ -#define VDD_32_33 (1 << 20) /* VDD voltage 3.2 ~ 3.3 */ -#define VDD_33_34 (1 << 21) /* VDD voltage 3.3 ~ 3.4 */ -#define VDD_34_35 (1 << 22) /* VDD voltage 3.4 ~ 3.5 */ -#define VDD_35_36 (1 << 23) /* VDD voltage 3.5 ~ 3.6 */ - rt_uint32_t flags; /* define device capabilities */ -#define MMCSD_BUSWIDTH_4 (1 << 0) -#define MMCSD_BUSWIDTH_8 (1 << 1) -#define MMCSD_MUTBLKWRITE (1 << 2) -#define MMCSD_HOST_IS_SPI (1 << 3) -#define controller_is_spi(host) (host->flags & MMCSD_HOST_IS_SPI) -#define MMCSD_SUP_SDIO_IRQ (1 << 4) /* support signal pending SDIO IRQs */ -#define MMCSD_SUP_HIGHSPEED (1 << 5) /* support high speed */ - - rt_uint32_t max_seg_size; /* maximum size of one dma segment */ - rt_uint32_t max_dma_segs; /* maximum number of dma segments in one request */ - rt_uint32_t max_blk_size; /* maximum block size */ - rt_uint32_t max_blk_count; /* maximum block count */ - - rt_uint32_t spi_use_crc; - struct rt_mutex bus_lock; - struct rt_semaphore sem_ack; - - rt_uint32_t sdio_irq_num; - struct rt_semaphore *sdio_irq_sem; - struct rt_thread *sdio_irq_thread; - - void *private_data; + struct rt_mmcsd_card *card; + const struct rt_mmcsd_host_ops *ops; + rt_uint32_t freq_min; + rt_uint32_t freq_max; + struct rt_mmcsd_io_cfg io_cfg; + rt_uint32_t valid_ocr; /* current valid OCR */ +#define VDD_165_195 (1 << 7) /* VDD voltage 1.65 - 1.95 */ +#define VDD_20_21 (1 << 8) /* VDD voltage 2.0 ~ 2.1 */ +#define VDD_21_22 (1 << 9) /* VDD voltage 2.1 ~ 2.2 */ +#define VDD_22_23 (1 << 10) /* VDD voltage 2.2 ~ 2.3 */ +#define VDD_23_24 (1 << 11) /* VDD voltage 2.3 ~ 2.4 */ +#define VDD_24_25 (1 << 12) /* VDD voltage 2.4 ~ 2.5 */ +#define VDD_25_26 (1 << 13) /* VDD voltage 2.5 ~ 2.6 */ +#define VDD_26_27 (1 << 14) /* VDD voltage 2.6 ~ 2.7 */ +#define VDD_27_28 (1 << 15) /* VDD voltage 2.7 ~ 2.8 */ +#define VDD_28_29 (1 << 16) /* VDD voltage 2.8 ~ 2.9 */ +#define VDD_29_30 (1 << 17) /* VDD voltage 2.9 ~ 3.0 */ +#define VDD_30_31 (1 << 18) /* VDD voltage 3.0 ~ 3.1 */ +#define VDD_31_32 (1 << 19) /* VDD voltage 3.1 ~ 3.2 */ +#define VDD_32_33 (1 << 20) /* VDD voltage 3.2 ~ 3.3 */ +#define VDD_33_34 (1 << 21) /* VDD voltage 3.3 ~ 3.4 */ +#define VDD_34_35 (1 << 22) /* VDD voltage 3.4 ~ 3.5 */ +#define VDD_35_36 (1 << 23) /* VDD voltage 3.5 ~ 3.6 */ + rt_uint32_t flags; /* define device capabilities */ +#define MMCSD_BUSWIDTH_4 (1 << 0) +#define MMCSD_BUSWIDTH_8 (1 << 1) +#define MMCSD_MUTBLKWRITE (1 << 2) +#define MMCSD_HOST_IS_SPI (1 << 3) +#define controller_is_spi(host) (host->flags & MMCSD_HOST_IS_SPI) +#define MMCSD_SUP_SDIO_IRQ (1 << 4) /* support signal pending SDIO IRQs */ +#define MMCSD_SUP_HIGHSPEED (1 << 5) /* support high speed */ + + rt_uint32_t max_seg_size; /* maximum size of one dma segment */ + rt_uint32_t max_dma_segs; /* maximum number of dma segments in one request */ + rt_uint32_t max_blk_size; /* maximum block size */ + rt_uint32_t max_blk_count; /* maximum block count */ + + rt_uint32_t spi_use_crc; + struct rt_mutex bus_lock; + struct rt_semaphore sem_ack; + + rt_uint32_t sdio_irq_num; + struct rt_semaphore *sdio_irq_sem; + struct rt_thread *sdio_irq_thread; + + void *private_data; }; rt_inline void mmcsd_delay_ms(rt_uint32_t ms) { - if (ms < 1000 / RT_TICK_PER_SECOND) - { - rt_thread_delay(1); - } - else - { - rt_thread_delay(ms/(1000 / RT_TICK_PER_SECOND)); - } + if (ms < 1000 / RT_TICK_PER_SECOND) + { + rt_thread_delay(1); + } + else + { + rt_thread_delay(ms/(1000 / RT_TICK_PER_SECOND)); + } } #ifdef __cplusplus diff --git a/components/drivers/include/drivers/mtd_nand.h b/components/drivers/include/drivers/mtd_nand.h index f7675aede..a452da61d 100644 --- a/components/drivers/include/drivers/mtd_nand.h +++ b/components/drivers/include/drivers/mtd_nand.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/mtd_nor.h b/components/drivers/include/drivers/mtd_nor.h index 32a952f37..2a3bb54f3 100644 --- a/components/drivers/include/drivers/mtd_nor.h +++ b/components/drivers/include/drivers/mtd_nor.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -14,54 +14,54 @@ #include struct rt_mtd_nor_driver_ops; -#define RT_MTD_NOR_DEVICE(device) ((struct rt_mtd_nor_device*)(device)) +#define RT_MTD_NOR_DEVICE(device) ((struct rt_mtd_nor_device*)(device)) struct rt_mtd_nor_device { - struct rt_device parent; + struct rt_device parent; - rt_uint32_t block_size; /* The Block size in the flash */ - rt_uint32_t block_start; /* The start of available block*/ - rt_uint32_t block_end; /* The end of available block */ + rt_uint32_t block_size; /* The Block size in the flash */ + rt_uint32_t block_start; /* The start of available block*/ + rt_uint32_t block_end; /* The end of available block */ - /* operations interface */ - const struct rt_mtd_nor_driver_ops* ops; + /* operations interface */ + const struct rt_mtd_nor_driver_ops* ops; }; struct rt_mtd_nor_driver_ops { - rt_err_t (*read_id) (struct rt_mtd_nor_device* device); + rt_err_t (*read_id) (struct rt_mtd_nor_device* device); - rt_size_t (*read) (struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint8_t* data, rt_uint32_t length); - rt_size_t (*write) (struct rt_mtd_nor_device* device, rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length); + rt_size_t (*read) (struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint8_t* data, rt_uint32_t length); + rt_size_t (*write) (struct rt_mtd_nor_device* device, rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length); - rt_err_t (*erase_block)(struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint32_t length); + rt_err_t (*erase_block)(struct rt_mtd_nor_device* device, rt_off_t offset, rt_uint32_t length); }; rt_err_t rt_mtd_nor_register_device(const char* name, struct rt_mtd_nor_device* device); rt_inline rt_uint32_t rt_mtd_nor_read_id(struct rt_mtd_nor_device* device) { - return device->ops->read_id(device); + return device->ops->read_id(device); } rt_inline rt_size_t rt_mtd_nor_read( - struct rt_mtd_nor_device* device, - rt_off_t offset, rt_uint8_t* data, rt_uint32_t length) + struct rt_mtd_nor_device* device, + rt_off_t offset, rt_uint8_t* data, rt_uint32_t length) { - return device->ops->read(device, offset, data, length); + return device->ops->read(device, offset, data, length); } rt_inline rt_size_t rt_mtd_nor_write( - struct rt_mtd_nor_device* device, - rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length) + struct rt_mtd_nor_device* device, + rt_off_t offset, const rt_uint8_t* data, rt_uint32_t length) { - return device->ops->write(device, offset, data, length); + return device->ops->write(device, offset, data, length); } rt_inline rt_err_t rt_mtd_nor_erase_block(struct rt_mtd_nor_device* device, rt_off_t offset, rt_size_t length) { - return device->ops->erase_block(device, offset, length); + return device->ops->erase_block(device, offset, length); } #endif diff --git a/components/drivers/include/drivers/pin.h b/components/drivers/include/drivers/pin.h index ca3540793..c624ddcb2 100644 --- a/components/drivers/include/drivers/pin.h +++ b/components/drivers/include/drivers/pin.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/pm.h b/components/drivers/include/drivers/pm.h index dd5875aa1..1a030dc0a 100644 --- a/components/drivers/include/drivers/pm.h +++ b/components/drivers/include/drivers/pm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/pulse_encoder.h b/components/drivers/include/drivers/pulse_encoder.h index 0c7df04cd..38ef7652b 100644 --- a/components/drivers/include/drivers/pulse_encoder.h +++ b/components/drivers/include/drivers/pulse_encoder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/rt_drv_pwm.h b/components/drivers/include/drivers/rt_drv_pwm.h index 16de4c6ab..8f58052af 100644 --- a/components/drivers/include/drivers/rt_drv_pwm.h +++ b/components/drivers/include/drivers/rt_drv_pwm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/rt_inputcapture.h b/components/drivers/include/drivers/rt_inputcapture.h index 0cadf6444..813ed3157 100644 --- a/components/drivers/include/drivers/rt_inputcapture.h +++ b/components/drivers/include/drivers/rt_inputcapture.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -48,7 +48,7 @@ struct rt_inputcapture_ops rt_err_t (*get_pulsewidth)(struct rt_inputcapture_device *inputcapture, rt_uint32_t *pulsewidth_us); }; -void rt_hw_capture_isr(struct rt_inputcapture_device *inputcapture, rt_bool_t level); +void rt_hw_inputcapture_isr(struct rt_inputcapture_device *inputcapture, rt_bool_t level); rt_err_t rt_device_inputcapture_register(struct rt_inputcapture_device *inputcapture, const char *name, diff --git a/components/drivers/include/drivers/rtc.h b/components/drivers/include/drivers/rtc.h index 1cd88a7be..484593711 100644 --- a/components/drivers/include/drivers/rtc.h +++ b/components/drivers/include/drivers/rtc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/sd.h b/components/drivers/include/drivers/sd.h index e096df937..450f23e65 100644 --- a/components/drivers/include/drivers/sd.h +++ b/components/drivers/include/drivers/sd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/drivers/sdio.h b/components/drivers/include/drivers/sdio.h index e4bf4a048..212d8cfb5 100644 --- a/components/drivers/include/drivers/sdio.h +++ b/components/drivers/include/drivers/sdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -174,10 +174,10 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func, rt_int32_t op_code, rt_uint8_t *buf, rt_uint32_t len); -rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, +rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, rt_uint32_t reg, rt_int32_t *err); -rt_int32_t sdio_io_writeb(struct rt_sdio_function *func, +rt_int32_t sdio_io_writeb(struct rt_sdio_function *func, rt_uint32_t reg, rt_uint8_t data); rt_uint16_t sdio_io_readw(struct rt_sdio_function *func, @@ -192,19 +192,19 @@ rt_uint32_t sdio_io_readl(struct rt_sdio_function *func, rt_int32_t sdio_io_writel(struct rt_sdio_function *func, rt_uint32_t data, rt_uint32_t addr); -rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); -rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); -rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); -rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len); diff --git a/components/drivers/include/drivers/sdio_func_ids.h b/components/drivers/include/drivers/sdio_func_ids.h index 79085a593..76502ff6e 100644 --- a/components/drivers/include/drivers/sdio_func_ids.h +++ b/components/drivers/include/drivers/sdio_func_ids.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2012-02-26 weety first version */ - + #ifndef __SDIO_FUNC_IDS_H__ #define __SDIO_FUNC_IDS_H__ diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h index 45095af63..c2e951e9b 100644 --- a/components/drivers/include/drivers/serial.h +++ b/components/drivers/include/drivers/serial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -104,7 +104,7 @@ struct serial_configure }; /* - * Serial FIFO mode + * Serial FIFO mode */ struct rt_serial_rx_fifo { @@ -121,7 +121,7 @@ struct rt_serial_tx_fifo struct rt_completion completion; }; -/* +/* * Serial DMA mode */ struct rt_serial_rx_dma diff --git a/components/drivers/include/drivers/spi.h b/components/drivers/include/drivers/spi.h index 04a65421a..018d12139 100644 --- a/components/drivers/include/drivers/spi.h +++ b/components/drivers/include/drivers/spi.h @@ -1,11 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2012-11-23 Bernard Add extern "C" + * 2020-06-13 armink fix the 3 wires issue */ #ifndef __SPI_H__ @@ -18,8 +19,6 @@ extern "C"{ #endif -#define RT_SPI_CPHA (1<<0) /* bit[0]:CPHA, clock phase */ -#define RT_SPI_CPOL (1<<1) /* bit[1]:CPOL, clock polarity */ /** * At CPOL=0 the base value of the clock is zero * - For CPHA=0, data are captured on the clock's rising edge (low->high transition) @@ -32,26 +31,29 @@ extern "C"{ * - For CPHA=1, data are captured on clock's rising edge and data are propagated * on a falling edge. */ +#define RT_SPI_CPHA (1<<0) /* bit[0]:CPHA, clock phase */ +#define RT_SPI_CPOL (1<<1) /* bit[1]:CPOL, clock polarity */ + #define RT_SPI_LSB (0<<2) /* bit[2]: 0-LSB */ #define RT_SPI_MSB (1<<2) /* bit[2]: 1-MSB */ #define RT_SPI_MASTER (0<<3) /* SPI master device */ #define RT_SPI_SLAVE (1<<3) /* SPI slave device */ +#define RT_SPI_CS_HIGH (1<<4) /* Chipselect active high */ +#define RT_SPI_NO_CS (1<<5) /* No chipselect */ +#define RT_SPI_3WIRE (1<<6) /* SI/SO pin shared */ +#define RT_SPI_READY (1<<7) /* Slave pulls low to pause */ + +#define RT_SPI_MODE_MASK (RT_SPI_CPHA | RT_SPI_CPOL | RT_SPI_MSB | RT_SPI_SLAVE | RT_SPI_CS_HIGH | RT_SPI_NO_CS | RT_SPI_3WIRE | RT_SPI_READY) + #define RT_SPI_MODE_0 (0 | 0) /* CPOL = 0, CPHA = 0 */ #define RT_SPI_MODE_1 (0 | RT_SPI_CPHA) /* CPOL = 0, CPHA = 1 */ #define RT_SPI_MODE_2 (RT_SPI_CPOL | 0) /* CPOL = 1, CPHA = 0 */ #define RT_SPI_MODE_3 (RT_SPI_CPOL | RT_SPI_CPHA) /* CPOL = 1, CPHA = 1 */ -#define RT_SPI_MODE_MASK (RT_SPI_CPHA | RT_SPI_CPOL | RT_SPI_MSB) - -#define RT_SPI_BUS_MODE_SPI (1<<0) -#define RT_SPI_BUS_MODE_QSPI (1<<1) - -#define RT_SPI_CS_HIGH (1<<4) /* Chipselect active high */ -#define RT_SPI_NO_CS (1<<5) /* No chipselect */ -#define RT_SPI_3WIRE (1<<6) /* SI/SO pin shared */ -#define RT_SPI_READY (1<<7) /* Slave pulls low to pause */ +#define RT_SPI_BUS_MODE_SPI (1<<0) +#define RT_SPI_BUS_MODE_QSPI (1<<1) /** * SPI message structure @@ -149,7 +151,7 @@ struct rt_qspi_configuration }; struct rt_qspi_device -{ +{ struct rt_spi_device parent; struct rt_qspi_configuration config; diff --git a/components/drivers/include/drivers/usb_common.h b/components/drivers/include/drivers/usb_common.h index c26d83391..9c29a0d0d 100644 --- a/components/drivers/include/drivers/usb_common.h +++ b/components/drivers/include/drivers/usb_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -427,23 +427,23 @@ struct usb_os_proerty }; typedef struct usb_os_proerty * usb_os_proerty_t; -// Value Description -// 1 A NULL-terminated Unicode String (REG_SZ) -// 2 A NULL-terminated Unicode String that includes environment variables (REG_EXPAND_SZ) -// 3 Free-form binary (REG_BINARY) -// 4 A little-endian 32-bit integer (REG_DWORD_LITTLE_ENDIAN) -// 5 A big-endian 32-bit integer (REG_DWORD_BIG_ENDIAN) -// 6 A NULL-terminated Unicode string that contains a symbolic link (REG_LINK) -// 7 Multiple NULL-terminated Unicode strings (REG_MULTI_SZ) -#define USB_OS_PROERTY_TYPE_REG_SZ 0x01UL -#define USB_OS_PROERTY_TYPE_REG_EXPAND_SZ 0x02UL -#define USB_OS_PROERTY_TYPE_REG_BINARY 0x03UL -#define USB_OS_PROERTY_TYPE_REG_DWORD_LITTLE_ENDIAN 0x04UL -#define USB_OS_PROERTY_TYPE_REG_DWORD_BIG_ENDIAN 0x05UL -#define USB_OS_PROERTY_TYPE_REG_LINK 0x06UL -#define USB_OS_PROERTY_TYPE_REG_MULTI_SZ 0x07UL - -#define USB_OS_PROERTY_DESC(PropertyDataType,PropertyName,PropertyData) \ +// Value Description +// 1 A NULL-terminated Unicode String (REG_SZ) +// 2 A NULL-terminated Unicode String that includes environment variables (REG_EXPAND_SZ) +// 3 Free-form binary (REG_BINARY) +// 4 A little-endian 32-bit integer (REG_DWORD_LITTLE_ENDIAN) +// 5 A big-endian 32-bit integer (REG_DWORD_BIG_ENDIAN) +// 6 A NULL-terminated Unicode string that contains a symbolic link (REG_LINK) +// 7 Multiple NULL-terminated Unicode strings (REG_MULTI_SZ) +#define USB_OS_PROPERTY_TYPE_REG_SZ 0x01UL +#define USB_OS_PROPERTY_TYPE_REG_EXPAND_SZ 0x02UL +#define USB_OS_PROPERTY_TYPE_REG_BINARY 0x03UL +#define USB_OS_PROPERTY_TYPE_REG_DWORD_LITTLE_ENDIAN 0x04UL +#define USB_OS_PROPERTY_TYPE_REG_DWORD_BIG_ENDIAN 0x05UL +#define USB_OS_PROPERTY_TYPE_REG_LINK 0x06UL +#define USB_OS_PROPERTY_TYPE_REG_MULTI_SZ 0x07UL + +#define USB_OS_PROPERTY_DESC(PropertyDataType,PropertyName,PropertyData) \ {\ .dwSize = sizeof(struct usb_os_proerty)-sizeof(const char *)*2\ +sizeof(PropertyName)*2+sizeof(PropertyData)*2,\ diff --git a/components/drivers/include/drivers/usb_device.h b/components/drivers/include/drivers/usb_device.h index 26f0c4cf4..1e76477db 100644 --- a/components/drivers/include/drivers/usb_device.h +++ b/components/drivers/include/drivers/usb_device.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -62,12 +62,12 @@ struct ufunction; struct udevice; struct uendpoint; -typedef enum +typedef enum { /* request to read full count */ UIO_REQUEST_READ_FULL, /* request to read any count */ - UIO_REQUEST_READ_BEST, + UIO_REQUEST_READ_BEST, /* request to write full count */ UIO_REQUEST_WRITE, }UIO_REQUEST_TYPE; @@ -85,7 +85,7 @@ struct udcd_ops rt_size_t (*ep_write)(rt_uint8_t address, void *buffer, rt_size_t size); rt_err_t (*ep0_send_status)(void); rt_err_t (*suspend)(void); - rt_err_t (*wakeup)(void); + rt_err_t (*wakeup)(void); }; struct ep_id @@ -215,10 +215,10 @@ enum udev_msg_type USB_MSG_SETUP_NOTIFY, USB_MSG_DATA_NOTIFY, USB_MSG_EP0_OUT, - USB_MSG_EP_CLEAR_FEATURE, + USB_MSG_EP_CLEAR_FEATURE, USB_MSG_SOF, USB_MSG_RESET, - USB_MSG_PLUG_IN, + USB_MSG_PLUG_IN, /* we don't need to add a "PLUG_IN" event because after the cable is * plugged in(before any SETUP) the classed have nothing to do. If the host * is ready, it will send RESET and we will have USB_MSG_RESET. So, a RESET @@ -279,7 +279,7 @@ uintf_t rt_usbd_find_interface(udevice_t device, rt_uint8_t value, ufunction_t * uep_t rt_usbd_find_endpoint(udevice_t device, ufunction_t* pfunc, rt_uint8_t ep_addr); rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req); rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size); -rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size, +rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size, rt_err_t (*rx_ind)(udevice_t device, rt_size_t size)); int rt_usbd_vcom_class_register(void); @@ -396,7 +396,7 @@ rt_inline rt_err_t dcd_ep0_send_status(udcd_t dcd) } rt_inline rt_err_t dcd_ep_set_stall(udcd_t dcd, rt_uint8_t address) -{ +{ RT_ASSERT(dcd != RT_NULL); RT_ASSERT(dcd->ops != RT_NULL); RT_ASSERT(dcd->ops->ep_set_stall != RT_NULL); diff --git a/components/drivers/include/drivers/usb_host.h b/components/drivers/include/drivers/usb_host.h index 2a68f4edb..2031e2cdc 100644 --- a/components/drivers/include/drivers/usb_host.h +++ b/components/drivers/include/drivers/usb_host.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -44,10 +44,10 @@ struct uclass_driver rt_list_t list; int class_code; int subclass_code; - + rt_err_t (*enable)(void* arg); rt_err_t (*disable)(void* arg); - + void* user_data; }; typedef struct uclass_driver* ucd_t; @@ -56,9 +56,9 @@ struct uprotocal { rt_list_t list; int pro_id; - + rt_err_t (*init)(void* arg); - rt_err_t (*callback)(void* arg); + rt_err_t (*callback)(void* arg); }; typedef struct uprotocal* uprotocal_t; @@ -77,13 +77,13 @@ struct uinstance rt_uint8_t status; rt_uint8_t type; rt_uint8_t index; - rt_uint8_t address; + rt_uint8_t address; rt_uint8_t speed; - rt_uint8_t max_packet_size; + rt_uint8_t max_packet_size; rt_uint8_t port; struct uhub* parent_hub; - struct uhintf* intf[USB_MAX_INTERFACE]; + struct uhintf* intf[USB_MAX_INTERFACE]; }; typedef struct uinstance* uinst_t; @@ -113,14 +113,14 @@ struct uhub struct uhub_descriptor hub_desc; rt_uint8_t num_ports; rt_uint32_t port_status[USB_HUB_PORT_NUM]; - struct uinstance* child[USB_HUB_PORT_NUM]; + struct uinstance* child[USB_HUB_PORT_NUM]; rt_bool_t is_roothub; - rt_uint8_t buffer[8]; + rt_uint8_t buffer[8]; struct uinstance* self; struct uhcd *hcd; -}; +}; typedef struct uhub* uhub_t; struct uhcd_ops @@ -128,7 +128,7 @@ struct uhcd_ops rt_err_t (*reset_port) (rt_uint8_t port); int (*pipe_xfer) (upipe_t pipe, rt_uint8_t token, void* buffer, int nbytes, int timeout); rt_err_t (*open_pipe) (upipe_t pipe); - rt_err_t (*close_pipe) (upipe_t pipe); + rt_err_t (*close_pipe) (upipe_t pipe); }; typedef struct uhcd_ops* uhcd_ops_t; struct uhcd @@ -136,7 +136,7 @@ struct uhcd struct rt_device parent; uhcd_ops_t ops; rt_uint8_t num_ports; - uhub_t roothub; + uhub_t roothub; }; typedef struct uhcd* uhcd_t; @@ -149,11 +149,11 @@ typedef enum uhost_msg_type uhost_msg_type; struct uhost_msg { - uhost_msg_type type; + uhost_msg_type type; union { struct uhub* hub; - struct + struct { func_callback function; void *context; @@ -193,14 +193,14 @@ ucd_t rt_usbh_class_driver_storage(void); /* usb hub interface */ -rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer, +rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer, rt_size_t size); rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint32_t* buffer); -rt_err_t rt_usbh_hub_get_port_status(uhub_t uhub, rt_uint16_t port, +rt_err_t rt_usbh_hub_get_port_status(uhub_t uhub, rt_uint16_t port, rt_uint32_t* buffer); -rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port, +rt_err_t rt_usbh_hub_clear_port_feature(uhub_t uhub, rt_uint16_t port, rt_uint16_t feature); -rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port, +rt_err_t rt_usbh_hub_set_port_feature(uhub_t uhub, rt_uint16_t port, rt_uint16_t feature); rt_err_t rt_usbh_hub_reset_port(uhub_t uhub, rt_uint16_t port); rt_err_t rt_usbh_event_signal(struct uhost_msg* msg); diff --git a/components/drivers/include/drivers/watchdog.h b/components/drivers/include/drivers/watchdog.h index f80ded58a..1cf3dc741 100644 --- a/components/drivers/include/drivers/watchdog.h +++ b/components/drivers/include/drivers/watchdog.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/drivers/include/drivers/wlan.h b/components/drivers/include/drivers/wlan.h index 724e61da7..b5b4f7358 100644 --- a/components/drivers/include/drivers/wlan.h +++ b/components/drivers/include/drivers/wlan.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/ipc/completion.h b/components/drivers/include/ipc/completion.h index acfcaa399..087a9be81 100644 --- a/components/drivers/include/ipc/completion.h +++ b/components/drivers/include/ipc/completion.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/ipc/dataqueue.h b/components/drivers/include/ipc/dataqueue.h index f584c267b..5dd94e55c 100644 --- a/components/drivers/include/ipc/dataqueue.h +++ b/components/drivers/include/ipc/dataqueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,17 +17,19 @@ #define RT_DATAQUEUE_EVENT_LWM 0x03 struct rt_data_item; -#define RT_DATAQUEUE_SIZE(dq) ((dq)->put_index - (dq)->get_index) -#define RT_DATAQUEUE_EMPTY(dq) ((dq)->size - RT_DATAQUEUE_SIZE(dq)) + /* data queue implementation */ struct rt_data_queue { + rt_uint32_t magic; + rt_uint16_t size; rt_uint16_t lwm; - rt_bool_t waiting_lwm; - rt_uint16_t get_index; - rt_uint16_t put_index; + rt_uint16_t get_index : 15; + rt_uint16_t is_empty : 1; + rt_uint16_t put_index : 15; + rt_uint16_t is_full : 1; struct rt_data_item *queue; @@ -53,9 +55,11 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size, rt_int32_t timeout); -rt_err_t rt_data_queue_peak(struct rt_data_queue *queue, +rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void **data_ptr, rt_size_t *size); void rt_data_queue_reset(struct rt_data_queue *queue); +rt_err_t rt_data_queue_deinit(struct rt_data_queue *queue); +rt_uint16_t rt_data_queue_len(struct rt_data_queue *queue); #endif diff --git a/components/drivers/include/ipc/pipe.h b/components/drivers/include/ipc/pipe.h index 93ba95cd2..a45e8ae00 100644 --- a/components/drivers/include/ipc/pipe.h +++ b/components/drivers/include/ipc/pipe.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/ipc/poll.h b/components/drivers/include/ipc/poll.h index 8c68a96af..1574215c7 100644 --- a/components/drivers/include/ipc/poll.h +++ b/components/drivers/include/ipc/poll.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/ipc/ringblk_buf.h b/components/drivers/include/ipc/ringblk_buf.h index 94fc2cfff..5b2971b80 100644 --- a/components/drivers/include/ipc/ringblk_buf.h +++ b/components/drivers/include/ipc/ringblk_buf.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/ipc/ringbuffer.h b/components/drivers/include/ipc/ringbuffer.h index 4487d02c4..71c480125 100644 --- a/components/drivers/include/ipc/ringbuffer.h +++ b/components/drivers/include/ipc/ringbuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -71,6 +71,7 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb, const rt_uint8_t *pt rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch); rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch); rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, rt_uint8_t *ptr, rt_uint16_t length); +rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr); rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch); rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb); diff --git a/components/drivers/include/ipc/waitqueue.h b/components/drivers/include/ipc/waitqueue.h index e26ec1e89..fbf5f9314 100644 --- a/components/drivers/include/ipc/waitqueue.h +++ b/components/drivers/include/ipc/waitqueue.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018/06/26 Bernard Fix the wait queue issue when wakeup a soon + * 2018/06/26 Bernard Fix the wait queue issue when wakeup a soon * to blocked thread. */ diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index 23e256c42..25451d7e9 100644 --- a/components/drivers/include/ipc/workqueue.h +++ b/components/drivers/include/ipc/workqueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index 623c08543..782a679b0 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/misc/adc.c b/components/drivers/misc/adc.c index 2d26beb24..d8f79e058 100644 --- a/components/drivers/misc/adc.c +++ b/components/drivers/misc/adc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/misc/pin.c b/components/drivers/misc/pin.c index aca58ee21..0456b909e 100644 --- a/components/drivers/misc/pin.c +++ b/components/drivers/misc/pin.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/misc/pulse_encoder.c b/components/drivers/misc/pulse_encoder.c index 3145c2467..5afb12664 100644 --- a/components/drivers/misc/pulse_encoder.c +++ b/components/drivers/misc/pulse_encoder.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/misc/rt_drv_pwm.c b/components/drivers/misc/rt_drv_pwm.c index 97d38d51b..79fa1c4fb 100644 --- a/components/drivers/misc/rt_drv_pwm.c +++ b/components/drivers/misc/rt_drv_pwm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/misc/rt_inputcapture.c b/components/drivers/misc/rt_inputcapture.c index d1886186d..134bbcee9 100644 --- a/components/drivers/misc/rt_inputcapture.c +++ b/components/drivers/misc/rt_inputcapture.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/mtd/mtd_nand.c b/components/drivers/mtd/mtd_nand.c index ae5aa9c17..646625ade 100644 --- a/components/drivers/mtd/mtd_nand.c +++ b/components/drivers/mtd/mtd_nand.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/mtd/mtd_nor.c b/components/drivers/mtd/mtd_nor.c index b941f9236..0f6eadeb5 100644 --- a/components/drivers/mtd/mtd_nor.c +++ b/components/drivers/mtd/mtd_nor.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -52,7 +52,7 @@ static rt_err_t _mtd_control(rt_device_t dev, int cmd, void *args) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops mtd_nor_ops = +const static struct rt_device_ops mtd_nor_ops = { _mtd_init, _mtd_open, diff --git a/components/drivers/pm/pm.c b/components/drivers/pm/pm.c index dd7cc2ae6..a7dbf42c1 100644 --- a/components/drivers/pm/pm.c +++ b/components/drivers/pm/pm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -46,7 +46,7 @@ static int _pm_device_suspend(rt_uint8_t mode) { ret = _pm.device_pm[index].ops->suspend(_pm.device_pm[index].device, mode); if(ret != RT_EOK) - break; + break; } } diff --git a/components/drivers/rtc/alarm.c b/components/drivers/rtc/alarm.c index c497ebf72..4fa53dba9 100644 --- a/components/drivers/rtc/alarm.c +++ b/components/drivers/rtc/alarm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/rtc/rtc.c b/components/drivers/rtc/rtc.c index e17c0fe7d..3468bcdef 100644 --- a/components/drivers/rtc/rtc.c +++ b/components/drivers/rtc/rtc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -164,7 +164,7 @@ int rt_rtc_ntp_sync_init(void) } init_ok = RT_TRUE; - + return RT_EOK; } INIT_COMPONENT_EXPORT(rt_rtc_ntp_sync_init); diff --git a/components/drivers/rtc/soft_rtc.c b/components/drivers/rtc/soft_rtc.c index adcbf81fe..2d10bc51b 100644 --- a/components/drivers/rtc/soft_rtc.c +++ b/components/drivers/rtc/soft_rtc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -55,7 +55,7 @@ static rt_err_t soft_rtc_control(rt_device_t dev, int cmd, void *args) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops soft_rtc_ops = +const static struct rt_device_ops soft_rtc_ops = { RT_NULL, RT_NULL, diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c index 5db0f38c0..f2ce09a83 100644 --- a/components/drivers/sdio/block_dev.c +++ b/components/drivers/sdio/block_dev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -76,7 +76,7 @@ rt_int32_t mmcsd_num_wr_blocks(struct rt_mmcsd_card *card) timeout_us += data.timeout_clks * 1000 / (card->host->io_cfg.clock / 1000); - if (timeout_us > 100000) + if (timeout_us > 100000) { data.timeout_ns = 100000000; data.timeout_clks = 0; @@ -119,9 +119,9 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, rt_memset(&data, 0, sizeof(struct rt_mmcsd_data)); req.cmd = &cmd; req.data = &data; - + cmd.arg = sector; - if (!(card->flags & CARD_FLAG_SDHC)) + if (!(card->flags & CARD_FLAG_SDHC)) { cmd.arg <<= 9; } @@ -130,7 +130,7 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, data.blksize = SECTOR_SIZE; data.blks = blks; - if (blks > 1) + if (blks > 1) { if (!controller_is_spi(card->host) || !dir) { @@ -149,7 +149,7 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, w_cmd = WRITE_BLOCK; } - if (!dir) + if (!dir) { cmd.cmd_code = r_cmd; data.flags |= DATA_DIR_READ; @@ -164,9 +164,9 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, data.buf = buf; mmcsd_send_request(host, &req); - if (!controller_is_spi(card->host) && dir != 0) + if (!controller_is_spi(card->host) && dir != 0) { - do + do { rt_int32_t err; @@ -174,7 +174,7 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, cmd.arg = card->rca << 16; cmd.flags = RESP_R1 | CMD_AC; err = mmcsd_send_cmd(card->host, &cmd, 5); - if (err) + if (err) { LOG_E("error %d requesting status", err); break; @@ -190,7 +190,7 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card, mmcsd_host_unlock(host); - if (cmd.err || data.err || stop.err) + if (cmd.err || data.err || stop.err) { LOG_E("mmcsd request blocks error"); LOG_E("%d,%d,%d, 0x%08x,0x%08x", @@ -264,7 +264,7 @@ static rt_size_t rt_mmcsd_read(rt_device_t dev, rt_sem_release(part->lock); /* the length of reading must align to SECTOR SIZE */ - if (err) + if (err) { rt_set_errno(-EIO); return 0; @@ -305,7 +305,7 @@ static rt_size_t rt_mmcsd_write(rt_device_t dev, rt_sem_release(part->lock); /* the length of reading must align to SECTOR SIZE */ - if (err) + if (err) { rt_set_errno(-EIO); @@ -330,7 +330,7 @@ static rt_int32_t mmcsd_set_blksize(struct rt_mmcsd_card *card) err = mmcsd_send_cmd(card->host, &cmd, 5); mmcsd_host_unlock(card->host); - if (err) + if (err) { LOG_E("MMCSD: unable to set block size to %d: %d", cmd.arg, err); @@ -341,7 +341,7 @@ static rt_int32_t mmcsd_set_blksize(struct rt_mmcsd_card *card) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops mmcsd_blk_ops = +const static struct rt_device_ops mmcsd_blk_ops = { rt_mmcsd_init, rt_mmcsd_open, @@ -362,7 +362,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) struct mmcsd_blk_device *blk_dev = RT_NULL; err = mmcsd_set_blksize(card); - if(err) + if(err) { return err; } @@ -384,15 +384,15 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) for (i = 0; i < RT_MMCSD_MAX_PARTITION; i++) { blk_dev = rt_calloc(1, sizeof(struct mmcsd_blk_device)); - if (!blk_dev) + if (!blk_dev) { LOG_E("mmcsd:malloc memory failed!"); break; } - blk_dev->max_req_size = BLK_MIN((card->host->max_dma_segs * - card->host->max_seg_size) >> 9, - (card->host->max_blk_count * + blk_dev->max_req_size = BLK_MIN((card->host->max_dma_segs * + card->host->max_seg_size) >> 9, + (card->host->max_blk_count * card->host->max_blk_size) >> 9); /* get the first partition */ @@ -402,7 +402,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) rt_snprintf(dname, 4, "sd%d", i); rt_snprintf(sname, 8, "sem_sd%d", i); blk_dev->part.lock = rt_sem_create(sname, 1, RT_IPC_FLAG_FIFO); - + /* register mmcsd device */ blk_dev->dev.type = RT_Device_Class_Block; #ifdef RT_USING_DEVICE_OPS @@ -418,11 +418,11 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) blk_dev->dev.user_data = blk_dev; blk_dev->card = card; - + blk_dev->geometry.bytes_per_sector = 1<<9; blk_dev->geometry.block_size = card->card_blksize; blk_dev->geometry.sector_count = blk_dev->part.size; - + rt_device_register(&blk_dev->dev, dname, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); rt_list_insert_after(&blk_devices, &blk_dev->list); @@ -435,7 +435,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) blk_dev->part.offset = 0; blk_dev->part.size = 0; blk_dev->part.lock = rt_sem_create("sem_sd0", 1, RT_IPC_FLAG_FIFO); - + /* register mmcsd device */ blk_dev->dev.type = RT_Device_Class_Block; #ifdef RT_USING_DEVICE_OPS @@ -454,14 +454,12 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) blk_dev->geometry.bytes_per_sector = 1<<9; blk_dev->geometry.block_size = card->card_blksize; - blk_dev->geometry.sector_count = + blk_dev->geometry.sector_count = card->card_capacity * (1024 / 512); - + rt_device_register(&blk_dev->dev, "sd0", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_REMOVABLE | RT_DEVICE_FLAG_STANDALONE); rt_list_insert_after(&blk_devices, &blk_dev->list); - - break; } else { @@ -474,9 +472,9 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) #ifdef RT_USING_DFS_MNTTABLE if (blk_dev) { - LOG_I("try to mount file system!"); - /* try to mount file system on this block device */ - dfs_mount_device(&(blk_dev->dev)); + LOG_I("try to mount file system!"); + /* try to mount file system on this block device */ + dfs_mount_device(&(blk_dev->dev)); } #endif } @@ -486,10 +484,10 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card) LOG_E("read mmcsd first sector failed"); err = -RT_ERROR; } - + /* release sector buffer */ rt_free(sector); - + return err; } @@ -501,15 +499,15 @@ void rt_mmcsd_blk_remove(struct rt_mmcsd_card *card) for (l = (&blk_devices)->next, n = l->next; l != &blk_devices; l = n) { blk_dev = (struct mmcsd_blk_device *)rt_list_entry(l, struct mmcsd_blk_device, list); - if (blk_dev->card == card) + if (blk_dev->card == card) { - /* unmount file system */ - const char * mounted_path = dfs_filesystem_get_mounted_path(&(blk_dev->dev)); - if (mounted_path) - { + /* unmount file system */ + const char * mounted_path = dfs_filesystem_get_mounted_path(&(blk_dev->dev)); + if (mounted_path) + { dfs_unmount(mounted_path); LOG_D("unmount file system %s for device %s.\r\n", mounted_path, blk_dev->dev.parent.name); - } + } rt_sem_delete(blk_dev->part.lock); rt_device_unregister(&blk_dev->dev); rt_list_remove(&blk_dev->list); diff --git a/components/drivers/sdio/mmc.c b/components/drivers/sdio/mmc.c index 7b1f7ee19..5aba3dba7 100644 --- a/components/drivers/sdio/mmc.c +++ b/components/drivers/sdio/mmc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -45,9 +45,9 @@ static const rt_uint8_t tacc_value[] = rt_inline rt_uint32_t GET_BITS(rt_uint32_t *resp, rt_uint32_t start, rt_uint32_t size) -{ +{ const rt_int32_t __size = size; - const rt_uint32_t __mask = (__size < 32 ? 1 << __size : 0) - 1; + const rt_uint32_t __mask = (__size < 32 ? 1 << __size : 0) - 1; const rt_int32_t __off = 3 - ((start) / 32); const rt_int32_t __shft = (start) & 31; rt_uint32_t __res; @@ -67,7 +67,7 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) rt_uint32_t a, b; struct rt_mmcsd_csd *csd = &card->csd; rt_uint32_t *resp = card->resp_csd; - + /* * We only understand CSD structure v1.1 and v1.2. * v1.2 has extra information in bits 15, 11 and 10. @@ -76,10 +76,10 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) csd->csd_structure = GET_BITS(resp, 126, 2); if (csd->csd_structure == 0) { LOG_E("unrecognised CSD structure version %d!", csd->csd_structure); - + return -RT_ERROR; } - + csd->taac = GET_BITS(resp, 112, 8); csd->nsac = GET_BITS(resp, 104, 8); csd->tran_speed = GET_BITS(resp, 96, 8); @@ -95,7 +95,7 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) csd->wr_blk_len = GET_BITS(resp, 22, 4); csd->wr_blk_partial = GET_BITS(resp, 21, 1); csd->csd_crc = GET_BITS(resp, 1, 7); - + card->card_blksize = 1 << csd->rd_blk_len; card->tacc_clks = csd->nsac * 100; card->tacc_ns = (tacc_uint[csd->taac&0x07] * tacc_value[(csd->taac&0x78)>>3] + 9) / 10; @@ -106,7 +106,7 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) card->erase_size = (a + 1) * (b + 1); card->erase_size <<= csd->wr_blk_len - 9; } - + return 0; } @@ -119,12 +119,12 @@ static int mmc_get_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t **new_ext_csd) struct rt_mmcsd_req req; struct rt_mmcsd_cmd cmd; struct rt_mmcsd_data data; - + *new_ext_csd = RT_NULL; - + if (GET_BITS(card->resp_cid, 122, 4) < 4) return 0; - + /* * As the ext_csd is so large and mostly unused, we don't store the * raw block in mmc_card. @@ -134,29 +134,29 @@ static int mmc_get_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t **new_ext_csd) LOG_E("alloc memory failed when get ext csd!"); return -RT_ENOMEM; } - + rt_memset(&req, 0, sizeof(struct rt_mmcsd_req)); rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); rt_memset(&data, 0, sizeof(struct rt_mmcsd_data)); - + req.cmd = &cmd; req.data = &data; - + cmd.cmd_code = SEND_EXT_CSD; cmd.arg = 0; - + /* NOTE HACK: the RESP_SPI_R1 is always correct here, but we * rely on callers to never use this with "native" calls for reading * CSD or CID. Native versions of those commands use the R2 type, * not R1 plus a data block. */ cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_ADTC; - + data.blksize = 512; data.blks = 1; data.flags = DATA_DIR_READ; data.buf = ext_csd; - + /* * Some cards require longer data read timeout than indicated in CSD. * Address this by setting the read timeout to a "reasonably high" @@ -165,14 +165,14 @@ static int mmc_get_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t **new_ext_csd) */ data.timeout_ns = 300000000; data.timeout_clks = 0; - + mmcsd_send_request(card->host, &req); - + if (cmd.err) return cmd.err; if (data.err) return data.err; - + *new_ext_csd = ext_csd; return 0; } @@ -191,14 +191,14 @@ static int mmc_parse_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) } card->flags |= CARD_FLAG_HIGHSPEED; - card->hs_max_data_rate = 200000000; - + card->hs_max_data_rate = 52000000; + card_capacity = *((rt_uint32_t *)&ext_csd[EXT_CSD_SEC_CNT]); card_capacity *= card->card_blksize; card_capacity >>= 10; /* unit:KB */ card->card_capacity = card_capacity; LOG_I("emmc card capacity %d KB.", card->card_capacity); - + return 0; } @@ -211,41 +211,41 @@ static int mmc_parse_ext_csd(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) * * Modifies the EXT_CSD register for selected card. */ -static int mmc_switch(struct rt_mmcsd_card *card, rt_uint8_t set, +static int mmc_switch(struct rt_mmcsd_card *card, rt_uint8_t set, rt_uint8_t index, rt_uint8_t value) { int err; struct rt_mmcsd_host *host = card->host; struct rt_mmcsd_cmd cmd = {0}; - + cmd.cmd_code = SWITCH; cmd.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) | (index << 16) | (value << 8) | set; cmd.flags = RESP_SPI_R1 | RESP_R1 | CMD_AC; - + err = mmcsd_send_cmd(host, &cmd, 3); if (err) return err; - + return 0; } -static int mmc_compare_ext_csds(struct rt_mmcsd_card *card, +static int mmc_compare_ext_csds(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd, rt_uint32_t bus_width) { rt_uint8_t *bw_ext_csd; int err; - + if (bus_width == MMCSD_BUS_WIDTH_1) return 0; - + err = mmc_get_ext_csd(card, &bw_ext_csd); - + if (err || bw_ext_csd == RT_NULL) { err = -RT_ERROR; goto out; } - + /* only compare read only fields */ err = !((ext_csd[EXT_CSD_PARTITION_SUPPORT] == bw_ext_csd[EXT_CSD_PARTITION_SUPPORT]) && (ext_csd[EXT_CSD_ERASED_MEM_CONT] == bw_ext_csd[EXT_CSD_ERASED_MEM_CONT]) && @@ -273,10 +273,10 @@ static int mmc_compare_ext_csds(struct rt_mmcsd_card *card, (ext_csd[EXT_CSD_PWR_CL_DDR_52_195] == bw_ext_csd[EXT_CSD_PWR_CL_DDR_52_195]) && (ext_csd[EXT_CSD_PWR_CL_DDR_52_360] == bw_ext_csd[EXT_CSD_PWR_CL_DDR_52_360]) && (ext_csd[EXT_CSD_PWR_CL_DDR_200_360] == bw_ext_csd[EXT_CSD_PWR_CL_DDR_200_360])); - + if (err) err = -RT_ERROR; - + out: rt_free(bw_ext_csd); return err; @@ -302,10 +302,10 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) struct rt_mmcsd_host *host = card->host; unsigned idx, bus_width = 0; int err = 0; - + if (GET_BITS(card->resp_cid, 122, 4) < 4) return 0; - + /* * Unlike SD, MMC cards dont have a configuration register to notify * supported bus width. So bus test command should be run to identify @@ -318,14 +318,23 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) * the device to work in 8bit transfer mode. If the * mmc switch command returns error then switch to * 4bit transfer mode. On success set the corresponding - * bus width on the host. + * bus width on the host. Meanwhile, mmc core would + * bail out early if corresponding bus capable wasn't + * set by drivers. */ + if ((!(host->flags & MMCSD_BUSWIDTH_8) && + ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8) || + (!(host->flags & MMCSD_BUSWIDTH_4) && + (ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_4 || + ext_csd_bits[idx] == EXT_CSD_BUS_WIDTH_8))) + continue; + err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_BUS_WIDTH, ext_csd_bits[idx]); if (err) continue; - + bus_width = bus_widths[idx]; mmcsd_set_bus_width(host, bus_width); mmcsd_delay_ms(20); //delay 10ms @@ -349,10 +358,10 @@ static int mmc_select_bus_width(struct rt_mmcsd_card *card, rt_uint8_t *ext_csd) } } } - + return err; } -rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host, +rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host, rt_uint32_t ocr, rt_uint32_t *rocr) { struct rt_mmcsd_cmd cmd; @@ -360,20 +369,20 @@ rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host, rt_err_t err = RT_EOK; rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); - + cmd.cmd_code = SEND_OP_COND; cmd.arg = controller_is_spi(host) ? 0 : ocr; cmd.flags = RESP_SPI_R1 | RESP_R3 | CMD_BCR; - + for (i = 100; i; i--) { err = mmcsd_send_cmd(host, &cmd, 3); if (err) break; - + /* if we're just probing, do a single pass */ if (ocr == 0) break; - + /* otherwise wait until reset completes */ if (controller_is_spi(host)) { if (!(cmd.resp[0] & R1_SPI_IDLE)) @@ -382,15 +391,15 @@ rt_err_t mmc_send_op_cond(struct rt_mmcsd_host *host, if (cmd.resp[0] & CARD_BUSY) break; } - + err = -RT_ETIMEOUT; - + mmcsd_delay_ms(10); //delay 10ms } - + if (rocr && !controller_is_spi(host)) *rocr = cmd.resp[0]; - + return err; } @@ -398,17 +407,17 @@ static rt_err_t mmc_set_card_addr(struct rt_mmcsd_host *host, rt_uint32_t rca) { rt_err_t err; struct rt_mmcsd_cmd cmd; - + rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); - + cmd.cmd_code = SET_RELATIVE_ADDR; cmd.arg = rca << 16; cmd.flags = RESP_R1 | CMD_AC; - + err = mmcsd_send_cmd(host, &cmd, 3); if (err) return err; - + return 0; } @@ -423,19 +432,19 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, struct rt_mmcsd_card *card = RT_NULL; mmcsd_go_idle(host); - + /* The extra bit indicates that we support high capacity */ err = mmc_send_op_cond(host, ocr | (1 << 30), &rocr); if (err) goto err; - - if (controller_is_spi(host)) + + if (controller_is_spi(host)) { err = mmcsd_spi_use_crc(host, 1); if (err) goto err1; } - + if (controller_is_spi(host)) err = mmcsd_get_cid(host, resp); else @@ -444,7 +453,7 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, goto err; card = rt_malloc(sizeof(struct rt_mmcsd_card)); - if (!card) + if (!card) { LOG_E("malloc card failed!"); err = -RT_ENOMEM; @@ -460,7 +469,7 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, /* * For native busses: get card RCA and quit open drain mode. */ - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmc_set_card_addr(host, card->rca); if (err) @@ -477,24 +486,24 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, if (err) goto err1; - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmcsd_select_card(card); if (err) goto err1; } - + /* * Fetch and process extended CSD. */ - + err = mmc_get_ext_csd(card, &ext_csd); if (err) goto err1; err = mmc_parse_ext_csd(card, ext_csd); if (err) goto err1; - + /* If doing byte addressing, check if required to do sector * addressing. Handle the case of <2GB cards needing sector * addressing. See section 8.1 JEDEC Standard JED84-A441; @@ -502,24 +511,18 @@ static rt_int32_t mmcsd_mmc_init_card(struct rt_mmcsd_host *host, */ if (!(card->flags & CARD_FLAG_SDHC) && (rocr & (1<<30))) card->flags |= CARD_FLAG_SDHC; - + /* set bus speed */ - max_data_rate = (unsigned int)-1; - if (card->flags & CARD_FLAG_HIGHSPEED) - { - if (max_data_rate > card->hs_max_data_rate) - max_data_rate = card->hs_max_data_rate; - } - else if (max_data_rate > card->max_data_rate) - { + if (card->flags & CARD_FLAG_HIGHSPEED) + max_data_rate = card->hs_max_data_rate; + else max_data_rate = card->max_data_rate; - } mmcsd_set_clock(host, max_data_rate); /*switch bus width*/ mmc_select_bus_width(card, ext_csd); - + host->card = card; rt_free(ext_csd); diff --git a/components/drivers/sdio/mmcsd_core.c b/components/drivers/sdio/mmcsd_core.c index 8131a3313..09481d403 100644 --- a/components/drivers/sdio/mmcsd_core.c +++ b/components/drivers/sdio/mmcsd_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -63,7 +63,7 @@ void mmcsd_send_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) req->cmd->err = 0; req->cmd->mrq = req; if (req->data) - { + { req->cmd->data = req->data; req->data->err = 0; req->data->mrq = req; @@ -72,12 +72,12 @@ void mmcsd_send_request(struct rt_mmcsd_host *host, struct rt_mmcsd_req *req) req->data->stop = req->stop; req->stop->err = 0; req->stop->mrq = req; - } + } } host->ops->request(host, req); rt_sem_take(&host->sem_ack, RT_WAITING_FOREVER); - + } while(req->cmd->err && (req->cmd->retries > 0)); @@ -122,7 +122,7 @@ rt_int32_t mmcsd_go_idle(struct rt_mmcsd_host *host) mmcsd_delay_ms(1); - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { mmcsd_set_chip_select(host, MMCSD_CS_IGNORE); mmcsd_delay_ms(1); @@ -179,7 +179,7 @@ rt_int32_t mmcsd_get_cid(struct rt_mmcsd_host *host, rt_uint32_t *cid) struct rt_mmcsd_data data; rt_uint32_t *buf = RT_NULL; - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { if (!host->card) return -RT_ERROR; @@ -198,7 +198,7 @@ rt_int32_t mmcsd_get_cid(struct rt_mmcsd_host *host, rt_uint32_t *cid) } buf = (rt_uint32_t *)rt_malloc(16); - if (!buf) + if (!buf) { LOG_E("allocate memory failed!"); @@ -274,7 +274,7 @@ rt_int32_t mmcsd_get_csd(struct rt_mmcsd_card *card, rt_uint32_t *csd) } buf = (rt_uint32_t*)rt_malloc(16); - if (!buf) + if (!buf) { LOG_E("allocate memory failed!"); @@ -336,12 +336,12 @@ static rt_int32_t _mmcsd_select_card(struct rt_mmcsd_host *host, cmd.cmd_code = SELECT_CARD; - if (card) + if (card) { cmd.arg = card->rca << 16; cmd.flags = RESP_R1 | CMD_AC; - } - else + } + else { cmd.arg = 0; cmd.flags = RESP_NONE | CMD_AC; @@ -442,7 +442,7 @@ void mmcsd_set_data_timeout(struct rt_mmcsd_data *data, { rt_uint32_t mult; - if (card->card_type == CARD_TYPE_SDIO) + if (card->card_type == CARD_TYPE_SDIO) { data->timeout_ns = 1000000000; /* SDIO card 1s */ data->timeout_clks = 0; @@ -468,7 +468,7 @@ void mmcsd_set_data_timeout(struct rt_mmcsd_data *data, /* * SD cards also have an upper limit on the timeout. */ - if (card->card_type == CARD_TYPE_SD) + if (card->card_type == CARD_TYPE_SD) { rt_uint32_t timeout_us, limit_us; @@ -488,21 +488,21 @@ void mmcsd_set_data_timeout(struct rt_mmcsd_data *data, /* * SDHC cards always use these fixed values. */ - if (timeout_us > limit_us || card->flags & CARD_FLAG_SDHC) + if (timeout_us > limit_us || card->flags & CARD_FLAG_SDHC) { data->timeout_ns = limit_us * 1000; /* SDHC card fixed 250ms */ data->timeout_clks = 0; } } - if (controller_is_spi(card->host)) + if (controller_is_spi(card->host)) { - if (data->flags & DATA_DIR_WRITE) + if (data->flags & DATA_DIR_WRITE) { if (data->timeout_ns < 1000000000) data->timeout_ns = 1000000000; /* 1s */ - } - else + } + else { if (data->timeout_ns < 100000000) data->timeout_ns = 100000000; /* 100ms */ @@ -522,7 +522,7 @@ rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr) ocr &= host->valid_ocr; bit = __rt_ffs(ocr); - if (bit) + if (bit) { bit -= 1; @@ -530,8 +530,8 @@ rt_uint32_t mmcsd_select_voltage(struct rt_mmcsd_host *host, rt_uint32_t ocr) host->io_cfg.vdd = bit; mmcsd_set_iocfg(host); - } - else + } + else { LOG_W("host doesn't support card's voltages!"); ocr = 0; @@ -549,7 +549,7 @@ static void mmcsd_power_up(struct rt_mmcsd_host *host) { host->io_cfg.chip_select = MMCSD_CS_HIGH; host->io_cfg.bus_mode = MMCSD_BUSMODE_PUSHPULL; - } + } else { host->io_cfg.chip_select = MMCSD_CS_IGNORE; @@ -580,7 +580,7 @@ static void mmcsd_power_off(struct rt_mmcsd_host *host) { host->io_cfg.clock = 0; host->io_cfg.vdd = 0; - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { host->io_cfg.bus_mode = MMCSD_BUSMODE_OPENDRAIN; host->io_cfg.chip_select = MMCSD_CS_IGNORE; @@ -619,7 +619,7 @@ void mmcsd_detect(void *param) rt_uint32_t ocr; rt_int32_t err; - while (1) + while (1) { if (rt_mb_recv(&mmcsd_detect_mb, (rt_ubase_t *)&host, RT_WAITING_FOREVER) == RT_EOK) { @@ -644,7 +644,7 @@ void mmcsd_detect(void *param) * detect SD card */ err = mmcsd_send_app_op_cond(host, 0, &ocr); - if (!err) + if (!err) { if (init_sd(host, ocr)) mmcsd_power_off(host); @@ -652,12 +652,12 @@ void mmcsd_detect(void *param) rt_mb_send(&mmcsd_hotpluge_mb, (rt_uint32_t)host); continue; } - + /* * detect mmc card */ err = mmc_send_op_cond(host, 0, &ocr); - if (!err) + if (!err) { if (init_mmc(host, ocr)) mmcsd_power_off(host); @@ -669,21 +669,21 @@ void mmcsd_detect(void *param) } else { - /* card removed */ - mmcsd_host_lock(host); - if (host->card->sdio_function_num != 0) - { - LOG_W("unsupport sdio card plug out!"); - } - else - { - rt_mmcsd_blk_remove(host->card); - rt_free(host->card); - - host->card = RT_NULL; - } - mmcsd_host_unlock(host); - rt_mb_send(&mmcsd_hotpluge_mb, (rt_uint32_t)host); + /* card removed */ + mmcsd_host_lock(host); + if (host->card->sdio_function_num != 0) + { + LOG_W("unsupport sdio card plug out!"); + } + else + { + rt_mmcsd_blk_remove(host->card); + rt_free(host->card); + + host->card = RT_NULL; + } + mmcsd_host_unlock(host); + rt_mb_send(&mmcsd_hotpluge_mb, (rt_uint32_t)host); } } } @@ -694,7 +694,7 @@ struct rt_mmcsd_host *mmcsd_alloc_host(void) struct rt_mmcsd_host *host; host = rt_malloc(sizeof(struct rt_mmcsd_host)); - if (!host) + if (!host) { LOG_E("alloc host failed"); @@ -736,16 +736,16 @@ int rt_mmcsd_core_init(void) &mmcsd_hotpluge_mb_pool[0], sizeof(mmcsd_hotpluge_mb_pool) / sizeof(mmcsd_hotpluge_mb_pool[0]), RT_IPC_FLAG_FIFO); RT_ASSERT(ret == RT_EOK); - ret = rt_thread_init(&mmcsd_detect_thread, "mmcsd_detect", mmcsd_detect, RT_NULL, + ret = rt_thread_init(&mmcsd_detect_thread, "mmcsd_detect", mmcsd_detect, RT_NULL, &mmcsd_stack[0], RT_MMCSD_STACK_SIZE, RT_MMCSD_THREAD_PREORITY, 20); - if (ret == RT_EOK) + if (ret == RT_EOK) { rt_thread_startup(&mmcsd_detect_thread); } rt_sdio_init(); - return 0; + return 0; } INIT_PREV_EXPORT(rt_mmcsd_core_init); diff --git a/components/drivers/sdio/sd.c b/components/drivers/sdio/sd.c index 183eba169..d739ee4ea 100644 --- a/components/drivers/sdio/sd.c +++ b/components/drivers/sdio/sd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -45,9 +45,9 @@ static const rt_uint8_t tacc_value[] = rt_inline rt_uint32_t GET_BITS(rt_uint32_t *resp, rt_uint32_t start, rt_uint32_t size) -{ +{ const rt_int32_t __size = size; - const rt_uint32_t __mask = (__size < 32 ? 1 << __size : 0) - 1; + const rt_uint32_t __mask = (__size < 32 ? 1 << __size : 0) - 1; const rt_int32_t __off = 3 - ((start) / 32); const rt_int32_t __shft = (start) & 31; rt_uint32_t __res; @@ -93,30 +93,11 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) card->tacc_ns = (tacc_uint[csd->taac&0x07] * tacc_value[(csd->taac&0x78)>>3] + 9) / 10; card->max_data_rate = tran_unit[csd->tran_speed&0x07] * tran_value[(csd->tran_speed&0x78)>>3]; - #if 0 - val = GET_BITS(resp, 115, 4); - unit = GET_BITS(resp, 112, 3); - csd->tacc_ns = (tacc_uint[unit] * tacc_value[val] + 9) / 10; - csd->tacc_clks = GET_BITS(resp, 104, 8) * 100; - - val = GET_BITS(resp, 99, 4); - unit = GET_BITS(resp, 96, 3); - csd->max_data_rate = tran_unit[unit] * tran_value[val]; - csd->ccc = GET_BITS(resp, 84, 12); - - unit = GET_BITS(resp, 47, 3); - val = GET_BITS(resp, 62, 12); - csd->device_size = (1 + val) << (unit + 2); - - csd->read_bl_len = GET_BITS(resp, 80, 4); - csd->write_bl_len = GET_BITS(resp, 22, 4); - csd->r2w_factor = GET_BITS(resp, 26, 3); - #endif break; case 1: card->flags |= CARD_FLAG_SDHC; - /*This field is fixed to 0Eh, which indicates 1 ms. + /*This field is fixed to 0Eh, which indicates 1 ms. The host should not use TAAC, NSAC, and R2W_FACTOR to calculate timeout and should uses fixed timeout values for read and write operations*/ @@ -142,23 +123,6 @@ static rt_int32_t mmcsd_parse_csd(struct rt_mmcsd_card *card) card->tacc_ns = 0; card->max_data_rate = tran_unit[csd->tran_speed&0x07] * tran_value[(csd->tran_speed&0x78)>>3]; - #if 0 - csd->tacc_ns = 0; - csd->tacc_clks = 0; - - val = GET_BITS(resp, 99, 4); - unit = GET_BITS(resp, 96, 3); - csd->max_data_rate = tran_unit[unit] * tran_value[val]; - csd->ccc = GET_BITS(resp, 84, 12); - - val = GET_BITS(resp, 48, 22); - csd->device_size = (1 + val) << 10; - - csd->read_bl_len = 9; - csd->write_bl_len = 9; - /* host should not use this factor and should use 250ms for write timeout */ - csd->r2w_factor = 2; - #endif break; default: LOG_E("unrecognised CSD structure version %d!", csd->csd_structure); @@ -193,13 +157,13 @@ static rt_int32_t mmcsd_switch(struct rt_mmcsd_card *card) rt_uint8_t *buf; buf = (rt_uint8_t*)rt_malloc(64); - if (!buf) + if (!buf) { LOG_E("alloc memory failed!"); return -RT_ENOMEM; } - + if (card->card_type != CARD_TYPE_SD) goto err; if (card->scr.sd_version < SCR_SPEC_VER_1) @@ -227,7 +191,7 @@ static rt_int32_t mmcsd_switch(struct rt_mmcsd_card *card) mmcsd_send_request(host, &req); - if (cmd.err || data.err) + if (cmd.err || data.err) { goto err1; } @@ -257,12 +221,12 @@ static rt_int32_t mmcsd_switch(struct rt_mmcsd_card *card) mmcsd_send_request(host, &req); - if (cmd.err || data.err) + if (cmd.err || data.err) { goto err1; } - if ((buf[16] & 0xF) != 1) + if ((buf[16] & 0xF) != 1) { LOG_I("switching card to high speed failed!"); goto err; @@ -291,12 +255,12 @@ static rt_err_t mmcsd_app_cmd(struct rt_mmcsd_host *host, cmd.cmd_code = APP_CMD; - if (card) + if (card) { cmd.arg = card->rca << 16; cmd.flags = RESP_R1 | CMD_AC; - } - else + } + else { cmd.arg = 0; cmd.flags = RESP_R1 | CMD_BCR; @@ -321,7 +285,7 @@ rt_err_t mmcsd_send_app_cmd(struct rt_mmcsd_host *host, { struct rt_mmcsd_req req; - rt_uint32_t i; + rt_uint32_t i; rt_err_t err; err = -RT_ERROR; @@ -330,15 +294,15 @@ rt_err_t mmcsd_send_app_cmd(struct rt_mmcsd_host *host, * We have to resend MMC_APP_CMD for each attempt so * we cannot use the retries field in mmc_command. */ - for (i = 0;i <= retry;i++) + for (i = 0;i <= retry;i++) { rt_memset(&req, 0, sizeof(struct rt_mmcsd_req)); err = mmcsd_app_cmd(host, card); - if (err) + if (err) { /* no point in retrying; no APP commands allowed */ - if (controller_is_spi(host)) + if (controller_is_spi(host)) { if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) break; @@ -360,7 +324,7 @@ rt_err_t mmcsd_send_app_cmd(struct rt_mmcsd_host *host, break; /* no point in retrying illegal APP commands */ - if (controller_is_spi(host)) + if (controller_is_spi(host)) { if (cmd->resp[0] & R1_SPI_ILLEGAL_COMMAND) break; @@ -380,7 +344,7 @@ rt_err_t mmcsd_app_set_bus_width(struct rt_mmcsd_card *card, rt_int32_t width) cmd.cmd_code = SD_APP_SET_BUS_WIDTH; cmd.flags = RESP_R1 | CMD_AC; - switch (width) + switch (width) { case MMCSD_BUS_WIDTH_1: cmd.arg = MMCSD_BUS_WIDTH_1; @@ -416,7 +380,7 @@ rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host, cmd.arg = ocr; cmd.flags = RESP_SPI_R1 | RESP_R3 | CMD_BCR; - for (i = 100; i; i--) + for (i = 100; i; i--) { err = mmcsd_send_app_cmd(host, RT_NULL, &cmd, 3); if (err) @@ -427,12 +391,12 @@ rt_err_t mmcsd_send_app_op_cond(struct rt_mmcsd_host *host, break; /* otherwise wait until reset completes */ - if (controller_is_spi(host)) + if (controller_is_spi(host)) { if (!(cmd.resp[0] & R1_SPI_IDLE)) break; - } - else + } + else { if (cmd.resp[0] & CARD_BUSY) break; @@ -580,7 +544,7 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, goto err; card = rt_malloc(sizeof(struct rt_mmcsd_card)); - if (!card) + if (!card) { LOG_E("malloc card failed!"); err = -RT_ENOMEM; @@ -595,7 +559,7 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, /* * For native busses: get card RCA and quit open drain mode. */ - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmcsd_get_card_addr(host, &card->rca); if (err) @@ -612,7 +576,7 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, if (err) goto err1; - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmcsd_select_card(card); if (err) @@ -625,7 +589,7 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, mmcsd_parse_scr(card); - if (controller_is_spi(host)) + if (controller_is_spi(host)) { err = mmcsd_spi_use_crc(host, 1); if (err) @@ -642,12 +606,12 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, /* set bus speed */ max_data_rate = (unsigned int)-1; - if (card->flags & CARD_FLAG_HIGHSPEED) + if (card->flags & CARD_FLAG_HIGHSPEED) { if (max_data_rate > card->hs_max_data_rate) max_data_rate = card->hs_max_data_rate; - } - else if (max_data_rate > card->max_data_rate) + } + else if (max_data_rate > card->max_data_rate) { max_data_rate = card->max_data_rate; } @@ -656,7 +620,7 @@ static rt_int32_t mmcsd_sd_init_card(struct rt_mmcsd_host *host, /*switch bus width*/ if ((host->flags & MMCSD_BUSWIDTH_4) && - (card->scr.sd_bus_widths & SD_SCR_BUS_WIDTH_4)) + (card->scr.sd_bus_widths & SD_SCR_BUS_WIDTH_4)) { err = mmcsd_app_set_bus_width(card, MMCSD_BUS_WIDTH_4); if (err) diff --git a/components/drivers/sdio/sdio.c b/components/drivers/sdio/sdio.c index 65bf87b89..adad68cf6 100644 --- a/components/drivers/sdio/sdio.c +++ b/components/drivers/sdio/sdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -73,7 +73,7 @@ rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host, cmd.arg = ocr; cmd.flags = RESP_SPI_R4 | RESP_R4 | CMD_BCR; - for (i = 100; i; i--) + for (i = 100; i; i--) { err = mmcsd_send_cmd(host, &cmd, 0); if (err) @@ -84,7 +84,7 @@ rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host, break; /* otherwise wait until reset completes */ - if (controller_is_spi(host)) + if (controller_is_spi(host)) { /* * Both R1_SPI_IDLE and MMC_CARD_BUSY indicate @@ -94,8 +94,8 @@ rt_int32_t sdio_io_send_op_cond(struct rt_mmcsd_host *host, */ if (cmd.resp[1] & CARD_BUSY) break; - } - else + } + else { if (cmd.resp[0] & CARD_BUSY) break; @@ -143,7 +143,7 @@ rt_int32_t sdio_io_rw_direct(struct rt_mmcsd_card *card, if (err) return err; - if (!controller_is_spi(card->host)) + if (!controller_is_spi(card->host)) { if (cmd.resp[0] & R5_ERROR) return -RT_EIO; @@ -153,7 +153,7 @@ rt_int32_t sdio_io_rw_direct(struct rt_mmcsd_card *card, return -RT_ERROR; } - if (!rw || raw) + if (!rw || raw) { if (controller_is_spi(card->host)) *pdata = (cmd.resp[0] >> 8) & 0xFF; @@ -218,7 +218,7 @@ rt_int32_t sdio_io_rw_extended(struct rt_mmcsd_card *card, if (data.err) return data.err; - if (!controller_is_spi(card->host)) + if (!controller_is_spi(card->host)) { if (cmd.resp[0] & R5_ERROR) return -RT_EIO; @@ -250,7 +250,7 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func, rt_int32_t ret; rt_uint32_t left_size; rt_uint32_t max_blks, blks; - + left_size = len; /* Do the bulk of the transfer using block mode (if supported). */ @@ -267,7 +267,7 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func, blks = max_blks; len = blks * func->cur_blk_size; - ret = sdio_io_rw_extended(func->card, rw, func->num, + ret = sdio_io_rw_extended(func->card, rw, func->num, addr, op_code, buf, blks, func->cur_blk_size); if (ret) return ret; @@ -283,7 +283,7 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func, { len = MIN(left_size, sdio_max_block_size(func)); - ret = sdio_io_rw_extended(func->card, rw, func->num, + ret = sdio_io_rw_extended(func->card, rw, func->num, addr, op_code, buf, 1, len); if (ret) return ret; @@ -297,7 +297,7 @@ rt_int32_t sdio_io_rw_extended_block(struct rt_sdio_function *func, return 0; } -rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, +rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, rt_uint32_t reg, rt_int32_t *err) { @@ -314,7 +314,7 @@ rt_uint8_t sdio_io_readb(struct rt_sdio_function *func, return data; } -rt_int32_t sdio_io_writeb(struct rt_sdio_function *func, +rt_int32_t sdio_io_writeb(struct rt_sdio_function *func, rt_uint32_t reg, rt_uint8_t data) { @@ -332,7 +332,7 @@ rt_uint16_t sdio_io_readw(struct rt_sdio_function *func, *err = 0; ret = sdio_io_rw_extended_block(func, 0, addr, 1, (rt_uint8_t *)&dmabuf, 2); - if (ret) + if (ret) { if (err) *err = ret; @@ -361,7 +361,7 @@ rt_uint32_t sdio_io_readl(struct rt_sdio_function *func, *err = 0; ret = sdio_io_rw_extended_block(func, 0, addr, 1, (rt_uint8_t *)&dmabuf, 4); - if (ret) + if (ret) { if (err) *err = ret; @@ -379,7 +379,7 @@ rt_int32_t sdio_io_writel(struct rt_sdio_function *func, return sdio_io_rw_extended_block(func, 1, addr, 1, (rt_uint8_t *)&dmabuf, 4); } -rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len) @@ -387,7 +387,7 @@ rt_int32_t sdio_io_read_multi_fifo_b(struct rt_sdio_function *func, return sdio_io_rw_extended_block(func, 0, addr, 0, buf, len); } -rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len) @@ -395,7 +395,7 @@ rt_int32_t sdio_io_write_multi_fifo_b(struct rt_sdio_function *func, return sdio_io_rw_extended_block(func, 1, addr, 0, buf, len); } -rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len) @@ -403,7 +403,7 @@ rt_int32_t sdio_io_read_multi_incr_b(struct rt_sdio_function *func, return sdio_io_rw_extended_block(func, 0, addr, 1, buf, len); } -rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func, +rt_int32_t sdio_io_write_multi_incr_b(struct rt_sdio_function *func, rt_uint32_t addr, rt_uint8_t *buf, rt_uint32_t len) @@ -425,7 +425,7 @@ static rt_int32_t sdio_read_cccr(struct rt_mmcsd_card *card) cccr_version = data & 0x0f; - if (cccr_version > SDIO_CCCR_REV_3_00) + if (cccr_version > SDIO_CCCR_REV_3_00) { LOG_E("unrecognised CCCR structure version %d", cccr_version); @@ -447,7 +447,7 @@ static rt_int32_t sdio_read_cccr(struct rt_mmcsd_card *card) if (data & SDIO_CCCR_CAP_4BLS) card->cccr.bus_width = 1; - if (cccr_version >= SDIO_CCCR_REV_1_10) + if (cccr_version >= SDIO_CCCR_REV_1_10) { data = sdio_io_readb(card->sdio_function[0], SDIO_REG_CCCR_POWER_CTRL, &ret); if (ret) @@ -457,7 +457,7 @@ static rt_int32_t sdio_read_cccr(struct rt_mmcsd_card *card) card->cccr.power_ctrl = 1; } - if (cccr_version >= SDIO_CCCR_REV_1_20) + if (cccr_version >= SDIO_CCCR_REV_1_20) { data = sdio_io_readb(card->sdio_function[0], SDIO_REG_CCCR_SPEED, &ret); if (ret) @@ -528,7 +528,7 @@ static rt_int32_t sdio_read_cis(struct rt_sdio_function *func) for (i = 0; i < 3; i++) { - data = sdio_io_readb(func0, + data = sdio_io_readb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_CIS + i, &ret); if (ret) return ret; @@ -557,13 +557,13 @@ static rt_int32_t sdio_read_cis(struct rt_sdio_function *func) return -RT_ENOMEM; curr->data = (rt_uint8_t *)curr + sizeof(struct rt_sdio_function_tuple); - for (i = 0; i < tpl_link; i++) + for (i = 0; i < tpl_link; i++) { curr->data[i] = sdio_io_readb(func0, cisptr + i, &ret); if (ret) break; } - if (ret) + if (ret) { rt_free(curr); break; @@ -611,7 +611,7 @@ static rt_int32_t sdio_read_cis(struct rt_sdio_function *func) LOG_D("CISTPL_VERS_1 too short"); } break; - default: + default: /* this tuple is unknown to the core */ curr->next = RT_NULL; curr->code = tpl_code; @@ -644,7 +644,7 @@ void sdio_free_cis(struct rt_sdio_function *func) tuple = func->tuples; - while (tuple && ((tuple != card->sdio_function[0]->tuples) || (!func->num))) + while (tuple && ((tuple != card->sdio_function[0]->tuples) || (!func->num))) { tmp = tuple; tuple = tuple->next; @@ -660,16 +660,16 @@ static rt_int32_t sdio_read_fbr(struct rt_sdio_function *func) rt_uint8_t data; struct rt_sdio_function *func0 = func->card->sdio_function[0]; - data = sdio_io_readb(func0, + data = sdio_io_readb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_STD_FUNC_IF, &ret); if (ret) goto err; data &= 0x0f; - if (data == 0x0f) + if (data == 0x0f) { - data = sdio_io_readb(func0, + data = sdio_io_readb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_STD_IF_EXT, &ret); if (ret) goto err; @@ -828,7 +828,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) if (err) goto err; - if (controller_is_spi(host)) + if (controller_is_spi(host)) { err = mmcsd_spi_use_crc(host, host->spi_use_crc); if (err) @@ -838,7 +838,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) function_num = (cmd5_resp & 0x70000000) >> 28; card = rt_malloc(sizeof(struct rt_mmcsd_card)); - if (!card) + if (!card) { LOG_E("malloc card failed"); err = -RT_ENOMEM; @@ -862,7 +862,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) card->sdio_function[0]->card = card; card->sdio_function[0]->num = 0; - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmcsd_get_card_addr(host, &card->rca); if (err) @@ -871,7 +871,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) mmcsd_set_bus_mode(host, MMCSD_BUSMODE_PUSHPULL); } - if (!controller_is_spi(host)) + if (!controller_is_spi(host)) { err = mmcsd_select_card(card); if (err) @@ -890,11 +890,11 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) if (err) goto err2; - if (card->flags & CARD_FLAG_HIGHSPEED) + if (card->flags & CARD_FLAG_HIGHSPEED) { - mmcsd_set_clock(host, 50000000); - } - else + mmcsd_set_clock(host, card->host->freq_max > 50000000 ? 50000000 : card->host->freq_max); + } + else { mmcsd_set_clock(host, card->cis.max_tran_speed); } @@ -903,7 +903,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) if (err) goto err2; - for (i = 1; i < function_num + 1; i++) + for (i = 1; i < function_num + 1; i++) { err = sdio_initialize_function(card, i); if (err) @@ -950,7 +950,7 @@ static rt_int32_t sdio_init_card(struct rt_mmcsd_host *host, rt_uint32_t ocr) } err: LOG_E("error %d while initialising SDIO card", err); - + return err; } @@ -961,13 +961,13 @@ rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr) RT_ASSERT(host != RT_NULL); - if (ocr & 0x7F) + if (ocr & 0x7F) { LOG_W("Card ocr below the defined voltage rang."); ocr &= ~0x7F; } - if (ocr & VDD_165_195) + if (ocr & VDD_165_195) { LOG_W("Can't support the low voltage SDIO card."); ocr &= ~VDD_165_195; @@ -975,7 +975,7 @@ rt_int32_t init_sdio(struct rt_mmcsd_host *host, rt_uint32_t ocr) current_ocr = mmcsd_select_voltage(host, ocr); - if (!current_ocr) + if (!current_ocr) { err = -RT_ERROR; goto err; @@ -1007,35 +1007,35 @@ static void sdio_irq_thread(void *param) card = host->card; RT_ASSERT(card != RT_NULL); - while (1) + while (1) { if (rt_sem_take(host->sdio_irq_sem, RT_WAITING_FOREVER) == RT_EOK) { mmcsd_host_lock(host); - pending = sdio_io_readb(host->card->sdio_function[0], + pending = sdio_io_readb(host->card->sdio_function[0], SDIO_REG_CCCR_INT_PEND, &ret); - if (ret) + if (ret) { mmcsd_dbg("error %d reading SDIO_REG_CCCR_INT_PEND\n", ret); goto out; } - for (i = 1; i <= 7; i++) + for (i = 1; i <= 7; i++) { - if (pending & (1 << i)) + if (pending & (1 << i)) { struct rt_sdio_function *func = card->sdio_function[i]; - if (!func) + if (!func) { mmcsd_dbg("pending IRQ for " "non-existant function %d\n", func->num); goto out; - } - else if (func->irq_handler) + } + else if (func->irq_handler) { func->irq_handler(func); - } - else + } + else { mmcsd_dbg("pending IRQ with no register handler\n"); goto out; @@ -1063,9 +1063,9 @@ static rt_int32_t sdio_irq_thread_create(struct rt_mmcsd_card *card) host->sdio_irq_sem = rt_sem_create("sdio_irq", 0, RT_IPC_FLAG_FIFO); RT_ASSERT(host->sdio_irq_sem != RT_NULL); - host->sdio_irq_thread = rt_thread_create("sdio_irq", sdio_irq_thread, host, + host->sdio_irq_thread = rt_thread_create("sdio_irq", sdio_irq_thread, host, RT_SDIO_STACK_SIZE, RT_SDIO_THREAD_PRIORITY, 20); - if (host->sdio_irq_thread != RT_NULL) + if (host->sdio_irq_thread != RT_NULL) { rt_thread_startup(host->sdio_irq_thread); } @@ -1081,7 +1081,7 @@ static rt_int32_t sdio_irq_thread_delete(struct rt_mmcsd_card *card) RT_ASSERT(host->sdio_irq_num > 0); host->sdio_irq_num--; - if (!host->sdio_irq_num) + if (!host->sdio_irq_num) { if (host->flags & MMCSD_SUP_SDIO_IRQ) host->ops->enable_sdio_irq(host, 0); @@ -1108,7 +1108,7 @@ rt_int32_t sdio_attach_irq(struct rt_sdio_function *func, mmcsd_dbg("SDIO: enabling IRQ for function %d\n", func->num); - if (func->irq_handler) + if (func->irq_handler) { mmcsd_dbg("SDIO: IRQ for already in use.\n"); @@ -1149,7 +1149,7 @@ rt_int32_t sdio_detach_irq(struct rt_sdio_function *func) mmcsd_dbg("SDIO: disabling IRQ for function %d\n", func->num); - if (func->irq_handler) + if (func->irq_handler) { func->irq_handler = RT_NULL; sdio_irq_thread_delete(func->card); @@ -1206,7 +1206,7 @@ rt_int32_t sdio_enable_func(struct rt_sdio_function *func) timeout = rt_tick_get() + func->enable_timeout_val * RT_TICK_PER_SECOND / 1000; - while (1) + while (1) { reg = sdio_io_readb(func0, SDIO_REG_CCCR_IO_RDY, &ret); if (ret) @@ -1278,17 +1278,17 @@ rt_int32_t sdio_set_block_size(struct rt_sdio_function *func, if (blksize > func->card->host->max_blk_size) return -RT_ERROR; - if (blksize == 0) + if (blksize == 0) { blksize = MIN(func->max_blk_size, func->card->host->max_blk_size); blksize = MIN(blksize, 512u); } - ret = sdio_io_writeb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_BLKSIZE, + ret = sdio_io_writeb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_BLKSIZE, blksize & 0xff); if (ret) return ret; - ret = sdio_io_writeb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_BLKSIZE + 1, + ret = sdio_io_writeb(func0, SDIO_REG_FBR_BASE(func->num) + SDIO_REG_FBR_BLKSIZE + 1, (blksize >> 8) & 0xff); if (ret) return ret; @@ -1301,14 +1301,14 @@ rt_inline rt_int32_t sdio_match_card(struct rt_mmcsd_card *card, const struct rt_sdio_device_id *id) { rt_uint8_t num = 1; - - if ((id->manufacturer != SDIO_ANY_MAN_ID) && + + if ((id->manufacturer != SDIO_ANY_MAN_ID) && (id->manufacturer != card->cis.manufacturer)) return 0; - + while (num <= card->sdio_function_num) { - if ((id->product != SDIO_ANY_PROD_ID) && + if ((id->product != SDIO_ANY_PROD_ID) && (id->product == card->sdio_function[num]->product)) return 1; num++; diff --git a/components/drivers/sensors/SConscript b/components/drivers/sensors/SConscript index 51c4b50ee..b56ae5ce6 100644 --- a/components/drivers/sensors/SConscript +++ b/components/drivers/sensors/SConscript @@ -7,7 +7,7 @@ src = ['sensor.c'] CPPPATH = [cwd, cwd + '/../include'] if GetDepend('RT_USING_SENSOR_CMD'): - src += ['sensor_cmd.c']; + src += ['sensor_cmd.c'] group = DefineGroup('Sensors', src, depend = ['RT_USING_SENSOR', 'RT_USING_DEVICE'], CPPPATH = CPPPATH) diff --git a/components/drivers/sensors/sensor.c b/components/drivers/sensors/sensor.c index 91b256bd6..c7efce62b 100644 --- a/components/drivers/sensors/sensor.c +++ b/components/drivers/sensors/sensor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -305,7 +305,7 @@ static rt_err_t rt_sensor_control(rt_device_t dev, int cmd, void *args) case RT_SENSOR_CTRL_GET_ID: if (args) { - sensor->ops->control(sensor, RT_SENSOR_CTRL_GET_ID, args); + result = sensor->ops->control(sensor, RT_SENSOR_CTRL_GET_ID, args); } break; case RT_SENSOR_CTRL_GET_INFO: @@ -350,7 +350,17 @@ static rt_err_t rt_sensor_control(rt_device_t dev, int cmd, void *args) result = sensor->ops->control(sensor, RT_SENSOR_CTRL_SELF_TEST, args); break; default: - return -RT_ERROR; + + if (cmd > RT_SENSOR_CTRL_USER_CMD_START) + { + /* Custom commands */ + result = sensor->ops->control(sensor, cmd, args); + } + else + { + result = -RT_ERROR; + } + break; } if (sensor->module) diff --git a/components/drivers/sensors/sensor.h b/components/drivers/sensors/sensor.h index 9c6e5ecc5..08c0d2eac 100644 --- a/components/drivers/sensors/sensor.h +++ b/components/drivers/sensors/sensor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -106,6 +106,8 @@ extern "C" { #define RT_SENSOR_CTRL_SET_POWER (5) /* Set power mode. args type of sensor power mode. ex. RT_SENSOR_POWER_DOWN,RT_SENSOR_POWER_NORMAL */ #define RT_SENSOR_CTRL_SELF_TEST (6) /* Take a self test */ +#define RT_SENSOR_CTRL_USER_CMD_START 0x100 /* User commands should be greater than 0x100 */ + struct rt_sensor_info { rt_uint8_t type; /* The sensor type */ @@ -151,7 +153,7 @@ struct rt_sensor_device const struct rt_sensor_ops *ops; /* The sensor ops */ struct rt_sensor_module *module; /* The sensor module */ - + rt_err_t (*irq_handle)(rt_sensor_t sensor); /* Called when an interrupt is generated, registered by the driver */ }; diff --git a/components/drivers/sensors/sensor_cmd.c b/components/drivers/sensors/sensor_cmd.c index dd1aa1ef9..ef53be978 100644 --- a/components/drivers/sensors/sensor_cmd.c +++ b/components/drivers/sensors/sensor_cmd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -69,7 +69,7 @@ static void sensor_fifo_rx_entry(void *parameter) struct rt_sensor_data *data = RT_NULL; struct rt_sensor_info info; rt_size_t res, i; - + rt_device_control(dev, RT_SENSOR_CTRL_GET_INFO, &info); data = (struct rt_sensor_data *)rt_malloc(sizeof(struct rt_sensor_data) * info.fifo_max); @@ -103,7 +103,7 @@ static void sensor_fifo(int argc, char **argv) return; } sensor = (rt_sensor_t)dev; - + if (rt_device_open(dev, RT_DEVICE_FLAG_FIFO_RX) != RT_EOK) { LOG_E("open device failed!"); diff --git a/components/drivers/serial/serial.c b/components/drivers/serial/serial.c index 50dd7e188..8c3c06f9a 100644 --- a/components/drivers/serial/serial.c +++ b/components/drivers/serial/serial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -219,7 +219,10 @@ rt_inline int _serial_poll_rx(struct rt_serial_device *serial, rt_uint8_t *data, *data = ch; data ++; length --; - if (ch == '\n') break; + if(serial->parent.open_flag & RT_DEVICE_FLAG_STREAM) + { + if (ch == '\n') break; + } } return size - length; @@ -315,6 +318,19 @@ rt_inline int _serial_int_tx(struct rt_serial_device *serial, const rt_uint8_t * while (length) { + /* + * to be polite with serial console add a line feed + * to the carriage return character + */ + if (*data == '\n' && (serial->parent.open_flag & RT_DEVICE_FLAG_STREAM)) + { + if (serial->ops->putc(serial, '\r') == -1) + { + rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); + continue; + } + } + if (serial->ops->putc(serial, *(char*)data) == -1) { rt_completion_wait(&(tx->completion), RT_WAITING_FOREVER); @@ -330,14 +346,16 @@ rt_inline int _serial_int_tx(struct rt_serial_device *serial, const rt_uint8_t * static void _serial_check_buffer_size(void) { static rt_bool_t already_output = RT_FALSE; - + if (already_output == RT_FALSE) { +#if !defined(RT_USING_ULOG) || defined(ULOG_USING_ISR_LOG) LOG_W("Warning: There is no enough buffer for saving data," " please increase the RT_SERIAL_RB_BUFSZ option."); +#endif already_output = RT_TRUE; } -} +} #if defined(RT_USING_POSIX) || defined(RT_SERIAL_USING_DMA) static rt_size_t _serial_fifo_calc_recved_len(struct rt_serial_device *serial) @@ -439,7 +457,7 @@ static void rt_dma_recv_update_put_index(struct rt_serial_device *serial, rt_siz rx_fifo->is_full = RT_TRUE; } } - + if(rx_fifo->is_full == RT_TRUE) { _serial_check_buffer_size(); @@ -594,7 +612,7 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag) /* initialize the Rx/Tx structure according to open flag */ if (serial->serial_rx == RT_NULL) - { + { if (oflag & RT_DEVICE_FLAG_INT_RX) { struct rt_serial_rx_fifo* rx_fifo; @@ -613,7 +631,7 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag) /* configure low level device */ serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX); } -#ifdef RT_SERIAL_USING_DMA +#ifdef RT_SERIAL_USING_DMA else if (oflag & RT_DEVICE_FLAG_DMA_RX) { if (serial->config.bufsz == 0) { @@ -654,7 +672,7 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag) #ifdef RT_SERIAL_USING_DMA else if (oflag & RT_DEVICE_FLAG_DMA_RX) dev->open_flag |= RT_DEVICE_FLAG_DMA_RX; -#endif /* RT_SERIAL_USING_DMA */ +#endif /* RT_SERIAL_USING_DMA */ } if (serial->serial_tx == RT_NULL) @@ -702,7 +720,7 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag) #ifdef RT_SERIAL_USING_DMA else if (oflag & RT_DEVICE_FLAG_DMA_TX) dev->open_flag |= RT_DEVICE_FLAG_DMA_TX; -#endif /* RT_SERIAL_USING_DMA */ +#endif /* RT_SERIAL_USING_DMA */ } /* set stream flag */ @@ -731,6 +749,7 @@ static rt_err_t rt_serial_close(struct rt_device *dev) rt_free(rx_fifo); serial->serial_rx = RT_NULL; dev->open_flag &= ~RT_DEVICE_FLAG_INT_RX; + /* configure low level device */ serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void*)RT_DEVICE_FLAG_INT_RX); } @@ -752,13 +771,14 @@ static rt_err_t rt_serial_close(struct rt_device *dev) rt_free(rx_fifo); } - /* configure low level device */ - serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *) RT_DEVICE_FLAG_DMA_RX); serial->serial_rx = RT_NULL; dev->open_flag &= ~RT_DEVICE_FLAG_DMA_RX; + + /* configure low level device */ + serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *) RT_DEVICE_FLAG_DMA_RX); } #endif /* RT_SERIAL_USING_DMA */ - + if (dev->open_flag & RT_DEVICE_FLAG_INT_TX) { struct rt_serial_tx_fifo* tx_fifo; @@ -769,6 +789,7 @@ static rt_err_t rt_serial_close(struct rt_device *dev) rt_free(tx_fifo); serial->serial_tx = RT_NULL; dev->open_flag &= ~RT_DEVICE_FLAG_INT_TX; + /* configure low level device */ serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void*)RT_DEVICE_FLAG_INT_TX); } @@ -780,10 +801,19 @@ static rt_err_t rt_serial_close(struct rt_device *dev) tx_dma = (struct rt_serial_tx_dma*)serial->serial_tx; RT_ASSERT(tx_dma != RT_NULL); + rt_data_queue_deinit(&(tx_dma->data_queue)); + rt_free(tx_dma); serial->serial_tx = RT_NULL; dev->open_flag &= ~RT_DEVICE_FLAG_DMA_TX; + + /* configure low level device */ + serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *) RT_DEVICE_FLAG_DMA_TX); } + + serial->ops->control(serial, RT_DEVICE_CTRL_CLOSE, RT_NULL); + dev->flag &= ~RT_DEVICE_FLAG_ACTIVATED; + #endif /* RT_SERIAL_USING_DMA */ return RT_EOK; } @@ -809,7 +839,7 @@ static rt_size_t rt_serial_read(struct rt_device *dev, { return _serial_dma_rx(serial, (rt_uint8_t *)buffer, size); } -#endif /* RT_SERIAL_USING_DMA */ +#endif /* RT_SERIAL_USING_DMA */ return _serial_poll_rx(serial, (rt_uint8_t *)buffer, size); } @@ -830,7 +860,7 @@ static rt_size_t rt_serial_write(struct rt_device *dev, { return _serial_int_tx(serial, (const rt_uint8_t *)buffer, size); } -#ifdef RT_SERIAL_USING_DMA +#ifdef RT_SERIAL_USING_DMA else if (dev->open_flag & RT_DEVICE_FLAG_DMA_TX) { return _serial_dma_tx(serial, (const rt_uint8_t *)buffer, size); @@ -980,7 +1010,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, } break; - +#ifdef RT_USING_POSIX #ifdef RT_USING_POSIX_TERMIOS case TCGETA: { @@ -1072,8 +1102,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, break; case TCXONC: break; -#endif -#ifdef RT_USING_POSIX +#endif /*RT_USING_POSIX_TERMIOS*/ case FIONREAD: { rt_size_t recved = 0; @@ -1097,7 +1126,7 @@ static rt_err_t rt_serial_control(struct rt_device *dev, } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops serial_ops = +const static struct rt_device_ops serial_ops = { rt_serial_init, rt_serial_open, @@ -1228,7 +1257,7 @@ void rt_hw_serial_isr(struct rt_serial_device *serial, int event) tx_dma = (struct rt_serial_tx_dma*) serial->serial_tx; rt_data_queue_pop(&(tx_dma->data_queue), &last_data_ptr, &data_size, 0); - if (rt_data_queue_peak(&(tx_dma->data_queue), &data_ptr, &data_size) == RT_EOK) + if (rt_data_queue_peek(&(tx_dma->data_queue), &data_ptr, &data_size) == RT_EOK) { /* transmit next data node */ tx_dma->activated = RT_TRUE; diff --git a/components/drivers/spi/enc28j60.c b/components/drivers/spi/enc28j60.c index a8bfe3a15..f99719245 100644 --- a/components/drivers/spi/enc28j60.c +++ b/components/drivers/spi/enc28j60.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -747,7 +747,7 @@ static struct pbuf *enc28j60_rx(rt_device_t dev) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops enc28j60_ops = +const static struct rt_device_ops enc28j60_ops = { enc28j60_init, enc28j60_open, diff --git a/components/drivers/spi/enc28j60.h b/components/drivers/spi/enc28j60.h index adff77474..471b71ec2 100644 --- a/components/drivers/spi/enc28j60.h +++ b/components/drivers/spi/enc28j60.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/spi/qspi_core.c b/components/drivers/spi/qspi_core.c index c9ff6a963..ca2cba0ab 100644 --- a/components/drivers/spi/qspi_core.c +++ b/components/drivers/spi/qspi_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,7 +14,7 @@ rt_err_t rt_qspi_configure(struct rt_qspi_device *device, struct rt_qspi_configu { RT_ASSERT(device != RT_NULL); RT_ASSERT(cfg != RT_NULL); - + struct rt_qspi_device *qspi_device = (struct rt_qspi_device *)device; rt_err_t result = RT_EOK; @@ -35,14 +35,14 @@ rt_err_t rt_qspi_configure(struct rt_qspi_device *device, struct rt_qspi_configu rt_err_t rt_qspi_bus_register(struct rt_spi_bus *bus, const char *name, const struct rt_spi_ops *ops) { rt_err_t result = RT_EOK; - + result = rt_spi_bus_register(bus, name, ops); if(result == RT_EOK) { /* set SPI bus to qspi modes */ bus->mode = RT_SPI_BUS_MODE_QSPI; } - + return result; } @@ -243,7 +243,7 @@ rt_err_t rt_qspi_send(struct rt_qspi_device *device, const void *send_buf, rt_si message.qspi_data_lines = 0; } - + /* set send buf and send size */ message.parent.send_buf = ptr + count; message.parent.recv_buf = RT_NULL; diff --git a/components/drivers/spi/sfud/inc/sfud_cfg.h b/components/drivers/spi/sfud/inc/sfud_cfg.h index 3b7860062..01255775c 100644 --- a/components/drivers/spi/sfud/inc/sfud_cfg.h +++ b/components/drivers/spi/sfud/inc/sfud_cfg.h @@ -38,6 +38,18 @@ #define SFUD_DEBUG_MODE #endif +#ifdef RT_DEBUG_SFUD +#define DBG_LVL DBG_LOG +#define SFUD_DEBUG(fmt, ...) LOG_D("(%s:%ld) "fmt"", __FILE__, __LINE__, ##__VA_ARGS__) +#else +#define DBG_LVL DBG_INFO +#endif /* RT_DEBUG_SFUD */ + +#define DBG_TAG "SFUD" +#include +extern void rt_kprintf(const char *fmt, ...); +#define SFUD_INFO(...) LOG_I(__VA_ARGS__) + /** * Using probe flash JEDEC SFDP parameter. */ diff --git a/components/drivers/spi/sfud/inc/sfud_flash_def.h b/components/drivers/spi/sfud/inc/sfud_flash_def.h index 13a0e702a..03b95cd00 100644 --- a/components/drivers/spi/sfud/inc/sfud_flash_def.h +++ b/components/drivers/spi/sfud/inc/sfud_flash_def.h @@ -87,7 +87,7 @@ typedef struct { #define SFUD_MF_ID_FUDAN 0xA1 #define SFUD_MF_ID_HYUNDAI 0xAD #define SFUD_MF_ID_SST 0xBF -#define SFUD_MF_ID_MICRONIX 0xC2 +#define SFUD_MF_ID_MACRONIX 0xC2 #define SFUD_MF_ID_GIGADEVICE 0xC8 #define SFUD_MF_ID_ISSI 0xD5 #define SFUD_MF_ID_WINBOND 0xEF @@ -110,7 +110,7 @@ typedef struct { {"GigaDevice", SFUD_MF_ID_GIGADEVICE}, \ {"ISSI", SFUD_MF_ID_ISSI}, \ {"Winbond", SFUD_MF_ID_WINBOND}, \ - {"Micronix", SFUD_MF_ID_MICRONIX}, \ + {"Macronix", SFUD_MF_ID_MACRONIX}, \ } #ifdef SFUD_USING_FLASH_INFO_TABLE @@ -124,6 +124,7 @@ typedef struct { {"AT45DB161E", SFUD_MF_ID_ATMEL, 0x26, 0x00, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_DUAL_BUFFER, 512, 0x81}, \ {"W25Q40BV", SFUD_MF_ID_WINBOND, 0x40, 0x13, 512L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"W25Q16BV", SFUD_MF_ID_WINBOND, 0x40, 0x15, 2L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ + {"W25Q64CV", SFUD_MF_ID_WINBOND, 0x40, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"W25Q64DW", SFUD_MF_ID_WINBOND, 0x60, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"W25Q128BV", SFUD_MF_ID_WINBOND, 0x40, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ {"W25Q256FV", SFUD_MF_ID_WINBOND, 0x40, 0x19, 32L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \ @@ -143,7 +144,7 @@ typedef struct { #endif /* SFUD_USING_FLASH_INFO_TABLE */ #ifdef SFUD_USING_QSPI -/* This table saves flash read-fast instructions in QSPI mode, +/* This table saves flash read-fast instructions in QSPI mode, * SFUD can use this table to select the most appropriate read instruction for flash. * | mf_id | type_id | capacity_id | qspi_read_mode | */ @@ -156,7 +157,7 @@ typedef struct { /* W25Q16BV */ \ {SFUD_MF_ID_WINBOND, 0x40, 0x15, NORMAL_SPI_READ|DUAL_OUTPUT}, \ /* W25Q32BV */ \ - {SFUD_MF_ID_WINBOND, 0x40, 0x16, NORMAL_SPI_READ|DUAL_OUTPUT}, \ + {SFUD_MF_ID_WINBOND, 0x40, 0x16, NORMAL_SPI_READ|DUAL_OUTPUT|QUAD_OUTPUT|QUAD_IO}, \ /* W25Q64JV */ \ {SFUD_MF_ID_WINBOND, 0x40, 0x17, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \ /* W25Q128JV */ \ @@ -172,7 +173,9 @@ typedef struct { /* A25LQ64 */ \ {SFUD_MF_ID_AMIC, 0x40, 0x17, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_IO}, \ /* MX25L3206E and KH25L3206E */ \ - {SFUD_MF_ID_MICRONIX, 0x20, 0x16, NORMAL_SPI_READ|DUAL_OUTPUT}, \ + {SFUD_MF_ID_MACRONIX, 0x20, 0x16, NORMAL_SPI_READ|DUAL_OUTPUT}, \ + /* MX25L51245G */ \ + {SFUD_MF_ID_MACRONIX, 0x20, 0x1A, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \ /* GD25Q64B */ \ {SFUD_MF_ID_GIGADEVICE, 0x40, 0x17, NORMAL_SPI_READ|DUAL_OUTPUT}, \ } diff --git a/components/drivers/spi/sfud/src/sfud.c b/components/drivers/spi/sfud/src/sfud.c index f666b0680..e5b03131f 100644 --- a/components/drivers/spi/sfud/src/sfud.c +++ b/components/drivers/spi/sfud/src/sfud.c @@ -897,7 +897,7 @@ static sfud_err set_write_enabled(const sfud_flash *flash, bool enabled) { if (enabled && (register_status & SFUD_STATUS_REGISTER_WEL) == 0) { SFUD_INFO("Error: Can't enable write status."); return SFUD_ERR_WRITE; - } else if (!enabled && (register_status & SFUD_STATUS_REGISTER_WEL) == 1) { + } else if (!enabled && (register_status & SFUD_STATUS_REGISTER_WEL) != 0) { SFUD_INFO("Error: Can't disable write status."); return SFUD_ERR_WRITE; } diff --git a/components/drivers/spi/spi_core.c b/components/drivers/spi/spi_core.c index 64b0d2e49..7b6b7a076 100644 --- a/components/drivers/spi/spi_core.c +++ b/components/drivers/spi/spi_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/spi/spi_dev.c b/components/drivers/spi/spi_dev.c index e334e7aeb..264f5d185 100644 --- a/components/drivers/spi/spi_dev.c +++ b/components/drivers/spi/spi_dev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -48,7 +48,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev, { case 0: /* set device */ break; - case 1: + case 1: break; } @@ -56,7 +56,7 @@ static rt_err_t _spi_bus_device_control(rt_device_t dev, } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops spi_bus_ops = +const static struct rt_device_ops spi_bus_ops = { RT_NULL, RT_NULL, @@ -129,7 +129,7 @@ static rt_err_t _spidev_device_control(rt_device_t dev, { case 0: /* set device */ break; - case 1: + case 1: break; } @@ -137,7 +137,7 @@ static rt_err_t _spidev_device_control(rt_device_t dev, } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops spi_device_ops = +const static struct rt_device_ops spi_device_ops = { RT_NULL, RT_NULL, diff --git a/components/drivers/spi/spi_flash.h b/components/drivers/spi/spi_flash.h index 30db32474..d4b0277bf 100644 --- a/components/drivers/spi/spi_flash.h +++ b/components/drivers/spi/spi_flash.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -25,10 +25,10 @@ typedef struct spi_flash_device *rt_spi_flash_device_t; #ifdef RT_USING_MTD_NOR struct spi_flash_mtd { - struct rt_mtd_nor_device mtd_device; - struct rt_spi_device * rt_spi_device; - struct rt_mutex lock; - void * user_data; + struct rt_mtd_nor_device mtd_device; + struct rt_spi_device * rt_spi_device; + struct rt_mutex lock; + void * user_data; }; #endif diff --git a/components/drivers/spi/spi_flash_sfud.c b/components/drivers/spi/spi_flash_sfud.c index eff604fe0..ba673edf6 100644 --- a/components/drivers/spi/spi_flash_sfud.c +++ b/components/drivers/spi/spi_flash_sfud.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,12 +15,6 @@ #ifdef RT_USING_SFUD -#ifdef RT_DEBUG_SFUD -#define DEBUG_TRACE rt_kprintf("[SFUD] "); rt_kprintf -#else -#define DEBUG_TRACE(...) -#endif /* RT_DEBUG_SFUD */ - #ifndef RT_SFUD_DEFAULT_SPI_CFG #ifndef RT_SFUD_SPI_MAX_HZ @@ -34,7 +28,7 @@ .data_width = 8, \ .max_hz = RT_SFUD_SPI_MAX_HZ, \ } -#endif +#endif /* RT_SFUD_DEFAULT_SPI_CFG */ #ifdef SFUD_USING_QSPI #define RT_SFUD_DEFAULT_QSPI_CFG \ @@ -44,11 +38,7 @@ .ddr_mode = 0, \ .qspi_dl_width = 4, \ } -#endif - -static char log_buf[RT_CONSOLEBUF_SIZE]; - -void sfud_log_debug(const char *file, const long line, const char *format, ...); +#endif /* SFUD_USING_QSPI */ static rt_err_t rt_sfud_control(rt_device_t dev, int cmd, void *args) { RT_ASSERT(dev); @@ -259,44 +249,6 @@ static void retry_delay_100us(void) { rt_thread_delay((RT_TICK_PER_SECOND * 1 + 9999) / 10000); } -/** - * This function is print debug info. - * - * @param file the file which has call this function - * @param line the line number which has call this function - * @param format output format - * @param ... args - */ -void sfud_log_debug(const char *file, const long line, const char *format, ...) { - va_list args; - - /* args point to the first variable parameter */ - va_start(args, format); - rt_kprintf("[SFUD] (%s:%ld) ", file, line); - /* must use vprintf to print */ - rt_vsnprintf(log_buf, sizeof(log_buf), format, args); - rt_kprintf("%s\n", log_buf); - va_end(args); -} - -/** - * This function is print routine info. - * - * @param format output format - * @param ... args - */ -void sfud_log_info(const char *format, ...) { - va_list args; - - /* args point to the first variable parameter */ - va_start(args, format); - rt_kprintf("[SFUD] "); - /* must use vprintf to print */ - rt_vsnprintf(log_buf, sizeof(log_buf), format, args); - rt_kprintf("%s\n", log_buf); - va_end(args); -} - sfud_err sfud_spi_port_init(sfud_flash *flash) { sfud_err result = SFUD_SUCCESS; @@ -311,7 +263,7 @@ sfud_err sfud_spi_port_init(sfud_flash *flash) { flash->spi.unlock = spi_unlock; flash->spi.user_data = flash; if (RT_TICK_PER_SECOND < 1000) { - rt_kprintf("[SFUD] Warning: The OS tick(%d) is less than 1000. So the flash write will take more time.\n", RT_TICK_PER_SECOND); + LOG_W("[SFUD] Warning: The OS tick(%d) is less than 1000. So the flash write will take more time.", RT_TICK_PER_SECOND); } /* 100 microsecond delay */ flash->retry.delay = retry_delay_100us; @@ -334,23 +286,23 @@ const static struct rt_device_ops flash_device_ops = #endif /** - * Probe SPI flash by SFUD(Serial Flash Universal Driver) driver library and though SPI device. + * Probe SPI flash by SFUD (Serial Flash Universal Driver) driver library and though SPI device by specified configuration. * * @param spi_flash_dev_name the name which will create SPI flash device * @param spi_dev_name using SPI device name + * @param spi_cfg SPI device configuration + * @param qspi_cfg QSPI device configuration * * @return probed SPI flash device, probe failed will return RT_NULL */ -rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name) { +rt_spi_flash_device_t rt_sfud_flash_probe_ex(const char *spi_flash_dev_name, const char *spi_dev_name, + struct rt_spi_configuration *spi_cfg, struct rt_qspi_configuration *qspi_cfg) +{ rt_spi_flash_device_t rtt_dev = RT_NULL; sfud_flash *sfud_dev = RT_NULL; char *spi_flash_dev_name_bak = RT_NULL, *spi_dev_name_bak = RT_NULL; - /* using default flash SPI configuration for initialize SPI Flash - * @note you also can change the SPI to other configuration after initialized finish */ - struct rt_spi_configuration cfg = RT_SFUD_DEFAULT_SPI_CFG; extern sfud_err sfud_device_init(sfud_flash *flash); #ifdef SFUD_USING_QSPI - struct rt_qspi_configuration qspi_cfg = RT_SFUD_DEFAULT_QSPI_CFG; struct rt_qspi_device *qspi_dev = RT_NULL; #endif @@ -380,7 +332,7 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const /* RT-Thread SPI device initialize */ rtt_dev->rt_spi_device = (struct rt_spi_device *) rt_device_find(spi_dev_name); if (rtt_dev->rt_spi_device == RT_NULL || rtt_dev->rt_spi_device->parent.type != RT_Device_Class_SPIDevice) { - rt_kprintf("ERROR: SPI device %s not found!\n", spi_dev_name); + LOG_E("ERROR: SPI device %s not found!", spi_dev_name); goto error; } sfud_dev->spi.name = spi_dev_name_bak; @@ -389,12 +341,12 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const /* set the qspi line number and configure the QSPI bus */ if(rtt_dev->rt_spi_device->bus->mode &RT_SPI_BUS_MODE_QSPI) { qspi_dev = (struct rt_qspi_device *)rtt_dev->rt_spi_device; - qspi_cfg.qspi_dl_width = qspi_dev->config.qspi_dl_width; - rt_qspi_configure(qspi_dev, &qspi_cfg); + qspi_cfg->qspi_dl_width = qspi_dev->config.qspi_dl_width; + rt_qspi_configure(qspi_dev, qspi_cfg); } else #endif - rt_spi_configure(rtt_dev->rt_spi_device, &cfg); + rt_spi_configure(rtt_dev->rt_spi_device, spi_cfg); } /* SFUD flash device initialize */ { @@ -406,7 +358,7 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const sfud_dev->user_data = rtt_dev; /* initialize SFUD device */ if (sfud_device_init(sfud_dev) != SFUD_SUCCESS) { - rt_kprintf("ERROR: SPI flash probe failed by SPI device %s.\n", spi_dev_name); + LOG_E("ERROR: SPI flash probe failed by SPI device %s.", spi_dev_name); goto error; } /* when initialize success, then copy SFUD flash device's geometry to RT-Thread SPI flash device */ @@ -416,8 +368,8 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const #ifdef SFUD_USING_QSPI /* reconfigure the QSPI bus for medium size */ if(rtt_dev->rt_spi_device->bus->mode &RT_SPI_BUS_MODE_QSPI) { - qspi_cfg.medium_size = sfud_dev->chip.capacity; - rt_qspi_configure(qspi_dev, &qspi_cfg); + qspi_cfg->medium_size = sfud_dev->chip.capacity; + rt_qspi_configure(qspi_dev, qspi_cfg); if(qspi_dev->enter_qspi_mode != RT_NULL) qspi_dev->enter_qspi_mode(qspi_dev); @@ -442,10 +394,10 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const rt_device_register(&(rtt_dev->flash_device), spi_flash_dev_name, RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_STANDALONE); - DEBUG_TRACE("Probe SPI flash %s by SPI device %s success.\n",spi_flash_dev_name, spi_dev_name); + LOG_I("Probe SPI flash %s by SPI device %s success.",spi_flash_dev_name, spi_dev_name); return rtt_dev; } else { - rt_kprintf("ERROR: Low memory.\n"); + LOG_E("ERROR: Low memory."); goto error; } @@ -463,6 +415,26 @@ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const return RT_NULL; } +/** + * Probe SPI flash by SFUD(Serial Flash Universal Driver) driver library and though SPI device. + * + * @param spi_flash_dev_name the name which will create SPI flash device + * @param spi_dev_name using SPI device name + * + * @return probed SPI flash device, probe failed will return RT_NULL + */ +rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name) +{ + struct rt_spi_configuration cfg = RT_SFUD_DEFAULT_SPI_CFG; +#ifndef SFUD_USING_QSPI + return rt_sfud_flash_probe_ex(spi_flash_dev_name, spi_dev_name, &cfg, RT_NULL); +#else + struct rt_qspi_configuration qspi_cfg = RT_SFUD_DEFAULT_QSPI_CFG; + + return rt_sfud_flash_probe_ex(spi_flash_dev_name, spi_dev_name, &cfg, &qspi_cfg); +#endif +} + /** * Delete SPI flash device * @@ -496,7 +468,7 @@ sfud_flash_t rt_sfud_flash_find(const char *spi_dev_name) rt_spi_device = (struct rt_spi_device *) rt_device_find(spi_dev_name); if (rt_spi_device == RT_NULL || rt_spi_device->parent.type != RT_Device_Class_SPIDevice) { - rt_kprintf("ERROR: SPI device %s not found!\n", spi_dev_name); + LOG_E("ERROR: SPI device %s not found!", spi_dev_name); goto __error; } @@ -505,7 +477,7 @@ sfud_flash_t rt_sfud_flash_find(const char *spi_dev_name) sfud_dev = (sfud_flash_t) (rtt_dev->user_data); return sfud_dev; } else { - rt_kprintf("ERROR: SFUD flash device not found!\n"); + LOG_E("ERROR: SFUD flash device not found!"); goto __error; } @@ -520,7 +492,7 @@ sfud_flash_t rt_sfud_flash_find_by_dev_name(const char *flash_dev_name) rtt_dev = (rt_spi_flash_device_t) rt_device_find(flash_dev_name); if (rtt_dev == RT_NULL || rtt_dev->flash_device.type != RT_Device_Class_Block) { - rt_kprintf("ERROR: Flash device %s not found!\n", flash_dev_name); + LOG_E("ERROR: Flash device %s not found!", flash_dev_name); goto __error; } @@ -528,7 +500,7 @@ sfud_flash_t rt_sfud_flash_find_by_dev_name(const char *flash_dev_name) sfud_dev = (sfud_flash_t) (rtt_dev->user_data); return sfud_dev; } else { - rt_kprintf("ERROR: SFUD flash device not found!\n"); + LOG_E("ERROR: SFUD flash device not found!"); goto __error; } @@ -712,11 +684,13 @@ static void sf(uint8_t argc, char **argv) { addr = 0; size = sfud_dev->chip.capacity; uint32_t start_time, time_cast; - size_t write_size = SFUD_WRITE_MAX_PAGE_SIZE, read_size = SFUD_WRITE_MAX_PAGE_SIZE; + size_t write_size = SFUD_WRITE_MAX_PAGE_SIZE, read_size = SFUD_WRITE_MAX_PAGE_SIZE, cur_op_size; uint8_t *write_data = rt_malloc(write_size), *read_data = rt_malloc(read_size); if (write_data && read_data) { - rt_memset(write_data, 0x55, write_size); + for (i = 0; i < write_size; i ++) { + write_data[i] = i & 0xFF; + } /* benchmark testing */ rt_kprintf("Erasing the %s %ld bytes data, waiting...\n", sfud_dev->name, size); start_time = rt_tick_get(); @@ -732,7 +706,12 @@ static void sf(uint8_t argc, char **argv) { rt_kprintf("Writing the %s %ld bytes data, waiting...\n", sfud_dev->name, size); start_time = rt_tick_get(); for (i = 0; i < size; i += write_size) { - result = sfud_write(sfud_dev, addr + i, write_size, write_data); + if (i + write_size <= size) { + cur_op_size = write_size; + } else { + cur_op_size = size - i; + } + result = sfud_write(sfud_dev, addr + i, cur_op_size, write_data); if (result != SFUD_SUCCESS) { rt_kprintf("Writing %s failed, already wr for %lu bytes, write %d each time\n", sfud_dev->name, i, write_size); break; @@ -750,12 +729,13 @@ static void sf(uint8_t argc, char **argv) { start_time = rt_tick_get(); for (i = 0; i < size; i += read_size) { if (i + read_size <= size) { - result = sfud_read(sfud_dev, addr + i, read_size, read_data); + cur_op_size = read_size; } else { - result = sfud_read(sfud_dev, addr + i, size - i, read_data); + cur_op_size = size - i; } + result = sfud_read(sfud_dev, addr + i, cur_op_size, read_data); /* data check */ - if (memcmp(write_data, read_data, read_size)) + if (memcmp(write_data, read_data, cur_op_size)) { rt_kprintf("Data check ERROR! Please check you flash by other command.\n"); result = SFUD_ERR_READ; diff --git a/components/drivers/spi/spi_flash_sfud.h b/components/drivers/spi/spi_flash_sfud.h index 490f2fead..0d5a751d0 100644 --- a/components/drivers/spi/spi_flash_sfud.h +++ b/components/drivers/spi/spi_flash_sfud.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -26,6 +26,19 @@ */ rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name); +/** + * Probe SPI flash by SFUD (Serial Flash Universal Driver) driver library and though SPI device by specified configuration. + * + * @param spi_flash_dev_name the name which will create SPI flash device + * @param spi_dev_name using SPI device name + * @param spi_cfg SPI device configuration + * @param qspi_cfg QSPI device configuration + * + * @return probed SPI flash device, probe failed will return RT_NULL + */ +rt_spi_flash_device_t rt_sfud_flash_probe_ex(const char *spi_flash_dev_name, const char *spi_dev_name, + struct rt_spi_configuration *spi_cfg, struct rt_qspi_configuration *qspi_cfg); + /** * Delete SPI flash device * diff --git a/components/drivers/spi/spi_msd.c b/components/drivers/spi/spi_msd.c index a109fd948..875ae3c48 100644 --- a/components/drivers/spi/spi_msd.c +++ b/components/drivers/spi/spi_msd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -234,24 +234,30 @@ static rt_err_t _send_cmd( else if (type == response_r2) { /* initial message */ + /* Prevent non-aligned address access, use recv_buffer to receive data */ message.send_buf = RT_NULL; - message.recv_buf = response + 1; + message.recv_buf = recv_buffer; message.length = 1; message.cs_take = message.cs_release = 0; /* transfer message */ device->bus->ops->xfer(device, &message); + response[1] = recv_buffer[0]; } else if ((type == response_r3) || (type == response_r7)) { /* initial message */ message.send_buf = RT_NULL; - message.recv_buf = response + 1; + message.recv_buf = recv_buffer; message.length = 4; message.cs_take = message.cs_release = 0; /* transfer message */ device->bus->ops->xfer(device, &message); + response[1] = recv_buffer[0]; + response[2] = recv_buffer[1]; + response[3] = recv_buffer[2]; + response[4] = recv_buffer[3]; } else { @@ -429,7 +435,7 @@ static rt_err_t _write_block(struct rt_spi_device *device, const void *buffer, u } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops msd_ops = +const static struct rt_device_ops msd_ops = { rt_msd_init, rt_msd_open, @@ -439,7 +445,7 @@ const static struct rt_device_ops msd_ops = rt_msd_control }; -const static struct rt_device_ops msd_sdhc_ops = +const static struct rt_device_ops msd_sdhc_ops = { rt_msd_init, rt_msd_open, diff --git a/components/drivers/spi/spi_msd.h b/components/drivers/spi/spi_msd.h index 637017092..e9febca78 100644 --- a/components/drivers/spi/spi_msd.h +++ b/components/drivers/spi/spi_msd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -93,12 +93,12 @@ */ typedef enum { - MSD_CARD_TYPE_UNKNOWN = 0, /**< unknown */ - MSD_CARD_TYPE_MMC, /**< MultiMedia Card */ - MSD_CARD_TYPE_SD_V1_X, /**< Ver 1.X Standard Capacity SD Memory Card */ - MSD_CARD_TYPE_SD_V2_X, /**< Ver 2.00 or later Standard Capacity SD Memory Card */ - MSD_CARD_TYPE_SD_SDHC, /**< High Capacity SD Memory Card */ - MSD_CARD_TYPE_SD_SDXC, /**< later Extended Capacity SD Memory Card */ + MSD_CARD_TYPE_UNKNOWN = 0, /**< unknown */ + MSD_CARD_TYPE_MMC, /**< MultiMedia Card */ + MSD_CARD_TYPE_SD_V1_X, /**< Ver 1.X Standard Capacity SD Memory Card */ + MSD_CARD_TYPE_SD_V2_X, /**< Ver 2.00 or later Standard Capacity SD Memory Card */ + MSD_CARD_TYPE_SD_SDHC, /**< High Capacity SD Memory Card */ + MSD_CARD_TYPE_SD_SDXC, /**< later Extended Capacity SD Memory Card */ }msd_card_type; typedef enum diff --git a/components/drivers/spi/spi_wifi_rw009.c b/components/drivers/spi/spi_wifi_rw009.c index 4ddd18ca1..388812d4f 100644 --- a/components/drivers/spi/spi_wifi_rw009.c +++ b/components/drivers/spi/spi_wifi_rw009.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/drivers/spi/spi_wifi_rw009.h b/components/drivers/spi/spi_wifi_rw009.h index 049b0a848..89ed17fb2 100644 --- a/components/drivers/spi/spi_wifi_rw009.h +++ b/components/drivers/spi/spi_wifi_rw009.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/drivers/src/completion.c b/components/drivers/src/completion.c index 9e461e49c..b91ae3d6d 100644 --- a/components/drivers/src/completion.c +++ b/components/drivers/src/completion.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/src/dataqueue.c b/components/drivers/src/dataqueue.c index 7553986b9..f32efa184 100644 --- a/components/drivers/src/dataqueue.c +++ b/components/drivers/src/dataqueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,6 +13,8 @@ #include #include +#define DATAQUEUE_MAGIC 0xbead0e0e + struct rt_data_item { const void *data_ptr; @@ -26,14 +28,18 @@ rt_data_queue_init(struct rt_data_queue *queue, void (*evt_notify)(struct rt_data_queue *queue, rt_uint32_t event)) { RT_ASSERT(queue != RT_NULL); + RT_ASSERT(size > 0); queue->evt_notify = evt_notify; + queue->magic = DATAQUEUE_MAGIC; queue->size = size; queue->lwm = lwm; queue->get_index = 0; queue->put_index = 0; + queue->is_empty = 1; + queue->is_full = 0; rt_list_init(&(queue->suspended_push_list)); rt_list_init(&(queue->suspended_pop_list)); @@ -56,14 +62,15 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, rt_ubase_t level; rt_thread_t thread; rt_err_t result; - + RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); result = RT_EOK; thread = rt_thread_self(); level = rt_hw_interrupt_disable(); - while (queue->put_index - queue->get_index == queue->size) + while (queue->is_full) { /* queue is full */ if (timeout == 0) @@ -78,7 +85,7 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, /* reset thread error number */ thread->error = RT_EOK; - + /* suspend thread on the push list */ rt_thread_suspend(thread); rt_list_insert_before(&(queue->suspended_push_list), &(thread->tlist)); @@ -104,9 +111,18 @@ rt_err_t rt_data_queue_push(struct rt_data_queue *queue, if (result != RT_EOK) goto __exit; } - queue->queue[queue->put_index % queue->size].data_ptr = data_ptr; - queue->queue[queue->put_index % queue->size].data_size = data_size; + queue->queue[queue->put_index].data_ptr = data_ptr; + queue->queue[queue->put_index].data_size = data_size; queue->put_index += 1; + if (queue->put_index == queue->size) + { + queue->put_index = 0; + } + queue->is_empty = 0; + if (queue->put_index == queue->get_index) + { + queue->is_full = 1; + } /* there is at least one thread in suspended list */ if (!rt_list_isempty(&(queue->suspended_pop_list))) @@ -139,7 +155,7 @@ RTM_EXPORT(rt_data_queue_push); rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, const void** data_ptr, - rt_size_t *size, + rt_size_t *size, rt_int32_t timeout) { rt_ubase_t level; @@ -147,6 +163,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, rt_err_t result; RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); RT_ASSERT(data_ptr != RT_NULL); RT_ASSERT(size != RT_NULL); @@ -154,7 +171,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, thread = rt_thread_self(); level = rt_hw_interrupt_disable(); - while (queue->get_index == queue->put_index) + while (queue->is_empty) { /* queue is empty */ if (timeout == 0) @@ -168,7 +185,7 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, /* reset thread error number */ thread->error = RT_EOK; - + /* suspend thread on the pop list */ rt_thread_suspend(thread); rt_list_insert_before(&(queue->suspended_pop_list), &(thread->tlist)); @@ -195,12 +212,20 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, goto __exit; } - *data_ptr = queue->queue[queue->get_index % queue->size].data_ptr; - *size = queue->queue[queue->get_index % queue->size].data_size; - + *data_ptr = queue->queue[queue->get_index].data_ptr; + *size = queue->queue[queue->get_index].data_size; queue->get_index += 1; + if (queue->get_index == queue->size) + { + queue->get_index = 0; + } + queue->is_full = 0; + if (queue->put_index == queue->get_index) + { + queue->is_empty = 1; + } - if ((queue->put_index - queue->get_index) <= queue->lwm) + if (rt_data_queue_len(queue) <= queue->lwm) { /* there is at least one thread in suspended list */ if (!rt_list_isempty(&(queue->suspended_push_list))) @@ -239,36 +264,47 @@ rt_err_t rt_data_queue_pop(struct rt_data_queue *queue, } RTM_EXPORT(rt_data_queue_pop); -rt_err_t rt_data_queue_peak(struct rt_data_queue *queue, +rt_err_t rt_data_queue_peek(struct rt_data_queue *queue, const void** data_ptr, rt_size_t *size) { rt_ubase_t level; RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); - level = rt_hw_interrupt_disable(); - - if (queue->get_index == queue->put_index) + if (queue->is_empty) { - rt_hw_interrupt_enable(level); - return -RT_EEMPTY; } - *data_ptr = queue->queue[queue->get_index % queue->size].data_ptr; - *size = queue->queue[queue->get_index % queue->size].data_size; + level = rt_hw_interrupt_disable(); + + *data_ptr = queue->queue[queue->get_index].data_ptr; + *size = queue->queue[queue->get_index].data_size; rt_hw_interrupt_enable(level); return RT_EOK; } -RTM_EXPORT(rt_data_queue_peak); +RTM_EXPORT(rt_data_queue_peek); void rt_data_queue_reset(struct rt_data_queue *queue) { + rt_ubase_t level; struct rt_thread *thread; - register rt_ubase_t temp; + + RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); + + level = rt_hw_interrupt_disable(); + + queue->get_index = 0; + queue->put_index = 0; + queue->is_empty = 1; + queue->is_full = 0; + + rt_hw_interrupt_enable(level); rt_enter_critical(); /* wakeup all suspend threads */ @@ -277,7 +313,7 @@ void rt_data_queue_reset(struct rt_data_queue *queue) while (!rt_list_isempty(&(queue->suspended_pop_list))) { /* disable interrupt */ - temp = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); /* get next suspend thread */ thread = rt_list_entry(queue->suspended_pop_list.next, @@ -294,14 +330,14 @@ void rt_data_queue_reset(struct rt_data_queue *queue) rt_thread_resume(thread); /* enable interrupt */ - rt_hw_interrupt_enable(temp); + rt_hw_interrupt_enable(level); } /* resume on push list */ while (!rt_list_isempty(&(queue->suspended_push_list))) { /* disable interrupt */ - temp = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); /* get next suspend thread */ thread = rt_list_entry(queue->suspended_push_list.next, @@ -318,10 +354,61 @@ void rt_data_queue_reset(struct rt_data_queue *queue) rt_thread_resume(thread); /* enable interrupt */ - rt_hw_interrupt_enable(temp); + rt_hw_interrupt_enable(level); } rt_exit_critical(); rt_schedule(); } RTM_EXPORT(rt_data_queue_reset); + +rt_err_t rt_data_queue_deinit(struct rt_data_queue *queue) +{ + rt_ubase_t level; + + RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); + + /* wakeup all suspend threads */ + rt_data_queue_reset(queue); + + level = rt_hw_interrupt_disable(); + queue->magic = 0; + rt_hw_interrupt_enable(level); + + rt_free(queue->queue); + + return RT_EOK; +} +RTM_EXPORT(rt_data_queue_deinit); + +rt_uint16_t rt_data_queue_len(struct rt_data_queue *queue) +{ + rt_ubase_t level; + rt_int16_t len; + + RT_ASSERT(queue != RT_NULL); + RT_ASSERT(queue->magic == DATAQUEUE_MAGIC); + + if (queue->is_empty) + { + return 0; + } + + level = rt_hw_interrupt_disable(); + + if (queue->put_index > queue->get_index) + { + len = queue->put_index - queue->get_index; + } + else + { + len = queue->size + queue->put_index - queue->get_index; + } + + rt_hw_interrupt_enable(level); + + return len; +} +RTM_EXPORT(rt_data_queue_len); + diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index ae87b6f5f..3b0b5fc20 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -323,18 +323,29 @@ static const struct dfs_file_ops pipe_fops = rt_err_t rt_pipe_open (rt_device_t device, rt_uint16_t oflag) { rt_pipe_t *pipe = (rt_pipe_t *)device; + rt_err_t ret = RT_EOK; + + if (device == RT_NULL) + { + ret = -RT_EINVAL; + goto __exit; + } - if (device == RT_NULL) return -RT_EINVAL; rt_mutex_take(&(pipe->lock), RT_WAITING_FOREVER); if (pipe->fifo == RT_NULL) { pipe->fifo = rt_ringbuffer_create(pipe->bufsz); + if (pipe->fifo == RT_NULL) + { + ret = -RT_ENOMEM; + } } rt_mutex_release(&(pipe->lock)); - return RT_EOK; +__exit: + return ret; } rt_err_t rt_pipe_close (rt_device_t device) @@ -417,7 +428,7 @@ rt_err_t rt_pipe_control(rt_device_t dev, int cmd, void *args) } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops pipe_ops = +const static struct rt_device_ops pipe_ops = { RT_NULL, rt_pipe_open, @@ -496,7 +507,7 @@ int rt_pipe_delete(const char *name) rt_device_unregister(device); /* close fifo ringbuffer */ - if (pipe->fifo) + if (pipe->fifo) { rt_ringbuffer_destroy(pipe->fifo); pipe->fifo = RT_NULL; @@ -553,7 +564,7 @@ int pipe(int fildes[2]) int mkfifo(const char *path, mode_t mode) { rt_pipe_t *pipe; - + pipe = rt_pipe_create(path, PIPE_BUFSZ); if (pipe == RT_NULL) { diff --git a/components/drivers/src/ringblk_buf.c b/components/drivers/src/ringblk_buf.c index 7d83149c5..c9631b9d4 100644 --- a/components/drivers/src/ringblk_buf.c +++ b/components/drivers/src/ringblk_buf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c index c6a491a7c..29de20b08 100644 --- a/components/drivers/src/ringbuffer.c +++ b/components/drivers/src/ringbuffer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -193,6 +193,40 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, } RTM_EXPORT(rt_ringbuffer_get); +/** + * peak data from ring buffer + */ +rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) +{ + RT_ASSERT(rb != RT_NULL); + + *ptr = RT_NULL; + + /* whether has enough data */ + rt_size_t size = rt_ringbuffer_data_len(rb); + + /* no data */ + if (size == 0) + return 0; + + *ptr = &rb->buffer_ptr[rb->read_index]; + + if(rb->buffer_size - rb->read_index > size) + { + rb->read_index += size; + return size; + } + + size = rb->buffer_size - rb->read_index; + + /* we are going into the other side of the mirror */ + rb->read_mirror = ~rb->read_mirror; + rb->read_index = 0; + + return size; +} +RTM_EXPORT(rt_ringbuffer_peak); + /** * put a character into ring buffer */ @@ -286,8 +320,8 @@ rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch) } RTM_EXPORT(rt_ringbuffer_getchar); -/** - * get the size of data in rb +/** + * get the size of data in rb */ rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb) { @@ -307,8 +341,8 @@ rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb) } RTM_EXPORT(rt_ringbuffer_data_len); -/** - * empty the rb +/** + * empty the rb */ void rt_ringbuffer_reset(struct rt_ringbuffer *rb) { @@ -328,7 +362,7 @@ struct rt_ringbuffer* rt_ringbuffer_create(rt_uint16_t size) struct rt_ringbuffer *rb; rt_uint8_t *pool; - RT_ASSERT(size > 0); + RT_ASSERT(size > 0); size = RT_ALIGN_DOWN(size, RT_ALIGN_SIZE); diff --git a/components/drivers/src/waitqueue.c b/components/drivers/src/waitqueue.c index 02240edbd..f9a6d6e12 100644 --- a/components/drivers/src/waitqueue.c +++ b/components/drivers/src/waitqueue.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2018/06/26 Bernard Fix the wait queue issue when wakeup a soon + * 2018/06/26 Bernard Fix the wait queue issue when wakeup a soon * to blocked thread. */ diff --git a/components/drivers/src/workqueue.c b/components/drivers/src/workqueue.c index 2e0280df3..e83db0a33 100644 --- a/components/drivers/src/workqueue.c +++ b/components/drivers/src/workqueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -424,6 +424,6 @@ int rt_work_sys_workqueue_init(void) return RT_EOK; } -INIT_DEVICE_EXPORT(rt_work_sys_workqueue_init); +INIT_PREV_EXPORT(rt_work_sys_workqueue_init); #endif #endif diff --git a/components/drivers/touch/SConscript b/components/drivers/touch/SConscript index f370b2aba..6c2a126c9 100644 --- a/components/drivers/touch/SConscript +++ b/components/drivers/touch/SConscript @@ -6,6 +6,6 @@ cwd = GetCurrentDir() src = ['touch.c'] CPPPATH = [cwd, cwd + '/../include'] -group = DefineGroup('Touch', src, depend = ['RT_USING_TOUCH', 'RT_USING_DEVICE'], CPPPATH = CPPPATH) +group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_TOUCH', 'RT_USING_DEVICE'], CPPPATH = CPPPATH) Return('group') diff --git a/components/drivers/touch/touch.c b/components/drivers/touch/touch.c index 80ba6378b..abe2c0fe2 100644 --- a/components/drivers/touch/touch.c +++ b/components/drivers/touch/touch.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,12 +16,9 @@ #include /* ISR for touch interrupt */ -static void irq_callback(void *args) +void rt_hw_touch_isr(rt_touch_t touch) { - rt_touch_t touch; - - touch = (rt_touch_t)args; - + RT_ASSERT(touch); if (touch->parent.rx_indicate == RT_NULL) { return; @@ -35,9 +32,17 @@ static void irq_callback(void *args) touch->parent.rx_indicate(&touch->parent, 1); } +#ifdef RT_TOUCH_PIN_IRQ +static void touch_irq_callback(void *param) +{ + rt_hw_touch_isr((rt_touch_t)param); +} +#endif + /* touch interrupt initialization function */ static rt_err_t rt_touch_irq_init(rt_touch_t touch) { +#ifdef RT_TOUCH_PIN_IRQ if (touch->config.irq_pin.pin == RT_PIN_NONE) { return -RT_EINVAL; @@ -47,18 +52,19 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch) if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLDOWN) { - rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING, irq_callback, (void *)touch); + rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING, touch_irq_callback, (void *)touch); } else if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLUP) { - rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_FALLING, irq_callback, (void *)touch); + rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_FALLING, touch_irq_callback, (void *)touch); } else if (touch->config.irq_pin.mode == PIN_MODE_INPUT) { - rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING_FALLING, irq_callback, (void *)touch); + rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING_FALLING, touch_irq_callback, (void *)touch); } rt_pin_irq_enable(touch->config.irq_pin.pin, PIN_IRQ_ENABLE); +#endif return RT_EOK; } @@ -66,19 +72,23 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch) /* touch interrupt enable */ static void rt_touch_irq_enable(rt_touch_t touch) { +#ifdef RT_TOUCH_PIN_IRQ if (touch->config.irq_pin.pin != RT_PIN_NONE) { rt_pin_irq_enable(touch->config.irq_pin.pin, RT_TRUE); } +#endif } /* touch interrupt disable */ static void rt_touch_irq_disable(rt_touch_t touch) { +#ifdef RT_TOUCH_PIN_IRQ if (touch->config.irq_pin.pin != RT_PIN_NONE) { rt_pin_irq_enable(touch->config.irq_pin.pin, RT_FALSE); } +#endif } static rt_err_t rt_touch_open(rt_device_t dev, rt_uint16_t oflag) diff --git a/components/drivers/touch/touch.h b/components/drivers/touch/touch.h index 6b7288a5a..677e554de 100644 --- a/components/drivers/touch/touch.h +++ b/components/drivers/touch/touch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -63,7 +63,9 @@ struct rt_touch_info struct rt_touch_config { +#ifdef RT_TOUCH_PIN_IRQ struct rt_device_pin_mode irq_pin; /* Interrupt pin, The purpose of this pin is to notification read data */ +#endif char *dev_name; /* The name of the communication device */ void *user_data; }; @@ -100,6 +102,9 @@ int rt_hw_touch_register(rt_touch_t touch, rt_uint32_t flag, void *data); +/* if you doesn't use pin device. you must call this function in your touch irq callback */ +void rt_hw_touch_isr(rt_touch_t touch); + #ifdef __cplusplus } #endif diff --git a/components/drivers/usb/usbdevice/SConscript b/components/drivers/usb/usbdevice/SConscript index 010b9837a..b6dfa8da1 100644 --- a/components/drivers/usb/usbdevice/SConscript +++ b/components/drivers/usb/usbdevice/SConscript @@ -3,7 +3,7 @@ from building import * cwd = GetCurrentDir() src = Split(""" -core/core.c +core/usbdevice_core.c core/usbdevice.c """) diff --git a/components/drivers/usb/usbdevice/class/audio_mic.c b/components/drivers/usb/usbdevice/class/audio_mic.c index 4ac85711a..760c055d1 100644 --- a/components/drivers/usb/usbdevice/class/audio_mic.c +++ b/components/drivers/usb/usbdevice/class/audio_mic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,10 +9,7 @@ */ #include -#include -#include #include - #include "drivers/usb_device.h" #include "audio.h" diff --git a/components/drivers/usb/usbdevice/class/audio_speaker.c b/components/drivers/usb/usbdevice/class/audio_speaker.c index 84c36d205..c8bbb9cb5 100644 --- a/components/drivers/usb/usbdevice/class/audio_speaker.c +++ b/components/drivers/usb/usbdevice/class/audio_speaker.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,10 +9,7 @@ */ #include -#include -#include #include - #include "drivers/usb_device.h" #include "audio.h" diff --git a/components/drivers/usb/usbdevice/class/cdc.h b/components/drivers/usb/usbdevice/class/cdc.h index 4e07f1626..a4616a956 100644 --- a/components/drivers/usb/usbdevice/class/cdc.h +++ b/components/drivers/usb/usbdevice/class/cdc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2012-10-03 Yi Qiu first version * 2012-12-12 heyuanjie87 add CDC endpoints collection */ - + #ifndef __CDC_H__ #define __CDC_H__ @@ -96,7 +96,7 @@ struct ucdc_header_descriptor rt_uint8_t length; rt_uint8_t type; rt_uint8_t subtype; - rt_uint16_t bcd; + rt_uint16_t bcd; }; typedef struct ucdc_header_descriptor* ucdc_hdr_desc_t; @@ -114,7 +114,7 @@ struct ucdc_call_mgmt_descriptor rt_uint8_t length; rt_uint8_t type; rt_uint8_t subtype; - rt_uint8_t capabilties; + rt_uint8_t capabilties; rt_uint8_t data_interface; }; typedef struct ucdc_call_mgmt_descriptor* ucdc_call_mgmt_desc_t; @@ -136,9 +136,9 @@ struct ucdc_comm_descriptor #endif struct uinterface_descriptor intf_desc; struct ucdc_header_descriptor hdr_desc; - struct ucdc_call_mgmt_descriptor call_mgmt_desc; - struct ucdc_acm_descriptor acm_desc; - struct ucdc_union_descriptor union_desc; + struct ucdc_call_mgmt_descriptor call_mgmt_desc; + struct ucdc_acm_descriptor acm_desc; + struct ucdc_union_descriptor union_desc; struct uendpoint_descriptor ep_desc; }; typedef struct ucdc_comm_descriptor* ucdc_comm_desc_t; @@ -170,7 +170,7 @@ typedef struct ucdc_eth_descriptor* ucdc_eth_desc_t; struct ucdc_data_descriptor { struct uinterface_descriptor intf_desc; - struct uendpoint_descriptor ep_out_desc; + struct uendpoint_descriptor ep_out_desc; struct uendpoint_descriptor ep_in_desc; }; typedef struct ucdc_data_descriptor* ucdc_data_desc_t; diff --git a/components/drivers/usb/usbdevice/class/cdc_vcom.c b/components/drivers/usb/usbdevice/class/cdc_vcom.c index b6044b37a..73a6629a6 100644 --- a/components/drivers/usb/usbdevice/class/cdc_vcom.c +++ b/components/drivers/usb/usbdevice/class/cdc_vcom.c @@ -1,20 +1,18 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2012-10-02 Yi Qiu first version - * 2012-12-12 heyuanjie87 change endpoints and function handler + * 2012-12-12 heyuanjie87 change endpoints and function handler * 2013-06-25 heyuanjie87 remove SOF mechinism * 2013-07-20 Yi Qiu do more test * 2016-02-01 Urey Fix some error */ #include -#include -#include #include #include #include "drivers/usb_device.h" @@ -144,23 +142,23 @@ const static struct ucdc_comm_descriptor _comm_desc = USB_DESC_LENGTH_INTERFACE, USB_DESC_TYPE_INTERFACE, USB_DYNAMIC, - 0x00, + 0x00, 0x01, USB_CDC_CLASS_COMM, USB_CDC_SUBCLASS_ACM, USB_CDC_PROTOCOL_V25TER, 0x00, }, - /* Header Functional Descriptor */ + /* Header Functional Descriptor */ { - 0x05, + 0x05, USB_CDC_CS_INTERFACE, USB_CDC_SCS_HEADER, 0x0110, }, - /* Call Management Functional Descriptor */ + /* Call Management Functional Descriptor */ { - 0x05, + 0x05, USB_CDC_CS_INTERFACE, USB_CDC_SCS_CALL_MGMT, 0x00, @@ -173,7 +171,7 @@ const static struct ucdc_comm_descriptor _comm_desc = USB_CDC_SCS_ACM, 0x02, }, - /* Union Functional Descriptor */ + /* Union Functional Descriptor */ { 0x05, USB_CDC_CS_INTERFACE, @@ -181,7 +179,7 @@ const static struct ucdc_comm_descriptor _comm_desc = USB_DYNAMIC, USB_DYNAMIC, }, - /* Endpoint Descriptor */ + /* Endpoint Descriptor */ { USB_DESC_LENGTH_ENDPOINT, USB_DESC_TYPE_ENDPOINT, @@ -202,27 +200,27 @@ const static struct ucdc_data_descriptor _data_desc = USB_DESC_TYPE_INTERFACE, USB_DYNAMIC, 0x00, - 0x02, + 0x02, USB_CDC_CLASS_DATA, - 0x00, - 0x00, - 0x00, + 0x00, + 0x00, + 0x00, }, /* endpoint, bulk out */ { - USB_DESC_LENGTH_ENDPOINT, + USB_DESC_LENGTH_ENDPOINT, USB_DESC_TYPE_ENDPOINT, USB_DYNAMIC | USB_DIR_OUT, - USB_EP_ATTR_BULK, + USB_EP_ATTR_BULK, USB_CDC_BUFSIZE, - 0x00, + 0x00, }, /* endpoint, bulk in */ { USB_DESC_LENGTH_ENDPOINT, USB_DESC_TYPE_ENDPOINT, USB_DYNAMIC | USB_DIR_IN, - USB_EP_ATTR_BULK, + USB_EP_ATTR_BULK, USB_CDC_BUFSIZE, 0x00, }, @@ -251,11 +249,11 @@ static void _vcom_reset_state(ufunction_t func) { struct vcom* data; int lvl; - + RT_ASSERT(func != RT_NULL) data = (struct vcom*)func->user_data; - + lvl = rt_hw_interrupt_disable(); data->connected = RT_FALSE; data->in_sending = RT_FALSE; @@ -297,9 +295,9 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size) return RT_EOK; } - + rt_completion_done(&data->wait); - + return RT_EOK; } @@ -394,7 +392,7 @@ static rt_err_t _cdc_set_line_coding_callback(udevice_t device, rt_size_t size) RT_DEBUG_LOG(RT_DEBUG_USB, ("_cdc_set_line_coding_callback\n")); dcd_ep0_send_status(device->dcd); - + return RT_EOK; } @@ -436,7 +434,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) RT_ASSERT(setup != RT_NULL); data = (struct vcom*)func->user_data; - + switch(setup->bRequest) { case CDC_SEND_ENCAPSULATED_COMMAND: @@ -486,16 +484,17 @@ static rt_err_t _function_enable(ufunction_t func) RT_DEBUG_LOG(RT_DEBUG_USB, ("cdc function enable\n")); _vcom_reset_state(func); - + data = (struct vcom*)func->user_data; data->ep_out->buffer = rt_malloc(CDC_RX_BUFSIZE); + RT_ASSERT(data->ep_out->buffer != RT_NULL); data->ep_out->request.buffer = data->ep_out->buffer; data->ep_out->request.size = EP_MAXPACKET(data->ep_out); - + data->ep_out->request.req_type = UIO_REQUEST_READ_BEST; rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); - + return RT_EOK; } @@ -520,7 +519,7 @@ static rt_err_t _function_disable(ufunction_t func) if(data->ep_out->buffer != RT_NULL) { rt_free(data->ep_out->buffer); - data->ep_out->buffer = RT_NULL; + data->ep_out->buffer = RT_NULL; } return RT_EOK; @@ -541,7 +540,7 @@ static struct ufunction_ops ops = * * @return RT_EOK on successful. */ -static rt_err_t _cdc_descriptor_config(ucdc_comm_desc_t comm, +static rt_err_t _cdc_descriptor_config(ucdc_comm_desc_t comm, rt_uint8_t cintf_nr, ucdc_data_desc_t data, rt_uint8_t dintf_nr) { comm->call_mgmt_desc.data_interface = dintf_nr; @@ -581,17 +580,19 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device) } /* set usb device string description */ rt_usbd_device_set_string(device, _ustring); - + /* create a cdc function */ func = rt_usbd_function_new(device, &dev_desc, &ops); - //not support HS - //rt_usbd_device_set_qualifier(device, &dev_qualifier); - + + /* support HS */ + rt_usbd_device_set_qualifier(device, &dev_qualifier); + /* allocate memory for cdc vcom data */ data = (struct vcom*)rt_malloc(sizeof(struct vcom)); + RT_ASSERT(data != RT_NULL); rt_memset(data, 0, sizeof(struct vcom)); func->user_data = (void*)data; - + /* initilize vcom */ rt_usb_vcom_init(func); @@ -641,7 +642,7 @@ ufunction_t rt_usbd_function_cdc_create(udevice_t device) /* add the cdc data interface to cdc function */ rt_usbd_function_add_interface(func, intf_data); - + return func; } @@ -677,7 +678,7 @@ static int _vcom_getc(struct rt_serial_device *serial) rt_uint32_t level; struct ufunction *func; struct vcom *data; - + func = (struct ufunction*)serial->parent.user_data; data = (struct vcom*)func->user_data; @@ -913,7 +914,7 @@ static void rt_usb_vcom_init(struct ufunction *func) rt_err_t result = RT_EOK; struct serial_configure config; struct vcom *data = (struct vcom*)func->user_data; - + /* initialize ring buffer */ rt_ringbuffer_init(&data->rx_ringbuffer, data->rx_rbp, CDC_RX_BUFSIZE); rt_ringbuffer_init(&data->tx_ringbuffer, data->tx_rbp, CDC_TX_BUFSIZE); @@ -947,9 +948,9 @@ static void rt_usb_vcom_init(struct ufunction *func) vcom_thread_stack, VCOM_TASK_STK_SIZE, 16, 20); result = rt_thread_startup(&vcom_thread); - RT_ASSERT(result == RT_EOK); + RT_ASSERT(result == RT_EOK); } -struct udclass vcom_class = +struct udclass vcom_class = { .rt_usbd_function_create = rt_usbd_function_cdc_create }; diff --git a/components/drivers/usb/usbdevice/class/ecm.c b/components/drivers/usb/usbdevice/class/ecm.c index b98b5007f..1550f8e1e 100644 --- a/components/drivers/usb/usbdevice/class/ecm.c +++ b/components/drivers/usb/usbdevice/class/ecm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -44,9 +44,9 @@ struct rt_ecm_eth ALIGN(4) char rx_buffer[USB_ETH_MTU]; char tx_buffer[USB_ETH_MTU]; - + struct rt_semaphore tx_buffer_free; - + }; typedef struct rt_ecm_eth * rt_ecm_eth_t; @@ -207,7 +207,7 @@ static rt_err_t _cdc_send_notifi(ufunction_t func,ucdc_notification_code_t notif _notifi.bNotificatinCode = notifi; _notifi.wValue = wValue; _notifi.wLength = wLength; - + eps->ep_cmd->request.buffer = (void *)&_notifi; eps->ep_cmd->request.size = 8; eps->ep_cmd->request.req_type = UIO_REQUEST_WRITE; @@ -220,7 +220,7 @@ static rt_err_t _ecm_set_eth_packet_filter(ufunction_t func, ureq_t setup) { rt_ecm_eth_t _ecm_eth = (rt_ecm_eth_t)func->user_data; dcd_ep0_send_status(func->device->dcd); - + /* send link up. */ eth_device_linkchange(&_ecm_eth->parent, RT_TRUE); _cdc_send_notifi(func, UCDC_NOTIFI_NETWORK_CONNECTION, 1, 0); @@ -292,7 +292,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) ecm_device->rx_size = ecm_device->rx_offset; ecm_device->rx_offset = 0; eth_device_ready(&ecm_device->parent); - + }else { ecm_device->eps.ep_out->request.buffer = ecm_device->eps.ep_out->buffer; @@ -419,15 +419,15 @@ rt_err_t rt_ecm_eth_tx(rt_device_t dev, struct pbuf* p) p->tot_len = USB_ETH_MTU; } - result = rt_sem_take(&device->tx_buffer_free, rt_tick_from_millisecond(1000)); + result = rt_sem_take(&ecm_eth_dev->tx_buffer_free, rt_tick_from_millisecond(1000)); if(result != RT_EOK) { LOG_W("wait for buffer free timeout"); /* if cost 1s to wait send done it said that connection is close . drop it */ - rt_sem_release(&device->tx_buffer_free); + rt_sem_release(&ecm_eth_dev->tx_buffer_free); return result; } - + pbuffer = (char *)&ecm_eth_dev->tx_buffer; for (q = p; q != NULL; q = q->next) { @@ -480,7 +480,7 @@ static rt_err_t _function_enable(ufunction_t func) /* reset eth rx tx */ ecm_device->rx_size = 0; ecm_device->rx_offset = 0; - + eps->ep_out->request.buffer = (void *)eps->ep_out->buffer; eps->ep_out->request.size = EP_MAXPACKET(eps->ep_out); eps->ep_out->request.req_type = UIO_REQUEST_READ_BEST; @@ -555,7 +555,7 @@ ufunction_t rt_usbd_function_ecm_create(udevice_t device) ualtsetting_t comm_setting, data_setting; ucdc_data_desc_t data_desc; ucdc_eth_desc_t comm_desc; - + /* parameter check */ RT_ASSERT(device != RT_NULL); @@ -565,7 +565,8 @@ ufunction_t rt_usbd_function_ecm_create(udevice_t device) /* create a cdc class */ cdc = rt_usbd_function_new(device, &_dev_desc, &ops); rt_usbd_device_set_qualifier(device, &dev_qualifier); - _ecm_eth= rt_malloc(sizeof(struct rt_ecm_eth)); + _ecm_eth= rt_malloc(sizeof(struct rt_ecm_eth)); + RT_ASSERT(_ecm_eth != RT_NULL); rt_memset(_ecm_eth, 0, sizeof(struct rt_ecm_eth)); cdc->user_data = _ecm_eth; @@ -599,7 +600,7 @@ ufunction_t rt_usbd_function_ecm_create(udevice_t device) rt_usbd_set_altsetting(intf_comm, 0); /* add the communication interface to the cdc class */ rt_usbd_function_add_interface(cdc, intf_comm); - + /* create a bulk in and a bulk out endpoint */ data_desc = (ucdc_data_desc_t)data_setting->desc; eps->ep_out = rt_usbd_endpoint_new(&data_desc->ep_out_desc, _ep_out_handler); @@ -647,14 +648,14 @@ ufunction_t rt_usbd_function_ecm_create(udevice_t device) _ecm_eth->parent.eth_tx = rt_ecm_eth_tx; /* register eth device */ eth_device_init(&_ecm_eth->parent, "u0"); - + /* send link up. */ eth_device_linkchange(&_ecm_eth->parent, RT_FALSE); - + return cdc; } -struct udclass ecm_class = +struct udclass ecm_class = { .rt_usbd_function_create = rt_usbd_function_ecm_create }; diff --git a/components/drivers/usb/usbdevice/class/hid.c b/components/drivers/usb/usbdevice/class/hid.c index a9b2e62d7..fae45bb0e 100644 --- a/components/drivers/usb/usbdevice/class/hid.c +++ b/components/drivers/usb/usbdevice/class/hid.c @@ -3,7 +3,7 @@ * COPYRIGHT (C) 2008 - 2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2017-03-13 Urey the first version @@ -11,13 +11,9 @@ */ #include -#include -#include #include - #include "drivers/usb_common.h" #include "drivers/usb_device.h" - #include "hid.h" #ifdef RT_USB_DEVICE_HID @@ -29,7 +25,7 @@ struct hid_s uep_t ep_in; uep_t ep_out; int status; - rt_uint16_t protocol; + rt_uint8_t protocol; rt_uint8_t report_buf[MAX_REPORT_SIZE]; struct rt_messagequeue hid_mq; }; @@ -246,7 +242,7 @@ static struct udevice_descriptor _dev_desc = USB_DESC_LENGTH_DEVICE, //bLength; USB_DESC_TYPE_DEVICE, //type; USB_BCD_VERSION, //bcdUSB; - USB_CLASS_HID, //bDeviceClass; + 0x0, //bDeviceClass; 0x00, //bDeviceSubClass; 0x00, //bDeviceProtocol; 64, //bMaxPacketSize0; @@ -266,8 +262,8 @@ static struct usb_qualifier_descriptor dev_qualifier = sizeof(dev_qualifier), //bLength USB_DESC_TYPE_DEVICEQUALIFIER, //bDescriptorType 0x0200, //bcdUSB - USB_CLASS_MASS_STORAGE, //bDeviceClass - 0x06, //bDeviceSubClass + 0x0, //bDeviceClass + 0x0, //bDeviceSubClass 0x50, //bDeviceProtocol 64, //bMaxPacketSize0 0x01, //bNumConfigurations @@ -347,7 +343,7 @@ const static struct uhid_comm_descriptor _hid_comm_desc = USB_DYNAMIC | USB_DIR_IN, USB_EP_ATTR_INT, 0x40, - 0x01, + 0x0A, }, /* Endpoint Descriptor OUT */ @@ -458,8 +454,6 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) struct hid_s *data = (struct hid_s *) func->user_data; - if(setup->wIndex != 0) - return -RT_EIO; switch (setup->bRequest) { @@ -489,7 +483,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) dcd_ep0_send_status(func->device->dcd); break; case USB_HID_REQ_GET_PROTOCOL: - rt_usbd_ep0_write(func->device, &data->protocol,2); + rt_usbd_ep0_write(func->device, &data->protocol,1); break; case USB_HID_REQ_SET_REPORT: @@ -627,12 +621,12 @@ static void hid_thread_entry(void* parameter) struct hid_report report; struct hid_s *hiddev; hiddev = (struct hid_s *)parameter; - while(1) - { - if(rt_mq_recv(&hiddev->hid_mq, &report, sizeof(report),RT_WAITING_FOREVER) != RT_EOK ) + while(1) + { + if(rt_mq_recv(&hiddev->hid_mq, &report, sizeof(report),RT_WAITING_FOREVER) != RT_EOK ) continue; - HID_Report_Received(&report); - } + HID_Report_Received(&report); + } } #ifdef RT_USING_DEVICE_OPS @@ -664,7 +658,7 @@ static void rt_usb_hid_init(struct ufunction *func) rt_device_register(&hiddev->parent, "hidd", RT_DEVICE_FLAG_RDWR); rt_mq_init(&hiddev->hid_mq, "hiddmq", hid_mq_pool, sizeof(struct hid_report), sizeof(hid_mq_pool), RT_IPC_FLAG_FIFO); - + rt_thread_init(&hid_thread, "hidd", hid_thread_entry, hiddev, hid_thread_stack, sizeof(hid_thread_stack), RT_USBD_THREAD_PRIO, 20); rt_thread_startup(&hid_thread); @@ -695,8 +689,9 @@ ufunction_t rt_usbd_function_hid_create(udevice_t device) /* create a cdc function */ func = rt_usbd_function_new(device, &_dev_desc, &ops); - //not support hs - //rt_usbd_device_set_qualifier(device, &_dev_qualifier); + + /* For high speed mode supporting */ + rt_usbd_device_set_qualifier(device, &dev_qualifier); /* allocate memory for cdc vcom data */ data = (struct hid_s*)rt_malloc(sizeof(struct hid_s)); @@ -735,7 +730,7 @@ ufunction_t rt_usbd_function_hid_create(udevice_t device) rt_usb_hid_init(func); return func; } -struct udclass hid_class = +struct udclass hid_class = { .rt_usbd_function_create = rt_usbd_function_hid_create }; diff --git a/components/drivers/usb/usbdevice/class/hid.h b/components/drivers/usb/usbdevice/class/hid.h index 4d0f314a1..2b6a4ad90 100644 --- a/components/drivers/usb/usbdevice/class/hid.h +++ b/components/drivers/usb/usbdevice/class/hid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/usb/usbdevice/class/mstorage.c b/components/drivers/usb/usbdevice/class/mstorage.c index 6a6e92415..89be813ad 100644 --- a/components/drivers/usb/usbdevice/class/mstorage.c +++ b/components/drivers/usb/usbdevice/class/mstorage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,12 +7,11 @@ * Date Author Notes * 2012-10-01 Yi Qiu first version * 2012-11-25 Heyuanjie87 reduce the memory consumption - * 2012-12-09 Heyuanjie87 change function and endpoint handler + * 2012-12-09 Heyuanjie87 change function and endpoint handler * 2013-07-25 Yi Qiu update for USB CV test */ #include -#include #include "drivers/usb_device.h" #include "mstorage.h" @@ -21,10 +20,10 @@ enum STAT { STAT_CBW, - STAT_CMD, + STAT_CMD, STAT_CSW, STAT_RECEIVE, - STAT_SEND, + STAT_SEND, }; typedef enum @@ -46,7 +45,7 @@ typedef rt_size_t (*cbw_handler)(ufunction_t func, ustorage_cbw_t cbw); struct scsi_cmd { rt_uint16_t cmd; - cbw_handler handler; + cbw_handler handler; rt_size_t cmd_len; CB_SIZE_TYPE type; rt_size_t data_size; @@ -54,10 +53,10 @@ struct scsi_cmd }; struct mstorage -{ +{ struct ustorage_csw csw_response; uep_t ep_in; - uep_t ep_out; + uep_t ep_out; int status; rt_uint32_t cb_data_size; rt_device_t disk; @@ -65,7 +64,7 @@ struct mstorage rt_int32_t count; rt_int32_t size; struct scsi_cmd* processing; - struct rt_device_blk_geometry geometry; + struct rt_device_blk_geometry geometry; }; ALIGN(4) @@ -180,9 +179,9 @@ static struct scsi_cmd cmd_data[] = {SCSI_REQUEST_SENSE, _request_sense, 6, COUNT, 0, DIR_IN}, {SCSI_INQUIRY_CMD, _inquiry_cmd, 6, COUNT, 0, DIR_IN}, {SCSI_ALLOW_REMOVAL, _allow_removal, 6, FIXED, 0, DIR_NONE}, - {SCSI_MODE_SENSE_6, _mode_sense_6, 6, COUNT, 0, DIR_IN}, - {SCSI_START_STOP, _start_stop, 6, FIXED, 0, DIR_NONE}, - {SCSI_READ_CAPACITIES, _read_capacities, 10, COUNT, 0, DIR_NONE}, + {SCSI_MODE_SENSE_6, _mode_sense_6, 6, COUNT, 0, DIR_IN}, + {SCSI_START_STOP, _start_stop, 6, FIXED, 0, DIR_NONE}, + {SCSI_READ_CAPACITIES, _read_capacities, 10, COUNT, 0, DIR_NONE}, {SCSI_READ_CAPACITY, _read_capacity, 10, FIXED, 8, DIR_IN}, {SCSI_READ_10, _read_10, 10, BLOCK_COUNT, 0, DIR_IN}, {SCSI_WRITE_10, _write_10, 10, BLOCK_COUNT, 0, DIR_OUT}, @@ -197,9 +196,9 @@ static void _send_status(ufunction_t func) RT_DEBUG_LOG(RT_DEBUG_USB, ("_send_status\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; data->ep_in->request.buffer = (rt_uint8_t*)&data->csw_response; - data->ep_in->request.size = SIZEOF_CSW; + data->ep_in->request.size = SIZEOF_CSW; data->ep_in->request.req_type = UIO_REQUEST_WRITE; rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request); data->status = STAT_CSW; @@ -210,13 +209,13 @@ static rt_size_t _test_unit_ready(ufunction_t func, ustorage_cbw_t cbw) struct mstorage *data; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_test_unit_ready\n")); data = (struct mstorage*)func->user_data; data->csw_response.status = 0; - + return 0; } @@ -225,7 +224,7 @@ static rt_size_t _allow_removal(ufunction_t func, ustorage_cbw_t cbw) struct mstorage *data; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_allow_removal\n")); @@ -238,7 +237,7 @@ static rt_size_t _allow_removal(ufunction_t func, ustorage_cbw_t cbw) /** * This function will handle inquiry command request. * - * @param func the usb function object. + * @param func the usb function object. * @param cbw the command block wrapper. * * @return RT_EOK on successful. @@ -250,12 +249,12 @@ static rt_size_t _inquiry_cmd(ufunction_t func, ustorage_cbw_t cbw) rt_uint8_t *buf; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_inquiry_cmd\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; buf = data->ep_in->buffer; *(rt_uint32_t*)&buf[0] = 0x0 | (0x80 << 8); @@ -278,7 +277,7 @@ static rt_size_t _inquiry_cmd(ufunction_t func, ustorage_cbw_t cbw) /** * This function will handle sense request. * - * @param func the usb function object. + * @param func the usb function object. * @param cbw the command block wrapper. * * @return RT_EOK on successful. @@ -289,12 +288,12 @@ static rt_size_t _request_sense(ufunction_t func, ustorage_cbw_t cbw) struct request_sense_data *buf; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_request_sense\n")); - - data = (struct mstorage*)func->user_data; + + data = (struct mstorage*)func->user_data; buf = (struct request_sense_data *)data->ep_in->buffer; buf->ErrorCode = 0x70; @@ -322,7 +321,7 @@ static rt_size_t _request_sense(ufunction_t func, ustorage_cbw_t cbw) * This function will handle mode_sense_6 request. * * @param func the usb function object. - * @param cbw the command block wrapper. + * @param cbw the command block wrapper. * * @return RT_EOK on successful. */ @@ -332,12 +331,12 @@ static rt_size_t _mode_sense_6(ufunction_t func, ustorage_cbw_t cbw) rt_uint8_t *buf; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_mode_sense_6\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; buf = data->ep_in->buffer; buf[0] = 3; buf[1] = 0; @@ -357,7 +356,7 @@ static rt_size_t _mode_sense_6(ufunction_t func, ustorage_cbw_t cbw) /** * This function will handle read_capacities request. * - * @param func the usb function object. + * @param func the usb function object. * @param cbw the command block wrapper. * * @return RT_EOK on successful. @@ -369,12 +368,12 @@ static rt_size_t _read_capacities(ufunction_t func, ustorage_cbw_t cbw) rt_uint32_t sector_count, sector_size; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_read_capacities\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; buf = data->ep_in->buffer; sector_count = data->geometry.sector_count; sector_size = data->geometry.bytes_per_sector; @@ -402,7 +401,7 @@ static rt_size_t _read_capacities(ufunction_t func, ustorage_cbw_t cbw) /** * This function will handle read_capacity request. * - * @param func the usb function object. + * @param func the usb function object. * @param cbw the command block wapper. * * @return RT_EOK on successful. @@ -415,14 +414,14 @@ static rt_size_t _read_capacity(ufunction_t func, ustorage_cbw_t cbw) rt_uint32_t sector_count, sector_size; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_read_capacity\n")); - data = (struct mstorage*)func->user_data; - buf = data->ep_in->buffer; - sector_count = data->geometry.sector_count; + data = (struct mstorage*)func->user_data; + buf = data->ep_in->buffer; + sector_count = data->geometry.sector_count - 1; /* Last Logical Block Address */ sector_size = data->geometry.bytes_per_sector; buf[0] = sector_count >> 24; @@ -456,19 +455,19 @@ static rt_size_t _read_10(ufunction_t func, ustorage_cbw_t cbw) { struct mstorage *data; rt_size_t size; - + RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; data->block = cbw->cb[2]<<24 | cbw->cb[3]<<16 | cbw->cb[4]<<8 | cbw->cb[5]<<0; data->count = cbw->cb[7]<<8 | cbw->cb[8]<<0; RT_ASSERT(data->count < data->geometry.sector_count); - data->csw_response.data_reside = data->cb_data_size; + data->csw_response.data_reside = data->cb_data_size; size = rt_device_read(data->disk, data->block, data->ep_in->buffer, 1); if(size == 0) { @@ -476,11 +475,11 @@ static rt_size_t _read_10(ufunction_t func, ustorage_cbw_t cbw) } data->ep_in->request.buffer = data->ep_in->buffer; - data->ep_in->request.size = data->geometry.bytes_per_sector; - data->ep_in->request.req_type = UIO_REQUEST_WRITE; + data->ep_in->request.size = data->geometry.bytes_per_sector; + data->ep_in->request.req_type = UIO_REQUEST_WRITE; rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request); data->status = STAT_SEND; - + return data->geometry.bytes_per_sector; } @@ -500,7 +499,7 @@ static rt_size_t _write_10(ufunction_t func, ustorage_cbw_t cbw) RT_ASSERT(func->device != RT_NULL); RT_ASSERT(cbw != RT_NULL); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; data->block = cbw->cb[2]<<24 | cbw->cb[3]<<16 | cbw->cb[4]<<8 | cbw->cb[5]<<0; @@ -512,13 +511,13 @@ static rt_size_t _write_10(ufunction_t func, ustorage_cbw_t cbw) data->count, data->block, data->geometry.sector_count)); data->csw_response.data_reside = data->cb_data_size; - + data->ep_out->request.buffer = data->ep_out->buffer; - data->ep_out->request.size = data->geometry.bytes_per_sector; + data->ep_out->request.size = data->geometry.bytes_per_sector; data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); data->status = STAT_RECEIVE; - + return data->geometry.bytes_per_sector; } @@ -534,42 +533,42 @@ static rt_size_t _verify_10(ufunction_t func, ustorage_cbw_t cbw) struct mstorage *data; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_verify_10\n")); data = (struct mstorage*)func->user_data; data->csw_response.status = 0; - + return 0; } -static rt_size_t _start_stop(ufunction_t func, +static rt_size_t _start_stop(ufunction_t func, ustorage_cbw_t cbw) { struct mstorage *data; RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_start_stop\n")); data = (struct mstorage*)func->user_data; data->csw_response.status = 0; - + return 0; } static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size) { struct mstorage *data; - + RT_ASSERT(func != RT_NULL); RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_in_handler\n")); - - data = (struct mstorage*)func->user_data; + + data = (struct mstorage*)func->user_data; switch(data->status) { @@ -577,15 +576,15 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size) if(data->ep_in->request.size != SIZEOF_CSW) { rt_kprintf("Size of csw command error\n"); - rt_usbd_ep_set_stall(func->device, data->ep_in); + rt_usbd_ep_set_stall(func->device, data->ep_in); } else { RT_DEBUG_LOG(RT_DEBUG_USB, ("return to cbw status\n")); data->ep_out->request.buffer = data->ep_out->buffer; data->ep_out->request.size = SIZEOF_CBW; - data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; - rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); + data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; + rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); data->status = STAT_CBW; } break; @@ -598,8 +597,8 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size) { data->csw_response.data_reside -= data->ep_in->request.size; if(data->csw_response.data_reside != 0) - { - RT_DEBUG_LOG(RT_DEBUG_USB, ("data_reside %d, request %d\n", + { + RT_DEBUG_LOG(RT_DEBUG_USB, ("data_reside %d, request %d\n", data->csw_response.data_reside, data->ep_in->request.size)); if(data->processing->dir == DIR_OUT) { @@ -607,35 +606,38 @@ static rt_err_t _ep_in_handler(ufunction_t func, rt_size_t size) } else { - rt_usbd_ep_set_stall(func->device, data->ep_in); + //rt_kprintf("warning:in stall path but not stall\n"); + + /* FIXME: Disable the operation or the disk cannot work. */ + //rt_usbd_ep_set_stall(func->device, data->ep_in); } data->csw_response.data_reside = 0; } } _send_status(func); break; - case STAT_SEND: + case STAT_SEND: data->csw_response.data_reside -= data->ep_in->request.size; - data->count--; - data->block++; + data->count--; + data->block++; if(data->count > 0 && data->csw_response.data_reside > 0) { if(rt_device_read(data->disk, data->block, data->ep_in->buffer, 1) == 0) { rt_kprintf("disk read error\n"); rt_usbd_ep_set_stall(func->device, data->ep_in); - return -RT_ERROR; + return -RT_ERROR; } data->ep_in->request.buffer = data->ep_in->buffer; - data->ep_in->request.size = data->geometry.bytes_per_sector; - data->ep_in->request.req_type = UIO_REQUEST_WRITE; - rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request); + data->ep_in->request.size = data->geometry.bytes_per_sector; + data->ep_in->request.req_type = UIO_REQUEST_WRITE; + rt_usbd_io_request(func->device, data->ep_in, &data->ep_in->request); } else { - _send_status(func); - } + _send_status(func); + } break; } @@ -665,7 +667,7 @@ static struct scsi_cmd* _find_cbw_command(rt_uint16_t cmd) { if(cmd_data[i].cmd == cmd) return &cmd_data[i]; - } + } return RT_NULL; } @@ -679,7 +681,7 @@ static void _cb_len_calc(ufunction_t func, struct scsi_cmd* cmd, RT_ASSERT(cmd != RT_NULL); RT_ASSERT(cbw != RT_NULL); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; if(cmd->cmd_len == 6) { switch(cmd->type) @@ -693,9 +695,9 @@ static void _cb_len_calc(ufunction_t func, struct scsi_cmd* cmd, case FIXED: data->cb_data_size = cmd->data_size; break; - default: + default: break; - } + } } else if(cmd->cmd_len == 10) { @@ -705,19 +707,32 @@ static void _cb_len_calc(ufunction_t func, struct scsi_cmd* cmd, data->cb_data_size = cbw->cb[7]<<8 | cbw->cb[8]; break; case BLOCK_COUNT: - data->cb_data_size = (cbw->cb[7]<<8 | cbw->cb[8]) * + data->cb_data_size = (cbw->cb[7]<<8 | cbw->cb[8]) * data->geometry.bytes_per_sector; break; case FIXED: data->cb_data_size = cmd->data_size; break; - default: + default: + break; + } + } + + //workaround: for stability in full-speed mode + else if(cmd->cmd_len == 12) + { + switch(cmd->type) + { + case COUNT: + data->cb_data_size = cbw->cb[4]; + break; + default: break; } } else { -// rt_kprintf("cmd_len error %d\n", cmd->cmd_len); + rt_kprintf("cmd_len error %d\n", cmd->cmd_len); } } @@ -730,10 +745,10 @@ static rt_bool_t _cbw_verify(ufunction_t func, struct scsi_cmd* cmd, RT_ASSERT(cbw != RT_NULL); RT_ASSERT(func != RT_NULL); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; if(cmd->cmd_len != cbw->cb_len) { - // rt_kprintf("cb_len error\n"); + rt_kprintf("cb_len error\n"); cmd->cmd_len = cbw->cb_len; } @@ -761,26 +776,26 @@ static rt_bool_t _cbw_verify(ufunction_t func, struct scsi_cmd* cmd, rt_kprintf("xfer_len > data_size\n"); return RT_FALSE; } - + if(cbw->xfer_len < data->cb_data_size) { - // rt_kprintf("xfer_len < data_size\n"); + rt_kprintf("xfer_len < data_size\n"); data->cb_data_size = cbw->xfer_len; data->csw_response.status = 1; } - return RT_TRUE; + return RT_TRUE; } static rt_size_t _cbw_handler(ufunction_t func, struct scsi_cmd* cmd, ustorage_cbw_t cbw) -{ +{ struct mstorage *data; RT_ASSERT(func != RT_NULL); RT_ASSERT(cbw != RT_NULL); RT_ASSERT(cmd->handler != RT_NULL); - + data = (struct mstorage*)func->user_data; data->processing = cmd; return cmd->handler(func, cbw); @@ -800,21 +815,21 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) struct scsi_cmd* cmd; rt_size_t len; struct ustorage_cbw* cbw; - + RT_ASSERT(func != RT_NULL); RT_ASSERT(func->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_ep_out_handler %d\n", size)); - + data = (struct mstorage*)func->user_data; - cbw = (struct ustorage_cbw*)data->ep_out->buffer; + cbw = (struct ustorage_cbw*)data->ep_out->buffer; if(data->status == STAT_CBW) { /* dump cbw information */ if(cbw->signature != CBW_SIGNATURE || size != SIZEOF_CBW) { goto exit; - } + } data->csw_response.signature = CSW_SIGNATURE; data->csw_response.tag = cbw->tag; @@ -822,33 +837,33 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) data->csw_response.status = 0; RT_DEBUG_LOG(RT_DEBUG_USB, ("ep_out reside %d\n", data->csw_response.data_reside)); - + cmd = _find_cbw_command(cbw->cb[0]); if(cmd == RT_NULL) { rt_kprintf("can't find cbw command\n"); goto exit; - } + } _cb_len_calc(func, cmd, cbw); if(!_cbw_verify(func, cmd, cbw)) { goto exit; } - + len = _cbw_handler(func, cmd, cbw); if(len == 0) { _send_status(func); - } - - return RT_EOK; + } + + return RT_EOK; } else if(data->status == STAT_RECEIVE) { RT_DEBUG_LOG(RT_DEBUG_USB, ("\nwrite size %d block 0x%x oount 0x%x\n", size, data->block, data->size)); - + data->size -= size; data->csw_response.data_reside -= size; @@ -857,10 +872,10 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) if(data->csw_response.data_reside != 0) { data->ep_out->request.buffer = data->ep_out->buffer; - data->ep_out->request.size = data->geometry.bytes_per_sector; - data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; + data->ep_out->request.size = data->geometry.bytes_per_sector; + data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); - data->block ++; + data->block ++; } else { @@ -885,7 +900,7 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) } data->csw_response.status = 1; _send_status(func); - + return -RT_ERROR; } @@ -900,21 +915,21 @@ static rt_err_t _ep_out_handler(ufunction_t func, rt_size_t size) static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) { rt_uint8_t lun = 0; - + RT_ASSERT(func != RT_NULL); - RT_ASSERT(func->device != RT_NULL); + RT_ASSERT(func->device != RT_NULL); RT_ASSERT(setup != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("mstorage_interface_handler\n")); switch(setup->bRequest) { - case USBREQ_GET_MAX_LUN: - + case USBREQ_GET_MAX_LUN: + RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_GET_MAX_LUN\n")); - + if(setup->wValue || setup->wLength != 1) - { + { rt_usbd_ep0_set_stall(func->device); } else @@ -925,14 +940,14 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) case USBREQ_MASS_STORAGE_RESET: RT_DEBUG_LOG(RT_DEBUG_USB, ("USBREQ_MASS_STORAGE_RESET\n")); - + if(setup->wValue || setup->wLength != 0) { rt_usbd_ep0_set_stall(func->device); } else - { - dcd_ep0_send_status(func->device->dcd); + { + dcd_ep0_send_status(func->device->dcd); } break; default: @@ -955,7 +970,7 @@ static rt_err_t _function_enable(ufunction_t func) struct mstorage *data; RT_ASSERT(func != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("Mass storage function enabled\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; data->disk = rt_device_find(RT_USB_MSTORAGE_DISK_NAME); if(data->disk == RT_NULL) @@ -969,14 +984,14 @@ static rt_err_t _function_enable(ufunction_t func) rt_kprintf("disk open error\n"); return -RT_ERROR; } - - if(rt_device_control(data->disk, RT_DEVICE_CTRL_BLK_GETGEOME, + + if(rt_device_control(data->disk, RT_DEVICE_CTRL_BLK_GETGEOME, (void*)&data->geometry) != RT_EOK) { rt_kprintf("get disk info error\n"); return -RT_ERROR; } - + data->ep_in->buffer = (rt_uint8_t*)rt_malloc(data->geometry.bytes_per_sector); if(data->ep_in->buffer == RT_NULL) { @@ -989,14 +1004,14 @@ static rt_err_t _function_enable(ufunction_t func) rt_free(data->ep_in->buffer); rt_kprintf("no memory\n"); return -RT_ENOMEM; - } - + } + /* prepare to read CBW request */ data->ep_out->request.buffer = data->ep_out->buffer; - data->ep_out->request.size = SIZEOF_CBW; - data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; + data->ep_out->request.size = SIZEOF_CBW; + data->ep_out->request.req_type = UIO_REQUEST_READ_FULL; rt_usbd_io_request(func->device, data->ep_out, &data->ep_out->request); - + return RT_EOK; } @@ -1014,11 +1029,11 @@ static rt_err_t _function_disable(ufunction_t func) RT_DEBUG_LOG(RT_DEBUG_USB, ("Mass storage function disabled\n")); - data = (struct mstorage*)func->user_data; + data = (struct mstorage*)func->user_data; if(data->ep_in->buffer != RT_NULL) { rt_free(data->ep_in->buffer); - data->ep_in->buffer = RT_NULL; + data->ep_in->buffer = RT_NULL; } if(data->ep_out->buffer != RT_NULL) @@ -1031,9 +1046,9 @@ static rt_err_t _function_disable(ufunction_t func) rt_device_close(data->disk); data->disk = RT_NULL; } - + data->status = STAT_CBW; - + return RT_EOK; } @@ -1072,11 +1087,11 @@ ufunction_t rt_usbd_function_mstorage_create(udevice_t device) /* set usb device string description */ rt_usbd_device_set_string(device, _ustring); - + /* create a mass storage function */ func = rt_usbd_function_new(device, &dev_desc, &ops); device->dev_qualifier = &dev_qualifier; - + /* allocate memory for mass storage function data */ data = (struct mstorage*)rt_malloc(sizeof(struct mstorage)); rt_memset(data, 0, sizeof(struct mstorage)); @@ -1087,7 +1102,7 @@ ufunction_t rt_usbd_function_mstorage_create(udevice_t device) /* create an alternate setting object */ setting = rt_usbd_altsetting_new(sizeof(struct umass_descriptor)); - + /* config desc in alternate setting */ rt_usbd_altsetting_config_descriptor(setting, &_mass_desc, (rt_off_t)&((umass_desc_t)0)->intf_desc); @@ -1112,7 +1127,7 @@ ufunction_t rt_usbd_function_mstorage_create(udevice_t device) return func; } -struct udclass msc_class = +struct udclass msc_class = { .rt_usbd_function_create = rt_usbd_function_mstorage_create }; diff --git a/components/drivers/usb/usbdevice/class/mstorage.h b/components/drivers/usb/usbdevice/class/mstorage.h index 254038195..6c81809ef 100644 --- a/components/drivers/usb/usbdevice/class/mstorage.h +++ b/components/drivers/usb/usbdevice/class/mstorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,7 +8,7 @@ * 2012-10-01 Yi Qiu first version * 2012-12-12 heyuanjie87 add MASS endpoints collection */ - + #ifndef __MSTORAGE_H__ #define __MSTORAGE_H__ @@ -23,7 +23,7 @@ struct umass_descriptor #endif struct uinterface_descriptor intf_desc; struct uendpoint_descriptor ep_out_desc; - struct uendpoint_descriptor ep_in_desc; + struct uendpoint_descriptor ep_in_desc; }; typedef struct umass_descriptor* umass_desc_t; diff --git a/components/drivers/usb/usbdevice/class/ndis.h b/components/drivers/usb/usbdevice/class/ndis.h index 6d6943366..b83f3c78e 100644 --- a/components/drivers/usb/usbdevice/class/ndis.h +++ b/components/drivers/usb/usbdevice/class/ndis.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,14 +7,14 @@ * Date Author Notes */ /* - * ndis.h - * + * ndis.h + * * Modified by Colin O'Flynn * ntddndis.h modified by Benedikt Spranger - * - * Thanks to the cygwin development team, + * + * Thanks to the cygwin development team, * espacially to Casper S. Hornstrup - * + * * THIS SOFTWARE IS NOT COPYRIGHTED * * This source code is offered for use in the public domain. You may @@ -30,7 +30,7 @@ #ifndef __NDIS_H__ #define __NDIS_H__ -#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 +#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 #define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B @@ -42,21 +42,21 @@ #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 #define OID_PNP_ENABLE_WAKE_UP 0xFD010106 -enum NDIS_DEVICE_POWER_STATE +enum NDIS_DEVICE_POWER_STATE { - NdisDeviceStateUnspecified = 0, - NdisDeviceStateD0, - NdisDeviceStateD1, - NdisDeviceStateD2, - NdisDeviceStateD3, - NdisDeviceStateMaximum + NdisDeviceStateUnspecified = 0, + NdisDeviceStateD0, + NdisDeviceStateD1, + NdisDeviceStateD2, + NdisDeviceStateD3, + NdisDeviceStateMaximum }; struct NDIS_PM_WAKE_UP_CAPABILITIES { - enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp; - enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp; - enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp; + enum NDIS_DEVICE_POWER_STATE MinMagicPacketWakeUp; + enum NDIS_DEVICE_POWER_STATE MinPatternWakeUp; + enum NDIS_DEVICE_POWER_STATE MinLinkChangeWakeUp; }; /* NDIS_PNP_CAPABILITIES.Flags constants */ @@ -194,36 +194,36 @@ struct NDIS_PM_WAKE_UP_CAPABILITIES #define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000 #define NDIS_MINIPORT_64BITS_DMA 0x01000000 -#define NDIS_MEDIUM_802_3 0x00000000 -#define NDIS_MEDIUM_802_5 0x00000001 -#define NDIS_MEDIUM_FDDI 0x00000002 -#define NDIS_MEDIUM_WAN 0x00000003 -#define NDIS_MEDIUM_LOCAL_TALK 0x00000004 -#define NDIS_MEDIUM_DIX 0x00000005 +#define NDIS_MEDIUM_802_3 0x00000000 +#define NDIS_MEDIUM_802_5 0x00000001 +#define NDIS_MEDIUM_FDDI 0x00000002 +#define NDIS_MEDIUM_WAN 0x00000003 +#define NDIS_MEDIUM_LOCAL_TALK 0x00000004 +#define NDIS_MEDIUM_DIX 0x00000005 #define NDIS_MEDIUM_ARCENT_RAW 0x00000006 #define NDIS_MEDIUM_ARCENT_878_2 0x00000007 -#define NDIS_MEDIUM_ATM 0x00000008 +#define NDIS_MEDIUM_ATM 0x00000008 #define NDIS_MEDIUM_WIRELESS_LAN 0x00000009 -#define NDIS_MEDIUM_IRDA 0x0000000A -#define NDIS_MEDIUM_BPC 0x0000000B -#define NDIS_MEDIUM_CO_WAN 0x0000000C -#define NDIS_MEDIUM_1394 0x0000000D - -#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 -#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 -#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 -#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 -#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 -#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 -#define NDIS_PACKET_TYPE_SMT 0x00000040 -#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 -#define NDIS_PACKET_TYPE_GROUP 0x00000100 -#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 -#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 -#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 - -#define NDIS_MEDIA_STATE_CONNECTED 0x00000000 -#define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001 +#define NDIS_MEDIUM_IRDA 0x0000000A +#define NDIS_MEDIUM_BPC 0x0000000B +#define NDIS_MEDIUM_CO_WAN 0x0000000C +#define NDIS_MEDIUM_1394 0x0000000D + +#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 +#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 +#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 +#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 +#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 +#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 +#define NDIS_PACKET_TYPE_SMT 0x00000040 +#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 +#define NDIS_PACKET_TYPE_GROUP 0x00000100 +#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 +#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 +#define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 + +#define NDIS_MEDIA_STATE_CONNECTED 0x00000000 +#define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 diff --git a/components/drivers/usb/usbdevice/class/rndis.c b/components/drivers/usb/usbdevice/class/rndis.c index 93e0ba6ae..391924dba 100644 --- a/components/drivers/usb/usbdevice/class/rndis.c +++ b/components/drivers/usb/usbdevice/class/rndis.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -215,7 +215,7 @@ const static char* _ustring[] = }; ALIGN(4) -struct usb_os_function_comp_id_descriptor rndis_func_comp_id_desc = +struct usb_os_function_comp_id_descriptor rndis_func_comp_id_desc = { .bFirstInterfaceNumber = USB_DYNAMIC, .reserved1 = 0x01, @@ -347,7 +347,7 @@ static rt_err_t _rndis_init_response(ufunction_t func, rndis_init_msg_t msg) rt_list_insert_before(&((rt_rndis_eth_t)func->user_data)->response_list, &response->list); rt_hw_interrupt_enable(level); } - + return RT_EOK; } @@ -764,7 +764,7 @@ static rt_err_t send_encapsulated_command_done(udevice_t device, rt_size_t size) } //#error here have bug ep 0x82 send failed static rt_err_t _rndis_send_encapsulated_command(ufunction_t func, ureq_t setup) -{ +{ RT_ASSERT(setup->wLength <= sizeof(rndis_message_buffer)); function = func; rt_usbd_ep0_read(func->device,rndis_message_buffer,setup->wLength,send_encapsulated_command_done); @@ -808,7 +808,7 @@ static rt_err_t _rndis_get_encapsulated_response(ufunction_t func, ureq_t setup) data[1] = 0; ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->request.buffer = ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->buffer; ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->request.size = 8; - ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->request.req_type = UIO_REQUEST_WRITE; + ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->request.req_type = UIO_REQUEST_WRITE; rt_usbd_io_request(func->device, ((rt_rndis_eth_t)func->user_data)->eps.ep_cmd, &((rt_rndis_eth_t)func->user_data)->eps.ep_cmd->request); } else @@ -983,7 +983,7 @@ static rt_err_t _function_enable(ufunction_t func) ((rt_rndis_eth_t)func->user_data)->need_notify = RT_TRUE; rt_hw_interrupt_enable(level); } - + return RT_EOK; } @@ -1022,7 +1022,7 @@ static rt_err_t _function_disable(ufunction_t func) rt_hw_interrupt_enable(level); } - + /* link down. */ eth_device_linkchange(&((rt_rndis_eth_t)func->user_data)->parent, RT_FALSE); @@ -1323,7 +1323,7 @@ ufunction_t rt_usbd_function_rndis_create(udevice_t device) /* create a cdc class */ cdc = rt_usbd_function_new(device, &_dev_desc, &ops); rt_usbd_device_set_qualifier(device, &dev_qualifier); - _rndis= rt_malloc(sizeof(struct rt_rndis_eth)); + _rndis= rt_malloc(sizeof(struct rt_rndis_eth)); rt_memset(_rndis, 0, sizeof(struct rt_rndis_eth)); cdc->user_data = _rndis; @@ -1357,7 +1357,7 @@ ufunction_t rt_usbd_function_rndis_create(udevice_t device) rt_usbd_set_altsetting(intf_comm, 0); /* add the communication interface to the cdc class */ rt_usbd_function_add_interface(cdc, intf_comm); - + /* create a bulk in and a bulk out endpoint */ data_desc = (ucdc_data_desc_t)data_setting->desc; eps->ep_out = rt_usbd_endpoint_new(&data_desc->ep_out_desc, _ep_out_handler); @@ -1434,7 +1434,7 @@ ufunction_t rt_usbd_function_rndis_create(udevice_t device) return cdc; } -struct udclass rndis_class = +struct udclass rndis_class = { .rt_usbd_function_create = rt_usbd_function_rndis_create }; diff --git a/components/drivers/usb/usbdevice/class/rndis.h b/components/drivers/usb/usbdevice/class/rndis.h index fcdd24998..f25ae4931 100644 --- a/components/drivers/usb/usbdevice/class/rndis.h +++ b/components/drivers/usb/usbdevice/class/rndis.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,43 +13,43 @@ #include -#define USB_ETH_MTU 1500+14 +#define USB_ETH_MTU 1500+14 #define RNDIS_MESSAGE_BUFFER_SIZE 128 #define RESPONSE_AVAILABLE 0x00000001 /* Remote NDIS version numbers */ -#define RNDIS_MAJOR_VERSION 1 +#define RNDIS_MAJOR_VERSION 1 #define RNDIS_MINOR_VERSION 0 /* common status values */ -#define RNDIS_STATUS_SUCCESS 0X00000000 -#define RNDIS_STATUS_FAILURE 0XC0000001 -#define RNDIS_STATUS_INVALID_DATA 0XC0010015 -#define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB -#define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B -#define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C +#define RNDIS_STATUS_SUCCESS 0X00000000 +#define RNDIS_STATUS_FAILURE 0XC0000001 +#define RNDIS_STATUS_INVALID_DATA 0XC0010015 +#define RNDIS_STATUS_NOT_SUPPORTED 0XC00000BB +#define RNDIS_STATUS_MEDIA_CONNECT 0X4001000B +#define RNDIS_STATUS_MEDIA_DISCONNECT 0X4001000C /* Remote NDIS message types */ -#define REMOTE_NDIS_PACKET_MSG 0x00000001 -#define REMOTE_NDIS_INITIALIZE_MSG 0X00000002 -#define REMOTE_NDIS_HALT_MSG 0X00000003 -#define REMOTE_NDIS_QUERY_MSG 0X00000004 -#define REMOTE_NDIS_SET_MSG 0X00000005 -#define REMOTE_NDIS_RESET_MSG 0X00000006 +#define REMOTE_NDIS_PACKET_MSG 0x00000001 +#define REMOTE_NDIS_INITIALIZE_MSG 0X00000002 +#define REMOTE_NDIS_HALT_MSG 0X00000003 +#define REMOTE_NDIS_QUERY_MSG 0X00000004 +#define REMOTE_NDIS_SET_MSG 0X00000005 +#define REMOTE_NDIS_RESET_MSG 0X00000006 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0X00000007 -#define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008 -#define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002 -#define REMOTE_NDIS_QUERY_CMPLT 0X80000004 -#define REMOTE_NDIS_SET_CMPLT 0X80000005 -#define REMOTE_NDIS_RESET_CMPLT 0X80000006 -#define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008 +#define REMOTE_NDIS_KEEPALIVE_MSG 0X00000008 +#define REMOTE_NDIS_INITIALIZE_CMPLT 0X80000002 +#define REMOTE_NDIS_QUERY_CMPLT 0X80000004 +#define REMOTE_NDIS_SET_CMPLT 0X80000005 +#define REMOTE_NDIS_RESET_CMPLT 0X80000006 +#define REMOTE_NDIS_KEEPALIVE_CMPLT 0X80000008 /* device flags */ -#define RNDIS_DF_CONNECTIONLESS 0x00000001 -#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 +#define RNDIS_DF_CONNECTIONLESS 0x00000001 +#define RNDIS_DF_CONNECTION_ORIENTED 0x00000002 /* mediums */ -#define RNDIS_MEDIUM_802_3 0x00000000 +#define RNDIS_MEDIUM_802_3 0x00000000 struct ucls_rndis { @@ -64,24 +64,24 @@ struct ucls_rndis /* Remote NDIS generic message type */ struct rndis_gen_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; }; typedef struct rndis_gen_msg* rndis_gen_msg_t; struct rndis_packet_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t DataOffset; - rt_uint32_t DataLength; - rt_uint32_t OOBDataOffset; - rt_uint32_t OOBDataLength; - rt_uint32_t NumOOBDataElements; - rt_uint32_t PerPacketInfoOffset; - rt_uint32_t PerPacketInfoLength; - rt_uint32_t VcHandle; - rt_uint32_t Reserved; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t DataOffset; + rt_uint32_t DataLength; + rt_uint32_t OOBDataOffset; + rt_uint32_t OOBDataLength; + rt_uint32_t NumOOBDataElements; + rt_uint32_t PerPacketInfoOffset; + rt_uint32_t PerPacketInfoLength; + rt_uint32_t VcHandle; + rt_uint32_t Reserved; }; typedef struct rndis_packet_msg* rndis_packet_msg_t; @@ -89,132 +89,132 @@ typedef struct rndis_packet_msg* rndis_packet_msg_t; struct rndis_init_msg { rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t MajorVersion; - rt_uint32_t MinorVersion; - rt_uint32_t MaxTransferSize; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t MajorVersion; + rt_uint32_t MinorVersion; + rt_uint32_t MaxTransferSize; }; typedef struct rndis_init_msg* rndis_init_msg_t; /* Response */ struct rndis_init_cmplt { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Status; - rt_uint32_t MajorVersion; - rt_uint32_t MinorVersion; - rt_uint32_t DeviceFlags; - rt_uint32_t Medium; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Status; + rt_uint32_t MajorVersion; + rt_uint32_t MinorVersion; + rt_uint32_t DeviceFlags; + rt_uint32_t Medium; rt_uint32_t MaxPacketsPerTransfer; - rt_uint32_t MaxTransferSize; + rt_uint32_t MaxTransferSize; rt_uint32_t PacketAlignmentFactor; - rt_uint32_t AfListOffset; - rt_uint32_t AfListSize; + rt_uint32_t AfListOffset; + rt_uint32_t AfListSize; }; typedef struct rndis_init_cmplt* rndis_init_cmplt_t; /* Remote NDIS Halt Message */ struct rndis_halt_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; }; /* Remote NDIS Query Message */ struct rndis_query_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Oid; - rt_uint32_t InformationBufferLength; - rt_uint32_t InformationBufferOffset; - rt_uint32_t DeviceVcHandle; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Oid; + rt_uint32_t InformationBufferLength; + rt_uint32_t InformationBufferOffset; + rt_uint32_t DeviceVcHandle; }; typedef struct rndis_query_msg* rndis_query_msg_t; /* Response */ struct rndis_query_cmplt { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Status; - rt_uint32_t InformationBufferLength; - rt_uint32_t InformationBufferOffset; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Status; + rt_uint32_t InformationBufferLength; + rt_uint32_t InformationBufferOffset; }; typedef struct rndis_query_cmplt* rndis_query_cmplt_t; /* Remote NDIS Set Message */ struct rndis_set_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Oid; - rt_uint32_t InformationBufferLength; - rt_uint32_t InformationBufferOffset; - rt_uint32_t DeviceVcHandle; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Oid; + rt_uint32_t InformationBufferLength; + rt_uint32_t InformationBufferOffset; + rt_uint32_t DeviceVcHandle; }; typedef struct rndis_set_msg* rndis_set_msg_t; /* Response */ struct rndis_set_cmplt { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Status; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Status; }; typedef struct rndis_set_cmplt* rndis_set_cmplt_t; /* Remote NDIS Soft Reset Message */ struct rndis_reset_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t Reserved; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t Reserved; }; /* Remote NDIS Soft Reset Response */ struct rndis_reset_cmplt { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t Status; - rt_uint32_t AddressingReset; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t Status; + rt_uint32_t AddressingReset; }; /* Remote NDIS Indicate Status Message */ struct rndis_indicate_status_msg { rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t Status; - rt_uint32_t StatusBufferLength; - rt_uint32_t StatusBufferOffset; + rt_uint32_t MessageLength; + rt_uint32_t Status; + rt_uint32_t StatusBufferLength; + rt_uint32_t StatusBufferOffset; }; typedef struct rndis_indicate_status_msg* rndis_indicate_status_msg_t; struct rndis_keepalive_msg { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestID; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestID; }; typedef struct rndis_keepalive_msg* rndis_keepalive_msg_t; /* Response: */ struct rndis_keepalive_cmplt { - rt_uint32_t MessageType; - rt_uint32_t MessageLength; - rt_uint32_t RequestId; - rt_uint32_t Status; + rt_uint32_t MessageType; + rt_uint32_t MessageLength; + rt_uint32_t RequestId; + rt_uint32_t Status; }; typedef struct rndis_keepalive_cmplt* rndis_keepalive_cmplt_t; diff --git a/components/drivers/usb/usbdevice/class/winusb.c b/components/drivers/usb/usbdevice/class/winusb.c index bf4b353d7..0db3de794 100644 --- a/components/drivers/usb/usbdevice/class/winusb.c +++ b/components/drivers/usb/usbdevice/class/winusb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,8 +8,6 @@ * 2017-11-16 ZYH first version */ #include -#include -#include #include #include #include "winusb.h" @@ -59,7 +57,7 @@ static struct usb_qualifier_descriptor dev_qualifier = }; ALIGN(4) -struct winusb_descriptor _winusb_desc = +struct winusb_descriptor _winusb_desc = { #ifdef RT_USB_DEVICE_COMPOSITE /* Interface Association Descriptor */ @@ -119,13 +117,13 @@ const static char* _ustring[] = }; ALIGN(4) -struct usb_os_proerty winusb_proerty[] = +struct usb_os_proerty winusb_proerty[] = { - USB_OS_PROERTY_DESC(USB_OS_PROERTY_TYPE_REG_SZ,"DeviceInterfaceGUID",RT_WINUSB_GUID), + USB_OS_PROPERTY_DESC(USB_OS_PROPERTY_TYPE_REG_SZ,"DeviceInterfaceGUID",RT_WINUSB_GUID), }; ALIGN(4) -struct usb_os_function_comp_id_descriptor winusb_func_comp_id_desc = +struct usb_os_function_comp_id_descriptor winusb_func_comp_id_desc = { .bFirstInterfaceNumber = USB_DYNAMIC, .reserved1 = 0x01, @@ -157,7 +155,7 @@ static ufunction_t cmd_func = RT_NULL; static rt_err_t _ep0_cmd_handler(udevice_t device, rt_size_t size) { winusb_device_t winusb_device; - + if(cmd_func != RT_NULL) { winusb_device = (winusb_device_t)cmd_func->user_data; @@ -193,7 +191,7 @@ static rt_err_t _interface_handler(ufunction_t func, ureq_t setup) _ep0_cmd_read(func, setup); break; } - + return RT_EOK; } static rt_err_t _function_enable(ufunction_t func) @@ -293,7 +291,7 @@ static rt_err_t rt_usb_winusb_init(ufunction_t func) winusb_device->parent.user_data = func; - + return rt_device_register(&winusb_device->parent, "winusb", RT_DEVICE_FLAG_RDWR); } @@ -354,7 +352,7 @@ ufunction_t rt_usbd_function_winusb_create(udevice_t device) return func; } -struct udclass winusb_class = +struct udclass winusb_class = { .rt_usbd_function_create = rt_usbd_function_winusb_create }; diff --git a/components/drivers/usb/usbdevice/class/winusb.h b/components/drivers/usb/usbdevice/class/winusb.h index b5f87b4e5..43fec34b6 100644 --- a/components/drivers/usb/usbdevice/class/winusb.h +++ b/components/drivers/usb/usbdevice/class/winusb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/usb/usbdevice/core/usbdevice.c b/components/drivers/usb/usbdevice/core/usbdevice.c index 2455bd801..246b3f5ae 100644 --- a/components/drivers/usb/usbdevice/core/usbdevice.c +++ b/components/drivers/usb/usbdevice/core/usbdevice.c @@ -3,7 +3,7 @@ * COPYRIGHT (C) 2008 - 2018, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2012-10-02 Yi Qiu first version @@ -62,7 +62,7 @@ static struct usb_qualifier_descriptor dev_qualifier = }; #endif -struct usb_os_comp_id_descriptor usb_comp_id_desc = +struct usb_os_comp_id_descriptor usb_comp_id_desc = { //head section { diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/usbdevice_core.c similarity index 96% rename from components/drivers/usb/usbdevice/core/core.c rename to components/drivers/usb/usbdevice/core/usbdevice_core.c index 584556303..fd205ad37 100644 --- a/components/drivers/usb/usbdevice/core/core.c +++ b/components/drivers/usb/usbdevice/core/usbdevice_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -238,7 +238,7 @@ static rt_err_t _get_interface(struct udevice* device, ureq_t setup) rt_uint8_t value; uintf_t intf; ufunction_t func; - + /* parameter check */ RT_ASSERT(device != RT_NULL); RT_ASSERT(setup != RT_NULL); @@ -262,7 +262,7 @@ static rt_err_t _get_interface(struct udevice* device, ureq_t setup) { intf->handler(func, setup); } - + return RT_EOK; } @@ -293,7 +293,7 @@ static rt_err_t _set_interface(struct udevice* device, ureq_t setup) rt_usbd_ep0_set_stall(device); return -RT_ERROR; } - + /* find the specified interface */ intf = rt_usbd_find_interface(device, setup->wIndex & 0xFF, &func); @@ -309,12 +309,12 @@ static rt_err_t _set_interface(struct udevice* device, ureq_t setup) dcd_ep_enable(device->dcd, ep); } dcd_ep0_send_status(device->dcd); - + if (intf->handler) { intf->handler(func, setup); } - + return RT_EOK; } @@ -336,7 +336,7 @@ static rt_err_t _get_config(struct udevice* device, ureq_t setup) RT_ASSERT(device->curr_cfg != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("_get_config\n")); - + if (device->state == USB_STATE_CONFIGURED) { /* get current configuration */ @@ -443,7 +443,7 @@ static rt_err_t _set_address(struct udevice* device, ureq_t setup) dcd_ep0_send_status(device->dcd); RT_DEBUG_LOG(RT_DEBUG_USB, ("_set_address\n")); - + device->state = USB_STATE_ADDRESS; return RT_EOK; @@ -479,7 +479,7 @@ static rt_err_t _request_interface(struct udevice* device, ureq_t setup) { ret = -RT_ERROR; } - + return ret; } @@ -564,9 +564,9 @@ static rt_err_t _standard_request(struct udevice* device, ureq_t setup) case USB_REQ_GET_STATUS: { uep_t ep; - + ep = rt_usbd_find_endpoint(device, RT_NULL, setup->wIndex); - value = ep->stalled; + value = ep->stalled; rt_usbd_ep0_write(device, &value, 2); } break; @@ -581,13 +581,13 @@ static rt_err_t _standard_request(struct udevice* device, ureq_t setup) { rt_usbd_clear_feature(device, setup->wValue, setup->wIndex); dcd_ep0_send_status(dcd); - ep->stalled = RT_FALSE; + ep->stalled = RT_FALSE; for (node = ep->request_list.next; node != &ep->request_list; node = node->next) { - req = (uio_request_t)rt_list_entry(node, struct uio_request, list); + req = (uio_request_t)rt_list_entry(node, struct uio_request, list); rt_usbd_io_request(device, ep, req); - RT_DEBUG_LOG(RT_DEBUG_USB, ("fired a request\n")); + RT_DEBUG_LOG(RT_DEBUG_USB, ("fired a request\n")); } rt_list_init(&ep->request_list); @@ -601,10 +601,10 @@ static rt_err_t _standard_request(struct udevice* device, ureq_t setup) if(USB_EP_HALT == setup->wValue) { ep = rt_usbd_find_endpoint(device, RT_NULL, setup->wIndex); - ep->stalled = RT_TRUE; + ep->stalled = RT_TRUE; rt_usbd_set_feature(device, setup->wValue, setup->wIndex); dcd_ep0_send_status(dcd); - } + } } break; case USB_REQ_SYNCH_FRAME: @@ -698,7 +698,7 @@ static rt_err_t _vendor_request(udevice_t device, ureq_t setup) { rt_uint8_t * pusb_comp_id_desc; rt_list_t *p; - usb_comp_id_desc_size = sizeof(struct usb_os_header_comp_id_descriptor) + + usb_comp_id_desc_size = sizeof(struct usb_os_header_comp_id_descriptor) + (sizeof(struct usb_os_function_comp_id_descriptor)-sizeof(rt_list_t))*rt_list_len(&device->os_comp_id_desc->func_desc); usb_comp_id_desc = (rt_uint8_t *)rt_malloc(usb_comp_id_desc_size); @@ -707,7 +707,7 @@ static rt_err_t _vendor_request(udevice_t device, ureq_t setup) pusb_comp_id_desc = usb_comp_id_desc; rt_memcpy((void *)pusb_comp_id_desc,(void *)&device->os_comp_id_desc->head_desc,sizeof(struct usb_os_header_comp_id_descriptor)); pusb_comp_id_desc += sizeof(struct usb_os_header_comp_id_descriptor); - + for (p = device->os_comp_id_desc->func_desc.next; p != &device->os_comp_id_desc->func_desc; p = p->next) { func_comp_id_desc = rt_list_entry(p,struct usb_os_function_comp_id_descriptor,list); @@ -726,7 +726,7 @@ static rt_err_t _vendor_request(udevice_t device, ureq_t setup) } break; } - + break; } return RT_EOK; @@ -784,7 +784,7 @@ static rt_err_t _setup_request(udevice_t device, ureq_t setup) /** * This function will hanle data notify event. * - * @param device the usb device object. + * @param device the usb device object. * @param ep_msg the endpoint message. * * @return RT_EOK. @@ -794,18 +794,18 @@ static rt_err_t _data_notify(udevice_t device, struct ep_msg* ep_msg) uep_t ep; ufunction_t func; rt_size_t size = 0; - + RT_ASSERT(device != RT_NULL); RT_ASSERT(ep_msg != RT_NULL); - + if (device->state != USB_STATE_CONFIGURED) { return -RT_ERROR; } - + ep = rt_usbd_find_endpoint(device, &func, ep_msg->ep_addr); if(ep == RT_NULL) - { + { rt_kprintf("invalid endpoint\n"); return -RT_ERROR; } @@ -817,7 +817,7 @@ static rt_err_t _data_notify(udevice_t device, struct ep_msg* ep_msg) { dcd_ep_write(device->dcd, EP_ADDRESS(ep), ep->request.buffer, EP_MAXPACKET(ep)); ep->request.remain_size -= EP_MAXPACKET(ep); - ep->request.buffer += EP_MAXPACKET(ep); + ep->request.buffer += EP_MAXPACKET(ep); } else if(ep->request.remain_size > 0) { @@ -834,9 +834,9 @@ static rt_err_t _data_notify(udevice_t device, struct ep_msg* ep_msg) size = ep_msg->size; if(ep->request.remain_size == 0) { - return RT_EOK; + return RT_EOK; } - + if(size == 0) { size = dcd_ep_read(device->dcd, EP_ADDRESS(ep), ep->request.buffer); @@ -865,9 +865,9 @@ static rt_err_t _ep0_out_notify(udevice_t device, struct ep_msg* ep_msg) { uep_t ep0; rt_size_t size; - + RT_ASSERT(device != RT_NULL); - RT_ASSERT(ep_msg != RT_NULL); + RT_ASSERT(ep_msg != RT_NULL); RT_ASSERT(device->dcd != RT_NULL); ep0 = &device->dcd->ep0; @@ -875,18 +875,18 @@ static rt_err_t _ep0_out_notify(udevice_t device, struct ep_msg* ep_msg) if(ep0->request.remain_size == 0) { - return RT_EOK; - } + return RT_EOK; + } if(size == 0) { size = dcd_ep_read(device->dcd, EP0_OUT_ADDR, ep0->request.buffer); if(size == 0) { return RT_EOK; - } + } } - ep0->request.remain_size -= size; + ep0->request.remain_size -= size; ep0->request.buffer += size; if(ep0->request.remain_size == 0) { @@ -894,7 +894,7 @@ static rt_err_t _ep0_out_notify(udevice_t device, struct ep_msg* ep_msg) if(ep0->rx_indicate != RT_NULL) { ep0->rx_indicate(device, size); - } + } } else { @@ -959,10 +959,10 @@ static rt_err_t _stop_notify(udevice_t device) static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_size_t size) { rt_uint16_t maxpacket; - - RT_ASSERT(device != RT_NULL); + + RT_ASSERT(device != RT_NULL); RT_ASSERT(device->dcd != RT_NULL); - RT_ASSERT(ep != RT_NULL); + RT_ASSERT(ep != RT_NULL); rt_enter_critical(); maxpacket = EP_MAXPACKET(ep); @@ -970,11 +970,11 @@ static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_s { dcd_ep_write(device->dcd, EP_ADDRESS(ep), ep->request.buffer, maxpacket); ep->request.remain_size -= maxpacket; - ep->request.buffer += maxpacket; + ep->request.buffer += maxpacket; } else { - dcd_ep_write(device->dcd, EP_ADDRESS(ep), ep->request.buffer, + dcd_ep_write(device->dcd, EP_ADDRESS(ep), ep->request.buffer, ep->request.remain_size); ep->request.remain_size = 0; } @@ -984,9 +984,9 @@ static rt_size_t rt_usbd_ep_write(udevice_t device, uep_t ep, void *buffer, rt_s static rt_size_t rt_usbd_ep_read_prepare(udevice_t device, uep_t ep, void *buffer, rt_size_t size) { - RT_ASSERT(device != RT_NULL); + RT_ASSERT(device != RT_NULL); RT_ASSERT(device->dcd != RT_NULL); - RT_ASSERT(ep != RT_NULL); + RT_ASSERT(ep != RT_NULL); RT_ASSERT(buffer != RT_NULL); RT_ASSERT(ep->ep_desc != RT_NULL); @@ -1010,7 +1010,7 @@ udevice_t rt_usbd_device_new(void) udevice = (udevice_t)rt_malloc(sizeof(struct udevice)); if(udevice == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } rt_memset(udevice, 0, sizeof(struct udevice)); @@ -1124,7 +1124,7 @@ uconfig_t rt_usbd_config_new(void) cfg = (uconfig_t)rt_malloc(sizeof(struct uconfig)); if(cfg == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } rt_memset(cfg, 0, sizeof(struct uconfig)); @@ -1163,7 +1163,7 @@ uintf_t rt_usbd_interface_new(udevice_t device, uintf_handler_t handler) intf = (uintf_t)rt_malloc(sizeof(struct uinterface)); if(intf == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } intf->intf_num = device->nr_intf; @@ -1198,14 +1198,14 @@ ualtsetting_t rt_usbd_altsetting_new(rt_size_t desc_size) setting = (ualtsetting_t)rt_malloc(sizeof(struct ualtsetting)); if(setting == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } /* allocate memory for the desc */ setting->desc = rt_malloc(desc_size); if (setting->desc == RT_NULL) { - rt_kprintf("alloc desc memery failed\n"); + rt_kprintf("alloc desc memory failed\n"); rt_free(setting); return RT_NULL; } @@ -1263,7 +1263,7 @@ ufunction_t rt_usbd_function_new(udevice_t device, udev_desc_t dev_desc, func = (ufunction_t)rt_malloc(sizeof(struct ufunction)); if(func == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } func->dev_desc = dev_desc; @@ -1298,7 +1298,7 @@ uep_t rt_usbd_endpoint_new(uep_desc_t ep_desc, udep_handler_t handler) ep = (uep_t)rt_malloc(sizeof(struct uendpoint)); if(ep == RT_NULL) { - rt_kprintf("alloc memery failed\n"); + rt_kprintf("alloc memory failed\n"); return RT_NULL; } ep->ep_desc = ep_desc; @@ -1705,7 +1705,7 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value) device->curr_cfg = cfg; dcd_set_config(device->dcd, value); - + return RT_TRUE; } @@ -1713,7 +1713,7 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value) * This function will bRequest an IO transaction. * * @param device the usb device object. - * @param ep the endpoint object. + * @param ep the endpoint object. * @param req IO bRequest. * * @return RT_EOK. @@ -1721,7 +1721,7 @@ rt_err_t rt_usbd_set_config(udevice_t device, rt_uint8_t value) rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req) { rt_size_t size = 0; - + RT_ASSERT(device != RT_NULL); RT_ASSERT(req != RT_NULL); @@ -1747,7 +1747,7 @@ rt_size_t rt_usbd_io_request(udevice_t device, uep_t ep, uio_request_t req) { rt_list_insert_before(&ep->request_list, &req->list); RT_DEBUG_LOG(RT_DEBUG_USB, ("suspend a request\n")); - } + } return size; } @@ -1770,10 +1770,10 @@ rt_err_t rt_usbd_set_feature(udevice_t device, rt_uint16_t value, rt_uint16_t in } else if (value == USB_FEATURE_ENDPOINT_HALT) { - RT_DEBUG_LOG(RT_DEBUG_USB, ("set feature stall\n")); + RT_DEBUG_LOG(RT_DEBUG_USB, ("set feature stall\n")); dcd_ep_set_stall(device->dcd, (rt_uint32_t)(index & 0xFF)); } - + return RT_EOK; } @@ -1798,38 +1798,38 @@ rt_err_t rt_usbd_clear_feature(udevice_t device, rt_uint16_t value, rt_uint16_t RT_DEBUG_LOG(RT_DEBUG_USB, ("clear feature stall\n")); dcd_ep_clear_stall(device->dcd, (rt_uint32_t)(index & 0xFF)); } - + return RT_EOK; } rt_err_t rt_usbd_ep0_set_stall(udevice_t device) { RT_ASSERT(device != RT_NULL); - + return dcd_ep_set_stall(device->dcd, 0); } rt_err_t rt_usbd_ep0_clear_stall(udevice_t device) { RT_ASSERT(device != RT_NULL); - + return dcd_ep_clear_stall(device->dcd, 0); } rt_err_t rt_usbd_ep_set_stall(udevice_t device, uep_t ep) { rt_err_t ret; - + RT_ASSERT(device != RT_NULL); RT_ASSERT(ep != RT_NULL); - RT_ASSERT(ep->ep_desc != RT_NULL); + RT_ASSERT(ep->ep_desc != RT_NULL); ret = dcd_ep_set_stall(device->dcd, EP_ADDRESS(ep)); if(ret == RT_EOK) { ep->stalled = RT_TRUE; } - + return ret; } @@ -1846,44 +1846,44 @@ rt_err_t rt_usbd_ep_clear_stall(udevice_t device, uep_t ep) { ep->stalled = RT_FALSE; } - + return ret; } static rt_err_t rt_usbd_ep_assign(udevice_t device, uep_t ep) { int i = 0; - + RT_ASSERT(device != RT_NULL); - RT_ASSERT(device->dcd != RT_NULL); - RT_ASSERT(device->dcd->ep_pool != RT_NULL); + RT_ASSERT(device->dcd != RT_NULL); + RT_ASSERT(device->dcd->ep_pool != RT_NULL); RT_ASSERT(ep != RT_NULL); RT_ASSERT(ep->ep_desc != RT_NULL); while(device->dcd->ep_pool[i].addr != 0xFF) { - if(device->dcd->ep_pool[i].status == ID_UNASSIGNED && + if(device->dcd->ep_pool[i].status == ID_UNASSIGNED && ep->ep_desc->bmAttributes == device->dcd->ep_pool[i].type && (EP_ADDRESS(ep) & 0x80) == device->dcd->ep_pool[i].dir) { EP_ADDRESS(ep) |= device->dcd->ep_pool[i].addr; ep->id = &device->dcd->ep_pool[i]; device->dcd->ep_pool[i].status = ID_ASSIGNED; - RT_DEBUG_LOG(RT_DEBUG_USB, ("assigned %d\n", device->dcd->ep_pool[i].addr)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("assigned %d\n", device->dcd->ep_pool[i].addr)); return RT_EOK; } - + i++; } - + return -RT_ERROR; } rt_err_t rt_usbd_ep_unassign(udevice_t device, uep_t ep) { RT_ASSERT(device != RT_NULL); - RT_ASSERT(device->dcd != RT_NULL); - RT_ASSERT(device->dcd->ep_pool != RT_NULL); + RT_ASSERT(device->dcd != RT_NULL); + RT_ASSERT(device->dcd->ep_pool != RT_NULL); RT_ASSERT(ep != RT_NULL); RT_ASSERT(ep->ep_desc != RT_NULL); @@ -1911,8 +1911,8 @@ rt_err_t rt_usbd_ep0_setup_handler(udcd_t dcd, struct urequest* setup) else { rt_memcpy((void*)&msg.content.setup, (void*)setup, sizeof(struct urequest)); - } - + } + msg.type = USB_MSG_SETUP_NOTIFY; msg.dcd = dcd; rt_usbd_event_signal(&msg); @@ -2011,7 +2011,7 @@ rt_err_t rt_usbd_reset_handler(udcd_t dcd) struct udev_msg msg; RT_ASSERT(dcd != RT_NULL); - + msg.type = USB_MSG_RESET; msg.dcd = dcd; rt_usbd_event_signal(&msg); @@ -2024,7 +2024,7 @@ rt_err_t rt_usbd_connect_handler(udcd_t dcd) struct udev_msg msg; RT_ASSERT(dcd != RT_NULL); - + msg.type = USB_MSG_PLUG_IN; msg.dcd = dcd; rt_usbd_event_signal(&msg); @@ -2037,7 +2037,7 @@ rt_err_t rt_usbd_disconnect_handler(udcd_t dcd) struct udev_msg msg; RT_ASSERT(dcd != RT_NULL); - + msg.type = USB_MSG_PLUG_OUT; msg.dcd = dcd; rt_usbd_event_signal(&msg); @@ -2050,7 +2050,7 @@ rt_err_t rt_usbd_sof_handler(udcd_t dcd) struct udev_msg msg; RT_ASSERT(dcd != RT_NULL); - + msg.type = USB_MSG_SOF; msg.dcd = dcd; rt_usbd_event_signal(&msg); @@ -2063,7 +2063,7 @@ rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size) uep_t ep0; rt_size_t sent_size = 0; - RT_ASSERT(device != RT_NULL); + RT_ASSERT(device != RT_NULL); RT_ASSERT(device->dcd != RT_NULL); RT_ASSERT(buffer != RT_NULL); RT_ASSERT(size > 0); @@ -2085,7 +2085,7 @@ rt_size_t rt_usbd_ep0_write(udevice_t device, void *buffer, rt_size_t size) return dcd_ep_write(device->dcd, EP0_IN_ADDR, ep0->request.buffer, sent_size); } -rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size, +rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size, rt_err_t (*rx_ind)(udevice_t device, rt_size_t size)) { uep_t ep0; @@ -2096,7 +2096,7 @@ rt_size_t rt_usbd_ep0_read(udevice_t device, void *buffer, rt_size_t size, RT_ASSERT(buffer != RT_NULL); ep0 = &device->dcd->ep0; - ep0->request.buffer = (rt_uint8_t *)buffer; + ep0->request.buffer = (rt_uint8_t *)buffer; ep0->request.remain_size = size; ep0->rx_indicate = rx_ind; if(size >= ep0->id->maxpacket) @@ -2143,7 +2143,7 @@ static void rt_usbd_thread_entry(void* parameter) } RT_DEBUG_LOG(RT_DEBUG_USB, ("message type %d\n", msg.type)); - + switch (msg.type) { case USB_MSG_SOF: @@ -2160,7 +2160,7 @@ static void rt_usbd_thread_entry(void* parameter) case USB_MSG_EP0_OUT: _ep0_out_notify(device, &msg.content.ep_msg); break; - case USB_MSG_RESET: + case USB_MSG_RESET: RT_DEBUG_LOG(RT_DEBUG_USB, ("reset %d\n", device->state)); if (device->state == USB_STATE_ADDRESS || device->state == USB_STATE_CONFIGURED) _stop_notify(device); @@ -2170,7 +2170,7 @@ static void rt_usbd_thread_entry(void* parameter) device->state = USB_STATE_ATTACHED; break; case USB_MSG_PLUG_OUT: - device->state = USB_STATE_NOTATTACHED; + device->state = USB_STATE_NOTATTACHED; _stop_notify(device); break; default: @@ -2204,7 +2204,7 @@ static struct rt_thread usb_thread; #define USBD_MQ_MAX_MSG 16 /* internal of the message queue: every message is associated with a pointer, * so in order to recveive USBD_MQ_MAX_MSG messages, we have to allocate more - * than USBD_MQ_MSG_SZ*USBD_MQ_MAX_MSG memery. */ + * than USBD_MQ_MSG_SZ*USBD_MQ_MAX_MSG memory. */ static rt_uint8_t usb_mq_pool[(USBD_MQ_MSG_SZ+sizeof(void*))*USBD_MQ_MAX_MSG]; /** diff --git a/components/drivers/usb/usbhost/SConscript b/components/drivers/usb/usbhost/SConscript index b12adfc5a..081c73281 100644 --- a/components/drivers/usb/usbhost/SConscript +++ b/components/drivers/usb/usbhost/SConscript @@ -3,7 +3,7 @@ from building import * cwd = GetCurrentDir() src = Split(""" -core/core.c +core/usbhost_core.c core/driver.c core/usbhost.c core/hub.c diff --git a/components/drivers/usb/usbhost/class/adk.c b/components/drivers/usb/usbhost/class/adk.c index 2425de7bb..492a2f9bb 100644 --- a/components/drivers/usb/usbhost/class/adk.c +++ b/components/drivers/usb/usbhost/class/adk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/usb/usbhost/class/adk.h b/components/drivers/usb/usbhost/class/adk.h index 041d47c67..aebe7de70 100644 --- a/components/drivers/usb/usbhost/class/adk.h +++ b/components/drivers/usb/usbhost/class/adk.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,8 +8,8 @@ * 2011-12-12 Yi Qiu first version */ -#ifndef __HID_H__ -#define __HID_H__ +#ifndef __ADK_H__ +#define __ADK_H__ #include @@ -19,7 +19,7 @@ struct uadkinst upipe_t pipe_out; struct rt_device device; -}; +}; typedef struct uadkinst* uadk_t; #define USB_ACCESSORY_VENDOR_ID 0x18D1 diff --git a/components/drivers/usb/usbhost/class/hid.c b/components/drivers/usb/usbhost/class/hid.c index e16096877..4038d3b32 100644 --- a/components/drivers/usb/usbhost/class/hid.c +++ b/components/drivers/usb/usbhost/class/hid.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -23,31 +23,31 @@ static rt_list_t _protocal_list; * @param intf the interface instance. * @duration the idle period of requesting data. * @report_id the report id - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) { struct urequest setup; - struct uinstance* device; + struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(intf != RT_NULL); RT_ASSERT(intf->device != RT_NULL); device = intf->device; - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.request = USB_REQ_SET_IDLE; setup.index = 0; setup.length = 0; setup.value = (duration << 8 )| report_id; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, timeout) == 0) return RT_EOK; - else return -RT_FALSE; + else return -RT_FALSE; } /** @@ -56,32 +56,32 @@ rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id) * @param intf the interface instance. * @buffer the data buffer to save usb report descriptor. * @param nbytes the size of buffer - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, +rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, rt_uint8_t id, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(intf != RT_NULL); RT_ASSERT(intf->device != RT_NULL); device = intf->device; - setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.request = USB_REQ_GET_REPORT; setup.index = intf->intf_desc->bInterfaceNumber; setup.length = size; setup.value = (type << 8 ) + id; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, timeout) == size) return RT_EOK; - else return -RT_FALSE; + else return -RT_FALSE; } /** @@ -90,31 +90,31 @@ rt_err_t rt_usbh_hid_get_report(struct uintf* intf, rt_uint8_t type, * @param intf the interface instance. * @buffer the data buffer to save usb report descriptor. * @param nbytes the size of buffer - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; - struct uinstance* device; + struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(intf != RT_NULL); RT_ASSERT(intf->device != RT_NULL); - + device = intf->device; - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.request = USB_REQ_SET_REPORT; setup.index = intf->intf_desc->bInterfaceNumber; setup.length = size; setup.value = 0x02 << 8; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, timeout) == size) return RT_EOK; - else return -RT_FALSE; + else return -RT_FALSE; } /** @@ -122,7 +122,7 @@ rt_err_t rt_usbh_hid_set_report(struct uintf* intf, rt_uint8_t *buffer, rt_size_ * * @param intf the interface instance. * @param protocol the protocol id. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) @@ -130,56 +130,56 @@ rt_err_t rt_usbh_hid_set_protocal(struct uintf* intf, int protocol) struct urequest setup; struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(intf != RT_NULL); RT_ASSERT(intf->device != RT_NULL); - + device = intf->device; - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.request = USB_REQ_SET_PROTOCOL; setup.index = 0; setup.length = 0; setup.value = protocol; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, RT_NULL, 0, timeout) == 0) return RT_EOK; - else return -RT_FALSE; + else return -RT_FALSE; } /** - * This function will do USB_REQ_GET_DESCRIPTOR request for the device instance + * This function will do USB_REQ_GET_DESCRIPTOR request for the device instance * to set feature of the hub port. * * @param intf the interface instance. * @buffer the data buffer to save usb report descriptor. * @param nbytes the size of buffer - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, +rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, rt_uint8_t *buffer, rt_size_t size) { struct urequest setup; - struct uinstance* device; + struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(intf != RT_NULL); RT_ASSERT(intf->device != RT_NULL); - + device = intf->device; - setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD| + setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD| USB_REQ_TYPE_INTERFACE; setup.request = USB_REQ_GET_DESCRIPTOR; setup.index = 0; setup.length = size; setup.value = USB_DESC_TYPE_REPORT << 8; - if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, + if(rt_usb_hcd_control_xfer(device->hcd, device, &setup, buffer, size, timeout) == size) return RT_EOK; else return -RT_FALSE; } @@ -188,7 +188,7 @@ rt_err_t rt_usbh_hid_get_report_descriptor(struct uintf* intf, * This function will register specified hid protocal to protocal list * * @param protocal the specified protocal. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal) @@ -199,26 +199,26 @@ rt_err_t rt_usbh_hid_protocal_register(uprotocal_t protocal) /* insert class driver into driver list */ rt_list_insert_after(&_protocal_list, &(protocal->list)); - - return RT_EOK; + + return RT_EOK; } /** * This function is the callback function of hid's int endpoint, it is invoked when data comes. * * @param context the context of the callback function. - * + * * @return none. */ static void rt_usbh_hid_callback(void* context) { - upipe_t pipe; + upipe_t pipe; struct uhid* hid; int timeout = USB_TIMEOUT_LONG; /* parameter check */ RT_ASSERT(context != RT_NULL); - + pipe = (upipe_t)context; hid = (struct uhid*)pipe->intf->user_data; @@ -228,7 +228,7 @@ static void rt_usbh_hid_callback(void* context) /* parameter check */ RT_ASSERT(pipe->intf->device->hcd != RT_NULL); - rt_usb_hcd_int_xfer(pipe->intf->device->hcd, pipe, hid->buffer, + rt_usb_hcd_int_xfer(pipe->intf->device->hcd, pipe, hid->buffer, pipe->ep.wMaxPacketSize, timeout); } @@ -236,7 +236,7 @@ static void rt_usbh_hid_callback(void* context) * This function will find specified hid protocal from protocal list * * @param pro_id the protocal id. - * + * * @return the found protocal or RT_NULL if there is no this protocal. */ static uprotocal_t rt_usbh_hid_protocal_find(int pro_id) @@ -246,7 +246,7 @@ static uprotocal_t rt_usbh_hid_protocal_find(int pro_id) /* try to find protocal object */ for (node = _protocal_list.next; node != &_protocal_list; node = node->next) { - uprotocal_t protocal = + uprotocal_t protocal = (uprotocal_t)rt_list_entry(node, struct uprotocal, list); if (protocal->pro_id == pro_id) return protocal; } @@ -260,18 +260,18 @@ static uprotocal_t rt_usbh_hid_protocal_find(int pro_id) * as a hid class device, it will continue the enumulate process. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_hid_enable(void* arg) { int i = 0, pro_id; - uprotocal_t protocal; + uprotocal_t protocal; struct uhid* hid; struct uintf* intf = (struct uintf*)arg; int timeout = USB_TIMEOUT_BASIC; upipe_t pipe; - + /* parameter check */ if(intf == RT_NULL) { @@ -282,65 +282,65 @@ static rt_err_t rt_usbh_hid_enable(void* arg) pro_id = intf->intf_desc->bInterfaceProtocol; RT_DEBUG_LOG(RT_DEBUG_USB, - ("HID device enable, protocal id %d\n", pro_id)); + ("HID device enable, protocal id %d\n", pro_id)); - protocal = rt_usbh_hid_protocal_find(pro_id); + protocal = rt_usbh_hid_protocal_find(pro_id); if(protocal == RT_NULL) { rt_kprintf("can't find hid protocal %d\n", pro_id); - intf->user_data = RT_NULL; + intf->user_data = RT_NULL; return -RT_ERROR; } - + hid = rt_malloc(sizeof(struct uhid)); RT_ASSERT(hid != RT_NULL); - /* initilize the data structure */ + /* initilize the data structure */ rt_memset(hid, 0, sizeof(struct uhid)); intf->user_data = (void*)hid; hid->protocal = protocal; - + for(i=0; iintf_desc->bNumEndpoints; i++) - { + { rt_err_t ret; uep_desc_t ep_desc; - /* get endpoint descriptor */ + /* get endpoint descriptor */ rt_usbh_get_endpoint_descriptor(intf->intf_desc, i, &ep_desc); if(ep_desc == RT_NULL) { rt_kprintf("rt_usbh_get_endpoint_descriptor error\n"); return -RT_ERROR; } - - if(USB_EP_ATTR(ep_desc->bmAttributes) != USB_EP_ATTR_INT) + + if(USB_EP_ATTR(ep_desc->bmAttributes) != USB_EP_ATTR_INT) continue; - + if(!(ep_desc->bEndpointAddress & USB_DIR_IN)) continue; - ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &hid->pipe_in, - intf, ep_desc, rt_usbh_hid_callback); + ret = rt_usb_hcd_alloc_pipe(intf->device->hcd, &hid->pipe_in, + intf, ep_desc, rt_usbh_hid_callback); if(ret != RT_EOK) return ret; } /* initialize hid protocal */ - hid->protocal->init((void*)intf); + hid->protocal->init((void*)intf); pipe = hid->pipe_in; /* parameter check */ RT_ASSERT(pipe->intf->device->hcd != RT_NULL); - - rt_usb_hcd_int_xfer(pipe->intf->device->hcd, hid->pipe_in, + + rt_usb_hcd_int_xfer(pipe->intf->device->hcd, hid->pipe_in, hid->buffer, hid->pipe_in->ep.wMaxPacketSize, timeout); return RT_EOK; } /** - * This function will be invoked when usb device plug out is detected and it would clean + * This function will be invoked when usb device plug out is detected and it would clean * and release all hub class related resources. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_hid_disable(void* arg) @@ -361,10 +361,10 @@ static rt_err_t rt_usbh_hid_disable(void* arg) rt_usb_hcd_free_pipe(intf->device->hcd, hid->pipe_in); } - /* free the hid instance */ + /* free the hid instance */ rt_free(hid); } - + /* free the instance */ rt_free(intf); @@ -374,7 +374,7 @@ static rt_err_t rt_usbh_hid_disable(void* arg) /** * This function will register hid class driver to the usb class driver manager. * and it should be invoked in the usb system initialization. - * + * * @return the error code, RT_EOK on successfully. */ ucd_t rt_usbh_class_driver_hid(void) @@ -382,7 +382,7 @@ ucd_t rt_usbh_class_driver_hid(void) rt_list_init(&_protocal_list); hid_driver.class_code = USB_CLASS_HID; - + hid_driver.enable = rt_usbh_hid_enable; hid_driver.disable = rt_usbh_hid_disable; diff --git a/components/drivers/usb/usbhost/class/hid.h b/components/drivers/usb/usbhost/class/hid.h index 8e446c8ce..10d3c6ee4 100644 --- a/components/drivers/usb/usbhost/class/hid.h +++ b/components/drivers/usb/usbhost/class/hid.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,7 +18,7 @@ struct uhid upipe_t pipe_in; rt_uint8_t buffer[8]; uprotocal_t protocal; -}; +}; typedef struct uhid uhid_t; #define USB_REQ_GET_REPORT 0x01 @@ -28,7 +28,7 @@ typedef struct uhid uhid_t; #define USB_REQ_SET_IDLE 0x0a #define USB_REQ_SET_PROTOCOL 0x0b -#define USB_HID_KEYBOARD 1 +#define USB_HID_KEYBOARD 1 #define USB_HID_MOUSE 2 rt_err_t rt_usbh_hid_set_idle(struct uintf* intf, int duration, int report_id); diff --git a/components/drivers/usb/usbhost/class/mass.c b/components/drivers/usb/usbhost/class/mass.c index 20048873f..abd89a5ef 100644 --- a/components/drivers/usb/usbhost/class/mass.c +++ b/components/drivers/usb/usbhost/class/mass.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -24,29 +24,29 @@ static struct uclass_driver storage_driver; * * @param intf the interface instance. * @param max_lun the buffer to save max_lun. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t _pipe_check(struct uhintf* intf, upipe_t pipe) { - struct uinstance* device; + struct uinstance* device; rt_err_t ret; ustor_t stor; - int size = 0; + int size = 0; struct ustorage_csw csw; if(intf == RT_NULL || pipe == RT_NULL) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } + } - /* get usb device instance from the interface instance */ - device = intf->device; + /* get usb device instance from the interface instance */ + device = intf->device; - /* get storage instance from the interface instance */ + /* get storage instance from the interface instance */ stor = (ustor_t)intf->user_data; - + /* check pipe status */ if(pipe->status == UPIPE_STATUS_OK) return RT_EOK; @@ -58,11 +58,11 @@ static rt_err_t _pipe_check(struct uhintf* intf, upipe_t pipe) if(pipe->status == UPIPE_STATUS_STALL) { /* clear the pipe stall status */ - ret = rt_usbh_clear_feature(device, pipe->ep.bEndpointAddress, + ret = rt_usbh_clear_feature(device, pipe->ep.bEndpointAddress, USB_FEATURE_ENDPOINT_HALT); if(ret != RT_EOK) return ret; } - + rt_thread_delay(50); @@ -73,14 +73,14 @@ static rt_err_t _pipe_check(struct uhintf* intf, upipe_t pipe) RT_DEBUG_LOG(RT_DEBUG_USB, ("clean storage in pipe stall\n")); /* it should receive csw after clear the stall feature */ - size = rt_usb_hcd_pipe_xfer(stor->pipe_in->inst->hcd, + size = rt_usb_hcd_pipe_xfer(stor->pipe_in->inst->hcd, stor->pipe_in, &csw, SIZEOF_CSW, 100); - if(size != SIZEOF_CSW) + if(size != SIZEOF_CSW) { rt_kprintf("receive the csw after stall failed\n"); return -RT_EIO; } - + return -RT_ERROR; } @@ -89,35 +89,35 @@ static rt_err_t _pipe_check(struct uhintf* intf, upipe_t pipe) * * @param intf the interface instance. * @param max_lun the buffer to save max_lun. - * + * * @return the error code, RT_EOK on successfully. */ -static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, +static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, ustorage_cbw_t cmd, rt_uint8_t* buffer, int timeout) { rt_size_t size; - rt_err_t ret; + rt_err_t ret; upipe_t pipe; struct ustorage_csw csw; ustor_t stor; - RT_ASSERT(cmd != RT_NULL); + RT_ASSERT(cmd != RT_NULL); if(intf == RT_NULL) { rt_kprintf("the interface is not available\n"); return -RT_EIO; } - - /* get storage instance from the interface instance */ + + /* get storage instance from the interface instance */ stor = (ustor_t)intf->user_data; do { /* send the cbw */ - size = rt_usb_hcd_pipe_xfer(stor->pipe_out->inst->hcd, stor->pipe_out, + size = rt_usb_hcd_pipe_xfer(stor->pipe_out->inst->hcd, stor->pipe_out, cmd, SIZEOF_CBW, timeout); - if(size != SIZEOF_CBW) + if(size != SIZEOF_CBW) { rt_kprintf("CBW size error\n"); return -RT_EIO; @@ -126,20 +126,20 @@ static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, { pipe = (cmd->dflags == CBWFLAGS_DIR_IN) ? stor->pipe_in : stor->pipe_out; - size = rt_usb_hcd_pipe_xfer(pipe->inst->hcd, pipe, (void*)buffer, + size = rt_usb_hcd_pipe_xfer(pipe->inst->hcd, pipe, (void*)buffer, cmd->xfer_len, timeout); if(size != cmd->xfer_len) { - rt_kprintf("request size %d, transfer size %d\n", + rt_kprintf("request size %d, transfer size %d\n", cmd->xfer_len, size); break; - } + } } - + /* receive the csw */ - size = rt_usb_hcd_pipe_xfer(stor->pipe_in->inst->hcd, stor->pipe_in, + size = rt_usb_hcd_pipe_xfer(stor->pipe_in->inst->hcd, stor->pipe_in, &csw, SIZEOF_CSW, timeout); - if(size != SIZEOF_CSW) + if(size != SIZEOF_CSW) { rt_kprintf("csw size error\n"); return -RT_EIO; @@ -148,12 +148,12 @@ static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, /* check in pipes status */ ret = _pipe_check(intf, stor->pipe_in); - if(ret != RT_EOK) + if(ret != RT_EOK) { rt_kprintf("in pipe error\n"); return ret; } - + /* check out pipes status */ ret = _pipe_check(intf, stor->pipe_out); if(ret != RT_EOK) @@ -161,20 +161,20 @@ static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, rt_kprintf("out pipe error\n"); return ret; } - + /* check csw status */ if(csw.signature != CSW_SIGNATURE || csw.tag != CBW_TAG_VALUE) { rt_kprintf("csw signature error\n"); return -RT_EIO; } - + if(csw.status != 0) { //rt_kprintf("csw status error:%d\n",csw.status); return -RT_ERROR; } - + return RT_EOK; } @@ -183,12 +183,12 @@ static rt_err_t rt_usb_bulk_only_xfer(struct uhintf* intf, * * @param intf the interface instance. * @param max_lun the buffer to save max_lun. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun) { - struct uinstance* device; + struct uinstance* device; struct urequest setup; int timeout = USB_TIMEOUT_BASIC; @@ -196,17 +196,17 @@ rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } + } /* parameter check */ RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_get_max_lun\n")); - /* get usb device instance from the interface instance */ - device = intf->device; + /* get usb device instance from the interface instance */ + device = intf->device; /* construct the request */ - setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.bRequest = USBREQ_GET_MAX_LUN; setup.wValue = intf->intf_desc->bInterfaceNumber; @@ -233,13 +233,13 @@ rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun) * This function will do USBREQ_MASS_STORAGE_RESET request for the usb interface instance. * * @param intf the interface instance. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_reset(struct uhintf* intf) { struct urequest setup; - struct uinstance* device; + struct uinstance* device; int timeout = USB_TIMEOUT_BASIC; /* parameter check */ @@ -247,16 +247,16 @@ rt_err_t rt_usbh_storage_reset(struct uhintf* intf) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } + } RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_reset\n")); - /* get usb device instance from the interface instance */ - device = intf->device; + /* get usb device instance from the interface instance */ + device = intf->device; /* construct the request */ - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE; setup.bRequest = USBREQ_MASS_STORAGE_RESET; setup.wIndex = intf->intf_desc->bInterfaceNumber; @@ -279,12 +279,12 @@ rt_err_t rt_usbh_storage_reset(struct uhintf* intf) * * @param intf the interface instance. * @param buffer the data buffer to save read data - * @param sector the start sector address to read. + * @param sector the start sector address to read. * @param sector the sector count to read. - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, +rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, rt_uint32_t sector, rt_size_t count, int timeout) { struct ustorage_cbw cmd; @@ -294,8 +294,8 @@ rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, { rt_kprintf("interface is not available\n"); return -RT_EIO; - } - + } + RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_read10\n")); @@ -325,12 +325,12 @@ rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, * * @param intf the interface instance. * @param buffer the data buffer to save write data - * @param sector the start sector address to write. + * @param sector the start sector address to write. * @param sector the sector count to write. - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, +rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, rt_uint32_t sector, rt_size_t count, int timeout) { struct ustorage_cbw cmd; @@ -340,8 +340,8 @@ rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } - + } + RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_write10\n")); @@ -371,7 +371,7 @@ rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, * * @param intf the interface instance. * @param buffer the data buffer to save sense data - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer) @@ -384,12 +384,12 @@ rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } - + } + RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_request_sense\n")); - /* construct the command block wrapper */ + /* construct the command block wrapper */ rt_memset(&cmd, 0, sizeof(struct ustorage_cbw)); cmd.signature = CBW_SIGNATURE; cmd.tag = CBW_TAG_VALUE; @@ -407,7 +407,7 @@ rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer) * This function will execute SCSI_TEST_UNIT_READY command to get unit ready status. * * @param intf the interface instance. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf) @@ -420,8 +420,8 @@ rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } - + } + RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_test_unit_ready\n")); @@ -434,7 +434,7 @@ rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf) cmd.lun = 0; cmd.cb_len = 12; cmd.cb[0] = SCSI_TEST_UNIT_READY; - + return rt_usb_bulk_only_xfer(intf, &cmd, RT_NULL, timeout); } @@ -443,21 +443,21 @@ rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf) * * @param intf the interface instance. * @param buffer the data buffer to save inquiry data - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_inquiry(struct uhintf* intf, rt_uint8_t* buffer) { struct ustorage_cbw cmd; int timeout = USB_TIMEOUT_LONG; - + /* parameter check */ if(intf == RT_NULL) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } - + } + RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_inquiry\n")); @@ -480,7 +480,7 @@ rt_err_t rt_usbh_storage_inquiry(struct uhintf* intf, rt_uint8_t* buffer) * * @param intf the interface instance. * @param buffer the data buffer to save capacity data - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_storage_get_capacity(struct uhintf* intf, rt_uint8_t* buffer) @@ -493,7 +493,7 @@ rt_err_t rt_usbh_storage_get_capacity(struct uhintf* intf, rt_uint8_t* buffer) { rt_kprintf("the interface is not available\n"); return -RT_EIO; - } + } RT_ASSERT(intf->device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_get_capacity\n")); @@ -513,17 +513,17 @@ rt_err_t rt_usbh_storage_get_capacity(struct uhintf* intf, rt_uint8_t* buffer) /** * This function will run mass storage class driver when usb device is detected - * and identified as a mass storage class device, it will continue to do the enumulate + * and identified as a mass storage class device, it will continue to do the enumulate * process. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_storage_enable(void* arg) { int i = 0; - rt_err_t ret; + rt_err_t ret; ustor_t stor; struct uhintf* intf = (struct uhintf*)arg; @@ -534,25 +534,25 @@ static rt_err_t rt_usbh_storage_enable(void* arg) return -RT_EIO; } - RT_DEBUG_LOG(RT_DEBUG_USB, ("subclass %d, protocal %d\n", + RT_DEBUG_LOG(RT_DEBUG_USB, ("subclass %d, protocal %d\n", intf->intf_desc->bInterfaceSubClass, intf->intf_desc->bInterfaceProtocol)); - + RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_storage_run\n")); /* only support SCSI subclass and bulk only protocal */ - + stor = rt_malloc(sizeof(struct ustor)); RT_ASSERT(stor != RT_NULL); /* initilize the data structure */ - rt_memset(stor, 0, sizeof(struct ustor)); + rt_memset(stor, 0, sizeof(struct ustor)); intf->user_data = (void*)stor; for(i=0; iintf_desc->bNumEndpoints; i++) - { + { uep_desc_t ep_desc; - + /* get endpoint descriptor from interface descriptor */ rt_usbh_get_endpoint_descriptor(intf->intf_desc, i, &ep_desc); if(ep_desc == RT_NULL) @@ -560,11 +560,11 @@ static rt_err_t rt_usbh_storage_enable(void* arg) rt_kprintf("rt_usb_get_endpoint_descriptor error\n"); return -RT_ERROR; } - - /* the endpoint type of mass storage class should be BULK */ + + /* the endpoint type of mass storage class should be BULK */ if((ep_desc->bmAttributes & USB_EP_ATTR_TYPE_MASK) != USB_EP_ATTR_BULK) continue; - + /* allocate pipes according to the endpoint type */ if(ep_desc->bEndpointAddress & USB_DIR_IN) { @@ -572,7 +572,7 @@ static rt_err_t rt_usbh_storage_enable(void* arg) stor->pipe_in = rt_usb_instance_find_pipe(intf->device,ep_desc->bEndpointAddress); } else - { + { /* alloc an output pipe for the storage instance */ stor->pipe_out = rt_usb_instance_find_pipe(intf->device,ep_desc->bEndpointAddress); } @@ -583,8 +583,8 @@ static rt_err_t rt_usbh_storage_enable(void* arg) { rt_kprintf("pipe error, unsupported device\n"); return -RT_ERROR; - } - + } + /* should implement as callback */ ret = rt_udisk_run(intf); if(ret != RT_EOK) return ret; @@ -593,11 +593,11 @@ static rt_err_t rt_usbh_storage_enable(void* arg) } /** - * This function will be invoked when usb device plug out is detected and it would clean + * This function will be invoked when usb device plug out is detected and it would clean * and release all mass storage class related resources. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_storage_disable(void* arg) @@ -617,7 +617,7 @@ static rt_err_t rt_usbh_storage_disable(void* arg) rt_udisk_stop(intf); - + /* free storage instance */ if(stor != RT_NULL) rt_free(stor); return RT_EOK; @@ -626,13 +626,13 @@ static rt_err_t rt_usbh_storage_disable(void* arg) /** * This function will register mass storage class driver to the usb class driver manager. * and it should be invoked in the usb system initialization. - * + * * @return the error code, RT_EOK on successfully. */ ucd_t rt_usbh_class_driver_storage(void) { storage_driver.class_code = USB_CLASS_MASS_STORAGE; - + storage_driver.enable = rt_usbh_storage_enable; storage_driver.disable = rt_usbh_storage_disable; diff --git a/components/drivers/usb/usbhost/class/mass.h b/components/drivers/usb/usbhost/class/mass.h index 770e64a03..2578fb54c 100644 --- a/components/drivers/usb/usbhost/class/mass.h +++ b/components/drivers/usb/usbhost/class/mass.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,17 +30,17 @@ struct ustor upipe_t pipe_in; upipe_t pipe_out; rt_uint32_t capicity[2]; - + struct rt_device dev[MAX_PARTITION_COUNT]; rt_uint8_t dev_cnt; -}; +}; typedef struct ustor* ustor_t; rt_err_t rt_usbh_storage_get_max_lun(struct uhintf* intf, rt_uint8_t* max_lun); rt_err_t rt_usbh_storage_reset(struct uhintf* intf); -rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, +rt_err_t rt_usbh_storage_read10(struct uhintf* intf, rt_uint8_t *buffer, rt_uint32_t sector, rt_size_t count, int timeout); -rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, +rt_err_t rt_usbh_storage_write10(struct uhintf* intf, rt_uint8_t *buffer, rt_uint32_t sector, rt_size_t count, int timeout); rt_err_t rt_usbh_storage_request_sense(struct uhintf* intf, rt_uint8_t* buffer); rt_err_t rt_usbh_storage_test_unit_ready(struct uhintf* intf); diff --git a/components/drivers/usb/usbhost/class/udisk.c b/components/drivers/usb/usbhost/class/udisk.c index 1509a2610..8be311e65 100644 --- a/components/drivers/usb/usbhost/class/udisk.c +++ b/components/drivers/usb/usbhost/class/udisk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -186,7 +186,7 @@ rt_err_t rt_udisk_run(struct uhintf* intf) { int i = 0; rt_err_t ret; - char dname[4]; + char dname[8]; char sname[8]; rt_uint8_t max_lun, *sector, sense[18], inquiry[36]; struct dfs_partition part[MAX_PARTITION_COUNT]; diff --git a/components/drivers/usb/usbhost/class/ukbd.c b/components/drivers/usb/usbhost/class/ukbd.c index 7d608de25..c89d60cd3 100644 --- a/components/drivers/usb/usbhost/class/ukbd.c +++ b/components/drivers/usb/usbhost/class/ukbd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,13 +14,13 @@ #if defined(RT_USBH_HID) && defined(RT_USBH_HID_KEYBOARD) -static struct uprotocal kbd_protocal; +static struct uprotocal kbd_protocal; static rt_err_t rt_usbh_hid_kbd_callback(void* arg) { int int1, int2; - struct uhid* hid; - + struct uhid* hid; + hid = (struct uhid*)arg; int1 = *(rt_uint32_t*)hid->buffer; @@ -28,9 +28,9 @@ static rt_err_t rt_usbh_hid_kbd_callback(void* arg) if(int1 != 0 || int2 != 0) { - RT_DEBUG_LOG(RT_DEBUG_USB, ("key down 0x%x, 0x%x\n", int1, int2)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("key down 0x%x, 0x%x\n", int1, int2)); } - + return RT_EOK; } @@ -38,20 +38,20 @@ static rt_err_t rt_usbh_hid_kbd_init(void* arg) { struct uintf* intf = (struct uintf*)arg; - RT_ASSERT(intf != RT_NULL); - + RT_ASSERT(intf != RT_NULL); + rt_usbh_hid_set_protocal(intf, 0); rt_usbh_hid_set_idle(intf, 10, 0); - //RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb keyboard\n")); + //RT_DEBUG_LOG(RT_DEBUG_USB, ("start usb keyboard\n")); return RT_EOK; } /** * This function will define the hid keyboard protocal, it will be register to the protocal list. - * + * * @return the keyboard protocal structure. */ uprotocal_t rt_usbh_hid_protocal_kbd(void) diff --git a/components/drivers/usb/usbhost/class/umouse.c b/components/drivers/usb/usbhost/class/umouse.c index e769475a9..94fca210b 100644 --- a/components/drivers/usb/usbhost/class/umouse.c +++ b/components/drivers/usb/usbhost/class/umouse.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/usb/usbhost/core/driver.c b/components/drivers/usb/usbhost/core/driver.c index 37327108c..6dad1409a 100644 --- a/components/drivers/usb/usbhost/core/driver.c +++ b/components/drivers/usb/usbhost/core/driver.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,21 +17,21 @@ static rt_list_t _driver_list; /** * This function will initilize the usb class driver related data structure, * and it should be invoked in the usb system initialization. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_class_driver_init(void) { rt_list_init(&_driver_list); - return RT_EOK; + return RT_EOK; } /** * This function will register an usb class driver to the class driver manager. * * @param drv the pointer of the usb class driver. - * + * * @return the error code, RT_EOK on successfully. */ @@ -41,15 +41,15 @@ rt_err_t rt_usbh_class_driver_register(ucd_t drv) /* insert class driver into driver list */ rt_list_insert_after(&_driver_list, &(drv->list)); - - return RT_EOK; + + return RT_EOK; } /** * This function will removes a previously registed usb class driver. * * @param drv the pointer of the usb class driver structure. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_class_driver_unregister(ucd_t drv) @@ -67,7 +67,7 @@ rt_err_t rt_usbh_class_driver_unregister(ucd_t drv) * * @param drv the pointer of usb class driver. * @param args the parameter of run function. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args) @@ -85,7 +85,7 @@ rt_err_t rt_usbh_class_driver_enable(ucd_t drv, void* args) * * @param drv the pointer of usb class driver structure. * @param args the argument of the stop function. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args) @@ -102,7 +102,7 @@ rt_err_t rt_usbh_class_driver_disable(ucd_t drv, void* args) /** * This function finds a usb class driver by specified class code and subclass code. * - * @param class_code the usb class driver's class code. + * @param class_code the usb class driver's class code. * @param subclass_code the usb class driver's sub class code. * * @return the registered usb class driver on successful, or RT_NULL on failure. @@ -118,7 +118,7 @@ ucd_t rt_usbh_class_driver_find(int class_code, int subclass_code) /* try to find driver object */ for (node = _driver_list.next; node != &_driver_list; node = node->next) { - ucd_t drv = + ucd_t drv = (ucd_t)rt_list_entry(node, struct uclass_driver, list); if (drv->class_code == class_code) { diff --git a/components/drivers/usb/usbhost/core/hub.c b/components/drivers/usb/usbhost/core/hub.c index 80ed9b4e3..b6381ec30 100644 --- a/components/drivers/usb/usbhost/core/hub.c +++ b/components/drivers/usb/usbhost/core/hub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -77,7 +77,7 @@ static rt_err_t root_hub_ctrl(struct uhcd *hcd, rt_uint16_t port, rt_uint8_t cmd return RT_ERROR; } return RT_EOK; -} +} void rt_usbh_root_hub_connect_handler(struct uhcd *hcd, rt_uint8_t port, rt_bool_t isHS) { struct uhost_msg msg; @@ -106,23 +106,23 @@ void rt_usbh_root_hub_disconnect_handler(struct uhcd *hcd, rt_uint8_t port) } /** - * This function will do USB_REQ_GET_DESCRIPTOR bRequest for the device instance + * This function will do USB_REQ_GET_DESCRIPTOR bRequest for the device instance * to get usb hub descriptor. * * @param intf the interface instance. * @buffer the data buffer to save usb hub descriptor. * @param nbytes the size of buffer - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer, rt_size_t nbytes) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(device != RT_NULL); - + setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_GET_DESCRIPTOR; setup.wIndex = 0; @@ -135,24 +135,24 @@ rt_err_t rt_usbh_hub_get_descriptor(struct uinstance* device, rt_uint8_t *buffer { return RT_EOK; } - } - return -RT_FALSE; + } + return -RT_FALSE; } /** - * This function will do USB_REQ_GET_STATUS bRequest for the device instance + * This function will do USB_REQ_GET_STATUS bRequest for the device instance * to get usb hub status. * * @param intf the interface instance. * @buffer the data buffer to save usb hub status. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint32_t* buffer) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(device != RT_NULL); @@ -168,31 +168,31 @@ rt_err_t rt_usbh_hub_get_status(struct uinstance* device, rt_uint32_t* buffer) return RT_EOK; } } - return -RT_FALSE; + return -RT_FALSE; } /** - * This function will do USB_REQ_GET_STATUS bRequest for the device instance + * This function will do USB_REQ_GET_STATUS bRequest for the device instance * to get hub port status. * * @param intf the interface instance. * @port the hub port to get status. * @buffer the data buffer to save usb hub status. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port, rt_uint32_t* buffer) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(hub != RT_NULL); /* get roothub port status */ if(hub->is_roothub) { - root_hub_ctrl(hub->hcd, port, RH_GET_PORT_STATUS, + root_hub_ctrl(hub->hcd, port, RH_GET_PORT_STATUS, (void*)buffer); return RT_EOK; } @@ -210,36 +210,36 @@ rt_err_t rt_usbh_hub_get_port_status(uhub_t hub, rt_uint16_t port, rt_uint32_t* return RT_EOK; } } - return -RT_FALSE; + return -RT_FALSE; } /** - * This function will do USB_REQ_CLEAR_FEATURE bRequest for the device instance + * This function will do USB_REQ_CLEAR_FEATURE bRequest for the device instance * to clear feature of the hub port. * * @param intf the interface instance. * @port the hub port. * @feature feature to be cleared. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port, rt_uint16_t feature) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(hub != RT_NULL); /* clear roothub feature */ if(hub->is_roothub) { - root_hub_ctrl(hub->hcd, port, RH_CLEAR_PORT_FEATURE, + root_hub_ctrl(hub->hcd, port, RH_CLEAR_PORT_FEATURE, (void*)(rt_uint32_t)feature); return RT_EOK; } - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_OTHER; setup.bRequest = USB_REQ_CLEAR_FEATURE; setup.wIndex = port; @@ -250,37 +250,37 @@ rt_err_t rt_usbh_hub_clear_port_feature(uhub_t hub, rt_uint16_t port, rt_uint16_ { return RT_EOK; } - return -RT_FALSE; + return -RT_FALSE; } /** - * This function will do USB_REQ_SET_FEATURE bRequest for the device instance + * This function will do USB_REQ_SET_FEATURE bRequest for the device instance * to set feature of the hub port. * * @param intf the interface instance. * @port the hub port. * @feature feature to be set. - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port, +rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port, rt_uint16_t feature) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + /* parameter check */ RT_ASSERT(hub != RT_NULL); /* clear roothub feature */ if(hub->is_roothub) { - root_hub_ctrl(hub->hcd, port, RH_SET_PORT_FEATURE, + root_hub_ctrl(hub->hcd, port, RH_SET_PORT_FEATURE, (void*)(rt_uint32_t)feature); return RT_EOK; } - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_CLASS | USB_REQ_TYPE_OTHER; setup.bRequest = USB_REQ_SET_FEATURE; setup.wIndex = port; @@ -291,7 +291,7 @@ rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port, { return RT_EOK; } - else return -RT_FALSE; + else return -RT_FALSE; } /** @@ -299,17 +299,17 @@ rt_err_t rt_usbh_hub_set_port_feature(uhub_t hub, rt_uint16_t port, * * @param intf the interface instance. * @param port the hub port. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port) { rt_err_t ret; rt_uint32_t pstatus; - + /* parameter check */ RT_ASSERT(hub != RT_NULL); - + rt_thread_delay(50); /* reset hub port */ @@ -321,12 +321,12 @@ rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port) ret = rt_usbh_hub_get_port_status(hub, port, &pstatus); if(!(pstatus & PORT_PRS)) break; } - + /* clear port reset feature */ - ret = rt_usbh_hub_clear_port_feature(hub, port, PORT_FEAT_C_RESET); + ret = rt_usbh_hub_clear_port_feature(hub, port, PORT_FEAT_C_RESET); if(ret != RT_EOK) return ret; - rt_thread_delay(50); + rt_thread_delay(50); return RT_EOK; } @@ -336,7 +336,7 @@ rt_err_t rt_usbh_hub_reset_port(uhub_t hub, rt_uint16_t port) * * @param device the usb instance. * @param port the hub port. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port) @@ -356,15 +356,15 @@ rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port) { ret = rt_usbh_hub_get_port_status(hub, port, &pstatus); if(ret != RT_EOK) return ret; - - if(!(pstatus & PORT_CCS)) + + if(!(pstatus & PORT_CCS)) { connect = RT_FALSE; break; } - + rt_thread_delay(delayticks); - } + } if(connect) return RT_EOK; else return -RT_ERROR; @@ -375,7 +375,7 @@ rt_err_t rt_usbh_hub_port_debounce(uhub_t hub, rt_uint16_t port) * disconnect events. * * @param intf the interface instance. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) @@ -386,7 +386,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) /* parameter check */ RT_ASSERT(hub != RT_NULL); - /* get usb device instance */ + /* get usb device instance */ for (i = 0; i < hub->num_ports; i++) { rt_err_t ret; @@ -394,7 +394,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) rt_uint32_t pstatus = 0; reconnect = RT_FALSE; - + /* get hub port status */ ret = rt_usbh_hub_get_port_status(hub, i + 1, &pstatus); if(ret != RT_EOK) continue; @@ -402,8 +402,8 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) RT_DEBUG_LOG(RT_DEBUG_USB, ("port %d status 0x%x\n", i + 1, pstatus)); /* check port status change */ - if (pstatus & PORT_CCSC) - { + if (pstatus & PORT_CCSC) + { /* clear port status change feature */ rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_CONNECTION); reconnect = RT_TRUE; @@ -411,34 +411,39 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) if(pstatus & PORT_PESC) { - rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_ENABLE); + rt_usbh_hub_clear_port_feature(hub, i + 1, PORT_FEAT_C_ENABLE); reconnect = RT_TRUE; } - + if(reconnect) - { - if(hub->child[i] != RT_NULL && hub->child[i]->status != DEV_STATUS_IDLE) + { + if(hub->child[i] != RT_NULL && hub->child[i]->status != DEV_STATUS_IDLE) + { rt_usbh_detach_instance(hub->child[i]); - + + /* Child device have been detach. Set hub->child[i] to NULL. */ + hub->child[i] = RT_NULL; + } + ret = rt_usbh_hub_port_debounce(hub, i + 1); if(ret != RT_EOK) continue; - + /* allocate an usb instance for new connected device */ device = rt_usbh_alloc_instance(hub->hcd); if(device == RT_NULL) break; - + /* set usb device speed */ device->speed = (pstatus & PORT_LSDA) ? 1 : 0; - device->parent_hub = hub; + device->parent_hub = hub; device->hcd = hub->hcd; device->port = i + 1; hub->child[i] = device; /* reset usb roothub port */ rt_usbh_hub_reset_port(hub, i + 1); - + /* attatch the usb instance to the hcd */ - rt_usbh_attatch_instance(device); + rt_usbh_attatch_instance(device); } } @@ -449,7 +454,7 @@ static rt_err_t rt_usbh_hub_port_change(uhub_t hub) * This function is the callback function of hub's int endpoint, it is invoked when data comes. * * @param context the context of the callback function. - * + * * @return none. */ static void rt_usbh_hub_irq(void* context) @@ -457,9 +462,9 @@ static void rt_usbh_hub_irq(void* context) upipe_t pipe; uhub_t hub; int timeout = USB_TIMEOUT_BASIC; - + RT_ASSERT(context != RT_NULL); - + pipe = (upipe_t)context; hub = (uhub_t)pipe->user_data; @@ -468,14 +473,14 @@ static void rt_usbh_hub_irq(void* context) RT_DEBUG_LOG(RT_DEBUG_USB,("hub irq error\n")); return; } - + rt_usbh_hub_port_change(hub); RT_DEBUG_LOG(RT_DEBUG_USB,("hub int xfer...\n")); /* parameter check */ RT_ASSERT(pipe->inst->hcd != RT_NULL); - + rt_usb_hcd_pipe_xfer(hub->self->hcd, pipe, hub->buffer, pipe->ep.wMaxPacketSize, timeout); } @@ -484,7 +489,7 @@ static void rt_usbh_hub_irq(void* context) * as a hub class device, it will continue to do the enumulate process. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ @@ -500,7 +505,7 @@ static rt_err_t rt_usbh_hub_enable(void *arg) int timeout = USB_TIMEOUT_LONG; /* paremeter check */ RT_ASSERT(intf != RT_NULL); - + RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usbh_hub_run\n")); /* get usb device instance */ @@ -508,8 +513,9 @@ static rt_err_t rt_usbh_hub_enable(void *arg) /* create a hub instance */ hub = rt_malloc(sizeof(struct uhub)); + RT_ASSERT(hub != RT_NULL); rt_memset(hub, 0, sizeof(struct uhub)); - + /* make interface instance's user data point to hub instance */ intf->user_data = (void*)hub; @@ -518,20 +524,25 @@ static rt_err_t rt_usbh_hub_enable(void *arg) if(ret != RT_EOK) { rt_kprintf("get hub descriptor failed\n"); - return -RT_ERROR; + return -RT_ERROR; } /* get full hub descriptor */ - ret = rt_usbh_hub_get_descriptor(device, (rt_uint8_t*)&hub->hub_desc, + ret = rt_usbh_hub_get_descriptor(device, (rt_uint8_t*)&hub->hub_desc, hub->hub_desc.length); if(ret != RT_EOK) { rt_kprintf("get hub descriptor again failed\n"); - return -RT_ERROR; - } + return -RT_ERROR; + } /* get hub ports number */ - hub->num_ports = hub->hub_desc.num_ports; + /* If hub device supported ports over USB_HUB_PORT_NUM(Ex: 8 port hub). Set hub->num_ports to USB_HUB_PORT_NUM */ + if(hub->hub_desc.num_ports > USB_HUB_PORT_NUM) + hub->num_ports = USB_HUB_PORT_NUM; + else + hub->num_ports = hub->hub_desc.num_ports; + hub->hcd = device->hcd; hub->self = device; @@ -543,7 +554,7 @@ static rt_err_t rt_usbh_hub_enable(void *arg) * 2 * RT_TICK_PER_SECOND / 1000 ); } - if(intf->intf_desc->bNumEndpoints != 1) + if(intf->intf_desc->bNumEndpoints != 1) return -RT_ERROR; /* get endpoint descriptor from interface descriptor */ @@ -554,12 +565,12 @@ static rt_err_t rt_usbh_hub_enable(void *arg) return -RT_ERROR; } - /* the endpoint type of hub class should be interrupt */ + /* the endpoint type of hub class should be interrupt */ if( USB_EP_ATTR(ep_desc->bmAttributes) == USB_EP_ATTR_INT) { /* the endpoint direction of hub class should be in */ if(ep_desc->bEndpointAddress & USB_DIR_IN) - { + { /* allocate a pipe according to the endpoint type */ pipe_in = rt_usb_instance_find_pipe(device,ep_desc->bEndpointAddress); if(pipe_in == RT_NULL) @@ -574,17 +585,17 @@ static rt_err_t rt_usbh_hub_enable(void *arg) /* parameter check */ RT_ASSERT(device->hcd != RT_NULL); pipe_in->user_data = hub; - rt_usb_hcd_pipe_xfer(hub->hcd, pipe_in, hub->buffer, + rt_usb_hcd_pipe_xfer(hub->hcd, pipe_in, hub->buffer, pipe_in->ep.wMaxPacketSize, timeout); return RT_EOK; } /** - * This function will be invoked when usb hub plug out is detected and it would clean + * This function will be invoked when usb hub plug out is detected and it would clean * and release all hub class related resources. * * @param arg the argument. - * + * * @return the error code, RT_EOK on successfully. */ static rt_err_t rt_usbh_hub_disable(void* arg) @@ -604,9 +615,8 @@ static rt_err_t rt_usbh_hub_disable(void* arg) if(hub->child[i] != RT_NULL) rt_usbh_detach_instance(hub->child[i]); } - + if(hub != RT_NULL) rt_free(hub); - if(intf != RT_NULL) rt_free(intf); return RT_EOK; } @@ -614,13 +624,13 @@ static rt_err_t rt_usbh_hub_disable(void* arg) /** * This function will register hub class driver to the usb class driver manager. * and it should be invoked in the usb system initialization. - * + * * @return the error code, RT_EOK on successfully. */ ucd_t rt_usbh_class_driver_hub(void) -{ +{ hub_driver.class_code = USB_CLASS_HUB; - + hub_driver.enable = rt_usbh_hub_enable; hub_driver.disable = rt_usbh_hub_disable; @@ -628,27 +638,27 @@ ucd_t rt_usbh_class_driver_hub(void) } /** - * This function is the main entry of usb hub thread, it is in charge of - * processing all messages received from the usb message buffer. + * This function is the main entry of usb hub thread, it is in charge of + * processing all messages received from the usb message buffer. * * @param parameter the parameter of the usb host thread. - * + * * @return none. */ static void rt_usbh_hub_thread_entry(void* parameter) -{ +{ while(1) - { + { struct uhost_msg msg; - + /* receive message */ - if(rt_mq_recv(usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) + if(rt_mq_recv(usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) != RT_EOK ) continue; //RT_DEBUG_LOG(RT_DEBUG_USB, ("msg type %d\n", msg.type)); - + switch (msg.type) - { + { case USB_MSG_CONNECT_CHANGE: rt_usbh_hub_port_change(msg.content.hub); break; @@ -658,7 +668,7 @@ static void rt_usbh_hub_thread_entry(void* parameter) break; default: break; - } + } } } @@ -666,8 +676,8 @@ static void rt_usbh_hub_thread_entry(void* parameter) * This function will post an message to the usb message queue, * * @param msg the message to be posted - * - * @return the error code, RT_EOK on successfully. + * + * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_event_signal(struct uhost_msg* msg) { @@ -683,7 +693,7 @@ rt_err_t rt_usbh_event_signal(struct uhost_msg* msg) * This function will initialize usb hub thread. * * @return none. - * + * */ void rt_usbh_hub_init(uhcd_t hcd) { @@ -695,9 +705,9 @@ void rt_usbh_hub_init(uhcd_t hcd) root_hub.num_ports = hcd->num_ports; /* create usb message queue */ usb_mq = rt_mq_create("usbh", 32, 16, RT_IPC_FLAG_FIFO); - + /* create usb hub thread */ - thread = rt_thread_create("usbh", rt_usbh_hub_thread_entry, RT_NULL, + thread = rt_thread_create("usbh", rt_usbh_hub_thread_entry, RT_NULL, USB_THREAD_STACK_SIZE, 8, 20); if(thread != RT_NULL) { diff --git a/components/drivers/usb/usbhost/core/usbhost.c b/components/drivers/usb/usbhost/core/usbhost.c index f0294238c..a76f6d458 100644 --- a/components/drivers/usb/usbhost/core/usbhost.c +++ b/components/drivers/usb/usbhost/core/usbhost.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,13 +19,13 @@ /** * This function will initialize the usb host stack, all the usb class driver and * host controller driver are also be initialized here. - * + * * @return none. */ rt_err_t rt_usb_host_init(void) { ucd_t drv; - rt_device_t uhc; + rt_device_t uhc; uhc = rt_device_find(USB_HOST_CONTROLLER_NAME); if(uhc == RT_NULL) diff --git a/components/drivers/usb/usbhost/core/core.c b/components/drivers/usb/usbhost/core/usbhost_core.c similarity index 94% rename from components/drivers/usb/usbhost/core/core.c rename to components/drivers/usb/usbhost/core/usbhost_core.c index 71341a33c..71fe3b8b3 100644 --- a/components/drivers/usb/usbhost/core/core.c +++ b/components/drivers/usb/usbhost/core/usbhost_core.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,28 +27,28 @@ uinst_t rt_usbh_alloc_instance(uhcd_t uhcd) /* lock scheduler */ rt_enter_critical(); - + for(i=0; idev_desc; - + /* alloc address 0 ep0 pipe*/ ep0_out_desc.wMaxPacketSize = 8; ep0_in_desc.wMaxPacketSize = 8; @@ -106,7 +106,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_in, device, &ep0_in_desc); RT_DEBUG_LOG(RT_DEBUG_USB, ("start enumnation\n")); - + /* get device descriptor head */ ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, 8); if(ret != RT_EOK) @@ -114,7 +114,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) rt_kprintf("get device descriptor head failed\n"); return ret; } - + /* reset bus */ rt_usbh_hub_reset_port(device->parent_hub, device->port); rt_thread_delay(2); @@ -127,20 +127,20 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) return ret; } /* free address 0 ep0 pipe*/ - + rt_usb_hcd_free_pipe(device->hcd,device->pipe_ep0_out); rt_usb_hcd_free_pipe(device->hcd,device->pipe_ep0_in); - + /* set device max packet size */ ep0_out_desc.wMaxPacketSize = device->dev_desc.bMaxPacketSize0; ep0_in_desc.wMaxPacketSize = device->dev_desc.bMaxPacketSize0; - + /* alloc true address ep0 pipe*/ rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_out, device, &ep0_out_desc); rt_usb_hcd_alloc_pipe(device->hcd, &device->pipe_ep0_in, device, &ep0_in_desc); RT_DEBUG_LOG(RT_DEBUG_USB, ("get device descriptor length %d\n", dev_desc->bLength)); - + /* get full device descriptor again */ ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_DEVICE, (void*)dev_desc, dev_desc->bLength); if(ret != RT_EOK) @@ -162,10 +162,14 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) /* alloc memory for configuration descriptor */ device->cfg_desc = (ucfg_desc_t)rt_malloc(cfg_desc.wTotalLength); + if(device->cfg_desc == RT_NULL) + { + return RT_ENOMEM; + } rt_memset(device->cfg_desc, 0, cfg_desc.wTotalLength); /* get full configuration descriptor */ - ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_CONFIGURATION, + ret = rt_usbh_get_descriptor(device, USB_DESC_TYPE_CONFIGURATION, device->cfg_desc, cfg_desc.wTotalLength); if(ret != RT_EOK) { @@ -175,12 +179,12 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) /* set configuration */ ret = rt_usbh_set_configure(device, 1); - if(ret != RT_EOK) + if(ret != RT_EOK) { return ret; } for(i=0; icfg_desc->bNumInterfaces; i++) - { + { /* get interface descriptor through configuration descriptor */ ret = rt_usbh_get_interface_descriptor(device->cfg_desc, i, &intf_desc); if(ret != RT_EOK) @@ -189,7 +193,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) return -RT_ERROR; } - RT_DEBUG_LOG(RT_DEBUG_USB, ("interface class 0x%x, subclass 0x%x\n", + RT_DEBUG_LOG(RT_DEBUG_USB, ("interface class 0x%x, subclass 0x%x\n", intf_desc->bInterfaceClass, intf_desc->bInterfaceSubClass)); /* alloc pipe*/ @@ -212,13 +216,17 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) } } /* find driver by class code found in interface descriptor */ - drv = rt_usbh_class_driver_find(intf_desc->bInterfaceClass, + drv = rt_usbh_class_driver_find(intf_desc->bInterfaceClass, intf_desc->bInterfaceSubClass); - + if(drv != RT_NULL) { /* allocate memory for interface device */ device->intf[i] = (struct uhintf*)rt_malloc(sizeof(struct uhintf)); + if(device->intf[i] == RT_NULL) + { + return RT_ENOMEM; + } device->intf[i]->drv = drv; device->intf[i]->device = device; device->intf[i]->intf_desc = intf_desc; @@ -237,7 +245,7 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) continue; } } - + return RT_EOK; } @@ -246,19 +254,19 @@ rt_err_t rt_usbh_attatch_instance(uinst_t device) * and release all resource. * * @param device the usb device instance. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_detach_instance(uinst_t device) { int i = 0; rt_list_t * l; - if(device == RT_NULL) + if(device == RT_NULL) { rt_kprintf("no usb instance to detach\n"); return -RT_ERROR; } - + /* free configration descriptor */ if (device->cfg_desc) { for (i = 0; i < device->cfg_desc->bNumInterfaces; i++) @@ -274,10 +282,10 @@ rt_err_t rt_usbh_detach_instance(uinst_t device) } rt_free(device->cfg_desc); } - + rt_usb_hcd_free_pipe(device->hcd,device->pipe_ep0_out); rt_usb_hcd_free_pipe(device->hcd,device->pipe_ep0_in); - + while(device->pipe.next!= &device->pipe) { l = device->pipe.next; @@ -285,29 +293,29 @@ rt_err_t rt_usbh_detach_instance(uinst_t device) rt_usb_hcd_free_pipe(device->hcd,rt_list_entry(l,struct upipe,list)); } rt_memset(device, 0, sizeof(struct uinstance)); - + return RT_EOK; } /** * This function will do USB_REQ_GET_DESCRIPTO' bRequest for the usb device instance, * - * @param device the usb device instance. + * @param device the usb device instance. * @param type the type of descriptor bRequest. * @param buffer the data buffer to save requested data * @param nbytes the size of buffer - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer, +rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer, int nbytes) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + RT_ASSERT(device != RT_NULL); - setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD | + setup.request_type = USB_REQ_TYPE_DIR_IN | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_GET_DESCRIPTOR; setup.wIndex = 0; @@ -331,19 +339,19 @@ rt_err_t rt_usbh_get_descriptor(uinst_t device, rt_uint8_t type, void* buffer, * This function will set an address to the usb device. * * @param device the usb device instance. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_set_address(uinst_t device) { struct urequest setup; int timeout = USB_TIMEOUT_BASIC; - + RT_ASSERT(device != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_set_address\n")); - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_SET_ADDRESS; setup.wIndex = 0; @@ -367,7 +375,7 @@ rt_err_t rt_usbh_set_address(uinst_t device) * * @param device the usb device instance. * @param config the configuration number. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_set_configure(uinst_t device, int config) @@ -378,7 +386,7 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config) /* check parameter */ RT_ASSERT(device != RT_NULL); - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_DEVICE; setup.bRequest = USB_REQ_SET_CONFIGURATION; setup.wIndex = 0; @@ -393,7 +401,7 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config) { return RT_ERROR; } - return RT_EOK; + return RT_EOK; } /** @@ -401,7 +409,7 @@ rt_err_t rt_usbh_set_configure(uinst_t device, int config) * * @param device the usb device instance. * @param intf the interface number. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_set_interface(uinst_t device, int intf) @@ -412,7 +420,7 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf) /* check parameter */ RT_ASSERT(device != RT_NULL); - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_INTERFACE; setup.bRequest = USB_REQ_SET_INTERFACE; setup.wIndex = 0; @@ -423,8 +431,8 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf) { return RT_ERROR; } - - return RT_EOK; + + return RT_EOK; } /** @@ -432,7 +440,7 @@ rt_err_t rt_usbh_set_interface(uinst_t device, int intf) * * @param device the usb device instance. * @param endpoint the endpoint number of the usb device. - * + * * @return the error code, RT_EOK on successfully. */ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) @@ -443,7 +451,7 @@ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) /* check parameter */ RT_ASSERT(device != RT_NULL); - setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | + setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_ENDPOINT; setup.bRequest = USB_REQ_CLEAR_FEATURE; setup.wIndex = endpoint; @@ -454,8 +462,8 @@ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) { return RT_ERROR; } - - return RT_EOK; + + return RT_EOK; } /** @@ -464,10 +472,10 @@ rt_err_t rt_usbh_clear_feature(uinst_t device, int endpoint, int feature) * @param cfg_desc the point of configuration descriptor structure. * @param num the number of interface descriptor. * @intf_desc the point of interface descriptor point. - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, +rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, uintf_desc_t* intf_desc) { rt_uint32_t ptr, depth = 0; @@ -479,9 +487,9 @@ rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, ptr = (rt_uint32_t)cfg_desc + cfg_desc->bLength; while(ptr < (rt_uint32_t)cfg_desc + cfg_desc->wTotalLength) { - if(depth++ > 0x20) + if(depth++ > 0x20) { - *intf_desc = RT_NULL; + *intf_desc = RT_NULL; return -RT_EIO; } desc = (udesc_t)ptr; @@ -492,10 +500,10 @@ rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, *intf_desc = (uintf_desc_t)desc; RT_DEBUG_LOG(RT_DEBUG_USB, - ("rt_usb_get_interface_descriptor: %d\n", num)); + ("rt_usb_get_interface_descriptor: %d\n", num)); return RT_EOK; } - } + } ptr = (rt_uint32_t)desc + desc->bLength; } @@ -509,14 +517,14 @@ rt_err_t rt_usbh_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, * @param intf_desc the point of interface descriptor structure. * @param num the number of endpoint descriptor. * @param ep_desc the point of endpoint descriptor point. - * + * * @return the error code, RT_EOK on successfully. */ -rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num, +rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num, uep_desc_t* ep_desc) { int count = 0, depth = 0; - rt_uint32_t ptr; + rt_uint32_t ptr; udesc_t desc; /* check parameter */ @@ -527,15 +535,15 @@ rt_err_t rt_usbh_get_endpoint_descriptor(uintf_desc_t intf_desc, int num, ptr = (rt_uint32_t)intf_desc + intf_desc->bLength; while(count < intf_desc->bNumEndpoints) { - if(depth++ > 0x20) + if(depth++ > 0x20) { - *ep_desc = RT_NULL; + *ep_desc = RT_NULL; return -RT_EIO; } - desc = (udesc_t)ptr; + desc = (udesc_t)ptr; if(desc->type == USB_DESC_TYPE_ENDPOINT) { - if(num == count) + if(num == count) { *ep_desc = (uep_desc_t)desc; diff --git a/components/drivers/watchdog/watchdog.c b/components/drivers/watchdog/watchdog.c index 196f02039..38dff5864 100644 --- a/components/drivers/watchdog/watchdog.c +++ b/components/drivers/watchdog/watchdog.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -14,7 +14,7 @@ /* RT-Thread Device Interface */ /* - * This function initializes serial + * This function initializes watchdog */ static rt_err_t rt_watchdog_init(struct rt_device *dev) { @@ -65,7 +65,7 @@ static rt_err_t rt_watchdog_control(struct rt_device *dev, } #ifdef RT_USING_DEVICE_OPS -const static struct rt_device_ops wdt_ops = +const static struct rt_device_ops wdt_ops = { rt_watchdog_init, rt_watchdog_open, diff --git a/components/drivers/wlan/wlan_cfg.c b/components/drivers/wlan/wlan_cfg.c index 7fa9ecb2d..0befe6e7d 100644 --- a/components/drivers/wlan/wlan_cfg.c +++ b/components/drivers/wlan/wlan_cfg.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_cfg.h b/components/drivers/wlan/wlan_cfg.h index 3fae3f3e9..4d0e73729 100644 --- a/components/drivers/wlan/wlan_cfg.h +++ b/components/drivers/wlan/wlan_cfg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_cmd.c b/components/drivers/wlan/wlan_cmd.c index fead6a8bf..fde906542 100644 --- a/components/drivers/wlan/wlan_cmd.c +++ b/components/drivers/wlan/wlan_cmd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_dev.c b/components/drivers/wlan/wlan_dev.c index cbfd50a6c..68df0b3bf 100644 --- a/components/drivers/wlan/wlan_dev.c +++ b/components/drivers/wlan/wlan_dev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -102,7 +102,7 @@ rt_err_t rt_wlan_dev_connect(struct rt_wlan_device *device, struct rt_wlan_info if ((password_len > RT_WLAN_PASSWORD_MAX_LENGTH) || (info->ssid.len > RT_WLAN_SSID_MAX_LENGTH)) { - LOG_E("L:%d password or ssid is to long", __LINE__); + LOG_E("L:%d password or ssid is too long", __LINE__); return -RT_ERROR; } rt_memset(&sta_info, 0, sizeof(struct rt_sta_info)); @@ -150,7 +150,7 @@ rt_err_t rt_wlan_dev_ap_start(struct rt_wlan_device *device, struct rt_wlan_info if ((password_len > RT_WLAN_PASSWORD_MAX_LENGTH) || (info->ssid.len > RT_WLAN_SSID_MAX_LENGTH)) { - LOG_E("L:%d password or ssid is to long", __LINE__); + LOG_E("L:%d password or ssid is too long", __LINE__); return -RT_ERROR; } @@ -530,7 +530,7 @@ rt_err_t rt_wlan_dev_scan(struct rt_wlan_device *device, struct rt_wlan_info *in { if (info->ssid.len > RT_WLAN_SSID_MAX_LENGTH) { - LOG_E("L:%d ssid is to long", __LINE__); + LOG_E("L:%d ssid is too long", __LINE__); return -RT_EINVAL; } rt_memcpy(&scan_info.ssid, &info->ssid, sizeof(rt_wlan_ssid_t)); diff --git a/components/drivers/wlan/wlan_dev.h b/components/drivers/wlan/wlan_dev.h index 43d6506d6..41e0fa47d 100644 --- a/components/drivers/wlan/wlan_dev.h +++ b/components/drivers/wlan/wlan_dev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -583,7 +583,7 @@ rt_err_t rt_wlan_dev_report_data(struct rt_wlan_device *device, void *buff, int /* * wlan device register interface */ -rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, +rt_err_t rt_wlan_dev_register(struct rt_wlan_device *wlan, const char *name, const struct rt_wlan_dev_ops *ops, rt_uint32_t flag, void *user_data); #ifdef __cplusplus diff --git a/components/drivers/wlan/wlan_lwip.c b/components/drivers/wlan/wlan_lwip.c index 3c4e4dd59..30205ac33 100644 --- a/components/drivers/wlan/wlan_lwip.c +++ b/components/drivers/wlan/wlan_lwip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_mgnt.c b/components/drivers/wlan/wlan_mgnt.c index cf2204c6b..6abac5691 100644 --- a/components/drivers/wlan/wlan_mgnt.c +++ b/components/drivers/wlan/wlan_mgnt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -713,7 +713,7 @@ static void rt_wlan_event_dispatch(struct rt_wlan_device *device, rt_wlan_dev_ev } COMPLETE_UNLOCK(); #ifdef RT_WLAN_WORK_THREAD_ENABLE - rt_wlan_send_to_thread(user_event, RT_NULL, 0); + rt_wlan_send_to_thread(user_event, user_buff.data, user_buff.len); #else { void *user_parameter; diff --git a/components/drivers/wlan/wlan_mgnt.h b/components/drivers/wlan/wlan_mgnt.h index df0827bb7..38d5c31da 100644 --- a/components/drivers/wlan/wlan_mgnt.h +++ b/components/drivers/wlan/wlan_mgnt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_prot.c b/components/drivers/wlan/wlan_prot.c index b1a1b5de9..5c32a3fbd 100644 --- a/components/drivers/wlan/wlan_prot.c +++ b/components/drivers/wlan/wlan_prot.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_prot.h b/components/drivers/wlan/wlan_prot.h index 2df979270..5f8930f45 100644 --- a/components/drivers/wlan/wlan_prot.h +++ b/components/drivers/wlan/wlan_prot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_workqueue.c b/components/drivers/wlan/wlan_workqueue.c index 4cd98346d..76b95e66b 100644 --- a/components/drivers/wlan/wlan_workqueue.c +++ b/components/drivers/wlan/wlan_workqueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/drivers/wlan/wlan_workqueue.h b/components/drivers/wlan/wlan_workqueue.h index 49bc4a5f9..7a68a27e0 100644 --- a/components/drivers/wlan/wlan_workqueue.h +++ b/components/drivers/wlan/wlan_workqueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/cmd.c b/components/finsh/cmd.c index ebef0eac1..27f2d71fd 100644 --- a/components/finsh/cmd.c +++ b/components/finsh/cmd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh.h b/components/finsh/finsh.h index eb38682c4..e99963e74 100644 --- a/components/finsh/finsh.h +++ b/components/finsh/finsh.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_api.h b/components/finsh/finsh_api.h index c601415d8..f3efb432e 100644 --- a/components/finsh/finsh_api.h +++ b/components/finsh/finsh_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_compiler.c b/components/finsh/finsh_compiler.c index 1b1f67cb7..306c54aec 100644 --- a/components/finsh/finsh_compiler.c +++ b/components/finsh/finsh_compiler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_error.c b/components/finsh/finsh_error.c index bdd0108f9..a5cf2eb51 100644 --- a/components/finsh/finsh_error.c +++ b/components/finsh/finsh_error.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_error.h b/components/finsh/finsh_error.h index 614e02a35..8dfafd013 100644 --- a/components/finsh/finsh_error.h +++ b/components/finsh/finsh_error.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_heap.c b/components/finsh/finsh_heap.c index 0d185db47..9f64d108d 100644 --- a/components/finsh/finsh_heap.c +++ b/components/finsh/finsh_heap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_heap.h b/components/finsh/finsh_heap.h index 9c04e5c22..f320c2771 100644 --- a/components/finsh/finsh_heap.h +++ b/components/finsh/finsh_heap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_init.c b/components/finsh/finsh_init.c index 72f5aa5e9..76302a051 100644 --- a/components/finsh/finsh_init.c +++ b/components/finsh/finsh_init.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_node.c b/components/finsh/finsh_node.c index 0de82c189..82a4c03f1 100644 --- a/components/finsh/finsh_node.c +++ b/components/finsh/finsh_node.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_node.h b/components/finsh/finsh_node.h index c7ce09963..ff4333df1 100644 --- a/components/finsh/finsh_node.h +++ b/components/finsh/finsh_node.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_ops.c b/components/finsh/finsh_ops.c index 2eafb50c6..ec8b8cb58 100644 --- a/components/finsh/finsh_ops.c +++ b/components/finsh/finsh_ops.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_ops.h b/components/finsh/finsh_ops.h index 95a8b001f..0cc945f07 100644 --- a/components/finsh/finsh_ops.h +++ b/components/finsh/finsh_ops.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -25,90 +25,90 @@ * OP [op1] */ -#define FINSH_OP_NOOP 0x00 +#define FINSH_OP_NOOP 0x00 /* add @ r1 = r2 + r3 */ -#define FINSH_OP_ADD_BYTE 0x01 -#define FINSH_OP_ADD_WORD 0x02 -#define FINSH_OP_ADD_DWORD 0x03 +#define FINSH_OP_ADD_BYTE 0x01 +#define FINSH_OP_ADD_WORD 0x02 +#define FINSH_OP_ADD_DWORD 0x03 /* sub @ r1 = r2 - r3 */ -#define FINSH_OP_SUB_BYTE 0x04 -#define FINSH_OP_SUB_WORD 0x05 -#define FINSH_OP_SUB_DWORD 0x06 +#define FINSH_OP_SUB_BYTE 0x04 +#define FINSH_OP_SUB_WORD 0x05 +#define FINSH_OP_SUB_DWORD 0x06 /* div @ r1 = r2 / r3 */ -#define FINSH_OP_DIV_BYTE 0x07 -#define FINSH_OP_DIV_WORD 0x08 -#define FINSH_OP_DIV_DWORD 0x09 +#define FINSH_OP_DIV_BYTE 0x07 +#define FINSH_OP_DIV_WORD 0x08 +#define FINSH_OP_DIV_DWORD 0x09 /* mod @ r1 = r2 % r3 */ -#define FINSH_OP_MOD_BYTE 0x0A -#define FINSH_OP_MOD_WORD 0x0B -#define FINSH_OP_MOD_DWORD 0x0C +#define FINSH_OP_MOD_BYTE 0x0A +#define FINSH_OP_MOD_WORD 0x0B +#define FINSH_OP_MOD_DWORD 0x0C /* mul @ r1 = r2 * r3 */ -#define FINSH_OP_MUL_BYTE 0x0D -#define FINSH_OP_MUL_WORD 0x0E -#define FINSH_OP_MUL_DWORD 0x0F +#define FINSH_OP_MUL_BYTE 0x0D +#define FINSH_OP_MUL_WORD 0x0E +#define FINSH_OP_MUL_DWORD 0x0F /* and @ r1 = r2 & r3 */ -#define FINSH_OP_AND_BYTE 0x10 -#define FINSH_OP_AND_WORD 0x11 -#define FINSH_OP_AND_DWORD 0x12 +#define FINSH_OP_AND_BYTE 0x10 +#define FINSH_OP_AND_WORD 0x11 +#define FINSH_OP_AND_DWORD 0x12 /* or @ r1 = r2 | r3 */ -#define FINSH_OP_OR_BYTE 0x13 -#define FINSH_OP_OR_WORD 0x14 -#define FINSH_OP_OR_DWORD 0x15 +#define FINSH_OP_OR_BYTE 0x13 +#define FINSH_OP_OR_WORD 0x14 +#define FINSH_OP_OR_DWORD 0x15 /* xor @ r1 = r2 ^ r3 */ -#define FINSH_OP_XOR_BYTE 0x16 -#define FINSH_OP_XOR_WORD 0x17 -#define FINSH_OP_XOR_DWORD 0x18 +#define FINSH_OP_XOR_BYTE 0x16 +#define FINSH_OP_XOR_WORD 0x17 +#define FINSH_OP_XOR_DWORD 0x18 /* bw @ r1 = ~r2 */ -#define FINSH_OP_BITWISE_BYTE 0x19 -#define FINSH_OP_BITWISE_WORD 0x1A -#define FINSH_OP_BITWISE_DWORD 0x1B +#define FINSH_OP_BITWISE_BYTE 0x19 +#define FINSH_OP_BITWISE_WORD 0x1A +#define FINSH_OP_BITWISE_DWORD 0x1B /* shl @ r1 = r2 << r3 */ -#define FINSH_OP_SHL_BYTE 0x1C -#define FINSH_OP_SHL_WORD 0x1D -#define FINSH_OP_SHL_DWORD 0x1E +#define FINSH_OP_SHL_BYTE 0x1C +#define FINSH_OP_SHL_WORD 0x1D +#define FINSH_OP_SHL_DWORD 0x1E /* shr @ r1 = r2 >> r3 */ -#define FINSH_OP_SHR_BYTE 0x1F -#define FINSH_OP_SHR_WORD 0x20 -#define FINSH_OP_SHR_DWORD 0x21 +#define FINSH_OP_SHR_BYTE 0x1F +#define FINSH_OP_SHR_WORD 0x20 +#define FINSH_OP_SHR_DWORD 0x21 /* ld @ r1 = [r2] */ -#define FINSH_OP_LD_BYTE 0x22 -#define FINSH_OP_LD_WORD 0x23 -#define FINSH_OP_LD_DWORD 0x24 +#define FINSH_OP_LD_BYTE 0x22 +#define FINSH_OP_LD_WORD 0x23 +#define FINSH_OP_LD_DWORD 0x24 -#define FINSH_OP_LD_VALUE_BYTE 0x25 -#define FINSH_OP_LD_VALUE_WORD 0x26 -#define FINSH_OP_LD_VALUE_DWORD 0x27 +#define FINSH_OP_LD_VALUE_BYTE 0x25 +#define FINSH_OP_LD_VALUE_WORD 0x26 +#define FINSH_OP_LD_VALUE_DWORD 0x27 /* st @ [r2] = r1 */ -#define FINSH_OP_ST_BYTE 0x28 -#define FINSH_OP_ST_WORD 0x29 -#define FINSH_OP_ST_DWORD 0x2A +#define FINSH_OP_ST_BYTE 0x28 +#define FINSH_OP_ST_WORD 0x29 +#define FINSH_OP_ST_DWORD 0x2A /* pop */ -#define FINSH_OP_POP 0x2B +#define FINSH_OP_POP 0x2B /* call r1 @ [r1](stack) */ -#define FINSH_OP_SYSCALL 0x2C +#define FINSH_OP_SYSCALL 0x2C /* load value from stack */ -#define FINSH_OP_LD_VALUE_BYTE_STACK 0x2D -#define FINSH_OP_LD_VALUE_WORD_STACK 0x2E -#define FINSH_OP_LD_VALUE_DWORD_STACK 0x2F +#define FINSH_OP_LD_VALUE_BYTE_STACK 0x2D +#define FINSH_OP_LD_VALUE_WORD_STACK 0x2E +#define FINSH_OP_LD_VALUE_DWORD_STACK 0x2F /* halt */ -#define FINSH_OP_HALT 0xFF +#define FINSH_OP_HALT 0xFF typedef void (*op_func)(); extern const op_func op_table[]; diff --git a/components/finsh/finsh_parser.c b/components/finsh/finsh_parser.c index 0e7617003..4b8b4af7e 100644 --- a/components/finsh/finsh_parser.c +++ b/components/finsh/finsh_parser.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_parser.h b/components/finsh/finsh_parser.h index 8e149a7e0..2d0148093 100644 --- a/components/finsh/finsh_parser.h +++ b/components/finsh/finsh_parser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_token.c b/components/finsh/finsh_token.c index 5fb593d81..dfd613da5 100644 --- a/components/finsh/finsh_token.c +++ b/components/finsh/finsh_token.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_token.h b/components/finsh/finsh_token.h index 0ce98c0f1..9845357b8 100644 --- a/components/finsh/finsh_token.h +++ b/components/finsh/finsh_token.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_var.c b/components/finsh/finsh_var.c index 6a27bf1fa..2e3df30c6 100644 --- a/components/finsh/finsh_var.c +++ b/components/finsh/finsh_var.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_var.h b/components/finsh/finsh_var.h index 8d7ee6a20..796f97944 100644 --- a/components/finsh/finsh_var.h +++ b/components/finsh/finsh_var.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_vm.c b/components/finsh/finsh_vm.c index 7c5640708..e56cedbdf 100644 --- a/components/finsh/finsh_vm.c +++ b/components/finsh/finsh_vm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/finsh_vm.h b/components/finsh/finsh_vm.h index fc515418e..15d5da1ef 100644 --- a/components/finsh/finsh_vm.h +++ b/components/finsh/finsh_vm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/msh.c b/components/finsh/msh.c index 79f1e3c87..73a5197dc 100644 --- a/components/finsh/msh.c +++ b/components/finsh/msh.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/msh.h b/components/finsh/msh.h index b7153107e..17c7a39ef 100644 --- a/components/finsh/msh.h +++ b/components/finsh/msh.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/finsh/msh_file.c b/components/finsh/msh_file.c index 10251b4cb..b431d944c 100644 --- a/components/finsh/msh_file.c +++ b/components/finsh/msh_file.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -101,6 +101,11 @@ int msh_exec_script(const char *cmd_line, int size) int length; line_buf = (char *) rt_malloc(RT_CONSOLEBUF_SIZE); + if (line_buf == RT_NULL) + { + close(fd); + return -RT_ENOMEM; + } /* read line by line and then exec it */ do diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 852d3e7ac..0d4162518 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -101,7 +101,7 @@ int finsh_set_prompt(const char * prompt) #include #endif /* RT_USING_DFS */ -const char *finsh_get_prompt() +const char *finsh_get_prompt(void) { #define _MSH_PROMPT "msh " #define _PROMPT "finsh " @@ -844,7 +844,7 @@ int finsh_system_init(void) finsh_system_var_init(&__vsymtab_start, &__vsymtab_end); #elif defined(_MSC_VER) unsigned int *ptr_begin, *ptr_end; - + if(shell) { rt_kprintf("finsh shell already init.\n"); diff --git a/components/finsh/shell.h b/components/finsh/shell.h index 8741759ed..e6b1921c6 100644 --- a/components/finsh/shell.h +++ b/components/finsh/shell.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -78,7 +78,7 @@ struct finsh_shell struct finsh_parser parser; #endif - char line[FINSH_CMD_SIZE]; + char line[FINSH_CMD_SIZE + 1]; rt_uint16_t line_position; rt_uint16_t line_curpos; diff --git a/components/finsh/symbol.c b/components/finsh/symbol.c index 78df9fac5..c6623e2d8 100644 --- a/components/finsh/symbol.c +++ b/components/finsh/symbol.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2010-03-22 Bernard first version */ - + #include #if defined(RT_USING_FINSH) && !defined(FINSH_USING_SYMTAB) diff --git a/components/libc/Kconfig b/components/libc/Kconfig index 2d1e9315f..26726d8f5 100644 --- a/components/libc/Kconfig +++ b/components/libc/Kconfig @@ -22,11 +22,11 @@ if RT_USING_LIBC && RT_USING_DFS if RT_USING_POSIX config RT_USING_POSIX_MMAP - bool "Enable mmap() api" + bool "Enable mmap() API" default n config RT_USING_POSIX_TERMIOS - bool "Enable termios feature" + bool "Enable termios APIs" default n config RT_USING_POSIX_AIO @@ -34,6 +34,9 @@ if RT_USING_LIBC && RT_USING_DFS default n endif +endif + +if RT_USING_LIBC config RT_USING_MODULE bool "Enable dynamic module with dlopen/dlsym/dlclose feature" default n diff --git a/components/libc/aio/posix_aio.c b/components/libc/aio/posix_aio.c index 3eb763449..66f15e4c5 100644 --- a/components/libc/aio/posix_aio.c +++ b/components/libc/aio/posix_aio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,25 +22,25 @@ struct rt_workqueue* aio_queue = NULL; /** - * The aio_cancel() function shall attempt to cancel one or more asynchronous I/O - * requests currently outstanding against file descriptor fildes. The aiocbp - * argument points to the asynchronous I/O control block for a particular request - * to be canceled. If aiocbp is NULL, then all outstanding cancelable asynchronous + * The aio_cancel() function shall attempt to cancel one or more asynchronous I/O + * requests currently outstanding against file descriptor fildes. The aiocbp + * argument points to the asynchronous I/O control block for a particular request + * to be canceled. If aiocbp is NULL, then all outstanding cancelable asynchronous * I/O requests against fildes shall be canceled. - * - * Normal asynchronous notification shall occur for asynchronous I/O operations - * that are successfully canceled. If there are requests that cannot be canceled, - * then the normal asynchronous completion process shall take place for those + * + * Normal asynchronous notification shall occur for asynchronous I/O operations + * that are successfully canceled. If there are requests that cannot be canceled, + * then the normal asynchronous completion process shall take place for those * requests when they are completed. - * - * For requested operations that are successfully canceled, the associated error - * status shall be set to [ECANCELED] and the return status shall be -1. For - * requested operations that are not successfully canceled, the aiocbp shall not + * + * For requested operations that are successfully canceled, the associated error + * status shall be set to [ECANCELED] and the return status shall be -1. For + * requested operations that are not successfully canceled, the aiocbp shall not * be modified by aio_cancel(). - * - * If aiocbp is not NULL, then if fildes does not have the same value as the file + * + * If aiocbp is not NULL, then if fildes does not have the same value as the file * descriptor with which the asynchronous operation was initiated, unspecified results occur. - * + * * Which operations are cancelable is implementation-defined. */ int aio_cancel(int fd, struct aiocb *cb) @@ -61,9 +61,9 @@ int aio_cancel(int fd, struct aiocb *cb) } /** - * The aio_error() function shall return the error status associated with the - * aiocb structure referenced by the aiocbp argument. The error status for an - * asynchronous I/O operation is the errno value that would be set by the corresponding + * The aio_error() function shall return the error status associated with the + * aiocb structure referenced by the aiocbp argument. The error status for an + * asynchronous I/O operation is the errno value that would be set by the corresponding * read(), write(), */ int aio_error (const struct aiocb *cb) @@ -77,44 +77,44 @@ int aio_error (const struct aiocb *cb) } /** - * The aio_fsync() function shall asynchronously perform a file synchronization - * operation, as specified by the op argument, for I/O operations associated with - * the file indicated by the file descriptor aio_fildes member of the aiocb - * structure referenced by the aiocbp argument and queued at the time of the - * call to aio_fsync(). The function call shall return when the synchronization - * request has been initiated or queued to the file or device (even when the data + * The aio_fsync() function shall asynchronously perform a file synchronization + * operation, as specified by the op argument, for I/O operations associated with + * the file indicated by the file descriptor aio_fildes member of the aiocb + * structure referenced by the aiocbp argument and queued at the time of the + * call to aio_fsync(). The function call shall return when the synchronization + * request has been initiated or queued to the file or device (even when the data * cannot be synchronized immediately). - * - * option: If op is O_DSYNC, all currently queued I/O operations shall be completed - * as if by a call to fdatasync(); that is, as defined for synchronized I/O data + * + * option: If op is O_DSYNC, all currently queued I/O operations shall be completed + * as if by a call to fdatasync(); that is, as defined for synchronized I/O data * integrity completion. - * - * option: If op is O_SYNC, all currently queued I/O operations shall be completed - * as if by a call to fsync(); that is, as defined for synchronized I/O file integrity - * completion. If the aio_fsync() function fails, or if the operation queued by - * aio_fsync() fails, then outstanding I/O operations are not guaranteed to have + * + * option: If op is O_SYNC, all currently queued I/O operations shall be completed + * as if by a call to fsync(); that is, as defined for synchronized I/O file integrity + * completion. If the aio_fsync() function fails, or if the operation queued by + * aio_fsync() fails, then outstanding I/O operations are not guaranteed to have * been completed. - * - * If aio_fsync() succeeds, then it is only the I/O that was queued at the time - * of the call to aio_fsync() that is guaranteed to be forced to the relevant + * + * If aio_fsync() succeeds, then it is only the I/O that was queued at the time + * of the call to aio_fsync() that is guaranteed to be forced to the relevant * completion state. The completion of subsequent I/O on the file descriptor is * not guaranteed to be completed in a synchronized fashion. - * - * The aiocbp argument refers to an asynchronous I/O control block. The aiocbp - * value may be used as an argument to aio_error() and aio_return() in order to - * determine the error status and return status, respectively, of the asynchronous - * operation while it is proceeding. When the request is queued, the error status - * for the operation is [EINPROGRESS]. When all data has been successfully transferred, - * the error status shall be reset to reflect the success or failure of the operation. - * If the operation does not complete successfully, the error status for the - * operation shall be set to indicate the error. The aio_sigevent member determines - * the asynchronous notification to occur as specified in Signal Generation and - * Delivery when all operations have achieved synchronized I/O completion. All - * other members of the structure referenced by aiocbp are ignored. If the control - * block referenced by aiocbp becomes an illegal address prior to asynchronous + * + * The aiocbp argument refers to an asynchronous I/O control block. The aiocbp + * value may be used as an argument to aio_error() and aio_return() in order to + * determine the error status and return status, respectively, of the asynchronous + * operation while it is proceeding. When the request is queued, the error status + * for the operation is [EINPROGRESS]. When all data has been successfully transferred, + * the error status shall be reset to reflect the success or failure of the operation. + * If the operation does not complete successfully, the error status for the + * operation shall be set to indicate the error. The aio_sigevent member determines + * the asynchronous notification to occur as specified in Signal Generation and + * Delivery when all operations have achieved synchronized I/O completion. All + * other members of the structure referenced by aiocbp are ignored. If the control + * block referenced by aiocbp becomes an illegal address prior to asynchronous * I/O completion, then the behavior is undefined. - * - * If the aio_fsync() function fails or aiocbp indicates an error condition, + * + * If the aio_fsync() function fails or aiocbp indicates an error condition, * data is not guaranteed to have been successfully transferred. */ static void aio_fync_work(struct rt_work* work, void* work_data) @@ -169,7 +169,7 @@ static void aio_read_work(struct rt_work* work, void* work_data) level = rt_hw_interrupt_disable(); if (len <= 0) cb->aio_result = errno; - else + else cb->aio_result = len; rt_hw_interrupt_enable(level); @@ -177,51 +177,51 @@ static void aio_read_work(struct rt_work* work, void* work_data) } /** - * The aio_read() function shall read aiocbp->aio_nbytes from the file associated - * with aiocbp->aio_fildes into the buffer pointed to by aiocbp->aio_buf. The - * function call shall return when the read request has been initiated or queued + * The aio_read() function shall read aiocbp->aio_nbytes from the file associated + * with aiocbp->aio_fildes into the buffer pointed to by aiocbp->aio_buf. The + * function call shall return when the read request has been initiated or queued * to the file or device (even when the data cannot be delivered immediately). - * - * If prioritized I/O is supported for this file, then the asynchronous operation - * shall be submitted at a priority equal to a base scheduling priority minus - * aiocbp->aio_reqprio. If Thread Execution Scheduling is not supported, then + * + * If prioritized I/O is supported for this file, then the asynchronous operation + * shall be submitted at a priority equal to a base scheduling priority minus + * aiocbp->aio_reqprio. If Thread Execution Scheduling is not supported, then * the base scheduling priority is that of the calling process; - * - * otherwise, the base scheduling priority is that of the calling thread. - * - * The aiocbp value may be used as an argument to aio_error() and aio_return() - * in order to determine the error status and return status, respectively, of - * the asynchronous operation while it is proceeding. If an error condition is - * encountered during queuing, the function call shall return without having - * initiated or queued the request. The requested operation takes place at the - * absolute position in the file as given by aio_offset, as if lseek() were called - * immediately prior to the operation with an offset equal to aio_offset and a - * whence equal to SEEK_SET. After a successful call to enqueue an asynchronous + * + * otherwise, the base scheduling priority is that of the calling thread. + * + * The aiocbp value may be used as an argument to aio_error() and aio_return() + * in order to determine the error status and return status, respectively, of + * the asynchronous operation while it is proceeding. If an error condition is + * encountered during queuing, the function call shall return without having + * initiated or queued the request. The requested operation takes place at the + * absolute position in the file as given by aio_offset, as if lseek() were called + * immediately prior to the operation with an offset equal to aio_offset and a + * whence equal to SEEK_SET. After a successful call to enqueue an asynchronous * I/O operation, the value of the file offset for the file is unspecified. * - * The aio_sigevent member specifies the notification which occurs when the + * The aio_sigevent member specifies the notification which occurs when the * request is completed. * * The aiocbp->aio_lio_opcode field shall be ignored by aio_read(). - * - * The aiocbp argument points to an aiocb structure. If the buffer pointed to by - * aiocbp->aio_buf or the control block pointed to by aiocbp becomes an illegal + * + * The aiocbp argument points to an aiocb structure. If the buffer pointed to by + * aiocbp->aio_buf or the control block pointed to by aiocbp becomes an illegal * address prior to asynchronous I/O completion, then the behavior is undefined. - * - * Simultaneous asynchronous operations using the same aiocbp produce undefined + * + * Simultaneous asynchronous operations using the same aiocbp produce undefined * results. - * + * * If synchronized I/O is enabled on the file associated with aiocbp->aio_fildes, - * the behavior of this function shall be according to the definitions of synchronized - * I/O data integrity completion and synchronized I/O file integrity completion. - * - * For any system action that changes the process memory space while an asynchronous - * I/O is outstanding to the address range being changed, the result of that action + * the behavior of this function shall be according to the definitions of synchronized + * I/O data integrity completion and synchronized I/O file integrity completion. + * + * For any system action that changes the process memory space while an asynchronous + * I/O is outstanding to the address range being changed, the result of that action * is undefined. - * - * For regular files, no data transfer shall occur past the offset maximum + * + * For regular files, no data transfer shall occur past the offset maximum * established in the open file description associated with aiocbp->aio_fildes. - * + * */ int aio_read(struct aiocb *cb) { @@ -242,16 +242,16 @@ int aio_read(struct aiocb *cb) } /** - * The aio_return() function shall return the return status associated with the - * aiocb structure referenced by the aiocbp argument. The return status for an - * asynchronous I/O operation is the value that would be returned by the corresponding - * read(), write(), or fsync() function call. If the error status for the operation - * is equal to [EINPROGRESS], then the return status for the operation is undefined. - * The aio_return() function may be called exactly once to retrieve the return - * status of a given asynchronous operation; thereafter, if the same aiocb structure - * is used in a call to aio_return() or aio_error(), an error may be returned. - * When the aiocb structure referred to by aiocbp is used to submit another asynchronous - * operation, then aio_return() may be successfully used to retrieve the return + * The aio_return() function shall return the return status associated with the + * aiocb structure referenced by the aiocbp argument. The return status for an + * asynchronous I/O operation is the value that would be returned by the corresponding + * read(), write(), or fsync() function call. If the error status for the operation + * is equal to [EINPROGRESS], then the return status for the operation is undefined. + * The aio_return() function may be called exactly once to retrieve the return + * status of a given asynchronous operation; thereafter, if the same aiocb structure + * is used in a call to aio_return() or aio_error(), an error may be returned. + * When the aiocb structure referred to by aiocbp is used to submit another asynchronous + * operation, then aio_return() may be successfully used to retrieve the return * status of that operation. */ ssize_t aio_return(struct aiocb *cb) @@ -268,23 +268,23 @@ ssize_t aio_return(struct aiocb *cb) } /** - * The aio_suspend() function shall suspend the calling thread until at least - * one of the asynchronous I/O operations referenced by the list argument has - * completed, until a signal interrupts the function, or, if timeout is not NULL, - * until the time interval specified by timeout has passed. If any of the aiocb - * structures in the list correspond to completed asynchronous I/O operations - * (that is, the error status for the operation is not equal to [EINPROGRESS]) - * at the time of the call, the function shall return without suspending the - * calling thread. The list argument is an array of pointers to asynchronous I/O - * control blocks. The nent argument indicates the number of elements in the - * array. Each aiocb structure pointed to has been used in initiating an asynchronous - * I/O request via aio_read(), aio_write(), or lio_listio(). This array may - * contain null pointers, which are ignored. If this array contains pointers - * that refer to aiocb structures that have not been used in submitting asynchronous + * The aio_suspend() function shall suspend the calling thread until at least + * one of the asynchronous I/O operations referenced by the list argument has + * completed, until a signal interrupts the function, or, if timeout is not NULL, + * until the time interval specified by timeout has passed. If any of the aiocb + * structures in the list correspond to completed asynchronous I/O operations + * (that is, the error status for the operation is not equal to [EINPROGRESS]) + * at the time of the call, the function shall return without suspending the + * calling thread. The list argument is an array of pointers to asynchronous I/O + * control blocks. The nent argument indicates the number of elements in the + * array. Each aiocb structure pointed to has been used in initiating an asynchronous + * I/O request via aio_read(), aio_write(), or lio_listio(). This array may + * contain null pointers, which are ignored. If this array contains pointers + * that refer to aiocb structures that have not been used in submitting asynchronous * I/O, the effect is undefined. - * - * If the time interval indicated in the timespec structure pointed to by timeout - * passes before any of the I/O operations referenced by list are completed, then + * + * If the time interval indicated in the timespec structure pointed to by timeout + * passes before any of the I/O operations referenced by list are completed, then * aio_suspend() shall return with an error. */ int aio_suspend(const struct aiocb *const list[], int nent, @@ -315,7 +315,7 @@ static void aio_write_work(struct rt_work* work, void* work_data) level = rt_hw_interrupt_disable(); if (len <= 0) cb->aio_result = errno; - else + else cb->aio_result = len; rt_hw_interrupt_enable(level); @@ -323,42 +323,42 @@ static void aio_write_work(struct rt_work* work, void* work_data) } /** - * The aio_write() function shall write aiocbp->aio_nbytes to the file associated - * with aiocbp->aio_fildes from the buffer pointed to by aiocbp->aio_buf. The - * function shall return when the write request has been initiated or, at a minimum, + * The aio_write() function shall write aiocbp->aio_nbytes to the file associated + * with aiocbp->aio_fildes from the buffer pointed to by aiocbp->aio_buf. The + * function shall return when the write request has been initiated or, at a minimum, * queued to the file or device. - * - * The aiocbp argument may be used as an argument to aio_error() and aio_return() - * in order to determine the error status and return status, respectively, of the + * + * The aiocbp argument may be used as an argument to aio_error() and aio_return() + * in order to determine the error status and return status, respectively, of the * asynchronous operation while it is proceeding. - * - * The aiocbp argument points to an aiocb structure. If the buffer pointed to by - * aiocbp->aio_buf or the control block pointed to by aiocbp becomes an illegal + * + * The aiocbp argument points to an aiocb structure. If the buffer pointed to by + * aiocbp->aio_buf or the control block pointed to by aiocbp becomes an illegal * address prior to asynchronous I/O completion, then the behavior is undefined. - * - * If O_APPEND is not set for the file descriptor aio_fildes, then the requested - * operation shall take place at the absolute position in the file as given by - * aio_offset, as if lseek() were called immediately prior to the operation with - * an offset equal to aio_offset and a whence equal to SEEK_SET. If O_APPEND is - * set for the file descriptor, or if aio_fildes is associated with a device that - * is incapable of seeking, write operations append to the file in the same order - * as the calls were made, except under circumstances described in Asynchronous - * I/O. After a successful call to enqueue an asynchronous I/O operation, the value + * + * If O_APPEND is not set for the file descriptor aio_fildes, then the requested + * operation shall take place at the absolute position in the file as given by + * aio_offset, as if lseek() were called immediately prior to the operation with + * an offset equal to aio_offset and a whence equal to SEEK_SET. If O_APPEND is + * set for the file descriptor, or if aio_fildes is associated with a device that + * is incapable of seeking, write operations append to the file in the same order + * as the calls were made, except under circumstances described in Asynchronous + * I/O. After a successful call to enqueue an asynchronous I/O operation, the value * of the file offset for the file is unspecified. - * - * The aio_sigevent member specifies the notification which occurs when the request + * + * The aio_sigevent member specifies the notification which occurs when the request * is completed. - * + * * The aiocbp->aio_lio_opcode field shall be ignored by aio_write(). - * - * Simultaneous asynchronous operations using the same aiocbp produce undefined + * + * Simultaneous asynchronous operations using the same aiocbp produce undefined * results. - * - * If synchronized I/O is enabled on the file associated with aiocbp->aio_fildes, - * the behavior of this function shall be according to the definitions of synchronized + * + * If synchronized I/O is enabled on the file associated with aiocbp->aio_fildes, + * the behavior of this function shall be according to the definitions of synchronized * I/O data integrity completion, and synchronized I/O file integrity completion. - * - * For regular files, no data transfer shall occur past the offset maximum established + * + * For regular files, no data transfer shall occur past the offset maximum established * in the open file description associated with aiocbp->aio_fildes. */ int aio_write(struct aiocb *cb) @@ -385,69 +385,69 @@ int aio_write(struct aiocb *cb) } /** - * The lio_listio() function shall initiate a list of I/O requests with a single + * The lio_listio() function shall initiate a list of I/O requests with a single * function call. - * - * The mode argument takes one of the values LIO_WAIT or LIO_NOWAIT declared in - * and determines whether the function returns when the I/O operations - * have been completed, or as soon as the operations have been queued. If the - * mode argument is LIO_WAIT, the function shall wait until all I/O is complete + * + * The mode argument takes one of the values LIO_WAIT or LIO_NOWAIT declared in + * and determines whether the function returns when the I/O operations + * have been completed, or as soon as the operations have been queued. If the + * mode argument is LIO_WAIT, the function shall wait until all I/O is complete * and the sig argument shall be ignored. - * - * If the mode argument is LIO_NOWAIT, the function shall return immediately, and - * asynchronous notification shall occur, according to the sig argument, when all - * the I/O operations complete. If sig is NULL, then no asynchronous notification - * shall occur. If sig is not NULL, asynchronous notification occurs as specified + * + * If the mode argument is LIO_NOWAIT, the function shall return immediately, and + * asynchronous notification shall occur, according to the sig argument, when all + * the I/O operations complete. If sig is NULL, then no asynchronous notification + * shall occur. If sig is not NULL, asynchronous notification occurs as specified * in Signal Generation and Delivery when all the requests in list have completed. - * + * * The I/O requests enumerated by list are submitted in an unspecified order. - * - * The list argument is an array of pointers to aiocb structures. The array contains + * + * The list argument is an array of pointers to aiocb structures. The array contains * nent elements. The array may contain NULL elements, which shall be ignored. - * - * If the buffer pointed to by list or the aiocb structures pointed to by the - * elements of the array list become illegal addresses before all asynchronous I/O - * completed and, if necessary, the notification is sent, then the behavior is - * undefined. If the buffers pointed to by the aio_buf member of the aiocb structure - * pointed to by the elements of the array list become illegal addresses prior to - * the asynchronous I/O associated with that aiocb structure being completed, the + * + * If the buffer pointed to by list or the aiocb structures pointed to by the + * elements of the array list become illegal addresses before all asynchronous I/O + * completed and, if necessary, the notification is sent, then the behavior is + * undefined. If the buffers pointed to by the aio_buf member of the aiocb structure + * pointed to by the elements of the array list become illegal addresses prior to + * the asynchronous I/O associated with that aiocb structure being completed, the * behavior is undefined. - * - * The aio_lio_opcode field of each aiocb structure specifies the operation to be - * performed. The supported operations are LIO_READ, LIO_WRITE, and LIO_NOP; these - * symbols are defined in . The LIO_NOP operation causes the list entry to - * be ignored. If the aio_lio_opcode element is equal to LIO_READ, then an I/O operation - * is submitted as if by a call to aio_read() with the aiocbp equal to the address - * of the aiocb structure. If the aio_lio_opcode element is equal to LIO_WRITE, then - * an I/O operation is submitted as if by a call to aio_write() with the aiocbp equal + * + * The aio_lio_opcode field of each aiocb structure specifies the operation to be + * performed. The supported operations are LIO_READ, LIO_WRITE, and LIO_NOP; these + * symbols are defined in . The LIO_NOP operation causes the list entry to + * be ignored. If the aio_lio_opcode element is equal to LIO_READ, then an I/O operation + * is submitted as if by a call to aio_read() with the aiocbp equal to the address + * of the aiocb structure. If the aio_lio_opcode element is equal to LIO_WRITE, then + * an I/O operation is submitted as if by a call to aio_write() with the aiocbp equal * to the address of the aiocb structure. - * - * The aio_fildes member specifies the file descriptor on which the operation is to + * + * The aio_fildes member specifies the file descriptor on which the operation is to * be performed. - * - * The aio_buf member specifies the address of the buffer to or from which the data + * + * The aio_buf member specifies the address of the buffer to or from which the data * is transferred. - * + * * The aio_nbytes member specifies the number of bytes of data to be transferred. - * - * The members of the aiocb structure further describe the I/O operation to be - * performed, in a manner identical to that of the corresponding aiocb structure + * + * The members of the aiocb structure further describe the I/O operation to be + * performed, in a manner identical to that of the corresponding aiocb structure * when used by the aio_read() and aio_write() functions. - * - * The nent argument specifies how many elements are members of the list; that is, + * + * The nent argument specifies how many elements are members of the list; that is, * the length of the array. - * - * The behavior of this function is altered according to the definitions of synchronized - * I/O data integrity completion and synchronized I/O file integrity completion if + * + * The behavior of this function is altered according to the definitions of synchronized + * I/O data integrity completion and synchronized I/O file integrity completion if * synchronized I/O is enabled on the file associated with aio_fildes. - * - * For regular files, no data transfer shall occur past the offset maximum established + * + * For regular files, no data transfer shall occur past the offset maximum established * in the open file description associated with aiocbp->aio_fildes. - * - * If sig->sigev_notify is SIGEV_THREAD and sig->sigev_notify_attributes is a - * non-null pointer and the block pointed to by this pointer becomes an illegal - * address prior to all asynchronous I/O being completed, then the behavior is - * undefined. + * + * If sig->sigev_notify is SIGEV_THREAD and sig->sigev_notify_attributes is a + * non-null pointer and the block pointed to by this pointer becomes an illegal + * address prior to all asynchronous I/O being completed, then the behavior is + * undefined. */ int lio_listio(int mode, struct aiocb * const list[], int nent, struct sigevent *sig) diff --git a/components/libc/aio/posix_aio.h b/components/libc/aio/posix_aio.h index f20ed48cb..de1173851 100644 --- a/components/libc/aio/posix_aio.h +++ b/components/libc/aio/posix_aio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/README.md b/components/libc/compilers/armlibc/README.md new file mode 100644 index 000000000..4d2a73b6b --- /dev/null +++ b/components/libc/compilers/armlibc/README.md @@ -0,0 +1,9 @@ +# ARMLIB (Keil-MDK) porting for RT-Thread + +Please define RT_USING_LIBC and compile RT-Thread with Keil-MDK compiler. + + + +## More Information + +https://www.keil.com/support/man/docs/armlib/ \ No newline at end of file diff --git a/components/libc/compilers/armlibc/dirent.h b/components/libc/compilers/armlibc/dirent.h index d3bc58cbc..2c0521d2e 100644 --- a/components/libc/compilers/armlibc/dirent.h +++ b/components/libc/compilers/armlibc/dirent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,32 +18,32 @@ */ /* File types */ -#define FT_REGULAR 0 /* regular file */ -#define FT_SOCKET 1 /* socket file */ -#define FT_DIRECTORY 2 /* directory */ -#define FT_USER 3 /* user defined */ +#define FT_REGULAR 0 /* regular file */ +#define FT_SOCKET 1 /* socket file */ +#define FT_DIRECTORY 2 /* directory */ +#define FT_USER 3 /* user defined */ #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_DIR_STRUCTURE -typedef struct +typedef struct { - int fd; /* directory file */ - char buf[512]; - int num; - int cur; + int fd; /* directory file */ + char buf[512]; + int num; + int cur; } DIR; #endif #ifndef HAVE_DIRENT_STRUCTURE struct dirent { - rt_uint8_t d_type; /* The type of the file */ - rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ - rt_uint16_t d_reclen; /* length of this record */ - char d_name[256]; /* The null-terminated file name */ + rt_uint8_t d_type; /* The type of the file */ + rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ + rt_uint16_t d_reclen; /* length of this record */ + char d_name[256]; /* The null-terminated file name */ }; #endif diff --git a/components/libc/compilers/armlibc/fcntl.h b/components/libc/compilers/armlibc/fcntl.h index 80cf1b440..f247b926e 100644 --- a/components/libc/compilers/armlibc/fcntl.h +++ b/components/libc/compilers/armlibc/fcntl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,6 +9,8 @@ #ifndef FCNTL_H__ #define FCNTL_H__ +#include + #ifdef RT_USING_DFS #include #endif diff --git a/components/libc/compilers/armlibc/libc.c b/components/libc/compilers/armlibc/libc.c index fee390d4b..971ddb8d4 100644 --- a/components/libc/compilers/armlibc/libc.c +++ b/components/libc/compilers/armlibc/libc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/libc.h b/components/libc/compilers/armlibc/libc.h index b9b1b6212..aecf8cdc5 100644 --- a/components/libc/compilers/armlibc/libc.h +++ b/components/libc/compilers/armlibc/libc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/libc_syms.c b/components/libc/compilers/armlibc/libc_syms.c index 0e1c42d89..d03197a5d 100644 --- a/components/libc/compilers/armlibc/libc_syms.c +++ b/components/libc/compilers/armlibc/libc_syms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/mem_std.c b/components/libc/compilers/armlibc/mem_std.c index e160104a2..c350aa68f 100644 --- a/components/libc/compilers/armlibc/mem_std.c +++ b/components/libc/compilers/armlibc/mem_std.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/stdio.c b/components/libc/compilers/armlibc/stdio.c index 5262a4dd9..c786c78aa 100644 --- a/components/libc/compilers/armlibc/stdio.c +++ b/components/libc/compilers/armlibc/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index b6ffb37b0..5d9331ba1 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,6 +9,8 @@ * 2013-11-24 aozima fixed _sys_read()/_sys_write() issues. * 2014-08-03 bernard If using msh, use system() implementation * in msh. + * 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when + * RT_USING_DFS is not defined */ #include @@ -265,16 +267,16 @@ RT_WEAK void _sys_exit(int return_code) */ long _sys_flen(FILEHANDLE fh) { +#ifdef RT_USING_DFS struct stat stat; - + if (fh < STDERR) return -1; -#ifndef RT_USING_DFS - return -1; -#else fstat(fh, &stat); return stat.st_size; +#else + return -1; #endif } @@ -308,7 +310,7 @@ int system(const char *string) #ifdef __MICROLIB #include -int fputc(int c, FILE *f) +int fputc(int c, FILE *f) { char ch[2] = {0}; @@ -317,7 +319,7 @@ int fputc(int c, FILE *f) return 1; } -int fgetc(FILE *f) +int fgetc(FILE *f) { #ifdef RT_USING_POSIX char ch; diff --git a/components/libc/compilers/armlibc/sys/errno.h b/components/libc/compilers/armlibc/sys/errno.h index 9c4307ebf..74cc986f7 100644 --- a/components/libc/compilers/armlibc/sys/errno.h +++ b/components/libc/compilers/armlibc/sys/errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/sys/ioctl.h b/components/libc/compilers/armlibc/sys/ioctl.h new file mode 100644 index 000000000..df17b19a6 --- /dev/null +++ b/components/libc/compilers/armlibc/sys/ioctl.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + + + +#endif diff --git a/components/libc/compilers/armlibc/sys/mman.h b/components/libc/compilers/armlibc/sys/mman.h index 8c61b32b7..6a260ccd7 100644 --- a/components/libc/compilers/armlibc/sys/mman.h +++ b/components/libc/compilers/armlibc/sys/mman.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/sys/stat.h b/components/libc/compilers/armlibc/sys/stat.h index ce95230e8..c4b42083c 100644 --- a/components/libc/compilers/armlibc/sys/stat.h +++ b/components/libc/compilers/armlibc/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h index 001ace4dd..d87a13a27 100644 --- a/components/libc/compilers/armlibc/sys/types.h +++ b/components/libc/compilers/armlibc/sys/types.h @@ -1,24 +1,26 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes + * 2020-09-05 Meco Man fix bugs + * 2020-12-16 Meco Man add useconds_t */ #ifndef __TYPES_H__ #define __TYPES_H__ #include -#include -typedef rt_int32_t clockid_t; -typedef rt_int32_t key_t; /* Used for interprocess communication. */ -typedef rt_int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int32_t clockid_t; +typedef int32_t key_t; /* Used for interprocess communication. */ +typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ #ifndef ARCH_CPU_64BIT -typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ +typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else -typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ +typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ #endif +typedef unsigned long useconds_t; /* microseconds (unsigned) */ #endif diff --git a/components/libc/compilers/armlibc/sys/unistd.h b/components/libc/compilers/armlibc/sys/unistd.h index 33f0561e7..2f188735d 100644 --- a/components/libc/compilers/armlibc/sys/unistd.h +++ b/components/libc/compilers/armlibc/sys/unistd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,7 +9,8 @@ #ifndef _SYS_UNISTD_H #define _SYS_UNISTD_H -#include +#include +#include "types.h" #ifdef RT_USING_DFS @@ -36,14 +37,39 @@ #define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ #define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ + +#ifndef O_RDONLY #define O_RDONLY 0 /* +1 == FREAD */ +#endif +#ifndef O_WRONLY #define O_WRONLY 1 /* +1 == FWRITE */ +#endif +#ifndef O_RDWR #define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#endif +#ifndef O_APPEND #define O_APPEND _FAPPEND +#endif +#ifndef O_CREAT #define O_CREAT _FCREAT +#endif +#ifndef O_TRUNC #define O_TRUNC _FTRUNC +#endif +#ifndef O_EXCL #define O_EXCL _FEXCL +#endif +#ifndef O_SYNC #define O_SYNC _FSYNC #endif +#endif + + +int isatty (int fd); +char * ttyname (int desc); + +unsigned int sleep(unsigned int seconds); +int usleep(useconds_t usec); + #endif /* _SYS_UNISTD_H */ diff --git a/components/libc/compilers/armlibc/termios.h b/components/libc/compilers/armlibc/termios.h deleted file mode 100644 index 195612122..000000000 --- a/components/libc/compilers/armlibc/termios.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#include -#include - -#endif diff --git a/components/libc/compilers/armlibc/unistd.h b/components/libc/compilers/armlibc/unistd.h index 70187722d..9b96d45ad 100644 --- a/components/libc/compilers/armlibc/unistd.h +++ b/components/libc/compilers/armlibc/unistd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/common/SConscript b/components/libc/compilers/common/SConscript index a8d260682..240730140 100644 --- a/components/libc/compilers/common/SConscript +++ b/components/libc/compilers/common/SConscript @@ -8,12 +8,15 @@ group = [] CPPPATH = [cwd] if GetDepend('RT_USING_LIBC'): - src += Glob('*.c') + src += Glob('*.c') else: - if GetDepend('RT_LIBC_USING_TIME'): + if GetDepend('RT_LIBC_USING_TIME') and not GetDepend('RT_USING_MINILIBC'): src += ['time.c'] -if (rtconfig.PLATFORM == 'armcc' or rtconfig.PLATFORM == 'iar') and rtconfig.ARCH != 'sim' : - group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) +if GetDepend('RT_USING_POSIX') == False: + SrcRemove(src, ['unistd.c']) + +if not GetDepend('RT_USING_MINILIBC') and (GetDepend('RT_USING_LIBC') or GetDepend('RT_LIBC_USING_TIME')): + group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH) Return('group') diff --git a/components/libc/compilers/common/readme.md b/components/libc/compilers/common/readme.md new file mode 100644 index 000000000..99797d933 --- /dev/null +++ b/components/libc/compilers/common/readme.md @@ -0,0 +1,10 @@ +## Attentions + +1. This folder is "common" for armlibc newlibc and dlib. It's not "common" for minilibc. + +2. If you want to add new .c files, please do not forget to fix SConscript file too. eg: + +```python +if GetDepend('RT_USING_POSIX') == False: + SrcRemove(src, ['unistd.c']) +``` \ No newline at end of file diff --git a/components/libc/compilers/common/sys/time.h b/components/libc/compilers/common/sys/time.h index 1d68eeafa..92552c294 100644 --- a/components/libc/compilers/common/sys/time.h +++ b/components/libc/compilers/common/sys/time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,6 +15,14 @@ extern "C" { #endif +/* + * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001. + */ +#if defined ( __ICCARM__ ) && (__VER__ >= 8010001) +#define _TIMESPEC_DEFINED +#endif + + #ifndef _TIMEVAL_DEFINED #define _TIMEVAL_DEFINED /* @@ -27,23 +35,12 @@ struct timeval { }; #endif /* _TIMEVAL_DEFINED */ -/* - * Skip define timespec for IAR version over 8.10.1 where __VER__ is 8010001. - */ -#if defined ( __ICCARM__ ) && (__VER__ >= 8010001) -#define _TIMESPEC_DEFINED -#endif - -#ifndef _TIMESPEC_DEFINED -#define _TIMESPEC_DEFINED -/* - * Structure defined by POSIX.1b to be like a timeval. - */ +#if !defined __GNUC__ && !defined __ICCARM__ struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; -#endif /* _TIMESPEC_DEFINED */ +#endif struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ diff --git a/components/libc/compilers/newlib/termios.h b/components/libc/compilers/common/termios.h similarity index 64% rename from components/libc/compilers/newlib/termios.h rename to components/libc/compilers/common/termios.h index 195612122..2960d52c5 100644 --- a/components/libc/compilers/newlib/termios.h +++ b/components/libc/compilers/common/termios.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,7 +9,11 @@ #ifndef _TERMIOS_H__ #define _TERMIOS_H__ +#include + +#ifdef RT_USING_POSIX_TERMIOS #include #include +#endif #endif diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 50a800b25..6c184fbf4 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -246,9 +246,9 @@ int gettimeofday(struct timeval *tp, void *ignore) #if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 #pragma module_name = "?time" #if _DLIB_TIME_USES_64 -time_t __time64(time_t *t) +time_t __time64(time_t *t) #else -time_t __time32(time_t *t) +time_t __time32(time_t *t) #endif #else time_t time(time_t *t) diff --git a/components/libc/compilers/common/unistd.c b/components/libc/compilers/common/unistd.c new file mode 100644 index 000000000..cdc065d05 --- /dev/null +++ b/components/libc/compilers/common/unistd.c @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2006-2021, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2020-09-01 Meco Man First Version + */ + +#include + +#ifdef RT_USING_POSIX_TERMIOS +#include "termios.h" + +int isatty(int fd) +{ + struct termios ts; + return(tcgetattr(fd,&ts) != -1);/*true if no error (is a tty)*/ +} +#endif + +char *ttyname(int fd) +{ + return "/dev/tty0"; /*TODO: need to add more specific*/ +} diff --git a/components/libc/compilers/dlib/README.md b/components/libc/compilers/dlib/README.md index 846eb3f5c..acd08f907 100644 --- a/components/libc/compilers/dlib/README.md +++ b/components/libc/compilers/dlib/README.md @@ -1,4 +1,9 @@ -Dlib(IAR) porting for RT-Thread. +# DLIB (IAR) porting for RT-Thread Please define RT_USING_LIBC and compile RT-Thread with IAR compiler. + + +## More Information + +http://www.iarsys.co.jp/download/LMS2/arm/7502/ewarm7502doc/arm/doc/EWARM_DevelopmentGuide.ENU.pdf P.130 \ No newline at end of file diff --git a/components/libc/compilers/dlib/dirent.h b/components/libc/compilers/dlib/dirent.h index 4c897cc55..2c0521d2e 100644 --- a/components/libc/compilers/dlib/dirent.h +++ b/components/libc/compilers/dlib/dirent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/environ.c b/components/libc/compilers/dlib/environ.c index ac1975883..84b04fda5 100644 --- a/components/libc/compilers/dlib/environ.c +++ b/components/libc/compilers/dlib/environ.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/fcntl.h b/components/libc/compilers/dlib/fcntl.h index ce95230e8..c4b42083c 100644 --- a/components/libc/compilers/dlib/fcntl.h +++ b/components/libc/compilers/dlib/fcntl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/libc.c b/components/libc/compilers/dlib/libc.c index 8b42411a6..d0dca7c5f 100644 --- a/components/libc/compilers/dlib/libc.c +++ b/components/libc/compilers/dlib/libc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/libc.h b/components/libc/compilers/dlib/libc.h index 5b46bee0c..fc3cafca7 100644 --- a/components/libc/compilers/dlib/libc.h +++ b/components/libc/compilers/dlib/libc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/rmtx.c b/components/libc/compilers/dlib/rmtx.c index 69405c8f6..66c3f9377 100644 --- a/components/libc/compilers/dlib/rmtx.c +++ b/components/libc/compilers/dlib/rmtx.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,7 +22,7 @@ void _Mtxinit(_Rmtx *m) rt_mutex_t mutex; RT_ASSERT(m != RT_NULL); - + mutex = (rt_mutex_t)m; rt_mutex_init(mutex, "iarMtx", RT_IPC_FLAG_FIFO); } diff --git a/components/libc/compilers/dlib/stdio.c b/components/libc/compilers/dlib/stdio.c index b35ade7a3..c11157d75 100644 --- a/components/libc/compilers/dlib/stdio.c +++ b/components/libc/compilers/dlib/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/sys/errno.h b/components/libc/compilers/dlib/sys/errno.h index 1ad4c8acc..54a1d33cd 100644 --- a/components/libc/compilers/dlib/sys/errno.h +++ b/components/libc/compilers/dlib/sys/errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/sys/mman.h b/components/libc/compilers/dlib/sys/mman.h index 8c61b32b7..6a260ccd7 100644 --- a/components/libc/compilers/dlib/sys/mman.h +++ b/components/libc/compilers/dlib/sys/mman.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/sys/signal.h b/components/libc/compilers/dlib/sys/signal.h index 22adb1228..a30235f2b 100644 --- a/components/libc/compilers/dlib/sys/signal.h +++ b/components/libc/compilers/dlib/sys/signal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/sys/stat.h b/components/libc/compilers/dlib/sys/stat.h index ce95230e8..c4b42083c 100644 --- a/components/libc/compilers/dlib/sys/stat.h +++ b/components/libc/compilers/dlib/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/sys/types.h b/components/libc/compilers/dlib/sys/types.h index 001ace4dd..e13a0f6d0 100644 --- a/components/libc/compilers/dlib/sys/types.h +++ b/components/libc/compilers/dlib/sys/types.h @@ -1,24 +1,25 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes + * 2020-12-16 Meco Man add useconds_t */ #ifndef __TYPES_H__ #define __TYPES_H__ #include -#include -typedef rt_int32_t clockid_t; -typedef rt_int32_t key_t; /* Used for interprocess communication. */ -typedef rt_int32_t pid_t; /* Used for process IDs and process group IDs. */ +typedef int32_t clockid_t; +typedef int32_t key_t; /* Used for interprocess communication. */ +typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ #ifndef ARCH_CPU_64BIT -typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ +typedef signed int ssize_t; /* Used for a count of bytes or an error indication. */ #else -typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ +typedef long signed int ssize_t; /* Used for a count of bytes or an error indication. */ #endif +typedef unsigned long useconds_t; /* microseconds (unsigned) */ #endif diff --git a/components/libc/compilers/dlib/sys/unistd.h b/components/libc/compilers/dlib/sys/unistd.h index 29f68f24f..a4dac0cf6 100644 --- a/components/libc/compilers/dlib/sys/unistd.h +++ b/components/libc/compilers/dlib/sys/unistd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,22 +17,22 @@ #include #else -#define _FREAD 0x0001 /* read enabled */ -#define _FWRITE 0x0002 /* write enabled */ -#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ -#define _FMARK 0x0010 /* internal; mark during gc() */ -#define _FDEFER 0x0020 /* internal; defer for next gc pass */ -#define _FASYNC 0x0040 /* signal pgrp when data ready */ -#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ -#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ -#define _FCREAT 0x0200 /* open with file create */ -#define _FTRUNC 0x0400 /* open with truncation */ -#define _FEXCL 0x0800 /* error on open if file exists */ -#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ -#define _FSYNC 0x2000 /* do all writes synchronously */ -#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ -#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ -#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ #endif diff --git a/components/libc/compilers/dlib/syscall_close.c b/components/libc/compilers/dlib/syscall_close.c index f46162deb..7ed1cc2f2 100644 --- a/components/libc/compilers/dlib/syscall_close.c +++ b/components/libc/compilers/dlib/syscall_close.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_lseek.c b/components/libc/compilers/dlib/syscall_lseek.c index b79cc410b..47a069bf0 100644 --- a/components/libc/compilers/dlib/syscall_lseek.c +++ b/components/libc/compilers/dlib/syscall_lseek.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_mem.c b/components/libc/compilers/dlib/syscall_mem.c index 236ef1c12..9c6de6445 100644 --- a/components/libc/compilers/dlib/syscall_mem.c +++ b/components/libc/compilers/dlib/syscall_mem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_open.c b/components/libc/compilers/dlib/syscall_open.c index 96e02dc32..37bfcecb4 100644 --- a/components/libc/compilers/dlib/syscall_open.c +++ b/components/libc/compilers/dlib/syscall_open.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_read.c b/components/libc/compilers/dlib/syscall_read.c index e24821148..afb661bd9 100644 --- a/components/libc/compilers/dlib/syscall_read.c +++ b/components/libc/compilers/dlib/syscall_read.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_remove.c b/components/libc/compilers/dlib/syscall_remove.c index e7f0268b1..629127bf7 100644 --- a/components/libc/compilers/dlib/syscall_remove.c +++ b/components/libc/compilers/dlib/syscall_remove.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscall_write.c b/components/libc/compilers/dlib/syscall_write.c index 85c0da22c..de464530b 100644 --- a/components/libc/compilers/dlib/syscall_write.c +++ b/components/libc/compilers/dlib/syscall_write.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/syscalls.h b/components/libc/compilers/dlib/syscalls.h index 993962e8d..3a89f16e0 100644 --- a/components/libc/compilers/dlib/syscalls.h +++ b/components/libc/compilers/dlib/syscalls.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/dlib/termios.h b/components/libc/compilers/dlib/termios.h deleted file mode 100644 index 195612122..000000000 --- a/components/libc/compilers/dlib/termios.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef _TERMIOS_H__ -#define _TERMIOS_H__ - -#include -#include - -#endif diff --git a/components/libc/compilers/dlib/unistd.h b/components/libc/compilers/dlib/unistd.h index a07d8409c..72b9d538e 100644 --- a/components/libc/compilers/dlib/unistd.h +++ b/components/libc/compilers/dlib/unistd.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/SConscript b/components/libc/compilers/minilibc/SConscript index 518d80057..dec657028 100644 --- a/components/libc/compilers/minilibc/SConscript +++ b/components/libc/compilers/minilibc/SConscript @@ -8,7 +8,7 @@ group = [] CPPPATH = [cwd] CPPDEFINES = ['RT_USING_MINILIBC'] -if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC'): +if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC') and GetDepend('RT_USING_MINILIBC'): group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) diff --git a/components/libc/compilers/minilibc/ctype.c b/components/libc/compilers/minilibc/ctype.c index b94ff2dae..4278d8e41 100644 --- a/components/libc/compilers/minilibc/ctype.c +++ b/components/libc/compilers/minilibc/ctype.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,34 +16,34 @@ int isprint (int ch) { - ch&=0x7f; - return (ch>=32 && ch<127); + ch&=0x7f; + return (ch>=32 && ch<127); } int isalpha(int ch) { - return (unsigned int)((ch | 0x20) - 'a') < 26u; + return (unsigned int)((ch | 0x20) - 'a') < 26u; } int isdigit (int ch) { - return (unsigned int)(ch - '0') < 10u; + return (unsigned int)(ch - '0') < 10u; } int isspace(int ch) { - switch(ch) - { - case ' ': - case '\n': - case '\f': - case '\r': - case '\t': - case '\v': - return 1; - default: - return 0; - } + switch(ch) + { + case ' ': + case '\n': + case '\f': + case '\r': + case '\t': + case '\v': + return 1; + default: + return 0; + } } #endif diff --git a/components/libc/compilers/minilibc/ctype.h b/components/libc/compilers/minilibc/ctype.h index 5f41376ed..9d394dd12 100644 --- a/components/libc/compilers/minilibc/ctype.h +++ b/components/libc/compilers/minilibc/ctype.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/errno.h b/components/libc/compilers/minilibc/errno.h index a7ee38059..b1cbe5452 100644 --- a/components/libc/compilers/minilibc/errno.h +++ b/components/libc/compilers/minilibc/errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,6 +11,6 @@ #include "libc/libc_errno.h" /* Others defined in libc/libc_errno.h */ -#define ENSRNOTFOUND 163 /* Domain name not found */ +#define ENSRNOTFOUND 163 /* Domain name not found */ #endif diff --git a/components/libc/compilers/minilibc/inttypes.h b/components/libc/compilers/minilibc/inttypes.h index 8bab74365..595e83a08 100644 --- a/components/libc/compilers/minilibc/inttypes.h +++ b/components/libc/compilers/minilibc/inttypes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/math.c b/components/libc/compilers/minilibc/math.c index cd5770178..375e94344 100644 --- a/components/libc/compilers/minilibc/math.c +++ b/components/libc/compilers/minilibc/math.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/math.h b/components/libc/compilers/minilibc/math.h index 49b80d821..327f47092 100644 --- a/components/libc/compilers/minilibc/math.h +++ b/components/libc/compilers/minilibc/math.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/qsort.c b/components/libc/compilers/minilibc/qsort.c index 2b97ce763..5f11e3a4f 100644 --- a/components/libc/compilers/minilibc/qsort.c +++ b/components/libc/compilers/minilibc/qsort.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -24,7 +24,7 @@ static void exch(char* base,size_t size,size_t a,size_t b) { /* Blame him for the scary variable names */ /* http://www.cs.princeton.edu/~rs/talks/QuicksortIsOptimal.pdf */ static void quicksort(char* base,size_t size,ssize_t l,ssize_t r, - int (*compar)(const void*,const void*)) { + int (*compar)(const void*,const void*)) { ssize_t i=l-1, j=r, p=l-1, q=r, k; char* v=base+r*size; if (r<=l) return; diff --git a/components/libc/compilers/minilibc/rand.c b/components/libc/compilers/minilibc/rand.c index 88603dc80..8bbf42a32 100644 --- a/components/libc/compilers/minilibc/rand.c +++ b/components/libc/compilers/minilibc/rand.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,10 +13,10 @@ static unsigned int _seed=1; /* Knuth's TAOCP section 3.6 */ -#define M ((1U<<31) -1) -#define A 48271 -#define Q 44488 // M/A -#define R 3399 // M%A; R < Q !!! +#define M ((1U<<31) -1) +#define A 48271 +#define Q 44488 // M/A +#define R 3399 // M%A; R < Q !!! int rand_r(unsigned int* seed) { int32_t X; @@ -24,7 +24,7 @@ int rand_r(unsigned int* seed) X = *seed; X = A*(X%Q) - R * (int32_t) (X/Q); if (X < 0) - X += M; + X += M; *seed = X; return X; @@ -35,8 +35,8 @@ int rand(void) { } void srand(unsigned int i) -{ - _seed=i; +{ + _seed=i; } int random(void) __attribute__((alias("rand"))); diff --git a/components/libc/compilers/minilibc/signal.h b/components/libc/compilers/minilibc/signal.h index f52f1e100..e350d166b 100644 --- a/components/libc/compilers/minilibc/signal.h +++ b/components/libc/compilers/minilibc/signal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/stddef.h b/components/libc/compilers/minilibc/stddef.h index 7353a157c..496c4b8ec 100644 --- a/components/libc/compilers/minilibc/stddef.h +++ b/components/libc/compilers/minilibc/stddef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/stdint.h b/components/libc/compilers/minilibc/stdint.h index bd5fdc83f..b2fb999c7 100644 --- a/components/libc/compilers/minilibc/stdint.h +++ b/components/libc/compilers/minilibc/stdint.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -223,7 +223,7 @@ typedef __UINTMAX_TYPE__ uintmax_t; #define WINT_MIN __WINT_MIN__ #endif /* (!defined __cplusplus || __cplusplus >= 201103L - || defined __STDC_LIMIT_MACROS) */ + || defined __STDC_LIMIT_MACROS) */ #if (!defined __cplusplus || __cplusplus >= 201103L \ || defined __STDC_CONSTANT_MACROS) @@ -250,7 +250,7 @@ typedef __UINTMAX_TYPE__ uintmax_t; #define UINTMAX_C(c) __UINTMAX_C(c) #endif /* (!defined __cplusplus || __cplusplus >= 201103L - || defined __STDC_CONSTANT_MACROS) */ + || defined __STDC_CONSTANT_MACROS) */ #ifndef __INT_MAX__ #define __INT_MAX__ 2147483647 @@ -259,8 +259,8 @@ typedef __UINTMAX_TYPE__ uintmax_t; #define INT_MAX (__INT_MAX__) #define UINT_MAX (INT_MAX * 2U + 1U) -#define LONG_MAX ((long)(~0UL>>1)) -#define LONG_MIN (-LONG_MAX - 1) -#define ULONG_MAX (~0UL) +#define LONG_MAX ((long)(~0UL>>1)) +#define LONG_MIN (-LONG_MAX - 1) +#define ULONG_MAX (~0UL) #endif diff --git a/components/libc/compilers/minilibc/stdio.h b/components/libc/compilers/minilibc/stdio.h index 678682cf5..7c29ef011 100644 --- a/components/libc/compilers/minilibc/stdio.h +++ b/components/libc/compilers/minilibc/stdio.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -10,16 +10,16 @@ #define __STDIO_H__ #define BUFSIZ 128 -#define EOF (-1) +#define EOF (-1) #ifndef SEEK_SET -#define SEEK_SET 0 /* set file offset to offset */ +#define SEEK_SET 0 /* set file offset to offset */ #endif #ifndef SEEK_CUR -#define SEEK_CUR 1 /* set file offset to current plus offset */ +#define SEEK_CUR 1 /* set file offset to current plus offset */ #endif #ifndef SEEK_END -#define SEEK_END 2 /* set file offset to EOF plus offset */ +#define SEEK_END 2 /* set file offset to EOF plus offset */ #endif #endif diff --git a/components/libc/compilers/minilibc/stdlib.c b/components/libc/compilers/minilibc/stdlib.c index 8154ec5b8..2bbad75fe 100644 --- a/components/libc/compilers/minilibc/stdlib.c +++ b/components/libc/compilers/minilibc/stdlib.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,60 +15,60 @@ int atoi(const char* s) { - long int v=0; - int sign=1; - while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++; - switch (*s) - { - case '-': - sign=-1; - case '+': - ++s; - } - while ((unsigned int) (*s - '0') < 10u) - { - v=v*10+*s-'0'; - ++s; - } - return sign==-1?-v:v; + long int v=0; + int sign=1; + while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++; + switch (*s) + { + case '-': + sign=-1; + case '+': + ++s; + } + while ((unsigned int) (*s - '0') < 10u) + { + v=v*10+*s-'0'; + ++s; + } + return sign==-1?-v:v; } -long int atol(const char* s) +long int atol(const char* s) { - long int v=0; - int sign=0; - while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s; - switch (*s) - { - case '-': sign=-1; - case '+': ++s; - } - while ((unsigned int) (*s - '0') < 10u) - { - v=v*10+*s-'0'; ++s; - } - return sign?-v:v; + long int v=0; + int sign=0; + while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s; + switch (*s) + { + case '-': sign=-1; + case '+': ++s; + } + while ((unsigned int) (*s - '0') < 10u) + { + v=v*10+*s-'0'; ++s; + } + return sign?-v:v; } #ifdef RT_USING_HEAP void *malloc(size_t size) { - return rt_malloc(size); + return rt_malloc(size); } void free(void *ptr) { - rt_free(ptr); + rt_free(ptr); } void *realloc(void *ptr, size_t size) { - return rt_realloc(ptr, size); + return rt_realloc(ptr, size); } void *calloc(size_t nelem, size_t elsize) { - return rt_calloc(nelem, elsize); + return rt_calloc(nelem, elsize); } #endif diff --git a/components/libc/compilers/minilibc/stdlib.h b/components/libc/compilers/minilibc/stdlib.h index d57d95b64..96d335409 100644 --- a/components/libc/compilers/minilibc/stdlib.h +++ b/components/libc/compilers/minilibc/stdlib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/string.c b/components/libc/compilers/minilibc/string.c index 1ab7c0509..4eb9cc3a4 100644 --- a/components/libc/compilers/minilibc/string.c +++ b/components/libc/compilers/minilibc/string.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -21,44 +21,44 @@ /* there is no strcpy and strcmp implementation in RT-Thread */ char *strcpy(char *dest, const char *src) { - return (char *)rt_strncpy(dest, src, rt_strlen(src) + 1); + return (char *)rt_strncpy(dest, src, rt_strlen(src) + 1); } char *strncpy(char *dest, const char *src, size_t siz) { - return (char *)rt_strncpy(dest, src, siz); + return (char *)rt_strncpy(dest, src, siz); } size_t strlcpy(char *dst, const char *src, size_t siz) { - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) - { - do - { - if ((*d++ = *s++) == 0) break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) - { - if (siz != 0) *d = '\0'; /* NUL-terminate dst */ - while (*s++) ; - } - - return(s - src - 1); /* count does not include NUL */ + register char *d = dst; + register const char *s = src; + register size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) + { + do + { + if ((*d++ = *s++) == 0) break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) + { + if (siz != 0) *d = '\0'; /* NUL-terminate dst */ + while (*s++) ; + } + + return(s - src - 1); /* count does not include NUL */ } int strcmp (const char *s1, const char *s2) { - while (*s1 && *s1 == *s2) - s1++, s2++; - return (*s1 - *s2); + while (*s1 && *s1 == *s2) + s1++, s2++; + return (*s1 - *s2); } /** @@ -69,87 +69,87 @@ int strcmp (const char *s1, const char *s2) */ int strncmp(const char *cs,const char *ct, size_t count) { - register signed char __res = 0; + register signed char __res = 0; - while (count) { - if ((__res = *cs - *ct++) != 0 || !*cs++) - break; - count--; - } + while (count) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + count--; + } - return __res; + return __res; } char *strcat(char * dest, const char * src) { - char *tmp = dest; + char *tmp = dest; - while (*dest) - dest++; - while ((*dest++ = *src++) != '\0') - ; + while (*dest) + dest++; + while ((*dest++ = *src++) != '\0') + ; - return tmp; + return tmp; } char *strncat(char *dest, const char *src, size_t count) { - char *tmp = dest; - - if (count) { - while (*dest) - dest++; - while ((*dest++ = *src++)) { - if (--count == 0) { - *dest = '\0'; - break; - } - } - } - - return tmp; + char *tmp = dest; + + if (count) { + while (*dest) + dest++; + while ((*dest++ = *src++)) { + if (--count == 0) { + *dest = '\0'; + break; + } + } + } + + return tmp; } -char *strrchr(const char *t, int c) +char *strrchr(const char *t, int c) { - register char ch; - register const char *l=0; - - ch = c; - for (;;) - { - if (*t == ch) l=t; - if (!*t) return (char*)l; - ++t; - } - - return (char*)l; + register char ch; + register const char *l=0; + + ch = c; + for (;;) + { + if (*t == ch) l=t; + if (!*t) return (char*)l; + ++t; + } + + return (char*)l; } int strncasecmp ( const char* s1, const char* s2, size_t len ) { - register unsigned int x2; - register unsigned int x1; - register const char* end = s1 + len; + register unsigned int x2; + register unsigned int x1; + register const char* end = s1 + len; - while (1) - { - if ((s1 >= end) ) - return 0; + while (1) + { + if ((s1 >= end) ) + return 0; - x2 = *s2 - 'A'; if ((x2 < 26u)) x2 += 32; - x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32; - s1++; s2++; + x2 = *s2 - 'A'; if ((x2 < 26u)) x2 += 32; + x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32; + s1++; s2++; - if (x2 != x1) - break; + if (x2 != x1) + break; - if (x1 == (unsigned int)-'A') - break; - } + if (x1 == (unsigned int)-'A') + break; + } - return x1 - x2; + return x1 - x2; } /* private function */ @@ -157,50 +157,50 @@ int strncasecmp ( const char* s1, const char* s2, size_t len ) rt_inline int divide(int *n, int base) { - rt_int32_t res; - - /* optimized for processor which does not support divide instructions. */ - if (base == 10) - { - res = ((int)*n) % 10U; - *n = ((int)*n) / 10U; - } - else - { - res = ((int)*n) % 16U; - *n = ((int)*n) / 16U; - } - - return res; + rt_int32_t res; + + /* optimized for processor which does not support divide instructions. */ + if (base == 10) + { + res = ((int)*n) % 10U; + *n = ((int)*n) / 10U; + } + else + { + res = ((int)*n) % 16U; + *n = ((int)*n) / 16U; + } + + return res; } rt_inline int skip_atoi(const char **s) { - register int i=0; - while (isdigit(**s)) i = i*10 + *((*s)++) - '0'; + register int i=0; + while (isdigit(**s)) i = i*10 + *((*s)++) - '0'; - return i; + return i; } unsigned char _ctype[] = { -_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ -_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ -_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ -_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ -_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ -_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ -_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ -_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ -_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ -_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ -_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ -_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ -_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ -_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ -_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ -_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ +_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ +_C,_C,_C,_C,_C,_C,_C,_C, /* 24-31 */ +_S|_SP,_P,_P,_P,_P,_P,_P,_P, /* 32-39 */ +_P,_P,_P,_P,_P,_P,_P,_P, /* 40-47 */ +_D,_D,_D,_D,_D,_D,_D,_D, /* 48-55 */ +_D,_D,_P,_P,_P,_P,_P,_P, /* 56-63 */ +_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U, /* 64-71 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 72-79 */ +_U,_U,_U,_U,_U,_U,_U,_U, /* 80-87 */ +_U,_U,_U,_P,_P,_P,_P,_P, /* 88-95 */ +_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L, /* 96-103 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 104-111 */ +_L,_L,_L,_L,_L,_L,_L,_L, /* 112-119 */ +_L,_L,_L,_P,_P,_P,_P,_C, /* 120-127 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 128-143 */ +0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-159 */ _S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 160-175 */ _P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P, /* 176-191 */ _U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U, /* 192-207 */ @@ -210,42 +210,42 @@ _L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L}; /* 240-255 */ #define __ismask(x) (_ctype[(int)(unsigned char)(x)]) -#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) -#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) -#define iscntrl(c) ((__ismask(c)&(_C)) != 0) -#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) -#define islower(c) ((__ismask(c)&(_L)) != 0) -#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) -#define ispunct(c) ((__ismask(c)&(_P)) != 0) -#define isspace(c) ((__ismask(c)&(_S)) != 0) -#define isupper(c) ((__ismask(c)&(_U)) != 0) -#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) +#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) +#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) +#define iscntrl(c) ((__ismask(c)&(_C)) != 0) +#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) +#define islower(c) ((__ismask(c)&(_L)) != 0) +#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) +#define ispunct(c) ((__ismask(c)&(_P)) != 0) +#define isspace(c) ((__ismask(c)&(_S)) != 0) +#define isupper(c) ((__ismask(c)&(_U)) != 0) +#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) #define isascii(c) (((unsigned char)(c))<=0x7f) #define toascii(c) (((unsigned char)(c))&0x7f) static inline unsigned char __tolower(unsigned char c) { - if (isupper(c)) - c -= 'A'-'a'; - return c; + if (isupper(c)) + c -= 'A'-'a'; + return c; } static inline unsigned char __toupper(unsigned char c) { - if (islower(c)) - c -= 'a'-'A'; - return c; + if (islower(c)) + c -= 'a'-'A'; + return c; } -int tolower(int c) +int tolower(int c) { - return __tolower(c); + return __tolower(c); } int toupper(int c) { - return __toupper(c); + return __toupper(c); } /** @@ -256,30 +256,30 @@ int toupper(int c) */ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) { - unsigned long result = 0,value; - - if (!base) { - base = 10; - if (*cp == '0') { - base = 8; - cp++; - if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { - cp++; - base = 16; - } - } - } else if (base == 16) { - if (cp[0] == '0' && toupper(cp[1]) == 'X') - cp += 2; - } - while (isxdigit(*cp) && - (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) { - result = result*base + value; - cp++; - } - if (endp) - *endp = (char *)cp; - return result; + unsigned long result = 0,value; + + if (!base) { + base = 10; + if (*cp == '0') { + base = 8; + cp++; + if ((toupper(*cp) == 'X') && isxdigit(cp[1])) { + cp++; + base = 16; + } + } + } else if (base == 16) { + if (cp[0] == '0' && toupper(cp[1]) == 'X') + cp += 2; + } + while (isxdigit(*cp) && + (value = isdigit(*cp) ? *cp-'0' : toupper(*cp)-'A'+10) < base) { + result = result*base + value; + cp++; + } + if (endp) + *endp = (char *)cp; + return result; } /** @@ -290,9 +290,9 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) */ long simple_strtol(const char *cp,char **endp,unsigned int base) { - if(*cp=='-') - return -simple_strtoul(cp+1,endp,base); - return simple_strtoul(cp,endp,base); + if(*cp=='-') + return -simple_strtoul(cp+1,endp,base); + return simple_strtoul(cp,endp,base); } /** @@ -303,30 +303,30 @@ long simple_strtol(const char *cp,char **endp,unsigned int base) */ unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base) { - unsigned long long result = 0, value; - - if (*cp == '0') { - cp++; - if ((toupper(*cp) == 'X') && isxdigit (cp[1])) { - base = 16; - cp++; - } - if (!base) { - base = 8; - } - } - if (!base) { - base = 10; - } - while (isxdigit (*cp) && (value = isdigit (*cp) - ? *cp - '0' - : (islower (*cp) ? toupper (*cp) : *cp) - 'A' + 10) < base) { - result = result * base + value; - cp++; - } - if (endp) - *endp = (char *) cp; - return result; + unsigned long long result = 0, value; + + if (*cp == '0') { + cp++; + if ((toupper(*cp) == 'X') && isxdigit (cp[1])) { + base = 16; + cp++; + } + if (!base) { + base = 8; + } + } + if (!base) { + base = 10; + } + while (isxdigit (*cp) && (value = isdigit (*cp) + ? *cp - '0' + : (islower (*cp) ? toupper (*cp) : *cp) - 'A' + 10) < base) { + result = result * base + value; + cp++; + } + if (endp) + *endp = (char *) cp; + return result; } /** @@ -337,284 +337,284 @@ unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base) */ long long simple_strtoll(const char *cp,char **endp,unsigned int base) { - if(*cp=='-') - return -simple_strtoull(cp+1,endp,base); - return simple_strtoull(cp,endp,base); + if(*cp=='-') + return -simple_strtoull(cp+1,endp,base); + return simple_strtoull(cp,endp,base); } /** * vsscanf - Unformat a buffer into a list of arguments - * @buf: input buffer - * @fmt: format of buffer - * @args: arguments + * @buf: input buffer + * @fmt: format of buffer + * @args: arguments */ int vsscanf(const char * buf, const char * fmt, va_list args) { - const char *str = buf; - char *next; - int num = 0; - int qualifier; - int base; - int field_width = -1; - int is_sign = 0; - - while(*fmt && *str) { - /* skip any white space in format */ - /* white space in format matchs any amount of - * white space, including none, in the input. - */ - if (isspace(*fmt)) { - while (isspace(*fmt)) - ++fmt; - while (isspace(*str)) - ++str; - } - - /* anything that is not a conversion must match exactly */ - if (*fmt != '%' && *fmt) { - if (*fmt++ != *str++) - break; - continue; - } - - if (!*fmt) - break; - ++fmt; - - /* skip this conversion. - * advance both strings to next white space - */ - if (*fmt == '*') { - while (!isspace(*fmt) && *fmt) - fmt++; - while (!isspace(*str) && *str) - str++; - continue; - } - - /* get field width */ - if (isdigit(*fmt)) - field_width = skip_atoi(&fmt); - - /* get conversion qualifier */ - qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z') { - qualifier = *fmt; - fmt++; - } - base = 10; - is_sign = 0; - - if (!*fmt || !*str) - break; - - switch(*fmt++) { - case 'c': - { - char *s = (char *) va_arg(args,char*); - if (field_width == -1) - field_width = 1; - do { - *s++ = *str++; - } while(field_width-- > 0 && *str); - num++; - } - continue; - case 's': - { - char *s = (char *) va_arg(args, char *); - if(field_width == -1) - field_width = INT_MAX; - /* first, skip leading white space in buffer */ - while (isspace(*str)) - str++; - - /* now copy until next white space */ - while (*str && !isspace(*str) && field_width--) { - *s++ = *str++; - } - *s = '\0'; - num++; - } - continue; - case 'n': - /* return number of characters read so far */ - { - int *i = (int *)va_arg(args,int*); - *i = str - buf; - } - continue; - case 'o': - base = 8; - break; - case 'x': - case 'X': - base = 16; - break; - case 'd': - case 'i': - is_sign = 1; - case 'u': - break; - case '%': - /* looking for '%' in str */ - if (*str++ != '%') - return num; - continue; - default: - /* invalid format; stop here */ - return num; - } - - /* have some sort of integer conversion. - * first, skip white space in buffer. - */ - while (isspace(*str)) - str++; - - if (!*str || !isdigit(*str)) - break; - - switch(qualifier) { - case 'h': - if (is_sign) { - short *s = (short *) va_arg(args,short *); - *s = (short) simple_strtol(str,&next,base); - } else { - unsigned short *s = (unsigned short *) va_arg(args, unsigned short *); - *s = (unsigned short) simple_strtoul(str, &next, base); - } - break; - case 'l': - if (is_sign) { - long *l = (long *) va_arg(args,long *); - *l = simple_strtol(str,&next,base); - } else { - unsigned long *l = (unsigned long*) va_arg(args,unsigned long*); - *l = simple_strtoul(str,&next,base); - } - break; - case 'L': - if (is_sign) { - long long *l = (long long*) va_arg(args,long long *); - *l = simple_strtoll(str,&next,base); - } else { - unsigned long long *l = (unsigned long long*) va_arg(args,unsigned long long*); - *l = simple_strtoull(str,&next,base); - } - break; - case 'Z': - { - unsigned long *s = (unsigned long*) va_arg(args,unsigned long*); - *s = (unsigned long) simple_strtoul(str,&next,base); - } - break; - default: - if (is_sign) { - int *i = (int *) va_arg(args, int*); - *i = (int) simple_strtol(str,&next,base); - } else { - unsigned int *i = (unsigned int*) va_arg(args, unsigned int*); - *i = (unsigned int) simple_strtoul(str,&next,base); - } - break; - } - num++; - - if (!next) - break; - str = next; - } - return num; + const char *str = buf; + char *next; + int num = 0; + int qualifier; + int base; + int field_width = -1; + int is_sign = 0; + + while(*fmt && *str) { + /* skip any white space in format */ + /* white space in format matchs any amount of + * white space, including none, in the input. + */ + if (isspace(*fmt)) { + while (isspace(*fmt)) + ++fmt; + while (isspace(*str)) + ++str; + } + + /* anything that is not a conversion must match exactly */ + if (*fmt != '%' && *fmt) { + if (*fmt++ != *str++) + break; + continue; + } + + if (!*fmt) + break; + ++fmt; + + /* skip this conversion. + * advance both strings to next white space + */ + if (*fmt == '*') { + while (!isspace(*fmt) && *fmt) + fmt++; + while (!isspace(*str) && *str) + str++; + continue; + } + + /* get field width */ + if (isdigit(*fmt)) + field_width = skip_atoi(&fmt); + + /* get conversion qualifier */ + qualifier = -1; + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'Z') { + qualifier = *fmt; + fmt++; + } + base = 10; + is_sign = 0; + + if (!*fmt || !*str) + break; + + switch(*fmt++) { + case 'c': + { + char *s = (char *) va_arg(args,char*); + if (field_width == -1) + field_width = 1; + do { + *s++ = *str++; + } while(field_width-- > 0 && *str); + num++; + } + continue; + case 's': + { + char *s = (char *) va_arg(args, char *); + if(field_width == -1) + field_width = INT_MAX; + /* first, skip leading white space in buffer */ + while (isspace(*str)) + str++; + + /* now copy until next white space */ + while (*str && !isspace(*str) && field_width--) { + *s++ = *str++; + } + *s = '\0'; + num++; + } + continue; + case 'n': + /* return number of characters read so far */ + { + int *i = (int *)va_arg(args,int*); + *i = str - buf; + } + continue; + case 'o': + base = 8; + break; + case 'x': + case 'X': + base = 16; + break; + case 'd': + case 'i': + is_sign = 1; + case 'u': + break; + case '%': + /* looking for '%' in str */ + if (*str++ != '%') + return num; + continue; + default: + /* invalid format; stop here */ + return num; + } + + /* have some sort of integer conversion. + * first, skip white space in buffer. + */ + while (isspace(*str)) + str++; + + if (!*str || !isdigit(*str)) + break; + + switch(qualifier) { + case 'h': + if (is_sign) { + short *s = (short *) va_arg(args,short *); + *s = (short) simple_strtol(str,&next,base); + } else { + unsigned short *s = (unsigned short *) va_arg(args, unsigned short *); + *s = (unsigned short) simple_strtoul(str, &next, base); + } + break; + case 'l': + if (is_sign) { + long *l = (long *) va_arg(args,long *); + *l = simple_strtol(str,&next,base); + } else { + unsigned long *l = (unsigned long*) va_arg(args,unsigned long*); + *l = simple_strtoul(str,&next,base); + } + break; + case 'L': + if (is_sign) { + long long *l = (long long*) va_arg(args,long long *); + *l = simple_strtoll(str,&next,base); + } else { + unsigned long long *l = (unsigned long long*) va_arg(args,unsigned long long*); + *l = simple_strtoull(str,&next,base); + } + break; + case 'Z': + { + unsigned long *s = (unsigned long*) va_arg(args,unsigned long*); + *s = (unsigned long) simple_strtoul(str,&next,base); + } + break; + default: + if (is_sign) { + int *i = (int *) va_arg(args, int*); + *i = (int) simple_strtol(str,&next,base); + } else { + unsigned int *i = (unsigned int*) va_arg(args, unsigned int*); + *i = (unsigned int) simple_strtoul(str,&next,base); + } + break; + } + num++; + + if (!next) + break; + str = next; + } + return num; } /** * sscanf - Unformat a buffer into a list of arguments - * @buf: input buffer - * @fmt: formatting of buffer - * @...: resulting arguments + * @buf: input buffer + * @fmt: formatting of buffer + * @...: resulting arguments */ int sscanf(const char * buf, const char * fmt, ...) { - va_list args; - int i; - - va_start(args,fmt); - i = vsscanf(buf,fmt,args); - va_end(args); - - return i; + va_list args; + int i; + + va_start(args,fmt); + i = vsscanf(buf,fmt,args); + va_end(args); + + return i; } size_t strspn(const char *s, const char *accept) { - size_t l=0; - int a=1,i, al=strlen(accept); - - while((a)&&(*s)) - { - for(a=i=0;(!a)&&(i terminate it */ - } - *ptrptr=s; - return tmp; + char*tmp=0; + + if (s==0) s=*ptrptr; + s += strspn(s,delim); /* overread leading delimiter */ + if (*s) + { + tmp=s; + s+=strcspn(s,delim); + + if (*s) *s++=0; /* not the end ? => terminate it */ + } + *ptrptr=s; + return tmp; } char *strtok(char *s, const char *delim) { - static char *strtok_pos; - return strtok_r(s,delim,&strtok_pos); + static char *strtok_pos; + return strtok_r(s,delim,&strtok_pos); } char *strchr(const char *s1, int i) { - const unsigned char *s = (const unsigned char *)s1; - unsigned char c = (unsigned int)i; + const unsigned char *s = (const unsigned char *)s1; + unsigned char c = (unsigned int)i; - while (*s && *s != c) - { - s++; - } + while (*s && *s != c) + { + s++; + } - if (*s != c) - { - s = NULL; - } + if (*s != c) + { + s = NULL; + } - return (char *) s; + return (char *) s; } long strtol(const char *str, char **endptr, int base) diff --git a/components/libc/compilers/minilibc/string.h b/components/libc/compilers/minilibc/string.h index 45524c776..6ccbc79fe 100644 --- a/components/libc/compilers/minilibc/string.h +++ b/components/libc/compilers/minilibc/string.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,22 +16,22 @@ /* replace for standard string library */ #if !defined (RT_USING_NEWLIB) && defined (RT_USING_MINILIBC) -#define ZEROPAD (1 << 0) /* pad with zero */ -#define SIGN (1 << 1) /* unsigned/signed long */ -#define PLUS (1 << 2) /* show plus */ -#define SPACE (1 << 3) /* space if plus */ -#define LEFT (1 << 4) /* left justified */ -#define SPECIAL (1 << 5) /* 0x */ -#define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */ +#define ZEROPAD (1 << 0) /* pad with zero */ +#define SIGN (1 << 1) /* unsigned/signed long */ +#define PLUS (1 << 2) /* show plus */ +#define SPACE (1 << 3) /* space if plus */ +#define LEFT (1 << 4) /* left justified */ +#define SPECIAL (1 << 5) /* 0x */ +#define LARGE (1 << 6) /* use 'ABCDEF' instead of 'abcdef' */ -#define _U 0x01 /* upper */ -#define _L 0x02 /* lower */ -#define _D 0x04 /* digit */ -#define _C 0x08 /* cntrl */ -#define _P 0x10 /* punct */ -#define _S 0x20 /* white space (space/lf/tab) */ -#define _X 0x40 /* hex digit */ -#define _SP 0x80 /* hard space (0x20) */ +#define _U 0x01 /* upper */ +#define _L 0x02 /* lower */ +#define _D 0x04 /* digit */ +#define _C 0x08 /* cntrl */ +#define _P 0x10 /* punct */ +#define _S 0x20 /* white space (space/lf/tab) */ +#define _X 0x40 /* hex digit */ +#define _SP 0x80 /* hard space (0x20) */ void* memset(void *s, int c, size_t n); void* memcpy(void *dest, const void *src, size_t n); diff --git a/components/libc/compilers/minilibc/sys/mman.h b/components/libc/compilers/minilibc/sys/mman.h index 8c61b32b7..6a260ccd7 100644 --- a/components/libc/compilers/minilibc/sys/mman.h +++ b/components/libc/compilers/minilibc/sys/mman.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/sys/stat.h b/components/libc/compilers/minilibc/sys/stat.h index 65db477a4..8867b84a1 100644 --- a/components/libc/compilers/minilibc/sys/stat.h +++ b/components/libc/compilers/minilibc/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,31 +14,31 @@ #ifdef RT_USING_DFS #include #else -#define _FREAD 0x0001 /* read enabled */ -#define _FWRITE 0x0002 /* write enabled */ -#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ -#define _FMARK 0x0010 /* internal; mark during gc() */ -#define _FDEFER 0x0020 /* internal; defer for next gc pass */ -#define _FASYNC 0x0040 /* signal pgrp when data ready */ -#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ -#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ -#define _FCREAT 0x0200 /* open with file create */ -#define _FTRUNC 0x0400 /* open with truncation */ -#define _FEXCL 0x0800 /* error on open if file exists */ -#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ -#define _FSYNC 0x2000 /* do all writes synchronously */ -#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ -#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ -#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ +#define _FREAD 0x0001 /* read enabled */ +#define _FWRITE 0x0002 /* write enabled */ +#define _FAPPEND 0x0008 /* append (writes guaranteed at the end) */ +#define _FMARK 0x0010 /* internal; mark during gc() */ +#define _FDEFER 0x0020 /* internal; defer for next gc pass */ +#define _FASYNC 0x0040 /* signal pgrp when data ready */ +#define _FSHLOCK 0x0080 /* BSD flock() shared lock present */ +#define _FEXLOCK 0x0100 /* BSD flock() exclusive lock present */ +#define _FCREAT 0x0200 /* open with file create */ +#define _FTRUNC 0x0400 /* open with truncation */ +#define _FEXCL 0x0800 /* error on open if file exists */ +#define _FNBIO 0x1000 /* non blocking I/O (sys5 style) */ +#define _FSYNC 0x2000 /* do all writes synchronously */ +#define _FNONBLOCK 0x4000 /* non blocking I/O (POSIX style) */ +#define _FNDELAY _FNONBLOCK /* non blocking I/O (4.2 style) */ +#define _FNOCTTY 0x8000 /* don't assign a ctty on this open */ -#define O_RDONLY 0 /* +1 == FREAD */ -#define O_WRONLY 1 /* +1 == FWRITE */ -#define O_RDWR 2 /* +1 == FREAD|FWRITE */ -#define O_APPEND _FAPPEND -#define O_CREAT _FCREAT -#define O_TRUNC _FTRUNC -#define O_EXCL _FEXCL -#define O_SYNC _FSYNC +#define O_RDONLY 0 /* +1 == FREAD */ +#define O_WRONLY 1 /* +1 == FWRITE */ +#define O_RDWR 2 /* +1 == FREAD|FWRITE */ +#define O_APPEND _FAPPEND +#define O_CREAT _FCREAT +#define O_TRUNC _FTRUNC +#define O_EXCL _FEXCL +#define O_SYNC _FSYNC #endif #endif diff --git a/components/libc/compilers/minilibc/sys/time.h b/components/libc/compilers/minilibc/sys/time.h index 22a93f5c9..aa9e6d704 100644 --- a/components/libc/compilers/minilibc/sys/time.h +++ b/components/libc/compilers/minilibc/sys/time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,36 +17,36 @@ typedef long time_t; * and used in other calls. */ struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ }; /* * Structure defined by POSIX.1b to be like a timeval. */ struct timespec { - time_t tv_sec; /* seconds */ - long tv_nsec; /* and nanoseconds */ + time_t tv_sec; /* seconds */ + long tv_nsec; /* and nanoseconds */ }; struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ }; struct tm { - int tm_sec; /* Seconds. [0-60] (1 leap second) */ - int tm_min; /* Minutes. [0-59] */ - int tm_hour; /* Hours. [0-23] */ - int tm_mday; /* Day. [1-31] */ - int tm_mon; /* Month. [0-11] */ - int tm_year; /* Year - 1900. */ - int tm_wday; /* Day of week. [0-6] */ - int tm_yday; /* Days in year.[0-365] */ - int tm_isdst; /* DST. [-1/0/1]*/ - - long int tm_gmtoff; /* Seconds east of UTC. */ - const char *tm_zone; /* Timezone abbreviation. */ + int tm_sec; /* Seconds. [0-60] (1 leap second) */ + int tm_min; /* Minutes. [0-59] */ + int tm_hour; /* Hours. [0-23] */ + int tm_mday; /* Day. [1-31] */ + int tm_mon; /* Month. [0-11] */ + int tm_year; /* Year - 1900. */ + int tm_wday; /* Day of week. [0-6] */ + int tm_yday; /* Days in year.[0-365] */ + int tm_isdst; /* DST. [-1/0/1]*/ + + long int tm_gmtoff; /* Seconds east of UTC. */ + const char *tm_zone; /* Timezone abbreviation. */ }; int gettimeofday(struct timeval *tp, void *ignore); diff --git a/components/libc/compilers/minilibc/sys/types.h b/components/libc/compilers/minilibc/sys/types.h index d3abc6bb3..5bed922a0 100644 --- a/components/libc/compilers/minilibc/sys/types.h +++ b/components/libc/compilers/minilibc/sys/types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -25,8 +25,6 @@ typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; -typedef int mode_t; - typedef unsigned long clockid_t; typedef int pid_t; @@ -40,7 +38,7 @@ typedef int caddr_t; typedef unsigned int wint_t; typedef unsigned long useconds_t; -typedef unsigned long clock_t; /* clock() */ +typedef unsigned long clock_t; /* clock() */ #ifndef NULL #define NULL (0) diff --git a/components/libc/compilers/minilibc/time.c b/components/libc/compilers/minilibc/time.c index 25e8f0e31..3ac76c883 100644 --- a/components/libc/compilers/minilibc/time.c +++ b/components/libc/compilers/minilibc/time.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/minilibc/time.h b/components/libc/compilers/minilibc/time.h index 09fc7d2e6..fba310fbe 100644 --- a/components/libc/compilers/minilibc/time.h +++ b/components/libc/compilers/minilibc/time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/newlib/README.md b/components/libc/compilers/newlib/README.md new file mode 100644 index 000000000..385f329a4 --- /dev/null +++ b/components/libc/compilers/newlib/README.md @@ -0,0 +1,9 @@ +# NEWLIB (GCC) porting for RT-Thread + +Please define RT_USING_LIBC and compile RT-Thread with GCC compiler. + + + +## More Information + +https://sourceware.org/newlib/libc.html#Reentrancy \ No newline at end of file diff --git a/components/libc/compilers/newlib/libc.c b/components/libc/compilers/newlib/libc.c index 2234c36f9..9834a9a01 100644 --- a/components/libc/compilers/newlib/libc.c +++ b/components/libc/compilers/newlib/libc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -19,7 +19,7 @@ #include #endif -int _EXFUN(putenv,(char *__string)); +int _EXFUN(putenv,(char *__string)); int libc_system_init(void) { diff --git a/components/libc/compilers/newlib/libc.h b/components/libc/compilers/newlib/libc.h index fdf2ab4f6..bf294ac11 100644 --- a/components/libc/compilers/newlib/libc.h +++ b/components/libc/compilers/newlib/libc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,7 +16,7 @@ #include #ifndef _EXFUN -#define _EXFUN(name, proto) name proto +#define _EXFUN(name, proto) name proto #endif #define MILLISECOND_PER_SECOND 1000UL diff --git a/components/libc/compilers/newlib/libc_syms.c b/components/libc/compilers/newlib/libc_syms.c index b150c10fd..f0882afcf 100644 --- a/components/libc/compilers/newlib/libc_syms.c +++ b/components/libc/compilers/newlib/libc_syms.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/newlib/stdio.c b/components/libc/compilers/newlib/stdio.c index 233a44739..ce5bdb75c 100644 --- a/components/libc/compilers/newlib/stdio.c +++ b/components/libc/compilers/newlib/stdio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,7 +15,7 @@ #define STDIO_DEVICE_NAME_MAX 32 -int _EXFUN(fileno, (FILE *)); +int _EXFUN(fileno, (FILE *)); static FILE* std_console = NULL; @@ -48,7 +48,7 @@ int libc_stdio_set_console(const char* device_name, int mode) { _GLOBAL_REENT->_stdin = std_console; } - else + else { _GLOBAL_REENT->_stdin = NULL; } diff --git a/components/libc/compilers/newlib/sys/dirent.h b/components/libc/compilers/newlib/sys/dirent.h index db8c0655a..bfba58609 100644 --- a/components/libc/compilers/newlib/sys/dirent.h +++ b/components/libc/compilers/newlib/sys/dirent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,36 +17,36 @@ */ /* File types */ -#define FT_REGULAR 0 /* regular file */ -#define FT_SOCKET 1 /* socket file */ -#define FT_DIRECTORY 2 /* directory */ -#define FT_USER 3 /* user defined */ +#define FT_REGULAR 0 /* regular file */ +#define FT_SOCKET 1 /* socket file */ +#define FT_DIRECTORY 2 /* directory */ +#define FT_USER 3 /* user defined */ -#define DT_UNKNOWN 0x00 -#define DT_REG 0x01 -#define DT_DIR 0x02 +#define DT_UNKNOWN 0x00 +#define DT_REG 0x01 +#define DT_DIR 0x02 #ifdef __cplusplus extern "C" { #endif #ifndef HAVE_DIR_STRUCTURE -typedef struct +typedef struct { - int fd; /* directory file */ - char buf[512]; - int num; - int cur; + int fd; /* directory file */ + char buf[512]; + int num; + int cur; } DIR; #endif #ifndef HAVE_DIRENT_STRUCTURE struct dirent { - rt_uint8_t d_type; /* The type of the file */ - rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ - rt_uint16_t d_reclen; /* length of this record */ - char d_name[256]; /* The null-terminated file name */ + rt_uint8_t d_type; /* The type of the file */ + rt_uint8_t d_namlen; /* The length of the not including the terminating null file name */ + rt_uint16_t d_reclen; /* length of this record */ + char d_name[256]; /* The null-terminated file name */ }; #endif diff --git a/components/libc/compilers/newlib/sys/mman.h b/components/libc/compilers/newlib/sys/mman.h index 8c61b32b7..6a260ccd7 100644 --- a/components/libc/compilers/newlib/sys/mman.h +++ b/components/libc/compilers/newlib/sys/mman.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/newlib/sys/statfs.h b/components/libc/compilers/newlib/sys/statfs.h index 3c923a21f..0996af9a1 100644 --- a/components/libc/compilers/newlib/sys/statfs.h +++ b/components/libc/compilers/newlib/sys/statfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,9 +13,9 @@ struct statfs { - rt_size_t f_bsize; /* block size */ - rt_size_t f_blocks; /* total data blocks in file system */ - rt_size_t f_bfree; /* free blocks in file system */ + rt_size_t f_bsize; /* block size */ + rt_size_t f_blocks; /* total data blocks in file system */ + rt_size_t f_bfree; /* free blocks in file system */ }; #endif diff --git a/components/libc/compilers/newlib/sys/termios.h b/components/libc/compilers/newlib/sys/termios.h index ce95230e8..c4b42083c 100644 --- a/components/libc/compilers/newlib/sys/termios.h +++ b/components/libc/compilers/newlib/sys/termios.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/compilers/newlib/syscalls.c b/components/libc/compilers/newlib/syscalls.c index 59c1881ad..754059fe2 100644 --- a/components/libc/compilers/newlib/syscalls.c +++ b/components/libc/compilers/newlib/syscalls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,10 +17,6 @@ #include #endif -#ifdef RT_USING_PTHREADS -#include -#endif - #ifdef RT_USING_MODULE #include #endif diff --git a/components/libc/compilers/newlib/time.c b/components/libc/compilers/newlib/time.c deleted file mode 100644 index f099d5133..000000000 --- a/components/libc/compilers/newlib/time.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#include -#include - -#ifdef RT_USING_DEVICE -int gettimeofday(struct timeval *tp, void *ignore) -{ - time_t time; - rt_device_t device; - - device = rt_device_find("rtc"); - RT_ASSERT(device != RT_NULL); - - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); - if (tp != RT_NULL) - { - tp->tv_sec = time; - tp->tv_usec = 0; - } - - return time; -} -#endif - -/** - * Returns the current time. - * - * @param time_t * t the timestamp pointer, if not used, keep NULL. - * - * @return time_t return timestamp current. - * - */ -/* for IAR 6.2 later Compiler */ -#if defined (__IAR_SYSTEMS_ICC__) && (__VER__) >= 6020000 -#pragma module_name = "?time" -time_t (__time32)(time_t *t) /* Only supports 32-bit timestamp */ -#else -time_t time(time_t *t) -#endif -{ - time_t time_now = 0; - -#ifdef RT_USING_RTC - static rt_device_t device = RT_NULL; - - /* optimization: find rtc device only first. */ - if (device == RT_NULL) - { - device = rt_device_find("rtc"); - } - - /* read timestamp from RTC device. */ - if (device != RT_NULL) - { - if (rt_device_open(device, 0) == RT_EOK) - { - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time_now); - rt_device_close(device); - } - } -#endif /* RT_USING_RTC */ - - /* if t is not NULL, write timestamp to *t */ - if (t != RT_NULL) - { - *t = time_now; - } - - return time_now; -} - -RT_WEAK clock_t clock(void) -{ - return rt_tick_get(); -} diff --git a/components/libc/libdl/arch/arm.c b/components/libc/libdl/arch/arm.c index a53c04f0b..6a884bdb5 100644 --- a/components/libc/libdl/arch/arm.c +++ b/components/libc/libdl/arch/arm.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2018/08/29 Bernard first version diff --git a/components/libc/libdl/arch/x86.c b/components/libc/libdl/arch/x86.c index 16f2322fb..e7ad714a0 100644 --- a/components/libc/libdl/arch/x86.c +++ b/components/libc/libdl/arch/x86.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2018/09/15 parai first version @@ -13,9 +13,9 @@ #ifdef __i386__ -#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ -#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ -#define R_X86_64_RELATIVE 8 /* Adjust by program base */ +#define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ +#define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ +#define R_X86_64_RELATIVE 8 /* Adjust by program base */ int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym_val) { Elf32_Addr *where, tmp; diff --git a/components/libc/libdl/dlclose.c b/components/libc/libdl/dlclose.c index 1202e13f2..876a1576c 100644 --- a/components/libc/libdl/dlclose.c +++ b/components/libc/libdl/dlclose.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/libdl/dlelf.c b/components/libc/libdl/dlelf.c index 1265ffcb0..3a4e62ad9 100644 --- a/components/libc/libdl/dlelf.c +++ b/components/libc/libdl/dlelf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -172,7 +172,7 @@ rt_err_t dlmodule_load_shared_object(struct rt_dlmodule* module, void *module_pt rel ++; } - if (unsolved) + if (unsolved) return -RT_ERROR; } @@ -301,7 +301,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module (rt_uint8_t *)elf_module + shdr[index].sh_offset, shdr[index].sh_size); rodata_addr = (rt_uint32_t)ptr; - LOG_D("load rodata 0x%x, size %d, rodata 0x%x", ptr, + LOG_D("load rodata 0x%x, size %d, rodata 0x%x", ptr, shdr[index].sh_size, *(rt_uint32_t *)data_addr); ptr += shdr[index].sh_size; } @@ -313,7 +313,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module (rt_uint8_t *)elf_module + shdr[index].sh_offset, shdr[index].sh_size); data_addr = (rt_uint32_t)ptr; - LOG_D("load data 0x%x, size %d, data 0x%x", ptr, + LOG_D("load data 0x%x, size %d, data 0x%x", ptr, shdr[index].sh_size, *(rt_uint32_t *)data_addr); ptr += shdr[index].sh_size; } @@ -362,7 +362,7 @@ rt_err_t dlmodule_load_relocated_object(struct rt_dlmodule* module, void *module if (sym->st_shndx != STN_UNDEF) { Elf32_Addr addr = 0; - + if ((ELF_ST_TYPE(sym->st_info) == STT_SECTION) || (ELF_ST_TYPE(sym->st_info) == STT_OBJECT)) { diff --git a/components/libc/libdl/dlelf.h b/components/libc/libdl/dlelf.h index 014ebe85c..ad9e2cdad 100644 --- a/components/libc/libdl/dlelf.h +++ b/components/libc/libdl/dlelf.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2018/08/29 Bernard first version diff --git a/components/libc/libdl/dlerror.c b/components/libc/libdl/dlerror.c index ad9b630e4..de948eb16 100644 --- a/components/libc/libdl/dlerror.c +++ b/components/libc/libdl/dlerror.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2010-11-17 yi.qiu first version @@ -13,6 +13,6 @@ const char *dlerror(void) { - return "TODO"; + return "TODO"; } RTM_EXPORT(dlerror) diff --git a/components/libc/libdl/dlfcn.h b/components/libc/libdl/dlfcn.h index 55273a41e..f5c9063f2 100644 --- a/components/libc/libdl/dlfcn.h +++ b/components/libc/libdl/dlfcn.h @@ -1,8 +1,8 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 - * + * * Change Logs: * Date Author Notes * 2010-11-17 yi.qiu first version diff --git a/components/libc/libdl/dlmodule.c b/components/libc/libdl/dlmodule.c index dbebfc896..5387bc4c0 100644 --- a/components/libc/libdl/dlmodule.c +++ b/components/libc/libdl/dlmodule.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,7 +14,9 @@ #include "dlmodule.h" #include "dlelf.h" +#if defined(RT_USING_POSIX) #include +#endif #define DBG_TAG "DLMD" #define DBG_LVL DBG_INFO @@ -122,7 +124,7 @@ static void _dlmodule_exit(void) rt_thread_t thread = (rt_thread_t)object; /* stop timer and suspend thread*/ - if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_CLOSE || + if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_CLOSE && (thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) { rt_timer_stop(&(thread->thread_timer)); @@ -419,11 +421,14 @@ struct rt_dlmodule *rt_module_self(void) struct rt_dlmodule* dlmodule_load(const char* filename) { - int fd, length = 0; +#if defined(RT_USING_POSIX) + int fd = -1, length = 0; +#endif rt_err_t ret = RT_EOK; rt_uint8_t *module_ptr = RT_NULL; struct rt_dlmodule *module = RT_NULL; +#if defined(RT_USING_POSIX) fd = open(filename, O_RDONLY, 0); if (fd >= 0) { @@ -446,6 +451,9 @@ struct rt_dlmodule* dlmodule_load(const char* filename) { goto __exit; } +#endif + + if (!module_ptr) goto __exit; /* check ELF header */ if (rt_memcmp(elf_module->e_ident, RTMMAG, SELFMAG) != 0 && @@ -512,7 +520,9 @@ struct rt_dlmodule* dlmodule_load(const char* filename) return module; __exit: +#if defined(RT_USING_POSIX) if (fd >= 0) close(fd); +#endif if (module_ptr) rt_free(module_ptr); if (module) dlmodule_destroy(module); @@ -537,7 +547,7 @@ struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_s if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1; if (module->stack_size < 2048 || module->stack_size > (1024 * 32)) module->stack_size = 2048; - tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module, + tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module, module->stack_size, module->priority, 10); if (tid) { @@ -570,7 +580,7 @@ void dlmodule_exit(int ret_code) rt_enter_critical(); /* module is not running */ - if (module->stat != RT_DLMODULE_STAT_RUNNING) + if (module->stat != RT_DLMODULE_STAT_RUNNING) { /* restore scheduling */ rt_exit_critical(); diff --git a/components/libc/libdl/dlmodule.h b/components/libc/libdl/dlmodule.h index 4a4ead330..688c0d4df 100644 --- a/components/libc/libdl/dlmodule.h +++ b/components/libc/libdl/dlmodule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/libdl/dlopen.c b/components/libc/libdl/dlopen.c index a8202ec60..bcb57d78f 100644 --- a/components/libc/libdl/dlopen.c +++ b/components/libc/libdl/dlopen.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -43,12 +43,12 @@ void* dlopen(const char *filename, int flags) /* find in module list */ module = dlmodule_find(fullpath); - if(module != RT_NULL) + if(module != RT_NULL) { rt_exit_critical(); module->nref++; } - else + else { rt_exit_critical(); module = dlmodule_load(fullpath); diff --git a/components/libc/libdl/dlsym.c b/components/libc/libdl/dlsym.c index ed0f183d8..f7c1c901f 100644 --- a/components/libc/libdl/dlsym.c +++ b/components/libc/libdl/dlsym.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,7 +17,7 @@ void* dlsym(void *handle, const char* symbol) { int i; struct rt_dlmodule *module; - + RT_ASSERT(handle != RT_NULL); module = (struct rt_dlmodule *)handle; diff --git a/components/libc/mmap/posix_mmap.c b/components/libc/mmap/posix_mmap.c index a16ace830..e68b82e64 100644 --- a/components/libc/mmap/posix_mmap.c +++ b/components/libc/mmap/posix_mmap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/SConscript b/components/libc/pthreads/SConscript index 1b7b75bfd..767b406d4 100644 --- a/components/libc/pthreads/SConscript +++ b/components/libc/pthreads/SConscript @@ -1,10 +1,22 @@ from building import * +from utils import VersionCmp -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] +cwd = GetCurrentDir() +src = Glob('*.c') +CPPPATH = [cwd] +CPPDEFINES = [] -group = DefineGroup('pthreads', src, - depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH) +# only enable POSIX.1b-1993 Real-time extensions +libc_ver = GetDepend('LIBC_VERSION') +try: + ver = libc_ver.split(' ') + ver = ver[1] + if VersionCmp(ver, "2.5.0") == 1: + CPPDEFINES = ['_POSIX_C_SOURCE=199309L'] +except : + pass + +group = DefineGroup('libc', src, + depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES) Return('group') diff --git a/components/libc/pthreads/mqueue.c b/components/libc/pthreads/mqueue.c index 003b49b9a..1af0ab291 100644 --- a/components/libc/pthreads/mqueue.c +++ b/components/libc/pthreads/mqueue.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/mqueue.h b/components/libc/pthreads/mqueue.h index 5cadde3ae..5152bfad2 100644 --- a/components/libc/pthreads/mqueue.h +++ b/components/libc/pthreads/mqueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/posix_types.h b/components/libc/pthreads/posix_types.h index ca20464bb..f2d806cc9 100644 --- a/components/libc/pthreads/posix_types.h +++ b/components/libc/pthreads/posix_types.h @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2013-12-23 Bernard Add the checking for ESHUTDOWN + * 2013-12-23 Bernard Add the checking for ESHUTDOWN */ #ifndef __POSIX_TYPES_H__ diff --git a/components/libc/pthreads/pthread.c b/components/libc/pthreads/pthread.c index 5d3bc0796..eabc92972 100644 --- a/components/libc/pthreads/pthread.c +++ b/components/libc/pthreads/pthread.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -200,7 +200,7 @@ int pthread_create(pthread_t *pid, /* allocate posix thread data */ pth_id = _pthread_data_create(); - if (pth_id == PTHREAD_NUM_MAX) + if (pth_id == PTHREAD_NUM_MAX) { ret = ENOMEM; goto __exit; diff --git a/components/libc/pthreads/pthread.h b/components/libc/pthreads/pthread.h index 7bb72b726..8639c1604 100644 --- a/components/libc/pthreads/pthread.h +++ b/components/libc/pthreads/pthread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -161,7 +161,7 @@ int pthread_attr_getguardsize(pthread_attr_t const *attr, size_t *guard_size); int pthread_attr_setscope(pthread_attr_t *attr, int scope); int pthread_attr_getscope(pthread_attr_t const *attr); int pthread_system_init(void); -int pthread_create (pthread_t *tid, const pthread_attr_t *attr, +int pthread_create (pthread_t *tid, const pthread_attr_t *attr, void *(*start) (void *), void *arg); int pthread_detach (pthread_t thread); diff --git a/components/libc/pthreads/pthread_attr.c b/components/libc/pthreads/pthread_attr.c index 2294599bf..4aedf5a90 100644 --- a/components/libc/pthreads/pthread_attr.c +++ b/components/libc/pthreads/pthread_attr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,7 +16,7 @@ #define DEFAULT_STACK_SIZE 2048 #define DEFAULT_PRIORITY (RT_THREAD_PRIORITY_MAX/2 + RT_THREAD_PRIORITY_MAX/4) -const pthread_attr_t pthread_default_attr = +const pthread_attr_t pthread_default_attr = { 0, /* stack base */ DEFAULT_STACK_SIZE, /* stack size */ diff --git a/components/libc/pthreads/pthread_barrier.c b/components/libc/pthreads/pthread_barrier.c index d76fe7f13..1a5b7fa3f 100644 --- a/components/libc/pthreads/pthread_barrier.c +++ b/components/libc/pthreads/pthread_barrier.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/pthread_cond.c b/components/libc/pthreads/pthread_cond.c index 38dc69746..59c271bf6 100644 --- a/components/libc/pthreads/pthread_cond.c +++ b/components/libc/pthreads/pthread_cond.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -84,10 +84,10 @@ int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) rt_snprintf(cond_name, sizeof(cond_name), "cond%02d", cond_num++); - if (attr == RT_NULL) /* use default value */ - cond->attr = PTHREAD_PROCESS_PRIVATE; - else - cond->attr = *attr; + if (attr == RT_NULL) /* use default value */ + cond->attr = PTHREAD_PROCESS_PRIVATE; + else + cond->attr = *attr; result = rt_sem_init(&cond->sem, cond_name, 0, RT_IPC_FLAG_FIFO); if (result != RT_EOK) diff --git a/components/libc/pthreads/pthread_internal.h b/components/libc/pthreads/pthread_internal.h index a6706ca09..24f24c8ce 100644 --- a/components/libc/pthreads/pthread_internal.h +++ b/components/libc/pthreads/pthread_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/pthread_mutex.c b/components/libc/pthreads/pthread_mutex.c index 8f9653178..a681380b1 100644 --- a/components/libc/pthreads/pthread_mutex.c +++ b/components/libc/pthreads/pthread_mutex.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -211,7 +211,7 @@ int pthread_mutex_unlock(pthread_mutex_t *mutex) result = rt_mutex_release(&(mutex->lock)); if (result == RT_EOK) return 0; - + return EINVAL; } RTM_EXPORT(pthread_mutex_unlock); diff --git a/components/libc/pthreads/pthread_rwlock.c b/components/libc/pthreads/pthread_rwlock.c index 64a0e221b..1c2fe19f5 100644 --- a/components/libc/pthreads/pthread_rwlock.c +++ b/components/libc/pthreads/pthread_rwlock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -60,7 +60,7 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, pthread_mutex_init(&(rwlock->rw_mutex), NULL); pthread_cond_init(&(rwlock->rw_condreaders), NULL); pthread_cond_init(&(rwlock->rw_condwriters), NULL); - + rwlock->rw_nwaitwriters = 0; rwlock->rw_nwaitreaders = 0; rwlock->rw_refcount = 0; @@ -117,7 +117,7 @@ int pthread_rwlock_destroy (pthread_rwlock_t *rwlock) pthread_mutex_unlock(&rwlock->rw_mutex); if (result == 0) pthread_mutex_destroy(&rwlock->rw_mutex); - + return result; } RTM_EXPORT(pthread_rwlock_destroy); @@ -234,7 +234,7 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, result = pthread_cond_timedwait(&rwlock->rw_condwriters, &rwlock->rw_mutex, abstime); /* rw_mutex should have been taken again when returned from waiting */ rwlock->rw_nwaitwriters--; - + if (result != 0) break; } @@ -324,7 +324,7 @@ int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) result = pthread_cond_wait(&rwlock->rw_condwriters, &rwlock->rw_mutex); /* rw_mutex should have been taken again when returned from waiting */ rwlock->rw_nwaitwriters--; - + if (result != 0) break; } diff --git a/components/libc/pthreads/pthread_spin.c b/components/libc/pthreads/pthread_spin.c index b31f4f639..3f3dc1593 100644 --- a/components/libc/pthreads/pthread_spin.c +++ b/components/libc/pthreads/pthread_spin.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/pthread_tls.c b/components/libc/pthreads/pthread_tls.c index 4b97d796d..d48df7f2d 100644 --- a/components/libc/pthreads/pthread_tls.c +++ b/components/libc/pthreads/pthread_tls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/sched.c b/components/libc/pthreads/sched.c index a1bf50985..5f2a53c01 100644 --- a/components/libc/pthreads/sched.c +++ b/components/libc/pthreads/sched.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/sched.h b/components/libc/pthreads/sched.h index dbaf66edc..07e2c0c6a 100644 --- a/components/libc/pthreads/sched.h +++ b/components/libc/pthreads/sched.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/pthreads/semaphore.c b/components/libc/pthreads/semaphore.c index 2bef10022..398cdf1f4 100644 --- a/components/libc/pthreads/semaphore.c +++ b/components/libc/pthreads/semaphore.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -64,7 +64,7 @@ static sem_t *posix_sem_find(const char* name) for (iter = posix_sem_list; iter != RT_NULL; iter = iter->next) { - object = (rt_object_t)&(iter->sem); + object = (rt_object_t)iter->sem; if (strncmp(object->name, name, RT_NAME_MAX) == 0) { diff --git a/components/libc/pthreads/semaphore.h b/components/libc/pthreads/semaphore.h index d135ae926..872226e38 100644 --- a/components/libc/pthreads/semaphore.h +++ b/components/libc/pthreads/semaphore.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/signal/posix_signal.c b/components/libc/signal/posix_signal.c index c0dd90e63..b06fe1268 100644 --- a/components/libc/signal/posix_signal.c +++ b/components/libc/signal/posix_signal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/signal/posix_signal.h b/components/libc/signal/posix_signal.h index 896d6b6da..fa8ad38fa 100644 --- a/components/libc/signal/posix_signal.h +++ b/components/libc/signal/posix_signal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/termios/posix_termios.c b/components/libc/termios/posix_termios.c index 75c876dd3..01ba010c8 100644 --- a/components/libc/termios/posix_termios.c +++ b/components/libc/termios/posix_termios.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2017/08/30 Bernard The first version + * 2017/08/30 Bernard The first version */ #include #include @@ -111,13 +111,6 @@ int tcdrain(int fd) return 0; } -int isatty (int fd) -{ - struct termios term; - - return tcgetattr (fd, &term) == 0; -} - #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) void cfmakeraw(struct termios *t) { diff --git a/components/libc/termios/posix_termios.h b/components/libc/termios/posix_termios.h index 4f556d79d..5bd1999b0 100644 --- a/components/libc/termios/posix_termios.h +++ b/components/libc/termios/posix_termios.h @@ -1,16 +1,17 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2017/08/30 Bernard The first version + * 2017/08/30 Bernard The first version */ #ifndef TERMIOS_H__ #define TERMIOS_H__ #include +#include #ifdef __cplusplus extern "C" { diff --git a/components/libc/time/clock_time.c b/components/libc/time/clock_time.c index 83b3b916c..f74e11724 100644 --- a/components/libc/time/clock_time.c +++ b/components/libc/time/clock_time.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2012-12-08 Bernard fix the issue of _timevalue.tv_usec initialization, + * 2012-12-08 Bernard fix the issue of _timevalue.tv_usec initialization, * which found by Rob */ diff --git a/components/libc/time/clock_time.h b/components/libc/time/clock_time.h index 7feb0390a..aef3ed213 100644 --- a/components/libc/time/clock_time.h +++ b/components/libc/time/clock_time.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/libc/time/posix_sleep.c b/components/libc/time/posix_sleep.c index f21b0a799..af05b1b9a 100644 --- a/components/libc/time/posix_sleep.c +++ b/components/libc/time/posix_sleep.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/Kconfig b/components/net/Kconfig index 4436934f0..77055d73b 100644 --- a/components/net/Kconfig +++ b/components/net/Kconfig @@ -118,8 +118,9 @@ config RT_USING_LWIP config RT_USING_LWIP202 bool "lwIP v2.0.2" - config RT_USING_LWIP210 - bool "lwIP v2.1.0" + config RT_USING_LWIP212 + bool "lwIP v2.1.2" + endchoice if (RT_USING_LWIP210 || RT_USING_LWIP202) diff --git a/components/net/SConscript b/components/net/SConscript index 0c59cd1c3..2012e6fbf 100644 --- a/components/net/SConscript +++ b/components/net/SConscript @@ -8,7 +8,7 @@ cwd = GetCurrentDir() list = os.listdir(cwd) # the default version of LWIP is 2.0.2 -if not GetDepend('RT_USING_LWIP141') and not GetDepend('RT_USING_LWIP202') and not GetDepend('RT_USING_LWIP210'): +if not GetDepend('RT_USING_LWIP141') and not GetDepend('RT_USING_LWIP202') and not GetDepend('RT_USING_LWIP212'): AddDepend('RT_USING_LWIP202') for d in list: diff --git a/components/net/at/Kconfig b/components/net/at/Kconfig index 50de00554..4aedbb888 100644 --- a/components/net/at/Kconfig +++ b/components/net/at/Kconfig @@ -75,16 +75,16 @@ if RT_USING_AT default n config AT_CMD_MAX_LEN - int "The maximum lenght of AT Commonds buffer" + int "The maximum length of AT Commands buffer" default 128 endif config AT_SW_VERSION_NUM hex - default 0x10300 + default 0x10301 help - sfotware module version number + software module version number endif diff --git a/components/net/at/at_socket/at_socket.c b/components/net/at/at_socket/at_socket.c index 11be4e23c..6d4c04085 100644 --- a/components/net/at/at_socket/at_socket.c +++ b/components/net/at/at_socket/at_socket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -70,8 +70,8 @@ struct at_socket *at_get_socket(int socket) return at_sock; } } - } - + } + rt_hw_interrupt_enable(level); return RT_NULL; @@ -289,7 +289,7 @@ static int alloc_empty_socket(rt_slist_t *l) rt_slist_for_each(node, &_socket_list) { at_sock = rt_slist_entry(node, struct at_socket, list); - if(at_sock->socket != idx) + if(at_sock->socket != idx) break; idx++; pre_node = node; @@ -302,7 +302,7 @@ static int alloc_empty_socket(rt_slist_t *l) return idx; } -static struct at_socket *alloc_socket_by_device(struct at_device *device) +static struct at_socket *alloc_socket_by_device(struct at_device *device, enum at_socket_type type) { static rt_mutex_t at_slock = RT_NULL; struct at_socket *sock = RT_NULL; @@ -323,10 +323,17 @@ static struct at_socket *alloc_socket_by_device(struct at_device *device) rt_mutex_take(at_slock, RT_WAITING_FOREVER); /* find an empty at socket entry */ - for (idx = 0; idx < device->class->socket_num && device->sockets[idx].magic; idx++); + if (device->class->socket_ops->at_socket != RT_NULL) + { + idx = device->class->socket_ops->at_socket(device, type); + } + else + { + for (idx = 0; idx < device->class->socket_num && device->sockets[idx].magic; idx++); + } /* can't find an empty protocol family entry */ - if (idx == device->class->socket_num) + if (idx < 0 || idx >= device->class->socket_num) { goto __err; } @@ -374,7 +381,7 @@ static struct at_socket *alloc_socket_by_device(struct at_device *device) return RT_NULL; } -static struct at_socket *alloc_socket(void) +static struct at_socket *alloc_socket(enum at_socket_type type) { extern struct netdev *netdev_default; struct netdev *netdev = RT_NULL; @@ -401,9 +408,12 @@ static struct at_socket *alloc_socket(void) return RT_NULL; } - return alloc_socket_by_device(device); + return alloc_socket_by_device(device, type); } +static void at_recv_notice_cb(struct at_socket *sock, at_socket_evt_t event, const char *buff, size_t bfsz); +static void at_closed_notice_cb(struct at_socket *sock, at_socket_evt_t event, const char *buff, size_t bfsz); + int at_socket(int domain, int type, int protocol) { struct at_socket *sock = RT_NULL; @@ -430,7 +440,7 @@ int at_socket(int domain, int type, int protocol) } /* allocate and initialize a new AT socket */ - sock = alloc_socket(); + sock = alloc_socket(socket_type); if (sock == RT_NULL) { return -1; @@ -438,6 +448,10 @@ int at_socket(int domain, int type, int protocol) sock->type = socket_type; sock->state = AT_SOCKET_OPEN; + /* set AT socket receive data callback function */ + sock->ops->at_set_event_cb(AT_SOCKET_EVT_RECV, at_recv_notice_cb); + sock->ops->at_set_event_cb(AT_SOCKET_EVT_CLOSED, at_closed_notice_cb); + return sock->socket; } @@ -494,7 +508,7 @@ int at_closesocket(int socket) /* deal with TCP server actively disconnect */ rt_thread_delay(rt_tick_from_millisecond(100)); - + sock = at_get_socket(socket); if (sock == RT_NULL) { @@ -515,7 +529,7 @@ int at_closesocket(int socket) } } - free_socket(sock); + free_socket(sock); return 0; } @@ -589,7 +603,7 @@ int at_bind(int socket, const struct sockaddr *name, socklen_t namelen) /* input ip address is different from device ip address */ if (ip_addr_cmp(&input_ipaddr, &local_ipaddr) == 0) - { + { struct at_socket *new_sock = RT_NULL; struct at_device *new_device = RT_NULL; enum at_socket_type type = sock->type; @@ -599,7 +613,7 @@ int at_bind(int socket, const struct sockaddr *name, socklen_t namelen) { return -1; } - + extern struct at_device *at_device_get_by_ipaddr(ip_addr_t *ip_addr); new_device = at_device_get_by_ipaddr(&input_ipaddr); if (new_device == RT_NULL) @@ -608,7 +622,7 @@ int at_bind(int socket, const struct sockaddr *name, socklen_t namelen) } /* allocate new socket */ - new_sock = alloc_socket_by_device(new_device); + new_sock = alloc_socket_by_device(new_device, type); if (new_sock == RT_NULL) { return -1; @@ -635,7 +649,7 @@ static void at_recv_notice_cb(struct at_socket *sock, at_socket_evt_t event, con { RT_ASSERT(buff); RT_ASSERT(event == AT_SOCKET_EVT_RECV); - + /* check the socket object status */ if (sock->magic != AT_SOCKET_MAGIC) { @@ -661,7 +675,7 @@ static void at_closed_notice_cb(struct at_socket *sock, at_socket_evt_t event, c { return; } - + at_do_event_changes(sock, AT_EVENT_RECV, RT_TRUE); at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE); @@ -703,10 +717,6 @@ int at_connect(int socket, const struct sockaddr *name, socklen_t namelen) sock->state = AT_SOCKET_CONNECT; - /* set AT socket receive data callback function */ - sock->ops->at_set_event_cb(AT_SOCKET_EVT_RECV, at_recv_notice_cb); - sock->ops->at_set_event_cb(AT_SOCKET_EVT_CLOSED, at_closed_notice_cb); - __exit: if (result < 0) @@ -721,7 +731,7 @@ int at_connect(int socket, const struct sockaddr *name, socklen_t namelen) { at_do_event_changes(sock, AT_EVENT_SEND, RT_TRUE); } - + return result; } @@ -744,7 +754,7 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f goto __exit; } - /* if the socket type is UDP, nead to connect socket first */ + /* if the socket type is UDP, need to connect socket first */ if (from && sock->type == AT_SOCKET_UDP && sock->state == AT_SOCKET_OPEN) { ip_addr_t remote_addr; @@ -760,9 +770,6 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f goto __exit; } sock->state = AT_SOCKET_CONNECT; - /* set AT socket receive data callback function */ - sock->ops->at_set_event_cb(AT_SOCKET_EVT_RECV, at_recv_notice_cb); - sock->ops->at_set_event_cb(AT_SOCKET_EVT_CLOSED, at_closed_notice_cb); } /* receive packet list last transmission of remaining data */ @@ -773,7 +780,7 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f goto __exit; } rt_mutex_release(sock->recv_lock); - + /* socket passively closed, receive function return 0 */ if (sock->state == AT_SOCKET_CLOSED) { @@ -815,23 +822,16 @@ int at_recvfrom(int socket, void *mem, size_t len, int flags, struct sockaddr *f } else { - if (sock->state == AT_SOCKET_CONNECT) - { - /* get receive buffer to receiver ring buffer */ - rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER); - recv_len = at_recvpkt_get(&(sock->recvpkt_list), (char *) mem, len); - rt_mutex_release(sock->recv_lock); - if (recv_len > 0) - { - break; - } - } - else + + /* get receive buffer to receiver ring buffer */ + rt_mutex_take(sock->recv_lock, RT_WAITING_FOREVER); + recv_len = at_recvpkt_get(&(sock->recvpkt_list), (char *) mem, len); + rt_mutex_release(sock->recv_lock); + if (recv_len > 0) { - LOG_D("received data exit, current socket (%d) is closed by remote.", socket); - result = 0; - goto __exit; + break; } + } } @@ -924,9 +924,6 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct goto __exit; } sock->state = AT_SOCKET_CONNECT; - /* set AT socket receive data callback function */ - sock->ops->at_set_event_cb(AT_SOCKET_EVT_RECV, at_recv_notice_cb); - sock->ops->at_set_event_cb(AT_SOCKET_EVT_CLOSED, at_closed_notice_cb); } if ((len = sock->ops->at_send(sock, (char *) data, size, sock->type)) < 0) @@ -948,7 +945,7 @@ int at_sendto(int socket, const void *data, size_t size, int flags, const struct { if (sock != RT_NULL) { - at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE); + at_do_event_changes(sock, AT_EVENT_ERROR, RT_TRUE); } } else @@ -1141,13 +1138,13 @@ struct hostent *at_gethostbyname(const char *name) #if NETDEV_IPV4 && NETDEV_IPV6 addr.u_addr.ip4.addr = ipstr_to_u32(ipstr); - addr.type = IPADDR_TYPE_V4; + addr.type = IPADDR_TYPE_V4; #elif NETDEV_IPV4 addr.addr = ipstr_to_u32(ipstr); #elif NETDEV_IPV6 #error "not support IPV6." #endif /* NETDEV_IPV4 && NETDEV_IPV6 */ - + /* fill hostent structure */ s_hostent_addr = addr; s_phostent_addr[0] = &s_hostent_addr; @@ -1246,8 +1243,8 @@ int at_getaddrinfo(const char *nodename, const char *servname, { strncpy(ip_str, nodename, strlen(nodename)); } - - #if NETDEV_IPV4 && NETDEV_IPV6 + + #if NETDEV_IPV4 && NETDEV_IPV6 addr.type = IPADDR_TYPE_V4; if ((addr.u_addr.ip4.addr = ipstr_to_u32(ip_str)) == 0) { @@ -1257,7 +1254,7 @@ int at_getaddrinfo(const char *nodename, const char *servname, addr.addr = ipstr_to_u32(ip_str); #elif NETDEV_IPV6 #error "not support IPV6." - #endif /* NETDEV_IPV4 && NETDEV_IPV6 */ + #endif /* NETDEV_IPV4 && NETDEV_IPV6 */ } } else diff --git a/components/net/at/at_socket/at_socket.h b/components/net/at/at_socket/at_socket.h index d98fa05f2..caac6d2d5 100644 --- a/components/net/at/at_socket/at_socket.h +++ b/components/net/at/at_socket/at_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -56,6 +56,7 @@ typedef enum } at_socket_evt_t; struct at_socket; +struct at_device; typedef void (*at_evt_cb_t)(struct at_socket *socket, at_socket_evt_t event, const char *buff, size_t bfsz); @@ -70,6 +71,7 @@ struct at_socket_ops int (*at_send)(struct at_socket *socket, const char *buff, size_t bfsz, enum at_socket_type type); int (*at_domain_resolve)(const char *name, char ip[16]); void (*at_set_event_cb)(at_socket_evt_t event, at_evt_cb_t cb); + int (*at_socket)(struct at_device *device, enum at_socket_type type); }; /* AT receive package list structure */ diff --git a/components/net/at/include/at.h b/components/net/at/include/at.h index a7a6aeca7..7d9de6b35 100644 --- a/components/net/at/include/at.h +++ b/components/net/at/include/at.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -18,7 +18,7 @@ extern "C" { #endif -#define AT_SW_VERSION "1.3.0" +#define AT_SW_VERSION "1.3.1" #define AT_CMD_NAME_LEN 16 #define AT_END_MARK_LEN 4 diff --git a/components/net/at/include/at_log.h b/components/net/at/include/at_log.h index 9e133561f..acb5b34ec 100644 --- a/components/net/at/include/at_log.h +++ b/components/net/at/include/at_log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/at/src/at_base_cmd.c b/components/net/at/src/at_base_cmd.c index b182477f9..00720c87b 100644 --- a/components/net/at/src/at_base_cmd.c +++ b/components/net/at/src/at_base_cmd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/at/src/at_cli.c b/components/net/at/src/at_cli.c index e39a91335..25fbb708f 100644 --- a/components/net/at/src/at_cli.c +++ b/components/net/at/src/at_cli.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,7 +27,7 @@ static rt_err_t (*odev_rx_ind)(rt_device_t dev, rt_size_t size) = RT_NULL; #ifdef AT_USING_CLIENT static struct rt_semaphore client_rx_notice; static struct rt_ringbuffer *client_rx_fifo = RT_NULL; -#endif +#endif static char console_getchar(void) { diff --git a/components/net/at/src/at_client.c b/components/net/at/src/at_client.c index ba4009738..d636460c2 100644 --- a/components/net/at/src/at_client.c +++ b/components/net/at/src/at_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -434,18 +434,20 @@ static rt_err_t at_client_getchar(at_client_t client, char *ch, rt_int32_t timeo { rt_err_t result = RT_EOK; - while (rt_device_read(client->device, 0, ch, 1) == 0) +__retry: + result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); + if (result != RT_EOK) { - rt_sem_control(client->rx_notice, RT_IPC_CMD_RESET, RT_NULL); - - result = rt_sem_take(client->rx_notice, rt_tick_from_millisecond(timeout)); - if (result != RT_EOK) - { - return result; - } + return result; + } + if(rt_device_read(client->device, 0, ch, 1) == 1) + { + return RT_EOK; + } + else + { + goto __retry; } - - return RT_EOK; } /** @@ -577,7 +579,7 @@ int at_obj_set_urc_table(at_client_t client, const struct at_urc *urc_table, rt_ client->urc_table[client->urc_table_size].urc = urc_table; client->urc_table[client->urc_table_size].urc_size = table_sz; client->urc_table_size++; - + rt_free(old_urc_table); } @@ -917,6 +919,11 @@ int at_client_init(const char *dev_name, rt_size_t recv_bufsz) RT_ASSERT(dev_name); RT_ASSERT(recv_bufsz > 0); + if (at_client_get(dev_name) != RT_NULL) + { + return result; + } + for (idx = 0; idx < AT_CLIENT_NUM_MAX && at_client_table[idx].device; idx++); if (idx >= AT_CLIENT_NUM_MAX) diff --git a/components/net/at/src/at_server.c b/components/net/at/src/at_server.c index 81d00951f..bfbbbae2d 100644 --- a/components/net/at/src/at_server.c +++ b/components/net/at/src/at_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/at/src/at_utils.c b/components/net/at/src/at_utils.c index 7d26425f5..8d8887fe5 100644 --- a/components/net/at/src/at_utils.c +++ b/components/net/at/src/at_utils.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h index 06c0be667..251de6697 100644 --- a/components/net/lwip-1.4.1/src/arch/include/arch/cc.h +++ b/components/net/lwip-1.4.1/src/arch/include/arch/cc.h @@ -66,7 +66,7 @@ typedef uintptr_t mem_ptr_t; #endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */ #endif -#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) +#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include #define LWIP_TIMEVAL_PRIVATE 0 #else @@ -78,6 +78,11 @@ typedef uintptr_t mem_ptr_t; #define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) #define PACK_STRUCT_BEGIN #define PACK_STRUCT_END +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /*Arm Compiler 6*/ +#define PACK_STRUCT_FIELD(x) x +#define PACK_STRUCT_STRUCT __attribute__((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END #elif defined(__IAR_SYSTEMS_ICC__) /* IAR Compiler */ #define PACK_STRUCT_BEGIN #define PACK_STRUCT_STRUCT diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c index c31bd59c1..b411563f3 100644 --- a/components/net/lwip-1.4.1/src/arch/sys_arch.c +++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (C) 2006-2018, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -27,11 +27,12 @@ * Change Logs: * Date Author Notes * 2012-12-8 Bernard add file header - * export bsd socket symbol for RT-Thread Application Module + * export bsd socket symbol for RT-Thread Application Module * 2017-11-15 Bernard add lock for init_done callback. */ #include +#include #include "lwip/sys.h" #include "lwip/opt.h" @@ -194,9 +195,9 @@ int lwip_system_init(void) netifapi_netif_set_addr(netif_default, &ipaddr, &netmask, &gw); } #endif - rt_kprintf("lwIP-%d.%d.%d initialized!\n", LWIP_VERSION_MAJOR, LWIP_VERSION_MINOR, LWIP_VERSION_REVISION); + rt_kprintf("lwIP-%d.%d.%d initialized!\n", LWIP_VERSION_MAJOR, LWIP_VERSION_MINOR, LWIP_VERSION_REVISION); - return 0; + return 0; } INIT_PREV_EXPORT(lwip_system_init); @@ -259,7 +260,7 @@ void sys_sem_signal(sys_sem_t *sem) * * @return If the timeout argument is non-zero, it will return the number of milliseconds * spent waiting for the semaphore to be signaled; If the semaphore isn't signaled - * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't + * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't * wait for the semaphore, it will return zero */ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) @@ -498,14 +499,10 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) } ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t); - if(ret == -RT_ETIMEOUT) + if(ret != RT_EOK) { return SYS_ARCH_TIMEOUT; } - else - { - LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK); - } /* get elapse msecond */ tick = rt_tick_get() - tick; @@ -536,7 +533,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) } else { - if (ret == RT_EOK) + if (ret == RT_EOK) ret = 1; } @@ -621,7 +618,7 @@ u32_t sys_jiffies(void) u32_t sys_now(void) { - return rt_tick_get() * (1000 / RT_TICK_PER_SECOND); + return rt_tick_get() * (1000 / RT_TICK_PER_SECOND); } #ifdef RT_LWIP_PPP diff --git a/components/net/lwip-1.4.1/src/core/snmp/msg_out.c b/components/net/lwip-1.4.1/src/core/snmp/msg_out.c index 485f076a5..d5f093763 100644 --- a/components/net/lwip-1.4.1/src/core/snmp/msg_out.c +++ b/components/net/lwip-1.4.1/src/core/snmp/msg_out.c @@ -306,7 +306,7 @@ snmp_authfail_trap(void) * * @param vb_len varbind-list length * @param rhl points to returned header lengths - * @return the required lenght for encoding the response header + * @return the required length for encoding the response header */ static u16_t snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len) @@ -353,7 +353,7 @@ snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len) * * @param vb_len varbind-list length * @param thl points to returned header lengths - * @return the required lenght for encoding the trap header + * @return the required length for encoding the trap header */ static u16_t snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len) diff --git a/components/net/lwip-1.4.1/src/netif/ethernetif.c b/components/net/lwip-1.4.1/src/netif/ethernetif.c index 9d8fa650a..052ee1bb0 100644 --- a/components/net/lwip-1.4.1/src/netif/ethernetif.c +++ b/components/net/lwip-1.4.1/src/netif/ethernetif.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * COPYRIGHT (C) 2006-2010, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -59,9 +59,9 @@ #define netifapi_netif_set_link_down(n) netifapi_netif_common(n, netif_set_link_down, NULL) #ifndef RT_LWIP_ETHTHREAD_PRIORITY -#define RT_ETHERNETIF_THREAD_PREORITY 0x90 +#define RT_ETHERNETIF_THREAD_PREORITY 0x90 #else -#define RT_ETHERNETIF_THREAD_PREORITY RT_LWIP_ETHTHREAD_PRIORITY +#define RT_ETHERNETIF_THREAD_PREORITY RT_LWIP_ETHTHREAD_PRIORITY #endif #ifndef LWIP_NO_TX_THREAD @@ -70,8 +70,8 @@ */ struct eth_tx_msg { - struct netif *netif; - struct pbuf *buf; + struct netif *netif; + struct pbuf *buf; }; static struct rt_mailbox eth_tx_thread_mb; @@ -156,6 +156,16 @@ static int lwip_netdev_set_dns_server(struct netdev *netif, uint8_t dns_num, ip_ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) { netdev_low_level_set_dhcp_status(netif, is_enabled); + + if(RT_TRUE == is_enabled) + { + dhcp_start((struct netif *)netif->user_data); + } + else + { + dhcp_stop((struct netif *)netif->user_data); + } + return ERR_OK; } #endif /* RT_LWIP_DHCP */ @@ -165,7 +175,7 @@ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) extern int lwip_ping_recv(int s, int *ttl); extern err_t lwip_ping_send(int s, ip_addr_t *addr, int size); -int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, +int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp) { int s, ttl, recv_len, result = 0; @@ -180,7 +190,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, struct addrinfo hint, *res = RT_NULL; struct sockaddr_in *h = RT_NULL; struct in_addr ina; - + RT_ASSERT(netif); RT_ASSERT(host); RT_ASSERT(ping_resp); @@ -199,7 +209,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, return -RT_ERROR; } rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t)); - + /* new a socket */ if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0) { @@ -267,7 +277,7 @@ const struct netdev_ops lwip_netdev_ops = lwip_netdev_set_addr_info, #ifdef RT_LWIP_DNS lwip_netdev_set_dns_server, -#else +#else NULL, #endif /* RT_LWIP_DNS */ @@ -315,7 +325,7 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); - + /* Update netdev info after registered */ netdev->flags = lwip_netif->flags; netdev->mtu = lwip_netif->mtu; @@ -325,7 +335,7 @@ static int netdev_add(struct netif *lwip_netif) netdev->ip_addr = lwip_netif->ip_addr; netdev->gw = lwip_netif->gw; netdev->netmask = lwip_netif->netmask; - + #ifdef RT_LWIP_DHCP netdev_low_level_set_dhcp_status(netdev, RT_TRUE); #endif @@ -358,7 +368,7 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p) struct eth_tx_msg msg; struct eth_device* enetif; - RT_ASSERT(netif != RT_NULL); + RT_ASSERT(netif != RT_NULL); enetif = (struct eth_device*)netif->state; /* send a message to eth tx thread */ @@ -372,13 +382,13 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p) #else struct eth_device* enetif; - RT_ASSERT(netif != RT_NULL); + RT_ASSERT(netif != RT_NULL); enetif = (struct eth_device*)netif->state; - if (enetif->eth_tx(&(enetif->parent), p) != RT_EOK) - { - return ERR_IF; - } + if (enetif->eth_tx(&(enetif->parent), p) != RT_EOK) + { + return ERR_IF; + } #endif return ERR_OK; } @@ -441,13 +451,12 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ { struct netif* netif; - netif = (struct netif*) rt_malloc (sizeof(struct netif)); + netif = (struct netif*) rt_calloc (1, sizeof(struct netif)); if (netif == RT_NULL) { rt_kprintf("malloc netif failed\n"); return -RT_ERROR; } - rt_memset(netif, 0, sizeof(struct netif)); /* set netif */ dev->netif = netif; @@ -465,16 +474,16 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ netif->name[1] = name[1]; /* set hw address to 6 */ - netif->hwaddr_len = 6; + netif->hwaddr_len = 6; /* maximum transfer unit */ - netif->mtu = ETHERNET_MTU; + netif->mtu = ETHERNET_MTU; /* get hardware MAC address */ rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); /* set output */ - netif->output = etharp_output; - netif->linkoutput = ethernetif_linkoutput; + netif->output = etharp_output; + netif->linkoutput = ethernetif_linkoutput; /* if tcp thread has been started up, we add this netif to the system */ if (rt_thread_find("tcpip") != RT_NULL) @@ -556,12 +565,12 @@ rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up) /* NOTE: please not use it in interrupt when no RxThread exist */ rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up) { - if (up == RT_TRUE) - netifapi_netif_set_link_up(dev->netif); - else - netifapi_netif_set_link_down(dev->netif); + if (up == RT_TRUE) + netifapi_netif_set_link_up(dev->netif); + else + netifapi_netif_set_link_down(dev->netif); - return RT_EOK; + return RT_EOK; } #endif @@ -629,8 +638,8 @@ static void eth_rx_thread_entry(void* parameter) /* receive all of buffer */ while (1) { - if(device->eth_rx == RT_NULL) break; - + if(device->eth_rx == RT_NULL) break; + p = device->eth_rx(&(device->parent)); if (p != RT_NULL) { diff --git a/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c b/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c index 129cc7da1..e14e34cfe 100644 --- a/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c +++ b/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c @@ -1,21 +1,7 @@ /* - * File : tftp_port.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h index 9663935da..ea6a5ff75 100644 --- a/components/net/lwip-2.0.2/src/arch/include/arch/cc.h +++ b/components/net/lwip-2.0.2/src/arch/include/arch/cc.h @@ -45,7 +45,7 @@ #define S32_F "ld" #define X32_F "lx" -#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) +#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include #define LWIP_TIMEVAL_PRIVATE 0 #else @@ -57,6 +57,11 @@ #define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) #define PACK_STRUCT_BEGIN #define PACK_STRUCT_END +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /*Arm Compiler 6*/ +#define PACK_STRUCT_FIELD(x) x +#define PACK_STRUCT_STRUCT __attribute__((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END #elif defined(__IAR_SYSTEMS_ICC__) /* IAR Compiler */ #define PACK_STRUCT_BEGIN #define PACK_STRUCT_STRUCT diff --git a/components/net/lwip-2.0.2/src/arch/sys_arch.c b/components/net/lwip-2.0.2/src/arch/sys_arch.c index b2abaeab5..b0d4709c9 100644 --- a/components/net/lwip-2.0.2/src/arch/sys_arch.c +++ b/components/net/lwip-2.0.2/src/arch/sys_arch.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (C) 2006-2018, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -27,11 +27,12 @@ * Change Logs: * Date Author Notes * 2012-12-8 Bernard add file header - * export bsd socket symbol for RT-Thread Application Module + * export bsd socket symbol for RT-Thread Application Module * 2017-11-15 Bernard add lock for init_done callback. */ #include +#include #include "lwip/sys.h" #include "lwip/opt.h" @@ -270,7 +271,7 @@ void sys_sem_signal(sys_sem_t *sem) * * @return If the timeout argument is non-zero, it will return the number of milliseconds * spent waiting for the semaphore to be signaled; If the semaphore isn't signaled - * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't + * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't * wait for the semaphore, it will return zero */ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) @@ -509,12 +510,9 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) } ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t); - - if(ret == -RT_ETIMEOUT) - return SYS_ARCH_TIMEOUT; - else + if(ret != RT_EOK) { - LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK); + return SYS_ARCH_TIMEOUT; } /* get elapse msecond */ @@ -545,7 +543,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) return SYS_ARCH_TIMEOUT; else { - if (ret == RT_EOK) + if (ret == RT_EOK) ret = 1; } diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c index a7bed3065..b49125c19 100644 --- a/components/net/lwip-2.0.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * COPYRIGHT (C) 2006-2018, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -164,6 +164,16 @@ static int lwip_netdev_set_dns_server(struct netdev *netif, uint8_t dns_num, ip_ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) { netdev_low_level_set_dhcp_status(netif, is_enabled); + + /*add dhcp start or stop must call dhcp_start and dhcp_stop function*/ + if(is_enabled == RT_TRUE) + { + dhcp_start((struct netif *)netif->user_data); + } + else + { + dhcp_stop((struct netif *)netif->user_data); + } return ERR_OK; } #endif /* RT_LWIP_DHCP */ @@ -173,7 +183,7 @@ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) extern int lwip_ping_recv(int s, int *ttl); extern err_t lwip_ping_send(int s, ip_addr_t *addr, int size); -int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, +int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp) { int s, ttl, recv_len, result = 0; @@ -188,7 +198,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, struct addrinfo hint, *res = RT_NULL; struct sockaddr_in *h = RT_NULL; struct in_addr ina; - + RT_ASSERT(netif); RT_ASSERT(host); RT_ASSERT(ping_resp); @@ -207,7 +217,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, return -RT_ERROR; } rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t)); - + /* new a socket */ if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0) { @@ -275,7 +285,7 @@ const struct netdev_ops lwip_netdev_ops = lwip_netdev_set_addr_info, #ifdef RT_LWIP_DNS lwip_netdev_set_dns_server, -#else +#else NULL, #endif /* RT_LWIP_DNS */ @@ -323,8 +333,8 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); - - /* Update netdev info after registered */ + + /* Update netdev info after registered */ netdev->flags = lwip_netif->flags; netdev->mtu = lwip_netif->mtu; netdev->ops = &lwip_netdev_ops; @@ -333,7 +343,7 @@ static int netdev_add(struct netif *lwip_netif) netdev->ip_addr = lwip_netif->ip_addr; netdev->gw = lwip_netif->gw; netdev->netmask = lwip_netif->netmask; - + #ifdef RT_LWIP_DHCP netdev_low_level_set_dhcp_status(netdev, RT_TRUE); #endif @@ -412,7 +422,7 @@ static err_t eth_netif_device_init(struct netif *netif) /* network interface device register */ netdev_add(netif); #endif /* RT_USING_NETDEV */ - + ethif = (struct eth_device*)netif->state; if (ethif != RT_NULL) { @@ -531,7 +541,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ ipaddr.addr = inet_addr(RT_LWIP_IPADDR); gw.addr = inet_addr(RT_LWIP_GWADDR); netmask.addr = inet_addr(RT_LWIP_MSKADDR); -#else +#else IP4_ADDR(&ipaddr, 0, 0, 0, 0); IP4_ADDR(&gw, 0, 0, 0, 0); IP4_ADDR(&netmask, 0, 0, 0, 0); @@ -683,7 +693,7 @@ static void eth_rx_thread_entry(void* parameter) while (1) { if(device->eth_rx == RT_NULL) break; - + p = device->eth_rx(&(device->parent)); if (p != RT_NULL) { @@ -706,9 +716,9 @@ static void eth_rx_thread_entry(void* parameter) } #endif -/* this function does not need, - * use eth_system_device_init_private() - * call by lwip_system_init(). +/* this function does not need, + * use eth_system_device_init_private() + * call by lwip_system_init(). */ int eth_system_device_init(void) { @@ -851,27 +861,27 @@ void list_if(void) rt_kprintf("gw address: %s\n", ipaddr_ntoa(&(netif->gw))); rt_kprintf("net mask : %s\n", ipaddr_ntoa(&(netif->netmask))); #if LWIP_IPV6 - { - ip6_addr_t *addr; - int addr_state; - int i; - - addr = (ip6_addr_t *)&netif->ip6_addr[0]; - addr_state = netif->ip6_addr_state[0]; - - rt_kprintf("\nipv6 link-local: %s state:%02X %s\n", ip6addr_ntoa(addr), - addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); - - for(i=1; iip6_addr[i]; - addr_state = netif->ip6_addr_state[i]; - - rt_kprintf("ipv6[%d] address: %s state:%02X %s\n", i, ip6addr_ntoa(addr), - addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); - } - - } + { + ip6_addr_t *addr; + int addr_state; + int i; + + addr = (ip6_addr_t *)&netif->ip6_addr[0]; + addr_state = netif->ip6_addr_state[0]; + + rt_kprintf("\nipv6 link-local: %s state:%02X %s\n", ip6addr_ntoa(addr), + addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); + + for(i=1; iip6_addr[i]; + addr_state = netif->ip6_addr_state[i]; + + rt_kprintf("ipv6[%d] address: %s state:%02X %s\n", i, ip6addr_ntoa(addr), + addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); + } + + } rt_kprintf("\r\n"); #endif /* LWIP_IPV6 */ netif = netif->next; diff --git a/components/net/lwip-2.1.0/READTEST.md b/components/net/lwip-2.1.0/READTEST.md deleted file mode 100644 index 6bdebeb11..000000000 --- a/components/net/lwip-2.1.0/READTEST.md +++ /dev/null @@ -1,12 +0,0 @@ -Porting network interface device for RT-Thread in lwIP. -The major jobs following RT-Thread Team. The RT-Thread network interface device need to synchronize some network status and address information in lwIP, so it need to make some changes in the lwIP netwrok status and address operations function. -The specific changes are as follows: - - - netif.c: add RT-Thread netdev header file , status synchronize(UP, LINK_UP), address synchronize(IP, netmask, gateway); - - - dns.c: add RT-Thread header file, dns servers synchronize; - - - sockets.c: custom 'select' function implementation in RT-Thread by the wait queue mode. - -by ChenYong 2019/3/26 10:00 AM -chenyong@rt-thread.com diff --git a/components/net/lwip-2.1.0/doc/FILES b/components/net/lwip-2.1.0/doc/FILES deleted file mode 100644 index e58857508..000000000 --- a/components/net/lwip-2.1.0/doc/FILES +++ /dev/null @@ -1,9 +0,0 @@ -doxygen/ - Configuration files and scripts to create the lwIP doxygen source - documentation (found at http://www.nongnu.org/lwip/) - -savannah.txt - How to obtain the current development source code. -contrib.txt - How to contribute to lwIP as a developer. -rawapi.txt - The documentation for the core API of lwIP. - Also provides an overview about the other APIs and multithreading. -sys_arch.txt - The documentation for a system abstraction layer of lwIP. -ppp.txt - Documentation of the PPP interface for lwIP. diff --git a/components/net/lwip-2.1.0/doc/NO_SYS_SampleCode.c b/components/net/lwip-2.1.0/doc/NO_SYS_SampleCode.c deleted file mode 100644 index 71f1c9f7f..000000000 --- a/components/net/lwip-2.1.0/doc/NO_SYS_SampleCode.c +++ /dev/null @@ -1,122 +0,0 @@ -void -eth_mac_irq() -{ - /* Service MAC IRQ here */ - - /* Allocate pbuf from pool (avoid using heap in interrupts) */ - struct pbuf* p = pbuf_alloc(PBUF_RAW, eth_data_count, PBUF_POOL); - - if(p != NULL) { - /* Copy ethernet frame into pbuf */ - pbuf_take(p, eth_data, eth_data_count); - - /* Put in a queue which is processed in main loop */ - if(!queue_try_put(&queue, p)) { - /* queue is full -> packet loss */ - pbuf_free(p); - } - } -} - -static err_t -netif_output(struct netif *netif, struct pbuf *p) -{ - LINK_STATS_INC(link.xmit); - - /* Update SNMP stats (only if you use SNMP) */ - MIB2_STATS_NETIF_ADD(netif, ifoutoctets, p->tot_len); - int unicast = ((p->payload[0] & 0x01) == 0); - if (unicast) { - MIB2_STATS_NETIF_INC(netif, ifoutucastpkts); - } else { - MIB2_STATS_NETIF_INC(netif, ifoutnucastpkts); - } - - lock_interrupts(); - pbuf_copy_partial(p, mac_send_buffer, p->tot_len, 0); - /* Start MAC transmit here */ - unlock_interrupts(); - - return ERR_OK; -} - -static void -netif_status_callback(struct netif *netif) -{ - printf("netif status changed %s\n", ip4addr_ntoa(netif_ip4_addr(netif))); -} - -static err_t -netif_init(struct netif *netif) -{ - netif->linkoutput = netif_output; - netif->output = etharp_output; - netif->output_ip6 = ethip6_output; - netif->mtu = ETHERNET_MTU; - netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET | NETIF_FLAG_IGMP | NETIF_FLAG_MLD6; - MIB2_INIT_NETIF(netif, snmp_ifType_ethernet_csmacd, 100000000); - - SMEMCPY(netif->hwaddr, your_mac_address_goes_here, ETH_HWADDR_LEN); - netif->hwaddr_len = ETH_HWADDR_LEN; - - return ERR_OK; -} - -void -main(void) -{ - struct netif netif; - - lwip_init(); - - netif_add(&netif, IP4_ADDR_ANY, IP4_ADDR_ANY, IP4_ADDR_ANY, NULL, netif_init, netif_input); - netif.name[0] = 'e'; - netif.name[1] = '0'; - netif_create_ip6_linklocal_address(&netif, 1); - netif.ip6_autoconfig_enabled = 1; - netif_set_status_callback(&netif, netif_status_callback); - netif_set_default(&netif); - netif_set_up(&netif); - - /* Start DHCP and HTTPD */ - dhcp_start(&netif ); - httpd_init(); - - while(1) { - /* Check link state, e.g. via MDIO communication with PHY */ - if(link_state_changed()) { - if(link_is_up()) { - netif_set_link_up(&netif); - } else { - netif_set_link_down(&netif); - } - } - - /* Check for received frames, feed them to lwIP */ - lock_interrupts(); - struct pbuf* p = queue_try_get(&queue); - unlock_interrupts(); - - if(p != NULL) { - LINK_STATS_INC(link.recv); - - /* Update SNMP stats (only if you use SNMP) */ - MIB2_STATS_NETIF_ADD(netif, ifinoctets, p->tot_len); - int unicast = ((p->payload[0] & 0x01) == 0); - if (unicast) { - MIB2_STATS_NETIF_INC(netif, ifinucastpkts); - } else { - MIB2_STATS_NETIF_INC(netif, ifinnucastpkts); - } - - if(netif.input(p, &netif) != ERR_OK) { - pbuf_free(p); - } - } - - /* Cyclic lwIP timers check */ - sys_check_timeouts(); - - /* your application goes here */ - } -} diff --git a/components/net/lwip-2.1.0/doc/ZeroCopyRx.c b/components/net/lwip-2.1.0/doc/ZeroCopyRx.c deleted file mode 100644 index 0e8219bd2..000000000 --- a/components/net/lwip-2.1.0/doc/ZeroCopyRx.c +++ /dev/null @@ -1,45 +0,0 @@ -typedef struct my_custom_pbuf -{ - struct pbuf_custom p; - void* dma_descriptor; -} my_custom_pbuf_t; - -LWIP_MEMPOOL_DECLARE(RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool"); - -void my_pbuf_free_custom(void* p) -{ - SYS_ARCH_DECL_PROTECT(old_level); - - my_custom_pbuf_t* my_puf = (my_custom_pbuf_t*)p; - - // invalidate data cache here - lwIP and/or application may have written into buffer! - // (invalidate is faster than flushing, and noone needs the correct data in the buffer) - invalidate_cpu_cache(p->payload, p->tot_len); - - SYS_ARCH_PROTECT(old_level); - free_rx_dma_descriptor(my_pbuf->dma_descriptor); - LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf); - SYS_ARCH_UNPROTECT(old_level); -} - -void eth_rx_irq() -{ - dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet(); - my_custom_pbuf_t* my_pbuf = (my_custom_pbuf_t*)LWIP_MEMPOOL_ALLOC(RX_POOL); - - my_pbuf->p.custom_free_function = my_pbuf_free_custom; - my_pbuf->dma_descriptor = dma_desc; - - invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length); - - struct pbuf* p = pbuf_alloced_custom(PBUF_RAW, - dma_desc->rx_length, - PBUF_REF, - &my_pbuf->p, - dma_desc->rx_data, - dma_desc->max_buffer_size); - - if(netif->input(p, netif) != ERR_OK) { - pbuf_free(p); - } -} diff --git a/components/net/lwip-2.1.0/doc/contrib.txt b/components/net/lwip-2.1.0/doc/contrib.txt deleted file mode 100644 index 6f0d7bc51..000000000 --- a/components/net/lwip-2.1.0/doc/contrib.txt +++ /dev/null @@ -1,58 +0,0 @@ -1 Introduction - -This document describes some guidelines for people participating -in lwIP development. - -2 How to contribute to lwIP - -Here is a short list of suggestions to anybody working with lwIP and -trying to contribute bug reports, fixes, enhancements, platform ports etc. -First of all as you may already know lwIP is a volunteer project so feedback -to fixes or questions might often come late. Hopefully the bug and patch tracking -features of Savannah help us not lose users' input. - -2.1 Source code style: - -1. do not use tabs. -2. indentation is two spaces per level (i.e. per tab). -3. end debug messages with a trailing newline (\n). -4. one space between keyword and opening bracket. -5. no space between function and opening bracket. -6. one space and no newline before opening curly braces of a block. -7. closing curly brace on a single line. -8. spaces surrounding assignment and comparisons. -9. don't initialize static and/or global variables to zero, the compiler takes care of that. -10. use current source code style as further reference. - -2.2 Source code documentation style: - -1. JavaDoc compliant and Doxygen compatible. -2. Function documentation above functions in .c files, not .h files. - (This forces you to synchronize documentation and implementation.) -3. Use current documentation style as further reference. - -2.3 Bug reports and patches: - -1. Make sure you are reporting bugs or send patches against the latest - sources. (From the latest release and/or the current Git sources.) -2. If you think you found a bug make sure it's not already filed in the - bugtracker at Savannah. -3. If you have a fix put the patch on Savannah. If it is a patch that affects - both core and arch specific stuff please separate them so that the core can - be applied separately while leaving the other patch 'open'. The preferred way - is to NOT touch archs you can't test and let maintainers take care of them. - This is a good way to see if they are used at all - the same goes for unix - netifs except tapif. -4. Do not file a bug and post a fix to it to the patch area. Either a bug report - or a patch will be enough. - If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. -5. Patches should be specific to a single change or to related changes. Do not mix bugfixes with spelling and other - trivial fixes unless the bugfix is trivial too. Do not reorganize code and rename identifiers in the same patch you - change behaviour if not necessary. A patch is easier to read and understand if it's to the point and short than - if it's not to the point and long :) so the chances for it to be applied are greater. - -2.4 Platform porters: - -1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and - you think it could benefit others[1] you might want discuss this on the mailing list. You - can also ask for Git access to submit and maintain your port in the contrib Git module. diff --git a/components/net/lwip-2.1.0/doc/doxygen/generate.bat b/components/net/lwip-2.1.0/doc/doxygen/generate.bat deleted file mode 100644 index 4eab18c7f..000000000 --- a/components/net/lwip-2.1.0/doc/doxygen/generate.bat +++ /dev/null @@ -1 +0,0 @@ -doxygen lwip.Doxyfile diff --git a/components/net/lwip-2.1.0/doc/doxygen/generate.sh b/components/net/lwip-2.1.0/doc/doxygen/generate.sh deleted file mode 100644 index 89344b0e8..000000000 --- a/components/net/lwip-2.1.0/doc/doxygen/generate.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -doxygen lwip.Doxyfile diff --git a/components/net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile b/components/net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile deleted file mode 100644 index 78cc0f28f..000000000 --- a/components/net/lwip-2.1.0/doc/doxygen/lwip.Doxyfile +++ /dev/null @@ -1,2531 +0,0 @@ -# Doxyfile 1.8.13 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "lwIP" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = "2.1.0" - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "Lightweight IP stack" - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = "output" - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = "The $name class " \ - "The $name widget " \ - "The $name file " \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = YES - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = ../../ - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up -# to that level are automatically included in the table of contents, even if -# they do not have an id attribute. -# Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. -# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. - -TOC_INCLUDE_HEADINGS = 0 - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = YES - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = NO - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if ... \endif and \cond -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. -# The default value is: NO. - -WARN_AS_ERROR = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text " - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = main_page.h \ - ../../src - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.inc \ - *.m \ - *.mm \ - *.dox - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = ../../src/include/netif/ppp/polarssl - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = ../ \ - ../../ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# -# -# where is the value of the INPUT_FILTER tag, and is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# properly processed by doxygen. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = main_page.h - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = NO - -# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. -# Note: The availability of this option depends on whether or not doxygen was -# generated with the -Duse-libclang=ON option for CMake. -# The default value is: NO. - -CLANG_ASSISTED_PARSING = NO - -# If clang assisted parsing is enabled you can provide the compiler with command -# line options that you would normally use when invoking the compiler. Note that -# the include paths will already be set by doxygen for the files and directories -# specified with INPUT and INCLUDE_PATH. -# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. - -CLANG_OPTIONS = - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = NO - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = lwip.chm - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use + S -# (what the is depends on the OS and browser, but it is typically -# , /
index.html - - diff --git a/components/net/lwip-2.1.0/doc/mdns.txt b/components/net/lwip-2.1.0/doc/mdns.txt deleted file mode 100644 index 0c28970da..000000000 --- a/components/net/lwip-2.1.0/doc/mdns.txt +++ /dev/null @@ -1,112 +0,0 @@ -Multicast DNS for lwIP - -Author: Erik Ekman - - -Note! The MDNS responder does not have all features required by the standards. -See notes in src/apps/mdns/mdns.c for what is left. It is however usable in normal -cases - but watch out if many devices on the same network try to use the same -host/service instance names. - - -How to enable: -============== - -MDNS support does not depend on DNS. -MDNS supports using IPv4 only, v6 only, or v4+v6. - -To enable MDNS responder, set - LWIP_MDNS_RESPONDER = 1 -in lwipopts.h and add src/apps/mdns/mdns.c to your list of files to build. - -The max number of services supported per netif is defined by MDNS_MAX_SERVICES, -default is 1. - -Increase MEMP_NUM_UDP_PCB by 1. MDNS needs one PCB. -Increase LWIP_NUM_NETIF_CLIENT_DATA by 1 (MDNS needs one entry on netif). - -MDNS with IPv4 requires LWIP_IGMP = 1, and preferably LWIP_AUTOIP = 1. -MDNS with IPv6 requires LWIP_IPV6_MLD = 1, and that a link-local address is -generated. - -The MDNS code puts its structs on the stack where suitable to reduce dynamic -memory allocation. It may use up to 1kB of stack. - -MDNS (like other apps) needs a strncasecmp() implementation. If you have one, define -'lwip_strnicmp' to it. Otherwise the code will provide an implementation -for you. - - -How to use: -=========== - -Call mdns_resp_init() during system initialization. -This opens UDP sockets on port 5353 for IPv4 and IPv6. - - -To start responding on a netif, run - mdns_resp_add_netif(struct netif *netif, char *hostname, u32_t dns_ttl) - -The hostname will be copied. If this returns successfully, the netif will join -the multicast groups and any MDNS/legacy DNS requests sent unicast or multicast -to port 5353 will be handled: -- .local type A, AAAA or ANY returns relevant IP addresses -- Reverse lookups (PTR in-addr.arpa, ip6.arpa) of netif addresses - returns .local -Answers will use the supplied TTL (in seconds) -MDNS allows UTF-8 names, but it is recommended to stay within ASCII, -since the default case-insensitive comparison assumes this. - -Call mdns_resp_announce() every time the IP address on the netif has changed. - -Call mdns_resp_restart() every time the network interface comes up after being -down, for example cable connected after being disconnected, administrative -interface comes up after being down, or the device wakes up from sleep. - -To stop responding on a netif, run - mdns_resp_remove_netif(struct netif *netif) - - -Adding services: -================ - -The netif first needs to be registered. Then run - mdns_resp_add_service(struct netif *netif, char *name, char *service, - u16_t proto, u16_t port, u32_t dns_ttl, - service_get_txt_fn_t txt_fn, void *txt_userdata); - -The name and service pointers will be copied. Name refers to the name of the -service instance, and service is the type of service, like _http -proto can be DNSSD_PROTO_UDP or DNSSD_PROTO_TCP which represent _udp and _tcp. -If this call returns successfully, the following queries will be answered: -- _services._dns-sd._udp.local type PTR returns ..local -- ..local type PTR returns ...local -- ...local type SRV returns hostname and port of service -- ...local type TXT builds text strings by calling txt_fn - with the supplied userdata. The callback adds strings to the reply by calling - mdns_resp_add_service_txtitem(struct mdns_service *service, char *txt, - int txt_len). Example callback method: - - static void srv_txt(struct mdns_service *service, void *txt_userdata) - { - res = mdns_resp_add_service_txtitem(service, "path=/", 6); - LWIP_ERROR("mdns add service txt failed\n", (res == ERR_OK), return); - } - - Since a hostname struct is used for TXT storage each single item can be max - 63 bytes long, and the total max length (including length bytes for each - item) is 255 bytes. - -If your device runs a webserver on port 80, an example call might be: - - mdns_resp_add_service(netif, "myweb", "_http" - DNSSD_PROTO_TCP, 80, 3600, srv_txt, NULL); - -which will publish myweb._http._tcp.local for any hosts looking for web servers, -and point them to .local:80 - -Relevant information will be sent as additional records to reduce number of -requests required from a client. - -To remove a service from a netif, run - mdns_resp_del_service(struct netif *netif, s8_t slot) \ No newline at end of file diff --git a/components/net/lwip-2.1.0/doc/mqtt_client.txt b/components/net/lwip-2.1.0/doc/mqtt_client.txt deleted file mode 100644 index 7fd93a8ed..000000000 --- a/components/net/lwip-2.1.0/doc/mqtt_client.txt +++ /dev/null @@ -1,162 +0,0 @@ -MQTT client for lwIP - -Author: Erik Andersson - -Details of the MQTT protocol can be found at: -http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html - ------------------------------------------------------------------ -1. Initial steps, reserve memory and make connection to server: - -1.1: Provide storage - -Static allocation: - mqtt_client_t static_client; - example_do_connect(&static_client); - -Dynamic allocation: - mqtt_client_t *client = mqtt_client_new(); - if(client != NULL) { - example_do_connect(&client); - } - -1.2: Establish Connection with server - -void example_do_connect(mqtt_client_t *client) -{ - struct mqtt_connect_client_info_t ci; - err_t err; - - /* Setup an empty client info structure */ - memset(&ci, 0, sizeof(ci)); - - /* Minimal amount of information required is client identifier, so set it here */ - ci.client_id = "lwip_test"; - - /* Initiate client and connect to server, if this fails immediately an error code is returned - otherwise mqtt_connection_cb will be called with connection result after attempting - to establish a connection with the server. - For now MQTT version 3.1.1 is always used */ - - err = mqtt_client_connect(client, ip_addr, MQTT_PORT, mqtt_connection_cb, 0, &ci); - - /* For now just print the result code if something goes wrong */ - if(err != ERR_OK) { - printf("mqtt_connect return %d\n", err); - } -} - -Connection to server can also be probed by calling mqtt_client_is_connected(client) - ------------------------------------------------------------------ -2. Implementing the connection status callback - - -static void mqtt_connection_cb(mqtt_client_t *client, void *arg, mqtt_connection_status_t status) -{ - err_t err; - if(status == MQTT_CONNECT_ACCEPTED) { - printf("mqtt_connection_cb: Successfully connected\n"); - - /* Setup callback for incoming publish requests */ - mqtt_set_inpub_callback(client, mqtt_incoming_publish_cb, mqtt_incoming_data_cb, arg); - - /* Subscribe to a topic named "subtopic" with QoS level 1, call mqtt_sub_request_cb with result */ - err = mqtt_subscribe(client, "subtopic", 1, mqtt_sub_request_cb, arg); - - if(err != ERR_OK) { - printf("mqtt_subscribe return: %d\n", err); - } - } else { - printf("mqtt_connection_cb: Disconnected, reason: %d\n", status); - - /* Its more nice to be connected, so try to reconnect */ - example_do_connect(client); - } -} - -static void mqtt_sub_request_cb(void *arg, err_t result) -{ - /* Just print the result code here for simplicity, - normal behaviour would be to take some action if subscribe fails like - notifying user, retry subscribe or disconnect from server */ - printf("Subscribe result: %d\n", result); -} - ------------------------------------------------------------------ -3. Implementing callbacks for incoming publish and data - -/* The idea is to demultiplex topic and create some reference to be used in data callbacks - Example here uses a global variable, better would be to use a member in arg - If RAM and CPU budget allows it, the easiest implementation might be to just take a copy of - the topic string and use it in mqtt_incoming_data_cb -*/ -static int inpub_id; -static void mqtt_incoming_publish_cb(void *arg, const char *topic, u32_t tot_len) -{ - printf("Incoming publish at topic %s with total length %u\n", topic, (unsigned int)tot_len); - - /* Decode topic string into a user defined reference */ - if(strcmp(topic, "print_payload") == 0) { - inpub_id = 0; - } else if(topic[0] == 'A') { - /* All topics starting with 'A' might be handled at the same way */ - inpub_id = 1; - } else { - /* For all other topics */ - inpub_id = 2; - } -} - -static void mqtt_incoming_data_cb(void *arg, const u8_t *data, u16_t len, u8_t flags) -{ - printf("Incoming publish payload with length %d, flags %u\n", len, (unsigned int)flags); - - if(flags & MQTT_DATA_FLAG_LAST) { - /* Last fragment of payload received (or whole part if payload fits receive buffer - See MQTT_VAR_HEADER_BUFFER_LEN) */ - - /* Call function or do action depending on reference, in this case inpub_id */ - if(inpub_id == 0) { - /* Don't trust the publisher, check zero termination */ - if(data[len-1] == 0) { - printf("mqtt_incoming_data_cb: %s\n", (const char *)data); - } - } else if(inpub_id == 1) { - /* Call an 'A' function... */ - } else { - printf("mqtt_incoming_data_cb: Ignoring payload...\n"); - } - } else { - /* Handle fragmented payload, store in buffer, write to file or whatever */ - } -} - ------------------------------------------------------------------ -4. Using outgoing publish - - -void example_publish(mqtt_client_t *client, void *arg) -{ - const char *pub_payload= "PubSubHubLubJub"; - err_t err; - u8_t qos = 2; /* 0 1 or 2, see MQTT specification */ - u8_t retain = 0; /* No don't retain such crappy payload... */ - err = mqtt_publish(client, "pub_topic", pub_payload, strlen(pub_payload), qos, retain, mqtt_pub_request_cb, arg); - if(err != ERR_OK) { - printf("Publish err: %d\n", err); - } -} - -/* Called when publish is complete either with sucess or failure */ -static void mqtt_pub_request_cb(void *arg, err_t result) -{ - if(result != ERR_OK) { - printf("Publish result: %d\n", result); - } -} - ------------------------------------------------------------------ -5. Disconnecting - -Simply call mqtt_disconnect(client) diff --git a/components/net/lwip-2.1.0/doc/ppp.txt b/components/net/lwip-2.1.0/doc/ppp.txt deleted file mode 100644 index 8b88b3a67..000000000 --- a/components/net/lwip-2.1.0/doc/ppp.txt +++ /dev/null @@ -1,529 +0,0 @@ -PPP interface for lwIP - -Author: Sylvain Rochet - -Table of Contents: - -1 - Supported PPP protocols and features -2 - Raw API PPP example for all protocols -3 - PPPoS input path (raw API, IRQ safe API, TCPIP API) -4 - Thread safe PPP API (PPPAPI) -5 - Notify phase callback (PPP_NOTIFY_PHASE) -6 - Upgrading from lwIP <= 1.4.x to lwIP >= 2.0.x - - - -1 Supported PPP protocols and features -====================================== - -Supported Low level protocols: -* PPP over serial using HDLC-like framing, such as wired dialup modems - or mobile telecommunications GPRS/EDGE/UMTS/HSPA+/LTE modems -* PPP over Ethernet, such as xDSL modems -* PPP over L2TP (Layer 2 Tunneling Protocol) LAC (L2TP Access Concentrator), - IP tunnel over UDP, such as VPN access - -Supported auth protocols: -* PAP, Password Authentication Protocol -* CHAP, Challenge-Handshake Authentication Protocol, also known as CHAP-MD5 -* MSCHAPv1, Microsoft version of CHAP, version 1 -* MSCHAPv2, Microsoft version of CHAP, version 2 -* EAP, Extensible Authentication Protocol - -Supported address protocols: -* IPCP, IP Control Protocol, IPv4 addresses negotiation -* IP6CP, IPv6 Control Protocol, IPv6 link-local addresses negotiation - -Supported encryption protocols: -* MPPE, Microsoft Point-to-Point Encryption - -Supported compression or miscellaneous protocols, for serial links only: -* PFC, Protocol Field Compression -* ACFC, Address-and-Control-Field-Compression -* ACCM, Asynchronous-Control-Character-Map -* VJ, Van Jacobson TCP/IP Header Compression - - - -2 Raw API PPP example for all protocols -======================================= - -As usual, raw API for lwIP means the lightweight API which *MUST* only be used -for NO_SYS=1 systems or called inside lwIP core thread for NO_SYS=0 systems. - -/* - * Globals - * ======= - */ - -/* The PPP control block */ -ppp_pcb *ppp; - -/* The PPP IP interface */ -struct netif ppp_netif; - - -/* - * PPP status callback - * =================== - * - * PPP status callback is called on PPP status change (up, down, …) from lwIP - * core thread - */ - -/* PPP status callback example */ -static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) { - struct netif *pppif = ppp_netif(pcb); - LWIP_UNUSED_ARG(ctx); - - switch(err_code) { - case PPPERR_NONE: { -#if LWIP_DNS - const ip_addr_t *ns; -#endif /* LWIP_DNS */ - printf("status_cb: Connected\n"); -#if PPP_IPV4_SUPPORT - printf(" our_ipaddr = %s\n", ipaddr_ntoa(&pppif->ip_addr)); - printf(" his_ipaddr = %s\n", ipaddr_ntoa(&pppif->gw)); - printf(" netmask = %s\n", ipaddr_ntoa(&pppif->netmask)); -#if LWIP_DNS - ns = dns_getserver(0); - printf(" dns1 = %s\n", ipaddr_ntoa(ns)); - ns = dns_getserver(1); - printf(" dns2 = %s\n", ipaddr_ntoa(ns)); -#endif /* LWIP_DNS */ -#endif /* PPP_IPV4_SUPPORT */ -#if PPP_IPV6_SUPPORT - printf(" our6_ipaddr = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0))); -#endif /* PPP_IPV6_SUPPORT */ - break; - } - case PPPERR_PARAM: { - printf("status_cb: Invalid parameter\n"); - break; - } - case PPPERR_OPEN: { - printf("status_cb: Unable to open PPP session\n"); - break; - } - case PPPERR_DEVICE: { - printf("status_cb: Invalid I/O device for PPP\n"); - break; - } - case PPPERR_ALLOC: { - printf("status_cb: Unable to allocate resources\n"); - break; - } - case PPPERR_USER: { - printf("status_cb: User interrupt\n"); - break; - } - case PPPERR_CONNECT: { - printf("status_cb: Connection lost\n"); - break; - } - case PPPERR_AUTHFAIL: { - printf("status_cb: Failed authentication challenge\n"); - break; - } - case PPPERR_PROTOCOL: { - printf("status_cb: Failed to meet protocol\n"); - break; - } - case PPPERR_PEERDEAD: { - printf("status_cb: Connection timeout\n"); - break; - } - case PPPERR_IDLETIMEOUT: { - printf("status_cb: Idle Timeout\n"); - break; - } - case PPPERR_CONNECTTIME: { - printf("status_cb: Max connect time reached\n"); - break; - } - case PPPERR_LOOPBACK: { - printf("status_cb: Loopback detected\n"); - break; - } - default: { - printf("status_cb: Unknown error code %d\n", err_code); - break; - } - } - -/* - * This should be in the switch case, this is put outside of the switch - * case for example readability. - */ - - if (err_code == PPPERR_NONE) { - return; - } - - /* ppp_close() was previously called, don't reconnect */ - if (err_code == PPPERR_USER) { - /* ppp_free(); -- can be called here */ - return; - } - - /* - * Try to reconnect in 30 seconds, if you need a modem chatscript you have - * to do a much better signaling here ;-) - */ - ppp_connect(pcb, 30); - /* OR ppp_listen(pcb); */ -} - - -/* - * Creating a new PPPoS session - * ============================ - * - * In lwIP, PPPoS is not PPPoSONET, in lwIP PPPoS is PPPoSerial. - */ - -#include "netif/ppp/pppos.h" - -/* - * PPPoS serial output callback - * - * ppp_pcb, PPP control block - * data, buffer to write to serial port - * len, length of the data buffer - * ctx, optional user-provided callback context pointer - * - * Return value: len if write succeed - */ -static u32_t output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) { - return uart_write(UART, data, len); -} - -/* - * Create a new PPPoS interface - * - * ppp_netif, netif to use for this PPP link, i.e. PPP IP interface - * output_cb, PPPoS serial output callback - * status_cb, PPP status callback, called on PPP status change (up, down, …) - * ctx_cb, optional user-provided callback context pointer - */ -ppp = pppos_create(&ppp_netif, - output_cb, status_cb, ctx_cb); - - -/* - * Creating a new PPPoE session - * ============================ - */ - -#include "netif/ppp/pppoe.h" - -/* - * Create a new PPPoE interface - * - * ppp_netif, netif to use for this PPP link, i.e. PPP IP interface - * ethif, already existing and setup Ethernet interface to use - * service_name, PPPoE service name discriminator (not supported yet) - * concentrator_name, PPPoE concentrator name discriminator (not supported yet) - * status_cb, PPP status callback, called on PPP status change (up, down, …) - * ctx_cb, optional user-provided callback context pointer - */ -ppp = pppoe_create(&ppp_netif, - ðif, - service_name, concentrator_name, - status_cb, ctx_cb); - - -/* - * Creating a new PPPoL2TP session - * =============================== - */ - -#include "netif/ppp/pppol2tp.h" - -/* - * Create a new PPPoL2TP interface - * - * ppp_netif, netif to use for this PPP link, i.e. PPP IP interface - * netif, optional already existing and setup output netif, necessary if you - * want to set this interface as default route to settle the chicken - * and egg problem with VPN links - * ipaddr, IP to connect to - * port, UDP port to connect to (usually 1701) - * secret, L2TP secret to use - * secret_len, size in bytes of the L2TP secret - * status_cb, PPP status callback, called on PPP status change (up, down, …) - * ctx_cb, optional user-provided callback context pointer - */ -ppp = pppol2tp_create(&ppp_netif, - struct netif *netif, ip_addr_t *ipaddr, u16_t port, - u8_t *secret, u8_t secret_len, - ppp_link_status_cb_fn link_status_cb, void *ctx_cb); - - -/* - * Initiate PPP client connection - * ============================== - */ - -/* Set this interface as default route */ -ppp_set_default(ppp); - -/* - * Basic PPP client configuration. Can only be set if PPP session is in the - * dead state (i.e. disconnected). We don't need to provide thread-safe - * equivalents through PPPAPI because those helpers are only changing - * structure members while session is inactive for lwIP core. Configuration - * only need to be done once. - */ - -/* Ask the peer for up to 2 DNS server addresses. */ -ppp_set_usepeerdns(ppp, 1); - -/* Auth configuration, this is pretty self-explanatory */ -ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password"); - -/* - * Initiate PPP negotiation, without waiting (holdoff=0), can only be called - * if PPP session is in the dead state (i.e. disconnected). - */ -u16_t holdoff = 0; -ppp_connect(ppp, holdoff); - - -/* - * Initiate PPP server listener - * ============================ - */ - -/* - * Basic PPP server configuration. Can only be set if PPP session is in the - * dead state (i.e. disconnected). We don't need to provide thread-safe - * equivalents through PPPAPI because those helpers are only changing - * structure members while session is inactive for lwIP core. Configuration - * only need to be done once. - */ -ip4_addr_t addr; - -/* Set our address */ -IP4_ADDR(&addr, 192,168,0,1); -ppp_set_ipcp_ouraddr(ppp, &addr); - -/* Set peer(his) address */ -IP4_ADDR(&addr, 192,168,0,2); -ppp_set_ipcp_hisaddr(ppp, &addr); - -/* Set primary DNS server */ -IP4_ADDR(&addr, 192,168,10,20); -ppp_set_ipcp_dnsaddr(ppp, 0, &addr); - -/* Set secondary DNS server */ -IP4_ADDR(&addr, 192,168,10,21); -ppp_set_ipcp_dnsaddr(ppp, 1, &addr); - -/* Auth configuration, this is pretty self-explanatory */ -ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password"); - -/* Require peer to authenticate */ -ppp_set_auth_required(ppp, 1); - -/* - * Only for PPPoS, the PPP session should be up and waiting for input. - * - * Note: for PPPoS, ppp_connect() and ppp_listen() are actually the same thing. - * The listen call is meant for future support of PPPoE and PPPoL2TP server - * mode, where we will need to negotiate the incoming PPPoE session or L2TP - * session before initiating PPP itself. We need this call because there is - * two passive modes for PPPoS, ppp_set_passive and ppp_set_silent. - */ -ppp_set_silent(pppos, 1); - -/* - * Initiate PPP listener (i.e. wait for an incoming connection), can only - * be called if PPP session is in the dead state (i.e. disconnected). - */ -ppp_listen(ppp); - - -/* - * Closing PPP connection - * ====================== - */ - -/* - * Initiate the end of the PPP session, without carrier lost signal - * (nocarrier=0), meaning a clean shutdown of PPP protocols. - * You can call this function at anytime. - */ -u8_t nocarrier = 0; -ppp_close(ppp, nocarrier); -/* - * Then you must wait your status_cb() to be called, it may takes from a few - * seconds to several tens of seconds depending on the current PPP state. - */ - -/* - * Freeing a PPP connection - * ======================== - */ - -/* - * Free the PPP control block, can only be called if PPP session is in the - * dead state (i.e. disconnected). You need to call ppp_close() before. - */ -ppp_free(ppp); - - - -3 PPPoS input path (raw API, IRQ safe API, TCPIP API) -===================================================== - -Received data on serial port should be sent to lwIP using the pppos_input() -function or the pppos_input_tcpip() function. - -If NO_SYS is 1 and if PPP_INPROC_IRQ_SAFE is 0 (the default), pppos_input() -is not IRQ safe and then *MUST* only be called inside your main loop. - -Whatever the NO_SYS value, if PPP_INPROC_IRQ_SAFE is 1, pppos_input() is IRQ -safe and can be safely called from an interrupt context, using that is going -to reduce your need of buffer if pppos_input() is called byte after byte in -your rx serial interrupt. - -if NO_SYS is 0, the thread safe way outside an interrupt context is to use -the pppos_input_tcpip() function to pass input data to the lwIP core thread -using the TCPIP API. This is thread safe in all cases but you should avoid -passing data byte after byte because it uses heavy locking (mailbox) and it -allocates pbuf, better fill them ! - -if NO_SYS is 0 and if PPP_INPROC_IRQ_SAFE is 1, you may also use pppos_input() -from an RX thread, however pppos_input() is not thread safe by itself. You can -do that *BUT* you should NEVER call pppos_connect(), pppos_listen() and -ppp_free() if pppos_input() can still be running, doing this is NOT thread safe -at all. Using PPP_INPROC_IRQ_SAFE from an RX thread is discouraged unless you -really know what you are doing, your move ;-) - - -/* - * Fonction to call for received data - * - * ppp, PPP control block - * buffer, input buffer - * buffer_len, buffer length in bytes - */ -void pppos_input(ppp, buffer, buffer_len); - -or - -void pppos_input_tcpip(ppp, buffer, buffer_len); - - - -4 Thread safe PPP API (PPPAPI) -============================== - -There is a thread safe API for all corresponding ppp_* functions, you have to -enable LWIP_PPP_API in your lwipopts.h file, then see -include/netif/ppp/pppapi.h, this is actually pretty obvious. - - - -5 Notify phase callback (PPP_NOTIFY_PHASE) -========================================== - -Notify phase callback, enabled using the PPP_NOTIFY_PHASE config option, let -you configure a callback that is called on each PPP internal state change. -This is different from the status callback which only warns you about -up(running) and down(dead) events. - -Notify phase callback can be used, for example, to set a LED pattern depending -on the current phase of the PPP session. Here is a callback example which -tries to mimic what we usually see on xDSL modems while they are negotiating -the link, which should be self-explanatory: - -static void ppp_notify_phase_cb(ppp_pcb *pcb, u8_t phase, void *ctx) { - switch (phase) { - - /* Session is down (either permanently or briefly) */ - case PPP_PHASE_DEAD: - led_set(PPP_LED, LED_OFF); - break; - - /* We are between two sessions */ - case PPP_PHASE_HOLDOFF: - led_set(PPP_LED, LED_SLOW_BLINK); - break; - - /* Session just started */ - case PPP_PHASE_INITIALIZE: - led_set(PPP_LED, LED_FAST_BLINK); - break; - - /* Session is running */ - case PPP_PHASE_RUNNING: - led_set(PPP_LED, LED_ON); - break; - - default: - break; - } -} - - - -6 Upgrading from lwIP <= 1.4.x to lwIP >= 2.0.x -=============================================== - -PPP API was fully reworked between 1.4.x and 2.0.x releases. However porting -from previous lwIP version is pretty easy: - -* Previous PPP API used an integer to identify PPP sessions, we are now - using ppp_pcb* control block, therefore all functions changed from "int ppp" - to "ppp_pcb *ppp" - -* struct netif was moved outside the PPP structure, you have to provide a netif - for PPP interface in pppoX_create() functions - -* PPP session are not started automatically after you created them anymore, - you have to call ppp_connect(), this way you can configure the session before - starting it. - -* Previous PPP API used CamelCase, we are now using snake_case. - -* Previous PPP API mixed PPPoS and PPPoE calls, this isn't the case anymore, - PPPoS functions are now prefixed pppos_ and PPPoE functions are now prefixed - pppoe_, common functions are now prefixed ppp_. - -* New PPPERR_ error codes added, check you have all of them in your status - callback function - -* Only the following include files should now be used in user application: - #include "netif/ppp/pppapi.h" - #include "netif/ppp/pppos.h" - #include "netif/ppp/pppoe.h" - #include "netif/ppp/pppol2tp.h" - - Functions from ppp.h can be used, but you don't need to include this header - file as it is already included by above header files. - -* PPP_INPROC_OWNTHREAD was broken by design and was removed, you have to create - your own serial rx thread - -* PPP_INPROC_MULTITHREADED option was misnamed and confusing and was renamed - PPP_INPROC_IRQ_SAFE, please read the "PPPoS input path" documentation above - because you might have been fooled by that - -* If you used tcpip_callback_with_block() on ppp_ functions you may wish to use - the PPPAPI API instead. - -* ppp_sighup and ppp_close functions were merged using an optional argument - "nocarrier" on ppp_close. - -* DNS servers are now only remotely asked if LWIP_DNS is set and if - ppp_set_usepeerdns() is set to true, they are now automatically registered - using the dns_setserver() function so you don't need to do that in the PPP - callback anymore. - -* PPPoS does not use the SIO API anymore, as such it now requires a serial - output callback in place of sio_write - -* PPP_MAXIDLEFLAG is now in ms instead of jiffies diff --git a/components/net/lwip-2.1.0/doc/savannah.txt b/components/net/lwip-2.1.0/doc/savannah.txt deleted file mode 100644 index a98418d96..000000000 --- a/components/net/lwip-2.1.0/doc/savannah.txt +++ /dev/null @@ -1,120 +0,0 @@ -Daily Use Guide for using Savannah for lwIP - -Table of Contents: - -1 - Obtaining lwIP from the Git repository -2 - Committers/developers Git access using SSH -3 - Merging a development branch to master branch -4 - How to release lwIP - - - -1 Obtaining lwIP from the Git repository ----------------------------------------- - -To perform an anonymous Git clone of the master branch (this is where -bug fixes and incremental enhancements occur), do this: - git clone git://git.savannah.nongnu.org/lwip.git - -Or, obtain a stable branch (updated with bug fixes only) as follows: - git clone --branch DEVEL-1_4_1 git://git.savannah.nongnu.org/lwip.git - -Or, obtain a specific (fixed) release as follows: - git clone --branch STABLE-1_4_1 git://git.savannah.nongnu.org/lwip.git - - -2 Committers/developers Git access using SSH --------------------------------------------- - -The Savannah server uses SSH (Secure Shell) protocol 2 authentication and encryption. -As such, Git commits to the server occur through a SSH tunnel for project members. -To create a SSH2 key pair in UNIX-like environments, do this: - ssh-keygen - -Under Windows, a recommended SSH client is "PuTTY", freely available with good -documentation and a graphic user interface. Use its key generator. - -Now paste the id_rsa.pub contents into your Savannah account public key list. Wait -a while so that Savannah can update its configuration (This can take minutes). - -Try to login using SSH: - ssh -v your_login@git.sv.gnu.org - -If it tells you: - Linux vcs.savannah.gnu.org 2.6.32-5-xen-686 #1 SMP Wed Jun 17 17:10:03 UTC 2015 i686 - - Interactive shell login is not possible for security reasons. - VCS commands are allowed. - Last login: Tue May 15 23:10:12 2012 from 82.245.102.129 - You tried to execute: - Sorry, you are not allowed to execute that command. - Shared connection to git.sv.gnu.org closed. - -then you could login; Savannah refuses to give you a shell - which is OK, as we -are allowed to use SSH for Git only. Now, you should be able to do this: - git clone your_login@git.sv.gnu.org:/srv/git/lwip.git - -After which you can edit your local files with bug fixes or new features and -commit them. Make sure you know what you are doing when using Git to make -changes on the repository. If in doubt, ask on the lwip-members mailing list. - -(If SSH asks about authenticity of the host, you can check the key -fingerprint against https://savannah.nongnu.org/git/?group=lwip - - -3 - Merging a development branch to master branch -------------------------------------------------- - -Merging is a straightforward process in Git. How to merge all changes in a -development branch since our last merge from main: - -Checkout the master branch: - git checkout master - -Merge the development branch to master: - git merge your-development-branch - -Resolve any conflict. - -Commit the merge result. - git commit -a - -Push your commits: - git push - - -4 How to release lwIP ---------------------- - -First, tag the release using Git: (I use release number 1.4.1 throughout -this example). - git tag -a STABLE-1_4_1 - -Share the tag reference by pushing it to remote: - git push origin STABLE-1_4_1 - -Prepare the release: - cp -r lwip lwip-1.4.1 - rm -rf lwip-1.4.1/.git lwip-1.4.1/.gitattributes - -Archive the current directory using tar, gzip'd, bzip2'd and zip'd. - tar czvf lwip-1.4.1.tar.gz lwip-1.4.1 - tar cjvf lwip-1.4.1.tar.bz2 lwip-1.4.1 - zip -r lwip-1.4.1.zip lwip-1.4.1 - -Now, sign the archives with a detached GPG binary signature as follows: - gpg -b lwip-1.4.1.tar.gz - gpg -b lwip-1.4.1.tar.bz2 - gpg -b lwip-1.4.1.zip - -Upload these files using anonymous FTP: - ncftp ftp://savannah.gnu.org/incoming/savannah/lwip - ncftp> mput *1.4.1.* - -Additionally, you may post a news item on Savannah, like this: - -A new 1.4.1 release is now available here: -http://savannah.nongnu.org/files/?group=lwip&highlight=1.4.1 - -You will have to submit this via the user News interface, then approve -this via the Administrator News interface. diff --git a/components/net/lwip-2.1.0/src/apps/README.md b/components/net/lwip-2.1.0/src/apps/README.md deleted file mode 100644 index 26670858c..000000000 --- a/components/net/lwip-2.1.0/src/apps/README.md +++ /dev/null @@ -1,6 +0,0 @@ -Some net apps for current version LwIP. - -The RT-Thread develop team ported apps. It's easy to use it on finsh/msh. - -- ping -- tftp diff --git a/components/net/lwip-2.1.0/CHANGELOG b/components/net/lwip-2.1.2/CHANGELOG similarity index 99% rename from components/net/lwip-2.1.0/CHANGELOG rename to components/net/lwip-2.1.2/CHANGELOG index 032cfa3ee..5f797e77e 100644 --- a/components/net/lwip-2.1.0/CHANGELOG +++ b/components/net/lwip-2.1.2/CHANGELOG @@ -6,6 +6,61 @@ HISTORY * [Enter new changes just after this line - do not remove this line] +(STABLE-2.1.2): + + ++ Bugfixes: + + 2018-11-21: Jens Nielsen + * netbiosns.c: fix expecting too large packet (bug #55069) + + 2018-11-19: Dirk Ziegelmeier + * smtp.c: fix compiling with strict C compatibility because of strnlen (bug #55034) + + 2018-11-12: Simon Goldschmidt + * tcp.c: fix overflow check in tcp_recved triggering invalid assertion (bug #55015) + + 2018-11-12: Simon Goldschmidt + * tcp.c: fix a bug in sending RST segments (sent from port 0) + +(STABLE-2.1.1): + + ++ Bugfixes: + + 2018-11-01: Joan Lledó + * sockets.c: fix bad assertion in lwip_poll_dec_sockets_used() (bug #54933) + + 2018-11-01: Dirk Ziegelmeier + * ip4.c: don't send 127.* to default netif (bug #54670) + + 2018-10-23: David Girault + * altcp_tls_mbedtls.c: fix use-after free (bug #54774) + + 2018-10-23: Ognjen Bjelica, Dirk Ziegelmeier + * snmp_scalar.c: Avoid NULL pointer dereference (bug #54886) + + 2018-10-23: Simon Goldschmidt + * Fix missing standard includes in multiple files + + 2018-10-17: Ivan Warren + * def.h: fix casting htonX and ntohX to u16_t (bug #54850) + + 2018-10-12: Simon Goldschmidt + * Revert "tcp_abandon: no need to buffer pcb->local_port" (fix that source port was 0 for RST + called when aborting a connection) + + 2018-10-11: Jonas Rabenstein + * tcp.c: tcp_recved: check for overflow and warn about too big values (patch #9699) + + 2018-10-06: Joan Lledó + * sockets.c: alloc_socket(): Check for LWIP_SOCKET_POLL when setting select- + related variables (patch #9696) + + 2018-10-04: Spencer + * tcp.c: Update prev pointer when skipping entries in tcp_slowtmr (patch #9694) + + 2018-09-27: Martine Lenders + * lowpan6.c: Fix IEEE 802.15.4 address setting (bug #54749) + (STABLE-2.1.0): ++ New features: diff --git a/components/net/lwip-2.1.0/CMakeLists.txt b/components/net/lwip-2.1.2/CMakeLists.txt similarity index 100% rename from components/net/lwip-2.1.0/CMakeLists.txt rename to components/net/lwip-2.1.2/CMakeLists.txt diff --git a/components/net/lwip-2.1.0/COPYING b/components/net/lwip-2.1.2/COPYING similarity index 100% rename from components/net/lwip-2.1.0/COPYING rename to components/net/lwip-2.1.2/COPYING diff --git a/components/net/lwip-2.1.0/FEATURES b/components/net/lwip-2.1.2/FEATURES similarity index 100% rename from components/net/lwip-2.1.0/FEATURES rename to components/net/lwip-2.1.2/FEATURES diff --git a/components/net/lwip-2.1.0/FILES b/components/net/lwip-2.1.2/FILES similarity index 100% rename from components/net/lwip-2.1.0/FILES rename to components/net/lwip-2.1.2/FILES diff --git a/components/net/lwip-2.1.0/README b/components/net/lwip-2.1.2/README similarity index 100% rename from components/net/lwip-2.1.0/README rename to components/net/lwip-2.1.2/README diff --git a/components/net/lwip-2.1.2/README_RT-THREAD.md b/components/net/lwip-2.1.2/README_RT-THREAD.md new file mode 100644 index 000000000..c91be2c7f --- /dev/null +++ b/components/net/lwip-2.1.2/README_RT-THREAD.md @@ -0,0 +1,89 @@ +# lwip 移æ¤è¯´æ˜Ž + +ä¸ºäº†é€‚é… RT-Thread 网å¡è®¾å¤‡ï¼ŒRT-Thread 团队基于原 [lwip](http://savannah.nongnu.org/projects/lwip/) 进行了一些修改,本文档记录了相关修改内容。 + +> 本 lwip-2.1.2 版本基于 [lwip STABLE-2_1_2_RELEASE](https://git.savannah.gnu.org/git/lwip.git) 版本移æ¤è€Œæ¥ã€‚ + + +| Date | Author | Notes | +| :---- | :---- | :---- | +| 2019-09-02 | MurphyZhao | 增加 lwip 2.1.2 移æ¤è¯´æ˜Ž | +| 2020-06-18 | xiangxistu | 增加部分 lwIP 2.1.2 移æ¤è¯´æ˜Ž | + +## 修改内容 + +### src/api + +- `src/api/sockets.c` 增加 `lwip_tryget_socket` 函数,作为 `tryget_socket` 函数的全局实现 +- `src/api/sockets.c` 在 `alloc_socket` 函数中,增加 SAL 移æ¤å‡½æ•° `rt_wqueue_init` + +``` +#ifdef SAL_USING_POSIX + rt_wqueue_init(&sockets[i].wait_head); +#endif +``` + +### src/app + +- 增加 `ping/ping.c`,便于在 finsh/msh 中使用 ping 功能 +- 增加 `tftp/tftp_port.c`,便于在 finsh/msh 中使用 tftp_server 功能 + +### src/arch + +增加 `src/arch` 目录,存储对接 RT-Thread 设备框架的移æ¤æ–‡ä»¶ï¼Œä»Ž lwip-2.0.2 版本中的移æ¤æ–‡ä»¶ä¿®æ”¹è€Œæ¥ã€‚ + + + +以åŠç›¸å¯¹äºŽ lwIP2.0.2 的增加修改内容: + + +* 在 `src/arch/sys_arch.c` 中增加 MTU 与 etharp_output çš„åˆå§‹åŒ– + +* 在 `src/arch/sys_arch.c` 中增加新添加的邮箱函数 + + 对邮箱机制的新增加的 sys_mbox_trypost_fromisr 函数予以实现 + +* 在 `src/arch/sys_arch.c` 中增加新添加的内存堆函数 + + 对内存堆的新增加的 mem_overflow_check_raw 与 mem_overflow_init_raw 函数予以实现 + +* 在 `src/arch/cc.h` 中增加对 lwIP 使用的标准错误代ç å®çš„处ç†ï¼Œä¸å†ä½¿ç”¨ lwIP å†…ç½®çš„é”™è¯¯å® + + +### src/core + +- 在 `src/core/dns.c` çš„ `dns_setserver` 函数中增加 RT-Thread netdev ç›¸å…³çš„ç§»æ¤ +- 在 `src/core/netif.c` 中增加 RT-Thread netdev ç›¸å…³çš„ç§»æ¤ + +### src/include + +- 在 `src/include/lwip/priv/sockets_priv.h` 中增加 SAL ç›¸å…³çš„ç§»æ¤ + + 在 `lwip_sock` 结构体中增加 ` rt_wqueue_t wait_head;` æˆå‘˜ + +- 在 `src/include/lwip/prot/ieee.h` 中增加 EAPOL, EAP over LAN 标识 + +- 在 `src/include/lwip/init.h` 中的版本å·åŽå¢žåŠ  `U` 标识 + +- 在 `src/include/lwip/sockets.h` 中增加 `LWIP_SOCKET_SELECT`ï¼Œè§£å†³å¼€å¯ RT_USING_POSIX æ—¶çš„å†²çª + +- 在 `src/include/lwip/arch.h` 中修改 ` `为 `"sys/types.h" `ï¼Œè§£å†³ç¼–è¯‘å†²çª + + 并添加 typedef int ssize_t 定义,补足因 libc 与 dfs 未开å¯æ—¶ ssize_t 的定义ä¸è¶³é—®é¢˜ + +- 在 `src/include/netif/` 中增加 `ethernetif.h`,用于对接 RT-Thread 网å¡è®¾å¤‡ + +### src/netif + +- 在 `src/netif/` 中增加 `ethernetif.c`,用于对接 RT-Thread 网å¡è®¾å¤‡ +- 在 `src/netif/lowpan6.c` 中增加 `LWIP_6LOWPAN` å®å®šä¹‰ï¼Œä»¥é˜²æ­¢ç¼–译错误 + +### src + +- 在 src 目录下,增加 `src/lwipopts.h`,用于 lwip 功能è£å‰ªä»¥åŠé…置设置 +- 在 src 目录下,增加 `src/lwippools.h`,用于定义 `LWIP_MALLOC_MEMPOOL` + +### 其它 + +- 增加 SConscript 文件,用于 scons 构建 +- 增加 README_RT-THREAD.md 文件,用于记录相对原 lwip æºç çš„改动 diff --git a/components/net/lwip-2.1.0/SConscript b/components/net/lwip-2.1.2/SConscript similarity index 99% rename from components/net/lwip-2.1.0/SConscript rename to components/net/lwip-2.1.2/SConscript index 36baf9418..04f59167d 100644 --- a/components/net/lwip-2.1.0/SConscript +++ b/components/net/lwip-2.1.2/SConscript @@ -260,6 +260,6 @@ if GetDepend(['RT_USING_LWIP_IPV6']): if GetDepend(['RT_LWIP_USING_PING']): src += lwipping_SRCS -group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP210'], CPPPATH = path) +group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP212'], CPPPATH = path) Return('group') diff --git a/components/net/lwip-2.1.0/UPGRADING b/components/net/lwip-2.1.2/UPGRADING similarity index 100% rename from components/net/lwip-2.1.0/UPGRADING rename to components/net/lwip-2.1.2/UPGRADING diff --git a/components/net/lwip-2.1.0/src/FILES b/components/net/lwip-2.1.2/src/FILES similarity index 100% rename from components/net/lwip-2.1.0/src/FILES rename to components/net/lwip-2.1.2/src/FILES diff --git a/components/net/lwip-2.1.0/src/Filelists.cmake b/components/net/lwip-2.1.2/src/Filelists.cmake similarity index 99% rename from components/net/lwip-2.1.0/src/Filelists.cmake rename to components/net/lwip-2.1.2/src/Filelists.cmake index 9fa1b659c..c76562872 100644 --- a/components/net/lwip-2.1.0/src/Filelists.cmake +++ b/components/net/lwip-2.1.2/src/Filelists.cmake @@ -10,7 +10,7 @@ set(LWIP_VERSION_MAJOR "2") set(LWIP_VERSION_MINOR "1") -set(LWIP_VERSION_REVISION "0") +set(LWIP_VERSION_REVISION "2") # LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases # LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for Git versions # Numbers 1..31 are reserved for release candidates diff --git a/components/net/lwip-2.1.0/src/Filelists.mk b/components/net/lwip-2.1.2/src/Filelists.mk similarity index 100% rename from components/net/lwip-2.1.0/src/Filelists.mk rename to components/net/lwip-2.1.2/src/Filelists.mk diff --git a/components/net/lwip-2.1.0/src/api/api_lib.c b/components/net/lwip-2.1.2/src/api/api_lib.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/api_lib.c rename to components/net/lwip-2.1.2/src/api/api_lib.c index 5e9ceafa5..e03b8b745 100644 --- a/components/net/lwip-2.1.0/src/api/api_lib.c +++ b/components/net/lwip-2.1.2/src/api/api_lib.c @@ -201,12 +201,12 @@ netconn_prepare_delete(struct netconn *conn) API_MSG_VAR_ALLOC(msg); API_MSG_VAR_REF(msg).conn = conn; -#if LWIP_TCP #if LWIP_SO_SNDTIMEO || LWIP_SO_LINGER /* get the time we started, which is later compared to sys_now() + conn->send_timeout */ API_MSG_VAR_REF(msg).msg.sd.time_started = sys_now(); #else /* LWIP_SO_SNDTIMEO || LWIP_SO_LINGER */ +#if LWIP_TCP API_MSG_VAR_REF(msg).msg.sd.polls_left = ((LWIP_TCP_CLOSE_TIMEOUT_MS_DEFAULT + TCP_SLOW_INTERVAL - 1) / TCP_SLOW_INTERVAL) + 1; #endif /* LWIP_TCP */ diff --git a/components/net/lwip-2.1.0/src/api/api_msg.c b/components/net/lwip-2.1.2/src/api/api_msg.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/api_msg.c rename to components/net/lwip-2.1.2/src/api/api_msg.c diff --git a/components/net/lwip-2.1.0/src/api/err.c b/components/net/lwip-2.1.2/src/api/err.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/err.c rename to components/net/lwip-2.1.2/src/api/err.c diff --git a/components/net/lwip-2.1.0/src/api/if_api.c b/components/net/lwip-2.1.2/src/api/if_api.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/if_api.c rename to components/net/lwip-2.1.2/src/api/if_api.c diff --git a/components/net/lwip-2.1.0/src/api/netbuf.c b/components/net/lwip-2.1.2/src/api/netbuf.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/netbuf.c rename to components/net/lwip-2.1.2/src/api/netbuf.c diff --git a/components/net/lwip-2.1.0/src/api/netdb.c b/components/net/lwip-2.1.2/src/api/netdb.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/netdb.c rename to components/net/lwip-2.1.2/src/api/netdb.c diff --git a/components/net/lwip-2.1.0/src/api/netifapi.c b/components/net/lwip-2.1.2/src/api/netifapi.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/netifapi.c rename to components/net/lwip-2.1.2/src/api/netifapi.c diff --git a/components/net/lwip-2.1.0/src/api/sockets.c b/components/net/lwip-2.1.2/src/api/sockets.c similarity index 99% rename from components/net/lwip-2.1.0/src/api/sockets.c rename to components/net/lwip-2.1.2/src/api/sockets.c index 4e343c55c..4fea5b372 100644 --- a/components/net/lwip-2.1.0/src/api/sockets.c +++ b/components/net/lwip-2.1.2/src/api/sockets.c @@ -541,17 +541,17 @@ alloc_socket(struct netconn *newconn, int accepted) after having marked it as used. */ SYS_ARCH_UNPROTECT(lev); sockets[i].lastdata.pbuf = NULL; -#if LWIP_SOCKET_SELECT +#if LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL LWIP_ASSERT("sockets[i].select_waiting == 0", sockets[i].select_waiting == 0); sockets[i].rcvevent = 0; /* TCP sendbuf is empty, but the socket is not yet writable until connected * (unless it has been created by accept()). */ sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1); sockets[i].errevent = 0; -#endif /* LWIP_SOCKET_SELECT */ - #ifdef SAL_USING_POSIX - rt_wqueue_init(&sockets[i].wait_head); - #endif +#endif /* LWIP_SOCKET_SELECT || LWIP_SOCKET_POLL */ +#ifdef SAL_USING_POSIX + rt_wqueue_init(&sockets[i].wait_head); +#endif return i + LWIP_SOCKET_OFFSET; } SYS_ARCH_UNPROTECT(lev); @@ -1327,7 +1327,7 @@ lwip_recvmsg(int s, struct msghdr *message, int flags) if ((message->msg_iov[i].iov_base == NULL) || ((ssize_t)message->msg_iov[i].iov_len <= 0) || ((size_t)(ssize_t)message->msg_iov[i].iov_len != message->msg_iov[i].iov_len) || ((ssize_t)(buflen + (ssize_t)message->msg_iov[i].iov_len) <= 0)) { - sock_set_errno(sock, ERR_VAL); + sock_set_errno(sock, err_to_errno(ERR_VAL)); done_socket(sock); return -1; } @@ -2326,7 +2326,6 @@ lwip_poll_dec_sockets_used(struct pollfd *fds, nfds_t nfds) /* Go through each struct pollfd in the array. */ for (fdi = 0; fdi < nfds; fdi++) { struct lwip_sock *sock = tryget_socket_unconn_nouse(fds[fdi].fd); - LWIP_ASSERT("socket gone at the end of select", sock != NULL); if (sock != NULL) { done_socket(sock); } diff --git a/components/net/lwip-2.1.0/src/api/tcpip.c b/components/net/lwip-2.1.2/src/api/tcpip.c similarity index 100% rename from components/net/lwip-2.1.0/src/api/tcpip.c rename to components/net/lwip-2.1.2/src/api/tcpip.c diff --git a/components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls.c b/components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls.c similarity index 97% rename from components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls.c rename to components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls.c index d241a0611..d642decb5 100644 --- a/components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls.c +++ b/components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls.c @@ -40,17 +40,15 @@ * track of the ratio of application data and TLS overhead would be too much. * * Mandatory security-related configuration: - * - define ALTCP_MBEDTLS_RNG_FN to a custom GOOD rng function returning 0 on success: - * int my_rng_fn(void *ctx, unsigned char *buffer , size_t len) + * - define ALTCP_MBEDTLS_RNG_FN to mbedtls_entropy_func to use the standard mbedTLS + * entropy and ensure to add at least one strong entropy source to your mbedtls port + * (implement mbedtls_platform_entropy_poll or mbedtls_hardware_poll providing strong + * entropy) * - define ALTCP_MBEDTLS_ENTROPY_PTR and ALTCP_MBEDTLS_ENTROPY_LEN to something providing * GOOD custom entropy * * Missing things / @todo: - * - RX data is acknowledged after receiving (tcp_recved is called when enqueueing - * the pbuf for mbedTLS receive, not when processed by mbedTLS or the inner - * connection; altcp_recved() from inner connection does nothing) - * - Client connections starting with 'connect()' are not handled yet... - * - some unhandled things are caught by LWIP_ASSERTs... + * - some unhandled/untested things migh be caught by LWIP_ASSERTs... */ #include "lwip/opt.h" @@ -309,17 +307,20 @@ altcp_mbedtls_pass_rx_data(struct altcp_pcb *conn, altcp_mbedtls_state_t *state) LWIP_ASSERT("state != NULL", state != NULL); buf = state->rx_app; if (buf) { + state->rx_app = NULL; if (conn->recv) { - u16_t tot_len = state->rx_app->tot_len; + u16_t tot_len = buf->tot_len; /* this needs to be increased first because the 'recved' call may come nested */ state->rx_passed_unrecved += tot_len; state->flags |= ALTCP_MBEDTLS_FLAGS_UPPER_CALLED; - err = conn->recv(conn->arg, conn, state->rx_app, ERR_OK); + err = conn->recv(conn->arg, conn, buf, ERR_OK); if (err != ERR_OK) { if (err == ERR_ABRT) { return ERR_ABRT; } /* not received, leave the pbuf(s) queued (and decrease 'unrecved' again) */ + LWIP_ASSERT("state == conn->state", state == conn->state); + state->rx_app = buf; state->rx_passed_unrecved -= tot_len; LWIP_ASSERT("state->rx_passed_unrecved >= 0", state->rx_passed_unrecved >= 0); if (state->rx_passed_unrecved < 0) { @@ -330,7 +331,6 @@ altcp_mbedtls_pass_rx_data(struct altcp_pcb *conn, altcp_mbedtls_state_t *state) } else { pbuf_free(buf); } - state->rx_app = NULL; } else if ((state->flags & (ALTCP_MBEDTLS_FLAGS_RX_CLOSE_QUEUED | ALTCP_MBEDTLS_FLAGS_RX_CLOSED)) == ALTCP_MBEDTLS_FLAGS_RX_CLOSE_QUEUED) { state->flags |= ALTCP_MBEDTLS_FLAGS_RX_CLOSED; @@ -339,6 +339,11 @@ altcp_mbedtls_pass_rx_data(struct altcp_pcb *conn, altcp_mbedtls_state_t *state) } } + /* application may have close the connection */ + if (conn->state != state) { + /* return error code to ensure altcp_mbedtls_handle_rx_appldata() exits the loop */ + return ERR_CLSD; + } return ERR_OK; } @@ -635,12 +640,13 @@ altcp_tls_context(struct altcp_pcb *conn) static void altcp_mbedtls_debug(void *ctx, int level, const char *file, int line, const char *str) { - LWIP_UNUSED_ARG(str); + LWIP_UNUSED_ARG(ctx); LWIP_UNUSED_ARG(level); LWIP_UNUSED_ARG(file); LWIP_UNUSED_ARG(line); - LWIP_UNUSED_ARG(ctx); - /* @todo: output debug string :-) */ + LWIP_UNUSED_ARG(str); + + LWIP_DEBUGF(ALTCP_MBEDTLS_DEBUG, ("%s:%04d: %s", file, line, str)); } #endif @@ -673,7 +679,7 @@ altcp_tls_create_config(int is_server, int have_cert, int have_pkey, int have_ca if (TCP_WND < MBEDTLS_SSL_MAX_CONTENT_LEN) { LWIP_DEBUGF(ALTCP_MBEDTLS_DEBUG|LWIP_DBG_LEVEL_SERIOUS, - ("altcp_tls: TCP_WND is smaller than the RX decrypion buffer, connection RX might stall!\n")); + ("altcp_tls: TCP_WND is smaller than the RX decryption buffer, connection RX might stall!\n")); } altcp_mbedtls_mem_init(); diff --git a/components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c b/components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c rename to components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_mem.c diff --git a/components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h b/components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h rename to components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_mem.h diff --git a/components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h b/components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h rename to components/net/lwip-2.1.2/src/apps/altcp_tls/altcp_tls_mbedtls_structs.h diff --git a/components/net/lwip-2.1.0/src/apps/http/altcp_proxyconnect.c b/components/net/lwip-2.1.2/src/apps/http/altcp_proxyconnect.c similarity index 99% rename from components/net/lwip-2.1.0/src/apps/http/altcp_proxyconnect.c rename to components/net/lwip-2.1.2/src/apps/http/altcp_proxyconnect.c index e3135ba9a..9a0b2ba19 100644 --- a/components/net/lwip-2.1.0/src/apps/http/altcp_proxyconnect.c +++ b/components/net/lwip-2.1.2/src/apps/http/altcp_proxyconnect.c @@ -51,6 +51,8 @@ #include "lwip/mem.h" #include "lwip/init.h" +#include + /** This string is passed in the HTTP header as "User-Agent: " */ #ifndef ALTCP_PROXYCONNECT_CLIENT_AGENT #define ALTCP_PROXYCONNECT_CLIENT_AGENT "lwIP/" LWIP_VERSION_STRING " (http://savannah.nongnu.org/projects/lwip)" diff --git a/components/net/lwip-2.1.0/src/apps/http/fs.c b/components/net/lwip-2.1.2/src/apps/http/fs.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fs.c rename to components/net/lwip-2.1.2/src/apps/http/fs.c diff --git a/components/net/lwip-2.1.0/src/apps/http/fs/404.html b/components/net/lwip-2.1.2/src/apps/http/fs/404.html similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fs/404.html rename to components/net/lwip-2.1.2/src/apps/http/fs/404.html diff --git a/components/net/lwip-2.1.0/src/apps/http/fs/img/sics.gif b/components/net/lwip-2.1.2/src/apps/http/fs/img/sics.gif similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fs/img/sics.gif rename to components/net/lwip-2.1.2/src/apps/http/fs/img/sics.gif diff --git a/components/net/lwip-2.1.0/src/apps/http/fs/index.html b/components/net/lwip-2.1.2/src/apps/http/fs/index.html similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fs/index.html rename to components/net/lwip-2.1.2/src/apps/http/fs/index.html diff --git a/components/net/lwip-2.1.0/src/apps/http/fsdata.c b/components/net/lwip-2.1.2/src/apps/http/fsdata.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fsdata.c rename to components/net/lwip-2.1.2/src/apps/http/fsdata.c diff --git a/components/net/lwip-2.1.0/src/apps/http/fsdata.h b/components/net/lwip-2.1.2/src/apps/http/fsdata.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/fsdata.h rename to components/net/lwip-2.1.2/src/apps/http/fsdata.h diff --git a/components/net/lwip-2.1.0/src/apps/http/http_client.c b/components/net/lwip-2.1.2/src/apps/http/http_client.c similarity index 99% rename from components/net/lwip-2.1.0/src/apps/http/http_client.c rename to components/net/lwip-2.1.2/src/apps/http/http_client.c index 9198c89d3..82da60d73 100644 --- a/components/net/lwip-2.1.0/src/apps/http/http_client.c +++ b/components/net/lwip-2.1.2/src/apps/http/http_client.c @@ -55,6 +55,7 @@ #include "lwip/init.h" #include +#include #include #if LWIP_TCP && LWIP_CALLBACK_API diff --git a/components/net/lwip-2.1.0/src/apps/http/httpd.c b/components/net/lwip-2.1.2/src/apps/http/httpd.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/httpd.c rename to components/net/lwip-2.1.2/src/apps/http/httpd.c diff --git a/components/net/lwip-2.1.0/src/apps/http/httpd_structs.h b/components/net/lwip-2.1.2/src/apps/http/httpd_structs.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/httpd_structs.h rename to components/net/lwip-2.1.2/src/apps/http/httpd_structs.h diff --git a/components/net/lwip-2.1.0/src/apps/http/makefsdata/makefsdata b/components/net/lwip-2.1.2/src/apps/http/makefsdata/makefsdata similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/makefsdata/makefsdata rename to components/net/lwip-2.1.2/src/apps/http/makefsdata/makefsdata diff --git a/components/net/lwip-2.1.0/src/apps/http/makefsdata/makefsdata.c b/components/net/lwip-2.1.2/src/apps/http/makefsdata/makefsdata.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/makefsdata/makefsdata.c rename to components/net/lwip-2.1.2/src/apps/http/makefsdata/makefsdata.c diff --git a/components/net/lwip-2.1.0/src/apps/http/makefsdata/readme.txt b/components/net/lwip-2.1.2/src/apps/http/makefsdata/readme.txt similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/makefsdata/readme.txt rename to components/net/lwip-2.1.2/src/apps/http/makefsdata/readme.txt diff --git a/components/net/lwip-2.1.0/src/apps/http/makefsdata/tinydir.h b/components/net/lwip-2.1.2/src/apps/http/makefsdata/tinydir.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/http/makefsdata/tinydir.h rename to components/net/lwip-2.1.2/src/apps/http/makefsdata/tinydir.h diff --git a/components/net/lwip-2.1.0/src/apps/lwiperf/lwiperf.c b/components/net/lwip-2.1.2/src/apps/lwiperf/lwiperf.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/lwiperf/lwiperf.c rename to components/net/lwip-2.1.2/src/apps/lwiperf/lwiperf.c diff --git a/components/net/lwip-2.1.0/src/apps/mdns/mdns.c b/components/net/lwip-2.1.2/src/apps/mdns/mdns.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/mdns/mdns.c rename to components/net/lwip-2.1.2/src/apps/mdns/mdns.c diff --git a/components/net/lwip-2.1.0/src/apps/mqtt/mqtt.c b/components/net/lwip-2.1.2/src/apps/mqtt/mqtt.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/mqtt/mqtt.c rename to components/net/lwip-2.1.2/src/apps/mqtt/mqtt.c diff --git a/components/net/lwip-2.1.0/src/apps/netbiosns/netbiosns.c b/components/net/lwip-2.1.2/src/apps/netbiosns/netbiosns.c similarity index 92% rename from components/net/lwip-2.1.0/src/apps/netbiosns/netbiosns.c rename to components/net/lwip-2.1.2/src/apps/netbiosns/netbiosns.c index 493e20bb7..c94a77910 100644 --- a/components/net/lwip-2.1.0/src/apps/netbiosns/netbiosns.c +++ b/components/net/lwip-2.1.2/src/apps/netbiosns/netbiosns.c @@ -111,6 +111,22 @@ PACK_STRUCT_END # include "arch/epstruct.h" #endif +/** NetBIOS message question part */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct netbios_question_hdr { + PACK_STRUCT_FLD_8(u8_t nametype); + PACK_STRUCT_FLD_8(u8_t encname[(NETBIOS_NAME_LEN * 2) + 1]); + PACK_STRUCT_FIELD(u16_t type); + PACK_STRUCT_FIELD(u16_t cls); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + /** NetBIOS message name part */ #ifdef PACK_STRUCT_USE_INCLUDES # include "arch/bpstruct.h" @@ -335,11 +351,11 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t /* if packet is valid */ if (p != NULL) { char netbios_name[NETBIOS_NAME_LEN + 1]; - struct netbios_hdr *netbios_hdr = (struct netbios_hdr *)p->payload; - struct netbios_name_hdr *netbios_name_hdr = (struct netbios_name_hdr *)(netbios_hdr + 1); + struct netbios_hdr *netbios_hdr = (struct netbios_hdr *)p->payload; + struct netbios_question_hdr *netbios_question_hdr = (struct netbios_question_hdr *)(netbios_hdr + 1); /* is the packet long enough (we need the header in one piece) */ - if (p->len < (sizeof(struct netbios_hdr) + sizeof(struct netbios_name_hdr))) { + if (p->len < (sizeof(struct netbios_hdr) + sizeof(struct netbios_question_hdr))) { /* packet too short */ pbuf_free(p); return; @@ -352,9 +368,9 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t ((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_RESPONSE)) == 0) && (netbios_hdr->questions == PP_NTOHS(1))) { /* decode the NetBIOS name */ - netbiosns_name_decode((char *)(netbios_name_hdr->encname), netbios_name, sizeof(netbios_name)); + netbiosns_name_decode((char *)(netbios_question_hdr->encname), netbios_name, sizeof(netbios_name)); /* check the request type */ - if (netbios_name_hdr->type == PP_HTONS(NETB_QTYPE_NB)) { + if (netbios_question_hdr->type == PP_HTONS(NETB_QTYPE_NB)) { /* if the packet is for us */ if (lwip_strnicmp(netbios_name, NETBIOS_LOCAL_NAME, sizeof(NETBIOS_LOCAL_NAME)) == 0) { struct pbuf *q; @@ -376,10 +392,10 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t resp->resp_hdr.additionalRRs = 0; /* prepare NetBIOS header datas */ - MEMCPY( resp->resp_name.encname, netbios_name_hdr->encname, sizeof(netbios_name_hdr->encname)); - resp->resp_name.nametype = netbios_name_hdr->nametype; - resp->resp_name.type = netbios_name_hdr->type; - resp->resp_name.cls = netbios_name_hdr->cls; + MEMCPY( resp->resp_name.encname, netbios_question_hdr->encname, sizeof(netbios_question_hdr->encname)); + resp->resp_name.nametype = netbios_question_hdr->nametype; + resp->resp_name.type = netbios_question_hdr->type; + resp->resp_name.cls = netbios_question_hdr->cls; resp->resp_name.ttl = PP_HTONL(NETBIOS_NAME_TTL); resp->resp_name.datalen = PP_HTONS(sizeof(resp->resp_name.flags) + sizeof(resp->resp_name.addr)); resp->resp_name.flags = PP_HTONS(NETB_NFLAG_NODETYPE_BNODE); @@ -393,7 +409,7 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t } } #if LWIP_NETBIOS_RESPOND_NAME_QUERY - } else if (netbios_name_hdr->type == PP_HTONS(NETB_QTYPE_NBSTAT)) { + } else if (netbios_question_hdr->type == PP_HTONS(NETB_QTYPE_NBSTAT)) { /* if the packet is for us or general query */ if (!lwip_strnicmp(netbios_name, NETBIOS_LOCAL_NAME, sizeof(NETBIOS_LOCAL_NAME)) || !lwip_strnicmp(netbios_name, "*", sizeof(NETBIOS_LOCAL_NAME))) { @@ -419,9 +435,9 @@ netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t /* resp->answer_hdr.authorityRRs = PP_HTONS(0); done by memset() */ /* resp->answer_hdr.additionalRRs = PP_HTONS(0); done by memset() */ /* we will copy the length of the station name */ - resp->name_size = netbios_name_hdr->nametype; + resp->name_size = netbios_question_hdr->nametype; /* we will copy the queried name */ - MEMCPY(resp->query_name, netbios_name_hdr->encname, (NETBIOS_NAME_LEN * 2) + 1); + MEMCPY(resp->query_name, netbios_question_hdr->encname, (NETBIOS_NAME_LEN * 2) + 1); /* NBSTAT */ resp->packet_type = PP_HTONS(0x21); /* Internet name */ diff --git a/components/net/lwip-2.1.0/src/apps/ping/ping.c b/components/net/lwip-2.1.2/src/apps/ping/ping.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/ping/ping.c rename to components/net/lwip-2.1.2/src/apps/ping/ping.c diff --git a/components/net/lwip-2.1.0/src/apps/smtp/smtp.c b/components/net/lwip-2.1.2/src/apps/smtp/smtp.c similarity index 99% rename from components/net/lwip-2.1.0/src/apps/smtp/smtp.c rename to components/net/lwip-2.1.2/src/apps/smtp/smtp.c index 8a87533a6..55303c35d 100644 --- a/components/net/lwip-2.1.0/src/apps/smtp/smtp.c +++ b/components/net/lwip-2.1.2/src/apps/smtp/smtp.c @@ -65,7 +65,7 @@ #include "lwip/altcp_tcp.h" #include "lwip/altcp_tls.h" -#include /* strnlen, memcpy */ +#include /* strlen, memcpy */ #include /** TCP poll interval. Unit is 0.5 sec. */ @@ -353,9 +353,8 @@ smtp_set_server_addr(const char* server) LWIP_ASSERT_CORE_LOCKED(); if (server != NULL) { - /* strnlen: returns length WITHOUT terminating 0 byte OR - * SMTP_MAX_SERVERNAME_LEN+1 when string is too long */ - len = strnlen(server, SMTP_MAX_SERVERNAME_LEN+1); + /* strlen: returns length WITHOUT terminating 0 byte */ + len = strlen(server); } if (len > SMTP_MAX_SERVERNAME_LEN) { return ERR_MEM; diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_asn1.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_asn1.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_asn1.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_asn1.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_asn1.h b/components/net/lwip-2.1.2/src/apps/snmp/snmp_asn1.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_asn1.h rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_asn1.h diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_core.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_core.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_core.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_core.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_core_priv.h b/components/net/lwip-2.1.2/src/apps/snmp/snmp_core_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_core_priv.h rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_core_priv.h diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_icmp.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_icmp.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_icmp.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_icmp.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_interfaces.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_interfaces.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_interfaces.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_interfaces.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_ip.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_ip.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_ip.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_ip.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_snmp.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_snmp.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_snmp.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_snmp.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_system.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_system.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_system.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_system.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_tcp.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_tcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_tcp.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_tcp.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_udp.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_udp.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_mib2_udp.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_mib2_udp.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_msg.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_msg.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_msg.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_msg.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_msg.h b/components/net/lwip-2.1.2/src/apps/snmp/snmp_msg.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_msg.h rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_msg.h diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_netconn.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_netconn.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_netconn.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_netconn.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_pbuf_stream.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_pbuf_stream.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_pbuf_stream.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_pbuf_stream.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_pbuf_stream.h b/components/net/lwip-2.1.2/src/apps/snmp/snmp_pbuf_stream.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_pbuf_stream.h rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_pbuf_stream.h diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_raw.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_raw.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_raw.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_raw.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_scalar.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_scalar.c similarity index 94% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_scalar.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_scalar.c index 4c5b94020..094f52fe9 100644 --- a/components/net/lwip-2.1.0/src/apps/snmp/snmp_scalar.c +++ b/components/net/lwip-2.1.2/src/apps/snmp/snmp_scalar.c @@ -193,28 +193,40 @@ snmp_scalar_array_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, st static s16_t snmp_scalar_array_get_value(struct snmp_node_instance *instance, void *value) { + s16_t result = -1; const struct snmp_scalar_array_node *array_node = (const struct snmp_scalar_array_node *)(const void *)instance->node; const struct snmp_scalar_array_node_def *array_node_def = (const struct snmp_scalar_array_node_def *)instance->reference.const_ptr; - return array_node->get_value(array_node_def, value); + if (array_node->get_value != NULL) { + result = array_node->get_value(array_node_def, value); + } + return result; } static snmp_err_t snmp_scalar_array_set_test(struct snmp_node_instance *instance, u16_t value_len, void *value) { + snmp_err_t result = SNMP_ERR_NOTWRITABLE; const struct snmp_scalar_array_node *array_node = (const struct snmp_scalar_array_node *)(const void *)instance->node; const struct snmp_scalar_array_node_def *array_node_def = (const struct snmp_scalar_array_node_def *)instance->reference.const_ptr; - return array_node->set_test(array_node_def, value_len, value); + if (array_node->set_test != NULL) { + result = array_node->set_test(array_node_def, value_len, value); + } + return result; } static snmp_err_t snmp_scalar_array_set_value(struct snmp_node_instance *instance, u16_t value_len, void *value) { + snmp_err_t result = SNMP_ERR_NOTWRITABLE; const struct snmp_scalar_array_node *array_node = (const struct snmp_scalar_array_node *)(const void *)instance->node; const struct snmp_scalar_array_node_def *array_node_def = (const struct snmp_scalar_array_node_def *)instance->reference.const_ptr; - return array_node->set_value(array_node_def, value_len, value); + if (array_node->set_value != NULL) { + result = array_node->set_value(array_node_def, value_len, value); + } + return result; } #endif /* LWIP_SNMP */ diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_snmpv2_framework.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_snmpv2_framework.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_snmpv2_framework.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_snmpv2_framework.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_snmpv2_usm.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_snmpv2_usm.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_snmpv2_usm.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_snmpv2_usm.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_table.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_table.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_table.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_table.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_threadsync.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_threadsync.c similarity index 91% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_threadsync.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_threadsync.c index cfcfb2747..56d98862c 100644 --- a/components/net/lwip-2.1.0/src/apps/snmp/snmp_threadsync.c +++ b/components/net/lwip-2.1.2/src/apps/snmp/snmp_threadsync.c @@ -55,7 +55,11 @@ threadsync_get_value_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.s16 = call_data->proxy_instance.get_value(&call_data->proxy_instance, call_data->arg1.value); + if (call_data->proxy_instance.get_value != NULL) { + call_data->retval.s16 = call_data->proxy_instance.get_value(&call_data->proxy_instance, call_data->arg1.value); + } else { + call_data->retval.s16 = -1; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); } @@ -76,7 +80,11 @@ threadsync_set_test_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.err = call_data->proxy_instance.set_test(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + if (call_data->proxy_instance.set_test != NULL) { + call_data->retval.err = call_data->proxy_instance.set_test(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + } else { + call_data->retval.err = SNMP_ERR_NOTWRITABLE; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); } @@ -98,7 +106,11 @@ threadsync_set_value_synced(void *ctx) { struct threadsync_data *call_data = (struct threadsync_data *)ctx; - call_data->retval.err = call_data->proxy_instance.set_value(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + if (call_data->proxy_instance.set_value != NULL) { + call_data->retval.err = call_data->proxy_instance.set_value(&call_data->proxy_instance, call_data->arg2.len, call_data->arg1.value); + } else { + call_data->retval.err = SNMP_ERR_NOTWRITABLE; + } sys_sem_signal(&call_data->threadsync_node->instance->sem); } diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmp_traps.c b/components/net/lwip-2.1.2/src/apps/snmp/snmp_traps.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmp_traps.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmp_traps.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmpv3.c b/components/net/lwip-2.1.2/src/apps/snmp/snmpv3.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmpv3.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmpv3.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmpv3_mbedtls.c b/components/net/lwip-2.1.2/src/apps/snmp/snmpv3_mbedtls.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmpv3_mbedtls.c rename to components/net/lwip-2.1.2/src/apps/snmp/snmpv3_mbedtls.c diff --git a/components/net/lwip-2.1.0/src/apps/snmp/snmpv3_priv.h b/components/net/lwip-2.1.2/src/apps/snmp/snmpv3_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/apps/snmp/snmpv3_priv.h rename to components/net/lwip-2.1.2/src/apps/snmp/snmpv3_priv.h diff --git a/components/net/lwip-2.1.0/src/apps/sntp/sntp.c b/components/net/lwip-2.1.2/src/apps/sntp/sntp.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/sntp/sntp.c rename to components/net/lwip-2.1.2/src/apps/sntp/sntp.c diff --git a/components/net/lwip-2.1.0/src/apps/tftp/tftp_port.c b/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c similarity index 62% rename from components/net/lwip-2.1.0/src/apps/tftp/tftp_port.c rename to components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c index 129cc7da1..e14e34cfe 100644 --- a/components/net/lwip-2.1.0/src/apps/tftp/tftp_port.c +++ b/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c @@ -1,21 +1,7 @@ /* - * File : tftp_port.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/lwip-2.1.0/src/apps/tftp/tftp_server.c b/components/net/lwip-2.1.2/src/apps/tftp/tftp_server.c similarity index 100% rename from components/net/lwip-2.1.0/src/apps/tftp/tftp_server.c rename to components/net/lwip-2.1.2/src/apps/tftp/tftp_server.c diff --git a/components/net/lwip-2.1.0/src/arch/include/arch/bpstruct.h b/components/net/lwip-2.1.2/src/arch/include/arch/bpstruct.h similarity index 100% rename from components/net/lwip-2.1.0/src/arch/include/arch/bpstruct.h rename to components/net/lwip-2.1.2/src/arch/include/arch/bpstruct.h diff --git a/components/net/lwip-2.1.0/src/arch/include/arch/cc.h b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h similarity index 90% rename from components/net/lwip-2.1.0/src/arch/include/arch/cc.h rename to components/net/lwip-2.1.2/src/arch/include/arch/cc.h index 77a589276..49c7541ed 100644 --- a/components/net/lwip-2.1.0/src/arch/include/arch/cc.h +++ b/components/net/lwip-2.1.2/src/arch/include/arch/cc.h @@ -57,11 +57,9 @@ in arch.h has been assigned to another error code. */ #define ESHUTDOWN 180 #endif /* __CC_ARM/__IAR_SYSTEMS_ICC__ */ -#else -#define LWIP_PROVIDE_ERRNO -#endif +#endif /* RT_USING_LIBC */ -#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) +#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include #define LWIP_TIMEVAL_PRIVATE 0 #else @@ -73,6 +71,11 @@ #define PACK_STRUCT_STRUCT __attribute__ ((__packed__)) #define PACK_STRUCT_BEGIN #define PACK_STRUCT_END +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /*Arm Compiler 6*/ +#define PACK_STRUCT_FIELD(x) x +#define PACK_STRUCT_STRUCT __attribute__((packed)) +#define PACK_STRUCT_BEGIN +#define PACK_STRUCT_END #elif defined(__IAR_SYSTEMS_ICC__) /* IAR Compiler */ #define PACK_STRUCT_BEGIN #define PACK_STRUCT_STRUCT diff --git a/components/net/lwip-2.1.0/src/arch/include/arch/epstruct.h b/components/net/lwip-2.1.2/src/arch/include/arch/epstruct.h similarity index 100% rename from components/net/lwip-2.1.0/src/arch/include/arch/epstruct.h rename to components/net/lwip-2.1.2/src/arch/include/arch/epstruct.h diff --git a/components/net/lwip-2.1.0/src/arch/include/arch/perf.h b/components/net/lwip-2.1.2/src/arch/include/arch/perf.h similarity index 100% rename from components/net/lwip-2.1.0/src/arch/include/arch/perf.h rename to components/net/lwip-2.1.2/src/arch/include/arch/perf.h diff --git a/components/net/lwip-2.1.0/src/arch/include/arch/sys_arch.h b/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h similarity index 84% rename from components/net/lwip-2.1.0/src/arch/include/arch/sys_arch.h rename to components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h index 9c7e2d26c..1e97f8a5a 100644 --- a/components/net/lwip-2.1.0/src/arch/include/arch/sys_arch.h +++ b/components/net/lwip-2.1.2/src/arch/include/arch/sys_arch.h @@ -1,33 +1,33 @@ /* * Copyright (c) 2001, Swedish Institute of Computer Science. - * All rights reserved. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * * $Id: sys_arch.h,v 1.3 2005/03/13 16:03:23 bear Exp $ @@ -59,6 +59,6 @@ typedef rt_mutex_t sys_mutex_t; typedef rt_mailbox_t sys_mbox_t; typedef rt_thread_t sys_thread_t; -err_t sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg); +// err_t sys_mbox_trypost_fromisr(sys_mbox_t *q, void *msg); #endif /* __ARCH_SYS_ARCH_H__ */ diff --git a/components/net/lwip-2.1.0/src/arch/sys_arch.c b/components/net/lwip-2.1.2/src/arch/sys_arch.c similarity index 98% rename from components/net/lwip-2.1.0/src/arch/sys_arch.c rename to components/net/lwip-2.1.2/src/arch/sys_arch.c index dc08715ec..c97609a4e 100644 --- a/components/net/lwip-2.1.0/src/arch/sys_arch.c +++ b/components/net/lwip-2.1.2/src/arch/sys_arch.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (C) 2006-2018, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -27,12 +27,13 @@ * Change Logs: * Date Author Notes * 2012-12-8 Bernard add file header - * export bsd socket symbol for RT-Thread Application Module + * export bsd socket symbol for RT-Thread Application Module * 2017-11-15 Bernard add lock for init_done callback. * 2018-11-02 MurphyZhao port to lwip2.1.0 */ #include +#include #include "lwip/sys.h" #include "lwip/opt.h" @@ -78,7 +79,7 @@ static err_t netif_device_init(struct netif *netif) /* copy device flags to netif flags */ netif->flags = ethif->flags; netif->mtu = ETHERNET_MTU; - + /* set output */ netif->output = etharp_output; @@ -278,7 +279,7 @@ void sys_sem_signal(sys_sem_t *sem) * * @return If the timeout argument is non-zero, it will return the number of milliseconds * spent waiting for the semaphore to be signaled; If the semaphore isn't signaled - * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't + * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't * wait for the semaphore, it will return zero */ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) @@ -523,12 +524,9 @@ u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) } ret = rt_mb_recv(*mbox, (rt_ubase_t *)msg, t); - - if(ret == -RT_ETIMEOUT) - return SYS_ARCH_TIMEOUT; - else + if(ret != RT_EOK) { - LWIP_ASSERT("rt_mb_recv returned with error!", ret == RT_EOK); + return SYS_ARCH_TIMEOUT; } /* get elapse msecond */ @@ -559,7 +557,7 @@ u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) return SYS_ARCH_TIMEOUT; else { - if (ret == RT_EOK) + if (ret == RT_EOK) ret = 1; } @@ -644,7 +642,7 @@ u32_t sys_jiffies(void) u32_t sys_now(void) { - return rt_tick_get() * (1000 / RT_TICK_PER_SECOND); + return rt_tick_get_millisecond(); } #if MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK diff --git a/components/net/lwip-2.1.0/src/core/altcp.c b/components/net/lwip-2.1.2/src/core/altcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/altcp.c rename to components/net/lwip-2.1.2/src/core/altcp.c diff --git a/components/net/lwip-2.1.0/src/core/altcp_alloc.c b/components/net/lwip-2.1.2/src/core/altcp_alloc.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/altcp_alloc.c rename to components/net/lwip-2.1.2/src/core/altcp_alloc.c diff --git a/components/net/lwip-2.1.0/src/core/altcp_tcp.c b/components/net/lwip-2.1.2/src/core/altcp_tcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/altcp_tcp.c rename to components/net/lwip-2.1.2/src/core/altcp_tcp.c diff --git a/components/net/lwip-2.1.0/src/core/def.c b/components/net/lwip-2.1.2/src/core/def.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/def.c rename to components/net/lwip-2.1.2/src/core/def.c diff --git a/components/net/lwip-2.1.0/src/core/dns.c b/components/net/lwip-2.1.2/src/core/dns.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/dns.c rename to components/net/lwip-2.1.2/src/core/dns.c diff --git a/components/net/lwip-2.1.0/src/core/inet_chksum.c b/components/net/lwip-2.1.2/src/core/inet_chksum.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/inet_chksum.c rename to components/net/lwip-2.1.2/src/core/inet_chksum.c diff --git a/components/net/lwip-2.1.0/src/core/init.c b/components/net/lwip-2.1.2/src/core/init.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/init.c rename to components/net/lwip-2.1.2/src/core/init.c diff --git a/components/net/lwip-2.1.0/src/core/ip.c b/components/net/lwip-2.1.2/src/core/ip.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ip.c rename to components/net/lwip-2.1.2/src/core/ip.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/autoip.c b/components/net/lwip-2.1.2/src/core/ipv4/autoip.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/autoip.c rename to components/net/lwip-2.1.2/src/core/ipv4/autoip.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/dhcp.c b/components/net/lwip-2.1.2/src/core/ipv4/dhcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/dhcp.c rename to components/net/lwip-2.1.2/src/core/ipv4/dhcp.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/etharp.c b/components/net/lwip-2.1.2/src/core/ipv4/etharp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/etharp.c rename to components/net/lwip-2.1.2/src/core/ipv4/etharp.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/icmp.c b/components/net/lwip-2.1.2/src/core/ipv4/icmp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/icmp.c rename to components/net/lwip-2.1.2/src/core/ipv4/icmp.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/igmp.c b/components/net/lwip-2.1.2/src/core/ipv4/igmp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/igmp.c rename to components/net/lwip-2.1.2/src/core/ipv4/igmp.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/ip4.c b/components/net/lwip-2.1.2/src/core/ipv4/ip4.c similarity index 99% rename from components/net/lwip-2.1.0/src/core/ipv4/ip4.c rename to components/net/lwip-2.1.2/src/core/ipv4/ip4.c index ed8ebe33a..26c26a91a 100644 --- a/components/net/lwip-2.1.0/src/core/ipv4/ip4.c +++ b/components/net/lwip-2.1.2/src/core/ipv4/ip4.c @@ -214,7 +214,7 @@ ip4_route(const ip4_addr_t *dest) #endif /* !LWIP_SINGLE_NETIF */ if ((netif_default == NULL) || !netif_is_up(netif_default) || !netif_is_link_up(netif_default) || - ip4_addr_isany_val(*netif_ip4_addr(netif_default))) { + ip4_addr_isany_val(*netif_ip4_addr(netif_default)) || ip4_addr_isloopback(dest)) { /* No matching netif found and default netif is not usable. If this is not good enough for you, use LWIP_HOOK_IP4_ROUTE() */ LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip4_route: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", diff --git a/components/net/lwip-2.1.0/src/core/ipv4/ip4_addr.c b/components/net/lwip-2.1.2/src/core/ipv4/ip4_addr.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/ip4_addr.c rename to components/net/lwip-2.1.2/src/core/ipv4/ip4_addr.c diff --git a/components/net/lwip-2.1.0/src/core/ipv4/ip4_frag.c b/components/net/lwip-2.1.2/src/core/ipv4/ip4_frag.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv4/ip4_frag.c rename to components/net/lwip-2.1.2/src/core/ipv4/ip4_frag.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/dhcp6.c b/components/net/lwip-2.1.2/src/core/ipv6/dhcp6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/dhcp6.c rename to components/net/lwip-2.1.2/src/core/ipv6/dhcp6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/ethip6.c b/components/net/lwip-2.1.2/src/core/ipv6/ethip6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/ethip6.c rename to components/net/lwip-2.1.2/src/core/ipv6/ethip6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/icmp6.c b/components/net/lwip-2.1.2/src/core/ipv6/icmp6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/icmp6.c rename to components/net/lwip-2.1.2/src/core/ipv6/icmp6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/inet6.c b/components/net/lwip-2.1.2/src/core/ipv6/inet6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/inet6.c rename to components/net/lwip-2.1.2/src/core/ipv6/inet6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/ip6.c b/components/net/lwip-2.1.2/src/core/ipv6/ip6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/ip6.c rename to components/net/lwip-2.1.2/src/core/ipv6/ip6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/ip6_addr.c b/components/net/lwip-2.1.2/src/core/ipv6/ip6_addr.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/ip6_addr.c rename to components/net/lwip-2.1.2/src/core/ipv6/ip6_addr.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/ip6_frag.c b/components/net/lwip-2.1.2/src/core/ipv6/ip6_frag.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/ip6_frag.c rename to components/net/lwip-2.1.2/src/core/ipv6/ip6_frag.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/mld6.c b/components/net/lwip-2.1.2/src/core/ipv6/mld6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/mld6.c rename to components/net/lwip-2.1.2/src/core/ipv6/mld6.c diff --git a/components/net/lwip-2.1.0/src/core/ipv6/nd6.c b/components/net/lwip-2.1.2/src/core/ipv6/nd6.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/ipv6/nd6.c rename to components/net/lwip-2.1.2/src/core/ipv6/nd6.c diff --git a/components/net/lwip-2.1.0/src/core/mem.c b/components/net/lwip-2.1.2/src/core/mem.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/mem.c rename to components/net/lwip-2.1.2/src/core/mem.c diff --git a/components/net/lwip-2.1.0/src/core/memp.c b/components/net/lwip-2.1.2/src/core/memp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/memp.c rename to components/net/lwip-2.1.2/src/core/memp.c diff --git a/components/net/lwip-2.1.0/src/core/netif.c b/components/net/lwip-2.1.2/src/core/netif.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/netif.c rename to components/net/lwip-2.1.2/src/core/netif.c diff --git a/components/net/lwip-2.1.0/src/core/pbuf.c b/components/net/lwip-2.1.2/src/core/pbuf.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/pbuf.c rename to components/net/lwip-2.1.2/src/core/pbuf.c diff --git a/components/net/lwip-2.1.0/src/core/raw.c b/components/net/lwip-2.1.2/src/core/raw.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/raw.c rename to components/net/lwip-2.1.2/src/core/raw.c diff --git a/components/net/lwip-2.1.0/src/core/stats.c b/components/net/lwip-2.1.2/src/core/stats.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/stats.c rename to components/net/lwip-2.1.2/src/core/stats.c diff --git a/components/net/lwip-2.1.0/src/core/sys.c b/components/net/lwip-2.1.2/src/core/sys.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/sys.c rename to components/net/lwip-2.1.2/src/core/sys.c diff --git a/components/net/lwip-2.1.0/src/core/tcp.c b/components/net/lwip-2.1.2/src/core/tcp.c similarity index 99% rename from components/net/lwip-2.1.0/src/core/tcp.c rename to components/net/lwip-2.1.2/src/core/tcp.c index dcf2495c9..bd7d64ec3 100644 --- a/components/net/lwip-2.1.0/src/core/tcp.c +++ b/components/net/lwip-2.1.2/src/core/tcp.c @@ -583,6 +583,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) tcp_free(pcb); } else { int send_rst = 0; + u16_t local_port = 0; enum tcp_state last_state; seqno = pcb->snd_nxt; ackno = pcb->rcv_nxt; @@ -597,6 +598,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) } } else { send_rst = reset; + local_port = pcb->local_port; TCP_PCB_REMOVE_ACTIVE(pcb); } if (pcb->unacked != NULL) { @@ -613,7 +615,7 @@ tcp_abandon(struct tcp_pcb *pcb, int reset) tcp_backlog_accepted(pcb); if (send_rst) { LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n")); - tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, pcb->local_port, pcb->remote_port); + tcp_rst(pcb, seqno, ackno, &pcb->local_ip, &pcb->remote_ip, local_port, pcb->remote_port); } last_state = pcb->state; tcp_free(pcb); @@ -966,6 +968,7 @@ void tcp_recved(struct tcp_pcb *pcb, u16_t len) { u32_t wnd_inflation; + tcpwnd_size_t rcv_wnd; LWIP_ASSERT_CORE_LOCKED(); @@ -975,19 +978,13 @@ tcp_recved(struct tcp_pcb *pcb, u16_t len) LWIP_ASSERT("don't call tcp_recved for listen-pcbs", pcb->state != LISTEN); - pcb->rcv_wnd = (tcpwnd_size_t)(pcb->rcv_wnd + len); - if (pcb->rcv_wnd > TCP_WND_MAX(pcb)) { + rcv_wnd = (tcpwnd_size_t)(pcb->rcv_wnd + len); + if ((rcv_wnd > TCP_WND_MAX(pcb)) || (rcv_wnd < pcb->rcv_wnd)) { + /* window got too big or tcpwnd_size_t overflow */ + LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: window got too big or tcpwnd_size_t overflow\n")); pcb->rcv_wnd = TCP_WND_MAX(pcb); - } else if (pcb->rcv_wnd == 0) { - /* rcv_wnd overflowed */ - if (TCP_STATE_IS_CLOSING(pcb->state)) { - /* In passive close, we allow this, since the FIN bit is added to rcv_wnd - by the stack itself, since it is not mandatory for an application - to call tcp_recved() for the FIN bit, but e.g. the netconn API does so. */ - pcb->rcv_wnd = TCP_WND_MAX(pcb); - } else { - LWIP_ASSERT("tcp_recved: len wrapped rcv_wnd\n", 0); - } + } else { + pcb->rcv_wnd = rcv_wnd; } wnd_inflation = tcp_update_rcv_ann_wnd(pcb); @@ -1219,6 +1216,7 @@ tcp_slowtmr(void) LWIP_ASSERT("tcp_slowtmr: active pcb->state != TIME-WAIT\n", pcb->state != TIME_WAIT); if (pcb->last_timer == tcp_timer_ctr) { /* skip this pcb, we have already processed it */ + prev = pcb; pcb = pcb->next; continue; } diff --git a/components/net/lwip-2.1.0/src/core/tcp_in.c b/components/net/lwip-2.1.2/src/core/tcp_in.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/tcp_in.c rename to components/net/lwip-2.1.2/src/core/tcp_in.c diff --git a/components/net/lwip-2.1.0/src/core/tcp_out.c b/components/net/lwip-2.1.2/src/core/tcp_out.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/tcp_out.c rename to components/net/lwip-2.1.2/src/core/tcp_out.c diff --git a/components/net/lwip-2.1.0/src/core/timeouts.c b/components/net/lwip-2.1.2/src/core/timeouts.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/timeouts.c rename to components/net/lwip-2.1.2/src/core/timeouts.c diff --git a/components/net/lwip-2.1.0/src/core/udp.c b/components/net/lwip-2.1.2/src/core/udp.c similarity index 100% rename from components/net/lwip-2.1.0/src/core/udp.c rename to components/net/lwip-2.1.2/src/core/udp.c diff --git a/components/net/lwip-2.1.0/src/include/compat/posix/arpa/inet.h b/components/net/lwip-2.1.2/src/include/compat/posix/arpa/inet.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/compat/posix/arpa/inet.h rename to components/net/lwip-2.1.2/src/include/compat/posix/arpa/inet.h diff --git a/components/net/lwip-2.1.0/src/include/compat/posix/net/if.h b/components/net/lwip-2.1.2/src/include/compat/posix/net/if.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/compat/posix/net/if.h rename to components/net/lwip-2.1.2/src/include/compat/posix/net/if.h diff --git a/components/net/lwip-2.1.0/src/include/compat/posix/netdb.h b/components/net/lwip-2.1.2/src/include/compat/posix/netdb.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/compat/posix/netdb.h rename to components/net/lwip-2.1.2/src/include/compat/posix/netdb.h diff --git a/components/net/lwip-2.1.0/src/include/compat/posix/sys/socket.h b/components/net/lwip-2.1.2/src/include/compat/posix/sys/socket.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/compat/posix/sys/socket.h rename to components/net/lwip-2.1.2/src/include/compat/posix/sys/socket.h diff --git a/components/net/lwip-2.1.0/src/include/compat/stdc/errno.h b/components/net/lwip-2.1.2/src/include/compat/stdc/errno.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/compat/stdc/errno.h rename to components/net/lwip-2.1.2/src/include/compat/stdc/errno.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/altcp.h b/components/net/lwip-2.1.2/src/include/lwip/altcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/altcp.h rename to components/net/lwip-2.1.2/src/include/lwip/altcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/altcp_tcp.h b/components/net/lwip-2.1.2/src/include/lwip/altcp_tcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/altcp_tcp.h rename to components/net/lwip-2.1.2/src/include/lwip/altcp_tcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/altcp_tls.h b/components/net/lwip-2.1.2/src/include/lwip/altcp_tls.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/altcp_tls.h rename to components/net/lwip-2.1.2/src/include/lwip/altcp_tls.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/api.h b/components/net/lwip-2.1.2/src/include/lwip/api.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/api.h rename to components/net/lwip-2.1.2/src/include/lwip/api.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/FILES b/components/net/lwip-2.1.2/src/include/lwip/apps/FILES similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/FILES rename to components/net/lwip-2.1.2/src/include/lwip/apps/FILES diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/altcp_proxyconnect.h b/components/net/lwip-2.1.2/src/include/lwip/apps/altcp_proxyconnect.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/altcp_proxyconnect.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/altcp_proxyconnect.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/altcp_tls_mbedtls_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/altcp_tls_mbedtls_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/altcp_tls_mbedtls_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/altcp_tls_mbedtls_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/fs.h b/components/net/lwip-2.1.2/src/include/lwip/apps/fs.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/fs.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/fs.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/http_client.h b/components/net/lwip-2.1.2/src/include/lwip/apps/http_client.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/http_client.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/http_client.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/httpd.h b/components/net/lwip-2.1.2/src/include/lwip/apps/httpd.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/httpd.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/httpd.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/httpd_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/httpd_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/httpd_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/httpd_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/lwiperf.h b/components/net/lwip-2.1.2/src/include/lwip/apps/lwiperf.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/lwiperf.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/lwiperf.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mdns.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mdns.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mdns.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mdns.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mdns_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mdns_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mdns_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mdns_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mdns_priv.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mdns_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mdns_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mdns_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mqtt.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mqtt.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mqtt.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mqtt.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mqtt_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mqtt_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mqtt_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mqtt_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/mqtt_priv.h b/components/net/lwip-2.1.2/src/include/lwip/apps/mqtt_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/mqtt_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/mqtt_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/netbiosns.h b/components/net/lwip-2.1.2/src/include/lwip/apps/netbiosns.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/netbiosns.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/netbiosns.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/netbiosns_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/netbiosns_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/netbiosns_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/netbiosns_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/smtp.h b/components/net/lwip-2.1.2/src/include/lwip/apps/smtp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/smtp.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/smtp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/smtp_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/smtp_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/smtp_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/smtp_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_core.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_core.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_core.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_core.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_mib2.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_mib2.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_mib2.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_mib2.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_scalar.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_scalar.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_scalar.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_scalar.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_snmpv2_framework.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_snmpv2_framework.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_snmpv2_framework.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_snmpv2_framework.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_snmpv2_usm.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_snmpv2_usm.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_snmpv2_usm.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_snmpv2_usm.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_table.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_table.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_table.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_table.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmp_threadsync.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmp_threadsync.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmp_threadsync.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmp_threadsync.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/snmpv3.h b/components/net/lwip-2.1.2/src/include/lwip/apps/snmpv3.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/snmpv3.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/snmpv3.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/sntp.h b/components/net/lwip-2.1.2/src/include/lwip/apps/sntp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/sntp.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/sntp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/sntp_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/sntp_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/sntp_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/sntp_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/tftp_opts.h b/components/net/lwip-2.1.2/src/include/lwip/apps/tftp_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/tftp_opts.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/tftp_opts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/apps/tftp_server.h b/components/net/lwip-2.1.2/src/include/lwip/apps/tftp_server.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/apps/tftp_server.h rename to components/net/lwip-2.1.2/src/include/lwip/apps/tftp_server.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/arch.h b/components/net/lwip-2.1.2/src/include/lwip/arch.h similarity index 99% rename from components/net/lwip-2.1.0/src/include/lwip/arch.h rename to components/net/lwip-2.1.2/src/include/lwip/arch.h index 58dae33aa..1606d4faa 100644 --- a/components/net/lwip-2.1.0/src/include/lwip/arch.h +++ b/components/net/lwip-2.1.2/src/include/lwip/arch.h @@ -196,7 +196,9 @@ typedef uintptr_t mem_ptr_t; #define LWIP_NO_UNISTD_H 0 #endif #if !LWIP_NO_UNISTD_H -#include +#include "sys/types.h" +#else +typedef int ssize_t; #endif #else /* SSIZE_MAX */ typedef int ssize_t; diff --git a/components/net/lwip-2.1.0/src/include/lwip/autoip.h b/components/net/lwip-2.1.2/src/include/lwip/autoip.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/autoip.h rename to components/net/lwip-2.1.2/src/include/lwip/autoip.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/debug.h b/components/net/lwip-2.1.2/src/include/lwip/debug.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/debug.h rename to components/net/lwip-2.1.2/src/include/lwip/debug.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/def.h b/components/net/lwip-2.1.2/src/include/lwip/def.h similarity index 94% rename from components/net/lwip-2.1.0/src/include/lwip/def.h rename to components/net/lwip-2.1.2/src/include/lwip/def.h index 3d6e107e3..dfb266d18 100644 --- a/components/net/lwip-2.1.0/src/include/lwip/def.h +++ b/components/net/lwip-2.1.2/src/include/lwip/def.h @@ -83,14 +83,14 @@ extern "C" { #endif #if BYTE_ORDER == BIG_ENDIAN -#define lwip_htons(x) (x) -#define lwip_ntohs(x) (x) -#define lwip_htonl(x) (x) -#define lwip_ntohl(x) (x) -#define PP_HTONS(x) (x) -#define PP_NTOHS(x) (x) -#define PP_HTONL(x) (x) -#define PP_NTOHL(x) (x) +#define lwip_htons(x) ((u16_t)(x)) +#define lwip_ntohs(x) ((u16_t)(x)) +#define lwip_htonl(x) ((u32_t)(x)) +#define lwip_ntohl(x) ((u32_t)(x)) +#define PP_HTONS(x) ((u16_t)(x)) +#define PP_NTOHS(x) ((u16_t)(x)) +#define PP_HTONL(x) ((u32_t)(x)) +#define PP_NTOHL(x) ((u32_t)(x)) #else /* BYTE_ORDER != BIG_ENDIAN */ #ifndef lwip_htons u16_t lwip_htons(u16_t x); diff --git a/components/net/lwip-2.1.0/src/include/lwip/dhcp.h b/components/net/lwip-2.1.2/src/include/lwip/dhcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/dhcp.h rename to components/net/lwip-2.1.2/src/include/lwip/dhcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/dhcp6.h b/components/net/lwip-2.1.2/src/include/lwip/dhcp6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/dhcp6.h rename to components/net/lwip-2.1.2/src/include/lwip/dhcp6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/dns.h b/components/net/lwip-2.1.2/src/include/lwip/dns.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/dns.h rename to components/net/lwip-2.1.2/src/include/lwip/dns.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/err.h b/components/net/lwip-2.1.2/src/include/lwip/err.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/err.h rename to components/net/lwip-2.1.2/src/include/lwip/err.h index 777309877..887d9b3fd 100644 --- a/components/net/lwip-2.1.0/src/include/lwip/err.h +++ b/components/net/lwip-2.1.2/src/include/lwip/err.h @@ -49,14 +49,6 @@ extern "C" { * @{ */ -/** Define LWIP_ERR_T in cc.h if you want to use - * a different type for your platform (must be signed). */ -#ifdef LWIP_ERR_T -typedef LWIP_ERR_T err_t; -#else /* LWIP_ERR_T */ -typedef s8_t err_t; -#endif /* LWIP_ERR_T*/ - /** Definitions for error constants. */ typedef enum { /** No error, everything OK. */ @@ -96,6 +88,14 @@ typedef enum { ERR_ARG = -16 } err_enum_t; +/** Define LWIP_ERR_T in cc.h if you want to use + * a different type for your platform (must be signed). */ +#ifdef LWIP_ERR_T +typedef LWIP_ERR_T err_t; +#else /* LWIP_ERR_T */ +typedef s8_t err_t; +#endif /* LWIP_ERR_T*/ + /** * @} */ diff --git a/components/net/lwip-2.1.0/src/include/lwip/errno.h b/components/net/lwip-2.1.2/src/include/lwip/errno.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/errno.h rename to components/net/lwip-2.1.2/src/include/lwip/errno.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/etharp.h b/components/net/lwip-2.1.2/src/include/lwip/etharp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/etharp.h rename to components/net/lwip-2.1.2/src/include/lwip/etharp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ethip6.h b/components/net/lwip-2.1.2/src/include/lwip/ethip6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ethip6.h rename to components/net/lwip-2.1.2/src/include/lwip/ethip6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/icmp.h b/components/net/lwip-2.1.2/src/include/lwip/icmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/icmp.h rename to components/net/lwip-2.1.2/src/include/lwip/icmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/icmp6.h b/components/net/lwip-2.1.2/src/include/lwip/icmp6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/icmp6.h rename to components/net/lwip-2.1.2/src/include/lwip/icmp6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/if_api.h b/components/net/lwip-2.1.2/src/include/lwip/if_api.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/if_api.h rename to components/net/lwip-2.1.2/src/include/lwip/if_api.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/igmp.h b/components/net/lwip-2.1.2/src/include/lwip/igmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/igmp.h rename to components/net/lwip-2.1.2/src/include/lwip/igmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/inet.h b/components/net/lwip-2.1.2/src/include/lwip/inet.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/inet.h rename to components/net/lwip-2.1.2/src/include/lwip/inet.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/inet_chksum.h b/components/net/lwip-2.1.2/src/include/lwip/inet_chksum.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/inet_chksum.h rename to components/net/lwip-2.1.2/src/include/lwip/inet_chksum.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/init.h b/components/net/lwip-2.1.2/src/include/lwip/init.h similarity index 99% rename from components/net/lwip-2.1.0/src/include/lwip/init.h rename to components/net/lwip-2.1.2/src/include/lwip/init.h index 41f1f2f7a..b2c385c3b 100644 --- a/components/net/lwip-2.1.0/src/include/lwip/init.h +++ b/components/net/lwip-2.1.2/src/include/lwip/init.h @@ -54,7 +54,7 @@ extern "C" { /** x.X.x: Minor version of the stack */ #define LWIP_VERSION_MINOR 1U /** x.x.X: Revision of the stack */ -#define LWIP_VERSION_REVISION 0U +#define LWIP_VERSION_REVISION 2U /** For release candidates, this is set to 1..254 * For official releases, this is set to 255 (LWIP_RC_RELEASE) * For development versions (Git), this is set to 0 (LWIP_RC_DEVELOPMENT) */ diff --git a/components/net/lwip-2.1.0/src/include/lwip/init.h.cmake.in b/components/net/lwip-2.1.2/src/include/lwip/init.h.cmake.in similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/init.h.cmake.in rename to components/net/lwip-2.1.2/src/include/lwip/init.h.cmake.in diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip.h b/components/net/lwip-2.1.2/src/include/lwip/ip.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip.h rename to components/net/lwip-2.1.2/src/include/lwip/ip.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip4.h b/components/net/lwip-2.1.2/src/include/lwip/ip4.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip4.h rename to components/net/lwip-2.1.2/src/include/lwip/ip4.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip4_addr.h b/components/net/lwip-2.1.2/src/include/lwip/ip4_addr.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip4_addr.h rename to components/net/lwip-2.1.2/src/include/lwip/ip4_addr.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip4_frag.h b/components/net/lwip-2.1.2/src/include/lwip/ip4_frag.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip4_frag.h rename to components/net/lwip-2.1.2/src/include/lwip/ip4_frag.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip6.h b/components/net/lwip-2.1.2/src/include/lwip/ip6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip6.h rename to components/net/lwip-2.1.2/src/include/lwip/ip6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip6_addr.h b/components/net/lwip-2.1.2/src/include/lwip/ip6_addr.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip6_addr.h rename to components/net/lwip-2.1.2/src/include/lwip/ip6_addr.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip6_frag.h b/components/net/lwip-2.1.2/src/include/lwip/ip6_frag.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip6_frag.h rename to components/net/lwip-2.1.2/src/include/lwip/ip6_frag.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip6_zone.h b/components/net/lwip-2.1.2/src/include/lwip/ip6_zone.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip6_zone.h rename to components/net/lwip-2.1.2/src/include/lwip/ip6_zone.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/ip_addr.h b/components/net/lwip-2.1.2/src/include/lwip/ip_addr.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/ip_addr.h rename to components/net/lwip-2.1.2/src/include/lwip/ip_addr.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/mem.h b/components/net/lwip-2.1.2/src/include/lwip/mem.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/mem.h rename to components/net/lwip-2.1.2/src/include/lwip/mem.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/memp.h b/components/net/lwip-2.1.2/src/include/lwip/memp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/memp.h rename to components/net/lwip-2.1.2/src/include/lwip/memp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/mld6.h b/components/net/lwip-2.1.2/src/include/lwip/mld6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/mld6.h rename to components/net/lwip-2.1.2/src/include/lwip/mld6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/nd6.h b/components/net/lwip-2.1.2/src/include/lwip/nd6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/nd6.h rename to components/net/lwip-2.1.2/src/include/lwip/nd6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/netbuf.h b/components/net/lwip-2.1.2/src/include/lwip/netbuf.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/netbuf.h rename to components/net/lwip-2.1.2/src/include/lwip/netbuf.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/netdb.h b/components/net/lwip-2.1.2/src/include/lwip/netdb.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/netdb.h rename to components/net/lwip-2.1.2/src/include/lwip/netdb.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/netif.h b/components/net/lwip-2.1.2/src/include/lwip/netif.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/netif.h rename to components/net/lwip-2.1.2/src/include/lwip/netif.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/netifapi.h b/components/net/lwip-2.1.2/src/include/lwip/netifapi.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/netifapi.h rename to components/net/lwip-2.1.2/src/include/lwip/netifapi.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/opt.h b/components/net/lwip-2.1.2/src/include/lwip/opt.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/opt.h rename to components/net/lwip-2.1.2/src/include/lwip/opt.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/pbuf.h b/components/net/lwip-2.1.2/src/include/lwip/pbuf.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/pbuf.h rename to components/net/lwip-2.1.2/src/include/lwip/pbuf.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/altcp_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/altcp_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/altcp_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/altcp_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/api_msg.h b/components/net/lwip-2.1.2/src/include/lwip/priv/api_msg.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/api_msg.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/api_msg.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/mem_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/mem_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/mem_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/mem_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/memp_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/memp_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/memp_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/memp_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/memp_std.h b/components/net/lwip-2.1.2/src/include/lwip/priv/memp_std.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/memp_std.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/memp_std.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/nd6_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/nd6_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/nd6_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/nd6_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/raw_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/raw_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/raw_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/raw_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/sockets_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/sockets_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/sockets_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/sockets_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/tcp_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/tcp_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/tcp_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/tcp_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/priv/tcpip_priv.h b/components/net/lwip-2.1.2/src/include/lwip/priv/tcpip_priv.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/priv/tcpip_priv.h rename to components/net/lwip-2.1.2/src/include/lwip/priv/tcpip_priv.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/autoip.h b/components/net/lwip-2.1.2/src/include/lwip/prot/autoip.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/autoip.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/autoip.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/dhcp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/dhcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/dhcp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/dhcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/dhcp6.h b/components/net/lwip-2.1.2/src/include/lwip/prot/dhcp6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/dhcp6.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/dhcp6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/dns.h b/components/net/lwip-2.1.2/src/include/lwip/prot/dns.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/dns.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/dns.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/etharp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/etharp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/etharp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/etharp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/ethernet.h b/components/net/lwip-2.1.2/src/include/lwip/prot/ethernet.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/ethernet.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/ethernet.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/iana.h b/components/net/lwip-2.1.2/src/include/lwip/prot/iana.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/iana.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/iana.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/icmp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/icmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/icmp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/icmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/icmp6.h b/components/net/lwip-2.1.2/src/include/lwip/prot/icmp6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/icmp6.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/icmp6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/ieee.h b/components/net/lwip-2.1.2/src/include/lwip/prot/ieee.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/ieee.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/ieee.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/igmp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/igmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/igmp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/igmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/ip.h b/components/net/lwip-2.1.2/src/include/lwip/prot/ip.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/ip.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/ip.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/ip4.h b/components/net/lwip-2.1.2/src/include/lwip/prot/ip4.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/ip4.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/ip4.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/ip6.h b/components/net/lwip-2.1.2/src/include/lwip/prot/ip6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/ip6.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/ip6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/mld6.h b/components/net/lwip-2.1.2/src/include/lwip/prot/mld6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/mld6.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/mld6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/nd6.h b/components/net/lwip-2.1.2/src/include/lwip/prot/nd6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/nd6.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/nd6.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/tcp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/tcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/tcp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/tcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/prot/udp.h b/components/net/lwip-2.1.2/src/include/lwip/prot/udp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/prot/udp.h rename to components/net/lwip-2.1.2/src/include/lwip/prot/udp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/raw.h b/components/net/lwip-2.1.2/src/include/lwip/raw.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/raw.h rename to components/net/lwip-2.1.2/src/include/lwip/raw.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/sio.h b/components/net/lwip-2.1.2/src/include/lwip/sio.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/sio.h rename to components/net/lwip-2.1.2/src/include/lwip/sio.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/snmp.h b/components/net/lwip-2.1.2/src/include/lwip/snmp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/snmp.h rename to components/net/lwip-2.1.2/src/include/lwip/snmp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/sockets.h b/components/net/lwip-2.1.2/src/include/lwip/sockets.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/sockets.h rename to components/net/lwip-2.1.2/src/include/lwip/sockets.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/stats.h b/components/net/lwip-2.1.2/src/include/lwip/stats.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/stats.h rename to components/net/lwip-2.1.2/src/include/lwip/stats.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/sys.h b/components/net/lwip-2.1.2/src/include/lwip/sys.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/sys.h rename to components/net/lwip-2.1.2/src/include/lwip/sys.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/tcp.h b/components/net/lwip-2.1.2/src/include/lwip/tcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/tcp.h rename to components/net/lwip-2.1.2/src/include/lwip/tcp.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/tcpbase.h b/components/net/lwip-2.1.2/src/include/lwip/tcpbase.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/tcpbase.h rename to components/net/lwip-2.1.2/src/include/lwip/tcpbase.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/tcpip.h b/components/net/lwip-2.1.2/src/include/lwip/tcpip.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/tcpip.h rename to components/net/lwip-2.1.2/src/include/lwip/tcpip.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/timeouts.h b/components/net/lwip-2.1.2/src/include/lwip/timeouts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/timeouts.h rename to components/net/lwip-2.1.2/src/include/lwip/timeouts.h diff --git a/components/net/lwip-2.1.0/src/include/lwip/udp.h b/components/net/lwip-2.1.2/src/include/lwip/udp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/lwip/udp.h rename to components/net/lwip-2.1.2/src/include/lwip/udp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/bridgeif.h b/components/net/lwip-2.1.2/src/include/netif/bridgeif.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/bridgeif.h rename to components/net/lwip-2.1.2/src/include/netif/bridgeif.h diff --git a/components/net/lwip-2.1.0/src/include/netif/bridgeif_opts.h b/components/net/lwip-2.1.2/src/include/netif/bridgeif_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/bridgeif_opts.h rename to components/net/lwip-2.1.2/src/include/netif/bridgeif_opts.h diff --git a/components/net/lwip-2.1.0/src/include/netif/etharp.h b/components/net/lwip-2.1.2/src/include/netif/etharp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/etharp.h rename to components/net/lwip-2.1.2/src/include/netif/etharp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ethernet.h b/components/net/lwip-2.1.2/src/include/netif/ethernet.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ethernet.h rename to components/net/lwip-2.1.2/src/include/netif/ethernet.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ethernetif.h b/components/net/lwip-2.1.2/src/include/netif/ethernetif.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ethernetif.h rename to components/net/lwip-2.1.2/src/include/netif/ethernetif.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ieee802154.h b/components/net/lwip-2.1.2/src/include/netif/ieee802154.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ieee802154.h rename to components/net/lwip-2.1.2/src/include/netif/ieee802154.h diff --git a/components/net/lwip-2.1.0/src/include/netif/lowpan6.h b/components/net/lwip-2.1.2/src/include/netif/lowpan6.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/lowpan6.h rename to components/net/lwip-2.1.2/src/include/netif/lowpan6.h diff --git a/components/net/lwip-2.1.0/src/include/netif/lowpan6_ble.h b/components/net/lwip-2.1.2/src/include/netif/lowpan6_ble.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/lowpan6_ble.h rename to components/net/lwip-2.1.2/src/include/netif/lowpan6_ble.h diff --git a/components/net/lwip-2.1.0/src/include/netif/lowpan6_common.h b/components/net/lwip-2.1.2/src/include/netif/lowpan6_common.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/lowpan6_common.h rename to components/net/lwip-2.1.2/src/include/netif/lowpan6_common.h diff --git a/components/net/lwip-2.1.0/src/include/netif/lowpan6_opts.h b/components/net/lwip-2.1.2/src/include/netif/lowpan6_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/lowpan6_opts.h rename to components/net/lwip-2.1.2/src/include/netif/lowpan6_opts.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ccp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ccp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ccp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ccp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/chap-md5.h b/components/net/lwip-2.1.2/src/include/netif/ppp/chap-md5.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/chap-md5.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/chap-md5.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/chap-new.h b/components/net/lwip-2.1.2/src/include/netif/ppp/chap-new.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/chap-new.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/chap-new.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/chap_ms.h b/components/net/lwip-2.1.2/src/include/netif/ppp/chap_ms.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/chap_ms.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/chap_ms.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/eap.h b/components/net/lwip-2.1.2/src/include/netif/ppp/eap.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/eap.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/eap.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ecp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ecp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ecp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ecp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/eui64.h b/components/net/lwip-2.1.2/src/include/netif/ppp/eui64.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/eui64.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/eui64.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/fsm.h b/components/net/lwip-2.1.2/src/include/netif/ppp/fsm.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/fsm.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/fsm.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ipcp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ipcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ipcp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ipcp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ipv6cp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ipv6cp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ipv6cp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ipv6cp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/lcp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/lcp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/lcp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/lcp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/magic.h b/components/net/lwip-2.1.2/src/include/netif/ppp/magic.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/magic.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/magic.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/mppe.h b/components/net/lwip-2.1.2/src/include/netif/ppp/mppe.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/mppe.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/mppe.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/arc4.h b/components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/arc4.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/arc4.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/arc4.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/des.h b/components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/des.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/des.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/des.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/md4.h b/components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/md4.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/md4.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/md4.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/md5.h b/components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/md5.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/md5.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/md5.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/sha1.h b/components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/sha1.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/polarssl/sha1.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/polarssl/sha1.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ppp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ppp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ppp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ppp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ppp_impl.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ppp_impl.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ppp_impl.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ppp_impl.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/ppp_opts.h b/components/net/lwip-2.1.2/src/include/netif/ppp/ppp_opts.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/ppp_opts.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/ppp_opts.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppapi.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppapi.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppapi.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppapi.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppcrypt.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppcrypt.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppcrypt.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppcrypt.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppdebug.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppdebug.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppdebug.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppdebug.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppoe.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppoe.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppoe.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppoe.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppol2tp.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppol2tp.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppol2tp.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppol2tp.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/pppos.h b/components/net/lwip-2.1.2/src/include/netif/ppp/pppos.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/pppos.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/pppos.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/upap.h b/components/net/lwip-2.1.2/src/include/netif/ppp/upap.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/upap.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/upap.h diff --git a/components/net/lwip-2.1.0/src/include/netif/ppp/vj.h b/components/net/lwip-2.1.2/src/include/netif/ppp/vj.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/ppp/vj.h rename to components/net/lwip-2.1.2/src/include/netif/ppp/vj.h diff --git a/components/net/lwip-2.1.0/src/include/netif/slipif.h b/components/net/lwip-2.1.2/src/include/netif/slipif.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/slipif.h rename to components/net/lwip-2.1.2/src/include/netif/slipif.h diff --git a/components/net/lwip-2.1.0/src/include/netif/zepif.h b/components/net/lwip-2.1.2/src/include/netif/zepif.h similarity index 100% rename from components/net/lwip-2.1.0/src/include/netif/zepif.h rename to components/net/lwip-2.1.2/src/include/netif/zepif.h diff --git a/components/net/lwip-2.1.0/src/lwipopts.h b/components/net/lwip-2.1.2/src/lwipopts.h similarity index 98% rename from components/net/lwip-2.1.0/src/lwipopts.h rename to components/net/lwip-2.1.2/src/lwipopts.h index 405e95ce6..220bb6fa4 100644 --- a/components/net/lwip-2.1.0/src/lwipopts.h +++ b/components/net/lwip-2.1.2/src/lwipopts.h @@ -236,6 +236,12 @@ # define SSIZE_MAX LONG_MAX # endif +#ifdef RT_USING_LIBC +#define LWIP_NO_UNISTD_H 0 +#else +#define LWIP_NO_UNISTD_H 1 +#endif + /* ---------- Memory options ---------- */ #define MEM_ALIGNMENT 4 #define MEMP_OVERFLOW_CHECK 1 //// @@ -538,6 +544,13 @@ #define LWIP_TCP_KEEPALIVE 1 #endif +/** + * LWIP_NETIF_HOSTNAME==1: Support netif hostname + */ +#ifndef LWIP_NETIF_HOSTNAME +#define LWIP_NETIF_HOSTNAME 1 +#endif + /** * LWIP_NETIF_API==1: Support netif api (in netifapi.c) */ diff --git a/components/net/lwip-2.1.0/src/lwippools.h b/components/net/lwip-2.1.2/src/lwippools.h similarity index 100% rename from components/net/lwip-2.1.0/src/lwippools.h rename to components/net/lwip-2.1.2/src/lwippools.h diff --git a/components/net/lwip-2.1.0/src/netif/FILES b/components/net/lwip-2.1.2/src/netif/FILES similarity index 100% rename from components/net/lwip-2.1.0/src/netif/FILES rename to components/net/lwip-2.1.2/src/netif/FILES diff --git a/components/net/lwip-2.1.0/src/netif/bridgeif.c b/components/net/lwip-2.1.2/src/netif/bridgeif.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/bridgeif.c rename to components/net/lwip-2.1.2/src/netif/bridgeif.c diff --git a/components/net/lwip-2.1.0/src/netif/bridgeif_fdb.c b/components/net/lwip-2.1.2/src/netif/bridgeif_fdb.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/bridgeif_fdb.c rename to components/net/lwip-2.1.2/src/netif/bridgeif_fdb.c diff --git a/components/net/lwip-2.1.0/src/netif/ethernet.c b/components/net/lwip-2.1.2/src/netif/ethernet.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ethernet.c rename to components/net/lwip-2.1.2/src/netif/ethernet.c diff --git a/components/net/lwip-2.1.0/src/netif/ethernetif.c b/components/net/lwip-2.1.2/src/netif/ethernetif.c similarity index 94% rename from components/net/lwip-2.1.0/src/netif/ethernetif.c rename to components/net/lwip-2.1.2/src/netif/ethernetif.c index 66ea1d237..829978c13 100644 --- a/components/net/lwip-2.1.0/src/netif/ethernetif.c +++ b/components/net/lwip-2.1.2/src/netif/ethernetif.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * COPYRIGHT (C) 2006-2018, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, @@ -41,8 +41,6 @@ * 2018-11-02 MurphyZhao port to lwIP 2.1.0 */ -#include "lwip/opt.h" - #include "lwip/opt.h" #include "lwip/debug.h" #include "lwip/def.h" @@ -165,6 +163,16 @@ static int lwip_netdev_set_dns_server(struct netdev *netif, uint8_t dns_num, ip_ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) { netdev_low_level_set_dhcp_status(netif, is_enabled); + + if(RT_TRUE == is_enabled) + { + dhcp_start((struct netif *)netif->user_data); + } + else + { + dhcp_stop((struct netif *)netif->user_data); + } + return ERR_OK; } #endif /* RT_LWIP_DHCP */ @@ -174,7 +182,7 @@ static int lwip_netdev_set_dhcp(struct netdev *netif, rt_bool_t is_enabled) extern int lwip_ping_recv(int s, int *ttl); extern err_t lwip_ping_send(int s, ip_addr_t *addr, int size); -int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, +int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, uint32_t timeout, struct netdev_ping_resp *ping_resp) { int s, ttl, recv_len, result = 0; @@ -189,7 +197,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, struct addrinfo hint, *res = RT_NULL; struct sockaddr_in *h = RT_NULL; struct in_addr ina; - + RT_ASSERT(netif); RT_ASSERT(host); RT_ASSERT(ping_resp); @@ -208,7 +216,7 @@ int lwip_netdev_ping(struct netdev *netif, const char *host, size_t data_len, return -RT_ERROR; } rt_memcpy(&(ping_resp->ip_addr), &target_addr, sizeof(ip_addr_t)); - + /* new a socket */ if ((s = lwip_socket(AF_INET, SOCK_RAW, IP_PROTO_ICMP)) < 0) { @@ -276,7 +284,7 @@ const struct netdev_ops lwip_netdev_ops = lwip_netdev_set_addr_info, #ifdef RT_LWIP_DNS lwip_netdev_set_dns_server, -#else +#else NULL, #endif /* RT_LWIP_DNS */ @@ -315,7 +323,7 @@ static int netdev_add(struct netif *lwip_netif) { return -ERR_IF; } - + #ifdef SAL_USING_LWIP extern int sal_lwip_netdev_set_pf_info(struct netdev *netdev); /* set the lwIP network interface device protocol family information */ @@ -324,7 +332,7 @@ static int netdev_add(struct netif *lwip_netif) rt_strncpy(name, lwip_netif->name, LWIP_NETIF_NAME_LEN); result = netdev_register(netdev, name, (void *)lwip_netif); - + /* Update netdev info after registered */ netdev->flags = lwip_netif->flags; netdev->mtu = lwip_netif->mtu; @@ -367,7 +375,7 @@ static int netdev_flags_sync(struct netif *lwip_netif) { return -ERR_IF; } - + netdev->mtu = lwip_netif->mtu; netdev->flags |= lwip_netif->flags; @@ -430,7 +438,7 @@ static err_t eth_netif_device_init(struct netif *netif) /* copy device flags to netif flags */ netif->flags = (ethif->flags & 0xff); netif->mtu = ETHERNET_MTU; - + /* set output */ netif->output = etharp_output; @@ -487,14 +495,18 @@ static err_t eth_netif_device_init(struct netif *netif) rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_uint16_t flags) { struct netif* netif; - - netif = (struct netif*) rt_malloc (sizeof(struct netif)); +#if LWIP_NETIF_HOSTNAME +#define LWIP_HOSTNAME_LEN 16 + char *hostname = RT_NULL; + netif = (struct netif*) rt_calloc (1, sizeof(struct netif) + LWIP_HOSTNAME_LEN); +#else + netif = (struct netif*) rt_calloc (1, sizeof(struct netif)); +#endif if (netif == RT_NULL) { rt_kprintf("malloc netif failed\n"); return -RT_ERROR; } - rt_memset(netif, 0, sizeof(struct netif)); /* set netif */ dev->netif = netif; @@ -518,13 +530,15 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ /* set linkoutput */ netif->linkoutput = ethernetif_linkoutput; - + /* get hardware MAC address */ rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); #if LWIP_NETIF_HOSTNAME /* Initialize interface hostname */ - netif->hostname = "rtthread"; + hostname = (char *)netif + sizeof(struct netif); + rt_sprintf(hostname, "rtthread_%02x%02x", name[0], name[1]); + netif->hostname = hostname; #endif /* LWIP_NETIF_HOSTNAME */ /* if tcp thread has been started up, we add this netif to the system */ @@ -536,7 +550,7 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ ipaddr.addr = inet_addr(RT_LWIP_IPADDR); gw.addr = inet_addr(RT_LWIP_GWADDR); netmask.addr = inet_addr(RT_LWIP_MSKADDR); -#else +#else IP4_ADDR(&ipaddr, 0, 0, 0, 0); IP4_ADDR(&gw, 0, 0, 0, 0); IP4_ADDR(&netmask, 0, 0, 0, 0); @@ -688,7 +702,7 @@ static void eth_rx_thread_entry(void* parameter) while (1) { if(device->eth_rx == RT_NULL) break; - + p = device->eth_rx(&(device->parent)); if (p != RT_NULL) { @@ -711,9 +725,9 @@ static void eth_rx_thread_entry(void* parameter) } #endif -/* this function does not need, - * use eth_system_device_init_private() - * call by lwip_system_init(). +/* this function does not need, + * use eth_system_device_init_private() + * call by lwip_system_init(). */ int eth_system_device_init(void) { @@ -856,27 +870,27 @@ void list_if(void) rt_kprintf("gw address: %s\n", ipaddr_ntoa(&(netif->gw))); rt_kprintf("net mask : %s\n", ipaddr_ntoa(&(netif->netmask))); #if LWIP_IPV6 - { - ip6_addr_t *addr; - int addr_state; - int i; - - addr = (ip6_addr_t *)&netif->ip6_addr[0]; - addr_state = netif->ip6_addr_state[0]; - - rt_kprintf("\nipv6 link-local: %s state:%02X %s\n", ip6addr_ntoa(addr), - addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); - - for(i=1; iip6_addr[i]; - addr_state = netif->ip6_addr_state[i]; - - rt_kprintf("ipv6[%d] address: %s state:%02X %s\n", i, ip6addr_ntoa(addr), - addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); - } - - } + { + ip6_addr_t *addr; + int addr_state; + int i; + + addr = (ip6_addr_t *)&netif->ip6_addr[0]; + addr_state = netif->ip6_addr_state[0]; + + rt_kprintf("\nipv6 link-local: %s state:%02X %s\n", ip6addr_ntoa(addr), + addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); + + for(i=1; iip6_addr[i]; + addr_state = netif->ip6_addr_state[i]; + + rt_kprintf("ipv6[%d] address: %s state:%02X %s\n", i, ip6addr_ntoa(addr), + addr_state, ip6_addr_isvalid(addr_state)?"VALID":"INVALID"); + } + + } rt_kprintf("\r\n"); #endif /* LWIP_IPV6 */ netif = netif->next; diff --git a/components/net/lwip-2.1.0/src/netif/lowpan6.c b/components/net/lwip-2.1.2/src/netif/lowpan6.c similarity index 99% rename from components/net/lwip-2.1.0/src/netif/lowpan6.c rename to components/net/lwip-2.1.2/src/netif/lowpan6.c index 6397b0cb5..b180b0c2e 100644 --- a/components/net/lwip-2.1.0/src/netif/lowpan6.c +++ b/components/net/lwip-2.1.2/src/netif/lowpan6.c @@ -630,11 +630,11 @@ lowpan6_output(struct netif *netif, struct pbuf *q, const ip6_addr_t *ip6addr) } /* Send out the packet using the returned hardware address. */ - result = lowpan6_hwaddr_to_addr(netif, &dest); - if (result != ERR_OK) { - MIB2_STATS_NETIF_INC(netif, ifoutdiscards); - return result; - } + dest.addr_len = netif->hwaddr_len; + /* XXX: Inferring the length of the source address from the destination address + * is not correct for IEEE 802.15.4, but currently we don't get this information + * from the neighbor cache */ + SMEMCPY(dest.addr, hwaddr, netif->hwaddr_len); MIB2_STATS_NETIF_INC(netif, ifoutucastpkts); return lowpan6_frag(netif, q, &src, &dest); } diff --git a/components/net/lwip-2.1.0/src/netif/lowpan6_ble.c b/components/net/lwip-2.1.2/src/netif/lowpan6_ble.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/lowpan6_ble.c rename to components/net/lwip-2.1.2/src/netif/lowpan6_ble.c diff --git a/components/net/lwip-2.1.0/src/netif/lowpan6_common.c b/components/net/lwip-2.1.2/src/netif/lowpan6_common.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/lowpan6_common.c rename to components/net/lwip-2.1.2/src/netif/lowpan6_common.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/PPPD_FOLLOWUP b/components/net/lwip-2.1.2/src/netif/ppp/PPPD_FOLLOWUP similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/PPPD_FOLLOWUP rename to components/net/lwip-2.1.2/src/netif/ppp/PPPD_FOLLOWUP diff --git a/components/net/lwip-2.1.0/src/netif/ppp/auth.c b/components/net/lwip-2.1.2/src/netif/ppp/auth.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/auth.c rename to components/net/lwip-2.1.2/src/netif/ppp/auth.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/ccp.c b/components/net/lwip-2.1.2/src/netif/ppp/ccp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/ccp.c rename to components/net/lwip-2.1.2/src/netif/ppp/ccp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/chap-md5.c b/components/net/lwip-2.1.2/src/netif/ppp/chap-md5.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/chap-md5.c rename to components/net/lwip-2.1.2/src/netif/ppp/chap-md5.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/chap-new.c b/components/net/lwip-2.1.2/src/netif/ppp/chap-new.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/chap-new.c rename to components/net/lwip-2.1.2/src/netif/ppp/chap-new.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/chap_ms.c b/components/net/lwip-2.1.2/src/netif/ppp/chap_ms.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/chap_ms.c rename to components/net/lwip-2.1.2/src/netif/ppp/chap_ms.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/demand.c b/components/net/lwip-2.1.2/src/netif/ppp/demand.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/demand.c rename to components/net/lwip-2.1.2/src/netif/ppp/demand.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/eap.c b/components/net/lwip-2.1.2/src/netif/ppp/eap.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/eap.c rename to components/net/lwip-2.1.2/src/netif/ppp/eap.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/ecp.c b/components/net/lwip-2.1.2/src/netif/ppp/ecp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/ecp.c rename to components/net/lwip-2.1.2/src/netif/ppp/ecp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/eui64.c b/components/net/lwip-2.1.2/src/netif/ppp/eui64.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/eui64.c rename to components/net/lwip-2.1.2/src/netif/ppp/eui64.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/fsm.c b/components/net/lwip-2.1.2/src/netif/ppp/fsm.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/fsm.c rename to components/net/lwip-2.1.2/src/netif/ppp/fsm.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/ipcp.c b/components/net/lwip-2.1.2/src/netif/ppp/ipcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/ipcp.c rename to components/net/lwip-2.1.2/src/netif/ppp/ipcp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/ipv6cp.c b/components/net/lwip-2.1.2/src/netif/ppp/ipv6cp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/ipv6cp.c rename to components/net/lwip-2.1.2/src/netif/ppp/ipv6cp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/lcp.c b/components/net/lwip-2.1.2/src/netif/ppp/lcp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/lcp.c rename to components/net/lwip-2.1.2/src/netif/ppp/lcp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/magic.c b/components/net/lwip-2.1.2/src/netif/ppp/magic.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/magic.c rename to components/net/lwip-2.1.2/src/netif/ppp/magic.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/mppe.c b/components/net/lwip-2.1.2/src/netif/ppp/mppe.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/mppe.c rename to components/net/lwip-2.1.2/src/netif/ppp/mppe.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/multilink.c b/components/net/lwip-2.1.2/src/netif/ppp/multilink.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/multilink.c rename to components/net/lwip-2.1.2/src/netif/ppp/multilink.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/README b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/README similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/README rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/README diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/arc4.c b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/arc4.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/arc4.c rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/arc4.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/des.c b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/des.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/des.c rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/des.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/md4.c b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/md4.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/md4.c rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/md4.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/md5.c b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/md5.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/md5.c rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/md5.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/polarssl/sha1.c b/components/net/lwip-2.1.2/src/netif/ppp/polarssl/sha1.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/polarssl/sha1.c rename to components/net/lwip-2.1.2/src/netif/ppp/polarssl/sha1.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/ppp.c b/components/net/lwip-2.1.2/src/netif/ppp/ppp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/ppp.c rename to components/net/lwip-2.1.2/src/netif/ppp/ppp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/pppapi.c b/components/net/lwip-2.1.2/src/netif/ppp/pppapi.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/pppapi.c rename to components/net/lwip-2.1.2/src/netif/ppp/pppapi.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/pppcrypt.c b/components/net/lwip-2.1.2/src/netif/ppp/pppcrypt.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/pppcrypt.c rename to components/net/lwip-2.1.2/src/netif/ppp/pppcrypt.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/pppoe.c b/components/net/lwip-2.1.2/src/netif/ppp/pppoe.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/pppoe.c rename to components/net/lwip-2.1.2/src/netif/ppp/pppoe.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/pppol2tp.c b/components/net/lwip-2.1.2/src/netif/ppp/pppol2tp.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/pppol2tp.c rename to components/net/lwip-2.1.2/src/netif/ppp/pppol2tp.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/pppos.c b/components/net/lwip-2.1.2/src/netif/ppp/pppos.c similarity index 99% rename from components/net/lwip-2.1.0/src/netif/ppp/pppos.c rename to components/net/lwip-2.1.2/src/netif/ppp/pppos.c index 246bead82..dff025544 100644 --- a/components/net/lwip-2.1.0/src/netif/ppp/pppos.c +++ b/components/net/lwip-2.1.2/src/netif/ppp/pppos.c @@ -482,7 +482,7 @@ pppos_input(ppp_pcb *ppp, u8_t *s, int l) u8_t cur_char; u8_t escaped; PPPOS_DECL_PROTECT(lev); -#if PPP_INPROC_IRQ_SAFE +#if !PPP_INPROC_IRQ_SAFE LWIP_ASSERT_CORE_LOCKED(); #endif diff --git a/components/net/lwip-2.1.0/src/netif/ppp/upap.c b/components/net/lwip-2.1.2/src/netif/ppp/upap.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/upap.c rename to components/net/lwip-2.1.2/src/netif/ppp/upap.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/utils.c b/components/net/lwip-2.1.2/src/netif/ppp/utils.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/utils.c rename to components/net/lwip-2.1.2/src/netif/ppp/utils.c diff --git a/components/net/lwip-2.1.0/src/netif/ppp/vj.c b/components/net/lwip-2.1.2/src/netif/ppp/vj.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/ppp/vj.c rename to components/net/lwip-2.1.2/src/netif/ppp/vj.c diff --git a/components/net/lwip-2.1.0/src/netif/slipif.c b/components/net/lwip-2.1.2/src/netif/slipif.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/slipif.c rename to components/net/lwip-2.1.2/src/netif/slipif.c diff --git a/components/net/lwip-2.1.0/src/netif/zepif.c b/components/net/lwip-2.1.2/src/netif/zepif.c similarity index 100% rename from components/net/lwip-2.1.0/src/netif/zepif.c rename to components/net/lwip-2.1.2/src/netif/zepif.c diff --git a/components/net/lwip-2.1.0/test/fuzz/Makefile b/components/net/lwip-2.1.2/test/fuzz/Makefile similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/Makefile rename to components/net/lwip-2.1.2/test/fuzz/Makefile diff --git a/components/net/lwip-2.1.0/test/fuzz/README b/components/net/lwip-2.1.2/test/fuzz/README similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/README rename to components/net/lwip-2.1.2/test/fuzz/README diff --git a/components/net/lwip-2.1.0/test/fuzz/config.h b/components/net/lwip-2.1.2/test/fuzz/config.h similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/config.h rename to components/net/lwip-2.1.2/test/fuzz/config.h diff --git a/components/net/lwip-2.1.0/test/fuzz/fuzz.c b/components/net/lwip-2.1.2/test/fuzz/fuzz.c similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/fuzz.c rename to components/net/lwip-2.1.2/test/fuzz/fuzz.c diff --git a/components/net/lwip-2.1.0/test/fuzz/lwipopts.h b/components/net/lwip-2.1.2/test/fuzz/lwipopts.h similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/lwipopts.h rename to components/net/lwip-2.1.2/test/fuzz/lwipopts.h diff --git a/components/net/lwip-2.1.0/test/fuzz/output_to_pcap.sh b/components/net/lwip-2.1.2/test/fuzz/output_to_pcap.sh similarity index 100% rename from components/net/lwip-2.1.0/test/fuzz/output_to_pcap.sh rename to components/net/lwip-2.1.2/test/fuzz/output_to_pcap.sh diff --git a/components/net/lwip-2.1.0/test/sockets/sockets_stresstest.c b/components/net/lwip-2.1.2/test/sockets/sockets_stresstest.c similarity index 100% rename from components/net/lwip-2.1.0/test/sockets/sockets_stresstest.c rename to components/net/lwip-2.1.2/test/sockets/sockets_stresstest.c diff --git a/components/net/lwip-2.1.0/test/sockets/sockets_stresstest.h b/components/net/lwip-2.1.2/test/sockets/sockets_stresstest.h similarity index 100% rename from components/net/lwip-2.1.0/test/sockets/sockets_stresstest.h rename to components/net/lwip-2.1.2/test/sockets/sockets_stresstest.h diff --git a/components/net/lwip-2.1.0/test/unit/Filelists.cmake b/components/net/lwip-2.1.2/test/unit/Filelists.cmake similarity index 100% rename from components/net/lwip-2.1.0/test/unit/Filelists.cmake rename to components/net/lwip-2.1.2/test/unit/Filelists.cmake diff --git a/components/net/lwip-2.1.0/test/unit/Filelists.mk b/components/net/lwip-2.1.2/test/unit/Filelists.mk similarity index 100% rename from components/net/lwip-2.1.0/test/unit/Filelists.mk rename to components/net/lwip-2.1.2/test/unit/Filelists.mk diff --git a/components/net/lwip-2.1.0/test/unit/api/test_sockets.c b/components/net/lwip-2.1.2/test/unit/api/test_sockets.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/api/test_sockets.c rename to components/net/lwip-2.1.2/test/unit/api/test_sockets.c diff --git a/components/net/lwip-2.1.0/test/unit/api/test_sockets.h b/components/net/lwip-2.1.2/test/unit/api/test_sockets.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/api/test_sockets.h rename to components/net/lwip-2.1.2/test/unit/api/test_sockets.h diff --git a/components/net/lwip-2.1.0/test/unit/arch/sys_arch.c b/components/net/lwip-2.1.2/test/unit/arch/sys_arch.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/arch/sys_arch.c rename to components/net/lwip-2.1.2/test/unit/arch/sys_arch.c diff --git a/components/net/lwip-2.1.0/test/unit/arch/sys_arch.h b/components/net/lwip-2.1.2/test/unit/arch/sys_arch.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/arch/sys_arch.h rename to components/net/lwip-2.1.2/test/unit/arch/sys_arch.h diff --git a/components/net/lwip-2.1.0/test/unit/core/test_def.c b/components/net/lwip-2.1.2/test/unit/core/test_def.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_def.c rename to components/net/lwip-2.1.2/test/unit/core/test_def.c diff --git a/components/net/lwip-2.1.0/test/unit/core/test_def.h b/components/net/lwip-2.1.2/test/unit/core/test_def.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_def.h rename to components/net/lwip-2.1.2/test/unit/core/test_def.h diff --git a/components/net/lwip-2.1.0/test/unit/core/test_mem.c b/components/net/lwip-2.1.2/test/unit/core/test_mem.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_mem.c rename to components/net/lwip-2.1.2/test/unit/core/test_mem.c diff --git a/components/net/lwip-2.1.0/test/unit/core/test_mem.h b/components/net/lwip-2.1.2/test/unit/core/test_mem.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_mem.h rename to components/net/lwip-2.1.2/test/unit/core/test_mem.h diff --git a/components/net/lwip-2.1.0/test/unit/core/test_netif.c b/components/net/lwip-2.1.2/test/unit/core/test_netif.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_netif.c rename to components/net/lwip-2.1.2/test/unit/core/test_netif.c diff --git a/components/net/lwip-2.1.0/test/unit/core/test_netif.h b/components/net/lwip-2.1.2/test/unit/core/test_netif.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_netif.h rename to components/net/lwip-2.1.2/test/unit/core/test_netif.h diff --git a/components/net/lwip-2.1.0/test/unit/core/test_pbuf.c b/components/net/lwip-2.1.2/test/unit/core/test_pbuf.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_pbuf.c rename to components/net/lwip-2.1.2/test/unit/core/test_pbuf.c diff --git a/components/net/lwip-2.1.0/test/unit/core/test_pbuf.h b/components/net/lwip-2.1.2/test/unit/core/test_pbuf.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_pbuf.h rename to components/net/lwip-2.1.2/test/unit/core/test_pbuf.h diff --git a/components/net/lwip-2.1.0/test/unit/core/test_timers.c b/components/net/lwip-2.1.2/test/unit/core/test_timers.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_timers.c rename to components/net/lwip-2.1.2/test/unit/core/test_timers.c diff --git a/components/net/lwip-2.1.0/test/unit/core/test_timers.h b/components/net/lwip-2.1.2/test/unit/core/test_timers.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/core/test_timers.h rename to components/net/lwip-2.1.2/test/unit/core/test_timers.h diff --git a/components/net/lwip-2.1.0/test/unit/dhcp/test_dhcp.c b/components/net/lwip-2.1.2/test/unit/dhcp/test_dhcp.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/dhcp/test_dhcp.c rename to components/net/lwip-2.1.2/test/unit/dhcp/test_dhcp.c diff --git a/components/net/lwip-2.1.0/test/unit/dhcp/test_dhcp.h b/components/net/lwip-2.1.2/test/unit/dhcp/test_dhcp.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/dhcp/test_dhcp.h rename to components/net/lwip-2.1.2/test/unit/dhcp/test_dhcp.h diff --git a/components/net/lwip-2.1.0/test/unit/etharp/test_etharp.c b/components/net/lwip-2.1.2/test/unit/etharp/test_etharp.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/etharp/test_etharp.c rename to components/net/lwip-2.1.2/test/unit/etharp/test_etharp.c diff --git a/components/net/lwip-2.1.0/test/unit/etharp/test_etharp.h b/components/net/lwip-2.1.2/test/unit/etharp/test_etharp.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/etharp/test_etharp.h rename to components/net/lwip-2.1.2/test/unit/etharp/test_etharp.h diff --git a/components/net/lwip-2.1.0/test/unit/ip4/test_ip4.c b/components/net/lwip-2.1.2/test/unit/ip4/test_ip4.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/ip4/test_ip4.c rename to components/net/lwip-2.1.2/test/unit/ip4/test_ip4.c diff --git a/components/net/lwip-2.1.0/test/unit/ip4/test_ip4.h b/components/net/lwip-2.1.2/test/unit/ip4/test_ip4.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/ip4/test_ip4.h rename to components/net/lwip-2.1.2/test/unit/ip4/test_ip4.h diff --git a/components/net/lwip-2.1.0/test/unit/ip6/test_ip6.c b/components/net/lwip-2.1.2/test/unit/ip6/test_ip6.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/ip6/test_ip6.c rename to components/net/lwip-2.1.2/test/unit/ip6/test_ip6.c diff --git a/components/net/lwip-2.1.0/test/unit/ip6/test_ip6.h b/components/net/lwip-2.1.2/test/unit/ip6/test_ip6.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/ip6/test_ip6.h rename to components/net/lwip-2.1.2/test/unit/ip6/test_ip6.h diff --git a/components/net/lwip-2.1.0/test/unit/lwip_check.h b/components/net/lwip-2.1.2/test/unit/lwip_check.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/lwip_check.h rename to components/net/lwip-2.1.2/test/unit/lwip_check.h diff --git a/components/net/lwip-2.1.0/test/unit/lwip_unittests.c b/components/net/lwip-2.1.2/test/unit/lwip_unittests.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/lwip_unittests.c rename to components/net/lwip-2.1.2/test/unit/lwip_unittests.c diff --git a/components/net/lwip-2.1.0/test/unit/lwipopts.h b/components/net/lwip-2.1.2/test/unit/lwipopts.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/lwipopts.h rename to components/net/lwip-2.1.2/test/unit/lwipopts.h diff --git a/components/net/lwip-2.1.0/test/unit/mdns/test_mdns.c b/components/net/lwip-2.1.2/test/unit/mdns/test_mdns.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/mdns/test_mdns.c rename to components/net/lwip-2.1.2/test/unit/mdns/test_mdns.c diff --git a/components/net/lwip-2.1.0/test/unit/mdns/test_mdns.h b/components/net/lwip-2.1.2/test/unit/mdns/test_mdns.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/mdns/test_mdns.h rename to components/net/lwip-2.1.2/test/unit/mdns/test_mdns.h diff --git a/components/net/lwip-2.1.0/test/unit/mqtt/test_mqtt.c b/components/net/lwip-2.1.2/test/unit/mqtt/test_mqtt.c similarity index 96% rename from components/net/lwip-2.1.0/test/unit/mqtt/test_mqtt.c rename to components/net/lwip-2.1.2/test/unit/mqtt/test_mqtt.c index 32f08e67d..7cff13ea2 100644 --- a/components/net/lwip-2.1.0/test/unit/mqtt/test_mqtt.c +++ b/components/net/lwip-2.1.2/test/unit/mqtt/test_mqtt.c @@ -94,6 +94,8 @@ START_TEST(basic_connect) p = pbuf_alloc(PBUF_RAW, sizeof(rxbuf), PBUF_REF); fail_unless(p != NULL); p->payload = rxbuf; + /* since we hack the rx path, we have to hack the rx window, too: */ + client->conn->rcv_wnd -= p->tot_len; if (client->conn->recv(client->conn->callback_arg, client->conn, p, ERR_OK) != ERR_OK) { pbuf_free(p); } diff --git a/components/net/lwip-2.1.0/test/unit/mqtt/test_mqtt.h b/components/net/lwip-2.1.2/test/unit/mqtt/test_mqtt.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/mqtt/test_mqtt.h rename to components/net/lwip-2.1.2/test/unit/mqtt/test_mqtt.h diff --git a/components/net/lwip-2.1.0/test/unit/tcp/tcp_helper.c b/components/net/lwip-2.1.2/test/unit/tcp/tcp_helper.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/tcp/tcp_helper.c rename to components/net/lwip-2.1.2/test/unit/tcp/tcp_helper.c diff --git a/components/net/lwip-2.1.0/test/unit/tcp/tcp_helper.h b/components/net/lwip-2.1.2/test/unit/tcp/tcp_helper.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/tcp/tcp_helper.h rename to components/net/lwip-2.1.2/test/unit/tcp/tcp_helper.h diff --git a/components/net/lwip-2.1.0/test/unit/tcp/test_tcp.c b/components/net/lwip-2.1.2/test/unit/tcp/test_tcp.c similarity index 97% rename from components/net/lwip-2.1.0/test/unit/tcp/test_tcp.c rename to components/net/lwip-2.1.2/test/unit/tcp/test_tcp.c index 9e84c6d94..c7f85f6a1 100644 --- a/components/net/lwip-2.1.0/test/unit/tcp/test_tcp.c +++ b/components/net/lwip-2.1.2/test/unit/tcp/test_tcp.c @@ -330,6 +330,53 @@ START_TEST(test_tcp_passive_close) } END_TEST +START_TEST(test_tcp_active_abort) +{ + struct test_tcp_counters counters; + struct tcp_pcb* pcb; + char data = 0x0f; + struct netif netif; + struct test_tcp_txcounters txcounters; + LWIP_UNUSED_ARG(_i); + + memset(&txcounters, 0, sizeof(txcounters)); + + /* initialize local vars */ + test_tcp_init_netif(&netif, &txcounters, &test_local_ip, &test_netmask); + + /* initialize counter struct */ + memset(&counters, 0, sizeof(counters)); + counters.expected_data_len = 1; + counters.expected_data = &data; + + /* create and initialize the pcb */ + pcb = test_tcp_new_counters_pcb(&counters); + EXPECT_RET(pcb != NULL); + tcp_set_state(pcb, ESTABLISHED, &test_local_ip, &test_remote_ip, TEST_LOCAL_PORT, TEST_REMOTE_PORT); + + /* abort the pcb */ + EXPECT_RET(txcounters.num_tx_calls == 0); + txcounters.copy_tx_packets = 1; + tcp_abort(pcb); + txcounters.copy_tx_packets = 0; + EXPECT(txcounters.num_tx_calls == 1); + EXPECT(txcounters.num_tx_bytes == 40U); + EXPECT(txcounters.tx_packets != NULL); + if (txcounters.tx_packets != NULL) { + u16_t ret; + struct tcp_hdr tcphdr; + ret = pbuf_copy_partial(txcounters.tx_packets, &tcphdr, 20, 20); + EXPECT(ret == 20); + EXPECT(tcphdr.dest == PP_HTONS(TEST_REMOTE_PORT)); + EXPECT(tcphdr.src == PP_HTONS(TEST_LOCAL_PORT)); + pbuf_free(txcounters.tx_packets); + txcounters.tx_packets = NULL; + } + + /* don't free the pcb here (part of the test!) */ +} +END_TEST + /** Check that we handle malformed tcp headers, and discard the pbuf(s) */ START_TEST(test_tcp_malformed_header) { @@ -1627,6 +1674,7 @@ tcp_suite(void) TESTFUNC(test_tcp_recv_inseq), TESTFUNC(test_tcp_recv_inseq_trim), TESTFUNC(test_tcp_passive_close), + TESTFUNC(test_tcp_active_abort), TESTFUNC(test_tcp_malformed_header), TESTFUNC(test_tcp_fast_retx_recover), TESTFUNC(test_tcp_fast_rexmit_wraparound), diff --git a/components/net/lwip-2.1.0/test/unit/tcp/test_tcp.h b/components/net/lwip-2.1.2/test/unit/tcp/test_tcp.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/tcp/test_tcp.h rename to components/net/lwip-2.1.2/test/unit/tcp/test_tcp.h diff --git a/components/net/lwip-2.1.0/test/unit/tcp/test_tcp_oos.c b/components/net/lwip-2.1.2/test/unit/tcp/test_tcp_oos.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/tcp/test_tcp_oos.c rename to components/net/lwip-2.1.2/test/unit/tcp/test_tcp_oos.c diff --git a/components/net/lwip-2.1.0/test/unit/tcp/test_tcp_oos.h b/components/net/lwip-2.1.2/test/unit/tcp/test_tcp_oos.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/tcp/test_tcp_oos.h rename to components/net/lwip-2.1.2/test/unit/tcp/test_tcp_oos.h diff --git a/components/net/lwip-2.1.0/test/unit/udp/test_udp.c b/components/net/lwip-2.1.2/test/unit/udp/test_udp.c similarity index 100% rename from components/net/lwip-2.1.0/test/unit/udp/test_udp.c rename to components/net/lwip-2.1.2/test/unit/udp/test_udp.c diff --git a/components/net/lwip-2.1.0/test/unit/udp/test_udp.h b/components/net/lwip-2.1.2/test/unit/udp/test_udp.h similarity index 100% rename from components/net/lwip-2.1.0/test/unit/udp/test_udp.h rename to components/net/lwip-2.1.2/test/unit/udp/test_udp.h diff --git a/components/net/lwip_dhcpd/dhcp_server.c b/components/net/lwip_dhcpd/dhcp_server.c index 93b4ad16f..0ebbe89ca 100644 --- a/components/net/lwip_dhcpd/dhcp_server.c +++ b/components/net/lwip_dhcpd/dhcp_server.c @@ -2,7 +2,7 @@ * File : dhcp_server.c * A simple DHCP server implementation * - * COPYRIGHT (C) 2011-2018, Shanghai Real-Thread Technology Co., Ltd + * COPYRIGHT (C) 2011-2021, Shanghai Real-Thread Technology Co., Ltd * http://www.rt-thread.com * All rights reserved. * diff --git a/components/net/lwip_dhcpd/dhcp_server.h b/components/net/lwip_dhcpd/dhcp_server.h index ea68d6b8e..3533cb608 100644 --- a/components/net/lwip_dhcpd/dhcp_server.h +++ b/components/net/lwip_dhcpd/dhcp_server.h @@ -2,7 +2,7 @@ * File : dhcp_server.h * A simple DHCP server implementation * - * COPYRIGHT (C) 2011-2018, Shanghai Real-Thread Technology Co., Ltd + * COPYRIGHT (C) 2011-2021, Shanghai Real-Thread Technology Co., Ltd * http://www.rt-thread.com * All rights reserved. * diff --git a/components/net/lwip_dhcpd/dhcp_server_raw.c b/components/net/lwip_dhcpd/dhcp_server_raw.c index 6c786301b..06a7affc9 100644 --- a/components/net/lwip_dhcpd/dhcp_server_raw.c +++ b/components/net/lwip_dhcpd/dhcp_server_raw.c @@ -1,7 +1,7 @@ /* * File : dhcp_server_raw.c * A simple DHCP server implementation - * COPYRIGHT (C) 2011-2018, Shanghai Real-Thread Technology Co., Ltd + * COPYRIGHT (C) 2011-2021, Shanghai Real-Thread Technology Co., Ltd * http://www.rt-thread.com * All rights reserved. * @@ -26,7 +26,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. - * + * * Change Logs: * Date Author Notes * 2014-04-01 Ren.Haibo the first version diff --git a/components/net/netdev/include/arpa/inet.h b/components/net/netdev/include/arpa/inet.h index 085e15dcb..9072dffb7 100644 --- a/components/net/netdev/include/arpa/inet.h +++ b/components/net/netdev/include/arpa/inet.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/netdev/include/netdev.h b/components/net/netdev/include/netdev.h index e11a8929b..16da0e502 100644 --- a/components/net/netdev/include/netdev.h +++ b/components/net/netdev/include/netdev.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -79,8 +79,8 @@ struct netdev_ops; /* network interface device object */ struct netdev { - rt_slist_t list; - + rt_slist_t list; + char name[RT_NAME_MAX]; /* network interface device name */ ip_addr_t ip_addr; /* IP address */ ip_addr_t netmask; /* subnet mask */ @@ -91,11 +91,11 @@ struct netdev ip_addr_t dns_servers[NETDEV_DNS_SERVERS_NUM]; /* DNS server */ uint8_t hwaddr_len; /* hardware address length */ uint8_t hwaddr[NETDEV_HWADDR_MAX_LEN]; /* hardware address */ - + uint16_t flags; /* network interface device status flag */ uint16_t mtu; /* maximum transfer unit (in bytes) */ const struct netdev_ops *ops; /* network interface device operations */ - + netdev_callback_fn status_callback; /* network interface device flags change callback */ netdev_callback_fn addr_callback; /* network interface device address information change callback */ diff --git a/components/net/netdev/include/netdev_ipaddr.h b/components/net/netdev/include/netdev_ipaddr.h index 65970ec5b..08ea50ed9 100644 --- a/components/net/netdev/include/netdev_ipaddr.h +++ b/components/net/netdev/include/netdev_ipaddr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -23,30 +23,30 @@ extern "C" { * On subnets, the decomposition of addresses to host and net parts * is done according to subnet mask, not the masks here. */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 +#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 +#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff +#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#define IN_MULTICAST(i) IN_CLASSD(i) +#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +#define IN_MULTICAST(i) IN_CLASSD(i) -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) +#define IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) -#define IN_LOOPBACKNET 127 /* official! */ +#define IN_LOOPBACKNET 127 /* official! */ /* IP address types for use in ip_addr_t.type member */ enum netdev_ip_addr_type { @@ -307,7 +307,7 @@ const char *netdev_inet_ntop(int af, const void *src, char *dst, int32_t size); int netdev_inet_pton(int af, const char *src, void *dst); #define inet_ntop(af, src, dst, size) netdev_inet_ntop(af, src, dst, size) -#define inet_pton(af, src, dst) netdev_inet_pton(af, src, dst) +#define inet_pton(af, src, dst) netdev_inet_pton(af, src, dst) #ifdef __cplusplus } diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 68e5364a9..ce418757f 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -856,7 +856,7 @@ void netdev_low_level_set_dhcp_status(struct netdev *netdev, rt_bool_t is_enable static void netdev_list_if(void) { #define NETDEV_IFCONFIG_MAC_MAX_LEN 6 -#define NETDEV_IFCONFIG_IEMI_MAX_LEN 8 +#define NETDEV_IFCONFIG_IMEI_MAX_LEN 8 rt_ubase_t index; rt_slist_t *node = RT_NULL; @@ -887,16 +887,22 @@ static void netdev_list_if(void) rt_kprintf("%02x ", netdev->hwaddr[index]); } } - else if (netdev->hwaddr_len == NETDEV_IFCONFIG_IEMI_MAX_LEN) + else if (netdev->hwaddr_len == NETDEV_IFCONFIG_IMEI_MAX_LEN) { rt_kprintf("IMEI: "); for (index = 0; index < netdev->hwaddr_len; index++) { /* two numbers are displayed at one time*/ if (netdev->hwaddr[index] < 10 && index != netdev->hwaddr_len - 1) - rt_kprintf("0"); + { + rt_kprintf("%02d", netdev->hwaddr[index]); + } + else + { + rt_kprintf("%d", netdev->hwaddr[index]); + } + - rt_kprintf("%d", netdev->hwaddr[index]); } } @@ -1087,7 +1093,7 @@ int netdev_cmd_ping(char* target_name, rt_uint32_t times, rt_size_t size) } } - /* if the response time is more than NETDEV_PING_DELAY, no nead to delay */ + /* if the response time is more than NETDEV_PING_DELAY, no need to delay */ delay_tick = ((rt_tick_get() - start_tick) > NETDEV_PING_DELAY) || (index == times) ? 0 : NETDEV_PING_DELAY; rt_thread_delay(delay_tick); } diff --git a/components/net/netdev/src/netdev_ipaddr.c b/components/net/netdev/src/netdev_ipaddr.c index 8d83937da..9abb41bd1 100644 --- a/components/net/netdev/src/netdev_ipaddr.c +++ b/components/net/netdev/src/netdev_ipaddr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -564,7 +564,7 @@ netdev_inet_ntop(int af, const void *src, char *dst, int32_t size) } switch (af) { -#if NTEDEV_IPV4 +#if NETDEV_IPV4 case AF_INET: return netdev_ip4addr_ntoa_r((const ip4_addr_t *)src, dst, size_int); #endif diff --git a/components/net/sal_socket/dfs_net/dfs_net.c b/components/net/sal_socket/dfs_net/dfs_net.c index f1a3d777a..67b652c32 100644 --- a/components/net/sal_socket/dfs_net/dfs_net.c +++ b/components/net/sal_socket/dfs_net/dfs_net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -21,7 +21,7 @@ int dfs_net_getsocket(int fd) { int socket; - struct dfs_fd *_dfs_fd; + struct dfs_fd *_dfs_fd; _dfs_fd = fd_get(fd); if (_dfs_fd == NULL) return -1; @@ -68,7 +68,7 @@ static int dfs_net_poll(struct dfs_fd *file, struct rt_pollreq *req) return sal_poll(file, req); } -const struct dfs_file_ops _net_fops = +const struct dfs_file_ops _net_fops = { NULL, /* open */ dfs_net_close, diff --git a/components/net/sal_socket/impl/af_inet.h b/components/net/sal_socket/impl/af_inet.h index caffbe140..421d15bfa 100644 --- a/components/net/sal_socket/impl/af_inet.h +++ b/components/net/sal_socket/impl/af_inet.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/impl/af_inet_at.c b/components/net/sal_socket/impl/af_inet_at.c index 135e4183c..c85dfe9f0 100644 --- a/components/net/sal_socket/impl/af_inet_at.c +++ b/components/net/sal_socket/impl/af_inet_at.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -85,7 +85,7 @@ static const struct sal_socket_ops at_socket_ops = #endif /* SAL_USING_POSIX */ }; -static const struct sal_netdb_ops at_netdb_ops = +static const struct sal_netdb_ops at_netdb_ops = { at_gethostbyname, NULL, diff --git a/components/net/sal_socket/impl/af_inet_lwip.c b/components/net/sal_socket/impl/af_inet_lwip.c index 56df735ab..2e19275b5 100644 --- a/components/net/sal_socket/impl/af_inet_lwip.c +++ b/components/net/sal_socket/impl/af_inet_lwip.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -229,7 +229,7 @@ int inet_ioctlsocket(int socket, long cmd, void *arg) { case F_GETFL: case F_SETFL: - return lwip_fcntl(socket, cmd, (int) arg); + return lwip_fcntl(socket, cmd, (int) arg); default: return lwip_ioctl(socket, cmd, arg); @@ -320,7 +320,7 @@ static const struct sal_proto_family lwip_inet_family = AF_INET6, #else AF_INET, -#endif +#endif &lwip_socket_ops, &lwip_netdb_ops, }; @@ -329,7 +329,7 @@ static const struct sal_proto_family lwip_inet_family = int sal_lwip_netdev_set_pf_info(struct netdev *netdev) { RT_ASSERT(netdev); - + netdev->sal_user_data = (void *) &lwip_inet_family; return 0; } diff --git a/components/net/sal_socket/impl/proto_mbedtls.c b/components/net/sal_socket/impl/proto_mbedtls.c index 3472bbeaf..79fbdcc5d 100644 --- a/components/net/sal_socket/impl/proto_mbedtls.c +++ b/components/net/sal_socket/impl/proto_mbedtls.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -59,7 +59,7 @@ static void *mebdtls_socket(int socket) { tls_free(session); session = RT_NULL; - + return RT_NULL; } @@ -68,7 +68,7 @@ static void *mebdtls_socket(int socket) { mbedtls_client_close(session); return RT_NULL; - } + } session->server_fd.fd = socket; return (void *)session; @@ -89,7 +89,7 @@ int mbedtls_net_send_cb(void *ctx, const unsigned char *buf, size_t len) { return -1; } - + pf = (struct sal_proto_family *)sock->netdev->sal_user_data; /* Register scoket sendto option to TLS send data callback */ @@ -128,7 +128,7 @@ int mbedtls_net_recv_cb( void *ctx, unsigned char *buf, size_t len) } pf = (struct sal_proto_family *)sock->netdev->sal_user_data; - + /* Register scoket recvfrom option to TLS recv data callback */ ret = pf->skt_ops->recvfrom((int) sock->user_data, (void *)buf, len, 0, RT_NULL, RT_NULL); if (ret < 0) @@ -183,7 +183,7 @@ static int mbedtls_connect(void *sock) mbedtls_x509_crt_verify_info((char *)session->buffer, session->buffer_len, " ! ", ret); goto __exit; } - + return ret; __exit: @@ -199,27 +199,27 @@ static int mbedtls_closesocket(void *sock) { struct sal_socket *ssock; int socket; - + if (sock == RT_NULL) { return 0; } - + socket = ((MbedTLSSession *) sock)->server_fd.fd; ssock = sal_get_socket(socket); if (ssock == RT_NULL) { return -1; } - + /* Close TLS client session, and clean user-data in SAL socket */ mbedtls_client_close((MbedTLSSession *) sock); ssock->user_data_tls = RT_NULL; - + return 0; } -static const struct sal_proto_tls_ops mbedtls_proto_ops= +static const struct sal_proto_tls_ops mbedtls_proto_ops= { RT_NULL, mebdtls_socket, diff --git a/components/net/sal_socket/include/dfs_net/dfs_net.h b/components/net/sal_socket/include/dfs_net/dfs_net.h index ad28b8ec2..82b752660 100644 --- a/components/net/sal_socket/include/dfs_net/dfs_net.h +++ b/components/net/sal_socket/include/dfs_net/dfs_net.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h b/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h index 8899daee9..f174bc650 100644 --- a/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h +++ b/components/net/sal_socket/include/dfs_net/sys_select/sys/select.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/sal.h b/components/net/sal_socket/include/sal.h index 6ffaa9035..dd250e37b 100644 --- a/components/net/sal_socket/include/sal.h +++ b/components/net/sal_socket/include/sal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/sal_netdb.h b/components/net/sal_socket/include/sal_netdb.h index d5ce9b1d7..50064ce34 100644 --- a/components/net/sal_socket/include/sal_netdb.h +++ b/components/net/sal_socket/include/sal_netdb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/sal_socket.h b/components/net/sal_socket/include/sal_socket.h index b620bbe23..497be47e4 100644 --- a/components/net/sal_socket/include/sal_socket.h +++ b/components/net/sal_socket/include/sal_socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -171,7 +171,7 @@ struct sockaddr_in #endif /* NETDEV_IPV4 */ #if NETDEV_IPV6 -struct sockaddr_in6 +struct sockaddr_in6 { uint8_t sin6_len; /* length of this structure */ sa_family_t sin6_family; /* AF_INET6 */ diff --git a/components/net/sal_socket/include/sal_tls.h b/components/net/sal_socket/include/sal_tls.h index 7681b313b..f211a3c1f 100644 --- a/components/net/sal_socket/include/sal_tls.h +++ b/components/net/sal_socket/include/sal_tls.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/socket/netdb.h b/components/net/sal_socket/include/socket/netdb.h index 17f83efe0..478340502 100644 --- a/components/net/sal_socket/include/socket/netdb.h +++ b/components/net/sal_socket/include/socket/netdb.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/socket/netinet/in.h b/components/net/sal_socket/include/socket/netinet/in.h index 57c417d7b..37240547b 100644 --- a/components/net/sal_socket/include/socket/netinet/in.h +++ b/components/net/sal_socket/include/socket/netinet/in.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/socket/netinet/tcp.h b/components/net/sal_socket/include/socket/netinet/tcp.h index 2ac4d6f40..a3b530186 100644 --- a/components/net/sal_socket/include/socket/netinet/tcp.h +++ b/components/net/sal_socket/include/socket/netinet/tcp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/socket/netinet/udp.h b/components/net/sal_socket/include/socket/netinet/udp.h index 485d7d142..21f50d55e 100644 --- a/components/net/sal_socket/include/socket/netinet/udp.h +++ b/components/net/sal_socket/include/socket/netinet/udp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/include/socket/sys_socket/sys/socket.h b/components/net/sal_socket/include/socket/sys_socket/sys/socket.h index 04470aa84..a86240e2f 100644 --- a/components/net/sal_socket/include/socket/sys_socket/sys/socket.h +++ b/components/net/sal_socket/include/socket/sys_socket/sys/socket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/socket/net_netdb.c b/components/net/sal_socket/socket/net_netdb.c index bc76a4896..03b995c68 100644 --- a/components/net/sal_socket/socket/net_netdb.c +++ b/components/net/sal_socket/socket/net_netdb.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/net/sal_socket/socket/net_sockets.c b/components/net/sal_socket/socket/net_sockets.c index a53b2f1f9..3637635d5 100644 --- a/components/net/sal_socket/socket/net_sockets.c +++ b/components/net/sal_socket/socket/net_sockets.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -95,7 +95,7 @@ int shutdown(int s, int how) rt_set_errno(-EBADF); return -1; } - + if (sal_shutdown(socket, how) == 0) { error = 0; @@ -105,7 +105,7 @@ int shutdown(int s, int how) rt_set_errno(-ENOTSOCK); error = -1; } - + fd_put(d); return error; diff --git a/components/net/sal_socket/src/sal_socket.c b/components/net/sal_socket/src/sal_socket.c index e5c55f8bf..278108871 100644 --- a/components/net/sal_socket/src/sal_socket.c +++ b/components/net/sal_socket/src/sal_socket.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -41,6 +41,13 @@ struct sal_socket_table struct sal_socket **sockets; }; +/* record the netdev and res table*/ +struct sal_netdev_res_table +{ + struct addrinfo *res; + struct netdev *netdev; +}; + #ifdef SAL_USING_TLS /* The global TLS protocol options */ static struct sal_proto_tls *proto_tls; @@ -50,6 +57,7 @@ static struct sal_proto_tls *proto_tls; static struct sal_socket_table socket_table; static struct rt_mutex sal_core_lock; static rt_bool_t init_ok = RT_FALSE; +static struct sal_netdev_res_table sal_dev_res_tbl[SAL_SOCKETS_NUM]; #define IS_SOCKET_PROTO_TLS(sock) (((sock)->protocol == PROTOCOL_TLS) || \ ((sock)->protocol == PROTOCOL_DTLS)) @@ -90,6 +98,11 @@ do { ((pf) = (struct sal_proto_family *) (netdev)->sal_user_data) != RT_NULL && \ (pf)->netdb_ops->ops) \ +#define SAL_NETDBOPS_VALID(netdev, pf, ops) \ + ((netdev) && \ + ((pf) = (struct sal_proto_family *) (netdev)->sal_user_data) != RT_NULL && \ + (pf)->netdb_ops->ops) \ + /** * SAL (Socket Abstraction Layer) initialize. * @@ -116,6 +129,9 @@ int sal_init(void) return -1; } + /*init the dev_res table */ + rt_memset(sal_dev_res_tbl, 0, sizeof(sal_dev_res_tbl)); + /* create sal socket lock */ rt_mutex_init(&sal_core_lock, "sal_lock", RT_IPC_FLAG_FIFO); @@ -309,12 +325,13 @@ struct sal_socket *sal_get_socket(int socket) { struct sal_socket_table *st = &socket_table; + socket = socket - SAL_SOCKET_OFFSET; + if (socket < 0 || socket >= (int) st->max_socket) { return RT_NULL; } - socket = socket - SAL_SOCKET_OFFSET; /* check socket structure valid or not */ RT_ASSERT(st->sockets[socket]->magic == SAL_SOCKET_MAGIC); @@ -564,6 +581,9 @@ int sal_accept(int socket, struct sockaddr *addr, socklen_t *addrlen) /* get the socket object by socket descriptor */ SAL_SOCKET_OBJ_GET(sock, socket); + /* check the network interface is up status */ + SAL_NETDEV_IS_UP(sock->netdev); + /* check the network interface socket operations */ SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, accept); @@ -679,7 +699,7 @@ int sal_shutdown(int socket, int how) /* get the socket object by socket descriptor */ SAL_SOCKET_OBJ_GET(sock, socket); - /* shutdown operation not nead to check network interface status */ + /* shutdown operation not need to check network interface status */ /* check the network interface socket opreation */ SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, shutdown); @@ -924,6 +944,7 @@ int sal_socket(int domain, int type, int protocol) sock = sal_get_socket(socket); if (sock == RT_NULL) { + socket_delete(socket); return -1; } @@ -956,7 +977,7 @@ int sal_socket(int domain, int type, int protocol) sock->user_data = (void *) proto_socket; return sock->socket; } - + socket_delete(socket); return -1; } @@ -969,9 +990,9 @@ int sal_closesocket(int socket) /* get the socket object by socket descriptor */ SAL_SOCKET_OBJ_GET(sock, socket); - /* clsoesocket operation not nead to vaild network interface status */ + /* clsoesocket operation not need to vaild network interface status */ /* valid the network interface socket opreation */ - SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, socket); + SAL_NETDEV_SOCKETOPS_VALID(sock->netdev, pf, closesocket); if (pf->skt_ops->closesocket((int) sock->user_data) == 0) { @@ -1082,10 +1103,12 @@ int sal_getaddrinfo(const char *nodename, { struct netdev *netdev = netdev_default; struct sal_proto_family *pf; + int ret = 0; + rt_uint32_t i = 0; if (SAL_NETDEV_NETDBOPS_VALID(netdev, pf, getaddrinfo)) { - return pf->netdb_ops->getaddrinfo(nodename, servname, hints, res); + ret = pf->netdb_ops->getaddrinfo(nodename, servname, hints, res); } else { @@ -1093,30 +1116,56 @@ int sal_getaddrinfo(const char *nodename, netdev = netdev_get_first_by_flags(NETDEV_FLAG_UP); if (SAL_NETDEV_NETDBOPS_VALID(netdev, pf, getaddrinfo)) { - return pf->netdb_ops->getaddrinfo(nodename, servname, hints, res); + ret = pf->netdb_ops->getaddrinfo(nodename, servname, hints, res); + } + else + { + ret = -1; } } - return -1; + if(ret == RT_EOK) + { + /*record the netdev and res*/ + for(i = 0; i < SAL_SOCKETS_NUM; i++) + { + if(sal_dev_res_tbl[i].res == RT_NULL) + { + sal_dev_res_tbl[i].res = *res; + sal_dev_res_tbl[i].netdev = netdev; + break; + } + } + + RT_ASSERT((i < SAL_SOCKETS_NUM)); + + } + + return ret; } void sal_freeaddrinfo(struct addrinfo *ai) { - struct netdev *netdev = netdev_default; - struct sal_proto_family *pf; + struct netdev *netdev = RT_NULL; + struct sal_proto_family *pf = RT_NULL; + rt_uint32_t i = 0; - if (SAL_NETDEV_NETDBOPS_VALID(netdev, pf, freeaddrinfo)) + /*when use the multi netdev, it must free the ai use the getaddrinfo netdev */ + for(i = 0; i < SAL_SOCKETS_NUM; i++) { - pf->netdb_ops->freeaddrinfo(ai); - } - else - { - /* get the first network interface device with up status */ - netdev = netdev_get_first_by_flags(NETDEV_FLAG_UP); - if (SAL_NETDEV_NETDBOPS_VALID(netdev, pf, freeaddrinfo)) + if(sal_dev_res_tbl[i].res == ai) { - pf->netdb_ops->freeaddrinfo(ai); + netdev = sal_dev_res_tbl[i].netdev; + sal_dev_res_tbl[i].res = RT_NULL; + sal_dev_res_tbl[i].netdev = RT_NULL; + break; } } + RT_ASSERT((i < SAL_SOCKETS_NUM)); + + if (SAL_NETDBOPS_VALID(netdev, pf, freeaddrinfo)) + { + pf->netdb_ops->freeaddrinfo(ai); + } } diff --git a/components/net/uip/rt-thread/uip_ethernetif.c b/components/net/uip/rt-thread/uip_ethernetif.c index fa4e52461..593fdba2b 100644 --- a/components/net/uip/rt-thread/uip_ethernetif.c +++ b/components/net/uip/rt-thread/uip_ethernetif.c @@ -14,9 +14,9 @@ /* * Copyright (c) 2001-2004 Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, @@ -25,21 +25,21 @@ * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT - * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. - * + * * Author: Adam Dunkels * */ @@ -62,19 +62,19 @@ extern u16_t uip_len, uip_slen; static struct rt_mailbox eth_rx_thread_mb; static struct rt_thread eth_rx_thread; #ifndef RT_LWIP_ETHTHREAD_PRIORITY -#define RT_ETHERNETIF_THREAD_PREORITY 0x90 +#define RT_ETHERNETIF_THREAD_PREORITY 0x90 static char eth_rx_thread_mb_pool[48 * 4]; static char eth_rx_thread_stack[1024]; #else -#define RT_ETHERNETIF_THREAD_PREORITY RT_LWIP_ETHTHREAD_PRIORITY +#define RT_ETHERNETIF_THREAD_PREORITY RT_LWIP_ETHTHREAD_PRIORITY static char eth_rx_thread_mb_pool[RT_LWIP_ETHTHREAD_MBOX_SIZE * 4]; static char eth_rx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; #endif struct eth_tx_msg { - struct netif *netif; - struct pbuf *buf; + struct netif *netif; + struct pbuf *buf; }; static struct rt_mailbox eth_tx_thread_mb; static struct rt_thread eth_tx_thread; @@ -89,225 +89,225 @@ static char eth_tx_thread_stack[RT_LWIP_ETHTHREAD_STACKSIZE]; /* the interface provided to uIP */ err_t eth_init(struct netif *netif) { - return 0; + return 0; } extern err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p); err_t eth_input(struct pbuf *p,struct netif *inp) { - struct eth_hdr *ethhdr; + struct eth_hdr *ethhdr; - if(p != RT_NULL) - { + if(p != RT_NULL) + { #ifdef LINK_STATS - //LINK_STATS_INC(link.recv); -#endif LINK_STATS - - ethhdr = p->payload; - - switch(uip_htons(ethhdr->type)) - { - case ETHTYPE_IP: //ETHTYPE_IP - etharp_ip_input(inp, p); - pbuf_header(p, -((rt_int16_t)sizeof(struct eth_hdr))); - if (tcpip_input(p, inp) != ERR_OK) - { - // discard packet - pbuf_free(p); - } - break; - - case ETHTYPE_ARP: - etharp_arp_input(inp, (struct eth_addr *)inp->hwaddr, p); - break; - - default: - pbuf_free(p); - p = RT_NULL; - break; - } - } + //LINK_STATS_INC(link.recv); +#endif LINK_STATS + + ethhdr = p->payload; + + switch(uip_htons(ethhdr->type)) + { + case ETHTYPE_IP: //ETHTYPE_IP + etharp_ip_input(inp, p); + pbuf_header(p, -((rt_int16_t)sizeof(struct eth_hdr))); + if (tcpip_input(p, inp) != ERR_OK) + { + // discard packet + pbuf_free(p); + } + break; + + case ETHTYPE_ARP: + etharp_arp_input(inp, (struct eth_addr *)inp->hwaddr, p); + break; + + default: + pbuf_free(p); + p = RT_NULL; + break; + } + } return ERR_OK; } err_t ethernetif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr) { - return etharp_output(netif, p, ipaddr); + return etharp_output(netif, p, ipaddr); } err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p) { - struct eth_tx_msg msg; - struct eth_device* enetif; + struct eth_tx_msg msg; + struct eth_device* enetif; - enetif = (struct eth_device*)netif->state; + enetif = (struct eth_device*)netif->state; - /* send a message to eth tx thread */ - msg.netif = netif; - msg.buf = p; - if (rt_mb_send(ð_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK) - { - /* waiting for ack */ - rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER); - } + /* send a message to eth tx thread */ + msg.netif = netif; + msg.buf = p; + if (rt_mb_send(ð_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK) + { + /* waiting for ack */ + rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER); + } - return ERR_OK; + return ERR_OK; } /* ethernetif APIs */ rt_err_t eth_device_init(struct eth_device* dev, const char* name) { - struct netif* netif; + struct netif* netif; uip_ipaddr_t ipaddr; - netif = (struct netif*) rt_malloc (sizeof(struct netif)); - if (netif == RT_NULL) - { - rt_kprintf("malloc netif failed\n"); - return -RT_ERROR; - } - rt_memset(netif, 0, sizeof(struct netif)); - - /* set netif */ - dev->netif = netif; - /* register to rt-thread device manager */ - rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR); - dev->parent.type = RT_Device_Class_NetIf; - rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO); - - /* set name */ - netif->name[0] = name[0]; - netif->name[1] = name[1]; - - /* set hw address to 6 */ - netif->hwaddr_len = 6; - /* maximum transfer unit */ - netif->mtu = ETHERNET_MTU; - /* broadcast capability */ - netif->flags = NETIF_FLAG_BROADCAST; - + netif = (struct netif*) rt_malloc (sizeof(struct netif)); + if (netif == RT_NULL) + { + rt_kprintf("malloc netif failed\n"); + return -RT_ERROR; + } + rt_memset(netif, 0, sizeof(struct netif)); + + /* set netif */ + dev->netif = netif; + /* register to rt-thread device manager */ + rt_device_register(&(dev->parent), name, RT_DEVICE_FLAG_RDWR); + dev->parent.type = RT_Device_Class_NetIf; + rt_sem_init(&(dev->tx_ack), name, 0, RT_IPC_FLAG_FIFO); + + /* set name */ + netif->name[0] = name[0]; + netif->name[1] = name[1]; + + /* set hw address to 6 */ + netif->hwaddr_len = 6; + /* maximum transfer unit */ + netif->mtu = ETHERNET_MTU; + /* broadcast capability */ + netif->flags = NETIF_FLAG_BROADCAST; + #if LWIP_IGMP - /* igmp support */ - netif->flags |= NETIF_FLAG_IGMP; + /* igmp support */ + netif->flags |= NETIF_FLAG_IGMP; #endif - /* get hardware address */ - rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); - - /* set output */ - netif->output = ethernetif_output; - netif->linkoutput = ethernetif_linkoutput; - - /* add netif to lwip */ - - if (netif_add(netif, IP_ADDR_ANY, IP_ADDR_BROADCAST, IP_ADDR_ANY, dev, - eth_init, eth_input) == RT_NULL) - { - /* failed, unregister device and free netif */ - rt_device_unregister(&(dev->parent)); - rt_free(netif); - return -RT_ERROR; - } - - netif_set_default(netif); - return RT_EOK; + /* get hardware address */ + rt_device_control(&(dev->parent), NIOCTL_GADDR, netif->hwaddr); + + /* set output */ + netif->output = ethernetif_output; + netif->linkoutput = ethernetif_linkoutput; + + /* add netif to lwip */ + + if (netif_add(netif, IP_ADDR_ANY, IP_ADDR_BROADCAST, IP_ADDR_ANY, dev, + eth_init, eth_input) == RT_NULL) + { + /* failed, unregister device and free netif */ + rt_device_unregister(&(dev->parent)); + rt_free(netif); + return -RT_ERROR; + } + + netif_set_default(netif); + return RT_EOK; } /* ethernet buffer */ void eth_tx_thread_entry(void* parameter) { - struct eth_tx_msg* msg; - - while (1) - { - if (rt_mb_recv(ð_tx_thread_mb, (rt_uint32_t*)&msg, RT_WAITING_FOREVER) == RT_EOK) - { - struct eth_device* enetif; - - RT_ASSERT(msg->netif != RT_NULL); - RT_ASSERT(msg->buf != RT_NULL); - - enetif = (struct eth_device*)msg->netif->state; - if (enetif != RT_NULL) - { - /* call driver's interface */ - if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK) - { - rt_kprintf("transmit eth packet failed\n"); - } - } - - /* send ack */ - rt_sem_release(&(enetif->tx_ack)); - } - } + struct eth_tx_msg* msg; + + while (1) + { + if (rt_mb_recv(ð_tx_thread_mb, (rt_uint32_t*)&msg, RT_WAITING_FOREVER) == RT_EOK) + { + struct eth_device* enetif; + + RT_ASSERT(msg->netif != RT_NULL); + RT_ASSERT(msg->buf != RT_NULL); + + enetif = (struct eth_device*)msg->netif->state; + if (enetif != RT_NULL) + { + /* call driver's interface */ + if (enetif->eth_tx(&(enetif->parent), msg->buf) != RT_EOK) + { + rt_kprintf("transmit eth packet failed\n"); + } + } + + /* send ack */ + rt_sem_release(&(enetif->tx_ack)); + } + } } /* ethernet buffer */ void eth_rx_thread_entry(void* parameter) { - struct eth_device* device; - - while (1) - { - if (rt_mb_recv(ð_rx_thread_mb, (rt_uint32_t*)&device, RT_WAITING_FOREVER) == RT_EOK) - { - struct pbuf *p; - - /* receive all of buffer */ - while (1) - { - p = device->eth_rx(&(device->parent)); - if (p != RT_NULL) - { - /* notify to upper layer */ - eth_input(p, device->netif); - } - else break; - } - } - } + struct eth_device* device; + + while (1) + { + if (rt_mb_recv(ð_rx_thread_mb, (rt_uint32_t*)&device, RT_WAITING_FOREVER) == RT_EOK) + { + struct pbuf *p; + + /* receive all of buffer */ + while (1) + { + p = device->eth_rx(&(device->parent)); + if (p != RT_NULL) + { + /* notify to upper layer */ + eth_input(p, device->netif); + } + else break; + } + } + } } rt_err_t eth_device_ready(struct eth_device* dev) { - /* post message to ethernet thread */ - return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); + /* post message to ethernet thread */ + return rt_mb_send(ð_rx_thread_mb, (rt_uint32_t)dev); } rt_err_t eth_system_device_init() { - rt_err_t result = RT_EOK; - - /* init rx thread */ - /* init mailbox and create ethernet thread */ - result = rt_mb_init(ð_rx_thread_mb, "erxmb", - ð_rx_thread_mb_pool[0], sizeof(eth_rx_thread_mb_pool)/4, - RT_IPC_FLAG_FIFO); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_init(ð_rx_thread, "erx", eth_rx_thread_entry, RT_NULL, - ð_rx_thread_stack[0], sizeof(eth_rx_thread_stack), - RT_ETHERNETIF_THREAD_PREORITY, 16); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_startup(ð_rx_thread); - RT_ASSERT(result == RT_EOK); - - /* init tx thread */ - /* init mailbox and create ethernet thread */ - - result = rt_mb_init(ð_tx_thread_mb, "etxmb", - ð_tx_thread_mb_pool[0], sizeof(eth_tx_thread_mb_pool)/4, - RT_IPC_FLAG_FIFO); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_init(ð_tx_thread, "etx", eth_tx_thread_entry, RT_NULL, - ð_tx_thread_stack[0], sizeof(eth_tx_thread_stack), - RT_ETHERNETIF_THREAD_PREORITY, 16); - RT_ASSERT(result == RT_EOK); - - result = rt_thread_startup(ð_tx_thread); - RT_ASSERT(result == RT_EOK); - - return result; + rt_err_t result = RT_EOK; + + /* init rx thread */ + /* init mailbox and create ethernet thread */ + result = rt_mb_init(ð_rx_thread_mb, "erxmb", + ð_rx_thread_mb_pool[0], sizeof(eth_rx_thread_mb_pool)/4, + RT_IPC_FLAG_FIFO); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_init(ð_rx_thread, "erx", eth_rx_thread_entry, RT_NULL, + ð_rx_thread_stack[0], sizeof(eth_rx_thread_stack), + RT_ETHERNETIF_THREAD_PREORITY, 16); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_startup(ð_rx_thread); + RT_ASSERT(result == RT_EOK); + + /* init tx thread */ + /* init mailbox and create ethernet thread */ + + result = rt_mb_init(ð_tx_thread_mb, "etxmb", + ð_tx_thread_mb_pool[0], sizeof(eth_tx_thread_mb_pool)/4, + RT_IPC_FLAG_FIFO); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_init(ð_tx_thread, "etx", eth_tx_thread_entry, RT_NULL, + ð_tx_thread_stack[0], sizeof(eth_tx_thread_stack), + RT_ETHERNETIF_THREAD_PREORITY, 16); + RT_ASSERT(result == RT_EOK); + + result = rt_thread_startup(ð_tx_thread); + RT_ASSERT(result == RT_EOK); + + return result; } diff --git a/components/net/uip/uip/lc-switch.h b/components/net/uip/uip/lc-switch.h index f32885fd1..90e22bd09 100644 --- a/components/net/uip/uip/lc-switch.h +++ b/components/net/uip/uip/lc-switch.h @@ -55,7 +55,7 @@ */ #ifndef __LC_SWITCH_H__ -#define __LC_SWTICH_H__ +#define __LC_SWITCH_H__ /* WARNING! lc implementation using switch() does not work if an LC_SET() is done within another switch() statement! */ diff --git a/components/utilities/ulog/backend/console_be.c b/components/utilities/ulog/backend/console_be.c index 95dd54742..b84cd95d0 100644 --- a/components/utilities/ulog/backend/console_be.c +++ b/components/utilities/ulog/backend/console_be.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/utilities/ulog/syslog/syslog.c b/components/utilities/ulog/syslog/syslog.c index 7586148fb..a081db6eb 100644 --- a/components/utilities/ulog/syslog/syslog.c +++ b/components/utilities/ulog/syslog/syslog.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,6 +11,7 @@ #include #include #include +#include #include "syslog.h" #ifdef ULOG_OUTPUT_FLOAT @@ -192,10 +193,10 @@ RT_WEAK rt_size_t syslog_formater(char *log_buf, int level, const char *tag, rt_ #ifdef ULOG_OUTPUT_LEVEL rt_snprintf(log_buf + log_len, ULOG_LINE_BUF_SIZE - log_len, "<%d>%s%3d %02d:%02d:%02d", level, - get_month_str(tm->tm_mon + 1), tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rt_tick_get() % 1000); + get_month_str(tm->tm_mon + 1), tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); #else rt_snprintf(log_buf + log_len, ULOG_LINE_BUF_SIZE - log_len, "%s%3d %02d:%02d:%02d", - get_month_str(tm->tm_mon + 1), tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, rt_tick_get() % 1000); + get_month_str(tm->tm_mon + 1), tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec); #endif /* ULOG_OUTPUT_LEVEL */ log_len += rt_strlen(log_buf + log_len); diff --git a/components/utilities/ulog/syslog/syslog.h b/components/utilities/ulog/syslog/syslog.h index 43eec7125..8e4d5ba15 100644 --- a/components/utilities/ulog/syslog/syslog.h +++ b/components/utilities/ulog/syslog/syslog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/utilities/ulog/ulog.c b/components/utilities/ulog/ulog.c index 8a8d142ef..757fa5276 100644 --- a/components/utilities/ulog/ulog.c +++ b/components/utilities/ulog/ulog.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -81,12 +81,12 @@ struct rt_ulog /* all backends */ rt_slist_t backend_list; /* the thread log's line buffer */ - char log_buf_th[ULOG_LINE_BUF_SIZE]; + char log_buf_th[ULOG_LINE_BUF_SIZE + 1]; #ifdef ULOG_USING_ISR_LOG /* the ISR log's line buffer */ rt_base_t output_locker_isr_lvl; - char log_buf_isr[ULOG_LINE_BUF_SIZE]; + char log_buf_isr[ULOG_LINE_BUF_SIZE + 1]; #endif /* ULOG_USING_ISR_LOG */ #ifdef ULOG_USING_ASYNC_OUTPUT @@ -396,7 +396,7 @@ void ulog_output_to_all_backend(rt_uint32_t level, const char *tag, rt_bool_t is #if !defined(ULOG_USING_COLOR) || defined(ULOG_USING_SYSLOG) backend->output(backend, level, tag, is_raw, log, size); #else - if (backend->support_color) + if (backend->support_color || is_raw) { backend->output(backend, level, tag, is_raw, log, size); } @@ -728,6 +728,8 @@ void ulog_hexdump(const char *tag, rt_size_t width, rt_uint8_t *buf, rt_size_t s } /* package newline sign */ log_len += ulog_strcpy(log_len, log_buf + log_len, ULOG_NEWLINE_SIGN); + /*add string end sign*/ + log_buf[log_len] = '\0'; /* do log output */ do_output(LOG_LVL_DBG, NULL, RT_TRUE, log_buf, log_len); } diff --git a/components/utilities/ulog/ulog.h b/components/utilities/ulog/ulog.h index c78d72eda..1fab86f38 100644 --- a/components/utilities/ulog/ulog.h +++ b/components/utilities/ulog/ulog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/utilities/ulog/ulog_def.h b/components/utilities/ulog/ulog_def.h index de5e82fcc..d1b276de7 100644 --- a/components/utilities/ulog/ulog_def.h +++ b/components/utilities/ulog/ulog_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -102,8 +102,8 @@ extern "C" { #define ulog_hex(TAG, width, buf, size) ulog_hexdump(TAG, width, buf, size) #else #define ulog_hex(TAG, width, buf, size) -#endif /* (LOG_LVL >= LOG_LVL_DBG) && (ULOG_OUTPUT_LVL >= LOG_LVL_DBG) */ - +#endif /* (LOG_LVL >= LOG_LVL_DBG) && (ULOG_OUTPUT_LVL >= LOG_LVL_DBG) */ + /* assert for developer. */ #ifdef ULOG_ASSERT_ENABLE #define ULOG_ASSERT(EXPR) \ @@ -142,7 +142,7 @@ extern "C" { #define log_d LOG_D #define log_v LOG_D #define log_raw LOG_RAW -#define log_hex LOG_HEX +#define log_hex LOG_HEX #define ELOG_LVL_ASSERT LOG_LVL_ASSERT #define ELOG_LVL_ERROR LOG_LVL_ERROR #define ELOG_LVL_WARN LOG_LVL_WARNING diff --git a/components/utilities/utest/utest.c b/components/utilities/utest/utest.c index 6500ae2fb..325823de8 100644 --- a/components/utilities/utest/utest.c +++ b/components/utilities/utest/utest.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/utilities/utest/utest.h b/components/utilities/utest/utest.h index 2c91bfe0e..6822c1a13 100644 --- a/components/utilities/utest/utest.h +++ b/components/utilities/utest/utest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,6 +12,7 @@ #define __UTEST_H__ #include +#include #include "utest_log.h" #include "utest_assert.h" @@ -21,13 +22,13 @@ extern "C" { /** * utest_error - * + * * @brief Test result. - * + * * @member UTEST_PASSED Test success. * @member UTEST_FAILED Test failed. * @member UTEST_PASSED Test skipped. - * + * */ enum utest_error { @@ -39,13 +40,13 @@ typedef enum utest_error utest_err_e; /** * utest - * + * * @brief utest data structure. - * + * * @member error Error number from enum `utest_error`. * @member passed_num Total number of tests passed. * @member failed_num Total number of tests failed. - * + * */ struct utest { @@ -57,16 +58,16 @@ typedef struct utest *utest_t; /** * utest_tc_export - * + * * @brief utest testcase data structure. * Will export the data to `UtestTcTab` section in flash. - * + * * @member name Testcase name. * @member run_timeout Testcase maximum test time (Time unit: seconds). * @member init Necessary initialization before executing the test case function. * @member tc Total number of tests failed. * @member cleanup Total number of tests failed. - * + * */ struct utest_tc_export { const char *name; @@ -79,61 +80,61 @@ typedef struct utest_tc_export *utest_tc_export_t; /** * test_unit_func - * + * * @brief Unit test handler function pointer. - * + * */ typedef void (*test_unit_func)(void); /** * utest_unit_run - * + * * @brief Unit test function executor. * No need for the user to call this function directly - * + * * @param func Unit test function. * @param unit_func_name Unit test function name. - * + * * @return void - * + * */ void utest_unit_run(test_unit_func func, const char *unit_func_name); /** * utest_handle_get - * + * * @brief Get the utest data structure handle. * No need for the user to call this function directly - * + * * @param void - * + * * @return utest_t type. (struct utest *) - * + * */ utest_t utest_handle_get(void); /** * UTEST_NAME_MAX_LEN - * + * * @brief Testcase name maximum length. - * + * */ #define UTEST_NAME_MAX_LEN (128u) /** * UTEST_TC_EXPORT - * + * * @brief Export testcase function to `UtestTcTab` section in flash. * Used in application layer. - * + * * @param testcase The testcase function. * @param name The testcase name. * @param init The initialization function of the test case. * @param cleanup The cleanup function of the test case. * @param timeout Testcase maximum test time (Time unit: seconds). - * + * * @return None - * + * */ #define UTEST_TC_EXPORT(testcase, name, init, cleanup, timeout) \ RT_USED static const struct utest_tc_export _utest_testcase \ @@ -148,14 +149,14 @@ utest_t utest_handle_get(void); /** * UTEST_UNIT_RUN - * + * * @brief Unit test function executor. * Used in `testcase` function in application. - * + * * @param test_unit_func Unit test function - * + * * @return None - * + * */ #define UTEST_UNIT_RUN(test_unit_func) \ utest_unit_run(test_unit_func, #test_unit_func); \ diff --git a/components/utilities/utest/utest_assert.h b/components/utilities/utest/utest_assert.h index d83279272..2e2007e77 100644 --- a/components/utilities/utest/utest_assert.h +++ b/components/utilities/utest/utest_assert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,10 +30,10 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa /** * uassert_x macros - * + * * @brief Get the utest data structure handle. * No need for the user to call this function directly. - * + * * @macro uassert_true if @value is true, not assert, means passing. * @macro uassert_false if @value is false, not assert, means passing. * @macro uassert_null if @value is null, not assert, means passing. @@ -46,7 +46,7 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa * @macro uassert_buf_not_equal if @a not equal to @b, not assert, means passing. buf type test. * @macro uassert_in_range if @value is in range of min and max, not assert, means passing. * @macro uassert_not_in_range if @value is not in range of min and max, not assert, means passing. - * + * */ #define uassert_true(value) __utest_assert(value, "(" #value ") is false") #define uassert_false(value) __utest_assert(!(value), "(" #value ") is true") @@ -62,7 +62,7 @@ void utest_assert_buf(const char *a, const char *b, rt_size_t sz, rt_bool_t equa #define uassert_buf_equal(a, b, sz) utest_assert_buf((const char*)(a), (const char*)(b), (sz), RT_TRUE, __FILE__, __LINE__, __func__, "buf not equal") #define uassert_buf_not_equal(a, b, sz) utest_assert_buf((const char*)(a), (const char*)(b), (sz), RT_FALSE, __FILE__, __LINE__, __func__, "buf equal") -#define uassert_in_range(value, min, max) __utest_assert(((value >= min) && (value <= max)), "(" #value ") not in range("#min","#max")") +#define uassert_in_range(value, min, max) __utest_assert(((value >= min) && (value <= max)), "(" #value ") not in range("#min","#max")") #define uassert_not_in_range(value, min, max) __utest_assert(!((value >= min) && (value <= max)), "(" #value ") in range("#min","#max")") #ifdef __cplusplus diff --git a/components/utilities/utest/utest_log.h b/components/utilities/utest/utest_log.h index 040326835..6aa54386a 100644 --- a/components/utilities/utest/utest_log.h +++ b/components/utilities/utest/utest_log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/utilities/ymodem/ry_sy.c b/components/utilities/ymodem/ry_sy.c index 4f4476e40..a87f6949d 100644 --- a/components/utilities/ymodem/ry_sy.c +++ b/components/utilities/ymodem/ry_sy.c @@ -40,7 +40,7 @@ static enum rym_code _rym_recv_begin( rt_kprintf("error creating file: %d\n", err); return RYM_CODE_CAN; } - cctx->flen = atoi((const char *)buf + rt_strnlen((const char *)buf, len - 1)); + cctx->flen = atoi(1 + (const char *)buf + rt_strnlen((const char *)buf, len - 1)); if (cctx->flen == 0) cctx->flen = -1; diff --git a/components/utilities/ymodem/ymodem.c b/components/utilities/ymodem/ymodem.c index 07055db61..8e4b04258 100644 --- a/components/utilities/ymodem/ymodem.c +++ b/components/utilities/ymodem/ymodem.c @@ -13,7 +13,7 @@ #include #include "ymodem.h" -#ifdef YMODEM_USING_CRC_TABLE +#ifdef YMODEM_USING_CRC_TABLE static const rt_uint16_t ccitt_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, diff --git a/components/vbus/prio_queue.c b/components/vbus/prio_queue.c index bca3cdcd9..f7f5bb05a 100644 --- a/components/vbus/prio_queue.c +++ b/components/vbus/prio_queue.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vbus/prio_queue.h b/components/vbus/prio_queue.h index 7358ffdb2..3e214212f 100644 --- a/components/vbus/prio_queue.h +++ b/components/vbus/prio_queue.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vbus/share_hdr/vbus_api.h b/components/vbus/share_hdr/vbus_api.h index db6cb7b72..a643822a9 100644 --- a/components/vbus/share_hdr/vbus_api.h +++ b/components/vbus/share_hdr/vbus_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/components/vbus/vbus.c b/components/vbus/vbus.c index 8add15d9d..e24a0eed0 100644 --- a/components/vbus/vbus.c +++ b/components/vbus/vbus.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -899,8 +899,8 @@ int rt_vbus_request_chn(struct rt_vbus_request *req, int timeout) { int i, chnr, err; - size_t plen = rt_strlen(req->name) + 2; - unsigned char *pbuf; + size_t plen = rt_strlen(req->name) + 2; + unsigned char *pbuf; rt_ubase_t lvl; lvl = rt_hw_interrupt_disable(); @@ -930,8 +930,8 @@ int rt_vbus_request_chn(struct rt_vbus_request *req, goto _waitforcmp; } - pbuf = rt_malloc(plen); - if (!pbuf) + pbuf = rt_malloc(plen); + if (!pbuf) { rt_hw_interrupt_enable(lvl); return -RT_ENOMEM; @@ -944,7 +944,7 @@ int rt_vbus_request_chn(struct rt_vbus_request *req, rt_memcpy(pbuf+1, req->name, plen-1); vbus_verbose("%s --> remote\n", dump_cmd_pkt(pbuf, plen)); - err = _chn0_post(pbuf, plen, RT_WAITING_FOREVER); + err = _chn0_post(pbuf, plen, RT_WAITING_FOREVER); rt_free(pbuf); _waitforcmp: diff --git a/components/vbus/vbus.h b/components/vbus/vbus.h index ea271d8e7..9434daf9e 100644 --- a/components/vbus/vbus.h +++ b/components/vbus/vbus.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -51,14 +51,14 @@ struct rt_vbus_data { }; struct rt_vbus_wm_cfg { - unsigned int low, high; + unsigned int low, high; }; struct rt_vbus_request { - unsigned char prio; - const char *name; - int is_server; - struct rt_vbus_wm_cfg recv_wm, post_wm; + unsigned char prio; + const char *name; + int is_server; + struct rt_vbus_wm_cfg recv_wm, post_wm; }; /** Request a channel. diff --git a/components/vbus/vbus_chnx.c b/components/vbus/vbus_chnx.c index d064d6f1f..8529989f6 100644 --- a/components/vbus/vbus_chnx.c +++ b/components/vbus/vbus_chnx.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vbus/watermark_queue.c b/components/vbus/watermark_queue.c index e56790d28..7a39b1135 100644 --- a/components/vbus/watermark_queue.c +++ b/components/vbus/watermark_queue.c @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vbus/watermark_queue.h b/components/vbus/watermark_queue.h index 0ecc52d8f..50bbc6957 100644 --- a/components/vbus/watermark_queue.h +++ b/components/vbus/watermark_queue.h @@ -1,6 +1,6 @@ /* * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm.c b/components/vmm/vmm.c index 7d6f9875d..f91858b83 100644 --- a/components/vmm/vmm.c +++ b/components/vmm/vmm.c @@ -1,9 +1,9 @@ /* * VMM startup file. * - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm.h b/components/vmm/vmm.h index 17bba8439..93788a9b1 100644 --- a/components/vmm/vmm.h +++ b/components/vmm/vmm.h @@ -1,9 +1,9 @@ /* * VMM startup file. * - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm_context.c b/components/vmm/vmm_context.c index 91641a483..e59f53200 100644 --- a/components/vmm/vmm_context.c +++ b/components/vmm/vmm_context.c @@ -1,7 +1,7 @@ /* - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm_context.h b/components/vmm/vmm_context.h index 019b68145..42bc9df16 100644 --- a/components/vmm/vmm_context.h +++ b/components/vmm/vmm_context.h @@ -1,7 +1,7 @@ /* - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm_iomap.c b/components/vmm/vmm_iomap.c index 55bd1ac36..526090aba 100644 --- a/components/vmm/vmm_iomap.c +++ b/components/vmm/vmm_iomap.c @@ -1,9 +1,9 @@ /* * VMM IO map table * - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: diff --git a/components/vmm/vmm_vector.c b/components/vmm/vmm_vector.c index d7909607c..580a88f41 100644 --- a/components/vmm/vmm_vector.c +++ b/components/vmm/vmm_vector.c @@ -1,9 +1,9 @@ /* * VMM vector handle - * - * COPYRIGHT (C) 2013-2014, Real-Thread Information Technology Ltd + * + * COPYRIGHT (C) 2013-2021, Real-Thread Information Technology Ltd * All rights reserved - * + * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: @@ -23,9 +23,9 @@ void vmm_guest_isr(int irqno, void* parameter) void vmm_vector_init(void) { - rt_hw_interrupt_install(RT_VMM_VIRQ_TRIGGER, vmm_guest_isr, RT_NULL, "virq"); - rt_hw_interrupt_umask(RT_VMM_VIRQ_TRIGGER); + rt_hw_interrupt_install(RT_VMM_VIRQ_TRIGGER, vmm_guest_isr, RT_NULL, "virq"); + rt_hw_interrupt_umask(RT_VMM_VIRQ_TRIGGER); - return; + return; } diff --git a/documentation/doxygen/kernel.h b/documentation/doxygen/kernel.h index b54144780..0702f3556 100644 --- a/documentation/doxygen/kernel.h +++ b/documentation/doxygen/kernel.h @@ -32,10 +32,10 @@ * round-robin scheduling is used for this case. * - The time of scheduler to choose the next highest ready thread is determinant. * - There are four status in thread management - * -# Initialization - * -# Running/Ready - * -# Blocked - * -# Closed + * -# Initialization + * -# Running/Ready + * -# Blocked + * -# Closed * - The number of threads in the system is unlimited, only related with RAM. */ diff --git a/documentation/doxygen/systeminit.h b/documentation/doxygen/systeminit.h index d62aca59b..2167e2d6f 100644 --- a/documentation/doxygen/systeminit.h +++ b/documentation/doxygen/systeminit.h @@ -7,7 +7,7 @@ * * @brief System initialization procedure. * - * When RT-Thread operating system starts up, the basic operating system facility + * When RT-Thread operating system starts up, the basic operating system facility * initialization routines must be invoked. * * The suggested initialization sequence is: diff --git a/examples/file/listdir.c b/examples/file/listdir.c index cf91bc77d..eee3f04f6 100644 --- a/examples/file/listdir.c +++ b/examples/file/listdir.c @@ -17,37 +17,37 @@ static char fullpath[256]; void list_dir(const char* path) { - DIR *dir; + DIR *dir; - dir = opendir(path); - if (dir != RT_NULL) - { - struct dirent* dirent; - struct stat s; + dir = opendir(path); + if (dir != RT_NULL) + { + struct dirent* dirent; + struct stat s; - do - { - dirent = readdir(dir); - if (dirent == RT_NULL) break; - rt_memset(&s, 0, sizeof(struct stat)); + do + { + dirent = readdir(dir); + if (dirent == RT_NULL) break; + rt_memset(&s, 0, sizeof(struct stat)); - /* build full path for each file */ - rt_sprintf(fullpath, "%s/%s", path, dirent->d_name); + /* build full path for each file */ + rt_sprintf(fullpath, "%s/%s", path, dirent->d_name); - stat(fullpath, &s); - if ( s.st_mode & DFS_S_IFDIR ) - { - rt_kprintf("%s\t\t\n", dirent->d_name); - } - else - { - rt_kprintf("%s\t\t%lu\n", dirent->d_name, s.st_size); - } - } while (dirent != RT_NULL); + stat(fullpath, &s); + if ( s.st_mode & DFS_S_IFDIR ) + { + rt_kprintf("%s\t\t\n", dirent->d_name); + } + else + { + rt_kprintf("%s\t\t%lu\n", dirent->d_name, s.st_size); + } + } while (dirent != RT_NULL); - closedir(dir); - } - else rt_kprintf("open %s directory failed\n", path); + closedir(dir); + } + else rt_kprintf("open %s directory failed\n", path); } #ifdef RT_USING_FINSH diff --git a/examples/file/readspeed.c b/examples/file/readspeed.c index 52f15b627..aeeb43f86 100644 --- a/examples/file/readspeed.c +++ b/examples/file/readspeed.c @@ -50,9 +50,9 @@ void readspeed(const char* filename, int block_size) } tick = rt_tick_get() - tick; - /* close file and release memory */ + /* close file and release memory */ close(fd); - rt_free(buff_ptr); + rt_free(buff_ptr); /* calculate read speed */ rt_kprintf("File read speed: %d byte/s\n", total_length /tick * RT_TICK_PER_SECOND); diff --git a/examples/file/writespeed.c b/examples/file/writespeed.c index ab6946888..ff96b81b4 100644 --- a/examples/file/writespeed.c +++ b/examples/file/writespeed.c @@ -36,31 +36,31 @@ void writespeed(const char* filename, int total_length, int block_size) return; } - /* prepare write data */ - for (index = 0; index < block_size; index++) - { - buff_ptr[index] = index; - } - index = 0; + /* prepare write data */ + for (index = 0; index < block_size; index++) + { + buff_ptr[index] = index; + } + index = 0; - /* get the beginning tick */ + /* get the beginning tick */ tick = rt_tick_get(); - while (index < total_length / block_size) - { - length = write(fd, buff_ptr, block_size); - if (length != block_size) - { - rt_kprintf("write failed\n"); - break; - } + while (index < total_length / block_size) + { + length = write(fd, buff_ptr, block_size); + if (length != block_size) + { + rt_kprintf("write failed\n"); + break; + } - index ++; - } + index ++; + } tick = rt_tick_get() - tick; - /* close file and release memory */ + /* close file and release memory */ close(fd); - rt_free(buff_ptr); + rt_free(buff_ptr); /* calculate write speed */ rt_kprintf("File write speed: %d byte/s\n", total_length / tick * RT_TICK_PER_SECOND); diff --git a/examples/kernel/tc_comm.h b/examples/kernel/tc_comm.h index aee1fec2d..c72c91ad5 100644 --- a/examples/kernel/tc_comm.h +++ b/examples/kernel/tc_comm.h @@ -1,7 +1,7 @@ #ifndef __TC_COMM_H__ #define __TC_COMM_H__ -/* +/* * RT-Thread TestCase * */ diff --git a/examples/pm/timer_app.c b/examples/pm/timer_app.c index b7ff675b3..579769314 100644 --- a/examples/pm/timer_app.c +++ b/examples/pm/timer_app.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/examples/pm/wakeup_app.c b/examples/pm/wakeup_app.c index 0d4c42a99..d287bf74e 100644 --- a/examples/pm/wakeup_app.c +++ b/examples/pm/wakeup_app.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/examples/test/net_test.c b/examples/test/net_test.c index 53bd2836f..b37543eaf 100644 --- a/examples/test/net_test.c +++ b/examples/test/net_test.c @@ -7,108 +7,108 @@ #include #include -/* +/* * UDP echo server */ #define UDP_ECHO_PORT 7 rt_thread_t udpecho_tid = RT_NULL; void udpecho_entry(void *parameter) { - struct netconn *conn; - struct netbuf *buf; - struct ip_addr *addr; - unsigned short port; + struct netconn *conn; + struct netbuf *buf; + struct ip_addr *addr; + unsigned short port; - conn = netconn_new(NETCONN_UDP); - netconn_bind(conn, IP_ADDR_ANY, 7); + conn = netconn_new(NETCONN_UDP); + netconn_bind(conn, IP_ADDR_ANY, 7); - while(1) - { + while(1) + { /* received data to buffer */ -#if LWIP_VERSION_MINOR==3U - buf = netconn_recv(conn); +#if LWIP_VERSION_MINOR==3U + buf = netconn_recv(conn); #else - netconn_recv(conn, &buf); + netconn_recv(conn, &buf); #endif - - addr = netbuf_fromaddr(buf); - port = netbuf_fromport(buf); - /* send the data to buffer */ - netconn_connect(conn, addr, port); + addr = netbuf_fromaddr(buf); + port = netbuf_fromport(buf); + + /* send the data to buffer */ + netconn_connect(conn, addr, port); - /* reset address, and send to client */ -#if LWIP_VERSION_MINOR==3U - buf->addr = RT_NULL; + /* reset address, and send to client */ +#if LWIP_VERSION_MINOR==3U + buf->addr = RT_NULL; #else - buf->addr = *IP_ADDR_ANY; + buf->addr = *IP_ADDR_ANY; #endif - - netconn_send(conn, buf); - - /* release buffer */ - netbuf_delete(buf); - } + + netconn_send(conn, buf); + + /* release buffer */ + netbuf_delete(buf); + } } /* * UDP socket echo server */ -#define UDP_SOCKET_ECHO_PORT 700 -#define UDP_SOCKET_BUFFER_SIZE 4096 +#define UDP_SOCKET_ECHO_PORT 700 +#define UDP_SOCKET_BUFFER_SIZE 4096 rt_thread_t udpecho_socket_tid = RT_NULL; void udpecho_socket_entry(void *parameter) { - int sock; - int bytes_read; - char *recv_data; - rt_uint32_t addr_len; - struct sockaddr_in server_addr, client_addr; - - /* allocate the data buffer */ - recv_data = rt_malloc(UDP_SOCKET_BUFFER_SIZE); - if (recv_data == RT_NULL) - { - /* no memory yet */ - rt_kprintf("no memory\n"); - goto _exit; - } - /* create a UDP socket */ - if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) - { - rt_kprintf("create socket error\n"); - goto _exit; - } - - /* initialize server address */ - server_addr.sin_family = AF_INET; - server_addr.sin_port = htons(UDP_SOCKET_ECHO_PORT); - server_addr.sin_addr.s_addr = INADDR_ANY; - rt_memset(&(server_addr.sin_zero),0, sizeof(server_addr.sin_zero)); - - /* bind socket to server address */ - if (bind(sock,(struct sockaddr *)&server_addr, - sizeof(struct sockaddr)) == -1) - { - /* bind failed */ - rt_kprintf("bind error\n"); - goto _exit; - } - - addr_len = sizeof(struct sockaddr); - while (1) - { - /* try to receive from UDP socket */ - bytes_read = recvfrom(sock, recv_data, UDP_SOCKET_BUFFER_SIZE, 0, - (struct sockaddr *)&client_addr, &addr_len); - - /* send back */ - sendto(sock, recv_data, bytes_read, 0, - (struct sockaddr *)&client_addr, addr_len); - } + int sock; + int bytes_read; + char *recv_data; + rt_uint32_t addr_len; + struct sockaddr_in server_addr, client_addr; + + /* allocate the data buffer */ + recv_data = rt_malloc(UDP_SOCKET_BUFFER_SIZE); + if (recv_data == RT_NULL) + { + /* no memory yet */ + rt_kprintf("no memory\n"); + goto _exit; + } + /* create a UDP socket */ + if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) + { + rt_kprintf("create socket error\n"); + goto _exit; + } + + /* initialize server address */ + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(UDP_SOCKET_ECHO_PORT); + server_addr.sin_addr.s_addr = INADDR_ANY; + rt_memset(&(server_addr.sin_zero),0, sizeof(server_addr.sin_zero)); + + /* bind socket to server address */ + if (bind(sock,(struct sockaddr *)&server_addr, + sizeof(struct sockaddr)) == -1) + { + /* bind failed */ + rt_kprintf("bind error\n"); + goto _exit; + } + + addr_len = sizeof(struct sockaddr); + while (1) + { + /* try to receive from UDP socket */ + bytes_read = recvfrom(sock, recv_data, UDP_SOCKET_BUFFER_SIZE, 0, + (struct sockaddr *)&client_addr, &addr_len); + + /* send back */ + sendto(sock, recv_data, bytes_read, 0, + (struct sockaddr *)&client_addr, addr_len); + } _exit: - rt_free(recv_data); - return; + rt_free(recv_data); + return; } /* @@ -118,59 +118,59 @@ void udpecho_socket_entry(void *parameter) rt_thread_t tcpecho_tid = RT_NULL; void tcpecho_entry(void *parameter) { - struct netconn *conn, *newconn; - err_t err; + struct netconn *conn, *newconn; + err_t err; - /* Create a new connection identifier. */ - conn = netconn_new(NETCONN_TCP); + /* Create a new connection identifier. */ + conn = netconn_new(NETCONN_TCP); - /* Bind connection to well known port number 7. */ - netconn_bind(conn, NULL, TCP_ECHO_PORT); + /* Bind connection to well known port number 7. */ + netconn_bind(conn, NULL, TCP_ECHO_PORT); - /* Tell connection to go into listening mode. */ - netconn_listen(conn); + /* Tell connection to go into listening mode. */ + netconn_listen(conn); - while(1) - { - /* Grab new connection. */ -#if LWIP_VERSION_MINOR==3U - newconn = netconn_accept(conn); - if(newconn != NULL) + while(1) + { + /* Grab new connection. */ +#if LWIP_VERSION_MINOR==3U + newconn = netconn_accept(conn); + if(newconn != NULL) #else - err = netconn_accept(conn, &newconn); - if(err == ERR_OK) + err = netconn_accept(conn, &newconn); + if(err == ERR_OK) #endif - /* Process the new connection. */ - { - struct netbuf *buf; - void *data; - u16_t len; + /* Process the new connection. */ + { + struct netbuf *buf; + void *data; + u16_t len; #if LWIP_VERSION_MINOR==3U - while((buf = netconn_recv(newconn)) != NULL) + while((buf = netconn_recv(newconn)) != NULL) #else - while((err = netconn_recv(newconn, &buf)) == ERR_OK) + while((err = netconn_recv(newconn, &buf)) == ERR_OK) #endif - { - do - { - netbuf_data(buf, &data, &len); - err = netconn_write(newconn, data, len, NETCONN_COPY); - if(err != ERR_OK){} - } - while(netbuf_next(buf) >= 0); - netbuf_delete(buf); - } - /* Close connection and discard connection identifier. */ - netconn_delete(newconn); - } - } + { + do + { + netbuf_data(buf, &data, &len); + err = netconn_write(newconn, data, len, NETCONN_COPY); + if(err != ERR_OK){} + } + while(netbuf_next(buf) >= 0); + netbuf_delete(buf); + } + /* Close connection and discard connection identifier. */ + netconn_delete(newconn); + } + } } /* * TCP socket echo server */ -#define TCP_SOCKET_ECHO_PORT 700 -#define TCP_SOCKET_BUFFER_SIZE 4096 +#define TCP_SOCKET_ECHO_PORT 700 +#define TCP_SOCKET_BUFFER_SIZE 4096 rt_thread_t tcpecho_socket_tid = RT_NULL; void tcpecho_socket_entry(void *parameter) { @@ -179,79 +179,79 @@ void tcpecho_socket_entry(void *parameter) int sock = -1, connected, bytes_received; struct sockaddr_in server_addr, client_addr; - recv_data = rt_malloc(TCP_SOCKET_BUFFER_SIZE); - if (recv_data == RT_NULL) - { - rt_kprintf("no memory\n"); - goto _exit; - } - - /* create a TCP socket */ - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) - { - rt_kprintf("create socket error\n"); - goto _exit; - } - - /* initialize server address */ - server_addr.sin_family = AF_INET; - server_addr.sin_port = htons(TCP_SOCKET_ECHO_PORT); - server_addr.sin_addr.s_addr = INADDR_ANY; - rt_memset(&(server_addr.sin_zero),8, sizeof(server_addr.sin_zero)); - - /* bind to server address */ - if (bind(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1) - { - rt_kprintf("bind address failed\n"); - goto _exit; + recv_data = rt_malloc(TCP_SOCKET_BUFFER_SIZE); + if (recv_data == RT_NULL) + { + rt_kprintf("no memory\n"); + goto _exit; + } + + /* create a TCP socket */ + if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) + { + rt_kprintf("create socket error\n"); + goto _exit; + } + + /* initialize server address */ + server_addr.sin_family = AF_INET; + server_addr.sin_port = htons(TCP_SOCKET_ECHO_PORT); + server_addr.sin_addr.s_addr = INADDR_ANY; + rt_memset(&(server_addr.sin_zero),8, sizeof(server_addr.sin_zero)); + + /* bind to server address */ + if (bind(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1) + { + rt_kprintf("bind address failed\n"); + goto _exit; } - /* listen */ - if (listen(sock, 5) == -1) - { - rt_kprintf("listen error\n"); - goto _exit; - } - - sin_size = sizeof(struct sockaddr_in); - while(1) - { - /* accept client connected */ - connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size); - if (connected > 0) - { - int timeout; - - /* set timeout option */ - timeout = 5000; /* 5second */ - setsockopt(connected, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); - - /* handle this client */ - while (1) - { - /* receive data from this connection */ - bytes_received = recv(connected,recv_data, TCP_SOCKET_BUFFER_SIZE, 0); - if (bytes_received <= 0) - { - rt_kprintf("close client connection, errno: %d\n", - rt_get_errno()); - /* connection closed. */ - lwip_close(connected); - break; - } - - /* send data to client */ - send(connected, recv_data, bytes_received, 0); - } - } + /* listen */ + if (listen(sock, 5) == -1) + { + rt_kprintf("listen error\n"); + goto _exit; + } + + sin_size = sizeof(struct sockaddr_in); + while(1) + { + /* accept client connected */ + connected = accept(sock, (struct sockaddr *)&client_addr, &sin_size); + if (connected > 0) + { + int timeout; + + /* set timeout option */ + timeout = 5000; /* 5second */ + setsockopt(connected, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); + + /* handle this client */ + while (1) + { + /* receive data from this connection */ + bytes_received = recv(connected,recv_data, TCP_SOCKET_BUFFER_SIZE, 0); + if (bytes_received <= 0) + { + rt_kprintf("close client connection, errno: %d\n", + rt_get_errno()); + /* connection closed. */ + lwip_close(connected); + break; + } + + /* send data to client */ + send(connected, recv_data, bytes_received, 0); + } + } } _exit: - /* close socket */ - if (sock != -1) lwip_close(sock); - rt_free(recv_data); + /* close socket */ + if (sock != -1) lwip_close(sock); + rt_free(recv_data); - return ; + return ; } /* @@ -261,40 +261,40 @@ void tcpecho_socket_entry(void *parameter) /* network test utilities entry */ void net_test(void) { - /* start UDP echo server */ - if (udpecho_tid == RT_NULL) - { - udpecho_tid = rt_thread_create("uecho", - udpecho_entry, RT_NULL, - 512, RT_THREAD_PRIORITY_MAX/2, 5); - if (udpecho_tid != RT_NULL) - rt_thread_startup(udpecho_tid); - } - if (udpecho_socket_tid == RT_NULL) - { - udpecho_socket_tid = rt_thread_create("uecho_s", - udpecho_socket_entry, RT_NULL, - 512, RT_THREAD_PRIORITY_MAX/2 + 1, 5); - if (udpecho_socket_tid != RT_NULL) - rt_thread_startup(udpecho_socket_tid); - } - - if (tcpecho_tid == RT_NULL) - { - tcpecho_tid = rt_thread_create("techo", - tcpecho_entry, RT_NULL, - 512, RT_THREAD_PRIORITY_MAX/2 + 2, 5); - if (tcpecho_tid != RT_NULL) - rt_thread_startup(tcpecho_tid); - } - if (tcpecho_socket_tid == RT_NULL) - { - tcpecho_socket_tid = rt_thread_create("techo_s", - tcpecho_socket_entry, RT_NULL, - 512, RT_THREAD_PRIORITY_MAX/2 + 3, 5); - if (tcpecho_socket_tid != RT_NULL) - rt_thread_startup(tcpecho_socket_tid); - } + /* start UDP echo server */ + if (udpecho_tid == RT_NULL) + { + udpecho_tid = rt_thread_create("uecho", + udpecho_entry, RT_NULL, + 512, RT_THREAD_PRIORITY_MAX/2, 5); + if (udpecho_tid != RT_NULL) + rt_thread_startup(udpecho_tid); + } + if (udpecho_socket_tid == RT_NULL) + { + udpecho_socket_tid = rt_thread_create("uecho_s", + udpecho_socket_entry, RT_NULL, + 512, RT_THREAD_PRIORITY_MAX/2 + 1, 5); + if (udpecho_socket_tid != RT_NULL) + rt_thread_startup(udpecho_socket_tid); + } + + if (tcpecho_tid == RT_NULL) + { + tcpecho_tid = rt_thread_create("techo", + tcpecho_entry, RT_NULL, + 512, RT_THREAD_PRIORITY_MAX/2 + 2, 5); + if (tcpecho_tid != RT_NULL) + rt_thread_startup(tcpecho_tid); + } + if (tcpecho_socket_tid == RT_NULL) + { + tcpecho_socket_tid = rt_thread_create("techo_s", + tcpecho_socket_entry, RT_NULL, + 512, RT_THREAD_PRIORITY_MAX/2 + 3, 5); + if (tcpecho_socket_tid != RT_NULL) + rt_thread_startup(tcpecho_socket_tid); + } } FINSH_FUNCTION_EXPORT(net_test, network test); diff --git a/examples/test/rtc_test.c b/examples/test/rtc_test.c index 992eb08d3..48129ca36 100644 --- a/examples/test/rtc_test.c +++ b/examples/test/rtc_test.c @@ -21,48 +21,48 @@ * Date Author Notes * 2018-01-15 Liu2guang the first version. */ -#include -#include +#include +#include int rtc_test(void) -{ +{ uint8_t i; time_t now; - rt_err_t ret = RT_EOK; - + rt_err_t ret = RT_EOK; + rt_kprintf("[RTC Test]RTC Test Start...\n"); rt_thread_delay(RT_TICK_PER_SECOND); - rt_kprintf("[RTC Test]Set RTC 2017-04-01 12:30:46\n\n"); + rt_kprintf("[RTC Test]Set RTC 2017-04-01 12:30:46\n\n"); rt_thread_delay(RT_TICK_PER_SECOND); - - ret = set_date(2017, 4, 1); + + ret = set_date(2017, 4, 1); if(ret != RT_EOK) { - rt_kprintf("[RTC Test]Set RTC Date failed\n"); + rt_kprintf("[RTC Test]Set RTC Date failed\n"); return RT_ERROR; } - + rt_thread_delay(RT_TICK_PER_SECOND); - - ret = set_time(12, 30, 46); + + ret = set_time(12, 30, 46); if(ret != RT_EOK) { - rt_kprintf("[RTC Test]Set RTC Time failed\n"); + rt_kprintf("[RTC Test]Set RTC Time failed\n"); return RT_ERROR; } - + rt_thread_delay(RT_TICK_PER_SECOND); - + for(i = 0; i < 10; i++) { - rt_kprintf("[RTC Test]Read RTC Date and Time: "); + rt_kprintf("[RTC Test]Read RTC Date and Time: "); now = time(RT_NULL); rt_kprintf("%s", ctime(&now)); - + rt_thread_delay(RT_TICK_PER_SECOND); } - + rt_kprintf("\n"); return RT_EOK; @@ -70,5 +70,5 @@ int rtc_test(void) #ifdef RT_USING_FINSH #include FINSH_FUNCTION_EXPORT(rtc_test, rtc drive test. e.g: rtc_test()); -MSH_CMD_EXPORT(rtc_test, rtc drive test. e.g: rtc_test()); +MSH_CMD_EXPORT(rtc_test, rtc drive test. e.g: rtc_test()); #endif diff --git a/examples/ulog/ulog_example.c b/examples/ulog/ulog_example.c index 88572f515..f7ee06879 100644 --- a/examples/ulog/ulog_example.c +++ b/examples/ulog/ulog_example.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/include/libc/libc_dirent.h b/include/libc/libc_dirent.h index c3a19878e..052ba54a6 100644 --- a/include/libc/libc_dirent.h +++ b/include/libc/libc_dirent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index 0f3bc7635..30d6092e3 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,7 +13,7 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) /* use errno.h file in toolchains */ #include #endif @@ -45,7 +45,7 @@ defined in armcc/errno.h #define ERROR_BASE_NO 0 #endif -#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) +#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) && !(defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #define EPERM (ERROR_BASE_NO + 1) #define ENOENT (ERROR_BASE_NO + 2) @@ -161,7 +161,7 @@ defined in armcc/errno.h #define EPROTONOSUPPORT (ERROR_BASE_NO + 93) #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) #define EOPNOTSUPP (ERROR_BASE_NO + 95) -#define ENOTSUP EOPNOTSUPP +#define ENOTSUP EOPNOTSUPP #define EPFNOSUPPORT (ERROR_BASE_NO + 96) #define EAFNOSUPPORT (ERROR_BASE_NO + 97) #define EADDRINUSE (ERROR_BASE_NO + 98) diff --git a/include/libc/libc_fcntl.h b/include/libc/libc_fcntl.h index 1b7c69b1f..0969a9058 100644 --- a/include/libc/libc_fcntl.h +++ b/include/libc/libc_fcntl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ @@ -16,7 +16,7 @@ #ifndef LIBC_FCNTL_H__ #define LIBC_FCNTL_H__ -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include #ifndef O_NONBLOCK @@ -42,7 +42,7 @@ #ifdef _O_BINARY #define O_BINARY _O_BINARY #else -#define O_BINARY 0 +#define O_BINARY 0 #endif #endif diff --git a/include/libc/libc_fdset.h b/include/libc/libc_fdset.h index ecd965cd2..88be6446c 100644 --- a/include/libc/libc_fdset.h +++ b/include/libc/libc_fdset.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ @@ -17,7 +17,7 @@ #include -#if defined(RT_USING_NEWLIB) || defined(_WIN32) +#if defined(RT_USING_NEWLIB) || defined(_WIN32) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) #include #if defined(HAVE_SYS_SELECT_H) #include diff --git a/include/libc/libc_ioctl.h b/include/libc/libc_ioctl.h index ef5a5257a..8f706a46c 100644 --- a/include/libc/libc_ioctl.h +++ b/include/libc/libc_ioctl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ @@ -32,99 +32,99 @@ * in send queue. */ #endif -#define TCGETS 0x5401 -#define TCSETS 0x5402 -#define TCSETSW 0x5403 -#define TCSETSF 0x5404 -#define TCGETA 0x5405 -#define TCSETA 0x5406 -#define TCSETAW 0x5407 -#define TCSETAF 0x5408 -#define TCSBRK 0x5409 -#define TCXONC 0x540A -#define TCFLSH 0x540B -#define TIOCEXCL 0x540C -#define TIOCNXCL 0x540D -#define TIOCSCTTY 0x540E -#define TIOCGPGRP 0x540F -#define TIOCSPGRP 0x5410 -#define TIOCOUTQ 0x5411 -#define TIOCSTI 0x5412 -#define TIOCGWINSZ 0x5413 -#define TIOCSWINSZ 0x5414 -#define TIOCMGET 0x5415 -#define TIOCMBIS 0x5416 -#define TIOCMBIC 0x5417 -#define TIOCMSET 0x5418 -#define TIOCGSOFTCAR 0x5419 -#define TIOCSSOFTCAR 0x541A -// #define FIONREAD 0x541B -#define TIOCINQ FIONREAD -#define TIOCLINUX 0x541C -#define TIOCCONS 0x541D -#define TIOCGSERIAL 0x541E -#define TIOCSSERIAL 0x541F -#define TIOCPKT 0x5420 -// #define FIONBIO 0x5421 -#define TIOCNOTTY 0x5422 -#define TIOCSETD 0x5423 -#define TIOCGETD 0x5424 -#define TCSBRKP 0x5425 -#define TIOCSBRK 0x5427 -#define TIOCCBRK 0x5428 -#define TIOCGSID 0x5429 -#define TIOCGRS485 0x542E -#define TIOCSRS485 0x542F -#define TIOCGPTN 0x80045430 -#define TIOCSPTLCK 0x40045431 -#define TIOCGDEV 0x80045432 -#define TCGETX 0x5432 -#define TCSETX 0x5433 -#define TCSETXF 0x5434 -#define TCSETXW 0x5435 -#define TIOCSIG 0x40045436 -#define TIOCVHANGUP 0x5437 -#define TIOCGPKT 0x80045438 -#define TIOCGPTLCK 0x80045439 -#define TIOCGEXCL 0x80045440 - -#define FIONCLEX 0x5450 -#define FIOCLEX 0x5451 +#define TCGETS 0x5401 +#define TCSETS 0x5402 +#define TCSETSW 0x5403 +#define TCSETSF 0x5404 +#define TCGETA 0x5405 +#define TCSETA 0x5406 +#define TCSETAW 0x5407 +#define TCSETAF 0x5408 +#define TCSBRK 0x5409 +#define TCXONC 0x540A +#define TCFLSH 0x540B +#define TIOCEXCL 0x540C +#define TIOCNXCL 0x540D +#define TIOCSCTTY 0x540E +#define TIOCGPGRP 0x540F +#define TIOCSPGRP 0x5410 +#define TIOCOUTQ 0x5411 +#define TIOCSTI 0x5412 +#define TIOCGWINSZ 0x5413 +#define TIOCSWINSZ 0x5414 +#define TIOCMGET 0x5415 +#define TIOCMBIS 0x5416 +#define TIOCMBIC 0x5417 +#define TIOCMSET 0x5418 +#define TIOCGSOFTCAR 0x5419 +#define TIOCSSOFTCAR 0x541A +// #define FIONREAD 0x541B +#define TIOCINQ FIONREAD +#define TIOCLINUX 0x541C +#define TIOCCONS 0x541D +#define TIOCGSERIAL 0x541E +#define TIOCSSERIAL 0x541F +#define TIOCPKT 0x5420 +// #define FIONBIO 0x5421 +#define TIOCNOTTY 0x5422 +#define TIOCSETD 0x5423 +#define TIOCGETD 0x5424 +#define TCSBRKP 0x5425 +#define TIOCSBRK 0x5427 +#define TIOCCBRK 0x5428 +#define TIOCGSID 0x5429 +#define TIOCGRS485 0x542E +#define TIOCSRS485 0x542F +#define TIOCGPTN 0x80045430 +#define TIOCSPTLCK 0x40045431 +#define TIOCGDEV 0x80045432 +#define TCGETX 0x5432 +#define TCSETX 0x5433 +#define TCSETXF 0x5434 +#define TCSETXW 0x5435 +#define TIOCSIG 0x40045436 +#define TIOCVHANGUP 0x5437 +#define TIOCGPKT 0x80045438 +#define TIOCGPTLCK 0x80045439 +#define TIOCGEXCL 0x80045440 + +#define FIONCLEX 0x5450 +#define FIOCLEX 0x5451 #ifndef _WIN32 -#define FIOASYNC 0x5452 +#define FIOASYNC 0x5452 #endif -#define TIOCSERCONFIG 0x5453 -#define TIOCSERGWILD 0x5454 -#define TIOCSERSWILD 0x5455 -#define TIOCGLCKTRMIOS 0x5456 -#define TIOCSLCKTRMIOS 0x5457 -#define TIOCSERGSTRUCT 0x5458 +#define TIOCSERCONFIG 0x5453 +#define TIOCSERGWILD 0x5454 +#define TIOCSERSWILD 0x5455 +#define TIOCGLCKTRMIOS 0x5456 +#define TIOCSLCKTRMIOS 0x5457 +#define TIOCSERGSTRUCT 0x5458 #define TIOCSERGETLSR 0x5459 #define TIOCSERGETMULTI 0x545A #define TIOCSERSETMULTI 0x545B -#define TIOCMIWAIT 0x545C -#define TIOCGICOUNT 0x545D -#define FIOQSIZE 0x5460 +#define TIOCMIWAIT 0x545C +#define TIOCGICOUNT 0x545D +#define FIOQSIZE 0x5460 -#define TIOCPKT_DATA 0 -#define TIOCPKT_FLUSHREAD 1 -#define TIOCPKT_FLUSHWRITE 2 -#define TIOCPKT_STOP 4 -#define TIOCPKT_START 8 -#define TIOCPKT_NOSTOP 16 -#define TIOCPKT_DOSTOP 32 -#define TIOCPKT_IOCTL 64 +#define TIOCPKT_DATA 0 +#define TIOCPKT_FLUSHREAD 1 +#define TIOCPKT_FLUSHWRITE 2 +#define TIOCPKT_STOP 4 +#define TIOCPKT_START 8 +#define TIOCPKT_NOSTOP 16 +#define TIOCPKT_DOSTOP 32 +#define TIOCPKT_IOCTL 64 #define TIOCSER_TEMT 0x01 struct winsize { - unsigned short ws_row; - unsigned short ws_col; - unsigned short ws_xpixel; - unsigned short ws_ypixel; + unsigned short ws_row; + unsigned short ws_col; + unsigned short ws_xpixel; + unsigned short ws_ypixel; }; #define TIOCM_LE 0x001 @@ -227,8 +227,8 @@ struct winsize { #define SIOCADDDLCI 0x8980 #define SIOCDELDLCI 0x8981 -#define SIOCDEVPRIVATE 0x89F0 -#define SIOCPROTOPRIVATE 0x89E0 +#define SIOCDEVPRIVATE 0x89F0 +#define SIOCPROTOPRIVATE 0x89E0 #endif diff --git a/include/libc/libc_signal.h b/include/libc/libc_signal.h index 898fe13f4..8a4cc0d73 100644 --- a/include/libc/libc_signal.h +++ b/include/libc/libc_signal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,6 +15,7 @@ extern "C" { #endif +#include #ifdef HAVE_CCONFIG_H #include #endif @@ -46,8 +47,8 @@ struct sigevent #ifndef HAVE_SIGINFO struct siginfo { - rt_uint16_t si_signo; - rt_uint16_t si_code; + uint16_t si_signo; + uint16_t si_code; union sigval si_value; }; @@ -56,11 +57,11 @@ typedef struct siginfo siginfo_t; #define SI_USER 0x01 /* Signal sent by kill(). */ #define SI_QUEUE 0x02 /* Signal sent by sigqueue(). */ -#define SI_TIMER 0x03 /* Signal generated by expiration of a +#define SI_TIMER 0x03 /* Signal generated by expiration of a timer set by timer_settime(). */ -#define SI_ASYNCIO 0x04 /* Signal generated by completion of an +#define SI_ASYNCIO 0x04 /* Signal generated by completion of an asynchronous I/O request. */ -#define SI_MESGQ 0x05 /* Signal generated by arrival of a +#define SI_MESGQ 0x05 /* Signal generated by arrival of a message on an empty message queue. */ #if !defined(RT_USING_NEWLIB) diff --git a/include/libc/libc_stat.h b/include/libc/libc_stat.h index 9079d1ef1..98450cd0d 100644 --- a/include/libc/libc_stat.h +++ b/include/libc/libc_stat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ @@ -9,7 +9,7 @@ #include -#if defined(RT_USING_NEWLIB) +#if defined(RT_USING_NEWLIB) || (defined( __GNUC__ ) && !defined(__ARMCC_VERSION)) /* use header file of newlib */ #include diff --git a/include/rtdbg.h b/include/rtdbg.h index a2dfbd969..c0a4e6822 100644 --- a/include/rtdbg.h +++ b/include/rtdbg.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -32,6 +32,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /* the debug log will force enable when RT_DEBUG macro is defined */ #if defined(RT_DEBUG) && !defined(DBG_ENABLE) #define DBG_ENABLE @@ -91,13 +95,13 @@ #ifdef DBG_COLOR #define _DBG_COLOR(n) rt_kprintf("\033["#n"m") #define _DBG_LOG_HDR(lvl_name, color_n) \ - rt_kprintf("\033["#color_n"m["lvl_name"/"DBG_SECTION_NAME"] ") + rt_kprintf("\033["#color_n"m[" lvl_name "/" DBG_SECTION_NAME "] ") #define _DBG_LOG_X_END \ rt_kprintf("\033[0m\n") #else #define _DBG_COLOR(n) #define _DBG_LOG_HDR(lvl_name, color_n) \ - rt_kprintf("["lvl_name"/"DBG_SECTION_NAME"] ") + rt_kprintf("[" lvl_name "/" DBG_SECTION_NAME "] ") #define _DBG_LOG_X_END \ rt_kprintf("\n") #endif /* DBG_COLOR */ @@ -176,4 +180,8 @@ #endif /* defined(RT_USING_ULOG) && define(DBG_ENABLE) */ +#ifdef __cplusplus +} +#endif + #endif /* RT_DBG_H__ */ diff --git a/include/rtdebug.h b/include/rtdebug.h index b66cd6fc6..8d4e55ac9 100644 --- a/include/rtdebug.h +++ b/include/rtdebug.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/include/rtdef.h b/include/rtdef.h index ababbf094..193b02700 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,6 +27,7 @@ * 2018-12-28 armink change version number to v3.1.2 * 2019-03-14 armink change version number to v3.1.3 * 2019-06-12 armink change version number to v3.1.4 + * 2020-05-14 armink change version number to v3.1.5 */ #ifndef __RT_DEF_H__ @@ -48,7 +49,7 @@ extern "C" { /* RT-Thread version information */ #define RT_VERSION 3L /**< major version number */ #define RT_SUBVERSION 1L /**< minor version number */ -#define RT_REVISION 4L /**< revise version number */ +#define RT_REVISION 5L /**< revise version number */ /* RT-Thread version */ #define RTTHREAD_VERSION ((RT_VERSION * 10000) + \ @@ -96,6 +97,13 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ #define RT_UINT32_MAX 0xffffffff /**< Maxium number of UINT32 */ #define RT_TICK_MAX RT_UINT32_MAX /**< Maxium number of tick */ +/* maximum value of ipc type */ +#define RT_SEM_VALUE_MAX RT_UINT16_MAX /**< Maxium number of semaphore .value */ +#define RT_MUTEX_VALUE_MAX RT_UINT16_MAX /**< Maxium number of mutex .value */ +#define RT_MUTEX_HOLD_MAX RT_UINT8_MAX /**< Maxium number of mutex .hold */ +#define RT_MB_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of mailbox .entry */ +#define RT_MQ_ENTRY_MAX RT_UINT16_MAX /**< Maxium number of message queue .entry */ + #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) #define __CLANG_ARM #endif @@ -367,20 +375,20 @@ typedef struct rt_object *rt_object_t; /**< Type for kernel obj */ enum rt_object_class_type { - RT_Object_Class_Null = 0, /**< The object is not used. */ - RT_Object_Class_Thread, /**< The object is a thread. */ - RT_Object_Class_Semaphore, /**< The object is a semaphore. */ - RT_Object_Class_Mutex, /**< The object is a mutex. */ - RT_Object_Class_Event, /**< The object is a event. */ - RT_Object_Class_MailBox, /**< The object is a mail box. */ - RT_Object_Class_MessageQueue, /**< The object is a message queue. */ - RT_Object_Class_MemHeap, /**< The object is a memory heap */ - RT_Object_Class_MemPool, /**< The object is a memory pool. */ - RT_Object_Class_Device, /**< The object is a device */ - RT_Object_Class_Timer, /**< The object is a timer. */ - RT_Object_Class_Module, /**< The object is a module. */ - RT_Object_Class_Unknown, /**< The object is unknown. */ - RT_Object_Class_Static = 0x80 /**< The object is a static object. */ + RT_Object_Class_Null = 0x00, /**< The object is not used. */ + RT_Object_Class_Thread = 0x01, /**< The object is a thread. */ + RT_Object_Class_Semaphore = 0x02, /**< The object is a semaphore. */ + RT_Object_Class_Mutex = 0x03, /**< The object is a mutex. */ + RT_Object_Class_Event = 0x04, /**< The object is a event. */ + RT_Object_Class_MailBox = 0x05, /**< The object is a mail box. */ + RT_Object_Class_MessageQueue = 0x06, /**< The object is a message queue. */ + RT_Object_Class_MemHeap = 0x07, /**< The object is a memory heap. */ + RT_Object_Class_MemPool = 0x08, /**< The object is a memory pool. */ + RT_Object_Class_Device = 0x09, /**< The object is a device. */ + RT_Object_Class_Timer = 0x0a, /**< The object is a timer. */ + RT_Object_Class_Module = 0x0b, /**< The object is a module. */ + RT_Object_Class_Unknown = 0x0c, /**< The object is unknown. */ + RT_Object_Class_Static = 0x80 /**< The object is a static object. */ }; /** @@ -426,6 +434,7 @@ struct rt_object_information #define RT_TIMER_CTRL_GET_TIME 0x1 /**< get timer control command */ #define RT_TIMER_CTRL_SET_ONESHOT 0x2 /**< change timer to one shot */ #define RT_TIMER_CTRL_SET_PERIODIC 0x3 /**< change timer to periodic */ +#define RT_TIMER_CTRL_GET_STATE 0x4 /**< get timer run state active or deactive*/ #ifndef RT_TIMER_SKIP_LIST_LEVEL #define RT_TIMER_SKIP_LIST_LEVEL 1 @@ -845,6 +854,7 @@ enum rt_device_class_type #define RT_DEVICE_CTRL_RESUME 0x01 /**< resume device */ #define RT_DEVICE_CTRL_SUSPEND 0x02 /**< suspend device */ #define RT_DEVICE_CTRL_CONFIG 0x03 /**< configure device */ +#define RT_DEVICE_CTRL_CLOSE 0x04 /**< close device */ #define RT_DEVICE_CTRL_SET_INT 0x10 /**< set interrupt */ #define RT_DEVICE_CTRL_CLR_INT 0x11 /**< clear interrupt */ diff --git a/include/rthw.h b/include/rthw.h index 21ac3da6c..7ec962347 100644 --- a/include/rthw.h +++ b/include/rthw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -117,7 +117,7 @@ void rt_hw_exception_install(rt_err_t (*exception_handle)(void *context)); */ void rt_hw_us_delay(rt_uint32_t us); -#define RT_DEFINE_SPINLOCK(x) +#define RT_DEFINE_SPINLOCK(x) #define RT_DECLARE_SPINLOCK(x) rt_ubase_t x #define rt_hw_spin_lock(lock) *(lock) = rt_hw_interrupt_disable() diff --git a/include/rtlibc.h b/include/rtlibc.h index b3a548beb..4780d628b 100644 --- a/include/rtlibc.h +++ b/include/rtlibc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/include/rtm.h b/include/rtm.h index 7e07a2239..fd675fcf6 100644 --- a/include/rtm.h +++ b/include/rtm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/include/rtservice.h b/include/rtservice.h index 81d6c71f1..d0bad85de 100644 --- a/include/rtservice.h +++ b/include/rtservice.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -128,21 +128,21 @@ rt_inline unsigned int rt_list_len(const rt_list_t *l) /** * rt_list_for_each - iterate over a list - * @pos: the rt_list_t * to use as a loop cursor. - * @head: the head for your list. + * @pos: the rt_list_t * to use as a loop cursor. + * @head: the head for your list. */ #define rt_list_for_each(pos, head) \ for (pos = (head)->next; pos != (head); pos = pos->next) /** * rt_list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the rt_list_t * to use as a loop cursor. - * @n: another rt_list_t * to use as temporary storage - * @head: the head for your list. + * @pos: the rt_list_t * to use as a loop cursor. + * @n: another rt_list_t * to use as temporary storage + * @head: the head for your list. */ #define rt_list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) /** * rt_list_for_each_entry - iterate over list of given type diff --git a/include/rtthread.h b/include/rtthread.h index 32fe011ab..9d4282aa5 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -40,6 +40,9 @@ extern "C" { void rt_system_object_init(void); struct rt_object_information * rt_object_get_information(enum rt_object_class_type type); +int rt_object_get_length(enum rt_object_class_type type); +int rt_object_get_pointers(enum rt_object_class_type type, rt_object_t *pointers, int maxlen); + void rt_object_init(struct rt_object *object, enum rt_object_class_type type, const char *name); @@ -514,7 +517,7 @@ rt_int32_t rt_sscanf(const char *buf, const char *fmt, ...); char *rt_strncpy(char *dest, const char *src, rt_ubase_t n); void *rt_memmove(void *dest, const void *src, rt_ubase_t n); rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_ubase_t count); -rt_uint32_t rt_strcasecmp(const char *a, const char *b); +rt_int32_t rt_strcasecmp(const char *a, const char *b); void rt_show_version(void); diff --git a/libcpu/arm/AT91SAM7S/AT91SAM7S.h b/libcpu/arm/AT91SAM7S/AT91SAM7S.h index 130f9074d..91b57053d 100644 --- a/libcpu/arm/AT91SAM7S/AT91SAM7S.h +++ b/libcpu/arm/AT91SAM7S/AT91SAM7S.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -15,276 +15,276 @@ extern "C" { #endif -#define AT91_REG *(volatile unsigned int *) /* Hardware register definition */ +#define AT91_REG *(volatile unsigned int *) /* Hardware register definition */ /* ========== Register definition for TC0 peripheral ========== */ -#define AT91C_TC0_SR (AT91_REG(0xFFFA0020)) /* TC0 Status Register */ -#define AT91C_TC0_RC (AT91_REG(0xFFFA001C)) /* TC0 Register C */ -#define AT91C_TC0_RB (AT91_REG(0xFFFA0018)) /* TC0 Register B */ -#define AT91C_TC0_CCR (AT91_REG(0xFFFA0000)) /* TC0 Channel Control Register */ -#define AT91C_TC0_CMR (AT91_REG(0xFFFA0004)) /* TC0 Channel Mode Register (Capture Mode / Waveform Mode) */ -#define AT91C_TC0_IER (AT91_REG(0xFFFA0024)) /* TC0 Interrupt Enable Register */ -#define AT91C_TC0_RA (AT91_REG(0xFFFA0014)) /* TC0 Register A */ -#define AT91C_TC0_IDR (AT91_REG(0xFFFA0028)) /* TC0 Interrupt Disable Register */ -#define AT91C_TC0_CV (AT91_REG(0xFFFA0010)) /* TC0 Counter Value */ -#define AT91C_TC0_IMR (AT91_REG(0xFFFA002C)) /* TC0 Interrupt Mask Register */ +#define AT91C_TC0_SR (AT91_REG(0xFFFA0020)) /* TC0 Status Register */ +#define AT91C_TC0_RC (AT91_REG(0xFFFA001C)) /* TC0 Register C */ +#define AT91C_TC0_RB (AT91_REG(0xFFFA0018)) /* TC0 Register B */ +#define AT91C_TC0_CCR (AT91_REG(0xFFFA0000)) /* TC0 Channel Control Register */ +#define AT91C_TC0_CMR (AT91_REG(0xFFFA0004)) /* TC0 Channel Mode Register (Capture Mode / Waveform Mode) */ +#define AT91C_TC0_IER (AT91_REG(0xFFFA0024)) /* TC0 Interrupt Enable Register */ +#define AT91C_TC0_RA (AT91_REG(0xFFFA0014)) /* TC0 Register A */ +#define AT91C_TC0_IDR (AT91_REG(0xFFFA0028)) /* TC0 Interrupt Disable Register */ +#define AT91C_TC0_CV (AT91_REG(0xFFFA0010)) /* TC0 Counter Value */ +#define AT91C_TC0_IMR (AT91_REG(0xFFFA002C)) /* TC0 Interrupt Mask Register */ /* ========== Register definition for TC1 peripheral ========== */ -#define AT91C_TC1_RB (AT91_REG(0xFFFA0058)) /* TC1 Register B */ -#define AT91C_TC1_CCR (AT91_REG(0xFFFA0040)) /* TC1 Channel Control Register */ -#define AT91C_TC1_IER (AT91_REG(0xFFFA0064)) /* TC1 Interrupt Enable Register */ -#define AT91C_TC1_IDR (AT91_REG(0xFFFA0068)) /* TC1 Interrupt Disable Register */ -#define AT91C_TC1_SR (AT91_REG(0xFFFA0060)) /* TC1 Status Register */ -#define AT91C_TC1_CMR (AT91_REG(0xFFFA0044)) /* TC1 Channel Mode Register (Capture Mode / Waveform Mode) */ -#define AT91C_TC1_RA (AT91_REG(0xFFFA0054)) /* TC1 Register A */ -#define AT91C_TC1_RC (AT91_REG(0xFFFA005C)) /* TC1 Register C */ -#define AT91C_TC1_IMR (AT91_REG(0xFFFA006C)) /* TC1 Interrupt Mask Register */ -#define AT91C_TC1_CV (AT91_REG(0xFFFA0050)) /* TC1 Counter Value */ +#define AT91C_TC1_RB (AT91_REG(0xFFFA0058)) /* TC1 Register B */ +#define AT91C_TC1_CCR (AT91_REG(0xFFFA0040)) /* TC1 Channel Control Register */ +#define AT91C_TC1_IER (AT91_REG(0xFFFA0064)) /* TC1 Interrupt Enable Register */ +#define AT91C_TC1_IDR (AT91_REG(0xFFFA0068)) /* TC1 Interrupt Disable Register */ +#define AT91C_TC1_SR (AT91_REG(0xFFFA0060)) /* TC1 Status Register */ +#define AT91C_TC1_CMR (AT91_REG(0xFFFA0044)) /* TC1 Channel Mode Register (Capture Mode / Waveform Mode) */ +#define AT91C_TC1_RA (AT91_REG(0xFFFA0054)) /* TC1 Register A */ +#define AT91C_TC1_RC (AT91_REG(0xFFFA005C)) /* TC1 Register C */ +#define AT91C_TC1_IMR (AT91_REG(0xFFFA006C)) /* TC1 Interrupt Mask Register */ +#define AT91C_TC1_CV (AT91_REG(0xFFFA0050)) /* TC1 Counter Value */ /* ========== Register definition for TC2 peripheral ========== */ -#define AT91C_TC2_CMR (AT91_REG(0xFFFA0084)) /* TC2 Channel Mode Register (Capture Mode / Waveform Mode) */ -#define AT91C_TC2_CCR (AT91_REG(0xFFFA0080)) /* TC2 Channel Control Register */ -#define AT91C_TC2_CV (AT91_REG(0xFFFA0090)) /* TC2 Counter Value */ -#define AT91C_TC2_RA (AT91_REG(0xFFFA0094)) /* TC2 Register A */ -#define AT91C_TC2_RB (AT91_REG(0xFFFA0098)) /* TC2 Register B */ -#define AT91C_TC2_IDR (AT91_REG(0xFFFA00A8)) /* TC2 Interrupt Disable Register */ -#define AT91C_TC2_IMR (AT91_REG(0xFFFA00AC)) /* TC2 Interrupt Mask Register */ -#define AT91C_TC2_RC (AT91_REG(0xFFFA009C)) /* TC2 Register C */ -#define AT91C_TC2_IER (AT91_REG(0xFFFA00A4)) /* TC2 Interrupt Enable Register */ -#define AT91C_TC2_SR (AT91_REG(0xFFFA00A0)) /* TC2 Status Register */ +#define AT91C_TC2_CMR (AT91_REG(0xFFFA0084)) /* TC2 Channel Mode Register (Capture Mode / Waveform Mode) */ +#define AT91C_TC2_CCR (AT91_REG(0xFFFA0080)) /* TC2 Channel Control Register */ +#define AT91C_TC2_CV (AT91_REG(0xFFFA0090)) /* TC2 Counter Value */ +#define AT91C_TC2_RA (AT91_REG(0xFFFA0094)) /* TC2 Register A */ +#define AT91C_TC2_RB (AT91_REG(0xFFFA0098)) /* TC2 Register B */ +#define AT91C_TC2_IDR (AT91_REG(0xFFFA00A8)) /* TC2 Interrupt Disable Register */ +#define AT91C_TC2_IMR (AT91_REG(0xFFFA00AC)) /* TC2 Interrupt Mask Register */ +#define AT91C_TC2_RC (AT91_REG(0xFFFA009C)) /* TC2 Register C */ +#define AT91C_TC2_IER (AT91_REG(0xFFFA00A4)) /* TC2 Interrupt Enable Register */ +#define AT91C_TC2_SR (AT91_REG(0xFFFA00A0)) /* TC2 Status Register */ /* ========== Register definition for PITC peripheral ========== */ -#define AT91C_PITC_PIVR (AT91_REG(0xFFFFFD38)) /* PITC Period Interval Value Register */ -#define AT91C_PITC_PISR (AT91_REG(0xFFFFFD34)) /* PITC Period Interval Status Register */ -#define AT91C_PITC_PIIR (AT91_REG(0xFFFFFD3C)) /* PITC Period Interval Image Register */ -#define AT91C_PITC_PIMR (AT91_REG(0xFFFFFD30)) /* PITC Period Interval Mode Register */ +#define AT91C_PITC_PIVR (AT91_REG(0xFFFFFD38)) /* PITC Period Interval Value Register */ +#define AT91C_PITC_PISR (AT91_REG(0xFFFFFD34)) /* PITC Period Interval Status Register */ +#define AT91C_PITC_PIIR (AT91_REG(0xFFFFFD3C)) /* PITC Period Interval Image Register */ +#define AT91C_PITC_PIMR (AT91_REG(0xFFFFFD30)) /* PITC Period Interval Mode Register */ /* ========== Register definition for UDP peripheral ========== */ -#define AT91C_UDP_NUM (AT91_REG(0xFFFB0000)) /* UDP Frame Number Register */ -#define AT91C_UDP_STAT (AT91_REG(0xFFFB0004)) /* UDP Global State Register */ -#define AT91C_UDP_FADDR (AT91_REG(0xFFFB0008)) /* UDP Function Address Register */ -#define AT91C_UDP_IER (AT91_REG(0xFFFB0010)) /* UDP Interrupt Enable Register */ -#define AT91C_UDP_IDR (AT91_REG(0xFFFB0014)) /* UDP Interrupt Disable Register */ -#define AT91C_UDP_IMR (AT91_REG(0xFFFB0018)) /* UDP Interrupt Mask Register */ -#define AT91C_UDP_ISR (AT91_REG(0xFFFB001C)) /* UDP Interrupt Status Register */ -#define AT91C_UDP_ICR (AT91_REG(0xFFFB0020)) /* UDP Interrupt Clear Register */ -#define AT91C_UDP_RSTEP (AT91_REG(0xFFFB0028)) /* UDP Reset Endpoint Register */ -#define AT91C_UDP_CSR0 (AT91_REG(0xFFFB0030)) /* UDP Endpoint Control and Status Register */ -#define AT91C_UDP_CSR(n) (*(&AT91C_UDP_CSR0 + n)) -#define AT91C_UDP_FDR0 (AT91_REG(0xFFFB0050)) /* UDP Endpoint FIFO Data Register */ -#define AT91C_UDP_FDR(n) (*(&AT91C_UDP_FDR0 + n)) -#define AT91C_UDP_TXVC (AT91_REG(0xFFFB0074)) /* UDP Transceiver Control Register */ +#define AT91C_UDP_NUM (AT91_REG(0xFFFB0000)) /* UDP Frame Number Register */ +#define AT91C_UDP_STAT (AT91_REG(0xFFFB0004)) /* UDP Global State Register */ +#define AT91C_UDP_FADDR (AT91_REG(0xFFFB0008)) /* UDP Function Address Register */ +#define AT91C_UDP_IER (AT91_REG(0xFFFB0010)) /* UDP Interrupt Enable Register */ +#define AT91C_UDP_IDR (AT91_REG(0xFFFB0014)) /* UDP Interrupt Disable Register */ +#define AT91C_UDP_IMR (AT91_REG(0xFFFB0018)) /* UDP Interrupt Mask Register */ +#define AT91C_UDP_ISR (AT91_REG(0xFFFB001C)) /* UDP Interrupt Status Register */ +#define AT91C_UDP_ICR (AT91_REG(0xFFFB0020)) /* UDP Interrupt Clear Register */ +#define AT91C_UDP_RSTEP (AT91_REG(0xFFFB0028)) /* UDP Reset Endpoint Register */ +#define AT91C_UDP_CSR0 (AT91_REG(0xFFFB0030)) /* UDP Endpoint Control and Status Register */ +#define AT91C_UDP_CSR(n) (*(&AT91C_UDP_CSR0 + n)) +#define AT91C_UDP_FDR0 (AT91_REG(0xFFFB0050)) /* UDP Endpoint FIFO Data Register */ +#define AT91C_UDP_FDR(n) (*(&AT91C_UDP_FDR0 + n)) +#define AT91C_UDP_TXVC (AT91_REG(0xFFFB0074)) /* UDP Transceiver Control Register */ /* ========== Register definition for US0 peripheral ========== */ -#define AT91C_US0_CR (AT91_REG(0xFFFC0000)) /* US0 Control Register */ -#define AT91C_US0_MR (AT91_REG(0xFFFC0004)) /* US0 Mode Register */ -#define AT91C_US0_IER (AT91_REG(0xFFFC0008)) /* US0 Interrupt Enable Register */ -#define AT91C_US0_IDR (AT91_REG(0xFFFC000C)) /* US0 Interrupt Disable Register */ -#define AT91C_US0_IMR (AT91_REG(0xFFFC0010)) /* US0 Interrupt Mask Register */ -#define AT91C_US0_CSR (AT91_REG(0xFFFC0014)) /* US0 Channel Status Register */ -#define AT91C_US0_RHR (AT91_REG(0xFFFC0018)) /* US0 Receiver Holding Register */ -#define AT91C_US0_THR (AT91_REG(0xFFFC001C)) /* US0 Transmitter Holding Register */ -#define AT91C_US0_BRGR (AT91_REG(0xFFFC0020)) /* US0 Baud Rate Generator Register */ -#define AT91C_US0_RTOR (AT91_REG(0xFFFC0024)) /* US0 Receiver Time-out Register */ -#define AT91C_US0_TTGR (AT91_REG(0xFFFC0028)) /* US0 Transmitter Time-guard Register */ -#define AT91C_US0_NER (AT91_REG(0xFFFC0044)) /* US0 Nb Errors Register */ -#define AT91C_US0_FIDI (AT91_REG(0xFFFC0040)) /* US0 FI_DI_Ratio Register */ -#define AT91C_US0_IF (AT91_REG(0xFFFC004C)) /* US0 IRDA_FILTER Register */ +#define AT91C_US0_CR (AT91_REG(0xFFFC0000)) /* US0 Control Register */ +#define AT91C_US0_MR (AT91_REG(0xFFFC0004)) /* US0 Mode Register */ +#define AT91C_US0_IER (AT91_REG(0xFFFC0008)) /* US0 Interrupt Enable Register */ +#define AT91C_US0_IDR (AT91_REG(0xFFFC000C)) /* US0 Interrupt Disable Register */ +#define AT91C_US0_IMR (AT91_REG(0xFFFC0010)) /* US0 Interrupt Mask Register */ +#define AT91C_US0_CSR (AT91_REG(0xFFFC0014)) /* US0 Channel Status Register */ +#define AT91C_US0_RHR (AT91_REG(0xFFFC0018)) /* US0 Receiver Holding Register */ +#define AT91C_US0_THR (AT91_REG(0xFFFC001C)) /* US0 Transmitter Holding Register */ +#define AT91C_US0_BRGR (AT91_REG(0xFFFC0020)) /* US0 Baud Rate Generator Register */ +#define AT91C_US0_RTOR (AT91_REG(0xFFFC0024)) /* US0 Receiver Time-out Register */ +#define AT91C_US0_TTGR (AT91_REG(0xFFFC0028)) /* US0 Transmitter Time-guard Register */ +#define AT91C_US0_NER (AT91_REG(0xFFFC0044)) /* US0 Nb Errors Register */ +#define AT91C_US0_FIDI (AT91_REG(0xFFFC0040)) /* US0 FI_DI_Ratio Register */ +#define AT91C_US0_IF (AT91_REG(0xFFFC004C)) /* US0 IRDA_FILTER Register */ /* ========== Register definition for AIC peripheral ========== */ -#define AT91C_AIC_SMR0 (AT91_REG(0xFFFFF000)) /* AIC Source Mode Register */ -#define AT91C_AIC_SMR(n) (*(&AT91C_AIC_SMR0 + n)) -#define AT91C_AIC_SVR0 (AT91_REG(0xFFFFF080)) /* AIC Source Vector Register */ -#define AT91C_AIC_SVR(n) (*(&AT91C_AIC_SVR0 + n)) -#define AT91C_AIC_IVR (AT91_REG(0xFFFFF100)) /* AIC Interrupt Vector Register */ -#define AT91C_AIC_FVR (AT91_REG(0xFFFFF104)) /* AIC FIQ Vector Register */ -#define AT91C_AIC_ISR (AT91_REG(0xFFFFF108)) /* AIC Interrupt Status Register */ -#define AT91C_AIC_IPR (AT91_REG(0xFFFFF10C)) /* AIC Interrupt Pending Register */ -#define AT91C_AIC_IMR (AT91_REG(0xFFFFF110)) /* AIC Interrupt Mask Register */ -#define AT91C_AIC_CISR (AT91_REG(0xFFFFF114)) /* AIC Core Interrupt Status Register */ -#define AT91C_AIC_IECR (AT91_REG(0xFFFFF120)) /* AIC Interrupt Enable Command Register */ -#define AT91C_AIC_IDCR (AT91_REG(0xFFFFF124)) /* AIC Interrupt Disable Command Register */ -#define AT91C_AIC_ICCR (AT91_REG(0xFFFFF128)) /* AIC Interrupt Clear Command Register */ -#define AT91C_AIC_ISCR (AT91_REG(0xFFFFF12C)) /* AIC Interrupt Set Command Register */ -#define AT91C_AIC_EOICR (AT91_REG(0xFFFFF130)) /* AIC End of Interrupt Command Register */ -#define AT91C_AIC_SPU (AT91_REG(0xFFFFF134)) /* AIC Spurious Vector Register */ -#define AT91C_AIC_DCR (AT91_REG(0xFFFFF138)) /* AIC Debug Control Register (Protect) */ -#define AT91C_AIC_FFER (AT91_REG(0xFFFFF140)) /* AIC Fast Forcing Enable Register */ -#define AT91C_AIC_FFDR (AT91_REG(0xFFFFF144)) /* AIC Fast Forcing Disable Register */ -#define AT91C_AIC_FFSR (AT91_REG(0xFFFFF148)) /* AIC Fast Forcing Status Register */ +#define AT91C_AIC_SMR0 (AT91_REG(0xFFFFF000)) /* AIC Source Mode Register */ +#define AT91C_AIC_SMR(n) (*(&AT91C_AIC_SMR0 + n)) +#define AT91C_AIC_SVR0 (AT91_REG(0xFFFFF080)) /* AIC Source Vector Register */ +#define AT91C_AIC_SVR(n) (*(&AT91C_AIC_SVR0 + n)) +#define AT91C_AIC_IVR (AT91_REG(0xFFFFF100)) /* AIC Interrupt Vector Register */ +#define AT91C_AIC_FVR (AT91_REG(0xFFFFF104)) /* AIC FIQ Vector Register */ +#define AT91C_AIC_ISR (AT91_REG(0xFFFFF108)) /* AIC Interrupt Status Register */ +#define AT91C_AIC_IPR (AT91_REG(0xFFFFF10C)) /* AIC Interrupt Pending Register */ +#define AT91C_AIC_IMR (AT91_REG(0xFFFFF110)) /* AIC Interrupt Mask Register */ +#define AT91C_AIC_CISR (AT91_REG(0xFFFFF114)) /* AIC Core Interrupt Status Register */ +#define AT91C_AIC_IECR (AT91_REG(0xFFFFF120)) /* AIC Interrupt Enable Command Register */ +#define AT91C_AIC_IDCR (AT91_REG(0xFFFFF124)) /* AIC Interrupt Disable Command Register */ +#define AT91C_AIC_ICCR (AT91_REG(0xFFFFF128)) /* AIC Interrupt Clear Command Register */ +#define AT91C_AIC_ISCR (AT91_REG(0xFFFFF12C)) /* AIC Interrupt Set Command Register */ +#define AT91C_AIC_EOICR (AT91_REG(0xFFFFF130)) /* AIC End of Interrupt Command Register */ +#define AT91C_AIC_SPU (AT91_REG(0xFFFFF134)) /* AIC Spurious Vector Register */ +#define AT91C_AIC_DCR (AT91_REG(0xFFFFF138)) /* AIC Debug Control Register (Protect) */ +#define AT91C_AIC_FFER (AT91_REG(0xFFFFF140)) /* AIC Fast Forcing Enable Register */ +#define AT91C_AIC_FFDR (AT91_REG(0xFFFFF144)) /* AIC Fast Forcing Disable Register */ +#define AT91C_AIC_FFSR (AT91_REG(0xFFFFF148)) /* AIC Fast Forcing Status Register */ /* ========== Register definition for DBGU peripheral ========== */ -#define AT91C_DBGU_EXID (AT91_REG(0xFFFFF244)) /* DBGU Chip ID Extension Register */ -#define AT91C_DBGU_BRGR (AT91_REG(0xFFFFF220)) /* DBGU Baud Rate Generator Register */ -#define AT91C_DBGU_IDR (AT91_REG(0xFFFFF20C)) /* DBGU Interrupt Disable Register */ -#define AT91C_DBGU_CSR (AT91_REG(0xFFFFF214)) /* DBGU Channel Status Register */ -#define AT91C_DBGU_CIDR (AT91_REG(0xFFFFF240)) /* DBGU Chip ID Register */ -#define AT91C_DBGU_MR (AT91_REG(0xFFFFF204)) /* DBGU Mode Register */ -#define AT91C_DBGU_IMR (AT91_REG(0xFFFFF210)) /* DBGU Interrupt Mask Register */ -#define AT91C_DBGU_CR (AT91_REG(0xFFFFF200)) /* DBGU Control Register */ -#define AT91C_DBGU_FNTR (AT91_REG(0xFFFFF248)) /* DBGU Force NTRST Register */ -#define AT91C_DBGU_THR (AT91_REG(0xFFFFF21C)) /* DBGU Transmitter Holding Register */ -#define AT91C_DBGU_RHR (AT91_REG(0xFFFFF218)) /* DBGU Receiver Holding Register */ -#define AT91C_DBGU_IER (AT91_REG(0xFFFFF208)) /* DBGU Interrupt Enable Register */ +#define AT91C_DBGU_EXID (AT91_REG(0xFFFFF244)) /* DBGU Chip ID Extension Register */ +#define AT91C_DBGU_BRGR (AT91_REG(0xFFFFF220)) /* DBGU Baud Rate Generator Register */ +#define AT91C_DBGU_IDR (AT91_REG(0xFFFFF20C)) /* DBGU Interrupt Disable Register */ +#define AT91C_DBGU_CSR (AT91_REG(0xFFFFF214)) /* DBGU Channel Status Register */ +#define AT91C_DBGU_CIDR (AT91_REG(0xFFFFF240)) /* DBGU Chip ID Register */ +#define AT91C_DBGU_MR (AT91_REG(0xFFFFF204)) /* DBGU Mode Register */ +#define AT91C_DBGU_IMR (AT91_REG(0xFFFFF210)) /* DBGU Interrupt Mask Register */ +#define AT91C_DBGU_CR (AT91_REG(0xFFFFF200)) /* DBGU Control Register */ +#define AT91C_DBGU_FNTR (AT91_REG(0xFFFFF248)) /* DBGU Force NTRST Register */ +#define AT91C_DBGU_THR (AT91_REG(0xFFFFF21C)) /* DBGU Transmitter Holding Register */ +#define AT91C_DBGU_RHR (AT91_REG(0xFFFFF218)) /* DBGU Receiver Holding Register */ +#define AT91C_DBGU_IER (AT91_REG(0xFFFFF208)) /* DBGU Interrupt Enable Register */ /* ========== Register definition for PIO peripheral ========== */ -#define AT91C_PIO_ODR (AT91_REG(0xFFFFF414)) /* PIOA Output Disable Registerr */ -#define AT91C_PIO_SODR (AT91_REG(0xFFFFF430)) /* PIOA Set Output Data Register */ -#define AT91C_PIO_ISR (AT91_REG(0xFFFFF44C)) /* PIOA Interrupt Status Register */ -#define AT91C_PIO_ABSR (AT91_REG(0xFFFFF478)) /* PIOA AB Select Status Register */ -#define AT91C_PIO_IER (AT91_REG(0xFFFFF440)) /* PIOA Interrupt Enable Register */ -#define AT91C_PIO_PPUDR (AT91_REG(0xFFFFF460)) /* PIOA Pull-up Disable Register */ -#define AT91C_PIO_IMR (AT91_REG(0xFFFFF448)) /* PIOA Interrupt Mask Register */ -#define AT91C_PIO_PER (AT91_REG(0xFFFFF400)) /* PIOA PIO Enable Register */ -#define AT91C_PIO_IFDR (AT91_REG(0xFFFFF424)) /* PIOA Input Filter Disable Register */ -#define AT91C_PIO_OWDR (AT91_REG(0xFFFFF4A4)) /* PIOA Output Write Disable Register */ -#define AT91C_PIO_MDSR (AT91_REG(0xFFFFF458)) /* PIOA Multi-driver Status Register */ -#define AT91C_PIO_IDR (AT91_REG(0xFFFFF444)) /* PIOA Interrupt Disable Register */ -#define AT91C_PIO_ODSR (AT91_REG(0xFFFFF438)) /* PIOA Output Data Status Register */ -#define AT91C_PIO_PPUSR (AT91_REG(0xFFFFF468)) /* PIOA Pull-up Status Register */ -#define AT91C_PIO_OWSR (AT91_REG(0xFFFFF4A8)) /* PIOA Output Write Status Register */ -#define AT91C_PIO_BSR (AT91_REG(0xFFFFF474)) /* PIOA Select B Register */ -#define AT91C_PIO_OWER (AT91_REG(0xFFFFF4A0)) /* PIOA Output Write Enable Register */ -#define AT91C_PIO_IFER (AT91_REG(0xFFFFF420)) /* PIOA Input Filter Enable Register */ -#define AT91C_PIO_PDSR (AT91_REG(0xFFFFF43C)) /* PIOA Pin Data Status Register */ -#define AT91C_PIO_PPUER (AT91_REG(0xFFFFF464)) /* PIOA Pull-up Enable Register */ -#define AT91C_PIO_OSR (AT91_REG(0xFFFFF418)) /* PIOA Output Status Register */ -#define AT91C_PIO_ASR (AT91_REG(0xFFFFF470)) /* PIOA Select A Register */ -#define AT91C_PIO_MDDR (AT91_REG(0xFFFFF454)) /* PIOA Multi-driver Disable Register */ -#define AT91C_PIO_CODR (AT91_REG(0xFFFFF434)) /* PIOA Clear Output Data Register */ -#define AT91C_PIO_MDER (AT91_REG(0xFFFFF450)) /* PIOA Multi-driver Enable Register */ -#define AT91C_PIO_PDR (AT91_REG(0xFFFFF404)) /* PIOA PIO Disable Register */ -#define AT91C_PIO_IFSR (AT91_REG(0xFFFFF428)) /* PIOA Input Filter Status Register */ -#define AT91C_PIO_OER (AT91_REG(0xFFFFF410)) /* PIOA Output Enable Register */ -#define AT91C_PIO_PSR (AT91_REG(0xFFFFF408)) /* PIOA PIO Status Register */ +#define AT91C_PIO_ODR (AT91_REG(0xFFFFF414)) /* PIOA Output Disable Registerr */ +#define AT91C_PIO_SODR (AT91_REG(0xFFFFF430)) /* PIOA Set Output Data Register */ +#define AT91C_PIO_ISR (AT91_REG(0xFFFFF44C)) /* PIOA Interrupt Status Register */ +#define AT91C_PIO_ABSR (AT91_REG(0xFFFFF478)) /* PIOA AB Select Status Register */ +#define AT91C_PIO_IER (AT91_REG(0xFFFFF440)) /* PIOA Interrupt Enable Register */ +#define AT91C_PIO_PPUDR (AT91_REG(0xFFFFF460)) /* PIOA Pull-up Disable Register */ +#define AT91C_PIO_IMR (AT91_REG(0xFFFFF448)) /* PIOA Interrupt Mask Register */ +#define AT91C_PIO_PER (AT91_REG(0xFFFFF400)) /* PIOA PIO Enable Register */ +#define AT91C_PIO_IFDR (AT91_REG(0xFFFFF424)) /* PIOA Input Filter Disable Register */ +#define AT91C_PIO_OWDR (AT91_REG(0xFFFFF4A4)) /* PIOA Output Write Disable Register */ +#define AT91C_PIO_MDSR (AT91_REG(0xFFFFF458)) /* PIOA Multi-driver Status Register */ +#define AT91C_PIO_IDR (AT91_REG(0xFFFFF444)) /* PIOA Interrupt Disable Register */ +#define AT91C_PIO_ODSR (AT91_REG(0xFFFFF438)) /* PIOA Output Data Status Register */ +#define AT91C_PIO_PPUSR (AT91_REG(0xFFFFF468)) /* PIOA Pull-up Status Register */ +#define AT91C_PIO_OWSR (AT91_REG(0xFFFFF4A8)) /* PIOA Output Write Status Register */ +#define AT91C_PIO_BSR (AT91_REG(0xFFFFF474)) /* PIOA Select B Register */ +#define AT91C_PIO_OWER (AT91_REG(0xFFFFF4A0)) /* PIOA Output Write Enable Register */ +#define AT91C_PIO_IFER (AT91_REG(0xFFFFF420)) /* PIOA Input Filter Enable Register */ +#define AT91C_PIO_PDSR (AT91_REG(0xFFFFF43C)) /* PIOA Pin Data Status Register */ +#define AT91C_PIO_PPUER (AT91_REG(0xFFFFF464)) /* PIOA Pull-up Enable Register */ +#define AT91C_PIO_OSR (AT91_REG(0xFFFFF418)) /* PIOA Output Status Register */ +#define AT91C_PIO_ASR (AT91_REG(0xFFFFF470)) /* PIOA Select A Register */ +#define AT91C_PIO_MDDR (AT91_REG(0xFFFFF454)) /* PIOA Multi-driver Disable Register */ +#define AT91C_PIO_CODR (AT91_REG(0xFFFFF434)) /* PIOA Clear Output Data Register */ +#define AT91C_PIO_MDER (AT91_REG(0xFFFFF450)) /* PIOA Multi-driver Enable Register */ +#define AT91C_PIO_PDR (AT91_REG(0xFFFFF404)) /* PIOA PIO Disable Register */ +#define AT91C_PIO_IFSR (AT91_REG(0xFFFFF428)) /* PIOA Input Filter Status Register */ +#define AT91C_PIO_OER (AT91_REG(0xFFFFF410)) /* PIOA Output Enable Register */ +#define AT91C_PIO_PSR (AT91_REG(0xFFFFF408)) /* PIOA PIO Status Register */ // ========== Register definition for PIOA peripheral ========== -#define AT91C_PIOA_IMR (AT91_REG(0xFFFFF448)) // (PIOA) Interrupt Mask Register -#define AT91C_PIOA_IER (AT91_REG(0xFFFFF440)) // (PIOA) Interrupt Enable Register -#define AT91C_PIOA_OWDR (AT91_REG(0xFFFFF4A4)) // (PIOA) Output Write Disable Register -#define AT91C_PIOA_ISR (AT91_REG(0xFFFFF44C)) // (PIOA) Interrupt Status Register -#define AT91C_PIOA_PPUDR (AT91_REG(0xFFFFF460)) // (PIOA) Pull-up Disable Register -#define AT91C_PIOA_MDSR (AT91_REG(0xFFFFF458)) // (PIOA) Multi-driver Status Register -#define AT91C_PIOA_MDER (AT91_REG(0xFFFFF450)) // (PIOA) Multi-driver Enable Register -#define AT91C_PIOA_PER (AT91_REG(0xFFFFF400)) // (PIOA) PIO Enable Register -#define AT91C_PIOA_PSR (AT91_REG(0xFFFFF408)) // (PIOA) PIO Status Register -#define AT91C_PIOA_OER (AT91_REG(0xFFFFF410)) // (PIOA) Output Enable Register -#define AT91C_PIOA_BSR (AT91_REG(0xFFFFF474)) // (PIOA) Select B Register -#define AT91C_PIOA_PPUER (AT91_REG(0xFFFFF464)) // (PIOA) Pull-up Enable Register -#define AT91C_PIOA_MDDR (AT91_REG(0xFFFFF454)) // (PIOA) Multi-driver Disable Register -#define AT91C_PIOA_PDR (AT91_REG(0xFFFFF404)) // (PIOA) PIO Disable Register -#define AT91C_PIOA_ODR (AT91_REG(0xFFFFF414)) // (PIOA) Output Disable Registerr -#define AT91C_PIOA_IFDR (AT91_REG(0xFFFFF424)) // (PIOA) Input Filter Disable Register -#define AT91C_PIOA_ABSR (AT91_REG(0xFFFFF478)) // (PIOA) AB Select Status Register -#define AT91C_PIOA_ASR (AT91_REG(0xFFFFF470)) // (PIOA) Select A Register -#define AT91C_PIOA_PPUSR (AT91_REG(0xFFFFF468)) // (PIOA) Pull-up Status Register -#define AT91C_PIOA_ODSR (AT91_REG(0xFFFFF438)) // (PIOA) Output Data Status Register -#define AT91C_PIOA_SODR (AT91_REG(0xFFFFF430)) // (PIOA) Set Output Data Register -#define AT91C_PIOA_IFSR (AT91_REG(0xFFFFF428)) // (PIOA) Input Filter Status Register -#define AT91C_PIOA_IFER (AT91_REG(0xFFFFF420)) // (PIOA) Input Filter Enable Register -#define AT91C_PIOA_OSR (AT91_REG(0xFFFFF418)) // (PIOA) Output Status Register -#define AT91C_PIOA_IDR (AT91_REG(0xFFFFF444)) // (PIOA) Interrupt Disable Register -#define AT91C_PIOA_PDSR (AT91_REG(0xFFFFF43C)) // (PIOA) Pin Data Status Register -#define AT91C_PIOA_CODR (AT91_REG(0xFFFFF434)) // (PIOA) Clear Output Data Register -#define AT91C_PIOA_OWSR (AT91_REG(0xFFFFF4A8)) // (PIOA) Output Write Status Register -#define AT91C_PIOA_OWER (AT91_REG(0xFFFFF4A0)) // (PIOA) Output Write Enable Register +#define AT91C_PIOA_IMR (AT91_REG(0xFFFFF448)) // (PIOA) Interrupt Mask Register +#define AT91C_PIOA_IER (AT91_REG(0xFFFFF440)) // (PIOA) Interrupt Enable Register +#define AT91C_PIOA_OWDR (AT91_REG(0xFFFFF4A4)) // (PIOA) Output Write Disable Register +#define AT91C_PIOA_ISR (AT91_REG(0xFFFFF44C)) // (PIOA) Interrupt Status Register +#define AT91C_PIOA_PPUDR (AT91_REG(0xFFFFF460)) // (PIOA) Pull-up Disable Register +#define AT91C_PIOA_MDSR (AT91_REG(0xFFFFF458)) // (PIOA) Multi-driver Status Register +#define AT91C_PIOA_MDER (AT91_REG(0xFFFFF450)) // (PIOA) Multi-driver Enable Register +#define AT91C_PIOA_PER (AT91_REG(0xFFFFF400)) // (PIOA) PIO Enable Register +#define AT91C_PIOA_PSR (AT91_REG(0xFFFFF408)) // (PIOA) PIO Status Register +#define AT91C_PIOA_OER (AT91_REG(0xFFFFF410)) // (PIOA) Output Enable Register +#define AT91C_PIOA_BSR (AT91_REG(0xFFFFF474)) // (PIOA) Select B Register +#define AT91C_PIOA_PPUER (AT91_REG(0xFFFFF464)) // (PIOA) Pull-up Enable Register +#define AT91C_PIOA_MDDR (AT91_REG(0xFFFFF454)) // (PIOA) Multi-driver Disable Register +#define AT91C_PIOA_PDR (AT91_REG(0xFFFFF404)) // (PIOA) PIO Disable Register +#define AT91C_PIOA_ODR (AT91_REG(0xFFFFF414)) // (PIOA) Output Disable Registerr +#define AT91C_PIOA_IFDR (AT91_REG(0xFFFFF424)) // (PIOA) Input Filter Disable Register +#define AT91C_PIOA_ABSR (AT91_REG(0xFFFFF478)) // (PIOA) AB Select Status Register +#define AT91C_PIOA_ASR (AT91_REG(0xFFFFF470)) // (PIOA) Select A Register +#define AT91C_PIOA_PPUSR (AT91_REG(0xFFFFF468)) // (PIOA) Pull-up Status Register +#define AT91C_PIOA_ODSR (AT91_REG(0xFFFFF438)) // (PIOA) Output Data Status Register +#define AT91C_PIOA_SODR (AT91_REG(0xFFFFF430)) // (PIOA) Set Output Data Register +#define AT91C_PIOA_IFSR (AT91_REG(0xFFFFF428)) // (PIOA) Input Filter Status Register +#define AT91C_PIOA_IFER (AT91_REG(0xFFFFF420)) // (PIOA) Input Filter Enable Register +#define AT91C_PIOA_OSR (AT91_REG(0xFFFFF418)) // (PIOA) Output Status Register +#define AT91C_PIOA_IDR (AT91_REG(0xFFFFF444)) // (PIOA) Interrupt Disable Register +#define AT91C_PIOA_PDSR (AT91_REG(0xFFFFF43C)) // (PIOA) Pin Data Status Register +#define AT91C_PIOA_CODR (AT91_REG(0xFFFFF434)) // (PIOA) Clear Output Data Register +#define AT91C_PIOA_OWSR (AT91_REG(0xFFFFF4A8)) // (PIOA) Output Write Status Register +#define AT91C_PIOA_OWER (AT91_REG(0xFFFFF4A0)) // (PIOA) Output Write Enable Register // ========== Register definition for PIOB peripheral ========== -#define AT91C_PIOB_OWSR (AT91_REG(0xFFFFF6A8)) // (PIOB) Output Write Status Register -#define AT91C_PIOB_PPUSR (AT91_REG(0xFFFFF668)) // (PIOB) Pull-up Status Register -#define AT91C_PIOB_PPUDR (AT91_REG(0xFFFFF660)) // (PIOB) Pull-up Disable Register -#define AT91C_PIOB_MDSR (AT91_REG(0xFFFFF658)) // (PIOB) Multi-driver Status Register -#define AT91C_PIOB_MDER (AT91_REG(0xFFFFF650)) // (PIOB) Multi-driver Enable Register -#define AT91C_PIOB_IMR (AT91_REG(0xFFFFF648)) // (PIOB) Interrupt Mask Register -#define AT91C_PIOB_OSR (AT91_REG(0xFFFFF618)) // (PIOB) Output Status Register -#define AT91C_PIOB_OER (AT91_REG(0xFFFFF610)) // (PIOB) Output Enable Register -#define AT91C_PIOB_PSR (AT91_REG(0xFFFFF608)) // (PIOB) PIO Status Register -#define AT91C_PIOB_PER (AT91_REG(0xFFFFF600)) // (PIOB) PIO Enable Register -#define AT91C_PIOB_BSR (AT91_REG(0xFFFFF674)) // (PIOB) Select B Register -#define AT91C_PIOB_PPUER (AT91_REG(0xFFFFF664)) // (PIOB) Pull-up Enable Register -#define AT91C_PIOB_IFDR (AT91_REG(0xFFFFF624)) // (PIOB) Input Filter Disable Register -#define AT91C_PIOB_ODR (AT91_REG(0xFFFFF614)) // (PIOB) Output Disable Registerr -#define AT91C_PIOB_ABSR (AT91_REG(0xFFFFF678)) // (PIOB) AB Select Status Register -#define AT91C_PIOB_ASR (AT91_REG(0xFFFFF670)) // (PIOB) Select A Register -#define AT91C_PIOB_IFER (AT91_REG(0xFFFFF620)) // (PIOB) Input Filter Enable Register -#define AT91C_PIOB_IFSR (AT91_REG(0xFFFFF628)) // (PIOB) Input Filter Status Register -#define AT91C_PIOB_SODR (AT91_REG(0xFFFFF630)) // (PIOB) Set Output Data Register -#define AT91C_PIOB_ODSR (AT91_REG(0xFFFFF638)) // (PIOB) Output Data Status Register -#define AT91C_PIOB_CODR (AT91_REG(0xFFFFF634)) // (PIOB) Clear Output Data Register -#define AT91C_PIOB_PDSR (AT91_REG(0xFFFFF63C)) // (PIOB) Pin Data Status Register -#define AT91C_PIOB_OWER (AT91_REG(0xFFFFF6A0)) // (PIOB) Output Write Enable Register -#define AT91C_PIOB_IER (AT91_REG(0xFFFFF640)) // (PIOB) Interrupt Enable Register -#define AT91C_PIOB_OWDR (AT91_REG(0xFFFFF6A4)) // (PIOB) Output Write Disable Register -#define AT91C_PIOB_MDDR (AT91_REG(0xFFFFF654)) // (PIOB) Multi-driver Disable Register -#define AT91C_PIOB_ISR (AT91_REG(0xFFFFF64C)) // (PIOB) Interrupt Status Register -#define AT91C_PIOB_IDR (AT91_REG(0xFFFFF644)) // (PIOB) Interrupt Disable Register -#define AT91C_PIOB_PDR (AT91_REG(0xFFFFF604)) // (PIOB) PIO Disable Register +#define AT91C_PIOB_OWSR (AT91_REG(0xFFFFF6A8)) // (PIOB) Output Write Status Register +#define AT91C_PIOB_PPUSR (AT91_REG(0xFFFFF668)) // (PIOB) Pull-up Status Register +#define AT91C_PIOB_PPUDR (AT91_REG(0xFFFFF660)) // (PIOB) Pull-up Disable Register +#define AT91C_PIOB_MDSR (AT91_REG(0xFFFFF658)) // (PIOB) Multi-driver Status Register +#define AT91C_PIOB_MDER (AT91_REG(0xFFFFF650)) // (PIOB) Multi-driver Enable Register +#define AT91C_PIOB_IMR (AT91_REG(0xFFFFF648)) // (PIOB) Interrupt Mask Register +#define AT91C_PIOB_OSR (AT91_REG(0xFFFFF618)) // (PIOB) Output Status Register +#define AT91C_PIOB_OER (AT91_REG(0xFFFFF610)) // (PIOB) Output Enable Register +#define AT91C_PIOB_PSR (AT91_REG(0xFFFFF608)) // (PIOB) PIO Status Register +#define AT91C_PIOB_PER (AT91_REG(0xFFFFF600)) // (PIOB) PIO Enable Register +#define AT91C_PIOB_BSR (AT91_REG(0xFFFFF674)) // (PIOB) Select B Register +#define AT91C_PIOB_PPUER (AT91_REG(0xFFFFF664)) // (PIOB) Pull-up Enable Register +#define AT91C_PIOB_IFDR (AT91_REG(0xFFFFF624)) // (PIOB) Input Filter Disable Register +#define AT91C_PIOB_ODR (AT91_REG(0xFFFFF614)) // (PIOB) Output Disable Registerr +#define AT91C_PIOB_ABSR (AT91_REG(0xFFFFF678)) // (PIOB) AB Select Status Register +#define AT91C_PIOB_ASR (AT91_REG(0xFFFFF670)) // (PIOB) Select A Register +#define AT91C_PIOB_IFER (AT91_REG(0xFFFFF620)) // (PIOB) Input Filter Enable Register +#define AT91C_PIOB_IFSR (AT91_REG(0xFFFFF628)) // (PIOB) Input Filter Status Register +#define AT91C_PIOB_SODR (AT91_REG(0xFFFFF630)) // (PIOB) Set Output Data Register +#define AT91C_PIOB_ODSR (AT91_REG(0xFFFFF638)) // (PIOB) Output Data Status Register +#define AT91C_PIOB_CODR (AT91_REG(0xFFFFF634)) // (PIOB) Clear Output Data Register +#define AT91C_PIOB_PDSR (AT91_REG(0xFFFFF63C)) // (PIOB) Pin Data Status Register +#define AT91C_PIOB_OWER (AT91_REG(0xFFFFF6A0)) // (PIOB) Output Write Enable Register +#define AT91C_PIOB_IER (AT91_REG(0xFFFFF640)) // (PIOB) Interrupt Enable Register +#define AT91C_PIOB_OWDR (AT91_REG(0xFFFFF6A4)) // (PIOB) Output Write Disable Register +#define AT91C_PIOB_MDDR (AT91_REG(0xFFFFF654)) // (PIOB) Multi-driver Disable Register +#define AT91C_PIOB_ISR (AT91_REG(0xFFFFF64C)) // (PIOB) Interrupt Status Register +#define AT91C_PIOB_IDR (AT91_REG(0xFFFFF644)) // (PIOB) Interrupt Disable Register +#define AT91C_PIOB_PDR (AT91_REG(0xFFFFF604)) // (PIOB) PIO Disable Register /* ========== Register definition for PMC peripheral ========== */ -#define AT91C_PMC_SCER (AT91_REG(0xFFFFFC00)) /* PMC System Clock Enable Register */ -#define AT91C_PMC_SCDR (AT91_REG(0xFFFFFC04)) /* PMC System Clock Disable Register */ -#define AT91C_PMC_SCSR (AT91_REG(0xFFFFFC08)) /* PMC System Clock Status Register */ -#define AT91C_PMC_PCER (AT91_REG(0xFFFFFC10)) /* PMC Peripheral Clock Enable Register */ -#define AT91C_PMC_PCDR (AT91_REG(0xFFFFFC14)) /* PMC Peripheral Clock Disable Register */ -#define AT91C_PMC_PCSR (AT91_REG(0xFFFFFC18)) /* PMC Peripheral Clock Status Register */ -#define AT91C_PMC_MOR (AT91_REG(0xFFFFFC20)) /* PMC Main Oscillator Register */ -#define AT91C_PMC_MCFR (AT91_REG(0xFFFFFC24)) /* PMC Main Clock Frequency Register */ -#define AT91C_PMC_PLLR (AT91_REG(0xFFFFFC2C)) /* PMC PLL Register */ -#define AT91C_PMC_MCKR (AT91_REG(0xFFFFFC30)) /* PMC Master Clock Register */ -#define AT91C_PMC_PCKR (AT91_REG(0xFFFFFC40)) /* PMC Programmable Clock Register */ -#define AT91C_PMC_IER (AT91_REG(0xFFFFFC60)) /* PMC Interrupt Enable Register */ -#define AT91C_PMC_IDR (AT91_REG(0xFFFFFC64)) /* PMC Interrupt Disable Register */ -#define AT91C_PMC_SR (AT91_REG(0xFFFFFC68)) /* PMC Status Register */ -#define AT91C_PMC_IMR (AT91_REG(0xFFFFFC6C)) /* PMC Interrupt Mask Register */ +#define AT91C_PMC_SCER (AT91_REG(0xFFFFFC00)) /* PMC System Clock Enable Register */ +#define AT91C_PMC_SCDR (AT91_REG(0xFFFFFC04)) /* PMC System Clock Disable Register */ +#define AT91C_PMC_SCSR (AT91_REG(0xFFFFFC08)) /* PMC System Clock Status Register */ +#define AT91C_PMC_PCER (AT91_REG(0xFFFFFC10)) /* PMC Peripheral Clock Enable Register */ +#define AT91C_PMC_PCDR (AT91_REG(0xFFFFFC14)) /* PMC Peripheral Clock Disable Register */ +#define AT91C_PMC_PCSR (AT91_REG(0xFFFFFC18)) /* PMC Peripheral Clock Status Register */ +#define AT91C_PMC_MOR (AT91_REG(0xFFFFFC20)) /* PMC Main Oscillator Register */ +#define AT91C_PMC_MCFR (AT91_REG(0xFFFFFC24)) /* PMC Main Clock Frequency Register */ +#define AT91C_PMC_PLLR (AT91_REG(0xFFFFFC2C)) /* PMC PLL Register */ +#define AT91C_PMC_MCKR (AT91_REG(0xFFFFFC30)) /* PMC Master Clock Register */ +#define AT91C_PMC_PCKR (AT91_REG(0xFFFFFC40)) /* PMC Programmable Clock Register */ +#define AT91C_PMC_IER (AT91_REG(0xFFFFFC60)) /* PMC Interrupt Enable Register */ +#define AT91C_PMC_IDR (AT91_REG(0xFFFFFC64)) /* PMC Interrupt Disable Register */ +#define AT91C_PMC_SR (AT91_REG(0xFFFFFC68)) /* PMC Status Register */ +#define AT91C_PMC_IMR (AT91_REG(0xFFFFFC6C)) /* PMC Interrupt Mask Register */ /******************************************************************************/ /* PERIPHERAL ID DEFINITIONS FOR AT91SAM7S64 */ /******************************************************************************/ -#define AT91C_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ -#define AT91C_ID_SYS 1 /* System Peripheral */ -#define AT91C_ID_PIOA 2 /* Parallel IO Controller A */ -#define AT91C_ID_PIOB 3 /* Parallel IO Controller B */ -#define AT91C_ID_ADC 4 /* Analog-to-Digital Converter */ -#define AT91C_ID_SPI 5 /* Serial Peripheral Interface */ -#define AT91C_ID_US0 6 /* USART 0 */ -#define AT91C_ID_US1 7 /* USART 1 */ -#define AT91C_ID_SSC 8 /* Serial Synchronous Controller */ -#define AT91C_ID_TWI 9 /* Two-Wire Interface */ -#define AT91C_ID_PWMC 10 /* PWM Controller */ -#define AT91C_ID_UDP 11 /* USB Device Port */ -#define AT91C_ID_TC0 12 /* Timer Counter 0 */ -#define AT91C_ID_TC1 13 /* Timer Counter 1 */ -#define AT91C_ID_TC2 14 /* Timer Counter 2 */ -#define AT91C_ID_15 15 /* Reserved */ -#define AT91C_ID_16 16 /* Reserved */ -#define AT91C_ID_17 17 /* Reserved */ -#define AT91C_ID_18 18 /* Reserved */ -#define AT91C_ID_19 19 /* Reserved */ -#define AT91C_ID_20 20 /* Reserved */ -#define AT91C_ID_21 21 /* Reserved */ -#define AT91C_ID_22 22 /* Reserved */ -#define AT91C_ID_23 23 /* Reserved */ -#define AT91C_ID_24 24 /* Reserved */ -#define AT91C_ID_25 25 /* Reserved */ -#define AT91C_ID_26 26 /* Reserved */ -#define AT91C_ID_27 27 /* Reserved */ -#define AT91C_ID_28 28 /* Reserved */ -#define AT91C_ID_29 29 /* Reserved */ -#define AT91C_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */ -#define AT91C_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */ -#define AT91C_ALL_INT 0xC0007FF7 /* ALL VALID INTERRUPTS */ +#define AT91C_ID_FIQ 0 /* Advanced Interrupt Controller (FIQ) */ +#define AT91C_ID_SYS 1 /* System Peripheral */ +#define AT91C_ID_PIOA 2 /* Parallel IO Controller A */ +#define AT91C_ID_PIOB 3 /* Parallel IO Controller B */ +#define AT91C_ID_ADC 4 /* Analog-to-Digital Converter */ +#define AT91C_ID_SPI 5 /* Serial Peripheral Interface */ +#define AT91C_ID_US0 6 /* USART 0 */ +#define AT91C_ID_US1 7 /* USART 1 */ +#define AT91C_ID_SSC 8 /* Serial Synchronous Controller */ +#define AT91C_ID_TWI 9 /* Two-Wire Interface */ +#define AT91C_ID_PWMC 10 /* PWM Controller */ +#define AT91C_ID_UDP 11 /* USB Device Port */ +#define AT91C_ID_TC0 12 /* Timer Counter 0 */ +#define AT91C_ID_TC1 13 /* Timer Counter 1 */ +#define AT91C_ID_TC2 14 /* Timer Counter 2 */ +#define AT91C_ID_15 15 /* Reserved */ +#define AT91C_ID_16 16 /* Reserved */ +#define AT91C_ID_17 17 /* Reserved */ +#define AT91C_ID_18 18 /* Reserved */ +#define AT91C_ID_19 19 /* Reserved */ +#define AT91C_ID_20 20 /* Reserved */ +#define AT91C_ID_21 21 /* Reserved */ +#define AT91C_ID_22 22 /* Reserved */ +#define AT91C_ID_23 23 /* Reserved */ +#define AT91C_ID_24 24 /* Reserved */ +#define AT91C_ID_25 25 /* Reserved */ +#define AT91C_ID_26 26 /* Reserved */ +#define AT91C_ID_27 27 /* Reserved */ +#define AT91C_ID_28 28 /* Reserved */ +#define AT91C_ID_29 29 /* Reserved */ +#define AT91C_ID_IRQ0 30 /* Advanced Interrupt Controller (IRQ0) */ +#define AT91C_ID_IRQ1 31 /* Advanced Interrupt Controller (IRQ1) */ +#define AT91C_ALL_INT 0xC0007FF7 /* ALL VALID INTERRUPTS */ /*****************************/ /* CPU Mode */ /*****************************/ -#define USERMODE 0x10 -#define FIQMODE 0x11 -#define IRQMODE 0x12 -#define SVCMODE 0x13 -#define ABORTMODE 0x17 -#define UNDEFMODE 0x1b -#define MODEMASK 0x1f -#define NOINT 0xc0 +#define USERMODE 0x10 +#define FIQMODE 0x11 +#define IRQMODE 0x12 +#define SVCMODE 0x13 +#define ABORTMODE 0x17 +#define UNDEFMODE 0x1b +#define MODEMASK 0x1f +#define NOINT 0xc0 #ifdef __cplusplus } diff --git a/libcpu/arm/AT91SAM7S/cpu.c b/libcpu/arm/AT91SAM7S/cpu.c index 8d28063eb..8a6943dca 100644 --- a/libcpu/arm/AT91SAM7S/cpu.c +++ b/libcpu/arm/AT91SAM7S/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,9 +30,9 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } /*@}*/ diff --git a/libcpu/arm/AT91SAM7S/interrupt.c b/libcpu/arm/AT91SAM7S/interrupt.c index db9d31fe2..e4aa8643f 100644 --- a/libcpu/arm/AT91SAM7S/interrupt.c +++ b/libcpu/arm/AT91SAM7S/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,7 +11,7 @@ #include #include "AT91SAM7S.h" -#define MAX_HANDLERS 32 +#define MAX_HANDLERS 32 extern rt_uint32_t rt_interrupt_nest; @@ -25,7 +25,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; void rt_hw_interrupt_handler(int vector) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -33,18 +33,18 @@ void rt_hw_interrupt_handler(int vector) */ void rt_hw_interrupt_init() { - rt_base_t index; + rt_base_t index; - for (index = 0; index < MAX_HANDLERS; index ++) - { - AT91C_AIC_SVR(index) = (rt_uint32_t)rt_hw_interrupt_handler; - } + for (index = 0; index < MAX_HANDLERS; index ++) + { + AT91C_AIC_SVR(index) = (rt_uint32_t)rt_hw_interrupt_handler; + } - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } /** @@ -53,11 +53,11 @@ void rt_hw_interrupt_init() */ void rt_hw_interrupt_mask(int vector) { - /* disable interrupt */ - AT91C_AIC_IDCR = 1 << vector; + /* disable interrupt */ + AT91C_AIC_IDCR = 1 << vector; - /* clear interrupt */ - AT91C_AIC_ICCR = 1 << vector; + /* clear interrupt */ + AT91C_AIC_ICCR = 1 << vector; } /** @@ -66,7 +66,7 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - AT91C_AIC_IECR = 1 << vector; + AT91C_AIC_IECR = 1 << vector; } /** @@ -77,11 +77,11 @@ void rt_hw_interrupt_umask(int vector) */ void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler) { - if(vector >= 0 && vector < MAX_HANDLERS) - { - if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)AT91C_AIC_SVR(vector); - if (new_handler != RT_NULL) AT91C_AIC_SVR(vector) = (rt_uint32_t)new_handler; - } + if(vector >= 0 && vector < MAX_HANDLERS) + { + if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)AT91C_AIC_SVR(vector); + if (new_handler != RT_NULL) AT91C_AIC_SVR(vector) = (rt_uint32_t)new_handler; + } } /*@}*/ diff --git a/libcpu/arm/AT91SAM7S/serial.c b/libcpu/arm/AT91SAM7S/serial.c index adbe8609d..583443f4c 100644 --- a/libcpu/arm/AT91SAM7S/serial.c +++ b/libcpu/arm/AT91SAM7S/serial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,46 +22,46 @@ typedef volatile rt_uint32_t REG32; struct rt_at91serial_hw { - REG32 US_CR; // Control Register - REG32 US_MR; // Mode Register - REG32 US_IER; // Interrupt Enable Register - REG32 US_IDR; // Interrupt Disable Register - REG32 US_IMR; // Interrupt Mask Register - REG32 US_CSR; // Channel Status Register - REG32 US_RHR; // Receiver Holding Register - REG32 US_THR; // Transmitter Holding Register - REG32 US_BRGR; // Baud Rate Generator Register - REG32 US_RTOR; // Receiver Time-out Register - REG32 US_TTGR; // Transmitter Time-guard Register - REG32 Reserved0[5]; // - REG32 US_FIDI; // FI_DI_Ratio Register - REG32 US_NER; // Nb Errors Register - REG32 Reserved1[1]; // - REG32 US_IF; // IRDA_FILTER Register - REG32 Reserved2[44]; // - REG32 US_RPR; // Receive Pointer Register - REG32 US_RCR; // Receive Counter Register - REG32 US_TPR; // Transmit Pointer Register - REG32 US_TCR; // Transmit Counter Register - REG32 US_RNPR; // Receive Next Pointer Register - REG32 US_RNCR; // Receive Next Counter Register - REG32 US_TNPR; // Transmit Next Pointer Register - REG32 US_TNCR; // Transmit Next Counter Register - REG32 US_PTCR; // PDC Transfer Control Register - REG32 US_PTSR; // PDC Transfer Status Register + REG32 US_CR; // Control Register + REG32 US_MR; // Mode Register + REG32 US_IER; // Interrupt Enable Register + REG32 US_IDR; // Interrupt Disable Register + REG32 US_IMR; // Interrupt Mask Register + REG32 US_CSR; // Channel Status Register + REG32 US_RHR; // Receiver Holding Register + REG32 US_THR; // Transmitter Holding Register + REG32 US_BRGR; // Baud Rate Generator Register + REG32 US_RTOR; // Receiver Time-out Register + REG32 US_TTGR; // Transmitter Time-guard Register + REG32 Reserved0[5]; // + REG32 US_FIDI; // FI_DI_Ratio Register + REG32 US_NER; // Nb Errors Register + REG32 Reserved1[1]; // + REG32 US_IF; // IRDA_FILTER Register + REG32 Reserved2[44]; // + REG32 US_RPR; // Receive Pointer Register + REG32 US_RCR; // Receive Counter Register + REG32 US_TPR; // Transmit Pointer Register + REG32 US_TCR; // Transmit Counter Register + REG32 US_RNPR; // Receive Next Pointer Register + REG32 US_RNCR; // Receive Next Counter Register + REG32 US_TNPR; // Transmit Next Pointer Register + REG32 US_TNCR; // Transmit Next Counter Register + REG32 US_PTCR; // PDC Transfer Control Register + REG32 US_PTSR; // PDC Transfer Status Register }; struct rt_at91serial { - struct rt_device parent; + struct rt_device parent; - struct rt_at91serial_hw* hw_base; - rt_uint16_t peripheral_id; - rt_uint32_t baudrate; + struct rt_at91serial_hw* hw_base; + rt_uint16_t peripheral_id; + rt_uint32_t baudrate; - /* reception field */ - rt_uint16_t save_index, read_index; - rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE]; + /* reception field */ + rt_uint16_t save_index, read_index; + rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE]; }; #ifdef RT_USING_UART1 struct rt_at91serial serial1; @@ -72,312 +72,312 @@ struct rt_at91serial serial2; static void rt_hw_serial_isr(int irqno) { - rt_base_t level; - struct rt_device* device; - struct rt_at91serial* serial = RT_NULL; + rt_base_t level; + struct rt_device* device; + struct rt_at91serial* serial = RT_NULL; - if (irqno == AT91C_ID_US0) - { + if (irqno == AT91C_ID_US0) + { #ifdef RT_USING_UART1 - /* serial 1 */ - serial = &serial1; + /* serial 1 */ + serial = &serial1; #endif - } - else if (irqno == AT91C_ID_US1) - { + } + else if (irqno == AT91C_ID_US1) + { #ifdef RT_USING_UART2 - /* serial 2 */ - serial = &serial2; + /* serial 2 */ + serial = &serial2; #endif - } - RT_ASSERT(serial != RT_NULL); + } + RT_ASSERT(serial != RT_NULL); - /* get generic device object */ - device = (rt_device_t)serial; + /* get generic device object */ + device = (rt_device_t)serial; - /* disable interrupt */ - level = rt_hw_interrupt_disable(); + /* disable interrupt */ + level = rt_hw_interrupt_disable(); - /* get received character */ - serial->rx_buffer[serial->save_index] = serial->hw_base->US_RHR; + /* get received character */ + serial->rx_buffer[serial->save_index] = serial->hw_base->US_RHR; - /* move to next position */ - serial->save_index ++; - if (serial->save_index >= RT_UART_RX_BUFFER_SIZE) - serial->save_index = 0; + /* move to next position */ + serial->save_index ++; + if (serial->save_index >= RT_UART_RX_BUFFER_SIZE) + serial->save_index = 0; - /* if the next position is read index, discard this 'read char' */ - if (serial->save_index == serial->read_index) - { - serial->read_index ++; - if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) - serial->read_index = 0; - } + /* if the next position is read index, discard this 'read char' */ + if (serial->save_index == serial->read_index) + { + serial->read_index ++; + if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) + serial->read_index = 0; + } - /* enable interrupt */ - rt_hw_interrupt_enable(level); + /* enable interrupt */ + rt_hw_interrupt_enable(level); - /* indicate to upper layer application */ - if (device->rx_indicate != RT_NULL) - device->rx_indicate(device, 1); + /* indicate to upper layer application */ + if (device->rx_indicate != RT_NULL) + device->rx_indicate(device, 1); - /* ack interrupt */ - AT91C_AIC_EOICR = 1; + /* ack interrupt */ + AT91C_AIC_EOICR = 1; } static rt_err_t rt_serial_init (rt_device_t dev) { - rt_uint32_t bd; - struct rt_at91serial* serial = (struct rt_at91serial*) dev; - - RT_ASSERT(serial != RT_NULL); - /* must be US0 or US1 */ - RT_ASSERT(((serial->peripheral_id == AT91C_ID_US0) || - (serial->peripheral_id == AT91C_ID_US1))); - - /* Enable Clock for USART */ - AT91C_PMC_PCER = 1 << serial->peripheral_id; - - /* Enable RxD0 and TxDO Pin */ - if (serial->peripheral_id == AT91C_ID_US0) - { - /* set pinmux */ - AT91C_PIO_PDR = (1 << 5) | (1 << 6); - } - else if (serial->peripheral_id == AT91C_ID_US1) - { - /* set pinmux */ - AT91C_PIO_PDR = (1 << 21) | (1 << 22); - } - - serial->hw_base->US_CR = AT91C_US_RSTRX | /* Reset Receiver */ - AT91C_US_RSTTX | /* Reset Transmitter */ - AT91C_US_RXDIS | /* Receiver Disable */ - AT91C_US_TXDIS; /* Transmitter Disable */ - - serial->hw_base->US_MR = AT91C_US_USMODE_NORMAL | /* Normal Mode */ - AT91C_US_CLKS_CLOCK | /* Clock = MCK */ - AT91C_US_CHRL_8_BITS | /* 8-bit Data */ - AT91C_US_PAR_NONE | /* No Parity */ - AT91C_US_NBSTOP_1_BIT; /* 1 Stop Bit */ - - /* set baud rate divisor */ - bd = ((MCK*10)/(serial->baudrate * 16)); - if ((bd % 10) >= 5) bd = (bd / 10) + 1; - else bd /= 10; - - serial->hw_base->US_BRGR = bd; - serial->hw_base->US_CR = AT91C_US_RXEN | /* Receiver Enable */ - AT91C_US_TXEN; /* Transmitter Enable */ - - /* reset rx index */ - serial->save_index = 0; - serial->read_index = 0; - - /* reset rx buffer */ - rt_memset(serial->rx_buffer, 0, RT_UART_RX_BUFFER_SIZE); - - return RT_EOK; + rt_uint32_t bd; + struct rt_at91serial* serial = (struct rt_at91serial*) dev; + + RT_ASSERT(serial != RT_NULL); + /* must be US0 or US1 */ + RT_ASSERT(((serial->peripheral_id == AT91C_ID_US0) || + (serial->peripheral_id == AT91C_ID_US1))); + + /* Enable Clock for USART */ + AT91C_PMC_PCER = 1 << serial->peripheral_id; + + /* Enable RxD0 and TxDO Pin */ + if (serial->peripheral_id == AT91C_ID_US0) + { + /* set pinmux */ + AT91C_PIO_PDR = (1 << 5) | (1 << 6); + } + else if (serial->peripheral_id == AT91C_ID_US1) + { + /* set pinmux */ + AT91C_PIO_PDR = (1 << 21) | (1 << 22); + } + + serial->hw_base->US_CR = AT91C_US_RSTRX | /* Reset Receiver */ + AT91C_US_RSTTX | /* Reset Transmitter */ + AT91C_US_RXDIS | /* Receiver Disable */ + AT91C_US_TXDIS; /* Transmitter Disable */ + + serial->hw_base->US_MR = AT91C_US_USMODE_NORMAL | /* Normal Mode */ + AT91C_US_CLKS_CLOCK | /* Clock = MCK */ + AT91C_US_CHRL_8_BITS | /* 8-bit Data */ + AT91C_US_PAR_NONE | /* No Parity */ + AT91C_US_NBSTOP_1_BIT; /* 1 Stop Bit */ + + /* set baud rate divisor */ + bd = ((MCK*10)/(serial->baudrate * 16)); + if ((bd % 10) >= 5) bd = (bd / 10) + 1; + else bd /= 10; + + serial->hw_base->US_BRGR = bd; + serial->hw_base->US_CR = AT91C_US_RXEN | /* Receiver Enable */ + AT91C_US_TXEN; /* Transmitter Enable */ + + /* reset rx index */ + serial->save_index = 0; + serial->read_index = 0; + + /* reset rx buffer */ + rt_memset(serial->rx_buffer, 0, RT_UART_RX_BUFFER_SIZE); + + return RT_EOK; } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { - struct rt_at91serial *serial = (struct rt_at91serial*)dev; - RT_ASSERT(serial != RT_NULL); - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - /* enable UART rx interrupt */ - serial->hw_base->US_IER = 1 << 0; /* RxReady interrupt */ - serial->hw_base->US_IMR |= 1 << 0; /* umask RxReady interrupt */ - - /* install UART handler */ - rt_hw_interrupt_install(serial->peripheral_id, rt_hw_serial_isr, RT_NULL); - AT91C_AIC_SMR(serial->peripheral_id) = 5 | (0x01 << 5); - rt_hw_interrupt_umask(serial->peripheral_id); - } - - return RT_EOK; + struct rt_at91serial *serial = (struct rt_at91serial*)dev; + RT_ASSERT(serial != RT_NULL); + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + /* enable UART rx interrupt */ + serial->hw_base->US_IER = 1 << 0; /* RxReady interrupt */ + serial->hw_base->US_IMR |= 1 << 0; /* umask RxReady interrupt */ + + /* install UART handler */ + rt_hw_interrupt_install(serial->peripheral_id, rt_hw_serial_isr, RT_NULL); + AT91C_AIC_SMR(serial->peripheral_id) = 5 | (0x01 << 5); + rt_hw_interrupt_umask(serial->peripheral_id); + } + + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { - struct rt_at91serial *serial = (struct rt_at91serial*)dev; - RT_ASSERT(serial != RT_NULL); + struct rt_at91serial *serial = (struct rt_at91serial*)dev; + RT_ASSERT(serial != RT_NULL); - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - /* disable interrupt */ - serial->hw_base->US_IDR = 1 << 0; /* RxReady interrupt */ - serial->hw_base->US_IMR &= ~(1 << 0); /* mask RxReady interrupt */ - } + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + /* disable interrupt */ + serial->hw_base->US_IDR = 1 << 0; /* RxReady interrupt */ + serial->hw_base->US_IMR &= ~(1 << 0); /* mask RxReady interrupt */ + } - return RT_EOK; + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - struct rt_at91serial *serial = (struct rt_at91serial*)dev; - RT_ASSERT(serial != RT_NULL); - - /* point to buffer */ - ptr = (rt_uint8_t*) buffer; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - while (size) - { - /* interrupt receive */ - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - if (serial->read_index != serial->save_index) - { - *ptr = serial->rx_buffer[serial->read_index]; - - serial->read_index ++; - if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) - serial->read_index = 0; - } - else - { - /* no data in rx buffer */ - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - break; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - ptr ++; size --; - } - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; - } - else if (dev->flag & RT_DEVICE_FLAG_DMA_RX) - { - /* not support right now */ - RT_ASSERT(0); - } - else - { - /* poll mode */ - while (size) - { - /* Wait for Full Rx Buffer */ - while (!(serial->hw_base->US_CSR & AT91C_US_RXRDY)); - - /* Read Character */ - *ptr = serial->hw_base->US_RHR; - ptr ++; - size --; - } - - return (rt_size_t)ptr - (rt_size_t)buffer; - } - - return 0; + rt_uint8_t* ptr; + struct rt_at91serial *serial = (struct rt_at91serial*)dev; + RT_ASSERT(serial != RT_NULL); + + /* point to buffer */ + ptr = (rt_uint8_t*) buffer; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + while (size) + { + /* interrupt receive */ + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + if (serial->read_index != serial->save_index) + { + *ptr = serial->rx_buffer[serial->read_index]; + + serial->read_index ++; + if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) + serial->read_index = 0; + } + else + { + /* no data in rx buffer */ + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + break; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + ptr ++; size --; + } + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + } + else if (dev->flag & RT_DEVICE_FLAG_DMA_RX) + { + /* not support right now */ + RT_ASSERT(0); + } + else + { + /* poll mode */ + while (size) + { + /* Wait for Full Rx Buffer */ + while (!(serial->hw_base->US_CSR & AT91C_US_RXRDY)); + + /* Read Character */ + *ptr = serial->hw_base->US_RHR; + ptr ++; + size --; + } + + return (rt_size_t)ptr - (rt_size_t)buffer; + } + + return 0; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - struct rt_at91serial *serial = (struct rt_at91serial*)dev; - RT_ASSERT(serial != RT_NULL); - - ptr = (rt_uint8_t*) buffer; - if (dev->open_flag & RT_DEVICE_OFLAG_WRONLY) - { - if (dev->flag & RT_DEVICE_FLAG_STREAM) - { - /* it's a stream mode device */ - while (size) - { - /* stream mode */ - if (*ptr == '\n') - { - while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); - serial->hw_base->US_THR = '\r'; - } - - /* Wait for Empty Tx Buffer */ - while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); - - /* Transmit Character */ - serial->hw_base->US_THR = *ptr; - ptr ++; size --; - } - } - else - { - while (size) - { - /* Wait for Empty Tx Buffer */ - while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); - - /* Transmit Character */ - serial->hw_base->US_THR = *ptr; - ptr ++; size --; - } - } - } - - return (rt_size_t)ptr - (rt_size_t)buffer; + rt_uint8_t* ptr; + struct rt_at91serial *serial = (struct rt_at91serial*)dev; + RT_ASSERT(serial != RT_NULL); + + ptr = (rt_uint8_t*) buffer; + if (dev->open_flag & RT_DEVICE_OFLAG_WRONLY) + { + if (dev->flag & RT_DEVICE_FLAG_STREAM) + { + /* it's a stream mode device */ + while (size) + { + /* stream mode */ + if (*ptr == '\n') + { + while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); + serial->hw_base->US_THR = '\r'; + } + + /* Wait for Empty Tx Buffer */ + while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); + + /* Transmit Character */ + serial->hw_base->US_THR = *ptr; + ptr ++; size --; + } + } + else + { + while (size) + { + /* Wait for Empty Tx Buffer */ + while (!(serial->hw_base->US_CSR & AT91C_US_TXRDY)); + + /* Transmit Character */ + serial->hw_base->US_THR = *ptr; + ptr ++; size --; + } + } + } + + return (rt_size_t)ptr - (rt_size_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - return RT_EOK; + return RT_EOK; } rt_err_t rt_hw_serial_init() { - rt_device_t device; + rt_device_t device; #ifdef RT_USING_UART1 - device = (rt_device_t) &serial1; - - /* init serial device private data */ - serial1.hw_base = (struct rt_at91serial_hw*)AT91C_BASE_US0; - serial1.peripheral_id = AT91C_ID_US0; - serial1.baudrate = 115200; - - /* set device virtual interface */ - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - - /* register uart1 on device subsystem */ - rt_device_register(device, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); + device = (rt_device_t) &serial1; + + /* init serial device private data */ + serial1.hw_base = (struct rt_at91serial_hw*)AT91C_BASE_US0; + serial1.peripheral_id = AT91C_ID_US0; + serial1.baudrate = 115200; + + /* set device virtual interface */ + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + + /* register uart1 on device subsystem */ + rt_device_register(device, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); #endif #ifdef RT_USING_UART2 - device = (rt_device_t) &serial2; - - serial2.hw_base = (struct rt_at91serial_hw*)AT91C_BASE_US1; - serial2.peripheral_id = AT91C_ID_US1; - serial2.baudrate = 115200; - - /* set device virtual interface */ - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - - /* register uart2 on device subsystem */ - rt_device_register(device, "uart2", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); + device = (rt_device_t) &serial2; + + serial2.hw_base = (struct rt_at91serial_hw*)AT91C_BASE_US1; + serial2.peripheral_id = AT91C_ID_US1; + serial2.baudrate = 115200; + + /* set device virtual interface */ + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + + /* register uart2 on device subsystem */ + rt_device_register(device, "uart2", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); #endif - return RT_EOK; + return RT_EOK; } /*@}*/ diff --git a/libcpu/arm/AT91SAM7S/serial.h b/libcpu/arm/AT91SAM7S/serial.h index 0937e92f6..7766053a7 100644 --- a/libcpu/arm/AT91SAM7S/serial.h +++ b/libcpu/arm/AT91SAM7S/serial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,48 +17,48 @@ #define AT91C_BASE_US1 (0xFFFC4000) // (US1) Base Address #endif -#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* US RXRDY Interrupt */ -#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* US TXRDY Interrupt */ -#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* US Reset Receiver */ -#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* US Reset Transmitter */ -#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* US Receiver Enable */ -#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* US Receiver Disable */ -#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* US Transmitter Enable */ -#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* US Transmitter Disable */ -#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) /* US Reset Status Bits */ +#define AT91C_US_RXRDY ((unsigned int) 0x1 << 0) /* US RXRDY Interrupt */ +#define AT91C_US_TXRDY ((unsigned int) 0x1 << 1) /* US TXRDY Interrupt */ +#define AT91C_US_RSTRX ((unsigned int) 0x1 << 2) /* US Reset Receiver */ +#define AT91C_US_RSTTX ((unsigned int) 0x1 << 3) /* US Reset Transmitter */ +#define AT91C_US_RXEN ((unsigned int) 0x1 << 4) /* US Receiver Enable */ +#define AT91C_US_RXDIS ((unsigned int) 0x1 << 5) /* US Receiver Disable */ +#define AT91C_US_TXEN ((unsigned int) 0x1 << 6) /* US Transmitter Enable */ +#define AT91C_US_TXDIS ((unsigned int) 0x1 << 7) /* US Transmitter Disable */ +#define AT91C_US_RSTSTA ((unsigned int) 0x1 << 8) /* US Reset Status Bits */ -#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) /* USAR) Normal */ -#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) /* USAR) RS485 */ -#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) /* USAR) Hardware Handshaking */ -#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) /* USAR) Modem */ -#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) /* USAR) ISO7816 protocol: T = 0 */ -#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) /* USAR) ISO7816 protocol: T = 1 */ -#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) /* USAR) IrDA */ -#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) /* USAR) Software Handshaking */ +#define AT91C_US_USMODE_NORMAL ((unsigned int) 0x0) /* USAR) Normal */ +#define AT91C_US_USMODE_RS485 ((unsigned int) 0x1) /* USAR) RS485 */ +#define AT91C_US_USMODE_HWHSH ((unsigned int) 0x2) /* USAR) Hardware Handshaking */ +#define AT91C_US_USMODE_MODEM ((unsigned int) 0x3) /* USAR) Modem */ +#define AT91C_US_USMODE_ISO7816_0 ((unsigned int) 0x4) /* USAR) ISO7816 protocol: T = 0 */ +#define AT91C_US_USMODE_ISO7816_1 ((unsigned int) 0x6) /* USAR) ISO7816 protocol: T = 1 */ +#define AT91C_US_USMODE_IRDA ((unsigned int) 0x8) /* USAR) IrDA */ +#define AT91C_US_USMODE_SWHSH ((unsigned int) 0xC) /* USAR) Software Handshaking */ -#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* USAR) Clock */ -#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) /* USAR) fdiv1 */ -#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) /* USAR) slow_clock (ARM) */ -#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) /* USAR) External (SCK) */ +#define AT91C_US_CLKS_CLOCK ((unsigned int) 0x0 << 4) /* USAR) Clock */ +#define AT91C_US_CLKS_FDIV1 ((unsigned int) 0x1 << 4) /* USAR) fdiv1 */ +#define AT91C_US_CLKS_SLOW ((unsigned int) 0x2 << 4) /* USAR) slow_clock (ARM) */ +#define AT91C_US_CLKS_EXT ((unsigned int) 0x3 << 4) /* USAR) External (SCK) */ -#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) /* USAR) Character Length: 5 bits */ -#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) /* USAR) Character Length: 6 bits */ -#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) /* USAR) Character Length: 7 bits */ -#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* USAR) Character Length: 8 bits */ +#define AT91C_US_CHRL_5_BITS ((unsigned int) 0x0 << 6) /* USAR) Character Length: 5 bits */ +#define AT91C_US_CHRL_6_BITS ((unsigned int) 0x1 << 6) /* USAR) Character Length: 6 bits */ +#define AT91C_US_CHRL_7_BITS ((unsigned int) 0x2 << 6) /* USAR) Character Length: 7 bits */ +#define AT91C_US_CHRL_8_BITS ((unsigned int) 0x3 << 6) /* USAR) Character Length: 8 bits */ -#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) /* DBGU Even Parity */ -#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) /* DBGU Odd Parity */ -#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) /* DBGU Parity forced to 0 (Space) */ -#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) /* DBGU Parity forced to 1 (Mark) */ -#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* DBGU No Parity */ -#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) /* DBGU Multi-drop mode */ +#define AT91C_US_PAR_EVEN ((unsigned int) 0x0 << 9) /* DBGU Even Parity */ +#define AT91C_US_PAR_ODD ((unsigned int) 0x1 << 9) /* DBGU Odd Parity */ +#define AT91C_US_PAR_SPACE ((unsigned int) 0x2 << 9) /* DBGU Parity forced to 0 (Space) */ +#define AT91C_US_PAR_MARK ((unsigned int) 0x3 << 9) /* DBGU Parity forced to 1 (Mark) */ +#define AT91C_US_PAR_NONE ((unsigned int) 0x4 << 9) /* DBGU No Parity */ +#define AT91C_US_PAR_MULTI_DROP ((unsigned int) 0x6 << 9) /* DBGU Multi-drop mode */ -#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* USART 1 stop bit */ -#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) /* USART Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits */ -#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) /* USART 2 stop bits */ +#define AT91C_US_NBSTOP_1_BIT ((unsigned int) 0x0 << 12) /* USART 1 stop bit */ +#define AT91C_US_NBSTOP_15_BIT ((unsigned int) 0x1 << 12) /* USART Asynchronous (SYNC=0) 2 stop bits Synchronous (SYNC=1) 2 stop bits */ +#define AT91C_US_NBSTOP_2_BIT ((unsigned int) 0x2 << 12) /* USART 2 stop bits */ -#define MCK 48054857 -#define BR 115200 /* Baud Rate */ -#define BRD (MCK/16/BR) /* Baud Rate Divisor */ +#define MCK 48054857 +#define BR 115200 /* Baud Rate */ +#define BRD (MCK/16/BR) /* Baud Rate Divisor */ #endif diff --git a/libcpu/arm/AT91SAM7S/stack.c b/libcpu/arm/AT91SAM7S/stack.c index 6f8bd13bf..23fce8e6e 100644 --- a/libcpu/arm/AT91SAM7S/stack.c +++ b/libcpu/arm/AT91SAM7S/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/AT91SAM7S/trap.c b/libcpu/arm/AT91SAM7S/trap.c index 208e56895..aa9df7c74 100644 --- a/libcpu/arm/AT91SAM7S/trap.c +++ b/libcpu/arm/AT91SAM7S/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,12 +20,12 @@ void rt_hw_trap_irq() { - rt_isr_handler_t hander = (rt_isr_handler_t)AT91C_AIC_IVR; + rt_isr_handler_t hander = (rt_isr_handler_t)AT91C_AIC_IVR; - hander(AT91C_AIC_ISR); + hander(AT91C_AIC_ISR); - /* end of interrupt */ - AT91C_AIC_EOICR = 0; + /* end of interrupt */ + AT91C_AIC_EOICR = 0; } void rt_hw_trap_fiq() diff --git a/libcpu/arm/AT91SAM7X/cpu.c b/libcpu/arm/AT91SAM7X/cpu.c index 484c19d10..7c950dab7 100644 --- a/libcpu/arm/AT91SAM7X/cpu.c +++ b/libcpu/arm/AT91SAM7X/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,9 +30,9 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } /*@}*/ diff --git a/libcpu/arm/AT91SAM7X/interrupt.c b/libcpu/arm/AT91SAM7X/interrupt.c index 0c37f63ad..3a28f507c 100644 --- a/libcpu/arm/AT91SAM7X/interrupt.c +++ b/libcpu/arm/AT91SAM7X/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,10 +13,10 @@ #include #include "AT91SAM7X256.h" -#define MAX_HANDLERS 32 +#define MAX_HANDLERS 32 /* exception and interrupt handler table */ -struct rt_irq_desc irq_desc[MAX_HANDLERS]; +struct rt_irq_desc irq_desc[MAX_HANDLERS]; extern rt_uint32_t rt_interrupt_nest; @@ -30,7 +30,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; static void rt_hw_interrupt_handler(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -38,7 +38,7 @@ static void rt_hw_interrupt_handler(int vector, void *param) */ void rt_hw_interrupt_init(void) { - rt_base_t index; + rt_base_t index; /* init exceptions table */ for(index=0; index < MAX_HANDLERS; index++) @@ -47,16 +47,16 @@ void rt_hw_interrupt_init(void) irq_desc[index].param = RT_NULL; } - for (index = 0; index < MAX_HANDLERS; index ++) - { - AT91C_BASE_AIC->AIC_SVR[index] = (rt_uint32_t)rt_hw_interrupt_handler; - } + for (index = 0; index < MAX_HANDLERS; index ++) + { + AT91C_BASE_AIC->AIC_SVR[index] = (rt_uint32_t)rt_hw_interrupt_handler; + } - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } /** @@ -65,11 +65,11 @@ void rt_hw_interrupt_init(void) */ void rt_hw_interrupt_mask(int vector) { - /* disable interrupt */ - AT91C_BASE_AIC->AIC_IDCR = 1 << vector; + /* disable interrupt */ + AT91C_BASE_AIC->AIC_IDCR = 1 << vector; - /* clear interrupt */ - AT91C_BASE_AIC->AIC_ICCR = 1 << vector; + /* clear interrupt */ + AT91C_BASE_AIC->AIC_ICCR = 1 << vector; } /** @@ -78,7 +78,7 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - AT91C_BASE_AIC->AIC_IECR = 1 << vector; + AT91C_BASE_AIC->AIC_IECR = 1 << vector; } /** @@ -90,21 +90,21 @@ void rt_hw_interrupt_umask(int vector) * * @return the old handler */ -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) +rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, + void *param, const char *name) { - rt_isr_handler_t old_handler = RT_NULL; - if(vector >= 0 && vector < MAX_HANDLERS) - { - old_handler = irq_desc[vector].handler; - if (handler != RT_NULL) - { - irq_desc[vector].handler = (rt_isr_handler_t)handler; - irq_desc[vector].param = param; - } - } - - return old_handler; + rt_isr_handler_t old_handler = RT_NULL; + if(vector >= 0 && vector < MAX_HANDLERS) + { + old_handler = irq_desc[vector].handler; + if (handler != RT_NULL) + { + irq_desc[vector].handler = (rt_isr_handler_t)handler; + irq_desc[vector].param = param; + } + } + + return old_handler; } /*@}*/ diff --git a/libcpu/arm/AT91SAM7X/stack.c b/libcpu/arm/AT91SAM7X/stack.c index ef60b1a76..caa482601 100644 --- a/libcpu/arm/AT91SAM7X/stack.c +++ b/libcpu/arm/AT91SAM7X/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/AT91SAM7X/trap.c b/libcpu/arm/AT91SAM7X/trap.c index 1c1c351ff..3c012dd85 100644 --- a/libcpu/arm/AT91SAM7X/trap.c +++ b/libcpu/arm/AT91SAM7X/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,17 +20,17 @@ void rt_hw_trap_irq(void) { - int irqno; - extern struct rt_irq_desc irq_desc[]; + int irqno; + extern struct rt_irq_desc irq_desc[]; - /* get interrupt number */ - irqno = AT91C_BASE_AIC->AIC_ISR; + /* get interrupt number */ + irqno = AT91C_BASE_AIC->AIC_ISR; - /* invoke isr with parameters */ - irq_desc[irqno].handler(irqno, irq_desc[irqno].param); + /* invoke isr with parameters */ + irq_desc[irqno].handler(irqno, irq_desc[irqno].param); - /* end of interrupt */ - AT91C_BASE_AIC->AIC_EOICR = 0; + /* end of interrupt */ + AT91C_BASE_AIC->AIC_EOICR = 0; } void rt_hw_trap_fiq(void) @@ -41,9 +41,9 @@ void rt_hw_trap_fiq(void) extern struct rt_thread* rt_current_thread; void rt_hw_trap_abort(void) { - rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name); - rt_thread_suspend(rt_current_thread); - rt_schedule(); + rt_kprintf("Abort occured!!! Thread [%s] suspended.\n",rt_current_thread->name); + rt_thread_suspend(rt_current_thread); + rt_schedule(); } /*@}*/ diff --git a/libcpu/arm/am335x/am33xx.h b/libcpu/arm/am335x/am33xx.h index 99a65ac91..3112a8ac1 100644 --- a/libcpu/arm/am335x/am33xx.h +++ b/libcpu/arm/am335x/am33xx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -9,8 +9,8 @@ #ifndef __AM33XX_H__ #define __AM33XX_H__ -#define REG32(x) (*((volatile unsigned int *)(x))) -#define REG16(x) (*((volatile unsigned short *)(x))) +#define REG32(x) (*((volatile unsigned int *)(x))) +#define REG16(x) (*((volatile unsigned short *)(x))) /** Cache Line size in ARM Cortex-A8. */ #define AM33XX_CACHELINE_SIZE (64) @@ -198,22 +198,22 @@ #define CM_DPLL_CLKSEL_TIMER2_CLK(base) REG32(CM_DPLL(base) + 0x8) /* timer registers */ -#define DMTIMER_TIDR(base) REG32(base + 0x0) -#define DMTIMER_TIOCP_CFG(base) REG32(base + 0x10) -#define DMTIMER_IRQ_EOI(base) REG32(base + 0x20) -#define DMTIMER_IRQSTATUS_RAW(base) REG32(base + 0x24) -#define DMTIMER_IRQSTATUS(base) REG32(base + 0x28) -#define DMTIMER_IRQENABLE_SET(base) REG32(base + 0x2C) -#define DMTIMER_IRQENABLE_CLR(base) REG32(base + 0x30) -#define DMTIMER_IRQWAKEEN(base) REG32(base + 0x34) -#define DMTIMER_TCLR(base) REG32(base + 0x38) -#define DMTIMER_TCRR(base) REG32(base + 0x3C) -#define DMTIMER_TLDR(base) REG32(base + 0x40) -#define DMTIMER_TTGR(base) REG32(base + 0x44) -#define DMTIMER_TWPS(base) REG32(base + 0x48) -#define DMTIMER_TMAR(base) REG32(base + 0x4C) -#define DMTIMER_TCAR(base, n) REG32(base + 0x50 + (((n) - 1) * 8)) -#define DMTIMER_TSICR(base) REG32(base + 0x54) +#define DMTIMER_TIDR(base) REG32(base + 0x0) +#define DMTIMER_TIOCP_CFG(base) REG32(base + 0x10) +#define DMTIMER_IRQ_EOI(base) REG32(base + 0x20) +#define DMTIMER_IRQSTATUS_RAW(base) REG32(base + 0x24) +#define DMTIMER_IRQSTATUS(base) REG32(base + 0x28) +#define DMTIMER_IRQENABLE_SET(base) REG32(base + 0x2C) +#define DMTIMER_IRQENABLE_CLR(base) REG32(base + 0x30) +#define DMTIMER_IRQWAKEEN(base) REG32(base + 0x34) +#define DMTIMER_TCLR(base) REG32(base + 0x38) +#define DMTIMER_TCRR(base) REG32(base + 0x3C) +#define DMTIMER_TLDR(base) REG32(base + 0x40) +#define DMTIMER_TTGR(base) REG32(base + 0x44) +#define DMTIMER_TWPS(base) REG32(base + 0x48) +#define DMTIMER_TMAR(base) REG32(base + 0x4C) +#define DMTIMER_TCAR(base, n) REG32(base + 0x50 + (((n) - 1) * 8)) +#define DMTIMER_TSICR(base) REG32(base + 0x54) #define EMU_INT 0 #define COMMTX_INT 1 @@ -317,33 +317,33 @@ struct rt_hw_register { - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; - unsigned long ORIG_r0; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long sp; + unsigned long lr; + unsigned long pc; + unsigned long cpsr; + unsigned long ORIG_r0; }; -#define USERMODE 0x10 -#define FIQMODE 0x11 -#define IRQMODE 0x12 -#define SVCMODE 0x13 -#define ABORTMODE 0x17 -#define UNDEFMODE 0x1b -#define MODEMASK 0x1f -#define NOINT 0xc0 +#define USERMODE 0x10 +#define FIQMODE 0x11 +#define IRQMODE 0x12 +#define SVCMODE 0x13 +#define ABORTMODE 0x17 +#define UNDEFMODE 0x1b +#define MODEMASK 0x1f +#define NOINT 0xc0 #endif diff --git a/libcpu/arm/am335x/context_iar.S b/libcpu/arm/am335x/context_iar.S index c53e15a23..1266d8cf7 100644 --- a/libcpu/arm/am335x/context_iar.S +++ b/libcpu/arm/am335x/context_iar.S @@ -1,21 +1,7 @@ ;/* -; * File : context_iar.S -; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2006, RT-Thread Development Team +; * Copyright (c) 2006-2021, RT-Thread Development Team ; * -; * This program is free software; you can redistribute it and/or modify -; * it under the terms of the GNU General Public License as published by -; * the Free Software Foundation; either version 2 of the License, or -; * (at your option) any later version. -; * -; * This program is distributed in the hope that it will be useful, -; * but WITHOUT ANY WARRANTY; without even the implied warranty of -; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; * GNU General Public License for more details. -; * -; * You should have received a copy of the GNU General Public License along -; * with this program; if not, write to the Free Software Foundation, Inc., -; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +; * SPDX-License-Identifier: Apache-2.0 ; * ; * Change Logs: ; * Date Author Notes diff --git a/libcpu/arm/am335x/cpu.c b/libcpu/arm/am335x/cpu.c index cae865fe5..284e2ea26 100644 --- a/libcpu/arm/am335x/cpu.c +++ b/libcpu/arm/am335x/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,74 +17,74 @@ */ /*@{*/ -#define ICACHE_MASK (rt_uint32_t)(1 << 12) -#define DCACHE_MASK (rt_uint32_t)(1 << 2) +#define ICACHE_MASK (rt_uint32_t)(1 << 12) +#define DCACHE_MASK (rt_uint32_t)(1 << 2) #if defined(__CC_ARM) rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - __asm - { - mrc p15, 0, i, c1, c0, 0 - } + __asm + { + mrc p15, 0, i, c1, c0, 0 + } - return i; + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } rt_inline void cache_disable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } #elif defined(__GNUC__) rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - return i; + asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "orr r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "orr r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } rt_inline void cache_disable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "bic r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "bic r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } #endif @@ -96,7 +96,7 @@ rt_inline void cache_disable(rt_uint32_t bit) */ void rt_hw_cpu_icache_enable() { - cache_enable(ICACHE_MASK); + cache_enable(ICACHE_MASK); } /** @@ -105,7 +105,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - cache_disable(ICACHE_MASK); + cache_disable(ICACHE_MASK); } /** @@ -114,7 +114,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return (cp15_rd() & ICACHE_MASK); + return (cp15_rd() & ICACHE_MASK); } /** @@ -123,7 +123,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - cache_enable(DCACHE_MASK); + cache_enable(DCACHE_MASK); } /** @@ -132,7 +132,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - cache_disable(DCACHE_MASK); + cache_disable(DCACHE_MASK); } /** @@ -141,7 +141,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return (cp15_rd() & DCACHE_MASK); + return (cp15_rd() & DCACHE_MASK); } #endif @@ -151,14 +151,14 @@ rt_base_t rt_hw_cpu_dcache_status() */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); - - level = rt_hw_interrupt_disable(); - while (level) - { - RT_ASSERT(0); - } + rt_uint32_t level; + rt_kprintf("shutdown...\n"); + + level = rt_hw_interrupt_disable(); + while (level) + { + RT_ASSERT(0); + } } /*@}*/ diff --git a/libcpu/arm/am335x/interrupt.c b/libcpu/arm/am335x/interrupt.c index 3acd86849..c4c5e8d7e 100644 --- a/libcpu/arm/am335x/interrupt.c +++ b/libcpu/arm/am335x/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,7 +17,7 @@ #define AINTC_BASE AM33XX_AINTC_REGS -#define MAX_HANDLERS 128 +#define MAX_HANDLERS 128 extern volatile rt_uint8_t rt_interrupt_nest; @@ -59,13 +59,13 @@ extern int system_vectors; static void rt_hw_vector_init(void) { unsigned int *dest = (unsigned int *)AM335X_VECTOR_BASE; - + #ifdef __ICCARM__ unsigned int *src = (unsigned int *)&__vector; #else unsigned int *src = (unsigned int *)&system_vectors; #endif - + rt_memcpy(dest, src, 16 * 4); rt_cpu_vector_set_base(AM335X_VECTOR_BASE); } diff --git a/libcpu/arm/am335x/interrupt.h b/libcpu/arm/am335x/interrupt.h index 7461f94da..90f392f40 100644 --- a/libcpu/arm/am335x/interrupt.h +++ b/libcpu/arm/am335x/interrupt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,28 +14,28 @@ #define INT_IRQ 0x00 #define INT_FIQ 0x01 -#define INTC_REVISION(hw_base) REG32((hw_base) + 0x0) -#define INTC_SYSCONFIG(hw_base) REG32((hw_base) + 0x10) -#define INTC_SYSSTATUS(hw_base) REG32((hw_base) + 0x14) -#define INTC_SIR_IRQ(hw_base) REG32((hw_base) + 0x40) -#define INTC_SIR_FIQ(hw_base) REG32((hw_base) + 0x44) -#define INTC_CONTROL(hw_base) REG32((hw_base) + 0x48) -#define INTC_PROTECTION(hw_base) REG32((hw_base) + 0x4c) -#define INTC_IDLE(hw_base) REG32((hw_base) + 0x50) -#define INTC_IRQ_PRIORITY(hw_base) REG32((hw_base) + 0x60) -#define INTC_FIQ_PRIORITY(hw_base) REG32((hw_base) + 0x64) -#define INTC_THRESHOLD(hw_base) REG32((hw_base) + 0x68) -#define INTC_SICR(hw_base) REG32((hw_base) + 0x6c) -#define INTC_SCR(hw_base, n) REG32((hw_base) + 0x70 + ((n) * 0x04)) -#define INTC_ITR(hw_base, n) REG32((hw_base) + 0x80 + ((n) * 0x20)) -#define INTC_MIR(hw_base, n) REG32((hw_base) + 0x84 + ((n) * 0x20)) -#define INTC_MIR_CLEAR(hw_base, n) REG32((hw_base) + 0x88 + ((n) * 0x20)) -#define INTC_MIR_SET(hw_base, n) REG32((hw_base) + 0x8c + ((n) * 0x20)) -#define INTC_ISR_SET(hw_base, n) REG32((hw_base) + 0x90 + ((n) * 0x20)) -#define INTC_ISR_CLEAR(hw_base, n) REG32((hw_base) + 0x94 + ((n) * 0x20)) +#define INTC_REVISION(hw_base) REG32((hw_base) + 0x0) +#define INTC_SYSCONFIG(hw_base) REG32((hw_base) + 0x10) +#define INTC_SYSSTATUS(hw_base) REG32((hw_base) + 0x14) +#define INTC_SIR_IRQ(hw_base) REG32((hw_base) + 0x40) +#define INTC_SIR_FIQ(hw_base) REG32((hw_base) + 0x44) +#define INTC_CONTROL(hw_base) REG32((hw_base) + 0x48) +#define INTC_PROTECTION(hw_base) REG32((hw_base) + 0x4c) +#define INTC_IDLE(hw_base) REG32((hw_base) + 0x50) +#define INTC_IRQ_PRIORITY(hw_base) REG32((hw_base) + 0x60) +#define INTC_FIQ_PRIORITY(hw_base) REG32((hw_base) + 0x64) +#define INTC_THRESHOLD(hw_base) REG32((hw_base) + 0x68) +#define INTC_SICR(hw_base) REG32((hw_base) + 0x6c) +#define INTC_SCR(hw_base, n) REG32((hw_base) + 0x70 + ((n) * 0x04)) +#define INTC_ITR(hw_base, n) REG32((hw_base) + 0x80 + ((n) * 0x20)) +#define INTC_MIR(hw_base, n) REG32((hw_base) + 0x84 + ((n) * 0x20)) +#define INTC_MIR_CLEAR(hw_base, n) REG32((hw_base) + 0x88 + ((n) * 0x20)) +#define INTC_MIR_SET(hw_base, n) REG32((hw_base) + 0x8c + ((n) * 0x20)) +#define INTC_ISR_SET(hw_base, n) REG32((hw_base) + 0x90 + ((n) * 0x20)) +#define INTC_ISR_CLEAR(hw_base, n) REG32((hw_base) + 0x94 + ((n) * 0x20)) #define INTC_PENDING_IRQ(hw_base, n) REG32((hw_base) + 0x98 + ((n) * 0x20)) #define INTC_PENDING_FIQ(hw_base, n) REG32((hw_base) + 0x9c + ((n) * 0x20)) -#define INTC_ILR(hw_base, n) REG32((hw_base) + 0x100 + ((n) * 0x04)) +#define INTC_ILR(hw_base, n) REG32((hw_base) + 0x100 + ((n) * 0x04)) void rt_hw_interrupt_control(int vector, int priority, int route); int rt_hw_interrupt_get_active(int fiq_irq); diff --git a/libcpu/arm/am335x/mmu.c b/libcpu/arm/am335x/mmu.c index babe82529..fbd886d0e 100644 --- a/libcpu/arm/am335x/mmu.c +++ b/libcpu/arm/am335x/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,122 +22,122 @@ extern void rt_cpu_tlb_set(register rt_uint32_t i); void mmu_disable_dcache() { - rt_cpu_dcache_disable(); + rt_cpu_dcache_disable(); } void mmu_enable_dcache() { - rt_hw_cpu_dcache_enable(); + rt_hw_cpu_dcache_enable(); } void mmu_disable_icache() { - rt_cpu_icache_disable(); + rt_cpu_icache_disable(); } void mmu_enable_icache() { - rt_hw_cpu_icache_enable(); + rt_hw_cpu_icache_enable(); } void mmu_disable() { - rt_cpu_mmu_disable(); + rt_cpu_mmu_disable(); } void mmu_enable() { - rt_cpu_mmu_enable(); + rt_cpu_mmu_enable(); } void mmu_setttbase(register rt_uint32_t i) { - register rt_uint32_t value; + register rt_uint32_t value; /* Invalidates all TLBs.Domain access is selected as * client by configuring domain access register, * in that case access controlled by permission value * set by page table entry */ - value = 0; - asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); + value = 0; + asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); - value = 0x55555555; - asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); - - rt_cpu_tlb_set(i); + value = 0x55555555; + asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); + + rt_cpu_tlb_set(i); } void mmu_set_domain(register rt_uint32_t i) { - asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); + asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); } void mmu_enable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 1); + i |= (1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 1); + i &= ~(1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_clean_invalidated_cache_index(int index) { - asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); + asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); } void mmu_clean_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~0x1f; + ptr = buffer & ~0x1f; - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); - ptr += 32; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); + ptr += 32; + } } void mmu_invalidate_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~0x1f; + ptr = buffer & ~0x1f; - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); - ptr += 32; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); + ptr += 32; + } } void mmu_invalidate_tlb() { - asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); } void mmu_invalidate_icache() { - asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); } /* level1 page table */ @@ -150,8 +150,8 @@ void mmu_setmtt(rt_uint32_t vaddrStart, rt_uint32_t vaddrEnd, rt_uint32_t paddrS nSec=(vaddrEnd>>20)-(vaddrStart>>20); for(i=0;i<=nSec;i++) { - *pTT = attr |(((paddrStart>>20)+i)<<20); - pTT++; + *pTT = attr |(((paddrStart>>20)+i)<<20); + pTT++; } } @@ -161,21 +161,21 @@ RT_WEAK void mmu_setmtts(void) mmu_setmtt(0x00000000, 0xFFFFFFFF, 0x00000000, RW_NCNB); /* None cached for 4G memory */ mmu_setmtt(0x80200000, 0x80800000 - 1, 0x80200000, RW_CB); /* 126M cached DDR memory */ mmu_setmtt(0x80000000, 0x80200000 - 1, 0x80000000, RW_NCNB); /* 2M none-cached DDR memory */ - mmu_setmtt(0x402F0000, 0x40300000 - 1, 0x402F0000, RW_CB); /* 63K OnChip memory */ + mmu_setmtt(0x402F0000, 0x40300000 - 1, 0x402F0000, RW_CB); /* 63K OnChip memory */ } void rt_hw_mmu_init(void) { - /* disable I/D cache */ - mmu_disable_dcache(); - mmu_disable_icache(); - mmu_disable(); - mmu_invalidate_tlb(); + /* disable I/D cache */ + mmu_disable_dcache(); + mmu_disable_icache(); + mmu_disable(); + mmu_invalidate_tlb(); mmu_setmtts(); - /* set MMU table address */ - mmu_setttbase((rt_uint32_t)_page_table); + /* set MMU table address */ + mmu_setttbase((rt_uint32_t)_page_table); /* enables MMU */ mmu_enable(); diff --git a/libcpu/arm/am335x/mmu.h b/libcpu/arm/am335x/mmu.h index 73635d3a0..706d66984 100644 --- a/libcpu/arm/am335x/mmu.h +++ b/libcpu/arm/am335x/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,27 +13,27 @@ #include -#define DESC_SEC (0x2) -#define CB (3<<2) //cache_on, write_back -#define CNB (2<<2) //cache_on, write_through -#define NCB (1<<2) //cache_off,WR_BUF on -#define NCNB (0<<2) //cache_off,WR_BUF off -#define AP_RW (3<<10) //supervisor=RW, user=RW -#define AP_RO (2<<10) //supervisor=RW, user=RO - -#define DOMAIN_FAULT (0x0) -#define DOMAIN_CHK (0x1) -#define DOMAIN_NOTCHK (0x3) -#define DOMAIN0 (0x0<<5) -#define DOMAIN1 (0x1<<5) - -#define DOMAIN0_ATTR (DOMAIN_CHK<<0) -#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) - -#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */ -#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */ -#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ -#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ +#define DESC_SEC (0x2) +#define CB (3<<2) //cache_on, write_back +#define CNB (2<<2) //cache_on, write_through +#define NCB (1<<2) //cache_off,WR_BUF on +#define NCNB (0<<2) //cache_off,WR_BUF off +#define AP_RW (3<<10) //supervisor=RW, user=RW +#define AP_RO (2<<10) //supervisor=RW, user=RO + +#define DOMAIN_FAULT (0x0) +#define DOMAIN_CHK (0x1) +#define DOMAIN_NOTCHK (0x3) +#define DOMAIN0 (0x0<<5) +#define DOMAIN1 (0x1<<5) + +#define DOMAIN0_ATTR (DOMAIN_CHK<<0) +#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) + +#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */ +#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */ +#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ +#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ void rt_hw_mmu_init(void); diff --git a/libcpu/arm/am335x/stack.c b/libcpu/arm/am335x/stack.c index 1dad93081..db3cb37e7 100644 --- a/libcpu/arm/am335x/stack.c +++ b/libcpu/arm/am335x/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/am335x/trap.c b/libcpu/arm/am335x/trap.c index b77543da6..7c73ce93d 100644 --- a/libcpu/arm/am335x/trap.c +++ b/libcpu/arm/am335x/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -36,13 +36,13 @@ extern long list_thread(void); void rt_hw_show_register (struct rt_hw_register *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -62,15 +62,15 @@ void rt_hw_trap_udef(struct rt_hw_register *regs) return; #endif - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("undefined instruction\n"); - rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); + rt_kprintf("undefined instruction\n"); + rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -84,10 +84,10 @@ void rt_hw_trap_udef(struct rt_hw_register *regs) */ void rt_hw_trap_swi(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("software interrupt\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("software interrupt\n"); + rt_hw_cpu_shutdown(); } /** @@ -100,15 +100,15 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) */ void rt_hw_trap_pabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("prefetch abort\n"); - rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); + rt_kprintf("prefetch abort\n"); + rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -124,29 +124,29 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs) #ifdef RT_USING_GDB if (gdb_mem_fault_handler) { - regs->pc = (unsigned long)gdb_mem_fault_handler; + regs->pc = (unsigned long)gdb_mem_fault_handler; return; } #endif - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("data abort\n"); - rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); + rt_kprintf("data abort\n"); + rt_kprintf("thread %.*s stack:\n", RT_NAME_MAX, rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } void rt_hw_trap_irq() { void *param; - unsigned long ir; + unsigned long ir; rt_isr_handler_t isr_func; extern struct rt_irq_desc isr_table[]; - ir = rt_hw_interrupt_get_active(INT_IRQ); + ir = rt_hw_interrupt_get_active(INT_IRQ); if (ir == 127) { /* new IRQ generation */ @@ -169,18 +169,18 @@ void rt_hw_trap_irq() if (isr_func != RT_NULL) isr_func(ir, param); - /* new IRQ generation */ + /* new IRQ generation */ rt_hw_interrupt_ack(INT_IRQ); } void rt_hw_trap_fiq() { void *param; - unsigned long ir; + unsigned long ir; rt_isr_handler_t isr_func; extern struct rt_irq_desc isr_table[]; - ir = rt_hw_interrupt_get_active(INT_FIQ); + ir = rt_hw_interrupt_get_active(INT_FIQ); /* get interrupt service routine */ isr_func = isr_table[ir].handler; @@ -189,7 +189,7 @@ void rt_hw_trap_fiq() /* turn to interrupt service routine */ isr_func(ir, param); - /* new FIQ generation */ + /* new FIQ generation */ rt_hw_interrupt_ack(INT_FIQ); } diff --git a/libcpu/arm/arm926/cpuport.c b/libcpu/arm/arm926/cpuport.c index 035e97d54..603c80f2d 100644 --- a/libcpu/arm/arm926/cpuport.c +++ b/libcpu/arm/arm926/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/arm926/machine.c b/libcpu/arm/arm926/machine.c index aa26d10ec..19baa4d9f 100644 --- a/libcpu/arm/arm926/machine.c +++ b/libcpu/arm/arm926/machine.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/arm926/mmu.c b/libcpu/arm/arm926/mmu.c index 19d70b9b0..50ada17f2 100644 --- a/libcpu/arm/arm926/mmu.c +++ b/libcpu/arm/arm926/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/arm926/mmu.h b/libcpu/arm/arm926/mmu.h index 36fdbeacd..ecd39d4ed 100644 --- a/libcpu/arm/arm926/mmu.h +++ b/libcpu/arm/arm926/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/arm926/stack.c b/libcpu/arm/arm926/stack.c index f90bfa8c2..caf16c41b 100644 --- a/libcpu/arm/arm926/stack.c +++ b/libcpu/arm/arm926/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/arm926/trap.c b/libcpu/arm/arm926/trap.c index 9e7ba4803..c364b2add 100644 --- a/libcpu/arm/arm926/trap.c +++ b/libcpu/arm/arm926/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/armv6/armv6.h b/libcpu/arm/armv6/armv6.h index 659ce9072..522c35845 100644 --- a/libcpu/arm/armv6/armv6.h +++ b/libcpu/arm/armv6/armv6.h @@ -1,12 +1,12 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes */ - + #ifndef __ARMV6_H__ #define __ARMV6_H__ @@ -26,7 +26,7 @@ #ifndef __ASSEMBLY__ struct rt_hw_register { - rt_uint32_t cpsr; + rt_uint32_t cpsr; rt_uint32_t r0; rt_uint32_t r1; rt_uint32_t r2; @@ -46,24 +46,24 @@ struct rt_hw_register }; #if(0) struct rt_hw_register{ - rt_uint32_t r0; - rt_uint32_t r1; - rt_uint32_t r2; - rt_uint32_t r3; - rt_uint32_t r4; - rt_uint32_t r5; - rt_uint32_t r6; - rt_uint32_t r7; - rt_uint32_t r8; - rt_uint32_t r9; - rt_uint32_t r10; - rt_uint32_t fp; - rt_uint32_t ip; - rt_uint32_t sp; - rt_uint32_t lr; - rt_uint32_t pc; - rt_uint32_t cpsr; - rt_uint32_t ORIG_r0; + rt_uint32_t r0; + rt_uint32_t r1; + rt_uint32_t r2; + rt_uint32_t r3; + rt_uint32_t r4; + rt_uint32_t r5; + rt_uint32_t r6; + rt_uint32_t r7; + rt_uint32_t r8; + rt_uint32_t r9; + rt_uint32_t r10; + rt_uint32_t fp; + rt_uint32_t ip; + rt_uint32_t sp; + rt_uint32_t lr; + rt_uint32_t pc; + rt_uint32_t cpsr; + rt_uint32_t ORIG_r0; }; #endif #endif diff --git a/libcpu/arm/armv6/cpuport.c b/libcpu/arm/armv6/cpuport.c index c8e920172..eda87225d 100644 --- a/libcpu/arm/armv6/cpuport.c +++ b/libcpu/arm/armv6/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,8 +11,8 @@ #include #include -#define ICACHE_MASK (rt_uint32_t)(1 << 12) -#define DCACHE_MASK (rt_uint32_t)(1 << 2) +#define ICACHE_MASK (rt_uint32_t)(1 << 12) +#define DCACHE_MASK (rt_uint32_t)(1 << 2) extern void machine_reset(void); extern void machine_shutdown(void); @@ -20,32 +20,32 @@ extern void machine_shutdown(void); #ifdef __GNUC__ rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - return i; + asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "orr r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "orr r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } rt_inline void cache_disable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "bic r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "bic r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } @@ -54,38 +54,38 @@ rt_inline void cache_disable(rt_uint32_t bit) #ifdef __CC_ARM rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - __asm - { - mrc p15, 0, i, c1, c0, 0 - } + __asm + { + mrc p15, 0, i, c1, c0, 0 + } - return i; + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - rt_uint32_t value; + rt_uint32_t value; - __asm - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + __asm + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } rt_inline void cache_disable(rt_uint32_t bit) { - rt_uint32_t value; + rt_uint32_t value; - __asm - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + __asm + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } #endif @@ -95,7 +95,7 @@ rt_inline void cache_disable(rt_uint32_t bit) */ void rt_hw_cpu_icache_enable() { - cache_enable(ICACHE_MASK); + cache_enable(ICACHE_MASK); } /** @@ -104,7 +104,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - cache_disable(ICACHE_MASK); + cache_disable(ICACHE_MASK); } /** @@ -113,7 +113,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return (cp15_rd() & ICACHE_MASK); + return (cp15_rd() & ICACHE_MASK); } /** @@ -122,7 +122,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - cache_enable(DCACHE_MASK); + cache_enable(DCACHE_MASK); } /** @@ -131,7 +131,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - cache_disable(DCACHE_MASK); + cache_disable(DCACHE_MASK); } /** @@ -140,7 +140,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return (cp15_rd() & DCACHE_MASK); + return (cp15_rd() & DCACHE_MASK); } /** @@ -149,13 +149,13 @@ rt_base_t rt_hw_cpu_dcache_status() */ void rt_hw_cpu_reset() { - - rt_kprintf("Restarting system...\n"); - machine_reset(); - while(1); /* loop forever and wait for reset to happen */ + rt_kprintf("Restarting system...\n"); + machine_reset(); - /* NEVER REACHED */ + while(1); /* loop forever and wait for reset to happen */ + + /* NEVER REACHED */ } /** @@ -164,67 +164,67 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); + rt_uint32_t level; + rt_kprintf("shutdown...\n"); - level = rt_hw_interrupt_disable(); - machine_shutdown(); - while (level) - { - RT_ASSERT(0); - } + level = rt_hw_interrupt_disable(); + machine_shutdown(); + while (level) + { + RT_ASSERT(0); + } } #ifdef RT_USING_CPU_FFS /** - * This function finds the first bit set (beginning with the least significant bit) + * This function finds the first bit set (beginning with the least significant bit) * in value and return the index of that bit. * - * Bits are numbered starting at 1 (the least significant bit). A return value of + * Bits are numbered starting at 1 (the least significant bit). A return value of * zero from any of these functions means that the argument was zero. - * - * @return return the index of the first bit set. If value is 0, then this function + * + * @return return the index of the first bit set. If value is 0, then this function * shall return 0. */ #if defined(__CC_ARM) int __rt_ffs(int value) { - register rt_uint32_t x; + register rt_uint32_t x; + + if (value == 0) + return value; - if (value == 0) - return value; - - __asm - { - rsb x, value, #0 - and x, x, value - clz x, x - rsb x, x, #32 - } + __asm + { + rsb x, value, #0 + and x, x, value + clz x, x + rsb x, x, #32 + } - return x; + return x; } #elif defined(__IAR_SYSTEMS_ICC__) int __rt_ffs(int value) { - if (value == 0) - return value; + if (value == 0) + return value; - __ASM("RSB r4, r0, #0"); - __ASM("AND r4, r4, r0"); - __ASM("CLZ r4, r4"); - __ASM("RSB r0, r4, #32"); + __ASM("RSB r4, r0, #0"); + __ASM("AND r4, r4, r0"); + __ASM("CLZ r4, r4"); + __ASM("RSB r0, r4, #32"); } #elif defined(__GNUC__) int __rt_ffs(int value) { - if (value == 0) - return value; + if (value == 0) + return value; - value &= (-value); - asm ("clz %0, %1": "=r"(value) :"r"(value)); + value &= (-value); + asm ("clz %0, %1": "=r"(value) :"r"(value)); - return (32 - value); + return (32 - value); } #endif diff --git a/libcpu/arm/armv6/mmu.c b/libcpu/arm/armv6/mmu.c index ae3cf7355..deb2f8365 100644 --- a/libcpu/arm/armv6/mmu.c +++ b/libcpu/arm/armv6/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,411 +12,411 @@ #ifdef __CC_ARM void mmu_setttbase(rt_uint32_t i) { - register rt_uint32_t value; + register rt_uint32_t value; - /* Invalidates all TLBs.Domain access is selected as - * client by configuring domain access register, - * in that case access controlled by permission value - * set by page table entry - */ - value = 0; - __asm volatile - { - mcr p15, 0, value, c8, c7, 0 - } + /* Invalidates all TLBs.Domain access is selected as + * client by configuring domain access register, + * in that case access controlled by permission value + * set by page table entry + */ + value = 0; + __asm volatile + { + mcr p15, 0, value, c8, c7, 0 + } - value = 0x55555555; - __asm volatile - { - mcr p15, 0, value, c3, c0, 0 - mcr p15, 0, i, c2, c0, 0 - } + value = 0x55555555; + __asm volatile + { + mcr p15, 0, value, c3, c0, 0 + mcr p15, 0, i, c2, c0, 0 + } } void mmu_set_domain(rt_uint32_t i) { - __asm volatile - { - mcr p15,0, i, c3, c0, 0 - } + __asm volatile + { + mcr p15,0, i, c3, c0, 0 + } } void mmu_enable() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, #0x01 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, #0x01 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_disable() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, #0x01 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, #0x01 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_enable_icache() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, #0x1000 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, #0x1000 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_enable_dcache() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, #0x04 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, #0x04 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_disable_icache() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, #0x1000 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, #0x1000 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_disable_dcache() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, #0x04 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, #0x04 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_enable_alignfault() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, #0x02 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, #0x02 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_disable_alignfault() { - register rt_uint32_t value; + register rt_uint32_t value; - __asm volatile - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, #0x02 - mcr p15, 0, value, c1, c0, 0 - } + __asm volatile + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, #0x02 + mcr p15, 0, value, c1, c0, 0 + } } void mmu_clean_invalidated_cache_index(int index) { - __asm volatile - { - mcr p15, 0, index, c7, c14, 2 - } + __asm volatile + { + mcr p15, 0, index, c7, c14, 2 + } } void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while(ptr < buffer + size) - { - __asm volatile - { - MCR p15, 0, ptr, c7, c14, 1 - } - ptr += CACHE_LINE_SIZE; - } + while(ptr < buffer + size) + { + __asm volatile + { + MCR p15, 0, ptr, c7, c14, 1 + } + ptr += CACHE_LINE_SIZE; + } } void mmu_clean_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - __asm volatile - { - MCR p15, 0, ptr, c7, c10, 1 - } - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + __asm volatile + { + MCR p15, 0, ptr, c7, c10, 1 + } + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - __asm volatile - { - MCR p15, 0, ptr, c7, c6, 1 - } - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + __asm volatile + { + MCR p15, 0, ptr, c7, c6, 1 + } + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_tlb() { - register rt_uint32_t value; + register rt_uint32_t value; - value = 0; - __asm volatile - { - mcr p15, 0, value, c8, c7, 0 - } + value = 0; + __asm volatile + { + mcr p15, 0, value, c8, c7, 0 + } } void mmu_invalidate_icache() { - register rt_uint32_t value; + register rt_uint32_t value; - value = 0; + value = 0; - __asm volatile - { - mcr p15, 0, value, c7, c5, 0 - } + __asm volatile + { + mcr p15, 0, value, c7, c5, 0 + } } void mmu_invalidate_dcache_all() { - register rt_uint32_t value; + register rt_uint32_t value; - value = 0; + value = 0; - __asm volatile - { - mcr p15, 0, value, c7, c6, 0 - } + __asm volatile + { + mcr p15, 0, value, c7, c6, 0 + } } #elif defined(__GNUC__) void mmu_setttbase(register rt_uint32_t i) { - register rt_uint32_t value; + register rt_uint32_t value; - /* Invalidates all TLBs.Domain access is selected as - * client by configuring domain access register, - * in that case access controlled by permission value - * set by page table entry - */ - value = 0; - asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); + /* Invalidates all TLBs.Domain access is selected as + * client by configuring domain access register, + * in that case access controlled by permission value + * set by page table entry + */ + value = 0; + asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); - value = 0x55555555; - asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); - asm volatile ("mcr p15, 0, %0, c2, c0, 0"::"r"(i)); + value = 0x55555555; + asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); + asm volatile ("mcr p15, 0, %0, c2, c0, 0"::"r"(i)); } void mmu_set_domain(register rt_uint32_t i) { - asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); + asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); } void mmu_enable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= 0x1; - /* Enables the extended page tables to be configured for - the hardware page translation mechanism, Subpage AP bits disabled */ - i |= (1 << 23); /* support for ARMv6 MMU features */ - i |= (1 << 13); /* High exception vectors selected, address range = 0xFFFF0000-0xFFFF001C */ + i |= 0x1; + /* Enables the extended page tables to be configured for + the hardware page translation mechanism, Subpage AP bits disabled */ + i |= (1 << 23); /* support for ARMv6 MMU features */ + i |= (1 << 13); /* High exception vectors selected, address range = 0xFFFF0000-0xFFFF001C */ - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~0x1; + i &= ~0x1; - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 12); + i |= (1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 2); + i |= (1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 12); + i &= ~(1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 2); + i &= ~(1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 1); + i |= (1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 1); + i &= ~(1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_clean_invalidated_cache_index(int index) { - asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); + asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); } void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while(ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c14, 1": :"r" (ptr)); - ptr += CACHE_LINE_SIZE; - } + while(ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c14, 1": :"r" (ptr)); + ptr += CACHE_LINE_SIZE; + } } void mmu_clean_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_tlb() { - asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); } void mmu_invalidate_icache() { - asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); } void mmu_invalidate_dcache_all() { - asm volatile ("mcr p15, 0, %0, c7, c6, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c7, c6, 0": :"r" (0)); } #endif @@ -426,123 +426,123 @@ static volatile unsigned int _pgd_table[4*1024] ALIGN(16*1024); * level2 page table * RT_MMU_PTE_SIZE must be 1024*n */ -#define RT_MMU_PTE_SIZE 4096 +#define RT_MMU_PTE_SIZE 4096 static volatile unsigned int _pte_table[RT_MMU_PTE_SIZE] ALIGN(1*1024); void mmu_create_pgd(struct mem_desc *mdesc) { - volatile rt_uint32_t *pTT; - volatile int i, nSec; - pTT = (rt_uint32_t *)_pgd_table + (mdesc->vaddr_start >> 20); - nSec = (mdesc->vaddr_end >> 20) - (mdesc->vaddr_start >> 20); - for(i = 0; i <= nSec; i++) - { - *pTT = mdesc->sect_attr | (((mdesc->paddr_start >> 20) + i) << 20); - pTT++; - } + volatile rt_uint32_t *pTT; + volatile int i, nSec; + pTT = (rt_uint32_t *)_pgd_table + (mdesc->vaddr_start >> 20); + nSec = (mdesc->vaddr_end >> 20) - (mdesc->vaddr_start >> 20); + for(i = 0; i <= nSec; i++) + { + *pTT = mdesc->sect_attr | (((mdesc->paddr_start >> 20) + i) << 20); + pTT++; + } } void mmu_create_pte(struct mem_desc *mdesc) { - volatile rt_uint32_t *pTT; - volatile rt_uint32_t *p_pteentry; - int i; - rt_uint32_t vaddr; - rt_uint32_t total_page = 0; - rt_uint32_t pte_offset = 0; - rt_uint32_t sect_attr = 0; - - total_page = (mdesc->vaddr_end >> 12) - (mdesc->vaddr_start >> 12) + 1; - pte_offset = mdesc->sect_attr & 0xfffffc00; - sect_attr = mdesc->sect_attr & 0x3ff; - vaddr = mdesc->vaddr_start; - - for(i = 0; i < total_page; i++) - { - pTT = (rt_uint32_t *)_pgd_table + (vaddr >> 20); - if (*pTT == 0) /* Level 1 page table item not used, now update pgd item */ - { - *pTT = pte_offset | sect_attr; - p_pteentry = (rt_uint32_t *)pte_offset + - ((vaddr & 0x000ff000) >> 12); - pte_offset += 1024; - } - else /* using old Level 1 page table item */ - { - p_pteentry = (rt_uint32_t *)(*pTT & 0xfffffc00) + - ((vaddr & 0x000ff000) >> 12); - } - - - *p_pteentry = mdesc->page_attr | (((mdesc->paddr_start >> 12) + i) << 12); - vaddr += 0x1000; - } + volatile rt_uint32_t *pTT; + volatile rt_uint32_t *p_pteentry; + int i; + rt_uint32_t vaddr; + rt_uint32_t total_page = 0; + rt_uint32_t pte_offset = 0; + rt_uint32_t sect_attr = 0; + + total_page = (mdesc->vaddr_end >> 12) - (mdesc->vaddr_start >> 12) + 1; + pte_offset = mdesc->sect_attr & 0xfffffc00; + sect_attr = mdesc->sect_attr & 0x3ff; + vaddr = mdesc->vaddr_start; + + for(i = 0; i < total_page; i++) + { + pTT = (rt_uint32_t *)_pgd_table + (vaddr >> 20); + if (*pTT == 0) /* Level 1 page table item not used, now update pgd item */ + { + *pTT = pte_offset | sect_attr; + p_pteentry = (rt_uint32_t *)pte_offset + + ((vaddr & 0x000ff000) >> 12); + pte_offset += 1024; + } + else /* using old Level 1 page table item */ + { + p_pteentry = (rt_uint32_t *)(*pTT & 0xfffffc00) + + ((vaddr & 0x000ff000) >> 12); + } + + + *p_pteentry = mdesc->page_attr | (((mdesc->paddr_start >> 12) + i) << 12); + vaddr += 0x1000; + } } static void build_pte_mem_desc(struct mem_desc *mdesc, rt_uint32_t size) { - rt_uint32_t pte_offset = 0; - rt_uint32_t nsec = 0; - /* set page table */ - for (; size > 0; size--) - { - if (mdesc->mapped_mode == PAGE_MAPPED) - { - nsec = (RT_ALIGN(mdesc->vaddr_end, 0x100000) - RT_ALIGN_DOWN(mdesc->vaddr_start, 0x100000)) >> 20; - mdesc->sect_attr |= (((rt_uint32_t)_pte_table)& 0xfffffc00) + pte_offset; - pte_offset += nsec << 10; - } - if (pte_offset >= RT_MMU_PTE_SIZE) - { - rt_kprintf("PTE table size too little\n"); - RT_ASSERT(0); - } + rt_uint32_t pte_offset = 0; + rt_uint32_t nsec = 0; + /* set page table */ + for (; size > 0; size--) + { + if (mdesc->mapped_mode == PAGE_MAPPED) + { + nsec = (RT_ALIGN(mdesc->vaddr_end, 0x100000) - RT_ALIGN_DOWN(mdesc->vaddr_start, 0x100000)) >> 20; + mdesc->sect_attr |= (((rt_uint32_t)_pte_table)& 0xfffffc00) + pte_offset; + pte_offset += nsec << 10; + } + if (pte_offset >= RT_MMU_PTE_SIZE) + { + rt_kprintf("PTE table size too little\n"); + RT_ASSERT(0); + } - mdesc++; - } + mdesc++; + } } void rt_hw_mmu_init(struct mem_desc *mdesc, rt_uint32_t size) { - /* disable I/D cache */ - mmu_disable_dcache(); - mmu_disable_icache(); - mmu_disable(); - mmu_invalidate_tlb(); - - /* clear pgd and pte table */ - rt_memset((void *)_pgd_table, 0, 16*1024); - rt_memset((void *)_pte_table, 0, RT_MMU_PTE_SIZE); - build_pte_mem_desc(mdesc, size); - /* set page table */ - for (; size > 0; size--) - { - if (mdesc->mapped_mode == SECT_MAPPED) - { - mmu_create_pgd(mdesc); - } - else - { - mmu_create_pte(mdesc); - } - - mdesc++; - } - - /* set MMU table address */ - mmu_setttbase((rt_uint32_t)_pgd_table); - - /* enables MMU */ - mmu_enable(); - - /* enable Instruction Cache */ - mmu_enable_icache(); - - /* enable Data Cache */ - mmu_enable_dcache(); - - mmu_invalidate_icache(); - mmu_invalidate_dcache_all(); + /* disable I/D cache */ + mmu_disable_dcache(); + mmu_disable_icache(); + mmu_disable(); + mmu_invalidate_tlb(); + + /* clear pgd and pte table */ + rt_memset((void *)_pgd_table, 0, 16*1024); + rt_memset((void *)_pte_table, 0, RT_MMU_PTE_SIZE); + build_pte_mem_desc(mdesc, size); + /* set page table */ + for (; size > 0; size--) + { + if (mdesc->mapped_mode == SECT_MAPPED) + { + mmu_create_pgd(mdesc); + } + else + { + mmu_create_pte(mdesc); + } + + mdesc++; + } + + /* set MMU table address */ + mmu_setttbase((rt_uint32_t)_pgd_table); + + /* enables MMU */ + mmu_enable(); + + /* enable Instruction Cache */ + mmu_enable_icache(); + + /* enable Data Cache */ + mmu_enable_dcache(); + + mmu_invalidate_icache(); + mmu_invalidate_dcache_all(); } diff --git a/libcpu/arm/armv6/mmu.h b/libcpu/arm/armv6/mmu.h index 4df61ac21..18355378b 100644 --- a/libcpu/arm/armv6/mmu.h +++ b/libcpu/arm/armv6/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,7 +12,7 @@ #include -#define CACHE_LINE_SIZE 32 +#define CACHE_LINE_SIZE 32 /* * Hardware page table definitions. @@ -30,7 +30,7 @@ /* * - section */ -#define PGD_SECT_BUFFERABLE (1 << 2) +#define PGD_SECT_BUFFERABLE (1 << 2) #define PGD_SECT_CACHEABLE (1 << 3) #define PGD_SECT_XN (1 << 4) /* ARMv6 */ #define PGD_SECT_AP0 (1 << 10) @@ -155,35 +155,35 @@ #define PAGE_RONX_FAULT (PAGE_AP_RO|PTE_TYPE_SMALL|PTE_EXT_XN) /* Read Only without cache and write buffer */ -#define DESC_SEC (0x2|(1<<4)) -#define CB (3<<2) //cache_on, write_back -#define CNB (2<<2) //cache_on, write_through -#define NCB (1<<2) //cache_off,WR_BUF on -#define NCNB (0<<2) //cache_off,WR_BUF off -#define AP_RW (3<<10) //supervisor=RW, user=RW -#define AP_RO (2<<10) //supervisor=RW, user=RO +#define DESC_SEC (0x2|(1<<4)) +#define CB (3<<2) //cache_on, write_back +#define CNB (2<<2) //cache_on, write_through +#define NCB (1<<2) //cache_off,WR_BUF on +#define NCNB (0<<2) //cache_off,WR_BUF off +#define AP_RW (3<<10) //supervisor=RW, user=RW +#define AP_RO (2<<10) //supervisor=RW, user=RO -#define DOMAIN_FAULT (0x0) -#define DOMAIN_CHK (0x1) -#define DOMAIN_NOTCHK (0x3) -#define DOMAIN0 (0x0<<5) -#define DOMAIN1 (0x1<<5) +#define DOMAIN_FAULT (0x0) +#define DOMAIN_CHK (0x1) +#define DOMAIN_NOTCHK (0x3) +#define DOMAIN0 (0x0<<5) +#define DOMAIN1 (0x1<<5) -#define DOMAIN0_ATTR (DOMAIN_CHK<<0) -#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) +#define DOMAIN0_ATTR (DOMAIN_CHK<<0) +#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) -#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */ -#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */ -#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ -#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ +#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) /* Read/Write, cache, write back */ +#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) /* Read/Write, cache, write through */ +#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ +#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) /* Read/Write without cache and write buffer */ struct mem_desc { - rt_uint32_t vaddr_start; - rt_uint32_t vaddr_end; - rt_uint32_t paddr_start; - rt_uint32_t sect_attr; /* when page mapped */ - rt_uint32_t page_attr; /* only sector mapped valid */ - rt_uint32_t mapped_mode; + rt_uint32_t vaddr_start; + rt_uint32_t vaddr_end; + rt_uint32_t paddr_start; + rt_uint32_t sect_attr; /* when page mapped */ + rt_uint32_t page_attr; /* only sector mapped valid */ + rt_uint32_t mapped_mode; #define SECT_MAPPED 0 #define PAGE_MAPPED 1 }; diff --git a/libcpu/arm/armv6/stack.c b/libcpu/arm/armv6/stack.c index 52de999fc..33a8d96d4 100644 --- a/libcpu/arm/armv6/stack.c +++ b/libcpu/arm/armv6/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/armv6/vfp.c b/libcpu/arm/armv6/vfp.c index 9aa8d34fc..fc07f5a30 100644 --- a/libcpu/arm/armv6/vfp.c +++ b/libcpu/arm/armv6/vfp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/armv6/vfp.h b/libcpu/arm/armv6/vfp.h index c347dbe0a..fd084f3ae 100644 --- a/libcpu/arm/armv6/vfp.h +++ b/libcpu/arm/armv6/vfp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -87,7 +87,7 @@ }) #define vmsr(vfp, var) \ - asm("vmsr "#vfp", %0" \ + asm("vmsr "#vfp", %0" \ : : "r" (var) : "cc") diff --git a/libcpu/arm/common/backtrace.c b/libcpu/arm/common/backtrace.c index 4fc87b20d..388a409d8 100644 --- a/libcpu/arm/common/backtrace.c +++ b/libcpu/arm/common/backtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/common/div0.c b/libcpu/arm/common/div0.c index 0cb3e09b5..113778b43 100644 --- a/libcpu/arm/common/div0.c +++ b/libcpu/arm/common/div0.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -8,5 +8,5 @@ */ void __div0 (void) { - while (1) ; + while (1) ; } diff --git a/libcpu/arm/common/showmem.c b/libcpu/arm/common/showmem.c index b770e4ce1..1a94ff1d9 100644 --- a/libcpu/arm/common/showmem.c +++ b/libcpu/arm/common/showmem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,27 +12,27 @@ void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) { - int i = 0, j =0; + int i = 0, j =0; - RT_ASSERT(addr); + RT_ASSERT(addr); - addr = addr & ~0xF; - size = 4*((size + 3)/4); + addr = addr & ~0xF; + size = 4*((size + 3)/4); - while(i < size) - { - rt_kprintf("0x%08x: ", addr ); + while(i < size) + { + rt_kprintf("0x%08x: ", addr ); - for(j=0; j<4; j++) - { - rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); + for(j=0; j<4; j++) + { + rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); - addr += 4; - i++; - } + addr += 4; + i++; + } - rt_kprintf("\n"); - } + rt_kprintf("\n"); + } - return; + return; } diff --git a/libcpu/arm/cortex-a/armv7.h b/libcpu/arm/cortex-a/armv7.h index d22f72fa6..f284bb525 100644 --- a/libcpu/arm/cortex-a/armv7.h +++ b/libcpu/arm/cortex-a/armv7.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,43 +12,43 @@ /* the exception stack without VFP registers */ struct rt_hw_exp_stack { - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long sp; + unsigned long lr; + unsigned long pc; + unsigned long cpsr; }; struct rt_hw_stack { - unsigned long cpsr; - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long lr; - unsigned long pc; + unsigned long cpsr; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long lr; + unsigned long pc; }; #define USERMODE 0x10 diff --git a/libcpu/arm/cortex-a/cache.c b/libcpu/arm/cortex-a/cache.c index 30af86baa..0a7e702db 100644 --- a/libcpu/arm/cortex-a/cache.c +++ b/libcpu/arm/cortex-a/cache.c @@ -1,11 +1,11 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2019-03-29 quanzhao the first version + * 2019-03-29 quanzhao the first version */ #include #include diff --git a/libcpu/arm/cortex-a/cp15.h b/libcpu/arm/cortex-a/cp15.h index 97c5b93ad..687199e57 100644 --- a/libcpu/arm/cortex-a/cp15.h +++ b/libcpu/arm/cortex-a/cp15.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/cpu.c b/libcpu/arm/cortex-a/cpu.c index 7c6bf58a4..f83429104 100644 --- a/libcpu/arm/cortex-a/cpu.c +++ b/libcpu/arm/cortex-a/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/gic.c b/libcpu/arm/cortex-a/gic.c index 2a46142b5..faad418b2 100644 --- a/libcpu/arm/cortex-a/gic.c +++ b/libcpu/arm/cortex-a/gic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -74,9 +74,8 @@ void arm_gic_ack(rt_uint32_t index, int irq) irq = irq - _gic_table[index].offset; RT_ASSERT(irq >= 0); - GIC_DIST_ENABLE_CLEAR(_gic_table[index].dist_hw_base, irq) = mask; + GIC_DIST_PENDING_CLEAR(_gic_table[index].dist_hw_base, irq) = mask; GIC_CPU_EOI(_gic_table[index].cpu_hw_base) = irq; - GIC_DIST_ENABLE_SET(_gic_table[index].dist_hw_base, irq) = mask; } void arm_gic_mask(rt_uint32_t index, int irq) diff --git a/libcpu/arm/cortex-a/gic.h b/libcpu/arm/cortex-a/gic.h index a16d0467f..e48f9f854 100644 --- a/libcpu/arm/cortex-a/gic.h +++ b/libcpu/arm/cortex-a/gic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/interrupt.c b/libcpu/arm/cortex-a/interrupt.c index b7a70719a..0d440d1d0 100644 --- a/libcpu/arm/cortex-a/interrupt.c +++ b/libcpu/arm/cortex-a/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/interrupt.h b/libcpu/arm/cortex-a/interrupt.h index 442187ede..a8a9afb95 100644 --- a/libcpu/arm/cortex-a/interrupt.h +++ b/libcpu/arm/cortex-a/interrupt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/mmu.c b/libcpu/arm/cortex-a/mmu.c index 1260f41fe..243fe19a0 100644 --- a/libcpu/arm/cortex-a/mmu.c +++ b/libcpu/arm/cortex-a/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/mmu.h b/libcpu/arm/cortex-a/mmu.h index fbce6df93..5cc60a774 100644 --- a/libcpu/arm/cortex-a/mmu.h +++ b/libcpu/arm/cortex-a/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/pmu.c b/libcpu/arm/cortex-a/pmu.c index 8ffc1dede..2b9165cc8 100644 --- a/libcpu/arm/cortex-a/pmu.c +++ b/libcpu/arm/cortex-a/pmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/pmu.h b/libcpu/arm/cortex-a/pmu.h index fb8390133..64a74b5d3 100644 --- a/libcpu/arm/cortex-a/pmu.h +++ b/libcpu/arm/cortex-a/pmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/stack.c b/libcpu/arm/cortex-a/stack.c index 07d795ab5..e68b32486 100644 --- a/libcpu/arm/cortex-a/stack.c +++ b/libcpu/arm/cortex-a/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-a/trap.c b/libcpu/arm/cortex-a/trap.c index dc232a46e..a213e776c 100644 --- a/libcpu/arm/cortex-a/trap.c +++ b/libcpu/arm/cortex-a/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-m0/context_gcc.S b/libcpu/arm/cortex-m0/context_gcc.S index d9993247e..a504ee076 100644 --- a/libcpu/arm/cortex-m0/context_gcc.S +++ b/libcpu/arm/cortex-m0/context_gcc.S @@ -22,7 +22,7 @@ .equ SCB_VTOR, 0xE000ED08 /* Vector Table Offset Register */ .equ NVIC_INT_CTRL, 0xE000ED04 /* interrupt control state register */ .equ NVIC_SHPR3, 0xE000ED20 /* system priority register (3) */ - .equ NVIC_PENDSV_PRI, 0x00FF0000 /* PendSV priority value (lowest) */ + .equ NVIC_PENDSV_PRI, 0xFFFF0000 /* PendSV and SysTick priority value (lowest) */ .equ NVIC_PENDSVSET, 0x10000000 /* value to trigger PendSV exception */ /* @@ -159,7 +159,7 @@ rt_hw_context_switch_to: MOVS R0, #1 STR R0, [R1] - /* set the PendSV exception priority */ + /* set the PendSV and SysTick exception priority */ LDR R0, =NVIC_SHPR3 LDR R1, =NVIC_PENDSV_PRI LDR R2, [R0,#0x00] /* read */ diff --git a/libcpu/arm/cortex-m0/context_iar.S b/libcpu/arm/cortex-m0/context_iar.S index 50d378135..6f410d1a2 100644 --- a/libcpu/arm/cortex-m0/context_iar.S +++ b/libcpu/arm/cortex-m0/context_iar.S @@ -19,7 +19,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SHPR3 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception SECTION .text:CODE(2) @@ -163,7 +163,7 @@ rt_hw_context_switch_to: MOVS r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SHPR3 LDR r1, =NVIC_PENDSV_PRI LDR r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m0/context_rvds.S b/libcpu/arm/cortex-m0/context_rvds.S index fb9ce9b4b..072486587 100644 --- a/libcpu/arm/cortex-m0/context_rvds.S +++ b/libcpu/arm/cortex-m0/context_rvds.S @@ -19,7 +19,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SHPR3 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception AREA |.text|, CODE, READONLY, ALIGN=2 @@ -168,7 +168,7 @@ rt_hw_context_switch_to PROC MOVS r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SHPR3 LDR r1, =NVIC_PENDSV_PRI LDR r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m0/cpuport.c b/libcpu/arm/cortex-m0/cpuport.c index 19aec4223..49e15bf33 100644 --- a/libcpu/arm/cortex-m0/cpuport.c +++ b/libcpu/arm/cortex-m0/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-m3/context_gcc.S b/libcpu/arm/cortex-m3/context_gcc.S index d17a8aa12..2878d2008 100644 --- a/libcpu/arm/cortex-m3/context_gcc.S +++ b/libcpu/arm/cortex-m3/context_gcc.S @@ -24,7 +24,7 @@ .equ PENDSVSET_BIT, 0x10000000 /* value to trigger PendSV exception */ .equ SHPR3, 0xE000ED20 /* system priority register (3) */ - .equ PENDSV_PRI_LOWEST, 0x00FF0000 /* PendSV priority value (lowest) */ + .equ PENDSV_PRI_LOWEST, 0xFFFF0000 /* PendSV and SysTick priority value (lowest) */ /* * rt_base_t rt_hw_interrupt_disable(); @@ -140,7 +140,7 @@ rt_hw_context_switch_to: MOV R0, #1 STR R0, [R1] - /* set the PendSV exception priority */ + /* set the PendSV and SysTick exception priority */ LDR R0, =SHPR3 LDR R1, =PENDSV_PRI_LOWEST LDR.W R2, [R0,#0] /* read */ diff --git a/libcpu/arm/cortex-m3/context_iar.S b/libcpu/arm/cortex-m3/context_iar.S index 91645c48b..7c0e69bf5 100644 --- a/libcpu/arm/cortex-m3/context_iar.S +++ b/libcpu/arm/cortex-m3/context_iar.S @@ -19,7 +19,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception SECTION .text:CODE(2) @@ -139,7 +139,7 @@ rt_hw_context_switch_to: MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m3/context_rvds.S b/libcpu/arm/cortex-m3/context_rvds.S index a2a7f41a2..a66143049 100644 --- a/libcpu/arm/cortex-m3/context_rvds.S +++ b/libcpu/arm/cortex-m3/context_rvds.S @@ -18,7 +18,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception AREA |.text|, CODE, READONLY, ALIGN=2 @@ -145,7 +145,7 @@ rt_hw_context_switch_to PROC MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m3/cpuport.c b/libcpu/arm/cortex-m3/cpuport.c index d17d4fdf2..ab0a2c352 100644 --- a/libcpu/arm/cortex-m3/cpuport.c +++ b/libcpu/arm/cortex-m3/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -388,13 +388,13 @@ int __rt_ffs(int value) { __asm volatile( "CMP r0, #0x00 \n" - "BEQ exit \n" + "BEQ 1f \n" "RBIT r0, r0 \n" "CLZ r0, r0 \n" "ADDS r0, r0, #0x01 \n" - "exit: \n" + "1: \n" : "=r"(value) : "r"(value) diff --git a/libcpu/arm/cortex-m4/context_gcc.S b/libcpu/arm/cortex-m4/context_gcc.S index 420f4f8ae..f569a3586 100644 --- a/libcpu/arm/cortex-m4/context_gcc.S +++ b/libcpu/arm/cortex-m4/context_gcc.S @@ -25,7 +25,7 @@ .equ SCB_VTOR, 0xE000ED08 /* Vector Table Offset Register */ .equ NVIC_INT_CTRL, 0xE000ED04 /* interrupt control state register */ .equ NVIC_SYSPRI2, 0xE000ED20 /* system priority register (2) */ -.equ NVIC_PENDSV_PRI, 0x00FF0000 /* PendSV priority value (lowest) */ +.equ NVIC_PENDSV_PRI, 0xFFFF0000 /* PendSV and SysTick priority value (lowest) */ .equ NVIC_PENDSVSET, 0x10000000 /* value to trigger PendSV exception */ /* @@ -182,7 +182,7 @@ rt_hw_context_switch_to: MOV r0, #1 STR r0, [r1] - /* set the PendSV exception priority */ + /* set the PendSV and SysTick exception priority */ LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] /* read */ diff --git a/libcpu/arm/cortex-m4/context_iar.S b/libcpu/arm/cortex-m4/context_iar.S index 06b8c7f88..18d6a3f78 100644 --- a/libcpu/arm/cortex-m4/context_iar.S +++ b/libcpu/arm/cortex-m4/context_iar.S @@ -21,7 +21,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception SECTION .text:CODE(2) @@ -186,7 +186,7 @@ rt_hw_context_switch_to: MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m4/context_rvds.S b/libcpu/arm/cortex-m4/context_rvds.S index f6d2447c5..3f948bc34 100644 --- a/libcpu/arm/cortex-m4/context_rvds.S +++ b/libcpu/arm/cortex-m4/context_rvds.S @@ -20,7 +20,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception AREA |.text|, CODE, READONLY, ALIGN=2 @@ -186,7 +186,7 @@ rt_hw_context_switch_to PROC MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m4/cpuport.c b/libcpu/arm/cortex-m4/cpuport.c index f556ba0c2..3c6a9aed7 100644 --- a/libcpu/arm/cortex-m4/cpuport.c +++ b/libcpu/arm/cortex-m4/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -454,7 +454,7 @@ RT_WEAK void rt_hw_cpu_reset(void) * @return return the index of the first bit set. If value is 0, then this function * shall return 0. */ -#if defined(__CC_ARM) +#if defined(__CC_ARM) __asm int __rt_ffs(int value) { CMP r0, #0x00 @@ -472,13 +472,13 @@ int __rt_ffs(int value) { __asm volatile( "CMP r0, #0x00 \n" - "BEQ exit \n" + "BEQ 1f \n" "RBIT r0, r0 \n" "CLZ r0, r0 \n" "ADDS r0, r0, #0x01 \n" - "exit: \n" + "1: \n" : "=r"(value) : "r"(value) diff --git a/libcpu/arm/cortex-m7/context_gcc.S b/libcpu/arm/cortex-m7/context_gcc.S index 420f4f8ae..f569a3586 100644 --- a/libcpu/arm/cortex-m7/context_gcc.S +++ b/libcpu/arm/cortex-m7/context_gcc.S @@ -25,7 +25,7 @@ .equ SCB_VTOR, 0xE000ED08 /* Vector Table Offset Register */ .equ NVIC_INT_CTRL, 0xE000ED04 /* interrupt control state register */ .equ NVIC_SYSPRI2, 0xE000ED20 /* system priority register (2) */ -.equ NVIC_PENDSV_PRI, 0x00FF0000 /* PendSV priority value (lowest) */ +.equ NVIC_PENDSV_PRI, 0xFFFF0000 /* PendSV and SysTick priority value (lowest) */ .equ NVIC_PENDSVSET, 0x10000000 /* value to trigger PendSV exception */ /* @@ -182,7 +182,7 @@ rt_hw_context_switch_to: MOV r0, #1 STR r0, [r1] - /* set the PendSV exception priority */ + /* set the PendSV and SysTick exception priority */ LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] /* read */ diff --git a/libcpu/arm/cortex-m7/context_iar.S b/libcpu/arm/cortex-m7/context_iar.S index 06b8c7f88..18d6a3f78 100644 --- a/libcpu/arm/cortex-m7/context_iar.S +++ b/libcpu/arm/cortex-m7/context_iar.S @@ -21,7 +21,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception SECTION .text:CODE(2) @@ -186,7 +186,7 @@ rt_hw_context_switch_to: MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m7/context_rvds.S b/libcpu/arm/cortex-m7/context_rvds.S index ea9e9cb8b..d051f819c 100644 --- a/libcpu/arm/cortex-m7/context_rvds.S +++ b/libcpu/arm/cortex-m7/context_rvds.S @@ -20,7 +20,7 @@ SCB_VTOR EQU 0xE000ED08 ; Vector Table Offset Register NVIC_INT_CTRL EQU 0xE000ED04 ; interrupt control state register NVIC_SYSPRI2 EQU 0xE000ED20 ; system priority register (2) -NVIC_PENDSV_PRI EQU 0x00FF0000 ; PendSV priority value (lowest) +NVIC_PENDSV_PRI EQU 0xFFFF0000 ; PendSV and SysTick priority value (lowest) NVIC_PENDSVSET EQU 0x10000000 ; value to trigger PendSV exception AREA |.text|, CODE, READONLY, ALIGN=2 @@ -186,7 +186,7 @@ rt_hw_context_switch_to PROC MOV r0, #1 STR r0, [r1] - ; set the PendSV exception priority + ; set the PendSV and SysTick exception priority LDR r0, =NVIC_SYSPRI2 LDR r1, =NVIC_PENDSV_PRI LDR.W r2, [r0,#0x00] ; read diff --git a/libcpu/arm/cortex-m7/cpuport.c b/libcpu/arm/cortex-m7/cpuport.c index c22242f14..3c6a9aed7 100644 --- a/libcpu/arm/cortex-m7/cpuport.c +++ b/libcpu/arm/cortex-m7/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -472,13 +472,13 @@ int __rt_ffs(int value) { __asm volatile( "CMP r0, #0x00 \n" - "BEQ exit \n" + "BEQ 1f \n" "RBIT r0, r0 \n" "CLZ r0, r0 \n" "ADDS r0, r0, #0x01 \n" - "exit: \n" + "1: \n" : "=r"(value) : "r"(value) diff --git a/libcpu/arm/cortex-r4/armv7.h b/libcpu/arm/cortex-r4/armv7.h index 3adcb92c5..d29b41a21 100644 --- a/libcpu/arm/cortex-r4/armv7.h +++ b/libcpu/arm/cortex-r4/armv7.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -16,23 +16,23 @@ /* the exception stack without VFP registers */ struct rt_hw_exp_stack { - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long sp; + unsigned long lr; + unsigned long pc; + unsigned long cpsr; }; #define USERMODE 0x10 diff --git a/libcpu/arm/cortex-r4/cpu.c b/libcpu/arm/cortex-r4/cpu.c index d2e8130e7..a018bc695 100644 --- a/libcpu/arm/cortex-r4/cpu.c +++ b/libcpu/arm/cortex-r4/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,22 +30,22 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } #ifdef __TI_COMPILER_VERSION__ #ifdef RT_USING_CPU_FFS int __rt_ffs(int value) { - if (value == 0) - return value; + if (value == 0) + return value; - __asm(" rsb r1, r0, #0"); - __asm(" and r1, r1, r0"); - __asm(" clz r1, r1"); - __asm(" rsb r0, r1, #32"); + __asm(" rsb r1, r0, #0"); + __asm(" and r1, r1, r0"); + __asm(" clz r1, r1"); + __asm(" rsb r0, r1, #32"); } #endif diff --git a/libcpu/arm/cortex-r4/interrupt.c b/libcpu/arm/cortex-r4/interrupt.c index 30e14f5a2..14a902392 100644 --- a/libcpu/arm/cortex-r4/interrupt.c +++ b/libcpu/arm/cortex-r4/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,7 +17,7 @@ #include "armv7.h" -#define MAX_HANDLERS 96 +#define MAX_HANDLERS 96 /* exception and interrupt handler table */ struct rt_irq_desc irq_desc[MAX_HANDLERS]; @@ -36,16 +36,16 @@ rt_uint32_t rt_thread_switch_interrupt_flag; static void rt_hw_int_not_handle(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } #define vimRAM (0xFFF82000U) void rt_hw_interrupt_init(void) { - register int i; + register int i; - rt_uint32_t *vect_addr; + rt_uint32_t *vect_addr; /* the initialization is done in sys_startup.c */ @@ -55,15 +55,15 @@ void rt_hw_interrupt_init(void) { irq_desc[i].handler = rt_hw_int_not_handle; - vect_addr = (rt_uint32_t *)(vimRAM + i*4); - *vect_addr = (rt_uint32_t)&irq_desc[i]; + vect_addr = (rt_uint32_t *)(vimRAM + i*4); + *vect_addr = (rt_uint32_t)&irq_desc[i]; } - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } void rt_hw_interrupt_mask(int vector) @@ -86,21 +86,21 @@ void rt_hw_interrupt_umask(int vector) * @return the old handler */ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) + void *param, const char *name) { - rt_isr_handler_t old_handler = RT_NULL; - - if(vector >= 0 && vector < MAX_HANDLERS) - { - old_handler = irq_desc[vector].handler; - if (handler != RT_NULL) - { - irq_desc[vector].handler = handler; - irq_desc[vector].param = param; - } - } - - return old_handler; + rt_isr_handler_t old_handler = RT_NULL; + + if(vector >= 0 && vector < MAX_HANDLERS) + { + old_handler = irq_desc[vector].handler; + if (handler != RT_NULL) + { + irq_desc[vector].handler = handler; + irq_desc[vector].param = param; + } + } + + return old_handler; } /*@}*/ diff --git a/libcpu/arm/cortex-r4/stack.c b/libcpu/arm/cortex-r4/stack.c index 612cde3bf..539b47d3d 100644 --- a/libcpu/arm/cortex-r4/stack.c +++ b/libcpu/arm/cortex-r4/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/cortex-r4/trap.c b/libcpu/arm/cortex-r4/trap.c index d50ad0653..e6c62390c 100644 --- a/libcpu/arm/cortex-r4/trap.c +++ b/libcpu/arm/cortex-r4/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -28,13 +28,13 @@ */ void rt_hw_show_register (struct rt_hw_exp_stack *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -49,8 +49,8 @@ void rt_hw_trap_udef(struct rt_hw_exp_stack *regs) { rt_kprintf("undefined instruction\n"); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } @@ -68,7 +68,7 @@ void rt_hw_trap_svc(struct rt_hw_exp_stack *regs) rt_kprintf("software interrupt\n"); rt_hw_show_register(regs); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif rt_hw_cpu_shutdown(); } @@ -86,7 +86,7 @@ void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs) rt_kprintf("prefetch abort\n"); rt_hw_show_register(regs); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif rt_hw_cpu_shutdown(); } @@ -104,7 +104,7 @@ void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs) rt_kprintf("Data Abort "); rt_hw_show_register(regs); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif rt_hw_cpu_shutdown(); } @@ -121,7 +121,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs) rt_kprintf("Reserved trap\n"); rt_hw_show_register(regs); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif rt_hw_cpu_shutdown(); } @@ -129,15 +129,15 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs) extern rt_isr_handler_t isr_table[]; void rt_hw_trap_irq(void) { - int irqno; - struct rt_irq_desc* irq; - extern struct rt_irq_desc irq_desc[]; + int irqno; + struct rt_irq_desc* irq; + extern struct rt_irq_desc irq_desc[]; - irq = (struct rt_irq_desc*) vimREG->IRQVECREG; - irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); + irq = (struct rt_irq_desc*) vimREG->IRQVECREG; + irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); - /* invoke isr */ - irq->handler(irqno, irq->param); + /* invoke isr */ + irq->handler(irqno, irq->param); } void rt_hw_trap_fiq(void) diff --git a/libcpu/arm/dm36x/cpuport.c b/libcpu/arm/dm36x/cpuport.c index f6e8a2005..fc8024852 100644 --- a/libcpu/arm/dm36x/cpuport.c +++ b/libcpu/arm/dm36x/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,8 +11,8 @@ #include #include -#define ICACHE_MASK (rt_uint32_t)(1 << 12) -#define DCACHE_MASK (rt_uint32_t)(1 << 2) +#define ICACHE_MASK (rt_uint32_t)(1 << 12) +#define DCACHE_MASK (rt_uint32_t)(1 << 2) extern void machine_reset(void); extern void machine_shutdown(void); @@ -20,70 +20,70 @@ extern void machine_shutdown(void); #ifdef __GNUC__ rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - return i; + asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "orr r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "orr r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } rt_inline void cache_disable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "bic r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "bic r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } #endif #ifdef __CC_ARM rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - __asm - { - mrc p15, 0, i, c1, c0, 0 - } + __asm + { + mrc p15, 0, i, c1, c0, 0 + } - return i; + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - rt_uint32_t value; + rt_uint32_t value; - __asm - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + __asm + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } rt_inline void cache_disable(rt_uint32_t bit) { - rt_uint32_t value; + rt_uint32_t value; - __asm - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + __asm + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } #endif @@ -93,7 +93,7 @@ rt_inline void cache_disable(rt_uint32_t bit) */ void rt_hw_cpu_icache_enable() { - cache_enable(ICACHE_MASK); + cache_enable(ICACHE_MASK); } /** @@ -102,7 +102,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - cache_disable(ICACHE_MASK); + cache_disable(ICACHE_MASK); } /** @@ -111,7 +111,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return (cp15_rd() & ICACHE_MASK); + return (cp15_rd() & ICACHE_MASK); } /** @@ -120,7 +120,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - cache_enable(DCACHE_MASK); + cache_enable(DCACHE_MASK); } /** @@ -129,7 +129,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - cache_disable(DCACHE_MASK); + cache_disable(DCACHE_MASK); } /** @@ -138,7 +138,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return (cp15_rd() & DCACHE_MASK); + return (cp15_rd() & DCACHE_MASK); } /** @@ -147,13 +147,13 @@ rt_base_t rt_hw_cpu_dcache_status() */ void rt_hw_cpu_reset() { - - rt_kprintf("Restarting system...\n"); - machine_reset(); - while(1); /* loop forever and wait for reset to happen */ + rt_kprintf("Restarting system...\n"); + machine_reset(); - /* NEVER REACHED */ + while(1); /* loop forever and wait for reset to happen */ + + /* NEVER REACHED */ } /** @@ -162,67 +162,67 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); + rt_uint32_t level; + rt_kprintf("shutdown...\n"); - level = rt_hw_interrupt_disable(); - machine_shutdown(); - while (level) - { - RT_ASSERT(0); - } + level = rt_hw_interrupt_disable(); + machine_shutdown(); + while (level) + { + RT_ASSERT(0); + } } #ifdef RT_USING_CPU_FFS /** - * This function finds the first bit set (beginning with the least significant bit) + * This function finds the first bit set (beginning with the least significant bit) * in value and return the index of that bit. * - * Bits are numbered starting at 1 (the least significant bit). A return value of + * Bits are numbered starting at 1 (the least significant bit). A return value of * zero from any of these functions means that the argument was zero. - * - * @return return the index of the first bit set. If value is 0, then this function + * + * @return return the index of the first bit set. If value is 0, then this function * shall return 0. */ #if defined(__CC_ARM) int __rt_ffs(int value) { - register rt_uint32_t x; + register rt_uint32_t x; + + if (value == 0) + return value; - if (value == 0) - return value; - - __asm - { - rsb x, value, #0 - and x, x, value - clz x, x - rsb x, x, #32 - } + __asm + { + rsb x, value, #0 + and x, x, value + clz x, x + rsb x, x, #32 + } - return x; + return x; } #elif defined(__IAR_SYSTEMS_ICC__) int __rt_ffs(int value) { - if (value == 0) - return value; + if (value == 0) + return value; - __ASM("RSB r4, r0, #0"); - __ASM("AND r4, r4, r0"); - __ASM("CLZ r4, r4"); - __ASM("RSB r0, r4, #32"); + __ASM("RSB r4, r0, #0"); + __ASM("AND r4, r4, r0"); + __ASM("CLZ r4, r4"); + __ASM("RSB r0, r4, #32"); } #elif defined(__GNUC__) int __rt_ffs(int value) { - if (value == 0) - return value; + if (value == 0) + return value; - value &= (-value); - asm ("clz %0, %1": "=r"(value) :"r"(value)); + value &= (-value); + asm ("clz %0, %1": "=r"(value) :"r"(value)); - return (32 - value); + return (32 - value); } #endif diff --git a/libcpu/arm/dm36x/mmu.c b/libcpu/arm/dm36x/mmu.c index abb2c1cd9..bec2e6a71 100644 --- a/libcpu/arm/dm36x/mmu.c +++ b/libcpu/arm/dm36x/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,22 +12,22 @@ #ifdef __CC_ARM void mmu_setttbase(rt_uint32_t i) { - register rt_uint32_t value; + register rt_uint32_t value; /* Invalidates all TLBs.Domain access is selected as * client by configuring domain access register, * in that case access controlled by permission value * set by page table entry */ - value = 0; + value = 0; __asm volatile { mcr p15, 0, value, c8, c7, 0 - } + } - value = 0x55555555; - __asm volatile - { + value = 0x55555555; + __asm volatile + { mcr p15, 0, value, c3, c0, 0 mcr p15, 0, i, c2, c0, 0 } @@ -153,44 +153,44 @@ void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) while(ptr < buffer + size) { - __asm volatile - { - MCR p15, 0, ptr, c7, c14, 1 - } + __asm volatile + { + MCR p15, 0, ptr, c7, c14, 1 + } ptr += CACHE_LINE_SIZE; } } void mmu_clean_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - __asm volatile - { - MCR p15, 0, ptr, c7, c10, 1 - } - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + __asm volatile + { + MCR p15, 0, ptr, c7, c10, 1 + } + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - __asm volatile - { - MCR p15, 0, ptr, c7, c6, 1 - } - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + __asm volatile + { + MCR p15, 0, ptr, c7, c6, 1 + } + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_tlb() @@ -231,137 +231,137 @@ void mmu_invalidate_dcache_all() #elif defined(__GNUC__) void mmu_setttbase(register rt_uint32_t i) { - register rt_uint32_t value; + register rt_uint32_t value; /* Invalidates all TLBs.Domain access is selected as * client by configuring domain access register, * in that case access controlled by permission value * set by page table entry */ - value = 0; - asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); + value = 0; + asm volatile ("mcr p15, 0, %0, c8, c7, 0"::"r"(value)); - value = 0x55555555; - asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); - asm volatile ("mcr p15, 0, %0, c2, c0, 0"::"r"(i)); + value = 0x55555555; + asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(value)); + asm volatile ("mcr p15, 0, %0, c2, c0, 0"::"r"(i)); } void mmu_set_domain(register rt_uint32_t i) { - asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); + asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); } void mmu_enable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= 0x1; - i |= (1 << 13); /* High exception vectors selected, address range = 0xFFFF0000-0xFFFF001C */ - /* S R bit=1 0 for system protection */ - i |= (1 << 8); - i &= ~(1 << 9); + i |= 0x1; + i |= (1 << 13); /* High exception vectors selected, address range = 0xFFFF0000-0xFFFF001C */ + /* S R bit=1 0 for system protection */ + i |= (1 << 8); + i &= ~(1 << 9); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~0x1; + i &= ~0x1; - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 12); + i |= (1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 2); + i |= (1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 12); + i &= ~(1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 2); + i &= ~(1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 1); + i |= (1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 1); + i &= ~(1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_clean_invalidated_cache_index(int index) { - asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); + asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); } void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) @@ -372,7 +372,7 @@ void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) while(ptr < buffer + size) { - asm volatile ("mcr p15, 0, %0, c7, c14, 1": :"r" (ptr)); + asm volatile ("mcr p15, 0, %0, c7, c14, 1": :"r" (ptr)); ptr += CACHE_LINE_SIZE; } } @@ -380,38 +380,38 @@ void mmu_clean_invalidated_dcache(rt_uint32_t buffer, rt_uint32_t size) void mmu_clean_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c10, 1": :"r" (ptr)); + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_dcache(rt_uint32_t buffer, rt_uint32_t size) { - unsigned int ptr; + unsigned int ptr; - ptr = buffer & ~(CACHE_LINE_SIZE - 1); + ptr = buffer & ~(CACHE_LINE_SIZE - 1); - while (ptr < buffer + size) - { - asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); - ptr += CACHE_LINE_SIZE; - } + while (ptr < buffer + size) + { + asm volatile ("mcr p15, 0, %0, c7, c6, 1": :"r" (ptr)); + ptr += CACHE_LINE_SIZE; + } } void mmu_invalidate_tlb() { - asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); } void mmu_invalidate_icache() { - asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); } void mmu_invalidate_dcache_all() @@ -462,13 +462,13 @@ void mmu_create_pte(struct mem_desc *mdesc) if (*pTT == 0) /* Level 1 page table item not used, now update pgd item */ { *pTT = pte_offset | sect_attr; - p_pteentry = (rt_uint32_t *)pte_offset + + p_pteentry = (rt_uint32_t *)pte_offset + ((vaddr & 0x000ff000) >> 12); pte_offset += 1024; } else /* using old Level 1 page table item */ { - p_pteentry = (rt_uint32_t *)(*pTT & 0xfffffc00) + + p_pteentry = (rt_uint32_t *)(*pTT & 0xfffffc00) + ((vaddr & 0x000ff000) >> 12); } @@ -503,13 +503,13 @@ static void build_pte_mem_desc(struct mem_desc *mdesc, rt_uint32_t size) void rt_hw_mmu_init(struct mem_desc *mdesc, rt_uint32_t size) { - /* disable I/D cache */ - mmu_disable_dcache(); - mmu_disable_icache(); - mmu_disable(); - mmu_invalidate_tlb(); + /* disable I/D cache */ + mmu_disable_dcache(); + mmu_disable_icache(); + mmu_disable(); + mmu_invalidate_tlb(); - /* clear pgd and pte table */ + /* clear pgd and pte table */ rt_memset((void *)_pgd_table, 0, 16*1024); rt_memset((void *)_pte_table, 0, RT_MMU_PTE_SIZE); build_pte_mem_desc(mdesc, size); diff --git a/libcpu/arm/dm36x/mmu.h b/libcpu/arm/dm36x/mmu.h index 3410b881a..60a4e3c6e 100644 --- a/libcpu/arm/dm36x/mmu.h +++ b/libcpu/arm/dm36x/mmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,7 +12,7 @@ #include -#define CACHE_LINE_SIZE 32 +#define CACHE_LINE_SIZE 32 /* * Hardware page table definitions. @@ -30,7 +30,7 @@ /* * - section */ -#define PGD_SECT_BUFFERABLE (1 << 2) +#define PGD_SECT_BUFFERABLE (1 << 2) #define PGD_SECT_CACHEABLE (1 << 3) #define PGD_SECT_XN (1 << 4) /* ARMv6 */ #define PGD_SECT_AP0 (1 << 10) @@ -133,14 +133,14 @@ #define PAGE_RO_FAULT (PAGE_AP_RO|PTE_TYPE_SMALL) /* Read Only without cache and write buffer */ struct mem_desc { - rt_uint32_t vaddr_start; - rt_uint32_t vaddr_end; - rt_uint32_t paddr_start; - rt_uint32_t sect_attr; /* when page mapped */ - rt_uint32_t page_attr; /* only sector mapped valid */ - rt_uint32_t mapped_mode; - #define SECT_MAPPED 0 - #define PAGE_MAPPED 1 + rt_uint32_t vaddr_start; + rt_uint32_t vaddr_end; + rt_uint32_t paddr_start; + rt_uint32_t sect_attr; /* when page mapped */ + rt_uint32_t page_attr; /* only sector mapped valid */ + rt_uint32_t mapped_mode; + #define SECT_MAPPED 0 + #define PAGE_MAPPED 1 }; diff --git a/libcpu/arm/dm36x/stack.c b/libcpu/arm/dm36x/stack.c index 9d7385b9c..e725d060c 100644 --- a/libcpu/arm/dm36x/stack.c +++ b/libcpu/arm/dm36x/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/lpc214x/cpuport.c b/libcpu/arm/lpc214x/cpuport.c index 2543a5e0a..723699c3c 100644 --- a/libcpu/arm/lpc214x/cpuport.c +++ b/libcpu/arm/lpc214x/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,13 +13,13 @@ #include #include "lpc214x.h" -#define MAX_HANDLERS 32 -#define SVCMODE 0x13 +#define MAX_HANDLERS 32 +#define SVCMODE 0x13 extern rt_uint32_t rt_interrupt_nest; /* exception and interrupt handler table */ -struct rt_irq_desc irq_desc[MAX_HANDLERS]; +struct rt_irq_desc irq_desc[MAX_HANDLERS]; /** * @addtogroup LPC214x @@ -37,35 +37,35 @@ struct rt_irq_desc irq_desc[MAX_HANDLERS]; * @return stack address */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { - unsigned long *stk; - - stk = (unsigned long *)stack_addr; - *(stk) = (unsigned long)tentry; /* entry point */ - *(--stk) = (unsigned long)texit; /* lr */ - *(--stk) = 0; /* r12 */ - *(--stk) = 0; /* r11 */ - *(--stk) = 0; /* r10 */ - *(--stk) = 0; /* r9 */ - *(--stk) = 0; /* r8 */ - *(--stk) = 0; /* r7 */ - *(--stk) = 0; /* r6 */ - *(--stk) = 0; /* r5 */ - *(--stk) = 0; /* r4 */ - *(--stk) = 0; /* r3 */ - *(--stk) = 0; /* r2 */ - *(--stk) = 0; /* r1 */ - *(--stk) = (unsigned long)parameter; /* r0 : argument */ - - /* cpsr */ - if ((rt_uint32_t)tentry & 0x01) - *(--stk) = SVCMODE | 0x20; /* thumb mode */ - else - *(--stk) = SVCMODE; /* arm mode */ - - /* return task's current stack address */ - return (rt_uint8_t *)stk; + unsigned long *stk; + + stk = (unsigned long *)stack_addr; + *(stk) = (unsigned long)tentry; /* entry point */ + *(--stk) = (unsigned long)texit; /* lr */ + *(--stk) = 0; /* r12 */ + *(--stk) = 0; /* r11 */ + *(--stk) = 0; /* r10 */ + *(--stk) = 0; /* r9 */ + *(--stk) = 0; /* r8 */ + *(--stk) = 0; /* r7 */ + *(--stk) = 0; /* r6 */ + *(--stk) = 0; /* r5 */ + *(--stk) = 0; /* r4 */ + *(--stk) = 0; /* r3 */ + *(--stk) = 0; /* r2 */ + *(--stk) = 0; /* r1 */ + *(--stk) = (unsigned long)parameter; /* r0 : argument */ + + /* cpsr */ + if ((rt_uint32_t)tentry & 0x01) + *(--stk) = SVCMODE | 0x20; /* thumb mode */ + else + *(--stk) = SVCMODE; /* arm mode */ + + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /* exception and interrupt handler table */ @@ -74,7 +74,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; void rt_hw_interrupt_handler(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -82,32 +82,32 @@ void rt_hw_interrupt_handler(int vector, void *param) */ void rt_hw_interrupt_init(void) { - rt_base_t index; - rt_uint32_t *vect_addr, *vect_ctl; + rt_base_t index; + rt_uint32_t *vect_addr, *vect_ctl; - /* initialize VIC*/ - VICIntEnClr = 0xffffffff; - VICVectAddr = 0; - /* set all to IRQ */ - VICIntSelect = 0; + /* initialize VIC*/ + VICIntEnClr = 0xffffffff; + VICVectAddr = 0; + /* set all to IRQ */ + VICIntSelect = 0; rt_memset(irq_desc, 0x00, sizeof(irq_desc)); - for (index = 0; index < MAX_HANDLERS; index ++) - { + for (index = 0; index < MAX_HANDLERS; index ++) + { irq_desc[index].handler = rt_hw_interrupt_handler; - vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + (index << 2)); - vect_ctl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + (index << 2)); + vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + (index << 2)); + vect_ctl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + (index << 2)); - *vect_addr = (rt_uint32_t)&irq_desc[index]; - *vect_ctl = 0xF; - } + *vect_addr = (rt_uint32_t)&irq_desc[index]; + *vect_ctl = 0xF; + } - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } /** @@ -116,7 +116,7 @@ void rt_hw_interrupt_init(void) */ void rt_hw_interrupt_mask(int vector) { - VICIntEnClr = (1 << vector); + VICIntEnClr = (1 << vector); } /** @@ -125,7 +125,7 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - VICIntEnable = (1 << vector); + VICIntEnable = (1 << vector); } /** @@ -143,17 +143,17 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, if(vector >= 0 && vector < MAX_HANDLERS) { - rt_uint32_t* vect_ctl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + (vector << 2)); + rt_uint32_t* vect_ctl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + (vector << 2)); /* assign IRQ slot and enable this slot */ *vect_ctl = 0x20 | (vector & 0x1F); old_handler = irq_desc[vector].handler; - if (handler != RT_NULL) - { - irq_desc[vector].handler = handler; - irq_desc[vector].param = param; - } + if (handler != RT_NULL) + { + irq_desc[vector].handler = handler; + irq_desc[vector].param = param; + } } return old_handler; @@ -173,22 +173,22 @@ void rt_hw_cpu_reset(void) */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } void rt_hw_trap_irq(void) { int irqno; - struct rt_irq_desc* irq; + struct rt_irq_desc* irq; extern struct rt_irq_desc irq_desc[]; - irq = (struct rt_irq_desc*) VICVectAddr; - irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); + irq = (struct rt_irq_desc*) VICVectAddr; + irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); - /* invoke isr */ - irq->handler(irqno, irq->param); + /* invoke isr */ + irq->handler(irqno, irq->param); /* acknowledge Interrupt */ // VICVectAddr = 0; diff --git a/libcpu/arm/lpc24xx/LPC24xx.h b/libcpu/arm/lpc24xx/LPC24xx.h index 5cb973085..827310ca6 100644 --- a/libcpu/arm/lpc24xx/LPC24xx.h +++ b/libcpu/arm/lpc24xx/LPC24xx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,20 +14,20 @@ #ifdef __cplusplus extern "C" { #endif - -#define USERMODE 0x10 -#define FIQMODE 0x11 -#define IRQMODE 0x12 -#define SVCMODE 0x13 -#define ABORTMODE 0x17 -#define UNDEFMODE 0x1b -#define MODEMASK 0x1f -#define NOINT 0xc0 - -#define MCLK (72000000) - + +#define USERMODE 0x10 +#define FIQMODE 0x11 +#define IRQMODE 0x12 +#define SVCMODE 0x13 +#define ABORTMODE 0x17 +#define UNDEFMODE 0x1b +#define MODEMASK 0x1f +#define NOINT 0xc0 + +#define MCLK (72000000) + /* Vectored Interrupt Controller (VIC) */ -#define VIC_BASE_ADDR 0xFFFFF000 +#define VIC_BASE_ADDR 0xFFFFF000 #define VICIRQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x000)) #define VICFIQStatus (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x004)) #define VICRawIntr (*(volatile unsigned long *)(VIC_BASE_ADDR + 0x008)) @@ -111,7 +111,7 @@ these registers are known as "VICVectPriority(x)". */ /* Pin Connect Block */ -#define PINSEL_BASE_ADDR 0xE002C000 +#define PINSEL_BASE_ADDR 0xE002C000 #define PINSEL0 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x00)) #define PINSEL1 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x04)) #define PINSEL2 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x08)) @@ -137,7 +137,7 @@ these registers are known as "VICVectPriority(x)". */ #define PINMODE9 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x64)) /* General Purpose Input/Output (GPIO) */ -#define GPIO_BASE_ADDR 0xE0028000 +#define GPIO_BASE_ADDR 0xE0028000 #define IOPIN0 (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x00)) #define IOSET0 (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x04)) #define IODIR0 (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x08)) @@ -148,13 +148,13 @@ these registers are known as "VICVectPriority(x)". */ #define IOCLR1 (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x1C)) /* GPIO Interrupt Registers */ -#define IO0_INT_EN_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x90)) +#define IO0_INT_EN_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x90)) #define IO0_INT_EN_F (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x94)) #define IO0_INT_STAT_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x84)) #define IO0_INT_STAT_F (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x88)) #define IO0_INT_CLR (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x8C)) -#define IO2_INT_EN_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0xB0)) +#define IO2_INT_EN_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0xB0)) #define IO2_INT_EN_F (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0xB4)) #define IO2_INT_STAT_R (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0xA4)) #define IO2_INT_STAT_F (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0xA8)) @@ -162,227 +162,227 @@ these registers are known as "VICVectPriority(x)". */ #define IO_INT_STAT (*(volatile unsigned long *)(GPIO_BASE_ADDR + 0x80)) -#define PARTCFG_BASE_ADDR 0x3FFF8000 -#define PARTCFG (*(volatile unsigned long *)(PARTCFG_BASE_ADDR + 0x00)) +#define PARTCFG_BASE_ADDR 0x3FFF8000 +#define PARTCFG (*(volatile unsigned long *)(PARTCFG_BASE_ADDR + 0x00)) /* Fast I/O setup */ -#define FIO_BASE_ADDR 0x3FFFC000 -#define FIO0DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x00)) +#define FIO_BASE_ADDR 0x3FFFC000 +#define FIO0DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x00)) #define FIO0MASK (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x10)) #define FIO0PIN (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x14)) #define FIO0SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x18)) #define FIO0CLR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x1C)) -#define FIO1DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x20)) +#define FIO1DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x20)) #define FIO1MASK (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x30)) #define FIO1PIN (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x34)) #define FIO1SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x38)) #define FIO1CLR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x3C)) -#define FIO2DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x40)) +#define FIO2DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x40)) #define FIO2MASK (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x50)) #define FIO2PIN (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x54)) #define FIO2SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x58)) #define FIO2CLR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x5C)) -#define FIO3DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x60)) +#define FIO3DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x60)) #define FIO3MASK (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x70)) #define FIO3PIN (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x74)) #define FIO3SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x78)) #define FIO3CLR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x7C)) -#define FIO4DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x80)) +#define FIO4DIR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x80)) #define FIO4MASK (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x90)) #define FIO4PIN (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x94)) #define FIO4SET (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x98)) #define FIO4CLR (*(volatile unsigned long *)(FIO_BASE_ADDR + 0x9C)) /* FIOs can be accessed through WORD, HALF-WORD or BYTE. */ -#define FIO0DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x00)) -#define FIO1DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x20)) -#define FIO2DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x40)) -#define FIO3DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x60)) -#define FIO4DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x80)) - -#define FIO0DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x01)) -#define FIO1DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x21)) -#define FIO2DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x41)) -#define FIO3DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x61)) -#define FIO4DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x81)) - -#define FIO0DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x02)) -#define FIO1DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x22)) -#define FIO2DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x42)) -#define FIO3DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x62)) -#define FIO4DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x82)) - -#define FIO0DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x03)) -#define FIO1DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x23)) -#define FIO2DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x43)) -#define FIO3DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x63)) -#define FIO4DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x83)) - -#define FIO0DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x00)) -#define FIO1DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x20)) -#define FIO2DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x40)) -#define FIO3DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x60)) -#define FIO4DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x80)) - -#define FIO0DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x02)) -#define FIO1DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x22)) -#define FIO2DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x42)) -#define FIO3DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x62)) -#define FIO4DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x82)) - -#define FIO0MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x10)) -#define FIO1MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x30)) -#define FIO2MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x50)) -#define FIO3MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x70)) -#define FIO4MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x90)) - -#define FIO0MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x11)) -#define FIO1MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x21)) -#define FIO2MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x51)) -#define FIO3MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x71)) -#define FIO4MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x91)) - -#define FIO0MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x12)) -#define FIO1MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x32)) -#define FIO2MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x52)) -#define FIO3MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x72)) -#define FIO4MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x92)) - -#define FIO0MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x13)) -#define FIO1MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x33)) -#define FIO2MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x53)) -#define FIO3MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x73)) -#define FIO4MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x93)) - -#define FIO0MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x10)) -#define FIO1MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x30)) -#define FIO2MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x50)) -#define FIO3MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x70)) -#define FIO4MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x90)) - -#define FIO0MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x12)) -#define FIO1MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x32)) -#define FIO2MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x52)) -#define FIO3MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x72)) -#define FIO4MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x92)) - -#define FIO0PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x14)) -#define FIO1PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x34)) -#define FIO2PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x54)) -#define FIO3PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x74)) -#define FIO4PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x94)) - -#define FIO0PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x15)) -#define FIO1PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x35)) -#define FIO2PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x55)) -#define FIO3PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x75)) -#define FIO4PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x95)) - -#define FIO0PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x16)) -#define FIO1PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x36)) -#define FIO2PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x56)) -#define FIO3PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x76)) -#define FIO4PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x96)) - -#define FIO0PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x17)) -#define FIO1PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x37)) -#define FIO2PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x57)) -#define FIO3PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x77)) -#define FIO4PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x97)) - -#define FIO0PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x14)) -#define FIO1PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x34)) -#define FIO2PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x54)) -#define FIO3PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x74)) -#define FIO4PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x94)) - -#define FIO0PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x16)) -#define FIO1PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x36)) -#define FIO2PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x56)) -#define FIO3PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x76)) -#define FIO4PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x96)) - -#define FIO0SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x18)) -#define FIO1SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x38)) -#define FIO2SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x58)) -#define FIO3SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x78)) -#define FIO4SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x98)) - -#define FIO0SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x19)) -#define FIO1SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x29)) -#define FIO2SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x59)) -#define FIO3SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x79)) -#define FIO4SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x99)) - -#define FIO0SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1A)) -#define FIO1SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3A)) -#define FIO2SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5A)) -#define FIO3SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7A)) -#define FIO4SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9A)) - -#define FIO0SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1B)) -#define FIO1SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3B)) -#define FIO2SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5B)) -#define FIO3SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7B)) -#define FIO4SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9B)) - -#define FIO0SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x18)) -#define FIO1SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x38)) -#define FIO2SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x58)) -#define FIO3SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x78)) -#define FIO4SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x98)) - -#define FIO0SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1A)) -#define FIO1SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3A)) -#define FIO2SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5A)) -#define FIO3SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7A)) -#define FIO4SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9A)) - -#define FIO0CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1C)) -#define FIO1CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3C)) -#define FIO2CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5C)) -#define FIO3CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7C)) -#define FIO4CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9C)) - -#define FIO0CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1D)) -#define FIO1CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x2D)) -#define FIO2CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5D)) -#define FIO3CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7D)) -#define FIO4CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9D)) - -#define FIO0CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1E)) -#define FIO1CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3E)) -#define FIO2CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5E)) -#define FIO3CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7E)) -#define FIO4CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9E)) - -#define FIO0CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1F)) -#define FIO1CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3F)) -#define FIO2CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5F)) -#define FIO3CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7F)) -#define FIO4CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9F)) - -#define FIO0CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1C)) -#define FIO1CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3C)) -#define FIO2CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5C)) -#define FIO3CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7C)) -#define FIO4CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9C)) - -#define FIO0CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1E)) -#define FIO1CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3E)) -#define FIO2CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5E)) -#define FIO3CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7E)) -#define FIO4CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9E)) +#define FIO0DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x00)) +#define FIO1DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x20)) +#define FIO2DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x40)) +#define FIO3DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x60)) +#define FIO4DIR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x80)) + +#define FIO0DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x01)) +#define FIO1DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x21)) +#define FIO2DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x41)) +#define FIO3DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x61)) +#define FIO4DIR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x81)) + +#define FIO0DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x02)) +#define FIO1DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x22)) +#define FIO2DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x42)) +#define FIO3DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x62)) +#define FIO4DIR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x82)) + +#define FIO0DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x03)) +#define FIO1DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x23)) +#define FIO2DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x43)) +#define FIO3DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x63)) +#define FIO4DIR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x83)) + +#define FIO0DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x00)) +#define FIO1DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x20)) +#define FIO2DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x40)) +#define FIO3DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x60)) +#define FIO4DIRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x80)) + +#define FIO0DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x02)) +#define FIO1DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x22)) +#define FIO2DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x42)) +#define FIO3DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x62)) +#define FIO4DIRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x82)) + +#define FIO0MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x10)) +#define FIO1MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x30)) +#define FIO2MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x50)) +#define FIO3MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x70)) +#define FIO4MASK0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x90)) + +#define FIO0MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x11)) +#define FIO1MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x21)) +#define FIO2MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x51)) +#define FIO3MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x71)) +#define FIO4MASK1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x91)) + +#define FIO0MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x12)) +#define FIO1MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x32)) +#define FIO2MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x52)) +#define FIO3MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x72)) +#define FIO4MASK2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x92)) + +#define FIO0MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x13)) +#define FIO1MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x33)) +#define FIO2MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x53)) +#define FIO3MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x73)) +#define FIO4MASK3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x93)) + +#define FIO0MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x10)) +#define FIO1MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x30)) +#define FIO2MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x50)) +#define FIO3MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x70)) +#define FIO4MASKL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x90)) + +#define FIO0MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x12)) +#define FIO1MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x32)) +#define FIO2MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x52)) +#define FIO3MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x72)) +#define FIO4MASKU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x92)) + +#define FIO0PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x14)) +#define FIO1PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x34)) +#define FIO2PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x54)) +#define FIO3PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x74)) +#define FIO4PIN0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x94)) + +#define FIO0PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x15)) +#define FIO1PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x35)) +#define FIO2PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x55)) +#define FIO3PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x75)) +#define FIO4PIN1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x95)) + +#define FIO0PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x16)) +#define FIO1PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x36)) +#define FIO2PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x56)) +#define FIO3PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x76)) +#define FIO4PIN2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x96)) + +#define FIO0PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x17)) +#define FIO1PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x37)) +#define FIO2PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x57)) +#define FIO3PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x77)) +#define FIO4PIN3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x97)) + +#define FIO0PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x14)) +#define FIO1PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x34)) +#define FIO2PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x54)) +#define FIO3PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x74)) +#define FIO4PINL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x94)) + +#define FIO0PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x16)) +#define FIO1PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x36)) +#define FIO2PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x56)) +#define FIO3PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x76)) +#define FIO4PINU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x96)) + +#define FIO0SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x18)) +#define FIO1SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x38)) +#define FIO2SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x58)) +#define FIO3SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x78)) +#define FIO4SET0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x98)) + +#define FIO0SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x19)) +#define FIO1SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x29)) +#define FIO2SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x59)) +#define FIO3SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x79)) +#define FIO4SET1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x99)) + +#define FIO0SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1A)) +#define FIO1SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3A)) +#define FIO2SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5A)) +#define FIO3SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7A)) +#define FIO4SET2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9A)) + +#define FIO0SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1B)) +#define FIO1SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3B)) +#define FIO2SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5B)) +#define FIO3SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7B)) +#define FIO4SET3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9B)) + +#define FIO0SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x18)) +#define FIO1SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x38)) +#define FIO2SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x58)) +#define FIO3SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x78)) +#define FIO4SETL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x98)) + +#define FIO0SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1A)) +#define FIO1SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3A)) +#define FIO2SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5A)) +#define FIO3SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7A)) +#define FIO4SETU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9A)) + +#define FIO0CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1C)) +#define FIO1CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3C)) +#define FIO2CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5C)) +#define FIO3CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7C)) +#define FIO4CLR0 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9C)) + +#define FIO0CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1D)) +#define FIO1CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x2D)) +#define FIO2CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5D)) +#define FIO3CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7D)) +#define FIO4CLR1 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9D)) + +#define FIO0CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1E)) +#define FIO1CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3E)) +#define FIO2CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5E)) +#define FIO3CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7E)) +#define FIO4CLR2 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9E)) + +#define FIO0CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x1F)) +#define FIO1CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x3F)) +#define FIO2CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x5F)) +#define FIO3CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x7F)) +#define FIO4CLR3 (*(volatile unsigned char *)(FIO_BASE_ADDR + 0x9F)) + +#define FIO0CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1C)) +#define FIO1CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3C)) +#define FIO2CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5C)) +#define FIO3CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7C)) +#define FIO4CLRL (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9C)) + +#define FIO0CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x1E)) +#define FIO1CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x3E)) +#define FIO2CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x5E)) +#define FIO3CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x7E)) +#define FIO4CLRU (*(volatile unsigned short *)(FIO_BASE_ADDR + 0x9E)) /* System Control Block(SCB) modules include Memory Accelerator Module, -Phase Locked Loop, VPB divider, Power Control, External Interrupt, +Phase Locked Loop, VPB divider, Power Control, External Interrupt, Reset, and Code Security/Debugging */ -#define SCB_BASE_ADDR 0xE01FC000 +#define SCB_BASE_ADDR 0xE01FC000 /* Memory Accelerator Module (MAM) */ #define MAMCR (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x000)) @@ -405,7 +405,7 @@ Reset, and Code Security/Debugging */ #define CLKSRCSEL (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x10C)) #define PCLKSEL0 (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x1A8)) #define PCLKSEL1 (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x1AC)) - + /* External Interrupts */ #define EXTINT (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x140)) #define INTWAKE (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x144)) @@ -423,22 +423,22 @@ Reset, and Code Security/Debugging */ #define AHBCFG2 (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x18C)) /* System Controls and Status */ -#define SCS (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x1A0)) +#define SCS (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x1A0)) -/* MPMC(EMC) registers, note: all the external memory controller(EMC) registers +/* MPMC(EMC) registers, note: all the external memory controller(EMC) registers are for LPC24xx only. */ -#define STATIC_MEM0_BASE 0x80000000 -#define STATIC_MEM1_BASE 0x81000000 -#define STATIC_MEM2_BASE 0x82000000 -#define STATIC_MEM3_BASE 0x83000000 +#define STATIC_MEM0_BASE 0x80000000 +#define STATIC_MEM1_BASE 0x81000000 +#define STATIC_MEM2_BASE 0x82000000 +#define STATIC_MEM3_BASE 0x83000000 -#define DYNAMIC_MEM0_BASE 0xA0000000 -#define DYNAMIC_MEM1_BASE 0xB0000000 -#define DYNAMIC_MEM2_BASE 0xC0000000 -#define DYNAMIC_MEM3_BASE 0xD0000000 +#define DYNAMIC_MEM0_BASE 0xA0000000 +#define DYNAMIC_MEM1_BASE 0xB0000000 +#define DYNAMIC_MEM2_BASE 0xC0000000 +#define DYNAMIC_MEM3_BASE 0xD0000000 /* External Memory Controller (EMC) */ -#define EMC_BASE_ADDR 0xFFE08000 +#define EMC_BASE_ADDR 0xFFE08000 #define EMC_CTRL (*(volatile unsigned long *)(EMC_BASE_ADDR + 0x000)) #define EMC_STAT (*(volatile unsigned long *)(EMC_BASE_ADDR + 0x004)) #define EMC_CONFIG (*(volatile unsigned long *)(EMC_BASE_ADDR + 0x008)) @@ -503,9 +503,9 @@ are for LPC24xx only. */ #define EMC_STA_EXT_WAIT (*(volatile unsigned long *)(EMC_BASE_ADDR + 0x880)) - + /* Timer 0 */ -#define TMR0_BASE_ADDR 0xE0004000 +#define TMR0_BASE_ADDR 0xE0004000 #define T0IR (*(volatile unsigned long *)(TMR0_BASE_ADDR + 0x00)) #define T0TCR (*(volatile unsigned long *)(TMR0_BASE_ADDR + 0x04)) #define T0TC (*(volatile unsigned long *)(TMR0_BASE_ADDR + 0x08)) @@ -525,7 +525,7 @@ are for LPC24xx only. */ #define T0CTCR (*(volatile unsigned long *)(TMR0_BASE_ADDR + 0x70)) /* Timer 1 */ -#define TMR1_BASE_ADDR 0xE0008000 +#define TMR1_BASE_ADDR 0xE0008000 #define T1IR (*(volatile unsigned long *)(TMR1_BASE_ADDR + 0x00)) #define T1TCR (*(volatile unsigned long *)(TMR1_BASE_ADDR + 0x04)) #define T1TC (*(volatile unsigned long *)(TMR1_BASE_ADDR + 0x08)) @@ -545,7 +545,7 @@ are for LPC24xx only. */ #define T1CTCR (*(volatile unsigned long *)(TMR1_BASE_ADDR + 0x70)) /* Timer 2 */ -#define TMR2_BASE_ADDR 0xE0070000 +#define TMR2_BASE_ADDR 0xE0070000 #define T2IR (*(volatile unsigned long *)(TMR2_BASE_ADDR + 0x00)) #define T2TCR (*(volatile unsigned long *)(TMR2_BASE_ADDR + 0x04)) #define T2TC (*(volatile unsigned long *)(TMR2_BASE_ADDR + 0x08)) @@ -565,7 +565,7 @@ are for LPC24xx only. */ #define T2CTCR (*(volatile unsigned long *)(TMR2_BASE_ADDR + 0x70)) /* Timer 3 */ -#define TMR3_BASE_ADDR 0xE0074000 +#define TMR3_BASE_ADDR 0xE0074000 #define T3IR (*(volatile unsigned long *)(TMR3_BASE_ADDR + 0x00)) #define T3TCR (*(volatile unsigned long *)(TMR3_BASE_ADDR + 0x04)) #define T3TC (*(volatile unsigned long *)(TMR3_BASE_ADDR + 0x08)) @@ -586,7 +586,7 @@ are for LPC24xx only. */ /* Pulse Width Modulator (PWM) */ -#define PWM0_BASE_ADDR 0xE0014000 +#define PWM0_BASE_ADDR 0xE0014000 #define PWM0IR (*(volatile unsigned long *)(PWM0_BASE_ADDR + 0x00)) #define PWM0TCR (*(volatile unsigned long *)(PWM0_BASE_ADDR + 0x04)) #define PWM0TC (*(volatile unsigned long *)(PWM0_BASE_ADDR + 0x08)) @@ -610,7 +610,7 @@ are for LPC24xx only. */ #define PWM0LER (*(volatile unsigned long *)(PWM0_BASE_ADDR + 0x50)) #define PWM0CTCR (*(volatile unsigned long *)(PWM0_BASE_ADDR + 0x70)) -#define PWM1_BASE_ADDR 0xE0018000 +#define PWM1_BASE_ADDR 0xE0018000 #define PWM1IR (*(volatile unsigned long *)(PWM1_BASE_ADDR + 0x00)) #define PWM1TCR (*(volatile unsigned long *)(PWM1_BASE_ADDR + 0x04)) #define PWM1TC (*(volatile unsigned long *)(PWM1_BASE_ADDR + 0x08)) @@ -636,7 +636,7 @@ are for LPC24xx only. */ /* Universal Asynchronous Receiver Transmitter 0 (UART0) */ -#define UART0_BASE_ADDR 0xE000C000 +#define UART0_BASE_ADDR 0xE000C000 #define U0RBR (*(volatile unsigned long *)(UART0_BASE_ADDR + 0x00)) #define U0THR (*(volatile unsigned long *)(UART0_BASE_ADDR + 0x00)) #define U0DLL (*(volatile unsigned long *)(UART0_BASE_ADDR + 0x00)) @@ -653,7 +653,7 @@ are for LPC24xx only. */ #define U0TER (*(volatile unsigned long *)(UART0_BASE_ADDR + 0x30)) /* Universal Asynchronous Receiver Transmitter 1 (UART1) */ -#define UART1_BASE_ADDR 0xE0010000 +#define UART1_BASE_ADDR 0xE0010000 #define U1RBR (*(volatile unsigned long *)(UART1_BASE_ADDR + 0x00)) #define U1THR (*(volatile unsigned long *)(UART1_BASE_ADDR + 0x00)) #define U1DLL (*(volatile unsigned long *)(UART1_BASE_ADDR + 0x00)) @@ -671,7 +671,7 @@ are for LPC24xx only. */ #define U1TER (*(volatile unsigned long *)(UART1_BASE_ADDR + 0x30)) /* Universal Asynchronous Receiver Transmitter 2 (UART2) */ -#define UART2_BASE_ADDR 0xE0078000 +#define UART2_BASE_ADDR 0xE0078000 #define U2RBR (*(volatile unsigned long *)(UART2_BASE_ADDR + 0x00)) #define U2THR (*(volatile unsigned long *)(UART2_BASE_ADDR + 0x00)) #define U2DLL (*(volatile unsigned long *)(UART2_BASE_ADDR + 0x00)) @@ -688,7 +688,7 @@ are for LPC24xx only. */ #define U2TER (*(volatile unsigned long *)(UART2_BASE_ADDR + 0x30)) /* Universal Asynchronous Receiver Transmitter 3 (UART3) */ -#define UART3_BASE_ADDR 0xE007C000 +#define UART3_BASE_ADDR 0xE007C000 #define U3RBR (*(volatile unsigned long *)(UART3_BASE_ADDR + 0x00)) #define U3THR (*(volatile unsigned long *)(UART3_BASE_ADDR + 0x00)) #define U3DLL (*(volatile unsigned long *)(UART3_BASE_ADDR + 0x00)) @@ -705,7 +705,7 @@ are for LPC24xx only. */ #define U3TER (*(volatile unsigned long *)(UART3_BASE_ADDR + 0x30)) /* I2C Interface 0 */ -#define I2C0_BASE_ADDR 0xE001C000 +#define I2C0_BASE_ADDR 0xE001C000 #define I20CONSET (*(volatile unsigned long *)(I2C0_BASE_ADDR + 0x00)) #define I20STAT (*(volatile unsigned long *)(I2C0_BASE_ADDR + 0x04)) #define I20DAT (*(volatile unsigned long *)(I2C0_BASE_ADDR + 0x08)) @@ -715,7 +715,7 @@ are for LPC24xx only. */ #define I20CONCLR (*(volatile unsigned long *)(I2C0_BASE_ADDR + 0x18)) /* I2C Interface 1 */ -#define I2C1_BASE_ADDR 0xE005C000 +#define I2C1_BASE_ADDR 0xE005C000 #define I21CONSET (*(volatile unsigned long *)(I2C1_BASE_ADDR + 0x00)) #define I21STAT (*(volatile unsigned long *)(I2C1_BASE_ADDR + 0x04)) #define I21DAT (*(volatile unsigned long *)(I2C1_BASE_ADDR + 0x08)) @@ -725,7 +725,7 @@ are for LPC24xx only. */ #define I21CONCLR (*(volatile unsigned long *)(I2C1_BASE_ADDR + 0x18)) /* I2C Interface 2 */ -#define I2C2_BASE_ADDR 0xE0080000 +#define I2C2_BASE_ADDR 0xE0080000 #define I22CONSET (*(volatile unsigned long *)(I2C2_BASE_ADDR + 0x00)) #define I22STAT (*(volatile unsigned long *)(I2C2_BASE_ADDR + 0x04)) #define I22DAT (*(volatile unsigned long *)(I2C2_BASE_ADDR + 0x08)) @@ -735,7 +735,7 @@ are for LPC24xx only. */ #define I22CONCLR (*(volatile unsigned long *)(I2C2_BASE_ADDR + 0x18)) /* SPI0 (Serial Peripheral Interface 0) */ -#define SPI0_BASE_ADDR 0xE0020000 +#define SPI0_BASE_ADDR 0xE0020000 #define S0SPCR (*(volatile unsigned long *)(SPI0_BASE_ADDR + 0x00)) #define S0SPSR (*(volatile unsigned long *)(SPI0_BASE_ADDR + 0x04)) #define S0SPDR (*(volatile unsigned long *)(SPI0_BASE_ADDR + 0x08)) @@ -743,7 +743,7 @@ are for LPC24xx only. */ #define S0SPINT (*(volatile unsigned long *)(SPI0_BASE_ADDR + 0x1C)) /* SSP0 Controller */ -#define SSP0_BASE_ADDR 0xE0068000 +#define SSP0_BASE_ADDR 0xE0068000 #define SSP0CR0 (*(volatile unsigned long *)(SSP0_BASE_ADDR + 0x00)) #define SSP0CR1 (*(volatile unsigned long *)(SSP0_BASE_ADDR + 0x04)) #define SSP0DR (*(volatile unsigned long *)(SSP0_BASE_ADDR + 0x08)) @@ -756,7 +756,7 @@ are for LPC24xx only. */ #define SSP0DMACR (*(volatile unsigned long *)(SSP0_BASE_ADDR + 0x24)) /* SSP1 Controller */ -#define SSP1_BASE_ADDR 0xE0030000 +#define SSP1_BASE_ADDR 0xE0030000 #define SSP1CR0 (*(volatile unsigned long *)(SSP1_BASE_ADDR + 0x00)) #define SSP1CR1 (*(volatile unsigned long *)(SSP1_BASE_ADDR + 0x04)) #define SSP1DR (*(volatile unsigned long *)(SSP1_BASE_ADDR + 0x08)) @@ -770,7 +770,7 @@ are for LPC24xx only. */ /* Real Time Clock */ -#define RTC_BASE_ADDR 0xE0024000 +#define RTC_BASE_ADDR 0xE0024000 #define RTC_ILR (*(volatile unsigned long *)(RTC_BASE_ADDR + 0x00)) #define RTC_CTC (*(volatile unsigned long *)(RTC_BASE_ADDR + 0x04)) #define RTC_CCR (*(volatile unsigned long *)(RTC_BASE_ADDR + 0x08)) @@ -801,7 +801,7 @@ are for LPC24xx only. */ /* A/D Converter 0 (AD0) */ -#define AD0_BASE_ADDR 0xE0034000 +#define AD0_BASE_ADDR 0xE0034000 #define AD0CR (*(volatile unsigned long *)(AD0_BASE_ADDR + 0x00)) #define AD0GDR (*(volatile unsigned long *)(AD0_BASE_ADDR + 0x04)) #define AD0INTEN (*(volatile unsigned long *)(AD0_BASE_ADDR + 0x0C)) @@ -817,12 +817,12 @@ are for LPC24xx only. */ /* D/A Converter */ -#define DAC_BASE_ADDR 0xE006C000 +#define DAC_BASE_ADDR 0xE006C000 #define DACR (*(volatile unsigned long *)(DAC_BASE_ADDR + 0x00)) /* Watchdog */ -#define WDG_BASE_ADDR 0xE0000000 +#define WDG_BASE_ADDR 0xE0000000 #define WDMOD (*(volatile unsigned long *)(WDG_BASE_ADDR + 0x00)) #define WDTC (*(volatile unsigned long *)(WDG_BASE_ADDR + 0x04)) #define WDFEED (*(volatile unsigned long *)(WDG_BASE_ADDR + 0x08)) @@ -830,78 +830,78 @@ are for LPC24xx only. */ #define WDCLKSEL (*(volatile unsigned long *)(WDG_BASE_ADDR + 0x10)) /* CAN CONTROLLERS AND ACCEPTANCE FILTER */ -#define CAN_ACCEPT_BASE_ADDR 0xE003C000 -#define CAN_AFMR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x00)) -#define CAN_SFF_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x04)) -#define CAN_SFF_GRP_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x08)) -#define CAN_EFF_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x0C)) -#define CAN_EFF_GRP_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x10)) -#define CAN_EOT (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x14)) -#define CAN_LUT_ERR_ADR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x18)) -#define CAN_LUT_ERR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x1C)) - -#define CAN_CENTRAL_BASE_ADDR 0xE0040000 -#define CAN_TX_SR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x00)) -#define CAN_RX_SR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x04)) -#define CAN_MSR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x08)) - -#define CAN1_BASE_ADDR 0xE0044000 -#define CAN1MOD (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x00)) -#define CAN1CMR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x04)) -#define CAN1GSR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x08)) -#define CAN1ICR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x0C)) -#define CAN1IER (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x10)) -#define CAN1BTR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x14)) -#define CAN1EWL (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x18)) -#define CAN1SR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x1C)) -#define CAN1RFS (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x20)) -#define CAN1RID (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x24)) -#define CAN1RDA (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x28)) -#define CAN1RDB (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x2C)) - -#define CAN1TFI1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x30)) -#define CAN1TID1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x34)) -#define CAN1TDA1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x38)) -#define CAN1TDB1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x3C)) -#define CAN1TFI2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x40)) -#define CAN1TID2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x44)) -#define CAN1TDA2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x48)) -#define CAN1TDB2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x4C)) -#define CAN1TFI3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x50)) -#define CAN1TID3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x54)) -#define CAN1TDA3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x58)) -#define CAN1TDB3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x5C)) - -#define CAN2_BASE_ADDR 0xE0048000 -#define CAN2MOD (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x00)) -#define CAN2CMR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x04)) -#define CAN2GSR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x08)) -#define CAN2ICR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x0C)) -#define CAN2IER (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x10)) -#define CAN2BTR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x14)) -#define CAN2EWL (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x18)) -#define CAN2SR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x1C)) -#define CAN2RFS (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x20)) -#define CAN2RID (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x24)) -#define CAN2RDA (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x28)) -#define CAN2RDB (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x2C)) - -#define CAN2TFI1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x30)) -#define CAN2TID1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x34)) -#define CAN2TDA1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x38)) -#define CAN2TDB1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x3C)) -#define CAN2TFI2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x40)) -#define CAN2TID2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x44)) -#define CAN2TDA2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x48)) -#define CAN2TDB2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x4C)) -#define CAN2TFI3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x50)) -#define CAN2TID3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x54)) -#define CAN2TDA3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x58)) -#define CAN2TDB3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x5C)) +#define CAN_ACCEPT_BASE_ADDR 0xE003C000 +#define CAN_AFMR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x00)) +#define CAN_SFF_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x04)) +#define CAN_SFF_GRP_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x08)) +#define CAN_EFF_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x0C)) +#define CAN_EFF_GRP_SA (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x10)) +#define CAN_EOT (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x14)) +#define CAN_LUT_ERR_ADR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x18)) +#define CAN_LUT_ERR (*(volatile unsigned long *)(CAN_ACCEPT_BASE_ADDR + 0x1C)) + +#define CAN_CENTRAL_BASE_ADDR 0xE0040000 +#define CAN_TX_SR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x00)) +#define CAN_RX_SR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x04)) +#define CAN_MSR (*(volatile unsigned long *)(CAN_CENTRAL_BASE_ADDR + 0x08)) + +#define CAN1_BASE_ADDR 0xE0044000 +#define CAN1MOD (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x00)) +#define CAN1CMR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x04)) +#define CAN1GSR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x08)) +#define CAN1ICR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x0C)) +#define CAN1IER (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x10)) +#define CAN1BTR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x14)) +#define CAN1EWL (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x18)) +#define CAN1SR (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x1C)) +#define CAN1RFS (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x20)) +#define CAN1RID (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x24)) +#define CAN1RDA (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x28)) +#define CAN1RDB (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x2C)) + +#define CAN1TFI1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x30)) +#define CAN1TID1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x34)) +#define CAN1TDA1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x38)) +#define CAN1TDB1 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x3C)) +#define CAN1TFI2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x40)) +#define CAN1TID2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x44)) +#define CAN1TDA2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x48)) +#define CAN1TDB2 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x4C)) +#define CAN1TFI3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x50)) +#define CAN1TID3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x54)) +#define CAN1TDA3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x58)) +#define CAN1TDB3 (*(volatile unsigned long *)(CAN1_BASE_ADDR + 0x5C)) + +#define CAN2_BASE_ADDR 0xE0048000 +#define CAN2MOD (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x00)) +#define CAN2CMR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x04)) +#define CAN2GSR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x08)) +#define CAN2ICR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x0C)) +#define CAN2IER (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x10)) +#define CAN2BTR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x14)) +#define CAN2EWL (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x18)) +#define CAN2SR (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x1C)) +#define CAN2RFS (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x20)) +#define CAN2RID (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x24)) +#define CAN2RDA (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x28)) +#define CAN2RDB (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x2C)) + +#define CAN2TFI1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x30)) +#define CAN2TID1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x34)) +#define CAN2TDA1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x38)) +#define CAN2TDB1 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x3C)) +#define CAN2TFI2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x40)) +#define CAN2TID2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x44)) +#define CAN2TDA2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x48)) +#define CAN2TDB2 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x4C)) +#define CAN2TFI3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x50)) +#define CAN2TID3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x54)) +#define CAN2TDA3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x58)) +#define CAN2TDB3 (*(volatile unsigned long *)(CAN2_BASE_ADDR + 0x5C)) /* MultiMedia Card Interface(MCI) Controller */ -#define MCI_BASE_ADDR 0xE008C000 +#define MCI_BASE_ADDR 0xE008C000 #define MCI_POWER (*(volatile unsigned long *)(MCI_BASE_ADDR + 0x00)) #define MCI_CLOCK (*(volatile unsigned long *)(MCI_BASE_ADDR + 0x04)) #define MCI_ARGUMENT (*(volatile unsigned long *)(MCI_BASE_ADDR + 0x08)) @@ -924,7 +924,7 @@ are for LPC24xx only. */ /* I2S Interface Controller (I2S) */ -#define I2S_BASE_ADDR 0xE0088000 +#define I2S_BASE_ADDR 0xE0088000 #define I2S_DAO (*(volatile unsigned long *)(I2S_BASE_ADDR + 0x00)) #define I2S_DAI (*(volatile unsigned long *)(I2S_BASE_ADDR + 0x04)) #define I2S_TX_FIFO (*(volatile unsigned long *)(I2S_BASE_ADDR + 0x08)) @@ -938,7 +938,7 @@ are for LPC24xx only. */ /* General-purpose DMA Controller */ -#define DMA_BASE_ADDR 0xFFE04000 +#define DMA_BASE_ADDR 0xFFE04000 #define GPDMA_INT_STAT (*(volatile unsigned long *)(DMA_BASE_ADDR + 0x000)) #define GPDMA_INT_TCSTAT (*(volatile unsigned long *)(DMA_BASE_ADDR + 0x004)) #define GPDMA_INT_TCCLR (*(volatile unsigned long *)(DMA_BASE_ADDR + 0x008)) @@ -970,8 +970,8 @@ are for LPC24xx only. */ /* USB Controller */ -#define USB_INT_BASE_ADDR 0xE01FC1C0 -#define USB_BASE_ADDR 0xFFE0C200 /* USB Base Address */ +#define USB_INT_BASE_ADDR 0xE01FC1C0 +#define USB_BASE_ADDR 0xFFE0C200 /* USB Base Address */ #define USB_INT_STAT (*(volatile unsigned long *)(USB_INT_BASE_ADDR + 0x00)) @@ -1027,7 +1027,7 @@ are for LPC24xx only. */ /* USB Host and OTG registers are for LPC24xx only */ /* USB Host Controller */ -#define USBHC_BASE_ADDR 0xFFE0C000 +#define USBHC_BASE_ADDR 0xFFE0C000 #define HC_REVISION (*(volatile unsigned long *)(USBHC_BASE_ADDR + 0x00)) #define HC_CONTROL (*(volatile unsigned long *)(USBHC_BASE_ADDR + 0x04)) #define HC_CMD_STAT (*(volatile unsigned long *)(USBHC_BASE_ADDR + 0x08)) @@ -1053,16 +1053,16 @@ are for LPC24xx only. */ #define HC_RH_PORT_STAT2 (*(volatile unsigned long *)(USBHC_BASE_ADDR + 0x58)) /* USB OTG Controller */ -#define USBOTG_BASE_ADDR 0xFFE0C100 +#define USBOTG_BASE_ADDR 0xFFE0C100 #define OTG_INT_STAT (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x00)) #define OTG_INT_EN (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x04)) #define OTG_INT_SET (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x08)) #define OTG_INT_CLR (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x0C)) -/* On LPC23xx, the name is USBPortSel, on LPC24xx, the name is OTG_STAT_CTRL */ +/* On LPC23xx, the name is USBPortSel, on LPC24xx, the name is OTG_STAT_CTRL */ #define OTG_STAT_CTRL (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x10)) #define OTG_TIMER (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x14)) -#define USBOTG_I2C_BASE_ADDR 0xFFE0C300 +#define USBOTG_I2C_BASE_ADDR 0xFFE0C300 #define OTG_I2C_RX (*(volatile unsigned long *)(USBOTG_I2C_BASE_ADDR + 0x00)) #define OTG_I2C_TX (*(volatile unsigned long *)(USBOTG_I2C_BASE_ADDR + 0x00)) #define OTG_I2C_STS (*(volatile unsigned long *)(USBOTG_I2C_BASE_ADDR + 0x04)) @@ -1070,20 +1070,20 @@ are for LPC24xx only. */ #define OTG_I2C_CLKHI (*(volatile unsigned long *)(USBOTG_I2C_BASE_ADDR + 0x0C)) #define OTG_I2C_CLKLO (*(volatile unsigned long *)(USBOTG_I2C_BASE_ADDR + 0x10)) -/* On LPC23xx, the names are USBClkCtrl and USBClkSt; on LPC24xx, the names are +/* On LPC23xx, the names are USBClkCtrl and USBClkSt; on LPC24xx, the names are OTG_CLK_CTRL and OTG_CLK_STAT respectively. */ -#define USBOTG_CLK_BASE_ADDR 0xFFE0CFF0 +#define USBOTG_CLK_BASE_ADDR 0xFFE0CFF0 #define OTG_CLK_CTRL (*(volatile unsigned long *)(USBOTG_CLK_BASE_ADDR + 0x04)) #define OTG_CLK_STAT (*(volatile unsigned long *)(USBOTG_CLK_BASE_ADDR + 0x08)) /* Note: below three register name convention is for LPC23xx USB device only, match -with the spec. update in USB Device Section. */ +with the spec. update in USB Device Section. */ #define USBPortSel (*(volatile unsigned long *)(USBOTG_BASE_ADDR + 0x10)) #define USBClkCtrl (*(volatile unsigned long *)(USBOTG_CLK_BASE_ADDR + 0x04)) #define USBClkSt (*(volatile unsigned long *)(USBOTG_CLK_BASE_ADDR + 0x08)) /* Ethernet MAC (32 bit data bus) -- all registers are RW unless indicated in parentheses */ -#define MAC_BASE_ADDR 0xFFE00000 /* AHB Peripheral # 0 */ +#define MAC_BASE_ADDR 0xFFE00000 /* AHB Peripheral # 0 */ #define MAC_MAC1 (*(volatile unsigned long *)(MAC_BASE_ADDR + 0x000)) /* MAC config reg 1 */ #define MAC_MAC2 (*(volatile unsigned long *)(MAC_BASE_ADDR + 0x004)) /* MAC config reg 2 */ #define MAC_IPGT (*(volatile unsigned long *)(MAC_BASE_ADDR + 0x008)) /* b2b InterPacketGap reg */ @@ -1139,7 +1139,7 @@ with the spec. update in USB Device Section. */ #define MAC_MODULEID (*(volatile unsigned long *)(MAC_BASE_ADDR + 0xFFC)) /* Module ID reg (RO) */ /* LCD Controller registers */ -#define LCD_BASE_ADDR 0xFFE10000 /* AHB Peripheral # 4 */ +#define LCD_BASE_ADDR 0xFFE10000 /* AHB Peripheral # 4 */ #define LCD_CFG (*(volatile unsigned long *)(0xE01FC1B8)) #define LCD_TIMH (*(volatile unsigned long *)(LCD_BASE_ADDR + 0x000)) #define LCD_TIMV (*(volatile unsigned long *)(LCD_BASE_ADDR + 0x004)) @@ -1169,24 +1169,24 @@ with the spec. update in USB Device Section. */ struct rt_hw_register { - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; - unsigned long ORIG_r0; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long sp; + unsigned long lr; + unsigned long pc; + unsigned long cpsr; + unsigned long ORIG_r0; }; #ifdef __cplusplus diff --git a/libcpu/arm/lpc24xx/cpu.c b/libcpu/arm/lpc24xx/cpu.c index f3a61e16a..071535180 100644 --- a/libcpu/arm/lpc24xx/cpu.c +++ b/libcpu/arm/lpc24xx/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -30,9 +30,9 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } /*@}*/ diff --git a/libcpu/arm/lpc24xx/interrupt.c b/libcpu/arm/lpc24xx/interrupt.c index a855de1e1..87bb86b87 100644 --- a/libcpu/arm/lpc24xx/interrupt.c +++ b/libcpu/arm/lpc24xx/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,10 +13,10 @@ #include #include "LPC24xx.h" -#define MAX_HANDLERS 32 +#define MAX_HANDLERS 32 /* exception and interrupt handler table */ -struct rt_irq_desc irq_desc[MAX_HANDLERS]; +struct rt_irq_desc irq_desc[MAX_HANDLERS]; extern rt_uint32_t rt_interrupt_nest; @@ -30,19 +30,19 @@ rt_uint32_t rt_thread_switch_interrupt_flag; /*@{*/ void rt_hw_interrupt_handler(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } void rt_hw_interrupt_init(void) { - register int i; + register int i; - rt_uint32_t *vect_addr, *vect_cntl; - - /* initialize VIC*/ - VICIntEnClr = 0xffffffff; - VICVectAddr = 0; - VICIntSelect = 0; + rt_uint32_t *vect_addr, *vect_cntl; + + /* initialize VIC*/ + VICIntEnClr = 0xffffffff; + VICVectAddr = 0; + VICIntSelect = 0; /* init exceptions table */ rt_memset(irq_desc, 0x00, sizeof(irq_desc)); @@ -50,27 +50,27 @@ void rt_hw_interrupt_init(void) { irq_desc[i].handler = rt_hw_interrupt_handler; - vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + i*4); - vect_cntl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + i*4); - *vect_addr = (rt_uint32_t)&irq_desc[i]; - *vect_cntl = 0xF; + vect_addr = (rt_uint32_t *)(VIC_BASE_ADDR + 0x100 + i*4); + vect_cntl = (rt_uint32_t *)(VIC_BASE_ADDR + 0x200 + i*4); + *vect_addr = (rt_uint32_t)&irq_desc[i]; + *vect_cntl = 0xF; } - - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } void rt_hw_interrupt_mask(int vector) { - VICIntEnClr = (1 << vector); + VICIntEnClr = (1 << vector); } void rt_hw_interrupt_umask(int vector) { - VICIntEnable = (1 << vector); + VICIntEnable = (1 << vector); } /** @@ -82,22 +82,22 @@ void rt_hw_interrupt_umask(int vector) * * @return the old handler */ -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) +rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, + void *param, const char *name) { - rt_isr_handler_t old_handler = RT_NULL; - - if(vector >= 0 && vector < MAX_HANDLERS) - { - old_handler = irq_desc[vector].handler; - if (handler != RT_NULL) - { - irq_desc[vector].handler = handler; - irq_desc[vector].param = param; - } - } - - return old_handler; + rt_isr_handler_t old_handler = RT_NULL; + + if(vector >= 0 && vector < MAX_HANDLERS) + { + old_handler = irq_desc[vector].handler; + if (handler != RT_NULL) + { + irq_desc[vector].handler = handler; + irq_desc[vector].param = param; + } + } + + return old_handler; } /*@}*/ diff --git a/libcpu/arm/lpc24xx/stack.c b/libcpu/arm/lpc24xx/stack.c index 0378a5f65..a7bce755b 100644 --- a/libcpu/arm/lpc24xx/stack.c +++ b/libcpu/arm/lpc24xx/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/lpc24xx/trap.c b/libcpu/arm/lpc24xx/trap.c index d296bfdbf..7ad7328a9 100644 --- a/libcpu/arm/lpc24xx/trap.c +++ b/libcpu/arm/lpc24xx/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -27,13 +27,13 @@ */ void rt_hw_show_register (struct rt_hw_register *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -48,8 +48,8 @@ void rt_hw_trap_udef(struct rt_hw_register *regs) { rt_kprintf("undefined instruction\n"); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } @@ -66,8 +66,8 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) { rt_kprintf("software interrupt\n"); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } @@ -83,8 +83,8 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) { rt_kprintf("prefetch abort\n"); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } @@ -97,11 +97,11 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) * @note never invoke this function in application */ void rt_hw_trap_dabt(struct rt_hw_register *regs) -{ +{ rt_kprintf("Data Abort "); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } @@ -116,27 +116,27 @@ void rt_hw_trap_resv(struct rt_hw_register *regs) { rt_kprintf("not used\n"); rt_hw_show_register(regs); - if (rt_thread_self() != RT_NULL) - rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); + if (rt_thread_self() != RT_NULL) + rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); } extern rt_isr_handler_t isr_table[]; void rt_hw_trap_irq(void) { - int irqno; - struct rt_irq_desc* irq; - extern struct rt_irq_desc irq_desc[]; + int irqno; + struct rt_irq_desc* irq; + extern struct rt_irq_desc irq_desc[]; - irq = (struct rt_irq_desc*) VICVectAddr; - irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); + irq = (struct rt_irq_desc*) VICVectAddr; + irqno = ((rt_uint32_t) irq - (rt_uint32_t) &irq_desc[0])/sizeof(struct rt_irq_desc); - /* invoke isr */ - irq->handler(irqno, irq->param); + /* invoke isr */ + irq->handler(irqno, irq->param); } void rt_hw_trap_fiq(void) -{ +{ rt_kprintf("fast interrupt request\n"); } diff --git a/libcpu/arm/realview-a8-vmm/armv7.h b/libcpu/arm/realview-a8-vmm/armv7.h index d22f72fa6..f284bb525 100644 --- a/libcpu/arm/realview-a8-vmm/armv7.h +++ b/libcpu/arm/realview-a8-vmm/armv7.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,43 +12,43 @@ /* the exception stack without VFP registers */ struct rt_hw_exp_stack { - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long sp; + unsigned long lr; + unsigned long pc; + unsigned long cpsr; }; struct rt_hw_stack { - unsigned long cpsr; - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long lr; - unsigned long pc; + unsigned long cpsr; + unsigned long r0; + unsigned long r1; + unsigned long r2; + unsigned long r3; + unsigned long r4; + unsigned long r5; + unsigned long r6; + unsigned long r7; + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long fp; + unsigned long ip; + unsigned long lr; + unsigned long pc; }; #define USERMODE 0x10 diff --git a/libcpu/arm/realview-a8-vmm/cp15.h b/libcpu/arm/realview-a8-vmm/cp15.h index 486f38200..b18331af9 100644 --- a/libcpu/arm/realview-a8-vmm/cp15.h +++ b/libcpu/arm/realview-a8-vmm/cp15.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/cpu.c b/libcpu/arm/realview-a8-vmm/cpu.c index 2d7871501..5f82671c1 100644 --- a/libcpu/arm/realview-a8-vmm/cpu.c +++ b/libcpu/arm/realview-a8-vmm/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,14 +20,14 @@ /** shutdown CPU */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); + rt_uint32_t level; + rt_kprintf("shutdown...\n"); - level = rt_hw_interrupt_disable(); - while (level) - { - RT_ASSERT(0); - } + level = rt_hw_interrupt_disable(); + while (level) + { + RT_ASSERT(0); + } } /*@}*/ diff --git a/libcpu/arm/realview-a8-vmm/gic.c b/libcpu/arm/realview-a8-vmm/gic.c index 82f87b7e8..962317821 100644 --- a/libcpu/arm/realview-a8-vmm/gic.c +++ b/libcpu/arm/realview-a8-vmm/gic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/gic.h b/libcpu/arm/realview-a8-vmm/gic.h index 8fcdf05f6..7c781ad4d 100644 --- a/libcpu/arm/realview-a8-vmm/gic.h +++ b/libcpu/arm/realview-a8-vmm/gic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/interrupt.c b/libcpu/arm/realview-a8-vmm/interrupt.c index 5ef0bdc46..d57588644 100644 --- a/libcpu/arm/realview-a8-vmm/interrupt.c +++ b/libcpu/arm/realview-a8-vmm/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/interrupt.h b/libcpu/arm/realview-a8-vmm/interrupt.h index 7461f94da..90f392f40 100644 --- a/libcpu/arm/realview-a8-vmm/interrupt.h +++ b/libcpu/arm/realview-a8-vmm/interrupt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -14,28 +14,28 @@ #define INT_IRQ 0x00 #define INT_FIQ 0x01 -#define INTC_REVISION(hw_base) REG32((hw_base) + 0x0) -#define INTC_SYSCONFIG(hw_base) REG32((hw_base) + 0x10) -#define INTC_SYSSTATUS(hw_base) REG32((hw_base) + 0x14) -#define INTC_SIR_IRQ(hw_base) REG32((hw_base) + 0x40) -#define INTC_SIR_FIQ(hw_base) REG32((hw_base) + 0x44) -#define INTC_CONTROL(hw_base) REG32((hw_base) + 0x48) -#define INTC_PROTECTION(hw_base) REG32((hw_base) + 0x4c) -#define INTC_IDLE(hw_base) REG32((hw_base) + 0x50) -#define INTC_IRQ_PRIORITY(hw_base) REG32((hw_base) + 0x60) -#define INTC_FIQ_PRIORITY(hw_base) REG32((hw_base) + 0x64) -#define INTC_THRESHOLD(hw_base) REG32((hw_base) + 0x68) -#define INTC_SICR(hw_base) REG32((hw_base) + 0x6c) -#define INTC_SCR(hw_base, n) REG32((hw_base) + 0x70 + ((n) * 0x04)) -#define INTC_ITR(hw_base, n) REG32((hw_base) + 0x80 + ((n) * 0x20)) -#define INTC_MIR(hw_base, n) REG32((hw_base) + 0x84 + ((n) * 0x20)) -#define INTC_MIR_CLEAR(hw_base, n) REG32((hw_base) + 0x88 + ((n) * 0x20)) -#define INTC_MIR_SET(hw_base, n) REG32((hw_base) + 0x8c + ((n) * 0x20)) -#define INTC_ISR_SET(hw_base, n) REG32((hw_base) + 0x90 + ((n) * 0x20)) -#define INTC_ISR_CLEAR(hw_base, n) REG32((hw_base) + 0x94 + ((n) * 0x20)) +#define INTC_REVISION(hw_base) REG32((hw_base) + 0x0) +#define INTC_SYSCONFIG(hw_base) REG32((hw_base) + 0x10) +#define INTC_SYSSTATUS(hw_base) REG32((hw_base) + 0x14) +#define INTC_SIR_IRQ(hw_base) REG32((hw_base) + 0x40) +#define INTC_SIR_FIQ(hw_base) REG32((hw_base) + 0x44) +#define INTC_CONTROL(hw_base) REG32((hw_base) + 0x48) +#define INTC_PROTECTION(hw_base) REG32((hw_base) + 0x4c) +#define INTC_IDLE(hw_base) REG32((hw_base) + 0x50) +#define INTC_IRQ_PRIORITY(hw_base) REG32((hw_base) + 0x60) +#define INTC_FIQ_PRIORITY(hw_base) REG32((hw_base) + 0x64) +#define INTC_THRESHOLD(hw_base) REG32((hw_base) + 0x68) +#define INTC_SICR(hw_base) REG32((hw_base) + 0x6c) +#define INTC_SCR(hw_base, n) REG32((hw_base) + 0x70 + ((n) * 0x04)) +#define INTC_ITR(hw_base, n) REG32((hw_base) + 0x80 + ((n) * 0x20)) +#define INTC_MIR(hw_base, n) REG32((hw_base) + 0x84 + ((n) * 0x20)) +#define INTC_MIR_CLEAR(hw_base, n) REG32((hw_base) + 0x88 + ((n) * 0x20)) +#define INTC_MIR_SET(hw_base, n) REG32((hw_base) + 0x8c + ((n) * 0x20)) +#define INTC_ISR_SET(hw_base, n) REG32((hw_base) + 0x90 + ((n) * 0x20)) +#define INTC_ISR_CLEAR(hw_base, n) REG32((hw_base) + 0x94 + ((n) * 0x20)) #define INTC_PENDING_IRQ(hw_base, n) REG32((hw_base) + 0x98 + ((n) * 0x20)) #define INTC_PENDING_FIQ(hw_base, n) REG32((hw_base) + 0x9c + ((n) * 0x20)) -#define INTC_ILR(hw_base, n) REG32((hw_base) + 0x100 + ((n) * 0x04)) +#define INTC_ILR(hw_base, n) REG32((hw_base) + 0x100 + ((n) * 0x04)) void rt_hw_interrupt_control(int vector, int priority, int route); int rt_hw_interrupt_get_active(int fiq_irq); diff --git a/libcpu/arm/realview-a8-vmm/mmu.c b/libcpu/arm/realview-a8-vmm/mmu.c index 58acdd814..f4d606809 100644 --- a/libcpu/arm/realview-a8-vmm/mmu.c +++ b/libcpu/arm/realview-a8-vmm/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/pmu.c b/libcpu/arm/realview-a8-vmm/pmu.c index 8ffc1dede..2b9165cc8 100644 --- a/libcpu/arm/realview-a8-vmm/pmu.c +++ b/libcpu/arm/realview-a8-vmm/pmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/pmu.h b/libcpu/arm/realview-a8-vmm/pmu.h index fb8390133..64a74b5d3 100644 --- a/libcpu/arm/realview-a8-vmm/pmu.h +++ b/libcpu/arm/realview-a8-vmm/pmu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/stack.c b/libcpu/arm/realview-a8-vmm/stack.c index 619a16c44..8cf73ac05 100644 --- a/libcpu/arm/realview-a8-vmm/stack.c +++ b/libcpu/arm/realview-a8-vmm/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/realview-a8-vmm/trap.c b/libcpu/arm/realview-a8-vmm/trap.c index 4a522f512..c6ca45aee 100644 --- a/libcpu/arm/realview-a8-vmm/trap.c +++ b/libcpu/arm/realview-a8-vmm/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -131,7 +131,7 @@ void rt_hw_trap_resv(struct rt_hw_exp_stack *regs) rt_hw_cpu_shutdown(); } -#define GIC_ACK_INTID_MASK 0x000003ff +#define GIC_ACK_INTID_MASK 0x000003ff void rt_hw_trap_irq(void) { diff --git a/libcpu/arm/s3c24x0/cpu.c b/libcpu/arm/s3c24x0/cpu.c index 4d3bf3c1a..ac4037c7b 100644 --- a/libcpu/arm/s3c24x0/cpu.c +++ b/libcpu/arm/s3c24x0/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -17,76 +17,76 @@ */ /*@{*/ -#define ICACHE_MASK (rt_uint32_t)(1 << 12) -#define DCACHE_MASK (rt_uint32_t)(1 << 2) +#define ICACHE_MASK (rt_uint32_t)(1 << 12) +#define DCACHE_MASK (rt_uint32_t)(1 << 2) #ifdef __GNUC__ rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - return i; + asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "orr r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "orr r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } rt_inline void cache_disable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "bic r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "bic r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } #endif #ifdef __CC_ARM rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - __asm - { - mrc p15, 0, i, c1, c0, 0 - } + __asm + { + mrc p15, 0, i, c1, c0, 0 + } - return i; + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } rt_inline void cache_disable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } #endif @@ -96,7 +96,7 @@ rt_inline void cache_disable(rt_uint32_t bit) */ void rt_hw_cpu_icache_enable() { - cache_enable(ICACHE_MASK); + cache_enable(ICACHE_MASK); } /** @@ -105,7 +105,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - cache_disable(ICACHE_MASK); + cache_disable(ICACHE_MASK); } /** @@ -114,7 +114,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return (cp15_rd() & ICACHE_MASK); + return (cp15_rd() & ICACHE_MASK); } /** @@ -123,7 +123,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - cache_enable(DCACHE_MASK); + cache_enable(DCACHE_MASK); } /** @@ -132,7 +132,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - cache_disable(DCACHE_MASK); + cache_disable(DCACHE_MASK); } /** @@ -141,7 +141,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return (cp15_rd() & DCACHE_MASK); + return (cp15_rd() & DCACHE_MASK); } /** @@ -150,21 +150,21 @@ rt_base_t rt_hw_cpu_dcache_status() */ void rt_hw_cpu_reset() { - /* Disable all interrupt except the WDT */ - INTMSK = (~((rt_uint32_t)1 << INTWDT)); + /* Disable all interrupt except the WDT */ + INTMSK = (~((rt_uint32_t)1 << INTWDT)); - /* Disable watchdog */ - WTCON = 0x0000; + /* Disable watchdog */ + WTCON = 0x0000; - /* Initialize watchdog timer count register */ - WTCNT = 0x0001; + /* Initialize watchdog timer count register */ + WTCNT = 0x0001; - /* Enable watchdog timer; assert reset at timer timeout */ - WTCON = 0x0021; + /* Enable watchdog timer; assert reset at timer timeout */ + WTCON = 0x0021; - while(1); /* loop forever and wait for reset to happen */ + while(1); /* loop forever and wait for reset to happen */ - /* NEVER REACHED */ + /* NEVER REACHED */ } /** @@ -173,14 +173,14 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); - - level = rt_hw_interrupt_disable(); - while (level) - { - RT_ASSERT(0); - } + rt_uint32_t level; + rt_kprintf("shutdown...\n"); + + level = rt_hw_interrupt_disable(); + while (level) + { + RT_ASSERT(0); + } } /*@}*/ diff --git a/libcpu/arm/s3c24x0/interrupt.c b/libcpu/arm/s3c24x0/interrupt.c index 8c7aebeb2..c985fc7c8 100644 --- a/libcpu/arm/s3c24x0/interrupt.c +++ b/libcpu/arm/s3c24x0/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,7 +13,7 @@ #include #include "s3c24x0.h" -#define MAX_HANDLERS 32 +#define MAX_HANDLERS 32 extern rt_uint32_t rt_interrupt_nest; @@ -29,7 +29,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; static void rt_hw_interrupt_handle(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -77,7 +77,7 @@ void rt_hw_interrupt_init(void) */ void rt_hw_interrupt_mask(int vector) { - INTMSK |= 1 << vector; + INTMSK |= 1 << vector; } /** @@ -86,15 +86,15 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - if (vector == INTNOTUSED6) - { - rt_kprintf("Interrupt vec %d is not used!\n", vector); - // while(1); - } - else if (vector == INTGLOBAL) - INTMSK = 0x0; - else - INTMSK &= ~(1 << vector); + if (vector == INTNOTUSED6) + { + rt_kprintf("Interrupt vec %d is not used!\n", vector); + // while(1); + } + else if (vector == INTGLOBAL) + INTMSK = 0x0; + else + INTMSK &= ~(1 << vector); } /** @@ -115,9 +115,9 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, if (handler != RT_NULL) { #ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); + rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); #endif /* RT_USING_INTERRUPT_INFO */ - isr_table[vector].handler = handler; + isr_table[vector].handler = handler; isr_table[vector].param = param; } } diff --git a/libcpu/arm/s3c24x0/mmu.c b/libcpu/arm/s3c24x0/mmu.c index dc993ec9a..4e5ef8d3c 100644 --- a/libcpu/arm/s3c24x0/mmu.c +++ b/libcpu/arm/s3c24x0/mmu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -12,158 +12,158 @@ #include #include "s3c24x0.h" -#define _MMUTT_STARTADDRESS 0x33FF0000 +#define _MMUTT_STARTADDRESS 0x33FF0000 -#define DESC_SEC (0x2|(1<<4)) -#define CB (3<<2) //cache_on, write_back -#define CNB (2<<2) //cache_on, write_through -#define NCB (1<<2) //cache_off,WR_BUF on -#define NCNB (0<<2) //cache_off,WR_BUF off -#define AP_RW (3<<10) //supervisor=RW, user=RW -#define AP_RO (2<<10) //supervisor=RW, user=RO +#define DESC_SEC (0x2|(1<<4)) +#define CB (3<<2) //cache_on, write_back +#define CNB (2<<2) //cache_on, write_through +#define NCB (1<<2) //cache_off,WR_BUF on +#define NCNB (0<<2) //cache_off,WR_BUF off +#define AP_RW (3<<10) //supervisor=RW, user=RW +#define AP_RO (2<<10) //supervisor=RW, user=RO -#define DOMAIN_FAULT (0x0) -#define DOMAIN_CHK (0x1) -#define DOMAIN_NOTCHK (0x3) -#define DOMAIN0 (0x0<<5) -#define DOMAIN1 (0x1<<5) +#define DOMAIN_FAULT (0x0) +#define DOMAIN_CHK (0x1) +#define DOMAIN_NOTCHK (0x3) +#define DOMAIN0 (0x0<<5) +#define DOMAIN1 (0x1<<5) -#define DOMAIN0_ATTR (DOMAIN_CHK<<0) -#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) +#define DOMAIN0_ATTR (DOMAIN_CHK<<0) +#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) -#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) -#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) -#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) -#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) +#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) +#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) +#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) +#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) #ifdef __GNUC__ void mmu_setttbase(register rt_uint32_t i) { - asm volatile ("mcr p15, 0, %0, c2, c0, 0": :"r" (i)); + asm volatile ("mcr p15, 0, %0, c2, c0, 0": :"r" (i)); } void mmu_set_domain(register rt_uint32_t i) { - asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); + asm volatile ("mcr p15,0, %0, c3, c0, 0": :"r" (i)); } void mmu_enable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= 0x1; + i |= 0x1; - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~0x1; + i &= ~0x1; - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 12); + i |= (1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 2); + i |= (1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_icache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 12); + i &= ~(1 << 12); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_dcache() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 2); + i &= ~(1 << 2); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_enable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i |= (1 << 1); + i |= (1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_disable_alignfault() { - register rt_uint32_t i; + register rt_uint32_t i; - /* read control register */ - asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + /* read control register */ + asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - i &= ~(1 << 1); + i &= ~(1 << 1); - /* write back to control register */ - asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); + /* write back to control register */ + asm volatile ("mcr p15, 0, %0, c1, c0, 0": :"r" (i)); } void mmu_clean_invalidated_cache_index(int index) { - asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); + asm volatile ("mcr p15, 0, %0, c7, c14, 2": :"r" (index)); } void mmu_invalidate_tlb() { - asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c8, c7, 0": :"r" (0)); } void mmu_invalidate_icache() { - asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); + asm volatile ("mcr p15, 0, %0, c7, c5, 0": :"r" (0)); } #endif @@ -320,71 +320,71 @@ void mmu_setmtt(int vaddrStart,int vaddrEnd,int paddrStart,int attr) nSec=(vaddrEnd>>20)-(vaddrStart>>20); for(i=0;i<=nSec;i++) { - *pTT = attr |(((paddrStart>>20)+i)<<20); - pTT++; + *pTT = attr |(((paddrStart>>20)+i)<<20); + pTT++; } } void rt_hw_mmu_init(void) { - int i,j; - //========================== IMPORTANT NOTE ========================= - //The current stack and code area can't be re-mapped in this routine. - //If you want memory map mapped freely, your own sophiscated mmu - //initialization code is needed. - //=================================================================== - - mmu_disable_dcache(); - mmu_disable_icache(); - - //If write-back is used,the DCache should be cleared. - for(i=0;i<64;i++) - for(j=0;j<8;j++) - mmu_clean_invalidated_cache_index((i<<26)|(j<<5)); - - mmu_invalidate_icache(); - - //To complete mmu_Init() fast, Icache may be turned on here. - mmu_enable_icache(); - - mmu_disable(); - mmu_invalidate_tlb(); - - //mmu_setmtt(int vaddrStart,int vaddrEnd,int paddrStart,int attr); - mmu_setmtt(0x00000000,0x07f00000,0x00000000,RW_CNB); //bank0 - mmu_setmtt(0x00000000,0x03f00000,(int)0x30000000,RW_CB); //bank0 - mmu_setmtt(0x04000000,0x07f00000,0,RW_NCNB); //bank0 - mmu_setmtt(0x08000000,0x0ff00000,0x08000000,RW_CNB); //bank1 - mmu_setmtt(0x10000000,0x17f00000,0x10000000,RW_NCNB); //bank2 - mmu_setmtt(0x18000000,0x1ff00000,0x18000000,RW_NCNB); //bank3 - //mmu_setmtt(0x20000000,0x27f00000,0x20000000,RW_CB); //bank4 - mmu_setmtt(0x20000000,0x27f00000,0x20000000,RW_NCNB); //bank4 for DM9000 - mmu_setmtt(0x28000000,0x2ff00000,0x28000000,RW_NCNB); //bank5 - //30f00000->30100000, 31000000->30200000 - mmu_setmtt(0x30000000,0x30100000,0x30000000,RW_CB); //bank6-1 - mmu_setmtt(0x30200000,0x33e00000,0x30200000,RW_CB); //bank6-2 - - mmu_setmtt(0x33f00000,0x34000000,0x33f00000,RW_NCNB); //bank6-3 - mmu_setmtt(0x38000000,0x3ff00000,0x38000000,RW_NCNB); //bank7 - - mmu_setmtt(0x40000000,0x47f00000,0x40000000,RW_NCNB); //SFR - mmu_setmtt(0x48000000,0x5af00000,0x48000000,RW_NCNB); //SFR - mmu_setmtt(0x5b000000,0x5b000000,0x5b000000,RW_NCNB); //SFR - mmu_setmtt(0x5b100000,0xfff00000,0x5b100000,RW_FAULT);//not used - mmu_setmtt(0x60000000,0x67f00000,0x60000000,RW_NCNB); //SFR - - mmu_setttbase(_MMUTT_STARTADDRESS); - - /* DOMAIN1: no_access, DOMAIN0,2~15=client(AP is checked) */ - mmu_set_domain(0x55555550|DOMAIN1_ATTR|DOMAIN0_ATTR); - - mmu_enable_alignfault(); - - mmu_enable(); - - /* ICache enable */ - mmu_enable_icache(); - /* DCache should be turned on after mmu is turned on. */ - mmu_enable_dcache(); + int i,j; + //========================== IMPORTANT NOTE ========================= + //The current stack and code area can't be re-mapped in this routine. + //If you want memory map mapped freely, your own sophiscated mmu + //initialization code is needed. + //=================================================================== + + mmu_disable_dcache(); + mmu_disable_icache(); + + //If write-back is used,the DCache should be cleared. + for(i=0;i<64;i++) + for(j=0;j<8;j++) + mmu_clean_invalidated_cache_index((i<<26)|(j<<5)); + + mmu_invalidate_icache(); + + //To complete mmu_Init() fast, Icache may be turned on here. + mmu_enable_icache(); + + mmu_disable(); + mmu_invalidate_tlb(); + + //mmu_setmtt(int vaddrStart,int vaddrEnd,int paddrStart,int attr); + mmu_setmtt(0x00000000,0x07f00000,0x00000000,RW_CNB); //bank0 + mmu_setmtt(0x00000000,0x03f00000,(int)0x30000000,RW_CB); //bank0 + mmu_setmtt(0x04000000,0x07f00000,0,RW_NCNB); //bank0 + mmu_setmtt(0x08000000,0x0ff00000,0x08000000,RW_CNB); //bank1 + mmu_setmtt(0x10000000,0x17f00000,0x10000000,RW_NCNB); //bank2 + mmu_setmtt(0x18000000,0x1ff00000,0x18000000,RW_NCNB); //bank3 + //mmu_setmtt(0x20000000,0x27f00000,0x20000000,RW_CB); //bank4 + mmu_setmtt(0x20000000,0x27f00000,0x20000000,RW_NCNB); //bank4 for DM9000 + mmu_setmtt(0x28000000,0x2ff00000,0x28000000,RW_NCNB); //bank5 + //30f00000->30100000, 31000000->30200000 + mmu_setmtt(0x30000000,0x30100000,0x30000000,RW_CB); //bank6-1 + mmu_setmtt(0x30200000,0x33e00000,0x30200000,RW_CB); //bank6-2 + + mmu_setmtt(0x33f00000,0x34000000,0x33f00000,RW_NCNB); //bank6-3 + mmu_setmtt(0x38000000,0x3ff00000,0x38000000,RW_NCNB); //bank7 + + mmu_setmtt(0x40000000,0x47f00000,0x40000000,RW_NCNB); //SFR + mmu_setmtt(0x48000000,0x5af00000,0x48000000,RW_NCNB); //SFR + mmu_setmtt(0x5b000000,0x5b000000,0x5b000000,RW_NCNB); //SFR + mmu_setmtt(0x5b100000,0xfff00000,0x5b100000,RW_FAULT);//not used + mmu_setmtt(0x60000000,0x67f00000,0x60000000,RW_NCNB); //SFR + + mmu_setttbase(_MMUTT_STARTADDRESS); + + /* DOMAIN1: no_access, DOMAIN0,2~15=client(AP is checked) */ + mmu_set_domain(0x55555550|DOMAIN1_ATTR|DOMAIN0_ATTR); + + mmu_enable_alignfault(); + + mmu_enable(); + + /* ICache enable */ + mmu_enable_icache(); + /* DCache should be turned on after mmu is turned on. */ + mmu_enable_dcache(); } diff --git a/libcpu/arm/s3c24x0/rtc.c b/libcpu/arm/s3c24x0/rtc.c index d0c80bce6..653bb09f7 100644 --- a/libcpu/arm/s3c24x0/rtc.c +++ b/libcpu/arm/s3c24x0/rtc.c @@ -1,14 +1,14 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2009-04-26 yi.qiu first version - * 2010-03-18 Gary Lee add functions such as GregorianDay - * and rtc_time_to_tm - * 2009-03-20 yi.qiu clean up + * 2009-04-26 yi.qiu first version + * 2010-03-18 Gary Lee add functions such as GregorianDay + * and rtc_time_to_tm + * 2009-03-20 yi.qiu clean up */ #include @@ -17,50 +17,50 @@ // #define RTC_DEBUG -#define RTC_ENABLE RTCCON |= 0x01; /*RTC read and write enable */ -#define RTC_DISABLE RTCCON &= ~0x01; /* RTC read and write disable */ -#define BCD2BIN(n) (((((n) >> 4) & 0x0F) * 10) + ((n) & 0x0F)) -#define BIN2BCD(n) ((((n) / 10) << 4) | ((n) % 10)) +#define RTC_ENABLE RTCCON |= 0x01; /*RTC read and write enable */ +#define RTC_DISABLE RTCCON &= ~0x01; /* RTC read and write disable */ +#define BCD2BIN(n) (((((n) >> 4) & 0x0F) * 10) + ((n) & 0x0F)) +#define BIN2BCD(n) ((((n) / 10) << 4) | ((n) % 10)) /** * This function get rtc time */ void rt_hw_rtc_get(struct tm *ti) { - rt_uint8_t sec, min, hour, mday, wday, mon, year; - - /* enable access to RTC registers */ - RTCCON |= RTC_ENABLE; - - /* read RTC registers */ - do - { - sec = BCDSEC; - min = BCDMIN; - hour = BCDHOUR; - mday = BCDDATE; - wday = BCDDAY; - mon = BCDMON; - year = BCDYEAR; + rt_uint8_t sec, min, hour, mday, wday, mon, year; + + /* enable access to RTC registers */ + RTCCON |= RTC_ENABLE; + + /* read RTC registers */ + do + { + sec = BCDSEC; + min = BCDMIN; + hour = BCDHOUR; + mday = BCDDATE; + wday = BCDDAY; + mon = BCDMON; + year = BCDYEAR; } while (sec != BCDSEC); #ifdef RTC_DEBUG - rt_kprintf("sec:%x min:%x hour:%x mday:%x wday:%x mon:%x year:%x\n", - sec, min, hour, mday, wday, mon, year); + rt_kprintf("sec:%x min:%x hour:%x mday:%x wday:%x mon:%x year:%x\n", + sec, min, hour, mday, wday, mon, year); #endif - /* disable access to RTC registers */ - RTC_DISABLE - - ti->tm_sec = BCD2BIN(sec & 0x7F); - ti->tm_min = BCD2BIN(min & 0x7F); - ti->tm_hour = BCD2BIN(hour & 0x3F); - ti->tm_mday = BCD2BIN(mday & 0x3F); - ti->tm_mon = BCD2BIN(mon & 0x1F); - ti->tm_year = BCD2BIN(year); - ti->tm_wday = BCD2BIN(wday & 0x07); - ti->tm_yday = 0; - ti->tm_isdst = 0; + /* disable access to RTC registers */ + RTC_DISABLE + + ti->tm_sec = BCD2BIN(sec & 0x7F); + ti->tm_min = BCD2BIN(min & 0x7F); + ti->tm_hour = BCD2BIN(hour & 0x3F); + ti->tm_mday = BCD2BIN(mday & 0x3F); + ti->tm_mon = BCD2BIN(mon & 0x1F); + ti->tm_year = BCD2BIN(year); + ti->tm_wday = BCD2BIN(wday & 0x07); + ti->tm_yday = 0; + ti->tm_isdst = 0; } /** @@ -68,32 +68,32 @@ void rt_hw_rtc_get(struct tm *ti) */ void rt_hw_rtc_set(struct tm *ti) { - rt_uint8_t sec, min, hour, mday, wday, mon, year; - - year = BIN2BCD(ti->tm_year); - mon = BIN2BCD(ti->tm_mon); - wday = BIN2BCD(ti->tm_wday); - mday = BIN2BCD(ti->tm_mday); - hour = BIN2BCD(ti->tm_hour); - min = BIN2BCD(ti->tm_min); - sec = BIN2BCD(ti->tm_sec); - - /* enable access to RTC registers */ - RTC_ENABLE - - do{ - /* write RTC registers */ - BCDSEC = sec; - BCDMIN = min; - BCDHOUR = hour; - BCDDATE = mday; - BCDDAY = wday; - BCDMON = mon; - BCDYEAR = year; - }while (sec != BCDSEC); - - /* disable access to RTC registers */ - RTC_DISABLE + rt_uint8_t sec, min, hour, mday, wday, mon, year; + + year = BIN2BCD(ti->tm_year); + mon = BIN2BCD(ti->tm_mon); + wday = BIN2BCD(ti->tm_wday); + mday = BIN2BCD(ti->tm_mday); + hour = BIN2BCD(ti->tm_hour); + min = BIN2BCD(ti->tm_min); + sec = BIN2BCD(ti->tm_sec); + + /* enable access to RTC registers */ + RTC_ENABLE + + do{ + /* write RTC registers */ + BCDSEC = sec; + BCDMIN = min; + BCDHOUR = hour; + BCDDATE = mday; + BCDDAY = wday; + BCDMON = mon; + BCDYEAR = year; + }while (sec != BCDSEC); + + /* disable access to RTC registers */ + RTC_DISABLE } /** @@ -101,85 +101,85 @@ void rt_hw_rtc_set(struct tm *ti) */ void rt_hw_rtc_reset (void) { - RTCCON = (RTCCON & ~0x06) | 0x08; - RTCCON &= ~(0x08|0x01); + RTCCON = (RTCCON & ~0x06) | 0x08; + RTCCON &= ~(0x08|0x01); } static struct rt_device rtc; static rt_err_t rtc_open(rt_device_t dev, rt_uint16_t oflag) { - RTC_ENABLE - return RT_EOK; + RTC_ENABLE + return RT_EOK; } static rt_err_t rtc_close(rt_device_t dev) { - RTC_DISABLE - return RT_EOK; + RTC_DISABLE + return RT_EOK; } static rt_size_t rtc_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - return RT_EOK; + return RT_EOK; } static rt_err_t rtc_control(rt_device_t dev, int cmd, void *args) { - struct tm tm, *tm_ptr; + struct tm tm, *tm_ptr; time_t *time; - RT_ASSERT(dev != RT_NULL); - - time = (time_t *)args; - switch (cmd) - { - case RT_DEVICE_CTRL_RTC_GET_TIME: - /* read device */ - rt_hw_rtc_get(&tm); - *((rt_time_t *)args) = mktime(&tm); - break; - - case RT_DEVICE_CTRL_RTC_SET_TIME: - tm_ptr = localtime(time); - /* write device */ - rt_hw_rtc_set(tm_ptr); - break; - } - - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + + time = (time_t *)args; + switch (cmd) + { + case RT_DEVICE_CTRL_RTC_GET_TIME: + /* read device */ + rt_hw_rtc_get(&tm); + *((rt_time_t *)args) = mktime(&tm); + break; + + case RT_DEVICE_CTRL_RTC_SET_TIME: + tm_ptr = localtime(time); + /* write device */ + rt_hw_rtc_set(tm_ptr); + break; + } + + return RT_EOK; } void rt_hw_rtc_init(void) { - rtc.type = RT_Device_Class_RTC; - - /* register rtc device */ - rtc.init = RT_NULL; - rtc.open = rtc_open; - rtc.close = rtc_close; - rtc.read = rtc_read; - rtc.write = RT_NULL; - rtc.control = rtc_control; - - /* no private */ - rtc.user_data = RT_NULL; - - rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); + rtc.type = RT_Device_Class_RTC; + + /* register rtc device */ + rtc.init = RT_NULL; + rtc.open = rtc_open; + rtc.close = rtc_close; + rtc.read = rtc_read; + rtc.write = RT_NULL; + rtc.control = rtc_control; + + /* no private */ + rtc.user_data = RT_NULL; + + rt_device_register(&rtc, "rtc", RT_DEVICE_FLAG_RDWR); } #ifdef RT_USING_FINSH #include void list_date() { - time_t time; - rt_device_t device; + time_t time; + rt_device_t device; - device = rt_device_find("rtc"); - if (device != RT_NULL) - { - rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); + device = rt_device_find("rtc"); + if (device != RT_NULL) + { + rt_device_control(device, RT_DEVICE_CTRL_RTC_GET_TIME, &time); - rt_kprintf("%d, %s\n", time, ctime(&time)); - } + rt_kprintf("%d, %s\n", time, ctime(&time)); + } } FINSH_FUNCTION_EXPORT(list_date, list date); #endif diff --git a/libcpu/arm/s3c24x0/rtc.h b/libcpu/arm/s3c24x0/rtc.h index aafa714b0..78219325a 100644 --- a/libcpu/arm/s3c24x0/rtc.h +++ b/libcpu/arm/s3c24x0/rtc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/s3c24x0/s3c24x0.h b/libcpu/arm/s3c24x0/s3c24x0.h index 03749c522..75e1eb011 100644 --- a/libcpu/arm/s3c24x0/s3c24x0.h +++ b/libcpu/arm/s3c24x0/s3c24x0.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,7 +22,7 @@ extern "C" { */ /*@{*/ -// Memory control +// Memory control #define BWSCON (*(volatile unsigned *)0x48000000) //Bus width & wait status #define BANKCON0 (*(volatile unsigned *)0x48000004) //Boot ROM control #define BANKCON1 (*(volatile unsigned *)0x48000008) //BANK1 control @@ -101,7 +101,7 @@ extern "C" { #define CLKCON (*(volatile unsigned *)0x4c00000c) //Clock generator control #define CLKSLOW (*(volatile unsigned *)0x4c000010) //Slow clock control #define CLKDIVN (*(volatile unsigned *)0x4c000014) //Clock divider control -#define CAMDIVN (*(volatile unsigned *)0x4c000018) //USB, CAM Clock divider control +#define CAMDIVN (*(volatile unsigned *)0x4c000018) //USB, CAM Clock divider control // LCD CONTROLLER @@ -114,7 +114,7 @@ extern "C" { #define LCDSADDR2 (*(volatile unsigned *)0x4d000018) //STN/TFT Frame buffer start address 2 #define LCDSADDR3 (*(volatile unsigned *)0x4d00001c) //STN/TFT Virtual screen address set #define REDLUT (*(volatile unsigned *)0x4d000020) //STN Red lookup table -#define GREENLUT (*(volatile unsigned *)0x4d000024) //STN Green lookup table +#define GREENLUT (*(volatile unsigned *)0x4d000024) //STN Green lookup table #define BLUELUT (*(volatile unsigned *)0x4d000028) //STN Blue lookup table #define DITHMODE (*(volatile unsigned *)0x4d00004c) //STN Dithering mode #define TPAL (*(volatile unsigned *)0x4d000050) //TFT Temporary palette @@ -223,10 +223,10 @@ extern "C" { #define TCNTO4 (*(volatile unsigned *)0x51000040) //Timer count observation 4 // Added for 2440 -#define FLTOUT (*(volatile unsigned *)0x560000c0) // Filter output(Read only) -#define DSC0 (*(volatile unsigned *)0x560000c4) // Strength control register 0 -#define DSC1 (*(volatile unsigned *)0x560000c8) // Strength control register 1 -#define MSLCON (*(volatile unsigned *)0x560000cc) // Memory sleep control register +#define FLTOUT (*(volatile unsigned *)0x560000c0) // Filter output(Read only) +#define DSC0 (*(volatile unsigned *)0x560000c4) // Strength control register 0 +#define DSC1 (*(volatile unsigned *)0x560000c8) // Strength control register 1 +#define MSLCON (*(volatile unsigned *)0x560000cc) // Memory sleep control register // USB DEVICE @@ -388,9 +388,9 @@ extern "C" { #define GPHDAT (*(volatile unsigned *)0x56000074) //Port H data #define GPHUP (*(volatile unsigned *)0x56000078) //Pull-up control H -#define GPJCON (*(volatile unsigned *)0x560000d0) //Port J control -#define GPJDAT (*(volatile unsigned *)0x560000d4) //Port J data -#define GPJUP (*(volatile unsigned *)0x560000d8) //Pull-up control J +#define GPJCON (*(volatile unsigned *)0x560000d0) //Port J control +#define GPJDAT (*(volatile unsigned *)0x560000d4) //Port J data +#define GPJUP (*(volatile unsigned *)0x560000d8) //Pull-up control J #define MISCCR (*(volatile unsigned *)0x56000080) //Miscellaneous control #define DCLKCON (*(volatile unsigned *)0x56000084) //DCLK0/1 control @@ -495,7 +495,7 @@ extern "C" { #ifdef __BIG_ENDIAN /* edited for 2440A */ #define SDIDAT (*(volatile unsigned *)0x5a00004c) #else // Little Endian -#define SDIDAT (*(volatile unsigned *)0x5a000040) +#define SDIDAT (*(volatile unsigned *)0x5a000040) #endif //SD Interface // PENDING BIT @@ -562,40 +562,40 @@ extern "C" { #define ClearPending(bit) {SRCPND = bit;INTPND = bit;INTPND;} //Wait until INTPND is changed for the case that the ISR is very short. -#define INTGLOBAL 32 +#define INTGLOBAL 32 /*****************************/ /* CPU Mode */ /*****************************/ -#define USERMODE 0x10 -#define FIQMODE 0x11 -#define IRQMODE 0x12 -#define SVCMODE 0x13 -#define ABORTMODE 0x17 -#define UNDEFMODE 0x1b -#define MODEMASK 0x1f -#define NOINT 0xc0 +#define USERMODE 0x10 +#define FIQMODE 0x11 +#define IRQMODE 0x12 +#define SVCMODE 0x13 +#define ABORTMODE 0x17 +#define UNDEFMODE 0x1b +#define MODEMASK 0x1f +#define NOINT 0xc0 struct rt_hw_register { - rt_uint32_t r0; - rt_uint32_t r1; - rt_uint32_t r2; - rt_uint32_t r3; - rt_uint32_t r4; - rt_uint32_t r5; - rt_uint32_t r6; - rt_uint32_t r7; - rt_uint32_t r8; - rt_uint32_t r9; - rt_uint32_t r10; - rt_uint32_t fp; - rt_uint32_t ip; - rt_uint32_t sp; - rt_uint32_t lr; - rt_uint32_t pc; - rt_uint32_t cpsr; - rt_uint32_t ORIG_r0; + rt_uint32_t r0; + rt_uint32_t r1; + rt_uint32_t r2; + rt_uint32_t r3; + rt_uint32_t r4; + rt_uint32_t r5; + rt_uint32_t r6; + rt_uint32_t r7; + rt_uint32_t r8; + rt_uint32_t r9; + rt_uint32_t r10; + rt_uint32_t fp; + rt_uint32_t ip; + rt_uint32_t sp; + rt_uint32_t lr; + rt_uint32_t pc; + rt_uint32_t cpsr; + rt_uint32_t ORIG_r0; }; #ifdef __cplusplus diff --git a/libcpu/arm/s3c24x0/serial.c b/libcpu/arm/s3c24x0/serial.c deleted file mode 100644 index 1eca1b111..000000000 --- a/libcpu/arm/s3c24x0/serial.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2006-03-13 Bernard first version - * 2009-04-20 yi.qiu modified according bernard's stm32 version - */ - -#include - -#include "serial.h" - -/** - * @addtogroup S3C24X0 - */ -/*@{*/ - -/* RT-Thread Device Interface */ -/** - * This function initializes serial - */ -static rt_err_t rt_serial_init(rt_device_t dev) -{ - struct serial_device* uart = (struct serial_device*) dev->user_data; - - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, - sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = uart->int_rx->save_index = 0; - } - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - rt_memset(uart->int_tx->tx_buffer, 0, - sizeof(uart->int_tx->tx_buffer)); - uart->int_tx->write_index = uart->int_tx->save_index = 0; - } - - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } - - return RT_EOK; -} - -/* save a char to serial buffer */ -static void rt_serial_savechar(struct serial_device* uart, char ch) -{ - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); -} - -static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) -{ - RT_ASSERT(dev != RT_NULL); - - return RT_EOK; -} - -static rt_err_t rt_serial_close(rt_device_t dev) -{ - RT_ASSERT(dev != RT_NULL); - - return RT_EOK; -} - -static rt_size_t rt_serial_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) -{ - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct serial_device*)dev->user_data; - - if (ptr == RT_NULL) - { - err_code = -RT_ENOMEM; - rt_set_errno(err_code); - return -RT_ENOMEM; - } - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_base_t level; - - /* interrupt mode Rx */ - while (size) - { - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size --; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - break; - } - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - while (uart->uart_device->ustat & USTAT_RCV_READY) - { - *ptr = uart->uart_device->urxh & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; -} - -static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) -{ - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct serial_device*)dev->user_data; - - if (ptr == RT_NULL) - { - err_code = -RT_ENOMEM; - rt_set_errno(err_code); - return -RT_ENOMEM; - } - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx */ - while (uart->int_tx->save_index != uart->int_tx->write_index) - { - /* save on tx buffer */ - uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - - -- size; - - /* move to next position */ - uart->int_tx->save_index ++; - - /* wrap save index */ - if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) - uart->int_tx->save_index = 0; - } - - /* set error code */ - if (size > 0) - err_code = -RT_EFULL; - } - else - { - /* polling mode */ - while (size) - { - /* - * to be polite with serial console add a line feed - * to the carriage return character - */ - if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) - { - while (!(uart->uart_device->ustat & USTAT_TXB_EMPTY)); - uart->uart_device->utxh = '\r'; - } - - while (!(uart->uart_device->ustat & USTAT_TXB_EMPTY)); - uart->uart_device->utxh = (*ptr & 0xFF); - - ++ptr; - --size; - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; -} - -static rt_err_t rt_serial_control(rt_device_t dev, int cmd, void *args) -{ - RT_ASSERT(dev != RT_NULL); - - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; - - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } - - return RT_EOK; -} - -/* - * serial register - */ -rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial) -{ - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); -} - -/* ISR for serial interrupt */ -void rt_hw_serial_isr(rt_device_t device) -{ - struct serial_device* uart = (struct serial_device*) device->user_data; - - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - - /* save on rx buffer */ - while (uart->uart_device->ustat & USTAT_RCV_READY) - { - rt_serial_savechar(uart, uart->uart_device->urxh & 0xff); - } - - /* invoke callback */ - if (device->rx_indicate != RT_NULL) - { - rt_size_t rx_length; - - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; - - device->rx_indicate(device, rx_length); - } -} - -/*@}*/ diff --git a/libcpu/arm/s3c24x0/serial.h b/libcpu/arm/s3c24x0/serial.h deleted file mode 100644 index 8a647ef35..000000000 --- a/libcpu/arm/s3c24x0/serial.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - */ -#ifndef __RT_HW_SERIAL_H__ -#define __RT_HW_SERIAL_H__ - -#include -#include - -#include "s3c24x0.h" - -#define USTAT_RCV_READY 0x01 /* receive data ready */ -#define USTAT_TXB_EMPTY 0x02 /* tx buffer empty */ -#define BPS 115200 /* serial baudrate */ - -#define UART_RX_BUFFER_SIZE 64 -#define UART_TX_BUFFER_SIZE 64 - -struct serial_int_rx -{ - rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; - rt_uint32_t read_index, save_index; -}; - -struct serial_int_tx -{ - rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; - rt_uint32_t write_index, save_index; -}; - -typedef struct uartport -{ - volatile rt_uint32_t ulcon; - volatile rt_uint32_t ucon; - volatile rt_uint32_t ufcon; - volatile rt_uint32_t umcon; - volatile rt_uint32_t ustat; - volatile rt_uint32_t urxb; - volatile rt_uint32_t ufstat; - volatile rt_uint32_t umstat; - volatile rt_uint32_t utxh; - volatile rt_uint32_t urxh; - volatile rt_uint32_t ubrd; -}uartport; - -struct serial_device -{ - uartport* uart_device; - - /* rx structure */ - struct serial_int_rx* int_rx; - - /* tx structure */ - struct serial_int_tx* int_tx; -}; - -rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); - -void rt_hw_serial_isr(rt_device_t device); - -#endif diff --git a/libcpu/arm/s3c24x0/stack.c b/libcpu/arm/s3c24x0/stack.c index 82607c359..99938e231 100644 --- a/libcpu/arm/s3c24x0/stack.c +++ b/libcpu/arm/s3c24x0/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/s3c24x0/start_gcc.S b/libcpu/arm/s3c24x0/start_gcc.S index 4adc45809..cc2b2f631 100644 --- a/libcpu/arm/s3c24x0/start_gcc.S +++ b/libcpu/arm/s3c24x0/start_gcc.S @@ -191,7 +191,7 @@ reset: copy_loop: ldmia r0!, {r3-r10} /* copy from source address [r0] */ stmia r1!, {r3-r10} /* copy to target address [r1] */ - cmp r0, r2 /* until source end addreee [r2] */ + cmp r0, r2 /* until source end address [r2] */ ble copy_loop /* setup stack */ diff --git a/libcpu/arm/s3c24x0/system_clock.c b/libcpu/arm/s3c24x0/system_clock.c index 833b193cc..235c5e5e5 100644 --- a/libcpu/arm/s3c24x0/system_clock.c +++ b/libcpu/arm/s3c24x0/system_clock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,21 +11,21 @@ #include #include "s3c24x0.h" -#define CONFIG_SYS_CLK_FREQ 12000000 // Fin = 12.00MHz +#define CONFIG_SYS_CLK_FREQ 12000000 // Fin = 12.00MHz #if CONFIG_SYS_CLK_FREQ == 12000000 - /* MPLL=2*12*100/6=400MHz */ - #define MPL_MIDV 92 /* m=MPL_MDIV+8=100 */ - #define MPL_PDIV 4 /* p=MPL_PDIV+2=6 */ - #define MPL_SDIV 0 /* s=MPL_SDIV=0 */ - /* UPLL=12*64/8=96MHz */ - #define UPL_MDIV 56 /* m=UPL_MDIV+8=64 */ - #define UPL_PDIV 2 /* p=UPL_PDIV+2=4 */ - #define UPL_SDIV 1 /* s=UPL_SDIV=1 */ - /* System clock divider FCLK:HCLK:PCLK=1:4:8 */ - #define DIVN_UPLL 0x1 /* UCLK = UPLL clock / 2 */ - #define HDIVN 0x2 /* HCLK = FCLK / 4 */ - #define PDIVN 0x1 /* PCLK = HCLK / 2 */ + /* MPLL=2*12*100/6=400MHz */ + #define MPL_MIDV 92 /* m=MPL_MDIV+8=100 */ + #define MPL_PDIV 4 /* p=MPL_PDIV+2=6 */ + #define MPL_SDIV 0 /* s=MPL_SDIV=0 */ + /* UPLL=12*64/8=96MHz */ + #define UPL_MDIV 56 /* m=UPL_MDIV+8=64 */ + #define UPL_PDIV 2 /* p=UPL_PDIV+2=4 */ + #define UPL_SDIV 1 /* s=UPL_SDIV=1 */ + /* System clock divider FCLK:HCLK:PCLK=1:4:8 */ + #define DIVN_UPLL 0x1 /* UCLK = UPLL clock / 2 */ + #define HDIVN 0x2 /* HCLK = FCLK / 4 */ + #define PDIVN 0x1 /* PCLK = HCLK / 2 */ #endif rt_uint32_t PCLK; @@ -35,60 +35,60 @@ rt_uint32_t UCLK; void rt_hw_get_clock(void) { - rt_uint32_t val; - rt_uint8_t m, p, s; + rt_uint32_t val; + rt_uint8_t m, p, s; - val = MPLLCON; - m = (val>>12)&0xff; - p = (val>>4)&0x3f; - s = val&3; + val = MPLLCON; + m = (val>>12)&0xff; + p = (val>>4)&0x3f; + s = val&3; - FCLK = ((m+8)*(CONFIG_SYS_CLK_FREQ/100)*2)/((p+2)*(1<>1)&3; - p = val&1; + val = CLKDIVN; + m = (val>>1)&3; + p = val&1; - switch (m) { - case 0: - HCLK = FCLK; - break; - case 1: - HCLK = FCLK>>1; - break; - case 2: - if(s&2) - HCLK = FCLK>>3; - else - HCLK = FCLK>>2; - break; - case 3: - if(s&1) - HCLK = FCLK/6; - else - HCLK = FCLK/3; - break; + switch (m) { + case 0: + HCLK = FCLK; + break; + case 1: + HCLK = FCLK>>1; + break; + case 2: + if(s&2) + HCLK = FCLK>>3; + else + HCLK = FCLK>>2; + break; + case 3: + if(s&1) + HCLK = FCLK/6; + else + HCLK = FCLK/3; + break; } - if(p) - PCLK = HCLK>>1; - else - PCLK = HCLK; + if(p) + PCLK = HCLK>>1; + else + PCLK = HCLK; } void rt_hw_set_mpll_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv) { - MPLLCON = sdiv | (pdiv<<4) | (mdiv<<12); + MPLLCON = sdiv | (pdiv<<4) | (mdiv<<12); } void rt_hw_set_upll_clock(rt_uint8_t sdiv, rt_uint8_t pdiv, rt_uint8_t mdiv) { - UPLLCON = (mdiv<<12) | (pdiv<<4) | sdiv; + UPLLCON = (mdiv<<12) | (pdiv<<4) | sdiv; } void rt_hw_set_divider(rt_uint8_t hdivn, rt_uint8_t pdivn) { - CLKDIVN = (hdivn<<1) | pdivn; + CLKDIVN = (hdivn<<1) | pdivn; } /** @@ -96,9 +96,9 @@ void rt_hw_set_divider(rt_uint8_t hdivn, rt_uint8_t pdivn) */ void rt_hw_clock_init(void) { - LOCKTIME = 0xFFFFFFFF; - rt_hw_set_mpll_clock(MPL_SDIV, MPL_PDIV, MPL_MIDV); - rt_hw_set_upll_clock(UPL_SDIV, UPL_PDIV, UPL_MDIV); - rt_hw_set_divider(HDIVN, PDIVN); + LOCKTIME = 0xFFFFFFFF; + rt_hw_set_mpll_clock(MPL_SDIV, MPL_PDIV, MPL_MIDV); + rt_hw_set_upll_clock(UPL_SDIV, UPL_PDIV, UPL_MDIV); + rt_hw_set_divider(HDIVN, PDIVN); } diff --git a/libcpu/arm/s3c24x0/trap.c b/libcpu/arm/s3c24x0/trap.c index f2f389c6b..f0e8a7097 100644 --- a/libcpu/arm/s3c24x0/trap.c +++ b/libcpu/arm/s3c24x0/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -34,13 +34,13 @@ extern long list_thread(void); void rt_hw_show_register (struct rt_hw_register *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -53,15 +53,15 @@ void rt_hw_show_register (struct rt_hw_register *regs) */ void rt_hw_trap_udef(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("undefined instruction\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_kprintf("undefined instruction\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -75,10 +75,10 @@ void rt_hw_trap_udef(struct rt_hw_register *regs) */ void rt_hw_trap_swi(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("software interrupt\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("software interrupt\n"); + rt_hw_cpu_shutdown(); } /** @@ -91,15 +91,15 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) */ void rt_hw_trap_pabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("prefetch abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_kprintf("prefetch abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -112,15 +112,15 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) */ void rt_hw_trap_dabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("data abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_kprintf("data abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); #ifdef RT_USING_FINSH - list_thread(); + list_thread(); #endif - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -132,9 +132,9 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs) */ void rt_hw_trap_resv(struct rt_hw_register *regs) { - rt_kprintf("not used\n"); - rt_hw_show_register(regs); - rt_hw_cpu_shutdown(); + rt_kprintf("not used\n"); + rt_hw_show_register(regs); + rt_hw_cpu_shutdown(); } extern struct rt_irq_desc isr_table[]; @@ -161,13 +161,13 @@ void rt_hw_trap_irq(void) ClearPending(1 << irq); #ifdef RT_USING_INTERRUPT_INFO - isr_table[irq].counter++; + isr_table[irq].counter++; #endif /* RT_USING_INTERRUPT_INFO */ } void rt_hw_trap_fiq(void) { - rt_kprintf("fast interrupt request\n"); + rt_kprintf("fast interrupt request\n"); } /*@}*/ diff --git a/libcpu/arm/s3c44b0/cpu.c b/libcpu/arm/s3c44b0/cpu.c index 03ebefba1..c9af44530 100644 --- a/libcpu/arm/s3c44b0/cpu.c +++ b/libcpu/arm/s3c44b0/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -22,29 +22,29 @@ */ void rt_hw_cpu_icache_enable() { - rt_base_t reg; - - volatile int i; - /* flush cycle */ - for(i = 0x10002000; i < 0x10004800; i+=16) - { - *((int *)i)=0x0; - } - - /* - * Init cache - * Non-cacheable area (everything outside RAM) - * 0x0000:0000 - 0x0C00:0000 - */ - NCACHBE0 = 0xC0000000; - NCACHBE1 = 0x00000000; - - /* - Enable chache - */ - reg = SYSCFG; - reg |= 0x00000006; /* 8kB */ - SYSCFG = reg; + rt_base_t reg; + + volatile int i; + /* flush cycle */ + for(i = 0x10002000; i < 0x10004800; i+=16) + { + *((int *)i)=0x0; + } + + /* + * Init cache + * Non-cacheable area (everything outside RAM) + * 0x0000:0000 - 0x0C00:0000 + */ + NCACHBE0 = 0xC0000000; + NCACHBE1 = 0x00000000; + + /* + Enable chache + */ + reg = SYSCFG; + reg |= 0x00000006; /* 8kB */ + SYSCFG = reg; } /** @@ -53,11 +53,11 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - rt_base_t reg; + rt_base_t reg; - reg = SYSCFG; - reg &= ~0x00000006; /* 8kB */ - SYSCFG = reg; + reg = SYSCFG; + reg &= ~0x00000006; /* 8kB */ + SYSCFG = reg; } /** @@ -66,7 +66,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return 0; + return 0; } /** @@ -75,7 +75,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - rt_hw_cpu_icache_enable(); + rt_hw_cpu_icache_enable(); } /** @@ -84,7 +84,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - rt_hw_cpu_icache_disable(); + rt_hw_cpu_icache_disable(); } /** @@ -93,7 +93,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return rt_hw_cpu_icache_status(); + return rt_hw_cpu_icache_status(); } /** @@ -110,9 +110,9 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } /*@}*/ diff --git a/libcpu/arm/s3c44b0/interrupt.c b/libcpu/arm/s3c44b0/interrupt.c index 6b3eed4a3..5464011dd 100644 --- a/libcpu/arm/s3c44b0/interrupt.c +++ b/libcpu/arm/s3c44b0/interrupt.c @@ -1,19 +1,19 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2006-09-06 XuXinming first version - * 2006-09-15 Bernard add interrupt bank 0..3 for more effective + * 2006-09-15 Bernard add interrupt bank 0..3 for more effective * in irq trap */ #include #include "s3c44b0.h" -#define MAX_HANDLERS 26 +#define MAX_HANDLERS 26 extern rt_uint32_t rt_interrupt_nest; @@ -34,7 +34,7 @@ unsigned char interrupt_bank3[256]; void rt_hw_interrupt_handle(int vector) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -42,70 +42,70 @@ void rt_hw_interrupt_handle(int vector) */ void rt_hw_interrupt_init() { - register int i; - - /* all interrupt disabled include global bit */ - INTMSK = 0x07ffffff; - - /* clear pending register */ - I_ISPC = 0x03ffffff; - - /* non-vector mode IRQ enable */ - INTCON = 0x5; - - /* all IRQ mode */ - INTMOD = 0x0; - - /* init exceptions table */ - for(i=0; ir0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -52,10 +52,10 @@ void rt_hw_show_register (struct rt_hw_register *regs) */ void rt_hw_trap_udef(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("undefined instruction\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("undefined instruction\n"); + rt_hw_cpu_shutdown(); } /** @@ -84,10 +84,10 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) */ void rt_hw_trap_pabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("prefetch abort\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("prefetch abort\n"); + rt_hw_cpu_shutdown(); } /** @@ -100,10 +100,10 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) */ void rt_hw_trap_dabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("data abort\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("data abort\n"); + rt_hw_cpu_shutdown(); } /** @@ -123,50 +123,50 @@ void rt_hw_trap_resv(struct rt_hw_register *regs) extern rt_isr_handler_t isr_table[]; void rt_hw_trap_irq() { - register unsigned long ispr, intstat; - register rt_isr_handler_t isr_func; + register unsigned long ispr, intstat; + register rt_isr_handler_t isr_func; #ifdef BSP_INT_DEBUG - rt_kprintf("irq coming, "); + rt_kprintf("irq coming, "); #endif - intstat = I_ISPR & 0x7ffffff; + intstat = I_ISPR & 0x7ffffff; #ifdef BSP_INT_DEBUG - rt_kprintf("I_ISPR: %d\n", intstat); + rt_kprintf("I_ISPR: %d\n", intstat); #endif - ispr = intstat; - - /* to find interrupt */ - if ( intstat & 0xff ) /* lowest 8bits */ - { - intstat = interrupt_bank0[intstat & 0xff]; - isr_func = (rt_isr_handler_t)isr_table[ intstat ]; - } - else if ( intstat & 0xff00 ) /* low 8bits */ - { - intstat = interrupt_bank1[(intstat & 0xff00) >> 8]; - isr_func = (rt_isr_handler_t)isr_table[ intstat ]; - } - else if ( intstat & 0xff0000 ) /* high 8bits */ - { - intstat = interrupt_bank2[(intstat & 0xff0000) >> 16]; - isr_func = (rt_isr_handler_t)isr_table[ intstat ]; - } - else if ( intstat & 0xff000000 ) /* highest 8bits */ - { - intstat = interrupt_bank3[(intstat & 0xff000000) >> 24]; - isr_func = (rt_isr_handler_t)isr_table[ intstat ]; - } - else return; + ispr = intstat; + + /* to find interrupt */ + if ( intstat & 0xff ) /* lowest 8bits */ + { + intstat = interrupt_bank0[intstat & 0xff]; + isr_func = (rt_isr_handler_t)isr_table[ intstat ]; + } + else if ( intstat & 0xff00 ) /* low 8bits */ + { + intstat = interrupt_bank1[(intstat & 0xff00) >> 8]; + isr_func = (rt_isr_handler_t)isr_table[ intstat ]; + } + else if ( intstat & 0xff0000 ) /* high 8bits */ + { + intstat = interrupt_bank2[(intstat & 0xff0000) >> 16]; + isr_func = (rt_isr_handler_t)isr_table[ intstat ]; + } + else if ( intstat & 0xff000000 ) /* highest 8bits */ + { + intstat = interrupt_bank3[(intstat & 0xff000000) >> 24]; + isr_func = (rt_isr_handler_t)isr_table[ intstat ]; + } + else return; #ifdef BSP_INT_DEBUG - rt_kprintf("irq: %d happen\n", intstat); + rt_kprintf("irq: %d happen\n", intstat); #endif - /* turn to interrupt service routine */ - isr_func(intstat); + /* turn to interrupt service routine */ + isr_func(intstat); - I_ISPC = ispr; /* clear interrupt */ + I_ISPC = ispr; /* clear interrupt */ } void rt_hw_trap_fiq() diff --git a/libcpu/arm/sep4020/clk.c b/libcpu/arm/sep4020/clk.c index da69e25b6..031d310fc 100644 --- a/libcpu/arm/sep4020/clk.c +++ b/libcpu/arm/sep4020/clk.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -11,46 +11,46 @@ #include #include "sep4020.h" -#define CLK_IN 4000000 /* Fin = 4.00MHz */ -#define SYSCLK 72000000 /* system clock we want */ - -#define CLK_ESRAM 0 -#define CLK_LCDC 1 -#define CLK_PWM 2 -#define CLK_DMAC 3 -#define CLK_EMI 4 -#define CLK_MMCSD 5 -#define CLK_SSI 7 -#define CLK_UART0 8 -#define CLK_UART1 9 -#define CLK_UART2 10 -#define CLK_UART3 11 -#define CLK_USB 12 -#define CLK_MAC 13 -#define CLK_SMC 14 -#define CLK_I2C 15 -#define CLK_GPT 16 +#define CLK_IN 4000000 /* Fin = 4.00MHz */ +#define SYSCLK 72000000 /* system clock we want */ + +#define CLK_ESRAM 0 +#define CLK_LCDC 1 +#define CLK_PWM 2 +#define CLK_DMAC 3 +#define CLK_EMI 4 +#define CLK_MMCSD 5 +#define CLK_SSI 7 +#define CLK_UART0 8 +#define CLK_UART1 9 +#define CLK_UART2 10 +#define CLK_UART3 11 +#define CLK_USB 12 +#define CLK_MAC 13 +#define CLK_SMC 14 +#define CLK_I2C 15 +#define CLK_GPT 16 static void rt_hw_set_system_clock(void) { - rt_uint8_t pv; - - /* pv value*/ - pv = SYSCLK/2/CLK_IN; - /* go to normal mode*/ - *(RP)PMU_PMDR = 0x01; - /* set the clock */ - *(RP)PMU_PMCR = 0x4000 | pv; - /* trige configurate*/ - *(RP)PMU_PMCR = 0xc000 | pv; + rt_uint8_t pv; + + /* pv value*/ + pv = SYSCLK/2/CLK_IN; + /* go to normal mode*/ + *(RP)PMU_PMDR = 0x01; + /* set the clock */ + *(RP)PMU_PMCR = 0x4000 | pv; + /* trige configurate*/ + *(RP)PMU_PMCR = 0xc000 | pv; } static void rt_hw_set_usb_clock(void) { - /* set the clock */ - *(RP)PMU_PUCR = 0x000c; - /* trige configurate*/ - *(RP)PMU_PMCR = 0x800c; + /* set the clock */ + *(RP)PMU_PUCR = 0x000c; + /* trige configurate*/ + *(RP)PMU_PMCR = 0x800c; } @@ -59,10 +59,10 @@ static void rt_hw_set_usb_clock(void) */ void rt_hw_clock_init(void) { - /* set system clock */ - rt_hw_set_system_clock(); - /* set usb clock */ - rt_hw_set_usb_clock(); + /* set system clock */ + rt_hw_set_system_clock(); + /* set usb clock */ + rt_hw_set_usb_clock(); } /** @@ -70,22 +70,22 @@ void rt_hw_clock_init(void) */ rt_uint32_t rt_hw_get_clock(void) { - rt_uint32_t val; - rt_uint8_t pv, pd, npd; - - /* get PMCR value */ - val =*(RP) PMU_PMCR; - /* get NPD */ - npd = (val >> 14) & 0x01; - /* get PD */ - pd = (val >> 10) & 0x0f; - /* get PV */ - pv = val & 0x7f; - /* caculate the system clock */ - if(npd) - val = 2 * CLK_IN * pv; - else - val = CLK_IN * pv / (pd + 1); + rt_uint32_t val; + rt_uint8_t pv, pd, npd; + + /* get PMCR value */ + val =*(RP) PMU_PMCR; + /* get NPD */ + npd = (val >> 14) & 0x01; + /* get PD */ + pd = (val >> 10) & 0x0f; + /* get PV */ + pv = val & 0x7f; + /* caculate the system clock */ + if(npd) + val = 2 * CLK_IN * pv; + else + val = CLK_IN * pv / (pd + 1); return(val); } diff --git a/libcpu/arm/sep4020/cpu.c b/libcpu/arm/sep4020/cpu.c index ee4eab626..2d443309b 100644 --- a/libcpu/arm/sep4020/cpu.c +++ b/libcpu/arm/sep4020/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -21,76 +21,76 @@ extern rt_uint32_t rt_hw_interrupt_disable(void); */ /*@{*/ -#define ICACHE_MASK (rt_uint32_t)(1 << 12) -#define DCACHE_MASK (rt_uint32_t)(1 << 2) +#define ICACHE_MASK (rt_uint32_t)(1 << 12) +#define DCACHE_MASK (rt_uint32_t)(1 << 2) #ifdef __GNUC__ rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); - return i; + asm ("mrc p15, 0, %0, c1, c0, 0":"=r" (i)); + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "orr r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "orr r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } rt_inline void cache_disable(rt_uint32_t bit) { - __asm__ __volatile__( \ - "mrc p15,0,r0,c1,c0,0\n\t" \ - "bic r0,r0,%0\n\t" \ - "mcr p15,0,r0,c1,c0,0" \ - : \ - :"r" (bit) \ - :"memory"); + __asm__ __volatile__( \ + "mrc p15,0,r0,c1,c0,0\n\t" \ + "bic r0,r0,%0\n\t" \ + "mcr p15,0,r0,c1,c0,0" \ + : \ + :"r" (bit) \ + :"memory"); } #endif #ifdef __CC_ARM rt_inline rt_uint32_t cp15_rd(void) { - rt_uint32_t i; + rt_uint32_t i; - __asm - { - mrc p15, 0, i, c1, c0, 0 - } + __asm + { + mrc p15, 0, i, c1, c0, 0 + } - return i; + return i; } rt_inline void cache_enable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - orr value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + orr value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } rt_inline void cache_disable(rt_uint32_t bit) { - rt_uint32_t value; - - __asm - { - mrc p15, 0, value, c1, c0, 0 - bic value, value, bit - mcr p15, 0, value, c1, c0, 0 - } + rt_uint32_t value; + + __asm + { + mrc p15, 0, value, c1, c0, 0 + bic value, value, bit + mcr p15, 0, value, c1, c0, 0 + } } #endif @@ -100,7 +100,7 @@ rt_inline void cache_disable(rt_uint32_t bit) */ void rt_hw_cpu_icache_enable() { - cache_enable(ICACHE_MASK); + cache_enable(ICACHE_MASK); } /** @@ -109,7 +109,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - cache_disable(ICACHE_MASK); + cache_disable(ICACHE_MASK); } /** @@ -118,7 +118,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return (cp15_rd() & ICACHE_MASK); + return (cp15_rd() & ICACHE_MASK); } /** @@ -127,7 +127,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - cache_enable(DCACHE_MASK); + cache_enable(DCACHE_MASK); } /** @@ -136,7 +136,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - cache_disable(DCACHE_MASK); + cache_disable(DCACHE_MASK); } /** @@ -145,7 +145,7 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return (cp15_rd() & DCACHE_MASK); + return (cp15_rd() & DCACHE_MASK); } /** @@ -155,18 +155,18 @@ rt_base_t rt_hw_cpu_dcache_status() void rt_hw_cpu_reset() { - /* enable watchdog */ - *(RP)(RTC_CTR) = 0x02; + /* enable watchdog */ + *(RP)(RTC_CTR) = 0x02; - /*Enable watchdog reset*/ - *(RP)(RTC_INT_EN) = 0x20; + /*Enable watchdog reset*/ + *(RP)(RTC_INT_EN) = 0x20; - /* Initialize watchdog timer count register */ - *(RP)(RTC_WD_CNT) = 0x0001; + /* Initialize watchdog timer count register */ + *(RP)(RTC_WD_CNT) = 0x0001; - while(1); /* loop forever and wait for reset to happen */ + while(1); /* loop forever and wait for reset to happen */ - /* NEVER REACHED */ + /* NEVER REACHED */ } /** @@ -175,12 +175,12 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_uint32_t UNUSED level; - rt_kprintf("shutdown...\n"); + rt_uint32_t UNUSED level; + rt_kprintf("shutdown...\n"); - level = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); - RT_ASSERT(RT_NULL); + RT_ASSERT(RT_NULL); } /*@}*/ diff --git a/libcpu/arm/sep4020/interrupt.c b/libcpu/arm/sep4020/interrupt.c index ebc9c9625..24907c139 100644 --- a/libcpu/arm/sep4020/interrupt.c +++ b/libcpu/arm/sep4020/interrupt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,7 +13,7 @@ #include #include -#define MAX_HANDLERS 32 +#define MAX_HANDLERS 32 extern rt_uint32_t rt_interrupt_nest; @@ -29,7 +29,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; static void rt_hw_interrupt_handle(int vector, void *param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -45,7 +45,7 @@ void rt_hw_interrupt_init(void) *(RP)(INTC_IMR) = 0xFFFFFFFF; /*enable all the irq*/ - *(RP)(INTC_IER) = 0XFFFFFFFF; + *(RP)(INTC_IER) = 0XFFFFFFFF; /*Dont use any forced irq*/ *(RP)(INTC_IFR) = 0x0; @@ -82,7 +82,7 @@ void rt_hw_interrupt_init(void) */ void rt_hw_interrupt_mask(int vector) { - *(RP)(INTC_IMR) |= 1 << vector; + *(RP)(INTC_IMR) |= 1 << vector; } /** @@ -91,12 +91,12 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - if(vector == 16) - { - rt_kprintf("Interrupt vec %d is not used!\n", vector); - } - else - *(RP)(INTC_IMR) &= ~(1 << vector); + if(vector == 16) + { + rt_kprintf("Interrupt vec %d is not used!\n", vector); + } + else + *(RP)(INTC_IMR) &= ~(1 << vector); } @@ -118,7 +118,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, if (handler != RT_NULL) { #ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); + rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); #endif /* RT_USING_INTERRUPT_INFO */ isr_table[vector].handler = handler; isr_table[vector].param = param; diff --git a/libcpu/arm/sep4020/sep4020.h b/libcpu/arm/sep4020/sep4020.h index 4ae09d027..bb8effbff 100644 --- a/libcpu/arm/sep4020/sep4020.h +++ b/libcpu/arm/sep4020/sep4020.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -13,13 +13,13 @@ /*Core definations*/ #define SVCMODE -#define Mode_USR 0x10 -#define Mode_FIQ 0x11 -#define Mode_IRQ 0x12 -#define Mode_SVC 0x13 -#define Mode_ABT 0x17 -#define Mode_UND 0x1B -#define Mode_SYS 0x1F +#define Mode_USR 0x10 +#define Mode_FIQ 0x11 +#define Mode_IRQ 0x12 +#define Mode_SVC 0x13 +#define Mode_ABT 0x17 +#define Mode_UND 0x1B +#define Mode_SYS 0x1F @@ -106,7 +106,7 @@ #define RTC_INT_STS (RTC_BASE+0X014) /* 中断状æ€å¯„存器 */ #define RTC_SAMP (RTC_BASE+0X018) /* 采样周期寄存器 */ #define RTC_WD_CNT (RTC_BASE+0X01C) /* Watch-Dog计数值寄存器 */ -#define RTC_WD_SEV (RTC_BASE+0X020) /* Watch-DogæœåŠ¡å¯„存器 */ +#define RTC_WD_SEV (RTC_BASE+0X020) /* Watch-DogæœåŠ¡å¯„存器 */ #define RTC_CONFIG_CHECK (RTC_BASE+0X024) /* é…置时间确认寄存器 (在é…置时间之å‰å…ˆå†™0xaaaaaaaa) */ #define RTC_KEY0 (RTC_BASE+0X02C) /* 密钥寄存器 */ @@ -325,18 +325,18 @@ * SDæ¨¡å— * 基å€: 0x1000B000 */ - -#define SDC_CLOCK_CONTROL (SD_BASE+0x00) /* SDIO时钟控制寄存器 */ -#define SDC_SOFTWARE_RESET (SD_BASE+0X04) /* SDIO软件å¤ä½å¯„存器 */ -#define SDC_ARGUMENT (SD_BASE+0X08) /* SDIO命令å‚数寄存器 */ -#define SDC_COMMAND (SD_BASE+0X0C) /* SDIO命令控制寄存器 */ + +#define SDC_CLOCK_CONTROL (SD_BASE+0x00) /* SDIO时钟控制寄存器 */ +#define SDC_SOFTWARE_RESET (SD_BASE+0X04) /* SDIO软件å¤ä½å¯„存器 */ +#define SDC_ARGUMENT (SD_BASE+0X08) /* SDIO命令å‚数寄存器 */ +#define SDC_COMMAND (SD_BASE+0X0C) /* SDIO命令控制寄存器 */ #define SDC_BLOCK_SIZE (SD_BASE+0X10) /* SDIOæ•°æ®å—长度寄存器 */ -#define SDC_BLOCK_COUNT (SD_BASE+0X14) /* SDIOæ•°æ®å—数目寄存器 */ -#define SDC_TRANSFER_MODE (SD_BASE+0X18) /* SDIO传输模å¼é€‰æ‹©å¯„存器 */ -#define SDC_RESPONSE0 (SD_BASE+0X1c) /* SDIOå“应寄存器0 */ -#define SDC_RESPONSE1 (SD_BASE+0X20) /* SDIOå“应寄存器1 */ -#define SDC_RESPONSE2 (SD_BASE+0X24) /* SDIOå“应寄存器2 */ -#define SDC_RESPONSE3 (SD_BASE+0X28) /* SDIOå“应寄存器3 */ +#define SDC_BLOCK_COUNT (SD_BASE+0X14) /* SDIOæ•°æ®å—数目寄存器 */ +#define SDC_TRANSFER_MODE (SD_BASE+0X18) /* SDIO传输模å¼é€‰æ‹©å¯„存器 */ +#define SDC_RESPONSE0 (SD_BASE+0X1c) /* SDIOå“应寄存器0 */ +#define SDC_RESPONSE1 (SD_BASE+0X20) /* SDIOå“应寄存器1 */ +#define SDC_RESPONSE2 (SD_BASE+0X24) /* SDIOå“应寄存器2 */ +#define SDC_RESPONSE3 (SD_BASE+0X28) /* SDIOå“应寄存器3 */ #define SDC_READ_TIMEOUT_CONTROL (SD_BASE+0X2c) /* SDIO读超时控制寄存器 */ #define SDC_INTERRUPT_STATUS (SD_BASE+0X30) /* SDIO中断状æ€å¯„存器 */ #define SDC_INTERRUPT_STATUS_MASK (SD_BASE+0X34) /* SDIO中断状æ€å±è”½å¯„存器 */ @@ -650,15 +650,15 @@ #define MAC_HASH0 (MAC_BASE+0X048) /* MAC HASH寄存器 */ #define MAC_HASH1 (MAC_BASE+0X04C) /* MAC HASH寄存器 */ #define MAC_TXPAUSE (MAC_BASE+0X050) /* MAC控制帧寄存器 */ -#define MAC_TX_BD (MAC_BASE+0X400) -#define MAC_RX_BD (MAC_BASE+0X600) +#define MAC_TX_BD (MAC_BASE+0X400) +#define MAC_RX_BD (MAC_BASE+0X600) /* ************************************** * Error Codes: * IF SUCCESS RETURN 0, ELSE RETURN OTHER ERROR CODE, - * parameter error return (-33)/E_PAR, + * parameter error return (-33)/E_PAR, * hardware error reture (-99)/E_HA ************************************** */ @@ -680,7 +680,7 @@ #define E_QOVR (-73) /* Queuing or nesting overflow */ #define E_DLT (-81) /* Object being waited for was deleted */ #define E_TMOUT (-85) /* Polling failure or timeout exceeded */ -#define E_RLWAI (-86) /* WAIT state was forcibly released */ +#define E_RLWAI (-86) /* WAIT state was forcibly released */ #define E_HA (-99) /* HARD WARE ERROR */ @@ -692,7 +692,7 @@ */ #define CLK_SGPT (1 << 16) -#define CLK_SI2S (1 << 15) +#define CLK_SI2S (1 << 15) #define CLK_SSMC (1 << 14) #define CLK_SMAC (1 << 13) #define CLK_SUSB (1 << 12) @@ -713,8 +713,8 @@ /*Interrupt Sources*/ -#define INTSRC_RTC 31 -#define INTSRC_DMAC 30 +#define INTSRC_RTC 31 +#define INTSRC_DMAC 30 #define INTSRC_EMI 29 #define INTSRC_MAC 28 #define INTSRC_TIMER1 27 @@ -732,17 +732,17 @@ #define INTSRC_USB 15 #define INTSRC_SMC0 14 #define INTSRC_SMC1 13 -#define INTSRC_SDIO 12 -#define INTSRC_EXINT10 11 -#define INTSRC_EXINT9 10 -#define INTSRC_EXINT8 9 -#define INTSRC_EXINT7 8 -#define INTSRC_EXINT6 7 -#define INTSRC_EXINT5 6 -#define INTSRC_EXINT4 5 -#define INTSRC_EXINT3 4 -#define INTSRC_EXINT2 3 -#define INTSRC_EXINT1 2 +#define INTSRC_SDIO 12 +#define INTSRC_EXINT10 11 +#define INTSRC_EXINT9 10 +#define INTSRC_EXINT8 9 +#define INTSRC_EXINT7 8 +#define INTSRC_EXINT6 7 +#define INTSRC_EXINT5 6 +#define INTSRC_EXINT4 5 +#define INTSRC_EXINT3 4 +#define INTSRC_EXINT2 3 +#define INTSRC_EXINT1 2 #define INTSRC_EXINT0 1 #define INTSRC_NULL 0 @@ -752,7 +752,7 @@ #define set_int_force(intnum) *(RP)INTC_IFR = (1 << intnum) //ç½®1åŽï¼Œè½¯ä»¶å¼ºåˆ¶è¯¥ä½å¯¹åº”的中断æºå‘å‡ºä¸­æ–­ä¿¡å· #define enable_irq(intnum) *(RP)INTC_IER |= (1 << intnum) //ç½®1åŽï¼Œå…许中断æºçš„IRQ ä¸­æ–­ä¿¡å· #define disable_irq( intnum) *(RP)INTC_IER &= ~(1<< intnum) //ç½®0åŽï¼Œä¸å…许中断æºçš„IRQ ä¸­æ–­ä¿¡å· -#define mask_irq(intnum) *(RP)INTC_IMR |= (1 << intnum) //ç½®1åŽï¼Œå±è”½å¯¹åº”çš„IRQ ä¸­æ–­ä¿¡å· +#define mask_irq(intnum) *(RP)INTC_IMR |= (1 << intnum) //ç½®1åŽï¼Œå±è”½å¯¹åº”çš„IRQ ä¸­æ–­ä¿¡å· #define unmask_irq(intnum) *(RP)INTC_IMR &= ~(1 << intnum) //ç½®0åŽï¼Œé€šè¿‡å¯¹åº”çš„IRQ ä¸­æ–­ä¿¡å· #define mask_all_irq() *(RP)INTC_IMR = 0xFFFFFFFF //å±è”½å¯¹åº”çš„IRQ ä¸­æ–­ä¿¡å· #define unmask_all_irq() *(RP)INTC_IMR = 0x00000000 //通过对应的IRQ ä¸­æ–­ä¿¡å· @@ -765,7 +765,7 @@ * 所有程åºä¸­ç”¨åˆ°çš„Typedef ************************************** */ - + typedef char S8; /* signed 8-bit integer */ typedef short S16; /* signed 16-bit integer */ typedef long S32; /* signed 32-bit integer */ @@ -782,8 +782,8 @@ typedef void (*FP)(); /* program start address */ #ifndef _BOOL_TYPE_ #define _BOOL_TYPE_ -typedef int BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ -#endif +typedef int BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ +#endif typedef int ER; /* Error code. A signed integer. */ @@ -802,71 +802,71 @@ typedef int ER; /* Error code. A signed integer. */ /*Macros for debug*/ #define EOUT(fmt,...) \ - do \ - { \ - rt_kprintf("EOUT:(%s:%i) ",__FILE__,__LINE__); \ - rt_kprintf(fmt,##__VA_ARGS__); \ - }while(0) + do \ + { \ + rt_kprintf("EOUT:(%s:%i) ",__FILE__,__LINE__); \ + rt_kprintf(fmt,##__VA_ARGS__); \ + }while(0) #define RT_DEBUG #ifdef RT_DEBUG - #define DBOUT(fmt,...) \ - do \ - { \ - rt_kprintf("DBOUT:(%s:%i) ",__FILE__,__LINE__); \ - rt_kprintf(fmt,##__VA_ARGS__); \ - }while(0) + #define DBOUT(fmt,...) \ + do \ + { \ + rt_kprintf("DBOUT:(%s:%i) ",__FILE__,__LINE__); \ + rt_kprintf(fmt,##__VA_ARGS__); \ + }while(0) #else - #define DBOUT(fmt,...) \ - do{}while(0) + #define DBOUT(fmt,...) \ + do{}while(0) #endif -#ifdef RT_DEBUG - #define ASSERT(arg) \ - if((arg) == 0) \ - { \ - while(1) \ - { \ - rt_kprintf("have a assert failure\n"); \ - } \ - } +#ifdef RT_DEBUG + #define ASSERT(arg) \ + if((arg) == 0) \ + { \ + while(1) \ + { \ + rt_kprintf("have a assert failure\n"); \ + } \ + } #else - #define ASSERT(arg) \ - do \ - { \ - }while(0) + #define ASSERT(arg) \ + do \ + { \ + }while(0) #endif #define write_reg(reg,value) \ - do \ - { \ - *(RP)(reg) = value; \ - }while(0) + do \ + { \ + *(RP)(reg) = value; \ + }while(0) #define read_reg(reg) (*(RP)reg) struct rt_hw_register { - rt_uint32_t r0; - rt_uint32_t r1; - rt_uint32_t r2; - rt_uint32_t r3; - rt_uint32_t r4; - rt_uint32_t r5; - rt_uint32_t r6; - rt_uint32_t r7; - rt_uint32_t r8; - rt_uint32_t r9; - rt_uint32_t r10; - rt_uint32_t fp; - rt_uint32_t ip; - rt_uint32_t sp; - rt_uint32_t lr; - rt_uint32_t pc; - rt_uint32_t cpsr; - rt_uint32_t ORIG_r0; + rt_uint32_t r0; + rt_uint32_t r1; + rt_uint32_t r2; + rt_uint32_t r3; + rt_uint32_t r4; + rt_uint32_t r5; + rt_uint32_t r6; + rt_uint32_t r7; + rt_uint32_t r8; + rt_uint32_t r9; + rt_uint32_t r10; + rt_uint32_t fp; + rt_uint32_t ip; + rt_uint32_t sp; + rt_uint32_t lr; + rt_uint32_t pc; + rt_uint32_t cpsr; + rt_uint32_t ORIG_r0; }; diff --git a/libcpu/arm/sep4020/serial.c b/libcpu/arm/sep4020/serial.c index 713959238..9bf1546c0 100644 --- a/libcpu/arm/sep4020/serial.c +++ b/libcpu/arm/sep4020/serial.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2006-03-13 Bernard first version * 2009-04-20 yi.qiu modified according bernard's stm32 version - * 2010-10-6 wangmeng added sep4020 surpport + * 2010-10-6 wangmeng added sep4020 surpport */ #include #include @@ -24,204 +24,204 @@ */ static rt_err_t rt_serial_init (rt_device_t dev) { - struct serial_device* uart = (struct serial_device*) dev->user_data; - - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, - sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = uart->int_rx->save_index = 0; - } - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - rt_memset(uart->int_tx->tx_buffer, 0, - sizeof(uart->int_tx->tx_buffer)); - uart->int_tx->write_index = uart->int_tx->save_index = 0; - } - - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } - - return RT_EOK; + struct serial_device* uart = (struct serial_device*) dev->user_data; + + if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) + { + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_memset(uart->int_rx->rx_buffer, 0, + sizeof(uart->int_rx->rx_buffer)); + uart->int_rx->read_index = uart->int_rx->save_index = 0; + } + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + rt_memset(uart->int_tx->tx_buffer, 0, + sizeof(uart->int_tx->tx_buffer)); + uart->int_tx->write_index = uart->int_tx->save_index = 0; + } + + dev->flag |= RT_DEVICE_FLAG_ACTIVATED; + } + + return RT_EOK; } /* save a char to serial buffer */ static void rt_serial_savechar(struct serial_device* uart, char ch) { - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; + uart->int_rx->save_index ++; + if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->save_index = 0; + + /* if the next position is read index, discard this 'read char' */ + if (uart->int_rx->save_index == uart->int_rx->read_index) + { + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { - RT_ASSERT(dev != RT_NULL); - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { - RT_ASSERT(dev != RT_NULL); - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_base_t level; - - /* interrupt mode Rx */ - while (size) - { - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size --; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - break; - } - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - while (uart->uart_device->lsr & USTAT_RCV_READY) - { - *ptr = uart->uart_device->dlbl_fifo.txfifo & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + ptr = buffer; + err_code = RT_EOK; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_base_t level; + + /* interrupt mode Rx */ + while (size) + { + if (uart->int_rx->read_index != uart->int_rx->save_index) + { + *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; + size --; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + } + else + { + /* set error code */ + err_code = -RT_EEMPTY; + break; + } + } + } + else + { + /* polling mode */ + while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) + { + while (uart->uart_device->lsr & USTAT_RCV_READY) + { + *ptr = uart->uart_device->dlbl_fifo.txfifo & 0xff; + ptr ++; + } + } + } + + /* set error code */ + rt_set_errno(err_code); + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) -{ - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx */ - while (uart->int_tx->save_index != uart->int_tx->write_index) - { - /* save on tx buffer */ - uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - - -- size; - - /* move to next position */ - uart->int_tx->save_index ++; - - /* wrap save index */ - if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) - uart->int_tx->save_index = 0; - } - - /* set error code */ - if (size > 0) - err_code = -RT_EFULL; - } - else - { - /* polling mode */ - while (size) - { - /* - * to be polite with serial console add a line feed - * to the carriage return character - */ - if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) - { - while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); - uart->uart_device->dlbl_fifo.txfifo = '\r'; - } - - while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); - uart->uart_device->dlbl_fifo.txfifo = (*ptr & 0x1FF); - - ++ptr; --size; - } - } - - /* set error code */ - rt_set_errno(err_code); - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; +{ + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + err_code = RT_EOK; + ptr = (rt_uint8_t*)buffer; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + /* interrupt mode Tx */ + while (uart->int_tx->save_index != uart->int_tx->write_index) + { + /* save on tx buffer */ + uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; + + -- size; + + /* move to next position */ + uart->int_tx->save_index ++; + + /* wrap save index */ + if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) + uart->int_tx->save_index = 0; + } + + /* set error code */ + if (size > 0) + err_code = -RT_EFULL; + } + else + { + /* polling mode */ + while (size) + { + /* + * to be polite with serial console add a line feed + * to the carriage return character + */ + if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) + { + while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); + uart->uart_device->dlbl_fifo.txfifo = '\r'; + } + + while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); + uart->uart_device->dlbl_fifo.txfifo = (*ptr & 0x1FF); + + ++ptr; --size; + } + } + + /* set error code */ + rt_set_errno(err_code); + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - RT_ASSERT(dev != RT_NULL); - - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; - - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } - - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + + switch (cmd) + { + case RT_DEVICE_CTRL_SUSPEND: + /* suspend device */ + dev->flag |= RT_DEVICE_FLAG_SUSPENDED; + break; + + case RT_DEVICE_CTRL_RESUME: + /* resume device */ + dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; + break; + } + + return RT_EOK; } /* @@ -229,49 +229,49 @@ static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) */ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial) { - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); + RT_ASSERT(device != RT_NULL); + + device->type = RT_Device_Class_Char; + device->rx_indicate = RT_NULL; + device->tx_complete = RT_NULL; + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + device->user_data = serial; + + /* register a character device */ + return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); } - + /* ISR for serial interrupt */ void rt_hw_serial_isr(rt_device_t device) { - struct serial_device* uart = (struct serial_device*) device->user_data; - - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - - /* save on rx buffer */ - while (uart->uart_device->lsr & USTAT_RCV_READY) - { - rt_serial_savechar(uart, uart->uart_device->dlbl_fifo.rxfifo & 0xff); - } - - /* invoke callback */ - if (device->rx_indicate != RT_NULL) - { - rt_size_t rx_length; - - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; - - device->rx_indicate(device, rx_length); - } + struct serial_device* uart = (struct serial_device*) device->user_data; + + /* interrupt mode receive */ + RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); + + /* save on rx buffer */ + while (uart->uart_device->lsr & USTAT_RCV_READY) + { + rt_serial_savechar(uart, uart->uart_device->dlbl_fifo.rxfifo & 0xff); + } + + /* invoke callback */ + if (device->rx_indicate != RT_NULL) + { + rt_size_t rx_length; + + /* get rx length */ + rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? + UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : + uart->int_rx->save_index - uart->int_rx->read_index; + + device->rx_indicate(device, rx_length); + } } /*@}*/ diff --git a/libcpu/arm/sep4020/serial.h b/libcpu/arm/sep4020/serial.h index 69e7df248..26ec0f6ce 100644 --- a/libcpu/arm/sep4020/serial.h +++ b/libcpu/arm/sep4020/serial.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -7,7 +7,7 @@ * Date Author Notes * 2006-03-13 Bernard first version * 2009-04-20 yi.qiu modified according bernard's stm32 version - * 2010-10-6 wangmeng added sep4020 surpport + * 2010-10-6 wangmeng added sep4020 surpport */ #ifndef __SERIAL_H__ @@ -15,67 +15,67 @@ #include -#define USTAT_RCV_READY 0x01 /* receive data ready */ -#define USTAT_TXB_EMPTY 0x40 /* tx buffer empty */ -#define BPS 115200 /* serial baudrate */ +#define USTAT_RCV_READY 0x01 /* receive data ready */ +#define USTAT_TXB_EMPTY 0x40 /* tx buffer empty */ +#define BPS 115200 /* serial baudrate */ -#define UART_RX_BUFFER_SIZE 64 -#define UART_TX_BUFFER_SIZE 64 +#define UART_RX_BUFFER_SIZE 64 +#define UART_TX_BUFFER_SIZE 64 /*For sep4020's uart have several secondary function*/ /*we use union to decribe it*/ union dlbl_fifo { - rt_uint32_t dlbl; - rt_uint32_t rxfifo; - rt_uint32_t txfifo; + rt_uint32_t dlbl; + rt_uint32_t rxfifo; + rt_uint32_t txfifo; }; union dlbh_ier { - rt_uint32_t dlbh; - rt_uint32_t ier; + rt_uint32_t dlbh; + rt_uint32_t ier; }; union iir_fcr { - rt_uint32_t iir; - rt_uint32_t fcr; + rt_uint32_t iir; + rt_uint32_t fcr; }; struct serial_int_rx { - rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; - rt_uint32_t read_index, save_index; + rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; + rt_uint32_t read_index, save_index; }; struct serial_int_tx { - rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; - rt_uint32_t write_index, save_index; + rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; + rt_uint32_t write_index, save_index; }; typedef struct uartport { - union dlbl_fifo dlbl_fifo; - union dlbh_ier dlbh_ier; - union iir_fcr iir_fcr; - rt_uint32_t lcr; - rt_uint32_t mcr; - rt_uint32_t lsr; - rt_uint32_t msr; + union dlbl_fifo dlbl_fifo; + union dlbh_ier dlbh_ier; + union iir_fcr iir_fcr; + rt_uint32_t lcr; + rt_uint32_t mcr; + rt_uint32_t lsr; + rt_uint32_t msr; }uartport; struct serial_device { - uartport* uart_device; - - /* rx structure */ - struct serial_int_rx* int_rx; + uartport* uart_device; - /* tx structure */ - struct serial_int_tx* int_tx; + /* rx structure */ + struct serial_int_rx* int_rx; + + /* tx structure */ + struct serial_int_tx* int_tx; }; rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); diff --git a/libcpu/arm/sep4020/stack.c b/libcpu/arm/sep4020/stack.c index b2205c76d..3a7b5fd87 100644 --- a/libcpu/arm/sep4020/stack.c +++ b/libcpu/arm/sep4020/stack.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/arm/sep4020/trap.c b/libcpu/arm/sep4020/trap.c index c551b2246..441a55bd6 100644 --- a/libcpu/arm/sep4020/trap.c +++ b/libcpu/arm/sep4020/trap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -31,13 +31,13 @@ extern struct rt_thread *rt_current_thread; void rt_hw_show_register (struct rt_hw_register *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); + rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("cpsr:0x%08x\n", regs->cpsr); } /** @@ -50,13 +50,13 @@ void rt_hw_show_register (struct rt_hw_register *regs) */ void rt_hw_trap_udef(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("undefined instruction\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("undefined instruction\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -70,10 +70,10 @@ void rt_hw_trap_udef(struct rt_hw_register *regs) */ void rt_hw_trap_swi(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("software interrupt\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("software interrupt\n"); + rt_hw_cpu_shutdown(); } /** @@ -86,13 +86,13 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) */ void rt_hw_trap_pabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("prefetch abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("prefetch abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -105,13 +105,13 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) */ void rt_hw_trap_dabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("data abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("data abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -123,9 +123,9 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs) */ void rt_hw_trap_resv(struct rt_hw_register *regs) { - rt_kprintf("not used\n"); - rt_hw_show_register(regs); - rt_hw_cpu_shutdown(); + rt_kprintf("not used\n"); + rt_hw_show_register(regs); + rt_hw_cpu_shutdown(); } extern struct rt_irq_desc isr_table[]; @@ -155,13 +155,13 @@ void rt_hw_trap_irq(void) isr_func(irq, param); #ifdef RT_USING_INTERRUPT_INFO - isr_table[irq].counter++; + isr_table[irq].counter++; #endif /* RT_USING_INTERRUPT_INFO */ } void rt_hw_trap_fiq(void) { - rt_kprintf("fast interrupt request\n"); + rt_kprintf("fast interrupt request\n"); } /*@}*/ diff --git a/libcpu/arm/zynq7000/SConscript b/libcpu/arm/zynq7000/SConscript deleted file mode 100644 index 2ad51b573..000000000 --- a/libcpu/arm/zynq7000/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -Import('rtconfig') -from building import * - -cwd = GetCurrentDir() -src = Glob('*.c') -CPPPATH = [cwd] - -if rtconfig.PLATFORM == 'iar': - src += Glob('*_iar.S') -elif rtconfig.PLATFORM == 'gcc': - src += Glob('*_gcc.S') -elif rtconfig.PLATFORM == 'armcc': - src += Glob('*_rvds.S') - -group = DefineGroup('AM1808', src, depend = [''], CPPPATH = CPPPATH) - -Return('group') diff --git a/libcpu/arm/zynq7000/armv7.h b/libcpu/arm/zynq7000/armv7.h deleted file mode 100644 index 65f6c2786..000000000 --- a/libcpu/arm/zynq7000/armv7.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __ARMV7_H__ -#define __ARMV7_H__ -/* - * COPYRIGHT (C) 2013-2014, Shanghai Real-Thread Technology Co., Ltd - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* the exception stack without VFP registers */ -struct rt_hw_exp_stack -{ - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r4; - unsigned long r5; - unsigned long r6; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long fp; - unsigned long ip; - unsigned long sp; - unsigned long lr; - unsigned long pc; - unsigned long cpsr; -}; - -#define USERMODE 0x10 -#define FIQMODE 0x11 -#define IRQMODE 0x12 -#define SVCMODE 0x13 -#define MONITORMODE 0x16 -#define ABORTMODE 0x17 -#define HYPMODE 0x1b -#define UNDEFMODE 0x1b -#define MODEMASK 0x1f -#define NOINT 0xc0 - -#define T_Bit (1<<5) -#define F_Bit (1<<6) -#define I_Bit (1<<7) -#define A_Bit (1<<8) -#define E_Bit (1<<9) -#define J_Bit (1<<24) - -void rt_hw_mmu_init(void); - -#endif diff --git a/libcpu/arm/zynq7000/context_gcc.S b/libcpu/arm/zynq7000/context_gcc.S deleted file mode 100644 index 98f98a024..000000000 --- a/libcpu/arm/zynq7000/context_gcc.S +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2006-2018, Shanghai Real-Thread Technology Co., Ltd - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2009-01-20 Bernard first version - */ - -#define NOINT 0xc0 - -/* - * rt_base_t rt_hw_interrupt_disable(); - */ -.globl rt_hw_interrupt_disable -rt_hw_interrupt_disable: - mrs r0, cpsr - orr r1, r0, #NOINT - msr cpsr_c, r1 - bx lr - -/* - * void rt_hw_interrupt_enable(rt_base_t level); - */ -.globl rt_hw_interrupt_enable -rt_hw_interrupt_enable: - msr cpsr, r0 - bx lr - -/* - * void rt_hw_context_switch(rt_uint32 from, rt_uint32 to); - * r0 --> from - * r1 --> to - */ -.globl rt_hw_context_switch -rt_hw_context_switch: - stmfd sp!, {lr} @ push pc (lr should be pushed in place of PC) - stmfd sp!, {r0-r12, lr} @ push lr & register file - - mrs r4, cpsr - tst lr, #0x01 - beq _ARM_MODE - orr r4, r4, #0x20 @ it's thumb code - -_ARM_MODE: - stmfd sp!, {r4} @ push cpsr - - str sp, [r0] @ store sp in preempted tasks TCB - ldr sp, [r1] @ get new task stack pointer - - ldmfd sp!, {r4} @ pop new task cpsr to spsr - msr spsr_cxsf, r4 - - ldmfd sp!, {r0-r12, lr, pc}^ @ pop new task r0-r12, lr & pc, copy spsr to cpsr - -/* - * void rt_hw_context_switch_to(rt_uint32 to); - * r0 --> to - */ -.globl rt_hw_context_switch_to -rt_hw_context_switch_to: - ldr sp, [r0] @ get new task stack pointer - - ldmfd sp!, {r4} @ pop new task spsr - msr spsr_cxsf, r4 - - bic r4, r4, #0x20 @ must be ARM mode - msr cpsr_cxsf, r4 - - ldmfd sp!, {r0-r12, lr, pc}^ @ pop new task r0-r12, lr & pc - -/* - * void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to); - */ -.globl rt_thread_switch_interrupt_flag -.globl rt_interrupt_from_thread -.globl rt_interrupt_to_thread -.globl rt_hw_context_switch_interrupt -rt_hw_context_switch_interrupt: - ldr r2, =rt_thread_switch_interrupt_flag - ldr r3, [r2] - cmp r3, #1 - beq _reswitch - mov r3, #1 @ set rt_thread_switch_interrupt_flag to 1 - str r3, [r2] - ldr r2, =rt_interrupt_from_thread @ set rt_interrupt_from_thread - str r0, [r2] -_reswitch: - ldr r2, =rt_interrupt_to_thread @ set rt_interrupt_to_thread - str r1, [r2] - bx lr diff --git a/libcpu/arm/zynq7000/cp15.h b/libcpu/arm/zynq7000/cp15.h deleted file mode 100644 index 75d81736a..000000000 --- a/libcpu/arm/zynq7000/cp15.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#ifndef __CP15_H__ -#define __CP15_H__ - -unsigned long rt_cpu_get_smp_id(void); - -void rt_cpu_mmu_disable(void); -void rt_cpu_mmu_enable(void); -void rt_cpu_tlb_set(volatile unsigned long*); - -void rt_cpu_vector_set_base(unsigned int addr); - -#endif diff --git a/libcpu/arm/zynq7000/cp15_gcc.S b/libcpu/arm/zynq7000/cp15_gcc.S deleted file mode 100644 index 0e3e60655..000000000 --- a/libcpu/arm/zynq7000/cp15_gcc.S +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-05 Bernard the first version - */ - -.globl rt_cpu_get_smp_id -rt_cpu_get_smp_id: - mrc p15, #0, r0, c0, c0, #5 - bx lr - -.globl rt_cpu_vector_set_base -rt_cpu_vector_set_base: - mcr p15, #0, r0, c12, c0, #0 - dsb - bx lr - -.globl rt_hw_cpu_dcache_enable -rt_hw_cpu_dcache_enable: - mrc p15, #0, r0, c1, c0, #0 - orr r0, r0, #0x00000004 - mcr p15, #0, r0, c1, c0, #0 - bx lr - -.globl rt_hw_cpu_icache_enable -rt_hw_cpu_icache_enable: - mrc p15, #0, r0, c1, c0, #0 - orr r0, r0, #0x00001000 - mcr p15, #0, r0, c1, c0, #0 - bx lr - -_FLD_MAX_WAY: - .word 0x3ff -_FLD_MAX_IDX: - .word 0x7ff - -.globl rt_cpu_dcache_clean_flush -rt_cpu_dcache_clean_flush: - push {r4-r11} - dmb - mrc p15, #1, r0, c0, c0, #1 @ read clid register - ands r3, r0, #0x7000000 @ get level of coherency - mov r3, r3, lsr #23 - beq finished - mov r10, #0 -loop1: - add r2, r10, r10, lsr #1 - mov r1, r0, lsr r2 - and r1, r1, #7 - cmp r1, #2 - blt skip - mcr p15, #2, r10, c0, c0, #0 - isb - mrc p15, #1, r1, c0, c0, #0 - and r2, r1, #7 - add r2, r2, #4 - ldr r4, _FLD_MAX_WAY - ands r4, r4, r1, lsr #3 - clz r5, r4 - ldr r7, _FLD_MAX_IDX - ands r7, r7, r1, lsr #13 -loop2: - mov r9, r4 -loop3: - orr r11, r10, r9, lsl r5 - orr r11, r11, r7, lsl r2 - mcr p15, #0, r11, c7, c14, #2 - subs r9, r9, #1 - bge loop3 - subs r7, r7, #1 - bge loop2 -skip: - add r10, r10, #2 - cmp r3, r10 - bgt loop1 - -finished: - dsb - isb - pop {r4-r11} - bx lr - -.globl rt_hw_cpu_dcache_disable -rt_hw_cpu_dcache_disable: - push {r4-r11, lr} - bl rt_cpu_dcache_clean_flush - mrc p15, #0, r0, c1, c0, #0 - bic r0, r0, #0x00000004 - mcr p15, #0, r0, c1, c0, #0 - pop {r4-r11, lr} - bx lr - -.globl rt_hw_cpu_icache_disable -rt_hw_cpu_icache_disable: - mrc p15, #0, r0, c1, c0, #0 - bic r0, r0, #0x00001000 - mcr p15, #0, r0, c1, c0, #0 - bx lr - -.globl rt_cpu_mmu_disable -rt_cpu_mmu_disable: - mcr p15, #0, r0, c8, c7, #0 @ invalidate tlb - mrc p15, #0, r0, c1, c0, #0 - bic r0, r0, #1 - mcr p15, #0, r0, c1, c0, #0 @ clear mmu bit - dsb - bx lr - -.globl rt_cpu_mmu_enable -rt_cpu_mmu_enable: - mrc p15, #0, r0, c1, c0, #0 - orr r0, r0, #0x001 - mcr p15, #0, r0, c1, c0, #0 @ set mmu enable bit - dsb - bx lr - -.globl rt_cpu_tlb_set -rt_cpu_tlb_set: - mcr p15, #0, r0, c2, c0, #0 - dmb - bx lr diff --git a/libcpu/arm/zynq7000/cpu.c b/libcpu/arm/zynq7000/cpu.c deleted file mode 100644 index 5f3a3e7b0..000000000 --- a/libcpu/arm/zynq7000/cpu.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#include -#include -#include "zynq7000.h" - -/** - * reset cpu by dog's time-out - * - */ -void rt_hw_cpu_reset() -{ - while (1); /* loop forever and wait for reset to happen */ - - /* NEVER REACHED */ -} - -/** - * shutdown CPU - * - */ -void rt_hw_cpu_shutdown() -{ - rt_uint32_t level; - rt_kprintf("shutdown...\n"); - - level = rt_hw_interrupt_disable(); - while (level) - { - RT_ASSERT(0); - } -} - diff --git a/libcpu/arm/zynq7000/gic.c b/libcpu/arm/zynq7000/gic.c deleted file mode 100644 index e23a359e6..000000000 --- a/libcpu/arm/zynq7000/gic.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#include -#include - -#include "gic.h" -#include "cp15.h" - -struct arm_gic -{ - rt_uint32_t offset; - - rt_uint32_t dist_hw_base; - rt_uint32_t cpu_hw_base; -}; -static struct arm_gic _gic_table[ARM_GIC_MAX_NR]; - -#define GIC_CPU_CTRL(hw_base) __REG32((hw_base) + 0x00) -#define GIC_CPU_PRIMASK(hw_base) __REG32((hw_base) + 0x04) -#define GIC_CPU_BINPOINT(hw_base) __REG32((hw_base) + 0x08) -#define GIC_CPU_INTACK(hw_base) __REG32((hw_base) + 0x0c) -#define GIC_CPU_EOI(hw_base) __REG32((hw_base) + 0x10) -#define GIC_CPU_RUNNINGPRI(hw_base) __REG32((hw_base) + 0x14) -#define GIC_CPU_HIGHPRI(hw_base) __REG32((hw_base) + 0x18) - -#define GIC_DIST_CTRL(hw_base) __REG32((hw_base) + 0x000) -#define GIC_DIST_TYPE(hw_base) __REG32((hw_base) + 0x004) -#define GIC_DIST_IGROUP(hw_base, n) __REG32((hw_base) + 0x080 + (n/32) * 4) -#define GIC_DIST_ENABLE_SET(hw_base, n) __REG32((hw_base) + 0x100 + (n/32) * 4) -#define GIC_DIST_ENABLE_CLEAR(hw_base, n) __REG32((hw_base) + 0x180 + (n/32) * 4) -#define GIC_DIST_PENDING_SET(hw_base, n) __REG32((hw_base) + 0x200) -#define GIC_DIST_PENDING_CLEAR(hw_base, n) __REG32((hw_base) + 0x280) -#define GIC_DIST_ACTIVE_BIT(hw_base) __REG32((hw_base) + 0x300) -#define GIC_DIST_PRI(hw_base, n) __REG32((hw_base) + 0x400 + (n/4) * 4) -#define GIC_DIST_TARGET(hw_base, n) __REG32((hw_base) + 0x800 + (n/4) * 4) -#define GIC_DIST_CONFIG(hw_base, n) __REG32((hw_base) + 0xc00 + (n/16) * 4) -#define GIC_DIST_SOFTINT(hw_base) __REG32((hw_base) + 0xf00) -#define GIC_DIST_CPENDSGI(hw_base, n) __REG32((hw_base) + 0xf10 + (n/4) * 4) -#define GIC_DIST_ICPIDR2(hw_base) __REG32((hw_base) + 0xfe8) - -static unsigned int _gic_max_irq; - -int arm_gic_get_active_irq(rt_uint32_t index) -{ - int irq; - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - irq = GIC_CPU_INTACK(_gic_table[index].cpu_hw_base); - irq += _gic_table[index].offset; - return irq; -} - -void arm_gic_ack(rt_uint32_t index, int irq) -{ - rt_uint32_t mask = 1 << (irq % 32); - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - irq = irq - _gic_table[index].offset; - RT_ASSERT(irq >= 0); - - GIC_DIST_ENABLE_CLEAR(_gic_table[index].dist_hw_base, irq) = mask; - GIC_CPU_EOI(_gic_table[index].cpu_hw_base) = irq; - GIC_DIST_ENABLE_SET(_gic_table[index].dist_hw_base, irq) = mask; -} - -void arm_gic_mask(rt_uint32_t index, int irq) -{ - rt_uint32_t mask = 1 << (irq % 32); - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - irq = irq - _gic_table[index].offset; - RT_ASSERT(irq >= 0); - - GIC_DIST_ENABLE_CLEAR(_gic_table[index].dist_hw_base, irq) = mask; -} - -void arm_gic_set_cpu(rt_uint32_t index, int irq, unsigned int cpumask) -{ - rt_uint32_t old_tgt; - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - irq = irq - _gic_table[index].offset; - RT_ASSERT(irq >= 0); - - old_tgt = GIC_DIST_TARGET(_gic_table[index].dist_hw_base, irq); - - old_tgt &= ~(0x0FFUL << ((irq % 4)*8)); - old_tgt |= cpumask << ((irq % 4)*8); - - GIC_DIST_TARGET(_gic_table[index].dist_hw_base, irq) = old_tgt; -} - -void arm_gic_umask(rt_uint32_t index, int irq) -{ - rt_uint32_t mask = 1 << (irq % 32); - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - irq = irq - _gic_table[index].offset; - RT_ASSERT(irq >= 0); - - GIC_DIST_ENABLE_SET(_gic_table[index].dist_hw_base, irq) = mask; -} - -void arm_gic_dump_type(rt_uint32_t index) -{ - unsigned int gic_type; - - gic_type = GIC_DIST_TYPE(_gic_table[index].dist_hw_base); - rt_kprintf("GICv%d on %p, max IRQs: %d, %s security extension(%08x)\n", - (GIC_DIST_ICPIDR2(_gic_table[index].dist_hw_base) >> 4) & 0xf, - _gic_table[index].dist_hw_base, - _gic_max_irq, - gic_type & (1 << 10) ? "has" : "no", - gic_type); -} - -int arm_gic_dist_init(rt_uint32_t index, rt_uint32_t dist_base, int irq_start) -{ - unsigned int gic_type, i; - rt_uint32_t cpumask = 1 << 0; - - RT_ASSERT(index < ARM_GIC_MAX_NR); - - _gic_table[index].dist_hw_base = dist_base; - _gic_table[index].offset = irq_start; - - /* Find out how many interrupts are supported. */ - gic_type = GIC_DIST_TYPE(dist_base); - _gic_max_irq = ((gic_type & 0x1f) + 1) * 32; - - /* - * The GIC only supports up to 1020 interrupt sources. - * Limit this to either the architected maximum, or the - * platform maximum. - */ - if (_gic_max_irq > 1020) - _gic_max_irq = 1020; - if (_gic_max_irq > ARM_GIC_NR_IRQS) - _gic_max_irq = ARM_GIC_NR_IRQS; - - cpumask |= cpumask << 8; - cpumask |= cpumask << 16; - - GIC_DIST_CTRL(dist_base) = 0x0; - - /* Set all global interrupts to be level triggered, active low. */ - for (i = 32; i < _gic_max_irq; i += 16) - GIC_DIST_CONFIG(dist_base, i) = 0x0; - - /* Set all global interrupts to this CPU only. */ - for (i = 32; i < _gic_max_irq; i += 4) - GIC_DIST_TARGET(dist_base, i) = cpumask; - - /* Set priority on all interrupts. */ - for (i = 0; i < _gic_max_irq; i += 4) - GIC_DIST_PRI(dist_base, i) = 0xa0a0a0a0; - - /* Disable all interrupts. */ - for (i = 0; i < _gic_max_irq; i += 32) - GIC_DIST_ENABLE_CLEAR(dist_base, i) = 0xffffffff; - - /* Set the FIQEn bit, signal FIQ for IGROUP0. */ - GIC_DIST_CTRL(dist_base) = 0x01; - - return 0; -} - -int arm_gic_cpu_init(rt_uint32_t index, rt_uint32_t cpu_base) -{ - RT_ASSERT(index < ARM_GIC_MAX_NR); - - _gic_table[index].cpu_hw_base = cpu_base; - - GIC_CPU_PRIMASK(cpu_base) = 0xf0; - /* Enable CPU interrupt */ - GIC_CPU_CTRL(cpu_base) = 0x01; - - return 0; -} - -void arm_gic_set_group(rt_uint32_t index, int vector, int group) -{ - /* As for GICv2, there are only group0 and group1. */ - RT_ASSERT(group <= 1); - RT_ASSERT(vector < _gic_max_irq); - - if (group == 0) - { - GIC_DIST_IGROUP(_gic_table[index].dist_hw_base, - vector) &= ~(1 << (vector % 32)); - } - else if (group == 1) - { - GIC_DIST_IGROUP(_gic_table[index].dist_hw_base, - vector) |= (1 << (vector % 32)); - } -} - -void arm_gic_trigger(rt_uint32_t index, int target_cpu, int irq) -{ - unsigned int reg; - - RT_ASSERT(irq <= 15); - RT_ASSERT(target_cpu <= 255); - - reg = (target_cpu << 16) | irq; - GIC_DIST_SOFTINT(_gic_table[index].dist_hw_base) = reg; -} - -void arm_gic_clear_sgi(rt_uint32_t index, int target_cpu, int irq) -{ - RT_ASSERT(irq <= 15); - RT_ASSERT(target_cpu <= 255); - - GIC_DIST_CPENDSGI(_gic_table[index].dist_hw_base, irq) = target_cpu << (irq % 4); -} diff --git a/libcpu/arm/zynq7000/gic.h b/libcpu/arm/zynq7000/gic.h deleted file mode 100644 index 8fcdf05f6..000000000 --- a/libcpu/arm/zynq7000/gic.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#ifndef __GIC_H__ -#define __GIC_H__ - -int arm_gic_dist_init(rt_uint32_t index, rt_uint32_t dist_base, int irq_start); -int arm_gic_cpu_init(rt_uint32_t index, rt_uint32_t cpu_base); - -void arm_gic_mask(rt_uint32_t index, int irq); -void arm_gic_umask(rt_uint32_t index, int irq); -void arm_gic_set_cpu(rt_uint32_t index, int irq, unsigned int cpumask); -void arm_gic_set_group(rt_uint32_t index, int vector, int group); - -int arm_gic_get_active_irq(rt_uint32_t index); -void arm_gic_ack(rt_uint32_t index, int irq); - -void arm_gic_trigger(rt_uint32_t index, int target_cpu, int irq); -void arm_gic_clear_sgi(rt_uint32_t index, int target_cpu, int irq); - -void arm_gic_dump_type(rt_uint32_t index); - -#endif - diff --git a/libcpu/arm/zynq7000/interrupt.c b/libcpu/arm/zynq7000/interrupt.c deleted file mode 100644 index 451785523..000000000 --- a/libcpu/arm/zynq7000/interrupt.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * COPYRIGHT (C) 2013-2014, Shanghai Real-Thread Technology Co., Ltd - * - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include -#include -#include "zynq7000.h" -#include "cp15.h" -#include "gic.h" - -#define MAX_HANDLERS IRQ_Zynq7000_MAXNR - -extern volatile rt_uint8_t rt_interrupt_nest; - -/* exception and interrupt handler table */ -struct rt_irq_desc isr_table[MAX_HANDLERS]; -rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; -rt_uint32_t rt_thread_switch_interrupt_flag; - -static void rt_hw_interrupt_handle(int vector, void *param) -{ - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); -} - -const unsigned int VECTOR_BASE = 0x00; -extern int system_vectors; - -static void rt_hw_vector_init(void) -{ - int sctrl; - unsigned int *src = (unsigned int *)&system_vectors; - - /* C12-C0 is only active when SCTLR.V = 0 */ - asm volatile ("mrc p15, #0, %0, c1, c0, #0" - :"=r" (sctrl)); - sctrl &= ~(1 << 13); - asm volatile ("mcr p15, #0, %0, c1, c0, #0" - : - :"r" (sctrl)); - - asm volatile ("mcr p15, #0, %0, c12, c0, #0" - : - :"r" (src)); -} - -/** - * This function will initialize hardware interrupt - */ -void rt_hw_interrupt_init(void) -{ - register rt_uint32_t idx; - - /* set vector table */ - rt_hw_vector_init(); - - /* init exceptions table */ - rt_memset(isr_table, 0x00, sizeof(isr_table)); - for (idx = 0; idx < MAX_HANDLERS; idx++) - { - isr_table[idx].handler = rt_hw_interrupt_handle; - } - - /* initialize ARM GIC */ - arm_gic_dist_init(0, Zynq7000_GIC_DIST_BASE, 0); - arm_gic_cpu_init(0, Zynq7000_GIC_CPU_BASE); - - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; -} - -/** - * This function will mask a interrupt. - * @param vector the interrupt number - */ -void rt_hw_interrupt_mask(int vector) -{ - arm_gic_mask(0, vector); -} - -/** - * This function will un-mask a interrupt. - * @param vector the interrupt number - */ -void rt_hw_interrupt_umask(int vector) -{ - arm_gic_umask(0, vector); -} - -/** - * This function will install a interrupt service routine to a interrupt. - * @param vector the interrupt number - * @param new_handler the interrupt service routine to be installed - * @param old_handler the old interrupt service routine - */ -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) -{ - rt_isr_handler_t old_handler = RT_NULL; - - if (vector < MAX_HANDLERS) - { - old_handler = isr_table[vector].handler; - - if (handler != RT_NULL) - { -#ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); -#endif /* RT_USING_INTERRUPT_INFO */ - isr_table[vector].handler = handler; - isr_table[vector].param = param; - } - /* set the interrupt to this cpu */ - arm_gic_set_cpu(0, vector, 1 << rt_cpu_get_smp_id()); - } - - return old_handler; -} - -void rt_hw_interrupt_clear(int vector) -{ - /* SGI will be cleared automatically. */ - if (vector < 16) - return; -} diff --git a/libcpu/arm/zynq7000/interrupt.h b/libcpu/arm/zynq7000/interrupt.h deleted file mode 100644 index da266c42a..000000000 --- a/libcpu/arm/zynq7000/interrupt.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#ifndef __INTERRUPT_H__ -#define __INTERRUPT_H__ - -void rt_hw_interrupt_clear(int vector); - -#endif /* end of include guard: __INTERRUPT_H__ */ - diff --git a/libcpu/arm/zynq7000/mmu.c b/libcpu/arm/zynq7000/mmu.c deleted file mode 100644 index fbdacca10..000000000 --- a/libcpu/arm/zynq7000/mmu.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#include -#include -#include - -#include "cp15.h" - -#define DESC_SEC (0x2) -#define CB (3<<2) //cache_on, write_back -#define CNB (2<<2) //cache_on, write_through -#define NCB (1<<2) //cache_off,WR_BUF on -#define NCNB (0<<2) //cache_off,WR_BUF off -#define AP_RW (3<<10) //supervisor=RW, user=RW -#define AP_RO (2<<10) //supervisor=RW, user=RO -#define XN (1<<4) //eXecute Never - -#define DOMAIN_FAULT (0x0) -#define DOMAIN_CHK (0x1) -#define DOMAIN_NOTCHK (0x3) -#define DOMAIN0 (0x0<<5) -#define DOMAIN1 (0x1<<5) - -#define DOMAIN0_ATTR (DOMAIN_CHK<<0) -#define DOMAIN1_ATTR (DOMAIN_FAULT<<2) - -/* Read/Write, cache, write back */ -#define RW_CB (AP_RW|DOMAIN0|CB|DESC_SEC) -/* Read/Write, cache, write through */ -#define RW_CNB (AP_RW|DOMAIN0|CNB|DESC_SEC) -/* Read/Write, device type */ -#define RW_NCB (AP_RW|DOMAIN0|NCB|DESC_SEC) -/* Read/Write strongly ordered type */ -#define RW_NCNB (AP_RW|DOMAIN0|NCNB|DESC_SEC) -/* Read/Write without cache and write buffer, no execute */ -#define RW_NCNBXN (AP_RW|DOMAIN0|NCNB|DESC_SEC|XN) -/* Read/Write without cache and write buffer */ -#define RW_FAULT (AP_RW|DOMAIN1|NCNB|DESC_SEC) - -void rt_hw_cpu_dump_page_table(rt_uint32_t *ptb) -{ - int i; - int fcnt = 0; - - rt_kprintf("page table@%p\n", ptb); - for (i = 0; i < 1024*4; i++) - { - rt_uint32_t pte1 = ptb[i]; - if ((pte1 & 0x3) == 0) - { - rt_kprintf("%03x: ", i); - fcnt++; - if (fcnt == 16) - { - rt_kprintf("fault\n"); - fcnt = 0; - } - continue; - } - if (fcnt != 0) - { - rt_kprintf("fault\n"); - fcnt = 0; - } - - rt_kprintf("%03x: %08x: ", i, pte1); - if ((pte1 & 0x3) == 0x3) - { - rt_kprintf("LPAE\n"); - } - else if ((pte1 & 0x3) == 0x1) - { - rt_kprintf("pte,ns:%d,domain:%d\n", - (pte1 >> 3) & 0x1, (pte1 >> 5) & 0xf); - /* - *rt_hw_cpu_dump_page_table_2nd((void*)((pte1 & 0xfffffc000) - * - 0x80000000 + 0xC0000000)); - */ - } - else if (pte1 & (1 << 18)) - { - rt_kprintf("super section,ns:%d,ap:%x,xn:%d,texcb:%02x\n", - (pte1 >> 19) & 0x1, - ((pte1 >> 13) | (pte1 >> 10))& 0xf, - (pte1 >> 4) & 0x1, - ((pte1 >> 10) | (pte1 >> 2)) & 0x1f); - } - else - { - rt_kprintf("section,ns:%d,ap:%x," - "xn:%d,texcb:%02x,domain:%d\n", - (pte1 >> 19) & 0x1, - ((pte1 >> 13) | (pte1 >> 10))& 0xf, - (pte1 >> 4) & 0x1, - (((pte1 & (0x7 << 12)) >> 10) | - ((pte1 & 0x0c) >> 2)) & 0x1f, - (pte1 >> 5) & 0xf); - } - } -} - -/* level1 page table, each entry for 1MB memory. */ -/* MMUTable is the name used by codes of Xilinx */ -volatile unsigned long MMUTable[4*1024] SECTION("mmu_tbl") __attribute__((aligned(16*1024))); -void rt_hw_mmu_setmtt(rt_uint32_t vaddrStart, - rt_uint32_t vaddrEnd, - rt_uint32_t paddrStart, - rt_uint32_t attr) -{ - volatile rt_uint32_t *pTT; - volatile int i, nSec; - pTT = (rt_uint32_t *)MMUTable + (vaddrStart >> 20); - nSec = (vaddrEnd >> 20) - (vaddrStart >> 20); - for(i = 0; i <= nSec; i++) - { - *pTT = attr | (((paddrStart >> 20) + i) << 20); - pTT++; - } -} - -unsigned long rt_hw_set_domain_register(unsigned long domain_val) -{ - unsigned long old_domain; - - asm volatile ("mrc p15, 0, %0, c3, c0\n" : "=r" (old_domain)); - asm volatile ("mcr p15, 0, %0, c3, c0\n" : :"r" (domain_val) : "memory"); - - return old_domain; -} - -void rt_hw_mmu_init(void) -{ - extern rt_uint32_t __text_start; - rt_hw_cpu_dcache_disable(); - rt_hw_cpu_icache_disable(); - rt_cpu_mmu_disable(); - - /* set page table */ - /* no access to the memory below .text */ - /* 128M cached DDR memory */ - rt_hw_mmu_setmtt((rt_uint32_t)&__text_start, 0x20000000-1, - 0x1ff00000, RW_CB); - /* PL region */ - rt_hw_mmu_setmtt(0x40000000, 0xBFFFFFFF, 0x40000000, RW_NCNBXN); - /* IOP registers */ - rt_hw_mmu_setmtt(0xE0000000, 0xE02FFFFF, 0xE0000000, RW_NCNBXN); - /* no access to the SMC memory(enable it if you want) */ - /* SLCR, PS and CPU private registers, note we map more memory space as the - * entry is 1MB in size. */ - rt_hw_mmu_setmtt(0xF8000000, 0xF8FFFFFF, 0xF8000000, RW_NCNBXN); - - /*rt_hw_cpu_dump_page_table(MMUTable);*/ - - /* become clients for all domains */ - rt_hw_set_domain_register(0x55555555); - - rt_cpu_tlb_set(MMUTable); - - rt_cpu_mmu_enable(); - - rt_hw_cpu_icache_enable(); - rt_hw_cpu_dcache_enable(); -} - diff --git a/libcpu/arm/zynq7000/stack.c b/libcpu/arm/zynq7000/stack.c deleted file mode 100644 index b38dd160f..000000000 --- a/libcpu/arm/zynq7000/stack.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2011-09-23 Bernard the first version - * 2011-10-05 Bernard add thumb mode - * 2013-07-15 Bernard add Cortex-A8 support. - */ -#include -#include "zynq7000.h" - -/** - * This function will initialize thread stack - * - * @param tentry the entry of thread - * @param parameter the parameter of entry - * @param stack_addr the beginning stack address - * @param texit the function will be called when thread exit - * - * @return stack address - */ -rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) -{ - rt_uint32_t *stk; - - stack_addr += sizeof(rt_uint32_t); - stack_addr = (rt_uint8_t *)RT_ALIGN_DOWN((rt_uint32_t)stack_addr, 8); - stk = (rt_uint32_t *)stack_addr; - *(--stk) = (rt_uint32_t)tentry; /* entry point */ - *(--stk) = (rt_uint32_t)texit; /* lr */ - *(--stk) = 0xdeadbeef; /* r12 */ - *(--stk) = 0xdeadbeef; /* r11 */ - *(--stk) = 0xdeadbeef; /* r10 */ - *(--stk) = 0xdeadbeef; /* r9 */ - *(--stk) = 0xdeadbeef; /* r8 */ - *(--stk) = 0xdeadbeef; /* r7 */ - *(--stk) = 0xdeadbeef; /* r6 */ - *(--stk) = 0xdeadbeef; /* r5 */ - *(--stk) = 0xdeadbeef; /* r4 */ - *(--stk) = 0xdeadbeef; /* r3 */ - *(--stk) = 0xdeadbeef; /* r2 */ - *(--stk) = 0xdeadbeef; /* r1 */ - *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ - - /* cpsr */ - if ((rt_uint32_t)tentry & 0x01) - *(--stk) = SVCMODE | 0x20; /* thumb mode */ - else - *(--stk) = SVCMODE; /* arm mode */ - - /* return task's current stack address */ - return (rt_uint8_t *)stk; -} - diff --git a/libcpu/arm/zynq7000/start_gcc.S b/libcpu/arm/zynq7000/start_gcc.S deleted file mode 100644 index 18056f0ad..000000000 --- a/libcpu/arm/zynq7000/start_gcc.S +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-05 Bernard the first version - */ - -.equ Mode_USR, 0x10 -.equ Mode_FIQ, 0x11 -.equ Mode_IRQ, 0x12 -.equ Mode_SVC, 0x13 -.equ Mode_ABT, 0x17 -.equ Mode_UND, 0x1B -.equ Mode_SYS, 0x1F - -.equ I_Bit, 0x80 @ when I bit is set, IRQ is disabled -.equ F_Bit, 0x40 @ when F bit is set, FIQ is disabled - -.equ UND_Stack_Size, 0x00000000 -.equ SVC_Stack_Size, 0x00000000 -.equ ABT_Stack_Size, 0x00000000 -.equ FIQ_Stack_Size, 0x00000100 -.equ IRQ_Stack_Size, 0x00000100 -.equ USR_Stack_Size, 0x00000000 - -#define ISR_Stack_Size (UND_Stack_Size + SVC_Stack_Size + ABT_Stack_Size + \ - FIQ_Stack_Size + IRQ_Stack_Size) - -/* stack */ -.globl stack_start -.globl stack_top - -.align 3 -.bss -stack_start: -.rept ISR_Stack_Size -.long 0 -.endr -stack_top: - -.text -/* reset entry */ -.globl _reset -_reset: - /* invalidate SCU */ - ldr r7, =0xF8F0000C - ldr r6, =0xFFFF - str r6, [r7] - - /* disable MMU */ - mrc p15, 0, r0, c1, c0, 0 /* read CP15 register 1 */ - bic r0, r0, #0x1 /* clear bit 0 */ - mcr p15, 0, r0, c1, c0, 0 /* write value back */ - - /* set the cpu to SVC32 mode and disable interrupt */ - mrs r0, cpsr - bic r0, r0, #0x1f - orr r0, r0, #0x13 - msr cpsr_c, r0 - - /* setup stack */ - bl stack_setup - - /* clear .bss */ - mov r0,#0 /* get a zero */ - ldr r1,=__bss_start /* bss start */ - ldr r2,=__bss_end /* bss end */ - -bss_loop: - cmp r1,r2 /* check if data to clear */ - strlo r0,[r1],#4 /* clear 4 bytes */ - blo bss_loop /* loop until done */ - - /* call C++ constructors of global objects */ - ldr r0, =__ctors_start__ - ldr r1, =__ctors_end__ - -ctor_loop: - cmp r0, r1 - beq ctor_end - ldr r2, [r0], #4 - stmfd sp!, {r0-r1} - mov lr, pc - bx r2 - ldmfd sp!, {r0-r1} - b ctor_loop -ctor_end: - - /* start RT-Thread Kernel */ - ldr pc, _rtthread_startup - -_rtthread_startup: - .word rtthread_startup - -stack_setup: - ldr r0, =stack_top - - @ Set the startup stack for svc - mov sp, r0 - - @ Enter Undefined Instruction Mode and set its Stack Pointer - msr cpsr_c, #Mode_UND|I_Bit|F_Bit - mov sp, r0 - sub r0, r0, #UND_Stack_Size - - @ Enter Abort Mode and set its Stack Pointer - msr cpsr_c, #Mode_ABT|I_Bit|F_Bit - mov sp, r0 - sub r0, r0, #ABT_Stack_Size - - @ Enter FIQ Mode and set its Stack Pointer - msr cpsr_c, #Mode_FIQ|I_Bit|F_Bit - mov sp, r0 - sub r0, r0, #FIQ_Stack_Size - - @ Enter IRQ Mode and set its Stack Pointer - msr cpsr_c, #Mode_IRQ|I_Bit|F_Bit - mov sp, r0 - sub r0, r0, #IRQ_Stack_Size - - @ Switch back to SVC - msr cpsr_c, #Mode_SVC|I_Bit|F_Bit - - bx lr - -.section .text.isr, "ax" -/* exception handlers: undef, swi, padt, dabt, resv, irq, fiq */ - .align 5 -.globl vector_fiq -vector_fiq: - stmfd sp!,{r0-r7,lr} - bl rt_hw_trap_fiq - ldmfd sp!,{r0-r7,lr} - subs pc,lr,#4 - -.globl rt_interrupt_enter -.globl rt_interrupt_leave -.globl rt_thread_switch_interrupt_flag -.globl rt_interrupt_from_thread -.globl rt_interrupt_to_thread - - .align 5 -.globl vector_irq -vector_irq: - stmfd sp!, {r0-r12,lr} - bl rt_interrupt_enter - bl rt_hw_trap_irq - bl rt_interrupt_leave - - @ if rt_thread_switch_interrupt_flag set, jump to - @ rt_hw_context_switch_interrupt_do and don't return - ldr r0, =rt_thread_switch_interrupt_flag - ldr r1, [r0] - cmp r1, #1 - beq rt_hw_context_switch_interrupt_do - - ldmfd sp!, {r0-r12,lr} - subs pc, lr, #4 - -rt_hw_context_switch_interrupt_do: - mov r1, #0 @ clear flag - str r1, [r0] - - mov r1, sp @ r1 point to {r0-r3} in stack - add sp, sp, #4*4 - ldmfd sp!, {r4-r12,lr}@ reload saved registers - mrs r0, spsr @ get cpsr of interrupt thread - sub r2, lr, #4 @ save old task's pc to r2 - - @ Switch to SVC mode with no interrupt. - msr cpsr_c, #I_Bit|F_Bit|Mode_SVC - - stmfd sp!, {r2} @ push old task's pc - stmfd sp!, {r4-r12,lr}@ push old task's lr,r12-r4 - ldmfd r1, {r1-r4} @ restore r0-r3 of the interrupt thread - stmfd sp!, {r1-r4} @ push old task's r0-r3 - stmfd sp!, {r0} @ push old task's cpsr - - ldr r4, =rt_interrupt_from_thread - ldr r5, [r4] - str sp, [r5] @ store sp in preempted tasks's TCB - - ldr r6, =rt_interrupt_to_thread - ldr r7, [r6] - ldr sp, [r7] @ get new task's stack pointer - - ldmfd sp!, {r4} @ pop new task's cpsr to spsr - msr spsr_cxsf, r4 - - ldmfd sp!, {r0-r12,lr,pc}^ @ pop new task's r0-r12,lr & pc, copy spsr to cpsr - - -.macro push_svc_reg - sub sp, sp, #17 * 4 @/* Sizeof(struct rt_hw_exp_stack) */ - stmia sp, {r0 - r12} @/* Calling r0-r12 */ - mov r0, sp - mrs r6, spsr @/* Save CPSR */ - str lr, [r0, #15*4] @/* Push PC */ - str r6, [r0, #16*4] @/* Push CPSR */ - cps #Mode_SVC - str sp, [r0, #13*4] @/* Save calling SP */ - str lr, [r0, #14*4] @/* Save calling PC */ -.endm - - .align 5 - .globl vector_swi -vector_swi: - push_svc_reg - bl rt_hw_trap_swi - b . - - .align 5 - .globl vector_undef -vector_undef: - push_svc_reg - bl rt_hw_trap_undef - b . - - .align 5 - .globl vector_pabt -vector_pabt: - push_svc_reg - bl rt_hw_trap_pabt - b . - - .align 5 - .globl vector_dabt -vector_dabt: - push_svc_reg - bl rt_hw_trap_dabt - b . - - .align 5 - .globl vector_resv -vector_resv: - push_svc_reg - bl rt_hw_trap_resv - b . diff --git a/libcpu/arm/zynq7000/trap.c b/libcpu/arm/zynq7000/trap.c deleted file mode 100644 index 6243ea82b..000000000 --- a/libcpu/arm/zynq7000/trap.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-20 Bernard first version - */ - -#include -#include - -#include "zynq7000.h" -#include "gic.h" - -extern struct rt_thread *rt_current_thread; -#ifdef RT_USING_FINSH -extern long list_thread(void); -#endif - -/** - * this function will show registers of CPU - * - * @param regs the registers point - */ -void rt_hw_show_register (struct rt_hw_exp_stack *regs) -{ - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x\n", regs->r8, regs->r9, regs->r10); - rt_kprintf("fp :0x%08x ip :0x%08x\n", regs->fp, regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("cpsr:0x%08x\n", regs->cpsr); -} - -/** - * When comes across an instruction which it cannot handle, - * it takes the undefined instruction trap. - * - * @param regs system registers - * - * @note never invoke this function in application - */ -void rt_hw_trap_undef(struct rt_hw_exp_stack *regs) -{ - rt_kprintf("undefined instruction:\n"); - rt_hw_show_register(regs); -#ifdef RT_USING_FINSH - list_thread(); -#endif - rt_hw_cpu_shutdown(); -} - -/** - * The software interrupt instruction (SWI) is used for entering - * Supervisor mode, usually to request a particular supervisor - * function. - * - * @param regs system registers - * - * @note never invoke this function in application - */ -void rt_hw_trap_swi(struct rt_hw_exp_stack *regs) -{ - rt_kprintf("software interrupt:\n"); - rt_hw_show_register(regs); -#ifdef RT_USING_FINSH - list_thread(); -#endif - rt_hw_cpu_shutdown(); -} - -/** - * An abort indicates that the current memory access cannot be completed, - * which occurs during an instruction prefetch. - * - * @param regs system registers - * - * @note never invoke this function in application - */ -void rt_hw_trap_pabt(struct rt_hw_exp_stack *regs) -{ - rt_kprintf("prefetch abort:\n"); - rt_hw_show_register(regs); -#ifdef RT_USING_FINSH - list_thread(); -#endif - rt_hw_cpu_shutdown(); -} - -/** - * An abort indicates that the current memory access cannot be completed, - * which occurs during a data access. - * - * @param regs system registers - * - * @note never invoke this function in application - */ -void rt_hw_trap_dabt(struct rt_hw_exp_stack *regs) -{ - rt_kprintf("data abort:"); - rt_hw_show_register(regs); -#ifdef RT_USING_FINSH - list_thread(); -#endif - rt_hw_cpu_shutdown(); -} - -/** - * Normally, system will never reach here - * - * @param regs system registers - * - * @note never invoke this function in application - */ -void rt_hw_trap_resv(struct rt_hw_exp_stack *regs) -{ - rt_kprintf("reserved trap:\n"); - rt_hw_show_register(regs); -#ifdef RT_USING_FINSH - list_thread(); -#endif - rt_hw_cpu_shutdown(); -} - -#define GIC_ACK_INTID_MASK 0x000003ff - -void rt_hw_trap_irq() -{ - void *param; - unsigned long ir; - unsigned long fullir; - rt_isr_handler_t isr_func; - extern struct rt_irq_desc isr_table[]; - - fullir = arm_gic_get_active_irq(0); - ir = fullir & GIC_ACK_INTID_MASK; - - /* get interrupt service routine */ - isr_func = isr_table[ir].handler; - if (isr_func) - { - param = isr_table[ir].param; - /* turn to interrupt service routine */ - isr_func(ir, param); - } - - /* end of interrupt */ - arm_gic_ack(0, fullir); -} - -void rt_hw_trap_fiq() -{ - void *param; - unsigned long ir; - unsigned long fullir; - rt_isr_handler_t isr_func; - extern struct rt_irq_desc isr_table[]; - - fullir = arm_gic_get_active_irq(0); - ir = fullir & GIC_ACK_INTID_MASK; - - /* get interrupt service routine */ - isr_func = isr_table[ir].handler; - param = isr_table[ir].param; - - /* turn to interrupt service routine */ - isr_func(ir, param); - - /* end of interrupt */ - arm_gic_ack(0, fullir); -} - diff --git a/libcpu/arm/zynq7000/vector_gcc.S b/libcpu/arm/zynq7000/vector_gcc.S deleted file mode 100644 index 60d3c6cf1..000000000 --- a/libcpu/arm/zynq7000/vector_gcc.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2006-2018, RT-Thread Development Team - * - * SPDX-License-Identifier: Apache-2.0 - * - * Change Logs: - * Date Author Notes - * 2013-07-05 Bernard the first version - */ - -.section .vectors, "ax" -.code 32 - -.globl system_vectors -system_vectors: - ldr pc, _vector_reset - ldr pc, _vector_undef - ldr pc, _vector_swi - ldr pc, _vector_pabt - ldr pc, _vector_dabt - ldr pc, _vector_resv - ldr pc, _vector_irq - ldr pc, _vector_fiq - -.globl _reset -.globl vector_undef -.globl vector_swi -.globl vector_pabt -.globl vector_dabt -.globl vector_resv -.globl vector_irq -.globl vector_fiq - -_vector_reset: - .word _reset -_vector_undef: - .word vector_undef -_vector_swi: - .word vector_swi -_vector_pabt: - .word vector_pabt -_vector_dabt: - .word vector_dabt -_vector_resv: - .word vector_resv -_vector_irq: - .word vector_irq -_vector_fiq: - .word vector_fiq - -.balignl 16,0xdeadbeef diff --git a/libcpu/avr32/uc3/cpu.c b/libcpu/avr32/uc3/cpu.c index b77e78dc5..190ce9325 100644 --- a/libcpu/avr32/uc3/cpu.c +++ b/libcpu/avr32/uc3/cpu.c @@ -25,7 +25,7 @@ */ void rt_hw_cpu_reset() { - /*NOTREACHED*/ + /*NOTREACHED*/ } /** @@ -34,9 +34,9 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - RT_ASSERT(0); + RT_ASSERT(0); } /*@}*/ diff --git a/libcpu/avr32/uc3/exception_gcc.S b/libcpu/avr32/uc3/exception_gcc.S index d5051af25..cdf2576f5 100644 --- a/libcpu/avr32/uc3/exception_gcc.S +++ b/libcpu/avr32/uc3/exception_gcc.S @@ -289,7 +289,7 @@ rt_hw_context_switch_interrupt_do: ld.w r12, r12[0] lda.w r11, rt_interrupt_to_thread /* Get new thread SP */ ld.w r11, r11[0] - st.w r12[0], sp /* Store old thead SP */ + st.w r12[0], sp /* Store old thread SP */ ld.w sp, r11[0] /* Load new thread SP */ ldm sp++, r0-r7 /* Pop R0-R7 (new thread) */ rete /* RETE pops R8-R12, LR, PC, SR automatically */ diff --git a/libcpu/avr32/uc3/serial.c b/libcpu/avr32/uc3/serial.c index 14ef86544..66fb6ca8b 100644 --- a/libcpu/avr32/uc3/serial.c +++ b/libcpu/avr32/uc3/serial.c @@ -24,8 +24,8 @@ struct rt_device _rt_usart_device; struct avr32_serial_int_rx _rt_usart_rx; struct avr32_serial_device uart = { - .uart_device = (avr32_usart_t *) &AVR32_USART1, - .int_rx = &_rt_usart_rx + .uart_device = (avr32_usart_t *) &AVR32_USART1, + .int_rx = &_rt_usart_rx }; /** @@ -36,163 +36,163 @@ struct avr32_serial_device uart = /* RT-Thread Device Interface */ static rt_err_t rt_serial_init (rt_device_t dev) { - struct avr32_serial_device* uart = (struct avr32_serial_device*) dev->user_data; + struct avr32_serial_device* uart = (struct avr32_serial_device*) dev->user_data; - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = 0; - uart->int_rx->save_index = 0; - } + if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) + { + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_memset(uart->int_rx->rx_buffer, 0, sizeof(uart->int_rx->rx_buffer)); + uart->int_rx->read_index = 0; + uart->int_rx->save_index = 0; + } - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } + dev->flag |= RT_DEVICE_FLAG_ACTIVATED; + } - return RT_EOK; + return RT_EOK; } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { - return RT_EOK; + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { - return RT_EOK; + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct avr32_serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct avr32_serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - /* interrupt mode Rx */ - while (size) - { - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - /* read a character */ - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size--; - - /* move to next position */ - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - break; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - while (usart_test_hit(uart->uart_device)) - { - *ptr = uart->uart_device->rhr & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct avr32_serial_device* uart; + + ptr = buffer; + err_code = RT_EOK; + uart = (struct avr32_serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + /* interrupt mode Rx */ + while (size) + { + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + if (uart->int_rx->read_index != uart->int_rx->save_index) + { + /* read a character */ + *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; + size--; + + /* move to next position */ + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + } + else + { + /* set error code */ + err_code = -RT_EEMPTY; + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + break; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + } + } + else + { + /* polling mode */ + while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) + { + while (usart_test_hit(uart->uart_device)) + { + *ptr = uart->uart_device->rhr & 0xff; + ptr ++; + } + } + } + + /* set error code */ + rt_set_errno(err_code); + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct avr32_serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct avr32_serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx, does not support */ - RT_ASSERT(0); - } - else - { - /* polling mode */ - if (dev->flag & RT_DEVICE_FLAG_STREAM) - { - /* stream mode */ - while (size) - { - usart_putchar(uart->uart_device, (int) *ptr); - - ++ptr; --size; - } - } - else - { - /* write data directly */ - while (size) - { - usart_bw_write_char(uart->uart_device, (int) *ptr); - - ++ptr; --size; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct avr32_serial_device* uart; + + err_code = RT_EOK; + ptr = (rt_uint8_t*)buffer; + uart = (struct avr32_serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + /* interrupt mode Tx, does not support */ + RT_ASSERT(0); + } + else + { + /* polling mode */ + if (dev->flag & RT_DEVICE_FLAG_STREAM) + { + /* stream mode */ + while (size) + { + usart_putchar(uart->uart_device, (int) *ptr); + + ++ptr; --size; + } + } + else + { + /* write data directly */ + while (size) + { + usart_bw_write_char(uart->uart_device, (int) *ptr); + + ++ptr; --size; + } + } + } + + /* set error code */ + rt_set_errno(err_code); + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - struct avr32_serial_device* uart; + struct avr32_serial_device* uart; - RT_ASSERT(dev != RT_NULL); + RT_ASSERT(dev != RT_NULL); - uart = (struct avr32_serial_device*)dev->user_data; - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; + uart = (struct avr32_serial_device*)dev->user_data; + switch (cmd) + { + case RT_DEVICE_CTRL_SUSPEND: + /* suspend device */ + dev->flag |= RT_DEVICE_FLAG_SUSPENDED; + break; - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } + case RT_DEVICE_CTRL_RESUME: + /* resume device */ + dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; + break; + } - return RT_EOK; + return RT_EOK; } /* @@ -201,77 +201,77 @@ static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) */ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct avr32_serial_device *serial) { - RT_ASSERT(device != RT_NULL); - - if ((flag & RT_DEVICE_FLAG_DMA_RX) || - (flag & RT_DEVICE_FLAG_INT_TX)) - { - RT_ASSERT(0); - } - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); + RT_ASSERT(device != RT_NULL); + + if ((flag & RT_DEVICE_FLAG_DMA_RX) || + (flag & RT_DEVICE_FLAG_INT_TX)) + { + RT_ASSERT(0); + } + + device->type = RT_Device_Class_Char; + device->rx_indicate = RT_NULL; + device->tx_complete = RT_NULL; + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + device->user_data = serial; + + /* register a character device */ + return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); } /* ISR for serial interrupt */ void rt_hw_serial_isr(void) { - struct avr32_serial_device* uart = (struct avr32_serial_device*) _rt_usart_device.user_data; - rt_base_t level; - - if (usart_test_hit(uart->uart_device)) - { - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - /* save character */ - uart->int_rx->rx_buffer[uart->int_rx->save_index] = uart->uart_device->rhr & 0xff; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - /* invoke callback */ - if (_rt_usart_device.rx_indicate != RT_NULL) - { - rt_size_t rx_length; - - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; - - _rt_usart_device.rx_indicate(&_rt_usart_device, rx_length); - } - } - else - { - usart_reset_status(uart->uart_device); - } + struct avr32_serial_device* uart = (struct avr32_serial_device*) _rt_usart_device.user_data; + rt_base_t level; + + if (usart_test_hit(uart->uart_device)) + { + /* interrupt mode receive */ + RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + /* save character */ + uart->int_rx->rx_buffer[uart->int_rx->save_index] = uart->uart_device->rhr & 0xff; + uart->int_rx->save_index ++; + if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->save_index = 0; + + /* if the next position is read index, discard this 'read char' */ + if (uart->int_rx->save_index == uart->int_rx->read_index) + { + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + /* invoke callback */ + if (_rt_usart_device.rx_indicate != RT_NULL) + { + rt_size_t rx_length; + + /* get rx length */ + rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? + UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : + uart->int_rx->save_index - uart->int_rx->read_index; + + _rt_usart_device.rx_indicate(&_rt_usart_device, rx_length); + } + } + else + { + usart_reset_status(uart->uart_device); + } } /*@}*/ diff --git a/libcpu/avr32/uc3/serial.h b/libcpu/avr32/uc3/serial.h index a17338701..fef65a12b 100644 --- a/libcpu/avr32/uc3/serial.h +++ b/libcpu/avr32/uc3/serial.h @@ -21,29 +21,29 @@ #include "compiler.h" #include "usart.h" -#define UART_RX_BUFFER_SIZE 64 -#define UART_TX_DMA_NODE_SIZE 4 +#define UART_RX_BUFFER_SIZE 64 +#define UART_TX_DMA_NODE_SIZE 4 /* data node for Tx Mode */ struct avr32_serial_data_node { - rt_uint8_t *data_ptr; - rt_size_t data_size; - struct avr32_serial_data_node *next, *prev; + rt_uint8_t *data_ptr; + rt_size_t data_size; + struct avr32_serial_data_node *next, *prev; }; struct avr32_serial_int_rx { - rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; - rt_uint32_t read_index, save_index; + rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; + rt_uint32_t read_index, save_index; }; struct avr32_serial_device { - avr32_usart_t *uart_device; + avr32_usart_t *uart_device; - /* rx structure */ - struct avr32_serial_int_rx* int_rx; + /* rx structure */ + struct avr32_serial_int_rx* int_rx; }; rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct avr32_serial_device *serial); diff --git a/libcpu/avr32/uc3/stack.c b/libcpu/avr32/uc3/stack.c index dd43b5edb..dee1161c1 100644 --- a/libcpu/avr32/uc3/stack.c +++ b/libcpu/avr32/uc3/stack.c @@ -30,28 +30,28 @@ */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) { - unsigned long *stk; + unsigned long *stk; - stk = (unsigned long *)stack_addr; - *(stk) = 0; /* r8 */ - *(--stk) = 0; /* r9 */ - *(--stk) = 0; /* r10 */ - *(--stk) = 0; /* r11 */ - *(--stk) = 0; /* r12 */ - *(--stk) = (unsigned long)texit; /* lr */ - *(--stk) = (unsigned long)tentry; /* entry point, pc */ - *(--stk) = 0x00600000; /* sr */ - *(--stk) = 0; /* r0 */ - *(--stk) = 0; /* r1 */ - *(--stk) = 0; /* r2 */ - *(--stk) = 0; /* r3 */ - *(--stk) = 0; /* r4 */ - *(--stk) = 0; /* r5 */ - *(--stk) = 0; /* r6 */ - *(--stk) = 0; /* r7 */ + stk = (unsigned long *)stack_addr; + *(stk) = 0; /* r8 */ + *(--stk) = 0; /* r9 */ + *(--stk) = 0; /* r10 */ + *(--stk) = 0; /* r11 */ + *(--stk) = 0; /* r12 */ + *(--stk) = (unsigned long)texit; /* lr */ + *(--stk) = (unsigned long)tentry; /* entry point, pc */ + *(--stk) = 0x00600000; /* sr */ + *(--stk) = 0; /* r0 */ + *(--stk) = 0; /* r1 */ + *(--stk) = 0; /* r2 */ + *(--stk) = 0; /* r3 */ + *(--stk) = 0; /* r4 */ + *(--stk) = 0; /* r5 */ + *(--stk) = 0; /* r6 */ + *(--stk) = 0; /* r7 */ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /*@}*/ diff --git a/libcpu/blackfin/bf53x/cpuport.c b/libcpu/blackfin/bf53x/cpuport.c index 91cfaeb40..2d69ccc99 100644 --- a/libcpu/blackfin/bf53x/cpuport.c +++ b/libcpu/blackfin/bf53x/cpuport.c @@ -8,8 +8,8 @@ * http://www.rt-thread.org/license/LICENSE * * Change Logs: - * Date Author Notes - * 2012-02-13 mojingxian first version + * Date Author Notes + * 2012-02-13 mojingxian first version */ #include @@ -23,10 +23,10 @@ rt_uint32_t rt_thread_switch_interrupt_flag; * initializes stack of thread */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { unsigned char i; - unsigned long *stk; + unsigned long *stk; stk = (unsigned long *)stack_addr; /* Load stack pointer */ diff --git a/libcpu/blackfin/bf53x/serial.c b/libcpu/blackfin/bf53x/serial.c index b8a4c5257..4a6484a64 100644 --- a/libcpu/blackfin/bf53x/serial.c +++ b/libcpu/blackfin/bf53x/serial.c @@ -29,206 +29,206 @@ */ static rt_err_t rt_serial_init (rt_device_t dev) { - struct serial_device* uart = (struct serial_device*) dev->user_data; - - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, - sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = uart->int_rx->save_index = 0; - } - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - rt_memset(uart->int_tx->tx_buffer, 0, - sizeof(uart->int_tx->tx_buffer)); - uart->int_tx->write_index = uart->int_tx->save_index = 0; - } - - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } - - return RT_EOK; + struct serial_device* uart = (struct serial_device*) dev->user_data; + + if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) + { + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_memset(uart->int_rx->rx_buffer, 0, + sizeof(uart->int_rx->rx_buffer)); + uart->int_rx->read_index = uart->int_rx->save_index = 0; + } + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + rt_memset(uart->int_tx->tx_buffer, 0, + sizeof(uart->int_tx->tx_buffer)); + uart->int_tx->write_index = uart->int_tx->save_index = 0; + } + + dev->flag |= RT_DEVICE_FLAG_ACTIVATED; + } + + return RT_EOK; } /* save a char to serial buffer */ static void rt_serial_savechar(struct serial_device* uart, char ch) { - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; + uart->int_rx->save_index ++; + if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->save_index = 0; + + /* if the next position is read index, discard this 'read char' */ + if (uart->int_rx->save_index == uart->int_rx->read_index) + { + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) -{ - RT_ASSERT(dev != RT_NULL); - - return RT_EOK; +{ + RT_ASSERT(dev != RT_NULL); + + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) -{ - RT_ASSERT(dev != RT_NULL); +{ + RT_ASSERT(dev != RT_NULL); - return RT_EOK; + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_base_t level; - - /* interrupt mode Rx */ - while (size) - { - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size --; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - break; - } - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - //while (uart->uart_device->ustat & USTAT_RCV_READY) - { - *ptr = uart->uart_device->rbr_thr & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + ptr = buffer; + err_code = RT_EOK; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_base_t level; + + /* interrupt mode Rx */ + while (size) + { + if (uart->int_rx->read_index != uart->int_rx->save_index) + { + *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; + size --; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + } + else + { + /* set error code */ + err_code = -RT_EEMPTY; + break; + } + } + } + else + { + /* polling mode */ + while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) + { + //while (uart->uart_device->ustat & USTAT_RCV_READY) + { + *ptr = uart->uart_device->rbr_thr & 0xff; + ptr ++; + } + } + } + + /* set error code */ + rt_set_errno(err_code); + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx */ - while (uart->int_tx->save_index != uart->int_tx->write_index) - { - /* save on tx buffer */ - uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - - -- size; - - /* move to next position */ - uart->int_tx->save_index ++; - - /* wrap save index */ - if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) - uart->int_tx->save_index = 0; - } - - /* set error code */ - if (size > 0) - err_code = -RT_EFULL; - } - else - { - /* polling mode */ - while (size) - { - /* - * to be polite with serial console add a line feed - * to the carriage return character - */ - if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) - { - while (!(uart->uart_device->lsr & 0x20)); - uart->uart_device->rbr_thr = '\r'; - } - - while (!(uart->uart_device->lsr & 0x20)); - uart->uart_device->rbr_thr = (*ptr & 0xFF); - - ++ptr; --size; - } - } - - /* set error code */ - rt_set_errno(err_code); - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + err_code = RT_EOK; + ptr = (rt_uint8_t*)buffer; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + /* interrupt mode Tx */ + while (uart->int_tx->save_index != uart->int_tx->write_index) + { + /* save on tx buffer */ + uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; + + -- size; + + /* move to next position */ + uart->int_tx->save_index ++; + + /* wrap save index */ + if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) + uart->int_tx->save_index = 0; + } + + /* set error code */ + if (size > 0) + err_code = -RT_EFULL; + } + else + { + /* polling mode */ + while (size) + { + /* + * to be polite with serial console add a line feed + * to the carriage return character + */ + if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) + { + while (!(uart->uart_device->lsr & 0x20)); + uart->uart_device->rbr_thr = '\r'; + } + + while (!(uart->uart_device->lsr & 0x20)); + uart->uart_device->rbr_thr = (*ptr & 0xFF); + + ++ptr; --size; + } + } + + /* set error code */ + rt_set_errno(err_code); + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - RT_ASSERT(dev != RT_NULL); - - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; - - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } - - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + + switch (cmd) + { + case RT_DEVICE_CTRL_SUSPEND: + /* suspend device */ + dev->flag |= RT_DEVICE_FLAG_SUSPENDED; + break; + + case RT_DEVICE_CTRL_RESUME: + /* resume device */ + dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; + break; + } + + return RT_EOK; } /* @@ -236,49 +236,49 @@ static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) */ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial) { - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); + RT_ASSERT(device != RT_NULL); + + device->type = RT_Device_Class_Char; + device->rx_indicate = RT_NULL; + device->tx_complete = RT_NULL; + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + device->user_data = serial; + + /* register a character device */ + return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); } - + /* ISR for serial interrupt */ void rt_hw_serial_isr(rt_device_t device) { - struct serial_device* uart = (struct serial_device*) device->user_data; - - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - - /* save on rx buffer */ - //while (uart->uart_device->ustat & USTAT_RCV_READY) - { - rt_serial_savechar(uart, uart->uart_device->rbr_thr & 0xff); - } - - /* invoke callback */ - if (device->rx_indicate != RT_NULL) - { - rt_size_t rx_length; - - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; - - device->rx_indicate(device, rx_length); - } + struct serial_device* uart = (struct serial_device*) device->user_data; + + /* interrupt mode receive */ + RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); + + /* save on rx buffer */ + //while (uart->uart_device->ustat & USTAT_RCV_READY) + { + rt_serial_savechar(uart, uart->uart_device->rbr_thr & 0xff); + } + + /* invoke callback */ + if (device->rx_indicate != RT_NULL) + { + rt_size_t rx_length; + + /* get rx length */ + rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? + UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : + uart->int_rx->save_index - uart->int_rx->read_index; + + device->rx_indicate(device, rx_length); + } } /*@}*/ diff --git a/libcpu/c-sky/ck802/contex_ck802_gcc.S b/libcpu/c-sky/ck802/contex_ck802_gcc.S index 44f2c331d..a4431b0f7 100644 --- a/libcpu/c-sky/ck802/contex_ck802_gcc.S +++ b/libcpu/c-sky/ck802/contex_ck802_gcc.S @@ -1,21 +1,7 @@ /* - * File : contex_ck802.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/c-sky/ck802/core_ck802.c b/libcpu/c-sky/ck802/core_ck802.c index 047c41726..d8cfce09f 100644 --- a/libcpu/c-sky/ck802/core_ck802.c +++ b/libcpu/c-sky/ck802/core_ck802.c @@ -1,21 +1,7 @@ /* - * File : core_ck802.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/c-sky/ck802/core_ck802.h b/libcpu/c-sky/ck802/core_ck802.h index 6c335f817..badae8c0f 100644 --- a/libcpu/c-sky/ck802/core_ck802.h +++ b/libcpu/c-sky/ck802/core_ck802.h @@ -1,21 +1,7 @@ /* - * File : core_ck802.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/c-sky/ck802/stack_ck802.c b/libcpu/c-sky/ck802/stack_ck802.c index 01fed9ad3..087722072 100644 --- a/libcpu/c-sky/ck802/stack_ck802.c +++ b/libcpu/c-sky/ck802/stack_ck802.c @@ -1,21 +1,7 @@ /* - * File : stack_ck802.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/ia32/__udivsi3.c b/libcpu/ia32/__udivsi3.c index ec7c59d1c..506dc2ddd 100644 --- a/libcpu/ia32/__udivsi3.c +++ b/libcpu/ia32/__udivsi3.c @@ -16,31 +16,31 @@ uint32_t __udivsi3(uint32_t num, uint32_t den) { - uint32_t quot = 0, qbit = 1; + uint32_t quot = 0, qbit = 1; - if (den == 0) - { - asm volatile ("int $0"); - return 0; /* If trap returns... */ - } + if (den == 0) + { + asm volatile ("int $0"); + return 0; /* If trap returns... */ + } - /* Left-justify denominator and count shift */ - while ((int32_t) den >= 0) - { - den <<= 1; - qbit <<= 1; - } + /* Left-justify denominator and count shift */ + while ((int32_t) den >= 0) + { + den <<= 1; + qbit <<= 1; + } - while (qbit) - { - if (den <= num) - { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } + while (qbit) + { + if (den <= num) + { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } - return quot; + return quot; } diff --git a/libcpu/ia32/__umodsi3.c b/libcpu/ia32/__umodsi3.c index 226a2c080..101db9deb 100644 --- a/libcpu/ia32/__umodsi3.c +++ b/libcpu/ia32/__umodsi3.c @@ -16,31 +16,31 @@ uint32_t __umodsi3(uint32_t num, uint32_t den) { - register uint32_t quot = 0, qbit = 1; + register uint32_t quot = 0, qbit = 1; - if (den == 0) - { - asm volatile ("int $0"); - return 0; /* if trap returns... */ - } + if (den == 0) + { + asm volatile ("int $0"); + return 0; /* if trap returns... */ + } - /* left-justify denominator and count shift */ - while ((int32_t) den >= 0) - { - den <<= 1; - qbit <<= 1; - } + /* left-justify denominator and count shift */ + while ((int32_t) den >= 0) + { + den <<= 1; + qbit <<= 1; + } - while (qbit) - { - if (den <= num) - { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } + while (qbit) + { + if (den <= num) + { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } - return num; + return num; } diff --git a/libcpu/ia32/backtrace.c b/libcpu/ia32/backtrace.c index b8f094d90..ee90ae71c 100644 --- a/libcpu/ia32/backtrace.c +++ b/libcpu/ia32/backtrace.c @@ -16,5 +16,5 @@ void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry) { - /* no implementation */ + /* no implementation */ } diff --git a/libcpu/ia32/interrupt.c b/libcpu/ia32/interrupt.c index e620cbe76..f14a9a3ca 100644 --- a/libcpu/ia32/interrupt.c +++ b/libcpu/ia32/interrupt.c @@ -1,27 +1,13 @@ /* - * File : interrupt.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2015, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2015/9/15 Bernard Update to new interrupt framework. */ - + #include #include @@ -50,45 +36,45 @@ void rt_hw_interrupt_handle(int vector, void* param); */ void rt_hw_pic_init() { - outb(IO_PIC1, 0x11); - outb(IO_PIC1+1, IRQ_OFFSET); - outb(IO_PIC1+1, 1<> 8)); - } - - /* init interrupt nest, and context */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + outb(IO_PIC1, 0x11); + outb(IO_PIC1+1, IRQ_OFFSET); + outb(IO_PIC1+1, 1<> 8)); + } + + /* init interrupt nest, and context */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } void rt_hw_interrupt_handle(int vector, void* param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } void rt_hw_isr(int vector) { - if (vector < MAX_HANDLERS) - { - irq_desc[vector].handler(vector, irq_desc[vector].param); - } + if (vector < MAX_HANDLERS) + { + irq_desc[vector].handler(vector, irq_desc[vector].param); + } } /** @@ -97,10 +83,10 @@ void rt_hw_isr(int vector) */ void rt_hw_interrupt_init(void) { - int idx; - - rt_hw_idt_init(); - rt_hw_pic_init(); + int idx; + + rt_hw_idt_init(); + rt_hw_pic_init(); /* init exceptions table */ for(idx=0; idx < MAX_HANDLERS; idx++) @@ -116,16 +102,16 @@ void rt_hw_interrupt_init(void) void rt_hw_interrupt_umask(int vector) { - irq_mask_8259A = irq_mask_8259A&~(1<> 8)); + irq_mask_8259A = irq_mask_8259A&~(1<> 8)); } void rt_hw_interrupt_mask(int vector) { - irq_mask_8259A = irq_mask_8259A | (1<> 8)); + irq_mask_8259A = irq_mask_8259A | (1<> 8)); } rt_isr_handler_t rt_hw_interrupt_install(int vector, @@ -154,15 +140,15 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_base_t rt_hw_interrupt_disable(void) { - rt_base_t level; + rt_base_t level; - __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (level): :"memory"); - return level; + __asm__ __volatile__("pushfl ; popl %0 ; cli":"=g" (level): :"memory"); + return level; } void rt_hw_interrupt_enable(rt_base_t level) { - __asm__ __volatile__("pushl %0 ; popfl": :"g" (level):"memory", "cc"); + __asm__ __volatile__("pushl %0 ; popfl": :"g" (level):"memory", "cc"); } /*@}*/ diff --git a/libcpu/ia32/showmem.c b/libcpu/ia32/showmem.c index 38f037f83..5374a3ad4 100644 --- a/libcpu/ia32/showmem.c +++ b/libcpu/ia32/showmem.c @@ -16,27 +16,27 @@ void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size) { - int i = 0, j =0; + int i = 0, j =0; - RT_ASSERT(addr); + RT_ASSERT(addr); - addr = addr & ~0xF; - size = 4*((size + 3)/4); + addr = addr & ~0xF; + size = 4*((size + 3)/4); - while(i < size) - { - rt_kprintf("0x%08x: ", addr ); + while(i < size) + { + rt_kprintf("0x%08x: ", addr ); - for(j=0; j<4; j++) - { - rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); + for(j=0; j<4; j++) + { + rt_kprintf("0x%08x ", *(rt_uint32_t *)addr); - addr += 4; - i++; - } + addr += 4; + i++; + } - rt_kprintf("\n"); - } + rt_kprintf("\n"); + } - return; + return; } diff --git a/libcpu/ia32/stack.c b/libcpu/ia32/stack.c index 9d656a73d..a533b9407 100644 --- a/libcpu/ia32/stack.c +++ b/libcpu/ia32/stack.c @@ -10,7 +10,7 @@ * Change Logs: * Date Author Notes */ - + #include #include @@ -24,36 +24,36 @@ * This function will initialize thread stack * * @param tentry the entry of thread - * @param parameter the parameter of entry + * @param parameter the parameter of entry * @param stack_addr the beginning stack address * @param texit the function will be called when thread exit * * @return stack address */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { - unsigned long *stk; + unsigned long *stk; - stk = (unsigned long *)stack_addr; - *(--stk) = (unsigned long)parameter; - *(--stk) = (unsigned long)texit; - *(--stk) = 0x200; /*flags*/ - *(--stk) = 0x08; /*cs*/ - *(--stk) = (unsigned long)tentry; /*eip*/ - *(--stk) = 0; /*irqno*/ - *(--stk) = 0x10; /*ds*/ - *(--stk) = 0x10; /*es*/ - *(--stk) = 0; /*eax*/ - *(--stk) = 0; /*ecx*/ - *(--stk) = 0; /*edx*/ - *(--stk) = 0; /*ebx*/ - *(--stk) = 0; /*esp*/ - *(--stk) = 0; /*ebp*/ - *(--stk) = 0; /*esi*/ - *(--stk) = 0; /*edi*/ + stk = (unsigned long *)stack_addr; + *(--stk) = (unsigned long)parameter; + *(--stk) = (unsigned long)texit; + *(--stk) = 0x200; /*flags*/ + *(--stk) = 0x08; /*cs*/ + *(--stk) = (unsigned long)tentry; /*eip*/ + *(--stk) = 0; /*irqno*/ + *(--stk) = 0x10; /*ds*/ + *(--stk) = 0x10; /*es*/ + *(--stk) = 0; /*eax*/ + *(--stk) = 0; /*ecx*/ + *(--stk) = 0; /*edx*/ + *(--stk) = 0; /*ebx*/ + *(--stk) = 0; /*esp*/ + *(--stk) = 0; /*ebp*/ + *(--stk) = 0; /*esi*/ + *(--stk) = 0; /*edi*/ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /*@}*/ diff --git a/libcpu/ia32/trap.c b/libcpu/ia32/trap.c index 5e9a51d6d..b3484cfd5 100644 --- a/libcpu/ia32/trap.c +++ b/libcpu/ia32/trap.c @@ -22,7 +22,7 @@ struct Gatedesc idt[256] = { {0}, }; struct Pseudodesc idt_pd = { - 0, sizeof(idt) - 1, (unsigned long) idt, + 0, sizeof(idt) - 1, (unsigned long) idt, }; /* exception and interrupt handler table */ @@ -40,36 +40,36 @@ extern rt_isr_handler_t hdinterrupt_func[]; * */ void rt_hw_idt_init(void) -{ - extern void Xdefault; - int i, j, func; +{ + extern void Xdefault; + int i, j, func; + + // install a default handler + for (i = 0; i < sizeof(idt)/sizeof(idt[0]); i++) + SETGATE(idt[i], 0, GD_KT, &Xdefault, 0); + + /*install trap handler*/ + for(i = 0; i < 16; i++) + { + func = (int)trap_func[i]; + SETGATE(idt[i], 0, GD_KT, func, 0); + } - // install a default handler - for (i = 0; i < sizeof(idt)/sizeof(idt[0]); i++) - SETGATE(idt[i], 0, GD_KT, &Xdefault, 0); + func = (int)trap_func[3]; + SETGATE(idt[3], 0, GD_KT, func, 3); - /*install trap handler*/ - for(i = 0; i < 16; i++) - { - func = (int)trap_func[i]; - SETGATE(idt[i], 0, GD_KT, func, 0); - } + i = 0; - func = (int)trap_func[3]; - SETGATE(idt[3], 0, GD_KT, func, 3); + /*install exteral interrupt handler*/ + for(j = IRQ_OFFSET; j < IRQ_OFFSET + MAX_HANDLERS; j++) + { + func = (int)hdinterrupt_func[i]; + SETGATE(idt[j], 0, GD_KT, func, 0); + i++; + } - i = 0; - - /*install exteral interrupt handler*/ - for(j = IRQ_OFFSET; j < IRQ_OFFSET + MAX_HANDLERS; j++) - { - func = (int)hdinterrupt_func[i]; - SETGATE(idt[j], 0, GD_KT, func, 0); - i++; - } - - // Load the IDT - asm volatile("lidt idt_pd + 2"); + // Load the IDT + asm volatile("lidt idt_pd + 2"); } /** @@ -80,24 +80,24 @@ void rt_hw_idt_init(void) */ void rt_hw_trap_irq(int trapno) { - switch(trapno) - { - case T_DIVIDE: - rt_kprintf("Divide error interrupt\n"); - RT_ASSERT(0); - case T_PGFLT: - rt_kprintf("Page fault interrupt\n"); - RT_ASSERT(0); - case T_GPFLT: - rt_kprintf("General protection interrupt\n"); - RT_ASSERT(0); - case T_DEFAULT: - rt_hw_interrupt_handle(T_DEFAULT); - return; - } + switch(trapno) + { + case T_DIVIDE: + rt_kprintf("Divide error interrupt\n"); + RT_ASSERT(0); + case T_PGFLT: + rt_kprintf("Page fault interrupt\n"); + RT_ASSERT(0); + case T_GPFLT: + rt_kprintf("General protection interrupt\n"); + RT_ASSERT(0); + case T_DEFAULT: + rt_hw_interrupt_handle(T_DEFAULT); + return; + } - /*kernel bug if run here*/ - RT_ASSERT(0); + /*kernel bug if run here*/ + RT_ASSERT(0); } /*@}*/ diff --git a/libcpu/m16c/m16c62p/cpuport.c b/libcpu/m16c/m16c62p/cpuport.c index c66f73b72..8f9a50d89 100644 --- a/libcpu/m16c/m16c62p/cpuport.c +++ b/libcpu/m16c/m16c62p/cpuport.c @@ -113,4 +113,4 @@ void rt_hw_interrupt_enable(rt_base_t level) temp = level & 0xffff; asm("LDC %0, FLG": :"r" (temp)); } -#endif \ No newline at end of file +#endif diff --git a/libcpu/mips/common/exception.h b/libcpu/mips/common/exception.h index 2cb03d20e..77fdb4a65 100644 --- a/libcpu/mips/common/exception.h +++ b/libcpu/mips/common/exception.h @@ -18,9 +18,9 @@ /* * important register numbers */ -#define REG_EPC 37 -#define REG_FP 72 -#define REG_SP 29 +#define REG_EPC 37 +#define REG_FP 72 +#define REG_SP 29 /* * Stack layout for the GDB exception handler @@ -28,117 +28,117 @@ * * The first PTRSIZE*6 bytes are argument save space for C subroutines. */ -#define NUMREGS 90 +#define NUMREGS 90 -#define GDB_FR_REG0 (PTRSIZE*6) /* 0 */ -#define GDB_FR_REG1 ((GDB_FR_REG0) + LONGSIZE) /* 1 */ -#define GDB_FR_REG2 ((GDB_FR_REG1) + LONGSIZE) /* 2 */ -#define GDB_FR_REG3 ((GDB_FR_REG2) + LONGSIZE) /* 3 */ -#define GDB_FR_REG4 ((GDB_FR_REG3) + LONGSIZE) /* 4 */ -#define GDB_FR_REG5 ((GDB_FR_REG4) + LONGSIZE) /* 5 */ -#define GDB_FR_REG6 ((GDB_FR_REG5) + LONGSIZE) /* 6 */ -#define GDB_FR_REG7 ((GDB_FR_REG6) + LONGSIZE) /* 7 */ -#define GDB_FR_REG8 ((GDB_FR_REG7) + LONGSIZE) /* 8 */ -#define GDB_FR_REG9 ((GDB_FR_REG8) + LONGSIZE) /* 9 */ -#define GDB_FR_REG10 ((GDB_FR_REG9) + LONGSIZE) /* 10 */ -#define GDB_FR_REG11 ((GDB_FR_REG10) + LONGSIZE) /* 11 */ -#define GDB_FR_REG12 ((GDB_FR_REG11) + LONGSIZE) /* 12 */ -#define GDB_FR_REG13 ((GDB_FR_REG12) + LONGSIZE) /* 13 */ -#define GDB_FR_REG14 ((GDB_FR_REG13) + LONGSIZE) /* 14 */ -#define GDB_FR_REG15 ((GDB_FR_REG14) + LONGSIZE) /* 15 */ -#define GDB_FR_REG16 ((GDB_FR_REG15) + LONGSIZE) /* 16 */ -#define GDB_FR_REG17 ((GDB_FR_REG16) + LONGSIZE) /* 17 */ -#define GDB_FR_REG18 ((GDB_FR_REG17) + LONGSIZE) /* 18 */ -#define GDB_FR_REG19 ((GDB_FR_REG18) + LONGSIZE) /* 19 */ -#define GDB_FR_REG20 ((GDB_FR_REG19) + LONGSIZE) /* 20 */ -#define GDB_FR_REG21 ((GDB_FR_REG20) + LONGSIZE) /* 21 */ -#define GDB_FR_REG22 ((GDB_FR_REG21) + LONGSIZE) /* 22 */ -#define GDB_FR_REG23 ((GDB_FR_REG22) + LONGSIZE) /* 23 */ -#define GDB_FR_REG24 ((GDB_FR_REG23) + LONGSIZE) /* 24 */ -#define GDB_FR_REG25 ((GDB_FR_REG24) + LONGSIZE) /* 25 */ -#define GDB_FR_REG26 ((GDB_FR_REG25) + LONGSIZE) /* 26 */ -#define GDB_FR_REG27 ((GDB_FR_REG26) + LONGSIZE) /* 27 */ -#define GDB_FR_REG28 ((GDB_FR_REG27) + LONGSIZE) /* 28 */ -#define GDB_FR_REG29 ((GDB_FR_REG28) + LONGSIZE) /* 29 */ -#define GDB_FR_REG30 ((GDB_FR_REG29) + LONGSIZE) /* 30 */ -#define GDB_FR_REG31 ((GDB_FR_REG30) + LONGSIZE) /* 31 */ +#define GDB_FR_REG0 (PTRSIZE*6) /* 0 */ +#define GDB_FR_REG1 ((GDB_FR_REG0) + LONGSIZE) /* 1 */ +#define GDB_FR_REG2 ((GDB_FR_REG1) + LONGSIZE) /* 2 */ +#define GDB_FR_REG3 ((GDB_FR_REG2) + LONGSIZE) /* 3 */ +#define GDB_FR_REG4 ((GDB_FR_REG3) + LONGSIZE) /* 4 */ +#define GDB_FR_REG5 ((GDB_FR_REG4) + LONGSIZE) /* 5 */ +#define GDB_FR_REG6 ((GDB_FR_REG5) + LONGSIZE) /* 6 */ +#define GDB_FR_REG7 ((GDB_FR_REG6) + LONGSIZE) /* 7 */ +#define GDB_FR_REG8 ((GDB_FR_REG7) + LONGSIZE) /* 8 */ +#define GDB_FR_REG9 ((GDB_FR_REG8) + LONGSIZE) /* 9 */ +#define GDB_FR_REG10 ((GDB_FR_REG9) + LONGSIZE) /* 10 */ +#define GDB_FR_REG11 ((GDB_FR_REG10) + LONGSIZE) /* 11 */ +#define GDB_FR_REG12 ((GDB_FR_REG11) + LONGSIZE) /* 12 */ +#define GDB_FR_REG13 ((GDB_FR_REG12) + LONGSIZE) /* 13 */ +#define GDB_FR_REG14 ((GDB_FR_REG13) + LONGSIZE) /* 14 */ +#define GDB_FR_REG15 ((GDB_FR_REG14) + LONGSIZE) /* 15 */ +#define GDB_FR_REG16 ((GDB_FR_REG15) + LONGSIZE) /* 16 */ +#define GDB_FR_REG17 ((GDB_FR_REG16) + LONGSIZE) /* 17 */ +#define GDB_FR_REG18 ((GDB_FR_REG17) + LONGSIZE) /* 18 */ +#define GDB_FR_REG19 ((GDB_FR_REG18) + LONGSIZE) /* 19 */ +#define GDB_FR_REG20 ((GDB_FR_REG19) + LONGSIZE) /* 20 */ +#define GDB_FR_REG21 ((GDB_FR_REG20) + LONGSIZE) /* 21 */ +#define GDB_FR_REG22 ((GDB_FR_REG21) + LONGSIZE) /* 22 */ +#define GDB_FR_REG23 ((GDB_FR_REG22) + LONGSIZE) /* 23 */ +#define GDB_FR_REG24 ((GDB_FR_REG23) + LONGSIZE) /* 24 */ +#define GDB_FR_REG25 ((GDB_FR_REG24) + LONGSIZE) /* 25 */ +#define GDB_FR_REG26 ((GDB_FR_REG25) + LONGSIZE) /* 26 */ +#define GDB_FR_REG27 ((GDB_FR_REG26) + LONGSIZE) /* 27 */ +#define GDB_FR_REG28 ((GDB_FR_REG27) + LONGSIZE) /* 28 */ +#define GDB_FR_REG29 ((GDB_FR_REG28) + LONGSIZE) /* 29 */ +#define GDB_FR_REG30 ((GDB_FR_REG29) + LONGSIZE) /* 30 */ +#define GDB_FR_REG31 ((GDB_FR_REG30) + LONGSIZE) /* 31 */ /* * Saved special registers */ -#define GDB_FR_STATUS ((GDB_FR_REG31) + LONGSIZE) /* 32 */ -#define GDB_FR_LO ((GDB_FR_STATUS) + LONGSIZE) /* 33 */ -#define GDB_FR_HI ((GDB_FR_LO) + LONGSIZE) /* 34 */ -#define GDB_FR_BADVADDR ((GDB_FR_HI) + LONGSIZE) /* 35 */ -#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + LONGSIZE) /* 36 */ -#define GDB_FR_EPC ((GDB_FR_CAUSE) + LONGSIZE) /* 37 */ +#define GDB_FR_STATUS ((GDB_FR_REG31) + LONGSIZE) /* 32 */ +#define GDB_FR_LO ((GDB_FR_STATUS) + LONGSIZE) /* 33 */ +#define GDB_FR_HI ((GDB_FR_LO) + LONGSIZE) /* 34 */ +#define GDB_FR_BADVADDR ((GDB_FR_HI) + LONGSIZE) /* 35 */ +#define GDB_FR_CAUSE ((GDB_FR_BADVADDR) + LONGSIZE) /* 36 */ +#define GDB_FR_EPC ((GDB_FR_CAUSE) + LONGSIZE) /* 37 */ ///* // * Saved floating point registers // */ -//#define GDB_FR_FPR0 ((GDB_FR_EPC) + LONGSIZE) /* 38 */ -//#define GDB_FR_FPR1 ((GDB_FR_FPR0) + LONGSIZE) /* 39 */ -//#define GDB_FR_FPR2 ((GDB_FR_FPR1) + LONGSIZE) /* 40 */ -//#define GDB_FR_FPR3 ((GDB_FR_FPR2) + LONGSIZE) /* 41 */ -//#define GDB_FR_FPR4 ((GDB_FR_FPR3) + LONGSIZE) /* 42 */ -//#define GDB_FR_FPR5 ((GDB_FR_FPR4) + LONGSIZE) /* 43 */ -//#define GDB_FR_FPR6 ((GDB_FR_FPR5) + LONGSIZE) /* 44 */ -//#define GDB_FR_FPR7 ((GDB_FR_FPR6) + LONGSIZE) /* 45 */ -//#define GDB_FR_FPR8 ((GDB_FR_FPR7) + LONGSIZE) /* 46 */ -//#define GDB_FR_FPR9 ((GDB_FR_FPR8) + LONGSIZE) /* 47 */ -//#define GDB_FR_FPR10 ((GDB_FR_FPR9) + LONGSIZE) /* 48 */ -//#define GDB_FR_FPR11 ((GDB_FR_FPR10) + LONGSIZE) /* 49 */ -//#define GDB_FR_FPR12 ((GDB_FR_FPR11) + LONGSIZE) /* 50 */ -//#define GDB_FR_FPR13 ((GDB_FR_FPR12) + LONGSIZE) /* 51 */ -//#define GDB_FR_FPR14 ((GDB_FR_FPR13) + LONGSIZE) /* 52 */ -//#define GDB_FR_FPR15 ((GDB_FR_FPR14) + LONGSIZE) /* 53 */ -//#define GDB_FR_FPR16 ((GDB_FR_FPR15) + LONGSIZE) /* 54 */ -//#define GDB_FR_FPR17 ((GDB_FR_FPR16) + LONGSIZE) /* 55 */ -//#define GDB_FR_FPR18 ((GDB_FR_FPR17) + LONGSIZE) /* 56 */ -//#define GDB_FR_FPR19 ((GDB_FR_FPR18) + LONGSIZE) /* 57 */ -//#define GDB_FR_FPR20 ((GDB_FR_FPR19) + LONGSIZE) /* 58 */ -//#define GDB_FR_FPR21 ((GDB_FR_FPR20) + LONGSIZE) /* 59 */ -//#define GDB_FR_FPR22 ((GDB_FR_FPR21) + LONGSIZE) /* 60 */ -//#define GDB_FR_FPR23 ((GDB_FR_FPR22) + LONGSIZE) /* 61 */ -//#define GDB_FR_FPR24 ((GDB_FR_FPR23) + LONGSIZE) /* 62 */ -//#define GDB_FR_FPR25 ((GDB_FR_FPR24) + LONGSIZE) /* 63 */ -//#define GDB_FR_FPR26 ((GDB_FR_FPR25) + LONGSIZE) /* 64 */ -//#define GDB_FR_FPR27 ((GDB_FR_FPR26) + LONGSIZE) /* 65 */ -//#define GDB_FR_FPR28 ((GDB_FR_FPR27) + LONGSIZE) /* 66 */ -//#define GDB_FR_FPR29 ((GDB_FR_FPR28) + LONGSIZE) /* 67 */ -//#define GDB_FR_FPR30 ((GDB_FR_FPR29) + LONGSIZE) /* 68 */ -//#define GDB_FR_FPR31 ((GDB_FR_FPR30) + LONGSIZE) /* 69 */ +//#define GDB_FR_FPR0 ((GDB_FR_EPC) + LONGSIZE) /* 38 */ +//#define GDB_FR_FPR1 ((GDB_FR_FPR0) + LONGSIZE) /* 39 */ +//#define GDB_FR_FPR2 ((GDB_FR_FPR1) + LONGSIZE) /* 40 */ +//#define GDB_FR_FPR3 ((GDB_FR_FPR2) + LONGSIZE) /* 41 */ +//#define GDB_FR_FPR4 ((GDB_FR_FPR3) + LONGSIZE) /* 42 */ +//#define GDB_FR_FPR5 ((GDB_FR_FPR4) + LONGSIZE) /* 43 */ +//#define GDB_FR_FPR6 ((GDB_FR_FPR5) + LONGSIZE) /* 44 */ +//#define GDB_FR_FPR7 ((GDB_FR_FPR6) + LONGSIZE) /* 45 */ +//#define GDB_FR_FPR8 ((GDB_FR_FPR7) + LONGSIZE) /* 46 */ +//#define GDB_FR_FPR9 ((GDB_FR_FPR8) + LONGSIZE) /* 47 */ +//#define GDB_FR_FPR10 ((GDB_FR_FPR9) + LONGSIZE) /* 48 */ +//#define GDB_FR_FPR11 ((GDB_FR_FPR10) + LONGSIZE) /* 49 */ +//#define GDB_FR_FPR12 ((GDB_FR_FPR11) + LONGSIZE) /* 50 */ +//#define GDB_FR_FPR13 ((GDB_FR_FPR12) + LONGSIZE) /* 51 */ +//#define GDB_FR_FPR14 ((GDB_FR_FPR13) + LONGSIZE) /* 52 */ +//#define GDB_FR_FPR15 ((GDB_FR_FPR14) + LONGSIZE) /* 53 */ +//#define GDB_FR_FPR16 ((GDB_FR_FPR15) + LONGSIZE) /* 54 */ +//#define GDB_FR_FPR17 ((GDB_FR_FPR16) + LONGSIZE) /* 55 */ +//#define GDB_FR_FPR18 ((GDB_FR_FPR17) + LONGSIZE) /* 56 */ +//#define GDB_FR_FPR19 ((GDB_FR_FPR18) + LONGSIZE) /* 57 */ +//#define GDB_FR_FPR20 ((GDB_FR_FPR19) + LONGSIZE) /* 58 */ +//#define GDB_FR_FPR21 ((GDB_FR_FPR20) + LONGSIZE) /* 59 */ +//#define GDB_FR_FPR22 ((GDB_FR_FPR21) + LONGSIZE) /* 60 */ +//#define GDB_FR_FPR23 ((GDB_FR_FPR22) + LONGSIZE) /* 61 */ +//#define GDB_FR_FPR24 ((GDB_FR_FPR23) + LONGSIZE) /* 62 */ +//#define GDB_FR_FPR25 ((GDB_FR_FPR24) + LONGSIZE) /* 63 */ +//#define GDB_FR_FPR26 ((GDB_FR_FPR25) + LONGSIZE) /* 64 */ +//#define GDB_FR_FPR27 ((GDB_FR_FPR26) + LONGSIZE) /* 65 */ +//#define GDB_FR_FPR28 ((GDB_FR_FPR27) + LONGSIZE) /* 66 */ +//#define GDB_FR_FPR29 ((GDB_FR_FPR28) + LONGSIZE) /* 67 */ +//#define GDB_FR_FPR30 ((GDB_FR_FPR29) + LONGSIZE) /* 68 */ +//#define GDB_FR_FPR31 ((GDB_FR_FPR30) + LONGSIZE) /* 69 */ // -//#define GDB_FR_FSR ((GDB_FR_FPR31) + LONGSIZE) /* 70 */ -//#define GDB_FR_FIR ((GDB_FR_FSR) + LONGSIZE) /* 71 */ -//#define GDB_FR_FRP ((GDB_FR_FIR) + LONGSIZE) /* 72 */ +//#define GDB_FR_FSR ((GDB_FR_FPR31) + LONGSIZE) /* 70 */ +//#define GDB_FR_FIR ((GDB_FR_FSR) + LONGSIZE) /* 71 */ +//#define GDB_FR_FRP ((GDB_FR_FIR) + LONGSIZE) /* 72 */ // -//#define GDB_FR_DUMMY ((GDB_FR_FRP) + LONGSIZE) /* 73, unused ??? */ +//#define GDB_FR_DUMMY ((GDB_FR_FRP) + LONGSIZE) /* 73, unused ??? */ // ///* // * Again, CP0 registers // */ -//#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + LONGSIZE) /* 74 */ -#define GDB_FR_FRP ((GDB_FR_EPC) + LONGSIZE) /* 72 */ -#define GDB_FR_CP0_INDEX ((GDB_FR_FRP) + LONGSIZE) /* 74 */ +//#define GDB_FR_CP0_INDEX ((GDB_FR_DUMMY) + LONGSIZE) /* 74 */ +#define GDB_FR_FRP ((GDB_FR_EPC) + LONGSIZE) /* 72 */ +#define GDB_FR_CP0_INDEX ((GDB_FR_FRP) + LONGSIZE) /* 74 */ -#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + LONGSIZE) /* 75 */ -#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + LONGSIZE)/* 76 */ -#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + LONGSIZE)/* 77 */ -#define GDB_FR_CP0_CONTEXT ((GDB_FR_CP0_ENTRYLO1) + LONGSIZE)/* 78 */ -#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_CONTEXT) + LONGSIZE)/* 79 */ -#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + LONGSIZE)/* 80 */ -#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + LONGSIZE) /* 81 */ -#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + LONGSIZE) /* 82 */ -#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + LONGSIZE) /* 83 */ -#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + LONGSIZE) /* 84 */ -#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + LONGSIZE)/* 85 */ -#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + LONGSIZE) /* 86 */ -#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + LONGSIZE) /* 87 */ -#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + LONGSIZE) /* 88 */ -#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + LONGSIZE) /* 89 */ +#define GDB_FR_CP0_RANDOM ((GDB_FR_CP0_INDEX) + LONGSIZE) /* 75 */ +#define GDB_FR_CP0_ENTRYLO0 ((GDB_FR_CP0_RANDOM) + LONGSIZE)/* 76 */ +#define GDB_FR_CP0_ENTRYLO1 ((GDB_FR_CP0_ENTRYLO0) + LONGSIZE)/* 77 */ +#define GDB_FR_CP0_CONTEXT ((GDB_FR_CP0_ENTRYLO1) + LONGSIZE)/* 78 */ +#define GDB_FR_CP0_PAGEMASK ((GDB_FR_CP0_CONTEXT) + LONGSIZE)/* 79 */ +#define GDB_FR_CP0_WIRED ((GDB_FR_CP0_PAGEMASK) + LONGSIZE)/* 80 */ +#define GDB_FR_CP0_REG7 ((GDB_FR_CP0_WIRED) + LONGSIZE) /* 81 */ +#define GDB_FR_CP0_REG8 ((GDB_FR_CP0_REG7) + LONGSIZE) /* 82 */ +#define GDB_FR_CP0_REG9 ((GDB_FR_CP0_REG8) + LONGSIZE) /* 83 */ +#define GDB_FR_CP0_ENTRYHI ((GDB_FR_CP0_REG9) + LONGSIZE) /* 84 */ +#define GDB_FR_CP0_REG11 ((GDB_FR_CP0_ENTRYHI) + LONGSIZE)/* 85 */ +#define GDB_FR_CP0_REG12 ((GDB_FR_CP0_REG11) + LONGSIZE) /* 86 */ +#define GDB_FR_CP0_REG13 ((GDB_FR_CP0_REG12) + LONGSIZE) /* 87 */ +#define GDB_FR_CP0_REG14 ((GDB_FR_CP0_REG13) + LONGSIZE) /* 88 */ +#define GDB_FR_CP0_PRID ((GDB_FR_CP0_REG14) + LONGSIZE) /* 89 */ -#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + LONGSIZE) + (PTRSIZE-1)) & ~(PTRSIZE-1)) +#define GDB_FR_SIZE ((((GDB_FR_CP0_PRID) + LONGSIZE) + (PTRSIZE-1)) & ~(PTRSIZE-1)) /* * This is the same as above, but for the high-level @@ -146,15 +146,15 @@ */ typedef struct pt_regs_s { - /* Saved main processor registers. */ - rt_base_t regs[32]; - /* Saved special registers. */ - rt_base_t cp0_status; - rt_base_t hi; - rt_base_t lo; - rt_base_t cp0_badvaddr; - rt_base_t cp0_cause; - rt_base_t cp0_epc; + /* Saved main processor registers. */ + rt_base_t regs[32]; + /* Saved special registers. */ + rt_base_t cp0_status; + rt_base_t hi; + rt_base_t lo; + rt_base_t cp0_badvaddr; + rt_base_t cp0_cause; + rt_base_t cp0_epc; } pt_regs_t; typedef void (* exception_func_t)(pt_regs_t *regs); diff --git a/libcpu/mips/common/mips.h b/libcpu/mips/common/mips.h index a4bc74a05..f7f87aced 100644 --- a/libcpu/mips/common/mips.h +++ b/libcpu/mips/common/mips.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/mips/common/mips_addrspace.h b/libcpu/mips/common/mips_addrspace.h index 3b82a4e37..7a3ff76f1 100644 --- a/libcpu/mips/common/mips_addrspace.h +++ b/libcpu/mips/common/mips_addrspace.h @@ -1,25 +1,11 @@ /* - * File : mips_addrspace.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ12ÈÕ Urey the first version + * 2016-9-12 Urey the first version */ #ifndef _MIPS_ADDRSPACE_H_ @@ -33,15 +19,15 @@ #define _ATYPE_ #define _ATYPE32_ #define _ATYPE64_ -#define _CONST64_(x) x +#define _CONST64_(x) x #else -#define _ATYPE_ __PTRDIFF_TYPE__ -#define _ATYPE32_ int -#define _ATYPE64_ __s64 +#define _ATYPE_ __PTRDIFF_TYPE__ +#define _ATYPE32_ int +#define _ATYPE64_ __s64 #ifdef CONFIG_64BIT -#define _CONST64_(x) x ## L +#define _CONST64_(x) x ## L #else -#define _CONST64_(x) x ## LL +#define _CONST64_(x) x ## LL #endif #endif @@ -52,21 +38,21 @@ #define _ACAST32_ #define _ACAST64_ #else -#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */ -#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */ +#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */ +#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */ #endif /* * Returns the kernel segment base of a given address */ -#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000) +#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000) /* * Returns the physical address of a CKSEGx / XKPHYS address */ -#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) -#define XPHYSADDR(a) ((_ACAST64_(a)) & \ - _CONST64_(0x000000ffffffffff)) +#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff) +#define XPHYSADDR(a) ((_ACAST64_(a)) & \ + _CONST64_(0x000000ffffffffff)) #ifdef CONFIG_64BIT @@ -75,73 +61,73 @@ * The compatibility segments use the full 64-bit sign extended value. Note * the R8000 doesn't have them so don't reference these in generic MIPS code. */ -#define XKUSEG _CONST64_(0x0000000000000000) -#define XKSSEG _CONST64_(0x4000000000000000) -#define XKPHYS _CONST64_(0x8000000000000000) -#define XKSEG _CONST64_(0xc000000000000000) -#define CKSEG0 _CONST64_(0xffffffff80000000) -#define CKSEG1 _CONST64_(0xffffffffa0000000) -#define CKSSEG _CONST64_(0xffffffffc0000000) -#define CKSEG3 _CONST64_(0xffffffffe0000000) - -#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) -#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1) -#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2) -#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3) +#define XKUSEG _CONST64_(0x0000000000000000) +#define XKSSEG _CONST64_(0x4000000000000000) +#define XKPHYS _CONST64_(0x8000000000000000) +#define XKSEG _CONST64_(0xc000000000000000) +#define CKSEG0 _CONST64_(0xffffffff80000000) +#define CKSEG1 _CONST64_(0xffffffffa0000000) +#define CKSSEG _CONST64_(0xffffffffc0000000) +#define CKSEG3 _CONST64_(0xffffffffe0000000) + +#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0) +#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1) +#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2) +#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3) #else -#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0BASE) -#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1BASE) -#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2BASE) -#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3BASE) +#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0BASE) +#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1BASE) +#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2BASE) +#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3BASE) /* * Map an address to a certain kernel segment */ -#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0BASE) -#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1BASE) -#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2BASE) -#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3BASE) +#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0BASE) +#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1BASE) +#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2BASE) +#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3BASE) /* * Memory segments (32bit kernel mode addresses) * These are the traditional names used in the 32-bit universe. */ -//#define KUSEGBASE 0x00000000 -//#define KSEG0BASE 0x80000000 -//#define KSEG1BASE 0xa0000000 -//#define KSEG2BASE 0xc0000000 -//#define KSEG3BASE 0xe0000000 - -#define CKUSEG 0x00000000 -#define CKSEG0 0x80000000 -#define CKSEG1 0xa0000000 -#define CKSEG2 0xc0000000 -#define CKSEG3 0xe0000000 +//#define KUSEGBASE 0x00000000 +//#define KSEG0BASE 0x80000000 +//#define KSEG1BASE 0xa0000000 +//#define KSEG2BASE 0xc0000000 +//#define KSEG3BASE 0xe0000000 + +#define CKUSEG 0x00000000 +#define CKSEG0 0x80000000 +#define CKSEG1 0xa0000000 +#define CKSEG2 0xc0000000 +#define CKSEG3 0xe0000000 #endif /* * Cache modes for XKPHYS address conversion macros */ -#define K_CALG_COH_EXCL1_NOL2 0 -#define K_CALG_COH_SHRL1_NOL2 1 -#define K_CALG_UNCACHED 2 -#define K_CALG_NONCOHERENT 3 -#define K_CALG_COH_EXCL 4 -#define K_CALG_COH_SHAREABLE 5 -#define K_CALG_NOTUSED 6 -#define K_CALG_UNCACHED_ACCEL 7 +#define K_CALG_COH_EXCL1_NOL2 0 +#define K_CALG_COH_SHRL1_NOL2 1 +#define K_CALG_UNCACHED 2 +#define K_CALG_NONCOHERENT 3 +#define K_CALG_COH_EXCL 4 +#define K_CALG_COH_SHAREABLE 5 +#define K_CALG_NOTUSED 6 +#define K_CALG_UNCACHED_ACCEL 7 /* * 64-bit address conversions */ -#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p)) -#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p)) -#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) -#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \ - (_CONST64_(cm) << 59) | (a)) +#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p)) +#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p)) +#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK) +#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \ + (_CONST64_(cm) << 59) | (a)) /* * Returns the uncached address of a sdram address @@ -151,17 +137,17 @@ /* We use a 36 bit physical address map here and cannot access physical memory directly from core */ #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000) -#else /* !CONFIG_SOC_AU1X00 */ +#else /* !CONFIG_SOC_AU1X00 */ #define UNCACHED_SDRAM(a) CKSEG1ADDR(a) -#endif /* CONFIG_SOC_AU1X00 */ -#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_SOC_AU1X00 */ +#endif /* __ASSEMBLY__ */ /* * The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting * the region, 3 bits for the CCA mode. This leaves 59 bits of which the * R8000 implements most with its 48-bit physical address space. */ -#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */ +#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */ #ifndef CONFIG_CPU_R8000 @@ -170,13 +156,13 @@ * in order to catch bugs in the source code. */ -#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000) -#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */ +#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000) +#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */ #endif -#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK) -#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE) +#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK) +#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE) #ifndef __ASSEMBLY__ @@ -187,18 +173,18 @@ static inline phys_addr_t virt_to_phys(volatile void * address) { #ifndef CONFIG_64BIT - return CPHYSADDR(address); + return CPHYSADDR(address); #else - return XPHYSADDR(address); + return XPHYSADDR(address); #endif } static inline void * phys_to_virt(unsigned long address) { #ifndef CONFIG_64BIT - return (void *)KSEG0ADDR(address); + return (void *)KSEG0ADDR(address); #else - return (void *)CKSEG0ADDR(address); + return (void *)CKSEG0ADDR(address); #endif } #endif diff --git a/libcpu/mips/common/mips_asm.h b/libcpu/mips/common/mips_asm.h index 8f97e370a..5a566b3bd 100644 --- a/libcpu/mips/common/mips_asm.h +++ b/libcpu/mips/common/mips_asm.h @@ -1,25 +1,11 @@ /* - * File : mips_asm.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #ifndef _MIPS_ASM_H_ @@ -61,31 +47,31 @@ * in makefile. */ #ifdef _BSS_OLD_ -#define BSS .##section bss +#define BSS .##section bss #else -#define BSS .##bss +#define BSS .##bss #endif #define LEAF(name)\ - .##text;\ - .##globl name;\ - .##ent name;\ + .##text;\ + .##globl name;\ + .##ent name;\ name: #define SLEAF(name)\ - .##text;\ - .##ent name;\ + .##text;\ + .##ent name;\ name: #ifdef __ghs__ #define END(name)\ - .##end name + .##end name #else #define END(name)\ - .##size name,.-name;\ - .##end name + .##size name,.-name;\ + .##end name #endif @@ -165,7 +151,7 @@ typedef union tunSU32 #define True !False #ifndef NULL -#define NULL ((void *)0) +#define NULL ((void *)0) #endif//NULL #ifndef MIN @@ -173,31 +159,31 @@ typedef union tunSU32 #endif//MIN #ifndef MAX -#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) #endif//MAX -#define MAXUINT(w) (\ - ((w) == sizeof(U8)) ? 0xFFU :\ - ((w) == sizeof(U16)) ? 0xFFFFU :\ - ((w) == sizeof(U32)) ? 0xFFFFFFFFU : 0\ - ) +#define MAXUINT(w) (\ + ((w) == sizeof(U8)) ? 0xFFU :\ + ((w) == sizeof(U16)) ? 0xFFFFU :\ + ((w) == sizeof(U32)) ? 0xFFFFFFFFU : 0\ + ) -#define MAXINT(w) (\ - ((w) == sizeof(S8)) ? 0x7F :\ - ((w) == sizeof(S16)) ? 0x7FFF :\ - ((w) == sizeof(S32)) ? 0x7FFFFFFF : 0\ - ) +#define MAXINT(w) (\ + ((w) == sizeof(S8)) ? 0x7F :\ + ((w) == sizeof(S16)) ? 0x7FFF :\ + ((w) == sizeof(S32)) ? 0x7FFFFFFF : 0\ + ) -#define MSK(n) ((1 << (n)) - 1) +#define MSK(n) ((1 << (n)) - 1) -#define KUSEG_MSK 0x80000000 -#define KSEG_MSK 0xE0000000 +#define KUSEG_MSK 0x80000000 +#define KSEG_MSK 0xE0000000 -#define KUSEGBASE 0x00000000 -#define KSEG0BASE 0x80000000 -#define KSEG1BASE 0xA0000000 -#define KSSEGBASE 0xC0000000 -#define KSEG3BASE 0xE0000000 +#define KUSEGBASE 0x00000000 +#define KSEG0BASE 0x80000000 +#define KSEG1BASE 0xA0000000 +#define KSSEGBASE 0xC0000000 +#define KSEG3BASE 0xE0000000 /* Below macros perform the following functions : * @@ -211,8 +197,8 @@ typedef union tunSU32 * KSEG1A : Same as KSEG1 but operates on register rather than constant. * PHYSA : Same as PHYS but operates on register rather than constant. * CACHED : Alias for KSEG0 macro . - * (Note that KSEG0 cache attribute is determined by K0 - * field of Config register, but this is typically cached). + * (Note that KSEG0 cache attribute is determined by K0 + * field of Config register, but this is typically cached). * UNCACHED : Alias for KSEG1 macro . */ #ifdef __ASSEMBLY__ @@ -222,117 +208,117 @@ typedef union tunSU32 #define KSEG3(addr) (((addr) & ~KSEG_MSK) | KSEG3BASE) #define KUSEG(addr) (((addr) & ~KUSEG_MSK) | KUSEGBASE) #define PHYS(addr) ( (addr) & ~KSEG_MSK) -#define KSEG0A(reg) and reg, ~KSEG_MSK; or reg, KSEG0BASE -#define KSEG1A(reg) and reg, ~KSEG_MSK; or reg, KSEG1BASE -#define PHYSA(reg) and reg, ~KSEG_MSK +#define KSEG0A(reg) and reg, ~KSEG_MSK; or reg, KSEG0BASE +#define KSEG1A(reg) and reg, ~KSEG_MSK; or reg, KSEG1BASE +#define PHYSA(reg) and reg, ~KSEG_MSK #else #define KSEG0(addr) (((U32)(addr) & ~KSEG_MSK) | KSEG0BASE) #define KSEG1(addr) (((U32)(addr) & ~KSEG_MSK) | KSEG1BASE) -#define KSSEG(addr) (((U32)(addr) & ~KSEG_MSK) | KSSEGBASE) -#define KSEG3(addr) (((U32)(addr) & ~KSEG_MSK) | KSEG3BASE) -#define KUSEG(addr) (((U32)(addr) & ~KUSEG_MSK) | KUSEGBASE) -#define PHYS(addr) ((U32)(addr) & ~KSEG_MSK) +#define KSSEG(addr) (((U32)(addr) & ~KSEG_MSK) | KSSEGBASE) +#define KSEG3(addr) (((U32)(addr) & ~KSEG_MSK) | KSEG3BASE) +#define KUSEG(addr) (((U32)(addr) & ~KUSEG_MSK) | KUSEGBASE) +#define PHYS(addr) ((U32)(addr) & ~KSEG_MSK) #endif -#define CACHED(addr) KSEG0(addr) -#define UNCACHED(addr) KSEG1(addr) +#define CACHED(addr) KSEG0(addr) +#define UNCACHED(addr) KSEG1(addr) #ifdef __ASSEMBLY__ /* Macroes to access variables at constant addresses * Compensates for signed 16 bit displacement - * Typical use: li a0, HIKSEG1(ATLAS_ASCIIWORD) - * sw v1, LO_OFFS(ATLAS_ASCIIWORD)(a0) + * Typical use: li a0, HIKSEG1(ATLAS_ASCIIWORD) + * sw v1, LO_OFFS(ATLAS_ASCIIWORD)(a0) */ -#define HIKSEG0(addr) ((KSEG0(addr) + 0x8000) & 0xffff0000) -#define HIKSEG1(addr) ((KSEG1(addr) + 0x8000) & 0xffff0000) -#define HI_PART(addr) (((addr) + 0x8000) & 0xffff0000) -#define LO_OFFS(addr) ((addr) & 0xffff) +#define HIKSEG0(addr) ((KSEG0(addr) + 0x8000) & 0xffff0000) +#define HIKSEG1(addr) ((KSEG1(addr) + 0x8000) & 0xffff0000) +#define HI_PART(addr) (((addr) + 0x8000) & 0xffff0000) +#define LO_OFFS(addr) ((addr) & 0xffff) #endif /* Most/Least significant 32 bit from 64 bit double word */ -#define HI32(data64) ((U32)(data64 >> 32)) -#define LO32(data64) ((U32)(data64 & 0xFFFFFFFF)) +#define HI32(data64) ((U32)(data64 >> 32)) +#define LO32(data64) ((U32)(data64 & 0xFFFFFFFF)) #if ((!defined(__ASSEMBLY__)) && (!defined(__LANGUAGE_ASSEMBLY))) -#define REG8( addr ) (*(volatile U8 *) (addr)) -#define REG16( addr ) (*(volatile U16 *)(addr)) -#define REG32( addr ) (*(volatile U32 *)(addr)) -#define REG64( addr ) (*(volatile U64 *)(addr)) +#define REG8( addr ) (*(volatile U8 *) (addr)) +#define REG16( addr ) (*(volatile U16 *)(addr)) +#define REG32( addr ) (*(volatile U32 *)(addr)) +#define REG64( addr ) (*(volatile U64 *)(addr)) #endif /* Register field mapping */ -#define REGFIELD(reg, rfld) (((reg) & rfld##_MSK) >> rfld##_SHF) +#define REGFIELD(reg, rfld) (((reg) & rfld##_MSK) >> rfld##_SHF) -/* absolute register address, access */ -#define REGA(addr) REG32(addr) +/* absolute register address, access */ +#define REGA(addr) REG32(addr) -/* physical register address, access: base address + offsett */ -#define REGP(base,phys) REG32( (U32)(base) + (phys) ) +/* physical register address, access: base address + offsett */ +#define REGP(base,phys) REG32( (U32)(base) + (phys) ) -/* relative register address, access: base address + offsett */ +/* relative register address, access: base address + offsett */ #define REG(base,offs) REG32( (U32)(base) + offs##_##OFS ) -/* relative register address, access: base address + offsett */ +/* relative register address, access: base address + offsett */ #define REG_8(base,offs) REG8( (U32)(base) + offs##_##OFS ) -/* relative register address, access: base address + offsett */ +/* relative register address, access: base address + offsett */ #define REG_16(base,offs) REG16( (U32)(base) + offs##_##OFS ) -/* relative register address, access: base address + offsett */ +/* relative register address, access: base address + offsett */ #define REG_64(base,offs) REG64( (U32)(base) + offs##_##OFS ) /************************************** * Macroes not used by YAMON any more * (kept for backwards compatibility) */ -/* register read field */ -#define REGARD(addr,fld) ((REGA(addr) & addr##_##fld##_##MSK) \ - >> addr##_##fld##_##SHF) +/* register read field */ +#define REGARD(addr,fld) ((REGA(addr) & addr##_##fld##_##MSK) \ + >> addr##_##fld##_##SHF) -/* register write numeric field value */ -#define REGAWRI(addr,fld,intval) ((REGA(addr) & ~(addr##_##fld##_##MSK))\ - | ((intval) << addr##_##fld##_##SHF)) +/* register write numeric field value */ +#define REGAWRI(addr,fld,intval) ((REGA(addr) & ~(addr##_##fld##_##MSK))\ + | ((intval) << addr##_##fld##_##SHF)) -/* register write enumerated field value */ -#define REGAWRE(addr,fld,enumval) ((REGA(addr) & ~(addr##_##fld##_##MSK))\ - | ((addr##_##fld##_##enumval) << addr##_##fld##_##SHF)) +/* register write enumerated field value */ +#define REGAWRE(addr,fld,enumval) ((REGA(addr) & ~(addr##_##fld##_##MSK))\ + | ((addr##_##fld##_##enumval) << addr##_##fld##_##SHF)) /* Examples: * - * exccode = REGARD(CPU_CAUSE,EXC); + * exccode = REGARD(CPU_CAUSE,EXC); * - * REGA(SDR_CONTROL) = REGAWRI(OSG_CONTROL,TMO,17) - * | REGAWRE(OSG_CONTROL,DTYPE,PC1); + * REGA(SDR_CONTROL) = REGAWRI(OSG_CONTROL,TMO,17) + * | REGAWRE(OSG_CONTROL,DTYPE,PC1); */ -/* register read field */ -#define REGRD(base,offs,fld) ((REG(base,offs) & offs##_##fld##_##MSK) \ - >> offs##_##fld##_##SHF) +/* register read field */ +#define REGRD(base,offs,fld) ((REG(base,offs) & offs##_##fld##_##MSK) \ + >> offs##_##fld##_##SHF) -/* register write numeric field value */ -#define REGWRI(base,offs,fld,intval)((REG(base,offs)& ~(offs##_##fld##_##MSK))\ +/* register write numeric field value */ +#define REGWRI(base,offs,fld,intval)((REG(base,offs)& ~(offs##_##fld##_##MSK))\ | (((intval) << offs##_##fld##_##SHF) & offs##_##fld##_##MSK)) -/* register write enumerated field value */ -#define REGWRE(base,offs,fld,enumval)((REG(base,offs) & ~(offs##_##fld##_##MSK))\ - | ((offs##_##fld##_##enumval) << offs##_##fld##_##SHF)) +/* register write enumerated field value */ +#define REGWRE(base,offs,fld,enumval)((REG(base,offs) & ~(offs##_##fld##_##MSK))\ + | ((offs##_##fld##_##enumval) << offs##_##fld##_##SHF)) -/* physical register read field */ -#define REGPRD(base,phys,fld) ((REGP(base,phys) & phys##_##fld##_##MSK) \ - >> phys##_##fld##_##SHF) +/* physical register read field */ +#define REGPRD(base,phys,fld) ((REGP(base,phys) & phys##_##fld##_##MSK) \ + >> phys##_##fld##_##SHF) -/* physical register write numeric field value */ -#define REGPWRI(base,phys,fld,intval)((REGP(base,phys)& ~(phys##_##fld##_##MSK))\ - | ((intval) << phys##_##fld##_##SHF)) +/* physical register write numeric field value */ +#define REGPWRI(base,phys,fld,intval)((REGP(base,phys)& ~(phys##_##fld##_##MSK))\ + | ((intval) << phys##_##fld##_##SHF)) -/* physical register write enumerated field value */ -#define REGPWRE(base,phys,fld,enumval)((REGP(base,phys) & ~(phys##_##fld##_##MSK))\ - | ((phys##_##fld##_##enumval) << phys##_##fld##_##SHF)) +/* physical register write enumerated field value */ +#define REGPWRE(base,phys,fld,enumval)((REGP(base,phys) & ~(phys##_##fld##_##MSK))\ + | ((phys##_##fld##_##enumval) << phys##_##fld##_##SHF)) /* * End of macroes not used by YAMON any more *********************************************/ @@ -344,14 +330,14 @@ typedef union tunSU32 /* Set byte address to little endian format */ #ifdef EL -#define SWAP_BYTEADDR_EL(addr) addr +#define SWAP_BYTEADDR_EL(addr) addr #else #define SWAP_BYTEADDR_EL(addr) SWAP_BYTEADDR32( addr ) #endif /* Set byte address to big endian format */ #ifdef EB -#define SWAP_BYTEADDR_EB(addr) addr +#define SWAP_BYTEADDR_EB(addr) addr #else #define SWAP_BYTEADDR_EB(addr) SWAP_BYTEADDR32( addr ) #endif diff --git a/libcpu/mips/common/mips_cache.c b/libcpu/mips/common/mips_cache.c index 1c979b710..1f20e15e5 100644 --- a/libcpu/mips/common/mips_cache.c +++ b/libcpu/mips/common/mips_cache.c @@ -1,25 +1,11 @@ /* - * File : mips_cache.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #include @@ -28,7 +14,7 @@ extern void cache_init(rt_ubase_t cache_size, rt_ubase_t cache_line_size); void r4k_cache_init(void) { -// cache_init(dcache_size, cpu_dcache_line_size); +// cache_init(dcache_size, cpu_dcache_line_size); } void r4k_cache_flush_all(void) @@ -45,7 +31,7 @@ void r4k_icache_flush_all(void) void r4k_icache_flush_range(rt_ubase_t addr, rt_ubase_t size) { - rt_ubase_t end, a; + rt_ubase_t end, a; if (size > g_mips_core.icache_size) { @@ -53,7 +39,7 @@ void r4k_icache_flush_range(rt_ubase_t addr, rt_ubase_t size) } else { - rt_ubase_t ic_lsize = g_mips_core.icache_line_size; + rt_ubase_t ic_lsize = g_mips_core.icache_line_size; a = addr & ~(ic_lsize - 1); end = ((addr + size) - 1) & ~(ic_lsize - 1); @@ -69,8 +55,8 @@ void r4k_icache_flush_range(rt_ubase_t addr, rt_ubase_t size) void r4k_icache_lock_range(rt_ubase_t addr, rt_ubase_t size) { - rt_ubase_t end, a; - rt_ubase_t ic_lsize = g_mips_core.icache_line_size; + rt_ubase_t end, a; + rt_ubase_t ic_lsize = g_mips_core.icache_line_size; a = addr & ~(ic_lsize - 1); end = ((addr + size) - 1) & ~(ic_lsize - 1); @@ -85,7 +71,7 @@ void r4k_icache_lock_range(rt_ubase_t addr, rt_ubase_t size) void r4k_dcache_inv(rt_ubase_t addr, rt_ubase_t size) { - rt_ubase_t end, a; + rt_ubase_t end, a; rt_ubase_t dc_lsize = g_mips_core.dcache_line_size; a = addr & ~(dc_lsize - 1); @@ -101,7 +87,7 @@ void r4k_dcache_inv(rt_ubase_t addr, rt_ubase_t size) void r4k_dcache_wback_inv(rt_ubase_t addr, rt_ubase_t size) { - rt_ubase_t end, a; + rt_ubase_t end, a; if (size >= g_mips_core.dcache_size) { @@ -109,7 +95,7 @@ void r4k_dcache_wback_inv(rt_ubase_t addr, rt_ubase_t size) } else { - rt_ubase_t dc_lsize = g_mips_core.dcache_line_size; + rt_ubase_t dc_lsize = g_mips_core.dcache_line_size; a = addr & ~(dc_lsize - 1); end = ((addr + size) - 1) & ~(dc_lsize - 1); diff --git a/libcpu/mips/common/mips_cache.h b/libcpu/mips/common/mips_cache.h index a94704107..c260ed304 100644 --- a/libcpu/mips/common/mips_cache.h +++ b/libcpu/mips/common/mips_cache.h @@ -1,25 +1,11 @@ /* - * File : mips_cache.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ10ÈÕ Urey the first version + * 2016-9-10 Urey the first version */ #ifndef _MIPS_CACHE_H_ @@ -120,7 +106,7 @@ enum dma_data_direction #define INDEX_STORE_DATA_D 0x1d #define INDEX_STORE_DATA_S 0x1f -#define cache_op(op, addr) \ +#define cache_op(op, addr) \ __asm__ __volatile__( \ ".set push\n" \ ".set noreorder\n" \ @@ -130,95 +116,95 @@ enum dma_data_direction : \ : "i" (op), "R" (*(unsigned char *)(addr))) -#define cache16_unroll32(base, op) \ - __asm__ __volatile__( \ - " .set noreorder \n" \ - " .set mips3 \n" \ - " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \ - " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \ - " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \ - " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \ - " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \ - " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \ - " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \ - " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \ - " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \ - " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \ - " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \ - " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \ - " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \ - " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \ - " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \ - " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \ - " .set mips0 \n" \ - " .set reorder \n" \ - : \ - : "r" (base), \ - "i" (op)); +#define cache16_unroll32(base, op) \ + __asm__ __volatile__( \ + " .set noreorder \n" \ + " .set mips3 \n" \ + " cache %1, 0x000(%0); cache %1, 0x010(%0) \n" \ + " cache %1, 0x020(%0); cache %1, 0x030(%0) \n" \ + " cache %1, 0x040(%0); cache %1, 0x050(%0) \n" \ + " cache %1, 0x060(%0); cache %1, 0x070(%0) \n" \ + " cache %1, 0x080(%0); cache %1, 0x090(%0) \n" \ + " cache %1, 0x0a0(%0); cache %1, 0x0b0(%0) \n" \ + " cache %1, 0x0c0(%0); cache %1, 0x0d0(%0) \n" \ + " cache %1, 0x0e0(%0); cache %1, 0x0f0(%0) \n" \ + " cache %1, 0x100(%0); cache %1, 0x110(%0) \n" \ + " cache %1, 0x120(%0); cache %1, 0x130(%0) \n" \ + " cache %1, 0x140(%0); cache %1, 0x150(%0) \n" \ + " cache %1, 0x160(%0); cache %1, 0x170(%0) \n" \ + " cache %1, 0x180(%0); cache %1, 0x190(%0) \n" \ + " cache %1, 0x1a0(%0); cache %1, 0x1b0(%0) \n" \ + " cache %1, 0x1c0(%0); cache %1, 0x1d0(%0) \n" \ + " cache %1, 0x1e0(%0); cache %1, 0x1f0(%0) \n" \ + " .set mips0 \n" \ + " .set reorder \n" \ + : \ + : "r" (base), \ + "i" (op)); static inline void flush_icache_line_indexed(rt_ubase_t addr) { - cache_op(INDEX_INVALIDATE_I, addr); + cache_op(INDEX_INVALIDATE_I, addr); } static inline void flush_dcache_line_indexed(rt_ubase_t addr) { - cache_op(INDEX_WRITEBACK_INV_D, addr); + cache_op(INDEX_WRITEBACK_INV_D, addr); } static inline void flush_icache_line(rt_ubase_t addr) { - cache_op(HIT_INVALIDATE_I, addr); + cache_op(HIT_INVALIDATE_I, addr); } static inline void lock_icache_line(rt_ubase_t addr) { - cache_op(FETCH_AND_LOCK_I, addr); + cache_op(FETCH_AND_LOCK_I, addr); } static inline void lock_dcache_line(rt_ubase_t addr) { - cache_op(FETCH_AND_LOCK_D, addr); + cache_op(FETCH_AND_LOCK_D, addr); } static inline void flush_dcache_line(rt_ubase_t addr) { - cache_op(HIT_WRITEBACK_INV_D, addr); + cache_op(HIT_WRITEBACK_INV_D, addr); } static inline void invalidate_dcache_line(rt_ubase_t addr) { - cache_op(HIT_INVALIDATE_D, addr); + cache_op(HIT_INVALIDATE_D, addr); } static inline void blast_dcache16(void) { - rt_ubase_t start = KSEG0BASE; - rt_ubase_t end = start + g_mips_core.dcache_size; - rt_ubase_t addr; + rt_ubase_t start = KSEG0BASE; + rt_ubase_t end = start + g_mips_core.dcache_size; + rt_ubase_t addr; - for (addr = start; addr < end; addr += g_mips_core.dcache_line_size) - cache16_unroll32(addr, INDEX_WRITEBACK_INV_D); + for (addr = start; addr < end; addr += g_mips_core.dcache_line_size) + cache16_unroll32(addr, INDEX_WRITEBACK_INV_D); } static inline void inv_dcache16(void) { - rt_ubase_t start = KSEG0BASE; - rt_ubase_t end = start + g_mips_core.dcache_size; - rt_ubase_t addr; + rt_ubase_t start = KSEG0BASE; + rt_ubase_t end = start + g_mips_core.dcache_size; + rt_ubase_t addr; - for (addr = start; addr < end; addr += g_mips_core.dcache_line_size) - cache16_unroll32(addr, HIT_INVALIDATE_D); + for (addr = start; addr < end; addr += g_mips_core.dcache_line_size) + cache16_unroll32(addr, HIT_INVALIDATE_D); } static inline void blast_icache16(void) { - rt_ubase_t start = KSEG0BASE; - rt_ubase_t end = start + g_mips_core.icache_size; - rt_ubase_t addr; + rt_ubase_t start = KSEG0BASE; + rt_ubase_t end = start + g_mips_core.icache_size; + rt_ubase_t addr; - for (addr = start; addr < end; addr += g_mips_core.icache_line_size) - cache16_unroll32(addr, INDEX_INVALIDATE_I); + for (addr = start; addr < end; addr += g_mips_core.icache_line_size) + cache16_unroll32(addr, INDEX_INVALIDATE_I); } void r4k_cache_init(void); diff --git a/libcpu/mips/common/mips_cfg.h b/libcpu/mips/common/mips_cfg.h index 3f0575d65..0dff9b787 100644 --- a/libcpu/mips/common/mips_cfg.h +++ b/libcpu/mips/common/mips_cfg.h @@ -1,25 +1,11 @@ /* - * File : mips_cfg.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ10ÈÕ Urey the first version + * 2016-9-10 Urey the first version */ #ifndef _MIPS_CFG_H_ @@ -38,7 +24,7 @@ typedef struct mips32_core_cfg // uint16_t dcache_ways; uint16_t dcache_size; - uint16_t max_tlb_entries; /* number of tlb entry */ + uint16_t max_tlb_entries; /* number of tlb entry */ } mips32_core_cfg_t; extern mips32_core_cfg_t g_mips_core; diff --git a/libcpu/mips/common/mips_context.h b/libcpu/mips/common/mips_context.h index 60d573784..466353012 100644 --- a/libcpu/mips/common/mips_context.h +++ b/libcpu/mips/common/mips_context.h @@ -1,36 +1,22 @@ /* - * File : mips_context_asm.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #ifndef _MIPS_CONTEXT_ASM_H_ #define _MIPS_CONTEXT_ASM_H_ -#define CONTEXT_SIZE ( STK_CTX_SIZE + FPU_ADJ ) +#define CONTEXT_SIZE ( STK_CTX_SIZE + FPU_ADJ ) #ifdef __mips_hard_float -#define FPU_ADJ (32 * 4 + 8) /* FP0-FP31 + CP1_STATUS */ -#define FPU_CTX ( CONTEXT_SIZE - FPU_ADJ ) +#define FPU_ADJ (32 * 4 + 8) /* FP0-FP31 + CP1_STATUS */ +#define FPU_CTX ( CONTEXT_SIZE - FPU_ADJ ) #else -#define FPU_ADJ 0 +#define FPU_ADJ 0 #endif @@ -43,237 +29,237 @@ #endif .macro SAVE_CONTEXT - .set push - .set noat - .set noreorder - .set volatile - - //save SP - move k1, sp - move k0, sp - subu sp, k1, CONTEXT_SIZE - sw k0, (29 * 4)(sp) - - //save REG - sw $0, ( 0 * 4)(sp) - sw $1, ( 1 * 4)(sp) - sw $2, ( 2 * 4)(sp) - sw $3, ( 3 * 4)(sp) - sw $4, ( 4 * 4)(sp) - sw $5, ( 5 * 4)(sp) - sw $6, ( 6 * 4)(sp) - sw $7, ( 7 * 4)(sp) - sw $8, ( 8 * 4)(sp) - sw $9, ( 9 * 4)(sp) - sw $10, (10 * 4)(sp) - sw $11, (11 * 4)(sp) - sw $12, (12 * 4)(sp) - sw $13, (13 * 4)(sp) - sw $14, (14 * 4)(sp) - sw $15, (15 * 4)(sp) - sw $16, (16 * 4)(sp) - sw $17, (17 * 4)(sp) - sw $18, (18 * 4)(sp) - sw $19, (19 * 4)(sp) - sw $20, (20 * 4)(sp) - sw $21, (21 * 4)(sp) - sw $22, (22 * 4)(sp) - sw $23, (23 * 4)(sp) - sw $24, (24 * 4)(sp) - sw $25, (25 * 4)(sp) - /* K0 K1 */ - sw $28, (28 * 4)(sp) - /* SP */ - sw $30, (30 * 4)(sp) - sw $31, (31 * 4)(sp) - - /* STATUS CAUSE EPC.... */ - mfc0 $2, CP0_STATUS - sw $2, STK_OFFSET_SR(sp) - - mfc0 $2, CP0_CAUSE - sw $2, STK_OFFSET_CAUSE(sp) - - mfc0 $2, CP0_BADVADDR - sw $2, STK_OFFSET_BADVADDR(sp) - - MFC0 $2, CP0_EPC - sw $2, STK_OFFSET_EPC(sp) - - mfhi $2 - sw $2, STK_OFFSET_HI(sp) - - mflo $2 - sw $2, STK_OFFSET_LO(sp) + .set push + .set noat + .set noreorder + .set volatile + + //save SP + move k1, sp + move k0, sp + subu sp, k1, CONTEXT_SIZE + sw k0, (29 * 4)(sp) + + //save REG + sw $0, ( 0 * 4)(sp) + sw $1, ( 1 * 4)(sp) + sw $2, ( 2 * 4)(sp) + sw $3, ( 3 * 4)(sp) + sw $4, ( 4 * 4)(sp) + sw $5, ( 5 * 4)(sp) + sw $6, ( 6 * 4)(sp) + sw $7, ( 7 * 4)(sp) + sw $8, ( 8 * 4)(sp) + sw $9, ( 9 * 4)(sp) + sw $10, (10 * 4)(sp) + sw $11, (11 * 4)(sp) + sw $12, (12 * 4)(sp) + sw $13, (13 * 4)(sp) + sw $14, (14 * 4)(sp) + sw $15, (15 * 4)(sp) + sw $16, (16 * 4)(sp) + sw $17, (17 * 4)(sp) + sw $18, (18 * 4)(sp) + sw $19, (19 * 4)(sp) + sw $20, (20 * 4)(sp) + sw $21, (21 * 4)(sp) + sw $22, (22 * 4)(sp) + sw $23, (23 * 4)(sp) + sw $24, (24 * 4)(sp) + sw $25, (25 * 4)(sp) + /* K0 K1 */ + sw $28, (28 * 4)(sp) + /* SP */ + sw $30, (30 * 4)(sp) + sw $31, (31 * 4)(sp) + + /* STATUS CAUSE EPC.... */ + mfc0 $2, CP0_STATUS + sw $2, STK_OFFSET_SR(sp) + + mfc0 $2, CP0_CAUSE + sw $2, STK_OFFSET_CAUSE(sp) + + mfc0 $2, CP0_BADVADDR + sw $2, STK_OFFSET_BADVADDR(sp) + + MFC0 $2, CP0_EPC + sw $2, STK_OFFSET_EPC(sp) + + mfhi $2 + sw $2, STK_OFFSET_HI(sp) + + mflo $2 + sw $2, STK_OFFSET_LO(sp) #ifdef __mips_hard_float - add a0, sp,STK_CTX_SIZE + add a0, sp,STK_CTX_SIZE - mfc0 t0, CP0_STATUS - .set push - .set at - or t0, M_StatusCU1 - .set push - mtc0 t0, CP0_STATUS + mfc0 t0, CP0_STATUS + .set push + .set at + or t0, M_StatusCU1 + .set push + mtc0 t0, CP0_STATUS - cfc1 t0, CP1_STATUS + cfc1 t0, CP1_STATUS sw t0 , 0x00(a0) - swc1 $f0,(0x04 * 1)(a0) - swc1 $f1,(0x04 * 2)(a0) - swc1 $f2,(0x04 * 3)(a0) - swc1 $f3,(0x04 * 4)(a0) - swc1 $f4,(0x04 * 5)(a0) - swc1 $f5,(0x04 * 6)(a0) - swc1 $f6,(0x04 * 7)(a0) - swc1 $f7,(0x04 * 8)(a0) - swc1 $f8,(0x04 * 9)(a0) - swc1 $f9,(0x04 * 10)(a0) - swc1 $f10,(0x04 * 11)(a0) - swc1 $f11,(0x04 * 12)(a0) - swc1 $f12,(0x04 * 13)(a0) - swc1 $f13,(0x04 * 14)(a0) - swc1 $f14,(0x04 * 15)(a0) - swc1 $f15,(0x04 * 16)(a0) - swc1 $f16,(0x04 * 17)(a0) - swc1 $f17,(0x04 * 18)(a0) - swc1 $f18,(0x04 * 19)(a0) - swc1 $f19,(0x04 * 20)(a0) - swc1 $f20,(0x04 * 21)(a0) - swc1 $f21,(0x04 * 22)(a0) - swc1 $f22,(0x04 * 23)(a0) - swc1 $f23,(0x04 * 24)(a0) - swc1 $f24,(0x04 * 25)(a0) - swc1 $f25,(0x04 * 26)(a0) - swc1 $f26,(0x04 * 27)(a0) - swc1 $f27,(0x04 * 28)(a0) - swc1 $f28,(0x04 * 29)(a0) - swc1 $f29,(0x04 * 30)(a0) - swc1 $f30,(0x04 * 31)(a0) - swc1 $f31,(0x04 * 32)(a0) - - nop + swc1 $f0,(0x04 * 1)(a0) + swc1 $f1,(0x04 * 2)(a0) + swc1 $f2,(0x04 * 3)(a0) + swc1 $f3,(0x04 * 4)(a0) + swc1 $f4,(0x04 * 5)(a0) + swc1 $f5,(0x04 * 6)(a0) + swc1 $f6,(0x04 * 7)(a0) + swc1 $f7,(0x04 * 8)(a0) + swc1 $f8,(0x04 * 9)(a0) + swc1 $f9,(0x04 * 10)(a0) + swc1 $f10,(0x04 * 11)(a0) + swc1 $f11,(0x04 * 12)(a0) + swc1 $f12,(0x04 * 13)(a0) + swc1 $f13,(0x04 * 14)(a0) + swc1 $f14,(0x04 * 15)(a0) + swc1 $f15,(0x04 * 16)(a0) + swc1 $f16,(0x04 * 17)(a0) + swc1 $f17,(0x04 * 18)(a0) + swc1 $f18,(0x04 * 19)(a0) + swc1 $f19,(0x04 * 20)(a0) + swc1 $f20,(0x04 * 21)(a0) + swc1 $f21,(0x04 * 22)(a0) + swc1 $f22,(0x04 * 23)(a0) + swc1 $f23,(0x04 * 24)(a0) + swc1 $f24,(0x04 * 25)(a0) + swc1 $f25,(0x04 * 26)(a0) + swc1 $f26,(0x04 * 27)(a0) + swc1 $f27,(0x04 * 28)(a0) + swc1 $f28,(0x04 * 29)(a0) + swc1 $f29,(0x04 * 30)(a0) + swc1 $f30,(0x04 * 31)(a0) + swc1 $f31,(0x04 * 32)(a0) + + nop #endif - //restore a0 - lw a0, (REG_A0 * 4)(sp) + //restore a0 + lw a0, (REG_A0 * 4)(sp) - .set pop + .set pop .endm .macro RESTORE_CONTEXT - .set push - .set noat - .set noreorder - .set volatile + .set push + .set noat + .set noreorder + .set volatile #ifdef __mips_hard_float - add a0, sp,STK_CTX_SIZE + add a0, sp,STK_CTX_SIZE - mfc0 t0, CP0_STATUS - .set push - .set at + mfc0 t0, CP0_STATUS + .set push + .set at or t0, M_StatusCU1 - .set noat - mtc0 t0, CP0_STATUS + .set noat + mtc0 t0, CP0_STATUS lw t0 , 0x00(a0) - lwc1 $f0,(0x04 * 1)(a0) - lwc1 $f1,(0x04 * 2)(a0) - lwc1 $f2,(0x04 * 3)(a0) - lwc1 $f3,(0x04 * 4)(a0) - lwc1 $f4,(0x04 * 5)(a0) - lwc1 $f5,(0x04 * 6)(a0) - lwc1 $f6,(0x04 * 7)(a0) - lwc1 $f7,(0x04 * 8)(a0) - lwc1 $f8,(0x04 * 9)(a0) - lwc1 $f9,(0x04 * 10)(a0) - lwc1 $f10,(0x04 * 11)(a0) - lwc1 $f11,(0x04 * 12)(a0) - lwc1 $f12,(0x04 * 13)(a0) - lwc1 $f13,(0x04 * 14)(a0) - lwc1 $f14,(0x04 * 15)(a0) - lwc1 $f15,(0x04 * 16)(a0) - lwc1 $f16,(0x04 * 17)(a0) - lwc1 $f17,(0x04 * 18)(a0) - lwc1 $f18,(0x04 * 19)(a0) - lwc1 $f19,(0x04 * 20)(a0) - lwc1 $f20,(0x04 * 21)(a0) - lwc1 $f21,(0x04 * 22)(a0) - lwc1 $f22,(0x04 * 23)(a0) - lwc1 $f23,(0x04 * 24)(a0) - lwc1 $f24,(0x04 * 25)(a0) - lwc1 $f25,(0x04 * 26)(a0) - lwc1 $f26,(0x04 * 27)(a0) - lwc1 $f27,(0x04 * 28)(a0) - lwc1 $f28,(0x04 * 29)(a0) - lwc1 $f29,(0x04 * 30)(a0) - lwc1 $f30,(0x04 * 31)(a0) - lwc1 $f31,(0x04 * 32)(a0) - ctc1 t0, CP1_STATUS ;/* restore fpp status reg */ - - nop + lwc1 $f0,(0x04 * 1)(a0) + lwc1 $f1,(0x04 * 2)(a0) + lwc1 $f2,(0x04 * 3)(a0) + lwc1 $f3,(0x04 * 4)(a0) + lwc1 $f4,(0x04 * 5)(a0) + lwc1 $f5,(0x04 * 6)(a0) + lwc1 $f6,(0x04 * 7)(a0) + lwc1 $f7,(0x04 * 8)(a0) + lwc1 $f8,(0x04 * 9)(a0) + lwc1 $f9,(0x04 * 10)(a0) + lwc1 $f10,(0x04 * 11)(a0) + lwc1 $f11,(0x04 * 12)(a0) + lwc1 $f12,(0x04 * 13)(a0) + lwc1 $f13,(0x04 * 14)(a0) + lwc1 $f14,(0x04 * 15)(a0) + lwc1 $f15,(0x04 * 16)(a0) + lwc1 $f16,(0x04 * 17)(a0) + lwc1 $f17,(0x04 * 18)(a0) + lwc1 $f18,(0x04 * 19)(a0) + lwc1 $f19,(0x04 * 20)(a0) + lwc1 $f20,(0x04 * 21)(a0) + lwc1 $f21,(0x04 * 22)(a0) + lwc1 $f22,(0x04 * 23)(a0) + lwc1 $f23,(0x04 * 24)(a0) + lwc1 $f24,(0x04 * 25)(a0) + lwc1 $f25,(0x04 * 26)(a0) + lwc1 $f26,(0x04 * 27)(a0) + lwc1 $f27,(0x04 * 28)(a0) + lwc1 $f28,(0x04 * 29)(a0) + lwc1 $f29,(0x04 * 30)(a0) + lwc1 $f30,(0x04 * 31)(a0) + lwc1 $f31,(0x04 * 32)(a0) + ctc1 t0, CP1_STATUS ;/* restore fpp status reg */ + + nop #endif - /* ͨÓüĴæÆ÷ */ - /* ZERO */ - lw $1, ( 1 * 4)(sp) - /* V0 */ - lw $3, ( 3 * 4)(sp) - lw $4, ( 4 * 4)(sp) - lw $5, ( 5 * 4)(sp) - lw $6, ( 6 * 4)(sp) - lw $7, ( 7 * 4)(sp) - lw $8, ( 8 * 4)(sp) - lw $9, ( 9 * 4)(sp) - lw $10, (10 * 4)(sp) - lw $11, (11 * 4)(sp) - lw $12, (12 * 4)(sp) - lw $13, (13 * 4)(sp) - lw $14, (14 * 4)(sp) - lw $15, (15 * 4)(sp) - lw $16, (16 * 4)(sp) - lw $17, (17 * 4)(sp) - lw $18, (18 * 4)(sp) - lw $19, (19 * 4)(sp) - lw $20, (20 * 4)(sp) - lw $21, (21 * 4)(sp) - lw $22, (22 * 4)(sp) - lw $23, (23 * 4)(sp) - lw $24, (24 * 4)(sp) - lw $25, (25 * 4)(sp) - lw $26, (26 * 4)(sp) - lw $27, (27 * 4)(sp) - lw $28, (28 * 4)(sp) - /* SP */ - lw $30, (30 * 4)(sp) - lw $31, (31 * 4)(sp) - - - /* STATUS CAUSE EPC.... */ - lw $2, STK_OFFSET_HI(sp) - mthi $2 - lw $2, STK_OFFSET_LO(sp) - mtlo $2 - - lw $2, STK_OFFSET_SR(sp) - mtc0 $2, CP0_STATUS - - lw $2, STK_OFFSET_BADVADDR(sp) - mtc0 $2, CP0_BADVADDR - - lw $2, STK_OFFSET_CAUSE(sp) - mtc0 $2, CP0_CAUSE - - lw $2, STK_OFFSET_EPC(sp) - MTC0 $2, CP0_EPC - - //restore $2 - lw $2, ( 2 * 4)(sp) - //restore sp - lw $29, (29 * 4)(sp) - - eret - nop + /* ͨ通用寄存器 */ + /* ZERO */ + lw $1, ( 1 * 4)(sp) + /* V0 */ + lw $3, ( 3 * 4)(sp) + lw $4, ( 4 * 4)(sp) + lw $5, ( 5 * 4)(sp) + lw $6, ( 6 * 4)(sp) + lw $7, ( 7 * 4)(sp) + lw $8, ( 8 * 4)(sp) + lw $9, ( 9 * 4)(sp) + lw $10, (10 * 4)(sp) + lw $11, (11 * 4)(sp) + lw $12, (12 * 4)(sp) + lw $13, (13 * 4)(sp) + lw $14, (14 * 4)(sp) + lw $15, (15 * 4)(sp) + lw $16, (16 * 4)(sp) + lw $17, (17 * 4)(sp) + lw $18, (18 * 4)(sp) + lw $19, (19 * 4)(sp) + lw $20, (20 * 4)(sp) + lw $21, (21 * 4)(sp) + lw $22, (22 * 4)(sp) + lw $23, (23 * 4)(sp) + lw $24, (24 * 4)(sp) + lw $25, (25 * 4)(sp) + lw $26, (26 * 4)(sp) + lw $27, (27 * 4)(sp) + lw $28, (28 * 4)(sp) + /* SP */ + lw $30, (30 * 4)(sp) + lw $31, (31 * 4)(sp) + + + /* STATUS CAUSE EPC.... */ + lw $2, STK_OFFSET_HI(sp) + mthi $2 + lw $2, STK_OFFSET_LO(sp) + mtlo $2 + + lw $2, STK_OFFSET_SR(sp) + mtc0 $2, CP0_STATUS + + lw $2, STK_OFFSET_BADVADDR(sp) + mtc0 $2, CP0_BADVADDR + + lw $2, STK_OFFSET_CAUSE(sp) + mtc0 $2, CP0_CAUSE + + lw $2, STK_OFFSET_EPC(sp) + MTC0 $2, CP0_EPC + + //restore $2 + lw $2, ( 2 * 4)(sp) + //restore sp + lw $29, (29 * 4)(sp) + + eret + nop .set pop .endm #endif diff --git a/libcpu/mips/common/mips_def.h b/libcpu/mips/common/mips_def.h index 1727684f5..3ac965f65 100644 --- a/libcpu/mips/common/mips_def.h +++ b/libcpu/mips/common/mips_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2019, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -35,24 +35,24 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnOpcode 26 -#define M_InstnOpcode (0x3f << S_InstnOpcode) -#define S_InstnRS 21 -#define M_InstnRS (0x1f << S_InstnRS) -#define S_InstnRT 16 -#define M_InstnRT (0x1f << S_InstnRT) -#define S_InstnRD 11 -#define M_InstnRD (0x1f << S_InstnRD) -#define S_InstnSA 6 -#define M_InstnSA (0x1f << S_InstnSA) -#define S_InstnTcode 6 -#define M_InstnTcode (0x3ff << S_InstnTcode) -#define S_InstnBcode 6 -#define M_InstnBcode (0xfffff << S_InstnBcode) -#define S_InstnFunc 0 -#define M_InstnFunc (0x3f << S_InstnFunc) -#define S_InstnSel 0 -#define M_InstnSel (0x7 << S_InstnSel) +#define S_InstnOpcode 26 +#define M_InstnOpcode (0x3f << S_InstnOpcode) +#define S_InstnRS 21 +#define M_InstnRS (0x1f << S_InstnRS) +#define S_InstnRT 16 +#define M_InstnRT (0x1f << S_InstnRT) +#define S_InstnRD 11 +#define M_InstnRD (0x1f << S_InstnRD) +#define S_InstnSA 6 +#define M_InstnSA (0x1f << S_InstnSA) +#define S_InstnTcode 6 +#define M_InstnTcode (0x3ff << S_InstnTcode) +#define S_InstnBcode 6 +#define M_InstnBcode (0xfffff << S_InstnBcode) +#define S_InstnFunc 0 +#define M_InstnFunc (0x3f << S_InstnFunc) +#define S_InstnSel 0 +#define M_InstnSel (0x7 << S_InstnSel) /* * I-Type (load, store, branch, immediate) @@ -64,8 +64,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnOffset 0 -#define M_InstnOffset (0xffff << S_InstnOffset) +#define S_InstnOffset 0 +#define M_InstnOffset (0xffff << S_InstnOffset) /* * I-Type (pref) @@ -77,8 +77,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnHint S_InstnRT -#define M_InstnHint M_InstnRT +#define S_InstnHint S_InstnRT +#define M_InstnHint M_InstnRT /* * J-Type (jump) @@ -90,8 +90,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnJIndex 0 -#define M_InstnJIndex (0x03ffffff << S_InstnJIndex) +#define S_InstnJIndex 0 +#define M_InstnJIndex (0x03ffffff << S_InstnJIndex) /* * FP R-Type (operate) @@ -103,14 +103,14 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnFmt S_InstnRS -#define M_InstnFmt M_InstnRS -#define S_InstnFT S_InstnRT -#define M_InstnFT M_InstnRT -#define S_InstnFS S_InstnRD -#define M_InstnFS M_InstnRD -#define S_InstnFD S_InstnSA -#define M_InstnFD M_InstnSA +#define S_InstnFmt S_InstnRS +#define M_InstnFmt M_InstnRS +#define S_InstnFT S_InstnRT +#define M_InstnFT M_InstnRT +#define S_InstnFS S_InstnRD +#define M_InstnFS M_InstnRD +#define S_InstnFD S_InstnSA +#define M_InstnFD M_InstnSA /* * FP R-Type (cpu <-> cpu data movement)) @@ -122,8 +122,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnSub S_InstnRS -#define M_InstnSub M_InstnRS +#define S_InstnSub S_InstnRS +#define M_InstnSub M_InstnRS /* * FP R-Type (compare) @@ -137,10 +137,10 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnCCcmp 8 -#define M_InstnCCcmp (0x7 << S_InstnCCcmp) -#define S_InstnCABS 6 -#define M_InstnCABS (0x1 << S_InstnCABS) +#define S_InstnCCcmp 8 +#define M_InstnCCcmp (0x7 << S_InstnCCcmp) +#define S_InstnCABS 6 +#define M_InstnCABS (0x1 << S_InstnCABS) /* * FP R-Type (FPR conditional move on FP cc) @@ -153,12 +153,12 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnCC 18 -#define M_InstnCC (0x7 << S_InstnCC) -#define S_InstnND 17 -#define M_InstnND (0x1 << S_InstnND) -#define S_InstnTF 16 -#define M_InstnTF (0x1 << S_InstnTF) +#define S_InstnCC 18 +#define M_InstnCC (0x7 << S_InstnCC) +#define S_InstnND 17 +#define M_InstnND (0x1 << S_InstnND) +#define S_InstnTF 16 +#define M_InstnTF (0x1 << S_InstnTF) /* * FP R-Type (3-operand operate) @@ -170,12 +170,12 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnFR S_InstnRS -#define M_InstnFR M_InstnRS -#define S_InstnOp4 3 -#define M_InstnOp4 (0x7 << S_InstnOp4) -#define S_InstnFmt3 0 -#define M_InstnFmt3 (0x7 << S_InstnFmt3) +#define S_InstnFR S_InstnRS +#define M_InstnFR M_InstnRS +#define S_InstnOp4 3 +#define M_InstnOp4 (0x7 << S_InstnOp4) +#define S_InstnFmt3 0 +#define M_InstnFmt3 (0x7 << S_InstnFmt3) /* * FP R-Type (Indexed load, store) @@ -196,8 +196,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define S_InstnHintX S_InstnRD -#define M_InstnHintX M_InstnRD +#define S_InstnHintX S_InstnRD +#define M_InstnHintX M_InstnRD /* * FP R-Type (GPR conditional move on FP cc) @@ -239,19 +239,19 @@ */ #ifdef MIPSADDR64 -#define A_K0BASE UNS64Const(0xffffffff80000000) -#define A_K1BASE UNS64Const(0xffffffffa0000000) -#define A_K2BASE UNS64Const(0xffffffffc0000000) -#define A_K3BASE UNS64Const(0xffffffffe0000000) -#define A_REGION UNS64Const(0xc000000000000000) -#define A_XKPHYS_ATTR UNS64Const(0x3800000000000000) +#define A_K0BASE UNS64Const(0xffffffff80000000) +#define A_K1BASE UNS64Const(0xffffffffa0000000) +#define A_K2BASE UNS64Const(0xffffffffc0000000) +#define A_K3BASE UNS64Const(0xffffffffe0000000) +#define A_REGION UNS64Const(0xc000000000000000) +#define A_XKPHYS_ATTR UNS64Const(0x3800000000000000) #else -#define A_K0BASE 0x80000000 -#define A_K1BASE 0xa0000000 -#define A_K2BASE 0xc0000000 -#define A_K3BASE 0xe0000000 +#define A_K0BASE 0x80000000 +#define A_K1BASE 0xa0000000 +#define A_K2BASE 0xc0000000 +#define A_K3BASE 0xe0000000 #endif -#define M_KMAPPED 0x40000000 /* KnSEG address is mapped if bit is one */ +#define M_KMAPPED 0x40000000 /* KnSEG address is mapped if bit is one */ #ifdef MIPS_Model64 @@ -352,41 +352,41 @@ /* * Cache encodings */ -#define K_CachePriI 0 /* Primary Icache */ -#define K_CachePriD 1 /* Primary Dcache */ -#define K_CachePriU 1 /* Unified primary */ -#define K_CacheTerU 2 /* Unified Tertiary */ -#define K_CacheSecU 3 /* Unified secondary */ +#define K_CachePriI 0 /* Primary Icache */ +#define K_CachePriD 1 /* Primary Dcache */ +#define K_CachePriU 1 /* Unified primary */ +#define K_CacheTerU 2 /* Unified Tertiary */ +#define K_CacheSecU 3 /* Unified secondary */ /* * Function encodings */ -#define S_CacheFunc 2 /* Amount to shift function encoding within 5-bit field */ -#define K_CacheIndexInv 0 /* Index invalidate */ -#define K_CacheIndexWBInv 0 /* Index writeback invalidate */ -#define K_CacheIndexLdTag 1 /* Index load tag */ -#define K_CacheIndexStTag 2 /* Index store tag */ -#define K_CacheHitInv 4 /* Hit Invalidate */ -#define K_CacheFill 5 /* Fill (Icache only) */ -#define K_CacheHitWBInv 5 /* Hit writeback invalidate */ -#define K_CacheHitWB 6 /* Hit writeback */ -#define K_CacheFetchLock 7 /* Fetch and lock */ - -#define ICIndexInv ((K_CacheIndexInv << S_CacheFunc) | K_CachePriI) -#define DCIndexWBInv ((K_CacheIndexWBInv << S_CacheFunc) | K_CachePriD) -#define DCIndexInv DCIndexWBInv -#define ICIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriI) -#define DCIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriD) -#define ICIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriI) -#define DCIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriD) -#define ICHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriI) -#define DCHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriD) -#define ICFill ((K_CacheFill << S_CacheFunc) | K_CachePriI) -#define DCHitWBInv ((K_CacheHitWBInv << S_CacheFunc) | K_CachePriD) -#define DCHitWB ((K_CacheHitWB << S_CacheFunc) | K_CachePriD) -#define ICFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriI) -#define DCFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriD) +#define S_CacheFunc 2 /* Amount to shift function encoding within 5-bit field */ +#define K_CacheIndexInv 0 /* Index invalidate */ +#define K_CacheIndexWBInv 0 /* Index writeback invalidate */ +#define K_CacheIndexLdTag 1 /* Index load tag */ +#define K_CacheIndexStTag 2 /* Index store tag */ +#define K_CacheHitInv 4 /* Hit Invalidate */ +#define K_CacheFill 5 /* Fill (Icache only) */ +#define K_CacheHitWBInv 5 /* Hit writeback invalidate */ +#define K_CacheHitWB 6 /* Hit writeback */ +#define K_CacheFetchLock 7 /* Fetch and lock */ + +#define ICIndexInv ((K_CacheIndexInv << S_CacheFunc) | K_CachePriI) +#define DCIndexWBInv ((K_CacheIndexWBInv << S_CacheFunc) | K_CachePriD) +#define DCIndexInv DCIndexWBInv +#define ICIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriI) +#define DCIndexLdTag ((K_CacheIndexLdTag << S_CacheFunc) | K_CachePriD) +#define ICIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriI) +#define DCIndexStTag ((K_CacheIndexStTag << S_CacheFunc) | K_CachePriD) +#define ICHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriI) +#define DCHitInv ((K_CacheHitInv << S_CacheFunc) | K_CachePriD) +#define ICFill ((K_CacheFill << S_CacheFunc) | K_CachePriI) +#define DCHitWBInv ((K_CacheHitWBInv << S_CacheFunc) | K_CachePriD) +#define DCHitWB ((K_CacheHitWB << S_CacheFunc) | K_CachePriD) +#define ICFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriI) +#define DCFetchLock ((K_CacheFetchLock << S_CacheFunc) | K_CachePriD) /* @@ -395,14 +395,14 @@ ************************************************************************* */ -#define PrefLoad 0 -#define PrefStore 1 -#define PrefLoadStreamed 4 -#define PrefStoreStreamed 5 -#define PrefLoadRetained 6 -#define PrefStoreRetained 7 -#define PrefWBInval 25 -#define PrefNudge 25 +#define PrefLoad 0 +#define PrefStore 1 +#define PrefLoadStreamed 4 +#define PrefStoreStreamed 5 +#define PrefLoadRetained 6 +#define PrefStoreRetained 7 +#define PrefWBInval 25 +#define PrefNudge 25 /* @@ -418,38 +418,38 @@ ************************************************************************* */ #ifdef __ASSEMBLY__ -#define zero $0 -#define AT $1 -#define v0 $2 -#define v1 $3 -#define a0 $4 -#define a1 $5 -#define a2 $6 -#define a3 $7 -#define t0 $8 -#define t1 $9 -#define t2 $10 -#define t3 $11 -#define t4 $12 -#define t5 $13 -#define t6 $14 -#define t7 $15 -#define s0 $16 -#define s1 $17 -#define s2 $18 -#define s3 $19 -#define s4 $20 -#define s5 $21 -#define s6 $22 -#define s7 $23 -#define t8 $24 -#define t9 $25 -#define k0 $26 -#define k1 $27 -#define gp $28 -#define sp $29 -#define fp $30 -#define ra $31 +#define zero $0 +#define AT $1 +#define v0 $2 +#define v1 $3 +#define a0 $4 +#define a1 $5 +#define a2 $6 +#define a3 $7 +#define t0 $8 +#define t1 $9 +#define t2 $10 +#define t3 $11 +#define t4 $12 +#define t5 $13 +#define t6 $14 +#define t7 $15 +#define s0 $16 +#define s1 $17 +#define s2 $18 +#define s3 $19 +#define s4 $20 +#define s5 $21 +#define s6 $22 +#define s7 $23 +#define t8 $24 +#define t9 $25 +#define k0 $26 +#define k1 $27 +#define gp $28 +#define sp $29 +#define fp $30 +#define ra $31 /* * The following registers are used by the AVP environment and @@ -457,8 +457,8 @@ */ #ifdef MIPSAVPENV -#define repc $25 /* Expected exception PC */ -#define tid $30 /* Current test case address */ +#define repc $25 /* Expected exception PC */ +#define tid $30 /* Current test case address */ #endif @@ -472,53 +472,53 @@ * Removing them causes assembly rather than runtime errors for tests that * use the `r' names. * - * - r25 (repc) is used as the expected PC on an exception - * - r26-r27 (k0, k1) are used in the exception handler - * - r30 (tid) is used as the current test address - */ - -#define r0 $0 -#define r1 $1 -#define r2 $2 -#define r3 $3 -#define r4 $4 -#define r5 $5 -#define r6 $6 -#define r7 $7 -#define r8 $8 -#define r9 $9 -#define r10 $10 -#define r11 $11 -#define r12 $12 -#define r13 $13 -#define r14 $14 -#define r15 $15 -#define r16 $16 -#define r17 $17 -#define r18 $18 -#define r19 $19 -#define r20 $20 -#define r21 $21 -#define r22 $22 -#define r23 $23 -#define r24 $24 + * - r25 (repc) is used as the expected PC on an exception + * - r26-r27 (k0, k1) are used in the exception handler + * - r30 (tid) is used as the current test address + */ + +#define r0 $0 +#define r1 $1 +#define r2 $2 +#define r3 $3 +#define r4 $4 +#define r5 $5 +#define r6 $6 +#define r7 $7 +#define r8 $8 +#define r9 $9 +#define r10 $10 +#define r11 $11 +#define r12 $12 +#define r13 $13 +#define r14 $14 +#define r15 $15 +#define r16 $16 +#define r17 $17 +#define r18 $18 +#define r19 $19 +#define r20 $20 +#define r21 $21 +#define r22 $22 +#define r23 $23 +#define r24 $24 #ifdef MIPSAVPENV -#define r25 r25_unknown -#define r26 r26_unknown -#define r27 r27_unknown +#define r25 r25_unknown +#define r26 r26_unknown +#define r27 r27_unknown #else -#define r25 $25 -#define r26 $26 -#define r27 $27 +#define r25 $25 +#define r26 $26 +#define r27 $27 #endif -#define r28 $28 -#define r29 $29 +#define r28 $28 +#define r29 $29 #ifdef MIPSAVPENV -#define r30 r30_unknown +#define r30 r30_unknown #else -#define r30 $30 +#define r30 $30 #endif -#define r31 $31 +#define r31 $31 #endif @@ -531,40 +531,40 @@ * to the assembler register name ($n). */ -#define R_r0 0 -#define R_r1 1 -#define R_r2 2 -#define R_r3 3 -#define R_r4 4 -#define R_r5 5 -#define R_r6 6 -#define R_r7 7 -#define R_r8 8 -#define R_r9 9 -#define R_r10 10 -#define R_r11 11 -#define R_r12 12 -#define R_r13 13 -#define R_r14 14 -#define R_r15 15 -#define R_r16 16 -#define R_r17 17 -#define R_r18 18 -#define R_r19 19 -#define R_r20 20 -#define R_r21 21 -#define R_r22 22 -#define R_r23 23 -#define R_r24 24 -#define R_r25 25 -#define R_r26 26 -#define R_r27 27 -#define R_r28 28 -#define R_r29 29 -#define R_r30 30 -#define R_r31 31 -#define R_hi 32 /* Hi register */ -#define R_lo 33 /* Lo register */ +#define R_r0 0 +#define R_r1 1 +#define R_r2 2 +#define R_r3 3 +#define R_r4 4 +#define R_r5 5 +#define R_r6 6 +#define R_r7 7 +#define R_r8 8 +#define R_r9 9 +#define R_r10 10 +#define R_r11 11 +#define R_r12 12 +#define R_r13 13 +#define R_r14 14 +#define R_r15 15 +#define R_r16 16 +#define R_r17 17 +#define R_r18 18 +#define R_r19 19 +#define R_r20 20 +#define R_r21 21 +#define R_r22 22 +#define R_r23 23 +#define R_r24 24 +#define R_r25 25 +#define R_r26 26 +#define R_r27 27 +#define R_r28 28 +#define R_r29 29 +#define R_r30 30 +#define R_r31 31 +#define R_hi 32 /* Hi register */ +#define R_lo 33 /* Lo register */ /* @@ -575,37 +575,37 @@ * These definitions provide the bit mask corresponding to the GPR number */ -#define M_AT (1<<1) -#define M_v0 (1<<2) -#define M_v1 (1<<3) -#define M_a0 (1<<4) -#define M_a1 (1<<5) -#define M_a2 (1<<6) -#define M_a3 (1<<7) -#define M_t0 (1<<8) -#define M_t1 (1<<9) -#define M_t2 (1<<10) -#define M_t3 (1<<11) -#define M_t4 (1<<12) -#define M_t5 (1<<13) -#define M_t6 (1<<14) -#define M_t7 (1<<15) -#define M_s0 (1<<16) -#define M_s1 (1<<17) -#define M_s2 (1<<18) -#define M_s3 (1<<19) -#define M_s4 (1<<20) -#define M_s5 (1<<21) -#define M_s6 (1<<22) -#define M_s7 (1<<23) -#define M_t8 (1<<24) -#define M_t9 (1<<25) -#define M_k0 (1<<26) -#define M_k1 (1<<27) -#define M_gp (1<<28) -#define M_sp (1<<29) -#define M_fp (1<<30) -#define M_ra (1<<31) +#define M_AT (1<<1) +#define M_v0 (1<<2) +#define M_v1 (1<<3) +#define M_a0 (1<<4) +#define M_a1 (1<<5) +#define M_a2 (1<<6) +#define M_a3 (1<<7) +#define M_t0 (1<<8) +#define M_t1 (1<<9) +#define M_t2 (1<<10) +#define M_t3 (1<<11) +#define M_t4 (1<<12) +#define M_t5 (1<<13) +#define M_t6 (1<<14) +#define M_t7 (1<<15) +#define M_s0 (1<<16) +#define M_s1 (1<<17) +#define M_s2 (1<<18) +#define M_s3 (1<<19) +#define M_s4 (1<<20) +#define M_s5 (1<<21) +#define M_s6 (1<<22) +#define M_s7 (1<<23) +#define M_t8 (1<<24) +#define M_t9 (1<<25) +#define M_k0 (1<<26) +#define M_k1 (1<<27) +#define M_gp (1<<28) +#define M_sp (1<<29) +#define M_fp (1<<30) +#define M_ra (1<<31) /* @@ -614,16 +614,16 @@ ************************************************************************* * Each register has the following definitions: * - * C0_rrr The register number (as a $n value) - * R_C0_rrr The register index (as an integer corresponding - * to the register number) + * C0_rrr The register number (as a $n value) + * R_C0_rrr The register index (as an integer corresponding + * to the register number) * * Each field in a register has the following definitions: * - * S_rrrfff The shift count required to right-justify - * the field. This corresponds to the bit - * number of the right-most bit in the field. - * M_rrrfff The Mask required to isolate the field. + * S_rrrfff The shift count required to right-justify + * the field. This corresponds to the bit + * number of the right-most bit in the field. + * M_rrrfff The Mask required to isolate the field. * * Register diagrams included below as comments correspond to the * MIPS32 and MIPS64 architecture specifications. Refer to other @@ -643,18 +643,18 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Index $0 -#define R_C0_Index 0 -#define C0_INX C0_Index /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Index $0 +#define R_C0_Index 0 +#define C0_INX C0_Index /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_IndexP 31 /* Probe failure (R)*/ -#define M_IndexP (0x1 << S_IndexP) +#define S_IndexP 31 /* Probe failure (R)*/ +#define M_IndexP (0x1 << S_IndexP) -#define S_IndexIndex 0 /* TLB index (R/W)*/ -#define M_IndexIndex (0x3f << S_IndexIndex) +#define S_IndexIndex 0 /* TLB index (R/W)*/ +#define M_IndexIndex (0x3f << S_IndexIndex) -#define M_Index0Fields 0x7fffffc0 -#define M_IndexRFields 0x80000000 +#define M_Index0Fields 0x7fffffc0 +#define M_IndexRFields 0x80000000 /* @@ -669,15 +669,15 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Random $1 -#define R_C0_Random 1 -#define C0_RAND $1 /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Random $1 +#define R_C0_Random 1 +#define C0_RAND $1 /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_RandomIndex 0 /* TLB random index (R)*/ -#define M_RandomIndex (0x3f << S_RandomIndex) +#define S_RandomIndex 0 /* TLB random index (R)*/ +#define M_RandomIndex (0x3f << S_RandomIndex) -#define M_Random0Fields 0xffffffc0 -#define M_RandomRFields 0x0000003f +#define M_Random0Fields 0xffffffc0 +#define M_RandomRFields 0x0000003f /* @@ -692,42 +692,42 @@ * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_EntryLo0 $2 -#define R_C0_EntryLo0 2 -#define C0_TLBLO_0 C0_EntryLo0 /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_EntryLo0 $2 +#define R_C0_EntryLo0 2 +#define C0_TLBLO_0 C0_EntryLo0 /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_EntryLoPFN 6 /* PFN (R/W) */ -#define M_EntryLoPFN (0xffffff << S_EntryLoPFN) -#define S_EntryLoC 3 /* Coherency attribute (R/W) */ -#define M_EntryLoC (0x7 << S_EntryLoC) -#define S_EntryLoD 2 /* Dirty (R/W) */ -#define M_EntryLoD (0x1 << S_EntryLoD) -#define S_EntryLoV 1 /* Valid (R/W) */ -#define M_EntryLoV (0x1 << S_EntryLoV) -#define S_EntryLoG 0 /* Global (R/W) */ -#define M_EntryLoG (0x1 << S_EntryLoG) -#define M_EntryLoOddPFN (0x1 << S_EntryLoPFN) /* Odd PFN bit */ -#define S_EntryLo_RS K_PageAlign /* Right-justify PFN */ -#define S_EntryLo_LS S_EntryLoPFN /* Position PFN to appropriate position */ +#define S_EntryLoPFN 6 /* PFN (R/W) */ +#define M_EntryLoPFN (0xffffff << S_EntryLoPFN) +#define S_EntryLoC 3 /* Coherency attribute (R/W) */ +#define M_EntryLoC (0x7 << S_EntryLoC) +#define S_EntryLoD 2 /* Dirty (R/W) */ +#define M_EntryLoD (0x1 << S_EntryLoD) +#define S_EntryLoV 1 /* Valid (R/W) */ +#define M_EntryLoV (0x1 << S_EntryLoV) +#define S_EntryLoG 0 /* Global (R/W) */ +#define M_EntryLoG (0x1 << S_EntryLoG) +#define M_EntryLoOddPFN (0x1 << S_EntryLoPFN) /* Odd PFN bit */ +#define S_EntryLo_RS K_PageAlign /* Right-justify PFN */ +#define S_EntryLo_LS S_EntryLoPFN /* Position PFN to appropriate position */ -#define M_EntryLo0Fields 0x00000000 -#define M_EntryLoRFields 0xc0000000 -#define M_EntryLo0Fields64 UNS64Const(0x0000000000000000) -#define M_EntryLoRFields64 UNS64Const(0xffffffffc0000000) +#define M_EntryLo0Fields 0x00000000 +#define M_EntryLoRFields 0xc0000000 +#define M_EntryLo0Fields64 UNS64Const(0x0000000000000000) +#define M_EntryLoRFields64 UNS64Const(0xffffffffc0000000) /* * Cache attribute values in the C field of EntryLo and the * K0 field of Config */ -#define K_CacheAttrCWTnWA 0 /* Cacheable, write-thru, no write allocate */ -#define K_CacheAttrCWTWA 1 /* Cacheable, write-thru, write allocate */ -#define K_CacheAttrU 2 /* Uncached */ -#define K_CacheAttrC 3 /* Cacheable */ -#define K_CacheAttrCN 3 /* Cacheable, non-coherent */ -#define K_CacheAttrCCE 4 /* Cacheable, coherent, exclusive */ -#define K_CacheAttrCCS 5 /* Cacheable, coherent, shared */ -#define K_CacheAttrCCU 6 /* Cacheable, coherent, update */ -#define K_CacheAttrUA 7 /* Uncached accelerated */ +#define K_CacheAttrCWTnWA 0 /* Cacheable, write-thru, no write allocate */ +#define K_CacheAttrCWTWA 1 /* Cacheable, write-thru, write allocate */ +#define K_CacheAttrU 2 /* Uncached */ +#define K_CacheAttrC 3 /* Cacheable */ +#define K_CacheAttrCN 3 /* Cacheable, non-coherent */ +#define K_CacheAttrCCE 4 /* Cacheable, coherent, exclusive */ +#define K_CacheAttrCCS 5 /* Cacheable, coherent, shared */ +#define K_CacheAttrCCU 6 /* Cacheable, coherent, update */ +#define K_CacheAttrUA 7 /* Uncached accelerated */ /* @@ -742,9 +742,9 @@ * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_EntryLo1 $3 -#define R_C0_EntryLo1 3 -#define C0_TLBLO_1 C0_EntryLo1 /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_EntryLo1 $3 +#define R_C0_EntryLo1 3 +#define C0_TLBLO_1 C0_EntryLo1 /* OBSOLETE - DO NOT USE IN NEW CODE */ /* * Field definitions are as given for EntryLo0 above @@ -763,21 +763,21 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Context $4 -#define R_C0_Context 4 -#define C0_CTXT C0_Context /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Context $4 +#define R_C0_Context 4 +#define C0_CTXT C0_Context /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_ContextPTEBase 23 /* PTE base (R/W) */ -#define M_ContextPTEBase (0x1ff << S_ContextPTEBase) -#define S_ContextBadVPN 4 /* BadVPN2 (R) */ -#define M_ContextBadVPN (0x7ffff << S_ContextBadVPN) -#define S_ContextBadVPN_LS 9 /* Position BadVPN to bit 31 */ -#define S_ContextBadVPN_RS 13 /* Right-justify shifted BadVPN field */ +#define S_ContextPTEBase 23 /* PTE base (R/W) */ +#define M_ContextPTEBase (0x1ff << S_ContextPTEBase) +#define S_ContextBadVPN 4 /* BadVPN2 (R) */ +#define M_ContextBadVPN (0x7ffff << S_ContextBadVPN) +#define S_ContextBadVPN_LS 9 /* Position BadVPN to bit 31 */ +#define S_ContextBadVPN_RS 13 /* Right-justify shifted BadVPN field */ -#define M_Context0Fields 0x0000000f -#define M_ContextRFields 0x007ffff0 -#define M_Context0Fields64 UNS64Const(0x000000000000000f) -#define M_ContextRFields64 UNS64Const(0x00000000007ffff0) +#define M_Context0Fields 0x0000000f +#define M_ContextRFields 0x007ffff0 +#define M_Context0Fields64 UNS64Const(0x000000000000000f) +#define M_ContextRFields64 UNS64Const(0x00000000007ffff0) /* @@ -792,34 +792,34 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_PageMask $5 -#define R_C0_PageMask 5 /* Mask (R/W) */ -#define C0_PGMASK C0_PageMask /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_PageMask $5 +#define R_C0_PageMask 5 /* Mask (R/W) */ +#define C0_PGMASK C0_PageMask /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_PageMaskMask 13 -#define M_PageMaskMask (0xfff << S_PageMaskMask) +#define S_PageMaskMask 13 +#define M_PageMaskMask (0xfff << S_PageMaskMask) -#define M_PageMask0Fields 0xfe001fff -#define M_PageMaskRFields 0x00000000 +#define M_PageMask0Fields 0xfe001fff +#define M_PageMaskRFields 0x00000000 /* * Values in the Mask field */ -#define K_PageMask4K 0x000 /* K_PageMasknn values are values for use */ -#define K_PageMask16K 0x003 /* with KReqPageAttributes or KReqPageMask macros */ -#define K_PageMask64K 0x00f -#define K_PageMask256K 0x03f -#define K_PageMask1M 0x0ff -#define K_PageMask4M 0x3ff -#define K_PageMask16M 0xfff +#define K_PageMask4K 0x000 /* K_PageMasknn values are values for use */ +#define K_PageMask16K 0x003 /* with KReqPageAttributes or KReqPageMask macros */ +#define K_PageMask64K 0x00f +#define K_PageMask256K 0x03f +#define K_PageMask1M 0x0ff +#define K_PageMask4M 0x3ff +#define K_PageMask16M 0xfff -#define M_PageMask4K (K_PageMask4K << S_PageMaskMask) /* M_PageMasknn values are masks */ -#define M_PageMask16K (K_PageMask16K << S_PageMaskMask) /* in position in the PageMask register */ -#define M_PageMask64K (K_PageMask64K << S_PageMaskMask) -#define M_PageMask256K (K_PageMask256K << S_PageMaskMask) -#define M_PageMask1M (K_PageMask1M << S_PageMaskMask) -#define M_PageMask4M (K_PageMask4M << S_PageMaskMask) -#define M_PageMask16M (K_PageMask16M << S_PageMaskMask) +#define M_PageMask4K (K_PageMask4K << S_PageMaskMask) /* M_PageMasknn values are masks */ +#define M_PageMask16K (K_PageMask16K << S_PageMaskMask) /* in position in the PageMask register */ +#define M_PageMask64K (K_PageMask64K << S_PageMaskMask) +#define M_PageMask256K (K_PageMask256K << S_PageMaskMask) +#define M_PageMask1M (K_PageMask1M << S_PageMaskMask) +#define M_PageMask4M (K_PageMask4M << S_PageMaskMask) +#define M_PageMask16M (K_PageMask16M << S_PageMaskMask) /* @@ -834,15 +834,15 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Wired $6 -#define R_C0_Wired 6 -#define C0_TLBWIRED C0_Wired /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Wired $6 +#define R_C0_Wired 6 +#define C0_TLBWIRED C0_Wired /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_WiredIndex 0 /* TLB wired boundary (R/W) */ -#define M_WiredIndex (0x3f << S_WiredIndex) +#define S_WiredIndex 0 /* TLB wired boundary (R/W) */ +#define M_WiredIndex (0x3f << S_WiredIndex) -#define M_Wired0Fields 0xffffffc0 -#define M_WiredRFields 0x00000000 +#define M_Wired0Fields 0xffffffc0 +#define M_WiredRFields 0x00000000 /* @@ -857,16 +857,16 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_BadVAddr $8 -#define R_C0_BadVAddr 8 -#define C0_BADVADDR C0_BadVAddr /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_BadVAddr $8 +#define R_C0_BadVAddr 8 +#define C0_BADVADDR C0_BadVAddr /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_BadVAddrOddPage K_PageSize /* Even/Odd VA bit for pair of PAs */ +#define M_BadVAddrOddPage K_PageSize /* Even/Odd VA bit for pair of PAs */ -#define M_BadVAddr0Fields 0x00000000 -#define M_BadVAddrRFields 0xffffffff -#define M_BadVAddr0Fields64 UNS64Const(0x0000000000000000) -#define M_BadVAddrRFields64 UNS64Const(0xffffffffffffffff) +#define M_BadVAddr0Fields 0x00000000 +#define M_BadVAddrRFields 0xffffffff +#define M_BadVAddr0Fields64 UNS64Const(0x0000000000000000) +#define M_BadVAddrRFields64 UNS64Const(0xffffffffffffffff) /* ************************************************************************ @@ -880,12 +880,12 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Count $9 -#define R_C0_Count 9 -#define C0_COUNT C0_Count /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Count $9 +#define R_C0_Count 9 +#define C0_COUNT C0_Count /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_Count0Fields 0x00000000 -#define M_CountRFields 0x00000000 +#define M_Count0Fields 0x00000000 +#define M_CountRFields 0x00000000 /* @@ -900,23 +900,23 @@ * +-+-+-+-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_EntryHi $10 -#define R_C0_EntryHi 10 -#define C0_TLBHI C0_EntryHi /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_EntryHi $10 +#define R_C0_EntryHi 10 +#define C0_TLBHI C0_EntryHi /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_EntryHiR64 62 /* Region (R/W) */ -#define M_EntryHiR64 UNS64Const(0xc000000000000000) -#define S_EntryHiVPN2 13 /* VPN/2 (R/W) */ -#define M_EntryHiVPN2 (0x7ffff << S_EntryHiVPN2) -#define M_EntryHiVPN264 UNS64Const(0x000000ffffffe000) -#define S_EntryHiASID 0 /* ASID (R/W) */ -#define M_EntryHiASID (0xff << S_EntryHiASID) -#define S_EntryHiVPN_Shf S_EntryHiVPN2 +#define S_EntryHiR64 62 /* Region (R/W) */ +#define M_EntryHiR64 UNS64Const(0xc000000000000000) +#define S_EntryHiVPN2 13 /* VPN/2 (R/W) */ +#define M_EntryHiVPN2 (0x7ffff << S_EntryHiVPN2) +#define M_EntryHiVPN264 UNS64Const(0x000000ffffffe000) +#define S_EntryHiASID 0 /* ASID (R/W) */ +#define M_EntryHiASID (0xff << S_EntryHiASID) +#define S_EntryHiVPN_Shf S_EntryHiVPN2 -#define M_EntryHi0Fields 0x00001f00 -#define M_EntryHiRFields 0x00000000 -#define M_EntryHi0Fields64 UNS64Const(0x0000000000001f00) -#define M_EntryHiRFields64 UNS64Const(0x3fffff0000000000) +#define M_EntryHi0Fields 0x00001f00 +#define M_EntryHiRFields 0x00000000 +#define M_EntryHi0Fields64 UNS64Const(0x0000000000001f00) +#define M_EntryHiRFields64 UNS64Const(0x3fffff0000000000) /* @@ -931,12 +931,12 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Compare $11 -#define R_C0_Compare 11 -#define C0_COMPARE C0_Compare /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Compare $11 +#define R_C0_Compare 11 +#define C0_COMPARE C0_Compare /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_Compare0Fields 0x00000000 -#define M_CompareRFields 0x00000000 +#define M_Compare0Fields 0x00000000 +#define M_CompareRFields 0x00000000 /* @@ -953,86 +953,86 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Status $12 -#define R_C0_Status 12 -#define C0_SR C0_Status /* OBSOLETE - DO NOT USE IN NEW CODE */ - -#define S_StatusCU 28 /* Coprocessor enable (R/W) */ -#define M_StatusCU (0xf << S_StatusCU) -#define S_StatusCU3 31 -#define M_StatusCU3 (0x1 << S_StatusCU3) -#define S_StatusCU2 30 -#define M_StatusCU2 (0x1 << S_StatusCU2) -#define S_StatusCU1 29 -#define M_StatusCU1 (0x1 << S_StatusCU1) -#define S_StatusCU0 28 -#define M_StatusCU0 (0x1 << S_StatusCU0) -#define S_StatusRP 27 /* Enable reduced power mode (R/W) */ -#define M_StatusRP (0x1 << S_StatusRP) -#define S_StatusFR 26 /* Enable 64-bit FPRs (MIPS64 only) (R/W) */ -#define M_StatusFR (0x1 << S_StatusFR) -#define S_StatusRE 25 /* Enable reverse endian (R/W) */ -#define M_StatusRE (0x1 << S_StatusRE) -#define S_StatusMX 24 /* Enable access to MDMX resources (MIPS64 only) (R/W) */ -#define M_StatusMX (0x1 << S_StatusMX) -#define S_StatusPX 23 /* Enable access to 64-bit instructions/data (MIPS64 only) (R/W) */ -#define M_StatusPX (0x1 << S_StatusPX) -#define S_StatusBEV 22 /* Enable Boot Exception Vectors (R/W) */ -#define M_StatusBEV (0x1 << S_StatusBEV) -#define S_StatusTS 21 /* Denote TLB shutdown (R/W) */ -#define M_StatusTS (0x1 << S_StatusTS) -#define S_StatusSR 20 /* Denote soft reset (R/W) */ -#define M_StatusSR (0x1 << S_StatusSR) -#define S_StatusNMI 19 -#define M_StatusNMI (0x1 << S_StatusNMI) /* Denote NMI (R/W) */ -#define S_StatusIM 8 /* Interrupt mask (R/W) */ -#define M_StatusIM (0xff << S_StatusIM) -#define S_StatusIM7 15 -#define M_StatusIM7 (0x1 << S_StatusIM7) -#define S_StatusIM6 14 -#define M_StatusIM6 (0x1 << S_StatusIM6) -#define S_StatusIM5 13 -#define M_StatusIM5 (0x1 << S_StatusIM5) -#define S_StatusIM4 12 -#define M_StatusIM4 (0x1 << S_StatusIM4) -#define S_StatusIM3 11 -#define M_StatusIM3 (0x1 << S_StatusIM3) -#define S_StatusIM2 10 -#define M_StatusIM2 (0x1 << S_StatusIM2) -#define S_StatusIM1 9 -#define M_StatusIM1 (0x1 << S_StatusIM1) -#define S_StatusIM0 8 -#define M_StatusIM0 (0x1 << S_StatusIM0) -#define S_StatusKX 7 /* Enable access to extended kernel addresses (MIPS64 only) (R/W) */ -#define M_StatusKX (0x1 << S_StatusKX) -#define S_StatusSX 6 /* Enable access to extended supervisor addresses (MIPS64 only) (R/W) */ -#define M_StatusSX (0x1 << S_StatusSX) -#define S_StatusUX 5 /* Enable access to extended user addresses (MIPS64 only) (R/W) */ -#define M_StatusUX (0x1 << S_StatusUX) -#define S_StatusKSU 3 /* Two-bit current mode (R/W) */ -#define M_StatusKSU (0x3 << S_StatusKSU) -#define S_StatusUM 4 /* User mode if supervisor mode not implemented (R/W) */ -#define M_StatusUM (0x1 << S_StatusUM) -#define S_StatusSM 3 /* Supervisor mode (R/W) */ -#define M_StatusSM (0x1 << S_StatusSM) -#define S_StatusERL 2 /* Denotes error level (R/W) */ -#define M_StatusERL (0x1 << S_StatusERL) -#define S_StatusEXL 1 /* Denotes exception level (R/W) */ -#define M_StatusEXL (0x1 << S_StatusEXL) -#define S_StatusIE 0 /* Enables interrupts (R/W) */ -#define M_StatusIE (0x1 << S_StatusIE) - -#define M_Status0Fields 0x00040000 -#define M_StatusRFields 0x058000e0 /* FR, MX, PX, KX, SX, UX unused in MIPS32 */ -#define M_Status0Fields64 0x00040000 -#define M_StatusRFields64 0x00000000 +#define C0_Status $12 +#define R_C0_Status 12 +#define C0_SR C0_Status /* OBSOLETE - DO NOT USE IN NEW CODE */ + +#define S_StatusCU 28 /* Coprocessor enable (R/W) */ +#define M_StatusCU (0xf << S_StatusCU) +#define S_StatusCU3 31 +#define M_StatusCU3 (0x1 << S_StatusCU3) +#define S_StatusCU2 30 +#define M_StatusCU2 (0x1 << S_StatusCU2) +#define S_StatusCU1 29 +#define M_StatusCU1 (0x1 << S_StatusCU1) +#define S_StatusCU0 28 +#define M_StatusCU0 (0x1 << S_StatusCU0) +#define S_StatusRP 27 /* Enable reduced power mode (R/W) */ +#define M_StatusRP (0x1 << S_StatusRP) +#define S_StatusFR 26 /* Enable 64-bit FPRs (MIPS64 only) (R/W) */ +#define M_StatusFR (0x1 << S_StatusFR) +#define S_StatusRE 25 /* Enable reverse endian (R/W) */ +#define M_StatusRE (0x1 << S_StatusRE) +#define S_StatusMX 24 /* Enable access to MDMX resources (MIPS64 only) (R/W) */ +#define M_StatusMX (0x1 << S_StatusMX) +#define S_StatusPX 23 /* Enable access to 64-bit instructions/data (MIPS64 only) (R/W) */ +#define M_StatusPX (0x1 << S_StatusPX) +#define S_StatusBEV 22 /* Enable Boot Exception Vectors (R/W) */ +#define M_StatusBEV (0x1 << S_StatusBEV) +#define S_StatusTS 21 /* Denote TLB shutdown (R/W) */ +#define M_StatusTS (0x1 << S_StatusTS) +#define S_StatusSR 20 /* Denote soft reset (R/W) */ +#define M_StatusSR (0x1 << S_StatusSR) +#define S_StatusNMI 19 +#define M_StatusNMI (0x1 << S_StatusNMI) /* Denote NMI (R/W) */ +#define S_StatusIM 8 /* Interrupt mask (R/W) */ +#define M_StatusIM (0xff << S_StatusIM) +#define S_StatusIM7 15 +#define M_StatusIM7 (0x1 << S_StatusIM7) +#define S_StatusIM6 14 +#define M_StatusIM6 (0x1 << S_StatusIM6) +#define S_StatusIM5 13 +#define M_StatusIM5 (0x1 << S_StatusIM5) +#define S_StatusIM4 12 +#define M_StatusIM4 (0x1 << S_StatusIM4) +#define S_StatusIM3 11 +#define M_StatusIM3 (0x1 << S_StatusIM3) +#define S_StatusIM2 10 +#define M_StatusIM2 (0x1 << S_StatusIM2) +#define S_StatusIM1 9 +#define M_StatusIM1 (0x1 << S_StatusIM1) +#define S_StatusIM0 8 +#define M_StatusIM0 (0x1 << S_StatusIM0) +#define S_StatusKX 7 /* Enable access to extended kernel addresses (MIPS64 only) (R/W) */ +#define M_StatusKX (0x1 << S_StatusKX) +#define S_StatusSX 6 /* Enable access to extended supervisor addresses (MIPS64 only) (R/W) */ +#define M_StatusSX (0x1 << S_StatusSX) +#define S_StatusUX 5 /* Enable access to extended user addresses (MIPS64 only) (R/W) */ +#define M_StatusUX (0x1 << S_StatusUX) +#define S_StatusKSU 3 /* Two-bit current mode (R/W) */ +#define M_StatusKSU (0x3 << S_StatusKSU) +#define S_StatusUM 4 /* User mode if supervisor mode not implemented (R/W) */ +#define M_StatusUM (0x1 << S_StatusUM) +#define S_StatusSM 3 /* Supervisor mode (R/W) */ +#define M_StatusSM (0x1 << S_StatusSM) +#define S_StatusERL 2 /* Denotes error level (R/W) */ +#define M_StatusERL (0x1 << S_StatusERL) +#define S_StatusEXL 1 /* Denotes exception level (R/W) */ +#define M_StatusEXL (0x1 << S_StatusEXL) +#define S_StatusIE 0 /* Enables interrupts (R/W) */ +#define M_StatusIE (0x1 << S_StatusIE) + +#define M_Status0Fields 0x00040000 +#define M_StatusRFields 0x058000e0 /* FR, MX, PX, KX, SX, UX unused in MIPS32 */ +#define M_Status0Fields64 0x00040000 +#define M_StatusRFields64 0x00000000 /* * Values in the KSU field */ -#define K_StatusKSU_U 2 /* User mode in KSU field */ -#define K_StatusKSU_S 1 /* Supervisor mode in KSU field */ -#define K_StatusKSU_K 0 /* Kernel mode in KSU field */ +#define K_StatusKSU_U 2 /* User mode in KSU field */ +#define K_StatusKSU_S 1 /* Supervisor mode in KSU field */ +#define K_StatusKSU_K 0 /* Kernel mode in KSU field */ /* @@ -1049,101 +1049,101 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Cause $13 -#define R_C0_Cause 13 -#define C0_CAUSE C0_Cause /* OBSOLETE - DO NOT USE IN NEW CODE */ - -#define S_CauseBD 31 -#define M_CauseBD (0x1 << S_CauseBD) -#define S_CauseCE 28 -#define M_CauseCE (0x3<< S_CauseCE) -#define S_CauseIV 23 -#define M_CauseIV (0x1 << S_CauseIV) -#define S_CauseWP 22 -#define M_CauseWP (0x1 << S_CauseWP) -#define S_CauseIP 8 -#define M_CauseIP (0xff << S_CauseIP) -#define S_CauseIPEXT 10 -#define M_CauseIPEXT (0x3f << S_CauseIPEXT) -#define S_CauseIP7 15 -#define M_CauseIP7 (0x1 << S_CauseIP7) -#define S_CauseIP6 14 -#define M_CauseIP6 (0x1 << S_CauseIP6) -#define S_CauseIP5 13 -#define M_CauseIP5 (0x1 << S_CauseIP5) -#define S_CauseIP4 12 -#define M_CauseIP4 (0x1 << S_CauseIP4) -#define S_CauseIP3 11 -#define M_CauseIP3 (0x1 << S_CauseIP3) -#define S_CauseIP2 10 -#define M_CauseIP2 (0x1 << S_CauseIP2) -#define S_CauseIP1 9 -#define M_CauseIP1 (0x1 << S_CauseIP1) -#define S_CauseIP0 8 -#define M_CauseIP0 (0x1 << S_CauseIP0) -#define S_CauseExcCode 2 -#define M_CauseExcCode (0x1f << S_CauseExcCode) - -#define M_Cause0Fields 0x4f3f0083 -#define M_CauseRFields 0xb000fc7c +#define C0_Cause $13 +#define R_C0_Cause 13 +#define C0_CAUSE C0_Cause /* OBSOLETE - DO NOT USE IN NEW CODE */ + +#define S_CauseBD 31 +#define M_CauseBD (0x1 << S_CauseBD) +#define S_CauseCE 28 +#define M_CauseCE (0x3<< S_CauseCE) +#define S_CauseIV 23 +#define M_CauseIV (0x1 << S_CauseIV) +#define S_CauseWP 22 +#define M_CauseWP (0x1 << S_CauseWP) +#define S_CauseIP 8 +#define M_CauseIP (0xff << S_CauseIP) +#define S_CauseIPEXT 10 +#define M_CauseIPEXT (0x3f << S_CauseIPEXT) +#define S_CauseIP7 15 +#define M_CauseIP7 (0x1 << S_CauseIP7) +#define S_CauseIP6 14 +#define M_CauseIP6 (0x1 << S_CauseIP6) +#define S_CauseIP5 13 +#define M_CauseIP5 (0x1 << S_CauseIP5) +#define S_CauseIP4 12 +#define M_CauseIP4 (0x1 << S_CauseIP4) +#define S_CauseIP3 11 +#define M_CauseIP3 (0x1 << S_CauseIP3) +#define S_CauseIP2 10 +#define M_CauseIP2 (0x1 << S_CauseIP2) +#define S_CauseIP1 9 +#define M_CauseIP1 (0x1 << S_CauseIP1) +#define S_CauseIP0 8 +#define M_CauseIP0 (0x1 << S_CauseIP0) +#define S_CauseExcCode 2 +#define M_CauseExcCode (0x1f << S_CauseExcCode) + +#define M_Cause0Fields 0x4f3f0083 +#define M_CauseRFields 0xb000fc7c /* * Values in the CE field */ -#define K_CauseCE0 0 /* Coprocessor 0 in the CE field */ -#define K_CauseCE1 1 /* Coprocessor 1 in the CE field */ -#define K_CauseCE2 2 /* Coprocessor 2 in the CE field */ -#define K_CauseCE3 3 /* Coprocessor 3 in the CE field */ +#define K_CauseCE0 0 /* Coprocessor 0 in the CE field */ +#define K_CauseCE1 1 /* Coprocessor 1 in the CE field */ +#define K_CauseCE2 2 /* Coprocessor 2 in the CE field */ +#define K_CauseCE3 3 /* Coprocessor 3 in the CE field */ /* * Values in the ExcCode field */ -#define EX_INT 0 /* Interrupt */ -#define EXC_INT (EX_INT << S_CauseExcCode) -#define EX_MOD 1 /* TLB modified */ -#define EXC_MOD (EX_MOD << S_CauseExcCode) -#define EX_TLBL 2 /* TLB exception (load or ifetch) */ -#define EXC_TLBL (EX_TLBL << S_CauseExcCode) -#define EX_TLBS 3 /* TLB exception (store) */ -#define EXC_TLBS (EX_TLBS << S_CauseExcCode) -#define EX_ADEL 4 /* Address error (load or ifetch) */ -#define EXC_ADEL (EX_ADEL << S_CauseExcCode) -#define EX_ADES 5 /* Address error (store) */ -#define EXC_ADES (EX_ADES << S_CauseExcCode) -#define EX_IBE 6 /* Instruction Bus Error */ -#define EXC_IBE (EX_IBE << S_CauseExcCode) -#define EX_DBE 7 /* Data Bus Error */ -#define EXC_DBE (EX_DBE << S_CauseExcCode) -#define EX_SYS 8 /* Syscall */ -#define EXC_SYS (EX_SYS << S_CauseExcCode) -#define EX_SYSCALL EX_SYS -#define EXC_SYSCALL EXC_SYS -#define EX_BP 9 /* Breakpoint */ -#define EXC_BP (EX_BP << S_CauseExcCode) -#define EX_BREAK EX_BP -#define EXC_BREAK EXC_BP -#define EX_RI 10 /* Reserved instruction */ -#define EXC_RI (EX_RI << S_CauseExcCode) -#define EX_CPU 11 /* CoProcessor Unusable */ -#define EXC_CPU (EX_CPU << S_CauseExcCode) -#define EX_OV 12 /* OVerflow */ -#define EXC_OV (EX_OV << S_CauseExcCode) -#define EX_TR 13 /* Trap instruction */ -#define EXC_TR (EX_TR << S_CauseExcCode) -#define EX_TRAP EX_TR -#define EXC_TRAP EXC_TR -#define EX_FPE 15 /* floating point exception */ -#define EXC_FPE (EX_FPE << S_CauseExcCode) -#define EX_C2E 18 /* COP2 exception */ -#define EXC_C2E (EX_C2E << S_CauseExcCode) -#define EX_MDMX 22 /* MDMX exception */ -#define EXC_MDMX (EX_MDMX << S_CauseExcCode) -#define EX_WATCH 23 /* Watch exception */ -#define EXC_WATCH (EX_WATCH << S_CauseExcCode) -#define EX_MCHECK 24 /* Machine check exception */ -#define EXC_MCHECK (EX_MCHECK << S_CauseExcCode) -#define EX_CacheErr 30 /* Cache error caused re-entry to Debug Mode */ -#define EXC_CacheErr (EX_CacheErr << S_CauseExcCode) +#define EX_INT 0 /* Interrupt */ +#define EXC_INT (EX_INT << S_CauseExcCode) +#define EX_MOD 1 /* TLB modified */ +#define EXC_MOD (EX_MOD << S_CauseExcCode) +#define EX_TLBL 2 /* TLB exception (load or ifetch) */ +#define EXC_TLBL (EX_TLBL << S_CauseExcCode) +#define EX_TLBS 3 /* TLB exception (store) */ +#define EXC_TLBS (EX_TLBS << S_CauseExcCode) +#define EX_ADEL 4 /* Address error (load or ifetch) */ +#define EXC_ADEL (EX_ADEL << S_CauseExcCode) +#define EX_ADES 5 /* Address error (store) */ +#define EXC_ADES (EX_ADES << S_CauseExcCode) +#define EX_IBE 6 /* Instruction Bus Error */ +#define EXC_IBE (EX_IBE << S_CauseExcCode) +#define EX_DBE 7 /* Data Bus Error */ +#define EXC_DBE (EX_DBE << S_CauseExcCode) +#define EX_SYS 8 /* Syscall */ +#define EXC_SYS (EX_SYS << S_CauseExcCode) +#define EX_SYSCALL EX_SYS +#define EXC_SYSCALL EXC_SYS +#define EX_BP 9 /* Breakpoint */ +#define EXC_BP (EX_BP << S_CauseExcCode) +#define EX_BREAK EX_BP +#define EXC_BREAK EXC_BP +#define EX_RI 10 /* Reserved instruction */ +#define EXC_RI (EX_RI << S_CauseExcCode) +#define EX_CPU 11 /* CoProcessor Unusable */ +#define EXC_CPU (EX_CPU << S_CauseExcCode) +#define EX_OV 12 /* OVerflow */ +#define EXC_OV (EX_OV << S_CauseExcCode) +#define EX_TR 13 /* Trap instruction */ +#define EXC_TR (EX_TR << S_CauseExcCode) +#define EX_TRAP EX_TR +#define EXC_TRAP EXC_TR +#define EX_FPE 15 /* floating point exception */ +#define EXC_FPE (EX_FPE << S_CauseExcCode) +#define EX_C2E 18 /* COP2 exception */ +#define EXC_C2E (EX_C2E << S_CauseExcCode) +#define EX_MDMX 22 /* MDMX exception */ +#define EXC_MDMX (EX_MDMX << S_CauseExcCode) +#define EX_WATCH 23 /* Watch exception */ +#define EXC_WATCH (EX_WATCH << S_CauseExcCode) +#define EX_MCHECK 24 /* Machine check exception */ +#define EXC_MCHECK (EX_MCHECK << S_CauseExcCode) +#define EX_CacheErr 30 /* Cache error caused re-entry to Debug Mode */ +#define EXC_CacheErr (EX_CacheErr << S_CauseExcCode) /* @@ -1158,13 +1158,13 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_EPC $14 -#define R_C0_EPC 14 +#define C0_EPC $14 +#define R_C0_EPC 14 -#define M_EPC0Fields 0x00000000 -#define M_EPCRFields 0x00000000 -#define M_EPC0Fields64 UNS64Const(0x0000000000000000) -#define M_EPCRFields64 UNS64Const(0x0000000000000000) +#define M_EPC0Fields 0x00000000 +#define M_EPCRFields 0x00000000 +#define M_EPC0Fields64 UNS64Const(0x0000000000000000) +#define M_EPCRFields64 UNS64Const(0x0000000000000000) /* ************************************************************************ @@ -1178,25 +1178,25 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_PRId $15 -#define R_C0_PRId 15 -#define C0_PRID C0_PRID /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_PRId $15 +#define R_C0_PRId 15 +#define C0_PRID C0_PRID /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_PRIdCoOpt 24 /* Company options (R) */ -#define M_PRIdCoOpt (0xff << S_PRIdCoOpt) -#define S_PRIdCoID 16 /* Company ID (R) */ -#define M_PRIdCoID (0xff << S_PRIdCoID) -#define S_PRIdImp 8 /* Implementation ID (R) */ -#define M_PRIdImp (0xff << S_PRIdImp) -#define S_PRIdRev 0 /* Revision (R) */ -#define M_PRIdRev (0xff << S_PRIdRev) +#define S_PRIdCoOpt 24 /* Company options (R) */ +#define M_PRIdCoOpt (0xff << S_PRIdCoOpt) +#define S_PRIdCoID 16 /* Company ID (R) */ +#define M_PRIdCoID (0xff << S_PRIdCoID) +#define S_PRIdImp 8 /* Implementation ID (R) */ +#define M_PRIdImp (0xff << S_PRIdImp) +#define S_PRIdRev 0 /* Revision (R) */ +#define M_PRIdRev (0xff << S_PRIdRev) -#define M_PRId0Fields 0x00000000 -#define M_PRIdRFields 0xffffffff +#define M_PRId0Fields 0x00000000 +#define M_PRIdRFields 0xffffffff /* * Values in the Company ID field */ -#define K_PRIdCoID_MIPS 1 +#define K_PRIdCoID_MIPS 1 #define K_PRIdCoID_Broadcom 2 #define K_PRIdCoID_Alchemy 3 #define K_PRIdCoID_SiByte 4 @@ -1208,21 +1208,21 @@ /* * Values in the implementation number field */ -#define K_PRIdImp_Jade 0x80 -#define K_PRIdImp_Opal 0x81 -#define K_PRIdImp_Ruby 0x82 -#define K_PRIdImp_JadeLite 0x83 +#define K_PRIdImp_Jade 0x80 +#define K_PRIdImp_Opal 0x81 +#define K_PRIdImp_Ruby 0x82 +#define K_PRIdImp_JadeLite 0x83 #define K_PRIdImp_4KEc 0x84 /* Emerald with TLB MMU */ #define K_PRIdImp_4KEmp 0x85 /* Emerald with FM MMU */ #define K_PRIdImp_4KSc 0x86 /* Coral */ -#define K_PRIdImp_R3000 0x01 -#define K_PRIdImp_R4000 0x04 -#define K_PRIdImp_R10000 0x09 -#define K_PRIdImp_R4300 0x0b -#define K_PRIdImp_R5000 0x23 -#define K_PRIdImp_R5200 0x28 -#define K_PRIdImp_R5400 0x54 +#define K_PRIdImp_R3000 0x01 +#define K_PRIdImp_R4000 0x04 +#define K_PRIdImp_R10000 0x09 +#define K_PRIdImp_R4300 0x0b +#define K_PRIdImp_R5000 0x23 +#define K_PRIdImp_R5200 0x28 +#define K_PRIdImp_R5400 0x54 /* ************************************************************************ @@ -1237,24 +1237,24 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Config $16 -#define R_C0_Config 16 -#define C0_CONFIG C0_Config /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_Config $16 +#define R_C0_Config 16 +#define C0_CONFIG C0_Config /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_ConfigMore 31 /* Additional config registers present (R) */ -#define M_ConfigMore (0x1 << S_ConfigMore) -#define S_ConfigImpl 16 /* Implementation-specific fields */ -#define M_ConfigImpl (0x7fff << S_ConfigImpl) -#define S_ConfigBE 15 /* Denotes big-endian operation (R) */ -#define M_ConfigBE (0x1 << S_ConfigBE) -#define S_ConfigAT 13 /* Architecture type (R) */ -#define M_ConfigAT (0x3 << S_ConfigAT) -#define S_ConfigAR 10 /* Architecture revision (R) */ -#define M_ConfigAR (0x7 << S_ConfigAR) -#define S_ConfigMT 7 /* MMU Type (R) */ -#define M_ConfigMT (0x7 << S_ConfigMT) -#define S_ConfigK0 0 /* Kseg0 coherency algorithm (R/W) */ -#define M_ConfigK0 (0x7 << S_ConfigK0) +#define S_ConfigMore 31 /* Additional config registers present (R) */ +#define M_ConfigMore (0x1 << S_ConfigMore) +#define S_ConfigImpl 16 /* Implementation-specific fields */ +#define M_ConfigImpl (0x7fff << S_ConfigImpl) +#define S_ConfigBE 15 /* Denotes big-endian operation (R) */ +#define M_ConfigBE (0x1 << S_ConfigBE) +#define S_ConfigAT 13 /* Architecture type (R) */ +#define M_ConfigAT (0x3 << S_ConfigAT) +#define S_ConfigAR 10 /* Architecture revision (R) */ +#define M_ConfigAR (0x7 << S_ConfigAR) +#define S_ConfigMT 7 /* MMU Type (R) */ +#define M_ConfigMT (0x7 << S_ConfigMT) +#define S_ConfigK0 0 /* Kseg0 coherency algorithm (R/W) */ +#define M_ConfigK0 (0x7 << S_ConfigK0) /* * The following definitions are technically part of the "reserved for @@ -1263,28 +1263,28 @@ * references. For that reason, they are included here, but may be * overridden by true implementation-specific definitions */ -#define S_ConfigK23 28 /* Kseg2/3 coherency algorithm (FM MMU only) (R/W) */ -#define M_ConfigK23 (0x7 << S_ConfigK23) -#define S_ConfigKU 25 /* Kuseg coherency algorithm (FM MMU only) (R/W) */ -#define M_ConfigKU (0x7 << S_ConfigKU) +#define S_ConfigK23 28 /* Kseg2/3 coherency algorithm (FM MMU only) (R/W) */ +#define M_ConfigK23 (0x7 << S_ConfigK23) +#define S_ConfigKU 25 /* Kuseg coherency algorithm (FM MMU only) (R/W) */ +#define M_ConfigKU (0x7 << S_ConfigKU) -#define M_Config0Fields 0x00000078 -#define M_ConfigRFields 0x8000ff80 +#define M_Config0Fields 0x00000078 +#define M_ConfigRFields 0x8000ff80 /* * Values in the AT field */ -#define K_ConfigAT_MIPS32 0 /* MIPS32 */ -#define K_ConfigAT_MIPS64S 1 /* MIPS64 with 32-bit addresses */ -#define K_ConfigAT_MIPS64 2 /* MIPS64 with 32/64-bit addresses */ +#define K_ConfigAT_MIPS32 0 /* MIPS32 */ +#define K_ConfigAT_MIPS64S 1 /* MIPS64 with 32-bit addresses */ +#define K_ConfigAT_MIPS64 2 /* MIPS64 with 32/64-bit addresses */ /* * Values in the MT field */ -#define K_ConfigMT_NoMMU 0 /* No MMU */ -#define K_ConfigMT_TLBMMU 1 /* Standard TLB MMU */ -#define K_ConfigMT_BATMMU 2 /* Standard BAT MMU */ -#define K_ConfigMT_FMMMU 3 /* Standard Fixed Mapping MMU */ +#define K_ConfigMT_NoMMU 0 /* No MMU */ +#define K_ConfigMT_TLBMMU 1 /* Standard TLB MMU */ +#define K_ConfigMT_BATMMU 2 /* Standard BAT MMU */ +#define K_ConfigMT_FMMMU 3 /* Standard Fixed Mapping MMU */ /* @@ -1300,72 +1300,72 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Config1 $16,1 -#define R_C0_Config1 16 - -#define S_Config1More 31 /* Additional Config registers present (R) */ -#define M_Config1More (0x1 << S_Config1More) -#define S_Config1MMUSize 25 /* Number of MMU entries - 1 (R) */ -#define M_Config1MMUSize (0x3f << S_Config1MMUSize) -#define S_Config1IS 22 /* Icache sets per way (R) */ -#define M_Config1IS (0x7 << S_Config1IS) -#define S_Config1IL 19 /* Icache line size (R) */ -#define M_Config1IL (0x7 << S_Config1IL) -#define S_Config1IA 16 /* Icache associativity - 1 (R) */ -#define M_Config1IA (0x7 << S_Config1IA) -#define S_Config1DS 13 /* Dcache sets per way (R) */ -#define M_Config1DS (0x7 << S_Config1DS) -#define S_Config1DL 10 /* Dcache line size (R) */ -#define M_Config1DL (0x7 << S_Config1DL) -#define S_Config1DA 7 /* Dcache associativity (R) */ -#define M_Config1DA (0x7 << S_Config1DA) -#define S_Config1C2 6 /* Coprocessor 2 present (R) */ -#define M_Config1C2 (0x1 << S_Config1C2) -#define S_Config1MD 5 /* Denotes MDMX present (R) */ -#define M_Config1MD (0x1 << S_Config1MD) -#define S_Config1PC 4 /* Denotes performance counters present (R) */ -#define M_Config1PC (0x1 << S_Config1PC) -#define S_Config1WR 3 /* Denotes watch registers present (R) */ -#define M_Config1WR (0x1 << S_Config1WR) -#define S_Config1CA 2 /* Denotes MIPS-16 present (R) */ -#define M_Config1CA (0x1 << S_Config1CA) -#define S_Config1EP 1 /* Denotes EJTAG present (R) */ -#define M_Config1EP (0x1 << S_Config1EP) -#define S_Config1FP 0 /* Denotes floating point present (R) */ -#define M_Config1FP (0x1 << S_Config1FP) - -#define M_Config10Fields 0x00000060 -#define M_Config1RFields 0x7fffff9f +#define C0_Config1 $16,1 +#define R_C0_Config1 16 + +#define S_Config1More 31 /* Additional Config registers present (R) */ +#define M_Config1More (0x1 << S_Config1More) +#define S_Config1MMUSize 25 /* Number of MMU entries - 1 (R) */ +#define M_Config1MMUSize (0x3f << S_Config1MMUSize) +#define S_Config1IS 22 /* Icache sets per way (R) */ +#define M_Config1IS (0x7 << S_Config1IS) +#define S_Config1IL 19 /* Icache line size (R) */ +#define M_Config1IL (0x7 << S_Config1IL) +#define S_Config1IA 16 /* Icache associativity - 1 (R) */ +#define M_Config1IA (0x7 << S_Config1IA) +#define S_Config1DS 13 /* Dcache sets per way (R) */ +#define M_Config1DS (0x7 << S_Config1DS) +#define S_Config1DL 10 /* Dcache line size (R) */ +#define M_Config1DL (0x7 << S_Config1DL) +#define S_Config1DA 7 /* Dcache associativity (R) */ +#define M_Config1DA (0x7 << S_Config1DA) +#define S_Config1C2 6 /* Coprocessor 2 present (R) */ +#define M_Config1C2 (0x1 << S_Config1C2) +#define S_Config1MD 5 /* Denotes MDMX present (R) */ +#define M_Config1MD (0x1 << S_Config1MD) +#define S_Config1PC 4 /* Denotes performance counters present (R) */ +#define M_Config1PC (0x1 << S_Config1PC) +#define S_Config1WR 3 /* Denotes watch registers present (R) */ +#define M_Config1WR (0x1 << S_Config1WR) +#define S_Config1CA 2 /* Denotes MIPS-16 present (R) */ +#define M_Config1CA (0x1 << S_Config1CA) +#define S_Config1EP 1 /* Denotes EJTAG present (R) */ +#define M_Config1EP (0x1 << S_Config1EP) +#define S_Config1FP 0 /* Denotes floating point present (R) */ +#define M_Config1FP (0x1 << S_Config1FP) + +#define M_Config10Fields 0x00000060 +#define M_Config1RFields 0x7fffff9f /* * The following macro generates a table that is indexed * by the Icache or Dcache sets field in Config1 and * contains the decoded value of sets per way */ -#define Config1CacheSets() \ - HALF(64); \ - HALF(128); \ - HALF(256); \ - HALF(512); \ - HALF(1024); \ - HALF(2048); \ - HALF(4096); \ - HALF(8192); +#define Config1CacheSets() \ + HALF(64); \ + HALF(128); \ + HALF(256); \ + HALF(512); \ + HALF(1024); \ + HALF(2048); \ + HALF(4096); \ + HALF(8192); /* * The following macro generates a table that is indexed * by the Icache or Dcache line size field in Config1 and * contains the decoded value of the cache line size, in bytes */ -#define Config1CacheLineSize() \ - HALF(0); \ - HALF(4); \ - HALF(8); \ - HALF(16); \ - HALF(32); \ - HALF(64); \ - HALF(128); \ - HALF(256); +#define Config1CacheLineSize() \ + HALF(0); \ + HALF(4); \ + HALF(8); \ + HALF(16); \ + HALF(32); \ + HALF(64); \ + HALF(128); \ + HALF(256); /* @@ -1381,18 +1381,18 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Config2 $16,2 -#define R_C0_Config2 16 +#define C0_Config2 $16,2 +#define R_C0_Config2 16 -#define S_Config2More 31 /* Additional Config registers present (R) */ -#define M_Config2More (0x1 << S_Config2More) -#define S_Config2SM 1 /* Denotes SmartMIPS ASE present (R) */ -#define M_Config2SM (0x1 << S_Config2SM) -#define S_Config2TL 0 /* Denotes Tracing Logic present (R) */ -#define M_Config2TL (0x1 << S_Config2TL) +#define S_Config2More 31 /* Additional Config registers present (R) */ +#define M_Config2More (0x1 << S_Config2More) +#define S_Config2SM 1 /* Denotes SmartMIPS ASE present (R) */ +#define M_Config2SM (0x1 << S_Config2SM) +#define S_Config2TL 0 /* Denotes Tracing Logic present (R) */ +#define M_Config2TL (0x1 << S_Config2TL) -#define M_Config20Fields 0xfffffffc -#define M_Config2RFields 0x00000003 +#define M_Config20Fields 0xfffffffc +#define M_Config2RFields 0x00000003 /* ************************************************************************ @@ -1406,14 +1406,14 @@ * +-+-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_LLAddr $17 -#define R_C0_LLAddr 17 -#define C0_LLADDR C0_LLAddr /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_LLAddr $17 +#define R_C0_LLAddr 17 +#define C0_LLADDR C0_LLAddr /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_LLAddr0Fields 0x00000000 -#define M_LLAddrRFields 0x00000000 -#define M_LLAddr0Fields64 UNS64Const(0x0000000000000000) -#define M_LLAddrRFields64 UNS64Const(0x0000000000000000) +#define M_LLAddr0Fields 0x00000000 +#define M_LLAddrRFields 0x00000000 +#define M_LLAddr0Fields64 UNS64Const(0x0000000000000000) +#define M_LLAddrRFields64 UNS64Const(0x0000000000000000) /* @@ -1428,25 +1428,25 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_WatchLo $18 -#define R_C0_WatchLo 18 -#define C0_WATCHLO C0_WatchLo /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_WatchLo $18 +#define R_C0_WatchLo 18 +#define C0_WATCHLO C0_WatchLo /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_WatchLoVAddr 3 /* Watch virtual address (R/W) */ -#define M_WatchLoVAddr (0x1fffffff << S_WatchLoVAddr) -#define S_WatchLoI 2 /* Enable Istream watch (R/W) */ -#define M_WatchLoI (0x1 << S_WatchLoI) -#define S_WatchLoR 1 /* Enable data read watch (R/W) */ -#define M_WatchLoR (0x1 << S_WatchLoR) -#define S_WatchLoW 0 /* Enable data write watch (R/W) */ -#define M_WatchLoW (0x1 << S_WatchLoW) +#define S_WatchLoVAddr 3 /* Watch virtual address (R/W) */ +#define M_WatchLoVAddr (0x1fffffff << S_WatchLoVAddr) +#define S_WatchLoI 2 /* Enable Istream watch (R/W) */ +#define M_WatchLoI (0x1 << S_WatchLoI) +#define S_WatchLoR 1 /* Enable data read watch (R/W) */ +#define M_WatchLoR (0x1 << S_WatchLoR) +#define S_WatchLoW 0 /* Enable data write watch (R/W) */ +#define M_WatchLoW (0x1 << S_WatchLoW) -#define M_WatchLo0Fields 0x00000000 -#define M_WatchLoRFields 0x00000000 -#define M_WatchLo0Fields64 UNS64Const(0x0000000000000000) -#define M_WatchLoRFields64 UNS64Const(0x0000000000000000) +#define M_WatchLo0Fields 0x00000000 +#define M_WatchLoRFields 0x00000000 +#define M_WatchLo0Fields64 UNS64Const(0x0000000000000000) +#define M_WatchLoRFields64 UNS64Const(0x0000000000000000) -#define M_WatchLoEnables (M_WatchLoI | M_WatchLoR | M_WatchLoW) +#define M_WatchLoEnables (M_WatchLoI | M_WatchLoR | M_WatchLoW) /* @@ -1461,21 +1461,21 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_WatchHi $19 -#define R_C0_WatchHi 19 -#define C0_WATCHHI C0_WatchHi /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_WatchHi $19 +#define R_C0_WatchHi 19 +#define C0_WATCHHI C0_WatchHi /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_WatchHiM 31 /* Denotes additional Watch registers present (R) */ -#define M_WatchHiM (0x1 << S_WatchHiM) -#define S_WatchHiG 30 /* Enable ASID-independent Watch match (R/W) */ -#define M_WatchHiG (0x1 << S_WatchHiG) -#define S_WatchHiASID 16 /* ASID value to match (R/W) */ -#define M_WatchHiASID (0xff << S_WatchHiASID) -#define S_WatchHiMask 3 /* Address inhibit mask (R/W) */ -#define M_WatchHiMask (0x1ff << S_WatchHiMask) +#define S_WatchHiM 31 /* Denotes additional Watch registers present (R) */ +#define M_WatchHiM (0x1 << S_WatchHiM) +#define S_WatchHiG 30 /* Enable ASID-independent Watch match (R/W) */ +#define M_WatchHiG (0x1 << S_WatchHiG) +#define S_WatchHiASID 16 /* ASID value to match (R/W) */ +#define M_WatchHiASID (0xff << S_WatchHiASID) +#define S_WatchHiMask 3 /* Address inhibit mask (R/W) */ +#define M_WatchHiMask (0x1ff << S_WatchHiMask) -#define M_WatchHi0Fields 0x3f00f007 -#define M_WatchHiRFields 0x80000000 +#define M_WatchHi0Fields 0x3f00f007 +#define M_WatchHiRFields 0x80000000 /* @@ -1490,14 +1490,14 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_XContext $20 -#define R_C0_XContext 20 -#define C0_EXTCTXT C0_XContext /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_XContext $20 +#define R_C0_XContext 20 +#define C0_EXTCTXT C0_XContext /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_XContextBadVPN2 4 /* BadVPN2 (R) */ -#define S_XContextBadVPN S_XContextBadVPN2 +#define S_XContextBadVPN2 4 /* BadVPN2 (R) */ +#define S_XContextBadVPN S_XContextBadVPN2 -#define M_XContext0Fields 0x0000000f +#define M_XContext0Fields 0x0000000f /* @@ -1519,60 +1519,60 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_Debug $23 /* EJTAG */ -#define R_C0_Debug 23 - -#define S_DebugDBD 31 /* Debug branch delay (R) */ -#define M_DebugDBD (0x1 << S_DebugDBD) -#define S_DebugDM 30 /* Debug mode (R) */ -#define M_DebugDM (0x1 << S_DebugDM) -#define S_DebugNoDCR 29 /* No debug control register present (R) */ -#define M_DebugNoDCR (0x1 << S_DebugNoDCR) -#define S_DebugLSNM 28 /* Load/Store Normal Memory (R/W) */ -#define M_DebugLSNM (0x1 << S_DebugLSNM) -#define S_DebugDoze 27 /* Doze (R) */ -#define M_DebugDoze (0x1 << S_DebugDoze) -#define S_DebugHalt 26 /* Halt (R) */ -#define M_DebugHalt (0x1 << S_DebugHalt) -#define S_DebugCountDM 25 /* Count register behavior in debug mode (R/W) */ -#define M_DebugCountDM (0x1 << S_DebugCountDM) -#define S_DebugIBusEP 24 /* Imprecise Instn Bus Error Pending (R/W) */ -#define M_DebugIBusEP (0x1 << S_DebugIBusEP) -#define S_DebugMCheckP 23 /* Imprecise Machine Check Pending (R/W) */ -#define M_DebugMCheckP (0x1 << S_DebugMCheckP) -#define S_DebugCacheEP 22 /* Imprecise Cache Error Pending (R/W) */ -#define M_DebugCacheEP (0x1 << S_DebugCacheEP) -#define S_DebugDBusEP 21 /* Imprecise Data Bus Error Pending (R/W) */ -#define M_DebugDBusEP (0x1 << S_DebugDBusEP) -#define S_DebugIEXI 20 /* Imprecise Exception Inhibit (R/W) */ -#define M_DebugIEXI (0x1 << S_DebugIEXI) -#define S_DebugDDBSImpr 19 /* Debug data break store imprecise (R) */ -#define M_DebugDDBSImpr (0x1 << S_DebugDDBSImpr) -#define S_DebugDDBLImpr 18 /* Debug data break load imprecise (R) */ -#define M_DebugDDBLImpr (0x1 << S_DebugDDBLImpr) -#define S_DebugEJTAGver 15 /* EJTAG version number (R) */ -#define M_DebugEJTAGver (0x7 << S_DebugEJTAGver) -#define S_DebugDExcCode 10 /* Debug exception code (R) */ -#define M_DebugDExcCode (0x1f << S_DebugDExcCode) -#define S_DebugNoSSt 9 /* No single step implemented (R) */ -#define M_DebugNoSSt (0x1 << S_DebugNoSSt) -#define S_DebugSSt 8 /* Single step enable (R/W) */ -#define M_DebugSSt (0x1 << S_DebugSSt) -#define S_DebugDINT 5 /* Debug interrupt (R) */ -#define M_DebugDINT (0x1 << S_DebugDINT) -#define S_DebugDIB 4 /* Debug instruction break (R) */ -#define M_DebugDIB (0x1 << S_DebugDIB) -#define S_DebugDDBS 3 /* Debug data break store (R) */ -#define M_DebugDDBS (0x1 << S_DebugDDBS) -#define S_DebugDDBL 2 /* Debug data break load (R) */ -#define M_DebugDDBL (0x1 << S_DebugDDBL) -#define S_DebugDBp 1 /* Debug breakpoint (R) */ -#define M_DebugDBp (0x1 << S_DebugDBp) -#define S_DebugDSS 0 /* Debug single step (R) */ -#define M_DebugDSS (0x1 << S_DebugDSS) - -#define M_Debug0Fields 0x01f000c0 -#define M_DebugRFields 0xec0ffe3f +#define C0_Debug $23 /* EJTAG */ +#define R_C0_Debug 23 + +#define S_DebugDBD 31 /* Debug branch delay (R) */ +#define M_DebugDBD (0x1 << S_DebugDBD) +#define S_DebugDM 30 /* Debug mode (R) */ +#define M_DebugDM (0x1 << S_DebugDM) +#define S_DebugNoDCR 29 /* No debug control register present (R) */ +#define M_DebugNoDCR (0x1 << S_DebugNoDCR) +#define S_DebugLSNM 28 /* Load/Store Normal Memory (R/W) */ +#define M_DebugLSNM (0x1 << S_DebugLSNM) +#define S_DebugDoze 27 /* Doze (R) */ +#define M_DebugDoze (0x1 << S_DebugDoze) +#define S_DebugHalt 26 /* Halt (R) */ +#define M_DebugHalt (0x1 << S_DebugHalt) +#define S_DebugCountDM 25 /* Count register behavior in debug mode (R/W) */ +#define M_DebugCountDM (0x1 << S_DebugCountDM) +#define S_DebugIBusEP 24 /* Imprecise Instn Bus Error Pending (R/W) */ +#define M_DebugIBusEP (0x1 << S_DebugIBusEP) +#define S_DebugMCheckP 23 /* Imprecise Machine Check Pending (R/W) */ +#define M_DebugMCheckP (0x1 << S_DebugMCheckP) +#define S_DebugCacheEP 22 /* Imprecise Cache Error Pending (R/W) */ +#define M_DebugCacheEP (0x1 << S_DebugCacheEP) +#define S_DebugDBusEP 21 /* Imprecise Data Bus Error Pending (R/W) */ +#define M_DebugDBusEP (0x1 << S_DebugDBusEP) +#define S_DebugIEXI 20 /* Imprecise Exception Inhibit (R/W) */ +#define M_DebugIEXI (0x1 << S_DebugIEXI) +#define S_DebugDDBSImpr 19 /* Debug data break store imprecise (R) */ +#define M_DebugDDBSImpr (0x1 << S_DebugDDBSImpr) +#define S_DebugDDBLImpr 18 /* Debug data break load imprecise (R) */ +#define M_DebugDDBLImpr (0x1 << S_DebugDDBLImpr) +#define S_DebugEJTAGver 15 /* EJTAG version number (R) */ +#define M_DebugEJTAGver (0x7 << S_DebugEJTAGver) +#define S_DebugDExcCode 10 /* Debug exception code (R) */ +#define M_DebugDExcCode (0x1f << S_DebugDExcCode) +#define S_DebugNoSSt 9 /* No single step implemented (R) */ +#define M_DebugNoSSt (0x1 << S_DebugNoSSt) +#define S_DebugSSt 8 /* Single step enable (R/W) */ +#define M_DebugSSt (0x1 << S_DebugSSt) +#define S_DebugDINT 5 /* Debug interrupt (R) */ +#define M_DebugDINT (0x1 << S_DebugDINT) +#define S_DebugDIB 4 /* Debug instruction break (R) */ +#define M_DebugDIB (0x1 << S_DebugDIB) +#define S_DebugDDBS 3 /* Debug data break store (R) */ +#define M_DebugDDBS (0x1 << S_DebugDDBS) +#define S_DebugDDBL 2 /* Debug data break load (R) */ +#define M_DebugDDBL (0x1 << S_DebugDDBL) +#define S_DebugDBp 1 /* Debug breakpoint (R) */ +#define M_DebugDBp (0x1 << S_DebugDBp) +#define S_DebugDSS 0 /* Debug single step (R) */ +#define M_DebugDSS (0x1 << S_DebugDSS) + +#define M_Debug0Fields 0x01f000c0 +#define M_DebugRFields 0xec0ffe3f /* @@ -1588,13 +1588,13 @@ */ -#define C0_DEPC $24 -#define R_C0_DEPC 24 +#define C0_DEPC $24 +#define R_C0_DEPC 24 -#define M_DEEPC0Fields 0x00000000 -#define M_DEEPCRFields 0x00000000 -#define M_DEEPC0Fields64 UNS64Const(0x0000000000000000) -#define M_DEEPCRFields64 UNS64Const(0x0000000000000000) +#define M_DEEPC0Fields 0x00000000 +#define M_DEEPCRFields 0x00000000 +#define M_DEEPC0Fields64 UNS64Const(0x0000000000000000) +#define M_DEEPCRFields64 UNS64Const(0x0000000000000000) /* @@ -1618,28 +1618,28 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_PerfCnt $25 -#define R_C0_PerfCnt 25 -#define C0_PRFCNT0 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define C0_PRFCNT1 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_PerfCnt $25 +#define R_C0_PerfCnt 25 +#define C0_PRFCNT0 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_PRFCNT1 C0_PerfCnt /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define S_PerfCntM 31 /* More performance counters exist (R) */ -#define M_PerfCntM (1 << S_PerfCntM) -#define S_PerfCntEvent 5 /* Enabled event (R/W) */ -#define M_PerfCntEvent (0x3f << S_PerfCntEvent) -#define S_PerfCntIE 4 /* Interrupt Enable (R/W) */ -#define M_PerfCntIE (1 << S_PerfCntIE) -#define S_PerfCntU 3 /* Enable counting in User Mode (R/W) */ -#define M_PerfCntU (1 << S_PerfCntU) -#define S_PerfCntS 2 /* Enable counting in Supervisor Mode (R/W) */ -#define M_PerfCntS (1 << S_PerfCntS) -#define S_PerfCntK 1 /* Enable counting in Kernel Mode (R/W) */ -#define M_PerfCntK (1 << S_PerfCntK) -#define S_PerfCntEXL 0 /* Enable counting while EXL==1 (R/W) */ -#define M_PerfCntEXL (1 << S_PerfCntEXL) +#define S_PerfCntM 31 /* More performance counters exist (R) */ +#define M_PerfCntM (1 << S_PerfCntM) +#define S_PerfCntEvent 5 /* Enabled event (R/W) */ +#define M_PerfCntEvent (0x3f << S_PerfCntEvent) +#define S_PerfCntIE 4 /* Interrupt Enable (R/W) */ +#define M_PerfCntIE (1 << S_PerfCntIE) +#define S_PerfCntU 3 /* Enable counting in User Mode (R/W) */ +#define M_PerfCntU (1 << S_PerfCntU) +#define S_PerfCntS 2 /* Enable counting in Supervisor Mode (R/W) */ +#define M_PerfCntS (1 << S_PerfCntS) +#define S_PerfCntK 1 /* Enable counting in Kernel Mode (R/W) */ +#define M_PerfCntK (1 << S_PerfCntK) +#define S_PerfCntEXL 0 /* Enable counting while EXL==1 (R/W) */ +#define M_PerfCntEXL (1 << S_PerfCntEXL) -#define M_PerfCnt0Fields 0x7ffff800 -#define M_PerfCntRFields 0x80000000 +#define M_PerfCnt0Fields 0x7ffff800 +#define M_PerfCntRFields 0x80000000 /* @@ -1654,13 +1654,13 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_ErrCtl $26 -#define R_C0_ErrCtl 26 -#define C0_ECC $26 /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define R_C0_ECC 26 /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_ErrCtl $26 +#define R_C0_ErrCtl 26 +#define C0_ECC $26 /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define R_C0_ECC 26 /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_ErrCtl0Fields 0x00000000 -#define M_ErrCtlRFields 0x00000000 +#define M_ErrCtl0Fields 0x00000000 +#define M_ErrCtlRFields 0x00000000 /* @@ -1675,12 +1675,12 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_CacheErr $27 -#define R_C0_CacheErr 27 -#define C0_CACHE_ERR C0_CacheErr /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_CacheErr $27 +#define R_C0_CacheErr 27 +#define C0_CACHE_ERR C0_CacheErr /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_CacheErr0Fields 0x00000000 -#define M_CachErrRFields 0x00000000 +#define M_CacheErr0Fields 0x00000000 +#define M_CachErrRFields 0x00000000 /* @@ -1695,9 +1695,9 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_TagLo $28 -#define R_C0_TagLo 28 -#define C0_TAGLO C0_TagLo /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_TagLo $28 +#define R_C0_TagLo 28 +#define C0_TAGLO C0_TagLo /* OBSOLETE - DO NOT USE IN NEW CODE */ /* * Some implementations use separate TagLo registers for the @@ -1705,11 +1705,11 @@ * definitions can be used in relevant code */ -#define C0_ITagLo $28,0 -#define C0_DTagLo $28,2 +#define C0_ITagLo $28,0 +#define C0_DTagLo $28,2 -#define M_TagLo0Fields 0x00000000 -#define M_TagLoRFields 0x00000000 +#define M_TagLo0Fields 0x00000000 +#define M_TagLoRFields 0x00000000 /* @@ -1724,8 +1724,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_DataLo $28,1 -#define R_C0_DataLo 28 +#define C0_DataLo $28,1 +#define R_C0_DataLo 28 /* * Some implementations use separate DataLo registers for the @@ -1733,11 +1733,11 @@ * definitions can be used in relevant code */ -#define C0_IDataLo $28,1 -#define C0_DDataLo $28,3 +#define C0_IDataLo $28,1 +#define C0_DDataLo $28,3 -#define M_DataLo0Fields 0x00000000 -#define M_DataLoRFields 0xffffffff +#define M_DataLo0Fields 0x00000000 +#define M_DataLoRFields 0xffffffff /* @@ -1752,9 +1752,9 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_TagHi $29 -#define R_C0_TagHi 29 -#define C0_TAGHI C0_TagHi /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_TagHi $29 +#define R_C0_TagHi 29 +#define C0_TAGHI C0_TagHi /* OBSOLETE - DO NOT USE IN NEW CODE */ /* * Some implementations use separate TagHi registers for the @@ -1762,11 +1762,11 @@ * definitions can be used in relevant code */ -#define C0_ITagHi $29,0 -#define C0_DTagHi $29,2 +#define C0_ITagHi $29,0 +#define C0_DTagHi $29,2 -#define M_TagHi0Fields 0x00000000 -#define M_TagHiRFields 0x00000000 +#define M_TagHi0Fields 0x00000000 +#define M_TagHiRFields 0x00000000 /* @@ -1781,8 +1781,8 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_DataHi $29,1 -#define R_C0_DataHi 29 +#define C0_DataHi $29,1 +#define R_C0_DataHi 29 /* * Some implementations use separate DataHi registers for the @@ -1790,11 +1790,11 @@ * definitions can be used in relevant code */ -#define C0_IDataHi $29,1 -#define C0_DDataHi $29,3 +#define C0_IDataHi $29,1 +#define C0_DDataHi $29,3 -#define M_DataHi0Fields 0x00000000 -#define M_DataHiRFields 0xffffffff +#define M_DataHi0Fields 0x00000000 +#define M_DataHiRFields 0xffffffff /* @@ -1809,14 +1809,14 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_ErrorEPC $30 -#define R_C0_ErrorEPC 30 -#define C0_ERROR_EPC C0_ErrorEPC /* OBSOLETE - DO NOT USE IN NEW CODE */ +#define C0_ErrorEPC $30 +#define R_C0_ErrorEPC 30 +#define C0_ERROR_EPC C0_ErrorEPC /* OBSOLETE - DO NOT USE IN NEW CODE */ -#define M_ErrorEPC0Fields 0x00000000 -#define M_ErrorEPCRFields 0x00000000 -#define M_ErrorEPC0Fields64 UNS64Const(0x0000000000000000) -#define M_ErrorEPCRFields64 UNS64Const(0x0000000000000000) +#define M_ErrorEPC0Fields 0x00000000 +#define M_ErrorEPCRFields 0x00000000 +#define M_ErrorEPC0Fields64 UNS64Const(0x0000000000000000) +#define M_ErrorEPCRFields64 UNS64Const(0x0000000000000000) /* @@ -1831,13 +1831,13 @@ * +-+//+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C0_DESAVE $31 -#define R_C0_DESAVE 31 +#define C0_DESAVE $31 +#define R_C0_DESAVE 31 -#define M_DESAVE0Fields 0x00000000 -#define M_DESAVERFields 0x00000000 -#define M_DESAVE0Fields64 UNS64Const(0x0000000000000000) -#define M_DESAVERFields64 UNS64Const(0x0000000000000000) +#define M_DESAVE0Fields 0x00000000 +#define M_DESAVERFields 0x00000000 +#define M_DESAVE0Fields64 UNS64Const(0x0000000000000000) +#define M_DESAVERFields64 UNS64Const(0x0000000000000000) /* @@ -1853,38 +1853,38 @@ ************************************************************************* */ -#define fp0 $f0 -#define fp1 $f1 -#define fp2 $f2 -#define fp3 $f3 -#define fp4 $f4 -#define fp5 $f5 -#define fp6 $f6 -#define fp7 $f7 -#define fp8 $f8 -#define fp9 $f9 -#define fp10 $f10 -#define fp11 $f11 -#define fp12 $f12 -#define fp13 $f13 -#define fp14 $f14 -#define fp15 $f15 -#define fp16 $f16 -#define fp17 $f17 -#define fp18 $f18 -#define fp19 $f19 -#define fp20 $f20 -#define fp21 $f21 -#define fp22 $f22 -#define fp23 $f23 -#define fp24 $f24 -#define fp25 $f25 -#define fp26 $f26 -#define fp27 $f27 -#define fp28 $f28 -#define fp29 $f29 -#define fp30 $f30 -#define fp31 $f31 +#define fp0 $f0 +#define fp1 $f1 +#define fp2 $f2 +#define fp3 $f3 +#define fp4 $f4 +#define fp5 $f5 +#define fp6 $f6 +#define fp7 $f7 +#define fp8 $f8 +#define fp9 $f9 +#define fp10 $f10 +#define fp11 $f11 +#define fp12 $f12 +#define fp13 $f13 +#define fp14 $f14 +#define fp15 $f15 +#define fp16 $f16 +#define fp17 $f17 +#define fp18 $f18 +#define fp19 $f19 +#define fp20 $f20 +#define fp21 $f21 +#define fp22 $f22 +#define fp23 $f23 +#define fp24 $f24 +#define fp25 $f25 +#define fp26 $f26 +#define fp27 $f27 +#define fp28 $f28 +#define fp29 $f29 +#define fp30 $f30 +#define fp31 $f31 /* * The following definitions are used to convert an FPR name @@ -1892,39 +1892,39 @@ * This is used in macro substitution in the AVPs. */ -#define fp1_even $f0 -#define fp3_even $f2 -#define fp5_even $f4 -#define fp7_even $f6 -#define fp9_even $f8 -#define fp11_even $f10 -#define fp13_even $f12 -#define fp15_even $f14 -#define fp17_even $f16 -#define fp19_even $f18 -#define fp21_even $f20 -#define fp23_even $f22 -#define fp25_even $f24 -#define fp27_even $f26 -#define fp29_even $f28 -#define fp31_even $f30 - -#define fp0_odd $f1 -#define fp2_odd $f3 -#define fp4_odd $f5 -#define fp6_odd $f7 -#define fp8_odd $f9 -#define fp10_odd $f11 -#define fp12_odd $f13 -#define fp14_odd $f15 -#define fp16_odd $f17 -#define fp18_odd $f19 -#define fp20_odd $f21 -#define fp22_odd $f23 -#define fp24_odd $f25 -#define fp26_odd $f27 -#define fp28_odd $f29 -#define fp30_odd $f31 +#define fp1_even $f0 +#define fp3_even $f2 +#define fp5_even $f4 +#define fp7_even $f6 +#define fp9_even $f8 +#define fp11_even $f10 +#define fp13_even $f12 +#define fp15_even $f14 +#define fp17_even $f16 +#define fp19_even $f18 +#define fp21_even $f20 +#define fp23_even $f22 +#define fp25_even $f24 +#define fp27_even $f26 +#define fp29_even $f28 +#define fp31_even $f30 + +#define fp0_odd $f1 +#define fp2_odd $f3 +#define fp4_odd $f5 +#define fp6_odd $f7 +#define fp8_odd $f9 +#define fp10_odd $f11 +#define fp12_odd $f13 +#define fp14_odd $f15 +#define fp16_odd $f17 +#define fp18_odd $f19 +#define fp20_odd $f21 +#define fp22_odd $f23 +#define fp24_odd $f25 +#define fp26_odd $f27 +#define fp28_odd $f29 +#define fp30_odd $f31 /* @@ -1936,38 +1936,38 @@ * to the assembler register name ($n). */ -#define R_fp0 0 -#define R_fp1 1 -#define R_fp2 2 -#define R_fp3 3 -#define R_fp4 4 -#define R_fp5 5 -#define R_fp6 6 -#define R_fp7 7 -#define R_fp8 8 -#define R_fp9 9 -#define R_fp10 10 -#define R_fp11 11 -#define R_fp12 12 -#define R_fp13 13 -#define R_fp14 14 -#define R_fp15 15 -#define R_fp16 16 -#define R_fp17 17 -#define R_fp18 18 -#define R_fp19 19 -#define R_fp20 20 -#define R_fp21 21 -#define R_fp22 22 -#define R_fp23 23 -#define R_fp24 24 -#define R_fp25 25 -#define R_fp26 26 -#define R_fp27 27 -#define R_fp28 28 -#define R_fp29 29 -#define R_fp30 30 -#define R_fp31 31 +#define R_fp0 0 +#define R_fp1 1 +#define R_fp2 2 +#define R_fp3 3 +#define R_fp4 4 +#define R_fp5 5 +#define R_fp6 6 +#define R_fp7 7 +#define R_fp8 8 +#define R_fp9 9 +#define R_fp10 10 +#define R_fp11 11 +#define R_fp12 12 +#define R_fp13 13 +#define R_fp14 14 +#define R_fp15 15 +#define R_fp16 16 +#define R_fp17 17 +#define R_fp18 18 +#define R_fp19 19 +#define R_fp20 20 +#define R_fp21 21 +#define R_fp22 22 +#define R_fp23 23 +#define R_fp24 24 +#define R_fp25 25 +#define R_fp26 26 +#define R_fp27 27 +#define R_fp28 28 +#define R_fp29 29 +#define R_fp30 30 +#define R_fp31 31 /* @@ -1976,11 +1976,11 @@ ************************************************************************* */ -#define fc0 $0 -#define fc25 $25 -#define fc26 $26 -#define fc28 $28 -#define fc31 $31 +#define fc0 $0 +#define fc25 $25 +#define fc26 $26 +#define fc28 $28 +#define fc31 $31 /* @@ -1992,11 +1992,11 @@ * to the assembler register name ($n). */ -#define R_fc0 0 -#define R_fc25 25 -#define R_fc26 26 -#define R_fc28 28 -#define R_fc31 31 +#define R_fc0 0 +#define R_fc25 25 +#define R_fc26 26 +#define R_fc28 28 +#define R_fc31 31 /* @@ -2005,14 +2005,14 @@ ************************************************************************* */ -#define cc0 $fcc0 -#define cc1 $fcc1 -#define cc2 $fcc2 -#define cc3 $fcc3 -#define cc4 $fcc4 -#define cc5 $fcc5 -#define cc6 $fcc6 -#define cc7 $fcc7 +#define cc0 $fcc0 +#define cc1 $fcc1 +#define cc2 $fcc2 +#define cc3 $fcc3 +#define cc4 $fcc4 +#define cc5 $fcc5 +#define cc6 $fcc6 +#define cc7 $fcc7 /* @@ -2024,14 +2024,14 @@ * to the assembler register name ($n). */ -#define R_cc0 0 -#define R_cc1 1 -#define R_cc2 2 -#define R_cc3 3 -#define R_cc4 4 -#define R_cc5 5 -#define R_cc6 6 -#define R_cc7 7 +#define R_cc0 0 +#define R_cc1 1 +#define R_cc2 2 +#define R_cc3 3 +#define R_cc4 4 +#define R_cc5 5 +#define R_cc6 6 +#define R_cc7 7 /* @@ -2047,27 +2047,27 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C1_FIR $0 -#define R_C1_FIR 0 +#define C1_FIR $0 +#define R_C1_FIR 0 -#define S_FIRConfigS 16 -#define M_FIRConfigS (0x1 << S_FIRConfigS) -#define S_FIRConfigD 17 -#define M_FIRConfigD (0x1 << S_FIRConfigD) -#define S_FIRConfigPS 18 -#define M_FIRConfigPS (0x1 << S_FIRConfigPS) -#define S_FIRConfig3D 19 -#define M_FIRConfig3D (0x1 << S_FIRConfig3D) -#define M_FIRConfigAll (M_FIRConfigS|M_FIRConfigD|M_FIRConfigPS|M_FIRConfig3D) +#define S_FIRConfigS 16 +#define M_FIRConfigS (0x1 << S_FIRConfigS) +#define S_FIRConfigD 17 +#define M_FIRConfigD (0x1 << S_FIRConfigD) +#define S_FIRConfigPS 18 +#define M_FIRConfigPS (0x1 << S_FIRConfigPS) +#define S_FIRConfig3D 19 +#define M_FIRConfig3D (0x1 << S_FIRConfig3D) +#define M_FIRConfigAll (M_FIRConfigS|M_FIRConfigD|M_FIRConfigPS|M_FIRConfig3D) -#define S_FIRImp 8 -#define M_FIRImp (0xff << S_FIRImp) +#define S_FIRImp 8 +#define M_FIRImp (0xff << S_FIRImp) -#define S_FIRRev 0 -#define M_FIRRev (0xff << S_FIRRev) +#define S_FIRRev 0 +#define M_FIRRev (0xff << S_FIRRev) -#define M_FIR0Fields 0xfff00000 -#define M_FIRRFields 0x000fffff +#define M_FIR0Fields 0xfff00000 +#define M_FIRRFields 0x000fffff /* ************************************************************************ @@ -2081,30 +2081,30 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C1_FCCR $25 -#define R_C1_FCCR 25 +#define C1_FCCR $25 +#define R_C1_FCCR 25 -#define S_FCCRCC 0 -#define M_FCCRCC (0xff << S_FCCRCC) -#define S_FCCRCC7 7 -#define M_FCCRCC7 (0x1 << S_FCCRCC7) -#define S_FCCRCC6 6 -#define M_FCCRCC6 (0x1 << S_FCCRCC6) -#define S_FCCRCC5 5 -#define M_FCCRCC5 (0x1 << S_FCCRCC5) -#define S_FCCRCC4 4 -#define M_FCCRCC4 (0x1 << S_FCCRCC4) -#define S_FCCRCC3 3 -#define M_FCCRCC3 (0x1 << S_FCCRCC3) -#define S_FCCRCC2 2 -#define M_FCCRCC2 (0x1 << S_FCCRCC2) -#define S_FCCRCC1 1 -#define M_FCCRCC1 (0x1 << S_FCCRCC1) -#define S_FCCRCC0 0 -#define M_FCCRCC0 (0x1 << S_FCCRCC0) +#define S_FCCRCC 0 +#define M_FCCRCC (0xff << S_FCCRCC) +#define S_FCCRCC7 7 +#define M_FCCRCC7 (0x1 << S_FCCRCC7) +#define S_FCCRCC6 6 +#define M_FCCRCC6 (0x1 << S_FCCRCC6) +#define S_FCCRCC5 5 +#define M_FCCRCC5 (0x1 << S_FCCRCC5) +#define S_FCCRCC4 4 +#define M_FCCRCC4 (0x1 << S_FCCRCC4) +#define S_FCCRCC3 3 +#define M_FCCRCC3 (0x1 << S_FCCRCC3) +#define S_FCCRCC2 2 +#define M_FCCRCC2 (0x1 << S_FCCRCC2) +#define S_FCCRCC1 1 +#define M_FCCRCC1 (0x1 << S_FCCRCC1) +#define S_FCCRCC0 0 +#define M_FCCRCC0 (0x1 << S_FCCRCC0) -#define M_FCCR0Fields 0xffffff00 -#define M_FCCRRFields 0x000000ff +#define M_FCCR0Fields 0xffffff00 +#define M_FCCRRFields 0x000000ff /* @@ -2120,39 +2120,39 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C1_FEXR $26 -#define R_C1_FEXR 26 +#define C1_FEXR $26 +#define R_C1_FEXR 26 -#define S_FEXRExc 12 -#define M_FEXRExc (0x3f << S_FEXRExc) -#define S_FEXRExcE 17 -#define M_FEXRExcE (0x1 << S_FEXRExcE) -#define S_FEXRExcV 16 -#define M_FEXRExcV (0x1 << S_FEXRExcV) -#define S_FEXRExcZ 15 -#define M_FEXRExcZ (0x1 << S_FEXRExcZ) -#define S_FEXRExcO 14 -#define M_FEXRExcO (0x1 << S_FEXRExcO) -#define S_FEXRExcU 13 -#define M_FEXRExcU (0x1 << S_FEXRExcU) -#define S_FEXRExcI 12 -#define M_FEXRExcI (0x1 << S_FEXRExcI) +#define S_FEXRExc 12 +#define M_FEXRExc (0x3f << S_FEXRExc) +#define S_FEXRExcE 17 +#define M_FEXRExcE (0x1 << S_FEXRExcE) +#define S_FEXRExcV 16 +#define M_FEXRExcV (0x1 << S_FEXRExcV) +#define S_FEXRExcZ 15 +#define M_FEXRExcZ (0x1 << S_FEXRExcZ) +#define S_FEXRExcO 14 +#define M_FEXRExcO (0x1 << S_FEXRExcO) +#define S_FEXRExcU 13 +#define M_FEXRExcU (0x1 << S_FEXRExcU) +#define S_FEXRExcI 12 +#define M_FEXRExcI (0x1 << S_FEXRExcI) -#define S_FEXRFlg 2 -#define M_FEXRFlg (0x1f << S_FEXRFlg) -#define S_FEXRFlgV 6 -#define M_FEXRFlgV (0x1 << S_FEXRFlgV) -#define S_FEXRFlgZ 5 -#define M_FEXRFlgZ (0x1 << S_FEXRFlgZ) -#define S_FEXRFlgO 4 -#define M_FEXRFlgO (0x1 << S_FEXRFlgO) -#define S_FEXRFlgU 3 -#define M_FEXRFlgU (0x1 << S_FEXRFlgU) -#define S_FEXRFlgI 2 -#define M_FEXRFlgI (0x1 << S_FEXRFlgI) +#define S_FEXRFlg 2 +#define M_FEXRFlg (0x1f << S_FEXRFlg) +#define S_FEXRFlgV 6 +#define M_FEXRFlgV (0x1 << S_FEXRFlgV) +#define S_FEXRFlgZ 5 +#define M_FEXRFlgZ (0x1 << S_FEXRFlgZ) +#define S_FEXRFlgO 4 +#define M_FEXRFlgO (0x1 << S_FEXRFlgO) +#define S_FEXRFlgU 3 +#define M_FEXRFlgU (0x1 << S_FEXRFlgU) +#define S_FEXRFlgI 2 +#define M_FEXRFlgI (0x1 << S_FEXRFlgI) -#define M_FEXR0Fields 0xfffc0f83 -#define M_FEXRRFields 0x00000000 +#define M_FEXR0Fields 0xfffc0f83 +#define M_FEXRRFields 0x00000000 /* @@ -2168,30 +2168,30 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C1_FENR $28 -#define R_C1_FENR 28 +#define C1_FENR $28 +#define R_C1_FENR 28 -#define S_FENREna 7 -#define M_FENREna (0x1f << S_FENREna) -#define S_FENREnaV 11 -#define M_FENREnaV (0x1 << S_FENREnaV) -#define S_FENREnaZ 10 -#define M_FENREnaZ (0x1 << S_FENREnaZ) -#define S_FENREnaO 9 -#define M_FENREnaO (0x1 << S_FENREnaO) -#define S_FENREnaU 8 -#define M_FENREnaU (0x1 << S_FENREnaU) -#define S_FENREnaI 7 -#define M_FENREnaI (0x1 << S_FENREnaI) +#define S_FENREna 7 +#define M_FENREna (0x1f << S_FENREna) +#define S_FENREnaV 11 +#define M_FENREnaV (0x1 << S_FENREnaV) +#define S_FENREnaZ 10 +#define M_FENREnaZ (0x1 << S_FENREnaZ) +#define S_FENREnaO 9 +#define M_FENREnaO (0x1 << S_FENREnaO) +#define S_FENREnaU 8 +#define M_FENREnaU (0x1 << S_FENREnaU) +#define S_FENREnaI 7 +#define M_FENREnaI (0x1 << S_FENREnaI) -#define S_FENRFS 2 -#define M_FENRFS (0x1 << S_FENRFS) +#define S_FENRFS 2 +#define M_FENRFS (0x1 << S_FENRFS) -#define S_FENRRM 0 -#define M_FENRRM (0x3 << S_FENRRM) +#define S_FENRRM 0 +#define M_FENRRM (0x3 << S_FENRRM) -#define M_FENR0Fields 0xfffff078 -#define M_FENRRFields 0x00000000 +#define M_FENR0Fields 0xfffff078 +#define M_FENRRFields 0x00000000 /* @@ -2207,90 +2207,90 @@ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ -#define C1_FCSR $31 -#define R_C1_FCSR 31 - -#define S_FCSRFCC7_1 25 /* Floating point condition codes 7..1 (R/W) */ -#define M_FCSRFCC7_1 (0x7f << S_FCSRFCC7_1) -#define S_FCSRCC7 31 -#define M_FCSRCC7 (0x1 << S_FCSRCC7) -#define S_FCSRCC6 30 -#define M_FCSRCC6 (0x1 << S_FCSRCC6) -#define S_FCSRCC5 29 -#define M_FCSRCC5 (0x1 << S_FCSRCC5) -#define S_FCSRCC4 28 -#define M_FCSRCC4 (0x1 << S_FCSRCC4) -#define S_FCSRCC3 27 -#define M_FCSRCC3 (0x1 << S_FCSRCC3) -#define S_FCSRCC2 26 -#define M_FCSRCC2 (0x1 << S_FCSRCC2) -#define S_FCSRCC1 25 -#define M_FCSRCC1 (0x1 << S_FCSRCC1) - -#define S_FCSRFS 24 /* Flush denorms to zero (R/W) */ -#define M_FCSRFS (0x1 << S_FCSRFS) - -#define S_FCSRCC0 23 /* Floating point condition code 0 (R/W) */ -#define M_FCSRCC0 (0x1 << S_FCSRCC0) -#define S_FCSRCC S_FCSRCC0 -#define M_FCSRCC M_FCSRCC0 - -#define S_FCSRImpl 21 /* Implementation-specific control bits (R/W) */ -#define M_FCSRImpl (0x3 << S_FCSRImpl) - -#define S_FCSRExc 12 /* Exception cause (R/W) */ -#define M_FCSRExc (0x3f << S_FCSRExc) -#define S_FCSRExcE 17 -#define M_FCSRExcE (0x1 << S_FCSRExcE) -#define S_FCSRExcV 16 -#define M_FCSRExcV (0x1 << S_FCSRExcV) -#define S_FCSRExcZ 15 -#define M_FCSRExcZ (0x1 << S_FCSRExcZ) -#define S_FCSRExcO 14 -#define M_FCSRExcO (0x1 << S_FCSRExcO) -#define S_FCSRExcU 13 -#define M_FCSRExcU (0x1 << S_FCSRExcU) -#define S_FCSRExcI 12 -#define M_FCSRExcI (0x1 << S_FCSRExcI) - -#define S_FCSREna 7 /* Exception enable (R/W) */ -#define M_FCSREna (0x1f << S_FCSREna) -#define S_FCSREnaV 11 -#define M_FCSREnaV (0x1 << S_FCSREnaV) -#define S_FCSREnaZ 10 -#define M_FCSREnaZ (0x1 << S_FCSREnaZ) -#define S_FCSREnaO 9 -#define M_FCSREnaO (0x1 << S_FCSREnaO) -#define S_FCSREnaU 8 -#define M_FCSREnaU (0x1 << S_FCSREnaU) -#define S_FCSREnaI 7 -#define M_FCSREnaI (0x1 << S_FCSREnaI) - -#define S_FCSRFlg 2 /* Exception flags (R/W) */ -#define M_FCSRFlg (0x1f << S_FCSRFlg) -#define S_FCSRFlgV 6 -#define M_FCSRFlgV (0x1 << S_FCSRFlgV) -#define S_FCSRFlgZ 5 -#define M_FCSRFlgZ (0x1 << S_FCSRFlgZ) -#define S_FCSRFlgO 4 -#define M_FCSRFlgO (0x1 << S_FCSRFlgO) -#define S_FCSRFlgU 3 -#define M_FCSRFlgU (0x1 << S_FCSRFlgU) -#define S_FCSRFlgI 2 -#define M_FCSRFlgI (0x1 << S_FCSRFlgI) - -#define S_FCSRRM 0 /* Rounding mode (R/W) */ -#define M_FCSRRM (0x3 << S_FCSRRM) - -#define M_FCSR0Fields 0x001c0000 -#define M_FCSRRFields 0x00000000 +#define C1_FCSR $31 +#define R_C1_FCSR 31 + +#define S_FCSRFCC7_1 25 /* Floating point condition codes 7..1 (R/W) */ +#define M_FCSRFCC7_1 (0x7f << S_FCSRFCC7_1) +#define S_FCSRCC7 31 +#define M_FCSRCC7 (0x1 << S_FCSRCC7) +#define S_FCSRCC6 30 +#define M_FCSRCC6 (0x1 << S_FCSRCC6) +#define S_FCSRCC5 29 +#define M_FCSRCC5 (0x1 << S_FCSRCC5) +#define S_FCSRCC4 28 +#define M_FCSRCC4 (0x1 << S_FCSRCC4) +#define S_FCSRCC3 27 +#define M_FCSRCC3 (0x1 << S_FCSRCC3) +#define S_FCSRCC2 26 +#define M_FCSRCC2 (0x1 << S_FCSRCC2) +#define S_FCSRCC1 25 +#define M_FCSRCC1 (0x1 << S_FCSRCC1) + +#define S_FCSRFS 24 /* Flush denorms to zero (R/W) */ +#define M_FCSRFS (0x1 << S_FCSRFS) + +#define S_FCSRCC0 23 /* Floating point condition code 0 (R/W) */ +#define M_FCSRCC0 (0x1 << S_FCSRCC0) +#define S_FCSRCC S_FCSRCC0 +#define M_FCSRCC M_FCSRCC0 + +#define S_FCSRImpl 21 /* Implementation-specific control bits (R/W) */ +#define M_FCSRImpl (0x3 << S_FCSRImpl) + +#define S_FCSRExc 12 /* Exception cause (R/W) */ +#define M_FCSRExc (0x3f << S_FCSRExc) +#define S_FCSRExcE 17 +#define M_FCSRExcE (0x1 << S_FCSRExcE) +#define S_FCSRExcV 16 +#define M_FCSRExcV (0x1 << S_FCSRExcV) +#define S_FCSRExcZ 15 +#define M_FCSRExcZ (0x1 << S_FCSRExcZ) +#define S_FCSRExcO 14 +#define M_FCSRExcO (0x1 << S_FCSRExcO) +#define S_FCSRExcU 13 +#define M_FCSRExcU (0x1 << S_FCSRExcU) +#define S_FCSRExcI 12 +#define M_FCSRExcI (0x1 << S_FCSRExcI) + +#define S_FCSREna 7 /* Exception enable (R/W) */ +#define M_FCSREna (0x1f << S_FCSREna) +#define S_FCSREnaV 11 +#define M_FCSREnaV (0x1 << S_FCSREnaV) +#define S_FCSREnaZ 10 +#define M_FCSREnaZ (0x1 << S_FCSREnaZ) +#define S_FCSREnaO 9 +#define M_FCSREnaO (0x1 << S_FCSREnaO) +#define S_FCSREnaU 8 +#define M_FCSREnaU (0x1 << S_FCSREnaU) +#define S_FCSREnaI 7 +#define M_FCSREnaI (0x1 << S_FCSREnaI) + +#define S_FCSRFlg 2 /* Exception flags (R/W) */ +#define M_FCSRFlg (0x1f << S_FCSRFlg) +#define S_FCSRFlgV 6 +#define M_FCSRFlgV (0x1 << S_FCSRFlgV) +#define S_FCSRFlgZ 5 +#define M_FCSRFlgZ (0x1 << S_FCSRFlgZ) +#define S_FCSRFlgO 4 +#define M_FCSRFlgO (0x1 << S_FCSRFlgO) +#define S_FCSRFlgU 3 +#define M_FCSRFlgU (0x1 << S_FCSRFlgU) +#define S_FCSRFlgI 2 +#define M_FCSRFlgI (0x1 << S_FCSRFlgI) + +#define S_FCSRRM 0 /* Rounding mode (R/W) */ +#define M_FCSRRM (0x3 << S_FCSRRM) + +#define M_FCSR0Fields 0x001c0000 +#define M_FCSRRFields 0x00000000 /* * Values in the rounding mode field (of both FCSR and FCCR) */ -#define K_FCSRRM_RN 0 -#define K_FCSRRM_RZ 1 -#define K_FCSRRM_RP 2 -#define K_FCSRRM_RM 3 +#define K_FCSRRM_RN 0 +#define K_FCSRRM_RZ 1 +#define K_FCSRRM_RP 2 +#define K_FCSRRM_RM 3 #endif /* _COMMON_MIPS_DEF_H_ */ diff --git a/libcpu/mips/common/mips_excpt.h b/libcpu/mips/common/mips_excpt.h index 868b046d3..4c4362d74 100644 --- a/libcpu/mips/common/mips_excpt.h +++ b/libcpu/mips/common/mips_excpt.h @@ -1,25 +1,11 @@ /* - * File : mips_excpt.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #ifndef _MIPS_EXCPT_H_ diff --git a/libcpu/mips/common/mips_regs.h b/libcpu/mips/common/mips_regs.h index 7ea07d386..aa8b5a6cd 100644 --- a/libcpu/mips/common/mips_regs.h +++ b/libcpu/mips/common/mips_regs.h @@ -1,25 +1,11 @@ /* - * File : mips_regs.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #ifndef _MIPS_REGS_H_ @@ -31,25 +17,25 @@ #define MIPS_REG_NR 32 typedef struct { - rt_uint32_t regs[MIPS_REG_NR]; /* 32 ¸öͨÓÃÄ¿µÄ¼Ä´æÆ÷ */ - rt_uint32_t CP0Status; /* CP0 Э´¦ÀíÆ÷״̬¼Ä´æÆ÷ */ - rt_uint32_t CP0DataHI; /* ³ýÊý¸ßλ¼Ä´æÆ÷ */ - rt_uint32_t CP0DataLO; /* ³ýÊýµÍλ¼Ä´æÆ÷ */ - rt_uint32_t CP0BadVAddr; /* ³ö´íµØÖ·¼Ä´æÆ÷ */ - rt_uint32_t CP0Cause; /* ²úÉúÖжϻòÕßÒì³£²é¿´µÄ¼Ä´æÆ÷*/ - rt_uint32_t CP0EPC; /* ³ÌÐò¼ÆÊýÆ÷¼Ä´æÆ÷ */ + rt_uint32_t regs[MIPS_REG_NR]; /* 32 个通用目的寄存器 */ + rt_uint32_t CP0Status; /* CP0 å处ç†å™¨çŠ¶æ€å¯„存器 */ + rt_uint32_t CP0DataHI; /* 除数高ä½å¯„存器 */ + rt_uint32_t CP0DataLO; /* 除数低ä½å¯„存器 */ + rt_uint32_t CP0BadVAddr; /* 出错地å€å¯„存器 */ + rt_uint32_t CP0Cause; /* 产生中断或者异常查看的寄存器*/ + rt_uint32_t CP0EPC; /* 程åºè®¡æ•°å™¨å¯„存器 */ } mips_reg_ctx; #define MIPS_ARG_REG_NR 4 typedef struct { - rt_uint32_t args[MIPS_ARG_REG_NR]; /* 4 ¸ö²ÎÊý¼Ä´æÆ÷ */ + rt_uint32_t args[MIPS_ARG_REG_NR]; /* 4 个å‚数寄存器 */ } mips_arg_ctx; struct linkctx { - rt_uint32_t id; - struct linkctx *next; + rt_uint32_t id; + struct linkctx *next; }; struct fpctx @@ -65,8 +51,8 @@ struct fp32ctx struct fpctx fp; union { - double d[16]; /* even doubles */ - float s[32]; /* even singles, padded */ + double d[16]; /* even doubles */ + float s[32]; /* even singles, padded */ }; }; @@ -75,17 +61,17 @@ struct fp64ctx struct fpctx fp; union { - double d[32]; /* even doubles, followed by odd doubles */ - float s[64]; /* even singles, followed by odd singles, padded */ + double d[32]; /* even doubles, followed by odd doubles */ + float s[64]; /* even singles, followed by odd singles, padded */ }; }; #endif /* !defined(__ASSEMBLY__) && !defined(ASSEMBLY) */ -#define MIPS_STK_CTX_WORD_SIZE 38 -#define SZREG 4 +#define MIPS_STK_CTX_WORD_SIZE 38 +#define SZREG 4 /********************************************************************************************************* - MIPS µÄ¼Ä´æÆ÷Ë÷Òý + MIPS 的寄存器索引 *********************************************************************************************************/ #define REG_ZERO 0 /* wired zero */ #define REG_AT 1 /* assembler temp */ @@ -131,8 +117,8 @@ struct fp64ctx #define STK_OFFSET_LAST ((MIPS_STK_CTX_WORD_SIZE - 1) * SZREG) -#define FP32CTX_CSR ((SZREG)*2) -#define FP64CTX_CSR ((SZREG)*2) +#define FP32CTX_CSR ((SZREG)*2) +#define FP64CTX_CSR ((SZREG)*2) #define LINKCTX_ID ((SZREG)*0) #define LINKCTX_NEXT ((SZREG)*1) @@ -142,61 +128,61 @@ struct fp64ctx #define LINKCTX_TYPE_FMSA 0x463D5341 #define LINKCTX_TYPE_DSP 0x00445350 #define LINKCTX_TYPE_STKSWP 0x53574150 -#define LINKCTX_TYPE_XPA 0x00585041 - -#define FP32CTX_0 ((SZREG)*4) -#define FP32CTX_2 (FP32CTX_0 + (1 * 8)) -#define FP32CTX_4 (FP32CTX_0 + (2 * 8)) -#define FP32CTX_6 (FP32CTX_0 + (3 * 8)) -#define FP32CTX_8 (FP32CTX_0 + (4 * 8)) -#define FP32CTX_10 (FP32CTX_0 + (5 * 8)) -#define FP32CTX_12 (FP32CTX_0 + (6 * 8)) -#define FP32CTX_14 (FP32CTX_0 + (7 * 8)) -#define FP32CTX_16 (FP32CTX_0 + (8 * 8)) -#define FP32CTX_18 (FP32CTX_0 + (9 * 8)) -#define FP32CTX_20 (FP32CTX_0 + (10 * 8)) -#define FP32CTX_22 (FP32CTX_0 + (11 * 8)) -#define FP32CTX_24 (FP32CTX_0 + (12 * 8)) -#define FP32CTX_26 (FP32CTX_0 + (13 * 8)) -#define FP32CTX_28 (FP32CTX_0 + (14 * 8)) -#define FP32CTX_30 (FP32CTX_0 + (15 * 8)) -#define FP32CTX_SIZE (FP32CTX_30 + (17 * 8)) - -#define FP64CTX_0 ((SZREG)*4) -#define FP64CTX_2 (FP64CTX_0 + (1 * 8)) -#define FP64CTX_4 (FP64CTX_0 + (2 * 8)) -#define FP64CTX_6 (FP64CTX_0 + (3 * 8)) -#define FP64CTX_8 (FP64CTX_0 + (4 * 8)) -#define FP64CTX_10 (FP64CTX_0 + (5 * 8)) -#define FP64CTX_12 (FP64CTX_0 + (6 * 8)) -#define FP64CTX_14 (FP64CTX_0 + (7 * 8)) -#define FP64CTX_16 (FP64CTX_0 + (8 * 8)) -#define FP64CTX_18 (FP64CTX_0 + (9 * 8)) -#define FP64CTX_20 (FP64CTX_0 + (10 * 8)) -#define FP64CTX_22 (FP64CTX_0 + (11 * 8)) -#define FP64CTX_24 (FP64CTX_0 + (12 * 8)) -#define FP64CTX_26 (FP64CTX_0 + (13 * 8)) -#define FP64CTX_28 (FP64CTX_0 + (14 * 8)) -#define FP64CTX_30 (FP64CTX_0 + (15 * 8)) -#define FP64CTX_1 (FP64CTX_30 + (1 * 8)) -#define FP64CTX_3 (FP64CTX_30 + (2 * 8)) -#define FP64CTX_5 (FP64CTX_30 + (3 * 8)) -#define FP64CTX_7 (FP64CTX_30 + (4 * 8)) -#define FP64CTX_9 (FP64CTX_30 + (5 * 8)) -#define FP64CTX_11 (FP64CTX_30 + (6 * 8)) -#define FP64CTX_13 (FP64CTX_30 + (7 * 8)) -#define FP64CTX_15 (FP64CTX_30 + (8 * 8)) -#define FP64CTX_17 (FP64CTX_30 + (9 * 8)) -#define FP64CTX_19 (FP64CTX_30 + (10 * 8)) -#define FP64CTX_21 (FP64CTX_30 + (11 * 8)) -#define FP64CTX_23 (FP64CTX_30 + (12 * 8)) -#define FP64CTX_25 (FP64CTX_30 + (13 * 8)) -#define FP64CTX_27 (FP64CTX_30 + (14 * 8)) -#define FP64CTX_29 (FP64CTX_30 + (15 * 8)) -#define FP64CTX_31 (FP64CTX_30 + (16 * 8)) -#define FP64CTX_SIZE (FP64CTX_31 + (17 * 8)) - -#define FPCTX_SIZE() (mips_getsr() & ST0_FR ? FP64CTX_SIZE : FP32CTX_SIZE) +#define LINKCTX_TYPE_XPA 0x00585041 + +#define FP32CTX_0 ((SZREG)*4) +#define FP32CTX_2 (FP32CTX_0 + (1 * 8)) +#define FP32CTX_4 (FP32CTX_0 + (2 * 8)) +#define FP32CTX_6 (FP32CTX_0 + (3 * 8)) +#define FP32CTX_8 (FP32CTX_0 + (4 * 8)) +#define FP32CTX_10 (FP32CTX_0 + (5 * 8)) +#define FP32CTX_12 (FP32CTX_0 + (6 * 8)) +#define FP32CTX_14 (FP32CTX_0 + (7 * 8)) +#define FP32CTX_16 (FP32CTX_0 + (8 * 8)) +#define FP32CTX_18 (FP32CTX_0 + (9 * 8)) +#define FP32CTX_20 (FP32CTX_0 + (10 * 8)) +#define FP32CTX_22 (FP32CTX_0 + (11 * 8)) +#define FP32CTX_24 (FP32CTX_0 + (12 * 8)) +#define FP32CTX_26 (FP32CTX_0 + (13 * 8)) +#define FP32CTX_28 (FP32CTX_0 + (14 * 8)) +#define FP32CTX_30 (FP32CTX_0 + (15 * 8)) +#define FP32CTX_SIZE (FP32CTX_30 + (17 * 8)) + +#define FP64CTX_0 ((SZREG)*4) +#define FP64CTX_2 (FP64CTX_0 + (1 * 8)) +#define FP64CTX_4 (FP64CTX_0 + (2 * 8)) +#define FP64CTX_6 (FP64CTX_0 + (3 * 8)) +#define FP64CTX_8 (FP64CTX_0 + (4 * 8)) +#define FP64CTX_10 (FP64CTX_0 + (5 * 8)) +#define FP64CTX_12 (FP64CTX_0 + (6 * 8)) +#define FP64CTX_14 (FP64CTX_0 + (7 * 8)) +#define FP64CTX_16 (FP64CTX_0 + (8 * 8)) +#define FP64CTX_18 (FP64CTX_0 + (9 * 8)) +#define FP64CTX_20 (FP64CTX_0 + (10 * 8)) +#define FP64CTX_22 (FP64CTX_0 + (11 * 8)) +#define FP64CTX_24 (FP64CTX_0 + (12 * 8)) +#define FP64CTX_26 (FP64CTX_0 + (13 * 8)) +#define FP64CTX_28 (FP64CTX_0 + (14 * 8)) +#define FP64CTX_30 (FP64CTX_0 + (15 * 8)) +#define FP64CTX_1 (FP64CTX_30 + (1 * 8)) +#define FP64CTX_3 (FP64CTX_30 + (2 * 8)) +#define FP64CTX_5 (FP64CTX_30 + (3 * 8)) +#define FP64CTX_7 (FP64CTX_30 + (4 * 8)) +#define FP64CTX_9 (FP64CTX_30 + (5 * 8)) +#define FP64CTX_11 (FP64CTX_30 + (6 * 8)) +#define FP64CTX_13 (FP64CTX_30 + (7 * 8)) +#define FP64CTX_15 (FP64CTX_30 + (8 * 8)) +#define FP64CTX_17 (FP64CTX_30 + (9 * 8)) +#define FP64CTX_19 (FP64CTX_30 + (10 * 8)) +#define FP64CTX_21 (FP64CTX_30 + (11 * 8)) +#define FP64CTX_23 (FP64CTX_30 + (12 * 8)) +#define FP64CTX_25 (FP64CTX_30 + (13 * 8)) +#define FP64CTX_27 (FP64CTX_30 + (14 * 8)) +#define FP64CTX_29 (FP64CTX_30 + (15 * 8)) +#define FP64CTX_31 (FP64CTX_30 + (16 * 8)) +#define FP64CTX_SIZE (FP64CTX_31 + (17 * 8)) + +#define FPCTX_SIZE() (mips_getsr() & ST0_FR ? FP64CTX_SIZE : FP32CTX_SIZE) /* * The following macros are especially useful for __asm__ @@ -279,7 +265,7 @@ struct fp64ctx /* * TX39 Series */ -#define CP0_TX39_CACHE $7 +#define CP0_TX39_CACHE $7 /* * Coprocessor 1 (FPU) register names @@ -346,38 +332,38 @@ struct fp64ctx /* Why doesn't stupidity hurt ... */ -#define PM_1K 0x00000000 -#define PM_4K 0x00001800 -#define PM_16K 0x00007800 -#define PM_64K 0x0001f800 -#define PM_256K 0x0007f800 +#define PM_1K 0x00000000 +#define PM_4K 0x00001800 +#define PM_16K 0x00007800 +#define PM_64K 0x0001f800 +#define PM_256K 0x0007f800 #else -#define PM_4K 0x00000000 -#define PM_16K 0x00006000 -#define PM_64K 0x0001e000 -#define PM_256K 0x0007e000 -#define PM_1M 0x001fe000 -#define PM_4M 0x007fe000 -#define PM_16M 0x01ffe000 -#define PM_64M 0x07ffe000 -#define PM_256M 0x1fffe000 +#define PM_4K 0x00000000 +#define PM_16K 0x00006000 +#define PM_64K 0x0001e000 +#define PM_256K 0x0007e000 +#define PM_1M 0x001fe000 +#define PM_4M 0x007fe000 +#define PM_16M 0x01ffe000 +#define PM_64M 0x07ffe000 +#define PM_256M 0x1fffe000 #endif /* * Values used for computation of new tlb entries */ -#define PL_4K 12 -#define PL_16K 14 -#define PL_64K 16 -#define PL_256K 18 -#define PL_1M 20 -#define PL_4M 22 -#define PL_16M 24 -#define PL_64M 26 -#define PL_256M 28 +#define PL_4K 12 +#define PL_16K 14 +#define PL_64K 16 +#define PL_256K 18 +#define PL_1M 20 +#define PL_4M 22 +#define PL_16M 24 +#define PL_64M 26 +#define PL_256M 28 /* * R4x00 interrupt enable / cause bits @@ -406,234 +392,234 @@ struct fp64ctx /* * Bitfields in the R4xx0 cp0 status register */ -#define ST0_IE 0x00000001 -#define ST0_EXL 0x00000002 -#define ST0_ERL 0x00000004 -#define ST0_KSU 0x00000018 -# define KSU_USER 0x00000010 -# define KSU_SUPERVISOR 0x00000008 -# define KSU_KERNEL 0x00000000 -#define ST0_UX 0x00000020 -#define ST0_SX 0x00000040 -#define ST0_KX 0x00000080 -#define ST0_DE 0x00010000 -#define ST0_CE 0x00020000 +#define ST0_IE 0x00000001 +#define ST0_EXL 0x00000002 +#define ST0_ERL 0x00000004 +#define ST0_KSU 0x00000018 +# define KSU_USER 0x00000010 +# define KSU_SUPERVISOR 0x00000008 +# define KSU_KERNEL 0x00000000 +#define ST0_UX 0x00000020 +#define ST0_SX 0x00000040 +#define ST0_KX 0x00000080 +#define ST0_DE 0x00010000 +#define ST0_CE 0x00020000 /* * Bitfields in the R[23]000 cp0 status register. */ #define ST0_IEC 0x00000001 -#define ST0_KUC 0x00000002 -#define ST0_IEP 0x00000004 -#define ST0_KUP 0x00000008 -#define ST0_IEO 0x00000010 -#define ST0_KUO 0x00000020 +#define ST0_KUC 0x00000002 +#define ST0_IEP 0x00000004 +#define ST0_KUP 0x00000008 +#define ST0_IEO 0x00000010 +#define ST0_KUO 0x00000020 /* bits 6 & 7 are reserved on R[23]000 */ -#define ST0_ISC 0x00010000 -#define ST0_SWC 0x00020000 -#define ST0_CM 0x00080000 +#define ST0_ISC 0x00010000 +#define ST0_SWC 0x00020000 +#define ST0_CM 0x00080000 /* * Bits specific to the R4640/R4650 */ -#define ST0_UM (_ULCAST_(1) << 4) -#define ST0_IL (_ULCAST_(1) << 23) -#define ST0_DL (_ULCAST_(1) << 24) +#define ST0_UM (_ULCAST_(1) << 4) +#define ST0_IL (_ULCAST_(1) << 23) +#define ST0_DL (_ULCAST_(1) << 24) /* * Bitfields in the TX39 family CP0 Configuration Register 3 */ -#define TX39_CONF_ICS_SHIFT 19 -#define TX39_CONF_ICS_MASK 0x00380000 -#define TX39_CONF_ICS_1KB 0x00000000 -#define TX39_CONF_ICS_2KB 0x00080000 -#define TX39_CONF_ICS_4KB 0x00100000 -#define TX39_CONF_ICS_8KB 0x00180000 -#define TX39_CONF_ICS_16KB 0x00200000 - -#define TX39_CONF_DCS_SHIFT 16 -#define TX39_CONF_DCS_MASK 0x00070000 -#define TX39_CONF_DCS_1KB 0x00000000 -#define TX39_CONF_DCS_2KB 0x00010000 -#define TX39_CONF_DCS_4KB 0x00020000 -#define TX39_CONF_DCS_8KB 0x00030000 -#define TX39_CONF_DCS_16KB 0x00040000 - -#define TX39_CONF_CWFON 0x00004000 -#define TX39_CONF_WBON 0x00002000 -#define TX39_CONF_RF_SHIFT 10 -#define TX39_CONF_RF_MASK 0x00000c00 -#define TX39_CONF_DOZE 0x00000200 -#define TX39_CONF_HALT 0x00000100 -#define TX39_CONF_LOCK 0x00000080 -#define TX39_CONF_ICE 0x00000020 -#define TX39_CONF_DCE 0x00000010 -#define TX39_CONF_IRSIZE_SHIFT 2 -#define TX39_CONF_IRSIZE_MASK 0x0000000c -#define TX39_CONF_DRSIZE_SHIFT 0 -#define TX39_CONF_DRSIZE_MASK 0x00000003 +#define TX39_CONF_ICS_SHIFT 19 +#define TX39_CONF_ICS_MASK 0x00380000 +#define TX39_CONF_ICS_1KB 0x00000000 +#define TX39_CONF_ICS_2KB 0x00080000 +#define TX39_CONF_ICS_4KB 0x00100000 +#define TX39_CONF_ICS_8KB 0x00180000 +#define TX39_CONF_ICS_16KB 0x00200000 + +#define TX39_CONF_DCS_SHIFT 16 +#define TX39_CONF_DCS_MASK 0x00070000 +#define TX39_CONF_DCS_1KB 0x00000000 +#define TX39_CONF_DCS_2KB 0x00010000 +#define TX39_CONF_DCS_4KB 0x00020000 +#define TX39_CONF_DCS_8KB 0x00030000 +#define TX39_CONF_DCS_16KB 0x00040000 + +#define TX39_CONF_CWFON 0x00004000 +#define TX39_CONF_WBON 0x00002000 +#define TX39_CONF_RF_SHIFT 10 +#define TX39_CONF_RF_MASK 0x00000c00 +#define TX39_CONF_DOZE 0x00000200 +#define TX39_CONF_HALT 0x00000100 +#define TX39_CONF_LOCK 0x00000080 +#define TX39_CONF_ICE 0x00000020 +#define TX39_CONF_DCE 0x00000010 +#define TX39_CONF_IRSIZE_SHIFT 2 +#define TX39_CONF_IRSIZE_MASK 0x0000000c +#define TX39_CONF_DRSIZE_SHIFT 0 +#define TX39_CONF_DRSIZE_MASK 0x00000003 /* * Status register bits available in all MIPS CPUs. */ -#define ST0_IM 0x0000ff00 -#define STATUSB_IP0 8 -#define STATUSF_IP0 (_ULCAST_(1) << 8) -#define STATUSB_IP1 9 -#define STATUSF_IP1 (_ULCAST_(1) << 9) -#define STATUSB_IP2 10 -#define STATUSF_IP2 (_ULCAST_(1) << 10) -#define STATUSB_IP3 11 -#define STATUSF_IP3 (_ULCAST_(1) << 11) -#define STATUSB_IP4 12 -#define STATUSF_IP4 (_ULCAST_(1) << 12) -#define STATUSB_IP5 13 -#define STATUSF_IP5 (_ULCAST_(1) << 13) -#define STATUSB_IP6 14 -#define STATUSF_IP6 (_ULCAST_(1) << 14) -#define STATUSB_IP7 15 -#define STATUSF_IP7 (_ULCAST_(1) << 15) -#define STATUSB_IP8 0 -#define STATUSF_IP8 (_ULCAST_(1) << 0) -#define STATUSB_IP9 1 -#define STATUSF_IP9 (_ULCAST_(1) << 1) -#define STATUSB_IP10 2 -#define STATUSF_IP10 (_ULCAST_(1) << 2) -#define STATUSB_IP11 3 -#define STATUSF_IP11 (_ULCAST_(1) << 3) -#define STATUSB_IP12 4 -#define STATUSF_IP12 (_ULCAST_(1) << 4) -#define STATUSB_IP13 5 -#define STATUSF_IP13 (_ULCAST_(1) << 5) -#define STATUSB_IP14 6 -#define STATUSF_IP14 (_ULCAST_(1) << 6) -#define STATUSB_IP15 7 -#define STATUSF_IP15 (_ULCAST_(1) << 7) -#define ST0_CH 0x00040000 -#define ST0_SR 0x00100000 -#define ST0_TS 0x00200000 -#define ST0_BEV 0x00400000 -#define ST0_RE 0x02000000 -#define ST0_FR 0x04000000 -#define ST0_CU 0xf0000000 -#define ST0_CU0 0x10000000 -#define ST0_CU1 0x20000000 -#define ST0_CU1_SHIFT 29 -#define ST0_CU2 0x40000000 -#define ST0_CU3 0x80000000 -#define ST0_XX 0x80000000 /* MIPS IV naming */ +#define ST0_IM 0x0000ff00 +#define STATUSB_IP0 8 +#define STATUSF_IP0 (_ULCAST_(1) << 8) +#define STATUSB_IP1 9 +#define STATUSF_IP1 (_ULCAST_(1) << 9) +#define STATUSB_IP2 10 +#define STATUSF_IP2 (_ULCAST_(1) << 10) +#define STATUSB_IP3 11 +#define STATUSF_IP3 (_ULCAST_(1) << 11) +#define STATUSB_IP4 12 +#define STATUSF_IP4 (_ULCAST_(1) << 12) +#define STATUSB_IP5 13 +#define STATUSF_IP5 (_ULCAST_(1) << 13) +#define STATUSB_IP6 14 +#define STATUSF_IP6 (_ULCAST_(1) << 14) +#define STATUSB_IP7 15 +#define STATUSF_IP7 (_ULCAST_(1) << 15) +#define STATUSB_IP8 0 +#define STATUSF_IP8 (_ULCAST_(1) << 0) +#define STATUSB_IP9 1 +#define STATUSF_IP9 (_ULCAST_(1) << 1) +#define STATUSB_IP10 2 +#define STATUSF_IP10 (_ULCAST_(1) << 2) +#define STATUSB_IP11 3 +#define STATUSF_IP11 (_ULCAST_(1) << 3) +#define STATUSB_IP12 4 +#define STATUSF_IP12 (_ULCAST_(1) << 4) +#define STATUSB_IP13 5 +#define STATUSF_IP13 (_ULCAST_(1) << 5) +#define STATUSB_IP14 6 +#define STATUSF_IP14 (_ULCAST_(1) << 6) +#define STATUSB_IP15 7 +#define STATUSF_IP15 (_ULCAST_(1) << 7) +#define ST0_CH 0x00040000 +#define ST0_SR 0x00100000 +#define ST0_TS 0x00200000 +#define ST0_BEV 0x00400000 +#define ST0_RE 0x02000000 +#define ST0_FR 0x04000000 +#define ST0_CU 0xf0000000 +#define ST0_CU0 0x10000000 +#define ST0_CU1 0x20000000 +#define ST0_CU1_SHIFT 29 +#define ST0_CU2 0x40000000 +#define ST0_CU3 0x80000000 +#define ST0_XX 0x80000000 /* MIPS IV naming */ /* * Bitfields and bit numbers in the coprocessor 0 cause register. * * Refer to your MIPS R4xx0 manual, chapter 5 for explanation. */ -#define CAUSEB_EXCCODE 2 -#define CAUSEF_EXCCODE (_ULCAST_(31) << 2) -#define CAUSEB_IP 8 -#define CAUSEF_IP (_ULCAST_(255) << 8) -#define CAUSEB_IP0 8 -#define CAUSEF_IP0 (_ULCAST_(1) << 8) -#define CAUSEB_IP1 9 -#define CAUSEF_IP1 (_ULCAST_(1) << 9) -#define CAUSEB_IP2 10 -#define CAUSEF_IP2 (_ULCAST_(1) << 10) -#define CAUSEB_IP3 11 -#define CAUSEF_IP3 (_ULCAST_(1) << 11) -#define CAUSEB_IP4 12 -#define CAUSEF_IP4 (_ULCAST_(1) << 12) -#define CAUSEB_IP5 13 -#define CAUSEF_IP5 (_ULCAST_(1) << 13) -#define CAUSEB_IP6 14 -#define CAUSEF_IP6 (_ULCAST_(1) << 14) -#define CAUSEB_IP7 15 -#define CAUSEF_IP7 (_ULCAST_(1) << 15) -#define CAUSEB_IV 23 -#define CAUSEF_IV (_ULCAST_(1) << 23) -#define CAUSEB_CE 28 -#define CAUSEF_CE (_ULCAST_(3) << 28) -#define CAUSEB_BD 31 -#define CAUSEF_BD (_ULCAST_(1) << 31) +#define CAUSEB_EXCCODE 2 +#define CAUSEF_EXCCODE (_ULCAST_(31) << 2) +#define CAUSEB_IP 8 +#define CAUSEF_IP (_ULCAST_(255) << 8) +#define CAUSEB_IP0 8 +#define CAUSEF_IP0 (_ULCAST_(1) << 8) +#define CAUSEB_IP1 9 +#define CAUSEF_IP1 (_ULCAST_(1) << 9) +#define CAUSEB_IP2 10 +#define CAUSEF_IP2 (_ULCAST_(1) << 10) +#define CAUSEB_IP3 11 +#define CAUSEF_IP3 (_ULCAST_(1) << 11) +#define CAUSEB_IP4 12 +#define CAUSEF_IP4 (_ULCAST_(1) << 12) +#define CAUSEB_IP5 13 +#define CAUSEF_IP5 (_ULCAST_(1) << 13) +#define CAUSEB_IP6 14 +#define CAUSEF_IP6 (_ULCAST_(1) << 14) +#define CAUSEB_IP7 15 +#define CAUSEF_IP7 (_ULCAST_(1) << 15) +#define CAUSEB_IV 23 +#define CAUSEF_IV (_ULCAST_(1) << 23) +#define CAUSEB_CE 28 +#define CAUSEF_CE (_ULCAST_(3) << 28) +#define CAUSEB_BD 31 +#define CAUSEF_BD (_ULCAST_(1) << 31) /* * Bits in the coprocessor 0 config register. */ /* Generic bits. */ -#define CONF_CM_CACHABLE_NO_WA 0 -#define CONF_CM_CACHABLE_WA 1 -#define CONF_CM_UNCACHED 2 -#define CONF_CM_CACHABLE_NONCOHERENT 3 -#define CONF_CM_CACHABLE_CE 4 -#define CONF_CM_CACHABLE_COW 5 -#define CONF_CM_CACHABLE_CUW 6 -#define CONF_CM_CACHABLE_ACCELERATED 7 -#define CONF_CM_CMASK 7 -#define CONF_BE (_ULCAST_(1) << 15) +#define CONF_CM_CACHABLE_NO_WA 0 +#define CONF_CM_CACHABLE_WA 1 +#define CONF_CM_UNCACHED 2 +#define CONF_CM_CACHABLE_NONCOHERENT 3 +#define CONF_CM_CACHABLE_CE 4 +#define CONF_CM_CACHABLE_COW 5 +#define CONF_CM_CACHABLE_CUW 6 +#define CONF_CM_CACHABLE_ACCELERATED 7 +#define CONF_CM_CMASK 7 +#define CONF_BE (_ULCAST_(1) << 15) /* Bits common to various processors. */ -#define CONF_CU (_ULCAST_(1) << 3) -#define CONF_DB (_ULCAST_(1) << 4) -#define CONF_IB (_ULCAST_(1) << 5) -#define CONF_DC (_ULCAST_(7) << 6) -#define CONF_IC (_ULCAST_(7) << 9) -#define CONF_EB (_ULCAST_(1) << 13) -#define CONF_EM (_ULCAST_(1) << 14) -#define CONF_SM (_ULCAST_(1) << 16) -#define CONF_SC (_ULCAST_(1) << 17) -#define CONF_EW (_ULCAST_(3) << 18) -#define CONF_EP (_ULCAST_(15)<< 24) -#define CONF_EC (_ULCAST_(7) << 28) -#define CONF_CM (_ULCAST_(1) << 31) +#define CONF_CU (_ULCAST_(1) << 3) +#define CONF_DB (_ULCAST_(1) << 4) +#define CONF_IB (_ULCAST_(1) << 5) +#define CONF_DC (_ULCAST_(7) << 6) +#define CONF_IC (_ULCAST_(7) << 9) +#define CONF_EB (_ULCAST_(1) << 13) +#define CONF_EM (_ULCAST_(1) << 14) +#define CONF_SM (_ULCAST_(1) << 16) +#define CONF_SC (_ULCAST_(1) << 17) +#define CONF_EW (_ULCAST_(3) << 18) +#define CONF_EP (_ULCAST_(15)<< 24) +#define CONF_EC (_ULCAST_(7) << 28) +#define CONF_CM (_ULCAST_(1) << 31) /* Bits specific to the R4xx0. */ -#define R4K_CONF_SW (_ULCAST_(1) << 20) -#define R4K_CONF_SS (_ULCAST_(1) << 21) -#define R4K_CONF_SB (_ULCAST_(3) << 22) +#define R4K_CONF_SW (_ULCAST_(1) << 20) +#define R4K_CONF_SS (_ULCAST_(1) << 21) +#define R4K_CONF_SB (_ULCAST_(3) << 22) /* Bits specific to the R5000. */ -#define R5K_CONF_SE (_ULCAST_(1) << 12) -#define R5K_CONF_SS (_ULCAST_(3) << 20) +#define R5K_CONF_SE (_ULCAST_(1) << 12) +#define R5K_CONF_SS (_ULCAST_(3) << 20) /* Bits specific to the R10000. */ -#define R10K_CONF_DN (_ULCAST_(3) << 3) -#define R10K_CONF_CT (_ULCAST_(1) << 5) -#define R10K_CONF_PE (_ULCAST_(1) << 6) -#define R10K_CONF_PM (_ULCAST_(3) << 7) -#define R10K_CONF_EC (_ULCAST_(15)<< 9) -#define R10K_CONF_SB (_ULCAST_(1) << 13) -#define R10K_CONF_SK (_ULCAST_(1) << 14) -#define R10K_CONF_SS (_ULCAST_(7) << 16) -#define R10K_CONF_SC (_ULCAST_(7) << 19) -#define R10K_CONF_DC (_ULCAST_(7) << 26) -#define R10K_CONF_IC (_ULCAST_(7) << 29) +#define R10K_CONF_DN (_ULCAST_(3) << 3) +#define R10K_CONF_CT (_ULCAST_(1) << 5) +#define R10K_CONF_PE (_ULCAST_(1) << 6) +#define R10K_CONF_PM (_ULCAST_(3) << 7) +#define R10K_CONF_EC (_ULCAST_(15)<< 9) +#define R10K_CONF_SB (_ULCAST_(1) << 13) +#define R10K_CONF_SK (_ULCAST_(1) << 14) +#define R10K_CONF_SS (_ULCAST_(7) << 16) +#define R10K_CONF_SC (_ULCAST_(7) << 19) +#define R10K_CONF_DC (_ULCAST_(7) << 26) +#define R10K_CONF_IC (_ULCAST_(7) << 29) /* Bits specific to the VR41xx. */ -#define VR41_CONF_CS (_ULCAST_(1) << 12) -#define VR41_CONF_M16 (_ULCAST_(1) << 20) -#define VR41_CONF_AD (_ULCAST_(1) << 23) +#define VR41_CONF_CS (_ULCAST_(1) << 12) +#define VR41_CONF_M16 (_ULCAST_(1) << 20) +#define VR41_CONF_AD (_ULCAST_(1) << 23) /* Bits specific to the R30xx. */ -#define R30XX_CONF_FDM (_ULCAST_(1) << 19) -#define R30XX_CONF_REV (_ULCAST_(1) << 22) -#define R30XX_CONF_AC (_ULCAST_(1) << 23) -#define R30XX_CONF_RF (_ULCAST_(1) << 24) -#define R30XX_CONF_HALT (_ULCAST_(1) << 25) -#define R30XX_CONF_FPINT (_ULCAST_(7) << 26) -#define R30XX_CONF_DBR (_ULCAST_(1) << 29) -#define R30XX_CONF_SB (_ULCAST_(1) << 30) -#define R30XX_CONF_LOCK (_ULCAST_(1) << 31) +#define R30XX_CONF_FDM (_ULCAST_(1) << 19) +#define R30XX_CONF_REV (_ULCAST_(1) << 22) +#define R30XX_CONF_AC (_ULCAST_(1) << 23) +#define R30XX_CONF_RF (_ULCAST_(1) << 24) +#define R30XX_CONF_HALT (_ULCAST_(1) << 25) +#define R30XX_CONF_FPINT (_ULCAST_(7) << 26) +#define R30XX_CONF_DBR (_ULCAST_(1) << 29) +#define R30XX_CONF_SB (_ULCAST_(1) << 30) +#define R30XX_CONF_LOCK (_ULCAST_(1) << 31) /* Bits specific to the TX49. */ -#define TX49_CONF_DC (_ULCAST_(1) << 16) -#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */ -#define TX49_CONF_HALT (_ULCAST_(1) << 18) -#define TX49_CONF_CWFON (_ULCAST_(1) << 27) +#define TX49_CONF_DC (_ULCAST_(1) << 16) +#define TX49_CONF_IC (_ULCAST_(1) << 17) /* conflict with CONF_SC */ +#define TX49_CONF_HALT (_ULCAST_(1) << 18) +#define TX49_CONF_CWFON (_ULCAST_(1) << 27) /* Bits specific to the MIPS32/64 PRA. */ -#define MIPS_CONF_MT (_ULCAST_(7) << 7) -#define MIPS_CONF_AR (_ULCAST_(7) << 10) -#define MIPS_CONF_AT (_ULCAST_(3) << 13) -#define MIPS_CONF_M (_ULCAST_(1) << 31) +#define MIPS_CONF_MT (_ULCAST_(7) << 7) +#define MIPS_CONF_AR (_ULCAST_(7) << 10) +#define MIPS_CONF_AT (_ULCAST_(3) << 13) +#define MIPS_CONF_M (_ULCAST_(1) << 31) /* * R10000 performance counter definitions. @@ -646,50 +632,50 @@ struct fp64ctx /* * Events counted by counter #0 */ -#define CE0_CYCLES 0 -#define CE0_INSN_ISSUED 1 -#define CE0_LPSC_ISSUED 2 -#define CE0_S_ISSUED 3 -#define CE0_SC_ISSUED 4 -#define CE0_SC_FAILED 5 -#define CE0_BRANCH_DECODED 6 -#define CE0_QW_WB_SECONDARY 7 -#define CE0_CORRECTED_ECC_ERRORS 8 -#define CE0_ICACHE_MISSES 9 -#define CE0_SCACHE_I_MISSES 10 -#define CE0_SCACHE_I_WAY_MISSPREDICTED 11 -#define CE0_EXT_INTERVENTIONS_REQ 12 -#define CE0_EXT_INVALIDATE_REQ 13 -#define CE0_VIRTUAL_COHERENCY_COND 14 -#define CE0_INSN_GRADUATED 15 +#define CE0_CYCLES 0 +#define CE0_INSN_ISSUED 1 +#define CE0_LPSC_ISSUED 2 +#define CE0_S_ISSUED 3 +#define CE0_SC_ISSUED 4 +#define CE0_SC_FAILED 5 +#define CE0_BRANCH_DECODED 6 +#define CE0_QW_WB_SECONDARY 7 +#define CE0_CORRECTED_ECC_ERRORS 8 +#define CE0_ICACHE_MISSES 9 +#define CE0_SCACHE_I_MISSES 10 +#define CE0_SCACHE_I_WAY_MISSPREDICTED 11 +#define CE0_EXT_INTERVENTIONS_REQ 12 +#define CE0_EXT_INVALIDATE_REQ 13 +#define CE0_VIRTUAL_COHERENCY_COND 14 +#define CE0_INSN_GRADUATED 15 /* * Events counted by counter #1 */ -#define CE1_CYCLES 0 -#define CE1_INSN_GRADUATED 1 -#define CE1_LPSC_GRADUATED 2 -#define CE1_S_GRADUATED 3 -#define CE1_SC_GRADUATED 4 -#define CE1_FP_INSN_GRADUATED 5 -#define CE1_QW_WB_PRIMARY 6 -#define CE1_TLB_REFILL 7 -#define CE1_BRANCH_MISSPREDICTED 8 -#define CE1_DCACHE_MISS 9 -#define CE1_SCACHE_D_MISSES 10 -#define CE1_SCACHE_D_WAY_MISSPREDICTED 11 -#define CE1_EXT_INTERVENTION_HITS 12 -#define CE1_EXT_INVALIDATE_REQ 13 -#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14 -#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15 +#define CE1_CYCLES 0 +#define CE1_INSN_GRADUATED 1 +#define CE1_LPSC_GRADUATED 2 +#define CE1_S_GRADUATED 3 +#define CE1_SC_GRADUATED 4 +#define CE1_FP_INSN_GRADUATED 5 +#define CE1_QW_WB_PRIMARY 6 +#define CE1_TLB_REFILL 7 +#define CE1_BRANCH_MISSPREDICTED 8 +#define CE1_DCACHE_MISS 9 +#define CE1_SCACHE_D_MISSES 10 +#define CE1_SCACHE_D_WAY_MISSPREDICTED 11 +#define CE1_EXT_INTERVENTION_HITS 12 +#define CE1_EXT_INVALIDATE_REQ 13 +#define CE1_SP_HINT_TO_CEXCL_SC_BLOCKS 14 +#define CE1_SP_HINT_TO_SHARED_SC_BLOCKS 15 /* * These flags define in which priviledge mode the counters count events */ -#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */ -#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */ -#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */ -#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */ +#define CEB_USER 8 /* Count events in user mode, EXL = ERL = 0 */ +#define CEB_SUPERVISOR 4 /* Count events in supvervisor mode EXL = ERL = 0 */ +#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */ +#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */ #ifndef __ASSEMBLY__ @@ -727,272 +713,272 @@ struct fp64ctx * Macros to access the system control coprocessor */ -#define __read_32bit_c0_register(source, sel) \ -({ int __res; \ - if (sel == 0) \ - __asm__ __volatile__( \ - "mfc0\t%0, " #source "\n\t" \ - : "=r" (__res)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips32\n\t" \ - "mfc0\t%0, " #source ", " #sel "\n\t" \ - ".set\tmips0\n\t" \ - : "=r" (__res)); \ - __res; \ +#define __read_32bit_c0_register(source, sel) \ +({ int __res; \ + if (sel == 0) \ + __asm__ __volatile__( \ + "mfc0\t%0, " #source "\n\t" \ + : "=r" (__res)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips32\n\t" \ + "mfc0\t%0, " #source ", " #sel "\n\t" \ + ".set\tmips0\n\t" \ + : "=r" (__res)); \ + __res; \ }) -#define __read_64bit_c0_register(source, sel) \ -({ unsigned long __res; \ - if (sel == 0) \ - __asm__ __volatile__( \ - ".set\tmips3\n\t" \ - "dmfc0\t%0, " #source "\n\t" \ - ".set\tmips0" \ - : "=r" (__res)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dmfc0\t%0, " #source ", " #sel "\n\t" \ - ".set\tmips0" \ - : "=r" (__res)); \ - __res; \ +#define __read_64bit_c0_register(source, sel) \ +({ unsigned long __res; \ + if (sel == 0) \ + __asm__ __volatile__( \ + ".set\tmips3\n\t" \ + "dmfc0\t%0, " #source "\n\t" \ + ".set\tmips0" \ + : "=r" (__res)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dmfc0\t%0, " #source ", " #sel "\n\t" \ + ".set\tmips0" \ + : "=r" (__res)); \ + __res; \ }) -#define __write_32bit_c0_register(register, sel, value) \ -do { \ - if (sel == 0) \ - __asm__ __volatile__( \ - "mtc0\t%z0, " #register "\n\t" \ - : : "Jr" (value)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips32\n\t" \ - "mtc0\t%z0, " #register ", " #sel "\n\t" \ - ".set\tmips0" \ - : : "Jr" (value)); \ +#define __write_32bit_c0_register(register, sel, value) \ +do { \ + if (sel == 0) \ + __asm__ __volatile__( \ + "mtc0\t%z0, " #register "\n\t" \ + : : "Jr" (value)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips32\n\t" \ + "mtc0\t%z0, " #register ", " #sel "\n\t" \ + ".set\tmips0" \ + : : "Jr" (value)); \ } while (0) -#define __write_64bit_c0_register(register, sel, value) \ -do { \ - if (sel == 0) \ - __asm__ __volatile__( \ - ".set\tmips3\n\t" \ - "dmtc0\t%z0, " #register "\n\t" \ - ".set\tmips0" \ - : : "Jr" (value)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dmtc0\t%z0, " #register ", " #sel "\n\t" \ - ".set\tmips0" \ - : : "Jr" (value)); \ +#define __write_64bit_c0_register(register, sel, value) \ +do { \ + if (sel == 0) \ + __asm__ __volatile__( \ + ".set\tmips3\n\t" \ + "dmtc0\t%z0, " #register "\n\t" \ + ".set\tmips0" \ + : : "Jr" (value)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dmtc0\t%z0, " #register ", " #sel "\n\t" \ + ".set\tmips0" \ + : : "Jr" (value)); \ } while (0) -#define __read_ulong_c0_register(reg, sel) \ - ((sizeof(unsigned long) == 4) ? \ - __read_32bit_c0_register(reg, sel) : \ - __read_64bit_c0_register(reg, sel)) - -#define __write_ulong_c0_register(reg, sel, val) \ -do { \ - if (sizeof(unsigned long) == 4) \ - __write_32bit_c0_register(reg, sel, val); \ - else \ - __write_64bit_c0_register(reg, sel, val); \ +#define __read_ulong_c0_register(reg, sel) \ + ((sizeof(unsigned long) == 4) ? \ + __read_32bit_c0_register(reg, sel) : \ + __read_64bit_c0_register(reg, sel)) + +#define __write_ulong_c0_register(reg, sel, val) \ +do { \ + if (sizeof(unsigned long) == 4) \ + __write_32bit_c0_register(reg, sel, val); \ + else \ + __write_64bit_c0_register(reg, sel, val); \ } while (0) /* * These versions are only needed for systems with more than 38 bits of * physical address space running the 32-bit kernel. That's none atm :-) */ -#define __read_64bit_c0_split(source, sel) \ -({ \ - unsigned long long val; \ - unsigned long flags; \ - \ - local_irq_save(flags); \ - if (sel == 0) \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dmfc0\t%M0, " #source "\n\t" \ - "dsll\t%L0, %M0, 32\n\t" \ - "dsrl\t%M0, %M0, 32\n\t" \ - "dsrl\t%L0, %L0, 32\n\t" \ - ".set\tmips0" \ - : "=r" (val)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dmfc0\t%M0, " #source ", " #sel "\n\t" \ - "dsll\t%L0, %M0, 32\n\t" \ - "dsrl\t%M0, %M0, 32\n\t" \ - "dsrl\t%L0, %L0, 32\n\t" \ - ".set\tmips0" \ - : "=r" (val)); \ - local_irq_restore(flags); \ - \ - val; \ +#define __read_64bit_c0_split(source, sel) \ +({ \ + unsigned long long val; \ + unsigned long flags; \ + \ + local_irq_save(flags); \ + if (sel == 0) \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dmfc0\t%M0, " #source "\n\t" \ + "dsll\t%L0, %M0, 32\n\t" \ + "dsrl\t%M0, %M0, 32\n\t" \ + "dsrl\t%L0, %L0, 32\n\t" \ + ".set\tmips0" \ + : "=r" (val)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dmfc0\t%M0, " #source ", " #sel "\n\t" \ + "dsll\t%L0, %M0, 32\n\t" \ + "dsrl\t%M0, %M0, 32\n\t" \ + "dsrl\t%L0, %L0, 32\n\t" \ + ".set\tmips0" \ + : "=r" (val)); \ + local_irq_restore(flags); \ + \ + val; \ }) -#define __write_64bit_c0_split(source, sel, val) \ -do { \ - unsigned long flags; \ - \ - local_irq_save(flags); \ - if (sel == 0) \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dsll\t%L0, %L0, 32\n\t" \ - "dsrl\t%L0, %L0, 32\n\t" \ - "dsll\t%M0, %M0, 32\n\t" \ - "or\t%L0, %L0, %M0\n\t" \ - "dmtc0\t%L0, " #source "\n\t" \ - ".set\tmips0" \ - : : "r" (val)); \ - else \ - __asm__ __volatile__( \ - ".set\tmips64\n\t" \ - "dsll\t%L0, %L0, 32\n\t" \ - "dsrl\t%L0, %L0, 32\n\t" \ - "dsll\t%M0, %M0, 32\n\t" \ - "or\t%L0, %L0, %M0\n\t" \ - "dmtc0\t%L0, " #source ", " #sel "\n\t" \ - ".set\tmips0" \ - : : "r" (val)); \ - local_irq_restore(flags); \ +#define __write_64bit_c0_split(source, sel, val) \ +do { \ + unsigned long flags; \ + \ + local_irq_save(flags); \ + if (sel == 0) \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dsll\t%L0, %L0, 32\n\t" \ + "dsrl\t%L0, %L0, 32\n\t" \ + "dsll\t%M0, %M0, 32\n\t" \ + "or\t%L0, %L0, %M0\n\t" \ + "dmtc0\t%L0, " #source "\n\t" \ + ".set\tmips0" \ + : : "r" (val)); \ + else \ + __asm__ __volatile__( \ + ".set\tmips64\n\t" \ + "dsll\t%L0, %L0, 32\n\t" \ + "dsrl\t%L0, %L0, 32\n\t" \ + "dsll\t%M0, %M0, 32\n\t" \ + "or\t%L0, %L0, %M0\n\t" \ + "dmtc0\t%L0, " #source ", " #sel "\n\t" \ + ".set\tmips0" \ + : : "r" (val)); \ + local_irq_restore(flags); \ } while (0) -#define read_c0_index() __read_32bit_c0_register($0, 0) -#define write_c0_index(val) __write_32bit_c0_register($0, 0, val) +#define read_c0_index() __read_32bit_c0_register($0, 0) +#define write_c0_index(val) __write_32bit_c0_register($0, 0, val) -#define read_c0_entrylo0() __read_ulong_c0_register($2, 0) -#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val) +#define read_c0_entrylo0() __read_ulong_c0_register($2, 0) +#define write_c0_entrylo0(val) __write_ulong_c0_register($2, 0, val) -#define read_c0_entrylo1() __read_ulong_c0_register($3, 0) -#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val) +#define read_c0_entrylo1() __read_ulong_c0_register($3, 0) +#define write_c0_entrylo1(val) __write_ulong_c0_register($3, 0, val) -#define read_c0_conf() __read_32bit_c0_register($3, 0) -#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val) +#define read_c0_conf() __read_32bit_c0_register($3, 0) +#define write_c0_conf(val) __write_32bit_c0_register($3, 0, val) -#define read_c0_context() __read_ulong_c0_register($4, 0) -#define write_c0_context(val) __write_ulong_c0_register($4, 0, val) +#define read_c0_context() __read_ulong_c0_register($4, 0) +#define write_c0_context(val) __write_ulong_c0_register($4, 0, val) -#define read_c0_pagemask() __read_32bit_c0_register($5, 0) -#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val) +#define read_c0_pagemask() __read_32bit_c0_register($5, 0) +#define write_c0_pagemask(val) __write_32bit_c0_register($5, 0, val) -#define read_c0_wired() __read_32bit_c0_register($6, 0) -#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val) +#define read_c0_wired() __read_32bit_c0_register($6, 0) +#define write_c0_wired(val) __write_32bit_c0_register($6, 0, val) -#define read_c0_info() __read_32bit_c0_register($7, 0) +#define read_c0_info() __read_32bit_c0_register($7, 0) -#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */ -#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val) +#define read_c0_cache() __read_32bit_c0_register($7, 0) /* TX39xx */ +#define write_c0_cache(val) __write_32bit_c0_register($7, 0, val) -#define read_c0_count() __read_32bit_c0_register($9, 0) -#define write_c0_count(val) __write_32bit_c0_register($9, 0, val) +#define read_c0_count() __read_32bit_c0_register($9, 0) +#define write_c0_count(val) __write_32bit_c0_register($9, 0, val) -#define read_c0_entryhi() __read_ulong_c0_register($10, 0) -#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val) +#define read_c0_entryhi() __read_ulong_c0_register($10, 0) +#define write_c0_entryhi(val) __write_ulong_c0_register($10, 0, val) -#define read_c0_compare() __read_32bit_c0_register($11, 0) -#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val) +#define read_c0_compare() __read_32bit_c0_register($11, 0) +#define write_c0_compare(val) __write_32bit_c0_register($11, 0, val) -#define read_c0_status() __read_32bit_c0_register($12, 0) -#define write_c0_status(val) __write_32bit_c0_register($12, 0, val) +#define read_c0_status() __read_32bit_c0_register($12, 0) +#define write_c0_status(val) __write_32bit_c0_register($12, 0, val) -#define read_c0_cause() __read_32bit_c0_register($13, 0) -#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val) +#define read_c0_cause() __read_32bit_c0_register($13, 0) +#define write_c0_cause(val) __write_32bit_c0_register($13, 0, val) -#define read_c0_prid() __read_32bit_c0_register($15, 0) +#define read_c0_prid() __read_32bit_c0_register($15, 0) -#define read_c0_config() __read_32bit_c0_register($16, 0) -#define read_c0_config1() __read_32bit_c0_register($16, 1) -#define read_c0_config2() __read_32bit_c0_register($16, 2) -#define read_c0_config3() __read_32bit_c0_register($16, 3) -#define write_c0_config(val) __write_32bit_c0_register($16, 0, val) -#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val) -#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val) -#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val) +#define read_c0_config() __read_32bit_c0_register($16, 0) +#define read_c0_config1() __read_32bit_c0_register($16, 1) +#define read_c0_config2() __read_32bit_c0_register($16, 2) +#define read_c0_config3() __read_32bit_c0_register($16, 3) +#define write_c0_config(val) __write_32bit_c0_register($16, 0, val) +#define write_c0_config1(val) __write_32bit_c0_register($16, 1, val) +#define write_c0_config2(val) __write_32bit_c0_register($16, 2, val) +#define write_c0_config3(val) __write_32bit_c0_register($16, 3, val) /* * The WatchLo register. There may be upto 8 of them. */ -#define read_c0_watchlo0() __read_ulong_c0_register($18, 0) -#define read_c0_watchlo1() __read_ulong_c0_register($18, 1) -#define read_c0_watchlo2() __read_ulong_c0_register($18, 2) -#define read_c0_watchlo3() __read_ulong_c0_register($18, 3) -#define read_c0_watchlo4() __read_ulong_c0_register($18, 4) -#define read_c0_watchlo5() __read_ulong_c0_register($18, 5) -#define read_c0_watchlo6() __read_ulong_c0_register($18, 6) -#define read_c0_watchlo7() __read_ulong_c0_register($18, 7) -#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val) -#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val) -#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val) -#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val) -#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val) -#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val) -#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val) -#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val) +#define read_c0_watchlo0() __read_ulong_c0_register($18, 0) +#define read_c0_watchlo1() __read_ulong_c0_register($18, 1) +#define read_c0_watchlo2() __read_ulong_c0_register($18, 2) +#define read_c0_watchlo3() __read_ulong_c0_register($18, 3) +#define read_c0_watchlo4() __read_ulong_c0_register($18, 4) +#define read_c0_watchlo5() __read_ulong_c0_register($18, 5) +#define read_c0_watchlo6() __read_ulong_c0_register($18, 6) +#define read_c0_watchlo7() __read_ulong_c0_register($18, 7) +#define write_c0_watchlo0(val) __write_ulong_c0_register($18, 0, val) +#define write_c0_watchlo1(val) __write_ulong_c0_register($18, 1, val) +#define write_c0_watchlo2(val) __write_ulong_c0_register($18, 2, val) +#define write_c0_watchlo3(val) __write_ulong_c0_register($18, 3, val) +#define write_c0_watchlo4(val) __write_ulong_c0_register($18, 4, val) +#define write_c0_watchlo5(val) __write_ulong_c0_register($18, 5, val) +#define write_c0_watchlo6(val) __write_ulong_c0_register($18, 6, val) +#define write_c0_watchlo7(val) __write_ulong_c0_register($18, 7, val) /* * The WatchHi register. There may be upto 8 of them. */ -#define read_c0_watchhi0() __read_32bit_c0_register($19, 0) -#define read_c0_watchhi1() __read_32bit_c0_register($19, 1) -#define read_c0_watchhi2() __read_32bit_c0_register($19, 2) -#define read_c0_watchhi3() __read_32bit_c0_register($19, 3) -#define read_c0_watchhi4() __read_32bit_c0_register($19, 4) -#define read_c0_watchhi5() __read_32bit_c0_register($19, 5) -#define read_c0_watchhi6() __read_32bit_c0_register($19, 6) -#define read_c0_watchhi7() __read_32bit_c0_register($19, 7) - -#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val) -#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val) -#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val) -#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val) -#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val) -#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val) -#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val) -#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val) - -#define read_c0_xcontext() __read_ulong_c0_register($20, 0) -#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val) - -#define read_c0_intcontrol() __read_32bit_c0_register($20, 1) +#define read_c0_watchhi0() __read_32bit_c0_register($19, 0) +#define read_c0_watchhi1() __read_32bit_c0_register($19, 1) +#define read_c0_watchhi2() __read_32bit_c0_register($19, 2) +#define read_c0_watchhi3() __read_32bit_c0_register($19, 3) +#define read_c0_watchhi4() __read_32bit_c0_register($19, 4) +#define read_c0_watchhi5() __read_32bit_c0_register($19, 5) +#define read_c0_watchhi6() __read_32bit_c0_register($19, 6) +#define read_c0_watchhi7() __read_32bit_c0_register($19, 7) + +#define write_c0_watchhi0(val) __write_32bit_c0_register($19, 0, val) +#define write_c0_watchhi1(val) __write_32bit_c0_register($19, 1, val) +#define write_c0_watchhi2(val) __write_32bit_c0_register($19, 2, val) +#define write_c0_watchhi3(val) __write_32bit_c0_register($19, 3, val) +#define write_c0_watchhi4(val) __write_32bit_c0_register($19, 4, val) +#define write_c0_watchhi5(val) __write_32bit_c0_register($19, 5, val) +#define write_c0_watchhi6(val) __write_32bit_c0_register($19, 6, val) +#define write_c0_watchhi7(val) __write_32bit_c0_register($19, 7, val) + +#define read_c0_xcontext() __read_ulong_c0_register($20, 0) +#define write_c0_xcontext(val) __write_ulong_c0_register($20, 0, val) + +#define read_c0_intcontrol() __read_32bit_c0_register($20, 1) #define write_c0_intcontrol(val) __write_32bit_c0_register($20, 1, val) -#define read_c0_framemask() __read_32bit_c0_register($21, 0) -#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val) +#define read_c0_framemask() __read_32bit_c0_register($21, 0) +#define write_c0_framemask(val) __write_32bit_c0_register($21, 0, val) -#define read_c0_debug() __read_32bit_c0_register($23, 0) -#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val) +#define read_c0_debug() __read_32bit_c0_register($23, 0) +#define write_c0_debug(val) __write_32bit_c0_register($23, 0, val) -#define read_c0_depc() __read_ulong_c0_register($24, 0) -#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val) +#define read_c0_depc() __read_ulong_c0_register($24, 0) +#define write_c0_depc(val) __write_ulong_c0_register($24, 0, val) -#define read_c0_ecc() __read_32bit_c0_register($26, 0) -#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val) +#define read_c0_ecc() __read_32bit_c0_register($26, 0) +#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val) -#define read_c0_derraddr0() __read_ulong_c0_register($26, 1) -#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val) +#define read_c0_derraddr0() __read_ulong_c0_register($26, 1) +#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val) -#define read_c0_cacheerr() __read_32bit_c0_register($27, 0) +#define read_c0_cacheerr() __read_32bit_c0_register($27, 0) -#define read_c0_derraddr1() __read_ulong_c0_register($27, 1) -#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val) +#define read_c0_derraddr1() __read_ulong_c0_register($27, 1) +#define write_c0_derraddr1(val) __write_ulong_c0_register($27, 1, val) -#define read_c0_taglo() __read_32bit_c0_register($28, 0) -#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val) +#define read_c0_taglo() __read_32bit_c0_register($28, 0) +#define write_c0_taglo(val) __write_32bit_c0_register($28, 0, val) -#define read_c0_taghi() __read_32bit_c0_register($29, 0) -#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val) +#define read_c0_taghi() __read_32bit_c0_register($29, 0) +#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val) -#define read_c0_errorepc() __read_ulong_c0_register($30, 0) -#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val) +#define read_c0_errorepc() __read_ulong_c0_register($30, 0) +#define write_c0_errorepc(val) __write_ulong_c0_register($30, 0, val) -#define read_c0_epc() __read_ulong_c0_register($14, 0) -#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val) +#define read_c0_epc() __read_ulong_c0_register($14, 0) +#define write_c0_epc(val) __write_ulong_c0_register($14, 0, val) #if 1 /* @@ -1001,20 +987,20 @@ do { \ #define read_32bit_cp0_register(source) \ ({ int __res; \ __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set\treorder\n\t" \ + ".set\tpush\n\t" \ + ".set\treorder\n\t" \ "mfc0\t%0,"STR(source)"\n\t" \ - ".set\tpop" \ + ".set\tpop" \ : "=r" (__res)); \ __res;}) #define read_32bit_cp0_set1_register(source) \ ({ int __res; \ __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set\treorder\n\t" \ + ".set\tpush\n\t" \ + ".set\treorder\n\t" \ "cfc0\t%0,"STR(source)"\n\t" \ - ".set\tpop" \ + ".set\tpop" \ : "=r" (__res)); \ __res;}) @@ -1032,14 +1018,14 @@ do { \ #define write_32bit_cp0_register(register,value) \ __asm__ __volatile__( \ - "mtc0\t%0,"STR(register)"\n\t" \ - "nop" \ + "mtc0\t%0,"STR(register)"\n\t" \ + "nop" \ : : "r" (value)); #define write_32bit_cp0_set1_register(register,value) \ __asm__ __volatile__( \ - "ctc0\t%0,"STR(register)"\n\t" \ - "nop" \ + "ctc0\t%0,"STR(register)"\n\t" \ + "nop" \ : : "r" (value)); #define write_64bit_cp0_register(register,value) \ @@ -1055,16 +1041,16 @@ do { \ #define read_mips32_cp0_config1() \ ({ int __res; \ __asm__ __volatile__( \ - ".set\tnoreorder\n\t" \ - ".set\tnoat\n\t" \ - "#.set\tmips64\n\t" \ - "#mfc0\t$1, $16, 1\n\t" \ - "#.set\tmips0\n\t" \ - ".word\t0x40018001\n\t" \ - "move\t%0,$1\n\t" \ - ".set\tat\n\t" \ - ".set\treorder" \ - :"=r" (__res)); \ + ".set\tnoreorder\n\t" \ + ".set\tnoat\n\t" \ + "#.set\tmips64\n\t" \ + "#mfc0\t$1, $16, 1\n\t" \ + "#.set\tmips0\n\t" \ + ".word\t0x40018001\n\t" \ + "move\t%0,$1\n\t" \ + ".set\tat\n\t" \ + ".set\treorder" \ + :"=r" (__res)); \ __res;}) #endif @@ -1073,96 +1059,97 @@ do { \ */ #define read_32bit_cp1_register(source) \ ({ int __res; \ - __asm__ __volatile__( \ - ".set\tpush\n\t" \ - ".set\treorder\n\t" \ + __asm__ __volatile__( \ + ".set\tpush\n\t" \ + ".set\treorder\n\t" \ "cfc1\t%0,"STR(source)"\n\t" \ - ".set\tpop" \ + ".set\tpop" \ : "=r" (__res)); \ __res;}) /* TLB operations. */ static inline void tlb_probe(void) { - __asm__ __volatile__( - ".set noreorder\n\t" - "tlbp\n\t" - ".set reorder"); + __asm__ __volatile__( + ".set noreorder\n\t" + "tlbp\n\t" + ".set reorder"); } static inline void tlb_read(void) { - __asm__ __volatile__( - ".set noreorder\n\t" - "tlbr\n\t" - ".set reorder"); + __asm__ __volatile__( + ".set noreorder\n\t" + "tlbr\n\t" + ".set reorder"); } static inline void tlb_write_indexed(void) { - __asm__ __volatile__( - ".set noreorder\n\t" - "tlbwi\n\t" - ".set reorder"); + __asm__ __volatile__( + ".set noreorder\n\t" + "tlbwi\n\t" + ".set reorder"); } static inline void tlb_write_random(void) { - __asm__ __volatile__( - ".set noreorder\n\t" - "tlbwr\n\t" - ".set reorder"); + __asm__ __volatile__( + ".set noreorder\n\t" + "tlbwr\n\t" + ".set reorder"); } /* * Manipulate bits in a c0 register. */ -#define __BUILD_SET_C0(name,register) \ -static inline unsigned int \ -set_c0_##name(unsigned int set) \ -{ \ - unsigned int res; \ - \ - res = read_c0_##name(); \ - res |= set; \ - write_c0_##name(res); \ - \ - return res; \ -} \ - \ -static inline unsigned int \ -clear_c0_##name(unsigned int clear) \ -{ \ - unsigned int res; \ - \ - res = read_c0_##name(); \ - res &= ~clear; \ - write_c0_##name(res); \ - \ - return res; \ -} \ - \ -static inline unsigned int \ -change_c0_##name(unsigned int change, unsigned int new) \ -{ \ - unsigned int res; \ - \ - res = read_c0_##name(); \ - res &= ~change; \ - res |= (new & change); \ - write_c0_##name(res); \ - \ - return res; \ +#define __BUILD_SET_C0(name,register) \ +static inline unsigned int \ +set_c0_##name(unsigned int set) \ +{ \ + unsigned int res; \ + \ + res = read_c0_##name(); \ + res |= set; \ + write_c0_##name(res); \ + \ + return res; \ +} \ + \ +static inline unsigned int \ +clear_c0_##name(unsigned int clear) \ +{ \ + unsigned int res; \ + \ + res = read_c0_##name(); \ + res &= ~clear; \ + write_c0_##name(res); \ + \ + return res; \ +} \ + \ +static inline unsigned int \ +change_c0_##name(unsigned int change, unsigned int new) \ +{ \ + unsigned int res; \ + \ + res = read_c0_##name(); \ + res &= ~change; \ + res |= (new & change); \ + write_c0_##name(res); \ + \ + return res; \ } __BUILD_SET_C0(status,CP0_STATUS) __BUILD_SET_C0(cause,CP0_CAUSE) __BUILD_SET_C0(config,CP0_CONFIG) -#define set_cp0_status(x) set_c0_status(x) -#define set_cp0_cause(x) set_c0_cause(x) -#define set_cp0_config(x) set_c0_config(x) +#define set_cp0_status(x) set_c0_status(x) +#define set_cp0_cause(x) set_c0_cause(x) +#define set_cp0_config(x) set_c0_config(x) #endif /* !__ASSEMBLY__ */ #endif /* _MIPS_REGS_H_ */ + diff --git a/libcpu/mips/common/mips_types.h b/libcpu/mips/common/mips_types.h index 7f0b8a685..a7dca63eb 100644 --- a/libcpu/mips/common/mips_types.h +++ b/libcpu/mips/common/mips_types.h @@ -1,25 +1,11 @@ /* - * File : mips_types.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version + * 2016-9-7 Urey the first version */ #ifndef _MIPS_TYPES_H_ diff --git a/libcpu/mips/common/mipscfg.h b/libcpu/mips/common/mipscfg.h index b4f30615f..f4761be73 100644 --- a/libcpu/mips/common/mipscfg.h +++ b/libcpu/mips/common/mipscfg.h @@ -24,7 +24,7 @@ typedef struct mips32_core_cfg rt_uint16_t dcache_lines_per_way; rt_uint16_t dcache_ways; - rt_uint16_t max_tlb_entries; /* number of tlb entry */ + rt_uint16_t max_tlb_entries; /* number of tlb entry */ } mips32_core_cfg_t; extern mips32_core_cfg_t g_mips_core; diff --git a/libcpu/mips/loongson_1b/cache.c b/libcpu/mips/loongson_1b/cache.c index 842f392cb..ccfdda95d 100644 --- a/libcpu/mips/loongson_1b/cache.c +++ b/libcpu/mips/loongson_1b/cache.c @@ -12,12 +12,12 @@ * 2010-07-09 Bernard first version * 2011-08-08 lgnq modified for LS1B */ - + #include #include "../common/mipsregs.h" -#define K0BASE 0x80000000 -#define PRID_LS1B 0x4220 +#define K0BASE 0x80000000 +#define PRID_LS1B 0x4220 extern void Clear_TagLo (void); extern void Invalidate_Icache_Ls1b(unsigned int); @@ -26,21 +26,21 @@ extern void Invalidate_Dcache_Fill_Ls1b(unsigned int); extern void Writeback_Invalidate_Dcache(unsigned int); extern void enable_cpu_cache(void); -typedef struct cacheinfo_t +typedef struct cacheinfo_t { - unsigned int icache_size; - unsigned int dcache_size; - unsigned int icacheline_size; - unsigned int dcacheline_size; + unsigned int icache_size; + unsigned int dcache_size; + unsigned int icacheline_size; + unsigned int dcacheline_size; } cacheinfo_t ; -typedef struct cacheop_t +typedef struct cacheop_t { - void (*Clear_TagLo) (void); - void (*Invalidate_Icache) (unsigned int); - void (*Invalidate_Dcache_Fill) (unsigned int); - void (*Invalidate_Dcache_ClearTag) (unsigned int); - void (*Init_Cache)(void); + void (*Clear_TagLo) (void); + void (*Invalidate_Icache) (unsigned int); + void (*Invalidate_Dcache_Fill) (unsigned int); + void (*Invalidate_Dcache_ClearTag) (unsigned int); + void (*Init_Cache)(void); } cacheop_t ; static cacheop_t cacheop, *pcacheop; @@ -53,24 +53,24 @@ int identify_cpu(void) pcacheop = &cacheop; pcacheinfo = &cacheinfo; - rt_kprintf("CPU configure: 0x%08x\n", read_c0_config()); + rt_kprintf("CPU configure: 0x%08x\n", read_c0_config()); cpu_id = read_c0_prid(); switch (cpu_id) - { - case PRID_LS1B: - rt_kprintf("CPU:LS1B\n"); - pcacheop->Clear_TagLo = Clear_TagLo; - pcacheop->Invalidate_Icache = Invalidate_Icache_Ls1b; - pcacheop->Invalidate_Dcache_Fill = Invalidate_Dcache_Fill_Ls1b; - pcacheop->Invalidate_Dcache_ClearTag = Invalidate_Dcache_ClearTag_Ls1b; - break; - default: - rt_kprintf("Unknown CPU type, system halted!\n"); - while (1) - { - ; - } - break; + { + case PRID_LS1B: + rt_kprintf("CPU:LS1B\n"); + pcacheop->Clear_TagLo = Clear_TagLo; + pcacheop->Invalidate_Icache = Invalidate_Icache_Ls1b; + pcacheop->Invalidate_Dcache_Fill = Invalidate_Dcache_Fill_Ls1b; + pcacheop->Invalidate_Dcache_ClearTag = Invalidate_Dcache_ClearTag_Ls1b; + break; + default: + rt_kprintf("Unknown CPU type, system halted!\n"); + while (1) + { + ; + } + break; } return 0; @@ -89,7 +89,7 @@ void probe_cache(void) icache_sets = 64 << ((config1 >> 22) & 7); icache_ways = 1 + ((config1 >> 16) & 7); icache_size = icache_sets * icache_ways * icache_line_size; - + if ((dcache_line_size = ((config1 >> 10) & 7))) dcache_line_size = 2 << dcache_line_size; else @@ -97,7 +97,7 @@ void probe_cache(void) dcache_sets = 64 << ((config1 >> 13) & 7); dcache_ways = 1 + ((config1 >> 7) & 7); dcache_size = dcache_sets * dcache_ways * dcache_line_size; - + rt_kprintf("DCache %2dkb, linesize %d bytes.\n", dcache_size >> 10, dcache_line_size); rt_kprintf("ICache %2dkb, linesize %d bytes.\n", icache_size >> 10, icache_line_size); @@ -111,120 +111,120 @@ void probe_cache(void) void invalidate_writeback_dcache_all(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); - - while (start < end) - { - Writeback_Invalidate_Dcache(start); //hit writeback invalidate - start += pcacheinfo->dcacheline_size; - } + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); + + while (start < end) + { + Writeback_Invalidate_Dcache(start); //hit writeback invalidate + start += pcacheinfo->dcacheline_size; + } } void invalidate_writeback_dcache(unsigned long addr, int size) { - unsigned long start, end; - - start = (addr +pcacheinfo->dcacheline_size -1) & (- pcacheinfo->dcacheline_size); - end = (end + size + pcacheinfo->dcacheline_size -1) & ( -pcacheinfo->dcacheline_size); - - while (start dcacheline_size; - } + unsigned long start, end; + + start = (addr +pcacheinfo->dcacheline_size -1) & (- pcacheinfo->dcacheline_size); + end = (end + size + pcacheinfo->dcacheline_size -1) & ( -pcacheinfo->dcacheline_size); + + while (start dcacheline_size; + } } void invalidate_icache_all(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->icache_size); - - while (start < end) - { - pcacheop->Invalidate_Icache(start); - start += pcacheinfo->icacheline_size; - } + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->icache_size); + + while (start < end) + { + pcacheop->Invalidate_Icache(start); + start += pcacheinfo->icacheline_size; + } } void invalidate_dcache_all(void) -{ - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); - while (start icacheline_size; - } +{ + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); + while (start icacheline_size; + } } //with cache disabled void init_dcache(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); - while (start < end) - { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; - } + while (start < end) + { + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; + } } void rt_hw_cache_init(void) { unsigned int start, end; - - /* 1. identify cpu and probe cache */ - identify_cpu(); - probe_cache(); - start = K0BASE; - end = (start + pcacheinfo->icache_size); + /* 1. identify cpu and probe cache */ + identify_cpu(); + probe_cache(); + + start = K0BASE; + end = (start + pcacheinfo->icache_size); /* - * 2. clear CP0 taglo/taghi register; + * 2. clear CP0 taglo/taghi register; */ pcacheop->Clear_TagLo(); - /* - * 3. invalidate instruction cache; + /* + * 3. invalidate instruction cache; */ - while (start < end) + while (start < end) { - pcacheop->Invalidate_Icache(start); //index invalidate icache - start += pcacheinfo->icacheline_size; + pcacheop->Invalidate_Icache(start); //index invalidate icache + start += pcacheinfo->icacheline_size; } /* - * 4. invalidate data cache; + * 4. invalidate data cache; */ start = K0BASE; end = (start + pcacheinfo->dcache_size); - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; } start = K0BASE; - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_Fill(start); //index invalidate dcache - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_Fill(start); //index invalidate dcache + start += pcacheinfo->dcacheline_size; } start = K0BASE; - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; } - /* enable cache */ - enable_cpu_cache(); - rt_kprintf("enable cpu cache done\n"); + /* enable cache */ + enable_cpu_cache(); + rt_kprintf("enable cpu cache done\n"); - return ; + return ; } diff --git a/libcpu/mips/loongson_1b/cache.h b/libcpu/mips/loongson_1b/cache.h index b5c2d4501..8ca015ef4 100644 --- a/libcpu/mips/loongson_1b/cache.h +++ b/libcpu/mips/loongson_1b/cache.h @@ -12,8 +12,8 @@ * 2010-07-09 Bernard first version * 2011-08-08 lgnq modified for LS1B */ -#ifndef __CACHE_H__ -#define __CACHE_H__ +#ifndef __CACHE_H__ +#define __CACHE_H__ /* * Cache Operations @@ -22,31 +22,31 @@ #define Index_Writeback_Inv_D 0x01 #define Index_Invalidate_SI 0x02 #define Index_Writeback_Inv_SD 0x03 -#define Index_Load_Tag_I 0x04 -#define Index_Load_Tag_D 0x05 -#define Index_Load_Tag_SI 0x06 -#define Index_Load_Tag_SD 0x07 -#define Index_Store_Tag_I 0x08 -#define Index_Store_Tag_D 0x09 -#define Index_Store_Tag_SI 0x0A -#define Index_Store_Tag_SD 0x0B -#define Create_Dirty_Excl_D 0x0d -#define Create_Dirty_Excl_SD 0x0f -#define Hit_Invalidate_I 0x10 -#define Hit_Invalidate_D 0x11 -#define Hit_Invalidate_SI 0x12 -#define Hit_Invalidate_SD 0x13 -#define Fill 0x14 -#define Hit_Writeback_Inv_D 0x15 +#define Index_Load_Tag_I 0x04 +#define Index_Load_Tag_D 0x05 +#define Index_Load_Tag_SI 0x06 +#define Index_Load_Tag_SD 0x07 +#define Index_Store_Tag_I 0x08 +#define Index_Store_Tag_D 0x09 +#define Index_Store_Tag_SI 0x0A +#define Index_Store_Tag_SD 0x0B +#define Create_Dirty_Excl_D 0x0d +#define Create_Dirty_Excl_SD 0x0f +#define Hit_Invalidate_I 0x10 +#define Hit_Invalidate_D 0x11 +#define Hit_Invalidate_SI 0x12 +#define Hit_Invalidate_SD 0x13 +#define Fill 0x14 +#define Hit_Writeback_Inv_D 0x15 /* 0x16 is unused */ -#define Hit_Writeback_Inv_SD 0x17 -#define Hit_Writeback_I 0x18 -#define Hit_Writeback_D 0x19 +#define Hit_Writeback_Inv_SD 0x17 +#define Hit_Writeback_I 0x18 +#define Hit_Writeback_D 0x19 /* 0x1a is unused */ -#define Hit_Writeback_SD 0x1b +#define Hit_Writeback_SD 0x1b /* 0x1c is unused */ /* 0x1e is unused */ -#define Hit_Set_Virtual_SI 0x1e -#define Hit_Set_Virtual_SD 0x1f +#define Hit_Set_Virtual_SI 0x1e +#define Hit_Set_Virtual_SD 0x1f #endif diff --git a/libcpu/mips/loongson_1b/cpuport.c b/libcpu/mips/loongson_1b/cpuport.c index c095c0481..23399800f 100644 --- a/libcpu/mips/loongson_1b/cpuport.c +++ b/libcpu/mips/loongson_1b/cpuport.c @@ -28,13 +28,13 @@ */ void rt_hw_cpu_reset(void) { - /* open the watch-dog */ - WDT_EN = 0x01; /* watch dog enable */ - WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */ - WDT_SET = 0x01; /* watch dog start */ + /* open the watch-dog */ + WDT_EN = 0x01; /* watch dog enable */ + WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */ + WDT_SET = 0x01; /* watch dog start */ - rt_kprintf("reboot system...\n"); - while (1); + rt_kprintf("reboot system...\n"); + while (1); } /** @@ -43,9 +43,9 @@ void rt_hw_cpu_reset(void) */ void rt_hw_cpu_shutdown(void) { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } extern rt_uint32_t cp0_get_cause(void); @@ -65,59 +65,59 @@ extern rt_uint32_t cp0_get_lo(void); */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) { - rt_uint32_t *stk; + rt_uint32_t *stk; static rt_uint32_t g_sr = 0; if (g_sr == 0) { - g_sr = cp0_get_status(); - g_sr &= 0xfffffffe; - g_sr |= 0x8401; + g_sr = cp0_get_status(); + g_sr &= 0xfffffffe; + g_sr |= 0x8401; } /** Start at stack top */ stk = (rt_uint32_t *)stack_addr; - *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ - *(--stk) = (rt_uint32_t) 0xeeee; /* c0_cause */ - *(--stk) = (rt_uint32_t) 0xffff; /* c0_badvaddr */ - *(--stk) = (rt_uint32_t) cp0_get_lo(); /* lo */ - *(--stk) = (rt_uint32_t) cp0_get_hi(); /* hi */ - *(--stk) = (rt_uint32_t) g_sr; /* C0_SR: HW2 = En, IE = En */ - *(--stk) = (rt_uint32_t) texit; /* ra */ - *(--stk) = (rt_uint32_t) 0x0000001e; /* s8 */ - *(--stk) = (rt_uint32_t) stack_addr; /* sp */ - *(--stk) = (rt_uint32_t) 0x0000001c; /* gp */ - *(--stk) = (rt_uint32_t) 0x0000001b; /* k1 */ - *(--stk) = (rt_uint32_t) 0x0000001a; /* k0 */ - *(--stk) = (rt_uint32_t) 0x00000019; /* t9 */ - *(--stk) = (rt_uint32_t) 0x00000018; /* t8 */ - *(--stk) = (rt_uint32_t) 0x00000017; /* s7 */ - *(--stk) = (rt_uint32_t) 0x00000016; /* s6 */ - *(--stk) = (rt_uint32_t) 0x00000015; /* s5 */ - *(--stk) = (rt_uint32_t) 0x00000014; /* s4 */ - *(--stk) = (rt_uint32_t) 0x00000013; /* s3 */ - *(--stk) = (rt_uint32_t) 0x00000012; /* s2 */ - *(--stk) = (rt_uint32_t) 0x00000011; /* s1 */ - *(--stk) = (rt_uint32_t) 0x00000010; /* s0 */ - *(--stk) = (rt_uint32_t) 0x0000000f; /* t7 */ - *(--stk) = (rt_uint32_t) 0x0000000e; /* t6 */ - *(--stk) = (rt_uint32_t) 0x0000000d; /* t5 */ - *(--stk) = (rt_uint32_t) 0x0000000c; /* t4 */ - *(--stk) = (rt_uint32_t) 0x0000000b; /* t3 */ - *(--stk) = (rt_uint32_t) 0x0000000a; /* t2 */ - *(--stk) = (rt_uint32_t) 0x00000009; /* t1 */ - *(--stk) = (rt_uint32_t) 0x00000008; /* t0 */ - *(--stk) = (rt_uint32_t) 0x00000007; /* a3 */ - *(--stk) = (rt_uint32_t) 0x00000006; /* a2 */ - *(--stk) = (rt_uint32_t) 0x00000005; /* a1 */ - *(--stk) = (rt_uint32_t) parameter; /* a0 */ - *(--stk) = (rt_uint32_t) 0x00000003; /* v1 */ - *(--stk) = (rt_uint32_t) 0x00000002; /* v0 */ - *(--stk) = (rt_uint32_t) 0x00000001; /* at */ - *(--stk) = (rt_uint32_t) 0x00000000; /* zero */ + *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ + *(--stk) = (rt_uint32_t) 0xeeee; /* c0_cause */ + *(--stk) = (rt_uint32_t) 0xffff; /* c0_badvaddr */ + *(--stk) = (rt_uint32_t) cp0_get_lo(); /* lo */ + *(--stk) = (rt_uint32_t) cp0_get_hi(); /* hi */ + *(--stk) = (rt_uint32_t) g_sr; /* C0_SR: HW2 = En, IE = En */ + *(--stk) = (rt_uint32_t) texit; /* ra */ + *(--stk) = (rt_uint32_t) 0x0000001e; /* s8 */ + *(--stk) = (rt_uint32_t) stack_addr; /* sp */ + *(--stk) = (rt_uint32_t) 0x0000001c; /* gp */ + *(--stk) = (rt_uint32_t) 0x0000001b; /* k1 */ + *(--stk) = (rt_uint32_t) 0x0000001a; /* k0 */ + *(--stk) = (rt_uint32_t) 0x00000019; /* t9 */ + *(--stk) = (rt_uint32_t) 0x00000018; /* t8 */ + *(--stk) = (rt_uint32_t) 0x00000017; /* s7 */ + *(--stk) = (rt_uint32_t) 0x00000016; /* s6 */ + *(--stk) = (rt_uint32_t) 0x00000015; /* s5 */ + *(--stk) = (rt_uint32_t) 0x00000014; /* s4 */ + *(--stk) = (rt_uint32_t) 0x00000013; /* s3 */ + *(--stk) = (rt_uint32_t) 0x00000012; /* s2 */ + *(--stk) = (rt_uint32_t) 0x00000011; /* s1 */ + *(--stk) = (rt_uint32_t) 0x00000010; /* s0 */ + *(--stk) = (rt_uint32_t) 0x0000000f; /* t7 */ + *(--stk) = (rt_uint32_t) 0x0000000e; /* t6 */ + *(--stk) = (rt_uint32_t) 0x0000000d; /* t5 */ + *(--stk) = (rt_uint32_t) 0x0000000c; /* t4 */ + *(--stk) = (rt_uint32_t) 0x0000000b; /* t3 */ + *(--stk) = (rt_uint32_t) 0x0000000a; /* t2 */ + *(--stk) = (rt_uint32_t) 0x00000009; /* t1 */ + *(--stk) = (rt_uint32_t) 0x00000008; /* t0 */ + *(--stk) = (rt_uint32_t) 0x00000007; /* a3 */ + *(--stk) = (rt_uint32_t) 0x00000006; /* a2 */ + *(--stk) = (rt_uint32_t) 0x00000005; /* a1 */ + *(--stk) = (rt_uint32_t) parameter; /* a0 */ + *(--stk) = (rt_uint32_t) 0x00000003; /* v1 */ + *(--stk) = (rt_uint32_t) 0x00000002; /* v0 */ + *(--stk) = (rt_uint32_t) 0x00000001; /* at */ + *(--stk) = (rt_uint32_t) 0x00000000; /* zero */ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /*@}*/ diff --git a/libcpu/mips/loongson_1b/exception.c b/libcpu/mips/loongson_1b/exception.c index 4a3745cbc..dbcec42ab 100644 --- a/libcpu/mips/loongson_1b/exception.c +++ b/libcpu/mips/loongson_1b/exception.c @@ -25,7 +25,7 @@ /** * exception handle table */ -#define RT_EXCEPTION_MAX 8 +#define RT_EXCEPTION_MAX 8 exception_func_t sys_exception_handlers[RT_EXCEPTION_MAX]; /** @@ -47,45 +47,45 @@ exception_func_t rt_set_except_vector(int n, exception_func_t func) void tlb_refill_handler(void) { - rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); + rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); + rt_hw_cpu_shutdown(); } void cache_error_handler(void) { - rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); + rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); + rt_hw_cpu_shutdown(); } static void unhandled_exception_handle(pt_regs_t *regs) { - rt_kprintf("exception happens, epc: 0x%08x, cause: 0x%08x\n", regs->cp0_epc, read_c0_cause()); + rt_kprintf("exception happens, epc: 0x%08x, cause: 0x%08x\n", regs->cp0_epc, read_c0_cause()); } void install_default_execpt_handle(void) { - rt_int32_t i; + rt_int32_t i; - for (i=0; i> 8; - - for (index = RT_EXCEPTION_MAX; index > 0; index --) - { - if (cause & (1 << index)) - { - sys_exception_handlers[index](regs); - cause &= ~(1 << index); - } - } + rt_uint32_t cause; + rt_uint32_t index; + + cause = (read_c0_cause() & read_c0_config()); + cause = (cause & 0xfc00) >> 8; + + for (index = RT_EXCEPTION_MAX; index > 0; index --) + { + if (cause & (1 << index)) + { + sys_exception_handlers[index](regs); + cause &= ~(1 << index); + } + } } /*@}*/ diff --git a/libcpu/mips/loongson_1b/interrupt.c b/libcpu/mips/loongson_1b/interrupt.c index 998d1e491..4af9319c5 100644 --- a/libcpu/mips/loongson_1b/interrupt.c +++ b/libcpu/mips/loongson_1b/interrupt.c @@ -51,7 +51,7 @@ void rt_hw_interrupt_init(void) rt_int32_t idx; /* pci active low */ - ls1b_hw0_icregs->int_pol = -1; //must be done here 20110802 lgnq + ls1b_hw0_icregs->int_pol = -1; //must be done here 20110802 lgnq /* make all interrupts level triggered */ (ls1b_hw0_icregs+0)->int_edge = 0x0000e000; /* mask all interrupts */ diff --git a/libcpu/mips/loongson_1b/ls1b.h b/libcpu/mips/loongson_1b/ls1b.h index 34393a344..3dab7f9da 100644 --- a/libcpu/mips/loongson_1b/ls1b.h +++ b/libcpu/mips/loongson_1b/ls1b.h @@ -1,7 +1,7 @@ /* * File : ls1b.h * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006-2011, RT-Thread Develop Team + * COPYRIGHT (C) 2006-2021, RT-Thread Develop Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -17,35 +17,35 @@ #include "../common/mipsregs.h" -#define LS1B_ACPI_IRQ 0 -#define LS1B_HPET_IRQ 1 -#define LS1B_UART0_IRQ 2 -#define LS1B_UART1_IRQ 3 -#define LS1B_UART2_IRQ 4 -#define LS1B_UART3_IRQ 5 -#define LS1B_CAN0_IRQ 6 -#define LS1B_CAN1_IRQ 7 -#define LS1B_SPI0_IRQ 8 -#define LS1B_SPI1_IRQ 9 -#define LS1B_AC97_IRQ 10 -#define LS1B_MS_IRQ 11 -#define LS1B_KB_IRQ 12 -#define LS1B_DMA0_IRQ 13 -#define LS1B_DMA1_IRQ 14 -#define LS1B_NAND_IRQ 15 -#define LS1B_I2C0_IRQ 16 -#define LS1B_I2C1_IRQ 17 -#define LS1B_PWM0_IRQ 18 -#define LS1B_PWM1_IRQ 19 -#define LS1B_PWM2_IRQ 20 -#define LS1B_PWM3_IRQ 21 -#define LS1B_LPC_IRQ 22 -#define LS1B_EHCI_IRQ 32 -#define LS1B_OHCI_IRQ 33 -#define LS1B_GMAC1_IRQ 34 -#define LS1B_GMAC2_IRQ 35 -#define LS1B_SATA_IRQ 36 -#define LS1B_GPU_IRQ 37 +#define LS1B_ACPI_IRQ 0 +#define LS1B_HPET_IRQ 1 +#define LS1B_UART0_IRQ 2 +#define LS1B_UART1_IRQ 3 +#define LS1B_UART2_IRQ 4 +#define LS1B_UART3_IRQ 5 +#define LS1B_CAN0_IRQ 6 +#define LS1B_CAN1_IRQ 7 +#define LS1B_SPI0_IRQ 8 +#define LS1B_SPI1_IRQ 9 +#define LS1B_AC97_IRQ 10 +#define LS1B_MS_IRQ 11 +#define LS1B_KB_IRQ 12 +#define LS1B_DMA0_IRQ 13 +#define LS1B_DMA1_IRQ 14 +#define LS1B_NAND_IRQ 15 +#define LS1B_I2C0_IRQ 16 +#define LS1B_I2C1_IRQ 17 +#define LS1B_PWM0_IRQ 18 +#define LS1B_PWM1_IRQ 19 +#define LS1B_PWM2_IRQ 20 +#define LS1B_PWM3_IRQ 21 +#define LS1B_LPC_IRQ 22 +#define LS1B_EHCI_IRQ 32 +#define LS1B_OHCI_IRQ 33 +#define LS1B_GMAC1_IRQ 34 +#define LS1B_GMAC2_IRQ 35 +#define LS1B_SATA_IRQ 36 +#define LS1B_GPU_IRQ 37 #define LS1B_PCI_INTA_IRQ 38 #define LS1B_PCI_INTB_IRQ 39 #define LS1B_PCI_INTC_IRQ 40 @@ -56,13 +56,13 @@ #define LS1B_GPIO_IRQ_COUNT 96 #define LS1B_GPIO_LAST_IRQ (LS1B_GPIO_FIRST_IRQ + LS1B_GPIO_IRQ_COUNT-1) -#define INT_PCI_INTA (1<<6) -#define INT_PCI_INTB (1<<7) -#define INT_PCI_INTC (1<<8) -#define INT_PCI_INTD (1<<9) +#define INT_PCI_INTA (1<<6) +#define INT_PCI_INTB (1<<7) +#define INT_PCI_INTC (1<<8) +#define INT_PCI_INTD (1<<9) #define LS1B_LAST_IRQ 159 -#define MIPS_CPU_TIMER_IRQ 167 +#define MIPS_CPU_TIMER_IRQ 167 #define LS1B_INTREG_BASE 0xbfd01040 #define LS1B_DMA_IRQ_BASE 168 @@ -70,71 +70,71 @@ struct ls1b_intc_regs { - volatile unsigned int int_isr; - volatile unsigned int int_en; - volatile unsigned int int_set; - volatile unsigned int int_clr; /* offset 0x10*/ - volatile unsigned int int_pol; - volatile unsigned int int_edge; /* offset 0 */ -}; + volatile unsigned int int_isr; + volatile unsigned int int_en; + volatile unsigned int int_set; + volatile unsigned int int_clr; /* offset 0x10*/ + volatile unsigned int int_pol; + volatile unsigned int int_edge; /* offset 0 */ +}; struct ls1b_cop_global_regs { - volatile unsigned int control; - volatile unsigned int rd_inten; - volatile unsigned int wr_inten; - volatile unsigned int rd_intisr; /* offset 0x10*/ - volatile unsigned int wr_intisr; - unsigned int unused[11]; -} ; + volatile unsigned int control; + volatile unsigned int rd_inten; + volatile unsigned int wr_inten; + volatile unsigned int rd_intisr; /* offset 0x10*/ + volatile unsigned int wr_intisr; + unsigned int unused[11]; +} ; struct ls1b_cop_channel_regs { - volatile unsigned int rd_control; - volatile unsigned int rd_src; - volatile unsigned int rd_cnt; - volatile unsigned int rd_status; /* offset 0x10*/ - volatile unsigned int wr_control; - volatile unsigned int wr_src; - volatile unsigned int wr_cnt; - volatile unsigned int wr_status; /* offset 0x10*/ -} ; + volatile unsigned int rd_control; + volatile unsigned int rd_src; + volatile unsigned int rd_cnt; + volatile unsigned int rd_status; /* offset 0x10*/ + volatile unsigned int wr_control; + volatile unsigned int wr_src; + volatile unsigned int wr_cnt; + volatile unsigned int wr_status; /* offset 0x10*/ +} ; struct ls1b_cop_regs { - struct ls1b_cop_global_regs global; - struct ls1b_cop_channel_regs chan[8][2]; + struct ls1b_cop_global_regs global; + struct ls1b_cop_channel_regs chan[8][2]; } ; -#define __REG8(addr) *((volatile unsigned char *)(addr)) -#define __REG16(addr) *((volatile unsigned short *)(addr)) -#define __REG32(addr) *((volatile unsigned int *)(addr)) - -#define GMAC0_BASE 0xBFE10000 -#define GMAC0_DMA_BASE 0xBFE11000 -#define GMAC1_BASE 0xBFE20000 -#define GMAC1_DMA_BASE 0xBFE21000 -#define I2C0_BASE 0xBFE58000 -#define PWM0_BASE 0xBFE5C000 -#define PWM1_BASE 0xBFE5C010 -#define PWM2_BASE 0xBFE5C020 -#define PWM3_BASE 0xBFE5C030 -#define WDT_BASE 0xBFE5C060 -#define RTC_BASE 0xBFE64000 -#define I2C1_BASE 0xBFE68000 -#define I2C2_BASE 0xBFE70000 -#define AC97_BASE 0xBFE74000 -#define NAND_BASE 0xBFE78000 -#define SPI_BASE 0xBFE80000 -#define CAN1_BASE 0xBF004300 -#define CAN0_BASE 0xBF004400 +#define __REG8(addr) *((volatile unsigned char *)(addr)) +#define __REG16(addr) *((volatile unsigned short *)(addr)) +#define __REG32(addr) *((volatile unsigned int *)(addr)) + +#define GMAC0_BASE 0xBFE10000 +#define GMAC0_DMA_BASE 0xBFE11000 +#define GMAC1_BASE 0xBFE20000 +#define GMAC1_DMA_BASE 0xBFE21000 +#define I2C0_BASE 0xBFE58000 +#define PWM0_BASE 0xBFE5C000 +#define PWM1_BASE 0xBFE5C010 +#define PWM2_BASE 0xBFE5C020 +#define PWM3_BASE 0xBFE5C030 +#define WDT_BASE 0xBFE5C060 +#define RTC_BASE 0xBFE64000 +#define I2C1_BASE 0xBFE68000 +#define I2C2_BASE 0xBFE70000 +#define AC97_BASE 0xBFE74000 +#define NAND_BASE 0xBFE78000 +#define SPI_BASE 0xBFE80000 +#define CAN1_BASE 0xBF004300 +#define CAN0_BASE 0xBF004400 /* Watch Dog registers */ -#define WDT_EN __REG32(WDT_BASE + 0x00) -#define WDT_SET __REG32(WDT_BASE + 0x04) -#define WDT_TIMER __REG32(WDT_BASE + 0x08) +#define WDT_EN __REG32(WDT_BASE + 0x00) +#define WDT_SET __REG32(WDT_BASE + 0x04) +#define WDT_TIMER __REG32(WDT_BASE + 0x08) -#define PLL_FREQ __REG32(0xbfe78030) -#define PLL_DIV_PARAM __REG32(0xbfe78034) +#define PLL_FREQ __REG32(0xbfe78030) +#define PLL_DIV_PARAM __REG32(0xbfe78034) #endif diff --git a/libcpu/mips/loongson_1b/mipscfg.c b/libcpu/mips/loongson_1b/mipscfg.c index 10dd3fee9..73e9efd96 100644 --- a/libcpu/mips/loongson_1b/mipscfg.c +++ b/libcpu/mips/loongson_1b/mipscfg.c @@ -17,18 +17,18 @@ mips32_core_cfg_t g_mips_core = { - 16, /* icache_line_size */ - 256, /* icache_lines_per_way */ - 4, /* icache_ways */ - 16, /* dcache_line_size */ - 256, /* dcache_lines_per_way */ - 4, /* dcache_ways */ - 16, /* max_tlb_entries */ + 16, /* icache_line_size */ + 256, /* icache_lines_per_way */ + 4, /* icache_ways */ + 16, /* dcache_line_size */ + 256, /* dcache_lines_per_way */ + 4, /* dcache_ways */ + 16, /* max_tlb_entries */ }; static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) { - rt_uint16_t rets = 1; + rt_uint16_t rets = 1; while (n--) rets *= b; @@ -38,7 +38,7 @@ static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) static rt_uint16_t m_log2(rt_uint16_t b) { - rt_uint16_t rets = 0; + rt_uint16_t rets = 0; while (b != 1) { @@ -54,29 +54,29 @@ static rt_uint16_t m_log2(rt_uint16_t b) */ void mips32_cfg_init(void) { - rt_uint16_t val; - rt_uint32_t cp0_config1; + rt_uint16_t val; + rt_uint32_t cp0_config1; - cp0_config1 = read_c0_config(); - if (cp0_config1 & 0x80000000) - { - cp0_config1 = read_c0_config1(); + cp0_config1 = read_c0_config(); + if (cp0_config1 & 0x80000000) + { + cp0_config1 = read_c0_config1(); - val = (cp0_config1 & (7<<22))>>22; - g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<19))>>19; - g_mips_core.icache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<16))>>16; - g_mips_core.icache_ways = val + 1; + val = (cp0_config1 & (7<<22))>>22; + g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); + val = (cp0_config1 & (7<<19))>>19; + g_mips_core.icache_line_size = 2 * m_pow(2, val); + val = (cp0_config1 & (7<<16))>>16; + g_mips_core.icache_ways = val + 1; - val = (cp0_config1 & (7<<13))>>13; - g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<10))>>10; - g_mips_core.dcache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<7))>>7; - g_mips_core.dcache_ways = val + 1; + val = (cp0_config1 & (7<<13))>>13; + g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); + val = (cp0_config1 & (7<<10))>>10; + g_mips_core.dcache_line_size = 2 * m_pow(2, val); + val = (cp0_config1 & (7<<7))>>7; + g_mips_core.dcache_ways = val + 1; - val = (cp0_config1 & (0x3F<<25))>>25; - g_mips_core.max_tlb_entries = val + 1; - } + val = (cp0_config1 & (0x3F<<25))>>25; + g_mips_core.max_tlb_entries = val + 1; + } } diff --git a/libcpu/mips/loongson_1c/cache.c b/libcpu/mips/loongson_1c/cache.c index bf97db9b4..c755c0e4e 100644 --- a/libcpu/mips/loongson_1c/cache.c +++ b/libcpu/mips/loongson_1c/cache.c @@ -13,12 +13,12 @@ * 2011-08-08 lgnq modified for LS1B * 2015-07-08 chinesebear modified for loongson 1c */ - + #include #include "../common/mipsregs.h" -#define K0BASE 0x80000000 -#define PRID_LS1C 0x4220 +#define K0BASE 0x80000000 +#define PRID_LS1C 0x4220 extern void Clear_TagLo (void); extern void Invalidate_Icache_Ls1c(unsigned int); @@ -27,21 +27,21 @@ extern void Invalidate_Dcache_Fill_Ls1c(unsigned int); extern void Writeback_Invalidate_Dcache(unsigned int); extern void enable_cpu_cache(void); -typedef struct cacheinfo_t +typedef struct cacheinfo_t { - unsigned int icache_size; - unsigned int dcache_size; - unsigned int icacheline_size; - unsigned int dcacheline_size; + unsigned int icache_size; + unsigned int dcache_size; + unsigned int icacheline_size; + unsigned int dcacheline_size; } cacheinfo_t ; -typedef struct cacheop_t +typedef struct cacheop_t { - void (*Clear_TagLo) (void); - void (*Invalidate_Icache) (unsigned int); - void (*Invalidate_Dcache_Fill) (unsigned int); - void (*Invalidate_Dcache_ClearTag) (unsigned int); - void (*Init_Cache)(void); + void (*Clear_TagLo) (void); + void (*Invalidate_Icache) (unsigned int); + void (*Invalidate_Dcache_Fill) (unsigned int); + void (*Invalidate_Dcache_ClearTag) (unsigned int); + void (*Init_Cache)(void); } cacheop_t ; static cacheop_t cacheop, *pcacheop; @@ -54,24 +54,24 @@ int identify_cpu(void) pcacheop = &cacheop; pcacheinfo = &cacheinfo; - rt_kprintf("CPU configure: 0x%08x\n", read_c0_config()); + rt_kprintf("CPU configure: 0x%08x\n", read_c0_config()); cpu_id = read_c0_prid(); switch (cpu_id) - { - case PRID_LS1C: - rt_kprintf("CPU:Loongson 1C\n"); - pcacheop->Clear_TagLo = Clear_TagLo; - pcacheop->Invalidate_Icache = Invalidate_Icache_Ls1c; - pcacheop->Invalidate_Dcache_Fill = Invalidate_Dcache_Fill_Ls1c; - pcacheop->Invalidate_Dcache_ClearTag = Invalidate_Dcache_ClearTag_Ls1c; - break; - default: - rt_kprintf("Unknown CPU type, system halted!\n"); - while (1) - { - ; - } - break; + { + case PRID_LS1C: + rt_kprintf("CPU:Loongson 1C\n"); + pcacheop->Clear_TagLo = Clear_TagLo; + pcacheop->Invalidate_Icache = Invalidate_Icache_Ls1c; + pcacheop->Invalidate_Dcache_Fill = Invalidate_Dcache_Fill_Ls1c; + pcacheop->Invalidate_Dcache_ClearTag = Invalidate_Dcache_ClearTag_Ls1c; + break; + default: + rt_kprintf("Unknown CPU type, system halted!\n"); + while (1) + { + ; + } + break; } return 0; @@ -90,7 +90,7 @@ void probe_cache(void) icache_sets = 64 << ((config1 >> 22) & 7); icache_ways = 1 + ((config1 >> 16) & 7); icache_size = icache_sets * icache_ways * icache_line_size; - + if ((dcache_line_size = ((config1 >> 10) & 7))) dcache_line_size = 2 << dcache_line_size; else @@ -98,7 +98,7 @@ void probe_cache(void) dcache_sets = 64 << ((config1 >> 13) & 7); dcache_ways = 1 + ((config1 >> 7) & 7); dcache_size = dcache_sets * dcache_ways * dcache_line_size; - + rt_kprintf("DCache %2dkb, linesize %d bytes.\n", dcache_size >> 10, dcache_line_size); rt_kprintf("ICache %2dkb, linesize %d bytes.\n", icache_size >> 10, icache_line_size); @@ -112,122 +112,122 @@ void probe_cache(void) void invalidate_writeback_dcache_all(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); - - while (start < end) - { - Writeback_Invalidate_Dcache(start); //hit writeback invalidate - start += pcacheinfo->dcacheline_size; - } + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); + + while (start < end) + { + Writeback_Invalidate_Dcache(start); //hit writeback invalidate + start += pcacheinfo->dcacheline_size; + } } void invalidate_writeback_dcache(unsigned long addr, int size) { - unsigned long start, end; - - start = (addr +pcacheinfo->dcacheline_size -1) & (- pcacheinfo->dcacheline_size); - end = (end + size + pcacheinfo->dcacheline_size -1) & ( -pcacheinfo->dcacheline_size); - - while (start dcacheline_size; - } + unsigned long start, end; + + start = (addr +pcacheinfo->dcacheline_size -1) & (- pcacheinfo->dcacheline_size); + end = (end + size + pcacheinfo->dcacheline_size -1) & ( -pcacheinfo->dcacheline_size); + + while (start dcacheline_size; + } } void invalidate_icache_all(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->icache_size); - - while (start < end) - { - pcacheop->Invalidate_Icache(start); - start += pcacheinfo->icacheline_size; - } + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->icache_size); + + while (start < end) + { + pcacheop->Invalidate_Icache(start); + start += pcacheinfo->icacheline_size; + } } void invalidate_dcache_all(void) -{ - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); - while (start icacheline_size; - } +{ + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); + while (start icacheline_size; + } } //with cache disabled void init_dcache(void) { - unsigned int start = K0BASE; - unsigned int end = (start + pcacheinfo->dcache_size); + unsigned int start = K0BASE; + unsigned int end = (start + pcacheinfo->dcache_size); - while (start < end) - { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; - } + while (start < end) + { + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; + } } void rt_hw_cache_init(void) { unsigned int start, end; - - /* 1. identify cpu and probe cache */ - identify_cpu(); - probe_cache(); - start = K0BASE; - end = (start + pcacheinfo->icache_size); + /* 1. identify cpu and probe cache */ + identify_cpu(); + probe_cache(); + + start = K0BASE; + end = (start + pcacheinfo->icache_size); /* - * 2. clear CP0 taglo/taghi register; + * 2. clear CP0 taglo/taghi register; */ pcacheop->Clear_TagLo(); - /* - * 3. invalidate instruction cache; + /* + * 3. invalidate instruction cache; */ - while (start < end) + while (start < end) { - pcacheop->Invalidate_Icache(start); //index invalidate icache - start += pcacheinfo->icacheline_size; + pcacheop->Invalidate_Icache(start); //index invalidate icache + start += pcacheinfo->icacheline_size; } /* - * 4. invalidate data cache; + * 4. invalidate data cache; */ start = K0BASE; end = (start + pcacheinfo->dcache_size); - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; } start = K0BASE; - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_Fill(start); //index invalidate dcache - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_Fill(start); //index invalidate dcache + start += pcacheinfo->dcacheline_size; } start = K0BASE; - while(start < end) + while(start < end) { - pcacheop->Invalidate_Dcache_ClearTag(start); - start += pcacheinfo->dcacheline_size; + pcacheop->Invalidate_Dcache_ClearTag(start); + start += pcacheinfo->dcacheline_size; } - /* enable cache */ - enable_cpu_cache(); - rt_kprintf("enable cpu cache done\n"); + /* enable cache */ + enable_cpu_cache(); + rt_kprintf("enable cpu cache done\n"); - return ; + return ; } diff --git a/libcpu/mips/loongson_1c/cache.h b/libcpu/mips/loongson_1c/cache.h index b5c2d4501..8ca015ef4 100644 --- a/libcpu/mips/loongson_1c/cache.h +++ b/libcpu/mips/loongson_1c/cache.h @@ -12,8 +12,8 @@ * 2010-07-09 Bernard first version * 2011-08-08 lgnq modified for LS1B */ -#ifndef __CACHE_H__ -#define __CACHE_H__ +#ifndef __CACHE_H__ +#define __CACHE_H__ /* * Cache Operations @@ -22,31 +22,31 @@ #define Index_Writeback_Inv_D 0x01 #define Index_Invalidate_SI 0x02 #define Index_Writeback_Inv_SD 0x03 -#define Index_Load_Tag_I 0x04 -#define Index_Load_Tag_D 0x05 -#define Index_Load_Tag_SI 0x06 -#define Index_Load_Tag_SD 0x07 -#define Index_Store_Tag_I 0x08 -#define Index_Store_Tag_D 0x09 -#define Index_Store_Tag_SI 0x0A -#define Index_Store_Tag_SD 0x0B -#define Create_Dirty_Excl_D 0x0d -#define Create_Dirty_Excl_SD 0x0f -#define Hit_Invalidate_I 0x10 -#define Hit_Invalidate_D 0x11 -#define Hit_Invalidate_SI 0x12 -#define Hit_Invalidate_SD 0x13 -#define Fill 0x14 -#define Hit_Writeback_Inv_D 0x15 +#define Index_Load_Tag_I 0x04 +#define Index_Load_Tag_D 0x05 +#define Index_Load_Tag_SI 0x06 +#define Index_Load_Tag_SD 0x07 +#define Index_Store_Tag_I 0x08 +#define Index_Store_Tag_D 0x09 +#define Index_Store_Tag_SI 0x0A +#define Index_Store_Tag_SD 0x0B +#define Create_Dirty_Excl_D 0x0d +#define Create_Dirty_Excl_SD 0x0f +#define Hit_Invalidate_I 0x10 +#define Hit_Invalidate_D 0x11 +#define Hit_Invalidate_SI 0x12 +#define Hit_Invalidate_SD 0x13 +#define Fill 0x14 +#define Hit_Writeback_Inv_D 0x15 /* 0x16 is unused */ -#define Hit_Writeback_Inv_SD 0x17 -#define Hit_Writeback_I 0x18 -#define Hit_Writeback_D 0x19 +#define Hit_Writeback_Inv_SD 0x17 +#define Hit_Writeback_I 0x18 +#define Hit_Writeback_D 0x19 /* 0x1a is unused */ -#define Hit_Writeback_SD 0x1b +#define Hit_Writeback_SD 0x1b /* 0x1c is unused */ /* 0x1e is unused */ -#define Hit_Set_Virtual_SI 0x1e -#define Hit_Set_Virtual_SD 0x1f +#define Hit_Set_Virtual_SI 0x1e +#define Hit_Set_Virtual_SD 0x1f #endif diff --git a/libcpu/mips/loongson_1c/cpuport.c b/libcpu/mips/loongson_1c/cpuport.c index 03fdc2a51..147f4882b 100644 --- a/libcpu/mips/loongson_1c/cpuport.c +++ b/libcpu/mips/loongson_1c/cpuport.c @@ -31,13 +31,13 @@ register rt_uint32_t $GP __asm__ ("$28"); */ void rt_hw_cpu_reset(void) { - /* open the watch-dog */ - WDT_EN = 0x01; /* watch dog enable */ - WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */ - WDT_SET = 0x01; /* watch dog start */ + /* open the watch-dog */ + WDT_EN = 0x01; /* watch dog enable */ + WDT_TIMER = 0x01; /* watch dog will be timeout after 1 tick */ + WDT_SET = 0x01; /* watch dog start */ - rt_kprintf("reboot system...\n"); - while (1); + rt_kprintf("reboot system...\n"); + while (1); } /** @@ -46,9 +46,9 @@ void rt_hw_cpu_reset(void) */ void rt_hw_cpu_shutdown(void) { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } extern rt_uint32_t cp0_get_cause(void); @@ -68,73 +68,73 @@ extern rt_uint32_t cp0_get_lo(void); */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) { - rt_uint32_t *stk; + rt_uint32_t *stk; static rt_uint32_t g_sr = 0; - static rt_uint32_t g_gp = 0; + static rt_uint32_t g_gp = 0; if (g_sr == 0) { - g_sr = cp0_get_status(); - g_sr &= 0xfffffffe; - g_sr |= 0x8401; + g_sr = cp0_get_status(); + g_sr &= 0xfffffffe; + g_sr |= 0x8401; - g_gp = $GP; + g_gp = $GP; } /** Start at stack top */ stk = (rt_uint32_t *)stack_addr; - *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ - *(--stk) = (rt_uint32_t) 0xeeee; /* c0_cause */ - *(--stk) = (rt_uint32_t) 0xffff; /* c0_badvaddr */ - *(--stk) = (rt_uint32_t) cp0_get_lo(); /* lo */ - *(--stk) = (rt_uint32_t) cp0_get_hi(); /* hi */ - *(--stk) = (rt_uint32_t) g_sr; /* C0_SR: HW2 = En, IE = En */ - *(--stk) = (rt_uint32_t) texit; /* ra */ - *(--stk) = (rt_uint32_t) 0x0000001e; /* s8 */ - *(--stk) = (rt_uint32_t) stack_addr; /* sp */ - *(--stk) = (rt_uint32_t) g_gp; /* gp */ - *(--stk) = (rt_uint32_t) 0x0000001b; /* k1 */ - *(--stk) = (rt_uint32_t) 0x0000001a; /* k0 */ - *(--stk) = (rt_uint32_t) 0x00000019; /* t9 */ - *(--stk) = (rt_uint32_t) 0x00000018; /* t8 */ - *(--stk) = (rt_uint32_t) 0x00000017; /* s7 */ - *(--stk) = (rt_uint32_t) 0x00000016; /* s6 */ - *(--stk) = (rt_uint32_t) 0x00000015; /* s5 */ - *(--stk) = (rt_uint32_t) 0x00000014; /* s4 */ - *(--stk) = (rt_uint32_t) 0x00000013; /* s3 */ - *(--stk) = (rt_uint32_t) 0x00000012; /* s2 */ - *(--stk) = (rt_uint32_t) 0x00000011; /* s1 */ - *(--stk) = (rt_uint32_t) 0x00000010; /* s0 */ - *(--stk) = (rt_uint32_t) 0x0000000f; /* t7 */ - *(--stk) = (rt_uint32_t) 0x0000000e; /* t6 */ - *(--stk) = (rt_uint32_t) 0x0000000d; /* t5 */ - *(--stk) = (rt_uint32_t) 0x0000000c; /* t4 */ - *(--stk) = (rt_uint32_t) 0x0000000b; /* t3 */ - *(--stk) = (rt_uint32_t) 0x0000000a; /* t2 */ - *(--stk) = (rt_uint32_t) 0x00000009; /* t1 */ - *(--stk) = (rt_uint32_t) 0x00000008; /* t0 */ - *(--stk) = (rt_uint32_t) 0x00000007; /* a3 */ - *(--stk) = (rt_uint32_t) 0x00000006; /* a2 */ - *(--stk) = (rt_uint32_t) 0x00000005; /* a1 */ - *(--stk) = (rt_uint32_t) parameter; /* a0 */ - *(--stk) = (rt_uint32_t) 0x00000003; /* v1 */ - *(--stk) = (rt_uint32_t) 0x00000002; /* v0 */ - *(--stk) = (rt_uint32_t) 0x00000001; /* at */ - *(--stk) = (rt_uint32_t) 0x00000000; /* zero */ - - /* return task's current stack address */ - return (rt_uint8_t *)stk; + *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ + *(--stk) = (rt_uint32_t) 0xeeee; /* c0_cause */ + *(--stk) = (rt_uint32_t) 0xffff; /* c0_badvaddr */ + *(--stk) = (rt_uint32_t) cp0_get_lo(); /* lo */ + *(--stk) = (rt_uint32_t) cp0_get_hi(); /* hi */ + *(--stk) = (rt_uint32_t) g_sr; /* C0_SR: HW2 = En, IE = En */ + *(--stk) = (rt_uint32_t) texit; /* ra */ + *(--stk) = (rt_uint32_t) 0x0000001e; /* s8 */ + *(--stk) = (rt_uint32_t) stack_addr; /* sp */ + *(--stk) = (rt_uint32_t) g_gp; /* gp */ + *(--stk) = (rt_uint32_t) 0x0000001b; /* k1 */ + *(--stk) = (rt_uint32_t) 0x0000001a; /* k0 */ + *(--stk) = (rt_uint32_t) 0x00000019; /* t9 */ + *(--stk) = (rt_uint32_t) 0x00000018; /* t8 */ + *(--stk) = (rt_uint32_t) 0x00000017; /* s7 */ + *(--stk) = (rt_uint32_t) 0x00000016; /* s6 */ + *(--stk) = (rt_uint32_t) 0x00000015; /* s5 */ + *(--stk) = (rt_uint32_t) 0x00000014; /* s4 */ + *(--stk) = (rt_uint32_t) 0x00000013; /* s3 */ + *(--stk) = (rt_uint32_t) 0x00000012; /* s2 */ + *(--stk) = (rt_uint32_t) 0x00000011; /* s1 */ + *(--stk) = (rt_uint32_t) 0x00000010; /* s0 */ + *(--stk) = (rt_uint32_t) 0x0000000f; /* t7 */ + *(--stk) = (rt_uint32_t) 0x0000000e; /* t6 */ + *(--stk) = (rt_uint32_t) 0x0000000d; /* t5 */ + *(--stk) = (rt_uint32_t) 0x0000000c; /* t4 */ + *(--stk) = (rt_uint32_t) 0x0000000b; /* t3 */ + *(--stk) = (rt_uint32_t) 0x0000000a; /* t2 */ + *(--stk) = (rt_uint32_t) 0x00000009; /* t1 */ + *(--stk) = (rt_uint32_t) 0x00000008; /* t0 */ + *(--stk) = (rt_uint32_t) 0x00000007; /* a3 */ + *(--stk) = (rt_uint32_t) 0x00000006; /* a2 */ + *(--stk) = (rt_uint32_t) 0x00000005; /* a1 */ + *(--stk) = (rt_uint32_t) parameter; /* a0 */ + *(--stk) = (rt_uint32_t) 0x00000003; /* v1 */ + *(--stk) = (rt_uint32_t) 0x00000002; /* v0 */ + *(--stk) = (rt_uint32_t) 0x00000001; /* at */ + *(--stk) = (rt_uint32_t) 0x00000000; /* zero */ + + /* return task's current stack address */ + return (rt_uint8_t *)stk; } #define cache_op(op,addr) \ - __asm__ __volatile__( \ - " .set push \n" \ - " .set noreorder \n" \ - " .set mips3\n\t \n" \ - " cache %0, %1 \n" \ - " .set pop \n" \ - : \ - : "i" (op), "R" (*(unsigned char *)(addr))) + __asm__ __volatile__( \ + " .set push \n" \ + " .set noreorder \n" \ + " .set mips3\n\t \n" \ + " cache %0, %1 \n" \ + " .set pop \n" \ + : \ + : "i" (op), "R" (*(unsigned char *)(addr))) #if defined(CONFIG_CPU_LOONGSON2) #define Hit_Invalidate_I 0x00 @@ -148,17 +148,17 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_ad void flush_cache(unsigned long start_addr, unsigned long size) { - unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE; - unsigned long addr = start_addr & ~(lsize - 1); - unsigned long aend = (start_addr + size - 1) & ~(lsize - 1); - - while (1) { - cache_op(Hit_Writeback_Inv_D, addr); - cache_op(Hit_Invalidate_I, addr); - if (addr == aend) - break; - addr += lsize; - } + unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE; + unsigned long addr = start_addr & ~(lsize - 1); + unsigned long aend = (start_addr + size - 1) & ~(lsize - 1); + + while (1) { + cache_op(Hit_Writeback_Inv_D, addr); + cache_op(Hit_Invalidate_I, addr); + if (addr == aend) + break; + addr += lsize; + } } diff --git a/libcpu/mips/loongson_1c/exception.c b/libcpu/mips/loongson_1c/exception.c index 4a3745cbc..dbcec42ab 100644 --- a/libcpu/mips/loongson_1c/exception.c +++ b/libcpu/mips/loongson_1c/exception.c @@ -25,7 +25,7 @@ /** * exception handle table */ -#define RT_EXCEPTION_MAX 8 +#define RT_EXCEPTION_MAX 8 exception_func_t sys_exception_handlers[RT_EXCEPTION_MAX]; /** @@ -47,45 +47,45 @@ exception_func_t rt_set_except_vector(int n, exception_func_t func) void tlb_refill_handler(void) { - rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); + rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); + rt_hw_cpu_shutdown(); } void cache_error_handler(void) { - rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); + rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); + rt_hw_cpu_shutdown(); } static void unhandled_exception_handle(pt_regs_t *regs) { - rt_kprintf("exception happens, epc: 0x%08x, cause: 0x%08x\n", regs->cp0_epc, read_c0_cause()); + rt_kprintf("exception happens, epc: 0x%08x, cause: 0x%08x\n", regs->cp0_epc, read_c0_cause()); } void install_default_execpt_handle(void) { - rt_int32_t i; + rt_int32_t i; - for (i=0; i> 8; - - for (index = RT_EXCEPTION_MAX; index > 0; index --) - { - if (cause & (1 << index)) - { - sys_exception_handlers[index](regs); - cause &= ~(1 << index); - } - } + rt_uint32_t cause; + rt_uint32_t index; + + cause = (read_c0_cause() & read_c0_config()); + cause = (cause & 0xfc00) >> 8; + + for (index = RT_EXCEPTION_MAX; index > 0; index --) + { + if (cause & (1 << index)) + { + sys_exception_handlers[index](regs); + cause &= ~(1 << index); + } + } } /*@}*/ diff --git a/libcpu/mips/loongson_1c/mipscfg.c b/libcpu/mips/loongson_1c/mipscfg.c index 10dd3fee9..73e9efd96 100644 --- a/libcpu/mips/loongson_1c/mipscfg.c +++ b/libcpu/mips/loongson_1c/mipscfg.c @@ -17,18 +17,18 @@ mips32_core_cfg_t g_mips_core = { - 16, /* icache_line_size */ - 256, /* icache_lines_per_way */ - 4, /* icache_ways */ - 16, /* dcache_line_size */ - 256, /* dcache_lines_per_way */ - 4, /* dcache_ways */ - 16, /* max_tlb_entries */ + 16, /* icache_line_size */ + 256, /* icache_lines_per_way */ + 4, /* icache_ways */ + 16, /* dcache_line_size */ + 256, /* dcache_lines_per_way */ + 4, /* dcache_ways */ + 16, /* max_tlb_entries */ }; static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) { - rt_uint16_t rets = 1; + rt_uint16_t rets = 1; while (n--) rets *= b; @@ -38,7 +38,7 @@ static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) static rt_uint16_t m_log2(rt_uint16_t b) { - rt_uint16_t rets = 0; + rt_uint16_t rets = 0; while (b != 1) { @@ -54,29 +54,29 @@ static rt_uint16_t m_log2(rt_uint16_t b) */ void mips32_cfg_init(void) { - rt_uint16_t val; - rt_uint32_t cp0_config1; + rt_uint16_t val; + rt_uint32_t cp0_config1; - cp0_config1 = read_c0_config(); - if (cp0_config1 & 0x80000000) - { - cp0_config1 = read_c0_config1(); + cp0_config1 = read_c0_config(); + if (cp0_config1 & 0x80000000) + { + cp0_config1 = read_c0_config1(); - val = (cp0_config1 & (7<<22))>>22; - g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<19))>>19; - g_mips_core.icache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<16))>>16; - g_mips_core.icache_ways = val + 1; + val = (cp0_config1 & (7<<22))>>22; + g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); + val = (cp0_config1 & (7<<19))>>19; + g_mips_core.icache_line_size = 2 * m_pow(2, val); + val = (cp0_config1 & (7<<16))>>16; + g_mips_core.icache_ways = val + 1; - val = (cp0_config1 & (7<<13))>>13; - g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<10))>>10; - g_mips_core.dcache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<7))>>7; - g_mips_core.dcache_ways = val + 1; + val = (cp0_config1 & (7<<13))>>13; + g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); + val = (cp0_config1 & (7<<10))>>10; + g_mips_core.dcache_line_size = 2 * m_pow(2, val); + val = (cp0_config1 & (7<<7))>>7; + g_mips_core.dcache_ways = val + 1; - val = (cp0_config1 & (0x3F<<25))>>25; - g_mips_core.max_tlb_entries = val + 1; - } + val = (cp0_config1 & (0x3F<<25))>>25; + g_mips_core.max_tlb_entries = val + 1; + } } diff --git a/libcpu/mips/pic32/cpuport.c b/libcpu/mips/pic32/cpuport.c index 3f08d5716..089f652bc 100644 --- a/libcpu/mips/pic32/cpuport.c +++ b/libcpu/mips/pic32/cpuport.c @@ -45,51 +45,51 @@ rt_uint32_t __attribute__((nomips16)) _get_gp(void) */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) { - rt_uint32_t *stk; + rt_uint32_t *stk; /** Start at stack top */ stk = (rt_uint32_t *)stack_addr; - *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ - *(--stk) = (rt_uint32_t) 0x00800000; /* c0_cause: IV=1, */ - *(--stk) = (rt_uint32_t) 0; /* c0_badvaddr */ - *(--stk) = (rt_uint32_t) 0; /* lo */ - *(--stk) = (rt_uint32_t) 0; /* hi */ - *(--stk) = (rt_uint32_t) 1; /* C0_SR: IE = En, */ - *(--stk) = (rt_uint32_t) texit; /* 31 ra */ - *(--stk) = (rt_uint32_t) 0x0000001e; /* 30 s8 */ - *(--stk) = (rt_uint32_t) stack_addr; /* 29 sp */ - *(--stk) = (rt_uint32_t) _get_gp(); /* 28 gp */ - *(--stk) = (rt_uint32_t) 0x0000001b; /* 27 k1 */ - *(--stk) = (rt_uint32_t) 0x0000001a; /* 26 k0 */ - *(--stk) = (rt_uint32_t) 0x00000019; /* 25 t9 */ - *(--stk) = (rt_uint32_t) 0x00000018; /* 24 t8 */ - *(--stk) = (rt_uint32_t) 0x00000017; /* 23 s7 */ - *(--stk) = (rt_uint32_t) 0x00000016; /* 22 s6 */ - *(--stk) = (rt_uint32_t) 0x00000015; /* 21 s5 */ - *(--stk) = (rt_uint32_t) 0x00000014; /* 20 s4 */ - *(--stk) = (rt_uint32_t) 0x00000013; /* 19 s3 */ - *(--stk) = (rt_uint32_t) 0x00000012; /* 18 s2 */ - *(--stk) = (rt_uint32_t) 0x00000011; /* 17 s1 */ - *(--stk) = (rt_uint32_t) 0x00000010; /* 16 s0 */ - *(--stk) = (rt_uint32_t) 0x0000000f; /* 15 t7 */ - *(--stk) = (rt_uint32_t) 0x0000000e; /* 14 t6 */ - *(--stk) = (rt_uint32_t) 0x0000000d; /* 13 t5 */ - *(--stk) = (rt_uint32_t) 0x0000000c; /* 12 t4 */ - *(--stk) = (rt_uint32_t) 0x0000000b; /* 11 t3 */ - *(--stk) = (rt_uint32_t) 0x0000000a; /* 10 t2 */ - *(--stk) = (rt_uint32_t) 0x00000009; /* 9 t1 */ - *(--stk) = (rt_uint32_t) 0x00000008; /* 8 t0 */ - *(--stk) = (rt_uint32_t) 0x00000007; /* 7 a3 */ - *(--stk) = (rt_uint32_t) 0x00000006; /* 6 a2 */ - *(--stk) = (rt_uint32_t) 0x00000005; /* 5 a1 */ - *(--stk) = (rt_uint32_t) parameter; /* 4 a0 */ - *(--stk) = (rt_uint32_t) 0x00000003; /* 3 v1 */ - *(--stk) = (rt_uint32_t) 0x00000002; /* 2 v0 */ - *(--stk) = (rt_uint32_t) 0x00000001; /* 1 at */ - *(--stk) = (rt_uint32_t) 0x00000000; /* 0 zero */ + *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ + *(--stk) = (rt_uint32_t) 0x00800000; /* c0_cause: IV=1, */ + *(--stk) = (rt_uint32_t) 0; /* c0_badvaddr */ + *(--stk) = (rt_uint32_t) 0; /* lo */ + *(--stk) = (rt_uint32_t) 0; /* hi */ + *(--stk) = (rt_uint32_t) 1; /* C0_SR: IE = En, */ + *(--stk) = (rt_uint32_t) texit; /* 31 ra */ + *(--stk) = (rt_uint32_t) 0x0000001e; /* 30 s8 */ + *(--stk) = (rt_uint32_t) stack_addr; /* 29 sp */ + *(--stk) = (rt_uint32_t) _get_gp(); /* 28 gp */ + *(--stk) = (rt_uint32_t) 0x0000001b; /* 27 k1 */ + *(--stk) = (rt_uint32_t) 0x0000001a; /* 26 k0 */ + *(--stk) = (rt_uint32_t) 0x00000019; /* 25 t9 */ + *(--stk) = (rt_uint32_t) 0x00000018; /* 24 t8 */ + *(--stk) = (rt_uint32_t) 0x00000017; /* 23 s7 */ + *(--stk) = (rt_uint32_t) 0x00000016; /* 22 s6 */ + *(--stk) = (rt_uint32_t) 0x00000015; /* 21 s5 */ + *(--stk) = (rt_uint32_t) 0x00000014; /* 20 s4 */ + *(--stk) = (rt_uint32_t) 0x00000013; /* 19 s3 */ + *(--stk) = (rt_uint32_t) 0x00000012; /* 18 s2 */ + *(--stk) = (rt_uint32_t) 0x00000011; /* 17 s1 */ + *(--stk) = (rt_uint32_t) 0x00000010; /* 16 s0 */ + *(--stk) = (rt_uint32_t) 0x0000000f; /* 15 t7 */ + *(--stk) = (rt_uint32_t) 0x0000000e; /* 14 t6 */ + *(--stk) = (rt_uint32_t) 0x0000000d; /* 13 t5 */ + *(--stk) = (rt_uint32_t) 0x0000000c; /* 12 t4 */ + *(--stk) = (rt_uint32_t) 0x0000000b; /* 11 t3 */ + *(--stk) = (rt_uint32_t) 0x0000000a; /* 10 t2 */ + *(--stk) = (rt_uint32_t) 0x00000009; /* 9 t1 */ + *(--stk) = (rt_uint32_t) 0x00000008; /* 8 t0 */ + *(--stk) = (rt_uint32_t) 0x00000007; /* 7 a3 */ + *(--stk) = (rt_uint32_t) 0x00000006; /* 6 a2 */ + *(--stk) = (rt_uint32_t) 0x00000005; /* 5 a1 */ + *(--stk) = (rt_uint32_t) parameter; /* 4 a0 */ + *(--stk) = (rt_uint32_t) 0x00000003; /* 3 v1 */ + *(--stk) = (rt_uint32_t) 0x00000002; /* 2 v0 */ + *(--stk) = (rt_uint32_t) 0x00000001; /* 1 at */ + *(--stk) = (rt_uint32_t) 0x00000000; /* 0 zero */ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } diff --git a/libcpu/mips/x1000/cache.c b/libcpu/mips/x1000/cache.c deleted file mode 100644 index 5fc968281..000000000 --- a/libcpu/mips/x1000/cache.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * File : cache.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016/11/02 Urey the first version - */ - -#include -#include -#include - -#include "../common/mips.h" - - -#define CONFIG_SYS_DCACHE_SIZE 16384 -#define CONFIG_SYS_ICACHE_SIZE 16384 -#define CONFIG_SYS_CACHELINE_SIZE 32 - -#define K0_TO_K1() \ -do { \ - unsigned long __k0_addr; \ - \ - __asm__ __volatile__( \ - "la %0, 1f\n\t" \ - "or %0, %0, %1\n\t" \ - "jr %0\n\t" \ - "nop\n\t" \ - "1: nop\n" \ - : "=&r"(__k0_addr) \ - : "r" (0x20000000) ); \ -} while(0) - -#define K1_TO_K0() \ -do { \ - unsigned long __k0_addr; \ - __asm__ __volatile__( \ - "nop;nop;nop;nop;nop;nop;nop\n\t" \ - "la %0, 1f\n\t" \ - "jr %0\n\t" \ - "nop\n\t" \ - "1: nop\n" \ - : "=&r" (__k0_addr)); \ -} while (0) - -#define INVALIDATE_BTB() \ -do { \ - unsigned long tmp; \ - __asm__ __volatile__( \ - ".set mips32\n\t" \ - "mfc0 %0, $16, 7\n\t" \ - "nop\n\t" \ - "ori %0, 2\n\t" \ - "mtc0 %0, $16, 7\n\t" \ - "nop\n\t" \ - ".set mips2\n\t" \ - : "=&r" (tmp)); \ -} while (0) - -#define __sync() \ - __asm__ __volatile__( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - ".set mips2\n\t" \ - "sync\n\t" \ - ".set pop" \ - : /* no output */ \ - : /* no input */ \ - : "memory") - -#if defined(JZ4775) || defined(X1000) -#define SYNC_WB() \ -do { \ - __asm__ __volatile__ ( \ - "sync\n\t" \ - "lw $0, %0\n\t" \ - : \ - :"m"(*(int *)0xa0000000) \ - :"memory"); \ -} while (0) -#else -#error "not define sync wb" -#define SYNC_WB() __asm__ __volatile__ ("sync") -#endif - - -#undef cache_op -#define cache_op(op, addr) \ - __asm__ __volatile__( \ - ".set push\n" \ - ".set noreorder\n" \ - ".set mips3\n" \ - "cache %0, %1\n" \ - ".set pop\n" \ - : \ - : "i" (op), "R" (*(unsigned char *)(addr))) - - -void rt_hw_dcache_flush_line(rt_uint32_t addr) -{ - cache_op(HIT_WRITEBACK_INV_D, addr); - SYNC_WB(); -} - -void rt_hw_dcache_flush_range(rt_uint32_t start_addr, rt_uint32_t size) -{ - rt_uint32_t lsize = CONFIG_SYS_CACHELINE_SIZE; - rt_uint32_t addr = start_addr & ~(lsize - 1); - rt_uint32_t aend = (start_addr + size - 1) & ~(lsize - 1); - rt_uint32_t writebuffer; - - for (; addr <= aend; addr += lsize) - { - cache_op(HIT_WRITEBACK_INV_D, addr); - } - SYNC_WB(); -} - -void rt_hw_dcache_flush_all(void) -{ - rt_uint32_t addr; - - for (addr = CKSEG0; addr < CKSEG0 + CONFIG_SYS_DCACHE_SIZE; addr += CONFIG_SYS_CACHELINE_SIZE) - { - cache_op(INDEX_WRITEBACK_INV_D, addr); - } - - SYNC_WB(); -} - -void rt_hw_dcache_invalidate_range(rt_uint32_t start_addr,rt_uint32_t size) -{ - rt_uint32_t lsize = CONFIG_SYS_CACHELINE_SIZE; - rt_uint32_t addr = start_addr & ~(lsize - 1); - rt_uint32_t aend = (start_addr + size - 1) & ~(lsize - 1); - - for (; addr <= aend; addr += lsize) - cache_op(HIT_INVALIDATE_D, addr); -} - -void rt_hw_dcache_invalidate_all(void) -{ - rt_uint32_t addr; - - for (addr = CKSEG0; addr < CKSEG0 + CONFIG_SYS_DCACHE_SIZE; addr += CONFIG_SYS_CACHELINE_SIZE) - { - cache_op(INDEX_STORE_TAG_D, addr); - } - - SYNC_WB(); -} - -void rt_hw_icache_flush_line(rt_uint32_t addr) -{ - cache_op(HIT_INVALIDATE_I, addr); -} - -void rt_hw_icache_flush_all(void) -{ - rt_uint32_t addr; - - asm volatile ("mtc0 $0, $28"); /* Clear Taglo */ - asm volatile ("mtc0 $0, $29"); /* Clear TagHi */ - - for (addr = CKSEG0; addr < CKSEG0 + CONFIG_SYS_DCACHE_SIZE; addr += CONFIG_SYS_CACHELINE_SIZE) - { - cache_op(INDEX_STORE_TAG_I, addr); - } - - INVALIDATE_BTB(); -} - -void rt_hw_icache_invalidate_all(void) -{ - rt_uint32_t i; - - K0_TO_K1(); - - asm volatile (".set noreorder\n" - ".set mips32\n\t" - "mtc0\t$0,$28\n\t" - "mtc0\t$0,$29\n" - ".set mips0\n" - ".set reorder\n"); - for (i = CKSEG0; i < CKSEG0 + CONFIG_SYS_ICACHE_SIZE; i += CONFIG_SYS_CACHELINE_SIZE) - cache_op(INDEX_STORE_TAG_I, i); - - K1_TO_K0(); - - INVALIDATE_BTB(); -} - - -void rt_hw_flush_cache_all(void) -{ - rt_hw_dcache_flush_all(); - rt_hw_icache_flush_all(); -} - - - diff --git a/libcpu/mips/x1000/cache.h b/libcpu/mips/x1000/cache.h deleted file mode 100644 index 0454527d9..000000000 --- a/libcpu/mips/x1000/cache.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * File : cache.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ19ÈÕ Urey the first version - */ - -#ifndef _X1000_CACHE_H_ -#define _X1000_CACHE_H_ - -#include "../common/mips.h" -#include "../common/mips_cache.h" - - -void rt_hw_icache_invalidate_all(void); -void rt_hw_icache_flush_all(void); - -void rt_hw_dcache_flush_all(void); -void rt_hw_dcache_flush_range(rt_uint32_t addr, rt_uint32_t size); -void rt_hw_dcache_invalidate_all(void); -void rt_hw_dcache_invalidate_range(rt_uint32_t addr,rt_uint32_t size); - -void rt_hw_flush_cache_all(void); -#endif /* _X1000_CACHE_H_ */ diff --git a/libcpu/mips/x1000/cpu.c b/libcpu/mips/x1000/cpu.c deleted file mode 100644 index e1a51b9fe..000000000 --- a/libcpu/mips/x1000/cpu.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * File : cpu.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ8ÈÕ Urey the first version - */ - - -#include -#include -#include - -#include "../common/mips.h" - -mips32_core_cfg_t g_mips_core = -{ - .icache_line_size = 32, - .icache_size = 16384, - - .dcache_line_size = 32, - .dcache_size = 16384, - - .max_tlb_entries = 16, /* max_tlb_entries */ -}; - -void rt_hw_tlb_init(void) -{ -//---------------------------------------------------------------------------------- -//cchappy tlb 0x30000000 to 0xC0000000 -//---------------------------------------------------------------------------------- - unsigned int pagemask = 0x007fe000;//0x01ffe000; /* 4MB */ - /* cached D:allow-W V:valid G */ - unsigned int entrylo0 = (0x30000000 >> 6) | (3 << 3) + (1 << 2) + (1 << 1) + 1; - unsigned int entrylo1 = (0x30400000 >> 6) | (3 << 3) + (1 << 2) + (1 << 1) + 1; - unsigned int entryhi = 0xc0000000; /* kseg2 base */ - int i; - __write_32bit_c0_register($5, 4, 0xa9000000); - write_c0_pagemask(pagemask); - write_c0_wired(0); -/* indexed write 32 tlb entry */ - for(i = 0; i < 32; i++) - { - asm ( - ".macro _ssnop; sll $0, $0, 1; .endm\n\t" - ".macro _ehb; sll $0, $0, 3; .endm\n\t" - ".macro mtc0_tlbw_hazard; _ssnop; _ssnop; _ehb; .endm\n\t" - ".macro tlbw_use_hazard; _ssnop; _ssnop; _ssnop; _ehb; .endm\n\t" - "\n\t" - "mtc0 %0, $0\n\t" /* write Index */ - "tlbw_use_hazard\n\t" - "mtc0 %1, $5\n\t" /* write PageMask */ - "mtc0 %2, $10\n\t" /* write EntryHi */ - "mtc0 %3, $2\n\t" /* write EntryLo0 */ - "mtc0 %4, $3\n\t" /* write EntryLo1 */ - "mtc0_tlbw_hazard\n\t" - "tlbwi \n\t" /* TLB indexed write */ - "tlbw_use_hazard\n\t" - : : "Jr" (i), "r" (pagemask), "r" (entryhi), - "r" (entrylo0), "r" (entrylo1) - ); - entryhi += 0x0800000; /* 32MB */ - entrylo0 += (0x0800000 >> 6); - entrylo1 += (0x0800000 >> 6); - } -} - -void rt_hw_cache_init(void) -{ - r4k_cache_flush_all(); -} - -/** - * this function will reset CPU - * - */ -RT_WEAK void rt_hw_cpu_reset() -{ - /* open the watch-dog */ - REG_WDT_TCSR = WDT_TCSR_EXT_EN; - REG_WDT_TCSR |= WDT_TCSR_PRESCALE_1024; - REG_WDT_TDR = 0x03; - REG_WDT_TCNT = 0x00; - REG_WDT_TCER |= WDT_TCER_TCEN; - - rt_kprintf("reboot system...\n"); - rt_hw_interrupt_disable(); - while (1); -} - -/** - * this function will shutdown CPU - * - */ -RT_WEAK void rt_hw_cpu_shutdown() -{ - rt_kprintf("shutdown...\n"); - rt_hw_interrupt_disable(); - while (1); -} - -/** - * This function finds the first bit set (beginning with the least significant bit) - * in value and return the index of that bit. - * - * Bits are numbered starting at 1 (the least significant bit). A return value of - * zero from any of these functions means that the argument was zero. - * - * @return return the index of the first bit set. If value is 0, then this function - * shall return 0. - */ -RT_WEAK int __rt_ffs(int value) -{ - return __builtin_ffs(value); -} diff --git a/libcpu/mips/x1000/interrupt.c b/libcpu/mips/x1000/interrupt.c deleted file mode 100644 index 2a7a42e79..000000000 --- a/libcpu/mips/x1000/interrupt.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * File : cpu_intc.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016/09/07 Urey the first version - */ - -#include -#include - -#include -#include -#include - -#include "../common/mips.h" - -#define INTERRUPTS_MAX 64 - -extern rt_uint32_t rt_interrupt_nest; -rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; -rt_uint32_t rt_thread_switch_interrupt_flag; - -static struct rt_irq_desc isr_table[INTERRUPTS_MAX]; - -static void rt_hw_interrupt_handler(int vector, void *param) -{ - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); -} - -void rt_hw_interrupt_init(void) -{ - rt_int32_t idx; - - clear_c0_status(0xff04); /* clear ERL */ - set_c0_status(0x0400); /* set IP2 */ - - - rt_memset(isr_table, 0x00, sizeof(isr_table)); - for (idx = 0; idx < INTERRUPTS_MAX; idx ++) - { - isr_table[idx].handler = rt_hw_interrupt_handler; - } - - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; - - /* enable cpu interrupt mask */ - set_c0_status(IE_IRQ0 | IE_IRQ1); -} - -void rt_hw_interrupt_mask(int vector) -{ - /* mask interrupt */ - __intc_mask_irq(vector); -} - -void rt_hw_interrupt_umask(int vector) -{ - __intc_unmask_irq(vector); -} - -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) -{ - rt_isr_handler_t old_handler = RT_NULL; - - if(vector < INTERRUPTS_MAX) - { - old_handler = isr_table[vector].handler; - -#ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); -#endif /* RT_USING_INTERRUPT_INFO */ - isr_table[vector].handler = handler; - isr_table[vector].param = param; - } - - return old_handler; -} - -rt_inline int fls(int x) -{ - __asm__("clz %0, %1" : "=r" (x) : "r" (x)); - - return 32 - x; -} - -void rt_interrupt_dispatch(void *ptreg) -{ - void *param; - rt_isr_handler_t irq_func; - - int irq = 0, group; - rt_uint32_t intc_ipr0 = 0, intc_ipr1 = 0, vpu_pending = 0; - - rt_uint32_t c0_status, c0_cause; - rt_uint32_t pending_im; - - /* check os timer */ - c0_status = read_c0_status(); - c0_cause = read_c0_cause(); - - pending_im = (c0_cause & ST0_IM) & (c0_status & ST0_IM); - - if (pending_im & CAUSEF_IP3) - { - extern void rt_hw_ost_handler(void); - rt_hw_ost_handler(); - return; - } - if (pending_im & CAUSEF_IP2) - { - intc_ipr0 = REG_INTC_IPR(0); - intc_ipr1 = REG_INTC_IPR(1); - - if (intc_ipr0) - { - irq = fls(intc_ipr0) - 1; - intc_ipr0 &= ~(1<= INTERRUPTS_MAX) - rt_kprintf("max interrupt, irq=%d\n", irq); - - /* do interrupt */ - irq_func = isr_table[irq].handler; - param = isr_table[irq].param; - (*irq_func)(irq, param); - -#ifdef RT_USING_INTERRUPT_INFO - isr_table[irq].counter++; -#endif /* RT_USING_INTERRUPT_INFO */ - - /* ack interrupt */ - __intc_ack_irq(irq); - } - - if (pending_im & CAUSEF_IP0) - rt_kprintf("CAUSEF_IP0\n"); - if (pending_im & CAUSEF_IP1) - rt_kprintf("CAUSEF_IP1\n"); - if (pending_im & CAUSEF_IP4) - rt_kprintf("CAUSEF_IP4\n"); - if (pending_im & CAUSEF_IP5) - rt_kprintf("CAUSEF_IP5\n"); - if (pending_im & CAUSEF_IP6) - rt_kprintf("CAUSEF_IP6\n"); - if (pending_im & CAUSEF_IP7) - rt_kprintf("CAUSEF_IP7\n"); -} - -#ifdef RT_USING_INTERRUPT_INFO -#include -int list_irqs(void) -{ - int index; - - rt_kprintf("interrupt list:\n"); - rt_kprintf("----------------\n"); - rt_kprintf("name counter\n"); - for (index = 0; index < INTERRUPTS_MAX; index ++) - { - if (isr_table[index].handler != rt_hw_interrupt_handler) - { - rt_kprintf("%-*.*s %d\n", RT_NAME_MAX, RT_NAME_MAX, isr_table[index].name, isr_table[index].counter); - } - } - - return 0; -} -MSH_CMD_EXPORT(list_irqs, list interrupt counter); -#endif - -unsigned int spin_lock_irqsave(void) -{ - register unsigned int t; - t = read_c0_status(); - write_c0_status((t & (~1))); - return (t); -} - -void spin_unlock_irqrestore(unsigned int val) -{ - write_c0_status(val); -} diff --git a/libcpu/mips/x1000/mips_backtrace.c b/libcpu/mips/x1000/mips_backtrace.c deleted file mode 100644 index b8a861bad..000000000 --- a/libcpu/mips/x1000/mips_backtrace.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * File : mips_backtrace.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ11ÈÕ Urey the first version - */ - -#include -#include -#include -#include - -#include "mips.h" - -/********************************************************************************************************* - Ö¸ÁÒå -*********************************************************************************************************/ -#define ADDUI_SP_INST 0x27bd0000 -#define SW_RA_INST 0xafbf0000 -#define JR_RA_INST 0x03e00008 - -#define INST_OP_MASK 0xffff0000 -#define INST_OFFSET_MASK 0x0000ffff - -#define abs(s) ((s) < 0 ? -(s):(s)) - -int backtrace_ctx(mips_reg_ctx *ctx) -{ - unsigned long *addr; - unsigned long *pc, *ra, *sp; - size_t ra_offset; - size_t stack_size; - int depth; - int size = 8; - - pc = (unsigned long *)(unsigned long)ctx->CP0EPC; - ra = (unsigned long *)(unsigned long)ctx->regs[REG_RA]; - sp = (unsigned long *)(unsigned long)ctx->regs[REG_SP]; - - rt_kprintf("[0x%08x]\n", pc); - - if (size == 1) return 1; - - ra_offset = stack_size = 0; - - for (addr = ra; !ra_offset || !stack_size; --addr) - { - switch (*addr & INST_OP_MASK) { - case ADDUI_SP_INST: - stack_size = abs((short)(*addr&INST_OFFSET_MASK)); - break; - - case SW_RA_INST: - ra_offset = (short)(*addr&INST_OFFSET_MASK); - break; - - case 0x3c1c0000: - goto out_of_loop; - - default: - break; - } - } - -out_of_loop: - if (ra_offset) ra = *(unsigned long **)((unsigned long)sp + ra_offset); - if (stack_size) sp = (unsigned long *)((unsigned long)sp + stack_size); - - // repeat backwar scanning - for (depth = 1; depth < size && ra && ra != (unsigned long *)0xffffffff; ++depth) - { - rt_kprintf("RA[%2d] : [0x%08x]\n", depth ,ra); - - ra_offset = 0; - stack_size = 0; - - for ( addr = ra; !ra_offset || !stack_size; -- addr ) - { - switch( *addr & INST_OP_MASK) - { - case ADDUI_SP_INST: - stack_size = abs((short)(*addr&INST_OFFSET_MASK)); - break; - - case SW_RA_INST: - ra_offset = abs((short)(*addr&INST_OFFSET_MASK)); - break; - - case 0x3c1c0000: - return depth +1; - - default: - break; - } - } - - ra = *(unsigned long **)((unsigned long)sp + ra_offset); - sp = (unsigned long *)((unsigned long)sp + stack_size); - } - - return depth; -} - -int backtrace(void) -{ - unsigned long *addr; - unsigned long *ra; - unsigned long *sp; - int size = 8, depth; - - size_t ra_offset; - size_t stack_size; - - // get current $a and $sp - __asm__ __volatile__ ( - " move %0, $ra\n" - " move %1, $sp\n" - : "=r"(ra), "=r"(sp) - ); - - // scanning to find the size of hte current stack frame - stack_size = 0; - - for ( addr = (unsigned long *)backtrace; !stack_size; ++addr) - { - if ((*addr & INST_OP_MASK ) == ADDUI_SP_INST ) - stack_size = abs((short)(*addr&INST_OFFSET_MASK)); - else if ( *addr == JR_RA_INST ) - break; - } - - sp = (unsigned long *) (( unsigned long )sp + stack_size); - - // repeat backwar scanning - for ( depth = 0; depth < size && ((( unsigned long )ra > KSEG0BASE) && (( unsigned long )ra < KSEG1BASE)); ++ depth ) - { - rt_kprintf("RA[%2d] : [0x%08x]\n", depth, ra); - { - extern void rt_thread_exit(void); - if ((uint32_t)ra == (uint32_t)(rt_thread_exit)) - return depth; - } - - ra_offset = 0; - stack_size = 0; - - for ( addr = ra; !ra_offset || !stack_size; -- addr ) - { - switch( *addr & INST_OP_MASK) - { - case ADDUI_SP_INST: - stack_size = abs((short)(*addr&INST_OFFSET_MASK)); - break; - - case SW_RA_INST: - ra_offset = (short)(*addr&INST_OFFSET_MASK); - break; - - case 0x3c1c0000: - return depth +1; - - default: - break; - } - } - - ra = *(unsigned long **)((unsigned long)sp + ra_offset); - sp = (unsigned long*) ((unsigned long)sp+stack_size ); - } - - return depth; -} - -#include -extern long list_thread(void); -void assert_hook(const char* ex, const char* func, rt_size_t line) -{ - backtrace(); - - list_thread(); - rt_kprintf("(%s) assertion failed at function:%s, line number:%d \n", ex, func, line); -} - -int backtrace_init(void) -{ -#ifdef RT_DEBUG - rt_assert_set_hook(assert_hook); -#endif - return 0; -} -INIT_DEVICE_EXPORT(backtrace_init); diff --git a/libcpu/mips/x1000/mips_cache_gcc.S b/libcpu/mips/x1000/mips_cache_gcc.S deleted file mode 100644 index 671f193af..000000000 --- a/libcpu/mips/x1000/mips_cache_gcc.S +++ /dev/null @@ -1,62 +0,0 @@ -/* - * File : mips_cache_gcc.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ19ÈÕ Urey the first version - */ - -#ifndef __ASSEMBLY__ -# define __ASSEMBLY__ -#endif - -#include "../common/mips.h" - - .text - .set noreorder - - .globl cache_init - .ent cache_init -cache_init: - .set noreorder - mtc0 zero, CP0_TAGLO - move t0, a0 // cache total size - move t1, a1 // cache line size - li t2, 0x80000000 - addu t3, t0, t2 - -_cache_init_loop: - cache 8, 0(t2) // icache_index_store_tag - cache 9, 0(t2) // dcache_index_store_tag - addu t2, t1 - bne t2, t3, _cache_init_loop - nop - - mfc0 t0, CP0_CONFIG - li t1, 0x7 - not t1 - and t0, t0, t1 - or t0, 0x3 // cacheable, noncoherent, write-back, write allocate - mtc0 t0, CP0_CONFIG - - jr ra - nop - - .set reorder - .end cache_init diff --git a/libcpu/mips/x1000/mips_context_gcc.S b/libcpu/mips/x1000/mips_context_gcc.S deleted file mode 100644 index d4c314ab6..000000000 --- a/libcpu/mips/x1000/mips_context_gcc.S +++ /dev/null @@ -1,95 +0,0 @@ -/* - * File : mips_context_asm.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version - */ - -#ifndef __ASSEMBLY__ -# define __ASSEMBLY__ -#endif - -#include "../common/mips.h" - - .global rt_thread_switch_interrupt_flag - .global rt_interrupt_from_thread - .global rt_interrupt_to_thread - - .section .text,"ax",@progbits - .set noreorder - .set noat - - .globl rt_hw_interrupt_disable -rt_hw_interrupt_disable: - mfc0 v0,CP0_STATUS - srl v1,v0,1 - sll v1,v1,1 -# and v1,v0,0xfffffffe - mtc0 v1,CP0_STATUS - jr ra - nop - -LEAF(rt_hw_interrupt_enable) - mtc0 a0,CP0_STATUS - jr ra - nop -END(rt_hw_interrupt_enable) - -/* - * void rt_hw_context_switch_to(rt_uint32 to)/* - * a0 --> to - */ -LEAF(rt_hw_context_switch_to) - lw sp , 0(a0) /* switch to the new stack */ - RESTORE_CONTEXT -END(rt_hw_context_switch_to) - -/* - * void rt_hw_context_switch(rt_uint32 from, rt_uint32 to) - * a0 --> from - * a1 --> to - */ -LEAF(rt_hw_context_switch) - mtc0 ra, CP0_EPC - SAVE_CONTEXT - - sw sp, 0(a0) /* store sp in preempted tasks TCB */ - lw sp, 0(a1) /* get new task stack pointer */ - - RESTORE_CONTEXT -END(rt_hw_context_switch) - -LEAF(rt_hw_context_switch_interrupt) - la t0, rt_thread_switch_interrupt_flag - lw t1, 0(t0) - nop - bnez t1, _reswitch - nop - li t1, 0x01 /* set rt_thread_switch_interrupt_flag to 1 */ - sw t1, 0(t0) - la t0, rt_interrupt_from_thread /* set rt_interrupt_from_thread */ - sw a0, 0(t0) -_reswitch: - la t0, rt_interrupt_to_thread /* set rt_interrupt_to_thread */ - sw a1, 0(t0) - jr ra - nop -END(rt_hw_context_switch_interrupt) - diff --git a/libcpu/mips/x1000/mips_excpt.c b/libcpu/mips/x1000/mips_excpt.c deleted file mode 100644 index 5d2a3dce6..000000000 --- a/libcpu/mips/x1000/mips_excpt.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * File : mips_excpt.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version - */ - -#include -#include -#include - -#include "mips.h" -#include "mips_excpt.h" - -extern int backtrace(void); -int backtrace_ctx(mips_reg_ctx *ctx); - -extern long list_thread(void); - -const static char *regstr[] = { - "$0 zero", "$1 at", "$2 v0", "$3 v1", "$4 a0", "$5 a1", "$6 a2", "$7 a3", - "$8 t0", "$9 t1", "$10 t2", "$11 t3", "$12 t4", "$13 t5", "$14 t6", "$15 t7", - "$16 s0", "$17 s1", "$18 s2", "$19 s3", "$20 s4", "$21 s5", "$22 s6", "$23 s7", - "$24 t8", "$25 t9", "$26 k0", "$27 k1", "$28 gp", "$29 sp", "$30 fp", "$31 ra" -}; - -static const char *cause_strings[32] = -{ - /* 0 */ "Int", - /* 1 */ "TLB Mods", - /* 2 */ "TLB Load", - /* 3 */ "TLB Store", - /* 4 */ "Address Load", - /* 5 */ "Address Store", - /* 6 */ "Instruction Bus Error", - /* 7 */ "Data Bus Error", - /* 8 */ "Syscall", - /* 9 */ "Breakpoint", - /* 10 */ "Reserved Instruction", - /* 11 */ "Coprocessor Unuseable", - /* 12 */ "Overflow", - /* 13 */ "Trap", - /* 14 */ "Instruction Virtual Coherency Error", - /* 15 */ "FP Exception", - /* 16 */ "Reserved 16", - /* 17 */ "Reserved 17", - /* 18 */ "Reserved 18", - /* 19 */ "Reserved 19", - /* 20 */ "Reserved 20", - /* 21 */ "Reserved 21", - /* 22 */ "Reserved 22", - /* 23 */ "Watch", - /* 24 */ "Reserved 24", - /* 25 */ "Reserved 25", - /* 26 */ "Reserved 26", - /* 27 */ "Reserved 27", - /* 28 */ "Reserved 28", - /* 29 */ "Reserved 29", - /* 30 */ "Reserved 30", - /* 31 */ "Data Virtual Coherency Error" -}; - - -/** - * exception handle table - */ -exception_func_t sys_exception_handlers[32]; - -static void mod_handler(mips_reg_ctx *regs) -{ - rt_kprintf("tlb modification exception\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - -static void tlbl_handler(mips_reg_ctx *regs) -{ - rt_kprintf("tlb exception: load\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - -static void tlbs_handler(mips_reg_ctx *regs) -{ - rt_kprintf("tlb exception: store\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - -static void adel_handler(mips_reg_ctx *regs) -{ - rt_kprintf("address error exception: load\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - rt_kprintf("current thread: %.*s\n", RT_NAME_MAX, rt_thread_self()->name); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - -static void ades_handler(mips_reg_ctx *regs) -{ - rt_kprintf("address error exception: store\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - -static void fpe_handler(mips_reg_ctx *regs) -{ - rt_kprintf("floating point exception\n"); - rt_kprintf("exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - - list_thread(); - - printf("-----------------------------------------------------\n"); - printf("BACKTRACE:\n"); - backtrace(); - printf("-----------------------------------------------------\n"); - - rt_hw_cpu_shutdown(); -} - - -static void unhandled_exception_handle(mips_reg_ctx *regs) -{ - int i; - unsigned int cause = read_c0_cause(); - unsigned int exc = (cause >> 2) & 0x1f; - - rt_kprintf("exception happens, epc: 0x%08x\n", regs->CP0EPC); - rt_kprintf(" cause: 0x%08x\n", regs->CP0Cause); - - for (i = 0; i < 32; i++) - { - if (i % 4 == 0) - printf("\n"); - printf("%8s %08x ", regstr[i], regs->regs[i]); - } - printf("\n"); - - list_thread(); - rt_hw_cpu_shutdown(); -} - -static void install_default_exception_handler(void) -{ - int i; - - for (i=0; i 32) || (!func)) - { - return 0; - } - - sys_exception_handlers[n] = func; - - return old_handler; -} - -void mips_exception_handler(mips_reg_ctx *ctx) -{ - static int read_epc_count = 0; - static int epc_save = 0; - int i; - unsigned int epc; - - //Èç¹û read_epc_count>0 ˵Ã÷ c_except_handler ÔÚ¶Á epc ʱÖØÈëÁË£¬¼´¶Á epc µ¼ÖÂÁËÒ»¸öеÄÒì³£ - if (read_epc_count > 0) - { - printf("ERROR: read epc fail when except handle\n"); - epc = epc_save; - read_epc_count = 0; - } - else - { - read_epc_count++; - epc_save = 0; - epc = read_c0_epc(); - epc_save = epc; - - if (epc != 0) - { - printf("-----------------------------------------------------\n"); - for (i = 0; i < 4; i++) - { - printf("%08x:\t%08x\n", - (epc - 4 * 4 + i * 4), - *(unsigned int *) ((epc - 4 * 4 + i * 4) | 0xa0000000)); - } - for (i = 0; i < 4; i++) - { - printf("%08x:\t%08x\n", - (epc + i * 4), - *(unsigned int *) ((epc + i * 4) | 0xa0000000)); - } - printf("-----------------------------------------------------\n"); - } - - read_epc_count--; - } - - printf("-----------------------------------------------------\n"); - unsigned int cause = read_c0_cause(); - unsigned int exc = (cause >> 2) & 0x1f; - printf("CAUSE=%08x --> %s\n", cause, cause_strings[exc]); - printf("EPC=%08x\n", epc); - - for (i = 0; i < 32; i++) - { - if ((i != 0) && (i % 4 == 0)) - printf("\n"); - printf("%8s %08x ", regstr[i], ctx->regs[i]); - } - printf("\n-----------------------------------------------------\n"); - printf("%s: \t %8x\n","CP0Status ", ctx->CP0Status); - printf("%s: \t %8x\n","CP0DataHI ", ctx->CP0DataHI); - printf("%s: \t %8x\n","CP0DataLO ", ctx->CP0DataLO); - printf("%s: \t %8x\n","CP0BadVAddr", ctx->CP0BadVAddr); - printf("%s: \t %8x\n","CP0Cause ", ctx->CP0Cause); - printf("%s: \t %8x\n","CP0EPC ", ctx->CP0EPC); - printf("-----------------------------------------------------\n"); - -#if 0 - switch (exc) - { - case EX_MOD: - /* TLB modified */ - break; - - case EX_TLBL: /* TLB exc(load or ifetch) */ - case EX_TLBS: /* TLB exception (store) */ - - break; - - case EX_ADEL: /* Address err(load or ifetch) */ - case EX_ADES: /* Address error (store) */ - - break; - - case EX_IBE: /* Instruction Bus Error */ - case EX_DBE: /* Data Bus Error */ - - break; - - case EX_SYS: /* Syscall */ - - break; - - case EX_BP: /* Breakpoint */ - case EX_TR: /* Trap instruction */ - - break; - case EX_RI: /* Reserved instruction */ - - break; - case EX_FPE: /* floating point exception */ - break; - - case EX_CPU: /* CoProcessor Unusable */ - - break; - case EX_OV: /* OVerflow */ - case EX_C2E: /* COP2 exception */ - case EX_MDMX: /* MDMX exception */ - case EX_WATCH: /* Watch exception */ - case EX_MCHECK: /* Machine check exception */ - case EX_CacheErr: /* Cache error caused re-entry */ - /* to Debug Mode */ - - break; - default: - rt_kprintf("Unknow exception: %d\r\n", exc); - break; - } -#else - sys_exception_handlers[exc](ctx); -#endif - - rt_hw_cpu_shutdown(); -} - - -void mips_cache_error_handler (unsigned int Addr) -{ - rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); - list_thread(); - rt_hw_cpu_shutdown(); -} - -void mips_tlb_refill_handler(void) -{ - rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); - rt_kprintf(" cause: 0x%08x\n", read_c0_cause()); - list_thread(); - rt_kprintf("current thread: %s\n", rt_thread_self()->name); - rt_hw_cpu_shutdown(); -} diff --git a/libcpu/mips/x1000/mips_excpt_gcc.S b/libcpu/mips/x1000/mips_excpt_gcc.S deleted file mode 100644 index c403adf93..000000000 --- a/libcpu/mips/x1000/mips_excpt_gcc.S +++ /dev/null @@ -1,102 +0,0 @@ -/* - * File : mips_excpt_asm.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version - */ - -#ifndef __ASSEMBLY__ -# define __ASSEMBLY__ -#endif - -#include "../common/mips.h" - -#define _EXC_STKSIZE 20*1024 - -;/********************************************************************************************************* -; PTE BASE Ïà¹Ø¶¨Òå -;*********************************************************************************************************/ - -#define PTE_BASE_OFFSET 23 -#define PTE_BASE_SIZE 9 -#define MIPS32_BADVPN2_SHIFT 2 - - - .section ".text", "ax" - .set noreorder - -LEAF(mips_tlb_refill_handlerx) - .set push - .set noat - .set noreorder - .set volatile - - ;/* - ; * K1 = CP0_CTXT - ; * K0 = K1 - ; */ - mfc0 k1 , CP0_CONTEXT ;/* K1 µÈÓÚ Context ¼Ä´æÆ÷ */ - ehb - move k0 , k1 ;/* K0 µÈÓÚ Context ¼Ä´æÆ÷ */ - - ;/* - ; * K1 <<= PTE_BASE_SIZE - ; * K1 >>= PTE_BASE_SIZE - ; * K1 >>= 4 - ; * K1 >>= MIPS32_BADVPN2_SHIFT - ; * K1 <<= 3 - ; */ - sll k1 , PTE_BASE_SIZE - srl k1 , (PTE_BASE_SIZE + 4 + MIPS32_BADVPN2_SHIFT) ;/* K1 Ϊ BAD VPN2 */ - sll k1 , (4 - 1) - - ;/* - ; * K0 >>= PTE_BASE_OFFSET - ; * K0 <<= PTE_BASE_OFFSET - ; */ - srl k0 , PTE_BASE_OFFSET - sll k0 , PTE_BASE_OFFSET ;/* K0 Ϊ PTE BASE */ - - ;/* - ; * K1 = K1 | K0 - ; */ - or k1 , k1 , k0 ;/* ºÏ³É */ - - ;/* - ; * K0 = *K1 - ; * K1 = *(K1 + 4) - ; */ - lw k0 , 0(k1) - lw k1 , 4(k1) - - ;/* - ; * CP0_TLBLO0 = K0 - ; * CP0_TLBLO1 = K1 - ; */ - mtc0 k0 , CP0_ENTRYLO0 ;/* EntryLo0 */ - mtc0 k1 , CP0_ENTRYLO1 ;/* EntryLo1 */ - ehb - - tlbwr ;/* TLB Ëæ»úÌæ»» */ - - eret ;/* Òì³£·µ»Ø */ - - .set pop -END(mips_tlb_refill_handlerx) diff --git a/libcpu/mips/x1000/mips_fp_gcc.S b/libcpu/mips/x1000/mips_fp_gcc.S deleted file mode 100644 index b21908406..000000000 --- a/libcpu/mips/x1000/mips_fp_gcc.S +++ /dev/null @@ -1,197 +0,0 @@ -/* - * File : mips_vfp32_asm.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ9ÈÕ Urey the first version - */ - -#ifndef __ASSEMBLY__ -# define __ASSEMBLY__ -#endif - -#ifdef __mips_hard_float - -.module hardfloat -.module doublefloat -.set nomips16 - -#include "../common/mips.h" -#undef fp - - .global mips_vfp32_init -LEAF(mips_vfp32_init) - mfc0 t0, CP0_STATUS - or t0 , M_StatusCU1 - mtc0 t0, CP0_STATUS - jr ra - nop -END(mips_vfp32_init) - -# -# FUNCTION: _fpctx_save -# -# DESCRIPTION: save floating point registers to memory starting at a0 -# -# RETURNS: int -# 0: No context saved -# CTX_*: Type of context stored -# - .global _fpctx_save -LEAF(_fpctx_save) - sw zero, LINKCTX_NEXT(a0) - mfc0 t0, CP0_STATUS - li t1, M_StatusCU1 - and t1, t0, t1 - bnez t1, 1f - # FP not enabled, bail out - move v0, zero - jr ra - -1: # Save FP32 base - li t1, ST0_FR - and t0, t0, t1 - cfc1 t2, $31 - sw t2, FP32CTX_CSR(a0) - sdc1 $f0, FP32CTX_0(a0) - sdc1 $f2, FP32CTX_2(a0) - sdc1 $f4, FP32CTX_4(a0) - sdc1 $f6, FP32CTX_6(a0) - sdc1 $f8, FP32CTX_8(a0) - sdc1 $f10, FP32CTX_10(a0) - sdc1 $f12, FP32CTX_12(a0) - sdc1 $f14, FP32CTX_14(a0) - sdc1 $f16, FP32CTX_16(a0) - sdc1 $f18, FP32CTX_18(a0) - sdc1 $f20, FP32CTX_20(a0) - sdc1 $f22, FP32CTX_22(a0) - sdc1 $f24, FP32CTX_24(a0) - sdc1 $f26, FP32CTX_26(a0) - sdc1 $f28, FP32CTX_28(a0) - sdc1 $f30, FP32CTX_30(a0) - bnez t0, 2f - li v0, LINKCTX_TYPE_FP32 - sw v0, LINKCTX_ID(a0) - jr ra - -2: # Save FP64 extra -.set push -.set fp=64 - sdc1 $f1, FP64CTX_1(a0) - sdc1 $f3, FP64CTX_3(a0) - sdc1 $f5, FP64CTX_5(a0) - sdc1 $f7, FP64CTX_7(a0) - sdc1 $f9, FP64CTX_9(a0) - sdc1 $f11, FP64CTX_11(a0) - sdc1 $f13, FP64CTX_13(a0) - sdc1 $f15, FP64CTX_15(a0) - sdc1 $f17, FP64CTX_17(a0) - sdc1 $f19, FP64CTX_19(a0) - sdc1 $f21, FP64CTX_21(a0) - sdc1 $f23, FP64CTX_23(a0) - sdc1 $f25, FP64CTX_25(a0) - sdc1 $f27, FP64CTX_27(a0) - sdc1 $f29, FP64CTX_29(a0) - sdc1 $f31, FP64CTX_31(a0) -.set pop - li v0, LINKCTX_TYPE_FP64 - sw v0, LINKCTX_ID(a0) - jr ra -END(_fpctx_save) - -# -# FUNCTION: _fpctx_load -# -# DESCRIPTION: load floating point registers from context chain starting at a0 -# -# RETURNS: int -# 0: Unrecognised context -# CTX_*: Type of context restored -# - .global _fpctx_load -LEAF(_fpctx_load) - lw v0, LINKCTX_ID(a0) - # Detect type - li t0, LINKCTX_TYPE_FP64 - li t1, LINKCTX_TYPE_FP32 - li t2, M_StatusCU1 - beq v0, t0, 0f - beq v0, t1, 1f - # Don't recognise this context, fail - move v0, zero - jr ra - -0: # FP64 context - # Enable CU1 - di t3 - ehb - or t3, t3, t2 - mtc0 t3, CP0_STATUS - ehb - # Load FP64 extra -.set push -.set fp=64 - ldc1 $f1, FP64CTX_1(a0) - ldc1 $f3, FP64CTX_3(a0) - ldc1 $f5, FP64CTX_5(a0) - ldc1 $f7, FP64CTX_7(a0) - ldc1 $f9, FP64CTX_9(a0) - ldc1 $f11, FP64CTX_11(a0) - ldc1 $f13, FP64CTX_13(a0) - ldc1 $f15, FP64CTX_15(a0) - ldc1 $f17, FP64CTX_17(a0) - ldc1 $f19, FP64CTX_19(a0) - ldc1 $f21, FP64CTX_21(a0) - ldc1 $f23, FP64CTX_23(a0) - ldc1 $f25, FP64CTX_25(a0) - ldc1 $f27, FP64CTX_27(a0) - ldc1 $f29, FP64CTX_29(a0) - ldc1 $f31, FP64CTX_31(a0) -.set pop -1: # FP32 context - # Enable CU1 - di t3 - ehb - or t3, t3, t2 - mtc0 t3, CP0_STATUS - ehb - # Load FP32 base - lw t1, FP32CTX_CSR(a0) - ctc1 t1, $31 - ldc1 $f0, FP32CTX_0(a0) - ldc1 $f2, FP32CTX_2(a0) - ldc1 $f4, FP32CTX_4(a0) - ldc1 $f6, FP32CTX_6(a0) - ldc1 $f8, FP32CTX_8(a0) - ldc1 $f10, FP32CTX_10(a0) - ldc1 $f12, FP32CTX_12(a0) - ldc1 $f14, FP32CTX_14(a0) - ldc1 $f16, FP32CTX_16(a0) - ldc1 $f18, FP32CTX_18(a0) - ldc1 $f20, FP32CTX_20(a0) - ldc1 $f22, FP32CTX_22(a0) - ldc1 $f24, FP32CTX_24(a0) - ldc1 $f26, FP32CTX_26(a0) - ldc1 $f28, FP32CTX_28(a0) - ldc1 $f30, FP32CTX_30(a0) - # Return CTX_FP32/64 - jr ra -END(_fpctx_load) - -#endif diff --git a/libcpu/mips/x1000/stack.c b/libcpu/mips/x1000/stack.c deleted file mode 100644 index 0043ea2a2..000000000 --- a/libcpu/mips/x1000/stack.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * File : stack.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ8ÈÕ Urey the first version - */ - -#include - -#include "../common/mips.h" - -register U32 $GP __asm__ ("$28"); - -rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) -{ - static rt_uint32_t wSR=0; - static rt_uint32_t wGP; - - mips_reg_ctx *regCtx; - mips_arg_ctx *argCtx; - rt_uint32_t i; - - if (wSR == 0) - { - wSR = read_c0_status(); - wSR &= 0xfffffffe; - wSR |= 0x0403; - - wGP = $GP; - } - - if ((rt_uint32_t) stack_addr & 0x7) - { - stack_addr = (rt_uint8_t *)((rt_uint32_t)stack_addr - 4); - } - - argCtx = (mips_arg_ctx *)((rt_uint32_t)stack_addr - sizeof(mips_arg_ctx)); - regCtx = (mips_reg_ctx *)((rt_uint32_t)stack_addr - sizeof(mips_arg_ctx) - sizeof(mips_reg_ctx)); - - for (i = 0; i < 4; ++i) - { - argCtx->args[i] = i; - } - - //±£´æͨÓüĴæÆ÷ - for (i = 0; i < 32; ++i) - { - regCtx->regs[i] = i; - } - - regCtx->regs[REG_SP] = (rt_uint32_t)stack_addr; - regCtx->regs[REG_A0] = (rt_uint32_t)parameter; - regCtx->regs[REG_GP] = (rt_uint32_t)wGP; - regCtx->regs[REG_FP] = (rt_uint32_t)0x0; - regCtx->regs[REG_RA] = (rt_uint32_t)texit; - - regCtx->CP0DataLO = 0x00; - regCtx->CP0DataHI = 0x00; - regCtx->CP0Cause = read_c0_cause(); - regCtx->CP0Status = wSR; - regCtx->CP0EPC = (rt_uint32_t)tentry; - regCtx->CP0BadVAddr= 0x00; - - return (rt_uint8_t *)(regCtx); -} diff --git a/libcpu/mips/x1000/startup_gcc.S b/libcpu/mips/x1000/startup_gcc.S deleted file mode 100644 index 1376cb7dd..000000000 --- a/libcpu/mips/x1000/startup_gcc.S +++ /dev/null @@ -1,328 +0,0 @@ -/* - * File : startup.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2016Äê9ÔÂ7ÈÕ Urey the first version - */ - -#ifndef __ASSEMBLY__ -# define __ASSEMBLY__ -#endif - -#include "../common/mips.h" - -#define IRQ_STACK_SIZE 0x2000 -#define EXC_STACK_SIZE 0x2000 - - - .section ".bss" - ALIGN(4) -irq_stack_low: - .space IRQ_STACK_SIZE -irq_stack_top: - .space 8 - - ALIGN(4) -exc_stack_low: - .space EXC_STACK_SIZE -exc_stack_top: - .space 8 - -#define SYSTEM_STACK 0x80003fe8 - -;/********************************************************************************************************* -; Èë¿Ú -;*********************************************************************************************************/ - .global rtthread_startup - .global mips_vfp32_init - - .global _start - .section ".start", "ax" - .set noreorder -_start: - .set noreorder - la ra, _start - - li t1, 0x00800000 - mtc0 t1, CP0_CAUSE - - /* init cp0 registers. */ - li t0, 0x1000FC00 /* BEV = 0 and mask all interrupt */ - mtc0 t0, CP0_STATUS - -#ifdef __mips_hard_float - jal mips_vfp32_init - nop -#endif - - /* setup stack pointer */ - li sp, SYSTEM_STACK - la gp, _gp - -_cache_init: - /* init caches, assumes a 4way * 128set * 32byte I/D cache */ - mtc0 zero, CP0_TAGLO /* TAGLO reg */ - mtc0 zero, CP0_TAGHI /* TAGHI reg */ - li t0, 3 /* enable cache for kseg0 accesses */ - mtc0 t0, CP0_CONFIG /* CONFIG reg */ - la t0, 0x80000000 /* an idx op should use an unmappable address */ - ori t1, t0, 0x4000 /* 16kB cache */ - -_cache_loop: - cache 0x8, 0(t0) /* index store icache tag */ - cache 0x9, 0(t0) /* index store dcache tag */ - bne t0, t1, _cache_loop - addiu t0, t0, 0x20 /* 32 bytes per cache line */ - nop - - /* invalidate BTB */ - mfc0 t0, CP0_CONFIG - nop - ori t0, 2 - mtc0 t0, CP0_CONFIG - nop - - - /* jump to RT-Thread RTOS */ - jal rtthread_startup - nop - - /* restart, never die */ - j _start - nop - .set reorder - - -;/********************************************************************************************************* -; Òì³£ÏòÁ¿±í -;*********************************************************************************************************/ - /* 0x0 - TLB refill handler */ - .section .vectors.1, "ax", %progbits - j mips_tlb_refill_entry - nop - - /* 0x100 - Cache error handler */ - .section .vectors.2, "ax", %progbits - j mips_cache_error_entry - nop - - /* 0x180 - Exception/Interrupt handler */ - .section .vectors.3, "ax", %progbits - j mips_exception_entry - nop - - /* 0x200 - Special Exception Interrupt handler (when IV is set in CP0_CAUSE) */ - .section .vectors.4, "ax", %progbits - j mips_interrupt_entry - nop - .section .vectors, "ax", %progbits - - .global mips_exception_handler -// .global mips_syscall -LEAF(mips_exception_entry) - .set push - .set noat - .set noreorder - .set volatile - - mfc0 k0, C0_CAUSE - andi k0, k0, 0x7c - beq zero, k0, except_do_intr - nop - - andi k0,(0x08 << 2) - beq zero,k0,except_do - nop -except_do_intr: - la k0,mips_interrupt_entry - jr k0 - nop -except_do_syscall: -// la k0,mips_syscall -// jr k0 - nop -except_do: - //save sp - move k0,sp - //la sp, exc_stack_top - subu sp, sp, CONTEXT_SIZE - //save context - sw $0, (4*0)(sp); - sw $1, (4*1)(sp); - sw $2, (4*2)(sp); - sw $3, (4*3)(sp); - sw $4, (4*4)(sp); - sw $5, (4*5)(sp); - sw $6, (4*6)(sp); - sw $7, (4*7)(sp); - sw $8, (4*8)(sp); - sw $9, (4*9)(sp); - sw $10, (4*10)(sp); - sw $11, (4*11)(sp); - sw $12, (4*12)(sp); - sw $13, (4*13)(sp); - sw $14, (4*14)(sp); - sw $15, (4*15)(sp); - sw $16, (4*16)(sp); - sw $17, (4*17)(sp); - sw $18, (4*18)(sp); - sw $19, (4*19)(sp); - sw $20, (4*20)(sp); - sw $21, (4*21)(sp); - sw $22, (4*22)(sp); - sw $23, (4*23)(sp); - sw $24, (4*24)(sp); - sw $25, (4*25)(sp); - sw $26, (4*26)(sp); - sw $27, (4*27)(sp); - sw $28, (4*28)(sp); - sw k0, (4*29)(sp); //old sp - sw $30, (4*30)(sp); - sw $31, (4*31)(sp); - - /* STATUS CAUSE EPC.... */ - mfc0 $2, CP0_STATUS - sw $2, STK_OFFSET_SR(sp) - - mfc0 $2, CP0_CAUSE - sw $2, STK_OFFSET_CAUSE(sp) - - mfc0 $2, CP0_BADVADDR - sw $2, STK_OFFSET_BADVADDR(sp) - - MFC0 $2, CP0_EPC - sw $2, STK_OFFSET_EPC(sp) - - mfhi $2 - sw $2, STK_OFFSET_HI(sp) - - mflo $2 - sw $2, STK_OFFSET_LO(sp) - - move a0, sp - la k0, mips_exception_handler - j k0 - nop - - // - - .set pop -END(mips_exception_entry) - - .global mips_tlb_refill_handler -LEAF(mips_tlb_refill_entry) - .set push - .set noat - .set noreorder - .set volatile - - la k0,mips_tlb_refill_handler - jr k0 - - nop - eret - nop - - .set pop -END(mips_tlb_refill_entry) - - .global mips_cache_error_handler -LEAF(mips_cache_error_entry) - .set push - .set noat - .set noreorder - .set volatile - - la k0,mips_cache_error_handler - jr k0 - nop - eret - nop - - .set pop -END(mips_cache_error_entry) - - - -.global rt_interrupt_dispatch -.global rt_interrupt_enter -.global rt_interrupt_leave -LEAF(mips_interrupt_entry) - .set push - .set noat - .set noreorder - .set volatile - - //mfc0 k0,CP0_EPC - SAVE_CONTEXT - - mfc0 t0, CP0_CAUSE - mfc0 t1, CP0_STATUS - and t0, t1 - - andi t0, 0xff00 - beqz t0, spurious_interrupt - nop - - /* let k0 keep the current context sp */ - move k0, sp - - /* switch to kernel stack */ - la sp, irq_stack_top - jal rt_interrupt_enter - nop - jal rt_interrupt_dispatch - nop - jal rt_interrupt_leave - nop - - /* switch sp back to thread's context */ - move sp, k0 - - /* - * if rt_thread_switch_interrupt_flag set, jump to - * rt_hw_context_switch_interrupt_do and don't return - */ - la k0, rt_thread_switch_interrupt_flag - lw k1, 0(k0) - beqz k1, spurious_interrupt - nop - sw zero, 0(k0) /* clear flag */ - nop - - /* - * switch to the new thread - */ - la k0, rt_interrupt_from_thread - lw k1, 0(k0) - nop - sw sp, 0(k1) /* store sp in preempted tasks's TCB */ - - la k0, rt_interrupt_to_thread - lw k1, 0(k0) - nop - lw sp, 0(k1) /* get new task's stack pointer */ - j spurious_interrupt - nop -spurious_interrupt: - RESTORE_CONTEXT - - .set pop -END(mips_interrupt_entry) diff --git a/libcpu/mips/x1000/x1000.h b/libcpu/mips/x1000/x1000.h deleted file mode 100644 index aa1829739..000000000 --- a/libcpu/mips/x1000/x1000.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * File : x1000.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-11-19 Urey the first version - */ - -#ifndef __X1000_H__ -#define __X1000_H__ - -#include "../common/mips.h" - -#ifndef __ASSEMBLY__ - -#define cache_unroll(base,op) \ - __asm__ __volatile__(" \ - .set noreorder; \ - .set mips3; \ - cache %1, (%0); \ - .set mips0; \ - .set reorder" \ - : \ - : "r" (base), \ - "i" (op)); - -/* cpu pipeline flush */ -static inline void jz_sync(void) -{ - __asm__ volatile ("sync"); -} - -static inline void writeb(u8 value, u32 address) -{ - *((volatile u8 *) address) = value; -} -static inline void writew( u16 value, u32 address) -{ - *((volatile u16 *) address) = value; -} -static inline void writel(u32 value, u32 address) -{ - *((volatile u32 *) address) = value; -} - -static inline u8 readb(u32 address) -{ - return *((volatile u8 *)address); -} - -static inline u16 readw(u32 address) -{ - return *((volatile u16 *)address); -} - -static inline u32 readl(u32 address) -{ - return *((volatile u32 *)address); -} - -static inline void jz_writeb(u32 address, u8 value) -{ - *((volatile u8 *)address) = value; -} - -static inline void jz_writew(u32 address, u16 value) -{ - *((volatile u16 *)address) = value; -} - -static inline void jz_writel(u32 address, u32 value) -{ - *((volatile u32 *)address) = value; -} - -static inline u8 jz_readb(u32 address) -{ - return *((volatile u8 *)address); -} - -static inline u16 jz_readw(u32 address) -{ - return *((volatile u16 *)address); -} - -static inline u32 jz_readl(u32 address) -{ - return *((volatile u32 *)address); -} - -#define BIT(n) (0x01u << (n)) -#define BIT0 (0x01u << 0) -#define BIT1 (0x01u << 1) -#define BIT2 (0x01u << 2) -#define BIT3 (0x01u << 3) -#define BIT4 (0x01u << 4) -#define BIT5 (0x01u << 5) -#define BIT6 (0x01u << 6) -#define BIT7 (0x01u << 7) -#define BIT8 (0x01u << 8) -#define BIT9 (0x01u << 9) -#define BIT10 (0x01u << 10) -#define BIT11 (0x01u << 11) -#define BIT12 (0x01u << 12) -#define BIT13 (0x01u << 13) -#define BIT14 (0x01u << 14) -#define BIT15 (0x01u << 15) -#define BIT16 (0x01u << 16) -#define BIT17 (0x01u << 17) -#define BIT18 (0x01u << 18) -#define BIT19 (0x01u << 19) -#define BIT20 (0x01u << 20) -#define BIT21 (0x01u << 21) -#define BIT22 (0x01u << 22) -#define BIT23 (0x01u << 23) -#define BIT24 (0x01u << 24) -#define BIT25 (0x01u << 25) -#define BIT26 (0x01u << 26) -#define BIT27 (0x01u << 27) -#define BIT28 (0x01u << 28) -#define BIT29 (0x01u << 29) -#define BIT30 (0x01u << 30) -#define BIT31 (0x01u << 31) - -/* Generate the bit field mask from msb to lsb */ -#define BITS_H2L(msb, lsb) ((0xFFFFFFFF >> (32-((msb)-(lsb)+1))) << (lsb)) - - -/* Get the bit field value from the data which is read from the register */ -#define get_bf_value(data, lsb, mask) (((data) & (mask)) >> (lsb)) - -#endif /* !ASSEMBLY */ - - -//---------------------------------------------------------------------- -// Register Definitions -// -/* AHB0 BUS Devices Base */ -#define HARB0_BASE 0xB3000000 -#define EMC_BASE 0xB3010000 -#define DDRC_BASE 0xB3020000 -#define MDMAC_BASE 0xB3030000 -#define LCD_BASE 0xB3050000 -#define TVE_BASE 0xB3050000 -#define SLCD_BASE 0xB3050000 -#define CIM_BASE 0xB3060000 -#define IPU_BASE 0xB3080000 -/* AHB1 BUS Devices Base */ -#define HARB1_BASE 0xB3200000 -#define DMAGP0_BASE 0xB3210000 -#define DMAGP1_BASE 0xB3220000 -#define DMAGP2_BASE 0xB3230000 -#define MC_BASE 0xB3250000 -#define ME_BASE 0xB3260000 -#define DEBLK_BASE 0xB3270000 -#define IDCT_BASE 0xB3280000 -#define CABAC_BASE 0xB3290000 -#define TCSM0_BASE 0xB32B0000 -#define TCSM1_BASE 0xB32C0000 -#define SRAM_BASE 0xB32D0000 -/* AHB2 BUS Devices Base */ -#define HARB2_BASE 0xB3400000 -#define NEMC_BASE 0xB3410000 -#define DMAC_BASE 0xB3420000 -#define UHC_BASE 0xB3430000 -//#define UDC_BASE 0xB3440000 -#define SFC_BASE 0xB3440000 -#define GPS_BASE 0xB3480000 -#define ETHC_BASE 0xB34B0000 -#define BCH_BASE 0xB34D0000 -#define MSC0_BASE 0xB3450000 -#define MSC1_BASE 0xB3460000 -#define MSC2_BASE 0xB3470000 -#define OTG_BASE 0xb3500000 - -/* APB BUS Devices Base */ -#define CPM_BASE 0xB0000000 -#define INTC_BASE 0xB0001000 -#define TCU_BASE 0xB0002000 -#define WDT_BASE 0xB0002000 -#define OST_BASE 0xB2000000 /* OS Timer */ -#define RTC_BASE 0xB0003000 -#define GPIO_BASE 0xB0010000 -#define AIC_BASE 0xB0020000 -#define DMIC_BASE 0xB0021000 -#define ICDC_BASE 0xB0020000 -#define UART0_BASE 0xB0030000 -#define UART1_BASE 0xB0031000 -#define UART2_BASE 0xB0032000 -#define SCC_BASE 0xB0040000 -#define SSI0_BASE 0xB0043000 -#define SSI1_BASE 0xB0044000 -#define SSI2_BASE 0xB0045000 -#define I2C0_BASE 0xB0050000 -#define I2C1_BASE 0xB0051000 -#define I2C2_BASE 0xB0052000 -#define PS2_BASE 0xB0060000 -#define SADC_BASE 0xB0070000 -#define OWI_BASE 0xB0072000 -#define TSSI_BASE 0xB0073000 - -/* NAND CHIP Base Address*/ -#define NEMC_CS1_IOBASE 0Xbb000000 -#define NEMC_CS2_IOBASE 0Xba000000 -#define NEMC_CS3_IOBASE 0Xb9000000 -#define NEMC_CS4_IOBASE 0Xb8000000 -#define NEMC_CS5_IOBASE 0Xb7000000 -#define NEMC_CS6_IOBASE 0Xb6000000 - -/********************************************************************************************************* -** WDT -*********************************************************************************************************/ -#define WDT_TDR (0x00) -#define WDT_TCER (0x04) -#define WDT_TCNT (0x08) -#define WDT_TCSR (0x0C) - -#define REG_WDT_TDR REG16(WDT_BASE + WDT_TDR) -#define REG_WDT_TCER REG8(WDT_BASE + WDT_TCER) -#define REG_WDT_TCNT REG16(WDT_BASE + WDT_TCNT) -#define REG_WDT_TCSR REG16(WDT_BASE + WDT_TCSR) - -#define WDT_TSCR_WDTSC (1 << 16) - -#define WDT_TCSR_PRESCALE_1 (0 << 3) -#define WDT_TCSR_PRESCALE_4 (1 << 3) -#define WDT_TCSR_PRESCALE_16 (2 << 3) -#define WDT_TCSR_PRESCALE_64 (3 << 3) -#define WDT_TCSR_PRESCALE_256 (4 << 3) -#define WDT_TCSR_PRESCALE_1024 (5 << 3) - -#define WDT_TCSR_EXT_EN (1 << 2) -#define WDT_TCSR_RTC_EN (1 << 1) -#define WDT_TCSR_PCK_EN (1 << 0) - -#define WDT_TCER_TCEN (1 << 0) - -/* RTC Reg */ -#define RTC_RTCCR (0x00) /* rw, 32, 0x00000081 */ -#define RTC_RTCSR (0x04) /* rw, 32, 0x???????? */ -#define RTC_RTCSAR (0x08) /* rw, 32, 0x???????? */ -#define RTC_RTCGR (0x0c) /* rw, 32, 0x0??????? */ -#define RTC_HCR (0x20) /* rw, 32, 0x00000000 */ -#define RTC_HWFCR (0x24) /* rw, 32, 0x0000???0 */ -#define RTC_HRCR (0x28) /* rw, 32, 0x00000??0 */ -#define RTC_HWCR (0x2c) /* rw, 32, 0x00000008 */ -#define RTC_HWRSR (0x30) /* rw, 32, 0x00000000 */ -#define RTC_HSPR (0x34) /* rw, 32, 0x???????? */ -#define RTC_WENR (0x3c) /* rw, 32, 0x00000000 */ -#define RTC_CKPCR (0x40) /* rw, 32, 0x00000010 */ -#define RTC_OWIPCR (0x44) /* rw, 32, 0x00000010 */ -#define RTC_PWRONCR (0x48) /* rw, 32, 0x???????? */ - -#define RTCCR_WRDY BIT(7) -#define WENR_WEN BIT(31) - -#define RECOVERY_SIGNATURE (0x001a1a) -#define REBOOT_SIGNATURE (0x003535) -#define UNMSAK_SIGNATURE (0x7c0000)//do not use these bits - - -#include "x1000_cpm.h" -#include "x1000_intc.h" -#include "x1000_otg_dwc.h" -#include "x1000_aic.h" -#include "x1000_slcdc.h" - -#endif /* _JZ_M150_H_ */ diff --git a/libcpu/mips/x1000/x1000_aic.h b/libcpu/mips/x1000/x1000_aic.h deleted file mode 100644 index ed2c8e6f7..000000000 --- a/libcpu/mips/x1000/x1000_aic.h +++ /dev/null @@ -1,794 +0,0 @@ -/** - ****************************************************************************** - * @file x1000_aic.h - * @author Urey - * @version V1.0.0 - * @date 2017Äê2ÔÂ20ÈÕ - * @brief TODO - ****************************************************************************** -**/ - - -#ifndef _X1000_AIC_H_ -#define _X1000_AIC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define AIC_FR (AIC_BASE + 0x00) -#define AIC_CR (AIC_BASE + 0x04) -#define AIC_ACCR1 (AIC_BASE + 0x08) -#define AIC_ACCR2 (AIC_BASE + 0x0c) -#define AIC_I2SCR (AIC_BASE + 0x10) -#define AIC_SR (AIC_BASE + 0x14) -#define AIC_ACSR (AIC_BASE + 0x18) -#define AIC_I2SSR (AIC_BASE + 0x1c) -#define AIC_ACCAR (AIC_BASE + 0x20) -#define AIC_ACCDR (AIC_BASE + 0x24) -#define AIC_ACSAR (AIC_BASE + 0x28) -#define AIC_ACSDR (AIC_BASE + 0x2c) -#define AIC_I2SDIV (AIC_BASE + 0x30) -#define AIC_DR (AIC_BASE + 0x34) - -#define SPDIF_ENA (AIC_BASE + 0x80) -#define SPDIF_CTRL (AIC_BASE + 0x84) -#define SPDIF_STATE (AIC_BASE + 0x88) -#define SPDIF_CFG1 (AIC_BASE + 0x8c) -#define SPDIF_CFG2 (AIC_BASE + 0x90) -#define SPDIF_FIFO (AIC_BASE + 0x94) - -#define ICDC_CKCFG (AIC_BASE + 0xa0) -#define ICDC_RGADW (AIC_BASE + 0xa4) -#define ICDC_RGDATA (AIC_BASE + 0xa8) - - -/* AIC_FR definition */ -#define AIC_FR_RFTH_LSB 24 -#define AIC_FR_RFTH(x) ( ( (x)/2 - 1 ) << AIC_FR_RFTH_LSB) // 2, 4, ..., 32 -#define AIC_FR_RFTH_MASK BITS_H2L(27, AIC_FR_RFTH_LSB) - -#define AIC_FR_TFTH_LSB 16 -#define AIC_FR_TFTH(x) ( ( (x)/2 ) << AIC_FR_TFTH_LSB) // 2, 4, ..., 32 -#define AIC_FR_TFTH_MASK BITS_H2L(20, AIC_FR_TFTH_LSB) - -/* new@4770 */ -#define AIC_FR_IBCKD BIT10 - -/* new@4770 */ -#define AIC_FR_ISYNCD BIT9 - -/* new@4770 */ -#define IC_FR_DMODE BIT8 - -#define AIC_FR_LSMP BIT6 -#define AIC_FR_ICDC BIT5 -#define AIC_FR_AUSEL BIT4 -#define AIC_FR_RST BIT3 -#define AIC_FR_BCKD BIT2 -#define AIC_FR_SYNCD BIT1 -#define AIC_FR_ENB BIT0 - - -/* AIC_CR definition */ -#define AIC_CR_PACK16 BIT28 - -#define AIC_CR_CHANNEL_LSB 24 -#define AIC_CR_CHANNEL_MASK BITS_H2L(26, 24) -#define AIC_CR_CHANNEL_MONO (0x0 << AIC_CR_CHANNEL_LSB) -#define AIC_CR_CHANNEL_STEREO (0x1 << AIC_CR_CHANNEL_LSB) -#define AIC_CR_CHANNEL_4CHNL (0x3 << AIC_CR_CHANNEL_LSB) -#define AIC_CR_CHANNEL_6CHNL (0x5 << AIC_CR_CHANNEL_LSB) -#define AIC_CR_CHANNEL_8CHNL (0x7 << AIC_CR_CHANNEL_LSB) - -#define AIC_CR_OSS_LSB 19 -#define AIC_CR_OSS_MASK BITS_H2L(21, AIC_CR_OSS_LSB) -#define AIC_CR_OSS(n) (((n) > 18 ? (n)/6 : (n)/9) << AIC_CR_OSS_LSB) /* n = 8, 16, 18, 20, 24 */ - -#define AIC_CR_ISS_LSB 16 -#define AIC_CR_ISS_MASK BITS_H2L(18, AIC_CR_ISS_LSB) -#define AIC_CR_ISS(n) (((n) > 18 ? (n)/6 : (n)/9) << AIC_CR_ISS_LSB) /* n = 8, 16, 18, 20, 24 */ - -#define AIC_CR_RDMS BIT15 -#define AIC_CR_TDMS BIT14 -#define AIC_CR_M2S BIT11 -#define AIC_CR_ENDSW BIT10 -#define AIC_CR_AVSTSU BIT9 -#define AIC_CR_TFLUSH BIT8 -#define AIC_CR_RFLUSH BIT7 -#define AIC_CR_EROR BIT6 -#define AIC_CR_ETUR BIT5 -#define AIC_CR_ERFS BIT4 -#define AIC_CR_ETFS BIT3 -#define AIC_CR_ENLBF BIT2 -#define AIC_CR_ERPL BIT1 -#define AIC_CR_EREC BIT0 - -/* AIC controller AC-link control register 1(ACCR1) */ -#define AIC_ACCR1_RS_LSB 16 -#define AIC_ACCR1_RS_MASK BITS_H2L(25, AIC_ACCR1_RS_LSB) -#define AIC_ACCR1_RS_SLOT(n) ((1 << ((n) - 3)) << AIC_ACCR1_RS_LSB) /* n = 3 .. 12 */ - -#define AIC_ACCR1_XS_LSB 0 -#define AIC_ACCR1_XS_MASK BITS_H2L(9, AIC_ACCR1_XS_LSB) -#define AIC_ACCR1_XS_SLOT(n) ((1 << ((n) - 3)) << AIC_ACCR1_XS_LSB) /* n = 3 .. 12 */ - -/* AIC controller AC-link control register 2 (ACCR2) */ -#define AIC_ACCR2_ERSTO BIT18 -#define AIC_ACCR2_ESADR BIT17 -#define AIC_ACCR2_ECADT BIT16 -#define AIC_ACCR2_SO BIT3 -#define AIC_ACCR2_SR BIT2 -#define AIC_ACCR2_SS BIT1 -#define AIC_ACCR2_SA BIT0 - -/* AIC controller i2s/msb-justified control register (I2SCR) */ -#define AIC_I2SCR_RFIRST BIT17 -#define AIC_I2SCR_SWLH BIT16 -#define AIC_I2SCR_ISTPBK BIT13 -#define AIC_I2SCR_STPBK BIT12 -#define AIC_I2SCR_ESCLK BIT4 -#define AIC_I2SCR_AMSL BIT0 - -/* AIC controller FIFO status register (AICSR) */ -#define AIC_SR_RFL_LSB 24 -#define AIC_SR_RFL_MASK BITS_H2L(29, AIC_SR_RFL_LSB) - -#define AIC_SR_TFL_LSB 8 -#define AIC_SR_TFL_MASK BITS_H2L(13, AIC_SR_TFL_LSB) - -#define AIC_SR_ROR BIT6 -#define AIC_SR_TUR BIT5 -#define AIC_SR_RFS BIT4 -#define AIC_SR_TFS BIT3 - -/* AIC controller AC-link status register (ACSR) */ -#define AIC_ACSR_SLTERR BIT21 -#define AIC_ACSR_CRDY BIT20 -#define AIC_ACSR_CLPM BIT19 -#define AIC_ACSR_RSTO BIT18 -#define AIC_ACSR_SADR BIT17 -#define AIC_ACSR_CADT BIT16 - -/* AIC controller I2S/MSB-justified status register (I2SSR) */ -#define AIC_I2SSR_CHBSY BIT5 -#define AIC_I2SSR_TBSY BIT4 -#define AIC_I2SSR_RBSY BIT3 -#define AIC_I2SSR_BSY BIT2 - -/* AIC controller AC97 codec command address register (ACCAR) */ -#define AIC_ACCAR_CAR_LSB 0 -#define AIC_ACCAR_CAR_MASK BITS_H2L(19, AIC_ACCAR_CAR_LSB) - - -/* AIC controller AC97 codec command data register (ACCDR) */ -#define AIC_ACCDR_CDR_LSB 0 -#define AIC_ACCDR_CDR_MASK BITS_H2L(19, AIC_ACCDR_CDR_LSB) - -/* AC97 read and write macro based on ACCAR and ACCDR */ -#define AC97_READ_CMD BIT19 -#define AC97_WRITE_CMD (BIT19 & ~BIT19) - -#define AC97_INDEX_LSB 12 -#define AC97_INDEX_MASK BITS_H2L(18, AC97_INDEX_LSB) - -#define AC97_DATA_LSB 4 -#define AC97_DATA_MASK BITS_H2L(19, AC97_DATA_LSB) - -/* AIC controller AC97 codec status address register (ACSAR) */ -#define AIC_ACSAR_SAR_LSB 0 -#define AIC_ACSAR_SAR_MASK BITS_H2L(19, AIC_ACSAR_SAR_LSB) - -/* AIC controller AC97 codec status data register (ACSDR) */ -#define AIC_ACSDR_SDR_LSB 0 -#define AIC_ACSDR_SDR_MASK BITS_H2L(19, AIC_ACSDR_SDR_LSB) - -/* AIC controller I2S/MSB-justified clock divider register (I2SDIV) */ -#define AIC_I2SDIV_IDIV_LSB 16 -#define AIC_I2SDIV_IDIV_MASK BITS_H2L(24, AIC_I2SDIV_IDIV_LSB) -#define AIC_I2SDIV_DIV_LSB 0 -#define AIC_I2SDIV_DIV_MASK BITS_H2L(8, AIC_I2SDIV_DIV_LSB) - -/* SPDIF enable register (SPDIF_ENA) */ -#define SPDIF_ENA_SPEN BIT0 - -/* SPDIF control register (SPDIF_CTRL) */ -#define SPDIF_CTRL_DMAEN BIT15 -#define SPDIF_CTRL_DTYPE BIT14 -#define SPDIF_CTRL_SIGN BIT13 -#define SPDIF_CTRL_INVALID BIT12 -#define SPDIF_CTRL_RST BIT11 -#define SPDIF_CTRL_SPDIFI2S BIT10 -#define SPDIF_CTRL_MTRIG BIT1 -#define SPDIF_CTRL_MFFUR BIT0 - -/* SPDIF state register (SPDIF_STAT) */ -#define SPDIF_STAT_BUSY BIT7 -#define SPDIF_STAT_FTRIG BIT1 -#define SPDIF_STAT_FUR BIT0 - -#define SPDIF_STAT_FLVL_LSB 8 -#define SPDIF_STAT_FLVL_MASK BITS_H2L(14, SPDIF_STAT_FLVL_LSB) - -/* SPDIF configure 1 register (SPDIF_CFG1) */ -#define SPDIF_CFG1_INITLVL BIT17 -#define SPDIF_CFG1_ZROVLD BIT16 - -#define SPDIF_CFG1_TRIG_LSB 12 -#define SPDIF_CFG1_TRIG_MASK BITS_H2L(13, SPDIF_CFG1_TRIG_LSB) -#define SPDIF_CFG1_TRIG(n) (((n) > 16 ? 3 : (n)/8) << SPDIF_CFG1_TRIG_LSB) /* n = 4, 8, 16, 32 */ - -#define SPDIF_CFG1_SRCNUM_LSB 8 -#define SPDIF_CFG1_SRCNUM_MASK BITS_H2L(11, SPDIF_CFG1_SRCNUM_LSB) - -#define SPDIF_CFG1_CH1NUM_LSB 4 -#define SPDIF_CFG1_CH1NUM_MASK BITS_H2L(7, SPDIF_CFG1_CH1NUM_LSB) - -#define SPDIF_CFG1_CH2NUM_LSB 0 -#define SPDIF_CFG1_CH2NUM_MASK BITS_H2L(3, SPDIF_CFG1_CH2NUM_LSB) - -/* SPDIF configure 2 register (SPDIF_CFG2) */ -#define SPDIF_CFG2_MAXWL BIT18 -#define SPDIF_CFG2_PRE BIT3 -#define SPDIF_CFG2_COPYN BIT2 -#define SPDIF_CFG2_AUDION BIT1 -#define SPDIF_CFG2_CONPRO BIT0 - -#define SPDIF_CFG2_FS_LSB 26 -#define SPDIF_CFG2_FS_MASK BITS_H2L(29, SPDIF_CFG2_FS_LSB) - -#define SPDIF_CFG2_ORGFRQ_LSB 22 -#define SPDIF_CFG2_ORGFRQ_MASK BITS_H2L(25, SPDIF_CFG2_ORGFRQ_LSB) - -#define SPDIF_CFG2_SAMWL_LSB 19 -#define SPDIF_CFG2_SAMWL_MASK BITS_H2L(21, SPDIF_CFG2_SAMWL_LSB) - -#define SPDIF_CFG2_CLKACU_LSB 16 -#define SPDIF_CFG2_CLKACU_MASK BITS_H2L(17, SPDIF_CFG2_CLKACU_LSB) - -#define SPDIF_CFG2_CATCODE_LSB 8 -#define SPDIF_CFG2_CATCODE_MASK BITS_H2L(15, SPDIF_CFG2_CATCODE_LSB) - -#define SPDIF_CFG2_CHMD_LSB 6 -#define SPDIF_CFG2_CHMD_MASK BITS_H2L(7, SPDIF_CFG2_CHMD_LSB) - -/* ICDC internal register access control register(RGADW) */ -#define ICDC_RGADW_RGWR BIT16 - -#define ICDC_RGADW_RGADDR_LSB 8 -#define ICDC_RGADW_RGADDR_MASK BITS_H2L(14, ICDC_RGADW_RGADDR_LSB) - -#define ICDC_RGADW_RGDIN_LSB 0 -#define ICDC_RGADW_RGDIN_MASK BITS_H2L(7, ICDC_RGADW_RGDIN_LSB) - - -/* ICDC internal register data output register (RGDATA)*/ -#define ICDC_RGDATA_IRQ BIT8 - -#define ICDC_RGDATA_RGDOUT_LSB 0 -#define ICDC_RGDATA_RGDOUT_MASK BITS_H2L(7, ICDC_RGDATA_RGDOUT_LSB) - - -#ifndef __MIPS_ASSEMBLER - - -#define REG_AIC_FR REG32(AIC_FR) -#define REG_AIC0_FR REG32(AIC0_FR) -#define REG_AIC_CR REG32(AIC_CR) -#define REG_AIC_ACCR1 REG32(AIC_ACCR1) -#define REG_AIC_ACCR2 REG32(AIC_ACCR2) -#define REG_AIC_I2SCR REG32(AIC_I2SCR) -#define REG_AIC_SR REG32(AIC_SR) -#define REG_AIC_ACSR REG32(AIC_ACSR) -#define REG_AIC_I2SSR REG32(AIC_I2SSR) -#define REG_AIC_ACCAR REG32(AIC_ACCAR) -#define REG_AIC_ACCDR REG32(AIC_ACCDR) -#define REG_AIC_ACSAR REG32(AIC_ACSAR) -#define REG_AIC_ACSDR REG32(AIC_ACSDR) -#define REG_AIC_I2SDIV REG32(AIC_I2SDIV) -#define REG_AIC_DR REG32(AIC_DR) - -#define REG_SPDIF_ENA REG32(SPDIF_ENA) -#define REG_SPDIF_CTRL REG32(SPDIF_CTRL) -#define REG_SPDIF_STATE REG32(SPDIF_STATE) -#define REG_SPDIF_CFG1 REG32(SPDIF_CFG1) -#define REG_SPDIF_CFG2 REG32(SPDIF_CFG2) -#define REG_SPDIF_FIFO REG32(SPDIF_FIFO) - -#define REG_ICDC_RGADW REG32(ICDC_RGADW) -#define REG_ICDC_RGDATA REG32(ICDC_RGDATA) - -#if 0 -#define __aic_enable() ( REG_AIC_FR |= AIC_FR_ENB ) -#define __aic_disable() ( REG_AIC_FR &= ~AIC_FR_ENB ) - -#define __aic_select_ac97() ( REG_AIC_FR &= ~AIC_FR_AUSEL ) -#define __aic_select_i2s() ( REG_AIC_FR |= AIC_FR_AUSEL ) - -#define __aic_play_zero() ( REG_AIC_FR &= ~AIC_FR_LSMP ) -#define __aic_play_lastsample() ( REG_AIC_FR |= AIC_FR_LSMP ) - -#define __i2s_as_master() ( REG_AIC_FR |= AIC_FR_BCKD | AIC_FR_SYNCD ) -#define __i2s_as_slave() ( REG_AIC_FR &= ~(AIC_FR_BCKD | AIC_FR_SYNCD) ) - -#define jz_aic_ibck_in (CLRREG32(AIC_FR, AIC_FR_IBCKD)) -#define jz_aic_ibck_out (SETREG32(AIC_FR, AIC_FR_IBCKD)) - -#define jz_aic_isync_in (CLRREG32(AIC_FR, AIC_FR_ISYNCD)) -#define jz_aic_isync_out (SETREG32(AIC_FR, AIC_FR_ISYNCD)) - -#define jz_aic_enable_dmode (SETREG32(AIC_FR, AIC_FR_DMODE)) -#define jz_aic_disable_dmode (CLRREG32(AIC_FR, AIC_FR_DMODE)) - -#define __aic_reset_status() ( REG_AIC_FR & AIC_FR_RST ) - -#define __aic_reset() \ -do { \ - REG_AIC_FR |= AIC_FR_RST; \ -} while(0) - - -#define __aic_set_transmit_trigger(n) \ -do { \ - REG_AIC_FR &= ~AIC_FR_TFTH_MASK; \ - REG_AIC_FR |= ((n) << AIC_FR_TFTH_LSB); \ -} while(0) - -#define __aic_set_receive_trigger(n) \ -do { \ - REG_AIC_FR &= ~AIC_FR_RFTH_MASK; \ - REG_AIC_FR |= ((n) << AIC_FR_RFTH_LSB); \ -} while(0) - -#define __aic_enable_oldstyle() -#define __aic_enable_newstyle() -#define __aic_enable_pack16() ( REG_AIC_CR |= AIC_CR_PACK16 ) -#define __aic_enable_unpack16() ( REG_AIC_CR &= ~AIC_CR_PACK16) - -#define jz_aic_set_channel(n) \ - do { \ - switch((n)) { \ - case 1: \ - case 2: \ - case 4: \ - case 6: \ - case 8: \ - CLRREG32(AIC_CR, AIC_CR_CHANNEL_MASK); \ - SETREG32(AIC_CR, ((((n) - 1) << 24) & AIC_CR_CHANNEL_MASK)); \ - break; \ - default: \ - printk("invalid aic channel, must be 1, 2, 4, 6, or 8\n"); \ - break; \ - } \ - } while(0) - -/* n = AIC_CR_CHANNEL_MONO,AIC_CR_CHANNEL_STEREO ... */ -#define __aic_out_channel_select(n) \ -do { \ - REG_AIC_CR &= ~AIC_CR_CHANNEL_MASK; \ - REG_AIC_CR |= ((n) << AIC_CR_CHANNEL_LSB ); \ -} while(0) - -#define __aic_enable_record() ( REG_AIC_CR |= AIC_CR_EREC ) -#define __aic_disable_record() ( REG_AIC_CR &= ~AIC_CR_EREC ) -#define __aic_enable_replay() ( REG_AIC_CR |= AIC_CR_ERPL ) -#define __aic_disable_replay() ( REG_AIC_CR &= ~AIC_CR_ERPL ) -#define __aic_enable_loopback() ( REG_AIC_CR |= AIC_CR_ENLBF ) -#define __aic_disable_loopback() ( REG_AIC_CR &= ~AIC_CR_ENLBF ) - -#define __aic_flush_tfifo() ( REG_AIC_CR |= AIC_CR_TFLUSH ) -#define __aic_unflush_tfifo() ( REG_AIC_CR &= ~AIC_CR_TFLUSH ) -#define __aic_flush_rfifo() ( REG_AIC_CR |= AIC_CR_RFLUSH ) -#define __aic_unflush_rfifo() ( REG_AIC_CR &= ~AIC_CR_RFLUSH ) - -#define __aic_enable_transmit_intr() \ - ( REG_AIC_CR |= (AIC_CR_ETFS | AIC_CR_ETUR) ) -#define __aic_disable_transmit_intr() \ - ( REG_AIC_CR &= ~(AIC_CR_ETFS | AIC_CR_ETUR) ) -#define __aic_enable_receive_intr() \ - ( REG_AIC_CR |= (AIC_CR_ERFS | AIC_CR_EROR) ) -#define __aic_disable_receive_intr() \ - ( REG_AIC_CR &= ~(AIC_CR_ERFS | AIC_CR_EROR) ) - -#define __aic_enable_transmit_dma() ( REG_AIC_CR |= AIC_CR_TDMS ) -#define __aic_disable_transmit_dma() ( REG_AIC_CR &= ~AIC_CR_TDMS ) -#define __aic_enable_receive_dma() ( REG_AIC_CR |= AIC_CR_RDMS ) -#define __aic_disable_receive_dma() ( REG_AIC_CR &= ~AIC_CR_RDMS ) - -#define __aic_enable_mono2stereo() ( REG_AIC_CR |= AIC_CR_M2S ) -#define __aic_disable_mono2stereo() ( REG_AIC_CR &= ~AIC_CR_M2S ) -#define __aic_enable_byteswap() ( REG_AIC_CR |= AIC_CR_ENDSW ) -#define __aic_disable_byteswap() ( REG_AIC_CR &= ~AIC_CR_ENDSW ) -#define __aic_enable_unsignadj() ( REG_AIC_CR |= AIC_CR_AVSTSU ) -#define __aic_disable_unsignadj() ( REG_AIC_CR &= ~AIC_CR_AVSTSU ) - -#define AC97_PCM_XS_L_FRONT AIC_ACCR1_XS_SLOT(3) -#define AC97_PCM_XS_R_FRONT AIC_ACCR1_XS_SLOT(4) -#define AC97_PCM_XS_CENTER AIC_ACCR1_XS_SLOT(6) -#define AC97_PCM_XS_L_SURR AIC_ACCR1_XS_SLOT(7) -#define AC97_PCM_XS_R_SURR AIC_ACCR1_XS_SLOT(8) -#define AC97_PCM_XS_LFE AIC_ACCR1_XS_SLOT(9) - -#define AC97_PCM_RS_L_FRONT AIC_ACCR1_RS_SLOT(3) -#define AC97_PCM_RS_R_FRONT AIC_ACCR1_RS_SLOT(4) -#define AC97_PCM_RS_CENTER AIC_ACCR1_RS_SLOT(6) -#define AC97_PCM_RS_L_SURR AIC_ACCR1_RS_SLOT(7) -#define AC97_PCM_RS_R_SURR AIC_ACCR1_RS_SLOT(8) -#define AC97_PCM_RS_LFE AIC_ACCR1_RS_SLOT(9) - -#define __ac97_set_xs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK ) -#define __ac97_set_xs_mono() \ -do { \ - REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \ - REG_AIC_ACCR1 |= AC97_PCM_XS_R_FRONT; \ -} while(0) -#define __ac97_set_xs_stereo() \ -do { \ - REG_AIC_ACCR1 &= ~AIC_ACCR1_XS_MASK; \ - REG_AIC_ACCR1 |= AC97_PCM_XS_L_FRONT | AC97_PCM_XS_R_FRONT; \ -} while(0) - -/* In fact, only stereo is support now. */ -#define __ac97_set_rs_none() ( REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK ) -#define __ac97_set_rs_mono() \ -do { \ - REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \ - REG_AIC_ACCR1 |= AC97_PCM_RS_R_FRONT; \ -} while(0) -#define __ac97_set_rs_stereo() \ -do { \ - REG_AIC_ACCR1 &= ~AIC_ACCR1_RS_MASK; \ - REG_AIC_ACCR1 |= AC97_PCM_RS_L_FRONT | AC97_PCM_RS_R_FRONT; \ -} while(0) - -#define __ac97_warm_reset_codec() \ - do { \ - REG_AIC_ACCR2 |= AIC_ACCR2_SA; \ - REG_AIC_ACCR2 |= AIC_ACCR2_SS; \ - udelay(2); \ - REG_AIC_ACCR2 &= ~AIC_ACCR2_SS; \ - REG_AIC_ACCR2 &= ~AIC_ACCR2_SA; \ - } while (0) - -#define __ac97_cold_reset_codec() \ - do { \ - REG_AIC_ACCR2 |= AIC_ACCR2_SR; \ - udelay(2); \ - REG_AIC_ACCR2 &= ~AIC_ACCR2_SR; \ - } while (0) - -/* n=8,16,18,20 */ -#define __ac97_set_iass(n) \ - ( REG_AIC_ACCR2 = (REG_AIC_ACCR2 & ~AIC_ACCR2_IASS_MASK) | AIC_ACCR2_IASS_##n##BIT ) -#define __ac97_set_oass(n) \ - ( REG_AIC_ACCR2 = (REG_AIC_ACCR2 & ~AIC_ACCR2_OASS_MASK) | AIC_ACCR2_OASS_##n##BIT ) - -/* This bit should only be set in 2 channels configuration */ -#define __i2s_send_rfirst() ( REG_AIC_I2SCR |= AIC_I2SCR_RFIRST ) /* RL */ -#define __i2s_send_lfirst() ( REG_AIC_I2SCR &= ~AIC_I2SCR_RFIRST ) /* LR */ - -/* This bit should only be set in 2 channels configuration and 16bit-packed mode */ -#define __i2s_switch_lr() ( REG_AIC_I2SCR |= AIC_I2SCR_SWLH ) -#define __i2s_unswitch_lr() ( REG_AIC_I2SCR &= ~AIC_I2SCR_SWLH ) - -#define __i2s_select_i2s() ( REG_AIC_I2SCR &= ~AIC_I2SCR_AMSL ) -#define __i2s_select_msbjustified() ( REG_AIC_I2SCR |= AIC_I2SCR_AMSL ) - -/* n=8,16,18,20,24 */ -/*#define __i2s_set_sample_size(n) \ - ( REG_AIC_I2SCR |= (REG_AIC_I2SCR & ~AIC_I2SCR_WL_MASK) | AIC_I2SCR_WL_##n##BIT )*/ - -#define __i2s_out_channel_select(n) __aic_out_channel_select(n) - -#define __i2s_set_oss_sample_size(n) \ - ( REG_AIC_CR = (REG_AIC_CR & ~AIC_CR_OSS_MASK) | AIC_CR_OSS(n)) -#define __i2s_set_iss_sample_size(n) \ - ( REG_AIC_CR = (REG_AIC_CR & ~AIC_CR_ISS_MASK) | AIC_CR_ISS(n)) - -#define __i2s_stop_bitclk() ( REG_AIC_I2SCR |= AIC_I2SCR_STPBK ) -#define __i2s_start_bitclk() ( REG_AIC_I2SCR &= ~AIC_I2SCR_STPBK ) - -#define __i2s_stop_ibitclk() ( REG_AIC_I2SCR |= AIC_I2SCR_ISTPBK ) -#define __i2s_start_ibitclk() ( REG_AIC_I2SCR &= ~AIC_I2SCR_ISTPBK ) - -#define __aic_transmit_request() ( REG_AIC_SR & AIC_SR_TFS ) -#define __aic_receive_request() ( REG_AIC_SR & AIC_SR_RFS ) -#define __aic_transmit_underrun() ( REG_AIC_SR & AIC_SR_TUR ) -#define __aic_receive_overrun() ( REG_AIC_SR & AIC_SR_ROR ) - -#define __aic_clear_errors() ( REG_AIC_SR &= ~(AIC_SR_TUR | AIC_SR_ROR) ) - -#define __aic_get_transmit_resident() \ - ( (REG_AIC_SR & AIC_SR_TFL_MASK) >> AIC_SR_TFL_LSB ) -#define __aic_get_receive_count() \ - ( (REG_AIC_SR & AIC_SR_RFL_MASK) >> AIC_SR_RFL_LSB ) - -#define __ac97_command_transmitted() ( REG_AIC_ACSR & AIC_ACSR_CADT ) -#define __ac97_status_received() ( REG_AIC_ACSR & AIC_ACSR_SADR ) -#define __ac97_status_receive_timeout() ( REG_AIC_ACSR & AIC_ACSR_RSTO ) -#define __ac97_codec_is_low_power_mode() ( REG_AIC_ACSR & AIC_ACSR_CLPM ) -#define __ac97_codec_is_ready() ( REG_AIC_ACSR & AIC_ACSR_CRDY ) -#define __ac97_slot_error_detected() ( REG_AIC_ACSR & AIC_ACSR_SLTERR ) -#define __ac97_clear_slot_error() ( REG_AIC_ACSR &= ~AIC_ACSR_SLTERR ) - -#define __i2s_is_busy() ( REG_AIC_I2SSR & AIC_I2SSR_BSY ) - -#define __ac97_out_rcmd_addr(reg) \ -do { \ - REG_AIC_ACCAR = AC97_READ_CMD | ((reg) << AC97_INDEX_LSB); \ -} while (0) - -#define __ac97_out_wcmd_addr(reg) \ -do { \ - REG_AIC_ACCAR = AC97_WRITE_CMD | ((reg) << AC97_INDEX_LSB); \ -} while (0) - -#define __ac97_out_data(value) \ -do { \ - REG_AIC_ACCDR = ((value) << AC97_DATA_LSB); \ -} while (0) - -#define __ac97_in_data() \ - ( (REG_AIC_ACSDR & CODEC_REG_DATA_MASK) >> AC97_DATA_LSB ) - -#define __ac97_in_status_addr() \ - ( (REG_AIC_ACSAR & AC97_INDEX_MASK) >> AC97_INDEX_LSB ) - -#define __i2s_set_sample_rate(i2sclk, sync) \ - ( REG_AIC_I2SDIV = ((i2sclk) / (4*64)) / (sync) ) - -#define __aic_write_tfifo(v) ( REG_AIC_DR = (v) ) -#define __aic_read_rfifo() ( REG_AIC_DR ) - -#define __aic_internal_codec() ( REG_AIC_FR |= AIC_FR_ICDC ) -#define __aic_external_codec() ( REG_AIC_FR &= ~AIC_FR_ICDC ) -#define __aic0_internal_codec() ( REG_AIC0_FR |= AIC_FR_ICDC ) -#define __aic0_external_codec() ( REG_AIC0_FR &= ~AIC_FR_ICDC ) - -// -// Define next ops for AC97 compatible -// - -#define AC97_ACSR AIC_ACSR - -#define __ac97_enable() __aic_enable(); __aic_select_ac97() -#define __ac97_disable() __aic_disable() -#define __ac97_reset() __aic_reset() - -#define __ac97_set_transmit_trigger(n) __aic_set_transmit_trigger(n) -#define __ac97_set_receive_trigger(n) __aic_set_receive_trigger(n) - -#define __ac97_enable_record() __aic_enable_record() -#define __ac97_disable_record() __aic_disable_record() -#define __ac97_enable_replay() __aic_enable_replay() -#define __ac97_disable_replay() __aic_disable_replay() -#define __ac97_enable_loopback() __aic_enable_loopback() -#define __ac97_disable_loopback() __aic_disable_loopback() - -#define __ac97_enable_transmit_dma() __aic_enable_transmit_dma() -#define __ac97_disable_transmit_dma() __aic_disable_transmit_dma() -#define __ac97_enable_receive_dma() __aic_enable_receive_dma() -#define __ac97_disable_receive_dma() __aic_disable_receive_dma() - -#define __ac97_transmit_request() __aic_transmit_request() -#define __ac97_receive_request() __aic_receive_request() -#define __ac97_transmit_underrun() __aic_transmit_underrun() -#define __ac97_receive_overrun() __aic_receive_overrun() - -#define __ac97_clear_errors() __aic_clear_errors() - -#define __ac97_get_transmit_resident() __aic_get_transmit_resident() -#define __ac97_get_receive_count() __aic_get_receive_count() - -#define __ac97_enable_transmit_intr() __aic_enable_transmit_intr() -#define __ac97_disable_transmit_intr() __aic_disable_transmit_intr() -#define __ac97_enable_receive_intr() __aic_enable_receive_intr() -#define __ac97_disable_receive_intr() __aic_disable_receive_intr() - -#define __ac97_write_tfifo(v) __aic_write_tfifo(v) -#define __ac97_read_rfifo() __aic_read_rfifo() - -// -// Define next ops for I2S compatible -// - -#define I2S_ACSR AIC_I2SSR - -#define __i2s_enable() __aic_enable(); __aic_select_i2s() -#define __i2s_disable() __aic_disable() -#define __i2s_reset() __aic_reset() - -#define __i2s_set_transmit_trigger(n) __aic_set_transmit_trigger(n) -#define __i2s_set_receive_trigger(n) __aic_set_receive_trigger(n) - -#define __i2s_enable_record() __aic_enable_record() -#define __i2s_disable_record() __aic_disable_record() -#define __i2s_enable_replay() __aic_enable_replay() -#define __i2s_disable_replay() __aic_disable_replay() -#define __i2s_enable_loopback() __aic_enable_loopback() -#define __i2s_disable_loopback() __aic_disable_loopback() - -#define __i2s_enable_transmit_dma() __aic_enable_transmit_dma() -#define __i2s_disable_transmit_dma() __aic_disable_transmit_dma() -#define __i2s_enable_receive_dma() __aic_enable_receive_dma() -#define __i2s_disable_receive_dma() __aic_disable_receive_dma() - -#define __i2s_transmit_request() __aic_transmit_request() -#define __i2s_receive_request() __aic_receive_request() -#define __i2s_transmit_underrun() __aic_transmit_underrun() -#define __i2s_receive_overrun() __aic_receive_overrun() - -#define __i2s_clear_errors() __aic_clear_errors() - -#define __i2s_get_transmit_resident() __aic_get_transmit_resident() -#define __i2s_get_receive_count() __aic_get_receive_count() - -#define __i2s_enable_transmit_intr() __aic_enable_transmit_intr() -#define __i2s_disable_transmit_intr() __aic_disable_transmit_intr() -#define __i2s_enable_receive_intr() __aic_enable_receive_intr() -#define __i2s_disable_receive_intr() __aic_disable_receive_intr() - -#define __i2s_write_tfifo(v) __aic_write_tfifo(v) -#define __i2s_read_rfifo() __aic_read_rfifo() - -#define __i2s_reset_codec() \ - do { \ - } while (0) - - -/************************************************************************* - * SPDIF INTERFACE in AIC Controller - *************************************************************************/ - -#define __spdif_enable() ( REG_SPDIF_ENA |= SPDIF_ENA_SPEN ) -#define __spdif_disable() ( REG_SPDIF_ENA &= ~SPDIF_ENA_SPEN ) - -#define __spdif_enable_transmit_dma() ( REG_SPDIF_CTRL |= SPDIF_CTRL_DMAEN ) -#define __spdif_disable_transmit_dma() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_DMAEN ) -#define __spdif_enable_dtype() ( REG_SPDIF_CTRL |= SPDIF_CTRL_DTYPE ) -#define __spdif_disable_dtype() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_DTYPE ) -#define __spdif_enable_sign() ( REG_SPDIF_CTRL |= SPDIF_CTRL_SIGN ) -#define __spdif_disable_sign() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_SIGN ) -#define __spdif_enable_invalid() ( REG_SPDIF_CTRL |= SPDIF_CTRL_INVALID ) -#define __spdif_disable_invalid() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_INVALID ) -#define __spdif_enable_reset() ( REG_SPDIF_CTRL |= SPDIF_CTRL_RST ) -#define __spdif_select_spdif() ( REG_SPDIF_CTRL |= SPDIF_CTRL_SPDIFI2S ) -#define __spdif_select_i2s() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_SPDIFI2S ) -#define __spdif_enable_MTRIGmask() ( REG_SPDIF_CTRL |= SPDIF_CTRL_MTRIG ) -#define __spdif_disable_MTRIGmask() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_MTRIG ) -#define __spdif_enable_MFFURmask() ( REG_SPDIF_CTRL |= SPDIF_CTRL_MFFUR ) -#define __spdif_disable_MFFURmask() ( REG_SPDIF_CTRL &= ~SPDIF_CTRL_MFFUR ) - -#define __spdif_enable_initlvl_high() ( REG_SPDIF_CFG1 |= SPDIF_CFG1_INITLVL ) -#define __spdif_enable_initlvl_low() ( REG_SPDIF_CFG1 &= ~SPDIF_CFG1_INITLVL ) -#define __spdif_enable_zrovld_invald() ( REG_SPDIF_CFG1 |= SPDIF_CFG1_ZROVLD ) -#define __spdif_enable_zrovld_vald() ( REG_SPDIF_CFG1 &= ~SPDIF_CFG1_ZROVLD ) - -/* 0, 1, 2, 3 */ -#define __spdif_set_transmit_trigger(n) \ -do { \ - REG_SPDIF_CFG1 &= ~SPDIF_CFG1_TRIG_MASK; \ - REG_SPDIF_CFG1 |= SPDIF_CFG1_TRIG(n); \ -} while(0) - -/* 1 ~ 15 */ -#define __spdif_set_srcnum(n) \ -do { \ - REG_SPDIF_CFG1 &= ~SPDIF_CFG1_SRCNUM_MASK; \ - REG_SPDIF_CFG1 |= ((n) << SPDIF_CFG1_SRCNUM_LSB); \ -} while(0) - -/* 1 ~ 15 */ -#define __spdif_set_ch1num(n) \ -do { \ - REG_SPDIF_CFG1 &= ~SPDIF_CFG1_CH1NUM_MASK; \ - REG_SPDIF_CFG1 |= ((n) << SPDIF_CFG1_CH1NUM_LSB); \ -} while(0) - -/* 1 ~ 15 */ -#define __spdif_set_ch2num(n) \ -do { \ - REG_SPDIF_CFG1 &= ~SPDIF_CFG1_CH2NUM_MASK; \ - REG_SPDIF_CFG1 |= ((n) << SPDIF_CFG1_CH2NUM_LSB); \ -} while(0) - -/* 0x0, 0x2, 0x3, 0xa, 0xe */ -#define __spdif_set_fs(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_FS_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_FS_LSB); \ -} while(0) - -/* 0xd, 0xc, 0x5, 0x1 */ -#define __spdif_set_orgfrq(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_ORGFRQ_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_ORGFRQ_LSB); \ -} while(0) - -/* 0x1, 0x6, 0x2, 0x4, 0x5 */ -#define __spdif_set_samwl(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_SAMWL_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_SAMWL_LSB); \ -} while(0) - -#define __spdif_enable_samwl_24() ( REG_SPDIF_CFG2 |= SPDIF_CFG2_MAXWL ) -#define __spdif_enable_samwl_20() ( REG_SPDIF_CFG1 &= ~SPDIF_CFG2_MAXWL ) - -/* 0x1, 0x1, 0x2, 0x3 */ -#define __spdif_set_clkacu(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_CLKACU_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_CLKACU_LSB); \ -} while(0) - -/* see IEC60958-3 */ -#define __spdif_set_catcode(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_CATCODE_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_CATCODE_LSB); \ -} while(0) - -/* n = 0x0, */ -#define __spdif_set_chmode(n) \ -do { \ - REG_SPDIF_CFG2 &= ~SPDIF_CFG2_CHMD_MASK; \ - REG_SPDIF_CFG2 |= ((n) << SPDIF_CFG2_CHMD_LSB); \ -} while(0) - -#define __spdif_enable_pre() ( REG_SPDIF_CFG2 |= SPDIF_CFG2_PRE ) -#define __spdif_disable_pre() ( REG_SPDIF_CFG2 &= ~SPDIF_CFG2_PRE ) -#define __spdif_enable_copyn() ( REG_SPDIF_CFG2 |= SPDIF_CFG2_COPYN ) -#define __spdif_disable_copyn() ( REG_SPDIF_CFG2 &= ~SPDIF_CFG2_COPYN ) -/* audio sample word represents linear PCM samples */ -#define __spdif_enable_audion() ( REG_SPDIF_CFG2 &= ~SPDIF_CFG2_AUDION ) -/* udio sample word used for other purpose */ -#define __spdif_disable_audion() ( REG_SPDIF_CFG2 |= SPDIF_CFG2_AUDION ) -#define __spdif_enable_conpro() ( REG_SPDIF_CFG2 &= ~SPDIF_CFG2_CONPRO ) -#define __spdif_disable_conpro() ( REG_SPDIF_CFG2 |= SPDIF_CFG2_CONPRO ) - -/*************************************************************************** - * ICDC - ***************************************************************************/ -#define __i2s_internal_codec() __aic_internal_codec() -#define __i2s_external_codec() __aic_external_codec() - -#define __icdc_clk_ready() ( REG_ICDC_CKCFG & ICDC_CKCFG_CKRDY ) -#define __icdc_sel_adc() ( REG_ICDC_CKCFG |= ICDC_CKCFG_SELAD ) -#define __icdc_sel_dac() ( REG_ICDC_CKCFG &= ~ICDC_CKCFG_SELAD ) - -#define __icdc_set_rgwr() ( REG_ICDC_RGADW |= ICDC_RGADW_RGWR ) -#define __icdc_clear_rgwr() ( REG_ICDC_RGADW &= ~ICDC_RGADW_RGWR ) -#define __icdc_rgwr_ready() ( REG_ICDC_RGADW & ICDC_RGADW_RGWR ) - -#define AIC_RW_CODEC_START() while (INREG32(ICDC_RGADW) & ICDC_RGADW_RGWR) -#define AIC_RW_CODEC_STOP() while (INREG32(ICDC_RGADW) & ICDC_RGADW_RGWR) - - -#define __icdc_set_addr(n) \ -do { \ - REG_ICDC_RGADW &= ~ICDC_RGADW_RGADDR_MASK; \ - REG_ICDC_RGADW |= (n) << ICDC_RGADW_RGADDR_LSB; \ -} while(0) - -#define __icdc_set_cmd(n) \ -do { \ - REG_ICDC_RGADW &= ~ICDC_RGADW_RGDIN_MASK; \ - REG_ICDC_RGADW |= (n) << ICDC_RGADW_RGDIN_LSB; \ -} while(0) - -#define __icdc_irq_pending() ( REG_ICDC_RGDATA & ICDC_RGDATA_IRQ ) -#define __icdc_get_value() ( REG_ICDC_RGDATA & ICDC_RGDATA_RGDOUT_MASK ) - - - -#endif /* __MIPS_ASSEMBLER */ - -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* _X1000_AIC_H_ */ diff --git a/libcpu/mips/x1000/x1000_cpm.h b/libcpu/mips/x1000/x1000_cpm.h deleted file mode 100644 index da2cc964e..000000000 --- a/libcpu/mips/x1000/x1000_cpm.h +++ /dev/null @@ -1,511 +0,0 @@ -/* - * File : x1000_cpm.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2017-02-03 Urey the first version - */ - -#ifndef _X1000_CPM_H_ -#define _X1000_CPM_H_ - -#define CPM_CPCCR (0x00) -#define CPM_CPCSR (0xd4) - -#define CPM_DDRCDR (0x2c) -#define CPM_I2SCDR (0x60) -#define CPM_I2SCDR1 (0x70) -#define CPM_LPCDR (0x64) -#define CPM_MSC0CDR (0x68) -#define CPM_MSC1CDR (0xa4) -#define CPM_USBCDR (0x50) -#define CPM_MACCDR (0x54) -#define CPM_UHCCDR (0x6c) -#define CPM_SFCCDR (0x74) -#define CPM_CIMCDR (0x7c) -#define CPM_PCMCDR (0x84) -#define CPM_PCMCDR1 (0xe0) -#define CPM_MPHYC (0xe8) - -#define CPM_INTR (0xb0) -#define CPM_INTRE (0xb4) -#define CPM_DRCG (0xd0) -#define CPM_CPSPPR (0x38) -#define CPM_CPPSR (0x34) - -#define CPM_USBPCR (0x3c) -#define CPM_USBRDT (0x40) -#define CPM_USBVBFIL (0x44) -#define CPM_USBPCR1 (0x48) - -#define CPM_CPAPCR (0x10) -#define CPM_CPMPCR (0x14) - -#define CPM_LCR (0x04) -#define CPM_PSWC0ST (0x90) -#define CPM_PSWC1ST (0x94) -#define CPM_PSWC2ST (0x98) -#define CPM_PSWC3ST (0x9c) -#define CPM_CLKGR (0x20) -#define CPM_CLKGR0 (0x20) -#define CPM_MESTSEL (0xec) -#define CPM_SRBC (0xc4) -#define CPM_ERNG (0xd8) -#define CPM_RNG (0xdc) -#define CPM_SLBC (0xc8) -#define CPM_SLPC (0xcc) -#define CPM_OPCR (0x24) -#define CPM_RSR (0x08) - - - - -/* - * CPM registers common define - */ - -/* Clock control register(CPCCR) */ -#define CPCCR_SEL_SRC_LSB 30 -#define CPCCR_SEL_SRC_MASK BITS_H2L(31, CPCCR_SEL_SRC_LSB) - -#define CPCCR_SEL_CPLL_LSB 28 -#define CPCCR_SEL_CPLL_MASK BITS_H2L(29, CPCCR_SEL_CPLL_LSB) - -#define CPCCR_SEL_H0PLL_LSB 26 -#define CPCCR_SEL_H0PLL_MASK BITS_H2L(27, CPCCR_SEL_H0PLL_LSB) - -#define CPCCR_SEL_H2PLL_LSB 24 -#define CPCCR_SEL_H2PLL_MASK BITS_H2L(25, CPCCR_SEL_H2PLL_LSB) - -#define CPCCR_CE_CPU BIT22 -#define CPCCR_CE_AHB0 BIT21 -#define CPCCR_CE_AHB2 BIT20 -#define CPCCR_CE (CPCCR_CE_CPU | CPCCR_CE_AHB0 | CPCCR_CE_AHB2) - -#define CPCCR_PDIV_LSB 16 -#define CPCCR_PDIV_MASK BITS_H2L(19, CPCCR_PDIV_LSB) - -#define CPCCR_H2DIV_LSB 12 -#define CPCCR_H2DIV_MASK BITS_H2L(15, CPCCR_H2DIV_LSB) - -#define CPCCR_H0DIV_LSB 8 -#define CPCCR_H0DIV_MASK BITS_H2L(11, CPCCR_H0DIV_LSB) - -#define CPCCR_L2DIV_LSB 4 -#define CPCCR_L2DIV_MASK BITS_H2L(7, CPCCR_L2DIV_LSB) - -#define CPCCR_CDIV_LSB 0 -#define CPCCR_CDIV_MASK BITS_H2L(3, CPCCR_CDIV_LSB) - -#define CPM_SRC_SEL_APLL 1 -#define CPM_PLL_SEL_SRC 1 -#define CPM_PLL_SEL_MPLL 2 - -/* Clock Status register(CPCSR) */ -#define CPCSR_SRC_MUX BIT31 -#define CPCSR_CPU_MUX BIT30 -#define CPCSR_AHB0_MUX BIT29 -#define CPCSR_AHB2_MUX BIT28 -#define CPCSR_DDR_MUX BIT27 -#define CPCSR_H2DIV_BUSY BIT2 -#define CPCSR_H0DIV_BUSY BIT1 -#define CPCSR_CDIV_BUSY BIT0 -#define CPCSR_DIV_BUSY (CPCSR_H2DIV_BUSY | CPCSR_H0DIV_BUSY | CPCSR_CDIV_BUSY) - -/* DDR clock divider register(DDCDR) */ -#define DDCDR_DCS_LSB 30 -#define DDCDR_DCS_MASK BITS_H2L(31, DDCDR_DCS_LSB) -#define DDCDR_DCS_STOP (0 << DDCDR_DCS_LSB) -#define DDCDR_DCS_APLL (1 << DDCDR_DCS_LSB) -#define DDCDR_DCS_MPLL (2 << DDCDR_DCS_LSB) -#define DDCDR_CE_DDR BIT29 -#define DDCDR_DDR_BUSY BIT28 -#define DDCDR_DDR_STOP BIT27 -#define DDCDR_GATE_EN BIT26 -#define DDCDR_DDR_CHANGE_EN BIT25 -#define DDCDR_DDR BIT24 -#define DDCDR_DDRDIV_LSB 0 -#define DDCDR_DDRDIV_MASK BITS_H2L(3, DDCDR_DDRDIV_LSB) - -/*MACPHY clock divider Register (MACCDR)*/ -#define MACCDR_MACPCS BIT31 -#define MACCDR_CE_MAC BIT29 -#define MACCDR_MAC_BUSY BIT28 -#define MACCDR_MAC_STOP BIT27 -#define MACCDR_MACCDR_LSB BIT0 -#define MACCDR_MACCDR_MASK BITS_H2L(7,MACCDR_MACCDR_LSB) - -/* I2S device clock divider register(I2SCDR) */ -#define I2SCDR_I2PCS BIT31 -#define I2SCDR_I2CS BIT30 - -#define I2SCDR_I2SDIV_M_LSB 13 -#define I2SCDR_I2SDIV_M_MASK BITS_H2L(21,I2SCDR_I2SDIV_M_LSB) -#define I2SCDR_I2SDIV_N_LSB 0 /* I2SCDR bit */ -#define I2SCDR_I2SDIV_N_MASK BITS_H2L(7, I2SCDR_I2SDIV_N_LSB) - - -/* I2S device clock divider register(I2SCDR1) */ -#define I2SCDR1_NEN BIT31 -#define I2SCDR1_DEN BIT30 -#define I2SCDR1_I2SDIV_D_LSB 0 -#define I2SCDR1_I2SDIV_D_MASK BITS_H2L(12,I2SCDR1_I2SDIV_D_LSB) - -/* LCD pix clock divider register(LPCDR) */ -#define LPCDR_LPCS_LSB 31 -#define LPCDR_LPCS_APLL (0 << LPCDR_LPCS_LSB) -#define LPCDR_LPCS_MPLL (1 << LPCDR_LPCS_LSB) -#define LPCDR_CE_LCD BIT28 -#define LPCDR_LCD_BUSY BIT27 -#define LPCDR_LCD_STOP BIT26 - -#define LPCDR_PIXDIV_LSB 0 /* LPCDR bit */ -#define LPCDR_PIXDIV_MASK BITS_H2L(7, LPCDR_PIXDIV_LSB) - -/* MSC clock divider register(MSCCDR) */ -#define MSCCDR_MPCS_LSB 31 /* MPCS bit */ -#define MSCCDR_MPCS_APLL (0 << MSCCDR_MPCS_LSB) -#define MSCCDR_MPCS_MPLL (1 << MSCCDR_MPCS_LSB) - -#define MSCCDR_CE_MSC BIT29 -#define MSCCDR_MSC_BUSY BIT28 -#define MSCCDR_MSC_STOP BIT27 -#define MSCCDR_S_CLK0_SEL BIT15 - -#define MSCCDR_MSCDIV_LSB 0 /* MSCCDR bit */ -#define MSCCDR_MSCDIV_MASK BITS_H2L(7, MSCCDR_MSCDIV_LSB) - - -/* OTG PHY clock divider register(USBCDR) */ -#define USBCDR_UCS BIT31 -#define USBCDR_UPCS BIT30 -#define USBCDR_CE_USB BIT29 -#define USBCDR_USB_BUSY BIT28 -#define USBCDR_USB_STOP BIT27 - -#define USBCDR_OTGDIV_LSB 0 /* USBCDR bit */ -#define USBCDR_OTGDIV_MASK BITS_H2L(7, USBCDR_OTGDIV_LSB) - -/* SSI clock divider register(SSICDR) */ -#define SSICDR_SPCS BIT31 -#define SSICDR_SCS BIT30 -#define SSICDR_CE_SSI BIT29 -#define SSICDR_SSI_BUSY BIT28 -#define SSICDR_SSI_STOP BIT27 -#define SSICDR_SSIDIV_LSB 0 /* SSICDR bit */ -#define SSICDR_SSIDIV_MASK BITS_H2L(7, SSICDR_SSIDIV_LSB) - -/* CIM mclk clock divider register(CIMCDR) */ -#define CIMCDR_CIMPCS_APLL (0 << 31) -#define CIMCDR_CIMPCS_MPLL BIT31 -#define CIMCDR_CE_CIM BIT29 -#define CIMCDR_CIM_BUSY BIT28 -#define CIMCDR_CIM_STOP BIT27 - -#define CIMCDR_CIMDIV_LSB 0 /* CIMCDR bit */ -#define CIMCDR_CIMDIV_MASK BITS_H2L(7, CIMCDR_CIMDIV_LSB) - - -/* PCM device clock divider register(PCMCDR) */ -#define PCMCDR_PCMPCS_LSB 30 -#define PCMCDR_PCMPCS_MASK BITS_H2L(31,PCMCDR_PCMPCS_LSB) -#define PCMCDR_PCMPCS_SCLK_A 0 << PCMCDR_PCMPCS_LSB -#define PCMCDR_PCMPCS_EXTCLK 1 << PCMCDR_PCMPCS_LSB -#define PCMCDR_PCMPCS_MPLL 2 << PCMCDR_PCMPCS_LSB -#define PCMCDR_CE_PCM BIT29 -#define PCMCDR_PCMDIV_M_LSB 13 -#define PCMCDR_PCMDIV_M_MASK BITS_H2L(21,PCMCDR_PCMDIV_M_LSB) -#define PCMCDR_PCMDIV_N_LSB 0 -#define PCMCDR_PCMDIV_N_MASK BITS_H2L(12,PCMCDR_PCMDIV_N_LSB) - -/* PCM device clock divider register(PCMCDR1) */ - -#define PCMCDR1_PCM_NEN BIT31 -#define PCMCDR1_PCM_DEN BIT30 -#define PCMCDR1_PCMDIV_D_LSB 0 -#define PCMCDR1_PCMDIV_D_MASK BITS_H2L(12,PCMCDR1_PCMDIV_D_LSB) - -/* MAC PHY Control Register (MPHYC) */ -#define MPHYC_MODE_SEL BIT31 //useless now -#define MPHYC_MAC_SPEED_LSB 29 -#define MPHYC_MAC_SPEED_MASK BITS_H2L(30,MPHYC_MAC_SPEED_LSB) -#define MPHYC_SOFT_RST BIT3 -#define MPHYC_PHY_INTF_LSB 0 -#define MPHYC_PHY_INTF_MASK BITS_H2L(2,MPHYC_PHY_INTF_MASK) //useless now - -/* CPM Interrupt Register (CPM_INTR)*/ -#define CPM_INTR_VBUS_INTR BIT1 -#define CPM_INTR_ADEV_INTR BIT0 - -/* CPM Interrupt Enable Register (CPM_INTRE)*/ -#define CPM_INTRE_VBUS_INTRE BIT1 -#define CPM_INTRE_ADEV_INTRE BIT0 - -/* CPM scratch pad protected register(CPSPPR) */ -#define CPSPPR_CPSPR_WRITABLE (0x00005a5a) - -/* OTG parameter control register(USBPCR) */ -#define USBPCR_USB_MODE BIT31 -#define USBPCR_AVLD_REG BIT30 -#define USBPCR_INCRM BIT27 /* INCR_MASK bit */ -#define USBPCR_TXRISE_TUNE BIT26 -#define USBPCR_COMMONONN BIT25 -#define USBPCR_VBUSVLDEXT BIT24 -#define USBPCR_VBUSVLDEXTSEL BIT23 -#define USBPCR_POR BIT22 -#define USBPCR_SIDDQ BIT21 -#define USBPCR_OTG_DISABLE BIT20 -#define USBPCR_TXPREEMPHTUNE BIT6 - -#define USBPCR_IDPULLUP_LSB 28 /* IDPULLUP_MASK bit */ -#define USBPCR_IDPULLUP_MASK BITS_H2L(29, USBPCR_IDPULLUP_LSB) - -#define USBPCR_COMPDISTUNE_LSB 17 -#define USBPCR_COMPDISTUNE_MASK BITS_H2L(19, USBPCR_COMPDISTUNE_LSB) - -#define USBPCR_OTGTUNE_LSB 14 -#define USBPCR_OTGTUNE_MASK BITS_H2L(16, USBPCR_OTGTUNE_LSB) - -#define USBPCR_SQRXTUNE_LSB 11 -#define USBPCR_SQRXTUNE_MASK BITS_H2L(13, USBPCR_SQRXTUNE_LSB) - -#define USBPCR_TXFSLSTUNE_LSB 7 -#define USBPCR_TXFSLSTUNE_MASK BITS_H2L(10, USBPCR_TXFSLSTUNE_LSB) - -#define USBPCR_TXRISETUNE_LSB 4 -#define USBPCR_TXRISETUNE_MASK BITS_H2L(5, USBPCR_TXRISETUNE_LSB) - -#define USBPCR_TXVREFTUNE_LSB 0 -#define USBPCR_TXVREFTUNE_MASK BITS_H2L(3, USBPCR_TXVREFTUNE_LSB) - -/* OTG reset detect timer register(USBRDT) */ -#define USBRDT_HB_MASK BIT26 -#define USBRDT_VBFIL_LD_EN BIT25 -#define USBRDT_IDDIG_EN BIT24 -#define USBRDT_IDDIG_REG BIT23 - -#define USBRDT_USBRDT_LSB 0 -#define USBRDT_USBRDT_MASK BITS_H2L(22, USBRDT_USBRDT_LSB) - -/* OTG parameter control register(USBPCR1) */ -#define USBPCR1_REG BIT31 -#define USBPCR1_USB_SEL BIT28 -#define USBPCR1_REFCLKSEL_LSB 26 -#define USBPCR1_REFCLKSEL_MASK BITS_H2L(27, USBPCR1_REFCLKSEL_LSB) - -#define USBPCR1_REFCLKDIV_LSB 24 -#define USBPCR1_REFCLKDIV_MASK BITS_H2L(25, USBPCR1_REFCLKDIV_LSB) - -#define USBPCR1_PORT_RST BIT21 - -#define USBPCR1_WORD_IF0 BIT19 -#define USBPCR1_WORD_IF1 BIT18 - - -/* APLL control register (CPXPCR) */ -#define CPAPCR_BS BIT31 -#define CPAPCR_M_LSB 24 -#define CPAPCR_M_MASK BITS_H2L(30, CPAPCR_M_LSB) - -#define CPAPCR_N_LSB 18 -#define CPAPCR_N_MASK BITS_H2L(22, CPAPCR_N_LSB) - -#define CPAPCR_OD_LSB 16 -#define CPAPCR_OD_MASK BITS_H2L(17, CPAPCR_OD_LSB) - -#define CPAPCR_LOCK BIT15 /* LOCK bit */ -#define CPAPCR_ON BIT10 -#define CPAPCR_BP BIT9 -#define CPAPCR_EN BIT8 -#define CPAPCR_PLLST_LSB 0 -#define CPAPCR_PLLST_MASK BITS_H2L(7,CPAPCR_PLLST_LSB) - -#define CPM_CPAPCR_EN CPAPCR_EN -#define CPM_CPAPCR_ON CPAPCR_ON - -/* MPLL control register (CPXPCR) */ -#define CPMPCR_BS BIT31 -#define CPMPCR_M_LSB 24 -#define CPMPCR_M_MASK BITS_H2L(30, CPAPCR_M_LSB) - -#define CPMPCR_N_LSB 18 -#define CPMPCR_N_MASK BITS_H2L(22, CPAPCR_N_LSB) - -#define CPMPCR_OD_LSB 16 -#define CPMPCR_OD_MASK BITS_H2L(17, CPAPCR_OD_LSB) - -#define CPMPCR_EN BIT7 -#define CPMPCR_BP BIT6 -#define CPMPCR_LOCK BIT1 /* LOCK bit */ -#define CPMPCR_ON BIT0 - -#define CPM_CPMPCR_EN CPMPCR_EN -#define CPM_CPMPCR_ON CPMPCR_ON - - - -/* Low power control register(LCR) */ -#define LCR_PST_LSB 8 -#define LCD_PST_MASK BITS_H2L(19,LCR_PST_LSB) -#define LCR_LPM_LSB 0 -#define LCR_LPM_MASK BITS_H2L(1,LCR_LPM_LSB) - -/* Clock gate register 0(CGR0) */ -#define CLKGR0_DDR BIT31 -#define CLKGR0_CPU BIT30 -#define CLKGR0_AHB0 BIT29 -#define CLKGR0_APB0 BIT28 -#define CLKGR0_RTC BIT27 -#define CLKGR0_PCM BIT26 -#define CLKGR0_MAC BIT25 -#define CLKGR0_AES BIT24 -#define CLKGR0_LCD BIT23 -#define CLKGR0_CIM BIT22 -#define CLKGR0_PDMA BIT21 -#define CLKGR0_OST BIT20 -#define CLKGR0_SSI BIT19 -#define CLKGR0_TCU BIT18 -#define CLKGR0_DMIC BIT17 -#define CLKGR0_UART2 BIT16 -#define CLKGR0_UART1 BIT15 -#define CLKGR0_UART0 BIT14 -#define CLKGR0_SADC BIT13 -#define CLKGR0_JPEG BIT12 -#define CLKGR0_AIC BIT11 -#define CLKGR0_I2C3 BIT10 -#define CLKGR0_I2C2 BIT9 -#define CLKGR0_I2C1 BIT8 -#define CLKGR0_I2C0 BIT7 -#define CLKGR0_SCC BIT6 -#define CLKGR0_MSC1 BIT5 -#define CLKGR0_MSC0 BIT4 -#define CLKGR0_OTG BIT3 -#define CLKGR0_SFC BIT2 -#define CLKGR0_EFUSE BIT1 -#define CLKGR0_NEMC BIT0 - -/* CPM MEST SEL Register */ - -#define MEST_SEL_TST8 BIT8 -#define MEST_SEL_TST7 BIT7 -#define MEST_SEL_TST4 BIT4 -#define MEST_SEL_TST3 BIT3 -#define MEST_SEL_TST1 BIT1 -#define MEST_SEL_TST0 BIT0 - -/*Soft Reset and Bus Control Register (SRBC)*/ - -#define SRBC_JPEG_SR BIT31 -#define SRBC_JPEG_STP BIT30 -#define SRBC_JPEG_ACK BIT29 -#define SRBC_LCD_SR BIT25 -#define SRBC_LCD_STP BIT24 -#define SRBC_LCD_ACK BIT23 -#define SRBC_CIM_STP BIT21 -#define SRBC_CIM_ACK BIT20 -#define SRBC_CPU_STP BIT15 -#define SRBC_CPU_ACK BIT14 -#define SRBC_OTG_SR BIT12 -#define SRBC_AHB2_STP BIT8 -#define SRBC_AHB2_ACK BIT7 -#define SRBC_DDR_STP BIT6 -#define SRBC_DDR_ACK BIT5 - - -/* Oscillator and power control register(OPCR) */ -#define OPCR_IDLE_DIS BIT31 -#define OPCR_MASK_INT BIT30 -#define OPCR_MASK_VPU BIT29 //ONLY FOR DEBUG -#define OPCR_GATE_SCLK_ABUS BIT28 -#define OPCR_L2C_PD BIT25 -#define OPCR_REQ_MODE BIT24 -#define OPCR_GATE_USBPHY_CLK BIT23 -#define OPCR_DIS_STOP_MUX BIT22 -#define OPCR_O1ST_LSB 8 -#define OPCR_O1ST_MASK BITS_H2L(19, OPCR_O1ST_LSB) -#define OPCR_OTGPHY0_ENABLE BIT7 /* otg */ -#define OPCR_OTGPHY1_ENABLE BIT6 /* uhc */ -#define OPCR_USBPHY_ENABLE (OPCR_OTGPHY0_ENABLE | OPCR_OTGPHY1_ENABLE) -#define OPCR_O1SE BIT4 -#define OPCR_PD BIT3 -#define OPCR_ERCS BIT2 -#define OPCR_BUSMODE BIT1 - - - -/* Reset status register(RSR) */ -#define RSR_HR BIT3 -#define RSR_P0R BIT2 -#define RSR_WR BIT1 -#define RSR_PR BIT0 - - -#ifndef __ASSEMBLY__ - -#define REG_CPM_CPCCR REG32(CPM_BASE + CPM_CPCCR) -#define REG_CPM_CPCSR REG32(CPM_BASE + CPM_CPCSR) -#define REG_CPM_DDCDR REG32(CPM_BASE + CPM_DDCDR) -#define REG_CPM_MACCDR REG32(CPM_BASE + CPM_MACCDR) -#define REG_CPM_I2SCDR REG32(CPM_BASE + CPM_I2SCDR) -#define REG_CPM_I2SCDR1 REG32(CPM_BASE + CPM_I2SCDR1) -#define REG_CPM_LPCDR REG32(CPM_BASE + CPM_LPCDR) -#define REG_CPM_MSC0CDR REG32(CPM_BASE + CPM_MSC0CDR) -#define REG_CPM_MSC1CDR REG32(CPM_BASE + CPM_MSC1CDR) -#define REG_CPM_USBCDR REG32(CPM_BASE + CPM_USBCDR) -#define REG_CPM_SSICDR REG32(CPM_BASE + CPM_SSICDR) -#define REG_CPM_CIMCDR REG32(CPM_BASE + CPM_CIMCDR) -#define REG_CPM_PCMCDR REG32(CPM_BASE + CPM_PCMCDR) -#define REG_CPM_PCMCDR1 REG32(CPM_BASE + CPM_PCMCDR1) -#define REG_CPM_MPHYC REG32(CPM_BASE + CPM_MPHYC) -#define REG_CPM_INTRCDR REG32(CPM_BASE + CPM_INTRCDR) -#define REG_CPM_INTRECDR REG32(CPM_BASE + CPM_INTRECDR) -#define REG_CPM_CPSPR REG32(CPM_BASE + CPM_CPSPR) -#define REG_CPM_CPSPPR REG32(CPM_BASE + CPM_CPSPPR) -#define REG_CPM_USBPCR REG32(CPM_BASE + CPM_USBPCR) -#define REG_CPM_USBRDT REG32(CPM_BASE + CPM_USBRDT) -#define REG_CPM_USBVBFIL REG32(CPM_BASE + CPM_USBVBFIL) -#define REG_CPM_USBPCR1 REG32(CPM_BASE + CPM_USBPCR1) -#define REG_CPM_CPAPCR REG32(CPM_BASE + CPM_CPAPCR) -#define REG_CPM_CPMPCR REG32(CPM_BASE + CPM_CPMPCR) - -#define REG_CPM_LCR REG32(CPM_BASE + CPM_LCR) -#define REG_CPM_PSWC0ST REG32(CPM_BASE + CPM_PSWC0ST) -#define REG_CPM_PSWC1ST REG32(CPM_BASE + CPM_PSWC1ST) -#define REG_CPM_PSWC2ST REG32(CPM_BASE + CPM_PSWC2ST) -#define REG_CPM_PSWC3ST REG32(CPM_BASE + CPM_PSWC3ST) -#define REG_CPM_CLKGR0 REG32(CPM_BASE + CPM_CLKGR0) -#define REG_CPM_SRBC REG32(CPM_BASE + CPM_SRBC) -#define REG_CPM_SLBC REG32(CPM_BASE + CPM_SLBC) -#define REG_CPM_SLPC REG32(CPM_BASE + CPM_SLPC) -#define REG_CPM_OPCR REG32(CPM_BASE + CPM_OPCR) -#define REG_CPM_RSR REG32(CPM_BASE + CPM_RSR) - -#define _REG_CPM_MSCCDR(n) REG_CPM_MSC##n##CDR -#define REG_CPM_MSCCDR(n) _REG_CPM_MSCCDR(n) - -/* CPM read write */ -#define cpm_inl(off) readl(CPM_BASE + off) -#define cpm_outl(val,off) writel(val, CPM_BASE + off) -#define cpm_test_bit(bit,off) (cpm_inl(off) & 0x1<<(bit)) -#define cpm_set_bit(bit,off) (cpm_outl((cpm_inl(off) | 0x1<<(bit)),off)) -#define cpm_clear_bit(bit,off) (cpm_outl(cpm_inl(off) & ~(0x1 << bit), off)) - -#endif /* __ASSEMBLY__ */ - -#endif /* _X1000_CPM_H_ */ diff --git a/libcpu/mips/x1000/x1000_intc.h b/libcpu/mips/x1000/x1000_intc.h deleted file mode 100644 index 1644b9077..000000000 --- a/libcpu/mips/x1000/x1000_intc.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * File : x1000_intc.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2017-02-03 Urey the first version - */ - -#ifndef _X1000_INTC_H_ -#define _X1000_INTC_H_ - - -/* - * INTC (Interrupt Controller) - */ -#define INTC_ISR(n) (INTC_BASE + 0x00 + (n) * 0x20) -#define INTC_IMR(n) (INTC_BASE + 0x04 + (n) * 0x20) -#define INTC_IMSR(n) (INTC_BASE + 0x08 + (n) * 0x20) -#define INTC_IMCR(n) (INTC_BASE + 0x0c + (n) * 0x20) -#define INTC_IPR(n) (INTC_BASE + 0x10 + (n) * 0x20) - -#define REG_INTC_ISR(n) REG32(INTC_ISR((n))) -#define REG_INTC_IMR(n) REG32(INTC_IMR((n))) -#define REG_INTC_IMSR(n) REG32(INTC_IMSR((n))) -#define REG_INTC_IMCR(n) REG32(INTC_IMCR((n))) -#define REG_INTC_IPR(n) REG32(INTC_IPR((n))) - -// interrupt controller interrupts -#define IRQ_DMIC 0 -#define IRQ_AIC0 1 -#define IRQ_RESERVED2 2 -#define IRQ_RESERVED3 3 -#define IRQ_RESERVED4 4 -#define IRQ_RESERVED5 5 -#define IRQ_RESERVED6 6 -#define IRQ_SFC 7 -#define IRQ_SSI0 8 -#define IRQ_RESERVED9 9 -#define IRQ_PDMA 10 -#define IRQ_PDMAD 11 -#define IRQ_RESERVED12 12 -#define IRQ_RESERVED13 13 -#define IRQ_GPIO3 14 -#define IRQ_GPIO2 15 -#define IRQ_GPIO1 16 -#define IRQ_GPIO0 17 -#define IRQ_RESERVED18 18 -#define IRQ_RESERVED19 19 -#define IRQ_RESERVED20 20 -#define IRQ_OTG 21 -#define IRQ_RESERVED22 22 -#define IRQ_AES 23 -#define IRQ_RESERVED24 24 -#define IRQ_TCU2 25 -#define IRQ_TCU1 26 -#define IRQ_TCU0 27 -#define IRQ_RESERVED28 28 -#define IRQ_RESERVED29 29 -#define IRQ_CIM 30 -#define IRQ_LCD 31 -#define IRQ_RTC 32 -#define IRQ_RESERVED33 33 -#define IRQ_RESERVED34 34 -#define IRQ_RESERVED35 35 -#define IRQ_MSC1 36 -#define IRQ_MSC0 37 -#define IRQ_SCC 38 -#define IRQ_RESERVED39 39 -#define IRQ_PCM0 40 -#define IRQ_RESERVED41 41 -#define IRQ_RESERVED42 42 -#define IRQ_RESERVED43 43 -#define IRQ_HARB2 44 -#define IRQ_RESERVED45 45 -#define IRQ_HARB0 46 -#define IRQ_CPM 47 -#define IRQ_RESERVED48 48 -#define IRQ_UART2 49 -#define IRQ_UART1 50 -#define IRQ_UART0 51 -#define IRQ_DDR 52 -#define IRQ_RESERVED53 53 -#define IRQ_EFUSE 54 -#define IRQ_MAC 55 -#define IRQ_RESERVED56 56 -#define IRQ_RESERVED57 57 -#define IRQ_I2C2 58 -#define IRQ_I2C1 59 -#define IRQ_I2C0 60 -#define IRQ_PDMAM 61 -#define IRQ_JPEG 62 -#define IRQ_RESERVED63 63 - -#define IRQ_INTC_MAX 63 - -#ifndef __ASSEMBLY__ - -#define __intc_unmask_irq(n) (REG_INTC_IMCR((n)/32) = (1 << ((n)%32))) -#define __intc_mask_irq(n) (REG_INTC_IMSR((n)/32) = (1 << ((n)%32))) -#define __intc_ack_irq(n) (REG_INTC_IPR((n)/32) = (1 << ((n)%32))) /* A dummy ack, as the Pending Register is Read Only. Should we remove __intc_ack_irq() */ - -#endif /* !__ASSEMBLY__ */ - -#endif /* _X1000_INTC_H_ */ diff --git a/libcpu/mips/x1000/x1000_otg_dwc.h b/libcpu/mips/x1000/x1000_otg_dwc.h deleted file mode 100644 index bb77981da..000000000 --- a/libcpu/mips/x1000/x1000_otg_dwc.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * File : x1000_otg_dwc.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2017-02-03 Urey the first version - */ - -#ifndef _X1000_OTG_DWC_H_ -#define _X1000_OTG_DWC_H_ - -/* Globle Regs define */ -#define GOTG_CTL (OTG_BASE + 0x00) -#define GOTG_INTR (OTG_BASE + 0x04) -#define GAHB_CFG (OTG_BASE + 0x08) -#define GUSB_CFG (OTG_BASE + 0x0c) -#define GRST_CTL (OTG_BASE + 0x10) -#define GINT_STS (OTG_BASE + 0x14) -#define GINT_MASK (OTG_BASE + 0x18) -#define GRXSTS_READ (OTG_BASE + 0x1c) -#define GRXSTS_POP (OTG_BASE + 0x20) -#define GRXFIFO_SIZE (OTG_BASE + 0x24) -#define GNPTXFIFO_SIZE (OTG_BASE + 0x28) -#define GDTXFIFO_SIZE (OTG_BASE + 0x104) -#define GHW_CFG1 (OTG_BASE + 0x44) -#define GHW_CFG2 (OTG_BASE + 0x48) -#define GHW_CFG3 (OTG_BASE + 0x4c) -#define GHW_CFG4 (OTG_BASE + 0x50) -#define GDFIFO_CFG (OTG_BASE + 0x5c) -#define PCGC_CTL (OTG_BASE + 0xe00) - -/* Fifo number 1 ~ 15 */ -#define GDEIP_TXF(n) (OTG_BASE + (0x104 + ((n-1) * 0x4))) - -#define REG_GOTG_CTL REG32(GOTG_CTL) -#define REG_GOTG_INTR REG32(GOTG_INTR) -#define REG_GAHB_CFG REG32(GAHB_CFG) -#define REG_GUSB_CFG REG32(GUSB_CFG) -#define REG_GRST_CTL REG32(GRST_CTL) -#define REG_GINT_STS REG32(GINT_STS) -#define REG_GINT_MASK REG32(GINT_MASK) -#define REG_GRXSTS_READ REG32(GRXSTS_READ) -#define REG_GRXSTS_POP REG32(GRXSTS_POP) -#define REG_GRXFIFO_SIZE REG32(GRXFIFO_SIZE) -#define REG_GNPTXFIFO_SIZE REG32(GNPTXFIFO_SIZE) -#define REG_GDTXFIFO_SIZE REG32(GDTXFIFO_SIZE) -#define REG_GHW_CFG1 REG32(GHW_CFG1) -#define REG_GHW_CFG2 REG32(GHW_CFG2) -#define REG_GHW_CFG3 REG32(GHW_CFG3) -#define REG_GHW_CFG4 REG32(GHW_CFG4) -#define REG_GDFIFO_CFG REG32(GDFIFO_CFG) -#define REG_GDIEP_TXF(n) REG32(GDEIP_TXF(n)) -#define REG_PCGC_CTL REG32(PCGC_CTL) -/* Device Regs define */ -#define EP_FIFO(n) (OTG_BASE + (n+1)*0x1000) // FiX ME -#define REG_EP_FIFO(n) REG32(EP_FIFO(n)) - - -#define OTG_DCFG (OTG_BASE + 0x800) -#define OTG_DCTL (OTG_BASE + 0x804) -#define OTG_DSTS (OTG_BASE + 0x808) -#define DIEP_MASK (OTG_BASE + 0x810) -#define DOEP_MASK (OTG_BASE + 0x814) -#define OTG_DAINT (OTG_BASE + 0x818) -#define DAINT_MASK (OTG_BASE + 0x81c) - -#define DIEP_EMPMSK (OTG_BASE + 0x834) - - -/* It's used in OTG_MULT_PROC_INTRPT = 1 -#define DEACH_INT (OTG_BASE + 0x838) -#define DEACH_INTMASK (OTG_BASE + 0x83c) -#define DIEP0_INTMASK (OTG_BASE + 0x840) -#define DIEP1_INTMASK (OTG_BASE + 0x844) -#define DOEP0_INTMASK (OTG_BASE + 0x880) -#define DOEP1_INTMASK (OTG_BASE + 0x884) -*/ - -#define DIEP_CTL(n) (OTG_BASE + (0x900 + (n)*0x20)) -#define DOEP_CTL(n) (OTG_BASE + (0xb00 + (n)*0x20)) - -#define DIEP_INT(n) (OTG_BASE + (0x908 + (n)*0x20)) -#define DOEP_INT(n) (OTG_BASE + (0xb08 + (n)*0x20)) - -#define DIEP_SIZE(n) (OTG_BASE + (0x910 + (n)*0x20)) -#define DOEP_SIZE(n) (OTG_BASE + (0xb10 + (n)*0x20)) - -#define DIEP_TXFSTS(n) (OTG_BASE + (0x918 + (n)*0x20)) - -#define DIEP_DMA(n) (OTG_BASE + (0x914 + (n)*0x20)) -#define DOEP_DMA(n) (OTG_BASE + (0xb14 + (n)*0x20)) - -#define REG_OTG_DCFG REG32(OTG_DCFG) -#define REG_OTG_DCTL REG32(OTG_DCTL) -#define REG_OTG_DSTS REG32(OTG_DSTS) -#define REG_DIEP_MASK REG32(DIEP_MASK) -#define REG_DOEP_MASK REG32(DOEP_MASK) -#define REG_OTG_DAINT REG32(OTG_DAINT) -#define REG_DAINT_MASK REG32(DAINT_MASK) -#define REG_DIEP_EMPMSK REG32(DIEP_EMPMSK) - -#define REG_DIEP_CTL(n) REG32(DIEP_CTL(n)) -#define REG_DOEP_CTL(n) REG32(DOEP_CTL(n)) - -#define REG_DIEP_INT(n) REG32(DIEP_INT(n)) -#define REG_DOEP_INT(n) REG32(DOEP_INT(n)) - -#define REG_DIEP_SIZE(n) REG32(DIEP_SIZE(n)) -#define REG_DOEP_SIZE(n) REG32(DOEP_SIZE(n)) - -#define REG_DIEP_TXFSTS(n) REG32(DIEP_TXFSTS(n)) - -#define REG_DIEP_DMA(n) REG32(DIEP_DMA(n)) -#define REG_DOEP_DMA(n) REG32(DOEP_DMA(n)) - -/* Regs macro define */ -/*************************************************/ -#define AHBCFG_TXFE_LVL BIT7 -#define AHBCFG_DMA_ENA BIT5 -#define AHBCFG_GLOBLE_INTRMASK BIT0 -#define USBCFG_FORCE_DEVICE BIT30 -#define USBCFG_TRDTIME_MASK (0xf << 10) -#define USBCFG_TRDTIME_9 (9 << 10) -#define USBCFG_TRDTIME_6 (6 << 10) - -/* GRSTCTL */ -#define RSTCTL_AHB_IDLE BIT31 -#define RSTCTL_TXFNUM_ALL (0x10 << 6) -#define RSTCTL_TXFIFO_FLUSH BIT5 -#define RSTCTL_RXFIFO_FLUSH BIT4 -#define RSTCTL_INTK_FLUSH BIT3 -#define RSTCTL_FRMCNT_RST BIT2 -#define RSTCTL_CORE_RST BIT0 - -/* GINTMSK */ -#define GINTMSK_RSUME_DETE BIT31 -#define GINTMSK_CONID_STSCHG BIT28 -#define GINTMSK_RESET_DETE BIT23 -#define GINTMSK_FETCH_SUSPEND BIT22 -#define GINTMSK_OEP_INTR BIT19 -#define GINTMSK_IEP_INTR BIT18 -#define GINTMSK_EP_MISMATCH BIT17 -#define GINTMSK_ENUM_DONE BIT13 -#define GINTMSK_USB_RESET BIT12 -#define GINTMSK_USB_SUSPEND BIT11 -#define GINTMSK_USB_EARLYSUSPEND BIT10 -#define GINTMSK_I2C_INT BIT9 -#define GINTMSK_ULPK_CKINT BIT8 -#define GINTMSK_GOUTNAK_EFF BIT7 -#define GINTMSK_GINNAK_EFF BIT6 -#define GINTMSK_NPTXFIFO_EMPTY BIT5 -#define GINTMSK_RXFIFO_NEMPTY BIT4 -#define GINTMSK_START_FRAM BIT3 -#define GINTMSK_OTG_INTR BIT2 -#define GINTMSK_MODE_MISMATCH BIT1 - -/* GINTSTS */ -#define GINTSTS_RSUME_DETE BIT31 -#define GINTSTS_CONID_STSCHG BIT28 -#define GINTSTS_RESET_DETE BIT23 -#define GINTSTS_FETCH_SUSPEND BIT22 -#define GINTSTS_OEP_INTR BIT19 -#define GINTSTS_IEP_INTR BIT18 -#define GINTSTS_EP_MISMATCH BIT17 -#define GINTSTS_ENUM_DONE BIT13 -#define GINTSTS_USB_RESET BIT12 -#define GINTSTS_USB_SUSPEND BIT11 -#define GINTSTS_USB_EARLYSUSPEND BIT10 -#define GINTSTS_I2C_INT BIT9 -#define GINTSTS_ULPK_CKINT BIT8 -#define GINTSTS_GOUTNAK_EFF BIT7 -#define GINTSTS_GINNAK_EFF BIT6 -#define GINTSTS_NPTXFIFO_EMPTY BIT5 -#define GINTSTS_RXFIFO_NEMPTY BIT4 -#define GINTSTS_START_FRAM BIT3 -#define GINTSTS_OTG_INTR BIT2 -#define GINTSTS_MODE_MISMATCH BIT1 - -/* DCTL */ -#define DCTL_CGOUTNAK BIT10 -#define DCTL_CLR_GNPINNAK BIT8 -#define DCTL_SGNPINNAK BIT7 -#define DCTL_SOFT_DISCONN BIT1 -#define DCTL_SGOUTNAK BIT9 -/* DCFG */ -#define DCFG_DEV_ADDR_MASK (0x7f << 4) -#define DCFG_DEV_ADDR_BIT 4 -#define DCFG_DEV_DESC_DMA (1 << 23) -/* DSTS */ -#define DSTS_ERRATIC_ERROR BIT3 -#define DSTS_ENUM_SPEED_MASK (0x3 << 1) -#define DSTS_ENUM_SPEED_BIT BIT1 -#define DSTS_ENUM_SPEED_HIGH (0x0 << 1) -#define DSTS_ENUM_SPEED_FULL_30OR60 (0x1 << 1) -#define DSTS_ENUM_SPEED_LOW (0x2 << 1) -#define DSTS_ENUM_SPEED_FULL_48 (0x3 << 1) - -/* GRXSTSR/GRXSTSP */ -#define GRXSTSP_PKSTS_MASK (0xf << 17) -#define GRXSTSP_PKSTS_GOUT_NAK (0x1 << 17) -#define GRXSTSP_PKSTS_GOUT_RECV (0x2 << 17) -#define GRXSTSP_PKSTS_TX_COMP (0x3 << 17) -#define GRXSTSP_PKSTS_SETUP_COMP (0x4 << 17) -#define GRXSTSP_PKSTS_SETUP_RECV (0x6 << 17) -#define GRXSTSP_BYTE_CNT_MASK (0x7ff << 4) -#define GRXSTSP_BYTE_CNT_BIT 4 -#define GRXSTSP_EPNUM_MASK (0xf) -#define GRXSTSP_EPNUM_BIT BIT0 - - -/* DIOEPCTL */ -// ep0 -#define DEP_EP0_MAXPKET_SIZE 64 -#define DEP_EP0_MPS_64 (0x0) -#define DEP_EP0_MPS_32 (0x1) -#define DEP_EP0_MPS_16 (0x2) -#define DEP_EP0_MPS_8 (0x3) - -#define DEP_ENA_BIT BIT31 -#define DEP_DISENA_BIT BIT30 -#define DEP_SET_NAK BIT27 -#define DEP_CLEAR_NAK BIT26 -#define DEP_SET_STALL BIT21 -#define DEP_TYPE_MASK (0x3 << 18) -#define DEP_TYPE_CNTL (0x0 << 18) -#define DEP_TYPE_ISO (0x1 << 18) -#define DEP_TYPE_BULK (0x2 << 18) -#define DEP_TYPE_INTR (0x3 << 18) -#define USB_ACTIVE_EP BIT15 -#define DEP_PKTSIZE_MASK 0x7ff -#define DEP_FS_PKTSIZE 64 -#define DEP_HS_PKTSIZE 512 - -/* DIOEPINT */ -#define DEP_NYET_INT BIT14 -#define DEP_NAK_INT BIT13 -#define DEP_BABBLE_ERR_INT BIT12 -#define DEP_PKT_DROP_STATUS BIT11 -#define DEP_BNA_INT BIT9 -#define DEP_TXFIFO_UNDRN BIT8 // Only for INEP -#define DEP_OUTPKT_ERR BIT8 // Only for OUTEP -#define DEP_TXFIFO_EMPTY BIT7 -#define DEP_INEP_NAKEFF BIT6 // Only for INEP -#define DEP_B2B_SETUP_RECV BIT6 // Only for OUTEP0 -#define DEP_INTOKEN_EPMISATCH BIT5 // Only for INEP -#define DEP_STATUS_PHASE_RECV BIT5 // Only for OUTEP0 -#define DEP_INTOKEN_RECV_TXFIFO_EMPTY BIT4 // Only for INEP -#define DEP_OUTTOKEN_RECV_EPDIS BIT4 // Only for OUTEP -#define DEP_TIME_OUT BIT3 // Only for INEP -#define DEP_SETUP_PHASE_DONE BIT3 // Only for OUTEP0 -#define DEP_AHB_ERR BIT2 -#define DEP_EPDIS_INT BIT1 -#define DEP_XFER_COMP BIT0 // Used by INEP and OUTEP - -/* DOEPSIZ0 */ -#define DOEPSIZE0_SUPCNT_1 (0x1 << 29) -#define DOEPSIZE0_SUPCNT_2 (0x2 << 29) -#define DOEPSIZE0_SUPCNT_3 (0x3 << 29) -#define DOEPSIZE0_PKTCNT_BIT BIT19 - - -#define DEP_RXFIFO_SIZE 1064 -#define DEP_NPTXFIFO_SIZE 1024 -#define DEP_DTXFIFO_SIZE 768 - - -#define DWC_GAHBCFG_INT_DMA_BURST_SINGLE 0 -#define DWC_GAHBCFG_INT_DMA_BURST_INCR 1 -#define DWC_GAHBCFG_INT_DMA_BURST_INCR4 3 -#define DWC_GAHBCFG_INT_DMA_BURST_INCR8 5 -#define DWC_GAHBCFG_INT_DMA_BURST_INCR16 7 - -#define DWC_GAHBCFG_EXT_DMA_BURST_1word 0x0 -#define DWC_GAHBCFG_EXT_DMA_BURST_4word 0x1 -#define DWC_GAHBCFG_EXT_DMA_BURST_8word 0x2 -#define DWC_GAHBCFG_EXT_DMA_BURST_16word 0x3 -#define DWC_GAHBCFG_EXT_DMA_BURST_32word 0x4 -#define DWC_GAHBCFG_EXT_DMA_BURST_64word 0x5 -#define DWC_GAHBCFG_EXT_DMA_BURST_128word 0x6 -#define DWC_GAHBCFG_EXT_DMA_BURST_256word 0x7 - -#define DEP_NUM 2 - -#if 0 -#define UTMI_PHY_WIDTH 8 -#else -#define UTMI_PHY_WIDTH 16 -#endif - -#endif /* _X1000_OTG_DWC_H_ */ diff --git a/libcpu/mips/x1000/x1000_slcdc.h b/libcpu/mips/x1000/x1000_slcdc.h deleted file mode 100644 index fab76ffad..000000000 --- a/libcpu/mips/x1000/x1000_slcdc.h +++ /dev/null @@ -1,463 +0,0 @@ -/* - * File : x1000_slcdc.h - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * Change Logs: - * Date Author Notes - * 2017Äê3ÔÂ20ÈÕ Urey the first version - */ -#ifndef _X1000_SLCDC_H_ -#define _X1000_SLCDC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/************************************************************************* - * SLCD (Smart LCD Controller) - *************************************************************************/ -#define LCDC0_BASE LCD_BASE - -#define SLCDC_CFG (LCDC0_BASE + 0xA0) /* SLCDC Configure Register */ -#define SLCDC_CTRL (LCDC0_BASE + 0xA4) /* SLCDC Control Register */ -#define SLCDC_STATE (LCDC0_BASE + 0xA8) /* SLCDC Status Register */ -#define SLCDC_DATA (LCDC0_BASE + 0xAC) /* SLCDC Data Register */ - -#define SLCDC_CFG_NEW (LCDC0_BASE + 0xB8) -#define SLCDC_WTIME (LCDC0_BASE + 0xB0) -#define SLCDC_TAS (LCDC0_BASE + 0xB4) -#define SLCDC_SLOW_TIME (LCDC0_BASE + 0xBC) - -/* SLCDC Configure Register */ -#define SLCDC_CFG_DWIDTH_BIT 10 -#define SLCDC_CFG_DWIDTH_MASK (0x7 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_18BIT (0 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_16BIT (1 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_8BIT_x3 (2 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_8BIT_x2 (3 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_8BIT_x1 (4 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_24BIT (5 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_DWIDTH_9BIT_x2 (7 << SLCDC_CFG_DWIDTH_BIT) -#define SLCDC_CFG_CWIDTH_BIT (8) -#define SLCDC_CFG_CWIDTH_MASK (0x3 << SLCDC_CFG_CWIDTH_BIT) -#define SLCDC_CFG_CWIDTH_16BIT (0 << SLCDC_CFG_CWIDTH_BIT) -#define SLCDC_CFG_CWIDTH_8BIT (1 << SLCDC_CFG_CWIDTH_BIT) -#define SLCDC_CFG_CWIDTH_18BIT (2 << SLCDC_CFG_CWIDTH_BIT) -#define SLCDC_CFG_CWIDTH_24BIT (3 << SLCDC_CFG_CWIDTH_BIT) -#define SLCDC_CFG_CS_ACTIVE_LOW (0 << 4) -#define SLCDC_CFG_CS_ACTIVE_HIGH (1 << 4) -#define SLCDC_CFG_RS_CMD_LOW (0 << 3) -#define SLCDC_CFG_RS_CMD_HIGH (1 << 3) -#define SLCDC_CFG_CLK_ACTIVE_FALLING (0 << 1) -#define SLCDC_CFG_CLK_ACTIVE_RISING (1 << 1) -#define SLCDC_CFG_TYPE_PARALLEL (0 << 0) -#define SLCDC_CFG_TYPE_SERIAL (1 << 0) - -/* SLCD New Configure Register */ -#define SLCDC_NEW_CFG_DWIDTH_BIT 13 -#define SLCDC_NEW_CFG_DWIDTH_MASK (0x7 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_DWIDTH_8BIT (0 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_DWIDTH_9BIT (1 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_DWIDTH_16BIT (2 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_DWIDTH_18BIT (3 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_DWIDTH_24BIT (4 << SLCDC_NEW_CFG_DWIDTH_BIT) -#define SLCDC_NEW_CFG_6800_MD (1 << 11) -#define SLCDC_NEW_CFG_CMD_9BIT (1 << 10) /* only use in old slcd */ -#define SLCDC_NEW_CFG_CMD_16BIT (0 << 10) /* only use in old slcd */ -#define SLCDC_NEW_CFG_DTIME_BIT 8 -#define SLCDC_NEW_CFG_DTIME_MASK (0x3 << SLCDC_NEW_CFG_DTIME_BIT) -#define SLCDC_NEW_CFG_DTIME_ONCE (0 << SLCDC_NEW_CFG_DTIME_BIT) -#define SLCDC_NEW_CFG_DTIME_TWICE (1 << SLCDC_NEW_CFG_DTIME_BIT) -#define SLCDC_NEW_CFG_DTIME_THREE (2 << SLCDC_NEW_CFG_DTIME_BIT) -#define SLCDC_NEW_CFG_CS_HIGH_IDLE (0 << 5) -#define SLCDC_NEW_CFG_CS_LOW_IDLE (1 << 5) -#define SLCDC_NEW_CFG_RS_CMD_LOW (0 << 4) -#define SLCDC_NEW_CFG_RS_CMD_HIGH (1 << 4) -#define SLCDC_NEW_CFG_CLK_ACTIVE_FALLING (0 << 3) -#define SLCDC_NEW_CFG_CLK_ACTIVE_RISING (1 << 3) -#define SLCDC_NEW_CFG_DTYPE_PARALLEL (0 << 2) -#define SLCDC_NEW_CFG_DTYPE_SERIAL (1 << 2) -#define SLCDC_NEW_CFG_CTYPE_PARALLEL (0 << 1) -#define SLCDC_NEW_CFG_CTYPE_SERIAL (1 << 1) -#define SLCDC_NEW_CFG_FMT_CONV_EN (1 << 0) - -/* SLCD Control Register */ -#define SLCDC_CTRL_TE_INV (1 << 9) -#define SLCDC_CTRL_NOT_USE_TE (1 << 8) -#define SLCDC_CTRL_DCSI_SEL (1 << 7) -#define SLCDC_CTRL_MIPI_MODE (1 << 6) -#define SLCDC_CTRL_NEW_MODE (1 << 5) -#define SLCDC_CTRL_FAST_MODE (1 << 4) -#define SLCDC_CTRL_GATE_MASK (1 << 3) -#define SLCDC_CTRL_DMA_MODE (1 << 2) -#define SLCDC_CTRL_DMA_START (1 << 1) -#define SLCDC_CTRL_DMA_EN (1 << 0) - -/* SLCD Status Register */ -#define SLCDC_STATE_BUSY (1 << 0) - -/* SLCD Data Register */ -#define SLCDC_DATA_RS_DATA (0 << 30) -#define SLCDC_DATA_RS_COMMAND (1 << 30) - -/************************************************************************* - * LCDC (LCD Controller) - *************************************************************************/ - -#define LCDC_CFG (LCDC0_BASE + 0x00) -#define LCDC_CTRL (LCDC0_BASE + 0x30) -#define LCDC_STATE (LCDC0_BASE + 0x34) -#define LCDC_OSDC (LCDC0_BASE + 0x100) -#define LCDC_OSDCTRL (LCDC0_BASE + 0x104) -#define LCDC_OSDS (LCDC0_BASE + 0x108) -#define LCDC_BGC0 (LCDC0_BASE + 0x10C) -#define LCDC_BGC1 (LCDC0_BASE + 0x2C4) -#define LCDC_KEY0 (LCDC0_BASE + 0x110) -#define LCDC_KEY1 (LCDC0_BASE + 0x114) -#define LCDC_ALPHA (LCDC0_BASE + 0x118) -#define LCDC_RGBC (LCDC0_BASE + 0x90) -#define LCDC_VAT (LCDC0_BASE + 0x0c) -#define LCDC_DAH (LCDC0_BASE + 0x10) -#define LCDC_DAV (LCDC0_BASE + 0x14) -#define LCDC_XYP0 (LCDC0_BASE + 0x120) -#define LCDC_XYP1 (LCDC0_BASE + 0x124) -#define LCDC_SIZE0 (LCDC0_BASE + 0x128) -#define LCDC_SIZE1 (LCDC0_BASE + 0x12C) -#define LCDC_VSYNC (LCDC0_BASE + 0x04) -#define LCDC_HSYNC (LCDC0_BASE + 0x08) -#define LCDC_PS (LCDC0_BASE + 0x18) -#define LCDC_CLS (LCDC0_BASE + 0x1c) -#define LCDC_SPL (LCDC0_BASE + 0x20) -#define LCDC_REV (LCDC0_BASE + 0x24) -#define LCDC_IID (LCDC0_BASE + 0x38) -#define LCDC_DA0 (LCDC0_BASE + 0x40) -#define LCDC_SA0 (LCDC0_BASE + 0x44) -#define LCDC_FID0 (LCDC0_BASE + 0x48) -#define LCDC_CMD0 (LCDC0_BASE + 0x4c) -#define LCDC_DA1 (LCDC0_BASE + 0x50) -#define LCDC_SA1 (LCDC0_BASE + 0x54) -#define LCDC_FID1 (LCDC0_BASE + 0x58) -#define LCDC_CMD1 (LCDC0_BASE + 0x5c) -#define LCDC_OFFS0 (LCDC0_BASE + 0x60) -#define LCDC_PW0 (LCDC0_BASE + 0x64) -#define LCDC_CNUM0 (LCDC0_BASE + 0x68) -#define LCDC_DESSIZE0 (LCDC0_BASE + 0x6C) -#define LCDC_OFFS1 (LCDC0_BASE + 0x70) -#define LCDC_PW1 (LCDC0_BASE + 0x74) -#define LCDC_CNUM1 (LCDC0_BASE + 0x78) -#define LCDC_DESSIZE1 (LCDC0_BASE + 0x7C) -#define LCDC_PCFG (LCDC0_BASE + 0x2C0) -#define LCDC_CPOS1 (0x78) -#define LCDC_DUAL_CTRL (0x2c8) -#define LCDC_ENH_CFG (0x400) -#define LCDC_ENH_CSCCFG (0x404) -#define LCDC_ENH_LUMACFG (0x408) -#define LCDC_ENH_CHROCFG0 (0x40c) -#define LCDC_ENH_CHROCFG1 (0x410) -#define LCDC_ENH_DITHERCFG (0x414) -#define LCDC_ENH_STATUS (0x418) -#define LCDC_ENH_GAMMA (0x800) -#define LCDC_ENH_VEE (0x1000) - -/* LCD Configure Register */ -#define LCDC_CFG_LCDPIN_BIT 31 -#define LCDC_CFG_LCDPIN_MASK (0x1 << LCDC_CFG_LCDPIN_BIT) -#define LCDC_CFG_LCDPIN_LCD (0x0 << LCDC_CFG_LCDPIN_BIT) -#define LCDC_CFG_LCDPIN_SLCD (0x1 << LCDC_CFG_LCDPIN_BIT) -#define LCDC_CFG_TVEPEH (1 << 30) -#define LCDC_CFG_NEWDES (1 << 28) -#define LCDC_CFG_PALBP (1 << 27) -#define LCDC_CFG_TVEN (1 << 26) -#define LCDC_CFG_RECOVER (1 << 25) -#define LCDC_CFG_PSM (1 << 23) -#define LCDC_CFG_CLSM (1 << 22) -#define LCDC_CFG_SPLM (1 << 21) -#define LCDC_CFG_REVM (1 << 20) -#define LCDC_CFG_HSYNM (1 << 19) -#define LCDC_CFG_PCLKM (1 << 18) -#define LCDC_CFG_INVDAT (1 << 17) -#define LCDC_CFG_SYNDIR_IN (1 << 16) -#define LCDC_CFG_PSP (1 << 15) -#define LCDC_CFG_CLSP (1 << 14) -#define LCDC_CFG_SPLP (1 << 13) -#define LCDC_CFG_REVP (1 << 12) -#define LCDC_CFG_HSP (1 << 11) -#define LCDC_CFG_PCP (1 << 10) -#define LCDC_CFG_DEP (1 << 9) -#define LCDC_CFG_VSP (1 << 8) -#define LCDC_CFG_MODE_TFT_18BIT (1 << 7) -#define LCDC_CFG_MODE_TFT_16BIT (0 << 7) -#define LCDC_CFG_MODE_TFT_24BIT (1 << 6) -#define LCDC_CFG_MODE_BIT 0 -#define LCDC_CFG_MODE_MASK (0x0f << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_GENERIC_TFT (0 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_SPECIAL_TFT_1 (1 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_SPECIAL_TFT_2 (2 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_SPECIAL_TFT_3 (3 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_NONINTER_CCIR656 (4 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_INTER_CCIR656 (6 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_SERIAL_TFT (12 << LCDC_CFG_MODE_BIT) -#define LCDC_CFG_MODE_LCM (13 << LCDC_CFG_MODE_BIT) -/* LCD Control Register */ -#define LCDC_CTRL_PINMD (1 << 31) -#define LCDC_CTRL_BST_BIT 28 -#define LCDC_CTRL_BST_MASK (0x7 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_BST_4 (0 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_BST_8 (1 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_BST_16 (2 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_BST_32 (3 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_BST_64 (4 << LCDC_CTRL_BST_BIT) -#define LCDC_CTRL_RGB565 (0 << 27) -#define LCDC_CTRL_RGB555 (1 << 27) -#define LCDC_CTRL_OFUP (1 << 26) -#define LCDC_CTRL_PDD_BIT 16 -#define LCDC_CTRL_PDD_MASK (0xff << LCDC_CTRL_PDD_BIT) -#define LCDC_CTRL_DACTE (1 << 14) -#define LCDC_CTRL_EOFM (1 << 13) -#define LCDC_CTRL_SOFM (1 << 12) -#define LCDC_CTRL_OFUM (1 << 11) -#define LCDC_CTRL_IFUM0 (1 << 10) -#define LCDC_CTRL_IFUM1 (1 << 9) -#define LCDC_CTRL_LDDM (1 << 8) -#define LCDC_CTRL_QDM (1 << 7) -#define LCDC_CTRL_BEDN (1 << 6) -#define LCDC_CTRL_PEDN (1 << 5) -#define LCDC_CTRL_DIS (1 << 4) -#define LCDC_CTRL_ENA (1 << 3) -#define LCDC_CTRL_BPP_BIT 0 -#define LCDC_CTRL_BPP_MASK (0x07 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_1 (0 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_2 (1 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_4 (2 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_8 (3 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_16 (4 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_18_24 (5 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_CMPS_24 (6 << LCDC_CTRL_BPP_BIT) -#define LCDC_CTRL_BPP_30 (7 << LCDC_CTRL_BPP_BIT) -/* LCD Status Register */ -#define LCDC_STATE_QD (1 << 7) -#define LCDC_STATE_EOF (1 << 5) -#define LCDC_STATE_SOF (1 << 4) -#define LCDC_STATE_OFU (1 << 3) -#define LCDC_STATE_IFU0 (1 << 2) -#define LCDC_STATE_IFU1 (1 << 1) -#define LCDC_STATE_LDD (1 << 0) -/* OSD Configure Register */ -#define LCDC_OSDC_PREMULTI1 (1 << 23) -#define LCDC_OSDC_COEF_SLE1_BIT 21 -#define LCDC_OSDC_COEF_SLE1_MASK (0x03 << LCDC_OSDC_COEF_SLE1_BIT) -#define LCDC_OSDC_COEF_SLE1_0 (0 << LCDC_OSDC_COEF_SLE1_BIT) -#define LCDC_OSDC_COEF_SLE1_1 (1 << LCDC_OSDC_COEF_SLE1_BIT) -#define LCDC_OSDC_COEF_SLE1_2 (2 << LCDC_OSDC_COEF_SLE1_BIT) -#define LCDC_OSDC_COEF_SLE1_3 (3 << LCDC_OSDC_COEF_SLE1_BIT) -#define LCDC_OSDC_PREMULTI0 (1 << 20) -#define LCDC_OSDC_COEF_SLE0_BIT 18 -#define LCDC_OSDC_COEF_SLE0_MASK (0x03 << LCDC_OSDC_COEF_SLE0_BIT) -#define LCDC_OSDC_COEF_SLE0_0 (0 << LCDC_OSDC_COEF_SLE0_BIT) -#define LCDC_OSDC_COEF_SLE0_1 (1 << LCDC_OSDC_COEF_SLE0_BIT) -#define LCDC_OSDC_COEF_SLE0_2 (2 << LCDC_OSDC_COEF_SLE0_BIT) -#define LCDC_OSDC_COEF_SLE0_3 (3 << LCDC_OSDC_COEF_SLE0_BIT) -#define LCDC_OSDC_ALPHAMD1 (1 << 17) -#define LCDC_OSDC_SOFM1 (1 << 15) -#define LCDC_OSDC_EOFM1 (1 << 14) -#define LCDC_OSDC_SOFM0 (1 << 11) -#define LCDC_OSDC_EOFM0 (1 << 10) -#define LCDC_OSDC_DENDM (1 << 9) -#define LCDC_OSDC_F1EN (1 << 4) -#define LCDC_OSDC_F0EN (1 << 3) -#define LCDC_OSDC_ALPHAEN (1 << 2) -#define LCDC_OSDC_ALPHAMD0 (1 << 1) -#define LCDC_OSDC_OSDEN (1 << 0) -/* OSD Controll Register */ -#define LCDC_OSDCTRL_IPU_CLKEN (1 << 15) -#define LCDC_OSDCTRL_RGB0_RGB565 (0 << 5) -#define LCDC_OSDCTRL_RGB0_RGB555 (1 << 5) -#define LCDC_OSDCTRL_RGB1_RGB565 (0 << 4) -#define LCDC_OSDCTRL_RGB1_RGB555 (1 << 4) -#define LCDC_OSDCTRL_BPP_BIT 0 -#define LCDC_OSDCTRL_BPP_MASK (0x7< - -#define CACHE_SIZE 16*1024 -#define CACHE_LINE_SIZE 32 -#define KSEG0 0x80000000 - -#define K0_TO_K1() \ -do { \ - unsigned long __k0_addr; \ - \ - __asm__ __volatile__( \ - "la %0, 1f\n\t" \ - "or %0, %0, %1\n\t" \ - "jr %0\n\t" \ - "nop\n\t" \ - "1: nop\n" \ - : "=&r"(__k0_addr) \ - : "r" (0x20000000) ); \ -} while(0) - -#define K1_TO_K0() \ -do { \ - unsigned long __k0_addr; \ - __asm__ __volatile__( \ - "nop;nop;nop;nop;nop;nop;nop\n\t" \ - "la %0, 1f\n\t" \ - "jr %0\n\t" \ - "nop\n\t" \ - "1: nop\n" \ - : "=&r" (__k0_addr)); \ -} while (0) - -#define INVALIDATE_BTB() \ -do { \ - unsigned long tmp; \ - __asm__ __volatile__( \ - ".set mips32\n\t" \ - "mfc0 %0, $16, 7\n\t" \ - "nop\n\t" \ - "ori %0, 2\n\t" \ - "mtc0 %0, $16, 7\n\t" \ - "nop\n\t" \ - ".set mips2\n\t" \ - : "=&r" (tmp)); \ -} while (0) - -#define SYNC_WB() __asm__ __volatile__ ("sync") - -#define cache_op(op,addr) \ - __asm__ __volatile__( \ - " .set noreorder \n" \ - " .set mips32\n\t \n" \ - " cache %0, %1 \n" \ - " .set mips0 \n" \ - " .set reorder" \ - : \ - : "i" (op), "m" (*(unsigned char *)(addr))) - -void __icache_invalidate_all(void) -{ - unsigned int i; - - K0_TO_K1(); - - asm volatile (".set noreorder\n" - ".set mips32\n\t" - "mtc0\t$0,$28\n\t" - "mtc0\t$0,$29\n" - ".set mips0\n" - ".set reorder\n"); - for (i=KSEG0;i from - * a1 --> to - */ - .globl rt_hw_context_switch -rt_hw_context_switch: - mtc0 ra, CP0_EPC - SAVE_ALL - - sw sp, 0(a0) /* store sp in preempted tasks TCB */ - lw sp, 0(a1) /* get new task stack pointer */ - - RESTORE_ALL_AND_RET - -/* - * void rt_hw_context_switch_to(rt_uint32 to)/* - * a0 --> to - */ - .globl rt_hw_context_switch_to -rt_hw_context_switch_to: - lw sp, 0(a0) /* get new task stack pointer */ - - RESTORE_ALL_AND_RET - -/* - * void rt_hw_context_switch_interrupt(rt_uint32 from, rt_uint32 to)/* - */ - .globl rt_thread_switch_interrupt_flag - .globl rt_interrupt_from_thread - .globl rt_interrupt_to_thread - .globl rt_hw_context_switch_interrupt -rt_hw_context_switch_interrupt: - la t0, rt_thread_switch_interrupt_flag - lw t1, 0(t0) - nop - bnez t1, _reswitch - nop - li t1, 0x01 /* set rt_thread_switch_interrupt_flag to 1 */ - sw t1, 0(t0) - la t0, rt_interrupt_from_thread /* set rt_interrupt_from_thread */ - sw a0, 0(t0) -_reswitch: - la t0, rt_interrupt_to_thread /* set rt_interrupt_to_thread */ - sw a1, 0(t0) - jr ra - nop - - .globl system_dump - -/* - * void rt_hw_context_switch_interrupt_do(rt_base_t flag) - */ - .globl rt_interrupt_enter - .globl rt_interrupt_leave - .globl mips_irq_handle -mips_irq_handle: - SAVE_ALL - - mfc0 t0, CP0_CAUSE - mfc0 t1, CP0_STATUS - and t0, t1 - - andi t0, 0xff00 - beqz t0, spurious_interrupt - nop - - /* let k0 keep the current context sp */ - move k0, sp - /* switch to kernel stack */ - li sp, SYSTEM_STACK - - jal rt_interrupt_enter - nop - jal rt_interrupt_dispatch - nop - jal rt_interrupt_leave - nop - - /* switch sp back to thread's context */ - move sp, k0 - - /* - * if rt_thread_switch_interrupt_flag set, jump to - * rt_hw_context_switch_interrupt_do and don't return - */ - la k0, rt_thread_switch_interrupt_flag - lw k1, 0(k0) - beqz k1, spurious_interrupt - nop - sw zero, 0(k0) /* clear flag */ - nop - - /* - * switch to the new thread - */ - la k0, rt_interrupt_from_thread - lw k1, 0(k0) - nop - sw sp, 0(k1) /* store sp in preempted tasks's TCB */ - - la k0, rt_interrupt_to_thread - lw k1, 0(k0) - nop - lw sp, 0(k1) /* get new task's stack pointer */ - j spurious_interrupt - nop - -spurious_interrupt: - RESTORE_ALL_AND_RET - - .set reorder diff --git a/libcpu/mips/xburst/cpu.c b/libcpu/mips/xburst/cpu.c deleted file mode 100644 index 88137535d..000000000 --- a/libcpu/mips/xburst/cpu.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * File : cpu.c - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2010-07-09 Bernard first version - * 2010-09-11 Bernard add CPU reset implementation - */ -#include -#include - -/** - * @addtogroup Ingenic - */ -/*@{*/ - -/** - * this function will reset CPU - * - */ -void rt_hw_cpu_reset() -{ - /* open the watch-dog */ - REG_WDT_TCSR = WDT_TCSR_EXT_EN; - REG_WDT_TCSR |= WDT_TCSR_PRESCALE_1024; - REG_WDT_TDR = 0x03; - REG_WDT_TCNT = 0x00; - REG_WDT_TCER |= WDT_TCER_TCEN; - - rt_kprintf("reboot system...\n"); - while (1); -} - -/** - * this function will shutdown CPU - * - */ -void rt_hw_cpu_shutdown() -{ - rt_kprintf("shutdown...\n"); - - while (1); -} - -/** - * This function finds the first bit set (beginning with the least significant bit) - * in value and return the index of that bit. - * - * Bits are numbered starting at 1 (the least significant bit). A return value of - * zero from any of these functions means that the argument was zero. - * - * @return return the index of the first bit set. If value is 0, then this function - * shall return 0. - */ -int __rt_ffs(int value) -{ - return __builtin_ffs(value); -} - -/*@}*/ diff --git a/libcpu/mips/xburst/exception.c b/libcpu/mips/xburst/exception.c deleted file mode 100644 index aebdf704e..000000000 --- a/libcpu/mips/xburst/exception.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * File : exception.c - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2010-05-17 swkyer first version - */ -#include -#include -#include "../common/exception.h" -#include "../common/mipsregs.h" - -/** - * @addtogroup Ingenic - */ -/*@{*/ - -/** - * exception handle table - */ -exception_func_t sys_exception_handlers[33]; - -/** - * setup the exception handle - */ -exception_func_t rt_set_except_vector(int n, exception_func_t func) -{ - exception_func_t old_handler = sys_exception_handlers[n]; - - if ((n == 0) || (n > 32) || (!func)) - { - return 0; - } - - sys_exception_handlers[n] = func; - - return old_handler; -} - -void tlb_refill_handler(void) -{ - rt_kprintf("tlb-miss happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); -} - -void cache_error_handler(void) -{ - rt_kprintf("cache exception happens, epc: 0x%08x\n", read_c0_epc()); - rt_hw_cpu_shutdown(); -} - -static void unhandled_exception_handle(pt_regs_t *regs) -{ - rt_kprintf("exception happens, epc: 0x%08x\n", regs->cp0_epc); -} - -void install_default_execpt_handle(void) -{ - rt_int32_t i; - - for (i=0; i<33; i++) - sys_exception_handlers[i] = (exception_func_t)unhandled_exception_handle; -} - -/*@}*/ - diff --git a/libcpu/mips/xburst/interrupt.c b/libcpu/mips/xburst/interrupt.c deleted file mode 100644 index 337646c73..000000000 --- a/libcpu/mips/xburst/interrupt.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * File : interrupt.c - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * 2010-07-09 Bernard first version - * 2013-03-29 aozima Modify the interrupt interface implementations. - */ - -#include -#include -#include - -#if defined(RT_USING_JZ4770) || defined(RT_USING_JZ4775) || defined(RT_USING_JZ_M150) || defined(RT_USING_JZ_X1000) -#define INTERRUPTS_MAX 64 -#else -#define INTERRUPTS_MAX 32 -#endif - -extern rt_uint32_t rt_interrupt_nest; -rt_uint32_t rt_interrupt_from_thread, rt_interrupt_to_thread; -rt_uint32_t rt_thread_switch_interrupt_flag; - -static struct rt_irq_desc isr_table[INTERRUPTS_MAX]; - -/** - * @addtogroup Ingenic - */ -/*@{*/ - -static void rt_hw_interrupt_handler(int vector, void *param) -{ - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); -} - -/** - * This function will initialize hardware interrupt - */ -void rt_hw_interrupt_init(void) -{ - rt_int32_t idx; - - rt_memset(isr_table, 0x00, sizeof(isr_table)); - for (idx = 0; idx < INTERRUPTS_MAX; idx ++) - { - isr_table[idx].handler = rt_hw_interrupt_handler; - } - - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; -} - -/** - * This function will mask a interrupt. - * @param vector the interrupt number - */ -void rt_hw_interrupt_mask(int vector) -{ - /* mask interrupt */ - __intc_mask_irq(vector); -} - -/** - * This function will un-mask a interrupt. - * @param vector the interrupt number - */ -void rt_hw_interrupt_umask(int vector) -{ - __intc_unmask_irq(vector); -} - -/** - * This function will install a interrupt service routine to a interrupt. - * @param vector the interrupt number - * @param handler the interrupt service routine to be installed - * @param param the interrupt service function parameter - * @param name the interrupt name - * @return old handler - */ -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, - void *param, const char *name) -{ - rt_isr_handler_t old_handler = RT_NULL; - - if(vector < INTERRUPTS_MAX) - { - old_handler = isr_table[vector].handler; - -#ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); -#endif /* RT_USING_INTERRUPT_INFO */ - isr_table[vector].handler = handler; - isr_table[vector].param = param; - } - - return old_handler; -} - -#if defined(RT_USING_JZ4770) || defined(RT_USING_JZ4775) || defined(RT_USING_JZ_M150) || defined(RT_USING_JZ_X1000) -/* - * fls - find last bit set. - * @word: The word to search - * - * This is defined the same way as ffs. - * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. - */ -rt_inline int fls(int x) -{ - __asm__("clz %0, %1" : "=r" (x) : "r" (x)); - - return 32 - x; -} -#endif - -#include - -void rt_interrupt_dispatch(void *ptreg) -{ - int i; - void *param; - rt_isr_handler_t irq_func; - -#if defined(RT_USING_JZ4770) || defined(RT_USING_JZ4775) || defined(RT_USING_JZ_M150) || defined(RT_USING_JZ_X1000) - int irq = 0, group; - rt_uint32_t intc_ipr0 = 0, intc_ipr1 = 0, vpu_pending = 0; - - rt_uint32_t c0_status, c0_cause; - rt_uint32_t pending_im; - - /* check os timer */ - c0_status = read_c0_status(); - c0_cause = read_c0_cause(); - - pending_im = (c0_cause & ST0_IM) & (c0_status & ST0_IM); - - if (pending_im & CAUSEF_IP3) - { - extern void rt_hw_ost_handler(void); - rt_hw_ost_handler(); - return; - } - - if (pending_im & CAUSEF_IP2) - { - intc_ipr0 = REG_INTC_IPR(0); - intc_ipr1 = REG_INTC_IPR(1); - - if (intc_ipr0) - { - irq = fls(intc_ipr0) - 1; - intc_ipr0 &= ~(1<= INTERRUPTS_MAX) - rt_kprintf("max interrupt, irq=%d\n", irq); - - /* do interrupt */ - irq_func = isr_table[irq].handler; - param = isr_table[irq].param; - (*irq_func)(irq, param); - -#ifdef RT_USING_INTERRUPT_INFO - isr_table[i].counter++; -#endif /* RT_USING_INTERRUPT_INFO */ - - /* ack interrupt */ - __intc_ack_irq(irq); - } - - if (pending_im & CAUSEF_IP0) - rt_kprintf("CAUSEF_IP0\n"); - if (pending_im & CAUSEF_IP1) - rt_kprintf("CAUSEF_IP1\n"); - if (pending_im & CAUSEF_IP4) - rt_kprintf("CAUSEF_IP4\n"); - if (pending_im & CAUSEF_IP5) - rt_kprintf("CAUSEF_IP5\n"); - if (pending_im & CAUSEF_IP6) - rt_kprintf("CAUSEF_IP6\n"); - if (pending_im & CAUSEF_IP7) - rt_kprintf("CAUSEF_IP7\n"); -#else - static rt_uint32_t pending = 0; - - /* the hardware interrupt */ - pending |= REG_INTC_IPR; - if (!pending) return; - - for (i = INTERRUPTS_MAX; i > 0; --i) - { - if ((pending & (1< -#include "../common/mipsregs.h" -#include "../common/mipscfg.h" - -mips32_core_cfg_t g_mips_core = -{ - 16, /* icache_line_size */ - 256, /* icache_lines_per_way */ - 4, /* icache_ways */ - 16, /* dcache_line_size */ - 256, /* dcache_lines_per_way */ - 4, /* dcache_ways */ - 16, /* max_tlb_entries */ -}; - -static rt_uint16_t m_pow(rt_uint16_t b, rt_uint16_t n) -{ - rt_uint16_t rets = 1; - - while (n--) - rets *= b; - - return rets; -} - -/** - * read core attribute - */ -void mips32_cfg_init(void) -{ - rt_uint16_t val; - rt_uint32_t cp0_config1; - - cp0_config1 = read_c0_config(); - if (cp0_config1 & 0x80000000) - { - cp0_config1 = read_c0_config1(); - - val = (cp0_config1 & (7<<22))>>22; - g_mips_core.icache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<19))>>19; - g_mips_core.icache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<16))>>16; - g_mips_core.icache_ways = val + 1; - - val = (cp0_config1 & (7<<13))>>13; - g_mips_core.dcache_lines_per_way = 64 * m_pow(2, val); - val = (cp0_config1 & (7<<10))>>10; - g_mips_core.dcache_line_size = 2 * m_pow(2, val); - val = (cp0_config1 & (7<<7))>>7; - g_mips_core.dcache_ways = val + 1; - - val = (cp0_config1 & (0x3F<<25))>>25; - g_mips_core.max_tlb_entries = val + 1; - } -} - -#ifdef RT_USING_FINSH -#include -static void CP0_status_analyze(unsigned long value) -{ - if(value & (1<<26)) - rt_kprintf(" FR"); - if(value & (1<<23)) - rt_kprintf(" PX"); - if(value & (1<<22)) - rt_kprintf(" BEV"); - if(value & (1<<20)) - rt_kprintf(" SR"); - if(value & (1<<19)) - rt_kprintf(" NMI"); - if(value & (1<<20)) - rt_kprintf(" SR"); - if(value & (0xFF<<8)) - rt_kprintf(" IM:0x%02X", (value >> 8) & 0xFF); - if(value & (1<<7)) - rt_kprintf(" KX"); - if(value & (1<<6)) - rt_kprintf(" SX"); - if(value & (1<<5)) - rt_kprintf(" UX"); - if(value & (0x03<<3)) - rt_kprintf(" KSU:0x%02X", (value >> 3) & 0x03); - if(value & (1<<2)) - rt_kprintf(" ERL"); - if(value & (1<<1)) - rt_kprintf(" EXL"); - if(value & (1<<0)) - rt_kprintf(" IE"); -} - -static void CP0_config0_analyze(unsigned long value) -{ - /* [31] M */ - if(value & (1UL<<31)) - rt_kprintf(" M"); - - /* [15] BE */ - if(value & (1<<15)) - rt_kprintf(" big-endian"); - else - rt_kprintf(" little-endian"); - - /* [14:13] AT */ - { - int AT = (value >> 13) & 0x03; - - if(AT == 0) - { - rt_kprintf(" MIPS32"); - } - else if(AT == 1) - { - rt_kprintf(" MIPS64/A32"); - } - else if(AT == 2) - { - rt_kprintf(" MIPS64/A64"); - } - else - { - rt_kprintf(" unkown"); - } - } - - /* [12:10] AR */ - { - int AR = (value >> 10) & 0x07; - - if(AR == 0) - { - rt_kprintf(" R1"); - } - else if(AR == 1) - { - rt_kprintf(" R2"); - } - else - { - rt_kprintf(" reserve"); - } - } - - /* [3] VI */ - if(value & (1UL<<31)) - rt_kprintf(" VI"); - - /* [2:0] K0 */ - { - int K0 = value & 0x07; - - if(K0 == 2) - { - rt_kprintf(" uncached"); - } - else if(K0 == 3) - { - rt_kprintf(" cacheable"); - } - else - { - rt_kprintf(" K0:reserve"); - } - } -} - -static void CP0_config1_analyze(unsigned long value) -{ - /* [31] M */ - if(value & (1UL<<31)) - rt_kprintf(" M"); - - /* [30:25] MMU size */ - { - int MMU_size = (value >> 25) & 0x3F; - rt_kprintf(" TLB:%d", MMU_size + 1); - } - - /* [24:22] IS, [21:19] IL, [18:16] IA */ - { - int IS = (value >> 22) & 0x07; - int IL = (value >> 19) & 0x07; - int IA = (value >> 16) & 0x07; - - IA = IA + 1; - IS = 64 << IS; - IL = 2 << IL; - rt_kprintf(" Icache-%dKB:%dway*%dset*%dbyte", - (IA*IS*IL) >> 10, IA, IS, IL); - } - - /* [15:13] DS, [12:10] DL, [9:7] DA */ - { - int DS = (value >> 13) & 0x07; - int DL = (value >> 10) & 0x07; - int DA = (value >> 7) & 0x07; - - DA = DA + 1; - DS = 64 << DS; - DL = 2 << DL; - rt_kprintf(" Dcache-%dKB:%dway*%dset*%dbyte", - (DA*DS*DL) >> 10, DA, DS, DL); - } - - /* [6] C2 */ - if(value & (1UL<<6)) - rt_kprintf(" CP2"); - - /* [5] MD */ - if(value & (1UL<<5)) - rt_kprintf(" MDMX-ASE"); - - /* [4] PC */ - if(value & (1UL<<4)) - rt_kprintf(" performa-count"); - - /* [3] WR */ - if(value & (1UL<<3)) - rt_kprintf(" Watch"); - - /* [2] CA */ - if(value & (1UL<<2)) - rt_kprintf(" MIPS16e"); - - /* [1] EP */ - if(value & (1UL<<1)) - rt_kprintf(" EJTAG"); - - /* [0] FP */ - if(value & (1UL<<0)) - rt_kprintf(" FPU"); -} - -static void CP0_config2_analyze(unsigned long value) -{ - /* [31] M */ - if(value & (1UL<<31)) - rt_kprintf(" M"); -} - -static void CP0_config3_analyze(unsigned long value) -{ - /* [31] M */ - if(value & (1UL<<31)) - rt_kprintf(" M"); -} - -static void list_mips(void) -{ - unsigned long value; - unsigned long num = 0; - - rt_kprintf("MIPS coprocessor register:\r\n"); - - rt_kprintf("( 0,0) INDEX : 0x%08X\r\n", read_c0_index()); - rt_kprintf("( 1,0) RANDOM : 0x%08X\r\n", read_c0_random()); - rt_kprintf("( 2,0) ENTRYLO0 : 0x%08X\r\n", read_c0_entrylo0()); - rt_kprintf("( 3,0) ENTRYLO1 : 0x%08X\r\n", read_c0_entrylo1()); - rt_kprintf("( 4,0) CONTEXT : 0x%08X\r\n", read_c0_context()); - rt_kprintf("( 5,0) PAGEMASK : 0x%08X\r\n", read_c0_pagemask()); - rt_kprintf("( 6,0) WIRED : 0x%08X\r\n", read_c0_wired()); - rt_kprintf("( 7,0) INFO : 0x%08X\r\n", read_c0_info()); - rt_kprintf("( 8,0) BADVADDR : 0x%08X\r\n", read_c0_badvaddr()); - rt_kprintf("( 9,0) COUNT : 0x%08X\r\n", read_c0_count()); - rt_kprintf("(10,0) ENTRYHI : 0x%08X\r\n", read_c0_entryhi()); - rt_kprintf("(11,0) COMPARE : 0x%08X\r\n", read_c0_compare()); - - value = read_c0_status(); - rt_kprintf("(12,0) STATUS : 0x%08X", value); - CP0_status_analyze(value); - rt_kprintf("\r\n"); - - /* - rt_kprintf("(12,1) INTCTL : 0x%08X\r\n", __read_32bit_c0_register(12, 1)); - rt_kprintf("(12,2) SRSCTL : 0x%08X\r\n", __read_32bit_c0_register(12, 2)); - */ - - rt_kprintf("(13,0) CAUSE : 0x%08X\r\n", read_c0_cause()); - rt_kprintf("(14,0) EPC : 0x%08X\r\n", read_c0_epc()); - rt_kprintf("(15,0) PRID : 0x%08X\r\n", read_c0_prid()); - rt_kprintf("(15,1) EBASE : 0x%08X\r\n", read_c0_ebase()); - - value = read_c0_config(); - rt_kprintf("(16,0) CONFIG : 0x%08X", value); - CP0_config0_analyze(value); - rt_kprintf("\r\n"); - if(value & (1UL << 31)) - { - value = read_c0_config1(); - rt_kprintf("(16,1) CONFIG1 : 0x%08X", value); - CP0_config1_analyze(value); - rt_kprintf("\r\n"); - - if(value & (1UL << 31)) - { - value = read_c0_config2(); - rt_kprintf("(16,2) CONFIG2 : 0x%08X\r\n", value); - CP0_config2_analyze(value); - rt_kprintf("\r\n"); - - if(value & (1UL << 31)) - { - value = read_c0_config3(); - rt_kprintf("(16,3) CONFIG3 : 0x%08X\r\n", value); - CP0_config3_analyze(value); - rt_kprintf("\r\n"); - } - } - } - - rt_kprintf("(17,0) LLADDR : 0x%08X\r\n", __read_32bit_c0_register($17, 0)); - rt_kprintf("(18,0) WATCHLO : 0x%08X\r\n", __read_32bit_c0_register($18, 0)); - rt_kprintf("(19,0) WATCHHI : 0x%08X\r\n", __read_32bit_c0_register($19, 0)); - rt_kprintf("(20,0) XCONTEXT : 0x%08X\r\n", __read_32bit_c0_register($20, 0)); - rt_kprintf("(21,0) FRAMEMASK : 0x%08X\r\n", __read_32bit_c0_register($21, 0)); - rt_kprintf("(22,0) DIAGNOSTIC: 0x%08X\r\n", __read_32bit_c0_register($22, 0)); - rt_kprintf("(23,0) DEBUG : 0x%08X\r\n", __read_32bit_c0_register($23, 0)); - rt_kprintf("(24,0) DEPC : 0x%08X\r\n", __read_32bit_c0_register($24, 0)); - - rt_kprintf("(25,0) PERFCTL0 : 0x%08X\r\n", __read_32bit_c0_register($25, 0)); - rt_kprintf("(26,0) ECC : 0x%08X\r\n", __read_32bit_c0_register($26, 0)); - rt_kprintf("(27,0) CACHEERR : 0x%08X\r\n", __read_32bit_c0_register($27, 0)); - rt_kprintf("(28,0) TAGLO : 0x%08X\r\n", __read_32bit_c0_register($28, 0)); - rt_kprintf("(29,0) TAGHI : 0x%08X\r\n", __read_32bit_c0_register($29, 0)); - - /* - rt_kprintf("(30,0) ERROREPC : 0x%08X\r\n", __read_32bit_c0_register($30, 0)); - rt_kprintf("(31,0) DESAVE : 0x%08X\r\n", __read_32bit_c0_register($31, 0)); - */ - - - rt_kprintf("\r\n"); -} -FINSH_FUNCTION_EXPORT(list_mips, list CPU info) -#endif /* RT_USING_FINSH */ - diff --git a/libcpu/mips/xburst/stack.c b/libcpu/mips/xburst/stack.c deleted file mode 100644 index ceba8b9d9..000000000 --- a/libcpu/mips/xburst/stack.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * File : stack.c - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2010-05-17 swkyer first version - * 2010-07-07 Bernard porting to Ingenic CPU - */ -#include - -/** - * @addtogroup Ingenic - */ -/*@{*/ - -extern rt_uint32_t cp0_get_cause(void); -extern rt_uint32_t cp0_get_status(void); -extern rt_uint32_t cp0_get_hi(void); -extern rt_uint32_t cp0_get_lo(void); - -/** - * This function will initialize thread stack - * - * @param tentry the entry of thread - * @param parameter the parameter of entry - * @param stack_addr the beginning stack address - * @param texit the function will be called when thread exit - * - * @return stack address - */ -rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) -{ - rt_uint32_t *stk; - static rt_uint32_t g_sr = 0; - - if (g_sr == 0) - { - g_sr = cp0_get_status(); - g_sr &= 0xfffffffe; - g_sr |= 0x0403; - } - - /** Start at stack top */ - stk = (rt_uint32_t *)stack_addr; - *(stk) = (rt_uint32_t) tentry; /* pc: Entry Point */ - *(--stk) = (rt_uint32_t) 0xeeee; /* c0_cause */ - *(--stk) = (rt_uint32_t) 0xffff; /* c0_badvaddr */ - *(--stk) = (rt_uint32_t) cp0_get_lo(); /* lo */ - *(--stk) = (rt_uint32_t) cp0_get_hi(); /* hi */ - *(--stk) = (rt_uint32_t) g_sr; /* C0_SR: HW2 = En, IE = En */ - *(--stk) = (rt_uint32_t) texit; /* ra */ - *(--stk) = (rt_uint32_t) 0x0000001e; /* s8 */ - *(--stk) = (rt_uint32_t) stack_addr; /* sp */ - *(--stk) = (rt_uint32_t) 0x0000001c; /* gp */ - *(--stk) = (rt_uint32_t) 0x0000001b; /* k1 */ - *(--stk) = (rt_uint32_t) 0x0000001a; /* k0 */ - *(--stk) = (rt_uint32_t) 0x00000019; /* t9 */ - *(--stk) = (rt_uint32_t) 0x00000018; /* t8 */ - *(--stk) = (rt_uint32_t) 0x00000017; /* s7 */ - *(--stk) = (rt_uint32_t) 0x00000016; /* s6 */ - *(--stk) = (rt_uint32_t) 0x00000015; /* s5 */ - *(--stk) = (rt_uint32_t) 0x00000014; /* s4 */ - *(--stk) = (rt_uint32_t) 0x00000013; /* s3 */ - *(--stk) = (rt_uint32_t) 0x00000012; /* s2 */ - *(--stk) = (rt_uint32_t) 0x00000011; /* s1 */ - *(--stk) = (rt_uint32_t) 0x00000010; /* s0 */ - *(--stk) = (rt_uint32_t) 0x0000000f; /* t7 */ - *(--stk) = (rt_uint32_t) 0x0000000e; /* t6 */ - *(--stk) = (rt_uint32_t) 0x0000000d; /* t5 */ - *(--stk) = (rt_uint32_t) 0x0000000c; /* t4 */ - *(--stk) = (rt_uint32_t) 0x0000000b; /* t3 */ - *(--stk) = (rt_uint32_t) 0x0000000a; /* t2 */ - *(--stk) = (rt_uint32_t) 0x00000009; /* t1 */ - *(--stk) = (rt_uint32_t) 0x00000008; /* t0 */ - *(--stk) = (rt_uint32_t) 0x00000007; /* a3 */ - *(--stk) = (rt_uint32_t) 0x00000006; /* a2 */ - *(--stk) = (rt_uint32_t) 0x00000005; /* a1 */ - *(--stk) = (rt_uint32_t) parameter; /* a0 */ - *(--stk) = (rt_uint32_t) 0x00000003; /* v1 */ - *(--stk) = (rt_uint32_t) 0x00000002; /* v0 */ - *(--stk) = (rt_uint32_t) 0x00000001; /* at */ - *(--stk) = (rt_uint32_t) 0x00000000; /* zero */ - - /* return task's current stack address */ - return (rt_uint8_t *)stk; -} - -/*@}*/ diff --git a/libcpu/mips/xburst/stack.h b/libcpu/mips/xburst/stack.h deleted file mode 100644 index 5bb7206c1..000000000 --- a/libcpu/mips/xburst/stack.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * File : stack.h - * COPYRIGHT (C) 2008 - 2016, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes -*/ - -#ifndef __STACK_H__ -#define __STACK_H__ - -#define SYSTEM_STACK 0x80003fe8 /* the kernel system stack address */ - -#endif diff --git a/libcpu/mips/xburst/start_gcc.S b/libcpu/mips/xburst/start_gcc.S deleted file mode 100644 index 322c2beae..000000000 --- a/libcpu/mips/xburst/start_gcc.S +++ /dev/null @@ -1,150 +0,0 @@ -/* - * File : start_gcc.S - * Change Logs: - * Date Author Notes - * 2010-05-17 swkyer first version - * 2010-09-04 bernard porting to Jz47xx - */ - -#include "../common/mips.inc" -#include "../common/stackframe.h" -#include "stack.h" - - .section ".start", "ax" - .set noreorder - - /* the program entry */ - .globl _start -_start: - .set noreorder - la ra, _start - - li t1, 0x00800000 - mtc0 t1, CP0_CAUSE - - /* init cp0 registers. */ - li t0, 0x0000FC00 /* BEV = 0 and mask all interrupt */ - mtc0 t0, CP0_STATUS - - /* setup stack pointer */ - li sp, SYSTEM_STACK - la gp, _gp - - /* init caches, assumes a 4way * 128set * 32byte I/D cache */ - mtc0 zero, CP0_TAGLO /* TAGLO reg */ - mtc0 zero, CP0_TAGHI /* TAGHI reg */ - li t0, 3 /* enable cache for kseg0 accesses */ - mtc0 t0, CP0_CONFIG /* CONFIG reg */ - la t0, 0x80000000 /* an idx op should use an unmappable address */ - ori t1, t0, 0x4000 /* 16kB cache */ - -_cache_loop: - cache 0x8, 0(t0) /* index store icache tag */ - cache 0x9, 0(t0) /* index store dcache tag */ - bne t0, t1, _cache_loop - addiu t0, t0, 0x20 /* 32 bytes per cache line */ - nop - - /* invalidate BTB */ - mfc0 t0, CP0_CONFIG - nop - ori t0, 2 - mtc0 t0, CP0_CONFIG - nop - - /* copy IRAM section */ - la t0, _iramcopy - la t1, _iramstart - la t2, _iramend -_iram_loop: - lw t3, 0(t0) - sw t3, 0(t1) - addiu t1, 4 - bne t1, t2, _iram_loop - addiu t0, 4 - /* clear bss */ - la t0, __bss_start - la t1, __bss_end -_clr_bss_loop: - sw zero, 0(t0) - bne t0, t1, _clr_bss_loop - addiu t0, t0, 4 - - /* jump to RT-Thread RTOS */ - jal rtthread_startup - nop - - /* restart, never die */ - j _start - nop - .set reorder - - .globl cp0_get_cause -cp0_get_cause: - mfc0 v0, CP0_CAUSE - jr ra - nop - - .globl cp0_get_status -cp0_get_status: - mfc0 v0, CP0_STATUS - jr ra - nop - - .globl cp0_get_hi -cp0_get_hi: - mfhi v0 - jr ra - nop - - .globl cp0_get_lo -cp0_get_lo: - mflo v0 - jr ra - nop - - .extern tlb_refill_handler - .extern cache_error_handler - - /* Exception Handler */ - /* 0x0 - TLB refill handler */ - .section .vectors.1, "ax", %progbits - j tlb_refill_handler - nop - - /* 0x100 - Cache error handler */ - .section .vectors.2, "ax", %progbits - j cache_error_handler - nop - - /* 0x180 - Exception/Interrupt handler */ - .section .vectors.3, "ax", %progbits - j _general_exception_handler - nop - - /* 0x200 - Special Exception Interrupt handler (when IV is set in CP0_CAUSE) */ - .section .vectors.4, "ax", %progbits - j _irq_handler - nop - - .section .vectors, "ax", %progbits - .extern mips_irq_handle - - /* general exception handler */ -_general_exception_handler: - .set noreorder - mfc0 k1, CP0_CAUSE - andi k1, k1, 0x7c - srl k1, k1, 2 - lw k0, sys_exception_handlers(k1) - jr k0 - nop - .set reorder - - /* interrupt handler */ -_irq_handler: - .set noreorder - la k0, mips_irq_handle - jr k0 - nop - .set reorder diff --git a/libcpu/mips/xburst/x1000.h b/libcpu/mips/xburst/x1000.h deleted file mode 100644 index 71d11783a..000000000 --- a/libcpu/mips/xburst/x1000.h +++ /dev/null @@ -1,329 +0,0 @@ -/* - * File : x1000.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2008 - 2012, RT-Thread Development Team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Change Logs: - * Date Author Notes - * 2015-11-19 Urey the first version - */ - -#ifndef X1000_H__ -#define X1000_H__ - -#ifndef __ASSEMBLY__ - -// typedef unsigned int size_t; -#define u64 unsigned long long -#define u32 unsigned int -#define u16 unsigned short -#define u8 unsigned char - -#define U64 unsigned long long -#define U32 unsigned int -#define U16 unsigned short -#define U8 unsigned char - -#define S64 signed long long -#define S32 int -#define S16 short int -#define S8 signed char - -#define cache_unroll(base,op) \ - __asm__ __volatile__(" \ - .set noreorder; \ - .set mips3; \ - cache %1, (%0); \ - .set mips0; \ - .set reorder" \ - : \ - : "r" (base), \ - "i" (op)); - -/* cpu pipeline flush */ -static inline void jz_sync(void) -{ - __asm__ volatile ("sync"); -} - -static inline void writeb(u8 value, u32 address) -{ - *((volatile u8 *) address) = value; -} -static inline void writew( u16 value, u32 address) -{ - *((volatile u16 *) address) = value; -} -static inline void writel(u32 value, u32 address) -{ - *((volatile u32 *) address) = value; -} - -static inline u8 readb(u32 address) -{ - return *((volatile u8 *)address); -} - -static inline u16 readw(u32 address) -{ - return *((volatile u16 *)address); -} - -static inline u32 readl(u32 address) -{ - return *((volatile u32 *)address); -} - -static inline void jz_writeb(u32 address, u8 value) -{ - *((volatile u8 *)address) = value; -} - -static inline void jz_writew(u32 address, u16 value) -{ - *((volatile u16 *)address) = value; -} - -static inline void jz_writel(u32 address, u32 value) -{ - *((volatile u32 *)address) = value; -} - -static inline u8 jz_readb(u32 address) -{ - return *((volatile u8 *)address); -} - -static inline u16 jz_readw(u32 address) -{ - return *((volatile u16 *)address); -} - -static inline u32 jz_readl(u32 address) -{ - return *((volatile u32 *)address); -} - -#define REG8(addr) *((volatile u8 *)(addr)) -#define REG16(addr) *((volatile u16 *)(addr)) -#define REG32(addr) *((volatile u32 *)(addr)) - -#define BIT(n) (0x01u << (n)) - -#else - -#define REG8(addr) (addr) -#define REG16(addr) (addr) -#define REG32(addr) (addr) - -#endif /* !ASSEMBLY */ - - -//---------------------------------------------------------------------- -// Register Definitions -// -/* AHB0 BUS Devices Base */ -#define HARB0_BASE 0xB3000000 -#define EMC_BASE 0xB3010000 -#define DDRC_BASE 0xB3020000 -#define MDMAC_BASE 0xB3030000 -#define LCD_BASE 0xB3050000 -#define TVE_BASE 0xB3050000 -#define SLCD_BASE 0xB3050000 -#define CIM_BASE 0xB3060000 -#define IPU_BASE 0xB3080000 -/* AHB1 BUS Devices Base */ -#define HARB1_BASE 0xB3200000 -#define DMAGP0_BASE 0xB3210000 -#define DMAGP1_BASE 0xB3220000 -#define DMAGP2_BASE 0xB3230000 -#define MC_BASE 0xB3250000 -#define ME_BASE 0xB3260000 -#define DEBLK_BASE 0xB3270000 -#define IDCT_BASE 0xB3280000 -#define CABAC_BASE 0xB3290000 -#define TCSM0_BASE 0xB32B0000 -#define TCSM1_BASE 0xB32C0000 -#define SRAM_BASE 0xB32D0000 -/* AHB2 BUS Devices Base */ -#define HARB2_BASE 0xB3400000 -#define NEMC_BASE 0xB3410000 -#define DMAC_BASE 0xB3420000 -#define UHC_BASE 0xB3430000 -#define UDC_BASE 0xB3440000 -#define GPS_BASE 0xB3480000 -#define ETHC_BASE 0xB34B0000 -#define BCH_BASE 0xB34D0000 -#define MSC0_BASE 0xB3450000 -#define MSC1_BASE 0xB3460000 -#define MSC2_BASE 0xB3470000 - -/* APB BUS Devices Base */ -#define CPM_BASE 0xB0000000 -#define INTC_BASE 0xB0001000 -#define TCU_BASE 0xB0002000 -#define WDT_BASE 0xB0002000 -#define OST_BASE 0xB2000000 /* OS Timer */ -#define RTC_BASE 0xB0003000 -#define GPIO_BASE 0xB0010000 -#define AIC_BASE 0xB0020000 -#define DMIC_BASE 0xB0021000 -#define ICDC_BASE 0xB0020000 -#define UART0_BASE 0xB0030000 -#define UART1_BASE 0xB0031000 -#define UART2_BASE 0xB0032000 -#define UART3_BASE 0xB0033000 -#define SCC_BASE 0xB0040000 -#define SSI0_BASE 0xB0043000 -#define SSI1_BASE 0xB0044000 -#define SSI2_BASE 0xB0045000 -#define I2C0_BASE 0xB0050000 -#define I2C1_BASE 0xB0051000 -#define PS2_BASE 0xB0060000 -#define SADC_BASE 0xB0070000 -#define OWI_BASE 0xB0072000 -#define TSSI_BASE 0xB0073000 - -/* NAND CHIP Base Address*/ -#define NEMC_CS1_IOBASE 0Xbb000000 -#define NEMC_CS2_IOBASE 0Xba000000 -#define NEMC_CS3_IOBASE 0Xb9000000 -#define NEMC_CS4_IOBASE 0Xb8000000 -#define NEMC_CS5_IOBASE 0Xb7000000 -#define NEMC_CS6_IOBASE 0Xb6000000 - -/********************************************************************************************************* -** WDT -*********************************************************************************************************/ -#define WDT_TDR (WDT_BASE + 0x00) -#define WDT_TCER (WDT_BASE + 0x04) -#define WDT_TCNT (WDT_BASE + 0x08) -#define WDT_TCSR (WDT_BASE + 0x0C) - -#define REG_WDT_TDR REG16(WDT_TDR) -#define REG_WDT_TCER REG8(WDT_TCER) -#define REG_WDT_TCNT REG16(WDT_TCNT) -#define REG_WDT_TCSR REG16(WDT_TCSR) - -#define WDT_TSCR_WDTSC (1 << 16) - -#define WDT_TCSR_PRESCALE_1 (0 << 3) -#define WDT_TCSR_PRESCALE_4 (1 << 3) -#define WDT_TCSR_PRESCALE_16 (2 << 3) -#define WDT_TCSR_PRESCALE_64 (3 << 3) -#define WDT_TCSR_PRESCALE_256 (4 << 3) -#define WDT_TCSR_PRESCALE_1024 (5 << 3) - -#define WDT_TCSR_EXT_EN (1 << 2) -#define WDT_TCSR_RTC_EN (1 << 1) -#define WDT_TCSR_PCK_EN (1 << 0) - -#define WDT_TCER_TCEN (1 << 0) - -/********************************************************************************************************* -** ÖжÏÔ´ -*********************************************************************************************************/ -/* INTC (Interrupt Controller) */ -#define INTC_ISR(n) (INTC_BASE + 0x00 + (n) * 0x20) -#define INTC_IMR(n) (INTC_BASE + 0x04 + (n) * 0x20) -#define INTC_IMSR(n) (INTC_BASE + 0x08 + (n) * 0x20) -#define INTC_IMCR(n) (INTC_BASE + 0x0c + (n) * 0x20) -#define INTC_IPR(n) (INTC_BASE + 0x10 + (n) * 0x20) - -#define REG_INTC_ISR(n) REG32(INTC_ISR((n))) -#define REG_INTC_IMR(n) REG32(INTC_IMR((n))) -#define REG_INTC_IMSR(n) REG32(INTC_IMSR((n))) -#define REG_INTC_IMCR(n) REG32(INTC_IMCR((n))) -#define REG_INTC_IPR(n) REG32(INTC_IPR((n))) - -// interrupt controller interrupts -#define IRQ_DMIC 0 -#define IRQ_AIC0 1 -#define IRQ_RESERVED2 2 -#define IRQ_RESERVED3 3 -#define IRQ_RESERVED4 4 -#define IRQ_RESERVED5 5 -#define IRQ_RESERVED6 6 -#define IRQ_SFC 7 -#define IRQ_SSI0 8 -#define IRQ_RESERVED9 9 -#define IRQ_PDMA 10 -#define IRQ_PDMAD 11 -#define IRQ_RESERVED12 12 -#define IRQ_RESERVED13 13 -#define IRQ_GPIO3 14 -#define IRQ_GPIO2 15 -#define IRQ_GPIO1 16 -#define IRQ_GPIO0 17 -#define IRQ_RESERVED18 18 -#define IRQ_RESERVED19 19 -#define IRQ_RESERVED20 20 -#define IRQ_OTG 21 -#define IRQ_RESERVED22 22 -#define IRQ_AES 23 -#define IRQ_RESERVED24 24 -#define IRQ_TCU2 25 -#define IRQ_TCU1 26 -#define IRQ_TCU0 27 -#define IRQ_RESERVED28 28 -#define IRQ_RESERVED29 29 -#define IRQ_CIM 30 -#define IRQ_LCD 31 -#define IRQ_RTC 32 -#define IRQ_RESERVED33 33 -#define IRQ_RESERVED34 34 -#define IRQ_RESERVED35 35 -#define IRQ_MSC1 36 -#define IRQ_MSC0 37 -#define IRQ_SCC 38 -#define IRQ_RESERVED39 39 -#define IRQ_PCM0 40 -#define IRQ_RESERVED41 41 -#define IRQ_RESERVED42 42 -#define IRQ_RESERVED43 43 -#define IRQ_HARB2 44 -#define IRQ_RESERVED45 45 -#define IRQ_HARB0 46 -#define IRQ_CPM 47 -#define IRQ_RESERVED48 48 -#define IRQ_UART2 49 -#define IRQ_UART1 50 -#define IRQ_UART0 51 -#define IRQ_DDR 52 -#define IRQ_RESERVED53 53 -#define IRQ_EFUSE 54 -#define IRQ_MAC 55 -#define IRQ_RESERVED56 56 -#define IRQ_RESERVED57 57 -#define IRQ_I2C2 58 -#define IRQ_I2C1 59 -#define IRQ_I2C0 60 -#define IRQ_PDMAM 61 -#define IRQ_JPEG 62 -#define IRQ_RESERVED63 63 - -#define IRQ_INTC_MAX 63 - -#ifndef __ASSEMBLY__ - -#define __intc_unmask_irq(n) (REG_INTC_IMCR((n)/32) = (1 << ((n)%32))) -#define __intc_mask_irq(n) (REG_INTC_IMSR((n)/32) = (1 << ((n)%32))) -#define __intc_ack_irq(n) (REG_INTC_IPR((n)/32) = (1 << ((n)%32))) /* A dummy ack, as the Pending Register is Read Only. Should we remove __intc_ack_irq() */ - -#endif /* !__ASSEMBLY__ */ - -#endif /* _JZ_M150_H_ */ diff --git a/libcpu/nios/nios_ii/stack.c b/libcpu/nios/nios_ii/stack.c index 125bf2c57..463ba0df9 100644 --- a/libcpu/nios/nios_ii/stack.c +++ b/libcpu/nios/nios_ii/stack.c @@ -1,7 +1,7 @@ /* * File : stack.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006-2011, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -30,43 +30,43 @@ * @return stack address */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { - unsigned long *stk; + unsigned long *stk; - stk = (unsigned long *)stack_addr; - *(stk) = 0x01; /* status */ - *(--stk) = (unsigned long)texit; /* ra */ - *(--stk) = 0xdeadbeef; /* fp */ - *(--stk) = 0xdeadbeef; /* r23 */ - *(--stk) = 0xdeadbeef; /* r22 */ - *(--stk) = 0xdeadbeef; /* r21 */ - *(--stk) = 0xdeadbeef; /* r20 */ - *(--stk) = 0xdeadbeef; /* r19 */ - *(--stk) = 0xdeadbeef; /* r18 */ - *(--stk) = 0xdeadbeef; /* r17 */ - *(--stk) = 0xdeadbeef; /* r16 */ -// *(--stk) = 0xdeadbeef; /* r15 */ -// *(--stk) = 0xdeadbeef; /* r14 */ -// *(--stk) = 0xdeadbeef; /* r13 */ -// *(--stk) = 0xdeadbeef; /* r12 */ -// *(--stk) = 0xdeadbeef; /* r11 */ -// *(--stk) = 0xdeadbeef; /* r10 */ -// *(--stk) = 0xdeadbeef; /* r9 */ -// *(--stk) = 0xdeadbeef; /* r8 */ - *(--stk) = 0xdeadbeef; /* r7 */ - *(--stk) = 0xdeadbeef; /* r6 */ - *(--stk) = 0xdeadbeef; /* r5 */ - *(--stk) = (unsigned long)parameter; /* r4 argument */ - *(--stk) = 0xdeadbeef; /* r3 */ - *(--stk) = 0xdeadbeef; /* r2 */ - *(--stk) = (unsigned long)tentry; /* pc */ + stk = (unsigned long *)stack_addr; + *(stk) = 0x01; /* status */ + *(--stk) = (unsigned long)texit; /* ra */ + *(--stk) = 0xdeadbeef; /* fp */ + *(--stk) = 0xdeadbeef; /* r23 */ + *(--stk) = 0xdeadbeef; /* r22 */ + *(--stk) = 0xdeadbeef; /* r21 */ + *(--stk) = 0xdeadbeef; /* r20 */ + *(--stk) = 0xdeadbeef; /* r19 */ + *(--stk) = 0xdeadbeef; /* r18 */ + *(--stk) = 0xdeadbeef; /* r17 */ + *(--stk) = 0xdeadbeef; /* r16 */ +// *(--stk) = 0xdeadbeef; /* r15 */ +// *(--stk) = 0xdeadbeef; /* r14 */ +// *(--stk) = 0xdeadbeef; /* r13 */ +// *(--stk) = 0xdeadbeef; /* r12 */ +// *(--stk) = 0xdeadbeef; /* r11 */ +// *(--stk) = 0xdeadbeef; /* r10 */ +// *(--stk) = 0xdeadbeef; /* r9 */ +// *(--stk) = 0xdeadbeef; /* r8 */ + *(--stk) = 0xdeadbeef; /* r7 */ + *(--stk) = 0xdeadbeef; /* r6 */ + *(--stk) = 0xdeadbeef; /* r5 */ + *(--stk) = (unsigned long)parameter; /* r4 argument */ + *(--stk) = 0xdeadbeef; /* r3 */ + *(--stk) = 0xdeadbeef; /* r2 */ + *(--stk) = (unsigned long)tentry; /* pc */ -// *(stk) = (unsigned long)tentry; /* thread entry (ra) */ -// *(--stk) = (unsigned long)parameter; /* thread argument, r4 */ +// *(stk) = (unsigned long)tentry; /* thread entry (ra) */ +// *(--stk) = (unsigned long)parameter; /* thread argument, r4 */ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /*@}*/ diff --git a/libcpu/ppc/common/stack.c b/libcpu/ppc/common/stack.c index 570e9ba04..de9d7d201 100644 --- a/libcpu/ppc/common/stack.c +++ b/libcpu/ppc/common/stack.c @@ -1,7 +1,7 @@ /* * File : stack.c * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006-2011, RT-Thread Development Team + * COPYRIGHT (C) 2006-2021, RT-Thread Development Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at @@ -9,7 +9,7 @@ * * Change Logs: * Date Author Notes - * 2011-02-14 Fred first implementation for + * 2011-02-14 Fred first implementation for */ #include diff --git a/libcpu/ppc/ppc405/interrupt.c b/libcpu/ppc/ppc405/interrupt.c index 27a528e2f..f072dd07e 100644 --- a/libcpu/ppc/ppc405/interrupt.c +++ b/libcpu/ppc/ppc405/interrupt.c @@ -28,18 +28,18 @@ rt_uint32_t rt_thread_switch_interrput_flag; rt_isr_handler_t rt_hw_interrupt_handler(rt_uint32_t vector, void* param) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); - return RT_NULL; + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + return RT_NULL; } void uic_irq_ack(unsigned int vec) { - mtdcr(uic0sr, UIC_MASK(vec)); + mtdcr(uic0sr, UIC_MASK(vec)); } void uic_int_handler (unsigned int vec) { - rt_interrupt_enter(); + rt_interrupt_enter(); /* Allow external interrupts to the CPU. */ if (isr_table [vec].handler != 0) @@ -47,91 +47,91 @@ void uic_int_handler (unsigned int vec) (*isr_table[vec].handler)(vec, isr_table[vec].param); } uic_irq_ack(vec); - + rt_interrupt_leave(); } /* handler for UIC interrupt */ void uic_interrupt(rt_uint32_t uic_base, int vec_base) { - int vec; - rt_uint32_t uic_msr; - rt_uint32_t msr_shift; - - /* - * Read masked interrupt status register to determine interrupt source - */ - uic_msr = get_dcr(uic_base + UIC_MSR); - msr_shift = uic_msr; - vec = vec_base; - - while (msr_shift != 0) - { - if (msr_shift & 0x80000000) - uic_int_handler(vec); - - /* - * Shift msr to next position and increment vector - */ - msr_shift <<= 1; - vec++; - } + int vec; + rt_uint32_t uic_msr; + rt_uint32_t msr_shift; + + /* + * Read masked interrupt status register to determine interrupt source + */ + uic_msr = get_dcr(uic_base + UIC_MSR); + msr_shift = uic_msr; + vec = vec_base; + + while (msr_shift != 0) + { + if (msr_shift & 0x80000000) + uic_int_handler(vec); + + /* + * Shift msr to next position and increment vector + */ + msr_shift <<= 1; + vec++; + } } -rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, +rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, void* param, const char* name) { - int intVal; + int intVal; rt_isr_handler_t old_handler; - if (((int)vector < 0) || ((int) vector >= MAX_HANDLERS)) - { + if (((int)vector < 0) || ((int) vector >= MAX_HANDLERS)) + { return RT_NULL; /* out of range */ - } - + } + /* install the handler in the system interrupt table */ intVal = rt_hw_interrupt_disable (); /* lock interrupts to prevent races */ old_handler = isr_table[vector].handler; isr_table[vector].handler = new_handler; isr_table[vector].param = param; - + rt_hw_interrupt_enable (intVal); } void rt_hw_interrupt_mask(int vector) { - mtdcr(uic0er, mfdcr(uic0er) & ~UIC_MASK(vector)); + mtdcr(uic0er, mfdcr(uic0er) & ~UIC_MASK(vector)); } void rt_hw_interrupt_unmask(int vector) { - mtdcr(uic0er, mfdcr(uic0er) | UIC_MASK(vector)); + mtdcr(uic0er, mfdcr(uic0er) | UIC_MASK(vector)); } void rt_hw_interrupt_init() { - int vector; + int vector; rt_uint32_t pit_value; pit_value = RT_TICK_PER_SECOND * (100000000 / RT_CPU_FREQ); /* enable pit */ - mtspr(SPRN_PIT, pit_value); - mtspr(SPRN_TCR, 0x4400000); + mtspr(SPRN_PIT, pit_value); + mtspr(SPRN_TCR, 0x4400000); - /* set default interrupt handler */ + /* set default interrupt handler */ for (vector = 0; vector < MAX_HANDLERS; vector++) { - isr_table [vector].handler = (rt_isr_handler_t)rt_hw_interrupt_handler; + isr_table [vector].handler = (rt_isr_handler_t)rt_hw_interrupt_handler; isr_table [vector].param = RT_NULL; } - /* initialize interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrput_flag = 0; + /* initialize interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrput_flag = 0; } /*@}*/ diff --git a/libcpu/risc-v/e310/context_gcc.S b/libcpu/risc-v/e310/context_gcc.S index 7aaa8db43..542092a66 100644 --- a/libcpu/risc-v/e310/context_gcc.S +++ b/libcpu/risc-v/e310/context_gcc.S @@ -1,21 +1,7 @@ ;/* -; * File : context_gcc.S -; * This file is part of RT-Thread RTOS -; * COPYRIGHT (C) 2018, RT-Thread Development Team +; * Copyright (c) 2006-2021, RT-Thread Development Team ; * -; * This program is free software; you can redistribute it and/or modify -; * it under the terms of the GNU General Public License as published by -; * the Free Software Foundation; either version 2 of the License, or -; * (at your option) any later version. -; * -; * This program is distributed in the hope that it will be useful, -; * but WITHOUT ANY WARRANTY; without even the implied warranty of -; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; * GNU General Public License for more details. -; * -; * You should have received a copy of the GNU General Public License along -; * with this program; if not, write to the Free Software Foundation, Inc., -; * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +; * SPDX-License-Identifier: Apache-2.0 ; * ; * Change Logs: ; * Date Author Notes diff --git a/libcpu/risc-v/e310/entry_gcc.S b/libcpu/risc-v/e310/entry_gcc.S index 83631e67e..6212cc3fc 100644 --- a/libcpu/risc-v/e310/entry_gcc.S +++ b/libcpu/risc-v/e310/entry_gcc.S @@ -1,21 +1,7 @@ /* - * File : context_gcc.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/risc-v/e310/stack.c b/libcpu/risc-v/e310/stack.c index a68c646e3..ba0fef832 100644 --- a/libcpu/risc-v/e310/stack.c +++ b/libcpu/risc-v/e310/stack.c @@ -1,21 +1,7 @@ /* - * File : stack.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/rx/context_iar.S b/libcpu/rx/context_iar.S index 143ae0031..97c630e79 100644 --- a/libcpu/rx/context_iar.S +++ b/libcpu/rx/context_iar.S @@ -28,8 +28,8 @@ _rt_hw_interrupt_enable: MVTIPL #KERNEL_INTERRUPT_PRIORITY RTS -; r0 --> swith from thread stack -; r1 --> swith to thread stack +; r0 --> switch from thread stack +; r1 --> switch to thread stack ; psr, pc, lr, r12, r3, r2, r1, r0 are pushed into [from] stack ___interrupt_27: @@ -73,12 +73,12 @@ ___interrupt_27: MOV.L #_rt_interrupt_from_thread, R15 MOV.L [ R15 ], R15 MOV.L R0, [ R15 ] - BRA swtich_to_thread + BRA switch_to_thread need_modify_isp: MVFC ISP, R15 ADD #12, R15 MVTC R15, ISP -swtich_to_thread: +switch_to_thread: SETPSW U MOV.L #_rt_interrupt_to_thread, R15 MOV.L [ R15 ], R15 diff --git a/libcpu/rx/cpuport.c b/libcpu/rx/cpuport.c index e8a75c629..ba8b6ff77 100644 --- a/libcpu/rx/cpuport.c +++ b/libcpu/rx/cpuport.c @@ -34,9 +34,9 @@ rt_uint32_t rt_thread_switch_interrupt_flag; /* stack frame*/ struct stack_frame { - rt_uint32_t ACCLO; + rt_uint32_t ACCLO; rt_uint32_t ACCHI; - rt_uint32_t FPSW; + rt_uint32_t FPSW; rt_uint32_t R1; rt_uint32_t R2; rt_uint32_t R3; @@ -53,21 +53,21 @@ struct stack_frame rt_uint32_t R14; rt_uint32_t R15; //there is not R0 register,it is special for stack pointer - rt_uint32_t PC; - rt_uint32_t PSW; + rt_uint32_t PC; + rt_uint32_t PSW; }; /** - * Initilial the threah stack. - * + * Initilial the thread stack. + * * @author LXZ (2014/11/8) - * - * @param void* tentry - * @param void* parameter - * @param rt_uint8_t* stack_addr - * @param void* texit - * - * @return rt_uint8_t* + * + * @param void* tentry + * @param void* parameter + * @param rt_uint8_t* stack_addr + * @param void* texit + * + * @return rt_uint8_t* */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, rt_uint8_t *stack_addr, void *texit) @@ -77,7 +77,7 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, unsigned long i; stk = (unsigned long *)stack_addr; - *(stk) = (unsigned long)texit; + *(stk) = (unsigned long)texit; stack_frame = (struct stack_frame *)(stack_addr - sizeof(struct stack_frame)) ; //Initilial all register @@ -85,12 +85,12 @@ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, { ((rt_uint32_t *)stack_frame)[i] = 0xdeadbeef; } - + stack_frame->PSW = (unsigned long)0x00030000 ; /* psw */ stack_frame->PC = (unsigned long)tentry; /* thread entery*/ stack_frame->R1 = (unsigned long )parameter; /* r1 : parameter */ stack_frame->FPSW = 0x00000100; /* fpsw */ - + return(rt_uint8_t *)stack_frame; } @@ -99,16 +99,16 @@ extern void list_thread(void); #endif extern rt_thread_t rt_current_thread; /** - * deal exception - * + * deal exception + * * @author LXZ (2014/11/8) - * - * @param struct stack_frame* exception_contex + * + * @param struct stack_frame* exception_contex */ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex) { if (exception_contex != RT_NULL) { - rt_kprintf("psw: 0x%08x\n", exception_contex->PSW); + rt_kprintf("psw: 0x%08x\n", exception_contex->PSW); rt_kprintf("pc: 0x%08x\n", exception_contex->PC); rt_kprintf("r0: 0x%08x\n", exception_contex->R1); rt_kprintf("r0: 0x%08x\n", exception_contex->R2); @@ -134,17 +134,17 @@ void rt_hw_hard_fault_exception(struct stack_frame* exception_contex) list_thread(); #endif while (1); - + } /** * switch thread in interrupt - * + * * @author LXZ (2014/11/8) - * - * @param rt_uint32_t from - * @param rt_uint32_t to + * + * @param rt_uint32_t from + * @param rt_uint32_t to */ void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to) { @@ -158,12 +158,12 @@ void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to) ENTER_INTERRUPT(); } /** - * swithc thread out the interrupt - * + * switch thread out the interrupt + * * @author LXZ (2014/11/8) - * - * @param rt_uint32_t from - * @param rt_uint32_t to + * + * @param rt_uint32_t from + * @param rt_uint32_t to */ void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to) { @@ -179,7 +179,7 @@ void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to) /** * shut down the chip - * + * * @author LXZ (2014/11/8) */ void rt_hw_cpu_shutdown(void) @@ -190,10 +190,10 @@ void rt_hw_cpu_shutdown(void) } /** * switch to the first thread,it just call one time - * + * * @author LXZ (2014/11/8) - * - * @param rt_uint32_t to + * + * @param rt_uint32_t to */ void rt_hw_context_switch_to(rt_uint32_t to) { diff --git a/libcpu/ti-dsp/c28x/cpuport.c b/libcpu/ti-dsp/c28x/cpuport.c index 3f88606c6..33b6923aa 100644 --- a/libcpu/ti-dsp/c28x/cpuport.c +++ b/libcpu/ti-dsp/c28x/cpuport.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/libcpu/unicore32/sep6200/context_gcc.S b/libcpu/unicore32/sep6200/context_gcc.S index 6b958e7f9..9f8e2b8f1 100644 --- a/libcpu/unicore32/sep6200/context_gcc.S +++ b/libcpu/unicore32/sep6200/context_gcc.S @@ -1,21 +1,7 @@ /* - * File : context_gcc.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/unicore32/sep6200/cpu.c b/libcpu/unicore32/sep6200/cpu.c index ebea8750e..8d0b86dae 100644 --- a/libcpu/unicore32/sep6200/cpu.c +++ b/libcpu/unicore32/sep6200/cpu.c @@ -1,21 +1,7 @@ /* - * File : cpu.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -34,23 +20,23 @@ #ifdef __GNUC__ rt_inline void cache_invalid(void) { - __asm__ volatile ("movc p0.c5, r1, #28\n" - "nop;nop;nop;nop;nop;nop;nop;nop;\n" - : - : - :"memory", "cc" - ); + __asm__ volatile ("movc p0.c5, r1, #28\n" + "nop;nop;nop;nop;nop;nop;nop;nop;\n" + : + : + :"memory", "cc" + ); } rt_inline void cache_enable(void) { - __asm__ volatile ( "movc r1, p0.c1, #0\n" - "or r1, r1, #0xc\n" - "movc p0.c1, r1, #0\n" - "nop;nop;nop;nop;nop;nop;nop;nop;\n" - : - : - :"r0", "memory", "cc"); + __asm__ volatile ( "movc r1, p0.c1, #0\n" + "or r1, r1, #0xc\n" + "movc p0.c1, r1, #0\n" + "nop;nop;nop;nop;nop;nop;nop;nop;\n" + : + : + :"r0", "memory", "cc"); } rt_inline void clean_dcache(void) @@ -59,8 +45,8 @@ rt_inline void clean_dcache(void) "movc p0.c5, ip, #10\n" "nop; nop; nop; nop; nop; nop; nop; nop\n" : - : - :"ip", "memory", "cc"); + : + :"ip", "memory", "cc"); } rt_inline rt_uint32_t icache_status(void) @@ -91,7 +77,7 @@ rt_inline rt_uint32_t dcache_status(void) rt_inline void dcache_flush(void) { - __asm__ volatile ( "mov ip, #0\n" + __asm__ volatile ( "mov ip, #0\n" "movc p0.c5, ip, #14\n" "nop; nop; nop; nop; nop; nop; nop; nop\n" : @@ -101,7 +87,7 @@ rt_inline void dcache_flush(void) rt_inline void icache_invalid(void) { - __asm__ volatile ( "mov r0, #0\n" + __asm__ volatile ( "mov r0, #0\n" "movc p0.c5, r0, #20\n" "nop; nop; nop; nop; nop; nop; nop; nop\n" : @@ -121,8 +107,8 @@ rt_inline void dcache_invalid(void) rt_inline void icache_disable(void) { - icache_invalid(); - __asm__ volatile ( "movc r0, p0.c1, #0\n" + icache_invalid(); + __asm__ volatile ( "movc r0, p0.c1, #0\n" "andn r0, r0, #8\n" "movc p0.c1, r0, #0\n" : @@ -132,8 +118,8 @@ rt_inline void icache_disable(void) rt_inline void dcache_disable(void) { - dcache_flush(); - __asm__ volatile ( "movc r0, p0.c1, #0\n" + dcache_flush(); + __asm__ volatile ( "movc r0, p0.c1, #0\n" "andn r0, r0, #20\n" "movc p0.c1, r0, #0\n" : @@ -184,7 +170,7 @@ rt_inline void dcache_enable(void) */ void rt_hw_cpu_icache_enable() { - icache_enable(); + icache_enable(); } /** @@ -193,7 +179,7 @@ void rt_hw_cpu_icache_enable() */ void rt_hw_cpu_icache_disable() { - icache_disable(); + icache_disable(); } /** @@ -202,7 +188,7 @@ void rt_hw_cpu_icache_disable() */ rt_base_t rt_hw_cpu_icache_status() { - return icache_status(); + return icache_status(); } /** @@ -211,7 +197,7 @@ rt_base_t rt_hw_cpu_icache_status() */ void rt_hw_cpu_dcache_enable() { - dcache_enable(); + dcache_enable(); } /** @@ -220,7 +206,7 @@ void rt_hw_cpu_dcache_enable() */ void rt_hw_cpu_dcache_disable() { - dcache_disable(); + dcache_disable(); } /** @@ -229,29 +215,29 @@ void rt_hw_cpu_dcache_disable() */ rt_base_t rt_hw_cpu_dcache_status() { - return dcache_status(); + return dcache_status(); } static void sep6200_reset(rt_uint32_t addr) { __asm__ volatile ( "mov ip, #0\n" - "movc p0.c5, ip, #28\n" /*Cache invalidate all*/ - "movc p0.c6, ip, #6\n" /*TLB invalidate all*/ - "nop;nop;nop;nop;nop;nop;nop;nop;\n" - "movc ip, p0.c1, #0\n" /*ctrl register*/ - "andn ip, ip, #0x000f\n" /*disable caches and mmu*/ - "movc p0.c1, ip, #0\n" - "nop\n" - "mov pc, %0\n" - "nop;nop;nop;nop;nop;nop;nop;nop;\n" - : "=&r" (addr) - : - :"memory", "cc"); + "movc p0.c5, ip, #28\n" /*Cache invalidate all*/ + "movc p0.c6, ip, #6\n" /*TLB invalidate all*/ + "nop;nop;nop;nop;nop;nop;nop;nop;\n" + "movc ip, p0.c1, #0\n" /*ctrl register*/ + "andn ip, ip, #0x000f\n" /*disable caches and mmu*/ + "movc p0.c1, ip, #0\n" + "nop\n" + "mov pc, %0\n" + "nop;nop;nop;nop;nop;nop;nop;nop;\n" + : "=&r" (addr) + : + :"memory", "cc"); } static void sep6200_poweroff(void) { - rt_kprintf("sep6200 power off not implemented\n"); + rt_kprintf("sep6200 power off not implemented\n"); while(1); } @@ -262,12 +248,12 @@ static void sep6200_poweroff(void) void rt_hw_cpu_reset() { - rt_kprintf("Soft reset, Restarting system...\n"); - sep6200_reset(0); + rt_kprintf("Soft reset, Restarting system...\n"); + sep6200_reset(0); - while(1); /* loop forever and wait for reset to happen */ + while(1); /* loop forever and wait for reset to happen */ - /* NEVER REACHED */ + /* NEVER REACHED */ } /** @@ -276,15 +262,15 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_uint32_t level; - rt_kprintf("shutdown...\n"); - - level = rt_hw_interrupt_disable(); - sep6200_poweroff(); - while (level) - { - RT_ASSERT(0); - } + rt_uint32_t level; + rt_kprintf("shutdown...\n"); + + level = rt_hw_interrupt_disable(); + sep6200_poweroff(); + while (level) + { + RT_ASSERT(0); + } } /*@}*/ diff --git a/libcpu/unicore32/sep6200/interrupt.c b/libcpu/unicore32/sep6200/interrupt.c index 31078320e..b34e64863 100644 --- a/libcpu/unicore32/sep6200/interrupt.c +++ b/libcpu/unicore32/sep6200/interrupt.c @@ -1,21 +1,7 @@ /* - * File : interrupt.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -26,38 +12,38 @@ #include #include -#define MAX_HANDLERS 64 +#define MAX_HANDLERS 64 #define SEP6200_IRQ_TYPE 0 #define SEP6200_FIQ_TYPE 1 -#define int_enable_all() \ - do { \ - *(volatile unsigned long*)SEP6200_VIC_INT_EN_L = ~0x0;\ - *(volatile unsigned long*)SEP6200_VIC_INT_EN_H = ~0x0;\ - }while(0) -#define int_disable_all() \ - do { \ - *(volatile unsigned long*)SEP6200_VIC_INT_EN_L = 0x0;\ - *(volatile unsigned long*)SEP6200_VIC_INT_EN_H = 0x0;\ - }while(0) -#define mask_all_int(int_type) \ - do { \ - if (int_type == SEP6200_IRQ_TYPE){ \ - *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = 0x1;\ - } else if (int_type == SEP6200_FIQ_TYPE) {\ - *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = 0x2;\ - }\ - }while(0) +#define int_enable_all() \ + do { \ + *(volatile unsigned long*)SEP6200_VIC_INT_EN_L = ~0x0;\ + *(volatile unsigned long*)SEP6200_VIC_INT_EN_H = ~0x0;\ + }while(0) +#define int_disable_all() \ + do { \ + *(volatile unsigned long*)SEP6200_VIC_INT_EN_L = 0x0;\ + *(volatile unsigned long*)SEP6200_VIC_INT_EN_H = 0x0;\ + }while(0) +#define mask_all_int(int_type) \ + do { \ + if (int_type == SEP6200_IRQ_TYPE){ \ + *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = 0x1;\ + } else if (int_type == SEP6200_FIQ_TYPE) {\ + *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = 0x2;\ + }\ + }while(0) #define unmask_all_int(int_type)\ - do { \ - if (int_type == SEP6200_IRQ_TYPE){ \ - *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = ~0x1;\ - } else if (int_type == SEP6200_FIQ_TYPE) {\ - *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = ~0x2;\ - }\ - }while(0) + do { \ + if (int_type == SEP6200_IRQ_TYPE){ \ + *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = ~0x1;\ + } else if (int_type == SEP6200_FIQ_TYPE) {\ + *(volatile unsigned long*)SEP6200_VIC_INT_MSK_ALL = ~0x2;\ + }\ + }while(0) #define SEP6200_INT_SET(intnum) \ do{ \ @@ -113,27 +99,27 @@ void rt_hw_interrupt_umask(int irq); rt_inline void sep6200_irq_enable(rt_uint32_t irq) { - SEP6200_INT_ENABLE(irq); + SEP6200_INT_ENABLE(irq); } rt_inline void sep6200_irq_disable(rt_uint32_t irq) { - SEP6200_INT_DISABLE(irq); + SEP6200_INT_DISABLE(irq); } rt_inline void sep6200_irq_unmask(rt_uint32_t irq) { - SEP6200_INT_ENABLE(irq); + SEP6200_INT_ENABLE(irq); } rt_inline void sep6200_irq_mask(rt_uint32_t irq) { - SEP6200_INT_DISABLE(irq); + SEP6200_INT_DISABLE(irq); } rt_isr_handler_t rt_hw_interrupt_handle(rt_uint32_t vector) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); - return RT_NULL; + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + return RT_NULL; } /** @@ -141,26 +127,26 @@ rt_isr_handler_t rt_hw_interrupt_handle(rt_uint32_t vector) */ void rt_hw_interrupt_init(void) { - rt_int32_t i; - register rt_uint32_t idx; - - - /* init exceptions table */ - for(idx=0; idx < MAX_HANDLERS; idx++) - { - isr_table[idx].handler = (rt_isr_handler_t)rt_hw_interrupt_handle; - } - int_disable_all(); - mask_all_int(SEP6200_FIQ_TYPE); - - //int_enable_all(); - unmask_all_int(SEP6200_IRQ_TYPE); - - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + rt_int32_t i; + register rt_uint32_t idx; + + + /* init exceptions table */ + for(idx=0; idx < MAX_HANDLERS; idx++) + { + isr_table[idx].handler = (rt_isr_handler_t)rt_hw_interrupt_handle; + } + int_disable_all(); + mask_all_int(SEP6200_FIQ_TYPE); + + //int_enable_all(); + unmask_all_int(SEP6200_IRQ_TYPE); + + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } @@ -171,11 +157,11 @@ void rt_hw_interrupt_init(void) */ void rt_hw_interrupt_mask(int irq) { - if (irq >= MAX_HANDLERS) { - rt_kprintf("Wrong irq num to mask\n"); - } else { - sep6200_irq_mask(irq); - } + if (irq >= MAX_HANDLERS) { + rt_kprintf("Wrong irq num to mask\n"); + } else { + sep6200_irq_mask(irq); + } } @@ -185,11 +171,11 @@ void rt_hw_interrupt_mask(int irq) */ void rt_hw_interrupt_umask(int irq) { - if (irq >= MAX_HANDLERS) { - rt_kprintf("Wrong irq num to unmask\n"); - } else { - sep6200_irq_unmask(irq); - } + if (irq >= MAX_HANDLERS) { + rt_kprintf("Wrong irq num to unmask\n"); + } else { + sep6200_irq_unmask(irq); + } } /** @@ -210,7 +196,7 @@ rt_isr_handler_t rt_hw_interrupt_install(int vector, rt_isr_handler_t handler, if (handler != RT_NULL) { #ifdef RT_USING_INTERRUPT_INFO - rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); + rt_strncpy(isr_table[vector].name, name, RT_NAME_MAX); #endif /* RT_USING_INTERRUPT_INFO */ isr_table[vector].handler = handler; isr_table[vector].param = param; diff --git a/libcpu/unicore32/sep6200/sep6200.h b/libcpu/unicore32/sep6200/sep6200.h index c09823740..773b505a0 100644 --- a/libcpu/unicore32/sep6200/sep6200.h +++ b/libcpu/unicore32/sep6200/sep6200.h @@ -1,21 +1,7 @@ /* - * File : sep6200.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -29,58 +15,58 @@ /*Core definations*/ #define PRIVMODE 0x13 -#define Mode_USR 0x10 -#define Mode_REAL 0x11 -#define Mode_IRQ 0x12 -#define Mode_PRIV 0x13 -#define Mode_TRAP 0x17 -#define Mode_EXT 0x1B -#define Mode_SUSR 0x1F +#define Mode_USR 0x10 +#define Mode_REAL 0x11 +#define Mode_IRQ 0x12 +#define Mode_PRIV 0x13 +#define Mode_TRAP 0x17 +#define Mode_EXT 0x1B +#define Mode_SUSR 0x1F /* * Address */ -#define SEP6200_VIC_BASE 0xb0000000 -#define SEP6200_PMU_BASE 0xb0001000 -#define SEP6200_RTC_BASE 0xb0002000 -#define SEP6200_TIMER_BASE 0xb0003000 -#define SEP6200_PWM_BASE 0xb0004000 -#define SEP6200_GPIO_BASE 0xb0006000 -#define SEP6200_TOUCH_ADC 0xb0007000 -#define SEP6200_SYSCTL_BASE 0xb0008000 -#define SEP6200_UART0_BASE 0xb1000000 -#define SEP6200_UART1_BASE 0xb1001000 -#define SEP6200_UART2_BASE 0xb1002000 -#define SEP6200_UART3_BASE 0xb1003000 -#define SEP6200_SSI1_BASE 0xb1004000 -#define SEP6200_SSI2_BASE 0xb1005000 -#define SEP6200_SSI3_BASE 0xb1006000 -#define SEP6200_I2C_BASE 0xb1007000 -#define SEP6200_I2S_BASE 0xb1008000 +#define SEP6200_VIC_BASE 0xb0000000 +#define SEP6200_PMU_BASE 0xb0001000 +#define SEP6200_RTC_BASE 0xb0002000 +#define SEP6200_TIMER_BASE 0xb0003000 +#define SEP6200_PWM_BASE 0xb0004000 +#define SEP6200_GPIO_BASE 0xb0006000 +#define SEP6200_TOUCH_ADC 0xb0007000 +#define SEP6200_SYSCTL_BASE 0xb0008000 +#define SEP6200_UART0_BASE 0xb1000000 +#define SEP6200_UART1_BASE 0xb1001000 +#define SEP6200_UART2_BASE 0xb1002000 +#define SEP6200_UART3_BASE 0xb1003000 +#define SEP6200_SSI1_BASE 0xb1004000 +#define SEP6200_SSI2_BASE 0xb1005000 +#define SEP6200_SSI3_BASE 0xb1006000 +#define SEP6200_I2C_BASE 0xb1007000 +#define SEP6200_I2S_BASE 0xb1008000 #define SEP6200_USB_BASE 0xb1010000 #define SEP6200_DMAC2_BASE 0xb1011000 #define SEP6200_ESRAM_BASE 0xb2000000 -#define SEP6200_NORREG_BASE0xb2020000 -#define SEP6200_SDIO1_BASE 0xb2022000 -#define SEP6200_SDIO2_BASE 0xb2023000 -#define SEP6200_LCDC_BASE 0xb2025000 -#define SEP6200_VPU_BASE 0xb2026000 -#define SEP6200_DMAC1_BASE 0xb2027000 -#define SEP6200_DDR2_REG 0xb3000000 -#define SEP6200_DDR_MEM 0x40000000 +#define SEP6200_NORREG_BASE0xb2020000 +#define SEP6200_SDIO1_BASE 0xb2022000 +#define SEP6200_SDIO2_BASE 0xb2023000 +#define SEP6200_LCDC_BASE 0xb2025000 +#define SEP6200_VPU_BASE 0xb2026000 +#define SEP6200_DMAC1_BASE 0xb2027000 +#define SEP6200_DDR2_REG 0xb3000000 +#define SEP6200_DDR_MEM 0x40000000 -#define SEP6200_UART0_DLBL (SEP6200_UART0_BASE+0x00) -#define SEP6200_UART0_RXFIFO (SEP6200_UART0_BASE+0x00) -#define SEP6200_UART0_TXFIFO (SEP6200_UART0_BASE+0x00) -#define SEP6200_UART0_DLBH (SEP6200_UART0_BASE+0x04) -#define SEP6200_UART0_IER (SEP6200_UART0_BASE+0x04) -#define SEP6200_UART0_IIR (SEP6200_UART0_BASE+0x08) -#define SEP6200_UART0_FCR (SEP6200_UART0_BASE+0x08) -#define SEP6200_UART0_LCR (SEP6200_UART0_BASE+0x0c) -#define SEP6200_UART0_MCR (SEP6200_UART0_BASE+0x10) -#define SEP6200_UART0_LSR (SEP6200_UART0_BASE+0x14) -#define SEP6200_UART0_MSR (SEP6200_UART0_BASE+0x18) +#define SEP6200_UART0_DLBL (SEP6200_UART0_BASE+0x00) +#define SEP6200_UART0_RXFIFO (SEP6200_UART0_BASE+0x00) +#define SEP6200_UART0_TXFIFO (SEP6200_UART0_BASE+0x00) +#define SEP6200_UART0_DLBH (SEP6200_UART0_BASE+0x04) +#define SEP6200_UART0_IER (SEP6200_UART0_BASE+0x04) +#define SEP6200_UART0_IIR (SEP6200_UART0_BASE+0x08) +#define SEP6200_UART0_FCR (SEP6200_UART0_BASE+0x08) +#define SEP6200_UART0_LCR (SEP6200_UART0_BASE+0x0c) +#define SEP6200_UART0_MCR (SEP6200_UART0_BASE+0x10) +#define SEP6200_UART0_LSR (SEP6200_UART0_BASE+0x14) +#define SEP6200_UART0_MSR (SEP6200_UART0_BASE+0x18) #define SEP6200_TIMER_T1LCR (SEP6200_TIMER_BASE + 0X000) @@ -362,7 +348,7 @@ typedef void (*FP)(); /* program start address */ #ifndef _BOOL_TYPE_ #define _BOOL_TYPE_ -typedef int BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ +typedef int BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ #endif typedef int ER; /* Error code. A signed integer. */ @@ -382,88 +368,88 @@ typedef int ER; /* Error code. A signed integer. */ /*Macros for debug*/ #define EOUT(fmt,...) \ - do \ - { \ - rt_kprintf("EOUT:(%s:%i) ",__FILE__,__LINE__); \ - rt_kprintf(fmt,##__VA_ARGS__); \ - }while(0) + do \ + { \ + rt_kprintf("EOUT:(%s:%i) ",__FILE__,__LINE__); \ + rt_kprintf(fmt,##__VA_ARGS__); \ + }while(0) #define RT_DEBUG #ifdef RT_DEBUG - #define DBOUT(fmt,...) \ - do \ - { \ - rt_kprintf("DBOUT:(%s:%i) ",__FILE__,__LINE__); \ - rt_kprintf(fmt,##__VA_ARGS__); \ - }while(0) + #define DBOUT(fmt,...) \ + do \ + { \ + rt_kprintf("DBOUT:(%s:%i) ",__FILE__,__LINE__); \ + rt_kprintf(fmt,##__VA_ARGS__); \ + }while(0) #else - #define DBOUT(fmt,...) \ - do{}while(0) + #define DBOUT(fmt,...) \ + do{}while(0) #endif -#ifdef RT_DEBUG - #define ASSERT(arg) \ - if((arg) == 0) \ - { \ - while(1) \ - { \ - rt_kprintf("have a assert failure\n"); \ - } \ - } +#ifdef RT_DEBUG + #define ASSERT(arg) \ + if((arg) == 0) \ + { \ + while(1) \ + { \ + rt_kprintf("have a assert failure\n"); \ + } \ + } #else - #define ASSERT(arg) \ - do \ - { \ - }while(0) + #define ASSERT(arg) \ + do \ + { \ + }while(0) #endif #define write_reg(reg,value) \ - do \ - { \ - *(RP)(reg) = value; \ - }while(0) + do \ + { \ + *(RP)(reg) = value; \ + }while(0) #define read_reg(reg) (*(RP)reg) struct rt_hw_register { - rt_uint32_t r0; - rt_uint32_t r1; - rt_uint32_t r2; - rt_uint32_t r3; - rt_uint32_t r4; - rt_uint32_t r5; - rt_uint32_t r6; - rt_uint32_t r7; - rt_uint32_t r8; - rt_uint32_t r9; - rt_uint32_t r10; - rt_uint32_t r11; - rt_uint32_t r12; - rt_uint32_t r13; - rt_uint32_t r14; - rt_uint32_t r15; - rt_uint32_t r16; - rt_uint32_t r17; - rt_uint32_t r18; - rt_uint32_t r19; - rt_uint32_t r20; - rt_uint32_t r21; - rt_uint32_t r22; - rt_uint32_t r23; - rt_uint32_t r24; - rt_uint32_t sb; - rt_uint32_t sl; - rt_uint32_t fp; - rt_uint32_t ip; - rt_uint32_t sp; - rt_uint32_t lr; - rt_uint32_t pc; - rt_uint32_t asr; - rt_uint32_t bsr; - rt_uint32_t ORIG_r0; + rt_uint32_t r0; + rt_uint32_t r1; + rt_uint32_t r2; + rt_uint32_t r3; + rt_uint32_t r4; + rt_uint32_t r5; + rt_uint32_t r6; + rt_uint32_t r7; + rt_uint32_t r8; + rt_uint32_t r9; + rt_uint32_t r10; + rt_uint32_t r11; + rt_uint32_t r12; + rt_uint32_t r13; + rt_uint32_t r14; + rt_uint32_t r15; + rt_uint32_t r16; + rt_uint32_t r17; + rt_uint32_t r18; + rt_uint32_t r19; + rt_uint32_t r20; + rt_uint32_t r21; + rt_uint32_t r22; + rt_uint32_t r23; + rt_uint32_t r24; + rt_uint32_t sb; + rt_uint32_t sl; + rt_uint32_t fp; + rt_uint32_t ip; + rt_uint32_t sp; + rt_uint32_t lr; + rt_uint32_t pc; + rt_uint32_t asr; + rt_uint32_t bsr; + rt_uint32_t ORIG_r0; }; /*@}*/ diff --git a/libcpu/unicore32/sep6200/serial.c b/libcpu/unicore32/sep6200/serial.c index 518257b61..f91834b6a 100644 --- a/libcpu/unicore32/sep6200/serial.c +++ b/libcpu/unicore32/sep6200/serial.c @@ -1,25 +1,11 @@ /* - * File : serial.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes - * 2013-03-16 Peng Fan Modified from sep4020 + * 2013-03-16 Peng Fan Modified from sep4020 */ #include #include @@ -36,204 +22,204 @@ */ static rt_err_t rt_serial_init (rt_device_t dev) { - struct serial_device* uart = (struct serial_device*) dev->user_data; + struct serial_device* uart = (struct serial_device*) dev->user_data; - if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) - { + if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) + { - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_memset(uart->int_rx->rx_buffer, 0, - sizeof(uart->int_rx->rx_buffer)); - uart->int_rx->read_index = uart->int_rx->save_index = 0; - } + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_memset(uart->int_rx->rx_buffer, 0, + sizeof(uart->int_rx->rx_buffer)); + uart->int_rx->read_index = uart->int_rx->save_index = 0; + } - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - rt_memset(uart->int_tx->tx_buffer, 0, - sizeof(uart->int_tx->tx_buffer)); - uart->int_tx->write_index = uart->int_tx->save_index = 0; - } + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + rt_memset(uart->int_tx->tx_buffer, 0, + sizeof(uart->int_tx->tx_buffer)); + uart->int_tx->write_index = uart->int_tx->save_index = 0; + } - dev->flag |= RT_DEVICE_FLAG_ACTIVATED; - } + dev->flag |= RT_DEVICE_FLAG_ACTIVATED; + } - return RT_EOK; + return RT_EOK; } /* save a char to serial buffer */ static void rt_serial_savechar(struct serial_device* uart, char ch) { - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; - uart->int_rx->save_index ++; - if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (uart->int_rx->save_index == uart->int_rx->read_index) - { - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->rx_buffer[uart->int_rx->save_index] = ch; + uart->int_rx->save_index ++; + if (uart->int_rx->save_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->save_index = 0; + + /* if the next position is read index, discard this 'read char' */ + if (uart->int_rx->save_index == uart->int_rx->read_index) + { + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { - RT_ASSERT(dev != RT_NULL); - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { - RT_ASSERT(dev != RT_NULL); - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - ptr = buffer; - err_code = RT_EOK; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - rt_base_t level; - - /* interrupt mode Rx */ - while (size) - { - if (uart->int_rx->read_index != uart->int_rx->save_index) - { - *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; - size --; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - uart->int_rx->read_index ++; - if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) - uart->int_rx->read_index = 0; - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - } - else - { - /* set error code */ - err_code = -RT_EEMPTY; - break; - } - } - } - else - { - /* polling mode */ - while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) - { - while (uart->uart_device->lsr & USTAT_RCV_READY) - { - *ptr = uart->uart_device->dlbl_fifo.txfifo & 0xff; - ptr ++; - } - } - } - - /* set error code */ - rt_set_errno(err_code); - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + ptr = buffer; + err_code = RT_EOK; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + rt_base_t level; + + /* interrupt mode Rx */ + while (size) + { + if (uart->int_rx->read_index != uart->int_rx->save_index) + { + *ptr++ = uart->int_rx->rx_buffer[uart->int_rx->read_index]; + size --; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + uart->int_rx->read_index ++; + if (uart->int_rx->read_index >= UART_RX_BUFFER_SIZE) + uart->int_rx->read_index = 0; + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + } + else + { + /* set error code */ + err_code = -RT_EEMPTY; + break; + } + } + } + else + { + /* polling mode */ + while ((rt_uint32_t)ptr - (rt_uint32_t)buffer < size) + { + while (uart->uart_device->lsr & USTAT_RCV_READY) + { + *ptr = uart->uart_device->dlbl_fifo.txfifo & 0xff; + ptr ++; + } + } + } + + /* set error code */ + rt_set_errno(err_code); + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - rt_err_t err_code; - struct serial_device* uart; - - err_code = RT_EOK; - ptr = (rt_uint8_t*)buffer; - uart = (struct serial_device*)dev->user_data; - - if (dev->flag & RT_DEVICE_FLAG_INT_TX) - { - /* interrupt mode Tx */ - while (uart->int_tx->save_index != uart->int_tx->write_index) - { - /* save on tx buffer */ - uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; - - -- size; - - /* move to next position */ - uart->int_tx->save_index ++; - - /* wrap save index */ - if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) - uart->int_tx->save_index = 0; - } - - /* set error code */ - if (size > 0) - err_code = -RT_EFULL; - } - else - { - /* polling mode */ - while (size) - { - /* - * to be polite with serial console add a line feed - * to the carriage return character - */ - if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) - { - while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); - uart->uart_device->dlbl_fifo.txfifo = '\r'; - } - - while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); - uart->uart_device->dlbl_fifo.txfifo = (*ptr & 0x1FF); - - ++ptr; --size; - } - } - - /* set error code */ - rt_set_errno(err_code); - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + rt_uint8_t* ptr; + rt_err_t err_code; + struct serial_device* uart; + + err_code = RT_EOK; + ptr = (rt_uint8_t*)buffer; + uart = (struct serial_device*)dev->user_data; + + if (dev->flag & RT_DEVICE_FLAG_INT_TX) + { + /* interrupt mode Tx */ + while (uart->int_tx->save_index != uart->int_tx->write_index) + { + /* save on tx buffer */ + uart->int_tx->tx_buffer[uart->int_tx->save_index] = *ptr++; + + -- size; + + /* move to next position */ + uart->int_tx->save_index ++; + + /* wrap save index */ + if (uart->int_tx->save_index >= UART_TX_BUFFER_SIZE) + uart->int_tx->save_index = 0; + } + + /* set error code */ + if (size > 0) + err_code = -RT_EFULL; + } + else + { + /* polling mode */ + while (size) + { + /* + * to be polite with serial console add a line feed + * to the carriage return character + */ + if (*ptr == '\n' && (dev->flag & RT_DEVICE_FLAG_STREAM)) + { + while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); + uart->uart_device->dlbl_fifo.txfifo = '\r'; + } + + while (!(uart->uart_device->lsr & USTAT_TXB_EMPTY)); + uart->uart_device->dlbl_fifo.txfifo = (*ptr & 0x1FF); + + ++ptr; --size; + } + } + + /* set error code */ + rt_set_errno(err_code); + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - RT_ASSERT(dev != RT_NULL); - - switch (cmd) - { - case RT_DEVICE_CTRL_SUSPEND: - /* suspend device */ - dev->flag |= RT_DEVICE_FLAG_SUSPENDED; - break; - - case RT_DEVICE_CTRL_RESUME: - /* resume device */ - dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; - break; - } - - return RT_EOK; + RT_ASSERT(dev != RT_NULL); + + switch (cmd) + { + case RT_DEVICE_CTRL_SUSPEND: + /* suspend device */ + dev->flag |= RT_DEVICE_FLAG_SUSPENDED; + break; + + case RT_DEVICE_CTRL_RESUME: + /* resume device */ + dev->flag &= ~RT_DEVICE_FLAG_SUSPENDED; + break; + } + + return RT_EOK; } /* @@ -241,49 +227,49 @@ static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) */ rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial) { - RT_ASSERT(device != RT_NULL); - - device->type = RT_Device_Class_Char; - device->rx_indicate = RT_NULL; - device->tx_complete = RT_NULL; - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - device->user_data = serial; - - /* register a character device */ - return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); + RT_ASSERT(device != RT_NULL); + + device->type = RT_Device_Class_Char; + device->rx_indicate = RT_NULL; + device->tx_complete = RT_NULL; + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + device->user_data = serial; + + /* register a character device */ + return rt_device_register(device, name, RT_DEVICE_FLAG_RDWR | flag); } /* ISR for serial interrupt */ void rt_hw_serial_isr(rt_device_t device) { - struct serial_device* uart = (struct serial_device*) device->user_data; + struct serial_device* uart = (struct serial_device*) device->user_data; - /* interrupt mode receive */ - RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); + /* interrupt mode receive */ + RT_ASSERT(device->flag & RT_DEVICE_FLAG_INT_RX); - /* save on rx buffer */ - while (uart->uart_device->lsr & USTAT_RCV_READY) - { - rt_serial_savechar(uart, uart->uart_device->dlbl_fifo.rxfifo & 0xff); - } + /* save on rx buffer */ + while (uart->uart_device->lsr & USTAT_RCV_READY) + { + rt_serial_savechar(uart, uart->uart_device->dlbl_fifo.rxfifo & 0xff); + } - /* invoke callback */ - if (device->rx_indicate != RT_NULL) - { - rt_size_t rx_length; + /* invoke callback */ + if (device->rx_indicate != RT_NULL) + { + rt_size_t rx_length; - /* get rx length */ - rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? - UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : - uart->int_rx->save_index - uart->int_rx->read_index; + /* get rx length */ + rx_length = uart->int_rx->read_index > uart->int_rx->save_index ? + UART_RX_BUFFER_SIZE - uart->int_rx->read_index + uart->int_rx->save_index : + uart->int_rx->save_index - uart->int_rx->read_index; - device->rx_indicate(device, rx_length); - } + device->rx_indicate(device, rx_length); + } } /*@}*/ diff --git a/libcpu/unicore32/sep6200/serial.h b/libcpu/unicore32/sep6200/serial.h index e626f5e20..dcfdc517d 100644 --- a/libcpu/unicore32/sep6200/serial.h +++ b/libcpu/unicore32/sep6200/serial.h @@ -1,21 +1,7 @@ /* - * File : serial.h - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -30,73 +16,73 @@ #include -#define USTAT_RCV_READY 0x01 /* receive data ready */ -#define USTAT_OVERRUN 0x02 /* overrun */ -#define USTAT_PARITY_ERR 0x04 /* parity error */ -#define USTAT_FRAME_ERROR 0x08 /* frame error */ -#define USTAT_BREAK 0x10 /* break */ -#define USTAT_TXB_EMPTY 0x40 /* tx buffer empty */ -#define USTAT_RCV_ERR 0x80 /* receive error */ +#define USTAT_RCV_READY 0x01 /* receive data ready */ +#define USTAT_OVERRUN 0x02 /* overrun */ +#define USTAT_PARITY_ERR 0x04 /* parity error */ +#define USTAT_FRAME_ERROR 0x08 /* frame error */ +#define USTAT_BREAK 0x10 /* break */ +#define USTAT_TXB_EMPTY 0x40 /* tx buffer empty */ +#define USTAT_RCV_ERR 0x80 /* receive error */ -#define BPS 115200 /* serial baudrate */ +#define BPS 115200 /* serial baudrate */ -#define UART_RX_BUFFER_SIZE 64 -#define UART_TX_BUFFER_SIZE 64 +#define UART_RX_BUFFER_SIZE 64 +#define UART_TX_BUFFER_SIZE 64 /*For sep6200's uart have several secondary function*/ /*we use union to decribe it*/ union dlbl_fifo { - rt_uint32_t dlbl; - rt_uint32_t rxfifo; - rt_uint32_t txfifo; + rt_uint32_t dlbl; + rt_uint32_t rxfifo; + rt_uint32_t txfifo; }; union dlbh_ier { - rt_uint32_t dlbh; - rt_uint32_t ier; + rt_uint32_t dlbh; + rt_uint32_t ier; }; union iir_fcr { - rt_uint32_t iir; - rt_uint32_t fcr; + rt_uint32_t iir; + rt_uint32_t fcr; }; struct serial_int_rx { - rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; - rt_uint32_t read_index, save_index; + rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE]; + rt_uint32_t read_index, save_index; }; struct serial_int_tx { - rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; - rt_uint32_t write_index, save_index; + rt_uint8_t tx_buffer[UART_TX_BUFFER_SIZE]; + rt_uint32_t write_index, save_index; }; typedef struct uartport { - union dlbl_fifo dlbl_fifo; - union dlbh_ier dlbh_ier; - union iir_fcr iir_fcr; - rt_uint32_t lcr; - rt_uint32_t mcr; - rt_uint32_t lsr; - rt_uint32_t msr; + union dlbl_fifo dlbl_fifo; + union dlbh_ier dlbh_ier; + union iir_fcr iir_fcr; + rt_uint32_t lcr; + rt_uint32_t mcr; + rt_uint32_t lsr; + rt_uint32_t msr; }uartport; struct serial_device { - uartport* uart_device; + uartport* uart_device; - /* rx structure */ - struct serial_int_rx* int_rx; + /* rx structure */ + struct serial_int_rx* int_rx; - /* tx structure */ - struct serial_int_tx* int_tx; + /* tx structure */ + struct serial_int_tx* int_tx; }; rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct serial_device *serial); diff --git a/libcpu/unicore32/sep6200/stack.c b/libcpu/unicore32/sep6200/stack.c index 722f40835..049b075f6 100644 --- a/libcpu/unicore32/sep6200/stack.c +++ b/libcpu/unicore32/sep6200/stack.c @@ -1,21 +1,7 @@ /* - * File : stack.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -42,47 +28,47 @@ */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { - rt_uint32_t *stk; + rt_uint32_t *stk; - stk = (rt_uint32_t*)stack_addr; - *(stk) = (rt_uint32_t)tentry; /* entry point */ - *(--stk) = (rt_uint32_t)texit; /* lr */ - *(--stk) = 0; /* r28 */ - *(--stk) = 0; /* r27 */ - *(--stk) = 0; /* r26 */ - *(--stk) = 0; /* r25 */ - *(--stk) = 0; /* r24 */ - *(--stk) = 0; /* r23 */ - *(--stk) = 0; /* r22 */ - *(--stk) = 0; /* r21 */ - *(--stk) = 0; /* r20 */ - *(--stk) = 0; /* r19 */ - *(--stk) = 0; /* r18 */ - *(--stk) = 0; /* r17 */ - *(--stk) = 0; /* r16 */ - *(--stk) = 0; /* r15 */ - *(--stk) = 0; /* r14 */ - *(--stk) = 0; /* r13 */ - *(--stk) = 0; /* r12 */ - *(--stk) = 0; /* r11 */ - *(--stk) = 0; /* r10 */ - *(--stk) = 0; /* r9 */ - *(--stk) = 0; /* r8 */ - *(--stk) = 0; /* r7 */ - *(--stk) = 0; /* r6 */ - *(--stk) = 0; /* r5 */ - *(--stk) = 0; /* r4 */ - *(--stk) = 0; /* r3 */ - *(--stk) = 0; /* r2 */ - *(--stk) = 0; /* r1 */ - *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ - *(--stk) = Mode_PRIV; /* asr */ - *(--stk) = Mode_PRIV; /* bsr */ /*why both PRIV do not need switch?*/ + stk = (rt_uint32_t*)stack_addr; + *(stk) = (rt_uint32_t)tentry; /* entry point */ + *(--stk) = (rt_uint32_t)texit; /* lr */ + *(--stk) = 0; /* r28 */ + *(--stk) = 0; /* r27 */ + *(--stk) = 0; /* r26 */ + *(--stk) = 0; /* r25 */ + *(--stk) = 0; /* r24 */ + *(--stk) = 0; /* r23 */ + *(--stk) = 0; /* r22 */ + *(--stk) = 0; /* r21 */ + *(--stk) = 0; /* r20 */ + *(--stk) = 0; /* r19 */ + *(--stk) = 0; /* r18 */ + *(--stk) = 0; /* r17 */ + *(--stk) = 0; /* r16 */ + *(--stk) = 0; /* r15 */ + *(--stk) = 0; /* r14 */ + *(--stk) = 0; /* r13 */ + *(--stk) = 0; /* r12 */ + *(--stk) = 0; /* r11 */ + *(--stk) = 0; /* r10 */ + *(--stk) = 0; /* r9 */ + *(--stk) = 0; /* r8 */ + *(--stk) = 0; /* r7 */ + *(--stk) = 0; /* r6 */ + *(--stk) = 0; /* r5 */ + *(--stk) = 0; /* r4 */ + *(--stk) = 0; /* r3 */ + *(--stk) = 0; /* r2 */ + *(--stk) = 0; /* r1 */ + *(--stk) = (rt_uint32_t)parameter; /* r0 : argument */ + *(--stk) = Mode_PRIV; /* asr */ + *(--stk) = Mode_PRIV; /* bsr */ /*why both PRIV do not need switch?*/ - /* return task's current stack address */ - return (rt_uint8_t *)stk; + /* return task's current stack address */ + return (rt_uint8_t *)stk; } /*@}*/ diff --git a/libcpu/unicore32/sep6200/start_gcc.S b/libcpu/unicore32/sep6200/start_gcc.S index 4dd17aa38..11676e875 100644 --- a/libcpu/unicore32/sep6200/start_gcc.S +++ b/libcpu/unicore32/sep6200/start_gcc.S @@ -1,21 +1,7 @@ /* - * File : start.S - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/unicore32/sep6200/trace.c b/libcpu/unicore32/sep6200/trace.c index 8f11a18a1..d83447c29 100644 --- a/libcpu/unicore32/sep6200/trace.c +++ b/libcpu/unicore32/sep6200/trace.c @@ -1,21 +1,7 @@ /* - * File : trace.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/libcpu/unicore32/sep6200/trap.c b/libcpu/unicore32/sep6200/trap.c index 1e5d02a27..f2f342cfb 100644 --- a/libcpu/unicore32/sep6200/trap.c +++ b/libcpu/unicore32/sep6200/trap.c @@ -1,21 +1,7 @@ /* - * File : trap.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes @@ -42,16 +28,16 @@ extern struct rt_thread *rt_current_thread; void rt_hw_show_register (struct rt_hw_register *regs) { - rt_kprintf("Execption:\n"); - rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); - rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); - rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x r11:0x%08x\n", regs->r8, regs->r9, regs->r10,regs->r11); - rt_kprintf("r12:0x%08x r13:0x%08x r14:0x%08x r15:0x%08x\n", regs->r12,regs->r13,regs->r14,regs->r15); - rt_kprintf("r16:0x%08x r17:0x%08x r18:0x%08x r19:0x%08x\n", regs->r16,regs->r17,regs->r18,regs->r19); - rt_kprintf("r20:0x%08x r21:0x%08x r22:0x%08x r23:0x%08x\n", regs->r20,regs->r21,regs->r22,regs->r23); - rt_kprintf("r24:0x%08x sb:0x%08x sl:0x%08xfp :0x%08x ip :0x%08x\n",regs->r24,regs->sb,regs->sl,regs->fp,regs->ip); - rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); - rt_kprintf("asr:0x%08x bsr:0x%08x\n", regs->asr,regs->bsr); + rt_kprintf("Execption:\n"); + rt_kprintf("r00:0x%08x r01:0x%08x r02:0x%08x r03:0x%08x\n", regs->r0, regs->r1, regs->r2, regs->r3); + rt_kprintf("r04:0x%08x r05:0x%08x r06:0x%08x r07:0x%08x\n", regs->r4, regs->r5, regs->r6, regs->r7); + rt_kprintf("r08:0x%08x r09:0x%08x r10:0x%08x r11:0x%08x\n", regs->r8, regs->r9, regs->r10,regs->r11); + rt_kprintf("r12:0x%08x r13:0x%08x r14:0x%08x r15:0x%08x\n", regs->r12,regs->r13,regs->r14,regs->r15); + rt_kprintf("r16:0x%08x r17:0x%08x r18:0x%08x r19:0x%08x\n", regs->r16,regs->r17,regs->r18,regs->r19); + rt_kprintf("r20:0x%08x r21:0x%08x r22:0x%08x r23:0x%08x\n", regs->r20,regs->r21,regs->r22,regs->r23); + rt_kprintf("r24:0x%08x sb:0x%08x sl:0x%08xfp :0x%08x ip :0x%08x\n",regs->r24,regs->sb,regs->sl,regs->fp,regs->ip); + rt_kprintf("sp :0x%08x lr :0x%08x pc :0x%08x\n", regs->sp, regs->lr, regs->pc); + rt_kprintf("asr:0x%08x bsr:0x%08x\n", regs->asr,regs->bsr); } /** @@ -64,13 +50,13 @@ void rt_hw_show_register (struct rt_hw_register *regs) */ void rt_hw_trap_extn(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("extn instruction\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("extn instruction\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -84,10 +70,10 @@ void rt_hw_trap_extn(struct rt_hw_register *regs) */ void rt_hw_trap_swi(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("software interrupt\n"); - rt_hw_cpu_shutdown(); + rt_kprintf("software interrupt\n"); + rt_hw_cpu_shutdown(); } /** @@ -100,13 +86,13 @@ void rt_hw_trap_swi(struct rt_hw_register *regs) */ void rt_hw_trap_pabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("prefetch abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("prefetch abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -119,13 +105,13 @@ void rt_hw_trap_pabt(struct rt_hw_register *regs) */ void rt_hw_trap_dabt(struct rt_hw_register *regs) { - rt_hw_show_register(regs); + rt_hw_show_register(regs); - rt_kprintf("data abort\n"); - rt_kprintf("thread - %s stack:\n", rt_current_thread->name); - rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); + rt_kprintf("data abort\n"); + rt_kprintf("thread - %s stack:\n", rt_current_thread->name); + rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); - rt_hw_cpu_shutdown(); + rt_hw_cpu_shutdown(); } /** @@ -137,9 +123,9 @@ void rt_hw_trap_dabt(struct rt_hw_register *regs) */ void rt_hw_trap_resv(struct rt_hw_register *regs) { - rt_kprintf("not used\n"); - rt_hw_show_register(regs); - rt_hw_cpu_shutdown(); + rt_kprintf("not used\n"); + rt_hw_show_register(regs); + rt_hw_cpu_shutdown(); } extern struct rt_irq_desc isr_table[]; @@ -152,7 +138,7 @@ void rt_hw_trap_irq(void) void *param; /* get the interrupt number */ - irq = *(RP)(SEP6200_VIC_IRQ_VECTOR_NUM); + irq = *(RP)(SEP6200_VIC_IRQ_VECTOR_NUM); /* get interrupt service routine */ isr_func = isr_table[irq].handler; @@ -162,13 +148,13 @@ void rt_hw_trap_irq(void) isr_func(irq, param); #ifdef RT_USING_INTERRUPT_INFO - isr_table[irq].counter++; + isr_table[irq].counter++; #endif /* RT_USING_INTERRUPT_INFO */ } void rt_hw_trap_fiq() { - rt_kprintf("fast interrupt request\n"); + rt_kprintf("fast interrupt request\n"); } /*@}*/ diff --git a/libcpu/xilinx/microblaze/cpu.c b/libcpu/xilinx/microblaze/cpu.c index 50a0e34dc..f5294a17e 100644 --- a/libcpu/xilinx/microblaze/cpu.c +++ b/libcpu/xilinx/microblaze/cpu.c @@ -28,8 +28,8 @@ void rt_hw_cpu_reset() */ void rt_hw_cpu_shutdown() { - rt_kprintf("shutdown...\n"); + rt_kprintf("shutdown...\n"); - while (1); + while (1); } diff --git a/libcpu/xilinx/microblaze/serial.c b/libcpu/xilinx/microblaze/serial.c index 17cca9f84..1902f1171 100644 --- a/libcpu/xilinx/microblaze/serial.c +++ b/libcpu/xilinx/microblaze/serial.c @@ -12,7 +12,7 @@ * 2006-08-23 Bernard first version * 2009-05-14 Bernard add RT-THread device interface * - * 2011-12-17 nl1031 MicroBlaze + * 2011-12-17 nl1031 MicroBlaze */ #include @@ -22,23 +22,23 @@ typedef volatile rt_uint32_t REG32; struct rt_mb_uart_lite_hw { - REG32 Rx_FIFO; // Receiver Holding Register - REG32 Tx_FIFO; // Transmitter Holding Register - REG32 STAT_REG; // Channel Status Register - REG32 CTRL_REG; // Control Register + REG32 Rx_FIFO; // Receiver Holding Register + REG32 Tx_FIFO; // Transmitter Holding Register + REG32 STAT_REG; // Channel Status Register + REG32 CTRL_REG; // Control Register }; struct rt_mb_uart_lite { - struct rt_device parent; + struct rt_device parent; - struct rt_mb_uart_lite_hw* hw_base; - rt_uint16_t peripheral_id; - rt_uint32_t baudrate; + struct rt_mb_uart_lite_hw* hw_base; + rt_uint16_t peripheral_id; + rt_uint32_t baudrate; - /* reception field */ - rt_uint16_t save_index, read_index; - rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE]; + /* reception field */ + rt_uint16_t save_index, read_index; + rt_uint8_t rx_buffer[RT_UART_RX_BUFFER_SIZE]; }; #ifdef RT_USING_UART1 struct rt_mb_uart_lite serial1; @@ -46,271 +46,271 @@ struct rt_mb_uart_lite serial1; static void rt_hw_serial_isr(void) { - unsigned int status; - rt_base_t level; - struct rt_device* device; - struct rt_mb_uart_lite* serial = RT_NULL; + unsigned int status; + rt_base_t level; + struct rt_device* device; + struct rt_mb_uart_lite* serial = RT_NULL; #ifdef RT_USING_UART1 - /* serial 1 */ - serial = &serial1; + /* serial 1 */ + serial = &serial1; #endif - RT_ASSERT(serial != RT_NULL); - - /* get generic device object */ - device = (rt_device_t)serial; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - - /* get uart status register */ - status = serial->hw_base->STAT_REG; - while (status & XUL_SR_RX_FIFO_VALID_DATA) - { - /* get received character */ - serial->rx_buffer[serial->save_index] = serial->hw_base->Rx_FIFO; - - /* move to next position */ - serial->save_index ++; - if (serial->save_index >= RT_UART_RX_BUFFER_SIZE) - serial->save_index = 0; - - /* if the next position is read index, discard this 'read char' */ - if (serial->save_index == serial->read_index) - { - serial->read_index ++; - if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) - serial->read_index = 0; - } - status = serial->hw_base->STAT_REG; - } - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - /* indicate to upper layer application */ - if (device->rx_indicate != RT_NULL) - device->rx_indicate(device, 1); + RT_ASSERT(serial != RT_NULL); + + /* get generic device object */ + device = (rt_device_t)serial; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + + /* get uart status register */ + status = serial->hw_base->STAT_REG; + while (status & XUL_SR_RX_FIFO_VALID_DATA) + { + /* get received character */ + serial->rx_buffer[serial->save_index] = serial->hw_base->Rx_FIFO; + + /* move to next position */ + serial->save_index ++; + if (serial->save_index >= RT_UART_RX_BUFFER_SIZE) + serial->save_index = 0; + + /* if the next position is read index, discard this 'read char' */ + if (serial->save_index == serial->read_index) + { + serial->read_index ++; + if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) + serial->read_index = 0; + } + status = serial->hw_base->STAT_REG; + } + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + /* indicate to upper layer application */ + if (device->rx_indicate != RT_NULL) + device->rx_indicate(device, 1); } static rt_err_t rt_serial_init (rt_device_t dev) { - struct rt_mb_uart_lite* serial = (struct rt_mb_uart_lite*) dev; + struct rt_mb_uart_lite* serial = (struct rt_mb_uart_lite*) dev; - RT_ASSERT(serial != RT_NULL); + RT_ASSERT(serial != RT_NULL); - RT_ASSERT(serial->peripheral_id != XPAR_UARTLITE_1_DEVICE_ID); + RT_ASSERT(serial->peripheral_id != XPAR_UARTLITE_1_DEVICE_ID); - /* reset rx index */ - serial->save_index = 0; - serial->read_index = 0; + /* reset rx index */ + serial->save_index = 0; + serial->read_index = 0; - /* reset rx buffer */ - rt_memset(serial->rx_buffer, 0, RT_UART_RX_BUFFER_SIZE); + /* reset rx buffer */ + rt_memset(serial->rx_buffer, 0, RT_UART_RX_BUFFER_SIZE); - return RT_EOK; + return RT_EOK; } static rt_err_t rt_serial_open(rt_device_t dev, rt_uint16_t oflag) { - struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; - RT_ASSERT(serial != RT_NULL); + struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; + RT_ASSERT(serial != RT_NULL); - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - /* enable UART rx interrupt */ - serial->hw_base->CTRL_REG = XUL_CR_ENABLE_INTR; /* enable interrupt */ + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + /* enable UART rx interrupt */ + serial->hw_base->CTRL_REG = XUL_CR_ENABLE_INTR; /* enable interrupt */ - /* install UART handler */ - rt_hw_interrupt_install(serial->peripheral_id, (rt_isr_handler_t)rt_hw_serial_isr, RT_NULL); - rt_hw_interrupt_umask(serial->peripheral_id); - } + /* install UART handler */ + rt_hw_interrupt_install(serial->peripheral_id, (rt_isr_handler_t)rt_hw_serial_isr, RT_NULL); + rt_hw_interrupt_umask(serial->peripheral_id); + } - return RT_EOK; + return RT_EOK; } static rt_err_t rt_serial_close(rt_device_t dev) { - struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; - RT_ASSERT(serial != RT_NULL); + struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; + RT_ASSERT(serial != RT_NULL); - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - /* disable interrupt */ - serial->hw_base->CTRL_REG = 0; /* RxReady interrupt */ - } + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + /* disable interrupt */ + serial->hw_base->CTRL_REG = 0; /* RxReady interrupt */ + } - return RT_EOK; + return RT_EOK; } static rt_size_t rt_serial_read (rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; - RT_ASSERT(serial != RT_NULL); - - /* point to buffer */ - ptr = (rt_uint8_t*) buffer; - - if (dev->flag & RT_DEVICE_FLAG_INT_RX) - { - while (size) - { - /* interrupt receive */ - rt_base_t level; - - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - if (serial->read_index != serial->save_index) - { - *ptr = serial->rx_buffer[serial->read_index]; - - serial->read_index ++; - if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) - serial->read_index = 0; - } - else - { - /* no data in rx buffer */ - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - break; - } - - /* enable interrupt */ - rt_hw_interrupt_enable(level); - - ptr ++; size --; - } - - return (rt_uint32_t)ptr - (rt_uint32_t)buffer; - } - else if (dev->flag & RT_DEVICE_FLAG_DMA_RX) - { - /* not support right now */ - RT_ASSERT(0); - } - else - { - /* poll mode */ - while (size) - { - /* Wait for Full Rx Buffer */ - while (!(serial->hw_base->STAT_REG & XUL_SR_RX_FIFO_VALID_DATA)); - - /* Read Character */ - *ptr = serial->hw_base->Rx_FIFO; - ptr ++; - size --; - } - - return (rt_size_t)ptr - (rt_size_t)buffer; - } - - return 0; + rt_uint8_t* ptr; + struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; + RT_ASSERT(serial != RT_NULL); + + /* point to buffer */ + ptr = (rt_uint8_t*) buffer; + + if (dev->flag & RT_DEVICE_FLAG_INT_RX) + { + while (size) + { + /* interrupt receive */ + rt_base_t level; + + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + if (serial->read_index != serial->save_index) + { + *ptr = serial->rx_buffer[serial->read_index]; + + serial->read_index ++; + if (serial->read_index >= RT_UART_RX_BUFFER_SIZE) + serial->read_index = 0; + } + else + { + /* no data in rx buffer */ + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + break; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + ptr ++; size --; + } + + return (rt_uint32_t)ptr - (rt_uint32_t)buffer; + } + else if (dev->flag & RT_DEVICE_FLAG_DMA_RX) + { + /* not support right now */ + RT_ASSERT(0); + } + else + { + /* poll mode */ + while (size) + { + /* Wait for Full Rx Buffer */ + while (!(serial->hw_base->STAT_REG & XUL_SR_RX_FIFO_VALID_DATA)); + + /* Read Character */ + *ptr = serial->hw_base->Rx_FIFO; + ptr ++; + size --; + } + + return (rt_size_t)ptr - (rt_size_t)buffer; + } + + return 0; } static rt_size_t rt_serial_write (rt_device_t dev, rt_off_t pos, const void* buffer, rt_size_t size) { - rt_uint8_t* ptr; - struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; - RT_ASSERT(serial != RT_NULL); - - ptr = (rt_uint8_t*) buffer; - if (dev->open_flag & RT_DEVICE_OFLAG_WRONLY) - { - if (dev->flag & RT_DEVICE_FLAG_STREAM) - { - /* it's a stream mode device */ - while (size) - { - /* stream mode */ - if (*ptr == '\n') - { - while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); - serial->hw_base->Tx_FIFO = '\r'; - } - - /* Wait for Empty Tx Buffer */ - while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); - - /* Transmit Character */ - serial->hw_base->Tx_FIFO = *ptr; - if (*ptr & 1) - rt_hw_board_led_on(2); - else - rt_hw_board_led_off(2); - ptr ++; size --; - } - } - else - { - while (size) - { - /* Wait for Empty Tx Buffer */ - while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); - - /* Transmit Character */ - serial->hw_base->Tx_FIFO = *ptr; - if (*ptr & 1) - rt_hw_board_led_on(2); - else - rt_hw_board_led_off(2); - ptr ++; size --; - } - } - } - - return (rt_size_t)ptr - (rt_size_t)buffer; + rt_uint8_t* ptr; + struct rt_mb_uart_lite *serial = (struct rt_mb_uart_lite*)dev; + RT_ASSERT(serial != RT_NULL); + + ptr = (rt_uint8_t*) buffer; + if (dev->open_flag & RT_DEVICE_OFLAG_WRONLY) + { + if (dev->flag & RT_DEVICE_FLAG_STREAM) + { + /* it's a stream mode device */ + while (size) + { + /* stream mode */ + if (*ptr == '\n') + { + while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); + serial->hw_base->Tx_FIFO = '\r'; + } + + /* Wait for Empty Tx Buffer */ + while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); + + /* Transmit Character */ + serial->hw_base->Tx_FIFO = *ptr; + if (*ptr & 1) + rt_hw_board_led_on(2); + else + rt_hw_board_led_off(2); + ptr ++; size --; + } + } + else + { + while (size) + { + /* Wait for Empty Tx Buffer */ + while (!(serial->hw_base->STAT_REG & XUL_SR_TX_FIFO_EMPTY)); + + /* Transmit Character */ + serial->hw_base->Tx_FIFO = *ptr; + if (*ptr & 1) + rt_hw_board_led_on(2); + else + rt_hw_board_led_off(2); + ptr ++; size --; + } + } + } + + return (rt_size_t)ptr - (rt_size_t)buffer; } static rt_err_t rt_serial_control (rt_device_t dev, int cmd, void *args) { - return RT_EOK; + return RT_EOK; } rt_err_t rt_hw_serial_init() { - rt_device_t device; + rt_device_t device; #ifndef RT_USING_CONSOLE - int Status; + int Status; - /* - * Initialize the UartLite driver so that it is ready to use. - */ - Status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID); - if (Status != XST_SUCCESS) - { - return; - } + /* + * Initialize the UartLite driver so that it is ready to use. + */ + Status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID); + if (Status != XST_SUCCESS) + { + return; + } #endif #ifdef RT_USING_UART1 - device = (rt_device_t) &serial1; - - /* init serial device private data */ - serial1.hw_base = (struct rt_mb_uart_lite_hw*)XPAR_USB_UART_BASEADDR; - serial1.peripheral_id = XPAR_UARTLITE_1_DEVICE_ID; - serial1.baudrate = 115200; - - /* set device virtual interface */ - device->init = rt_serial_init; - device->open = rt_serial_open; - device->close = rt_serial_close; - device->read = rt_serial_read; - device->write = rt_serial_write; - device->control = rt_serial_control; - - /* register uart1 on device subsystem */ - rt_device_register(device, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); + device = (rt_device_t) &serial1; + + /* init serial device private data */ + serial1.hw_base = (struct rt_mb_uart_lite_hw*)XPAR_USB_UART_BASEADDR; + serial1.peripheral_id = XPAR_UARTLITE_1_DEVICE_ID; + serial1.baudrate = 115200; + + /* set device virtual interface */ + device->init = rt_serial_init; + device->open = rt_serial_open; + device->close = rt_serial_close; + device->read = rt_serial_read; + device->write = rt_serial_write; + device->control = rt_serial_control; + + /* register uart1 on device subsystem */ + rt_device_register(device, "uart1", RT_DEVICE_FLAG_RDWR | RT_DEVICE_FLAG_INT_RX); #endif - return RT_EOK; + return RT_EOK; } diff --git a/libcpu/xilinx/microblaze/stack.c b/libcpu/xilinx/microblaze/stack.c index 686fc078a..87f1dfa01 100644 --- a/libcpu/xilinx/microblaze/stack.c +++ b/libcpu/xilinx/microblaze/stack.c @@ -29,43 +29,43 @@ extern void *_SDA2_BASE_; * @return stack address */ rt_uint8_t *rt_hw_stack_init(void *tentry, void *parameter, - rt_uint8_t *stack_addr, void *texit) + rt_uint8_t *stack_addr, void *texit) { - unsigned long *stk; + unsigned long *stk; - stk = (unsigned long *)stack_addr; - stk--; - stk--; - *stk-- = 0; /* r31 */ - *stk-- = 0; /* r30 */ - *stk-- = 0; /* r29 */ - *stk-- = 0; /* r28 */ - *stk-- = 0; /* r27 */ - *stk-- = 0; /* r26 */ - *stk-- = 0; /* r25 */ - *stk-- = 0; /* r24 */ - *stk-- = 0; /* r23 */ - *stk-- = 0; /* r22 */ - *stk-- = 0; /* r21 */ - *stk-- = 0; /* r20 */ - *stk-- = 0; /* r19 */ - *stk-- = 0; /* r18 */ - *stk-- = 0; /* r17 */ - *stk-- = (unsigned long)texit - 8; /* r15 = task return address*/ - *stk-- = (unsigned long)tentry; /* r14 = entry address*/ - *stk-- = (unsigned long)&_SDA_BASE_; /* r13 */ - *stk-- = 0; /* r12 */ - *stk-- = 0; /* r11 */ - *stk-- = 0; /* r10 */ - *stk-- = 0; /* r09 */ - *stk-- = 0; /* r08 */ - *stk-- = 0; /* r07 */ - *stk-- = 0; /* r06 */ - *stk-- = (unsigned long) parameter; /* r05 */ - *stk-- = 0; /* r04 */ - *stk-- = 0; /* r03 */ - *stk-- = (unsigned long)&_SDA2_BASE_; /* r02 */ - *stk = 2; /* enable interrupt */ - return (rt_uint8_t *)stk; + stk = (unsigned long *)stack_addr; + stk--; + stk--; + *stk-- = 0; /* r31 */ + *stk-- = 0; /* r30 */ + *stk-- = 0; /* r29 */ + *stk-- = 0; /* r28 */ + *stk-- = 0; /* r27 */ + *stk-- = 0; /* r26 */ + *stk-- = 0; /* r25 */ + *stk-- = 0; /* r24 */ + *stk-- = 0; /* r23 */ + *stk-- = 0; /* r22 */ + *stk-- = 0; /* r21 */ + *stk-- = 0; /* r20 */ + *stk-- = 0; /* r19 */ + *stk-- = 0; /* r18 */ + *stk-- = 0; /* r17 */ + *stk-- = (unsigned long)texit - 8; /* r15 = task return address*/ + *stk-- = (unsigned long)tentry; /* r14 = entry address*/ + *stk-- = (unsigned long)&_SDA_BASE_; /* r13 */ + *stk-- = 0; /* r12 */ + *stk-- = 0; /* r11 */ + *stk-- = 0; /* r10 */ + *stk-- = 0; /* r09 */ + *stk-- = 0; /* r08 */ + *stk-- = 0; /* r07 */ + *stk-- = 0; /* r06 */ + *stk-- = (unsigned long) parameter; /* r05 */ + *stk-- = 0; /* r04 */ + *stk-- = 0; /* r03 */ + *stk-- = (unsigned long)&_SDA2_BASE_; /* r02 */ + *stk = 2; /* enable interrupt */ + return (rt_uint8_t *)stk; } diff --git a/libcpu/xilinx/microblaze/trap.c b/libcpu/xilinx/microblaze/trap.c index 3b3f98d10..bcfb3cc49 100644 --- a/libcpu/xilinx/microblaze/trap.c +++ b/libcpu/xilinx/microblaze/trap.c @@ -10,13 +10,13 @@ * Change Logs: * Date Author Notes * 2006-08-23 Bernard first version - * 2011-12-17 nl1031 for MicroBlaze + * 2011-12-17 nl1031 for MicroBlaze * */ -#include -#include "xparameters.h" -#include "xintc.h" +#include +#include "xparameters.h" +#include "xintc.h" #include "xintc_i.h" #include "xintc_l.h" @@ -33,7 +33,7 @@ rt_uint32_t rt_thread_switch_interrupt_flag; void rt_hw_interrupt_handler(int vector) { - rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); + rt_kprintf("Unhandled interrupt %d occured!!!\n", vector); } /** @@ -41,24 +41,24 @@ void rt_hw_interrupt_handler(int vector) */ void rt_hw_interrupt_init() { - rt_base_t index; + rt_base_t index; - XIntc_Config *CfgPtr; + XIntc_Config *CfgPtr; CfgPtr = &XIntc_ConfigTable[0]; - for (index = 0; index < MAX_HANDLERS; index ++) - { - CfgPtr->HandlerTable[index].Handler = (XInterruptHandler)rt_hw_interrupt_handler; - } + for (index = 0; index < MAX_HANDLERS; index ++) + { + CfgPtr->HandlerTable[index].Handler = (XInterruptHandler)rt_hw_interrupt_handler; + } - /* init interrupt nest, and context in thread sp */ - rt_interrupt_nest = 0; - rt_interrupt_from_thread = 0; - rt_interrupt_to_thread = 0; - rt_thread_switch_interrupt_flag = 0; + /* init interrupt nest, and context in thread sp */ + rt_interrupt_nest = 0; + rt_interrupt_from_thread = 0; + rt_interrupt_to_thread = 0; + rt_thread_switch_interrupt_flag = 0; } /** @@ -67,8 +67,8 @@ void rt_hw_interrupt_init() */ void rt_hw_interrupt_mask(int vector) { - /* disable interrupt */ - XIntc_Disable(&int_ctl,vector); + /* disable interrupt */ + XIntc_Disable(&int_ctl,vector); } /** @@ -77,7 +77,7 @@ void rt_hw_interrupt_mask(int vector) */ void rt_hw_interrupt_umask(int vector) { - XIntc_Enable(&int_ctl,vector); + XIntc_Enable(&int_ctl,vector); } /** @@ -88,15 +88,15 @@ void rt_hw_interrupt_umask(int vector) */ void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_handler_t *old_handler) { - XIntc_Config *CfgPtr; + XIntc_Config *CfgPtr; CfgPtr = &XIntc_ConfigTable[0]; - if(vector >= 0 && vector < MAX_HANDLERS) - { - if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)CfgPtr->HandlerTable[vector].Handler; - if (new_handler != RT_NULL) CfgPtr->HandlerTable[vector].Handler = (XInterruptHandler)new_handler; - } + if(vector >= 0 && vector < MAX_HANDLERS) + { + if (*old_handler != RT_NULL) *old_handler = (rt_isr_handler_t)CfgPtr->HandlerTable[vector].Handler; + if (new_handler != RT_NULL) CfgPtr->HandlerTable[vector].Handler = (XInterruptHandler)new_handler; + } } /*****************************************************************************/ @@ -117,7 +117,7 @@ void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_ha * calling an interrupt handler. * * -* @return None. +* @return None. * * @note * @@ -131,81 +131,81 @@ void rt_hw_interrupt_install(int vector, rt_isr_handler_t new_handler, rt_isr_ha void rt_hw_trap_irq(void ) { - u32 intr_status; - u32 intr_mask = 1; - int intr_number; - volatile u32 reg; /* used as bit bucket */ - XIntc_Config *cfg_ptr; - - - /* Get the configuration data using the device ID */ - cfg_ptr = &XIntc_ConfigTable[0]; - - /* Get the interrupts that are waiting to be serviced */ - intr_status = XIntc_GetIntrStatus(XPAR_INTC_0_BASEADDR); - - /* Service each interrupt that is active and enabled by checking each - * bit in the register from LSB to MSB which corresponds to an interrupt - * intput signal - */ - for (intr_number = 0; intr_number < XPAR_INTC_MAX_NUM_INTR_INPUTS; intr_number++) - { - if (intr_status & 1) - { - XIntc_VectorTableEntry *table_ptr; - - /* If the interrupt has been setup to acknowledge it - * before servicing the interrupt, then ack it - */ - if (cfg_ptr->AckBeforeService & intr_mask) - { - XIntc_AckIntr(cfg_ptr->BaseAddress, intr_mask); - } - - /* The interrupt is active and enabled, call the - * interrupt handler that was setup with the specified - * parameter - */ - table_ptr = &(cfg_ptr->HandlerTable[intr_number]); - table_ptr->Handler(table_ptr->CallBackRef); - - /* If the interrupt has been setup to acknowledge it - * after it has been serviced then ack it - */ - if ((cfg_ptr->AckBeforeService & intr_mask) == 0) - { - XIntc_AckIntr(cfg_ptr->BaseAddress, intr_mask); - } - - /* - * Read the ISR again to handle architectures with posted write - * bus access issues. - */ - reg = XIntc_GetIntrStatus(cfg_ptr->BaseAddress); - - /* - * If only the highest priority interrupt is to be - * serviced, exit loop and return after servicing - * the interrupt - */ - if (cfg_ptr->Options == XIN_SVC_SGL_ISR_OPTION) - { - return; - } - } - - /* Move to the next interrupt to check */ - intr_mask <<= 1; - intr_status >>= 1; - - /* If there are no other bits set indicating that all interrupts - * have been serviced, then exit the loop - */ - if (intr_status == 0) - { - break; - } - } + u32 intr_status; + u32 intr_mask = 1; + int intr_number; + volatile u32 reg; /* used as bit bucket */ + XIntc_Config *cfg_ptr; + + + /* Get the configuration data using the device ID */ + cfg_ptr = &XIntc_ConfigTable[0]; + + /* Get the interrupts that are waiting to be serviced */ + intr_status = XIntc_GetIntrStatus(XPAR_INTC_0_BASEADDR); + + /* Service each interrupt that is active and enabled by checking each + * bit in the register from LSB to MSB which corresponds to an interrupt + * intput signal + */ + for (intr_number = 0; intr_number < XPAR_INTC_MAX_NUM_INTR_INPUTS; intr_number++) + { + if (intr_status & 1) + { + XIntc_VectorTableEntry *table_ptr; + + /* If the interrupt has been setup to acknowledge it + * before servicing the interrupt, then ack it + */ + if (cfg_ptr->AckBeforeService & intr_mask) + { + XIntc_AckIntr(cfg_ptr->BaseAddress, intr_mask); + } + + /* The interrupt is active and enabled, call the + * interrupt handler that was setup with the specified + * parameter + */ + table_ptr = &(cfg_ptr->HandlerTable[intr_number]); + table_ptr->Handler(table_ptr->CallBackRef); + + /* If the interrupt has been setup to acknowledge it + * after it has been serviced then ack it + */ + if ((cfg_ptr->AckBeforeService & intr_mask) == 0) + { + XIntc_AckIntr(cfg_ptr->BaseAddress, intr_mask); + } + + /* + * Read the ISR again to handle architectures with posted write + * bus access issues. + */ + reg = XIntc_GetIntrStatus(cfg_ptr->BaseAddress); + + /* + * If only the highest priority interrupt is to be + * serviced, exit loop and return after servicing + * the interrupt + */ + if (cfg_ptr->Options == XIN_SVC_SGL_ISR_OPTION) + { + return; + } + } + + /* Move to the next interrupt to check */ + intr_mask <<= 1; + intr_status >>= 1; + + /* If there are no other bits set indicating that all interrupts + * have been serviced, then exit the loop + */ + if (intr_status == 0) + { + break; + } + } } diff --git a/src/Kconfig b/src/Kconfig index c06a85875..de6e806c3 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -314,7 +314,7 @@ endmenu config RT_VER_NUM hex - default 0x30104 + default 0x30105 help RT-Thread version number diff --git a/src/clock.c b/src/clock.c index 6bdfd21e9..c473b4f27 100644 --- a/src/clock.c +++ b/src/clock.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -111,7 +111,7 @@ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms) tick = RT_TICK_PER_SECOND * (ms / 1000); tick += (RT_TICK_PER_SECOND * (ms % 1000) + 999) / 1000; } - + /* return the calculated tick */ return tick; } diff --git a/src/components.c b/src/components.c index 828005615..ed9d5c3c4 100644 --- a/src/components.c +++ b/src/components.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -91,7 +91,7 @@ void rt_components_board_init(void) rt_kprintf(":%d done\n", result); } #else - const init_fn_t *fn_ptr; + volatile const init_fn_t *fn_ptr; for (fn_ptr = &__rt_init_rti_board_start; fn_ptr < &__rt_init_rti_board_end; fn_ptr++) { @@ -117,7 +117,7 @@ void rt_components_init(void) rt_kprintf(":%d done\n", result); } #else - const init_fn_t *fn_ptr; + volatile const init_fn_t *fn_ptr; for (fn_ptr = &__rt_init_rti_board_end; fn_ptr < &__rt_init_rti_end; fn_ptr ++) { @@ -173,7 +173,7 @@ void main_thread_entry(void *parameter) { extern int main(void); extern int $Super$$main(void); - + #ifdef RT_USING_COMPONENTS_INIT /* RT-Thread components initialization */ rt_components_init(); diff --git a/src/cpu.c b/src/cpu.c index 5cba05fe7..a8fcb06d2 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/src/device.c b/src/device.c index 32c06b380..388c2ecf1 100644 --- a/src/device.c +++ b/src/device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -111,38 +111,7 @@ rt_err_t rt_device_init_all(void) */ rt_device_t rt_device_find(const char *name) { - struct rt_object *object; - struct rt_list_node *node; - struct rt_object_information *information; - - /* enter critical */ - if (rt_thread_self() != RT_NULL) - rt_enter_critical(); - - /* try to find device object */ - information = rt_object_get_information(RT_Object_Class_Device); - RT_ASSERT(information != RT_NULL); - for (node = information->object_list.next; - node != &(information->object_list); - node = node->next) - { - object = rt_list_entry(node, struct rt_object, list); - if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) - { - /* leave critical */ - if (rt_thread_self() != RT_NULL) - rt_exit_critical(); - - return (rt_device_t)object; - } - } - - /* leave critical */ - if (rt_thread_self() != RT_NULL) - rt_exit_critical(); - - /* not found */ - return RT_NULL; + return (rt_device_t)rt_object_find(name, RT_Object_Class_Device); } RTM_EXPORT(rt_device_find); diff --git a/src/idle.c b/src/idle.c index d54ad67a4..54cc088fd 100644 --- a/src/idle.c +++ b/src/idle.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -142,82 +142,37 @@ void rt_thread_idle_excute(void) { /* Loop until there is no dead thread. So one call to rt_thread_idle_excute * will do all the cleanups. */ - while (_has_defunct_thread()) + /* disable interrupt */ + + RT_DEBUG_NOT_IN_INTERRUPT; + +#ifdef RT_USING_HEAP + while (1) { rt_base_t lock; rt_thread_t thread; -#ifdef RT_USING_MODULE - struct rt_dlmodule *module = RT_NULL; -#endif - RT_DEBUG_NOT_IN_INTERRUPT; - /* disable interrupt */ lock = rt_hw_interrupt_disable(); - /* re-check whether list is empty */ - if (_has_defunct_thread()) - { - /* get defunct thread */ - thread = rt_list_entry(rt_thread_defunct.next, - struct rt_thread, - tlist); -#ifdef RT_USING_MODULE - module = (struct rt_dlmodule*)thread->module_id; - if (module) - { - dlmodule_destroy(module); - } -#endif - /* remove defunct thread */ - rt_list_remove(&(thread->tlist)); - - /* lock scheduler to prevent scheduling in cleanup function. */ - rt_enter_critical(); - - /* invoke thread cleanup */ - if (thread->cleanup != RT_NULL) - thread->cleanup(thread); - -#ifdef RT_USING_SIGNALS - rt_thread_free_sig(thread); -#endif - - /* if it's a system object, not delete it */ - if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) - { - /* detach this object */ - rt_object_detach((rt_object_t)thread); - /* unlock scheduler */ - rt_exit_critical(); - - /* enable interrupt */ - rt_hw_interrupt_enable(lock); - - return; - } - - /* unlock scheduler */ - rt_exit_critical(); - } - else + /* check whether list is empty */ + if (!_has_defunct_thread()) { - /* enable interrupt */ rt_hw_interrupt_enable(lock); - - /* may the defunct thread list is removed by others, just return */ - return; + break; } - - /* enable interrupt */ - rt_hw_interrupt_enable(lock); - -#ifdef RT_USING_HEAP + /* get defunct thread */ + thread = rt_list_entry(rt_thread_defunct.next, + struct rt_thread, + tlist); + /* remove defunct thread */ + rt_list_remove(&(thread->tlist)); /* release thread's stack */ RT_KERNEL_FREE(thread->stack_addr); /* delete thread object */ rt_object_delete((rt_object_t)thread); -#endif + rt_hw_interrupt_enable(lock); } +#endif } extern void rt_system_power_manager(void); @@ -239,7 +194,7 @@ static void rt_thread_idle_entry(void *parameter) #endif rt_thread_idle_excute(); -#ifdef RT_USING_PM +#ifdef RT_USING_PM rt_system_power_manager(); #endif } diff --git a/src/ipc.c b/src/ipc.c index e6955bae3..cb15c9b05 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -117,6 +117,9 @@ rt_inline rt_err_t rt_ipc_list_suspend(rt_list_t *list, rt_list_insert_before(list, &(thread->tlist)); } break; + + default: + break; } return RT_EOK; @@ -458,7 +461,17 @@ rt_err_t rt_sem_release(rt_sem_t sem) need_schedule = RT_TRUE; } else - sem->value ++; /* increase value */ + { + if(sem->value < RT_SEM_VALUE_MAX) + { + sem->value ++; /* increase value */ + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } + } /* enable interrupt */ rt_hw_interrupt_enable(temp); @@ -680,12 +693,22 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) if (mutex->owner == thread) { - /* it's the same thread */ - mutex->hold ++; + if(mutex->hold < RT_MUTEX_HOLD_MAX) + { + /* it's the same thread */ + mutex->hold ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } } else { +#ifdef RT_USING_SIGNALS __again: +#endif /* end of RT_USING_SIGNALS */ /* The value of mutex is 1 in initial status. Therefore, if the * value is great than 0, it indicates the mutex is avaible. */ @@ -697,7 +720,15 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) /* set mutex owner and original priority */ mutex->owner = thread; mutex->original_priority = thread->current_priority; - mutex->hold ++; + if(mutex->hold < RT_MUTEX_HOLD_MAX) + { + mutex->hold ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } } else { @@ -754,8 +785,10 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) if (thread->error != RT_EOK) { +#ifdef RT_USING_SIGNALS /* interrupt by signal, try it again */ if (thread->error == -RT_EINTR) goto __again; +#endif /* end of RT_USING_SIGNALS */ /* return error */ return thread->error; @@ -852,7 +885,15 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) /* set new owner and priority */ mutex->owner = thread; mutex->original_priority = thread->current_priority; - mutex->hold ++; + if(mutex->hold < RT_MUTEX_HOLD_MAX) + { + mutex->hold ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } /* resume thread */ rt_ipc_list_resume(&(mutex->parent.suspend_thread)); @@ -861,8 +902,16 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) } else { - /* increase value */ - mutex->value ++; + if(mutex->value < RT_MUTEX_VALUE_MAX) + { + /* increase value */ + mutex->value ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } /* clear owner */ mutex->owner = RT_NULL; @@ -1080,6 +1129,13 @@ rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set) status = RT_EOK; } } + else + { + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + return -RT_EINVAL; + } /* move node to the next */ n = n->next; @@ -1178,6 +1234,10 @@ rt_err_t rt_event_recv(rt_event_t event, if (recved) *recved = (event->set & set); + /* fill thread event info */ + thread->event_set = (event->set & set); + thread->event_info = option; + /* received event */ if (option & RT_EVENT_FLAG_CLEAR) event->set &= ~set; @@ -1186,6 +1246,11 @@ rt_err_t rt_event_recv(rt_event_t event, { /* no waiting */ thread->error = -RT_ETIMEOUT; + + /* enable interrupt */ + rt_hw_interrupt_enable(level); + + return -RT_ETIMEOUT; } else { @@ -1538,8 +1603,17 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, ++ mb->in_offset; if (mb->in_offset >= mb->size) mb->in_offset = 0; - /* increase message entry */ - mb->entry ++; + + if(mb->entry < RT_MB_ENTRY_MAX) + { + /* increase message entry */ + mb->entry ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } /* resume suspended thread */ if (!rt_list_isempty(&mb->parent.suspend_thread)) @@ -1687,8 +1761,12 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout) ++ mb->out_offset; if (mb->out_offset >= mb->size) mb->out_offset = 0; + /* decrease message entry */ - mb->entry --; + if(mb->entry > 0) + { + mb->entry --; + } /* resume suspended thread */ if (!rt_list_isempty(&(mb->suspend_sender_thread))) @@ -2102,8 +2180,16 @@ rt_err_t rt_mq_send_wait(rt_mq_t mq, if (mq->msg_queue_head == RT_NULL) mq->msg_queue_head = msg; - /* increase message entry */ - mq->entry ++; + if(mq->entry < RT_MQ_ENTRY_MAX) + { + /* increase message entry */ + mq->entry ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } /* resume suspended thread */ if (!rt_list_isempty(&mq->parent.suspend_thread)) @@ -2202,8 +2288,16 @@ rt_err_t rt_mq_urgent(rt_mq_t mq, const void *buffer, rt_size_t size) if (mq->msg_queue_tail == RT_NULL) mq->msg_queue_tail = msg; - /* increase message entry */ - mq->entry ++; + if(mq->entry < RT_MQ_ENTRY_MAX) + { + /* increase message entry */ + mq->entry ++; + } + else + { + rt_hw_interrupt_enable(temp); /* enable interrupt */ + return -RT_EFULL; /* value overflowed */ + } /* resume suspended thread */ if (!rt_list_isempty(&mq->parent.suspend_thread)) @@ -2346,7 +2440,10 @@ rt_err_t rt_mq_recv(rt_mq_t mq, mq->msg_queue_tail = RT_NULL; /* decrease message entry */ - mq->entry --; + if(mq->entry > 0) + { + mq->entry --; + } /* enable interrupt */ rt_hw_interrupt_enable(temp); diff --git a/src/irq.c b/src/irq.c index 8b4d0d0a9..c163c3554 100644 --- a/src/irq.c +++ b/src/irq.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -20,7 +20,7 @@ static void (*rt_interrupt_leave_hook)(void); /** * @ingroup Hook - * This function set a hook function when the system enter a interrupt + * This function set a hook function when the system enter a interrupt * * @note the hook function must be simple and never be blocked or suspend. */ @@ -30,7 +30,7 @@ void rt_interrupt_enter_sethook(void (*hook)(void)) } /** * @ingroup Hook - * This function set a hook function when the system exit a interrupt. + * This function set a hook function when the system exit a interrupt. * * @note the hook function must be simple and never be blocked or suspend. */ diff --git a/src/kservice.c b/src/kservice.c index 58f04330f..ea9bd87b4 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -370,7 +370,7 @@ RTM_EXPORT(rt_strstr); * * @return the result */ -rt_uint32_t rt_strcasecmp(const char *a, const char *b) +rt_int32_t rt_strcasecmp(const char *a, const char *b) { int ca, cb; @@ -456,7 +456,10 @@ RTM_EXPORT(rt_strncmp); rt_int32_t rt_strcmp(const char *cs, const char *ct) { while (*cs && *cs == *ct) - cs++, ct++; + { + cs++; + ct++; + } return (*cs - *ct); } @@ -538,12 +541,12 @@ void rt_show_version(void) rt_kprintf("- RT - Thread Operating System\n"); rt_kprintf(" / | \\ %d.%d.%d build %s\n", RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__); - rt_kprintf(" 2006 - 2019 Copyright by rt-thread team\n"); + rt_kprintf(" 2006 - 2020 Copyright by rt-thread team\n"); } RTM_EXPORT(rt_show_version); /* private function */ -#define isdigit(c) ((unsigned)((c) - '0') < 10) +#define _ISDIGIT(c) ((unsigned)((c) - '0') < 10) #ifdef RT_PRINTF_LONGLONG rt_inline int divide(long long *n, int base) @@ -588,7 +591,7 @@ rt_inline int divide(long *n, int base) rt_inline int skip_atoi(const char **s) { register int i = 0; - while (isdigit(**s)) + while (_ISDIGIT(**s)) i = i * 10 + *((*s)++) - '0'; return i; @@ -834,7 +837,7 @@ rt_int32_t rt_vsnprintf(char *buf, /* get field width */ field_width = -1; - if (isdigit(*fmt)) field_width = skip_atoi(&fmt); + if (_ISDIGIT(*fmt)) field_width = skip_atoi(&fmt); else if (*fmt == '*') { ++ fmt; @@ -853,7 +856,7 @@ rt_int32_t rt_vsnprintf(char *buf, if (*fmt == '.') { ++ fmt; - if (isdigit(*fmt)) precision = skip_atoi(&fmt); + if (_ISDIGIT(*fmt)) precision = skip_atoi(&fmt); else if (*fmt == '*') { ++ fmt; @@ -1113,7 +1116,7 @@ RTM_EXPORT(rt_console_get_device); * * @param name the name of new console device * - * @return the old console device handler + * @return the old console device handler on successful, or RT_NULL on failure. */ rt_device_t rt_console_set_device(const char *name) { @@ -1124,6 +1127,10 @@ rt_device_t rt_console_set_device(const char *name) /* find new console device */ new_device = rt_device_find(name); + + /* check whether it's a same device */ + if (new_device == old_device) return RT_NULL; + if (new_device != RT_NULL) { if (_console_device != RT_NULL) diff --git a/src/mem.c b/src/mem.c index 8099b6bb7..ac0d27f2c 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -490,6 +490,12 @@ void *rt_realloc(void *rmem, rt_size_t newsize) ((struct heap_mem *)&heap_ptr[mem2->next])->prev = ptr2; } + if (mem2 < lfree) + { + /* the splited struct is now the lowest */ + lfree = mem2; + } + plug_holes(mem2); rt_sem_release(&heap_sem); diff --git a/src/memheap.c b/src/memheap.c index aef56e1a7..358974b0e 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ @@ -127,7 +127,7 @@ rt_err_t rt_memheap_detach(struct rt_memheap *heap) RT_ASSERT(rt_object_get_type(&heap->parent) == RT_Object_Class_MemHeap); RT_ASSERT(rt_object_is_systemobject(&heap->parent)); - rt_object_detach(&(heap->lock.parent.parent)); + rt_sem_detach(&heap->lock); rt_object_detach(&(heap->parent)); /* Return a successful completion. */ @@ -712,6 +712,20 @@ void *rt_calloc(rt_size_t count, rt_size_t size) } RTM_EXPORT(rt_calloc); +void rt_memory_info(rt_uint32_t *total, + rt_uint32_t *used, + rt_uint32_t *max_used) +{ + if (total != RT_NULL) + *total = _heap.pool_size; + + if (used != RT_NULL) + *used = _heap.pool_size - _heap.available_size; + + if (max_used != RT_NULL) + *max_used = _heap.max_used_size; +} + #endif #endif diff --git a/src/mempool.c b/src/mempool.c index 00471efb3..1de48940d 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -134,7 +134,7 @@ RTM_EXPORT(rt_mp_init); rt_err_t rt_mp_detach(struct rt_mempool *mp) { struct rt_thread *thread; - register rt_ubase_t temp; + register rt_ubase_t level; /* parameter check */ RT_ASSERT(mp != RT_NULL); @@ -145,7 +145,7 @@ rt_err_t rt_mp_detach(struct rt_mempool *mp) while (!rt_list_isempty(&(mp->suspend_thread))) { /* disable interrupt */ - temp = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); /* get next suspend thread */ thread = rt_list_entry(mp->suspend_thread.next, struct rt_thread, tlist); @@ -160,7 +160,7 @@ rt_err_t rt_mp_detach(struct rt_mempool *mp) rt_thread_resume(thread); /* enable interrupt */ - rt_hw_interrupt_enable(temp); + rt_hw_interrupt_enable(level); } /* detach object */ @@ -250,7 +250,7 @@ RTM_EXPORT(rt_mp_create); rt_err_t rt_mp_delete(rt_mp_t mp) { struct rt_thread *thread; - register rt_ubase_t temp; + register rt_ubase_t level; RT_DEBUG_NOT_IN_INTERRUPT; @@ -263,7 +263,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp) while (!rt_list_isempty(&(mp->suspend_thread))) { /* disable interrupt */ - temp = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); /* get next suspend thread */ thread = rt_list_entry(mp->suspend_thread.next, struct rt_thread, tlist); @@ -278,7 +278,7 @@ rt_err_t rt_mp_delete(rt_mp_t mp) rt_thread_resume(thread); /* enable interrupt */ - rt_hw_interrupt_enable(temp); + rt_hw_interrupt_enable(level); } /* release allocated room */ diff --git a/src/object.c b/src/object.c index 4ee2f6a1a..8414a63e7 100644 --- a/src/object.c +++ b/src/object.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -212,7 +212,9 @@ void rt_system_object_init(void) /** * This function will return the specified type of object information. * - * @param type the type of object + * @param type the type of object, which can be + * RT_Object_Class_Thread/Semaphore/Mutex... etc + * * @return the object type information or RT_NULL */ struct rt_object_information * @@ -227,6 +229,77 @@ rt_object_get_information(enum rt_object_class_type type) } RTM_EXPORT(rt_object_get_information); +/** + * This function will return the length of object list in object container. + * + * @param type the type of object, which can be + * RT_Object_Class_Thread/Semaphore/Mutex... etc + * @return the length of object list + */ +int rt_object_get_length(enum rt_object_class_type type) +{ + int count = 0; + rt_ubase_t level; + struct rt_list_node *node = RT_NULL; + struct rt_object_information *information = RT_NULL; + + information = rt_object_get_information((enum rt_object_class_type)type); + if (information == RT_NULL) return 0; + + level = rt_hw_interrupt_disable(); + /* get the count of objects */ + rt_list_for_each(node, &(information->object_list)) + { + count ++; + } + rt_hw_interrupt_enable(level); + + return count; +} +RTM_EXPORT(rt_object_get_length); + +/** + * This function will copy the object pointer of the specified type, + * with the maximum size specified by maxlen. + * + * @param type the type of object, which can be + * RT_Object_Class_Thread/Semaphore/Mutex... etc + * @param pointers the pointers will be saved to + * @param maxlen the maximum number of pointers can be saved + * + * @return the copied number of object pointers + */ +int rt_object_get_pointers(enum rt_object_class_type type, rt_object_t *pointers, int maxlen) +{ + int index = 0; + rt_ubase_t level; + + struct rt_object *object; + struct rt_list_node *node = RT_NULL; + struct rt_object_information *information = RT_NULL; + + if (maxlen <= 0) return 0; + + information = rt_object_get_information((enum rt_object_class_type)type); + if (information == RT_NULL) return 0; + + level = rt_hw_interrupt_disable(); + /* retrieve pointer of object */ + rt_list_for_each(node, &(information->object_list)) + { + object = rt_list_entry(node, struct rt_object, list); + + pointers[index] = object; + index ++; + + if (index >= maxlen) break; + } + rt_hw_interrupt_enable(level); + + return index; +} +RTM_EXPORT(rt_object_get_pointers); + /** * This function will initialize an object and add it to object system * management. @@ -412,7 +485,7 @@ void rt_object_delete(rt_object_t object) RT_OBJECT_HOOK_CALL(rt_object_detach_hook, (object)); /* reset object type */ - object->type = 0; + object->type = RT_Object_Class_Null; /* lock interrupt */ temp = rt_hw_interrupt_disable(); @@ -482,9 +555,10 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) struct rt_list_node *node = RT_NULL; struct rt_object_information *information = RT_NULL; + information = rt_object_get_information((enum rt_object_class_type)type); + /* parameter check */ - if ((name == RT_NULL) || (type > RT_Object_Class_Unknown)) - return RT_NULL; + if ((name == RT_NULL) || (information == RT_NULL)) return RT_NULL; /* which is invoke in interrupt status */ RT_DEBUG_NOT_IN_INTERRUPT; @@ -493,14 +567,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) rt_enter_critical(); /* try to find object */ - if (information == RT_NULL) - { - information = rt_object_get_information((enum rt_object_class_type)type); - RT_ASSERT(information != RT_NULL); - } - for (node = information->object_list.next; - node != &(information->object_list); - node = node->next) + rt_list_for_each(node, &(information->object_list)) { object = rt_list_entry(node, struct rt_object, list); if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) diff --git a/src/scheduler.c b/src/scheduler.c index c50df06bd..9114bdcdc 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -26,23 +26,21 @@ #include #include -static rt_int16_t rt_scheduler_lock_nest; -extern volatile rt_uint8_t rt_interrupt_nest; - rt_list_t rt_thread_priority_table[RT_THREAD_PRIORITY_MAX]; -struct rt_thread *rt_current_thread; - -rt_uint8_t rt_current_priority; +rt_uint32_t rt_thread_ready_priority_group; #if RT_THREAD_PRIORITY_MAX > 32 /* Maximum priority level, 256 */ -rt_uint32_t rt_thread_ready_priority_group; rt_uint8_t rt_thread_ready_table[32]; -#else -/* Maximum priority level, 32 */ -rt_uint32_t rt_thread_ready_priority_group; #endif + +extern volatile rt_uint8_t rt_interrupt_nest; +static rt_int16_t rt_scheduler_lock_nest; +struct rt_thread *rt_current_thread = RT_NULL; +rt_uint8_t rt_current_priority; + + rt_list_t rt_thread_defunct; #ifdef RT_USING_HOOK diff --git a/src/signal.c b/src/signal.c index 02a975ee6..08e79bcb2 100644 --- a/src/signal.c +++ b/src/signal.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * diff --git a/src/slab.c b/src/slab.c index 0872ecf09..12ca1a938 100644 --- a/src/slab.c +++ b/src/slab.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/src/thread.c b/src/thread.c index ab4696b69..3351e35cf 100644 --- a/src/thread.c +++ b/src/thread.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -26,8 +26,8 @@ bug when thread has not startup. */ -#include #include +#include extern rt_list_t rt_thread_priority_table[RT_THREAD_PRIORITY_MAX]; extern struct rt_thread *rt_current_thread; @@ -78,6 +78,31 @@ void rt_thread_inited_sethook(void (*hook)(rt_thread_t thread)) #endif +/* must be invoke witch rt_hw_interrupt_disable */ +static void _thread_cleanup_execute(rt_thread_t thread) +{ + register rt_base_t level; +#ifdef RT_USING_MODULE + struct rt_dlmodule *module = RT_NULL; +#endif + level = rt_hw_interrupt_disable(); +#ifdef RT_USING_MODULE + module = (struct rt_dlmodule*)thread->module_id; + if (module) + { + dlmodule_destroy(module); + } +#endif + /* invoke thread cleanup */ + if (thread->cleanup != RT_NULL) + thread->cleanup(thread); + +#ifdef RT_USING_SIGNALS + rt_thread_free_sig(thread); +#endif + rt_hw_interrupt_enable(level); +} + void rt_thread_exit(void) { struct rt_thread *thread; @@ -89,6 +114,8 @@ void rt_thread_exit(void) /* disable interrupt */ level = rt_hw_interrupt_disable(); + _thread_cleanup_execute(thread); + /* remove from schedule */ rt_schedule_remove_thread(thread); /* change stat */ @@ -97,8 +124,7 @@ void rt_thread_exit(void) /* remove it from timer list */ rt_timer_detach(&thread->thread_timer); - if ((rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) && - thread->cleanup == RT_NULL) + if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) { rt_object_detach((rt_object_t)thread); } @@ -108,11 +134,11 @@ void rt_thread_exit(void) rt_list_insert_after(&rt_thread_defunct, &(thread->tlist)); } - /* enable interrupt */ - rt_hw_interrupt_enable(level); - /* switch to next task */ rt_schedule(); + + /* enable interrupt */ + rt_hw_interrupt_enable(level); } static rt_err_t _rt_thread_init(struct rt_thread *thread, @@ -314,20 +340,24 @@ rt_err_t rt_thread_detach(rt_thread_t thread) RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread); RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread)); + if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_CLOSE) + return RT_EOK; + if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) { /* remove from schedule */ rt_schedule_remove_thread(thread); } + _thread_cleanup_execute(thread); + /* release thread timer */ rt_timer_detach(&(thread->thread_timer)); /* change stat */ thread->stat = RT_THREAD_CLOSE; - if ((rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) && - thread->cleanup == RT_NULL) + if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) { rt_object_detach((rt_object_t)thread); } @@ -413,12 +443,17 @@ rt_err_t rt_thread_delete(rt_thread_t thread) RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread); RT_ASSERT(rt_object_is_systemobject((rt_object_t)thread) == RT_FALSE); + if ((thread->stat & RT_THREAD_STAT_MASK) == RT_THREAD_CLOSE) + return RT_EOK; + if ((thread->stat & RT_THREAD_STAT_MASK) != RT_THREAD_INIT) { /* remove from schedule */ rt_schedule_remove_thread(thread); } + _thread_cleanup_execute(thread); + /* release thread timer */ rt_timer_detach(&(thread->thread_timer)); @@ -559,7 +594,7 @@ rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick) if (rt_tick_get() - *tick < inc_tick) { - *tick = rt_tick_get() - *tick + inc_tick; + *tick = *tick + inc_tick - rt_tick_get(); /* suspend thread */ rt_thread_suspend(thread); @@ -594,7 +629,7 @@ RTM_EXPORT(rt_thread_delay_until); /** * This function will let current thread delay for some milliseconds. * - * @param tick the delay time + * @param ms the delay ms time * * @return RT_EOK */ @@ -615,7 +650,8 @@ RTM_EXPORT(rt_thread_mdelay); * @param cmd the control command, which includes * RT_THREAD_CTRL_CHANGE_PRIORITY for changing priority level of thread; * RT_THREAD_CTRL_STARTUP for starting a thread; - * RT_THREAD_CTRL_CLOSE for delete a thread. + * RT_THREAD_CTRL_CLOSE for delete a thread; + * RT_THREAD_CTRL_BIND_CPU for bind the thread to a CPU. * @param arg the argument of control command * * @return RT_EOK @@ -676,9 +712,17 @@ rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg) case RT_THREAD_CTRL_STARTUP: return rt_thread_startup(thread); -#ifdef RT_USING_HEAP case RT_THREAD_CTRL_CLOSE: - return rt_thread_delete(thread); + + if (rt_object_is_systemobject((rt_object_t)thread) == RT_TRUE) + { + return rt_thread_detach(thread); + } +#ifdef RT_USING_HEAP + else + { + return rt_thread_delete(thread); + } #endif default: @@ -721,8 +765,8 @@ rt_err_t rt_thread_suspend(rt_thread_t thread) temp = rt_hw_interrupt_disable(); /* change thread stat */ - thread->stat = RT_THREAD_SUSPEND | (thread->stat & ~RT_THREAD_STAT_MASK); rt_schedule_remove_thread(thread); + thread->stat = RT_THREAD_SUSPEND | (thread->stat & ~RT_THREAD_STAT_MASK); /* stop thread timer anyway */ rt_timer_stop(&(thread->thread_timer)); @@ -821,38 +865,7 @@ RTM_EXPORT(rt_thread_timeout); */ rt_thread_t rt_thread_find(char *name) { - struct rt_object_information *information; - struct rt_object *object; - struct rt_list_node *node; - - /* enter critical */ - if (rt_thread_self() != RT_NULL) - rt_enter_critical(); - - /* try to find device object */ - information = rt_object_get_information(RT_Object_Class_Thread); - RT_ASSERT(information != RT_NULL); - for (node = information->object_list.next; - node != &(information->object_list); - node = node->next) - { - object = rt_list_entry(node, struct rt_object, list); - if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) - { - /* leave critical */ - if (rt_thread_self() != RT_NULL) - rt_exit_critical(); - - return (rt_thread_t)object; - } - } - - /* leave critical */ - if (rt_thread_self() != RT_NULL) - rt_exit_critical(); - - /* not found */ - return RT_NULL; + return (rt_thread_t)rt_object_find(name, RT_Object_Class_Thread); } RTM_EXPORT(rt_thread_find); diff --git a/src/timer.c b/src/timer.c index fd938065d..0190f72d0 100644 --- a/src/timer.c +++ b/src/timer.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2018, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -25,6 +25,10 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL]; #ifdef RT_USING_TIMER_SOFT + +#define RT_SOFT_TIMER_IDLE 1 +#define RT_SOFT_TIMER_BUSY 0 + #ifndef RT_TIMER_THREAD_STACK_SIZE #define RT_TIMER_THREAD_STACK_SIZE 512 #endif @@ -33,6 +37,8 @@ static rt_list_t rt_timer_list[RT_TIMER_SKIP_LIST_LEVEL]; #define RT_TIMER_THREAD_PRIO 0 #endif +/* soft timer status */ +static rt_uint8_t soft_timer_status = RT_SOFT_TIMER_IDLE; /* soft timer list */ static rt_list_t rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL]; static struct rt_thread timer_thread; @@ -108,14 +114,23 @@ static void _rt_timer_init(rt_timer_t timer, static rt_tick_t rt_timer_list_next_timeout(rt_list_t timer_list[]) { struct rt_timer *timer; + register rt_base_t level; + rt_tick_t timeout_tick = RT_TICK_MAX; - if (rt_list_isempty(&timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1])) - return RT_TICK_MAX; + /* disable interrupt */ + level = rt_hw_interrupt_disable(); - timer = rt_list_entry(timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1].next, - struct rt_timer, row[RT_TIMER_SKIP_LIST_LEVEL - 1]); + if (!rt_list_isempty(&timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1])) + { + timer = rt_list_entry(timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1].next, + struct rt_timer, row[RT_TIMER_SKIP_LIST_LEVEL - 1]); + timeout_tick = timer->timeout_tick; + } + + /* enable interrupt */ + rt_hw_interrupt_enable(level); - return timer->timeout_tick; + return timeout_tick; } rt_inline void _rt_timer_remove(rt_timer_t timer) @@ -212,6 +227,8 @@ rt_err_t rt_timer_detach(rt_timer_t timer) level = rt_hw_interrupt_disable(); _rt_timer_remove(timer); + /* stop timer */ + timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; /* enable interrupt */ rt_hw_interrupt_enable(level); @@ -275,6 +292,8 @@ rt_err_t rt_timer_delete(rt_timer_t timer) level = rt_hw_interrupt_disable(); _rt_timer_remove(timer); + /* stop timer */ + timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; /* enable interrupt */ rt_hw_interrupt_enable(level); @@ -312,7 +331,6 @@ rt_err_t rt_timer_start(rt_timer_t timer) _rt_timer_remove(timer); /* change status of timer */ timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - rt_hw_interrupt_enable(level); RT_OBJECT_HOOK_CALL(rt_object_take_hook, (&(timer->parent))); @@ -323,9 +341,6 @@ rt_err_t rt_timer_start(rt_timer_t timer) RT_ASSERT(timer->init_tick < RT_TICK_MAX / 2); timer->timeout_tick = rt_tick_get() + timer->init_tick; - /* disable interrupt */ - level = rt_hw_interrupt_disable(); - #ifdef RT_USING_TIMER_SOFT if (timer->parent.flag & RT_TIMER_FLAG_SOFT_TIMER) { @@ -399,7 +414,8 @@ rt_err_t rt_timer_start(rt_timer_t timer) if (timer->parent.flag & RT_TIMER_FLAG_SOFT_TIMER) { /* check whether timer thread is ready */ - if ((timer_thread.stat & RT_THREAD_STAT_MASK) != RT_THREAD_READY) + if ((soft_timer_status == RT_SOFT_TIMER_IDLE) && + ((timer_thread.stat & RT_THREAD_STAT_MASK) == RT_THREAD_SUSPEND)) { /* resume timer thread to check soft timer */ rt_thread_resume(&timer_thread); @@ -436,13 +452,12 @@ rt_err_t rt_timer_stop(rt_timer_t timer) level = rt_hw_interrupt_disable(); _rt_timer_remove(timer); + /* change status */ + timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; /* enable interrupt */ rt_hw_interrupt_enable(level); - /* change stat */ - timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - return RT_EOK; } RTM_EXPORT(rt_timer_stop); @@ -458,10 +473,13 @@ RTM_EXPORT(rt_timer_stop); */ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg) { + register rt_base_t level; + /* timer check */ RT_ASSERT(timer != RT_NULL); RT_ASSERT(rt_object_get_type(&timer->parent) == RT_Object_Class_Timer); + level = rt_hw_interrupt_disable(); switch (cmd) { case RT_TIMER_CTRL_GET_TIME: @@ -479,7 +497,24 @@ rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg) case RT_TIMER_CTRL_SET_PERIODIC: timer->parent.flag |= RT_TIMER_FLAG_PERIODIC; break; + + case RT_TIMER_CTRL_GET_STATE: + if(timer->parent.flag & RT_TIMER_FLAG_ACTIVATED) + { + /*timer is start and run*/ + *(rt_tick_t *)arg = RT_TIMER_FLAG_ACTIVATED; + } + else + { + /*timer is stop*/ + *(rt_tick_t *)arg = RT_TIMER_FLAG_DEACTIVATED; + } + break; + + default: + break; } + rt_hw_interrupt_enable(level); return RT_EOK; } @@ -496,6 +531,9 @@ void rt_timer_check(void) struct rt_timer *t; rt_tick_t current_tick; register rt_base_t level; + rt_list_t list; + + rt_list_init(&list); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("timer check enter\n")); @@ -519,7 +557,12 @@ void rt_timer_check(void) /* remove timer from timer list firstly */ _rt_timer_remove(t); - + if (!(t->parent.flag & RT_TIMER_FLAG_PERIODIC)) + { + t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; + } + /* add timer to temporary list */ + rt_list_insert_after(&list, &(t->row[RT_TIMER_SKIP_LIST_LEVEL - 1])); /* call timeout function */ t->timeout_func(t->parameter); @@ -529,6 +572,12 @@ void rt_timer_check(void) RT_OBJECT_HOOK_CALL(rt_timer_exit_hook, (t)); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("current tick: %d\n", current_tick)); + /* Check whether the timer object is detached or started again */ + if (rt_list_isempty(&list)) + { + continue; + } + rt_list_remove(&(t->row[RT_TIMER_SKIP_LIST_LEVEL - 1])); if ((t->parent.flag & RT_TIMER_FLAG_PERIODIC) && (t->parent.flag & RT_TIMER_FLAG_ACTIVATED)) { @@ -536,14 +585,8 @@ void rt_timer_check(void) t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; rt_timer_start(t); } - else - { - /* stop timer */ - t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - } } - else - break; + else break; } /* enable interrupt */ @@ -564,26 +607,29 @@ rt_tick_t rt_timer_next_timeout_tick(void) #ifdef RT_USING_TIMER_SOFT /** - * This function will check timer list, if a timeout event happens, the + * This function will check software-timer list, if a timeout event happens, the * corresponding timeout function will be invoked. */ void rt_soft_timer_check(void) { rt_tick_t current_tick; - rt_list_t *n; struct rt_timer *t; + register rt_base_t level; + rt_list_t list; - RT_DEBUG_LOG(RT_DEBUG_TIMER, ("software timer check enter\n")); + rt_list_init(&list); - current_tick = rt_tick_get(); + RT_DEBUG_LOG(RT_DEBUG_TIMER, ("software timer check enter\n")); - /* lock scheduler */ - rt_enter_critical(); + /* disable interrupt */ + level = rt_hw_interrupt_disable(); - for (n = rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1].next; - n != &(rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1]);) + while (!rt_list_isempty(&rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1])) { - t = rt_list_entry(n, struct rt_timer, row[RT_TIMER_SKIP_LIST_LEVEL - 1]); + t = rt_list_entry(rt_soft_timer_list[RT_TIMER_SKIP_LIST_LEVEL - 1].next, + struct rt_timer, row[RT_TIMER_SKIP_LIST_LEVEL - 1]); + + current_tick = rt_tick_get(); /* * It supposes that the new tick shall less than the half duration of @@ -593,26 +639,35 @@ void rt_soft_timer_check(void) { RT_OBJECT_HOOK_CALL(rt_timer_enter_hook, (t)); - /* move node to the next */ - n = n->next; - /* remove timer from timer list firstly */ _rt_timer_remove(t); + if (!(t->parent.flag & RT_TIMER_FLAG_PERIODIC)) + { + t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; + } + /* add timer to temporary list */ + rt_list_insert_after(&list, &(t->row[RT_TIMER_SKIP_LIST_LEVEL - 1])); + + soft_timer_status = RT_SOFT_TIMER_BUSY; + /* enable interrupt */ + rt_hw_interrupt_enable(level); - /* not lock scheduler when performing timeout function */ - rt_exit_critical(); /* call timeout function */ t->timeout_func(t->parameter); - /* re-get tick */ - current_tick = rt_tick_get(); - RT_OBJECT_HOOK_CALL(rt_timer_exit_hook, (t)); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("current tick: %d\n", current_tick)); - /* lock scheduler */ - rt_enter_critical(); + /* disable interrupt */ + level = rt_hw_interrupt_disable(); + soft_timer_status = RT_SOFT_TIMER_IDLE; + /* Check whether the timer object is detached or started again */ + if (rt_list_isempty(&list)) + { + continue; + } + rt_list_remove(&(t->row[RT_TIMER_SKIP_LIST_LEVEL - 1])); if ((t->parent.flag & RT_TIMER_FLAG_PERIODIC) && (t->parent.flag & RT_TIMER_FLAG_ACTIVATED)) { @@ -620,17 +675,11 @@ void rt_soft_timer_check(void) t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; rt_timer_start(t); } - else - { - /* stop timer */ - t->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED; - } } else break; /* not check anymore */ } - - /* unlock scheduler */ - rt_exit_critical(); + /* enable interrupt */ + rt_hw_interrupt_enable(level); RT_DEBUG_LOG(RT_DEBUG_TIMER, ("software timer check leave\n")); } diff --git a/tools/auto-ci.py b/tools/auto-ci.py index 67834544d..96082c5b5 100644 --- a/tools/auto-ci.py +++ b/tools/auto-ci.py @@ -38,7 +38,6 @@ 'stm32f0x': 'arm', 'stm32f107': 'arm', 'stm32f10x': 'arm', - 'stm32f20x': 'arm', 'stm32f40x': 'arm', } diff --git a/tools/building.py b/tools/building.py index 65af79443..2ddeb9669 100644 --- a/tools/building.py +++ b/tools/building.py @@ -28,6 +28,7 @@ import sys import string import utils +import operator from SCons.Script import * from utils import _make_path_relative @@ -675,8 +676,16 @@ def DefineGroup(name, src, depend, **parameters): MergeGroup(g, group) return objs + def PriorityInsertGroup(groups, group): + length = len(groups) + for i in range(0, length): + if operator.gt(groups[i]['name'].lower(), group['name'].lower()): + groups.insert(i, group) + return + groups.append(group) + # add a new group - Projects.append(group) + PriorityInsertGroup(Projects, group) return objs diff --git a/tools/eclipse.py b/tools/eclipse.py index 253db37be..269d8ce30 100644 --- a/tools/eclipse.py +++ b/tools/eclipse.py @@ -20,6 +20,10 @@ import xml.etree.ElementTree as etree from xml.etree.ElementTree import SubElement +from building import * + +MODULE_VER_NUM = 5 + source_pattern = ['*.c', '*.cpp', '*.cxx', '*.s', '*.S', '*.asm'] def OSPath(path): @@ -135,7 +139,22 @@ def IsRttEclipsePathFormat(path): else : return False +# all libs added by scons should be ends with five whitespace as a flag +rtt_lib_flag = 5 * " " + + +def ConverToRttEclipseLibFormat(lib): + return str(lib) + str(rtt_lib_flag) + +def IsRttEclipseLibFormat(path): + if path.endswith(rtt_lib_flag): + return True + else: + return False + + + def HandleToolOption(tools, env, project, reset): BSP_ROOT = os.path.abspath(env['BSP_ROOT']) @@ -216,7 +235,7 @@ def HandleToolOption(tools, env, project, reset): with open('rtconfig_preinc.h', mode = 'w+') as f: f.write(file_header) for cppdef in CPPDEFINES: - f.write("#define " + cppdef + '\n') + f.write("#define " + cppdef.replace('=', ' ') + '\n') f.write(file_tail) # change the c.compiler.include.files files = option.findall('listOptionValue') @@ -276,23 +295,31 @@ def HandleToolOption(tools, env, project, reset): else: option.set('value', 'false') # update libs - if linker_libs_option is not None : + if linker_libs_option is not None: option = linker_libs_option # remove old libs for item in option.findall('listOptionValue'): - option.remove(item) + if IsRttEclipseLibFormat(item.get("value")): + option.remove(item) + # add new libs - for lib in env['LIBS']: - SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': lib}) + if env.has_key('LIBS'): + for lib in env['LIBS']: + formatedLib = ConverToRttEclipseLibFormat(lib) + SubElement(option, 'listOptionValue', { + 'builtIn': 'false', 'value': formatedLib}) + # update lib paths - if linker_paths_option is not None : + if linker_paths_option is not None: option = linker_paths_option # remove old lib paths for item in option.findall('listOptionValue'): - option.remove(item) + if IsRttEclipsePathFormat(item.get('value')): + # clean old configuration + option.remove(item) # add new old lib paths for path in env['LIBPATH']: - SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': path}) + SubElement(option, 'listOptionValue', {'builtIn': 'false', 'value': ConverToRttEclipsePathFormat(RelativeProjectPath(env, path).replace('\\', '/'))}) return @@ -334,12 +361,13 @@ def GenExcluding(env, project): rtt_root = os.path.abspath(env['RTT_ROOT']) bsp_root = os.path.abspath(env['BSP_ROOT']) coll_dirs = CollectPaths(project['DIRS']) - all_paths = [OSPath(path) for path in coll_dirs] + all_paths_temp = [OSPath(path) for path in coll_dirs] + all_paths = [] - # remove unused path - for path in all_paths: - if not path.startswith(rtt_root) and not path.startswith(bsp_root): - all_paths.remove(path) + # add used path + for path in all_paths_temp: + if path.startswith(rtt_root) or path.startswith(bsp_root): + all_paths.append(path) if bsp_root.startswith(rtt_root): # bsp folder is in the RT-Thread root folder, such as the RT-Thread source code on GitHub diff --git a/tools/gcc.py b/tools/gcc.py index 2e29c8f34..8c9685d52 100644 --- a/tools/gcc.py +++ b/tools/gcc.py @@ -23,7 +23,7 @@ import os import re -import platform +import platform def GetGCCRoot(rtconfig): exec_path = rtconfig.EXEC_PATH @@ -63,7 +63,7 @@ def CheckHeader(rtconfig, filename): fn = os.path.join(root, prefix, 'include', filename) if os.path.isfile(fn): return True - + return False def GetNewLibVersion(rtconfig): @@ -98,18 +98,18 @@ def checkAndGetResult(pattern, string): gcc_cmd = os.path.join(rtconfig.EXEC_PATH, rtconfig.CC) - # use temp file to get more information + # use temp file to get more information f = open('__tmp.c', 'w') if f: f.write(str) f.close() - # '-fdirectives-only', + # '-fdirectives-only', if(platform.system() == 'Windows'): child = subprocess.Popen([gcc_cmd, '-E', '-P', '__tmp.c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) else: child = subprocess.Popen(gcc_cmd + ' -E -P __tmp.c', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - + stdout, stderr = child.communicate() # print(stdout) @@ -148,7 +148,7 @@ def checkAndGetResult(pattern, string): if re.findall('pthread_create', line): posix_thread = 1 - + if have_fdset: result += '#define HAVE_FDSET 1\n' @@ -162,7 +162,7 @@ def checkAndGetResult(pattern, string): result += '#define HAVE_SIGVAL 1\n' if version: - result += '#define GCC_VERSION "%s"\n' % version + result += '#define GCC_VERSION_STR "%s"\n' % version result += '#define STDC "%s"\n' % stdc diff --git a/tools/keil.py b/tools/keil.py index 7d4913dcf..ce6f69008 100644 --- a/tools/keil.py +++ b/tools/keil.py @@ -51,6 +51,9 @@ def _get_filetype(fn): if fn.rfind('.lib') != -1: return 4 + if fn.rfind('.o') != -1: + return 3 + # other filetype return 5 diff --git a/tools/menuconfig.py b/tools/menuconfig.py index b49a2e712..d2ee2eea5 100644 --- a/tools/menuconfig.py +++ b/tools/menuconfig.py @@ -27,6 +27,8 @@ import re import sys import shutil +import hashlib +import operator # make rtconfig.h from .config @@ -97,6 +99,14 @@ def mk_rtconfig(filename): rtconfig.write('#endif\n') rtconfig.close() + +def get_file_md5(file): + MD5 = hashlib.new('md5') + with open(file, 'r') as fp: + MD5.update(fp.read().encode('utf8')) + fp_md5 = MD5.hexdigest() + return fp_md5 + def config(): mk_rtconfig('.config') @@ -219,22 +229,22 @@ def menuconfig(RTT_ROOT): os.environ['PKGS_ROOT'] = os.path.join(env_dir, 'packages') fn = '.config' - - if os.path.isfile(fn): - mtime = os.path.getmtime(fn) - else: - mtime = -1 + fn_old = '.config.old' kconfig_cmd = os.path.join(RTT_ROOT, 'tools', 'kconfig-frontends', 'kconfig-mconf') os.system(kconfig_cmd + ' Kconfig') if os.path.isfile(fn): - mtime2 = os.path.getmtime(fn) + if os.path.isfile(fn_old): + diff_eq = operator.eq(get_file_md5(fn), get_file_md5(fn_old)) + else: + diff_eq = False else: - mtime2 = -1 + sys.exit(-1) # make rtconfig.h - if mtime != mtime2: + if diff_eq == False: + shutil.copyfile(fn, fn_old) mk_rtconfig(fn) # guiconfig for windows and linux @@ -249,22 +259,22 @@ def guiconfig(RTT_ROOT): os.environ['PKGS_ROOT'] = os.path.join(env_dir, 'packages') fn = '.config' - - if os.path.isfile(fn): - mtime = os.path.getmtime(fn) - else: - mtime = -1 + fn_old = '.config.old' sys.argv = ['guiconfig', 'Kconfig']; pyguiconfig._main() if os.path.isfile(fn): - mtime2 = os.path.getmtime(fn) + if os.path.isfile(fn_old): + diff_eq = operator.eq(get_file_md5(fn), get_file_md5(fn_old)) + else: + diff_eq = False else: - mtime2 = -1 + sys.exit(-1) # make rtconfig.h - if mtime != mtime2: + if diff_eq == False: + shutil.copyfile(fn, fn_old) mk_rtconfig(fn) diff --git a/tools/mkdist.py b/tools/mkdist.py index 7e4b9a8bb..ddcaf7b37 100644 --- a/tools/mkdist.py +++ b/tools/mkdist.py @@ -349,7 +349,7 @@ def MkDist(program, BSP_ROOT, RTT_ROOT, Env, rttide = None): if 'dist_handle' in Env: print("=> start dist handle") dist_handle = Env['dist_handle'] - dist_handle(BSP_ROOT) + dist_handle(BSP_ROOT, dist_dir) # copy tools directory print('=> components') diff --git a/tools/rtthread.mk b/tools/rtthread.mk index fdc96d415..7cf018cb5 100644 --- a/tools/rtthread.mk +++ b/tools/rtthread.mk @@ -55,6 +55,20 @@ $(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC) @$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@)) endef +define add_s_file +$(eval S_SRC := $(1:$(BSP_ROOT)/%=%)) \ +$(eval S_SRC := $(S_SRC:$(RTT_ROOT)/%=%)) \ +$(eval SOBJ := $(1:%.s=%.o)) \ +$(eval SOBJ := $(SOBJ:$(BSP_ROOT)/%=$(BSP_BUILD_DIR)/%)) \ +$(eval SOBJ := $(SOBJ:$(RTT_ROOT)/%=$(RTT_BUILD_DIR)/%)) \ +$(eval LOCALS := $(addprefix $(BUILD_DIR)/,$(SOBJ))) \ +$(eval OBJS += $(LOCALS)) \ +$(if $(strip $(LOCALS)),$(eval $(LOCALS): $(S_SRC) + @if [ ! -d $$(@D) ]; then mkdir -p $$(@D); fi + @echo cc $$< + @$(CROSS_COMPILE)gcc $$(AFLAGS) -c $$< -o $$@)) +endef + add_flg = $(eval CFLAGS += $1) \ $(eval AFLAGS += $1) \ $(eval CXXFLAGS += $1) @@ -89,6 +103,9 @@ $(if $(SRCS),$(foreach f,$(SRCS),$(call add_cxx_file,$(f)))) SRCS := $(strip $(filter %.S,$(SRC_FILES))) $(if $(SRCS),$(foreach f,$(SRCS),$(call add_S_file,$(f)))) +SRCS := $(strip $(filter %.s,$(SRC_FILES))) +$(if $(SRCS),$(foreach f,$(SRCS),$(call add_s_file,$(f)))) + CFLAGS += $(CPPPATHS) CXXFLAGS += $(CPPPATHS) AFLAGS += $(CPPPATHS) diff --git a/tools/utils.py b/tools/utils.py index 945939654..67ce098cc 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -273,7 +273,7 @@ def VersionCmp(ver1, ver2): def GCCC99Patch(cflags): import building - gcc_version = building.GetDepend('GCC_VERSION') + gcc_version = building.GetDepend('GCC_VERSION_STR') if gcc_version: gcc_version = gcc_version.replace('"', '') if VersionCmp(gcc_version, "4.8.0") == 1:

pYrqx2ke>TPT{~5zHm+Ng3Ed2;vNUEsDGBk)>EyZ>^Q>y*T|=z9!ML6w6_5 zUD1aV2{wbe+baWB=EJy=P!^h_gWtzUR^+~{Epq<|H=ANx7FLyoi5U`$7YJIJqJ`-$ z0BS|Rz9ZjbqHVr+zN243wD&oy%M<fgVzjPvOu+CjfQRQAKLo8g4`Gp?Hm= z2-Yoq+%fnB^3B%fBJZM14eG_?c8XlGSU_VY1d3Y~3fO-e3jXJzX&$zExg{5AP;`c@ zZGUE^wpQc@Yg?b=jQ*n+1=`-~pHo0rjI@q*kAG?Z2pjpxy!H$I3y4#llYC-n^t$d5 z_uy=7ZakdzPCWtydIntE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D z8;6_{>(z0%3LK3c>ta^H#H7iyxH~n8EUzMiWanh;0+mfnFXwudZArmeiULB{ix7k~ zn@A)AN_@_DW#34BTkw+pYkF^+3g@zvgX@lB-y)C@&Lj34>1j+O;SUK5* z3PDdK6$lmmJO_d~>#YA{An%_p6#p;xA@AOYo`~qtE_!w<$;tavloe^RTv?fl6SE|- zvsUt6I&}>Dd0Hb&O6r>zokQ-1K>c&VUPNdtHAPvC7(Nd&jFr za_d6VJn&n6o%qRw*Wx8?bR;Dlh?BfghYHAL=rQ#FmGw$j$p?yS4D_0UdjT!_N@GR9 zzr81sFaye6mE9MB=fjQ%;+NkZ=*`ds zx2Nw9e9(HP@xWDY^u=X9y2R`zgB|sCxi<)MUP9t`XOmvahE?H|9m`k14JZ5pJ)@~* ccj}b2x|Y_O8?CNIV9@`MG}C|6fF6zg4~fJEzyJUM diff --git a/components/dfs/filesystems/uffs/src/CMakeLists.txt b/components/dfs/filesystems/uffs/src/CMakeLists.txt deleted file mode 100644 index 7d744d16e..000000000 --- a/components/dfs/filesystems/uffs/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -ADD_SUBDIRECTORY(emu) -ADD_SUBDIRECTORY(uffs) -ADD_SUBDIRECTORY(utils) -ADD_SUBDIRECTORY(example) -ADD_SUBDIRECTORY(platform) -ADD_SUBDIRECTORY(test/api_test) -ADD_SUBDIRECTORY(test/clients) diff --git a/components/dfs/filesystems/uffs/src/emu/CMakeLists.txt b/components/dfs/filesystems/uffs/src/emu/CMakeLists.txt deleted file mode 100644 index f70deff7a..000000000 --- a/components/dfs/filesystems/uffs/src/emu/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -SET (libemu_SRCS - cmdline.c - cmdline.h - helper_cmds.c - uffs_fileem.c - uffs_fileem_share.c - uffs_fileem_wrap.c - uffs_fileem_ecc_soft.c - uffs_fileem_ecc_hw.c - uffs_fileem_ecc_hw_auto.c - uffs_fileem.h - test_cmds.c - ) - -IF (UNIX) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/posix) -ENDIF() -IF (WIN32) - INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/platform/win32) -ENDIF() -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/inc) -INCLUDE_DIRECTORIES(${uffs_SOURCE_DIR}/src/test/api_test) -ADD_LIBRARY(emu STATIC ${libemu_SRCS} ) - diff --git a/components/dfs/filesystems/uffs/src/emu/cmdline.c b/components/dfs/filesystems/uffs/src/emu/cmdline.c deleted file mode 100644 index 9774a11ca..000000000 --- a/components/dfs/filesystems/uffs/src/emu/cmdline.c +++ /dev/null @@ -1,643 +0,0 @@ -/* -This file is part of UFFS, the Ultra-low-cost Flash File System. - -Copyright (C) 2005-2009 Ricky Zheng - -UFFS is free software; you can redistribute it and/or modify it under -the GNU Library General Public License as published by the Free Software -Foundation; either version 2 of the License, or (at your option) any -later version. - -UFFS is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -or GNU Library General Public License, as applicable, for more details. - -You should have received a copy of the GNU General Public License -and GNU Library General Public License along with UFFS; if not, write -to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -Boston, MA 02110-1301, USA. - -As a special exception, if other files instantiate templates or use -macros or inline functions from this file, or you compile this file -and link it with other works to produce a work based on this file, -this file does not by itself cause the resulting work to be covered -by the GNU General Public License. However the source code for this -file must still be made available in accordance with section (3) of -the GNU General Public License v2. - -This exception does not invalidate any other reasons why a work based -on this file might be covered by the GNU General Public License. -*/ - -/** -* \file cmdline.c -* \brief command line test interface -* \author Ricky Zheng, created in 22th Feb, 2007 -*/ - -#include -#include -//#include -#include "uffs_config.h" -#include "cmdline.h" -#include "uffs/uffs_fs.h" - -#define PROMPT "UFFS>" - -#define PFX "cli : " -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -#define MAX_CLI_ARGS_BUF_LEN 120 -#define MAX_CLI_ARGS_NUM 20 -#define MAX_CLI_ENV_NUM 11 // '?', '0' - '9' - - -struct cli_arg { - int argc; - char *argv[MAX_CLI_ARGS_NUM]; - char _buf[MAX_CLI_ARGS_BUF_LEN]; -}; - -static BOOL m_exit = FALSE; -static BOOL m_abort = FALSE; -static struct cli_commandset *m_cmdset_head = NULL; - -// Note: last command return code stored in env 0. -static int m_cli_envs[MAX_CLI_ENV_NUM] = {0}; // cli environment variables - -static const struct cli_command * cli_find(const char *cmd); -static int cmd_help(int argc, char *argv[]); - - -#define FOR_EACH_CLI_CMD(set, cmd) \ - for (set = m_cmdset_head; set && set->cmds; set = set->next) \ - for (cmd = set->cmds; cmd && cmd->handler; cmd++) - - -/*** filter out leading and tailing spaces, discard comments - * return pointer to start of new command line - */ -static char * cli_process_line(char *p) -{ - char *s; - char *x; - - if (!p) - return NULL; - - // skip leading spaces - while (p && (*p == ' ' || *p == '\t')) - p++; - - for (s = x = p; *p; x++, p++) { - switch(*p) { - case '\\': - p++; - if (*p) { - switch(*p) { - case 'n': - *x = '\n'; - break; - case 'r': - *x = '\r'; - break; - case 't': - *x = '\t'; - break; - case 'b': - *x = '\b'; - break; - default: - if (*p >= '0' && *p <= '9') - *x = *p - '0'; - else - *x = *p; - break; - } - } - break; - default: - if (*p == '\r' || *p == '\n' || *p == '#') *p = '\0'; - *x = *p; - break; - } - - if (*p == 0) - break; - } - - // trim tailing spaces - p--; - while (p > s && (*p == ' ' || *p == '\t')) - *p-- = '\0'; - - return s; -} - -static int cli_env_to_idx(char env) -{ - int idx = -1; - - if (env >= '0' && env <= '9') { - idx = env - '0' + 1; - } - else if (env == '?') { - idx = 0; - } - - return idx; -} - -int cli_env_set(char env, int val) -{ - int idx = cli_env_to_idx(env); - - if (idx >= 0) { - m_cli_envs[idx] = val; - return 0; - } - else - return -1; -} - -int cli_env_get(char env) -{ - int idx = cli_env_to_idx(env); - - return idx >= 0 ? m_cli_envs[idx] : 0; -} - -/** exec command times: - * exec [...] - */ -static int cmd_exec(int argc, char *argv[]) -{ - int n = 0; - const struct cli_command *cmd; - - CHK_ARGC(3, 0); - - if (sscanf(argv[1], "%d", &n) != 1) - return CLI_INVALID_ARG; - if (n <= 0) - return CLI_INVALID_ARG; - - cmd = cli_find(argv[2]); - if (cmd == NULL) { - MSG("Unknown command '%s'\n", argv[2]); - return -1; - } - else { - argv += 2; - while (n-- >= 0) { - if (cmd->handler(argc - 2, argv) != 0) - return -1; - } - } - - return 0; -} - -/** - * test expression - * test - * for example: - * test 1 > 0 ==> return 0 - * test 1 <= 0 ==> return -1 - */ -static int cmd_test(int argc, char *argv[]) -{ - int a, b; - char *op; - BOOL tst = FALSE; - - CHK_ARGC(4, 4); - - if (sscanf(argv[1], "%d", &a) != 1 || - sscanf(argv[3], "%d", &b) != 1) - { - return CLI_INVALID_ARG; - } - - op = argv[2]; - if (!strcmp(op, ">")) { - tst = (a > b); - } - else if (!strcmp(op, "<")) { - tst = (a < b); - } - else if (!strcmp(op, "==")) { - tst = (a == b); - } - else if (!strcmp(op, ">=")) { - tst = (a >= b); - } - else if (!strcmp(op, "<=")) { - tst = (a <= b); - } - else if (!strcmp(op, "!=")) { - tst = (a != b); - } - else { - return CLI_INVALID_ARG; - } - - return tst ? 0 : -1; -} - -/** if last command failed (return != 0), run - * ! - */ -static int cmd_failed(int argc, char *argv[]) -{ - const struct cli_command *cmd; - - CHK_ARGC(2, 0); - - cmd = cli_find(argv[1]); - if (cmd == NULL) { - MSG("Unknown command '%s'\n", argv[1]); - return -1; - } - else { - argv++; - return (cli_env_get('?') == 0 ? 0 : cmd->handler(argc - 1, argv)); - } -} - -/** print messages - * echo [ ...] - */ -static int cmd_echo(int argc, char *argv[]) -{ - int i; - - for (i = 1; i < argc; i++) { - MSG("%s%s", i > 1 ? " " : "", argv[i]); - } - MSG("\n"); - - return 0; -} - -/** set cli environment variable - * set - */ -static int cmd_set(int argc, char *argv[]) -{ - int val; - int ret = -1; - - CHK_ARGC(3, 0); - - if (sscanf(argv[2], "%d", &val) == 1) { - ret = cli_env_set(argv[1][0], val); - } - - return ret; -} - -/** evaluation the expresstion, result to $1 - * evl - */ -static int cmd_evl(int argc, char *argv[]) -{ - int val1, val2, result = 0; - int ret = -1; - - CHK_ARGC(4, 4); - - if (sscanf(argv[1], "%d", &val1) == 1 && - sscanf(argv[3], "%d", &val2) == 1) { - ret = 0; - switch(argv[2][0]) { - case '+': - result = val1 + val2; - break; - case '-': - result = val1 - val2; - break; - case '*': - result = val1 * val2; - break; - case '/': - if (val2 == 0) - ret = -1; - else - result = val1 / val2; - break; - case '%': - if (val2 == 0) - ret = -1; - else - result = val1 % val2; - break; - default: - ret = CLI_INVALID_ARG; - break; - } - } - - if (ret == 0) - ret = cli_env_set('1', result); - - return ret; -} - -static int cmd_exit(int argc, char *argv[]) -{ - m_exit = TRUE; - return 0; -} - -/** Abort current script - * abort [...] - */ -static int cmd_abort(int argc, char *argv[]) -{ - if (argc > 1) { - cmd_echo(argc, argv); - } - - m_abort = TRUE; - - return 0; -} - -/** run local file system's script - * script - */ -static int cmd_script(int argc, char *argv[]) -{ - char line_buf[256]; - char *p; - FILE *fp; - const char *name; - int ret = 0; - static int stack = 0; - - CHK_ARGC(2, 0); - - if (stack++ == 0) - m_abort = FALSE; - - name = argv[1]; - fp = fopen(name, "r"); - - if (fp) { - memset(line_buf, 0, sizeof(line_buf)); - while (!m_abort && fgets(line_buf, sizeof(line_buf) - 1, fp)) { - p = line_buf + sizeof(line_buf) - 1; - while (*p == 0 && p > line_buf) - p--; - while ((*p == '\r' || *p == '\n') && p > line_buf) { - *p-- = 0; - } - p = cli_process_line(line_buf); - if (*p) - ret = cli_interpret(p); - memset(line_buf, 0, sizeof(line_buf)); - } - fclose(fp); - } - else { - MSG("Can't open host script file '%s' for read\n", name); - ret = -1; - } - - stack--; - - return ret; -} - - - -static const struct cli_command default_cmds[] = -{ - { cmd_help, "help|?", "[]", "show commands or help on one command" }, - { cmd_exit, "exit", NULL, "exit command line" }, - { cmd_exec, "*", " [...]>", "run times" }, - { cmd_failed, "!", " [...]", "run if last command failed" }, - { cmd_echo, "echo", "[...]", "print messages" }, - { cmd_set, "set", " ", "set env variable" }, - { cmd_evl, "evl", " ", "evaluation expresstion" }, - { cmd_test, "test", " ", "test expression: " }, - { cmd_script, "script", "", "run host script " }, - { cmd_abort, "abort", NULL, "abort from the running script" }, - { NULL, NULL, NULL, NULL } -}; - -static struct cli_commandset default_cmdset = { - default_cmds, -}; - -static BOOL match_cmd(const char *src, int start, int end, const char *des) -{ - while (src[start] == ' ' && start < end) - start++; - - while (src[end] == ' ' && start < end) - end--; - - if ((int)strlen(des) == (end - start + 1)) { - if (memcmp(src + start, des, end - start + 1) == 0) { - return TRUE; - } - } - - return FALSE; -} - -static BOOL check_cmd(const char *cmds, const char *cmd) -{ - int start, end; - - for (start = end = 0; cmds[end] != 0 && cmds[end] != '|'; end++); - - while (end > start) { - if (match_cmd(cmds, start, end - 1, cmd) == TRUE) - return TRUE; - if (cmds[end] == 0) - break; - if (cmds[end] == '|') { - end++; - for (start = end; cmds[end] != 0 && cmds[end] != '|'; end++); - } - } - - return FALSE; -} - -static const struct cli_command * cli_find(const char *cmd) -{ - struct cli_commandset *work; - const struct cli_command *s; - - FOR_EACH_CLI_CMD(work, s) { - if (check_cmd(s->cmd, cmd) == TRUE) - return s; - } - - return NULL; -} - -static void show_cmd_usage(const struct cli_command *cmd) -{ - MSG("%s: %s\n", cmd->cmd, cmd->descr); - MSG("Usage: %s %s\n", cmd->cmd, cmd->args ? cmd->args : ""); -} - -static int cmd_help(int argc, char *argv[]) -{ - const struct cli_command *cmd; - struct cli_commandset *cmdset; - int i, n; - - if (argc < 2) { - MSG("Available commands:\n"); - n = 0; - FOR_EACH_CLI_CMD(cmdset, cmd) { - MSG("%s", cmd->cmd); - for (i = strlen(cmd->cmd); i%10; i++, MSG(" ")); - if ((++n % 5) == 0) MSG("\n"); - } - MSG("\n"); - } - else { - cmd = cli_find(argv[1]); - if (cmd == NULL) { - MSG("No such command\n"); - return -1; - } - else { - show_cmd_usage(cmd); - } - } - - return 0; -} - -static void cli_parse_args(const char *cmd, struct cli_arg *arg) -{ - char *p; - int val; - - if (arg) { - arg->argc = 0; - if (cmd) { - p = arg->_buf; - while (*cmd && arg->argc < MAX_CLI_ARGS_NUM && (p - arg->_buf < MAX_CLI_ARGS_BUF_LEN)) { - while(*cmd && (*cmd == ' ' || *cmd == '\t')) - cmd++; - - arg->argv[arg->argc] = p; - while (*cmd && (*cmd != ' ' && *cmd != '\t') && (p - arg->_buf < MAX_CLI_ARGS_BUF_LEN)) { - if (*cmd == '$') { - // command env replacement - cmd++; - val = cli_env_get(*cmd++); - if (p - arg->_buf < MAX_CLI_ARGS_BUF_LEN - 12) { // 12 is long enough for 32bit 'int' - p += sprintf(p, "%d", val & 0xFFFFFFFF); - } - } - else - *p++ = *cmd++; - } - *p++ = '\0'; - - if (*(arg->argv[arg->argc]) == '\0') - break; - arg->argc++; - } - } - } -} - -int cli_interpret(const char *line) -{ - struct cli_arg arg = {0}; - const struct cli_command *cmd; - int ret = -1; - - cli_parse_args(line, &arg); - - if (arg.argc > 0) { - cmd = cli_find(arg.argv[0]); - if (cmd == NULL) { - MSG("Unknown command '%s'\n", arg.argv[0]); - } - else { - ret = cmd->handler(arg.argc, arg.argv); - if (ret == CLI_INVALID_ARG) { - MSG("\n"); - show_cmd_usage(cmd); - } - } - } - - cli_env_set('?', ret); // $? = last command return code - - return ret; -} - -void cli_add_commandset(struct cli_commandset *set) -{ - if (set) { - set->next = m_cmdset_head; - m_cmdset_head = set; - } -} - -void cli_main_entry() -{ - char line[80]; - int linelen = 0; - char *p; - - MSG("$ "); - cli_add_commandset(&default_cmdset); - - while (!m_exit) { - char ch; - if (linelen >= sizeof(line)) - continue; - ch = getc(stdin); - switch (ch) { - case 8: - case 127: - if (linelen > 0) { - --linelen; - MSG("\x08 \x08"); - } - break; - - case '\r': - case '\n': - //MSG("\r\n"); - if (linelen > 0) { - line[linelen] = 0; - p = cli_process_line(line); - if (*p) - cli_interpret(p); - linelen = 0; - } - MSG("$ "); - break; - - case 21: - while (linelen > 0) { - --linelen; - MSG("\x08 \x08"); - } - break; - - default: - if (ch >= ' ' && ch < 127 && linelen < sizeof(line) - 1) { - line[linelen++] = ch; - //MSG("%c", ch); - } - } - } -} diff --git a/components/dfs/filesystems/uffs/src/emu/cmdline.h b/components/dfs/filesystems/uffs/src/emu/cmdline.h deleted file mode 100644 index 284d68eae..000000000 --- a/components/dfs/filesystems/uffs/src/emu/cmdline.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - - -#ifndef _UFFS_CLI_H_ -#define _UFFS_CLI_H_ - -#ifndef BOOL -#define BOOL int -#endif - -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef FALSE -#define FALSE 0 -#endif - -#define CLI_INVALID_ARG -100 - -typedef int command_t(int argc, char *argv[]); - -struct cli_command { - command_t *handler; - const char *cmd; - const char *args; - const char *descr; -}; - -struct cli_commandset { - const struct cli_command *cmds; - struct cli_commandset *next; -}; - -void cli_add_commandset(struct cli_commandset *set); -int cli_interpret(const char *line); -int cli_env_get(char env); -int cli_env_set(char env, int val); -void cli_main_entry(); - -#define u_assert(x) \ - ((x) ? TRUE : \ - (uffs_PerrorRaw(UFFS_MSG_NORMAL, \ - "Assert failed at %s:%s:%d: '%s' is not true.\n", \ - __FILE__, __FUNCTION__, __LINE__, #x), FALSE)) - - -#define CHK_ARGC(min, max) \ - if (argc < min || (max > 0 && argc > max)) \ - return CLI_INVALID_ARG - -#endif - - diff --git a/components/dfs/filesystems/uffs/src/emu/helper_cmds.c b/components/dfs/filesystems/uffs/src/emu/helper_cmds.c deleted file mode 100644 index 1526c441c..000000000 --- a/components/dfs/filesystems/uffs/src/emu/helper_cmds.c +++ /dev/null @@ -1,694 +0,0 @@ -/* - This file is part of UFFS, the Ultra-low-cost Flash File System. - - Copyright (C) 2005-2009 Ricky Zheng - - UFFS is free software; you can redistribute it and/or modify it under - the GNU Library General Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) any - later version. - - UFFS is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - or GNU Library General Public License, as applicable, for more details. - - You should have received a copy of the GNU General Public License - and GNU Library General Public License along with UFFS; if not, write - to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - - As a special exception, if other files instantiate templates or use - macros or inline functions from this file, or you compile this file - and link it with other works to produce a work based on this file, - this file does not by itself cause the resulting work to be covered - by the GNU General Public License. However the source code for this - file must still be made available in accordance with section (3) of - the GNU General Public License v2. - - This exception does not invalidate any other reasons why a work based - on this file might be covered by the GNU General Public License. -*/ - -/** - * \file helper_cmds.c - * \brief helper commands for test uffs - * \author Ricky Zheng - */ -#include -#include -#include -#include -#include "uffs_config.h" -#include "uffs/uffs_public.h" -#include "uffs/uffs_fs.h" -#include "uffs/uffs_utils.h" -#include "uffs/uffs_core.h" -#include "uffs/uffs_mtb.h" -#include "uffs/uffs_find.h" -#include "cmdline.h" -#include "uffs/uffs_fd.h" -#include "uffs/uffs_mtb.h" -#include "uffs_fileem.h" - -#define PFX "cmd : " - -#define MAX_PATH_LENGTH 128 - -#define MSGLN(msg,...) uffs_Perror(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) -#define MSG(msg,...) uffs_PerrorRaw(UFFS_MSG_NORMAL, msg, ## __VA_ARGS__) - -/** format [] */ -static int cmd_format(int argc, char *argv[]) -{ - URET ret; - const char *mount = "/"; - uffs_Device *dev; - UBOOL force = U_FALSE; - - if (argc > 1) { - mount = argv[1]; - if (argc > 2 && strcmp(argv[2], "-f") == 0) - force = U_TRUE; - } - MSGLN("Formating %s ... ", mount); - - dev = uffs_GetDeviceFromMountPoint(mount); - if (dev == NULL) { - MSGLN("Can't get device from mount point."); - return -1; - } - else { - ret = uffs_FormatDevice(dev, force); - if (ret != U_SUCC) { - MSGLN("Format fail."); - return -1; - } - else { - MSGLN("Format succ."); - } - uffs_PutDevice(dev); - } - - return 0; -} - -/** mkf */ -static int cmd_mkf(int argc, char *argv[]) -{ - int fd; - const char *name; - int oflags = UO_RDWR | UO_CREATE; - - CHK_ARGC(2, 2); - - name = argv[1]; - fd = uffs_open(name, oflags); - if (fd < 0) { - MSGLN("Create %s fail, err: %d", name, uffs_get_error()); - return -1; - } - else { - MSGLN("Create %s succ.", name); - uffs_close(fd); - } - - return 0; -} - -/** mkdir