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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n: L; o! ]4 ?
  1. [code]EDMA sample test application
    ' S7 u% a4 [$ ]! _0 D1 D& X
  2. /*- S9 N1 u# g4 u- u/ J2 K9 r
  3. * edma_test.c
    5 S# l; l0 R* w3 l
  4. *+ v! |$ Z2 g( P8 w$ \9 {- }; w
  5. * brief  EDMA3 Test Application% M% q' H+ x  J; q8 o
  6. *
    6 D% S! M; l1 ?8 [/ o
  7. *   This file contains EDMA3 Test code.0 e0 b' x& k: T: Z& G
  8. *# o. E0 `9 U2 p2 H% H/ [9 y/ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; `' @0 `! y8 }, m) _3 V6 R0 U# a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 I/ ]5 o9 H( ]
  11. *         TO CHANGE.
    % [& `( |  m' }! S2 ?- x/ e
  12. *; \! _( V5 G5 D& W/ `# ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! i1 u! v' y8 ~8 u4 M, Q
  14. *
    . t# b7 H7 C$ G; c+ q) d# L0 @
  15. * This program is free software; you can redistribute it and/or
    ( e; K  k6 h6 k4 T
  16. * modify it under the terms of the GNU General Public License as' _& G! ?" u: R; m1 k
  17. * published by the Free Software Foundation version 2.
    * t/ m; d5 o, V; I2 j
  18. *2 ^5 b6 h0 A3 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 H# G& {* c- ~$ v, Y$ Y* b# x
  20. * kind, whether express or implied; without even the implied warranty/ m8 Z# q" `! S; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( t; d" U2 w, o- e1 d" I9 ~
  22. * GNU General Public License for more details.
    & R" k9 v! y3 A5 K
  23. */
    $ ]& Y, v, @7 l+ F; P% i; l
  24. * O: P# W" ?( e+ G$ r0 U3 a$ P  f, I3 H
  25. #include <linux/module.h>
    ( m& i" G; R3 Z/ w- @: h: ^. x
  26. #include <linux/init.h>
    , ?: V  Q, H- q/ v4 z
  27. #include <linux/errno.h>
    : I  c# D# S$ ]6 c, r, A' ?
  28. #include <linux/types.h>
    - f7 d7 ]9 j3 P
  29. #include <linux/interrupt.h>
    3 D' z# a* a" u' ?0 g( Y
  30. #include <asm/io.h>
    . ?4 L; V) Q/ U1 r0 M/ H
  31. #include <linux/moduleparam.h>
    % q4 G& _8 s2 |7 n5 G' j
  32. #include <linux/sysctl.h>3 L- ^* G& c' {. r  x% ^/ i
  33. #include <linux/mm.h>: f' b+ h, }' u5 Q( q
  34. #include <linux/dma-mapping.h>
    5 ]8 v2 a6 M5 I! |3 ~) K

  35. 8 I" M3 ?. G6 s2 @3 x
  36. #include <mach/memory.h>
    ) Y, M( F! n3 [  E+ w
  37. #include <mach/hardware.h>! n+ W6 f. ^3 k. k+ S! w% y- n
  38. #include <mach/irqs.h>
    3 Y' @2 ?& }) i! N) i+ D
  39. #include <asm/hardware/edma.h>3 E* R% @) r5 ]3 x: m( d
  40. ' \/ {! c5 h% a* g7 }
  41. #undef EDMA3_DEBUG
    - y/ g+ K' ^2 J$ e  T
  42. /*#define EDMA3_DEBUG*/, Z, C1 g. p$ b4 K8 N$ d

  43. , ?3 i6 n+ h7 I
  44. #ifdef EDMA3_DEBUG
    : S# ~; m& `! F2 x! r, O. J+ o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! Y( C: H+ U5 ?0 @) D% b  Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). a, _+ a5 k( u6 g1 Q, L; L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( y& \- u2 `4 Q7 g
  48. #else3 Z! n& B! X: @8 _% l  ~6 F/ G
  49. #define DMA_PRINTK( x... )
    $ `0 V" Z9 J4 ?* H3 m9 a. l) i
  50. #define DMA_FN_IN# i: `% i2 Q, L
  51. #define DMA_FN_OUT
    4 o! O$ R; r9 _( N" v2 ]& T( c$ b
  52. #endif
    9 u9 M; d8 E# L5 R

  53. . K9 a! U4 \1 J; R4 g2 V& w. `; B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 W- G; g+ {# T
  55. #define STATIC_SHIFT                3
    $ @- W* U% R& T! i! \6 B
  56. #define TCINTEN_SHIFT               20& \. N- W+ }' N( [. Y- u  ]( E" u: F: U
  57. #define ITCINTEN_SHIFT              21
    9 W  ^8 h/ g/ P
  58. #define TCCHEN_SHIFT                22
    ( I0 l+ s! T: w; ^/ ]: V
  59. #define ITCCHEN_SHIFT               233 X, @- ]# i5 ~. K& u9 L+ O
  60. ' p% `# d; D7 w7 K
  61. static volatile int irqraised1 = 0;
    4 t& F( @  X6 V
  62. static volatile int irqraised2 = 0;
      ?6 N/ F1 b/ m0 m' m8 f, |
  63.   H+ ^4 [, T+ k9 E1 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, O- W/ j  S  \" q' R  g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T+ p; A9 _1 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ z& t# }$ @5 c5 P  G2 Y
  67. / _" J# |4 X9 ^2 G* b
  68. dma_addr_t dmaphyssrc1 = 0;# m3 G8 `1 h) K9 ?0 ~
  69. dma_addr_t dmaphyssrc2 = 0;/ _3 ^* `  \, L8 U
  70. dma_addr_t dmaphysdest1 = 0;
    % h/ t& q4 g4 r$ Q
  71. dma_addr_t dmaphysdest2 = 0;: B) U5 W0 G1 z# X8 S

  72. % y4 n$ U' w1 T% r+ A: r7 y  z1 Y
  73. char *dmabufsrc1 = NULL;
    8 c6 g& d6 L  \/ L
  74. char *dmabufsrc2 = NULL;, d" [' U: U% m; |  {
  75. char *dmabufdest1 = NULL;
    1 F; l7 i5 [5 u0 R6 R
  76. char *dmabufdest2 = NULL;
      u8 }6 L, N# s7 g+ l. v; V
  77. , ?5 u! X" Q! `( v, a: J, i4 ?
  78. static int acnt = 512;4 a% z7 B5 @- r: n+ s
  79. static int bcnt = 8;
    + q8 O# x& H1 \  ?
  80. static int ccnt = 8;
    0 U7 K2 x3 Y+ k3 H5 T% O( [" s2 A

  81. & u& S2 R* I# X; q' E
  82. module_param(acnt, int, S_IRUGO);" P9 `6 R7 e. A9 c" X
  83. module_param(bcnt, int, S_IRUGO);0 g/ D& y+ n4 ?8 J- m7 m9 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( h  S) o. J4 @0 X9 a
9 g& A0 |2 H* B3 w/ P4 `7 V$ |6 G3 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 G7 I8 U  t. Q# f! c- ?* yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# e0 Z- G7 o8 @+ ~" J; _# @7 Z- P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: k) i: W: a2 s9 l6 a

8 _. e# `8 e7 R& y  v' w1 E+ b3 T$ f3 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-14 11:08 , Processed in 0.042532 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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