linux內核沒有iobuf,LINUX2.6.26.6內核下雙口RAM的驅動函數測試成功!

驅動程序:

#include

//#include

#include

#include

#include

#include

#include

#include

//#include

#include

//#include

#include

#include

#include

#include

//#include

#include

#include

#include

#include

#include

#include

#include

MODULE_LICENSE("GPL");

#define IOPORT_MAJOR 221 //定義主設備號

#define IOWRITE???????? 1

#define IOREAD????????? 2

#define DRAM_LEN??????? 0X2000 //8k WORD

#define DA_BASE ?0X30000000

typedef char ioport_device_t;

static ioport_device_t dram_devices[257];

unsigned short sincode60[]={2048,2064,2081,2097,2114,2131,2147,2164,2180,2197,

2214,2230,2247,2263,2280,2296,2313,2329,2345,2362,

2378,2394,2411,2427,2443,2459,2475,2491,2507,2523,

2539,2555,2571,2587,2602,2618,2633,2649,2664,2680,

2695,2711,2726,2741,2756,2771,2786,2801,2815,2830,

2845,2859,2874,2888,2902,2917,2931,2945,2959,2973,

2986,3000,3014,3027,3040,3054,3067,3080,3093,3106,

3118,3131,3144,3156,3168,3180,3192,3204,3216,3228,

3240,3251,3262,3274,3285,3296,3307,3317,3328,3338,

3349,3359,3369,3379,3389,3399,3408,3417,3427,3436,

3445,3454,3462,3471,3479,3488,3496,3504,3512,3519,

3527,3534,3541,3549,3555,3562,3569,3575,3582,3588,

3594,3600,3605,3611,3616,3621,3627,3631,3636,3641,

3645,3649,3654,3657,3661,3665,3668,3672,3675,3678,

3680,3683,3686,3688,3690,3692,3694,3695,3697,3698,

3699,3700,3701,3702,3702,3702,3702,3702,3702,3702,

3701,3701,3700,3699,3697,3696,3695,3693,3691,3689,

3687,3684,3682,3679,3676,3673,3670,3667,3663,3659,

3656,3652,3647,3643,3639,3634,3629,3624,3619,3614,

3608,3603,3597,3591,3585,3579,3572,3566,3559,3552,

3545,3538,3531,3523,3515,3508,3500,3492,3484,3475,

3467,3458,3449,3440,3431,3422,3413,3403,3394,3384,

3374,3364,3354,3344,3333,3323,3312,3301,3290,3279,

3268,3257,3245,3234,3222,3210,3198,3186,3174,3162,

3150,3137,3125,3112,3099,3086,3073,3060,3047,3034,

3020,3007,2993,2979,2966,2952,2938,2924,2910,2895,

2881,2867,2852,2838,2823,2808,2793,2778,2763,2748,

2733,2718,2703,2688,2672,2657,2641,2626,2610,2594,

2579,2563,2547,2531,2515,2499,2483,2467,2451,2435,

2419,2402,2386,2370,2354,2337,2321,2304,2288,2271,

2255,2238,2222,2205,2189,2172,2156,2139,2122,2106,

2089,2072,2056,2039,2023,2006,1989,1973,1956,1939,

1923,1906,1890,1873,1857,1840,1824,1807,1791,1774,

1758,1741,1725,1709,1693,1676,1660,1644,1628,1612,

1596,1580,1564,1548,1532,1516,1501,1485,1469,1454,

1438,1423,1407,1392,1377,1362,1347,1332,1317,1302,

1287,1272,1257,1243,1228,1214,1200,1185,1171,1157,

1143,1129,1116,1102,1088,1075,1061,1048,1035,1022,

1009,996,983,970,958,945,933,921,909,897,

885,873,861,850,838,827,816,805,794,783,

772,762,751,741,731,721,711,701,692,682,

673,664,655,646,637,628,620,611,603,595,

587,580,572,564,557,550,543,536,529,523,

516,510,504,498,492,487,481,476,471,466,

461,456,452,448,443,439,436,432,428,425,

422,419,416,413,411,408,406,404,402,400,

399,398,396,395,394,394,393,393,393,393,

393,393,393,394,395,396,397,398,400,401,

403,405,407,409,412,415,417,420,423,427,

430,434,438,441,446,450,454,459,464,468,

474,479,484,490,495,501,507,513,520,526,

533,540,546,554,561,568,576,583,591,599,

607,616,624,633,641,650,659,668,678,687,

696,706,716,726,736,746,757,767,778,788,

799,810,821,833,844,855,867,879,891,903,

915,927,939,951,964,977,989,1002,1015,1028,

1041,1055,1068,1081,1095,1109,1122,1136,1150,1164,

1178,1193,1207,1221,1236,1250,1265,1280,1294,1309,

1324,1339,1354,1369,1384,1400,1415,1431,1446,1462,

1477,1493,1508,1524,1540,1556,1572,1588,1604,1620,

1636,1652,1668,1684,1701,1717,1733,1750,1766,1782,

1799,1815,1832,1848,1865,1881,1898,1915,1931,1948,

1964,1981,1998,2014,2031

};

unsigned short sincode50[]={

614,606,598,590,582,574,567,560,552,545,

538,532,525,519,512,506,500,494,489,483,

478,473,468,463,458,453,449,445,441,437,

433,430,426,423,420,417,414,411,409,407,

405,403,401,399,398,397,396,395,394,393,

393,393,393,393,393,393,394,395,395,396,

398,399,401,402,404,406,409,411,414,416,

419,422,426,429,433,436,440,444,448,453,

457,462,467,472,477,482,488,493,499,505,

511,518,524,531,537,544,551,558,566,573,

581,589,597,605,613,621,630,638,647,656,

665,674,684,693,703,713,723,733,743,753,

764,774,785,796,807,818,829,840,852,863,

875,887,899,911,923,935,947,960,972,985,

998,1011,1024,1037,1050,1064,1077,1090,1104,1118,

1132,1146,1160,1174,1188,1202,1216,1231,1245,1260,

1275,1289,1304,1319,1334,1349,1364,1379,1395,1410,

1425,1441,1456,1472,1488,1503,1519,1535,1551,1566,

1582,1598,1614,1631,1647,1663,1679,1695,1712,1728,

1744,1761,1777,1793,1810,1826,1843,1859,1876,1892,

1909,1926,1942,1959,1975,1992,2009,2025,2042,2059,

2075,2092,2108,2125,2142,2158,2175,2192,2208,2225,

2241,2258,2274,2291,2307,2324,2340,2356,2373,2389,

2405,2421,2438,2454,2470,2486,2502,2518,2534,2550,

2566,2581,2597,2613,2628,2644,2659,2675,2690,2705,

2721,2736,2751,2766,2781,2796,2811,2825,2840,2855,

2869,2883,2898,2912,2926,2940,2954,2968,2982,2995,

3009,3023,3036,3049,3062,3075,3088,3101,3114,3127,

3139,3152,3164,3176,3188,3200,3212,3224,3236,3247,

3259,3270,3281,3292,3303,3314,3324,3335,3345,3356,

3366,3376,3386,3395,3405,3414,3424,3433,3442,3451,

3460,3468,3477,3485,3493,3501,3509,3517,3524,3532,

3539,3546,3553,3560,3567,3573,3580,3586,3592,3598,

3603,3609,3615,3620,3625,3630,3635,3639,3644,3648,

3652,3656,3660,3664,3667,3671,3674,3677,3680,3682,

3685,3687,3689,3691,3693,3695,3696,3698,3699,3700,

3701,3701,3702,3702,3702,3702,3702,3702,3702,3701,

3700,3699,3698,3697,3695,3693,3692,3690,3687,3685,

3683,3680,3677,3674,3671,3668,3664,3661,3657,3653,

3649,3644,3640,3635,3631,3626,3621,3615,3610,3604,

3599,3593,3587,3581,3574,3568,3561,3554,3547,3540,

3533,3526,3518,3510,3502,3494,3486,3478,3470,3461,

3452,3443,3434,3425,3416,3407,3397,3387,3377,3367,

3357,3347,3337,3326,3316,3305,3294,3283,3272,3261,

3249,3238,3226,3214,3202,3190,3178,3166,3154,3141,

3129,3116,3104,3091,3078,3065,3051,3038,3025,3011,

2998,2984,2970,2956,2942,2928,2914,2900,2886,2871,

2857,2842,2828,2813,2798,2783,2768,2753,2738,2723,

2708,2693,2677,2662,2646,2631,2615,2600,2584,2568,

2552,2536,2521,2505,2489,2472,2456,2440,2424,2408,

2392,2375,2359,2343,2326,2310,2293,2277,2260,2244,

2227,2211,2194,2178,2161,2144,2128,2111,2095,2078,

2061,2045,2028,2011,1995,1978,1962,1945,1928,1912,

1895,1879,1862,1846,1829,1813,1796,1780,1763,1747,

1731,1714,1698,1682,1666,1649,1633,1617,1601,1585,

1569,1553,1537,1522,1506,1490,1475,1459,1443,1428,

1413,1397,1382,1367,1352,1337,1322,1307,1292,1277,

1262,1248,1233,1219,1204,1190,1176,1162,1148,1134,

1120,1106,1093,1079,1066,1052,1039,1026,1013,1000,

987,975,962,949,937,925,913,901,889,877,

865,853,842,831,819,808,797,787,776,765,

755,744,734,724,714,705,695,685,676,667,

658,649,640,631,623

};

unsigned short sincode40[]={

3481,3472,3464,3455,3446,3437,3428,3419,3410,3400,

3390,3381,3371,3361,3351,3340,3330,3319,3308,3298,

3287,3276,3264,3253,3242,3230,3218,3206,3194,3182,

3170,3158,3146,3133,3120,3108,3095,3082,3069,3056,

3043,3029,3016,3002,2989,2975,2961,2947,2933,2919,

2905,2891,2876,2862,2847,2833,2818,2803,2788,2773,

2758,2743,2728,2713,2698,2682,2667,2652,2636,2620,

2605,2589,2573,2558,2542,2526,2510,2494,2478,2462,

2446,2429,2413,2397,2381,2364,2348,2332,2315,2299,

2282,2266,2249,2233,2216,2200,2183,2167,2150,2133,

2117,2100,2084,2067,2050,2034,2017,2000,1984,1967,

1951,1934,1917,1901,1884,1868,1851,1835,1818,1802,

1785,1769,1752,1736,1720,1703,1687,1671,1655,1639,

1623,1606,1590,1574,1559,1543,1527,1511,1495,1480,

1464,1449,1433,1418,1402,1387,1372,1357,1342,1327,

1312,1297,1282,1267,1253,1238,1224,1209,1195,1181,

1167,1153,1139,1125,1111,1097,1084,1070,1057,1044,

1030,1017,1004,991,979,966,954,941,929,917,

905,893,881,869,857,846,834,823,812,801,

790,779,769,758,748,738,728,718,708,698,

688,679,670,661,652,643,634,625,617,609,

601,593,585,577,569,562,555,548,541,534,

527,521,514,508,502,496,491,485,480,474,

469,464,460,455,451,446,442,438,434,431,

427,424,421,418,415,412,410,408,405,403,

402,400,398,397,396,395,394,393,393,393,

393,393,393,393,394,394,395,396,397,399,

400,402,404,406,408,410,413,415,418,421,

424,428,431,435,439,443,447,451,456,460,

465,470,475,480,486,492,497,503,509,515,

522,528,535,542,549,556,563,571,578,586,

594,602,610,618,627,635,644,653,662,671,

681,690,700,709,719,729,739,750,760,771,

781,792,803,814,825,836,848,859,871,883,

895,907,919,931,943,956,968,981,994,1007,

1020,1033,1046,1059,1072,1086,1100,1113,1127,1141,

1155,1169,1183,1197,1212,1226,1240,1255,1270,1284,

1299,1314,1329,1344,1359,1374,1390,1405,1420,1436,

1451,1467,1482,1498,1514,1529,1545,1561,1577,1593,

1609,1625,1641,1657,1674,1690,1706,1722,1739,1755,

1771,1788,1804,1821,1837,1854,1870,1887,1903,1920,

1937,1953,1970,1987,2003,2020,2036,2053,2070,2086,

2103,2120,2136,2153,2169,2186,2203,2219,2236,2252,

2269,2285,2302,2318,2334,2351,2367,2383,2400,2416,

2432,2448,2464,2481,2497,2513,2529,2544,2560,2576,

2592,2607,2623,2639,2654,2670,2685,2700,2716,2731,

2746,2761,2776,2791,2806,2820,2835,2850,2864,2879,

2893,2907,2921,2935,2949,2963,2977,2991,3005,3018,

3031,3045,3058,3071,3084,3097,3110,3123,3135,3148,

3160,3172,3184,3196,3208,3220,3232,3243,3255,3266,

3277,3288,3299,3310,3321,3331,3342,3352,3362,3372,

3382,3392,3402,3411,3421,3430,3439,3448,3457,3465,

3474,3482,3490,3498,3506,3514,3522,3529,3537,3544,

3551,3558,3564,3571,3577,3584,3590,3596,3602,3607,

3613,3618,3623,3628,3633,3638,3642,3647,3651,3655,

3659,3662,3666,3669,3673,3676,3679,3681,3684,3686,

3689,3691,3693,3694,3696,3697,3699,3700,3700,3701,

3702,3702,3702,3702,3702,3702,3702,3701,3700,3699,

3698,3697,3696,3694,3692,3690,3688,3686,3684,3681,

3678,3675,3672,3669,3665,3662,3658,3654,3650,3646,

3642,3637,3632,3627,3622,3617,3612,3606,3601,3595,

3589,3583,3576,3570,3563,3557,3550,3543,3535,3528,

3521,3513,3505,3497,3489

};

unsigned short node=sizeof(sincode50)/sizeof(unsigned short);

static int? dram_open(struct inode *inode,struct file *filp)

{

unsigned short minor,i;

void __iomem *pt=NULL;

minor = MINOR(inode->i_rdev);

dram_devices[minor]++;

//init dram

pt=ioremap(DA_BASE,DRAM_LEN+1);

if(pt==NULL){

printk("Failed to remap register bloack!/n");

return -ENOMEM;

}

for(i=0;i

writew(0x00,pt);

pt++;

}

//iounmap(DA_BASE);

return 0;

}

static int? dram_release(struct inode *inode,struct file *filp)

{

int minor;

minor = MINOR(inode->i_rdev);

if(dram_devices[minor])

dram_devices[minor]--;

//iounmap(DA_BASE);

return 0;

}

static int? dram_ctl_ioctl(struct inode *inode, struct file *filp,

unsigned int command, unsigned long arg)

{

int err = 0;

int i=0;

int minor = MINOR(inode->i_rdev);

void __iomem *pt;

switch(command)

{

case 1:

pt=ioremap(DA_BASE,DRAM_LEN+1 );

if(pt==NULL){

printk("Failed to remap register bloack!/n");

return -ENOMEM;

}

for(i=0;i

writew(0x800,pt);

pt++;

}

printk("DA half output!/n");

//iounmap(DA_BASE);

break;

case 2:

pt=ioremap(DA_BASE,DRAM_LEN+1);

if(pt==NULL){

printk("Failed to remap register bloack!/n");

return -ENOMEM;

}

for(i=0;i

writew(0xfff,pt);

pt++;

}

printk("DA full output!/n");

//iounmap(DA_BASE);

break;

}

return err;

}

static ssize_t dram_read(struct file *f,char *buf,int size,loff_t *off)

{

printk("in read function!/n");

return 0;

}

static ssize_t dram_write(struct file *f,const char *buf, int size,loff_t *off)

{

void __iomem *pt;

int i=0;

/*?pt=ioremap(DA_BASE,DRAM_LEN+1);

if(size>DRAM_LEN){

printk("Write DRAM out of size!");

return -EFAULT;

}

if(copy_from_user(pt,buf,size)) return -EFAULT;

*/

pt=ioremap(DA_BASE,DRAM_LEN+1);

if(pt==NULL){

printk("Failed to remap register bloack!/n");

return -ENOMEM;

}

for(i=0;i

writew(sincode60[i],pt);

pt+=2;

writew(sincode50[i],pt);

pt+=2;

writew(sincode40[i],pt);

pt+=2;

}

return 0;

}

static struct file_operations dram_ctl_fops={

owner:????????????? THIS_MODULE,

ioctl:????????? dram_ctl_ioctl,

open:?????????? dram_open,

release:??????? dram_release,

write:??dram_write,

read: ??dram_read,

};

static int __init dram_init(void)

{

register_chrdev(IOPORT_MAJOR ,"dram_driver",&dram_ctl_fops);

return 0;

}

static void __exit dram_exit(void)

{

unregister_chrdev(IOPORT_MAJOR,"dram_driver");

}

module_init(dram_init);

module_exit(dram_exit);

Makefile文件:

# Makefile2.6

ifneq ($(KERNELRELEASE),)

#kbuild syntax. dependency relationship of files and target modules are listed here.

#obj-m +=hello.o

#obj-m :=gpio_driver.o

obj-m :=dram_driver.o

else

PWD :=$(shell pwd)

KEVER ?=$(shell uname -r)

#KDIR :=/home/wfg/linux-2.6.26.3/$(KEVER)/build

#KDIR :=/home/wfg/linux-2.6.26.3

KDIR :=/home/wuyan/download/linux-2.6.26

default:

#$(MAKE) -C $(KDIR) M=$(PWD)

make -C $(KDIR) M=$(PWD) modules

clean:

rm -rf .*.cmd *.o *.mod.c *.ko .tmp_versions *.order *symvers

endif

測試程序:

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

#define DEVICE_DRAM??????????????? "/dev/dram_driver"

#define IOWRITE??????????????? 1

#define IOCLEAR??????????????? 2

unsigned short sincode60[]={2048,2064,2081,2097,2114,2131,2147,2164,2180,2197,

2214,2230,2247,2263,2280,2296,2313,2329,2345,2362,

2378,2394,2411,2427,2443,2459,2475,2491,2507,2523,

2539,2555,2571,2587,2602,2618,2633,2649,2664,2680,

2695,2711,2726,2741,2756,2771,2786,2801,2815,2830,

2845,2859,2874,2888,2902,2917,2931,2945,2959,2973,

2986,3000,3014,3027,3040,3054,3067,3080,3093,3106,

3118,3131,3144,3156,3168,3180,3192,3204,3216,3228,

3240,3251,3262,3274,3285,3296,3307,3317,3328,3338,

3349,3359,3369,3379,3389,3399,3408,3417,3427,3436,

3445,3454,3462,3471,3479,3488,3496,3504,3512,3519,

3527,3534,3541,3549,3555,3562,3569,3575,3582,3588,

3594,3600,3605,3611,3616,3621,3627,3631,3636,3641,

3645,3649,3654,3657,3661,3665,3668,3672,3675,3678,

3680,3683,3686,3688,3690,3692,3694,3695,3697,3698,

3699,3700,3701,3702,3702,3702,3702,3702,3702,3702,

3701,3701,3700,3699,3697,3696,3695,3693,3691,3689,

3687,3684,3682,3679,3676,3673,3670,3667,3663,3659,

3656,3652,3647,3643,3639,3634,3629,3624,3619,3614,

3608,3603,3597,3591,3585,3579,3572,3566,3559,3552,

3545,3538,3531,3523,3515,3508,3500,3492,3484,3475,

3467,3458,3449,3440,3431,3422,3413,3403,3394,3384,

3374,3364,3354,3344,3333,3323,3312,3301,3290,3279,

3268,3257,3245,3234,3222,3210,3198,3186,3174,3162,

3150,3137,3125,3112,3099,3086,3073,3060,3047,3034,

3020,3007,2993,2979,2966,2952,2938,2924,2910,2895,

2881,2867,2852,2838,2823,2808,2793,2778,2763,2748,

2733,2718,2703,2688,2672,2657,2641,2626,2610,2594,

2579,2563,2547,2531,2515,2499,2483,2467,2451,2435,

2419,2402,2386,2370,2354,2337,2321,2304,2288,2271,

2255,2238,2222,2205,2189,2172,2156,2139,2122,2106,

2089,2072,2056,2039,2023,2006,1989,1973,1956,1939,

1923,1906,1890,1873,1857,1840,1824,1807,1791,1774,

1758,1741,1725,1709,1693,1676,1660,1644,1628,1612,

1596,1580,1564,1548,1532,1516,1501,1485,1469,1454,

1438,1423,1407,1392,1377,1362,1347,1332,1317,1302,

1287,1272,1257,1243,1228,1214,1200,1185,1171,1157,

1143,1129,1116,1102,1088,1075,1061,1048,1035,1022,

1009,996,983,970,958,945,933,921,909,897,

885,873,861,850,838,827,816,805,794,783,

772,762,751,741,731,721,711,701,692,682,

673,664,655,646,637,628,620,611,603,595,

587,580,572,564,557,550,543,536,529,523,

516,510,504,498,492,487,481,476,471,466,

461,456,452,448,443,439,436,432,428,425,

422,419,416,413,411,408,406,404,402,400,

399,398,396,395,394,394,393,393,393,393,

393,393,393,394,395,396,397,398,400,401,

403,405,407,409,412,415,417,420,423,427,

430,434,438,441,446,450,454,459,464,468,

474,479,484,490,495,501,507,513,520,526,

533,540,546,554,561,568,576,583,591,599,

607,616,624,633,641,650,659,668,678,687,

696,706,716,726,736,746,757,767,778,788,

799,810,821,833,844,855,867,879,891,903,

915,927,939,951,964,977,989,1002,1015,1028,

1041,1055,1068,1081,1095,1109,1122,1136,1150,1164,

1178,1193,1207,1221,1236,1250,1265,1280,1294,1309,

1324,1339,1354,1369,1384,1400,1415,1431,1446,1462,

1477,1493,1508,1524,1540,1556,1572,1588,1604,1620,

1636,1652,1668,1684,1701,1717,1733,1750,1766,1782,

1799,1815,1832,1848,1865,1881,1898,1915,1931,1948,

1964,1981,1998,2014,2031

};

unsigned short sincode50[]={

614,606,598,590,582,574,567,560,552,545,

538,532,525,519,512,506,500,494,489,483,

478,473,468,463,458,453,449,445,441,437,

433,430,426,423,420,417,414,411,409,407,

405,403,401,399,398,397,396,395,394,393,

393,393,393,393,393,393,394,395,395,396,

398,399,401,402,404,406,409,411,414,416,

419,422,426,429,433,436,440,444,448,453,

457,462,467,472,477,482,488,493,499,505,

511,518,524,531,537,544,551,558,566,573,

581,589,597,605,613,621,630,638,647,656,

665,674,684,693,703,713,723,733,743,753,

764,774,785,796,807,818,829,840,852,863,

875,887,899,911,923,935,947,960,972,985,

998,1011,1024,1037,1050,1064,1077,1090,1104,1118,

1132,1146,1160,1174,1188,1202,1216,1231,1245,1260,

1275,1289,1304,1319,1334,1349,1364,1379,1395,1410,

1425,1441,1456,1472,1488,1503,1519,1535,1551,1566,

1582,1598,1614,1631,1647,1663,1679,1695,1712,1728,

1744,1761,1777,1793,1810,1826,1843,1859,1876,1892,

1909,1926,1942,1959,1975,1992,2009,2025,2042,2059,

2075,2092,2108,2125,2142,2158,2175,2192,2208,2225,

2241,2258,2274,2291,2307,2324,2340,2356,2373,2389,

2405,2421,2438,2454,2470,2486,2502,2518,2534,2550,

2566,2581,2597,2613,2628,2644,2659,2675,2690,2705,

2721,2736,2751,2766,2781,2796,2811,2825,2840,2855,

2869,2883,2898,2912,2926,2940,2954,2968,2982,2995,

3009,3023,3036,3049,3062,3075,3088,3101,3114,3127,

3139,3152,3164,3176,3188,3200,3212,3224,3236,3247,

3259,3270,3281,3292,3303,3314,3324,3335,3345,3356,

3366,3376,3386,3395,3405,3414,3424,3433,3442,3451,

3460,3468,3477,3485,3493,3501,3509,3517,3524,3532,

3539,3546,3553,3560,3567,3573,3580,3586,3592,3598,

3603,3609,3615,3620,3625,3630,3635,3639,3644,3648,

3652,3656,3660,3664,3667,3671,3674,3677,3680,3682,

3685,3687,3689,3691,3693,3695,3696,3698,3699,3700,

3701,3701,3702,3702,3702,3702,3702,3702,3702,3701,

3700,3699,3698,3697,3695,3693,3692,3690,3687,3685,

3683,3680,3677,3674,3671,3668,3664,3661,3657,3653,

3649,3644,3640,3635,3631,3626,3621,3615,3610,3604,

3599,3593,3587,3581,3574,3568,3561,3554,3547,3540,

3533,3526,3518,3510,3502,3494,3486,3478,3470,3461,

3452,3443,3434,3425,3416,3407,3397,3387,3377,3367,

3357,3347,3337,3326,3316,3305,3294,3283,3272,3261,

3249,3238,3226,3214,3202,3190,3178,3166,3154,3141,

3129,3116,3104,3091,3078,3065,3051,3038,3025,3011,

2998,2984,2970,2956,2942,2928,2914,2900,2886,2871,

2857,2842,2828,2813,2798,2783,2768,2753,2738,2723,

2708,2693,2677,2662,2646,2631,2615,2600,2584,2568,

2552,2536,2521,2505,2489,2472,2456,2440,2424,2408,

2392,2375,2359,2343,2326,2310,2293,2277,2260,2244,

2227,2211,2194,2178,2161,2144,2128,2111,2095,2078,

2061,2045,2028,2011,1995,1978,1962,1945,1928,1912,

1895,1879,1862,1846,1829,1813,1796,1780,1763,1747,

1731,1714,1698,1682,1666,1649,1633,1617,1601,1585,

1569,1553,1537,1522,1506,1490,1475,1459,1443,1428,

1413,1397,1382,1367,1352,1337,1322,1307,1292,1277,

1262,1248,1233,1219,1204,1190,1176,1162,1148,1134,

1120,1106,1093,1079,1066,1052,1039,1026,1013,1000,

987,975,962,949,937,925,913,901,889,877,

865,853,842,831,819,808,797,787,776,765,

755,744,734,724,714,705,695,685,676,667,

658,649,640,631,623

};

unsigned short sincode40[]={

3481,3472,3464,3455,3446,3437,3428,3419,3410,3400,

3390,3381,3371,3361,3351,3340,3330,3319,3308,3298,

3287,3276,3264,3253,3242,3230,3218,3206,3194,3182,

3170,3158,3146,3133,3120,3108,3095,3082,3069,3056,

3043,3029,3016,3002,2989,2975,2961,2947,2933,2919,

2905,2891,2876,2862,2847,2833,2818,2803,2788,2773,

2758,2743,2728,2713,2698,2682,2667,2652,2636,2620,

2605,2589,2573,2558,2542,2526,2510,2494,2478,2462,

2446,2429,2413,2397,2381,2364,2348,2332,2315,2299,

2282,2266,2249,2233,2216,2200,2183,2167,2150,2133,

2117,2100,2084,2067,2050,2034,2017,2000,1984,1967,

1951,1934,1917,1901,1884,1868,1851,1835,1818,1802,

1785,1769,1752,1736,1720,1703,1687,1671,1655,1639,

1623,1606,1590,1574,1559,1543,1527,1511,1495,1480,

1464,1449,1433,1418,1402,1387,1372,1357,1342,1327,

1312,1297,1282,1267,1253,1238,1224,1209,1195,1181,

1167,1153,1139,1125,1111,1097,1084,1070,1057,1044,

1030,1017,1004,991,979,966,954,941,929,917,

905,893,881,869,857,846,834,823,812,801,

790,779,769,758,748,738,728,718,708,698,

688,679,670,661,652,643,634,625,617,609,

601,593,585,577,569,562,555,548,541,534,

527,521,514,508,502,496,491,485,480,474,

469,464,460,455,451,446,442,438,434,431,

427,424,421,418,415,412,410,408,405,403,

402,400,398,397,396,395,394,393,393,393,

393,393,393,393,394,394,395,396,397,399,

400,402,404,406,408,410,413,415,418,421,

424,428,431,435,439,443,447,451,456,460,

465,470,475,480,486,492,497,503,509,515,

522,528,535,542,549,556,563,571,578,586,

594,602,610,618,627,635,644,653,662,671,

681,690,700,709,719,729,739,750,760,771,

781,792,803,814,825,836,848,859,871,883,

895,907,919,931,943,956,968,981,994,1007,

1020,1033,1046,1059,1072,1086,1100,1113,1127,1141,

1155,1169,1183,1197,1212,1226,1240,1255,1270,1284,

1299,1314,1329,1344,1359,1374,1390,1405,1420,1436,

1451,1467,1482,1498,1514,1529,1545,1561,1577,1593,

1609,1625,1641,1657,1674,1690,1706,1722,1739,1755,

1771,1788,1804,1821,1837,1854,1870,1887,1903,1920,

1937,1953,1970,1987,2003,2020,2036,2053,2070,2086,

2103,2120,2136,2153,2169,2186,2203,2219,2236,2252,

2269,2285,2302,2318,2334,2351,2367,2383,2400,2416,

2432,2448,2464,2481,2497,2513,2529,2544,2560,2576,

2592,2607,2623,2639,2654,2670,2685,2700,2716,2731,

2746,2761,2776,2791,2806,2820,2835,2850,2864,2879,

2893,2907,2921,2935,2949,2963,2977,2991,3005,3018,

3031,3045,3058,3071,3084,3097,3110,3123,3135,3148,

3160,3172,3184,3196,3208,3220,3232,3243,3255,3266,

3277,3288,3299,3310,3321,3331,3342,3352,3362,3372,

3382,3392,3402,3411,3421,3430,3439,3448,3457,3465,

3474,3482,3490,3498,3506,3514,3522,3529,3537,3544,

3551,3558,3564,3571,3577,3584,3590,3596,3602,3607,

3613,3618,3623,3628,3633,3638,3642,3647,3651,3655,

3659,3662,3666,3669,3673,3676,3679,3681,3684,3686,

3689,3691,3693,3694,3696,3697,3699,3700,3700,3701,

3702,3702,3702,3702,3702,3702,3702,3701,3700,3699,

3698,3697,3696,3694,3692,3690,3688,3686,3684,3681,

3678,3675,3672,3669,3665,3662,3658,3654,3650,3646,

3642,3637,3632,3627,3622,3617,3612,3606,3601,3595,

3589,3583,3576,3570,3563,3557,3550,3543,3535,3528,

3521,3513,3505,3497,3489

};

unsigned short node=sizeof(sincode50)/sizeof(unsigned short);

unsigned short data[3000];

unsigned short data1[10];

int main()

{

int fd;

int val=-1,i=0;

unsigned short *pt=NULL;

if( (fd=open(DEVICE_DRAM,O_RDWR)) < 0 )

{

perror("can not open device");

exit(1);

}

printf("open device success!DA point is %d/n",node);

for(i=0;i<3000;i++) data[i]=0;

pt=data;

for(i=0;i

*pt++=sincode60[i];

*pt++=sincode50[i];

*pt++=sincode40[i];

}

write(fd,data,3*node);

while(1)

{

printf("0:quit,1:half,2:full,3:write,4:read/n");

scanf("%d",&val);

if(val==1)

ioctl(fd,1,0);

else if(val==2)

ioctl(fd,2,0);

else if(val==3)

write(fd,data,3*node);

else if(val==4)

read(fd,data1,3);

else if(val==0)

{

close(fd);

exit(1);

}

}

}

重新生成JFFS2文件系統,下載到板子中

root@WK:ls

aImage20008000? dram_test?????? mnt???????????? tmp

aImage_old????? etc???????????? proc??????????? usr

bin???????????? example???????? root??????????? var

boot??????????? home??????????? sbin

dev???????????? lib???????????? sys

root@WK:insmod dram_driver

root@WK:lsmod

dram_driver 6401 0 - Live 0xbf000000

root@WK:mknod /dev/dram_driver c 221 1

root@WK:./dram_test

open device success!DA point is 625

0:quit,1:half,2:full,3:write,4:read

成功輸出了三相正玄波信號!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/532252.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/532252.shtml
英文地址,請注明出處:http://en.pswp.cn/news/532252.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

spring和mybatis結合做簡單的增刪查改系統_springbootamp;amp;vue簡單的景點信息管理系統...

springboot&&vue簡單的景點信息管理系統這兩天閑著沒有什么事&#xff0c;就根據陳哥的教程&#xff0c;試著寫了一個springboot和vue的簡單的景點信息管理系統。也就大致實現了最基本的增刪查改。先看看效果圖吧&#xff1a;1、登陸界面&#xff1a; 2、注冊界面&…

linux 內核 丟棄分片包,LINUX內核關于IP分片重組問題請教

最近研究學習IP分片重組&#xff0c;也拜讀了不少dx的閱讀理解。可還是有疑問&#xff0c;請教xdm。源代碼&#xff1a;linux-2.4.26\linux-2.4.26\net\ipv4\ip_fragment.cIP分片的重組大概經過以下幾個函數:0/ ip_defrag1/ ip_find-->ip_frag_create-->ip_frag_intern2/…

spark算子_十、Spark之詳解Action類算子

常用Action類算子列表reduce(func): 通過func函數來對RDD中所有元素進行聚合運算&#xff0c;先運算分區內數據&#xff0c;再運算分區間數據。scala> val rdd1 sc.makeRDD(1 to 100)rdd1: org.apache.spark.rdd.RDD[Int] ParallelCollectionRDD[4] at makeRDD at :24# 對…

linux 庫函數 劫持,Linux hook技術之-Ring3下動態鏈接庫.so函數劫持

劫持普通函數當然沒有什么意思了&#xff01;我們要劫持的是系統函數&#xff01;我們知道&#xff0c;Unix操作系統中對于GCC而言&#xff0c;默認情況下&#xff0c;所編譯的程序中對標準C函數(fopen、printf、execv家族等等函數)的鏈接&#xff0c;都是通過動態鏈接方式來鏈…

await原理 js_「速圍」Node.js V14.3.0 發布支持頂級 Await 和 REPL 增強功能

本周&#xff0c;Nodejs v14.3.0 發布。這個版本包括添加頂級 Await、REPL 增強等功能。REPL 增強通過自動補全改進對 REPL 的預覽支持&#xff0c;例如&#xff0c;下圖中當輸入 process.ver 之后&#xff0c;不需要輸入剩下的實際內容&#xff0c;它幫我們生成了自動補全的輸…

在linux安裝requests庫命令,在Linux--Ubuntu18.04環境下安裝requests庫

之前在服務器上裝過requests庫&#xff0c;但是記憶中花了好大的力氣才成功&#xff0c;現在因為一次意外&#xff0c;服務器重裝系統&#xff0c;現在這些亂七八糟的庫又要重裝一遍&#xff0c;與上次不同的是&#xff0c;這次我裝一遍就成功了。現在分享一下成功的經歷。Pyth…

linux輸入ls后不顯示_零基礎學習之Linux基礎命令小結

安裝完重啟后&#xff0c;沒有像sery所說在圖形界面崩潰了&#xff0c;由于我沒有安裝X-WINDOWS而是直接進入了文本界面。如果你想做linux管理的話&#xff0c;最好在文本界面下工作&#xff0c;這樣會適應如下圖:第一行顯示的是我們所安裝的linux是Red Hat 企業4第二行顯示的是…

redhat enterprise linux 哪個版本好,Red Hat Enterprise Linux 版本顯示中(Santiago)是啥意思?...

樓主的邏輯還有問題。1、linux跟windows都是一種操作系統&#xff0c;但是它用的分區格式是ext3的&#xff0c;ntfs和fat都不合適。安裝過程中你可以自己選擇刪除現有分區創建新分區&#xff0c;但如果你不了解&#xff0c;很可能把所有的分區都清了。2、redhat分區多大合適看你…

.gitignore文件_【第1739期】為Git倉庫里的.idea文件夾正名

前言.idea該不該提交到代碼倉庫中呢&#xff1f;你的意見呢&#xff1f;今日早讀文章由《Flask Web開發》作者李輝分享。正文從這開始&#xff5e;&#xff5e;在網絡上&#xff0c;我曾多次看到人們對于Git倉庫中的.idea文件夾的偏見。最近的一次是在某個博客中技術專家對于志…

監控linux時間不對,shell 計算故障時間 配合web監控

#!/bin/bash#checkfail.log 為SHELL監控網站時間存放的日志文件 https://blog.51cto.com/junhai/2437965fail_time(){starttimetail -n 1000 checkfail.log |grep "$url"|grep "第1次"|tail -n 3|head -n 1|awk {print $1, $2} #取網站掛掉的時間endtimet…

linux redis清空數據恢復,Redis數據恢復--誤刪數據后一次嚇尿的經歷

1、起因&#xff0c;一個flushdb命令因為誤操作&#xff0c;輸入了一個flushdb命令&#xff0c;導到redis里0號庫里的數據全部清空&#xff0c;OMG&#xff0c;這里有不少重要信息&#xff0c;如果被領導知道&#xff0c;必開除2、appendonly留有生機仔細想想&#xff0c;當時數…

c語言 枚舉類型 uint32_淺談C語言枚舉類型 | 附自創用法分享

經濟學家說過&#xff0c;路邊是不會有100元的&#xff1b;但如果有&#xff0c;你還是要撿起來。同理&#xff0c;在貌似萬物免費的網絡時代&#xff0c;你是很難找到有針對性的好資料&#xff1b;但是如果有&#xff0c;希望你能認真學習吸收。比如筆者今天寫的這一篇一今天這…

linux在bin下加入ssh,移植?ssh?到開發板

2》編譯/home/arm下新建目錄sshwork&#xff0c;并且將源碼復制到該目錄下mkdir /home/arm/sshworkcp zlib-1.2.3.tar.gz openssl-0.9.8d.tar.gz openssh-4.6p1.tar.gz/home/arm/sshwork/home/arm/sshwork下新建目錄lib&#xff0c;用來保存生成的庫文件。mkdir /home/arm/sshw…

java pdf增刪改查_如何利用Java代碼操作索引庫?

今天是劉小愛自學Java的第161天。感謝你的觀看&#xff0c;謝謝你。學習計劃安排如下&#xff1a;學了幾天的Elasticserch&#xff0c;但都是它本身的知識點&#xff0c;如何通過Java語言去操作它呢&#xff1f;這就好比以前學數據庫&#xff0c;在數據庫工具中通過sql語句也能…

linux shell 第幾行,Linux shell 獲得字符串所在行數及位置

shell 獲得字符串所在行數及位置01 獲取字符串所在的行數方式一&#xff1a;用grep -n[rootroot]# cat testapplebitcreatedelectexeflowgood[rootroot]# cat test | grep -n exe5:exe[rootroot]# cat test | grep -n exe | awk -F ":" {print $1}5方式二&#xff1a…

sublime text3 怎么配置、運行python_SublimeText3按ctrl+b執行python無反應

最后更新時間&#xff1a;2017-09-14 現象&#xff1a; 在Sublime中打開.py文件&#xff0c;按”ctrlb”執行時無反應。點擊工具->編譯系統中已經有且識別到Python&#xff0c;但執行”run&#xff08;ctrlshiftb&#xff09;”時無反應&#xff0c;Sublime左下角提示”No B…

linux 火鍋平臺,“定制版火鍋”來襲,持續創新才能永葆活力

原標題&#xff1a;“定制版火鍋”來襲&#xff0c;持續創新才能永葆活力5月1日&#xff0c;重慶涪陵紅酒小鎮的一家轉轉火鍋店&#xff0c;推出“五一”定制版火鍋免費請游客品嘗。廣西的螺螄粉、貴州的折耳根、湖南臭豆腐、福建烏龍茶、重慶榨菜、河南胡辣湯、陜西老陳醋、海…

internetreadfile讀取數據長度為0_YOLOV3的TensorFlow2.0實現,支持在自己的數據集上訓練...

GitHub鏈接&#xff1a;calmisential/YOLOv3_TensorFlow2?github.com我主要參考了yolov3的一個keras實現版本&#xff1a;qqwweee/keras-yolo3?github.com目前支持在PASCAL VOC 2012數據集上訓練和自定義數據集上訓練&#xff0c;具體的訓練過程可參考項目倉庫中的README文檔…

c語言用鏈表對學生成績排序,學生成績排序和平均分計算利用c語言鏈表的創建插入刪除.doc...

#define NULL 0#define LEN sizeof(struct student)struct student{long num;float score;struct student *next;};int n;struct student *creat(void)//創建鏈表{struct student *head;struct student *p1,*p2;n0;p1p2(struct student*)malloc(LEN);scanf("%ld,%f",…

深井軟巖巷道群支護技術與應用_深井軟巖巷道深淺孔帷幕注漿技術

一、成果內容1.基本原理對失修巷道進行刷擴、支護&#xff0c;滿足使用斷面后進行幫頂噴漿、底板整平&#xff0c;先底板注漿&#xff0c;然后幫、頂注漿。錨架充支護巷道直接底板整平后&#xff0c;先底板后幫、頂注漿。通過全斷面深淺孔聯合注水泥漿進行巷道加固&#xff0c;…