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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 w  m: V7 S' l! q0 X
  1. [code]EDMA sample test application
    4 l2 f, G8 A6 a+ K5 x  B
  2. /*4 ^( t4 }# b3 n) r. n# o% x% s
  3. * edma_test.c' v$ G6 W$ n6 T5 a3 H- `0 D' M
  4. *' ]7 G" A/ d5 i# i2 D3 U9 g
  5. * brief  EDMA3 Test Application" e0 {, |" V+ o! N' h1 @- w
  6. *
    + `9 m: ]5 {. \6 Y7 ^1 R. v( d
  7. *   This file contains EDMA3 Test code.$ L' b( b! y: C- S$ j6 t
  8. *
    ! w4 b. V( F3 p( f# [7 T  U5 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ D7 P4 b- Z  c" b! ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * A4 p, a0 D, J  s' ?( }) ?: H' \
  11. *         TO CHANGE.
    * y9 ]6 t) q& F( k( `+ }
  12. *
    1 x, ^9 ]: ?7 x, b. W0 u5 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 F0 ]& n/ c6 q& G4 g& B
  14. *
    : `7 ^; k) f  ~8 x0 O, C
  15. * This program is free software; you can redistribute it and/or. M6 m5 ~2 J* z* |' ]2 t0 e( V
  16. * modify it under the terms of the GNU General Public License as  C& z/ z( T5 N0 u/ J
  17. * published by the Free Software Foundation version 2.& w- _4 Y3 Z" [9 @. j$ a7 T) Q% {
  18. *
    , p2 U% y: Q/ o9 ~  Q5 p4 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - m5 ]! A0 g9 R) a
  20. * kind, whether express or implied; without even the implied warranty
    9 ^, {  l9 f9 M* b% T1 T. _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- ~4 L  f; B' B) f4 ~
  22. * GNU General Public License for more details.4 W. j, o  h5 ]6 O: R1 Z& f
  23. */- F1 p. Y1 |6 ?
  24. % x8 E' ]6 x0 X) y9 R
  25. #include <linux/module.h>
    % r1 ~" o$ C0 ?! V0 _
  26. #include <linux/init.h>3 M' [1 {5 w& ~% T9 P) Q: u
  27. #include <linux/errno.h>
    0 H/ f* q& H! g) p
  28. #include <linux/types.h>
    ( g( a! n8 N$ P2 p! P( F2 i, D
  29. #include <linux/interrupt.h>
    6 x/ t5 T6 L' l' S& v- w
  30. #include <asm/io.h>$ E2 H) ^" D2 }# F7 N$ F
  31. #include <linux/moduleparam.h>' B# B- l( u3 J' B' a1 h' D
  32. #include <linux/sysctl.h>
      w$ x; e2 c: ~
  33. #include <linux/mm.h>5 I2 [0 p  o5 {# P+ F
  34. #include <linux/dma-mapping.h>
    - j. Q5 ?3 E* F4 k: m4 s$ T! I

  35. ) P. v' n# L& Z; J2 I
  36. #include <mach/memory.h>
    + F& y, e, S( l3 D- X, m
  37. #include <mach/hardware.h>! k) k" |/ S6 P0 y% w
  38. #include <mach/irqs.h>! g6 |; t) T2 c3 Q0 L4 J. @! ?) A
  39. #include <asm/hardware/edma.h>
    5 O( z2 M1 x3 J5 ^9 u/ E$ E
  40. 0 A& P3 i5 D# ]
  41. #undef EDMA3_DEBUG
    1 l) A0 x& v/ I6 k2 L. x
  42. /*#define EDMA3_DEBUG*/
    1 H) W& q' P6 G0 N' _

  43. 3 f+ R- d) i  l3 \' r! S5 W% }' Y
  44. #ifdef EDMA3_DEBUG
    . a8 M2 {- o- T+ [0 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ d; @: `2 n% j+ T2 F/ N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 G* W: {2 A# Y9 M9 y" \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), y' n9 j+ n* i  S3 B( b
  48. #else
    ; F* s* i+ i5 `! u/ C
  49. #define DMA_PRINTK( x... )
    1 b$ X( M! U# L' l- `. C
  50. #define DMA_FN_IN% |, S4 P, F9 d7 W6 M$ O/ t
  51. #define DMA_FN_OUT" ]; }( _# C) ?" _. R6 ?
  52. #endif
    % O* q1 y) t/ p( |
  53. " N1 |# i- M* N, ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 B3 s) W& Z) J. n. \- T* L
  55. #define STATIC_SHIFT                3
    ) [2 D& m4 P7 B, d  s2 o7 L
  56. #define TCINTEN_SHIFT               20
    1 o0 s' F" n% q1 s
  57. #define ITCINTEN_SHIFT              21
    * f$ h" Y. G" z- j/ l% |1 N
  58. #define TCCHEN_SHIFT                22' K8 h" M2 D$ {' N6 r4 ^
  59. #define ITCCHEN_SHIFT               23
    4 f" q3 ]% x4 I+ d* Q2 V8 F
  60. 6 m) }+ e3 @5 E7 G3 M6 A
  61. static volatile int irqraised1 = 0;
    4 {: ^' S1 O4 ]0 m! E7 Y) L
  62. static volatile int irqraised2 = 0;& S- u4 E. i1 i

  63. ! [/ Y+ S8 Y# A4 j& ]  M8 T( ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# y1 [9 E+ P; t0 b0 p3 O/ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Q4 J2 x, r- U& T7 z! I  D# q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 S7 c0 U3 ^" X; m
  67. , f' C0 u2 D  r$ |6 E" u
  68. dma_addr_t dmaphyssrc1 = 0;
    $ _/ Y0 f2 b& s# ?
  69. dma_addr_t dmaphyssrc2 = 0;) o# z2 \  a0 S0 f, _1 E
  70. dma_addr_t dmaphysdest1 = 0;* s$ A: R$ ]; l- s
  71. dma_addr_t dmaphysdest2 = 0;! k8 J; m* b1 b
  72. ; p2 h& g+ d5 p; a8 U: a* y
  73. char *dmabufsrc1 = NULL;& B+ z& M* u- B
  74. char *dmabufsrc2 = NULL;- W& S1 `# S' W9 U6 C5 {
  75. char *dmabufdest1 = NULL;, R8 U6 u0 I/ ]* }* n
  76. char *dmabufdest2 = NULL;- S. X  B) j2 B$ O& s  S9 k3 d
  77. 0 Y# \  g: `' W, u0 S# J4 {: q
  78. static int acnt = 512;
    9 ^+ f; c  C0 w% z7 }5 K" W
  79. static int bcnt = 8;
    ) p( R* F; j* |  F# a/ R2 L
  80. static int ccnt = 8;3 e0 a3 L  K6 n/ z2 r; H
  81. 7 ]+ c+ u& v% [  P0 c
  82. module_param(acnt, int, S_IRUGO);6 P2 d* d9 s# a4 X: I
  83. module_param(bcnt, int, S_IRUGO);
    * m$ a7 Y- s1 C8 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( T0 j9 V# \! t2 X( t$ G8 R
: _$ @9 T1 _2 e0 j' l7 l9 n; Y  T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  c0 V2 b4 E1 H5 r! Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 V! L8 Q  T! L$ z; X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 X7 Y' H2 F0 K% l; ?

  v7 j0 c7 v  {; p9 X3 L5 r
) N6 b; X. X- W: n5 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 20:04 , Processed in 0.040541 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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