Changeset d9f3dcb in rtems
- Timestamp:
- 02/02/23 18:58:24 (4 months ago)
- Branches:
- master
- Children:
- c0fad60
- Parents:
- ebb9e8c
- git-author:
- Kinsey Moore <kinsey.moore@…> (02/02/23 18:58:24)
- git-committer:
- Joel Sherrill <joel@…> (02/08/23 20:11:47)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
bsps/include/xil/sleep.h
rebb9e8c rd9f3dcb 1 /****************************************************************************** 2 * Copyright (c) 2014 - 2022 Xilinx, Inc. All rights reserved. 3 * SPDX-License-Identifier: MIT 4 ******************************************************************************/ 5 6 7 /*****************************************************************************/ 8 /** 9 * @file sleep.h 10 * 11 * This header file contains ARM Cortex A53,A9,R5,Microblaze specific sleep 12 * related APIs. 13 * 14 * <pre> 15 * MODIFICATION HISTORY : 16 * 17 * Ver Who Date Changes 18 * ----- ---- -------- ------------------------------------------------------- 19 * 6.6 srm 11/02/17 Added processor specific sleep routines 20 * function prototypes. 21 * 7.7 sk 01/10/22 Typecast sleep declaration argument from unsigned int to 22 * u32 to fix misra_c_2012_directive_4_6 violation. 23 * 7.7 sk 01/10/22 Modify the return type of sleep_R5 and usleep_R5 from 24 * unsigned to void to fix misra_c_2012_rule_17_7 violation. 25 * 7.7 sk 03/02/22 Update usleep_R5 and usleep parameter types to fix misra_ 26 * c_2012_directive_4_6 violation. 27 * 28 * </pre> 29 * 30 ******************************************************************************/ 31 32 #ifndef SLEEP_H 33 #define SLEEP_H 34 35 #include "xil_types.h" 36 #include "xil_io.h" 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /*****************************************************************************/ 43 /** 44 * 45 * This macro polls an address periodically until a condition is met or till the 46 * timeout occurs. 47 * The minimum timeout for calling this macro is 100us. If the timeout is less 48 * than 100us, it still waits for 100us. Also the unit for the timeout is 100us. 49 * If the timeout is not a multiple of 100us, it waits for a timeout of 50 * the next usec value which is a multiple of 100us. 51 * 52 * @param IO_func - accessor function to read the register contents. 53 * Depends on the register width. 54 * @param ADDR - Address to be polled 55 * @param VALUE - variable to read the value 56 * @param COND - Condition to checked (usually involves VALUE) 57 * @param TIMEOUT_US - timeout in micro seconds 58 * 59 * @return 0 - when the condition is met 60 * -1 - when the condition is not met till the timeout period 61 * 62 * @note none 63 * 64 *****************************************************************************/ 65 #define Xil_poll_timeout(IO_func, ADDR, VALUE, COND, TIMEOUT_US) \ 66 ( { \ 67 u64 timeout = TIMEOUT_US/100; \ 68 if(TIMEOUT_US%100!=0) \ 69 timeout++; \ 70 for(;;) { \ 71 VALUE = IO_func(ADDR); \ 72 if(COND) \ 73 break; \ 74 else { \ 75 usleep(100); \ 76 timeout--; \ 77 if(timeout==0) \ 78 break; \ 79 } \ 80 } \ 81 (timeout>0) ? 0 : -1; \ 82 } ) 83 84 void usleep(ULONG useconds); 85 void sleep(u32 seconds); 86 void usleep_R5(ULONG useconds); 87 void sleep_R5(u32 seconds); 88 int usleep_MB(unsigned long useconds); 89 unsigned sleep_MB(unsigned int seconds); 90 int usleep_A53(unsigned long useconds); 91 unsigned sleep_A53(unsigned int seconds); 92 int usleep_A9(unsigned long useconds); 93 unsigned sleep_A9(unsigned int seconds); 94 95 #ifdef __cplusplus 96 } 97 #endif 98 99 #endif 1 #include <sys/unistd.h>
Note: See TracChangeset
for help on using the changeset viewer.