delay timer的wrap around
span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }.cm-searching {background: #ffa; background: rgba(255, 255, 0, .4);}.cm-force-border { padding-right: .1px; }@media print { .CodeMirror div.CodeMirror-cursors {visibility: hidden;}}.cm-tab-wrap-hack:after { content: ""; }span.CodeMirror-selectedtext { background: none; }.CodeMirror-activeline-background, .CodeMirror-selected {transition: visibility 0ms 100ms;}.CodeMirror-blur .CodeMirror-activeline-background, .CodeMirror-blur .CodeMirror-selected {visibility:hidden;}.CodeMirror-blur .CodeMirror-matchingbracket {color:inherit !important;outline:none !important;text-decoration:none !important;}.CodeMirror-sizer {min-height:auto !important;}
-->
span::selection, .cm-s-base16-light .CodeMirror-line > span > span::selection { background: #e0e0e0; }.cm-s-base16-light .CodeMirror-line::-moz-selection, .cm-s-base16-light .CodeMirror-line > span::-moz-selection, .cm-s-base16-light .CodeMirror-line > span > span::-moz-selection { background: #e0e0e0; }.cm-s-base16-light .CodeMirror-gutters { background: #f5f5f5; border-right: 0px; }.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; }.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; }.cm-s-base16-light .CodeMirror-linenumber { color: #b0b0b0; }.cm-s-base16-light .CodeMirror-cursor { border-left: 1px solid #505050; }.cm-s-base16-light span.cm-comment { color: #8f5536; }.cm-s-base16-light span.cm-atom { color: #aa759f; }.cm-s-base16-light span.cm-number { color: #aa759f; }.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { color: #90a959; }.cm-s-base16-light span.cm-keyword { color: #ac4142; }.cm-s-base16-light span.cm-string { color: #f4bf75; }.cm-s-base16-light span.cm-variable { color: #90a959; }.cm-s-base16-light span.cm-variable-2 { color: #6a9fb5; }.cm-s-base16-light span.cm-def { color: #d28445; }.cm-s-base16-light span.cm-bracket { color: #202020; }.cm-s-base16-light span.cm-tag { color: #ac4142; }.cm-s-base16-light span.cm-link { color: #aa759f; }.cm-s-base16-light span.cm-error { background: #ac4142; color: #505050; }.cm-s-base16-light .CodeMirror-activeline-background { background: #DDDCDC; }.cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
-->
li {list-style-type:decimal;}.wiz-editor-body ol.wiz-list-level2 > li {list-style-type:lower-latin;}.wiz-editor-body ol.wiz-list-level3 > li {list-style-type:lower-roman;}.wiz-editor-body li.wiz-list-align-style {list-style-position: inside; margin-left: -1em;}.wiz-editor-body blockquote {padding: 0 12px;}.wiz-editor-body blockquote > :first-child {margin-top:0;}.wiz-editor-body blockquote > :last-child {margin-bottom:0;}.wiz-editor-body img {border:0;max-width:100%;height:auto !important;margin:2px 0;}.wiz-editor-body table {border-collapse:collapse;border:1px solid #bbbbbb;}.wiz-editor-body td,.wiz-editor-body th {padding:4px 8px;border-collapse:collapse;border:1px solid #bbbbbb;min-height:28px;word-break:break-word;box-sizing: border-box;}.wiz-editor-body td > div:first-child {margin-top:0;}.wiz-editor-body td > div:last-child {margin-bottom:0;}.wiz-editor-body img.wiz-svg-image {box-shadow:1px 1px 4px #E8E8E8;}.wiz-hide {display:none !important;}
-->
/***********************************************************
* Delay for the given number of microseconds. The driver must
* be initialized before calling this function.
***********************************************************/
void udelay(uint32_t usec)
{
assert((timer_ops != NULL) &&
(timer_ops->clk_mult != 0U) &&
(timer_ops->clk_div != 0U) &&
(timer_ops->get_timer_value != NULL)); uint32_t start, delta, total_delta; assert(usec < (UINT32_MAX / timer_ops->clk_div)); start = timer_ops->get_timer_value(); /* Add an extra tick to avoid delaying less than requested. */
total_delta =
div_round_up(usec * timer_ops->clk_div,
timer_ops->clk_mult) + 1U; do {
/*
* If the timer value wraps around, the subtraction will
* overflow and it will still give the correct result.
*/
delta = start - timer_ops->get_timer_value(); /* Decreasing counter */ } while (delta < total_delta);
}
#include <stdio.h> int main(int argc, const char *argv[])
{
unsigned char a, b, c; a = 0x20;
b = 0x00;
c = a - b;
printf("a(0x%x) - b(0x%x) = %x\n", a, b, c); a = 0x00;
b = 0xE0;
c = a - b;
printf("a(0x%x) - b(0x%x) = %x\n", a, b, c); a = 0x00;
b = 0x20;
c = a - b;
printf("a(0x%x) - b(0x%x) = %x\n", a, b, c); a = 0xF0;
b = 0x10;
c = a - b;
printf("a(0x%x) - b(0x%x) = %x\n", a, b, c); return ;
}
a(0x20) - b(0x0) =
a(0x0) - b(0xe0) =
a(0x0) - b(0x20) = e0
a(0xf0) - b(0x10) = e0
可以看到,如果是以无符号数输出的话,上面的大数减小数和小数减大数的结果是一样的。
delay timer的wrap around的更多相关文章
- java Timer 使用小结
Java自带的java.util.Timer类,通过调度一个java.util.TimerTask任务.这种方式可以让程序按照某一个频度执行,但不能指定时间运行.用的较少. 任务的调用通过起的子线程进 ...
- Java Timer及TimerTarsk(摘自网络)
Java自带的java.util.Timer类,通过调度一个java.util.TimerTask任务. 这种方式可以让程序按照某一个频度执行,但不能指定时间运行.用的较少.任务的调用通过起的子线程进 ...
- Linux时间子系统之(十七):ARM generic timer驱动代码分析
专题文档汇总目录 Notes:ARM平台Clock/Timer架构:System counter.Timer以及两者之间关系:Per cpu timer通过CP15访问,System counter通 ...
- Linux时间子系统(十七) ARM generic timer驱动代码分析
一.前言 关注ARM平台上timer driver(clocksource chip driver和clockevent chip driver)的驱动工程师应该会注意到timer硬件的演化过程.在单 ...
- 第一次用写一个3d轮播
2016-07-11gallery 3d html <!doctype html><html lang="en"><head> <met ...
- 进程调度函数scheduler_tick()的触发原理:周期PERIODIC定时器
参考文章: https://www.jb51.net/article/133579.htm https://blog.csdn.net/flaoter/article/details/77509553 ...
- 【原】AFNetworking源码阅读(一)
[原]AFNetworking源码阅读(一) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 AFNetworking版本:3.0.4 由于我平常并没有经常使用AFNetw ...
- AFNetworking 3.0 源码解读(九)之 AFNetworkActivityIndicatorManager
让我们的APP像艺术品一样优雅,开发工程师更像是一名匠人,不仅需要精湛的技艺,而且要有一颗匠心. 前言 AFNetworkActivityIndicatorManager 是对状态栏中网络激活那个小控 ...
- [WPF系列]-DataBinding(数据绑定) 自定义Binding
自定义Binding A base class for custom WPF binding markup extensions BindingDecoratorBase Code: public c ...
随机推荐
- 箭头函数的this指向
es6的箭头函数中this指向是跟普通function中的this指向不同的,普通function的this指向取决于调用function的对象, 而箭头函数的this指向取决于声明它的对象,看下面这 ...
- wpf radiobuttong 去前面的圆点, 自定义radiobutton样式
自定义radiobutton样式代码: <windows.Resources> <LinearGradientBrush x:Key="CheckRadioFillNorm ...
- python3 修改excel 单元格的值(xlsx)
excel code #coding=utf- import os.path import os from openpyxl.reader.excel import load_workbook # e ...
- IBM X3650 m4 面板指示灯
- 【操作系统之八】Linux常用命令之top
一.概念Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,且可以通过交互式命令自定义显示内容,类似于Windows的任务管理器. 二.命令格式 [root@PCS101 log ...
- Kafka支持单集群20万分区
Kafka支持单集群20万分区 之前网上关于确定Kafka分区数的博客多多少少都源自于饶军大神的文章,如今他带来了这方面的第二篇文章,特此翻译一下,记录一下其中的要点. 原贴地址: https://w ...
- Android 及 iOS 常用操作命令
应用相关 1. 安装应用(真机) Android adb install xxx.apk iOS ideviceinstaller -i xxx.ipa 2. 卸载应用(真机) Android adb ...
- Can not issue data manipulation statements with executeQuery()的解决方案
Can not issue data manipulation statements with executeQuery() 报错的解决方案: 把“ResultSet rs = statement. ...
- vertica审计日志
最近时段的所有请求: select * from dc_requests_issued order by time desc limit 10; 默认在磁盘上保留50MB: dbadmin=> ...
- Python做一个计时器的动画
一.问题在做连连看的时候需要加一个计时器的动画,这样就完成了计时功能的设计. 二.解决主要思路: 1.先产生一个画布,用深颜色填充满. 2.产生一个新的矩阵用来覆盖画布,背景用白色,就可以渲染出来递减 ...