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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 X# c6 `2 d' s
  1. [code]EDMA sample test application
    - F# I2 Z# D& j0 M" }8 T7 Q
  2. /*
    & y4 X3 l) S2 u+ d0 \2 T
  3. * edma_test.c
    * m% T# i" O$ ]' p0 L" O" j, o- l
  4. *$ s) V3 S; j$ x1 m: C1 [
  5. * brief  EDMA3 Test Application
    0 ]  {$ E- [! c+ f& J' F
  6. *' Y* x! x$ ?8 W; u& @3 E
  7. *   This file contains EDMA3 Test code.
    2 d( M$ ^* L1 H1 N* |
  8. *8 m8 j+ x; S% s! e7 `6 M% ]; `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( G9 ?5 g* R& x& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ h/ Z/ H5 a& [& e8 \% T( O% S- h, c
  11. *         TO CHANGE.
    $ k' c9 Z2 K: s* C% K
  12. *8 [( K4 P% t1 H7 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 N1 z& ^/ G! Z5 V: f# I+ l
  14. *
    / s/ O) E  p9 K4 h* K2 I, @
  15. * This program is free software; you can redistribute it and/or
    $ a& f  b: R% x# W0 Q
  16. * modify it under the terms of the GNU General Public License as9 H6 S) E% K) \! k* n/ Q0 t
  17. * published by the Free Software Foundation version 2.3 k7 v, b8 |4 T2 f
  18. *  a* u5 H( o( x1 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 ]5 W1 Q' E" ~9 Y
  20. * kind, whether express or implied; without even the implied warranty
    4 x- y) B3 q0 v& z/ E5 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# e  Y" |8 T4 l4 s* b& B( P
  22. * GNU General Public License for more details.2 E. X  F+ O( n7 R3 D
  23. */
      E2 `, t6 H' N: l6 K& _7 d( \3 m
  24. ! ^  O6 J! B& Z. n
  25. #include <linux/module.h>
    . `; [4 P! V! U
  26. #include <linux/init.h>/ C1 m" |' ^- b
  27. #include <linux/errno.h>
    0 A& c3 B) f, ^* E  Q' r
  28. #include <linux/types.h>
    / F2 g; Z8 }. S: E% g) A
  29. #include <linux/interrupt.h>
      d3 Q& m/ R2 g7 c6 C
  30. #include <asm/io.h>
    ) \5 B% g0 L7 \7 C1 z
  31. #include <linux/moduleparam.h>
    3 v/ t4 c5 l7 M) K% Y# b# S' m
  32. #include <linux/sysctl.h>
    : I3 y. D" K! l2 N1 a4 v
  33. #include <linux/mm.h>
    0 w% ~/ U/ ]2 X/ w
  34. #include <linux/dma-mapping.h>5 y0 O$ W+ L2 a# c0 }' H, X
  35. / f8 p* Q% p1 b. _3 T" ?
  36. #include <mach/memory.h>* E  v4 r. K: D" {4 m+ Q4 \
  37. #include <mach/hardware.h>
    $ a3 V! e' {( Q; Z
  38. #include <mach/irqs.h>
    ' M) L5 I  a, W5 Y9 V% B
  39. #include <asm/hardware/edma.h>
    ! f) n  ?7 `5 D( m7 r

  40. ! A4 l6 a* p; E' u+ N$ E7 {
  41. #undef EDMA3_DEBUG
    9 c0 n+ Q9 p/ v5 L0 {9 _
  42. /*#define EDMA3_DEBUG*/- d. v) Q% t9 A" z# W' S

  43. - p; O: S6 g6 ?& b) `/ p7 I
  44. #ifdef EDMA3_DEBUG
    % _" a$ |% \& h9 A9 c3 {9 c0 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 y1 [5 T% }8 G2 P# r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! R; U9 |) U# I3 s/ M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 t/ Y4 c& t, N! D  T% R3 l5 c6 E+ _* L
  48. #else
    6 s; P# E6 M9 L+ R* c
  49. #define DMA_PRINTK( x... )2 C! Y! m5 h, d2 E) w& u
  50. #define DMA_FN_IN& d4 ?- N8 {8 x: i1 d, Y2 T
  51. #define DMA_FN_OUT
    * e" P6 x7 V6 q: X4 Z7 e
  52. #endif
    7 h) V1 a5 z8 N& l/ l& p

  53. $ q& y+ K" w; \8 ^( ~# k/ W! q: x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); z7 X( I: Q$ N- X& r! e9 V
  55. #define STATIC_SHIFT                3
    * K# A. o# {4 }% g1 _9 V
  56. #define TCINTEN_SHIFT               20( a' y1 L. h( J% _$ ~' Q9 g
  57. #define ITCINTEN_SHIFT              21* c% Q. W2 N+ }, a; i/ k
  58. #define TCCHEN_SHIFT                22# ]0 t. \6 Z4 Q7 N
  59. #define ITCCHEN_SHIFT               23
    ( S( F; I' f3 S& Q
  60. & [: ?% b  j9 m/ L% K
  61. static volatile int irqraised1 = 0;
    9 f: }- }7 B* W$ u) O6 N) H
  62. static volatile int irqraised2 = 0;
      h" z, `2 }7 `  c, Y& D
  63. ) ]+ D7 ^7 q: [; w/ |; K. g3 F7 u0 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B7 R9 H1 |! F) x1 t2 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 D) _0 ]7 o2 l# v7 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( G" R  B" Z( g* l

  67. ( p* `# Q4 j* p( K4 w4 R
  68. dma_addr_t dmaphyssrc1 = 0;+ i- w* R7 e* C% Z% E* j$ L, q0 M5 W
  69. dma_addr_t dmaphyssrc2 = 0;
    8 \. l& j* c* Y+ I$ ^8 l$ E. m* v
  70. dma_addr_t dmaphysdest1 = 0;% l& E2 i/ x) ]2 h9 \; U1 Q/ H# h7 v+ Q
  71. dma_addr_t dmaphysdest2 = 0;1 k- L- r; _* n" V) C4 a! T

  72. 3 v, C$ B+ R+ H& y) Q; g7 F/ l
  73. char *dmabufsrc1 = NULL;
    : k" r- c+ m1 I5 K
  74. char *dmabufsrc2 = NULL;; m, I  N, q/ Z' O2 v7 Z4 c( m
  75. char *dmabufdest1 = NULL;# x5 l8 |5 t8 _; `9 V6 C( y$ a& X
  76. char *dmabufdest2 = NULL;
    5 P7 s0 G5 W: C' `

  77. 3 q3 i5 |2 S( s+ ^5 f
  78. static int acnt = 512;
    ( H3 Y2 l, ^: B* E5 W" z0 a
  79. static int bcnt = 8;5 m: c: o4 j9 \0 C0 y
  80. static int ccnt = 8;4 x. I1 P3 ?4 d1 t* |

  81. . u, R( X- ?7 c4 w" I
  82. module_param(acnt, int, S_IRUGO);
    " ]( T! O# H9 g) }2 K8 a% u
  83. module_param(bcnt, int, S_IRUGO);
      C% u! ^' _/ t2 g: E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 v6 y% O& h2 M2 ^' W: P- b% Y( M
& L& a; e' g3 `$ ^2 y7 Y! Y+ `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 }. K% p" U  D" \) x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: V: Y0 f5 f& O% W6 e& [7 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: s: V- f# j1 l/ j5 N1 i
. \, \4 I( l9 P) Q
$ |+ J7 x( z6 W7 H' [0 Q  d7 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 14:05 , Processed in 0.038755 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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