Start a new topic

PC720 Mailbox

Per my last post "interrupt driven BSP" I need access to the mailbox function in the HOST IF star.  Your comment was that you thought it was still there but not used.  I don't see any information on the mailbox function in either the documents for the host if star or within the VHDL itself.  Could you please advise how I can gain access to the mailbox in and out feature.  I understand that my custom firmware would have to generate the data but I require the ports on the host IF star, I assume its a 32bit data and strobe interface that's presented via the port map.  The C API supports mailbox but simply times out because there is nothing in the mailbox.

Chris


This topic is being closed because the issue is considered as resolved by 4DSP. Feel free to create a new topic for any further inquiries.
Dear Sir,


Can you confirm the discussion is moving forward on the email layer, can I close this topic?


Thanks,
Arnaud
My inqury was for another project but I think i have mostly what i need.  I was trying to find out if there was an example project that does mailboxes for the pc720 and what that would cost for just the project.  Email is better than forum if you need more info.
Hello Chris,

After reviewing the forum posts, as Arnaud mentioned it seems that the proposal developed for Luis will cover these aspects. Is there any specific that you would like for me to check on?


Thanks
Michael
Dear Sir,


I am asking Michael to get in touch with you in the forum. But the proposal and my extra details covers all the design aspects, I have reviewed the proposal document.


Thanks,
Arnaud
I meant Michael sorry.  I would like to hear more about this option from him.
Dear Sir,


I checked internally but nobody seems to know a Robert. If my information is correct you have received both Pierrick and Michael on site and Michael made you a proposal.


I believe if I am right this is already asserted then?


Best Regards,
Arnaud
Yes please forward this to Robert, we have been in discussions related to this in the past.
Dear Sir,


They are not documented, this interface is not disclosed to public so we don't have documentation. We provided you with a reference module in source and all the description required in this post to help you on your integration. The interrupt star provided as reference is able to trigger a mailbox interrupt through the host interface star and the code is quite straightforward so you would need to look at the source code of both this star and the host interface star.


I can ask my sales colleagues to get in touch with you and offer you an interrupt based reference design with the proper documentation but you should expect some cost involved.


Do you want a sales colleague to get in touch with you?


Best Regards,
Arnaud



"1) The interrupt star generates a interrupt packet via the command bus towards the host interface, there are several operations available on the command bus, typically read, write, etc.. The host interface is then placing the mailbox value on a BAR register and asserts interrupt."

Where are these operations documented?
Dear Sir,


1) The interrupt star generates a interrupt packet via the command bus towards the host interface, there are several operations available on the command bus, typically read, write, etc.. The host interface is then placing the mailbox value on a BAR register and asserts interrupt.


2) Indeed there is no FIFO for Host to FPGA mailbox but there is a software FIFO in the device driver to queue FPGA to host mailbox.


3) A mailbox is any 32 bit value, you can put anything you want in there. This could be a size to offload, channel information, etc.. interrupt_16 star is an example of an implementation around the mailbox.


Your understanding of the sequence is correct but only 3) requires correction. Calling 4fm_readmailbox causes the API to try reading a value from the mailbox queue in the device driver, there is a sleeping semaphore waiting on a value to placed in the queue, the queue being filled by the device driver as soon an mailbox interrupt is received from the operating system.


I hope that helps,
Arnaud

  In looking at the C and HDL I am a bit confused.  The HDL module does not appear to actually generate an interrupt that would feed into the PCIe bus.  I see that when an interrupt is triggered it apparently sets a flag in the cmdout register but I dont see how an actual interrupt is generated.  From the C code I see that you provided some register writes into the new module to configure and arm the interrupt_16 core.    It would appear that the following happens based on the code provided

1)  I put in that core and add some user logic to generate the 16 bit "int" signal in the fpga
2) The c code reaches into the bar space for the interrupt_16 module and arms the core
3) C code calls "4fm_readmailbox", presumably program goes to sleep until time out or interrupt occurs
4) Custom FPGA code raises one of the 16 interrupt bits
5) PCIe interrupt is generate which wakes up 4fm_readmailbox sleeping process
6) 4fm_readmailbox reads the status register and returns the value

I guess my confusions are

1) How does this module generate a pcie interrupt since I dont see any signals that would indicate that is happening.  It would appear the 4fm_readmailbox would be required to poll the status register looking for the trigger bit to toggle.  I havn't torn through the code in the uBlaze perhaps the interrupt magic is in there based on the module setting the  "cmdout_val" bit?
2) This core doesn't appear to have a fifo, so it doesn't allow cued mailbox messages as indicated in the prior message board post.
3) What is the "mailbox" is that the status register which simply includes the 8 bits of which interrupt tripped?


Dear chris,


attached to the post you have a intterupt star that we have used internally to generate command mailbox interrupts. You can copy the folder local to your "star_lib" and you can use the library merge tool to merge the star from intterupt_16.TCLib into your own TCLIB file.


There is a short document that describes the behavior of the interrupt_16 star included in the stars folder.


Also I attached a software llibrary example to control this star.


below is an example code that waits for a mailbox interrupt


[code]

// wait for an interrupt
if(sipif_readmailbox(&intstatus)!=SIPIF_ERR_OK) {
printf("Received a time out on loop %d\n", loopidx);
        return -1


}


[/code]


it could be that your sipif.cpp file does not support this function by default. In that case you can add the following fuction in there


[code]



int sipif_readmailbox(unsigned long *pmboxval)
{
_4FM_error_t rc4fm;


// we do not want any null args here
if(pmboxval==NULL)
return SIPIF_ERR_NULL_ARGUMENT;


switch(g_typeif)
{
case SIPIF_ETHAPI: {
return SIPIF_ERR_UNEXPECTED_LAYER_ID;
  }
case SIPIF_4FM_FC:
case SIPIF_4FM: {
rc4fm = g_p4FM_ReadMailbox(&g_hDev, pmboxval, g_timeout);
if(rc4fm!=_4FM_OK)
return SIPIF_ERR_TIMEOUT;
break;
}
default:
return SIPIF_ERR_UNEXPECTED_LAYER_ID;
}


return SIPIF_ERR_OK;
}
[/code]




and you should then add the following in your sipif.h file


[code]



/**
* Read a mailbox word from the 4FM interface.  *
* @param buf pointer to the buffer receiving data from the firmware
* @param word pointer to a variable about to receive the mailbox value.
* @return  - SIPIF_ERR_OK
* - SIPIF_ERR_TIMEOUT
* - SIPIF_ERR_UNEXPECTED_LAYER_ID
*/
int sipif_readmailbox(unsigned long *pmboxval);
[/code]




best regards,
Erik