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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / h7 t2 V. S; D: j! W) @
  1. [code]EDMA sample test application& W9 x5 F/ U" O3 S( H9 a
  2. /*
    7 ]$ D* B) |# a6 t4 l
  3. * edma_test.c
    - ~+ p0 P" l7 L7 A% Q
  4. *- s: W9 e  [7 Z0 G. O
  5. * brief  EDMA3 Test Application: h# e2 Z( M7 H0 `/ Y: q
  6. *
    5 s, m, ]; g2 a" q1 j9 y
  7. *   This file contains EDMA3 Test code.
    9 F" H1 U5 D3 e/ X  ^
  8. *# x  p. D" B+ m, Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' y( O; u& c7 r" ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 |2 z# y& s7 m* k& E
  11. *         TO CHANGE." q' s' Q& `1 I# q4 e
  12. ** v9 z9 j' H4 F: a. T1 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( b9 W' H8 P& o( @9 z6 U
  14. *
    8 p" a% P$ l2 ?9 m5 t8 B% q* ]
  15. * This program is free software; you can redistribute it and/or! \; i7 O* o! w! K* d" k& K# I
  16. * modify it under the terms of the GNU General Public License as5 O6 c- X& u5 c! M& c% l2 Q2 k* C
  17. * published by the Free Software Foundation version 2.
    9 H, H' |, n, F3 H
  18. *
    3 T$ w: E" H" J0 E% g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 g  ?. U( \8 S7 t* Y
  20. * kind, whether express or implied; without even the implied warranty8 f4 M! ?0 K% l, v( I9 ]. S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  o& {+ q/ A  O6 N. N# @* g* _
  22. * GNU General Public License for more details.
    * Z1 v+ m5 ~; m( y( j
  23. */! x% O" Z/ T3 M/ L6 p

  24. 8 H, U8 D3 O6 D& b
  25. #include <linux/module.h>1 v9 @0 f2 R9 t% r
  26. #include <linux/init.h>
    " M% `7 S: y! z" I# I+ i
  27. #include <linux/errno.h>
    ! c; @2 M, z! ^! b7 f3 n
  28. #include <linux/types.h>
    , v+ v" m6 n- c$ [' M2 S
  29. #include <linux/interrupt.h>+ Z" F0 i" f, W3 t* s6 q/ N
  30. #include <asm/io.h>; `! |" y9 h0 t' y" m$ P; n
  31. #include <linux/moduleparam.h>. Y1 G: ?2 f8 D4 V
  32. #include <linux/sysctl.h>1 f& G0 M9 R" l& W8 A) A% K7 |! |
  33. #include <linux/mm.h>
    " A( K0 Y: f8 X6 d% |- @
  34. #include <linux/dma-mapping.h>8 z( Q' z# y. p3 l+ @3 O

  35. 1 }1 v. k7 H2 E6 r( p4 f9 E
  36. #include <mach/memory.h>
    ' m% }! `- i* w2 [
  37. #include <mach/hardware.h>" z8 v, f2 `. `1 O' j) ?+ m
  38. #include <mach/irqs.h>
    * O" ]: R% k' A8 R( A
  39. #include <asm/hardware/edma.h>
    0 P1 g9 A0 m$ E. x, U

  40. 8 a! N, Q/ b+ @' m( g
  41. #undef EDMA3_DEBUG6 d  _% C1 V/ R% p: a
  42. /*#define EDMA3_DEBUG*/
    1 H% [8 ~) E+ j4 V7 q, s8 t! V
  43. + s/ X$ ^+ T5 q* |
  44. #ifdef EDMA3_DEBUG- n: b' @( P6 s# f3 e4 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      y7 u- |& S* ^# J3 L% ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / @. L4 t0 I2 S$ G1 ^: O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ g8 k6 P0 ~; Z: F
  48. #else$ L6 R. }* b8 m1 U  I& e% @% y
  49. #define DMA_PRINTK( x... )
    9 q6 |) X6 e3 I: u( B/ n& }5 U
  50. #define DMA_FN_IN7 b4 z8 o7 N- a# ^
  51. #define DMA_FN_OUT
    $ B* ~5 Q6 k2 y% S! v/ @0 I
  52. #endif+ w! ?9 n2 N: w. ~4 s# U

  53. 7 e8 O- l- E' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 D8 c% I$ Y: L  g* K* ?. X
  55. #define STATIC_SHIFT                3# t2 c( K1 r* w; c
  56. #define TCINTEN_SHIFT               20
    ( a6 K& f( E9 Z$ x2 M
  57. #define ITCINTEN_SHIFT              213 S  q4 f, S, i9 B2 A# T4 l. O9 t
  58. #define TCCHEN_SHIFT                22
    7 _0 Y6 x4 I% P* `
  59. #define ITCCHEN_SHIFT               23: r7 c5 c$ m' \2 R* c* x
  60. 5 j; z8 F* p% o4 e2 a, @! z$ {% W
  61. static volatile int irqraised1 = 0;
    9 [5 O) i- z1 ^/ \9 b
  62. static volatile int irqraised2 = 0;
    $ h, g) P6 K  ?3 q! X
  63. ) |% B6 i$ I' N7 \! d% s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " e4 r% j+ l9 `) d5 b% H# ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 Y. K& a: X8 F% @3 \$ W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " H3 _) r/ G2 r, b

  67. . M# f0 J$ P4 b+ t- n3 N
  68. dma_addr_t dmaphyssrc1 = 0;+ N' k2 o0 v7 F! L
  69. dma_addr_t dmaphyssrc2 = 0;3 D# T+ |8 F- l0 m7 |8 ^
  70. dma_addr_t dmaphysdest1 = 0;
    0 o- j5 H6 w8 _- ^5 r9 z
  71. dma_addr_t dmaphysdest2 = 0;
    . V0 x! z6 _9 i6 o* P! {

  72. . J5 @% |# F( ~6 ?& Y2 n- u, Q
  73. char *dmabufsrc1 = NULL;
    ' U# k3 S0 ?# V  D
  74. char *dmabufsrc2 = NULL;; a& y6 g+ Z  N  Y& k6 j& C, R" V8 l
  75. char *dmabufdest1 = NULL;
    / E4 H: U! L# ?- b0 k6 s, ~3 H3 Z  T
  76. char *dmabufdest2 = NULL;7 A5 j- Q6 G" x0 }+ k
  77. / ~# b) u) v0 G2 |
  78. static int acnt = 512;
    - X: \( j2 P7 M7 @
  79. static int bcnt = 8;
    1 v9 ^& J6 z2 U  i, s8 t$ E
  80. static int ccnt = 8;2 D5 i, G, p0 m4 a
  81. 4 Y6 ^- V3 u8 Q
  82. module_param(acnt, int, S_IRUGO);
      ?+ M1 c) k6 I
  83. module_param(bcnt, int, S_IRUGO);
    3 P1 Y7 ]. g6 U6 m* F9 J3 q5 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Z8 _1 i" ~& ~0 V0 Z, f( w2 l
: [) h3 I( s$ J6 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 c& ^* \9 Z- l0 ~5 _" y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R* V1 X# H- R# z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' X8 ]) A! W' C. F
9 L$ n) f$ m9 T# b& Z7 R0 P! S
& D% ~7 M3 ?; v0 w9 V& i0 d  L" `3 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 11:56 , Processed in 0.041737 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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