/* sec_lib.c - Recv data to LCD Display function */

定義部開始

略

定義部の最後


//--- μITRON環境用漢字ディスプレイ定義 ------------------
#include "../kanji_functions/global&define.c"
#include "../kanji_functions/16x16special_font.c"
#include "../kanji_functions/16x16_size_font.c"
#include "../kanji_functions/8x16_size_font.c"

void gpio_out_function( signal, level )
int signal, level;
{
  switch(signal)
    {
    case GPIO_OUT_INIT:
      sys_ini_pio (CLK_OUT,    1);
      sys_ini_pio (DATA_OUT,   1);
      sys_ini_pio (ENABLE_OUT, 1);
      break;
    case CLK_OUT:
      sys_wri_pio(CLK_OUT   ,level);
      break;
    case DATA_OUT:
      sys_wri_pio(DATA_OUT  ,level);
      break;
    case ENABLE_OUT:
      sys_wri_pio(ENABLE_OUT,level);
      break;
    }
}

void delay_msec_function( wait )
    int wait;
    {
    dly_tsk (wait);
    }

#include "../kanji_functions/sg12864a.c"
#include "../kanji_functions/shift_jis_to_display.c"
// -------------------------------



/******************************************************************************
*
* sec_init - initialize ethernet to serial converter


略


/******************************************************************************
*
* sec_update - update ethernet to serial converter
*/
略

    mode = 2;

    if (chan == 0)//1ch分のみ稼動  if(mode != 0)を変更
	{
        /* task1起動 */

        /* task2起動 */

略



/******************************************************************************
*
* sec_task1 - network receive task
*
* RETURNS: N/A
*/

static void sec_task1 (UW args)
    {

略



	    case SEC_PHASE_CONNECT:


略

		if (ret == 0)


略


		else{
   //ret = sio_write を消去
   //--------------
            shift_jis_to_display( buffer, ret );
   //--------------
   	        net_write (chan, buffer, ret, SEC_TIMEOUT);
            }

        break;

/******************************************************************************
*
* sec_task2 - serial receive task
*
* RETURNS: N/A
*/

static void sec_task2 (UW args)
{
    int chan = (int)args;

    reg_lock();
    reg_tbl.net[chan].display[0]='\0';//Web入力用文字列を初期化
    reg_unlock();

  //--------------
    unsigned char ipaddr[4];
    unsigned char ipmask[4];
    char str1[]={0x8a,0xbf,0x8e,0x9a,0x83,0x66,0x83,0x42,0x83,0x58,0x83,0x76,0x83,0x8c,0x83,0x43};//"漢字ディスプレイ"
    char str2[]={0x82,0x6b,0x82,0x60,0x82,0x6d,0x83,0x54,0x81,0x5b,0x83,0x6f};//"ＬＡＮサーバ"
    char set_to_disply_str[18];

    delay_msec_function( 100 );
    display_function(0);//ディスプレイの初期化処理
    delay_msec_function( 100 );
    display_function(400);//画面クリア
//----------------


    while (reg_tbl.net[chan].display[0]=='\0'
            && sec_param[chan].phase!=SEC_PHASE_CONNECT)
    {
//--------------
      delay_msec_function( 2000 );
      display_function(400);//画面クリア
//この部分は128bit幅のディスプレイ専用の処理です（始め）
      delay_msec_function( 800 );
      
      shift_jis_to_display( str1,  16 );
      shift_jis_to_display( str2,  12 );
      shift_jis_to_display( "    ",  4 );//半角スペース表示
      reg_lock();
      nt_addr_get (0, ipaddr, ipmask);
      if (ipaddr[0])
      {
        sprintf (set_to_disply_str, "%u.%u.%u.%u", 
        (unsigned int)(ipaddr[0]) & 0xff,
        (unsigned int)(ipaddr[1]) & 0xff, 
        (unsigned int)(ipaddr[2]) & 0xff,
        (unsigned int)(ipaddr[3]) & 0xff);
        shift_jis_to_display( set_to_disply_str, strlen(set_to_disply_str) );
        shift_jis_to_display("                ",16-(strlen(set_to_disply_str)) );

        sprintf (set_to_disply_str, "mask%u port%u",
        nt_mask2bit (ipmask), 
        reg_tbl.net[chan].port);
        shift_jis_to_display( set_to_disply_str, strlen(set_to_disply_str) );
        shift_jis_to_display("                ",16-(strlen(set_to_disply_str)) );
      }
      reg_unlock();
//この部分は128bit幅のディスプレイ専用の処理です（終わり）
//-------------------

    }// while-loop

    while (1)
    {
      if( reg_tbl.net[chan].display[0]!='\0' )//文字列代入状況チェック
      {
        reg_lock();
        if(reg_tbl.net[chan].display[0]==0x0C)
        {
          display_function(400);//画面クリア
        }
        else
        {
          shift_jis_to_display( reg_tbl.net[chan].display, 
                              strlen(reg_tbl.net[chan].display) );
        }
        reg_tbl.net[chan].display[0]='\0';//Web入力用文字列を初期化
        reg_unlock();
      }
      delay_msec_function( 1000 );
    }// while-loop

    }
