OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" U8 |6 p8 C6 u0 u# y3 e* G) P( I
  1. [code]EDMA sample test application
    ; o) j3 I3 K3 j$ Q2 `
  2. /*
    ( i% v! |& C8 e0 x- i7 ^3 X$ G
  3. * edma_test.c
    1 r# L0 n* B! I, S
  4. *) \0 M  \. U+ J% l
  5. * brief  EDMA3 Test Application
    * k9 k2 R, s$ T/ T& c& w$ k$ e$ [
  6. *# x4 z/ b0 Z. w( {8 q' b3 A
  7. *   This file contains EDMA3 Test code.' Z" o5 U, s7 G  p. A3 C# ~- a7 U
  8. *9 Y% T8 G- l& T8 \% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ p. f7 U: S! Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 R" x2 q9 k7 Y' R
  11. *         TO CHANGE.' u5 s: A/ b# F8 N
  12. *
    9 Y0 y5 R  B, Q: z6 z, b) e2 C  Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Y8 T( m  l# P3 G+ y" o4 Q
  14. *
    / D# M8 A& z2 P
  15. * This program is free software; you can redistribute it and/or
    ( i2 a( n, v3 H; J/ z8 c6 T4 w
  16. * modify it under the terms of the GNU General Public License as7 K; C9 l7 A) G, A/ B
  17. * published by the Free Software Foundation version 2.' v% y8 N7 N) i6 \
  18. *
    6 D" i- l) U+ h+ v. W# A7 W: x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 X* ^$ ~4 \" g  x  c
  20. * kind, whether express or implied; without even the implied warranty
    - Y1 V: _: r: a: H" T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# S5 \/ d' s( k! C' J" J8 }) M+ X
  22. * GNU General Public License for more details.
    8 n8 @  ?6 a: t" L+ L& x0 P
  23. */6 N% f+ ?! Q' Q1 c

  24. # P& a9 m( H( E1 c* P& o
  25. #include <linux/module.h>
    ' z! c+ B5 O% @0 _% O* O6 o: B# ?
  26. #include <linux/init.h>$ J+ n# H' `" L4 a8 W9 l) b4 N0 u
  27. #include <linux/errno.h>
    8 p0 r9 q3 p$ G& w8 C( `6 q4 |
  28. #include <linux/types.h>
    ' \- p# u9 Q5 P
  29. #include <linux/interrupt.h>
    - m: ?4 m) c/ I3 z9 S7 C
  30. #include <asm/io.h>
      w. O. w4 S" B7 b: l2 r* r
  31. #include <linux/moduleparam.h>- P4 N. R# ^0 M
  32. #include <linux/sysctl.h>
    " v8 D. W! C4 Z7 e' \
  33. #include <linux/mm.h>  Y6 w9 q3 p- a/ e: w: B* F
  34. #include <linux/dma-mapping.h>
    3 {! k) M; `+ X$ i' F$ a

  35. 1 x  \8 B" r3 h; z% P1 U+ l
  36. #include <mach/memory.h>* P# z0 C' h5 p% Z& ]! E6 c
  37. #include <mach/hardware.h>
    4 Q: t- w2 [$ s+ P0 C- o7 D/ i3 G
  38. #include <mach/irqs.h>+ q5 k/ k/ X9 y% z) h* }  }. T# D
  39. #include <asm/hardware/edma.h>
    4 V8 S+ S8 X* h4 I" }6 o6 F% T! Y

  40. ( I2 M7 a1 O9 Z5 g7 X( r3 M! V
  41. #undef EDMA3_DEBUG
    4 i0 G7 G/ z: d6 a/ ^
  42. /*#define EDMA3_DEBUG*/8 a* t2 d( \: }9 Y  V6 Q

  43.   y& m5 z+ m4 R5 R& `
  44. #ifdef EDMA3_DEBUG
    * N1 \3 O3 l3 H' J+ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); H+ H1 F3 d! B" K* O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ E  n- l. {% a( M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- q4 Y, v5 P! ?' A
  48. #else
    3 _4 x- r9 K7 T- B
  49. #define DMA_PRINTK( x... )
    8 d' _# s: W7 c& |& p% J$ N
  50. #define DMA_FN_IN9 `$ F/ s# L" n8 O, B
  51. #define DMA_FN_OUT
    - J/ [/ G& j4 r2 v0 m
  52. #endif
    & E- j, b% o& R- B4 b( y0 x: G) e

  53. " O6 \  g0 W# d, p' z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) g3 g7 Z- g- F3 C: ], i
  55. #define STATIC_SHIFT                3
    ; T, S7 L, w1 k6 B0 b: c: @2 ?- P
  56. #define TCINTEN_SHIFT               20( g3 F* W' j6 _+ ?
  57. #define ITCINTEN_SHIFT              21
    & I: C- @0 W/ O- B. j% |' Q& r
  58. #define TCCHEN_SHIFT                225 A  t) c3 L2 K7 h. F
  59. #define ITCCHEN_SHIFT               23+ Y% L3 c) L, t; g; ^
  60.   ^) ]; H) v0 x. A) w) D
  61. static volatile int irqraised1 = 0;/ t! Z! x. W; s( S1 v$ o& O
  62. static volatile int irqraised2 = 0;7 B3 D+ `8 T5 g- E. p6 G

  63. $ q8 u! x! b# Z3 ~% t$ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X& c4 L! F4 e5 Z( j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 M0 c1 v6 d& e- F+ ~1 d+ z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D! {! w" d: I3 i$ M* a; L8 g

  67. % [5 K4 [) ~8 n7 y" B  {: z
  68. dma_addr_t dmaphyssrc1 = 0;, u6 A5 }/ B; c7 S
  69. dma_addr_t dmaphyssrc2 = 0;
    ; ]2 _6 n* i0 e" t4 z1 v: \
  70. dma_addr_t dmaphysdest1 = 0;1 j8 A6 s1 Z. a
  71. dma_addr_t dmaphysdest2 = 0;
    8 W3 |  Q8 l- b' @% E. |& f

  72. , u- I6 |* f3 [- Q9 m
  73. char *dmabufsrc1 = NULL;3 q5 X" X/ i' \, f
  74. char *dmabufsrc2 = NULL;
    7 a+ F/ a! b) }( O) V' V' k  c
  75. char *dmabufdest1 = NULL;1 R- @  ~6 J2 P4 \: W; w
  76. char *dmabufdest2 = NULL;
    3 F$ q& ~6 r7 r$ f7 ^4 }+ ?7 T1 y
  77. ' U% z3 c9 W6 |* y- D9 i; _
  78. static int acnt = 512;$ }% {' P2 x5 w7 ]. I8 M/ ?. O; {# ^3 [
  79. static int bcnt = 8;
    - a0 E9 `! y- i2 K, Z6 Y1 H' U
  80. static int ccnt = 8;
    4 A6 T5 s" n6 w0 S1 D) v7 q* S
  81. , S/ M. s* D& y* ~4 K) \
  82. module_param(acnt, int, S_IRUGO);- m6 @3 Y! a7 a' R: {
  83. module_param(bcnt, int, S_IRUGO);; Y& B* t3 o/ d) R" W# j( t" h7 a) J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" @  ]; L' [. W3 j: p

1 N2 q6 X! O8 `, e) }  U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 Z. M! d, w1 _& H0 H0 N( O4 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: q3 S. \* V3 C, S0 ^0 r3 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 U2 G6 Y$ @: Y$ V/ `# {7 M, v

0 M' ^, x1 }9 D. M& w2 s7 B# v% j9 Q& z- N  {" T5 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 12:23 , Processed in 0.039395 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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