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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o( m* X7 ]; R! D  \
  1. [code]EDMA sample test application0 B6 b- W! F/ N) }! r
  2. /*
    8 |7 I$ |. f: x, x' F
  3. * edma_test.c1 Q5 _; i5 M" u" x8 K. \/ F* p
  4. *5 x) c4 v/ x9 G# D( I
  5. * brief  EDMA3 Test Application
    $ O: g8 L% w' k
  6. *% e2 i# P3 x+ I
  7. *   This file contains EDMA3 Test code.
    8 \. B5 _/ ?) h; x. A
  8. *1 ]! L) `: y( M8 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- H/ m, U" H) P0 u- ?% u6 w2 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Y5 F: g* j8 g5 j: d: D7 k
  11. *         TO CHANGE.
    # u2 O, H. s6 C% B3 U$ b
  12. *
    2 j! }) s- `$ c, Q: C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  j3 T( ?1 W" ~8 S4 [
  14. *, e3 ?; O2 F$ x4 H6 Z! a
  15. * This program is free software; you can redistribute it and/or
    & {0 V$ K2 j. r# N) @, B8 B( J
  16. * modify it under the terms of the GNU General Public License as' u- r8 W# _8 ?0 Q' x
  17. * published by the Free Software Foundation version 2.5 t* K$ \2 A8 D1 \
  18. *! A: V; i2 ~' i0 W; d, d, \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {. r2 N  M; n9 l8 T4 E  `
  20. * kind, whether express or implied; without even the implied warranty# Y6 b: S' o% D; s' R1 i& s. a0 \, g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 l5 x) b% o$ M6 T: ^' ]0 A
  22. * GNU General Public License for more details.
    - |& ~: f: t) g5 j8 H/ b5 a
  23. */
    % E6 K9 K$ Y5 L+ T

  24. / E6 D" Q: A% E# j  v
  25. #include <linux/module.h>/ r/ L, o9 Y: o, C; n
  26. #include <linux/init.h>
    ; w' ]! J: P5 y1 C+ F5 r
  27. #include <linux/errno.h>
    : o0 G% \- J  |: {5 q$ e
  28. #include <linux/types.h>, s! [0 v" ?# Y* R7 X
  29. #include <linux/interrupt.h>; D6 z9 i) m- h  j8 [- O- \# d: V
  30. #include <asm/io.h>
    0 i! t5 o+ r% F" l
  31. #include <linux/moduleparam.h>
    , m5 l: p; t, h2 R( e& r
  32. #include <linux/sysctl.h>! P* Z" k8 T  F: L; }
  33. #include <linux/mm.h>/ q; J0 }& h4 K% ~( ?# I' ]
  34. #include <linux/dma-mapping.h>- |2 J% M+ t" F1 g5 i5 U# c
  35. ; \) Z3 y3 n: D. d5 H
  36. #include <mach/memory.h>+ r: x2 w: |: `; m- L
  37. #include <mach/hardware.h>
    + {3 L; N7 p, m8 @% y" c
  38. #include <mach/irqs.h>0 ^3 ]" B( G5 _4 @4 K
  39. #include <asm/hardware/edma.h>
    # A) Y6 _, p% O

  40. 3 I6 r5 n( `6 N6 E4 K; _& |
  41. #undef EDMA3_DEBUG
      C+ m9 e+ E0 Y) J2 P
  42. /*#define EDMA3_DEBUG*/
    ; a; D/ I3 I/ y

  43. ) n+ S& H. s8 w; z) p% f  Y# w
  44. #ifdef EDMA3_DEBUG
    ' i8 r- s$ V' v- d( {: o" R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + h& ]5 o* k$ c% ]; ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); _( z0 z, Z+ o4 k0 i- y  d* [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v* V" C. w$ W6 S) M
  48. #else
    ; i3 q6 J' G8 u$ }! U9 q( p7 Q, _
  49. #define DMA_PRINTK( x... )
    * d6 A) L/ w: l; q' g0 h. K
  50. #define DMA_FN_IN2 n$ e% c6 ]9 V# S0 h
  51. #define DMA_FN_OUT0 m* t& D# f5 l( k: N7 R
  52. #endif
    0 b" b* W6 f: k  i0 S) ~

  53. 9 x/ R' m7 }' i2 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), h+ d. x+ D/ W3 A; h
  55. #define STATIC_SHIFT                3! e# T/ c% m4 c$ X" ]2 A5 I
  56. #define TCINTEN_SHIFT               20% n5 F6 Z# l# F; k
  57. #define ITCINTEN_SHIFT              21
    5 i3 b  I" c# M
  58. #define TCCHEN_SHIFT                220 Q# V. [& N% o& w
  59. #define ITCCHEN_SHIFT               23
    * ~: e- l' V! ?! h/ g/ _  w3 R/ T
  60. 3 \. |/ \. E7 J+ }' z: O) M8 e
  61. static volatile int irqraised1 = 0;
    ' Q( N& n: s$ z$ F/ i
  62. static volatile int irqraised2 = 0;; n. q( r  b' w% E
  63. 9 N" a0 k/ |* N+ A; O0 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [* z$ k: u7 ]+ d' M) S* T* }- g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & I+ {2 T; X' s, c4 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C' C' y3 V7 U/ E

  67. ! a( w1 n2 J7 r. n6 e3 I
  68. dma_addr_t dmaphyssrc1 = 0;
    5 V; z2 J( w+ M
  69. dma_addr_t dmaphyssrc2 = 0;; s8 \8 y0 P9 u; O
  70. dma_addr_t dmaphysdest1 = 0;
    # |0 h* R7 ?+ L$ \' g" v
  71. dma_addr_t dmaphysdest2 = 0;! s3 f+ Q2 ~9 i  d
  72. / v4 y3 G. ?: W, {6 ~2 ~
  73. char *dmabufsrc1 = NULL;- j9 {; i3 t( y7 d
  74. char *dmabufsrc2 = NULL;! T2 K+ B* Y) ~: c1 _
  75. char *dmabufdest1 = NULL;
    . a# D& I" h1 J' H
  76. char *dmabufdest2 = NULL;6 a$ w, \: `1 ?

  77. $ W5 I# |; Y/ x) V
  78. static int acnt = 512;
    8 a. x3 C$ B, ?4 n$ @
  79. static int bcnt = 8;1 X( z+ d  M, J+ ^! @$ l
  80. static int ccnt = 8;
      ^! ~9 J! F2 Y6 o1 q7 s
  81. 0 r; J6 |: x0 W' b7 K3 Y. Z4 X7 L
  82. module_param(acnt, int, S_IRUGO);
    # |! o( G. O! {/ e; I5 O
  83. module_param(bcnt, int, S_IRUGO);
    & w# l- |7 Z$ w# e/ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. _- y# t( k1 E$ m- `, W$ y
4 D& h4 {+ y3 @, e3 H) m/ v# u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" T/ z: y: s% e4 v- U- t9 A: U1 ?' b/ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C5 g  f8 w$ C- ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p5 f! T& o* i! G- k
1 D* i8 a) b1 J- ^# x9 t% d: n2 }" U% I9 ?7 B+ ~0 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-12-6 00:00 , Processed in 0.063058 second(s), 34 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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