On Thu, May 12, 2011 at 7:49 PM,  <[email protected]> wrote:
> Hi,
> I have some TinyOS related questions!
>
> Whats the difference between:
> a.) signal event(...);
> b.) atomic signal event(...);

This means the code section within the atomic curly braces (or the
line in this case) will execute without preemption.

> What kind of code is more efficiency and what does the async event here mean?

Async events are those triggered by interruptions.

> a.)
> async event void Int0.fired()
> {
>   ....
>   signal PHY.data_arrived();
> }
>
> event void PHY.data_arrived() {
>   uint16_t rcv_crc = 0;
>   uint16_t calc_crc = 0;
>
>   call PHY.extract(...); /// do memcpy, takes about 1-2ms
>
>   // calc checksum
>   rcv_crc = ....
>   calc_crc = call Crc.crc16(....);
>
>   // if checksum is correct we signal
>   if(rcv_crc == calc_crc)
>   {
>     atomic signal Radio.receive(...);
>   }
>   else
>   {
>     printf("crc wrong\n");
>     printfflush();
>   }
> }
>
> b.)
> async event void Int0.fired()
> {
>   ....
>   signal PHY.data_arrived();
> }
>
> event void PHY.data_arrived() {
>   post task_data_arrived();
> }
>
> task void task_data_arrived() {
>   uint16_t rcv_crc = 0;
>   uint16_t calc_crc = 0;
>
>   call PHY.extract(...); /// do memcpy
>
>   // calc checksum
>   rcv_crc = ....
>   calc_crc = call Crc.crc16(....);
>
>   // if checksum is correct we signal
>   if(rcv_crc == calc_crc)
>   {
>     atomic signal Radio.receive(...);
>   }
>   else
>   {
>     printf("crc wrong\n");
>     printfflush();
>   }
> }
> --
> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
--
Antonio Liñan Colina
R+D+I Engineer
@: [email protected]
@: [email protected]
------------------------------
Advancare
T: +34 93 582 02 70
http://www.advancare.com
http://www.zolertia.com

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to