tRunCtrl.c
Go to the documentation of this file.00001
00010 #include "tRunCtrl.h"
00011 #include "taskCtrl.h"
00012 #include "transferCtrl.h"
00013 #include "sh7045lib.h"
00014 #include "packetHandleTarget.h"
00015
00016
00017 static runCtrl_t Run;
00018
00019
00020 static void msecHandler(void) {
00021 update_tRunCtrlState(&Run);
00022 }
00023
00024
00025 void __main(void) {}
00026 int main(void) {
00027 nodeInfo_t node;
00028 int port;
00029
00030 initTransferCtrl(SCI_0);
00031 initTransferCtrl(SCI_1);
00032 init_timer(INT_MTU_LEVEL);
00033 set_imask(0);
00034
00035 init_tRunCtrlState(&Run, PACKAGE_NUM_VERSION);
00036 initNodeInfo(&node);
00037 registerStructInfo(&node, (unsigned char *)&Run, RUN_CTRL_TARGET_ID);
00038
00039 set_timerHandler(msecHandler, SMP_USEC);
00040 start_timer(SMP_USEC);
00041
00042 while (1) {
00043 if (get_sciReadable(SCI_0)) {
00044 port = SCI_0;
00045 break;
00046 } else if (get_sciReadable(SCI_1)) {
00047 port = SCI_1;
00048 break;
00049 }
00050 }
00051 trans_setPort(port);
00052 reset_tRunCtrlPosition(&Run);
00053
00054 while (1) {
00055 packetRecvHandler(&Run);
00056 }
00057 }
00058