コード例 #1
0
ファイル: csqrt.c プロジェクト: bahamas10/openzfs
dcomplex
csqrt(dcomplex z) {
	dcomplex ans;
	double x, y, t, ax, ay;
	int n, ix, iy, hx, hy, lx, ly;

	x = D_RE(z);
	y = D_IM(z);
	hx = HI_WORD(x);
	lx = LO_WORD(x);
	hy = HI_WORD(y);
	ly = LO_WORD(y);
	ix = hx & 0x7fffffff;
	iy = hy & 0x7fffffff;
	ay = fabs(y);
	ax = fabs(x);
	if (ix >= 0x7ff00000 || iy >= 0x7ff00000) {
		/* x or y is Inf or NaN */
		if (ISINF(iy, ly))
			D_IM(ans) = D_RE(ans) = ay;
		else if (ISINF(ix, lx)) {
			if (hx > 0) {
				D_RE(ans) = ax;
				D_IM(ans) = ay * zero;
			} else {
				D_RE(ans) = ay * zero;
				D_IM(ans) = ax;
			}
		} else
			D_IM(ans) = D_RE(ans) = ax + ay;
	} else if ((iy | ly) == 0) {	/* y = 0 */
		if (hx >= 0) {
			D_RE(ans) = sqrt(ax);
			D_IM(ans) = zero;
		} else {
			D_IM(ans) = sqrt(ax);
			D_RE(ans) = zero;
		}
	} else if (ix >= iy) {
		n = (ix - iy) >> 20;
		if (n >= 30) {	/* x >> y or y=0 */
			t = sqrt(ax);
		} else if (ix >= 0x5f300000) {	/* x > 2**500 */
			ax *= twom601;
			y *= twom601;
			t = two300 * sqrt(ax + sqrt(ax * ax + y * y));
		} else if (iy < 0x20b00000) {	/* y < 2**-500 */
			ax *= two599;
			y *= two599;
			t = twom300 * sqrt(ax + sqrt(ax * ax + y * y));
		} else
			t = sqrt(half * (ax + sqrt(ax * ax + ay * ay)));
		if (hx >= 0) {
			D_RE(ans) = t;
			D_IM(ans) = ay / (t + t);
		} else {
			D_IM(ans) = t;
			D_RE(ans) = ay / (t + t);
		}
	} else {
コード例 #2
0
dcomplex
csinh(dcomplex z) {
	double t, x, y, S, C;
	int hx, ix, lx, hy, iy, ly, n;
	dcomplex ans;

	x = D_RE(z);
	y = D_IM(z);
	hx = HI_WORD(x);
	lx = LO_WORD(x);
	ix = hx & 0x7fffffff;
	hy = HI_WORD(y);
	ly = LO_WORD(y);
	iy = hy & 0x7fffffff;
	x = fabs(x);
	y = fabs(y);

	(void) sincos(y, &S, &C);
	if (ix >= 0x403c0000) {	/* |x| > 28 = prec/2 (14,28,34,60) */
		if (ix >= 0x40862E42) {	/* |x| > 709.78... ~ log(2**1024) */
			if (ix >= 0x7ff00000) {	/* |x| is inf or NaN */
				if ((iy | ly) == 0) {
					D_RE(ans) = x;
					D_IM(ans) = y;
				} else if (iy >= 0x7ff00000) {
					D_RE(ans) = x;
					D_IM(ans) = x - y;
				} else {
					D_RE(ans) = C * x;
					D_IM(ans) = S * x;
				}
			} else {
				/* return exp(x)=t*2**n */
				t = __k_cexp(x, &n);
				D_RE(ans) = scalbn(C * t, n - 1);
				D_IM(ans) = scalbn(S * t, n - 1);
			}
		} else {
			t = exp(x) * 0.5;
			D_RE(ans) = C * t;
			D_IM(ans) = S * t;
		}
	} else {
		if ((ix | lx) == 0) {	/* x = 0, return (0,S) */
			D_RE(ans) = 0.0;
			D_IM(ans) = S;
		} else {
			D_RE(ans) = C * sinh(x);
			D_IM(ans) = S * cosh(x);
		}
	}
	if (hx < 0)
		D_RE(ans) = -D_RE(ans);
	if (hy < 0)
		D_IM(ans) = -D_IM(ans);
	return (ans);
}
コード例 #3
0
ファイル: InterruptUtils.cpp プロジェクト: crazy-weasel/sweb
void InterruptUtils::initialise()
{
  // allocate some memory for our handlers
  GateDesc *interrupt_gates = new GateDesc[NUM_INTERRUPT_HANDLERS];

  for (uint32 i = 0; i < NUM_INTERRUPT_HANDLERS; ++i)
  {
    interrupt_gates[i].offset_low = LO_WORD(handlers[i].offset);
    interrupt_gates[i].offset_high = HI_WORD(handlers[i].offset);
    interrupt_gates[i].gate_size = GATE_SIZE_32_BIT;
    interrupt_gates[i].present = 1;
    interrupt_gates[i].reserved = 0;
    interrupt_gates[i].segment_selector = KERNEL_CS;
    interrupt_gates[i].type = TYPE_INTERRUPT_GATE;
    interrupt_gates[i].unused = 0;
    interrupt_gates[i].zeros = 0;
    interrupt_gates[i].dpl = (handlers[i].number == SYSCALL_INTERRUPT ?
        DPL_USER_SPACE : DPL_KERNEL_SPACE);
  }

  IDTR idtr;

  idtr.base =  (uint32)interrupt_gates;
  idtr.limit = sizeof(GateDesc)*NUM_INTERRUPT_HANDLERS - 1;
  lidt(&idtr);
}
コード例 #4
0
/** LRW "logical memory read / write" primitive plus Clock Distribution. Blocking.
 * Frame consists of two datagrams, one LRW and one FPRMW.
 *
 * @param[in] LogAdr		= Logical memory address
 * @param[in] length		= length of databuffer
 * @param[in,out] data		= databuffer to write to and read from slave.
 * @param[in] DCrs			= Distributed Clock reference slave address.
 * @param[out] DCtime		= DC time read from reference slave.
 * @param[in] timeout		= timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ec_LRWDC(uint32 LogAdr, uint16 length, void *data, uint16 DCrs, int64 *DCtime, int timeout)
{
    uint16 DCtO;
    uint8 idx;
	int wkc;
	uint64 DCtE;

    idx = ec_getindex();
	/* LRW in first datagram */
    ec_setupdatagram(&ec_txbuf[idx], EC_CMD_LRW, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data);
	/* FPRMW in second datagram */
	DCtE = htoell(*DCtime);
    DCtO = ec_adddatagram(&ec_txbuf[idx], EC_CMD_FRMW, idx, FALSE, DCrs, ECT_REG_DCSYSTIME, sizeof(DCtime), &DCtE);
    wkc = ec_srconfirm(idx, timeout);
    if ((wkc > 0) && (ec_rxbuf[idx][EC_CMDOFFSET] == EC_CMD_LRW))
    {
        memcpy(data, &ec_rxbuf[idx][EC_HEADERSIZE], length);
		memcpy(&wkc, &ec_rxbuf[idx][EC_HEADERSIZE + length], EC_WKCSIZE);
		memcpy(&DCtE, &ec_rxbuf[idx][DCtO], sizeof(*DCtime));
		*DCtime = etohll(DCtE);
    }
    ec_setbufstat(idx, EC_BUF_EMPTY);

    return wkc;
}
コード例 #5
0
ファイル: InterruptUtils.cpp プロジェクト: stormycatcat/sweb
void InterruptUtils::initialise()
{
  uint32 num_handlers = 0;
  for (uint32 i = 0; handlers[i].offset != 0; ++i)
    num_handlers = handlers[i].number;
  ++num_handlers;
  // allocate some memory for our handlers
  GateDesc *interrupt_gates = new GateDesc[num_handlers];
  size_t dummy_handler_sled_size = (((size_t) arch_dummyHandlerMiddle) - (size_t) arch_dummyHandler);
  assert((dummy_handler_sled_size % 128) == 0 && "cannot handle weird padding in the kernel binary");
  dummy_handler_sled_size /= 128;

  uint32 j = 0;
  for (uint32 i = 0; i < num_handlers; ++i)
  {
    while (handlers[j].number < i && handlers[j].offset != 0)
      ++j;
    interrupt_gates[i].offset_low = LO_WORD((handlers[j].number == i && handlers[j].offset != 0) ? (size_t)handlers[j].offset : (((size_t)arch_dummyHandler)+i*dummy_handler_sled_size));
    interrupt_gates[i].offset_high = HI_WORD((handlers[j].number == i && handlers[j].offset != 0) ? (size_t)handlers[j].offset : (((size_t)arch_dummyHandler)+i*dummy_handler_sled_size));
    interrupt_gates[i].gate_size = GATE_SIZE_32_BIT;
    interrupt_gates[i].present = 1;
    interrupt_gates[i].reserved = 0;
    interrupt_gates[i].segment_selector = KERNEL_CS;
    interrupt_gates[i].type = TYPE_INTERRUPT_GATE;
    interrupt_gates[i].unused = 0;
    interrupt_gates[i].zeros = 0;
    interrupt_gates[i].dpl = ((i == SYSCALL_INTERRUPT && handlers[j].number == i) ? DPL_USER_SPACE : DPL_KERNEL_SPACE);
  }

  IDTR idtr;

  idtr.base = (uint32) interrupt_gates;
  idtr.limit = sizeof(GateDesc) * num_handlers - 1;
  lidt(&idtr);
}
コード例 #6
0
ファイル: InterruptUtils.cpp プロジェクト: dkales/sweb
void InterruptUtils::initialise()
{
  uint32 num_handlers = 0;
  for (uint32 i = 0; handlers[i].offset != 0; ++i)
    num_handlers = handlers[i].number;
  ++num_handlers;
  // allocate some memory for our handlers
  GateDesc *interrupt_gates = new GateDesc[num_handlers];

  uint32 j = 0;
  for (uint32 i = 0; i < num_handlers; ++i)
  {
    while (handlers[j].number < i && handlers[j].offset != 0)
      ++j;
    interrupt_gates[i].offset_low = LO_WORD((handlers[j].number == i && handlers[j].offset != 0) ? handlers[j].offset : arch_dummyHandler);
    interrupt_gates[i].offset_high = HI_WORD((handlers[j].number == i && handlers[j].offset != 0) ? handlers[j].offset : arch_dummyHandler);
    interrupt_gates[i].gate_size = GATE_SIZE_32_BIT;
    interrupt_gates[i].present = 1;
    interrupt_gates[i].reserved = 0;
    interrupt_gates[i].segment_selector = KERNEL_CS;
    interrupt_gates[i].type = TYPE_INTERRUPT_GATE;
    interrupt_gates[i].unused = 0;
    interrupt_gates[i].zeros = 0;
    interrupt_gates[i].dpl = ((i == SYSCALL_INTERRUPT && handlers[j].number == i) ? DPL_USER_SPACE : DPL_KERNEL_SPACE);
  }

  IDTR idtr;

  idtr.base = (uint32) interrupt_gates;
  idtr.limit = sizeof(GateDesc) * num_handlers - 1;
  lidt(&idtr);
}
コード例 #7
0
// --------------------------------------------------------------------------
// Menu Callback
// --------------------------------------------------------------------------
int Setup_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        uwItemId = LO_WORD(uiParam);
        uwOption = HI_WORD(uiParam);

        switch (uwItemId)
        {
        case IDM_AUTO_POWER_OFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_POWEROFF, 1, uwOption);
            break;

        case IDM_BEEP:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_BEEPKEY, 1, uwOption);
            break;

        case IDM_LANGUAGE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LANGUAGE, 1, uwOption);
            break;

        case IDM_TV_MODE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_TVFORMAT, 1, uwOption);
            break;

        case IDM_FREQUENCY:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_FREQ, 1, uwOption);
            break;

        case IDM_SENSOR_ROTATE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_SENSOR_ROTATE, 1, uwOption);
            break;
        case IDM_LCDOFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LCDOFF, 1, uwOption);
            break;

        case IDM_LEDSET:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LED, 1, uwOption);
            break;			
        case IDM_DELAYOFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_DELAYOFF, 1, uwOption);
            break;
		case IDM_MOVIE_PARKING:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIEPARKING, 1, uwOption);
            break;
		case IDM_SETUP_MODE:
			Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_MODE_SEL, 1, uwOption);
            break;

        }
    }

    return TMF_PROCESSED;
}
コード例 #8
0
ファイル: MenuSetup.c プロジェクト: magic-gjh/NT96655_FHD6600
// --------------------------------------------------------------------------
// Menu Callback
// --------------------------------------------------------------------------
int Setup_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        uwItemId = LO_WORD(uiParam);
        uwOption = HI_WORD(uiParam);

        switch (uwItemId)
        {
        case IDM_AUTO_POWER_OFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_POWEROFF, 1, uwOption);
            break;

        case IDM_BEEP:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_BEEPKEY, 1, uwOption);
            break;

        case IDM_LANGUAGE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LANGUAGE, 1, uwOption);
            break;

        case IDM_TV_MODE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_TVFORMAT, 1, uwOption);
            break;

        case IDM_FREQUENCY:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_FREQ, 1, uwOption);
            break;

        case IDM_SENSOR_ROTATE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_SENSOR_ROTATE, 1, uwOption);
            break;
        case IDM_LCDOFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LCDOFF, 1, uwOption);
            break;
        case IDM_WIFI:
            //Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_WIFI, 1, uwOption);
            if (uwOption == WIFI_ON)
            {
                if(gMovData.State==MOV_ST_REC)
                {
                FlowMovie_StopRec();
                }
                Ux_OpenWindow(&UIMenuWndWiFiWaitCtrl, 0);
                BKG_PostEvent(NVTEVT_BKW_WIFI_ON);
            }
            break;
        }
    }

    return TMF_PROCESSED;
}
コード例 #9
0
/** LWR "logical memory write" primitive. Blocking.
 *
 * @param[in] LogAdr		= Logical memory address
 * @param[in] length		= length of databuffer
 * @param[in] data			= databuffer to write to slave.
 * @param[in] timeout		= timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ec_LWR(uint32 LogAdr, uint16 length, void *data, int timeout)
{
    uint8 idx;
	int wkc;

    idx = ec_getindex();
    ec_setupdatagram(&ec_txbuf[idx], EC_CMD_LWR, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data);
    wkc = ec_srconfirm(idx, timeout);
    ec_setbufstat(idx, EC_BUF_EMPTY);

    return wkc;
}
コード例 #10
0
ファイル: ethercatbase.cpp プロジェクト: TABETA/SOEM
/** LWR "logical memory write" primitive. Blocking.
 *
 * @param[in] port        = port context struct
 * @param[in] LogAdr      = Logical memory address
 * @param[in] length      = length of databuffer
 * @param[in] data        = databuffer to write to slave.
 * @param[in] timeout     = timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ecx_portt::LWR(uint32 LogAdr, uint16 length, void *data, int timeout)
{
	uint8 idx;
	int wkc;

	idx = getindex();
	txbuf[idx].setupdatagram(EC_CMD_LWR, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data, &txbuflength[idx]);
	wkc = srconfirm(idx, timeout);
	setbufstat(idx, EC_BUF_EMPTY);

	return wkc;
}
コード例 #11
0
ファイル: ethercatbase.cpp プロジェクト: TABETA/SOEM
/** LRD "logical memory read" primitive. Blocking.
 *
 * @param[in] port        = port context struct
 * @param[in]  LogAdr     = Logical memory address
 * @param[in]  length     = length of bytes to read from slave.
 * @param[out] data       = databuffer to read from slave.
 * @param[in]  timeout    = timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ecx_portt::LRD(uint32 LogAdr, uint16 length, void *data, int timeout)
{
	uint8 idx;
	int wkc;

	idx = getindex();
	setupdatagram(&(txbuf[idx]), EC_CMD_LRD, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data);
	wkc = srconfirm(idx, timeout);
	if ((wkc > 0) && (rxbuf[idx].getCommand() == EC_CMD_LRD))
	{
		rxbuf[idx].copyHeader(data, length);
	}
	setbufstat(idx, EC_BUF_EMPTY);

	return wkc;
}
コード例 #12
0
/** LRD "logical memory read" primitive. Blocking.
 *
 * @param[in] LogAdr		= Logical memory address
 * @param[in] length		= length of bytes to read from slave.
 * @param[out] data			= databuffer to read from slave.
 * @param[in] timeout		= timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ec_LRD(uint32 LogAdr, uint16 length, void *data, int timeout)
{
    uint8 idx;
	int wkc;

    idx = ec_getindex();
    ec_setupdatagram(&ec_txbuf[idx], EC_CMD_LRD, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data);
    wkc = ec_srconfirm(idx, timeout);
    if ((wkc > 0) && (ec_rxbuf[idx][EC_CMDOFFSET]==EC_CMD_LRD))
    {
        memcpy(data, &ec_rxbuf[idx][EC_HEADERSIZE], length);
    }
    ec_setbufstat(idx, EC_BUF_EMPTY);

    return wkc;
}
コード例 #13
0
ファイル: launcher.c プロジェクト: e8johan/oaesis
launcher_main(void)
#endif
{
  OBJECT * desktop_bg;
  OBJECT * menu;
  
  int      ap_id;  

  /* Pdomain (1); FIXME decide where to put this */
  /* Get application id */
  ap_id = appl_init();

  /* Fix resource data */
  rsrc_rcfix(launch);

  /* Get address of desktop background */
  rsrc_gaddr(R_TREE, DESKBG, &desktop_bg);

  /* Set desktop background */
  wind_set(0,
           WF_NEWDESK,
           HI_WORD(desktop_bg),
           LO_WORD(desktop_bg),
           0,
           0);

  /* Get address of the menu */
  rsrc_gaddr(R_TREE, MENU, &menu);

  /* Install menu */
  menu_bar(menu, MENU_INSTALL);

  /* Register launcher as "oAESis" */
  menu_register(ap_id, "  oAESis");

  graf_mouse(ARROW, 0L);

  start_programs();

  updatewait();

  appl_exit();
        
  return 0;
}
コード例 #14
0
ファイル: ethercatbase.cpp プロジェクト: TABETA/SOEM
/** LRW "logical memory read / write" primitive plus Clock Distribution. Blocking.
 * Frame consists of two datagrams, one LRW and one FPRMW.
 *
 * @param[in] port        = port context struct
 * @param[in]     LogAdr  = Logical memory address
 * @param[in]     length  = length of databuffer
 * @param[in,out] data    = databuffer to write to and read from slave.
 * @param[in]     DCrs    = Distributed Clock reference slave address.
 * @param[out]    DCtime  = DC time read from reference slave.
 * @param[in]     timeout = timeout in us, standard is EC_TIMEOUTRET
 * @return Workcounter or EC_NOFRAME
 */
int ecx_portt::LRWDC(uint32 LogAdr, uint16 length, void *data, uint16 DCrs, int64 *DCtime, int timeout)
{
	uint8 idx = getindex();
	/* LRW in first datagram */
	setupdatagram(&(txbuf[idx]), EC_CMD_LRW, idx, LO_WORD(LogAdr), HI_WORD(LogAdr), length, data);
	/* FPRMW in second datagram */
	uint64 DCtE = htoell(*DCtime);
	uint16 DCtO = adddatagram(EC_CMD_FRMW, idx, FALSE, DCrs, ECT_REG_DCSYSTIME, sizeof(DCtime), &DCtE);
	int wkc = srconfirm(idx, timeout);
	if ((wkc > 0) && (rxbuf[idx].getCommand() == EC_CMD_LRW))
	{
		rxbuf[idx].copyHeader(data, length);
		wkc = rxbuf[idx].getWorkCounter(length);
		*DCtime = rxbuf[idx].getDCTime(DCtO);
		
	}
	setbufstat(idx, EC_BUF_EMPTY);

	return wkc;
}
コード例 #15
0
#endif
};

// for index end
uint8_t gHIDProtocolMode = REPORT_PROCOCOL_MODE;
uint8_t gHIDSuspandMode = 0;
HID_INFO_ATTRB cHidInfo = {0, 0, 0x0100};

const TAttribAppl HIDSAttrTbl[] =
{
    /*--------------------------HID Service ---------------------------*/
    /* <<Primary Service>>, .. 0*/
    {
        (ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE),  /* wFlags     */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_PRIMARY_SERVICE),
            HI_WORD(GATT_UUID_PRIMARY_SERVICE),
            LO_WORD(GATT_UUID_HID),               /* service UUID */
            HI_WORD(GATT_UUID_HID)
        },
        UUID_16BIT_SIZE,                            /* bValueLen     */
        NULL,                                       /* pValueContext */
        GATT_PERM_READ_AUTHEN_REQ                              /* wPermissions  */
    },
    /* <<Characteristic>>, .. 1*/
    {
        ATTRIB_FLAG_VALUE_INCL,                     /* wFlags */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_CHARACTERISTIC),
            HI_WORD(GATT_UUID_CHARACTERISTIC),
            GATT_CHAR_PROP_READ,                    /* characteristic properties */
コード例 #16
0
 uint8 PrepareCycPacket(uint8 FrameIndex)
 {
    boolean more=TRUE;
    uint8 idx,cmd,i;
   
   uint8 *data;
   uint16 ADP, ADO;
   uint16 Datalength;
   uint16 IOoffset;
   
   CycFrame[FrameIndex].nInfo=ec_Frame[FrameIndex].NumCmd;
   CycFrame[FrameIndex].timeout=EC_TIMEOUTRET;
   //index
	  idx=ec_getindex();
	  CycFrame[FrameIndex].nIdx=idx;
	  
   //buffer
      CycFrame[FrameIndex].FrameBuffer=&ec_txbuf[idx];
	  CycFrame[FrameIndex].FrameStatus=&ec_rxbufstat[idx];
	  
    for (i=0;i<CycFrame[FrameIndex].nInfo;i++)
	    {
		  if (i==(CycFrame[FrameIndex].nInfo-1))//is the last command?
		      more=FALSE;
			  
			//cmd
		 if (ec_Frame[FrameIndex].FrameCmds[i].state& ec_slave[0].state)
		     cmd=ec_Frame[FrameIndex].FrameCmds[i].cmd;
			 else cmd=EC_CMD_NOP;
			 
		 //length	 
		 Datalength=ec_Frame[FrameIndex].FrameCmds[i].DataLength;
		 CycFrame[FrameIndex].length[i]=Datalength;
		 
		 //data default
		 data=(uint8 *)malloc(Datalength);
		 memset(data, 0, Datalength);
		 
		 //IO map offset
		 IOoffset=ec_Frame[FrameIndex].FrameCmds[i].Offs+DATAOFFS+FrameIndex*PROCOFFS; //(offset of the command in the frame) + (offset of data in the command) + (Number of Frame * 1536)
		 
		 //address & data
		 switch (cmd)
		 { case EC_CMD_LRD:
		      ADP=LO_WORD(ec_Frame[FrameIndex].FrameCmds[i].laddr);
		      ADO=HI_WORD(ec_Frame[FrameIndex].FrameCmds[i].laddr);
			 
			  CycFrame[FrameIndex].RXdatabuffer[i]=&InProc[IOoffset];
		      break;
			  
			case EC_CMD_NOP:
			   ADP=0x0000;
			   ADO=0x0100;
			  break;
			  
			case EC_CMD_LRW:
            case EC_CMD_LWR:
			    ADP=LO_WORD(ec_Frame[FrameIndex].FrameCmds[i].laddr);
		        ADO=HI_WORD(ec_Frame[FrameIndex].FrameCmds[i].laddr);
			    if (ec_slave[0].state==EC_STATE_OPERATIONAL)
			        memcpy(data, &OutProc[IOoffset], Datalength);
				CycFrame[FrameIndex].TXdatabuffer[i]=&OutProc[IOoffset];
                CycFrame[FrameIndex].RXdatabuffer[i]=&InProc[IOoffset];				
				break;
			default:
		    ADP=ec_Frame[FrameIndex].FrameCmds[i].ADP;
			ADO=ec_Frame[FrameIndex].FrameCmds[i].ADO;
		     break;
		 } 
		 //expected wkc
		 CycFrame[FrameIndex].ExpectedWKC[i]=ec_Frame[FrameIndex].FrameCmds[i].cnt;
		 
		 //build frame
		 if (i==0) //the frame is empty?
		      {ec_setupdatagram(&ec_txbuf[idx], cmd, idx, ADP, ADO, Datalength, data);
			  CycFrame[FrameIndex].DataOffset[i]=DATAOFFS+2;} //in ec_rxbuf is stored the frame without Ethernet header (12 byte),
			                                                  //so data of first datagram are located after EtherCAT header(2 byte)
															  //and datagram header (10 byte)
          else
            CycFrame[FrameIndex].DataOffset[i]=ec_adddatagram(&ec_txbuf[idx], cmd, idx, more, ADP, ADO, Datalength, data);
             
    	free(data);	 
		}
	   
	return idx;
}	
コード例 #17
0
ファイル: MenuMovie.c プロジェクト: github188/NT9665X_GMD_V18
int Movie_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        uwItemId = LO_WORD(uiParam);
        uwOption = HI_WORD(uiParam);

        switch (uwItemId)
        {
        case IDM_MOVIE_SIZE:
        case IDM_MOVIE_SIZE_DUAL:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIESIZE, 1, uwOption);
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_IMAGE_RATIO, 1, uwOption);
            break;

        case IDM_EV:
            Ux_SendEvent(&CustomPhotoObjCtrl, NVTEVT_EXE_EV, 1, uwOption);
            break;

        case IDM_MOVIE_HDR:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIE_HDR, 1, uwOption);
            break;

#if (_MULTI_RECORD_FUNC_)
        case IDM_MOVIE_DUAL_REC:
            {
                UINT32 uiSelect = (uwOption == 0) ? FALSE : TRUE; // according to option order
                Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_DUAL_REC, 1, uiSelect);
                Movie_MenuSizeConfig();
            }
            {
                // set image ratio
                UINT32 uiSize;
                uiSize = SysGetFlag(FL_MOVIE_DUAL_REC) ? SysGetFlag(FL_MOVIE_SIZE_DUAL) : SysGetFlag(FL_MOVIE_SIZE);
                Ux_SendEvent(&CustomMovieObjCtrl,NVTEVT_EXE_MOVIESIZE, 1, uiSize);
                Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_IMAGE_RATIO, 1, uiSize);
            }
            break;
#endif

        case IDM_MOVIE_CYCLIC_REC:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_CYCLIC_REC, 1, uwOption);
            break;

        case IDM_MOVIE_TIMELAPSE_REC:
            SysSetFlag(FL_MOVIE_TIMELAPSE_REC,uwOption);
            break;

        case IDM_MOVIE_MOTION_DET:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOTION_DET, 1, uwOption);
            break;

        case IDM_MOVIE_AUDIO:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIE_AUDIO, 1, uwOption);
            break;

        case IDM_MOVIE_DATEIMPRINT:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIE_DATE_IMPRINT, 1, uwOption);
            break;
			
	  case IDM_CAR_NUM:
	  	if(uwOption==1)
	  	{
	            if ((SysGetFlag(FL_LANGUAGE) == LANG_SC)||(SysGetFlag(FL_LANGUAGE) == LANG_TC)) 
	            {
	                Ux_OpenWindow(&UIMenuWndSetupCarNumberCtrl, 1, 0);
	            }
	            else
	            {
	                Ux_OpenWindow(&UIMenuWndSetupCommonCarNumberCtrl, 1, 0);
	            }		
		}
	  	break;
		
        case IDM_MOVIE_GSENSOR:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_GSENSOR,1,uwOption);
            break;
			
        case IDM_MOVIE_PARKING:
            Ux_SendEvent(&CustomMovieObjCtrl, NVTEVT_EXE_MOVIEPARKING, 1, uwOption);
            break;
			
        default:
            Setup_MenuCallback(uiMessage, uiParam);
            break;
        }
    }
    else if (uiMessage == TMM_ENTER_ITEM)
    {
        Movie_MenuSizeConfig();
    }

    return TMF_PROCESSED;
}
コード例 #18
0
static uint8_t simpleCharCtlPntValue[3] = {0};
/**<  simple BLE profile control point indication enable flag. */
static uint8_t simpleCharCtlPntIndFlag = GATT_CLIENT_CHAR_CONFIG_DEFAULT;
/**<  Function pointer used to send event to application from simple profile. Initiated in SimpBleService_AddService. */
static pfnAPPHandleInfoCB_t pfnSimpBleServiceCB = NULL;

bool SimpBleService_V5Indicate( uint8_t ServiceId, uint8_t OpCode, uint8_t RspCode );

/**< @brief  profile/service definition.  */
const TAttribAppl simple_ble_service_tbl[] =
{
    /* <<Primary Service>>, .. */
    {
        (ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE),  /* wFlags     */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_PRIMARY_SERVICE),
            HI_WORD(GATT_UUID_PRIMARY_SERVICE),
            LO_WORD(GATT_UUID_SIMPLE_PROFILE),      /* service UUID */
            HI_WORD(GATT_UUID_SIMPLE_PROFILE)
        },
        UUID_16BIT_SIZE,                            /* bValueLen     */
        NULL,                                       /* pValueContext */
        GATT_PERM_READ                              /* wPermissions  */
    },
    /* <<Characteristic>> demo for read */
    {
        ATTRIB_FLAG_VALUE_INCL,                     /* wFlags */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_CHARACTERISTIC),
            HI_WORD(GATT_UUID_CHARACTERISTIC),
            GATT_CHAR_PROP_READ  /* characteristic properties */
コード例 #19
0
/** Enumerate and init all slaves.
 *
 * @param[in]  context        = context struct
 * @param[in] usetable     = TRUE when using configtable to init slaves, FALSE otherwise
 * @return Workcounter of slave discover datagram = number of slaves found
 */
int ecx_config_init(ecx_contextt *context, uint8 usetable)
{
   uint16 w, slave, ADPh, configadr, ssigen;
   uint16 topology, estat;
   int16 topoc, slavec, aliasadr;
   uint8 b,h;
   uint8 zbuf[64];
   uint8 SMc;
   uint32 eedat;
   int wkc, cindex, nSM, lp;

   EC_PRINT("ec_config_init %d\n",usetable);
   *(context->slavecount) = 0;
   /* clean ec_slave array */
   memset(context->slavelist, 0x00, sizeof(ec_slavet) * context->maxslave);
   memset(&zbuf, 0x00, sizeof(zbuf));
   memset(context->grouplist, 0x00, sizeof(ec_groupt) * context->maxgroup);
   /* clear slave eeprom cache */
   ecx_siigetbyte(context, 0, EC_MAXEEPBUF);
   
   for(lp = 0; lp < context->maxgroup; lp++)
   {
      context->grouplist[lp].logstartaddr = lp << 16; /* default start address per group entry */
   }
   /* make special pre-init register writes to enable MAC[1] local administered bit *
    * setting for old netX100 slaves */
   b = 0x00;
   ecx_BWR(context->port, 0x0000, ECT_REG_DLALIAS, sizeof(b), &b, EC_TIMEOUTRET3);    /* Ignore Alias register */
   b = EC_STATE_INIT | EC_STATE_ACK;
   ecx_BWR(context->port, 0x0000, ECT_REG_ALCTL, sizeof(b), &b, EC_TIMEOUTRET3);      /* Reset all slaves to Init */
   /* netX100 should now be happy */
   
   wkc = ecx_BWR(context->port, 0x0000, ECT_REG_ALCTL, sizeof(b), &b, EC_TIMEOUTRET3);      /* Reset all slaves to Init */
   printf("wkc = %d\n",wkc);
   
   w = 0x0000;
   wkc = ecx_BRD(context->port, 0x0000, ECT_REG_TYPE, sizeof(w), &w, EC_TIMEOUTSAFE);   /* detect number of slaves */
   if (wkc > 0)
   {
      *(context->slavecount) = wkc;
      b = 0x00;
      ecx_BWR(context->port, 0x0000, ECT_REG_DLPORT, sizeof(b), &b, EC_TIMEOUTRET3);     /* deact loop manual */
      w = htoes(0x0004);
      ecx_BWR(context->port, 0x0000, ECT_REG_IRQMASK, sizeof(w), &w, EC_TIMEOUTRET3);    /* set IRQ mask */
      ecx_BWR(context->port, 0x0000, ECT_REG_RXERR, 8, &zbuf, EC_TIMEOUTRET3);           /* reset CRC counters */
      ecx_BWR(context->port, 0x0000, ECT_REG_FMMU0, 16 * 3, &zbuf, EC_TIMEOUTRET3);      /* reset FMMU's */
      ecx_BWR(context->port, 0x0000, ECT_REG_SM0, 8 * 4, &zbuf, EC_TIMEOUTRET3);         /* reset SyncM */
      ecx_BWR(context->port, 0x0000, ECT_REG_DCSYSTIME, 4, &zbuf, EC_TIMEOUTRET3);       /* reset system time+ofs */
      w = htoes(0x1000);
      ecx_BWR(context->port, 0x0000, ECT_REG_DCSPEEDCNT, sizeof(w), &w, EC_TIMEOUTRET3); /* DC speedstart */
      w = htoes(0x0c00);
      ecx_BWR(context->port, 0x0000, ECT_REG_DCTIMEFILT, sizeof(w), &w, EC_TIMEOUTRET3); /* DC filt expr */
      b = 0x00;
      ecx_BWR(context->port, 0x0000, ECT_REG_DLALIAS, sizeof(b), &b, EC_TIMEOUTRET3);    /* Ignore Alias register */
      b = EC_STATE_INIT | EC_STATE_ACK;
      ecx_BWR(context->port, 0x0000, ECT_REG_ALCTL, sizeof(b), &b, EC_TIMEOUTRET3);      /* Reset all slaves to Init */
      b = 2;
      ecx_BWR(context->port, 0x0000, ECT_REG_EEPCFG, sizeof(b), &b , EC_TIMEOUTRET3);    /* force Eeprom from PDI */
      b = 0;
      ecx_BWR(context->port, 0x0000, ECT_REG_EEPCFG, sizeof(b), &b , EC_TIMEOUTRET3);    /* set Eeprom to master */
      
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         ADPh = (uint16)(1 - slave);
         context->slavelist[slave].Itype = 
            etohs(ecx_APRDw(context->port, ADPh, ECT_REG_PDICTL, EC_TIMEOUTRET3)); /* read interface type of slave */
         /* a node offset is used to improve readibility of network frames */
         /* this has no impact on the number of addressable slaves (auto wrap around) */
         ecx_APWRw(context->port, ADPh, ECT_REG_STADR, htoes(slave + EC_NODEOFFSET) , EC_TIMEOUTRET3); /* set node address of slave */
         if (slave == 1) 
         {
            b = 1; /* kill non ecat frames for first slave */
         }
         else 
         {
            b = 0; /* pass all frames for following slaves */
         }
         ecx_APWRw(context->port, ADPh, ECT_REG_DLCTL, htoes(b), EC_TIMEOUTRET3); /* set non ecat frame behaviour */
         configadr = etohs(ecx_APRDw(context->port, ADPh, ECT_REG_STADR, EC_TIMEOUTRET3));
         context->slavelist[slave].configadr = configadr;
         ecx_FPRD(context->port, configadr, ECT_REG_ALIAS, sizeof(aliasadr), &aliasadr, EC_TIMEOUTRET3);
         context->slavelist[slave].aliasadr = etohs(aliasadr);
         ecx_FPRD(context->port, configadr, ECT_REG_EEPSTAT, sizeof(estat), &estat, EC_TIMEOUTRET3);
         estat = etohs(estat);
         if (estat & EC_ESTAT_R64) /* check if slave can read 8 byte chunks */
         {
            context->slavelist[slave].eep_8byte = 1;
         }
         ecx_readeeprom1(context, slave, ECT_SII_MANUF); /* Manuf */
      }
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         context->slavelist[slave].eep_man = 
            etohl(ecx_readeeprom2(context, slave, EC_TIMEOUTEEP)); /* Manuf */
         ecx_readeeprom1(context, slave, ECT_SII_ID); /* ID */
      }
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         context->slavelist[slave].eep_id = 
            etohl(ecx_readeeprom2(context, slave, EC_TIMEOUTEEP)); /* ID */
         ecx_readeeprom1(context, slave, ECT_SII_REV); /* revision */
      }
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         context->slavelist[slave].eep_rev = 
            etohl(ecx_readeeprom2(context, slave, EC_TIMEOUTEEP)); /* revision */
         ecx_readeeprom1(context, slave, ECT_SII_RXMBXADR); /* write mailbox address + mailboxsize */
      }
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         eedat = etohl(ecx_readeeprom2(context, slave, EC_TIMEOUTEEP)); /* write mailbox address and mailboxsize */
         context->slavelist[slave].mbx_wo = (uint16)LO_WORD(eedat);
         context->slavelist[slave].mbx_l = (uint16)HI_WORD(eedat);
         if (context->slavelist[slave].mbx_l > 0) 
         {
            ecx_readeeprom1(context, slave, ECT_SII_TXMBXADR); /* read mailbox offset */
         }
      }
      for (slave = 1; slave <= *(context->slavecount); slave++)
      {
         if (context->slavelist[slave].mbx_l > 0) 
         {
            eedat = etohl(ecx_readeeprom2(context, slave, EC_TIMEOUTEEP)); /* read mailbox offset */
            context->slavelist[slave].mbx_ro = (uint16)LO_WORD(eedat); /* read mailbox offset */
            context->slavelist[slave].mbx_rl = (uint16)HI_WORD(eedat); /*read mailbox length */
            if (context->slavelist[slave].mbx_rl == 0)
            {
               context->slavelist[slave].mbx_rl = context->slavelist[slave].mbx_l;
            }
         }
         configadr = context->slavelist[slave].configadr;
         if ((etohs(ecx_FPRDw(context->port, configadr, ECT_REG_ESCSUP, EC_TIMEOUTRET3)) & 0x04) > 0)  /* Support DC? */
         {   
            context->slavelist[slave].hasdc = TRUE;
         }
         else
         {
            context->slavelist[slave].hasdc = FALSE;
         }
         topology = etohs(ecx_FPRDw(context->port, configadr, ECT_REG_DLSTAT, EC_TIMEOUTRET3)); /* extract topology from DL status */
         h = 0; 
         b = 0;
         if ((topology & 0x0300) == 0x0200) /* port0 open and communication established */
         {
            h++;
            b |= 0x01;
         }
         if ((topology & 0x0c00) == 0x0800) /* port1 open and communication established */
         {
            h++;
            b |= 0x02;
         }
         if ((topology & 0x3000) == 0x2000) /* port2 open and communication established */
         {
            h++;
            b |= 0x04;
         }
         if ((topology & 0xc000) == 0x8000) /* port3 open and communication established */
         {
            h++;
            b |= 0x08;
         }
         /* ptype = Physical type*/
         context->slavelist[slave].ptype = 
            LO_BYTE(etohs(ecx_FPRDw(context->port, configadr, ECT_REG_PORTDES, EC_TIMEOUTRET3)));
         context->slavelist[slave].topology = h;
         context->slavelist[slave].activeports = b;
         /* 0=no links, not possible             */
         /* 1=1 link  , end of line              */
         /* 2=2 links , one before and one after */
         /* 3=3 links , split point              */
         /* 4=4 links , cross point              */
         /* search for parent */
         context->slavelist[slave].parent = 0; /* parent is master */
         if (slave > 1)
         {
            topoc = 0; 
            slavec = slave - 1;
            do
            {
               topology = context->slavelist[slavec].topology;
               if (topology == 1)
               {
                  topoc--; /* endpoint found */
               }
               if (topology == 3)
               {
                  topoc++; /* split found */
               }
               if (topology == 4)
               {
                  topoc += 2; /* cross found */
               }
               if (((topoc >= 0) && (topology > 1)) ||
                   (slavec == 1)) /* parent found */
               {
                  context->slavelist[slave].parent = slavec;
                  slavec = 1;
               }
               slavec--;
            }
            while (slavec > 0);
         }

         w = ecx_statecheck(context, slave, EC_STATE_INIT,  EC_TIMEOUTSTATE); //* check state change Init */
   
         /* set default mailbox configuration if slave has mailbox */
         if (context->slavelist[slave].mbx_l>0)
         {   
            context->slavelist[slave].SMtype[0] = 1;
            context->slavelist[slave].SMtype[1] = 2;
            context->slavelist[slave].SMtype[2] = 3;
            context->slavelist[slave].SMtype[3] = 4;
            context->slavelist[slave].SM[0].StartAddr = htoes(context->slavelist[slave].mbx_wo);
            context->slavelist[slave].SM[0].SMlength = htoes(context->slavelist[slave].mbx_l);
            context->slavelist[slave].SM[0].SMflags = htoel(EC_DEFAULTMBXSM0);
            context->slavelist[slave].SM[1].StartAddr = htoes(context->slavelist[slave].mbx_ro);
            context->slavelist[slave].SM[1].SMlength = htoes(context->slavelist[slave].mbx_rl);
            context->slavelist[slave].SM[1].SMflags = htoel(EC_DEFAULTMBXSM1);
            context->slavelist[slave].mbx_proto = 
               ecx_readeeprom(context, slave, ECT_SII_MBXPROTO, EC_TIMEOUTEEP);
         }   
         cindex = 0;
         #ifdef EC_VER1
         /* use configuration table ? */
         if (usetable)
         {
            cindex = ec_findconfig( context->slavelist[slave].eep_man, context->slavelist[slave].eep_id );
            context->slavelist[slave].configindex= cindex;
         }
         /* slave found in configuration table ? */
         if (cindex)
         {
            context->slavelist[slave].Dtype = ec_configlist[cindex].Dtype;            
            strcpy(context->slavelist[slave].name ,ec_configlist[cindex].name);
            context->slavelist[slave].Ibits = ec_configlist[cindex].Ibits;
            context->slavelist[slave].Obits = ec_configlist[cindex].Obits;
            if (context->slavelist[slave].Obits)
            {
               context->slavelist[slave].FMMU0func = 1;
            }
            if (context->slavelist[slave].Ibits)
            {
               context->slavelist[slave].FMMU1func = 2;
            }
            context->slavelist[slave].FMMU[0].FMMUactive = ec_configlist[cindex].FM0ac;
            context->slavelist[slave].FMMU[1].FMMUactive = ec_configlist[cindex].FM1ac;
            context->slavelist[slave].SM[2].StartAddr = htoes(ec_configlist[cindex].SM2a);
            context->slavelist[slave].SM[2].SMflags = htoel(ec_configlist[cindex].SM2f);
            /* simple (no mailbox) output slave found ? */
            if (context->slavelist[slave].Obits && !context->slavelist[slave].SM[2].StartAddr)
            {
               context->slavelist[slave].SM[0].StartAddr = htoes(0x0f00);
               context->slavelist[slave].SM[0].SMlength = htoes((context->slavelist[slave].Obits + 7) / 8);
               context->slavelist[slave].SM[0].SMflags = htoel(EC_DEFAULTDOSM0);         
               context->slavelist[slave].FMMU[0].FMMUactive = 1;
               context->slavelist[slave].FMMU[0].FMMUtype = 2;
               context->slavelist[slave].SMtype[0] = 3;
            }
            /* complex output slave */
            else
            {
               context->slavelist[slave].SM[2].SMlength = htoes((context->slavelist[slave].Obits + 7) / 8);
               context->slavelist[slave].SMtype[2] = 3;
            }   
            context->slavelist[slave].SM[3].StartAddr = htoes(ec_configlist[cindex].SM3a);
            context->slavelist[slave].SM[3].SMflags = htoel(ec_configlist[cindex].SM3f);
            /* simple (no mailbox) input slave found ? */
            if (context->slavelist[slave].Ibits && !context->slavelist[slave].SM[3].StartAddr)
            {
               context->slavelist[slave].SM[1].StartAddr = htoes(0x1000);
               context->slavelist[slave].SM[1].SMlength = htoes((context->slavelist[slave].Ibits + 7) / 8);
               context->slavelist[slave].SM[1].SMflags = htoel(0x00000000);         
               context->slavelist[slave].FMMU[1].FMMUactive = 1;
               context->slavelist[slave].FMMU[1].FMMUtype = 1;
               context->slavelist[slave].SMtype[1] = 4;
            }
            /* complex input slave */
            else
            {
               context->slavelist[slave].SM[3].SMlength = htoes((context->slavelist[slave].Ibits + 7) / 8);
               context->slavelist[slave].SMtype[3] = 4;
            }   
         }
         /* slave not in configuration table, find out via SII */
         else
         #endif
         {
            ssigen = ecx_siifind(context, slave, ECT_SII_GENERAL);
            /* SII general section */
            if (ssigen)
            {
               context->slavelist[slave].CoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x07);
               context->slavelist[slave].FoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x08);
               context->slavelist[slave].EoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x09);
               context->slavelist[slave].SoEdetails = ecx_siigetbyte(context, slave, ssigen + 0x0a);
               if((ecx_siigetbyte(context, slave, ssigen + 0x0d) & 0x02) > 0)
               {
                  context->slavelist[slave].blockLRW = 1;
                  context->slavelist[0].blockLRW++;                  
               }   
               context->slavelist[slave].Ebuscurrent = ecx_siigetbyte(context, slave, ssigen + 0x0e);
               context->slavelist[slave].Ebuscurrent += ecx_siigetbyte(context, slave, ssigen + 0x0f) << 8;
               context->slavelist[0].Ebuscurrent += context->slavelist[slave].Ebuscurrent;
            }
            /* SII strings section */
            if (ecx_siifind(context, slave, ECT_SII_STRING) > 0)
            {
               ecx_siistring(context, context->slavelist[slave].name, slave, 1);
            }
            /* no name for slave found, use constructed name */
            else
            {
               sprintf(context->slavelist[slave].name, "? M:%8.8x I:%8.8x",
                       (unsigned int)context->slavelist[slave].eep_man, 
                       (unsigned int)context->slavelist[slave].eep_id);
            }
            /* SII SM section */
            nSM = ecx_siiSM(context, slave, context->eepSM);
            if (nSM>0)
            {   
               context->slavelist[slave].SM[0].StartAddr = htoes(context->eepSM->PhStart);
               context->slavelist[slave].SM[0].SMlength = htoes(context->eepSM->Plength);
               context->slavelist[slave].SM[0].SMflags = 
                  htoel((context->eepSM->Creg) + (context->eepSM->Activate << 16));
               SMc = 1;
               while ((SMc < EC_MAXSM) &&  ecx_siiSMnext(context, slave, context->eepSM, SMc))
               {
                  context->slavelist[slave].SM[SMc].StartAddr = htoes(context->eepSM->PhStart);
                  context->slavelist[slave].SM[SMc].SMlength = htoes(context->eepSM->Plength);
                  context->slavelist[slave].SM[SMc].SMflags = 
                     htoel((context->eepSM->Creg) + (context->eepSM->Activate << 16));
                  SMc++;
               }   
            }   
            /* SII FMMU section */
            if (ecx_siiFMMU(context, slave, context->eepFMMU))
            {
               if (context->eepFMMU->FMMU0 !=0xff) 
               {
                  context->slavelist[slave].FMMU0func = context->eepFMMU->FMMU0;
               }
               if (context->eepFMMU->FMMU1 !=0xff) 
               {
                  context->slavelist[slave].FMMU1func = context->eepFMMU->FMMU1;
               }
               if (context->eepFMMU->FMMU2 !=0xff) 
               {
                  context->slavelist[slave].FMMU2func = context->eepFMMU->FMMU2;
               }
               if (context->eepFMMU->FMMU3 !=0xff) 
               {
                  context->slavelist[slave].FMMU3func = context->eepFMMU->FMMU3;
               }
            }            
         }   

         if (context->slavelist[slave].mbx_l > 0)
         {
            if (context->slavelist[slave].SM[0].StartAddr == 0x0000) /* should never happen */
            {
               EC_PRINT("Slave %d has no proper mailbox in configuration, try default.\n", slave);
               context->slavelist[slave].SM[0].StartAddr = htoes(0x1000);
               context->slavelist[slave].SM[0].SMlength = htoes(0x0080);
               context->slavelist[slave].SM[0].SMflags = htoel(EC_DEFAULTMBXSM0);
               context->slavelist[slave].SMtype[0] = 1;               
            }         
            if (context->slavelist[slave].SM[1].StartAddr == 0x0000) /* should never happen */
            {
               EC_PRINT("Slave %d has no proper mailbox out configuration, try default.\n", slave);
               context->slavelist[slave].SM[1].StartAddr = htoes(0x1080);
               context->slavelist[slave].SM[1].SMlength = htoes(0x0080);
               context->slavelist[slave].SM[1].SMflags = htoel(EC_DEFAULTMBXSM1);
               context->slavelist[slave].SMtype[1] = 2;
            }         
            /* program SM0 mailbox in and SM1 mailbox out for slave */
            /* writing both SM in one datagram will solve timing issue in old NETX */
            ecx_FPWR(context->port, configadr, ECT_REG_SM0, sizeof(ec_smt) * 2, 
               &(context->slavelist[slave].SM[0]), EC_TIMEOUTRET3);
         } 
         /* request pre_op for slave */
         ecx_FPWRw(context->port, configadr, ECT_REG_ALCTL, htoes(EC_STATE_PRE_OP | EC_STATE_ACK) , EC_TIMEOUTRET3); /* set preop status */
      }
   }   
   return wkc;
}
コード例 #20
0
ファイル: ltp_service.c プロジェクト: wanghao-xznu/BumbleBee1
/* find me service for ltp to register service */
#include "btltp.h"


uint8_t ChaValV8_011[1] = {0x08};
uint8_t ChaValV8D11[1]  = {0x01};
uint8_t ChaValV8D21[1]  = {0x02};
uint8_t ChaValV8D31[1]  = {0x03};

const TAttribAppl GattdFindMeProfile[] =
{
    /*----------handle = 0x0008  {Service=0x1801 ("Attribute Profile")}---*/
    {
        (ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE),  /* wFlags     */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_PRIMARY_SERVICE),
            HI_WORD(GATT_UUID_PRIMARY_SERVICE),
            LO_WORD(0x1801),                         /* service UUID */
            HI_WORD(0x1801)
        },
        UUID_16BIT_SIZE,                            /* bValueLen     */
        NULL,                                       /* pValueContext */
        GATT_PERM_READ                              /* wPermissions  */
    },

    /* +++++++++++ handle = 0x0009 Characteristic -- Service Changed +++++++++++++  */
    {
        ATTRIB_FLAG_VALUE_INCL,                     /* wFlags */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_CHARACTERISTIC),
            HI_WORD(GATT_UUID_CHARACTERISTIC),
コード例 #21
0
ファイル: UIConfig.c プロジェクト: magic-gjh/NT96655_FHD6600
static BOOL UI_WriteLogoFileName(UINT32 logoId)
{
    FST_FILE    pFile;
    UINT32      uiFileSize;
    UINT8       *BgBuf;
    char        *fileName;
    URECT       Rect = {0, 0, 320, 240};
    ER          erReturn = E_OK;
    PSTORE_SECTION_HANDLE* pSecHdl; // to save the handle of PStore section
    char *psecnameId;

    if (logoId == UI_LOGO_POWERON)
    {
        fileName = "A:\\logo.jpg";
        psecnameId = PS_POWERON_LOGO;
    }
    else //if (logoId == UI_LOGO_POWEROFF)
    {
        fileName = "A:\\logo2.jpg";
        psecnameId = PS_POWEROFF_LOGO;
    }

    FileSys_WaitFinish();
    pFile = FileSys_OpenFile(fileName, FST_OPEN_READ);

    if (pFile == NULL)
    {
        debug_err(("open file error\r\n"));
        return FALSE;
    }

    uiFileSize = FileSys_GetFileLen(fileName);  // for small page nand

    USE_MSG(("file size = %d\r\n",uiFileSize));

    if ((uiFileSize < 1024) || (uiFileSize > LOGO_MAX_FILESIZE))
    {
        Cal_FillRect(&Rect, _OSD_INDEX_BLACK);
        Cal_ShowStringByColor("jpg size is too big or too small\n", &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
        Delay_DelayMs(2000);
        Cal_FillRect(&Rect, _OSD_INDEX_BLACK);
        debug_err(("Write logo error\n\r"));
        return FALSE;
    }

    BgBuf = (UINT8 *)OS_GetMempoolAddr(POOL_ID_APP);
    if (FileSys_ReadFile(pFile,(UINT8 *)(BgBuf+4),&uiFileSize,FST_FLAG_NONE,NULL)!=FST_STA_OK)
    {
        USE_MSG(("file read failed\r\n"));
        return FALSE;
    }

    FileSys_CloseFile(pFile);

    *BgBuf = LO_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+1) = HI_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+2) = LO_BYTE(HI_WORD(uiFileSize));
    *(BgBuf+3) = HI_BYTE(HI_WORD(uiFileSize));

    pSecHdl = PStore_OpenSection(psecnameId, PS_RDWR | PS_CREATE);

    if (pSecHdl == E_PS_SECHDLER)
    {
        debug_err(("Section open fail\r\n"));
        goto err_ret;
    }

    erReturn = PStore_WriteSection(BgBuf, 0, SYSPARAM_LOGO_LEN, pSecHdl);

    if (erReturn != E_PS_OK)
    {
        debug_err(("PStore program error\r\n"));
        goto err_ret;
    }
    //#PIC#2010/07/23#Creator -begin
    PStore_CloseSection(pSecHdl);
    //#PIC#2010/07/23#Creator -end
    return TRUE;

err_ret:
    PStore_CloseSection(pSecHdl);
    //PStore_DisablePS();
    return FALSE;
}
コード例 #22
0
ファイル: UIConfig.c プロジェクト: magic-gjh/NT96655_FHD6600
void UI_UpdateCfgFile(void)
{
#if 0
    UINT32      uiKeyAct, uiKeyCode;
    FLGPTN     uiFlag;
#endif
    char*       str;
    FST_FILE    pFile;
    UINT32      uiFileSize;
    UINT8       *BgBuf;
    char        *fileName;
    URECT       Rect = {0, 0, 320, 240};
    BOOL        Ret  =TRUE ;
    ER          erReturn;

    PSTORE_SECTION_HANDLE* pSecHdl; // to save the handle of PStore section

    fileName = "A:\\NTCONFIG.bin";

    FileSys_WaitFinish();
    pFile = FileSys_OpenFile(fileName, FST_OPEN_READ);

    if (pFile == NULL)
    {
        debug_err(("open file error\r\n"));
        Ret  =FALSE;
    }

    uiFileSize = FileSys_GetFileLen(fileName);  // for small page nand
    USE_MSG(("file size = %d\r\n",uiFileSize));

    //if file is null
    if (uiFileSize == 0)
    {
        USE_MSG(("file size is 0\r\n"));
        Ret  =FALSE;
    }

    if (uiFileSize > CFG_MAX_FILESIZE)
    {
        USE_MSG(("file size is bigger = %d\r\n",uiFileSize));
        Ret  =FALSE;
    }

    //get_blk((void *)&BgBuf,  POOL_ID_SICD);
    //rel_blk(POOL_ID_SICD, BgBuf);
    //SysGetSICDAddr((UINT32*)&BgBuf);
    BgBuf = (UINT8 *)OS_GetMempoolAddr(POOL_ID_APP);
    if (FileSys_ReadFile(pFile,BgBuf,&uiFileSize,FST_FLAG_NONE,NULL)!=FST_STA_OK)
    {
        USE_MSG(("file read failed\r\n"));
        Ret  =FALSE;
    }

    FileSys_CloseFile(pFile);

    *BgBuf = LO_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+1) = HI_BYTE(LO_WORD(uiFileSize));
    *(BgBuf+2) = LO_BYTE(HI_WORD(uiFileSize));
    *(BgBuf+3) = HI_BYTE(HI_WORD(uiFileSize));

    //PStore_EnablePS();
    pSecHdl = PStore_OpenSection(PS_BG_CFG, PS_RDWR | PS_CREATE);

    if (pSecHdl == E_PS_SECHDLER)
    {
        debug_err(("Section open fail\r\n"));
        PStore_CloseSection(pSecHdl);
        //PStore_DisablePS();
        Ret  =FALSE;
    }

    erReturn = PStore_WriteSection(BgBuf, 0, SYSPARAM_SYSFLAG_LEN, pSecHdl);

    PStore_CloseSection(pSecHdl);

    if (erReturn != E_PS_OK)
    {
        debug_err(("PStore program error\r\n"));
        Ret  =FALSE;
    }


    Cal_FillRect(&Rect, _OSD_INDEX_BLACK);

    Rect.x   = 56;
    Rect.y   = 108;
    Rect.w   = 212;
    Rect.h   = 24;

    if (Ret  == FALSE)
    {
        str =  "Update Cfg file error";
        Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
    }else
    {
        str = "Update Cfg file ok";
        Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK);
    }

    Delay_DelayMs(1000);

    if (Ret)
    {
       System_PowerOff(SYS_POWEROFF_NORMAL);
    }

#if 0

    clr_flg(FLG_ID_CALIBRATION, 0xffffffff);
    while (1)
    {
        wai_flg(&uiFlag, FLG_ID_CALIBRATION, 0xffffffff, TWF_ORW | TWF_CLR);

        debug_msg("^GuiFlag:%x\r\n",uiFlag);
        if (uiFlag)
            break;
    }
#else
    Delay_DelayMs(1500);
#endif
}
コード例 #23
0
ファイル: firm_update.c プロジェクト: AceXIE/SOEM
void boottest(char *ifname, uint16 slave, char *filename)
{
	printf("Starting firmware update example\n");

	/* initialise SOEM, bind socket to ifname */
	if (ec_init(ifname))
	{
		printf("ec_init on %s succeeded.\n",ifname);
		/* find and auto-config slaves */


	    if ( ec_config_init(FALSE) > 0 )
		{
			printf("%d slaves found and configured.\n",ec_slavecount);

			printf("Request init state for slave %d\n", slave);
			ec_slave[slave].state = EC_STATE_INIT;
			ec_writestate(slave);

			/* wait for slave to reach INIT state */
			ec_statecheck(slave, EC_STATE_INIT,  EC_TIMEOUTSTATE * 4);
			printf("Slave %d state to INIT.\n", slave);

			/* read BOOT mailbox data, master -> slave */
			data = ec_readeeprom(slave, ECT_SII_BOOTRXMBX, EC_TIMEOUTEEP);
			ec_slave[slave].SM[0].StartAddr = (uint16)LO_WORD(data);
            		ec_slave[slave].SM[0].SMlength = (uint16)HI_WORD(data);
			/* store boot write mailbox address */
			ec_slave[slave].mbx_wo = (uint16)LO_WORD(data);
			/* store boot write mailbox size */
			ec_slave[slave].mbx_l = (uint16)HI_WORD(data);

			/* read BOOT mailbox data, slave -> master */
			data = ec_readeeprom(slave, ECT_SII_BOOTTXMBX, EC_TIMEOUTEEP);
			ec_slave[slave].SM[1].StartAddr = (uint16)LO_WORD(data);
                        ec_slave[slave].SM[1].SMlength = (uint16)HI_WORD(data);
			/* store boot read mailbox address */
			ec_slave[slave].mbx_ro = (uint16)LO_WORD(data);
			/* store boot read mailbox size */
			ec_slave[slave].mbx_rl = (uint16)HI_WORD(data);

			printf(" SM0 A:%4.4x L:%4d F:%8.8x\n", ec_slave[slave].SM[0].StartAddr, ec_slave[slave].SM[0].SMlength,
			    (int)ec_slave[slave].SM[0].SMflags);
			printf(" SM1 A:%4.4x L:%4d F:%8.8x\n", ec_slave[slave].SM[1].StartAddr, ec_slave[slave].SM[1].SMlength,
			    (int)ec_slave[slave].SM[1].SMflags);
			/* program SM0 mailbox in for slave */
			ec_FPWR (ec_slave[slave].configadr, ECT_REG_SM0, sizeof(ec_smt), &ec_slave[slave].SM[0], EC_TIMEOUTRET);
			/* program SM1 mailbox out for slave */
			ec_FPWR (ec_slave[slave].configadr, ECT_REG_SM1, sizeof(ec_smt), &ec_slave[slave].SM[1], EC_TIMEOUTRET);

			printf("Request BOOT state for slave %d\n", slave);
			ec_slave[slave].state = EC_STATE_BOOT;
			ec_writestate(slave);

			/* wait for slave to reach BOOT state */
			if (ec_statecheck(slave, EC_STATE_BOOT,  EC_TIMEOUTSTATE * 10) == EC_STATE_BOOT)
			{
				printf("Slave %d state to BOOT.\n", slave);

				if (input_bin(filename, &filesize))
				{
					printf("File read OK, %d bytes.\n",filesize);
					printf("FoE write....");
					j = ec_FOEwrite(slave, filename, 0, filesize , &filebuffer, EC_TIMEOUTSTATE);
					printf("result %d.\n",j);
					printf("Request init state for slave %d\n", slave);
					ec_slave[slave].state = EC_STATE_INIT;
					ec_writestate(slave);
				}
				else
				    printf("File not read OK.\n");
			}

		}
		else
		{
			printf("No slaves found!\n");
		}
		printf("End firmware update example, close socket\n");
		/* stop SOEM, close socket */
		ec_close();
	}
	else
	{
		printf("No socket connection on %s\nExcecute as root\n",ifname);
	}
}
コード例 #24
0
ファイル: gattsvc_gls.c プロジェクト: wanghao-xznu/BumbleBee1
#include <gattsvc_gls.h>
#endif


/**
 * @brief  service definition.
 *
 *	Glucose Servic
 */
const TAttribAppl gattSvcGLS[] =
{
	/** Primary Service>>, .. */
	{
		(ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE),  	/**< wFlags     */
		{                                           	/**< bTypeValue */
			LO_WORD(GATT_UUID_PRIMARY_SERVICE),
			HI_WORD(GATT_UUID_PRIMARY_SERVICE),
			LO_WORD(GATT_UUID_GLUCOSE),               	/**< service UUID */
			HI_WORD(GATT_UUID_GLUCOSE)
		},
		UUID_16BIT_SIZE,                            /**< bValueLen     */
		NULL,                                       /**< pValueContext */
		GATT_PERM_READ                              /**< wPermissions  */
	},

	/** Characteristic*/
	{
		ATTRIB_FLAG_VALUE_INCL,                     	/**< wFlags */
		{                                           	/**< bTypeValue */
			LO_WORD(GATT_UUID_CHARACTERISTIC),
			HI_WORD(GATT_UUID_CHARACTERISTIC),
コード例 #25
0
// --------------------------------------------------------------------------
// Menu Callback
// --------------------------------------------------------------------------
int Playback_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    uwItemId = LO_WORD(uiParam);
    uwOption = HI_WORD(uiParam);

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        switch (uwItemId)
        {
        #if !CUSTOM_PROTECT_MENU
        case IDM_PROTECT:
            SysSetFlag(FL_PROTECT, PROTECT_ONE); // Reset protect menu item

            if (UI_Validate_Storage(STORAGE_CHECK_LOCKED, NULL) == FALSE)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_CARD_LOCKED, FLOWWRNMSG_TIMER_1SEC);
                return TMF_PROCESSED;
            }

            Ux_SendEvent(&UIPlayObjCtrl, NVTEVT_EXE_PROTECT, 1, uwOption);

            if (uwOption == PROTECT_ALL || uwOption == UNPROTECT_ALL)
            {
                Ux_OpenWindow(&UIFlowWndWaitMomentCtrl, 1, FLOWWAITMOMENT_MSG_PLEASEWAIT);
            }
            break;
        #endif

        #if !CUSTOM_SLIDESHOW_MENU
        case IDM_SLIDE_SHOW:
            {
                UINT32  uiTime = 2000;  // default 2 sec

                if (uwOption == SLIDE_SHOW_5SEC)
                {
                    uiTime = 5000;
                }
                else if (uwOption == SLIDE_SHOW_8SEC)
                {
                    uiTime = 8000;
                }
                if (GetCardStatus() != CARD_REMOVED)
                    Ux_OpenWindow(&UIMenuWndPlaySlideShowCBCtrl, 1, uiTime);
            }
            break;
        #endif

        default:
            Setup_MenuCallback(uiMessage, uiParam);
            break;
        }
    }
    else if (uiMessage == TMM_ENTER_OPTION)
    {
        switch (uwItemId)
        {
        #if !CUSTOM_PROTECT_MENU
        case IDM_PROTECT:
            if (UIPlay_GetData(PLAY_FILENUM) == 0)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_NO_IMAGE, FLOWWRNMSG_TIMER_1SEC);
                return TMF_PASS_MESSAGE;
            }
            break;
        #endif

        #if !CUSTOM_SLIDESHOW_MENU
        case IDM_SLIDE_SHOW:
            if (UIPlay_GetData(PLAY_FILENUM) == 0)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_NO_IMAGE, FLOWWRNMSG_TIMER_1SEC);
            }
            break;
        #endif

        default:
            break;
        }
    }

    return TMF_PROCESSED;
}
コード例 #26
0
ファイル: MenuPlayback.c プロジェクト: magic-gjh/NT96650_K12
// --------------------------------------------------------------------------
// Menu Callback
// --------------------------------------------------------------------------
int Playback_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    uwItemId = LO_WORD(uiParam);
    uwOption = HI_WORD(uiParam);

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        switch (uwItemId)
        {
        #if !CUSTOM_PROTECT_MENU
        case IDM_PROTECT:
            SysSetFlag(FL_PROTECT, PROTECT_ONE); // Reset protect menu item

            if (UIStorageCheck(STORAGE_CHECK_LOCKED, NULL) == TRUE)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_CARD_LOCKED, FLOWWRNMSG_TIMER_1SEC);
                return TMF_PROCESSED;
            }

            switch (uwOption)
            {
            case PROTECT_ONE:
                Ux_SendEvent(&UIPlayObjCtrl, NVTEVT_PROTECT, 1, PLAY_PROTECT_ONE);
                break;

            case UNPROTECT_ONE:
                Ux_SendEvent(&UIPlayObjCtrl, NVTEVT_PROTECT, 1, PLAY_UNPROTECT_ONE);
                break;

            case PROTECT_ALL:
                AppBKW_SetData(BKW_PROTECT_TYPE, PLAY_PROTECT_ALL);
                BKG_PostEvent(NVTEVT_BKW_SETPROTECT);
                break;

            case UNPROTECT_ALL:
                AppBKW_SetData(BKW_PROTECT_TYPE, PLAY_UNPROTECT_ALL);
                BKG_PostEvent(NVTEVT_BKW_SETPROTECT);
                break;
            }
            Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYSINGLE, 1, PB_SINGLE_CURR);
            if (uwOption == PROTECT_ALL || uwOption == UNPROTECT_ALL)
            {
                Ux_OpenWindow(&UIFlowWndWaitMomentCtrl, 1, UIFlowWndWaitMoment_StatusTXT_Msg_STRID_PLEASE_WAIT);
            }
            break;
        #endif

        #if !CUSTOM_SLIDESHOW_MENU
        case IDM_SLIDE_SHOW:
            {
                UINT32  uiTime = 2000;  // default 2 sec

                if (uwOption == SLIDE_SHOW_5SEC)
                {
                    uiTime = 5000;
                }
                else if (uwOption == SLIDE_SHOW_8SEC)
                {
                    uiTime = 8000;
                }
                if(MenuPlay_IsNoFile()==TRUE)
                {
                    Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_NO_IMAGE, FLOWWRNMSG_TIMER_1SEC);
                }
                else
                {
                    Ux_OpenWindow(&UIMenuWndPlaySlideShowCBCtrl, 1,uiTime);
                }
            }
            break;
        #endif

        case IDM_MAKE_MOVIE:
            if (uwOption == MAKE_MOVIE_YES)
            {
                Ux_OpenWindow(&UIFlowWndProcessingCtrl, 0);
                BKG_PostEvent(NVTEVT_BKW_MAKE_MOVIE);
            }
            break;

        default:
            Setup_MenuCallback(uiMessage, uiParam);
            break;
        }

    }
    else if (uiMessage == TMM_ENTER_OPTION)
    {
        switch (uwItemId)
        {
        #if !CUSTOM_PROTECT_MENU
        case IDM_PROTECT:
            if(MenuPlay_IsNoFile()==TRUE)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_NO_IMAGE, FLOWWRNMSG_TIMER_1SEC);
                return TMF_PASS_MESSAGE;
            }
            break;
        #endif

        #if !CUSTOM_SLIDESHOW_MENU
        case IDM_SLIDE_SHOW:
            if(MenuPlay_IsNoFile()==TRUE)
            {
                Ux_OpenWindow(&UIFlowWndWrnMsgCtrl, 2, FLOWWRNMSG_ISSUE_NO_IMAGE, FLOWWRNMSG_TIMER_1SEC);
            }
            break;
        #endif

        case IDM_MAKE_MOVIE:
            SysSetFlag(FL_MAKE_MOVIE, MAKE_MOVIE_NO); // Reset protect menu item
            break;

        default:
            break;
        }
    }

    return TMF_PROCESSED;
}
コード例 #27
0
ファイル: UserPStore.c プロジェクト: magic-gjh/NT96620_GMD223
UINT32 UserPS_WriteUniFontFile(CHAR *pFilename)
{
    PPSTORE_SECTION_HANDLE  pSection;
    HNVT_FILE               *pFile;
    UINT32                  uiFileSize, uiWriteSize;
    UINT8                   *pMemPool;

    FilesysWaitInitFinish(FST_TIME_INFINITE);
    FilesysWaitCmdFinish(FST_TIME_INFINITE);

    pFile = Filesys_fopen((char *)pFilename, "R");
    if(pFile == NULL)
    {
        debug_err(("UserPS: Error opening %s\r\n", pFilename));
        return E_USERPS_FILE;
    }

    uiFileSize = pFile->fileSize;
    uiWriteSize = uiFileSize;
    debug_err(("UserPS: File size = %ld\r\n", uiFileSize));
    FilesysCloseActFile();

    if(uiFileSize > POOL_SIZE_UNIFONT)
    {
        debug_err(("UserPS: File size too large!\r\n"));
        return E_USERPS_FILE;
    }

    get_blk((void *)&pMemPool, POOL_ID_CAPTURE);
    rel_blk(POOL_ID_CAPTURE, pMemPool);

    pMemPool = (pMemPool + POOL_SIZE_CAPTURE - POOL_SIZE_UNIFONT);
    FilesysReadWriteByName2(FST_CMD_READ_BY_NAME, pFilename, (UINT8 *)(pMemPool+4),
                            &uiWriteSize, 0, FST_TIME_INFINITE);
    FilesysWaitCmdFinish(FST_TIME_INFINITE);
    debug_err(("UserPS: Gotta write file size = %ld\r\n", uiWriteSize));

    *pMemPool = LO_BYTE(LO_WORD(uiWriteSize));
    *(pMemPool+1) = HI_BYTE(LO_WORD(uiWriteSize));
    *(pMemPool+2) = LO_BYTE(HI_WORD(uiWriteSize));
    *(pMemPool+3) = HI_BYTE(HI_WORD(uiWriteSize));

    //PStore_EnablePS();

    if((pSection = PStore_OpenSection(PS_UNIFONT_DATA, PS_RDWR | PS_CREATE)) != E_PS_SECHDLER)
    {
        if(PStore_WriteSection(pMemPool, 0, (uiWriteSize+4), pSection) != E_PS_OK)
        {
            debug_err(("UserPS: PStore write Unicode font data fail\r\n"));
        }
        PStore_CloseSection(pSection);
        //PStore_DisablePS();
    }
    else
    {
        debug_err(("UserPS: PStore open section fail\r\n"));
        //PStore_DisablePS();
        return E_USERPS_PSECTION;
    }

    return E_USERPS_OK;
}
コード例 #28
0
/** Enumerate and init all slaves.
 *
 * @param[in] usetable	  = TRUE when using configtable to init slaves, FALSE otherwise
 * @return Workcounter of slave discover datagram = number of slaves found
 */
int ec_config_init(uint8 usetable)
{
    uint16 w, slave, ADPh, configadr, mbx_wo, mbx_ro, mbx_l, ssigen;
    uint16 topology, estat;
    int16 topoc, slavec;
    uint8 b,h;
	uint8 zbuf[64];
	uint8 SMc;
	uint32 eedat;
	int wkc, cindex, nSM;

    ec_slavecount = 0;
	/* clean ec_slave array */
	memset(&ec_slave, 0x00, sizeof(ec_slave));
	memset(&zbuf, 0x00, sizeof(zbuf));
    w = 0x0000;
    wkc = ec_BRD(0x0000, ECT_REG_TYPE, sizeof(w), &w, EC_TIMEOUTSAFE);		/* detect number of slaves */

    if (wkc > 0)
    {
        ec_slavecount = wkc;
        b = 0x00;
        ec_BWR(0x0000, ECT_REG_DLPORT, sizeof(b), &b, EC_TIMEOUTRET);		/* deact loop manual */
        w = htoes(0x0004);
        ec_BWR(0x0000, ECT_REG_IRQMASK, sizeof(w), &w, EC_TIMEOUTRET);		/* set IRQ mask */
        ec_BWR(0x0000, ECT_REG_RXERR, 8, &zbuf, EC_TIMEOUTRET);  			/* reset CRC counters */
        ec_BWR(0x0000, ECT_REG_FMMU0, 16 * 3, &zbuf, EC_TIMEOUTRET);		/* reset FMMU's */
        ec_BWR(0x0000, ECT_REG_SM0, 8 * 4, &zbuf, EC_TIMEOUTRET);			/* reset SyncM */
        ec_BWR(0x0000, ECT_REG_DCSYSTIME, 4, &zbuf, EC_TIMEOUTRET); 		/* reset system time+ofs */
        w = htoes(0x1000);
        ec_BWR(0x0000, ECT_REG_DCSPEEDCNT, sizeof(w), &w, EC_TIMEOUTRET);   /* DC speedstart */
        w = htoes(0x0c00);
        ec_BWR(0x0000, ECT_REG_DCTIMEFILT, sizeof(w), &w, EC_TIMEOUTRET);   /* DC filt expr */
        b = 0x00;
        ec_BWR(0x0000, ECT_REG_DLALIAS, sizeof(b), &b, EC_TIMEOUTRET);		/* Ignore Alias register */
        b = EC_STATE_INIT | EC_STATE_ACK;
        ec_BWR(0x0000, ECT_REG_ALCTL, sizeof(b), &b, EC_TIMEOUTRET);		/* Reset all slaves to Init */
		b = 2;
		ec_BWR(0x0000, ECT_REG_EEPCFG, sizeof(b), &b , EC_TIMEOUTRET); 		/* force Eeprom from PDI */
		b = 0;
		ec_BWR(0x0000, ECT_REG_EEPCFG, sizeof(b), &b , EC_TIMEOUTRET); 		/* set Eeprom to master */
		
        for (slave = 1; slave <= ec_slavecount; slave++)
        {
            ADPh = (uint16)(1 - slave);
            ec_slave[slave].Itype = etohs(ec_APRDw(ADPh, ECT_REG_PDICTL, EC_TIMEOUTRET)); /* read interface type of slave */
			/* a node offset is used to improve readibility of network frames */
			/* this has no impact on the number of addressable slaves (auto wrap around) */
            ec_APWRw(ADPh, ECT_REG_STADR, htoes(slave + EC_NODEOFFSET) , EC_TIMEOUTRET); /* set node address of slave */
            if (slave == 1) 
			{
				b = 1; /* kill non ecat frames for first slave */
			}
			else 
			{
				b = 0; /* pass all frames for following slaves */
			}
            ec_APWRw(ADPh, ECT_REG_DLCTL, htoes(b), EC_TIMEOUTRET); /* set non ecat frame behaviour */
            configadr = etohs(ec_APRDw(ADPh, ECT_REG_STADR, EC_TIMEOUTRET));
            ec_slave[slave].configadr = configadr;
		    ec_FPRD(configadr, ECT_REG_EEPSTAT, sizeof(estat), &estat, EC_TIMEOUTRET);
			estat = etohs(estat);
			if ((estat & (1 << 6))) /* check if slave can read 8 byte chunks */
			{
				ec_slave[slave].eep_8byte = 1;
			}
            ec_readeeprom1(slave, ECT_SII_MANUF); /* Manuf */
        }
		for (slave = 1; slave <= ec_slavecount; slave++)
        {
            ec_slave[slave].eep_man = etohl(ec_readeeprom2(slave, EC_TIMEOUTEEP)); /* Manuf */
            ec_readeeprom1(slave, ECT_SII_ID); /* ID */
        }
        for (slave = 1; slave <= ec_slavecount; slave++)
        {
            ec_slave[slave].eep_id = etohl(ec_readeeprom2(slave, EC_TIMEOUTEEP)); /* ID */
            ec_readeeprom1(slave, ECT_SII_REV); /* revision */
        }
        for (slave = 1; slave <= ec_slavecount; slave++)
        {
            ec_slave[slave].eep_rev = etohl(ec_readeeprom2(slave, EC_TIMEOUTEEP)); /* revision */
            ec_readeeprom1(slave, ECT_SII_RXMBXADR); /* write mailbox address + mailboxsize */
        }
        for (slave = 1; slave <= ec_slavecount; slave++)
        {
            eedat = etohl(ec_readeeprom2(slave, EC_TIMEOUTEEP)); /* write mailbox address and mailboxsize */
            ec_slave[slave].mbx_wo = (uint16)LO_WORD(eedat);
            ec_slave[slave].mbx_l = (uint16)HI_WORD(eedat);
			if (ec_slave[slave].mbx_l > 0) 
			{
	            ec_readeeprom1(slave, ECT_SII_TXMBXADR); /* read mailbox offset */
			}
        }
        for (slave = 1; slave <= ec_slavecount; slave++)
        {
			if (ec_slave[slave].mbx_l > 0) 
			{
	            ec_slave[slave].mbx_ro = (uint16)etohl(ec_readeeprom2(slave, EC_TIMEOUTEEP)); /* read mailbox offset */
			}
            configadr = ec_slave[slave].configadr;
            mbx_ro = ec_slave[slave].mbx_ro;
            mbx_wo = ec_slave[slave].mbx_wo;
            mbx_l = ec_slave[slave].mbx_l;
            if ((etohs(ec_FPRDw(configadr, ECT_REG_ESCSUP, EC_TIMEOUTRET)) & 0x04) > 0)  /* Support DC? */
            {
                ec_slave[slave].hasdc = TRUE;
            }
            else
            {
                ec_slave[slave].hasdc = FALSE;
            }
            topology = etohs(ec_FPRDw(configadr, ECT_REG_DLSTAT, EC_TIMEOUTRET)); /* extract topology from DL status */
			h = 0; 
			b = 0;
            if ((topology & 0x0300) == 0x0200) /* port0 open and communication established */
            {
                h++;
				b |= 0x01;
            }
            if ((topology & 0x0c00) == 0x0800) /* port1 open and communication established */
            {
                h++;
				b |= 0x02;
            }
            if ((topology & 0x3000) == 0x2000) /* port2 open and communication established */
            {
                h++;
				b |= 0x04;
            }
            if ((topology & 0xc000) == 0x8000) /* port3 open and communication established */
            {
                h++;
				b |= 0x08;
            }
            /* ptype = Physical type*/
            ec_slave[slave].ptype = LO_BYTE(etohs(ec_FPRDw(configadr, ECT_REG_PORTDES, EC_TIMEOUTRET)));
            ec_slave[slave].topology = h;
			ec_slave[slave].activeports = b;
			/* 0=no links, not possible             */
            /* 1=1 link  , end of line              */
            /* 2=2 links , one before and one after */
            /* 3=3 links , split point              */
            /* 4=4 links , cross point              */
            /* search for parent */
            ec_slave[slave].parent = 0; /* parent is master */
            if (slave > 1)
            {
                topoc = 0; 
                slavec = slave - 1;
                do
                {
		            topology = ec_slave[slavec].topology;
                    if (topology == 1)
                    {
                        topoc--; /* endpoint found */
                    }
                    if (topology == 3)
                    {
                        topoc++; /* split found */
                    }
                    if (topology == 4)
                    {
                        topoc+=2; /* cross found */
                    }
                    if (((topoc >= 0) && (topology > 1)) ||
					    (slavec == 1)) /* parent found */
                    {
                        ec_slave[slave].parent = slavec;
                        slavec = 1;
                    }
					slavec--;
                }
                while (slavec > 0);
            }

            w = ec_statecheck(slave, EC_STATE_INIT,  EC_TIMEOUTSTATE); //* check state change Init */
	
			/* set default mailbox configuration if slave has mailbox */
			if (ec_slave[slave].mbx_l>0)
			{	
				ec_slave[slave].SMtype[0] = 0;
				ec_slave[slave].SMtype[1] = 1;
				ec_slave[slave].SMtype[2] = 2;
				ec_slave[slave].SMtype[3] = 3;
				ec_slave[slave].SM[0].StartAddr = htoes(ec_slave[slave].mbx_wo);
				ec_slave[slave].SM[0].SMlength = htoes(ec_slave[slave].mbx_l);
				ec_slave[slave].SM[0].SMflags = htoel(EC_DEFAULTMBXSM0);
				ec_slave[slave].SM[1].StartAddr = htoes(ec_slave[slave].mbx_ro);
				ec_slave[slave].SM[1].SMlength = htoes(ec_slave[slave].mbx_l);
				ec_slave[slave].SM[1].SMflags = htoel(EC_DEFAULTMBXSM1);
				ec_slave[slave].mbx_proto = ec_readeeprom (slave, ECT_SII_MBXPROTO, EC_TIMEOUTEEP);
			}	
			cindex = 0;
			/* use configuration table ? */
			if (usetable)
			{
				cindex = ec_findconfig( ec_slave[slave].eep_man, ec_slave[slave].eep_id );
				ec_slave[slave].configindex= cindex;
			}
			/* slave found in configuration table ? */
			if (cindex)
			{
				ec_slave[slave].Dtype = ec_configlist[cindex].Dtype;				
				strcpy(	ec_slave[slave].name ,ec_configlist[cindex].name);
				ec_slave[slave].Ibits = ec_configlist[cindex].Ibits;
				ec_slave[slave].Obits = ec_configlist[cindex].Obits;
				if (ec_slave[slave].Obits)
				{	
					ec_slave[slave].FMMU0func = 1;
				}	
				if (ec_slave[slave].Ibits)
				{	
					ec_slave[slave].FMMU1func = 2;
				}	
				ec_slave[slave].FMMU[0].FMMUactive = ec_configlist[cindex].FM0ac;
				ec_slave[slave].FMMU[1].FMMUactive = ec_configlist[cindex].FM1ac;
				ec_slave[slave].SM[2].StartAddr = htoes(ec_configlist[cindex].SM2a);
				ec_slave[slave].SM[2].SMflags = htoel(ec_configlist[cindex].SM2f);
				/* simple (no mailbox) output slave found ? */
				if (ec_slave[slave].Obits && !ec_slave[slave].SM[2].StartAddr)
				{
					ec_slave[slave].SM[0].StartAddr = htoes(0x0f00);
					ec_slave[slave].SM[0].SMlength = htoes((ec_slave[slave].Obits + 7) / 8);
					ec_slave[slave].SM[0].SMflags = htoel(EC_DEFAULTDOSM0);			
					ec_slave[slave].FMMU[0].FMMUactive = 1;
					ec_slave[slave].FMMU[0].FMMUtype = 2;
					ec_slave[slave].SMtype[0] = 2;
				}
				/* complex output slave */
				else
				{
					ec_slave[slave].SM[2].SMlength = htoes((ec_slave[slave].Obits + 7) / 8);
					ec_slave[slave].SMtype[2] = 2;
				}	
				ec_slave[slave].SM[3].StartAddr = htoes(ec_configlist[cindex].SM3a);
				ec_slave[slave].SM[3].SMflags = htoel(ec_configlist[cindex].SM3f);
				/* simple (no mailbox) input slave found ? */
				if (ec_slave[slave].Ibits && !ec_slave[slave].SM[3].StartAddr)
				{
					ec_slave[slave].SM[1].StartAddr = htoes(0x1000);
					ec_slave[slave].SM[1].SMlength = htoes((ec_slave[slave].Ibits + 7) / 8);
					ec_slave[slave].SM[1].SMflags = htoel(0x00000000);			
					ec_slave[slave].FMMU[1].FMMUactive = 1;
					ec_slave[slave].FMMU[1].FMMUtype = 1;
					ec_slave[slave].SMtype[1] = 3;
				}
				/* complex input slave */
				else
				{
					ec_slave[slave].SM[3].SMlength = htoes((ec_slave[slave].Ibits + 7) / 8);
					ec_slave[slave].SMtype[3] = 3;
				}	
			}
			/* slave not in configuration table, find out via SII */
			else
			{
				ssigen = ec_siifind(slave, ECT_SII_GENERAL);
				/* SII general section */
				if (ssigen)
                {
					ec_slave[slave].CoEdetails = ec_siigetbyte(slave, ssigen + 0x07);
					ec_slave[slave].FoEdetails = ec_siigetbyte(slave, ssigen + 0x08);
					ec_slave[slave].EoEdetails = ec_siigetbyte(slave, ssigen + 0x09);
					ec_slave[slave].SoEdetails = ec_siigetbyte(slave, ssigen + 0x0a);
					if((ec_siigetbyte(slave, ssigen + 0x0d) & 0x02) > 0)
					{
						ec_slave[slave].blockLRW = 1;
						ec_slave[0].blockLRW++;						
					}	
					ec_slave[slave].Ebuscurrent = ec_siigetbyte(slave, ssigen + 0x0e);
					ec_slave[slave].Ebuscurrent += ec_siigetbyte(slave, ssigen + 0x0f) << 8;
					ec_slave[0].Ebuscurrent += ec_slave[slave].Ebuscurrent;
                }
				/* SII strings section */
				if (ec_siifind(slave, ECT_SII_STRING) > 0)
                {
                    ec_siistring(ec_slave[slave].name, slave, 1);
                }
				/* no name for slave found, use constructed name */
                else
                {
                    sprintf(ec_slave[slave].name, "? M:%8.8x I:%8.8x",
                    (unsigned int)ec_slave[slave].eep_man, (unsigned int)ec_slave[slave].eep_id);
                }
				/* SII SM section */
				nSM = ec_siiSM (slave,&ec_SM);
				if (nSM>0)
				{	
					ec_slave[slave].SM[0].StartAddr = htoes(ec_SM.PhStart);
					ec_slave[slave].SM[0].SMlength = htoes(ec_SM.Plength);
					ec_slave[slave].SM[0].SMflags = htoel((ec_SM.Creg) + (ec_SM.Activate << 16));
					SMc = 1;
					while ((SMc < EC_MAXSM) &&  ec_siiSMnext(slave, &ec_SM, SMc))
					{
						ec_slave[slave].SM[SMc].StartAddr = htoes(ec_SM.PhStart);
						ec_slave[slave].SM[SMc].SMlength = htoes(ec_SM.Plength);
						ec_slave[slave].SM[SMc].SMflags = htoel((ec_SM.Creg) + (ec_SM.Activate << 16));
						SMc++;
					}	
				}	
				/* SII FMMU section */
                if (ec_siiFMMU(slave, &ec_FMMU))
				{
					if (ec_FMMU.FMMU0 !=0xff) 
						ec_slave[slave].FMMU0func = ec_FMMU.FMMU0;
					if (ec_FMMU.FMMU1 !=0xff) 
						ec_slave[slave].FMMU1func = ec_FMMU.FMMU1;
					if (ec_FMMU.FMMU2 !=0xff) 
						ec_slave[slave].FMMU2func = ec_FMMU.FMMU2;
					if (ec_FMMU.FMMU3 !=0xff) 
						ec_slave[slave].FMMU3func = ec_FMMU.FMMU3;
				}	
			}	

			if (ec_slave[slave].mbx_l > 0)
			{
				if (ec_slave[slave].SM[0].StartAddr == 0x0000) /* should never happen */
				{
					ec_slave[slave].SM[0].StartAddr = htoes(0x1000);
					ec_slave[slave].SM[0].SMlength = htoes(0x0080);
					ec_slave[slave].SM[0].SMflags = htoel(EC_DEFAULTMBXSM0);
					ec_slave[slave].SMtype[0] = 0;					
				}			
				if (ec_slave[slave].SM[1].StartAddr == 0x0000) /* should never happen */
				{
					ec_slave[slave].SM[1].StartAddr = htoes(0x1080);
					ec_slave[slave].SM[1].SMlength = htoes(0x0080);
					ec_slave[slave].SM[1].SMflags = htoel(EC_DEFAULTMBXSM1);
					ec_slave[slave].SMtype[1] = 1;
				}			
				/* program SM0 mailbox in for slave */
				ec_FPWR (configadr, ECT_REG_SM0, sizeof(ec_smt), &ec_slave[slave].SM[0], EC_TIMEOUTRET);
				/* program SM1 mailbox out for slave */
				// usleep(1000); // was needed for NETX (needs internal time after SM update)
				ec_FPWR (configadr, ECT_REG_SM1, sizeof(ec_smt), &ec_slave[slave].SM[1], EC_TIMEOUTRET);
			}	
			ec_FPWRw(configadr, ECT_REG_ALCTL, htoes(EC_STATE_PRE_OP | EC_STATE_ACK) , EC_TIMEOUTRET); /* set preop status */
		}
	}	
    return wkc;
}
コード例 #29
0
ファイル: bas.c プロジェクト: wanghao-xznu/BumbleBee1
/**<  BatteryLevel value. */
static uint8_t gBatteryLevel = 0;
static uint8_t gBasReadBatteryLevelPending = FALSE;
/**<  Function pointer used to send event to application from pxp profile. */
/**<  Initiated in PXP_AddService. */
static pfnAPPHandleInfoCB_t pfnBasCB = NULL;

/**< @brief  profile/service definition.  */
static const TAttribAppl BasAttrTbl[] =
{
    /*----------------- Battery Service -------------------*/
    /* <<Primary Service>>, .. */
    {
        (ATTRIB_FLAG_VALUE_INCL | ATTRIB_FLAG_LE | ATTRIB_FLAG_BR_EDR),   /* wFlags     */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_PRIMARY_SERVICE),
            HI_WORD(GATT_UUID_PRIMARY_SERVICE),
            LO_WORD(GATT_UUID_BATTERY),              /* service UUID */
            HI_WORD(GATT_UUID_BATTERY)
        },
        UUID_16BIT_SIZE,                            /* bValueLen     */
        NULL,                                       /* pValueContext */
        GATT_PERM_READ                              /* wPermissions  */
    },

    /* <<Characteristic>>, .. */
    {
        ATTRIB_FLAG_VALUE_INCL,                     /* wFlags */
        {                                           /* bTypeValue */
            LO_WORD(GATT_UUID_CHARACTERISTIC),
            HI_WORD(GATT_UUID_CHARACTERISTIC),
コード例 #30
0
ファイル: MenuSetup.c プロジェクト: magic-gjh/NT96650_K12
// --------------------------------------------------------------------------
// Menu Callback
// --------------------------------------------------------------------------
int Setup_MenuCallback(UINT32 uiMessage, UINT32 uiParam)
{
    UINT16  uwItemId;
    UINT16  uwOption;

    if (uiMessage == TMM_CONFIRM_OPTION)
    {
        uwItemId = LO_WORD(uiParam);
        uwOption = HI_WORD(uiParam);

        switch (uwItemId)
        {
        case IDM_AUTO_POWER_OFF:
            #if(_MODEL_DSC_==_MODEL_DUAL_AONI328_)//vincent@20150914-2
            SysSetFlag(FL_AUTO_POWER_OFF,uwOption);
            if ((SysGetFlag(FL_MOVIE_MOTION_DET) == MOVIE_MOTIONDET_OFF) && (PRIMARY_MODE_PLAYBACK != System_GetState(SYS_STATE_CURRMODE)))//vincent@20150914-3 
            {
                Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_POWEROFF, 1, uwOption);
            }
            #else
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_POWEROFF, 1, uwOption);
            #endif
            break;

        case IDM_BEEP:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_BEEPKEY, 1, uwOption);
            break;

        case IDM_LANGUAGE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LANGUAGE, 1, uwOption);
            break;

        case IDM_TV_MODE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_TVFORMAT, 1, uwOption);
            break;

        case IDM_FREQUENCY:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_FREQ, 1, uwOption);
            break;

        case IDM_SENSOR_ROTATE:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_SENSOR_ROTATE, 1, uwOption);
            break;
        case IDM_LCDOFF:
            #if(_MODEL_DSC_==_MODEL_DUAL_AONI328_)//vincent@20150914-5
            SysSetFlag(FL_LCDOffIndex,uwOption);
            if (PRIMARY_MODE_PLAYBACK != System_GetState(SYS_STATE_CURRMODE))
            {
                Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LCDOFF, 1, uwOption);
            }
            #endif
            
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LCDOFF, 1, uwOption);
            break;

        case IDM_LEDSET:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_LED, 1, uwOption);
            break;			
        case IDM_DELAYOFF:
            Ux_SendEvent(&UISetupObjCtrl, NVTEVT_EXE_DELAYOFF, 1, uwOption);
            break;

        }

    }

    return TMF_PROCESSED;
}