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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + x$ H" `4 L+ p6 o: W
  1. [code]EDMA sample test application9 [$ p) {' @* ^' H
  2. /*6 u; M7 K0 @- C! {: b
  3. * edma_test.c
    , i3 L; V  F; T  o$ l! c
  4. *
    + `0 j0 J& ]7 d2 S+ F( l( G# h
  5. * brief  EDMA3 Test Application
    3 \% n$ w( K" ^) Q
  6. *% i" |* _+ A! Y( t4 g+ h
  7. *   This file contains EDMA3 Test code.* j- G. R. ~+ [! c
  8. *
    # W4 i+ |* V8 {+ n; p" B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 ]8 n  \, W: Y$ I$ s6 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 h1 L5 ^. l: i1 i' N. a
  11. *         TO CHANGE.
    ' J" e* n& K  `! W
  12. ** a9 n5 }; K) F% B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  d+ l  ^) R9 H/ w
  14. *
    5 M& S% P- R* G" z
  15. * This program is free software; you can redistribute it and/or
    / Z9 D  G# \& F" S7 R
  16. * modify it under the terms of the GNU General Public License as$ A+ l( k2 l4 Z3 f1 `
  17. * published by the Free Software Foundation version 2.
    ' E% Q, B5 A4 ^5 Q2 @8 u
  18. *
    ; ]! D: f  z3 _4 t: {1 n/ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; n, W( o" b" X9 m
  20. * kind, whether express or implied; without even the implied warranty+ W, p, Z  K0 k8 L/ Z5 c+ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: |1 k" X+ p# ]* O% e1 S
  22. * GNU General Public License for more details.
    5 h/ g* a3 j2 H. E
  23. */$ A  x% b4 q0 a+ Y7 o5 e$ |

  24. : \2 m$ X$ S6 X6 @2 ^+ V
  25. #include <linux/module.h>' a( J) a- \: ^
  26. #include <linux/init.h>
    ( T% t7 W/ {" f
  27. #include <linux/errno.h>& u# l( l& N$ Q( ~- `8 L
  28. #include <linux/types.h>
    " X1 h$ }+ n! i& s' a; s9 Y
  29. #include <linux/interrupt.h>
    9 S7 k; t: G$ _6 L2 a, L
  30. #include <asm/io.h>% f) {/ d( L2 F0 x8 B: e- r
  31. #include <linux/moduleparam.h>5 ?1 ]3 f1 X1 u! N3 R7 w
  32. #include <linux/sysctl.h>$ E) ~6 j2 s& o4 F; Z
  33. #include <linux/mm.h>1 k$ K3 }4 x! O
  34. #include <linux/dma-mapping.h>( }# {& `$ A( x+ o) J, Q0 f- d5 I

  35. 0 I/ z) f+ q$ f) c: [& d
  36. #include <mach/memory.h>" ]- v, B8 w  q3 r; k' L' G
  37. #include <mach/hardware.h>5 F- R4 X) ]: ?9 h( U
  38. #include <mach/irqs.h>
    ; ]8 @8 b1 h) Q+ t* ^- r
  39. #include <asm/hardware/edma.h>
    7 h0 Z: n% }+ d4 |
  40. ; q: O# G" {3 v2 c, B7 ]
  41. #undef EDMA3_DEBUG) D* J6 U+ |6 y: E1 t
  42. /*#define EDMA3_DEBUG*/. \# z" U, s, V! F

  43. 5 b) Z8 d$ y6 \+ @
  44. #ifdef EDMA3_DEBUG7 Y6 M  u8 j5 W5 V+ [7 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' s5 L  y) |1 W* N9 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) e8 b" o- M, p8 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V9 p5 r4 r. L
  48. #else9 c) V: X" m; `
  49. #define DMA_PRINTK( x... )! i1 O+ X. s5 w% F% q/ j
  50. #define DMA_FN_IN
    + t2 w# J7 a+ Q6 S: E3 ^. P9 e& {6 X
  51. #define DMA_FN_OUT) J+ P& Q5 D$ m
  52. #endif
    4 O6 Z" O, L+ P% t+ k  `4 d( W
  53. : V. Q, I9 @4 a2 R3 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / @$ `+ M  x. f3 s* X2 q( {
  55. #define STATIC_SHIFT                3
    + i1 N+ H. H: [" ]- e! a3 u
  56. #define TCINTEN_SHIFT               208 n  U9 k, `* N" m/ s
  57. #define ITCINTEN_SHIFT              217 Y0 O2 s  T: |2 ?! u& N0 D8 N3 W
  58. #define TCCHEN_SHIFT                22& @. L1 U- s4 F% H+ Y# L; `
  59. #define ITCCHEN_SHIFT               23, E  d9 U. Z4 n5 \5 Q, e3 @

  60. . H- L9 K" Y; k1 {  s$ C
  61. static volatile int irqraised1 = 0;! ^, N; N0 |. f% x
  62. static volatile int irqraised2 = 0;* k6 B. A4 p& q9 ^
  63. # S. @0 s! j. w+ W' W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H: c/ W/ K+ m* r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + r! s+ U3 C3 X5 n7 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % d; @6 N6 U- s$ h
  67. " G3 u7 g! h% m( J) \; p/ x* |, s
  68. dma_addr_t dmaphyssrc1 = 0;
    5 {8 K8 Q' b- ?  y
  69. dma_addr_t dmaphyssrc2 = 0;
    + [; M% w6 ]" d% i: H
  70. dma_addr_t dmaphysdest1 = 0;( _$ ^- A4 u: w! Y$ p8 G4 ~
  71. dma_addr_t dmaphysdest2 = 0;7 W2 g/ e! ?4 g$ n3 B
  72.   S' |. J( I9 [% ^5 ?$ i3 Z
  73. char *dmabufsrc1 = NULL;
    % ~, }7 A0 u% }& E; e
  74. char *dmabufsrc2 = NULL;
    & o& ], r- ]6 s
  75. char *dmabufdest1 = NULL;$ O; {$ b' g4 R/ c7 H+ g* x8 e
  76. char *dmabufdest2 = NULL;2 c+ k5 K+ w; h5 C% ^+ \! L8 `( H

  77. 2 y8 K! D# W" d3 {
  78. static int acnt = 512;
    / Z, N" b: I' ]+ S) w
  79. static int bcnt = 8;1 a- J* K) Z: m% x- V# G# I4 V9 V
  80. static int ccnt = 8;; e8 K; j" ~& _& z5 S4 T
  81. : u* b8 ?, j$ f+ R' Q; C) Y' `
  82. module_param(acnt, int, S_IRUGO);
    : I! b6 ]3 T1 v2 O( x
  83. module_param(bcnt, int, S_IRUGO);
    , e. U9 N" U: u" C* j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  {; H9 [& }# H2 E: I
! X+ @* x; s4 G* W  i0 D+ K$ {3 A2 l' w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k2 B6 v! _+ ~) M2 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 o/ e) `5 J% ^0 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! n4 [/ h/ B7 a1 Z
4 Z  Z8 w/ _8 p2 k  f

1 B- v; J$ W/ e. h* m$ i" L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 00:06 , Processed in 0.042876 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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