This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

how to read statistical counters of 82559 !!!


[ Thanks to Andrew for his continuous support ]


I have been trying to read statistical counters of i82559 chip but
unsuccessful so far. This is the code, I inserted in i82559_send after call
to TxMachine.

{
#define MY_SIZE 64
   cyg_uint32 my_ioaddr = p_i82559->io_address;
   unsigned char *status_register = (unsigned
char*)pciwindow_mem_alloc(MY_SIZE);
   unsigned char i = 0;
   if(!status_register) {
      os_printf("memory out !!\n");
      goto out_of_scope;
   }
   memset(status_register, 0, MY_SIZE);
   wait_for_cmd_done(my_ioaddr, WAIT_CU);
   OUTL(VIRT_TO_BUS(status_register), my_ioaddr + SCBPointer);
   OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd);
   // wait_for_cmd_done(my_ioaddr, WAIT_CU);

   for(i = 0; i < MY_SIZE; i++) {
      os_printf("%02x  ",status_register[i]);
      if( i % 8 == 7)
           os_printf("\n");
   }
   os_printf("\n\n\n");
}

This dumps all zeros. I was not sure about call to wait_for_cmd_done. I did
try to call it before lines OUTL(VIRT_TO_BUS(status_register), my_ioaddr +
SCBPointer) then after line OUTW(CU_SHOWSTATS, my_ioaddr + SCBCmd) and then
at both place [hit and trial :-( ], but all dumps zero only. Can someone
give me some suggestions, what is wrong with code?
I have some questions in this regard. The second argument to function
wait_for_cmd_done is either WAIT_CU or WAIT_RU, corrosponding to Command
Unit and Receive Unit. I think dumping statistical counters is related to
Command Unit. Can someone give me more details about this? Also I found in
i82559.c, the function wait_for_cmd_done is called before writing to device,
while the function name indicates that it waits for "given command done".
Can someone clarify, when should I call wait_for_cmd_done. Before
writing/reading to device or after?
Please excuse me if my questions are silly. It's first time, I am
interfacing with some device.

Regards
Mohanlal


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]