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

Last change on this file since 279 was 279, 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: 12.9 KB
Line 
1#include <setjmp.h>
2#include <sys/time.h>
3#include <stdarg.h>
4#include "../../../musl-1.1.12/include/poll.h"
5#include "analogin_api.h"
6#include "gpio_api.h"
7#include "i2c_api.h"
8#include "pwmout_api.h"
9#include "rtc_api.h"
10#include "serial_api.h"
11#include "us_ticker_api.h"
12#include "wait_api.h"
13#include "usrcmd.h"
14#include "ff.h"
15#include <kernel.h>
16#include "socket_stub.h"
17
18void shellif_into();
19void shellif_outof();
20
21void __exp_analogin_init(analogin_t *obj, PinName pin)
22{
23 shellif_into();
24 analogin_init(obj, pin);
25 shellif_outof();
26}
27
28uint16_t __exp_analogin_read_u16(analogin_t *obj)
29{
30 uint16_t result;
31 shellif_into();
32 result = analogin_read_u16(obj);
33 shellif_outof();
34 return result;
35}
36
37void __exp_gpio_init(gpio_t *obj, PinName pin)
38{
39 shellif_into();
40 gpio_init(obj, pin);
41 shellif_outof();
42}
43
44void __exp_gpio_dir(gpio_t *obj, PinDirection direction)
45{
46 shellif_into();
47 gpio_dir(obj, direction);
48 shellif_outof();
49}
50
51int __exp_i2c_start(i2c_t *obj)
52{
53 int result;
54 shellif_into();
55 result = i2c_start(obj);
56 shellif_outof();
57 return result;
58}
59
60int __exp_i2c_stop(i2c_t *obj)
61{
62 int result;
63 shellif_into();
64 result = i2c_stop(obj);
65 shellif_outof();
66 return result;
67}
68
69void __exp_i2c_init(i2c_t *obj, PinName sda, PinName scl)
70{
71 shellif_into();
72 i2c_init(obj, sda, scl);
73 shellif_outof();
74}
75
76int __exp_i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
77{
78 int result;
79 shellif_into();
80 result = i2c_read(obj, address, data, length, stop);
81 shellif_outof();
82 return result;
83}
84
85int __exp_i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
86{
87 int result;
88 shellif_into();
89 result = i2c_write(obj, address, data, length, stop);
90 shellif_outof();
91 return result;
92}
93
94int __exp_i2c_byte_read(i2c_t *obj, int last)
95{
96 int result;
97 shellif_into();
98 result = i2c_byte_read(obj, last);
99 shellif_outof();
100 return result;
101}
102
103int __exp_i2c_byte_write(i2c_t *obj, int data)
104{
105 int result;
106 shellif_into();
107 result = i2c_byte_write(obj, data);
108 shellif_outof();
109 return result;
110}
111
112void __exp_pwmout_free(pwmout_t* obj)
113{
114 shellif_into();
115 pwmout_free(obj);
116 shellif_outof();
117}
118
119void __exp_pwmout_init(pwmout_t* obj, PinName pin)
120{
121 shellif_into();
122 pwmout_init(obj, pin);
123 shellif_outof();
124}
125
126void __exp_pwmout_pulsewidth_us(pwmout_t* obj, int us)
127{
128 shellif_into();
129 pwmout_pulsewidth_us(obj, us);
130 shellif_outof();
131}
132
133void __exp_rtc_init(void)
134{
135 shellif_into();
136 rtc_init();
137 shellif_outof();
138}
139
140void __exp_rtc_free(void)
141{
142 shellif_into();
143 rtc_free();
144 shellif_outof();
145}
146
147int __exp_rtc_isenabled(void)
148{
149 int result;
150 shellif_into();
151 result = rtc_isenabled();
152 shellif_outof();
153 return result;
154}
155
156time_t __exp_rtc_read(void)
157{
158 time_t result;
159 shellif_into();
160 result = rtc_read();
161 shellif_outof();
162 return result;
163}
164
165void __exp_rtc_write(time_t t)
166{
167 shellif_into();
168 rtc_write(t);
169 shellif_outof();
170}
171
172void __exp_serial_baud(serial_t *obj, int baudrate)
173{
174 shellif_into();
175 serial_baud(obj, baudrate);
176 shellif_outof();
177}
178
179void __exp_serial_init(serial_t *obj, PinName tx, PinName rx)
180{
181 shellif_into();
182 serial_init(obj, tx, rx);
183 shellif_outof();
184}
185
186int __exp_serial_readable(serial_t *obj)
187{
188 int result;
189 shellif_into();
190 result = serial_readable(obj);
191 shellif_outof();
192 return result;
193}
194
195int __exp_serial_getc(serial_t *obj)
196{
197 int result;
198 shellif_into();
199 result = serial_getc(obj);
200 shellif_outof();
201 return result;
202}
203
204void __exp_serial_putc(serial_t *obj, int c)
205{
206 shellif_into();
207 serial_putc(obj, c);
208 shellif_outof();
209}
210
211uint32_t __exp_us_ticker_read(void)
212{
213 int result;
214 shellif_into();
215 result = us_ticker_read();
216 shellif_outof();
217 return result;
218}
219
220void __exp_wait_ms(int ms)
221{
222 shellif_into();
223 wait_ms(ms);
224 shellif_outof();
225}
226
227bool __exp_SD_begin()
228{
229 bool result;
230 shellif_into();
231 result = SD_begin();
232 shellif_outof();
233 return result;
234}
235
236int __exp_usrcmd_cd(int argc, char **argv)
237{
238 int result;
239 shellif_into();
240 result = usrcmd_cd(argc, argv);
241 shellif_outof();
242 return result;
243}
244
245int __exp_usrcmd_ls(int argc, char **argv)
246{
247 int result;
248 shellif_into();
249 result = usrcmd_ls(argc, argv);
250 shellif_outof();
251 return result;
252}
253
254int __exp_usrcmd_cp(int argc, char **argv)
255{
256 int result;
257 shellif_into();
258 result = usrcmd_cp(argc, argv);
259 shellif_outof();
260 return result;
261}
262
263int __exp_usrcmd_rm(int argc, char **argv)
264{
265 int result;
266 shellif_into();
267 result = usrcmd_rm(argc, argv);
268 shellif_outof();
269 return result;
270}
271
272int __exp_usrcmd_mv(int argc, char **argv)
273{
274 int result;
275 shellif_into();
276 result = usrcmd_mv(argc, argv);
277 shellif_outof();
278 return result;
279}
280
281int __exp_usrcmd_mkdir(int argc, char **argv)
282{
283 int result;
284 shellif_into();
285 result = usrcmd_mkdir(argc, argv);
286 shellif_outof();
287 return result;
288}
289
290int __exp_usrcmd_hexdump(int argc, char **argv)
291{
292 int result;
293 shellif_into();
294 result = usrcmd_hexdump(argc, argv);
295 shellif_outof();
296 return result;
297}
298
299int __exp_usrcmd_info(int argc, char **argv)
300{
301 int result;
302 shellif_into();
303 result = usrcmd_info(argc, argv);
304 shellif_outof();
305 return result;
306}
307
308int __exp_usrcmd_exit(int argc, char **argv)
309{
310 int result;
311 shellif_into();
312 result = usrcmd_exit(argc, argv);
313 shellif_outof();
314 return result;
315}
316
317void __exp_shell_abort()
318{
319 shellif_into();
320 shell_abort();
321 shellif_outof();
322}
323
324void __exp_shell_exit(int exitcd)
325{
326 shellif_into();
327 shell_exit(exitcd);
328 shellif_outof();
329}
330
331int __exp_shell_kill(int pid, int sig)
332{
333 int result;
334 shellif_into();
335 result = shell_kill(pid, sig);
336 shellif_outof();
337 return result;
338}
339
340int __exp_shell_gettimeofday(struct timeval * tp, void * tzvp)
341{
342 int result;
343 shellif_into();
344 result = shell_gettimeofday(tp, tzvp);
345 shellif_outof();
346 return result;
347}
348
349void __exp_vsyslog(int priority, const char *format, va_list ap)
350{
351 shellif_into();
352 vsyslog(priority, format, ap);
353 shellif_outof();
354}
355
356int __exp_shell_open(const char * path, int flags)
357{
358 int result;
359 shellif_into();
360 result = shell_open(path, flags);
361 shellif_outof();
362 return result;
363}
364
365int __exp_shell_close(int fd)
366{
367 int result;
368 shellif_into();
369 result = shell_close(fd);
370 shellif_outof();
371 return result;
372}
373
374int __exp_shell_read(int fd, char *data, int len)
375{
376 int result;
377 shellif_into();
378 result = shell_read(fd, data, len);
379 shellif_outof();
380 return result;
381}
382
383int __exp_shell_write(int fd, char *data, int len)
384{
385 int result;
386 shellif_into();
387 result = shell_write(fd, data, len);
388 shellif_outof();
389 return result;
390}
391
392int __exp_shell_lseek(int fd, int ptr, int dir)
393{
394 int result;
395 shellif_into();
396 result = shell_lseek(fd, ptr, dir);
397 shellif_outof();
398 return result;
399}
400
401int __exp_shell_fstat(int fd, struct stat * st)
402{
403 int result;
404 shellif_into();
405 result = shell_fstat(fd, st);
406 shellif_outof();
407 return result;
408}
409
410int __exp_shell_stat(const char *fname, struct stat *st)
411{
412 int result;
413 shellif_into();
414 result = shell_stat(fname, st);
415 shellif_outof();
416 return result;
417}
418
419int __exp_shell_link(void)
420{
421 int result;
422 shellif_into();
423 result = shell_link();
424 shellif_outof();
425 return result;
426}
427
428int __exp_shell_unlink(const char *path)
429{
430 int result;
431 shellif_into();
432 result = shell_unlink(path);
433 shellif_outof();
434 return result;
435}
436
437int __exp_shell_isatty(int fd)
438{
439 int result;
440 shellif_into();
441 result = shell_isatty(fd);
442 shellif_outof();
443 return result;
444}
445
446int __exp_fsync(int fd)
447{
448 int result;
449 shellif_into();
450 result = fsync(fd);
451 shellif_outof();
452 return result;
453}
454
455int __exp_ftruncate(int fd, off_t length)
456{
457 int result;
458 shellif_into();
459 result = ftruncate(fd, length);
460 shellif_outof();
461 return result;
462}
463
464int __exp_ioctl(int fd, int request, va_list ap)
465{
466 int result;
467 shellif_into();
468 result = ioctl(fd, request, ap);
469 shellif_outof();
470 return result;
471}
472
473int __exp_tcgetattr(int fd, struct termios *termios_p)
474{
475 int result;
476 shellif_into();
477 result = tcgetattr(fd, termios_p);
478 shellif_outof();
479 return result;
480}
481
482int __exp_tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
483{
484 int result;
485 shellif_into();
486 result = tcsetattr(fd, optional_actions, termios_p);
487 shellif_outof();
488 return result;
489}
490
491int __exp_shell_rename(const char *oldpath, const char *newpath)
492{
493 int result;
494 shellif_into();
495 result = shell_rename(oldpath, newpath);
496 shellif_outof();
497 return result;
498}
499
500int __exp_rmdir(const char *path)
501{
502 int result;
503 shellif_into();
504 result = rmdir(path);
505 shellif_outof();
506 return result;
507}
508
509int __exp_mkdir(const char *path, mode_t mode)
510{
511 int result;
512 shellif_into();
513 result = mkdir(path, mode);
514 shellif_outof();
515 return result;
516}
517
518int __exp_chmod(const char *path, mode_t mode)
519{
520 int result;
521 shellif_into();
522 result = chmod(path, mode);
523 shellif_outof();
524 return result;
525}
526
527char *__exp_getcwd(char *buf, size_t size)
528{
529 char *result;
530 shellif_into();
531 result = getcwd(buf, size);
532 shellif_outof();
533 return result;
534}
535
536int __exp_chdir(const char *path)
537{
538 int result;
539 shellif_into();
540 result = chdir(path);
541 shellif_outof();
542 return result;
543}
544
545int __exp_chroot(const char *path)
546{
547 int result;
548 shellif_into();
549 result = chroot(path);
550 shellif_outof();
551 return result;
552}
553
554int __exp_closedir(DIR *dir)
555{
556 int result;
557 shellif_into();
558 result = closedir(dir);
559 shellif_outof();
560 return result;
561}
562
563DIR *__exp_opendir(const char *path)
564{
565 DIR *result;
566 shellif_into();
567 result = opendir(path);
568 shellif_outof();
569 return result;
570}
571
572struct dirent *__exp_readdir(DIR *dir)
573{
574 struct dirent *result;
575 shellif_into();
576 result = readdir(dir);
577 shellif_outof();
578 return result;
579}
580
581void __exp_rewinddir(DIR *dir)
582{
583 shellif_into();
584 rewinddir(dir);
585 shellif_outof();
586}
587
588void __exp_seekdir(DIR *dir, long pos)
589{
590 shellif_into();
591 seekdir(dir, pos);
592 shellif_outof();
593}
594
595long __exp_telldir(DIR *dir)
596{
597 long result;
598 shellif_into();
599 result = telldir(dir);
600 shellif_outof();
601 return result;
602}
603
604int __exp_shell_getpid()
605{
606 int result;
607 shellif_into();
608 result = shell_getpid();
609 shellif_outof();
610 return result;
611}
612
613int __exp_socket(int family, int type, int protocol)
614{
615 int result;
616 shellif_into();
617 result = socket(family, type, protocol);
618 shellif_outof();
619 return result;
620}
621
622int __exp_bind(int fd, const struct sockaddr *addr, socklen_t len)
623{
624 int result;
625 shellif_into();
626 result = bind(fd, addr, len);
627 shellif_outof();
628 return result;
629}
630
631int __exp_listen(int fd, int backlog)
632{
633 int result;
634 shellif_into();
635 result = listen(fd, backlog);
636 shellif_outof();
637 return result;
638}
639
640int __exp_connect(int fd, const struct sockaddr *addr, socklen_t len)
641{
642 int result;
643 shellif_into();
644 result = connect(fd, addr, len);
645 shellif_outof();
646 return result;
647}
648
649int __exp_accept(int fd, struct sockaddr *addr, socklen_t *len)
650{
651 int result;
652 shellif_into();
653 result = accept(fd, addr, len);
654 shellif_outof();
655 return result;
656}
657
658ssize_t __exp_send(int fd, const void *buf, size_t len, int flags)
659{
660 ssize_t result;
661 shellif_into();
662 result = send(fd, buf, len, flags);
663 shellif_outof();
664 return result;
665}
666
667ssize_t __exp_sendto(int fd, const void *buf, size_t len, int flags, const struct sockaddr *addr, socklen_t alen)
668{
669 ssize_t result;
670 shellif_into();
671 result = sendto(fd, buf, len, flags, addr, alen);
672 shellif_outof();
673 return result;
674}
675
676ssize_t __exp_recv(int fd, void *buf, size_t len, int flags)
677{
678 ssize_t result;
679 shellif_into();
680 result = recv(fd, buf, len, flags);
681 shellif_outof();
682 return result;
683}
684
685ssize_t __exp_recvfrom(int fd, void *buf, size_t len, int flags, struct sockaddr *addr, socklen_t *alen)
686{
687 ssize_t result;
688 shellif_into();
689 result = recvfrom(fd, buf, len, flags, addr, alen);
690 shellif_outof();
691 return result;
692}
693
694int __exp_shutdown(int fd, int how)
695{
696 int result;
697 shellif_into();
698 result = shutdown(fd, how);
699 shellif_outof();
700 return result;
701}
702
703int __exp_getsockopt(int fd, int level, int optname, void *optval, socklen_t *optlen)
704{
705 int result;
706 shellif_into();
707 result = getsockopt(fd, level, optname, optval, optlen);
708 shellif_outof();
709 return result;
710}
711
712int __exp_setsockopt(int fd, int level, int optname, const void *optval, socklen_t optlen)
713{
714 int result;
715 shellif_into();
716 result = setsockopt(fd, level, optname, optval, optlen);
717 shellif_outof();
718 return result;
719}
720
721int __exp_select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds, struct timeval *tv)
722{
723 int result;
724 shellif_into();
725 result = select(n, rfds, wfds, efds, tv);
726 shellif_outof();
727 return result;
728}
729
730int __exp_poll(struct pollfd *fds, nfds_t nfds, int timeout)
731{
732 int result;
733 shellif_into();
734 result = poll(fds, nfds, timeout);
735 shellif_outof();
736 return result;
737}
738
739int __exp_gethostname(char *name, size_t len)
740{
741 int result;
742 shellif_into();
743 result = gethostname(name, len);
744 shellif_outof();
745 return result;
746}
747
748int __exp_getnameinfo(const struct sockaddr *sa, socklen_t sl,
749 char *node, socklen_t nodelen,
750 char *serv, socklen_t servlen,
751 int flags)
752{
753 int result;
754 shellif_into();
755 shell_abort();
756 result = 0;
757 shellif_outof();
758 return result;
759}
760
761int __exp_getpeername(int fd, struct sockaddr *addr, socklen_t *len)
762{
763 int result;
764 shellif_into();
765 shell_abort();
766 result = 0;
767 shellif_outof();
768 return result;
769}
770
771int __exp_getsockname(int fd, struct sockaddr *addr, socklen_t *len)
772{
773 int result;
774 shellif_into();
775 shell_abort();
776 result = 0;
777 shellif_outof();
778 return result;
779}
780
781int __exp_socketpair(int family, int type, int protocol, int fd[2])
782{
783 int result;
784 shellif_into();
785 shell_abort();
786 result = 0;
787 shellif_outof();
788 return result;
789}
Note: See TracBrowser for help on using the repository browser.