Remove obsolete chibios block devices
authorgkostka <kostka.grzegorz@gmail.com>
Fri, 13 Nov 2015 21:09:07 +0000 (22:09 +0100)
committergkostka <kostka.grzegorz@gmail.com>
Fri, 13 Nov 2015 21:10:18 +0000 (22:10 +0100)
blockdev/CMakeLists.txt
blockdev/chibios/sdc_lwext4.c [deleted file]
blockdev/chibios/sdc_lwext4.h [deleted file]
blockdev/chibios/spi_lwext4.c [deleted file]
blockdev/chibios/spi_lwext4.h [deleted file]
blockdev/chibios/timings.c [deleted file]

index 2099d503a4484fad0fa6331fde4de53639622b41..9f195afdd61dd24e05b6a6c96e4304f652a3e285 100644 (file)
@@ -4,12 +4,9 @@ if    (BLOCKDEV_TYPE STREQUAL  linux)
 aux_source_directory(linux BLOCKDEV_SRC)\r
 elseif    (BLOCKDEV_TYPE STREQUAL  windows)\r
 aux_source_directory(windows BLOCKDEV_SRC)\r
-elseif    (BLOCKDEV_TYPE STREQUAL  chibios)\r
-aux_source_directory(chibios BLOCKDEV_SRC)\r
 else()\r
 endif()\r
 \r
 aux_source_directory(. BLOCKDEV_SRC)\r
-\r
 add_library(blockdev  ${BLOCKDEV_SRC})\r
 \r
diff --git a/blockdev/chibios/sdc_lwext4.c b/blockdev/chibios/sdc_lwext4.c
deleted file mode 100644 (file)
index e558ab0..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*\r
- * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com)\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- *\r
- * - Redistributions of source code must retain the above copyright\r
- *   notice, this list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright\r
- *   notice, this list of conditions and the following disclaimer in the\r
- *   documentation and/or other materials provided with the distribution.\r
- * - The name of the author may not be used to endorse or promote products\r
- *   derived from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-\r
-#include "sdc_lwext4.h"\r
-\r
-#include <config.h>\r
-#include <ext4_config.h>\r
-#include <ext4_blockdev.h>\r
-#include <ext4_errno.h>\r
-#include <stdio.h>\r
-#include <stdbool.h>\r
-#include <string.h>\r
-#include <fcntl.h>\r
-\r
-#include <hal.h>\r
-#include <sdc.h>\r
-\r
-\r
-/**@brief   Block size.*/\r
-#define SDC_BLOCK_SIZE 512\r
-\r
-/**@brief   MBR_block ID*/\r
-#define MBR_BLOCK_ID 0\r
-#define MBR_PART_TABLE_OFF 446\r
-\r
-struct part_tab_entry {\r
-       uint8_t status;\r
-       uint8_t chs1[3];\r
-       uint8_t type;\r
-       uint8_t chs2[3];\r
-       uint32_t first_lba;\r
-       uint32_t sectors;\r
-} __attribute__((packed));\r
-\r
-/**@brief   Partition block offset*/\r
-static uint32_t part_offset;\r
-\r
-/**@brief IO timings*/\r
-struct sdc_io_timings {\r
-       uint64_t acc_bread;\r
-       uint64_t acc_bwrite;\r
-\r
-       uint32_t cnt_bread;\r
-       uint32_t cnt_bwrite;\r
-\r
-       uint32_t av_bread;\r
-       uint32_t av_bwrite;\r
-};\r
-\r
-static struct sdc_io_timings io_timings;\r
-\r
-void io_timings_clear(void)\r
-{\r
-       memset(&io_timings, 0, sizeof(struct sdc_io_timings));\r
-}\r
-\r
-const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms)\r
-{\r
-       static struct ext4_io_stats s;\r
-\r
-       s.io_read = (((float)io_timings.acc_bread * 100.0) / time_sum_ms);\r
-       s.io_read /= 1000.0;\r
-\r
-       s.io_write = (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);\r
-       s.io_write /= 1000.0;\r
-\r
-       s.cpu = 100.0 - s.io_read - s.io_write;\r
-\r
-       return &s;\r
-}\r
-\r
-/**********************BLOCKDEV INTERFACE**************************************/\r
-static int sdc_open(struct ext4_blockdev *bdev);\r
-static int sdc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,\r
-                    uint32_t blk_cnt);\r
-static int sdc_bwrite(struct ext4_blockdev *bdev, const void *buf,\r
-                     uint64_t blk_id, uint32_t blk_cnt);\r
-static int sdc_close(struct ext4_blockdev *bdev);\r
-\r
-/******************************************************************************/\r
-EXT4_BLOCKDEV_STATIC_INSTANCE(_sdc, SDC_BLOCK_SIZE, 0, sdc_open, sdc_bread,\r
-                             sdc_bwrite, sdc_close);\r
-\r
-/******************************************************************************/\r
-EXT4_BCACHE_STATIC_INSTANCE(_sdc_cache, CONFIG_BLOCK_DEV_CACHE_SIZE,\r
-                           EXT_LOGICAL_BLOCK_SIZE);\r
-\r
-/******************************************************************************/\r
-\r
-static int sdc_open(struct ext4_blockdev *bdev)\r
-{\r
-       (void)bdev;\r
-\r
-       static uint8_t mbr[512];\r
-       struct part_tab_entry *part0;\r
-\r
-       sdcStart(&SDCD1, NULL);\r
-\r
-       if (sdcConnect(&SDCD1) != HAL_SUCCESS)\r
-               return EIO;\r
-\r
-       if (sdcRead(&SDCD1, 0, mbr, 1) != HAL_SUCCESS)\r
-               return EIO;\r
-\r
-       part0 = (struct part_tab_entry *)(mbr + MBR_PART_TABLE_OFF);\r
-\r
-       part_offset = part0->first_lba;\r
-       _sdc.ph_bcnt = SDCD1.capacity * SDC_BLOCK_SIZE;\r
-\r
-       return EOK;\r
-}\r
-\r
-static int sdc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,\r
-                    uint32_t blk_cnt)\r
-{\r
-       (void)bdev;\r
-       bool status;\r
-       uint64_t v = tim_get_us();\r
-\r
-       status = sdcRead(&SDCD1, blk_id, buf, blk_cnt);\r
-       if (status != HAL_SUCCESS)\r
-               return EIO;\r
-\r
-       io_timings.acc_bread += tim_get_us() - v;\r
-       io_timings.cnt_bread++;\r
-       io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread;\r
-\r
-       return EOK;\r
-}\r
-\r
-static int sdc_bwrite(struct ext4_blockdev *bdev, const void *buf,\r
-                     uint64_t blk_id, uint32_t blk_cnt)\r
-{\r
-       (void)bdev;\r
-       bool status;\r
-       uint64_t v = tim_get_us();\r
-\r
-       status = sdcWrite(&SDCD1, blk_id, buf, blk_cnt);\r
-       if (status != HAL_SUCCESS)\r
-               return EIO;\r
-\r
-       io_timings.acc_bwrite += tim_get_us() - v;\r
-       io_timings.cnt_bwrite++;\r
-       io_timings.av_bwrite = io_timings.acc_bwrite / io_timings.cnt_bwrite;\r
-\r
-       return EOK;\r
-}\r
-\r
-static int sdc_close(struct ext4_blockdev *bdev)\r
-{\r
-       (void)bdev;\r
-       return EOK;\r
-}\r
-\r
-/******************************************************************************/\r
-\r
-struct ext4_bcache *sdc_cache_get(void) { return &_sdc_cache; }\r
-\r
-struct ext4_blockdev *sdc_bdev_get(void) { return &_sdc; }\r
diff --git a/blockdev/chibios/sdc_lwext4.h b/blockdev/chibios/sdc_lwext4.h
deleted file mode 100644 (file)
index f70194a..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
- * Copyright (c) 2014 Grzegorz Kostka (kostka.grzegorz@gmail.com)\r
- * All rights reserved.\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- *\r
- * - Redistributions of source code must retain the above copyright\r
- *   notice, this list of conditions and the following disclaimer.\r
- * - Redistributions in binary form must reproduce the above copyright\r
- *   notice, this list of conditions and the following disclaimer in the\r
- *   documentation and/or other materials provided with the distribution.\r
- * - The name of the author may not be used to endorse or promote products\r
- *   derived from this software without specific prior written permission.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\r
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\r
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\r
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\r
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\r
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
- */\r
-#ifndef SDC_LWEXT4_H_\r
-#define SDC_LWEXT4_H_\r
-\r
-#include <config.h>\r
-#include <ext4_config.h>\r
-#include <ext4_blockdev.h>\r
-\r
-#include <stdint.h>\r
-#include <stdbool.h>\r
-\r
-/**@brief   SDC cache get.*/\r
-struct ext4_bcache *sdc_cache_get(void);\r
-\r
-/**@brief   SDC blockdev get.*/\r
-struct ext4_blockdev *sdc_bdev_get(void);\r
-\r
-\r
-#endif /* CHIBI_SDC_LWEXT4_H_ */\r
diff --git a/blockdev/chibios/spi_lwext4.c b/blockdev/chibios/spi_lwext4.c
deleted file mode 100644 (file)
index 4181df2..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   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 OF SUCH DAMAGE.
- */
-
-#include "spi_lwext4.h"
-
-#include <config.h>
-#include <ext4_config.h>
-#include <ext4_blockdev.h>
-#include <ext4_errno.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <fcntl.h>
-
-#include <hal.h>
-#include <mmc_spi.h>
-
-
-#if HAL_USE_MMC_SPI
-extern MMCDriver MMCD1;
-#endif
-
-/**@brief   Block size.*/
-#define SPI_BLOCK_SIZE 512
-
-/**@brief   MBR_block ID*/
-#define MBR_BLOCK_ID 0
-#define MBR_PART_TABLE_OFF 446
-
-struct part_tab_entry {
-       uint8_t status;
-       uint8_t chs1[3];
-       uint8_t type;
-       uint8_t chs2[3];
-       uint32_t first_lba;
-       uint32_t sectors;
-} __attribute__((packed));
-
-/**@brief   Partition block offset*/
-static uint32_t part_offset;
-
-/**@brief IO timings*/
-struct spi_io_timings {
-       uint64_t acc_bread;
-       uint64_t acc_bwrite;
-
-       uint32_t cnt_bread;
-       uint32_t cnt_bwrite;
-
-       uint32_t av_bread;
-       uint32_t av_bwrite;
-};
-
-static struct spi_io_timings io_timings;
-
-void io_timings_clear(void)
-{
-       memset(&io_timings, 0, sizeof(struct spi_io_timings));
-}
-
-const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms)
-{
-       static struct ext4_io_stats s;
-
-       s.io_read = (((float)io_timings.acc_bread * 100.0) / time_sum_ms);
-       s.io_read /= 1000.0;
-
-       s.io_write = (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms);
-       s.io_write /= 1000.0;
-
-       s.cpu = 100.0 - s.io_read - s.io_write;
-
-       return &s;
-}
-
-/**********************BLOCKDEV INTERFACE**************************************/
-static int spi_open(struct ext4_blockdev *bdev);
-static int spi_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
-                    uint32_t blk_cnt);
-static int spi_bwrite(struct ext4_blockdev *bdev, const void *buf,
-                     uint64_t blk_id, uint32_t blk_cnt);
-static int spi_close(struct ext4_blockdev *bdev);
-
-/******************************************************************************/
-EXT4_BLOCKDEV_STATIC_INSTANCE(_spi, SPI_BLOCK_SIZE, 0, spi_open, spi_bread,
-                             spi_bwrite, spi_close);
-
-/******************************************************************************/
-EXT4_BCACHE_STATIC_INSTANCE(_spi_cache, CONFIG_BLOCK_DEV_CACHE_SIZE,
-                           EXT_LOGICAL_BLOCK_SIZE);
-
-/******************************************************************************/
-
-static int spi_open(struct ext4_blockdev *bdev)
-{
-
-       (void)bdev;
-
-       static uint8_t mbr[512];
-       struct part_tab_entry *part0;
-
-       if (mmcConnect(&MMCD1) != HAL_SUCCESS)
-               return EIO;
-
-       if (mmcStartSequentialRead(&MMCD1, 0) != HAL_SUCCESS)
-               return EIO;
-
-       if (mmcSequentialRead(&MMCD1, mbr) != HAL_SUCCESS)
-               return EIO;
-
-       if (mmcStopSequentialRead(&MMCD1) != HAL_SUCCESS)
-               return EIO;
-
-       part0 = (struct part_tab_entry *)(mbr + MBR_PART_TABLE_OFF);
-
-       part_offset = part0->first_lba;
-       _spi.ph_bcnt = MMCD1.capacity * SPI_BLOCK_SIZE;
-
-       return EOK;
-}
-
-static int spi_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id,
-                    uint32_t blk_cnt)
-{
-       (void)bdev;
-       uint64_t v = tim_get_us();
-
-       if (mmcStartSequentialRead(&MMCD1, blk_id) != HAL_SUCCESS)
-               return EIO;
-
-       while (blk_cnt) {
-               if (mmcSequentialRead(&MMCD1, buf) != HAL_SUCCESS)
-                       return EIO;
-
-               buf += SPI_BLOCK_SIZE;
-               blk_cnt--;
-       }
-
-       if (mmcStopSequentialRead(&MMCD1) != HAL_SUCCESS)
-               return EIO;
-
-       io_timings.acc_bread += tim_get_us() - v;
-       io_timings.cnt_bread++;
-       io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread;
-
-       return EOK;
-}
-
-static int spi_bwrite(struct ext4_blockdev *bdev, const void *buf,
-                     uint64_t blk_id, uint32_t blk_cnt)
-{
-       (void)bdev;
-       uint64_t v = tim_get_us();
-
-       if (mmcStartSequentialWrite(&MMCD1, blk_id) != HAL_SUCCESS)
-               return EIO;
-
-       while (blk_cnt) {
-               if (mmcSequentialWrite(&MMCD1, buf) != HAL_SUCCESS)
-                       return EIO;
-
-               buf += SPI_BLOCK_SIZE;
-               blk_cnt--;
-       }
-
-       if (mmcStopSequentialWrite(&MMCD1) != HAL_SUCCESS)
-               return EIO;
-
-       io_timings.acc_bwrite += tim_get_us() - v;
-       io_timings.cnt_bwrite++;
-       io_timings.av_bwrite = io_timings.acc_bwrite / io_timings.cnt_bwrite;
-
-       return EOK;
-}
-
-static int spi_close(struct ext4_blockdev *bdev)
-{
-       (void)bdev;
-       return EOK;
-}
-
-/******************************************************************************/
-
-struct ext4_bcache *spi_cache_get(void) { return &_spi_cache; }
-
-struct ext4_blockdev *spi_bdev_get(void) { return &_spi; }
diff --git a/blockdev/chibios/spi_lwext4.h b/blockdev/chibios/spi_lwext4.h
deleted file mode 100644 (file)
index 292c4f0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * spi_lwext4.h
- *
- *  Created on: 21 gru 2014
- *      Author: gko
- */
-
-#ifndef SPI_LWEXT4_H_
-#define SPI_LWEXT4_H_
-
-#include <config.h>
-#include <ext4_config.h>
-#include <ext4_blockdev.h>
-
-#include <stdint.h>
-#include <stdbool.h>
-
-/**@brief   SPI cache get.*/
-struct ext4_bcache *spi_cache_get(void);
-
-/**@brief   SPI blockdev get.*/
-struct ext4_blockdev *spi_bdev_get(void);
-
-#endif /* SPI_LWEXT4_H_ */
diff --git a/blockdev/chibios/timings.c b/blockdev/chibios/timings.c
deleted file mode 100644 (file)
index 26294ce..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2014 Grzegorz Kostka (kostka.grzegorz@gmail.com)
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - 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.
- * - The name of the author may not be used to endorse or promote products
- *   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 OF SUCH DAMAGE.
- */
-
-#include "../test_lwext4.h"
-
-#include <config.h>
-
-#include <ch.h>
-#include <chvt.h>
-
-
-void tim_wait_ms(uint32_t v) { chThdSleepMilliseconds(v); }
-
-uint64_t tim_get_us(void)
-{
-       uint64_t v = chVTGetSystemTimeX();
-       return ST2US(v);
-}
-
-uint32_t tim_get_ms(void)
-{
-       uint32_t v = chVTGetSystemTimeX();
-       return ST2MS(v);
-}