• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _PORTING_H
2 #define _PORTING_H
3 
4 #include "los_mux.h"
5 #include "los_event.h"
6 #include "los_typedef.h"
7 #include "jffs2.h"
8 #ifdef __cplusplus
9 #if __cplusplus
10 extern "C" {
11 #endif /* __cplusplus */
12 #endif /* __cplusplus */
13 
14 /* the following should be same with os_sys_stat.h */
15 #define JFFS2_S_IFMT	 0x00000f000
16 #define JFFS2_S_IFDIR	 0040000
17 #define JFFS2_S_IFREG	 0100000
18 
19 struct jffs2_fs_info {
20 	unsigned long   sector_size; /* a erasing block size*/
21 	unsigned long   nr_blocks; /* number of blocks in flash */
22 	unsigned long   free_size; /* size of free flash */
23 };
24 
25 struct jffs2_stat {
26     unsigned long   st_mode;     /* File mode */
27     uint32_t        st_ino;      /* File serial number */
28     uint32_t        st_dev;      /* ID of device containing file */
29     unsigned long   st_nlink;    /* Number of hard links */
30     unsigned long   st_uid;      /* User ID of the file owner */
31     unsigned long   st_gid;      /* Group ID of the file's group */
32     long  st_size;        /* File size (regular files only) */
33     long  sddst_atime;    /* Last access time */
34     long  sddst_mtime;    /* Last data modification time */
35     long  sddst_ctime;    /* Last file status change time */
36 };
37 
38 extern cyg_fileops jffs2_fileops;
39 extern cyg_fileops jffs2_dirops;
40 extern struct cyg_fstab_entry jffs2_fste;
41 
42 time_t jffs2_get_timestamp(void);
43 void jffs2_get_info_from_sb(void *data, struct jffs2_fs_info *info);
44 
45 void jffs_mutex_take(LosMux *mutex, uint32_t time_out);
46 
47 void jffs_mutex_release(LosMux *mutex);
48 
49 void jffs_mutex_create(LosMux *mutex);
50 
51 void jffs_mutex_delete(LosMux *mutex);
52 void jffs_event_create(PEVENT_CB_S event_CB);
53 void jffs_event_send(PEVENT_CB_S event_CB, uint32_t events);
54 uint32_t jffs_event_recv(PEVENT_CB_S event_CB, uint32_t event_mask, uint32_t mode, uint32_t time_out);
55 void jffs_event_detach(PEVENT_CB_S event_CB);
56 void jffs_lock(void);
57 void jffs_unlock(void);
58 
59 #ifdef __cplusplus
60 #if __cplusplus
61 }
62 #endif /* __cplusplus */
63 #endif /* __cplusplus */
64 
65 #endif
66