리눅스 디바이스 드라이버 소스(parport_pc.c)보다가 이해가 안

cabjaewon의 이미지

리눅스 디바이스 드라이버 소스 보다가 __port_pc_frob_control(p,wm,d&wm) 이란 표현을 봤는데요,어떤 기능을 하는지 모르겠어요..

1. 앞에 '__"이 붙은 것의 의미 내지는 기능이 뭐죠?

2. 'd&vm' 과 같은 표현은 뭔지...

3. 밑에 소스에서 ' if(d&0x20) ' 절의 기능에 대해 설명해 주세요.

void parport_pc_write_control(struct parport *p,unsigned char d)
{
const unsigned char wm=(PARPORT_CONTROL_STROBE| PARPORT_CONTROL_AUTOFD|
PARPORT_CONTROL_INIT|
PARPORT_CONTROL_SELECT);
// Writes to the control register. These are bitmasks:
_______
// - PARPORT_CONTROL_STROBE (nStrobe)
_______
// - PARPORT_CONTROL_AUTOFD (nAutoFd)
_____
// - PARPORT_CONTROL_INIT (nInit)
_________
// - PARPORT_CONTROL_SELECT (nSelectIn)

//If
if(d&0x20)
{
printk(KERN_DEBUG "%s (%s):use data_reverse for this!\n",
p->name,p->cad->name);
parport_pc_data_reverse(p);
}
__parport_pc_frob_control(p,wm,d & wm);
}

hb_kim의 이미지

1. 보통 C 프로그램이 어셈블리어로 컴파일될때 C 심볼앞에 _ 를 붙이거든요. 그러니까 C 프로그램에서 우연히 어셈블리 코드에 있는 같은 이름의 심볼과 충돌하지 않게 하기 위해서 _ 를 붙여줄때가 있습니다. 근데 이 경우에는, 헤더파일을 보시면 주석이 달려있는데 원래 함수와 약간 다른 기능의 함수/매크로를 만들면서 새로운 이름을 지어주기가 귀챦아 그냥 붙여준 듯합니다.

2. d&vm 은 d 와 vm 의 arithmetic AND 입니다.

3. 왜 0x20 이 특별한 의미를 가지는지 이해하시려면 프린터 인터페이스를 이해하셔야 될듯.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.