Ignore:
Timestamp:
Jun 18, 2017, 10:06:41 PM (5 years ago)
Author:
alain
Message:

Introduce syscalls.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/time.h

    r1 r23  
    11/*
    2  * time.h: thread time related management
     2 * time.h - Structure used by gettimeofday.
    33 *
    4  * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless
    5  * Copyright (c) 2011,2012 UPMC Sorbonne Universites
     4 * author    Alain Greiner (2016,2017)
    65 *
    7  * This file is part of ALMOS-kernel.
     6 * Copyright (c) UPMC Sorbonne Universites
    87 *
    9  * ALMOS-kernel is free software; you can redistribute it and/or modify it
     8 * This file is part of ALMOS-MKH.
     9 *
     10 * ALMOS-MKH is free software; you can redistribute it and/or modify it
    1011 * under the terms of the GNU General Public License as published by
    1112 * the Free Software Foundation; version 2.0 of the License.
    1213 *
    13  * ALMOS-kernel is distributed in the hope that it will be useful, but
     14 * ALMOS-MKH is distributed in the hope that it will be useful, but
    1415 * WITHOUT ANY WARRANTY; without even the implied warranty of
    1516 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     
    1718 *
    1819 * You should have received a copy of the GNU General Public License
    19  * along with ALMOS-kernel; if not, write to the Free Software Foundation,
     20 * along with ALMOS-MKH; if not, write to the Free Software Foundation,
    2021 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    2122 */
     
    2425#define _TIME_H_
    2526
    26 #include <types.h>
    27 #include <list.h>
    28 #include <device.h>
     27#include <hal_types.h>
    2928
    30 struct event_s;
    3129
    32 struct alarm_info_s
     30struct timeval
    3331{
    34         uint_t signature;
    35 
    36         /* Public members */
    37         struct event_s *event;
    38 
    39         /* Private members */
    40         uint_t tm_wakeup;
    41         struct list_entry list;
     32        uint32_t tv_sec;        /* secondes */
     33        uint32_t tv_usec;       /* microsecondes */
    4234};
    4335
    44 struct alarm_s
    45 {
    46         struct list_entry wait_queue;
    47 };
    48 
    49 
    50 struct timeb {
    51         time_t         time;
    52         unsigned short millitm;
    53         short          timezone;
    54         short          dstflag;
    55 };
    56 
    57 struct timeval {
    58         clock_t tv_sec;    /* secondes */
    59         clock_t tv_usec;   /* microsecondes */
    60 };
    61 
    62 struct timezone {
     36struct timezone
     37{
    6338        int tz_minuteswest;     /* minutes west of Greenwich */
    6439        int tz_dsttime;         /* type of DST correction */
    6540};
    6641
    67 
    68 struct tms
    69 {
    70        clock_t tms_utime;  /* user time */
    71        clock_t tms_stime;  /* system time */
    72        clock_t tms_cutime; /* user time of children */
    73        clock_t tms_cstime; /* system time of children */
    74 };
    75 
    76 
    77 error_t alarm_manager_init(struct alarm_s *alarm);
    78 error_t alarm_wait(struct alarm_info_s *info, uint_t msec);
    79 
    80 void alarm_clock(struct alarm_s *alarm, uint_t ticks_nr);
    81 
    82 int sys_clock (uint64_t *val);
    83 int sys_alarm (unsigned nb_sec);
    84 int sys_ftime (struct timeb *utime);
    85 int sys_times(struct tms *utms);
    86 int sys_gettimeofday(struct timeval *tv, struct timezone *tz);
    87 
    88 #if CONFIG_THREAD_TIME_STAT
    89 struct thread_s;
    90 inline void tm_sleep_compute(struct thread_s *thread);
    91 inline void tm_usr_compute(struct thread_s *thread);
    92 inline void tm_sys_compute(struct thread_s *thread);
    93 inline void tm_wait_compute(struct thread_s *thread);
    94 inline void tm_exit_compute(struct thread_s *thread);
    95 inline void tm_born_compute(struct thread_s *thread);
    96 inline void tm_create_compute(struct thread_s *thread);
    97 
    98 #else
    99 
    100 #define tm_sleep_compute(thread)
    101 #define tm_usr_compute(thread)
    102 #define tm_sys_compute(thread)
    103 #define tm_wait_compute(thread)
    104 #define tm_exit_compute(thread)
    105 #define tm_born_compute(thread)
    106 #define tm_create_compute(thread)
    107 
    108 #endif  /* CONFIG_SCHED_STAT */
    109 
    11042#endif  /* _TIME_H_ */
Note: See TracChangeset for help on using the changeset viewer.