示例#1
0
void main ( void )
{
    uint8_t         monitorState;
    static uint8_t  oldMute             = 0x00;
    BOOL            externalAccess;
    uint8_t         u8Data, rotarySwitch;

    externalAccess      = false;
    oldMute             = true;

    HalInitialize();
    HalTimerInit();
    HalUartInit();
	HalTimerWait(100);
   GPIOC->DDR |=  0x30;            
   GPIOC->CR1 |=  0x30;
   GPIOC->ODR |= 0x30;
    /* Perform a hard reset on the device to ensure that it is in a known   */
    /* state (also downloads a fresh copy of EDID from NVRAM).              */

    DEBUG_PRINT(MSG_ALWAYS,("\nPower up Initialize..."));
    u8Data = SI_DevicePowerUpBoot(0);
    if ( u8Data <= 0x02 )
    {
        DEBUG_PRINT( MSG_ALWAYS, ( "0 FAILED - " ));
    }
    DEBUG_PRINT(MSG_ALWAYS,("\n0 Base Address: %02X  BSM Status: %02X\n", (int)u8Data, (int)SiIRegioRead(0, REG_BSM_STAT )));
    /*u8Data = SI_DevicePowerUpBoot(1);
    if ( u8Data <= 0x02 )
    {
        DEBUG_PRINT( MSG_ALWAYS, ( "1 FAILED - " ));
    }
    DEBUG_PRINT(MSG_ALWAYS,("\n1 Base Address: %02X  BSM Status: %02X\n", (int)u8Data, (int)SiIRegioRead(1, REG_BSM_STAT )));
*/

    CpDisplayChipInfo(0);
	//CpDisplayChipInfo(1);
    //HalTimerSet( TIMER_POLLING, DEM_POLLING_DELAY );
    while ( 1 )
    {
   		HalTimerWait(100);
       process(0);
	  // process(1);
    }
}
示例#2
0
文件: init.c 项目: wjcsharp/arcos-os
VOID
KeInitialize(VOID) {
    HANDLE testScrollerProcess, testShell;

    HalInitialize();

#ifdef HAVE_KD
    KdInitialize();
#endif

    MmInitialize();

    IoInitialize();

    //Initialize ps manager, create initial process
    PsInitialize();
    ASSERT(KeCurrentProcess);

    //Initialize message passing
    MessInitialize();



    KdPrint("Say %s to %s!", "hello", "ARCOS kernel debugger");


    PsCreateProcess(TestScrollerProcess, 10, &testScrollerProcess, NULL);
    ObCloseHandle(testScrollerProcess);

    CreateProcess("shell", 31, &testShell, NULL);
    ObCloseHandle(testShell);




    KeRestoreInterrupts(TRUE);

    while (1) {
        // wait for something interesting to happen
        KeYieldProcessor();
    }
}
/*******************************************************************************
**
** Function:    NfcAdaptation::DownloadFirmware
**
** Description: Download firmware patch files.
**
** Returns:     None.
**
*******************************************************************************/
void NfcAdaptation::DownloadFirmware ()
{
    const char* func = "NfcAdaptation::DownloadFirmware";
    ALOGD ("%s: enter", func);
    static UINT8 cmd_reset_nci[] = {0x20,0x00,0x01,0x01};
    static UINT8 cmd_init_nci[]  = {0x20,0x01,0x00};
    static UINT8 cmd_reset_nci_size = sizeof(cmd_reset_nci) / sizeof(UINT8);
    static UINT8 cmd_init_nci_size  = sizeof(cmd_init_nci)  / sizeof(UINT8);
    UINT8 p_core_init_rsp_params;
    HalInitialize ();

    mHalOpenCompletedEvent.lock ();
    ALOGD ("%s: try open HAL", func);
    HalOpen (HalDownloadFirmwareCallback, HalDownloadFirmwareDataCallback);
    mHalOpenCompletedEvent.wait ();
    /* Send a CORE_RESET and CORE_INIT to the NFCC. This is required because when calling
     * HalCoreInitialized, the HAL is going to parse the conf file and send NCI commands
     * to the NFCC. Hence CORE-RESET and CORE-INIT have to be sent prior to this.
     */
    mHalCoreResetCompletedEvent.lock();
    ALOGD("%s: send CORE_RESET", func);
    HalWrite(cmd_reset_nci_size , cmd_reset_nci);
    mHalCoreResetCompletedEvent.wait();
    mHalCoreInitCompletedEvent.lock();
    ALOGD("%s: send CORE_INIT", func);
    HalWrite(cmd_init_nci_size , cmd_init_nci);
    mHalCoreInitCompletedEvent.wait();
    mHalInitCompletedEvent.lock ();
    ALOGD ("%s: try init HAL", func);
    HalCoreInitialized (&p_core_init_rsp_params);
    mHalInitCompletedEvent.wait ();

    mHalCloseCompletedEvent.lock ();
    ALOGD ("%s: try close HAL", func);
    HalClose ();
    mHalCloseCompletedEvent.wait ();

    HalTerminate ();
    ALOGD ("%s: exit", func);
}
示例#4
0
文件: hw_main.c 项目: kcrazy/winekit
NDIS_STATUS
Hw11Initialize(
    __in  PHW                     Hw,
    __in  PHVL                    Hvl,
    __out NDIS_ERROR_CODE*        ErrorCode,
    __out PULONG                  ErrorValue
    )
{
    NDIS_STATUS                 ndisStatus = NDIS_STATUS_SUCCESS;
    Hw->Hvl = Hvl;

    do
    {
        //
        // Initialize the HAL layer
        //
        ndisStatus = HalInitialize(Hw->Hal);
        if (ndisStatus != NDIS_STATUS_SUCCESS) 
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HalInitialize failed. Status = 0x%08x\n", ndisStatus));
            break;
        }
        
        //
        // Read the HW capabilities
        //
        HalGetPowerSaveCapabilities(Hw->Hal, &Hw->MacState.HalPowerSaveCapability);

        //
        // Reset our state to its initial value
        //        
        HwResetSoftwareMacState(Hw);     // Resets the software data
        HwResetSoftwarePhyState(Hw);     // Resets the software data
        NdisZeroMemory(&Hw->Stats, sizeof(NIC_STATISTICS));

        //
        // Clear any stale state from the hardware
        //
        ndisStatus = HwClearNicState(Hw);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HwClearNicState failed. Status = 0x%08x\n", ndisStatus));
            break;
        }

        //
        // Program our new state on the hardware
        //
        ndisStatus = HwSetNicState(Hw);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            MpTrace(COMP_INIT_PNP, DBG_SERIOUS, ("HwSetNicState failed. Status = 0x%08x\n", ndisStatus));
            break;
        }

        //
        // Initialize the scatter gather DMA with NDIS for send. This also allocates stuff
        // for receive shared memory allocation
        //
        ndisStatus = HwInitializeScatterGatherDma(Hw, ErrorCode, ErrorValue);
        if (ndisStatus != NDIS_STATUS_SUCCESS)
        {
            break;
        }


    } while (FALSE);


    if (ndisStatus != NDIS_STATUS_SUCCESS)
    {       
        //
        // Deregister the DMA from NDIS
        //
        if (Hw->MiniportDmaHandle != NULL)
        {
            NdisMDeregisterScatterGatherDma(Hw->MiniportDmaHandle);
        }
    }
    
    return ndisStatus;
}