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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% k, ^8 N8 D% S. [4 B
  1. [code]EDMA sample test application
    4 a4 F7 t) A( u0 m2 `
  2. /*
    / J5 F  T. {8 C# L. J6 q
  3. * edma_test.c7 C+ q/ A: R/ s. V, S
  4. *0 z% b: f5 y' y& M" n
  5. * brief  EDMA3 Test Application5 i! N- n1 o0 ]" p0 }6 o& |- j8 K
  6. *
    7 a& z& {9 W6 k3 p9 e( Z* K
  7. *   This file contains EDMA3 Test code.6 l) M- A& o1 L
  8. *
    % w. r; W  f4 g8 s. v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. k; b, W6 l4 c+ g, c7 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. J2 b  E5 _9 r* q! P( w6 ]# x
  11. *         TO CHANGE.) ]$ P  r$ [$ A" d; H$ ^4 w
  12. *$ ], U' ~) c/ a5 R. s* Y! ?- S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 d. ~  A! u7 t' e+ s
  14. *$ n$ E4 ^5 G9 ^* Y8 L  ]7 d
  15. * This program is free software; you can redistribute it and/or9 t: p+ `9 m9 d
  16. * modify it under the terms of the GNU General Public License as' G7 O- y* |; r1 e7 u' ~
  17. * published by the Free Software Foundation version 2.
    - ^$ c- X0 t( R/ G5 R1 @4 k
  18. *# w) v. x  E/ Z( g+ S1 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 a4 [8 j# \$ {8 s+ d' }! `
  20. * kind, whether express or implied; without even the implied warranty
    3 N. y; e8 {& ^8 d8 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* H7 O9 @; P* F7 d/ R2 i! l/ f  n8 _
  22. * GNU General Public License for more details.
    2 o6 _# G1 v- n
  23. */+ o. V6 U' U+ d. U1 e6 e& U
  24. 2 v: `" D" X- q2 J
  25. #include <linux/module.h>/ T% m3 |+ u  p& e. \5 o1 M- M7 z
  26. #include <linux/init.h>5 y9 N  V2 j+ }$ c" v
  27. #include <linux/errno.h>
      R3 B7 O( l# |5 A$ w2 n! D
  28. #include <linux/types.h>
    5 w9 L$ l8 C$ [3 y, `6 P' a6 r$ h; D
  29. #include <linux/interrupt.h>
    $ H% ^" u% j3 r; b; N
  30. #include <asm/io.h>
    ) n' Y' b2 W- _/ u1 H- H4 d7 b! Z' M
  31. #include <linux/moduleparam.h>$ @& e/ e0 P6 r, Q1 D! n; M& b/ q
  32. #include <linux/sysctl.h>
    / ^, ]- \7 ?, H/ C4 R. G
  33. #include <linux/mm.h>
    . N" S) h8 ?4 |2 N+ u
  34. #include <linux/dma-mapping.h>( }& w8 c$ U( v, e5 n0 g
  35. ! E6 F1 S- P" g8 ]
  36. #include <mach/memory.h>( Z2 k1 G: q' u! I# q
  37. #include <mach/hardware.h>
    * f& D$ F; r, r5 U( |& g
  38. #include <mach/irqs.h>; d1 o7 x; \* ]3 N5 k8 b* [6 |
  39. #include <asm/hardware/edma.h>, d7 Y$ E9 s9 @. e' i+ Z

  40. 2 q8 R" t. P( H( b- D; H
  41. #undef EDMA3_DEBUG/ x$ F. P/ q. p; X1 L# p  i
  42. /*#define EDMA3_DEBUG*/* w" \5 \7 z$ H; N
  43. ' n/ j" W+ C% y8 F# c" a
  44. #ifdef EDMA3_DEBUG
    4 S+ {. B7 \, \9 ^- ~6 X, H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n& u4 t. o% x0 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 b5 g  d$ A# ^$ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . }! i: t) v. C8 c( Z2 f# \
  48. #else
    ! h* d+ L4 n1 H: A) |
  49. #define DMA_PRINTK( x... )) J1 B) I* i6 V3 t" t
  50. #define DMA_FN_IN3 v) @% L3 _* }
  51. #define DMA_FN_OUT% |( @' D( M9 E3 F- X! X+ X
  52. #endif
    0 H- @6 L  P8 _) m  C" j! ?

  53. # n  q( O$ R' {' L% t- u8 x7 R( L. t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 U! V: u1 Z2 J7 u0 T6 H( O  A
  55. #define STATIC_SHIFT                3
    % S9 Z, H( t* t0 K0 \
  56. #define TCINTEN_SHIFT               20( i, J3 o3 }2 Q) o
  57. #define ITCINTEN_SHIFT              21
    $ R. r6 ?5 d7 X) B! H) e
  58. #define TCCHEN_SHIFT                22! T# g8 H8 e8 B: Q2 f" T9 E/ w! L  M* l
  59. #define ITCCHEN_SHIFT               23* i1 h8 T: h+ t; F

  60. 7 s1 D5 ~8 b2 v. }4 i
  61. static volatile int irqraised1 = 0;2 f1 \/ {3 V2 D. p
  62. static volatile int irqraised2 = 0;
    / e- T2 S6 I# x1 I+ s, P# [+ t. s
  63. . [" z+ r- `# v  K' l+ B2 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F  w& @9 B- G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 S$ r0 d8 s, i4 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R, e. w/ I2 v

  67. 1 M: x; [! m- _, Y: b( F. `
  68. dma_addr_t dmaphyssrc1 = 0;# R8 d/ {% |/ a. {
  69. dma_addr_t dmaphyssrc2 = 0;
    0 y) q# X; B6 y3 X$ s, r" e' d$ d
  70. dma_addr_t dmaphysdest1 = 0;
    6 Q% A- t! J  \, D9 X
  71. dma_addr_t dmaphysdest2 = 0;
    * T" ~$ ?; s' k2 D1 M

  72. 6 z' `% V8 g. R) n# g; g9 X
  73. char *dmabufsrc1 = NULL;2 A  Y; s! z/ z! V- V5 M
  74. char *dmabufsrc2 = NULL;
    " l& J- u$ s) C/ X0 k
  75. char *dmabufdest1 = NULL;
    ) k: g7 A" Q5 P  W6 e
  76. char *dmabufdest2 = NULL;+ Y& m$ r) z+ t) `& U4 z0 X4 C+ |
  77. , Y# C. g2 |# f2 F4 Y/ |) t( v; Q
  78. static int acnt = 512;- R: d' A& d# c2 I! V( ?6 Q
  79. static int bcnt = 8;) D) H" _. }0 x$ |& \: P
  80. static int ccnt = 8;
    4 F& ]$ e0 i; R3 p/ j6 j# R
  81. . a  T+ J' ?) z" m
  82. module_param(acnt, int, S_IRUGO);
    . c# ?' f$ I5 l& U
  83. module_param(bcnt, int, S_IRUGO);6 C9 @& Y9 q7 @, O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) P- P" z) n/ U, Y" C) w: S! s* K/ J* X6 |! Q4 U7 A, ~% w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 W+ i$ p/ j, L7 n+ o' j4 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ c+ w2 j  D3 \; r2 A  D$ \. n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  q; {% m1 L, i; |$ L; L2 k/ u8 P6 u* ?3 d* B6 ]  [9 C

: {; y  J. ]. ^; |5 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-18 16:59 , Processed in 0.042621 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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