summaryrefslogtreecommitdiff
path: root/components/drivers/sdio/block_dev.c
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2018-09-11 19:03:10 +0800
committerGitHub <[email protected]>2018-09-11 19:03:10 +0800
commit8c2448a4d40ace5187efeabb8d3ed164a6fe87e5 (patch)
tree2ec30c58a711626518c4c2e3496a99c6b0208c49 /components/drivers/sdio/block_dev.c
parent1d6fad9d2f7edf5d56d4b8499fd5d0266703ad0c (diff)
parent2c01189114ed19785af24806c89672e4cf907d54 (diff)
Merge pull request #1774 from EvalZero/sdio_dev
[DeviceDriver][SDIO] Update sdio debug log.
Diffstat (limited to 'components/drivers/sdio/block_dev.c')
-rw-r--r--components/drivers/sdio/block_dev.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/components/drivers/sdio/block_dev.c b/components/drivers/sdio/block_dev.c
index 34aa42eacd..6a55e85a3d 100644
--- a/components/drivers/sdio/block_dev.c
+++ b/components/drivers/sdio/block_dev.c
@@ -27,6 +27,16 @@
#include <drivers/mmcsd_core.h>
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "[SDIO]"
+#ifdef RT_SDIO_DEBUG
+#define DBG_LEVEL DBG_LOG
+#else
+#define DBG_LEVEL DBG_INFO
+#endif /* RT_SDIO_DEBUG */
+#define DBG_COLOR
+#include <rtdbg.h>
+
static rt_list_t blk_devices = RT_LIST_OBJECT_INIT(blk_devices);
#define BLK_MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -182,7 +192,7 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card,
err = mmcsd_send_cmd(card->host, &cmd, 5);
if (err)
{
- rt_kprintf("error %d requesting status\n", err);
+ LOG_E("error %d requesting status", err);
break;
}
/*
@@ -198,8 +208,8 @@ static rt_err_t rt_mmcsd_req_blk(struct rt_mmcsd_card *card,
if (cmd.err || data.err || stop.err)
{
- rt_kprintf("mmcsd request blocks error\n");
- rt_kprintf("%d,%d,%d, 0x%08x,0x%08x\n",
+ LOG_E("mmcsd request blocks error");
+ LOG_E("%d,%d,%d, 0x%08x,0x%08x",
cmd.err, data.err, stop.err, data.flags, sector);
return -RT_ERROR;
@@ -338,7 +348,7 @@ static rt_int32_t mmcsd_set_blksize(struct rt_mmcsd_card *card)
if (err)
{
- rt_kprintf("MMCSD: unable to set block size to %d: %d\n", cmd.arg, err);
+ LOG_E("MMCSD: unable to set block size to %d: %d", cmd.arg, err);
return -RT_ERROR;
}
@@ -373,13 +383,13 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
return err;
}
- rt_kprintf("probe mmcsd block device!\n");
+ LOG_I("probe mmcsd block device!");
/* get the first sector to read partition table */
sector = (rt_uint8_t *)rt_malloc(SECTOR_SIZE);
if (sector == RT_NULL)
{
- rt_kprintf("allocate partition sector buffer failed\n");
+ LOG_E("allocate partition sector buffer failed!");
return -RT_ENOMEM;
}
@@ -392,7 +402,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
blk_dev = rt_calloc(1, sizeof(struct mmcsd_blk_device));
if (!blk_dev)
{
- rt_kprintf("mmcsd:malloc memory failed!\n");
+ LOG_E("mmcsd:malloc memory failed!");
break;
}
@@ -480,7 +490,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
#ifdef RT_USING_DFS_MNTTABLE
if (0) // if (blk_dev)
{
- rt_kprintf("try to mount file system!\n");
+ LOG_I("try to mount file system!");
/* try to mount file system on this block device */
dfs_mount_device(&(blk_dev->dev));
}
@@ -489,7 +499,7 @@ rt_int32_t rt_mmcsd_blk_probe(struct rt_mmcsd_card *card)
}
else
{
- rt_kprintf("read mmcsd first sector failed\n");
+ LOG_E("read mmcsd first sector failed");
err = -RT_ERROR;
}