master/cdev.c
changeset 950 8b00e63fff90
parent 949 e424c0074c67
child 956 d9b9bc794d10
equal deleted inserted replaced
949:e424c0074c67 950:8b00e63fff90
    40 
    40 
    41 #include <linux/module.h>
    41 #include <linux/module.h>
    42 
    42 
    43 #include "cdev.h"
    43 #include "cdev.h"
    44 #include "master.h"
    44 #include "master.h"
       
    45 #include "slave_config.h"
    45 #include "ioctl.h"
    46 #include "ioctl.h"
    46 
    47 
    47 /*****************************************************************************/
    48 /*****************************************************************************/
    48 
    49 
    49 /** \cond */
    50 /** \cond */
   369 
   370 
   370                 data.data_size = domain->data_size;
   371                 data.data_size = domain->data_size;
   371                 data.logical_base_address = domain->logical_base_address;
   372                 data.logical_base_address = domain->logical_base_address;
   372                 data.working_counter = domain->working_counter;
   373                 data.working_counter = domain->working_counter;
   373                 data.expected_working_counter = domain->expected_working_counter;
   374                 data.expected_working_counter = domain->expected_working_counter;
       
   375                 data.fmmu_count = ec_domain_fmmu_count(domain);
       
   376 
       
   377                 if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
       
   378                     retval = -EFAULT;
       
   379                     break;
       
   380                 }
       
   381                 break;
       
   382             }
       
   383 
       
   384         case EC_IOCTL_DOMAIN_FMMU:
       
   385             {
       
   386                 ec_ioctl_domain_fmmu_t data;
       
   387                 const ec_domain_t *domain;
       
   388                 const ec_fmmu_config_t *fmmu;
       
   389 
       
   390                 if (copy_from_user(&data, (void __user *) arg, sizeof(data))) {
       
   391                     retval = -EFAULT;
       
   392                     break;
       
   393                 }
       
   394                 
       
   395                 if (!(domain = ec_master_find_domain(master, data.domain_index))) {
       
   396                     EC_ERR("Domain %u does not exist!\n", data.domain_index);
       
   397                     retval = -EINVAL;
       
   398                     break;
       
   399                 }
       
   400 
       
   401                 if (!(fmmu = ec_domain_find_fmmu(domain, data.fmmu_index))) {
       
   402                     EC_ERR("Domain %u has less than %u fmmu configurations.\n",
       
   403                             data.domain_index, data.fmmu_index + 1);
       
   404                     retval = -EINVAL;
       
   405                     break;
       
   406                 }
       
   407 
       
   408                 data.slave_config_alias = fmmu->sc->alias;
       
   409                 data.slave_config_position = fmmu->sc->position;
       
   410                 data.fmmu_dir = fmmu->dir;
       
   411                 data.logical_address = fmmu->logical_start_address;
       
   412                 data.data_size = fmmu->data_size;
   374 
   413 
   375                 if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
   414                 if (copy_to_user((void __user *) arg, &data, sizeof(data))) {
   376                     retval = -EFAULT;
   415                     retval = -EFAULT;
   377                     break;
   416                     break;
   378                 }
   417                 }