static ssize_t freqhopping_status_proc_write(struct file *file, const char *buffer, size_t count, loff_t *data) { int ret; char kbuf[256]; size_t len = 0; unsigned int p1,p2,p3,p4,p5,p6; struct freqhopping_ioctl fh_ctl; p1 = p2 = p3 = p4 = p5 = p6 = 0; FH_MSG("EN: %s",__func__); len = min(count, (sizeof(kbuf)-1)); if (count == 0)return -1; if(count > 255)count = 255; ret = copy_from_user(kbuf, buffer, count); if (ret < 0)return -1; kbuf[count] = '\0'; sscanf(kbuf, "%x %x", &p1, &p2); fh_ctl.pll_id = p2; fh_ctl.ssc_setting.df= 0; fh_ctl.ssc_setting.dt= 0; fh_ctl.ssc_setting.upbnd= 0; fh_ctl.ssc_setting.lowbnd= 0; if( p1 == 0){ mt_freqhopping_ioctl(NULL,FH_CMD_DISABLE,(unsigned long)(&fh_ctl)); } else{ mt_freqhopping_ioctl(NULL,FH_CMD_ENABLE,(unsigned long)(&fh_ctl)); } return count; }
static ssize_t freqhopping_debug_proc_write(struct file *file, const char *buffer, size_t count, loff_t *data) { int ret; char kbuf[256]; size_t len = 0; unsigned int cmd,p1,p2,p3,p4,p5,p6,p7; struct freqhopping_ioctl fh_ctl; p1 = p2 = p3 = p4 = p5 = p6 = p7 = 0; FH_MSG("EN: %s",__func__); len = min(count, (sizeof(kbuf)-1)); if (count == 0)return -1; if(count > 255)count = 255; ret = copy_from_user(kbuf, buffer, count); if (ret < 0)return -1; kbuf[count] = '\0'; sscanf(kbuf, "%x %x %x %x %x %x %x %x", &cmd, &p1, &p2, &p3, &p4, &p5, &p6, &p7); //ccyeh fh_ctl.opcode = p1; fh_ctl.pll_id = p2; //ccyeh removed fh_ctl.ssc_setting_id = p3; fh_ctl.ssc_setting.dds = p3; fh_ctl.ssc_setting.df = p4; fh_ctl.ssc_setting.dt = p5; fh_ctl.ssc_setting.upbnd = p6; fh_ctl.ssc_setting.lowbnd = p7; fh_ctl.ssc_setting.freq = 0; if (cmd < FH_CMD_INTERNAL_MAX_CMD) { mt_freqhopping_ioctl(NULL,cmd,(unsigned long)(&fh_ctl)); } else if((cmd > FH_DCTL_CMD_ID) && (cmd < FH_DCTL_CMD_MAX)) { mt_freqhopping_devctl(cmd, &fh_ctl); } else { FH_MSG("CMD error!"); } return count; }