forked from len0rd/rockbox
iRiver: the backlight blink loop is now done in C, using two threads, as a test of the threading code
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5283 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
de85b67f25
commit
688b4ddec6
1 changed files with 43 additions and 1 deletions
44
apps/main.c
44
apps/main.c
|
|
@ -16,6 +16,48 @@
|
||||||
* KIND, either express or implied.
|
* KIND, either express or implied.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef IRIVER_H100
|
||||||
|
#include "thread.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
|
unsigned long test_thread_stack[0x1000];
|
||||||
|
|
||||||
|
void yield(void)
|
||||||
|
{
|
||||||
|
switch_thread();
|
||||||
|
wake_up_thread();
|
||||||
|
}
|
||||||
|
|
||||||
|
void test_thread(void)
|
||||||
|
{
|
||||||
|
while(1)
|
||||||
|
{
|
||||||
|
GPIO1_OUT ^= 0x00020000;
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
init_threads();
|
||||||
|
|
||||||
|
create_thread(test_thread, test_thread_stack,
|
||||||
|
sizeof(test_thread_stack), "Test thread");
|
||||||
|
|
||||||
|
GPIO1_FUNCTION |= 0x00020000;
|
||||||
|
GPIO1_ENABLE |= 0x00020000;
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
for(i = 0;i < 10000;i++) {}
|
||||||
|
yield();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "disk.h"
|
#include "disk.h"
|
||||||
#include "fat.h"
|
#include "fat.h"
|
||||||
|
|
@ -271,4 +313,4 @@ int main(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue