source: EcnlProtoTool/trunk/ntshell/src/shellif.c@ 286

Last change on this file since 286 was 286, checked in by coas-nagasima, 7 years ago

各ソフトウェアのライセンスを整理

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-csrc
File size: 15.4 KB
Line 
1/*
2 * TOPPERS ECHONET Lite Communication Middleware
3 *
4 * Copyright (C) 2017 Cores Co., Ltd. Japan
5 *
6 * 上記著作権者
7は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
8 * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
9 * 変・再é…
10å¸ƒï¼ˆä»¥ä¸‹ï¼Œåˆ©ç”¨ã¨å‘¼ã¶ï¼‰ã™ã‚‹ã“とを無償で許諾する.
11 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
12 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
13 * スコード中に含まれていること.
14 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
15 * 用できる形で再é…
16å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œå†é…
17å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨
18 * 者
19マニュアルなど)に,上記の著作権表示,この利用条件および下記
20 * の無保証規定を掲載すること.
21 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
22 * 用できない形で再é…
23å¸ƒã™ã‚‹å ´åˆã«ã¯ï¼Œæ¬¡ã®ã„ずれかの条件を満たすこ
24 * と.
25 * (a) 再é…
26å¸ƒã«ä¼´ã†ãƒ‰ã‚­ãƒ¥ãƒ¡ãƒ³ãƒˆï¼ˆåˆ©ç”¨è€…
27マニュアルなど)に,上記の著
28 * 作権表示,この利用条件および下記の無保証規定を掲載すること.
29 * (b) 再é…
30å¸ƒã®å½¢æ…
31‹ã‚’,別に定める方法によって,TOPPERSプロジェクトに
32 * 報告すること.
33 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
34 * 害からも,上記著作権者
35およびTOPPERSプロジェクトをå…
36è²¬ã™ã‚‹ã“と.
37 * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
38 * 由に基づく請求からも,上記著作権者
39およびTOPPERSプロジェクトを
40 * å…
41è²¬ã™ã‚‹ã“と.
42 *
43 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者
44お
45 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
46 * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
47 * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
48 * の責任を負わない.
49 *
50 * @(#) $Id: shellif.c 286 2017-05-02 15:25:33Z coas-nagasima $
51 */
52#include <setjmp.h>
53#include <sys/time.h>
54#include <stdarg.h>
55#include "../../../musl-1.1.12/include/poll.h"
56#include "analogin_api.h"
57#include "gpio_api.h"
58#include "i2c_api.h"
59#include "pwmout_api.h"
60#include "rtc_api.h"
61#include "serial_api.h"
62#include "us_ticker_api.h"
63#include "wait_api.h"
64#include "usrcmd.h"
65#include "ff.h"
66#include <kernel.h>
67#include "socket_stub.h"
68
69void shellif_into();
70void shellif_outof();
71
72void __exp_analogin_init(analogin_t *obj, PinName pin)
73{
74 shellif_into();
75 analogin_init(obj, pin);
76 shellif_outof();
77}
78
79uint16_t __exp_analogin_read_u16(analogin_t *obj)
80{
81 uint16_t result;
82 shellif_into();
83 result = analogin_read_u16(obj);
84 shellif_outof();
85 return result;
86}
87
88void __exp_gpio_init(gpio_t *obj, PinName pin)
89{
90 shellif_into();
91 gpio_init(obj, pin);
92 shellif_outof();
93}
94
95void __exp_gpio_dir(gpio_t *obj, PinDirection direction)
96{
97 shellif_into();
98 gpio_dir(obj, direction);
99 shellif_outof();
100}
101
102int __exp_i2c_start(i2c_t *obj)
103{
104 int result;
105 shellif_into();
106 result = i2c_start(obj);
107 shellif_outof();
108 return result;
109}
110
111int __exp_i2c_stop(i2c_t *obj)
112{
113 int result;
114 shellif_into();
115 result = i2c_stop(obj);
116 shellif_outof();
117 return result;
118}
119
120void __exp_i2c_init(i2c_t *obj, PinName sda, PinName scl)
121{
122 shellif_into();
123 i2c_init(obj, sda, scl);
124 shellif_outof();
125}
126
127int __exp_i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
128{
129 int result;
130 shellif_into();
131 result = i2c_read(obj, address, data, length, stop);
132 shellif_outof();
133 return result;
134}
135
136int __exp_i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
137{
138 int result;
139 shellif_into();
140 result = i2c_write(obj, address, data, length, stop);
141 shellif_outof();
142 return result;
143}
144
145int __exp_i2c_byte_read(i2c_t *obj, int last)
146{
147 int result;
148 shellif_into();
149 result = i2c_byte_read(obj, last);
150 shellif_outof();
151 return result;
152}
153
154int __exp_i2c_byte_write(i2c_t *obj, int data)
155{
156 int result;
157 shellif_into();
158 result = i2c_byte_write(obj, data);
159 shellif_outof();
160 return result;
161}
162
163void __exp_pwmout_free(pwmout_t* obj)
164{
165 shellif_into();
166 pwmout_free(obj);
167 shellif_outof();
168}
169
170void __exp_pwmout_init(pwmout_t* obj, PinName pin)
171{
172 shellif_into();
173 pwmout_init(obj, pin);
174 shellif_outof();
175}
176
177void __exp_pwmout_pulsewidth_us(pwmout_t* obj, int us)
178{
179 shellif_into();
180 pwmout_pulsewidth_us(obj, us);
181 shellif_outof();
182}
183
184void __exp_rtc_init(void)
185{
186 shellif_into();
187 rtc_init();
188 shellif_outof();
189}
190
191void __exp_rtc_free(void)
192{
193 shellif_into();
194 rtc_free();
195 shellif_outof();
196}
197
198int __exp_rtc_isenabled(void)
199{
200 int result;
201 shellif_into();
202 result = rtc_isenabled();
203 shellif_outof();
204 return result;
205}
206
207time_t __exp_rtc_read(void)
208{
209 time_t result;
210 shellif_into();
211 result = rtc_read();
212 shellif_outof();
213 return result;
214}
215
216void __exp_rtc_write(time_t t)
217{
218 shellif_into();
219 rtc_write(t);
220 shellif_outof();
221}
222
223void __exp_serial_baud(serial_t *obj, int baudrate)
224{
225 shellif_into();
226 serial_baud(obj, baudrate);
227 shellif_outof();
228}
229
230void __exp_serial_init(serial_t *obj, PinName tx, PinName rx)
231{
232 shellif_into();
233 serial_init(obj, tx, rx);
234 shellif_outof();
235}
236
237int __exp_serial_readable(serial_t *obj)
238{
239 int result;
240 shellif_into();
241 result = serial_readable(obj);
242 shellif_outof();
243 return result;
244}
245
246int __exp_serial_getc(serial_t *obj)
247{
248 int result;
249 shellif_into();
250 result = serial_getc(obj);
251 shellif_outof();
252 return result;
253}
254
255void __exp_serial_putc(serial_t *obj, int c)
256{
257 shellif_into();
258 serial_putc(obj, c);
259 shellif_outof();
260}
261
262uint32_t __exp_us_ticker_read(void)
263{
264 int result;
265 shellif_into();
266 result = us_ticker_read();
267 shellif_outof();
268 return result;
269}
270
271void __exp_wait_ms(int ms)
272{
273 shellif_into();
274 wait_ms(ms);
275 shellif_outof();
276}
277
278bool __exp_SD_begin()
279{
280 bool result;
281 shellif_into();
282 result = SD_begin();
283 shellif_outof();
284 return result;
285}
286
287int __exp_usrcmd_cd(int argc, char **argv)
288{
289 int result;
290 shellif_into();
291 result = usrcmd_cd(argc, argv);
292 shellif_outof();
293 return result;
294}
295
296int __exp_usrcmd_ls(int argc, char **argv)
297{
298 int result;
299 shellif_into();
300 result = usrcmd_ls(argc, argv);
301 shellif_outof();
302 return result;
303}
304
305int __exp_usrcmd_cp(int argc, char **argv)
306{
307 int result;
308 shellif_into();
309 result = usrcmd_cp(argc, argv);
310 shellif_outof();
311 return result;
312}
313
314int __exp_usrcmd_rm(int argc, char **argv)
315{
316 int result;
317 shellif_into();
318 result = usrcmd_rm(argc, argv);
319 shellif_outof();
320 return result;
321}
322
323int __exp_usrcmd_mv(int argc, char **argv)
324{
325 int result;
326 shellif_into();
327 result = usrcmd_mv(argc, argv);
328 shellif_outof();
329 return result;
330}
331
332int __exp_usrcmd_mkdir(int argc, char **argv)
333{
334 int result;
335 shellif_into();
336 result = usrcmd_mkdir(argc, argv);
337 shellif_outof();
338 return result;
339}
340
341int __exp_usrcmd_hexdump(int argc, char **argv)
342{
343 int result;
344 shellif_into();
345 result = usrcmd_hexdump(argc, argv);
346 shellif_outof();
347 return result;
348}
349
350int __exp_usrcmd_info(int argc, char **argv)
351{
352 int result;
353 shellif_into();
354 result = usrcmd_info(argc, argv);
355 shellif_outof();
356 return result;
357}
358
359int __exp_usrcmd_exit(int argc, char **argv)
360{
361 int result;
362 shellif_into();
363 result = usrcmd_exit(argc, argv);
364 shellif_outof();
365 return result;
366}
367
368void __exp_shell_abort()
369{
370 shellif_into();
371 shell_abort();
372 shellif_outof();
373}
374
375void __exp_shell_exit(int exitcd)
376{
377 shellif_into();
378 shell_exit(exitcd);
379 shellif_outof();
380}
381
382int __exp_shell_kill(int pid, int sig)
383{
384 int result;
385 shellif_into();
386 result = shell_kill(pid, sig);
387 shellif_outof();
388 return result;
389}
390
391int __exp_shell_gettimeofday(struct timeval * tp, void * tzvp)
392{
393 int result;
394 shellif_into();
395 result = shell_gettimeofday(tp, tzvp);
396 shellif_outof();
397 return result;
398}
399
400void __exp_vsyslog(int priority, const char *format, va_list ap)
401{
402 shellif_into();
403 vsyslog(priority, format, ap);
404 shellif_outof();
405}
406
407int __exp_shell_open(const char * path, int flags)
408{
409 int result;
410 shellif_into();
411 result = shell_open(path, flags);
412 shellif_outof();
413 return result;
414}
415
416int __exp_shell_close(int fd)
417{
418 int result;
419 shellif_into();
420 result = shell_close(fd);
421 shellif_outof();
422 return result;
423}
424
425int __exp_shell_read(int fd, char *data, int len)
426{
427 int result;
428 shellif_into();
429 result = shell_read(fd, data, len);
430 shellif_outof();
431 return result;
432}
433
434int __exp_shell_write(int fd, char *data, int len)
435{
436 int result;
437 shellif_into();
438 result = shell_write(fd, data, len);
439 shellif_outof();
440 return result;
441}
442
443int __exp_shell_lseek(int fd, int ptr, int dir)
444{
445 int result;
446 shellif_into();
447 result = shell_lseek(fd, ptr, dir);
448 shellif_outof();
449 return result;
450}
451
452int __exp_shell_fstat(int fd, struct stat * st)
453{
454 int result;
455 shellif_into();
456 result = shell_fstat(fd, st);
457 shellif_outof();
458 return result;
459}
460
461int __exp_shell_stat(const char *fname, struct stat *st)
462{
463 int result;
464 shellif_into();
465 result = shell_stat(fname, st);
466 shellif_outof();
467 return result;
468}
469
470int __exp_shell_link(void)
471{
472 int result;
473 shellif_into();
474 result = shell_link();
475 shellif_outof();
476 return result;
477}
478
479int __exp_shell_unlink(const char *path)
480{
481 int result;
482 shellif_into();
483 result = shell_unlink(path);
484 shellif_outof();
485 return result;
486}
487
488int __exp_shell_isatty(int fd)
489{
490 int result;
491 shellif_into();
492 result = shell_isatty(fd);
493 shellif_outof();
494 return result;
495}
496
497int __exp_fsync(int fd)
498{
499 int result;
500 shellif_into();
501 result = fsync(fd);
502 shellif_outof();
503 return result;
504}
505
506int __exp_ftruncate(int fd, off_t length)
507{
508 int result;
509 shellif_into();
510 result = ftruncate(fd, length);
511 shellif_outof();
512 return result;
513}
514
515int __exp_ioctl(int fd, int request, va_list ap)
516{
517 int result;
518 shellif_into();
519 result = ioctl(fd, request, ap);
520 shellif_outof();
521 return result;
522}
523
524int __exp_tcgetattr(int fd, struct termios *termios_p)
525{
526 int result;
527 shellif_into();
528 result = tcgetattr(fd, termios_p);
529 shellif_outof();
530 return result;
531}
532
533int __exp_tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
534{
535 int result;
536 shellif_into();
537 result = tcsetattr(fd, optional_actions, termios_p);
538 shellif_outof();
539 return result;
540}
541
542int __exp_shell_rename(const char *oldpath, const char *newpath)
543{
544 int result;
545 shellif_into();
546 result = shell_rename(oldpath, newpath);
547 shellif_outof();
548 return result;
549}
550
551int __exp_rmdir(const char *path)
552{
553 int result;
554 shellif_into();
555 result = rmdir(path);
556 shellif_outof();
557 return result;
558}
559
560int __exp_mkdir(const char *path, mode_t mode)
561{
562 int result;
563 shellif_into();
564 result = mkdir(path, mode);
565 shellif_outof();
566 return result;
567}
568
569int __exp_chmod(const char *path, mode_t mode)
570{
571 int result;
572 shellif_into();
573 result = chmod(path, mode);
574 shellif_outof();
575 return result;
576}
577
578char *__exp_getcwd(char *buf, size_t size)
579{
580 char *result;
581 shellif_into();
582 result = getcwd(buf, size);
583 shellif_outof();
584 return result;
585}
586
587int __exp_chdir(const char *path)
588{
589 int result;
590 shellif_into();
591 result = chdir(path);
592 shellif_outof();
593 return result;
594}
595
596int __exp_chroot(const char *path)
597{
598 int result;
599 shellif_into();
600 result = chroot(path);
601 shellif_outof();
602 return result;
603}
604
605int __exp_closedir(DIR *dir)
606{
607 int result;
608 shellif_into();
609 result = closedir(dir);
610 shellif_outof();
611 return result;
612}
613
614DIR *__exp_opendir(const char *path)
615{
616 DIR *result;
617 shellif_into();
618 result = opendir(path);
619 shellif_outof();
620 return result;
621}
622
623struct dirent *__exp_readdir(DIR *dir)
624{
625 struct dirent *result;
626 shellif_into();
627 result = readdir(dir);
628 shellif_outof();
629 return result;
630}
631
632void __exp_rewinddir(DIR *dir)
633{
634 shellif_into();
635 rewinddir(dir);
636 shellif_outof();
637}
638
639void __exp_seekdir(DIR *dir, long pos)
640{
641 shellif_into();
642 seekdir(dir, pos);
643 shellif_outof();
644}
645
646long __exp_telldir(DIR *dir)
647{
648 long result;
649 shellif_into();
650 result = telldir(dir);
651 shellif_outof();
652 return result;
653}
654
655int __exp_shell_getpid()
656{
657 int result;
658 shellif_into();
659 result = shell_getpid();
660 shellif_outof();
661 return result;
662}
663
664int __exp_socket(int family, int type, int protocol)
665{
666 int result;
667 shellif_into();
668 result = socket(family, type, protocol);
669 shellif_outof();
670 return result;
671}
672
673int __exp_bind(int fd, const struct sockaddr *addr, socklen_t len)
674{
675 int result;
676 shellif_into();
677 result = bind(fd, addr, len);
678 shellif_outof();
679 return result;
680}
681
682int __exp_listen(int fd, int backlog)
683{
684 int result;
685 shellif_into();
686 result = listen(fd, backlog);
687 shellif_outof();
688 return result;
689}
690
691int __exp_connect(int fd, const struct sockaddr *addr, socklen_t len)
692{
693 int result;
694 shellif_into();
695 result = connect(fd, addr, len);
696 shellif_outof();
697 return result;
698}
699
700int __exp_accept(int fd, struct sockaddr *addr, socklen_t *len)
701{
702 int result;
703 shellif_into();
704 result = accept(fd, addr, len);
705 shellif_outof();
706 return result;
707}
708
709ssize_t __exp_send(int fd, const void *buf, size_t len, int flags)
710{
711 ssize_t result;
712 shellif_into();
713 result = send(fd, buf, len, flags);
714 shellif_outof();
715 return result;
716}
717
718ssize_t __exp_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
719{
720 ssize_t result;
721 shellif_into();
722 result = sendto(fd, buf, len, flags, addr, alen);
723 shellif_outof();
724 return result;
725}
726
727ssize_t __exp_recv(int fd, void *buf, size_t len, int flags)
728{
729 ssize_t result;
730 shellif_into();
731 result = recv(fd, buf, len, flags);
732 shellif_outof();
733 return result;
734}
735
736ssize_t __exp_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *alen)
737{
738 ssize_t result;
739 shellif_into();
740 result = recvfrom(fd, buf, len, flags, addr, alen);
741 shellif_outof();
742 return result;
743}
744
745int __exp_shutdown(int fd, int how)
746{
747 int result;
748 shellif_into();
749 result = shutdown(fd, how);
750 shellif_outof();
751 return result;
752}
753
754int __exp_getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen)
755{
756 int result;
757 shellif_into();
758 result = getsockopt(fd, level, optname, optval, optlen);
759 shellif_outof();
760 return result;
761}
762
763int __exp_setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
764{
765 int result;
766 shellif_into();
767 result = setsockopt(fd, level, optname, optval, optlen);
768 shellif_outof();
769 return result;
770}
771
772int __exp_select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)
773{
774 int result;
775 shellif_into();
776 result = select(n, rfds, wfds, efds, tv);
777 shellif_outof();
778 return result;
779}
780
781int __exp_poll(struct pollfd *fds, nfds_t nfds, int timeout)
782{
783 int result;
784 shellif_into();
785 result = poll(fds, nfds, timeout);
786 shellif_outof();
787 return result;
788}
789
790int __exp_gethostname(char *name, size_t len)
791{
792 int result;
793 shellif_into();
794 result = gethostname(name, len);
795 shellif_outof();
796 return result;
797}
798
799int __exp_getnameinfo(const struct sockaddr *sa, socklen_t sl,
800 char *node, socklen_t nodelen,
801 char *serv, socklen_t servlen,
802 int flags)
803{
804 int result;
805 shellif_into();
806 shell_abort();
807 result = 0;
808 shellif_outof();
809 return result;
810}
811
812int __exp_getpeername(int fd, struct sockaddr *addr, socklen_t *len)
813{
814 int result;
815 shellif_into();
816 shell_abort();
817 result = 0;
818 shellif_outof();
819 return result;
820}
821
822int __exp_getsockname(int fd, struct sockaddr *addr, socklen_t *len)
823{
824 int result;
825 shellif_into();
826 shell_abort();
827 result = 0;
828 shellif_outof();
829 return result;
830}
831
832int __exp_socketpair(int family, int type, int protocol, int fd[2])
833{
834 int result;
835 shellif_into();
836 shell_abort();
837 result = 0;
838 shellif_outof();
839 return result;
840}
Note: See TracBrowser for help on using the repository browser.