![]() |
|
|||
File indexing completed on 2025-05-11 08:24:09
0001 /* SPDX-License-Identifier: BSD-2-Clause */ 0002 0003 /** 0004 * @file 0005 * 0006 * @ingroup RTEMSBSPsX8664AMD64EFI 0007 * 0008 * @brief EFI clock implementation 0009 */ 0010 0011 /* 0012 * Copyright (C) 2023 Karel Gardas 0013 * 0014 * Redistribution and use in source and binary forms, with or without 0015 * modification, are permitted provided that the following conditions 0016 * are met: 0017 * 1. Redistributions of source code must retain the above copyright 0018 * notice, this list of conditions and the following disclaimer. 0019 * 2. Redistributions in binary form must reproduce the above copyright 0020 * notice, this list of conditions and the following disclaimer in the 0021 * documentation and/or other materials provided with the distribution. 0022 * 0023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 0024 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 0025 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 0026 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 0027 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 0028 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 0029 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 0030 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 0031 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 0032 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 0033 * POSSIBILITY OF SUCH DAMAGE. 0034 */ 0035 0036 #include <bsp.h> 0037 #include <efi.h> 0038 0039 #include <stdio.h> 0040 0041 extern EFI_BOOT_SERVICES *BS; 0042 0043 static EFI_EVENT clock_event = 0; 0044 0045 extern void 0046 Clock_isr( void* ); 0047 0048 #ifndef EFIAPI 0049 #error "EFIAPI not defined!" 0050 #endif 0051 0052 /* 0053 * CAVEAT: This function is to be called from the UEFI which means it 0054 * needs to be callable by using MS ABI! 0055 */ 0056 EFIAPI void 0057 efi_clock_tick_notify(EFI_EVENT e, VOID* ctx); 0058 0059 EFIAPI void 0060 efi_clock_tick_notify(EFI_EVENT e, VOID* ctx) 0061 { 0062 Clock_isr(NULL); 0063 } 0064 0065 static void 0066 efi_clock_initialize( void ) 0067 { 0068 EFI_STATUS status = BS->CreateEvent 0069 (EVT_TIMER | EVT_NOTIFY_SIGNAL, 0070 TPL_CALLBACK, (EFI_EVENT_NOTIFY)efi_clock_tick_notify, 0071 (VOID*)NULL, &clock_event); 0072 if (EFI_ERROR(status)) { 0073 printf("EFI: error while creating event in clock initialization!\n"); 0074 } 0075 else { 0076 printf("EFI: clock event created.\n"); 0077 /* set periodic timer to signal Clock_isr every 10 milisecond. Value provided 0078 here is following UEFI spec in hundred of nanoseconds. */ 0079 status = BS->SetTimer(clock_event, TimerPeriodic, (10 * 1000 * 10)); 0080 if (EFI_ERROR(status)) { 0081 printf("EFI: error while creating timer in clock initialization!\n"); 0082 BS->CloseEvent(clock_event); 0083 } 0084 else { 0085 printf("EFI: timer for clock event is set.\n"); 0086 } 0087 } 0088 } 0089 0090 #define Clock_driver_support_initialize_hardware() efi_clock_initialize() 0091 0092 #define CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER 0093 0094 /* Include shared source clock driver code */ 0095 #include "../../shared/dev/clock/clockimpl.h"
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |