Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers file_stream.h Source File

file_stream.h

Go to the documentation of this file.
00001 /**
00002  * @file    file_stream.h
00003  * @brief   Different file stream parsers that are supported
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #ifndef FILE_STREAM_H
00023 #define FILE_STREAM_H
00024 
00025 #include <stdint.h>
00026 
00027 #include "virtual_fs.h"
00028 #include "error.h"
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034 typedef enum {
00035     STREAM_TYPE_START = 0,
00036 
00037     STREAM_TYPE_BIN = STREAM_TYPE_START,
00038     STREAM_TYPE_HEX,
00039 
00040     // Add new stream types here
00041 
00042     STREAM_TYPE_COUNT,
00043 
00044     STREAM_TYPE_NONE
00045 } stream_type_t;
00046 
00047 // Stateless function to identify a filestream by its contents
00048 stream_type_t stream_start_identify(const uint8_t *data, uint32_t size);
00049 
00050 // Stateless function to identify a filestream by its name
00051 stream_type_t stream_type_from_name(const vfs_filename_t filename);
00052 
00053 error_t stream_open(stream_type_t stream_type);
00054 
00055 error_t stream_write(const uint8_t *data, uint32_t size);
00056 
00057 error_t stream_close(void);
00058 
00059 #ifdef __cplusplus
00060 }
00061 #endif
00062 
00063 #endif