6455_mezz_schematic
- 格式:pdf
- 大小:322.86 KB
- 文档页数:22
pca9865中树莓派清除当前占空比的代码要清除当前的占空比,可以将PWM的占空比设置为0。
以下是使用PCA9685控制PWM的示例代码:```pythonimport timefrom smbus import SMBus# 初始化PCA9685bus = SMBus(1)address = 0x40# PCA9685的寄存器地址PCA9685_MODE1 = 0x00PCA9685_PRESCALE = 0xFELED_ON_L = 0x06LED_ON_H = 0x07LED_OFF_L = 0x08LED_OFF_H = 0x09# 设置PWM频率def set_pwm_frequency(bus, address, frequency):prescale_value = 25000000.0 #25MHzprescale_value /= 4096.0 #12 bitsprescale_value /= float(frequency)prescale_value -= 1.0prescale = int(prescale_value + 0.5)old_mode = bus.read_byte_data(address, PCA9685_MODE1)new_mode = (old_mode & 0x7F) | 0x10 #睡眠模式bus.write_byte_data(address, PCA9685_MODE1, new_mode)bus.write_byte_data(address, PCA9685_PRESCALE, prescale) bus.write_byte_data(address, PCA9685_MODE1, old_mode)time.sleep(0.005) #延迟5ms生效bus.write_byte_data(address, PCA9685_MODE1, old_mode |0x80) #唤醒# 设置PWM占空比def set_pwm_duty_cycle(bus, address, channel, duty_cycle): on_value = 0off_value = int(duty_cycle * 4095 / 100) #将占空比映射到4096的范围内bus.write_byte_data(address, LED_ON_L + 4 * channel,on_value & 0xFF)bus.write_byte_data(address, LED_ON_H + 4 * channel,on_value >> 8)bus.write_byte_data(address, LED_OFF_L + 4 * channel,off_value & 0xFF)bus.write_byte_data(address, LED_OFF_H + 4 * channel,off_value >> 8)# 清除当前占空比def clear_pwm_duty_cycle(bus, address, channel):set_pwm_duty_cycle(bus, address, channel, 0)# 设置PWM频率为50Hzset_pwm_frequency(bus, address, 50)# 清除当前占空比clear_pwm_duty_cycle(bus, address, 0)```请注意,此示例使用第三方库`SMBus`来控制I2C通信。
Frequency Converter with Trip ValuesKFD2-UFC-Ex1.D<1-channel isolated barrier<24 V DC supply (Power Rail)<Input for NAMUR sensors or dry contacts<Input frequency 1 mHz ... 5 kHz<Current output 0/4 mA ... 20 mA<Relay contact and transistor output<Start-up override<Line fault detection (LFD)<Up to SIL 2 acc. to IEC 61508/IEC 61511This isolated barrier is used for intrinsic safety applications.The device is a universal frequency converter that changes a digital input signal into a proportional free adjustable 0/4 mA ... 20 mA analog output signal and functions as a switch amplifier and a trip alarm.The functions of the switch outputs (2 relay outputs and 1 potential free transistor output) are easily adjustable [trip value display (min/max alarm), serially switched output, pulse divider output, error signal output].The device is easily configured by the use of keypad or with the PACTware configuration software.A fault is signalized by LEDs acc. to NAMUR NE44 and a separate collective error message output.For additional information, refer to the manual and .Zone 2Div. 23-1+161718101112III20-III13+14-8+7-IV24 V DC23+24-edate:222-1-1Dateofissue:222-1-1Filename:231194_eng.pdfe d a t e : 2022-01-10 D a t e of i s s u e : 2022-01-10 F i l e n a m e : 231194_e ng .p d fe d a t e : 2022-01-10 D a t e of i s s u e : 2022-01-10 F i l e n a m e : 231194_e ng .p d fe d a t e : 2022-01-10 D a t e of i s s u e : 2022-01-10 F i l e n a m e : 231194_e ng .p d fAccessoriese d a t e : 2022-01-10 D a t e of i s s u e : 2022-01-10 F i l e n a m e : 231194_e ng .p d fe d a t e : 2022-01-10 D a t e of i s s u e : 2022-01-10 F i l e n a m e : 231194_e ng .p d fKFD2-UFC-Ex1.DFrequency Converter with Trip Values Maximum Switching Power of Output ContactsResistive load DC Resistive load AC1max. 105 switching cycles0.110.220.330.440.5I (A)。
veu mxgraph mxcodecregistry用法-概述说明以及解释1.引言1.1 概述概述是文章中的第一个部分,它旨在向读者介绍本文所要讨论的主题——veu mxgraph mxcodecregistry的用法。
在这一部分,我们将简要地概括veu mxgraph mxcodecregistry,并介绍它在实际应用中的重要性和功能。
veu mxgraph mxcodecregistry是一个开源的JavaScript库,用于创建和管理图形用户界面中的可视化图形。
它建立在veu和mxgraph库的基础之上,提供了一种简单且强大的方式来创建和定制各种图形元素。
通过veu mxgraph mxcodecregistry,开发者可以轻松地创建各种类型的图表、流程图、组织结构图等,以满足用户的不同需求。
它提供了丰富的图形元素和工具,使开发人员能够轻松地设计和编辑这些图形,以实现更好的可视化效果。
此外,veu mxgraph mxcodecregistry还具有良好的扩展性和灵活性。
开发人员可以根据自己的需求自定义和扩展其功能,以适应不同的项目要求。
它还能够与其他常用的前端框架和工具进行集成,提供更加便捷和高效的开发体验。
在本文中,我们将探讨veu mxgraph mxcodecregistry的基本用法,并介绍一些实际应用案例。
通过详细的实例和说明,读者将能够了解和掌握veu mxgraph mxcodecregistry的使用方法,从而在自己的项目中应用这一强大的可视化工具。
在接下来的章节中,我们将深入研究veu mxgraph mxcodecregistry 的定义、作用、基本用法,并总结其优势和应用场景。
我们还将展望veu mxgraph mxcodecregistry的未来发展趋势,以期为读者提供更多有益的信息和参考。
总而言之,本文将全面介绍veu mxgraph mxcodecregistry的用法。
CODE ENGLISH CONTENT CHINA CONTENTO2Verify Real Mode校验实模式O3Disable Non-Maskable Internupt(NMI)放弃非屏蔽中断O4Get CPU type获得CPU类型O6Initialize system hardware 初始化系统硬件O7Disable shadow and execute code from the ROM放弃映射和从只读存储器执行代码 O8Initalize chipset with initial POST valucs用初始自检值初始化芯片组O9Set IN POST flag置入自检标示OA Initilize CPU registers初始化CPU 寄存器OB Enable CPU Cache激活CPU缓存OC Initialize caches to initial POST values用初始自检值初始化缓存OE Initialize I/O component初始化输入,输出组件OF Initialize the local bus IDE初始化局部总线IDE 10Initialize Power Management初始化电源管理11Load alternate registers with initial POST values用自检初始值加载替换寄存器12Restore CPU control word during warm boot恢复CPU控制字在热启动时13Initialize PCI BUS Mastering devices初始化PCI总线主设备14Initialize Keyboard controller初始化键盘控制器16BIOS ROM checksum BIOS ROM求校验和17Iinitalize cache before memory Auto size在内存自动排序初始化缓存188254 timer initialization8254时钟计数器初始化1A8237 DMA controller initilzation8237DMA控制器初始化1C Reset Programmable Intemupt conntpller重置可编程中断请求控制器20Test DRAM refresh测试DRAM刷新22Test 8742 Keyboard Conntroller测试8742键盘控制器24Set ES segment register to 4 GB设置ES段寄存器达4GB28Auto size DRAM自动测试DRAM容量29Initialize POST Memory Manager初始化自检内存管理器2A Clear 512 KB base RAM512KB基本内存清零2C RAM failure on address line RAM失败在某地址线2E RAM failure on data bits of low byte of memory bus RAM失败在存储总线低位某数据位 2F Enable cache before system BIOS shadow激活缓存在系统BIOS映射前32Test CPUbus-clock freguency测试CPU 总线时钟频率33Initialize Phoenix Dispatch Manager初始化凤凰分派管理器36Warm start shut down热启动关机38Shadow system BIOS ROM映射系统BIOS ROM3A Auto size cache自动测试缓存容量3C Advanced configuration of chipset registers芯片组寄存器高级配置3D Load altrnate registers with CMOS values用CMOS值加载交换寄存器41Initialize extended memory for RomPilot为ROM引导初始化扩展存储器42Initialize interrupt vectors初始化中断向量45POST device initialization自检设备初始化46Check ROMcopyright notice检查ROM版权提示47Initialize 120 support初始化120支援48Check video configuration against CMOS检查区别于CMOS的显存配置49Initialize PCI bus and devices初始化PCI总线及设备4A Initialize all video adapters in system初始化所有系统内的显示适配器 4B QuietBoot start (optional)冷启动开始4C Shadow video BIOS ROM映射ROM内显示BIOS4E Display BIOS copyright notice显示BIOS 版权提示4F Initialize MultiBoot初始化多启动52Test Keyboard测试键盘54Set key click if enabled激活后设置键控响声55Enable USB devices激活USB设备58Test for unexpected interrupts测试意外中断59Initialize POST display service初始化自检显示服务5A Display prompt press F2 to enter SETUP显示DOS提示按F2进入设置5B Disable CPU cache放弃CPU缓存5C Test RAM between 512 and 640 KB测试RAM从512至640KB 60Test extended memory测试扩展存储器62Test ectended memory address lines测试扩展内存地址线64Jump to UserPatch1跳至用户补丁区166Configure advanced cache registers配置高级缓存寄存器67Initialize Multi Processor APIC初始化多处理器APIC68Enable external and CPU caches激活外接和CPU缓存69Display system Management Mode (SMM)area显示系统管理模式区6A Display external L2 cache size 显示外接L2缓存容量6B Load custom defaults(optional)加载用户默认值6C Dislay shadow-area message显示映射区信息6E Display possible high address for UMB recover显示可能的高端地址为UMB恢复使用70Display error messages显示错误信息72Check for configuation errors检测配置偏差76Check for keyboard errors检测键盘错误7C Set up tard ware interrupt vectors设置硬件中断向量7D Initialize Intelligent System Monitoring初始化智能系统跟踪7E Initialize coprocessor if present如果存在,初始化协处理器80Disable onboard Super I/O ports and IRQS放弃板上的超级输入输出端口及IRQS 81Late POST device initialization最后自检设备的初始化82Detect and install extemal RS232 ports侦测安装外接RS232端口83Configure non-MCD IDE controllers配置NON-MCD IDE控制器84Detect and installextermal parallel ports侦测安装外接并行端口85Initialize PC-compatible PnP ISA devices初始化兼容PC即插即用ISA设备86Re-initialize onblard I/O Ports重初始化板上的输入输出端口87Configure Motherboard Configurable Devices(optional)配置M/B可配置设备88Initializ BIOS Data area BOIS数据区初始化89Enable mon-maskable inteerupts[NMIS]激活非屏蔽中断请求8A Initializ Extended Bios Data Area扩展BIOS数据区初始化8b Test and initialize PS/2 mouse测试和初始化PS/2端口8C Initialize floppy controller初始化软驱控制器8F Determine number of ATA drives (optional)测试ATA驱动器数量90Initialize hard-disk controllers初始化硬盘驱控制器91Initialize local-bus bard-disk countrollers初始化局部总线上的硬盘控制器92Jump to Userpatch2跳至用户补丁区93Build MPTABLE for multi-processor boards为多处理器板建立多处理器列表95Install CD-ROM for boot为启动安装CD-ROM96Clear hUge ES segment register清空大量ES段寄存器97Fix up Multi Procssor table设置多处理器列表98Scarch for option ROMs,One long,授索可选只读存储器,一长,二two short beeps on checksum failure短嗡鸣声,在校验失败时99Check for SMART Drive(optional)检查SMART驱动器9A Shadow option ROMs映射选定的只读存储器9C Set up power Management设置电源管理9D Initialize security engine(oprional)初始化安防措施9E Enable bardware interrupts激活硬件中断9F Determine number of ATA and SCDI drives 检测A/A和SCDI设备数量A0Set time or day设置时间和日期A2Check key lock检查锁定键A4Initialize typebatic rateA8Erase F2 prompt清除F2提示AA Scan for F2 key stroke扫描有无F2键按下AC Enter SETUP进入设置AE clear boot flag清除启动标志B0Check for errors检查错误B1Inform Rom pilot about the end of POST通知只读存储器在自检结束后引导系统 B2POST done-prepare to boot operating system自检结束准备起动系统B4One short beep before boot起动前一个短嗡鸣声B5Terminate QuietBoot(optional)结束冷启动B6Check passwont(potional)检验密码B7Initialize ACPIBIOS初始化ACPIBIOSB9Prepare Boot准备启动BA Initialize SMBIOS初始化SMBIOSBB Initialize PuP Option ROMs初 始化即插即用只读存储器BC Clear parity checkers清零奇偶校验检测BD Display MultiBoot menu显示多启动菜单BE Clear screen (Optional)清空显示屏BF Check virus and backup reminders检查病毒备份提示C0Try to boot with INT 19试用INT 19启动C1Initialize POST Error Manager初始化自检管理C2Initialize error logging初始化错误日志C3Initialize error display function初始化错误显示功能C4Initialize system error bandler初始化系统错误处理C5PnPnd dual CMOS(optional)C6Initialize note disk (optional)C7Initialize note dock lateC8Force check(optional)强行检查CC Redirect Int 10h to ENable remote serial video重指示INT 10去激活远程窜行显示 CD Re_map I/O and memory for PCMCIA重定位I/O和内存为PCMCIA卡CE Initialize digitize and display message初始化数字的显示信息D2Unknowm interrupt不明中断The followIng are for boot block in Flash ROME0Initialize the chipset初始化芯片组E1Initialize the bridge初始化桥E2Iinitalize the CPU初始化CPUE3Initialize system timer初始化系统时钟E4Initialize system I/0初始化系统输入输出口E5Check force reCovery boot检查强行恢复启动E6Checksum BIOSROM BIOS ROM求校验和E7Go to BIOS转向BIOSE8Set Hune Segment设置大量段寄存器E9Initialize Multi procssor初始化多处理器EA Initialize OEMspectal code初始化OEM专用代码EB Initialize PIC and DMA初始化PIC 和DMAEC Initialize Memory type初始化存储类型ED Initialize Memory size初始化存储容量EE Shadow Boot Block映射启动模块EF System memory test系统存储器测试F0Initilize intemupt vectors初始化中断向量F1Initilize Run Time Clock初始化运行时钟F2Initilize video初始化显示F3Initilize System Management Manager初始化系统管理的管理器F4Output one beep输出一个嗡鸣声F5Clear Huge Seginent清空大量段寄存器F6Boot to Mini DOS最小化DOS启动F7Boot to Full DOS完整DOS启动。
ICDPPCNEXUSMPC55xx / MPC56xx In-Circuit DebuggerQuick Start GuideCopyright 2009, P&E Microcomputer Systems, Inc. All rights reserved.Visit us on the web at Document Version HistoryVersion Date Notes1.0 21 Sep 2009 Initial versionCONTENTS1 Introduction (4)1.1 P&E Compatible Hardware (4)2 Getting Started (5)2.1 Connecting to your Target (5)2.2 Reset Script (6)2.3 Loading Data and Debug Information (7)2.4 CPU and Memory Windows (8)3 Debugging (10)3.1 GOTIL command (10)3.1 Stepping through C instructions (11)3.3 Setting and Reaching Breakpoints (12)3.4 Using Code Window Popup Debug Evaluation Hints (13)3.5 Using the Variables Window (15)3.6 Modifying a Variable (16)3.7 Using the Register Interpreter (17)3.8 Adding Register Field Descriptions to the Variables Window (20)1 IntroductionThis document is a step-by-step guide to using the P&E ICDPPCNEXUS in-circuit debugger software, which is compatible with Freescale MPC55xx / MPC56xx processors. This guide covers the most commonly used features of the debugger: loading binary & debug information, accessing CPU registers & memory, stepping code, setting breakpoints, and monitoring variables.1.1 P&E Compatible HardwareThe following lists the P&E hardware compatible with the ICDPPCNEXUS debugger software.P&E Part Number Interface to host PCCABPPCNEXUS Parallel (LPT) portUSB-ML-PPCNEXUS USB 2.0 (Backwards compatible with USB 1.1 ports) Cyclone MAX Serial (RS232) portUSB 1.1 (Upwards compatible with USB 2.0 ports)Ethernet2 Getting Started2.1 Connecting to your TargetUpon starting the debugger, the connection assistant dialog appears:•Use the “Interface” and “Port” drop-down menus to choose the P&E hardware interface connected between the PC and your target board.•The “Target CPU” setting can safely be left at the “Autodetect” setting for most users. If you experience problems connecting, you can try specifying the exact Freescale device that you are connecting to.• A BDM_SPEED parameter between 2 to 4 can typically be used.Processors running at slower clock speeds will require higher values.Click the Connect button, and ICDPPCNEXUS will attempt to contact the processor. Using the default debugger settings, ICDPPCNEXUS will establish communications and reset the processor.After establishing communications, the main debugger screen will appear, and a debugger reset script macro should automatically execute and complete.2.2 Reset ScriptThis section explains the initialization that the debugger, using a reset script macro file, performs on the processor. The user can view and modify all of the macro file's initialization tasks.The processor Boot Assist Module (BAM) would normally initialize the memory of the processor. However, when running the target application from the debugger, the BAM functionality is disabled. To account for this, the debugger must run a script file on reset. The script initializes the memory of the processor similar to the way in which the BAM would initialize the processor.If ICDPPCNEXUS is launched from the Freescale CodeWarrior IDE, the correct reset script file is automatically selected.If ICDPPCNEXUS is launched stand-alone, the reset script file may need to be configured. Several reset script macros are included with the ICDPPCNEXUS debugger and have a .mac extension. For detailed information, you can view each macro file using a simple text editor such as Notepad. The macro contents will contain useful comments, such as which devices are supported by that particular macro.To configure the debugger reset script macro, select the debugger Configuration menu, Automated Script Options dialog, shown here:2.3 Loading Data and Debug InformationIf ICDPPCNEXUS is launched from the Freescale CodeWarrior IDE, your code will automatically be downloaded to the processor.•RAM projects are loaded into the processor’s internal SRAM.•FLASH projects will invoke the CPROGPPCNEXUS Flash programming software to burn the code into the processor’s internal FLASH.The debug information is also automatically loaded from CodeWarrior, which will allow you to debug using your high level source code and variables.If ICDPPCNEXUS is launched stand-alone, you will need to manually download the code and debug information. Launch the Load Dialog by clicking on the High Level Load button on the debugger tool bar:This dialog allows you to specify the binary/debug file and whether to load into RAM or FLASH. Once you are satisfied with your settings, press the “Process Load Command” button to begin the download process. This step will also load the debug information.2.4 CPU and Memory WindowsThe CPU Window displays all CPU core registers, including the Program Counter (PC) and all general purpose registers.•To modify CPU register contents, double-click the register value. You will be prompted for a new value.The Memory Window displays data at any given memory address. It can be used to view RAM contents, FLASH contents, and values of peripheral registers.•To change the memory address, right-click inside the Memory Window and select “Set Base Address”. You will be prompted for a new address to begin displaying data.•To change the contents in memory, double-click the value in memory that you would like to change. You will be prompted for a new value.3 DebuggingThis section outlines the different debugging capabilities available in the ICDPPCNEXUS debugger once the debug information has been loaded.3.1 GOTIL commandAt this point, your source window will show the assembly language startup code generated by the compiler:If you do not need to debug this section and would like to run the processor until the beginning of your “main” function, you can use the “GOTIL” command.•Type “GOTIL main” in the Status window to tell the debugger to run code until it reaches the “main” function of your code.The “GOTIL” command works with any function in your code.3.1 Stepping through C instructionsStep through the initialization code, or any source code, using the high-level language source step command. Use this feature by typing “HSTEP” in the Status window or by clicking the high-level step button on the debugger tool bar:Each time the HSTEP command executes, the debugger will rapidly single step assembly instructions until it encounters the next source instruction, at which point target execution will cease. When the debugger reaches the next source instruction, all visible windows will be updated with data from the board. After reaching the main function, step through several C language instructions. Notice that some instructions will take longer to step through than others because each C instruction may consist of a greater or fewer number of underlying assembly instructions.3.3 Setting and Reaching BreakpointsIn the source code window, there will be a small red dot and a small blue arrow next to each source instruction that has underlying object code. If a large blue arrow appears on a source line, this indicates that the program counter (PC) currently points to this instruction. If a large red stop sign appears on the source line, this indicates that a breakpoint exists on this line.•Set a breakpoint at an instruction by double-clicking the tiny red dot.•To remove a breakpoint, double-click the large red stop sign.Execution will begin in real-time when you issue the HGO command or click the high-level language GO button on the debugger tool bar:If the debugger encounters a breakpoint, execution will stop on this source line. If it does not encounter a breakpoint, target execution will continue until you press a key or use the stop button on the debugger tool bar:•By double clicking the small blue arrow, you will be issuing a GOTIL command to the address of this source line.A GOTIL command will set a single breakpoint at the desired address, and the processor will begin executing code in real-time from the current program counter (PC). When the debugger encounters the GOTIL address, execution stops. If the debugger does not encounter this location, execution continues until you press akey or use the stop button on the debugger tool bar. Note that all user breakpoints are ignored when the GOTIL command is used.You may also double-click the red and blue symbols in the disassembly window. The disassembly window may display an additional symbol, a small, blue "S" enclosed in a box. This indicates that that a source code instruction begins on this disassembly instruction.3.4 Using Code Window Popup Debug Evaluation HintsWhen debugging source code, it is convenient to view the contents of a variable while viewing your source code. The in-circuit debugger has a feature, debug hints, which displays the value of a variable while the mouse cursor is held over the variable name. The hint may be displayed in any of three locations, as shown below.The three locations for the debug hints are the code window title bar, the status window caption bar, and a popup hint that appears over the variable in source code. You can configure the hints to display in any combination.•Set the locations of debug hints in the configuration menu of the debuggerThe information in the popup hint box is similar to the information displayed in the variables window.The information includes the variable name (i), value ($1), and type (signed long).3.5 Using the Variables WindowThe variables window displays the current value of application variables. The following window shows a display of variables from the example application.Variables that are pointer or reference types are displayed in red. Normal variables are displayed in black.•Add a variable by typing the VAR command, by right clicking the variables window and choosing “Add a variable”, or by hitting the "Add Variable"button in the variables window.When adding a variable using the pop-up menu, the debugger displays the following screen.In the variable field, type the address or name of the variable. Typically, set the type of the variable to “Default”, which means that the variable will be displayed as it is defined in the debugging information. When adding a variable, you may specify the numeric display base of the variable.3.6 Modifying a Variable•To modify the current value of a variable, right-click the variable name in the variables window and select “Modify Variable” to display a dialog.Check the “Modify value” checkbox, and type the variable’s new value. After you click the OK button, the debugger updates the variable value on the target, and the debugger refreshes the variable window to display the new value. Note that the debugger will not edit certain user-defined types, such as enumerated types.•You may also modify a variable’s display properties, such as the type or numeric display base using this dialog.3.7 Using the Register InterpreterThe register interpreter provides a descriptive display of bit fields within the processor’s peripheral registers. The register interpreter allows you easily to change the value of these registers. You may quickly check the current state of a peripheral and examine the configuration of the target device.When you use the register interpreter within the debugger, it reads the current value of the peripheral register, decodes it, and displays it.To launch the register interpreter in the debugger, either use the “R” command or click the view/edit register button on the tool bar:A window will appear that allows you to select a peripheral block to examine.Double clicking the module of choice will launch the register selection window.Double clicking a specific register will launch the edit/display window for that register.The window lists the keystrokes and mouse actions, allowing you to modify the values of each of the fields. After right clicking on a specific field, the register interpreter will display all options for that field.When you quit the register view/edit window by hitting the ESC key, you will be given the opportunity to write the new value into the register, as shown in the following window.3.8 Adding Register Field Descriptions to the Variables WindowAdd register bit fields to the variables window by using the “_TR” command in the debugger or by clicking the "Add Register" button in the variables window. After selecting the register field, the field appears in the debugger variables window, and the debugger will continually update its value.。
Blackfin Debugger Release 09.2023Blackfin DebuggerTRACE32 Online HelpTRACE32 DirectoryTRACE32 IndexTRACE32 Documents ......................................................................................................................ICD In-Circuit Debugger ................................................................................................................Processor Architecture Manuals ..............................................................................................Blackfin ....................................................................................................................................Blackfin Debugger (1)Introduction (4)Brief Overview of Documents for New Users4 Demo and Start-up Scripts5 Location of Debug Connector5Warning (5)Quick Start JTAG (6)Troubleshooting (8)SYStem.Up Errors8FAQ (8)Configuration (9)System Overview9Blackfin specific SYStem Commands (10)SYStem.CONFIG Configure debugger according to target topology10 Daisy-Chain Example13 TapStates14 SYStem.CONFIG.CORE Assign core to TRACE32 instance15 SYStem.CPU CPU type selection16 SYStem.JtagClock JTAG clock selection17 SYStem.LOCK Lock and tristate the debug port17 SYStem.MemAccess Real-time memory access (non-intrusive)18 SYStem.Mode System mode selection19 SYStem.Option.IMASKASM Interrupt disable19 SYStem.Option.IMASKHLL Interrupt disable20Breakpoints (21)Software Breakpoints21 On-chip Breakpoints21 Breakpoint in ROM21Example for Breakpoints22 Memory Classes (23)CPU specific TrOnchip Commands (24)JTAG Connector (25)Blackfin DebuggerVersion 10-Oct-2023 IntroductionThis document describes the processor specific settings and features for the Blackfin Embedded Media Processor. TRACE32-ICD supports all Blackfin devices which are equipped with the JT AG debug interface.Please keep in mind that only the Processor Architecture Manual (the document you are reading at the moment) is CPU specific, while all other parts of the online help are generic for all CPUs supported by Lauterbach. So if there are questions related to the CPU, the Processor Architecture Manual should be your first choice.If some of the described functions, options, signals or connections in this Processor Architecture Manual are only valid for a single CPU the name is added in brackets.Brief Overview of Documents for New UsersArchitecture-independent information:•“Training Basic Debugging” (training_debugger.pdf): Get familiar with the basic features of a TRACE32 debugger.•“T32Start” (app_t32start.pdf): T32Start assists you in starting TRACE32 PowerView instances for different configurations of the debugger. T32Start is only available for Windows.•“General Commands” (general_ref_<x>.pdf): Alphabetic list of debug commands.Architecture-specific information:•“Processor Architecture Manuals”: These manuals describe commands that are specific for the processor architecture supported by your Debug Cable. T o access the manual for your processorarchitecture, proceed as follows:-Choose Help menu > Processor Architecture Manual.•“OS Awareness Manuals” (rtos_<os>.pdf): TRACE32 PowerView can be extended for operating system-aware debugging. The appropriate OS Awareness manual informs you how to enable theOS-aware debugging.Demo and Start-up ScriptsLauterbach provides ready-to-run start-up scripts for known Blackfin based hardware.To search for PRACTICE scripts, do one of the following in TRACE32 PowerView:•Type at the command line: WELCOME.SCRIPTS•or choose File menu > Search for Script.Y ou can now search the demo folder and its subdirectories for PRACTICE start-up scripts(*.cmm) and other demo software.Y ou can also manually navigate in the ~~/demo/blackfin/ subfolder of the system directory ofTRACE32.Location of Debug ConnectorLocate the debug connector on your target board as close as possible to the processor to minimize the capacitive influence of the trace length and cross coupling of noise onto the JT AG signals. WarningSignal LevelThe debugger output voltage follows the target voltage level. It supports a voltage range of 0.4…5.2V. ESD ProtectionNOTE:T o prevent debugger and target from damage it is recommended to connect ordisconnect the debug cable only while the target power is OFF.Recommendation for the software start:•Disconnect the debug cable from the target while the target power is off.•Connect the host system, the TRACE32 hardware and the debug cable.•Start the TRACE32 software.•Connect the debug cable to the target.•Switch the target power ON.Power down:•Switch off the target power.•Disconnect the debug cable from the target.Quick Start JTAGStarting up the debugger is done as follows:1.Select the device prompt B: for the ICD Debugger, if the device prompt is not active after the TRACE32 software was started.2.Select the CPU type to load the CPU specific settings.3.Enter debug mode:This command resets the CPU and enters debug mode. After the execution of this command access to the registers and to memory is possible. Before performing the first access to external SDRAM or FLASH the External Bus Interface Unit (EBIU) must be configured.4.The following command sequence is for the BF537 processor and configures the SDRAM controller with default values that were derived for maximum flexibility. They work for a system clock frequency between 54MHz and 133MHz.In the example a ST M29W320DB flash device is used in 16-bit mode. All four memory banks and CLKOUT are enabled.B:SYStem.CPU BF537SYStem.Up; configure SDRAM controllerData.Set 0xFFC00A1sLONG 0x0091998D Data.Set 0xFFC00A14 %WORD 0x0025Data.Set 0xFFC00A1C %WORD 0x03A0; EBIU_SDGCTL ; EBIU_SDBCTL ; EBIU_SDRRC; enable all flash memory banks and clock outData.Set 0xFFC00A00 %WORD 0x00FF; EBIU_AMGCTL; ST M29W320DB flash device in 16-bit modeFLASH.Create 1. 0x20000000--0x20003FFF 0x4000 AM29LV100 Word FLASH.Create 1. 0x20004000--0x20007FFF 0x2000 AM29LV100 Word FLASH.Create 1. 0x20008000--0x2000FFFF 0x8000 AM29LV100 Word FLASH.Create 1. 0x20010000--0x203FFFFF 0x10000 AM29LV100 Word5.Load the program.Data.LOAD.Elf demo.dxe; The file demo.dxe is in ELF format The option of the Data.LOAD command depends on the file format generated by the compiler. A detailed description of the Data.LOAD command is given in the “General Commands Reference”. The start-up sequence can be automated using the programming language PRACTICE. A typical start sequence is shown below. This sequence can be written to a PRACTICE script file (*.cmm, ASCII format) and executed with the command DO<file>.B::; Select the ICD device promptWinClear; Delete all windowsSYStem.CPU BF537; select the processorSYStem.Up; Reset the target and enter debug modeData.Load.Elf sieve.dxe; Load the applicationRegister.Set PC main; Set the PC to function mainList.Mix; Open disassembly window *) Register.view; Open register window *) PER.view; Open window with peripheral register *) Break.Set sieve; Set breakpoint to function sieveBreak.Set 0x1000 /p; Set on-chip breakpoint to address 1000; Refer to the restrictions in; On-chip Breakpoints.*) These commands open windows on the screen. The window position can be specified with the WinPOS command.TroubleshootingSYStem.Up ErrorsThe SYStem.Up command is the first command of a debug session where communication with the target is required. If you receive error messages while executing this command this may have the following reasons.All The target has no power.All There are additional loads or capacities on the JTAG lines.All The JTAG clock is too fast.FAQPlease refer to https:///kb.Configuration System OverviewBlackfin specific SYStem CommandsSYStem.CONFIG Configure debugger according to target topologyThe four parameters IRPRE, IRPOST , DRPRE, DRPOST are required to inform the debugger about the T AP controller position in the JT AG chain, if there is more than one core in the JT AG chain (e.g. ARM + DSP). The information is required before the debugger can be activated e.g. by a SYStem.Up . See Daisy-chain Example .For some CPU selections (SYStem.CPU ) the above setting might be automatically included, since the required system configuration of these CPUs is known.T riState has to be used if several debuggers (“via separate cables”) are connected to a common JT AG port at the same time in order to ensure that always only one debugger drives the signal lines. T APState and TCKLevel define the T AP state and TCK level which is selected when the debugger switches to tristate mode. Please note: nTRST must have a pull-up resistor on the target, TCK can have a pull-up or pull-down resistor, other trigger inputs need to be kept in inactive state.Format:SYStem.CONFIG <parameter> <number_or_address>SYStem.MultiCore <parameter> <number_or_address> (deprecated)<parameter>:CORE <core><parameter>:(JTAG):DRPRE <bits>DRPOST <bits>IRPRE <bits>IRPOST <bits>DAPDRPOST <bits>DAPDRPRE <bits>DAPIRPOST <bits>DAPIRPRE <bits>TAPState <state>TCKLevel <level>TriState [ON | OFF ]Slave [ON | OFF ]DEBUGPORTTYPE [JTAG | SWD ]SWDPIDLEHIGH [ON | OFF ]SWDPTargetSel <value>CORE For multicore debugging one TRACE32 PowerView GUI has to be startedper core. To bundle several cores in one processor as required by thesystem this command has to be used to define core and processorcoordinates within the system topology.Further information can be found in SYStem.CONFIG.CORE.… DRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TDI signal and the TAP you are describing. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… DRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of TAPs in theJTAG chain between the TAP you are describing and the TDO signal. InBYPASS mode, each TAP contributes one data register bit. See possibleTAP types and example below.Default: 0.… IRPOST <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JT AG chain between TDI signal andthe TAP you are describing. See possible T AP types and example below.Default: 0.… IRPRE <bits>Defines the TAP position in a JT AG scan chain. Number of InstructionRegister (IR) bits of all TAPs in the JTAG chain between the T AP you aredescribing and the TDO signal. See possible TAP types and examplebelow.Default: 0.TAPState(default: 7 = Select-DR-Scan) This is the state of the TAP controller whenthe debugger switches to tristate mode. All states of the JTAG T APcontroller are selectable.TCKLevel (default: 0) Level of TCK signal when all debuggers are tristated. TriState(default: OFF) If several debuggers share the same debug port, thisoption is required. The debugger switches to tristate mode after eachdebug port access. Then other debuggers can access the port. JT AG:This option must be used, if the JTAG line of multiple debug boxes areconnected by a JTAG joiner adapter to access a single JTAG chain. Slave(default: OFF) If more than one debugger share the same debug port, allexcept one must have this option active.JTAG: Only one debugger - the “master” - is allowed to control the signalsnTRST and nSRST (nRESET).DEBUGPORTTYPE [JTAG | SWD]It specifies the used debug port type “JT AG”, “SWD”. It assumes the selected type is supported by the target.Default: JT AG.SWDPIdleHigh [ON | OFF]Keep SWDIO line high when idle. Only for Serialwire Debug mode. Usually the debugger will pull the SWDIO data line low, when no operation is in progress, so while the clock on the SWCLK line is stopped (kept low).Y ou can configure the debugger to pull the SWDIO data linehigh, when no operation is in progress by usingSYStem.CONFIG SWDPIdleHigh ONDefault: OFF.SWDPTargetSel<value>Device address in case of a multidrop serial wire debug port.Default: none set (any address accepted).Daisy-Chain ExampleBelow, configuration for core C.Instruction register length of •Core A: 3 bit •Core B: 5 bit •Core D: 6 bitSYStem.CONFIG.IRPRE 6.; IR Core D SYStem.CONFIG.IRPOST 8.; IR Core A + B SYStem.CONFIG.DRPRE 1.; DR Core D SYStem.CONFIG.DRPOST 2.; DR Core A + BSYStem.CONFIG.CORE 0. 1.; Target Core C is Core 0 in Chip 1Core A Core B Core CCore D TDOTDI Chip 0Chip 1TapStates0Exit2-DR1Exit1-DR2Shift-DR3Pause-DR4Select-IR-Scan5Update-DR6Capture-DR7Select-DR-Scan8Exit2-IR9Exit1-IR10Shift-IR11Pause-IR12Run-Test/Idle13Update-IR14Capture-IR15Test-Logic-ResetSYStem.CONFIG.CORE Assign core to TRACE32 instance Format:SYStem.CONFIG.CORE<core_index><chip_index>SYStem.MultiCore.CORE<core_index><chip_index> (deprecated) <chip_index>:1 (i)<core_index>:1…kDefault core_index: depends on the CPU, usually 1. for generic chipsDefault chip_index: derived from CORE= parameter of the configuration file (config.t32). The COREparameter is defined according to the start order of the GUI in T32Start with ascending values.T o provide proper interaction between different parts of the debugger, the systems topology must bemapped to the debugger’s topology model. The debugger model abstracts chips and sub cores of these chips. Every GUI must be connect to one unused core entry in the debugger topology model. Once the SYStem.CPU is selected, a generic chip or non-generic chip is created at the default chip_index.Non-generic ChipsNon-generic chips have a fixed number of sub cores, each with a fixed CPU type.Initially, all GUIs are configured with different chip_index values. Therefore, you have to assign thecore_index and the chip_index for every core. Usually, the debugger does not need further information to access cores in non-generic chips, once the setup is correct.Generic ChipsGeneric chips can accommodate an arbitrary amount of sub-cores. The debugger still needs information how to connect to the individual cores e.g. by setting the JT AG chain coordinates.Start-up ProcessThe debug system must not have an invalid state where a GUI is connected to a wrong core type of a non-generic chip, two GUIs are connected to the same coordinate or a GUI is not connected to a core. The initial state of the system is valid since every new GUI uses a new chip_index according to its CORE= parameter of the configuration file (config.t32). If the system contains fewer chips than initially assumed, the chips must be merged by calling SYStem.CONFIG.CORE.SYStem.CPU CPU type selection Format:SYStem.CPU <cpu><cpu>:BF531 | BF532 | BF533 | BF534…Default selection: BF534.Selects the CPU type.SYStem.JtagClock JT AG clock selection Format:SYStem.JtagClock [<frequency>]SYStem.BdmClock<frequency>(deprecated)Default frequency: 1MHz.Selects the JT AG port frequency (TCK). Any frequency up to 50MHz can be entered, it will be generated by the debuggers internal PLL.For CPUs which come up with very low clock speeds it might be necessary to slow down the JT AGfrequency. After initialization of the CPUs PLL the JT AG clock can be increased.SYStem.LOCK Lock and tristate the debug port Format:SYStem.LOCK [ON | OFF]Default: OFF.If the system is locked, no access to the debug port will be performed by the debugger. While locked, the debug connector of the debugger is tristated. The main intention of the SYStem.LOCK command is to give debug access to another tool.SYStem.MemAccess Real-time memory access (non-intrusive) Format:SYStem.MemAccess Denied | StopAndGo | BTCBTC“BTC” allows a non-intrusive memory access while the core is running, if aBackground T elemetry Channel (BTC) is defined in your application. Anyinformation on how to create such a channel can be found in AnalogDevices’ VisualDSP++ user’s manual. The JT AG clock speed should be asfast as possible to get good performanceDenied Real-time memory access during program execution to target is disabled.StopAndGo Temporarily halts the core(s) to perform the memory access. Each stoptakes some time depending on the speed of the JT AG port, the number ofthe assigned cores, and the operations that should be performed.SYStem.Mode System mode selectionFormat:SYStem.Mode <mode>SYStem.Attach (alias for SYStem.Mode Attach)SYStem.Down (alias for SYStem.Mode Down)SYStem.Up (alias for SYStem.Mode Up)<mode>:DownGoAttachUpDown Disables the debugger.Go Resets the target with debug mode enabled and prepares the CPU fordebug mode entry. After this command the CPU is in the system.upmode and running. Now, the processor can be stopped with the breakcommand or if a break condition occurs.Attach User program remains running (no reset) and the debug interface isinitialized.Up Resets the target and sets the CPU to debug mode. After execution ofthis command the CPU is stopped and prepared for debugging.StandBy Not supported.NoDebug Not supported.SYStem.Option.IMASKASM Interrupt disable Format:SYStem.Option.IMASKASM [ON | OFF]Mask interrupts during assembler single steps. Useful to prevent interrupt disturbance during assembler single stepping.SYStem.Option.IMASKHLL Interrupt disable Format:SYStem.Option.IMASKHLL [ON | OFF]Mask interrupts during HLL single steps. Useful to prevent interrupt disturbance during HLL single stepping.BreakpointsThere are two types of breakpoints available: software breakpoints and on-chip breakpoints. Software BreakpointsSoftware breakpoints are the default breakpoints. A special breakcode is patched to memory so it only can be used in RAM or FLASH areas.There is no restriction in the number of software breakpoints.On-chip BreakpointsThe Blackfin processor has a total of six instruction and two data on-chip breakpoints.A pair of two breakpoints may be further grouped together to form a range breakpoint. A range breakpointcan be including or excluding. In the first case the core is stopped if an address in the range is detected, in the second case the core is stopped when an address outside of the range is observed.Breakpoint in ROMWith the command MAP.BOnchip<range> it is possible to inform the debugger about ROM(FLASH,EPROM) address ranges in target. If a breakpoint is set within the specified address range the debugger uses automatically the available on-chip breakpoints.Example for BreakpointsAssume you have a target with FLASH from 0x20000000 to 0x200FFFFF and RAM from 0x0 to 0x1000000. The command to configure TRACE32 correctly for this configuration is: Map.BOnchip 0x20000000--0x200FFFFFThe following breakpoint combinations are possible.Software breakpoints:Break.Set 0x0 /Program; Software Breakpoint 1Break.Set 0x1000 /Program; Software Breakpoint 2On-chip breakpoints:Break.Set 0x20000100 /Program; On-chip Breakpoint 1Break.Set 0x2000ff00 /Program; On-chip Breakpoint 2Memory ClassesThe following memory classes are available: Memory Class DescriptionP ProgramD DataCPU specific TrOnchip CommandsThe TrOnchip command group is not available for the Blackfin debugger.JTAG ConnectorSignal Pin Pin SignalGND12EMU-N/C34GNDVDDIO56TMSN/C78TCKN/C910TRST-N/C1112TDIGND1314TDOJTAG Connector Signal Description CPU Signal TMS JTAG-TMS,TMSoutput of debuggerTDI TDI JTAG-TDI,output of debuggerTCK TCK JTAG-TCK,output of debugger/TRST /TRST JTAG-TRST,output of debuggerTDO TDO JTAG-TDO,input for debugger/EMU JTAG Emulation Flag /EMUVDDIO VDDIO This pin is used by the debugger to sense the targetI/O voltage and to set the drive levels accordingly. Ifthe sensed voltage level is too low (e.g. target has nopower) the debugger powers down its drivers toprevent the target from damage.。
PCA9865中树莓派清除当前占空比的代码1. 前言在近年来,随着物联网技术的飞速发展,树莓派(Raspberry Pi)作为一款廉价、小巧、高性能的单板计算机,受到了广泛的关注和运用。
在树莓派的应用中,经常需要控制各种外部设备的PWM信号,而PCA9865作为一款16通道PWM芯片,成为了树莓派控制PWM信号的重要组件之一。
2. PCA9865简介PCA9865是一款常见的16通道PWM驱动芯片,可以通过I2C总线与树莓派进行通信,能够提供16路独立的PWM输出。
在树莓派控制外部设备时,通常需要根据实际需求来调整PWM信号的占空比,而PCA9865则能够很好地完成这一任务。
3. 清除当前占空比的代码编写在使用PCA9865进行PWM信号控制时,经常会遇到需要清除当前占空比的情况。
为了方便理解,我们可以考虑编写一段Python代码来实现清除当前占空比的功能。
import smbusimport time# 定义PCA9865的位置区域PCA9865_ARESS = 0x40# 定义寄存器位置区域MODE1 = 0x00PRE_SCALE = 0xFELED0_ON_L = 0x06# 初始化I2C总线bus = smbus.SMBus(1)# 函数:清除当前占空比def clear_pwm_duty_cycle(channel):# 设置PWM输出为全高电平bus.write_byte_data(PCA9865_ARESS, LED0_ON_L + 4 * channe l, 0x10)bus.write_byte_data(PCA9865_ARESS, LED0_ON_L + 4 * channe l + 1, 0x00)bus.write_byte_data(PCA9865_ARESS, LED0_ON_L + 4 * channe l + 2, 0x10)bus.write_byte_data(PCA9865_ARESS, LED0_ON_L + 4 * channe l + 3, 0x00)# 清除当前占空比clear_pwm_duty_cycle(0)上面的代码中,我们首先引入了smboos库来对I2C总线进行初始化,然后定义了PCA9865的位置区域和各个寄存器的位置区域。
zwallocatevirtualmemory 参数-回复ZWAllocateVirtualMemory是Windows操作系统中的一个API函数,用于在用户态进程的虚拟地址空间中分配内存。
本文将详细介绍ZWAllocateVirtualMemory函数的参数和作用,以及一步一步回答与其相关的问题。
1. ZWAllocateVirtualMemory的函数原型是什么?NTSTATUS NTAPI ZWAllocateVirtualMemory(HANDLE ProcessHandle, 指定进程的句柄PVOID *BaseAddress, 分配的内存的起始地址ULONG_PTR ZeroBits, 必须被清零的低位数PSIZE_T RegionSize, 分配的内存的大小ULONG AllocationType, 内存分配类型ULONG Protect 内存保护属性);2. ZWAllocateVirtualMemory函数的参数具体是什么含义?- ProcessHandle:指定进程的句柄,用于指定在哪个进程的虚拟地址空间中分配内存。
可以通过OpenProcess或CreateProcess等函数获取进程句柄。
该参数对应于ZwAllocateVirtualMemory内核函数中的ProcessHandle参数。
- BaseAddress:分配的内存的起始地址。
传入一个指向指针的指针,函数将返回分配的内存的起始地址。
如果BaseAddress为NULL,则由系统自动分配。
该参数对应于ZwAllocateVirtualMemory内核函数中的BaseAddress参数。
- ZeroBits:必须被清零的低位数。
该参数指定希望从分配的起始地址开始多少位必须为零。
通常将其设置为0。
该参数对应于ZwAllocateVirtualMemory内核函数中的ZeroBits参数。
- RegionSize:分配的内存的大小。
rule.findbugs.BX_BOXING_IMMEDIATELY_=性能- 基本类型包装之后立刻解包rule.findbugs.IJU_SETUP_NO_=使用错误- TestCase定义的setUp没有调用super.setUp()rule.findbugs.TQ_ALWAYS_VALUE_USED_WHERE_NEVER_=使用错误- 某个值使用了注解限制类型,但是这个限制永远不会发生rule.findbugs.TLW_TWO_LOCK_=多线程错误- 等待两个被持有的锁rule.findbugs.RV_01_TO_=使用错误- 0至1的随机数被当做整数0rule.findbugs.NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABL =高危- 参数必须非null但是标记为可为nullrule.findbugs.RV_ABSOLUTE_VALUE_OF_RANDOM_=使用错误- 尝试计算32位随机整数的绝对值rule.findbugs.EC_INCOMPATIBLE_ARRAY_=使用错误- 使用equals()比较不兼容的数组rule.findbugs.UL_UNRELEASED_LOCK_EXCEPTION_=多线程错误- 方法没有在所有异常路径释放锁rule.findbugs.SE_NONSTATIC_=不良实践- serialVersionUID 不是static的rule.findbugs.UCF_USELESS_CONTROL_=高危- 无用控制流rule.findbugs.BC_IMPOSSIBLE_=使用错误- 不可能的转换rule.findbugs.XSS_REQUEST_PARAMETER_TO_SEND_=安全风险- servlet的反射导致跨站脚本漏洞rule.findbugs.DM_NEW_FOR_=性能- 仅为了获得一个方法就创建了一个对象rule.findbugs.OBL_UNSATISFIED_=试验- 方法可能在清理流或资源时失败rule.findbugs.UW_UNCOND_=多线程错误- 无条件等待rule.findbugs.DLS_DEAD_LOCAL_STORE_OF_=高危- 把null设置给不会用到的局部变量rule.findbugs.NM_CLASS_NAMING_=类名应该以大写字母开头rule.findbugs.RC_REF_COMPARISON_BAD_PRACTICE_=使用错误- 怀疑对两个布尔值的引用进行比较rule.findbugs.MWN_MISMATCHED_=多线程错误- 不匹配的notify()rule.findbugs.NM_VERY_=错误- 非常容易迷惑的方法名rule.findbugs.FI_NULLIFY_=不良实践- 空Finalizer禁用了超类的finalizerrule.findbugs.MTIA_SUSPECT_STRUTS_INSTANCE_=高危- 继承了struts Action的类使用了实例变量rule.findbugs.DM_STRING_=性能- 方法调用了效率很低的new String(String)构造方法rule.findbugs.STCAL_INVOKE_ON_STATIC_DATE_FORMAT_=多线程错误- 调用静态DateFormatrule.findbugs.NP_NULL_PARAM_DEREF_=使用错误- 非虚拟方法调用向非空参数传入了nullrule.findbugs.FI_=不良实践- 应该删除空的finalizerrule.findbugs.CD_CIRCULAR_=试验- 类间存在循环引用rule.findbugs.EC_UNRELATED_=使用错误- 使用equals()比较不同类型rule.findbugs.EI_EXPOSE_STATIC_=恶意代码漏洞- 把可变对象保存到静态字段中可能会暴露内部静态状态rule.findbugs.DMI_INVOKING_TOSTRING_ON_ANONYMOUS_=错误- 对数组执行toStringrule.findbugs.SIC_INNER_SHOULD_BE_STATIC_=性能- 可以重构成一个静态内部类rule.findbugs.STI_INTERRUPTED_ON_=错误- 在thread实例上调用了静态Thread.interrupted()方法_IDIOM_NO_SUPER_=不良实践- clone方法没有调用super.clone()rule.findbugs.VA_FORMAT_STRING_BAD_=错误用法- 格式化字符串占位符与传入的参数不匹配rule.findbugs.EQ_DOESNT_OVERRIDE_=高危- 类没有覆盖父类的equals方法rule.findbugs.BC_IMPOSSIBLE_DOWNCAST_OF_=错误用法- 集合转换为数组元素时发生的类型转换错误rule.findbugs.SE_NO_SUITABLE_CONSTRUCTOR_FOR_=不良实践- 类是可扩展的,但是没有提供无参数的构造方法rule.findbugs.TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_ALWAYS_SIN =错误用法- 数值需要类型标示,但是却标记为未知rule.findbugs.SIC_INNER_SHOULD_BE_STATIC_NEEDS_=性能- 可以筹够成一个静态内部类rule.findbugs.EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_=不良实践- equals检测不兼容的参数操作rule.findbugs.RV_RETURN_VALUE_OF_PUTIFABSENT_=错误用法- 忽略了putIfAbsent的返回值,传递给putIfAbsent的值被重用rule.findbugs.STCAL_INVOKE_ON_STATIC_CALENDAR_=多线程错误- 调用静态Calendarrule.findbugs.MS_CANNOT_BE_=恶意代码漏洞- 字段不是final的,不能防止恶意代码的攻击rule.findbugs.IS_INCONSISTENT_=多线程错误- 不一致的同步rule.findbugs.SE_NO_=不良实践- 类是可序列化的,但是没有定义serialVersionUIDrule.findbugs.EI_EXPOSE_=恶意代码漏洞- 可能暴露内部实现,通过与可变对象引用协作rule.findbugs.NM_METHOD_CONSTRUCTOR_=错误用法- 明显的方法/构造方法混淆rule.findbugs.ICAST_INTEGER_MULTIPLY_CAST_TO_=高危- 整形乘法的结果转换为long型rule.findbugs.QF_QUESTIONABLE_FOR_=高危- for循环中存在复杂,微妙或者错误的自增rule.findbugs.DLS_DEAD_STORE_OF_CLASS_=错误用法- 类中保存了无用字符rule.findbugs.NM_FUTURE_KEYWORD_USED_AS_MEMBER_=不良实践- 使用了未来java版本中成为关键字的标识rule.findbugs.BC_VACUOUS_=高危- instanceof会一直返回truerule.findbugs.INT_VACUOUS_BIT_=高危- 在整形上进行位操作时有一些位上出现空洞rule.findbugs.NP_NULL_=错误用法- 一个已知的null值被检测它是否是一个类型的实例rule.findbugs.SIC_THREADLOCAL_DEADLY_=错误用法- 非静态内部类和ThreadLocal的致命结合rule.findbugs.EQ_=高危- 罕见的equals方法rule.findbugs.IJU_NO_=错误用法- TestCase没有任何测试rule.findbugs.EQ_OVERRIDING_EQUALS_NOT_=错误用法- equals方法覆盖了父类的equals可能功能不符rule.findbugs.XFB_XML_FACTORY_=高危- 方法直接调用了xml接口的一个具体实现rule.findbugs.SWL_SLEEP_WITH_LOCK_=多线程错误- 方法在获得锁时调用了Thread.sleep()_=不良实践- 类实现了Cloneable ,但是没有定义或使用clone方法rule.findbugs.WA_AWAIT_NOT_IN_=多线程错误- 未在循环中使用的Condition.await()rule.findbugs.DM_FP_NUMBER_=性能- 方法调用了低效的浮点书构造方法;应该使用静态的valueOf代替rule.findbugs.SF_SWITCH_NO_=Switch语句中没有包含defaultrule.findbugs.NP_NULL_ON_SOME_PATH_FROM_RETURN_=高危- 调用返回返回值可能出现null值rule.findbugs.NP_CLONE_COULD_RETURN_=不良实践- Clone方法可能返回nullrule.findbugs.MS_OOI_=恶意代码漏洞- 属性应该从接口中移除并将访问权限设置为包保护rule.findbugs.DM_BOXED_PRIMITIVE_=性能- 方法使用了装箱的基本类型只为了调用toStringrule.findbugs.EQ_ABSTRACT_=不良实践- 抽象类定义了协变的equals方法rule.findbugs.DM_STRING_=性能- 方法调用了String的toString()方法rule.findbugs.SE_METHOD_MUST_BE_=错误用法- 方法必须是private 的为了让序列化正常工作rule.findbugs.DL_SYNCHRONIZATION_ON_=多线程错误- 在Boolean 上使用同步可能导致死锁rule.findbugs.UWF_UNWRITTEN_=错误用法- 未赋值属性rule.findbugs.IS2_INCONSISTENT_=多线程错误- 不一致的同步rule.findbugs.IM_AVERAGE_COMPUTATION_COULD_=高危- 计算平均值可能溢出rule.findbugs.BIT_SIGNED_CHECK_HIGH_=错误用法- 检查位运算的符号rule.findbugs.FL_MATH_USING_FLOAT_=错误用法- 方法进行数学运算时使用了浮点数的精度rule.findbugs.WS_WRITEOBJECT_=多线程错误- 类的writeObject()方法是同步的,但是没有做其他事情rule.findbugs.RV_RETURN_VALUE_=错误用法- 方法忽略了返回值rule.findbugs.SQL_NONCONSTANT_STRING_PASSED_TO_=安全风险- 非常量的字符串传递给方法执行SQL语句rule.findbugs.JCIP_FIELD_ISNT_FINAL_IN_IMMUTABLE_=不良实践- 不可变的类的属性应该是finalrule.findbugs.AM_CREATES_EMPTY_ZIP_FILE_=不良实践- 创建了一个空的zip文件的入口rule.findbugs.DM_NEXTINT_VIA_=性能- 使用Random的nextInt 方法来获得一个随机整数,而不是nextDoublerule.findbugs.UI_INHERITANCE_UNSAFE_=不良实践- 如果类被扩展,GetResource的使用可能就是不安全的rule.findbugs.SIO_SUPERFLUOUS_=错误用法- 不必要的类型检测使用instanceof操作符rule.findbugs.EQ_OTHER_NO_=错误用法- equals()方法定义,但是没有覆盖equals(Object)M_USELESS_ABSTRACT_=试验- 抽象方法已经在实现的接口中定义了rule.findbugs.MTIA_SUSPECT_SERVLET_INSTANCE_=高危- 扩展Servlet的类使用了实例变量rule.findbugs.DM_USELESS_=多线程错误- 使用默认的空run方法创建了一个线程rule.findbugs.ML_SYNC_ON_UPDATED_=多线程错误- 方法在一个修改了的属性上进行了同步rule.findbugs.CO_SELF_NO_=不良实践- 协变的compareTo()定义rule.findbugs.BC_UNCONFIRMED_=高危- 未检查/未证实的类型转换rule.findbugs.FI_FINALIZER_NULLS_=不良实践- Finalizer空属性rule.findbugs.BIT_=错误用法- 不兼容的位掩码(BIT_AND)rule.findbugs.FE_FLOATING_POINT_=高危- 测试浮点数相等rule.findbugs.TQ_EXPLICIT_UNKNOWN_SOURCE_VALUE_REACHES_NEVER_SINK. name=错误用法- 值不要求有类型标示,但是标记为未知rule.findbugs.NP_NULL_PARAM_=错误用法- 方法调用把null传递给一个非null参数rule.findbugs.FB_MISSING_EXPECTED_=试验- findbugs丢失了期待或需要的警告rule.findbugs.DMI_INVOKING_HASHCODE_ON_=错误用法- 在数组上调用了hashCoderule.findbugs.QBA_QUESTIONABLE_BOOLEAN_=错误用法- 方法在布尔表达式中分配了boolean文字rule.findbugs.SA_FIELD_SELF_=错误用法- 属性自己与自己进行了比较rule.findbugs.UR_UNINIT_READ_CALLED_FROM_SUPER_=错误用法- 父类的构造方法调用未初始化属性的方法rule.findbugs.ES_COMPARING_PARAMETER_STRING_WITH_=不良实践- 比较字符串参数使用了== 或!=rule.findbugs.INT_BAD_COMPARISON_WITH_NONNEGATIVE_=错误用法- 错误比较非负值与负数rule.findbugs.INT_BAD_COMPARISON_WITH_SIGNED_=错误用法- 错误比较带符号的byterule.findbugs.IO_APPENDING_TO_OBJECT_OUTPUT_=错误用法- 尝试向一个对象输出流添加信息rule.findbugs.FI_MISSING_SUPER_=不良实践- Finalizer没有调用父类的finalizerrule.findbugs.VA_FORMAT_STRING_EXTRA_ARGUMENTS_=错误用法- 传递了多余实际使用的格式化字符串的参数rule.findbugs.HE_EQUALS_USE_=不良实践- 类定义了equals(),但使用了Object.hashCode()rule.findbugs.IJU_BAD_SUITE_=错误用法- TestCase声明了一个错误的suite方法rule.findbugs.DMI_CONSTANT_DB_=安全风险- 硬编码了数据库密码rule.findbugs.REC_CATCH_=高危- 捕获了没有抛出的异常rule.findbugs.PS_PUBLIC_=高危- 类在公用接口中暴露了同步和信号rule.findbugs.EC_UNRELATED_=错误用法- 调用equals()比较不同的接口类型rule.findbugs.UCF_USELESS_CONTROL_FLOW_NEXT_=错误用法- 执行到下一行的无用流程控制rule.findbugs.LG_LOST_LOGGER_DUE_TO_WEAK_=试验- OpenJDK中存在潜在的丢失logger的风险,因为弱引用rule.findbugs.NP_UNWRITTEN_=错误用法- 读取未初始化的属性rule.findbugs.DMI_UNSUPPORTED_=高危- 调用不支持的方法rule.findbugs.RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE. name=高危- 重复比较非空值和nullrule.findbugs.EC_BAD_ARRAY_=错误用法- 调用equals(),与==效果一样rule.findbugs.EI_EXPOSE_=恶意代码漏洞- 可能通过返回一个可变对象的引用暴露了内部实现rule.findbugs.NP_DEREFERENCE_OF_READLINE_=高危- 没有判断readLine()的结果是否为空rule.findbugs.UPM_UNCALLED_PRIVATE_=性能- 从未用到的私有方法rule.findbugs.NP_NULL_ON_SOME_=错误用法- 可能出现空指针引用rule.findbugs.NP_EQUALS_SHOULD_HANDLE_NULL_=不良实践- equals()方法没有检测null参数rule.findbugs.EC_NULL_=错误用法- 使用空参数调用equals()rule.findbugs.SE_BAD_FIELD_=不良实践- 非序列化值保存在序列化类的实例变量中rule.findbugs.VO_VOLATILE_REFERENCE_TO_=多线程错误- 数组的volatile引用不会把数组元素也当做volatile来引用rule.findbugs.NP_SYNC_AND_NULL_CHECK_=多线程错误- 同步和空值检测发生在同一个属性上rule.findbugs.DM_=不良实践- 方法调用了System.exit(...)rule.findbugs.RC_REF_=不良实践- 怀疑进行了引用比较rule.findbugs.SE_NO_SUITABLE_=不良实践- 类是可序列化的,但是父类没有定义无参数构造方法rule.findbugs.DC_=多线程错误- 可能对属性进行了双重检测rule.findbugs.DMI_LONG_BITS_TO_DOUBLE_INVOKED_ON_=错误用法- 在int上调用了Double.longBitsToDoublerule.findbugs.RpC_REPEATED_CONDITIONAL_=错误用法- 重复判断条件rule.findbugs.WMI_WRONG_MAP_=性能- keySet迭代是低效的,使用entrySet代替rule.findbugs.DLS_DEAD_LOCAL_=高危- 未用的局部变量rule.findbugs.INT_BAD_REM_BY_=错误用法- 整数剩余模1rule.findbugs.RV_RETURN_VALUE_IGNORED_BAD_=不良实践- 方法忽略异常返回值rule.findbugs.SA_LOCAL_SELF_=高危- 局部变量的自我赋值rule.findbugs.MS_SHOULD_BE_=恶意代码漏洞- 属性不是final,但是应该设置成finalrule.findbugs.SIC_INNER_SHOULD_BE_=性能- 应该是一个静态内部类rule.findbugs.NP_GUARANTEED_=错误用法- null值一定会被调用rule.findbugs.SE_READ_RESOLVE_MUST_RETURN_=不良实践- readResolve方法必须返回Objectrule.findbugs.NP_LOAD_OF_KNOWN_NULL_=高危- 加载了已知的null值rule.findbugs.BX_BOXING_IMMEDIATELY_UNBOXED_TO_PERFORM_COERCION.na me=性能- 基本数据被装箱又被拆箱_IMPLEMENTS_CLONE_BUT_NOT_=不良实践- 类定义了clone()但没有实现Cloneablerule.findbugs.CO_ABSTRACT_=不良实践- 抽象类定义了协变的compareTo()方法rule.findbugs.BAC_BAD_APPLET_=试验- 错误的Applet构造方法依赖未初始化的AppletStubrule.findbugs.EQ_GETCLASS_AND_CLASS_=不良实践- equals方法因为子类失败rule.findbugs.DB_DUPLICATE_SWITCH_=高危- 在两个switch语句中使用了相同的代码rule.findbugs.DB_DUPLICATE_=高危- 在两个分支中使用了相同的代码rule.findbugs.UOE_USE_OBJECT_=试验- 在final类上调用了equals,但是没有覆盖Object的equals方法rule.findbugs.FI_=不良实践- Finalizer除了调用父类的finalizer以外什么也没做rule.findbugs.NP_ALWAYS_=错误用法- 调用了null指针rule.findbugs.DMI_VACUOUS_SELF_COLLECTION_=错误用法- 集合的调用不能被感知rule.findbugs.DLS_DEAD_LOCAL_STORE_IN_=错误用法- 返回语句中的无用的赋值rule.findbugs.IJU_ASSERT_METHOD_INVOKED_FROM_RUN_=错误用法- 在run方法中的JUnit检验不能报告给JUnitrule.findbugs.DMI_EMPTY_DB_=安全风险- 空的数据库密码rule.findbugs.DM_BOOLEAN_=性能- 方法调用了低效的Boolean构造方法;使用Boolean.valueOf(...)代替rule.findbugs.BC_IMPOSSIBLE_=错误用法- 不可能转型rule.findbugs.BC_EQUALS_METHOD_SHOULD_WORK_FOR_ALL_=不良实践- Equals方法不应该假设任何有关参数类型的事宜rule.findbugs.RV_EXCEPTION_NOT_=错误用法- 异常创建后就丢弃了,没有抛出rule.findbugs.VA_PRIMITIVE_ARRAY_PASSED_TO_OBJECT_=错误用法- 基本类型数组传递给一个期待可变对象类型参数的方法rule.findbugs.LI_LAZY_INIT_UPDATE_=多线程错误- 错误的延迟初始化和更新静态属性rule.findbugs.SA_FIELD_SELF_=错误用法- 属性自身赋值rule.findbugs.EQ_ALWAYS_=错误用法- equals方法一直返回falserule.findbugs.DMI_RANDOM_USED_ONLY_=不良实践- Random对象创建后只用了一次rule.findbugs.NM_CLASS_NOT_=不良实践- Class没有继承Exception,虽然名字像一个异常rule.findbugs.SA_LOCAL_DOUBLE_=高危- 给局部变量双重赋值rule.findbugs.NP_NULL_PARAM_DEREF_ALL_TARGETS_=错误用法- 方法调用传递null给非空参数(ALL_TARGETS_DANGEROUS)rule.findbugs.NP_TOSTRING_COULD_RETURN_=不良实践- toString方法可能返回nullrule.findbugs.BC_BAD_CAST_TO_ABSTRACT_=高危- 转换成抽象集合值得怀疑rule.findbugs.NM_LCASE_=类定义了hashcode(); 应该是hashCode()吧?rule.findbugs.RU_INVOKE_=多线程错误- 在线程中调用了run(你的意思是再启动一次么?)rule.findbugs.DMI_INVOKING_TOSTRING_ON_=错误用法- 调用了数组的toStringrule.findbugs.NM_METHOD_NAMING_=方法名应该以小写字母开头rule.findbugs.RCN_REDUNDANT_COMPARISON_TWO_NULL_=高危- 重复比较两个null值rule.findbugs.SA_LOCAL_SELF_=错误用法- 对一个变量进行无意义的自我计算(比如x & x)rule.findbugs.MS_MUTABLE_=恶意代码漏洞- 属性是可变的Hashtablerule.findbugs.RV_DONT_JUST_NULL_CHECK_=高危- 方法丢掉了readLine的结果,在检测它是非空之后。
soui log4z 用法SOUI Log4z 是一款开源的轻量级高性能的跨平台日志库,主要针对7*24小时服务器程序的日志输出与跟踪调试,支持64/32位的Windows、Linux、Mac、Android、iOS等操作系统。
以下是SOUI Log4z的基本用法:配置文件:SOUI Log4z 使用配置文件来定义日志输出的方式和级别等参数。
配置文件是一个文本文件,可以通过修改该文件来调整日志的行为。
配置文件中的各项参数如下:path:指定日志输出路径,默认为当前工作目录下的logs目录。
name:指定日志文件名,默认为log。
level:指定日志级别,默认为DEBUG。
display:指定是否在控制台输出日志,默认为true。
outfile:指定是否将日志输出到文件,默认为false。
日志级别:SOUI Log4z 支持多个日志级别,可以根据需要进行配置。
以下是支持的日志级别,按照从低到高的顺序排列:LOG_LEVEL_TRACELOG_LEVEL_DEBUGLOG_LEVEL_INFOLOG_LEVEL_WARNLOG_LEVEL_ERRORLOG_LEVEL_FATAL可以通过修改配置文件中的level参数来设置日志级别。
例如,将级别设置为INFO将只输出INFO及以上级别的日志。
使用方法:在代码中引入Log4z的头文件,并使用Log4z提供的宏来进行日志输出。
例如,使用LOG_INFO宏输出INFO级别的日志信息,使用LOG_ERROR宏输出ERROR级别的日志信息。
可以根据需要选择不同的宏来输出不同级别的日志信息。
以上是SOUI Log4z的基本用法,通过配置文件和日志级别的设置,可以方便地控制日志的行为和输出。
同时,SOUI Log4z还支持多线程安全、流式输入等高级功能,可以满足各种复杂的日志需求。
6455的EDMA3+MCBSP根据6455开发板自带的程序修改而来,调试通过,这个工程包括两个文件Edma_interrupt_example.c和edmaIntDispatcher.c,第一个是初始化的程序,第二个为中断服务子程序。
最后再附带一个FPGA的Verilog程序,用与产生mcbsp的接收数据。
如果想接收更多的数据,修改BUFFSIZE的大小就好了。
希望对你有帮助!下面是第一个文件内容/*根据dsk_app.c这个文件修改的mcbsp + edma,调试通过*/#include <stdio.h>#include <csl_edma3.h>#include <csl_intc.h>#include <soc.h>#include <edmaCommon.h>#include <csl_mcbsp.h>#include <cslr_dev.h>#define BUFFSIZE 10#define PING 0#define PONG 1Int16 gBufferXmtPing[BUFFSIZE]; // Transmit PING bufferInt16 gBufferXmtPong[BUFFSIZE]; // Transmit PONG bufferInt16 gBufferRcvPing[BUFFSIZE]; // Receive PING bufferInt16 gBufferRcvPong[BUFFSIZE]; // Receive PONG buffervolatile Uint32 intFlag = 0;Uint32 passStatus = 1;/* Forward declaration */void tcc1Fxn(void);void edmaInit(void);/* Macro that gives 2 CLK delay cycles */\do { #define WAIT_FOR_2_CLKvolatile int delayCnt = 2; \while(delayCnt > 0) --delayCnt; \}while (0)/* Global constants- Number of words to transfer *///#define NumOfWords 100/* Function declarations */void init_McBSP0(void);CSL_Status hwSetupVerify (CSL_McbspHwSetup *,CSL_McbspHwSetup *);/* Handle for the MCBSP instance */CSL_McbspHandle hMcbsp;/* Create data buffers for transfer *///Uint16 xmt[NumOfWords];//Uint16 rcv[NumOfWords];/* Global data definition */CSL_McbspGlobalSetup mcbspGbl = {CSL_MCBSP_IOMODE_TXDIS_RXDIS ,CSL_MCBSP_DLBMODE_OFF, //关闭自环模式CSL_MCBSP_CLKSTP_DISABLE};/* Receive data setup */CSL_McbspDataSetup mcbspRxData = {CSL_MCBSP_PHASE_SINGLE,CSL_MCBSP_WORDLEN_8,1, //frame length(CSL_McbspWordLen)0,0,//CSL_MCBSP_FRMSYNC_IGNORE, //frame sinc ignoreCSL_MCBSP_FRMSYNC_DETECT,CSL_MCBSP_COMPAND_OFF_MSB_FIRST,CSL_MCBSP_DATADELAY_1_BIT,CSL_MCBSP_RJUSTDXENA_RJUST_RZF ,CSL_MCBSP_INTMODE_ON_READY,// CSL_MCBSP_INTMODE_ON_FSYNC,CSL_MCBSP_32BIT_REVERS_DISABLE};/* Transmit data setup */CSL_McbspDataSetup mcbspTxData = {CSL_MCBSP_PHASE_SINGLE,CSL_MCBSP_WORDLEN_8,1, //每次发送一个元素(CSL_McbspWordLen)0,0,CSL_MCBSP_FRMSYNC_DETECT,CSL_MCBSP_COMPAND_OFF_MSB_FIRST,CSL_MCBSP_DATADELAY_1_BIT, //发送时,相对于同步信号延时一个clkCSL_MCBSP_RJUSTDXENA_DXENA_OFF,CSL_MCBSP_INTMODE_ON_READY,// CSL_MCBSP_INTMODE_ON_FSYNC,CSL_MCBSP_32BIT_REVERS_ENABLE};/* Clock setup defaults */CSL_McbspClkSetup mcbspClock = {CSL_MCBSP_FSCLKMODE_INTERNAL, /* XMT Frame-sync *///CSL_MCBSP_FSCLKMODE_INTERNAL, /* RCV Frame-sync */CSL_MCBSP_FSCLKMODE_EXTERNAL,CSL_MCBSP_TXRXCLKMODE_INTERNAL, /* XMT clock */// CSL_MCBSP_TXRXCLKMODE_INTERNAL, /* RCV clock */CSL_MCBSP_TXRXCLKMODE_EXTERNAL,CSL_MCBSP_FSPOL_ACTIVE_HIGH, /* XMT Frame-sync active high */CSL_MCBSP_FSPOL_ACTIVE_HIGH, /* RCV Frame-sync active high */CSL_MCBSP_CLKPOL_TX_RISING_EDGE, /* XMT clock rising edge *///CSL_MCBSP_CLKPOL_RX_FALLING_EDGE,/* RCV clock falling edge */CSL_MCBSP_CLKPOL_RX_RISING_EDGE,/* RCV clock falling edge */0, /* Frame-sync pulse width = 1 bit */0x8, /* Frame-sync pulse period 17clk*/0x5, /*clk divide by 6 */CSL_MCBSP_SRGCLK_CLKCPU,CSL_MCBSP_CLKPOL_TX_RISING_EDGE ,/* CLKS pin signal rising edge */CSL_MCBSP_TXFSMODE_DXRCOPY,// CSL_MCBSP_TXFSMODE_SRG,CSL_MCBSP_CLKGSYNCMODE_OFF /* GSYNC = 0 means no clock synchronisation */ };/* Multichannel setup */CSL_McbspMulChSetup mcbspMul = {CSL_MCBSP_PARTMODE_2PARTITION, /* RX */CSL_MCBSP_PARTMODE_2PARTITION, /* TX */(Uint16)0, /* rxMulChSel */(Uint16)0, /* txMulChSel */CSL_MCBSP_PABLK_0,/* rxPartABlk */CSL_MCBSP_PBBLK_1,/* rxPartBBlk */CSL_MCBSP_PABLK_0,/* txPartABlk */CSL_MCBSP_PBBLK_1 /* txPartABlk */};/* Mcbsp hwsetup */CSL_McbspHwSetup myHwSetup = {&mcbspGbl,&mcbspRxData,&mcbspTxData,&mcbspClock,&mcbspMul,CSL_MCBSP_EMU_FREERUN,NULL};/* Intc declaration */CSL_IntcContext intcContext;CSL_IntcEventHandlerRecord EventHandler[100];CSL_IntcObj intcObjEdma;CSL_IntcHandle hIntcEdma;CSL_IntcGlobalEnableState state;CSL_IntcEventHandlerRecord EventRecord;CSL_IntcParam vectId;CSL_Edma3HwDmaChannelSetup dmahwSetup[CSL_EDMA3_NUM_DMACH] =CSL_EDMA3_DMACHANNELSETUP_DEFAULT;CSL_Edma3HwSetup hwSetup = {&dmahwSetup[0],NULL};/* Globals *//* Edma handle */CSL_Edma3Handle hModule;/* PaRAM settings for sets 13 (receive) and 65 (receive ping reload) */CSL_Edma3ParamSetup gParamSetupRcvPing = { // PaRAM Set Structure for receive ping bufferCSL_EDMA3_OPT_MAKE // option -OPT (CSL_EDMA3_ITCCH_DIS, \CSL_EDMA3_TCCH_DIS, \\CSL_EDMA3_ITCINT_DIS,CSL_EDMA3_TCINT_EN, \15, CSL_EDMA3_TCC_NORMAL, \CSL_EDMA3_FIFOWIDTH_NONE, \CSL_EDMA3_STATIC_DIS, \CSL_EDMA3_SYNC_A, \CSL_EDMA3_ADDRMODE_INCR, \CSL_EDMA3_ADDRMODE_INCR),(Uint32)0x028c0000, // srcAddr -SRCCSL_EDMA3_CNT_MAKE(2,BUFFSIZE), // aCntbCnt -(ACNT, BCNT)(Uint32)&gBufferRcvPing, // dstAddr -DSTCSL_EDMA3_BIDX_MAKE(0,2), // srcDstBidx -(SRCBIDX, DSTBIDX) CSL_EDMA3_LINKBCNTRLD_MAKE(0x4800, 1), // linkBcntrld - (LINK, BCNTRLD)CSL_EDMA3_CIDX_MAKE(0,0), // srcDstCidx -(SRCCIDX, DSTCIDX)1 // cCnt -CCNT};/* PaRAM settings for set 64 (transmit pong reload) */CSL_Edma3ParamSetup gParamSetupRcvPong = { // PaRAM Set Structure for receive pong bufferCSL_EDMA3_OPT_MAKE // option -OPT (CSL_EDMA3_ITCCH_DIS, \CSL_EDMA3_TCCH_DIS, \CSL_EDMA3_ITCINT_DIS, \CSL_EDMA3_TCINT_EN, \15, CSL_EDMA3_TCC_NORMAL, \CSL_EDMA3_FIFOWIDTH_NONE, \CSL_EDMA3_STATIC_DIS, \CSL_EDMA3_SYNC_A, \CSL_EDMA3_ADDRMODE_INCR, \CSL_EDMA3_ADDRMODE_INCR),(Uint32)0x028c0000, // srcAddr -SRCCSL_EDMA3_CNT_MAKE(2,BUFFSIZE), // aCntbCnt -(ACNT, BCNT)(Uint32)&gBufferRcvPong, // dstAddr -DSTCSL_EDMA3_BIDX_MAKE(0,2), // srcDstBidx -(SRCBIDX, DSTBIDX) CSL_EDMA3_LINKBCNTRLD_MAKE(0x4820, 1), // linkBcntrld - (LINK, BCNTRLD)CSL_EDMA3_CIDX_MAKE(0,0), // srcDstCidx -(SRCCIDX, DSTCIDX)1 // cCnt -CCNT};void edmaInit(){edmaObj;CSL_Edma3ObjCSL_Edma3ParamHandle hParamBasic1;CSL_Edma3ChannelObj chObjXmt, chObjRcv;CSL_Edma3CmdIntr regionIntr;CSL_Edma3CmdDrae regionAccess;CSL_Edma3ChannelHandle hChannelXmt, hChannelRcv;CSL_Edma3Context context;CSL_Edma3ChannelAttr chAttrXmt, chAttrRcv;CSL_Status status;Uint32 i;/* Intc module initialization */intcContext.eventhandlerRecord = EventHandler;intcContext.numEvtEntries = 10;CSL_intcInit(&intcContext);/* Enable NMIs */CSL_intcGlobalNmiEnable();/* Enable global interrupts */CSL_intcGlobalEnable(&state);/* Opening a intc handle for edma event */vectId = CSL_INTC_VECTID_4;hIntcEdma = CSL_intcOpen (&intcObjEdma, CSL_INTC_EVENTID_EDMA3CC_INT1, \&vectId , NULL);/* Module initialization */status = CSL_edma3Init(&context);if (status != CSL_SOK) {printf (Edma module initialization failed\n);return;}/* Edma module open */hModule = CSL_edma3Open(&edmaObj,CSL_EDMA3,NULL,&status);/* Setup the DRAE masks* DRAE enable(Bits 0-15) for the shadow region 1.*/regionAccess.region = CSL_EDMA3_REGION_1 ;regionAccess.drae = 0xFFFFFFFF ;regionAccess.draeh = 0xFFFFFFFF ;CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_DMAREGION_ENABLE, ®ionAccess); /* DMA chanel --> PaRAM mapping, queue assignment */dmahwSetup[12].paramNum = 12;dmahwSetup[12].que = CSL_EDMA3_QUE_1;dmahwSetup[13].paramNum = 13;dmahwSetup[13].que = CSL_EDMA3_QUE_1;CSL_edma3HwSetup(hModule,&hwSetup);/* --- Setup Receive Chan vnel (McBSP1 receive, param 13) --- *//* Channel open */chAttrRcv.regionNum = CSL_EDMA3_REGION_1;chAttrRcv.chaNum = CSL_EDMA3_CHA_REVT0;hChannelRcv = CSL_edma3ChannelOpen(&chObjRcv, CSL_EDMA3, &chAttrRcv, &status);/* Set up parameter block 65 as EDMA transmit ping reload */hParamBasic1 = CSL_edma3GetParamHandle(hChannelRcv,65,NULL);status = CSL_edma3ParamSetup(hParamBasic1,&gParamSetupRcvPing);/* Set up parameter block 64 as EDMA transmit pong reload */hParamBasic1 = CSL_edma3GetParamHandle(hChannelRcv,64,NULL);CSL_edma3ParamSetup(hParamBasic1,&gParamSetupRcvPong);/* Set up parameter block 13 as EDMA transmit (start with copy of ping) */hParamBasic1 = CSL_edma3GetParamHandle(hChannelRcv,13,NULL);CSL_edma3ParamSetup(hParamBasic1,&gParamSetupRcvPing);/* Set up channel and queue relationships */CSL_edma3HwChannelSetupParam(hChannelRcv, 13);CSL_edma3HwChannelSetupQue(hChannelRcv, CSL_EDMA3_QUE_1);/* Association of an EDMA event handler with the INTC routine */EventRecord.handler = &eventEdmaHandler;EventRecord.arg = (void*)(hModule);CSL_intcPlugEventHandler(hIntcEdma,&EventRecord);/* Enabling event edma */CSL_intcHwControl(hIntcEdma,CSL_INTC_CMD_EVTENABLE,NULL);/* Hook up the EDMA event with an completion code function handler */EdmaEventHook(15, tcc1Fxn);// EdmaEventHook(1, tcc1Fxn);/* Enable EDMA region interrupts */regionIntr.region = CSL_EDMA3_REGION_1 ;regionIntr.intr = 0x0000C000;regionIntr.intrh = 0x00000000;CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTR_ENABLE,®ionIntr);/* Receive event clear and enable ,备注用于外部触发使用*/CSL_edma3HwChannelControl(hChannelRcv,CSL_EDMA3_CMD_CHANNEL_CLEAR,NULL);CSL_edma3HwChannelControl(hChannelRcv,CSL_EDMA3_CMD_CHANNEL_ENABLE,NULL);/* Clear CPU interrupt event 72 (EVTCLR2) *///*((Uint32*)0x1800048) = 0x00000100;/* Enable CPU interrupt event 72 (EVTMASK2) */// *((Uint32*)0x1800088) = 0x00000100;/* Manually trigger the receive channel 备注,如果手动触发的话,就不要使能通道,即CSL_edma3HwChannelControl(hChannelRcv,CSL_EDMA3_CMD_CHANNEL_ENABLE,NULL)这句话要注释掉;*//*for (i = 1; i <= BUFFSIZE; i++){status =CSL_edma3HwChannelControl(hChannelRcv,CSL_EDMA3_CMD_CHANNEL_SET,NULL);if (status != CSL_SOK) {printf (Edma channel set command failed\n);return;}} */while(1){//while (!intFlag);if (intFlag){intFlag = 0;printf (*******completion***********\n);}}}void main(){Bool mcbsp1En;/* Clear buffers */memset((void*)gBufferXmtPing,0,sizeof(gBufferXmtPing));memset((void*)gBufferXmtPong,0,sizeof(gBufferXmtPong));memset((void*)gBufferRcvPing,0,sizeof(gBufferRcvPing));memset((void*)gBufferRcvPong,0,sizeof(gBufferRcvPong));/* Unlock the PERCFG0 register */CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERLOCK, DEV_PERLOCK_LOCKVAL, UNLOCK);/* Enable the powersaver for the MCBSP 0 */CSL_FINST (((CSL_DevRegs*)CSL_DEV_REGS)->PERCFG0, DEV_PERCFG0_MCBSP0CTL, ENABLE);do {mcbsp1En = (Bool) CSL_FEXT(((CSL_DevRegs*)CSL_DEV_REGS)->PERSTAT0,DEV_PERSTAT0_MCBSP0STAT);} while (mcbsp1En != TRUE);printf(Powersaver for MCBSP 1 is enabled\n);init_McBSP0();/* Start the EDMA controller */edmaInit();}void tcc1Fxn(void){intFlag = 1;}void init_McBSP0(void){status = CSL_SOK;CSL_StatusCSL_McbspContext pContext;CSL_McbspObj mcbspObj;//Uint16 loopIndex;CSL_BitMask16 ctrlMask;//CSL_BitMask16 response;CSL_McbspHwSetup readHwSetup;//Uint16 maxTimeout = 1000;//Uint16 timeout = 0;//Uint16 errCount = 0;CSL_McbspGlobalSetup globalSetup;CSL_McbspDataSetup rxDataSetup;CSL_McbspDataSetup txDataSetup;CSL_McbspClkSetup clkSetup;/* Clear local data structures */memset (&readHwSetup, 0, sizeof(CSL_McbspHwSetup));memset (&mcbspObj, 0, sizeof(CSL_McbspObj));/* Allocated memory for variable */readHwSetup.global = &globalSetup;readHwSetup.rxdataset = &rxDataSetup;readHwSetup.txdataset = &txDataSetup;readHwSetup.clkset = &clkSetup;/* Data Arrays *//*for (loopIndex = 0; loopIndex < NumOfWords; loopIndex++) {xmt[loopIndex] = loopIndex;rcv[loopIndex] = 0;}*/printf(\***singleChannelTransmission***\n);/* Initialize the MCBSP CSL module */status = CSL_mcbspInit(&pContext);if (status != CSL_SOK) {printf(Mcbsp initialization failed\n);return;}/* Open the CSL module */hMcbsp = CSL_mcbspOpen (&mcbspObj, CSL_MCBSP_0, NULL, &status);if ((hMcbsp == NULL) || (status != CSL_SOK)) {printf (MCBSP: Opening instance... Failed.\n);printf (\Reason: Error opening the instance. \[status = 0x%x, hMcbsp = 0x%x]\n, status, hMcbsp);exit(1);}/* Disable MCBSP transmit and receive */ctrlMask = CSL_MCBSP_CTRL_RX_DISABLE| CSL_MCBSP_CTRL_TX_DISABLE| CSL_MCBSP_CTRL_FSYNC_DISABLE| CSL_MCBSP_CTRL_SRG_DISABLE;CSL_mcbspHwControl (hMcbsp, CSL_MCBSP_CMD_RESET_CONTROL, &ctrlMask);/* Setup hardware parameters */status= CSL_mcbspHwSetup (hMcbsp , &myHwSetup);if (status != CSL_SOK){printf (MCBSP: Hardware setup... Failed.\n);exit(1);}/* Get Hw setup Parameters */status = CSL_mcbspGetHwSetup (hMcbsp , &readHwSetup);if (status != CSL_SOK){printf (MCBSP: Get Hardware setup... Failed.\n);exit(1);}/* Compare the hardware setup parameter values passed in the* hwSetup structure by comparing them with the actual values read from* the Mcbsp registers*/status = hwSetupVerify (&myHwSetup, &readHwSetup);if (status != CSL_SOK){printf (MCBSP: Hardware setup and Read Hardware setup parameter );printf (comparision ... Failed.\n);exit(1);}/* Start sample rate generator and wait for 2 clock cycles */ctrlMask = CSL_MCBSP_CTRL_SRG_ENABLE | CSL_MCBSP_CTRL_FSYNC_ENABLE;CSL_mcbspHwControl(hMcbsp, CSL_MCBSP_CMD_RESET_CONTROL, &ctrlMask);WAIT_FOR_2_CLK;/* Enable MCBSP transmit and receive and wait for 2 clock cycles */// ctrlMask = CSL_MCBSP_CTRL_TX_ENABLE | CSL_MCBSP_CTRL_RX_ENABLE;ctrlMask = CSL_MCBSP_CTRL_RX_ENABLE;CSL_mcbspHwControl(hMcbsp, CSL_MCBSP_CMD_RESET_CONTROL, &ctrlMask);WAIT_FOR_2_CLK;}CSL_Status hwSetupVerify (CSL_McbspHwSetup *hwSetup,CSL_McbspHwSetup *hwSetupRead){CSL_Status status = CSL_SOK;/* Check the mcbsp global setup parameters */if (hwSetupRead->global != NULL) {if(!((hwSetup->global->dlbMode == hwSetupRead->global->dlbMode)&&(hwSetup->global->clkStopMode == \hwSetupRead->global->clkStopMode) &&(hwSetup->global->ioEnableMode == \hwSetupRead->global->ioEnableMode))) { status = CSL_ESYS_FAIL;}}/* Check the mcbsp receive data setup parameters */if (hwSetupRead->rxdataset != NULL) {hwSetupRead->rxdataset->numPhases) &&(hwSetup->rxdataset->wordLength1 == \hwSetupRead->rxdataset->wordLength1) &&(hwSetup->rxdataset->wordLength2 == \hwSetupRead->rxdataset->wordLength2) &&(hwSetup->rxdataset->frmLength1 == \hwSetupRead->rxdataset->frmLength1) &&(hwSetup->rxdataset->frmSyncIgn == \hwSetupRead->rxdataset->frmSyncIgn) &&(hwSetup->rxdataset->compand == \hwSetupRead->rxdataset->compand)&& (hwSetup->rxdataset->dataDelay == \hwSetupRead->rxdataset->dataDelay) &&(hwSetup->rxdataset->rjust_dxenable == \hwSetupRead->rxdataset->rjust_dxenable) &&(hwSetup->rxdataset->intEvent == \hwSetupRead->rxdataset->intEvent) &&(hwSetup->rxdataset->wordReverse == \hwSetupRead->rxdataset->wordReverse))) {status = CSL_ESYS_FAIL;}}/* Check the mcbsp transmit data setup parameters */if (hwSetupRead->txdataset != NULL) {if (!((hwSetup->txdataset->numPhases == \hwSetupRead->txdataset->numPhases) &&(hwSetup->txdataset->wordLength1 == \hwSetupRead->txdataset->wordLength1) &&(hwSetup->txdataset->wordLength2 == \hwSetupRead->txdataset->wordLength2) &&(hwSetup->txdataset->frmLength1 == \hwSetupRead->txdataset->frmLength1) &&(hwSetup->txdataset->frmSyncIgn == \hwSetupRead->txdataset->frmSyncIgn) &&(hwSetup->txdataset->compand == \hwSetupRead->txdataset->compand) &&(hwSetup->txdataset->dataDelay == \hwSetupRead->txdataset->dataDelay) &&(hwSetup->txdataset->rjust_dxenable == \hwSetupRead->txdataset->rjust_dxenable)hwSetupRead->txdataset->intEvent) &&(hwSetup->txdataset->wordReverse == \hwSetupRead->txdataset->wordReverse))) {status = CSL_ESYS_FAIL;}}/* Check the mcbsp clock setup parameters */if (hwSetupRead->clkset != NULL) {if (!((hwSetup->clkset->frmSyncRxMode == \hwSetupRead->clkset->frmSyncRxMode)&&(hwSetup->clkset->frmSyncTxMode == \hwSetupRead->clkset->frmSyncTxMode) &&(hwSetup->clkset->frmSyncRxPolarity == \hwSetupRead->clkset->frmSyncRxPolarity) &&(hwSetup->clkset->frmSyncTxPolarity == \hwSetupRead->clkset->frmSyncTxPolarity) &&(hwSetup->clkset->clkRxMode == \hwSetupRead->clkset->clkRxMode) &&(hwSetup->clkset->clkTxMode == \hwSetupRead->clkset->clkTxMode) &&(hwSetup->clkset->clkRxPolarity == \hwSetupRead->clkset->clkRxPolarity)&&(hwSetup->clkset->clkTxPolarity == \hwSetupRead->clkset->clkTxPolarity)&&(hwSetup->clkset->srgFrmPulseWidth == \hwSetupRead->clkset->srgFrmPulseWidth) &&(hwSetup->clkset->srgFrmPeriod == \hwSetupRead->clkset->srgFrmPeriod)&&(hwSetup->clkset->srgClkDivide == \hwSetupRead->clkset->srgClkDivide)&&(hwSetup->clkset->srgClkSync == \hwSetupRead->clkset->srgClkSync)&&(hwSetup->clkset->srgInputClkMode == \hwSetupRead->clkset->srgInputClkMode) &&(hwSetup->clkset->srgClkPolarity == \hwSetupRead->clkset->srgClkPolarity)&&(hwSetup->clkset->srgTxFrmSyncMode == \hwSetupRead->clkset->srgTxFrmSyncMode))) { status = CSL_ESYS_FAIL;}}/* Check the mcbsp emulation mode setup parameters */if(!((hwSetup->emumode == hwSetupRead->emumode ) &&(hwSetup->extendSetup == hwSetupRead->extendSetup))) {status = CSL_ESYS_FAIL;}return status;}第二个文件内容/*============================================================================* Copyright (c) Texas Instruments Inc 2002, 2003, 2004, 2005** Use of this software is controlled by the terms and conditions found in the* license agreement under which this software has been supplied.*===========================================================================*//** ============================================================================ ** @file edmaIntDispatcher.c** @path $(CSLPATH)\example\edma\edma_interrupt\src** @desc This is utility function used by edma as Interrupt dispather** ============================================================================ */#include <csl_edma3.h>#include <edmaCommon.h>/* Global Edma Tcc handler table */#pragma DATA_SECTION(TccHandlerTable,.testMem);EdmaTccHandler TccHandlerTable[64];/**============================================================================= * @func eventEdmaHandler** @arg* handle - Edma module handle** @desc* This is the interrupt handler routine for edma interrupt** @returnNONE***============================================================================= */void eventEdmaHandler (void *handle){CSL_Edma3Handle hModule = (CSL_Edma3Handle)handle;CSL_BitMask32 maskVal;CSL_Edma3CmdIntr regionIntr;Uint32 tcc;Uint32 intr;Uint32 intrh;// Uint32 * a;// Uint32 * b;//a = (Uint32 *)0x02A01008;// b = (Uint32 *)0x02A01068;/* Read the IPR */regionIntr.region = CSL_EDMA3_REGION_1;CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND, ®ionIntr);while (regionIntr.intr || regionIntr.intrh) {intr = regionIntr.intr;intrh = regionIntr.intrh;tcc = 0;while (intr) {maskVal = 1 << tcc;if (intr & maskVal) {InvokeHandle(tcc);intr &= ~maskVal;}tcc++;}tcc = 0;while (intrh) {maskVal = 1 << tcc;if (intrh & maskVal) {InvokeHandle((tcc+32));intrh &= ~maskVal;}tcc++;}//intFlag = 0;CSL_edma3HwControl(hModule,CSL_EDMA3_CMD_INTRPEND_CLEAR,®ionIntr);//*a = 0x00002000;// *b = 0x00000002;CSL_edma3GetHwStatus(hModule,CSL_EDMA3_QUERY_INTRPEND,®ionIntr);}}/**============================================================================= * @func EdmaEventHook** @arg* tcc - Tcc number* fxn - Pointer to function which points to edma isr** @desc* This is the interrupt handler routine for edma interrupt** @return* NONE**============================================================================= */void EdmaEventHook (EdmaTccHandler fxn){TccHandlerTable[tcc] = (fxn);}/**============================================================================= * @func Verify_Transfer*** @desc* This is utility function used by the edma example to verify theData transfer. *** @return* NONE**============================================================================= */Bool Verify_Transfer (Uint16 aCnt,Uint16 bCnt,Uint16 cCnt,Uint16 srcBIdx,Uint16 dstBIdx,Uint16 srcCIdx,Uint16 dstCIdx,Uint8 *srcBuff,Uint8 *dstBuff,Bool abSync)/*Bool Verify_Transfer (Uint16 aCnt,Uint16 bCnt,Uint16 cCnt,Uint16 srcBIdx,Uint16 dstBIdx,Uint16 srcCIdx,Uint16 dstCIdx,unsigned int *srcBuff,Bool abSync)*/{Uint32 loopIndex1;Uint32 loopIndex2;Uint32 loopIndex3;Uint8 *srcArrayPtr = srcBuff;//unsigned int *srcArrayPtr = srcBuff;Uint8 *dstArrayPtr = dstBuff;Uint8 *srcFramePtr = srcBuff;// unsigned int *srcFramePtr = srcBuff;Uint8 *dstFramePtr = dstBuff;for (loopIndex1 = 0; loopIndex1 < cCnt; loopIndex1++){for (loopIndex2 = 0; loopIndex2 < bCnt; loopIndex2++){for (loopIndex3 = 0; loopIndex3 < aCnt; loopIndex3++)if (srcArrayPtr[loopIndex3] != dstArrayPtr[loopIndex3])return FALSE;srcArrayPtr = srcArrayPtr + srcBIdx;dstArrayPtr = dstArrayPtr + dstBIdx;}if (abSync) {srcFramePtr = srcFramePtr + srcCIdx;srcArrayPtr = srcFramePtr;dstFramePtr = dstFramePtr + dstCIdx;dstArrayPtr = dstFramePtr;}else {srcFramePtr = srcArrayPtr + srcCIdx - srcBIdx;srcArrayPtr = srcFramePtr;dstFramePtr = dstArrayPtr + dstCIdx - dstBIdx;dstArrayPtr = dstFramePtr;}}return TRUE;}Verilog程序,en产生一个上升沿就会产生一次数据,reset高电平复位,程序初始化时要有个复位信号。