Project

General

Profile

M4 hello world patches for use with remoteproc ยป resource_table_no_ipc.h

John Pruitt, 04/06/2023 05:28 PM

 
/*
* Copyright (C) 2022-2022 Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the
* distribution.
*
* Neither the name of Texas Instruments Incorporated nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef RESOURCE_TABLE_NO_IPC_H_
#define RESOURCE_TABLE_NO_IPC_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include <drivers/ipc_rpmsg/include/ipc_rpmsg_linux_resource_table.h>
#include <stdint.h>
#include <kernel/dpl/SystemP.h>
#include <kernel/dpl/DebugP.h> /* DebugP is needed for DebugP_MEM_LOG_SIZE */
#include <drivers/hw_include/cslr_soc.h>

/*
* NOTES
*
* - RPMessage_ResourceTable copied from Linux IPC example ti_drivers_config.c
*
* - gDebugMemLog copied from Linux IPC example ti_dlp_config.c
*
* - Should I just delete gDebugMemLogSize? Or is it used somewhere?
*
* - I do NOT expect the log to be viewable from Linux, because I did not
* copy this part of ti_dlp_config.c:
* void putchar_(char character)
* {
* // Output to memory trace buffer
* DebugP_memLogWriterPutChar(character);
* }
*
* - Future work: try reducing the size of the DebugP log buffer if not used
* It takes 0x1000 of space in .bss by default
*/


/* DebugP log buffer memory and size
* - This log can be viewed via ROV in CCS
* - When linux is enabled, this log can also be viewed via linux debugfs
*/
char gDebugMemLog[DebugP_MEM_LOG_SIZE] __attribute__ ((section (".bss.debug_mem_trace_buf"), aligned (128)));
uint32_t gDebugMemLogSize = DebugP_MEM_LOG_SIZE;


const RPMessage_ResourceTable gRPMessage_linuxResourceTable __attribute__((used)) __attribute__ ((section (".resource_table"), aligned (4096))) =
{
{
1U, /* we're the first version that implements this */
2U, /* number of entries, MUST be 2 */
{ 0U, 0U, } /* reserved, must be zero */
},
/* offsets to the entries */
{
offsetof(RPMessage_ResourceTable, vdev),
offsetof(RPMessage_ResourceTable, trace),
},
/* vdev entry */
{
RPMESSAGE_RSC_TYPE_VDEV, RPMESSAGE_RSC_VIRTIO_ID_RPMSG,
0U, 1U, 0U, 0U, 0U, 2U, { 0U, 0U },
},
/* the two vrings */
{ RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 1U, 0U },
{ RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 2U, 0U },
{
(RPMESSAGE_RSC_TRACE_INTS_VER0 | RPMESSAGE_RSC_TYPE_TRACE),
(uint32_t)gDebugMemLog, DebugP_MEM_LOG_SIZE,
0, "trace:m4fss0_0",
},
};

#ifdef __cplusplus
}
#endif

#endif /* RESOURCE_TABLE_NO_IPC_H_ */
    (1-1/1)