Find the answer to your Linux question:
Results 1 to 5 of 5
Hi I am moving some code for to work with SPI interface from windows to Linux SUSE platform and for to make it working I have to communicate with some ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3

    Communication between c++ project and SPI driver

    Hi

    I am moving some code for to work with SPI interface from windows to Linux SUSE platform and for to make it working I have to communicate with some small SPI driver, I have few libraries generated by that driver:

    libi2cbrdg.a
    libi2cbrdg.la
    libi2cbrdg.so
    libi2cbrdg.so.1
    libi2cbrdg.so.1.1.0

    I am compiling my project with following makefile:

    comp: ErrorCodes.h Errors.h FrameDll.h FrameDllHeader.h Framework.h Functions.h TargetProcessor.h Layout1.h ModCommon.h ModScalerDB.h ProxyIDs.h SPIProxy.h SPITuning.cpp ModBiquad.h ModCommon.h ModDeinterleave.h ModFloatToFract32.h
    g++ -g -L./lib -li2cbrdg ErrorCodes.h Errors.h FrameDll.h FrameDllHeader.h Framework.h Functions.h TargetProcessor.h Layout1.h ModCommon.h ModScalerDB.h ProxyIDs.h SPIProxy.h SPITuning.cpp -o comp.o

    Output:

    SPIProxy.h: In member function ‘virtual int CSPIProxy::_Read(void*, int)’:
    SPIProxy.h:55: error: ‘U2C_IoWrite’ was not declared in this scope
    SPIProxy.h:56: error: ‘U2C_SpiRead’ was not declared in this scope
    SPIProxy.h: In member function ‘virtual int CSPIProxy::_Write(const void*, int)’:
    SPIProxy.h:65: error: ‘U2C_IoWrite’ was not declared in this scope
    SPIProxy.h:66: error: ‘U2C_SpiWrite’ was not declared in this scope
    SPIProxy.h: In member function ‘virtual int CSPIProxy::Open(unsigned int)’:
    SPIProxy.h:185: error: ‘U2C_GetDeviceCount’ was not declared in this scope
    SPIProxy.h:192: error: ‘U2C_OpenDevice’ was not declared in this scope
    SPIProxy.h:200: error: ‘U2C_SpiSetConfig’ was not declared in this scope
    SPIProxy.h:201: error: ‘U2C_SPI_FREQ_200KHZ’ was not declared in this scope
    SPIProxy.h:201: error: ‘U2C_SpiSetFreq’ was not declared in this scope
    SPIProxy.h:202: error: ‘U2C_SetIoDirection’ was not declared in this scope
    SPIProxy.h:203: error: ‘U2C_IoWrite’ was not declared in this scope
    SPIProxy.h: In member function ‘virtual int CSPIProxy::_Read(void*, int)’:
    SPIProxy.h:55: error: ‘U2C_IoWrite’ was not declared in this scope
    SPIProxy.h:56: error: ‘U2C_SpiRead’ was not declared in this scope
    SPIProxy.h: In member function ‘virtual int CSPIProxy::_Write(const void*, int)’:
    SPIProxy.h:65: error: ‘U2C_IoWrite’ was not declared in this scope
    SPIProxy.h:66: error: ‘U2C_SpiWrite’ was not declared in this scope
    SPIProxy.h: In member function ‘virtual int CSPIProxy::Open(unsigned int)’:
    SPIProxy.h:185: error: ‘U2C_GetDeviceCount’ was not declared in this scope
    SPIProxy.h:192: error: ‘U2C_OpenDevice’ was not declared in this scope
    SPIProxy.h:200: error: ‘U2C_SpiSetConfig’ was not declared in this scope
    SPIProxy.h:201: error: ‘U2C_SPI_FREQ_200KHZ’ was not declared in this scope
    SPIProxy.h:201: error: ‘U2C_SpiSetFreq’ was not declared in this scope
    SPIProxy.h:202: error: ‘U2C_SetIoDirection’ was not declared in this scope
    SPIProxy.h:203: error: ‘U2C_IoWrite’ was not declared in this scope

    But still as u see I have some functions missed I know that they are in these libraries, whats wrong? People, please, help?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    What do you mean by the SPI interface? I am somewhat familiar with the SPI functions for PostgreSQL. Is that what you are getting at? Or something else?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    3
    Quote Originally Posted by Rubberman View Post
    What do you mean by the SPI interface? I am somewhat familiar with the SPI functions for PostgreSQL. Is that what you are getting at? Or something else?
    Nop, nothing to do with SQL, I am trying to adjust communication with piece of hardware through some small adapter that speaks SPI, so my code has to be "connected" to driver for this adapter, these libraries belong to that driver, and functions that have to perform connection are in these libraries but I don't see any reason way compiler cannot see them after I am doing linking ?

  4. #4
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    I don't think .h files are typically put in the compile line of the makefile, or anywhere in the makefile for that matter, unless they actually have code to compile inside of them, do they?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    So, are you trying to write a device driver (kernel module), or is this strictly user-space code? The rules are very different.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...