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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" t* p: x/ g2 i+ y
  1. [code]EDMA sample test application
    # |5 S6 e$ r7 m; T
  2. /*# V3 \$ `5 Q$ {- F, R2 H
  3. * edma_test.c
    9 n% c& I% A& s& g; V! H: R, a
  4. *4 B7 S! `6 D% ^
  5. * brief  EDMA3 Test Application2 V& B! h6 Y$ V+ Z6 D3 O/ |
  6. */ z+ u1 v7 a; B9 j( b# l; t6 R
  7. *   This file contains EDMA3 Test code.; d/ i' d# h# V+ m
  8. *
    / G, Z# ~) z, e0 Z) m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! }( \# R9 d, t6 J8 ~2 e( y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % P+ q/ G6 H% z' D8 |2 w! I% k# n
  11. *         TO CHANGE.
    2 V' a/ k) \) A) |, c  V- j, F' Z
  12. *
    0 S) V6 o6 Y; l; o+ a+ b! B. ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: E2 m4 y! X% K1 h
  14. *
    ( L+ Y( L2 d# B2 u8 I( R
  15. * This program is free software; you can redistribute it and/or
    " m1 h( v$ a, O  T9 h% a1 Y
  16. * modify it under the terms of the GNU General Public License as0 ^* i! p8 m/ S3 k$ E
  17. * published by the Free Software Foundation version 2.
      c- e) L2 }, ^8 Y6 e0 |
  18. *$ U# R  l) Q$ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , [& f6 l: D% L! i
  20. * kind, whether express or implied; without even the implied warranty
    % K+ t. N& @1 ~, b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 l# x7 N+ a/ p; a
  22. * GNU General Public License for more details./ @+ T" W* ]  b2 x7 H1 w: D
  23. */8 J/ i3 y: h7 G+ }' O+ r: V

  24. 8 n# b7 M; U: i5 ^9 p. w4 @0 ^
  25. #include <linux/module.h>' N# k* s. S# o
  26. #include <linux/init.h>
    / r( c$ b! E5 S2 a3 M( p& M
  27. #include <linux/errno.h>
    # ]. ?8 c6 Z' K6 X) d& d1 D
  28. #include <linux/types.h>6 A! m5 E. g  t+ Y- q0 Q
  29. #include <linux/interrupt.h>$ v: g8 w0 q; a- S
  30. #include <asm/io.h>5 ^' l6 K  y' u, r/ L# ?- u! ]' C; b* ]
  31. #include <linux/moduleparam.h>
    $ q$ |4 a. W, b$ O4 Z/ I2 `
  32. #include <linux/sysctl.h>% N8 S5 [% d4 v* R' n
  33. #include <linux/mm.h>
    & e! _0 ^. ^5 g8 B! H2 I# Q$ n. c
  34. #include <linux/dma-mapping.h>
    1 B2 F( q& N- I' e2 G

  35. ) [2 ]  q, @/ N' ?# L( k3 S
  36. #include <mach/memory.h>4 H' L! [8 r7 z8 F+ P7 N
  37. #include <mach/hardware.h>
    9 @% F+ ?2 v1 R% R. L
  38. #include <mach/irqs.h>, S4 u0 K1 w- [5 M: W0 c: B' H
  39. #include <asm/hardware/edma.h>  U$ b: B( R9 r+ s" d
  40. , w* i, d. E$ o7 y4 _
  41. #undef EDMA3_DEBUG
    " X* t2 }- y+ t9 R; [( Y% T4 b& K
  42. /*#define EDMA3_DEBUG*/" m2 S' e2 }8 w9 ?
  43. ( j, ~7 @- H0 T3 J  o! k6 O/ F
  44. #ifdef EDMA3_DEBUG
    ! ]! H, c3 v# E7 Q, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ n' B9 ^9 T* ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; I. G1 U/ p6 Y& M- R, c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 g: Y# E* r0 G0 w
  48. #else+ [% f7 p: ^+ i+ H" q  a
  49. #define DMA_PRINTK( x... )
      S' |, M+ s* }+ E
  50. #define DMA_FN_IN
      T5 t" ^, n! L
  51. #define DMA_FN_OUT
    " \1 F2 s: z" F) y9 c
  52. #endif! w; F* R1 T: i% Z
  53. 0 I, z) T  G; b; n$ }9 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& R% u5 G, n) J& i6 W$ r) M
  55. #define STATIC_SHIFT                37 G; [; E3 {" O; u/ y9 I# Q. W$ H2 L
  56. #define TCINTEN_SHIFT               20$ M0 O8 A$ f( a5 g
  57. #define ITCINTEN_SHIFT              21( t/ O3 o" J4 h: h( ~- U! W4 f
  58. #define TCCHEN_SHIFT                22$ ^' _: D% Y& g0 Y* p& \/ x* p4 s5 p
  59. #define ITCCHEN_SHIFT               23
    0 ~0 T+ d2 a8 V" r0 x
  60. 1 m8 a* g3 F! P. u
  61. static volatile int irqraised1 = 0;
    : S: r& F6 V" {2 V* W; J/ c
  62. static volatile int irqraised2 = 0;0 n5 N3 |2 ?, b# c

  63. 2 _: ]/ i9 Z4 Z, c% B" s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ B, g% L5 u- M  ]1 B" O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?5 i9 g" i1 `& C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) x1 J6 N+ W3 [! u" C
  67. 5 r% H" o' M4 H& N
  68. dma_addr_t dmaphyssrc1 = 0;. D% f+ T5 a" {0 t
  69. dma_addr_t dmaphyssrc2 = 0;& W! E5 K8 o9 E3 ~) ]4 q: V
  70. dma_addr_t dmaphysdest1 = 0;
      M" k: b, R5 G
  71. dma_addr_t dmaphysdest2 = 0;( F* J0 K0 Z3 h4 Y; g

  72. 3 K) I6 x" _) L6 x. F/ C7 [
  73. char *dmabufsrc1 = NULL;2 p6 N" t" C- }, |1 f& {. X( A
  74. char *dmabufsrc2 = NULL;% w* u, _! }& e. f* ?8 E
  75. char *dmabufdest1 = NULL;2 m" n. Y. h( S) i: C$ K
  76. char *dmabufdest2 = NULL;$ }3 g0 U2 E- s: y+ @* n( ^

  77. 6 Z0 t  W! s1 m
  78. static int acnt = 512;! b9 U# t# C& y2 G+ {
  79. static int bcnt = 8;3 ~% V8 x+ X2 }$ i- Q* z: ]0 J
  80. static int ccnt = 8;
    8 p& d; F( H5 K4 c2 M1 [
  81. - b) e. v: k! k* a( I
  82. module_param(acnt, int, S_IRUGO);
    / S6 `+ d( |7 t5 t2 ~. f0 Z% ?% F, v5 K
  83. module_param(bcnt, int, S_IRUGO);2 g; W, |% ?8 |& s5 u% u# X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 ]+ `) U5 r: y" L. {! {1 _% D
) j. ^5 y) g0 T- l- L! a8 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 K( i/ z6 U. k7 k- jarm-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 b( r$ N& L4 b9 B1 w  F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 n! X! X1 t4 H( Z- u
2 l- _9 E0 J) |! b
) O" _; E3 _9 D. P* K. H* y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 09:55 , Processed in 0.038100 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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