public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* Conditional define of HAL_DELAY_US in Cortex-M architecture HAL
@ 2010-12-15 13:09 Ilija Kocho
  2010-12-15 15:57 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: Ilija Kocho @ 2010-12-15 13:09 UTC (permalink / raw)
  To: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

Hello

This is a small patch that enables redefinition of HAL_DELAY_US at
variant or platform level.

An example use case is substitution of hal_delay_us() with "equivalent"
that provides sub microsecond polling (for devices that require low
latency response).

Best regards
Ilija


[-- Attachment #2: cortex-m_hal_delay_us_macro.patch --]
[-- Type: text/x-patch, Size: 1496 bytes --]

Index: hal/cortexm/arch/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/cortexm/arch/current/ChangeLog,v
retrieving revision 1.11
diff -u -5 -r1.11 ChangeLog
--- hal/cortexm/arch/current/ChangeLog	17 May 2010 11:38:29 -0000	1.11
+++ hal/cortexm/arch/current/ChangeLog	13 Dec 2010 12:25:48 -0000
@@ -1,5 +1,9 @@
+2010-12-12  Ilija Kocho <ilijak@siva.com.mk>
+
+	* include/hal_intr.h: Conditional define of HAL_DELAY_US().
+	
 2010-05-17  Spencer Oliver <spen@spen-soft.co.uk>
 
 	* include/hal_intr.h (HAL_INTERRUPT_STACK_CALL_PENDING_DSRS):
 	* src/hal_misc.c (hal_reset_vsr): Add 0 argument to SWI.
 
Index: hal/cortexm/arch/current/include/hal_intr.h
===================================================================
RCS file: /cvs/ecos/ecos/packages/hal/cortexm/arch/current/include/hal_intr.h,v
retrieving revision 1.5
diff -u -5 -r1.5 hal_intr.h
--- hal/cortexm/arch/current/include/hal_intr.h	17 May 2010 11:38:30 -0000	1.5
+++ hal/cortexm/arch/current/include/hal_intr.h	13 Dec 2010 12:25:48 -0000
@@ -357,12 +357,13 @@
 //==========================================================================
 // HAL_DELAY_US().
 //
 
 __externC void hal_delay_us( cyg_int32 us );
+#if !defined HAL_DELAY_US
 #define HAL_DELAY_US( __us ) hal_delay_us( __us )
-
+#endif
 //==========================================================================
 // Reset.
 //
 // This uses the SYSRESETREQ bit in the Cortex-M3 NVIC.
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Conditional define of HAL_DELAY_US in Cortex-M architecture HAL
  2010-12-15 13:09 Conditional define of HAL_DELAY_US in Cortex-M architecture HAL Ilija Kocho
@ 2010-12-15 15:57 ` Gary Thomas
  2010-12-16 11:28   ` Ilija Kocho
  0 siblings, 1 reply; 3+ messages in thread
From: Gary Thomas @ 2010-12-15 15:57 UTC (permalink / raw)
  To: ecos-patches

On 12/15/2010 06:09 AM, Ilija Kocho wrote:
> Hello
>
> This is a small patch that enables redefinition of HAL_DELAY_US at
> variant or platform level.
>
> An example use case is substitution of hal_delay_us() with "equivalent"
> that provides sub microsecond polling (for devices that require low
> latency response).

Just curious; what good does "sub microsecond polling" do when
this function defines the delay in microseconds??

Note: I don't have a problem with the concept as in most cases
the ability to provide architecture/family/target overrides is
considered useful.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Conditional define of HAL_DELAY_US in Cortex-M architecture HAL
  2010-12-15 15:57 ` Gary Thomas
@ 2010-12-16 11:28   ` Ilija Kocho
  0 siblings, 0 replies; 3+ messages in thread
From: Ilija Kocho @ 2010-12-16 11:28 UTC (permalink / raw)
  To: ecos-patches

On 15.12.2010 16:57, Gary Thomas wrote:
> On 12/15/2010 06:09 AM, Ilija Kocho wrote:
>> Hello
>>
>> This is a small patch that enables redefinition of HAL_DELAY_US at
>> variant or platform level.
>>
>> An example use case is substitution of hal_delay_us() with "equivalent"
>> that provides sub microsecond polling (for devices that require low
>> latency response).
>
> Just curious; what good does "sub microsecond polling" do when
> this function defines the delay in microseconds??

Such an example is USB serial device for RedBoot (that we are working on
and are going to contribute soon).
Response delay of 10ms, or even 1ms is too much for USB. True, it
doesn't have to be sub microsecond, but for shared medium such as USB
it's good to be ASAP. In reality, with typical system clock frequency of
Cortex-M controllers typical response shall be bellow 1us (worst case
may be above).

>
> Note: I don't have a problem with the concept as in most cases
> the ability to provide architecture/family/target overrides is
> considered useful.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-16 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-15 13:09 Conditional define of HAL_DELAY_US in Cortex-M architecture HAL Ilija Kocho
2010-12-15 15:57 ` Gary Thomas
2010-12-16 11:28   ` Ilija Kocho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).