Changeset 364 for asp3_tinet_ecnl_rx/trunk/bnep_bridge/src
- Timestamp:
- Feb 1, 2019, 9:57:09 PM (5 years ago)
- Location:
- asp3_tinet_ecnl_rx/trunk/bnep_bridge/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/main.c
r359 r364 117 117 static void main_timeout(); 118 118 119 extern int ntshell_exit; 120 119 121 int uart_read(char *buf, int cnt, void *extobj) 120 122 { 121 return serial_rea_dat(SIO_PORTID, (char *)buf, cnt); 123 struct main_t *obj = (struct main_t *)extobj; 124 int result; 125 ER ret; 126 int timer; 127 128 obj->prev = obj->now; 129 130 /* タイマー取得 */ 131 timer = main_get_timer(); 132 133 /* 待ち */ 134 ret = serial_trea_dat(SIO_PORTID, buf, cnt, timer); 135 if ((ret < 0) && (ret != E_OK) && (ret != E_TMOUT)) { 136 syslog(LOG_NOTICE, "tslp_tsk ret: %s %d", itron_strerror(ret), timer); 137 ntshell_exit = 1; 138 return -1; 139 } 140 result = (int)ret; 141 142 ret = get_tim(&obj->now); 143 if (ret != E_OK) { 144 syslog(LOG_NOTICE, "get_tim ret: %s", itron_strerror(ret)); 145 ntshell_exit = 1; 146 return -1; 147 } 148 149 /* 時間経過 */ 150 int elapse = obj->now - obj->prev; 151 main_progress(elapse); 152 153 /* タイムアウト処理 */ 154 main_timeout(); 155 156 return result; 122 157 } 123 158 … … 125 160 { 126 161 return serial_wri_dat(SIO_PORTID, buf, cnt); 127 }128 129 unsigned char ntstdio_xi(struct ntstdio_t *handle)130 {131 char buf[1];132 if(serial_rea_dat(SIO_PORTID, buf, 1) != 1)133 return -EIO;134 return buf[0];135 }136 137 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)138 {139 char buf[1];140 buf[0] = c;141 serial_wri_dat(SIO_PORTID, buf, 1);142 162 } 143 163 … … 154 174 main_initialize(); 155 175 156 ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, NULL);176 ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, &main_obj); 157 177 ntshell_set_prompt(&ntshell, "NTShell>"); 158 178 ntshell_execute(&ntshell); … … 172 192 ER ret; 173 193 174 ntshell_task_init(); 194 #ifdef TOPPERS_OMIT_TECS 195 serial_opn_por(SIO_PORTID); 196 #endif 197 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 198 199 ntshell_task_init(uart_read, uart_write, &main_obj); 175 200 176 201 main_obj.timer = TMO_FEVR; -
asp3_tinet_ecnl_rx/trunk/bnep_bridge/src/main.cfg
r348 r364 47 47 INCLUDE("if_rx62n.cfg"); 48 48 INCLUDE("ntshell_main.cfg"); 49 INCLUDE("mbed_api.cfg"); 49 50 50 51 CRE_TSK(MAIN_TASK, { TA_ACT, 0, main_task, MAIN_PRIORITY, MAIN_STACK_SIZE, NULL });
Note:
See TracChangeset
for help on using the changeset viewer.