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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ S% i5 P+ q% a% ~
  1. [code]EDMA sample test application4 s( l, h" T) p7 x0 c( E
  2. /*
    * k4 m& L- \" ]+ ~- C! j7 Y# a* _
  3. * edma_test.c
    ( L: |, c) u$ ?+ T/ _& P
  4. *- s, r2 I2 m' Z" D3 {+ B9 `5 s6 R
  5. * brief  EDMA3 Test Application' W$ d+ {# O% z/ ]) v) `, D
  6. *
    ) N$ ~- h5 d" N: ~4 k, S
  7. *   This file contains EDMA3 Test code.
      L& a+ N6 ]# H9 O0 \: R
  8. *
    $ t' k* x% n9 j" H% _! q% C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 k% s( O8 f3 C0 P: L9 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : l( k3 b9 a8 G, D
  11. *         TO CHANGE.
    + e- l# e0 X$ L  O/ I! V4 g1 R
  12. *- ?3 f0 h& [2 L* |4 c1 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : u* z; ^8 Z5 l2 y' i
  14. *
    & @; X! O* Y/ r" I0 n
  15. * This program is free software; you can redistribute it and/or- W0 o( ]7 c! r' K$ {8 {8 X
  16. * modify it under the terms of the GNU General Public License as
    # V8 e( c! ^8 Z6 K3 W5 w( h
  17. * published by the Free Software Foundation version 2.
    5 p8 {( U# ^; U( m# u
  18. *4 t" ]5 T& n  {2 m0 V3 K& _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' K' a2 _3 K0 j0 J2 o& Q: U% o/ A
  20. * kind, whether express or implied; without even the implied warranty
    ; ^  X7 z. P: s2 I* C% l  X+ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , |0 ]& a3 y4 ^! i. d% V
  22. * GNU General Public License for more details.
    8 h# a  F4 z4 t; h" ?. O
  23. */
    + ]7 @6 P/ \0 j( V: s# ]/ K
  24. 6 G/ E- O, ], N' g. ], D
  25. #include <linux/module.h>
    ) G& r  d4 L- j' \; T
  26. #include <linux/init.h>
    * ^( x* M2 J/ s
  27. #include <linux/errno.h>. S$ _5 o4 k! d: W. |% E
  28. #include <linux/types.h>! h3 _% {6 t2 X( F. j
  29. #include <linux/interrupt.h>. L2 a1 |$ w* T7 g; H7 Y, n
  30. #include <asm/io.h>3 }. w+ F3 S( I; U. ]. d
  31. #include <linux/moduleparam.h>
    & l2 T; b0 m" c
  32. #include <linux/sysctl.h>3 x; s1 y* m9 F: Q* [
  33. #include <linux/mm.h>0 |( H/ W! o& ?) s
  34. #include <linux/dma-mapping.h>1 }" ^" |) d# t$ H" E

  35. 6 ]1 i2 m' q9 O" c6 C# x  t- u9 s
  36. #include <mach/memory.h>
    6 g1 n6 H; v) X# p) p+ j
  37. #include <mach/hardware.h>6 l. x4 d- i8 D: ]( c: r- q
  38. #include <mach/irqs.h>' i/ x0 i4 p; u1 P7 W0 z
  39. #include <asm/hardware/edma.h>2 w- R: H4 m2 F

  40. / s) s, B9 \+ u0 E
  41. #undef EDMA3_DEBUG
    3 e0 A6 p+ F* D% L
  42. /*#define EDMA3_DEBUG*/0 _0 a7 \# P# ?
  43. % l: W6 U+ ^+ I; T5 }* N$ {6 w
  44. #ifdef EDMA3_DEBUG" s/ |, W' t! w1 V* [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" T' F( N8 k9 K, L, T0 h4 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 N1 u  l" d* s$ o3 A4 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 ^2 I1 m  M+ B& q) }$ Y
  48. #else
    " X4 y, X! p9 ^7 [* l( G4 h
  49. #define DMA_PRINTK( x... )  e6 Z) z6 C/ h5 M/ T% s  G
  50. #define DMA_FN_IN0 Z2 r0 D" P0 w1 Q8 l
  51. #define DMA_FN_OUT" M0 Q! a  M0 V) }7 y
  52. #endif3 F8 H+ M3 C8 a3 l# X
  53. % K0 Y0 c$ F$ u2 w- M$ H% {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 B# Q0 Y0 _# Q, t9 a5 M) H
  55. #define STATIC_SHIFT                3) V6 A' t; n7 y" X9 R/ N0 j
  56. #define TCINTEN_SHIFT               202 _/ U5 _7 f: D* y
  57. #define ITCINTEN_SHIFT              21
    + p% ?1 Q- W1 U# N
  58. #define TCCHEN_SHIFT                22  G& p6 d: j* E4 w( A: _. v! c% g
  59. #define ITCCHEN_SHIFT               23/ b& `0 h7 ?- @

  60. ) D- p5 J3 a* J, Z: @
  61. static volatile int irqraised1 = 0;" R' L% m4 {9 O; Z+ f1 }  a8 s. f
  62. static volatile int irqraised2 = 0;* i  f; b2 |# z" P7 ]4 k/ l

  63. 3 E: n, n: _) ~5 G+ W) K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 ~- F& R' L, [. E. B) F- T3 ?5 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 U. K: t: o/ w3 S% X2 y1 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 H2 |, A: E2 y
  67. ! H& r* S% m5 B7 y: c) H
  68. dma_addr_t dmaphyssrc1 = 0;
    5 Z4 @' _; K5 B% W* e! E
  69. dma_addr_t dmaphyssrc2 = 0;# ~" a; u# a" S4 m9 }6 k
  70. dma_addr_t dmaphysdest1 = 0;6 T- a, Q6 E- t5 J, k$ s
  71. dma_addr_t dmaphysdest2 = 0;
    ! I) K4 |: n$ e$ [/ ?: P
  72. / _6 T' v1 ?2 a( V8 {
  73. char *dmabufsrc1 = NULL;7 u; `8 n$ ?: B4 u
  74. char *dmabufsrc2 = NULL;$ n) d( N8 q: S% L% m/ L
  75. char *dmabufdest1 = NULL;9 X7 C& m& [/ l
  76. char *dmabufdest2 = NULL;# |9 h9 \, A, p' n( G
  77. ( O% h$ a; U, k8 [0 _" \
  78. static int acnt = 512;
    # U: Z! H/ b+ J
  79. static int bcnt = 8;
    2 t* ^& l5 Z( x6 w, ~- w4 }
  80. static int ccnt = 8;
    # x2 X) R1 \1 `/ ?0 |3 n# u( y

  81. 1 p! Q) b; z' P2 b5 o- C+ E- B
  82. module_param(acnt, int, S_IRUGO);) D0 f* H' @- t, B( |9 z3 _0 H
  83. module_param(bcnt, int, S_IRUGO);
    5 w0 P5 A' [5 F/ `, J  t6 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 E# `, n4 m- I5 p8 E3 ^
, _- k, H2 Y) z' \1 p; |. t/ h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 l2 Z- A7 L' z& @: c7 ]8 n/ {9 c6 ?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! T1 g0 h; ^8 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( V8 r3 \( j# M0 ]5 H/ R3 T& M- x  Y
9 x9 J# Z# V/ k6 ?! Q$ ^2 M- `
" ]7 x7 h& u9 R- ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 22:19 , Processed in 0.043603 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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