Changeset fa3005f in rtems


Ignore:
Timestamp:
Mar 1, 2020, 10:56:08 AM (4 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
5, master
Children:
097ea1e
Parents:
7e3b5c0
git-author:
Sebastian Huber <sebastian.huber@…> (03/01/20 10:56:08)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/04/20 08:38:58)
Message:

console: Use IMFS_add_node() for simple task cons

Change license to BSD-2-Clause according to file history.

Update #3053.
Update #3894.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/consolesimpletask.c

    r7e3b5c0 rfa3005f  
     1/* SPDX-License-Identifier: BSD-2-Clause */
     2
    13/*
    2  * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
     4 * Copyright (C) 2018, 2020 embedded brains GmbH (http://www.embedded-brains.de)
    35 *
    4  *  embedded brains GmbH
    5  *  Dornierstr. 4
    6  *  82178 Puchheim
    7  *  Germany
    8  *  <rtems@embedded-brains.de>
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
    914 *
    10  * The license and distribution terms for this file may be
    11  * found in the file LICENSE in this distribution or at
    12  * http://www.rtems.org/license/LICENSE.
     15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
     19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     25 * POSSIBILITY OF SUCH DAMAGE.
    1326 */
     27
     28#if HAVE_CONFIG_H
     29#include "config.h"
     30#endif
    1431
    1532#include <rtems/console.h>
     
    2542
    2643typedef struct {
     44  IMFS_jnode_t Node;
    2745  RTEMS_INTERRUPT_LOCK_MEMBER( buf_lock )
    2846  rtems_mutex output_mutex;
     
    4967}
    5068
     69static Console_simple_task_Control *_Console_simple_task_Iop_to_control(
     70  const rtems_libio_t *iop
     71)
     72{
     73  return (Console_simple_task_Control *) IMFS_iop_to_node( iop );
     74}
     75
    5176static ssize_t _Console_simple_task_Write(
    5277  rtems_libio_t *iop,
     
    5984  size_t                       todo;
    6085
    61   cons = IMFS_generic_get_context_by_iop( iop );
     86  cons = _Console_simple_task_Iop_to_control( iop );
    6287  buf = buffer;
    6388  todo = count;
     
    138163  Console_simple_task_Control *cons;
    139164
    140   cons = IMFS_generic_get_context_by_iop( iop );
     165  cons = _Console_simple_task_Iop_to_control( iop );
    141166  _Console_simple_task_Put_chars( cons );
    142167
     
    162187
    163188static const IMFS_node_control
    164 _Console_simple_task_Node_control = IMFS_GENERIC_INITIALIZER(
     189_Console_simple_task_Node_control = IMFS_NODE_CONTROL_INITIALIZER(
    165190  &_Console_simple_task_Handlers,
    166   IMFS_node_initialize_generic,
    167   IMFS_node_destroy_default
     191  IMFS_node_initialize_default,
     192  IMFS_do_nothing_destroy
    168193);
    169194
     
    188213}
    189214
     215static const char _Console_simple_task_Name[] = "console";
     216
    190217void _Console_simple_task_Initialize( void )
    191218{
     
    193220
    194221  cons = &_Console_simple_task_Instance;
     222
     223  IMFS_node_preinitialize(
     224    &cons->Node,
     225    &_Console_simple_task_Node_control,
     226    _Console_simple_task_Name,
     227    sizeof( _Console_simple_task_Name ) - 1,
     228    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO
     229  );
    195230
    196231  rtems_interrupt_lock_initialize( &cons->buf_lock, "Console" );
    197232  rtems_mutex_init( &cons->output_mutex, "Console" );
    198233
    199   IMFS_make_generic_node(
    200     CONSOLE_DEVICE_NAME,
    201     S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    202     &_Console_simple_task_Node_control,
    203     cons
    204   );
     234  IMFS_add_node( "/dev", &cons->Node, NULL );
    205235
    206236  rtems_task_create(
Note: See TracChangeset for help on using the changeset viewer.