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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & {, l- x/ c. g' g
  1. [code]EDMA sample test application$ s. s+ ~3 Q; t- |8 E
  2. /*+ v0 z* C3 y9 Y% h4 T8 c+ ^
  3. * edma_test.c
    ( N' K0 G8 A6 B5 ]( e/ j$ ?
  4. *
    + @% u# n4 }; D* o* c* g
  5. * brief  EDMA3 Test Application* Y' s: g. A4 k; e9 A
  6. *+ P" ?! h9 i2 a7 j* U6 D# s
  7. *   This file contains EDMA3 Test code.
    % B7 Z& c9 v# o4 ?0 Q
  8. *
    ! k$ @% {& Z( r( E# k! a1 f9 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 R- j4 G: {/ r9 P. L# H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / _  L/ X) b7 I0 a+ ^
  11. *         TO CHANGE.
    ( ]; ]7 p/ J& z% d
  12. *& b, o0 m; y( V; ]' p5 Q+ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ], r7 P# ?; w# E
  14. *( R- l1 \& ?  G$ w* p% `3 p) k8 g" a
  15. * This program is free software; you can redistribute it and/or, z  P0 ^0 _9 c
  16. * modify it under the terms of the GNU General Public License as
    5 o% f* `# a) b
  17. * published by the Free Software Foundation version 2.
    1 k2 X# G7 ?: }7 H- ?
  18. *
    $ a9 i' U2 k" B$ z. x( m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # a$ p3 u$ E1 m# Y
  20. * kind, whether express or implied; without even the implied warranty% _$ }' ]: n+ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : U' ~% i7 H8 |6 i. r
  22. * GNU General Public License for more details.2 G4 R7 B9 |; x
  23. */' d, s8 O, o+ B2 a

  24. & R& U' X& u- y- c- r1 F/ \( K
  25. #include <linux/module.h>2 M) N" J/ k5 |: I5 j3 T& @/ k
  26. #include <linux/init.h>
    . z* R" d; k/ ~& J0 R
  27. #include <linux/errno.h>
    , u- d  A. S, K" ~# a% Q4 k
  28. #include <linux/types.h>5 S# P4 W+ M/ I8 |
  29. #include <linux/interrupt.h>
    / p4 G  v* `, y6 p
  30. #include <asm/io.h>
    & I- f, o/ G- e( a
  31. #include <linux/moduleparam.h>1 V  X& k1 e* d
  32. #include <linux/sysctl.h>
    1 Q+ Q# ?  \4 W* a
  33. #include <linux/mm.h>
    3 {; s5 S3 U9 ~4 E
  34. #include <linux/dma-mapping.h>' H- {8 I  s# F  r" m" C

  35. 0 L* K- R' r/ v5 K' n
  36. #include <mach/memory.h>! n5 D/ ~: C: Q3 Q
  37. #include <mach/hardware.h>/ s+ \' ]: f, ]
  38. #include <mach/irqs.h>; c  m8 ~2 I3 G* w! @/ T. C
  39. #include <asm/hardware/edma.h>3 _; L6 f- E+ m) j1 |/ Y* c

  40. % K! I9 \$ N9 @; j' s( Q) i5 g
  41. #undef EDMA3_DEBUG3 `/ C0 Z5 ~9 g! T
  42. /*#define EDMA3_DEBUG*/% w  E3 k1 @3 R. v/ q

  43. 6 T! U  b. X8 \& [/ P' E
  44. #ifdef EDMA3_DEBUG8 t- W2 u% Q5 r+ P& e$ p  B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* M$ X# O3 ?; m) _* k" R/ c* E" u7 q' u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! T% e3 r$ {. |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 B  k6 [  I9 y/ N6 ^3 `" n
  48. #else
    / X* {5 ~7 F( X
  49. #define DMA_PRINTK( x... )
    2 L; j, d5 |6 u1 A' x
  50. #define DMA_FN_IN
    3 l: W& [. K, T( d3 U% d
  51. #define DMA_FN_OUT9 f  I- u% s0 B
  52. #endif# _* X9 _' n8 d! F3 q, r' n: ^

  53. - N6 c& O- F2 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 T$ ^  W, f& B' H
  55. #define STATIC_SHIFT                3
    1 n5 |8 B1 P6 P* B$ U" e
  56. #define TCINTEN_SHIFT               20
    2 X" k% [- x8 M% F9 `4 M
  57. #define ITCINTEN_SHIFT              212 ]/ b" r5 Z7 @5 ^
  58. #define TCCHEN_SHIFT                22* m/ H3 ^1 H' p5 N, j
  59. #define ITCCHEN_SHIFT               23
    7 ]$ A+ ?" Y* G9 ?! n! d

  60. " \( u$ {$ n5 x6 X( Y
  61. static volatile int irqraised1 = 0;5 E# H1 U" C' I6 w" |: w" j3 M
  62. static volatile int irqraised2 = 0;/ e% }% j3 u% r" k, A$ e

  63. 4 u# P/ x- `+ Y- l( ?8 v& A6 q/ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      T% ^1 N. \" X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p7 |! i+ H& w/ D. u! W8 J* w$ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; l, Z+ y7 M+ h7 J' O+ s

  67. / [# @5 V1 o! A. _7 Q# J
  68. dma_addr_t dmaphyssrc1 = 0;
    ' \% z7 u4 M( g, C. d! c* a
  69. dma_addr_t dmaphyssrc2 = 0;  E! B$ u& T  _2 F1 ^5 k/ d9 z, X
  70. dma_addr_t dmaphysdest1 = 0;
    $ \1 L4 u- U3 W# }( F
  71. dma_addr_t dmaphysdest2 = 0;8 O0 e% e% r; K1 B

  72. + o3 p1 y( S. Y* X4 ?& L
  73. char *dmabufsrc1 = NULL;2 s" T& L) z' v
  74. char *dmabufsrc2 = NULL;, y" W9 B0 y. s1 a1 z% c3 Y
  75. char *dmabufdest1 = NULL;
    ( ^9 k7 o* Q4 n' f6 i: R$ ^
  76. char *dmabufdest2 = NULL;
    ' H' H* C: r# |: f2 c. q0 |

  77. " B( y; T4 A* [6 Y
  78. static int acnt = 512;! W: i) f5 y  E8 U) D2 S
  79. static int bcnt = 8;/ P* P4 ~5 X; y9 s9 ^) h  Q1 r
  80. static int ccnt = 8;) q5 {7 {6 _5 H, B* x0 g8 `
  81. ; u0 K( `' K9 s: O3 y% l0 l
  82. module_param(acnt, int, S_IRUGO);5 l7 s9 M2 E* v; Y/ d4 m6 o
  83. module_param(bcnt, int, S_IRUGO);
    : {9 f5 c0 R5 E. Q9 f* f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& M  e2 c' w' B* L
! {; F  d6 n( p: {. a9 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Y) |6 J( F( `2 _* r( P- iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# l1 |, ]! o6 N; `5 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& u; K9 b0 [( z* J( T

* u9 w# V2 X& Q! X; Z! }- _, @6 q/ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 17:32 , Processed in 0.040813 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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