Project

General

Profile

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

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

 
1
/*
2
 *  Copyright (C) 2022-2022 Texas Instruments Incorporated
3
 *
4
 *  Redistribution and use in source and binary forms, with or without
5
 *  modification, are permitted provided that the following conditions
6
 *  are met:
7
 *
8
 *    Redistributions of source code must retain the above copyright
9
 *    notice, this list of conditions and the following disclaimer.
10
 *
11
 *    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
14
 *    distribution.
15
 *
16
 *    Neither the name of Texas Instruments Incorporated nor the names of
17
 *    its contributors may be used to endorse or promote products derived
18
 *    from this software without specific prior written permission.
19
 *
20
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
 *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
 *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
 *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
 *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
 *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
 */
32

    
33
#ifndef RESOURCE_TABLE_NO_IPC_H_
34
#define RESOURCE_TABLE_NO_IPC_H_
35

    
36
#ifdef __cplusplus
37
extern "C" {
38
#endif
39

    
40
#include <stddef.h>
41
#include <drivers/ipc_rpmsg/include/ipc_rpmsg_linux_resource_table.h>
42
#include <stdint.h>
43
#include <kernel/dpl/SystemP.h>
44
#include <kernel/dpl/DebugP.h> /* DebugP is needed for DebugP_MEM_LOG_SIZE */
45
#include <drivers/hw_include/cslr_soc.h>
46

    
47
/*
48
 * NOTES
49
 *
50
 * - RPMessage_ResourceTable copied from Linux IPC example ti_drivers_config.c
51
 *
52
 * - gDebugMemLog copied from Linux IPC example ti_dlp_config.c
53
 *
54
 * - Should I just delete gDebugMemLogSize? Or is it used somewhere?
55
 *
56
 * - I do NOT expect the log to be viewable from Linux, because I did not
57
 *   copy this part of ti_dlp_config.c:
58
 *      void putchar_(char character)
59
 *      {
60
 *          // Output to memory trace buffer
61
 *          DebugP_memLogWriterPutChar(character);
62
 *      }
63
 *
64
 * - Future work: try reducing the size of the DebugP log buffer if not used
65
 *   It takes 0x1000 of space in .bss by default
66
 */
67

    
68

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

    
76

    
77
const RPMessage_ResourceTable gRPMessage_linuxResourceTable __attribute__((used)) __attribute__ ((section (".resource_table"), aligned (4096))) =
78
{
79
    {
80
        1U,         /* we're the first version that implements this */
81
        2U,         /* number of entries, MUST be 2 */
82
        { 0U, 0U, } /* reserved, must be zero */
83
    },
84
    /* offsets to the entries */
85
    {
86
        offsetof(RPMessage_ResourceTable, vdev),
87
        offsetof(RPMessage_ResourceTable, trace),
88
    },
89
    /* vdev entry */
90
    {
91
        RPMESSAGE_RSC_TYPE_VDEV, RPMESSAGE_RSC_VIRTIO_ID_RPMSG,
92
        0U, 1U, 0U, 0U, 0U, 2U, { 0U, 0U },
93
    },
94
    /* the two vrings */
95
    { RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 1U, 0U },
96
    { RPMESSAGE_RSC_VRING_ADDR_ANY, 4096U, 256U, 2U, 0U },
97
    {
98
        (RPMESSAGE_RSC_TRACE_INTS_VER0 | RPMESSAGE_RSC_TYPE_TRACE),
99
        (uint32_t)gDebugMemLog, DebugP_MEM_LOG_SIZE,
100
        0, "trace:m4fss0_0",
101
    },
102
};
103

    
104
#ifdef __cplusplus
105
}
106
#endif
107

    
108
#endif /* RESOURCE_TABLE_NO_IPC_H_ */
    (1-1/1)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)