lib/voe_handler.c
branchstable-1.5
changeset 2429 cc2e1cbb63b1
parent 2421 bc2d4bf9cbe5
child 2430 1430a47a67dd
equal deleted inserted replaced
2428:8a270ea612ee 2429:cc2e1cbb63b1
    63     data.config_index = voe->config->index;
    63     data.config_index = voe->config->index;
    64     data.voe_index = voe->index;
    64     data.voe_index = voe->index;
    65     data.vendor_id = &vendor_id;
    65     data.vendor_id = &vendor_id;
    66     data.vendor_type = &vendor_type;
    66     data.vendor_type = &vendor_type;
    67 
    67 
    68     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_SEND_HEADER, &data) == -1)
    68     if (ioctl(voe->config->master->fd,
       
    69                 EC_IOCTL_VOE_SEND_HEADER, &data) == -1) {
    69         fprintf(stderr, "Failed to set VoE send header: %s\n",
    70         fprintf(stderr, "Failed to set VoE send header: %s\n",
    70                 strerror(errno));
    71                 strerror(errno));
       
    72     }
    71 }
    73 }
    72 
    74 
    73 /*****************************************************************************/
    75 /*****************************************************************************/
    74 
    76 
    75 void ecrt_voe_handler_received_header(const ec_voe_handler_t *voe,
    77 void ecrt_voe_handler_received_header(const ec_voe_handler_t *voe,
    80     data.config_index = voe->config->index;
    82     data.config_index = voe->config->index;
    81     data.voe_index = voe->index;
    83     data.voe_index = voe->index;
    82     data.vendor_id = vendor_id;
    84     data.vendor_id = vendor_id;
    83     data.vendor_type = vendor_type;
    85     data.vendor_type = vendor_type;
    84 
    86 
    85     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_REC_HEADER, &data) == -1)
    87     if (ioctl(voe->config->master->fd,
       
    88                 EC_IOCTL_VOE_REC_HEADER, &data) == -1) {
    86         fprintf(stderr, "Failed to get received VoE header: %s\n",
    89         fprintf(stderr, "Failed to get received VoE header: %s\n",
    87                 strerror(errno));
    90                 strerror(errno));
       
    91     }
    88 }
    92 }
    89 
    93 
    90 /*****************************************************************************/
    94 /*****************************************************************************/
    91 
    95 
    92 uint8_t *ecrt_voe_handler_data(ec_voe_handler_t *voe)
    96 uint8_t *ecrt_voe_handler_data(ec_voe_handler_t *voe)
   108     ec_ioctl_voe_t data;
   112     ec_ioctl_voe_t data;
   109 
   113 
   110     data.config_index = voe->config->index;
   114     data.config_index = voe->config->index;
   111     data.voe_index = voe->index;
   115     data.voe_index = voe->index;
   112 
   116 
   113     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_READ, &data) == -1)
   117     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_READ, &data) == -1) {
   114         fprintf(stderr, "Failed to initiate VoE reading: %s\n",
   118         fprintf(stderr, "Failed to initiate VoE reading: %s\n",
   115                 strerror(errno));
   119                 strerror(errno));
       
   120     }
   116 }
   121 }
   117 
   122 
   118 /*****************************************************************************/
   123 /*****************************************************************************/
   119 
   124 
   120 void ecrt_voe_handler_read_nosync(ec_voe_handler_t *voe)
   125 void ecrt_voe_handler_read_nosync(ec_voe_handler_t *voe)
   122     ec_ioctl_voe_t data;
   127     ec_ioctl_voe_t data;
   123 
   128 
   124     data.config_index = voe->config->index;
   129     data.config_index = voe->config->index;
   125     data.voe_index = voe->index;
   130     data.voe_index = voe->index;
   126 
   131 
   127     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_READ_NOSYNC, &data) == -1)
   132     if (ioctl(voe->config->master->fd,
       
   133                 EC_IOCTL_VOE_READ_NOSYNC, &data) == -1) {
   128         fprintf(stderr, "Failed to initiate VoE reading: %s\n",
   134         fprintf(stderr, "Failed to initiate VoE reading: %s\n",
   129                 strerror(errno));
   135                 strerror(errno));
       
   136     }
   130 }
   137 }
   131 
   138 
   132 /*****************************************************************************/
   139 /*****************************************************************************/
   133 
   140 
   134 void ecrt_voe_handler_write(ec_voe_handler_t *voe, size_t size)
   141 void ecrt_voe_handler_write(ec_voe_handler_t *voe, size_t size)
   138     data.config_index = voe->config->index;
   145     data.config_index = voe->config->index;
   139     data.voe_index = voe->index;
   146     data.voe_index = voe->index;
   140     data.size = size;
   147     data.size = size;
   141     data.data = voe->data;
   148     data.data = voe->data;
   142 
   149 
   143     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_WRITE, &data) == -1)
   150     if (ioctl(voe->config->master->fd, EC_IOCTL_VOE_WRITE, &data) == -1) {
   144         fprintf(stderr, "Failed to initiate VoE writing: %s\n",
   151         fprintf(stderr, "Failed to initiate VoE writing: %s\n",
   145                 strerror(errno));
   152                 strerror(errno));
       
   153     }
   146 }
   154 }
   147 
   155 
   148 /*****************************************************************************/
   156 /*****************************************************************************/
   149 
   157 
   150 ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)
   158 ec_request_state_t ecrt_voe_handler_execute(ec_voe_handler_t *voe)