04 2013 档案
摘要:http://www.coactionos.com/embedded-design/133-effective-use-of-arm-cortex-m3-svcall.htmlThe ARM Cortex-M3 service call (SVCall) can be a tricky feature to integrate in to your system software. It is useful for two things:Allowing a piece of code to execute without interruptionJumping to privileged m
阅读全文
摘要:unit uMultiInputBox;interfaceuses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.StdCtrls;type TFieldType = ( ftNumber, ftHexNumber, ftFloatNumber, ftText ); TInputRec = record Prompt : string; MaxLength : integer; FieldTy...
阅读全文
摘要:http://blog.frankvh.com/2011/12/07/cortex-m3-m4-hard-fault-handler/If you’re seeing a Hard Fault exception on your Cortex M3 or Cortex M4 processor, t...
阅读全文
摘要:This is the difference between a "procedure" and a "procedure of object"TheOnClickis defined as aTNotifyEvent:type TNotifyEvent = procedure(Sender: TObject) of object;You cannot assign a procedure to theOnClickas it is the wrong type. It needs to be a procedure of object.You can
阅读全文
摘要:procedure MoveMemory(Destination: Pointer; Source: Pointer; Length: NativeUInt);begin Move(Source^, Destination^, Length);end;procedure CopyMemory(Destination: Pointer; Source: Pointer; Length: NativeUInt);begin Move(Source^, Destination^, Length);end;procedure FillMemory(Destination: Pointer; Len..
阅读全文
摘要:指针 : 指针是一个特殊的变量, 它里面存储的数值被解释成为内存里的一个地址.(1) 指针对应着一个数据在内存中的地址, 得到了指针就可以自由地修改该数据. (2) 一个指针变量仅仅是存储一个内存的地址, 为指针所指向的内容分配空间是程序员要干的工作. (3) 如果一个指针没有指向任何数据, 它的值是nil, 它就被称为是零( nil )指针或空(null) 指针. (4) 要访问一个指针所指向的内容, 在指针变量名字的后面跟上^运算符. 这种方法称为对指针取内容. (5) 指针的指针就是用来存放指针所在的内存地址的. 要搞清一个指针, 需要了解以下内容:(1) 指针的类型. (2) 指针所.
阅读全文
摘要:fmOpenRead = $0000; fmOpenWrite = $0001; fmOpenReadWrite = $0002; fmExclusive = $0004; // when used with FileCreate, atomically creates the file only if it doesn't exist, fails otherwise fmShareCompat = $0000 platform; // DOS compatibility mode is not portable fmShareExclu...
阅读全文
摘要:Hex formatsIntel=====Hexadecimal values are always in uppercase. Each line is a record.The sum of all the bytes in each record should be 00 (modulo 256).Record types:00: data records01: end-of-file record02: extended address recordData record----------- :0D011C0000000000C3E0FF0000000000C30F: 0D 0...
阅读全文
摘要:var fullFileName : string;begin // Set up a full file name with drive and path fullFileName := 'C:\Program Files\Borland\Delphi7\Projects\Unit1.dcu'; // Show the component parts of this full name ShowMessage('Drive = '+ExtractFileDrive (fullFileName)); ShowMessage('Dir = '+Ex
阅读全文
摘要:QuickSort AlgorithOne of the common problems in programming is to sort anarray of valuesin some order (ascending or descending).While there are many "standard" sorting algorithms, QuickSort is one of the fastest.Quicksort sorts by employing adivide and conquer strategyto divide a list into
阅读全文
摘要:1 RowOut: pByteArray; 2 RowIn : array[0..2400] of pByteArray; 3 4 RowOut := pByteArray(Bitmap0.Scanline[y]); 5 6 RowIn[xout] := pByteArray(Imagebits.Picture.Bitmap.Scanline[wout-1-xout]); 7 8 9 if RowIn[x*8+bitx][y div 8] and pu2[y mod 8] <> 0 then 10 11 if RowIn[x*8+bitx]^[y div 8] an...
阅读全文
摘要:/*The CRC calculation unit mainly consists of a single 32-bit data register, which:is used as an input register to enter new data in the CRC calculator(when writing into the register) holds the result of the previous CRC calculation(when reading the register)Each write operation into the data regist
阅读全文
摘要:unit USBDeviceNotify;//USB Device arrival or removeinterfaceuses Windows, Messages, SysUtils, Classes, Forms;type PDevBroadcastHdr = ^DEV_BROADCAST_HDR; DEV_BROADCAST_HDR = packed record dbch_size: DWORD; dbch_devicetype: DWORD; dbch_reserved: DWORD; end; PDevBroadcastDev...
阅读全文
摘要:#ifndef _W25Q_H_#define _W25Q_H_/*The W25Q16BV array is organized into 8,192 programmable pages of 256-bytes each.Up to 256 bytes can be programmed at a time.Pages can be erased in groups of 16 (sector erase),groups of 128 (32KB block erase),groups of 256 (64KB block erase) orthe entire chip (chip e
阅读全文
摘要:/* Define to prevent recursive inclusion -------------------------------------*/#ifndef __AT24_H#define __AT24_H#include <string.h>#include "hw_twi.h"#include "hw_def.h"/*AT24C02, 2K Bits SERIAL EEPROM:Internally organized with 32 pages of 8 bytes each,the 2K Bits requires
阅读全文
摘要:http://marc.durdin.net/2011/10/comparing-tstringstream-vs-tstringlist.htmlThere are two methods widely used in Delphi code for reading and writing strings to/from streams with Delphi,that initially seem pretty similar in their behaviour. These areTStrings.SaveToStreamandTStringStream.SaveToStream (o
阅读全文
摘要:http://delphi.wikia.com/wiki/CompilerVersion_ConstantThe CompilerVersion constant identifies the internal version number of the Delphi compiler.It is defined in the System unit and may be referenced either in code just as any other constant:if CompilerVersion = 20 then sCompilerName := 'Delphi 2
阅读全文
摘要:B<cond>.<qualifier><lable>--Branch causes a branch to a target addressif ConditionPassed(cond) then{ EncodingSpecificOperations(PC, lable);BranchWritePC(PC + imm32);}//All versions of the Thumb instruction setT1 : B<cond> <lable> : not allowed in IT blockT2 : B<cond&
阅读全文
摘要:#ifndef __BUFFER_H__#define __BUFFER_H__#include /* * http://en.wikipedia.org/wiki/Circular_buffer : Mirroring * * The capacity of circle buffer must ...
阅读全文
摘要:#ifndef __LIST_H__#define __LIST_H__#include <stdint.h>#define LIST_ITEM_VAR() LIST_ITEM_T item#define LIST_ITEM_PTR(x) LIST_ITEM_T * x#define LIST_ITEM_PAIR(x, y) LIST_ITEM_T * x, * y//#define list_entry(pItem, T) ( (T *)(pItem) )#define LIST_ITEM_U8_PTR( p...
阅读全文
摘要:参见USB枚举过程USB枚举过程图示http://blogs.msdn.com/b/usbcoreblog/archive/2010/09/11/9915562.aspxDevice enumeration for a USB port begins when the hub indicate a ...
阅读全文
摘要:ClassUsageDescriptionExamples00hDeviceUnspecifiedclass 0(Device class is unspecified. Interface descriptors are used for determining the required drivers.)01hInterfaceAudioSpeaker,microphone,sound card02hBothCommunications and CDC ControlEthernet adapter,modem,serial port adapter03hInterfaceHuman In
阅读全文
摘要:/* * File: alloc.c * Purpose: generic malloc() and free() engine * * Notes: 99% of this code stolen/borrowed from the K&R C * examples. * */#include "common.h"#include "stdlib.h"#pragma section = "HEAP"/***************************************************************
阅读全文
摘要:/* * File: printk.c * Purpose: The standard C library routine printf(), but without * all the baggage. */#include <stdarg.h>/********************************************************************/typedef struct{ int dest; void (*func)( char ); char * loc;} PRINTK_INFO;int pr...
阅读全文
摘要:/* * File: queue.h * Purpose: Implement a first in, first out linked list * * Notes: */#ifndef _QUEUE_H_#define _QUEUE_H_/********************************************************************//* * Individual queue node */typedef struct NODE{ struct NODE *next;} QNODE;/* * Queue Struture - linke...
阅读全文
摘要:简单讲,OHCI,UHCI都是USB1.1的接口标准,而EHCI是对应USB2.0接口标准,最新的XHCI是USB3.0的接口标准。1.OHCI(Open Host Controller Interface)是支持USB1.1标准,但不只是针对USB,还支持其他的一些接口,比如它还支持Apple的火线(Firewire,IEEE 1394)接口。与UHCI相比,OHCI的硬件复杂,硬件做的事情更多,所以实现对应的驱动的任务就相对简单。主要用于非X86的USB,如扩展卡,嵌入式开发板的USB主控。2.UHCI(Universal Host Controller Interface), 是Inte
阅读全文
摘要:USB Composite Class DevicesA USB Composite Device is any device which does more than one jobfor example a combined keyboard and mouse.A USB Composite device is the one with multiple interfaces controlled independently of each other. When using such device multiple functions are combined into a singl
阅读全文
摘要:http://www.cppblog.com/Lee7/archive/2008/01/07/40650.htmlOverlapped I/O简述:Overlapped I/O也称Asynchronous I/O,异步I/O模型。异步I/O和同步I/O不同,同步I/O时,程序被挂起,一直到I/O处理完,程序才能获得控制。异步I/O,调用一个函数告诉 OS,进行I/O操作,不等I/O结束就立即返回,继续程序执行,操作系统完成I/O之后,通知消息给你。Overlapped I/O只是一种模型,它可以由内核对象(hand),事件内核对象(hEvent), 异步过程调用(apcs) 和完成端口(I/O
阅读全文
摘要:应用程序和驱动程序的通信过程是:应用程序使用CreateFile函数打开设备,然后用DeviceIoControl与驱动程序进行通信,包括读和写两种操作。还可以用ReadFile读数据用WriteFile写数据。操作完毕时用CloseHandle关闭设备。我们比较常用的就是用DeviceIoControl对设备进行读写操作。CreateFile这是一个多功能的函数,可打开或创建以下对象,并返回可访问的句柄:控制台,通信资源,目录(只读打开),磁盘驱动器,文件,邮槽,管道。HANDLE WINAPI CreateFile( _In_ LPCTSTR lpFileName, _In_ ...
阅读全文
摘要:Standard DescriptorsADevice Descriptordescribes general information about a USB device. It includes information that applies globally to the device and all of the device's configurations. A USB device has only one device descriptor.TheConfiguration Descriptorgives information about a specific de
阅读全文
摘要:选择 USB 设备的驱动程序模型https://github.com/libusbx/libusbx/wiki/Windows-BackendWinUSBdoes not supportWindows 2003 ( 32bit/64bit )WinUSBdoes not supportWindows XP 64 bit ( not officially support on 64bit Windows XP)WinUSBcannot be used to send an actual reset command to an USB device. This is a limitation of
阅读全文
摘要:在计算机还没有出现之前,有一种叫做电传打字机(Teletype Model 33)的玩意,每秒钟可以打10个字符。但是它有一个问题,就是打完一行换行的时候,要用去0.2秒,正好可以打两个字符。要是在这0.2秒里面,又有新的字符传过来,那么这个字符将丢失。于是,研制人员想了个办法解决这个问题,就是在每行后面加两个表示结束的字符。一个叫做“回车”,告诉打字机把打印头定位在左边界;另一个叫做“换行”,告诉打字机把纸向下移一行。这就是“换行”和“回车”的来历,从它们的英语名字上也可以看出一二。Unix系统里,每行结尾只有“<换行>”,即“\n”;Windows系统里面,每行结尾是“<
阅读全文
摘要:C99中新增加了restrict修饰的指针:由restrict修饰的指针是最初唯一对指针所指向的对象进行存取的方法,仅当第二个指针基于第一个时,才能对对象进行存取。对对象的存取都限定于基于由restrict修饰的指针表达式中。由restrict修饰的指针主要用于函数形参,或指向由malloc()分配的内存空间。restrict数据类型不改变程序的语义。编译器能通过作出restrict修饰的指针是存取对象的唯一方法的假设,更好地优化某些类型的例程。restrict是c99标准引入的,它只可以用于限定和约束指针,并表明指针是访问一个数据对象的唯一且初始的方式.即它告诉编译器,所有修改该指针所指向内
阅读全文
摘要:%% 打印一个百分号%a 浮点数、十六进制数字和p-记数法(C99)%A 浮点数、十六进制数字和p-记法(C99)%c 一个字符 %d 有符号十进制整数 %i 有符号十进制数(与%d相同)%e 浮点数、e-记数法%E 浮点数、E-记数法%f 浮点数、十进制记数法 %g 根据数值不同自动选择%f或%e.%G 根据数值不同自动选择%f或%e.%p 指针 %s 字符串%u 无符号十进制整数%o 无符号八进制整数%x 使用十六进制数字0..f的无符号十六进制整数 %X 使用十六进...
阅读全文
摘要:http://stackoverflow.com/questions/14926294/formatted-print-to-circular-bufferI'm writing embedded code for STM32F3 mc (STM32F3-Discovery). I need to output some data to UART and I'm using DMA for this as this allows me to concentrate on sensors reading and data processing rather than on wai
阅读全文
摘要:PostThreadMessage将一个消息放入(寄送)到指定线程的消息队列里,不等待线程处理消息就返回。既可以发送消息给工作线程,也可以发送给UI线程。其原型如下:BOOL PostThreadMessage( DWORD idThread, UINT Msg, WPARAM wParam, LPARAM lParam);idThread:其消息将被寄送的线程的线程标识符。如果线程没有消息队列,此函数将失败。当线程第一次调用一个Win 32 USER或GDI函数时,系统创建线程的消息队列。要得到更多的信息,参见备注。Msg:指定将被寄送的消息的类型。...
阅读全文
摘要:#ifndef __RING_BUFFER_H__#define __RING_BUFFER_H__//------------------------------------------------------------------------------// External functions//------------------------------------------------------------------------------void BSP_Lock( void );void BSP_Unlock( void );typedef struct{...
阅读全文
摘要:#ifndef __CIRCLE_BUFFER_H__#define __CIRCLE_BUFFER_H__/* * http://en.wikipedia.org/wiki/Circular_buffer : Mirroring * * The capacity of circle buffer must be a power of two ! * * The source and sink of data can implement independent policies for dealing * with a full buffer and overrun while adherin
阅读全文
摘要:SourceInsight : Options : Custom CommandsAdd 在弹出对话框写入 C/C++ Formatter"C:\AStyle\AStyle.exe" --style=ansi -s2 --convert-tabs %fSourceInsight : Options : Key Assignments
阅读全文
摘要:打开ultraedit,高级->工具配置。命令行填写:C:\AStyle\AStyle.exe --style=ansi -s2 "%f" "%f"工作目录填写:%P;选项不改;去掉捕获输出--style=ansi 是astyle的命令,-s2 缩进2个空格"%f" "%f"是ultraedit的参数。可以分配快捷键
阅读全文
摘要:astyle 全称为 Artistic Style,官方网站是http://astyle.sourceforge.netastyle不但可以对C/C++进行格式优化,还可以处理Java和C#。astyle 是一个命令行程序,简单的使用方法是直接使用astyle加上你要格式化的程序的源文件。 astyle支持不同的代码风格,也有不同的参数来设置自己想要的效果通过命令“astyle -V”可以查询版本信息通过命令“astyle --help”可以获取所有参数的介绍下载最新版本 :http://sourceforge.net/projects/astyleastyle是一个命令行工具,命令语法很简单
阅读全文
摘要:http://www.embedded.com/electronics-blogs/programming-pointers/4024450/Tag-vs-Type-NamesTag names in CIn C, the name s appearing in:struct s{ ...}; s is atag. A tag by itself is not a type name. If it were, then C compilers would accept declarations such as:s x; // error in Cs *p; // ditto...
阅读全文
摘要:混乱的字体命名问题设置字体属性是样式表的最常见的用途之一。不过,尽管字体选择很重要,但是目前还没有一种办法能确保在 Web 上一致地使用字体,因为没有一种统一描述字体和字体的变形的方法。例如,字体 Times、Times New Roman 和 TimesNR 可能很类似,甚至完全相同,不过用户代理怎么能知道这一点呢?创作人员可能在一个文档中指定字体为 TimesNR,但是如果用户机器上没有安装这种字体,用户查看文档会看到什么呢?即使安装了 Times New Roman,用户代理也不知道这两个字体(Times New Roman 和 TimesNR)实际上是可以互换的。如果你希望一个浏览器上
阅读全文
摘要:1 2 3 #define ITM_ENA (*(volatile unsigned int*)0xE0000E00) // ITM Enable 4 #define ITM_TPR (*(volatile unsigned int*)0xE0000E40) // Trace Privilege Register 5 #define ITM_TCR (*(volatile unsigned int*)0xE0000E80) // ITM Trace Control Reg. 6 #define ITM_LSR (*(volatile unsigned int*...
阅读全文
摘要:IAR EWARM Printf via SWOStdout and stderr of the application can be redirected to ITM stimulus port #0. It means that stdout/stderr messages (e.g. str...
阅读全文
摘要:JTAG -Joint Test Action GroupJTAG(Joint Test Action Group)联合测试行动小组)是一种国际标准测试协议(IEEE 1149.1兼容)Test Access Port and Boundary-Scan Architecture主要用于芯片内部测试及对系统进行仿真、调试。现在多数的高级器件都支持JTAG协议,如DSP、FPGA器件等。通常所说的JTAG大致分两类,一类用于测试芯片的电气特性,检测芯片是否有问题;一类用于Debug;一般支持JTAG的CPU内都包含了这两个模块。一个含有JTAG Debug接口模块的CPU,只要时钟正常,就可以通
阅读全文
摘要:unit jlinkarm;interfaceuses SysUtils, Windows;(* RegIndex RegName0 R01 R1 2 R2 3 R3 4 R4 ...
阅读全文
摘要:The setup packet--------------------------------------------------------------------------------------------Every USB device must respond to setup packets on the default pipe.The setup packets are used for detection and configuration of the deviceand carry out common functions such as setting the US
阅读全文
摘要:Mnemonic Brief description SeeB Branch B, BL, BX, and BLXBL Branch with Link B, BL, BX, and BLXBLX Branch indirect with Link B, BL, BX, and BLXBX Branch indirect B, BL, BX, and BLXCBNZ ...
阅读全文
摘要:Cortex-M3是一个 32位处理器内核。内部的数据路径是 32位的,寄存器是 32位的,存储器接口也是 32 位的。CM3 采用了哈佛结构,拥有独立的指令总线和数据总线,可以让取指与数据访问并行不悖。这样一来数据访问不再占用指令总线,从而提升了性能。为实现这个特性, CM3内部含有好几条总线接口,每条都为自己的应用场合优化过,并且它们可以并行工作。但是另一方面,指令总线和数据总线共享同一个存储器空间(一个统一的存储器系统)。比较复杂的应用可能需要更多的存储系统功能,为此CM3提供一个可选的MPU,而且在需要的情况下也可以使用外部的 cache。另外在CM3中,Both小端模式和大端模式都是
阅读全文
摘要:Cortex-M3处理器支持两种处理器的操作模式,还支持两级特权操作。两种操作模式分别为:处理者模式和线程模式(thread mode)。引入两个模式的本意,是用于区别普通应用程序的代码和异常服务例程的代码——包括中断服务例程的代码。两级特权操作分别为:特权级和用户级。这可以提供一种存储器访问的保护机制,使得普通的用户程序代码不能意外地,甚至是恶意地执行涉及到要害的操作。处理器支持两种特权级,这也是一个基本的安全模型。主应用程序(线程模式),既可以使用特权级,也可以使用用户级;异常服务例程(处理者模式)必须在特权级下执行。通过引入特权级和用户级,就能够在硬件水平上限制某些不受信任的或者还没有调
阅读全文
摘要:The stack has the same function as in a single-task system: storage of returnaddresses of function calls, parameters and local variables, and temporary storage ofintermediate calculation results and register values.Task stack for Cortex MAll embOS tasks execute in thread mode using the process stack
阅读全文
摘要:不可屏蔽中断 Non-maskable interrupts (NMIs)embOS performs atomic operations by disabling interrupts. However, a non-maskable interrupt (NMI) cannot be disab
阅读全文
摘要:OS_EnterRegion()Indicates to the OS the beginning of a criticalregion.A critical region counter (OS_RegionCnt), which is 0by default, is incremented so that the routine can be nested.Interrupts < Fast Interrupt and Normal Interrupt > are not disabled using OS_EnterRegion();however,disabling in
阅读全文
摘要:1. 轮询全局变量2. 使用事件驱动A. 信号量(1) 二进制信号量(resource/binarysemaphore)<互斥锁Mutex(Mutual exclusion ) >信号量只有二进制的0或1OS_Use() Claims a resource and blocks it for other tasksOS_Unuse()Releases a semaphore currently in use by atask.OS_Request() Requests a specified semaphore, blocks it forother tasks if it is
阅读全文
摘要:Multitasking systemsPreemptive multitaskingCooperative multitaskingRound-robin scheduling algorithmPriority inversion /priority inheritance
阅读全文
摘要:embOS是一个优先级控制的多任务系统,是专门为各种微控制器应用于实时系统应用的嵌入式操作系统.是一个具有最小RAM和ROM占用的、高速的、多功能的高性能工具。特点:贯穿embOS的整个开发过程,微控制器有限的资源一直是开发者所顾忌的。五年来,该RTOS的内部结构已经被优化为不同客户的不同应用中,以满足工业需要。对不同微控制器的完全源码,使开发者很方便用实时操作系统构建实时程序。embOS是高度模块化的,只有需要的函数才被调用,占用的ROM非常小。 最小的内存占用:1kb ROM,30字节 RAM;由于提供源码文件,你可以用embOS灵活定制系统以满足实际需求。任务之间可以通过旗语、邮箱和事件
阅读全文
摘要:PRIMASK, FAULTMASK 和BASEPRIPRIMASK 当它置1 时,就关掉所有可屏蔽的异常,只剩下NMI和硬fault 可以响应。它的缺省值是0,表示没有关中断。FAULTMASK当它置1 时,只有NMI 才能响应,所有其它的异常,包括中断和fault,通通闭嘴。它的缺省值也是0,表示没有关异常。BASEPRI最多有9 位(由表达优先级的位数决定)。它定义了被屏蔽优先级的阈值。当它被设成某个值后,所有优先级号大于等于此值的中断都被关(优先级号越大,优先级越低)。但若被设成0,则不关闭任何中断,0 也是缺省值。为了快速地开关中断,CM3 还专门设置了一条CPS 指令,有4 种用法
阅读全文
摘要:CM3内核有16个中断,优先级通过 SCB->SHP[0]to SCB->SHP[11] 设置/****** Cortex-M3 Processor Exceptions Numbers ***************************************************/ N...
阅读全文
摘要:Windows → Preferences → Java → Editor → Content Assist将 Auto activation delay(ms): 改成 20 即可!将 Auto activation triggers for java: 的默认值“.”改为.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
阅读全文