⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hal-architecture-characterization.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
📖 第 1 页 / 共 2 页
字号:
></TABLE><P>It may be necessary under some circumstances for the HAL to executecode in the kernel idle thread's loop. An example might be to executea processor halt instruction. This macro provides a portable way ofdoing this. The argument is a copy of the idle thread's loop counter,and may be used to trigger actions at longer intervals than everyloop.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7852">Reorder barrier</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">HAL_REORDER_BARRIER()</PRE></TD></TR></TABLE><P>When optimizing the compiler can reorder code. In some parts ofmulti-threaded systems, where the order of actions is vital, this cansometimes cause problems. This macro may be inserted into places wherereordering should not happen and prevents code being migrated acrossit by the compiler optimizer. It should be placed between statementsthat must be executed in the order written in the code.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7856">Breakpoint support</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">HAL_BREAKPOINT( label )HAL_BREAKINSTHAL_BREAKINST_SIZE</PRE></TD></TR></TABLE><P>These macros provide support for breakpoints.</P><P><TTCLASS="FUNCTION">HAL_BREAKPOINT()</TT> executes a breakpointinstruction. The label is defined at the breakpoint instruction sothat exception code can detect which breakpoint was executed.</P><P><TTCLASS="LITERAL">HAL_BREAKINST</TT> contains the breakpoint instructioncode as an integer value. <TTCLASS="LITERAL">HAL_BREAKINST_SIZE</TT> isthe size of that breakpoint instruction in bytes. Together thesemay be used to place a breakpoint in any code.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7865">GDB support</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">HAL_THREAD_GET_SAVED_REGISTERS( sp, regs )HAL_GET_GDB_REGISTERS( regval, regs )HAL_SET_GDB_REGISTERS( regs, regval )</PRE></TD></TR></TABLE><P>These macros provide support for interfacing GDB to the HAL.</P><P><TTCLASS="FUNCTION">HAL_THREAD_GET_SAVED_REGISTERS()</TT> extracts apointer to a <SPANCLASS="STRUCTNAME">HAL_SavedRegisters</SPAN> structurefrom a stack pointer value. The stack pointer passed in should be thevalue saved by the thread context macros. The macro will assign apointer to the <SPANCLASS="STRUCTNAME">HAL_SavedRegisters</SPAN> structureto the variable passed as the second argument.</P><P><TTCLASS="FUNCTION">HAL_GET_GDB_REGISTERS()</TT> translates a registerstate as saved by the HAL and into a register dump in the formatexpected by GDB. It takes a pointer to a<SPANCLASS="STRUCTNAME">HAL_SavedRegisters</SPAN> structure in the<TTCLASS="PARAMETER"><I>regs</I></TT> argument and a pointer to the memory tocontain the GDB register dump in the <TTCLASS="PARAMETER"><I>regval</I></TT>argument.</P><P><TTCLASS="FUNCTION">HAL_SET_GDB_REGISTERS()</TT> translates a GDB formatregister dump into a the format expected by the HAL.  It takes apointer to the memory containing the GDB register dump in the<TTCLASS="PARAMETER"><I>regval</I></TT> argument and a pointer to a<SPANCLASS="STRUCTNAME">HAL_SavedRegisters</SPAN> structurein the <TTCLASS="PARAMETER"><I>regs</I></TT> argument.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7883">Setjmp and longjmp support</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">CYGARC_JMP_BUF_SIZEhal_jmp_buf[CYGARC_JMP_BUF_SIZE]hal_setjmp( hal_jmp_buf env )hal_longjmp( hal_jmp_buf env, int val )</PRE></TD></TR></TABLE><P>These functions provide support for the C<TTCLASS="FUNCTION">setjmp()</TT> and <TTCLASS="FUNCTION">longjmp()</TT>functions.  Refer to the C library for further information.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7889">Stack Sizes</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">CYGNUM_HAL_STACK_SIZE_MINIMUMCYGNUM_HAL_STACK_SIZE_TYPICAL</PRE></TD></TR></TABLE><P>The values of these macros define the minimum and typical sizes ofthread stacks.</P><P><TTCLASS="LITERAL">CYGNUM_HAL_STACK_SIZE_MINIMUM</TT> defines the minimumsize of a thread stack. This is enough for the thread to functioncorrectly within eCos and allows it to take interrupts and contextswitches. There should also be enough space for a simple thread entryfunction to execute and call basic kernel operations on objects likemutexes and semaphores. However there will not be enough room for muchmore than this. When creating stacks for their own threads,applications should determine the stack usage needed for applicationpurposes and then add<TTCLASS="LITERAL">CYGNUM_HAL_STACK_SIZE_MINIMUM</TT>.</P><P><TTCLASS="LITERAL">CYGNUM_HAL_STACK_SIZE_TYPICAL</TT> is a reasonable increment over<TTCLASS="LITERAL">CYGNUM_HAL_STACK_SIZE_MINIMUM</TT>, usually about 1kB. This should beadequate for most modest thread needs. Only threads that need todefine significant amounts of local data, or have very deep call treesshould need to use a larger stack size.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7899">Address Translation</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">CYGARC_CACHED_ADDRESS(addr)CYGARC_UNCACHED_ADDRESS(addr)CYGARC_PHYSICAL_ADDRESS(addr)</PRE></TD></TR></TABLE><P>These macros provide address translation between different views ofmemory. In many architectures a given memory location may be visibleat different addresses in both cached and uncached forms. It is alsopossible that the MMU or some other address translation unit in theCPU presents memory to the program at a different virtual address toits physical address on the bus.</P><P><TTCLASS="FUNCTION">CYGARC_CACHED_ADDRESS()</TT> translates the givenaddress to its location in cached memory. This is typically where theapplication will access the memory.</P><P><TTCLASS="FUNCTION">CYGARC_UNCACHED_ADDRESS()</TT> translates the givenaddress to its location in uncached memory. This is typically wheredevice drivers will access the memory to avoid cache problems. It mayadditionally be necessary for the cache to be flushed before thecontents of this location is fully valid.</P><P><TTCLASS="FUNCTION">CYGARC_PHYSICAL_ADDRESS()</TT> translates the givenaddress to its location in the physical address space. This istypically the address that needs to be passed to device hardware suchas a DMA engine, ethernet device or PCI bus bridge. The physicaladdress may not be directly accessible to the program, it may bere-mapped by address translation.</P></DIV><DIVCLASS="SECTION"><H2CLASS="SECTION"><ANAME="AEN7909">Global Pointer</H2><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">CYGARC_HAL_SAVE_GP()CYGARC_HAL_RESTORE_GP()</PRE></TD></TR></TABLE><P>These macros insert code to save and restore any global data pointerthat the ABI uses. These are necessary when switching context betweentwo eCos instances - for example between an eCos application andRedBoot.</P></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="hal-interfaces.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="hal-interrupt-handling.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">HAL Interfaces</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="hal-interfaces.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">Interrupt Handling</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -