From 8e4bff4cab0ddac6060645b0715210484d02ff40 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Wed, 30 Aug 2017 08:25:59 +0000 Subject: Initial file dump from open source release --- drivers/misc/sdiodev/sdio_dev_test.c | 1219 ++++++++++++++++++++++++++++++++++ 1 file changed, 1219 insertions(+) create mode 100644 drivers/misc/sdiodev/sdio_dev_test.c (limited to 'drivers/misc/sdiodev/sdio_dev_test.c') diff --git a/drivers/misc/sdiodev/sdio_dev_test.c b/drivers/misc/sdiodev/sdio_dev_test.c new file mode 100644 index 00000000..31385b0a --- /dev/null +++ b/drivers/misc/sdiodev/sdio_dev_test.c @@ -0,0 +1,1219 @@ +/* + * Copyright (C) 2013 Spreadtrum Communications Inc. + * + * Filename : sdio_dev_test.c + * Abstract : This file is a implementation for itm sipc command/event function + * + * Authors : gaole.zhang + * + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + + * 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. + */ + +#include "sdio_dev.h" + + +#if defined(SDIO_TEST_CASE1) + +#define SEND_BUF_LEN 1024//SDIO_TEST_CASE1 + +char *data_send_ptr[17] = {0}; + + +static void test_sdio_send_func(int chn,int senddatalen,void* data_buf) +{ + + uint32 chndatalen,ret; + + char *tmp = (char*)data_buf; + + //SDIOTRAN_ERR("\nrun to test_sdio_send_func,senddatalen is %d!!!\n",senddatalen); + SDIOTRAN_ERR("entry"); + + + + set_marlin_wakeup(chn,1); + + + + if(!sdio_dev_chn_idle(chn)) + { + SDIOTRAN_ERR("send chn active,can't send right now,chn is %d!!!",chn); + return; + } + + + chndatalen = sdio_dev_get_chn_datalen(chn); + if(senddatalen > chndatalen) + { + SDIOTRAN_ERR("channel %d chndatalen is =%d,senddatalen is =%d, can't send!!",chn,chndatalen,senddatalen); + return; + } + + SDIOTRAN_ERR("ap chn %d send len %d data: %d,%d,%d,%d %d,%d,%d,%d %d,%d,%d,%d!!!",chn,senddatalen,\ + tmp[0],\ + tmp[1],\ + tmp[2],\ + tmp[3], \ + tmp[101], \ + tmp[102], \ + tmp[103], \ + tmp[104], \ + tmp[230], \ + tmp[231], \ + tmp[232], \ + tmp[233] \ + ); + + sdio_dev_write(chn,data_buf,senddatalen); + set_marlin_sleep(chn,1); + + +} + + + +static int gaole_test_thread(void *data) +{ + int i,j,k; + + struct sched_param param = {.sched_priority = 90}; + + /*set the thread as a real time thread, and its priority is 90*/ + sched_setscheduler(current, SCHED_RR, ¶m); + + /*for(i=0;i<16;i++){ + + data_send_ptr[i] = kmalloc(SEND_BUF_LEN,GFP_KERNEL); + if (NULL == data_send_ptr[i]) + { + SDIOTRAN_ERR("kmalloc send buf%d err!!!",i); + return -1; + } + + SDIOTRAN_DEBUG("kmalloc send buf%d ok!!!",i); + + for(j=0,k=0;j 8192) + break; + + test_sdio_send_func(j,(32< 50) + break; + + if(invalid_num > 50) + break; + } + + return 0; +} + +void gaole_creat_test(void) +{ + struct task_struct * task; + + task = kthread_create(gaole_test_thread, NULL, "GaoleTest"); + if(0 != task) + wake_up_process(task); +} + + + +#endif//SDIO_TEST_CASE2 + + + +#if defined(SDIO_TEST_CASE4) + +#define BUF_LEN 1024//SDIO_TEST_CASE4 + +char *data_ptr[10] = {0}; + +bool continue_send = 1; + +static int test_send_chn = 0; + + + +static void test_sdio_send_func(int chn,void* data_buf) +{ + + uint32 datalen; + + char *tmp = (char*)data_buf; + + //SDIOTRAN_ERR("\nrun to test_sdio_send_func!!!\n"); + + while(!sdio_dev_chn_idle(chn)); + + while(1) + { + datalen = sdio_dev_get_chn_datalen(chn); + if(datalen) + { + SDIOTRAN_ERR("channel %d len is =%d!!!",chn,datalen); + break; + } + else + SDIOTRAN_ERR("channel %d len is =%d!!!",chn,datalen); + + } + + SDIOTRAN_ERR("ap %d send data: %d,%d,%d,%d %d,%d,%d,%d %d,%d,%d,%d!!!",chn,\ + tmp[0],\ + tmp[1],\ + tmp[2],\ + tmp[3], \ + tmp[101], \ + tmp[102], \ + tmp[103], \ + tmp[104], \ + tmp[230], \ + tmp[231], \ + tmp[232], \ + tmp[233] \ + ); + + sdio_dev_write(chn,data_buf,datalen); + +} + +void case4_workq_handler(void) +{ + int i; + + int read_chn = 0; + int datalen = 0; + + read_chn = sdio_dev_get_read_chn(); + + if(-1 == read_chn) + return; + + + SDIOTRAN_DEBUG("ap recv: active_chn is %d!!!",read_chn); + + + for(i=0;i