?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

유저 공간으로부터 커널로 데이터 복사 / 유저 공간으로 커널 데이터 복사

copy_from_user()

copy_to_user()

 

플랫폼드라이버 등록 및 해제 함수; /include/linux/platform_device.h

platform_register_drivers()

platform_driver_register()

platform_driver_unregister()

 

플랫폼 디바이스 등록 및 해제

platform_device_register()

platform_device_register_simple()

platform_device_unregister()

 

플랫폼디바이스추가

platform_add_devices()

 

버스 드라이버 등록 및 해제; /drivers/base/bus.c, include/linux/device.h

bus_register()

bus_unregister()

 

리소스 관리용 kzalloc(). devm_kzalloc()을 사용하여 할당 된 메모리는 드라이버 분리시 자동으로 해제.

devm_kzalloc(&pdev->dev, sizeof(struct imx_fb_videomode), GFP_KERNEL)

 

물리주소를 가상주소로 매핑. 

void __iomem * ioremap(resource_size_t offset, unsigned long size)

 

I/O 메모리 영역을 확보. 이 영역의 소유주를 표시.

request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name), 0)

 

디바이스 I/O 레지스터 리소스 가져오기

struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0) 

 

인터럽트(Interrupt) 가져오기

예: 디바이스트리 interrupts 프로퍼티에서

s->irq = platform_get_irq(pdev, 0);

 

플랫폼 드라이버 데이터(정보)를 등록

platform_set_drvdata(struct platform_device *pdev, void *data)

 

리소스 체크, memory region (request_mem_region), ioremaps(ioremap) 을 한번에 수행.

devm_ioremap_resource()

 

플랫폼 디바이스 데이터 포인터 반환

void *dev_get_platdata(const struct device *dev)

 

 

접두사 of (Open Firmware)가 붙여진 API

 

각 유형별 프로퍼티를 얻기위한 API

of_property_read_string()

of_property_read_u32()

of_property_read_bool()

 

Custom 프로퍼티 가져오기

of_get_property()

 

예:

static int imx_uart_probe(struct platform_device *pdev)
{
    struct device_node *np = pdev->dev.of_node;
    if (of_get_property(np, "rts-gpios", NULL))
	 ...
}

 

호환가능한 머신 테스트

of_machine_is_compatible("fsl,imx28-evk")

 

디바이스가 of_device_id 목록의 항목과 일치하는지 확인;

시스템에 존재하는 platform_device 가 지원되는 장치 목록(matches)에 있는지 확인하기 위해 드라이버가 사용한다.

const struct of_device_id *of_match_device(const struct of_device_id *matches, const struct device *dev)

 

 

매크로

 

드라이버 함수 심볼릭 내보내기 (외부에서 호출 가능하도록)

EXPORT_SYMBOL_GPL()

 

구조체(type)에 속한 멤버(member)의 포인터(ptr)를 구조체 포인터로 캐스트

container_of(ptr, type, member)

 


  1. No Image

    리눅스에서 시리얼 포트 사용 및 접근 권한

    Date2024.05.21 Bymakersweb Views3852
    Read More
  2. No Image

    리눅스 Qt 응용프로그램 AppImage 로 구축

    Date2024.01.07 Bymakersweb Views3511
    Read More
  3. No Image

    GRUB의 timeout 설정

    Date2023.11.07 Bymakersweb Views4021
    Read More
  4. lubuntu 22.04 LTS 설치

    Date2023.01.23 Bymakersweb Views6680
    Read More
  5. No Image

    시스템에서 사용 가능한 D-Bus 서비스를 보려면?

    Date2022.12.29 Bymakersweb Views6482
    Read More
  6. No Image

    리눅스에서 네트워크 구성

    Date2022.06.11 Bymakersweb Views6418
    Read More
  7. D-Bus ObjectManager

    Date2022.02.12 Bymakersweb Views3301
    Read More
  8. No Image

    ifconfig 는 대부분 ip 명령으로 대체

    Date2022.02.12 Bymakersweb Views4882
    Read More
  9. SocketCAN 유틸 사용방법

    Date2022.02.05 Bymakersweb Views16089
    Read More
  10. No Image

    dbus-broker를 기본 DBus 구현으로 설정

    Date2021.01.20 Bymakersweb Views4859
    Read More
  11. 리눅스 오디오 스택과 아키텍처

    Date2020.09.02 Bymakersweb Views6252
    Read More
  12. No Image

    wayland-scanner 를 통해 Wayland 프로토콜 코드생성

    Date2020.06.08 Bymakersweb Views4681
    Read More
  13. No Image

    Wayland 의 Client Application 프로그래밍 기본 루틴

    Date2020.06.04 Bymakersweb Views5407
    Read More
  14. No Image

    Wayland 의 주요 객체들

    Date2020.06.04 Bymakersweb Views4521
    Read More
  15. No Image

    Weston 의 설명 및 관련 컴포넌트

    Date2020.06.03 Bymakersweb Views6444
    Read More
  16. No Image

    64비트 리눅스에서 32비트 응용프로그램을 실행하려면

    Date2020.02.29 Bymakersweb Views4757
    Read More
  17. No Image

    initramfs (initial ram file system: 초기 램 파일 시스템)

    Date2020.02.25 Bymakersweb Views6143
    Read More
  18. No Image

    플랫폼 디바이스 드라이버 개발 시 많이 사용되는 커널 API 및 매크로

    Date2020.01.28 Bymakersweb Views8260
    Read More
  19. No Image

    PATH에 새로운 경로 추가

    Date2019.09.19 Bymakersweb Views3065
    Read More
  20. No Image

    리눅스 컴파일러 최신으로 업데이트

    Date2018.12.26 Bylinux Views4216
    Read More
Board Pagination Prev 1 2 3 Next
/ 3