Dependencies: DM_FATFileSystem EthernetInterface HTTPClient mbed-rtos mbed-src
Fork of DMSupport by
crc.h@42:39e97a2ea6be, 2016-06-02 (annotated)
- Committer:
- destinyXfate
- Date:
- Thu Jun 02 05:03:52 2016 +0000
- Revision:
- 42:39e97a2ea6be
- Parent:
- 11:dedcebcfc869
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 11:dedcebcfc869 | 1 | /* |
embeddedartists | 11:dedcebcfc869 | 2 | * Copyright 2014 Embedded Artists AB |
embeddedartists | 11:dedcebcfc869 | 3 | * |
embeddedartists | 11:dedcebcfc869 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
embeddedartists | 11:dedcebcfc869 | 5 | * you may not use this file except in compliance with the License. |
embeddedartists | 11:dedcebcfc869 | 6 | * You may obtain a copy of the License at |
embeddedartists | 11:dedcebcfc869 | 7 | * |
embeddedartists | 11:dedcebcfc869 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
embeddedartists | 11:dedcebcfc869 | 9 | * |
embeddedartists | 11:dedcebcfc869 | 10 | * Unless required by applicable law or agreed to in writing, software |
embeddedartists | 11:dedcebcfc869 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
embeddedartists | 11:dedcebcfc869 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
embeddedartists | 11:dedcebcfc869 | 13 | * See the License for the specific language governing permissions and |
embeddedartists | 11:dedcebcfc869 | 14 | * limitations under the License. |
embeddedartists | 11:dedcebcfc869 | 15 | */ |
embeddedartists | 11:dedcebcfc869 | 16 | |
embeddedartists | 11:dedcebcfc869 | 17 | #ifndef __CRC_H |
embeddedartists | 11:dedcebcfc869 | 18 | #define __CRC_H |
embeddedartists | 11:dedcebcfc869 | 19 | |
embeddedartists | 11:dedcebcfc869 | 20 | #include <stdio.h> |
embeddedartists | 11:dedcebcfc869 | 21 | #include <stdint.h> |
embeddedartists | 11:dedcebcfc869 | 22 | |
embeddedartists | 11:dedcebcfc869 | 23 | /** Calculates the CRC32 checksum on the contents of the file |
embeddedartists | 11:dedcebcfc869 | 24 | * |
embeddedartists | 11:dedcebcfc869 | 25 | * Note that the position in the file will change as a result of this |
embeddedartists | 11:dedcebcfc869 | 26 | * call. To get the old position back, use fseek(). |
embeddedartists | 11:dedcebcfc869 | 27 | * |
embeddedartists | 11:dedcebcfc869 | 28 | * @param f An open file |
embeddedartists | 11:dedcebcfc869 | 29 | * |
embeddedartists | 11:dedcebcfc869 | 30 | * @returns |
embeddedartists | 11:dedcebcfc869 | 31 | * checksum on success |
embeddedartists | 11:dedcebcfc869 | 32 | * 0 on failure |
embeddedartists | 11:dedcebcfc869 | 33 | */ |
embeddedartists | 11:dedcebcfc869 | 34 | uint32_t crc_File(FILE* f); |
embeddedartists | 11:dedcebcfc869 | 35 | |
embeddedartists | 11:dedcebcfc869 | 36 | /** Calculates the CRC32 checksum on the data |
embeddedartists | 11:dedcebcfc869 | 37 | * |
embeddedartists | 11:dedcebcfc869 | 38 | * @param data the data |
embeddedartists | 11:dedcebcfc869 | 39 | * @param size the number of elements in the data array |
embeddedartists | 11:dedcebcfc869 | 40 | * |
embeddedartists | 11:dedcebcfc869 | 41 | * @returns |
embeddedartists | 11:dedcebcfc869 | 42 | * checksum |
embeddedartists | 11:dedcebcfc869 | 43 | */ |
embeddedartists | 11:dedcebcfc869 | 44 | uint32_t crc_Buffer(const uint32_t* data, uint32_t size); |
embeddedartists | 11:dedcebcfc869 | 45 | |
embeddedartists | 11:dedcebcfc869 | 46 | #endif /* end __CRC_H */ |