Monday, May 23, 2011

Hello world in Visual studio of Windows

// Test Project.cpp : Defines the entry point for the console application.
//
E.g 1:
#include "stdafx.h"
#include <stdio.h>

int _tmain(int argc, _TCHAR* argv[])
{
 printf("hello world\n");
 printf("Press Enter to continue: ");
 fflush(stdout);
 while (getchar() != '\n' );
 return 0;
}


E.g 2:
// TrustZoneTest.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include <process.h>
int _tmain(int argc, _TCHAR* argv[])
{
 double x = 1.1;
 double y = 2.2;
 printf("hello world");
 system("pause");

 return 0;
}

Windows Comand Line

md/mkdir: create a directory
del: delete a file
rmdir: remove directory
ipconfig: get IP address

Monday, May 9, 2011

How to edit the Boot.ini file in Windows XP

http://support.microsoft.com/kb/289022

Sunday, May 8, 2011

DOS命令大全 IIS命令大全 SQL命令大全

http://www.cnblogs.com/hanjiheng/archive/2011/05/08/2040425.html

Friday, May 6, 2011

Suspend/wakeup for psmouse, atkbd device

Based on kernel 2.6.24

For PS2 mouse and PS2 keyboard. the driver is at:
/linuxsrc/driver/input/mouse/psmouse-base.c
/linuxsrc/driver/input/keyboard/atkbd.c

How does supend/wakeup works for mouse and drive?

/linuxsrc/kernel/power/main.c devince_suspend
->
/linuxsrc/driver/base/power/main.c call the driver of each device
->
/linuxsrc/driver/input/serio.c
serio_suspend() -> serio_cleanup()->
serio_resume() -> serio_reconnect_driver()-> 
->
/linuxsrc/driver/input/mouse/psmouse-base.c
/linuxsrc/driver/input/keyboard/atkbd.c
psmouse_cleanup(); atkbd_cleanup()
psmouse_reconnect(); atkbd_reconnect()

Thursday, May 5, 2011

cpufreq: CPU_Frequency_Scaling

https://wiki.archlinux.org/index.php/CPU_Frequency_Scaling
http://www.mjmwired.net/kernel/Documentation/cpu-freq/governors.txt

Linux kernel Suspend Code

After echo "mem" > /sys/power/state directory, it jumps to kernel. start to execute code at /linux-2.6.24/kernel/power/main.c, it execute function

state_store() -> enter_state() ->
1. suspend_prepare()
2. suspend_device_and_enter() // machine stop here, and wakeup here!!!
3. suspend_finish()

remember, all the printk statement you added will be print into /var/log/message.
It doesn't necessary to pint out immediately. For example, printk statement before OS get into S3 state may print out after wakeup OS.
Basically, printk will write to memory first, and then print out to file.