Simulated product dispenser

Dependencies:   HTS221

Fork of mbed-cloud-workshop-connect-HTS221 by Jim Carver

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 FLASH_MINIMAL_PROG_UNIT 8
00050 
00051 #define DELETE_ITEM_FLAG        0x8000
00052 #define HEADER_FLAG_MASK        0xF000
00053 #define SOTP_MASTER_RECORD_TYPE 0x0FFE
00054 #define SOTP_NO_TYPE            0x0FFF
00055 
00056 #define MASTER_RECORD_BLANK_FIELD_SIZE FLASH_MINIMAL_PROG_UNIT
00057 
00058 
00059 typedef struct {
00060     uint16_t version;
00061     uint16_t format_rev;
00062     uint32_t reserved;
00063 } master_record_data_t __attribute__((aligned(4)));
00064 
00065 #define MASTER_RECORD_SIZE sizeof(master_record_data_t)
00066 
00067 palStatus_t sotp_flash_read_area(uint8_t area, uint32_t offset, uint32_t len_bytes, uint32_t *buf);
00068 palStatus_t sotp_flash_write_area(uint8_t area, uint32_t offset, uint32_t len_bytes, const uint32_t *buf);
00069 palStatus_t sotp_flash_erase_area(uint8_t area);
00070 
00071 #ifdef __cplusplus
00072 }
00073 #endif
00074 
00075 #endif