Jump to content

Recommended Posts

Posted

hello  ,

 

I am making a controller which has an pre-existing driver code and  make it compatible with it ...

how can integrate the both ???

Hello Sir,

First of all, in what language is the pre-existing driver

code written in - Assembly of C ? If in C it is fairly easy

-- two ways to do it:

 

1. Use header files as

#include <cstdlib>

#include <cstring>

/* And so on ... */

 

2. Use the extern command as:

extern "C"

{

  #include <stdio.h>

  #include <stdlib.h>

  /* And so on .. */

};

 

If the pre-existing driver code is in Assembly,

a easy way would be to inline it inside the

C++ code, as

asm("assembly code as a string literal.")

OR

__asm__("assembly code as a string literal.")

 

In addition, one could use extended Assembly.

Note however, that using Assembly means

that the programmer has to keep track of:

1. Register naming

2. Ordering of operands

3. Operand Size

4. Immediate Operands

5. Memory operands

6. Indexing

Etc., etc.

Hope that helps.

Posted

My initial reaction is JDI. Please restate the question. Is the driver code written is assembly or C? Is there an OS presumption?

Hello ,

The driver code is written in c for linux  ..  and wish have to make a controller which runs on this driver code ....

Could you help me integrating the two  ..

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...