leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sotp_int.h Source File

sotp_int.h

00001 /*
00002  * Copyright (c) 2016 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 
00018 #ifndef __SOTP_INT_H
00019 #define __SOTP_INT_H
00020 
00021 #include <stdint.h>
00022 #include "mbed-trace/mbed_trace.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 #define TRACE_GROUP                     "sotp"
00029 
00030 #ifdef ESFS_INTERACTIVE_TEST
00031 #define STATIC
00032 #define PR_ERR printf
00033 #define PR_INFO printf
00034 #define PR_DEBUG printf
00035 #else
00036 #define STATIC static
00037 #define PR_ERR tr_err
00038 #define PR_INFO tr_info
00039 #define PR_DEBUG tr_debug
00040 #endif
00041 
00042 
00043 typedef struct {
00044     uint16_t type_and_flags;
00045     uint16_t length;
00046     uint32_t mac;
00047 } record_header_t __attribute__((aligned(4)));
00048 
00049 #define DELETE_ITEM_FLAG        0x8000
00050 #define HEADER_FLAG_MASK        0xF000
00051 #define SOTP_MASTER_RECORD_TYPE 0x0FFE
00052 #define SOTP_NO_TYPE            0x0FFF
00053 
00054 typedef struct {
00055     uint16_t version;
00056     uint16_t format_rev;
00057     uint32_t reserved;
00058 } master_record_data_t __attribute__((aligned(4)));
00059 
00060 #define MASTER_RECORD_SIZE sizeof(master_record_data_t)
00061 
00062 palStatus_t sotp_flash_read_area(uint8_t area, uint32_t offset, uint32_t len_bytes, uint32_t *buf);
00063 palStatus_t sotp_flash_write_area(uint8_t area, uint32_t offset, uint32_t len_bytes, const uint32_t *buf);
00064 palStatus_t sotp_flash_erase_area(uint8_t area);
00065 
00066 #ifdef __cplusplus
00067 }
00068 #endif
00069 
00070 #endif