OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ j. n! S( }4 d% C1 O6 R
  1. [code]EDMA sample test application" Q& ?2 }- f& O7 Q; z) F
  2. /*
    5 e8 \# g8 q, ?" B! [1 e
  3. * edma_test.c
    4 _4 Z% u8 c' \0 o4 k- o0 V
  4. *( z$ t1 @" ?, k3 P- W. e$ w2 C6 @- \, X
  5. * brief  EDMA3 Test Application7 V0 ]8 B2 P/ Q! x! Z2 E
  6. *
    & g  F5 T' O% u: `- m* G# `* f
  7. *   This file contains EDMA3 Test code.9 N3 l. J+ ~# D4 b% F
  8. *& E0 E5 ~' V# t/ u" T7 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 ]; _# i/ @$ M) p3 n1 Z- f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / q5 p& Y$ C8 z/ t: d: `0 B( Z
  11. *         TO CHANGE.# P2 U/ |6 u) C8 X' Z
  12. *2 e9 H/ q7 ^; D% n& G- I4 P/ O1 X2 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. R& K) ^2 S; B- t! ~( I
  14. *
    $ F8 \1 s+ v3 P& R8 s* y& x
  15. * This program is free software; you can redistribute it and/or
    % w$ u. N1 y6 O& a+ Y' h' y  K8 }
  16. * modify it under the terms of the GNU General Public License as/ ]3 w) t) D) c' y2 Y! I
  17. * published by the Free Software Foundation version 2.
    0 c% j. R4 E0 I1 x7 l5 A* P
  18. *
    # S& ]; ~2 |7 C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  E( ?7 m& v3 a7 @  W' J
  20. * kind, whether express or implied; without even the implied warranty
    9 w, q; J9 Z4 u  f3 ?9 w% Z/ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 }2 m! @/ b" j2 ~- M
  22. * GNU General Public License for more details.
    / d# E0 L, f# C$ D$ r, N, L
  23. */9 E4 [' E0 V: {% C; O# \
  24. 6 k" U! R+ H6 k, E
  25. #include <linux/module.h>
    ! \. w* o# ]! z8 B
  26. #include <linux/init.h>4 r+ p# D7 r; T; A( n% V
  27. #include <linux/errno.h>% E1 Q$ ?( ^0 n3 b
  28. #include <linux/types.h>% W8 V* Y: p7 z8 o# H) H) l
  29. #include <linux/interrupt.h>
    9 {8 h; J; W, i& e4 E, I
  30. #include <asm/io.h>3 \' m/ v1 y0 w: G
  31. #include <linux/moduleparam.h>+ e/ z" G7 n2 K
  32. #include <linux/sysctl.h>
    . `0 T( p5 X8 h  `* u; }# f9 u& G
  33. #include <linux/mm.h>
    ; t% Z1 N9 n9 o: ?
  34. #include <linux/dma-mapping.h>0 E# E  v# Z  E- Z& A
  35. ; _: E; X3 a/ a' v# m% G( z$ ?
  36. #include <mach/memory.h>2 e9 ]* l$ \; C" e
  37. #include <mach/hardware.h>
    7 L8 C" {/ K6 l  C! l
  38. #include <mach/irqs.h>% `$ L8 g" ]) Z/ }! [
  39. #include <asm/hardware/edma.h>
    : G2 g( m( i& M& o
  40. ' }% s$ s3 @9 l0 n& F& |. r
  41. #undef EDMA3_DEBUG: i+ y6 x6 v" L, @% Q. A, `
  42. /*#define EDMA3_DEBUG*/* X' f6 Q! X* \2 v* Y
  43. ; d3 O& F& ]) x1 l% j
  44. #ifdef EDMA3_DEBUG
    ( o( b! }1 N. k' c, M7 e% b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 g% a2 N/ k! ~, m1 H: m. T9 a1 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [* b# e8 g0 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; T1 S9 o! m. p& B
  48. #else4 f& ~5 ^/ \6 T+ }% S3 n
  49. #define DMA_PRINTK( x... )
    2 g+ E( a9 P3 s( O- J
  50. #define DMA_FN_IN
    / F0 X. E% E5 r
  51. #define DMA_FN_OUT
    8 s6 y& T  A* r/ G
  52. #endif
    ! W3 h$ j  {4 i) r
  53. # l$ y7 X1 `% q& X) ]5 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& p; M( `, m1 N. y& W/ ~
  55. #define STATIC_SHIFT                3
    / q, K+ t) z! ?# `( O. `7 J
  56. #define TCINTEN_SHIFT               201 b1 z1 O! q; v7 |# h; |
  57. #define ITCINTEN_SHIFT              21' [2 E: G0 l6 d& q: T( |
  58. #define TCCHEN_SHIFT                22$ P. v1 F+ `7 P$ a8 `6 G+ t, Y
  59. #define ITCCHEN_SHIFT               23
    , K2 G8 z- l# W4 I# t& N) R
  60.   v8 n/ G$ u% n6 m! C5 h$ d
  61. static volatile int irqraised1 = 0;+ Y: I  s4 b7 a0 V
  62. static volatile int irqraised2 = 0;
    4 i3 C+ a$ p7 N/ k2 t

  63. 3 W  D* ^9 Z3 h1 y) P" n, I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . l$ I7 b3 l1 `, Y  }" G1 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 M' t# J% G1 c5 N' F! r6 _6 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L. J( g1 d; f) ~9 o5 F

  67. & O5 r' |- W$ R' ^; Q5 x! t
  68. dma_addr_t dmaphyssrc1 = 0;
    * M" j7 _1 p- i, G1 U* l
  69. dma_addr_t dmaphyssrc2 = 0;
    7 j; ?8 M5 q5 K& F
  70. dma_addr_t dmaphysdest1 = 0;7 Q. ?* `/ U/ z' u3 f; L5 d) k
  71. dma_addr_t dmaphysdest2 = 0;
    % x' |% S& I( x. N# y- w  ^. a

  72. 2 }# n  Q+ j& s' q% _
  73. char *dmabufsrc1 = NULL;, R& @6 g. }. J$ k' I7 e
  74. char *dmabufsrc2 = NULL;
    8 o5 ]/ ?/ R- h1 z/ h6 W  K
  75. char *dmabufdest1 = NULL;' k  f3 k( D! k) i. H: C. T2 w
  76. char *dmabufdest2 = NULL;  u1 V( |, q4 n) v! o) N

  77. : N# P3 `2 C) ]4 a
  78. static int acnt = 512;: D3 }3 I+ w8 r2 V: C, P6 f
  79. static int bcnt = 8;* j: A( i9 z6 A* I& H  E; c
  80. static int ccnt = 8;+ _' O8 N9 q7 k. v# C! }" M

  81. * G3 U7 R. S+ B5 ]6 W9 \
  82. module_param(acnt, int, S_IRUGO);
    - T8 Z1 z& [1 {; i5 Y
  83. module_param(bcnt, int, S_IRUGO);
    : X% p* c/ \; B9 [1 j: b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ r( w6 o( y5 W1 O
- v8 s2 c# ^. |) w- @& w6 d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- S. F: Q6 w1 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?! @/ b! S, \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Z* A' _0 m( P6 @' ]9 g% b" n
9 C7 I9 W0 o: Q# ]1 P9 y& i
& f# c- t$ I% V  O% O1 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-13 23:58 , Processed in 0.038073 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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