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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# p% i. c' C" m- a$ ~
  1. [code]EDMA sample test application
    6 w2 t, B3 H( K/ Z7 k
  2. /*2 ?. e4 h* }8 X  w0 x
  3. * edma_test.c
    9 `3 ~+ ]( x4 E4 Z$ w5 f
  4. *7 P# Q5 ?  k4 ?, ?- m
  5. * brief  EDMA3 Test Application
    ; Z# q; [/ ~& `5 M' z( T* D8 `
  6. *
    ! p" g6 @7 D- `1 v& ~+ T" h
  7. *   This file contains EDMA3 Test code.* z  x4 W7 {# b4 g* R, I+ \
  8. *
    9 z( X& W2 L/ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : t7 ?/ _3 w" R! _9 {; y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 @9 Z9 w/ g3 T! T. _: p
  11. *         TO CHANGE.- |* h( m$ k$ e1 x
  12. *
    6 W  r& f  Y) C5 Z) K7 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 _5 c9 g0 }# R) v+ S8 z6 s
  14. *2 ]3 z1 O2 W6 k% ]; y* e
  15. * This program is free software; you can redistribute it and/or
    1 c# A9 P; R3 `0 p* }5 a0 b* A; n/ Y
  16. * modify it under the terms of the GNU General Public License as
    7 h' _3 _" A# E! [
  17. * published by the Free Software Foundation version 2.2 T% }" z' a& g
  18. *
    - q/ x' `# w% @7 [, t+ f$ r- |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. M" n, r5 j4 j3 p9 h) N
  20. * kind, whether express or implied; without even the implied warranty! Z( _$ F' a7 o1 f# X) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; v+ |- z- u' S' O9 D7 V, ~! G! K
  22. * GNU General Public License for more details.0 A# s- z( X, U& N
  23. */
    7 C& X1 s. G5 }* M4 V  ^, s
  24. 1 R! L; v. J) z1 C- y' n& A# F
  25. #include <linux/module.h>
    3 f4 P% @, ?9 E! S* g
  26. #include <linux/init.h>$ m0 ]# L* m, N7 e3 W9 {
  27. #include <linux/errno.h>
    2 v" V6 ~, m  A  O0 v" g5 l
  28. #include <linux/types.h>! ^7 {7 r+ o" a
  29. #include <linux/interrupt.h>% w: Z9 z1 D" C4 n; i- E( u
  30. #include <asm/io.h>& k, W9 ~& K/ s. J  s
  31. #include <linux/moduleparam.h>
    $ H1 C, j. _/ x! T) @$ t8 n
  32. #include <linux/sysctl.h>' B: @, J% q8 ?5 O8 ?( [2 s% V
  33. #include <linux/mm.h>9 q5 v% Q  n* g2 b! U$ d) s0 x
  34. #include <linux/dma-mapping.h>  _7 l8 J  n! S! P$ i7 Y$ b
  35. 3 h. Q2 A# |, d! H
  36. #include <mach/memory.h>8 G( ^+ z, F1 _7 d. N
  37. #include <mach/hardware.h>$ ^) ^! e% O/ n8 K0 d
  38. #include <mach/irqs.h>% _. Z, w# L5 x! }9 m
  39. #include <asm/hardware/edma.h>2 i: O5 v# u: a+ _2 K9 b/ p

  40. 9 V  P0 |" N2 V/ I
  41. #undef EDMA3_DEBUG9 a9 m  C. {2 L* F: p$ S
  42. /*#define EDMA3_DEBUG*/& t7 @* C/ ~: b& k1 Y! j7 \5 C7 c
  43. % ^' Y& t% H/ B& F7 A
  44. #ifdef EDMA3_DEBUG8 n" q0 Q7 c  H: Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" T( ^8 v, ^$ ~3 T4 s& N" W6 W5 h/ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 w5 P" s: m+ M* \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 e; w  W0 [5 `2 G9 Z
  48. #else
    ! L! b! V) T+ L  {
  49. #define DMA_PRINTK( x... )  D) h$ _) d( x1 a& i8 p
  50. #define DMA_FN_IN7 Y4 k4 ]+ A6 R% E
  51. #define DMA_FN_OUT% h$ Q+ U9 `+ o% }8 n- y" l% w
  52. #endif
    % P$ Q4 O# \/ l2 l& x0 b% r" l/ C

  53. $ e6 U' L% z; |8 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 s* ^5 K$ \; m- x" [. v
  55. #define STATIC_SHIFT                3
    0 `9 P% x) O+ ]6 @- u
  56. #define TCINTEN_SHIFT               20! [% i% H+ j* O; t
  57. #define ITCINTEN_SHIFT              21
    # [, T7 w+ @9 l& J  d
  58. #define TCCHEN_SHIFT                22
    ) G7 p9 A' b) y# s/ ^, m6 P! }
  59. #define ITCCHEN_SHIFT               23
    ) L( y! f8 w8 e2 U

  60. 8 T5 U# p& M& n' q, {" v8 f
  61. static volatile int irqraised1 = 0;
    / J6 E% I) J# e
  62. static volatile int irqraised2 = 0;
    . M. d2 [: x+ a9 V3 U
  63. * @% z+ h4 z3 R1 k1 n1 N0 z8 c: N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G- S9 o7 j, U( k/ h! [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |% r& o5 H3 i% J2 O# }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G2 R- H4 ~5 D

  67.   b  _( o7 e1 G+ h3 s- Y
  68. dma_addr_t dmaphyssrc1 = 0;
    4 l" j' ]/ H2 b% ]# o
  69. dma_addr_t dmaphyssrc2 = 0;( R" |8 A! x7 h0 X1 v
  70. dma_addr_t dmaphysdest1 = 0;
    ) L' x0 E! U. P. k1 x
  71. dma_addr_t dmaphysdest2 = 0;, k# m% @) e4 h, u# N% p& ^$ @
  72. 8 J0 T4 u' C9 z: K/ t" d
  73. char *dmabufsrc1 = NULL;- C2 J5 w3 K1 u- n8 B! [  J) ^  \
  74. char *dmabufsrc2 = NULL;
    1 D4 i. o1 E- _  {" b& f
  75. char *dmabufdest1 = NULL;+ w5 L0 q- L2 [3 Q
  76. char *dmabufdest2 = NULL;) B- H7 I+ T( |, z& r& N0 T! q

  77. # j) Q! v! W- I/ I9 ?/ W: u9 o
  78. static int acnt = 512;7 K; ^: P. z/ R' @8 q# c. x
  79. static int bcnt = 8;; a3 y6 G3 i* n: R5 t' x/ v. }
  80. static int ccnt = 8;0 w- B& t) w: [0 U! y. i8 N! `
  81. 0 Z" {$ V1 {  T- e; W6 _4 g2 O% K
  82. module_param(acnt, int, S_IRUGO);
      L0 Z( o' G  E3 v
  83. module_param(bcnt, int, S_IRUGO);
      a: Y& _' {, D% B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ Z, q9 f0 N9 P( p1 `/ ]% C  ]9 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 e5 r4 U, _  L- M- N1 e" f" |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 N& \9 s( o  \% D. z4 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 |* \2 o* R7 X5 t& V/ W
" Z: i2 L9 `) L& E. A- V+ V
. s5 H! E* X! Q) n1 {, c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 21:16 , Processed in 0.038574 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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