killole.blogg.se

Beagle driver
Beagle driver





beagle driver beagle driver
  1. BEAGLE DRIVER HOW TO
  2. BEAGLE DRIVER DRIVER

#define IOCBBBGPIOSRE _IOW(_IOCTL_MAGIC,8,struct bbbgpio_ioctl*) /*set rising edge*/ #define IOCBBBGPIOSH1 _IOW(_IOCTL_MAGIC,7,struct bbbgpio_ioctl*) /*set high detect*/ #define IOCBBBGPIOSL0 _IOW(_IOCTL_MAGIC,6,struct bbbgpio_ioctl*) /*set low detect*/ #define IOCBBBGPIOSD _IOW(_IOCTL_MAGIC,5,struct bbbgpio_ioctl*) /*set direction*/ #define IOCBBBGPIORD _IOR(_IOCTL_MAGIC,4,struct bbbgpio_ioctl*) /*read from register*/ #define IOCBBBGPIOWR _IOW(_IOCTL_MAGIC,3,struct bbbgpio_ioctl*) /*write data to register*/ #define IOCBBBGPIOUP _IOW(_IOCTL_MAGIC,2,struct bbbgpio_ioctl*) /*IOCTL used for unregistering PIN*/ Data Types and IOCTL Optionsįor transferring data between user space and kernel space and also for IOCTL I used a structure that contains two buffers for read and write operations, the number of the pin that is controlled and the interrupt number, if interrupts are used for reading data.Ĭopy Code #define IOCBBBGPIORP _IOW(_IOCTL_MAGIC,1,struct bbbgpio_ioctl*) /*IOCTL used for registering PIN*/

BEAGLE DRIVER HOW TO

In the next paragraphs I will present the source code of some functions and also an example of how to use this device driver.

BEAGLE DRIVER DRIVER

The driver use IOCTLs for performing basic settings of the port, such as exporting a pin, set the direction input or output, use capture events such rising edge, falling edge etc. For example, it had to change the state of an output port from 0 to 1 with a frequency of 1 KHz, it had to change the value each millisecond. I managed to fulfill the time constraint by using code optimizations techniques and by writing some device drivers. The interesting part at that project was the time constraint, the software had to take a decision or wait for an input at exactly the specified time. Some time ago I worked on a project on Beaglebone Black that had to control some IOs, UART ports, also had to take some decisions and communicate with a PC via sockets. This will be a simple article about Linux Device Drivers, in fact about a char driver that controls the GPIO ( General Purpose Input-Output) port of the Beaglebone Black.







Beagle driver