arm Linux programming in c

Ruben
Hi

This may seem like a strange question, but I am used to program pics etc...
and I am very new to linux and arm but want to get my fingers wet.

I read that you can use the kernel api for programming the arm device (I'm
using a mini2440) meaning you dont have to write the headers and the c
files implementation like you would for a pic. Is this true, or do i have
to write the headers and c files from scratch? 

This really confuses me as I dont know where to find the api documentation
and the specific header includes for the component I want to program
against? 

I've been googling the net but can't find an answer. If I can use the
kernel api, would someone please tell me where and how to locate the
headers and docs.

Thanks alot

Ruben

Juergen Beisert
When you run a Linux kernel on your Mini2440 forget about how to program
microcontrollers. Linux is an operating system. If you want to use the
kernel's API you need to write your own kernel drivers which will be part
of the Linux kernel at run-time.
If you just want to exchange some data with one of the S3C2440 processor's
built-in devices, you only need the POSIX API to exchange data with the
silicon. The Linux kernel will hide all the ugly details of accessing the
register bits in this case.

Ruben
thanks for the reply Juergen.

a few things I'm trying to wrap my mind around is say for instance I want
to talk to the max232 and send out data via the db9 connector, how does it
work? 

Is it correct if I say that the posix handles processor instructions and
not peripheral?

Thats not even mentioning if i want to talk to the 24C08 EEPROM, USB or
even QTopia.

wow, seems like I still have a long way to go. is there a book you can
recommend? I bought the E.L.L.K guide, but having some trouble with how
everything links together as its not a beginners guide. I managed though,
to setup, configure and run all the example apps except for the kernel
compiling. 

Your advice and help is really appreciated.

Sincerely

Ruben

Juergen Beisert
> max232 and send out data via the db9 connector, how does it work? 

The Mini2440 UARTs are simple tty-devices. So, just open /dev/ttySAC0 and
write bytes to the file handle (plain POSIX API). There is a serial-howto
for Linux floating around. Google for it. It will also explains how to set
the baudrate, byte sizes, stop bit count and so on.

You also can read and write to the EEPROM in the same way. "Everything is a
file", if the Linux kernel supports the hardware.

> wow, seems like I still have a long way to go.

No. Everything is already prepared. Forget to handle the hardware by your
own. Let Linux do it for you.

> is there a book you can recommend?

Read everything about POSIX.
And only if Linux does not support your special piece of hardware, *then*
you need to write your own driver which talks to the silicon.

You may can start on your Linux based host, and in the next step you learn
how to cross compile and how to use the same programs on your Mini2440.

Also surf throug the web and read everything about "embedded
Linux/programming/buildtools".

Ruben
thanks Juergen!

spend a lot of time last night and this morning investigating this. and
your reply confirms my conclusion:

> if Linux does not support your special piece of hardware, *then*
you need to write your own driver which talks to the silicon.

thats just fantastic, and a lot easier than old school microcontrollers. 

You're awesome, thanks a lot for your help, I'd love to buy you a bottle of
Johnny Walker, but alas...

been a great help!

cheers 

Ruben

PS: to verify that linux supports my silicon, I should probably get
acquainted with the kernel docs right?

Juergen Beisert
> PS: to verify that linux supports my silicon, I should probably get
> acquainted with the kernel docs right?

There is no easy answer: if you use our BSP (Board Support Package)[1], all
peripherals except the camera interface is supported in the Linux kernel.
This includes the buzzer, the GPIO, SD card, USB and so on. In this case
you can use your Mini2440 like any different x86 host computer. Except the
software for the Mini2440 must be compiled with a cross compiler, due to
its different architecture (ARM).
If you use a Linux kernel from somewhere you must walk through its kernel's
configuration menu and see what S3C2440 special silicon devices are
supported.

[1] refer http://www.friendlyarm.net/forum/topic/2737

Ruben
Thanks for your help, makes much more sense now