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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ]5 I: p5 k7 Y' r
  1. [code]EDMA sample test application
    * f" p) H% S5 w/ h7 |: G) f- Y
  2. /*, d* ?: y! k. C  }" V
  3. * edma_test.c4 R$ W0 O/ c; j0 M4 S4 k
  4. *
    / ^1 L2 q0 ]6 E, w: L6 x5 S2 T
  5. * brief  EDMA3 Test Application
    % C8 [' A/ N7 g, g6 D7 ]2 w
  6. *
    ! n) s3 D2 y8 Q6 g  e+ Q* J# P
  7. *   This file contains EDMA3 Test code.( b3 q$ Y+ V, E
  8. *, u0 e, ?( h( j( [1 v8 c  s& `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 `6 Z+ p8 v  y% c! N! x* K% k* C1 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 k! ~. I% z3 S! [9 P7 ^+ R
  11. *         TO CHANGE.
    ! G4 r& C: [' u
  12. *3 l! P3 P5 R' d/ i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! e) @1 H, y2 i* O4 q
  14. *& @$ F$ v4 m- e2 p8 e+ H
  15. * This program is free software; you can redistribute it and/or
    2 e# L3 E2 O, ^2 n: l) W
  16. * modify it under the terms of the GNU General Public License as+ v3 O7 E( \% K5 u. X2 ]+ m% S" W0 @
  17. * published by the Free Software Foundation version 2.- a! \9 e$ d: C2 B- U
  18. *" t9 @  q5 G  J; S! X, G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) V' ~, W. H0 l6 S3 O6 ~! u
  20. * kind, whether express or implied; without even the implied warranty: G5 ^" {( ?1 {4 q/ \) Q/ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 [4 ?8 H: ~& J5 g# G
  22. * GNU General Public License for more details./ t/ d: g. t/ N" `( U2 {
  23. */% V5 n$ H8 w) e

  24. 5 R& ?. x# G" p5 Z
  25. #include <linux/module.h>! T# p* Z0 ^' j: Z9 i
  26. #include <linux/init.h>1 s4 G) U% |+ Y' v1 [
  27. #include <linux/errno.h>& M% Z3 ]+ @- ~% F1 Z0 G' x* L% ~
  28. #include <linux/types.h>
    2 C" W8 @/ q" B1 O) t1 \; b
  29. #include <linux/interrupt.h>" `# ~) f. z2 I, [* w$ v/ D6 V
  30. #include <asm/io.h># g% |/ U* o; ]6 n
  31. #include <linux/moduleparam.h>" U9 |, X6 D7 Q; M. n
  32. #include <linux/sysctl.h>
    % L3 G( c$ y% _' G
  33. #include <linux/mm.h>
    : W; ], W, I" g& B0 w
  34. #include <linux/dma-mapping.h>
    * k/ U. ?& y0 K3 Z% r2 W( H5 _- O- i

  35. - p. Q& C% A" O* O
  36. #include <mach/memory.h>
    " e$ O2 \5 J0 t2 l9 K# `
  37. #include <mach/hardware.h>
    - ]2 L! F* z+ A' W. y$ S5 X4 v
  38. #include <mach/irqs.h>
    # b& i, Y% U- N9 Q1 v) D# ]
  39. #include <asm/hardware/edma.h>
    / i& [+ m% r& F) T6 @

  40. . x. U5 y2 b7 y! u3 k" q
  41. #undef EDMA3_DEBUG
    + X4 I$ s5 F. R0 \8 r# w9 A
  42. /*#define EDMA3_DEBUG*/0 ]; K& E  M: C* c
  43. 1 [  E) Z& n- I$ g
  44. #ifdef EDMA3_DEBUG2 ~  ?6 t6 X( g9 b) H) i. `: V0 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ }, ?8 X0 r" N  d# U1 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! S9 L, ]) K7 T1 A5 Y- h) N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); P0 |. P/ p4 q! M( w. v
  48. #else5 L9 \& s3 }  ]6 H
  49. #define DMA_PRINTK( x... )' k  ~( J7 R4 |: e# Q0 a& L2 L
  50. #define DMA_FN_IN
    3 K% V, l6 D( ^. T+ z! p3 L) u/ ^
  51. #define DMA_FN_OUT7 G, Y- @4 P4 E( Y0 w0 [! x; D
  52. #endif
    " v3 |3 H8 Q) v- c" M
  53. ) ~; a+ w- A! T1 H' l4 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), J$ Q0 R( j; ?/ s  y1 P
  55. #define STATIC_SHIFT                3; y9 Y2 _& D4 H+ j
  56. #define TCINTEN_SHIFT               20
    2 V' r4 U$ S* h( i! W" s
  57. #define ITCINTEN_SHIFT              21, B4 |2 s) d' R6 t
  58. #define TCCHEN_SHIFT                22
    3 R; d& l6 f0 e! z3 B
  59. #define ITCCHEN_SHIFT               23
    ! x* U8 p" W; F- r9 t0 X

  60. / [1 Q' h) S6 R- H0 |
  61. static volatile int irqraised1 = 0;
    4 V0 T3 N# ^1 ?
  62. static volatile int irqraised2 = 0;0 ?, T. t( m' P; r" Z" y9 m

  63. ! C0 S$ A; ^, @" l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x4 v4 _1 Q8 g# b/ I0 S) @! L8 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : w0 d5 `; S; ?4 u( g+ J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t7 o8 M, R0 j$ u: w

  67. % m: ^, i$ y3 H1 x7 G- W8 H( |
  68. dma_addr_t dmaphyssrc1 = 0;
    ( \& V, x: L0 `  s+ @2 {. g
  69. dma_addr_t dmaphyssrc2 = 0;
    , }' ]5 b/ n$ |* e  ?# D
  70. dma_addr_t dmaphysdest1 = 0;
    2 i* U! T5 `8 y' s( S: p+ }
  71. dma_addr_t dmaphysdest2 = 0;
    4 j5 w5 m8 U: d/ Q( |% o3 _% J2 H5 [
  72. " c$ b) P# `4 X+ ^7 K6 H7 ^
  73. char *dmabufsrc1 = NULL;$ X3 p, P1 O9 H* i
  74. char *dmabufsrc2 = NULL;
    & \+ b1 B/ g0 U; I) o$ J4 @4 d7 }
  75. char *dmabufdest1 = NULL;" B$ T1 A# V- Q( `, a! V" R
  76. char *dmabufdest2 = NULL;3 L& P! e/ ~% C% x1 x! ~8 ~
  77. + X( e6 |4 T/ w- x6 R' C3 M  c# F
  78. static int acnt = 512;' d1 Z2 F7 a6 z! y4 L; F$ z2 Q
  79. static int bcnt = 8;
    , [9 t) j( E) f
  80. static int ccnt = 8;
    2 p; H  H: Q( C8 S
  81. ; g; p7 Z4 }& E
  82. module_param(acnt, int, S_IRUGO);
    9 t, g/ P) s, [3 m* N
  83. module_param(bcnt, int, S_IRUGO);
    ( j0 G6 J* h1 n3 Y- H: f3 m& ]9 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 i; J1 e! y0 e8 i8 Y2 T# T  u: q; R6 P3 g+ r" s, \5 ^# E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 j# u( U- X( N. O- H- v4 I- p& varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: J5 A, t; K3 }% Y' D: U6 |/ Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- e, F# I9 C( I7 v- ^0 ?
. n; R9 D$ ^) P& Y8 e! a: C3 k
6 c1 p5 R5 c' R. J! n. K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 07:24 , Processed in 0.041286 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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