Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / n8 / include_private / n8_time.h
blobd3aff2e680fe39b1abc78dcc191f2a2ddf9c8adf
1 /*-
2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
3 * All rights reserved.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
12 * met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /*****************************************************************************
36 * @(#) n8_time.h 1.4@(#)
37 *****************************************************************************/
39 /*****************************************************************************/
40 /** @file n8_time.h
41 * @brief Time manipulation functions in a os independent manner.
43 * This file contains the data structures and function prototypes needed
44 * to manipulate time values in an OS independent manner.
46 *****************************************************************************/
48 /*****************************************************************************
49 * Revision history:
50 * 03/12/03 jpw Added n8_delay_ms
51 * 08/17/01 msz Original version.
52 ****************************************************************************/
53 #ifndef _N8_TIME_H
54 #define _N8_TIME_H
56 #include "n8_pub_types.h"
57 #include "n8_pub_errors.h"
59 /*****************************************************************************
60 * #defines
61 *****************************************************************************/
63 #define N8_MICROSECS_IN_SECOND 1000000
65 /*****************************************************************************
66 * Structures/type definitions
67 *****************************************************************************/
69 typedef struct
71 uint32_t tv_sec; /* Seconds. */
72 uint32_t tv_usec; /* Microseconds. */
73 } n8_timeval_t;
76 /*****************************************************************************
77 * Function prototypes
78 *****************************************************************************/
80 /* Get current timeval */
81 N8_Status_t
82 n8_gettime( n8_timeval_t *n8_timeResults );
84 /* Get seconds from timeval */
85 uint32_t
86 n8_timesecs( n8_timeval_t *n8_timeResults );
88 /* Get microseconds from timeval */
89 uint32_t
90 n8_timeusecs( n8_timeval_t *n8_timeResults );
92 /* Subtract two n8_timevals, n8_timeResults = n8_time2 - n8_time1 */
93 N8_Status_t
94 n8_subtime( n8_timeval_t *n8_timeResults,
95 n8_timeval_t *n8_time2,
96 n8_timeval_t *n8_time1 );
98 /* Add two n8_timevals, n8_timeResults = n8_time2 + n8_time1 */
99 N8_Status_t
100 n8_addtime( n8_timeval_t *n8_timeResults,
101 n8_timeval_t *n8_time2,
102 n8_timeval_t *n8_time1 );
104 /* Sleep usec seconds. */
105 N8_Status_t
106 n8_usleep(unsigned int usecs);
108 #if 0
109 /* Sleep milliseconds. */
110 N8_Status_t
111 n8_delay_ms(unsigned int milliseconds);
112 #endif
114 #endif