1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: #include <tk/tkernel.h>
15: #include <tm/tmonitor.h>
16:
17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31:
32:
33: #if USE_TMONITOR
34: #define TM_PUTSTRING(a) tm_putstring(a)
35:
36: void print_err( UB* str, ER err)
37: {
38: tm_printf(str, err);
39: }
40:
41: #else
42: #define TM_PUTSTRING(a)
43:
44: void print_err( UB* str, INT par) {}
45:
46: #endif
47:
48: 49: 50: 51: 52:
53: void tsk1(INT stacd, void *exinf)
54: {
55: TM_PUTSTRING((UB*)"Start Task-1\n");
56:
57: tk_exd_tsk();
58: }
59:
60: 61: 62: 63: 64:
65: void tsk2(INT stacd, void *exinf)
66: {
67: TM_PUTSTRING((UB*)"Start Task-2\n");
68:
69: tk_exd_tsk();
70: }
71:
72: const T_CTSK ctsk1 = {0, (TA_HLNG | TA_RNG3), &tsk1, 10, 1024, 0};
73: const T_CTSK ctsk2 = {0, (TA_HLNG | TA_RNG3), &tsk2, 11, 1024, 0};
74:
75: 76: 77: 78: 79:
80:
81: EXPORT INT usermain( void )
82: {
83: T_RVER rver;
84: ID id1, id2;
85:
86: TM_PUTSTRING((UB*)"Start User-main program.\n");
87:
88: tk_ref_ver(&rver);
89:
90: #if USE_TMONITOR
91: tm_printf((UB*)"Make Code: %04x Product ID: %04x\n", rver.maker, rver.prid);
92: tm_printf((UB*)"Product Ver. %04x\nProduct Num. %04x %04x %04x %04x\n",
93: rver.prver, rver.prno[0],rver.prno[1],rver.prno[2],rver.prno[3]);
94: #endif
95:
96: id1 = tk_cre_tsk(&ctsk1);
97: tk_sta_tsk(id1, 0);
98:
99: id2 = tk_cre_tsk(&ctsk2);
100: tk_sta_tsk(id2, 0);
101:
102: tk_slp_tsk(TMO_FEVR);
103:
104: return 0;
105: }