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

Anonymous
Saturday, February 24th, 2007 at 12:24:52pm UTC 

  1. diff --git a/apps/main.c b/apps/main.c
  2. index a912e07..e6d1e50 100644
  3. --- a/apps/main.c
  4. +++ b/apps/main.c
  5. @@ -106,6 +106,8 @@
  6.  #include "cuesheet.h"
  7.  
  8.  /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
  9. +volatile unsigned char IDATA_ATTR CPU_MESSAGE=0;
  10. +volatile unsigned char IDATA_ATTR CPU_REPLY=0;
  11.  
  12.  const char appsversion[]=APPSVERSION;
  13.  
  14. @@ -542,6 +544,24 @@ static void init(void)
  15.  }
  16.  
  17.  #ifdef CPU_PP
  18. +void cop_rolo(void) ICODE_ATTR;
  19. +void cop_rolo(void)
  20. +{
  21. +    /* Invalidate cache */
  22. +    outl(inl(0xf000f044) | 0x6, 0xf000f044);
  23. +    while ((inl(0x6000c000) & 0x8000) != 0) {}
  24. +   
  25. +    /* Disable cache */
  26. +    outl(0x0, 0x6000C000);
  27. +
  28. +    CPU_REPLY = 1;
  29. +
  30. +    asm volatile(
  31. +        "mov   r0, #0x10000000   \n"
  32. +        "mov   pc, r0            \n"
  33. +    );
  34. +}
  35. +
  36.  void cop_main(void)
  37.  {
  38.  /* This is the entry point for the coprocessor
  39. @@ -550,9 +570,15 @@ void cop_main(void)
  40.     platforms which support it.
  41.  
  42.     At present all we do is send the COP to sleep if anything wakes it. */
  43. -    while(1) {
  44. +    long i;
  45. +    unsigned long* memmapregs = (unsigned long*)0xf000f000;
  46. +
  47. +    (*(volatile unsigned long*)(0x60004134)) |= 0x10; /* Set mailbox interrupt */
  48. +
  49. +    while(CPU_MESSAGE != COP_REBOOT) {
  50.          COP_CTL = PROC_SLEEP;
  51.      }
  52. +    cop_rolo();
  53.  }
  54.  #endif
  55.  
  56. diff --git a/firmware/export/config.h b/firmware/export/config.h
  57. index 1a3e0be..ac2ee68 100644
  58. --- a/firmware/export/config.h
  59. +++ b/firmware/export/config.h
  60. @@ -280,6 +280,8 @@
  61.  
  62.  #define NUM_CORES 1
  63.  #define CURRENT_CORE 0
  64. +
  65. +#define COP_REBOOT 0x00000001
  66.  #else
  67.  #define NUM_CORES 1
  68.  #define CURRENT_CORE 0
  69. diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h
  70. index d304895..1cc23e9 100644
  71. --- a/firmware/export/pp5020.h
  72. +++ b/firmware/export/pp5020.h
  73. @@ -25,6 +25,17 @@
  74.  #define CPU_CTL          (*(volatile unsigned long *)(0x60007000))
  75.  #define COP_CTL          (*(volatile unsigned long *)(0x60007004))
  76.  
  77. +/* Mailboxes */
  78. +/* Each processor has two mailboxes it can write to and two which
  79. +   it can read from.  We define the first to be for sending messages
  80. +   and the second for replying to messages */
  81. +#if 0
  82. +#define CPU_MESSAGE      (*(volatile unsigned long *)(0x60001000))
  83. +#define COP_MESSAGE      (*(volatile unsigned long *)(0x60001004))
  84. +#define CPU_REPLY        (*(volatile unsigned long *)(0x60001008))
  85. +#define COP_REPLY        (*(volatile unsigned long *)(0x6000100c))
  86. +#endif
  87. +
  88.  #define GPIOA_ENABLE     (*(volatile unsigned long *)(0x6000d000))
  89.  #define GPIOB_ENABLE     (*(volatile unsigned long *)(0x6000d004))
  90.  #define GPIOC_ENABLE     (*(volatile unsigned long *)(0x6000d008))
  91. diff --git a/firmware/rolo.c b/firmware/rolo.c
  92. index 84b3280..eb72013 100644
  93. --- a/firmware/rolo.c
  94. +++ b/firmware/rolo.c
  95. @@ -63,6 +63,8 @@ void rolo_restart(const unsigned char* source, unsigned char* dest,
  96.      long i;
  97.      unsigned char* localdest = dest;
  98.  #if (CONFIG_CPU==PP5020) || (CONFIG_CPU==PP5024)
  99. +    extern volatile unsigned char CPU_MESSAGE;
  100. +    extern volatile unsigned char CPU_REPLY;
  101.      unsigned long* memmapregs = (unsigned long*)0xf000f000;
  102.  #endif
  103.  
  104. @@ -78,6 +80,10 @@ void rolo_restart(const unsigned char* source, unsigned char* dest,
  105.          : : "a"(dest)
  106.      );
  107.  #elif (CONFIG_CPU==PP5020) || (CONFIG_CPU==PP5024)
  108. +
  109. +    CPU_MESSAGE = COP_REBOOT;
  110. +    COP_CTL = PROC_WAKE;
  111. +
  112.      /* Flush cache */
  113.      outl(inl(0xf000f044) | 0x2, 0xf000f044);
  114.      while ((inl(0x6000c000) & 0x8000) != 0) {}
  115. @@ -85,10 +91,13 @@ void rolo_restart(const unsigned char* source, unsigned char* dest,
  116.      /* Disable cache */
  117.      outl(0x0, 0x6000C000);
  118.  
  119. +   
  120.      /* Reset the memory mapping registers to zero */
  121.      for (i=0;i<8;i++)
  122.          memmapregs[i]=0;
  123.  
  124. +    while(CPU_REPLY != 1) {}
  125. +
  126.      asm volatile(
  127.          "mov   r0, #0x10000000   \n"
  128.          "mov   pc, r0            \n"

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