#include <sil.h>
#include "target_syssvc.h"
#include "upd72001.h"
データ構造 | |
struct | sio_port_initialization_block |
struct | sio_port_control_block |
マクロ定義 | |
#define | UPD72001_DELAY 200U |
#define | UPD72001_CR0 0x00U |
#define | UPD72001_CR1 0x01U |
#define | UPD72001_CR2 0x02U |
#define | UPD72001_CR3 0x03U |
#define | UPD72001_CR4 0x04U |
#define | UPD72001_CR5 0x05U |
#define | UPD72001_CR10 0x0aU |
#define | UPD72001_CR12 0x0cU |
#define | UPD72001_CR14 0x0eU |
#define | UPD72001_CR15 0x0fU |
#define | UPD72001_SR0 0x00U |
#define | CR_RESET 0x18U |
#define | CR0_EOI 0x38U |
#define | CR1_DOWN 0x00U |
#define | CR1_RECV 0x10U |
#define | CR1_SEND 0x02U |
#define | CR3_DEF 0xc1U |
#define | CR4_DEF 0x44U |
#define | CR5_DEF 0xeaU |
#define | CR10_DEF 0x00U |
#define | CR14_DEF 0x07U |
#define | CR15_DEF 0x56U |
#define | SR0_RECV 0x01U |
#define | SR0_SEND 0x04U |
#define | INDEX_SIOP(siopid) ((uint_t)((siopid) - 1)) |
#define | get_siopcb(siopid) (&(siopcb_table[INDEX_SIOP(siopid)])) |
型定義 | |
typedef struct sio_port_initialization_block | SIOPINIB |
関数 | |
Inline uint8_t | upd72001_read_reg (void *addr) |
Inline void | upd72001_write_reg (void *addr, uint8_t val) |
Inline uint8_t | upd72001_read_ctrl (void *addr, uint8_t reg) |
Inline void | upd72001_write_ctrl (void *addr, uint8_t reg, uint8_t val) |
Inline void | upd72001_write_brg (void *addr, uint8_t reg, uint8_t val, uint8_t brg2, uint8_t brg1) |
static void | upd72001_get_stat (SIOPCB *p_siopcb) |
Inline bool_t | upd72001_getready (SIOPCB *p_siopcb) |
Inline bool_t | upd72001_putready (SIOPCB *p_siopcb) |
Inline char_t | upd72001_getchar (SIOPCB *p_siopcb) |
Inline void | upd72001_putchar (SIOPCB *p_siopcb, char_t c) |
Inline void | upd72001_eoi (void) |
void | upd72001_initialize (void) |
bool_t | upd72001_openflag (void) |
SIOPCB * | upd72001_opn_por (ID siopid, intptr_t exinf) |
void | upd72001_cls_por (SIOPCB *p_siopcb) |
bool_t | upd72001_snd_chr (SIOPCB *p_siopcb, char_t c) |
int_t | upd72001_rcv_chr (SIOPCB *p_siopcb) |
void | upd72001_ena_cbr (SIOPCB *p_siopcb, uint_t cbrtn) |
void | upd72001_dis_cbr (SIOPCB *p_siopcb, uint_t cbrtn) |
static void | upd72001_isr_siop (SIOPCB *p_siopcb) |
void | upd72001_isr (void) |
変数 | |
const SIOPINIB | siopinib_table [TNUM_SIOP] |
SIOPCB | siopcb_table [TNUM_SIOP] |
#define CR0_EOI 0x38U |
#define CR10_DEF 0x00U |
#define CR14_DEF 0x07U |
#define CR15_DEF 0x56U |
#define CR1_DOWN 0x00U |
#define CR1_RECV 0x10U |
#define CR1_SEND 0x02U |
#define CR3_DEF 0xc1U |
upd72001.c の 85 行で定義されています。
#define CR4_DEF 0x44U |
upd72001.c の 86 行で定義されています。
#define CR5_DEF 0xeaU |
upd72001.c の 87 行で定義されています。
#define CR_RESET 0x18U |
#define get_siopcb | ( | siopid | ) | (&(siopcb_table[INDEX_SIOP(siopid)])) |
#define INDEX_SIOP | ( | siopid | ) | ((uint_t)((siopid) - 1)) |
upd72001.c の 140 行で定義されています。
#define SR0_RECV 0x01U |
#define SR0_SEND 0x04U |
#define UPD72001_CR0 0x00U |
#define UPD72001_CR1 0x01U |
upd72001.c の 62 行で定義されています。
参照元 upd72001_cls_por(), upd72001_dis_cbr(), upd72001_ena_cbr(), と upd72001_opn_por().
#define UPD72001_CR10 0x0aU |
#define UPD72001_CR12 0x0cU |
#define UPD72001_CR14 0x0eU |
#define UPD72001_CR15 0x0fU |
#define UPD72001_CR2 0x02U |
#define UPD72001_CR3 0x03U |
#define UPD72001_CR4 0x04U |
#define UPD72001_CR5 0x05U |
#define UPD72001_DELAY 200U |
#define UPD72001_SR0 0x00U |
typedef struct sio_port_initialization_block SIOPINIB |
void upd72001_cls_por | ( | SIOPCB * | p_siopcb | ) |
upd72001.c の 327 行で定義されています。
参照先 CR1_DOWN, sio_port_initialization_block::ctrl, sio_port_control_block::openflag, sio_port_control_block::p_siopinib, UPD72001_CR1, と upd72001_write_ctrl().
参照元 sio_cls_por().
00328 { 00329 upd72001_write_ctrl(p_siopcb->p_siopinib->ctrl, UPD72001_CR1, CR1_DOWN); 00330 p_siopcb->openflag = false; 00331 }
upd72001.c の 383 行で定義されています。
参照先 sio_port_control_block::cr1, CR1_RECV, CR1_SEND, sio_port_initialization_block::ctrl, sio_port_control_block::p_siopinib, SIO_RDY_RCV, SIO_RDY_SND, UPD72001_CR1, と upd72001_write_ctrl().
参照元 sio_dis_cbr().
00384 { 00385 uint8_t cr1_bit = 0; 00386 00387 switch (cbrtn) { 00388 case SIO_RDY_SND: 00389 cr1_bit = CR1_SEND; 00390 break; 00391 case SIO_RDY_RCV: 00392 cr1_bit = CR1_RECV; 00393 break; 00394 } 00395 p_siopcb->cr1 &= ~cr1_bit; 00396 upd72001_write_ctrl(p_siopcb->p_siopinib->ctrl, 00397 UPD72001_CR1, p_siopcb->cr1); 00398 }
upd72001.c の 362 行で定義されています。
参照先 sio_port_control_block::cr1, CR1_RECV, CR1_SEND, sio_port_initialization_block::ctrl, sio_port_control_block::p_siopinib, SIO_RDY_RCV, SIO_RDY_SND, UPD72001_CR1, と upd72001_write_ctrl().
参照元 sio_ena_cbr().
00363 { 00364 uint8_t cr1_bit = 0; 00365 00366 switch (cbrtn) { 00367 case SIO_RDY_SND: 00368 cr1_bit = CR1_SEND; 00369 break; 00370 case SIO_RDY_RCV: 00371 cr1_bit = CR1_RECV; 00372 break; 00373 } 00374 p_siopcb->cr1 |= cr1_bit; 00375 upd72001_write_ctrl(p_siopcb->p_siopinib->ctrl, 00376 UPD72001_CR1, p_siopcb->cr1); 00377 }
Inline void upd72001_eoi | ( | void | ) |
upd72001.c の 256 行で定義されています。
参照先 CR0_EOI, TADR_UPD72001_CTRLA, UPD72001_CR0, と upd72001_write_ctrl().
参照元 upd72001_isr().
00257 { 00258 upd72001_write_ctrl((void *) TADR_UPD72001_CTRLA, UPD72001_CR0, CR0_EOI); 00259 }
static void upd72001_get_stat | ( | SIOPCB * | p_siopcb | ) | [static] |
upd72001.c の 199 行で定義されています。
参照先 sio_port_initialization_block::ctrl, sio_port_control_block::getready, sio_port_control_block::p_siopinib, sio_port_control_block::putready, SR0_RECV, SR0_SEND, upd72001_read_ctrl(), と UPD72001_SR0.
参照元 upd72001_getready(), と upd72001_putready().
00200 { 00201 uint8_t sr0; 00202 00203 sr0 = upd72001_read_ctrl(p_siopcb->p_siopinib->ctrl, UPD72001_SR0); 00204 if ((sr0 & SR0_RECV) != 0) { 00205 p_siopcb->getready = true; 00206 } 00207 if ((sr0 & SR0_SEND) != 0) { 00208 p_siopcb->putready = true; 00209 } 00210 }
upd72001.c の 236 行で定義されています。
参照先 sio_port_initialization_block::data, sio_port_control_block::getready, sio_port_control_block::p_siopinib, と upd72001_read_reg().
参照元 upd72001_rcv_chr().
00237 { 00238 p_siopcb->getready = false; 00239 return((char_t) upd72001_read_reg(p_siopcb->p_siopinib->data)); 00240 }
upd72001.c の 216 行で定義されています。
参照先 sio_port_control_block::getready, と upd72001_get_stat().
参照元 upd72001_isr_siop(), と upd72001_rcv_chr().
00217 { 00218 upd72001_get_stat(p_siopcb); 00219 return(p_siopcb->getready); 00220 }
void upd72001_initialize | ( | void | ) |
upd72001.c の 265 行で定義されています。
参照先 sio_port_control_block::openflag, sio_port_control_block::p_siopinib, と TNUM_SIOP.
参照元 sio_initialize().
00266 { 00267 SIOPCB *p_siopcb; 00268 uint_t i; 00269 00270 /* 00271 * シリアルI/Oポート管理ブロックの初期化 00272 */ 00273 for (p_siopcb = siopcb_table, i = 0; i < TNUM_SIOP; p_siopcb++, i++) { 00274 p_siopcb->p_siopinib = &(siopinib_table[i]); 00275 p_siopcb->openflag = false; 00276 } 00277 }
void upd72001_isr | ( | void | ) |
upd72001.c の 424 行で定義されています。
参照先 upd72001_eoi(), と upd72001_isr_siop().
参照元 sio_isr().
00425 { 00426 if (siopcb_table[0].openflag) { 00427 upd72001_isr_siop(&(siopcb_table[0])); 00428 } 00429 if (siopcb_table[1].openflag) { 00430 upd72001_isr_siop(&(siopcb_table[1])); 00431 } 00432 upd72001_eoi(); 00433 }
static void upd72001_isr_siop | ( | SIOPCB * | p_siopcb | ) | [static] |
upd72001.c の 404 行で定義されています。
参照先 sio_port_control_block::cr1, CR1_RECV, CR1_SEND, sio_port_control_block::exinf, upd72001_getready(), upd72001_irdy_rcv(), upd72001_irdy_snd(), と upd72001_putready().
参照元 upd72001_isr().
00405 { 00406 if ((p_siopcb->cr1 & CR1_RECV) != 0U && upd72001_getready(p_siopcb)) { 00407 /* 00408 * 受信通知コールバックルーチンを呼び出す. 00409 */ 00410 upd72001_irdy_rcv(p_siopcb->exinf); 00411 } 00412 if ((p_siopcb->cr1 & CR1_SEND) != 0U && upd72001_putready(p_siopcb)) { 00413 /* 00414 * 送信可能コールバックルーチンを呼び出す. 00415 */ 00416 upd72001_irdy_snd(p_siopcb->exinf); 00417 } 00418 }
bool_t upd72001_openflag | ( | void | ) |
upd72001.c の 283 行で定義されています。
参照元 sio_cls_por(), sio_opn_por(), と upd72001_opn_por().
00284 { 00285 return(siopcb_table[0].openflag || siopcb_table[1].openflag); 00286 }
upd72001.c の 292 行で定義されています。
参照先 sio_port_initialization_block::brg1_def, sio_port_initialization_block::brg2_def, sio_port_control_block::cr1, CR10_DEF, CR14_DEF, CR15_DEF, CR1_DOWN, sio_port_initialization_block::cr3_def, sio_port_initialization_block::cr4_def, sio_port_initialization_block::cr5_def, CR_RESET, sio_port_initialization_block::ctrl, sio_port_control_block::exinf, get_siopcb, sio_port_control_block::getready, sio_port_control_block::openflag, sio_port_control_block::p_siopinib, sio_port_control_block::putready, TADR_UPD72001_CTRLA, TADR_UPD72001_CTRLB, UPD72001_CR1, UPD72001_CR10, UPD72001_CR12, UPD72001_CR14, UPD72001_CR15, UPD72001_CR2, UPD72001_CR3, UPD72001_CR4, UPD72001_CR5, upd72001_openflag(), upd72001_write_brg(), upd72001_write_ctrl(), と upd72001_write_reg().
参照元 sio_opn_por().
00293 { 00294 SIOPCB *p_siopcb; 00295 const SIOPINIB *p_siopinib; 00296 00297 p_siopcb = get_siopcb(siopid); 00298 p_siopinib = p_siopcb->p_siopinib; 00299 00300 upd72001_write_reg(p_siopinib->ctrl, CR_RESET); 00301 if (!upd72001_openflag()) { 00302 upd72001_write_ctrl((void *) TADR_UPD72001_CTRLA, UPD72001_CR2, 0x18); 00303 upd72001_write_ctrl((void *) TADR_UPD72001_CTRLB, UPD72001_CR2, 0x00); 00304 } 00305 p_siopcb->cr1 = CR1_DOWN; 00306 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR1, p_siopcb->cr1); 00307 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR4, p_siopinib->cr4_def); 00308 upd72001_write_brg(p_siopinib->ctrl, UPD72001_CR12, 0x01U, 00309 p_siopinib->brg2_def, p_siopinib->brg1_def); 00310 upd72001_write_brg(p_siopinib->ctrl, UPD72001_CR12, 0x02U, 00311 p_siopinib->brg2_def, p_siopinib->brg1_def); 00312 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR15, CR15_DEF); 00313 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR14, CR14_DEF); 00314 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR10, CR10_DEF); 00315 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR3, p_siopinib->cr3_def); 00316 upd72001_write_ctrl(p_siopinib->ctrl, UPD72001_CR5, p_siopinib->cr5_def); 00317 p_siopcb->exinf = exinf; 00318 p_siopcb->getready = p_siopcb->putready = false; 00319 p_siopcb->openflag = true; 00320 return(p_siopcb); 00321 }
upd72001.c の 246 行で定義されています。
参照先 sio_port_initialization_block::data, sio_port_control_block::p_siopinib, sio_port_control_block::putready, と upd72001_write_reg().
参照元 upd72001_snd_chr().
00247 { 00248 p_siopcb->putready = false; 00249 upd72001_write_reg(p_siopcb->p_siopinib->data, (uint8_t) c); 00250 }
upd72001.c の 226 行で定義されています。
参照先 sio_port_control_block::putready, と upd72001_get_stat().
参照元 upd72001_isr_siop(), と upd72001_snd_chr().
00227 { 00228 upd72001_get_stat(p_siopcb); 00229 return(p_siopcb->putready); 00230 }
upd72001.c の 350 行で定義されています。
参照先 upd72001_getchar(), と upd72001_getready().
参照元 sio_rcv_chr().
00351 { 00352 if (upd72001_getready(p_siopcb)) { 00353 return((int_t)(uint8_t) upd72001_getchar(p_siopcb)); 00354 } 00355 return(-1); 00356 }
Inline uint8_t upd72001_read_ctrl | ( | void * | addr, | |
uint8_t | reg | |||
) |
upd72001.c の 164 行で定義されています。
参照先 upd72001_read_reg(), と upd72001_write_reg().
参照元 upd72001_get_stat().
00165 { 00166 upd72001_write_reg(addr, reg); 00167 return(upd72001_read_reg(addr)); 00168 }
Inline uint8_t upd72001_read_reg | ( | void * | addr | ) |
upd72001.c の 147 行で定義されています。
参照先 sil_dly_nse(), UPD72001_DELAY, と upd72001_reb_reg.
参照元 upd72001_getchar(), upd72001_read_ctrl(), と upd72001_write_brg().
00148 { 00149 uint8_t val; 00150 00151 val = upd72001_reb_reg(addr); 00152 sil_dly_nse(UPD72001_DELAY); 00153 return(val); 00154 }
upd72001.c の 337 行で定義されています。
参照先 upd72001_putchar(), と upd72001_putready().
参照元 sio_snd_chr().
00338 { 00339 if (upd72001_putready(p_siopcb)) { 00340 upd72001_putchar(p_siopcb, c); 00341 return(true); 00342 } 00343 return(false); 00344 }
Inline void upd72001_write_brg | ( | void * | addr, | |
uint8_t | reg, | |||
uint8_t | val, | |||
uint8_t | brg2, | |||
uint8_t | brg1 | |||
) |
upd72001.c の 178 行で定義されています。
参照先 upd72001_read_reg(), と upd72001_write_reg().
参照元 upd72001_opn_por().
00180 { 00181 upd72001_write_reg(addr, reg); 00182 upd72001_write_reg(addr, val); 00183 upd72001_write_reg(addr, brg2); 00184 upd72001_write_reg(addr, brg1); 00185 (void) upd72001_read_reg(addr); /* ダミーリード */ 00186 }
Inline void upd72001_write_ctrl | ( | void * | addr, | |
uint8_t | reg, | |||
uint8_t | val | |||
) |
upd72001.c の 171 行で定義されています。
参照先 upd72001_write_reg().
参照元 upd72001_cls_por(), upd72001_dis_cbr(), upd72001_ena_cbr(), upd72001_eoi(), と upd72001_opn_por().
00172 { 00173 upd72001_write_reg(addr, reg); 00174 upd72001_write_reg(addr, val); 00175 }
Inline void upd72001_write_reg | ( | void * | addr, | |
uint8_t | val | |||
) |
upd72001.c の 157 行で定義されています。
参照先 sil_dly_nse(), UPD72001_DELAY, と upd72001_wrb_reg.
参照元 upd72001_opn_por(), upd72001_putchar(), upd72001_read_ctrl(), upd72001_write_brg(), と upd72001_write_ctrl().
00158 { 00159 upd72001_wrb_reg(addr, val); 00160 sil_dly_nse(UPD72001_DELAY); 00161 }
SIOPCB siopcb_table[TNUM_SIOP] |
upd72001.c の 135 行で定義されています。
const SIOPINIB siopinib_table[TNUM_SIOP] |
初期値:
{ { (void *) TADR_UPD72001_DATAA, (void *) TADR_UPD72001_CTRLA, CR3_DEF, CR4_DEF, CR5_DEF, BRG1_DEF, BRG2_DEF }, { (void *) TADR_UPD72001_DATAB, (void *) TADR_UPD72001_CTRLB, CR3_DEF, CR4_DEF, CR5_DEF, BRG1_DEF, BRG2_DEF } }
upd72001.c の 125 行で定義されています。
Copyright © 2008 by Kijineko Inc.