Set bits macro

11 views
Skip to first unread message

rd...@iinet.net.au

unread,
Feb 26, 2013, 10:57:01 PM2/26/13
to rt-thre...@googlegroups.com
Hi,
 
I frequently use the following macro and thought it might be useful to others and perhaps worthy of including in RT-Thread. I currently add this macro to the BSP's rtconfig.h but it might make more sense to add it to rtdef.h.
 
#define RT_SET_BITS(var, mask, bits)   ((var) = ((var) & ~(mask)) | ((bits) & (mask)))
 
So instead of:
 
   TCFG0 &= 0xffff00ff;
   TCFG0 |= 15 << 8;
becomes:
 
   RT_SET_BITS(TCFG0, 0xff00, 15 << 8);
 
Regards,
Rob
 

bernard

unread,
Feb 26, 2013, 11:10:41 PM2/26/13
to rt-thre...@googlegroups.com
It's only for set bits. So, 

#define RT_CLR_BIT(p,n) ((p) &= ~((1) << (n)))

or others. 

And it's better to add into rtdevice.h file. 

RT-Thread use github as source code repo. When you have good code, you can provide a pull request. After review the code, the patch can be merged to RT-Thread. 

RT-Thread on github.com:




Best Regards, 
Bernard Xiong

2013/2/27 <rd...@iinet.net.au>
 

--
--
You received this message because you are subscribed to the Google
Groups "rt-thread-users" group.
To post to this group, send email to rt-thre...@googlegroups.com
To unsubscribe from this group, send email to
rt-thread-use...@googlegroups.com
 
---
You received this message because you are subscribed to the Google Groups "rt-thread-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rt-thread-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

rd...@iinet.net.au

unread,
Feb 26, 2013, 11:38:43 PM2/26/13
to rt-thre...@googlegroups.com
No need for RT_CLR_BITS
 
RT_SET_BITS(var, 0xf0, 0);
 
sets the bits indicated by the mask (0xf0) to 0.
 
 

rd...@iinet.net.au

unread,
Feb 27, 2013, 12:22:02 AM2/27/13
to rt-thre...@googlegroups.com
Also, I am using version 1.0.X for which there is no rtdevice.h.
 
Rob
 

bernard

unread,
Feb 27, 2013, 12:25:48 AM2/27/13
to rt-thre...@googlegroups.com
Please try more on RT-Thread 1.1.0 and 1.2.0 on github.com.




Regards, 
Bernard


2013/2/27 <rd...@iinet.net.au>
Also, I am using version 1.0.X for which there is no rtdevice.h.
 
Rob
 

--

rd...@iinet.net.au

unread,
Mar 1, 2013, 3:24:18 AM3/1/13
to rt-thre...@googlegroups.com
I plan to migrate to the latest version eventually but unfortunately RT-Thread 1.1.0 was not ready when I had to start developing my firmware. And I don't time at the moment to start migrating to the newest version. Although I have it running on another development board, I have not yet had time to look at 1.1.0 in depth but I understand the device driver framework has changed and I have a number of device drivers that would need to be migrated. I also have a number of changes I have made outside of the BSP which I would also need to migrate which should be straight forward if that area of the code hasn't changed. For instance I have made changes to LWIP but those changes are limited to two files.
 
Another change, that others might be interested in, is the seperation of the shell interface from finsh. Basically shell.c is now a stand alone shell interface with history, while finsh just exposes the three functions needed to link it to the shell. By initialising a couple of callbacks the shell can be linked to any command processor.
 
While finsh is great for testing and debugging it does not exactly make a great user interface due to the C syntax and sometimes cryptic responses. I can now have a default command processor that implements a user interface and by typing "finsh" I can switch to using finsh as the command processor. Typing "exit" returns to the default user interface.
 
Can you give me an idea of what is required to migrate from 1.0.X ?
 
Also, this forum doesn't seem to get much traffic, is there another english forum that everybody is using?
 
Regards,
Rob
 

bernard

unread,
Mar 1, 2013, 3:54:00 AM3/1/13
to rt-thre...@googlegroups.com
RT-Thread 1.1.0 has been released last year. The newest development trunk is RT-Thread 1.2.0, which is stalled in github.  The old RT-Thread 1.0.x version has mostly stopped maintenance. However, the kernel of RT-Thread 1.1.0 is almost the same as the kernel of RT-Thread 1.0.x.

A new shell with application module feature will appear in RT-Thread 1.2.0.  I have finished most of code of this shell, but I need time to debug and merge with application module. 

Another, I'm considering the planning of RT-Thread 2.0.0. This version will be focus on more widely architecture, such as MIPS, Cortex-A CPU. Welcome suggestion. 




Regards, 
Bernard Xiong 

2013/3/1 <rd...@iinet.net.au>
Rob
 

--

rd...@iinet.net.au

unread,
Mar 1, 2013, 10:28:15 AM3/1/13
to rt-thre...@googlegroups.com
Yes it was released last year, 1.1.0 Beta was due to be released Oct. 10 according to the roadmap. However, I waited and it wasn't. I had to start my development. Version 1.1.0 RC was released a month later, Nov. 7. However, since the release was not announced on this forum it was closer to December before I released it had been released, almost two months after I started developing with 1.0.2. I've been too busy to investigate and see how much is involved in migrating to 1.1.0.
 
Perhaps future releases could be announced here?
 
Can you give me an idea of what is involved in migrating from 1.0.X ?
Also, this forum doesn't seem to get much traffic, is there another english forum that everybody is using?
 
Do you have an updated roadmap, wish list, for 2.0.0? Also, I would be interested in one of your boards, can you let me know shipping costs and how to pay you?
 
Regards,
Rob
 

rd...@iinet.net.au

unread,
Mar 1, 2013, 10:59:06 AM3/1/13
to rt-thre...@googlegroups.com
For the shipping costs perhaps I should mention that I am in Perth Australia.
 

bernard

unread,
Mar 1, 2013, 11:06:30 AM3/1/13
to rt-thre...@googlegroups.com
Yes, it's not announced on this forum. I will announce releases on this forum future. 

em, @Grissiom just released RT-Thread GUI 0.6.1 today. All of them can be visited from github. Actually, there is a strict release planning in RT-Thread: it will release a version every quarter, 1 development version, 1 stable version. The current development series is RT-Thread 1.2.0-dev, and stable series is RT-Thread 1.1.x. In order to make the evolution of the RT-Thread GUI, we have released RT-Thread GUI monthly since this year. 

The most problem of RT-Thread is, it's a RTOS come from China, therefore, there are lots users in China, that means lots of documents are in Chinese. And less English document, less traffic on this forum and other English forum. The goal of 1.2.0 series is to improve the document of RT-Thread. I will provide a road map of RT-Thread in English later. 

The road map of RT-Thread 2.0.0 has only a idea, therefore, we welcome any wish list for 2.0.0.

For the migrating from 1.0.x to 1.1.x, please provide which platform do you use, which components do you use in RT-Thread etc. About the kernel part, it's fully compatible with old kernel. 




Best Regards, 
Bernard

2013/3/1 <rd...@iinet.net.au>

--
Reply all
Reply to author
Forward
0 new messages