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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' r) G9 s; a8 B- @7 o
  1. [code]EDMA sample test application' v, q+ T( n0 i
  2. /*
    * F3 D9 \% Z) d. I6 F
  3. * edma_test.c
    : D' m5 ~: v) _% B) V& T& J
  4. *: c) G( [% b0 H
  5. * brief  EDMA3 Test Application$ _$ H+ x& |2 l+ Q  ?0 j4 ~9 |; e
  6. *
    8 ^0 D8 e1 O/ X7 H3 t' A
  7. *   This file contains EDMA3 Test code.7 |0 J8 u" A6 L. T( D
  8. *4 @# T. i: s- O! @3 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! U3 c3 C! h+ J' W* s; C6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 P) o1 r8 y8 q& h0 g6 S8 d
  11. *         TO CHANGE.7 c: H6 `! x4 e/ O" p
  12. *
    - m' s# S$ X2 ~, w& _: h6 @! Y6 M6 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 |; N* p! M5 E2 O% V2 E" f1 ]
  14. *
    7 t, s$ B4 z# \- ]7 k1 V: p! A3 f( n
  15. * This program is free software; you can redistribute it and/or
    + q3 S: `8 }( K4 f3 ]* u$ o
  16. * modify it under the terms of the GNU General Public License as8 b  }$ A+ ~. d! j/ f+ d$ V
  17. * published by the Free Software Foundation version 2.4 V) u2 t$ Y) T& D/ X
  18. *+ h4 k& Q' V1 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o4 I$ j4 T) d1 t" T
  20. * kind, whether express or implied; without even the implied warranty
    % {0 ~& f+ [9 ~6 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! X2 }  O1 [# Q' |
  22. * GNU General Public License for more details.
    8 }+ t5 t4 `' D' a  E
  23. */" i% b) c# O% g8 q2 C- I- t; F

  24. . y" Z1 |1 i9 A& W& x$ l+ C, F
  25. #include <linux/module.h>6 d, n. b7 ]  E% Q8 k# B
  26. #include <linux/init.h>
    , a" J+ J! ^% F5 [1 b, \5 ^' s; }
  27. #include <linux/errno.h>' m; o' D; ?1 B8 G
  28. #include <linux/types.h>
    $ z3 A7 ~: j+ {9 t
  29. #include <linux/interrupt.h>
    1 D" i" @  F! c, A/ X' Q
  30. #include <asm/io.h>
    5 J# N' h8 V- r% Y- ^! r1 J& d2 t2 J
  31. #include <linux/moduleparam.h>
    1 H% c& u. y4 O* @  @8 O6 M$ R7 ~
  32. #include <linux/sysctl.h>1 v3 Z4 r7 T) }5 k0 s) E; C
  33. #include <linux/mm.h>( t! ]3 S3 E9 {
  34. #include <linux/dma-mapping.h>3 G  F7 z, L9 a' @+ _' |
  35. : s1 }9 I6 L0 X# O. ?3 g8 S% z
  36. #include <mach/memory.h>
    " G2 i0 f/ N/ L, `; a( [& t
  37. #include <mach/hardware.h>9 C2 U% G. _4 M  U/ d
  38. #include <mach/irqs.h>
    / X3 }! n  b3 l2 l( n
  39. #include <asm/hardware/edma.h>7 g3 I0 x/ r. C
  40. , e2 q+ _( q0 q1 H4 t
  41. #undef EDMA3_DEBUG
    % i9 [/ s  w6 y5 [1 @
  42. /*#define EDMA3_DEBUG*/
    1 |* z! S5 \8 w( o' E
  43. 5 c0 w' v7 ?0 d
  44. #ifdef EDMA3_DEBUG: ]' Q0 A' M- O; d: P9 C) {+ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " l& E: [# J9 u8 c0 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 u/ \" ?3 k/ `& k" u) i, [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 ~! e* {/ V7 @9 t4 s! d
  48. #else: l5 c, V" ]0 J  t' V
  49. #define DMA_PRINTK( x... )
    2 ^- q1 o& i- {, i& Y( \" s$ S
  50. #define DMA_FN_IN- ^. g' r8 Q7 _" M' |
  51. #define DMA_FN_OUT
    " H. ^; b+ U: H2 ?3 l
  52. #endif
    4 t, |% T) n' k$ o# r# c/ h2 k8 O
  53. / f+ j$ h5 h! W- |' @/ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). [- u3 G" E& m9 F! S
  55. #define STATIC_SHIFT                3. ~7 u8 @9 X  s+ C0 p% ~+ ]
  56. #define TCINTEN_SHIFT               20
    7 X6 K* z! n. _/ }6 A
  57. #define ITCINTEN_SHIFT              21* W3 c4 B& a  n
  58. #define TCCHEN_SHIFT                22
    4 Z9 T% m9 N1 s0 `4 s0 j/ {7 p* S* B  K
  59. #define ITCCHEN_SHIFT               238 V- K& o. G7 q3 p4 v) u

  60. 9 ]. x8 m; }+ C  T( s: {
  61. static volatile int irqraised1 = 0;% S9 v) O1 \$ Z5 S( K8 j6 z( ^# B
  62. static volatile int irqraised2 = 0;9 L+ @, a! t5 h( C; L8 a) _( J
  63. 1 @2 e) Y1 X* m) }9 ]" v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Z7 G* c4 a8 z4 g: J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c' }) B/ e% b4 E: s5 X) R% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J6 `5 L+ I2 ?; v. y0 v

  67. / R( L$ o9 N. v, }/ C9 P9 K1 T
  68. dma_addr_t dmaphyssrc1 = 0;
    # Z' F- S2 o) ?" [  D9 J4 i
  69. dma_addr_t dmaphyssrc2 = 0;
    , L' l. j% \9 \) H# f
  70. dma_addr_t dmaphysdest1 = 0;
    / u* v4 `& @7 V. ]3 o. Y7 K/ t0 i
  71. dma_addr_t dmaphysdest2 = 0;. d1 G' Y: G- K
  72. . V. p( J8 q) ?! D
  73. char *dmabufsrc1 = NULL;
    % V. f7 l# `* r1 X
  74. char *dmabufsrc2 = NULL;. Q( H$ G0 O# W4 Z' F$ D8 H
  75. char *dmabufdest1 = NULL;
    * ~9 L5 V3 N, H6 H" R) E- n. P4 R
  76. char *dmabufdest2 = NULL;
    : R- ]  a0 b: w7 x1 `

  77. ; E  W/ T8 D* k! R, j4 Q: P
  78. static int acnt = 512;1 w1 z9 `. g% t' V# {0 r/ ^8 H; q
  79. static int bcnt = 8;
    9 v% D9 @% _$ c4 c1 ~- C
  80. static int ccnt = 8;
    . |3 u( v. b5 a# V6 I: v2 D; |4 ?
  81. 3 N8 U! z5 O8 b/ r$ y/ i' K
  82. module_param(acnt, int, S_IRUGO);
    6 l! J4 m. R& }
  83. module_param(bcnt, int, S_IRUGO);
    * _7 C: `9 @% t" d* w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 G! |9 k- {; [9 k! V. _
. x7 p2 F8 g% ^) R$ K5 f( p( t5 {; e2 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, V2 M$ I1 i+ G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q! j  Y7 y  j% H* c( I$ \( X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 P* H% I5 p' L0 G' y
0 s0 u! k% J3 z- a3 F9 \& t
" H, @7 c. h* C; G6 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 05:08 , Processed in 0.039825 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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