Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.74 KB | None | 0 0
  1. /* Framework ---------------------------------------------------------------- */
  2.  
  3. struct block;
  4.  
  5. typedef int (*cd_init_t)(void);
  6. typedef int (*cd_connect_t)(struct block *, struct block *);
  7.  
  8. struct compute_domain
  9. {
  10.     const char  *name;
  11.     cd_init_t   *init;
  12.     cd_connect_t    *connect;
  13. };
  14.  
  15. struct block
  16. {
  17.     struct compute_domain *domain;
  18. };
  19.  
  20.  
  21.  
  22. /* This would replace the current tb->connect method */
  23. int
  24. connect(struct block *src, struct block *dst)
  25. {
  26.     /* Easy case */
  27.     if (src->domain == dst->domain)
  28.         return src->domain->connect(src, dst);
  29.    
  30.     /* ingress / egress */
  31.     factory = find_adaptor(src, dst);
  32.     if (!factory)
  33.         return -EINVAL;
  34.  
  35.     struct block *adapt = factory();
  36.  
  37.     src->domain->connect(src, adapt);
  38.     dst->domain->connect(adapt, dst);
  39. }
  40.  
  41.  
  42. /* Host -------------------------------------------------------------------- */
  43. /* This is shipped with gr-runtime, the default compute domain and would
  44.  * pretty much be all the current code */
  45.  
  46. static int
  47. host_init(void)
  48. {
  49.     /* Init of host domain (if any is required ...) */
  50. }
  51.  
  52. static int
  53. host_connect(struct block *src, struct block *dst)
  54. {
  55.     /* Call the 'normal' connect function like it is currently */
  56. }
  57.  
  58. static struct compute_domain domHost = {
  59.     .name = "Host",
  60.     .init = host_init,
  61.     .connect = host_connect,
  62. };
  63.  
  64.  
  65. /* RF NoC ----------------------------------------------------------------- */
  66. /* This would essentially be in gr-uhd */
  67.  
  68. static int
  69. rfnoc_init(void)
  70. {
  71.     /* Register our host ingress / egress with framework */
  72. }
  73.  
  74. static int
  75. rfnoc_connect(struct block *src, struct block *dst)
  76. {
  77.     /* Calls UHD to connect those blocks. You can assume
  78.      * src & dst are either pure rfnoc block or an ingress/egress blocks
  79.      */
  80. }
  81.  
  82. static struct compute_domain domRFNoC = {
  83.     .name = "RF NoC",
  84.     .init = rfnoc_init,
  85.     .connect = rfnoc_connect,
  86. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement