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_arm/trunk/ntshell/src/ntshell_main.c

    r352 r364  
    6969const struct utsname host_name = {
    7070        "TOPPERS/ASP3",
    71     TARGET_NAME,
    72     "3.2.0",
    73     "3.2.0",
    74     TARGET_NAME,
    75     "toppers.jp"
     71        TARGET_NAME,
     72        "3.2.0",
     73        "3.2.0",
     74        TARGET_NAME,
     75        "toppers.jp"
    7676};
    7777
     
    8888jmp_buf process_exit;
    8989void sys_init(void);
    90 
    91 void ntshell_task_init()
    92 {
     90NTSHELL_SERIAL_READ ntshell_serial_read = 0;
     91NTSHELL_SERIAL_WRITE ntshell_serial_write = 0;
     92void *ntshell_serial_extobj;
     93
     94unsigned char ntstdio_xi(struct ntstdio_t *handle)
     95{
     96        unsigned char buf[1];
     97        ntshell_serial_read((char *)buf, 1, ntshell_serial_extobj);
     98        return buf[0];
     99}
     100
     101void ntstdio_xo(struct ntstdio_t *handle, unsigned char c)
     102{
     103        char buf[1];
     104        buf[0] = c;
     105        ntshell_serial_write(buf, 1, ntshell_serial_extobj);
     106}
     107
     108void ntshell_task_init(NTSHELL_SERIAL_READ func_read,
     109        NTSHELL_SERIAL_WRITE func_write, void *extobj)
     110{
     111        ntshell_serial_read = func_read;
     112        ntshell_serial_write = func_write;
     113        ntshell_serial_extobj = extobj;
     114
    93115        sys_init();
    94116
     
    126148        int result = 0;
    127149        int found = 0;
     150
     151        if (*args == 0)
     152                return result;
    128153
    129154        if (strcmp((const char *)args[1], "help") == 0) {
     
    295320int shell_clock_getres(clockid_t clk_id, struct timespec *res)
    296321{
    297         if (clk_id != CLOCK_REALTIME)
     322        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    298323                return -EINVAL;
    299324
     
    308333        SYSTIM now = 0;
    309334
    310         if (clk_id != CLOCK_REALTIME)
     335        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    311336                return -EINVAL;
    312337
     
    320345int shell_clock_settime(clockid_t clk_id, const struct timespec *tp)
    321346{
    322         if (clk_id != CLOCK_REALTIME)
     347        if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
    323348                return -EINVAL;
    324349
    325         rtc_write(tp->tv_sec);
     350        SYSTIM time;
     351        ER ret;
     352
     353        time = (tp->tv_sec * 1000000ll) + (tp->tv_nsec / 1000ll);
     354
     355        ret = set_tim(time);
     356        if (ret != E_OK) {
     357                return -EPERM;
     358        }
    326359
    327360        return 0;
     
    356389}
    357390
    358 struct sigaction sigtable[6];
     391struct sigaction sigtable[7];
    359392
    360393int shell_sigaction(int sig, const struct sigaction *restrict sa, struct sigaction *restrict old)
     
    381414                sat = &sigtable[5];
    382415                break;
     416        case SIGPIPE:
     417                sat = &sigtable[6];
     418                break;
    383419        default:
    384420                return -EINVAL;
Note: See TracChangeset for help on using the changeset viewer.