Thank you !
How can I use the SPI master device in the audio driver?
I see the code sound/arm/sa11xx-uda1341.c, they call the L3 module,in my audio driver I need to call spi module
#include
struct sa11xx_uda1341 {
struct snd_card *card;
struct l3_client *uda1341;
struct snd_pcm *pcm;
long samplerate;
struct audio_stream s[2]; /* playback & capture */
};
l3_open(sa11xx_uda1341->uda1341);
How can I open the" netx_spi" I see the struct netx_spi in driver/spi/netx_spi.c
however I don't see the definition of it in file include/linux/spi/spi.h
and in netx_spi.c I don't see the open function .
MT,can you give me a small example how to call the netx-spi module? thanks a lot. I am a fresh in linux .
some problem I meet:
I have a big global audio data array : static u8 WindowsXP_Wav[243552] ={}
in my application program ,I must send it to my SPI codec, I use write(fd,WindowsXP_Wav,243552) write the data to my driver in the application program.
in my driver module I allocate a area 60 pages in the __init function
paudio_data=(void *)vmalloc(60);
memset(paudio_data,0,60);
In driver module "write function" I use "copy_from_user " copy the data from user space application :
if(copy_from_user(paudio_data,buf,243552))
{
return -EFAULT;
}
then I boot the system run my application program, the report like this
./spi_ctrl_wl
1 device file ope[ 44.850000] spi_codec driver file open ok
n
[ 44.850000] Unable to handle kernel paging request at virtual address c485c000
[ 44.860000] pgd = c07f0000
[ 44.860000] [c485c000] *pgd=804ab011, *pte=00000000, *ppte=00000000
[ 44.870000] Internal error: Oops: 807 [#1]
[ 44.870000] Modules linked in:
[ 44.870000] CPU: 0 Tainted: GF (2.6.23.1-rt5-ptx3-netx2 #130)
[ 44.870000] PC is at __copy_from_user+0x70/0x3b0
[ 44.870000] LR is at 0x6308cf
[ 44.870000] pc : [
[ 44.870000] sp : c3559f14 ip : fe130962 fp : c3559f44
[ 44.870000] r10: 00000000 r9 : c3558000 r8 : fc2d08d7
[ 44.870000] r7 : fafe0738 r6 : fa820477 r5 : faab00c4 r4 : fb64fcfa
[ 44.870000] r3 : fc87f9c4 r2 : 0003a6c0 r1 : 0000960c r0 : c485c000
[ 44.870000] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 44.870000] Control: 0005317f Table: 807f0000 DAC: 00000015
[ 44.870000] Process spi_ctrl_wl (pid: 950, stack limit = 0xc3558260)
[ 44.870000] Stack: (0xc3559f14 to 0xc355a000)
[ 44.870000] 9f00: 000085ec c3559f78 0003b760
[ 44.870000] 9f20: c3558000 c485b000 0003b760 00000000 c07e3000 c01f9784 c3559f74 c3559f48
[ 44.870000] 9f40: c009517c c01f9750 00000003 00000020 c353b000 c07e3000 fffffff7 00000000
[ 44.870000] 9f60: 00000000 c0027fc8 c3559fa4 c3559f78 c00958c4 c00950ac 00000000 00000000
[ 44.870000] 9f80: 00000005 00000000 40023db8 00000000 00000000 00000004 00000000 c3559fa8
[ 44.870000] 9fa0: c0027e20 c0095890 40023db8 00000000 00000003 000085ec 0003b760 00000003
[ 44.870000] 9fc0: 40023db8 00000000 00000000 00000004 00000000 00000000 4013a000 bec96d3c
[ 44.870000] 9fe0: 00000000 bec96d20 000084f0 400d2a7c 60000010 00000003 00000000 00000000
[ 44.870000] Backtrace:
[ 44.870000] [
[ 44.870000] [
[ 44.870000] r8:c0027fc8 r7:00000000 r6:00000000 r5:fffffff7 r4:c07e3000
[ 44.870000] [
[ 44.870000] r7:00000004 r6:00000000 r5:00000000 r4:40023db8
[ 44.870000] Code: e4b18004 e4b1c004 e4b1e004 e2522020 (e8a051f8)
[ 45.060000] spi_codec driver release ok
Segmentation fault
how to deal with this problem?? the method copy_from_user can't copy big array??
Thank you!
Hilscher Gesellschaft für Systemautomation mbH
how to deal with this problem?? the method copy_from_user can't copy big array??
Thank you!
Why should copy_from_user have a size limitation. I suggest you verify the pointers you are passing to the function. It's a usual segmentation fault (memory access violaton) in copy_from_user, which you can see here:
[ 44.870000] Internal error: Oops: 807 [#1] [ 44.870000] Modules linked in: [ 44.870000] CPU: 0 Tainted: GF (2.6.23.1-rt5-ptx3-netx2 #130) [ 44.870000] PC is at __copy_from_user+0x70/0x3b0 [ 44.870000] LR is at 0x6308cf
paudio_data=(void *)vmalloc(60); memset(paudio_data,0,60); if(copy_from_user(paudio_data,buf,243552)) { return -EFAULT; }
If I understand your code right you allocate 60 Bytes, and try to copy 243552 bytes into this buffer? Seems like magic compression to me, or how do you expect your buffer to fit into 60 bytes?
Regards
MT
Oh ,thankyou MT ,I misunderstand the vmalloc I assume it allocate 60 page,however
I set
paudio_data=(void *)vmalloc(245760);
memset(paudio_data,0,245760);
In my test application program I define a global array: unsigned const char WindowsXP_Wav[243552] = {
0x52, 0x49, 0x46, 0x46, 0x58, 0xb7, 0x03, 0x00,............}
then I run it to test my driver , and here is the error,
allocation failed: out of vmalloc space - use vmalloc=
[ 163.090000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 163.100000] pgd = c3748000
[ 163.110000] [00000000] *pgd=8374d031, *pte=00000000, *ppte=00000000
[ 163.110000] Internal error: Oops: 17 [#1]
[ 163.110000] Modules linked in:
[ 163.110000] CPU: 0 Tainted: GF (2.6.23.1-rt5-ptx3-netx2 #146)
[ 163.110000] PC is at VsPlaywave+0x310/0x488
[ 163.110000] LR is at 0x0
[ 163.110000] pc : [
[ 163.110000] sp : c36ffef8 ip : c03b03a8 fp : c36fff1c
[ 163.110000] r10: 00000000 r9 : c36fe000 r8 : 00000003
[ 163.110000] r7 : 000323e0 r6 : c06a8c00 r5 : c044b7f8 r4 : 00000020
[ 163.110000] r3 : 00000000 r2 : 00000001 r1 : 00000002 r0 : 00000000
[ 163.110000] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 163.110000] Control: 0005317f Table: 83748000 DAC: 00000015
[ 163.110000] Process play_from_user (pid: 960, stack limit = 0xc36fe260)
[ 163.110000] Stack: (0xc36ffef8 to 0xc3700000)
[ 163.110000] fee0: c044b800 00000001
[ 163.110000] ff00: 00000001 c044b800 00000001 c3c9b5a0 c36fff34 c36fff20 c01fa31c c01f9e38
[ 163.110000] ff20: c3c9b5a0 c01fa2b0 c36fff4c c36fff38 c00a2260 c01fa2c0 c3c9b5a0 00001388
[ 163.110000] ff40: c36fff74 c36fff50 c00a22d4 c00a2204 c36fff74 ffffffff 00001000 00000000
[ 163.110000] ff60: 00001388 00000001 c36fffa4 c36fff78 c00a2584 c00a2278 c002ea40 00000000
[ 163.110000] ff80: c36fffac 40023db8 00000000 00000000 00000036 c0027fc8 00000000 c36fffa8
[ 163.110000] ffa0: c0027e20 c00a2514 40023db8 00000000 00000003 00000001 00001388 00001387
[ 163.110000] ffc0: 40023db8 00000000 00000000 00000036 00000000 00000000 4013a000 beae1d2c
[ 163.110000] ffe0: 00000000 beae1d10 00008554 400d985c 60000010 00000003 80002031 80002431
[ 163.110000] Backtrace:
[ 163.110000] [
[ 163.110000] r7:c3c9b5a0 r6:00000001 r5:c044b800 r4:00000001
[ 163.110000] [
[ 163.110000] r5:c01fa2b0 r4:c3c9b5a0
[ 163.110000] [
[ 163.110000] r5:00001388 r4:c3c9b5a0
[ 163.110000] [
[ 163.110000] r6:00000001 r5:00001388 r4:00000000
[ 163.110000] [
[ 163.110000] r8:c0027fc8 r7:00000036 r6:00000000 r5:00000000 r4:40023db8
[ 163.110000] Code: e59f012c e3a01004 e3a02000 ebf8d5a9 (e5903000)
[ 163.340000] spi_codec driver release ok
Segmentation fault
I allocate big area 250000 the result is the same!
this is my main code:
u8 *paudio_data;
static int spi_test_probe(struct spi_device *spi)
{
p_netx_spi_device=spi;
spi_codec_gpio_init();
spi->mode = SPI_MODE_0;
spi->bits_per_word = 8;
spi->max_speed_hz = 1250000;
(spi->master->setup)(spi);
return 0;
}
the speed of spi is 1.25Mhz ,243552 byte
ssize_t spi_codec_write(struct file *filp,const char __user *buf,size_t count,loff_t *f_pos)
{
if(copy_from_user(paudio_data,buf,243552))
{
return -EFAULT;
} // here is right no error
VsSineTest(p_netx_spi_device);//here is ok
VsPlaywave(p_netx_spi_device);
*f_pos+=count;
return 1;
}
here is the main codec data sending code:
void VsPlaywave(struct spi_device *spi)
{
for(jj=0;jj<243552;jj+=32)
{
Mp3SelectData();
while((pio_in& MP3_DREQ)== 0);
for(i=0;i<32;i++)
{
SPIPutChar(spi, paudio_data);
paudio_data+=1;
}
Mp3DeselectData(); //xDCS = 1
}
printk("&&&&&&send data is over\n");
}
void SPIPutChar(struct spi_device *spi,u8 *c)
{
spi_write(spi, c, 1);
}
static int __init spi_test_init(void)
{
result=spi_register_driver(&spi_test_driver);
paudio_data=(void *)vmalloc(255760);
memset(paudio_data,0,255760);
}
here is the small test application:
int main()
{
int fd;
int n;
printf("1 device file open\n");
fd=open("/dev/spi_codec_wl",O_RDWR|O_NDELAY);
if(fd==-1)
{
printf("fd=%d\n",fd);
perror("fail to open spi_test");
exit(1);
}
write(fd,WindowsXP_Wav,243552);
}
now I move the global array in my driver spi_test.c :
and resize it to static u8 WindowsXP_Wav[65536] = {.....}
void SPIPutChar(struct spi_device *spi,u8 c)
{ u8 buf[1];
buf[0]=c;
spi_write(spi, buf, 1);
}
void VsPlaywave(struct spi_device *spi)
{
for(jj=0;jj<65536;jj+=32)
{
Mp3SelectData();
while((pio_in& MP3_DREQ)== 0);
for(i=0;i<32;i++)
{
SPIPutChar(spi,WindowsXP_Wav[jj+i]);
}
Mp3DeselectData();
}
}
int spi_codec_ioctl(struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg)
{
struct spi_codec_dev *dev=filp->private_data;
printk(" spi_codec ioctl start\n");
switch(cmd)
{
case SPI_CODEC_ON:
dev->value=1;
VsPlaywave(p_netx_spi_device);
break;
case SPI_CODEC_OFF:
break;
default:
return -ENOTTY;
}
printk("spi_codec ioctl over\n");
return 0;
}
when I run test program ,1 in 4 times it will report segment fault ,others it seems ok.
and when I resize the array u8 WindowsXP_Wav[131072] = {.....}
when I run test program ,1 in2 times it will report segment fault ,
I find that the size of global variable in the module driver affect it.
How can I solve this problem.The array size of my program is about 240kByte--- u8 WindowsXP_Wav[243552]
the fault message is the same:
allocation failed: out of vmalloc space - use vmalloc=
[ 150.690000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 150.690000] pgd = c37d4000
[ 150.700000] [00000000] *pgd=83d22031, *pte=00000000, *ppte=00000000
[ 150.700000] Internal error: Oops: 17 [#1]
[ 150.700000] Modules linked in:
[ 150.700000] CPU: 0 Tainted: GF (2.6.23.1-rt5-ptx3-netx2 #161)
[ 150.700000] PC is at VsPlaywave+0x270/0x38c
[ 150.700000] LR is at 0x0
[ 150.700000] pc : [
[ 150.700000] sp : c34c5ee8 ip : c03c03a8 fp : c34c5f14
[ 150.700000] r10: 00000000 r9 : c34c4000 r8 : c02ffc50
[ 150.700000] r7 : 00000380 r6 : c05ff800 r5 : c02fffd0 r4 : 00000020
[ 150.700000] r3 : 00000000 r2 : 00000001 r1 : 00000002 r0 : 00000000
[ 150.700000] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 150.700000] Control: 0005317f Table: 837d4000 DAC: 00000015
[ 150.700000] Process wangl_test (pid: 954, stack limit = 0xc34c4260)
[ 150.700000] Stack: (0xc34c5ee8 to 0xc34c6000)
[ 150.700000] 5ee0: c003b280 00000001 c0517e40 00000001 c0517e40 c04201a0
[ 150.700000] 5f00: c3505960 00000003 c34c5f34 c34c5f18 c01fb900 c01fb50c c34c5f34 c3505960
[ 150.700000] 5f20: c01fb888 00000001 c34c5f4c c34c5f38 c00a2260 c01fb898 c3505960 4001e000
[ 150.700000] 5f40: c34c5f74 c34c5f50 c00a22d4 c00a2204 c3d6a9c0 ffffffff 00001000 00000000
[ 150.700000] 5f60: 4001e000 00000001 c34c5fa4 c34c5f78 c00a2584 c00a2278 c002ea40 00000000
[ 150.700000] 5f80: 00000005 40023db8 00000000 00000000 00000036 c0027fc8 00000000 c34c5fa8
[ 150.700000] 5fa0: c0027e20 c00a2514 40023db8 00000000 00000003 00000001 4001e000 00000003
[ 150.700000] 5fc0: 40023db8 00000000 00000000 00000036 00000000 00000000 4013a000 bec86d3c
[ 150.700000] 5fe0: 00000000 bec86d20 000084b8 400d985c 60000010 00000003 00000000 00000000
[ 150.700000] Backtrace:
[ 150.700000] [
[ 150.700000] r8:00000003 r7:c3505960 r6:c04201a0 r5:c0517e40 r4:00000001
[ 150.700000] [
[ 150.700000] r6:00000001 r5:c01fb888 r4:c3505960
[ 150.700000] [
[ 150.700000] r5:4001e000 r4:c3505960
[ 150.700000] [
[ 150.700000] r6:00000001 r5:4001e000 r4:00000000
[ 150.700000] [
[ 150.700000] r8:c0027fc8 r7:00000036 r6:00000000 r5:00000000 r4:40023db8
[ 150.700000] Code: e59f0114 e3a01004 e3a02000 ebf8d01c (e5903000)
[ 150.930000] spi_codec driver release ok
Segmentation fault
Hilscher Gesellschaft für Systemautomation mbH
allocation failed: out of vmalloc space - use vmalloc=to increase size.
[ 150.690000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
You should read the error message, and not just copy and paste them. vmalloc returns a NULL pointer and you seem to use it in your code.
Regards
MT
Dear MT
I have resolve the problem ,that is caused by the ioremap
//#define pio_out_en *(volatile int *)(ioremap((unsigned long)0x00100908,4))
//#define pio_out *(volatile int *)(ioremap((unsigned long)0x00100904,4))
//#define pio_in *(volatile int *)(ioremap((unsigned long)0x00100900,4))
last time ,I use pio directly by the three macro pointer,and now I use
#define pio_reg_start 0x00100900
#define pio_in 0x0
#define pio_out 0x4
#define pio_out_en 0x8
pio_area=request_mem_region(pio_reg_start ,0xc,"netx-spi");//spi->name);
if(pio_area==NULL){
printk("can't reserve region\n");
}
pio_base=ioremap(pio_reg_start ,0xc);
void Mp3SelectControl(void)
{
unsigned long val;
val=readl(pio_base+pio_out);
val &= ~ MP3_XCS;
writel(val,pio_base+pio_out);
}
and the mp3 codec driver in linux is ok now!thank you for your help! :D so happy
Dear MT
I am now transplant the spi_codec char driver to alsa architecture
I view the example of other platform such samsung, blackfin using uda1341 ,both of them use DMA,since there is no DMA in NETX500,
the substream->runtime ->dma_addr is the audio data buffer start ,it is the physical bus address
how Can I use spi_write() to write the audio data start from substream->runtime ->dma_addr to the spi bus
I see the explanation in the LINUX device driver.pdf as follow:
Variables of type dma_addr_t should be treated as opaque by the driver;the only allowable operations are to pass them to the DMA support routines and to the device itself .Aa a bus address ,dma_addr_t may lead to unexpected problems if used directly by the CPU.
how Can I use spi_write() to write the audio data start from substream->runtime ->dma_addr to the spi bus?? The substream audio data address is type of dma_addr_t ,I don't know how to deal it! Can you give me some advice?
and I see the document writing-an-alsa-driver.pdf .I see Chapter 11 .Buffer and Memory Management ->Externel Hardware Buffers
some chips have their own hardware buffers and the DMA transfer from the host memory is not available. In such a case, you need to either
1) copy/set the audio data directly to the external hardwarebuffer, or
2) make an intermediate buffer and copy/set the data from it to the external hardware buffer in interrupts (or in tasklets, preferably).
The first case works fine if the external hardware buffer is enough large. This method doesn’t need any
extra buffers and thus is more effective. You need to define the copy and silence callbacks for the data
transfer.(however My codec buffer is 32B )
static int playback_copy(struct snd_pcm_substream *substream, int channel,
snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count);
Is that mean if there is no DMA I must realize the playback_copy?
Thank you !
Hilscher Gesellschaft für Systemautomation mbH
the substream->runtime ->dma_addr is the audio data buffer start ,it is the physical bus address
how Can I use spi_write() to write the audio data start from substream->runtime ->dma_addr to the spi bus
The runtime structure contains dma_addr AND dma_area.
See the following documentation ALSA DMA Buffer information
You can try to emulate DMA this way, but I assume ALSA prefers for drivers that are not able to use DMA to implement playback_copy. See http://www.kernel.org/pub/linux/kernel/people/tiwai/docs/writing-an-alsa-driver/ch11s02.html
BTW: I don't know anything about ALSA driver, and also need to look into the documentation.
Regards
MT
[/]Thank you for your reply very much!
now I am try to transplant the alsa-utils-1.0.13 to get the aplay to test my driver,I
have installed the "salsa-lib-0.0.21" to my NFS filesystem successfully ,
My nfs system path is /tftpboot/192.168.1.118,when I go to the folder alsa-utils-1.0.13 and run the following command:
./configure --host=arm-v4t-linux-gnueabi --build=i486-linux --prefix=/tftpboot/192.168.1.118/usr --with-alsa-prefix=/tftpboot/192.168.1.118/lib --with-alsa-inc-prefix=/tftpboot/192.168.1.118/include CPPFLAGS="-I/tftpboot/192.168.1.118/include/alsa -l salsa -I/tftpboot/192.168.1.118/usr/include/ncurses"
It report that:
checking for arm-v4t-linux-gnueabi-gcc... no
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
It report that no cross-compiler , why there is such error? I compile the salsa-lib-0.0.21,linux kernel all by arm-v4t-linux-gcc ,why It can't be found by alsa-utils-1.0.13?
then I run arm-v4t-linux-gcc -v ,It report like this:
Using built-in specs.
Target: arm-v4t-linux-gnueabi
Configured with: /netxbsp/OSELAS/OSELAS.Toolchain-1.1.1/build-cross/gcc-4.1.2/configure --host=i686-host-linux-gnu --target=arm-v4t-linux-gnueabi --prefix=/opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18 --with-sysroot=/opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18/sysroot-arm-v4t-linux-gnueabi --with-arch=armv4t --with-float=soft --with-fpu=vfp --disable-nls --disable-multilib --enable-symvers=gnu --enable-__cxa_atexit --enable-shared --enable-threads=posix --enable-languages=c,c++ --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.1.2
the compiler is ok! What is the problem?
I change it to this :
./configure --host=arm-v4t-linux-gnueabi --target=arm-v4t-linux-gnueabi --build=i486-linux --prefix=/tftpboot/192.168.1.118/usr --with-alsa-prefix=/tftpboot/192.168.1.118/lib --with-alsa-inc-prefix=/tftpboot/192.168.1.118/include
it is ok
checking for arm-v4t-linux-gnueabi-gcc... arm-v4t-linux-gnueabi-gcc
checking for libasound headers version >= 1.0.12... found.
checking for snd_ctl_open in -lasound... no
configure: error: No linkable libasound was found.
I do not understand why it can find now
and though I install salsalib , there is no libasound in my nfs filesystem /tftpboot/192.168.1.118/lib
Hilscher Gesellschaft für Systemautomation mbH
checking for snd_ctl_open in -lasound... no
configure: error: No linkable libasound was found.I do not understand why it can find now
and though I install salsalib , there is no libasound in my nfs filesystem /tftpboot/192.168.1.118/lib
This is basic linux and compiler howto and has nothing to do with netX specific implementation, so it might be wrong in these forums.
But it's quite easy. You write that you are using a replacement alsa (salsa). This comes with the library libsalsa.so and not with libasound.so. See here:
ll /tmp/salsa/lib/ -rw-r--r-- 1 mtrensch users 242240 2009-04-15 09:17 libsalsa.a -rwxr-xr-x 1 mtrensch users 926 2009-04-15 09:17 libsalsa.la lrwxrwxrwx 1 mtrensch users 17 2009-04-15 09:17 libsalsa.so -> libsalsa.so.0.0.1 lrwxrwxrwx 1 mtrensch users 17 2009-04-15 09:17 libsalsa.so.0 -> libsalsa.so.0.0.1 -rwxr-xr-x 1 mtrensch users 193177 2009-04-15 09:17 libsalsa.so.0.0.1 drwxr-xr-x 2 mtrensch users 4096 2009-04-15 09:17 pkgconfig
So you will need to tell the configure script to use libsalsa additionally.
Example:
LIBS=-lsalsa ./configure ......
This should always append -lsalsa to every compile procedure. It might not work, as I've not tested it, but you should get an idea what to do.
Or you can do a symlink libasound.so --> libsalsa.so
Regards
MT
I change it to this :
./configure --host=arm-v4t-linux-gnueabi --target=arm-v4t-linux-gnueabi --build=i486-linux --prefix=/tftpboot/192.168.1.118/usr --with-alsa-prefix=/tftpboot/192.168.1.118/lib --with-alsa-inc-prefix=/tftpboot/192.168.1.118/include
it is ok
checking for arm-v4t-linux-gnueabi-gcc... arm-v4t-linux-gnueabi-gcc
checking for libasound headers version >= 1.0.12... found.
checking for snd_ctl_open in -lasound... no
configure: error: No linkable libasound was found.I do not understand why it can find now
Hilscher Gesellschaft für Systemautomation mbH
wangl wrote:I change it to this :
./configure --host=arm-v4t-linux-gnueabi --target=arm-v4t-linux-gnueabi --build=i486-linux --prefix=/tftpboot/192.168.1.118/usr --with-alsa-prefix=/tftpboot/192.168.1.118/lib --with-alsa-inc-prefix=/tftpboot/192.168.1.118/include
it is ok
checking for arm-v4t-linux-gnueabi-gcc... arm-v4t-linux-gnueabi-gcc
checking for libasound headers version >= 1.0.12... found.
checking for snd_ctl_open in -lasound... no
configure: error: No linkable libasound was found.I do not understand why it can find now
now it regenerate again , even I use the same command above it report :
checking for arm-v4t-linux-gnueabi-gcc... no
I reinstall the salsa .There is libasound.so link now.However the toolchain
,why the ./configure can't find it ? oh ,it is so strange
As always under linux with configure scripts take a look into config.log. There is a detailed error message where the problem comes from
Regards
MT
however in another PC,
when I install the salsa lib
I run ./configure --host=arm-v4t-linux-gnueabi --prefix=
make
make install
then it report:
../libtool: line 944: arm-v4t-linux-gnueabi-ranlib: command not found
make[2]: *** [install-libLTLIBRARIES] Error 127
however the arm-v4t-linux-gnueabi-ranlib is in the folder
/opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18/bin
when I run ./configure --host=arm-v4t-linux-gnueabi --prefix=
it report:
checking for arm-v4t-linux-gnueabi-ranlib... arm-v4t-linux-gnueabi-ranlib
when I run:
ls -l arm-v4t-linux-gnueabi-ranlib
-rwxr-xr-x 2 1001 users 1927929 2008-01-10 17:09 arm-v4t-linux-gnueabi-ranlib
it report that ranlib is an executable file
What is wrong?
I have solve it .Because I use ubuntu ,when I run ./configure ,I have no Permissions,so I add sudo.However I add this line
export PATH= /opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18/bin/:$PATH in the ~/.bashrc file in user me-wangl.When I use sudo ,the PATH will not contain this line ,because of sudo ,the environment will be root!So I use su,then add this line ~/.bashrc.then it can find the toolchain now !however, new problem:
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for arm-v4t-linux-gnueabi-strip... arm-v4t-linux-gnueabi-strip
checking whether NLS is requested... yes
checking for msgfmt... /usr/bin/msgfmt
checking for gmsgfmt... /usr/bin/msgfmt
checking for xgettext... /usr/bin/xgettext
checking for msgmerge... /usr/bin/msgmerge
checking for style of include used by make... GNU
checking for arm-v4t-linux-gnueabi-gcc... arm-v4t-linux-gnueabi-gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
Is there any tools what I need to install? so I go to see config.log
I find these:
configure:2473: arm-v4t-linux-gnueabi-gcc conftest.c -lsalsa >&5
/opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18/lib/gcc/arm-v4t-linux-gnueabi/4.1.2/../../../../arm-v4t-linux-gnueabi/bin/ld: cannot find -lsalsa
collect2: ld returned 1 exit status
configure:2476: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE "alsa-utils"
| #define VERSION "1.0.13"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2515: error: C compiler cannot create executables
See `config.log' for more details.
It don't find libsalsa
my configure command is:
LIBS=-lsalsa ./configure --host=arm-v4t-linux-gnueabi --target=arm-v4t-linux-gnueabi --build=i486-linux --prefix=/tftpboot/192.168.1.118/usr --with-alsa-prefix=/tftpboot/192.168.1.118/lib --with-alsa-inc-prefix=/tftpboot/192.168.1.118/include
however ,my lib libsalsa is under the folder /tftpboot/192.168.1.118/lib
I try to solve this
when I discard the LIBS=-lsalsa ,the configure operation can success ,however when I run make ,there is a lot of erro!I think that there is no error ALSA uliti source code,just it don't find the lib.It must find the salsa lib.
Hilscher Gesellschaft für Systemautomation mbH
I am really starting myself if you really read the documentation of the free to download libraries you are using. You will need to try yourself how to compile a library from the WWW.
When writing drivers for an operating system you won't any reply from the chip developer why your library is not working.
I have done a little research now and have READ the documentation of salsa and alsa-utils, but I won't do this the next time. I've seen now from your postings, that you seem to ignore compiler warnings, etc. You don't look at possible include path, nor do you care about library include pathes/names. If you want to write driver's for open source projects you will need to read their documentation and understand their build environment. Maybe there's even forums and mailing lists on their sites.
Here is a short info how to compile salsa and alsa-utils (You will need to change the pathes, as it was built in a temporary folder):
libsalsa (0.0.21):
export PATH=$PATH:/opt/OSELAS.Toolchain-1.1.1/arm-v4t-linux-gnueabi/gcc-4.1.2-glibc-2.5-kernel-2.6.18/bin ./configure --host=arm-v4t-linux-gnueabi --prefix=/tmp/salsa_arm --enable-libasound --enable-conf --enable-rawmidi --enable-seq --enable-timer make all install
libncurses (which is needed for alsamixer, i've used version 5.7):
./configure --host=arm-v4t-linux-gnueabi --prefix=/tmp/salsa_arm make all install
alsa-utils (1.0.19).
NOTE: You will need to remove both references to iecset from Makefile.in, as iecset cannot be built against salsa.
./configure --host=arm-v4t-linux-gnueabi --prefix=/tmp/salsa_arm --with-alsa-prefix=/tmp/salsa_arm/lib --with-alsa-inc-prefix=/tmp/salsa_arm/include CFLAGS=-I/tmp/salsa_arm/include/ncurses make all install
PS: Next time I will not post any Plug-And-Play solution, for other's peoples projects.
Regards
MT
I am really starting myself if you really read the documentation of the free to download libraries you are using. You will need to try yourself how to compile a library from the WWW.
When writing drivers for an operating system you won't any reply from the chip developer why your library is not working.
I have done a little research now and have READ the documentation of salsa and alsa-utils, but I won't do this the next time. I've seen now from your postings, that you seem to ignore compiler warnings, etc. You don't look at possible include path, nor do you care about library include pathes/names. If you want to write driver's for open source projects you will need to read their documentation and understand their build environment. Maybe there's even forums and mailing lists on their sites.
Dear MT:
I have a question to ask you!
The nxdb500,frequence ,I use timer2 to generate interrupt count every clock cycle
the input clock of netxdb500 is 25Mhz ,what is the frequency of cclk?Where does it define in the linux source file ?
Hilscher Gesellschaft für Systemautomation mbH
Dear MT:
The nxdb500,frequence ,I use timer2 to generate interrupt count every clock cycle
the input clock of netxdb500 is 25Mhz ,what is the frequency of cclk?Where does it define in the linux source file ?
It is correct that there is an external 25MHz oscillator connected to the netX, but this does not represent the internal clocks.
The netX 100/500 data sheet clearly states the following clocks:
And it is defined in the platform headers (CLOCK_TICK_RATE), as for every other linux platform too.
Regards
MT
[/]MT:
Oh ,I have seen that in the Data reference guide 2.1 ,
it said that The cpu runs on a 200MHx system clock ,Is that in the situation when the input Oscillator is 25MHz.Is that mean I can't change the system clock? I have never see a cpu do such thing!
Hilscher Gesellschaft für Systemautomation mbH
it said that The cpu runs on a 200MHx system clock ,Is that in the situation when the input Oscillator is 25MHz
All peripherals (Counters, SPI, etc..) run at a fixed clock of 100MHz (ARM clock / 2). Whenever another clockrate is needed, the peripheral itself offers some registers to generate a different clock from the 100MHz.
.Is that mean I can't change the system clock? I have never see a cpu do such thing!
Why should you want to change the system clock (200MHz) at runtime?
I don't see the correlation to your first question, where you are asking for a timer. The timer is generated through the 100MHz peripheral clock and can freely be adjusted in increments of 10ns (1/100MHz). Generating an interrupt with every ARM clock cycle (5ns), seems a little to much for me. Who should handle the interrupt load? Or am I missing something in your explanation?
Regards
MT
Dear MT
I have realize the Alsa driver use the spi codec now!You can introduce VS1003 or VS1053 spi codec to other user who are facing the audio problem because of IIS interface problem with NETX. It can play music successfully ,but a little noise ,because the interrupt interval is a little long.However ,it is enough for our using.I use the kernel timer API,and do not use the timer 2. Thanks to your help!
Now I am trying to write the usb driver.Is there some example in the source which is used by netx? In the source code path driver/usb I do not see a file which have relationship with netx(with prefix name netx ).Can you tell me one ?We need to support the USB HID and USB Mass storage!
I want to use the USB Keyboard with nxdb500 board ,when I run make menuconfig,then choose Device driver->USB support ,It seem that nothing related to netx !
Hilscher Gesellschaft für Systemautomation mbH
Now I am trying to write the usb driver.Is there some example in the source which is used by netx? In the source code path driver/usb I do not see a file which have relationship with netx(with prefix name netx ).
Can you tell me one?
Regards
MT
Dear MT
My audio driver has some problem,I need to do the following step to make my driver be effective
mkdir /dev/snd
mknod /dev/snd/pcmC0D0p c 116 16
I see the book LDD chapter 3
The user of a driver that is distributed in the form of a module can invoke such a script from the system’s
rc.local file
however there is no rc.local file in my fils system ,in folder /etc/init.d just these folder:
banner inetd modules networking openssh pure-ftpd rcS telnetd thttpd udev xorg
I edit the file rcS like this:
#!/bin/sh
#
# /etc/init.d/rcS
#
# $Id: rcS 7022 2007-02-28 14:17:06Z jbe $
#
echo -n "mounting filesystems..."
mount -a 2>/dev/null
echo "done."
# modprobe ppp_async
# loadkmap < /etc/boottime.kmap
# set hostname
test -e /etc/hostname && hostname -F /etc/hostname
mkdir /dev/snd
mknod /dev/snd/pcmC0D0p c 116 16
echo "running rc.d services..."
run-parts -a start /etc/rc.d
however when the system boot ,it show these:
[ 12.790000] Freeing init memory: 132K
mounting filesystems...done.
mkdir: cannot create directory '/dev/snd': File exists
mknod: /dev/snd/pcmC0D0p: File exists
running rc.d services...
mounting... ramfs at /dev
creating initial udev device nodes:
making extra nodes
udev startup is finished
loading modules
however when I use root login the netx linux system
cd /dev
there is no /dev/snd or /dev/pcmC0D0p node.
so I change the file rcS add some sentence:
rm -rf /dev/snd
rm -rf /dev/snd/pcmC0D0p
mkdir /dev/snd
mknod /dev/snd/pcmC0D0p c 116 16
however there is also no directory /dev/snd or node pcmC0D0p
what is wrong?
thank you MT
Best regards
Hilscher Gesellschaft für Systemautomation mbH
Did you compile your driver as a module, then you will need to make it started by using modprobe (or entering it into /etc/modules).
If you link it into the kernel, it should be automatically started and the dev-nodes should be created. You may need to write a udev rule to create special dev-nodes (man udev)
Regards
MT
If you link it into the kernel, it should be automatically started and the dev-nodes should be created. You may need to write a udev rule to create special dev-nodes (man udev)
MT
snd-netx-vs1003-objs := netx-vs1003.o
in /sound/arm/Kconfig
menu "ALSA ARM devices"
depends on SND!=n && ARM
config SND_NETX_VS1003
tristate "netx500 vs1003 driver"
select SND_PCM
help
Say Y here if you have a board based on NETX Series
and want to use VS1003 audio chip.
So maybe I need to write a udev rule
Hilscher Gesellschaft für Systemautomation mbH
I am not quite sure if it may be driver dependent, if the entry is created automatically.
But another thing which came to my mind. If you do a mknod these entries will "survive" a reboot of the system. Usually you only need to create them once for a device.
On fixed embedded systems you can just do a mknod once, and don't create udev-rules.
On casual PCs with changing hardware (e.g. USB, hotplugging, etc) udev-rules are preferred.
Regards
MT
.
But another thing which came to my mind. If you do a mknod these entries will "survive" a reboot of the system. Usually you only need to create them once for a device.On fixed embedded systems you can just do a mknod once, and don't create udev-rules.
On casual PCs with changing hardware (e.g. USB, hotplugging, etc) udev-rules are preferred.
Hilscher Gesellschaft für Systemautomation mbH
AFAIK it should not matter if JFFS2 or NFS is used. Maybe you have wrong permissions set on the NFS export, so the nodes are not saved?
Regards
MT
M T
Hilscher Gesellschaft für Systemautomation mbH
I am no linux driver writer and I cannot give you an example. But there is much documentation around (even a Linux Driver Development Kit" at http://kernel.org/pub/linux/kernel/people/gregkh/ddk or an openbook at http://lwn.net/Kernel/LDD3).
You may also take a look at "arch/arm/mach-netx/nxhmire.c" to see how the display driver accesses the SPI interface. IMHO you will need to write a spi device driver and communicate through it, but as I told you I have no experience in writing drivers under Linux.
PS: I won't do a linux basic course.
BTW: Could a moderator split this thread, as it has nothing todo with "Hardware/General questions" any more.
Regards
MT