Ignore:
Timestamp:
Feb 1, 2019, 9:57:09 PM (5 years ago)
Author:
coas-nagasima
Message:

TINETとSocket APIなどを更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_rx/trunk/ntshell/src/ntshell_main.c

    r342 r364  
    6060#include "socket_stub.h"
    6161#include "usb_hbth.h"
     62#include "mbed_api.h"
    6263
    6364extern int bt_bnep_mode;
     
    6970const struct utsname host_name = {
    7071        "TOPPERS/ASP3",
    71     TARGET_NAME,
    72     "3.2.0",
    73     "3.2.0",
    74     TARGET_NAME,
    75     "toppers.jp"
     72        TARGET_NAME,
     73        "3.2.0",
     74        "3.2.0",
     75        TARGET_NAME,
     76        "toppers.jp"
    7677};
    7778
     
    8889jmp_buf process_exit;
    8990void sys_init(void);
    90 
    91 void ntshell_task_init()
    92 {
     91NTSHELL_SERIAL_READ ntshell_serial_read = 0;
     92NTSHELL_SERIAL_WRITE ntshell_serial_write = 0;
     93void *ntshell_serial_extobj;
     94
     95unsigned char ntstdio_xi(struct ntstdio_t *handle)
     96{
     97        unsigned char buf[1];
     98        ntshell_serial_read((char *)buf, 1, ntshell_serial_extobj);
     99        return buf[0];
     100}
     101
     102void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)
     103{
     104        char buf[1];
     105        buf[0] = c;
     106        ntshell_serial_write(buf, 1, ntshell_serial_extobj);
     107}
     108
     109void ntshell_task_init(NTSHELL_SERIAL_READ func_read,
     110        NTSHELL_SERIAL_WRITE func_write, void *extobj)
     111{
     112        ntshell_serial_read = func_read;
     113        ntshell_serial_write = func_write;
     114        ntshell_serial_extobj = extobj;
     115
    93116        sys_init();
    94117
     
    126149        int result = 0;
    127150        int found = 0;
     151
     152        if (*args == 0)
     153                return result;
    128154
    129155        if (strcmp((const char *)args[1], "help") == 0) {
     
    295321int shell_clock_getres(clockid_t clk_id, struct timespec *res)
    296322{
    297         if (clk_id != CLOCK_REALTIME)
     323        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    298324                return -EINVAL;
    299325
     
    308334        SYSTIM now = 0;
    309335
    310         if (clk_id != CLOCK_REALTIME)
     336        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    311337                return -EINVAL;
    312338
     
    320346int shell_clock_settime(clockid_t clk_id, const struct timespec *tp)
    321347{
    322         if (clk_id != CLOCK_REALTIME)
     348        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    323349                return -EINVAL;
    324350
    325         rtc_write(tp->tv_sec);
     351        SYSTIM time;
     352        ER ret;
     353
     354        time = (tp->tv_sec * 1000000ll) + (tp->tv_nsec / 1000ll);
     355
     356        ret = set_tim(time);
     357        if (ret != E_OK) {
     358                return -EPERM;
     359        }
    326360
    327361        return 0;
     
    356390}
    357391
    358 struct sigaction sigtable[6];
     392struct sigaction sigtable[7];
    359393
    360394int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
     
    381415                sat = &sigtable[5];
    382416                break;
     417        case SIGPIPE:
     418                sat = &sigtable[6];
     419                break;
    383420        default:
    384421                return -EINVAL;
Note: See TracChangeset for help on using the changeset viewer.