CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

USB library doubt

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
xxopiumxx



Joined: 01 Jul 2011
Posts: 20

View user's profile Send private message

USB library doubt
PostPosted: Tue Sep 20, 2011 9:35 am     Reply with quote

Hi. I'm working a lot on USB HID, with a PIC18F4550. Anyways, i think that i spend more time reading the libraries, and trying to understand them, than properly programming.

In this moment I am trying to edit my own interrupt functions, and I am having some trouble.

I understand that when an interrupt comes up, a certain register changes its value and that calls a subroutine. particularly that segment is (obviating the control/en==0 instructions):

Code:

void usb_isr_tok_dne() {
   

(...)

         else {
         if (!bit_test(USTAT,2)) {
            usb_isr_tok_out_dne(en);
         }
         else {
            usb_isr_tok_in_dne(en);
      }
}


Digging a bit deeper, I found that the function usb_isr_tok_in_dne doesn't do anything in case of en==1 (or generically !=0||!=CDC)

Code:

void usb_isr_tok_in_dne(int8 endpoint) {
   if (endpoint==0) {
      if (USB_stack_status.dev_req == GET_DESCRIPTOR) {usb_copy_desc_seg_to_ep();} //check this, we are missing report descriptor?
      else if (USB_stack_status.dev_req == SET_ADDRESS) {usb_finish_set_address();}
   }
  #if USB_CDC_DEVICE
  else if (endpoint==USB_CDC_DATA_IN_ENDPOINT) { //see ex_usb_serial.c example and usb_cdc.h driver
      usb_isr_tok_in_cdc_data_dne();
  }
  #endif
}


This is just for curiosity, because I am actually managing the in-interrupt at my will, but I wish to understand it better.

The other thing that I don't understand and I suspect that is giving me some trouble is the usb_flush_in & usb_flush_out. As I understand it 'clears' the endpoint for new incomes/outcomes; but I cannot find where it is first called; and it is not implicit called because if I don't call the usb_flush_in, for example, explicitly my pic doesn't see the interrupt in.
I know this because I've configured a pair of leds, in the interrupt routine, that informs me about it.

thanks for your time. any answer will be great!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group