Advertisement
dhruvag2000

diff2

Aug 6th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 7.36 KB | None | 0 0
  1. root@beaglebone:~/testBela# git diff resources/
  2. diff --git a/resources/rproc-build/common/resource_table_empty.h b/resources/rproc-build/common/resource_table_empty.h
  3. index 07e97d9b..e240d507 100644
  4. --- a/resources/rproc-build/common/resource_table_empty.h
  5. +++ b/resources/rproc-build/common/resource_table_empty.h
  6. @@ -1,17 +1,34 @@
  7.  /*
  8. - *  ======== resource_table_empty.h ========
  9. + * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/
  10.   *
  11. - *  Define the resource table entries for all PRU cores. This will be
  12. - *  incorporated into corresponding base images, and used by the remoteproc
  13. - *  on the host-side to allocated/reserve resources.  Note the remoteproc
  14. - *  driver requires that all PRU firmware be built with a resource table.
  15.   *
  16. - *  This file contains an empty resource table.  It can be used either as:
  17. + * Redistribution and use in source and binary forms, with or without
  18. + * modification, are permitted provided that the following conditions
  19. + * are met:
  20.   *
  21. - *        1) A template, or
  22. - *        2) As-is if a PRU application does not need to configure PRU_INTC
  23. - *                  or interact with the rpmsg driver
  24. + *     * Redistributions of source code must retain the above copyright
  25. + *       notice, this list of conditions and the following disclaimer.
  26.   *
  27. + *     * Redistributions in binary form must reproduce the above copyright
  28. + *       notice, this list of conditions and the following disclaimer in the
  29. + *       documentation and/or other materials provided with the
  30. + *       distribution.
  31. + *
  32. + *     * Neither the name of Texas Instruments Incorporated nor the names of
  33. + *       its contributors may be used to endorse or promote products derived
  34. + *       from this software without specific prior written permission.
  35. + *
  36. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  37. + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  38. + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  39. + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  40. + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  41. + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  42. + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  43. + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  44. + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  45. + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  46. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  47.   */
  48.  
  49.  #ifndef _RSC_TABLE_PRU_H_
  50. @@ -19,21 +36,104 @@
  51.  
  52.  #include <stddef.h>
  53.  #include <rsc_types.h>
  54. +#include "pru_virtio_ids.h"
  55. +
  56. +/*
  57. + * Sizes of the virtqueues (expressed in number of buffers supported,
  58. + * and must be power of 2)
  59. + */
  60. +#define PRU_RPMSG_VQ0_SIZE     16
  61. +#define PRU_RPMSG_VQ1_SIZE     16
  62. +
  63. +/*
  64. + * The feature bitmap for virtio rpmsg
  65. + */
  66. +#define VIRTIO_RPMSG_F_NS      0               //name service notifications
  67. +
  68. +/* This firmware supports name service notifications as one of its features */
  69. +#define RPMSG_PRU_C0_FEATURES  (1 << VIRTIO_RPMSG_F_NS)
  70. +
  71. +/* Definition for unused interrupts */
  72. +#define HOST_UNUSED            255
  73. +
  74. +/* Mapping sysevts to a channel. Each pair contains a sysevt, channel. */
  75. +// struct ch_map pru_intc_map[] = { {16, 2},
  76. +//                              {17, 0},
  77. +// };
  78. +struct ch_map pru_intc_map[] = { {55, 2},
  79. +                 {54, 2},
  80. +};
  81. +
  82.  
  83.  struct my_resource_table {
  84.         struct resource_table base;
  85.  
  86. -       uint32_t offset[1]; /* Should match 'num' in actual definition */
  87. +       uint32_t offset[2]; /* Should match 'num' in actual definition */
  88. +
  89. +       /* rpmsg vdev entry */
  90. +       struct fw_rsc_vdev rpmsg_vdev;
  91. +       struct fw_rsc_vdev_vring rpmsg_vring0;
  92. +       struct fw_rsc_vdev_vring rpmsg_vring1;
  93. +
  94. +       /* intc definition */
  95. +       struct fw_rsc_custom pru_ints;
  96.  };
  97.  
  98. -#pragma DATA_SECTION(pru_remoteproc_ResourceTable, ".resource_table")
  99. -#pragma RETAIN(pru_remoteproc_ResourceTable)
  100. -struct my_resource_table pru_remoteproc_ResourceTable = {
  101. -       1,      /* we're the first version that implements this */
  102. -       0,      /* number of entries in the table */
  103. +#pragma DATA_SECTION(resourceTable, ".resource_table")
  104. +#pragma RETAIN(resourceTable)
  105. +struct my_resource_table resourceTable = {
  106. +       1,      /* Resource table version: only version 1 is supported by the current driver */
  107. +       2,      /* number of entries in the table */
  108.         0, 0,   /* reserved, must be zero */
  109. -       0,      /* offset[0] */
  110. +       /* offsets to entries */
  111. +       {
  112. +               offsetof(struct my_resource_table, rpmsg_vdev),
  113. +               offsetof(struct my_resource_table, pru_ints),
  114. +       },
  115. +
  116. +       /* rpmsg vdev entry */
  117. +       {
  118. +               (uint32_t)TYPE_VDEV,                    //type
  119. +               (uint32_t)VIRTIO_ID_RPMSG,              //id
  120. +               (uint32_t)0,                            //notifyid
  121. +               (uint32_t)RPMSG_PRU_C0_FEATURES,        //dfeatures
  122. +               (uint32_t)0,                            //gfeatures
  123. +               (uint32_t)0,                            //config_len
  124. +               (uint8_t)0,                             //status
  125. +               (uint8_t)2,                             //num_of_vrings, only two is supported
  126. +               { (uint8_t)0, (uint8_t)0 },             //reserved
  127. +               /* no config data */
  128. +       },
  129. +       /* the two vrings */
  130. +       {
  131. +               0,                      //da, will be populated by host, can't pass it in
  132. +               16,                     //align (bytes),
  133. +               PRU_RPMSG_VQ0_SIZE,     //num of descriptors
  134. +               0,                      //notifyid, will be populated, can't pass right now
  135. +               0                       //reserved
  136. +       },
  137. +       {
  138. +               0,                      //da, will be populated by host, can't pass it in
  139. +               16,                     //align (bytes),
  140. +               PRU_RPMSG_VQ1_SIZE,     //num of descriptors
  141. +               0,                      //notifyid, will be populated, can't pass right now
  142. +               0                       //reserved
  143. +       },
  144. +
  145. +       {
  146. +               TYPE_CUSTOM, TYPE_PRU_INTS,
  147. +               sizeof(struct fw_rsc_custom_ints),
  148. +               { /* PRU_INTS version */
  149. +                       0x0000,
  150. +                       /* Channel-to-host mapping, 255 for unused */
  151. +                       0, HOST_UNUSED, 2, HOST_UNUSED, HOST_UNUSED,
  152. +                       HOST_UNUSED, HOST_UNUSED, HOST_UNUSED, HOST_UNUSED, HOST_UNUSED,
  153. +                       /* Number of evts being mapped to channels */
  154. +                       (sizeof(pru_intc_map) / sizeof(struct ch_map)),
  155. +                       /* Pointer to the structure containing mapped events */
  156. +                       pru_intc_map,
  157. +               },
  158. +       },
  159.  };
  160.  
  161.  #endif /* _RSC_TABLE_PRU_H_ */
  162. -
  163. diff --git a/resources/rproc-build/rproc-template.c b/resources/rproc-build/rproc-template.c
  164. index 3553316f..30ae35a1 100644
  165. --- a/resources/rproc-build/rproc-template.c
  166. +++ b/resources/rproc-build/rproc-template.c
  167. @@ -2,6 +2,7 @@
  168.  
  169.  void _c_int00(void)
  170.  {
  171. +       // pru_rpmsg_init();
  172.         __asm__ __volatile__
  173.         (
  174.  #include "included_assembly.h"
  175.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement