Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Committer:
mikl_andre
Date:
Fri Sep 02 10:07:12 2016 +0000
Revision:
48:950406be9810
Parent:
46:665391110051
Child:
49:81d5bddb02f0
Fixed some comments;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jeej 43:28202405094d 1 #ifndef _D7A_H_
Jeej 43:28202405094d 2 #define _D7A_H_
Jeej 43:28202405094d 3
Jeej 43:28202405094d 4 #include "d7a_common.h"
Jeej 43:28202405094d 5
Jeej 43:28202405094d 6
Jeej 43:28202405094d 7 //======================================================================
Jeej 43:28202405094d 8 // Defines
Jeej 43:28202405094d 9 //======================================================================
Jeej 43:28202405094d 10
Jeej 43:28202405094d 11 #define D7A_UID_LEN (8)
Jeej 43:28202405094d 12
Jeej 43:28202405094d 13
Jeej 43:28202405094d 14 //======================================================================
Jeej 43:28202405094d 15 // Enums
Jeej 43:28202405094d 16 //======================================================================
Jeej 43:28202405094d 17
Jeej 43:28202405094d 18 //======================================================================
Jeej 43:28202405094d 19 // d7a_fs_storage_t
Jeej 43:28202405094d 20 //----------------------------------------------------------------------
Jeej 43:28202405094d 21 /// File "Storage Class"
Jeej 43:28202405094d 22 //======================================================================
Jeej 43:28202405094d 23 typedef enum {
Jeej 43:28202405094d 24 /// No data is keeped. Can only write in it.
Jeej 43:28202405094d 25 /// Ex: Use for commands.
Jeej 43:28202405094d 26 TRANSIENT = 0,
Jeej 43:28202405094d 27 /// Data is stocked in RAM and initialized at 0.
Jeej 43:28202405094d 28 /// Can not guarantee data integrity over time.
Jeej 43:28202405094d 29 /// Ex: Use for often updated data.
Jeej 43:28202405094d 30 VOLATILE,
Jeej 43:28202405094d 31 /// Data is stocked in RAM and initialized with the last flushed data from EEPROM.
Jeej 43:28202405094d 32 /// Can not guarantee data integrity over time.
Jeej 43:28202405094d 33 /// Ex: Use for temporary configurations.
Jeej 43:28202405094d 34 RESTORABLE,
Jeej 43:28202405094d 35 /// Data is stoked in EEPROM.
Jeej 43:28202405094d 36 /// Data integrity is guaranteed.
Jeej 43:28202405094d 37 /// Ex: Use for important configurations.
Jeej 43:28202405094d 38 /// /!\ Use sparingly as operations on these type of files are time and ressource consuming
Jeej 43:28202405094d 39 PERMANENT
Jeej 43:28202405094d 40 } d7a_fs_storage_t;
Jeej 43:28202405094d 41
Jeej 43:28202405094d 42 //======================================================================
Jeej 43:28202405094d 43 // d7a_fs_perm_t
Jeej 43:28202405094d 44 //----------------------------------------------------------------------
Jeej 43:28202405094d 45 /// File permissions for USER/GUEST
Jeej 43:28202405094d 46 //======================================================================
Jeej 43:28202405094d 47 typedef enum {
Jeej 43:28202405094d 48 O_O = 0b00000000,
Jeej 43:28202405094d 49 R_O = 0b00100000,
Jeej 43:28202405094d 50 R_R = 0b00100100,
Jeej 43:28202405094d 51 W_O = 0b00010000,
Jeej 43:28202405094d 52 W_W = 0b00010010,
Jeej 43:28202405094d 53 RW_O = 0b00110000,
Jeej 43:28202405094d 54 RW_R = 0b00110100,
Jeej 43:28202405094d 55 RW_W = 0b00110010,
Jeej 43:28202405094d 56 RW_RW = 0b00110110,
Jeej 43:28202405094d 57 RWX_O = 0b00111000,
Jeej 43:28202405094d 58 RWX_RWX = 0b00111111,
Jeej 43:28202405094d 59 } d7a_fs_perm_t;
Jeej 43:28202405094d 60
Jeej 43:28202405094d 61 // =======================================================================
Jeej 43:28202405094d 62 // d7a_nls_t
Jeej 43:28202405094d 63 // -----------------------------------------------------------------------
Jeej 43:28202405094d 64 /// Enumerator of the NWL security modes
Jeej 43:28202405094d 65 // =======================================================================
Jeej 43:28202405094d 66 typedef enum
Jeej 43:28202405094d 67 {
Jeej 43:28202405094d 68 /// No security enabled
Jeej 43:28202405094d 69 D7A_NLS_NO = 0,
Jeej 43:28202405094d 70 /// Encryption only, Counter Mode
Jeej 43:28202405094d 71 D7A_NLS_AES_CTR,
Jeej 43:28202405094d 72 /// No encryption, Authentication, Cipher-block chaining with 128 bit MAC
Jeej 43:28202405094d 73 D7A_NLS_AES_CBC_MAC_128,
Jeej 43:28202405094d 74 /// No encryption, Authentication, Cipher-block chaining with 64 bit MAC
Jeej 43:28202405094d 75 D7A_NLS_AES_CBC_MAC_64,
Jeej 43:28202405094d 76 /// No encryption, Authentication, Cipher-block chaining with 32 bit MAC
Jeej 43:28202405094d 77 D7A_NLS_AES_CBC_MAC_32,
Jeej 43:28202405094d 78 /// Authentication with CBC-MAC-128 and Encryption with Counter Mode
Jeej 43:28202405094d 79 D7A_NLS_AES_CCM_128,
Jeej 43:28202405094d 80 /// Authentication with CBC-MAC-64 and Encryption with Counter Mode
Jeej 43:28202405094d 81 D7A_NLS_AES_CCM_64,
Jeej 43:28202405094d 82 /// Authentication with CBC-MAC-32 and Encryption with Counter Mode
Jeej 43:28202405094d 83 D7A_NLS_AES_CCM_32,
Jeej 43:28202405094d 84 /// QTY
Jeej 43:28202405094d 85 D7A_NLS_QTY
Jeej 43:28202405094d 86
Jeej 43:28202405094d 87 } d7a_nls_t;
Jeej 43:28202405094d 88
Jeej 43:28202405094d 89
Jeej 45:b85384e7d825 90 // Mimic ALP Errors
Jeej 45:b85384e7d825 91 typedef enum
Jeej 45:b85384e7d825 92 {
Jeej 45:b85384e7d825 93 D7A_ERR_ITF_FULL = 2, // 0x02: For interfaces supporting buffering, indicates buffer reached maximum capacity (no data loss)
Jeej 45:b85384e7d825 94 D7A_ERR_PARTIAL_COMPLETION = 1, // 0x01: Action received and partially completed at response. To be completed after response
Jeej 45:b85384e7d825 95
Jeej 45:b85384e7d825 96 D7A_ERR_NONE = 0, // 0x00: Action completed (OK)
Jeej 45:b85384e7d825 97 D7A_ERR_FILE_NOT_FOUND = -1, // 0xFF: Error access file: File ID does not exist
Jeej 45:b85384e7d825 98 D7A_ERR_FILE_EXIST = -2, // 0xFE: Error create file: File ID already exists
Jeej 45:b85384e7d825 99 D7A_ERR_FILE_NOT_RESTORABLE = -3, // 0xFD: Error restore file: File is not restorable
Jeej 45:b85384e7d825 100 D7A_ERR_PERMISSION_DENIED = -4, // 0xFC: Error access file: Insufficient permissions
Jeej 45:b85384e7d825 101 D7A_ERR_LENGTH_OVERFLOW = -5, // 0xFB: Error create file: Supplied length (in header) is beyond file limits
Jeej 45:b85384e7d825 102 D7A_ERR_ALLOC_OVERFLOW = -6, // 0xFA: Error create file: Supplied allocation (in header) is beyond file limits
Jeej 45:b85384e7d825 103 D7A_ERR_OFFSET_OVERFLOW = -7, // 0xF9: Error write: Supplied start offset is out of bounds of file allocation
Jeej 45:b85384e7d825 104 D7A_ERR_WRITE_OVERFLOW = -8, // 0xF8: Error complete write: Supplied data goes beyond file allocation
Jeej 45:b85384e7d825 105 D7A_ERR_WRITE_ERROR = -9, // 0xF7: Error write: impossible to write in storage location
Jeej 45:b85384e7d825 106 D7A_ERR_OPERATION_UNKNOWN = -10,// 0xF6: Error unknown Operation
Jeej 45:b85384e7d825 107 D7A_ERR_OPERAND_INCOMPLETE = -11,// 0xF5: Error incomplete Operand
Jeej 45:b85384e7d825 108 D7A_ERR_OPERAND_WRONG_FORMAT = -12,// 0xF4: Error wrong Operand format
Jeej 45:b85384e7d825 109 D7A_ERR_ITF_INVALID = -13,// 0xF3: Error invalid interface
Jeej 45:b85384e7d825 110 D7A_ERR_ITF_OVERFLOW = -14,// 0xF2: Error interface overflown (i.e. ressources exhausted, buffer full with data discarded)
Jeej 45:b85384e7d825 111 D7A_ERR_QUERY_FAIL = -15,// 0xF1: (Group of) Query result was false (Informative error code).
Jeej 45:b85384e7d825 112
Jeej 45:b85384e7d825 113 D7A_ERR_UNKNOWN = -128,// 0x80: Unknown error
Jeej 45:b85384e7d825 114 D7A_ERR_FS_TIMEOUT, // 0x81: Internal FS Error
Jeej 45:b85384e7d825 115 D7A_ERR_ITF_UNKNOWN, // 0x82: Unknown Interface
Jeej 45:b85384e7d825 116
Jeej 45:b85384e7d825 117 // Modem errors
Jeej 45:b85384e7d825 118 D7A_ERR_NOT_READY ,// The modem is not ready to recieve commands
Jeej 45:b85384e7d825 119 D7A_ERR_COM_LINK ,// A serial link timeout occured
Jeej 45:b85384e7d825 120 D7A_ERR_ILLEGAL_FID ,// The FID specified is illegal
Jeej 45:b85384e7d825 121 D7A_ERR_ILLEGAL_FILE_DEF ,// The FILE parameters specified are illegal
Jeej 45:b85384e7d825 122 D7A_ERR_CMD_TO ,// The command expired
Jeej 45:b85384e7d825 123 D7A_ERR_TX_FAILED ,// Transmission failed
Jeej 45:b85384e7d825 124
Jeej 45:b85384e7d825 125
Jeej 45:b85384e7d825 126 } d7a_errors_t;
Jeej 45:b85384e7d825 127
Jeej 46:665391110051 128 // Types of retry policies
Jeej 46:665391110051 129 typedef enum {
Jeej 46:665391110051 130 ALP_RPOL_ONESHOT = 0,
Jeej 46:665391110051 131 ALP_RPOL_SINGLE = 1,
Jeej 46:665391110051 132 ALP_RPOL_REPORT = 2,
Jeej 46:665391110051 133 ALP_RPOL_REPORT_CHECKED = 3,
Jeej 46:665391110051 134 ALP_RPOL_BULK = 4,
Jeej 46:665391110051 135 ALP_RPOL_SPARE_1 = 5,
Jeej 46:665391110051 136 ALP_RPOL_SPARE_2 = 6,
Jeej 46:665391110051 137 ALP_RPOL_SPARE_3 = 7,
Jeej 46:665391110051 138
Jeej 46:665391110051 139 ALP_RPOL_QTY,
Jeej 46:665391110051 140 } alp_rpol_t;
Jeej 45:b85384e7d825 141
Jeej 43:28202405094d 142 //======================================================================
Jeej 43:28202405094d 143 // Structures
Jeej 43:28202405094d 144 //======================================================================
Jeej 43:28202405094d 145
Jeej 43:28202405094d 146 //======================================================================
Jeej 43:28202405094d 147 // d7a_com_config_t
Jeej 43:28202405094d 148 //----------------------------------------------------------------------
Jeej 43:28202405094d 149 /// Com port configuration structure
Jeej 43:28202405094d 150 //======================================================================
Jeej 43:28202405094d 151 typedef struct {
Jeej 43:28202405094d 152 /// Tx pin
Jeej 43:28202405094d 153 PinName tx;
Jeej 43:28202405094d 154 /// RX pin
Jeej 43:28202405094d 155 PinName rx;
Jeej 43:28202405094d 156 /// WKUP pin
Jeej 43:28202405094d 157 PinName rts;
Jeej 43:28202405094d 158 /// HST_WKUP pin
Jeej 43:28202405094d 159 PinName cts;
Jeej 43:28202405094d 160 /// Size of RX buffer
Jeej 43:28202405094d 161 uint16_t rx_buffer_size;
Jeej 43:28202405094d 162 } d7a_com_config_t;
Jeej 43:28202405094d 163
Jeej 43:28202405094d 164 typedef uint32_t (*WriteFileFunction)( const uint8_t file_id,
Jeej 43:28202405094d 165 const uint16_t offset,
Jeej 43:28202405094d 166 const uint16_t size,
Jeej 43:28202405094d 167 const uint8_t* const content);
Jeej 43:28202405094d 168
Jeej 43:28202405094d 169 typedef uint32_t (*ReadFileFunction)( const uint8_t file_id,
Jeej 43:28202405094d 170 const uint16_t offset,
Jeej 43:28202405094d 171 const uint16_t size,
Jeej 43:28202405094d 172 uint8_t* buf);
Jeej 43:28202405094d 173
Jeej 46:665391110051 174 typedef void (*NotifDoneFunction)( const uint8_t file_id,
Jeej 46:665391110051 175 const uint8_t error);
Jeej 46:665391110051 176
Jeej 43:28202405094d 177 //======================================================================
Jeej 43:28202405094d 178 // d7a_fs_callbacks_t
Jeej 43:28202405094d 179 //----------------------------------------------------------------------
Jeej 43:28202405094d 180 /// File system callbacks
Jeej 43:28202405094d 181 //======================================================================
Jeej 43:28202405094d 182 typedef struct {
Jeej 43:28202405094d 183 /// Write in local file
Jeej 43:28202405094d 184 WriteFileFunction write_file;
Jeej 43:28202405094d 185 /// Read from local file
Jeej 43:28202405094d 186 ReadFileFunction read_file;
Jeej 46:665391110051 187 /// Is call when the notification is finished if indicated in the retry policy
Jeej 46:665391110051 188 NotifDoneFunction notif_done;
Jeej 43:28202405094d 189 } d7a_fs_callbacks_t;
Jeej 43:28202405094d 190
Jeej 43:28202405094d 191 //======================================================================
Jeej 43:28202405094d 192 // fw_version_t
Jeej 43:28202405094d 193 //----------------------------------------------------------------------
Jeej 43:28202405094d 194 /// Firmware version Structure
Jeej 43:28202405094d 195 /// Used within the revision structure
Jeej 43:28202405094d 196 //======================================================================
Jeej 43:28202405094d 197 TYPEDEF_STRUCT_PACKED
Jeej 43:28202405094d 198 {
Jeej 43:28202405094d 199 /// Software identifier
Jeej 43:28202405094d 200 uint8_t id;
Jeej 43:28202405094d 201 /// Version major
Jeej 43:28202405094d 202 uint8_t major;
Jeej 43:28202405094d 203 /// Version minor
Jeej 43:28202405094d 204 uint8_t minor;
Jeej 43:28202405094d 205 /// Version patch
Jeej 43:28202405094d 206 uint16_t patch;
Jeej 43:28202405094d 207 /// Version hash
Jeej 43:28202405094d 208 uint32_t hash;
Jeej 43:28202405094d 209 } fw_version_t;
Jeej 43:28202405094d 210
Jeej 43:28202405094d 211 //======================================================================
Jeej 43:28202405094d 212 // d7a_revision_t
Jeej 43:28202405094d 213 //----------------------------------------------------------------------
Jeej 43:28202405094d 214 /// Revision Structure
Jeej 43:28202405094d 215 ///
Jeej 43:28202405094d 216 /// Usage within D7B server:
Jeej 43:28202405094d 217 /// An XML describing the File system of a device is associated to a
Jeej 43:28202405094d 218 /// couple manufacturer_id/device_id (==Device).
Jeej 43:28202405094d 219 /// Different versions of the Device's XML can exist and can be mapped
Jeej 43:28202405094d 220 /// according to fw_version id/major/minor
Jeej 43:28202405094d 221 //======================================================================
Jeej 43:28202405094d 222 TYPEDEF_STRUCT_PACKED
Jeej 43:28202405094d 223 {
Jeej 43:28202405094d 224 /// Manufacturer ID: provided by Wizzilab
Jeej 43:28202405094d 225 // comes from: here
Jeej 43:28202405094d 226 uint32_t manufacturer_id;
Jeej 43:28202405094d 227 /// Device ID: Arbitrary number, at user/customer choice
Jeej 43:28202405094d 228 // comes from: application
Jeej 43:28202405094d 229 uint32_t device_id;
Jeej 43:28202405094d 230 /// Hardware Board ID:
Jeej 43:28202405094d 231 // comes from: board definition
Jeej 43:28202405094d 232 uint32_t hw_version;
Jeej 43:28202405094d 233 /// Firmware Version: made of
Jeej 43:28202405094d 234 /// - major,minor and patch indexes : comes from versioning tool
Jeej 43:28202405094d 235 /// - fw_id : "build-flavour" : comes from build setup
Jeej 43:28202405094d 236 /// FW_ID | MAJOR | MINOR | PATCH | HASH |
Jeej 43:28202405094d 237 /// 1B | 1B | 1B | 2B | 4B |
Jeej 43:28202405094d 238 fw_version_t fw_version;
Jeej 43:28202405094d 239 /// "file-system" signature XXX: to be worked out
Jeej 43:28202405094d 240 // comes from: application
Jeej 43:28202405094d 241 uint32_t fs_crc;
Jeej 43:28202405094d 242 } d7a_revision_t;
Jeej 43:28202405094d 243
Jeej 43:28202405094d 244
Jeej 43:28202405094d 245 // =======================================================================
Jeej 43:28202405094d 246 // d7a_addressee_ctrl_t
Jeej 43:28202405094d 247 // -----------------------------------------------------------------------
Jeej 43:28202405094d 248 /// Bitfield structure of the Addressee control byte
Jeej 43:28202405094d 249 // =======================================================================
Jeej 43:28202405094d 250 typedef union
Jeej 43:28202405094d 251 {
Jeej 43:28202405094d 252 // bit access fields
Jeej 43:28202405094d 253 struct {
Jeej 43:28202405094d 254 /// Network security method
Jeej 43:28202405094d 255 uint8_t nls : 4;
Jeej 43:28202405094d 256 /// ID type
Jeej 43:28202405094d 257 uint8_t idf : 2;
Jeej 43:28202405094d 258 /// RFU
Jeej 43:28202405094d 259 uint8_t rfu_6 : 1;
Jeej 43:28202405094d 260 uint8_t rfu_7 : 1;
Jeej 43:28202405094d 261 } bf;
Jeej 43:28202405094d 262
Jeej 43:28202405094d 263 // byte access
Jeej 43:28202405094d 264 uint8_t byte;
Jeej 43:28202405094d 265
Jeej 43:28202405094d 266 } d7a_addressee_ctrl_t;
Jeej 43:28202405094d 267
Jeej 43:28202405094d 268 // =======================================================================
Jeej 43:28202405094d 269 // d7a_xcl_t
Jeej 43:28202405094d 270 // -----------------------------------------------------------------------
Jeej 43:28202405094d 271 /// Bitfield structure of the Addressee Access Class
Jeej 43:28202405094d 272 // =======================================================================
Jeej 43:28202405094d 273 typedef union
Jeej 43:28202405094d 274 {
Jeej 43:28202405094d 275 // bit access fields
Jeej 43:28202405094d 276 struct {
Jeej 43:28202405094d 277 /// Subclass mask
Jeej 43:28202405094d 278 uint8_t m : 4;
Jeej 43:28202405094d 279 /// Specifier
Jeej 43:28202405094d 280 uint8_t s : 4;
Jeej 43:28202405094d 281 } bf;
Jeej 43:28202405094d 282
Jeej 43:28202405094d 283 // byte access
Jeej 43:28202405094d 284 uint8_t byte;
Jeej 43:28202405094d 285
Jeej 43:28202405094d 286 } d7a_xcl_t;
Jeej 43:28202405094d 287
Jeej 43:28202405094d 288 // =======================================================================
Jeej 43:28202405094d 289 // d7a_addressee_t
Jeej 43:28202405094d 290 // -----------------------------------------------------------------------
Jeej 43:28202405094d 291 /// Structure of the D7ATP Addressee byte
Jeej 43:28202405094d 292 // =======================================================================
Jeej 43:28202405094d 293 TYPEDEF_STRUCT_PACKED
Jeej 43:28202405094d 294 {
Jeej 43:28202405094d 295 d7a_addressee_ctrl_t ctrl;
Jeej 43:28202405094d 296 d7a_xcl_t xcl;
Jeej 43:28202405094d 297 uint8_t id[D7A_UID_LEN];
Jeej 43:28202405094d 298
Jeej 43:28202405094d 299 } d7a_addressee_t;
Jeej 43:28202405094d 300
Jeej 43:28202405094d 301
Jeej 43:28202405094d 302 //======================================================================
Jeej 43:28202405094d 303 // Prototypes
Jeej 43:28202405094d 304 //======================================================================
Jeej 43:28202405094d 305
Jeej 43:28202405094d 306 //======================================================================
Jeej 43:28202405094d 307 // d7a_open
Jeej 43:28202405094d 308 //----------------------------------------------------------------------
Jeej 43:28202405094d 309 /// @brief Open D7A driver and start the modem
Jeej 43:28202405094d 310 /// @param d7a_com_config_t* Com port configuration structure
Jeej 43:28202405094d 311 /// @param PinName Reset pin
Jeej 43:28202405094d 312 /// @param d7a_fs_callbacks_t* File system callbacks (You cannot use local files if this is not specified)
Jeej 45:b85384e7d825 313 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 314 //======================================================================
Jeej 45:b85384e7d825 315 d7a_errors_t d7a_open(const d7a_com_config_t* com_config, PinName reset_pin = NC, const d7a_fs_callbacks_t* fs_callbacks = NULL);
Jeej 43:28202405094d 316
Jeej 43:28202405094d 317 //======================================================================
Jeej 43:28202405094d 318 // d7a_close
Jeej 43:28202405094d 319 //----------------------------------------------------------------------
Jeej 43:28202405094d 320 /// @brief Close D7A driver and stop the modem
Jeej 45:b85384e7d825 321 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 322 //======================================================================
Jeej 45:b85384e7d825 323 d7a_errors_t d7a_close(void);
Jeej 43:28202405094d 324
Jeej 43:28202405094d 325 //======================================================================
Jeej 43:28202405094d 326 // d7a_start
Jeej 43:28202405094d 327 //----------------------------------------------------------------------
Jeej 43:28202405094d 328 /// @brief Start the modem
Jeej 45:b85384e7d825 329 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 330 //======================================================================
Jeej 45:b85384e7d825 331 d7a_errors_t d7a_start(void);
Jeej 43:28202405094d 332
Jeej 43:28202405094d 333 //======================================================================
Jeej 43:28202405094d 334 // d7a_stop
Jeej 43:28202405094d 335 //----------------------------------------------------------------------
Jeej 43:28202405094d 336 /// @brief Stop the modem (goes to low power)
Jeej 45:b85384e7d825 337 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 338 //======================================================================
Jeej 45:b85384e7d825 339 d7a_errors_t d7a_stop(void);
Jeej 43:28202405094d 340
Jeej 43:28202405094d 341 //======================================================================
Jeej 43:28202405094d 342 // d7a_create
Jeej 43:28202405094d 343 //----------------------------------------------------------------------
Jeej 43:28202405094d 344 /// @brief Creates a file on the modem
Jeej 43:28202405094d 345 /// @param d7a_fs_storage_t Type of file
Jeej 43:28202405094d 346 /// @param uint8_t Access permissions
Jeej 43:28202405094d 347 /// @param uint32_t Length of the created file
Jeej 43:28202405094d 348 /// @param uint32_t Maximum size of the file
Jeej 43:28202405094d 349 /// @param uint8_t File ID to an eventual Action file
Jeej 43:28202405094d 350 /// @param uint8_t File ID to an eventual Interface file
Jeej 45:b85384e7d825 351 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 352 //======================================================================
Jeej 45:b85384e7d825 353 d7a_errors_t d7a_create(const uint8_t file_id, d7a_fs_storage_t prop, d7a_fs_perm_t perm, uint32_t size, uint32_t alloc, uint8_t action_file = 0, uint8_t interface = 0);
Jeej 43:28202405094d 354
Jeej 43:28202405094d 355 //======================================================================
Jeej 43:28202405094d 356 // d7a_declare
Jeej 43:28202405094d 357 //----------------------------------------------------------------------
mikl_andre 48:950406be9810 358 /// @brief Declare a file stored on the host to the modem (need to have implemented the fs_callbacks)
Jeej 43:28202405094d 359 /// @param uint8_t File ID of file to declare
Jeej 43:28202405094d 360 /// @param d7a_fs_storage_t Type of file
Jeej 43:28202405094d 361 /// @param uint8_t Access permissions
Jeej 43:28202405094d 362 /// @param uint32_t Length of the created file
Jeej 43:28202405094d 363 /// @param uint32_t Maximum size of the file
Jeej 43:28202405094d 364 /// @param uint8_t File ID to an eventual Action file
Jeej 43:28202405094d 365 /// @param uint8_t File ID to an eventual Interface file
Jeej 45:b85384e7d825 366 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 367 //======================================================================
Jeej 45:b85384e7d825 368 d7a_errors_t d7a_declare(const uint8_t file_id, d7a_fs_storage_t prop, d7a_fs_perm_t perm, uint32_t size, uint32_t alloc, uint8_t action_file = 0, uint8_t interface = 0);
Jeej 43:28202405094d 369
Jeej 43:28202405094d 370 //======================================================================
Jeej 43:28202405094d 371 // d7a_read
Jeej 43:28202405094d 372 //----------------------------------------------------------------------
Jeej 43:28202405094d 373 /// @brief Read data from a file
Jeej 43:28202405094d 374 /// @param uint8_t File ID of file to read
Jeej 43:28202405094d 375 /// @param uint32_t Offset from which to start reading
Jeej 43:28202405094d 376 /// @param uint32_t Size of data to read
Jeej 43:28202405094d 377 /// @param uint8_t* Buffer to retrieve data
Jeej 46:665391110051 378 /// @param d7a_addressee_t* Addressee to an eventual distant device
Jeej 46:665391110051 379 /// @param alp_rpol_t Index to the retry policy to use
Jeej 45:b85384e7d825 380 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 381 //======================================================================
Jeej 46:665391110051 382 d7a_errors_t d7a_read(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* buf, d7a_addressee_t* addressee = NULL, alp_rpol_t retry = ALP_RPOL_ONESHOT);
Jeej 43:28202405094d 383
Jeej 43:28202405094d 384 //======================================================================
Jeej 43:28202405094d 385 // d7a_write
Jeej 43:28202405094d 386 //----------------------------------------------------------------------
Jeej 43:28202405094d 387 /// @brief Write data to a file
Jeej 43:28202405094d 388 /// @param uint8_t File ID of file to write
Jeej 43:28202405094d 389 /// @param uint32_t Offset from which to start writing
Jeej 43:28202405094d 390 /// @param uint32_t Size of data to write
Jeej 43:28202405094d 391 /// @param uint8_t* Buffer of the data to write
Jeej 46:665391110051 392 /// @param d7a_addressee_t* Addressee to an eventual distant device
Jeej 46:665391110051 393 /// @param alp_rpol_t Index to the retry policy to use
Jeej 45:b85384e7d825 394 /// @return d7a_errors_t Error code
Jeej 43:28202405094d 395 //======================================================================
Jeej 46:665391110051 396 d7a_errors_t d7a_write(const uint8_t file_id, const uint32_t offset, const uint32_t size, const uint8_t* const buf, d7a_addressee_t* addressee = NULL, alp_rpol_t retry = ALP_RPOL_ONESHOT, bool resp = true);
Jeej 46:665391110051 397
Jeej 46:665391110051 398 //======================================================================
mikl_andre 48:950406be9810 399 // d7a_notify
Jeej 46:665391110051 400 //----------------------------------------------------------------------
Jeej 46:665391110051 401 /// @brief Write data to a file
Jeej 46:665391110051 402 /// @param uint8_t File ID of file to write
Jeej 46:665391110051 403 /// @param uint32_t Offset from which to start writing
Jeej 46:665391110051 404 /// @param uint32_t Size of data to write
Jeej 46:665391110051 405 /// @return d7a_errors_t Error code
Jeej 46:665391110051 406 //======================================================================
Jeej 46:665391110051 407 d7a_errors_t d7a_notify(const uint8_t file_id, const uint32_t offset, const uint32_t size);
Jeej 43:28202405094d 408
Jeej 43:28202405094d 409 #endif // _D7A_H_