Changeset 364 for asp3_tinet_ecnl_arm/trunk/app4_aircon/src/main.c
- Timestamp:
- Feb 1, 2019, 9:57:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/app4_aircon/src/main.c
r359 r364 79 79 80 80 ID ws_api_mailboxid = MAIN_DATAQUEUE; 81 #ifndef NOUSE_MPF_NET_BUF 81 82 ID ws_mempoolid = MPF_NET_BUF_256; 83 #endif 82 84 83 85 #ifdef IF_ETHER_BTUSB … … 111 113 static void main_timeout(); 112 114 115 extern int ntshell_exit; 116 113 117 int uart_read(char *buf, int cnt, void *extobj) 114 118 { 115 return serial_rea_dat(SIO_PORTID, (char *)buf, cnt); 119 struct main_t *obj = (struct main_t *)extobj; 120 int result; 121 ER ret; 122 int timer; 123 124 obj->prev = obj->now; 125 126 /* タイマー取得 */ 127 timer = main_get_timer(); 128 129 /* 待ち */ 130 ret = serial_trea_dat(SIO_PORTID, buf, cnt, timer); 131 if ((ret < 0) && (ret != E_OK) && (ret != E_TMOUT)) { 132 syslog(LOG_NOTICE, "tslp_tsk ret: %s %d", itron_strerror(ret), timer); 133 ntshell_exit = 1; 134 return -1; 135 } 136 result = (int)ret; 137 138 ret = get_tim(&obj->now); 139 if (ret != E_OK) { 140 syslog(LOG_NOTICE, "get_tim ret: %s", itron_strerror(ret)); 141 ntshell_exit = 1; 142 return -1; 143 } 144 145 /* 時間経過 */ 146 int elapse = obj->now - obj->prev; 147 main_progress(elapse); 148 149 /* タイムアウト処理 */ 150 main_timeout(); 151 152 return result; 116 153 } 117 154 … … 119 156 { 120 157 return serial_wri_dat(SIO_PORTID, buf, cnt); 121 }122 123 unsigned char ntstdio_xi(struct ntstdio_t *handle)124 {125 char buf[1];126 if(serial_rea_dat(SIO_PORTID, buf, 1) != 1)127 return -EIO;128 return buf[0];129 }130 131 void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)132 {133 char buf[1];134 buf[0] = c;135 serial_wri_dat(SIO_PORTID, buf, 1);136 158 } 137 159 … … 150 172 main_initialize(); 151 173 152 ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, NULL);174 ntshell_init(&ntshell, uart_read, uart_write, cmd_execute, &main_obj); 153 175 ntshell_set_prompt(&ntshell, "NTShell>"); 154 176 ntshell_execute(&ntshell); … … 168 190 ER ret; 169 191 170 ntshell_task_init(); 192 #ifdef TOPPERS_OMIT_TECS 193 serial_opn_por(SIO_PORTID); 194 #endif 195 serial_ctl_por(SIO_PORTID, IOCTL_FCSND | IOCTL_FCRCV); 196 197 ntshell_task_init(uart_read, uart_write, &main_obj); 171 198 172 199 main_obj.timer = TMO_FEVR;
Note:
See TracChangeset
for help on using the changeset viewer.