Exportable version of WizziLab's modem driver.

Dependents:   modem_ref_helper

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers kal_fs.h Source File

kal_fs.h

00001 /// @copyright
00002 /// ========================================================================={{{
00003 /// Copyright (c) 2012-2013 WizziLab                                           /
00004 /// All rights reserved                                                        /
00005 ///                                                                            /
00006 /// IMPORTANT: This Software may not be modified, copied or distributed unless /
00007 /// embedded on a WizziLab product. Other than for the foregoing purpose, this /
00008 /// Software and/or its documentation may not be used, reproduced, copied,     /
00009 /// prepared derivative works of, modified, performed, distributed, displayed  /
00010 /// or sold for any purpose. For the sole purpose of embedding this Software   /
00011 /// on a WizziLab product, copy, modification and distribution of this         /
00012 /// Software is granted provided that the following conditions are respected:  /
00013 ///                                                                            /
00014 /// *  Redistributions of source code must retain the above copyright notice,  /
00015 ///    this list of conditions and the following disclaimer                    /
00016 ///                                                                            /
00017 /// *  Redistributions in binary form must reproduce the above copyright       /
00018 ///    notice, this list of conditions and the following disclaimer in the     /
00019 ///    documentation and/or other materials provided with the distribution.    /
00020 ///                                                                            /
00021 /// *  The name of WizziLab can not be used to endorse or promote products     /
00022 ///    derived from this software without specific prior written permission.   /
00023 ///                                                                            /
00024 /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS        /
00025 /// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED  /
00026 /// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR /
00027 /// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR          /
00028 /// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,      /
00029 /// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,        /
00030 /// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,            /
00031 /// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY     /
00032 /// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING    /
00033 /// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS         /
00034 /// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.               /
00035 /// WIZZILAB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,       /
00036 /// ENHANCEMENTS OR MODIFICATIONS.                                             /
00037 ///                                                                            /
00038 /// Should you have any questions regarding your right to use this Software,   /
00039 /// contact WizziLab at www.wizzilab.com.                                      /
00040 ///                                                                            /
00041 /// =========================================================================}}}
00042 /// @endcopyright
00043 
00044 //  =======================================================================
00045 /// @file           kal_fs.c
00046 /// @brief          File-System header
00047 //  =======================================================================
00048 
00049 #ifndef __KAL_FS_H__
00050 #define __KAL_FS_H__
00051 
00052 // PROP Byte
00053 #define FS_BFO_STORAGE_CLASS    0
00054 #define FS_BFO_ACT_COND         4
00055 #define FS_BFO_ACT_EN           7
00056 #define FS_BFS_STORAGE_CLASS    2
00057 #define FS_BFM_STORAGE_CLASS    0x3
00058 #define FS_BFS_ACT_COND         3
00059 #define FS_BFM_ACT_COND         0x7
00060 #define FS_BFS_ACT_EN           1
00061 #define FS_BFM_ACT_EN           0x1
00062 
00063 // =======================================================================
00064 // kal_fs_perm_t
00065 // -----------------------------------------------------------------------
00066 /// Bitfield structure of PERM
00067 // =======================================================================
00068 typedef union
00069 {
00070     struct {
00071         /// Guest permissions
00072         u8 guest_x       : 1;
00073         u8 guest_w       : 1;
00074         u8 guest_r       : 1;
00075         /// User permissions
00076         u8 user_x        : 1;
00077         u8 user_w        : 1;
00078         u8 user_r        : 1;
00079         /// General permissions
00080         u8 writable      : 1;
00081         u8 readable      : 1;
00082     } bf;
00083 
00084     u8 byte;
00085 } kal_fs_perm_t;
00086 
00087 // PERM Byte
00088 #define FS_BFO_GUEST_X          0
00089 #define FS_BFO_GUEST_W          1
00090 #define FS_BFO_GUEST_R          2
00091 #define FS_BFO_USER_X           3
00092 #define FS_BFO_USER_W           4
00093 #define FS_BFO_USER_R           5
00094 #define FS_BFO_WRITABLE         6
00095 #define FS_BFO_READABLE         7
00096 #define FS_BFS_GUEST_X          1
00097 #define FS_BFS_GUEST_W          1
00098 #define FS_BFS_GUEST_R          1
00099 #define FS_BFS_USER_X           1
00100 #define FS_BFS_USER_W           1
00101 #define FS_BFS_USER_R           1
00102 #define FS_BFS_WRITABLE         1
00103 #define FS_BFS_READABLE         1
00104 
00105 enum { TRANSIENT=0, VOLATILE, RESTORABLE, PERMANENT};
00106 
00107 // "Piped" File: rd/wr are not stored but just sent on IF
00108 #define FS_TRANSIENT         (TRANSIENT  << FS_BFO_STORAGE_CLASS)
00109 // "RAM" File: rd/wr to a volatile buffer.
00110 #define FS_VOLATILE          (VOLATILE   << FS_BFO_STORAGE_CLASS)
00111 // "Mirrored" File: loaded from NVM, cached/used in RAM. Flushable to NVM.
00112 #define FS_RESTORABLE        (RESTORABLE << FS_BFO_STORAGE_CLASS)
00113 // "Normal" File: rd/wr from/to NVM
00114 #define FS_PERMANENT         (PERMANENT  << FS_BFO_STORAGE_CLASS)
00115 #define FS_ACT_COND(c)       ((c & 0x7) << FS_BFO_ACT_COND)
00116 #define FS_ACT_EN            (1  << FS_BFO_ACT_EN)
00117 
00118 // D7AactP Enabled File properties
00119 #if 0 // Condition is not used (nor usable)
00120     #define FS_TRANSIENT_NOTIF(c) (FS_TRANSIENT  | FS_ACT_EN | FS_ACT_COND(c))
00121     #define FS_VOLATILE_NOTIF(c)  (FS_VOLATILE   | FS_ACT_EN | FS_ACT_COND(c))
00122     #define FS_RESTORABLE_NOTIF(c)(FS_RESTORABLE | FS_ACT_EN | FS_ACT_COND(c))
00123     #define FS_PERMANENT_NOTIF(c) (FS_PERMANENT  | FS_ACT_EN | FS_ACT_COND(c))
00124 #else
00125     #define FS_TRANSIENT_NOTIF    (FS_TRANSIENT  | FS_ACT_EN)
00126     #define FS_VOLATILE_NOTIF     (FS_VOLATILE   | FS_ACT_EN)
00127     #define FS_RESTORABLE_NOTIF   (FS_RESTORABLE | FS_ACT_EN)
00128     #define FS_PERMANENT_NOTIF    (FS_PERMANENT  | FS_ACT_EN)
00129 #endif
00130 
00131 #define RWRWRW              0b11110110
00132 #define RWRWR_              0b11110100
00133 #define RWR_R_              0b11100100
00134 #define R_R_R_              0b10100100
00135 #define RWRW__              0b11110000
00136 #define RW_W__              0b11010000
00137 #define _W_W__              0b01010000
00138 #define RWR___              0b11100000
00139 #define RW____              0b11000000
00140 #define R_R___              0b10100000
00141 #define _W____              0b01000000
00142 #define R_____              0b10000000
00143 
00144 #define FS_GMASK_GUEST_X    FS_GUEST_X
00145 #define FS_GMASK_GUEST_W    FS_GUEST_W
00146 #define FS_GMASK_GUEST_R    FS_GUEST_R
00147 #define FS_GMASK_USER_X     (FS_GUEST_X+FS_USER_X)
00148 #define FS_GMASK_USER_W     (FS_GUEST_W+FS_USER_W)
00149 #define FS_GMASK_USER_R     (FS_GUEST_R+FS_USER_R)
00150 
00151 #endif // __KAL_FS_H__