OpenCores
URL https://opencores.org/ocsvn/de1_olpcl2294_system/de1_olpcl2294_system/trunk

Subversion Repositories de1_olpcl2294_system

[/] [de1_olpcl2294_system/] [trunk/] [sw/] [ecos/] [debug/] [main.c] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 qaztronic
//
2
//
3
//
4
 
5
#include <stdio.h>
6
#include <math.h>
7
#include <stdlib.h>
8
 
9
#include <cyg/kernel/kapi.h>
10
 
11
#include "LPC22xx.h"
12
#include "lib_dbg_sh.h"
13
 
14
extern void dbg_sh(void);
15
 
16
 
17
/* now declare (and allocate space for) some kernel objects,
18
   like the two threads we will use */
19
cyg_thread thread_s[2];         /* space for two thread objects */
20
 
21
char stack[2][4096];            /* space for two 4K stacks */
22
 
23
/* now the handles for the threads */
24
cyg_handle_t dbg_shell_thread, simple_threadB;
25
 
26
/* and now variables for the procedure which is the thread */
27
cyg_thread_entry_t dbg_shell;
28
cyg_thread_entry_t simple_program;
29
 
30
/* and now a mutex to protect calls to the C library */
31
cyg_mutex_t cliblock;
32
 
33
/* we install our own startup routine which sets up threads */
34
void cyg_user_start(void)
35
{
36
//   printf("Entering twothreads' cyg_user_start() function\n");
37
 
38
  // enable cs3
39
  PINSEL2 = 0x0f814924;
40
 
41
  // configure BCFG3
42
  *((unsigned int *)0xFFE0000C) = 0x20007de7;
43
 
44
  // configure gpio
45
  *((unsigned int *)0x83200008) = 0x0003ffff;
46
  *((unsigned int *)0x83200008) = 0x00000003;
47
  *((unsigned int *)0x83200008) ^= 0x00000002;
48
 
49
 
50
  cyg_mutex_init(&cliblock);
51
 
52
  cyg_thread_create(4, dbg_shell, (cyg_addrword_t) 0,
53
                    "DBG Shell", (void *) stack[0], 4096,
54
                    &dbg_shell_thread, &thread_s[0]);
55
  cyg_thread_create(4, simple_program, (cyg_addrword_t) 1,
56
                    "Thread B", (void *) stack[1], 4096,
57
                    &simple_threadB, &thread_s[1]);
58
 
59
  cyg_thread_resume(dbg_shell_thread);
60
  cyg_thread_resume(simple_threadB);
61
}
62
 
63
/* this is a simple program which runs in a thread */
64
void dbg_shell(cyg_addrword_t data)
65
{
66
  int message = (int) data;
67
  int delay;
68
 
69
  printf("Beginning execution; thread data is %d\n", message);
70
 
71
  dbg_sh();
72
 
73
}
74
 
75
/* this is a simple program which runs in a thread */
76
void simple_program(cyg_addrword_t data)
77
{
78
 
79
  for (;;) {
80
 
81
    *((unsigned int *)0x83200008) ^= 0x00000001;
82
 
83
    cyg_thread_delay(200);
84
  }
85
}
86
 
87
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.