Hi, Currently I'm developping drivers. When I look the examples I success to write a driver but I would like to understand how works teh function that I use. For example, in order to configure a pin as an output we use : s3c2410_gpio_cfgpin(S3C2410_GPB(8), S3C2410_GPIO_OUTPUT); I would like to know where I can find that I need to use S3C2410_GPIO_OUTPUT. The value is explain somewhere in a doc and not onlu in the regs-gpio.h. The functions are difined in gpio.c, but is there a doc that explain how to use the functions. I think that we also need to look at the datasheet ? I don't success to make the link between the datasheet and the gpio functions. Thanks
Documentation about functions used to developp drivers
"that I need to use S3C2410_GPIO_OUTPUT": Do you mean the API with this question or do you mean why this pin must be output? At first you should take a look into the schematics to know, which direction setting each GPIO pin needs to make it work. If you define the pin to be something different than a GPIO, the pin's direction is handled from the hardware. Otherwise the direction is required. The gpio driver uses some indirections to handle more than one CPU with the same code. This makes the driver harder to read. But at the end there is no magic: They just change the bits in the corresponding registers to configure the GPIO as defined in your request. If you read these registers you can compare their content with the datasheet.
"I would like to know where I can find that I need to use S3C2410_GPIO_OUTPUT." My question is, for example, if I want to configure a pin in output. How do I know that the constant to use is S3C2410_GPIO_OUTPUT. I agree with you. But in order to use these functions that modify the registers, I need to have a documentation that explain how they work ? Thanks.
The answer is very easy: "Read the source", means there is (mostly) no doc. Instead you have hundreds of examples where you can take a look how things are working. APIs *in* the kernel can change and do change from time to time. So, developers are happy when they have done their job to make it work. Documentation? Do _you_ write documentation about your work? ;-)
Ok, Now I know that there is no official doc. I agree that there is enough examples to understand how it work. It's not a fake, but yes I write a doc on almost every subjetc that I work on. Thanks for your answer.