Search This Blog

Friday, February 11, 2011

What is Assisted GPS - AGPS

Assisted GPS is used to assist the GPS by providing the additional information like visible GPS satellites, reference time, Doppler which would help in GPS acquisition process. This feature intern help faster GPS acquiring time and reducing the GPS power consumption. Also helps in more accurate GPS measurements with more coverage.

Friday, February 4, 2011

Best programming practice: Constant usage in C/C++


Constant means read-only. Answer is not complete but still good. Constant can be declared in various way for various needs.

const int a; //Constant (non-modifiable) integer
int const a; //Constant (non-modifiable) integer
const int *a; //pointer to a Constant (non-modifiable) integer
int * const a; //Constant (non-modifiable) pointer to a integer
int const * a const; //Constant (non-modifiable) pointer to constant integer

You can write a program without using a constant keyword which would work without any problem. But writing a program using constant is good practice and dictates user on how to use them based on its behavior.

Best programming practice (C/C++): When and where to use volatile keyword

Main usage of volatile seen in embedded space. Practical use is seen in
1) Memory mapped peripheral registers 2) Global variables modified by ISR routine 3) Global variables modified by multi-threaded environment. In these scenarios values of these variable can change unexpectedly.

Watch out for the below behaviours and first thing to look for is assessing for the need for volatile variables.
Code stops working when
1) Multithreaded environment but works in single process/threads
2) Enable optimization
3) Enable Interrupts

Volatile qualifier will be used when the variable is declared, which tells the compiler that value of the variable can change without any action taken by code.

volatile int myVolatile;
int volatile myVolatile;
What is the difference between two?
If you do not know the answer let me know.

int * volatile myVolatile;
This means volatile pointer to non volatile variable.
int volatile * volatile myVolatile;
Volatile pointer to Volatile variable.

How to set automatic recovery after power failure for a SUN Netra box using ALOM port command

Please refer the How to connect to ALOM port section in this website. Once you login to SUN box and able to see the ALOM prompt sc>, you can use setsc command.
sc> showsc
Check the value for sc_powerstatememory variable. It shall show as below:
sc_powerstatememory false
To set the automatic recovery after power failure, do as below
sc> setsc sc_powerstatememory true
For any other commands use showsc and below syntax
sc> setsc <variable> <Value>

How to connect to console and ALOM port of SUN server

Pick up a laptop and cable which has RJ-47 in one end and 7-Pin serial port on the other end.

Connect RJ-47 to SERIAL MGT port in the Sun Box and serial port to your laptop. Make sure that you have a application like putty for the serial connection. Serial connection configuration shall be 9600/8n1/none. Establish a serial connection using putty, either console login prompt will appear or ALOM port login prompt appears. Please provide login and password, takes you to ALOM prompt or console window. If you wish to go to ALOM prompt from console then type “#.”(HASH and DOT). If you wish to switch to console prompt from ALOM then type “console”.

Embedded Engineer: integer promotion rule - Programming in C and C++

One thing Embedded engineer should know is integer promotion rule. Declaring the variable in correct makes life lot more easy in debugging and it should a good practice of programming as well.
Below example is for integer promotion rule.

unsigned int uIntVar = 2;
  int intVar = -10;
    (uIntVar+intVar > 2) ? puts("> 2") : puts("<= 2");

Answer is >2. Expression having the signed and unsigned integers, signed integer becomes a large number and evaluates to positive number in above example.
However it becomes a negative number if
int result = intVar  + uIntVar;  Or type cast the result to int

Now let me post questions.
1) What is the return value if invoke malloc with size zero?
2) How do you write a 1's compliment for given number?

Answer for the first question is strange where second one tests whether you are a embedded engineer.

What is Push-to-Talk over Cellular (PoC)

PoC is a one way communication over cellular network or called half duplex communication where voice call is full duplex. PoC called as walkie-talkie over PS domain of cellular networks. Best advantage is airtime which would be 1/4th or even less because voice packets transferred only one direction at a time. Radio resources can be allocated and released when needed.

What is Unlicensed Mobile Access - UMA

UMA provides tunneled IP connection to GSM/GPRS services through WiFi frequencies. But it needs dual mode mobile, to support roaming between wireless networks and unlicensed WiFi networks. UMA Network controller (UNC) is critical network node interworking between tunneled WiFi connection and cellular network.

Picture is referenced from book by Harri Holma and Antti Toskala