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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 _- y; Q) t) U  ^% y! \; S# C. V
  1. [code]EDMA sample test application- _# Z! Z) ?, W
  2. /*9 N" U' X' B$ x+ d( V" s
  3. * edma_test.c' A& y, V8 U1 `$ u% D. N* l0 a
  4. ** U6 \, h! i' F6 H, J
  5. * brief  EDMA3 Test Application, ]6 Q& l9 R- g5 c
  6. *
    / l3 z, U0 V' x/ G8 C& `5 F- q0 b
  7. *   This file contains EDMA3 Test code.+ Z9 u+ `& \4 c0 }$ w
  8. *& c: H# O" A( p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 j# C7 j. Z+ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' _2 {: L# _, C* N! A
  11. *         TO CHANGE." b1 I( h" R( W1 H: |9 z
  12. *
    / S( j* B% e% H. D' @; N7 x, _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// U# D4 M5 E9 f; k+ d8 g
  14. ** S7 ^( N4 P* M
  15. * This program is free software; you can redistribute it and/or  N  R8 P+ c7 m7 p$ u
  16. * modify it under the terms of the GNU General Public License as5 |  `2 s8 I, [$ {
  17. * published by the Free Software Foundation version 2.
    # J# [" P8 Q: U" t' F2 W9 y
  18. *2 M$ t- H6 r, L& L6 H$ H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) B% @5 `' Z5 N4 G8 S* H
  20. * kind, whether express or implied; without even the implied warranty
    ; t! @% O# o1 \" O! g  C' Y! d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) ^4 E, v) I* N. ?
  22. * GNU General Public License for more details.
      o6 r3 D% Y. B6 S/ `% _+ W5 H
  23. */5 f, o2 J5 g: W' @& E  }
  24. % H5 Q  S& _3 R/ {4 H* s: s* r
  25. #include <linux/module.h>0 g  D. l* o/ _8 c3 Z
  26. #include <linux/init.h>
    ( W5 S  ~6 i' Z7 t8 V+ J& h9 L! j  B1 Y
  27. #include <linux/errno.h>
    " m7 P, h6 A: Q5 I
  28. #include <linux/types.h>2 }1 J" g8 A  Z- H
  29. #include <linux/interrupt.h>
    # i! V) g: A+ t" Q, x
  30. #include <asm/io.h>$ H' j8 c0 m1 g1 l  ?  T( x
  31. #include <linux/moduleparam.h>
    & d8 F9 J+ D- s" ^. k5 a4 q* m% d2 H/ J
  32. #include <linux/sysctl.h>
    4 ]( w' G! A" D7 x
  33. #include <linux/mm.h>
    # _- \: U$ A8 f: I7 Q
  34. #include <linux/dma-mapping.h>1 ]9 H$ w2 `% N) ]

  35. 8 o- _& x2 f$ {, Z
  36. #include <mach/memory.h>
    8 |* m0 m9 `( w, B
  37. #include <mach/hardware.h>
    ; Y# d) N. D' n% A# [- i9 a
  38. #include <mach/irqs.h>, e  S. @, b0 [* ~' C( n( ?8 P
  39. #include <asm/hardware/edma.h>* @9 Y) D3 `; L# }3 C* V* e5 G- N

  40.   D! A' s  h# f7 k* C4 d. t
  41. #undef EDMA3_DEBUG
    5 E9 W3 [( |. D& @9 s
  42. /*#define EDMA3_DEBUG*/! n- ~5 _. U, {8 h

  43. 4 X$ E. F, d8 Y+ s- ^# l+ M
  44. #ifdef EDMA3_DEBUG
    6 D; R* W8 a6 F1 l4 n% X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) L2 P% K$ `5 ?% V, ~6 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u- @& u- d  I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # q( ^7 o8 \2 i; g: b
  48. #else2 K/ \3 ~) J: |% s) ]/ y
  49. #define DMA_PRINTK( x... )) M) `9 Q3 f  D5 ^+ N( i
  50. #define DMA_FN_IN
    . s# e2 w- }6 Z% \% e
  51. #define DMA_FN_OUT
    9 F# g) X1 u/ V4 p7 A
  52. #endif6 m5 G( S- D0 P6 v% p! H

  53. 4 H2 R6 o) J$ i- I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ~  z4 U* v0 J6 Q
  55. #define STATIC_SHIFT                3
    # H* m* g/ s& p
  56. #define TCINTEN_SHIFT               20
    5 |, N3 K' s: |: ~- P% w
  57. #define ITCINTEN_SHIFT              21" l; \) y# [- a# q# |  W
  58. #define TCCHEN_SHIFT                22
    3 p3 v0 j$ v" D1 X4 B. Q
  59. #define ITCCHEN_SHIFT               23
    2 ]4 E7 _7 o, i0 C

  60. / ?! U" V6 ?7 k( j1 L% H8 R
  61. static volatile int irqraised1 = 0;, s  A  d! j6 C' _2 @- K$ n* u
  62. static volatile int irqraised2 = 0;
    # b7 u4 r" r0 f/ y9 }+ H

  63. * w0 @% N; v0 p# j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % b5 W8 l+ J* s, N' y! V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 T" Z. p5 W7 ]7 Q/ ]  V- B, B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  s8 K2 p9 k6 E
  67. # Q0 G3 P; t6 w( j
  68. dma_addr_t dmaphyssrc1 = 0;3 [2 U# G4 [- g- o; l9 T
  69. dma_addr_t dmaphyssrc2 = 0;; j" O3 \* M6 j# e9 `3 L2 v2 ^: m
  70. dma_addr_t dmaphysdest1 = 0;
    . v  ^# ]: _& t5 y
  71. dma_addr_t dmaphysdest2 = 0;, l! h: \* |9 g) r1 e! w" I

  72. * h& V5 i& Q1 W6 p
  73. char *dmabufsrc1 = NULL;
    1 v- l+ i3 H. @+ s- B4 m
  74. char *dmabufsrc2 = NULL;
      m! |) \- |# K0 Q& f4 n" x
  75. char *dmabufdest1 = NULL;
    5 Y7 n, _: y$ N# W
  76. char *dmabufdest2 = NULL;* \& H3 _$ P0 }8 g. }% p

  77. 8 `9 |9 N: \7 k, w
  78. static int acnt = 512;+ L% H, X. ]8 E& S* b  b/ [: t
  79. static int bcnt = 8;+ o0 M* `9 ~$ V
  80. static int ccnt = 8;, X5 i% d: I6 K6 J

  81. - M8 e  h" Q% N/ s
  82. module_param(acnt, int, S_IRUGO);. y' t0 y7 q- }4 Y) I, k3 y' e
  83. module_param(bcnt, int, S_IRUGO);+ ]0 `5 a7 @( Z& {+ T/ w4 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 I: V) V& d! ?4 z5 E8 X2 I, h$ o: A
& u! W3 l* j# K4 X, ^% e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]; k' w( T; ]5 v, M( U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# K0 i/ @$ E* m* R) S5 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 N. S$ C2 l; ^1 c% V7 r: I/ Q: C, s7 N4 n

: Q# D: w* `  x/ ?$ f0 {0 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-5 22:05 , Processed in 0.040089 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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