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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, f; R2 l* t5 k4 U* y: x
  1. [code]EDMA sample test application
    / R; h# I2 u" u7 I
  2. /*
    ; N% ?; Z2 x# H4 K. N" L4 |
  3. * edma_test.c: d6 ^( P7 q) I7 b
  4. *
    9 X; i' n9 A: l, }; T* H
  5. * brief  EDMA3 Test Application) a# f+ A* Z! G! c% L- A' V
  6. *7 E, I% r8 C3 i& t3 k
  7. *   This file contains EDMA3 Test code." V% ^, C$ n2 ~( o
  8. *
    ) \) |- ]/ L1 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) o& {1 L+ o1 m7 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 H, }/ V: i$ W
  11. *         TO CHANGE.
    4 l& y: _, }% Q: T; W0 S
  12. *
    : g" t3 C0 ~  f' z% W/ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, `2 S+ A; J" d, K& k5 Q4 p/ v
  14. *
    4 K5 H5 h4 E' x3 C
  15. * This program is free software; you can redistribute it and/or
    ( F$ f2 ?+ u& u8 v$ i" U7 S
  16. * modify it under the terms of the GNU General Public License as
    & o; |. d3 Y6 P5 h! }. Y/ n3 ~" i
  17. * published by the Free Software Foundation version 2.
    : }! n; z( a: a) U3 v2 i$ t7 X
  18. *; _; k7 }4 o' i$ B( u% s" e- V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ P$ b, W. w* K4 X$ G2 r: s2 F
  20. * kind, whether express or implied; without even the implied warranty0 A+ I. s# T+ e6 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! R* q& \- Y! h
  22. * GNU General Public License for more details.1 F; M. I, B; W- E) X: L
  23. */
    6 g- R; U/ o* y4 O
  24. * u7 c' F  p9 d4 h+ r: s0 K
  25. #include <linux/module.h>
    * I: ~4 Z( t# i- r/ |1 I
  26. #include <linux/init.h>8 ]$ u! @$ Y* U
  27. #include <linux/errno.h>+ S5 Y3 u8 e1 R! f9 g, d
  28. #include <linux/types.h>
    7 ]9 Q2 |# e# M6 r
  29. #include <linux/interrupt.h>
    : g' z/ [  ?' t5 J; v
  30. #include <asm/io.h>
    / ]1 S* P) d* w+ c! |
  31. #include <linux/moduleparam.h>
    1 g/ z" v- O( M% V3 t3 r" t* v
  32. #include <linux/sysctl.h>% ]% g; X7 g$ [2 {* K3 a
  33. #include <linux/mm.h>
    # g) b* t! I( C% b' S% Y8 {2 X
  34. #include <linux/dma-mapping.h>6 D, k& p/ ]/ h9 }7 u. x+ X
  35. ' }" A" R0 N3 U8 Q9 W9 |  X
  36. #include <mach/memory.h>
    $ d' V, k  r$ ?' L/ v' N
  37. #include <mach/hardware.h># O7 B5 E) C* |$ k
  38. #include <mach/irqs.h>
    9 l6 o( |5 v. g, _1 Y
  39. #include <asm/hardware/edma.h>
    $ t; C$ [$ b. Q) [; c/ G

  40. ) T. p  ^5 `" |! a! |3 P
  41. #undef EDMA3_DEBUG
    ! U( T3 ~8 ?5 }) t3 D4 H* ~
  42. /*#define EDMA3_DEBUG*/6 ^/ l2 L1 f& A7 H5 W' ]  B8 B: r

  43. 6 A$ E1 T1 y* l
  44. #ifdef EDMA3_DEBUG- V* g) t$ W- @: T4 ~1 z& i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 S% Z5 n  @" z0 P7 u' J0 ^9 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 B' X4 }" d5 p* K7 L. S1 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @' f: C% E4 u
  48. #else, Z7 x" d* P0 A6 \5 K7 c
  49. #define DMA_PRINTK( x... )0 s2 g- ]6 S  S* I
  50. #define DMA_FN_IN
    # a9 g9 q( e; ]! b9 H
  51. #define DMA_FN_OUT' k+ Y1 a. L1 P, P$ Q* _% ^7 U
  52. #endif
      B- V$ f6 b) Z

  53. - A& H0 r& |8 ?; z; S) }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# H* e  ~" @4 s4 |  ?3 x% p
  55. #define STATIC_SHIFT                3
    - s) `7 j) V5 j+ y8 V0 M/ {2 R
  56. #define TCINTEN_SHIFT               20& c2 m3 B8 J2 d0 ^# s9 I1 o
  57. #define ITCINTEN_SHIFT              218 R  n" C& m, w4 |
  58. #define TCCHEN_SHIFT                22
    ' n5 p! \7 _4 B: U0 S8 I
  59. #define ITCCHEN_SHIFT               23" k* i- @) i: Q! w
  60. 1 d; g' @7 V. ~, z/ D# W: C
  61. static volatile int irqraised1 = 0;
    ( }& Y3 W4 T- K9 Q" d+ {3 H
  62. static volatile int irqraised2 = 0;5 F. x: w* r4 P3 T
  63. 9 |% ^4 Y: R2 \$ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 d/ Q9 I, y2 t7 d+ U# g9 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K( j$ @- G) _. l/ _, r9 j: l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      T# {7 K4 t/ N$ }- J  P3 r2 j2 d
  67. $ w; E0 l* ]1 ^4 \
  68. dma_addr_t dmaphyssrc1 = 0;
    , G- w0 |) J1 E! j% M
  69. dma_addr_t dmaphyssrc2 = 0;
    ! v/ B% x* z7 c, M
  70. dma_addr_t dmaphysdest1 = 0;
    1 F* Q2 s0 u; y4 V
  71. dma_addr_t dmaphysdest2 = 0;" @" v2 k6 l  M7 t8 ?) L

  72. + A5 }, k* V" ^
  73. char *dmabufsrc1 = NULL;
    , `3 `5 X/ i+ d7 I+ Y
  74. char *dmabufsrc2 = NULL;
      j3 T( w+ D! N6 J4 Z& Q
  75. char *dmabufdest1 = NULL;0 _, m4 t2 H- H+ m5 ?2 ]5 R5 G
  76. char *dmabufdest2 = NULL;$ j4 R+ c3 K! b( b6 ^1 m' v+ @  s8 |2 P& [
  77. 2 Z6 V; [( H) N
  78. static int acnt = 512;
    * N+ @# G1 o+ ^$ n5 y
  79. static int bcnt = 8;
    4 w  x  J/ T& n7 u4 P
  80. static int ccnt = 8;- h; R! D* u5 F5 F

  81. " U8 \( ^# u7 H
  82. module_param(acnt, int, S_IRUGO);
    ( e8 b! [# T/ S: j) x
  83. module_param(bcnt, int, S_IRUGO);
    6 r: F- y2 ~2 i: E4 g$ y: ]  D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; o9 K, n& l% X2 R7 H2 u/ ]

& D- t$ l8 _3 [$ L" c' w# _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 a+ z  Q: q. H+ E( Q* {; C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 k6 p' ?% Y) i7 \; Y2 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( p, d7 _) v- R5 m8 [7 J, x9 u
  h# L* z9 `( U; k$ \6 d8 i
: p" i0 x7 G8 _, n3 E' Y4 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-1 21:33 , Processed in 0.045558 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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