From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by ozlabs.org (Postfix) with ESMTP id BC168DDDE3 for ; Fri, 24 Oct 2008 03:59:21 +1100 (EST) Received: by yw-out-2324.google.com with SMTP id 5so113185ywh.39 for ; Thu, 23 Oct 2008 09:59:20 -0700 (PDT) Message-ID: Date: Thu, 23 Oct 2008 17:58:50 +0100 From: "Bruno Monteiro" To: "John Linn" Subject: Re: Compile program using XGpio In-Reply-To: <20081021200830.436214D8052@mail10-sin.bigfish.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_34353_17591202.1224781130265" References: <20081021200830.436214D8052@mail10-sin.bigfish.com> Cc: linuxppc-embedded@ozlabs.org List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , ------=_Part_34353_17591202.1224781130265 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I'm a new driver writer and i'm trying to understand how to deal with XGpio. My goal is writing a small piece of code that can turn leds on and off. I think this driver should do it: #include #include #include "xgpio.h" #include "xgpio_ioctl.h" #include "xparameters.h" XGpio led; static int myteste_init(void) { XGpio_Initialize (&led, LEDs_4Bit); XGpio_SetDataDirection(&led,1,0); XGpio_DiscreteWrite(&led,1,0xf); printk (KERN_ALERT "LEDS: Turn off\n"); return 0; } static int myteste_exit(void) { XGpio_DiscreteWrite(&led,1,0x0); printk (KERN_ALERT "LEDS: Turn on\n"); return 0; } module_init(myteste_init); module_exit(myteste_exit); But i have this error: ERROR: "XGpio_SetDataDirection" [drivers/char/mytest/mytest.ko] undefined! ERROR: "XGpio_Initialize" [drivers/char/mytest/mytest.ko] undefined! ERROR: "XGpio_DiscreteWrite" [drivers/char/mytest/mytest.ko] undefined! Any suggestion? This is the makefile: EXTRA_CFLAGS += -I$(TOPDIR)/drivers/xilinx_common EXTRA_CFLAGS += -I$(TOPDIR)/drivers/char/xilinx_gpio obj-$(CONFIG_MY_TEST) := mytest.o Is there any way to use *.dts instead xparameters.h Thanks, Bruno On Tue, Oct 21, 2008 at 9:08 PM, John Linn wrote: > Hi Bruno, > > > > I don't think you can do what you're trying to do, unless I'm > misunderstanding or just not smart enough. > > > > The EDK from Xilinx ships with drivers that are not Linux drivers. Those > functions in main below are intended for a standalone (no RTOS) system such > they can't just be called from a user app in Linux. You are sort of trying > to create a user mode driver with what you are doing. > > > > There is a character mode gpio driver in the Xilinx git tree, git:// > git.xilinx.com/linux-2.6-xlnx.git that has been used previously. I don't > currently test that driver as we're in the process of getting a flattened > gpio driver that is not char driver ready for mainline. > > > > I plan to take a look at the char mode gpio driver today as there's another > question regarding it on the list. > > > > Thanks, > > John > > > > > ------------------------------ > > *From:* linuxppc-embedded-bounces+john.linn=xilinx.com@ozlabs.org [mailto: > linuxppc-embedded-bounces+john.linn > =xilinx.com@ozlabs.org] *On Behalf Of *Bruno Monteiro > *Sent:* Tuesday, October 21, 2008 8:36 AM > *To:* linuxppc-embedded@ozlabs.org > *Subject:* Compile program using XGpio > > > > Hi all, > > > I'm working with a Virtex2p. I have a running system using: > > - EDK 9.1 > - Crosstool-ng (svn) > - linux-2.6-xlnx > - BusyBox 1.12.1 > > Now, i'm trying to build a small program that turn off leds. I guess it > should be something like this: > > void main (void){ > XGpio led; > XGpio_Initialize (&led, XPAR_LEDS_4BIT_DEVICE_ID); > XGpio_SetDataDirection(&led,1,0); > XGpio_DiscreteWrite(&led,1,0xf); > } > > > I want to know how to compile it (without EDK). Any suggestion? > > > Thanks, > Bruno Monteiro > > This email and any attachments are intended for the sole use of the named > recipient(s) and contain(s) confidential information that may be > proprietary, privileged or copyrighted under applicable law. If you are not > the intended recipient, do not read, copy, or forward this email message or > any attachments. Delete this email message and any attachments immediately. > ------=_Part_34353_17591202.1224781130265 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

I'm a new driver writer and i'm trying to understand how to deal with XGpio. My goal is writing a small piece of code that can turn leds on and off. I think this driver should do it:


#include <linux/init.h>
#include <linux/module.h>

#include "xgpio.h"
#include "xgpio_ioctl.h"
#include "xparameters.h"

XGpio led;

static int myteste_init(void)
{
    XGpio_Initialize (&led, LEDs_4Bit);
    XGpio_SetDataDirection(&led,1,0);   
    XGpio_DiscreteWrite(&led,1,0xf);   
    printk (KERN_ALERT "LEDS: Turn off\n");
   
    return 0;
}

static int myteste_exit(void)
{
   
    XGpio_DiscreteWrite(&led,1,0x0);   
    printk (KERN_ALERT "LEDS: Turn on\n");   
    return 0;
}

module_init(myteste_init);
module_exit(myteste_exit);

But i have this error:
ERROR: "XGpio_SetDataDirection" [drivers/char/mytest/mytest.ko] undefined!
ERROR: "XGpio_Initialize" [drivers/char/mytest/mytest.ko] undefined!
ERROR: "XGpio_DiscreteWrite" [drivers/char/mytest/mytest.ko] undefined!

Any suggestion? This is the makefile:
  EXTRA_CFLAGS    += -I$(TOPDIR)/drivers/xilinx_common
  EXTRA_CFLAGS    += -I$(TOPDIR)/drivers/char/xilinx_gpio
  obj-$(CONFIG_MY_TEST)     := mytest.o


Is there any way to use *.dts instead xparameters.h

Thanks,
Bruno




On Tue, Oct 21, 2008 at 9:08 PM, John Linn <John.Linn@xilinx.com> wrote:

Hi Bruno,

 

I don't think you can do what you're trying to do, unless I'm misunderstanding or just not smart enough.

 

The EDK from Xilinx ships with drivers that are not Linux drivers.  Those functions in main below are intended for a standalone (no RTOS) system such they can't just be called from a user app in Linux.  You are sort of trying to create a user mode driver with what you are doing.

 

There is a character mode gpio driver in the Xilinx git tree, git://git.xilinx.com/linux-2.6-xlnx.git that has been used previously.  I don't currently test that driver as we're in the process of getting a flattened gpio driver that is not char driver ready for mainline.

 

I plan to take a look at the char mode gpio driver today as there's another question regarding it on the list.

 

Thanks,

John

 

 


From: linuxppc-embedded-bounces+john.linn=xilinx.com@ozlabs.org [mailto:linuxppc-embedded-bounces+john.linn=xilinx.com@ozlabs.org] On Behalf Of Bruno Monteiro
Sent: Tuesday, October 21, 2008 8:36 AM
To: linuxppc-embedded@ozlabs.org
Subject: Compile program using XGpio

 

Hi all,



I'm working with a Virtex2p. I have a running system using:

  • EDK 9.1
  • Crosstool-ng (svn)
  • linux-2.6-xlnx
  • BusyBox 1.12.1

Now, i'm trying to build a small program that turn off leds. I guess it should be something like this:

void main (void){
    XGpio led;   
    XGpio_Initialize (&led, XPAR_LEDS_4BIT_DEVICE_ID);
    XGpio_SetDataDirection(&led,1,0);
    XGpio_DiscreteWrite(&led,1,0xf);   
}


I want to know how to compile it (without EDK). Any suggestion?


Thanks,
Bruno Monteiro


This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

------=_Part_34353_17591202.1224781130265--