示例#1
0
/*-------------------------------------------------------------------------*
 * Function:  GenericBulkBulkIn
 *-------------------------------------------------------------------------*
 * Description:
 *      The PC is requesting data to be sent back to it.  Pull data
 *      output of the fifo and send it back up to the maximum size
 *      packet.
 * Inputs:
 *      TUInt8 aEndpoint         -- Endpoint with interrupt
 *      T_USBEndpointStatus aStatus -- Current status of this endpoint
 *-------------------------------------------------------------------------*/
void GenericBulkBulkIn(
        void *aWorkspace,
        TUInt8 aEndpoint,
        T_USBEndpointStatus aStatus)
{
    TInt16 i, length;
    TUInt8 c;
    PARAM_NOT_USED(aWorkspace);
    PARAM_NOT_USED(aStatus);

    // Pull out data up to the maximum size of a packet
    memset(G_GenBulkBuffer, 0xFF, sizeof(G_GenBulkBuffer));
    for (i=0; i<(GENERIC_BULK_MAX_PACKET_SIZE-1); i++)  {
        // Only process if we have data
        if (UEZQueueReceive(G_GenBulkFifoOut, &G_GenBulkBuffer[i+1], 0) != UEZ_ERROR_NONE)
            break;
    }
    length = i;
    G_GenBulkBuffer[0] = length;

    // Send what we have back (first byte is the length of the rest of the bytes)
    (*G_ghDevice)->Write(G_ghDevice, aEndpoint, G_GenBulkBuffer, sizeof(G_GenBulkBuffer));

    // Check to see if there is more in the queue and if not
    // report we are empty (if we have a callback)
    if (G_callbacks.iGenBulkEmptyOutput) {
        if (UEZQueuePeek(G_GenBulkFifoOut, &c, 0) == UEZ_ERROR_TIMEOUT) {
            G_callbacks.iGenBulkEmptyOutput(G_callbacks.iCallbackWorkspace);
        }
    }
}
示例#2
0
/*---------------------------------------------------------------------------*
 * Routine:  Network_lwIP_Scan
 *---------------------------------------------------------------------------*
 * Description:
 *      Start a scan and setup a callback routine for receiving events.
 * Inputs:
 *      void *aWorkspace -- Workspace
 *      T_uezNetworkScanCallback *aCallback -- Routine to call when a scan is
 *          found or the scan is complete
 *      void *aCallbackWorkspace -- Workspace to use with the callback
 *      char *aScanSSID -- ID to scan under (null string if none)
 *      TUInt32 aTimeout -- Total time in ms to attempt scan before timing out.
 * Outputs:
 *      T_uezError -- Error code
 *---------------------------------------------------------------------------*/
T_uezError Network_lwIP_Scan(
    void *aWorkspace,
    TUInt32 aChannelNumber,
    const char *aScanSSID,
    T_uezNetworkScanCallback aCallback,
    void *aCallbackWorkspace,
    TUInt32 aTimeout)
{
    T_Network_lwIP_Workspace *p = (T_Network_lwIP_Workspace *)aWorkspace;
    T_uezError error = UEZ_ERROR_NONE;
    T_uezNetworkInfo scanInfo;

    PARAM_NOT_USED(aCallback);
    PARAM_NOT_USED(aCallbackWorkspace);

    // Doing a scan is an exclusive command.  Nothing else can be
    // processing.
    UEZSemaphoreGrab(p->iSem, UEZ_TIMEOUT_INFINITE);

    scanInfo.iRSSILevel = 0;
    scanInfo.iSecurityMode = UEZ_NETWORK_SECURITY_MODE_OPEN;
    scanInfo.iChannel = 0;
    strcpy(scanInfo.iName, "lwIP");
    p->iInfo = scanInfo;
    p->iScanStatus = UEZ_NETWORK_SCAN_STATUS_COMPLETE;

    if (aCallback) {
        aCallback(aCallbackWorkspace, &scanInfo);
    }

    UEZSemaphoreRelease(p->iSem);

    return error;
}
示例#3
0
/*-------------------------------------------------------------------------*
 * Function:  GenericBulkBulkOut
 *-------------------------------------------------------------------------*
 * Description:
 *      Bulk virtual comm data has come out of the PC.  This data
 *      is put into the fifo.
 * Inputs:
 *      TUInt8 aEndpoint         -- Endpoint with interrupt
 *      T_USBEndpointStatus aStatus -- Current status of this endpoint
 *-------------------------------------------------------------------------*/
void GenericBulkBulkOut(
        void *aWorkspace,
        TUInt8 aEndpoint,
        T_USBEndpointStatus aStatus)
{
    TInt16 i, length;
    PARAM_NOT_USED(aWorkspace);
    PARAM_NOT_USED(aStatus);

    // Read data from endpoint
    length = (*G_ghDevice)->Read(
                G_ghDevice,
                aEndpoint,
                G_GenBulkBuffer,
                sizeof(G_GenBulkBuffer));

    if (length) {
        // Store all data until we are full.
        // TBD:  If the PC keeps sending us data and our
        //          buffer is full, we currently have no handshaking
        //          to handle overflow.
        for (i=1; i<=G_GenBulkBuffer[0]; i++)  {
            // Put in the queue one character at time quickly, until full.
            if (UEZQueueSend(G_GenBulkFifoIn, &G_GenBulkBuffer[i], 0) != UEZ_ERROR_NONE)
                break;
        }
    }

    // Setup a response
    GenericBulkBulkIn(aWorkspace, USB_ENDPOINT_ADDRESS(1, USB_ENDPOINT_ADDRESS_DIR_IN), aStatus);
}
示例#4
0
/*---------------------------------------------------------------------------*
 * Routine:  CalcChecksumTask
 *---------------------------------------------------------------------------*
 * Description:
 *      Calculate a checksum in a separate task
 * Inputs:
 *      T_uezTask aMyTask         -- This task
 *      void *aParams             -- Passed in parameters
 * Outputs:
 *      TUInt32                   -- Returned code
 *---------------------------------------------------------------------------*/
void CalcChecksumTask(T_uezTask aMyTask, void *aParams)
{
    PARAM_NOT_USED(aMyTask);
    PARAM_NOT_USED(aParams);
    G_romChecksum = ROMChecksumCalculate();
    G_romChecksumCalculated = ETrue;
}
示例#5
0
T_uezError Network_lwIP_Leave(void *aWorkspace, TUInt32 aTimeout)
{
    PARAM_NOT_USED(aWorkspace);
    PARAM_NOT_USED(aTimeout);

    // doesn't do anything in this implementation

    return UEZ_ERROR_NONE;
}
示例#6
0
TUInt32 GenericBulkMonitor(T_uezTask aMyTask, void *aParameters)
{
    PARAM_NOT_USED(aParameters);
    PARAM_NOT_USED(aMyTask);

    // Just constantly process endpoint data
    for (;;)  {
        ((*G_ghDevice)->ProcessEndpoints)(G_ghDevice, UEZ_TIMEOUT_INFINITE);
    }
}
示例#7
0
/*---------------------------------------------------------------------------*
 * Routine:  Flash_NXP_LPC17xx_40xx_QueryReg
 *---------------------------------------------------------------------------*
 * Description:
 *      Query the chip for the given register (word based address).
 * Inputs:
 *      void *aWorkspace            -- Workspace
 *      TUInt32 aReg                -- Register to query
 *      TUInt32 *aValue             -- Place to store value returned
 * Outputs:
 *      T_uezError                   -- Error code
 *---------------------------------------------------------------------------*/
T_uezError Flash_NXP_LPC17xx_40xx_QueryReg(
    void *aWorkspace,
    TUInt32 aReg,
    TUInt32 *aValue)
{
    T_uezError error = UEZ_ERROR_NONE;
    PARAM_NOT_USED(aWorkspace);
    PARAM_NOT_USED(aReg);

    // Do nothing
    *aValue = 0;

    return error;
}
/*---------------------------------------------------------------------------*
 * Routine:  RX62N_DirectDrive_SetBaseAddr
 *---------------------------------------------------------------------------*
 * Description:
 *      Changes the address in memory where the LCD controller gets it's
 *      pixels and if that change should occur synchronously.
 * Inputs:
 *      void *aWorkspace          -- LCD Controller's workspace
 *      TUInt32 aBaseAddress      -- New pixel memory base address
 *      TBool aSync               -- Wait for raster?
 * Outputs:
 *      T_uezError                 -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX62N_DirectDrive_SetBaseAddr(
            void *aWorkspace,
            TUInt32 aBaseAddress,
            TBool aSync)
{
//    T_workspace *p = (T_workspace *)aWorkspace;
    PARAM_NOT_USED(aWorkspace);
    PARAM_NOT_USED(aBaseAddress);
    PARAM_NOT_USED(aSync);

//    LCD_UPBASE = p->iBaseAddress;
// TBD: Change base address!

    return UEZ_ERROR_NONE;
}
示例#9
0
/*---------------------------------------------------------------------------*
 * Routine:  RX62N_RTC_InitializeWorkspace
 *---------------------------------------------------------------------------*
 * Description:
 *      Setup the RX62N RTC workspace.
 * Inputs:
 *      void *aW                    -- Particular RTC workspace
 * Outputs:
 *      T_uezError                   -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX62N_RTC_InitializeWorkspace(void *aWorkspace)
{
    //T_RX62N_RTC_Workspace *p = (T_RX62N_RTC_Workspace *)aWorkspace;
    PARAM_NOT_USED(aWorkspace);
    
    return UEZ_ERROR_NONE;
}
示例#10
0
文件: SrchDlg.c 项目: mike2718/WinVi
BOOL CALLBACK SubstChkCallback(HWND hDlg, UINT uMsg, WPARAM wPar, LPARAM lPar)
{	SEARCHCONFIRMRESULT	Result;
	static RECT			Rect;
	static BOOL			RectDefined = FALSE;

	PARAM_NOT_USED(lPar);
	switch (uMsg) {
		case WM_INITDIALOG:
			if (RectDefined)
				SetWindowPos(hDlg, 0, Rect.left, Rect.top, 0, 0,
				                      SWP_NOZORDER | SWP_NOSIZE);
			return (TRUE);

		case WM_COMMAND:
			switch (wPar) {
				case IDOK:
					Result = ConfirmReplace;
					break;
				case 100:
					Result = ConfirmSkip;
					break;
				case IDCANCEL:
					Result = ConfirmAbort;
					break;
			}
			GetWindowRect(hDlg, &Rect);
			RectDefined = TRUE;
			EndDialog(hDlg, Result);
			return (TRUE);
	}
	return (FALSE);
}
/*---------------------------------------------------------------------------*
 * Routine:  ISerialGeneric_TimerCallbackTransmitEmpty
 *---------------------------------------------------------------------------*
 * Description:
 *      The transmission buffer is empty (or needs more characters).  Pull
 *      a byte out of the waiting buffer and put into the serial hardware
 *      output by calling SerialDevice->OutputByte.
 * Inputs:
 *      void *aCallbackWorkspace    -- Pointer to T_RS485_Generic_Timer_Workspace
 *---------------------------------------------------------------------------*/
static void ISerialGeneric_TimerCallbackTransmitEmpty(
    void *aCallbackWorkspace,
    TUInt32 aNumBytesAvailable)
{
    T_RS485_Generic_Timer_Workspace *p =
        (T_RS485_Generic_Timer_Workspace *)aCallbackWorkspace;
    TUInt8 c;
    PARAM_NOT_USED(aNumBytesAvailable);

    // Only send one byte at a time because we have greater control
    // over the timing (the LPC2478 takes 1 character minus 1 stop bit to process
    // this many characters
    // Output a byte to the buffer
    if (_isr_UEZQueueReceive(p->iQueueSend, &c) == UEZ_ERROR_NONE) {
        // Got data, send it
        (*p->iSerial)->OutputByte((T_halWorkspace *)p->iSerial, c);
    } else {
        // No more data to send
        p->iTxBusy = EFalse;

        // Set the time it takes until we get a match
        (*p->iTimer)->SetMatchRegister(p->iTimer, 0,
            p->iReleaseTimeCPUCycles, ETrue, EFalse, EFalse);

        // Reset and start the counter
        (*p->iTimer)->Reset(p->iTimer);
        (*p->iTimer)->Enable(p->iTimer);
    }
}
示例#12
0
/*---------------------------------------------------------------------------*
 * Routine:  RX62N_RTC_Configure
 *---------------------------------------------------------------------------*
 * Description:
 *      Configure for internal or external clock and turn on.
 * Inputs:
 *      void *aW                     -- RTC workspace
 *      TBool aIsExternalClock       -- Internal or external clock config.
 *      TUInt16 aPrescaleInteger     -- Prescalar integer (13-bit) when
 *                                      internal config
 *      TUInt16 aPrescaleFraction    -- Prescalar fraction (15-bit) when
 *                                      internal
 * Outputs:
 *      T_uezError                   -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX62N_RTC_Configure(void *aWorkspace)
{
    //T_RX62N_RTC_Workspace *p = (T_RX62N_RTC_Workspace *)aWorkspace;
    PARAM_NOT_USED(aWorkspace);

    // Go ahead and make clock run (regardless of the time)
    RTC.RCR2.BIT.START = 1;

    return UEZ_ERROR_NONE;
}
示例#13
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUITestTextLine
 *---------------------------------------------------------------------------*
 * Description:
 *      Show a line of text in the test area.
 * Inputs:
 *      T_testData *aData -- Current test state
 *      TUInt16 aLine -- Line of result data (0=top, 1=next down, etc.)
 *      const char *aText -- Text to show
 *---------------------------------------------------------------------------*/
void UEZGUITestTextLine(T_testData *aData, TUInt16 aLine, const char *aText)
{
    void *aWorkspace = aData->iPrivateData;

    // Just output the text regardless of the line offset requested
    PARAM_NOT_USED(aLine);
    if (G_verbose) {
        FDICmdSendString(aWorkspace, aText);
        FDICmdSendString(aWorkspace, "\n");
    }
}
示例#14
0
/*-------------------------------------------------------------------------*
 * Function:  GenericBulkInterruptIn
 *-------------------------------------------------------------------------*
 * Description:
 *      A USB interrupt has polled.  Respond with a notification about
 *      the state of the serial lines.
 *      NOTE:  Currently this does not seem to work!
 * Inputs:
 *      TUInt8 aEndpoint         -- Endpoint with interrupt
 *      T_USBEndpointStatus aStatus -- Current status of this endpoint
 *-------------------------------------------------------------------------*/
void GenericBulkInterruptIn(
        void *aWorkspace,
        TUInt8 aEndpoint,
        T_USBEndpointStatus aStatus)
{
    // Do nothing
    PARAM_NOT_USED(aStatus);
    PARAM_NOT_USED(aWorkspace);

    G_GenBulkBuffer[0] = 0xA1;
    G_GenBulkBuffer[1] = 0x20;  // SERIAL_STATE
    G_GenBulkBuffer[2] = 0x00;  // wValue
    G_GenBulkBuffer[3] = 0x00;
    G_GenBulkBuffer[4] = 0x01;  // Interface
    G_GenBulkBuffer[5] = 0x00;
    G_GenBulkBuffer[6] = 0x02;  // wLength
    G_GenBulkBuffer[7] = 0x00;
    G_GenBulkBuffer[8] = 0x00;  // UART State
    G_GenBulkBuffer[9] = 0x00;
    ((*G_ghDevice)->Write)(G_ghDevice, aEndpoint, G_GenBulkBuffer, 10);
}
/*---------------------------------------------------------------------------*
 * Routine:  RX63N_DirectDrive_SetBaseAddr
 *---------------------------------------------------------------------------*
 * Description:
 *      Changes the address in memory where the LCD controller gets it's
 *      pixels and if that change should occur synchronously.
 * Inputs:
 *      void *aWorkspace          -- LCD Controller's workspace
 *      TUInt32 aBaseAddress      -- New pixel memory base address
 *      TBool aSync               -- Wait for raster?
 * Outputs:
 *      T_uezError                 -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX63N_DirectDrive_SetBaseAddr(
            void *aWorkspace,
            TUInt32 aBaseAddress,
            TBool aSync)
{
    T_workspace *p = (T_workspace *)aWorkspace;
    PARAM_NOT_USED(aSync);

	p->iBaseAddress = aBaseAddress;
	LCDSetLineSource(0, DD_FRAME_HEIGHT, (pixel *)p->iBaseAddress, DD_FRAME_WIDTH);

    return UEZ_ERROR_NONE;
}
示例#16
0
T_uezError Network_lwIP_SocketWrite(
    void *aWorkspace,
    T_uezNetworkSocket aSocket,
    void *aData,
    TUInt32 aNumBytes,
    TBool aFlush,
    TUInt32 aTimeout)
{
    T_Network_lwIP_Workspace *p = (T_Network_lwIP_Workspace *)aWorkspace;
    T_uezError error = UEZ_ERROR_UNKNOWN;
    T_lwIPSocket *p_socket = p->iSockets + aSocket;
    TUInt16 numWrite;
    PARAM_NOT_USED(aTimeout);

    if ((aSocket == 0) || (aSocket > NETWORK_LWIP_NUM_SOCKETS))
        return UEZ_ERROR_HANDLE_INVALID;
    UEZSemaphoreGrab(p->iSem, UEZ_TIMEOUT_INFINITE);

    if (p_socket->iState == SOCKET_STATE_FREE) {
        error = UEZ_ERROR_HANDLE_INVALID;
    } else if ((p_socket->iFlags & SOCKET_FLAG_CONNECTED) == 0) {
        error = UEZ_ERROR_NOT_OPEN;
    } else {
        while (aNumBytes) {
            // Send data up to a 16-bit value
            if (aNumBytes > 0xFFFF)
                numWrite = 0xFFFF;
            else
                numWrite = (TUInt16)aNumBytes;
            aNumBytes -= numWrite;

            // Clean up any previous timeout errors
            if (p_socket->iNetconn->err == ERR_TIMEOUT)
                p_socket->iNetconn->err = ERR_OK;
            // Write out this segment (noting if there is data past this one)
            error
                = IConvertErrorCode(netconn_write(p_socket->iNetconn, aData,
                                                  numWrite, NETCONN_COPY | ((aFlush) ? 0
                                                          : NETCONN_MORE)));
            // Stop on any errors
            if (error != UEZ_ERROR_NONE)
                break;

            aData = (void *)(((char *)aData) + numWrite);
        }
    }

    UEZSemaphoreRelease(p->iSem);

    return error;
}
T_uezError Host_SetControlPacketSize(
            void *aWorkspace,
            TUInt8 aDeviceAddress,
            TUInt16 aPacketSize)
{
    PARAM_NOT_USED(aWorkspace);

    if (aPacketSize > 256)
        return UEZ_ERROR_ILLEGAL_PARAMETER;

    EDCtrl->Control = (aPacketSize << 16);

    return UEZ_ERROR_NONE;
}
static TBool Keypad_NXP_PCA9555_Callback(
            void *aCallbackWorkspace, 
            TUInt32 aChannel)
{
    T_Keypad_NXP_I2C_PCA9555_Workspace *p = 
        (T_Keypad_NXP_I2C_PCA9555_Workspace *)aCallbackWorkspace;
    PARAM_NOT_USED(aChannel);

    // Notify the thread we got one ready by releasing the semaphore
    // that is holding the monitoring thread
    _isr_UEZSemaphoreRelease(p->iReady);

    // Don't reset the interrupt, we'll do it when we are ready in the task
    return EFalse;
}
示例#19
0
/*-------------------------------------------------------------------------*
 * Function:  GenericBulkHandleClassRequest
 *-------------------------------------------------------------------------*
 * Description:
 *      Handle CDC class requests that are required for the virtual
 *      COMM port.  Notify the system each time the baud rate is changed.
 * Inputs:
 *      T_USBSetupPacket *aSetup -- Setup packet with cmd
 *      TUInt16 *aLength         -- Pointer to length of return data
 *      TUInt8 **aData           -- Pointer to start of return data
 * Outputs:
 *      TBool                    -- ETrue if handled, else EFalse.
 *-------------------------------------------------------------------------*/
TBool GenericBulkHandleClassRequest(
                void *aWorkspace,
                T_USBSetupPacket *aSetup,
                TUInt16 *aLength,
                TUInt8 **aData)
{
    PARAM_NOT_USED(aWorkspace);

    switch (aSetup->iRequest) {
        default:
            return EFalse;
    }
#if (COMPILER_TYPE!=IAR)
    return ETrue;
#endif
}
示例#20
0
/*---------------------------------------------------------------------------*
 * Routine:  Flash_NXP_LPC17xx_40xx_GetChipInfo
 *---------------------------------------------------------------------------*
 * Description:
 *      Get information about the chip size
 * Inputs:
 *      void *aW                    -- Workspace
 *      T_FlashChipInfo *aInfo      -- Pointer to structure to receive info
 * Outputs:
 *      T_uezError                   -- Error code.  Returns UEZ_ERROR_NOT_FOUND
 *                                      if flash information is not found
 *                                      (in this case, missing QRY header)
 *---------------------------------------------------------------------------*/
T_uezError Flash_NXP_LPC17xx_40xx_GetChipInfo(
    void *aWorkspace,
    T_FlashChipInfo *aInfo)
{
    PARAM_NOT_USED(aWorkspace);

    // Manually fill in the structure with a list
    // of 16x 4K blocks followed by 14x 16K blocks
    aInfo->iBitWidth = 8;
    aInfo->iNumBytesHigh = 0;
    aInfo->iNumBytesLow = 512*1024;
    aInfo->iNumRegions = 2;
    aInfo->iRegions[0].iNumEraseBlocks = 16;
    aInfo->iRegions[0].iSizeEraseBlock = 4*1024;
    aInfo->iRegions[1].iNumEraseBlocks = 14;
    aInfo->iRegions[1].iSizeEraseBlock = 32*1024;

    return UEZ_ERROR_NONE;
}
示例#21
0
/*---------------------------------------------------------------------------*
 * Routine:  ExternalInterrupt_Renesas_RX62N_ConfigurePinSet
 *---------------------------------------------------------------------------*
 * Description:
 *      Configure the pin to be on IRQn-A (EFalse) or IRQn-B (ETrue).
 * Inputs:
 *      void *aWorkspace            -- Workspace
 *      TUInt32 aChannel            -- EINT channel (0 to 15)
 *      TBool aIsPinSetB            -- ETrue = IRQn-B, EFalse = IRQn-A
 * Outputs:
 *      T_uezError                   -- Error code
 *---------------------------------------------------------------------------*/
T_uezError ExternalInterrupt_Renesas_RX62N_ConfigurePinSet(
    void *aWorkspace,
    TUInt32 aChannel,
    TBool aIsPinSetB)
{
    T_uezError error = UEZ_ERROR_NONE;
    PARAM_NOT_USED(aWorkspace);

    // Fake loop
    while (1) {
        // Is this a valid channel?
        if (aChannel >= NUM_EXTERNAL_INTERRUPTS) {
            error = UEZ_ERROR_OUT_OF_RANGE;
            break;
        }

        G_eintEntries[aChannel].iIsPinSetB = aIsPinSetB;
        break;
    }

    return error;
}
示例#22
0
/*---------------------------------------------------------------------------*
 * Routine:  RX62N_RTC_Set
 *---------------------------------------------------------------------------*
 * Description:
 *      Set the current date and time.
 * Inputs:
 *      void *aW                     -- RTC workspace
 *      T_uezTimeDate *aTimeDate     -- Time and date of the current time
 * Outputs:
 *      T_uezError                   -- Error code
 *---------------------------------------------------------------------------*/
T_uezError RX62N_RTC_Set(void *aWorkspace, const T_uezTimeDate *aTimeDate)
{
    //T_RX62N_RTC_Workspace *p = (T_RX62N_RTC_Workspace *)aWorkspace;
    PARAM_NOT_USED(aWorkspace);

    // Stop RTC (disable and reset)
    RTC.RCR2.BIT.START = 0;
    RTC.RCR2.BIT.RESET = 1;

    // Update RTC registers
    RTC.RSECCNT.BYTE = IDecimalToBCD(aTimeDate->iTime.iSecond);
    RTC.RMINCNT.BYTE = IDecimalToBCD(aTimeDate->iTime.iMinute);
    RTC.RHRCNT.BYTE = IDecimalToBCD(aTimeDate->iTime.iHour);
    RTC.RDAYCNT.BYTE = IDecimalToBCD(aTimeDate->iDate.iDay);
    RTC.RMONCNT.BYTE = IDecimalToBCD(aTimeDate->iDate.iMonth);
    RTC.RYRCNT.WORD = IDecimalToBCD(aTimeDate->iDate.iYear);

    // Start RTC with external XTAL
    RTC.RCR2.BIT.START = 1;

    return UEZ_ERROR_NONE;
}
示例#23
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUITestShowResult
 *---------------------------------------------------------------------------*
 * Description:
 *      Show a result on the screen and possibly delay
 * Inputs:
 *      T_testData *aData -- Current test state
 *      TUInt16 aLine -- Line of result data (0=top, 1=next down, etc.)
 *      TUInt16 aResult -- Result to show as well
 *      TUInt32 aDelay -- Amount of time to delay to show this
 *---------------------------------------------------------------------------*/
void UEZGUITestShowResult(
        T_testData *aData,
        TUInt16 aLine,
        TUInt16 aResult,
        TUInt32 aDelay)
{
    static const char *textResults[] = {
            "In Progress",
            "Done",
            "PASS",
            "FAIL",
            "Skip", };

    // We got a result.  Pass or fail?
    void *aWorkspace = aData->iPrivateData;

    FDICmdSendString(aWorkspace, textResults[aResult]);
    FDICmdSendString(aWorkspace, ": ");

    // Don't delay
    PARAM_NOT_USED(aDelay);
}
示例#24
0
文件: SrchDlg.c 项目: mike2718/WinVi
BOOL CALLBACK SearchCallback(HWND hDlg, UINT uMsg, WPARAM wPar, LPARAM lPar)
{	extern BOOL SearchBoxPosition, HexEditTextSide;
	extern INT  SearchBoxX, SearchBoxY;
	static RECT DlgRect;
	static BOOL Enabled;
	static CHAR CloseString[10];

	PARAM_NOT_USED(lPar);
	switch (uMsg) {
		RECT r;

		case WM_INITDIALOG:
			GetWindowRect(hDlg, &DlgRect);
			GetWindowRect(GetDlgItem(hDlg, IDC_REPLACE), &r);
			SetWindowPos(hDlg, 0, SearchBoxX, SearchBoxY,
								  DlgRect.right - DlgRect.left,
								  r.top - DlgRect.top,
						 SearchBoxPosition ? SWP_NOZORDER
										   : SWP_NOZORDER | SWP_NOMOVE);
			SendMessage(hDlg, DM_REPOSITION, 0, 0);
			EnableWindow(GetDlgItem(hDlg, IDC_SHOWREPLACE), FALSE);
			if (HexInput != (HexEditMode && !HexEditTextSide)) {
				HexInput ^= TRUE;
				*SearchBuf = '\0';
			}
			if (SelectCount && (HexInput ? 3 : 1) * SelectCount
							   < WSIZE(SearchBuf)) {
				POSITION SelPos;
				INT		 i, c;
				PWSTR	 p = SearchBuf;

				SelPos = SelectStart;
				for (i=(INT)SelectCount; i; --i) {
					if (HexInput) {
						c = ByteAt(&SelPos);
						if (Advance(&SelPos, 1) != 1) break;
						if (UtfEncoding == 16 && i > 1) {
							if (UtfLsbFirst)
								c |= ByteAt(&SelPos) << 8;
							else c = (c << 8) | ByteAt(&SelPos);
							if (Advance(&SelPos, 1) != 1) break;
							--i;
						}
						p += _snwprintf(p, WSIZE(SearchBuf) - (p-SearchBuf),
										UtfEncoding == 16 ? L"%04x " : L"%02x ",
										c);
					} else {
						if ((c = CharAt(&SelPos)) == C_CRLF) c = '\r';
						else if (!UtfEncoding) c = CharSetToUnicode(c);
						if (UtfEncoding == 16) {
							if (i > 1) --i;
							if (Advance(&SelPos, 2) != 2) break;
						} else if (Advance(&SelPos, 1) != 1) break;
						*p++ = c;
					}
				}
				if (HexInput) --p;
				*p = '\0';
				if (*SearchBuf && !ViewOnlyFlag)
					EnableWindow(GetDlgItem(hDlg, IDC_SHOWREPLACE), TRUE);
			} else {
				PWSTR p;

				if ((p = ExtractIdentifier(NULL)) != NULL)
					wcsncpy(SearchBuf, p, WSIZE(SearchBuf));
			}
			Enabled = *SearchBuf!='\0';
			if (Enabled) {
				EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
				SetDlgItemTextW(hDlg, IDC_SEARCHSTRING, SearchBuf);
				SendMessage(hDlg, DM_SETDEFID, IDOK, 0L);
			} else {
				SendMessage(hDlg, DM_SETDEFID, IDCANCEL, 0L);
				EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
			}
			EnableWindow(GetDlgItem(hDlg, IDC_REPLACESTRING), FALSE);
			EnableWindow(GetDlgItem(hDlg, IDC_REPLACE),       FALSE);
			EnableWindow(GetDlgItem(hDlg, IDC_REPLACEALL),    FALSE);
			CheckDlgButton(hDlg, *SrchDispBuf=='?' ? IDC_BACKWARD : IDC_FORWARD,
								 TRUE);
			CheckDlgButton(hDlg, IDC_MATCHCASE,	!IgnoreCaseFlag);
			CheckDlgButton(hDlg, IDC_MAGIC,		Magic);
			CheckDlgButton(hDlg, IDC_HEXSEARCH, HexInput);
			CheckDlgButton(hDlg, IDC_WHOLEWORD,	WholeWord);
			CheckDlgButton(hDlg, IDC_WRAPSCAN,	WrapScanFlag);
			LOADSTRING(hInst, 909, CloseString, sizeof(CloseString));
			ReplaceOpen = FALSE;
			PostMessage(hDlg, WM_COMMAND, 4569, 0);	/*for Wine*/
			return (TRUE);

		case WM_COMMAND:
			switch (COMMAND) {
				case 4569:
					/*Disable/enable again for Wine...*/
					EnableWindow(GetDlgItem(hDlg, IDOK), Enabled);
					break;
				case IDOK:
					SearchOk(hDlg);
					break;
				case IDCANCEL:
					if (ReplacingAll) Interrupted = TRUE;
					PostMessage(hDlg, WM_CLOSE, 0, 0);
					break;
				case IDC_SEARCHSTRING:
					GetDlgItemTextW(hDlg, IDC_SEARCHSTRING, CommandBuf, 4);
					if (Enabled != (*CommandBuf != '\0')) {
						if (Enabled ^= TRUE) {
							EnableWindow(GetDlgItem(hDlg, IDOK), TRUE);
							SendMessage(hDlg, DM_SETDEFID, IDOK, 0L);
						} else {
							SendMessage(hDlg, DM_SETDEFID, IDCANCEL, 0L);
							EnableWindow(GetDlgItem(hDlg, IDOK), FALSE);
						}
						if (ReplaceOpen) {
						  EnableWindow(GetDlgItem(hDlg,IDC_REPLACE),   Enabled);
						  EnableWindow(GetDlgItem(hDlg,IDC_REPLACEALL),Enabled);
						}
					}
					break;
				case IDC_SHOWREPLACE:
					EnableWindow(GetDlgItem(hDlg, IDC_REPLACESTRING), TRUE);
					EnableWindow(GetDlgItem(hDlg, IDC_REPLACE), SelectCount!=0);
					EnableWindow(GetDlgItem(hDlg, IDC_REPLACEALL),	  TRUE);
					SetWindowPos(hDlg, 0,0,0, DlgRect.right-DlgRect.left,
											  DlgRect.bottom-DlgRect.top,
								 SWP_NOZORDER | SWP_NOMOVE);
					SendMessage(hDlg, DM_REPOSITION, 0, 0);
					SetFocus(GetDlgItem(hDlg, IDC_REPLACESTRING));
					SendMessage(hDlg, DM_SETDEFID, IDC_REPLACE, 0L);
					EnableWindow(GetDlgItem(hDlg, IDC_SHOWREPLACE),  FALSE);
					ReplaceOpen = TRUE;
					break;
				case IDC_REPLACE:
					ReplaceSearched(hDlg);
					SetDlgItemText(hDlg, IDCANCEL, CloseString);
					break;
				case IDC_REPLACEALL:
					SetupSearchString(hDlg, NULL);
					GlobalSubst(hDlg);
					SetDlgItemText(hDlg, IDCANCEL, CloseString);
			}
			return (TRUE);

		case WM_MOVE:
		case WM_CLOSE:
			SearchBoxPosition = TRUE;
			GetWindowRect(hDlg, &r);
			SearchBoxX = r.left;
			SearchBoxY = r.top;
			if (uMsg == WM_CLOSE) {
				DestroyWindow(hDlg);
				hwndSearch = NULL;
			}
			return (TRUE);
	}
	return (FALSE);
}
示例#25
0
static void AudioPlayerExit(const T_choice *aChoice)
{
	G_AudioIsRunning = EFalse;
    PARAM_NOT_USED(aChoice);
    G_ws->iExit = ETrue;
}
示例#26
0
/*---------------------------------------------------------------------------*
 * Routine:  UEZGUITestRemoveButtons
 *---------------------------------------------------------------------------*
 * Description:
 *      Remove options/buttons
 * Inputs:
 *      T_testData *aData -- Current test state
 *      TUInt16 aButtonTypes -- Type of buttons to remove/hide
 *---------------------------------------------------------------------------*/
void UEZGUITestRemoveButtons(T_testData *aData, TUInt16 aButtonTypes)
{
    // Do nothing
    PARAM_NOT_USED(aData); PARAM_NOT_USED(aButtonTypes);
}
示例#27
0
/*---------------------------------------------------------------------------*
 * Routine:  Network_lwIP_Configure
 *---------------------------------------------------------------------------*
 * Description:
 *      Configure the lwIP (if any).
 *      NOTE: This is a good place for the programming for the MAC address
 * Inputs:
 *      void *aW                    -- Workspace
 *---------------------------------------------------------------------------*/
void Network_lwIP_Configure(void *aWorkspace)
{
    PARAM_NOT_USED(aWorkspace);
}
static void SlideshowExit(const T_choice *aChoice)
{
    PARAM_NOT_USED(aChoice);
    G_ws->iExit = ETrue;
}
示例#29
0
/*---------------------------------------------------------------------------*
 * Routine: CRC_Generic_Interface_Close
 *---------------------------------------------------------------------------*
 * Description:
 *    
 * Inputs:
 *      void *aWorkspace               -- Workspace
 * Outputs:
 *      T_uezError                     -- Error code
 *---------------------------------------------------------------------------*/
T_uezError CRC_Generic_Interface_Close(void *aWorkspace)
{
    // Doesn't do anything in this implementation
    PARAM_NOT_USED(aWorkspace);
    return UEZ_ERROR_NONE;
}
示例#30
0
static void VideoPlayerSelectExit(const T_choice *aChoice)
{
    PARAM_NOT_USED(aChoice);
    G_ws->iExit = ETrue;
}