13 July 2025

grub2

Show grub2 menu on bootup:
# grub2-editenv list
saved_entry=0
menu_auto_hide=1
boot_success=1
boot_indeterminate=0

# grub2-editenv - set menu_auto_hide=1
# grub2-editenv - unset menu_auto_hide

# grub2-editenv list
saved_entry=0
boot_success=1
boot_indeterminate=0

# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-6.15.6"
args="ro rootflags=subvol=root rhgb quiet $tuned_params"
root="UUID=f6b181fb-377d-4321-a31f-3e90f29a6abb"
initrd="/boot/initramfs-6.15.6.img $tuned_initrd"
title="Fedora Linux (6.15.6) 42 (Workstation Edition)"
id="226a800694a546aa9be2a9ad7d9a9ba9-6.15.6"
index=1
kernel="/boot/vmlinuz-6.14.0-63.fc42.x86_64"
args="ro rootflags=subvol=root rhgb quiet $tuned_params"
root="UUID=f6b181fb-377d-4321-a31f-3e90f29a6abb"
initrd="/boot/initramfs-6.14.0-63.fc42.x86_64.img $tuned_initrd"
title="Fedora Linux (6.14.0-63.fc42.x86_64) 42 (Workstation Edition)"
id="226a800694a546aa9be2a9ad7d9a9ba9-6.14.0-63.fc42.x86_64"
index=2
kernel="/boot/vmlinuz-0-rescue-226a800694a546aa9be2a9ad7d9a9ba9"
args="ro rootflags=subvol=root rhgb quiet"
root="UUID=f6b181fb-377d-4321-a31f-3e90f29a6abb"
initrd="/boot/initramfs-0-rescue-226a800694a546aa9be2a9ad7d9a9ba9.img"
title="Fedora Linux (0-rescue-226a800694a546aa9be2a9ad7d9a9ba9) 42 (Workstation Edition)"
id="226a800694a546aa9be2a9ad7d9a9ba9-0-rescue"

# grubby --remove-kernel=/boot/vmlinuz-6.15.6 

# grubby --info=ALL
index=0
kernel="/boot/vmlinuz-6.14.0-63.fc42.x86_64"
args="ro rootflags=subvol=root rhgb quiet $tuned_params"
root="UUID=f6b181fb-377d-4321-a31f-3e90f29a6abb"
initrd="/boot/initramfs-6.14.0-63.fc42.x86_64.img $tuned_initrd"
title="Fedora Linux (6.14.0-63.fc42.x86_64) 42 (Workstation Edition)"
id="226a800694a546aa9be2a9ad7d9a9ba9-6.14.0-63.fc42.x86_64"
index=1
kernel="/boot/vmlinuz-0-rescue-226a800694a546aa9be2a9ad7d9a9ba9"
args="ro rootflags=subvol=root rhgb quiet"
root="UUID=f6b181fb-377d-4321-a31f-3e90f29a6abb"
initrd="/boot/initramfs-0-rescue-226a800694a546aa9be2a9ad7d9a9ba9.img"
title="Fedora Linux (0-rescue-226a800694a546aa9be2a9ad7d9a9ba9) 42 (Workstation Edition)"
id="226a800694a546aa9be2a9ad7d9a9ba9-0-rescue"

# grub2-editenv list
saved_entry=1
boot_success=1
boot_indeterminate=0

# grub2-set-default 0

# grub2-editenv list
saved_entry=0
boot_success=1
boot_indeterminate=0


# cat /etc/default/grub
GRUB_TIMEOUT=30
...
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_ENABLE_BLSCFG=true
GRUB_GFXMODE="1920x1080x32,auto"
GRUB_BACKGROUND=/boot/grub2/torres_del.png
GRUB_FONT=/boot/grub2/fonts/DejaVuSansMono24.pf2

# magick torres_del.png /boot/grub2/torres_del.png

# dnf install texlive-dejavu
# grub2-mkfont --output=/boot/grub2/fonts/DejaVuSansMono24.pf2 --size=24 \
   /usr/share/texlive/texmf-dist/fonts/truetype/public/dejavu/DejaVuSansMono.ttf

update "/etc/grub.d/06_local_colors" as per how-do-i-change-the-font-colours-for-grub
echo "${1}set color_normal=red/black"
echo "${1}set color_highlight=cyan/light-gray"
echo "${1}set menu_color_normal=blue/black"
echo "${1}set menu_color_highlight=green/light-gray"

# grub2-mkconfig -o /boot/grub2/grub.cfg

12 July 2025

b43

# lspci
...
02:00.0 Network controller: Broadcom Inc. and subsidiaries BCM43228 802.11a/b/g/n
# lspci -nn -d 14e4:
02:00.0 Network controller [0280]: Broadcom Inc. and subsidiaries BCM43228 ...
        802.11a/b/g/n [14e4:4359]
https://wireless.docs.kernel.org/en/latest/en/users/drivers/b43.html
http://linuxwireless.sipsolutions.net/en/users/Drivers/b43/

b43 and b43legacy are drivers for the 802.11b/g/n family of wireless chips that Broadcom produces.
  • b43legacy: supports BCM4306 Rev 2 and cards that have only 802.11b capability
  • b43: supports all other models
The b43 drivers require proprietary firmware to be loaded onto the wireless chip before it can operate.
BCM43228 is present in supported list :)
PCI-ID Supported? Chip ID Modes PHY version Alternative
14e4:4359 yes (3.17+) BCM43228 a/b/g/n N (r16) wl

The Broadcom wireless chip needs proprietary software (called "firmware") that runs on the wireless chip itself to work properly. This firmware is copyrighted by Broadcom and must be extracted from Broadcom's proprietary drivers. To get such firmware on your system, you must download the driver from a legal distribution point, extract it, and install it.

b43-fwcutter tool will help extract firmware from the Broadcom driver.


https://github.com/minios-linux/b43-firmware/releases
# wget https://github.com/minios-linux/b43-firmware/releases/download/b43-firmware/broadcom-wl-6.30.163.46.tar.bz2
Or
# wget https://excellmedia.dl.sourceforge.net/project/sulinos/archives/broadcom-wl-6.30.163.46.tar.bz2

# tar xjvf broadcom-wl-6.30.163.46.tar.bz2 
broadcom-wl-6.30.163.46.wl_apsta.o

# b43-fwcutter -w /lib/firmware/ broadcom-wl-6.30.163.46.wl_apsta.o
This file is recognised as:
  filename   :  wl_apsta.o
  version    :  784.2
  MD5        :  29c8a47094fbae342902d84881a465ff
...
Extracting b43/ucode30_mimo.fw

# modprobe b43

# dmesg -c
[ 5898.781754] b43-phy4: Broadcom 43228 WLAN found (core revision 30)
[ 5898.782217] b43-phy4: Found PHY: Analog 9, Type 4 (N), Revision 16
[ 5898.782229] b43-phy4: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1
[ 5898.782573] Broadcom 43xx driver loaded [ Features: PNLS ]
[ 5898.783514] ieee80211 phy4: Selected rate control algorithm 'minstrel_ht'
[ 5898.805277] b43 bcma0:1 wlp2s0b1: renamed from wlan0
[ 5898.970504] b43-phy4: Loading firmware version 784.2 (2012-08-15 21:35:19)
[ 5899.213485] b43-phy4: Loading firmware version 784.2 (2012-08-15 21:35:19)
[ 5901.114541] b43-phy4: Loading firmware version 784.2 (2012-08-15 21:35:19)
[ 5901.226879] wlp2s0b1: authenticate with 2c:30:33:5e:dd:b1 (local address=1e:15:b9:d2:65:b2)
[ 5901.226892] wlp2s0b1: send auth to 2c:30:33:5e:dd:b1 (try 1/3)
[ 5901.230903] wlp2s0b1: authenticated
[ 5901.231483] wlp2s0b1: associate with 2c:30:33:5e:dd:b1 (try 1/3)
[ 5901.250226] wlp2s0b1: RX AssocResp from 2c:30:33:5e:dd:b1 (capab=0x1411 status=0 aid=10)
[ 5901.250397] wlp2s0b1: associated

# ifconfig wlp2s0b1
wlp2s0b1: flags=4163 UP,BROADCAST,RUNNING,MULTICAST  mtu 1500
        inet 192.168.1.19  netmask 255.255.255.0  broadcast 192.168.1.255 

28 October 2017

ARM 2



Reference:
http://bear.ces.cwru.edu/eecs_382/ARM7-TDMI-manual-pt2.pdf
http://infocenter.arm.com/help/topic/com.arm.doc.dai0179b/CHDFDFIG.html
https://blog.feabhas.com/2013/02/setting-up-the-cortex-m34-armv7-m-memory-protection-unit-mpu/
http://allontutorials.com/memory-protection-unitsmpu-a-look-at-arm-mpus/
http://www.atmel.com/Images/Atmel-42128-AT02346-Using-the-MPU-on-Atmel-Cortex-M3-M4-based-Microcontroller_Application-Note.pdf

http://infocenter.arm.com/help/topic/com.arm.doc.ddi0363g/DDI0363G_cortex_r4_r1p4_trm.pdf
http://www.peter-cockerell.net/aalp/html/frames.html
http://bear.ces.cwru.edu/eecs_382/ARM7-TDMI-manual-pt2.pdf
http://www.iti.uni-stuttgart.de/~radetzki/Seminar06/08_report.pdf

ARM

ARM is the world’s leading semiconductor intellectual property (IP) supplier.

ARM licenses technology designs to semiconductor companies.
The partner companies pay an up-front license fee (several million dollars) to gain access to a design.
And also a royalty on every chip that uses the licensed design.
The major characteristics of RISC architecture are,
-> Relatively few instructions
-> Memory access limited to load and store instructions
-> Relatively few addressing modes
-> All operations are done within the registers of the CPU
-> Single cycle instruction execution
iPhone 5 - Apple A6
- a Dual-core ARM Custom Cortex-A7 CPU and a Tri-core PowerVR SGX543MP3 GPU

iPad 3 - Apple A5X
- a Dual-core ARM Cortex-A9 CPU and a Quad-core PowerVR SGX543MP4 GPU

NVIDIA’s Tegra 3
- a Quad-core ARM Cortex-A9 CPU and a 12-core GeForce GPU

Galaxy S III - Samsung Exynos 4412 Quad
- a Quad-core ARM Cortex-A9 CPU and a Quad-core ARM Mali-400 MP4 OC GPU

Galaxy 2 - Samsung Exynos 4210
- a Dual-core ARM Cortex-A9 CPU and a Quad-core ARM Mali-400 MP4 GPU

Motorola DEFY+ - TI OMAP 3620
- a single-core ARM Cortex-A8 CPU and a PowerVR SGX530 GPU

LG Optimus Net - Qualcomm Snapdragon S1 (MSM7227)
- a single-core ARM Cortex-A5 CPU and a Adreno 200 GPU

GE LOGIQ - TI DM6446 (DaVinci)
- a single-code ARM9 CPU and TMS320 C64x+ DSP core

Reference:
http://www.anandtech.com/show/6292/iphone-5-a6-not-a15-custom-core
http://ir.arm.com/phoenix.zhtml?c=197211&p=irol-homeprofile
http://en.wikipedia.org/wiki/Apple_Ax#List_of_Apple_SoCs
http://www.arm.com/products/processors/cortex-a/index.php
http://www.droid-life.com/2011/11/08/nvidia-makes-tegra-3-quad-core-processor-official-here-is-everything-you-ever-wanted-to-know-about-it/

14 January 2017

get score

To start fresh game : http://zzzscore.com/1to50/en/#


To cheat :
Enter score you want:


example:
For score 37.155, url is http://zzzscore.com/1to50/en/result/#!v=U2FsdGVkX1/ap+BKR8BoXpn1Tz34TQ==

echo -n 37.155 | openssl enc -rc4 -a -e -salt -pass pass:"key" ==> U2FsdGVkX1/ap+BKR8BoXpn1Tz34TQ==

echo "U2FsdGVkX1/ap+BKR8BoXpn1Tz34TQ==" | openssl enc -rc4 -d -salt -pass pass:"key" ==> 37.155

Reference:
http://www.shellhacks.com/en/Encrypt-And-Decrypt-Files-With-A-Password-Using-OpenSSL


26 March 2016

Hotspot

Hot Spot 2.0 (HS 2.0), also called Wi-Fi Certified Passpoint, is a new standard (IEEE 802.11u) for public-access Wi-Fi that enables seamless roaming among WiFi networks and between WiFi and cellular networks.

How does it all work?
1. The client sends an ANQP query to the AP.
2. In ANQP response, client gets list of Online Signup (OSU) providers that are reachable from this hotspot.
3. The list typically is displayed at client as an icon and operator friendly name.
5. Once the user selects an OSU provider from the list, client connects to the OSU WLAN (Open or OSEN).
6. Client then makes an HTTPS connection to the OSU server URI to finish registration/purchase.
7. On success full registration, security credentials are pushed to client.
8. Now client disassociates from the OSU WLAN.
9. And connects to the HS2.0 WLAN using the standard ANQP mechanism.

GAS => Generic Advertisement Service
ANQP => Access Network Query Protocol
Client uses GAS query (with ANQP IEs) to get ANQP Capability list from AP. This will enable client to identify AP’s network and service provider.


Software Hotspots
Wi-Fi adapters in computers could operate as hotspots.
1. Windows 7 have built in support for hotspot.
2. Third-party software vendors, offer applications to allow users to operate their own Hotspot.

How to Enable a Virtual WiFi in Windows
make sure "Microsoft Virtual WiFi Miniport Adaptor" is created.

http://www.wikihow.com/Enable-a-Virtual-WiFi-in-Windows

# netsh wlan set hostednetwork mode=allow ssid="Homewifi" key="passphrase" keyUsage=persistent

# netsh wlan start hostednetwork

Reference:
http://en.wikipedia.org/wiki/Hotspot_%28Wi-Fi%29
http://whatis.techtarget.com/definition/Hot-Spot-20-HS-20
http://www.theruckusroom.net/2014/10/hotspots-get-hotter-with-release-2-of-hotspot-20.html
http://www.arubanetworks.com/techdocs/ArubaOS_64_Web_Help/Content/ArubaFrameStyles/hotspot/predepoyment_overview.htm

14 February 2016

Cyanogen on Nexus 7 (2012)

CyanogenMod is an aftermarket firmware for a number of cell phones based on the open-source Android operating system. It offers features not found in the official Android based firmwares of vendors.

Cyanogen commercially develops operating systems pre-installed on some devices (OnePlus One, YU Yureka, YU Yuphoria, Andromax Q, Lenovo ZUK Z1, Wileyfox Swift, Wileyfox Storm) based upon the CyanogenMod source code.
Initially distinguished with the suffix -S (CyanogenMod 11S), with version 12 Cyanogen rebranded the custom offering as Cyanogen OS.

Unlock the bootloader
# adb reboot bootloader
# fastboot oem unlock

Download latest CM recovery image from cm-grouper.
Installing recovery using fastboot

# adb reboot bootloader
# fastboot erase recovery
# fastboot flash recovery cm-12.1-20150901-SNAPSHOT-YOG4PAO237-grouper-recovery.img
# fastboot reboot-bootloader

Installing CyanogenMod from recovery

http://download.cyanogenmod.org/?type=snapshot&device=grouper
- Enter "Recovery mode""
-- Wipe data/factory reset
-- Wipe cache partition
-- Apply update
--- Choose from internal storage
---- 0
---- "cm-12.1-20150901-SNAPSHOT-YOG4PAO237-grouper.zip"
# fastboot reboot

Open Gapps is the best place for downloading Google apps suit for custom ROMs. Open Gapps packs common Google apps suit including Google Play Store app.
Download latest Open Gapps package from ogapps-nano
Installing Open Gapps 
# adb push open_gapps-arm-5.1-micro-20151002.zip /data/media/0/
# adb push open_gapps-arm-5.1-micro-20151002.zip /sdcard/
Enter "Recovery mode"
- Apply update
-- Choose from internal storage
--- 0
--- "open_gapps-arm-5.1-micro-20151002.zip"
# fastboot reboot

Lock the bootloader
# adb reboot bootloader
# fastboot oem lock

2. Installing from factory image
Download latest Google Nexus image from Nexus 7(2012).
Flashing Nexus image from Google

# adb reboot bootloader
# fastboot oem unlock
# flash-all
# fastboot oem lock

3. Installing from AOSP image
1. Recovery image TWRP 3.0.0.0 from here.
2. Marshmallow 6.0.1_r13 OTA-Package from here
3. Gapps for 6.0 from here.

Flashing Marshmallow image

# adb reboot bootloader
# fastboot oem unlock
#
#
# fastboot flash recovery twrp-3.0.0-0-grouper.img
# fastboot reboot
#
# press holding 'Volume (up)', 'Volume (down)' and 'Power' buttons.
# Enter recovery mode
# or
# adb reboot bootloader
#
(RECOVERY)# adb push aosp_grouper-ota-eng-20160203.ds.zip /sdcard/
(RECOVERY)# adb push benzo-gapps-M-20151011-signed-chroma-r3.zip /sdcard/
#
(RECOVERY)# From Install menu select AOSP OTA image and flash
(RECOVERY)# Reboot System
#
(RECOVERY)# From Install menu select GAPPS image and flash
(RECOVERY)# Reboot System
#
# fastboot oem lock

Reference:
https://en.wikipedia.org/wiki/CyanogenMod
https://wiki.cyanogenmod.org/w/Install_CM_for_grouper
http://download.cyanogenmod.org/?type=snapshot&device=grouper
http://techtrickz.com/download/open-gapps-project-best-place-for-downloading-latest-and-correct-google-apps/
https://developers.google.com/android/nexus/images
http://forum.xda-developers.com/nexus-7/development
http://forum.xda-developers.com/nexus-7/development/android-6-aosp-grouper-t3268172






28 December 2015

Transmit Beamforming - TxBF

“MIMO” refers to a technique for sending and receiving more than one data signal on the same radio channel at the same time via multipath propagation.

802.11n/ac systems take advantage of multipath by sending multiple radio signals at the same time. Each of these signals, called a spatial stream, is sent from its own antenna using its own transmitter. Because there is some space between these antennas, each signal follows a slightly different and unique path to the receiver, a situation called spatial diversity. The receiver has multiple antennas as well, each with its own radio that independently decodes the arriving signals, and each signal is combined with the signals from the other receive radios. The result is that multiple data streams are received at the same time.

MIMO can be sub-divided into three main categories :-
precoding:
precoding is multi-stream beamforming. With this, same signal is emitted from each of the transmit antennas with appropriate phase and gain weighting such that the signal power is maximized at the receiver input.
- Precoding requires knowledge of channel state information (CSI) at the transmitter and the receiver.

spatial multiplexing:
Signal is split into multiple lower-rate streams and each stream is transmitted from a different transmit antenna in the same frequency channel. If these signals arrive at the receiver antenna array with sufficiently different spatial signatures, it can separate these streams into almost parallel channels. Spatial multiplexing can also be used for simultaneous transmission to multiple receivers, known as space-division multiple access or multi-user MIMO.
- Spatial multiplexing can be used without CSI at the transmitter, but can be combined with precoding if CSI is available.

diversity coding:
The signal is emitted from each of the transmit antennas with full or near orthogonal coding.
- Diversity coding can be combined with spatial multiplexing when some channel knowledge is available at the transmitter. Because there is no channel knowledge, there is no beamforming.

- Orthogonal Frequency Division Multiplexing (OFDM) is a modulation scheme that uses multiple subcarriers within the same single channel. Rather than transmit a high-rate stream of data with a single subcarrier, OFDM makes use of a large number of closely spaced orthogonal subcarriers (meaning that crosstalk between the subchannels is eliminated) that are transmitted in parallel.
- The advantages of using OFDM include reduced multipath effects in reception and increased spectral efficiency.
- OFDMA achieves multiple access by assigning subsets of subcarriers to individual users.

- multiple transmit antennas can be used for beamforming
- multiple receive antennas can be used for diversity

TxBF requires multiple copies of the same signal arriving in phase at the receiver.
- Implicit Feedback: AP detect from its multiple antennas the different phases of arrival of a signal from the client on each of the AP’s antennas. This is roughly analogous to the way human ears process sounds that arrive at each ear at different times and therefore give an indication of the direction from which the sound came.
- Explicit Feedback:

- it should be obvious that a system can do spatial multiplexing or phase-based beamforming, but not both at the same time.



Reference:
http://www.digitalairwireless.com/wireless-blog/t-80211n/transmit-beamforming-txbf-explained.html
http://theruckusroom.typepad.com/files/adaptive-antennas-txbf-wp-0521-1.pdf
http://rfmw.em.keysight.com/wireless/helpfiles/89600b/webhelp/subsystems/wlan-ofdm/Content/ofdm_basicprinciplesoverview.htm

20 December 2015

fast BSS transition (FT)





Reference:
https://en.wikipedia.org/wiki/IEEE_802.11r-2008

OKC


A PMK identifier is defined as
PMKID = HMAC-SHA1-128(PMK, "PMK Name" || AA || SPA)

PMK - PMK is derived at the end of successful 802.1X authentication or after PSK authentication
AA - Authenticator Address / BSSID of AP
SPA - Supplicant Address

-> AP1 forwards PMK1 and AA to AP2.

-> STA sends Reassociation request frame to AP2 with pmkid2 in the RSNIE.
-> AP2 calculates pnkid2 using pmkid1 + AA + SPA.
-> If pmkid2 is acceptable to AP2, it will send M1 frame and starts 4 way handshake.



Reference:
https://www.cwnp.com/uploads/802-11_rsn_ft.pdf

22 October 2015

Wireless Broadband in India

HSD - High Speed Data
EVDO - Evolution data optimized

In mobile broadband market we presently have only two technologies available – EVDO from CDMA operators (Tata Photon+, Reliance Netconnect Broadband+, MTS MBlaze, BSNL EVDO and Virgin vFlash) and 3G from GSM operators (BSNL and MTNL covering the nation).

Reliance Netconnect - CDMA 1x, speed up to 144kbps.
- Huawei EC 121
- ZTE MG 880
- LG LXU 800
Reliance Netconnect+ - CDMA EVDO
Relaince 3 (ZTE AC2739) - speed up to 3.1 Mbps data rate
Relaince Pro 3 (ZTE AC2791) - speed up to 14.7 Mbps data rate
- Huawei EC 168c/1260/1262/150/159
- ZTE AC 2726/273x/2791/8710

Reference:
http://telecomtalk.info/wireless-broadband-3g-or-evdo-what-is-the-choice/34759/
http://www.rcom.co.in/Rcom/personal/internet/wireless_internet.html

14 August 2015

Mutex and Semaphore

Thread is a light weight process which shares the memory.
- Multiple threads allows the programmer to run particular job independent of all the others. ex:- spell check in wordpad.
- Multiple threads can run on multiple CPUs, providing a performance improvement.

Multithreaded applications requires synchronization.
- mutex - Only the thread that locks a mutex can unlock it.
- semaphore - Binary semaphore is equal to mutex, which can be unlocked by other threads. ex:- with semaphore, a thread to wait for other threads.

The pieces of code protected by mutex and semaphore is called Critical Section.

Implementing Semaphores on ARM Processors
- Semaphores are used to manage access to a shared resource. Unfortunately, semaphore themselves are shared resources. Who will protect semaphore? ha ha ha...
- In single core system, easy way to avoid the issue is, preventing any other interrupts from being served while we access (read–modify–write) the semaphore.
MRS   r12, CPSR        ; read CPSR
ORR   r12, r12, #I_bit ; set I bit
MSR   CPSR_c, r12      ; write back CPSR
CPSID i                ; disable IRQ
- In multi core system, we need a mechanism to prevent the other core from accessing the system bus, while one task in one core carries out the read–modify–write sequence. SWP disables interrupt and blocks system bus, causing critical performance bottleneck.
LOCKED EQU 0         ; define value indicating

 LDR   r1, <addr>    ; load semaphore address
 LDR   r0, =LOCKED   ; preload "locked" value

spin_lock
 SWP   r0, r0, [r1]  ; swap register value with semaphore
 CMP   r0, #LOCKED   ; if semaphore was locked already
 BEQ   spin_lock     ;     retry
- A new, non-blocking method is Exclusive load (LDREX) (reads and tags the memory) and Exclusive store (STREX) (stores data to memory only if the tag is still valid). With this mechanism, bus masters won't be locked out from memory access altogether, but only if they access the same memory.
LOCKED EQU 0           ; define value indicating

 LDR     r12, <addr>   ; preload semaphore address
 LDR     r1, =LOCKED   ; preload "locked" value

spin_lock
 LDREX   r0, [r12]     ; load semaphore value
 CMP     r0, #LOCKED   ; if semaphore was locked already
 STREXNE r0, r1, [r12] ;    try to claim
 CMPNE   r0, #1        ;    and check success
 BEQ     spin_lock     ; retry if claiming semaphore failed.


Reference:
http://softpixel.com/~cwright/programming/threads/threads.c.php
http://koti.mbnet.fi/niclasw/MutexSemaphore.html
https://www.doulos.com/knowhow/arm/Hints_and_Tips/Implementing_Semaphores/

13 August 2015

PCIE

PCIE consists of 3 layers:
1. The Transaction Layer - 
 - Transaction Layer Packet (TLP)
2. The Data Link Layer -
 a. This layer adds DLL header (2 bytes) and CRC at the end.
    Called Data Link Layer Packets (DLLPs).
 - With CRC TLP’s integrity is assured.
 - An ack-retransmit mechanism makes sure no TLPs are lost. ie. reliability is assured.
 c. A flow control mechanism makes sure a packet is sent and received.
 d. Makes sure NO TLP delivery fails.
 e. Packet reordering
3. The Physical Layer -

- Most TLPs are routed by ID, which is a combination of Bus number, Device number and Function number.
- Bus mastering allows peripheral to exchange TLPs with peer peripherals.
- TLP on the bus generates PCIE interrupt. ie. a Write Request, with a special address, which the host has written into the peripheral’s configuration space during initialization.

- Vendors of FPGA devices provide a Transaction Layer front-end IP core to use with application logic.
- PCIE switch allow more devices to connect to a single Root Port.
- pCIE bridge provides an interface to other buses.

- PCIE BUS ENUMERATION
a. OS addresses PCI devises through PCIE controller, using IDSEL (Initialization Device Select) signal.
b. Bus enumeration is performed by attempting to read the vendor register and device ID register for each combination of bus number and device number at the device's function #0.
Initialization Device Select signal (IDSEL)
c. When a read to a specified B/D/F combination for the vendor ID register succeeds, OS knows that it exists; it writes all ones to its BARs and reads back the device's requested memory size in an encoded form.
d. Now OS programs the memory-mapped and I/O port addresses into the device's BAR configuration register.
e. If a PCI-to-PCI bridge is found, enumeration continues on that secondary bus.

- PCIE BUS ARBITRATION
Arbitration signals (REQ# and GNT#) are used to obtain permission for transaction.
PCIE requests with REQ# and should wait for GNT# from an arbiter located on the motherboard.


Reference:
http://www.xillybus.com/tutorials/pci-express-tlp-pcie-primer-tutorial-guide-1
http://www.xillybus.com/tutorials/pci-express-tlp-pcie-primer-tutorial-guide-2
http://www.xillybus.com/tutorials/pci-express-dma-requests-completions
http://rts.lab.asu.edu/web_438/CSE438_598_slides_yhlee/438_5_PCI_Architecture.pdf
https://en.wikipedia.org/wiki/Conventional_PCI

09 August 2015

AMBA

Different AMBA buses are:
1. AMBA 1 Advanced System Bus (ASB) [1996]
2. AMBA 1 Advanced Peripheral Bus (APB) [1996]
3. AMBA 2 High-performance Bus (AHB) - widely used on ARM Cortex-M based designs
4. AMBA 3 AMBA Extensible Interface (AXI) [2003]
5. AMBA 4 AMBA Extensible Interface 4 (AXI4) [2010]
6. AMBA 4 AXI Coherency Extensions (ACE) [2011]
7. AMBA 5 Coherent Hub Interface (CHI) [2013]



Reference:
https://en.wikipedia.org/wiki/Advanced_Microcontroller_Bus_Architecture
https://www.doulos.com/knowhow/

24 June 2015

802.11ac

ADDTS => add traffic stream
TS => traffic stream
TSPEC => traffic specification
TCLAS => traffic classification
APSD => Automatic power save delivery

EDCA Admission Control
Admission control is negotiated by the use of a TSPEC.
A station specifies its traffic flow requirements (data rate, delay bounds, packet size, and others) and requests the AP to create a TSPEC by sending the ADDTS (add TSPEC) management action frame.
If the TSPEC is accepted, the high priority access category inside the STA is permitted to use the high priority access parameters.

Controlled Channel Access
Unscheduled Automatic Power Save Delivery (U-APSD). This is an asynchronous approach to power conservation defined in 802.11, and serves as the basis of WMM Power Save, allowing the client to request queued traffic at any time rather than waiting for the next beacon frame.


Reference:
http://www.cisco.com/c/en/us/products/collateral/wireless/aironet-3600-series/white_paper_c11-713103.html
http://www.eetimes.com/document.asp?doc_id=1271987
http://community.arubanetworks.com/aruba/attachments/aruba/tkb%40tkb/37/1/U-APSD%20explained%20and%20debugged_i62_R2.pdf

23 June 2015

Using PEAP for wireless authentication

PEAP creates an encrypted TLS tunnel between the client and the authentication server. The keys for this encryption are transported using the server's public key. The ensuing exchange of authentication information inside the tunnel to authenticate the client is then encrypted and user credentials are safe from eavesdropping.

Use a trusted certificate for authentication: The RADIUS server must be configured with a digital certificate that is signed by a trusted certificate authority (CA), using a private or a public CA.
Validate the server certificate on all clients: All PEAP clients must validate the server certificate for authentication. A Trusted Root CA, that issued the server certificate, must be installed in client.








Reference:
http://www.networkworld.com/columnists/2007/042307-wireless-security.html
http://revolutionwifi.blogspot.com/2010/09/peapv0-packet-flow-reference.html
http://www.keyboardlife.net/2010/06/8021x-port-based-authentication-wired.html

22 June 2015

SA Query

use case of SA Query procedure
A client might lose its encryption keys due to a card reset or reboot and needs to (re-)associate itself. Since he lost all his keys, he sends an unprotected Association Request Frame. The AP still has a valid association from the client with keys in his client table, so the AP will first of all reject the Association and tell the client to try again in “X” seconds. After that, the AP tries to find out if this is an attack and the actual client can still answer protected frames.

The mechanism for that check is the Source Address (SA) Query phase, which starts with a protected SA Query Request from the AP to the client. If the client is unable to answer them until the comeback timeout “X” expires, the AP will send out a protected Disassociate and discards the keys for the no longer valid association of the client. As of now, a new (unprotected) Association Request from the client will be accepted.

Reference:
https://wlan1nde.wordpress.com/2014/10/21/protected-management-frames-802-11w

19 June 2015

802.11n Aggregation

MPDU -> MAC protocol data unit
MSDU -> MAC service data unit


Reference:
http://www.cisco.com/en/US/prod/collateral/wireless/ps5678/ps11983/white_paper_c11-713103.html

09 November 2014

System on a chip

WLAN chips are another example of a system fully integrated on a single chip (SoC).
1. The maximum output power to be delivered by the power amplifier still remains a critical issue for standard silicon.
2. Some other elements like the transmitter/receiver switch, the RF filters or the voltage-controlled oscillator (VCO) tank, may also be hard to implement in standard silicon technologies.
3. Noise isolation and technology fusion of analog/RF with digital and memory systems can be costly.

The advantages of SoC are good performance, small system size, and potentially low system cost.

Intellectual Property are designs purchased from a third-party as sub-components of a larger ASIC. They may be provided as an HDL description (often termed a "soft macro"), or as a fully routed design that could be printed directly onto an ASIC's mask (often termed a "hard macro").

The silicon wafers start out blank and pure. The circuits are built in layers in clean rooms. First, photoresist patterns are photo-masked in micrometer detail onto the wafers' surface. The wafers are then exposed to short-wave ultraviolet light and the unexposed areas are thus etched away and cleaned. Hot chemical vapors are deposited on to the desired zones and baked in high heat, which permeate the vapors into the desired zones. In some cases, ions, such as O2+ or O+, are implanted in precise patterns and at a specific depth by using RF-driven ion sources.

These steps are often repeated many hundreds of times, depending on the complexity of the desired circuit and its connections.

Wafer based ATEs typically use a device called wafer prober for testing integrated circuits.

Wafer-level packaging consists of extending the wafer fab processes to include device interconnection and device protection processes. Most other kinds of packaging do wafer dicing first, and then put the individual die in a plastic package and attach the solder bumps.

1. Wafer Level - Chip Scale Package (WL-CSP): The die may be mounted on an interposer upon which pads or balls are printed directly onto the silicon wafer, resulting in a package very close to the size of the silicon die: such a package is called a Wafer Level - Chip Scale Package (WL-CSP).
2. Wafer Level - Ball Grid Array (WL-BGA): The package is not realized on a silicon wafer as for classical Wafer Level Package, but on an artificial wafer. The electrical connections from the chip pads to the interconnects are realized in thin-film technology (like WL-CSP). With this technology any number of additional interconnects can be realized on the package in an arbitrary distance (fan-out design).

Reference:
http://www.eetimes.com/document.asp?doc_id=1202950
http://en.wikipedia.org/wiki/System_on_a_chip
http://opencores.org/
http://www.design-reuse.com/articles/20203/analog-ip-integration-soc.html
http://en.wikipedia.org/wiki/Electronic_design_automation
http://en.wikipedia.org/wiki/Wafer_fabrication
https://www.youtube.com/watch?v=UvluuAIiA50
http://en.wikipedia.org/wiki/Wafer_testing



01 November 2014

IEEE and Wi-Fi Alliance

>>> IEEE 802.11 standardizes WLAN technical specifications.
>>> The Wi-Fi Alliance creates certification programs for WLAN products.

Wi-Fi Direct (P2P) is a standard developed by the Wi-Fi Alliance. Wi-Fi Direct is not a standard created or maintained by the IEEE and as such there are no current plans to incorporate it into any IEEE standard.

Wi-Fi certification program formulation procedure:
1. Marketing TG (MTG) is established.
2. In the MTG, a Statement of Work (SoW) and a Marketing Requirements Document (MRD) are created.
3. Technical TG (TTG) is established and a Wi-Fi test plan is developed for the Wi-Fi certification.
4. Plugfest is held by member companies for testbed development, device selection, and connectivity verification.
5. Wi-Fi Certification, without waiting for the completion of IEEE 802.11 standards.

Reference:
https://www.ntt-review.jp/archive/ntttechnical.php?contents=ntr201004gls.html
http://networkengineering.stackexchange.com/questions/9675/does-ieee-802-11ac-imply-wi-fi-direct-compatibility