Subversion Repositories Kolibri OS

Rev

Rev 9952 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9952 Rev 9954
Line 46... Line 46...
46
        uint8_t hour;
46
        uint8_t hour;
47
        uint8_t min;
47
        uint8_t min;
48
        uint8_t sec;
48
        uint8_t sec;
49
        uint8_t _zero;
49
        uint8_t _zero;
50
    };
50
    };
51
} ksys_time_t;
51
} ksys_time_bcd_t;
Line 52... Line 52...
52
 
52
 
53
typedef union {
53
typedef union {
54
    uint32_t val;
54
    uint32_t val;
55
    struct {
55
    struct {
56
        uint8_t year;
56
        uint8_t year;
57
        uint8_t month;
57
        uint8_t month;
58
        uint8_t day;
58
        uint8_t day;
59
        uint8_t _zero;
59
        uint8_t _zero;
60
    };
60
    };
Line 61... Line 61...
61
} ksys_date_t;
61
} ksys_date_bcd_t;
62
 
62
 
63
typedef union {
63
typedef union {
64
    uint32_t val;
64
    uint32_t val;
Line 91... Line 91...
91
                uint32_t debug;
91
                uint32_t debug;
92
                uint32_t offset;
92
                uint32_t offset;
93
            };
93
            };
94
            union {
94
            union {
95
                uint32_t flags;
95
                uint32_t flags;
-
 
96
                uint32_t enc_name;
96
                char* args;
97
                char* args;
97
            };
98
            };
98
        };
99
        };
99
    };
100
    };
100
    uint32_t data_size;
101
    uint32_t data_size;
Line 111... Line 112...
111
typedef struct {
112
typedef struct {
112
    uint32_t status;
113
    uint32_t status;
113
    uint32_t rw_bytes;
114
    uint32_t rw_bytes;
114
} ksys_file_status_t;
115
} ksys_file_status_t;
Line -... Line 116...
-
 
116
 
-
 
117
#define KSYS_FNAME_UTF8_SIZE 520
-
 
118
#define KSYS_FNAME_CP866_SIZE 264
-
 
119
 
-
 
120
typedef struct {
-
 
121
    uint8_t sec;
-
 
122
    uint8_t min;
-
 
123
    uint8_t hour;
-
 
124
    uint8_t _zero;
-
 
125
} ksys_ftime_t;
-
 
126
 
-
 
127
typedef struct {
-
 
128
    uint8_t day;
-
 
129
    uint8_t month;
-
 
130
    uint16_t year;
-
 
131
} ksys_fdate_t;
115
 
132
 
116
typedef struct {
133
typedef struct {
117
    uint32_t attr;
134
    uint32_t attr;
118
    uint32_t name_enc;
135
    uint32_t name_enc;
119
    ksys_time_t ctime;
136
    ksys_ftime_t ctime;
120
    ksys_date_t cdate;
137
    ksys_fdate_t cdate;
121
    ksys_time_t atime;
138
    ksys_ftime_t atime;
122
    ksys_date_t adate;
139
    ksys_fdate_t adate;
123
    ksys_time_t mtime;
140
    ksys_ftime_t mtime;
124
    ksys_date_t mdate;
141
    ksys_fdate_t mdate;
125
    uint64_t size;
142
    uint64_t size;
126
    char name[0];
143
    char name[0];
Line -... Line 144...
-
 
144
} ksys_file_info_t;
-
 
145
 
-
 
146
typedef struct  {
-
 
147
    uint32_t version;
-
 
148
    uint32_t blocks;
-
 
149
    uint32_t files;
-
 
150
    uint8_t  __reserved[20];
-
 
151
} ksys_dir_entry_header_t;
-
 
152
 
-
 
153
typedef struct {
-
 
154
    ksys_dir_entry_header_t header;
-
 
155
    ksys_file_info_t info;
127
} ksys_file_info_t;
156
} ksys_dir_entry_t;
Line 128... Line 157...
128
 
157
 
129
#define KSYS_THREAD_INFO_SIZE 1024
158
#define KSYS_THREAD_INFO_SIZE 1024
130
 
159
 
Line 422... Line 451...
422
    return val;
451
    return val;
423
}
452
}
Line 424... Line 453...
424
 
453
 
Line 425... Line 454...
425
/*==================== Function 3 - get system time. ===================*/
454
/*==================== Function 3 - get system time. ===================*/
426
 
455
 
427
KOSAPI ksys_time_t _ksys_get_time(void)
456
KOSAPI ksys_time_bcd_t _ksys_get_time(void)
428
{
457
{
429
    ksys_time_t c_time;
458
    ksys_time_bcd_t bcd_time;
430
    asm_inline(
459
    asm_inline(
431
        "int $0x40"
460
        "int $0x40"
432
        : "=a"(c_time)
461
        : "=a"(bcd_time)
433
        : "a"(3)
462
        : "a"(3)
434
        : "memory");
463
        : "memory");
Line 435... Line 464...
435
    return c_time;
464
    return bcd_time;
436
}
465
}
437
 
466
 
Line 864... Line 893...
864
    return val;
893
    return val;
865
}
894
}
Line 866... Line 895...
866
 
895
 
Line 867... Line 896...
867
/*=================== Function 29 - get system date. ===================*/
896
/*=================== Function 29 - get system date. ===================*/
868
 
897
 
869
KOSAPI ksys_date_t _ksys_get_date(void)
898
KOSAPI ksys_date_bcd_t _ksys_get_date(void)
870
{
899
{
871
    ksys_date_t val;
900
    ksys_date_bcd_t bcd_date;
872
    asm_inline(
901
    asm_inline(
873
        "int $0x40"
902
        "int $0x40"
874
        : "=a"(val)
903
        : "=a"(bcd_date)
875
        : "a"(29));
904
        : "a"(29));
Line 876... Line 905...
876
    return val;
905
    return bcd_date;
877
}
906
}
Line 1526... Line 1555...
1526
    f.zero = 0;
1555
    f.zero = 0;
1527
    f.path_ptr = (char*)name;
1556
    f.path_ptr = (char*)name;
1528
    return _ksys_file(&f);
1557
    return _ksys_file(&f);
1529
}
1558
}
Line -... Line 1559...
-
 
1559
 
-
 
1560
KOSAPI ksys_file_status_t _ksys_file_read_dir(const char* name, uint32_t offset,
-
 
1561
                                              uint32_t enc, uint32_t blocks, void* buff)
-
 
1562
{
-
 
1563
    ksys_file_t f;
-
 
1564
    f.func_num = KSYS_FILE_READ_DIR;
-
 
1565
    f.offset = offset;
-
 
1566
    f.enc_name = enc;
-
 
1567
    f.data_size = blocks;
-
 
1568
    f.data = buff;
-
 
1569
    f.zero = 0;
-
 
1570
    f.path_ptr = (char*)name;
-
 
1571
    return _ksys_file(&f);
-
 
1572
}
1530
 
1573
 
1531
/*===================== Function 70, subfunction 2 =====================*/
1574
/*===================== Function 70, subfunction 2 =====================*/
Line 1532... Line 1575...
1532
/*============ Create/rewrite file with long names support. ============*/
1575
/*============ Create/rewrite file with long names support. ============*/
1533
 
1576
 
Line 1572... Line 1615...
1572
    return _ksys_file(&f).status;
1615
    return _ksys_file(&f).status;
1573
}
1616
}
Line 1574... Line 1617...
1574
 
1617
 
Line -... Line 1618...
-
 
1618
/*========== Function 70, subfunction 5 - get information on file/folder. =====*/
-
 
1619
 
-
 
1620
enum KSYS_FILE_ATTR {
-
 
1621
    KSYS_FILE_ATTR_RO = 0x1,
-
 
1622
    KSYS_FILE_ATTR_HIDDEN = 0x2,
-
 
1623
    KSYS_FILE_ATTR_SYS = 0x4,
-
 
1624
    KSYS_FILE_ATTR_VOL_LABEL = 0x8,
-
 
1625
    KSYS_FILE_ATTR_DIR = 0x10,
-
 
1626
    KSYS_FILE_ATTR_ARCHIVE = 0x20
1575
/*========== Function 70, subfunction 5 - get information on file/folder. =====*/
1627
};
1576
 
1628
 
1577
KOSAPI int _ksys_file_info(const char* name, ksys_file_info_t* info)
1629
KOSAPI int _ksys_file_info(const char* name, ksys_file_info_t* info)
1578
{
1630
{
1579
    ksys_file_t f;
1631
    ksys_file_t f;
Line 1622... Line 1674...
1622
    f.zero = 0;
1674
    f.zero = 0;
1623
    f.path_ptr = (char*)path;
1675
    f.path_ptr = (char*)path;
1624
    return _ksys_file(&f).status;
1676
    return _ksys_file(&f).status;
1625
}
1677
}
Line -... Line 1678...
-
 
1678
 
-
 
1679
#define _ksys_rmdir(x) _ksys_file_delete(x)
1626
 
1680
 
Line 1627... Line 1681...
1627
/*============= Function 70, subfunction 9 - create folder. =============*/
1681
/*============= Function 70, subfunction 9 - create folder. =============*/
1628
 
1682
 
1629
KOSAPI int _ksys_mkdir(const char* path)
1683
KOSAPI int _ksys_mkdir(const char* path)