(toppers-users 989) Re: シリアルポート管理ブロック初期化はいつ ?

ktakahashi @ vesta.ocn.ne.jp ktakahashi @ vesta.ocn.ne.jp
2003年 7月 16日 (水) 19:28:45 JST


IKEUCHI Mitsuo (’r“àŒõ—Y) <ikeuchi.mitsuo @ jp.panasonic.com>‚³‚ñF
ƒAƒ‰ƒCƒuƒrƒWƒ‡ƒ“ƒ\ƒtƒgƒEƒGƒA‚̍‚‹´‚Ɛ\‚µ‚Ü‚·B
VŽQŽÒ‚Å‚·‚ªA‚æ‚낵‚­‚¨Šè‚¢‚µ‚Ü‚·B

spcb‚ÌŽÀ‘Ì‚ªAspcb_table ‚Å‚·‚æ‚ˁB
ƒ[ƒh‚·‚é‚Æ‚«‚ɏ‰Šú‰»‚³‚ê‚Ä‚¢‚é‚Ì‚ª³í‚ȃP[ƒX‚Å‚·‚ˁB
‹M“a‚̏ꍇAƒ[ƒ_[‚É–â‘肪‚ ‚é‚Ì‚Å‚µ‚傤‚©H

ŽQl‚Ì‚½‚߁Ah8‚Å‚·‚ªAgdb‚Ì“®ìŠm”F‚ðˆÈ‰º‚ɏ‘‚¢‚Ä‚¨‚«‚Ü‚·B
(cygwin‚Ȃ̂Ń\[ƒX‚ÌŠ¿Žš‚Í•¶Žš‰»‚¯‚µ‚Ä‚Ü‚·j

ƒe[ƒuƒ‹‚̃AƒhƒŒƒX‚́@0x50004‚̂悤‚Å‚·B

--------------------

[Administrator @ ONE nserv]$ h8300-hms-gdb jsp.exe
GNU gdb 5.3
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-cygwin --target=h8300-hms"...
(gdb) set machine h8300h
(gdb) set remotebaud 38400
(gdb) target hms /dev/com1
Remote target hms connected to /dev/com1
0x00000000 in ?? ()
(gdb) load
.vectors        : 0x00ffc000 .. 0x00ffc100
.text   : 0x00400000 .. 0x00415aba
.rodata : 0x00415aba .. 0x0041a7e8
.data   : 0x00500000 .. 0x00500e94
Transfer rate: 900064 bits in <1 sec, 1171 bytes/write.
Timeout reading from remote system.
(gdb) cd ..
Working directory /home/Administrator/jsp.
(gdb) cd systask
Working directory /home/Administrator/jsp/systask.
(gdb) p spcb_table
$1 = {{init_flag = 0, hwport = {base = 255}, in_semid = 0, out_semid = 0,
    in_read_ptr = 0, in_write_ptr = 0, out_read_ptr = 0, out_write_ptr = 0,
    ioctl = 0, send_enabled = 0, ixon_stopped = 0, ixoff_stopped = 0,
    ixoff_send = 0 '\0', in_buffer = '\0' <repeats 255 times>,
    out_buffer = '\0' <repeats 255 times>}, {init_flag = 0, hwport = {
      base = 255}, in_semid = 0, out_semid = 0, in_read_ptr = 0,
    in_write_ptr = 0, out_read_ptr = 0, out_write_ptr = 0, ioctl = 0,
    send_enabled = 0, ixon_stopped = 0, ixoff_stopped = 0,
    ixoff_send = 0 '\0', in_buffer = '\0' <repeats 255 times>,
    out_buffer = '\0' <repeats 255 times>}}
(gdb) p &spcb_table
$2 = (SPCB (*)[2]) 0x500004
(gdb) l serial.c:123
118      *  Eƒ“BƒVEƒlAƒzEƒFBƒVEƒ‰E
119      *
120      *  ƒnvƒ\.ƒzEƒ\EƒPEƒbAƒƒƒjƒAƒTþAƒqƒNƒjAƒˆƒZ.ƒLAƒqAƒ}ƒcƒ~ƒAþAƒLAƒjAAAƒnAABE
121      */
122     ER
123     serial_open(ID portid)
124     {
125             SPCB    *spcb;
126             ER      ercd;
127
(gdb)
128             if (!(1 <= portid && portid <= NUM_PORT)) {
129                     return(E_ID);
130             }
131             spcb = get_spcb(portid);
132
133             if (spcb->init_flag) {          /* ƒX鴁EƒXƒRƒ€AƒHAƒzEƒ`Eƒ@EƒeEƒb */
134                     return(E_OK);
135             }
136
137             /*
(gdb) b 133
Breakpoint 1 at 0x4005ee: file serial.c, line 133.
(gdb) c
Continuing.

Breakpoint 1, serial_open (portid=564) at serial.c:133
133             if (spcb->init_flag) {          /* ƒX鴁EƒXƒRƒ€AƒHAƒzEƒ`Eƒ@EƒeEƒb */
(gdb) p spcb
$3 = (SPCB *) 0x500004
(gdb) p *spcb
$4 = {init_flag = 0, hwport = {base = 255}, in_semid = 0, out_semid = 0,
  in_read_ptr = 0, in_write_ptr = 0, out_read_ptr = 0, out_write_ptr = 0,
  ioctl = 0, send_enabled = 0, ixon_stopped = 0, ixoff_stopped = 0,
  ixoff_send = 0 '\0', in_buffer = '\0' <repeats 255 times>,
  out_buffer = '\0' <repeats 255 times>}
(gdb) b 128
Breakpoint 2 at 0x4005c6: file serial.c, line 128.
(gdb) d 1
(gdb) c
Continuing.

> 
> ’r“à‚Å‚·B
> 
> ˆêƒ–ŒŽ‚Ù‚Ç‘O‚Ɂu (toppers-users 895) kz_sh4 ‚ŃTƒ“ƒvƒ‹
> ƒvƒƒOƒ‰ƒ€‚ª“®‚«‚Ü‚¹‚ñv‚Æ‚¢‚¤“Še‚ð‚µ‚½‚à‚Ì‚Å‚·B‚Ù‚ñ‚Ì
> ­‚µi’»‚ª‚ ‚èA‚Ü‚½•ª‚©‚ç‚È‚¢‚Æ‚±‚낪‚Å‚Ä‚«‚½‚̂ŁA‚Ü‚½
> Ž¿–₳‚¹‚Ä‚­‚¾‚³‚¢B
> 
> æ‚ÌŽ¿–â‚ł́AƒVƒŠƒAƒ‹o—Í‚ª‚¤‚Ü‚­‚¢‚Á‚Ä‚È‚©‚Á‚½‚Ì‚Å‚·‚ªA
> ‚±‚ê‚́AƒVƒŠƒAƒ‹ƒ|[ƒgŠÇ—ƒuƒƒbƒN‚̏‰Šú‰»ƒtƒ‰ƒO
>  ( SPCB.init_flag ) ‚ª -1 ‚É‚È‚Á‚Ä‚¢‚é‚Ì‚ªŒ´ˆö‚̂悤‚Å‚·B
> 
> ƒVƒŠƒAƒ‹‰Šú‰»ŠÖ” serial_initialize() ¨ serial_open() ‚Å
> 
>   if (spcb->init_flag) {      /* ‰Šú‰»Ï‚©‚̃`ƒFƒbƒN */
>       return(E_OK);
>   }
> 
> ‚Æ‚¢‚¤•”•ª‚ª‚ ‚è‚Ü‚·‚ªA’l‚ª -1 ‚¾‚ƁA‚±‚±‚Łu‰Šú‰»Ï‚݁v
> ‚Æ”»’f‚³‚ê‚Ä‚µ‚Ü‚¢‚Ü‚·B‚»‚Ì‚½‚߁AŒãX‚̏ˆ—‚ª‚¨‚©‚µ‚­
> ‚È‚Á‚Ä‚¢‚é‚悤‚Å‚·B
> 
> ‚Æ‚±‚낪A SPCB •Ï”‚̏‰Šú‰»‚Í
> 
> static SPCB spcb_table[NUM_PORT] = {
>   { 0, HWPORT1, SEM_SERIAL1_IN, SEM_SERIAL1_OUT },
> #if NUM_PORT > 1
>   { 0, HWPORT2, SEM_SERIAL2_IN, SEM_SERIAL2_OUT },
> #endif
> };
> 
> ‚Æ‚¢‚¤‚悤‚ɍs‚È‚í‚ê‚Ä‚¨‚èAÅ‰‚Í init_flag = 0 ‚É‚È‚Á‚Ä
> ‚¢‚é‚Í‚¸‚È‚Ì‚Å‚·B‚Ç‚±‚©‚Å -1 ‚É•Ï‚í‚Á‚Ä‚¢‚é‚Ì‚©A‚»‚à‚»‚à
> ‰Šú‰»‚ªs‚È‚í‚ê‚Ä‚¢‚È‚¢‚Ì‚©‚æ‚­•ª‚©‚è‚Ü‚¹‚ñB
> 
> ‚Ç‚È‚½‚©A‚¨•ª‚©‚è‚Ì•û‚ª‚¢‚ç‚Á‚µ‚á‚ê‚΁A‚²‹³ŽöŠè‚¦‚È‚¢‚Å
> ‚µ‚傤‚©B
> 
> *********************************************************
> ’r“àŒõ—Y ƒpƒiƒ\ƒjƒbƒNƒtƒ@ƒNƒgƒŠ[ƒ\ƒŠƒ…[ƒVƒ‡ƒ“ƒYŠ”Ž®‰ïŽÐ        
> *********************************************************
---
ƒAƒ‰ƒCƒuƒrƒWƒ‡ƒ“ƒ\ƒtƒgƒEƒGƒAŠ”Ž®‰ïŽÐ
‚‹´˜a_
650-0045 _ŒËŽs’†‰›‹æ`“‡9-1
_ŒËƒCƒ“ƒLƒ…ƒx[ƒVƒ‡ƒ“ƒIƒtƒBƒX117†Žº
Email:ktakahashi @ vesta.ocn.ne.jp
http://homepage3.nifty.com/ALVS/