2008-06-06

Linux Driver

 

result=register_chrdev(iGpio_Major, DEVICE_NAME, &gpio_fops);

iGpio_Major : major number of device node

DEVICE_NAME : device name (/dev/DEVICE_NAME)

gpio_fops : address of structure of driver functions

ex.

static struct file_operations gpio_fops =
{
    .owner      = THIS_MODULE,
    .read       =   gpio_read,
    .write      =   gpio_write,
    .open       =   gpio_open,
    .release    =   gpio_release,
};

addr=ioremap(GPP_DATA_OUT_REG,4);

ioremap : mapping device to virtual memory for read/write

GPP_DATA_OUT_REG : physical address of device

addr : virtual memory address of device

result = unregister_chrdev(iGpio_Major, DEVICE_NAME);

沒有留言:

★★★★★★ 傑森系列 ★★★★★★