/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_class_audio_set_max_graphic_eq * Returned Value : USB_OK if command has been passed on USB * Comments : * This function is called by the application to send max graphic equalizer value * to the audio device *END*--------------------------------------------------------------------*/ USB_STATUS usb_class_audio_set_max_graphic_eq ( /* [IN] Class Interface structure pointer */ AUDIO_COMMAND_PTR com_ptr, /* [IN] length of the Buffer */ uint16_t blen, /* [IN] channel number */ uint8_t channel_no, /* [IN] Buffer to send data */ void *buf ) { /* Body */ uint16_t wIndex; AUDIO_CONTROL_INTERFACE_STRUCT_PTR if_ptr; USB_STATUS status = USBERR_ERROR; if_ptr = (AUDIO_CONTROL_INTERFACE_STRUCT_PTR)com_ptr->CLASS_PTR->class_intf_handle; wIndex = (uint16_t)(((if_ptr->fu_desc->bUnitID)<<8)|(if_ptr->AUDIO_G.IFNUM)); /* Check whether this attribute valid or not */ status = check_valid_fu(if_ptr->fu_desc,FU_GRAPHIC_EQ_MASK,if_ptr->fu_desc->bControlSize*channel_no); if (USB_OK == status) { status = usb_class_audio_cntrl_common(com_ptr,SET_REQUEST_ITF,SET_MAX, (uint16_t)((USB_AUDIO_CTRL_FU_GRAPHIC_EQ << 8) | channel_no),wIndex,blen,buf); } return status; }
/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_class_audio_get_max_graphic_eq * Returned Value : USB_OK if command has been passed on USB * Comments : * This function is called by the application to get max graphic equalizer value * from the audio device *END*--------------------------------------------------------------------*/ usb_status usb_class_audio_get_max_graphic_eq ( /* [IN] Class Interface structure pointer */ audio_command_t* com_ptr, /* [IN] length of the Buffer */ uint16_t blen, /* [IN] channel number */ uint8_t channel_no, /* [IN] Buffer to receive data */ void* buf ) { /* Body */ uint16_t windex; audio_control_struct_t* if_ptr; usb_status status = USBERR_ERROR; if_ptr = (audio_control_struct_t*)com_ptr->class_control_handle; windex = (uint16_t)((uint16_t)((uint16_t)(if_ptr->fu_desc->bunitid)<<8)|(if_ptr->ifnum)); /* Check whether this attribute valid or not */ status = check_valid_fu(if_ptr->fu_desc,FU_GRAPHIC_EQ_MASK,if_ptr->fu_desc->bcontrolsize*channel_no); if (USB_OK == status) { status = usb_class_audio_cntrl_common(com_ptr,GET_REQUEST_ITF,GET_MAX, (uint16_t)((USB_AUDIO_CTRL_FU_GRAPHIC_EQ << 8) | channel_no),windex,blen,(uint8_t *)buf); } return status; }
/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_class_audio_feature_command * Returned Value : USB_OK if command has been passed on USB * Comments : * This function is called by the application to get or set feature units * of audio device *END*--------------------------------------------------------------------*/ USB_STATUS usb_class_audio_feature_command ( /* [IN] Class Interface structure pointer */ AUDIO_COMMAND_PTR com_ptr, /* [IN] channel number */ uint8_t channel_no, /* [IN] Buffer to send data */ void *buf, /* [IN] The command to perform */ uint32_t cmd ) { /* Body */ uint16_t wIndex; uint16_t request_value; AUDIO_CONTROL_INTERFACE_STRUCT_PTR if_ptr; USB_AUDIO_COMMAND_PTR p_feature_command; USB_STATUS status = USBERR_ERROR; if_ptr = (AUDIO_CONTROL_INTERFACE_STRUCT_PTR)com_ptr->CLASS_PTR->class_intf_handle; /* Validity checking: for audio interface */ status = usb_host_class_intf_validate(if_ptr); if (USB_OK == status) { /* pointer to command */ p_feature_command = &(usb_audio_feature_commands[cmd]); /* get request value */ request_value = (uint16_t)((p_feature_command->request_value << 8) | channel_no); wIndex = (uint16_t)(((if_ptr->fu_desc->bUnitID)<<8)|(if_ptr->AUDIO_G.IFNUM)); /* Check whether this attribute valid or not */ status = check_valid_fu(if_ptr->fu_desc,p_feature_command->control_mask,if_ptr->fu_desc->bControlSize*channel_no); if (USB_OK == status) { status = usb_class_audio_cntrl_common(com_ptr, p_feature_command->request_type, p_feature_command->request_code, request_value, wIndex, p_feature_command->length, buf); } } return status; }
/*FUNCTION*---------------------------------------------------------------- * * Function Name : usb_class_audio_feature_command * Returned Value : USB_OK if command has been passed on USB * Comments : * This function is called by the application to get or set feature units * of audio device *END*--------------------------------------------------------------------*/ usb_status usb_class_audio_feature_command ( /* [IN] Class Interface structure pointer */ audio_command_t* com_ptr, /* [IN] channel number */ uint8_t channel_no, /* [IN] Buffer to send data */ void* buf, /* [IN] The command to perform */ uint32_t cmd ) { /* Body */ uint16_t windex; uint16_t request_value; audio_control_struct_t* if_ptr; usb_audio_command_t* p_feature_command; usb_status status = USBERR_ERROR; if_ptr = (audio_control_struct_t*)com_ptr->class_control_handle; /* Validity checking: for audio interface */ status = usb_hostdev_validate(if_ptr->dev_handle); if (USB_OK == status) { /* pointer to command */ p_feature_command = &(usb_audio_feature_commands[cmd]); /* get request value */ request_value = (uint16_t)((uint16_t)((uint16_t)p_feature_command->request_value << 8) | channel_no); windex = (uint16_t)((uint16_t)((uint16_t)(if_ptr->fu_desc->bunitid) << 8)|(if_ptr->ifnum)); /* Check whether this attribute valid or not */ status = check_valid_fu(if_ptr->fu_desc,p_feature_command->control_mask,if_ptr->fu_desc->bcontrolsize*channel_no); if (USB_OK == status) { status = usb_class_audio_cntrl_common(com_ptr, p_feature_command->request_type, p_feature_command->request_code, request_value, windex, p_feature_command->length, (uint8_t *)buf); } } return status; }