USB_CFG_IMPLEMENT_FN_READ and USB_CFG_IMPLEMENT_FN_WRITE
are both defined to 1.
The device gets detected without problems.
The codesnippet below is the content of the
callbacks
Code: Select all
uchar usbFunctionSetup(uchar data[8])
{
 uart_putc('s');
 switch(data[1]){
    case STEST:{
        buffer[0]=1;
        usbMsgPtr=buffer;
        return 1;
    }break;  
    case RTEST:{
        return 0xff; // get usbFunctionRead called;
    }break;
    case WTEST:{
        return 0xff; // get usbFunctionWrite called;
    }break;
 }
}
uchar usbFunctionWrite(uchar* data,uchar len)
{
  uart_putc('w');
  return 1;
}
uchar usbFunctionRead(uchar* data,uchar len)
{
  uart_putc('r');
  return 1;
}
On the client side:
Performing
Code: Select all
usb_control_msg(hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_OUT,WTEST, 0, 0, buf, strlen(buffer), 1000);Results in "sw" in the terminal app and usbFunctionWrite getting called.
Performing
Code: Select all
usb_control_msg(hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,STEST, 0, 0, buf, sizeof(buffer), 1000);Results in "s" in the terminal app and correct data getting returned
to the client app.
Performing
Code: Select all
usb_control_msg(hDev,USB_TYPE_VENDOR|USB_RECIP_DEVICE|USB_ENDPOINT_IN,RTEST, 0, 0, buf, sizeof(buffer), 1000);Results in "s" in the terminal app and no usbFunctionRead getting called.
Thus no data is supplied to the client application.
I'm using AVR-USB on an mega8515 with 8kb of external sram.
I thought of usbFunctionRead as a Way to conveniently read the
xmem in larger chunks than 254.
The firmware code contains atm just the xmem initialization, since i am trying to understand where the problem lies.
The usbdriver is from the latest PowerSwitcher zipfile.
Best Regards,
Tobias
