유저 공간으로부터 커널로 데이터 복사 / 유저 공간으로 커널 데이터 복사
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)
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
25 | libblkid - USB Storage의 정보 가져오기 | makersweb | 2018.10.18 | 683 |
24 | tslib 크로스 컴파일과 터치스크린 보정 | makersweb | 2018.08.02 | 2204 |
23 |
Ubuntu Linux에서 dbus-c++바인딩 D-Bus 테스트
![]() | makersweb | 2018.03.07 | 7114 |
22 | NFS를 통해 파일시스템 공유 | makersweb | 2018.03.05 | 1144 |
21 |
Wayland에 대한 간단한 소개
![]() | makersweb | 2017.12.29 | 3417 |
20 |
Ubuntu16.04에서 weston구동
![]() | makersweb | 2017.12.28 | 981 |
19 | UVC 장치를 사용할때 v4l2: select timeout 에러 발생 | makersweb | 2017.12.27 | 2404 |
18 | Build Qt 4.7.0 for Embedded Linux | makersweb | 2015.05.25 | 5426 |
17 |
[IPC]D-Bus 소개
![]() | makersweb | 2015.02.28 | 29809 |
16 |
리눅스 프레임버퍼(Linux Frame Buffer)
![]() | makersweb | 2015.02.15 | 7506 |
15 | 리눅스 데스크탑 환경 종류 | pjk | 2015.02.11 | 4623 |
14 | 디바이스 드라이버에 대해서 | makersweb | 2014.04.19 | 4132 |
13 |
리눅스 커널 소스코드 구성도
![]() | makersweb | 2014.03.04 | 5497 |
12 | read() 함수, write() 함수 | makersweb | 2014.03.04 | 11356 |
11 | 리눅스 디렉터리 구조 | makersweb | 2014.02.28 | 3240 |
10 | file_operations | makersweb | 2014.02.27 | 3292 |
9 |
ioctl() 함수
![]() | makersweb | 2014.02.27 | 14181 |
8 | 키패드 드라이버 | pjk | 2014.02.12 | 6526 |
7 | 1. make | pjk | 2014.02.05 | 2104 |
6 | 2. 간단한 Makefile | pjk | 2014.02.05 | 2604 |