Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:08

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*  void Shm_Convert_packet( &packet )
0004  *
0005  *  This routine is the shared memory locked queue MPCI driver routine
0006  *  used to convert the RTEMS's information in a packet from non-native
0007  *  format to processor native format.
0008  *
0009  *  Input parameters:
0010  *    packet  - pointer to a packet
0011  *
0012  *  Output parameters:
0013  *    *packet - packet in native format
0014  *
0015  *  NOTE: Message buffers are not manipulated.
0016  *        Endian conversion is currently the only conversion.
0017  *
0018  *  COPYRIGHT (c) 1989-1999.
0019  *  On-Line Applications Research Corporation (OAR).
0020  *
0021  * Redistribution and use in source and binary forms, with or without
0022  * modification, are permitted provided that the following conditions
0023  * are met:
0024  * 1. Redistributions of source code must retain the above copyright
0025  *    notice, this list of conditions and the following disclaimer.
0026  * 2. Redistributions in binary form must reproduce the above copyright
0027  *    notice, this list of conditions and the following disclaimer in the
0028  *    documentation and/or other materials provided with the distribution.
0029  *
0030  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0031  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0032  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0033  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0034  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0035  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0036  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0037  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0038  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0039  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0040  * POSSIBILITY OF SUCH DAMAGE.
0041  */
0042 
0043 #include <rtems.h>
0044 #include "shm_driver.h"
0045 
0046 void Shm_Convert_packet(
0047   rtems_packet_prefix *packet
0048 )
0049 {
0050   uint32_t   *pkt, i;
0051 
0052   pkt = (uint32_t*) packet;
0053   for ( i=RTEMS_MINIMUN_HETERO_CONVERSION ; i ; i--, pkt++ )
0054     *pkt = CPU_swap_u32( *pkt );
0055 
0056   for ( i=packet->to_convert ; i ; i--, pkt++ )
0057     *pkt = CPU_swap_u32( *pkt );
0058 }