From 4b375d7f7b320facca624a773de7cdfd15189061 Mon Sep 17 00:00:00 2001 From: suikan Date: Sun, 22 Feb 2015 22:24:36 +0900 Subject: [PATCH] =?utf8?q?FIFO=E3=81=AE=E5=86=85=E5=AE=B9=E3=82=92?= =?utf8?q?=E8=A6=97=E3=81=8F=E3=83=86=E3=82=B9=E3=83=88=E3=81=A8=E3=80=81P?= =?utf8?q?ri/Sec=E3=82=A2=E3=83=A9=E3=82=A4=E3=83=A1=E3=83=B3=E3=83=88?= =?utf8?q?=E3=81=AE=E3=83=86=E3=82=B9=E3=83=88=E3=81=AB=E4=B8=A1=E5=AF=BE?= =?utf8?q?=E5=BF=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- trx305/test.c | 110 +++++++--------------------------------------------------- 1 file changed, 13 insertions(+), 97 deletions(-) diff --git a/trx305/test.c b/trx305/test.c index 946caa9..bfe07d0 100644 --- a/trx305/test.c +++ b/trx305/test.c @@ -5,68 +5,14 @@ #include "test.h" #include -/* - * 並行実行されるタスクへのメッセージ領域 - */ -char message[3]; - -/* - * ループ回数 - */ -UW task_loop; /* タスク内でのループ回数 */ -UW tex_loop; /* 例外処理ルーチン内でのループ回数 */ - -/* - * 並行実行されるタスク - */ -void task(VP_INT exinf) -{ - INT n = 0; - INT tskno = (INT) exinf; - - syslog(LOG_NOTICE, "task%d is running (%03d). %s", - tskno, ++n); - -} - -/* - * 並行して実行されるタスク用のタスク例外処理ルーチン - */ -void tex_routine(TEXPTN texptn, VP_INT exinf) -{ - INT tskno = (INT) exinf; - - syslog(LOG_NOTICE, "task%d receives exception 0x%04x. ", - tskno, texptn); - - } - -/* - * CPU例外ハンドラ - */ -#ifdef CPUEXC1 - -void -cpuexc_handler(VP p_excinf) -{ - - syslog(LOG_NOTICE, "CPU exception handler (p_excinf = %08p).", - p_excinf); -} +#define PEEPINGTEST // Define PEEPING test to see the top 4 of FIFO after enabling SPORT RX -#endif /* CPUEXC1 */ - -/* - * 周期ハンドラ - * - * HIGH_PRIORITY,MID_PRIORITY,LOW_PRIORITY の各優先度のレディキュー - * を回転させる. - */ -void cyclic_handler(VP_INT exinf) -{ - -} +#ifdef PEEPINGTEST +#define SLEEPDURATION 2000 +#else +#define SLEEPDURATION 10 +#endif /* * メインタスク @@ -125,13 +71,6 @@ void main_task(VP_INT exinf) 29 << 0 ; // SLEN 0-1:not allowed,2-31:Serial word length - 1 ssync(); - /* - syslog( LOG_NOTICE, "SPORT0_Disable " ); - syslog( LOG_NOTICE, "SPORT0_RCR1 : %08x", *pSPORT0_RCR1 ); - syslog( LOG_NOTICE, "SPORT0_RCR2 : %08x", *pSPORT0_RCR2 ); - - syslog( LOG_NOTICE, "SPORT0_STAT : %08x", *pSPORT0_STAT ); -*/ int count = 0, event = 0; @@ -139,11 +78,6 @@ void main_task(VP_INT exinf) // RX FIFOが空になるまで読み捨てる while( *pSPORT0_STAT & RXNE) dummy = *pSPORT0_RX32; -/* - *pSPORT0_RCR1 &= ~RSPEN; // RX SPORT disable - syslog( LOG_NOTICE, "FIFO Cleared. FIFO must be empty"); - syslog( LOG_NOTICE, "SPORT0_STAT : %08x", *pSPORT0_STAT ); -*/ /* * メインループ */ @@ -153,52 +87,34 @@ void main_task(VP_INT exinf) // RX受信を開始する *pSPORT0_RCR1 |= RSPEN; // RX SPORT Enable ssync(); - /* - syslog( LOG_NOTICE, "SPORT0_Enabled" ); - syslog( LOG_NOTICE, "SPORT0_RCR1 : %08x", *pSPORT0_RCR1 ); - syslog( LOG_NOTICE, "SPORT0_RCR2 : %08x", *pSPORT0_RCR2 ); -*/ // 3mS スリープ tslp_tsk(3); // FIFOにデータがたまったはずである。 - /* - syslog( LOG_NOTICE, "SPORT0_Disabled. FIFO must be full " ); - syslog( LOG_NOTICE, "SPORT0_RCR1 : %08x", *pSPORT0_RCR1 ); - syslog( LOG_NOTICE, "SPORT0_RCR2 : %08x", *pSPORT0_RCR2 ); - - syslog( LOG_NOTICE, "SPORT0_STAT : %08x", *pSPORT0_STAT ); -*/ // FIFOデータを読みだして下位2bitのみ表示する rx[0] = *pSPORT0_RX32 & 0x3; // 下位2bitのみ抽出 rx[1] = *pSPORT0_RX32 & 0x3; // 下位2bitのみ抽出 rx[2] = *pSPORT0_RX32 & 0x3; // 下位2bitのみ抽出 rx[3] = *pSPORT0_RX32 & 0x3; // 下位2bitのみ抽出 + +#ifndef PEEPINGTEST *pSPORT0_RCR1 &= ~RSPEN; // RX SPORT disable - // syslog( LOG_NOTICE, "FIFO Read. FIFO must be empty"); if (rx[0] !=0) { event ++; +#endif syslog( LOG_NOTICE, "RX word : %d,%d,%d,%d", rx[0], rx[1], rx[2], rx[3] ); +#ifndef PEEPINGTEST } count++; if (!( count % 1000 )) syslog( LOG_NOTICE, "trial : %d, event : %d", count, event); - // syslog( LOG_NOTICE, "SPORT0_RCR1 : %08x", *pSPORT0_RCR1 ); - // syslog( LOG_NOTICE, "SPORT0_RCR2 : %08x", *pSPORT0_RCR2 ); - // syslog( LOG_NOTICE, "SPORT0_STAT : %08x", *pSPORT0_STAT ); - +#endif // RX受信を終了する。FIFOにはデータがたまっているはずである。 *pSPORT0_RCR1 &= ~RSPEN; // RX SPORT disable ssync(); - /* - syslog( LOG_NOTICE, "SPORT0 dsiabled"); - syslog( LOG_NOTICE, "SPORT0_RCR1 : %08x", *pSPORT0_RCR1 ); - syslog( LOG_NOTICE, "SPORT0_RCR2 : %08x", *pSPORT0_RCR2 ); - syslog( LOG_NOTICE, "SPORT0_STAT : %08x", *pSPORT0_STAT ); -*/ - // 1秒スリープ - tslp_tsk(10); + // スリープ + tslp_tsk(SLEEPDURATION); // RX FIFOが空になるまで読み捨てる while( *pSPORT0_STAT & RXNE) -- 2.11.0