xiaoxiang781216 commented on code in PR #7678: URL: https://github.com/apache/nuttx/pull/7678#discussion_r1032814848
########## drivers/segger/rtt_stream.c: ########## @@ -0,0 +1,203 @@ +/**************************************************************************** + * drivers/segger/rtt_stream.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <assert.h> +#include <stdio.h> + +#include <nuttx/config.h> +#include <nuttx/kmalloc.h> +#include <nuttx/streams.h> +#include <nuttx/segger/rtt.h> + +#include <SEGGER_RTT.h> + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rttstream_putc + ****************************************************************************/ + +static void rttstream_putc(FAR struct lib_outstream_s *this, int ch) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + stream->public.nput += SEGGER_RTT_PutChar(stream->channel, ch); +} + +/**************************************************************************** + * Name: rttstream_puts + ****************************************************************************/ + +static int rttstream_puts(FAR struct lib_outstream_s *this, + FAR const void *buf, int len) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + int ret = SEGGER_RTT_Write(stream->channel, buf, len); + stream->public.nput += ret; + return ret; +} + +/**************************************************************************** + * Name: rttstream_getc + ****************************************************************************/ + +static int rttstream_getc(FAR struct lib_instream_s *this) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ch = -1; + + DEBUGASSERT(stream); + stream->public.nget += SEGGER_RTT_Read(stream->channel, &ch, 1); + return ch; +} + +/**************************************************************************** + * Name: rttstream_gets + ****************************************************************************/ + +static int rttstream_gets(FAR struct lib_instream_s *this, + FAR void * buffer, int size) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ret; + + DEBUGASSERT(stream); + ret = SEGGER_RTT_Read(stream->channel, buffer, size); + stream->public.nget += ret; + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_rttoutstream + * + * Description: + * Initializes a stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttoutstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + * Returned Value: + * None (User allocated instance initialized). + * + ****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, int channel, + size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *upbuf = (FAR char *)kmm_malloc(bufsize); + + DEBUGASSERT(upbuf); + DEBUGASSERT(name); + sprintf(name, "rtt%d", channel); + SEGGER_RTT_ConfigUpBuffer(channel, name, upbuf, + bufsize, SEGGER_RTT_MODE_NO_BLOCK_SKIP); + + stream->public.put = rttstream_putc; + stream->public.puts = rttstream_puts; + stream->public.flush = lib_noflush; + stream->public.nput = 0; + stream->channel = channel; +} + +/**************************************************************************** + * Name: lib_rttinstream + * + * Description: + * Initializes input stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttinstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + ****************************************************************************/ + +void lib_rttinstream(FAR struct lib_rttinstream_s *stream, + int channel, size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *downbuf = (FAR char *)kmm_malloc(bufsize); + + DEBUGASSERT(downbuf); + DEBUGASSERT(name); + sprintf(name, "rtt%d", channel); + SEGGER_RTT_ConfigDownBuffer(channel, name, downbuf, + bufsize, SEGGER_RTT_MODE_DEFAULT); + + stream->public.get = rttstream_getc; + stream->public.gets = rttstream_gets; + stream->public.nget = 0; + stream->channel = channel; +} + +/**************************************************************************** + * Name: lib_rttoutstream_uninit + ****************************************************************************/ + +void lib_rttoutstream_uninit(FAR struct lib_rttoutstream_s *stream, + int channel) +{ + FAR SEGGER_RTT_CB *RTTCB; + FAR SEGGER_RTT_BUFFER_UP *UP; + + RTTCB = (SEGGER_RTT_CB *)((unsigned char *) + &_SEGGER_RTT + SEGGER_RTT_UNCACHED_OFF); + UP = &RTTCB->aUp[channel]; + kmm_free((FAR void *)UP->sName); + kmm_free(UP->pBuffer); + SEGGER_RTT_ConfigUpBuffer(channel, NULL, NULL, 0, SEGGER_RTT_MODE_DEFAULT); +} + +/**************************************************************************** + * Name: lib_rttinstream_uninit + ****************************************************************************/ + +void lib_rttinstream_uninit(FAR struct lib_rttinstream_s *stream, + int channel) Review Comment: ditto ########## include/nuttx/segger/rtt.h: ########## @@ -0,0 +1,96 @@ +/**************************************************************************** + * include/nuttx/segger/rtt.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SEGGER_RTT_H +#define __INCLUDE_NUTTX_SEGGER_RTT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/streams.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +struct lib_rttoutstream_s +{ + struct lib_outstream_s public; + int channel; +}; + +struct lib_rttinstream_s +{ + struct lib_instream_s public; + int channel; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef CONFIG_SEGGER_RTT + +/**************************************************************************** +* Name: lib_rttoutstream +*****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, + int channel, size_t bufsize); + +/**************************************************************************** +* Name: lib_rttinstream +*****************************************************************************/ + +void lib_rttinstream(FAR struct lib_rttinstream_s *stream, + int channel, size_t bufsize); + +/**************************************************************************** + * Name: lib_rttoutstream_uninit + ****************************************************************************/ + +void lib_rttoutstream_uninit(FAR struct lib_rttoutstream_s *stream, Review Comment: ```suggestion void lib_rttoutstream_close(FAR struct lib_rttoutstream_s *stream, ``` ########## drivers/segger/rtt_stream.c: ########## @@ -0,0 +1,203 @@ +/**************************************************************************** + * drivers/segger/rtt_stream.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <assert.h> +#include <stdio.h> + +#include <nuttx/config.h> +#include <nuttx/kmalloc.h> +#include <nuttx/streams.h> +#include <nuttx/segger/rtt.h> + +#include <SEGGER_RTT.h> + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rttstream_putc + ****************************************************************************/ + +static void rttstream_putc(FAR struct lib_outstream_s *this, int ch) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + stream->public.nput += SEGGER_RTT_PutChar(stream->channel, ch); +} + +/**************************************************************************** + * Name: rttstream_puts + ****************************************************************************/ + +static int rttstream_puts(FAR struct lib_outstream_s *this, + FAR const void *buf, int len) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + int ret = SEGGER_RTT_Write(stream->channel, buf, len); + stream->public.nput += ret; + return ret; +} + +/**************************************************************************** + * Name: rttstream_getc + ****************************************************************************/ + +static int rttstream_getc(FAR struct lib_instream_s *this) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ch = -1; + + DEBUGASSERT(stream); + stream->public.nget += SEGGER_RTT_Read(stream->channel, &ch, 1); + return ch; +} + +/**************************************************************************** + * Name: rttstream_gets + ****************************************************************************/ + +static int rttstream_gets(FAR struct lib_instream_s *this, + FAR void * buffer, int size) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ret; + + DEBUGASSERT(stream); + ret = SEGGER_RTT_Read(stream->channel, buffer, size); + stream->public.nget += ret; + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_rttoutstream + * + * Description: + * Initializes a stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttoutstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + * Returned Value: + * None (User allocated instance initialized). + * + ****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, int channel, + size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *upbuf = (FAR char *)kmm_malloc(bufsize); + + DEBUGASSERT(upbuf); + DEBUGASSERT(name); + sprintf(name, "rtt%d", channel); + SEGGER_RTT_ConfigUpBuffer(channel, name, upbuf, + bufsize, SEGGER_RTT_MODE_NO_BLOCK_SKIP); + + stream->public.put = rttstream_putc; + stream->public.puts = rttstream_puts; + stream->public.flush = lib_noflush; + stream->public.nput = 0; + stream->channel = channel; +} + +/**************************************************************************** + * Name: lib_rttinstream + * + * Description: + * Initializes input stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttinstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + ****************************************************************************/ + +void lib_rttinstream(FAR struct lib_rttinstream_s *stream, + int channel, size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *downbuf = (FAR char *)kmm_malloc(bufsize); Review Comment: ditto ########## drivers/segger/rtt_stream.c: ########## @@ -0,0 +1,203 @@ +/**************************************************************************** + * drivers/segger/rtt_stream.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <assert.h> +#include <stdio.h> + +#include <nuttx/config.h> +#include <nuttx/kmalloc.h> +#include <nuttx/streams.h> +#include <nuttx/segger/rtt.h> + +#include <SEGGER_RTT.h> + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rttstream_putc + ****************************************************************************/ + +static void rttstream_putc(FAR struct lib_outstream_s *this, int ch) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + stream->public.nput += SEGGER_RTT_PutChar(stream->channel, ch); +} + +/**************************************************************************** + * Name: rttstream_puts + ****************************************************************************/ + +static int rttstream_puts(FAR struct lib_outstream_s *this, + FAR const void *buf, int len) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + int ret = SEGGER_RTT_Write(stream->channel, buf, len); + stream->public.nput += ret; + return ret; +} + +/**************************************************************************** + * Name: rttstream_getc + ****************************************************************************/ + +static int rttstream_getc(FAR struct lib_instream_s *this) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ch = -1; + + DEBUGASSERT(stream); + stream->public.nget += SEGGER_RTT_Read(stream->channel, &ch, 1); + return ch; +} + +/**************************************************************************** + * Name: rttstream_gets + ****************************************************************************/ + +static int rttstream_gets(FAR struct lib_instream_s *this, + FAR void * buffer, int size) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ret; + + DEBUGASSERT(stream); + ret = SEGGER_RTT_Read(stream->channel, buffer, size); + stream->public.nget += ret; + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_rttoutstream + * + * Description: + * Initializes a stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttoutstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + * Returned Value: + * None (User allocated instance initialized). + * + ****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, int channel, + size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *upbuf = (FAR char *)kmm_malloc(bufsize); + + DEBUGASSERT(upbuf); + DEBUGASSERT(name); + sprintf(name, "rtt%d", channel); + SEGGER_RTT_ConfigUpBuffer(channel, name, upbuf, + bufsize, SEGGER_RTT_MODE_NO_BLOCK_SKIP); + + stream->public.put = rttstream_putc; + stream->public.puts = rttstream_puts; + stream->public.flush = lib_noflush; + stream->public.nput = 0; + stream->channel = channel; +} + +/**************************************************************************** + * Name: lib_rttinstream + * + * Description: + * Initializes input stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttinstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + ****************************************************************************/ + +void lib_rttinstream(FAR struct lib_rttinstream_s *stream, + int channel, size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *downbuf = (FAR char *)kmm_malloc(bufsize); + + DEBUGASSERT(downbuf); + DEBUGASSERT(name); + sprintf(name, "rtt%d", channel); + SEGGER_RTT_ConfigDownBuffer(channel, name, downbuf, + bufsize, SEGGER_RTT_MODE_DEFAULT); + + stream->public.get = rttstream_getc; + stream->public.gets = rttstream_gets; + stream->public.nget = 0; + stream->channel = channel; +} + +/**************************************************************************** + * Name: lib_rttoutstream_uninit + ****************************************************************************/ + +void lib_rttoutstream_uninit(FAR struct lib_rttoutstream_s *stream, + int channel) Review Comment: remove channel ########## include/nuttx/segger/rtt.h: ########## @@ -0,0 +1,96 @@ +/**************************************************************************** + * include/nuttx/segger/rtt.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SEGGER_RTT_H +#define __INCLUDE_NUTTX_SEGGER_RTT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/streams.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +struct lib_rttoutstream_s +{ + struct lib_outstream_s public; + int channel; +}; + +struct lib_rttinstream_s +{ + struct lib_instream_s public; + int channel; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef CONFIG_SEGGER_RTT + +/**************************************************************************** +* Name: lib_rttoutstream +*****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, + int channel, size_t bufsize); + +/**************************************************************************** +* Name: lib_rttinstream +*****************************************************************************/ + +void lib_rttinstream(FAR struct lib_rttinstream_s *stream, + int channel, size_t bufsize); + +/**************************************************************************** + * Name: lib_rttoutstream_uninit + ****************************************************************************/ + +void lib_rttoutstream_uninit(FAR struct lib_rttoutstream_s *stream, + int channel); + +#endif + +/**************************************************************************** + * Name: lib_rttinstream_uninit + ****************************************************************************/ + +void lib_rttinstream_uninit(FAR struct lib_rttinstream_s *stream, + int channel); Review Comment: remove ########## drivers/segger/rtt_stream.c: ########## @@ -0,0 +1,203 @@ +/**************************************************************************** + * drivers/segger/rtt_stream.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <assert.h> +#include <stdio.h> + +#include <nuttx/config.h> +#include <nuttx/kmalloc.h> +#include <nuttx/streams.h> +#include <nuttx/segger/rtt.h> + +#include <SEGGER_RTT.h> + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: rttstream_putc + ****************************************************************************/ + +static void rttstream_putc(FAR struct lib_outstream_s *this, int ch) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + stream->public.nput += SEGGER_RTT_PutChar(stream->channel, ch); +} + +/**************************************************************************** + * Name: rttstream_puts + ****************************************************************************/ + +static int rttstream_puts(FAR struct lib_outstream_s *this, + FAR const void *buf, int len) +{ + FAR struct lib_rttoutstream_s *stream = + (FAR struct lib_rttoutstream_s *)this; + int ret = SEGGER_RTT_Write(stream->channel, buf, len); + stream->public.nput += ret; + return ret; +} + +/**************************************************************************** + * Name: rttstream_getc + ****************************************************************************/ + +static int rttstream_getc(FAR struct lib_instream_s *this) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ch = -1; + + DEBUGASSERT(stream); + stream->public.nget += SEGGER_RTT_Read(stream->channel, &ch, 1); + return ch; +} + +/**************************************************************************** + * Name: rttstream_gets + ****************************************************************************/ + +static int rttstream_gets(FAR struct lib_instream_s *this, + FAR void * buffer, int size) +{ + FAR struct lib_rttinstream_s *stream = + (FAR struct lib_rttinstream_s *)this; + int ret; + + DEBUGASSERT(stream); + ret = SEGGER_RTT_Read(stream->channel, buffer, size); + stream->public.nget += ret; + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_rttoutstream + * + * Description: + * Initializes a stream for use with the configured RTT interface. + * + * Input Parameters: + * stream - User allocated, uninitialized instance of struct + * lib_rttoutstream_s to be initialized. + * channel - SEGGER RTT channel number + * bufsize - Size of the RTT channel buffer + * + * Returned Value: + * None (User allocated instance initialized). + * + ****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, int channel, + size_t bufsize) +{ + FAR char *name = (FAR char *)kmm_malloc(32); + FAR char *upbuf = (FAR char *)kmm_malloc(bufsize); Review Comment: let's use the fix allocation as the suggestion ########## include/nuttx/segger/rtt.h: ########## @@ -0,0 +1,96 @@ +/**************************************************************************** + * include/nuttx/segger/rtt.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_SEGGER_RTT_H +#define __INCLUDE_NUTTX_SEGGER_RTT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/streams.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Declarations + ****************************************************************************/ + +struct lib_rttoutstream_s +{ + struct lib_outstream_s public; + int channel; +}; + +struct lib_rttinstream_s +{ + struct lib_instream_s public; + int channel; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifdef CONFIG_SEGGER_RTT + +/**************************************************************************** +* Name: lib_rttoutstream +*****************************************************************************/ + +void lib_rttoutstream(FAR struct lib_rttoutstream_s *stream, Review Comment: ```suggestion void lib_rttoutstream_open(FAR struct lib_rttoutstream_s *stream, ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org