Yes, Please find the attachment for the user space application. On Thu, Nov 17, 2011 at 5:50 PM, S, Venkatraman <svenkatr@xxxxxx> wrote: > On Thu, Nov 17, 2011 at 4:48 PM, Shashidhar Hiremath > <shashidharh@xxxxxxxxxxxxxxx> wrote: >> Hi Venkatraman, >> If I understand correctly, You want the test_cmds.c file to be >> compiled conditionally based on the menuconfig option for >> CONFIG_MMC_TEST right ? > > Yes. > BTW, do you have any user space utilities for testing this ? > I'd be inclined to give it a run. > >> >> On Thu, Nov 17, 2011 at 4:04 PM, S, Venkatraman <svenkatr@xxxxxx> wrote: >>> On Wed, Nov 16, 2011 at 4:38 PM, Shashidhar Hiremath >>> <shashidharh@xxxxxxxxxxxxxxx> wrote: >>>> The patch provides An infrastructure to test commands other than Read/Write commands using the IOCTL interface.The Patch can be useful incase of validating the device to verify whether device support a given command or not. The result of the sent command will be written to the result element of the mmc_ioc_cmd structure passed through IOCTL interface. >>>> >>>> Signed-off-by: Shashidhar Hiremath <shashidharh@xxxxxxxxxxxxxxx> >>>> --- >>>> drivers/mmc/card/Makefile | 2 +- >>>> drivers/mmc/card/block.c | 28 ++ >>>> drivers/mmc/card/test_cmds.c | 743 ++++++++++++++++++++++++++++++++++++++++++ >>>> drivers/mmc/card/test_cmds.h | 53 +++ >>>> drivers/mmc/core/core.c | 4 + >>>> drivers/mmc/core/mmc.c | 4 + >>>> drivers/mmc/core/mmc_ops.c | 1 + >>>> drivers/mmc/core/sd.c | 2 + >>>> include/linux/mmc/ioctl.h | 1 + >>>> 9 files changed, 837 insertions(+), 1 deletions(-) >>>> create mode 100644 drivers/mmc/card/test_cmds.c >>>> create mode 100644 drivers/mmc/card/test_cmds.h >>>> >>>> diff --git a/drivers/mmc/card/Makefile b/drivers/mmc/card/Makefile >>>> index c73b406..ea52ee1 100644 >>>> --- a/drivers/mmc/card/Makefile >>>> +++ b/drivers/mmc/card/Makefile >>>> @@ -3,7 +3,7 @@ >>>> # >>>> >>>> obj-$(CONFIG_MMC_BLOCK) += mmc_block.o >>>> -mmc_block-objs := block.o queue.o >>>> +mmc_block-objs := block.o queue.o test_cmds.o >>> >>> Why should it be included by default ? >>> I think it belongs under CONFIG_MMC_TEST >>> >>>> obj-$(CONFIG_MMC_TEST) += mmc_test.o >>>> >>> >> >> >> >> -- >> regards, >> Shashidhar Hiremath >> > -- regards, Shashidhar Hiremath
#include <stdio.h> #include <fcntl.h> #include <errno.h> #include <linux/mmc/ioctl.h> #include <sys/ioctl.h> #define DEV_NAME "/dev/mmcblk0" #define MMC_BLOCK_MAJOR 179 static struct mmc_ioc_cmd mmc_local_cmd; int main(void) { int fd, ret_val,opcode; printf("Please Enter the Command Index to be tested \n"); scanf("%d",&opcode); mmc_local_cmd.opcode = opcode, mmc_local_cmd.write_flag = 2, mmc_local_cmd.data_ptr = (int)NULL, fd = open(DEV_NAME, O_RDWR); if (fd < 0) { printf("cannot open device file: %s\n", DEV_NAME); return -1; } ioctl(fd,MMC_IOC_CMD,&mmc_local_cmd); if(mmc_local_cmd.result == 0) printf("\nResult: OK\nTest Passed"); else if(mmc_local_cmd.result == 1) printf("\nResult: Failed"); else if(mmc_local_cmd.result == 2) printf("\nResult: Command Not Supported"); else if(mmc_local_cmd.result == 3) printf("\nResult: Card Not Supported"); else { printf("\nResult:ERROR %d Occured",mmc_local_cmd.result); printf("\nResult: Please see Kernel log messages for detail"); } close(fd); return 0; }