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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 T0 ~8 q4 \( b9 A; g9 n4 n
  1. [code]EDMA sample test application
    ; {# F; s9 v7 B6 t1 {
  2. /*
    , W& ~5 e& P; C: y
  3. * edma_test.c% V* f8 D. J# {" a* z
  4. *
    ! d0 a+ @$ ^  g& s6 Q' N
  5. * brief  EDMA3 Test Application+ F2 }* C( M, M
  6. *
    8 W$ d9 F. v6 W, g; D1 y; U) H: o
  7. *   This file contains EDMA3 Test code.
    + }( w" h$ Z0 H. U
  8. *9 T1 O& b5 T' Q# o1 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( ~3 f- U' w) j: ^8 W6 r% m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ {: I$ U, X/ [" F9 V( V3 I/ C
  11. *         TO CHANGE.1 `9 R% b  d9 o% I3 b* w( ~% i
  12. *
    5 G# B; k2 Y; T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* s6 V8 e0 R" Y/ l# T6 f
  14. *
    " b9 R3 a5 r; D. Z# n7 o4 Z
  15. * This program is free software; you can redistribute it and/or
    & ~5 w) i# D5 J0 b* |0 F6 m6 D  c
  16. * modify it under the terms of the GNU General Public License as
    ) z- G9 y% J! A/ S
  17. * published by the Free Software Foundation version 2.
    " G. d) S7 y4 M2 J" @
  18. *$ o8 }5 }/ A; o! Q" F' x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, y) i" X7 E9 v4 K9 l4 y6 P
  20. * kind, whether express or implied; without even the implied warranty% Z  H/ H+ l* b+ S2 n9 C0 m, r" G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* K  D2 p  W: J8 a) Y
  22. * GNU General Public License for more details.6 M2 Z+ n/ S6 w
  23. */. ]; S6 z. R# i: g5 K% t4 l

  24. % _  d/ T: F+ R: m4 Z
  25. #include <linux/module.h>
    8 J3 n, L0 `( B9 _9 }
  26. #include <linux/init.h>
    - W$ ]. n1 k/ g) h* H7 @
  27. #include <linux/errno.h>
    + S7 }* P! Z& R5 J! ^( v5 @
  28. #include <linux/types.h>' w1 W6 V6 u0 f) Z, i
  29. #include <linux/interrupt.h>
    ' o$ i/ r: J% B
  30. #include <asm/io.h>6 I8 S0 U+ a4 T" `: e0 N3 Q
  31. #include <linux/moduleparam.h>0 x, l$ b6 [4 W# h
  32. #include <linux/sysctl.h>' e% A+ s# P( G& K& O! W* S. T
  33. #include <linux/mm.h>
    * Q7 k( y% r' Z1 o
  34. #include <linux/dma-mapping.h>. ~; O" o6 Z3 R- I, _

  35. 9 E1 ^( H: b  R: ]* e
  36. #include <mach/memory.h>
    ! G% d  J& {1 z$ k
  37. #include <mach/hardware.h>" ?$ {+ J# S5 E" A  q- ?
  38. #include <mach/irqs.h>
    - x3 W$ N2 F# `- o
  39. #include <asm/hardware/edma.h>
    2 e2 ^" i8 n4 l& @

  40. 9 m7 R- D6 A) W: l! ?
  41. #undef EDMA3_DEBUG
    ( T6 M, i; Z/ ~1 i
  42. /*#define EDMA3_DEBUG*/
    0 p" ]7 e3 e. O. S! F

  43. & q5 b& U  H: A8 p, X
  44. #ifdef EDMA3_DEBUG+ @4 s5 V6 i( z+ K" B# K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 _% Z) x# J: C) E( j. R9 U% u4 c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # T4 p+ H4 p- Q- C% b# K, [, U# H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! o8 z' b% h" G. D: l) I
  48. #else, ?5 _8 U) O: S* W
  49. #define DMA_PRINTK( x... )! C2 F: Z& s: T1 _( p1 Y. _# h6 U
  50. #define DMA_FN_IN
    0 d. ]: R( i! A8 a% ~
  51. #define DMA_FN_OUT' {' V/ i0 B" h2 ?. F
  52. #endif% s, f" O) W5 i+ ~
  53. 6 E  T8 T8 [9 V7 u4 I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : e- x; J: t' n& H. i% {' ?& R
  55. #define STATIC_SHIFT                32 Z6 C; |+ f# J4 i. a; R
  56. #define TCINTEN_SHIFT               20
    : G8 P: t7 N- Z$ {6 V: F* t
  57. #define ITCINTEN_SHIFT              213 x' R$ ~) M! W2 Z% {. v8 T4 f
  58. #define TCCHEN_SHIFT                220 T/ \0 b6 x! ~( O) @9 b
  59. #define ITCCHEN_SHIFT               23
    - _% \- n% L( {* n2 q1 P5 \

  60. " O  y) W+ U  N" J  `# h- Q( l
  61. static volatile int irqraised1 = 0;7 O' W. P& E4 r3 c5 c" B
  62. static volatile int irqraised2 = 0;- D/ ?$ h0 J, h
  63. . O  o2 f. v# p9 R% f6 b) R+ D% W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 l( }) t; H- g  P* C1 X5 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      w& h: k" I, F8 u- d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# i9 n6 ^- j* H/ U& Q+ h# K

  67. 8 _2 Z' p% M3 a
  68. dma_addr_t dmaphyssrc1 = 0;
    # _! |* x: C6 D) Y- |0 |; T. `
  69. dma_addr_t dmaphyssrc2 = 0;
    % [2 T8 I, V/ A. F) U) B9 J
  70. dma_addr_t dmaphysdest1 = 0;9 p* ]; f1 g. l/ F4 c/ Y
  71. dma_addr_t dmaphysdest2 = 0;' E; A! P, ]2 k9 L* r

  72. ! [8 P* U4 q8 ?* A9 @! h
  73. char *dmabufsrc1 = NULL;
    2 ^% x1 J+ T, V8 b' A( M8 D5 {
  74. char *dmabufsrc2 = NULL;
    $ I( o# B2 v! E7 H1 B* f+ H
  75. char *dmabufdest1 = NULL;
    ; ?: A) _' ~6 m! B' j! U4 F
  76. char *dmabufdest2 = NULL;9 ]" ~) P6 _* U( X, @, Y

  77. ; S# ?6 s: X  ~5 H3 C8 p* t
  78. static int acnt = 512;
    5 l, B) a" g, K& A5 B5 V- @
  79. static int bcnt = 8;! ]+ I  j2 t7 _6 D) B5 l  x
  80. static int ccnt = 8;9 o/ W# H% y3 ?  Y; ~- L# i) K

  81. 4 T* M1 u/ k- x
  82. module_param(acnt, int, S_IRUGO);( C& Z, |. U) O4 u) T7 L
  83. module_param(bcnt, int, S_IRUGO);1 ]) }3 J) U; C8 u; }$ e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  l8 w2 J, k' H
, u" Z% p# h! p7 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^" m0 s' b2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  \) ?: b* r4 F) C4 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 c* ]3 w: l, C2 ?/ M& l: f, Y. B" D! k, x! q/ L, |

2 S6 w5 U, t: `3 r) |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 23:31 , Processed in 0.040949 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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