Mistake on this page?
Report an issue in GitHub or email us
SerialWireOutput.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-2019 ARM Limited
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef MBED_SERIALWIREOUTPUT_H
19 #define MBED_SERIALWIREOUTPUT_H
20 
21 #include "platform/platform.h"
22 
23 #if defined(DEVICE_ITM)
24 
25 #include "platform/FileHandle.h"
26 
27 namespace mbed {
28 /**
29  * \defgroup drivers_SerialWireOutput SerialWireOutput class
30  * \ingroup drivers-public-api
31  * @{
32  */
33 
34 class SerialWireOutput : public FileHandle {
35 
36 public:
37 
39 
40  ssize_t write(const void *buffer, size_t size) override;
41 
42  ssize_t read(void *buffer, size_t size) override
43  {
44  /* Reading is not supported by this file handle */
45  return -EBADF;
46  }
47 
48  off_t seek(off_t offset, int whence = SEEK_SET) override
49  {
50  /* Seeking is not support by this file handler */
51  return -ESPIPE;
52  }
53 
54  off_t size() override
55  {
56  /* Size is not defined for this file handle */
57  return -EINVAL;
58  }
59 
60  int isatty() override
61  {
62  /* File handle is used for terminal output */
63  return true;
64  }
65 
66  int close() override
67  {
68  return 0;
69  }
70 };
71 
72 /** @}*/
73 
74 } // namespace mbed
75 
76 #endif // DEVICE_ITM
77 
78 #endif // MBED_SERIALWIREOUTPUT_H
off_t seek(off_t offset, int whence=SEEK_SET) override
Move the file position to a given offset from from a given location.
ssize_t write(const void *buffer, size_t size) override
Write the contents of a buffer to a file.
int isatty() override
Check if the file in an interactive terminal device.
Class FileHandle.
Definition: FileHandle.h:46
off_t size() override
Get the size of the file.
ssize_t read(void *buffer, size_t size) override
Read the contents of a file into a buffer.
int close() override
Close a file.
Definition: ATHandler.h:46
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.