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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ]# C! }2 A6 s1 L# E4 d# D
  1. [code]EDMA sample test application0 q1 X. C# V% E, N
  2. /*
    9 G6 m. P' v7 R! U+ k; a; o4 T
  3. * edma_test.c$ {. j- h7 t1 Q$ @6 _
  4. *
    ) M: X2 O3 @5 k7 s$ j0 \7 {4 c: L& w
  5. * brief  EDMA3 Test Application
    & y% z4 r* M$ d$ ]
  6. *3 s! E; f/ S, j& _! |
  7. *   This file contains EDMA3 Test code.
    ; j7 A: c3 T9 _: l8 m' a
  8. *
    * h9 ?1 u3 B( t7 {2 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; U+ M. g$ e+ S, ~9 X/ x0 s: w) _* o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 v1 E3 L: _! |6 p5 o2 t
  11. *         TO CHANGE.& t% \; \+ o" L+ S* A/ R& ~
  12. *
    * O1 L. ^' a8 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ u+ i$ ]. K) c! K4 J- _; h
  14. *
    4 [6 `7 N- l4 D) y' p9 U
  15. * This program is free software; you can redistribute it and/or' T( h3 ?. S& [9 e: T& P$ s& ]2 u
  16. * modify it under the terms of the GNU General Public License as! O- z3 H. L6 M
  17. * published by the Free Software Foundation version 2.) n. g( u$ W3 }) k8 _* f
  18. *3 u2 _0 c1 g  q4 F' K+ L& q( Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& w8 L  O. J# Q+ N" H* a
  20. * kind, whether express or implied; without even the implied warranty7 d/ c" ^# D1 l: F' J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( L/ n( h  S. ~$ G
  22. * GNU General Public License for more details.+ Y3 e: V! U5 |( r
  23. */  F8 g# Q9 Y* p. s1 K$ v

  24. ) t, |9 G# Y7 A0 a1 ^0 z( Q9 A5 m
  25. #include <linux/module.h>
    . a3 N; K( d5 I. ]3 |' A
  26. #include <linux/init.h>
    " B, K. @0 E6 g' q
  27. #include <linux/errno.h>
    $ }  v0 d1 _/ A! h  C5 [+ c! d
  28. #include <linux/types.h>+ m" R# D/ {* s8 d; `% v7 h
  29. #include <linux/interrupt.h>
    3 K' T5 t+ a4 [( I
  30. #include <asm/io.h>
    : S- s. G. v9 a: s
  31. #include <linux/moduleparam.h>& ~8 b& l3 ?% S( @# k* j
  32. #include <linux/sysctl.h>4 c; F( d6 X0 f5 m' A/ u+ a
  33. #include <linux/mm.h>% X5 i7 y6 w, b. E/ @# D- m
  34. #include <linux/dma-mapping.h>
    , f! D" V" O0 E; p0 ^

  35. 7 R) o  y# E( |
  36. #include <mach/memory.h>
    ( H' J( X- Q! |
  37. #include <mach/hardware.h>, l! x5 ~9 w1 l0 u0 J
  38. #include <mach/irqs.h>
    9 |# b( t; f5 v6 r5 D/ ]& B' |4 @
  39. #include <asm/hardware/edma.h>) p, X% R% i; |. J' f: i5 {

  40. " U2 }4 @* q' W2 K" |( q! `
  41. #undef EDMA3_DEBUG
    ' M* Y  |" ~4 k1 z/ U7 t" U
  42. /*#define EDMA3_DEBUG*/
    % ^. n2 C7 x1 Z
  43. % q9 Y5 |9 o( _2 o* {# \. n6 c$ ^
  44. #ifdef EDMA3_DEBUG
    2 |+ T, P- E) w$ c2 t* `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & s$ u! J/ {" C* F& u1 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % e  _# }2 X' A8 M6 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). Y; A2 _" x& [2 P) L0 i! \
  48. #else
    % C; X! B% p# ~2 l# c7 O4 i
  49. #define DMA_PRINTK( x... )
    + M9 I5 b* m7 V6 t0 R
  50. #define DMA_FN_IN
    ( a% g* r4 L' [1 S1 Y6 f
  51. #define DMA_FN_OUT" |9 M) m  q2 w, {
  52. #endif
    " T, B" n& ?' l/ K2 g4 w5 m
  53. # V& ?* ?! F; s5 j6 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + M. f; G: u0 [$ n9 v; {
  55. #define STATIC_SHIFT                39 R7 l4 K9 d( K- k2 k9 @. {
  56. #define TCINTEN_SHIFT               20
    8 @" T0 i; @- A3 k+ _3 n
  57. #define ITCINTEN_SHIFT              21
    # S" f9 B2 Q) c0 N/ o
  58. #define TCCHEN_SHIFT                222 C! v1 _0 k2 ~
  59. #define ITCCHEN_SHIFT               23  A  y) @1 b4 ~) a7 v
  60. ; b& ^8 G. H( \" [; _
  61. static volatile int irqraised1 = 0;
    . g1 @- i$ I& a- a
  62. static volatile int irqraised2 = 0;
    . w# y; t, E0 p/ P

  63. " i% s6 J% h# g  t8 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, i7 S) B8 g) F% ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( C/ ]$ H7 S" Q& S" F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G! Z5 ?/ v5 n: v

  67. - n$ V7 m* w5 p# a7 R+ c
  68. dma_addr_t dmaphyssrc1 = 0;9 p5 |. ^5 t3 ?( e  q
  69. dma_addr_t dmaphyssrc2 = 0;0 G. Y5 I2 s0 |6 Y& q
  70. dma_addr_t dmaphysdest1 = 0;
    / Z4 ~- M8 v9 @# f- K
  71. dma_addr_t dmaphysdest2 = 0;
    ' P9 h* n/ \3 {
  72. . O( ?/ m1 J1 m& w; l$ N
  73. char *dmabufsrc1 = NULL;. F3 Y, Y. x- \8 u* {7 y
  74. char *dmabufsrc2 = NULL;; U; H2 ^% p8 o# C: L
  75. char *dmabufdest1 = NULL;
    6 g% n' q5 y! h. Y
  76. char *dmabufdest2 = NULL;
    & V2 J; E0 J0 q! e6 Q# |7 [& h5 h( S
  77. 4 t7 H, G5 ?9 H! a: G1 x9 F
  78. static int acnt = 512;
    * {+ z: o5 G; n/ ?4 ]$ t9 x, l
  79. static int bcnt = 8;, M* X  l" S; N6 v$ X1 L+ m
  80. static int ccnt = 8;
    4 `: l- ~# p+ s! M3 g

  81. $ D" F$ {) i" O# {( j9 x
  82. module_param(acnt, int, S_IRUGO);/ e0 Q1 t7 s8 ~' I7 ~
  83. module_param(bcnt, int, S_IRUGO);
    & m  D$ H; A: ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- x  P0 x) q, k" e8 j, w. {% u
" _; p3 P1 A- h9 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, d9 ?* Q  ?* L8 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' u/ p7 O( E9 p4 s% K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! _+ _' }0 Y% G3 a0 e' X. g* \6 t( R/ F  n+ S

( C2 _7 C- F+ ~" |# Q8 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 14:11 , Processed in 0.040511 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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