In include\linux\Cupmask.h, there are the following definitions
typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
extern cpumask_t _unused_cpumask_arg_;
#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
{
set_bit(cpu, dstp->bits);
}
In include\linux\Types.h, there are the following definitions
#ifdef __KERNEL__
#define BITS_TO_LONGS(bits) \
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \
unsigned long name(this bits =32)
#define BITS_PER_BYTE 8
#endif
Problem with using single quotes in awk variables
We can conclude that: cpumask_t is equivalent to unsigned long bits
, so cpumask_t *dstp is a pointer to an unsigned long array.
Then why does this expression appear? set_bit(cpu, dstp->bits); ?????cpusets are represented by bit masks.
For an unsigned int type on a 32-bit machine, it has 32 bits. Then each bit corresponds to a CPU. For example, 0x1 represents the CPU at position 0. 0x3 represents the two CPUs at positions 0 and 1.
You can also look at the sixth post of this thread:
http://www.chinaunix.net/index.php?uid=20551201&url=http://linux.chinaunix.net/bbs/viewthread.php?tid=904906 Thanks to scutan (冬日夜雨) for his help (great guy),
I understand the meaning of the code better.
There is one thing I don't understand
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) //dest points to unsigned long bits
//I can't understand this expression dstp->bits
{
set_bit(cpuhttp://www.airmaxshoe.net, dstp->bits);
}-> It is generally used in data structures.
For example,
struct student
{
age;
heathy;
}
struct stdent *p;
If I want to access the age of *p, I can write p->age like this;
If you define an unsigned long aaa; unsigned long p; There is no such usage p->bit,,,,, I don't understand here. Original post by eezzrr at 2009-2-17 01:36 http://linux.chinaunix.net/bbs/images/common/back.gif
-> Generally used in data structures.
For example,
struct student
{
age;
heathy;
}
struct stdent *p;
If I want to access the age of *p, I can write p->age;
If you define an unsigned long aaa; unsigned long ...
is like this http://www.posercity.com, for example, unsigned long a, then a is the value of the first element of the array. And you can also use a, then a represents the first address of the array.
Previous article:ARM9 first contact experience
Next article:Implementation of Embedded CCD Image Data Acquisition System Based on USB
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- [Gizwits Gokit3 Review] + AirLink configuration (Arduino)
- Node voltage calculation
- Showing goods + artificial intelligence first board dog bone AI
- [TI mmWave Radar Evaluation]_5_AWR1843BOOST Corridor Ranging Corner Reflector Test
- Operational amplifiers in series can achieve high precision and high output power at the same time
- CC2640 BLE Bluetooth wireless module low power consumption
- pyESP32 board design draft and BOM list
- ARM working mode
- Shanghai Optoelectronics IC Company needs analog IC design engineers
- MakeCode now supports ESP32 and ESP32-S2