Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Mine
Thursday, August 3rd, 2006 at 12:50:50pm UTC 

  1. Index: apps/main.c
  2. ===================================================================
  3. RCS file: /cvsroot/rockbox/apps/main.c,v
  4. retrieving revision 1.178
  5. diff -u -b -r1.178 main.c
  6. --- apps/main.c 21 Jul 2006 08:42:27 -0000       1.178
  7. +++ apps/main.c 3 Aug 2006 12:45:17 -0000
  8. @@ -99,6 +99,7 @@
  9.  /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
  10.  
  11.  const char appsversion[]=APPSVERSION;
  12. +bool cop_is_available IDATA_ATTR = false;
  13.  
  14.  void init(void);
  15.  
  16. @@ -451,6 +452,20 @@
  17.  #endif
  18.  }
  19.  
  20. +void cop_main(void)
  21. +{
  22. +/* This is the entry point for the coprocessor
  23. +   Anyone not running an upgraded bootloader will never reach this point,
  24. +   so it should not be assumed that the coprocessor be usable even on
  25. +   platforms which support it.
  26. +
  27. +   At present all we do is send the COP to sleep if anything wakes it. */
  28. +    while(1) {
  29. +        cop_is_available = true;
  30. +        sleep(1);
  31. +    }
  32. +}
  33. +
  34.  int main(void)
  35.  {
  36.      app_main();
  37. Index: firmware/thread.c
  38. ===================================================================
  39. RCS file: /cvsroot/rockbox/firmware/thread.c,v
  40. retrieving revision 1.59
  41. diff -u -b -r1.59 thread.c
  42. --- firmware/thread.c   8 Feb 2006 21:30:35 -0000  1.59
  43. +++ firmware/thread.c   3 Aug 2006 12:45:23 -0000
  44. @@ -23,6 +23,7 @@
  45.  #include "system.h"
  46.  #include "kernel.h"
  47.  #include "cpu.h"
  48. +#include "string.h"
  49.  
  50.  #ifdef CPU_COLDFIRE
  51.  struct regs
  52. @@ -48,6 +49,9 @@
  53.      void         *sp;    /* Stack pointer (r13) */
  54.      unsigned int lr;     /* r14 (lr) */
  55.      void         *start; /* Thread start address, or NULL when started */
  56. +#ifdef CPU_PP
  57. +    bool         run_on_cop; /* Thread should be run on the coprocessor */
  58. +#endif
  59.  };
  60.  #elif CONFIG_CPU == TCC730
  61.  struct regs
  62. @@ -74,6 +78,16 @@
  63.  extern int stackbegin[];
  64.  extern int stackend[];
  65.  
  66. +#ifdef CPU_PP
  67. +static const char cop_main_thread_name[] = "main_coprocessor";
  68. +
  69. +extern int cop_stackbegin[];
  70. +extern int cop_stackend[];
  71. +
  72. +extern void cop_main(void);
  73. +extern bool cop_is_available;
  74. +#endif
  75. +
  76.  void switch_thread(void) ICODE_ATTR;
  77.  static inline void store_context(void* addr) __attribute__ ((always_inline));
  78.  static inline void load_context(const void* addr) __attribute__ ((always_inline));
  79. @@ -292,8 +306,17 @@
  80.         panicf("Stkov %s", thread_name[current]);
  81.  #endif
  82.  
  83. +#ifdef CPU_PP
  84. +    /* Find the next thread on this processor */
  85. +    while(thread_contexts[++current].run_on_cop !=
  86. +      thread_contexts[current_thread].run_on_cop){
  87. +        if (current >= num_threads)
  88. +            current = -1;
  89. +    }
  90. +#else
  91.      if (++current >= num_threads)
  92.          current = 0;
  93. +#endif
  94.  
  95.      current_thread = current;
  96.      load_context(&thread_contexts[current]);
  97. @@ -351,6 +374,13 @@
  98.      regs->started = 0;
  99.  #endif
  100.      regs->start = (void*)function;
  101. +#ifdef CPU_PP
  102. +    if((cop_is_available) && strncmp(thread_name[num_threads], "codec_thread", 14)){
  103. +        regs->run_on_cop = true;
  104. +    } else {
  105. +        regs->run_on_cop = false;
  106. +    }
  107. +#endif
  108.  
  109.      wake_up_thread();
  110.      return num_threads++; /* return the current ID, e.g for remove_thread() */
  111. @@ -396,6 +426,17 @@
  112.      thread_contexts[0].start = 0; /* thread 0 already running */
  113.  #endif
  114.      num_sleepers = 0;
  115. +#ifdef CPU_PP
  116. +    thread_contexts[0].run_on_cop = false;
  117. +    /* If the COP has not been set up, then the next thread will never be
  118. +       run. */
  119. +    num_threads++;
  120. +    thread_name[1] = cop_main_thread_name;
  121. +    thread_stack[1] = cop_stackbegin;
  122. +    thread_stack_size[1] = (int)cop_stackend - (int)cop_stackbegin;
  123. +    thread_contexts[1].start = &cop_main;
  124. +    thread_contexts[1].run_on_cop = true;
  125. +#endif
  126.  }
  127.  
  128.  int thread_stack_usage(int threadnum)

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right