Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_uc_buffer_utilities.h Source File

arm_uc_buffer_utilities.h

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2016-2017 ARM Ltd.
00003 //
00004 // SPDX-License-Identifier: Apache-2.0
00005 //
00006 // Licensed under the Apache License, Version 2.0 (the "License");
00007 // you may not use this file except in compliance with the License.
00008 // You may obtain a copy of the License at
00009 //
00010 //     http://www.apache.org/licenses/LICENSE-2.0
00011 //
00012 // Unless required by applicable law or agreed to in writing, software
00013 // distributed under the License is distributed on an "AS IS" BASIS,
00014 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 // See the License for the specific language governing permissions and
00016 // limitations under the License.
00017 // ----------------------------------------------------------------------------
00018 
00019 #ifndef ARM_UPDATE_BUFFER_UTILITIES_H
00020 #define ARM_UPDATE_BUFFER_UTILITIES_H
00021 
00022 #include "update-client-common/arm_uc_types.h"
00023 #include "update-client-common/arm_uc_error.h"
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 
00030 /**
00031  * @brief Calculate CRC 32
00032  *
00033  * @param buffer Input array.
00034  * @param length Length of array in bytes.
00035  *
00036  * @return 32 bit CRC.
00037  */
00038 uint32_t arm_uc_crc32(const uint8_t *buffer, uint32_t length);
00039 
00040 /**
00041  * @brief Parse 4 byte array into uint32_t
00042  *
00043  * @param input 4 byte array.
00044  * @return uint32_t
00045  */
00046 uint32_t arm_uc_parse_uint32(const uint8_t *input);
00047 
00048 /**
00049  * @brief Parse 8 byte array into uint64_t
00050  *
00051  * @param input 8 byte array.
00052  * @return uint64_t
00053  */
00054 uint64_t arm_uc_parse_uint64(const uint8_t *input);
00055 
00056 /**
00057  * @brief Write uint32_t to array.
00058  *
00059  * @param buffer Pointer to buffer.
00060  * @param value Value to be written.
00061  */
00062 void arm_uc_write_uint32(uint8_t *buffer, uint32_t value);
00063 
00064 /**
00065  * @brief Write uint64_t to array.
00066  *
00067  * @param buffer Pointer to buffer.
00068  * @param value Value to be written.
00069  */
00070 void arm_uc_write_uint64(uint8_t *buffer, uint64_t value);
00071 
00072 
00073 uint32_t ARM_UC_BinCompareCT(const arm_uc_buffer_t *a, const arm_uc_buffer_t *b);
00074 
00075 #ifdef __cplusplus
00076 }
00077 #endif
00078 
00079 #endif // ARM_UPDATE_BUFFER_UTILITIES_H