LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-24-2012, 01:26 PM   #1
ktrboston
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Rep: Reputation: 0
expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before


Hi all, I no experience in prgramming skills but I am have trouble finding this error I receive when I run "Make Build" on this programm for a DPIO2 module. I am not going to put the whole code here but here is part of it
The first error I get is that root/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:141: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dpio2_kernel_interrupt_handler. Thanks in advance.


/*

Copyright (C) 2006 VMETRO ASA

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.

*/


/****************************************************************************
Module : dpio2-linux-kernel-module.c

Description :

Revision History:
01b,07oct2004,meh Removed devfs and in with udev.
01a,06oct2004,meh Created base on kernel module for 2.4.x

*****************************************************************************/


#ifndef __KERNEL__
# define __KERNEL__
#endif



/* Include
*/
#include "linux/module.h"
#include "linux/kernel.h" /* printk, .. */
#include "asm/io.h" /* ioremap, writel, readl, .. */
#include "asm/uaccess.h" /* copy_from/to_user, .. */
#include "linux/pci.h"
#include "linux/pagemap.h" /* page_cache_release, ... */

#include "vmosa-linux.h"
#include "dpio2-linux.h"
#include "dpio2-linux-kernel.h"

#include "Dpio2Defs.h" /* DPIO2_INTERRUPT_GLOBAL_MASK_REGISTER */

#include "release.h"



/* Set the right GPL license to avoid warrnings then loading the driver
*/
MODULE_LICENSE("VMETRO DPIO2");
MODULE_AUTHOR("Morten Ebbell Hestnes");
MODULE_DESCRIPTION("DPIO2 Device Driver");



/* Defines
*/
#define DPIO2_MAX_USER_MAP ( MAX_DPIO2_CARDS * 10 )



/* Globals
*/
static int dpio2_major = 0;
dpio2_device_t dpio2_device[MAX_DPIO2_CARDS+1];
dpio2_device_t* dpio2_device_irq_cmp[MAX_DEVICE_IRQ_CMP];
int dpio2_number_of_cards = 0;
dpio2_user_map_t dpio2_user_map_data[DPIO2_MAX_USER_MAP];
static int dpio2_bus_numbers[MAX_DPIO2_DEVICE];
dpio2_hw_info_t dpio2_hw_info[MAX_DPIO2_DEVICE];



/* Forward declaration
*/
int dpio2_open ( struct inode *inode, struct file *filp );
int dpio2_release ( struct inode *inode, struct file *filp );
int dpio2_ioctl ( struct inode *inode, struct file *filp,
unsigned int, unsigned long);
int dpio2_mmap ( struct file *filp, struct vm_area_struct *vma );
static void dpio2_exit ( void );
void free_user_pages ( struct page **pages, int nr_pages );
void save_user_map_data ( struct page **pages, int nr_pages );
void remove_user_map_data ( struct page **pages );
void init_user_map_data ( void );




struct file_operations dpio2_fops = {
open: dpio2_open,
release: dpio2_release,
ioctl: dpio2_ioctl,
mmap: dpio2_mmap,
};





#if 0
void busmark (dpio2_device_t *device, unsigned long u32)
{
UINT32 input;
writel ( u32, device->ctrl_base + DPIO2_GENERAL_PURPOSE_REGISTER );
readl ( device->ctrl_base + DPIO2_GENERAL_PURPOSE_REGISTER );
}
#endif






/**
* dpio2_kernel_interrupt_handler
*
* handle interrupt routed from a DPIO2 HW module by the kernel
*
* Do:
* (1) Check if legal interrupt.
* (2) Disable dpio2 routing it's interrupt to PCI
* (3) Give semaphore to waiting interrut handle pthread.
*
* @param irq
* @param *dev_id
* @param *regs
*
* @return IRQ_HANDLED or IRQ_NONE
*/
irqreturn_t dpio2_kernel_interrupt_handler (int irq,
void *device,
struct pt_regs *regs)
{


/* Check interrupt line number against dpio2_device struvt address
*/
if ( dpio2_device_irq_cmp [ irq ] != (dpio2_device_t*)device ) {

ERROR_MSG (("device struct pointer (0x%x) value is corrupted, should be (0x%x)\n",
(int) device, (int) dpio2_device_irq_cmp [ irq ] ));
return IRQ_NONE;

}
 
Old 09-24-2012, 05:14 PM   #2
byannoni
Member
 
Registered: Aug 2012
Location: /home/byannoni
Distribution: Arch
Posts: 128

Rep: Reputation: 36
Try adding this to the top:
Code:
#include "linux/irqreturn.h"
 
Old 09-25-2012, 02:02 PM   #3
ktrboston
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Adding irqreturn.h

Quote:
Originally Posted by byannoni View Post
Try adding this to the top:
Code:
#include "linux/irqreturn.h"

Should it be in the Include Section or above where the interrupt starts.
 
Old 09-25-2012, 02:48 PM   #4
byannoni
Member
 
Registered: Aug 2012
Location: /home/byannoni
Distribution: Arch
Posts: 128

Rep: Reputation: 36
I would put it with the rest of the includes for style, but you can put it anywhere above the interrupt
 
Old 09-26-2012, 11:52 AM   #5
ktrboston
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
When I add that line of code top or with the interrupt. I get the following error.

c/x86-linux-2.6.x/kernel/../../../lib/x86-linux-2.6.x;
make[1]: Entering directory `/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel'
make[1]: Leaving directory `/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel'
make -C /lib/modules/2.6.18-308.13.1.el5/build M=/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-308.13.1.el5-x86_64'
CC [M] /home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.o
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c: In function ‘dpio2_kernel_interrupt_handle’:
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:151: warning: cast from pointer to integer of different size
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:151: warning: cast from pointer to integer of different size
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:180: warning: cast from pointer to integer of different size
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:182: warning: cast from pointer to integer of different size
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c: In function ‘dpio2_mmap’:
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:398: error: implicit declaration of function ‘remap_page_range’
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c: In function ‘dpio2_ioctl’:
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:681: error: implicit declaration of function ‘free_irq’
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:721: error: implicit declaration of function ‘request_irq’
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:722: error: ‘dpio2_kernel_interrupt_handler’ undeclared (first use in this function)
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:722: error: (Each undeclared identifier is reported only once
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:722: error: for each function it appears in.)
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:723: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:953: warning: cast from pointer to integer of different size
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c: In function ‘dpio2_init’:
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:1705: error: implicit declaration of function ‘pci_find_class’
/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.c:1705: warning: assignment makes pointer from integer without a cast
make[2]: *** [/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel/dpio2-linux-kernel-module.o] Error 1
make[1]: *** [_module_/home/Bostonmicromachines/Desktop/dpio2-drv-src-x86-linux/src/x86-linux-2.6.x/kernel] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.18-308.13.1.el5-x86_64'
make: *** [build] Error 2
 
Old 09-26-2012, 11:55 AM   #6
ktrboston
LQ Newbie
 
Registered: Mar 2010
Posts: 5

Original Poster
Rep: Reputation: 0
Here is where I put for instance. I have put up in the include part but get the same thing.

/**
* dpio2_kernel_interrupt_handler
*
* handle interrupt routed from a DPIO2 HW module by the kernel
*
* Do:
* (1) Check if legal interrupt.
* (2) Disable dpio2 routing it's interrupt to PCI
* (3) Give semaphore to waiting interrut handle pthread.
*
* @param irq
* @param *dev_id
* @param *regs
*
* @return IRQ_HANDLED or IRQ_NONE
*/
#include "linux/irqreturn.h"
irqreturn_t dpio2_kernel_interrupt_handle (int irq,
void *device,
struct pt_regs *regs)
{


/* Check interrupt line number against dpio2_device struvt address
*/
if ( dpio2_device_irq_cmp [ irq ] != (dpio2_device_t*)device ) {

ERROR_MSG (("device struct pointer (0x%x) value is corrupted, should be (0x%x)\n",
(int) device, (int) dpio2_device_irq_cmp [ irq ] ));
return IRQ_NONE;

}
 
Old 02-11-2013, 05:22 PM   #7
lq@lanclos.org
LQ Newbie
 
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
It looks like you're trying to build the dpio2 source code from Vmetro (now owned by Curtiss-Wright) on a 64-bit Linux host. I recently went through this experience myself, on CentOS 5.x and CentOS 6.x; contact me via e-mail if you'd like a context diff of the necessary changes.
 
  


Reply

Tags
dpio2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
inline asm, 64-bit asm, intercepting segfaults, etc. rainbowsally Programming 0 02-04-2012 06:10 PM
[SOLVED] Why the expected =, ,, ;, asm or __attribute__ before typedef error? shawley Programming 8 02-02-2010 12:06 PM
libnet-functions.h:1432:error:expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before Jane2008 Linux - Newbie 2 11-13-2009 04:36 AM
unable to resolve compilation error;./List.c:5: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ amolgupta Programming 3 01-09-2009 11:09 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 03:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration