• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Embedded Software » BIOS » BIOS forum » Accessing host from a remote server.
Share
BIOS
  • Forum
  • Announcements
Options
  • Subscribe via RSS

Forums

Accessing host from a remote server.

This question is answered
sachinpdesai
Posted by sachinpdesai
on Apr 13 2012 10:00 AM
Intellectual1260 points

 I am using Codec Engine 2.26 to run some algorithms on the remote DSP in DM3730. One of the algorithms however in the middle of its execution need to send some information to the host micro-controller (the information is regarding changing of certain analog gains). How can I achieve this?

regards

Sachin

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Chris Ring
    Posted by Chris Ring
    on Apr 13 2012 12:21 PM
    Verified Answer
    Verified by sachinpdesai
    Genius16190 points

    Codec Engine "just runs XDAIS algorithms", so you can structure your codec in any XDAIS-compliant way.  There's no inherent support for 'out of band messaging' in CE as the XDAIS/XDM specs don't define this behavior.

    Best case, if your app can wait until the end of the process() call to get this extra info, is to send it from the codec via an extended outArgs from your process() call.  That's a very common pattern many codecs use.

    Or if the app needs to know immediately, maybe the codec could "return early" from process() with outArgs that contain the info you want to return to the app, and maybe a flag that the process() call didn't "really" complete and the app should call it again?

    Further up the complexity chain, your codec could use some underlying Link-based service (MSGQ?) to send this info to a CE-independent thread in your app (also using MSGQ)?  But at that point you're tying yourself to Link (implying you can't run that codec 'locally') and introducing some ugly dependencies you probably don't want.

    Chris

    Codec Engine
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 13 2012 17:19 PM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    Thanks Chris,

    Our requirement (or rather the customer requirement) is that in we do this messaging in the middle of process. So there are two options we have thought of

    1) In out current architecture there are 2 XDAIS algorithms AFE and APU, and both execute on DSP, and we do call APU from AFE. Neither AFE nor APU are called via AISA APIs, but we have out own extensions (DEVNODE for AFE and ECO for APU). On the same line we were thinking of having a 3rd XDAIS algorithm (GAIN) that runs locally (on host micro controller) but that can be called from AFE. Now this raises two questions

      a) Using one codec engine is it possible to have some algorithms run locally and some remotely?

      b) If the answer to a is yes, then is it possible to to extend CE APIs (as we have done for AFE and APU) the third time to be able to call the GAIN algorithm

    2) The second suggestion is that the process simply interrupts the host and tells it what to do.

    Your suggestions are truly appreciated :))

    regards

    Sachin

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chris Ring
    Posted by Chris Ring
    on Apr 13 2012 18:20 PM
    Verified Answer
    Verified by Chris Ring
    Genius16190 points

    sachinpdesai
    a) Using one codec engine is it possible to have some algorithms run locally and some remotely?

    Yep, that's supported.  The same A8-side app can drive local and/or remote algs.

    I'm not sure that's what you're suggesting, though.  Reading your suggestion, it sounds like you want a DSP-side 'remote' alg to somehow also act as an _app_ and drive a 'remote-from-the-DSP-POV' alg running on the A8?!  If that's what you mean, that's not supported, and I'd instead suggest you just send a DSP->A8 MSGQ message.

    sachinpdesai
    b) If the answer to a is yes, then is it possible to to extend CE APIs (as we have done for AFE and APU) the third time to be able to call the GAIN algorithm

    Yep, extend to your heart's content.  Note that often we recommend using the existing IUNIVERSAL interface rather than create a brand new one like DEVNODE.  While both extension methods are supported, IUNIVERSAL already provides the necessary stubs/skels so there's less work.

    sachinpdesai
    2) The second suggestion is that the process simply interrupts the host and tells it what to do.

    Yep, that might be the "just send a DSP->A8 MSGQ message" approach.  Create a separate ARM-side thread that does MSGQ_get() and have the DSP-side do a MSGQ_put() as needed.

    Chris

    Codec Engine
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 16 2012 10:56 AM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    Thanks a lot Chris. Based on your i/p we feel the MSGQ approach suits us best. We want to ensure that the MSGQ implementation is feasible and meets our customers requirements in terms of latency and message size. Is there an example code we can look at? I assume that this implementation is feasible using and interrupts instead of polling on ARM.

    Sachin

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chris Ring
    Posted by Chris Ring
    on Apr 16 2012 12:57 PM
    Verified Answer
    Verified by sachinpdesai
    Genius16190 points

    This is a good starting starting point for a DSP Link-only standalone example:

    http://processors.wiki.ti.com/index.php/Audio_Soc_example

    It's good in your case as it also uses MSGQ.

    There will be some work to use both DSP Link and CE in the same app - e.g. you'll have to #include headers from both CE and Link.  You can probably leverage CE's Engine_open() to load the DSP (but be sure not to use MSGQ before opening the Engine - and similar for Engine_close()).  And depending on how you're building your app, you may want to continue using CE's generated list of libraries (configuro-generated linker.cmd file or package.bld-generated .xdl file) to get the DSP Link libraries on your link line.

    Chris

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 24 2012 13:55 PM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    Do I need to do the all or some of the PROC calls shown in that example? I added all the MSGQ calls but I am getting an error when trying to pick up message on ARM (from DSP) DSP_ETIMEOUT.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chris Ring
    Posted by Chris Ring
    on Apr 24 2012 17:59 PM
    Verified Answer
    Verified by sachinpdesai
    Genius16190 points

    I'll open with "I'm not a DSP Link expert" and "I haven't done this"... followed by "all the source code is provided, so you may have to dig in a bit yourself".

    Assuming you're not calling any DSP Link APIs until after Engine_open(), you're running your MSGQ-using thread from the same process as CE, you're ok using messages from the same POOL as CE (and the msgs in that POOL are the right size and there are enough to spare), you should just have to call MSGQ_open()/get().

    Are you passing a timeout value into MSGQ_get()?  Is the DSP side calling MSGQ_locate() and successfully finding the MSGQ that was MSGQ_open()'d on the GPP side?

    Chris

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 24 2012 18:58 PM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    how do I ensure "you're ok using messages from the same POOL as CE (and the msgs in that POOL are the right size and there are enough to spare" I am passing a timeout value (5 ms) in MSGQ_get, but I am sure that MSGQ_put is done before so timeout shouldn't matter (I will nevertheless increase timeout and see) I calling MSGQ_locate and it is successfull on DSPS_side.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 25 2012 08:27 AM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    Thanks Chris. This issue is resolved for now. I am able to get one message asynchronously from the algorithm running on the DSP to the application executing on the host. However I will like to keep this thread alive as I need to do the following improvements

    1) Currently I am passing only a message ID, will like to extend this to pass some more data fields.

    2) Also I am sending the message upstream only once. Would like to do this a multiple times and from different points in the algorithm to ensure no memory leak etc?

    3) The application in currently polling for the message. I would like this to be made interrupt driven, where the interrupt is generated by the algorithm. Can you give me any pointers on how to go about implementing this>

    regards

    Sachin

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 25 2012 11:01 AM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    I am having some issues with #2 above. I have two places in my algorithm where I put a message in the message queue. The applicationseems to be continously picking up the one I put second. Here is the code flow

    Algo()

    {

    put message A;

    put message B;

    }

    Application()

    {

    pick up the message and print;

    }

    the o/p is continuous stream of B. So the issues are

    1) Message A is never picked up

    2) Message B which has neen put only once seems to be picked up again and again. How do I invalidate a message in the queue?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Chris Ring
    Posted by Chris Ring
    on Apr 25 2012 12:24 PM
    Verified Answer
    Verified by sachinpdesai
    Genius16190 points

    Your code should look something like this:

    ARM:                                               DSP:

        hARM = MSGQ_create("somename")

                                                          hDSP = MSGQ_locate("somename")

        MSGQ_get(hARM)

                                                          MSGQ_alloc(hDSP)

                                                          MSGQ_put(hDSP)

        MSGQ_free(hARM)

        ... some time later

        MSGQ_delete(hARM)

    With the green code (ARM-side "get/free" and DSP-side "alloc/put") looping for each msg you send.  Is that what you're doing?

    Chris

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • sachinpdesai
    Posted by sachinpdesai
    on Apr 25 2012 13:23 PM
    Verified Answer
    Verified by sachinpdesai
    Intellectual1260 points

    Thanks once again Chris. The issue is resolved. I was doing

    ARM:                                               DSP:

        hARM = MSGQ_create("somename")

                                                          hDSP = MSGQ_locate("somename")

                                                           MSGQ_alloc(hDSP)

                                                           MSGQ_put(hDSP) Put message A

        MSGQ_get(hARM)

                                ... some time later

                                                           MSGQ_put(hDSP) Put message B

        MSGQ_get(hARM)

        ... some more time later

        MSGQ_free(hARM)

        MSGQ_delete(hARM)


    With your suggested sequence it works just fine.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use