冷枫叶
百度空间 | 百度首页 
 
文章列表
 
2009-11-02 10:08

本程序是在周立功网上的程序的基础上修改的,原例里的ACK时序有点问题

/*******************************************************************************************************************
此程序是I2C操作平台(主方式的软件平台)的底层的C子程序,如发送数据
及接收数据,应答位发送,并提供了几个直接面对器件的操作函数,它很方便的与用
户程序连接并扩展。
注意:函数是采用软件延时的方法产生SCL脉冲,对高晶振频率要作一定的修改
(本例是3us机器周期,如果系统对时

 
2009-10-23 11:04

这是一个简短的文档,描述了linux内核的首选代码风格。代码风格是因人而异的,而且我
不愿意把我的观点强加给任何人,不过这里所讲述的是我必须要维护的代码所遵守的风格,
并且我也希望绝大多数其他代码也能遵守这个风格。请在写代码时至少考虑一下本文所述的
风格。

首先,我建议你打印一份GNU代码规范,然后不要读它。烧了它,这是一个具有重大象征性
意义的动作。

不管怎样,现在我们开始:


第一章:缩进

制表符是8个字符,所以缩进也是8个字符。有些异端运动试图将
 
2009-10-23 08:51

Many Ways to Use Remote Desktop (X11VNC)

 
2009-10-19 15:36
#if __LINUX_ARM_ARCH__ < 5

#include <asm-generic/bitops/ffz.h>
#include <asm-generic/bitops/__fls.h>
#include <asm-generic/bitops/__ffs.h>
#include <asm-generic/bitops/fls.h>
#include <asm-generic/bitops/ffs.h>

#else

static inline int constant_fls(int x)
{
int r = 32;

if (!x)
return 0;
if (!(x & 0xffff0000u)) {
x <<= 16;
r -= 16;
}
if (!(x & 0xff000000u)) {
x
 
2009-10-12 09:41
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>

void rand_init(void){
srand(time(0));
}

u_int8_t  get_rand8(void){
return(rand() % 256);
}
u_int16_t get_rand16(void){
return(rand() % 65536);
}
u_int32_t get_rand32(void){
return(rand());
}
u_int32_t get_n(u_int32_t n){
return(rand() % n);
}
 
2009-09-30 10:36
#ifndef _TYPES_H_
#define _TYPES_H_

#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

typedef unsigned char        u8;
typedef unsigned short        u16;
typedef unsigned int        u32;
typedef unsigned long long    u64;
typedef signed char        s8;
typedef short          
 
2009-09-18 09:54
ngx_fd_t
ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access)
{
ngx_fd_t  fd;

fd = open((const char *) name, O_CREAT|O_EXCL|O_RDWR,
access ? access : 0600);

if (fd != -1 && !persistent) {
unlink((const char *) name);
}

return fd;
}
 
2009-09-18 09:46

void
ngx_encode_base64(ngx_str_t *dst, ngx_str_t *src)
{
u_char         *d, *s;
size_t          len;
static u_char   basis64[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

len = src->len;
s = src->data;
d = dst->data;

while (len > 2) {
*d++ = basis64[(s[0] >> 2) & 0x3f];
*d++ = basi
 
2009-09-05 10:06
理查德·史蒂文斯(William Richard (Rich) Stevens,1951年2月5日-1999年9月1日),美国计算机科学家,是众多的畅销UNIX、TCP/IP书籍的作者。 著作 * 1990年 - “UNIX Network Programming” - ISBN 0-139-49876-1 中文名:《UNIX网络编程》 * 1992年 - Advanced Programming in the UNIX Environment - ISBN 0-201-56317-7 中文名:《UNIX环境高级编程》 * 1994年 - TCP/IP Illustrated, Volume 1: The Protocols - ISBN 0-201-63346-9 中文名:《TCP/IP详解 卷1:协议》 * 1995年 - TCP/IP Illustrated, Volume 2: The Imple
 
2009-09-03 17:20
/* readconfig.c by R.wen(rwen2012@gmail.com), 20090903 */

/* read file like this: (net-eth0.txt)

MODE  =  static
IPADDR=192.168.9.159
NETMASK=255.255.255.0
GATEWAY=192.168.9.1

*/

#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>


int readline(int fd, char *buf)
 
2009-09-03 12:35
标准的udp客户端开了套接口后,一般使用sendto和recvfrom函数来发数据,最近看到ntpclient的代码里面是使用send函数直接法的,就分析了一下,原来udp发送数据有两种方法供大家选用的,顺便把udp的connect用法也就解释清楚了。
方法一:
socket----->sendto()或recvfrom()
方法二:
socket----->connect()----->send()或recv()

首先从这里看出udp中也是可以使用connect的,但是这两种方法到底有什么区别呢?首先把这四个发送函数的定义列出来:
int send(int s,
 
2009-09-02 18:00
#include <stdio.h>
#include <
 
2009-08-13 12:50
/* Encryption and decryption are symmetric */
#define stream_decrypt stream_encrypt
static void stream_encrypt(stream_state *self, unsigned char *block,
 
2009-08-13 12:48
/**************************************************************
* Basic xor encryption program by spade89 :) *
* this code is for everyhuman no copyrights *
* feel free to modify or duplicate as much as you want. *
*
 
2009-08-09 10:49
/* test the loop unroling, by R.wen */
/* 循环展开可以避免小循环中,由于循环开销所占的比例过大造成的性能下降*/

#include <stdio.h>
#include <time.h>

int checksum(int num)
{
int i;
int sum1=0, sum2=0;

time_t t1, t2;

t1 = time(NULL);
for (i=num; i>0; i--)
sum1 += i;

t2 = time(NULL);
t1 = t2 - t1;
{
for (i=num/4; i>0; i--) {
sum2 += i;
sum2 += i+1;       
sum2
 
     
 
 
个人档案
 
Rwen2012
男, 27岁
广东 广州 
上次登录:
5天前
加为好友
 
   
 
文章分类
 
 
fs/io(13)
 
 
 
 
Kernel(24)
 
色影(11)
 
 
 
 
 
 
 
 
 
 
Arm(2)
 
     
 
留言板
 

空间很好,互踩互踩!
 

我来踩你啦,一定要回踩哦。o(∩_∩)o...哈哈
 

我参加了百度[点亮爱的心愿]活动,请好友们帮我点十下,提前感谢你的支持。谢谢你!
 

我们能交个朋友吗!你很出色,关注你一段时间了
 

花无处不在,坦然随意。希望朋友的生活像花儿一样,自然、自在、美好、快乐!有空来我...
 
     
 
最新评论
 
文章评论|照片评论


内容不错 ,赞
 

谢谢!
 

??????还好
 
 

0x30000 是 3 M~~~~~
 
     
 
好友最新文章
 
     
 
最近访客
 
 

leehark

蓝色小红鱼

maomaoliyang

花儿开一朵

du_zeming

guangqi002

proudboy_linux

igouwa
     
 
订阅我的空间
 
已有人次访问本空间
 
订阅RSS  什么是RSS?

您也想拥有这样的空间?请点此申请。
     


©2009 Baidu