OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10101|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - q( M1 U5 L% M7 `/ K4 Y
  1. [code]EDMA sample test application
    % |! y  l3 V* ^0 p$ z
  2. /*
    7 l- q9 F! H% M* {; _. o
  3. * edma_test.c
    ) L# y* n4 [$ }% I7 H! R: [$ F% o
  4. *
    ) h+ {1 s8 t; X8 y
  5. * brief  EDMA3 Test Application0 ]* n8 q; Y2 e' w6 m: g# E
  6. *
    1 y9 C2 {4 W4 Y0 u4 O2 W6 w. e
  7. *   This file contains EDMA3 Test code.
    # p+ O  v1 y: N
  8. *
    ' y9 j( z" k' T7 y0 p, \' Q. M" \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " d  s3 }; B% u1 R) L: b8 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ N; Y" V( K, @3 b2 _7 [: u
  11. *         TO CHANGE.  |9 l/ I- b8 W: C7 }+ s4 c  c
  12. *
    8 i& g3 e8 n; b6 F% F0 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; W, r' ~6 T; `: V* n
  14. *
    / H, W2 X- x; L: [( F7 f, i
  15. * This program is free software; you can redistribute it and/or( S3 Z7 N+ e# o, m, g
  16. * modify it under the terms of the GNU General Public License as" ~" l8 e- O* W  b9 {& U
  17. * published by the Free Software Foundation version 2.: n! Y# g7 J% _
  18. *+ g1 s& s6 ^0 O$ c  _0 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }1 P7 T+ L7 p  R$ E) P
  20. * kind, whether express or implied; without even the implied warranty
    3 V8 I  \" S, n6 w8 y) p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* h2 u1 M" C  L; R% t8 K
  22. * GNU General Public License for more details.
    7 ?) a' O: R& d# X1 p( n1 n
  23. */
    5 c' e: H( s8 c8 d% q* j  {6 @6 C

  24. , E" _$ f" t+ `7 U% G* O
  25. #include <linux/module.h># m+ w1 l' A; _2 _2 z
  26. #include <linux/init.h>
    + a! G/ g0 h& B" J2 R5 \# w7 l1 ]. \
  27. #include <linux/errno.h>0 \9 g* n$ N. `" P- j/ G
  28. #include <linux/types.h>
      q6 p) u6 D6 E$ X' n/ b# b
  29. #include <linux/interrupt.h>* |/ d; f, W- ]. b  l/ Q
  30. #include <asm/io.h>6 r* D2 A/ D+ @5 r
  31. #include <linux/moduleparam.h>; j0 _9 ]1 Z' P, Q2 A- b
  32. #include <linux/sysctl.h>- M( Z( w8 ]; u( J& Q, j; Q5 o0 M
  33. #include <linux/mm.h>
    % V  N$ f7 f3 V7 T( K
  34. #include <linux/dma-mapping.h>* F2 w  ?$ d' ^5 D) U( l1 d1 F$ N( G

  35. 9 f+ ^' p( Q+ r) M! C
  36. #include <mach/memory.h>1 o7 e) p& w( Q6 F" U
  37. #include <mach/hardware.h>6 }5 S! `7 R: t
  38. #include <mach/irqs.h>/ k& o$ C; I: v/ G
  39. #include <asm/hardware/edma.h>1 n0 \0 A6 u% }# D% Y/ I

  40. 4 Y6 l2 O) l! n; i
  41. #undef EDMA3_DEBUG
    ( V1 {% r% [' l' V$ i; b5 t1 C
  42. /*#define EDMA3_DEBUG*/
    . g% p, E: y2 O3 H

  43. , \" S9 Q- c% C/ c# c
  44. #ifdef EDMA3_DEBUG
    3 m+ `: F& c+ Y& T* K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 ?$ v& B2 [* ?2 ?9 f# W' }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 \% R0 @9 o- W' }' h$ Y9 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # ^3 N5 e' F1 |# I7 Z
  48. #else
    " x& ?4 B4 h, n( n# r9 y: I9 }4 i
  49. #define DMA_PRINTK( x... )& w, b# b4 q9 m3 o2 C4 \6 \5 l! h) |8 q
  50. #define DMA_FN_IN
    % Y, o: S/ _( c9 D8 q
  51. #define DMA_FN_OUT$ H5 M) X6 [3 P
  52. #endif
    ! f0 g# }9 c% J  I

  53. ) w' P' m) K# [4 b- L1 P/ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ G7 R5 [* G, C! @5 T
  55. #define STATIC_SHIFT                3
    # U9 Y: h0 J. c! A5 M0 L
  56. #define TCINTEN_SHIFT               20
    . q9 R# a- c) A" ~9 i1 R
  57. #define ITCINTEN_SHIFT              21; |$ k, g4 K5 u5 `* J0 f5 Q& c
  58. #define TCCHEN_SHIFT                22* n$ g7 h2 N. d% ~
  59. #define ITCCHEN_SHIFT               23
    3 y# ~$ |% T: q. D0 w
  60. 8 G- E$ k7 w. C, h9 R
  61. static volatile int irqraised1 = 0;
    6 [" l! `/ J' j( `# t" E
  62. static volatile int irqraised2 = 0;+ w. n+ [+ y5 x& w4 y: B! j
  63. + N* m* \. y0 a+ n$ m2 w! ?' h! s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) f' |" n( H$ G, I& U' d/ y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & S. A+ V  H: s2 a$ ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 `4 Q9 H# N1 W2 C% \4 O$ Y8 a

  67. 1 @6 K. Q+ J/ Q! e6 B# }  n- t; |
  68. dma_addr_t dmaphyssrc1 = 0;' K1 f) c) G7 N: i- D( d
  69. dma_addr_t dmaphyssrc2 = 0;
    $ [( t5 n- a& J& @; ^# Y3 X
  70. dma_addr_t dmaphysdest1 = 0;6 ?- J8 a) N* A
  71. dma_addr_t dmaphysdest2 = 0;
    + `$ a, C' a4 Z0 d& L# I' x

  72. ' C# W( F- P- x; ^# U
  73. char *dmabufsrc1 = NULL;
    1 U( Q# z; n# y/ g6 W3 S
  74. char *dmabufsrc2 = NULL;( e( [0 T! K2 P* k: j8 A* t
  75. char *dmabufdest1 = NULL;
      P5 F( ]& O- L# X* m3 Y! z3 D" F- J
  76. char *dmabufdest2 = NULL;
    & C3 x) W: F" H; O/ |& R. d( Y/ c

  77. $ U  J  N+ L- _* w2 i
  78. static int acnt = 512;
    % r9 c( D) R0 n/ h6 d+ @
  79. static int bcnt = 8;
    8 d/ [, ]0 ?6 C
  80. static int ccnt = 8;
    7 d8 H0 n+ |3 m( R" t3 w

  81. ( o; \9 u5 K2 |' b' Y& d/ ^
  82. module_param(acnt, int, S_IRUGO);
    & `+ v4 G5 t6 }, }5 Q1 `
  83. module_param(bcnt, int, S_IRUGO);
    4 |; r% c! n" m6 \& @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) P1 d+ {, }9 |( Y/ h3 h3 o
9 U; M% I9 v# \9 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {" m5 ^) x" q% t7 _% Z
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 C* f6 I) M! d, z! F: ^- H4 J; T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" X8 |* S* @. h9 f
/ j# r( o- r- m' F; M/ w
& w# v- _3 D& V" n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-16 09:19 , Processed in 0.046409 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表