usb_specific_request.c File Reference

user call-back functions More...

#include "config.h"
#include "conf_usb.h"
#include "lib_mcu/usb/usb_drv.h"
#include "usb_descriptors.h"
#include "modules/usb/device_chap9/usb_standard_request.h"
#include "usb_specific_request.h"

Include dependency graph for usb_specific_request.c:

Go to the source code of this file.

Functions

Bool usb_user_read_request (U8 type, U8 request)
 This function is called by the standard usb read request function when the Usb request is not supported.
Bool usb_user_get_descriptor (U8 type, U8 string)
 usb_user_get_descriptor.This function returns the size and the pointer on a user information structure
void usb_user_endpoint_init (U8 conf_nb)
 usb_user_endpoint_init.This function configures the endpoints.
void cdc_get_line_coding (void)
 cdc_get_line_coding.This function manages reception of line coding parameters (baudrate...).
void cdc_set_line_coding (void)
 cdc_set_line_coding.This function manages reception of line coding parameters (baudrate...).
void cdc_set_control_line_state (void)
 cdc_set_control_line_state.This function manages the SET_CONTROL_LINE_LINE_STATE CDC request.

Variables

U8 code * pbuffer
U8 data_to_transfer
S_line_coding line_coding


Detailed Description

user call-back functions

This file contains the user call-back functions corresponding to the application:

Author:
Atmel Corporation: http://www.atmel.com
Support and FAQ: http://support.atmel.no/

Definition in file usb_specific_request.c.


Function Documentation

Bool usb_user_read_request ( U8  type,
U8  request 
)

This function is called by the standard usb read request function when the Usb request is not supported.

This function returns TRUE when the request is processed. This function returns FALSE if the request is not supported. In this case, a STALL handshake will be automatically sent by the standard usb read request function.

Parameters:
none 
Returns:
none

Definition at line 76 of file usb_specific_request.c.

References cdc_get_line_coding(), cdc_set_control_line_state(), cdc_set_line_coding(), FALSE, GET_LINE_CODING, SET_CONTROL_LINE_STATE, SET_LINE_CODING, TRUE, and Usb_read_byte.

Referenced by usb_process_request().

00077 {
00078 U8  descriptor_type ;
00079 U8  string_type     ;
00080 
00081    string_type     = Usb_read_byte();
00082    descriptor_type = Usb_read_byte();
00083    switch(request)
00084    {
00085       case GET_LINE_CODING:
00086          cdc_get_line_coding();
00087                return TRUE;
00088                break;
00089 
00090       case SET_LINE_CODING:
00091          cdc_set_line_coding();
00092                return TRUE;
00093                break;
00094 
00095       case SET_CONTROL_LINE_STATE:
00096          cdc_set_control_line_state();
00097       return TRUE;
00098       break;
00099 
00100       default:
00101          return FALSE;
00102          break;
00103 
00104    }
00105    return FALSE;
00106 }

Here is the call graph for this function:

Here is the caller graph for this function:

Bool usb_user_get_descriptor ( U8  type,
U8  string 
)

usb_user_get_descriptor.This function returns the size and the pointer on a user information structure

Parameters:
none 
Returns:
none

Definition at line 118 of file usb_specific_request.c.

References FALSE.

Referenced by usb_get_descriptor().

00119 { /*
00120    switch(type)
00121    {
00122       case STRING_DESCRIPTOR:
00123          switch (string)
00124          {
00125             case LANG_ID:
00126                data_to_transfer = sizeof (usb_user_language_id);
00127                pbuffer = &(usb_user_language_id.bLength);
00128                return TRUE;
00129                break;
00130             case MAN_INDEX:
00131                data_to_transfer = sizeof (usb_user_manufacturer_string_descriptor);
00132                pbuffer = &(usb_user_manufacturer_string_descriptor.bLength);
00133                return TRUE;
00134                break;
00135             case PROD_INDEX:
00136                data_to_transfer = sizeof (usb_user_product_string_descriptor);
00137                pbuffer = &(usb_user_product_string_descriptor.bLength);
00138                return TRUE;
00139                break;
00140             case SN_INDEX:
00141                data_to_transfer = sizeof (usb_user_serial_number);
00142                pbuffer = &(usb_user_serial_number.bLength);
00143                return TRUE;
00144                break;
00145             default:
00146                return FALSE;
00147          }
00148       default:
00149          return FALSE;
00150    }*/
00151 
00152    return FALSE;
00153 }

Here is the caller graph for this function:

void usb_user_endpoint_init ( U8  conf_nb  ) 

usb_user_endpoint_init.This function configures the endpoints.

Parameters:
none 
Returns:
none

Definition at line 163 of file usb_specific_request.c.

References DIRECTION_IN, DIRECTION_OUT, INT_EP, NYET_ENABLED, ONE_BANK, RX_EP, SIZE_32, TX_EP, TYPE_BULK, TYPE_INTERRUPT, usb_configure_endpoint, and Usb_reset_endpoint.

Referenced by usb_set_configuration().

00164 {
00165   usb_configure_endpoint(INT_EP,      \
00166                          TYPE_INTERRUPT,     \
00167                          DIRECTION_IN,  \
00168                          SIZE_32,       \
00169                          ONE_BANK,     \
00170                          NYET_ENABLED);
00171 
00172   usb_configure_endpoint(TX_EP,      \
00173                          TYPE_BULK,  \
00174                          DIRECTION_OUT,  \
00175                          SIZE_32,     \
00176                          ONE_BANK,     \
00177                          NYET_ENABLED);
00178 
00179   usb_configure_endpoint(RX_EP,      \
00180                          TYPE_BULK,     \
00181                          DIRECTION_IN,  \
00182                          SIZE_32,       \
00183                          ONE_BANK,     \
00184                          NYET_ENABLED);
00185 
00186   Usb_reset_endpoint(INT_EP);
00187   Usb_reset_endpoint(TX_EP);
00188   Usb_reset_endpoint(RX_EP);
00189 
00190 
00191 }

Here is the caller graph for this function:

void cdc_get_line_coding ( void   ) 

cdc_get_line_coding.This function manages reception of line coding parameters (baudrate...).

Parameters:
none 
Returns:
none

Definition at line 201 of file usb_specific_request.c.

References S_line_coding::bCharFormat, S_line_coding::bDataBits, S_line_coding::bParityType, S_line_coding::dwDTERate, Is_usb_read_control_enabled, Is_usb_receive_out, line_coding, LSB0, LSB1, LSB2, LSB3, Usb_ack_receive_out, Usb_ack_receive_setup, Usb_send_control_in, and Usb_write_byte.

Referenced by usb_user_read_request().

Here is the caller graph for this function:

void cdc_set_line_coding ( void   ) 

cdc_set_line_coding.This function manages reception of line coding parameters (baudrate...).

Parameters:
none 
Returns:
none

Definition at line 229 of file usb_specific_request.c.

References S_line_coding::bCharFormat, S_line_coding::bDataBits, S_line_coding::bParityType, S_line_coding::dwDTERate, Is_usb_read_control_enabled, Is_usb_receive_out, line_coding, LSB0, LSB1, LSB2, LSB3, Usb_ack_receive_out, Usb_ack_receive_setup, Usb_read_byte, and Usb_send_control_in.

Referenced by usb_user_read_request().

Here is the caller graph for this function:

void cdc_set_control_line_state ( void   ) 

cdc_set_control_line_state.This function manages the SET_CONTROL_LINE_LINE_STATE CDC request.

Todo:
Manages here hardware flow control...
Parameters:
none 
Returns:
none

Definition at line 257 of file usb_specific_request.c.

References Is_usb_read_control_enabled, Usb_ack_receive_setup, and Usb_send_control_in.

Referenced by usb_user_read_request().

00258 {
00259    Usb_ack_receive_setup();
00260    Usb_send_control_in();
00261    while(!(Is_usb_read_control_enabled()));
00262 
00263 }

Here is the caller graph for this function:


Variable Documentation

U8 code* pbuffer

Definition at line 94 of file usb_standard_request.c.

Referenced by usb_get_descriptor().

U8 data_to_transfer

Definition at line 96 of file usb_standard_request.c.

Referenced by usb_get_descriptor().

S_line_coding line_coding

Definition at line 75 of file cdc_rf_task.c.

Referenced by cdc_get_line_coding(), and cdc_set_line_coding().


Generated on Mon May 5 15:58:14 2008 for ATMEL by  doxygen 1.5.1-p1