linux¶¨Ê±Æ÷ÉèÖÃ
10.5.2 ¾«Í¨¶¨Ê±Æ÷ÉèÖÃ
º¯ÊýalarmÉèÖõĶ¨Ê±Æ÷Ö»Äܾ«È·µ½Ã룬¶øÒÔϺ¯ÊýÀíÂÛÉÏ¿ÉÒÔ¾«È·µ½Î¢Ã
#include <sys/select.h>
#include <sys/itimer.h>
int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval
*value, struct itimerval *ovalue);
º¯Êýsetitimer¿ÉÒÔÌṩÈýÖÖ¶¨Ê±Æ÷£¬ËüÃÇÏ໥¶ÀÁ¢£¬ÈÎÒâÒ»¸ö¶¨Ê±Íê³É¶¼½«·¢ËͶ¨Ê±Ðźŵ½½ø³Ì£¬²¢ÇÒ×Ô¶¯ÖØмÆʱ¡£²ÎÊýwhichÈ·¶¨Á˶¨Ê±Æ÷µÄÀàÐÍ£¬Èç±í10-6Ëùʾ£º
±í10-6 ²ÎÊýwhichÓ붨ʱÆ÷ÀàÐÍ
È¡Öµ
º¬Òå
Ðźŷ¢ËÍ
ITIMER_REAL
¶¨Ê±Õæʵʱ¼ä£¬ÓëalarmÀàÐÍÏàͬ¡£
SIGALRM
ITIMER_VIRT
¶¨Ê±½ø³ÌÔÚÓû§Ì¬ÏµÄʵ¼ÊÖ´ÐÐʱ¼ä¡£
SIGVTALRM
ITIMER_PROF
¶¨Ê±½ø³ÌÔÚÓû§Ì¬ºÍºËÐÄ̬ÏÂ
µÄʵ¼ÊÖ´ÐÐʱ¼ä¡£
SIGPROF
ÕâÈýÖÖ¶¨Ê±Æ÷¶¨Ê±Íê³Éʱ¸ø½ø³Ì·¢Ë͵ÄÐźŸ÷²»Ïàͬ£¬ÆäÖÐITIMER_REALÀඨʱÆ÷·¢ËÍSIGALRMÐźţ¬ITIMER_VIRTÀඨʱÆ÷·¢ËÍSIGVTALRMÐźţ¬ITIMER_REALÀඨʱÆ÷·¢ËÍSIGPROFÐźš£
º¯Êýalarm±¾ÖÊÉÏÉèÖõÄÊǵ;«È·¡¢·ÇÖØÔصÄITIMER_REALÀඨʱÆ÷£¬ËüÖ»Äܾ«È·µ½Ã룬²¢ÇÒÿ´ÎÉèÖÃÖ»ÄܲúÉúÒ»´Î¶¨Ê±¡£º¯ÊýsetitimerÉèÖõĶ¨Ê±Æ÷Ôò²»Í¬£¬ËüÃDz»µ«¿ÉÒÔ¼Æʱµ½Î¢ÃÀíÂÛÉÏ£©£¬»¹ÄÜ×Ô¶¯Ñ»·¶¨Ê±¡£ÔÚÒ»¸öUnix½ø³ÌÖУ¬²»ÄÜͬʱʹÓÃalarmºÍITIMER_REALÀඨʱÆ÷¡£
½á¹¹itimervalÃèÊöÁ˶¨Ê±Æ÷µÄ×é³É£º
struct itimerval
{
struct timeval it_interval; /* Ï´ζ¨Ê±È¡Öµ */
struct timeval it_value; /* ±¾´Î¶¨Ê±ÉèÖÃÖµ */
}
½á¹¹timevalÃèÊöÁËÒ»¸ö¾«È·µ½Î¢ÃîµÄʱ¼ä£º
struct timeval
{
long tv_sec; /* Ã루1000000΢Ã룩 */
long tv_usec; /* ΢Ãî */
}
º¯ÊýsetitimerÉèÖÃÒ»¸ö¶¨Ê±Æ÷£¬²ÎÊývalueÖ¸ÏòÒ»¸öitimerval½á¹¹£¬¸Ã½á¹¹¾ö¶¨ÁËÉèÖõĶ¨Ê±Æ÷ÐÅÏ¢£¬½á¹¹³ÉÔ±it_valueÖ¸¶¨Ê״ζ¨Ê±µÄʱ¼ä£¬½á¹¹³ÉÔ±it_intervalÖ¸¶¨Ï´ζ¨Ê±µÄʱ¼ä¡£¶¨Ê±Æ÷¹¤×÷ʱ£¬ÏȽ«it_valueµÄʱ¼äÖµ¼õµ½0£¬·¢ËÍÒ»¸öÐźţ¬ÔÙ½«it_value¸³ÖµÎªit_intervalµÄÖµ£¬ÖØпªÊ¼¶¨Ê±£¬Èç´Ë·´¸´¡£Èç¹ûit_valueÖµ±»ÉèÖÃΪ0£¬Ôò¶¨Ê±Æ÷Í£Ö¹¶¨Ê±£»Èç¹ûit_valueÖµ²»Îª0µ«it_intervalֵΪ0£¬Ôò¶¨Ê±Æ÷ÔÚÒ»´Î¶¨Ê±ºóÖÕÖ¹¡£
º¯Êýsetitimerµ÷Óóɹ¦Ê±·µ»Ø0£¬·ñÔò·µ»Ø-1£¬²ÎÊýovalueÈç¹û²»Îª¿Õ£¬·µ»ØÉÏ´Î
Ïà¹ØÎĵµ£º
ÔÚºÆ嫵ÄLinuxÖУ¬²éÕÒij¸öÎļþÊǼþ·Ç³£ÒªÃüµÄʶù¡£ÎÒÊÔ¹ýºÜ¶à·½·¨£¬×î¼òµ¥¡¢×î·½±ãµÄÒ»ÖÖÊÇÀûÓÃlocateÃüÁîºÍupdatedbÃüÁîÅäºÏµÄ·½·¨£º
±ÈÈ磬ÎÒÃÇÒª²éÕÒÒ»¸öÎļþÃûÖдø“chen”×Ö·û´®µÄÎļþ£¬ÕâÑù×ö£º
[root@locahost /]# locate chen
ÕâÑù¾ÍÄܳöÏÖÒ»´ó´®Ô̺¬chen×Ö·û´®ÎļþÃûµÄÎļþ¡£
×¢Ò⣬locateÖ´Ðкóµ ......
ÏÂÃæµÄÎļþµÄʹÓ÷½·¨ÊÇ£º½«ÏÂÃæµÄÎļþ±£´æÔÚlinuxÄÚºËÔ´ÂëĿ¼ÖУ¬ÎļþµÄÃû³ÆÊÇ.config£¬È»ºómake menuconfig,ÔÚ³öÏÖ
µÄÅäÖýçÃæÖÐÑ¡ÔñLoad ConfiguratioÑ¡ÏȻºó¿ÉÒÔÔÚÕâ¸ö»ù´¡ÉÏÐÞ¸Ä×Ô¼ºµÄkernel¡£ÏÂÃæµÄÅäÖÃÊÇ»ùÓÚs3c2410£¬Ö§³Öyaffs2
Îļþϵͳ¡£ÎÒ¿´ÁËһϱàÒë³öÀ´µÄuImage´ó¸ÅÔÚ800k×óÓÒ£¬ºÇºÇôÕâÊDZ¾È˵ÚÒ»´Î³É ......
LinuxÇý¶¯µÄһЩ»ù±¾²Ù×÷
LinuxÄÚºËÖж¨ÒåÁ˺ܶàºê£¬¶ÔÓ²¼þ¶Ë¿ÚºÍ¼Ä´æÆ÷½øÐвÙ×÷£¬´ÓÍøÉÏËѼ¯ÁËһЩºê¶¨ÒåµÄÐÅÏ¢£º
1. __REG¼òµ¥µÄ˵¾ÍÊÇ»ñµÃºóÃæËùʾÎïÀíµØÖ·Ó³ÉäºóµÄÐéÄâµØÖ·£¬ÀýÈ磺
#define GPLR0 __REG(0x40E00000) /* GPIO Pin-Level Register GPIO<31:0> */
#define GPL ......
ÔÚ·þÎñÆ÷ÉÏд²¿ÊðÏîÄ¿µÄ½Å±¾ ,ÐèÒª°ÑÉÏ´«À´µÄ×îеÄÏîÄ¿½âѹ, ²¿Êð ,Æô¶¯·þÎñ ʵÏÖ×Ô¶¯»¯
ÓÚÊÇÕÒµ½×îеÄÎļþÊǵÚÒ»¼þÊÂÇé
¾ÍµÃµ½ÁËÒÔϽű¾
$ ls -lrt | awk '/xmhi/ { f=$NF };END{ print f }'
ÖмäµÄxmhiÊÇÎļþËù°üº¬µÄ×Ö·û´®
ÁíÍâÈç¹ûÒªls³öËùÓеÄÎļþÃû
$ ls -l |awk '{print$9}' ......