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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 E4 B0 u9 A9 C2 `& x
  1. [code]EDMA sample test application
    , W4 `- F: f/ [+ G: r
  2. /*2 _/ B+ W& I8 N( t; m
  3. * edma_test.c
    5 C7 l8 p7 g8 p4 j5 A
  4. *+ e: }/ r. r1 ~
  5. * brief  EDMA3 Test Application% [2 V. _: }. k
  6. *0 `/ L! ]" q9 Q7 k+ p  k* ?$ Q
  7. *   This file contains EDMA3 Test code.
    3 v. p  O8 U  |! U
  8. *5 B# B' z4 _. ~( w# [1 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 U- I( W/ p3 g3 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 u5 [) ~0 {3 x4 e
  11. *         TO CHANGE.
    & p- K. D/ n" B) T. I
  12. *" F' c7 i( Q% |4 U! H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: z* O9 |5 U4 m/ V6 T5 T  Y" y  k
  14. *1 @3 F( U8 z8 Z1 S3 B
  15. * This program is free software; you can redistribute it and/or
    % p) `7 V+ I3 f. ]6 v2 i. }' |
  16. * modify it under the terms of the GNU General Public License as
    $ w$ g/ @5 h9 k! {6 L% K( b
  17. * published by the Free Software Foundation version 2.; A' _, T  |- U2 h; O8 i# ?; H! d
  18. *
    & E( s: U# F$ h4 w$ P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , M! C9 C9 H* T
  20. * kind, whether express or implied; without even the implied warranty
    9 P, q3 e- T- w( `' v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 w# l' Z6 D9 f) [* H
  22. * GNU General Public License for more details.0 B. x( x* w; [
  23. */
    & {5 ~& r! `( o3 A; l7 L
  24. 8 Q. k: ^$ F6 U& C6 m0 G. B
  25. #include <linux/module.h>
    ; r# f  m( {( R& U2 _
  26. #include <linux/init.h>6 g/ m9 r4 R2 c0 E
  27. #include <linux/errno.h>
      r1 _( y) H" _0 p$ E0 m& E
  28. #include <linux/types.h>
    ; V2 w* x% l7 X( N6 l/ x
  29. #include <linux/interrupt.h>+ {% m9 d6 L  ]  V# p) o/ G$ f
  30. #include <asm/io.h>
    6 H; A3 t  f1 v" B; D
  31. #include <linux/moduleparam.h>
    # D% v( L% e0 y
  32. #include <linux/sysctl.h>0 G/ F8 z% z9 F$ E: N
  33. #include <linux/mm.h>! r5 ^$ B; v; U
  34. #include <linux/dma-mapping.h>3 P- ]8 r- C% ^) r" J
  35. ( D, U1 s3 x- s0 F
  36. #include <mach/memory.h>& G8 T  A- `1 g  x
  37. #include <mach/hardware.h>
    9 g& q$ V) l/ j  Q6 v$ i7 I
  38. #include <mach/irqs.h>6 l5 U- ?$ O0 b+ S$ F. w
  39. #include <asm/hardware/edma.h>
    6 D- Q$ N, }+ N# w

  40. 7 Z* Z- W/ A0 }8 }& R! A9 \
  41. #undef EDMA3_DEBUG
    - x7 F' C2 Y" A) O' s! [
  42. /*#define EDMA3_DEBUG*/* l( z2 _7 R1 x. V9 X
  43. 5 {. \3 x5 H: Q) A4 B; W
  44. #ifdef EDMA3_DEBUG( x# Q1 M4 G5 U% f3 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 V% B/ A# d9 P3 m- U9 o, F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 j! n0 s" ~; V: W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) T6 p* t- `$ x+ Y7 q' Q+ o  ]/ j1 r
  48. #else
    & H# v8 y+ c, x( [8 v, h0 g
  49. #define DMA_PRINTK( x... )+ o3 n$ x+ d' S! ~! i6 x' w% C/ E
  50. #define DMA_FN_IN
    - I6 q, Q/ h' O8 W1 Z( E2 J& r, i
  51. #define DMA_FN_OUT
    8 S% D: D1 C% V6 o4 i& {$ t
  52. #endif
    ( L6 w8 k3 K0 q

  53. 8 d1 n3 K8 z2 @2 {& ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- u" N: J$ W8 `  ^# ]$ h
  55. #define STATIC_SHIFT                3
    $ N% [+ [! n, h" l2 \' N: u
  56. #define TCINTEN_SHIFT               20, Y7 U2 r  n2 M- X" z* G3 j8 ]
  57. #define ITCINTEN_SHIFT              21
    9 u: T; h0 C; S9 c* y
  58. #define TCCHEN_SHIFT                22) H& \1 n: k3 q7 V
  59. #define ITCCHEN_SHIFT               23- Q* U: W1 @5 t4 N8 K, M+ w
  60. 9 W$ v1 p. C1 y6 m
  61. static volatile int irqraised1 = 0;
    ; w* ~% X: q( {' J0 }9 I6 f; Q
  62. static volatile int irqraised2 = 0;
    2 \7 T: |( j$ W1 G5 K
  63. : Q! W) U) g9 H/ b0 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I$ M7 }& V- w/ H' a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w/ |8 ?5 E, N$ q8 w1 ~4 b% ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k# c, M& r4 n
  67. $ B) Z3 C$ x' v5 u3 g4 d6 k4 ^- [( U
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ^( {$ V4 U9 o% \/ \
  69. dma_addr_t dmaphyssrc2 = 0;
    . M3 ^8 A% R  T+ }
  70. dma_addr_t dmaphysdest1 = 0;, t' p6 D& O7 ~1 i
  71. dma_addr_t dmaphysdest2 = 0;) N: c: ?+ u6 Y0 T- l6 e8 Z7 B4 Z

  72. 4 H) Z6 m1 Q1 `  P1 F) Z" h
  73. char *dmabufsrc1 = NULL;
    8 x! i4 x1 ]: J" z# G) D
  74. char *dmabufsrc2 = NULL;1 U, N2 ^' t" x( u/ x( V, K
  75. char *dmabufdest1 = NULL;9 b/ {! d# c% G9 [
  76. char *dmabufdest2 = NULL;
    # f. r8 C2 C, W' W! |' n

  77. 2 K, v3 X& j  U; v$ P
  78. static int acnt = 512;! B' U1 T  R" H0 U; J: Q- T: p
  79. static int bcnt = 8;
    3 t% r- D. g+ l/ M8 e
  80. static int ccnt = 8;2 w+ P8 a/ w/ g% }4 p

  81. 4 }4 N* f$ a  }9 g) }/ T, D
  82. module_param(acnt, int, S_IRUGO);( y" ~( r+ W7 M* @$ J
  83. module_param(bcnt, int, S_IRUGO);
    7 l6 S; x6 l+ Z' W# w5 {  ]- G) A9 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 o% o# }! |3 q0 F
) m$ d+ z. J8 F: F( c& _! n6 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 h( D' {; Z. L6 G) d3 H! \$ b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ v: M+ x* c* V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, S3 C  s- ]! m$ V: l4 S7 X
. ?0 C4 q, N" Y8 A: t3 J& x; I& ]$ T$ j9 ?$ L! @  E/ E* K8 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 16:58 , Processed in 0.042096 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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