1 /*             ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
2  *
3  *                 Copyright (c) 2014-2015 Datalight, Inc.
4  *                     All Rights Reserved Worldwide.
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; use version 2 of the License.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
12  *  of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License along
16  *  with this program; if not, write to the Free Software Foundation, Inc.,
17  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 /*  Businesses and individuals that for commercial or other reasons cannot
21  *  comply with the terms of the GPLv2 license may obtain a commercial license
22  *  before incorporating Reliance Edge into proprietary software for
23  *  distribution in any form.  Visit http://www.datalight.com/reliance-edge for
24  *  more information.
25  */
26 
27 /** @file
28  */
29 #ifndef REDOSSERV_H
30 #define REDOSSERV_H
31 
32 
33 #include <redostypes.h>
34 
35 
36 /** @brief Type of access requested when opening a block device.
37  */
38 typedef enum
39 {
40     BDEV_O_RDONLY, /**< Open block device for read access. */
41     BDEV_O_WRONLY, /**< Open block device for write access. */
42     BDEV_O_RDWR    /**< Open block device for read and write access. */
43 } BDEVOPENMODE;
44 
45 REDSTATUS RedOsBDevOpen( uint8_t bVolNum,
46                          BDEVOPENMODE mode );
47 REDSTATUS RedOsBDevClose( uint8_t bVolNum );
48 REDSTATUS RedOsBDevRead( uint8_t bVolNum,
49                          uint64_t ullSectorStart,
50                          uint32_t ulSectorCount,
51                          void * pBuffer );
52 
53 #if REDCONF_READ_ONLY == 0
54     REDSTATUS RedOsBDevWrite( uint8_t bVolNum,
55                               uint64_t ullSectorStart,
56                               uint32_t ulSectorCount,
57                               const void * pBuffer );
58     REDSTATUS RedOsBDevFlush( uint8_t bVolNum );
59 #endif
60 
61 /*  Non-standard API: for host machines only.
62  */
63 REDSTATUS RedOsBDevConfig( uint8_t bVolNum,
64                            const char * pszBDevSpec );
65 
66 
67 #if REDCONF_TASK_COUNT > 1U
68     REDSTATUS RedOsMutexInit( void );
69     REDSTATUS RedOsMutexUninit( void );
70     void RedOsMutexAcquire( void );
71     void RedOsMutexRelease( void );
72 #endif
73 #if ( REDCONF_TASK_COUNT > 1U ) && ( REDCONF_API_POSIX == 1 )
74     uint32_t RedOsTaskId( void );
75 #endif
76 
77 REDSTATUS RedOsClockInit( void );
78 REDSTATUS RedOsClockUninit( void );
79 uint32_t RedOsClockGetTime( void );
80 
81 REDSTATUS RedOsTimestampInit( void );
82 REDSTATUS RedOsTimestampUninit( void );
83 REDTIMESTAMP RedOsTimestamp( void );
84 uint64_t RedOsTimePassed( REDTIMESTAMP tsSince );
85 
86 #if REDCONF_OUTPUT == 1
87     void RedOsOutputString( const char * pszString );
88 #endif
89 
90 #if REDCONF_ASSERTS == 1
91     void RedOsAssertFail( const char * pszFileName,
92                           uint32_t ulLineNum );
93 #endif
94 
95 
96 #endif /* ifndef REDOSSERV_H */
97